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

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.
@@ -2,10 +2,1176 @@
2
2
 
3
3
  var solidJs = require('solid-js');
4
4
 
5
+ class NotReadyError extends Error {
6
+ source;
7
+ constructor(e) {
8
+ super();
9
+ this.source = e;
10
+ }
11
+ }
12
+ class StatusError extends Error {
13
+ source;
14
+ constructor(e, t) {
15
+ super(t instanceof Error ? t.message : String(t), {
16
+ cause: t
17
+ });
18
+ this.source = e;
19
+ }
20
+ }
21
+ const REACTIVE_NONE = 0;
22
+ const REACTIVE_CHECK = 1 << 0;
23
+ const REACTIVE_DIRTY = 1 << 1;
24
+ const REACTIVE_RECOMPUTING_DEPS = 1 << 2;
25
+ const REACTIVE_IN_HEAP = 1 << 3;
26
+ const REACTIVE_IN_HEAP_HEIGHT = 1 << 4;
27
+ const REACTIVE_ZOMBIE = 1 << 5;
28
+ const REACTIVE_DISPOSED = 1 << 6;
29
+ const REACTIVE_OPTIMISTIC_DIRTY = 1 << 7;
30
+ const REACTIVE_SNAPSHOT_STALE = 1 << 8;
31
+ const REACTIVE_LAZY = 1 << 9;
32
+ const STATUS_PENDING = 1 << 0;
33
+ const STATUS_ERROR = 1 << 1;
34
+ const STATUS_UNINITIALIZED = 1 << 2;
35
+ const EFFECT_RENDER = 1;
36
+ const EFFECT_USER = 2;
37
+ const EFFECT_TRACKED = 3;
38
+ const NOT_PENDING = {};
39
+ const defaultContext = {};
40
+ function actualInsertIntoHeap(e, t) {
41
+ const n = (e.i?.t ? e.i.u?.o : e.i?.o) ?? -1;
42
+ if (n >= e.o) e.o = n + 1;
43
+ const i = e.o;
44
+ const r = t.l[i];
45
+ if (r === undefined) t.l[i] = e;else {
46
+ const t = r.T;
47
+ t.S = e;
48
+ e.T = t;
49
+ r.T = e;
50
+ }
51
+ if (i > t.R) t.R = i;
52
+ }
53
+ function insertIntoHeap(e, t) {
54
+ let n = e.O;
55
+ if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS)) return;
56
+ if (n & REACTIVE_CHECK) {
57
+ e.O = n & -4 | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
58
+ } else e.O = n | REACTIVE_IN_HEAP;
59
+ if (!(n & REACTIVE_IN_HEAP_HEIGHT)) actualInsertIntoHeap(e, t);
60
+ }
61
+ function insertIntoHeapHeight(e, t) {
62
+ let n = e.O;
63
+ if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_IN_HEAP_HEIGHT)) return;
64
+ e.O = n | REACTIVE_IN_HEAP_HEIGHT;
65
+ actualInsertIntoHeap(e, t);
66
+ }
67
+ function deleteFromHeap(e, t) {
68
+ const n = e.O;
69
+ if (!(n & (REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT))) return;
70
+ e.O = n & -25;
71
+ const i = e.o;
72
+ if (e.T === e) t.l[i] = undefined;else {
73
+ const n = e.S;
74
+ const r = t.l[i];
75
+ const s = n ?? r;
76
+ if (e === r) t.l[i] = n;else e.T.S = n;
77
+ s.T = e.T;
78
+ }
79
+ e.T = e;
80
+ e.S = undefined;
81
+ }
82
+ function markHeap(e) {
83
+ if (e._) return;
84
+ e._ = true;
85
+ for (let t = 0; t <= e.R; t++) {
86
+ for (let n = e.l[t]; n !== undefined; n = n.S) {
87
+ if (n.O & REACTIVE_IN_HEAP) markNode(n);
88
+ }
89
+ }
90
+ }
91
+ function markNode(e, t = REACTIVE_DIRTY) {
92
+ const n = e.O;
93
+ if ((n & (REACTIVE_CHECK | REACTIVE_DIRTY)) >= t) return;
94
+ e.O = n & -4 | t;
95
+ for (let t = e.I; t !== null; t = t.p) {
96
+ markNode(t.h, REACTIVE_CHECK);
97
+ }
98
+ if (e.A !== null) {
99
+ for (let t = e.A; t !== null; t = t.P) {
100
+ for (let e = t.I; e !== null; e = e.p) {
101
+ markNode(e.h, REACTIVE_CHECK);
102
+ }
103
+ }
104
+ }
105
+ }
106
+ function runHeap(e, t) {
107
+ e._ = false;
108
+ for (e.N = 0; e.N <= e.R; e.N++) {
109
+ let n = e.l[e.N];
110
+ while (n !== undefined) {
111
+ if (n.O & REACTIVE_IN_HEAP) t(n);else adjustHeight(n, e);
112
+ n = e.l[e.N];
113
+ }
114
+ }
115
+ e.R = 0;
116
+ }
117
+ function adjustHeight(e, t) {
118
+ deleteFromHeap(e, t);
119
+ let n = e.o;
120
+ for (let t = e.C; t; t = t.D) {
121
+ const e = t.V;
122
+ const i = e.m || e;
123
+ if (i.L && i.o >= n) n = i.o + 1;
124
+ }
125
+ if (e.o !== n) {
126
+ e.o = n;
127
+ for (let n = e.I; n !== null; n = n.p) {
128
+ insertIntoHeapHeight(n.h, t);
129
+ }
130
+ }
131
+ }
132
+ const transitions = new Set();
133
+ const dirtyQueue = {
134
+ l: new Array(2e3).fill(undefined),
135
+ _: false,
136
+ N: 0,
137
+ R: 0
138
+ };
139
+ const zombieQueue = {
140
+ l: new Array(2e3).fill(undefined),
141
+ _: false,
142
+ N: 0,
143
+ R: 0
144
+ };
145
+ let clock = 0;
146
+ let activeTransition = null;
147
+ let scheduled = false;
148
+ function runLaneEffects(e) {
149
+ for (const t of activeLanes) {
150
+ if (t.k || t.U.size > 0) continue;
151
+ const n = t.W[e - 1];
152
+ if (n.length) {
153
+ t.W[e - 1] = [];
154
+ runQueue(n, e);
155
+ }
156
+ }
157
+ }
158
+ function schedule() {
159
+ if (scheduled) return;
160
+ scheduled = true;
161
+ if (!globalQueue.H && true) queueMicrotask(flush);
162
+ }
163
+ class Queue {
164
+ i = null;
165
+ G = [[], []];
166
+ M = [];
167
+ created = clock;
168
+ addChild(e) {
169
+ this.M.push(e);
170
+ e.i = this;
171
+ }
172
+ removeChild(e) {
173
+ const t = this.M.indexOf(e);
174
+ if (t >= 0) {
175
+ this.M.splice(t, 1);
176
+ e.i = null;
177
+ }
178
+ }
179
+ notify(e, t, n, i) {
180
+ if (this.i) return this.i.notify(e, t, n, i);
181
+ return false;
182
+ }
183
+ run(e) {
184
+ if (this.G[e - 1].length) {
185
+ const t = this.G[e - 1];
186
+ this.G[e - 1] = [];
187
+ runQueue(t, e);
188
+ }
189
+ for (let t = 0; t < this.M.length; t++) this.M[t].run?.(e);
190
+ }
191
+ enqueue(e, t) {
192
+ if (e) {
193
+ if (currentOptimisticLane) {
194
+ const n = findLane(currentOptimisticLane);
195
+ n.W[e - 1].push(t);
196
+ } else {
197
+ this.G[e - 1].push(t);
198
+ }
199
+ }
200
+ schedule();
201
+ }
202
+ 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];
209
+ if (!i) {
210
+ i = {
211
+ G: [[], []],
212
+ M: []
213
+ };
214
+ e.M[t] = i;
215
+ }
216
+ n.stashQueues(i);
217
+ }
218
+ }
219
+ 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];
225
+ if (i) i.restoreQueues(n);
226
+ }
227
+ }
228
+ }
229
+ class GlobalQueue extends Queue {
230
+ H = false;
231
+ F = [];
232
+ $ = [];
233
+ j = new Set();
234
+ static K;
235
+ static Y;
236
+ static Z = null;
237
+ flush() {
238
+ if (this.H) return;
239
+ this.H = true;
240
+ try {
241
+ runHeap(dirtyQueue, GlobalQueue.K);
242
+ if (activeTransition) {
243
+ const e = transitionComplete(activeTransition);
244
+ if (!e) {
245
+ let e = activeTransition;
246
+ runHeap(zombieQueue, GlobalQueue.K);
247
+ this.F = [];
248
+ this.$ = [];
249
+ this.j = new Set();
250
+ runLaneEffects(EFFECT_RENDER);
251
+ runLaneEffects(EFFECT_USER);
252
+ this.stashQueues(activeTransition.B);
253
+ clock++;
254
+ scheduled = dirtyQueue.R >= dirtyQueue.N;
255
+ reassignPendingTransition(activeTransition.F);
256
+ activeTransition = null;
257
+ finalizePureQueue(null, true);
258
+ return;
259
+ }
260
+ this.F !== activeTransition.F && this.F.push(...activeTransition.F);
261
+ this.restoreQueues(activeTransition.B);
262
+ transitions.delete(activeTransition);
263
+ const t = activeTransition;
264
+ activeTransition = null;
265
+ reassignPendingTransition(this.F);
266
+ finalizePureQueue(t);
267
+ } else {
268
+ if (transitions.size) runHeap(zombieQueue, GlobalQueue.K);
269
+ finalizePureQueue();
270
+ }
271
+ clock++;
272
+ scheduled = dirtyQueue.R >= dirtyQueue.N;
273
+ runLaneEffects(EFFECT_RENDER);
274
+ this.run(EFFECT_RENDER);
275
+ runLaneEffects(EFFECT_USER);
276
+ this.run(EFFECT_USER);
277
+ } finally {
278
+ this.H = false;
279
+ }
280
+ }
281
+ notify(e, t, n, i) {
282
+ if (t & STATUS_PENDING) {
283
+ 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();
288
+ }
289
+ }
290
+ return true;
291
+ }
292
+ return false;
293
+ }
294
+ initTransition(e) {
295
+ if (e) e = currentTransition(e);
296
+ if (e && e === activeTransition) return;
297
+ if (!e && activeTransition && activeTransition.J === clock) return;
298
+ if (!activeTransition) {
299
+ activeTransition = e ?? {
300
+ J: clock,
301
+ F: [],
302
+ q: [],
303
+ $: [],
304
+ j: new Set(),
305
+ ee: [],
306
+ B: {
307
+ G: [[], []],
308
+ M: []
309
+ },
310
+ te: false
311
+ };
312
+ } else if (e) {
313
+ 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
+ }
323
+ transitions.delete(t);
324
+ activeTransition = e;
325
+ }
326
+ 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);
332
+ }
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);
338
+ }
339
+ this.$ = activeTransition.$;
340
+ for (const e of activeLanes) {
341
+ if (!e.ne) e.ne = activeTransition;
342
+ }
343
+ for (const e of this.j) activeTransition.j.add(e);
344
+ this.j = activeTransition.j;
345
+ }
346
+ }
347
+ function insertSubs(e, t = false) {
348
+ const n = e.ie || currentOptimisticLane;
349
+ const i = e.re !== undefined;
350
+ for (let r = e.I; r !== null; r = r.p) {
351
+ if (i && r.h.se) {
352
+ r.h.O |= REACTIVE_SNAPSHOT_STALE;
353
+ continue;
354
+ }
355
+ if (t && n) {
356
+ r.h.O |= REACTIVE_OPTIMISTIC_DIRTY;
357
+ assignOrMergeLane(r.h, n);
358
+ } else if (t) {
359
+ r.h.O |= REACTIVE_OPTIMISTIC_DIRTY;
360
+ r.h.ie = undefined;
361
+ }
362
+ 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);
367
+ }
368
+ continue;
369
+ }
370
+ const s = r.h.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
371
+ if (s.N > r.h.o) s.N = r.h.o;
372
+ insertIntoHeap(r.h, s);
373
+ }
374
+ }
375
+ function finalizePureQueue(e = null, t = false) {
376
+ let n = !t;
377
+ if (!t) checkBoundaryChildren(globalQueue);
378
+ if (dirtyQueue.R >= dirtyQueue.N) runHeap(dirtyQueue, GlobalQueue.K);
379
+ 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
+ }
420
+ }
421
+ }
422
+ function checkBoundaryChildren(e) {
423
+ for (const t of e.M) {
424
+ t.checkSources?.();
425
+ checkBoundaryChildren(t);
426
+ }
427
+ }
428
+ function reassignPendingTransition(e) {
429
+ for (let t = 0; t < e.length; t++) {
430
+ e[t].ne = activeTransition;
431
+ }
432
+ }
433
+ const globalQueue = new GlobalQueue();
434
+ function flush() {
435
+ while (scheduled) {
436
+ globalQueue.flush();
437
+ }
438
+ }
439
+ function runQueue(e, t) {
440
+ for (let n = 0; n < e.length; n++) e[n](t);
441
+ }
442
+ function transitionComplete(e) {
443
+ if (e.te) return true;
444
+ if (e.ee.length) return false;
445
+ 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) {
449
+ t = false;
450
+ break;
451
+ }
452
+ }
453
+ t && (e.te = true);
454
+ return t;
455
+ }
456
+ function currentTransition(e) {
457
+ while (e.te && typeof e.te === "object") e = e.te;
458
+ return e;
459
+ }
460
+ function runInTransition(e, t) {
461
+ const n = activeTransition;
462
+ try {
463
+ activeTransition = currentTransition(e);
464
+ return t();
465
+ } finally {
466
+ activeTransition = n;
467
+ }
468
+ }
469
+ const signalLanes = new WeakMap();
470
+ const activeLanes = new Set();
471
+ function getOrCreateLane(e) {
472
+ let t = signalLanes.get(e);
473
+ if (t) {
474
+ return findLane(t);
475
+ }
476
+ const n = e.de;
477
+ const i = n?.ie ? findLane(n.ie) : null;
478
+ t = {
479
+ Te: e,
480
+ U: new Set(),
481
+ W: [[], []],
482
+ k: null,
483
+ ne: activeTransition,
484
+ Se: i
485
+ };
486
+ signalLanes.set(e, t);
487
+ activeLanes.add(t);
488
+ e.Re = e.Oe || 0;
489
+ return t;
490
+ }
491
+ function findLane(e) {
492
+ while (e.k) e = e.k;
493
+ return e;
494
+ }
495
+ function mergeLanes(e, t) {
496
+ e = findLane(e);
497
+ t = findLane(t);
498
+ 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]);
503
+ return e;
504
+ }
505
+ function resolveLane(e) {
506
+ const t = e.ie;
507
+ if (!t) return undefined;
508
+ const n = findLane(t);
509
+ if (activeLanes.has(n)) return n;
510
+ e.ie = undefined;
511
+ return undefined;
512
+ }
513
+ function hasActiveOverride(e) {
514
+ return !!(e._e && e.ae !== NOT_PENDING);
515
+ }
516
+ function assignOrMergeLane(e, t) {
517
+ const n = findLane(t);
518
+ const i = e.ie;
519
+ if (i) {
520
+ if (i.k) {
521
+ e.ie = t;
522
+ return;
523
+ }
524
+ const r = findLane(i);
525
+ if (activeLanes.has(r)) {
526
+ 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);
530
+ }
531
+ return;
532
+ }
533
+ }
534
+ e.ie = t;
535
+ }
536
+ function handleAsync(e, t, n) {
537
+ const i = typeof t === "object" && t !== null;
538
+ const r = i && untrack(() => t[Symbol.asyncIterator]);
539
+ const s = !r && i && untrack(() => typeof t.then === "function");
540
+ if (!s && !r) {
541
+ e.Ie = null;
542
+ return t;
543
+ }
544
+ e.Ie = t;
545
+ let o;
546
+ const handleError = n => {
547
+ if (e.Ie !== t) return;
548
+ globalQueue.initTransition(e.ne);
549
+ notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
550
+ e.J = clock;
551
+ };
552
+ const asyncWrite = (i, r) => {
553
+ if (e.Ie !== t) return;
554
+ if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
555
+ globalQueue.initTransition(e.ne);
556
+ clearStatus(e);
557
+ 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;
564
+ insertSubs(e);
565
+ }
566
+ e.J = clock;
567
+ } else if (s) {
568
+ const t = e.fe;
569
+ const n = e.pe;
570
+ if (!n || !n(i, t)) {
571
+ e.fe = i;
572
+ e.J = clock;
573
+ if (e.he) {
574
+ setSignal(e.he, i);
575
+ }
576
+ insertSubs(e, true);
577
+ }
578
+ } else {
579
+ setSignal(e, () => i);
580
+ }
581
+ schedule();
582
+ flush();
583
+ r?.();
584
+ };
585
+ if (s) {
586
+ let n = false,
587
+ i = true;
588
+ t.then(e => {
589
+ if (i) {
590
+ o = e;
591
+ n = true;
592
+ } else asyncWrite(e);
593
+ }, e => {
594
+ if (!i) handleError(e);
595
+ });
596
+ i = false;
597
+ if (!n) {
598
+ globalQueue.initTransition(e.ne);
599
+ throw new NotReadyError(context);
600
+ }
601
+ }
602
+ if (r) {
603
+ const n = t[Symbol.asyncIterator]();
604
+ let i = false;
605
+ const iterate = () => {
606
+ let e,
607
+ t = false,
608
+ r = true;
609
+ n.next().then(n => {
610
+ if (r) {
611
+ e = n;
612
+ t = true;
613
+ } else if (!n.done) asyncWrite(n.value, iterate);else {
614
+ schedule();
615
+ flush();
616
+ }
617
+ }, e => {
618
+ if (!r) handleError(e);
619
+ });
620
+ r = false;
621
+ if (t && !e.done) {
622
+ o = e.value;
623
+ i = true;
624
+ return iterate();
625
+ }
626
+ return t && e.done;
627
+ };
628
+ const r = iterate();
629
+ if (!i && !r) {
630
+ globalQueue.initTransition(e.ne);
631
+ throw new NotReadyError(context);
632
+ }
633
+ }
634
+ return o;
635
+ }
636
+ function clearStatus(e) {
637
+ e.Ee = e.Ee & STATUS_UNINITIALIZED;
638
+ e.X = null;
639
+ updatePendingSignal(e);
640
+ e.Ae?.();
641
+ }
642
+ function notifyStatus(e, t, n, i, r) {
643
+ 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);
647
+ if (!i) {
648
+ e.Ee = t | (t !== STATUS_ERROR ? e.Ee & STATUS_UNINITIALIZED : 0);
649
+ e.X = n;
650
+ updatePendingSignal(e);
651
+ }
652
+ if (r && !i) {
653
+ assignOrMergeLane(e, r);
654
+ }
655
+ if (u && activeTransition && n instanceof NotReadyError) {
656
+ const e = n.source;
657
+ if (!activeTransition.q.includes(e)) {
658
+ activeTransition.q.push(e);
659
+ }
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);
666
+ } else {
667
+ e.Ae();
668
+ }
669
+ return;
670
+ }
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);
676
+ }
677
+ }
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
+ }
685
+ }
686
+ }
687
+ }
688
+ function unlinkSubs(e) {
689
+ const t = e.V;
690
+ const n = e.D;
691
+ const i = e.p;
692
+ const r = e.Pe;
693
+ if (i !== null) i.Pe = r;else t.Ne = r;
694
+ if (r !== null) r.p = i;else {
695
+ t.I = i;
696
+ if (i === null) {
697
+ t.ge?.();
698
+ t.L && !t.Ce && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
699
+ }
700
+ }
701
+ return n;
702
+ }
703
+ function unobserved(e) {
704
+ deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
705
+ let t = e.C;
706
+ while (t !== null) {
707
+ t = unlinkSubs(t);
708
+ }
709
+ e.C = null;
710
+ disposeChildren(e, true);
711
+ }
712
+ function link(e, t) {
713
+ const n = t.ye;
714
+ if (n !== null && n.V === e) return;
715
+ let i = null;
716
+ const r = t.O & REACTIVE_RECOMPUTING_DEPS;
717
+ if (r) {
718
+ i = n !== null ? n.D : t.C;
719
+ if (i !== null && i.V === e) {
720
+ t.ye = i;
721
+ return;
722
+ }
723
+ }
724
+ const s = e.Ne;
725
+ if (s !== null && s.h === t && (!r || isValidLink(s, t))) return;
726
+ const o = t.ye = e.Ne = {
727
+ V: e,
728
+ h: t,
729
+ D: i,
730
+ Pe: s,
731
+ p: null
732
+ };
733
+ if (n !== null) n.D = o;else t.C = o;
734
+ if (s !== null) s.p = o;else e.I = o;
735
+ }
736
+ function isValidLink(e, t) {
737
+ const n = t.ye;
738
+ if (n !== null) {
739
+ let i = t.C;
740
+ do {
741
+ if (i === e) return true;
742
+ if (i === n) break;
743
+ i = i.D;
744
+ } while (i !== null);
745
+ }
746
+ return false;
747
+ }
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;
803
+ let tracking = false;
804
+ let stale = false;
805
+ let context = null;
806
+ let currentOptimisticLane = null;
807
+ function recompute(e, t = false) {
808
+ const n = e.oe;
809
+ if (!t) {
810
+ if (e.ne && (!n || activeTransition) && activeTransition !== e.ne) globalQueue.initTransition(e.ne);
811
+ deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
812
+ if (e.ne || n === EFFECT_TRACKED) disposeChildren(e);else {
813
+ markDisposal(e);
814
+ e.Ve = e.me;
815
+ e.be = e.De;
816
+ e.me = null;
817
+ e.De = null;
818
+ e.we = 0;
819
+ }
820
+ }
821
+ const i = !!(e.O & REACTIVE_OPTIMISTIC_DIRTY);
822
+ const r = hasActiveOverride(e);
823
+ const s = !!(e.Ee & STATUS_PENDING);
824
+ const o = context;
825
+ context = e;
826
+ e.ye = null;
827
+ e.O = REACTIVE_RECOMPUTING_DEPS;
828
+ e.J = clock;
829
+ let u = e.ae === NOT_PENDING ? e.fe : e.ae;
830
+ let c = e.o;
831
+ let l = tracking;
832
+ let a = currentOptimisticLane;
833
+ tracking = true;
834
+ if (i) {
835
+ const t = resolveLane(e);
836
+ if (t) currentOptimisticLane = t;
837
+ }
838
+ try {
839
+ 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);
845
+ }
846
+ } catch (t) {
847
+ if (t instanceof NotReadyError && currentOptimisticLane) {
848
+ const t = findLane(currentOptimisticLane);
849
+ if (t.Te !== e) {
850
+ t.U.add(e);
851
+ e.ie = t;
852
+ updatePendingSignal(t.Te);
853
+ }
854
+ }
855
+ notifyStatus(e, t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, t, undefined, t instanceof NotReadyError ? e.ie : undefined);
856
+ } finally {
857
+ tracking = l;
858
+ e.O = REACTIVE_NONE | (t ? e.O & REACTIVE_SNAPSHOT_STALE : 0);
859
+ context = o;
860
+ }
861
+ if (!e.X) {
862
+ const o = e.ye;
863
+ let l = o !== null ? o.D : e.C;
864
+ if (l !== null) {
865
+ do {
866
+ l = unlinkSubs(l);
867
+ } while (l !== null);
868
+ if (o !== null) o.D = null;else e.C = null;
869
+ }
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
+ }
883
+ } else if (r) {
884
+ e.ae = u;
885
+ } else if (e.o != c) {
886
+ for (let t = e.I; t !== null; t = t.p) {
887
+ insertIntoHeapHeight(t.h, t.h.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
888
+ }
889
+ }
890
+ }
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));
894
+ }
895
+ function updateIfNecessary(e) {
896
+ if (e.O & REACTIVE_CHECK) {
897
+ for (let t = e.C; t; t = t.D) {
898
+ const n = t.V;
899
+ const i = n.m || n;
900
+ if (i.L) {
901
+ updateIfNecessary(i);
902
+ }
903
+ if (e.O & REACTIVE_DIRTY) {
904
+ break;
905
+ }
906
+ }
907
+ }
908
+ if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || e.X && e.J < clock && !e.Ie) {
909
+ recompute(e);
910
+ }
911
+ e.O = REACTIVE_NONE | e.O & REACTIVE_SNAPSHOT_STALE;
912
+ }
913
+ function computed(e, t, n) {
914
+ const i = n?.transparent;
915
+ const r = {
916
+ 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,
925
+ L: e,
926
+ fe: t,
927
+ o: 0,
928
+ A: null,
929
+ S: undefined,
930
+ T: null,
931
+ C: null,
932
+ ye: null,
933
+ I: null,
934
+ Ne: null,
935
+ i: context,
936
+ ve: null,
937
+ De: null,
938
+ 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
946
+ };
947
+ r.T = r;
948
+ const s = context?.t ? context.u : context;
949
+ if (context) {
950
+ const e = context.De;
951
+ if (e === null) {
952
+ context.De = r;
953
+ } else {
954
+ r.ve = e;
955
+ context.De = r;
956
+ }
957
+ }
958
+ if (s) r.o = s.o + 1;
959
+ !n?.lazy && recompute(r, true);
960
+ return r;
961
+ }
962
+ function isEqual(e, t) {
963
+ return e === t;
964
+ }
965
+ function untrack(e, t) {
966
+ if (!tracking && true) return e();
967
+ const n = tracking;
968
+ tracking = false;
969
+ try {
970
+ return e();
971
+ } finally {
972
+ tracking = n;
973
+ }
974
+ }
975
+ function read(e) {
976
+ let t = context;
977
+ if (t?.t) t = t.u;
978
+ if (e.O & REACTIVE_LAZY) {
979
+ e.O &= ~REACTIVE_LAZY;
980
+ recompute(e, true);
981
+ }
982
+ const n = e.m || e;
983
+ if (t && tracking) {
984
+ if (e.L && e.O & REACTIVE_DISPOSED) recompute(e);
985
+ link(e, t);
986
+ if (n.L) {
987
+ const i = e.O & REACTIVE_ZOMBIE;
988
+ if (n.o >= (i ? zombieQueue.N : dirtyQueue.N)) {
989
+ markNode(t);
990
+ markHeap(i ? zombieQueue : dirtyQueue);
991
+ updateIfNecessary(n);
992
+ }
993
+ const r = n.o;
994
+ if (r >= t.o && e.i !== t) {
995
+ t.o = r + 1;
996
+ }
997
+ }
998
+ }
999
+ if (n.Ee & STATUS_PENDING) {
1000
+ if (t && true) {
1001
+ if (currentOptimisticLane) {
1002
+ const i = n.ie;
1003
+ const r = findLane(currentOptimisticLane);
1004
+ if (i && findLane(i) === r && !hasActiveOverride(n)) {
1005
+ if (!tracking) link(e, t);
1006
+ throw n.X;
1007
+ }
1008
+ } else {
1009
+ if (!tracking) link(e, t);
1010
+ throw n.X;
1011
+ }
1012
+ } else if (!t && n.Ee & STATUS_UNINITIALIZED) {
1013
+ throw n.X;
1014
+ }
1015
+ }
1016
+ if (e.L && e.Ee & STATUS_ERROR) {
1017
+ if (e.J < clock) {
1018
+ recompute(e, true);
1019
+ return read(e);
1020
+ } else throw e.X;
1021
+ }
1022
+ return !t || currentOptimisticLane !== null && (e._e || e.ie || n === e || !!(n.Ee & STATUS_PENDING)) || e.ae === NOT_PENDING || stale ? e.fe : e.ae;
1023
+ }
1024
+ 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) {
1032
+ insertSubs(e, true);
1033
+ schedule();
1034
+ }
1035
+ return t;
1036
+ }
1037
+ 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);
1047
+ }
1048
+ e.Oe = (e.Oe || 0) + 1;
1049
+ const i = getOrCreateLane(e);
1050
+ e.ie = i;
1051
+ e.fe = t;
1052
+ } else {
1053
+ if (e.ae === NOT_PENDING) globalQueue.F.push(e);
1054
+ e.ae = t;
1055
+ }
1056
+ updatePendingSignal(e);
1057
+ if (e.he) {
1058
+ setSignal(e.he, t);
1059
+ }
1060
+ e.J = clock;
1061
+ insertSubs(e, n);
1062
+ schedule();
1063
+ return t;
1064
+ }
1065
+ function computePendingState(e) {
1066
+ 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);
1072
+ }
1073
+ return true;
1074
+ }
1075
+ if (e.ae !== NOT_PENDING && !(t.Ee & STATUS_UNINITIALIZED)) return true;
1076
+ return !!(t.Ee & STATUS_PENDING && !(t.Ee & STATUS_UNINITIALIZED));
1077
+ }
1078
+ function updatePendingSignal(e) {
1079
+ if (e.Me) {
1080
+ const t = computePendingState(e);
1081
+ const n = e.Me;
1082
+ setSignal(n, t);
1083
+ if (!t && n.ie) {
1084
+ const t = resolveLane(e);
1085
+ if (t && t.U.size > 0) {
1086
+ const e = findLane(n.ie);
1087
+ if (e !== t) {
1088
+ mergeLanes(t, e);
1089
+ }
1090
+ }
1091
+ signalLanes.delete(n);
1092
+ n.ie = undefined;
1093
+ }
1094
+ }
1095
+ }
1096
+ function createMemo(e, t, n) {
1097
+ let i = computed(e, t, n);
1098
+ return read.bind(null, i);
1099
+ }
1100
+ function isWrappable(e) {
1101
+ return e != null && typeof e === "object" && !Object.isFrozen(e);
1102
+ }
1103
+ const DELETE = Symbol(0);
1104
+ function updatePath(e, t, n = 0) {
1105
+ let i,
1106
+ r = e;
1107
+ if (n < t.length - 1) {
1108
+ i = t[n];
1109
+ const s = typeof i;
1110
+ const o = Array.isArray(e);
1111
+ if (Array.isArray(i)) {
1112
+ for (let r = 0; r < i.length; r++) {
1113
+ t[n] = i[r];
1114
+ updatePath(e, t, n);
1115
+ }
1116
+ t[n] = i;
1117
+ return;
1118
+ } else if (o && s === "function") {
1119
+ for (let r = 0; r < e.length; r++) {
1120
+ if (i(e[r], r)) {
1121
+ t[n] = r;
1122
+ updatePath(e, t, n);
1123
+ }
1124
+ }
1125
+ t[n] = i;
1126
+ return;
1127
+ } else if (o && s === "object") {
1128
+ const {
1129
+ from: r = 0,
1130
+ to: s = e.length - 1,
1131
+ by: o = 1
1132
+ } = i;
1133
+ for (let i = r; i <= s; i += o) {
1134
+ t[n] = i;
1135
+ updatePath(e, t, n);
1136
+ }
1137
+ t[n] = i;
1138
+ return;
1139
+ } else if (n < t.length - 2) {
1140
+ updatePath(e[i], t, n + 1);
1141
+ return;
1142
+ }
1143
+ r = e[i];
1144
+ }
1145
+ let s = t[t.length - 1];
1146
+ if (typeof s === "function") {
1147
+ s = s(r);
1148
+ if (s === r) return;
1149
+ }
1150
+ if (i === undefined && s == undefined) return;
1151
+ if (s === DELETE) {
1152
+ delete e[i];
1153
+ } else if (i === undefined || isWrappable(r) && isWrappable(s) && !Array.isArray(s)) {
1154
+ const t = i !== undefined ? e[i] : e;
1155
+ const n = Object.keys(s);
1156
+ for (let e = 0; e < n.length; e++) t[n[e]] = s[n[e]];
1157
+ } else {
1158
+ e[i] = s;
1159
+ }
1160
+ }
1161
+ Object.assign(function storePath(...e) {
1162
+ return t => {
1163
+ updatePath(t, e);
1164
+ };
1165
+ }, {
1166
+ DELETE: DELETE
1167
+ });
1168
+
5
1169
  const effect = (fn, effectFn, initial) => solidJs.createRenderEffect(fn, effectFn, initial, {
6
1170
  transparent: true
7
1171
  });
8
- const memo = fn => solidJs.createMemo(() => fn());
1172
+ const memo = (fn, transparent) => transparent ? fn.$r ? fn : createMemo(() => fn(), undefined, {
1173
+ transparent: true
1174
+ }) : solidJs.createMemo(() => fn());
9
1175
 
10
1176
  function createRenderer({
11
1177
  createElement,