@solidjs/universal 2.0.0-beta.2 → 2.0.0-beta.4

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/dev.cjs CHANGED
@@ -96,7 +96,7 @@ function markNode(e, t = REACTIVE_DIRTY) {
96
96
  markNode(t.h, REACTIVE_CHECK);
97
97
  }
98
98
  if (e.A !== null) {
99
- for (let t = e.A; t !== null; t = t.P) {
99
+ for (let t = e.A; t !== null; t = t.N) {
100
100
  for (let e = t.I; e !== null; e = e.p) {
101
101
  markNode(e.h, REACTIVE_CHECK);
102
102
  }
@@ -105,11 +105,11 @@ function markNode(e, t = REACTIVE_DIRTY) {
105
105
  }
106
106
  function runHeap(e, t) {
107
107
  e._ = false;
108
- for (e.N = 0; e.N <= e.R; e.N++) {
109
- let n = e.l[e.N];
108
+ for (e.P = 0; e.P <= e.R; e.P++) {
109
+ let n = e.l[e.P];
110
110
  while (n !== undefined) {
111
111
  if (n.O & REACTIVE_IN_HEAP) t(n);else adjustHeight(n, e);
112
- n = e.l[e.N];
112
+ n = e.l[e.P];
113
113
  }
114
114
  }
115
115
  e.R = 0;
@@ -118,8 +118,8 @@ function adjustHeight(e, t) {
118
118
  deleteFromHeap(e, t);
119
119
  let n = e.o;
120
120
  for (let t = e.C; t; t = t.D) {
121
- const e = t.V;
122
- const i = e.m || e;
121
+ const e = t.m;
122
+ const i = e.V || e;
123
123
  if (i.L && i.o >= n) n = i.o + 1;
124
124
  }
125
125
  if (e.o !== n) {
@@ -133,46 +133,106 @@ const transitions = new Set();
133
133
  const dirtyQueue = {
134
134
  l: new Array(2e3).fill(undefined),
135
135
  _: false,
136
- N: 0,
136
+ P: 0,
137
137
  R: 0
138
138
  };
139
139
  const zombieQueue = {
140
140
  l: new Array(2e3).fill(undefined),
141
141
  _: false,
142
- N: 0,
142
+ P: 0,
143
143
  R: 0
144
144
  };
145
145
  let clock = 0;
146
146
  let activeTransition = null;
147
147
  let scheduled = false;
148
+ let stashedOptimisticReads = null;
148
149
  function runLaneEffects(e) {
149
150
  for (const t of activeLanes) {
150
- if (t.k || t.U.size > 0) continue;
151
- const n = t.W[e - 1];
151
+ if (t.U || t.k.size > 0) continue;
152
+ const n = t.G[e - 1];
152
153
  if (n.length) {
153
- t.W[e - 1] = [];
154
+ t.G[e - 1] = [];
154
155
  runQueue(n, e);
155
156
  }
156
157
  }
157
158
  }
159
+ function queueStashedOptimisticEffects(e) {
160
+ for (let t = e.I; t !== null; t = t.p) {
161
+ const e = t.h;
162
+ if (!e.W) continue;
163
+ if (e.W === EFFECT_TRACKED) {
164
+ if (!e.H) {
165
+ e.H = true;
166
+ e.F.enqueue(EFFECT_USER, e.M);
167
+ }
168
+ continue;
169
+ }
170
+ const n = e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
171
+ if (n.P > e.o) n.P = e.o;
172
+ insertIntoHeap(e, n);
173
+ }
174
+ }
175
+ function mergeTransitionState(e, t) {
176
+ t.$ = e;
177
+ e.j.push(...t.j);
178
+ for (const n of activeLanes) {
179
+ if (n.K === t) n.K = e;
180
+ }
181
+ e.Y.push(...t.Y);
182
+ for (const n of t.Z) e.Z.add(n);
183
+ for (const n of t.B) {
184
+ if (!e.B.includes(n)) e.B.push(n);
185
+ }
186
+ }
187
+ function resolveOptimisticNodes(e) {
188
+ for (let t = 0; t < e.length; t++) {
189
+ const n = e[t];
190
+ n.q = undefined;
191
+ if (n.X !== NOT_PENDING) {
192
+ n.J = n.X;
193
+ n.X = NOT_PENDING;
194
+ }
195
+ const i = n.ee;
196
+ n.ee = NOT_PENDING;
197
+ if (i !== NOT_PENDING && n.J !== i) insertSubs(n, true);
198
+ n.K = null;
199
+ }
200
+ e.length = 0;
201
+ }
202
+ function cleanupCompletedLanes(e) {
203
+ for (const t of activeLanes) {
204
+ const n = e ? t.K === e : !t.K;
205
+ if (!n) continue;
206
+ if (!t.U) {
207
+ if (t.G[0].length) runQueue(t.G[0], EFFECT_RENDER);
208
+ if (t.G[1].length) runQueue(t.G[1], EFFECT_USER);
209
+ }
210
+ if (t.te.q === t) t.te.q = undefined;
211
+ t.k.clear();
212
+ t.G[0].length = 0;
213
+ t.G[1].length = 0;
214
+ activeLanes.delete(t);
215
+ signalLanes.delete(t.te);
216
+ }
217
+ }
158
218
  function schedule() {
159
219
  if (scheduled) return;
160
220
  scheduled = true;
161
- if (!globalQueue.H && true) queueMicrotask(flush);
221
+ if (!globalQueue.ne && true) queueMicrotask(flush);
162
222
  }
163
223
  class Queue {
164
224
  i = null;
165
- G = [[], []];
166
- M = [];
225
+ ie = [[], []];
226
+ re = [];
167
227
  created = clock;
168
228
  addChild(e) {
169
- this.M.push(e);
229
+ this.re.push(e);
170
230
  e.i = this;
171
231
  }
172
232
  removeChild(e) {
173
- const t = this.M.indexOf(e);
233
+ const t = this.re.indexOf(e);
174
234
  if (t >= 0) {
175
- this.M.splice(t, 1);
235
+ this.re.splice(t, 1);
176
236
  e.i = null;
177
237
  }
178
238
  }
@@ -181,110 +241,126 @@ class Queue {
181
241
  return false;
182
242
  }
183
243
  run(e) {
184
- if (this.G[e - 1].length) {
185
- const t = this.G[e - 1];
186
- this.G[e - 1] = [];
244
+ if (this.ie[e - 1].length) {
245
+ const t = this.ie[e - 1];
246
+ this.ie[e - 1] = [];
187
247
  runQueue(t, e);
188
248
  }
189
- for (let t = 0; t < this.M.length; t++) this.M[t].run?.(e);
249
+ for (let t = 0; t < this.re.length; t++) this.re[t].run?.(e);
190
250
  }
191
251
  enqueue(e, t) {
192
252
  if (e) {
193
253
  if (currentOptimisticLane) {
194
254
  const n = findLane(currentOptimisticLane);
195
- n.W[e - 1].push(t);
255
+ n.G[e - 1].push(t);
196
256
  } else {
197
- this.G[e - 1].push(t);
257
+ this.ie[e - 1].push(t);
198
258
  }
199
259
  }
200
260
  schedule();
201
261
  }
202
262
  stashQueues(e) {
203
- e.G[0].push(...this.G[0]);
204
- e.G[1].push(...this.G[1]);
205
- this.G = [[], []];
206
- for (let t = 0; t < this.M.length; t++) {
207
- let n = this.M[t];
208
- let i = e.M[t];
263
+ e.ie[0].push(...this.ie[0]);
264
+ e.ie[1].push(...this.ie[1]);
265
+ this.ie = [[], []];
266
+ for (let t = 0; t < this.re.length; t++) {
267
+ let n = this.re[t];
268
+ let i = e.re[t];
209
269
  if (!i) {
210
270
  i = {
211
- G: [[], []],
212
- M: []
271
+ ie: [[], []],
272
+ re: []
213
273
  };
214
- e.M[t] = i;
274
+ e.re[t] = i;
215
275
  }
216
276
  n.stashQueues(i);
217
277
  }
218
278
  }
219
279
  restoreQueues(e) {
220
- this.G[0].push(...e.G[0]);
221
- this.G[1].push(...e.G[1]);
222
- for (let t = 0; t < e.M.length; t++) {
223
- const n = e.M[t];
224
- let i = this.M[t];
280
+ this.ie[0].push(...e.ie[0]);
281
+ this.ie[1].push(...e.ie[1]);
282
+ for (let t = 0; t < e.re.length; t++) {
283
+ const n = e.re[t];
284
+ let i = this.re[t];
225
285
  if (i) i.restoreQueues(n);
226
286
  }
227
287
  }
228
288
  }
229
289
  class GlobalQueue extends Queue {
230
- H = false;
231
- F = [];
232
- $ = [];
233
- j = new Set();
234
- static K;
235
- static Y;
236
- static Z = null;
290
+ ne = false;
291
+ se = [];
292
+ Y = [];
293
+ Z = new Set();
294
+ static oe;
295
+ static ue;
296
+ static ce = null;
237
297
  flush() {
238
- if (this.H) return;
239
- this.H = true;
298
+ if (this.ne) return;
299
+ this.ne = true;
240
300
  try {
241
- runHeap(dirtyQueue, GlobalQueue.K);
301
+ runHeap(dirtyQueue, GlobalQueue.oe);
242
302
  if (activeTransition) {
243
303
  const e = transitionComplete(activeTransition);
244
304
  if (!e) {
245
- let e = activeTransition;
246
- runHeap(zombieQueue, GlobalQueue.K);
247
- this.F = [];
248
- this.$ = [];
249
- this.j = new Set();
305
+ const e = activeTransition;
306
+ runHeap(zombieQueue, GlobalQueue.oe);
307
+ this.se = [];
308
+ this.Y = [];
309
+ this.Z = new Set();
250
310
  runLaneEffects(EFFECT_RENDER);
251
311
  runLaneEffects(EFFECT_USER);
252
- this.stashQueues(activeTransition.B);
312
+ this.stashQueues(e.ae);
253
313
  clock++;
254
- scheduled = dirtyQueue.R >= dirtyQueue.N;
255
- reassignPendingTransition(activeTransition.F);
314
+ scheduled = dirtyQueue.R >= dirtyQueue.P;
315
+ reassignPendingTransition(e.se);
256
316
  activeTransition = null;
257
- finalizePureQueue(null, true);
317
+ if (!e.j.length && e.Y.length) {
318
+ stashedOptimisticReads = new Set();
319
+ for (let t = 0; t < e.Y.length; t++) {
320
+ const n = e.Y[t];
321
+ if (n.L || n.fe) continue;
322
+ stashedOptimisticReads.add(n);
323
+ queueStashedOptimisticEffects(n);
324
+ }
325
+ }
326
+ try {
327
+ finalizePureQueue(null, true);
328
+ } finally {
329
+ stashedOptimisticReads = null;
330
+ }
258
331
  return;
259
332
  }
260
- this.F !== activeTransition.F && this.F.push(...activeTransition.F);
261
- this.restoreQueues(activeTransition.B);
333
+ this.se !== activeTransition.se && this.se.push(...activeTransition.se);
334
+ this.restoreQueues(activeTransition.ae);
262
335
  transitions.delete(activeTransition);
263
336
  const t = activeTransition;
264
337
  activeTransition = null;
265
- reassignPendingTransition(this.F);
338
+ reassignPendingTransition(this.se);
266
339
  finalizePureQueue(t);
267
340
  } else {
268
- if (transitions.size) runHeap(zombieQueue, GlobalQueue.K);
341
+ if (transitions.size) runHeap(zombieQueue, GlobalQueue.oe);
269
342
  finalizePureQueue();
270
343
  }
271
344
  clock++;
272
- scheduled = dirtyQueue.R >= dirtyQueue.N;
345
+ scheduled = dirtyQueue.R >= dirtyQueue.P;
273
346
  runLaneEffects(EFFECT_RENDER);
274
347
  this.run(EFFECT_RENDER);
275
348
  runLaneEffects(EFFECT_USER);
276
349
  this.run(EFFECT_USER);
277
350
  } finally {
278
- this.H = false;
351
+ this.ne = false;
279
352
  }
280
353
  }
281
354
  notify(e, t, n, i) {
282
355
  if (t & STATUS_PENDING) {
283
356
  if (n & STATUS_PENDING) {
284
- const t = i !== undefined ? i : e.X;
285
- if (activeTransition && t && !activeTransition.q.includes(t.source)) {
286
- activeTransition.q.push(t.source);
287
- schedule();
357
+ const t = i !== undefined ? i : e.le;
358
+ if (activeTransition && t) {
359
+ const e = t.source;
360
+ if (!activeTransition.B.includes(e)) {
361
+ activeTransition.B.push(e);
362
+ schedule();
363
+ }
288
364
  }
289
365
  }
290
366
  return true;
@@ -294,61 +370,59 @@ class GlobalQueue extends Queue {
294
370
  initTransition(e) {
295
371
  if (e) e = currentTransition(e);
296
372
  if (e && e === activeTransition) return;
297
- if (!e && activeTransition && activeTransition.J === clock) return;
373
+ if (!e && activeTransition && activeTransition.Ee === clock) return;
298
374
  if (!activeTransition) {
299
375
  activeTransition = e ?? {
300
- J: clock,
301
- F: [],
302
- q: [],
303
- $: [],
304
- j: new Set(),
305
- ee: [],
306
- B: {
307
- G: [[], []],
308
- M: []
376
+ Ee: clock,
377
+ se: [],
378
+ B: [],
379
+ Y: [],
380
+ Z: new Set(),
381
+ j: [],
382
+ ae: {
383
+ ie: [[], []],
384
+ re: []
309
385
  },
310
- te: false
386
+ $: false
311
387
  };
312
388
  } else if (e) {
313
389
  const t = activeTransition;
314
- t.te = e;
315
- e.ee.push(...t.ee);
316
- for (const n of activeLanes) {
317
- if (n.ne === t) n.ne = e;
318
- }
319
- e.$.push(...t.$);
320
- for (const n of t.j) {
321
- e.j.add(n);
322
- }
390
+ mergeTransitionState(e, t);
323
391
  transitions.delete(t);
324
392
  activeTransition = e;
325
393
  }
326
394
  transitions.add(activeTransition);
327
- activeTransition.J = clock;
328
- for (let e = 0; e < this.F.length; e++) {
329
- const t = this.F[e];
330
- t.ne = activeTransition;
331
- activeTransition.F.push(t);
395
+ activeTransition.Ee = clock;
396
+ if (this.se !== activeTransition.se) {
397
+ for (let e = 0; e < this.se.length; e++) {
398
+ const t = this.se[e];
399
+ t.K = activeTransition;
400
+ activeTransition.se.push(t);
401
+ }
402
+ this.se = activeTransition.se;
332
403
  }
333
- this.F = activeTransition.F;
334
- for (let e = 0; e < this.$.length; e++) {
335
- const t = this.$[e];
336
- t.ne = activeTransition;
337
- activeTransition.$.push(t);
404
+ if (this.Y !== activeTransition.Y) {
405
+ for (let e = 0; e < this.Y.length; e++) {
406
+ const t = this.Y[e];
407
+ t.K = activeTransition;
408
+ activeTransition.Y.push(t);
409
+ }
410
+ this.Y = activeTransition.Y;
338
411
  }
339
- this.$ = activeTransition.$;
340
412
  for (const e of activeLanes) {
341
- if (!e.ne) e.ne = activeTransition;
413
+ if (!e.K) e.K = activeTransition;
414
+ }
415
+ if (this.Z !== activeTransition.Z) {
416
+ for (const e of this.Z) activeTransition.Z.add(e);
417
+ this.Z = activeTransition.Z;
342
418
  }
343
- for (const e of this.j) activeTransition.j.add(e);
344
- this.j = activeTransition.j;
345
419
  }
346
420
  }
347
421
  function insertSubs(e, t = false) {
348
- const n = e.ie || currentOptimisticLane;
349
- const i = e.re !== undefined;
422
+ const n = e.q || currentOptimisticLane;
423
+ const i = e.Te !== undefined;
350
424
  for (let r = e.I; r !== null; r = r.p) {
351
- if (i && r.h.se) {
425
+ if (i && r.h.de) {
352
426
  r.h.O |= REACTIVE_SNAPSHOT_STALE;
353
427
  continue;
354
428
  }
@@ -357,82 +431,64 @@ function insertSubs(e, t = false) {
357
431
  assignOrMergeLane(r.h, n);
358
432
  } else if (t) {
359
433
  r.h.O |= REACTIVE_OPTIMISTIC_DIRTY;
360
- r.h.ie = undefined;
434
+ r.h.q = undefined;
361
435
  }
362
436
  const e = r.h;
363
- if (e.oe === EFFECT_TRACKED) {
364
- if (!e.ue) {
365
- e.ue = true;
366
- e.ce.enqueue(EFFECT_USER, e.le);
437
+ if (e.W === EFFECT_TRACKED) {
438
+ if (!e.H) {
439
+ e.H = true;
440
+ e.F.enqueue(EFFECT_USER, e.M);
367
441
  }
368
442
  continue;
369
443
  }
370
444
  const s = r.h.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
371
- if (s.N > r.h.o) s.N = r.h.o;
445
+ if (s.P > r.h.o) s.P = r.h.o;
372
446
  insertIntoHeap(r.h, s);
373
447
  }
374
448
  }
449
+ function commitPendingNodes() {
450
+ const e = globalQueue.se;
451
+ for (let t = 0; t < e.length; t++) {
452
+ const n = e[t];
453
+ if (n.X !== NOT_PENDING) {
454
+ n.J = n.X;
455
+ n.X = NOT_PENDING;
456
+ if (n.W && n.W !== EFFECT_TRACKED) n.H = true;
457
+ }
458
+ if (!(n.Se & STATUS_PENDING)) n.Se &= ~STATUS_UNINITIALIZED;
459
+ if (n.L) GlobalQueue.ue(n, false, true);
460
+ }
461
+ e.length = 0;
462
+ }
375
463
  function finalizePureQueue(e = null, t = false) {
376
- let n = !t;
464
+ const n = !t;
465
+ if (n) commitPendingNodes();
377
466
  if (!t) checkBoundaryChildren(globalQueue);
378
- if (dirtyQueue.R >= dirtyQueue.N) runHeap(dirtyQueue, GlobalQueue.K);
467
+ if (dirtyQueue.R >= dirtyQueue.P) runHeap(dirtyQueue, GlobalQueue.oe);
379
468
  if (n) {
380
- const t = globalQueue.F;
381
- for (let e = 0; e < t.length; e++) {
382
- const n = t[e];
383
- if (n.ae !== NOT_PENDING) {
384
- n.fe = n.ae;
385
- n.ae = NOT_PENDING;
386
- if (n.oe && n.oe !== EFFECT_TRACKED) n.ue = true;
387
- }
388
- if (!(n.Ee & STATUS_PENDING)) n.Ee &= ~STATUS_UNINITIALIZED;
389
- if (n.L) GlobalQueue.Y(n, false, true);
390
- }
391
- t.length = 0;
392
- const n = e ? e.$ : globalQueue.$;
393
- for (let e = 0; e < n.length; e++) {
394
- const t = n[e];
395
- const i = t.ae;
396
- t.ie = undefined;
397
- if (i !== NOT_PENDING && t.fe !== i) {
398
- t.fe = i;
399
- insertSubs(t, true);
400
- }
401
- t.ae = NOT_PENDING;
402
- t.ne = null;
403
- }
404
- n.length = 0;
405
- e ? e.j : globalQueue.j;
406
- for (const t of activeLanes) {
407
- const n = e ? t.ne === e : !t.ne;
408
- if (!n) continue;
409
- if (!t.k) {
410
- if (t.W[0].length) runQueue(t.W[0], EFFECT_RENDER);
411
- if (t.W[1].length) runQueue(t.W[1], EFFECT_USER);
412
- }
413
- if (t.Te.ie === t) t.Te.ie = undefined;
414
- t.U.clear();
415
- t.W[0].length = 0;
416
- t.W[1].length = 0;
417
- activeLanes.delete(t);
418
- signalLanes.delete(t.Te);
419
- }
469
+ commitPendingNodes();
470
+ resolveOptimisticNodes(e ? e.Y : globalQueue.Y);
471
+ e ? e.Z : globalQueue.Z;
472
+ cleanupCompletedLanes(e);
420
473
  }
421
474
  }
422
475
  function checkBoundaryChildren(e) {
423
- for (const t of e.M) {
476
+ for (const t of e.re) {
424
477
  t.checkSources?.();
425
478
  checkBoundaryChildren(t);
426
479
  }
427
480
  }
428
481
  function reassignPendingTransition(e) {
429
482
  for (let t = 0; t < e.length; t++) {
430
- e[t].ne = activeTransition;
483
+ e[t].K = activeTransition;
431
484
  }
432
485
  }
433
486
  const globalQueue = new GlobalQueue();
434
487
  function flush() {
435
- while (scheduled) {
488
+ if (globalQueue.ne) {
489
+ return;
490
+ }
491
+ while (scheduled || activeTransition) {
436
492
  globalQueue.flush();
437
493
  }
438
494
  }
@@ -440,21 +496,30 @@ function runQueue(e, t) {
440
496
  for (let n = 0; n < e.length; n++) e[n](t);
441
497
  }
442
498
  function transitionComplete(e) {
443
- if (e.te) return true;
444
- if (e.ee.length) return false;
499
+ if (e.$) return true;
500
+ if (e.j.length) return false;
445
501
  let t = true;
446
- for (let n = 0; n < e.q.length; n++) {
447
- const i = e.q[n];
448
- if (i.Ee & STATUS_PENDING && i.X?.source === i) {
502
+ for (let n = 0; n < e.B.length; n++) {
503
+ const i = e.B[n];
504
+ if (i.Se & STATUS_PENDING && i.le?.source === i) {
449
505
  t = false;
450
506
  break;
451
507
  }
452
508
  }
453
- t && (e.te = true);
509
+ if (t) {
510
+ for (let n = 0; n < e.Y.length; n++) {
511
+ const i = e.Y[n];
512
+ if (hasActiveOverride(i) && "Se" in i && i.Se & STATUS_PENDING && i.le instanceof NotReadyError && i.le.source !== i) {
513
+ t = false;
514
+ break;
515
+ }
516
+ }
517
+ }
518
+ t && (e.$ = true);
454
519
  return t;
455
520
  }
456
521
  function currentTransition(e) {
457
- while (e.te && typeof e.te === "object") e = e.te;
522
+ while (e.$ && typeof e.$ === "object") e = e.$;
458
523
  return e;
459
524
  }
460
525
  function runInTransition(e, t) {
@@ -473,111 +538,203 @@ function getOrCreateLane(e) {
473
538
  if (t) {
474
539
  return findLane(t);
475
540
  }
476
- const n = e.de;
477
- const i = n?.ie ? findLane(n.ie) : null;
541
+ const n = e.Re;
542
+ const i = n?.q ? findLane(n.q) : null;
478
543
  t = {
479
- Te: e,
480
- U: new Set(),
481
- W: [[], []],
482
- k: null,
483
- ne: activeTransition,
484
- Se: i
544
+ te: e,
545
+ k: new Set(),
546
+ G: [[], []],
547
+ U: null,
548
+ K: activeTransition,
549
+ Oe: i
485
550
  };
486
551
  signalLanes.set(e, t);
487
552
  activeLanes.add(t);
488
- e.Re = e.Oe || 0;
553
+ e._e = false;
489
554
  return t;
490
555
  }
491
556
  function findLane(e) {
492
- while (e.k) e = e.k;
557
+ while (e.U) e = e.U;
493
558
  return e;
494
559
  }
495
560
  function mergeLanes(e, t) {
496
561
  e = findLane(e);
497
562
  t = findLane(t);
498
563
  if (e === t) return e;
499
- t.k = e;
500
- for (const n of t.U) e.U.add(n);
501
- e.W[0].push(...t.W[0]);
502
- e.W[1].push(...t.W[1]);
564
+ t.U = e;
565
+ for (const n of t.k) e.k.add(n);
566
+ e.G[0].push(...t.G[0]);
567
+ e.G[1].push(...t.G[1]);
503
568
  return e;
504
569
  }
505
570
  function resolveLane(e) {
506
- const t = e.ie;
571
+ const t = e.q;
507
572
  if (!t) return undefined;
508
573
  const n = findLane(t);
509
574
  if (activeLanes.has(n)) return n;
510
- e.ie = undefined;
575
+ e.q = undefined;
511
576
  return undefined;
512
577
  }
578
+ function resolveTransition(e) {
579
+ return resolveLane(e)?.K ?? e.K;
580
+ }
513
581
  function hasActiveOverride(e) {
514
- return !!(e._e && e.ae !== NOT_PENDING);
582
+ return !!(e.ee !== undefined && e.ee !== NOT_PENDING);
515
583
  }
516
584
  function assignOrMergeLane(e, t) {
517
585
  const n = findLane(t);
518
- const i = e.ie;
586
+ const i = e.q;
519
587
  if (i) {
520
- if (i.k) {
521
- e.ie = t;
588
+ if (i.U) {
589
+ e.q = t;
522
590
  return;
523
591
  }
524
592
  const r = findLane(i);
525
593
  if (activeLanes.has(r)) {
526
594
  if (r !== n && !hasActiveOverride(e)) {
527
- if (n.Se && findLane(n.Se) === r) {
528
- e.ie = t;
529
- } else if (r.Se && findLane(r.Se) === n) ;else mergeLanes(n, r);
595
+ if (n.Oe && findLane(n.Oe) === r) {
596
+ e.q = t;
597
+ } else if (r.Oe && findLane(r.Oe) === n) ;else mergeLanes(n, r);
530
598
  }
531
599
  return;
532
600
  }
533
601
  }
534
- e.ie = t;
602
+ e.q = t;
603
+ }
604
+ function addPendingSource(e, t) {
605
+ if (e.Ie === t || e.pe?.has(t)) return false;
606
+ if (!e.Ie) {
607
+ e.Ie = t;
608
+ return true;
609
+ }
610
+ if (!e.pe) {
611
+ e.pe = new Set([e.Ie, t]);
612
+ } else {
613
+ e.pe.add(t);
614
+ }
615
+ e.Ie = undefined;
616
+ return true;
617
+ }
618
+ function removePendingSource(e, t) {
619
+ if (e.Ie) {
620
+ if (e.Ie !== t) return false;
621
+ e.Ie = undefined;
622
+ return true;
623
+ }
624
+ if (!e.pe?.delete(t)) return false;
625
+ if (e.pe.size === 1) {
626
+ e.Ie = e.pe.values().next().value;
627
+ e.pe = undefined;
628
+ } else if (e.pe.size === 0) {
629
+ e.pe = undefined;
630
+ }
631
+ return true;
632
+ }
633
+ function clearPendingSources(e) {
634
+ e.Ie = undefined;
635
+ e.pe?.clear();
636
+ e.pe = undefined;
637
+ }
638
+ function setPendingError(e, t, n) {
639
+ if (!t) {
640
+ e.le = null;
641
+ return;
642
+ }
643
+ if (n instanceof NotReadyError && n.source === t) {
644
+ e.le = n;
645
+ return;
646
+ }
647
+ const i = e.le;
648
+ if (!(i instanceof NotReadyError) || i.source !== t) {
649
+ e.le = new NotReadyError(t);
650
+ }
651
+ }
652
+ function forEachDependent(e, t) {
653
+ for (let n = e.I; n !== null; n = n.p) t(n.h);
654
+ for (let n = e.A; n !== null; n = n.N) {
655
+ for (let e = n.I; e !== null; e = e.p) t(e.h);
656
+ }
657
+ }
658
+ function settlePendingSource(e) {
659
+ let t = false;
660
+ const n = new Set();
661
+ const settle = i => {
662
+ if (n.has(i) || !removePendingSource(i, e)) return;
663
+ n.add(i);
664
+ i.Ee = clock;
665
+ const r = i.Ie ?? i.pe?.values().next().value;
666
+ if (r) {
667
+ setPendingError(i, r);
668
+ updatePendingSignal(i);
669
+ } else {
670
+ i.Se &= ~STATUS_PENDING;
671
+ setPendingError(i);
672
+ updatePendingSignal(i);
673
+ if (i.he) {
674
+ if (i.W === EFFECT_TRACKED) {
675
+ const e = i;
676
+ if (!e.H) {
677
+ e.H = true;
678
+ e.F.enqueue(EFFECT_USER, e.M);
679
+ }
680
+ } else {
681
+ const e = i.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
682
+ if (e.P > i.o) e.P = i.o;
683
+ insertIntoHeap(i, e);
684
+ }
685
+ t = true;
686
+ }
687
+ i.he = false;
688
+ }
689
+ forEachDependent(i, settle);
690
+ };
691
+ forEachDependent(e, settle);
692
+ if (t) schedule();
535
693
  }
536
694
  function handleAsync(e, t, n) {
537
695
  const i = typeof t === "object" && t !== null;
538
696
  const r = i && untrack(() => t[Symbol.asyncIterator]);
539
697
  const s = !r && i && untrack(() => typeof t.then === "function");
540
698
  if (!s && !r) {
541
- e.Ie = null;
699
+ e.Ae = null;
542
700
  return t;
543
701
  }
544
- e.Ie = t;
702
+ e.Ae = t;
545
703
  let o;
546
704
  const handleError = n => {
547
- if (e.Ie !== t) return;
548
- globalQueue.initTransition(e.ne);
705
+ if (e.Ae !== t) return;
706
+ globalQueue.initTransition(resolveTransition(e));
549
707
  notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
550
- e.J = clock;
708
+ e.Ee = clock;
551
709
  };
552
710
  const asyncWrite = (i, r) => {
553
- if (e.Ie !== t) return;
711
+ if (e.Ae !== t) return;
554
712
  if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
555
- globalQueue.initTransition(e.ne);
713
+ globalQueue.initTransition(resolveTransition(e));
556
714
  clearStatus(e);
557
715
  const s = resolveLane(e);
558
- if (s) s.U.delete(e);
559
- if (e._e) {
560
- const t = e.ae !== NOT_PENDING;
561
- if (e.L) e.ae = i;
562
- if (!t) {
563
- e.fe = i;
716
+ if (s) s.k.delete(e);
717
+ if (e.ee !== undefined) {
718
+ if (e.ee !== undefined && e.ee !== NOT_PENDING) e.X = i;else {
719
+ e.J = i;
564
720
  insertSubs(e);
565
721
  }
566
- e.J = clock;
722
+ e.Ee = clock;
567
723
  } else if (s) {
568
- const t = e.fe;
569
- const n = e.pe;
724
+ const t = e.J;
725
+ const n = e.Ne;
570
726
  if (!n || !n(i, t)) {
571
- e.fe = i;
572
- e.J = clock;
573
- if (e.he) {
574
- setSignal(e.he, i);
727
+ e.J = i;
728
+ e.Ee = clock;
729
+ if (e.Pe) {
730
+ setSignal(e.Pe, i);
575
731
  }
576
732
  insertSubs(e, true);
577
733
  }
578
734
  } else {
579
735
  setSignal(e, () => i);
580
736
  }
737
+ settlePendingSource(e);
581
738
  schedule();
582
739
  flush();
583
740
  r?.();
@@ -595,7 +752,7 @@ function handleAsync(e, t, n) {
595
752
  });
596
753
  i = false;
597
754
  if (!n) {
598
- globalQueue.initTransition(e.ne);
755
+ globalQueue.initTransition(resolveTransition(e));
599
756
  throw new NotReadyError(context);
600
757
  }
601
758
  }
@@ -627,75 +784,126 @@ function handleAsync(e, t, n) {
627
784
  };
628
785
  const r = iterate();
629
786
  if (!i && !r) {
630
- globalQueue.initTransition(e.ne);
787
+ globalQueue.initTransition(resolveTransition(e));
631
788
  throw new NotReadyError(context);
632
789
  }
633
790
  }
634
791
  return o;
635
792
  }
636
- function clearStatus(e) {
637
- e.Ee = e.Ee & STATUS_UNINITIALIZED;
638
- e.X = null;
793
+ function clearStatus(e, t = false) {
794
+ clearPendingSources(e);
795
+ e.he = false;
796
+ e.Se = t ? 0 : e.Se & STATUS_UNINITIALIZED;
797
+ setPendingError(e);
639
798
  updatePendingSignal(e);
640
- e.Ae?.();
799
+ e.ge?.();
641
800
  }
642
801
  function notifyStatus(e, t, n, i, r) {
643
802
  if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError)) n = new StatusError(e, n);
644
- const s = n instanceof NotReadyError && n.source === e;
645
- const o = t === STATUS_PENDING && e._e && !s;
646
- const u = o && hasActiveOverride(e);
803
+ const s = t === STATUS_PENDING && n instanceof NotReadyError ? n.source : undefined;
804
+ const o = s === e;
805
+ const u = t === STATUS_PENDING && e.ee !== undefined && !o;
806
+ const c = u && hasActiveOverride(e);
647
807
  if (!i) {
648
- e.Ee = t | (t !== STATUS_ERROR ? e.Ee & STATUS_UNINITIALIZED : 0);
649
- e.X = n;
808
+ if (t === STATUS_PENDING && s) {
809
+ addPendingSource(e, s);
810
+ e.Se = STATUS_PENDING | e.Se & STATUS_UNINITIALIZED;
811
+ setPendingError(e, s, n);
812
+ } else {
813
+ clearPendingSources(e);
814
+ e.Se = t | (t !== STATUS_ERROR ? e.Se & STATUS_UNINITIALIZED : 0);
815
+ e.le = n;
816
+ }
650
817
  updatePendingSignal(e);
651
818
  }
652
819
  if (r && !i) {
653
820
  assignOrMergeLane(e, r);
654
821
  }
655
- if (u && activeTransition && n instanceof NotReadyError) {
656
- const e = n.source;
657
- if (!activeTransition.q.includes(e)) {
658
- activeTransition.q.push(e);
822
+ const a = i || c;
823
+ const f = i || u ? undefined : r;
824
+ if (e.ge) {
825
+ if (i && t === STATUS_PENDING) {
826
+ return;
659
827
  }
660
- }
661
- const c = i || u;
662
- const l = i || o ? undefined : r;
663
- if (e.Ae) {
664
- if (c) {
665
- e.Ae(t, n);
828
+ if (a) {
829
+ e.ge(t, n);
666
830
  } else {
667
- e.Ae();
831
+ e.ge();
668
832
  }
669
833
  return;
670
834
  }
671
- for (let i = e.I; i !== null; i = i.p) {
672
- i.h.J = clock;
673
- if (i.h.X !== n) {
674
- !i.h.ne && globalQueue.F.push(i.h);
675
- notifyStatus(i.h, t, n, c, l);
835
+ forEachDependent(e, e => {
836
+ e.Ee = clock;
837
+ if (t === STATUS_PENDING && s && e.Ie !== s && !e.pe?.has(s) || t !== STATUS_PENDING && (e.le !== n || e.Ie || e.pe)) {
838
+ if (!a && !e.K) globalQueue.se.push(e);
839
+ notifyStatus(e, t, n, a, f);
840
+ }
841
+ });
842
+ }
843
+ let externalSourceConfig = null;
844
+ function markDisposal(e) {
845
+ let t = e.Ce;
846
+ while (t) {
847
+ t.O |= REACTIVE_ZOMBIE;
848
+ if (t.O & REACTIVE_IN_HEAP) {
849
+ deleteFromHeap(t, dirtyQueue);
850
+ insertIntoHeap(t, zombieQueue);
676
851
  }
852
+ markDisposal(t);
853
+ t = t.De;
677
854
  }
678
- for (let i = e.A; i !== null; i = i.P) {
679
- for (let e = i.I; e !== null; e = e.p) {
680
- e.h.J = clock;
681
- if (e.h.X !== n) {
682
- !e.h.ne && globalQueue.F.push(e.h);
683
- notifyStatus(e.h, t, n, c, l);
684
- }
855
+ }
856
+ function disposeChildren(e, t = false, n) {
857
+ if (e.O & REACTIVE_DISPOSED) return;
858
+ if (t) e.O = REACTIVE_DISPOSED;
859
+ let i = n ? e.me : e.Ce;
860
+ while (i) {
861
+ const e = i.De;
862
+ if (i.C) {
863
+ const e = i;
864
+ deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
865
+ let t = e.C;
866
+ do {
867
+ t = unlinkSubs(t);
868
+ } while (t !== null);
869
+ e.C = null;
870
+ e.ye = null;
871
+ }
872
+ disposeChildren(i, true);
873
+ i = e;
874
+ }
875
+ if (n) {
876
+ e.me = null;
877
+ } else {
878
+ e.Ce = null;
879
+ e.ve = 0;
880
+ }
881
+ runDisposal(e, n);
882
+ }
883
+ function runDisposal(e, t) {
884
+ let n = t ? e.we : e.be;
885
+ if (!n) return;
886
+ if (Array.isArray(n)) {
887
+ for (let e = 0; e < n.length; e++) {
888
+ const t = n[e];
889
+ t.call(t);
685
890
  }
891
+ } else {
892
+ n.call(n);
686
893
  }
894
+ t ? e.we = null : e.be = null;
687
895
  }
688
896
  function unlinkSubs(e) {
689
- const t = e.V;
897
+ const t = e.m;
690
898
  const n = e.D;
691
899
  const i = e.p;
692
- const r = e.Pe;
693
- if (i !== null) i.Pe = r;else t.Ne = r;
900
+ const r = e.Ue;
901
+ if (i !== null) i.Ue = r;else t.ke = r;
694
902
  if (r !== null) r.p = i;else {
695
903
  t.I = i;
696
904
  if (i === null) {
697
- t.ge?.();
698
- t.L && !t.Ce && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
905
+ t.Ge?.();
906
+ t.L && !t.xe && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
699
907
  }
700
908
  }
701
909
  return n;
@@ -711,23 +919,23 @@ function unobserved(e) {
711
919
  }
712
920
  function link(e, t) {
713
921
  const n = t.ye;
714
- if (n !== null && n.V === e) return;
922
+ if (n !== null && n.m === e) return;
715
923
  let i = null;
716
924
  const r = t.O & REACTIVE_RECOMPUTING_DEPS;
717
925
  if (r) {
718
926
  i = n !== null ? n.D : t.C;
719
- if (i !== null && i.V === e) {
927
+ if (i !== null && i.m === e) {
720
928
  t.ye = i;
721
929
  return;
722
930
  }
723
931
  }
724
- const s = e.Ne;
932
+ const s = e.ke;
725
933
  if (s !== null && s.h === t && (!r || isValidLink(s, t))) return;
726
- const o = t.ye = e.Ne = {
727
- V: e,
934
+ const o = t.ye = e.ke = {
935
+ m: e,
728
936
  h: t,
729
937
  D: i,
730
- Pe: s,
938
+ Ue: s,
731
939
  p: null
732
940
  };
733
941
  if (n !== null) n.D = o;else t.C = o;
@@ -745,91 +953,38 @@ function isValidLink(e, t) {
745
953
  }
746
954
  return false;
747
955
  }
748
- function markDisposal(e) {
749
- let t = e.De;
750
- while (t) {
751
- t.O |= REACTIVE_ZOMBIE;
752
- if (t.O & REACTIVE_IN_HEAP) {
753
- deleteFromHeap(t, dirtyQueue);
754
- insertIntoHeap(t, zombieQueue);
755
- }
756
- markDisposal(t);
757
- t = t.ve;
758
- }
759
- }
760
- function disposeChildren(e, t = false, n) {
761
- if (e.O & REACTIVE_DISPOSED) return;
762
- if (t) e.O = REACTIVE_DISPOSED;
763
- let i = n ? e.be : e.De;
764
- while (i) {
765
- const e = i.ve;
766
- if (i.C) {
767
- const e = i;
768
- deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
769
- let t = e.C;
770
- do {
771
- t = unlinkSubs(t);
772
- } while (t !== null);
773
- e.C = null;
774
- e.ye = null;
775
- }
776
- disposeChildren(i, true);
777
- i = e;
778
- }
779
- if (n) {
780
- e.be = null;
781
- } else {
782
- e.De = null;
783
- e.ve = null;
784
- e.we = 0;
785
- }
786
- runDisposal(e, n);
787
- }
788
- function runDisposal(e, t) {
789
- let n = t ? e.Ve : e.me;
790
- if (!n) return;
791
- if (Array.isArray(n)) {
792
- for (let e = 0; e < n.length; e++) {
793
- const t = n[e];
794
- t.call(t);
795
- }
796
- } else {
797
- n.call(n);
798
- }
799
- t ? e.Ve = null : e.me = null;
800
- }
801
- GlobalQueue.K = recompute;
802
- GlobalQueue.Y = disposeChildren;
956
+ GlobalQueue.oe = recompute;
957
+ GlobalQueue.ue = disposeChildren;
803
958
  let tracking = false;
804
959
  let stale = false;
805
960
  let context = null;
806
961
  let currentOptimisticLane = null;
807
962
  function recompute(e, t = false) {
808
- const n = e.oe;
963
+ const n = e.W;
809
964
  if (!t) {
810
- if (e.ne && (!n || activeTransition) && activeTransition !== e.ne) globalQueue.initTransition(e.ne);
965
+ if (e.K && (!n || activeTransition) && activeTransition !== e.K) globalQueue.initTransition(e.K);
811
966
  deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
812
- if (e.ne || n === EFFECT_TRACKED) disposeChildren(e);else {
967
+ if (e.K || n === EFFECT_TRACKED) disposeChildren(e);else {
813
968
  markDisposal(e);
814
- e.Ve = e.me;
815
- e.be = e.De;
816
- e.me = null;
817
- e.De = null;
818
- e.we = 0;
969
+ e.we = e.be;
970
+ e.me = e.Ce;
971
+ e.be = null;
972
+ e.Ce = null;
973
+ e.ve = 0;
819
974
  }
820
975
  }
821
976
  const i = !!(e.O & REACTIVE_OPTIMISTIC_DIRTY);
822
- const r = hasActiveOverride(e);
823
- const s = !!(e.Ee & STATUS_PENDING);
977
+ const r = e.ee !== undefined && e.ee !== NOT_PENDING;
978
+ const s = !!(e.Se & STATUS_PENDING);
824
979
  const o = context;
825
980
  context = e;
826
981
  e.ye = null;
827
982
  e.O = REACTIVE_RECOMPUTING_DEPS;
828
- e.J = clock;
829
- let u = e.ae === NOT_PENDING ? e.fe : e.ae;
983
+ e.Ee = clock;
984
+ let u = e.X === NOT_PENDING ? e.J : e.X;
830
985
  let c = e.o;
831
- let l = tracking;
832
- let a = currentOptimisticLane;
986
+ let a = tracking;
987
+ let f = currentOptimisticLane;
833
988
  tracking = true;
834
989
  if (i) {
835
990
  const t = resolveLane(e);
@@ -837,66 +992,67 @@ function recompute(e, t = false) {
837
992
  }
838
993
  try {
839
994
  u = handleAsync(e, e.L(u));
840
- clearStatus(e);
841
- const t = resolveLane(e);
842
- if (t) {
843
- t.U.delete(e);
844
- updatePendingSignal(t.Te);
995
+ clearStatus(e, t);
996
+ const n = resolveLane(e);
997
+ if (n) {
998
+ n.k.delete(e);
999
+ updatePendingSignal(n.te);
845
1000
  }
846
1001
  } catch (t) {
847
1002
  if (t instanceof NotReadyError && currentOptimisticLane) {
848
1003
  const t = findLane(currentOptimisticLane);
849
- if (t.Te !== e) {
850
- t.U.add(e);
851
- e.ie = t;
852
- updatePendingSignal(t.Te);
1004
+ if (t.te !== e) {
1005
+ t.k.add(e);
1006
+ e.q = t;
1007
+ updatePendingSignal(t.te);
853
1008
  }
854
1009
  }
855
- notifyStatus(e, t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, t, undefined, t instanceof NotReadyError ? e.ie : undefined);
1010
+ if (t instanceof NotReadyError) e.he = true;
1011
+ notifyStatus(e, t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, t, undefined, t instanceof NotReadyError ? e.q : undefined);
856
1012
  } finally {
857
- tracking = l;
1013
+ tracking = a;
858
1014
  e.O = REACTIVE_NONE | (t ? e.O & REACTIVE_SNAPSHOT_STALE : 0);
859
1015
  context = o;
860
1016
  }
861
- if (!e.X) {
1017
+ if (!e.le) {
862
1018
  const o = e.ye;
863
- let l = o !== null ? o.D : e.C;
864
- if (l !== null) {
1019
+ let a = o !== null ? o.D : e.C;
1020
+ if (a !== null) {
865
1021
  do {
866
- l = unlinkSubs(l);
867
- } while (l !== null);
1022
+ a = unlinkSubs(a);
1023
+ } while (a !== null);
868
1024
  if (o !== null) o.D = null;else e.C = null;
869
1025
  }
870
- const a = r ? e.fe : e.ae === NOT_PENDING ? e.fe : e.ae;
871
- const f = !e.pe || !e.pe(a, u);
872
- if (f) {
873
- const o = r ? e.fe : undefined;
874
- if (t || n && activeTransition !== e.ne || i) e.fe = u;else e.ae = u;
875
- if (r && !i && s) {
876
- const t = e.Oe || 0;
877
- const n = e.Re || 0;
878
- if (t <= n) e.fe = u;
879
- }
880
- if (!r || i || e.fe !== o) {
881
- insertSubs(e, i || r);
882
- }
1026
+ const f = r ? e.ee : e.X === NOT_PENDING ? e.J : e.X;
1027
+ const l = !e.Ne || !e.Ne(f, u);
1028
+ if (l) {
1029
+ const o = r ? e.ee : undefined;
1030
+ if (t || n && activeTransition !== e.K || i) {
1031
+ e.J = u;
1032
+ if (r && i) {
1033
+ e.ee = u;
1034
+ e.X = u;
1035
+ }
1036
+ } else e.X = u;
1037
+ if (r && !i && s && !e._e) e.ee = u;
1038
+ if (!r || i || e.ee !== o) insertSubs(e, i || r);
883
1039
  } else if (r) {
884
- e.ae = u;
1040
+ e.X = u;
885
1041
  } else if (e.o != c) {
886
1042
  for (let t = e.I; t !== null; t = t.p) {
887
1043
  insertIntoHeapHeight(t.h, t.h.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
888
1044
  }
889
1045
  }
890
1046
  }
891
- currentOptimisticLane = a;
892
- (!t || e.Ee & STATUS_PENDING) && !e.ne && !(activeTransition && e._e) && globalQueue.F.push(e);
893
- e.ne && n && activeTransition !== e.ne && runInTransition(e.ne, () => recompute(e));
1047
+ currentOptimisticLane = f;
1048
+ (!t || e.Se & STATUS_PENDING) && !e.K && !(activeTransition && r) && globalQueue.se.push(e);
1049
+ e.K && n && activeTransition !== e.K && runInTransition(e.K, () => recompute(e));
894
1050
  }
895
1051
  function updateIfNecessary(e) {
896
1052
  if (e.O & REACTIVE_CHECK) {
897
1053
  for (let t = e.C; t; t = t.D) {
898
- const n = t.V;
899
- const i = n.m || n;
1054
+ const n = t.m;
1055
+ const i = n.V || n;
900
1056
  if (i.L) {
901
1057
  updateIfNecessary(i);
902
1058
  }
@@ -905,7 +1061,7 @@ function updateIfNecessary(e) {
905
1061
  }
906
1062
  }
907
1063
  }
908
- if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || e.X && e.J < clock && !e.Ie) {
1064
+ if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || e.le && e.Ee < clock && !e.Ae) {
909
1065
  recompute(e);
910
1066
  }
911
1067
  e.O = REACTIVE_NONE | e.O & REACTIVE_SNAPSHOT_STALE;
@@ -914,16 +1070,16 @@ function computed(e, t, n) {
914
1070
  const i = n?.transparent;
915
1071
  const r = {
916
1072
  id: n?.id ?? (context?.id ),
917
- Le: i,
918
- pe: n?.equals != null ? n.equals : isEqual,
919
- Ge: !!n?.pureWrite,
920
- ge: n?.unobserved,
921
- me: null,
922
- ce: context?.ce ?? globalQueue,
923
- ke: context?.ke ?? defaultContext,
924
- we: 0,
1073
+ Ve: i,
1074
+ Ne: n?.equals != null ? n.equals : isEqual,
1075
+ fe: !!n?.pureWrite,
1076
+ Ge: n?.unobserved,
1077
+ be: null,
1078
+ F: context?.F ?? globalQueue,
1079
+ Le: context?.Le ?? defaultContext,
1080
+ ve: 0,
925
1081
  L: e,
926
- fe: t,
1082
+ J: t,
927
1083
  o: 0,
928
1084
  A: null,
929
1085
  S: undefined,
@@ -931,28 +1087,28 @@ function computed(e, t, n) {
931
1087
  C: null,
932
1088
  ye: null,
933
1089
  I: null,
934
- Ne: null,
1090
+ ke: null,
935
1091
  i: context,
936
- ve: null,
937
1092
  De: null,
1093
+ Ce: null,
938
1094
  O: n?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
939
- Ee: STATUS_UNINITIALIZED,
940
- J: clock,
941
- ae: NOT_PENDING,
942
- Ve: null,
943
- be: null,
944
- Ie: null,
945
- ne: null
1095
+ Se: STATUS_UNINITIALIZED,
1096
+ Ee: clock,
1097
+ X: NOT_PENDING,
1098
+ we: null,
1099
+ me: null,
1100
+ Ae: null,
1101
+ K: null
946
1102
  };
947
1103
  r.T = r;
948
1104
  const s = context?.t ? context.u : context;
949
1105
  if (context) {
950
- const e = context.De;
1106
+ const e = context.Ce;
951
1107
  if (e === null) {
952
- context.De = r;
1108
+ context.Ce = r;
953
1109
  } else {
954
- r.ve = e;
955
- context.De = r;
1110
+ r.De = e;
1111
+ context.Ce = r;
956
1112
  }
957
1113
  }
958
1114
  if (s) r.o = s.o + 1;
@@ -967,6 +1123,7 @@ function untrack(e, t) {
967
1123
  const n = tracking;
968
1124
  tracking = false;
969
1125
  try {
1126
+ if (externalSourceConfig) ;
970
1127
  return e();
971
1128
  } finally {
972
1129
  tracking = n;
@@ -979,13 +1136,13 @@ function read(e) {
979
1136
  e.O &= ~REACTIVE_LAZY;
980
1137
  recompute(e, true);
981
1138
  }
982
- const n = e.m || e;
1139
+ const n = e.V || e;
983
1140
  if (t && tracking) {
984
1141
  if (e.L && e.O & REACTIVE_DISPOSED) recompute(e);
985
1142
  link(e, t);
986
1143
  if (n.L) {
987
1144
  const i = e.O & REACTIVE_ZOMBIE;
988
- if (n.o >= (i ? zombieQueue.N : dirtyQueue.N)) {
1145
+ if (n.o >= (i ? zombieQueue.P : dirtyQueue.P)) {
989
1146
  markNode(t);
990
1147
  markHeap(i ? zombieQueue : dirtyQueue);
991
1148
  updateIfNecessary(n);
@@ -996,106 +1153,121 @@ function read(e) {
996
1153
  }
997
1154
  }
998
1155
  }
999
- if (n.Ee & STATUS_PENDING) {
1156
+ if (n.Se & STATUS_PENDING) {
1000
1157
  if (t && true) {
1001
1158
  if (currentOptimisticLane) {
1002
- const i = n.ie;
1159
+ const i = n.q;
1003
1160
  const r = findLane(currentOptimisticLane);
1004
1161
  if (i && findLane(i) === r && !hasActiveOverride(n)) {
1005
- if (!tracking) link(e, t);
1006
- throw n.X;
1162
+ if (!tracking && e !== t) link(e, t);
1163
+ throw n.le;
1007
1164
  }
1008
1165
  } else {
1009
- if (!tracking) link(e, t);
1010
- throw n.X;
1166
+ if (!tracking && e !== t) link(e, t);
1167
+ throw n.le;
1011
1168
  }
1012
- } else if (!t && n.Ee & STATUS_UNINITIALIZED) {
1013
- throw n.X;
1169
+ } else if (t && n !== e && n.Se & STATUS_UNINITIALIZED) {
1170
+ if (!tracking && e !== t) link(e, t);
1171
+ throw n.le;
1172
+ } else if (!t && n.Se & STATUS_UNINITIALIZED) {
1173
+ throw n.le;
1014
1174
  }
1015
1175
  }
1016
- if (e.L && e.Ee & STATUS_ERROR) {
1017
- if (e.J < clock) {
1176
+ if (e.L && e.Se & STATUS_ERROR) {
1177
+ if (e.Ee < clock) {
1018
1178
  recompute(e, true);
1019
1179
  return read(e);
1020
- } else throw e.X;
1180
+ } else throw e.le;
1181
+ }
1182
+ if (e.ee !== undefined && e.ee !== NOT_PENDING) {
1183
+ return e.ee;
1021
1184
  }
1022
- return !t || currentOptimisticLane !== null && (e._e || e.ie || n === e || !!(n.Ee & STATUS_PENDING)) || e.ae === NOT_PENDING || stale ? e.fe : e.ae;
1185
+ return !t || currentOptimisticLane !== null && (e.ee !== undefined || e.q || n === e && stale || !!(n.Se & STATUS_PENDING)) || e.X === NOT_PENDING || stale ? e.J : e.X;
1023
1186
  }
1024
1187
  function setSignal(e, t) {
1025
- if (e.ne && activeTransition !== e.ne) globalQueue.initTransition(e.ne);
1026
- const n = e._e && true;
1027
- const i = n ? e.fe : e.ae === NOT_PENDING ? e.fe : e.ae;
1028
- if (typeof t === "function") t = t(i);
1029
- const r = !e.pe || !e.pe(i, t) || !!(e.Ee & STATUS_UNINITIALIZED);
1030
- if (!r) {
1031
- if (n && e.ae !== NOT_PENDING && e.L) {
1188
+ if (e.K && activeTransition !== e.K) globalQueue.initTransition(e.K);
1189
+ const n = e.ee !== undefined && true;
1190
+ const i = e.ee !== undefined && e.ee !== NOT_PENDING;
1191
+ const r = n ? i ? e.ee : e.J : e.X === NOT_PENDING ? e.J : e.X;
1192
+ if (typeof t === "function") t = t(r);
1193
+ const s = !e.Ne || !e.Ne(r, t) || !!(e.Se & STATUS_UNINITIALIZED);
1194
+ if (!s) {
1195
+ if (n && i && e.L) {
1032
1196
  insertSubs(e, true);
1033
1197
  schedule();
1034
1198
  }
1035
1199
  return t;
1036
1200
  }
1037
1201
  if (n) {
1038
- const n = globalQueue.$.includes(e);
1039
- if (e.ne && n) {
1040
- globalQueue.initTransition(e.ne);
1041
- }
1042
- if (e.ae === NOT_PENDING) {
1043
- e.ae = e.fe;
1044
- }
1045
- if (!n) {
1046
- globalQueue.$.push(e);
1202
+ const n = e.ee === NOT_PENDING;
1203
+ if (!n) globalQueue.initTransition(resolveTransition(e));
1204
+ if (n) {
1205
+ e.X = e.J;
1206
+ globalQueue.Y.push(e);
1047
1207
  }
1048
- e.Oe = (e.Oe || 0) + 1;
1208
+ e._e = true;
1049
1209
  const i = getOrCreateLane(e);
1050
- e.ie = i;
1051
- e.fe = t;
1210
+ e.q = i;
1211
+ e.ee = t;
1052
1212
  } else {
1053
- if (e.ae === NOT_PENDING) globalQueue.F.push(e);
1054
- e.ae = t;
1213
+ if (e.X === NOT_PENDING) globalQueue.se.push(e);
1214
+ e.X = t;
1055
1215
  }
1056
1216
  updatePendingSignal(e);
1057
- if (e.he) {
1058
- setSignal(e.he, t);
1217
+ if (e.Pe) {
1218
+ setSignal(e.Pe, t);
1059
1219
  }
1060
- e.J = clock;
1220
+ e.Ee = clock;
1061
1221
  insertSubs(e, n);
1062
1222
  schedule();
1063
1223
  return t;
1064
1224
  }
1065
1225
  function computePendingState(e) {
1066
1226
  const t = e;
1067
- if (e._e && e.ae !== NOT_PENDING) {
1068
- if (t.Ee & STATUS_PENDING && !(t.Ee & STATUS_UNINITIALIZED)) return true;
1069
- if (e.de) {
1070
- const t = e.ie ? findLane(e.ie) : null;
1071
- return !!(t && t.U.size > 0);
1227
+ const n = e.V;
1228
+ if (n && e.X !== NOT_PENDING) {
1229
+ return !n.Ae && !(n.Se & STATUS_PENDING);
1230
+ }
1231
+ if (e.ee !== undefined && e.ee !== NOT_PENDING) {
1232
+ if (t.Se & STATUS_PENDING && !(t.Se & STATUS_UNINITIALIZED)) return true;
1233
+ if (e.Re) {
1234
+ const t = e.q ? findLane(e.q) : null;
1235
+ return !!(t && t.k.size > 0);
1072
1236
  }
1073
1237
  return true;
1074
1238
  }
1075
- if (e.ae !== NOT_PENDING && !(t.Ee & STATUS_UNINITIALIZED)) return true;
1076
- return !!(t.Ee & STATUS_PENDING && !(t.Ee & STATUS_UNINITIALIZED));
1239
+ if (e.ee !== undefined && e.ee === NOT_PENDING && !e.Re) {
1240
+ return false;
1241
+ }
1242
+ if (e.X !== NOT_PENDING && !(t.Se & STATUS_UNINITIALIZED)) return true;
1243
+ return !!(t.Se & STATUS_PENDING && !(t.Se & STATUS_UNINITIALIZED));
1077
1244
  }
1078
1245
  function updatePendingSignal(e) {
1079
- if (e.Me) {
1246
+ if (e.Qe) {
1080
1247
  const t = computePendingState(e);
1081
- const n = e.Me;
1248
+ const n = e.Qe;
1082
1249
  setSignal(n, t);
1083
- if (!t && n.ie) {
1250
+ if (!t && n.q) {
1084
1251
  const t = resolveLane(e);
1085
- if (t && t.U.size > 0) {
1086
- const e = findLane(n.ie);
1252
+ if (t && t.k.size > 0) {
1253
+ const e = findLane(n.q);
1087
1254
  if (e !== t) {
1088
1255
  mergeLanes(t, e);
1089
1256
  }
1090
1257
  }
1091
1258
  signalLanes.delete(n);
1092
- n.ie = undefined;
1259
+ n.q = undefined;
1093
1260
  }
1094
1261
  }
1095
1262
  }
1263
+ function accessor(e) {
1264
+ const t = read.bind(null, e);
1265
+ t.$r = true;
1266
+ return t;
1267
+ }
1096
1268
  function createMemo(e, t, n) {
1097
1269
  let i = computed(e, t, n);
1098
- return read.bind(null, i);
1270
+ return accessor(i);
1099
1271
  }
1100
1272
  function isWrappable(e) {
1101
1273
  return e != null && typeof e === "object" && !Object.isFrozen(e);