@pie-players/pie-section-player-tools-session-debugger 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2709 @@
1
+ var vs = Object.defineProperty;
2
+ var zn = (e) => {
3
+ throw TypeError(e);
4
+ };
5
+ var _s = (e, t, n) => t in e ? vs(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
6
+ var T = (e, t, n) => _s(e, typeof t != "symbol" ? t + "" : t, n), tn = (e, t, n) => t.has(e) || zn("Cannot " + n);
7
+ var l = (e, t, n) => (tn(e, t, "read from private field"), n ? n.call(e) : t.get(e)), m = (e, t, n) => t.has(e) ? zn("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), p = (e, t, n, r) => (tn(e, t, "write to private field"), r ? r.call(e, n) : t.set(e, n), n), j = (e, t, n) => (tn(e, t, "access private method"), n);
8
+ var Zn;
9
+ typeof window < "u" && ((Zn = window.__svelte ?? (window.__svelte = {})).v ?? (Zn.v = /* @__PURE__ */ new Set())).add("5");
10
+ const ps = 2, bn = "[", $n = "[!", Qn = "]", ot = {}, R = /* @__PURE__ */ Symbol(), er = "http://www.w3.org/1999/xhtml", on = !1;
11
+ var tr = Array.isArray, gs = Array.prototype.indexOf, lt = Array.prototype.includes, ms = Array.from, Ft = Object.keys, Ht = Object.defineProperty, Ge = Object.getOwnPropertyDescriptor, ws = Object.getOwnPropertyDescriptors, bs = Object.prototype, $s = Array.prototype, nr = Object.getPrototypeOf, Vn = Object.isExtensible;
12
+ const ys = () => {
13
+ };
14
+ function Es(e) {
15
+ for (var t = 0; t < e.length; t++)
16
+ e[t]();
17
+ }
18
+ function rr() {
19
+ var e, t, n = new Promise((r, s) => {
20
+ e = r, t = s;
21
+ });
22
+ return { promise: n, resolve: e, reject: t };
23
+ }
24
+ const O = 2, zt = 4, Wt = 8, sr = 1 << 24, $e = 16, de = 32, Ne = 64, ln = 128, J = 512, N = 1024, D = 2048, ne = 4096, fe = 8192, we = 16384, ht = 32768, ft = 65536, Yn = 1 << 17, ir = 1 << 18, qe = 1 << 19, xs = 1 << 20, Be = 65536, fn = 1 << 21, yn = 1 << 22, Me = 1 << 23, nn = /* @__PURE__ */ Symbol("$state"), Ss = /* @__PURE__ */ Symbol("legacy props"), Oe = new class extends Error {
25
+ constructor() {
26
+ super(...arguments);
27
+ T(this, "name", "StaleReactionError");
28
+ T(this, "message", "The reaction that called `getAbortSignal()` was re-run or destroyed");
29
+ }
30
+ }(), En = 3, qt = 8;
31
+ function or(e) {
32
+ throw new Error("https://svelte.dev/e/lifecycle_outside_component");
33
+ }
34
+ function ks() {
35
+ throw new Error("https://svelte.dev/e/async_derived_orphan");
36
+ }
37
+ function Is(e) {
38
+ throw new Error("https://svelte.dev/e/effect_in_teardown");
39
+ }
40
+ function Ts() {
41
+ throw new Error("https://svelte.dev/e/effect_in_unowned_derived");
42
+ }
43
+ function Ms(e) {
44
+ throw new Error("https://svelte.dev/e/effect_orphan");
45
+ }
46
+ function As() {
47
+ throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
48
+ }
49
+ function Cs() {
50
+ throw new Error("https://svelte.dev/e/hydration_failed");
51
+ }
52
+ function Ns() {
53
+ throw new Error("https://svelte.dev/e/state_descriptors_fixed");
54
+ }
55
+ function Rs() {
56
+ throw new Error("https://svelte.dev/e/state_prototype_fixed");
57
+ }
58
+ function Os() {
59
+ throw new Error("https://svelte.dev/e/state_unsafe_mutation");
60
+ }
61
+ function Ds() {
62
+ throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror");
63
+ }
64
+ function Ut(e) {
65
+ console.warn("https://svelte.dev/e/hydration_mismatch");
66
+ }
67
+ function Ps() {
68
+ console.warn("https://svelte.dev/e/svelte_boundary_reset_noop");
69
+ }
70
+ let k = !1;
71
+ function Je(e) {
72
+ k = e;
73
+ }
74
+ let S;
75
+ function ue(e) {
76
+ if (e === null)
77
+ throw Ut(), ot;
78
+ return S = e;
79
+ }
80
+ function xn() {
81
+ return ue(/* @__PURE__ */ Re(S));
82
+ }
83
+ function xe(e) {
84
+ if (k) {
85
+ if (/* @__PURE__ */ Re(S) !== null)
86
+ throw Ut(), ot;
87
+ S = e;
88
+ }
89
+ }
90
+ function Ls(e = 1) {
91
+ if (k) {
92
+ for (var t = e, n = S; t--; )
93
+ n = /** @type {TemplateNode} */
94
+ /* @__PURE__ */ Re(n);
95
+ S = n;
96
+ }
97
+ }
98
+ function lr(e = !0) {
99
+ for (var t = 0, n = S; ; ) {
100
+ if (n.nodeType === qt) {
101
+ var r = (
102
+ /** @type {Comment} */
103
+ n.data
104
+ );
105
+ if (r === Qn) {
106
+ if (t === 0) return n;
107
+ t -= 1;
108
+ } else (r === bn || r === $n || // "[1", "[2", etc. for if blocks
109
+ r[0] === "[" && !isNaN(Number(r.slice(1)))) && (t += 1);
110
+ }
111
+ var s = (
112
+ /** @type {TemplateNode} */
113
+ /* @__PURE__ */ Re(n)
114
+ );
115
+ e && n.remove(), n = s;
116
+ }
117
+ }
118
+ function js(e) {
119
+ if (!e || e.nodeType !== qt)
120
+ throw Ut(), ot;
121
+ return (
122
+ /** @type {Comment} */
123
+ e.data
124
+ );
125
+ }
126
+ function fr(e) {
127
+ return e === this.v;
128
+ }
129
+ function Fs(e, t) {
130
+ return e != e ? t == t : e !== t || e !== null && typeof e == "object" || typeof e == "function";
131
+ }
132
+ function Hs(e) {
133
+ return !Fs(e, this.v);
134
+ }
135
+ let zs = !1, V = null;
136
+ function ut(e) {
137
+ V = e;
138
+ }
139
+ function ur(e, t = !1, n) {
140
+ V = {
141
+ p: V,
142
+ i: !1,
143
+ c: null,
144
+ e: null,
145
+ s: e,
146
+ x: null,
147
+ l: null
148
+ };
149
+ }
150
+ function ar(e) {
151
+ var t = (
152
+ /** @type {ComponentContext} */
153
+ V
154
+ ), n = t.e;
155
+ if (n !== null) {
156
+ t.e = null;
157
+ for (var r of n)
158
+ Rr(r);
159
+ }
160
+ return e !== void 0 && (t.x = e), t.i = !0, V = t.p, e ?? /** @type {T} */
161
+ {};
162
+ }
163
+ function cr() {
164
+ return !0;
165
+ }
166
+ let De = [];
167
+ function dr() {
168
+ var e = De;
169
+ De = [], Es(e);
170
+ }
171
+ function Ze(e) {
172
+ if (De.length === 0 && !pt) {
173
+ var t = De;
174
+ queueMicrotask(() => {
175
+ t === De && dr();
176
+ });
177
+ }
178
+ De.push(e);
179
+ }
180
+ function Vs() {
181
+ for (; De.length > 0; )
182
+ dr();
183
+ }
184
+ function hr(e) {
185
+ var t = $;
186
+ if (t === null)
187
+ return b.f |= Me, e;
188
+ if ((t.f & ht) === 0 && (t.f & zt) === 0)
189
+ throw e;
190
+ at(e, t);
191
+ }
192
+ function at(e, t) {
193
+ for (; t !== null; ) {
194
+ if ((t.f & ln) !== 0) {
195
+ if ((t.f & ht) === 0)
196
+ throw e;
197
+ try {
198
+ t.b.error(e);
199
+ return;
200
+ } catch (n) {
201
+ e = n;
202
+ }
203
+ }
204
+ t = t.parent;
205
+ }
206
+ throw e;
207
+ }
208
+ const Ys = -7169;
209
+ function M(e, t) {
210
+ e.f = e.f & Ys | t;
211
+ }
212
+ function Sn(e) {
213
+ (e.f & J) !== 0 || e.deps === null ? M(e, N) : M(e, ne);
214
+ }
215
+ function vr(e) {
216
+ if (e !== null)
217
+ for (const t of e)
218
+ (t.f & O) === 0 || (t.f & Be) === 0 || (t.f ^= Be, vr(
219
+ /** @type {Derived} */
220
+ t.deps
221
+ ));
222
+ }
223
+ function _r(e, t, n) {
224
+ (e.f & D) !== 0 ? t.add(e) : (e.f & ne) !== 0 && n.add(e), vr(e.deps), M(e, N);
225
+ }
226
+ const Ct = /* @__PURE__ */ new Set();
227
+ let x = null, Q = null, F = [], Xt = null, un = !1, pt = !1;
228
+ var Qe, et, je, tt, $t, yt, Fe, ve, nt, ce, an, cn, pr;
229
+ const An = class An {
230
+ constructor() {
231
+ m(this, ce);
232
+ T(this, "committed", !1);
233
+ /**
234
+ * The current values of any sources that are updated in this batch
235
+ * They keys of this map are identical to `this.#previous`
236
+ * @type {Map<Source, any>}
237
+ */
238
+ T(this, "current", /* @__PURE__ */ new Map());
239
+ /**
240
+ * The values of any sources that are updated in this batch _before_ those updates took place.
241
+ * They keys of this map are identical to `this.#current`
242
+ * @type {Map<Source, any>}
243
+ */
244
+ T(this, "previous", /* @__PURE__ */ new Map());
245
+ /**
246
+ * When the batch is committed (and the DOM is updated), we need to remove old branches
247
+ * and append new ones by calling the functions added inside (if/each/key/etc) blocks
248
+ * @type {Set<() => void>}
249
+ */
250
+ m(this, Qe, /* @__PURE__ */ new Set());
251
+ /**
252
+ * If a fork is discarded, we need to destroy any effects that are no longer needed
253
+ * @type {Set<(batch: Batch) => void>}
254
+ */
255
+ m(this, et, /* @__PURE__ */ new Set());
256
+ /**
257
+ * The number of async effects that are currently in flight
258
+ */
259
+ m(this, je, 0);
260
+ /**
261
+ * The number of async effects that are currently in flight, _not_ inside a pending boundary
262
+ */
263
+ m(this, tt, 0);
264
+ /**
265
+ * A deferred that resolves when the batch is committed, used with `settled()`
266
+ * TODO replace with Promise.withResolvers once supported widely enough
267
+ * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
268
+ */
269
+ m(this, $t, null);
270
+ /**
271
+ * Deferred effects (which run after async work has completed) that are DIRTY
272
+ * @type {Set<Effect>}
273
+ */
274
+ m(this, yt, /* @__PURE__ */ new Set());
275
+ /**
276
+ * Deferred effects that are MAYBE_DIRTY
277
+ * @type {Set<Effect>}
278
+ */
279
+ m(this, Fe, /* @__PURE__ */ new Set());
280
+ /**
281
+ * A map of branches that still exist, but will be destroyed when this batch
282
+ * is committed — we skip over these during `process`.
283
+ * The value contains child effects that were dirty/maybe_dirty before being reset,
284
+ * so they can be rescheduled if the branch survives.
285
+ * @type {Map<Effect, { d: Effect[], m: Effect[] }>}
286
+ */
287
+ m(this, ve, /* @__PURE__ */ new Map());
288
+ T(this, "is_fork", !1);
289
+ m(this, nt, !1);
290
+ }
291
+ is_deferred() {
292
+ return this.is_fork || l(this, tt) > 0;
293
+ }
294
+ /**
295
+ * Add an effect to the #skipped_branches map and reset its children
296
+ * @param {Effect} effect
297
+ */
298
+ skip_effect(t) {
299
+ l(this, ve).has(t) || l(this, ve).set(t, { d: [], m: [] });
300
+ }
301
+ /**
302
+ * Remove an effect from the #skipped_branches map and reschedule
303
+ * any tracked dirty/maybe_dirty child effects
304
+ * @param {Effect} effect
305
+ */
306
+ unskip_effect(t) {
307
+ var n = l(this, ve).get(t);
308
+ if (n) {
309
+ l(this, ve).delete(t);
310
+ for (var r of n.d)
311
+ M(r, D), ee(r);
312
+ for (r of n.m)
313
+ M(r, ne), ee(r);
314
+ }
315
+ }
316
+ /**
317
+ *
318
+ * @param {Effect[]} root_effects
319
+ */
320
+ process(t) {
321
+ F = [], this.apply();
322
+ var n = [], r = [];
323
+ for (const s of t)
324
+ j(this, ce, an).call(this, s, n, r);
325
+ if (this.is_deferred()) {
326
+ j(this, ce, cn).call(this, r), j(this, ce, cn).call(this, n);
327
+ for (const [s, i] of l(this, ve))
328
+ br(s, i);
329
+ } else {
330
+ for (const s of l(this, Qe)) s();
331
+ l(this, Qe).clear(), l(this, je) === 0 && j(this, ce, pr).call(this), x = null, Bn(r), Bn(n), l(this, $t)?.resolve();
332
+ }
333
+ Q = null;
334
+ }
335
+ /**
336
+ * Associate a change to a given source with the current
337
+ * batch, noting its previous and current values
338
+ * @param {Source} source
339
+ * @param {any} value
340
+ */
341
+ capture(t, n) {
342
+ n !== R && !this.previous.has(t) && this.previous.set(t, n), (t.f & Me) === 0 && (this.current.set(t, t.v), Q?.set(t, t.v));
343
+ }
344
+ activate() {
345
+ x = this, this.apply();
346
+ }
347
+ deactivate() {
348
+ x === this && (x = null, Q = null);
349
+ }
350
+ flush() {
351
+ if (this.activate(), F.length > 0) {
352
+ if (gr(), x !== null && x !== this)
353
+ return;
354
+ } else l(this, je) === 0 && this.process([]);
355
+ this.deactivate();
356
+ }
357
+ discard() {
358
+ for (const t of l(this, et)) t(this);
359
+ l(this, et).clear();
360
+ }
361
+ /**
362
+ *
363
+ * @param {boolean} blocking
364
+ */
365
+ increment(t) {
366
+ p(this, je, l(this, je) + 1), t && p(this, tt, l(this, tt) + 1);
367
+ }
368
+ /**
369
+ *
370
+ * @param {boolean} blocking
371
+ */
372
+ decrement(t) {
373
+ p(this, je, l(this, je) - 1), t && p(this, tt, l(this, tt) - 1), !l(this, nt) && (p(this, nt, !0), Ze(() => {
374
+ p(this, nt, !1), this.is_deferred() ? F.length > 0 && this.flush() : this.revive();
375
+ }));
376
+ }
377
+ revive() {
378
+ for (const t of l(this, yt))
379
+ l(this, Fe).delete(t), M(t, D), ee(t);
380
+ for (const t of l(this, Fe))
381
+ M(t, ne), ee(t);
382
+ this.flush();
383
+ }
384
+ /** @param {() => void} fn */
385
+ oncommit(t) {
386
+ l(this, Qe).add(t);
387
+ }
388
+ /** @param {(batch: Batch) => void} fn */
389
+ ondiscard(t) {
390
+ l(this, et).add(t);
391
+ }
392
+ settled() {
393
+ return (l(this, $t) ?? p(this, $t, rr())).promise;
394
+ }
395
+ static ensure() {
396
+ if (x === null) {
397
+ const t = x = new An();
398
+ Ct.add(x), pt || Ze(() => {
399
+ x === t && t.flush();
400
+ });
401
+ }
402
+ return x;
403
+ }
404
+ apply() {
405
+ }
406
+ };
407
+ Qe = new WeakMap(), et = new WeakMap(), je = new WeakMap(), tt = new WeakMap(), $t = new WeakMap(), yt = new WeakMap(), Fe = new WeakMap(), ve = new WeakMap(), nt = new WeakMap(), ce = new WeakSet(), /**
408
+ * Traverse the effect tree, executing effects or stashing
409
+ * them for later execution as appropriate
410
+ * @param {Effect} root
411
+ * @param {Effect[]} effects
412
+ * @param {Effect[]} render_effects
413
+ */
414
+ an = function(t, n, r) {
415
+ t.f ^= N;
416
+ for (var s = t.first, i = null; s !== null; ) {
417
+ var o = s.f, f = (o & (de | Ne)) !== 0, u = f && (o & N) !== 0, a = u || (o & fe) !== 0 || l(this, ve).has(s);
418
+ if (!a && s.fn !== null) {
419
+ f ? s.f ^= N : i !== null && (o & (zt | Wt | sr)) !== 0 ? i.b.defer_effect(s) : (o & zt) !== 0 ? n.push(s) : It(s) && ((o & $e) !== 0 && l(this, Fe).add(s), dt(s));
420
+ var c = s.first;
421
+ if (c !== null) {
422
+ s = c;
423
+ continue;
424
+ }
425
+ }
426
+ for (; s !== null; ) {
427
+ s === i && (i = null);
428
+ var h = s.next;
429
+ if (h !== null) {
430
+ s = h;
431
+ break;
432
+ }
433
+ s = s.parent;
434
+ }
435
+ }
436
+ }, /**
437
+ * @param {Effect[]} effects
438
+ */
439
+ cn = function(t) {
440
+ for (var n = 0; n < t.length; n += 1)
441
+ _r(t[n], l(this, yt), l(this, Fe));
442
+ }, pr = function() {
443
+ var s;
444
+ if (Ct.size > 1) {
445
+ this.previous.clear();
446
+ var t = Q, n = !0;
447
+ for (const i of Ct) {
448
+ if (i === this) {
449
+ n = !1;
450
+ continue;
451
+ }
452
+ const o = [];
453
+ for (const [u, a] of this.current) {
454
+ if (i.current.has(u))
455
+ if (n && a !== i.current.get(u))
456
+ i.current.set(u, a);
457
+ else
458
+ continue;
459
+ o.push(u);
460
+ }
461
+ if (o.length === 0)
462
+ continue;
463
+ const f = [...i.current.keys()].filter((u) => !this.current.has(u));
464
+ if (f.length > 0) {
465
+ var r = F;
466
+ F = [];
467
+ const u = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map();
468
+ for (const c of o)
469
+ mr(c, f, u, a);
470
+ if (F.length > 0) {
471
+ x = i, i.apply();
472
+ for (const c of F)
473
+ j(s = i, ce, an).call(s, c, [], []);
474
+ i.deactivate();
475
+ }
476
+ F = r;
477
+ }
478
+ }
479
+ x = null, Q = t;
480
+ }
481
+ this.committed = !0, Ct.delete(this);
482
+ };
483
+ let be = An;
484
+ function Dt(e) {
485
+ var t = pt;
486
+ pt = !0;
487
+ try {
488
+ for (var n; ; ) {
489
+ if (Vs(), F.length === 0 && (x?.flush(), F.length === 0))
490
+ return Xt = null, /** @type {T} */
491
+ n;
492
+ gr();
493
+ }
494
+ } finally {
495
+ pt = t;
496
+ }
497
+ }
498
+ function gr() {
499
+ un = !0;
500
+ var e = null;
501
+ try {
502
+ for (var t = 0; F.length > 0; ) {
503
+ var n = be.ensure();
504
+ if (t++ > 1e3) {
505
+ var r, s;
506
+ Bs();
507
+ }
508
+ n.process(F), Ae.clear();
509
+ }
510
+ } finally {
511
+ F = [], un = !1, Xt = null;
512
+ }
513
+ }
514
+ function Bs() {
515
+ try {
516
+ As();
517
+ } catch (e) {
518
+ at(e, Xt);
519
+ }
520
+ }
521
+ let he = null;
522
+ function Bn(e) {
523
+ var t = e.length;
524
+ if (t !== 0) {
525
+ for (var n = 0; n < t; ) {
526
+ var r = e[n++];
527
+ if ((r.f & (we | fe)) === 0 && It(r) && (he = /* @__PURE__ */ new Set(), dt(r), r.deps === null && r.first === null && r.nodes === null && r.teardown === null && r.ac === null && Lr(r), he?.size > 0)) {
528
+ Ae.clear();
529
+ for (const s of he) {
530
+ if ((s.f & (we | fe)) !== 0) continue;
531
+ const i = [s];
532
+ let o = s.parent;
533
+ for (; o !== null; )
534
+ he.has(o) && (he.delete(o), i.push(o)), o = o.parent;
535
+ for (let f = i.length - 1; f >= 0; f--) {
536
+ const u = i[f];
537
+ (u.f & (we | fe)) === 0 && dt(u);
538
+ }
539
+ }
540
+ he.clear();
541
+ }
542
+ }
543
+ he = null;
544
+ }
545
+ }
546
+ function mr(e, t, n, r) {
547
+ if (!n.has(e) && (n.add(e), e.reactions !== null))
548
+ for (const s of e.reactions) {
549
+ const i = s.f;
550
+ (i & O) !== 0 ? mr(
551
+ /** @type {Derived} */
552
+ s,
553
+ t,
554
+ n,
555
+ r
556
+ ) : (i & (yn | $e)) !== 0 && (i & D) === 0 && wr(s, t, r) && (M(s, D), ee(
557
+ /** @type {Effect} */
558
+ s
559
+ ));
560
+ }
561
+ }
562
+ function wr(e, t, n) {
563
+ const r = n.get(e);
564
+ if (r !== void 0) return r;
565
+ if (e.deps !== null)
566
+ for (const s of e.deps) {
567
+ if (lt.call(t, s))
568
+ return !0;
569
+ if ((s.f & O) !== 0 && wr(
570
+ /** @type {Derived} */
571
+ s,
572
+ t,
573
+ n
574
+ ))
575
+ return n.set(
576
+ /** @type {Derived} */
577
+ s,
578
+ !0
579
+ ), !0;
580
+ }
581
+ return n.set(e, !1), !1;
582
+ }
583
+ function ee(e) {
584
+ for (var t = Xt = e; t.parent !== null; ) {
585
+ t = t.parent;
586
+ var n = t.f;
587
+ if (un && t === $ && (n & $e) !== 0 && (n & ir) === 0)
588
+ return;
589
+ if ((n & (Ne | de)) !== 0) {
590
+ if ((n & N) === 0) return;
591
+ t.f ^= N;
592
+ }
593
+ }
594
+ F.push(t);
595
+ }
596
+ function br(e, t) {
597
+ if (!((e.f & de) !== 0 && (e.f & N) !== 0)) {
598
+ (e.f & D) !== 0 ? t.d.push(e) : (e.f & ne) !== 0 && t.m.push(e), M(e, N);
599
+ for (var n = e.first; n !== null; )
600
+ br(n, t), n = n.next;
601
+ }
602
+ }
603
+ function Ws(e) {
604
+ let t = 0, n = kt(0), r;
605
+ return () => {
606
+ Tn() && (w(n), Or(() => (t === 0 && (r = Xr(() => e(() => gt(n)))), t += 1, () => {
607
+ Ze(() => {
608
+ t -= 1, t === 0 && (r?.(), r = void 0, gt(n));
609
+ });
610
+ })));
611
+ };
612
+ }
613
+ var qs = ft | qe;
614
+ function Us(e, t, n) {
615
+ new Xs(e, t, n);
616
+ }
617
+ var U, Et, _e, He, se, ie, B, oe, pe, ze, Te, rt, st, it, ge, Yt, L, $r, yr, dn, Pt, hn;
618
+ class Xs {
619
+ /**
620
+ * @param {TemplateNode} node
621
+ * @param {BoundaryProps} props
622
+ * @param {((anchor: Node) => void)} children
623
+ */
624
+ constructor(t, n, r) {
625
+ m(this, L);
626
+ /** @type {Boundary | null} */
627
+ T(this, "parent");
628
+ T(this, "is_pending", !1);
629
+ /** @type {TemplateNode} */
630
+ m(this, U);
631
+ /** @type {TemplateNode | null} */
632
+ m(this, Et, k ? S : null);
633
+ /** @type {BoundaryProps} */
634
+ m(this, _e);
635
+ /** @type {((anchor: Node) => void)} */
636
+ m(this, He);
637
+ /** @type {Effect} */
638
+ m(this, se);
639
+ /** @type {Effect | null} */
640
+ m(this, ie, null);
641
+ /** @type {Effect | null} */
642
+ m(this, B, null);
643
+ /** @type {Effect | null} */
644
+ m(this, oe, null);
645
+ /** @type {DocumentFragment | null} */
646
+ m(this, pe, null);
647
+ m(this, ze, 0);
648
+ m(this, Te, 0);
649
+ m(this, rt, !1);
650
+ /** @type {Set<Effect>} */
651
+ m(this, st, /* @__PURE__ */ new Set());
652
+ /** @type {Set<Effect>} */
653
+ m(this, it, /* @__PURE__ */ new Set());
654
+ /**
655
+ * A source containing the number of pending async deriveds/expressions.
656
+ * Only created if `$effect.pending()` is used inside the boundary,
657
+ * otherwise updating the source results in needless `Batch.ensure()`
658
+ * calls followed by no-op flushes
659
+ * @type {Source<number> | null}
660
+ */
661
+ m(this, ge, null);
662
+ m(this, Yt, Ws(() => (p(this, ge, kt(l(this, ze))), () => {
663
+ p(this, ge, null);
664
+ })));
665
+ p(this, U, t), p(this, _e, n), p(this, He, (s) => {
666
+ var i = (
667
+ /** @type {Effect} */
668
+ $
669
+ );
670
+ i.b = this, i.f |= ln, r(s);
671
+ }), this.parent = /** @type {Effect} */
672
+ $.b, p(this, se, Dr(() => {
673
+ if (k) {
674
+ const s = (
675
+ /** @type {Comment} */
676
+ l(this, Et)
677
+ );
678
+ xn(), s.data === $n ? j(this, L, yr).call(this) : j(this, L, $r).call(this);
679
+ } else
680
+ j(this, L, dn).call(this);
681
+ }, qs)), k && p(this, U, S);
682
+ }
683
+ /**
684
+ * Defer an effect inside a pending boundary until the boundary resolves
685
+ * @param {Effect} effect
686
+ */
687
+ defer_effect(t) {
688
+ _r(t, l(this, st), l(this, it));
689
+ }
690
+ /**
691
+ * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
692
+ * @returns {boolean}
693
+ */
694
+ is_rendered() {
695
+ return !this.is_pending && (!this.parent || this.parent.is_rendered());
696
+ }
697
+ has_pending_snippet() {
698
+ return !!l(this, _e).pending;
699
+ }
700
+ /**
701
+ * Update the source that powers `$effect.pending()` inside this boundary,
702
+ * and controls when the current `pending` snippet (if any) is removed.
703
+ * Do not call from inside the class
704
+ * @param {1 | -1} d
705
+ */
706
+ update_pending_count(t) {
707
+ j(this, L, hn).call(this, t), p(this, ze, l(this, ze) + t), !(!l(this, ge) || l(this, rt)) && (p(this, rt, !0), Ze(() => {
708
+ p(this, rt, !1), l(this, ge) && Vt(l(this, ge), l(this, ze));
709
+ }));
710
+ }
711
+ get_effect_pending() {
712
+ return l(this, Yt).call(this), w(
713
+ /** @type {Source<number>} */
714
+ l(this, ge)
715
+ );
716
+ }
717
+ /** @param {unknown} error */
718
+ error(t) {
719
+ var n = l(this, _e).onerror;
720
+ let r = l(this, _e).failed;
721
+ if (!n && !r)
722
+ throw t;
723
+ l(this, ie) && (z(l(this, ie)), p(this, ie, null)), l(this, B) && (z(l(this, B)), p(this, B, null)), l(this, oe) && (z(l(this, oe)), p(this, oe, null)), k && (ue(
724
+ /** @type {TemplateNode} */
725
+ l(this, Et)
726
+ ), Ls(), ue(lr()));
727
+ var s = !1, i = !1;
728
+ const o = () => {
729
+ if (s) {
730
+ Ps();
731
+ return;
732
+ }
733
+ s = !0, i && Ds(), l(this, oe) !== null && mt(l(this, oe), () => {
734
+ p(this, oe, null);
735
+ }), j(this, L, Pt).call(this, () => {
736
+ be.ensure(), j(this, L, dn).call(this);
737
+ });
738
+ };
739
+ Ze(() => {
740
+ try {
741
+ i = !0, n?.(t, o), i = !1;
742
+ } catch (f) {
743
+ at(f, l(this, se) && l(this, se).parent);
744
+ }
745
+ r && p(this, oe, j(this, L, Pt).call(this, () => {
746
+ be.ensure();
747
+ try {
748
+ return Ie(() => {
749
+ var f = (
750
+ /** @type {Effect} */
751
+ $
752
+ );
753
+ f.b = this, f.f |= ln, r(
754
+ l(this, U),
755
+ () => t,
756
+ () => o
757
+ );
758
+ });
759
+ } catch (f) {
760
+ return at(
761
+ f,
762
+ /** @type {Effect} */
763
+ l(this, se).parent
764
+ ), null;
765
+ }
766
+ }));
767
+ });
768
+ }
769
+ }
770
+ U = new WeakMap(), Et = new WeakMap(), _e = new WeakMap(), He = new WeakMap(), se = new WeakMap(), ie = new WeakMap(), B = new WeakMap(), oe = new WeakMap(), pe = new WeakMap(), ze = new WeakMap(), Te = new WeakMap(), rt = new WeakMap(), st = new WeakMap(), it = new WeakMap(), ge = new WeakMap(), Yt = new WeakMap(), L = new WeakSet(), $r = function() {
771
+ try {
772
+ p(this, ie, Ie(() => l(this, He).call(this, l(this, U))));
773
+ } catch (t) {
774
+ this.error(t);
775
+ }
776
+ }, yr = function() {
777
+ const t = l(this, _e).pending;
778
+ t && (this.is_pending = !0, p(this, B, Ie(() => t(l(this, U)))), Ze(() => {
779
+ var n = p(this, pe, document.createDocumentFragment()), r = We();
780
+ n.append(r), p(this, ie, j(this, L, Pt).call(this, () => (be.ensure(), Ie(() => l(this, He).call(this, r))))), l(this, Te) === 0 && (l(this, U).before(n), p(this, pe, null), mt(
781
+ /** @type {Effect} */
782
+ l(this, B),
783
+ () => {
784
+ p(this, B, null);
785
+ }
786
+ ), this.is_pending = !1);
787
+ }));
788
+ }, dn = function() {
789
+ try {
790
+ if (this.is_pending = this.has_pending_snippet(), p(this, Te, 0), p(this, ze, 0), p(this, ie, Ie(() => {
791
+ l(this, He).call(this, l(this, U));
792
+ })), l(this, Te) > 0) {
793
+ var t = p(this, pe, document.createDocumentFragment());
794
+ Hr(l(this, ie), t);
795
+ const n = (
796
+ /** @type {(anchor: Node) => void} */
797
+ l(this, _e).pending
798
+ );
799
+ p(this, B, Ie(() => n(l(this, U))));
800
+ } else
801
+ this.is_pending = !1;
802
+ } catch (n) {
803
+ this.error(n);
804
+ }
805
+ }, /**
806
+ * @template T
807
+ * @param {() => T} fn
808
+ */
809
+ Pt = function(t) {
810
+ var n = $, r = b, s = V;
811
+ ae(l(this, se)), G(l(this, se)), ut(l(this, se).ctx);
812
+ try {
813
+ return t();
814
+ } catch (i) {
815
+ return hr(i), null;
816
+ } finally {
817
+ ae(n), G(r), ut(s);
818
+ }
819
+ }, /**
820
+ * Updates the pending count associated with the currently visible pending snippet,
821
+ * if any, such that we can replace the snippet with content once work is done
822
+ * @param {1 | -1} d
823
+ */
824
+ hn = function(t) {
825
+ var n;
826
+ if (!this.has_pending_snippet()) {
827
+ this.parent && j(n = this.parent, L, hn).call(n, t);
828
+ return;
829
+ }
830
+ if (p(this, Te, l(this, Te) + t), l(this, Te) === 0) {
831
+ this.is_pending = !1;
832
+ for (const r of l(this, st))
833
+ M(r, D), ee(r);
834
+ for (const r of l(this, it))
835
+ M(r, ne), ee(r);
836
+ l(this, st).clear(), l(this, it).clear(), l(this, B) && mt(l(this, B), () => {
837
+ p(this, B, null);
838
+ }), l(this, pe) && (l(this, U).before(l(this, pe)), p(this, pe, null));
839
+ }
840
+ };
841
+ function Js(e, t, n, r) {
842
+ const s = kn;
843
+ var i = e.filter((d) => !d.settled);
844
+ if (n.length === 0 && i.length === 0) {
845
+ r(t.map(s));
846
+ return;
847
+ }
848
+ var o = x, f = (
849
+ /** @type {Effect} */
850
+ $
851
+ ), u = Ks(), a = i.length === 1 ? i[0].promise : i.length > 1 ? Promise.all(i.map((d) => d.promise)) : null;
852
+ function c(d) {
853
+ u();
854
+ try {
855
+ r(d);
856
+ } catch (g) {
857
+ (f.f & we) === 0 && at(g, f);
858
+ }
859
+ o?.deactivate(), vn();
860
+ }
861
+ if (n.length === 0) {
862
+ a.then(() => c(t.map(s)));
863
+ return;
864
+ }
865
+ function h() {
866
+ u(), Promise.all(n.map((d) => /* @__PURE__ */ Gs(d))).then((d) => c([...t.map(s), ...d])).catch((d) => at(d, f));
867
+ }
868
+ a ? a.then(h) : h();
869
+ }
870
+ function Ks() {
871
+ var e = $, t = b, n = V, r = x;
872
+ return function(i = !0) {
873
+ ae(e), G(t), ut(n), i && r?.activate();
874
+ };
875
+ }
876
+ function vn() {
877
+ ae(null), G(null), ut(null);
878
+ }
879
+ // @__NO_SIDE_EFFECTS__
880
+ function kn(e) {
881
+ var t = O | D, n = b !== null && (b.f & O) !== 0 ? (
882
+ /** @type {Derived} */
883
+ b
884
+ ) : null;
885
+ return $ !== null && ($.f |= qe), {
886
+ ctx: V,
887
+ deps: null,
888
+ effects: null,
889
+ equals: fr,
890
+ f: t,
891
+ fn: e,
892
+ reactions: null,
893
+ rv: 0,
894
+ v: (
895
+ /** @type {V} */
896
+ R
897
+ ),
898
+ wv: 0,
899
+ parent: n ?? $,
900
+ ac: null
901
+ };
902
+ }
903
+ // @__NO_SIDE_EFFECTS__
904
+ function Gs(e, t, n) {
905
+ let r = (
906
+ /** @type {Effect | null} */
907
+ $
908
+ );
909
+ r === null && ks();
910
+ var s = (
911
+ /** @type {Boundary} */
912
+ r.b
913
+ ), i = (
914
+ /** @type {Promise<V>} */
915
+ /** @type {unknown} */
916
+ void 0
917
+ ), o = kt(
918
+ /** @type {V} */
919
+ R
920
+ ), f = !b, u = /* @__PURE__ */ new Map();
921
+ return ci(() => {
922
+ var a = rr();
923
+ i = a.promise;
924
+ try {
925
+ Promise.resolve(e()).then(a.resolve, a.reject).then(() => {
926
+ c === x && c.committed && c.deactivate(), vn();
927
+ });
928
+ } catch (g) {
929
+ a.reject(g), vn();
930
+ }
931
+ var c = (
932
+ /** @type {Batch} */
933
+ x
934
+ );
935
+ if (f) {
936
+ var h = s.is_rendered();
937
+ s.update_pending_count(1), c.increment(h), u.get(c)?.reject(Oe), u.delete(c), u.set(c, a);
938
+ }
939
+ const d = (g, v = void 0) => {
940
+ if (c.activate(), v)
941
+ v !== Oe && (o.f |= Me, Vt(o, v));
942
+ else {
943
+ (o.f & Me) !== 0 && (o.f ^= Me), Vt(o, g);
944
+ for (const [C, y] of u) {
945
+ if (u.delete(C), C === c) break;
946
+ y.reject(Oe);
947
+ }
948
+ }
949
+ f && (s.update_pending_count(-1), c.decrement(h));
950
+ };
951
+ a.promise.then(d, (g) => d(null, g || "unknown"));
952
+ }), fi(() => {
953
+ for (const a of u.values())
954
+ a.reject(Oe);
955
+ }), new Promise((a) => {
956
+ function c(h) {
957
+ function d() {
958
+ h === i ? a(o) : c(i);
959
+ }
960
+ h.then(d, d);
961
+ }
962
+ c(i);
963
+ });
964
+ }
965
+ // @__NO_SIDE_EFFECTS__
966
+ function Zs(e) {
967
+ const t = /* @__PURE__ */ kn(e);
968
+ return zr(t), t;
969
+ }
970
+ function Qs(e) {
971
+ var t = e.effects;
972
+ if (t !== null) {
973
+ e.effects = null;
974
+ for (var n = 0; n < t.length; n += 1)
975
+ z(
976
+ /** @type {Effect} */
977
+ t[n]
978
+ );
979
+ }
980
+ }
981
+ function ei(e) {
982
+ for (var t = e.parent; t !== null; ) {
983
+ if ((t.f & O) === 0)
984
+ return (t.f & we) === 0 ? (
985
+ /** @type {Effect} */
986
+ t
987
+ ) : null;
988
+ t = t.parent;
989
+ }
990
+ return null;
991
+ }
992
+ function In(e) {
993
+ var t, n = $;
994
+ ae(ei(e));
995
+ try {
996
+ e.f &= ~Be, Qs(e), t = Wr(e);
997
+ } finally {
998
+ ae(n);
999
+ }
1000
+ return t;
1001
+ }
1002
+ function Er(e) {
1003
+ var t = In(e);
1004
+ if (!e.equals(t) && (e.wv = Yr(), (!x?.is_fork || e.deps === null) && (e.v = t, e.deps === null))) {
1005
+ M(e, N);
1006
+ return;
1007
+ }
1008
+ Ce || (Q !== null ? (Tn() || x?.is_fork) && Q.set(e, t) : Sn(e));
1009
+ }
1010
+ function ti(e) {
1011
+ if (e.effects !== null)
1012
+ for (const t of e.effects)
1013
+ (t.teardown || t.ac) && (t.teardown?.(), t.ac?.abort(Oe), t.teardown = ys, t.ac = null, wt(t, 0), Mn(t));
1014
+ }
1015
+ function xr(e) {
1016
+ if (e.effects !== null)
1017
+ for (const t of e.effects)
1018
+ t.teardown && dt(t);
1019
+ }
1020
+ let _n = /* @__PURE__ */ new Set();
1021
+ const Ae = /* @__PURE__ */ new Map();
1022
+ let Sr = !1;
1023
+ function kt(e, t) {
1024
+ var n = {
1025
+ f: 0,
1026
+ // TODO ideally we could skip this altogether, but it causes type errors
1027
+ v: e,
1028
+ reactions: null,
1029
+ equals: fr,
1030
+ rv: 0,
1031
+ wv: 0
1032
+ };
1033
+ return n;
1034
+ }
1035
+ // @__NO_SIDE_EFFECTS__
1036
+ function P(e, t) {
1037
+ const n = kt(e);
1038
+ return zr(n), n;
1039
+ }
1040
+ // @__NO_SIDE_EFFECTS__
1041
+ function ni(e, t = !1, n = !0) {
1042
+ const r = kt(e);
1043
+ return t || (r.equals = Hs), r;
1044
+ }
1045
+ function E(e, t, n = !1) {
1046
+ b !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
1047
+ // to ensure we error if state is set inside an inspect effect
1048
+ (!te || (b.f & Yn) !== 0) && cr() && (b.f & (O | $e | yn | Yn)) !== 0 && (K === null || !lt.call(K, e)) && Os();
1049
+ let r = n ? Ke(t) : t;
1050
+ return Vt(e, r);
1051
+ }
1052
+ function Vt(e, t) {
1053
+ if (!e.equals(t)) {
1054
+ var n = e.v;
1055
+ Ce ? Ae.set(e, t) : Ae.set(e, n), e.v = t;
1056
+ var r = be.ensure();
1057
+ if (r.capture(e, n), (e.f & O) !== 0) {
1058
+ const s = (
1059
+ /** @type {Derived} */
1060
+ e
1061
+ );
1062
+ (e.f & D) !== 0 && In(s), Sn(s);
1063
+ }
1064
+ e.wv = Yr(), kr(e, D), $ !== null && ($.f & N) !== 0 && ($.f & (de | Ne)) === 0 && (q === null ? _i([e]) : q.push(e)), !r.is_fork && _n.size > 0 && !Sr && ri();
1065
+ }
1066
+ return t;
1067
+ }
1068
+ function ri() {
1069
+ Sr = !1;
1070
+ for (const e of _n)
1071
+ (e.f & N) !== 0 && M(e, ne), It(e) && dt(e);
1072
+ _n.clear();
1073
+ }
1074
+ function gt(e) {
1075
+ E(e, e.v + 1);
1076
+ }
1077
+ function kr(e, t) {
1078
+ var n = e.reactions;
1079
+ if (n !== null)
1080
+ for (var r = n.length, s = 0; s < r; s++) {
1081
+ var i = n[s], o = i.f, f = (o & D) === 0;
1082
+ if (f && M(i, t), (o & O) !== 0) {
1083
+ var u = (
1084
+ /** @type {Derived} */
1085
+ i
1086
+ );
1087
+ Q?.delete(u), (o & Be) === 0 && (o & J && (i.f |= Be), kr(u, ne));
1088
+ } else f && ((o & $e) !== 0 && he !== null && he.add(
1089
+ /** @type {Effect} */
1090
+ i
1091
+ ), ee(
1092
+ /** @type {Effect} */
1093
+ i
1094
+ ));
1095
+ }
1096
+ }
1097
+ function Ke(e) {
1098
+ if (typeof e != "object" || e === null || nn in e)
1099
+ return e;
1100
+ const t = nr(e);
1101
+ if (t !== bs && t !== $s)
1102
+ return e;
1103
+ var n = /* @__PURE__ */ new Map(), r = tr(e), s = /* @__PURE__ */ P(0), i = Ye, o = (f) => {
1104
+ if (Ye === i)
1105
+ return f();
1106
+ var u = b, a = Ye;
1107
+ G(null), Un(i);
1108
+ var c = f();
1109
+ return G(u), Un(a), c;
1110
+ };
1111
+ return r && n.set("length", /* @__PURE__ */ P(
1112
+ /** @type {any[]} */
1113
+ e.length
1114
+ )), new Proxy(
1115
+ /** @type {any} */
1116
+ e,
1117
+ {
1118
+ defineProperty(f, u, a) {
1119
+ (!("value" in a) || a.configurable === !1 || a.enumerable === !1 || a.writable === !1) && Ns();
1120
+ var c = n.get(u);
1121
+ return c === void 0 ? o(() => {
1122
+ var h = /* @__PURE__ */ P(a.value);
1123
+ return n.set(u, h), h;
1124
+ }) : E(c, a.value, !0), !0;
1125
+ },
1126
+ deleteProperty(f, u) {
1127
+ var a = n.get(u);
1128
+ if (a === void 0) {
1129
+ if (u in f) {
1130
+ const c = o(() => /* @__PURE__ */ P(R));
1131
+ n.set(u, c), gt(s);
1132
+ }
1133
+ } else
1134
+ E(a, R), gt(s);
1135
+ return !0;
1136
+ },
1137
+ get(f, u, a) {
1138
+ if (u === nn)
1139
+ return e;
1140
+ var c = n.get(u), h = u in f;
1141
+ if (c === void 0 && (!h || Ge(f, u)?.writable) && (c = o(() => {
1142
+ var g = Ke(h ? f[u] : R), v = /* @__PURE__ */ P(g);
1143
+ return v;
1144
+ }), n.set(u, c)), c !== void 0) {
1145
+ var d = w(c);
1146
+ return d === R ? void 0 : d;
1147
+ }
1148
+ return Reflect.get(f, u, a);
1149
+ },
1150
+ getOwnPropertyDescriptor(f, u) {
1151
+ var a = Reflect.getOwnPropertyDescriptor(f, u);
1152
+ if (a && "value" in a) {
1153
+ var c = n.get(u);
1154
+ c && (a.value = w(c));
1155
+ } else if (a === void 0) {
1156
+ var h = n.get(u), d = h?.v;
1157
+ if (h !== void 0 && d !== R)
1158
+ return {
1159
+ enumerable: !0,
1160
+ configurable: !0,
1161
+ value: d,
1162
+ writable: !0
1163
+ };
1164
+ }
1165
+ return a;
1166
+ },
1167
+ has(f, u) {
1168
+ if (u === nn)
1169
+ return !0;
1170
+ var a = n.get(u), c = a !== void 0 && a.v !== R || Reflect.has(f, u);
1171
+ if (a !== void 0 || $ !== null && (!c || Ge(f, u)?.writable)) {
1172
+ a === void 0 && (a = o(() => {
1173
+ var d = c ? Ke(f[u]) : R, g = /* @__PURE__ */ P(d);
1174
+ return g;
1175
+ }), n.set(u, a));
1176
+ var h = w(a);
1177
+ if (h === R)
1178
+ return !1;
1179
+ }
1180
+ return c;
1181
+ },
1182
+ set(f, u, a, c) {
1183
+ var h = n.get(u), d = u in f;
1184
+ if (r && u === "length")
1185
+ for (var g = a; g < /** @type {Source<number>} */
1186
+ h.v; g += 1) {
1187
+ var v = n.get(g + "");
1188
+ v !== void 0 ? E(v, R) : g in f && (v = o(() => /* @__PURE__ */ P(R)), n.set(g + "", v));
1189
+ }
1190
+ if (h === void 0)
1191
+ (!d || Ge(f, u)?.writable) && (h = o(() => /* @__PURE__ */ P(void 0)), E(h, Ke(a)), n.set(u, h));
1192
+ else {
1193
+ d = h.v !== R;
1194
+ var C = o(() => Ke(a));
1195
+ E(h, C);
1196
+ }
1197
+ var y = Reflect.getOwnPropertyDescriptor(f, u);
1198
+ if (y?.set && y.set.call(c, a), !d) {
1199
+ if (r && typeof u == "string") {
1200
+ var Ee = (
1201
+ /** @type {Source<number>} */
1202
+ n.get("length")
1203
+ ), re = Number(u);
1204
+ Number.isInteger(re) && re >= Ee.v && E(Ee, re + 1);
1205
+ }
1206
+ gt(s);
1207
+ }
1208
+ return !0;
1209
+ },
1210
+ ownKeys(f) {
1211
+ w(s);
1212
+ var u = Reflect.ownKeys(f).filter((h) => {
1213
+ var d = n.get(h);
1214
+ return d === void 0 || d.v !== R;
1215
+ });
1216
+ for (var [a, c] of n)
1217
+ c.v !== R && !(a in f) && u.push(a);
1218
+ return u;
1219
+ },
1220
+ setPrototypeOf() {
1221
+ Rs();
1222
+ }
1223
+ }
1224
+ );
1225
+ }
1226
+ var Wn, Ir, Tr, Mr;
1227
+ function pn() {
1228
+ if (Wn === void 0) {
1229
+ Wn = window, Ir = /Firefox/.test(navigator.userAgent);
1230
+ var e = Element.prototype, t = Node.prototype, n = Text.prototype;
1231
+ Tr = Ge(t, "firstChild").get, Mr = Ge(t, "nextSibling").get, Vn(e) && (e.__click = void 0, e.__className = void 0, e.__attributes = null, e.__style = void 0, e.__e = void 0), Vn(n) && (n.__t = void 0);
1232
+ }
1233
+ }
1234
+ function We(e = "") {
1235
+ return document.createTextNode(e);
1236
+ }
1237
+ // @__NO_SIDE_EFFECTS__
1238
+ function ct(e) {
1239
+ return (
1240
+ /** @type {TemplateNode | null} */
1241
+ Tr.call(e)
1242
+ );
1243
+ }
1244
+ // @__NO_SIDE_EFFECTS__
1245
+ function Re(e) {
1246
+ return (
1247
+ /** @type {TemplateNode | null} */
1248
+ Mr.call(e)
1249
+ );
1250
+ }
1251
+ function Se(e, t) {
1252
+ if (!k)
1253
+ return /* @__PURE__ */ ct(e);
1254
+ var n = /* @__PURE__ */ ct(S);
1255
+ if (n === null)
1256
+ n = S.appendChild(We());
1257
+ else if (t && n.nodeType !== En) {
1258
+ var r = We();
1259
+ return n?.before(r), ue(r), r;
1260
+ }
1261
+ return t && Cr(
1262
+ /** @type {Text} */
1263
+ n
1264
+ ), ue(n), n;
1265
+ }
1266
+ function Xe(e, t = 1, n = !1) {
1267
+ let r = k ? S : e;
1268
+ for (var s; t--; )
1269
+ s = r, r = /** @type {TemplateNode} */
1270
+ /* @__PURE__ */ Re(r);
1271
+ if (!k)
1272
+ return r;
1273
+ if (n) {
1274
+ if (r?.nodeType !== En) {
1275
+ var i = We();
1276
+ return r === null ? s?.after(i) : r.before(i), ue(i), i;
1277
+ }
1278
+ Cr(
1279
+ /** @type {Text} */
1280
+ r
1281
+ );
1282
+ }
1283
+ return ue(r), r;
1284
+ }
1285
+ function si(e) {
1286
+ e.textContent = "";
1287
+ }
1288
+ function ii() {
1289
+ return !1;
1290
+ }
1291
+ function Ar(e, t, n) {
1292
+ return (
1293
+ /** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */
1294
+ document.createElementNS(er, e, void 0)
1295
+ );
1296
+ }
1297
+ function Cr(e) {
1298
+ if (
1299
+ /** @type {string} */
1300
+ e.nodeValue.length < 65536
1301
+ )
1302
+ return;
1303
+ let t = e.nextSibling;
1304
+ for (; t !== null && t.nodeType === En; )
1305
+ t.remove(), e.nodeValue += /** @type {string} */
1306
+ t.nodeValue, t = e.nextSibling;
1307
+ }
1308
+ function Nr(e) {
1309
+ var t = b, n = $;
1310
+ G(null), ae(null);
1311
+ try {
1312
+ return e();
1313
+ } finally {
1314
+ G(t), ae(n);
1315
+ }
1316
+ }
1317
+ function oi(e) {
1318
+ $ === null && (b === null && Ms(), Ts()), Ce && Is();
1319
+ }
1320
+ function li(e, t) {
1321
+ var n = t.last;
1322
+ n === null ? t.last = t.first = e : (n.next = e, e.prev = n, t.last = e);
1323
+ }
1324
+ function ye(e, t, n) {
1325
+ var r = $;
1326
+ r !== null && (r.f & fe) !== 0 && (e |= fe);
1327
+ var s = {
1328
+ ctx: V,
1329
+ deps: null,
1330
+ nodes: null,
1331
+ f: e | D | J,
1332
+ first: null,
1333
+ fn: t,
1334
+ last: null,
1335
+ next: null,
1336
+ parent: r,
1337
+ b: r && r.b,
1338
+ prev: null,
1339
+ teardown: null,
1340
+ wv: 0,
1341
+ ac: null
1342
+ };
1343
+ if (n)
1344
+ try {
1345
+ dt(s);
1346
+ } catch (f) {
1347
+ throw z(s), f;
1348
+ }
1349
+ else t !== null && ee(s);
1350
+ var i = s;
1351
+ if (n && i.deps === null && i.teardown === null && i.nodes === null && i.first === i.last && // either `null`, or a singular child
1352
+ (i.f & qe) === 0 && (i = i.first, (e & $e) !== 0 && (e & ft) !== 0 && i !== null && (i.f |= ft)), i !== null && (i.parent = r, r !== null && li(i, r), b !== null && (b.f & O) !== 0 && (e & Ne) === 0)) {
1353
+ var o = (
1354
+ /** @type {Derived} */
1355
+ b
1356
+ );
1357
+ (o.effects ?? (o.effects = [])).push(i);
1358
+ }
1359
+ return s;
1360
+ }
1361
+ function Tn() {
1362
+ return b !== null && !te;
1363
+ }
1364
+ function fi(e) {
1365
+ const t = ye(Wt, null, !1);
1366
+ return M(t, N), t.teardown = e, t;
1367
+ }
1368
+ function gn(e) {
1369
+ oi();
1370
+ var t = (
1371
+ /** @type {Effect} */
1372
+ $.f
1373
+ ), n = !b && (t & de) !== 0 && (t & ht) === 0;
1374
+ if (n) {
1375
+ var r = (
1376
+ /** @type {ComponentContext} */
1377
+ V
1378
+ );
1379
+ (r.e ?? (r.e = [])).push(e);
1380
+ } else
1381
+ return Rr(e);
1382
+ }
1383
+ function Rr(e) {
1384
+ return ye(zt | xs, e, !1);
1385
+ }
1386
+ function ui(e) {
1387
+ be.ensure();
1388
+ const t = ye(Ne | qe, e, !0);
1389
+ return () => {
1390
+ z(t);
1391
+ };
1392
+ }
1393
+ function ai(e) {
1394
+ be.ensure();
1395
+ const t = ye(Ne | qe, e, !0);
1396
+ return (n = {}) => new Promise((r) => {
1397
+ n.outro ? mt(t, () => {
1398
+ z(t), r(void 0);
1399
+ }) : (z(t), r(void 0));
1400
+ });
1401
+ }
1402
+ function ci(e) {
1403
+ return ye(yn | qe, e, !0);
1404
+ }
1405
+ function Or(e, t = 0) {
1406
+ return ye(Wt | t, e, !0);
1407
+ }
1408
+ function rn(e, t = [], n = [], r = []) {
1409
+ Js(r, t, n, (s) => {
1410
+ ye(Wt, () => e(...s.map(w)), !0);
1411
+ });
1412
+ }
1413
+ function Dr(e, t = 0) {
1414
+ var n = ye($e | t, e, !0);
1415
+ return n;
1416
+ }
1417
+ function Ie(e) {
1418
+ return ye(de | qe, e, !0);
1419
+ }
1420
+ function Pr(e) {
1421
+ var t = e.teardown;
1422
+ if (t !== null) {
1423
+ const n = Ce, r = b;
1424
+ qn(!0), G(null);
1425
+ try {
1426
+ t.call(null);
1427
+ } finally {
1428
+ qn(n), G(r);
1429
+ }
1430
+ }
1431
+ }
1432
+ function Mn(e, t = !1) {
1433
+ var n = e.first;
1434
+ for (e.first = e.last = null; n !== null; ) {
1435
+ const s = n.ac;
1436
+ s !== null && Nr(() => {
1437
+ s.abort(Oe);
1438
+ });
1439
+ var r = n.next;
1440
+ (n.f & Ne) !== 0 ? n.parent = null : z(n, t), n = r;
1441
+ }
1442
+ }
1443
+ function di(e) {
1444
+ for (var t = e.first; t !== null; ) {
1445
+ var n = t.next;
1446
+ (t.f & de) === 0 && z(t), t = n;
1447
+ }
1448
+ }
1449
+ function z(e, t = !0) {
1450
+ var n = !1;
1451
+ (t || (e.f & ir) !== 0) && e.nodes !== null && e.nodes.end !== null && (hi(
1452
+ e.nodes.start,
1453
+ /** @type {TemplateNode} */
1454
+ e.nodes.end
1455
+ ), n = !0), Mn(e, t && !n), wt(e, 0), M(e, we);
1456
+ var r = e.nodes && e.nodes.t;
1457
+ if (r !== null)
1458
+ for (const i of r)
1459
+ i.stop();
1460
+ Pr(e);
1461
+ var s = e.parent;
1462
+ s !== null && s.first !== null && Lr(e), e.next = e.prev = e.teardown = e.ctx = e.deps = e.fn = e.nodes = e.ac = null;
1463
+ }
1464
+ function hi(e, t) {
1465
+ for (; e !== null; ) {
1466
+ var n = e === t ? null : /* @__PURE__ */ Re(e);
1467
+ e.remove(), e = n;
1468
+ }
1469
+ }
1470
+ function Lr(e) {
1471
+ var t = e.parent, n = e.prev, r = e.next;
1472
+ n !== null && (n.next = r), r !== null && (r.prev = n), t !== null && (t.first === e && (t.first = r), t.last === e && (t.last = n));
1473
+ }
1474
+ function mt(e, t, n = !0) {
1475
+ var r = [];
1476
+ jr(e, r, !0);
1477
+ var s = () => {
1478
+ n && z(e), t && t();
1479
+ }, i = r.length;
1480
+ if (i > 0) {
1481
+ var o = () => --i || s();
1482
+ for (var f of r)
1483
+ f.out(o);
1484
+ } else
1485
+ s();
1486
+ }
1487
+ function jr(e, t, n) {
1488
+ if ((e.f & fe) === 0) {
1489
+ e.f ^= fe;
1490
+ var r = e.nodes && e.nodes.t;
1491
+ if (r !== null)
1492
+ for (const f of r)
1493
+ (f.is_global || n) && t.push(f);
1494
+ for (var s = e.first; s !== null; ) {
1495
+ var i = s.next, o = (s.f & ft) !== 0 || // If this is a branch effect without a block effect parent,
1496
+ // it means the parent block effect was pruned. In that case,
1497
+ // transparency information was transferred to the branch effect.
1498
+ (s.f & de) !== 0 && (e.f & $e) !== 0;
1499
+ jr(s, t, o ? n : !1), s = i;
1500
+ }
1501
+ }
1502
+ }
1503
+ function vi(e) {
1504
+ Fr(e, !0);
1505
+ }
1506
+ function Fr(e, t) {
1507
+ if ((e.f & fe) !== 0) {
1508
+ e.f ^= fe, (e.f & N) === 0 && (M(e, D), ee(e));
1509
+ for (var n = e.first; n !== null; ) {
1510
+ var r = n.next, s = (n.f & ft) !== 0 || (n.f & de) !== 0;
1511
+ Fr(n, s ? t : !1), n = r;
1512
+ }
1513
+ var i = e.nodes && e.nodes.t;
1514
+ if (i !== null)
1515
+ for (const o of i)
1516
+ (o.is_global || t) && o.in();
1517
+ }
1518
+ }
1519
+ function Hr(e, t) {
1520
+ if (e.nodes)
1521
+ for (var n = e.nodes.start, r = e.nodes.end; n !== null; ) {
1522
+ var s = n === r ? null : /* @__PURE__ */ Re(n);
1523
+ t.append(n), n = s;
1524
+ }
1525
+ }
1526
+ let Lt = !1, Ce = !1;
1527
+ function qn(e) {
1528
+ Ce = e;
1529
+ }
1530
+ let b = null, te = !1;
1531
+ function G(e) {
1532
+ b = e;
1533
+ }
1534
+ let $ = null;
1535
+ function ae(e) {
1536
+ $ = e;
1537
+ }
1538
+ let K = null;
1539
+ function zr(e) {
1540
+ b !== null && (K === null ? K = [e] : K.push(e));
1541
+ }
1542
+ let H = null, Y = 0, q = null;
1543
+ function _i(e) {
1544
+ q = e;
1545
+ }
1546
+ let Vr = 1, Pe = 0, Ye = Pe;
1547
+ function Un(e) {
1548
+ Ye = e;
1549
+ }
1550
+ function Yr() {
1551
+ return ++Vr;
1552
+ }
1553
+ function It(e) {
1554
+ var t = e.f;
1555
+ if ((t & D) !== 0)
1556
+ return !0;
1557
+ if (t & O && (e.f &= ~Be), (t & ne) !== 0) {
1558
+ for (var n = (
1559
+ /** @type {Value[]} */
1560
+ e.deps
1561
+ ), r = n.length, s = 0; s < r; s++) {
1562
+ var i = n[s];
1563
+ if (It(
1564
+ /** @type {Derived} */
1565
+ i
1566
+ ) && Er(
1567
+ /** @type {Derived} */
1568
+ i
1569
+ ), i.wv > e.wv)
1570
+ return !0;
1571
+ }
1572
+ (t & J) !== 0 && // During time traveling we don't want to reset the status so that
1573
+ // traversal of the graph in the other batches still happens
1574
+ Q === null && M(e, N);
1575
+ }
1576
+ return !1;
1577
+ }
1578
+ function Br(e, t, n = !0) {
1579
+ var r = e.reactions;
1580
+ if (r !== null && !(K !== null && lt.call(K, e)))
1581
+ for (var s = 0; s < r.length; s++) {
1582
+ var i = r[s];
1583
+ (i.f & O) !== 0 ? Br(
1584
+ /** @type {Derived} */
1585
+ i,
1586
+ t,
1587
+ !1
1588
+ ) : t === i && (n ? M(i, D) : (i.f & N) !== 0 && M(i, ne), ee(
1589
+ /** @type {Effect} */
1590
+ i
1591
+ ));
1592
+ }
1593
+ }
1594
+ function Wr(e) {
1595
+ var C;
1596
+ var t = H, n = Y, r = q, s = b, i = K, o = V, f = te, u = Ye, a = e.f;
1597
+ H = /** @type {null | Value[]} */
1598
+ null, Y = 0, q = null, b = (a & (de | Ne)) === 0 ? e : null, K = null, ut(e.ctx), te = !1, Ye = ++Pe, e.ac !== null && (Nr(() => {
1599
+ e.ac.abort(Oe);
1600
+ }), e.ac = null);
1601
+ try {
1602
+ e.f |= fn;
1603
+ var c = (
1604
+ /** @type {Function} */
1605
+ e.fn
1606
+ ), h = c();
1607
+ e.f |= ht;
1608
+ var d = e.deps, g = x?.is_fork;
1609
+ if (H !== null) {
1610
+ var v;
1611
+ if (g || wt(e, Y), d !== null && Y > 0)
1612
+ for (d.length = Y + H.length, v = 0; v < H.length; v++)
1613
+ d[Y + v] = H[v];
1614
+ else
1615
+ e.deps = d = H;
1616
+ if (Tn() && (e.f & J) !== 0)
1617
+ for (v = Y; v < d.length; v++)
1618
+ ((C = d[v]).reactions ?? (C.reactions = [])).push(e);
1619
+ } else !g && d !== null && Y < d.length && (wt(e, Y), d.length = Y);
1620
+ if (cr() && q !== null && !te && d !== null && (e.f & (O | ne | D)) === 0)
1621
+ for (v = 0; v < /** @type {Source[]} */
1622
+ q.length; v++)
1623
+ Br(
1624
+ q[v],
1625
+ /** @type {Effect} */
1626
+ e
1627
+ );
1628
+ if (s !== null && s !== e) {
1629
+ if (Pe++, s.deps !== null)
1630
+ for (let y = 0; y < n; y += 1)
1631
+ s.deps[y].rv = Pe;
1632
+ if (t !== null)
1633
+ for (const y of t)
1634
+ y.rv = Pe;
1635
+ q !== null && (r === null ? r = q : r.push(.../** @type {Source[]} */
1636
+ q));
1637
+ }
1638
+ return (e.f & Me) !== 0 && (e.f ^= Me), h;
1639
+ } catch (y) {
1640
+ return hr(y);
1641
+ } finally {
1642
+ e.f ^= fn, H = t, Y = n, q = r, b = s, K = i, ut(o), te = f, Ye = u;
1643
+ }
1644
+ }
1645
+ function pi(e, t) {
1646
+ let n = t.reactions;
1647
+ if (n !== null) {
1648
+ var r = gs.call(n, e);
1649
+ if (r !== -1) {
1650
+ var s = n.length - 1;
1651
+ s === 0 ? n = t.reactions = null : (n[r] = n[s], n.pop());
1652
+ }
1653
+ }
1654
+ if (n === null && (t.f & O) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
1655
+ // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
1656
+ // allows us to skip the expensive work of disconnecting and immediately reconnecting it
1657
+ (H === null || !lt.call(H, t))) {
1658
+ var i = (
1659
+ /** @type {Derived} */
1660
+ t
1661
+ );
1662
+ (i.f & J) !== 0 && (i.f ^= J, i.f &= ~Be), Sn(i), ti(i), wt(i, 0);
1663
+ }
1664
+ }
1665
+ function wt(e, t) {
1666
+ var n = e.deps;
1667
+ if (n !== null)
1668
+ for (var r = t; r < n.length; r++)
1669
+ pi(e, n[r]);
1670
+ }
1671
+ function dt(e) {
1672
+ var t = e.f;
1673
+ if ((t & we) === 0) {
1674
+ M(e, N);
1675
+ var n = $, r = Lt;
1676
+ $ = e, Lt = !0;
1677
+ try {
1678
+ (t & ($e | sr)) !== 0 ? di(e) : Mn(e), Pr(e);
1679
+ var s = Wr(e);
1680
+ e.teardown = typeof s == "function" ? s : null, e.wv = Vr;
1681
+ var i;
1682
+ on && zs && (e.f & D) !== 0 && e.deps;
1683
+ } finally {
1684
+ Lt = r, $ = n;
1685
+ }
1686
+ }
1687
+ }
1688
+ function w(e) {
1689
+ var t = e.f, n = (t & O) !== 0;
1690
+ if (b !== null && !te) {
1691
+ var r = $ !== null && ($.f & we) !== 0;
1692
+ if (!r && (K === null || !lt.call(K, e))) {
1693
+ var s = b.deps;
1694
+ if ((b.f & fn) !== 0)
1695
+ e.rv < Pe && (e.rv = Pe, H === null && s !== null && s[Y] === e ? Y++ : H === null ? H = [e] : H.push(e));
1696
+ else {
1697
+ (b.deps ?? (b.deps = [])).push(e);
1698
+ var i = e.reactions;
1699
+ i === null ? e.reactions = [b] : lt.call(i, b) || i.push(b);
1700
+ }
1701
+ }
1702
+ }
1703
+ if (Ce && Ae.has(e))
1704
+ return Ae.get(e);
1705
+ if (n) {
1706
+ var o = (
1707
+ /** @type {Derived} */
1708
+ e
1709
+ );
1710
+ if (Ce) {
1711
+ var f = o.v;
1712
+ return ((o.f & N) === 0 && o.reactions !== null || Ur(o)) && (f = In(o)), Ae.set(o, f), f;
1713
+ }
1714
+ var u = (o.f & J) === 0 && !te && b !== null && (Lt || (b.f & J) !== 0), a = (o.f & ht) === 0;
1715
+ It(o) && (u && (o.f |= J), Er(o)), u && !a && (xr(o), qr(o));
1716
+ }
1717
+ if (Q?.has(e))
1718
+ return Q.get(e);
1719
+ if ((e.f & Me) !== 0)
1720
+ throw e.v;
1721
+ return e.v;
1722
+ }
1723
+ function qr(e) {
1724
+ if (e.f |= J, e.deps !== null)
1725
+ for (const t of e.deps)
1726
+ (t.reactions ?? (t.reactions = [])).push(e), (t.f & O) !== 0 && (t.f & J) === 0 && (xr(
1727
+ /** @type {Derived} */
1728
+ t
1729
+ ), qr(
1730
+ /** @type {Derived} */
1731
+ t
1732
+ ));
1733
+ }
1734
+ function Ur(e) {
1735
+ if (e.v === R) return !0;
1736
+ if (e.deps === null) return !1;
1737
+ for (const t of e.deps)
1738
+ if (Ae.has(t) || (t.f & O) !== 0 && Ur(
1739
+ /** @type {Derived} */
1740
+ t
1741
+ ))
1742
+ return !0;
1743
+ return !1;
1744
+ }
1745
+ function Xr(e) {
1746
+ var t = te;
1747
+ try {
1748
+ return te = !0, e();
1749
+ } finally {
1750
+ te = t;
1751
+ }
1752
+ }
1753
+ const Le = /* @__PURE__ */ Symbol("events"), Jr = /* @__PURE__ */ new Set(), mn = /* @__PURE__ */ new Set();
1754
+ function Nt(e, t, n) {
1755
+ (t[Le] ?? (t[Le] = {}))[e] = n;
1756
+ }
1757
+ function gi(e) {
1758
+ for (var t = 0; t < e.length; t++)
1759
+ Jr.add(e[t]);
1760
+ for (var n of mn)
1761
+ n(e);
1762
+ }
1763
+ let Xn = null;
1764
+ function Jn(e) {
1765
+ var t = this, n = (
1766
+ /** @type {Node} */
1767
+ t.ownerDocument
1768
+ ), r = e.type, s = e.composedPath?.() || [], i = (
1769
+ /** @type {null | Element} */
1770
+ s[0] || e.target
1771
+ );
1772
+ Xn = e;
1773
+ var o = 0, f = Xn === e && e[Le];
1774
+ if (f) {
1775
+ var u = s.indexOf(f);
1776
+ if (u !== -1 && (t === document || t === /** @type {any} */
1777
+ window)) {
1778
+ e[Le] = t;
1779
+ return;
1780
+ }
1781
+ var a = s.indexOf(t);
1782
+ if (a === -1)
1783
+ return;
1784
+ u <= a && (o = u);
1785
+ }
1786
+ if (i = /** @type {Element} */
1787
+ s[o] || e.target, i !== t) {
1788
+ Ht(e, "currentTarget", {
1789
+ configurable: !0,
1790
+ get() {
1791
+ return i || n;
1792
+ }
1793
+ });
1794
+ var c = b, h = $;
1795
+ G(null), ae(null);
1796
+ try {
1797
+ for (var d, g = []; i !== null; ) {
1798
+ var v = i.assignedSlot || i.parentNode || /** @type {any} */
1799
+ i.host || null;
1800
+ try {
1801
+ var C = i[Le]?.[r];
1802
+ C != null && (!/** @type {any} */
1803
+ i.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
1804
+ // -> the target could not have been disabled because it emits the event in the first place
1805
+ e.target === i) && C.call(i, e);
1806
+ } catch (y) {
1807
+ d ? g.push(y) : d = y;
1808
+ }
1809
+ if (e.cancelBubble || v === t || v === null)
1810
+ break;
1811
+ i = v;
1812
+ }
1813
+ if (d) {
1814
+ for (let y of g)
1815
+ queueMicrotask(() => {
1816
+ throw y;
1817
+ });
1818
+ throw d;
1819
+ }
1820
+ } finally {
1821
+ e[Le] = t, delete e.currentTarget, G(c), ae(h);
1822
+ }
1823
+ }
1824
+ }
1825
+ const mi = (
1826
+ // We gotta write it like this because after downleveling the pure comment may end up in the wrong location
1827
+ globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", {
1828
+ /** @param {string} html */
1829
+ createHTML: (e) => e
1830
+ })
1831
+ );
1832
+ function wi(e) {
1833
+ return (
1834
+ /** @type {string} */
1835
+ mi?.createHTML(e) ?? e
1836
+ );
1837
+ }
1838
+ function Kr(e, t = !1) {
1839
+ var n = Ar("template");
1840
+ return e = e.replaceAll("<!>", "<!---->"), n.innerHTML = t ? wi(e) : e, n.content;
1841
+ }
1842
+ function bt(e, t) {
1843
+ var n = (
1844
+ /** @type {Effect} */
1845
+ $
1846
+ );
1847
+ n.nodes === null && (n.nodes = { start: e, end: t, a: null, t: null });
1848
+ }
1849
+ // @__NO_SIDE_EFFECTS__
1850
+ function Tt(e, t) {
1851
+ var n = (t & ps) !== 0, r, s = !e.startsWith("<!>");
1852
+ return () => {
1853
+ if (k)
1854
+ return bt(S, null), S;
1855
+ r === void 0 && (r = Kr(s ? e : "<!>" + e, !0), r = /** @type {TemplateNode} */
1856
+ /* @__PURE__ */ ct(r));
1857
+ var i = (
1858
+ /** @type {TemplateNode} */
1859
+ n || Ir ? document.importNode(r, !0) : r.cloneNode(!0)
1860
+ );
1861
+ return bt(i, i), i;
1862
+ };
1863
+ }
1864
+ // @__NO_SIDE_EFFECTS__
1865
+ function bi(e, t, n = "svg") {
1866
+ var r = !e.startsWith("<!>"), s = `<${n}>${r ? e : "<!>" + e}</${n}>`, i;
1867
+ return () => {
1868
+ if (k)
1869
+ return bt(S, null), S;
1870
+ if (!i) {
1871
+ var o = (
1872
+ /** @type {DocumentFragment} */
1873
+ Kr(s, !0)
1874
+ ), f = (
1875
+ /** @type {Element} */
1876
+ /* @__PURE__ */ ct(o)
1877
+ );
1878
+ i = /** @type {Element} */
1879
+ /* @__PURE__ */ ct(f);
1880
+ }
1881
+ var u = (
1882
+ /** @type {TemplateNode} */
1883
+ i.cloneNode(!0)
1884
+ );
1885
+ return bt(u, u), u;
1886
+ };
1887
+ }
1888
+ // @__NO_SIDE_EFFECTS__
1889
+ function Gr(e, t) {
1890
+ return /* @__PURE__ */ bi(e, t, "svg");
1891
+ }
1892
+ function ke(e, t) {
1893
+ if (k) {
1894
+ var n = (
1895
+ /** @type {Effect & { nodes: EffectNodes }} */
1896
+ $
1897
+ );
1898
+ ((n.f & ht) === 0 || n.nodes.end === null) && (n.nodes.end = S), xn();
1899
+ return;
1900
+ }
1901
+ e !== null && e.before(
1902
+ /** @type {Node} */
1903
+ t
1904
+ );
1905
+ }
1906
+ const $i = ["touchstart", "touchmove"];
1907
+ function yi(e) {
1908
+ return $i.includes(e);
1909
+ }
1910
+ function Ei(e, t) {
1911
+ var n = t == null ? "" : typeof t == "object" ? t + "" : t;
1912
+ n !== (e.__t ?? (e.__t = e.nodeValue)) && (e.__t = n, e.nodeValue = n + "");
1913
+ }
1914
+ function Zr(e, t) {
1915
+ return Qr(e, t);
1916
+ }
1917
+ function xi(e, t) {
1918
+ pn(), t.intro = t.intro ?? !1;
1919
+ const n = t.target, r = k, s = S;
1920
+ try {
1921
+ for (var i = /* @__PURE__ */ ct(n); i && (i.nodeType !== qt || /** @type {Comment} */
1922
+ i.data !== bn); )
1923
+ i = /* @__PURE__ */ Re(i);
1924
+ if (!i)
1925
+ throw ot;
1926
+ Je(!0), ue(
1927
+ /** @type {Comment} */
1928
+ i
1929
+ );
1930
+ const o = Qr(e, { ...t, anchor: i });
1931
+ return Je(!1), /** @type {Exports} */
1932
+ o;
1933
+ } catch (o) {
1934
+ if (o instanceof Error && o.message.split(`
1935
+ `).some((f) => f.startsWith("https://svelte.dev/e/")))
1936
+ throw o;
1937
+ return o !== ot && console.warn("Failed to hydrate: ", o), t.recover === !1 && Cs(), pn(), si(n), Je(!1), Zr(e, t);
1938
+ } finally {
1939
+ Je(r), ue(s);
1940
+ }
1941
+ }
1942
+ const Rt = /* @__PURE__ */ new Map();
1943
+ function Qr(e, { target: t, anchor: n, props: r = {}, events: s, context: i, intro: o = !0 }) {
1944
+ pn();
1945
+ var f = void 0, u = ai(() => {
1946
+ var a = n ?? t.appendChild(We());
1947
+ Us(
1948
+ /** @type {TemplateNode} */
1949
+ a,
1950
+ {
1951
+ pending: () => {
1952
+ }
1953
+ },
1954
+ (d) => {
1955
+ ur({});
1956
+ var g = (
1957
+ /** @type {ComponentContext} */
1958
+ V
1959
+ );
1960
+ if (i && (g.c = i), s && (r.$$events = s), k && bt(
1961
+ /** @type {TemplateNode} */
1962
+ d,
1963
+ null
1964
+ ), f = e(d, r) || {}, k && ($.nodes.end = S, S === null || S.nodeType !== qt || /** @type {Comment} */
1965
+ S.data !== Qn))
1966
+ throw Ut(), ot;
1967
+ ar();
1968
+ }
1969
+ );
1970
+ var c = /* @__PURE__ */ new Set(), h = (d) => {
1971
+ for (var g = 0; g < d.length; g++) {
1972
+ var v = d[g];
1973
+ if (!c.has(v)) {
1974
+ c.add(v);
1975
+ var C = yi(v);
1976
+ for (const re of [t, document]) {
1977
+ var y = Rt.get(re);
1978
+ y === void 0 && (y = /* @__PURE__ */ new Map(), Rt.set(re, y));
1979
+ var Ee = y.get(v);
1980
+ Ee === void 0 ? (re.addEventListener(v, Jn, { passive: C }), y.set(v, 1)) : y.set(v, Ee + 1);
1981
+ }
1982
+ }
1983
+ }
1984
+ };
1985
+ return h(ms(Jr)), mn.add(h), () => {
1986
+ for (var d of c)
1987
+ for (const C of [t, document]) {
1988
+ var g = (
1989
+ /** @type {Map<string, number>} */
1990
+ Rt.get(C)
1991
+ ), v = (
1992
+ /** @type {number} */
1993
+ g.get(d)
1994
+ );
1995
+ --v == 0 ? (C.removeEventListener(d, Jn), g.delete(d), g.size === 0 && Rt.delete(C)) : g.set(d, v);
1996
+ }
1997
+ mn.delete(h), a !== n && a.parentNode?.removeChild(a);
1998
+ };
1999
+ });
2000
+ return wn.set(f, u), f;
2001
+ }
2002
+ let wn = /* @__PURE__ */ new WeakMap();
2003
+ function Si(e, t) {
2004
+ const n = wn.get(e);
2005
+ return n ? (wn.delete(e), n(t)) : Promise.resolve();
2006
+ }
2007
+ var Z, le, W, Ve, xt, St, Bt;
2008
+ class ki {
2009
+ /**
2010
+ * @param {TemplateNode} anchor
2011
+ * @param {boolean} transition
2012
+ */
2013
+ constructor(t, n = !0) {
2014
+ /** @type {TemplateNode} */
2015
+ T(this, "anchor");
2016
+ /** @type {Map<Batch, Key>} */
2017
+ m(this, Z, /* @__PURE__ */ new Map());
2018
+ /**
2019
+ * Map of keys to effects that are currently rendered in the DOM.
2020
+ * These effects are visible and actively part of the document tree.
2021
+ * Example:
2022
+ * ```
2023
+ * {#if condition}
2024
+ * foo
2025
+ * {:else}
2026
+ * bar
2027
+ * {/if}
2028
+ * ```
2029
+ * Can result in the entries `true->Effect` and `false->Effect`
2030
+ * @type {Map<Key, Effect>}
2031
+ */
2032
+ m(this, le, /* @__PURE__ */ new Map());
2033
+ /**
2034
+ * Similar to #onscreen with respect to the keys, but contains branches that are not yet
2035
+ * in the DOM, because their insertion is deferred.
2036
+ * @type {Map<Key, Branch>}
2037
+ */
2038
+ m(this, W, /* @__PURE__ */ new Map());
2039
+ /**
2040
+ * Keys of effects that are currently outroing
2041
+ * @type {Set<Key>}
2042
+ */
2043
+ m(this, Ve, /* @__PURE__ */ new Set());
2044
+ /**
2045
+ * Whether to pause (i.e. outro) on change, or destroy immediately.
2046
+ * This is necessary for `<svelte:element>`
2047
+ */
2048
+ m(this, xt, !0);
2049
+ m(this, St, () => {
2050
+ var t = (
2051
+ /** @type {Batch} */
2052
+ x
2053
+ );
2054
+ if (l(this, Z).has(t)) {
2055
+ var n = (
2056
+ /** @type {Key} */
2057
+ l(this, Z).get(t)
2058
+ ), r = l(this, le).get(n);
2059
+ if (r)
2060
+ vi(r), l(this, Ve).delete(n);
2061
+ else {
2062
+ var s = l(this, W).get(n);
2063
+ s && (l(this, le).set(n, s.effect), l(this, W).delete(n), s.fragment.lastChild.remove(), this.anchor.before(s.fragment), r = s.effect);
2064
+ }
2065
+ for (const [i, o] of l(this, Z)) {
2066
+ if (l(this, Z).delete(i), i === t)
2067
+ break;
2068
+ const f = l(this, W).get(o);
2069
+ f && (z(f.effect), l(this, W).delete(o));
2070
+ }
2071
+ for (const [i, o] of l(this, le)) {
2072
+ if (i === n || l(this, Ve).has(i)) continue;
2073
+ const f = () => {
2074
+ if (Array.from(l(this, Z).values()).includes(i)) {
2075
+ var a = document.createDocumentFragment();
2076
+ Hr(o, a), a.append(We()), l(this, W).set(i, { effect: o, fragment: a });
2077
+ } else
2078
+ z(o);
2079
+ l(this, Ve).delete(i), l(this, le).delete(i);
2080
+ };
2081
+ l(this, xt) || !r ? (l(this, Ve).add(i), mt(o, f, !1)) : f();
2082
+ }
2083
+ }
2084
+ });
2085
+ /**
2086
+ * @param {Batch} batch
2087
+ */
2088
+ m(this, Bt, (t) => {
2089
+ l(this, Z).delete(t);
2090
+ const n = Array.from(l(this, Z).values());
2091
+ for (const [r, s] of l(this, W))
2092
+ n.includes(r) || (z(s.effect), l(this, W).delete(r));
2093
+ });
2094
+ this.anchor = t, p(this, xt, n);
2095
+ }
2096
+ /**
2097
+ *
2098
+ * @param {any} key
2099
+ * @param {null | ((target: TemplateNode) => void)} fn
2100
+ */
2101
+ ensure(t, n) {
2102
+ var r = (
2103
+ /** @type {Batch} */
2104
+ x
2105
+ ), s = ii();
2106
+ if (n && !l(this, le).has(t) && !l(this, W).has(t))
2107
+ if (s) {
2108
+ var i = document.createDocumentFragment(), o = We();
2109
+ i.append(o), l(this, W).set(t, {
2110
+ effect: Ie(() => n(o)),
2111
+ fragment: i
2112
+ });
2113
+ } else
2114
+ l(this, le).set(
2115
+ t,
2116
+ Ie(() => n(this.anchor))
2117
+ );
2118
+ if (l(this, Z).set(r, t), s) {
2119
+ for (const [f, u] of l(this, le))
2120
+ f === t ? r.unskip_effect(u) : r.skip_effect(u);
2121
+ for (const [f, u] of l(this, W))
2122
+ f === t ? r.unskip_effect(u.effect) : r.skip_effect(u.effect);
2123
+ r.oncommit(l(this, St)), r.ondiscard(l(this, Bt));
2124
+ } else
2125
+ k && (this.anchor = S), l(this, St).call(this);
2126
+ }
2127
+ }
2128
+ Z = new WeakMap(), le = new WeakMap(), W = new WeakMap(), Ve = new WeakMap(), xt = new WeakMap(), St = new WeakMap(), Bt = new WeakMap();
2129
+ function Ii(e) {
2130
+ V === null && or(), gn(() => {
2131
+ const t = Xr(e);
2132
+ if (typeof t == "function") return (
2133
+ /** @type {() => void} */
2134
+ t
2135
+ );
2136
+ });
2137
+ }
2138
+ function Ti(e, t, { bubbles: n = !1, cancelable: r = !1 } = {}) {
2139
+ return new CustomEvent(e, { detail: t, bubbles: n, cancelable: r });
2140
+ }
2141
+ function Mi() {
2142
+ const e = V;
2143
+ return e === null && or(), (t, n, r) => {
2144
+ const s = (
2145
+ /** @type {Record<string, Function | Function[]>} */
2146
+ e.s.$$events?.[
2147
+ /** @type {string} */
2148
+ t
2149
+ ]
2150
+ );
2151
+ if (s) {
2152
+ const i = tr(s) ? s.slice() : [s], o = Ti(
2153
+ /** @type {string} */
2154
+ t,
2155
+ n,
2156
+ r
2157
+ );
2158
+ for (const f of i)
2159
+ f.call(e.x, o);
2160
+ return !o.defaultPrevented;
2161
+ }
2162
+ return !0;
2163
+ };
2164
+ }
2165
+ function Ot(e, t, n = !1) {
2166
+ k && xn();
2167
+ var r = new ki(e), s = n ? ft : 0;
2168
+ function i(o, f) {
2169
+ if (k) {
2170
+ const c = js(e);
2171
+ var u;
2172
+ if (c === bn ? u = 0 : c === $n ? u = !1 : u = parseInt(c.substring(1)), o !== u) {
2173
+ var a = lr();
2174
+ ue(a), r.anchor = a, Je(!1), r.ensure(o, f), Je(!0);
2175
+ return;
2176
+ }
2177
+ }
2178
+ r.ensure(o, f);
2179
+ }
2180
+ Dr(() => {
2181
+ var o = !1;
2182
+ t((f, u = 0) => {
2183
+ o = !0, i(u, f);
2184
+ }), o || i(!1, null);
2185
+ }, s);
2186
+ }
2187
+ function Ai(e, t) {
2188
+ return e == null ? null : String(e);
2189
+ }
2190
+ function Kn(e, t, n, r) {
2191
+ var s = e.__style;
2192
+ if (k || s !== t) {
2193
+ var i = Ai(t);
2194
+ (!k || i !== e.getAttribute("style")) && (i == null ? e.removeAttribute("style") : e.style.cssText = i), e.__style = t;
2195
+ }
2196
+ return r;
2197
+ }
2198
+ const Ci = /* @__PURE__ */ Symbol("is custom element"), Ni = /* @__PURE__ */ Symbol("is html");
2199
+ function Ri(e, t, n, r) {
2200
+ var s = Oi(e);
2201
+ k && (s[t] = e.getAttribute(t)), s[t] !== (s[t] = n) && (n == null ? e.removeAttribute(t) : typeof n != "string" && Di(e).includes(t) ? e[t] = n : e.setAttribute(t, n));
2202
+ }
2203
+ function Oi(e) {
2204
+ return (
2205
+ /** @type {Record<string | symbol, unknown>} **/
2206
+ // @ts-expect-error
2207
+ e.__attributes ?? (e.__attributes = {
2208
+ [Ci]: e.nodeName.includes("-"),
2209
+ [Ni]: e.namespaceURI === er
2210
+ })
2211
+ );
2212
+ }
2213
+ var Gn = /* @__PURE__ */ new Map();
2214
+ function Di(e) {
2215
+ var t = e.getAttribute("is") || e.nodeName, n = Gn.get(t);
2216
+ if (n) return n;
2217
+ Gn.set(t, n = []);
2218
+ for (var r, s = e, i = Element.prototype; i !== s; ) {
2219
+ r = ws(s);
2220
+ for (var o in r)
2221
+ r[o].set && n.push(o);
2222
+ s = nr(s);
2223
+ }
2224
+ return n;
2225
+ }
2226
+ function sn(e, t, n, r) {
2227
+ var s = (
2228
+ /** @type {V} */
2229
+ r
2230
+ ), i = !0, o = () => (i && (i = !1, s = /** @type {V} */
2231
+ r), s), f;
2232
+ f = /** @type {V} */
2233
+ e[t], f === void 0 && r !== void 0 && (f = o());
2234
+ var u;
2235
+ u = () => {
2236
+ var d = (
2237
+ /** @type {V} */
2238
+ e[t]
2239
+ );
2240
+ return d === void 0 ? o() : (i = !0, d);
2241
+ };
2242
+ var a = !1, c = /* @__PURE__ */ kn(() => (a = !1, u())), h = (
2243
+ /** @type {Effect} */
2244
+ $
2245
+ );
2246
+ return (
2247
+ /** @type {() => V} */
2248
+ (function(d, g) {
2249
+ if (arguments.length > 0) {
2250
+ const v = g ? w(c) : d;
2251
+ return E(c, v), a = !0, s !== void 0 && (s = v), d;
2252
+ }
2253
+ return Ce && a || (h.f & we) !== 0 ? c.v : w(c);
2254
+ })
2255
+ );
2256
+ }
2257
+ function Pi(e) {
2258
+ return new Li(e);
2259
+ }
2260
+ var me, X;
2261
+ class Li {
2262
+ /**
2263
+ * @param {ComponentConstructorOptions & {
2264
+ * component: any;
2265
+ * }} options
2266
+ */
2267
+ constructor(t) {
2268
+ /** @type {any} */
2269
+ m(this, me);
2270
+ /** @type {Record<string, any>} */
2271
+ m(this, X);
2272
+ var n = /* @__PURE__ */ new Map(), r = (i, o) => {
2273
+ var f = /* @__PURE__ */ ni(o, !1, !1);
2274
+ return n.set(i, f), f;
2275
+ };
2276
+ const s = new Proxy(
2277
+ { ...t.props || {}, $$events: {} },
2278
+ {
2279
+ get(i, o) {
2280
+ return w(n.get(o) ?? r(o, Reflect.get(i, o)));
2281
+ },
2282
+ has(i, o) {
2283
+ return o === Ss ? !0 : (w(n.get(o) ?? r(o, Reflect.get(i, o))), Reflect.has(i, o));
2284
+ },
2285
+ set(i, o, f) {
2286
+ return E(n.get(o) ?? r(o, f), f), Reflect.set(i, o, f);
2287
+ }
2288
+ }
2289
+ );
2290
+ p(this, X, (t.hydrate ? xi : Zr)(t.component, {
2291
+ target: t.target,
2292
+ anchor: t.anchor,
2293
+ props: s,
2294
+ context: t.context,
2295
+ intro: t.intro ?? !1,
2296
+ recover: t.recover
2297
+ })), (!t?.props?.$$host || t.sync === !1) && Dt(), p(this, me, s.$$events);
2298
+ for (const i of Object.keys(l(this, X)))
2299
+ i === "$set" || i === "$destroy" || i === "$on" || Ht(this, i, {
2300
+ get() {
2301
+ return l(this, X)[i];
2302
+ },
2303
+ /** @param {any} value */
2304
+ set(o) {
2305
+ l(this, X)[i] = o;
2306
+ },
2307
+ enumerable: !0
2308
+ });
2309
+ l(this, X).$set = /** @param {Record<string, any>} next */
2310
+ (i) => {
2311
+ Object.assign(s, i);
2312
+ }, l(this, X).$destroy = () => {
2313
+ Si(l(this, X));
2314
+ };
2315
+ }
2316
+ /** @param {Record<string, any>} props */
2317
+ $set(t) {
2318
+ l(this, X).$set(t);
2319
+ }
2320
+ /**
2321
+ * @param {string} event
2322
+ * @param {(...args: any[]) => any} callback
2323
+ * @returns {any}
2324
+ */
2325
+ $on(t, n) {
2326
+ l(this, me)[t] = l(this, me)[t] || [];
2327
+ const r = (...s) => n.call(this, ...s);
2328
+ return l(this, me)[t].push(r), () => {
2329
+ l(this, me)[t] = l(this, me)[t].filter(
2330
+ /** @param {any} fn */
2331
+ (s) => s !== r
2332
+ );
2333
+ };
2334
+ }
2335
+ $destroy() {
2336
+ l(this, X).$destroy();
2337
+ }
2338
+ }
2339
+ me = new WeakMap(), X = new WeakMap();
2340
+ let es;
2341
+ typeof HTMLElement == "function" && (es = class extends HTMLElement {
2342
+ /**
2343
+ * @param {*} $$componentCtor
2344
+ * @param {*} $$slots
2345
+ * @param {ShadowRootInit | undefined} shadow_root_init
2346
+ */
2347
+ constructor(t, n, r) {
2348
+ super();
2349
+ /** The Svelte component constructor */
2350
+ T(this, "$$ctor");
2351
+ /** Slots */
2352
+ T(this, "$$s");
2353
+ /** @type {any} The Svelte component instance */
2354
+ T(this, "$$c");
2355
+ /** Whether or not the custom element is connected */
2356
+ T(this, "$$cn", !1);
2357
+ /** @type {Record<string, any>} Component props data */
2358
+ T(this, "$$d", {});
2359
+ /** `true` if currently in the process of reflecting component props back to attributes */
2360
+ T(this, "$$r", !1);
2361
+ /** @type {Record<string, CustomElementPropDefinition>} Props definition (name, reflected, type etc) */
2362
+ T(this, "$$p_d", {});
2363
+ /** @type {Record<string, EventListenerOrEventListenerObject[]>} Event listeners */
2364
+ T(this, "$$l", {});
2365
+ /** @type {Map<EventListenerOrEventListenerObject, Function>} Event listener unsubscribe functions */
2366
+ T(this, "$$l_u", /* @__PURE__ */ new Map());
2367
+ /** @type {any} The managed render effect for reflecting attributes */
2368
+ T(this, "$$me");
2369
+ /** @type {ShadowRoot | null} The ShadowRoot of the custom element */
2370
+ T(this, "$$shadowRoot", null);
2371
+ this.$$ctor = t, this.$$s = n, r && (this.$$shadowRoot = this.attachShadow(r));
2372
+ }
2373
+ /**
2374
+ * @param {string} type
2375
+ * @param {EventListenerOrEventListenerObject} listener
2376
+ * @param {boolean | AddEventListenerOptions} [options]
2377
+ */
2378
+ addEventListener(t, n, r) {
2379
+ if (this.$$l[t] = this.$$l[t] || [], this.$$l[t].push(n), this.$$c) {
2380
+ const s = this.$$c.$on(t, n);
2381
+ this.$$l_u.set(n, s);
2382
+ }
2383
+ super.addEventListener(t, n, r);
2384
+ }
2385
+ /**
2386
+ * @param {string} type
2387
+ * @param {EventListenerOrEventListenerObject} listener
2388
+ * @param {boolean | AddEventListenerOptions} [options]
2389
+ */
2390
+ removeEventListener(t, n, r) {
2391
+ if (super.removeEventListener(t, n, r), this.$$c) {
2392
+ const s = this.$$l_u.get(n);
2393
+ s && (s(), this.$$l_u.delete(n));
2394
+ }
2395
+ }
2396
+ async connectedCallback() {
2397
+ if (this.$$cn = !0, !this.$$c) {
2398
+ let t = function(s) {
2399
+ return (i) => {
2400
+ const o = Ar("slot");
2401
+ s !== "default" && (o.name = s), ke(i, o);
2402
+ };
2403
+ };
2404
+ if (await Promise.resolve(), !this.$$cn || this.$$c)
2405
+ return;
2406
+ const n = {}, r = ji(this);
2407
+ for (const s of this.$$s)
2408
+ s in r && (s === "default" && !this.$$d.children ? (this.$$d.children = t(s), n.default = !0) : n[s] = t(s));
2409
+ for (const s of this.attributes) {
2410
+ const i = this.$$g_p(s.name);
2411
+ i in this.$$d || (this.$$d[i] = jt(i, s.value, this.$$p_d, "toProp"));
2412
+ }
2413
+ for (const s in this.$$p_d)
2414
+ !(s in this.$$d) && this[s] !== void 0 && (this.$$d[s] = this[s], delete this[s]);
2415
+ this.$$c = Pi({
2416
+ component: this.$$ctor,
2417
+ target: this.$$shadowRoot || this,
2418
+ props: {
2419
+ ...this.$$d,
2420
+ $$slots: n,
2421
+ $$host: this
2422
+ }
2423
+ }), this.$$me = ui(() => {
2424
+ Or(() => {
2425
+ this.$$r = !0;
2426
+ for (const s of Ft(this.$$c)) {
2427
+ if (!this.$$p_d[s]?.reflect) continue;
2428
+ this.$$d[s] = this.$$c[s];
2429
+ const i = jt(
2430
+ s,
2431
+ this.$$d[s],
2432
+ this.$$p_d,
2433
+ "toAttribute"
2434
+ );
2435
+ i == null ? this.removeAttribute(this.$$p_d[s].attribute || s) : this.setAttribute(this.$$p_d[s].attribute || s, i);
2436
+ }
2437
+ this.$$r = !1;
2438
+ });
2439
+ });
2440
+ for (const s in this.$$l)
2441
+ for (const i of this.$$l[s]) {
2442
+ const o = this.$$c.$on(s, i);
2443
+ this.$$l_u.set(i, o);
2444
+ }
2445
+ this.$$l = {};
2446
+ }
2447
+ }
2448
+ // We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte
2449
+ // and setting attributes through setAttribute etc, this is helpful
2450
+ /**
2451
+ * @param {string} attr
2452
+ * @param {string} _oldValue
2453
+ * @param {string} newValue
2454
+ */
2455
+ attributeChangedCallback(t, n, r) {
2456
+ this.$$r || (t = this.$$g_p(t), this.$$d[t] = jt(t, r, this.$$p_d, "toProp"), this.$$c?.$set({ [t]: this.$$d[t] }));
2457
+ }
2458
+ disconnectedCallback() {
2459
+ this.$$cn = !1, Promise.resolve().then(() => {
2460
+ !this.$$cn && this.$$c && (this.$$c.$destroy(), this.$$me(), this.$$c = void 0);
2461
+ });
2462
+ }
2463
+ /**
2464
+ * @param {string} attribute_name
2465
+ */
2466
+ $$g_p(t) {
2467
+ return Ft(this.$$p_d).find(
2468
+ (n) => this.$$p_d[n].attribute === t || !this.$$p_d[n].attribute && n.toLowerCase() === t
2469
+ ) || t;
2470
+ }
2471
+ });
2472
+ function jt(e, t, n, r) {
2473
+ const s = n[e]?.type;
2474
+ if (t = s === "Boolean" && typeof t != "boolean" ? t != null : t, !r || !n[e])
2475
+ return t;
2476
+ if (r === "toAttribute")
2477
+ switch (s) {
2478
+ case "Object":
2479
+ case "Array":
2480
+ return t == null ? null : JSON.stringify(t);
2481
+ case "Boolean":
2482
+ return t ? "" : null;
2483
+ case "Number":
2484
+ return t ?? null;
2485
+ default:
2486
+ return t;
2487
+ }
2488
+ else
2489
+ switch (s) {
2490
+ case "Object":
2491
+ case "Array":
2492
+ return t && JSON.parse(t);
2493
+ case "Boolean":
2494
+ return t;
2495
+ // conversion already handled above
2496
+ case "Number":
2497
+ return t != null ? +t : t;
2498
+ default:
2499
+ return t;
2500
+ }
2501
+ }
2502
+ function ji(e) {
2503
+ const t = {};
2504
+ return e.childNodes.forEach((n) => {
2505
+ t[
2506
+ /** @type {Element} node */
2507
+ n.slot || "default"
2508
+ ] = !0;
2509
+ }), t;
2510
+ }
2511
+ function Fi(e, t, n, r, s, i) {
2512
+ let o = class extends es {
2513
+ constructor() {
2514
+ super(e, n, s), this.$$p_d = t;
2515
+ }
2516
+ static get observedAttributes() {
2517
+ return Ft(t).map(
2518
+ (f) => (t[f].attribute || f).toLowerCase()
2519
+ );
2520
+ }
2521
+ };
2522
+ return Ft(t).forEach((f) => {
2523
+ Ht(o.prototype, f, {
2524
+ get() {
2525
+ return this.$$c && f in this.$$c ? this.$$c[f] : this.$$d[f];
2526
+ },
2527
+ set(u) {
2528
+ u = jt(f, u, t), this.$$d[f] = u;
2529
+ var a = this.$$c;
2530
+ if (a) {
2531
+ var c = Ge(a, f)?.get;
2532
+ c ? a[f] = u : a.$set({ [f]: u });
2533
+ }
2534
+ }
2535
+ });
2536
+ }), r.forEach((f) => {
2537
+ Ht(o.prototype, f, {
2538
+ get() {
2539
+ return this.$$c?.[f];
2540
+ }
2541
+ });
2542
+ }), e.element = /** @type {any} */
2543
+ o, o;
2544
+ }
2545
+ var Hi = /* @__PURE__ */ Gr('<svg xmlns="http://www.w3.org/2000/svg" class="h-3 w-3" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 15l7-7 7 7"></path></svg>'), zi = /* @__PURE__ */ Gr('<svg xmlns="http://www.w3.org/2000/svg" class="h-3 w-3" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg>'), Vi = /* @__PURE__ */ Tt('<div class="alert alert-info"><svg xmlns="http://www.w3.org/2000/svg" class="stroke-current shrink-0 h-5 w-5" fill="none" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg> <span class="text-xs">No session data yet. Interact with the questions to see updates.</span></div>'), Yi = /* @__PURE__ */ Tt('<div class="bg-base-200 rounded p-3 flex-1 min-h-0 flex flex-col"><div class="text-xs font-semibold mb-2">Item Sessions Snapshot</div> <pre class="bg-base-300 p-2 rounded text-xs overflow-auto flex-1 min-h-0"> </pre></div>'), Bi = /* @__PURE__ */ Tt('<div class="p-4 flex flex-col min-h-0 overflow-hidden"><div class="space-y-3 flex-1 min-h-0 flex flex-col"><div class="mb-2"><div class="text-sm font-bold mb-2">PIE Session Data (Persistent)</div></div> <!></div></div>'), Wi = /* @__PURE__ */ Tt('<div class="absolute bottom-0 right-0 w-4 h-4 cursor-se-resize" role="button" tabindex="0" title="Resize window"><svg class="w-full h-full text-base-content/30" viewBox="0 0 16 16" fill="currentColor"><path d="M16 16V14H14V16H16Z"></path><path d="M16 11V9H14V11H16Z"></path><path d="M13 16V14H11V16H13Z"></path></svg></div>'), qi = /* @__PURE__ */ Tt('<div class="fixed z-100 bg-base-100 rounded-lg shadow-2xl border-2 border-base-300"><div class="flex items-center justify-between px-4 py-2 bg-base-200 rounded-t-lg cursor-move select-none border-b border-base-300" role="button" tabindex="0" aria-label="Drag session panel"><div class="flex items-center gap-2"><svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path></svg> <h3 class="font-bold text-sm">Session Data</h3></div> <div class="flex gap-1"><button class="btn btn-xs btn-ghost btn-circle"><!></button> <button class="btn btn-xs btn-ghost btn-circle" title="Close"><svg xmlns="http://www.w3.org/2000/svg" class="h-3 w-3" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg></button></div></div> <!> <!></div>');
2546
+ function Ui(e, t) {
2547
+ ur(t, !0);
2548
+ const n = Mi();
2549
+ let r = sn(t, "toolkitCoordinator", 7, null), s = sn(t, "sectionId", 7, ""), i = sn(t, "attemptId", 7, void 0), o = /* @__PURE__ */ P(!1), f = /* @__PURE__ */ P(24), u = /* @__PURE__ */ P(100), a = /* @__PURE__ */ P(220), c = /* @__PURE__ */ P(600), h = /* @__PURE__ */ P(!1), d = /* @__PURE__ */ P(!1), g = 0, v = 0, C = 0, y = 0, Ee = 0, re = 0, Cn = 0, Nn = 0, Jt = /* @__PURE__ */ P(Ke({
2550
+ currentItemIndex: null,
2551
+ currentItemId: null,
2552
+ visitedItemIdentifiers: [],
2553
+ updatedAt: null,
2554
+ lastChangedItemId: null,
2555
+ itemSessions: {}
2556
+ }));
2557
+ function Rn(_) {
2558
+ try {
2559
+ return structuredClone(_);
2560
+ } catch {
2561
+ return JSON.parse(JSON.stringify(_));
2562
+ }
2563
+ }
2564
+ function On() {
2565
+ if (!(!r() || !s()))
2566
+ return r().getSectionController?.({ sectionId: s(), attemptId: i() });
2567
+ }
2568
+ function Dn(_) {
2569
+ const A = On()?.getCurrentSectionAttemptSlice?.() || null;
2570
+ E(
2571
+ Jt,
2572
+ {
2573
+ currentItemIndex: typeof A?.currentItemIndex == "number" ? A.currentItemIndex : null,
2574
+ currentItemId: typeof A?.currentItemId == "string" && A.currentItemId ? A.currentItemId : null,
2575
+ visitedItemIdentifiers: Rn(A?.visitedItemIdentifiers || []),
2576
+ updatedAt: _?.updatedAt || Date.now(),
2577
+ lastChangedItemId: _?.itemId || null,
2578
+ itemSessions: Rn(A?.itemSessions || {})
2579
+ },
2580
+ !0
2581
+ );
2582
+ }
2583
+ gn(() => {
2584
+ if (!r() || !s()) return;
2585
+ Dn();
2586
+ const I = On()?.subscribe?.((A) => {
2587
+ Dn({
2588
+ itemId: A?.itemId,
2589
+ updatedAt: A?.timestamp || Date.now()
2590
+ });
2591
+ });
2592
+ return () => {
2593
+ I?.();
2594
+ };
2595
+ }), Ii(() => {
2596
+ const _ = (Zt, Qt, en) => Math.max(Qt, Math.min(Zt, en)), I = window.innerWidth, A = window.innerHeight;
2597
+ E(a, _(Math.round(I * 0.29), 280, 560), !0), E(c, _(Math.round(A * 0.72), 360, 860), !0), E(f, Math.max(16, Math.round(I * 0.08)), !0), E(u, Math.max(16, Math.round((A - w(c)) / 2)), !0);
2598
+ });
2599
+ function ts(_) {
2600
+ E(h, !0), g = _.clientX, v = _.clientY, C = w(f), y = w(u), document.addEventListener("mousemove", Pn), document.addEventListener("mouseup", Kt);
2601
+ }
2602
+ function Pn(_) {
2603
+ if (!w(h)) return;
2604
+ const I = _.clientX - g, A = _.clientY - v;
2605
+ E(f, C + I), E(u, y + A), E(f, Math.max(0, Math.min(w(f), window.innerWidth - w(a))), !0), E(u, Math.max(0, Math.min(w(u), window.innerHeight - 100)), !0);
2606
+ }
2607
+ function Kt() {
2608
+ E(h, !1), document.removeEventListener("mousemove", Pn), document.removeEventListener("mouseup", Kt);
2609
+ }
2610
+ function ns(_) {
2611
+ E(d, !0), Ee = _.clientX, re = _.clientY, Cn = w(a), Nn = w(c), document.addEventListener("mousemove", Ln), document.addEventListener("mouseup", Gt), _.stopPropagation();
2612
+ }
2613
+ function Ln(_) {
2614
+ if (!w(d)) return;
2615
+ const I = _.clientX - Ee, A = _.clientY - re;
2616
+ E(a, Math.max(300, Math.min(Cn + I, window.innerWidth - w(f))), !0), E(c, Math.max(200, Math.min(Nn + A, window.innerHeight - w(u))), !0);
2617
+ }
2618
+ function Gt() {
2619
+ E(d, !1), document.removeEventListener("mousemove", Ln), document.removeEventListener("mouseup", Gt);
2620
+ }
2621
+ gn(() => () => {
2622
+ Kt(), Gt();
2623
+ });
2624
+ var rs = {
2625
+ get toolkitCoordinator() {
2626
+ return r();
2627
+ },
2628
+ set toolkitCoordinator(_ = null) {
2629
+ r(_), Dt();
2630
+ },
2631
+ get sectionId() {
2632
+ return s();
2633
+ },
2634
+ set sectionId(_ = "") {
2635
+ s(_), Dt();
2636
+ },
2637
+ get attemptId() {
2638
+ return i();
2639
+ },
2640
+ set attemptId(_ = void 0) {
2641
+ i(_), Dt();
2642
+ }
2643
+ }, Mt = qi(), At = Se(Mt), jn = Xe(Se(At), 2), vt = Se(jn), ss = Se(vt);
2644
+ {
2645
+ var is = (_) => {
2646
+ var I = Hi();
2647
+ ke(_, I);
2648
+ }, os = (_) => {
2649
+ var I = zi();
2650
+ ke(_, I);
2651
+ };
2652
+ Ot(ss, (_) => {
2653
+ w(o) ? _(is) : _(os, !1);
2654
+ });
2655
+ }
2656
+ xe(vt);
2657
+ var ls = Xe(vt, 2);
2658
+ xe(jn), xe(At);
2659
+ var Fn = Xe(At, 2);
2660
+ {
2661
+ var fs = (_) => {
2662
+ var I = Bi(), A = Se(I), Zt = Xe(Se(A), 2);
2663
+ {
2664
+ var Qt = (Ue) => {
2665
+ var _t = Vi();
2666
+ ke(Ue, _t);
2667
+ }, en = /* @__PURE__ */ Zs(() => Object.keys(w(Jt).itemSessions || {}).length === 0), cs = (Ue) => {
2668
+ var _t = Yi(), Hn = Xe(Se(_t), 2), ds = Se(Hn, !0);
2669
+ xe(Hn), xe(_t), rn((hs) => Ei(ds, hs), [() => JSON.stringify(w(Jt), null, 2)]), ke(Ue, _t);
2670
+ };
2671
+ Ot(Zt, (Ue) => {
2672
+ w(en) ? Ue(Qt) : Ue(cs, !1);
2673
+ });
2674
+ }
2675
+ xe(A), xe(I), rn(() => Kn(I, `height: ${w(c) - 60}px;`)), ke(_, I);
2676
+ };
2677
+ Ot(Fn, (_) => {
2678
+ w(o) || _(fs);
2679
+ });
2680
+ }
2681
+ var us = Xe(Fn, 2);
2682
+ {
2683
+ var as = (_) => {
2684
+ var I = Wi();
2685
+ Nt("mousedown", I, ns), ke(_, I);
2686
+ };
2687
+ Ot(us, (_) => {
2688
+ w(o) || _(as);
2689
+ });
2690
+ }
2691
+ return xe(Mt), rn(() => {
2692
+ Kn(Mt, `left: ${w(f) ?? ""}px; top: ${w(u) ?? ""}px; width: ${w(a) ?? ""}px; ${w(o) ? "height: auto;" : `height: ${w(c)}px;`}`), Ri(vt, "title", w(o) ? "Maximize" : "Minimize");
2693
+ }), Nt("mousedown", At, ts), Nt("click", vt, () => E(o, !w(o))), Nt("click", ls, () => n("close")), ke(e, Mt), ar(rs);
2694
+ }
2695
+ gi(["mousedown", "click"]);
2696
+ customElements.define("pie-section-player-tools-session-debugger", Fi(
2697
+ Ui,
2698
+ {
2699
+ sectionId: { attribute: "section-id", type: "String" },
2700
+ attemptId: { attribute: "attempt-id", type: "String" },
2701
+ toolkitCoordinator: { attribute: "toolkit-coordinator", type: "Object" }
2702
+ },
2703
+ [],
2704
+ [],
2705
+ { mode: "open" }
2706
+ ));
2707
+ export {
2708
+ Ui as default
2709
+ };