@walker-di/fortalece-ai-sdk 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3312 @@
1
+ typeof window < "u" && ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add("5");
2
+ const Qn = 1, es = 2, Gr = 4, ts = 8, rs = 16, ns = 1, ss = 2, Jr = "[", Vt = "[!", yr = "]", ct = {}, j = Symbol(), is = "http://www.w3.org/1999/xhtml", ur = !1;
3
+ var Xr = Array.isArray, as = Array.prototype.indexOf, Yt = Array.from, Ft = Object.keys, Ut = Object.defineProperty, ot = Object.getOwnPropertyDescriptor, ls = Object.getOwnPropertyDescriptors, os = Object.prototype, fs = Array.prototype, Qr = Object.getPrototypeOf, Pr = Object.isExtensible;
4
+ function cs(e) {
5
+ for (var t = 0; t < e.length; t++)
6
+ e[t]();
7
+ }
8
+ function en() {
9
+ var e, t, r = new Promise((n, i) => {
10
+ e = n, t = i;
11
+ });
12
+ return { promise: r, resolve: e, reject: t };
13
+ }
14
+ const O = 2, xr = 4, $r = 8, us = 1 << 24, Ne = 16, Re = 32, He = 64, Kt = 128, pe = 512, F = 1024, G = 2048, Le = 4096, Q = 8192, Ce = 16384, Wt = 32768, ut = 65536, jr = 1 << 17, tn = 1 << 18, Xe = 1 << 19, ds = 1 << 20, Ae = 1 << 25, We = 32768, dr = 1 << 21, zr = 1 << 22, Ue = 1 << 23, lr = Symbol("$state"), vs = Symbol("legacy props"), hs = Symbol(""), it = new class extends Error {
15
+ name = "StaleReactionError";
16
+ message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
17
+ }(), kr = 3, pt = 8;
18
+ function ps() {
19
+ throw new Error("https://svelte.dev/e/async_derived_orphan");
20
+ }
21
+ function ms(e) {
22
+ throw new Error("https://svelte.dev/e/effect_in_teardown");
23
+ }
24
+ function _s() {
25
+ throw new Error("https://svelte.dev/e/effect_in_unowned_derived");
26
+ }
27
+ function gs(e) {
28
+ throw new Error("https://svelte.dev/e/effect_orphan");
29
+ }
30
+ function bs() {
31
+ throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
32
+ }
33
+ function ws() {
34
+ throw new Error("https://svelte.dev/e/hydration_failed");
35
+ }
36
+ function ys() {
37
+ throw new Error("https://svelte.dev/e/state_descriptors_fixed");
38
+ }
39
+ function xs() {
40
+ throw new Error("https://svelte.dev/e/state_prototype_fixed");
41
+ }
42
+ function $s() {
43
+ throw new Error("https://svelte.dev/e/state_unsafe_mutation");
44
+ }
45
+ function zs() {
46
+ throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror");
47
+ }
48
+ function Gt(e) {
49
+ console.warn("https://svelte.dev/e/hydration_mismatch");
50
+ }
51
+ function ks() {
52
+ console.warn("https://svelte.dev/e/svelte_boundary_reset_noop");
53
+ }
54
+ let w = !1;
55
+ function Te(e) {
56
+ w = e;
57
+ }
58
+ let S;
59
+ function W(e) {
60
+ if (e === null)
61
+ throw Gt(), ct;
62
+ return S = e;
63
+ }
64
+ function Jt() {
65
+ return W(/* @__PURE__ */ Oe(S));
66
+ }
67
+ function $(e) {
68
+ if (w) {
69
+ if (/* @__PURE__ */ Oe(S) !== null)
70
+ throw Gt(), ct;
71
+ S = e;
72
+ }
73
+ }
74
+ function Et(e = 1) {
75
+ if (w) {
76
+ for (var t = e, r = S; t--; )
77
+ r = /** @type {TemplateNode} */
78
+ /* @__PURE__ */ Oe(r);
79
+ S = r;
80
+ }
81
+ }
82
+ function Bt(e = !0) {
83
+ for (var t = 0, r = S; ; ) {
84
+ if (r.nodeType === pt) {
85
+ var n = (
86
+ /** @type {Comment} */
87
+ r.data
88
+ );
89
+ if (n === yr) {
90
+ if (t === 0) return r;
91
+ t -= 1;
92
+ } else (n === Jr || n === Vt) && (t += 1);
93
+ }
94
+ var i = (
95
+ /** @type {TemplateNode} */
96
+ /* @__PURE__ */ Oe(r)
97
+ );
98
+ e && r.remove(), r = i;
99
+ }
100
+ }
101
+ function rn(e) {
102
+ if (!e || e.nodeType !== pt)
103
+ throw Gt(), ct;
104
+ return (
105
+ /** @type {Comment} */
106
+ e.data
107
+ );
108
+ }
109
+ function nn(e) {
110
+ return e === this.v;
111
+ }
112
+ function Es(e, t) {
113
+ return e != e ? t == t : e !== t || e !== null && typeof e == "object" || typeof e == "function";
114
+ }
115
+ function sn(e) {
116
+ return !Es(e, this.v);
117
+ }
118
+ let Ss = !1, le = null;
119
+ function dt(e) {
120
+ le = e;
121
+ }
122
+ function Er(e, t = !1, r) {
123
+ le = {
124
+ p: le,
125
+ i: !1,
126
+ c: null,
127
+ e: null,
128
+ s: e,
129
+ x: null,
130
+ l: null
131
+ };
132
+ }
133
+ function Sr(e) {
134
+ var t = (
135
+ /** @type {ComponentContext} */
136
+ le
137
+ ), r = t.e;
138
+ if (r !== null) {
139
+ t.e = null;
140
+ for (var n of r)
141
+ zn(n);
142
+ }
143
+ return e !== void 0 && (t.x = e), t.i = !0, le = t.p, e ?? /** @type {T} */
144
+ {};
145
+ }
146
+ function an() {
147
+ return !0;
148
+ }
149
+ let Ze = [];
150
+ function ln() {
151
+ var e = Ze;
152
+ Ze = [], cs(e);
153
+ }
154
+ function mt(e) {
155
+ if (Ze.length === 0 && !St) {
156
+ var t = Ze;
157
+ queueMicrotask(() => {
158
+ t === Ze && ln();
159
+ });
160
+ }
161
+ Ze.push(e);
162
+ }
163
+ function As() {
164
+ for (; Ze.length > 0; )
165
+ ln();
166
+ }
167
+ function on(e) {
168
+ var t = x;
169
+ if (t === null)
170
+ return y.f |= Ue, e;
171
+ if ((t.f & Wt) === 0) {
172
+ if ((t.f & Kt) === 0)
173
+ throw e;
174
+ t.b.error(e);
175
+ } else
176
+ vt(e, t);
177
+ }
178
+ function vt(e, t) {
179
+ for (; t !== null; ) {
180
+ if ((t.f & Kt) !== 0)
181
+ try {
182
+ t.b.error(e);
183
+ return;
184
+ } catch (r) {
185
+ e = r;
186
+ }
187
+ t = t.parent;
188
+ }
189
+ throw e;
190
+ }
191
+ const Ot = /* @__PURE__ */ new Set();
192
+ let k = null, Pt = null, ie = null, ne = [], Xt = null, vr = !1, St = !1;
193
+ class he {
194
+ committed = !1;
195
+ /**
196
+ * The current values of any sources that are updated in this batch
197
+ * They keys of this map are identical to `this.#previous`
198
+ * @type {Map<Source, any>}
199
+ */
200
+ current = /* @__PURE__ */ new Map();
201
+ /**
202
+ * The values of any sources that are updated in this batch _before_ those updates took place.
203
+ * They keys of this map are identical to `this.#current`
204
+ * @type {Map<Source, any>}
205
+ */
206
+ previous = /* @__PURE__ */ new Map();
207
+ /**
208
+ * When the batch is committed (and the DOM is updated), we need to remove old branches
209
+ * and append new ones by calling the functions added inside (if/each/key/etc) blocks
210
+ * @type {Set<() => void>}
211
+ */
212
+ #t = /* @__PURE__ */ new Set();
213
+ /**
214
+ * If a fork is discarded, we need to destroy any effects that are no longer needed
215
+ * @type {Set<(batch: Batch) => void>}
216
+ */
217
+ #e = /* @__PURE__ */ new Set();
218
+ /**
219
+ * The number of async effects that are currently in flight
220
+ */
221
+ #r = 0;
222
+ /**
223
+ * The number of async effects that are currently in flight, _not_ inside a pending boundary
224
+ */
225
+ #n = 0;
226
+ /**
227
+ * A deferred that resolves when the batch is committed, used with `settled()`
228
+ * TODO replace with Promise.withResolvers once supported widely enough
229
+ * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
230
+ */
231
+ #o = null;
232
+ /**
233
+ * Deferred effects (which run after async work has completed) that are DIRTY
234
+ * @type {Effect[]}
235
+ */
236
+ #i = [];
237
+ /**
238
+ * Deferred effects that are MAYBE_DIRTY
239
+ * @type {Effect[]}
240
+ */
241
+ #s = [];
242
+ /**
243
+ * A set of branches that still exist, but will be destroyed when this batch
244
+ * is committed — we skip over these during `process`
245
+ * @type {Set<Effect>}
246
+ */
247
+ skipped_effects = /* @__PURE__ */ new Set();
248
+ is_fork = !1;
249
+ is_deferred() {
250
+ return this.is_fork || this.#n > 0;
251
+ }
252
+ /**
253
+ *
254
+ * @param {Effect[]} root_effects
255
+ */
256
+ process(t) {
257
+ ne = [], Pt = null, this.apply();
258
+ var r = {
259
+ parent: null,
260
+ effect: null,
261
+ effects: [],
262
+ render_effects: [],
263
+ block_effects: []
264
+ };
265
+ for (const n of t)
266
+ this.#a(n, r);
267
+ this.is_fork || this.#c(), this.is_deferred() ? (this.#l(r.effects), this.#l(r.render_effects), this.#l(r.block_effects)) : (Pt = this, k = null, Dr(r.render_effects), Dr(r.effects), Pt = null, this.#o?.resolve()), ie = null;
268
+ }
269
+ /**
270
+ * Traverse the effect tree, executing effects or stashing
271
+ * them for later execution as appropriate
272
+ * @param {Effect} root
273
+ * @param {EffectTarget} target
274
+ */
275
+ #a(t, r) {
276
+ t.f ^= F;
277
+ for (var n = t.first; n !== null; ) {
278
+ var i = n.f, s = (i & (Re | He)) !== 0, a = s && (i & F) !== 0, l = a || (i & Q) !== 0 || this.skipped_effects.has(n);
279
+ if ((n.f & Kt) !== 0 && n.b?.is_pending() && (r = {
280
+ parent: r,
281
+ effect: n,
282
+ effects: [],
283
+ render_effects: [],
284
+ block_effects: []
285
+ }), !l && n.fn !== null) {
286
+ s ? n.f ^= F : (i & xr) !== 0 ? r.effects.push(n) : Rt(n) && ((n.f & Ne) !== 0 && r.block_effects.push(n), It(n));
287
+ var o = n.first;
288
+ if (o !== null) {
289
+ n = o;
290
+ continue;
291
+ }
292
+ }
293
+ var f = n.parent;
294
+ for (n = n.next; n === null && f !== null; )
295
+ f === r.effect && (this.#l(r.effects), this.#l(r.render_effects), this.#l(r.block_effects), r = /** @type {EffectTarget} */
296
+ r.parent), n = f.next, f = f.parent;
297
+ }
298
+ }
299
+ /**
300
+ * @param {Effect[]} effects
301
+ */
302
+ #l(t) {
303
+ for (const r of t)
304
+ ((r.f & G) !== 0 ? this.#i : this.#s).push(r), this.#f(r.deps), U(r, F);
305
+ }
306
+ /**
307
+ * @param {Value[] | null} deps
308
+ */
309
+ #f(t) {
310
+ if (t !== null)
311
+ for (const r of t)
312
+ (r.f & O) === 0 || (r.f & We) === 0 || (r.f ^= We, this.#f(
313
+ /** @type {Derived} */
314
+ r.deps
315
+ ));
316
+ }
317
+ /**
318
+ * Associate a change to a given source with the current
319
+ * batch, noting its previous and current values
320
+ * @param {Source} source
321
+ * @param {any} value
322
+ */
323
+ capture(t, r) {
324
+ this.previous.has(t) || this.previous.set(t, r), (t.f & Ue) === 0 && (this.current.set(t, t.v), ie?.set(t, t.v));
325
+ }
326
+ activate() {
327
+ k = this, this.apply();
328
+ }
329
+ deactivate() {
330
+ k === this && (k = null, ie = null);
331
+ }
332
+ flush() {
333
+ if (this.activate(), ne.length > 0) {
334
+ if (fn(), k !== null && k !== this)
335
+ return;
336
+ } else this.#r === 0 && this.process([]);
337
+ this.deactivate();
338
+ }
339
+ discard() {
340
+ for (const t of this.#e) t(this);
341
+ this.#e.clear();
342
+ }
343
+ #c() {
344
+ if (this.#n === 0) {
345
+ for (const t of this.#t) t();
346
+ this.#t.clear();
347
+ }
348
+ this.#r === 0 && this.#u();
349
+ }
350
+ #u() {
351
+ if (Ot.size > 1) {
352
+ this.previous.clear();
353
+ var t = ie, r = !0, n = {
354
+ parent: null,
355
+ effect: null,
356
+ effects: [],
357
+ render_effects: [],
358
+ block_effects: []
359
+ };
360
+ for (const s of Ot) {
361
+ if (s === this) {
362
+ r = !1;
363
+ continue;
364
+ }
365
+ const a = [];
366
+ for (const [o, f] of this.current) {
367
+ if (s.current.has(o))
368
+ if (r && f !== s.current.get(o))
369
+ s.current.set(o, f);
370
+ else
371
+ continue;
372
+ a.push(o);
373
+ }
374
+ if (a.length === 0)
375
+ continue;
376
+ const l = [...s.current.keys()].filter((o) => !this.current.has(o));
377
+ if (l.length > 0) {
378
+ var i = ne;
379
+ ne = [];
380
+ const o = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Map();
381
+ for (const c of a)
382
+ cn(c, l, o, f);
383
+ if (ne.length > 0) {
384
+ k = s, s.apply();
385
+ for (const c of ne)
386
+ s.#a(c, n);
387
+ s.deactivate();
388
+ }
389
+ ne = i;
390
+ }
391
+ }
392
+ k = null, ie = t;
393
+ }
394
+ this.committed = !0, Ot.delete(this);
395
+ }
396
+ /**
397
+ *
398
+ * @param {boolean} blocking
399
+ */
400
+ increment(t) {
401
+ this.#r += 1, t && (this.#n += 1);
402
+ }
403
+ /**
404
+ *
405
+ * @param {boolean} blocking
406
+ */
407
+ decrement(t) {
408
+ this.#r -= 1, t && (this.#n -= 1), this.revive();
409
+ }
410
+ revive() {
411
+ for (const t of this.#i)
412
+ U(t, G), Ge(t);
413
+ for (const t of this.#s)
414
+ U(t, Le), Ge(t);
415
+ this.#i = [], this.#s = [], this.flush();
416
+ }
417
+ /** @param {() => void} fn */
418
+ oncommit(t) {
419
+ this.#t.add(t);
420
+ }
421
+ /** @param {(batch: Batch) => void} fn */
422
+ ondiscard(t) {
423
+ this.#e.add(t);
424
+ }
425
+ settled() {
426
+ return (this.#o ??= en()).promise;
427
+ }
428
+ static ensure() {
429
+ if (k === null) {
430
+ const t = k = new he();
431
+ Ot.add(k), St || he.enqueue(() => {
432
+ k === t && t.flush();
433
+ });
434
+ }
435
+ return k;
436
+ }
437
+ /** @param {() => void} task */
438
+ static enqueue(t) {
439
+ mt(t);
440
+ }
441
+ apply() {
442
+ }
443
+ }
444
+ function D(e) {
445
+ var t = St;
446
+ St = !0;
447
+ try {
448
+ for (var r; ; ) {
449
+ if (As(), ne.length === 0 && (k?.flush(), ne.length === 0))
450
+ return Xt = null, /** @type {T} */
451
+ r;
452
+ fn();
453
+ }
454
+ } finally {
455
+ St = t;
456
+ }
457
+ }
458
+ function fn() {
459
+ var e = Ye;
460
+ vr = !0;
461
+ var t = null;
462
+ try {
463
+ var r = 0;
464
+ for (Ht(!0); ne.length > 0; ) {
465
+ var n = he.ensure();
466
+ if (r++ > 1e3) {
467
+ var i, s;
468
+ Ts();
469
+ }
470
+ n.process(ne), Be.clear();
471
+ }
472
+ } finally {
473
+ vr = !1, Ht(e), Xt = null;
474
+ }
475
+ }
476
+ function Ts() {
477
+ try {
478
+ bs();
479
+ } catch (e) {
480
+ vt(e, Xt);
481
+ }
482
+ }
483
+ let Ee = null;
484
+ function Dr(e) {
485
+ var t = e.length;
486
+ if (t !== 0) {
487
+ for (var r = 0; r < t; ) {
488
+ var n = e[r++];
489
+ if ((n.f & (Ce | Q)) === 0 && Rt(n) && (Ee = /* @__PURE__ */ new Set(), It(n), n.deps === null && n.first === null && n.nodes === null && (n.teardown === null && n.ac === null ? Sn(n) : n.fn = null), Ee?.size > 0)) {
490
+ Be.clear();
491
+ for (const i of Ee) {
492
+ if ((i.f & (Ce | Q)) !== 0) continue;
493
+ const s = [i];
494
+ let a = i.parent;
495
+ for (; a !== null; )
496
+ Ee.has(a) && (Ee.delete(a), s.push(a)), a = a.parent;
497
+ for (let l = s.length - 1; l >= 0; l--) {
498
+ const o = s[l];
499
+ (o.f & (Ce | Q)) === 0 && It(o);
500
+ }
501
+ }
502
+ Ee.clear();
503
+ }
504
+ }
505
+ Ee = null;
506
+ }
507
+ }
508
+ function cn(e, t, r, n) {
509
+ if (!r.has(e) && (r.add(e), e.reactions !== null))
510
+ for (const i of e.reactions) {
511
+ const s = i.f;
512
+ (s & O) !== 0 ? cn(
513
+ /** @type {Derived} */
514
+ i,
515
+ t,
516
+ r,
517
+ n
518
+ ) : (s & (zr | Ne)) !== 0 && (s & G) === 0 && un(i, t, n) && (U(i, G), Ge(
519
+ /** @type {Effect} */
520
+ i
521
+ ));
522
+ }
523
+ }
524
+ function un(e, t, r) {
525
+ const n = r.get(e);
526
+ if (n !== void 0) return n;
527
+ if (e.deps !== null)
528
+ for (const i of e.deps) {
529
+ if (t.includes(i))
530
+ return !0;
531
+ if ((i.f & O) !== 0 && un(
532
+ /** @type {Derived} */
533
+ i,
534
+ t,
535
+ r
536
+ ))
537
+ return r.set(
538
+ /** @type {Derived} */
539
+ i,
540
+ !0
541
+ ), !0;
542
+ }
543
+ return r.set(e, !1), !1;
544
+ }
545
+ function Ge(e) {
546
+ for (var t = Xt = e; t.parent !== null; ) {
547
+ t = t.parent;
548
+ var r = t.f;
549
+ if (vr && t === x && (r & Ne) !== 0 && (r & tn) === 0)
550
+ return;
551
+ if ((r & (He | Re)) !== 0) {
552
+ if ((r & F) === 0) return;
553
+ t.f ^= F;
554
+ }
555
+ }
556
+ ne.push(t);
557
+ }
558
+ function Cs(e) {
559
+ let t = 0, r = Je(0), n;
560
+ return () => {
561
+ Ct() && (d(r), Cr(() => (t === 0 && (n = jn(() => e(() => At(r)))), t += 1, () => {
562
+ mt(() => {
563
+ t -= 1, t === 0 && (n?.(), n = void 0, At(r));
564
+ });
565
+ })));
566
+ };
567
+ }
568
+ var Ms = ut | Xe | Kt;
569
+ function Is(e, t, r) {
570
+ new Ns(e, t, r);
571
+ }
572
+ class Ns {
573
+ /** @type {Boundary | null} */
574
+ parent;
575
+ #t = !1;
576
+ /** @type {TemplateNode} */
577
+ #e;
578
+ /** @type {TemplateNode | null} */
579
+ #r = w ? S : null;
580
+ /** @type {BoundaryProps} */
581
+ #n;
582
+ /** @type {((anchor: Node) => void)} */
583
+ #o;
584
+ /** @type {Effect} */
585
+ #i;
586
+ /** @type {Effect | null} */
587
+ #s = null;
588
+ /** @type {Effect | null} */
589
+ #a = null;
590
+ /** @type {Effect | null} */
591
+ #l = null;
592
+ /** @type {DocumentFragment | null} */
593
+ #f = null;
594
+ /** @type {TemplateNode | null} */
595
+ #c = null;
596
+ #u = 0;
597
+ #d = 0;
598
+ #h = !1;
599
+ /**
600
+ * A source containing the number of pending async deriveds/expressions.
601
+ * Only created if `$effect.pending()` is used inside the boundary,
602
+ * otherwise updating the source results in needless `Batch.ensure()`
603
+ * calls followed by no-op flushes
604
+ * @type {Source<number> | null}
605
+ */
606
+ #v = null;
607
+ #b = Cs(() => (this.#v = Je(this.#u), () => {
608
+ this.#v = null;
609
+ }));
610
+ /**
611
+ * @param {TemplateNode} node
612
+ * @param {BoundaryProps} props
613
+ * @param {((anchor: Node) => void)} children
614
+ */
615
+ constructor(t, r, n) {
616
+ this.#e = t, this.#n = r, this.#o = n, this.parent = /** @type {Effect} */
617
+ x.b, this.#t = !!this.#n.pending, this.#i = Mr(() => {
618
+ if (x.b = this, w) {
619
+ const s = this.#r;
620
+ Jt(), /** @type {Comment} */
621
+ s.nodeType === pt && /** @type {Comment} */
622
+ s.data === Vt ? this.#y() : this.#w();
623
+ } else {
624
+ var i = this.#_();
625
+ try {
626
+ this.#s = se(() => n(i));
627
+ } catch (s) {
628
+ this.error(s);
629
+ }
630
+ this.#d > 0 ? this.#m() : this.#t = !1;
631
+ }
632
+ return () => {
633
+ this.#c?.remove();
634
+ };
635
+ }, Ms), w && (this.#e = S);
636
+ }
637
+ #w() {
638
+ try {
639
+ this.#s = se(() => this.#o(this.#e));
640
+ } catch (t) {
641
+ this.error(t);
642
+ }
643
+ this.#t = !1;
644
+ }
645
+ #y() {
646
+ const t = this.#n.pending;
647
+ t && (this.#a = se(() => t(this.#e)), he.enqueue(() => {
648
+ var r = this.#_();
649
+ this.#s = this.#p(() => (he.ensure(), se(() => this.#o(r)))), this.#d > 0 ? this.#m() : (Ve(
650
+ /** @type {Effect} */
651
+ this.#a,
652
+ () => {
653
+ this.#a = null;
654
+ }
655
+ ), this.#t = !1);
656
+ }));
657
+ }
658
+ #_() {
659
+ var t = this.#e;
660
+ return this.#t && (this.#c = ae(), this.#e.before(this.#c), t = this.#c), t;
661
+ }
662
+ /**
663
+ * Returns `true` if the effect exists inside a boundary whose pending snippet is shown
664
+ * @returns {boolean}
665
+ */
666
+ is_pending() {
667
+ return this.#t || !!this.parent && this.parent.is_pending();
668
+ }
669
+ has_pending_snippet() {
670
+ return !!this.#n.pending;
671
+ }
672
+ /**
673
+ * @param {() => Effect | null} fn
674
+ */
675
+ #p(t) {
676
+ var r = x, n = y, i = le;
677
+ we(this.#i), K(this.#i), dt(this.#i.ctx);
678
+ try {
679
+ return t();
680
+ } catch (s) {
681
+ return on(s), null;
682
+ } finally {
683
+ we(r), K(n), dt(i);
684
+ }
685
+ }
686
+ #m() {
687
+ const t = (
688
+ /** @type {(anchor: Node) => void} */
689
+ this.#n.pending
690
+ );
691
+ this.#s !== null && (this.#f = document.createDocumentFragment(), this.#f.append(
692
+ /** @type {TemplateNode} */
693
+ this.#c
694
+ ), Cn(this.#s, this.#f)), this.#a === null && (this.#a = se(() => t(this.#e)));
695
+ }
696
+ /**
697
+ * Updates the pending count associated with the currently visible pending snippet,
698
+ * if any, such that we can replace the snippet with content once work is done
699
+ * @param {1 | -1} d
700
+ */
701
+ #g(t) {
702
+ if (!this.has_pending_snippet()) {
703
+ this.parent && this.parent.#g(t);
704
+ return;
705
+ }
706
+ this.#d += t, this.#d === 0 && (this.#t = !1, this.#a && Ve(this.#a, () => {
707
+ this.#a = null;
708
+ }), this.#f && (this.#e.before(this.#f), this.#f = null));
709
+ }
710
+ /**
711
+ * Update the source that powers `$effect.pending()` inside this boundary,
712
+ * and controls when the current `pending` snippet (if any) is removed.
713
+ * Do not call from inside the class
714
+ * @param {1 | -1} d
715
+ */
716
+ update_pending_count(t) {
717
+ this.#g(t), this.#u += t, this.#v && ht(this.#v, this.#u);
718
+ }
719
+ get_effect_pending() {
720
+ return this.#b(), d(
721
+ /** @type {Source<number>} */
722
+ this.#v
723
+ );
724
+ }
725
+ /** @param {unknown} error */
726
+ error(t) {
727
+ var r = this.#n.onerror;
728
+ let n = this.#n.failed;
729
+ if (this.#h || !r && !n)
730
+ throw t;
731
+ this.#s && (Z(this.#s), this.#s = null), this.#a && (Z(this.#a), this.#a = null), this.#l && (Z(this.#l), this.#l = null), w && (W(
732
+ /** @type {TemplateNode} */
733
+ this.#r
734
+ ), Et(), W(Bt()));
735
+ var i = !1, s = !1;
736
+ const a = () => {
737
+ if (i) {
738
+ ks();
739
+ return;
740
+ }
741
+ i = !0, s && zs(), he.ensure(), this.#u = 0, this.#l !== null && Ve(this.#l, () => {
742
+ this.#l = null;
743
+ }), this.#t = this.has_pending_snippet(), this.#s = this.#p(() => (this.#h = !1, se(() => this.#o(this.#e)))), this.#d > 0 ? this.#m() : this.#t = !1;
744
+ };
745
+ var l = y;
746
+ try {
747
+ K(null), s = !0, r?.(t, a), s = !1;
748
+ } catch (o) {
749
+ vt(o, this.#i && this.#i.parent);
750
+ } finally {
751
+ K(l);
752
+ }
753
+ n && mt(() => {
754
+ this.#l = this.#p(() => {
755
+ he.ensure(), this.#h = !0;
756
+ try {
757
+ return se(() => {
758
+ n(
759
+ this.#e,
760
+ () => t,
761
+ () => a
762
+ );
763
+ });
764
+ } catch (o) {
765
+ return vt(
766
+ o,
767
+ /** @type {Effect} */
768
+ this.#i.parent
769
+ ), null;
770
+ } finally {
771
+ this.#h = !1;
772
+ }
773
+ });
774
+ });
775
+ }
776
+ }
777
+ function Rs(e, t, r, n) {
778
+ const i = Qt;
779
+ if (r.length === 0 && e.length === 0) {
780
+ n(t.map(i));
781
+ return;
782
+ }
783
+ var s = k, a = (
784
+ /** @type {Effect} */
785
+ x
786
+ ), l = Ls();
787
+ function o() {
788
+ Promise.all(r.map((f) => /* @__PURE__ */ Os(f))).then((f) => {
789
+ l();
790
+ try {
791
+ n([...t.map(i), ...f]);
792
+ } catch (c) {
793
+ (a.f & Ce) === 0 && vt(c, a);
794
+ }
795
+ s?.deactivate(), qt();
796
+ }).catch((f) => {
797
+ vt(f, a);
798
+ });
799
+ }
800
+ e.length > 0 ? Promise.all(e).then(() => {
801
+ l();
802
+ try {
803
+ return o();
804
+ } finally {
805
+ s?.deactivate(), qt();
806
+ }
807
+ }) : o();
808
+ }
809
+ function Ls() {
810
+ var e = x, t = y, r = le, n = k;
811
+ return function(s = !0) {
812
+ we(e), K(t), dt(r), s && n?.activate();
813
+ };
814
+ }
815
+ function qt() {
816
+ we(null), K(null), dt(null);
817
+ }
818
+ // @__NO_SIDE_EFFECTS__
819
+ function Qt(e) {
820
+ var t = O | G, r = y !== null && (y.f & O) !== 0 ? (
821
+ /** @type {Derived} */
822
+ y
823
+ ) : null;
824
+ return x !== null && (x.f |= Xe), {
825
+ ctx: le,
826
+ deps: null,
827
+ effects: null,
828
+ equals: nn,
829
+ f: t,
830
+ fn: e,
831
+ reactions: null,
832
+ rv: 0,
833
+ v: (
834
+ /** @type {V} */
835
+ j
836
+ ),
837
+ wv: 0,
838
+ parent: r ?? x,
839
+ ac: null
840
+ };
841
+ }
842
+ // @__NO_SIDE_EFFECTS__
843
+ function Os(e, t) {
844
+ let r = (
845
+ /** @type {Effect | null} */
846
+ x
847
+ );
848
+ r === null && ps();
849
+ var n = (
850
+ /** @type {Boundary} */
851
+ r.b
852
+ ), i = (
853
+ /** @type {Promise<V>} */
854
+ /** @type {unknown} */
855
+ void 0
856
+ ), s = Je(
857
+ /** @type {V} */
858
+ j
859
+ ), a = !y, l = /* @__PURE__ */ new Map();
860
+ return Vs(() => {
861
+ var o = en();
862
+ i = o.promise;
863
+ try {
864
+ Promise.resolve(e()).then(o.resolve, o.reject).then(() => {
865
+ f === k && f.committed && f.deactivate(), qt();
866
+ });
867
+ } catch (u) {
868
+ o.reject(u), qt();
869
+ }
870
+ var f = (
871
+ /** @type {Batch} */
872
+ k
873
+ );
874
+ if (a) {
875
+ var c = !n.is_pending();
876
+ n.update_pending_count(1), f.increment(c), l.get(f)?.reject(it), l.delete(f), l.set(f, o);
877
+ }
878
+ const p = (u, v = void 0) => {
879
+ if (f.activate(), v)
880
+ v !== it && (s.f |= Ue, ht(s, v));
881
+ else {
882
+ (s.f & Ue) !== 0 && (s.f ^= Ue), ht(s, u);
883
+ for (const [g, A] of l) {
884
+ if (l.delete(g), g === f) break;
885
+ A.reject(it);
886
+ }
887
+ }
888
+ a && (n.update_pending_count(-1), f.decrement(c));
889
+ };
890
+ o.promise.then(p, (u) => p(null, u || "unknown"));
891
+ }), $n(() => {
892
+ for (const o of l.values())
893
+ o.reject(it);
894
+ }), new Promise((o) => {
895
+ function f(c) {
896
+ function p() {
897
+ c === i ? o(s) : f(i);
898
+ }
899
+ c.then(p, p);
900
+ }
901
+ f(i);
902
+ });
903
+ }
904
+ // @__NO_SIDE_EFFECTS__
905
+ function ft(e) {
906
+ const t = /* @__PURE__ */ Qt(e);
907
+ return Mn(t), t;
908
+ }
909
+ // @__NO_SIDE_EFFECTS__
910
+ function Ps(e) {
911
+ const t = /* @__PURE__ */ Qt(e);
912
+ return t.equals = sn, t;
913
+ }
914
+ function dn(e) {
915
+ var t = e.effects;
916
+ if (t !== null) {
917
+ e.effects = null;
918
+ for (var r = 0; r < t.length; r += 1)
919
+ Z(
920
+ /** @type {Effect} */
921
+ t[r]
922
+ );
923
+ }
924
+ }
925
+ function js(e) {
926
+ for (var t = e.parent; t !== null; ) {
927
+ if ((t.f & O) === 0)
928
+ return (t.f & Ce) === 0 ? (
929
+ /** @type {Effect} */
930
+ t
931
+ ) : null;
932
+ t = t.parent;
933
+ }
934
+ return null;
935
+ }
936
+ function Ar(e) {
937
+ var t, r = x;
938
+ we(js(e));
939
+ try {
940
+ e.f &= ~We, dn(e), t = Ln(e);
941
+ } finally {
942
+ we(r);
943
+ }
944
+ return t;
945
+ }
946
+ function vn(e) {
947
+ var t = Ar(e);
948
+ if (e.equals(t) || (k?.is_fork || (e.v = t), e.wv = Nn()), !Qe)
949
+ if (ie !== null)
950
+ (Ct() || k?.is_fork) && ie.set(e, t);
951
+ else {
952
+ var r = (e.f & pe) === 0 ? Le : F;
953
+ U(e, r);
954
+ }
955
+ }
956
+ let hr = /* @__PURE__ */ new Set();
957
+ const Be = /* @__PURE__ */ new Map();
958
+ let hn = !1;
959
+ function Je(e, t) {
960
+ var r = {
961
+ f: 0,
962
+ // TODO ideally we could skip this altogether, but it causes type errors
963
+ v: e,
964
+ reactions: null,
965
+ equals: nn,
966
+ rv: 0,
967
+ wv: 0
968
+ };
969
+ return r;
970
+ }
971
+ // @__NO_SIDE_EFFECTS__
972
+ function I(e, t) {
973
+ const r = Je(e);
974
+ return Mn(r), r;
975
+ }
976
+ // @__NO_SIDE_EFFECTS__
977
+ function pn(e, t = !1, r = !0) {
978
+ const n = Je(e);
979
+ return t || (n.equals = sn), n;
980
+ }
981
+ function m(e, t, r = !1) {
982
+ y !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
983
+ // to ensure we error if state is set inside an inspect effect
984
+ (!be || (y.f & jr) !== 0) && an() && (y.f & (O | Ne | zr | jr)) !== 0 && !Me?.includes(e) && $s();
985
+ let n = r ? at(t) : t;
986
+ return ht(e, n);
987
+ }
988
+ function ht(e, t) {
989
+ if (!e.equals(t)) {
990
+ var r = e.v;
991
+ Qe ? Be.set(e, t) : Be.set(e, r), e.v = t;
992
+ var n = he.ensure();
993
+ n.capture(e, r), (e.f & O) !== 0 && ((e.f & G) !== 0 && Ar(
994
+ /** @type {Derived} */
995
+ e
996
+ ), U(e, (e.f & pe) !== 0 ? F : Le)), e.wv = Nn(), mn(e, G), x !== null && (x.f & F) !== 0 && (x.f & (Re | He)) === 0 && (re === null ? Ws([e]) : re.push(e)), !n.is_fork && hr.size > 0 && !hn && Ds();
997
+ }
998
+ return t;
999
+ }
1000
+ function Ds() {
1001
+ hn = !1;
1002
+ var e = Ye;
1003
+ Ht(!0);
1004
+ const t = Array.from(hr);
1005
+ try {
1006
+ for (const r of t)
1007
+ (r.f & F) !== 0 && U(r, Le), Rt(r) && It(r);
1008
+ } finally {
1009
+ Ht(e);
1010
+ }
1011
+ hr.clear();
1012
+ }
1013
+ function At(e) {
1014
+ m(e, e.v + 1);
1015
+ }
1016
+ function mn(e, t) {
1017
+ var r = e.reactions;
1018
+ if (r !== null)
1019
+ for (var n = r.length, i = 0; i < n; i++) {
1020
+ var s = r[i], a = s.f, l = (a & G) === 0;
1021
+ if (l && U(s, t), (a & O) !== 0) {
1022
+ var o = (
1023
+ /** @type {Derived} */
1024
+ s
1025
+ );
1026
+ ie?.delete(o), (a & We) === 0 && (a & pe && (s.f |= We), mn(o, Le));
1027
+ } else l && ((a & Ne) !== 0 && Ee !== null && Ee.add(
1028
+ /** @type {Effect} */
1029
+ s
1030
+ ), Ge(
1031
+ /** @type {Effect} */
1032
+ s
1033
+ ));
1034
+ }
1035
+ }
1036
+ function at(e) {
1037
+ if (typeof e != "object" || e === null || lr in e)
1038
+ return e;
1039
+ const t = Qr(e);
1040
+ if (t !== os && t !== fs)
1041
+ return e;
1042
+ var r = /* @__PURE__ */ new Map(), n = Xr(e), i = /* @__PURE__ */ I(0), s = Ke, a = (l) => {
1043
+ if (Ke === s)
1044
+ return l();
1045
+ var o = y, f = Ke;
1046
+ K(null), Hr(s);
1047
+ var c = l();
1048
+ return K(o), Hr(f), c;
1049
+ };
1050
+ return n && r.set("length", /* @__PURE__ */ I(
1051
+ /** @type {any[]} */
1052
+ e.length
1053
+ )), new Proxy(
1054
+ /** @type {any} */
1055
+ e,
1056
+ {
1057
+ defineProperty(l, o, f) {
1058
+ (!("value" in f) || f.configurable === !1 || f.enumerable === !1 || f.writable === !1) && ys();
1059
+ var c = r.get(o);
1060
+ return c === void 0 ? c = a(() => {
1061
+ var p = /* @__PURE__ */ I(f.value);
1062
+ return r.set(o, p), p;
1063
+ }) : m(c, f.value, !0), !0;
1064
+ },
1065
+ deleteProperty(l, o) {
1066
+ var f = r.get(o);
1067
+ if (f === void 0) {
1068
+ if (o in l) {
1069
+ const c = a(() => /* @__PURE__ */ I(j));
1070
+ r.set(o, c), At(i);
1071
+ }
1072
+ } else
1073
+ m(f, j), At(i);
1074
+ return !0;
1075
+ },
1076
+ get(l, o, f) {
1077
+ if (o === lr)
1078
+ return e;
1079
+ var c = r.get(o), p = o in l;
1080
+ if (c === void 0 && (!p || ot(l, o)?.writable) && (c = a(() => {
1081
+ var v = at(p ? l[o] : j), g = /* @__PURE__ */ I(v);
1082
+ return g;
1083
+ }), r.set(o, c)), c !== void 0) {
1084
+ var u = d(c);
1085
+ return u === j ? void 0 : u;
1086
+ }
1087
+ return Reflect.get(l, o, f);
1088
+ },
1089
+ getOwnPropertyDescriptor(l, o) {
1090
+ var f = Reflect.getOwnPropertyDescriptor(l, o);
1091
+ if (f && "value" in f) {
1092
+ var c = r.get(o);
1093
+ c && (f.value = d(c));
1094
+ } else if (f === void 0) {
1095
+ var p = r.get(o), u = p?.v;
1096
+ if (p !== void 0 && u !== j)
1097
+ return {
1098
+ enumerable: !0,
1099
+ configurable: !0,
1100
+ value: u,
1101
+ writable: !0
1102
+ };
1103
+ }
1104
+ return f;
1105
+ },
1106
+ has(l, o) {
1107
+ if (o === lr)
1108
+ return !0;
1109
+ var f = r.get(o), c = f !== void 0 && f.v !== j || Reflect.has(l, o);
1110
+ if (f !== void 0 || x !== null && (!c || ot(l, o)?.writable)) {
1111
+ f === void 0 && (f = a(() => {
1112
+ var u = c ? at(l[o]) : j, v = /* @__PURE__ */ I(u);
1113
+ return v;
1114
+ }), r.set(o, f));
1115
+ var p = d(f);
1116
+ if (p === j)
1117
+ return !1;
1118
+ }
1119
+ return c;
1120
+ },
1121
+ set(l, o, f, c) {
1122
+ var p = r.get(o), u = o in l;
1123
+ if (n && o === "length")
1124
+ for (var v = f; v < /** @type {Source<number>} */
1125
+ p.v; v += 1) {
1126
+ var g = r.get(v + "");
1127
+ g !== void 0 ? m(g, j) : v in l && (g = a(() => /* @__PURE__ */ I(j)), r.set(v + "", g));
1128
+ }
1129
+ if (p === void 0)
1130
+ (!u || ot(l, o)?.writable) && (p = a(() => /* @__PURE__ */ I(void 0)), m(p, at(f)), r.set(o, p));
1131
+ else {
1132
+ u = p.v !== j;
1133
+ var A = a(() => at(f));
1134
+ m(p, A);
1135
+ }
1136
+ var h = Reflect.getOwnPropertyDescriptor(l, o);
1137
+ if (h?.set && h.set.call(c, f), !u) {
1138
+ if (n && typeof o == "string") {
1139
+ var _ = (
1140
+ /** @type {Source<number>} */
1141
+ r.get("length")
1142
+ ), B = Number(o);
1143
+ Number.isInteger(B) && B >= _.v && m(_, B + 1);
1144
+ }
1145
+ At(i);
1146
+ }
1147
+ return !0;
1148
+ },
1149
+ ownKeys(l) {
1150
+ d(i);
1151
+ var o = Reflect.ownKeys(l).filter((p) => {
1152
+ var u = r.get(p);
1153
+ return u === void 0 || u.v !== j;
1154
+ });
1155
+ for (var [f, c] of r)
1156
+ c.v !== j && !(f in l) && o.push(f);
1157
+ return o;
1158
+ },
1159
+ setPrototypeOf() {
1160
+ xs();
1161
+ }
1162
+ }
1163
+ );
1164
+ }
1165
+ var Fr, _n, gn, bn;
1166
+ function pr() {
1167
+ if (Fr === void 0) {
1168
+ Fr = window, _n = /Firefox/.test(navigator.userAgent);
1169
+ var e = Element.prototype, t = Node.prototype, r = Text.prototype;
1170
+ gn = ot(t, "firstChild").get, bn = ot(t, "nextSibling").get, Pr(e) && (e.__click = void 0, e.__className = void 0, e.__attributes = null, e.__style = void 0, e.__e = void 0), Pr(r) && (r.__t = void 0);
1171
+ }
1172
+ }
1173
+ function ae(e = "") {
1174
+ return document.createTextNode(e);
1175
+ }
1176
+ // @__NO_SIDE_EFFECTS__
1177
+ function Ie(e) {
1178
+ return (
1179
+ /** @type {TemplateNode | null} */
1180
+ gn.call(e)
1181
+ );
1182
+ }
1183
+ // @__NO_SIDE_EFFECTS__
1184
+ function Oe(e) {
1185
+ return (
1186
+ /** @type {TemplateNode | null} */
1187
+ bn.call(e)
1188
+ );
1189
+ }
1190
+ function E(e, t) {
1191
+ if (!w)
1192
+ return /* @__PURE__ */ Ie(e);
1193
+ var r = /* @__PURE__ */ Ie(S);
1194
+ if (r === null)
1195
+ r = S.appendChild(ae());
1196
+ else if (t && r.nodeType !== kr) {
1197
+ var n = ae();
1198
+ return r?.before(n), W(n), n;
1199
+ }
1200
+ return W(r), r;
1201
+ }
1202
+ function C(e, t = 1, r = !1) {
1203
+ let n = w ? S : e;
1204
+ for (var i; t--; )
1205
+ i = n, n = /** @type {TemplateNode} */
1206
+ /* @__PURE__ */ Oe(n);
1207
+ if (!w)
1208
+ return n;
1209
+ if (r && n?.nodeType !== kr) {
1210
+ var s = ae();
1211
+ return n === null ? i?.after(s) : n.before(s), W(s), s;
1212
+ }
1213
+ return W(n), n;
1214
+ }
1215
+ function Tr(e) {
1216
+ e.textContent = "";
1217
+ }
1218
+ function wn() {
1219
+ return !1;
1220
+ }
1221
+ function yn(e) {
1222
+ w && /* @__PURE__ */ Ie(e) !== null && Tr(e);
1223
+ }
1224
+ let Ur = !1;
1225
+ function xn() {
1226
+ Ur || (Ur = !0, document.addEventListener(
1227
+ "reset",
1228
+ (e) => {
1229
+ Promise.resolve().then(() => {
1230
+ if (!e.defaultPrevented)
1231
+ for (
1232
+ const t of
1233
+ /**@type {HTMLFormElement} */
1234
+ e.target.elements
1235
+ )
1236
+ t.__on_r?.();
1237
+ });
1238
+ },
1239
+ // In the capture phase to guarantee we get noticed of it (no possibility of stopPropagation)
1240
+ { capture: !0 }
1241
+ ));
1242
+ }
1243
+ function er(e) {
1244
+ var t = y, r = x;
1245
+ K(null), we(null);
1246
+ try {
1247
+ return e();
1248
+ } finally {
1249
+ K(t), we(r);
1250
+ }
1251
+ }
1252
+ function Fs(e, t, r, n = r) {
1253
+ e.addEventListener(t, () => er(r));
1254
+ const i = e.__on_r;
1255
+ i ? e.__on_r = () => {
1256
+ i(), n(!0);
1257
+ } : e.__on_r = () => n(!0), xn();
1258
+ }
1259
+ function Us(e) {
1260
+ x === null && (y === null && gs(), _s()), Qe && ms();
1261
+ }
1262
+ function Bs(e, t) {
1263
+ var r = t.last;
1264
+ r === null ? t.last = t.first = e : (r.next = e, e.prev = r, t.last = e);
1265
+ }
1266
+ function ye(e, t, r) {
1267
+ var n = x;
1268
+ n !== null && (n.f & Q) !== 0 && (e |= Q);
1269
+ var i = {
1270
+ ctx: le,
1271
+ deps: null,
1272
+ nodes: null,
1273
+ f: e | G | pe,
1274
+ first: null,
1275
+ fn: t,
1276
+ last: null,
1277
+ next: null,
1278
+ parent: n,
1279
+ b: n && n.b,
1280
+ prev: null,
1281
+ teardown: null,
1282
+ wv: 0,
1283
+ ac: null
1284
+ };
1285
+ if (r)
1286
+ try {
1287
+ It(i), i.f |= Wt;
1288
+ } catch (l) {
1289
+ throw Z(i), l;
1290
+ }
1291
+ else t !== null && Ge(i);
1292
+ var s = i;
1293
+ if (r && s.deps === null && s.teardown === null && s.nodes === null && s.first === s.last && // either `null`, or a singular child
1294
+ (s.f & Xe) === 0 && (s = s.first, (e & Ne) !== 0 && (e & ut) !== 0 && s !== null && (s.f |= ut)), s !== null && (s.parent = n, n !== null && Bs(s, n), y !== null && (y.f & O) !== 0 && (e & He) === 0)) {
1295
+ var a = (
1296
+ /** @type {Derived} */
1297
+ y
1298
+ );
1299
+ (a.effects ??= []).push(s);
1300
+ }
1301
+ return i;
1302
+ }
1303
+ function Ct() {
1304
+ return y !== null && !be;
1305
+ }
1306
+ function $n(e) {
1307
+ const t = ye($r, null, !1);
1308
+ return U(t, F), t.teardown = e, t;
1309
+ }
1310
+ function Br(e) {
1311
+ Us();
1312
+ var t = (
1313
+ /** @type {Effect} */
1314
+ x.f
1315
+ ), r = !y && (t & Re) !== 0 && (t & Wt) === 0;
1316
+ if (r) {
1317
+ var n = (
1318
+ /** @type {ComponentContext} */
1319
+ le
1320
+ );
1321
+ (n.e ??= []).push(e);
1322
+ } else
1323
+ return zn(e);
1324
+ }
1325
+ function zn(e) {
1326
+ return ye(xr | ds, e, !1);
1327
+ }
1328
+ function qs(e) {
1329
+ he.ensure();
1330
+ const t = ye(He | Xe, e, !0);
1331
+ return () => {
1332
+ Z(t);
1333
+ };
1334
+ }
1335
+ function Hs(e) {
1336
+ he.ensure();
1337
+ const t = ye(He | Xe, e, !0);
1338
+ return (r = {}) => new Promise((n) => {
1339
+ r.outro ? Ve(t, () => {
1340
+ Z(t), n(void 0);
1341
+ }) : (Z(t), n(void 0));
1342
+ });
1343
+ }
1344
+ function Zs(e) {
1345
+ return ye(xr, e, !1);
1346
+ }
1347
+ function Vs(e) {
1348
+ return ye(zr | Xe, e, !0);
1349
+ }
1350
+ function Cr(e, t = 0) {
1351
+ return ye($r | t, e, !0);
1352
+ }
1353
+ function Se(e, t = [], r = [], n = []) {
1354
+ Rs(n, t, r, (i) => {
1355
+ ye($r, () => e(...i.map(d)), !0);
1356
+ });
1357
+ }
1358
+ function Mr(e, t = 0) {
1359
+ var r = ye(Ne | t, e, !0);
1360
+ return r;
1361
+ }
1362
+ function se(e) {
1363
+ return ye(Re | Xe, e, !0);
1364
+ }
1365
+ function kn(e) {
1366
+ var t = e.teardown;
1367
+ if (t !== null) {
1368
+ const r = Qe, n = y;
1369
+ qr(!0), K(null);
1370
+ try {
1371
+ t.call(null);
1372
+ } finally {
1373
+ qr(r), K(n);
1374
+ }
1375
+ }
1376
+ }
1377
+ function En(e, t = !1) {
1378
+ var r = e.first;
1379
+ for (e.first = e.last = null; r !== null; ) {
1380
+ const i = r.ac;
1381
+ i !== null && er(() => {
1382
+ i.abort(it);
1383
+ });
1384
+ var n = r.next;
1385
+ (r.f & He) !== 0 ? r.parent = null : Z(r, t), r = n;
1386
+ }
1387
+ }
1388
+ function Ys(e) {
1389
+ for (var t = e.first; t !== null; ) {
1390
+ var r = t.next;
1391
+ (t.f & Re) === 0 && Z(t), t = r;
1392
+ }
1393
+ }
1394
+ function Z(e, t = !0) {
1395
+ var r = !1;
1396
+ (t || (e.f & tn) !== 0) && e.nodes !== null && e.nodes.end !== null && (Ks(
1397
+ e.nodes.start,
1398
+ /** @type {TemplateNode} */
1399
+ e.nodes.end
1400
+ ), r = !0), En(e, t && !r), Zt(e, 0), U(e, Ce);
1401
+ var n = e.nodes && e.nodes.t;
1402
+ if (n !== null)
1403
+ for (const s of n)
1404
+ s.stop();
1405
+ kn(e);
1406
+ var i = e.parent;
1407
+ i !== null && i.first !== null && Sn(e), e.next = e.prev = e.teardown = e.ctx = e.deps = e.fn = e.nodes = e.ac = null;
1408
+ }
1409
+ function Ks(e, t) {
1410
+ for (; e !== null; ) {
1411
+ var r = e === t ? null : /* @__PURE__ */ Oe(e);
1412
+ e.remove(), e = r;
1413
+ }
1414
+ }
1415
+ function Sn(e) {
1416
+ var t = e.parent, r = e.prev, n = e.next;
1417
+ r !== null && (r.next = n), n !== null && (n.prev = r), t !== null && (t.first === e && (t.first = n), t.last === e && (t.last = r));
1418
+ }
1419
+ function Ve(e, t, r = !0) {
1420
+ var n = [];
1421
+ An(e, n, !0);
1422
+ var i = () => {
1423
+ r && Z(e), t && t();
1424
+ }, s = n.length;
1425
+ if (s > 0) {
1426
+ var a = () => --s || i();
1427
+ for (var l of n)
1428
+ l.out(a);
1429
+ } else
1430
+ i();
1431
+ }
1432
+ function An(e, t, r) {
1433
+ if ((e.f & Q) === 0) {
1434
+ e.f ^= Q;
1435
+ var n = e.nodes && e.nodes.t;
1436
+ if (n !== null)
1437
+ for (const l of n)
1438
+ (l.is_global || r) && t.push(l);
1439
+ for (var i = e.first; i !== null; ) {
1440
+ var s = i.next, a = (i.f & ut) !== 0 || // If this is a branch effect without a block effect parent,
1441
+ // it means the parent block effect was pruned. In that case,
1442
+ // transparency information was transferred to the branch effect.
1443
+ (i.f & Re) !== 0 && (e.f & Ne) !== 0;
1444
+ An(i, t, a ? r : !1), i = s;
1445
+ }
1446
+ }
1447
+ }
1448
+ function Ir(e) {
1449
+ Tn(e, !0);
1450
+ }
1451
+ function Tn(e, t) {
1452
+ if ((e.f & Q) !== 0) {
1453
+ e.f ^= Q, (e.f & F) === 0 && (U(e, G), Ge(e));
1454
+ for (var r = e.first; r !== null; ) {
1455
+ var n = r.next, i = (r.f & ut) !== 0 || (r.f & Re) !== 0;
1456
+ Tn(r, i ? t : !1), r = n;
1457
+ }
1458
+ var s = e.nodes && e.nodes.t;
1459
+ if (s !== null)
1460
+ for (const a of s)
1461
+ (a.is_global || t) && a.in();
1462
+ }
1463
+ }
1464
+ function Cn(e, t) {
1465
+ if (e.nodes)
1466
+ for (var r = e.nodes.start, n = e.nodes.end; r !== null; ) {
1467
+ var i = r === n ? null : /* @__PURE__ */ Oe(r);
1468
+ t.append(r), r = i;
1469
+ }
1470
+ }
1471
+ let Ye = !1;
1472
+ function Ht(e) {
1473
+ Ye = e;
1474
+ }
1475
+ let Qe = !1;
1476
+ function qr(e) {
1477
+ Qe = e;
1478
+ }
1479
+ let y = null, be = !1;
1480
+ function K(e) {
1481
+ y = e;
1482
+ }
1483
+ let x = null;
1484
+ function we(e) {
1485
+ x = e;
1486
+ }
1487
+ let Me = null;
1488
+ function Mn(e) {
1489
+ y !== null && (Me === null ? Me = [e] : Me.push(e));
1490
+ }
1491
+ let H = null, X = 0, re = null;
1492
+ function Ws(e) {
1493
+ re = e;
1494
+ }
1495
+ let In = 1, Mt = 0, Ke = Mt;
1496
+ function Hr(e) {
1497
+ Ke = e;
1498
+ }
1499
+ function Nn() {
1500
+ return ++In;
1501
+ }
1502
+ function Rt(e) {
1503
+ var t = e.f;
1504
+ if ((t & G) !== 0)
1505
+ return !0;
1506
+ if (t & O && (e.f &= ~We), (t & Le) !== 0) {
1507
+ var r = e.deps;
1508
+ if (r !== null)
1509
+ for (var n = r.length, i = 0; i < n; i++) {
1510
+ var s = r[i];
1511
+ if (Rt(
1512
+ /** @type {Derived} */
1513
+ s
1514
+ ) && vn(
1515
+ /** @type {Derived} */
1516
+ s
1517
+ ), s.wv > e.wv)
1518
+ return !0;
1519
+ }
1520
+ (t & pe) !== 0 && // During time traveling we don't want to reset the status so that
1521
+ // traversal of the graph in the other batches still happens
1522
+ ie === null && U(e, F);
1523
+ }
1524
+ return !1;
1525
+ }
1526
+ function Rn(e, t, r = !0) {
1527
+ var n = e.reactions;
1528
+ if (n !== null && !Me?.includes(e))
1529
+ for (var i = 0; i < n.length; i++) {
1530
+ var s = n[i];
1531
+ (s.f & O) !== 0 ? Rn(
1532
+ /** @type {Derived} */
1533
+ s,
1534
+ t,
1535
+ !1
1536
+ ) : t === s && (r ? U(s, G) : (s.f & F) !== 0 && U(s, Le), Ge(
1537
+ /** @type {Effect} */
1538
+ s
1539
+ ));
1540
+ }
1541
+ }
1542
+ function Ln(e) {
1543
+ var t = H, r = X, n = re, i = y, s = Me, a = le, l = be, o = Ke, f = e.f;
1544
+ H = /** @type {null | Value[]} */
1545
+ null, X = 0, re = null, y = (f & (Re | He)) === 0 ? e : null, Me = null, dt(e.ctx), be = !1, Ke = ++Mt, e.ac !== null && (er(() => {
1546
+ e.ac.abort(it);
1547
+ }), e.ac = null);
1548
+ try {
1549
+ e.f |= dr;
1550
+ var c = (
1551
+ /** @type {Function} */
1552
+ e.fn
1553
+ ), p = c(), u = e.deps;
1554
+ if (H !== null) {
1555
+ var v;
1556
+ if (Zt(e, X), u !== null && X > 0)
1557
+ for (u.length = X + H.length, v = 0; v < H.length; v++)
1558
+ u[X + v] = H[v];
1559
+ else
1560
+ e.deps = u = H;
1561
+ if (Ct() && (e.f & pe) !== 0)
1562
+ for (v = X; v < u.length; v++)
1563
+ (u[v].reactions ??= []).push(e);
1564
+ } else u !== null && X < u.length && (Zt(e, X), u.length = X);
1565
+ if (an() && re !== null && !be && u !== null && (e.f & (O | Le | G)) === 0)
1566
+ for (v = 0; v < /** @type {Source[]} */
1567
+ re.length; v++)
1568
+ Rn(
1569
+ re[v],
1570
+ /** @type {Effect} */
1571
+ e
1572
+ );
1573
+ return i !== null && i !== e && (Mt++, re !== null && (n === null ? n = re : n.push(.../** @type {Source[]} */
1574
+ re))), (e.f & Ue) !== 0 && (e.f ^= Ue), p;
1575
+ } catch (g) {
1576
+ return on(g);
1577
+ } finally {
1578
+ e.f ^= dr, H = t, X = r, re = n, y = i, Me = s, dt(a), be = l, Ke = o;
1579
+ }
1580
+ }
1581
+ function Gs(e, t) {
1582
+ let r = t.reactions;
1583
+ if (r !== null) {
1584
+ var n = as.call(r, e);
1585
+ if (n !== -1) {
1586
+ var i = r.length - 1;
1587
+ i === 0 ? r = t.reactions = null : (r[n] = r[i], r.pop());
1588
+ }
1589
+ }
1590
+ r === null && (t.f & O) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
1591
+ // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
1592
+ // allows us to skip the expensive work of disconnecting and immediately reconnecting it
1593
+ (H === null || !H.includes(t)) && (U(t, Le), (t.f & pe) !== 0 && (t.f ^= pe, t.f &= ~We), dn(
1594
+ /** @type {Derived} **/
1595
+ t
1596
+ ), Zt(
1597
+ /** @type {Derived} **/
1598
+ t,
1599
+ 0
1600
+ ));
1601
+ }
1602
+ function Zt(e, t) {
1603
+ var r = e.deps;
1604
+ if (r !== null)
1605
+ for (var n = t; n < r.length; n++)
1606
+ Gs(e, r[n]);
1607
+ }
1608
+ function It(e) {
1609
+ var t = e.f;
1610
+ if ((t & Ce) === 0) {
1611
+ U(e, F);
1612
+ var r = x, n = Ye;
1613
+ x = e, Ye = !0;
1614
+ try {
1615
+ (t & (Ne | us)) !== 0 ? Ys(e) : En(e), kn(e);
1616
+ var i = Ln(e);
1617
+ e.teardown = typeof i == "function" ? i : null, e.wv = In;
1618
+ var s;
1619
+ ur && Ss && (e.f & G) !== 0 && e.deps;
1620
+ } finally {
1621
+ Ye = n, x = r;
1622
+ }
1623
+ }
1624
+ }
1625
+ async function Js() {
1626
+ await Promise.resolve(), D();
1627
+ }
1628
+ function d(e) {
1629
+ var t = e.f, r = (t & O) !== 0;
1630
+ if (y !== null && !be) {
1631
+ var n = x !== null && (x.f & Ce) !== 0;
1632
+ if (!n && !Me?.includes(e)) {
1633
+ var i = y.deps;
1634
+ if ((y.f & dr) !== 0)
1635
+ e.rv < Mt && (e.rv = Mt, H === null && i !== null && i[X] === e ? X++ : H === null ? H = [e] : H.includes(e) || H.push(e));
1636
+ else {
1637
+ (y.deps ??= []).push(e);
1638
+ var s = e.reactions;
1639
+ s === null ? e.reactions = [y] : s.includes(y) || s.push(y);
1640
+ }
1641
+ }
1642
+ }
1643
+ if (Qe) {
1644
+ if (Be.has(e))
1645
+ return Be.get(e);
1646
+ if (r) {
1647
+ var a = (
1648
+ /** @type {Derived} */
1649
+ e
1650
+ ), l = a.v;
1651
+ return ((a.f & F) === 0 && a.reactions !== null || Pn(a)) && (l = Ar(a)), Be.set(a, l), l;
1652
+ }
1653
+ } else r && (!ie?.has(e) || k?.is_fork && !Ct()) && (a = /** @type {Derived} */
1654
+ e, Rt(a) && vn(a), Ye && Ct() && (a.f & pe) === 0 && On(a));
1655
+ if (ie?.has(e))
1656
+ return ie.get(e);
1657
+ if ((e.f & Ue) !== 0)
1658
+ throw e.v;
1659
+ return e.v;
1660
+ }
1661
+ function On(e) {
1662
+ if (e.deps !== null) {
1663
+ e.f ^= pe;
1664
+ for (const t of e.deps)
1665
+ (t.reactions ??= []).push(e), (t.f & O) !== 0 && (t.f & pe) === 0 && On(
1666
+ /** @type {Derived} */
1667
+ t
1668
+ );
1669
+ }
1670
+ }
1671
+ function Pn(e) {
1672
+ if (e.v === j) return !0;
1673
+ if (e.deps === null) return !1;
1674
+ for (const t of e.deps)
1675
+ if (Be.has(t) || (t.f & O) !== 0 && Pn(
1676
+ /** @type {Derived} */
1677
+ t
1678
+ ))
1679
+ return !0;
1680
+ return !1;
1681
+ }
1682
+ function jn(e) {
1683
+ var t = be;
1684
+ try {
1685
+ return be = !0, e();
1686
+ } finally {
1687
+ be = t;
1688
+ }
1689
+ }
1690
+ const Xs = -7169;
1691
+ function U(e, t) {
1692
+ e.f = e.f & Xs | t;
1693
+ }
1694
+ const Dn = /* @__PURE__ */ new Set(), mr = /* @__PURE__ */ new Set();
1695
+ function Qs(e, t, r, n = {}) {
1696
+ function i(s) {
1697
+ if (n.capture || zt.call(t, s), !s.cancelBubble)
1698
+ return er(() => r?.call(this, s));
1699
+ }
1700
+ return e.startsWith("pointer") || e.startsWith("touch") || e === "wheel" ? mt(() => {
1701
+ t.addEventListener(e, i, n);
1702
+ }) : t.addEventListener(e, i, n), i;
1703
+ }
1704
+ function Fn(e, t, r, n, i) {
1705
+ var s = { capture: n, passive: i }, a = Qs(e, t, r, s);
1706
+ (t === document.body || // @ts-ignore
1707
+ t === window || // @ts-ignore
1708
+ t === document || // Firefox has quirky behavior, it can happen that we still get "canplay" events when the element is already removed
1709
+ t instanceof HTMLMediaElement) && $n(() => {
1710
+ t.removeEventListener(e, a, s);
1711
+ });
1712
+ }
1713
+ function Un(e) {
1714
+ for (var t = 0; t < e.length; t++)
1715
+ Dn.add(e[t]);
1716
+ for (var r of mr)
1717
+ r(e);
1718
+ }
1719
+ let Zr = null;
1720
+ function zt(e) {
1721
+ var t = this, r = (
1722
+ /** @type {Node} */
1723
+ t.ownerDocument
1724
+ ), n = e.type, i = e.composedPath?.() || [], s = (
1725
+ /** @type {null | Element} */
1726
+ i[0] || e.target
1727
+ );
1728
+ Zr = e;
1729
+ var a = 0, l = Zr === e && e.__root;
1730
+ if (l) {
1731
+ var o = i.indexOf(l);
1732
+ if (o !== -1 && (t === document || t === /** @type {any} */
1733
+ window)) {
1734
+ e.__root = t;
1735
+ return;
1736
+ }
1737
+ var f = i.indexOf(t);
1738
+ if (f === -1)
1739
+ return;
1740
+ o <= f && (a = o);
1741
+ }
1742
+ if (s = /** @type {Element} */
1743
+ i[a] || e.target, s !== t) {
1744
+ Ut(e, "currentTarget", {
1745
+ configurable: !0,
1746
+ get() {
1747
+ return s || r;
1748
+ }
1749
+ });
1750
+ var c = y, p = x;
1751
+ K(null), we(null);
1752
+ try {
1753
+ for (var u, v = []; s !== null; ) {
1754
+ var g = s.assignedSlot || s.parentNode || /** @type {any} */
1755
+ s.host || null;
1756
+ try {
1757
+ var A = s["__" + n];
1758
+ A != null && (!/** @type {any} */
1759
+ s.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
1760
+ // -> the target could not have been disabled because it emits the event in the first place
1761
+ e.target === s) && A.call(s, e);
1762
+ } catch (h) {
1763
+ u ? v.push(h) : u = h;
1764
+ }
1765
+ if (e.cancelBubble || g === t || g === null)
1766
+ break;
1767
+ s = g;
1768
+ }
1769
+ if (u) {
1770
+ for (let h of v)
1771
+ queueMicrotask(() => {
1772
+ throw h;
1773
+ });
1774
+ throw u;
1775
+ }
1776
+ } finally {
1777
+ e.__root = t, delete e.currentTarget, K(c), we(p);
1778
+ }
1779
+ }
1780
+ }
1781
+ function Bn(e) {
1782
+ var t = document.createElement("template");
1783
+ return t.innerHTML = e.replaceAll("<!>", "<!---->"), t.content;
1784
+ }
1785
+ function qe(e, t) {
1786
+ var r = (
1787
+ /** @type {Effect} */
1788
+ x
1789
+ );
1790
+ r.nodes === null && (r.nodes = { start: e, end: t, a: null, t: null });
1791
+ }
1792
+ // @__NO_SIDE_EFFECTS__
1793
+ function J(e, t) {
1794
+ var r = (t & ns) !== 0, n = (t & ss) !== 0, i, s = !e.startsWith("<!>");
1795
+ return () => {
1796
+ if (w)
1797
+ return qe(S, null), S;
1798
+ i === void 0 && (i = Bn(s ? e : "<!>" + e), r || (i = /** @type {TemplateNode} */
1799
+ /* @__PURE__ */ Ie(i)));
1800
+ var a = (
1801
+ /** @type {TemplateNode} */
1802
+ n || _n ? document.importNode(i, !0) : i.cloneNode(!0)
1803
+ );
1804
+ if (r) {
1805
+ var l = (
1806
+ /** @type {TemplateNode} */
1807
+ /* @__PURE__ */ Ie(a)
1808
+ ), o = (
1809
+ /** @type {TemplateNode} */
1810
+ a.lastChild
1811
+ );
1812
+ qe(l, o);
1813
+ } else
1814
+ qe(a, a);
1815
+ return a;
1816
+ };
1817
+ }
1818
+ // @__NO_SIDE_EFFECTS__
1819
+ function ei(e, t, r = "svg") {
1820
+ var n = !e.startsWith("<!>"), i = `<${r}>${n ? e : "<!>" + e}</${r}>`, s;
1821
+ return () => {
1822
+ if (w)
1823
+ return qe(S, null), S;
1824
+ if (!s) {
1825
+ var a = (
1826
+ /** @type {DocumentFragment} */
1827
+ Bn(i)
1828
+ ), l = (
1829
+ /** @type {Element} */
1830
+ /* @__PURE__ */ Ie(a)
1831
+ );
1832
+ s = /** @type {Element} */
1833
+ /* @__PURE__ */ Ie(l);
1834
+ }
1835
+ var o = (
1836
+ /** @type {TemplateNode} */
1837
+ s.cloneNode(!0)
1838
+ );
1839
+ return qe(o, o), o;
1840
+ };
1841
+ }
1842
+ // @__NO_SIDE_EFFECTS__
1843
+ function tr(e, t) {
1844
+ return /* @__PURE__ */ ei(e, t, "svg");
1845
+ }
1846
+ function ti(e = "") {
1847
+ if (!w) {
1848
+ var t = ae(e + "");
1849
+ return qe(t, t), t;
1850
+ }
1851
+ var r = S;
1852
+ return r.nodeType !== kr && (r.before(r = ae()), W(r)), qe(r, r), r;
1853
+ }
1854
+ function R(e, t) {
1855
+ if (w) {
1856
+ var r = (
1857
+ /** @type {Effect & { nodes: EffectNodes }} */
1858
+ x
1859
+ );
1860
+ ((r.f & Wt) === 0 || r.nodes.end === null) && (r.nodes.end = S), Jt();
1861
+ return;
1862
+ }
1863
+ e !== null && e.before(
1864
+ /** @type {Node} */
1865
+ t
1866
+ );
1867
+ }
1868
+ const ri = ["touchstart", "touchmove"];
1869
+ function ni(e) {
1870
+ return ri.includes(e);
1871
+ }
1872
+ function lt(e, t) {
1873
+ var r = t == null ? "" : typeof t == "object" ? t + "" : t;
1874
+ r !== (e.__t ??= e.nodeValue) && (e.__t = r, e.nodeValue = r + "");
1875
+ }
1876
+ function qn(e, t) {
1877
+ return Hn(e, t);
1878
+ }
1879
+ function si(e, t) {
1880
+ pr(), t.intro = t.intro ?? !1;
1881
+ const r = t.target, n = w, i = S;
1882
+ try {
1883
+ for (var s = /* @__PURE__ */ Ie(r); s && (s.nodeType !== pt || /** @type {Comment} */
1884
+ s.data !== Jr); )
1885
+ s = /* @__PURE__ */ Oe(s);
1886
+ if (!s)
1887
+ throw ct;
1888
+ Te(!0), W(
1889
+ /** @type {Comment} */
1890
+ s
1891
+ );
1892
+ const a = Hn(e, { ...t, anchor: s });
1893
+ return Te(!1), /** @type {Exports} */
1894
+ a;
1895
+ } catch (a) {
1896
+ if (a instanceof Error && a.message.split(`
1897
+ `).some((l) => l.startsWith("https://svelte.dev/e/")))
1898
+ throw a;
1899
+ return a !== ct && console.warn("Failed to hydrate: ", a), t.recover === !1 && ws(), pr(), Tr(r), Te(!1), qn(e, t);
1900
+ } finally {
1901
+ Te(n), W(i);
1902
+ }
1903
+ }
1904
+ const st = /* @__PURE__ */ new Map();
1905
+ function Hn(e, { target: t, anchor: r, props: n = {}, events: i, context: s, intro: a = !0 }) {
1906
+ pr();
1907
+ var l = /* @__PURE__ */ new Set(), o = (p) => {
1908
+ for (var u = 0; u < p.length; u++) {
1909
+ var v = p[u];
1910
+ if (!l.has(v)) {
1911
+ l.add(v);
1912
+ var g = ni(v);
1913
+ t.addEventListener(v, zt, { passive: g });
1914
+ var A = st.get(v);
1915
+ A === void 0 ? (document.addEventListener(v, zt, { passive: g }), st.set(v, 1)) : st.set(v, A + 1);
1916
+ }
1917
+ }
1918
+ };
1919
+ o(Yt(Dn)), mr.add(o);
1920
+ var f = void 0, c = Hs(() => {
1921
+ var p = r ?? t.appendChild(ae());
1922
+ return Is(
1923
+ /** @type {TemplateNode} */
1924
+ p,
1925
+ {
1926
+ pending: () => {
1927
+ }
1928
+ },
1929
+ (u) => {
1930
+ if (s) {
1931
+ Er({});
1932
+ var v = (
1933
+ /** @type {ComponentContext} */
1934
+ le
1935
+ );
1936
+ v.c = s;
1937
+ }
1938
+ if (i && (n.$$events = i), w && qe(
1939
+ /** @type {TemplateNode} */
1940
+ u,
1941
+ null
1942
+ ), f = e(u, n) || {}, w && (x.nodes.end = S, S === null || S.nodeType !== pt || /** @type {Comment} */
1943
+ S.data !== yr))
1944
+ throw Gt(), ct;
1945
+ s && Sr();
1946
+ }
1947
+ ), () => {
1948
+ for (var u of l) {
1949
+ t.removeEventListener(u, zt);
1950
+ var v = (
1951
+ /** @type {number} */
1952
+ st.get(u)
1953
+ );
1954
+ --v === 0 ? (document.removeEventListener(u, zt), st.delete(u)) : st.set(u, v);
1955
+ }
1956
+ mr.delete(o), p !== r && p.parentNode?.removeChild(p);
1957
+ };
1958
+ });
1959
+ return _r.set(f, c), f;
1960
+ }
1961
+ let _r = /* @__PURE__ */ new WeakMap();
1962
+ function ii(e, t) {
1963
+ const r = _r.get(e);
1964
+ return r ? (_r.delete(e), r(t)) : Promise.resolve();
1965
+ }
1966
+ class ai {
1967
+ /** @type {TemplateNode} */
1968
+ anchor;
1969
+ /** @type {Map<Batch, Key>} */
1970
+ #t = /* @__PURE__ */ new Map();
1971
+ /**
1972
+ * Map of keys to effects that are currently rendered in the DOM.
1973
+ * These effects are visible and actively part of the document tree.
1974
+ * Example:
1975
+ * ```
1976
+ * {#if condition}
1977
+ * foo
1978
+ * {:else}
1979
+ * bar
1980
+ * {/if}
1981
+ * ```
1982
+ * Can result in the entries `true->Effect` and `false->Effect`
1983
+ * @type {Map<Key, Effect>}
1984
+ */
1985
+ #e = /* @__PURE__ */ new Map();
1986
+ /**
1987
+ * Similar to #onscreen with respect to the keys, but contains branches that are not yet
1988
+ * in the DOM, because their insertion is deferred.
1989
+ * @type {Map<Key, Branch>}
1990
+ */
1991
+ #r = /* @__PURE__ */ new Map();
1992
+ /**
1993
+ * Keys of effects that are currently outroing
1994
+ * @type {Set<Key>}
1995
+ */
1996
+ #n = /* @__PURE__ */ new Set();
1997
+ /**
1998
+ * Whether to pause (i.e. outro) on change, or destroy immediately.
1999
+ * This is necessary for `<svelte:element>`
2000
+ */
2001
+ #o = !0;
2002
+ /**
2003
+ * @param {TemplateNode} anchor
2004
+ * @param {boolean} transition
2005
+ */
2006
+ constructor(t, r = !0) {
2007
+ this.anchor = t, this.#o = r;
2008
+ }
2009
+ #i = () => {
2010
+ var t = (
2011
+ /** @type {Batch} */
2012
+ k
2013
+ );
2014
+ if (this.#t.has(t)) {
2015
+ var r = (
2016
+ /** @type {Key} */
2017
+ this.#t.get(t)
2018
+ ), n = this.#e.get(r);
2019
+ if (n)
2020
+ Ir(n), this.#n.delete(r);
2021
+ else {
2022
+ var i = this.#r.get(r);
2023
+ i && (this.#e.set(r, i.effect), this.#r.delete(r), i.fragment.lastChild.remove(), this.anchor.before(i.fragment), n = i.effect);
2024
+ }
2025
+ for (const [s, a] of this.#t) {
2026
+ if (this.#t.delete(s), s === t)
2027
+ break;
2028
+ const l = this.#r.get(a);
2029
+ l && (Z(l.effect), this.#r.delete(a));
2030
+ }
2031
+ for (const [s, a] of this.#e) {
2032
+ if (s === r || this.#n.has(s)) continue;
2033
+ const l = () => {
2034
+ if (Array.from(this.#t.values()).includes(s)) {
2035
+ var f = document.createDocumentFragment();
2036
+ Cn(a, f), f.append(ae()), this.#r.set(s, { effect: a, fragment: f });
2037
+ } else
2038
+ Z(a);
2039
+ this.#n.delete(s), this.#e.delete(s);
2040
+ };
2041
+ this.#o || !n ? (this.#n.add(s), Ve(a, l, !1)) : l();
2042
+ }
2043
+ }
2044
+ };
2045
+ /**
2046
+ * @param {Batch} batch
2047
+ */
2048
+ #s = (t) => {
2049
+ this.#t.delete(t);
2050
+ const r = Array.from(this.#t.values());
2051
+ for (const [n, i] of this.#r)
2052
+ r.includes(n) || (Z(i.effect), this.#r.delete(n));
2053
+ };
2054
+ /**
2055
+ *
2056
+ * @param {any} key
2057
+ * @param {null | ((target: TemplateNode) => void)} fn
2058
+ */
2059
+ ensure(t, r) {
2060
+ var n = (
2061
+ /** @type {Batch} */
2062
+ k
2063
+ ), i = wn();
2064
+ if (r && !this.#e.has(t) && !this.#r.has(t))
2065
+ if (i) {
2066
+ var s = document.createDocumentFragment(), a = ae();
2067
+ s.append(a), this.#r.set(t, {
2068
+ effect: se(() => r(a)),
2069
+ fragment: s
2070
+ });
2071
+ } else
2072
+ this.#e.set(
2073
+ t,
2074
+ se(() => r(this.anchor))
2075
+ );
2076
+ if (this.#t.set(n, t), i) {
2077
+ for (const [l, o] of this.#e)
2078
+ l === t ? n.skipped_effects.delete(o) : n.skipped_effects.add(o);
2079
+ for (const [l, o] of this.#r)
2080
+ l === t ? n.skipped_effects.delete(o.effect) : n.skipped_effects.add(o.effect);
2081
+ n.oncommit(this.#i), n.ondiscard(this.#s);
2082
+ } else
2083
+ w && (this.anchor = S), this.#i();
2084
+ }
2085
+ }
2086
+ function ge(e, t, r = !1) {
2087
+ w && Jt();
2088
+ var n = new ai(e), i = r ? ut : 0;
2089
+ function s(a, l) {
2090
+ if (w) {
2091
+ const f = rn(e) === Vt;
2092
+ if (a === f) {
2093
+ var o = Bt();
2094
+ W(o), n.anchor = o, Te(!1), n.ensure(a, l), Te(!0);
2095
+ return;
2096
+ }
2097
+ }
2098
+ n.ensure(a, l);
2099
+ }
2100
+ Mr(() => {
2101
+ var a = !1;
2102
+ t((l, o = !0) => {
2103
+ a = !0, s(o, l);
2104
+ }), a || s(!1, null);
2105
+ }, i);
2106
+ }
2107
+ function li(e, t, r) {
2108
+ for (var n = [], i = t.length, s, a = t.length, l = 0; l < i; l++) {
2109
+ let p = t[l];
2110
+ Ve(
2111
+ p,
2112
+ () => {
2113
+ if (s) {
2114
+ if (s.pending.delete(p), s.done.add(p), s.pending.size === 0) {
2115
+ var u = (
2116
+ /** @type {Set<EachOutroGroup>} */
2117
+ e.outrogroups
2118
+ );
2119
+ gr(Yt(s.done)), u.delete(s), u.size === 0 && (e.outrogroups = null);
2120
+ }
2121
+ } else
2122
+ a -= 1;
2123
+ },
2124
+ !1
2125
+ );
2126
+ }
2127
+ if (a === 0) {
2128
+ var o = n.length === 0 && r !== null;
2129
+ if (o) {
2130
+ var f = (
2131
+ /** @type {Element} */
2132
+ r
2133
+ ), c = (
2134
+ /** @type {Element} */
2135
+ f.parentNode
2136
+ );
2137
+ Tr(c), c.append(f), e.items.clear();
2138
+ }
2139
+ gr(t, !o);
2140
+ } else
2141
+ s = {
2142
+ pending: new Set(t),
2143
+ done: /* @__PURE__ */ new Set()
2144
+ }, (e.outrogroups ??= /* @__PURE__ */ new Set()).add(s);
2145
+ }
2146
+ function gr(e, t = !0) {
2147
+ for (var r = 0; r < e.length; r++)
2148
+ Z(e[r], t);
2149
+ }
2150
+ var Vr;
2151
+ function br(e, t, r, n, i, s = null) {
2152
+ var a = e, l = /* @__PURE__ */ new Map(), o = (t & Gr) !== 0;
2153
+ if (o) {
2154
+ var f = (
2155
+ /** @type {Element} */
2156
+ e
2157
+ );
2158
+ a = w ? W(/* @__PURE__ */ Ie(f)) : f.appendChild(ae());
2159
+ }
2160
+ w && Jt();
2161
+ var c = null, p = /* @__PURE__ */ Ps(() => {
2162
+ var _ = r();
2163
+ return Xr(_) ? _ : _ == null ? [] : Yt(_);
2164
+ }), u, v = !0;
2165
+ function g() {
2166
+ h.fallback = c, oi(h, u, a, t, n), c !== null && (u.length === 0 ? (c.f & Ae) === 0 ? Ir(c) : (c.f ^= Ae, kt(c, null, a)) : Ve(c, () => {
2167
+ c = null;
2168
+ }));
2169
+ }
2170
+ var A = Mr(() => {
2171
+ u = /** @type {V[]} */
2172
+ d(p);
2173
+ var _ = u.length;
2174
+ let B = !1;
2175
+ if (w) {
2176
+ var oe = rn(a) === Vt;
2177
+ oe !== (_ === 0) && (a = Bt(), W(a), Te(!1), B = !0);
2178
+ }
2179
+ for (var q = /* @__PURE__ */ new Set(), fe = (
2180
+ /** @type {Batch} */
2181
+ k
2182
+ ), V = wn(), M = 0; M < _; M += 1) {
2183
+ w && S.nodeType === pt && /** @type {Comment} */
2184
+ S.data === yr && (a = /** @type {Comment} */
2185
+ S, B = !0, Te(!1));
2186
+ var ee = u[M], me = n(ee, M), N = v ? null : l.get(me);
2187
+ N ? (N.v && ht(N.v, ee), N.i && ht(N.i, M), V && fe.skipped_effects.delete(N.e)) : (N = fi(
2188
+ l,
2189
+ v ? a : Vr ??= ae(),
2190
+ ee,
2191
+ me,
2192
+ M,
2193
+ i,
2194
+ t,
2195
+ r
2196
+ ), v || (N.e.f |= Ae), l.set(me, N)), q.add(me);
2197
+ }
2198
+ if (_ === 0 && s && !c && (v ? c = se(() => s(a)) : (c = se(() => s(Vr ??= ae())), c.f |= Ae)), w && _ > 0 && W(Bt()), !v)
2199
+ if (V) {
2200
+ for (const [xe, $e] of l)
2201
+ q.has(xe) || fe.skipped_effects.add($e.e);
2202
+ fe.oncommit(g), fe.ondiscard(() => {
2203
+ });
2204
+ } else
2205
+ g();
2206
+ B && Te(!0), d(p);
2207
+ }), h = { effect: A, items: l, outrogroups: null, fallback: c };
2208
+ v = !1, w && (a = S);
2209
+ }
2210
+ function oi(e, t, r, n, i) {
2211
+ var s = (n & ts) !== 0, a = t.length, l = e.items, o = e.effect.first, f, c = null, p, u = [], v = [], g, A, h, _;
2212
+ if (s)
2213
+ for (_ = 0; _ < a; _ += 1)
2214
+ g = t[_], A = i(g, _), h = /** @type {EachItem} */
2215
+ l.get(A).e, (h.f & Ae) === 0 && (h.nodes?.a?.measure(), (p ??= /* @__PURE__ */ new Set()).add(h));
2216
+ for (_ = 0; _ < a; _ += 1) {
2217
+ if (g = t[_], A = i(g, _), h = /** @type {EachItem} */
2218
+ l.get(A).e, e.outrogroups !== null)
2219
+ for (const N of e.outrogroups)
2220
+ N.pending.delete(h), N.done.delete(h);
2221
+ if ((h.f & Ae) !== 0)
2222
+ if (h.f ^= Ae, h === o)
2223
+ kt(h, null, r);
2224
+ else {
2225
+ var B = c ? c.next : o;
2226
+ h === e.effect.last && (e.effect.last = h.prev), h.prev && (h.prev.next = h.next), h.next && (h.next.prev = h.prev), Fe(e, c, h), Fe(e, h, B), kt(h, B, r), c = h, u = [], v = [], o = c.next;
2227
+ continue;
2228
+ }
2229
+ if ((h.f & Q) !== 0 && (Ir(h), s && (h.nodes?.a?.unfix(), (p ??= /* @__PURE__ */ new Set()).delete(h))), h !== o) {
2230
+ if (f !== void 0 && f.has(h)) {
2231
+ if (u.length < v.length) {
2232
+ var oe = v[0], q;
2233
+ c = oe.prev;
2234
+ var fe = u[0], V = u[u.length - 1];
2235
+ for (q = 0; q < u.length; q += 1)
2236
+ kt(u[q], oe, r);
2237
+ for (q = 0; q < v.length; q += 1)
2238
+ f.delete(v[q]);
2239
+ Fe(e, fe.prev, V.next), Fe(e, c, fe), Fe(e, V, oe), o = oe, c = V, _ -= 1, u = [], v = [];
2240
+ } else
2241
+ f.delete(h), kt(h, o, r), Fe(e, h.prev, h.next), Fe(e, h, c === null ? e.effect.first : c.next), Fe(e, c, h), c = h;
2242
+ continue;
2243
+ }
2244
+ for (u = [], v = []; o !== null && o !== h; )
2245
+ (f ??= /* @__PURE__ */ new Set()).add(o), v.push(o), o = o.next;
2246
+ if (o === null)
2247
+ continue;
2248
+ }
2249
+ (h.f & Ae) === 0 && u.push(h), c = h, o = h.next;
2250
+ }
2251
+ if (e.outrogroups !== null) {
2252
+ for (const N of e.outrogroups)
2253
+ N.pending.size === 0 && (gr(Yt(N.done)), e.outrogroups?.delete(N));
2254
+ e.outrogroups.size === 0 && (e.outrogroups = null);
2255
+ }
2256
+ if (o !== null || f !== void 0) {
2257
+ var M = [];
2258
+ if (f !== void 0)
2259
+ for (h of f)
2260
+ (h.f & Q) === 0 && M.push(h);
2261
+ for (; o !== null; )
2262
+ (o.f & Q) === 0 && o !== e.fallback && M.push(o), o = o.next;
2263
+ var ee = M.length;
2264
+ if (ee > 0) {
2265
+ var me = (n & Gr) !== 0 && a === 0 ? r : null;
2266
+ if (s) {
2267
+ for (_ = 0; _ < ee; _ += 1)
2268
+ M[_].nodes?.a?.measure();
2269
+ for (_ = 0; _ < ee; _ += 1)
2270
+ M[_].nodes?.a?.fix();
2271
+ }
2272
+ li(e, M, me);
2273
+ }
2274
+ }
2275
+ s && mt(() => {
2276
+ if (p !== void 0)
2277
+ for (h of p)
2278
+ h.nodes?.a?.apply();
2279
+ });
2280
+ }
2281
+ function fi(e, t, r, n, i, s, a, l) {
2282
+ var o = (a & Qn) !== 0 ? (a & rs) === 0 ? /* @__PURE__ */ pn(r, !1, !1) : Je(r) : null, f = (a & es) !== 0 ? Je(i) : null;
2283
+ return {
2284
+ v: o,
2285
+ i: f,
2286
+ e: se(() => (s(t, o ?? r, f ?? i, l), () => {
2287
+ e.delete(n);
2288
+ }))
2289
+ };
2290
+ }
2291
+ function kt(e, t, r) {
2292
+ if (e.nodes)
2293
+ for (var n = e.nodes.start, i = e.nodes.end, s = t && (t.f & Ae) === 0 ? (
2294
+ /** @type {EffectNodes} */
2295
+ t.nodes.start
2296
+ ) : r; n !== null; ) {
2297
+ var a = (
2298
+ /** @type {TemplateNode} */
2299
+ /* @__PURE__ */ Oe(n)
2300
+ );
2301
+ if (s.before(n), n === i)
2302
+ return;
2303
+ n = a;
2304
+ }
2305
+ }
2306
+ function Fe(e, t, r) {
2307
+ t === null ? e.effect.first = r : t.next = r, r === null ? e.effect.last = t : r.prev = t;
2308
+ }
2309
+ function Zn(e, t) {
2310
+ Zs(() => {
2311
+ var r = e.getRootNode(), n = (
2312
+ /** @type {ShadowRoot} */
2313
+ r.host ? (
2314
+ /** @type {ShadowRoot} */
2315
+ r
2316
+ ) : (
2317
+ /** @type {Document} */
2318
+ r.head ?? /** @type {Document} */
2319
+ r.ownerDocument.head
2320
+ )
2321
+ );
2322
+ if (!n.querySelector("#" + t.hash)) {
2323
+ const i = document.createElement("style");
2324
+ i.id = t.hash, i.textContent = t.code, n.appendChild(i);
2325
+ }
2326
+ });
2327
+ }
2328
+ const Yr = [...`
2329
+ \r\f \v\uFEFF`];
2330
+ function ci(e, t, r) {
2331
+ var n = e == null ? "" : "" + e;
2332
+ if (t && (n = n ? n + " " + t : t), r) {
2333
+ for (var i in r)
2334
+ if (r[i])
2335
+ n = n ? n + " " + i : i;
2336
+ else if (n.length)
2337
+ for (var s = i.length, a = 0; (a = n.indexOf(i, a)) >= 0; ) {
2338
+ var l = a + s;
2339
+ (a === 0 || Yr.includes(n[a - 1])) && (l === n.length || Yr.includes(n[l])) ? n = (a === 0 ? "" : n.substring(0, a)) + n.substring(l + 1) : a = l;
2340
+ }
2341
+ }
2342
+ return n === "" ? null : n;
2343
+ }
2344
+ function ui(e, t) {
2345
+ return e == null ? null : String(e);
2346
+ }
2347
+ function Tt(e, t, r, n, i, s) {
2348
+ var a = e.__className;
2349
+ if (w || a !== r || a === void 0) {
2350
+ var l = ci(r, n, s);
2351
+ (!w || l !== e.getAttribute("class")) && (l == null ? e.removeAttribute("class") : e.className = l), e.__className = r;
2352
+ } else if (s && i !== s)
2353
+ for (var o in s) {
2354
+ var f = !!s[o];
2355
+ (i == null || f !== !!i[o]) && e.classList.toggle(o, f);
2356
+ }
2357
+ return s;
2358
+ }
2359
+ function wr(e, t, r, n) {
2360
+ var i = e.__style;
2361
+ if (w || i !== t) {
2362
+ var s = ui(t);
2363
+ (!w || s !== e.getAttribute("style")) && (s == null ? e.removeAttribute("style") : e.style.cssText = s), e.__style = t;
2364
+ }
2365
+ return n;
2366
+ }
2367
+ const di = Symbol("is custom element"), vi = Symbol("is html");
2368
+ function Kr(e) {
2369
+ if (w) {
2370
+ var t = !1, r = () => {
2371
+ if (!t) {
2372
+ if (t = !0, e.hasAttribute("value")) {
2373
+ var n = e.value;
2374
+ Nt(e, "value", null), e.value = n;
2375
+ }
2376
+ if (e.hasAttribute("checked")) {
2377
+ var i = e.checked;
2378
+ Nt(e, "checked", null), e.checked = i;
2379
+ }
2380
+ }
2381
+ };
2382
+ e.__on_r = r, mt(r), xn();
2383
+ }
2384
+ }
2385
+ function Nt(e, t, r, n) {
2386
+ var i = hi(e);
2387
+ w && (i[t] = e.getAttribute(t), t === "src" || t === "srcset" || t === "href" && e.nodeName === "LINK") || i[t] !== (i[t] = r) && (t === "loading" && (e[hs] = r), r == null ? e.removeAttribute(t) : typeof r != "string" && pi(e).includes(t) ? e[t] = r : e.setAttribute(t, r));
2388
+ }
2389
+ function hi(e) {
2390
+ return (
2391
+ /** @type {Record<string | symbol, unknown>} **/
2392
+ // @ts-expect-error
2393
+ e.__attributes ??= {
2394
+ [di]: e.nodeName.includes("-"),
2395
+ [vi]: e.namespaceURI === is
2396
+ }
2397
+ );
2398
+ }
2399
+ var Wr = /* @__PURE__ */ new Map();
2400
+ function pi(e) {
2401
+ var t = e.getAttribute("is") || e.nodeName, r = Wr.get(t);
2402
+ if (r) return r;
2403
+ Wr.set(t, r = []);
2404
+ for (var n, i = e, s = Element.prototype; s !== i; ) {
2405
+ n = ls(i);
2406
+ for (var a in n)
2407
+ n[a].set && r.push(a);
2408
+ i = Qr(i);
2409
+ }
2410
+ return r;
2411
+ }
2412
+ function jt(e, t, r = t) {
2413
+ var n = /* @__PURE__ */ new WeakSet();
2414
+ Fs(e, "input", async (i) => {
2415
+ var s = i ? e.defaultValue : e.value;
2416
+ if (s = or(e) ? fr(s) : s, r(s), k !== null && n.add(k), await Js(), s !== (s = t())) {
2417
+ var a = e.selectionStart, l = e.selectionEnd, o = e.value.length;
2418
+ if (e.value = s ?? "", l !== null) {
2419
+ var f = e.value.length;
2420
+ a === l && l === o && f > o ? (e.selectionStart = f, e.selectionEnd = f) : (e.selectionStart = a, e.selectionEnd = Math.min(l, f));
2421
+ }
2422
+ }
2423
+ }), // If we are hydrating and the value has since changed,
2424
+ // then use the updated value from the input instead.
2425
+ (w && e.defaultValue !== e.value || // If defaultValue is set, then value == defaultValue
2426
+ // TODO Svelte 6: remove input.value check and set to empty string?
2427
+ jn(t) == null && e.value) && (r(or(e) ? fr(e.value) : e.value), k !== null && n.add(k)), Cr(() => {
2428
+ var i = t();
2429
+ if (e === document.activeElement) {
2430
+ var s = (
2431
+ /** @type {Batch} */
2432
+ Pt ?? k
2433
+ );
2434
+ if (n.has(s))
2435
+ return;
2436
+ }
2437
+ or(e) && i === fr(e.value) || e.type === "date" && !i && !e.value || i !== e.value && (e.value = i ?? "");
2438
+ });
2439
+ }
2440
+ function or(e) {
2441
+ var t = e.type;
2442
+ return t === "number" || t === "range";
2443
+ }
2444
+ function fr(e) {
2445
+ return e === "" ? null : +e;
2446
+ }
2447
+ function Y(e, t, r, n) {
2448
+ var i = (
2449
+ /** @type {V} */
2450
+ n
2451
+ ), s = !0, a = () => (s && (s = !1, i = /** @type {V} */
2452
+ n), i), l;
2453
+ l = /** @type {V} */
2454
+ e[t], l === void 0 && n !== void 0 && (l = a());
2455
+ var o;
2456
+ o = () => {
2457
+ var u = (
2458
+ /** @type {V} */
2459
+ e[t]
2460
+ );
2461
+ return u === void 0 ? a() : (s = !0, u);
2462
+ };
2463
+ var f = !1, c = /* @__PURE__ */ Qt(() => (f = !1, o())), p = (
2464
+ /** @type {Effect} */
2465
+ x
2466
+ );
2467
+ return (
2468
+ /** @type {() => V} */
2469
+ (function(u, v) {
2470
+ if (arguments.length > 0) {
2471
+ const g = v ? d(c) : u;
2472
+ return m(c, g), f = !0, i !== void 0 && (i = g), u;
2473
+ }
2474
+ return Qe && f || (p.f & Ce) !== 0 ? c.v : d(c);
2475
+ })
2476
+ );
2477
+ }
2478
+ function mi(e) {
2479
+ return new _i(e);
2480
+ }
2481
+ class _i {
2482
+ /** @type {any} */
2483
+ #t;
2484
+ /** @type {Record<string, any>} */
2485
+ #e;
2486
+ /**
2487
+ * @param {ComponentConstructorOptions & {
2488
+ * component: any;
2489
+ * }} options
2490
+ */
2491
+ constructor(t) {
2492
+ var r = /* @__PURE__ */ new Map(), n = (s, a) => {
2493
+ var l = /* @__PURE__ */ pn(a, !1, !1);
2494
+ return r.set(s, l), l;
2495
+ };
2496
+ const i = new Proxy(
2497
+ { ...t.props || {}, $$events: {} },
2498
+ {
2499
+ get(s, a) {
2500
+ return d(r.get(a) ?? n(a, Reflect.get(s, a)));
2501
+ },
2502
+ has(s, a) {
2503
+ return a === vs ? !0 : (d(r.get(a) ?? n(a, Reflect.get(s, a))), Reflect.has(s, a));
2504
+ },
2505
+ set(s, a, l) {
2506
+ return m(r.get(a) ?? n(a, l), l), Reflect.set(s, a, l);
2507
+ }
2508
+ }
2509
+ );
2510
+ this.#e = (t.hydrate ? si : qn)(t.component, {
2511
+ target: t.target,
2512
+ anchor: t.anchor,
2513
+ props: i,
2514
+ context: t.context,
2515
+ intro: t.intro ?? !1,
2516
+ recover: t.recover
2517
+ }), (!t?.props?.$$host || t.sync === !1) && D(), this.#t = i.$$events;
2518
+ for (const s of Object.keys(this.#e))
2519
+ s === "$set" || s === "$destroy" || s === "$on" || Ut(this, s, {
2520
+ get() {
2521
+ return this.#e[s];
2522
+ },
2523
+ /** @param {any} value */
2524
+ set(a) {
2525
+ this.#e[s] = a;
2526
+ },
2527
+ enumerable: !0
2528
+ });
2529
+ this.#e.$set = /** @param {Record<string, any>} next */
2530
+ (s) => {
2531
+ Object.assign(i, s);
2532
+ }, this.#e.$destroy = () => {
2533
+ ii(this.#e);
2534
+ };
2535
+ }
2536
+ /** @param {Record<string, any>} props */
2537
+ $set(t) {
2538
+ this.#e.$set(t);
2539
+ }
2540
+ /**
2541
+ * @param {string} event
2542
+ * @param {(...args: any[]) => any} callback
2543
+ * @returns {any}
2544
+ */
2545
+ $on(t, r) {
2546
+ this.#t[t] = this.#t[t] || [];
2547
+ const n = (...i) => r.call(this, ...i);
2548
+ return this.#t[t].push(n), () => {
2549
+ this.#t[t] = this.#t[t].filter(
2550
+ /** @param {any} fn */
2551
+ (i) => i !== n
2552
+ );
2553
+ };
2554
+ }
2555
+ $destroy() {
2556
+ this.#e.$destroy();
2557
+ }
2558
+ }
2559
+ let Vn;
2560
+ typeof HTMLElement == "function" && (Vn = class extends HTMLElement {
2561
+ /** The Svelte component constructor */
2562
+ $$ctor;
2563
+ /** Slots */
2564
+ $$s;
2565
+ /** @type {any} The Svelte component instance */
2566
+ $$c;
2567
+ /** Whether or not the custom element is connected */
2568
+ $$cn = !1;
2569
+ /** @type {Record<string, any>} Component props data */
2570
+ $$d = {};
2571
+ /** `true` if currently in the process of reflecting component props back to attributes */
2572
+ $$r = !1;
2573
+ /** @type {Record<string, CustomElementPropDefinition>} Props definition (name, reflected, type etc) */
2574
+ $$p_d = {};
2575
+ /** @type {Record<string, EventListenerOrEventListenerObject[]>} Event listeners */
2576
+ $$l = {};
2577
+ /** @type {Map<EventListenerOrEventListenerObject, Function>} Event listener unsubscribe functions */
2578
+ $$l_u = /* @__PURE__ */ new Map();
2579
+ /** @type {any} The managed render effect for reflecting attributes */
2580
+ $$me;
2581
+ /**
2582
+ * @param {*} $$componentCtor
2583
+ * @param {*} $$slots
2584
+ * @param {*} use_shadow_dom
2585
+ */
2586
+ constructor(e, t, r) {
2587
+ super(), this.$$ctor = e, this.$$s = t, r && this.attachShadow({ mode: "open" });
2588
+ }
2589
+ /**
2590
+ * @param {string} type
2591
+ * @param {EventListenerOrEventListenerObject} listener
2592
+ * @param {boolean | AddEventListenerOptions} [options]
2593
+ */
2594
+ addEventListener(e, t, r) {
2595
+ if (this.$$l[e] = this.$$l[e] || [], this.$$l[e].push(t), this.$$c) {
2596
+ const n = this.$$c.$on(e, t);
2597
+ this.$$l_u.set(t, n);
2598
+ }
2599
+ super.addEventListener(e, t, r);
2600
+ }
2601
+ /**
2602
+ * @param {string} type
2603
+ * @param {EventListenerOrEventListenerObject} listener
2604
+ * @param {boolean | AddEventListenerOptions} [options]
2605
+ */
2606
+ removeEventListener(e, t, r) {
2607
+ if (super.removeEventListener(e, t, r), this.$$c) {
2608
+ const n = this.$$l_u.get(t);
2609
+ n && (n(), this.$$l_u.delete(t));
2610
+ }
2611
+ }
2612
+ async connectedCallback() {
2613
+ if (this.$$cn = !0, !this.$$c) {
2614
+ let e = function(n) {
2615
+ return (i) => {
2616
+ const s = document.createElement("slot");
2617
+ n !== "default" && (s.name = n), R(i, s);
2618
+ };
2619
+ };
2620
+ if (await Promise.resolve(), !this.$$cn || this.$$c)
2621
+ return;
2622
+ const t = {}, r = gi(this);
2623
+ for (const n of this.$$s)
2624
+ n in r && (n === "default" && !this.$$d.children ? (this.$$d.children = e(n), t.default = !0) : t[n] = e(n));
2625
+ for (const n of this.attributes) {
2626
+ const i = this.$$g_p(n.name);
2627
+ i in this.$$d || (this.$$d[i] = Dt(i, n.value, this.$$p_d, "toProp"));
2628
+ }
2629
+ for (const n in this.$$p_d)
2630
+ !(n in this.$$d) && this[n] !== void 0 && (this.$$d[n] = this[n], delete this[n]);
2631
+ this.$$c = mi({
2632
+ component: this.$$ctor,
2633
+ target: this.shadowRoot || this,
2634
+ props: {
2635
+ ...this.$$d,
2636
+ $$slots: t,
2637
+ $$host: this
2638
+ }
2639
+ }), this.$$me = qs(() => {
2640
+ Cr(() => {
2641
+ this.$$r = !0;
2642
+ for (const n of Ft(this.$$c)) {
2643
+ if (!this.$$p_d[n]?.reflect) continue;
2644
+ this.$$d[n] = this.$$c[n];
2645
+ const i = Dt(
2646
+ n,
2647
+ this.$$d[n],
2648
+ this.$$p_d,
2649
+ "toAttribute"
2650
+ );
2651
+ i == null ? this.removeAttribute(this.$$p_d[n].attribute || n) : this.setAttribute(this.$$p_d[n].attribute || n, i);
2652
+ }
2653
+ this.$$r = !1;
2654
+ });
2655
+ });
2656
+ for (const n in this.$$l)
2657
+ for (const i of this.$$l[n]) {
2658
+ const s = this.$$c.$on(n, i);
2659
+ this.$$l_u.set(i, s);
2660
+ }
2661
+ this.$$l = {};
2662
+ }
2663
+ }
2664
+ // We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte
2665
+ // and setting attributes through setAttribute etc, this is helpful
2666
+ /**
2667
+ * @param {string} attr
2668
+ * @param {string} _oldValue
2669
+ * @param {string} newValue
2670
+ */
2671
+ attributeChangedCallback(e, t, r) {
2672
+ this.$$r || (e = this.$$g_p(e), this.$$d[e] = Dt(e, r, this.$$p_d, "toProp"), this.$$c?.$set({ [e]: this.$$d[e] }));
2673
+ }
2674
+ disconnectedCallback() {
2675
+ this.$$cn = !1, Promise.resolve().then(() => {
2676
+ !this.$$cn && this.$$c && (this.$$c.$destroy(), this.$$me(), this.$$c = void 0);
2677
+ });
2678
+ }
2679
+ /**
2680
+ * @param {string} attribute_name
2681
+ */
2682
+ $$g_p(e) {
2683
+ return Ft(this.$$p_d).find(
2684
+ (t) => this.$$p_d[t].attribute === e || !this.$$p_d[t].attribute && t.toLowerCase() === e
2685
+ ) || e;
2686
+ }
2687
+ });
2688
+ function Dt(e, t, r, n) {
2689
+ const i = r[e]?.type;
2690
+ if (t = i === "Boolean" && typeof t != "boolean" ? t != null : t, !n || !r[e])
2691
+ return t;
2692
+ if (n === "toAttribute")
2693
+ switch (i) {
2694
+ case "Object":
2695
+ case "Array":
2696
+ return t == null ? null : JSON.stringify(t);
2697
+ case "Boolean":
2698
+ return t ? "" : null;
2699
+ case "Number":
2700
+ return t ?? null;
2701
+ default:
2702
+ return t;
2703
+ }
2704
+ else
2705
+ switch (i) {
2706
+ case "Object":
2707
+ case "Array":
2708
+ return t && JSON.parse(t);
2709
+ case "Boolean":
2710
+ return t;
2711
+ // conversion already handled above
2712
+ case "Number":
2713
+ return t != null ? +t : t;
2714
+ default:
2715
+ return t;
2716
+ }
2717
+ }
2718
+ function gi(e) {
2719
+ const t = {};
2720
+ return e.childNodes.forEach((r) => {
2721
+ t[
2722
+ /** @type {Element} node */
2723
+ r.slot || "default"
2724
+ ] = !0;
2725
+ }), t;
2726
+ }
2727
+ function Yn(e, t, r, n, i, s) {
2728
+ let a = class extends Vn {
2729
+ constructor() {
2730
+ super(e, r, i), this.$$p_d = t;
2731
+ }
2732
+ static get observedAttributes() {
2733
+ return Ft(t).map(
2734
+ (l) => (t[l].attribute || l).toLowerCase()
2735
+ );
2736
+ }
2737
+ };
2738
+ return Ft(t).forEach((l) => {
2739
+ Ut(a.prototype, l, {
2740
+ get() {
2741
+ return this.$$c && l in this.$$c ? this.$$c[l] : this.$$d[l];
2742
+ },
2743
+ set(o) {
2744
+ o = Dt(l, o, t), this.$$d[l] = o;
2745
+ var f = this.$$c;
2746
+ if (f) {
2747
+ var c = ot(f, l)?.get;
2748
+ c ? f[l] = o : f.$set({ [l]: o });
2749
+ }
2750
+ }
2751
+ });
2752
+ }), n.forEach((l) => {
2753
+ Ut(a.prototype, l, {
2754
+ get() {
2755
+ return this.$$c?.[l];
2756
+ }
2757
+ });
2758
+ }), e.element = /** @type {any} */
2759
+ a, a;
2760
+ }
2761
+ const Nr = "https://api.fortalece.ai";
2762
+ function Rr() {
2763
+ return `msg_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
2764
+ }
2765
+ function Kn(e) {
2766
+ const t = {
2767
+ "Content-Type": "application/json"
2768
+ };
2769
+ return e.apiKey && (t.Authorization = `Bearer ${e.apiKey}`), e.projectId && (t["X-Project-ID"] = e.projectId), t;
2770
+ }
2771
+ async function bi(e, t, r) {
2772
+ const n = e.apiUrl || Nr, i = {
2773
+ projectId: e.projectId,
2774
+ message: t,
2775
+ conversationId: r
2776
+ };
2777
+ try {
2778
+ const s = await fetch(`${n}/api/chat/message`, {
2779
+ method: "POST",
2780
+ headers: Kn(e),
2781
+ body: JSON.stringify(i)
2782
+ });
2783
+ if (!s.ok)
2784
+ return {
2785
+ success: !1,
2786
+ error: (await s.json().catch(() => ({}))).error || `Request failed with status ${s.status}`
2787
+ };
2788
+ const a = await s.json();
2789
+ return {
2790
+ success: !0,
2791
+ message: {
2792
+ id: a.id || Rr(),
2793
+ role: "assistant",
2794
+ content: a.message || a.content || "",
2795
+ timestamp: new Date(a.timestamp || Date.now()),
2796
+ metadata: a.metadata
2797
+ },
2798
+ conversationId: a.conversationId
2799
+ };
2800
+ } catch (s) {
2801
+ return {
2802
+ success: !1,
2803
+ error: s instanceof Error ? s.message : "Unknown error occurred"
2804
+ };
2805
+ }
2806
+ }
2807
+ function wi(e) {
2808
+ return {
2809
+ id: Rr(),
2810
+ role: "user",
2811
+ content: e,
2812
+ timestamp: /* @__PURE__ */ new Date()
2813
+ };
2814
+ }
2815
+ function cr(e) {
2816
+ return {
2817
+ id: Rr(),
2818
+ role: "system",
2819
+ content: e,
2820
+ timestamp: /* @__PURE__ */ new Date()
2821
+ };
2822
+ }
2823
+ async function yi(e, t) {
2824
+ const r = e.apiUrl || Nr, n = {
2825
+ ...t,
2826
+ projectId: e.projectId
2827
+ };
2828
+ try {
2829
+ const i = await fetch(`${r}/api/feedback`, {
2830
+ method: "POST",
2831
+ headers: Kn(e),
2832
+ body: JSON.stringify(n)
2833
+ });
2834
+ if (!i.ok)
2835
+ return {
2836
+ success: !1,
2837
+ error: (await i.json().catch(() => ({}))).error || `Request failed with status ${i.status}`
2838
+ };
2839
+ const s = await i.json();
2840
+ return {
2841
+ success: !0,
2842
+ feedbackId: s.feedbackId || s.id
2843
+ };
2844
+ } catch (i) {
2845
+ return {
2846
+ success: !1,
2847
+ error: i instanceof Error ? i.message : "Unknown error occurred"
2848
+ };
2849
+ }
2850
+ }
2851
+ function Zi(e, t) {
2852
+ return {
2853
+ projectId: e,
2854
+ apiUrl: t?.apiUrl || Nr,
2855
+ apiKey: t?.apiKey
2856
+ };
2857
+ }
2858
+ var xi = /* @__PURE__ */ tr('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="icon svelte-1105cax"><path fill-rule="evenodd" d="M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z" clip-rule="evenodd" class="svelte-1105cax"></path></svg>'), $i = /* @__PURE__ */ tr('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="icon svelte-1105cax"><path fill-rule="evenodd" d="M4.804 21.644A6.707 6.707 0 0 0 6 21.75a6.721 6.721 0 0 0 3.583-1.029c.774.182 1.584.279 2.417.279 5.322 0 9.75-3.97 9.75-9 0-5.03-4.428-9-9.75-9s-9.75 3.97-9.75 9c0 2.409 1.025 4.587 2.674 6.192.232.226.277.428.254.543a3.73 3.73 0 0 1-.814 1.686.75.75 0 0 0 .44 1.223ZM8.25 10.875a1.125 1.125 0 1 0 0 2.25 1.125 1.125 0 0 0 0-2.25ZM10.875 12a1.125 1.125 0 1 1 2.25 0 1.125 1.125 0 0 1-2.25 0Zm4.875-1.125a1.125 1.125 0 1 0 0 2.25 1.125 1.125 0 0 0 0-2.25Z" clip-rule="evenodd" class="svelte-1105cax"></path></svg>'), zi = /* @__PURE__ */ J('<span class="timestamp svelte-1105cax"> </span>'), ki = /* @__PURE__ */ J('<div><div class="bubble svelte-1105cax"><p class="content svelte-1105cax"> </p> <!></div></div>'), Ei = /* @__PURE__ */ J('<div class="message assistant svelte-1105cax"><div class="bubble loading-bubble svelte-1105cax"><div class="typing-indicator svelte-1105cax"><span class="svelte-1105cax"></span> <span class="svelte-1105cax"></span> <span class="svelte-1105cax"></span></div></div></div>'), Si = /* @__PURE__ */ J('<div class="chat-window svelte-1105cax"><div class="header svelte-1105cax"><div class="header-content svelte-1105cax"><div class="header-icon svelte-1105cax"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="svelte-1105cax"><path fill-rule="evenodd" d="M4.804 21.644A6.707 6.707 0 0 0 6 21.75a6.721 6.721 0 0 0 3.583-1.029c.774.182 1.584.279 2.417.279 5.322 0 9.75-3.97 9.75-9 0-5.03-4.428-9-9.75-9s-9.75 3.97-9.75 9c0 2.409 1.025 4.587 2.674 6.192.232.226.277.428.254.543a3.73 3.73 0 0 1-.814 1.686.75.75 0 0 0 .44 1.223ZM8.25 10.875a1.125 1.125 0 1 0 0 2.25 1.125 1.125 0 0 0 0-2.25ZM10.875 12a1.125 1.125 0 1 1 2.25 0 1.125 1.125 0 0 1-2.25 0Zm4.875-1.125a1.125 1.125 0 1 0 0 2.25 1.125 1.125 0 0 0 0-2.25Z" clip-rule="evenodd" class="svelte-1105cax"></path></svg></div> <div class="header-text svelte-1105cax"><h3 class="svelte-1105cax">Support</h3> <p class="svelte-1105cax">We typically reply within minutes</p></div></div> <button class="close-btn svelte-1105cax" aria-label="Close chat"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="svelte-1105cax"><path fill-rule="evenodd" d="M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z" clip-rule="evenodd" class="svelte-1105cax"></path></svg></button></div> <div class="messages svelte-1105cax"><!> <!></div> <form class="input-wrapper svelte-1105cax"><textarea rows="1" class="input svelte-1105cax"></textarea> <button type="submit" class="send-btn svelte-1105cax" aria-label="Send message"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="send-icon svelte-1105cax"><path d="M3.478 2.404a.75.75 0 0 0-.926.941l2.432 7.905H13.5a.75.75 0 0 1 0 1.5H4.984l-2.432 7.905a.75.75 0 0 0 .926.94 60.519 60.519 0 0 0 18.445-8.986.75.75 0 0 0 0-1.218A60.517 60.517 0 0 0 3.478 2.404Z" class="svelte-1105cax"></path></svg></button></form> <div class="powered-by svelte-1105cax">Powered by <a href="https://fortalece.ai" target="_blank" rel="noopener noreferrer" class="svelte-1105cax">Fortalece AI</a></div></div>'), Ai = /* @__PURE__ */ J('<div><button class="toggle-btn svelte-1105cax"><!></button> <!></div>');
2859
+ const Ti = {
2860
+ hash: "svelte-1105cax",
2861
+ code: `.svelte-1105cax {box-sizing:border-box;margin:0;padding:0;}.support-chat.svelte-1105cax {--bg: #ffffff;--bg-secondary: #f9fafb;--text: #1f2937;--text-muted: #6b7280;--border: #e5e7eb;--shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);position:fixed;bottom:1rem;z-index:9999;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;}.support-chat.theme-dark.svelte-1105cax {--bg: #1f2937;--bg-secondary: #374151;--text: #f9fafb;--text-muted: #9ca3af;--border: #4b5563;}
2862
+
2863
+ @media (prefers-color-scheme: dark) {.support-chat.theme-auto.svelte-1105cax {--bg: #1f2937;--bg-secondary: #374151;--text: #f9fafb;--text-muted: #9ca3af;--border: #4b5563;}
2864
+ }.toggle-btn.svelte-1105cax {position:absolute;bottom:0;right:0;width:3.5rem;height:3.5rem;border-radius:50%;border:none;background:var(--primary-color);color:white;cursor:pointer;box-shadow:var(--shadow);display:flex;align-items:center;justify-content:center;transition:transform 0.2s, opacity 0.2s;}.toggle-btn.svelte-1105cax:hover {transform:scale(1.05);}.toggle-btn.svelte-1105cax .icon:where(.svelte-1105cax) {width:1.5rem;height:1.5rem;}.chat-window.svelte-1105cax {position:absolute;bottom:4.5rem;right:0;width:380px;max-width:calc(100vw - 2rem);height:500px;max-height:calc(100vh - 8rem);background:var(--bg);border-radius:1rem;box-shadow:var(--shadow);display:flex;flex-direction:column;overflow:hidden;border:1px solid var(--border);}.header.svelte-1105cax {display:flex;align-items:center;justify-content:space-between;padding:1rem;background:var(--primary-color);color:white;}.header-content.svelte-1105cax {display:flex;align-items:center;gap:0.75rem;}.header-icon.svelte-1105cax {width:2.5rem;height:2.5rem;background:rgba(255, 255, 255, 0.2);border-radius:50%;display:flex;align-items:center;justify-content:center;}.header-icon.svelte-1105cax svg:where(.svelte-1105cax) {width:1.5rem;height:1.5rem;}.header-text.svelte-1105cax h3:where(.svelte-1105cax) {font-size:1rem;font-weight:600;margin:0;}.header-text.svelte-1105cax p:where(.svelte-1105cax) {font-size:0.75rem;opacity:0.9;margin:0;}.close-btn.svelte-1105cax {background:transparent;border:none;color:white;cursor:pointer;padding:0.5rem;border-radius:50%;display:flex;align-items:center;justify-content:center;transition:background 0.2s;}.close-btn.svelte-1105cax:hover {background:rgba(255, 255, 255, 0.2);}.close-btn.svelte-1105cax svg:where(.svelte-1105cax) {width:1.25rem;height:1.25rem;}.messages.svelte-1105cax {flex:1;overflow-y:auto;padding:1rem;background:var(--bg-secondary);}.message.svelte-1105cax {display:flex;margin-bottom:0.75rem;}.message.user.svelte-1105cax {justify-content:flex-end;}.message.assistant.svelte-1105cax {justify-content:flex-start;}.bubble.svelte-1105cax {max-width:85%;padding:0.75rem 1rem;border-radius:1rem;}.user.svelte-1105cax .bubble:where(.svelte-1105cax) {background:var(--primary-color);color:white;border-bottom-right-radius:0.25rem;}.assistant.svelte-1105cax .bubble:where(.svelte-1105cax) {background:var(--bg);color:var(--text);border-bottom-left-radius:0.25rem;border:1px solid var(--border);}.content.svelte-1105cax {font-size:0.875rem;line-height:1.5;word-wrap:break-word;white-space:pre-wrap;}.timestamp.svelte-1105cax {display:block;font-size:0.625rem;opacity:0.7;margin-top:0.25rem;text-align:right;}.loading-bubble.svelte-1105cax {padding:1rem 1.25rem;}.typing-indicator.svelte-1105cax {display:flex;gap:0.25rem;}.typing-indicator.svelte-1105cax span:where(.svelte-1105cax) {width:0.5rem;height:0.5rem;background:var(--text-muted);border-radius:50%;
2865
+ animation: svelte-1105cax-bounce 1.4s infinite ease-in-out both;}.typing-indicator.svelte-1105cax span:where(.svelte-1105cax):nth-child(1) {animation-delay:-0.32s;}.typing-indicator.svelte-1105cax span:where(.svelte-1105cax):nth-child(2) {animation-delay:-0.16s;}
2866
+
2867
+ @keyframes svelte-1105cax-bounce {
2868
+ 0%,
2869
+ 80%,
2870
+ 100% {
2871
+ transform: scale(0);
2872
+ }
2873
+ 40% {
2874
+ transform: scale(1);
2875
+ }
2876
+ }.input-wrapper.svelte-1105cax {display:flex;align-items:flex-end;gap:0.5rem;padding:0.75rem;background:var(--bg);border-top:1px solid var(--border);}.input.svelte-1105cax {flex:1;resize:none;border:1px solid var(--border);border-radius:1rem;padding:0.625rem 1rem;font-size:0.875rem;font-family:inherit;line-height:1.5;outline:none;max-height:100px;background:var(--bg);color:var(--text);}.input.svelte-1105cax:focus {border-color:var(--primary-color);box-shadow:0 0 0 2px rgba(99, 102, 241, 0.2);}.input.svelte-1105cax::placeholder {color:var(--text-muted);}.input.svelte-1105cax:disabled {opacity:0.6;cursor:not-allowed;}.send-btn.svelte-1105cax {display:flex;align-items:center;justify-content:center;width:2.25rem;height:2.25rem;border:none;border-radius:50%;background:var(--primary-color);color:white;cursor:pointer;transition:opacity 0.2s, transform 0.1s;flex-shrink:0;}.send-btn.svelte-1105cax:hover:not(:disabled) {opacity:0.9;transform:scale(1.05);}.send-btn.svelte-1105cax:disabled {opacity:0.5;cursor:not-allowed;}.send-icon.svelte-1105cax {width:1rem;height:1rem;}.powered-by.svelte-1105cax {padding:0.5rem;text-align:center;font-size:0.625rem;color:var(--text-muted);background:var(--bg);border-top:1px solid var(--border);}.powered-by.svelte-1105cax a:where(.svelte-1105cax) {color:var(--primary-color);text-decoration:none;font-weight:500;}.powered-by.svelte-1105cax a:where(.svelte-1105cax):hover {text-decoration:underline;}`
2877
+ };
2878
+ function Ci(e, t) {
2879
+ Er(t, !0), Zn(e, Ti);
2880
+ let r = Y(t, "projectId"), n = Y(t, "apiUrl", 7, "https://api.fortalece.ai"), i = Y(t, "position", 7, "bottom-right"), s = Y(t, "theme", 7, "light"), a = Y(t, "primaryColor", 7, "#6366f1"), l = Y(t, "welcomeMessage", 7, "Hi there! How can I help you today?"), o = Y(t, "placeholder", 7, "Type a message..."), f = /* @__PURE__ */ I(!1), c = /* @__PURE__ */ I(at([])), p = /* @__PURE__ */ I(""), u = /* @__PURE__ */ I(!1), v = /* @__PURE__ */ I(void 0);
2881
+ const g = /* @__PURE__ */ ft(() => ({ projectId: r(), apiUrl: n() })), A = /* @__PURE__ */ ft(() => i() === "bottom-left" ? "left: 1rem; right: auto;" : "right: 1rem; left: auto;"), h = /* @__PURE__ */ ft(() => s() === "dark" ? "theme-dark" : s() === "auto" ? "theme-auto" : "theme-light");
2882
+ Br(() => {
2883
+ l() && d(c).length === 0 && m(c, [cr(l())], !0);
2884
+ });
2885
+ function _() {
2886
+ const b = document.querySelector("support-chat")?.shadowRoot?.querySelector(".messages");
2887
+ b && (b.scrollTop = b.scrollHeight);
2888
+ }
2889
+ Br(() => {
2890
+ d(c).length > 0 && setTimeout(_, 50);
2891
+ });
2892
+ function B() {
2893
+ m(f, !d(f));
2894
+ }
2895
+ async function oe(b) {
2896
+ if (!b.trim() || d(u)) return;
2897
+ const ce = wi(b);
2898
+ m(c, [...d(c), ce], !0), m(p, ""), m(u, !0);
2899
+ try {
2900
+ const ue = await bi(d(g), b, d(v));
2901
+ ue.success && ue.message ? (m(c, [...d(c), ue.message], !0), m(v, ue.conversationId, !0)) : m(
2902
+ c,
2903
+ [
2904
+ ...d(c),
2905
+ cr(ue.error || "Sorry, something went wrong. Please try again.")
2906
+ ],
2907
+ !0
2908
+ );
2909
+ } catch {
2910
+ m(
2911
+ c,
2912
+ [
2913
+ ...d(c),
2914
+ cr("Sorry, something went wrong. Please try again.")
2915
+ ],
2916
+ !0
2917
+ );
2918
+ } finally {
2919
+ m(u, !1);
2920
+ }
2921
+ }
2922
+ function q(b) {
2923
+ return b ? b.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : "";
2924
+ }
2925
+ var fe = {
2926
+ get projectId() {
2927
+ return r();
2928
+ },
2929
+ set projectId(b) {
2930
+ r(b), D();
2931
+ },
2932
+ get apiUrl() {
2933
+ return n();
2934
+ },
2935
+ set apiUrl(b = "https://api.fortalece.ai") {
2936
+ n(b), D();
2937
+ },
2938
+ get position() {
2939
+ return i();
2940
+ },
2941
+ set position(b = "bottom-right") {
2942
+ i(b), D();
2943
+ },
2944
+ get theme() {
2945
+ return s();
2946
+ },
2947
+ set theme(b = "light") {
2948
+ s(b), D();
2949
+ },
2950
+ get primaryColor() {
2951
+ return a();
2952
+ },
2953
+ set primaryColor(b = "#6366f1") {
2954
+ a(b), D();
2955
+ },
2956
+ get welcomeMessage() {
2957
+ return l();
2958
+ },
2959
+ set welcomeMessage(b = "Hi there! How can I help you today?") {
2960
+ l(b), D();
2961
+ },
2962
+ get placeholder() {
2963
+ return o();
2964
+ },
2965
+ set placeholder(b = "Type a message...") {
2966
+ o(b), D();
2967
+ }
2968
+ }, V = Ai(), M = E(V);
2969
+ M.__click = B;
2970
+ var ee = E(M);
2971
+ {
2972
+ var me = (b) => {
2973
+ var ce = xi();
2974
+ R(b, ce);
2975
+ }, N = (b) => {
2976
+ var ce = $i();
2977
+ R(b, ce);
2978
+ };
2979
+ ge(ee, (b) => {
2980
+ d(f) ? b(me) : b(N, !1);
2981
+ });
2982
+ }
2983
+ $(M);
2984
+ var xe = C(M, 2);
2985
+ {
2986
+ var $e = (b) => {
2987
+ var ce = Si(), ue = E(ce), rr = C(E(ue), 2);
2988
+ rr.__click = B, $(ue);
2989
+ var _t = C(ue, 2), z = E(_t);
2990
+ br(z, 17, () => d(c), (L) => L.id, (L, ke) => {
2991
+ var de = ki();
2992
+ let ve;
2993
+ var Pe = E(de), et = E(Pe), wt = E(et, !0);
2994
+ $(et);
2995
+ var Lt = C(et, 2);
2996
+ {
2997
+ var yt = (tt) => {
2998
+ var rt = zi(), sr = E(rt, !0);
2999
+ $(rt), Se((xt) => lt(sr, xt), [() => q(d(ke).timestamp)]), R(tt, rt);
3000
+ };
3001
+ ge(Lt, (tt) => {
3002
+ d(ke).timestamp && tt(yt);
3003
+ });
3004
+ }
3005
+ $(Pe), $(de), Se(() => {
3006
+ ve = Tt(de, 1, "message svelte-1105cax", null, ve, {
3007
+ user: d(ke).role === "user",
3008
+ assistant: d(ke).role !== "user"
3009
+ }), lt(wt, d(ke).content);
3010
+ }), R(L, de);
3011
+ });
3012
+ var te = C(z, 2);
3013
+ {
3014
+ var gt = (L) => {
3015
+ var ke = Ei();
3016
+ R(L, ke);
3017
+ };
3018
+ ge(te, (L) => {
3019
+ d(u) && L(gt);
3020
+ });
3021
+ }
3022
+ $(_t);
3023
+ var bt = C(_t, 2), ze = E(bt);
3024
+ yn(ze), ze.__keydown = (L) => {
3025
+ L.key === "Enter" && !L.shiftKey && (L.preventDefault(), oe(d(p)));
3026
+ };
3027
+ var nr = C(ze, 2);
3028
+ $(bt), Et(2), $(ce), Se(
3029
+ (L) => {
3030
+ Nt(ze, "placeholder", o()), ze.disabled = d(u), nr.disabled = L;
3031
+ },
3032
+ [() => d(u) || !d(p).trim()]
3033
+ ), Fn("submit", bt, (L) => {
3034
+ L.preventDefault(), oe(d(p));
3035
+ }), jt(ze, () => d(p), (L) => m(p, L)), R(b, ce);
3036
+ };
3037
+ ge(xe, (b) => {
3038
+ d(f) && b($e);
3039
+ });
3040
+ }
3041
+ return $(V), Se(() => {
3042
+ Tt(V, 1, `support-chat ${d(h) ?? ""}`, "svelte-1105cax"), wr(V, `--primary-color: ${a() ?? ""}; ${d(A) ?? ""}`), Nt(M, "aria-label", d(f) ? "Close chat" : "Open chat");
3043
+ }), R(e, V), Sr(fe);
3044
+ }
3045
+ Un(["click", "keydown"]);
3046
+ customElements.define("support-chat", Yn(
3047
+ Ci,
3048
+ {
3049
+ projectId: { attribute: "project-id", reflect: !0 },
3050
+ apiUrl: { attribute: "api-url", reflect: !0 },
3051
+ position: { attribute: "position", reflect: !0 },
3052
+ theme: { attribute: "theme", reflect: !0 },
3053
+ primaryColor: { attribute: "primary-color", reflect: !0 },
3054
+ welcomeMessage: { attribute: "welcome-message", reflect: !0 },
3055
+ placeholder: { attribute: "placeholder", reflect: !0 }
3056
+ },
3057
+ [],
3058
+ [],
3059
+ !0
3060
+ ));
3061
+ var Mi = /* @__PURE__ */ tr('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="icon svelte-p7nz7"><path fill-rule="evenodd" d="M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z" clip-rule="evenodd" class="svelte-p7nz7"></path></svg>'), Ii = /* @__PURE__ */ tr('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="icon svelte-p7nz7"><path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm11.378-3.917c-.89-.777-2.366-.777-3.255 0a.75.75 0 0 1-.988-1.129c1.454-1.272 3.776-1.272 5.23 0 1.513 1.324 1.513 3.518 0 4.842a3.75 3.75 0 0 1-.837.552c-.676.328-1.028.774-1.028 1.152v.75a.75.75 0 0 1-1.5 0v-.75c0-1.279 1.06-2.107 1.875-2.502.182-.088.351-.199.503-.331.83-.727.83-1.857 0-2.584ZM12 18a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z" clip-rule="evenodd" class="svelte-p7nz7"></path></svg>'), Ni = /* @__PURE__ */ J('<div class="success-state svelte-p7nz7"><div class="success-icon svelte-p7nz7"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="svelte-p7nz7"><path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm13.36-1.814a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z" clip-rule="evenodd" class="svelte-p7nz7"></path></svg></div> <h4 class="svelte-p7nz7">Thank you!</h4> <p class="svelte-p7nz7">Your feedback has been submitted successfully.</p> <button class="btn btn-primary svelte-p7nz7">Send more feedback</button></div>'), Ri = /* @__PURE__ */ J('<button type="button"><span class="type-icon svelte-p7nz7"> </span> <span class="type-label svelte-p7nz7"> </span></button>'), Li = /* @__PURE__ */ J('<button type="button"> </button>'), Oi = /* @__PURE__ */ J('<div class="form-group svelte-p7nz7"><span class="form-label svelte-p7nz7" id="priority-label">Priority</span> <div class="priority-selector svelte-p7nz7" role="group" aria-labelledby="priority-label"></div></div>'), Pi = /* @__PURE__ */ J('<div class="error-message svelte-p7nz7"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="svelte-p7nz7"><path fill-rule="evenodd" d="M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003ZM12 8.25a.75.75 0 0 1 .75.75v3.75a.75.75 0 0 1-1.5 0V9a.75.75 0 0 1 .75-.75Zm0 8.25a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z" clip-rule="evenodd" class="svelte-p7nz7"></path></svg> </div>'), ji = /* @__PURE__ */ J('<span class="spinner svelte-p7nz7"></span> Submitting...', 1), Di = /* @__PURE__ */ J(`<form class="svelte-p7nz7"><div class="form-group svelte-p7nz7"><span class="form-label svelte-p7nz7" id="type-label">Type</span> <div class="type-selector svelte-p7nz7" role="group" aria-labelledby="type-label"></div></div> <div class="form-group svelte-p7nz7"><label class="form-label svelte-p7nz7" for="title">Title <span class="required svelte-p7nz7">*</span></label> <input type="text" id="title" class="form-input svelte-p7nz7" placeholder="Brief summary of your feedback" required/></div> <div class="form-group svelte-p7nz7"><label class="form-label svelte-p7nz7" for="description">Description <span class="required svelte-p7nz7">*</span></label> <textarea id="description" class="form-textarea svelte-p7nz7" placeholder="Provide more details about your feedback..." rows="4" required></textarea></div> <!> <div class="form-group svelte-p7nz7"><label class="form-label svelte-p7nz7" for="email">Email (optional)</label> <input type="email" id="email" class="form-input svelte-p7nz7" placeholder="your@email.com"/> <span class="form-hint svelte-p7nz7">We'll only contact you if we need more information</span></div> <!> <button type="submit" class="btn btn-primary btn-submit svelte-p7nz7"><!></button></form>`), Fi = /* @__PURE__ */ J(`<div class="panel-window svelte-p7nz7"><div class="header svelte-p7nz7"><div class="header-content svelte-p7nz7"><div class="header-icon svelte-p7nz7"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="svelte-p7nz7"><path fill-rule="evenodd" d="M7.502 6h7.128A3.375 3.375 0 0 1 18 9.375v9.375a3 3 0 0 0 3-3V6.108c0-1.505-1.125-2.811-2.664-2.94a48.972 48.972 0 0 0-.673-.05A3 3 0 0 0 15 1.5h-1.5a3 3 0 0 0-2.663 1.618c-.225.015-.45.032-.673.05C8.662 3.295 7.554 4.542 7.502 6ZM13.5 3A1.5 1.5 0 0 0 12 4.5h4.5A1.5 1.5 0 0 0 15 3h-1.5Z" clip-rule="evenodd" class="svelte-p7nz7"></path><path fill-rule="evenodd" d="M3 9.375C3 8.339 3.84 7.5 4.875 7.5h9.75c1.036 0 1.875.84 1.875 1.875v11.25c0 1.035-.84 1.875-1.875 1.875h-9.75A1.875 1.875 0 0 1 3 20.625V9.375Zm9.586 4.594a.75.75 0 0 0-1.172-.938l-2.476 3.096-.908-.907a.75.75 0 0 0-1.06 1.06l1.5 1.5a.75.75 0 0 0 1.116-.062l3-3.75Z" clip-rule="evenodd" class="svelte-p7nz7"></path></svg></div> <div class="header-text svelte-p7nz7"><h3 class="svelte-p7nz7">Send Feedback</h3> <p class="svelte-p7nz7">We'd love to hear from you</p></div></div> <button class="close-btn svelte-p7nz7" aria-label="Close"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="svelte-p7nz7"><path fill-rule="evenodd" d="M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z" clip-rule="evenodd" class="svelte-p7nz7"></path></svg></button></div> <div class="content svelte-p7nz7"><!></div> <div class="powered-by svelte-p7nz7">Powered by <a href="https://fortalece.ai" target="_blank" rel="noopener noreferrer" class="svelte-p7nz7">Fortalece AI</a></div></div>`), Ui = /* @__PURE__ */ J('<div><button class="toggle-btn svelte-p7nz7"><!></button> <!></div>');
3062
+ const Bi = {
3063
+ hash: "svelte-p7nz7",
3064
+ code: `.svelte-p7nz7 {box-sizing:border-box;margin:0;padding:0;}.feedback-panel.svelte-p7nz7 {--bg: #ffffff;--bg-secondary: #f9fafb;--text: #1f2937;--text-muted: #6b7280;--border: #e5e7eb;--shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);--error: #ef4444;--success: #22c55e;position:fixed;bottom:1rem;z-index:9999;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;}.feedback-panel.theme-dark.svelte-p7nz7 {--bg: #1f2937;--bg-secondary: #374151;--text: #f9fafb;--text-muted: #9ca3af;--border: #4b5563;}
3065
+
3066
+ @media (prefers-color-scheme: dark) {.feedback-panel.theme-auto.svelte-p7nz7 {--bg: #1f2937;--bg-secondary: #374151;--text: #f9fafb;--text-muted: #9ca3af;--border: #4b5563;}
3067
+ }.toggle-btn.svelte-p7nz7 {position:absolute;bottom:0;right:0;width:3.5rem;height:3.5rem;border-radius:50%;border:none;background:var(--primary-color);color:white;cursor:pointer;box-shadow:var(--shadow);display:flex;align-items:center;justify-content:center;transition:transform 0.2s, opacity 0.2s;}.toggle-btn.svelte-p7nz7:hover {transform:scale(1.05);}.toggle-btn.svelte-p7nz7 .icon:where(.svelte-p7nz7) {width:1.5rem;height:1.5rem;}.panel-window.svelte-p7nz7 {position:absolute;bottom:4.5rem;right:0;width:400px;max-width:calc(100vw - 2rem);max-height:calc(100vh - 8rem);background:var(--bg);border-radius:1rem;box-shadow:var(--shadow);display:flex;flex-direction:column;overflow:hidden;border:1px solid var(--border);}.header.svelte-p7nz7 {display:flex;align-items:center;justify-content:space-between;padding:1rem;background:var(--primary-color);color:white;}.header-content.svelte-p7nz7 {display:flex;align-items:center;gap:0.75rem;}.header-icon.svelte-p7nz7 {width:2.5rem;height:2.5rem;background:rgba(255, 255, 255, 0.2);border-radius:50%;display:flex;align-items:center;justify-content:center;}.header-icon.svelte-p7nz7 svg:where(.svelte-p7nz7) {width:1.5rem;height:1.5rem;}.header-text.svelte-p7nz7 h3:where(.svelte-p7nz7) {font-size:1rem;font-weight:600;margin:0;}.header-text.svelte-p7nz7 p:where(.svelte-p7nz7) {font-size:0.75rem;opacity:0.9;margin:0;}.close-btn.svelte-p7nz7 {background:transparent;border:none;color:white;cursor:pointer;padding:0.5rem;border-radius:50%;display:flex;align-items:center;justify-content:center;transition:background 0.2s;}.close-btn.svelte-p7nz7:hover {background:rgba(255, 255, 255, 0.2);}.close-btn.svelte-p7nz7 svg:where(.svelte-p7nz7) {width:1.25rem;height:1.25rem;}.content.svelte-p7nz7 {flex:1;overflow-y:auto;padding:1rem;background:var(--bg);}
3068
+
3069
+ /* Form Styles */.form-group.svelte-p7nz7 {margin-bottom:1rem;}.form-label.svelte-p7nz7 {display:block;font-size:0.875rem;font-weight:500;color:var(--text);margin-bottom:0.375rem;}.required.svelte-p7nz7 {color:var(--error);}.form-input.svelte-p7nz7,
3070
+ .form-textarea.svelte-p7nz7 {width:100%;padding:0.625rem 0.75rem;border:1px solid var(--border);border-radius:0.5rem;font-size:0.875rem;font-family:inherit;background:var(--bg);color:var(--text);outline:none;transition:border-color 0.2s, box-shadow 0.2s;}.form-input.svelte-p7nz7:focus,
3071
+ .form-textarea.svelte-p7nz7:focus {border-color:var(--primary-color);box-shadow:0 0 0 2px rgba(99, 102, 241, 0.2);}.form-input.svelte-p7nz7::placeholder,
3072
+ .form-textarea.svelte-p7nz7::placeholder {color:var(--text-muted);}.form-textarea.svelte-p7nz7 {resize:vertical;min-height:80px;}.form-hint.svelte-p7nz7 {display:block;font-size:0.75rem;color:var(--text-muted);margin-top:0.25rem;}
3073
+
3074
+ /* Type Selector */.type-selector.svelte-p7nz7 {display:flex;flex-wrap:wrap;gap:0.5rem;}.type-btn.svelte-p7nz7 {display:flex;align-items:center;gap:0.375rem;padding:0.5rem 0.75rem;border:1px solid var(--border);border-radius:2rem;background:var(--bg);color:var(--text);font-size:0.75rem;cursor:pointer;transition:all 0.2s;}.type-btn.svelte-p7nz7:hover {border-color:var(--primary-color);}.type-btn.active.svelte-p7nz7 {background:var(--primary-color);border-color:var(--primary-color);color:white;}.type-icon.svelte-p7nz7 {font-size:0.875rem;}
3075
+
3076
+ /* Priority Selector */.priority-selector.svelte-p7nz7 {display:flex;gap:0.5rem;}.priority-btn.svelte-p7nz7 {flex:1;padding:0.5rem;border:1px solid var(--border);border-radius:0.5rem;background:var(--bg);color:var(--text);font-size:0.75rem;cursor:pointer;transition:all 0.2s;}.priority-btn.svelte-p7nz7:hover {border-color:var(--priority-color);}.priority-btn.active.svelte-p7nz7 {background:var(--priority-color);border-color:var(--priority-color);color:white;}
3077
+
3078
+ /* Error Message */.error-message.svelte-p7nz7 {display:flex;align-items:center;gap:0.5rem;padding:0.75rem;background:rgba(239, 68, 68, 0.1);border:1px solid rgba(239, 68, 68, 0.3);border-radius:0.5rem;color:var(--error);font-size:0.875rem;margin-bottom:1rem;}.error-message.svelte-p7nz7 svg:where(.svelte-p7nz7) {width:1.25rem;height:1.25rem;flex-shrink:0;}
3079
+
3080
+ /* Buttons */.btn.svelte-p7nz7 {display:inline-flex;align-items:center;justify-content:center;gap:0.5rem;padding:0.75rem 1.25rem;border:none;border-radius:0.5rem;font-size:0.875rem;font-weight:500;font-family:inherit;cursor:pointer;transition:opacity 0.2s, transform 0.1s;}.btn-primary.svelte-p7nz7 {background:var(--primary-color);color:white;}.btn-primary.svelte-p7nz7:hover:not(:disabled) {opacity:0.9;}.btn-primary.svelte-p7nz7:disabled {opacity:0.6;cursor:not-allowed;}.btn-submit.svelte-p7nz7 {width:100%;margin-top:0.5rem;}
3081
+
3082
+ /* Spinner */.spinner.svelte-p7nz7 {width:1rem;height:1rem;border:2px solid rgba(255, 255, 255, 0.3);border-top-color:white;border-radius:50%;
3083
+ animation: svelte-p7nz7-spin 0.6s linear infinite;}
3084
+
3085
+ @keyframes svelte-p7nz7-spin {
3086
+ to {
3087
+ transform: rotate(360deg);
3088
+ }
3089
+ }
3090
+
3091
+ /* Success State */.success-state.svelte-p7nz7 {display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:2rem 1rem;}.success-icon.svelte-p7nz7 {width:4rem;height:4rem;color:var(--success);margin-bottom:1rem;}.success-icon.svelte-p7nz7 svg:where(.svelte-p7nz7) {width:100%;height:100%;}.success-state.svelte-p7nz7 h4:where(.svelte-p7nz7) {font-size:1.25rem;font-weight:600;color:var(--text);margin-bottom:0.5rem;}.success-state.svelte-p7nz7 p:where(.svelte-p7nz7) {font-size:0.875rem;color:var(--text-muted);margin-bottom:1.5rem;}
3092
+
3093
+ /* Powered by */.powered-by.svelte-p7nz7 {padding:0.5rem;text-align:center;font-size:0.625rem;color:var(--text-muted);background:var(--bg);border-top:1px solid var(--border);}.powered-by.svelte-p7nz7 a:where(.svelte-p7nz7) {color:var(--primary-color);text-decoration:none;font-weight:500;}.powered-by.svelte-p7nz7 a:where(.svelte-p7nz7):hover {text-decoration:underline;}`
3094
+ };
3095
+ function qi(e, t) {
3096
+ Er(t, !0), Zn(e, Bi);
3097
+ let r = Y(t, "projectId"), n = Y(t, "apiUrl", 7, "https://api.fortalece.ai"), i = Y(t, "position", 7, "bottom-right"), s = Y(t, "theme", 7, "light"), a = Y(t, "primaryColor", 7, "#6366f1"), l = Y(t, "showPriority", 7, !0), o = Y(t, "allowAttachments", 7, !1), f = /* @__PURE__ */ I(!1), c = /* @__PURE__ */ I(!1), p = /* @__PURE__ */ I(!1), u = /* @__PURE__ */ I(null), v = /* @__PURE__ */ I("improvement"), g = /* @__PURE__ */ I(""), A = /* @__PURE__ */ I(""), h = /* @__PURE__ */ I("medium"), _ = /* @__PURE__ */ I("");
3098
+ const B = /* @__PURE__ */ ft(() => ({ projectId: r(), apiUrl: n() })), oe = /* @__PURE__ */ ft(() => i() === "bottom-left" ? "left: 1rem; right: auto;" : "right: 1rem; left: auto;"), q = /* @__PURE__ */ ft(() => s() === "dark" ? "theme-dark" : s() === "auto" ? "theme-auto" : "theme-light"), fe = [
3099
+ { value: "bug", label: "Bug Report", icon: "🐛" },
3100
+ { value: "feature", label: "Feature Request", icon: "✨" },
3101
+ { value: "improvement", label: "Improvement", icon: "💡" },
3102
+ { value: "question", label: "Question", icon: "❓" },
3103
+ { value: "other", label: "Other", icon: "📝" }
3104
+ ], V = [
3105
+ { value: "low", label: "Low", color: "#22c55e" },
3106
+ { value: "medium", label: "Medium", color: "#f59e0b" },
3107
+ { value: "high", label: "High", color: "#ef4444" }
3108
+ ];
3109
+ function M() {
3110
+ m(f, !d(f)), d(f) || ee();
3111
+ }
3112
+ function ee() {
3113
+ m(v, "improvement"), m(g, ""), m(A, ""), m(h, "medium"), m(_, ""), m(u, null), m(p, !1);
3114
+ }
3115
+ async function me(z) {
3116
+ if (z.preventDefault(), !d(g).trim() || !d(A).trim()) {
3117
+ m(u, "Please fill in all required fields.");
3118
+ return;
3119
+ }
3120
+ m(c, !0), m(u, null);
3121
+ try {
3122
+ const te = await yi(d(B), {
3123
+ type: d(v),
3124
+ title: d(g).trim(),
3125
+ description: d(A).trim(),
3126
+ priority: l() ? d(h) : void 0,
3127
+ email: d(_).trim() || void 0
3128
+ });
3129
+ te.success ? m(p, !0) : m(u, te.error || "Failed to submit feedback. Please try again.", !0);
3130
+ } catch {
3131
+ m(u, "An unexpected error occurred. Please try again.");
3132
+ } finally {
3133
+ m(c, !1);
3134
+ }
3135
+ }
3136
+ var N = {
3137
+ get projectId() {
3138
+ return r();
3139
+ },
3140
+ set projectId(z) {
3141
+ r(z), D();
3142
+ },
3143
+ get apiUrl() {
3144
+ return n();
3145
+ },
3146
+ set apiUrl(z = "https://api.fortalece.ai") {
3147
+ n(z), D();
3148
+ },
3149
+ get position() {
3150
+ return i();
3151
+ },
3152
+ set position(z = "bottom-right") {
3153
+ i(z), D();
3154
+ },
3155
+ get theme() {
3156
+ return s();
3157
+ },
3158
+ set theme(z = "light") {
3159
+ s(z), D();
3160
+ },
3161
+ get primaryColor() {
3162
+ return a();
3163
+ },
3164
+ set primaryColor(z = "#6366f1") {
3165
+ a(z), D();
3166
+ },
3167
+ get showPriority() {
3168
+ return l();
3169
+ },
3170
+ set showPriority(z = !0) {
3171
+ l(z), D();
3172
+ },
3173
+ get allowAttachments() {
3174
+ return o();
3175
+ },
3176
+ set allowAttachments(z = !1) {
3177
+ o(z), D();
3178
+ }
3179
+ }, xe = Ui(), $e = E(xe);
3180
+ $e.__click = M;
3181
+ var b = E($e);
3182
+ {
3183
+ var ce = (z) => {
3184
+ var te = Mi();
3185
+ R(z, te);
3186
+ }, ue = (z) => {
3187
+ var te = Ii();
3188
+ R(z, te);
3189
+ };
3190
+ ge(b, (z) => {
3191
+ d(f) ? z(ce) : z(ue, !1);
3192
+ });
3193
+ }
3194
+ $($e);
3195
+ var rr = C($e, 2);
3196
+ {
3197
+ var _t = (z) => {
3198
+ var te = Fi(), gt = E(te), bt = C(E(gt), 2);
3199
+ bt.__click = M, $(gt);
3200
+ var ze = C(gt, 2), nr = E(ze);
3201
+ {
3202
+ var L = (de) => {
3203
+ var ve = Ni(), Pe = C(E(ve), 6);
3204
+ Pe.__click = ee, $(ve), R(de, ve);
3205
+ }, ke = (de) => {
3206
+ var ve = Di(), Pe = E(ve), et = C(E(Pe), 2);
3207
+ br(et, 21, () => fe, (T) => T.value, (T, P) => {
3208
+ var _e = Ri();
3209
+ let nt;
3210
+ _e.__click = () => m(v, d(P).value, !0);
3211
+ var je = E(_e), De = E(je, !0);
3212
+ $(je);
3213
+ var $t = C(je, 2), ar = E($t, !0);
3214
+ $($t), $(_e), Se(() => {
3215
+ nt = Tt(_e, 1, "type-btn svelte-p7nz7", null, nt, { active: d(v) === d(P).value }), lt(De, d(P).icon), lt(ar, d(P).label);
3216
+ }), R(T, _e);
3217
+ }), $(et), $(Pe);
3218
+ var wt = C(Pe, 2), Lt = C(E(wt), 2);
3219
+ Kr(Lt), $(wt);
3220
+ var yt = C(wt, 2), tt = C(E(yt), 2);
3221
+ yn(tt), $(yt);
3222
+ var rt = C(yt, 2);
3223
+ {
3224
+ var sr = (T) => {
3225
+ var P = Oi(), _e = C(E(P), 2);
3226
+ br(_e, 21, () => V, (nt) => nt.value, (nt, je) => {
3227
+ var De = Li();
3228
+ let $t;
3229
+ De.__click = () => m(h, d(je).value, !0);
3230
+ var ar = E(De, !0);
3231
+ $(De), Se(() => {
3232
+ $t = Tt(De, 1, "priority-btn svelte-p7nz7", null, $t, { active: d(h) === d(je).value }), wr(De, `--priority-color: ${d(je).color ?? ""}`), lt(ar, d(je).label);
3233
+ }), R(nt, De);
3234
+ }), $(_e), $(P), R(T, P);
3235
+ };
3236
+ ge(rt, (T) => {
3237
+ l() && T(sr);
3238
+ });
3239
+ }
3240
+ var xt = C(rt, 2), Lr = C(E(xt), 2);
3241
+ Kr(Lr), Et(2), $(xt);
3242
+ var Or = C(xt, 2);
3243
+ {
3244
+ var Wn = (T) => {
3245
+ var P = Pi(), _e = C(E(P));
3246
+ $(P), Se(() => lt(_e, ` ${d(u) ?? ""}`)), R(T, P);
3247
+ };
3248
+ ge(Or, (T) => {
3249
+ d(u) && T(Wn);
3250
+ });
3251
+ }
3252
+ var ir = C(Or, 2), Gn = E(ir);
3253
+ {
3254
+ var Jn = (T) => {
3255
+ var P = ji();
3256
+ Et(), R(T, P);
3257
+ }, Xn = (T) => {
3258
+ var P = ti("Submit Feedback");
3259
+ R(T, P);
3260
+ };
3261
+ ge(Gn, (T) => {
3262
+ d(c) ? T(Jn) : T(Xn, !1);
3263
+ });
3264
+ }
3265
+ $(ir), $(ve), Se(() => ir.disabled = d(c)), Fn("submit", ve, me), jt(Lt, () => d(g), (T) => m(g, T)), jt(tt, () => d(A), (T) => m(A, T)), jt(Lr, () => d(_), (T) => m(_, T)), R(de, ve);
3266
+ };
3267
+ ge(nr, (de) => {
3268
+ d(p) ? de(L) : de(ke, !1);
3269
+ });
3270
+ }
3271
+ $(ze), Et(2), $(te), R(z, te);
3272
+ };
3273
+ ge(rr, (z) => {
3274
+ d(f) && z(_t);
3275
+ });
3276
+ }
3277
+ return $(xe), Se(() => {
3278
+ Tt(xe, 1, `feedback-panel ${d(q) ?? ""}`, "svelte-p7nz7"), wr(xe, `--primary-color: ${a() ?? ""}; ${d(oe) ?? ""}`), Nt($e, "aria-label", d(f) ? "Close feedback" : "Send feedback");
3279
+ }), R(e, xe), Sr(N);
3280
+ }
3281
+ Un(["click"]);
3282
+ customElements.define("feedback-panel", Yn(
3283
+ qi,
3284
+ {
3285
+ projectId: { attribute: "project-id", reflect: !0 },
3286
+ apiUrl: { attribute: "api-url", reflect: !0 },
3287
+ position: { attribute: "position", reflect: !0 },
3288
+ theme: { attribute: "theme", reflect: !0 },
3289
+ primaryColor: { attribute: "primary-color", reflect: !0 },
3290
+ showPriority: { attribute: "show-priority", reflect: !0, type: "Boolean" },
3291
+ allowAttachments: {
3292
+ attribute: "allow-attachments",
3293
+ reflect: !0,
3294
+ type: "Boolean"
3295
+ }
3296
+ },
3297
+ [],
3298
+ [],
3299
+ !0
3300
+ ));
3301
+ const Vi = "0.1.0";
3302
+ export {
3303
+ Nr as DEFAULT_API_URL,
3304
+ qi as FeedbackPanel,
3305
+ Ci as SupportChat,
3306
+ Vi as VERSION,
3307
+ Zi as createApiConfig,
3308
+ cr as createSystemMessage,
3309
+ wi as createUserMessage,
3310
+ bi as sendMessage,
3311
+ yi as submitFeedback
3312
+ };