@nil-/xit 0.4.19 → 0.4.20

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.
@@ -1,174 +1,3146 @@
1
- import { n as l, u as w, s as B, r as C, a as E, e as j, g as M, b as P, c as k, t as T, d as y, f as h, h as m, i as S, j as $ } from "./index.js";
2
- import "./internal/client.js";
3
- function q(e, r, n) {
1
+ var Cr = Object.defineProperty;
2
+ var xn = (e) => {
3
+ throw TypeError(e);
4
+ };
5
+ var Ir = (e, t, n) => t in e ? Cr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
6
+ var se = (e, t, n) => Ir(e, typeof t != "symbol" ? t + "" : t, n), Vt = (e, t, n) => t.has(e) || xn("Cannot " + n);
7
+ var a = (e, t, n) => (Vt(e, t, "read from private field"), n ? n.call(e) : t.get(e)), g = (e, t, n) => t.has(e) ? xn("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), b = (e, t, n, r) => (Vt(e, t, "write to private field"), r ? r.call(e, n) : t.set(e, n), n), m = (e, t, n) => (Vt(e, t, "access private method"), n);
8
+ var Hn = Array.isArray, Dr = Array.prototype.indexOf, Ze = Array.prototype.includes, ei = Array.from, ti = Object.keys, Xt = Object.defineProperty, lt = Object.getOwnPropertyDescriptor, Pr = Object.getOwnPropertyDescriptors, $n = Object.prototype, Lr = Array.prototype, fn = Object.getPrototypeOf, On = Object.isExtensible, ni = Object.prototype.hasOwnProperty;
9
+ function ri(e) {
10
+ return typeof e == "function";
11
+ }
12
+ const fe = () => {
13
+ };
14
+ function si(e) {
15
+ return typeof (e == null ? void 0 : e.then) == "function";
16
+ }
17
+ function ii(e) {
18
+ return e();
19
+ }
20
+ function Yn(e) {
21
+ for (var t = 0; t < e.length; t++)
22
+ e[t]();
23
+ }
24
+ function Un() {
25
+ var e, t, n = new Promise((r, s) => {
26
+ e = r, t = s;
27
+ });
28
+ return { promise: n, resolve: e, reject: t };
29
+ }
30
+ function ai(e, t, n = !1) {
31
+ return e === void 0 ? n ? (
32
+ /** @type {() => V} */
33
+ t()
34
+ ) : (
35
+ /** @type {V} */
36
+ t
37
+ ) : e;
38
+ }
39
+ function oi(e, t) {
40
+ if (Array.isArray(e))
41
+ return e;
42
+ if (t === void 0 || !(Symbol.iterator in e))
43
+ return Array.from(e);
44
+ const n = [];
45
+ for (const r of e)
46
+ if (n.push(r), n.length === t) break;
47
+ return n;
48
+ }
49
+ function fi(e, t) {
50
+ var n = {};
51
+ for (var r in e)
52
+ t.includes(r) || (n[r] = e[r]);
53
+ for (var s of Object.getOwnPropertySymbols(e))
54
+ Object.propertyIsEnumerable.call(e, s) && !t.includes(s) && (n[s] = e[s]);
55
+ return n;
56
+ }
57
+ const C = 2, je = 4, Tt = 8, ln = 1 << 24, le = 16, ue = 32, ye = 64, Jt = 128, V = 512, O = 1024, I = 2048, re = 4096, K = 8192, W = 16384, Ye = 32768, Nn = 1 << 25, dt = 65536, ht = 1 << 17, Fr = 1 << 18, Ue = 1 << 19, Bn = 1 << 20, li = 1 << 25, qe = 65536, Zt = 1 << 21, Qe = 1 << 22, Te = 1 << 23, Ae = Symbol("$state"), ui = Symbol("legacy props"), ci = Symbol(""), jr = Symbol("proxy path"), _i = Symbol("hmr anchor"), oe = new class extends Error {
58
+ constructor() {
59
+ super(...arguments);
60
+ se(this, "name", "StaleReactionError");
61
+ se(this, "message", "The reaction that called `getAbortSignal()` was re-run or destroyed");
62
+ }
63
+ }();
64
+ var qn;
65
+ const hi = (
66
+ // We gotta write it like this because after downleveling the pure comment may end up in the wrong location
67
+ !!((qn = globalThis.document) != null && qn.contentType) && /* @__PURE__ */ globalThis.document.contentType.includes("xml")
68
+ ), vi = 1, Yt = 3, zn = 8, pi = 11;
69
+ function Gn(e) {
70
+ return e === this.v;
71
+ }
72
+ function Vn(e, t) {
73
+ return e != e ? t == t : e !== t || e !== null && typeof e == "object" || typeof e == "function";
74
+ }
75
+ function Kn(e) {
76
+ return !Vn(e, this.v);
77
+ }
78
+ function qr(e) {
79
+ throw new Error("https://svelte.dev/e/experimental_async_required");
80
+ }
81
+ function wi() {
82
+ throw new Error("https://svelte.dev/e/invalid_default_snippet");
83
+ }
84
+ function yi() {
85
+ throw new Error("https://svelte.dev/e/invalid_snippet_arguments");
86
+ }
87
+ function Hr(e) {
88
+ throw new Error("https://svelte.dev/e/lifecycle_outside_component");
89
+ }
90
+ function $r() {
91
+ throw new Error("https://svelte.dev/e/missing_context");
92
+ }
93
+ function bi() {
94
+ throw new Error("https://svelte.dev/e/snippet_without_render_tag");
95
+ }
96
+ function gi(e) {
97
+ throw new Error("https://svelte.dev/e/store_invalid_shape");
98
+ }
99
+ function mi() {
100
+ throw new Error("https://svelte.dev/e/svelte_element_invalid_this_value");
101
+ }
102
+ function Yr() {
103
+ throw new Error("https://svelte.dev/e/async_derived_orphan");
104
+ }
105
+ function Ei(e, t) {
106
+ throw new Error("https://svelte.dev/e/component_api_changed");
107
+ }
108
+ function Ti(e, t) {
109
+ throw new Error("https://svelte.dev/e/component_api_invalid_new");
110
+ }
111
+ function Ai(e, t, n) {
112
+ throw new Error("https://svelte.dev/e/each_key_duplicate");
113
+ }
114
+ function Ur(e) {
115
+ throw new Error("https://svelte.dev/e/effect_in_teardown");
116
+ }
117
+ function Br() {
118
+ throw new Error("https://svelte.dev/e/effect_in_unowned_derived");
119
+ }
120
+ function zr(e) {
121
+ throw new Error("https://svelte.dev/e/effect_orphan");
122
+ }
123
+ function Gr() {
124
+ throw new Error("https://svelte.dev/e/effect_pending_outside_reaction");
125
+ }
126
+ function Vr() {
127
+ throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
128
+ }
129
+ function Kr() {
130
+ throw new Error("https://svelte.dev/e/fork_discarded");
131
+ }
132
+ function Wr() {
133
+ throw new Error("https://svelte.dev/e/fork_timing");
134
+ }
135
+ function Si() {
136
+ throw new Error("https://svelte.dev/e/get_abort_signal_outside_reaction");
137
+ }
138
+ function ki() {
139
+ throw new Error("https://svelte.dev/e/hydration_failed");
140
+ }
141
+ function xi(e) {
142
+ throw new Error("https://svelte.dev/e/lifecycle_legacy_only");
143
+ }
144
+ function Oi(e) {
145
+ throw new Error("https://svelte.dev/e/props_invalid_value");
146
+ }
147
+ function Xr() {
148
+ throw new Error("https://svelte.dev/e/state_descriptors_fixed");
149
+ }
150
+ function Jr() {
151
+ throw new Error("https://svelte.dev/e/state_prototype_fixed");
152
+ }
153
+ function Zr() {
154
+ throw new Error("https://svelte.dev/e/state_unsafe_mutation");
155
+ }
156
+ function Qr() {
157
+ throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror");
158
+ }
159
+ const Ni = 1, Ri = 2, Mi = 4, Ci = 8, Ii = 16, Di = 1, Pi = 4, Li = 8, Fi = 16, ji = 1, qi = 2, Hi = 4, $i = 1, Yi = 2, Ui = 4, Bi = 8, es = "[", Wn = "[!", Rn = "[?", ts = "]", un = {}, R = Symbol(), ns = Symbol("filename"), zi = Symbol("hmr"), rs = "http://www.w3.org/1999/xhtml", Gi = "http://www.w3.org/2000/svg", Vi = "http://www.w3.org/1998/Math/MathML", Ki = "@attach";
160
+ function Wi(e) {
161
+ console.warn("https://svelte.dev/e/dynamic_void_element_content");
162
+ }
163
+ const ss = [];
164
+ function is(e, t = !1, n = !1) {
165
+ return St(e, /* @__PURE__ */ new Map(), "", ss, null, n);
166
+ }
167
+ function St(e, t, n, r, s = null, i = !1) {
168
+ if (typeof e == "object" && e !== null) {
169
+ var f = t.get(e);
170
+ if (f !== void 0) return f;
171
+ if (e instanceof Map) return (
172
+ /** @type {Snapshot<T>} */
173
+ new Map(e)
174
+ );
175
+ if (e instanceof Set) return (
176
+ /** @type {Snapshot<T>} */
177
+ new Set(e)
178
+ );
179
+ if (Hn(e)) {
180
+ var l = (
181
+ /** @type {Snapshot<any>} */
182
+ Array(e.length)
183
+ );
184
+ t.set(e, l), s !== null && t.set(s, l);
185
+ for (var u = 0; u < e.length; u += 1) {
186
+ var o = e[u];
187
+ u in e && (l[u] = St(o, t, n, r, null, i));
188
+ }
189
+ return l;
190
+ }
191
+ if (fn(e) === $n) {
192
+ l = {}, t.set(e, l), s !== null && t.set(s, l);
193
+ for (var c of Object.keys(e))
194
+ l[c] = St(
195
+ // @ts-expect-error
196
+ e[c],
197
+ t,
198
+ n,
199
+ r,
200
+ null,
201
+ i
202
+ );
203
+ return l;
204
+ }
205
+ if (e instanceof Date)
206
+ return (
207
+ /** @type {Snapshot<T>} */
208
+ structuredClone(e)
209
+ );
210
+ if (typeof /** @type {T & { toJSON?: any } } */
211
+ e.toJSON == "function" && !i)
212
+ return St(
213
+ /** @type {T & { toJSON(): any } } */
214
+ e.toJSON(),
215
+ t,
216
+ n,
217
+ r,
218
+ // Associate the instance with the toJSON clone
219
+ e
220
+ );
221
+ }
222
+ if (e instanceof EventTarget)
223
+ return (
224
+ /** @type {Snapshot<T>} */
225
+ e
226
+ );
227
+ try {
228
+ return (
229
+ /** @type {Snapshot<T>} */
230
+ structuredClone(e)
231
+ );
232
+ } catch {
233
+ return (
234
+ /** @type {Snapshot<T>} */
235
+ e
236
+ );
237
+ }
238
+ }
239
+ let Be = null;
240
+ function Xn(e, t) {
241
+ const n = e.v;
242
+ if (n === R)
243
+ return;
244
+ const r = as(e), s = (
245
+ /** @type {Reaction} */
246
+ w
247
+ ), i = e.wv > s.wv || s.wv === 0, f = i ? "color: CornflowerBlue; font-weight: bold" : "color: grey; font-weight: normal";
248
+ if (console.groupCollapsed(
249
+ e.label ? `%c${r}%c ${e.label}` : `%c${r}%c`,
250
+ f,
251
+ i ? "font-weight: normal" : f,
252
+ typeof n == "object" && n !== null && Ae in n ? is(n, !0) : n
253
+ ), r === "$derived") {
254
+ const u = new Set(
255
+ /** @type {Derived} */
256
+ e.deps
257
+ );
258
+ for (const o of u)
259
+ Xn(o);
260
+ }
261
+ if (e.created && console.log(e.created), i && e.updated)
262
+ for (const u of e.updated.values())
263
+ u.error && console.log(u.error);
264
+ if (t)
265
+ for (var l of t.traces)
266
+ console.log(l);
267
+ console.groupEnd();
268
+ }
269
+ function as(e) {
270
+ var t;
271
+ return (e.f & (C | Qe)) !== 0 ? "$derived" : (t = e.label) != null && t.startsWith("$") ? "store" : "$state";
272
+ }
273
+ function Xi(e, t) {
274
+ var n = Be;
275
+ try {
276
+ Be = { entries: /* @__PURE__ */ new Map(), reaction: w };
277
+ var r = performance.now(), s = t(), i = (performance.now() - r).toFixed(2), f = $e(e);
278
+ if (!At())
279
+ console.log(`${f} %cran outside of an effect (${i}ms)`, "color: grey");
280
+ else if (Be.entries.size === 0)
281
+ console.log(`${f} %cno reactive dependencies (${i}ms)`, "color: grey");
282
+ else {
283
+ console.group(`${f} %c(${i}ms)`, "color: grey");
284
+ var l = Be.entries;
285
+ $e(() => {
286
+ for (const [u, o] of l)
287
+ Xn(u, o);
288
+ }), Be = null, console.groupEnd();
289
+ }
290
+ return s;
291
+ } finally {
292
+ Be = n;
293
+ }
294
+ }
295
+ function Ji(e, t) {
296
+ return e.label = t, os(e.v, t), e;
297
+ }
298
+ function os(e, t) {
299
+ var n;
300
+ return (n = e == null ? void 0 : e[jr]) == null || n.call(e, t), e;
301
+ }
302
+ function Zi(e) {
303
+ const t = new Error(), n = fs();
304
+ return n.length === 0 ? null : (n.unshift(`
305
+ `), Xt(t, "stack", {
306
+ value: n.join(`
307
+ `)
308
+ }), Xt(t, "name", {
309
+ value: e
310
+ }), /** @type {Error & { stack: string }} */
311
+ t);
312
+ }
313
+ function fs() {
314
+ const e = Error.stackTraceLimit;
315
+ Error.stackTraceLimit = 1 / 0;
316
+ const t = new Error().stack;
317
+ if (Error.stackTraceLimit = e, !t) return [];
318
+ const n = t.split(`
319
+ `), r = [];
320
+ for (let s = 0; s < n.length; s++) {
321
+ const i = n[s], f = i.replaceAll("\\", "/");
322
+ if (i.trim() !== "Error") {
323
+ if (i.includes("validate_each_keys"))
324
+ return [];
325
+ f.includes("svelte/src/internal") || f.includes("node_modules/.vite") || r.push(i);
326
+ }
327
+ }
328
+ return r;
329
+ }
330
+ let M = null;
331
+ function et(e) {
332
+ M = e;
333
+ }
334
+ let Kt = null;
335
+ function Qi(e, t, n, r, s, i) {
336
+ const f = Kt;
337
+ Kt = {
338
+ type: t,
339
+ file: n[ns],
340
+ line: r,
341
+ column: s,
342
+ parent: f,
343
+ ...i
344
+ };
345
+ try {
346
+ return e();
347
+ } finally {
348
+ Kt = f;
349
+ }
350
+ }
351
+ let ls = null;
352
+ function ea(e) {
353
+ ls = e;
354
+ }
355
+ function ta() {
356
+ const e = {};
357
+ return [
358
+ () => (_s(e) || $r(), us(e)),
359
+ (t) => cs(e, t)
360
+ ];
361
+ }
362
+ function us(e) {
363
+ return (
364
+ /** @type {T} */
365
+ Ut().get(e)
366
+ );
367
+ }
368
+ function cs(e, t) {
369
+ return Ut().set(e, t), t;
370
+ }
371
+ function _s(e) {
372
+ return Ut().has(e);
373
+ }
374
+ function na() {
375
+ return Ut();
376
+ }
377
+ function ra(e, t = !1, n) {
378
+ M = {
379
+ p: M,
380
+ i: !1,
381
+ c: null,
382
+ e: null,
383
+ s: e,
384
+ x: null,
385
+ r: (
386
+ /** @type {Effect} */
387
+ y
388
+ ),
389
+ l: null
390
+ };
391
+ }
392
+ function sa(e) {
393
+ var t = (
394
+ /** @type {ComponentContext} */
395
+ M
396
+ ), n = t.e;
397
+ if (n !== null) {
398
+ t.e = null;
399
+ for (var r of n)
400
+ xr(r);
401
+ }
402
+ return e !== void 0 && (t.x = e), t.i = !0, M = t.p, e ?? /** @type {T} */
403
+ {};
404
+ }
405
+ function Jn() {
406
+ return !0;
407
+ }
408
+ function Ut(e) {
409
+ return M === null && Hr(), M.c ?? (M.c = new Map(ds(M) || void 0));
410
+ }
411
+ function ds(e) {
412
+ let t = e.p;
413
+ for (; t !== null; ) {
414
+ const n = t.c;
415
+ if (n !== null)
416
+ return n;
417
+ t = t.p;
418
+ }
419
+ return null;
420
+ }
421
+ let Re = [];
422
+ function Zn() {
423
+ var e = Re;
424
+ Re = [], Yn(e);
425
+ }
426
+ function Se(e) {
427
+ if (Re.length === 0 && !ut) {
428
+ var t = Re;
429
+ queueMicrotask(() => {
430
+ t === Re && Zn();
431
+ });
432
+ }
433
+ Re.push(e);
434
+ }
435
+ function hs() {
436
+ for (; Re.length > 0; )
437
+ Zn();
438
+ }
439
+ function ia(e, t) {
440
+ console.warn("https://svelte.dev/e/assignment_value_stale");
441
+ }
442
+ function aa(e, t) {
443
+ console.warn("https://svelte.dev/e/binding_property_non_reactive");
444
+ }
445
+ function oa(e) {
446
+ console.warn("https://svelte.dev/e/console_log_state");
447
+ }
448
+ function vs() {
449
+ console.warn("https://svelte.dev/e/derived_inert");
450
+ }
451
+ function fa(e, t) {
452
+ console.warn("https://svelte.dev/e/event_handler_invalid");
453
+ }
454
+ function la(e) {
455
+ console.warn("https://svelte.dev/e/hydratable_missing_but_expected");
456
+ }
457
+ function cn(e) {
458
+ console.warn("https://svelte.dev/e/hydration_mismatch");
459
+ }
460
+ function ua(e, t, n, r) {
461
+ console.warn("https://svelte.dev/e/ownership_invalid_binding");
462
+ }
463
+ function ca(e, t, n, r) {
464
+ console.warn("https://svelte.dev/e/ownership_invalid_mutation");
465
+ }
466
+ function _a() {
467
+ console.warn("https://svelte.dev/e/select_multiple_invalid_value");
468
+ }
469
+ function Qn(e) {
470
+ console.warn("https://svelte.dev/e/state_proxy_equality_mismatch");
471
+ }
472
+ function ps() {
473
+ console.warn("https://svelte.dev/e/svelte_boundary_reset_noop");
474
+ }
475
+ let U = !1;
476
+ function da(e) {
477
+ U = e;
478
+ }
479
+ let k;
480
+ function ke(e) {
481
+ if (e === null)
482
+ throw cn(), un;
483
+ return k = e;
484
+ }
485
+ function ws() {
486
+ return ke(/* @__PURE__ */ Oe(k));
487
+ }
488
+ function ha(e) {
489
+ if (U) {
490
+ if (/* @__PURE__ */ Oe(k) !== null)
491
+ throw cn(), un;
492
+ k = e;
493
+ }
494
+ }
495
+ function va(e) {
496
+ U && (k = e.content);
497
+ }
498
+ function ys(e = 1) {
499
+ if (U) {
500
+ for (var t = e, n = k; t--; )
501
+ n = /** @type {TemplateNode} */
502
+ /* @__PURE__ */ Oe(n);
503
+ k = n;
504
+ }
505
+ }
506
+ function bs(e = !0) {
507
+ for (var t = 0, n = k; ; ) {
508
+ if (n.nodeType === zn) {
509
+ var r = (
510
+ /** @type {Comment} */
511
+ n.data
512
+ );
513
+ if (r === ts) {
514
+ if (t === 0) return n;
515
+ t -= 1;
516
+ } else (r === es || r === Wn || // "[1", "[2", etc. for if blocks
517
+ r[0] === "[" && !isNaN(Number(r.slice(1)))) && (t += 1);
518
+ }
519
+ var s = (
520
+ /** @type {TemplateNode} */
521
+ /* @__PURE__ */ Oe(n)
522
+ );
523
+ e && n.remove(), n = s;
524
+ }
525
+ }
526
+ function pa(e) {
527
+ if (!e || e.nodeType !== zn)
528
+ throw cn(), un;
529
+ return (
530
+ /** @type {Comment} */
531
+ e.data
532
+ );
533
+ }
534
+ function ot(e) {
535
+ if (typeof e != "object" || e === null || Ae in e)
536
+ return e;
537
+ const t = fn(e);
538
+ if (t !== $n && t !== Lr)
539
+ return e;
540
+ var n = /* @__PURE__ */ new Map(), r = Hn(e), s = /* @__PURE__ */ be(0), i = Fe, f = (l) => {
541
+ if (Fe === i)
542
+ return l();
543
+ var u = w, o = Fe;
544
+ J(null), Fn(i);
545
+ var c = l();
546
+ return J(u), Fn(o), c;
547
+ };
548
+ return r && n.set("length", /* @__PURE__ */ be(
549
+ /** @type {any[]} */
550
+ e.length
551
+ )), new Proxy(
552
+ /** @type {any} */
553
+ e,
554
+ {
555
+ defineProperty(l, u, o) {
556
+ (!("value" in o) || o.configurable === !1 || o.enumerable === !1 || o.writable === !1) && Xr();
557
+ var c = n.get(u);
558
+ return c === void 0 ? f(() => {
559
+ var p = /* @__PURE__ */ be(o.value);
560
+ return n.set(u, p), p;
561
+ }) : ee(c, o.value, !0), !0;
562
+ },
563
+ deleteProperty(l, u) {
564
+ var o = n.get(u);
565
+ if (o === void 0) {
566
+ if (u in l) {
567
+ const c = f(() => /* @__PURE__ */ be(R));
568
+ n.set(u, c), _t(s);
569
+ }
570
+ } else
571
+ ee(o, R), _t(s);
572
+ return !0;
573
+ },
574
+ get(l, u, o) {
575
+ var h;
576
+ if (u === Ae)
577
+ return e;
578
+ var c = n.get(u), p = u in l;
579
+ if (c === void 0 && (!p || (h = lt(l, u)) != null && h.writable) && (c = f(() => {
580
+ var _ = ot(p ? l[u] : R), A = /* @__PURE__ */ be(_);
581
+ return A;
582
+ }), n.set(u, c)), c !== void 0) {
583
+ var d = F(c);
584
+ return d === R ? void 0 : d;
585
+ }
586
+ return Reflect.get(l, u, o);
587
+ },
588
+ getOwnPropertyDescriptor(l, u) {
589
+ var o = Reflect.getOwnPropertyDescriptor(l, u);
590
+ if (o && "value" in o) {
591
+ var c = n.get(u);
592
+ c && (o.value = F(c));
593
+ } else if (o === void 0) {
594
+ var p = n.get(u), d = p == null ? void 0 : p.v;
595
+ if (p !== void 0 && d !== R)
596
+ return {
597
+ enumerable: !0,
598
+ configurable: !0,
599
+ value: d,
600
+ writable: !0
601
+ };
602
+ }
603
+ return o;
604
+ },
605
+ has(l, u) {
606
+ var d;
607
+ if (u === Ae)
608
+ return !0;
609
+ var o = n.get(u), c = o !== void 0 && o.v !== R || Reflect.has(l, u);
610
+ if (o !== void 0 || y !== null && (!c || (d = lt(l, u)) != null && d.writable)) {
611
+ o === void 0 && (o = f(() => {
612
+ var h = c ? ot(l[u]) : R, _ = /* @__PURE__ */ be(h);
613
+ return _;
614
+ }), n.set(u, o));
615
+ var p = F(o);
616
+ if (p === R)
617
+ return !1;
618
+ }
619
+ return c;
620
+ },
621
+ set(l, u, o, c) {
622
+ var kn;
623
+ var p = n.get(u), d = u in l;
624
+ if (r && u === "length")
625
+ for (var h = o; h < /** @type {Source<number>} */
626
+ p.v; h += 1) {
627
+ var _ = n.get(h + "");
628
+ _ !== void 0 ? ee(_, R) : h in l && (_ = f(() => /* @__PURE__ */ be(R)), n.set(h + "", _));
629
+ }
630
+ if (p === void 0)
631
+ (!d || (kn = lt(l, u)) != null && kn.writable) && (p = f(() => /* @__PURE__ */ be(void 0)), ee(p, ot(o)), n.set(u, p));
632
+ else {
633
+ d = p.v !== R;
634
+ var A = f(() => ot(o));
635
+ ee(p, A);
636
+ }
637
+ var S = Reflect.getOwnPropertyDescriptor(l, u);
638
+ if (S != null && S.set && S.set.call(c, o), !d) {
639
+ if (r && typeof u == "string") {
640
+ var it = (
641
+ /** @type {Source<number>} */
642
+ n.get("length")
643
+ ), at = Number(u);
644
+ Number.isInteger(at) && at >= it.v && ee(it, at + 1);
645
+ }
646
+ _t(s);
647
+ }
648
+ return !0;
649
+ },
650
+ ownKeys(l) {
651
+ F(s);
652
+ var u = Reflect.ownKeys(l).filter((p) => {
653
+ var d = n.get(p);
654
+ return d === void 0 || d.v !== R;
655
+ });
656
+ for (var [o, c] of n)
657
+ c.v !== R && !(o in l) && u.push(o);
658
+ return u;
659
+ },
660
+ setPrototypeOf() {
661
+ Jr();
662
+ }
663
+ }
664
+ );
665
+ }
666
+ function tt(e) {
667
+ try {
668
+ if (e !== null && typeof e == "object" && Ae in e)
669
+ return e[Ae];
670
+ } catch {
671
+ }
672
+ return e;
673
+ }
674
+ function wa(e, t) {
675
+ return Object.is(tt(e), tt(t));
676
+ }
677
+ function ya(e, t, n = !0) {
678
+ try {
679
+ e === t != (tt(e) === tt(t)) && Qn(n ? "===" : "!==");
680
+ } catch {
681
+ }
682
+ return e === t === n;
683
+ }
684
+ function ba(e, t, n = !0) {
685
+ return e == t != (tt(e) == tt(t)) && Qn(), e == t === n;
686
+ }
687
+ var Mn, gs, ms, er, tr;
688
+ function ga() {
689
+ if (Mn === void 0) {
690
+ Mn = window, gs = document, ms = /Firefox/.test(navigator.userAgent);
691
+ var e = Element.prototype, t = Node.prototype, n = Text.prototype;
692
+ er = lt(t, "firstChild").get, tr = lt(t, "nextSibling").get, On(e) && (e.__click = void 0, e.__className = void 0, e.__attributes = null, e.__style = void 0, e.__e = void 0), On(n) && (n.__t = void 0);
693
+ }
694
+ }
695
+ function vt(e = "") {
696
+ return document.createTextNode(e);
697
+ }
698
+ // @__NO_SIDE_EFFECTS__
699
+ function Pt(e) {
700
+ return (
701
+ /** @type {TemplateNode | null} */
702
+ er.call(e)
703
+ );
704
+ }
705
+ // @__NO_SIDE_EFFECTS__
706
+ function Oe(e) {
707
+ return (
708
+ /** @type {TemplateNode | null} */
709
+ tr.call(e)
710
+ );
711
+ }
712
+ function ma(e, t) {
713
+ if (!U)
714
+ return /* @__PURE__ */ Pt(e);
715
+ var n = /* @__PURE__ */ Pt(k);
716
+ if (n === null)
717
+ n = k.appendChild(vt());
718
+ else if (t && n.nodeType !== Yt) {
719
+ var r = vt();
720
+ return n == null || n.before(r), ke(r), r;
721
+ }
722
+ return t && _n(
723
+ /** @type {Text} */
724
+ n
725
+ ), ke(n), n;
726
+ }
727
+ function Ea(e, t = !1) {
728
+ if (!U) {
729
+ var n = /* @__PURE__ */ Pt(e);
730
+ return n instanceof Comment && n.data === "" ? /* @__PURE__ */ Oe(n) : n;
731
+ }
732
+ if (t) {
733
+ if ((k == null ? void 0 : k.nodeType) !== Yt) {
734
+ var r = vt();
735
+ return k == null || k.before(r), ke(r), r;
736
+ }
737
+ _n(
738
+ /** @type {Text} */
739
+ k
740
+ );
741
+ }
742
+ return k;
743
+ }
744
+ function Ta(e, t = 1, n = !1) {
745
+ let r = U ? k : e;
746
+ for (var s; t--; )
747
+ s = r, r = /** @type {TemplateNode} */
748
+ /* @__PURE__ */ Oe(r);
749
+ if (!U)
750
+ return r;
751
+ if (n) {
752
+ if ((r == null ? void 0 : r.nodeType) !== Yt) {
753
+ var i = vt();
754
+ return r === null ? s == null || s.after(i) : r.before(i), ke(i), i;
755
+ }
756
+ _n(
757
+ /** @type {Text} */
758
+ r
759
+ );
760
+ }
761
+ return ke(r), r;
762
+ }
763
+ function Es(e) {
764
+ e.textContent = "";
765
+ }
766
+ function Aa() {
767
+ return !1;
768
+ }
769
+ function Sa(e, t, n) {
770
+ let r = n ? { is: n } : void 0;
771
+ return (
772
+ /** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */
773
+ document.createElementNS(t ?? rs, e, r)
774
+ );
775
+ }
776
+ function ka() {
777
+ return document.createDocumentFragment();
778
+ }
779
+ function xa(e = "") {
780
+ return document.createComment(e);
781
+ }
782
+ function Oa(e, t, n = "") {
783
+ if (t.startsWith("xlink:")) {
784
+ e.setAttributeNS("http://www.w3.org/1999/xlink", t, n);
785
+ return;
786
+ }
787
+ return e.setAttribute(t, n);
788
+ }
789
+ function _n(e) {
790
+ if (
791
+ /** @type {string} */
792
+ e.nodeValue.length < 65536
793
+ )
794
+ return;
795
+ let t = e.nextSibling;
796
+ for (; t !== null && t.nodeType === Yt; )
797
+ t.remove(), e.nodeValue += /** @type {string} */
798
+ t.nodeValue, t = e.nextSibling;
799
+ }
800
+ function nr(e) {
801
+ var t = y;
802
+ if (t === null)
803
+ return w.f |= Te, e;
804
+ if ((t.f & Ye) === 0 && (t.f & je) === 0)
805
+ throw e;
806
+ we(e, t);
807
+ }
808
+ function we(e, t) {
809
+ for (; t !== null; ) {
810
+ if ((t.f & Jt) !== 0) {
811
+ if ((t.f & Ye) === 0)
812
+ throw e;
813
+ try {
814
+ t.b.error(e);
815
+ return;
816
+ } catch (n) {
817
+ e = n;
818
+ }
819
+ }
820
+ t = t.parent;
821
+ }
822
+ throw e;
823
+ }
824
+ const Ts = -7169;
825
+ function T(e, t) {
826
+ e.f = e.f & Ts | t;
827
+ }
828
+ function dn(e) {
829
+ (e.f & V) !== 0 || e.deps === null ? T(e, O) : T(e, re);
830
+ }
831
+ function rr(e) {
832
+ if (e !== null)
833
+ for (const t of e)
834
+ (t.f & C) === 0 || (t.f & qe) === 0 || (t.f ^= qe, rr(
835
+ /** @type {Derived} */
836
+ t.deps
837
+ ));
838
+ }
839
+ function sr(e, t, n) {
840
+ (e.f & I) !== 0 ? t.add(e) : (e.f & re) !== 0 && n.add(e), rr(e.deps), T(e, O);
841
+ }
842
+ function hn(e, t, n) {
4
843
  if (e == null)
5
- return r(void 0), n && n(void 0), l;
6
- const t = w(
844
+ return t(void 0), n && n(void 0), fe;
845
+ const r = $e(
7
846
  () => e.subscribe(
8
- r,
847
+ t,
9
848
  // @ts-expect-error
10
849
  n
11
850
  )
12
851
  );
13
- return t.unsubscribe ? () => t.unsubscribe() : t;
852
+ return r.unsubscribe ? () => r.unsubscribe() : r;
14
853
  }
15
- const b = [];
16
- function x(e, r) {
854
+ const ze = [];
855
+ function ir(e, t) {
17
856
  return {
18
- subscribe: v(e, r).subscribe
857
+ subscribe: vn(e, t).subscribe
19
858
  };
20
859
  }
21
- function v(e, r = l) {
860
+ function vn(e, t = fe) {
22
861
  let n = null;
23
- const t = /* @__PURE__ */ new Set();
24
- function i(u) {
25
- if (B(e, u) && (e = u, n)) {
26
- const a = !b.length;
27
- for (const s of t)
28
- s[1](), b.push(s, e);
29
- if (a) {
30
- for (let s = 0; s < b.length; s += 2)
31
- b[s][0](b[s + 1]);
32
- b.length = 0;
862
+ const r = /* @__PURE__ */ new Set();
863
+ function s(l) {
864
+ if (Vn(e, l) && (e = l, n)) {
865
+ const u = !ze.length;
866
+ for (const o of r)
867
+ o[1](), ze.push(o, e);
868
+ if (u) {
869
+ for (let o = 0; o < ze.length; o += 2)
870
+ ze[o][0](ze[o + 1]);
871
+ ze.length = 0;
33
872
  }
34
873
  }
35
874
  }
36
- function c(u) {
37
- i(u(
875
+ function i(l) {
876
+ s(l(
38
877
  /** @type {T} */
39
878
  e
40
879
  ));
41
880
  }
42
- function o(u, a = l) {
43
- const s = [u, a];
44
- return t.add(s), t.size === 1 && (n = r(i, c) || l), u(
881
+ function f(l, u = fe) {
882
+ const o = [l, u];
883
+ return r.add(o), r.size === 1 && (n = t(s, i) || fe), l(
45
884
  /** @type {T} */
46
885
  e
47
886
  ), () => {
48
- t.delete(s), t.size === 0 && n && (n(), n = null);
887
+ r.delete(o), r.size === 0 && n && (n(), n = null);
49
888
  };
50
889
  }
51
- return { set: i, update: c, subscribe: o };
890
+ return { set: s, update: i, subscribe: f };
52
891
  }
53
- function D(e, r, n) {
54
- const t = !Array.isArray(e), i = t ? [e] : e;
55
- if (!i.every(Boolean))
892
+ function As(e, t, n) {
893
+ const r = !Array.isArray(e), s = r ? [e] : e;
894
+ if (!s.every(Boolean))
56
895
  throw new Error("derived() expects stores as input, got a falsy value");
57
- const c = r.length < 2;
58
- return x(n, (o, u) => {
59
- let a = !1;
60
- const s = [];
61
- let d = 0, _ = l;
62
- const g = () => {
63
- if (d)
896
+ const i = t.length < 2;
897
+ return ir(n, (f, l) => {
898
+ let u = !1;
899
+ const o = [];
900
+ let c = 0, p = fe;
901
+ const d = () => {
902
+ if (c)
64
903
  return;
65
- _();
66
- const f = r(t ? s[0] : s, o, u);
67
- c ? o(f) : _ = typeof f == "function" ? f : l;
68
- }, A = i.map(
69
- (f, p) => q(
70
- f,
71
- (O) => {
72
- s[p] = O, d &= ~(1 << p), a && g();
904
+ p();
905
+ const _ = t(r ? o[0] : o, f, l);
906
+ i ? f(_) : p = typeof _ == "function" ? _ : fe;
907
+ }, h = s.map(
908
+ (_, A) => hn(
909
+ _,
910
+ (S) => {
911
+ o[A] = S, c &= ~(1 << A), u && d();
73
912
  },
74
913
  () => {
75
- d |= 1 << p;
914
+ c |= 1 << A;
76
915
  }
77
916
  )
78
917
  );
79
- return a = !0, g(), function() {
80
- C(A), _(), a = !1;
918
+ return u = !0, d(), function() {
919
+ Yn(h), p(), u = !1;
81
920
  };
82
921
  });
83
922
  }
84
- function F(e) {
923
+ function Ss(e) {
85
924
  return {
86
925
  // @ts-expect-error TODO i suspect the bind is unnecessary
87
926
  subscribe: e.subscribe.bind(e)
88
927
  };
89
928
  }
90
- function z(e) {
91
- let r;
92
- return q(e, (n) => r = n)(), r;
929
+ function pn(e) {
930
+ let t;
931
+ return hn(e, (n) => t = n)(), t;
932
+ }
933
+ let Qt = !1, ft = !1, en = Symbol();
934
+ function Na(e, t, n) {
935
+ const r = n[t] ?? (n[t] = {
936
+ store: null,
937
+ source: /* @__PURE__ */ Fs(void 0),
938
+ unsubscribe: fe
939
+ });
940
+ if (r.store !== e && !(en in n))
941
+ if (r.unsubscribe(), r.store = e ?? null, e == null)
942
+ r.source.v = void 0, r.unsubscribe = fe;
943
+ else {
944
+ var s = !0;
945
+ r.unsubscribe = hn(e, (i) => {
946
+ s ? r.source.v = i : ee(r.source, i);
947
+ }), s = !1;
948
+ }
949
+ return e && en in n ? pn(e) : F(r.source);
93
950
  }
94
- function G(e) {
95
- E(e, e.v + 1);
951
+ function Ra(e, t, n) {
952
+ let r = n[t];
953
+ return r && r.store !== e && (r.unsubscribe(), r.unsubscribe = fe), e;
96
954
  }
97
- function H(e) {
98
- let r = 0, n = P(0), t;
99
- return () => {
100
- j() && (M(n), k(() => (r === 0 && (t = w(() => e(() => G(n)))), r += 1, () => {
101
- T().then(() => {
102
- r -= 1, r === 0 && (t == null || t(), t = void 0);
955
+ function ks(e, t) {
956
+ return Bt(e, t), t;
957
+ }
958
+ function Ma(e, t) {
959
+ var n = e[t];
960
+ n.store !== null && ks(n.store, n.source.v);
961
+ }
962
+ function Ca() {
963
+ const e = {};
964
+ function t() {
965
+ An(() => {
966
+ for (var n in e)
967
+ e[n].unsubscribe();
968
+ Xt(e, en, {
969
+ enumerable: !1,
970
+ value: !0
103
971
  });
104
- })));
105
- };
972
+ });
973
+ }
974
+ return [e, t];
975
+ }
976
+ function Bt(e, t) {
977
+ Qt = !0;
978
+ try {
979
+ e.set(t);
980
+ } finally {
981
+ Qt = !1;
982
+ }
983
+ }
984
+ function Ia(e, t, n) {
985
+ return Bt(e, n), t;
986
+ }
987
+ function Da(e, t, n = 1) {
988
+ return Bt(e, t + n), t;
989
+ }
990
+ function Pa(e, t, n = 1) {
991
+ const r = t + n;
992
+ return Bt(e, r), r;
993
+ }
994
+ function La() {
995
+ ft = !0;
106
996
  }
107
- function I(e, r) {
108
- var n = S, t = h, i = e();
109
- const c = v(i, (o) => {
110
- var u = i !== e(), a, s = h, d = S;
111
- y(t), m(n);
997
+ function Fa(e) {
998
+ var t = ft;
999
+ try {
1000
+ return ft = !1, [e(), ft];
1001
+ } finally {
1002
+ ft = t;
1003
+ }
1004
+ }
1005
+ const _e = /* @__PURE__ */ new Set();
1006
+ let v = null, x = null, tn = null, ut = !1, Wt = !1, Ge = null, kt = null;
1007
+ var Cn = 0;
1008
+ let xs = 1;
1009
+ var Ve, Ke, Ce, de, ie, yt, H, bt, me, he, ae, We, Xe, Ie, N, xt, ar, Ot, nn, Nt, Os;
1010
+ const Ht = class Ht {
1011
+ constructor() {
1012
+ g(this, N);
1013
+ se(this, "id", xs++);
1014
+ /**
1015
+ * The current values of any signals that are updated in this batch.
1016
+ * Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment)
1017
+ * They keys of this map are identical to `this.#previous`
1018
+ * @type {Map<Value, [any, boolean]>}
1019
+ */
1020
+ se(this, "current", /* @__PURE__ */ new Map());
1021
+ /**
1022
+ * The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place.
1023
+ * They keys of this map are identical to `this.#current`
1024
+ * @type {Map<Value, any>}
1025
+ */
1026
+ se(this, "previous", /* @__PURE__ */ new Map());
1027
+ /**
1028
+ * When the batch is committed (and the DOM is updated), we need to remove old branches
1029
+ * and append new ones by calling the functions added inside (if/each/key/etc) blocks
1030
+ * @type {Set<(batch: Batch) => void>}
1031
+ */
1032
+ g(this, Ve, /* @__PURE__ */ new Set());
1033
+ /**
1034
+ * If a fork is discarded, we need to destroy any effects that are no longer needed
1035
+ * @type {Set<(batch: Batch) => void>}
1036
+ */
1037
+ g(this, Ke, /* @__PURE__ */ new Set());
1038
+ /**
1039
+ * Callbacks that should run only when a fork is committed.
1040
+ * @type {Set<(batch: Batch) => void>}
1041
+ */
1042
+ g(this, Ce, /* @__PURE__ */ new Set());
1043
+ /**
1044
+ * Async effects that are currently in flight
1045
+ * @type {Map<Effect, number>}
1046
+ */
1047
+ g(this, de, /* @__PURE__ */ new Map());
1048
+ /**
1049
+ * Async effects that are currently in flight, _not_ inside a pending boundary
1050
+ * @type {Map<Effect, number>}
1051
+ */
1052
+ g(this, ie, /* @__PURE__ */ new Map());
1053
+ /**
1054
+ * A deferred that resolves when the batch is committed, used with `settled()`
1055
+ * TODO replace with Promise.withResolvers once supported widely enough
1056
+ * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
1057
+ */
1058
+ g(this, yt, null);
1059
+ /**
1060
+ * The root effects that need to be flushed
1061
+ * @type {Effect[]}
1062
+ */
1063
+ g(this, H, []);
1064
+ /**
1065
+ * Effects created while this batch was active.
1066
+ * @type {Effect[]}
1067
+ */
1068
+ g(this, bt, []);
1069
+ /**
1070
+ * Deferred effects (which run after async work has completed) that are DIRTY
1071
+ * @type {Set<Effect>}
1072
+ */
1073
+ g(this, me, /* @__PURE__ */ new Set());
1074
+ /**
1075
+ * Deferred effects that are MAYBE_DIRTY
1076
+ * @type {Set<Effect>}
1077
+ */
1078
+ g(this, he, /* @__PURE__ */ new Set());
1079
+ /**
1080
+ * A map of branches that still exist, but will be destroyed when this batch
1081
+ * is committed — we skip over these during `process`.
1082
+ * The value contains child effects that were dirty/maybe_dirty before being reset,
1083
+ * so they can be rescheduled if the branch survives.
1084
+ * @type {Map<Effect, { d: Effect[], m: Effect[] }>}
1085
+ */
1086
+ g(this, ae, /* @__PURE__ */ new Map());
1087
+ /**
1088
+ * Inverse of #skipped_branches which we need to tell prior batches to unskip them when committing
1089
+ * @type {Set<Effect>}
1090
+ */
1091
+ g(this, We, /* @__PURE__ */ new Set());
1092
+ se(this, "is_fork", !1);
1093
+ g(this, Xe, !1);
1094
+ /** @type {Set<Batch>} */
1095
+ g(this, Ie, /* @__PURE__ */ new Set());
1096
+ }
1097
+ /**
1098
+ * Add an effect to the #skipped_branches map and reset its children
1099
+ * @param {Effect} effect
1100
+ */
1101
+ skip_effect(t) {
1102
+ a(this, ae).has(t) || a(this, ae).set(t, { d: [], m: [] }), a(this, We).delete(t);
1103
+ }
1104
+ /**
1105
+ * Remove an effect from the #skipped_branches map and reschedule
1106
+ * any tracked dirty/maybe_dirty child effects
1107
+ * @param {Effect} effect
1108
+ * @param {(e: Effect) => void} callback
1109
+ */
1110
+ unskip_effect(t, n = (r) => this.schedule(r)) {
1111
+ var r = a(this, ae).get(t);
1112
+ if (r) {
1113
+ a(this, ae).delete(t);
1114
+ for (var s of r.d)
1115
+ T(s, I), n(s);
1116
+ for (s of r.m)
1117
+ T(s, re), n(s);
1118
+ }
1119
+ a(this, We).add(t);
1120
+ }
1121
+ /**
1122
+ * Associate a change to a given source with the current
1123
+ * batch, noting its previous and current values
1124
+ * @param {Value} source
1125
+ * @param {any} value
1126
+ * @param {boolean} [is_derived]
1127
+ */
1128
+ capture(t, n, r = !1) {
1129
+ t.v !== R && !this.previous.has(t) && this.previous.set(t, t.v), (t.f & Te) === 0 && (this.current.set(t, [n, r]), x == null || x.set(t, n)), this.is_fork || (t.v = n);
1130
+ }
1131
+ activate() {
1132
+ v = this;
1133
+ }
1134
+ deactivate() {
1135
+ v = null, x = null;
1136
+ }
1137
+ flush() {
112
1138
  try {
113
- a = $(() => {
114
- k(() => {
115
- const _ = e();
116
- u && o(_);
117
- });
118
- });
1139
+ Wt = !0, v = this, m(this, N, Ot).call(this);
119
1140
  } finally {
120
- y(s), m(d);
1141
+ Cn = 0, tn = null, Ge = null, kt = null, Wt = !1, v = null, x = null, Le.clear();
121
1142
  }
122
- return u = !0, a;
123
- });
124
- return r ? {
125
- set: r,
126
- update: (o) => r(o(e())),
127
- subscribe: c.subscribe
128
- } : {
129
- subscribe: c.subscribe
130
- };
1143
+ }
1144
+ discard() {
1145
+ for (const t of a(this, Ke)) t(this);
1146
+ a(this, Ke).clear(), a(this, Ce).clear(), _e.delete(this);
1147
+ }
1148
+ /**
1149
+ * @param {Effect} effect
1150
+ */
1151
+ register_created_effect(t) {
1152
+ a(this, bt).push(t);
1153
+ }
1154
+ /**
1155
+ * @param {boolean} blocking
1156
+ * @param {Effect} effect
1157
+ */
1158
+ increment(t, n) {
1159
+ let r = a(this, de).get(n) ?? 0;
1160
+ if (a(this, de).set(n, r + 1), t) {
1161
+ let s = a(this, ie).get(n) ?? 0;
1162
+ a(this, ie).set(n, s + 1);
1163
+ }
1164
+ }
1165
+ /**
1166
+ * @param {boolean} blocking
1167
+ * @param {Effect} effect
1168
+ * @param {boolean} skip - whether to skip updates (because this is triggered by a stale reaction)
1169
+ */
1170
+ decrement(t, n, r) {
1171
+ let s = a(this, de).get(n) ?? 0;
1172
+ if (s === 1 ? a(this, de).delete(n) : a(this, de).set(n, s - 1), t) {
1173
+ let i = a(this, ie).get(n) ?? 0;
1174
+ i === 1 ? a(this, ie).delete(n) : a(this, ie).set(n, i - 1);
1175
+ }
1176
+ a(this, Xe) || r || (b(this, Xe, !0), Se(() => {
1177
+ b(this, Xe, !1), this.flush();
1178
+ }));
1179
+ }
1180
+ /**
1181
+ * @param {Set<Effect>} dirty_effects
1182
+ * @param {Set<Effect>} maybe_dirty_effects
1183
+ */
1184
+ transfer_effects(t, n) {
1185
+ for (const r of t)
1186
+ a(this, me).add(r);
1187
+ for (const r of n)
1188
+ a(this, he).add(r);
1189
+ t.clear(), n.clear();
1190
+ }
1191
+ /** @param {(batch: Batch) => void} fn */
1192
+ oncommit(t) {
1193
+ a(this, Ve).add(t);
1194
+ }
1195
+ /** @param {(batch: Batch) => void} fn */
1196
+ ondiscard(t) {
1197
+ a(this, Ke).add(t);
1198
+ }
1199
+ /** @param {(batch: Batch) => void} fn */
1200
+ on_fork_commit(t) {
1201
+ a(this, Ce).add(t);
1202
+ }
1203
+ run_fork_commit_callbacks() {
1204
+ for (const t of a(this, Ce)) t(this);
1205
+ a(this, Ce).clear();
1206
+ }
1207
+ settled() {
1208
+ return (a(this, yt) ?? b(this, yt, Un())).promise;
1209
+ }
1210
+ static ensure() {
1211
+ if (v === null) {
1212
+ const t = v = new Ht();
1213
+ Wt || (_e.add(v), ut || Se(() => {
1214
+ v === t && t.flush();
1215
+ }));
1216
+ }
1217
+ return v;
1218
+ }
1219
+ apply() {
1220
+ {
1221
+ x = null;
1222
+ return;
1223
+ }
1224
+ }
1225
+ /**
1226
+ *
1227
+ * @param {Effect} effect
1228
+ */
1229
+ schedule(t) {
1230
+ var s;
1231
+ if (tn = t, (s = t.b) != null && s.is_pending && (t.f & (je | Tt | ln)) !== 0 && (t.f & Ye) === 0) {
1232
+ t.b.defer_effect(t);
1233
+ return;
1234
+ }
1235
+ for (var n = t; n.parent !== null; ) {
1236
+ n = n.parent;
1237
+ var r = n.f;
1238
+ if (Ge !== null && n === y && (w === null || (w.f & C) === 0) && !Qt)
1239
+ return;
1240
+ if ((r & (ye | ue)) !== 0) {
1241
+ if ((r & O) === 0)
1242
+ return;
1243
+ n.f ^= O;
1244
+ }
1245
+ }
1246
+ a(this, H).push(n);
1247
+ }
1248
+ };
1249
+ Ve = new WeakMap(), Ke = new WeakMap(), Ce = new WeakMap(), de = new WeakMap(), ie = new WeakMap(), yt = new WeakMap(), H = new WeakMap(), bt = new WeakMap(), me = new WeakMap(), he = new WeakMap(), ae = new WeakMap(), We = new WeakMap(), Xe = new WeakMap(), Ie = new WeakMap(), N = new WeakSet(), xt = function() {
1250
+ return this.is_fork || a(this, ie).size > 0;
1251
+ }, ar = function() {
1252
+ for (const r of a(this, Ie))
1253
+ for (const s of a(r, ie).keys()) {
1254
+ for (var t = !1, n = s; n.parent !== null; ) {
1255
+ if (a(this, ae).has(n)) {
1256
+ t = !0;
1257
+ break;
1258
+ }
1259
+ n = n.parent;
1260
+ }
1261
+ if (!t)
1262
+ return !0;
1263
+ }
1264
+ return !1;
1265
+ }, Ot = function() {
1266
+ var l, u;
1267
+ if (Cn++ > 1e3 && (_e.delete(this), Ns()), !m(this, N, xt).call(this)) {
1268
+ for (const o of a(this, me))
1269
+ a(this, he).delete(o), T(o, I), this.schedule(o);
1270
+ for (const o of a(this, he))
1271
+ T(o, re), this.schedule(o);
1272
+ }
1273
+ const t = a(this, H);
1274
+ b(this, H, []), this.apply();
1275
+ var n = Ge = [], r = [], s = kt = [];
1276
+ for (const o of t)
1277
+ try {
1278
+ m(this, N, nn).call(this, o, n, r);
1279
+ } catch (c) {
1280
+ throw ur(o), c;
1281
+ }
1282
+ if (v = null, s.length > 0) {
1283
+ var i = Ht.ensure();
1284
+ for (const o of s)
1285
+ i.schedule(o);
1286
+ }
1287
+ if (Ge = null, kt = null, m(this, N, xt).call(this) || m(this, N, ar).call(this)) {
1288
+ m(this, N, Nt).call(this, r), m(this, N, Nt).call(this, n);
1289
+ for (const [o, c] of a(this, ae))
1290
+ lr(o, c);
1291
+ } else {
1292
+ a(this, de).size === 0 && _e.delete(this), a(this, me).clear(), a(this, he).clear();
1293
+ for (const o of a(this, Ve)) o(this);
1294
+ a(this, Ve).clear(), In(r), In(n), (l = a(this, yt)) == null || l.resolve();
1295
+ }
1296
+ var f = (
1297
+ /** @type {Batch | null} */
1298
+ /** @type {unknown} */
1299
+ v
1300
+ );
1301
+ if (a(this, H).length > 0) {
1302
+ const o = f ?? (f = this);
1303
+ a(o, H).push(...a(this, H).filter((c) => !a(o, H).includes(c)));
1304
+ }
1305
+ f !== null && (_e.add(f), m(u = f, N, Ot).call(u));
1306
+ }, /**
1307
+ * Traverse the effect tree, executing effects or stashing
1308
+ * them for later execution as appropriate
1309
+ * @param {Effect} root
1310
+ * @param {Effect[]} effects
1311
+ * @param {Effect[]} render_effects
1312
+ */
1313
+ nn = function(t, n, r) {
1314
+ t.f ^= O;
1315
+ for (var s = t.first; s !== null; ) {
1316
+ var i = s.f, f = (i & (ue | ye)) !== 0, l = f && (i & O) !== 0, u = l || (i & K) !== 0 || a(this, ae).has(s);
1317
+ if (!u && s.fn !== null) {
1318
+ f ? s.f ^= O : (i & je) !== 0 ? n.push(s) : st(s) && ((i & le) !== 0 && a(this, he).add(s), He(s));
1319
+ var o = s.first;
1320
+ if (o !== null) {
1321
+ s = o;
1322
+ continue;
1323
+ }
1324
+ }
1325
+ for (; s !== null; ) {
1326
+ var c = s.next;
1327
+ if (c !== null) {
1328
+ s = c;
1329
+ break;
1330
+ }
1331
+ s = s.parent;
1332
+ }
1333
+ }
1334
+ }, /**
1335
+ * @param {Effect[]} effects
1336
+ */
1337
+ Nt = function(t) {
1338
+ for (var n = 0; n < t.length; n += 1)
1339
+ sr(t[n], a(this, me), a(this, he));
1340
+ }, Os = function() {
1341
+ var c, p, d;
1342
+ for (const h of _e) {
1343
+ var t = h.id < this.id, n = [];
1344
+ for (const [_, [A, S]] of this.current) {
1345
+ if (h.current.has(_)) {
1346
+ var r = (
1347
+ /** @type {[any, boolean]} */
1348
+ h.current.get(_)[0]
1349
+ );
1350
+ if (t && A !== r)
1351
+ h.current.set(_, [A, S]);
1352
+ else
1353
+ continue;
1354
+ }
1355
+ n.push(_);
1356
+ }
1357
+ var s = [...h.current.keys()].filter((_) => !this.current.has(_));
1358
+ if (s.length === 0)
1359
+ t && h.discard();
1360
+ else if (n.length > 0) {
1361
+ if (t)
1362
+ for (const _ of a(this, We))
1363
+ h.unskip_effect(_, (A) => {
1364
+ var S;
1365
+ (A.f & (le | Qe)) !== 0 ? h.schedule(A) : m(S = h, N, Nt).call(S, [A]);
1366
+ });
1367
+ h.activate();
1368
+ var i = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Map();
1369
+ for (var l of n)
1370
+ or(l, s, i, f);
1371
+ f = /* @__PURE__ */ new Map();
1372
+ var u = [...h.current.keys()].filter(
1373
+ (_) => this.current.has(_) ? (
1374
+ /** @type {[any, boolean]} */
1375
+ this.current.get(_)[0] !== _
1376
+ ) : !0
1377
+ );
1378
+ for (const _ of a(this, bt))
1379
+ (_.f & (W | K | ht)) === 0 && wn(_, u, f) && ((_.f & (Qe | le)) !== 0 ? (T(_, I), h.schedule(_)) : a(h, me).add(_));
1380
+ if (a(h, H).length > 0) {
1381
+ h.apply();
1382
+ for (var o of a(h, H))
1383
+ m(c = h, N, nn).call(c, o, [], []);
1384
+ b(h, H, []);
1385
+ }
1386
+ h.deactivate();
1387
+ }
1388
+ }
1389
+ for (const h of _e)
1390
+ a(h, Ie).has(this) && (a(h, Ie).delete(this), a(h, Ie).size === 0 && !m(p = h, N, xt).call(p) && (h.activate(), m(d = h, N, Ot).call(d)));
1391
+ };
1392
+ let ce = Ht;
1393
+ function Lt(e) {
1394
+ var t = ut;
1395
+ ut = !0;
1396
+ try {
1397
+ var n;
1398
+ for (e && (v !== null && !v.is_fork && v.flush(), n = e()); ; ) {
1399
+ if (hs(), v === null)
1400
+ return (
1401
+ /** @type {T} */
1402
+ n
1403
+ );
1404
+ v.flush();
1405
+ }
1406
+ } finally {
1407
+ ut = t;
1408
+ }
131
1409
  }
132
- function J(e) {
133
- let r;
134
- const n = H((i) => {
135
- let c = !1;
136
- const o = e.subscribe((u) => {
137
- r = u, c && i();
138
- });
139
- return c = !0, o;
140
- });
141
- function t() {
142
- return j() ? (n(), r) : z(e);
1410
+ function Ns() {
1411
+ try {
1412
+ Vr();
1413
+ } catch (e) {
1414
+ we(e, tn);
1415
+ }
1416
+ }
1417
+ let Q = null;
1418
+ function In(e) {
1419
+ var t = e.length;
1420
+ if (t !== 0) {
1421
+ for (var n = 0; n < t; ) {
1422
+ var r = e[n++];
1423
+ if ((r.f & (W | K)) === 0 && st(r) && (Q = /* @__PURE__ */ new Set(), He(r), r.deps === null && r.first === null && r.nodes === null && r.teardown === null && r.ac === null && Nr(r), (Q == null ? void 0 : Q.size) > 0)) {
1424
+ Le.clear();
1425
+ for (const s of Q) {
1426
+ if ((s.f & (W | K)) !== 0) continue;
1427
+ const i = [s];
1428
+ let f = s.parent;
1429
+ for (; f !== null; )
1430
+ Q.has(f) && (Q.delete(f), i.push(f)), f = f.parent;
1431
+ for (let l = i.length - 1; l >= 0; l--) {
1432
+ const u = i[l];
1433
+ (u.f & (W | K)) === 0 && He(u);
1434
+ }
1435
+ }
1436
+ Q.clear();
1437
+ }
1438
+ }
1439
+ Q = null;
1440
+ }
1441
+ }
1442
+ function or(e, t, n, r) {
1443
+ if (!n.has(e) && (n.add(e), e.reactions !== null))
1444
+ for (const s of e.reactions) {
1445
+ const i = s.f;
1446
+ (i & C) !== 0 ? or(
1447
+ /** @type {Derived} */
1448
+ s,
1449
+ t,
1450
+ n,
1451
+ r
1452
+ ) : (i & (Qe | le)) !== 0 && (i & I) === 0 && wn(s, t, r) && (T(s, I), yn(
1453
+ /** @type {Effect} */
1454
+ s
1455
+ ));
1456
+ }
1457
+ }
1458
+ function fr(e, t) {
1459
+ if (e.reactions !== null)
1460
+ for (const n of e.reactions) {
1461
+ const r = n.f;
1462
+ (r & C) !== 0 ? fr(
1463
+ /** @type {Derived} */
1464
+ n,
1465
+ t
1466
+ ) : (r & ht) !== 0 && (T(n, I), t.add(
1467
+ /** @type {Effect} */
1468
+ n
1469
+ ));
1470
+ }
1471
+ }
1472
+ function wn(e, t, n) {
1473
+ const r = n.get(e);
1474
+ if (r !== void 0) return r;
1475
+ if (e.deps !== null)
1476
+ for (const s of e.deps) {
1477
+ if (Ze.call(t, s))
1478
+ return !0;
1479
+ if ((s.f & C) !== 0 && wn(
1480
+ /** @type {Derived} */
1481
+ s,
1482
+ t,
1483
+ n
1484
+ ))
1485
+ return n.set(
1486
+ /** @type {Derived} */
1487
+ s,
1488
+ !0
1489
+ ), !0;
1490
+ }
1491
+ return n.set(e, !1), !1;
1492
+ }
1493
+ function yn(e) {
1494
+ v.schedule(e);
1495
+ }
1496
+ let Ft = [];
1497
+ function Rs() {
1498
+ Lt(() => {
1499
+ const e = Ft;
1500
+ Ft = [];
1501
+ for (const t of e)
1502
+ js(t);
1503
+ });
1504
+ }
1505
+ function ja(e) {
1506
+ var t = rt(0), n = !0, r = (
1507
+ /** @type {T} */
1508
+ void 0
1509
+ );
1510
+ return F(t), Bs(() => {
1511
+ if (n) {
1512
+ var s = x;
1513
+ try {
1514
+ x = null, r = e();
1515
+ } finally {
1516
+ x = s;
1517
+ }
1518
+ return;
1519
+ }
1520
+ Ft.length === 0 && Se(Rs), Ft.push(t);
1521
+ }), n = !1, r;
1522
+ }
1523
+ function lr(e, t) {
1524
+ if (!((e.f & ue) !== 0 && (e.f & O) !== 0)) {
1525
+ (e.f & I) !== 0 ? t.d.push(e) : (e.f & re) !== 0 && t.m.push(e), T(e, O);
1526
+ for (var n = e.first; n !== null; )
1527
+ lr(n, t), n = n.next;
1528
+ }
1529
+ }
1530
+ function ur(e) {
1531
+ T(e, O);
1532
+ for (var t = e.first; t !== null; )
1533
+ ur(t), t = t.next;
1534
+ }
1535
+ function qa(e) {
1536
+ qr(), v !== null && Wr();
1537
+ var t = ce.ensure();
1538
+ t.is_fork = !0, x = /* @__PURE__ */ new Map();
1539
+ var n = !1, r = t.settled();
1540
+ return Lt(e), {
1541
+ commit: async () => {
1542
+ if (n) {
1543
+ await r;
1544
+ return;
1545
+ }
1546
+ _e.has(t) || Kr(), n = !0, t.is_fork = !1;
1547
+ for (var [s, [i]] of t.current)
1548
+ s.v = i, s.wv = qt();
1549
+ t.activate(), t.run_fork_commit_callbacks(), t.deactivate(), Lt(() => {
1550
+ var f = /* @__PURE__ */ new Set();
1551
+ for (var l of t.current.keys())
1552
+ fr(l, f);
1553
+ Ls(f), yr();
1554
+ }), t.flush(), await r;
1555
+ },
1556
+ discard: () => {
1557
+ for (var s of t.current.keys())
1558
+ s.wv = qt();
1559
+ !n && _e.has(t) && t.discard();
1560
+ }
1561
+ };
1562
+ }
1563
+ function cr(e) {
1564
+ let t = 0, n = rt(0), r;
1565
+ return () => {
1566
+ At() && (F(n), Gt(() => (t === 0 && (r = $e(() => e(() => _t(n)))), t += 1, () => {
1567
+ Se(() => {
1568
+ t -= 1, t === 0 && (r == null || r(), r = void 0, _t(n));
1569
+ });
1570
+ })));
1571
+ };
1572
+ }
1573
+ var Ms = dt | Ue;
1574
+ function Ha(e, t, n, r) {
1575
+ new Cs(e, t, n, r);
1576
+ }
1577
+ var $, gt, z, De, P, G, D, Y, ve, Pe, Ee, Je, mt, Et, pe, $t, E, _r, dr, hr, rn, Rt, Mt, sn, an;
1578
+ class Cs {
1579
+ /**
1580
+ * @param {TemplateNode} node
1581
+ * @param {BoundaryProps} props
1582
+ * @param {((anchor: Node) => void)} children
1583
+ * @param {((error: unknown) => unknown) | undefined} [transform_error]
1584
+ */
1585
+ constructor(t, n, r, s) {
1586
+ g(this, E);
1587
+ /** @type {Boundary | null} */
1588
+ se(this, "parent");
1589
+ se(this, "is_pending", !1);
1590
+ /**
1591
+ * API-level transformError transform function. Transforms errors before they reach the `failed` snippet.
1592
+ * Inherited from parent boundary, or defaults to identity.
1593
+ * @type {(error: unknown) => unknown}
1594
+ */
1595
+ se(this, "transform_error");
1596
+ /** @type {TemplateNode} */
1597
+ g(this, $);
1598
+ /** @type {TemplateNode | null} */
1599
+ g(this, gt, U ? k : null);
1600
+ /** @type {BoundaryProps} */
1601
+ g(this, z);
1602
+ /** @type {((anchor: Node) => void)} */
1603
+ g(this, De);
1604
+ /** @type {Effect} */
1605
+ g(this, P);
1606
+ /** @type {Effect | null} */
1607
+ g(this, G, null);
1608
+ /** @type {Effect | null} */
1609
+ g(this, D, null);
1610
+ /** @type {Effect | null} */
1611
+ g(this, Y, null);
1612
+ /** @type {DocumentFragment | null} */
1613
+ g(this, ve, null);
1614
+ g(this, Pe, 0);
1615
+ g(this, Ee, 0);
1616
+ g(this, Je, !1);
1617
+ /** @type {Set<Effect>} */
1618
+ g(this, mt, /* @__PURE__ */ new Set());
1619
+ /** @type {Set<Effect>} */
1620
+ g(this, Et, /* @__PURE__ */ new Set());
1621
+ /**
1622
+ * A source containing the number of pending async deriveds/expressions.
1623
+ * Only created if `$effect.pending()` is used inside the boundary,
1624
+ * otherwise updating the source results in needless `Batch.ensure()`
1625
+ * calls followed by no-op flushes
1626
+ * @type {Source<number> | null}
1627
+ */
1628
+ g(this, pe, null);
1629
+ g(this, $t, cr(() => (b(this, pe, rt(a(this, Pe))), () => {
1630
+ b(this, pe, null);
1631
+ })));
1632
+ var i;
1633
+ b(this, $, t), b(this, z, n), b(this, De, (f) => {
1634
+ var l = (
1635
+ /** @type {Effect} */
1636
+ y
1637
+ );
1638
+ l.b = this, l.f |= Jt, r(f);
1639
+ }), this.parent = /** @type {Effect} */
1640
+ y.b, this.transform_error = s ?? ((i = this.parent) == null ? void 0 : i.transform_error) ?? ((f) => f), b(this, P, Vs(() => {
1641
+ if (U) {
1642
+ const f = (
1643
+ /** @type {Comment} */
1644
+ a(this, gt)
1645
+ );
1646
+ ws();
1647
+ const l = f.data === Wn;
1648
+ if (f.data.startsWith(Rn)) {
1649
+ const o = JSON.parse(f.data.slice(Rn.length));
1650
+ m(this, E, dr).call(this, o);
1651
+ } else l ? m(this, E, hr).call(this) : m(this, E, _r).call(this);
1652
+ } else
1653
+ m(this, E, rn).call(this);
1654
+ }, Ms)), U && b(this, $, k);
1655
+ }
1656
+ /**
1657
+ * Defer an effect inside a pending boundary until the boundary resolves
1658
+ * @param {Effect} effect
1659
+ */
1660
+ defer_effect(t) {
1661
+ sr(t, a(this, mt), a(this, Et));
1662
+ }
1663
+ /**
1664
+ * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
1665
+ * @returns {boolean}
1666
+ */
1667
+ is_rendered() {
1668
+ return !this.is_pending && (!this.parent || this.parent.is_rendered());
1669
+ }
1670
+ has_pending_snippet() {
1671
+ return !!a(this, z).pending;
1672
+ }
1673
+ /**
1674
+ * Update the source that powers `$effect.pending()` inside this boundary,
1675
+ * and controls when the current `pending` snippet (if any) is removed.
1676
+ * Do not call from inside the class
1677
+ * @param {1 | -1} d
1678
+ * @param {Batch} batch
1679
+ */
1680
+ update_pending_count(t, n) {
1681
+ m(this, E, sn).call(this, t, n), b(this, Pe, a(this, Pe) + t), !(!a(this, pe) || a(this, Je)) && (b(this, Je, !0), Se(() => {
1682
+ b(this, Je, !1), a(this, pe) && pt(a(this, pe), a(this, Pe));
1683
+ }));
1684
+ }
1685
+ get_effect_pending() {
1686
+ return a(this, $t).call(this), F(
1687
+ /** @type {Source<number>} */
1688
+ a(this, pe)
1689
+ );
1690
+ }
1691
+ /** @param {unknown} error */
1692
+ error(t) {
1693
+ if (!a(this, z).onerror && !a(this, z).failed)
1694
+ throw t;
1695
+ v != null && v.is_fork ? (a(this, G) && v.skip_effect(a(this, G)), a(this, D) && v.skip_effect(a(this, D)), a(this, Y) && v.skip_effect(a(this, Y)), v.on_fork_commit(() => {
1696
+ m(this, E, an).call(this, t);
1697
+ })) : m(this, E, an).call(this, t);
1698
+ }
1699
+ }
1700
+ $ = new WeakMap(), gt = new WeakMap(), z = new WeakMap(), De = new WeakMap(), P = new WeakMap(), G = new WeakMap(), D = new WeakMap(), Y = new WeakMap(), ve = new WeakMap(), Pe = new WeakMap(), Ee = new WeakMap(), Je = new WeakMap(), mt = new WeakMap(), Et = new WeakMap(), pe = new WeakMap(), $t = new WeakMap(), E = new WeakSet(), _r = function() {
1701
+ try {
1702
+ b(this, G, Ne(() => a(this, De).call(this, a(this, $))));
1703
+ } catch (t) {
1704
+ this.error(t);
1705
+ }
1706
+ }, /**
1707
+ * @param {unknown} error The deserialized error from the server's hydration comment
1708
+ */
1709
+ dr = function(t) {
1710
+ const n = a(this, z).failed;
1711
+ n && b(this, Y, Ne(() => {
1712
+ n(
1713
+ a(this, $),
1714
+ () => t,
1715
+ () => () => {
1716
+ }
1717
+ );
1718
+ }));
1719
+ }, hr = function() {
1720
+ const t = a(this, z).pending;
1721
+ t && (this.is_pending = !0, b(this, D, Ne(() => t(a(this, $)))), Se(() => {
1722
+ var n = b(this, ve, document.createDocumentFragment()), r = vt();
1723
+ n.append(r), b(this, G, m(this, E, Mt).call(this, () => Ne(() => a(this, De).call(this, r)))), a(this, Ee) === 0 && (a(this, $).before(n), b(this, ve, null), Dt(
1724
+ /** @type {Effect} */
1725
+ a(this, D),
1726
+ () => {
1727
+ b(this, D, null);
1728
+ }
1729
+ ), m(this, E, Rt).call(
1730
+ this,
1731
+ /** @type {Batch} */
1732
+ v
1733
+ ));
1734
+ }));
1735
+ }, rn = function() {
1736
+ try {
1737
+ if (this.is_pending = this.has_pending_snippet(), b(this, Ee, 0), b(this, Pe, 0), b(this, G, Ne(() => {
1738
+ a(this, De).call(this, a(this, $));
1739
+ })), a(this, Ee) > 0) {
1740
+ var t = b(this, ve, document.createDocumentFragment());
1741
+ Xs(a(this, G), t);
1742
+ const n = (
1743
+ /** @type {(anchor: Node) => void} */
1744
+ a(this, z).pending
1745
+ );
1746
+ b(this, D, Ne(() => n(a(this, $))));
1747
+ } else
1748
+ m(this, E, Rt).call(
1749
+ this,
1750
+ /** @type {Batch} */
1751
+ v
1752
+ );
1753
+ } catch (n) {
1754
+ this.error(n);
1755
+ }
1756
+ }, /**
1757
+ * @param {Batch} batch
1758
+ */
1759
+ Rt = function(t) {
1760
+ this.is_pending = !1, t.transfer_effects(a(this, mt), a(this, Et));
1761
+ }, /**
1762
+ * @template T
1763
+ * @param {() => T} fn
1764
+ */
1765
+ Mt = function(t) {
1766
+ var n = y, r = w, s = M;
1767
+ Z(a(this, P)), J(a(this, P)), et(a(this, P).ctx);
1768
+ try {
1769
+ return ce.ensure(), t();
1770
+ } catch (i) {
1771
+ return nr(i), null;
1772
+ } finally {
1773
+ Z(n), J(r), et(s);
1774
+ }
1775
+ }, /**
1776
+ * Updates the pending count associated with the currently visible pending snippet,
1777
+ * if any, such that we can replace the snippet with content once work is done
1778
+ * @param {1 | -1} d
1779
+ * @param {Batch} batch
1780
+ */
1781
+ sn = function(t, n) {
1782
+ var r;
1783
+ if (!this.has_pending_snippet()) {
1784
+ this.parent && m(r = this.parent, E, sn).call(r, t, n);
1785
+ return;
1786
+ }
1787
+ b(this, Ee, a(this, Ee) + t), a(this, Ee) === 0 && (m(this, E, Rt).call(this, n), a(this, D) && Dt(a(this, D), () => {
1788
+ b(this, D, null);
1789
+ }), a(this, ve) && (a(this, $).before(a(this, ve)), b(this, ve, null)));
1790
+ }, /**
1791
+ * @param {unknown} error
1792
+ */
1793
+ an = function(t) {
1794
+ a(this, G) && (ne(a(this, G)), b(this, G, null)), a(this, D) && (ne(a(this, D)), b(this, D, null)), a(this, Y) && (ne(a(this, Y)), b(this, Y, null)), U && (ke(
1795
+ /** @type {TemplateNode} */
1796
+ a(this, gt)
1797
+ ), ys(), ke(bs()));
1798
+ var n = a(this, z).onerror;
1799
+ let r = a(this, z).failed;
1800
+ var s = !1, i = !1;
1801
+ const f = () => {
1802
+ if (s) {
1803
+ ps();
1804
+ return;
1805
+ }
1806
+ s = !0, i && Qr(), a(this, Y) !== null && Dt(a(this, Y), () => {
1807
+ b(this, Y, null);
1808
+ }), m(this, E, Mt).call(this, () => {
1809
+ m(this, E, rn).call(this);
1810
+ });
1811
+ }, l = (u) => {
1812
+ try {
1813
+ i = !0, n == null || n(u, f), i = !1;
1814
+ } catch (o) {
1815
+ we(o, a(this, P) && a(this, P).parent);
1816
+ }
1817
+ r && b(this, Y, m(this, E, Mt).call(this, () => {
1818
+ try {
1819
+ return Ne(() => {
1820
+ var o = (
1821
+ /** @type {Effect} */
1822
+ y
1823
+ );
1824
+ o.b = this, o.f |= Jt, r(
1825
+ a(this, $),
1826
+ () => u,
1827
+ () => f
1828
+ );
1829
+ });
1830
+ } catch (o) {
1831
+ return we(
1832
+ o,
1833
+ /** @type {Effect} */
1834
+ a(this, P).parent
1835
+ ), null;
1836
+ }
1837
+ }));
1838
+ };
1839
+ Se(() => {
1840
+ var u;
1841
+ try {
1842
+ u = this.transform_error(t);
1843
+ } catch (o) {
1844
+ we(o, a(this, P) && a(this, P).parent);
1845
+ return;
1846
+ }
1847
+ u !== null && typeof u == "object" && typeof /** @type {any} */
1848
+ u.then == "function" ? u.then(
1849
+ l,
1850
+ /** @param {unknown} e */
1851
+ (o) => we(o, a(this, P) && a(this, P).parent)
1852
+ ) : l(u);
1853
+ });
1854
+ };
1855
+ function $a() {
1856
+ y === null && Gr();
1857
+ var e = y.b;
1858
+ return e === null ? 0 : e.get_effect_pending();
1859
+ }
1860
+ function bn(e, t, n, r) {
1861
+ const s = mn;
1862
+ var i = e.filter((d) => !d.settled);
1863
+ if (n.length === 0 && i.length === 0) {
1864
+ r(t.map(s));
1865
+ return;
1866
+ }
1867
+ var f = (
1868
+ /** @type {Effect} */
1869
+ y
1870
+ ), l = gn(), u = i.length === 1 ? i[0].promise : i.length > 1 ? Promise.all(i.map((d) => d.promise)) : null;
1871
+ function o(d) {
1872
+ l();
1873
+ try {
1874
+ r(d);
1875
+ } catch (h) {
1876
+ (f.f & W) === 0 && we(h, f);
1877
+ }
1878
+ nt();
1879
+ }
1880
+ if (n.length === 0) {
1881
+ u.then(() => o(t.map(s)));
1882
+ return;
1883
+ }
1884
+ var c = zt();
1885
+ function p() {
1886
+ Promise.all(n.map((d) => /* @__PURE__ */ Is(d))).then((d) => o([...t.map(s), ...d])).catch((d) => we(d, f)).finally(() => c());
1887
+ }
1888
+ u ? u.then(() => {
1889
+ l(), p(), nt();
1890
+ }) : p();
1891
+ }
1892
+ function Ya(e, t) {
1893
+ bn(e, [], [], t);
1894
+ }
1895
+ function gn() {
1896
+ var e = (
1897
+ /** @type {Effect} */
1898
+ y
1899
+ ), t = w, n = M, r = (
1900
+ /** @type {Batch} */
1901
+ v
1902
+ );
1903
+ return function(i = !0) {
1904
+ Z(e), J(t), et(n), i && (e.f & W) === 0 && (r == null || r.activate(), r == null || r.apply());
1905
+ };
1906
+ }
1907
+ async function Ua(e) {
1908
+ var t = gn(), n = await e;
1909
+ return () => (t(), n);
1910
+ }
1911
+ async function Dn(e) {
1912
+ var t = ct;
1913
+ queueMicrotask(() => {
1914
+ ct === t && Ct(null);
1915
+ });
1916
+ var n = await e;
1917
+ return () => (Ct(t), queueMicrotask(() => {
1918
+ ct === t && Ct(null);
1919
+ }), n);
1920
+ }
1921
+ async function* Ba(e) {
1922
+ var s, i;
1923
+ const t = ((s = e[Symbol.asyncIterator]) == null ? void 0 : s.call(e)) ?? ((i = e[Symbol.iterator]) == null ? void 0 : i.call(e));
1924
+ if (t === void 0)
1925
+ throw new TypeError("value is not async iterable");
1926
+ let n = !1;
1927
+ try {
1928
+ for (; ; ) {
1929
+ const { done: f, value: l } = (await Dn(t.next()))();
1930
+ if (f) {
1931
+ n = !0;
1932
+ break;
1933
+ }
1934
+ var r = ct;
1935
+ yield l, Ct(r);
1936
+ }
1937
+ } finally {
1938
+ if (!n && t.return !== void 0)
1939
+ return (
1940
+ /** @type {TReturn} */
1941
+ (await Dn(t.return()))().value
1942
+ );
1943
+ }
1944
+ }
1945
+ function nt(e = !0) {
1946
+ Z(null), J(null), et(null), e && (v == null || v.deactivate());
1947
+ }
1948
+ function za(e) {
1949
+ const t = gn(), n = zt();
1950
+ var r = (
1951
+ /** @type {Effect} */
1952
+ y
1953
+ ), s = null;
1954
+ const i = (o) => {
1955
+ s = { error: o }, jn(r) || we(o, r);
1956
+ };
1957
+ var f = Promise.resolve(e[0]()).catch(i), l = { promise: f, settled: !1 }, u = [l];
1958
+ f.finally(() => {
1959
+ l.settled = !0, nt();
1960
+ });
1961
+ for (const o of e.slice(1)) {
1962
+ f = f.then(() => {
1963
+ if (t(), s)
1964
+ throw s.error;
1965
+ if (jn(r))
1966
+ throw oe;
1967
+ return o();
1968
+ }).catch(i);
1969
+ const c = { promise: f, settled: !1 };
1970
+ u.push(c), f.finally(() => {
1971
+ c.settled = !0, nt();
1972
+ });
1973
+ }
1974
+ return f.then(() => Promise.resolve()).finally(() => n()), u;
1975
+ }
1976
+ function Ga(e) {
1977
+ return Promise.all(e.map((t) => t.promise));
1978
+ }
1979
+ function zt() {
1980
+ var e = (
1981
+ /** @type {Effect} */
1982
+ y
1983
+ ), t = (
1984
+ /** @type {Boundary} */
1985
+ e.b
1986
+ ), n = (
1987
+ /** @type {Batch} */
1988
+ v
1989
+ ), r = t.is_rendered();
1990
+ return t.update_pending_count(1, n), n.increment(r, e), (s = !1) => {
1991
+ t.update_pending_count(-1, n), n.decrement(r, e, s);
1992
+ };
1993
+ }
1994
+ let ct = null;
1995
+ function Ct(e) {
1996
+ ct = e;
1997
+ }
1998
+ // @__NO_SIDE_EFFECTS__
1999
+ function mn(e) {
2000
+ var t = C | I;
2001
+ return y !== null && (y.f |= Ue), {
2002
+ ctx: M,
2003
+ deps: null,
2004
+ effects: null,
2005
+ equals: Gn,
2006
+ f: t,
2007
+ fn: e,
2008
+ reactions: null,
2009
+ rv: 0,
2010
+ v: (
2011
+ /** @type {V} */
2012
+ R
2013
+ ),
2014
+ wv: 0,
2015
+ parent: y,
2016
+ ac: null
2017
+ };
2018
+ }
2019
+ // @__NO_SIDE_EFFECTS__
2020
+ function Is(e, t, n) {
2021
+ let r = (
2022
+ /** @type {Effect | null} */
2023
+ y
2024
+ );
2025
+ r === null && Yr();
2026
+ var s = (
2027
+ /** @type {Promise<V>} */
2028
+ /** @type {unknown} */
2029
+ void 0
2030
+ ), i = rt(
2031
+ /** @type {V} */
2032
+ R
2033
+ ), f = !w, l = /* @__PURE__ */ new Map();
2034
+ return Gs(() => {
2035
+ var h;
2036
+ var u = (
2037
+ /** @type {Effect} */
2038
+ y
2039
+ ), o = Un();
2040
+ s = o.promise;
2041
+ try {
2042
+ Promise.resolve(e()).then(o.resolve, o.reject).finally(nt);
2043
+ } catch (_) {
2044
+ o.reject(_), nt();
2045
+ }
2046
+ var c = (
2047
+ /** @type {Batch} */
2048
+ v
2049
+ );
2050
+ if (f) {
2051
+ if ((u.f & Ye) !== 0)
2052
+ var p = zt();
2053
+ if (
2054
+ /** @type {Boundary} */
2055
+ r.b.is_rendered()
2056
+ )
2057
+ (h = l.get(c)) == null || h.reject(oe), l.delete(c);
2058
+ else {
2059
+ for (const _ of l.values())
2060
+ _.reject(oe);
2061
+ l.clear();
2062
+ }
2063
+ l.set(c, o);
2064
+ }
2065
+ const d = (_, A = void 0) => {
2066
+ if (p) {
2067
+ var S = A === oe;
2068
+ p(S);
2069
+ }
2070
+ if (!(A === oe || (u.f & W) !== 0)) {
2071
+ if (c.activate(), A)
2072
+ i.f |= Te, pt(i, A);
2073
+ else {
2074
+ (i.f & Te) !== 0 && (i.f ^= Te), pt(i, _);
2075
+ for (const [it, at] of l) {
2076
+ if (l.delete(it), it === c) break;
2077
+ at.reject(oe);
2078
+ }
2079
+ }
2080
+ c.deactivate();
2081
+ }
2082
+ };
2083
+ o.promise.then(d, (_) => d(null, _ || "unknown"));
2084
+ }), An(() => {
2085
+ for (const u of l.values())
2086
+ u.reject(oe);
2087
+ }), new Promise((u) => {
2088
+ function o(c) {
2089
+ function p() {
2090
+ c === s ? u(i) : o(s);
2091
+ }
2092
+ c.then(p, p);
2093
+ }
2094
+ o(s);
2095
+ });
2096
+ }
2097
+ // @__NO_SIDE_EFFECTS__
2098
+ function Va(e) {
2099
+ const t = /* @__PURE__ */ mn(e);
2100
+ return gr(t), t;
2101
+ }
2102
+ // @__NO_SIDE_EFFECTS__
2103
+ function Ka(e) {
2104
+ const t = /* @__PURE__ */ mn(e);
2105
+ return t.equals = Kn, t;
2106
+ }
2107
+ function Ds(e) {
2108
+ var t = e.effects;
2109
+ if (t !== null) {
2110
+ e.effects = null;
2111
+ for (var n = 0; n < t.length; n += 1)
2112
+ ne(
2113
+ /** @type {Effect} */
2114
+ t[n]
2115
+ );
2116
+ }
2117
+ }
2118
+ function En(e) {
2119
+ var t, n = y, r = e.parent;
2120
+ if (!xe && r !== null && (r.f & (W | K)) !== 0)
2121
+ return vs(), e.v;
2122
+ Z(r);
2123
+ try {
2124
+ e.f &= ~qe, Ds(e), t = Tr(e);
2125
+ } finally {
2126
+ Z(n);
2127
+ }
2128
+ return t;
2129
+ }
2130
+ function vr(e) {
2131
+ var t = En(e);
2132
+ if (!e.equals(t) && (e.wv = qt(), (!(v != null && v.is_fork) || e.deps === null) && (v !== null ? v.capture(e, t, !0) : e.v = t, e.deps === null))) {
2133
+ T(e, O);
2134
+ return;
2135
+ }
2136
+ xe || (x !== null ? (At() || v != null && v.is_fork) && x.set(e, t) : dn(e));
2137
+ }
2138
+ function Ps(e) {
2139
+ var t, n;
2140
+ if (e.effects !== null)
2141
+ for (const r of e.effects)
2142
+ (r.teardown || r.ac) && ((t = r.teardown) == null || t.call(r), (n = r.ac) == null || n.abort(oe), r.teardown = fe, r.ac = null, wt(r, 0), Sn(r));
2143
+ }
2144
+ function pr(e) {
2145
+ if (e.effects !== null)
2146
+ for (const t of e.effects)
2147
+ t.teardown && He(t);
2148
+ }
2149
+ let jt = /* @__PURE__ */ new Set();
2150
+ const Le = /* @__PURE__ */ new Map();
2151
+ function Ls(e) {
2152
+ jt = e;
2153
+ }
2154
+ let wr = !1;
2155
+ function rt(e, t) {
2156
+ var n = {
2157
+ f: 0,
2158
+ // TODO ideally we could skip this altogether, but it causes type errors
2159
+ v: e,
2160
+ reactions: null,
2161
+ equals: Gn,
2162
+ rv: 0,
2163
+ wv: 0
2164
+ };
2165
+ return n;
2166
+ }
2167
+ // @__NO_SIDE_EFFECTS__
2168
+ function be(e, t) {
2169
+ const n = rt(e);
2170
+ return gr(n), n;
2171
+ }
2172
+ // @__NO_SIDE_EFFECTS__
2173
+ function Fs(e, t = !1, n = !0) {
2174
+ const r = rt(e);
2175
+ return t || (r.equals = Kn), r;
2176
+ }
2177
+ function Wa(e, t) {
2178
+ return ee(
2179
+ e,
2180
+ $e(() => F(e))
2181
+ ), t;
2182
+ }
2183
+ function ee(e, t, n = !1) {
2184
+ w !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
2185
+ // to ensure we error if state is set inside an inspect effect
2186
+ (!te || (w.f & ht) !== 0) && Jn() && (w.f & (C | le | Qe | ht)) !== 0 && (X === null || !Ze.call(X, e)) && Zr();
2187
+ let r = n ? ot(t) : t;
2188
+ return pt(e, r, kt);
2189
+ }
2190
+ function pt(e, t, n = null) {
2191
+ if (!e.equals(t)) {
2192
+ Le.set(e, xe ? t : e.v);
2193
+ var r = ce.ensure();
2194
+ if (r.capture(e, t), (e.f & C) !== 0) {
2195
+ const s = (
2196
+ /** @type {Derived} */
2197
+ e
2198
+ );
2199
+ (e.f & I) !== 0 && En(s), x === null && dn(s);
2200
+ }
2201
+ e.wv = qt(), br(e, I, n), y !== null && (y.f & O) !== 0 && (y.f & (ue | ye)) === 0 && (B === null ? $s([e]) : B.push(e)), !r.is_fork && jt.size > 0 && !wr && yr();
2202
+ }
2203
+ return t;
2204
+ }
2205
+ function yr() {
2206
+ wr = !1;
2207
+ for (const e of jt)
2208
+ (e.f & O) !== 0 && T(e, re), st(e) && He(e);
2209
+ jt.clear();
2210
+ }
2211
+ function js(e, t = 1) {
2212
+ var n = F(e), r = t === 1 ? n++ : n--;
2213
+ return ee(e, n), r;
2214
+ }
2215
+ function Xa(e, t = 1) {
2216
+ var n = F(e);
2217
+ return ee(e, t === 1 ? ++n : --n);
2218
+ }
2219
+ function _t(e) {
2220
+ ee(e, e.v + 1);
2221
+ }
2222
+ function br(e, t, n) {
2223
+ var r = e.reactions;
2224
+ if (r !== null)
2225
+ for (var s = r.length, i = 0; i < s; i++) {
2226
+ var f = r[i], l = f.f, u = (l & I) === 0;
2227
+ if (u && T(f, t), (l & C) !== 0) {
2228
+ var o = (
2229
+ /** @type {Derived} */
2230
+ f
2231
+ );
2232
+ x == null || x.delete(o), (l & qe) === 0 && (l & V && (f.f |= qe), br(o, re, n));
2233
+ } else if (u) {
2234
+ var c = (
2235
+ /** @type {Effect} */
2236
+ f
2237
+ );
2238
+ (l & le) !== 0 && Q !== null && Q.add(c), n !== null ? n.push(c) : yn(c);
2239
+ }
2240
+ }
2241
+ }
2242
+ let ge = null;
2243
+ function qs(e) {
2244
+ var t = ge;
2245
+ try {
2246
+ if (ge = /* @__PURE__ */ new Set(), $e(e), t !== null)
2247
+ for (var n of ge)
2248
+ t.add(n);
2249
+ return ge;
2250
+ } finally {
2251
+ ge = t;
2252
+ }
2253
+ }
2254
+ function Ja(e) {
2255
+ for (var t of qs(e))
2256
+ pt(t, t.v);
2257
+ }
2258
+ function Za(e, t) {
2259
+ if (t) {
2260
+ const n = document.body;
2261
+ e.autofocus = !0, Se(() => {
2262
+ document.activeElement === n && e.focus();
2263
+ });
2264
+ }
2265
+ }
2266
+ function Qa(e) {
2267
+ U && /* @__PURE__ */ Pt(e) !== null && Es(e);
2268
+ }
2269
+ let Pn = !1;
2270
+ function Hs() {
2271
+ Pn || (Pn = !0, document.addEventListener(
2272
+ "reset",
2273
+ (e) => {
2274
+ Promise.resolve().then(() => {
2275
+ var t;
2276
+ if (!e.defaultPrevented)
2277
+ for (
2278
+ const n of
2279
+ /**@type {HTMLFormElement} */
2280
+ e.target.elements
2281
+ )
2282
+ (t = n.__on_r) == null || t.call(n);
2283
+ });
2284
+ },
2285
+ // In the capture phase to guarantee we get noticed of it (no possibility of stopPropagation)
2286
+ { capture: !0 }
2287
+ ));
2288
+ }
2289
+ function eo(e, t, n, r = !0) {
2290
+ r && n();
2291
+ for (var s of t)
2292
+ e.addEventListener(s, n);
2293
+ An(() => {
2294
+ for (var i of t)
2295
+ e.removeEventListener(i, n);
2296
+ });
2297
+ }
2298
+ function Tn(e) {
2299
+ var t = w, n = y;
2300
+ J(null), Z(null);
2301
+ try {
2302
+ return e();
2303
+ } finally {
2304
+ J(t), Z(n);
2305
+ }
2306
+ }
2307
+ function to(e, t, n, r = n) {
2308
+ e.addEventListener(t, () => Tn(n));
2309
+ const s = e.__on_r;
2310
+ s ? e.__on_r = () => {
2311
+ s(), r(!0);
2312
+ } : e.__on_r = () => r(!0), Hs();
2313
+ }
2314
+ let It = !1, xe = !1;
2315
+ function Ln(e) {
2316
+ xe = e;
2317
+ }
2318
+ let w = null, te = !1;
2319
+ function J(e) {
2320
+ w = e;
2321
+ }
2322
+ let y = null;
2323
+ function Z(e) {
2324
+ y = e;
2325
+ }
2326
+ let X = null;
2327
+ function gr(e) {
2328
+ w !== null && (X === null ? X = [e] : X.push(e));
2329
+ }
2330
+ let L = null, q = 0, B = null;
2331
+ function $s(e) {
2332
+ B = e;
2333
+ }
2334
+ let mr = 1, Me = 0, Fe = Me;
2335
+ function Fn(e) {
2336
+ Fe = e;
2337
+ }
2338
+ function qt() {
2339
+ return ++mr;
2340
+ }
2341
+ function st(e) {
2342
+ var t = e.f;
2343
+ if ((t & I) !== 0)
2344
+ return !0;
2345
+ if (t & C && (e.f &= ~qe), (t & re) !== 0) {
2346
+ for (var n = (
2347
+ /** @type {Value[]} */
2348
+ e.deps
2349
+ ), r = n.length, s = 0; s < r; s++) {
2350
+ var i = n[s];
2351
+ if (st(
2352
+ /** @type {Derived} */
2353
+ i
2354
+ ) && vr(
2355
+ /** @type {Derived} */
2356
+ i
2357
+ ), i.wv > e.wv)
2358
+ return !0;
2359
+ }
2360
+ (t & V) !== 0 && // During time traveling we don't want to reset the status so that
2361
+ // traversal of the graph in the other batches still happens
2362
+ x === null && T(e, O);
2363
+ }
2364
+ return !1;
2365
+ }
2366
+ function Er(e, t, n = !0) {
2367
+ var r = e.reactions;
2368
+ if (r !== null && !(X !== null && Ze.call(X, e)))
2369
+ for (var s = 0; s < r.length; s++) {
2370
+ var i = r[s];
2371
+ (i.f & C) !== 0 ? Er(
2372
+ /** @type {Derived} */
2373
+ i,
2374
+ t,
2375
+ !1
2376
+ ) : t === i && (n ? T(i, I) : (i.f & O) !== 0 && T(i, re), yn(
2377
+ /** @type {Effect} */
2378
+ i
2379
+ ));
2380
+ }
2381
+ }
2382
+ function Tr(e) {
2383
+ var A;
2384
+ var t = L, n = q, r = B, s = w, i = X, f = M, l = te, u = Fe, o = e.f;
2385
+ L = /** @type {null | Value[]} */
2386
+ null, q = 0, B = null, w = (o & (ue | ye)) === 0 ? e : null, X = null, et(e.ctx), te = !1, Fe = ++Me, e.ac !== null && (Tn(() => {
2387
+ e.ac.abort(oe);
2388
+ }), e.ac = null);
2389
+ try {
2390
+ e.f |= Zt;
2391
+ var c = (
2392
+ /** @type {Function} */
2393
+ e.fn
2394
+ ), p = c();
2395
+ e.f |= Ye;
2396
+ var d = e.deps, h = v == null ? void 0 : v.is_fork;
2397
+ if (L !== null) {
2398
+ var _;
2399
+ if (h || wt(e, q), d !== null && q > 0)
2400
+ for (d.length = q + L.length, _ = 0; _ < L.length; _++)
2401
+ d[q + _] = L[_];
2402
+ else
2403
+ e.deps = d = L;
2404
+ if (At() && (e.f & V) !== 0)
2405
+ for (_ = q; _ < d.length; _++)
2406
+ ((A = d[_]).reactions ?? (A.reactions = [])).push(e);
2407
+ } else !h && d !== null && q < d.length && (wt(e, q), d.length = q);
2408
+ if (Jn() && B !== null && !te && d !== null && (e.f & (C | re | I)) === 0)
2409
+ for (_ = 0; _ < /** @type {Source[]} */
2410
+ B.length; _++)
2411
+ Er(
2412
+ B[_],
2413
+ /** @type {Effect} */
2414
+ e
2415
+ );
2416
+ if (s !== null && s !== e) {
2417
+ if (Me++, s.deps !== null)
2418
+ for (let S = 0; S < n; S += 1)
2419
+ s.deps[S].rv = Me;
2420
+ if (t !== null)
2421
+ for (const S of t)
2422
+ S.rv = Me;
2423
+ B !== null && (r === null ? r = B : r.push(.../** @type {Source[]} */
2424
+ B));
2425
+ }
2426
+ return (e.f & Te) !== 0 && (e.f ^= Te), p;
2427
+ } catch (S) {
2428
+ return nr(S);
2429
+ } finally {
2430
+ e.f ^= Zt, L = t, q = n, B = r, w = s, X = i, et(f), te = l, Fe = u;
2431
+ }
2432
+ }
2433
+ function Ys(e, t) {
2434
+ let n = t.reactions;
2435
+ if (n !== null) {
2436
+ var r = Dr.call(n, e);
2437
+ if (r !== -1) {
2438
+ var s = n.length - 1;
2439
+ s === 0 ? n = t.reactions = null : (n[r] = n[s], n.pop());
2440
+ }
2441
+ }
2442
+ if (n === null && (t.f & C) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
2443
+ // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
2444
+ // allows us to skip the expensive work of disconnecting and immediately reconnecting it
2445
+ (L === null || !Ze.call(L, t))) {
2446
+ var i = (
2447
+ /** @type {Derived} */
2448
+ t
2449
+ );
2450
+ (i.f & V) !== 0 && (i.f ^= V, i.f &= ~qe), i.v !== R && dn(i), Ps(i), wt(i, 0);
2451
+ }
2452
+ }
2453
+ function wt(e, t) {
2454
+ var n = e.deps;
2455
+ if (n !== null)
2456
+ for (var r = t; r < n.length; r++)
2457
+ Ys(e, n[r]);
2458
+ }
2459
+ function He(e) {
2460
+ var t = e.f;
2461
+ if ((t & W) === 0) {
2462
+ T(e, O);
2463
+ var n = y, r = It;
2464
+ y = e, It = !0;
2465
+ try {
2466
+ (t & (le | ln)) !== 0 ? Ks(e) : Sn(e), Or(e);
2467
+ var s = Tr(e);
2468
+ e.teardown = typeof s == "function" ? s : null, e.wv = mr;
2469
+ var i;
2470
+ } finally {
2471
+ It = r, y = n;
2472
+ }
2473
+ }
2474
+ }
2475
+ async function no() {
2476
+ await Promise.resolve(), Lt();
2477
+ }
2478
+ function ro() {
2479
+ return ce.ensure().settled();
2480
+ }
2481
+ function F(e) {
2482
+ var t = e.f, n = (t & C) !== 0;
2483
+ if (ge == null || ge.add(e), w !== null && !te) {
2484
+ var r = y !== null && (y.f & W) !== 0;
2485
+ if (!r && (X === null || !Ze.call(X, e))) {
2486
+ var s = w.deps;
2487
+ if ((w.f & Zt) !== 0)
2488
+ e.rv < Me && (e.rv = Me, L === null && s !== null && s[q] === e ? q++ : L === null ? L = [e] : L.push(e));
2489
+ else {
2490
+ (w.deps ?? (w.deps = [])).push(e);
2491
+ var i = e.reactions;
2492
+ i === null ? e.reactions = [w] : Ze.call(i, w) || i.push(w);
2493
+ }
2494
+ }
2495
+ }
2496
+ if (xe && Le.has(e))
2497
+ return Le.get(e);
2498
+ if (n) {
2499
+ var f = (
2500
+ /** @type {Derived} */
2501
+ e
2502
+ );
2503
+ if (xe) {
2504
+ var l = f.v;
2505
+ return ((f.f & O) === 0 && f.reactions !== null || Sr(f)) && (l = En(f)), Le.set(f, l), l;
2506
+ }
2507
+ var u = (f.f & V) === 0 && !te && w !== null && (It || (w.f & V) !== 0), o = (f.f & Ye) === 0;
2508
+ st(f) && (u && (f.f |= V), vr(f)), u && !o && (pr(f), Ar(f));
2509
+ }
2510
+ if (x != null && x.has(e))
2511
+ return x.get(e);
2512
+ if ((e.f & Te) !== 0)
2513
+ throw e.v;
2514
+ return e.v;
2515
+ }
2516
+ function Ar(e) {
2517
+ if (e.f |= V, e.deps !== null)
2518
+ for (const t of e.deps)
2519
+ (t.reactions ?? (t.reactions = [])).push(e), (t.f & C) !== 0 && (t.f & V) === 0 && (pr(
2520
+ /** @type {Derived} */
2521
+ t
2522
+ ), Ar(
2523
+ /** @type {Derived} */
2524
+ t
2525
+ ));
2526
+ }
2527
+ function Sr(e) {
2528
+ if (e.v === R) return !0;
2529
+ if (e.deps === null) return !1;
2530
+ for (const t of e.deps)
2531
+ if (Le.has(t) || (t.f & C) !== 0 && Sr(
2532
+ /** @type {Derived} */
2533
+ t
2534
+ ))
2535
+ return !0;
2536
+ return !1;
2537
+ }
2538
+ function so(e) {
2539
+ return e && F(e);
2540
+ }
2541
+ function $e(e) {
2542
+ var t = te;
2543
+ try {
2544
+ return te = !0, e();
2545
+ } finally {
2546
+ te = t;
2547
+ }
2548
+ }
2549
+ function io(e) {
2550
+ if (!(typeof e != "object" || !e || e instanceof EventTarget)) {
2551
+ if (Ae in e)
2552
+ on(e);
2553
+ else if (!Array.isArray(e))
2554
+ for (let t in e) {
2555
+ const n = e[t];
2556
+ typeof n == "object" && n && Ae in n && on(n);
2557
+ }
2558
+ }
2559
+ }
2560
+ function on(e, t = /* @__PURE__ */ new Set()) {
2561
+ if (typeof e == "object" && e !== null && // We don't want to traverse DOM elements
2562
+ !(e instanceof EventTarget) && !t.has(e)) {
2563
+ t.add(e), e instanceof Date && e.getTime();
2564
+ for (let r in e)
2565
+ try {
2566
+ on(e[r], t);
2567
+ } catch {
2568
+ }
2569
+ const n = fn(e);
2570
+ if (n !== Object.prototype && n !== Array.prototype && n !== Map.prototype && n !== Set.prototype && n !== Date.prototype) {
2571
+ const r = Pr(n);
2572
+ for (let s in r) {
2573
+ const i = r[s].get;
2574
+ if (i)
2575
+ try {
2576
+ i.call(e);
2577
+ } catch {
2578
+ }
2579
+ }
2580
+ }
2581
+ }
2582
+ }
2583
+ function kr(e) {
2584
+ y === null && (w === null && zr(), Br()), xe && Ur();
2585
+ }
2586
+ function Us(e, t) {
2587
+ var n = t.last;
2588
+ n === null ? t.last = t.first = e : (n.next = e, e.prev = n, t.last = e);
2589
+ }
2590
+ function j(e, t) {
2591
+ var n = y;
2592
+ n !== null && (n.f & K) !== 0 && (e |= K);
2593
+ var r = {
2594
+ ctx: M,
2595
+ deps: null,
2596
+ nodes: null,
2597
+ f: e | I | V,
2598
+ first: null,
2599
+ fn: t,
2600
+ last: null,
2601
+ next: null,
2602
+ parent: n,
2603
+ b: n && n.b,
2604
+ prev: null,
2605
+ teardown: null,
2606
+ wv: 0,
2607
+ ac: null
2608
+ };
2609
+ v == null || v.register_created_effect(r);
2610
+ var s = r;
2611
+ if ((e & je) !== 0)
2612
+ Ge !== null ? Ge.push(r) : ce.ensure().schedule(r);
2613
+ else if (t !== null) {
2614
+ try {
2615
+ He(r);
2616
+ } catch (f) {
2617
+ throw ne(r), f;
2618
+ }
2619
+ s.deps === null && s.teardown === null && s.nodes === null && s.first === s.last && // either `null`, or a singular child
2620
+ (s.f & Ue) === 0 && (s = s.first, (e & le) !== 0 && (e & dt) !== 0 && s !== null && (s.f |= dt));
2621
+ }
2622
+ if (s !== null && (s.parent = n, n !== null && Us(s, n), w !== null && (w.f & C) !== 0 && (e & ye) === 0)) {
2623
+ var i = (
2624
+ /** @type {Derived} */
2625
+ w
2626
+ );
2627
+ (i.effects ?? (i.effects = [])).push(s);
2628
+ }
2629
+ return r;
2630
+ }
2631
+ function At() {
2632
+ return w !== null && !te;
2633
+ }
2634
+ function An(e) {
2635
+ const t = j(Tt, null);
2636
+ return T(t, O), t.teardown = e, t;
2637
+ }
2638
+ function ao(e) {
2639
+ kr();
2640
+ var t = (
2641
+ /** @type {Effect} */
2642
+ y.f
2643
+ ), n = !w && (t & ue) !== 0 && (t & Ye) === 0;
2644
+ if (n) {
2645
+ var r = (
2646
+ /** @type {ComponentContext} */
2647
+ M
2648
+ );
2649
+ (r.e ?? (r.e = [])).push(e);
2650
+ } else
2651
+ return xr(e);
2652
+ }
2653
+ function xr(e) {
2654
+ return j(je | Bn, e);
2655
+ }
2656
+ function oo(e) {
2657
+ return kr(), j(Tt | Bn, e);
2658
+ }
2659
+ function Bs(e) {
2660
+ return j(ht, e);
2661
+ }
2662
+ function zs(e) {
2663
+ ce.ensure();
2664
+ const t = j(ye | Ue, e);
2665
+ return () => {
2666
+ ne(t);
2667
+ };
2668
+ }
2669
+ function fo(e) {
2670
+ ce.ensure();
2671
+ const t = j(ye | Ue, e);
2672
+ return (n = {}) => new Promise((r) => {
2673
+ n.outro ? Dt(t, () => {
2674
+ ne(t), r(void 0);
2675
+ }) : (ne(t), r(void 0));
2676
+ });
2677
+ }
2678
+ function lo(e) {
2679
+ return j(je, e);
2680
+ }
2681
+ function uo(e, t) {
2682
+ var n = (
2683
+ /** @type {ComponentContextLegacy} */
2684
+ M
2685
+ ), r = { effect: null, ran: !1, deps: e };
2686
+ n.l.$.push(r), r.effect = Gt(() => {
2687
+ if (e(), !r.ran) {
2688
+ r.ran = !0;
2689
+ var s = (
2690
+ /** @type {Effect} */
2691
+ y
2692
+ );
2693
+ try {
2694
+ Z(s.parent), $e(t);
2695
+ } finally {
2696
+ Z(s);
2697
+ }
2698
+ }
2699
+ });
2700
+ }
2701
+ function co() {
2702
+ var e = (
2703
+ /** @type {ComponentContextLegacy} */
2704
+ M
2705
+ );
2706
+ Gt(() => {
2707
+ for (var t of e.l.$) {
2708
+ t.deps();
2709
+ var n = t.effect;
2710
+ (n.f & O) !== 0 && n.deps !== null && T(n, re), st(n) && He(n), t.ran = !1;
2711
+ }
2712
+ });
2713
+ }
2714
+ function Gs(e) {
2715
+ return j(Qe | Ue, e);
2716
+ }
2717
+ function Gt(e, t = 0) {
2718
+ return j(Tt | t, e);
2719
+ }
2720
+ function _o(e, t = [], n = [], r = []) {
2721
+ bn(r, t, n, (s) => {
2722
+ j(Tt, () => e(...s.map(F)));
2723
+ });
2724
+ }
2725
+ function ho(e, t = [], n = [], r = []) {
2726
+ if (n.length > 0 || r.length > 0)
2727
+ var s = zt();
2728
+ bn(r, t, n, (i) => {
2729
+ j(je, () => e(...i.map(F))), s && s();
2730
+ });
2731
+ }
2732
+ function Vs(e, t = 0) {
2733
+ var n = j(le | t, e);
2734
+ return n;
2735
+ }
2736
+ function vo(e, t = 0) {
2737
+ var n = j(ln | t, e);
2738
+ return n;
2739
+ }
2740
+ function Ne(e) {
2741
+ return j(ue | Ue, e);
2742
+ }
2743
+ function Or(e) {
2744
+ var t = e.teardown;
2745
+ if (t !== null) {
2746
+ const n = xe, r = w;
2747
+ Ln(!0), J(null);
2748
+ try {
2749
+ t.call(null);
2750
+ } finally {
2751
+ Ln(n), J(r);
2752
+ }
2753
+ }
2754
+ }
2755
+ function Sn(e, t = !1) {
2756
+ var n = e.first;
2757
+ for (e.first = e.last = null; n !== null; ) {
2758
+ const s = n.ac;
2759
+ s !== null && Tn(() => {
2760
+ s.abort(oe);
2761
+ });
2762
+ var r = n.next;
2763
+ (n.f & ye) !== 0 ? n.parent = null : ne(n, t), n = r;
2764
+ }
2765
+ }
2766
+ function Ks(e) {
2767
+ for (var t = e.first; t !== null; ) {
2768
+ var n = t.next;
2769
+ (t.f & ue) === 0 && ne(t), t = n;
2770
+ }
2771
+ }
2772
+ function ne(e, t = !0) {
2773
+ var n = !1;
2774
+ (t || (e.f & Fr) !== 0) && e.nodes !== null && e.nodes.end !== null && (Ws(
2775
+ e.nodes.start,
2776
+ /** @type {TemplateNode} */
2777
+ e.nodes.end
2778
+ ), n = !0), T(e, Nn), Sn(e, t && !n), wt(e, 0);
2779
+ var r = e.nodes && e.nodes.t;
2780
+ if (r !== null)
2781
+ for (const i of r)
2782
+ i.stop();
2783
+ Or(e), e.f ^= Nn, e.f |= W;
2784
+ var s = e.parent;
2785
+ s !== null && s.first !== null && Nr(e), e.next = e.prev = e.teardown = e.ctx = e.deps = e.fn = e.nodes = e.ac = e.b = null;
2786
+ }
2787
+ function Ws(e, t) {
2788
+ for (; e !== null; ) {
2789
+ var n = e === t ? null : /* @__PURE__ */ Oe(e);
2790
+ e.remove(), e = n;
2791
+ }
2792
+ }
2793
+ function Nr(e) {
2794
+ var t = e.parent, n = e.prev, r = e.next;
2795
+ n !== null && (n.next = r), r !== null && (r.prev = n), t !== null && (t.first === e && (t.first = r), t.last === e && (t.last = n));
2796
+ }
2797
+ function Dt(e, t, n = !0) {
2798
+ var r = [];
2799
+ Rr(e, r, !0);
2800
+ var s = () => {
2801
+ n && ne(e), t && t();
2802
+ }, i = r.length;
2803
+ if (i > 0) {
2804
+ var f = () => --i || s();
2805
+ for (var l of r)
2806
+ l.out(f);
2807
+ } else
2808
+ s();
2809
+ }
2810
+ function Rr(e, t, n) {
2811
+ if ((e.f & K) === 0) {
2812
+ e.f ^= K;
2813
+ var r = e.nodes && e.nodes.t;
2814
+ if (r !== null)
2815
+ for (const l of r)
2816
+ (l.is_global || n) && t.push(l);
2817
+ for (var s = e.first; s !== null; ) {
2818
+ var i = s.next;
2819
+ if ((s.f & ye) === 0) {
2820
+ var f = (s.f & dt) !== 0 || // If this is a branch effect without a block effect parent,
2821
+ // it means the parent block effect was pruned. In that case,
2822
+ // transparency information was transferred to the branch effect.
2823
+ (s.f & ue) !== 0 && (e.f & le) !== 0;
2824
+ Rr(s, t, f ? n : !1);
2825
+ }
2826
+ s = i;
2827
+ }
2828
+ }
2829
+ }
2830
+ function po(e) {
2831
+ Mr(e, !0);
2832
+ }
2833
+ function Mr(e, t) {
2834
+ if ((e.f & K) !== 0) {
2835
+ e.f ^= K, (e.f & O) === 0 && (T(e, I), ce.ensure().schedule(e));
2836
+ for (var n = e.first; n !== null; ) {
2837
+ var r = n.next, s = (n.f & dt) !== 0 || (n.f & ue) !== 0;
2838
+ Mr(n, s ? t : !1), n = r;
2839
+ }
2840
+ var i = e.nodes && e.nodes.t;
2841
+ if (i !== null)
2842
+ for (const f of i)
2843
+ (f.is_global || t) && f.in();
2844
+ }
2845
+ }
2846
+ function jn(e = (
2847
+ /** @type {Effect} */
2848
+ y
2849
+ )) {
2850
+ return (e.f & W) !== 0;
2851
+ }
2852
+ function Xs(e, t) {
2853
+ if (e.nodes)
2854
+ for (var n = e.nodes.start, r = e.nodes.end; n !== null; ) {
2855
+ var s = n === r ? null : /* @__PURE__ */ Oe(n);
2856
+ t.append(n), n = s;
2857
+ }
2858
+ }
2859
+ function Js(e, t) {
2860
+ var n = y, r = w, s = e();
2861
+ const i = vn(s, (f) => {
2862
+ var l = s !== e(), u, o = w, c = y;
2863
+ J(r), Z(n);
2864
+ try {
2865
+ u = zs(() => {
2866
+ Gt(() => {
2867
+ const p = e();
2868
+ l && f(p);
2869
+ });
2870
+ });
2871
+ } finally {
2872
+ J(o), Z(c);
2873
+ }
2874
+ return l = !0, u;
2875
+ });
2876
+ return t ? {
2877
+ set: t,
2878
+ update: (f) => t(f(e())),
2879
+ subscribe: i.subscribe
2880
+ } : {
2881
+ subscribe: i.subscribe
2882
+ };
2883
+ }
2884
+ function Zs(e) {
2885
+ let t;
2886
+ const n = cr((s) => {
2887
+ let i = !1;
2888
+ const f = e.subscribe((l) => {
2889
+ t = l, i && s();
2890
+ });
2891
+ return i = !0, f;
2892
+ });
2893
+ function r() {
2894
+ return At() ? (n(), t) : pn(e);
143
2895
  }
144
2896
  return "set" in e ? {
145
2897
  get current() {
146
- return t();
2898
+ return r();
147
2899
  },
148
- set current(i) {
149
- e.set(i);
2900
+ set current(s) {
2901
+ e.set(s);
150
2902
  }
151
2903
  } : {
152
2904
  get current() {
153
- return t();
2905
+ return r();
154
2906
  }
155
2907
  };
156
2908
  }
157
- const N = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2909
+ const wo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
158
2910
  __proto__: null,
159
- derived: D,
160
- fromStore: J,
161
- get: z,
162
- readable: x,
163
- readonly: F,
164
- toStore: I,
165
- writable: v
2911
+ derived: As,
2912
+ fromStore: Zs,
2913
+ get: pn,
2914
+ readable: ir,
2915
+ readonly: Ss,
2916
+ toStore: Js,
2917
+ writable: vn
166
2918
  }, Symbol.toStringTag, { value: "Module" }));
167
2919
  export {
168
- N as a,
169
- H as c,
170
- z as g,
171
- G as i,
172
- q as s,
173
- v as w
2920
+ ei as $,
2921
+ Ki as A,
2922
+ Oa as B,
2923
+ zn as C,
2924
+ pi as D,
2925
+ vi as E,
2926
+ ns as F,
2927
+ Vi as G,
2928
+ es as H,
2929
+ hi as I,
2930
+ Ui as J,
2931
+ Bi as K,
2932
+ ga as L,
2933
+ Oe as M,
2934
+ Gi as N,
2935
+ un as O,
2936
+ da as P,
2937
+ ki as Q,
2938
+ Ye as R,
2939
+ Ae as S,
2940
+ Yt as T,
2941
+ Es as U,
2942
+ fo as V,
2943
+ Ha as W,
2944
+ ra as X,
2945
+ M as Y,
2946
+ cn as Z,
2947
+ sa as _,
2948
+ ia as a,
2949
+ fe as a$,
2950
+ zi as a0,
2951
+ ee as a1,
2952
+ Vs as a2,
2953
+ dt as a3,
2954
+ F as a4,
2955
+ Ne as a5,
2956
+ rt as a6,
2957
+ ne as a7,
2958
+ _i as a8,
2959
+ lt as a9,
2960
+ Lt as aA,
2961
+ gn as aB,
2962
+ pa as aC,
2963
+ Mi as aD,
2964
+ li as aE,
2965
+ Ai as aF,
2966
+ Ka as aG,
2967
+ Hn as aH,
2968
+ Ni as aI,
2969
+ Ii as aJ,
2970
+ Fs as aK,
2971
+ Ri as aL,
2972
+ W as aM,
2973
+ K as aN,
2974
+ ue as aO,
2975
+ Ci as aP,
2976
+ _o as aQ,
2977
+ Ws as aR,
2978
+ bi as aS,
2979
+ mi as aT,
2980
+ gi as aU,
2981
+ Wi as aV,
2982
+ ea as aW,
2983
+ ls as aX,
2984
+ le as aY,
2985
+ lo as aZ,
2986
+ ri as a_,
2987
+ ui as aa,
2988
+ ua as ab,
2989
+ ca as ac,
2990
+ Ti as ad,
2991
+ Ei as ae,
2992
+ kr as af,
2993
+ Bs as ag,
2994
+ Gt as ah,
2995
+ is as ai,
2996
+ Zi as aj,
2997
+ R as ak,
2998
+ zt as al,
2999
+ bn as am,
3000
+ bs as an,
3001
+ yi as ao,
3002
+ po as ap,
3003
+ Dt as aq,
3004
+ v as ar,
3005
+ Xs as as,
3006
+ Aa as at,
3007
+ si as au,
3008
+ Wn as av,
3009
+ pt as aw,
3010
+ ce as ax,
3011
+ nt as ay,
3012
+ ut as az,
3013
+ ts as b,
3014
+ La as b$,
3015
+ Hi as b0,
3016
+ ji as b1,
3017
+ qi as b2,
3018
+ Fr as b3,
3019
+ Ue as b4,
3020
+ io as b5,
3021
+ Vn as b6,
3022
+ vo as b7,
3023
+ ni as b8,
3024
+ to as b9,
3025
+ Ya as bA,
3026
+ aa as bB,
3027
+ ti as bC,
3028
+ zs as bD,
3029
+ oa as bE,
3030
+ jn as bF,
3031
+ Qi as bG,
3032
+ Is as bH,
3033
+ ma as bI,
3034
+ on as bJ,
3035
+ ho as bK,
3036
+ Va as bL,
3037
+ gs as bM,
3038
+ ja as bN,
3039
+ At as bO,
3040
+ ba as bP,
3041
+ fi as bQ,
3042
+ ai as bR,
3043
+ Ea as bS,
3044
+ Ba as bT,
3045
+ va as bU,
3046
+ wi as bV,
3047
+ Ja as bW,
3048
+ Ma as bX,
3049
+ we as bY,
3050
+ uo as bZ,
3051
+ co as b_,
3052
+ _a as ba,
3053
+ wa as bb,
3054
+ Hs as bc,
3055
+ ci as bd,
3056
+ rs as be,
3057
+ fn as bf,
3058
+ Pr as bg,
3059
+ Za as bh,
3060
+ ha as bi,
3061
+ eo as bj,
3062
+ no as bk,
3063
+ Nn as bl,
3064
+ oo as bm,
3065
+ ao as bn,
3066
+ Yn as bo,
3067
+ ii as bp,
3068
+ mn as bq,
3069
+ Fa as br,
3070
+ Oi as bs,
3071
+ Pi as bt,
3072
+ ot as bu,
3073
+ js as bv,
3074
+ Li as bw,
3075
+ Di as bx,
3076
+ xe as by,
3077
+ Fi as bz,
3078
+ Xt as c,
3079
+ Wa as c0,
3080
+ ys as c1,
3081
+ $a as c2,
3082
+ Qa as c3,
3083
+ za as c4,
3084
+ so as c5,
3085
+ Ua as c6,
3086
+ Ca as c7,
3087
+ Ta as c8,
3088
+ be as c9,
3089
+ ro as cA,
3090
+ Fe as cB,
3091
+ _t as cC,
3092
+ cr as cD,
3093
+ Un as cE,
3094
+ vn as cF,
3095
+ pn as cG,
3096
+ wo as cH,
3097
+ Na as ca,
3098
+ Ia as cb,
3099
+ ks as cc,
3100
+ Ra as cd,
3101
+ ya as ce,
3102
+ Ji as cf,
3103
+ os as cg,
3104
+ oi as ch,
3105
+ Xi as ci,
3106
+ Dn as cj,
3107
+ Xa as ck,
3108
+ Pa as cl,
3109
+ Da as cm,
3110
+ Ga as cn,
3111
+ Mn as co,
3112
+ qr as cp,
3113
+ la as cq,
3114
+ Hr as cr,
3115
+ xi as cs,
3116
+ Si as ct,
3117
+ ta as cu,
3118
+ qa as cv,
3119
+ na as cw,
3120
+ us as cx,
3121
+ _s as cy,
3122
+ cs as cz,
3123
+ Kt as d,
3124
+ fa as e,
3125
+ Z as f,
3126
+ w as g,
3127
+ U as h,
3128
+ y as i,
3129
+ Sa as j,
3130
+ vt as k,
3131
+ k as l,
3132
+ Pt as m,
3133
+ ms as n,
3134
+ ws as o,
3135
+ ke as p,
3136
+ Se as q,
3137
+ _n as r,
3138
+ J as s,
3139
+ An as t,
3140
+ $e as u,
3141
+ $i as v,
3142
+ Tn as w,
3143
+ Yi as x,
3144
+ ka as y,
3145
+ xa as z
174
3146
  };