@tanstack/solid-query-persist-client 6.0.0-alpha.0 → 6.0.0-alpha.1

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