@solidjs/signals 0.8.1 → 0.8.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
@@ -24,21 +24,21 @@ var SUPPORTS_PROXY = typeof Proxy === "function";
24
24
 
25
25
  // src/core/heap.ts
26
26
  function actualInsertIntoHeap(n, heap) {
27
- const parentHeight = (n.q?._ ? n.q.$?.c : n.q?.c) ?? -1;
27
+ const parentHeight = (n.w?.$ ? n.w.aa?.c : n.w?.c) ?? -1;
28
28
  if (parentHeight >= n.c)
29
29
  n.c = parentHeight + 1;
30
30
  const height = n.c;
31
- const heapAtHeight = heap.p[height];
31
+ const heapAtHeight = heap.s[height];
32
32
  if (heapAtHeight === void 0) {
33
- heap.p[height] = n;
33
+ heap.s[height] = n;
34
34
  } else {
35
- const tail = heapAtHeight.x;
36
- tail.P = n;
37
- n.x = tail;
38
- heapAtHeight.x = n;
35
+ const tail = heapAtHeight.z;
36
+ tail.Q = n;
37
+ n.z = tail;
38
+ heapAtHeight.z = n;
39
39
  }
40
- if (height > heap.J) {
41
- heap.J = height;
40
+ if (height > heap.L) {
41
+ heap.L = height;
42
42
  }
43
43
  }
44
44
  function insertIntoHeap(n, heap) {
@@ -66,28 +66,28 @@ function deleteFromHeap(n, heap) {
66
66
  return;
67
67
  n.b = flags & ~(8 /* InHeap */ | 16 /* InHeapHeight */);
68
68
  const height = n.c;
69
- if (n.x === n) {
70
- heap.p[height] = void 0;
69
+ if (n.z === n) {
70
+ heap.s[height] = void 0;
71
71
  } else {
72
- const next = n.P;
73
- const dhh = heap.p[height];
72
+ const next = n.Q;
73
+ const dhh = heap.s[height];
74
74
  const end = next ?? dhh;
75
75
  if (n === dhh) {
76
- heap.p[height] = next;
76
+ heap.s[height] = next;
77
77
  } else {
78
- n.x.P = next;
78
+ n.z.Q = next;
79
79
  }
80
- end.x = n.x;
80
+ end.z = n.z;
81
81
  }
82
- n.x = n;
83
- n.P = void 0;
82
+ n.z = n;
83
+ n.Q = void 0;
84
84
  }
85
85
  function markHeap(heap) {
86
- if (heap.aa)
86
+ if (heap.ba)
87
87
  return;
88
- heap.aa = true;
89
- for (let i = 0; i <= heap.J; i++) {
90
- for (let el = heap.p[i]; el !== void 0; el = el.P) {
88
+ heap.ba = true;
89
+ for (let i = 0; i <= heap.L; i++) {
90
+ for (let el = heap.s[i]; el !== void 0; el = el.Q) {
91
91
  if (el.b & 8 /* InHeap */)
92
92
  markNode(el);
93
93
  }
@@ -98,39 +98,39 @@ function markNode(el, newState = 2 /* Dirty */) {
98
98
  if ((flags & (1 /* Check */ | 2 /* Dirty */)) >= newState)
99
99
  return;
100
100
  el.b = flags & ~(1 /* Check */ | 2 /* Dirty */) | newState;
101
- for (let link2 = el.r; link2 !== null; link2 = link2.y) {
101
+ for (let link2 = el.x; link2 !== null; link2 = link2.A) {
102
102
  markNode(link2.j, 1 /* Check */);
103
103
  }
104
- if (el.ba !== null) {
105
- for (let child = el.ba; child !== null; child = child.ra) {
106
- for (let link2 = child.r; link2 !== null; link2 = link2.y) {
104
+ if (el.ca !== null) {
105
+ for (let child = el.ca; child !== null; child = child.sa) {
106
+ for (let link2 = child.x; link2 !== null; link2 = link2.A) {
107
107
  markNode(link2.j, 1 /* Check */);
108
108
  }
109
109
  }
110
110
  }
111
111
  }
112
112
  function runHeap(heap, recompute2) {
113
- heap.aa = false;
114
- for (heap.n = 0; heap.n <= heap.J; heap.n++) {
115
- let el = heap.p[heap.n];
113
+ heap.ba = false;
114
+ for (heap.q = 0; heap.q <= heap.L; heap.q++) {
115
+ let el = heap.s[heap.q];
116
116
  while (el !== void 0) {
117
117
  if (el.b & 8 /* InHeap */)
118
118
  recompute2(el);
119
119
  else {
120
120
  adjustHeight(el, heap);
121
121
  }
122
- el = heap.p[heap.n];
122
+ el = heap.s[heap.q];
123
123
  }
124
124
  }
125
- heap.J = 0;
125
+ heap.L = 0;
126
126
  }
127
127
  function adjustHeight(el, heap) {
128
128
  deleteFromHeap(el, heap);
129
129
  let newHeight = el.c;
130
- for (let d = el.u; d; d = d.E) {
131
- const dep1 = d.Q;
132
- const dep = "_owner" in dep1 ? dep1.z : dep1;
133
- if ("_fn" in dep) {
130
+ for (let d = el.l; d; d = d.E) {
131
+ const dep1 = d.R;
132
+ const dep = dep1.ia || dep1;
133
+ if (dep.H) {
134
134
  if (dep.c >= newHeight) {
135
135
  newHeight = dep.c + 1;
136
136
  }
@@ -138,7 +138,7 @@ function adjustHeight(el, heap) {
138
138
  }
139
139
  if (el.c !== newHeight) {
140
140
  el.c = newHeight;
141
- for (let s = el.r; s !== null; s = s.y) {
141
+ for (let s = el.x; s !== null; s = s.A) {
142
142
  insertIntoHeapHeight(s.j, heap);
143
143
  }
144
144
  }
@@ -147,83 +147,104 @@ function adjustHeight(el, heap) {
147
147
  // src/core/scheduler.ts
148
148
  var clock = 0;
149
149
  var activeTransition = null;
150
- var unobserved = [];
151
150
  var transitions = /* @__PURE__ */ new Set();
152
151
  var scheduled = false;
153
152
  function schedule() {
154
153
  if (scheduled)
155
154
  return;
156
155
  scheduled = true;
157
- if (!globalQueue.ca)
156
+ if (!globalQueue.da)
158
157
  queueMicrotask(flush);
159
158
  }
160
159
  var dirtyQueue = {
161
- p: new Array(2e3).fill(void 0),
162
- aa: false,
163
- n: 0,
164
- J: 0
160
+ s: new Array(2e3).fill(void 0),
161
+ ba: false,
162
+ q: 0,
163
+ L: 0
165
164
  };
166
165
  var zombieQueue = {
167
- p: new Array(2e3).fill(void 0),
168
- aa: false,
169
- n: 0,
170
- J: 0
166
+ s: new Array(2e3).fill(void 0),
167
+ ba: false,
168
+ q: 0,
169
+ L: 0
171
170
  };
172
171
  var Queue = class {
173
- q = null;
174
- A = [[], []];
175
- R = [];
172
+ w = null;
173
+ k = [[], []];
174
+ m = [];
176
175
  created = clock;
177
176
  addChild(child) {
178
- this.R.push(child);
179
- child.q = this;
177
+ this.m.push(child);
178
+ child.w = this;
180
179
  }
181
180
  removeChild(child) {
182
- const index = this.R.indexOf(child);
181
+ const index = this.m.indexOf(child);
183
182
  if (index >= 0) {
184
- this.R.splice(index, 1);
185
- child.q = null;
183
+ this.m.splice(index, 1);
184
+ child.w = null;
186
185
  }
187
186
  }
188
187
  notify(node, mask, flags) {
189
- if (this.q)
190
- return this.q.notify(node, mask, flags);
188
+ if (this.w)
189
+ return this.w.notify(node, mask, flags);
191
190
  return false;
192
191
  }
193
192
  run(type) {
194
- if (this.A[type - 1].length) {
195
- const effects = this.A[type - 1];
196
- this.A[type - 1] = [];
193
+ if (this.k[type - 1].length) {
194
+ const effects = this.k[type - 1];
195
+ this.k[type - 1] = [];
197
196
  runQueue(effects, type);
198
197
  }
199
- for (let i = 0; i < this.R.length; i++) {
200
- this.R[i].run(type);
198
+ for (let i = 0; i < this.m.length; i++) {
199
+ this.m[i].run(type);
201
200
  }
202
201
  }
203
202
  enqueue(type, fn) {
204
203
  if (type)
205
- this.A[type - 1].push(fn);
204
+ this.k[type - 1].push(fn);
206
205
  schedule();
207
206
  }
207
+ stashQueues(stub) {
208
+ stub.k[0].push(...this.k[0]);
209
+ stub.k[1].push(...this.k[1]);
210
+ this.k = [[], []];
211
+ for (let i = 0; i < this.m.length; i++) {
212
+ let child = this.m[i];
213
+ let childStub = stub.m[i];
214
+ if (!childStub) {
215
+ childStub = { k: [[], []], m: [] };
216
+ stub.m[i] = childStub;
217
+ }
218
+ child.stashQueues(childStub);
219
+ }
220
+ }
221
+ restoreQueues(stub) {
222
+ this.k[0].push(...stub.k[0]);
223
+ this.k[1].push(...stub.k[1]);
224
+ for (let i = 0; i < stub.m.length; i++) {
225
+ const childStub = stub.m[i];
226
+ let child = this.m[i];
227
+ if (child)
228
+ child.restoreQueues(childStub);
229
+ }
230
+ }
208
231
  };
209
232
  var GlobalQueue = class _GlobalQueue extends Queue {
210
- ca = false;
233
+ da = false;
211
234
  h = [];
212
235
  static S;
213
236
  static la;
214
237
  flush() {
215
- if (this.ca)
238
+ if (this.da)
216
239
  return;
217
- this.ca = true;
240
+ this.da = true;
218
241
  try {
219
242
  runHeap(dirtyQueue, _GlobalQueue.S);
220
243
  if (activeTransition) {
221
244
  if (!transitionComplete(activeTransition)) {
222
245
  runHeap(zombieQueue, _GlobalQueue.S);
223
246
  globalQueue.h = [];
224
- activeTransition.queues[0].push(...globalQueue.A[0]);
225
- activeTransition.queues[1].push(...globalQueue.A[1]);
226
- globalQueue.A = [[], []];
247
+ globalQueue.stashQueues(activeTransition.queueStash);
227
248
  clock++;
228
249
  scheduled = false;
229
250
  runPending(activeTransition.pendingNodes, true);
@@ -231,8 +252,7 @@ var GlobalQueue = class _GlobalQueue extends Queue {
231
252
  return;
232
253
  }
233
254
  globalQueue.h.push(...activeTransition.pendingNodes);
234
- globalQueue.A[0].push(...activeTransition.queues[0]);
235
- globalQueue.A[1].push(...activeTransition.queues[1]);
255
+ globalQueue.restoreQueues(activeTransition.queueStash);
236
256
  transitions.delete(activeTransition);
237
257
  activeTransition = null;
238
258
  if (runPending(globalQueue.h, false))
@@ -245,7 +265,7 @@ var GlobalQueue = class _GlobalQueue extends Queue {
245
265
  n.g = n.e;
246
266
  n.e = NOT_PENDING;
247
267
  }
248
- if (n.ha)
268
+ if (n.H)
249
269
  _GlobalQueue.la(n, false, true);
250
270
  }
251
271
  globalQueue.h.length = 0;
@@ -254,8 +274,7 @@ var GlobalQueue = class _GlobalQueue extends Queue {
254
274
  this.run(1 /* Render */);
255
275
  this.run(2 /* User */);
256
276
  } finally {
257
- this.ca = false;
258
- unobserved.length && notifyUnobserved();
277
+ this.da = false;
259
278
  }
260
279
  }
261
280
  notify(node, mask, flags) {
@@ -276,7 +295,7 @@ var GlobalQueue = class _GlobalQueue extends Queue {
276
295
  time: clock,
277
296
  pendingNodes: [],
278
297
  asyncNodes: [],
279
- queues: [[], []]
298
+ queueStash: { k: [[], []], m: [] }
280
299
  };
281
300
  }
282
301
  transitions.add(activeTransition);
@@ -295,8 +314,8 @@ function runPending(pendingNodes, value) {
295
314
  for (let i = 0; i < p.length; i++) {
296
315
  const n = p[i];
297
316
  n.T = activeTransition;
298
- if (n.G) {
299
- n.G.da(value);
317
+ if (n.I) {
318
+ n.I.ea(value);
300
319
  needsReset = true;
301
320
  }
302
321
  }
@@ -322,14 +341,6 @@ function transitionComplete(transition) {
322
341
  }
323
342
  return done;
324
343
  }
325
- function notifyUnobserved() {
326
- for (let i = 0; i < unobserved.length; i++) {
327
- const source = unobserved[i];
328
- if (!source.r)
329
- unobserved[i].sa?.();
330
- }
331
- unobserved = [];
332
- }
333
344
 
334
345
  // src/core/core.ts
335
346
  GlobalQueue.S = recompute;
@@ -340,6 +351,14 @@ var pendingValueCheck = false;
340
351
  var pendingCheck = null;
341
352
  var context = null;
342
353
  var defaultContext = {};
354
+ function notifySubs(node) {
355
+ for (let s = node.x; s !== null; s = s.A) {
356
+ const queue = s.j.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue;
357
+ if (queue.q > s.j.c)
358
+ queue.q = s.j.c;
359
+ insertIntoHeap(s.j, queue);
360
+ }
361
+ }
343
362
  function recompute(el, create = false) {
344
363
  deleteFromHeap(el, el.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue);
345
364
  if (el.e !== NOT_PENDING || el.U || el.V)
@@ -347,16 +366,16 @@ function recompute(el, create = false) {
347
366
  else {
348
367
  markDisposal(el);
349
368
  globalQueue.h.push(el);
350
- el.V = el.s;
351
- el.U = el.o;
352
- el.s = null;
353
- el.o = null;
369
+ el.V = el.t;
370
+ el.U = el.r;
371
+ el.t = null;
372
+ el.r = null;
354
373
  }
355
374
  const oldcontext = context;
356
375
  context = el;
357
- el.H = null;
376
+ el.F = null;
358
377
  el.b = 4 /* RecomputingDeps */;
359
- el.W = clock;
378
+ el.J = clock;
360
379
  let value = el.e === NOT_PENDING ? el.g : el.e;
361
380
  let oldHeight = el.c;
362
381
  let prevStatusFlags = el.f;
@@ -365,7 +384,7 @@ function recompute(el, create = false) {
365
384
  clearStatusFlags(el);
366
385
  tracking = true;
367
386
  try {
368
- value = el.ha(value);
387
+ value = el.H(value);
369
388
  } catch (e) {
370
389
  if (e instanceof NotReadyError) {
371
390
  if (e.cause !== el)
@@ -379,8 +398,8 @@ function recompute(el, create = false) {
379
398
  }
380
399
  el.b = 0 /* None */;
381
400
  context = oldcontext;
382
- const depsTail = el.H;
383
- let toRemove = depsTail !== null ? depsTail.E : el.u;
401
+ const depsTail = el.F;
402
+ let toRemove = depsTail !== null ? depsTail.E : el.l;
384
403
  if (toRemove !== null) {
385
404
  do {
386
405
  toRemove = unlinkSubs(toRemove);
@@ -388,15 +407,15 @@ function recompute(el, create = false) {
388
407
  if (depsTail !== null) {
389
408
  depsTail.E = null;
390
409
  } else {
391
- el.u = null;
410
+ el.l = null;
392
411
  }
393
412
  }
394
- const valueChanged = !el.ea || !el.ea(el.e === NOT_PENDING ? el.g : el.e, value);
413
+ const valueChanged = !el.fa || !el.fa(el.e === NOT_PENDING ? el.g : el.e, value);
395
414
  const statusFlagsChanged = el.f !== prevStatusFlags || el.B !== prevError;
396
415
  el.ma?.(statusFlagsChanged, prevStatusFlags);
397
416
  if (valueChanged || statusFlagsChanged) {
398
417
  if (valueChanged) {
399
- if (create || el.ia || el.I)
418
+ if (create || el.ja || el.K)
400
419
  el.g = value;
401
420
  else {
402
421
  if (el.e === NOT_PENDING)
@@ -404,26 +423,26 @@ function recompute(el, create = false) {
404
423
  el.e = value;
405
424
  }
406
425
  if (el.C)
407
- el.C.da(value);
426
+ el.C.ea(value);
408
427
  }
409
- for (let s = el.r; s !== null; s = s.y) {
428
+ for (let s = el.x; s !== null; s = s.A) {
410
429
  const queue = s.j.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue;
411
- if (s.j.c < el.c && queue.n > s.j.c)
412
- queue.n = s.j.c;
430
+ if (s.j.c < el.c && queue.q > s.j.c)
431
+ queue.q = s.j.c;
413
432
  insertIntoHeap(s.j, queue);
414
433
  }
415
434
  } else if (el.c != oldHeight) {
416
- for (let s = el.r; s !== null; s = s.y) {
435
+ for (let s = el.x; s !== null; s = s.A) {
417
436
  insertIntoHeapHeight(s.j, s.j.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue);
418
437
  }
419
438
  }
420
439
  }
421
440
  function updateIfNecessary(el) {
422
441
  if (el.b & 1 /* Check */) {
423
- for (let d = el.u; d; d = d.E) {
424
- const dep1 = d.Q;
425
- const dep = "_owner" in dep1 ? dep1.z : dep1;
426
- if ("_fn" in dep) {
442
+ for (let d = el.l; d; d = d.E) {
443
+ const dep1 = d.R;
444
+ const dep = dep1.ia || dep1;
445
+ if (dep.H) {
427
446
  updateIfNecessary(dep);
428
447
  }
429
448
  if (el.b & 2 /* Dirty */) {
@@ -437,62 +456,75 @@ function updateIfNecessary(el) {
437
456
  el.b = 0 /* None */;
438
457
  }
439
458
  function unlinkSubs(link2) {
440
- const dep = link2.Q;
459
+ const dep = link2.R;
441
460
  const nextDep = link2.E;
442
- const nextSub = link2.y;
461
+ const nextSub = link2.A;
443
462
  const prevSub = link2.na;
444
463
  if (nextSub !== null) {
445
464
  nextSub.na = prevSub;
446
465
  } else {
447
- dep.X = prevSub;
466
+ dep.W = prevSub;
448
467
  }
449
468
  if (prevSub !== null) {
450
- prevSub.y = nextSub;
469
+ prevSub.A = nextSub;
451
470
  } else {
452
- dep.r = nextSub;
471
+ dep.x = nextSub;
472
+ if (nextSub === null) {
473
+ dep.ta?.();
474
+ dep.H && unobserved(dep);
475
+ }
453
476
  }
454
477
  return nextDep;
455
478
  }
479
+ function unobserved(el) {
480
+ deleteFromHeap(el, el.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue);
481
+ let dep = el.l;
482
+ while (dep !== null) {
483
+ dep = unlinkSubs(dep);
484
+ }
485
+ el.l = null;
486
+ runDisposal(el);
487
+ }
456
488
  function link(dep, sub) {
457
- const prevDep = sub.H;
458
- if (prevDep !== null && prevDep.Q === dep) {
489
+ const prevDep = sub.F;
490
+ if (prevDep !== null && prevDep.R === dep) {
459
491
  return;
460
492
  }
461
493
  let nextDep = null;
462
494
  const isRecomputing = sub.b & 4 /* RecomputingDeps */;
463
495
  if (isRecomputing) {
464
- nextDep = prevDep !== null ? prevDep.E : sub.u;
465
- if (nextDep !== null && nextDep.Q === dep) {
466
- sub.H = nextDep;
496
+ nextDep = prevDep !== null ? prevDep.E : sub.l;
497
+ if (nextDep !== null && nextDep.R === dep) {
498
+ sub.F = nextDep;
467
499
  return;
468
500
  }
469
501
  }
470
- const prevSub = dep.X;
502
+ const prevSub = dep.W;
471
503
  if (prevSub !== null && prevSub.j === sub && (!isRecomputing || isValidLink(prevSub, sub))) {
472
504
  return;
473
505
  }
474
- const newLink = sub.H = dep.X = {
475
- Q: dep,
506
+ const newLink = sub.F = dep.W = {
507
+ R: dep,
476
508
  j: sub,
477
509
  E: nextDep,
478
510
  na: prevSub,
479
- y: null
511
+ A: null
480
512
  };
481
513
  if (prevDep !== null) {
482
514
  prevDep.E = newLink;
483
515
  } else {
484
- sub.u = newLink;
516
+ sub.l = newLink;
485
517
  }
486
518
  if (prevSub !== null) {
487
- prevSub.y = newLink;
519
+ prevSub.A = newLink;
488
520
  } else {
489
- dep.r = newLink;
521
+ dep.x = newLink;
490
522
  }
491
523
  }
492
524
  function isValidLink(checkLink, sub) {
493
- const depsTail = sub.H;
525
+ const depsTail = sub.F;
494
526
  if (depsTail !== null) {
495
- let link2 = sub.u;
527
+ let link2 = sub.l;
496
528
  do {
497
529
  if (link2 === checkLink) {
498
530
  return true;
@@ -510,13 +542,13 @@ function setStatusFlags(signal2, flags, error = null) {
510
542
  signal2.B = error;
511
543
  }
512
544
  function setError(signal2, error) {
513
- setStatusFlags(signal2, 2 /* Error */ | 4 /* Uninitialized */, error);
545
+ setStatusFlags(signal2, 2 /* Error */, error);
514
546
  }
515
547
  function clearStatusFlags(signal2) {
516
548
  setStatusFlags(signal2, 0 /* None */);
517
549
  }
518
550
  function markDisposal(el) {
519
- let child = el.o;
551
+ let child = el.r;
520
552
  while (child) {
521
553
  child.b |= 32 /* Zombie */;
522
554
  const inHeap = child.b & 8 /* InHeap */;
@@ -525,26 +557,35 @@ function markDisposal(el) {
525
557
  insertIntoHeap(child, zombieQueue);
526
558
  }
527
559
  markDisposal(child);
528
- child = child.K;
560
+ child = child.M;
529
561
  }
530
562
  }
563
+ function dispose(node) {
564
+ let toRemove = node.l || null;
565
+ do {
566
+ toRemove = unlinkSubs(toRemove);
567
+ } while (toRemove !== null);
568
+ node.l = null;
569
+ node.F = null;
570
+ disposeChildren(node, true);
571
+ }
531
572
  function disposeChildren(node, self = false, zombie) {
532
573
  if (node.b & 64 /* Disposed */)
533
574
  return;
534
575
  if (self)
535
576
  node.b = 64 /* Disposed */;
536
- let child = zombie ? node.U : node.o;
577
+ let child = zombie ? node.U : node.r;
537
578
  while (child) {
538
- const nextChild = child.K;
539
- if (child.u) {
579
+ const nextChild = child.M;
580
+ if (child.l) {
540
581
  const n = child;
541
582
  deleteFromHeap(n, n.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue);
542
- let toRemove = n.u;
583
+ let toRemove = n.l;
543
584
  do {
544
585
  toRemove = unlinkSubs(toRemove);
545
586
  } while (toRemove !== null);
546
- n.u = null;
547
- n.H = null;
587
+ n.l = null;
588
+ n.F = null;
548
589
  }
549
590
  disposeChildren(child, true);
550
591
  child = nextChild;
@@ -552,13 +593,13 @@ function disposeChildren(node, self = false, zombie) {
552
593
  if (zombie) {
553
594
  node.U = null;
554
595
  } else {
555
- node.o = null;
556
- node.K = null;
596
+ node.r = null;
597
+ node.M = null;
557
598
  }
558
599
  runDisposal(node, zombie);
559
600
  }
560
601
  function runDisposal(node, zombie) {
561
- let disposal = zombie ? node.V : node.s;
602
+ let disposal = zombie ? node.V : node.t;
562
603
  if (!disposal)
563
604
  return;
564
605
  if (Array.isArray(disposal)) {
@@ -569,15 +610,15 @@ function runDisposal(node, zombie) {
569
610
  } else {
570
611
  disposal.call(disposal);
571
612
  }
572
- zombie ? node.V = null : node.s = null;
613
+ zombie ? node.V = null : node.t = null;
573
614
  }
574
615
  function withOptions(obj, options) {
575
616
  obj.id = options?.id ?? (context?.id != null ? getNextChildId(context) : void 0);
576
- obj.ea = options?.equals != null ? options.equals : isEqual;
577
- obj.ya = !!options?.pureWrite;
578
- obj.sa = options?.unobserved;
579
- if (options?.ja)
580
- Object.assign(obj, options.ja);
617
+ obj.fa = options?.equals != null ? options.equals : isEqual;
618
+ obj.za = !!options?.pureWrite;
619
+ obj.ta = options?.unobserved;
620
+ if (options?.ka)
621
+ Object.assign(obj, options.ka);
581
622
  return obj;
582
623
  }
583
624
  function getNextChildId(owner) {
@@ -592,43 +633,43 @@ function formatId(prefix, id) {
592
633
  function computed(fn, initialValue, options) {
593
634
  const self = withOptions(
594
635
  {
595
- s: null,
636
+ t: null,
596
637
  i: globalQueue,
597
638
  D: defaultContext,
598
639
  oa: 0,
599
- ha: fn,
640
+ H: fn,
600
641
  g: initialValue,
601
642
  c: 0,
602
- ba: null,
603
- P: void 0,
643
+ ca: null,
644
+ Q: void 0,
645
+ z: null,
646
+ l: null,
647
+ F: null,
604
648
  x: null,
605
- u: null,
606
- H: null,
649
+ W: null,
650
+ w: context,
651
+ M: null,
607
652
  r: null,
608
- X: null,
609
- q: context,
610
- K: null,
611
- o: null,
612
653
  b: 0 /* None */,
613
654
  f: 4 /* Uninitialized */,
614
- W: clock,
655
+ J: clock,
615
656
  e: NOT_PENDING,
616
657
  V: null,
617
658
  U: null
618
659
  },
619
660
  options
620
661
  );
621
- self.x = self;
622
- const parent = context?._ ? context.$ : context;
662
+ self.z = self;
663
+ const parent = context?.$ ? context.aa : context;
623
664
  if (context) {
624
665
  context.i && (self.i = context.i);
625
666
  context.D && (self.D = context.D);
626
- const lastChild = context.o;
667
+ const lastChild = context.r;
627
668
  if (lastChild === null) {
628
- context.o = self;
669
+ context.r = self;
629
670
  } else {
630
- self.K = lastChild;
631
- context.o = self;
671
+ self.M = lastChild;
672
+ context.r = self;
632
673
  }
633
674
  }
634
675
  if (parent)
@@ -660,6 +701,9 @@ function asyncComputed(asyncFn, initialValue, options) {
660
701
  return;
661
702
  globalQueue.initTransition(self);
662
703
  setError(self, e);
704
+ self.J = clock;
705
+ notifySubs(self);
706
+ schedule();
663
707
  flush();
664
708
  });
665
709
  } else {
@@ -677,6 +721,9 @@ function asyncComputed(asyncFn, initialValue, options) {
677
721
  return;
678
722
  globalQueue.initTransition(self);
679
723
  setError(self, error);
724
+ self.J = clock;
725
+ notifySubs(self);
726
+ schedule();
680
727
  flush();
681
728
  }
682
729
  })();
@@ -685,7 +732,7 @@ function asyncComputed(asyncFn, initialValue, options) {
685
732
  throw new NotReadyError(context);
686
733
  };
687
734
  const self = computed(fn, initialValue, options);
688
- self.ta = () => {
735
+ self.ua = () => {
689
736
  refreshing = true;
690
737
  recompute(self);
691
738
  flush();
@@ -694,15 +741,15 @@ function asyncComputed(asyncFn, initialValue, options) {
694
741
  }
695
742
  function signal(v, options, firewall = null) {
696
743
  if (firewall !== null) {
697
- return firewall.ba = withOptions(
744
+ return firewall.ca = withOptions(
698
745
  {
699
746
  g: v,
700
- r: null,
701
- X: null,
702
- z: firewall,
703
- ra: firewall.ba,
747
+ x: null,
748
+ W: null,
749
+ ia: firewall,
750
+ sa: firewall.ca,
704
751
  f: 0 /* None */,
705
- W: clock,
752
+ J: clock,
706
753
  e: NOT_PENDING
707
754
  },
708
755
  options
@@ -711,10 +758,10 @@ function signal(v, options, firewall = null) {
711
758
  return withOptions(
712
759
  {
713
760
  g: v,
714
- r: null,
715
- X: null,
761
+ x: null,
762
+ W: null,
716
763
  f: 0 /* None */,
717
- W: clock,
764
+ J: clock,
718
765
  e: NOT_PENDING
719
766
  },
720
767
  options
@@ -736,34 +783,34 @@ function untrack(fn) {
736
783
  }
737
784
  function read(el) {
738
785
  let c = context;
739
- if (c?._)
740
- c = c.$;
786
+ if (c?.$)
787
+ c = c.aa;
741
788
  if (c && tracking) {
742
789
  link(el, c);
743
- const owner = "_owner" in el ? el.z : el;
744
- if ("_fn" in owner) {
790
+ const owner = el.ia || el;
791
+ if (owner.H) {
745
792
  const isZombie = el.b & 32 /* Zombie */;
746
- if (owner.c >= (isZombie ? zombieQueue.n : dirtyQueue.n)) {
793
+ if (owner.c >= (isZombie ? zombieQueue.q : dirtyQueue.q)) {
747
794
  markNode(c);
748
795
  markHeap(isZombie ? zombieQueue : dirtyQueue);
749
796
  updateIfNecessary(owner);
750
797
  }
751
798
  const height = owner.c;
752
- if (height >= c.c && el.q !== c) {
799
+ if (height >= c.c && el.w !== c) {
753
800
  c.c = height + 1;
754
801
  }
755
802
  }
756
803
  }
757
804
  if (pendingCheck) {
758
805
  const pendingResult = (el.f & 1 /* Pending */) !== 0 || !!el.T || false;
759
- if (!el.G) {
760
- el.G = signal(pendingResult);
761
- el.G.ia = true;
762
- el.G.da = (v) => setSignal(el.G, v);
806
+ if (!el.I) {
807
+ el.I = signal(pendingResult);
808
+ el.I.ja = true;
809
+ el.I.ea = (v) => setSignal(el.I, v);
763
810
  }
764
811
  const prev = pendingCheck;
765
812
  pendingCheck = null;
766
- read(el.G);
813
+ read(el.I);
767
814
  pendingCheck = prev;
768
815
  prev.g = pendingResult || prev.g;
769
816
  }
@@ -772,8 +819,8 @@ function read(el) {
772
819
  el.C = signal(
773
820
  el.e === NOT_PENDING ? el.g : el.e
774
821
  );
775
- el.C.ia = true;
776
- el.C.da = (v) => queueMicrotask(() => queueMicrotask(() => setSignal(el.C, v)));
822
+ el.C.ja = true;
823
+ el.C.ea = (v) => queueMicrotask(() => queueMicrotask(() => setSignal(el.C, v)));
777
824
  }
778
825
  pendingValueCheck = false;
779
826
  try {
@@ -794,7 +841,7 @@ function read(el) {
794
841
  }
795
842
  }
796
843
  if (el.f & 2 /* Error */) {
797
- if (el.W < clock) {
844
+ if (el.J < clock) {
798
845
  recompute(el, true);
799
846
  return read(el);
800
847
  } else {
@@ -809,11 +856,11 @@ function setSignal(el, v) {
809
856
  el.e === NOT_PENDING ? el.g : el.e
810
857
  );
811
858
  }
812
- const valueChanged = !el.ea || !el.ea(el.e === NOT_PENDING ? el.g : el.e, v);
859
+ const valueChanged = !el.fa || !el.fa(el.e === NOT_PENDING ? el.g : el.e, v);
813
860
  if (!valueChanged && !el.f)
814
861
  return v;
815
862
  if (valueChanged) {
816
- if (el.ia)
863
+ if (el.ja)
817
864
  el.g = v;
818
865
  else {
819
866
  if (el.e === NOT_PENDING)
@@ -821,16 +868,11 @@ function setSignal(el, v) {
821
868
  el.e = v;
822
869
  }
823
870
  if (el.C)
824
- el.C.da(v);
871
+ el.C.ea(v);
825
872
  }
826
873
  clearStatusFlags(el);
827
- el.W = clock;
828
- for (let s = el.r; s !== null; s = s.y) {
829
- const queue = s.j.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue;
830
- if (queue.n > s.j.c)
831
- queue.n = s.j.c;
832
- insertIntoHeap(s.j, queue);
833
- }
874
+ el.J = clock;
875
+ notifySubs(el);
834
876
  schedule();
835
877
  return v;
836
878
  }
@@ -844,41 +886,41 @@ function onCleanup(fn) {
844
886
  if (!context)
845
887
  return fn;
846
888
  const node = context;
847
- if (!node.s) {
848
- node.s = fn;
849
- } else if (Array.isArray(node.s)) {
850
- node.s.push(fn);
889
+ if (!node.t) {
890
+ node.t = fn;
891
+ } else if (Array.isArray(node.t)) {
892
+ node.t.push(fn);
851
893
  } else {
852
- node.s = [node.s, fn];
894
+ node.t = [node.t, fn];
853
895
  }
854
896
  return fn;
855
897
  }
856
898
  function createOwner(options) {
857
899
  const parent = context;
858
900
  const owner = {
859
- _: true,
860
- $: parent?._ ? parent.$ : parent,
861
- o: null,
862
- K: null,
863
- s: null,
901
+ $: true,
902
+ aa: parent?.$ ? parent.aa : parent,
903
+ r: null,
904
+ M: null,
905
+ t: null,
864
906
  id: options?.id ?? (parent?.id != null ? getNextChildId(parent) : void 0),
865
907
  i: parent?.i ?? globalQueue,
866
908
  D: parent?.D || defaultContext,
867
909
  oa: 0,
868
910
  V: null,
869
911
  U: null,
870
- q: parent,
912
+ w: parent,
871
913
  dispose(self = true) {
872
914
  disposeChildren(owner, self);
873
915
  }
874
916
  };
875
917
  if (parent) {
876
- const lastChild = parent.o;
918
+ const lastChild = parent.r;
877
919
  if (lastChild === null) {
878
- parent.o = owner;
920
+ parent.r = owner;
879
921
  } else {
880
- owner.K = lastChild;
881
- parent.o = owner;
922
+ owner.M = lastChild;
923
+ parent.r = owner;
882
924
  }
883
925
  }
884
926
  return owner;
@@ -966,29 +1008,29 @@ function effect(compute, effect2, error, initialValue, options) {
966
1008
  let initialized = false;
967
1009
  const node = computed(compute, initialValue, {
968
1010
  ...options,
969
- ja: {
970
- fa: true,
1011
+ ka: {
1012
+ ga: true,
971
1013
  pa: initialValue,
972
- ua: effect2,
1014
+ va: effect2,
973
1015
  qa: error,
974
- L: void 0,
1016
+ N: void 0,
975
1017
  i: getOwner()?.i ?? globalQueue,
976
- I: options?.render ? 1 /* Render */ : 2 /* User */,
1018
+ K: options?.render ? 1 /* Render */ : 2 /* User */,
977
1019
  ma(statusFlagsChanged, prevStatusFlags) {
978
1020
  if (initialized) {
979
1021
  const errorChanged = this.f && this.f === prevStatusFlags && statusFlagsChanged;
980
- this.fa = !(this.f & 2 /* Error */) && !(this.f & 1 /* Pending */ & ~prevStatusFlags) && !errorChanged;
981
- if (this.fa)
982
- this.i.enqueue(this.I, runEffect.bind(this));
1022
+ this.ga = !(this.f & 2 /* Error */) && !(this.f & 1 /* Pending */ & ~prevStatusFlags) && !errorChanged;
1023
+ if (this.ga)
1024
+ this.i.enqueue(this.K, runEffect.bind(this));
983
1025
  }
984
1026
  if (this.f & 2 /* Error */) {
985
1027
  let error2 = this.B;
986
1028
  this.i.notify(this, 1 /* Pending */, 0);
987
- if (this.I === 2 /* User */) {
1029
+ if (this.K === 2 /* User */) {
988
1030
  try {
989
1031
  return this.qa ? this.qa(error2, () => {
990
- this.L?.();
991
- this.L = void 0;
1032
+ this.N?.();
1033
+ this.N = void 0;
992
1034
  }) : console.error(error2);
993
1035
  } catch (e) {
994
1036
  error2 = e;
@@ -996,7 +1038,7 @@ function effect(compute, effect2, error, initialValue, options) {
996
1038
  }
997
1039
  if (!this.i.notify(this, 2 /* Error */, 2 /* Error */))
998
1040
  throw error2;
999
- } else if (this.I === 1 /* Render */) {
1041
+ } else if (this.K === 1 /* Render */) {
1000
1042
  this.i.notify(
1001
1043
  this,
1002
1044
  1 /* Pending */ | 2 /* Error */,
@@ -1007,25 +1049,24 @@ function effect(compute, effect2, error, initialValue, options) {
1007
1049
  }
1008
1050
  });
1009
1051
  initialized = true;
1010
- if (node.I === 1 /* Render */) {
1011
- node.ha = (p) => !(node.f & 2 /* Error */) ? staleValues(() => compute(p)) : compute(p);
1012
- }
1013
- !options?.defer && !(node.f & (2 /* Error */ | 1 /* Pending */)) && (node.I === 2 /* User */ ? node.i.enqueue(node.I, runEffect.bind(node)) : runEffect.call(node));
1014
- onCleanup(() => node.L?.());
1052
+ if (node.K === 1 /* Render */)
1053
+ node.H = (p) => staleValues(() => compute(p));
1054
+ !options?.defer && !(node.f & (2 /* Error */ | 1 /* Pending */)) && (node.K === 2 /* User */ ? node.i.enqueue(node.K, runEffect.bind(node)) : runEffect.call(node));
1055
+ onCleanup(() => node.N?.());
1015
1056
  }
1016
1057
  function runEffect() {
1017
- if (!this.fa || this.b & 64 /* Disposed */)
1058
+ if (!this.ga || this.b & 64 /* Disposed */)
1018
1059
  return;
1019
- this.L?.();
1020
- this.L = void 0;
1060
+ this.N?.();
1061
+ this.N = void 0;
1021
1062
  try {
1022
- this.L = this.ua(this.g, this.pa);
1063
+ this.N = this.va(this.g, this.pa);
1023
1064
  } catch (error) {
1024
1065
  if (!this.i.notify(this, 2 /* Error */, 2 /* Error */))
1025
1066
  throw error;
1026
1067
  } finally {
1027
1068
  this.pa = this.g;
1028
- this.fa = false;
1069
+ this.ga = false;
1029
1070
  }
1030
1071
  }
1031
1072
 
@@ -1056,7 +1097,7 @@ function createMemo(compute, value, options) {
1056
1097
  function createAsync(compute, value, options) {
1057
1098
  const node = asyncComputed(compute, value, options);
1058
1099
  const ret = read.bind(null, node);
1059
- ret.refresh = node.ta;
1100
+ ret.refresh = node.ua;
1060
1101
  return ret;
1061
1102
  }
1062
1103
  function createEffect(compute, effectFn, value, options) {
@@ -1076,11 +1117,29 @@ function createRenderEffect(compute, effectFn, value, options) {
1076
1117
  }
1077
1118
  function createTrackedEffect(compute, options) {
1078
1119
  }
1079
- function createReaction(effect2, options) {
1120
+ function createReaction(effectFn, options) {
1121
+ let cleanup = void 0;
1122
+ onCleanup(() => cleanup?.());
1123
+ return (tracking2) => {
1124
+ effect(
1125
+ () => (tracking2(), getOwner()),
1126
+ (node) => {
1127
+ cleanup?.();
1128
+ cleanup = (effectFn.effect || effectFn)?.();
1129
+ dispose(node);
1130
+ },
1131
+ effectFn.error,
1132
+ void 0,
1133
+ {
1134
+ defer: true,
1135
+ ...options
1136
+ }
1137
+ );
1138
+ };
1080
1139
  }
1081
1140
  function resolve(fn) {
1082
1141
  return new Promise((res, rej) => {
1083
- createRoot((dispose) => {
1142
+ createRoot((dispose2) => {
1084
1143
  computed(() => {
1085
1144
  try {
1086
1145
  res(fn());
@@ -1089,7 +1148,7 @@ function resolve(fn) {
1089
1148
  throw err;
1090
1149
  rej(err);
1091
1150
  }
1092
- dispose();
1151
+ dispose2();
1093
1152
  });
1094
1153
  });
1095
1154
  });
@@ -1098,6 +1157,14 @@ function createOptimistic(first, second, third) {
1098
1157
  return {};
1099
1158
  }
1100
1159
  function onSettled(callback) {
1160
+ let cleanup;
1161
+ const o = getOwner();
1162
+ if (o)
1163
+ onCleanup(() => cleanup?.());
1164
+ globalQueue.enqueue(2 /* User */, () => {
1165
+ cleanup = callback();
1166
+ !o && cleanup?.();
1167
+ });
1101
1168
  }
1102
1169
 
1103
1170
  // src/store/reconcile.ts
@@ -1233,23 +1300,17 @@ function reconcile(value, key, all = false) {
1233
1300
  function createProjectionInternal(fn, initialValue = {}, options) {
1234
1301
  let node;
1235
1302
  const wrappedMap = /* @__PURE__ */ new WeakMap();
1236
- const traps = {
1237
- ...storeTraps,
1238
- get(target, property, receiver) {
1239
- const o = getOwner();
1240
- const n = node;
1241
- (!o || o !== n) && n && read(n);
1242
- return storeTraps.get(target, property, receiver);
1243
- }
1244
- };
1245
1303
  const wrapProjection = (source) => {
1246
1304
  if (wrappedMap.has(source))
1247
1305
  return wrappedMap.get(source);
1248
1306
  if (source[$TARGET]?.[STORE_WRAP] === wrapProjection)
1249
1307
  return source;
1250
- const wrapped = createStoreProxy(source, traps, {
1308
+ const wrapped = createStoreProxy(source, storeTraps, {
1251
1309
  [STORE_WRAP]: wrapProjection,
1252
- [STORE_LOOKUP]: wrappedMap
1310
+ [STORE_LOOKUP]: wrappedMap,
1311
+ [STORE_FIREWALL]() {
1312
+ return node;
1313
+ }
1253
1314
  });
1254
1315
  wrappedMap.set(source, wrapped);
1255
1316
  return wrapped;
@@ -1282,6 +1343,7 @@ var STORE_NODE = "n";
1282
1343
  var STORE_HAS = "h";
1283
1344
  var STORE_WRAP = "w";
1284
1345
  var STORE_LOOKUP = "l";
1346
+ var STORE_FIREWALL = "f";
1285
1347
  function createStoreProxy(value, traps = storeTraps, extend) {
1286
1348
  let newTarget;
1287
1349
  if (Array.isArray(value)) {
@@ -1310,18 +1372,24 @@ function getNodes(target, type) {
1310
1372
  target[type] = nodes = /* @__PURE__ */ Object.create(null);
1311
1373
  return nodes;
1312
1374
  }
1313
- function getNode(nodes, property, value, equals = isEqual) {
1375
+ function getNode(nodes, property, value, firewall, equals = isEqual) {
1314
1376
  if (nodes[property])
1315
1377
  return nodes[property];
1316
- return nodes[property] = signal(value, {
1317
- equals,
1318
- unobserved() {
1319
- delete nodes[property];
1320
- }
1321
- });
1378
+ return nodes[property] = signal(
1379
+ value,
1380
+ {
1381
+ equals,
1382
+ unobserved() {
1383
+ delete nodes[property];
1384
+ }
1385
+ },
1386
+ firewall
1387
+ );
1322
1388
  }
1323
1389
  function trackSelf(target, symbol = $TRACK) {
1324
- getObserver() && read(getNode(getNodes(target, STORE_NODE), symbol, void 0, false));
1390
+ getObserver() && read(
1391
+ getNode(getNodes(target, STORE_NODE), symbol, void 0, target[STORE_FIREWALL]?.(), false)
1392
+ );
1325
1393
  }
1326
1394
  function getKeys(source, override, enumerable = true) {
1327
1395
  const baseKeys = untrack(() => enumerable ? Object.keys(source) : Reflect.ownKeys(source));
@@ -1384,7 +1452,14 @@ var storeTraps = {
1384
1452
  let proto;
1385
1453
  return !Array.isArray(target[STORE_VALUE]) && (proto = Object.getPrototypeOf(target[STORE_VALUE])) && proto !== Object.prototype ? value.bind(storeValue) : value;
1386
1454
  } else if (getObserver()) {
1387
- return read(getNode(nodes, property, isWrappable(value) ? wrap(value, target) : value));
1455
+ return read(
1456
+ getNode(
1457
+ nodes,
1458
+ property,
1459
+ isWrappable(value) ? wrap(value, target) : value,
1460
+ target[STORE_FIREWALL]?.()
1461
+ )
1462
+ );
1388
1463
  }
1389
1464
  }
1390
1465
  return isWrappable(value) ? wrap(value, target) : value;
@@ -1393,7 +1468,7 @@ var storeTraps = {
1393
1468
  if (property === $PROXY || property === $TRACK || property === "__proto__")
1394
1469
  return true;
1395
1470
  const has = target[STORE_OVERRIDE] && property in target[STORE_OVERRIDE] ? target[STORE_OVERRIDE][property] !== $DELETED : property in target[STORE_VALUE];
1396
- getObserver() && read(getNode(getNodes(target, STORE_HAS), property, has));
1471
+ getObserver() && read(getNode(getNodes(target, STORE_HAS), property, has, target[STORE_FIREWALL]?.()));
1397
1472
  return has;
1398
1473
  },
1399
1474
  set(target, property, rawValue) {
@@ -1768,52 +1843,52 @@ function mapArray(list, map, options) {
1768
1843
  const keyFn = typeof options?.keyed === "function" ? options.keyed : void 0;
1769
1844
  return createMemo(
1770
1845
  updateKeyedMap.bind({
1771
- z: createOwner(),
1772
- k: 0,
1773
- va: list,
1774
- F: [],
1775
- M: map,
1846
+ X: createOwner(),
1847
+ n: 0,
1848
+ wa: list,
1849
+ G: [],
1850
+ O: map,
1776
1851
  d: [],
1777
1852
  a: [],
1778
- N: keyFn,
1779
- l: keyFn || options?.keyed === false ? [] : void 0,
1780
- m: map.length > 1 ? [] : void 0,
1853
+ P: keyFn,
1854
+ o: keyFn || options?.keyed === false ? [] : void 0,
1855
+ p: map.length > 1 ? [] : void 0,
1781
1856
  Y: options?.fallback
1782
1857
  })
1783
1858
  );
1784
1859
  }
1785
1860
  var pureOptions = { pureWrite: true };
1786
1861
  function updateKeyedMap() {
1787
- const newItems = this.va() || [], newLen = newItems.length;
1862
+ const newItems = this.wa() || [], newLen = newItems.length;
1788
1863
  newItems[$TRACK];
1789
- runWithOwner(this.z, () => {
1790
- let i, j, mapper = this.l ? () => {
1791
- this.l[j] = signal(newItems[j], pureOptions);
1792
- this.m && (this.m[j] = signal(j, pureOptions));
1793
- return this.M(
1794
- read.bind(null, this.l[j]),
1795
- this.m ? read.bind(null, this.m[j]) : void 0
1864
+ runWithOwner(this.X, () => {
1865
+ let i, j, mapper = this.o ? () => {
1866
+ this.o[j] = signal(newItems[j], pureOptions);
1867
+ this.p && (this.p[j] = signal(j, pureOptions));
1868
+ return this.O(
1869
+ read.bind(null, this.o[j]),
1870
+ this.p ? read.bind(null, this.p[j]) : void 0
1796
1871
  );
1797
- } : this.m ? () => {
1872
+ } : this.p ? () => {
1798
1873
  const item = newItems[j];
1799
- this.m[j] = signal(j, pureOptions);
1800
- return this.M(
1874
+ this.p[j] = signal(j, pureOptions);
1875
+ return this.O(
1801
1876
  () => item,
1802
- read.bind(null, this.m[j])
1877
+ read.bind(null, this.p[j])
1803
1878
  );
1804
1879
  } : () => {
1805
1880
  const item = newItems[j];
1806
- return this.M(() => item);
1881
+ return this.O(() => item);
1807
1882
  };
1808
1883
  if (newLen === 0) {
1809
- if (this.k !== 0) {
1810
- this.z.dispose(false);
1884
+ if (this.n !== 0) {
1885
+ this.X.dispose(false);
1811
1886
  this.a = [];
1812
- this.F = [];
1887
+ this.G = [];
1813
1888
  this.d = [];
1814
- this.k = 0;
1815
- this.l && (this.l = []);
1816
- this.m && (this.m = []);
1889
+ this.n = 0;
1890
+ this.o && (this.o = []);
1891
+ this.p && (this.p = []);
1817
1892
  }
1818
1893
  if (this.Y && !this.d[0]) {
1819
1894
  this.d[0] = runWithOwner(
@@ -1821,45 +1896,45 @@ function updateKeyedMap() {
1821
1896
  this.Y
1822
1897
  );
1823
1898
  }
1824
- } else if (this.k === 0) {
1899
+ } else if (this.n === 0) {
1825
1900
  if (this.a[0])
1826
1901
  this.a[0].dispose();
1827
1902
  this.d = new Array(newLen);
1828
1903
  for (j = 0; j < newLen; j++) {
1829
- this.F[j] = newItems[j];
1904
+ this.G[j] = newItems[j];
1830
1905
  this.d[j] = runWithOwner(this.a[j] = createOwner(), mapper);
1831
1906
  }
1832
- this.k = newLen;
1907
+ this.n = newLen;
1833
1908
  } else {
1834
- let start, end, newEnd, item, key, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen), tempRows = this.l ? new Array(newLen) : void 0, tempIndexes = this.m ? new Array(newLen) : void 0;
1835
- for (start = 0, end = Math.min(this.k, newLen); start < end && (this.F[start] === newItems[start] || this.l && compare(this.N, this.F[start], newItems[start])); start++) {
1836
- if (this.l)
1837
- setSignal(this.l[start], newItems[start]);
1909
+ let start, end, newEnd, item, key, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen), tempRows = this.o ? new Array(newLen) : void 0, tempIndexes = this.p ? new Array(newLen) : void 0;
1910
+ for (start = 0, end = Math.min(this.n, newLen); start < end && (this.G[start] === newItems[start] || this.o && compare(this.P, this.G[start], newItems[start])); start++) {
1911
+ if (this.o)
1912
+ setSignal(this.o[start], newItems[start]);
1838
1913
  }
1839
- for (end = this.k - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.F[end] === newItems[newEnd] || this.l && compare(this.N, this.F[end], newItems[newEnd])); end--, newEnd--) {
1914
+ for (end = this.n - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.G[end] === newItems[newEnd] || this.o && compare(this.P, this.G[end], newItems[newEnd])); end--, newEnd--) {
1840
1915
  temp[newEnd] = this.d[end];
1841
1916
  tempNodes[newEnd] = this.a[end];
1842
- tempRows && (tempRows[newEnd] = this.l[end]);
1843
- tempIndexes && (tempIndexes[newEnd] = this.m[end]);
1917
+ tempRows && (tempRows[newEnd] = this.o[end]);
1918
+ tempIndexes && (tempIndexes[newEnd] = this.p[end]);
1844
1919
  }
1845
1920
  newIndices = /* @__PURE__ */ new Map();
1846
1921
  newIndicesNext = new Array(newEnd + 1);
1847
1922
  for (j = newEnd; j >= start; j--) {
1848
1923
  item = newItems[j];
1849
- key = this.N ? this.N(item) : item;
1924
+ key = this.P ? this.P(item) : item;
1850
1925
  i = newIndices.get(key);
1851
1926
  newIndicesNext[j] = i === void 0 ? -1 : i;
1852
1927
  newIndices.set(key, j);
1853
1928
  }
1854
1929
  for (i = start; i <= end; i++) {
1855
- item = this.F[i];
1856
- key = this.N ? this.N(item) : item;
1930
+ item = this.G[i];
1931
+ key = this.P ? this.P(item) : item;
1857
1932
  j = newIndices.get(key);
1858
1933
  if (j !== void 0 && j !== -1) {
1859
1934
  temp[j] = this.d[i];
1860
1935
  tempNodes[j] = this.a[i];
1861
- tempRows && (tempRows[j] = this.l[i]);
1862
- tempIndexes && (tempIndexes[j] = this.m[i]);
1936
+ tempRows && (tempRows[j] = this.o[i]);
1937
+ tempIndexes && (tempIndexes[j] = this.p[i]);
1863
1938
  j = newIndicesNext[j];
1864
1939
  newIndices.set(key, j);
1865
1940
  } else
@@ -1870,46 +1945,46 @@ function updateKeyedMap() {
1870
1945
  this.d[j] = temp[j];
1871
1946
  this.a[j] = tempNodes[j];
1872
1947
  if (tempRows) {
1873
- this.l[j] = tempRows[j];
1874
- setSignal(this.l[j], newItems[j]);
1948
+ this.o[j] = tempRows[j];
1949
+ setSignal(this.o[j], newItems[j]);
1875
1950
  }
1876
1951
  if (tempIndexes) {
1877
- this.m[j] = tempIndexes[j];
1878
- setSignal(this.m[j], j);
1952
+ this.p[j] = tempIndexes[j];
1953
+ setSignal(this.p[j], j);
1879
1954
  }
1880
1955
  } else {
1881
1956
  this.d[j] = runWithOwner(this.a[j] = createOwner(), mapper);
1882
1957
  }
1883
1958
  }
1884
- this.d = this.d.slice(0, this.k = newLen);
1885
- this.F = newItems.slice(0);
1959
+ this.d = this.d.slice(0, this.n = newLen);
1960
+ this.G = newItems.slice(0);
1886
1961
  }
1887
1962
  });
1888
1963
  return this.d;
1889
1964
  }
1890
1965
  function repeat(count, map, options) {
1891
1966
  return updateRepeat.bind({
1892
- z: createOwner(),
1893
- k: 0,
1894
- w: 0,
1895
- wa: count,
1896
- M: map,
1967
+ X: createOwner(),
1968
+ n: 0,
1969
+ y: 0,
1970
+ xa: count,
1971
+ O: map,
1897
1972
  a: [],
1898
1973
  d: [],
1899
- xa: options?.from,
1974
+ ya: options?.from,
1900
1975
  Y: options?.fallback
1901
1976
  });
1902
1977
  }
1903
1978
  function updateRepeat() {
1904
- const newLen = this.wa();
1905
- const from = this.xa?.() || 0;
1906
- runWithOwner(this.z, () => {
1979
+ const newLen = this.xa();
1980
+ const from = this.ya?.() || 0;
1981
+ runWithOwner(this.X, () => {
1907
1982
  if (newLen === 0) {
1908
- if (this.k !== 0) {
1909
- this.z.dispose(false);
1983
+ if (this.n !== 0) {
1984
+ this.X.dispose(false);
1910
1985
  this.a = [];
1911
1986
  this.d = [];
1912
- this.k = 0;
1987
+ this.n = 0;
1913
1988
  }
1914
1989
  if (this.Y && !this.d[0]) {
1915
1990
  this.d[0] = runWithOwner(
@@ -1920,20 +1995,20 @@ function updateRepeat() {
1920
1995
  return;
1921
1996
  }
1922
1997
  const to = from + newLen;
1923
- const prevTo = this.w + this.k;
1924
- if (this.k === 0 && this.a[0])
1998
+ const prevTo = this.y + this.n;
1999
+ if (this.n === 0 && this.a[0])
1925
2000
  this.a[0].dispose();
1926
2001
  for (let i = to; i < prevTo; i++)
1927
- this.a[i - this.w].dispose();
1928
- if (this.w < from) {
1929
- let i = this.w;
1930
- while (i < from && i < this.k)
2002
+ this.a[i - this.y].dispose();
2003
+ if (this.y < from) {
2004
+ let i = this.y;
2005
+ while (i < from && i < this.n)
1931
2006
  this.a[i++].dispose();
1932
- this.a.splice(0, from - this.w);
1933
- this.d.splice(0, from - this.w);
1934
- } else if (this.w > from) {
1935
- let i = prevTo - this.w - 1;
1936
- let difference = this.w - from;
2007
+ this.a.splice(0, from - this.y);
2008
+ this.d.splice(0, from - this.y);
2009
+ } else if (this.y > from) {
2010
+ let i = prevTo - this.y - 1;
2011
+ let difference = this.y - from;
1937
2012
  this.a.length = this.d.length = newLen;
1938
2013
  while (i >= difference) {
1939
2014
  this.a[i] = this.a[i - difference];
@@ -1943,19 +2018,19 @@ function updateRepeat() {
1943
2018
  for (let i2 = 0; i2 < difference; i2++) {
1944
2019
  this.d[i2] = runWithOwner(
1945
2020
  this.a[i2] = createOwner(),
1946
- () => this.M(i2 + from)
2021
+ () => this.O(i2 + from)
1947
2022
  );
1948
2023
  }
1949
2024
  }
1950
2025
  for (let i = prevTo; i < to; i++) {
1951
2026
  this.d[i - from] = runWithOwner(
1952
2027
  this.a[i - from] = createOwner(),
1953
- () => this.M(i)
2028
+ () => this.O(i)
1954
2029
  );
1955
2030
  }
1956
2031
  this.d = this.d.slice(0, newLen);
1957
- this.w = from;
1958
- this.k = newLen;
2032
+ this.y = from;
2033
+ this.n = newLen;
1959
2034
  });
1960
2035
  return this.d;
1961
2036
  }
@@ -1966,7 +2041,7 @@ function compare(key, a, b) {
1966
2041
  // src/boundaries.ts
1967
2042
  function boundaryComputed(fn, propagationMask) {
1968
2043
  const node = computed(fn, void 0, {
1969
- ja: {
2044
+ ka: {
1970
2045
  ma() {
1971
2046
  let flags = this.f;
1972
2047
  this.f &= ~this.Z;
@@ -1991,20 +2066,20 @@ function createBoundChildren(owner, fn, queue, mask) {
1991
2066
  });
1992
2067
  }
1993
2068
  var ConditionalQueue = class extends Queue {
1994
- t;
1995
- ga = /* @__PURE__ */ new Set();
2069
+ u;
2070
+ ha = /* @__PURE__ */ new Set();
1996
2071
  h = /* @__PURE__ */ new Set();
1997
2072
  constructor(disabled) {
1998
2073
  super();
1999
- this.t = disabled;
2074
+ this.u = disabled;
2000
2075
  }
2001
2076
  run(type) {
2002
- if (!type || read(this.t))
2077
+ if (!type || read(this.u))
2003
2078
  return;
2004
2079
  return super.run(type);
2005
2080
  }
2006
2081
  notify(node, type, flags) {
2007
- if (read(this.t)) {
2082
+ if (read(this.u)) {
2008
2083
  if (type & 1 /* Pending */) {
2009
2084
  if (flags & 1 /* Pending */) {
2010
2085
  this.h.add(node);
@@ -2014,9 +2089,9 @@ var ConditionalQueue = class extends Queue {
2014
2089
  }
2015
2090
  if (type & 2 /* Error */) {
2016
2091
  if (flags & 2 /* Error */) {
2017
- this.ga.add(node);
2092
+ this.ha.add(node);
2018
2093
  type &= ~2 /* Error */;
2019
- } else if (this.ga.delete(node))
2094
+ } else if (this.ha.delete(node))
2020
2095
  type &= ~2 /* Error */;
2021
2096
  }
2022
2097
  }
@@ -2024,38 +2099,32 @@ var ConditionalQueue = class extends Queue {
2024
2099
  }
2025
2100
  };
2026
2101
  var CollectionQueue = class extends Queue {
2027
- O;
2102
+ _;
2028
2103
  a = /* @__PURE__ */ new Set();
2029
- t = signal(false, { pureWrite: true });
2030
- ka = false;
2104
+ u = signal(false, { pureWrite: true });
2105
+ ra = false;
2031
2106
  constructor(type) {
2032
2107
  super();
2033
- this.O = type;
2108
+ this._ = type;
2034
2109
  }
2035
2110
  run(type) {
2036
- if (!type || read(this.t))
2111
+ if (!type || read(this.u))
2037
2112
  return;
2038
2113
  return super.run(type);
2039
2114
  }
2040
- enqueue(type, fn) {
2041
- if (this.O & 1 /* Pending */ && this.ka) {
2042
- return this.q?.enqueue(type, fn);
2043
- }
2044
- return super.enqueue(type, fn);
2045
- }
2046
2115
  notify(node, type, flags) {
2047
- if (!(type & this.O) || this.O & 1 /* Pending */ && this.ka)
2116
+ if (!(type & this._) || this._ & 1 /* Pending */ && this.ra)
2048
2117
  return super.notify(node, type, flags);
2049
- if (flags & this.O) {
2118
+ if (flags & this._) {
2050
2119
  this.a.add(node);
2051
2120
  if (this.a.size === 1)
2052
- setSignal(this.t, true);
2121
+ setSignal(this.u, true);
2053
2122
  } else if (this.a.size > 0) {
2054
2123
  this.a.delete(node);
2055
2124
  if (this.a.size === 0)
2056
- setSignal(this.t, false);
2125
+ setSignal(this.u, false);
2057
2126
  }
2058
- type &= ~this.O;
2127
+ type &= ~this._;
2059
2128
  return type ? super.notify(node, type, flags) : true;
2060
2129
  }
2061
2130
  };
@@ -2064,28 +2133,28 @@ function createBoundary(fn, condition) {
2064
2133
  const queue = new ConditionalQueue(computed(() => condition() === "hidden" /* HIDDEN */));
2065
2134
  const tree = createBoundChildren(owner, fn, queue, 0);
2066
2135
  computed(() => {
2067
- const disabled = read(queue.t);
2136
+ const disabled = read(queue.u);
2068
2137
  tree.Z = disabled ? 2 /* Error */ | 1 /* Pending */ : 0;
2069
2138
  if (!disabled) {
2070
2139
  queue.h.forEach(
2071
2140
  (node) => queue.notify(node, 1 /* Pending */, 1 /* Pending */)
2072
2141
  );
2073
- queue.ga.forEach((node) => queue.notify(node, 2 /* Error */, 2 /* Error */));
2142
+ queue.ha.forEach((node) => queue.notify(node, 2 /* Error */, 2 /* Error */));
2074
2143
  queue.h.clear();
2075
- queue.ga.clear();
2144
+ queue.ha.clear();
2076
2145
  }
2077
2146
  });
2078
- return () => read(queue.t) ? void 0 : read(tree);
2147
+ return () => read(queue.u) ? void 0 : read(tree);
2079
2148
  }
2080
2149
  function createCollectionBoundary(type, fn, fallback) {
2081
2150
  const owner = createOwner();
2082
2151
  const queue = new CollectionQueue(type);
2083
2152
  const tree = createBoundChildren(owner, fn, queue, type);
2084
2153
  const decision = computed(() => {
2085
- if (!read(queue.t)) {
2154
+ if (!read(queue.u)) {
2086
2155
  const resolved = read(tree);
2087
- if (!untrack(() => read(queue.t)))
2088
- queue.ka = true;
2156
+ if (!untrack(() => read(queue.u)))
2157
+ queue.ra = true;
2089
2158
  return resolved;
2090
2159
  }
2091
2160
  return fallback(queue);