@solidjs/signals 0.9.10 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/node.cjs CHANGED
@@ -100,12 +100,12 @@ function markNode(e, r = n) {
100
100
  const i = e._;
101
101
  if ((i & (t | n)) >= r) return;
102
102
  e._ = (i & -4) | r;
103
- for (let n = e.P; n !== null; n = n.C) {
103
+ for (let n = e.P; n !== null; n = n.A) {
104
104
  markNode(n.k, t);
105
105
  }
106
- if (e.A !== null) {
107
- for (let n = e.A; n !== null; n = n.W) {
108
- for (let e = n.P; e !== null; e = e.C) {
106
+ if (e.C !== null) {
107
+ for (let n = e.C; n !== null; n = n.W) {
108
+ for (let e = n.P; e !== null; e = e.A) {
109
109
  markNode(e.k, t);
110
110
  }
111
111
  }
@@ -133,7 +133,7 @@ function adjustHeight(e, t) {
133
133
  }
134
134
  if (e.u !== n) {
135
135
  e.u = n;
136
- for (let n = e.P; n !== null; n = n.C) {
136
+ for (let n = e.P; n !== null; n = n.A) {
137
137
  insertIntoHeapHeight(n.k, t);
138
138
  }
139
139
  }
@@ -145,82 +145,12 @@ let O = 0;
145
145
  let x = null;
146
146
  let v = false;
147
147
  let P = false;
148
- const C = new WeakMap();
149
- const k = new Set();
150
- let A = null;
151
- function setCurrentOptimisticLane(e) {
152
- A = e;
153
- }
154
- function getOrCreateLane(e) {
155
- let t = C.get(e);
156
- if (t) {
157
- return findLane(t);
158
- }
159
- const n = e.T;
160
- const r = n?.M ? findLane(n.M) : null;
161
- t = { t: e, q: new Set(), F: [[], []], V: null, B: x, D: r };
162
- C.set(e, t);
163
- k.add(t);
164
- e.G = e.K || 0;
165
- return t;
166
- }
167
- function findLane(e) {
168
- while (e.V) e = e.V;
169
- return e;
170
- }
171
- function mergeLanes(e, t) {
172
- e = findLane(e);
173
- t = findLane(t);
174
- if (e === t) return e;
175
- t.V = e;
176
- for (const n of t.q) e.q.add(n);
177
- e.F[0].push(...t.F[0]);
178
- e.F[1].push(...t.F[1]);
179
- return e;
180
- }
181
- function clearLaneEntry(e) {
182
- C.delete(e);
183
- }
184
- function resolveLane(e) {
185
- const t = e.M;
186
- if (!t) return undefined;
187
- const n = findLane(t);
188
- if (k.has(n)) return n;
189
- e.M = undefined;
190
- return undefined;
191
- }
192
- function hasActiveOverride(e) {
193
- return !!(e.U && e.J !== y);
194
- }
195
- function assignOrMergeLane(e, t) {
196
- const n = findLane(t);
197
- const r = e.M;
198
- if (r) {
199
- if (r.V) {
200
- e.M = t;
201
- return;
202
- }
203
- const i = findLane(r);
204
- if (k.has(i)) {
205
- if (i !== n && !hasActiveOverride(e)) {
206
- if (n.D && findLane(n.D) === i) {
207
- e.M = t;
208
- } else if (i.D && findLane(i.D) === n);
209
- else {
210
- mergeLanes(n, i);
211
- }
212
- }
213
- return;
214
- }
215
- }
216
- e.M = t;
217
- }
218
148
  function runLaneEffects(e) {
219
- for (const t of k) {
220
- if (t.V || t.q.size > 0) continue;
221
- const n = t.F[e - 1];
149
+ for (const t of C) {
150
+ if (t.T || t.M.size > 0) continue;
151
+ const n = t.q[e - 1];
222
152
  if (n.length) {
223
- t.F[e - 1] = [];
153
+ t.q[e - 1] = [];
224
154
  runQueue(n, e);
225
155
  }
226
156
  }
@@ -231,21 +161,21 @@ function setProjectionWriteActive(e) {
231
161
  function schedule() {
232
162
  if (v) return;
233
163
  v = true;
234
- if (!E.X) queueMicrotask(flush);
164
+ if (!A.F) queueMicrotask(flush);
235
165
  }
236
166
  class Queue {
237
167
  o = null;
238
- Y = [[], []];
239
- Z = [];
168
+ V = [[], []];
169
+ D = [];
240
170
  created = O;
241
171
  addChild(e) {
242
- this.Z.push(e);
172
+ this.D.push(e);
243
173
  e.o = this;
244
174
  }
245
175
  removeChild(e) {
246
- const t = this.Z.indexOf(e);
176
+ const t = this.D.indexOf(e);
247
177
  if (t >= 0) {
248
- this.Z.splice(t, 1);
178
+ this.D.splice(t, 1);
249
179
  e.o = null;
250
180
  }
251
181
  }
@@ -254,88 +184,88 @@ class Queue {
254
184
  return false;
255
185
  }
256
186
  run(e) {
257
- if (this.Y[e - 1].length) {
258
- const t = this.Y[e - 1];
259
- this.Y[e - 1] = [];
187
+ if (this.V[e - 1].length) {
188
+ const t = this.V[e - 1];
189
+ this.V[e - 1] = [];
260
190
  runQueue(t, e);
261
191
  }
262
- for (let t = 0; t < this.Z.length; t++) this.Z[t].run?.(e);
192
+ for (let t = 0; t < this.D.length; t++) this.D[t].run?.(e);
263
193
  }
264
194
  enqueue(e, t) {
265
195
  if (e) {
266
- if (A) {
267
- const n = findLane(A);
268
- n.F[e - 1].push(t);
196
+ if (R) {
197
+ const n = findLane(R);
198
+ n.q[e - 1].push(t);
269
199
  } else {
270
- this.Y[e - 1].push(t);
200
+ this.V[e - 1].push(t);
271
201
  }
272
202
  }
273
203
  schedule();
274
204
  }
275
205
  stashQueues(e) {
276
- e.Y[0].push(...this.Y[0]);
277
- e.Y[1].push(...this.Y[1]);
278
- this.Y = [[], []];
279
- for (let t = 0; t < this.Z.length; t++) {
280
- let n = this.Z[t];
281
- let r = e.Z[t];
206
+ e.V[0].push(...this.V[0]);
207
+ e.V[1].push(...this.V[1]);
208
+ this.V = [[], []];
209
+ for (let t = 0; t < this.D.length; t++) {
210
+ let n = this.D[t];
211
+ let r = e.D[t];
282
212
  if (!r) {
283
- r = { Y: [[], []], Z: [] };
284
- e.Z[t] = r;
213
+ r = { V: [[], []], D: [] };
214
+ e.D[t] = r;
285
215
  }
286
216
  n.stashQueues(r);
287
217
  }
288
218
  }
289
219
  restoreQueues(e) {
290
- this.Y[0].push(...e.Y[0]);
291
- this.Y[1].push(...e.Y[1]);
292
- for (let t = 0; t < e.Z.length; t++) {
293
- const n = e.Z[t];
294
- let r = this.Z[t];
220
+ this.V[0].push(...e.V[0]);
221
+ this.V[1].push(...e.V[1]);
222
+ for (let t = 0; t < e.D.length; t++) {
223
+ const n = e.D[t];
224
+ let r = this.D[t];
295
225
  if (r) r.restoreQueues(n);
296
226
  }
297
227
  }
298
228
  }
299
229
  class GlobalQueue extends Queue {
300
- X = false;
301
- $ = [];
302
- ee = [];
303
- te = new Set();
304
- static ne;
305
- static re;
306
- static ie = null;
230
+ F = false;
231
+ B = [];
232
+ G = [];
233
+ K = new Set();
234
+ static U;
235
+ static J;
236
+ static X = null;
307
237
  flush() {
308
- if (this.X) return;
309
- this.X = true;
238
+ if (this.F) return;
239
+ this.F = true;
310
240
  try {
311
- runHeap(_, GlobalQueue.ne);
241
+ runHeap(_, GlobalQueue.U);
312
242
  if (x) {
313
243
  const e = transitionComplete(x);
314
244
  if (!e) {
315
245
  let e = x;
316
- runHeap(b, GlobalQueue.ne);
317
- this.$ = [];
318
- this.ee = [];
319
- this.te = new Set();
246
+ runHeap(b, GlobalQueue.U);
247
+ this.B = [];
248
+ this.G = [];
249
+ this.K = new Set();
320
250
  runLaneEffects(d);
321
251
  runLaneEffects(p);
322
- this.stashQueues(x.se);
252
+ this.stashQueues(x.Y);
323
253
  O++;
324
254
  v = _.m >= _.j;
325
- reassignPendingTransition(x.$);
255
+ reassignPendingTransition(x.B);
326
256
  x = null;
327
257
  finalizePureQueue(null, true);
328
258
  return;
329
259
  }
330
- this.$ !== x.$ && this.$.push(...x.$);
331
- this.restoreQueues(x.se);
260
+ this.B !== x.B && this.B.push(...x.B);
261
+ this.restoreQueues(x.Y);
332
262
  m.delete(x);
333
263
  const t = x;
334
264
  x = null;
335
- reassignPendingTransition(this.$);
265
+ reassignPendingTransition(this.B);
336
266
  finalizePureQueue(t);
337
267
  } else {
338
- if (m.size) runHeap(b, GlobalQueue.ne);
268
+ if (m.size) runHeap(b, GlobalQueue.U);
339
269
  finalizePureQueue();
340
270
  }
341
271
  O++;
@@ -345,15 +275,15 @@ class GlobalQueue extends Queue {
345
275
  runLaneEffects(p);
346
276
  this.run(p);
347
277
  } finally {
348
- this.X = false;
278
+ this.F = false;
349
279
  }
350
280
  }
351
281
  notify(e, t, n, r) {
352
282
  if (t & l) {
353
283
  if (n & l) {
354
- const t = r !== undefined ? r : e.oe;
355
- if (x && t && !x.ue.includes(t.t)) {
356
- x.ue.push(t.t);
284
+ const t = r !== undefined ? r : e.Z;
285
+ if (x && t && !x.$.includes(t.t)) {
286
+ x.$.push(t.t);
357
287
  schedule();
358
288
  }
359
289
  }
@@ -364,68 +294,68 @@ class GlobalQueue extends Queue {
364
294
  initTransition(e) {
365
295
  if (e) e = currentTransition(e);
366
296
  if (e && e === x) return;
367
- if (!e && x && x.fe === O) return;
297
+ if (!e && x && x.ee === O) return;
368
298
  if (!x) {
369
299
  x = e ?? {
370
- fe: O,
300
+ ee: O,
301
+ B: [],
371
302
  $: [],
372
- ue: [],
373
- ee: [],
374
- te: new Set(),
375
- le: [],
376
- se: { Y: [[], []], Z: [] },
377
- ce: false
303
+ G: [],
304
+ K: new Set(),
305
+ te: [],
306
+ Y: { V: [[], []], D: [] },
307
+ ne: false
378
308
  };
379
309
  } else if (e) {
380
310
  const t = x;
381
- t.ce = e;
382
- e.le.push(...t.le);
383
- for (const n of k) {
384
- if (n.B === t) n.B = e;
311
+ t.ne = e;
312
+ e.te.push(...t.te);
313
+ for (const n of C) {
314
+ if (n.re === t) n.re = e;
385
315
  }
386
- e.ee.push(...t.ee);
387
- for (const n of t.te) {
388
- e.te.add(n);
316
+ e.G.push(...t.G);
317
+ for (const n of t.K) {
318
+ e.K.add(n);
389
319
  }
390
320
  m.delete(t);
391
321
  x = e;
392
322
  }
393
323
  m.add(x);
394
- x.fe = O;
395
- for (let e = 0; e < this.$.length; e++) {
396
- const t = this.$[e];
397
- t.B = x;
398
- x.$.push(t);
324
+ x.ee = O;
325
+ for (let e = 0; e < this.B.length; e++) {
326
+ const t = this.B[e];
327
+ t.re = x;
328
+ x.B.push(t);
399
329
  }
400
- this.$ = x.$;
401
- for (let e = 0; e < this.ee.length; e++) {
402
- const t = this.ee[e];
403
- t.B = x;
404
- x.ee.push(t);
330
+ this.B = x.B;
331
+ for (let e = 0; e < this.G.length; e++) {
332
+ const t = this.G[e];
333
+ t.re = x;
334
+ x.G.push(t);
405
335
  }
406
- this.ee = x.ee;
407
- for (const e of k) {
408
- if (!e.B) e.B = x;
336
+ this.G = x.G;
337
+ for (const e of C) {
338
+ if (!e.re) e.re = x;
409
339
  }
410
- for (const e of this.te) x.te.add(e);
411
- this.te = x.te;
340
+ for (const e of this.K) x.K.add(e);
341
+ this.K = x.K;
412
342
  }
413
343
  }
414
344
  function insertSubs(e, t = false) {
415
- const n = e.M || A;
416
- for (let r = e.P; r !== null; r = r.C) {
345
+ const n = e.ie || R;
346
+ for (let r = e.P; r !== null; r = r.A) {
417
347
  if (t && n) {
418
348
  r.k._ |= f;
419
349
  assignOrMergeLane(r.k, n);
420
350
  } else if (t) {
421
351
  r.k._ |= f;
422
- r.k.M = undefined;
352
+ r.k.ie = undefined;
423
353
  }
424
354
  const e = r.k;
425
- if (e.ae === h) {
426
- if (!e.de) {
427
- e.de = true;
428
- e.pe.enqueue(p, e.he);
355
+ if (e.se === h) {
356
+ if (!e.oe) {
357
+ e.oe = true;
358
+ e.ue.enqueue(p, e.fe);
429
359
  }
430
360
  continue;
431
361
  }
@@ -436,100 +366,103 @@ function insertSubs(e, t = false) {
436
366
  }
437
367
  function finalizePureQueue(e = null, t = false) {
438
368
  let n = !t;
439
- if (!t) checkBoundaryChildren(E);
440
- if (_.m >= _.j) runHeap(_, GlobalQueue.ne);
369
+ if (!t) checkBoundaryChildren(A);
370
+ if (_.m >= _.j) runHeap(_, GlobalQueue.U);
441
371
  if (n) {
442
- const t = E.$;
372
+ const t = A.B;
443
373
  for (let e = 0; e < t.length; e++) {
444
374
  const n = t[e];
445
- if (n.J !== y) {
446
- n.ye = n.J;
447
- n.J = y;
448
- if (n.ae && n.ae !== h) n.de = true;
375
+ if (n.le !== y) {
376
+ n.ce = n.le;
377
+ n.le = y;
378
+ if (n.se && n.se !== h) n.oe = true;
449
379
  }
450
- n.ge &= ~a;
451
- if (n.R) GlobalQueue.re(n, false, true);
380
+ n.ae &= ~a;
381
+ if (n.R) GlobalQueue.J(n, false, true);
452
382
  }
453
383
  t.length = 0;
454
- const n = e ? e.ee : E.ee;
384
+ const n = e ? e.G : A.G;
455
385
  for (let e = 0; e < n.length; e++) {
456
386
  const t = n[e];
457
- const r = t.J;
458
- t.M = undefined;
459
- if (r !== y && t.ye !== r) {
460
- t.ye = r;
387
+ const r = t.le;
388
+ t.ie = undefined;
389
+ if (r !== y && t.ce !== r) {
390
+ t.ce = r;
461
391
  insertSubs(t, true);
462
392
  }
463
- t.J = y;
464
- t.B = null;
393
+ t.le = y;
394
+ t.re = null;
465
395
  }
466
396
  n.length = 0;
467
- const r = e ? e.te : E.te;
468
- if (GlobalQueue.ie && r.size) {
397
+ const r = e ? e.K : A.K;
398
+ if (GlobalQueue.X && r.size) {
469
399
  for (const e of r) {
470
- GlobalQueue.ie(e);
400
+ GlobalQueue.X(e);
471
401
  }
472
402
  r.clear();
473
403
  schedule();
474
404
  }
475
- for (const t of k) {
476
- const n = e ? t.B === e : !t.B;
405
+ for (const t of C) {
406
+ const n = e ? t.re === e : !t.re;
477
407
  if (!n) continue;
478
- if (!t.V) {
479
- if (t.F[0].length) runQueue(t.F[0], d);
480
- if (t.F[1].length) runQueue(t.F[1], p);
408
+ if (!t.T) {
409
+ if (t.q[0].length) runQueue(t.q[0], d);
410
+ if (t.q[1].length) runQueue(t.q[1], p);
481
411
  }
482
- if (t.t.M === t) t.t.M = undefined;
483
- t.q.clear();
484
- t.F[0].length = 0;
485
- t.F[1].length = 0;
486
- k.delete(t);
487
- C.delete(t.t);
412
+ if (t.t.ie === t) t.t.ie = undefined;
413
+ t.M.clear();
414
+ t.q[0].length = 0;
415
+ t.q[1].length = 0;
416
+ C.delete(t);
417
+ k.delete(t.t);
488
418
  }
489
419
  }
490
420
  }
491
421
  function checkBoundaryChildren(e) {
492
- for (const t of e.Z) {
422
+ for (const t of e.D) {
493
423
  t.checkSources?.();
494
424
  checkBoundaryChildren(t);
495
425
  }
496
426
  }
497
427
  function trackOptimisticStore(e) {
498
- E.te.add(e);
428
+ A.K.add(e);
499
429
  schedule();
500
430
  }
501
431
  function reassignPendingTransition(e) {
502
432
  for (let t = 0; t < e.length; t++) {
503
- e[t].B = x;
433
+ e[t].re = x;
504
434
  }
505
435
  }
506
- const E = new GlobalQueue();
436
+ const A = new GlobalQueue();
507
437
  function flush() {
508
438
  while (v) {
509
- E.flush();
439
+ A.flush();
510
440
  }
511
441
  }
512
442
  function runQueue(e, t) {
513
443
  for (let n = 0; n < e.length; n++) e[n](t);
514
444
  }
515
445
  function transitionComplete(e) {
516
- if (e.ce) return true;
517
- if (e.le.length) return false;
446
+ if (e.ne) return true;
447
+ if (e.te.length) return false;
518
448
  let t = true;
519
- for (let n = 0; n < e.ue.length; n++) {
520
- const r = e.ue[n];
521
- if (r.ge & l && r.oe?.t === r) {
449
+ for (let n = 0; n < e.$.length; n++) {
450
+ const r = e.$[n];
451
+ if (r.ae & l && r.Z?.t === r) {
522
452
  t = false;
523
453
  break;
524
454
  }
525
455
  }
526
- t && (e.ce = true);
456
+ t && (e.ne = true);
527
457
  return t;
528
458
  }
529
459
  function currentTransition(e) {
530
- while (e.ce && typeof e.ce === "object") e = e.ce;
460
+ while (e.ne && typeof e.ne === "object") e = e.ne;
531
461
  return e;
532
462
  }
463
+ function setActiveTransition(e) {
464
+ x = e;
465
+ }
533
466
  function runInTransition(e, t) {
534
467
  const n = x;
535
468
  try {
@@ -539,195 +472,107 @@ function runInTransition(e, t) {
539
472
  x = n;
540
473
  }
541
474
  }
542
- function restoreTransition(e, t) {
543
- E.initTransition(e);
544
- const n = t();
545
- flush();
546
- return n;
475
+ const k = new WeakMap();
476
+ const C = new Set();
477
+ function getOrCreateLane(e) {
478
+ let t = k.get(e);
479
+ if (t) {
480
+ return findLane(t);
481
+ }
482
+ const n = e.de;
483
+ const r = n?.ie ? findLane(n.ie) : null;
484
+ t = { t: e, M: new Set(), q: [[], []], T: null, re: x, pe: r };
485
+ k.set(e, t);
486
+ C.add(t);
487
+ e.he = e.ye || 0;
488
+ return t;
547
489
  }
548
- function action(e) {
549
- return (...t) =>
550
- new Promise((n, r) => {
551
- const i = e(...t);
552
- E.initTransition();
553
- let s = x;
554
- s.le.push(i);
555
- const done = (e, t) => {
556
- s = currentTransition(s);
557
- const o = s.le.indexOf(i);
558
- if (o >= 0) s.le.splice(o, 1);
559
- x = s;
560
- schedule();
561
- t ? r(t) : n(e);
562
- };
563
- const step = (e, t) => {
564
- let n;
565
- try {
566
- n = t ? i.throw(e) : i.next(e);
567
- } catch (e) {
568
- return done(undefined, e);
569
- }
570
- if (n instanceof Promise)
571
- return void n.then(run, e => restoreTransition(s, () => step(e, true)));
572
- run(n);
573
- };
574
- const run = e => {
575
- if (e.done) return done(e.value);
576
- if (e.value instanceof Promise)
577
- return void e.value.then(
578
- e => restoreTransition(s, () => step(e)),
579
- e => restoreTransition(s, () => step(e, true))
580
- );
581
- restoreTransition(s, () => step(e.value));
582
- };
583
- step();
584
- });
490
+ function findLane(e) {
491
+ while (e.T) e = e.T;
492
+ return e;
585
493
  }
586
- GlobalQueue.ne = recompute;
587
- GlobalQueue.re = disposeChildren;
588
- let W = false;
589
- let j = false;
590
- let N = false;
591
- let L = false;
592
- let Q = false;
593
- let I = false;
594
- let H = null;
595
- function recompute(t, n = false) {
596
- const i = t.ae;
597
- if (!n) {
598
- if (t.B && (!i || x) && x !== t.B) E.initTransition(t.B);
599
- deleteFromHeap(t, t._ & o ? b : _);
600
- if (t.B || i === h) disposeChildren(t);
601
- else {
602
- markDisposal(t);
603
- t.we = t.Se;
604
- t.me = t._e;
605
- t.Se = null;
606
- t._e = null;
607
- }
608
- }
609
- const s = !!(t._ & f);
610
- const u = hasActiveOverride(t);
611
- const a = !!(t.ge & l);
612
- const d = H;
613
- H = t;
614
- t.be = null;
615
- t._ = r;
616
- t.fe = O;
617
- let p = t.J === y ? t.ye : t.J;
618
- let g = t.u;
619
- let w = W;
620
- let S = A;
621
- W = true;
622
- if (s) {
623
- const e = resolveLane(t);
624
- if (e) setCurrentOptimisticLane(e);
625
- }
626
- try {
627
- p = handleAsync(t, t.R(p));
628
- clearStatus(t);
629
- const e = resolveLane(t);
630
- if (e) {
631
- e.q.delete(t);
632
- updatePendingSignal(e.t);
633
- }
634
- } catch (e) {
635
- if (e instanceof NotReadyError && A) {
636
- const e = findLane(A);
637
- if (e.t !== t) {
638
- e.q.add(t);
639
- t.M = e;
640
- updatePendingSignal(e.t);
641
- }
642
- }
643
- notifyStatus(
644
- t,
645
- e instanceof NotReadyError ? l : c,
646
- e,
647
- undefined,
648
- e instanceof NotReadyError ? t.M : undefined
649
- );
650
- } finally {
651
- W = w;
652
- t._ = e;
653
- H = d;
654
- }
655
- if (!t.oe) {
656
- const e = t.be;
657
- let r = e !== null ? e.L : t.N;
658
- if (r !== null) {
659
- do {
660
- r = unlinkSubs(r);
661
- } while (r !== null);
662
- if (e !== null) e.L = null;
663
- else t.N = null;
494
+ function mergeLanes(e, t) {
495
+ e = findLane(e);
496
+ t = findLane(t);
497
+ if (e === t) return e;
498
+ t.T = e;
499
+ for (const n of t.M) e.M.add(n);
500
+ e.q[0].push(...t.q[0]);
501
+ e.q[1].push(...t.q[1]);
502
+ return e;
503
+ }
504
+ function resolveLane(e) {
505
+ const t = e.ie;
506
+ if (!t) return undefined;
507
+ const n = findLane(t);
508
+ if (C.has(n)) return n;
509
+ e.ie = undefined;
510
+ return undefined;
511
+ }
512
+ function hasActiveOverride(e) {
513
+ return !!(e.ge && e.le !== y);
514
+ }
515
+ function assignOrMergeLane(e, t) {
516
+ const n = findLane(t);
517
+ const r = e.ie;
518
+ if (r) {
519
+ if (r.T) {
520
+ e.ie = t;
521
+ return;
664
522
  }
665
- const f = u ? t.ye : t.J === y ? t.ye : t.J;
666
- const l = !t.Oe || !t.Oe(f, p);
667
- if (l) {
668
- const e = u ? t.ye : undefined;
669
- if (n || (i && x !== t.B) || s) t.ye = p;
670
- else t.J = p;
671
- if (u && !s && a) {
672
- const e = t.K || 0;
673
- const n = t.G || 0;
674
- if (e <= n) t.ye = p;
675
- }
676
- if (!u || s || t.ye !== e) {
677
- insertSubs(t, s || u);
678
- }
679
- } else if (u) {
680
- t.J = p;
681
- } else if (t.u != g) {
682
- for (let e = t.P; e !== null; e = e.C) {
683
- insertIntoHeapHeight(e.k, e.k._ & o ? b : _);
523
+ const i = findLane(r);
524
+ if (C.has(i)) {
525
+ if (i !== n && !hasActiveOverride(e)) {
526
+ if (n.pe && findLane(n.pe) === i) {
527
+ e.ie = t;
528
+ } else if (i.pe && findLane(i.pe) === n);
529
+ else mergeLanes(n, i);
684
530
  }
531
+ return;
685
532
  }
686
533
  }
687
- setCurrentOptimisticLane(S);
688
- (!n || t.ge & l) && !t.B && !(x && t.U) && E.$.push(t);
689
- t.B && i && x !== t.B && runInTransition(t.B, () => recompute(t));
534
+ e.ie = t;
690
535
  }
691
536
  function handleAsync(e, t, r) {
692
537
  const i = typeof t === "object" && t !== null;
693
538
  const s = i && untrack(() => t[Symbol.asyncIterator]);
694
539
  const o = !s && i && untrack(() => typeof t.then === "function");
695
540
  if (!o && !s) {
696
- e.xe = null;
541
+ e.we = null;
697
542
  return t;
698
543
  }
699
- e.xe = t;
544
+ e.we = t;
700
545
  let u;
701
546
  const handleError = n => {
702
- if (e.xe !== t) return;
703
- E.initTransition(e.B);
547
+ if (e.we !== t) return;
548
+ A.initTransition(e.re);
704
549
  notifyStatus(e, n instanceof NotReadyError ? l : c, n);
705
- e.fe = O;
550
+ e.ee = O;
706
551
  };
707
552
  const asyncWrite = (i, s) => {
708
- if (e.xe !== t) return;
553
+ if (e.we !== t) return;
709
554
  if (e._ & (n | f)) return;
710
- E.initTransition(e.B);
555
+ A.initTransition(e.re);
711
556
  clearStatus(e);
712
557
  const o = resolveLane(e);
713
- if (o) o.q.delete(e);
558
+ if (o) o.M.delete(e);
714
559
  if (r) r(i);
715
- else if (e.U) {
716
- const t = e.J !== y;
717
- if (e.R) e.J = i;
560
+ else if (e.ge) {
561
+ const t = e.le !== y;
562
+ if (e.R) e.le = i;
718
563
  if (!t) {
719
- e.ye = i;
564
+ e.ce = i;
720
565
  insertSubs(e);
721
566
  }
722
- e.fe = O;
567
+ e.ee = O;
723
568
  } else if (o) {
724
- const t = e.ye;
725
- const n = e.Oe;
569
+ const t = e.ce;
570
+ const n = e.Se;
726
571
  if (!n || !n(i, t)) {
727
- e.ye = i;
728
- e.fe = O;
729
- if (e.ve) {
730
- setSignal(e.ve, i);
572
+ e.ce = i;
573
+ e.ee = O;
574
+ if (e.me) {
575
+ setSignal(e.me, i);
731
576
  }
732
577
  insertSubs(e, true);
733
578
  }
@@ -754,8 +599,8 @@ function handleAsync(e, t, r) {
754
599
  );
755
600
  r = false;
756
601
  if (!n) {
757
- E.initTransition(e.B);
758
- throw new NotReadyError(H);
602
+ A.initTransition(e.re);
603
+ throw new NotReadyError(Q);
759
604
  }
760
605
  }
761
606
  if (s) {
@@ -786,27 +631,27 @@ function handleAsync(e, t, r) {
786
631
  };
787
632
  const i = iterate();
788
633
  if (!r && !i) {
789
- E.initTransition(e.B);
790
- throw new NotReadyError(H);
634
+ A.initTransition(e.re);
635
+ throw new NotReadyError(Q);
791
636
  }
792
637
  }
793
638
  return u;
794
639
  }
795
640
  function clearStatus(e) {
796
- e.ge = e.ge & a;
797
- e.oe = null;
641
+ e.ae = e.ae & a;
642
+ e.Z = null;
798
643
  updatePendingSignal(e);
799
- e.Pe?.();
644
+ e._e?.();
800
645
  }
801
646
  function notifyStatus(e, t, n, r, i) {
802
647
  if (t === c && !(n instanceof StatusError) && !(n instanceof NotReadyError))
803
648
  n = new StatusError(e, n);
804
649
  const s = n instanceof NotReadyError && n.t === e;
805
- const o = t === l && e.U && !s;
650
+ const o = t === l && e.ge && !s;
806
651
  const u = o && hasActiveOverride(e);
807
652
  if (!r) {
808
- e.ge = t | (t !== c ? e.ge & a : 0);
809
- e.oe = n;
653
+ e.ae = t | (t !== c ? e.ae & a : 0);
654
+ e.Z = n;
810
655
  updatePendingSignal(e);
811
656
  }
812
657
  if (i && !r) {
@@ -814,68 +659,249 @@ function notifyStatus(e, t, n, r, i) {
814
659
  }
815
660
  if (u && x && n instanceof NotReadyError) {
816
661
  const e = n.t;
817
- if (!x.ue.includes(e)) {
818
- x.ue.push(e);
662
+ if (!x.$.includes(e)) {
663
+ x.$.push(e);
819
664
  }
820
665
  }
821
666
  const f = r || u;
822
667
  const d = r || o ? undefined : i;
823
- if (e.Pe) {
668
+ if (e._e) {
824
669
  if (f) {
825
- e.Pe(t, n);
670
+ e._e(t, n);
826
671
  } else {
827
- e.Pe();
672
+ e._e();
828
673
  }
829
674
  return;
830
675
  }
831
- for (let r = e.P; r !== null; r = r.C) {
832
- r.k.fe = O;
833
- if (r.k.oe !== n) {
834
- !r.k.B && E.$.push(r.k);
676
+ for (let r = e.P; r !== null; r = r.A) {
677
+ r.k.ee = O;
678
+ if (r.k.Z !== n) {
679
+ !r.k.re && A.B.push(r.k);
835
680
  notifyStatus(r.k, t, n, f, d);
836
681
  }
837
682
  }
838
- for (let r = e.A; r !== null; r = r.W) {
839
- for (let e = r.P; e !== null; e = e.C) {
840
- e.k.fe = O;
841
- if (e.k.oe !== n) {
842
- !e.k.B && E.$.push(e.k);
683
+ for (let r = e.C; r !== null; r = r.W) {
684
+ for (let e = r.P; e !== null; e = e.A) {
685
+ e.k.ee = O;
686
+ if (e.k.Z !== n) {
687
+ !e.k.re && A.B.push(e.k);
843
688
  notifyStatus(e.k, t, n, f, d);
844
689
  }
845
690
  }
846
691
  }
847
692
  }
848
- function updateIfNecessary(r) {
849
- if (r._ & t) {
850
- for (let e = r.N; e; e = e.L) {
851
- const t = e.I;
852
- const i = t.H || t;
853
- if (i.R) {
854
- updateIfNecessary(i);
693
+ function effect(e, t, n, r, i) {
694
+ let s = false;
695
+ const o = computed(i?.render ? t => staleValues(() => e(t)) : e, r, {
696
+ ...i,
697
+ equals: () => {
698
+ o.oe = !o.Z;
699
+ if (s) o.ue.enqueue(o.se, runEffect.bind(o));
700
+ return false;
701
+ },
702
+ lazy: true
703
+ });
704
+ o.be = r;
705
+ o.Oe = t;
706
+ o.xe = n;
707
+ o.ve = undefined;
708
+ o.se = i?.render ? d : p;
709
+ o._e = (e, t) => {
710
+ const n = e !== undefined ? e : o.ae;
711
+ const r = t !== undefined ? t : o.Z;
712
+ if (n & c) {
713
+ let e = r;
714
+ o.ue.notify(o, l, 0);
715
+ if (o.se === p) {
716
+ try {
717
+ return o.xe
718
+ ? o.xe(e, () => {
719
+ o.ve?.();
720
+ o.ve = undefined;
721
+ })
722
+ : console.error(e);
723
+ } catch (t) {
724
+ e = t;
725
+ }
855
726
  }
856
- if (r._ & n) {
857
- break;
727
+ if (!o.ue.notify(o, c, c)) throw e;
728
+ } else if (o.se === d) o.ue.notify(o, l | c, n, r);
729
+ };
730
+ recompute(o, true);
731
+ !i?.defer && (o.se === p ? o.ue.enqueue(o.se, runEffect.bind(o)) : runEffect.call(o));
732
+ s = true;
733
+ onCleanup(() => o.ve?.());
734
+ }
735
+ function runEffect() {
736
+ if (!this.oe || this._ & u) return;
737
+ this.ve?.();
738
+ this.ve = undefined;
739
+ try {
740
+ this.ve = this.Oe(this.ce, this.be);
741
+ } catch (e) {
742
+ if (!this.ue.notify(this, c, c)) throw e;
743
+ } finally {
744
+ this.be = this.ce;
745
+ this.oe = false;
746
+ }
747
+ }
748
+ function trackedEffect(e, t) {
749
+ const run = () => {
750
+ if (!n.oe || n._ & u) return;
751
+ n.oe = false;
752
+ recompute(n);
753
+ };
754
+ const n = computed(
755
+ () => {
756
+ try {
757
+ n.ve?.();
758
+ n.ve = undefined;
759
+ n.ve = staleValues(e) || undefined;
760
+ } finally {
858
761
  }
762
+ },
763
+ undefined,
764
+ { ...t, lazy: true, pureWrite: true }
765
+ );
766
+ n.ve = undefined;
767
+ n.oe = true;
768
+ n.se = h;
769
+ n.fe = run;
770
+ n.ue.enqueue(p, run);
771
+ onCleanup(() => n.ve?.());
772
+ }
773
+ const W = {};
774
+ function markDisposal(e) {
775
+ let t = e.Pe;
776
+ while (t) {
777
+ t._ |= o;
778
+ if (t._ & i) {
779
+ deleteFromHeap(t, _);
780
+ insertIntoHeap(t, b);
859
781
  }
782
+ markDisposal(t);
783
+ t = t.Ae;
860
784
  }
861
- if (r._ & (n | f) || (r.oe && r.fe < O)) {
862
- recompute(r);
785
+ }
786
+ function dispose(e) {
787
+ let t = e.N || null;
788
+ do {
789
+ t = unlinkSubs(t);
790
+ } while (t !== null);
791
+ e.N = null;
792
+ e.ke = null;
793
+ disposeChildren(e, true);
794
+ }
795
+ function disposeChildren(e, t = false, n) {
796
+ if (e._ & u) return;
797
+ if (t) e._ = u;
798
+ let r = n ? e.Ce : e.Pe;
799
+ while (r) {
800
+ const e = r.Ae;
801
+ if (r.N) {
802
+ const e = r;
803
+ deleteFromHeap(e, e._ & o ? b : _);
804
+ let t = e.N;
805
+ do {
806
+ t = unlinkSubs(t);
807
+ } while (t !== null);
808
+ e.N = null;
809
+ e.ke = null;
810
+ }
811
+ disposeChildren(r, true);
812
+ r = e;
863
813
  }
864
- r._ = e;
814
+ if (n) {
815
+ e.Ce = null;
816
+ } else {
817
+ e.Pe = null;
818
+ e.Ae = null;
819
+ }
820
+ runDisposal(e, n);
821
+ }
822
+ function runDisposal(e, t) {
823
+ let n = t ? e.We : e.Ee;
824
+ if (!n) return;
825
+ if (Array.isArray(n)) {
826
+ for (let e = 0; e < n.length; e++) {
827
+ const t = n[e];
828
+ t.call(t);
829
+ }
830
+ } else {
831
+ n.call(n);
832
+ }
833
+ t ? (e.We = null) : (e.Ee = null);
834
+ }
835
+ function getNextChildId(e) {
836
+ if (e.id != null) return formatId(e.id, e.je++);
837
+ throw new Error("Cannot get child id from owner without an id");
838
+ }
839
+ function formatId(e, t) {
840
+ const n = t.toString(36),
841
+ r = n.length - 1;
842
+ return e + (r ? String.fromCharCode(64 + r) : "") + n;
843
+ }
844
+ function getObserver() {
845
+ if (L || H) return W;
846
+ return E ? Q : null;
847
+ }
848
+ function getOwner() {
849
+ return Q;
850
+ }
851
+ function onCleanup(e) {
852
+ if (!Q) return e;
853
+ if (!Q.Ee) Q.Ee = e;
854
+ else if (Array.isArray(Q.Ee)) Q.Ee.push(e);
855
+ else Q.Ee = [Q.Ee, e];
856
+ return e;
857
+ }
858
+ function createOwner(e) {
859
+ const t = Q;
860
+ const n = {
861
+ id: e?.id ?? (t?.id != null ? getNextChildId(t) : undefined),
862
+ i: true,
863
+ l: t?.i ? t.l : t,
864
+ Pe: null,
865
+ Ae: null,
866
+ Ee: null,
867
+ ue: t?.ue ?? A,
868
+ Ne: t?.Ne || w,
869
+ je: 0,
870
+ We: null,
871
+ Ce: null,
872
+ o: t,
873
+ dispose(e = true) {
874
+ disposeChildren(n, e);
875
+ }
876
+ };
877
+ if (t) {
878
+ const e = t.Pe;
879
+ if (e === null) {
880
+ t.Pe = n;
881
+ } else {
882
+ n.Ae = e;
883
+ t.Pe = n;
884
+ }
885
+ }
886
+ return n;
887
+ }
888
+ function createRoot(e, t) {
889
+ const n = createOwner(t);
890
+ return runWithOwner(n, () => e(n.dispose));
865
891
  }
866
892
  function unlinkSubs(e) {
867
893
  const t = e.I;
868
894
  const n = e.L;
869
- const r = e.C;
870
- const i = e.Ce;
871
- if (r !== null) r.Ce = i;
872
- else t.ke = i;
873
- if (i !== null) i.C = r;
895
+ const r = e.A;
896
+ const i = e.Le;
897
+ if (r !== null) r.Le = i;
898
+ else t.Ie = i;
899
+ if (i !== null) i.A = r;
874
900
  else {
875
901
  t.P = r;
876
902
  if (r === null) {
877
- t.Ae?.();
878
- t.R && !t.Ee && unobserved(t);
903
+ t.He?.();
904
+ t.R && !t.Qe && unobserved(t);
879
905
  }
880
906
  }
881
907
  return n;
@@ -890,27 +916,27 @@ function unobserved(e) {
890
916
  disposeChildren(e, true);
891
917
  }
892
918
  function link(e, t) {
893
- const n = t.be;
919
+ const n = t.ke;
894
920
  if (n !== null && n.I === e) return;
895
921
  let i = null;
896
922
  const s = t._ & r;
897
923
  if (s) {
898
924
  i = n !== null ? n.L : t.N;
899
925
  if (i !== null && i.I === e) {
900
- t.be = i;
926
+ t.ke = i;
901
927
  return;
902
928
  }
903
929
  }
904
- const o = e.ke;
930
+ const o = e.Ie;
905
931
  if (o !== null && o.k === t && (!s || isValidLink(o, t))) return;
906
- const u = (t.be = e.ke = { I: e, k: t, L: i, Ce: o, C: null });
932
+ const u = (t.ke = e.Ie = { I: e, k: t, L: i, Le: o, A: null });
907
933
  if (n !== null) n.L = u;
908
934
  else t.N = u;
909
- if (o !== null) o.C = u;
935
+ if (o !== null) o.A = u;
910
936
  else e.P = u;
911
937
  }
912
938
  function isValidLink(e, t) {
913
- const n = t.be;
939
+ const n = t.ke;
914
940
  if (n !== null) {
915
941
  let r = t.N;
916
942
  do {
@@ -921,117 +947,171 @@ function isValidLink(e, t) {
921
947
  }
922
948
  return false;
923
949
  }
924
- function markDisposal(e) {
925
- let t = e._e;
926
- while (t) {
927
- t._ |= o;
928
- if (t._ & i) {
929
- deleteFromHeap(t, _);
930
- insertIntoHeap(t, b);
950
+ GlobalQueue.U = recompute;
951
+ GlobalQueue.J = disposeChildren;
952
+ let E = false;
953
+ let j = false;
954
+ let N = false;
955
+ let L = false;
956
+ let I = false;
957
+ let H = false;
958
+ let Q = null;
959
+ let R = null;
960
+ function recompute(t, n = false) {
961
+ const i = t.se;
962
+ if (!n) {
963
+ if (t.re && (!i || x) && x !== t.re) A.initTransition(t.re);
964
+ deleteFromHeap(t, t._ & o ? b : _);
965
+ if (t.re || i === h) disposeChildren(t);
966
+ else {
967
+ markDisposal(t);
968
+ t.We = t.Ee;
969
+ t.Ce = t.Pe;
970
+ t.Ee = null;
971
+ t.Pe = null;
931
972
  }
932
- markDisposal(t);
933
- t = t.We;
934
973
  }
935
- }
936
- function dispose(e) {
937
- let t = e.N || null;
938
- do {
939
- t = unlinkSubs(t);
940
- } while (t !== null);
941
- e.N = null;
942
- e.be = null;
943
- disposeChildren(e, true);
944
- }
945
- function disposeChildren(e, t = false, n) {
946
- if (e._ & u) return;
947
- if (t) e._ = u;
948
- let r = n ? e.me : e._e;
949
- while (r) {
950
- const e = r.We;
951
- if (r.N) {
952
- const e = r;
953
- deleteFromHeap(e, e._ & o ? b : _);
954
- let t = e.N;
955
- do {
956
- t = unlinkSubs(t);
957
- } while (t !== null);
958
- e.N = null;
959
- e.be = null;
974
+ const s = !!(t._ & f);
975
+ const u = hasActiveOverride(t);
976
+ const a = !!(t.ae & l);
977
+ const d = Q;
978
+ Q = t;
979
+ t.ke = null;
980
+ t._ = r;
981
+ t.ee = O;
982
+ let p = t.le === y ? t.ce : t.le;
983
+ let g = t.u;
984
+ let w = E;
985
+ let S = R;
986
+ E = true;
987
+ if (s) {
988
+ const e = resolveLane(t);
989
+ if (e) R = e;
990
+ }
991
+ try {
992
+ p = handleAsync(t, t.R(p));
993
+ clearStatus(t);
994
+ const e = resolveLane(t);
995
+ if (e) {
996
+ e.M.delete(t);
997
+ updatePendingSignal(e.t);
960
998
  }
961
- disposeChildren(r, true);
962
- r = e;
999
+ } catch (e) {
1000
+ if (e instanceof NotReadyError && R) {
1001
+ const e = findLane(R);
1002
+ if (e.t !== t) {
1003
+ e.M.add(t);
1004
+ t.ie = e;
1005
+ updatePendingSignal(e.t);
1006
+ }
1007
+ }
1008
+ notifyStatus(
1009
+ t,
1010
+ e instanceof NotReadyError ? l : c,
1011
+ e,
1012
+ undefined,
1013
+ e instanceof NotReadyError ? t.ie : undefined
1014
+ );
1015
+ } finally {
1016
+ E = w;
1017
+ t._ = e;
1018
+ Q = d;
963
1019
  }
964
- if (n) {
965
- e.me = null;
966
- } else {
967
- e._e = null;
968
- e.We = null;
1020
+ if (!t.Z) {
1021
+ const e = t.ke;
1022
+ let r = e !== null ? e.L : t.N;
1023
+ if (r !== null) {
1024
+ do {
1025
+ r = unlinkSubs(r);
1026
+ } while (r !== null);
1027
+ if (e !== null) e.L = null;
1028
+ else t.N = null;
1029
+ }
1030
+ const f = u ? t.ce : t.le === y ? t.ce : t.le;
1031
+ const l = !t.Se || !t.Se(f, p);
1032
+ if (l) {
1033
+ const e = u ? t.ce : undefined;
1034
+ if (n || (i && x !== t.re) || s) t.ce = p;
1035
+ else t.le = p;
1036
+ if (u && !s && a) {
1037
+ const e = t.ye || 0;
1038
+ const n = t.he || 0;
1039
+ if (e <= n) t.ce = p;
1040
+ }
1041
+ if (!u || s || t.ce !== e) {
1042
+ insertSubs(t, s || u);
1043
+ }
1044
+ } else if (u) {
1045
+ t.le = p;
1046
+ } else if (t.u != g) {
1047
+ for (let e = t.P; e !== null; e = e.A) {
1048
+ insertIntoHeapHeight(e.k, e.k._ & o ? b : _);
1049
+ }
1050
+ }
969
1051
  }
970
- runDisposal(e, n);
1052
+ R = S;
1053
+ (!n || t.ae & l) && !t.re && !(x && t.ge) && A.B.push(t);
1054
+ t.re && i && x !== t.re && runInTransition(t.re, () => recompute(t));
971
1055
  }
972
- function runDisposal(e, t) {
973
- let n = t ? e.we : e.Se;
974
- if (!n) return;
975
- if (Array.isArray(n)) {
976
- for (let e = 0; e < n.length; e++) {
977
- const t = n[e];
978
- t.call(t);
1056
+ function updateIfNecessary(r) {
1057
+ if (r._ & t) {
1058
+ for (let e = r.N; e; e = e.L) {
1059
+ const t = e.I;
1060
+ const i = t.H || t;
1061
+ if (i.R) {
1062
+ updateIfNecessary(i);
1063
+ }
1064
+ if (r._ & n) {
1065
+ break;
1066
+ }
979
1067
  }
980
- } else {
981
- n.call(n);
982
1068
  }
983
- t ? (e.we = null) : (e.Se = null);
984
- }
985
- function getNextChildId(e) {
986
- if (e.id != null) return formatId(e.id, e.je++);
987
- throw new Error("Cannot get child id from owner without an id");
988
- }
989
- function formatId(e, t) {
990
- const n = t.toString(36),
991
- r = n.length - 1;
992
- return e + (r ? String.fromCharCode(64 + r) : "") + n;
1069
+ if (r._ & (n | f) || (r.Z && r.ee < O)) {
1070
+ recompute(r);
1071
+ }
1072
+ r._ = e;
993
1073
  }
994
1074
  function computed(t, n, r) {
995
1075
  const i = {
996
- id: r?.id ?? (H?.id != null ? getNextChildId(H) : undefined),
997
- Oe: r?.equals != null ? r.equals : isEqual,
998
- Ne: !!r?.pureWrite,
999
- Ae: r?.unobserved,
1000
- Se: null,
1001
- pe: H?.pe ?? E,
1002
- Le: H?.Le ?? w,
1076
+ id: r?.id ?? (Q?.id != null ? getNextChildId(Q) : undefined),
1077
+ Se: r?.equals != null ? r.equals : isEqual,
1078
+ Re: !!r?.pureWrite,
1079
+ He: r?.unobserved,
1080
+ Ee: null,
1081
+ ue: Q?.ue ?? A,
1082
+ Ne: Q?.Ne ?? w,
1003
1083
  je: 0,
1004
1084
  R: t,
1005
- ye: n,
1085
+ ce: n,
1006
1086
  u: 0,
1007
- A: null,
1087
+ C: null,
1008
1088
  S: undefined,
1009
1089
  h: null,
1010
1090
  N: null,
1011
- be: null,
1012
- P: null,
1013
1091
  ke: null,
1014
- o: H,
1015
- We: null,
1016
- _e: null,
1092
+ P: null,
1093
+ Ie: null,
1094
+ o: Q,
1095
+ Ae: null,
1096
+ Pe: null,
1017
1097
  _: e,
1018
- ge: a,
1019
- fe: O,
1020
- J: y,
1098
+ ae: a,
1099
+ ee: O,
1100
+ le: y,
1101
+ We: null,
1102
+ Ce: null,
1021
1103
  we: null,
1022
- me: null,
1023
- xe: null,
1024
- B: null
1104
+ re: null
1025
1105
  };
1026
1106
  i.h = i;
1027
- const s = H?.i ? H.l : H;
1028
- if (H) {
1029
- const e = H._e;
1107
+ const s = Q?.i ? Q.l : Q;
1108
+ if (Q) {
1109
+ const e = Q.Pe;
1030
1110
  if (e === null) {
1031
- H._e = i;
1111
+ Q.Pe = i;
1032
1112
  } else {
1033
- i.We = e;
1034
- H._e = i;
1113
+ i.Ae = e;
1114
+ Q.Pe = i;
1035
1115
  }
1036
1116
  }
1037
1117
  if (s) i.u = s.u + 1;
@@ -1040,112 +1120,55 @@ function computed(t, n, r) {
1040
1120
  }
1041
1121
  function signal(e, t, n = null) {
1042
1122
  const r = {
1043
- Oe: t?.equals != null ? t.equals : isEqual,
1044
- Ne: !!t?.pureWrite,
1045
- Ae: t?.unobserved,
1046
- ye: e,
1123
+ Se: t?.equals != null ? t.equals : isEqual,
1124
+ Re: !!t?.pureWrite,
1125
+ He: t?.unobserved,
1126
+ ce: e,
1047
1127
  P: null,
1048
- ke: null,
1049
- fe: O,
1128
+ Ie: null,
1129
+ ee: O,
1050
1130
  H: n,
1051
- W: n?.A || null,
1052
- J: y
1131
+ W: n?.C || null,
1132
+ le: y
1053
1133
  };
1054
- n && (n.A = r);
1134
+ n && (n.C = r);
1055
1135
  return r;
1056
1136
  }
1057
1137
  function optimisticSignal(e, t) {
1058
1138
  const n = signal(e, t);
1059
- n.U = true;
1139
+ n.ge = true;
1060
1140
  return n;
1061
1141
  }
1062
1142
  function optimisticComputed(e, t, n) {
1063
1143
  const r = computed(e, t, n);
1064
- r.U = true;
1144
+ r.ge = true;
1065
1145
  return r;
1066
1146
  }
1067
- function getPendingSignal(e) {
1068
- if (!e.Qe) {
1069
- e.Qe = optimisticSignal(false, { pureWrite: true });
1070
- if (e.T) {
1071
- e.Qe.T = e;
1072
- }
1073
- if (computePendingState(e)) setSignal(e.Qe, true);
1074
- }
1075
- return e.Qe;
1076
- }
1077
- function computePendingState(e) {
1078
- const t = e;
1079
- if (e.U && e.J !== y) {
1080
- if (t.ge & l && !(t.ge & a)) return true;
1081
- if (e.T) {
1082
- const t = e.M ? findLane(e.M) : null;
1083
- return !!(t && t.q.size > 0);
1084
- }
1085
- return true;
1086
- }
1087
- if (e.J !== y && !(t.ge & a)) return true;
1088
- return !!(t.ge & l && !(t.ge & a));
1089
- }
1090
- function getPendingValueComputed(e) {
1091
- if (!e.ve) {
1092
- const t = I;
1093
- I = false;
1094
- const n = L;
1095
- L = false;
1096
- const r = H;
1097
- H = null;
1098
- e.ve = optimisticComputed(() => read(e));
1099
- e.ve.T = e;
1100
- H = r;
1101
- L = n;
1102
- I = t;
1103
- }
1104
- return e.ve;
1105
- }
1106
- function updatePendingSignal(e) {
1107
- if (e.Qe) {
1108
- const t = computePendingState(e);
1109
- const n = e.Qe;
1110
- setSignal(n, t);
1111
- if (!t && n.M) {
1112
- const t = resolveLane(e);
1113
- if (t && t.q.size > 0) {
1114
- const e = findLane(n.M);
1115
- if (e !== t) {
1116
- mergeLanes(t, e);
1117
- }
1118
- }
1119
- clearLaneEntry(n);
1120
- n.M = undefined;
1121
- }
1122
- }
1123
- }
1124
1147
  function isEqual(e, t) {
1125
1148
  return e === t;
1126
1149
  }
1127
1150
  function untrack(e) {
1128
- if (!W) return e();
1129
- W = false;
1151
+ if (!E) return e();
1152
+ E = false;
1130
1153
  try {
1131
1154
  return e();
1132
1155
  } finally {
1133
- W = true;
1156
+ E = true;
1134
1157
  }
1135
1158
  }
1136
1159
  function read(e) {
1137
- if (I) {
1160
+ if (H) {
1138
1161
  const t = getPendingValueComputed(e);
1139
- const n = I;
1140
- I = false;
1162
+ const n = H;
1163
+ H = false;
1141
1164
  const r = read(t);
1142
- I = n;
1143
- if (t.ge & l) return e.ye;
1144
- if (j && A && t.M) {
1145
- const n = findLane(t.M);
1146
- const r = findLane(A);
1147
- if (n !== r && n.q.size > 0) {
1148
- return e.ye;
1165
+ H = n;
1166
+ if (t.ae & l) return e.ce;
1167
+ if (j && R && t.ie) {
1168
+ const n = findLane(t.ie);
1169
+ const r = findLane(R);
1170
+ if (n !== r && n.M.size > 0) {
1171
+ return e.ce;
1149
1172
  }
1150
1173
  }
1151
1174
  return r;
@@ -1156,15 +1179,15 @@ function read(e) {
1156
1179
  const r = L;
1157
1180
  L = false;
1158
1181
  if (read(n)) {
1159
- Q = true;
1182
+ I = true;
1160
1183
  }
1161
1184
  L = r;
1162
- return e.ye;
1185
+ return e.ce;
1163
1186
  }
1164
- let t = H;
1187
+ let t = Q;
1165
1188
  if (t?.i) t = t.l;
1166
1189
  if (N && e.R) recompute(e);
1167
- if (t && W) {
1190
+ if (t && E) {
1168
1191
  if (e.R && e._ & u) recompute(e);
1169
1192
  link(e, t);
1170
1193
  const n = e.H || e;
@@ -1182,128 +1205,136 @@ function read(e) {
1182
1205
  }
1183
1206
  }
1184
1207
  const n = e.H || e;
1185
- if (t && n.ge & l && !(j && n.B && x !== n.B)) {
1186
- if (A) {
1187
- const r = n.M;
1188
- const i = findLane(A);
1208
+ if (t && n.ae & l && !(j && n.re && x !== n.re)) {
1209
+ if (R) {
1210
+ const r = n.ie;
1211
+ const i = findLane(R);
1189
1212
  if (r && findLane(r) === i && !hasActiveOverride(n)) {
1190
- if (!W) link(e, t);
1191
- throw n.oe;
1213
+ if (!E) link(e, t);
1214
+ throw n.Z;
1192
1215
  }
1193
1216
  } else {
1194
- if (!W) link(e, t);
1195
- throw n.oe;
1217
+ if (!E) link(e, t);
1218
+ throw n.Z;
1196
1219
  }
1197
1220
  }
1198
- if (e.R && e.ge & c) {
1199
- if (e.fe < O) {
1221
+ if (e.R && e.ae & c) {
1222
+ if (e.ee < O) {
1200
1223
  recompute(e, true);
1201
1224
  return read(e);
1202
- } else throw e.oe;
1225
+ } else throw e.Z;
1203
1226
  }
1204
- return !t || A !== null || e.J === y || (j && e.B && x !== e.B) ? e.ye : e.J;
1227
+ return !t || R !== null || e.le === y || (j && e.re && x !== e.re) ? e.ce : e.le;
1205
1228
  }
1206
1229
  function setSignal(e, t) {
1207
- if (e.B && x !== e.B) E.initTransition(e.B);
1208
- const n = e.U && !P;
1209
- const r = n ? e.ye : e.J === y ? e.ye : e.J;
1230
+ if (e.re && x !== e.re) A.initTransition(e.re);
1231
+ const n = e.ge && !P;
1232
+ const r = n ? e.ce : e.le === y ? e.ce : e.le;
1210
1233
  if (typeof t === "function") t = t(r);
1211
- const i = !e.Oe || !e.Oe(r, t);
1234
+ const i = !e.Se || !e.Se(r, t);
1212
1235
  if (!i) {
1213
- if (n && e.J !== y && e.R) {
1236
+ if (n && e.le !== y && e.R) {
1214
1237
  insertSubs(e, true);
1215
1238
  schedule();
1216
1239
  }
1217
1240
  return t;
1218
1241
  }
1219
1242
  if (n) {
1220
- const n = E.ee.includes(e);
1221
- if (e.B && n) {
1222
- E.initTransition(e.B);
1243
+ const n = A.G.includes(e);
1244
+ if (e.re && n) {
1245
+ A.initTransition(e.re);
1223
1246
  }
1224
- if (e.J === y) {
1225
- e.J = e.ye;
1247
+ if (e.le === y) {
1248
+ e.le = e.ce;
1226
1249
  }
1227
1250
  if (!n) {
1228
- E.ee.push(e);
1251
+ A.G.push(e);
1229
1252
  }
1230
- e.K = (e.K || 0) + 1;
1253
+ e.ye = (e.ye || 0) + 1;
1231
1254
  const r = getOrCreateLane(e);
1232
- e.M = r;
1233
- e.ye = t;
1255
+ e.ie = r;
1256
+ e.ce = t;
1234
1257
  } else {
1235
- if (e.J === y) E.$.push(e);
1236
- e.J = t;
1258
+ if (e.le === y) A.B.push(e);
1259
+ e.le = t;
1237
1260
  }
1238
1261
  updatePendingSignal(e);
1239
- if (e.ve) {
1240
- setSignal(e.ve, t);
1262
+ if (e.me) {
1263
+ setSignal(e.me, t);
1241
1264
  }
1242
- e.fe = O;
1265
+ e.ee = O;
1243
1266
  insertSubs(e, n);
1244
1267
  schedule();
1245
1268
  return t;
1246
1269
  }
1247
- const R = {};
1248
- function getObserver() {
1249
- if (L || I) return R;
1250
- return W ? H : null;
1251
- }
1252
- function getOwner() {
1253
- return H;
1254
- }
1255
- function onCleanup(e) {
1256
- if (!H) return e;
1257
- if (!H.Se) H.Se = e;
1258
- else if (Array.isArray(H.Se)) H.Se.push(e);
1259
- else H.Se = [H.Se, e];
1260
- return e;
1270
+ function runWithOwner(e, t) {
1271
+ const n = Q;
1272
+ const r = E;
1273
+ Q = e;
1274
+ E = false;
1275
+ try {
1276
+ return t();
1277
+ } finally {
1278
+ Q = n;
1279
+ E = r;
1280
+ }
1261
1281
  }
1262
- function createOwner(e) {
1263
- const t = H;
1264
- const n = {
1265
- id: e?.id ?? (t?.id != null ? getNextChildId(t) : undefined),
1266
- i: true,
1267
- l: t?.i ? t.l : t,
1268
- _e: null,
1269
- We: null,
1270
- Se: null,
1271
- pe: t?.pe ?? E,
1272
- Le: t?.Le || w,
1273
- je: 0,
1274
- we: null,
1275
- me: null,
1276
- o: t,
1277
- dispose(e = true) {
1278
- disposeChildren(n, e);
1282
+ function getPendingSignal(e) {
1283
+ if (!e.Te) {
1284
+ e.Te = optimisticSignal(false, { pureWrite: true });
1285
+ if (e.de) {
1286
+ e.Te.de = e;
1279
1287
  }
1280
- };
1281
- if (t) {
1282
- const e = t._e;
1283
- if (e === null) {
1284
- t._e = n;
1285
- } else {
1286
- n.We = e;
1287
- t._e = n;
1288
+ if (computePendingState(e)) setSignal(e.Te, true);
1289
+ }
1290
+ return e.Te;
1291
+ }
1292
+ function computePendingState(e) {
1293
+ const t = e;
1294
+ if (e.ge && e.le !== y) {
1295
+ if (t.ae & l && !(t.ae & a)) return true;
1296
+ if (e.de) {
1297
+ const t = e.ie ? findLane(e.ie) : null;
1298
+ return !!(t && t.M.size > 0);
1288
1299
  }
1300
+ return true;
1289
1301
  }
1290
- return n;
1302
+ if (e.le !== y && !(t.ae & a)) return true;
1303
+ return !!(t.ae & l && !(t.ae & a));
1291
1304
  }
1292
- function createRoot(e, t) {
1293
- const n = createOwner(t);
1294
- return runWithOwner(n, () => e(n.dispose));
1305
+ function updatePendingSignal(e) {
1306
+ if (e.Te) {
1307
+ const t = computePendingState(e);
1308
+ const n = e.Te;
1309
+ setSignal(n, t);
1310
+ if (!t && n.ie) {
1311
+ const t = resolveLane(e);
1312
+ if (t && t.M.size > 0) {
1313
+ const e = findLane(n.ie);
1314
+ if (e !== t) {
1315
+ mergeLanes(t, e);
1316
+ }
1317
+ }
1318
+ k.delete(n);
1319
+ n.ie = undefined;
1320
+ }
1321
+ }
1295
1322
  }
1296
- function runWithOwner(e, t) {
1297
- const n = H;
1298
- const r = W;
1299
- H = e;
1300
- W = false;
1301
- try {
1302
- return t();
1303
- } finally {
1304
- H = n;
1305
- W = r;
1323
+ function getPendingValueComputed(e) {
1324
+ if (!e.me) {
1325
+ const t = H;
1326
+ H = false;
1327
+ const n = L;
1328
+ L = false;
1329
+ const r = Q;
1330
+ Q = null;
1331
+ e.me = optimisticComputed(() => read(e));
1332
+ e.me.de = e;
1333
+ Q = r;
1334
+ L = n;
1335
+ H = t;
1306
1336
  }
1337
+ return e.me;
1307
1338
  }
1308
1339
  function staleValues(e, t = true) {
1309
1340
  const n = j;
@@ -1315,27 +1346,27 @@ function staleValues(e, t = true) {
1315
1346
  }
1316
1347
  }
1317
1348
  function pending(e) {
1318
- const t = I;
1319
- I = true;
1349
+ const t = H;
1350
+ H = true;
1320
1351
  try {
1321
1352
  return e();
1322
1353
  } finally {
1323
- I = t;
1354
+ H = t;
1324
1355
  }
1325
1356
  }
1326
1357
  function isPending(e) {
1327
1358
  const t = L;
1328
- const n = Q;
1359
+ const n = I;
1329
1360
  L = true;
1330
- Q = false;
1361
+ I = false;
1331
1362
  try {
1332
1363
  e();
1333
- return Q;
1364
+ return I;
1334
1365
  } catch {
1335
- return Q;
1366
+ return I;
1336
1367
  } finally {
1337
1368
  L = t;
1338
- Q = n;
1369
+ I = n;
1339
1370
  }
1340
1371
  }
1341
1372
  function refresh(e) {
@@ -1364,7 +1395,7 @@ function getContext(e, t = getOwner()) {
1364
1395
  if (!t) {
1365
1396
  throw new NoOwnerError();
1366
1397
  }
1367
- const n = hasContext(e, t) ? t.Le[e.id] : e.defaultValue;
1398
+ const n = hasContext(e, t) ? t.Ne[e.id] : e.defaultValue;
1368
1399
  if (isUndefined(n)) {
1369
1400
  throw new ContextNotFoundError();
1370
1401
  }
@@ -1374,93 +1405,57 @@ function setContext(e, t, n = getOwner()) {
1374
1405
  if (!n) {
1375
1406
  throw new NoOwnerError();
1376
1407
  }
1377
- n.Le = { ...n.Le, [e.id]: isUndefined(t) ? e.defaultValue : t };
1408
+ n.Ne = { ...n.Ne, [e.id]: isUndefined(t) ? e.defaultValue : t };
1378
1409
  }
1379
1410
  function hasContext(e, t) {
1380
- return !isUndefined(t?.Le[e.id]);
1411
+ return !isUndefined(t?.Ne[e.id]);
1381
1412
  }
1382
1413
  function isUndefined(e) {
1383
1414
  return typeof e === "undefined";
1384
1415
  }
1385
- function effect(e, t, n, r, i) {
1386
- let s = false;
1387
- const o = computed(i?.render ? t => staleValues(() => e(t)) : e, r, {
1388
- ...i,
1389
- equals: () => {
1390
- o.de = !o.oe;
1391
- if (s) o.pe.enqueue(o.ae, runEffect.bind(o));
1392
- return false;
1393
- },
1394
- lazy: true
1395
- });
1396
- o.Ie = r;
1397
- o.He = t;
1398
- o.Re = n;
1399
- o.Te = undefined;
1400
- o.ae = i?.render ? d : p;
1401
- o.Pe = (e, t) => {
1402
- const n = e !== undefined ? e : o.ge;
1403
- const r = t !== undefined ? t : o.oe;
1404
- if (n & c) {
1405
- let e = r;
1406
- o.pe.notify(o, l, 0);
1407
- if (o.ae === p) {
1416
+ function restoreTransition(e, t) {
1417
+ A.initTransition(e);
1418
+ const n = t();
1419
+ flush();
1420
+ return n;
1421
+ }
1422
+ function action(e) {
1423
+ return (...t) =>
1424
+ new Promise((n, r) => {
1425
+ const i = e(...t);
1426
+ A.initTransition();
1427
+ let s = x;
1428
+ s.te.push(i);
1429
+ const done = (e, t) => {
1430
+ s = currentTransition(s);
1431
+ const o = s.te.indexOf(i);
1432
+ if (o >= 0) s.te.splice(o, 1);
1433
+ setActiveTransition(s);
1434
+ schedule();
1435
+ t ? r(t) : n(e);
1436
+ };
1437
+ const step = (e, t) => {
1438
+ let n;
1408
1439
  try {
1409
- return o.Re
1410
- ? o.Re(e, () => {
1411
- o.Te?.();
1412
- o.Te = undefined;
1413
- })
1414
- : console.error(e);
1415
- } catch (t) {
1416
- e = t;
1440
+ n = t ? i.throw(e) : i.next(e);
1441
+ } catch (e) {
1442
+ return done(undefined, e);
1417
1443
  }
1418
- }
1419
- if (!o.pe.notify(o, c, c)) throw e;
1420
- } else if (o.ae === d) o.pe.notify(o, l | c, n, r);
1421
- };
1422
- recompute(o, true);
1423
- !i?.defer && (o.ae === p ? o.pe.enqueue(o.ae, runEffect.bind(o)) : runEffect.call(o));
1424
- s = true;
1425
- onCleanup(() => o.Te?.());
1426
- }
1427
- function runEffect() {
1428
- if (!this.de || this._ & u) return;
1429
- this.Te?.();
1430
- this.Te = undefined;
1431
- try {
1432
- this.Te = this.He(this.ye, this.Ie);
1433
- } catch (e) {
1434
- if (!this.pe.notify(this, c, c)) throw e;
1435
- } finally {
1436
- this.Ie = this.ye;
1437
- this.de = false;
1438
- }
1439
- }
1440
- function trackedEffect(e, t) {
1441
- const run = () => {
1442
- if (!n.de || n._ & u) return;
1443
- n.de = false;
1444
- recompute(n);
1445
- };
1446
- const n = computed(
1447
- () => {
1448
- try {
1449
- n.Te?.();
1450
- n.Te = undefined;
1451
- n.Te = staleValues(e) || undefined;
1452
- } finally {
1453
- }
1454
- },
1455
- undefined,
1456
- { ...t, lazy: true, pureWrite: true }
1457
- );
1458
- n.Te = undefined;
1459
- n.de = true;
1460
- n.ae = h;
1461
- n.he = run;
1462
- n.pe.enqueue(p, run);
1463
- onCleanup(() => n.Te?.());
1444
+ if (n instanceof Promise)
1445
+ return void n.then(run, e => restoreTransition(s, () => step(e, true)));
1446
+ run(n);
1447
+ };
1448
+ const run = e => {
1449
+ if (e.done) return done(e.value);
1450
+ if (e.value instanceof Promise)
1451
+ return void e.value.then(
1452
+ e => restoreTransition(s, () => step(e)),
1453
+ e => restoreTransition(s, () => step(e, true))
1454
+ );
1455
+ restoreTransition(s, () => step(e.value));
1456
+ };
1457
+ step();
1458
+ });
1464
1459
  }
1465
1460
  function createSignal(e, t, n) {
1466
1461
  if (typeof e === "function") {
@@ -1525,7 +1520,7 @@ function createOptimistic(e, t, n) {
1525
1520
  function onSettled(e) {
1526
1521
  getOwner()
1527
1522
  ? createTrackedEffect(() => untrack(e))
1528
- : E.enqueue(p, () => {
1523
+ : A.enqueue(p, () => {
1529
1524
  const t = e();
1530
1525
  t?.();
1531
1526
  });
@@ -1637,7 +1632,7 @@ function applyState(e, t, n, r) {
1637
1632
  const d = unwrap(getOverrideValue(s, o, u, c));
1638
1633
  let p = unwrap(e[c]);
1639
1634
  if (d === p) continue;
1640
- if (!d || !isWrappable(d) || (n(d) != null && n(d) !== n(p))) {
1635
+ if (!d || !isWrappable(d) || !isWrappable(p) || (n(d) != null && n(d) !== n(p))) {
1641
1636
  t && setSignal(t, void 0);
1642
1637
  a && setSignal(a, isWrappable(p) ? wrap(p, i) : p);
1643
1638
  } else applyState(p, wrap(d, i), n, r);
@@ -1692,7 +1687,7 @@ function createProjectionInternal(e, t = {}, n) {
1692
1687
  i !== r && i !== undefined && reconcile(i, n?.key || "id", n?.all)(s);
1693
1688
  });
1694
1689
  });
1695
- r.Ee = true;
1690
+ r.Qe = true;
1696
1691
  return { store: s, node: r };
1697
1692
  }
1698
1693
  function createProjection(e, t = {}, n) {
@@ -1738,8 +1733,8 @@ const M = Symbol(0),
1738
1733
  q = Symbol(0),
1739
1734
  F = Symbol(0),
1740
1735
  V = Symbol(0),
1741
- B = Symbol(0);
1742
- const D = new WeakMap();
1736
+ D = Symbol(0);
1737
+ const B = new WeakMap();
1743
1738
  const G = "v",
1744
1739
  K = "o",
1745
1740
  z = "x",
@@ -1792,7 +1787,7 @@ function getNode(e, t, n, r, i = isEqual, s) {
1792
1787
  },
1793
1788
  r
1794
1789
  );
1795
- if (s) o.U = true;
1790
+ if (s) o.ge = true;
1796
1791
  return (e[t] = o);
1797
1792
  }
1798
1793
  function trackSelf(e, t = M) {
@@ -1804,7 +1799,7 @@ function getKeys(e, t, n = true) {
1804
1799
  const i = new Set(r);
1805
1800
  const s = Reflect.ownKeys(t);
1806
1801
  for (const e of s) {
1807
- if (t[e] !== B) i.add(e);
1802
+ if (t[e] !== D) i.add(e);
1808
1803
  else i.delete(e);
1809
1804
  }
1810
1805
  return Array.from(i);
@@ -1812,7 +1807,7 @@ function getKeys(e, t, n = true) {
1812
1807
  function getPropertyDescriptor(e, t, n) {
1813
1808
  let r = e;
1814
1809
  if (t && n in t) {
1815
- if (r[n] === B) return void 0;
1810
+ if (r[n] === D) return void 0;
1816
1811
  if (!(n in r)) r = t;
1817
1812
  }
1818
1813
  return Reflect.getOwnPropertyDescriptor(r, n);
@@ -1838,15 +1833,15 @@ const re = {
1838
1833
  if (e && e.get) return e.get.call(n);
1839
1834
  }
1840
1835
  if (writeOnly(n)) {
1841
- let n = i && (o || !u) ? (i.J !== y ? (i.U ? i.ye : i.J) : i.ye) : f[t];
1842
- n === B && (n = undefined);
1836
+ let n = i && (o || !u) ? (i.le !== y ? (i.ge ? i.ce : i.le) : i.ce) : f[t];
1837
+ n === D && (n = undefined);
1843
1838
  if (!isWrappable(n)) return n;
1844
1839
  const r = wrap(n, e);
1845
1840
  ne?.add(r);
1846
1841
  return r;
1847
1842
  }
1848
1843
  let l = i ? (o || !u ? read(r[t]) : (read(r[t]), f[t])) : f[t];
1849
- l === B && (l = undefined);
1844
+ l === D && (l = undefined);
1850
1845
  if (!i) {
1851
1846
  if (!o && typeof l === "function" && !f.hasOwnProperty(t)) {
1852
1847
  let t;
@@ -1861,7 +1856,7 @@ const re = {
1861
1856
  },
1862
1857
  has(e, t) {
1863
1858
  if (t === V || t === M || t === "__proto__") return true;
1864
- const n = e[z] && t in e[z] ? e[z][t] !== B : e[K] && t in e[K] ? e[K][t] !== B : t in e[G];
1859
+ const n = e[z] && t in e[z] ? e[z][t] !== D : e[K] && t in e[K] ? e[K][t] !== D : t in e[G];
1865
1860
  getObserver() && read(getNode(getNodes(e, J), t, n, e[Z], isEqual, e[$]));
1866
1861
  return n;
1867
1862
  },
@@ -1870,8 +1865,8 @@ const re = {
1870
1865
  if (writeOnly(r)) {
1871
1866
  if (e[$]) {
1872
1867
  const t = e[Z];
1873
- if (t?.B) {
1874
- E.initTransition(t.B);
1868
+ if (t?.re) {
1869
+ A.initTransition(t.re);
1875
1870
  }
1876
1871
  }
1877
1872
  untrack(() => {
@@ -1888,8 +1883,8 @@ const re = {
1888
1883
  else (e[u] || (e[u] = Object.create(null)))[t] = l;
1889
1884
  const a = isWrappable(l);
1890
1885
  if (isWrappable(f)) {
1891
- const e = D.get(f);
1892
- e && (e instanceof Set ? e.delete(r) : D.delete(f));
1886
+ const e = B.get(f);
1887
+ e && (e instanceof Set ? e.delete(r) : B.delete(f));
1893
1888
  }
1894
1889
  if (recursivelyNotify(r, ee) && a) recursivelyAddParent(l, r);
1895
1890
  e[J]?.[t] && setSignal(e[J][t], true);
@@ -1909,8 +1904,8 @@ const re = {
1909
1904
  return true;
1910
1905
  },
1911
1906
  deleteProperty(e, t) {
1912
- const n = e[z]?.[t] === B;
1913
- const r = e[K]?.[t] === B;
1907
+ const n = e[z]?.[t] === D;
1908
+ const r = e[K]?.[t] === D;
1914
1909
  if (writeOnly(e[V]) && !n && !r) {
1915
1910
  untrack(() => {
1916
1911
  const n = e[$] && !P;
@@ -1918,13 +1913,13 @@ const re = {
1918
1913
  if (n) trackOptimisticStore(e[V]);
1919
1914
  const i = e[z] && t in e[z] ? e[z][t] : e[K] && t in e[K] ? e[K][t] : e[G][t];
1920
1915
  if (t in e[G] || (e[K] && t in e[K])) {
1921
- (e[r] || (e[r] = Object.create(null)))[t] = B;
1916
+ (e[r] || (e[r] = Object.create(null)))[t] = D;
1922
1917
  } else if (e[r] && t in e[r]) {
1923
1918
  delete e[r][t];
1924
1919
  } else return true;
1925
1920
  if (isWrappable(i)) {
1926
- const t = D.get(i);
1927
- t && (t instanceof Set ? t.delete(e) : D.delete(i));
1921
+ const t = B.get(i);
1922
+ t && (t instanceof Set ? t.delete(e) : B.delete(i));
1928
1923
  }
1929
1924
  if (e[J]?.[t]) setSignal(e[J][t], false);
1930
1925
  const s = getNodes(e, U);
@@ -1940,7 +1935,7 @@ const re = {
1940
1935
  if (e[z]) {
1941
1936
  const n = new Set(t);
1942
1937
  for (const t of Reflect.ownKeys(e[z])) {
1943
- if (e[z][t] !== B) n.add(t);
1938
+ if (e[z][t] !== D) n.add(t);
1944
1939
  else n.delete(t);
1945
1940
  }
1946
1941
  t = Array.from(n);
@@ -1950,7 +1945,7 @@ const re = {
1950
1945
  getOwnPropertyDescriptor(e, t) {
1951
1946
  if (t === V) return { value: e[V], writable: true, configurable: true };
1952
1947
  if (e[z] && t in e[z]) {
1953
- if (e[z][t] === B) return undefined;
1948
+ if (e[z][t] === D) return undefined;
1954
1949
  const n = getPropertyDescriptor(e[G], e[K], t);
1955
1950
  if (n) {
1956
1951
  return { ...n, value: e[z][t] };
@@ -2002,7 +1997,7 @@ function recursivelyNotify(e, t) {
2002
1997
  }
2003
1998
  t = n[Y] || t;
2004
1999
  }
2005
- const i = D.get(n?.[G] || e);
2000
+ const i = B.get(n?.[G] || e);
2006
2001
  if (!i) return r;
2007
2002
  if (i instanceof Set) {
2008
2003
  for (let e of i) r = recursivelyNotify(e, t) || r;
@@ -2017,10 +2012,10 @@ function recursivelyAddParent(e, t) {
2017
2012
  e = r[G];
2018
2013
  }
2019
2014
  if (t) {
2020
- let n = D.get(e);
2021
- if (!n) D.set(e, t);
2015
+ let n = B.get(e);
2016
+ if (!n) B.set(e, t);
2022
2017
  else if (n !== t) {
2023
- if (!(n instanceof Set)) D.set(e, (n = new Set([n])));
2018
+ if (!(n instanceof Set)) B.set(e, (n = new Set([n])));
2024
2019
  else if (n.has(t)) return;
2025
2020
  n.add(t);
2026
2021
  } else return;
@@ -2045,7 +2040,7 @@ function deep(e) {
2045
2040
  return e[q];
2046
2041
  }
2047
2042
  function createOptimisticStore(e, t, n) {
2048
- GlobalQueue.ie ||= clearOptimisticStore;
2043
+ GlobalQueue.X ||= clearOptimisticStore;
2049
2044
  const r = typeof e === "function";
2050
2045
  const i = (r ? t : e) ?? {};
2051
2046
  const s = r ? e : undefined;
@@ -2062,14 +2057,14 @@ function clearOptimisticStore(e) {
2062
2057
  if (r) {
2063
2058
  for (const e of Reflect.ownKeys(n)) {
2064
2059
  if (r[e]) {
2065
- r[e].M = undefined;
2060
+ r[e].ie = undefined;
2066
2061
  const n = t[K] && e in t[K] ? t[K][e] : t[G][e];
2067
- const i = n === B ? undefined : n;
2062
+ const i = n === D ? undefined : n;
2068
2063
  setSignal(r[e], isWrappable(i) ? wrap(i, t) : i);
2069
2064
  }
2070
2065
  }
2071
2066
  if (r[M]) {
2072
- r[M].M = undefined;
2067
+ r[M].ie = undefined;
2073
2068
  setSignal(r[M], undefined);
2074
2069
  }
2075
2070
  }
@@ -2120,7 +2115,7 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
2120
2115
  setProjectionWriteActive(false);
2121
2116
  }
2122
2117
  });
2123
- r.Ee = true;
2118
+ r.Qe = true;
2124
2119
  }
2125
2120
  return { store: s, node: r };
2126
2121
  }
@@ -2143,7 +2138,7 @@ function snapshot(e, t, n) {
2143
2138
  const r = s?.length || e.length;
2144
2139
  for (let i = 0; i < r; i++) {
2145
2140
  f = s && i in s ? s[i] : e[i];
2146
- if (f === B) continue;
2141
+ if (f === D) continue;
2147
2142
  if ((u = snapshot(f, t, n)) !== f || o) {
2148
2143
  if (!o) t.set(e, (o = [...e]));
2149
2144
  o[i] = u;
@@ -2305,8 +2300,8 @@ function mapArray(e, t, n) {
2305
2300
  qe: 0,
2306
2301
  Fe: e,
2307
2302
  Ve: [],
2308
- Be: t,
2309
- De: [],
2303
+ De: t,
2304
+ Be: [],
2310
2305
  Ge: [],
2311
2306
  Ke: r,
2312
2307
  ze: r || n?.keyed === false ? [] : undefined,
@@ -2327,7 +2322,7 @@ function updateKeyedMap() {
2327
2322
  ? () => {
2328
2323
  this.ze[r] = signal(e[r], oe);
2329
2324
  this.Ue && (this.Ue[r] = signal(r, oe));
2330
- return this.Be(
2325
+ return this.De(
2331
2326
  read.bind(null, this.ze[r]),
2332
2327
  this.Ue ? read.bind(null, this.Ue[r]) : undefined
2333
2328
  );
@@ -2336,31 +2331,31 @@ function updateKeyedMap() {
2336
2331
  ? () => {
2337
2332
  const t = e[r];
2338
2333
  this.Ue[r] = signal(r, oe);
2339
- return this.Be(() => t, read.bind(null, this.Ue[r]));
2334
+ return this.De(() => t, read.bind(null, this.Ue[r]));
2340
2335
  }
2341
2336
  : () => {
2342
2337
  const t = e[r];
2343
- return this.Be(() => t);
2338
+ return this.De(() => t);
2344
2339
  };
2345
2340
  if (t === 0) {
2346
2341
  if (this.qe !== 0) {
2347
2342
  this.Me.dispose(false);
2348
2343
  this.Ge = [];
2349
2344
  this.Ve = [];
2350
- this.De = [];
2345
+ this.Be = [];
2351
2346
  this.qe = 0;
2352
2347
  this.ze && (this.ze = []);
2353
2348
  this.Ue && (this.Ue = []);
2354
2349
  }
2355
- if (this.Je && !this.De[0]) {
2356
- this.De[0] = runWithOwner((this.Ge[0] = createOwner()), this.Je);
2350
+ if (this.Je && !this.Be[0]) {
2351
+ this.Be[0] = runWithOwner((this.Ge[0] = createOwner()), this.Je);
2357
2352
  }
2358
2353
  } else if (this.qe === 0) {
2359
2354
  if (this.Ge[0]) this.Ge[0].dispose();
2360
- this.De = new Array(t);
2355
+ this.Be = new Array(t);
2361
2356
  for (r = 0; r < t; r++) {
2362
2357
  this.Ve[r] = e[r];
2363
- this.De[r] = runWithOwner((this.Ge[r] = createOwner()), i);
2358
+ this.Be[r] = runWithOwner((this.Ge[r] = createOwner()), i);
2364
2359
  }
2365
2360
  this.qe = t;
2366
2361
  } else {
@@ -2389,7 +2384,7 @@ function updateKeyedMap() {
2389
2384
  (this.Ve[o] === e[u] || (this.ze && compare(this.Ke, this.Ve[o], e[u])));
2390
2385
  o--, u--
2391
2386
  ) {
2392
- d[u] = this.De[o];
2387
+ d[u] = this.Be[o];
2393
2388
  p[u] = this.Ge[o];
2394
2389
  h && (h[u] = this.ze[o]);
2395
2390
  y && (y[u] = this.Ue[o]);
@@ -2408,7 +2403,7 @@ function updateKeyedMap() {
2408
2403
  l = this.Ke ? this.Ke(f) : f;
2409
2404
  r = c.get(l);
2410
2405
  if (r !== undefined && r !== -1) {
2411
- d[r] = this.De[n];
2406
+ d[r] = this.Be[n];
2412
2407
  p[r] = this.Ge[n];
2413
2408
  h && (h[r] = this.ze[n]);
2414
2409
  y && (y[r] = this.Ue[n]);
@@ -2418,7 +2413,7 @@ function updateKeyedMap() {
2418
2413
  }
2419
2414
  for (r = s; r < t; r++) {
2420
2415
  if (r in d) {
2421
- this.De[r] = d[r];
2416
+ this.Be[r] = d[r];
2422
2417
  this.Ge[r] = p[r];
2423
2418
  if (h) {
2424
2419
  this.ze[r] = h[r];
@@ -2429,14 +2424,14 @@ function updateKeyedMap() {
2429
2424
  setSignal(this.Ue[r], r);
2430
2425
  }
2431
2426
  } else {
2432
- this.De[r] = runWithOwner((this.Ge[r] = createOwner()), i);
2427
+ this.Be[r] = runWithOwner((this.Ge[r] = createOwner()), i);
2433
2428
  }
2434
2429
  }
2435
- this.De = this.De.slice(0, (this.qe = t));
2430
+ this.Be = this.Be.slice(0, (this.qe = t));
2436
2431
  this.Ve = e.slice(0);
2437
2432
  }
2438
2433
  });
2439
- return this.De;
2434
+ return this.Be;
2440
2435
  }
2441
2436
  function repeat(e, t, n) {
2442
2437
  return updateRepeat.bind({
@@ -2444,9 +2439,9 @@ function repeat(e, t, n) {
2444
2439
  qe: 0,
2445
2440
  Xe: 0,
2446
2441
  Ye: e,
2447
- Be: t,
2442
+ De: t,
2448
2443
  Ge: [],
2449
- De: [],
2444
+ Be: [],
2450
2445
  Ze: n?.from,
2451
2446
  Je: n?.fallback
2452
2447
  });
@@ -2459,11 +2454,11 @@ function updateRepeat() {
2459
2454
  if (this.qe !== 0) {
2460
2455
  this.Me.dispose(false);
2461
2456
  this.Ge = [];
2462
- this.De = [];
2457
+ this.Be = [];
2463
2458
  this.qe = 0;
2464
2459
  }
2465
- if (this.Je && !this.De[0]) {
2466
- this.De[0] = runWithOwner((this.Ge[0] = createOwner()), this.Je);
2460
+ if (this.Je && !this.Be[0]) {
2461
+ this.Be[0] = runWithOwner((this.Ge[0] = createOwner()), this.Je);
2467
2462
  }
2468
2463
  return;
2469
2464
  }
@@ -2475,147 +2470,96 @@ function updateRepeat() {
2475
2470
  let e = this.Xe;
2476
2471
  while (e < t && e < this.qe) this.Ge[e++].dispose();
2477
2472
  this.Ge.splice(0, t - this.Xe);
2478
- this.De.splice(0, t - this.Xe);
2473
+ this.Be.splice(0, t - this.Xe);
2479
2474
  } else if (this.Xe > t) {
2480
2475
  let n = r - this.Xe - 1;
2481
2476
  let i = this.Xe - t;
2482
- this.Ge.length = this.De.length = e;
2477
+ this.Ge.length = this.Be.length = e;
2483
2478
  while (n >= i) {
2484
2479
  this.Ge[n] = this.Ge[n - i];
2485
- this.De[n] = this.De[n - i];
2480
+ this.Be[n] = this.Be[n - i];
2486
2481
  n--;
2487
2482
  }
2488
2483
  for (let e = 0; e < i; e++) {
2489
- this.De[e] = runWithOwner((this.Ge[e] = createOwner()), () => this.Be(e + t));
2484
+ this.Be[e] = runWithOwner((this.Ge[e] = createOwner()), () => this.De(e + t));
2490
2485
  }
2491
2486
  }
2492
2487
  for (let e = r; e < n; e++) {
2493
- this.De[e - t] = runWithOwner((this.Ge[e - t] = createOwner()), () => this.Be(e));
2488
+ this.Be[e - t] = runWithOwner((this.Ge[e - t] = createOwner()), () => this.De(e));
2494
2489
  }
2495
- this.De = this.De.slice(0, e);
2490
+ this.Be = this.Be.slice(0, e);
2496
2491
  this.Xe = t;
2497
2492
  this.qe = e;
2498
2493
  });
2499
- return this.De;
2494
+ return this.Be;
2500
2495
  }
2501
2496
  function compare(e, t, n) {
2502
2497
  return e ? e(t) === e(n) : true;
2503
2498
  }
2504
2499
  function boundaryComputed(e, t) {
2505
2500
  const n = computed(e, undefined, { lazy: true });
2506
- n.Pe = (e, t) => {
2507
- const r = e !== undefined ? e : n.ge;
2508
- const i = t !== undefined ? t : n.oe;
2509
- n.ge &= ~n.$e;
2510
- n.pe.notify(n, n.$e, r, i);
2501
+ n._e = (e, t) => {
2502
+ const r = e !== undefined ? e : n.ae;
2503
+ const i = t !== undefined ? t : n.Z;
2504
+ n.ae &= ~n.$e;
2505
+ n.ue.notify(n, n.$e, r, i);
2511
2506
  };
2512
2507
  n.$e = t;
2513
- n.Ee = true;
2508
+ n.Qe = true;
2514
2509
  recompute(n, true);
2515
2510
  return n;
2516
2511
  }
2517
2512
  function createBoundChildren(e, t, n, r) {
2518
- const i = e.pe;
2519
- i.addChild((e.pe = n));
2520
- onCleanup(() => i.removeChild(e.pe));
2513
+ const i = e.ue;
2514
+ i.addChild((e.ue = n));
2515
+ onCleanup(() => i.removeChild(e.ue));
2521
2516
  return runWithOwner(e, () => {
2522
2517
  const e = computed(t);
2523
2518
  return boundaryComputed(() => staleValues(() => flatten(read(e))), r);
2524
2519
  });
2525
2520
  }
2526
- class ConditionalQueue extends Queue {
2521
+ class CollectionQueue extends Queue {
2527
2522
  et;
2528
2523
  tt = new Set();
2529
- $ = new Set();
2524
+ nt = signal(false, { pureWrite: true });
2525
+ rt = false;
2530
2526
  constructor(e) {
2531
2527
  super();
2532
2528
  this.et = e;
2533
2529
  }
2534
2530
  run(e) {
2535
- if (!e || read(this.et)) return;
2536
- return super.run(e);
2537
- }
2538
- notify(e, t, n, r) {
2539
- if (read(this.et)) {
2540
- if (t & l) {
2541
- if (n & l) {
2542
- this.$.add(e);
2543
- t &= ~l;
2544
- } else if (this.$.delete(e)) t &= ~l;
2545
- }
2546
- if (t & c) {
2547
- if (n & c) {
2548
- this.tt.add(e);
2549
- t &= ~c;
2550
- } else if (this.tt.delete(e)) t &= ~c;
2551
- }
2552
- }
2553
- return t ? super.notify(e, t, n, r ?? e.oe) : true;
2554
- }
2555
- }
2556
- class CollectionQueue extends Queue {
2557
- nt;
2558
- rt = new Set();
2559
- et = signal(false, { pureWrite: true });
2560
- it = false;
2561
- constructor(e) {
2562
- super();
2563
- this.nt = e;
2564
- }
2565
- run(e) {
2566
- if (!e || read(this.et)) return;
2531
+ if (!e || read(this.nt)) return;
2567
2532
  return super.run(e);
2568
2533
  }
2569
2534
  notify(e, t, n, r) {
2570
- if (!(t & this.nt) || (this.nt & l && this.it)) return super.notify(e, t, n, r);
2571
- if (n & this.nt) {
2572
- const t = r?.t || e.oe?.t;
2535
+ if (!(t & this.et) || (this.et & l && this.rt)) return super.notify(e, t, n, r);
2536
+ if (n & this.et) {
2537
+ const t = r?.t || e.Z?.t;
2573
2538
  if (t) {
2574
- const e = this.rt.size === 0;
2575
- this.rt.add(t);
2576
- if (e) setSignal(this.et, true);
2539
+ const e = this.tt.size === 0;
2540
+ this.tt.add(t);
2541
+ if (e) setSignal(this.nt, true);
2577
2542
  }
2578
2543
  }
2579
- t &= ~this.nt;
2544
+ t &= ~this.et;
2580
2545
  return t ? super.notify(e, t, n, r) : true;
2581
2546
  }
2582
2547
  checkSources() {
2583
- for (const e of this.rt) {
2584
- if (!(e.ge & this.nt)) this.rt.delete(e);
2585
- }
2586
- if (!this.rt.size) setSignal(this.et, false);
2587
- }
2588
- }
2589
- var ue;
2590
- (function (e) {
2591
- e["VISIBLE"] = "visible";
2592
- e["HIDDEN"] = "hidden";
2593
- })(ue || (ue = {}));
2594
- function createBoundary(e, t) {
2595
- const n = createOwner();
2596
- const r = new ConditionalQueue(computed(() => t() === ue.HIDDEN));
2597
- const i = createBoundChildren(n, e, r, 0);
2598
- computed(() => {
2599
- const e = read(r.et);
2600
- i.$e = e ? c | l : 0;
2601
- if (!e) {
2602
- r.$.forEach(e => r.notify(e, l, l, e.oe));
2603
- r.tt.forEach(e => r.notify(e, c, c, e.oe));
2604
- r.$.clear();
2605
- r.tt.clear();
2548
+ for (const e of this.tt) {
2549
+ if (!(e.ae & this.et)) this.tt.delete(e);
2606
2550
  }
2607
- });
2608
- return () => (read(r.et) ? undefined : read(i));
2551
+ if (!this.tt.size) setSignal(this.nt, false);
2552
+ }
2609
2553
  }
2610
2554
  function createCollectionBoundary(e, t, n) {
2611
2555
  const r = createOwner();
2612
2556
  const i = new CollectionQueue(e);
2613
2557
  const s = createBoundChildren(r, t, i, e);
2614
2558
  const o = computed(() => {
2615
- if (!read(i.et)) {
2559
+ if (!read(i.nt)) {
2616
2560
  const e = read(s);
2617
- if (!untrack(() => read(i.et))) {
2618
- i.it = true;
2561
+ if (!untrack(() => read(i.nt))) {
2562
+ i.rt = true;
2619
2563
  return e;
2620
2564
  }
2621
2565
  }
@@ -2628,10 +2572,10 @@ function createLoadBoundary(e, t) {
2628
2572
  }
2629
2573
  function createErrorBoundary(e, t) {
2630
2574
  return createCollectionBoundary(c, e, e => {
2631
- let n = e.rt.values().next().value;
2632
- const r = n.oe?.cause ?? n.oe;
2575
+ let n = e.tt.values().next().value;
2576
+ const r = n.Z?.cause ?? n.Z;
2633
2577
  return t(r, () => {
2634
- for (const t of e.rt) recompute(t);
2578
+ for (const t of e.tt) recompute(t);
2635
2579
  schedule();
2636
2580
  });
2637
2581
  });
@@ -2693,7 +2637,6 @@ exports.NoOwnerError = NoOwnerError;
2693
2637
  exports.NotReadyError = NotReadyError;
2694
2638
  exports.SUPPORTS_PROXY = g;
2695
2639
  exports.action = action;
2696
- exports.createBoundary = createBoundary;
2697
2640
  exports.createContext = createContext;
2698
2641
  exports.createEffect = createEffect;
2699
2642
  exports.createErrorBoundary = createErrorBoundary;
@@ -2701,6 +2644,7 @@ exports.createLoadBoundary = createLoadBoundary;
2701
2644
  exports.createMemo = createMemo;
2702
2645
  exports.createOptimistic = createOptimistic;
2703
2646
  exports.createOptimisticStore = createOptimisticStore;
2647
+ exports.createOwner = createOwner;
2704
2648
  exports.createProjection = createProjection;
2705
2649
  exports.createReaction = createReaction;
2706
2650
  exports.createRenderEffect = createRenderEffect;