fictoan-react 2.0.0-beta.5 → 2.0.0-beta.7

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,4245 @@
1
+ "use client";
2
+ "use client;";
3
+ import { jsx as o, jsxs as I, Fragment as Ee } from "react/jsx-runtime";
4
+ import N, { useCallback as G, useEffect as q, useRef as Y, useState as j, useMemo as ye, createElement as xt, createRef as Rt, useImperativeHandle as Je, createContext as Be, useContext as Ne } from "react";
5
+ import { createRoot as Mt } from "react-dom/client";
6
+ const Et = (e) => e.filter((t) => !!t).join(" "), D = N.forwardRef(
7
+ ({
8
+ as: e = "div",
9
+ role: t,
10
+ ariaLabel: a,
11
+ tabIndex: r,
12
+ onKeyDown: c,
13
+ ...s
14
+ }, n) => {
15
+ const {
16
+ classNames: i = [],
17
+ bgColor: l,
18
+ bgColour: d,
19
+ bgOpacity: u,
20
+ borderColor: p,
21
+ borderColour: f,
22
+ borderOpacity: x,
23
+ className: v,
24
+ columns: k,
25
+ fillColor: m,
26
+ fillColour: A,
27
+ gap: y,
28
+ hideOnDesktop: R,
29
+ hideOnMobile: T,
30
+ hideOnTabletLandscape: V,
31
+ hideOnTabletPortrait: F,
32
+ horizontalMargin: E,
33
+ horizontalPadding: P,
34
+ horizontallyCenterThis: b,
35
+ horizontallyCentreThis: L,
36
+ isFullHeight: _,
37
+ isFullWidth: S,
38
+ layoutAsFlexbox: w,
39
+ layoutAsGrid: z,
40
+ stackVertically: C,
41
+ stackHorizontally: B,
42
+ marginLeft: g,
43
+ marginBottom: $,
44
+ margin: h,
45
+ marginRight: M,
46
+ marginTop: O,
47
+ opacity: H,
48
+ paddingBottom: Z,
49
+ paddingLeft: le,
50
+ padding: te,
51
+ paddingRight: ae,
52
+ paddingTop: re,
53
+ pushItemsToEnds: $e,
54
+ shadow: we,
55
+ shape: W,
56
+ showOnlyOnDesktop: X,
57
+ showOnlyOnMobile: Q,
58
+ showOnlyOnTabletLandscape: se,
59
+ showOnlyOnTabletPortrait: xe,
60
+ size: Ie,
61
+ strokeColor: U,
62
+ strokeColour: he,
63
+ textColor: ge,
64
+ textColour: ue,
65
+ verticalMargin: be,
66
+ verticalPadding: Re,
67
+ verticallyCenterItems: bt,
68
+ verticallyCentreItems: Nt,
69
+ weight: _e,
70
+ style: kt,
71
+ ...$t
72
+ } = s, { className: Da, classNames: Aa, ...La } = s, Ge = {
73
+ ...kt,
74
+ ...u && { "--bg-opacity": Number(u) / 100 },
75
+ ...x && { "--border-opacity": Number(x) / 100 }
76
+ };
77
+ return /* @__PURE__ */ o(
78
+ e,
79
+ {
80
+ ref: n,
81
+ role: t,
82
+ "aria-label": a,
83
+ tabIndex: r,
84
+ onKeyDown: c,
85
+ ...$t,
86
+ style: Object.keys(Ge).length > 0 ? Ge : void 0,
87
+ className: Et(
88
+ [
89
+ v,
90
+ l && `bg-${l}`,
91
+ d && `bg-${d}`,
92
+ p && `border-${p}`,
93
+ f && `border-${f}`,
94
+ m && `fill-${m}`,
95
+ A && `fill-${A}`,
96
+ R && "hide-on-desktop",
97
+ T && "hide-on-mobile",
98
+ V && "hide-on-tablet-landscape",
99
+ F && "hide-on-tablet-portrait",
100
+ E && `margin-right-${E} margin-left-${E}`,
101
+ P && `padding-right-${P} padding-left-${P}`,
102
+ b && "horizontally-centre-this",
103
+ L && "horizontally-centre-this",
104
+ _ && "full-height",
105
+ S && "full-width",
106
+ w && "layout-flexbox",
107
+ z && "layout-grid",
108
+ C && "stack-vertically",
109
+ B && "stack-horizontally",
110
+ y && `gap-${y}`,
111
+ g && `margin-left-${g}`,
112
+ $ && `margin-bottom-${$}`,
113
+ h && `margin-all-${h}`,
114
+ M && `margin-right-${M}`,
115
+ O && `margin-top-${O}`,
116
+ H && `opacity-${H}`,
117
+ Z && `padding-bottom-${Z}`,
118
+ le && `padding-left-${le}`,
119
+ te && `padding-all-${te}`,
120
+ ae && `padding-right-${ae}`,
121
+ re && `padding-top-${re}`,
122
+ $e && "push-to-ends",
123
+ we && `shadow-${we}`,
124
+ W && `shape-${W}`,
125
+ X && "show-only-on-desktop",
126
+ Q && "show-only-on-mobile",
127
+ se && "show-only-on-tablet-landscape",
128
+ xe && "show-only-on-tablet-portrait",
129
+ Ie && `size-${Ie}`,
130
+ U && `stroke-${U}`,
131
+ he && `stroke-${he}`,
132
+ ge && `text-${ge}`,
133
+ ue && `text-${ue}`,
134
+ be && `margin-top-${be} margin-bottom-${be}`,
135
+ Re && `padding-top-${Re} padding-bottom-${Re}`,
136
+ bt && "vertically-centre-items",
137
+ Nt && "vertically-centre-items",
138
+ _e && `weight-${_e}`
139
+ ].concat(i)
140
+ )
141
+ }
142
+ );
143
+ }
144
+ );
145
+ D.displayName = "Element";
146
+ const de = (e, t) => N.forwardRef(
147
+ (a, r) => {
148
+ const c = { ...t, ...a };
149
+ if (e === "a" && "external" in c) {
150
+ const { external: s } = c;
151
+ s && (c.target = "_blank", c.rel = "noopener noreferrer");
152
+ }
153
+ return /* @__PURE__ */ o(D, { as: e, ref: r, ...c });
154
+ }
155
+ ), Va = de("article"), Fa = de("aside"), Wa = de("body"), K = de("div"), za = de("footer"), Ha = de("header"), _a = de("main"), Pt = de("nav"), Ga = de("section"), Ka = de("span"), ja = de("a", {
156
+ rel: "noopener noreferrer"
157
+ // Default props for Hyperlink
158
+ }), St = {
159
+ cross: /* @__PURE__ */ o("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ o("path", { d: "M18 6L6 18M6 6l12 12" }) }),
160
+ tick: /* @__PURE__ */ o("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ o("path", { d: "M5 12l5 5L20 7" }) }),
161
+ plus: /* @__PURE__ */ o("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ o("path", { d: "M12 5v14M5 12h14" }) }),
162
+ minus: /* @__PURE__ */ o("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ o("path", { d: "M5 12h14" }) })
163
+ }, Oe = N.forwardRef(
164
+ ({
165
+ children: e,
166
+ size: t = "medium",
167
+ shape: a,
168
+ actionIcon: r,
169
+ onActionClick: c,
170
+ actionAriaLabel: s,
171
+ ...n
172
+ }, i) => {
173
+ let l = [];
174
+ t && l.push(`size-${t}`), a && l.push(`shape-${a}`);
175
+ const d = (p) => {
176
+ p.stopPropagation(), c == null || c(p);
177
+ }, u = !!r;
178
+ return /* @__PURE__ */ I(
179
+ D,
180
+ {
181
+ "data-badge": !0,
182
+ "data-has-action": u || void 0,
183
+ ref: i,
184
+ classNames: l,
185
+ role: "status",
186
+ "aria-label": typeof e == "string" ? e : void 0,
187
+ ...n,
188
+ children: [
189
+ e,
190
+ u && /* @__PURE__ */ o(
191
+ "button",
192
+ {
193
+ type: "button",
194
+ className: "badge-action-button",
195
+ onClick: d,
196
+ "aria-label": s,
197
+ children: St[r]
198
+ }
199
+ )
200
+ ]
201
+ }
202
+ );
203
+ }
204
+ );
205
+ Oe.displayName = "Badge";
206
+ const Fe = (e, t) => {
207
+ const a = G(t, [t]);
208
+ q(() => {
209
+ const r = (c) => {
210
+ !e.current || typeof a != "function" || e.current.contains(c.target) || a(c);
211
+ };
212
+ return document.addEventListener("mousedown", r), document.addEventListener("touchstart", r), () => {
213
+ document.removeEventListener("mousedown", r), document.removeEventListener("touchstart", r);
214
+ };
215
+ }, [e, a]);
216
+ }, It = N.forwardRef(
217
+ ({
218
+ id: e,
219
+ children: t,
220
+ isOpen: a = !1,
221
+ onClose: r,
222
+ position: c = "right",
223
+ size: s = "medium",
224
+ padding: n = "micro",
225
+ bgColor: i,
226
+ bgColour: l,
227
+ isDismissible: d = !0,
228
+ showOverlay: u = !0,
229
+ blurOverlay: p = !1,
230
+ closeOnClickOutside: f = !0,
231
+ zIndex: x,
232
+ label: v,
233
+ description: k,
234
+ classNames: m = [],
235
+ ...A
236
+ }, y) => {
237
+ const R = `${e}`, T = k ? `${R}-description` : void 0, V = Y(null), F = y || V, E = [
238
+ "drawer",
239
+ c,
240
+ s,
241
+ ...a ? ["open"] : [],
242
+ ...u ? ["with-overlay"] : [],
243
+ ...p ? ["blur-overlay"] : [],
244
+ ...m
245
+ ];
246
+ return q(() => {
247
+ const b = F.current, L = document.querySelector(`[data-drawer-overlay-for="${R}"]`);
248
+ return a ? (b == null || b.classList.add("open"), b == null || b.classList.remove("closing"), b == null || b.focus(), L && L.classList.add("visible"), document.body.style.overflow = "hidden") : b != null && b.classList.contains("open") && (b.classList.add("closing"), b.classList.remove("open"), L && L.classList.remove("visible"), document.body.style.overflow = ""), () => {
249
+ document.body.style.overflow = "";
250
+ };
251
+ }, [a, R, F]), q(() => {
252
+ const b = (L) => {
253
+ L.key === "Escape" && d && a && r && r();
254
+ };
255
+ return document.addEventListener("keydown", b), () => document.removeEventListener("keydown", b);
256
+ }, [d, a, r]), Fe(F, () => {
257
+ f && d && a && r && r();
258
+ }), /* @__PURE__ */ I(Ee, { children: [
259
+ u && /* @__PURE__ */ o(
260
+ K,
261
+ {
262
+ className: `drawer-overlay ${p ? "blur" : ""} ${a ? "visible" : ""}`,
263
+ "data-drawer-overlay-for": e,
264
+ "aria-hidden": "true",
265
+ onClick: f && d && r ? r : void 0,
266
+ style: { zIndex: x ?? 9999 }
267
+ }
268
+ ),
269
+ /* @__PURE__ */ I(
270
+ D,
271
+ {
272
+ as: "div",
273
+ id: R,
274
+ "data-drawer": !0,
275
+ ref: F,
276
+ classNames: E,
277
+ onAnimationEnd: (b) => {
278
+ (b.animationName.includes("slide-out") || b.animationName.includes("fade-out")) && b.currentTarget.classList.remove("closing");
279
+ },
280
+ role: "dialog",
281
+ "aria-modal": "true",
282
+ "aria-label": v || "Drawer",
283
+ "aria-describedby": T,
284
+ tabIndex: -1,
285
+ style: { zIndex: x ?? 1e4 },
286
+ ...A,
287
+ children: [
288
+ d && r && /* @__PURE__ */ o(
289
+ "button",
290
+ {
291
+ className: "drawer-dismiss-button",
292
+ onClick: r,
293
+ "aria-label": "Close drawer",
294
+ tabIndex: 0,
295
+ children: "×"
296
+ }
297
+ ),
298
+ /* @__PURE__ */ I(
299
+ K,
300
+ {
301
+ className: "drawer-content",
302
+ role: "document",
303
+ padding: n,
304
+ bgColor: i,
305
+ bgColour: l,
306
+ children: [
307
+ k && /* @__PURE__ */ o("div", { id: T, className: "sr-only", children: k }),
308
+ t
309
+ ]
310
+ }
311
+ )
312
+ ]
313
+ }
314
+ )
315
+ ] });
316
+ }
317
+ );
318
+ It.displayName = "Drawer";
319
+ const We = N.forwardRef(
320
+ ({ size: e = "medium", shape: t, kind: a, isLoading: r, label: c, ...s }, n) => {
321
+ let i = [];
322
+ return a && i.push(a), e && i.push(`size-${e}`), t && i.push(`shape-${t}`), r && i.push("is-loading"), /* @__PURE__ */ o(
323
+ D,
324
+ {
325
+ as: "button",
326
+ "data-button": !0,
327
+ ref: n,
328
+ classNames: i,
329
+ "aria-label": c,
330
+ "aria-disabled": s.disabled || r,
331
+ "aria-busy": r,
332
+ ...s
333
+ }
334
+ );
335
+ }
336
+ );
337
+ We.displayName = "Button";
338
+ const Tt = N.forwardRef(
339
+ ({ isJoint: e = !0, spacing: t, equaliseWidth: a, children: r, ...c }, s) => {
340
+ let n = [];
341
+ return e && n.push("is-joint"), t && !e && n.push(`spacing-${t}`), a && n.push("equal-width"), /* @__PURE__ */ o(
342
+ D,
343
+ {
344
+ as: "div",
345
+ "data-button-group": !0,
346
+ ref: s,
347
+ role: "group",
348
+ classNames: n,
349
+ ...c,
350
+ children: r
351
+ }
352
+ );
353
+ }
354
+ );
355
+ Tt.displayName = "ButtonGroup";
356
+ const Ke = N.forwardRef(
357
+ ({ children: e, current: t, ...a }, r) => /* @__PURE__ */ o(
358
+ D,
359
+ {
360
+ as: "li",
361
+ "data-breadcrumb-item": !0,
362
+ ref: r,
363
+ ...a,
364
+ "aria-current": t ? "page" : void 0,
365
+ className: t ? "current" : void 0,
366
+ role: "listitem",
367
+ children: /* @__PURE__ */ o("span", { className: "breadcrumb-content", children: e })
368
+ }
369
+ )
370
+ ), Dt = ({ separator: e }) => /* @__PURE__ */ o(
371
+ J,
372
+ {
373
+ className: "breadcrumb-separator",
374
+ "aria-hidden": "true",
375
+ role: "presentation",
376
+ margin: "none",
377
+ children: e
378
+ }
379
+ ), At = N.forwardRef(
380
+ ({ children: e, separator: t = "/", spacing: a = "micro", ...r }, c) => {
381
+ let s = [];
382
+ a && s.push(`spacing-${a}`);
383
+ const n = N.Children.toArray(e).filter(Boolean), i = n.reduce((l, d, u) => {
384
+ if (!N.isValidElement(d)) return l;
385
+ const p = u === n.length - 1;
386
+ let f;
387
+ if (d.type === Ke) {
388
+ const x = d;
389
+ f = N.cloneElement(x, {
390
+ current: p
391
+ });
392
+ } else
393
+ f = /* @__PURE__ */ o(Ke, { current: p, children: d }, `item-${u}`);
394
+ return l.push(f), p || l.push(
395
+ /* @__PURE__ */ o(Dt, { separator: t }, `sep-${u}`)
396
+ ), l;
397
+ }, []);
398
+ return /* @__PURE__ */ o("nav", { "aria-label": "Breadcrumb", ref: c, ...r, children: /* @__PURE__ */ o(
399
+ D,
400
+ {
401
+ as: "ul",
402
+ "data-breadcrumbs-wrapper": !0,
403
+ role: "list",
404
+ classNames: s,
405
+ children: i
406
+ }
407
+ ) });
408
+ }
409
+ );
410
+ At.displayName = "Breadcrumbs";
411
+ const Ze = N.forwardRef(
412
+ ({ kind: e, children: t, title: a, ...r }, c) => /* @__PURE__ */ o(
413
+ D,
414
+ {
415
+ as: "div",
416
+ "data-callout": !0,
417
+ ref: c,
418
+ className: e,
419
+ role: {
420
+ info: "status",
421
+ success: "status",
422
+ warning: "alert",
423
+ error: "alert"
424
+ }[e],
425
+ "aria-live": e === "error" || e === "warning" ? "assertive" : "polite",
426
+ "aria-label": a,
427
+ ...r,
428
+ children: t
429
+ }
430
+ )
431
+ );
432
+ Ze.displayName = "Callout";
433
+ const Qe = N.forwardRef(({ shape: e, heading: t, children: a, ...r }, c) => {
434
+ let s = [];
435
+ return e && s.push(`shape-${e}`), /* @__PURE__ */ o(
436
+ D,
437
+ {
438
+ as: "div",
439
+ "data-card": !0,
440
+ ref: c,
441
+ classNames: s,
442
+ role: "region",
443
+ "aria-label": t,
444
+ tabIndex: 0,
445
+ ...r,
446
+ children: a
447
+ }
448
+ );
449
+ });
450
+ Qe.displayName = "Card";
451
+ const Lt = N.forwardRef(({
452
+ children: e,
453
+ source: t,
454
+ language: a = "json",
455
+ showCopyButton: r,
456
+ showLineNumbers: c,
457
+ description: s,
458
+ withSyntaxHighlighting: n = !1,
459
+ makeEditable: i = !1,
460
+ onChange: l,
461
+ shadow: d,
462
+ ...u
463
+ }, p) => {
464
+ const [f, x] = j(!1), [v, k] = j(null), [m, A] = j(n), [y, R] = j(null), T = Y(null);
465
+ let V = typeof e == "string" ? e : N.Children.toArray(e).join("");
466
+ e || (V = typeof t == "object" ? JSON.stringify(t, null, 2) : t ?? ""), q(() => {
467
+ if (!n) return;
468
+ (async () => {
469
+ var z;
470
+ A(!0);
471
+ try {
472
+ const B = (await import("prismjs")).default;
473
+ if (typeof window < "u" && !window.Prism && (window.Prism = B), a !== "plain" && !B.languages[a])
474
+ try {
475
+ await import(`prismjs/components/prism-${a}`);
476
+ } catch {
477
+ console.warn(`Language "${a}" not available, falling back to plain text`);
478
+ }
479
+ k(B);
480
+ } catch (C) {
481
+ (C == null ? void 0 : C.code) === "ERR_MODULE_NOT_FOUND" || (z = C == null ? void 0 : C.message) != null && z.includes("Cannot find module") ? console.warn(
482
+ "PrismJS is not installed. To enable syntax highlighting, run: npm install prismjs"
483
+ ) : console.warn(`Failed to load syntax highlighting for ${a}:`, C);
484
+ } finally {
485
+ A(!1);
486
+ }
487
+ })();
488
+ }, [n, a]);
489
+ const F = G(() => {
490
+ var $;
491
+ const w = window.getSelection();
492
+ if (!w || w.rangeCount === 0) return null;
493
+ const z = w.getRangeAt(0), C = z.startContainer;
494
+ let g = z.startOffset;
495
+ if (C && C !== y && y) {
496
+ const h = document.createTreeWalker(
497
+ y,
498
+ NodeFilter.SHOW_TEXT,
499
+ null
500
+ );
501
+ let M;
502
+ for (; (M = h.nextNode()) && M !== C; )
503
+ g += (($ = M.textContent) == null ? void 0 : $.length) || 0;
504
+ }
505
+ return g;
506
+ }, [y]), E = G((w) => {
507
+ var z;
508
+ if (!(!y || !n || !v))
509
+ try {
510
+ const C = i ? F() : null, B = v.highlight(
511
+ w,
512
+ v.languages[a] || v.languages.plain,
513
+ a
514
+ );
515
+ if (y.innerHTML = B, i && C !== null) {
516
+ const g = window.getSelection(), $ = document.createRange(), h = document.createTreeWalker(
517
+ y,
518
+ NodeFilter.SHOW_TEXT,
519
+ null
520
+ );
521
+ let M = 0, O;
522
+ for (; O = h.nextNode(); ) {
523
+ const H = ((z = O.textContent) == null ? void 0 : z.length) || 0;
524
+ if (M + H >= C) {
525
+ $.setStart(O, C - M), $.setEnd(O, C - M), g == null || g.removeAllRanges(), g == null || g.addRange($);
526
+ break;
527
+ }
528
+ M += H;
529
+ }
530
+ }
531
+ } catch (C) {
532
+ console.warn("Error highlighting code:", C), y && (y.textContent = w);
533
+ }
534
+ }, [a, n, i, v, F, y]), P = G((w) => {
535
+ if (!y) return;
536
+ const z = y.textContent || "";
537
+ l == null || l(z), requestAnimationFrame(() => {
538
+ E(z);
539
+ });
540
+ }, [E, l, y]);
541
+ q(() => {
542
+ const w = y;
543
+ if (!(!w || !i))
544
+ return w.addEventListener("input", P), () => {
545
+ w.removeEventListener("input", P);
546
+ };
547
+ }, [i, P, y]), q(() => {
548
+ !y || !v || E(V);
549
+ }, [E, V, v, y]);
550
+ const b = async () => {
551
+ try {
552
+ const w = y ? y.textContent || "" : V;
553
+ await navigator.clipboard.writeText(w), x(!0), setTimeout(() => x(!1), 3e3);
554
+ } catch (w) {
555
+ console.error("Could not copy text: ", w);
556
+ }
557
+ }, L = async (w) => {
558
+ (w.key === "Enter" || w.key === " ") && w.target === T.current && (w.preventDefault(), await b());
559
+ };
560
+ let _ = [];
561
+ c && _.push("show-line-numbers");
562
+ const S = V.split(/\r\n|\r|\n/gm);
563
+ return /* @__PURE__ */ I(
564
+ D,
565
+ {
566
+ "data-code-block": !0,
567
+ as: "div",
568
+ classNames: _,
569
+ role: "region",
570
+ "aria-label": s || `Code block in ${a}`,
571
+ ...u,
572
+ children: [
573
+ r ? f ? /* @__PURE__ */ o(
574
+ Oe,
575
+ {
576
+ className: "code-block-copied-badge",
577
+ size: "tiny",
578
+ shape: "rounded",
579
+ "aria-live": "polite",
580
+ children: "Copied!"
581
+ }
582
+ ) : /* @__PURE__ */ o(
583
+ We,
584
+ {
585
+ type: "button",
586
+ className: "code-block-copy-button",
587
+ size: "tiny",
588
+ shape: "rounded",
589
+ onClick: b,
590
+ onKeyDown: L,
591
+ "aria-label": "Copy code to clipboard",
592
+ children: "Copy"
593
+ }
594
+ ) : null,
595
+ /* @__PURE__ */ I(
596
+ "pre",
597
+ {
598
+ ref: T,
599
+ className: `language-${a}${d ? ` shadow-${d}` : ""}`,
600
+ tabIndex: 0,
601
+ "aria-label": `Code in ${a}`,
602
+ children: [
603
+ c && Array.from(Array(S.length).keys()).map((w) => /* @__PURE__ */ o(
604
+ "span",
605
+ {
606
+ className: "line-numbers",
607
+ "aria-hidden": "true",
608
+ children: w + 1
609
+ },
610
+ w
611
+ )),
612
+ /* @__PURE__ */ o(
613
+ "code",
614
+ {
615
+ ref: R,
616
+ contentEditable: i,
617
+ suppressContentEditableWarning: !0,
618
+ spellCheck: "false",
619
+ className: `language-${a} ${m ? "is-loading" : ""}`,
620
+ children: V
621
+ }
622
+ )
623
+ ]
624
+ }
625
+ )
626
+ ]
627
+ }
628
+ );
629
+ });
630
+ Lt.displayName = "CodeBlock";
631
+ const et = N.forwardRef(
632
+ ({ kind: e, height: t, label: a, ...r }, c) => {
633
+ let s = [];
634
+ return e && s.push(e), /* @__PURE__ */ o(
635
+ D,
636
+ {
637
+ as: "hr",
638
+ "data-hrule": !0,
639
+ ref: c,
640
+ classNames: s,
641
+ role: "separator",
642
+ "aria-orientation": "horizontal",
643
+ "aria-label": a,
644
+ ...r,
645
+ style: { height: t }
646
+ }
647
+ );
648
+ }
649
+ );
650
+ et.displayName = "Divider";
651
+ const Bt = [
652
+ // Colours
653
+ "bgColor",
654
+ "bgColour",
655
+ "bgOpacity",
656
+ "textColor",
657
+ "textColour",
658
+ "borderColor",
659
+ "borderColour",
660
+ "borderOpacity",
661
+ "fillColor",
662
+ "fillColour",
663
+ "strokeColor",
664
+ "strokeColour",
665
+ // Visual
666
+ "shadow",
667
+ "shape",
668
+ "opacity",
669
+ // Layout
670
+ "layoutAsFlexbox",
671
+ "stackVertically",
672
+ "stackHorizontally",
673
+ "layoutAsGrid",
674
+ "columns",
675
+ "gap",
676
+ // Margin
677
+ "margin",
678
+ "horizontalMargin",
679
+ "verticalMargin",
680
+ "marginTop",
681
+ "marginRight",
682
+ "marginBottom",
683
+ "marginLeft",
684
+ // Padding
685
+ "padding",
686
+ "horizontalPadding",
687
+ "verticalPadding",
688
+ "paddingTop",
689
+ "paddingRight",
690
+ "paddingBottom",
691
+ "paddingLeft",
692
+ // Alignment
693
+ "horizontallyCentreThis",
694
+ "horizontallyCenterThis",
695
+ "verticallyCentreItems",
696
+ "verticallyCenterItems",
697
+ "pushItemsToEnds",
698
+ // Sizing
699
+ "isFullWidth",
700
+ "isFullHeight",
701
+ // Responsive visibility
702
+ "hideOnMobile",
703
+ "showOnlyOnMobile",
704
+ "hideOnTabletPortrait",
705
+ "showOnlyOnTabletPortrait",
706
+ "hideOnTabletLandscape",
707
+ "showOnlyOnTabletLandscape",
708
+ "hideOnDesktop",
709
+ "showOnlyOnDesktop",
710
+ // Typography
711
+ "weight",
712
+ // Custom classes
713
+ "classNames"
714
+ ], ie = (e) => {
715
+ const t = {}, a = {};
716
+ for (const r of Object.keys(e))
717
+ Bt.includes(r) ? t[r] = e[r] : a[r] = e[r];
718
+ return {
719
+ wrapperProps: t,
720
+ inputProps: a
721
+ };
722
+ }, Pe = N.forwardRef(
723
+ ({
724
+ label: e,
725
+ hideLabel: t,
726
+ htmlFor: a,
727
+ ...r
728
+ }, c) => {
729
+ let s = [];
730
+ return t && s.push("visually-hidden"), /* @__PURE__ */ o(
731
+ D,
732
+ {
733
+ as: "label",
734
+ ref: c,
735
+ htmlFor: a,
736
+ classNames: s,
737
+ ...r,
738
+ children: e
739
+ }
740
+ );
741
+ }
742
+ );
743
+ Pe.displayName = "InputLabel";
744
+ const J = N.forwardRef(
745
+ ({ weight: e, size: t, fontStyle: a = "sans-serif", align: r, isSubtext: c, ...s }, n) => {
746
+ let i = [];
747
+ return e && i.push(`weight-${e}`), t && i.push(`text-${t}`), a && i.push(`font-${a}`), c && i.push("sub-text"), r && i.push(`text-${r}`), /* @__PURE__ */ o(D, { as: "p", ref: n, classNames: i, ...s });
748
+ }
749
+ );
750
+ J.displayName = "Text";
751
+ const Ot = ({ state: e }) => e === "valid" ? /* @__PURE__ */ o(
752
+ "svg",
753
+ {
754
+ "data-validation-icon": "valid",
755
+ xmlns: "http://www.w3.org/2000/svg",
756
+ viewBox: "0 0 24 24",
757
+ width: "20",
758
+ height: "20",
759
+ children: /* @__PURE__ */ o(
760
+ "polyline",
761
+ {
762
+ points: "3.5 12.5 8.5 17.5 20.5 5.5",
763
+ fill: "none",
764
+ stroke: "#0ec05c",
765
+ strokeMiterlimit: "10",
766
+ strokeWidth: "2"
767
+ }
768
+ )
769
+ }
770
+ ) : /* @__PURE__ */ I(
771
+ "svg",
772
+ {
773
+ "data-validation-icon": "invalid",
774
+ xmlns: "http://www.w3.org/2000/svg",
775
+ viewBox: "0 0 24 24",
776
+ width: "20",
777
+ height: "20",
778
+ children: [
779
+ /* @__PURE__ */ o(
780
+ "line",
781
+ {
782
+ x1: "6.5",
783
+ y1: "17.5",
784
+ x2: "18.5",
785
+ y2: "5.5",
786
+ fill: "none",
787
+ stroke: "#ef4343",
788
+ strokeMiterlimit: "10",
789
+ strokeWidth: "2"
790
+ }
791
+ ),
792
+ /* @__PURE__ */ o(
793
+ "line",
794
+ {
795
+ x1: "6.5",
796
+ y1: "5.5",
797
+ x2: "18.5",
798
+ y2: "17.5",
799
+ fill: "none",
800
+ stroke: "#ef4343",
801
+ strokeMiterlimit: "10",
802
+ strokeWidth: "2"
803
+ }
804
+ )
805
+ ]
806
+ }
807
+ ), ee = N.forwardRef(
808
+ ({
809
+ label: e,
810
+ customLabel: t,
811
+ htmlFor: a,
812
+ helpText: r,
813
+ errorText: c,
814
+ validationState: s,
815
+ required: n,
816
+ size: i,
817
+ labelFirst: l,
818
+ children: d,
819
+ ...u
820
+ }, p) => {
821
+ const f = e || t, x = r || c;
822
+ return /* @__PURE__ */ I(
823
+ D,
824
+ {
825
+ as: "div",
826
+ "data-form-item": !0,
827
+ ref: p,
828
+ role: "group",
829
+ required: n,
830
+ className: [i ? `size-${i}` : "", l ? "label-first" : ""].filter(Boolean).join(" ") || void 0,
831
+ ...u,
832
+ children: [
833
+ f && /* @__PURE__ */ I(K, { "data-label-wrapper": !0, "data-has-validation": s ? "true" : void 0, children: [
834
+ t || e && /* @__PURE__ */ o(Pe, { label: e, htmlFor: a }),
835
+ s && /* @__PURE__ */ o(Ot, { state: s })
836
+ ] }),
837
+ /* @__PURE__ */ o(K, { "data-input-wrapper": !0, children: d }),
838
+ x && /* @__PURE__ */ I(K, { className: "info-section vertically-center-items", children: [
839
+ r && /* @__PURE__ */ o(J, { className: "help-text", children: r }),
840
+ c && /* @__PURE__ */ o(J, { className: "error-text", children: c })
841
+ ] })
842
+ ]
843
+ }
844
+ );
845
+ }
846
+ );
847
+ ee.displayName = "FormItem";
848
+ const ze = N.forwardRef(
849
+ ({
850
+ id: e,
851
+ name: t,
852
+ label: a,
853
+ hideLabel: r,
854
+ helpText: c,
855
+ errorText: s,
856
+ onChange: n,
857
+ checked: i,
858
+ defaultChecked: l,
859
+ disabled: d,
860
+ required: u,
861
+ size: p = "medium",
862
+ labelFirst: f,
863
+ ...x
864
+ }, v) => {
865
+ const k = ye(() => t || e, [t, e]), m = (R) => {
866
+ n == null || n(R.target.checked);
867
+ }, { wrapperProps: A, inputProps: y } = ie(x);
868
+ return /* @__PURE__ */ I(
869
+ ee,
870
+ {
871
+ label: a,
872
+ htmlFor: e,
873
+ helpText: c,
874
+ errorText: s,
875
+ required: u,
876
+ size: p,
877
+ labelFirst: f,
878
+ ...A,
879
+ children: [
880
+ /* @__PURE__ */ o(
881
+ D,
882
+ {
883
+ as: "input",
884
+ type: "checkbox",
885
+ ref: v,
886
+ id: e,
887
+ name: k,
888
+ checked: i,
889
+ defaultChecked: l,
890
+ disabled: d,
891
+ required: u,
892
+ onChange: m,
893
+ ...y
894
+ }
895
+ ),
896
+ /* @__PURE__ */ o(
897
+ D,
898
+ {
899
+ as: f ? "label" : "div",
900
+ htmlFor: f ? e : void 0,
901
+ "data-checkbox": !0,
902
+ className: `size-${p}`
903
+ }
904
+ )
905
+ ]
906
+ }
907
+ );
908
+ }
909
+ );
910
+ ze.displayName = "Checkbox";
911
+ const He = N.forwardRef(
912
+ ({
913
+ id: e,
914
+ name: t,
915
+ label: a,
916
+ hideLabel: r,
917
+ helpText: c,
918
+ errorText: s,
919
+ onChange: n,
920
+ checked: i,
921
+ defaultChecked: l,
922
+ disabled: d,
923
+ required: u,
924
+ size: p = "medium",
925
+ labelFirst: f,
926
+ ...x
927
+ }, v) => {
928
+ const k = ye(() => t || e, [t, e]), m = (R) => {
929
+ n == null || n(R.target.checked);
930
+ }, { wrapperProps: A, inputProps: y } = ie(x);
931
+ return /* @__PURE__ */ I(
932
+ ee,
933
+ {
934
+ label: a,
935
+ htmlFor: e,
936
+ helpText: c,
937
+ errorText: s,
938
+ required: u,
939
+ size: p,
940
+ labelFirst: f,
941
+ ...A,
942
+ children: [
943
+ /* @__PURE__ */ o(
944
+ D,
945
+ {
946
+ as: "input",
947
+ type: "checkbox",
948
+ ref: v,
949
+ id: e,
950
+ name: k,
951
+ checked: i,
952
+ defaultChecked: l,
953
+ disabled: d,
954
+ required: u,
955
+ onChange: m,
956
+ ...y
957
+ }
958
+ ),
959
+ /* @__PURE__ */ o(
960
+ D,
961
+ {
962
+ as: f ? "label" : "div",
963
+ htmlFor: f ? e : void 0,
964
+ "data-switch": !0,
965
+ className: `size-${p}`
966
+ }
967
+ )
968
+ ]
969
+ }
970
+ );
971
+ }
972
+ );
973
+ He.displayName = "Switch";
974
+ const Ct = N.forwardRef(
975
+ ({
976
+ id: e,
977
+ name: t,
978
+ label: a,
979
+ helpText: r,
980
+ errorText: c,
981
+ options: s,
982
+ value: n,
983
+ defaultValue: i,
984
+ onChange: l,
985
+ align: d,
986
+ equaliseWidth: u,
987
+ equalizeWidth: p,
988
+ required: f,
989
+ disabled: x,
990
+ size: v,
991
+ columns: k,
992
+ labelFirst: m,
993
+ ...A
994
+ }, y) => {
995
+ const R = ye(() => t || e, [t, e]), [T, V] = N.useState(
996
+ n || i || []
997
+ );
998
+ N.useEffect(() => {
999
+ n !== void 0 && V(n);
1000
+ }, [n]);
1001
+ const F = (P, b) => {
1002
+ let L;
1003
+ b ? L = [...T, P] : L = T.filter((_) => _ !== P), n === void 0 && V(L), l == null || l(L);
1004
+ };
1005
+ let E = [];
1006
+ return d && E.push(`align-${d}`), (u || p) && E.push("equalise-width"), k && E.push("with-columns"), m && E.push("label-first"), /* @__PURE__ */ o(
1007
+ ee,
1008
+ {
1009
+ label: a,
1010
+ htmlFor: e,
1011
+ helpText: r,
1012
+ errorText: c,
1013
+ required: f,
1014
+ children: /* @__PURE__ */ o(
1015
+ D,
1016
+ {
1017
+ as: "div",
1018
+ "data-checkbox-group": !0,
1019
+ ref: y,
1020
+ classNames: E,
1021
+ role: "group",
1022
+ "aria-label": a,
1023
+ style: k ? { gridTemplateColumns: `repeat(${k}, 1fr)` } : void 0,
1024
+ ...A,
1025
+ children: s.map((P, b) => {
1026
+ const { id: L, value: _, label: S, ...w } = P, z = L || `${e}-option-${b}`, C = T.includes(_);
1027
+ return /* @__PURE__ */ o(
1028
+ ze,
1029
+ {
1030
+ id: z,
1031
+ name: R,
1032
+ label: S,
1033
+ checked: C,
1034
+ disabled: x || P.disabled,
1035
+ size: v,
1036
+ labelFirst: m,
1037
+ onChange: (B) => F(_, B),
1038
+ ...w
1039
+ },
1040
+ z
1041
+ );
1042
+ })
1043
+ }
1044
+ )
1045
+ }
1046
+ );
1047
+ }
1048
+ );
1049
+ Ct.displayName = "CheckboxGroup";
1050
+ const Vt = N.forwardRef(
1051
+ ({
1052
+ id: e,
1053
+ name: t,
1054
+ label: a,
1055
+ helpText: r,
1056
+ errorText: c,
1057
+ options: s,
1058
+ value: n,
1059
+ defaultValue: i,
1060
+ onChange: l,
1061
+ align: d,
1062
+ equaliseWidth: u,
1063
+ equalizeWidth: p,
1064
+ required: f,
1065
+ disabled: x,
1066
+ size: v,
1067
+ columns: k,
1068
+ labelFirst: m,
1069
+ ...A
1070
+ }, y) => {
1071
+ const R = ye(() => t || e, [t, e]), [T, V] = N.useState(
1072
+ n || i || []
1073
+ );
1074
+ N.useEffect(() => {
1075
+ n !== void 0 && V(n);
1076
+ }, [n]);
1077
+ const F = (P, b) => {
1078
+ let L;
1079
+ b ? L = [...T, P] : L = T.filter((_) => _ !== P), n === void 0 && V(L), l == null || l(L);
1080
+ };
1081
+ let E = [];
1082
+ return d && E.push(`align-${d}`), (u || p) && E.push("equalise-width"), k && E.push("with-columns"), m && E.push("label-first"), /* @__PURE__ */ o(
1083
+ ee,
1084
+ {
1085
+ label: a,
1086
+ htmlFor: e,
1087
+ helpText: r,
1088
+ errorText: c,
1089
+ required: f,
1090
+ children: /* @__PURE__ */ o(
1091
+ D,
1092
+ {
1093
+ as: "div",
1094
+ "data-switch-group": !0,
1095
+ ref: y,
1096
+ classNames: E,
1097
+ role: "group",
1098
+ "aria-label": a,
1099
+ style: k ? { gridTemplateColumns: `repeat(${k}, 1fr)` } : void 0,
1100
+ ...A,
1101
+ children: s.map((P, b) => {
1102
+ const { id: L, value: _, label: S, ...w } = P, z = L || `${e}-option-${b}`, C = T.includes(_);
1103
+ return /* @__PURE__ */ o(
1104
+ He,
1105
+ {
1106
+ id: z,
1107
+ name: R,
1108
+ label: S,
1109
+ checked: C,
1110
+ disabled: x || P.disabled,
1111
+ size: v,
1112
+ labelFirst: m,
1113
+ onChange: (B) => F(_, B),
1114
+ ...w
1115
+ },
1116
+ z
1117
+ );
1118
+ })
1119
+ }
1120
+ )
1121
+ }
1122
+ );
1123
+ }
1124
+ );
1125
+ Vt.displayName = "SwitchGroup";
1126
+ const tt = N.forwardRef(
1127
+ ({
1128
+ "aria-label": e,
1129
+ "aria-invalid": t,
1130
+ label: a,
1131
+ helpText: r,
1132
+ errorText: c,
1133
+ required: s,
1134
+ accept: n,
1135
+ allowMultipleFiles: i = !1,
1136
+ capture: l,
1137
+ height: d = "120px",
1138
+ onChange: u,
1139
+ className: p = "",
1140
+ instructionMainText: f = "Drag and drop or click to upload",
1141
+ instructionSubText: x = "You can add multiple files",
1142
+ invalid: v,
1143
+ id: k,
1144
+ name: m,
1145
+ badgeBgColour: A,
1146
+ badgeTextColour: y,
1147
+ size: R,
1148
+ ...T
1149
+ }, V) => {
1150
+ const [F, E] = j([]), [P, b] = j(!1), L = Y(null), _ = (h) => {
1151
+ h.preventDefault(), h.stopPropagation(), b(!0);
1152
+ }, S = (h) => {
1153
+ h.preventDefault(), h.stopPropagation(), b(!1);
1154
+ }, w = (h) => {
1155
+ h.preventDefault(), h.stopPropagation(), b(!1);
1156
+ const M = Array.from(h.dataTransfer.files);
1157
+ z(M);
1158
+ }, z = (h) => {
1159
+ if (i)
1160
+ E((M) => [...M, ...h]), u == null || u([...F, ...h]);
1161
+ else {
1162
+ const M = h[0];
1163
+ E([M]), u == null || u([M]);
1164
+ }
1165
+ }, C = (h) => {
1166
+ if (h.target.files) {
1167
+ const M = Array.from(h.target.files);
1168
+ z(M);
1169
+ }
1170
+ }, B = (h) => {
1171
+ const M = F.filter((O, H) => H !== h);
1172
+ E(M), u == null || u(M);
1173
+ }, g = () => {
1174
+ var h;
1175
+ (h = L.current) == null || h.click();
1176
+ }, { wrapperProps: $ } = ie(T);
1177
+ return /* @__PURE__ */ o(
1178
+ ee,
1179
+ {
1180
+ label: a,
1181
+ htmlFor: k,
1182
+ helpText: r,
1183
+ errorText: c,
1184
+ required: s,
1185
+ size: R,
1186
+ ...$,
1187
+ children: /* @__PURE__ */ I(
1188
+ K,
1189
+ {
1190
+ "data-file-upload-area": !0,
1191
+ ref: V,
1192
+ className: [
1193
+ "file-upload-wrapper",
1194
+ P ? "dragging" : "",
1195
+ p
1196
+ ].filter(Boolean).join(" "),
1197
+ "aria-label": e || a,
1198
+ "aria-invalid": t || v || void 0,
1199
+ "aria-required": s,
1200
+ children: [
1201
+ /* @__PURE__ */ I(
1202
+ K,
1203
+ {
1204
+ className: "file-upload-area",
1205
+ onDragOver: _,
1206
+ onDragLeave: S,
1207
+ onDrop: w,
1208
+ onClick: g,
1209
+ style: { height: d },
1210
+ children: [
1211
+ /* @__PURE__ */ o(
1212
+ "input",
1213
+ {
1214
+ ref: L,
1215
+ type: "file",
1216
+ id: k,
1217
+ name: m,
1218
+ onChange: C,
1219
+ multiple: i,
1220
+ accept: n,
1221
+ capture: l,
1222
+ className: "file-input"
1223
+ }
1224
+ ),
1225
+ f && /* @__PURE__ */ I(K, { className: "file-upload-content", children: [
1226
+ /* @__PURE__ */ o(J, { children: f }),
1227
+ x && /* @__PURE__ */ o(J, { isSubtext: !0, children: x })
1228
+ ] })
1229
+ ]
1230
+ }
1231
+ ),
1232
+ F.length > 0 && /* @__PURE__ */ o(K, { className: "uploaded-files", children: F.map((h, M) => /* @__PURE__ */ o(
1233
+ Oe,
1234
+ {
1235
+ size: "small",
1236
+ shape: "rounded",
1237
+ actionIcon: "cross",
1238
+ onActionClick: () => B(M),
1239
+ actionAriaLabel: `Remove ${h.name}`,
1240
+ bgColour: A,
1241
+ textColour: y,
1242
+ children: h.name
1243
+ },
1244
+ `${h.name}-${M}`
1245
+ )) })
1246
+ ]
1247
+ }
1248
+ )
1249
+ }
1250
+ );
1251
+ }
1252
+ );
1253
+ tt.displayName = "FileUpload";
1254
+ const Se = N.forwardRef(
1255
+ ({
1256
+ // FormItem props
1257
+ label: e,
1258
+ hideLabel: t,
1259
+ helpText: a,
1260
+ errorText: r,
1261
+ size: c,
1262
+ required: s,
1263
+ // Side elements
1264
+ innerIconLeft: n,
1265
+ innerIconRight: i,
1266
+ innerTextLeft: l,
1267
+ innerTextRight: d,
1268
+ // Validation
1269
+ validateThis: u,
1270
+ valid: p,
1271
+ invalid: f,
1272
+ validationState: x,
1273
+ // Handlers
1274
+ onChange: v,
1275
+ onBlur: k,
1276
+ onFocus: m,
1277
+ // Aria
1278
+ "aria-label": A,
1279
+ "aria-invalid": y,
1280
+ // Input props
1281
+ id: R,
1282
+ name: T,
1283
+ value: V,
1284
+ defaultValue: F,
1285
+ type: E = "text",
1286
+ placeholder: P,
1287
+ autoComplete: b,
1288
+ maxLength: L,
1289
+ minLength: _,
1290
+ pattern: S,
1291
+ readOnly: w,
1292
+ disabled: z,
1293
+ className: C,
1294
+ ...B
1295
+ }, g) => {
1296
+ const $ = Y(null), h = Y(null), M = Y(null), [O, H] = j(!1), [Z, le] = j(null), te = x ?? (u ? Z : null), ae = N.useCallback(
1297
+ (U) => {
1298
+ M.current = U, typeof g == "function" ? g(U) : g && (g.current = U);
1299
+ },
1300
+ [g]
1301
+ ), re = () => {
1302
+ const U = M.current;
1303
+ if (!U || U.value === "") {
1304
+ le(null);
1305
+ return;
1306
+ }
1307
+ le(U.validity.valid ? "valid" : "invalid");
1308
+ }, $e = (U) => {
1309
+ v == null || v(U.target.value), O && u && re();
1310
+ }, we = (U) => {
1311
+ H(!0), u && re(), k == null || k(U);
1312
+ }, W = (U) => {
1313
+ m == null || m(U);
1314
+ };
1315
+ q(() => {
1316
+ const U = (he, ge) => {
1317
+ if (!he) return;
1318
+ const ue = he.closest("[data-form-item]");
1319
+ ue == null || ue.style.setProperty(
1320
+ `--side-element-${ge}-width`,
1321
+ `${he.getBoundingClientRect().width}px`
1322
+ );
1323
+ };
1324
+ (l || n) && U($.current, "left"), (d || i) && U(h.current, "right");
1325
+ }, [l, d, n, i]);
1326
+ const X = (U, he, ge) => {
1327
+ if (!U) return null;
1328
+ const ue = typeof U == "string", be = N.isValidElement(U) ? U.props : {}, Re = !ue && N.isValidElement(U) && (be.onClick || be.onKeyDown || U.type === "button" || U.type === "a");
1329
+ return /* @__PURE__ */ o(
1330
+ K,
1331
+ {
1332
+ ref: ge,
1333
+ "data-input-side-element": !0,
1334
+ className: `${he} ${ue ? "is-text" : "is-icon"} ${Re ? "is-interactive" : ""}`,
1335
+ "aria-hidden": "true",
1336
+ children: U
1337
+ }
1338
+ );
1339
+ }, Q = !!(n || l), se = !!(i || d), { wrapperProps: xe, inputProps: Ie } = ie(B);
1340
+ return /* @__PURE__ */ I(
1341
+ ee,
1342
+ {
1343
+ label: e,
1344
+ htmlFor: R,
1345
+ helpText: a,
1346
+ errorText: r,
1347
+ validationState: te,
1348
+ required: s,
1349
+ size: c,
1350
+ ...xe,
1351
+ children: [
1352
+ /* @__PURE__ */ o(
1353
+ D,
1354
+ {
1355
+ as: "input",
1356
+ ref: ae,
1357
+ "data-input-field": !0,
1358
+ id: R,
1359
+ name: T,
1360
+ type: E,
1361
+ value: V,
1362
+ defaultValue: F,
1363
+ placeholder: P || " ",
1364
+ autoComplete: b,
1365
+ maxLength: L,
1366
+ minLength: _,
1367
+ pattern: S,
1368
+ readOnly: w,
1369
+ disabled: z,
1370
+ required: s,
1371
+ className: [
1372
+ C,
1373
+ Q && "with-left-element",
1374
+ se && "with-right-element"
1375
+ ].filter(Boolean).join(" "),
1376
+ "aria-label": A || e,
1377
+ "aria-invalid": y || f,
1378
+ "aria-required": s,
1379
+ onChange: $e,
1380
+ onBlur: we,
1381
+ onFocus: W,
1382
+ ...Ie
1383
+ }
1384
+ ),
1385
+ (Q || se) && /* @__PURE__ */ I(K, { "data-input-helper": !0, "aria-hidden": "true", children: [
1386
+ X(n || l, "left", $),
1387
+ X(i || d, "right", h)
1388
+ ] })
1389
+ ]
1390
+ }
1391
+ );
1392
+ }
1393
+ );
1394
+ Se.displayName = "InputField";
1395
+ const at = N.forwardRef(
1396
+ ({
1397
+ desktopSpan: e,
1398
+ mobileSpan: t,
1399
+ tabletLandscapeSpan: a,
1400
+ tabletPortraitSpan: r,
1401
+ isHorizontal: c,
1402
+ role: s,
1403
+ ...n
1404
+ }, i) => {
1405
+ let l = [];
1406
+ return e || a || r || t ? (e && l.push(`${e}`), a && l.push(`${a}-on-tablet-landscape`), r && l.push(`${r}-on-tablet-portrait`), t && l.push(`${t}-on-mobile`)) : l.push("whole"), c && l.push("horizontal"), /* @__PURE__ */ o(
1407
+ D,
1408
+ {
1409
+ as: "div",
1410
+ "data-portion": !0,
1411
+ ref: i,
1412
+ classNames: l,
1413
+ role: s,
1414
+ ...n
1415
+ }
1416
+ );
1417
+ }
1418
+ );
1419
+ at.displayName = "Portion";
1420
+ const rt = N.forwardRef(
1421
+ ({
1422
+ id: e,
1423
+ name: t,
1424
+ value: a,
1425
+ label: r,
1426
+ helpText: c,
1427
+ errorText: s,
1428
+ onChange: n,
1429
+ checked: i,
1430
+ disabled: l,
1431
+ required: d,
1432
+ labelFirst: u,
1433
+ ...p
1434
+ }, f) => {
1435
+ const x = ye(() => t || e, [t, e]), v = (A) => {
1436
+ A.target.checked && n && n(a);
1437
+ }, { wrapperProps: k, inputProps: m } = ie(p);
1438
+ return /* @__PURE__ */ o(
1439
+ D,
1440
+ {
1441
+ as: "div",
1442
+ "data-radio-button": !0,
1443
+ ref: f,
1444
+ role: "radio",
1445
+ "aria-checked": i,
1446
+ "aria-disabled": l,
1447
+ className: u ? "label-first" : void 0,
1448
+ ...k,
1449
+ children: /* @__PURE__ */ I(
1450
+ ee,
1451
+ {
1452
+ label: r,
1453
+ htmlFor: e,
1454
+ helpText: c,
1455
+ errorText: s,
1456
+ required: d,
1457
+ labelFirst: u,
1458
+ children: [
1459
+ /* @__PURE__ */ o(
1460
+ D,
1461
+ {
1462
+ as: "input",
1463
+ type: "radio",
1464
+ id: e,
1465
+ name: x,
1466
+ value: a,
1467
+ checked: i,
1468
+ disabled: l,
1469
+ required: d,
1470
+ onChange: v,
1471
+ ...m
1472
+ }
1473
+ ),
1474
+ /* @__PURE__ */ o(
1475
+ D,
1476
+ {
1477
+ as: u ? "label" : "div",
1478
+ htmlFor: u ? e : void 0,
1479
+ "data-radio": !0
1480
+ }
1481
+ )
1482
+ ]
1483
+ }
1484
+ )
1485
+ }
1486
+ );
1487
+ }
1488
+ );
1489
+ rt.displayName = "RadioButton";
1490
+ const st = N.forwardRef(
1491
+ ({
1492
+ id: e,
1493
+ name: t,
1494
+ label: a,
1495
+ helpText: r,
1496
+ errorText: c,
1497
+ options: s,
1498
+ value: n,
1499
+ defaultValue: i,
1500
+ onChange: l,
1501
+ align: d,
1502
+ equaliseWidth: u,
1503
+ equalizeWidth: p,
1504
+ required: f,
1505
+ disabled: x,
1506
+ size: v,
1507
+ columns: k,
1508
+ labelFirst: m,
1509
+ ...A
1510
+ }, y) => {
1511
+ const R = ye(() => t || e, [t, e]), T = (F) => {
1512
+ l == null || l(F.target.value);
1513
+ };
1514
+ let V = [];
1515
+ return d && V.push(`align-${d}`), (u || p) && V.push("equalise-width"), k && V.push("with-columns"), m && V.push("label-first"), /* @__PURE__ */ o(
1516
+ ee,
1517
+ {
1518
+ label: a,
1519
+ htmlFor: e,
1520
+ helpText: r,
1521
+ errorText: c,
1522
+ required: f,
1523
+ size: v,
1524
+ children: /* @__PURE__ */ o(
1525
+ D,
1526
+ {
1527
+ as: "div",
1528
+ "data-radio-group": !0,
1529
+ ref: y,
1530
+ classNames: V,
1531
+ role: "radiogroup",
1532
+ "aria-label": a,
1533
+ style: k ? { gridTemplateColumns: `repeat(${k}, 1fr)` } : void 0,
1534
+ ...A,
1535
+ children: s.map((F, E) => {
1536
+ const { id: P, value: b, label: L, ..._ } = F, S = P || `${e}-option-${E}`, w = n ? n === b : i === b;
1537
+ return /* @__PURE__ */ I(
1538
+ K,
1539
+ {
1540
+ "data-radio-button": !0,
1541
+ role: "radio",
1542
+ "aria-checked": w,
1543
+ className: m ? "label-first" : void 0,
1544
+ children: [
1545
+ /* @__PURE__ */ o(
1546
+ "input",
1547
+ {
1548
+ type: "radio",
1549
+ id: S,
1550
+ name: R,
1551
+ value: b,
1552
+ checked: w,
1553
+ disabled: x,
1554
+ onChange: T,
1555
+ ..._
1556
+ }
1557
+ ),
1558
+ /* @__PURE__ */ o("label", { htmlFor: S, children: L }),
1559
+ m ? /* @__PURE__ */ o("label", { htmlFor: S, "data-radio": !0 }) : /* @__PURE__ */ o(K, { "data-radio": !0 })
1560
+ ]
1561
+ },
1562
+ S
1563
+ );
1564
+ })
1565
+ }
1566
+ )
1567
+ }
1568
+ );
1569
+ }
1570
+ );
1571
+ st.displayName = "RadioGroup";
1572
+ const nt = N.forwardRef(
1573
+ ({
1574
+ layout: e = "grid",
1575
+ gutters: t = "medium",
1576
+ retainLayoutOnTabletLandscape: a,
1577
+ retainLayoutOnTabletPortrait: r,
1578
+ retainLayoutOnMobile: c,
1579
+ retainLayoutAlways: s,
1580
+ allowUltraWide: n,
1581
+ groupLabel: i,
1582
+ ...l
1583
+ }, d) => {
1584
+ let u = [];
1585
+ return e && u.push(`layout-${e}`), t && u.push(t === "none" ? "no-gutters" : `${t}-gutters`), a && u.push("retain-layout-on-tablet-landscape"), r && u.push("retain-layout-on-tablet-portrait"), c && u.push("retain-layout-on-mobile"), s && u.push(
1586
+ "retain-layout-on-tablet-landscape retain-layout-on-tablet-portrait retain-layout-on-mobile"
1587
+ ), n && u.push("allow-ultra-wide"), /* @__PURE__ */ o(
1588
+ D,
1589
+ {
1590
+ as: "div",
1591
+ "data-row": !0,
1592
+ ref: d,
1593
+ classNames: [u.join(" ")],
1594
+ marginBottom: "tiny",
1595
+ role: "grid",
1596
+ "aria-label": i,
1597
+ ...l
1598
+ }
1599
+ );
1600
+ }
1601
+ );
1602
+ nt.displayName = "Row";
1603
+ const ot = N.forwardRef(
1604
+ ({
1605
+ // FormItem props
1606
+ label: e,
1607
+ helpText: t,
1608
+ errorText: a,
1609
+ required: r,
1610
+ size: c,
1611
+ // Select props
1612
+ id: s,
1613
+ name: n,
1614
+ options: i,
1615
+ onChange: l,
1616
+ disabled: d,
1617
+ className: u,
1618
+ ...p
1619
+ }, f) => {
1620
+ const x = ye(() => n || s, [n, s]), v = (R) => /* @__PURE__ */ o(
1621
+ D,
1622
+ {
1623
+ as: "option",
1624
+ value: R.value,
1625
+ disabled: R.disabled,
1626
+ children: R.label
1627
+ },
1628
+ R.value
1629
+ ), k = (R) => /* @__PURE__ */ o(
1630
+ D,
1631
+ {
1632
+ as: "optgroup",
1633
+ label: R.label,
1634
+ children: R.options.map(v)
1635
+ },
1636
+ R.label
1637
+ ), m = (R) => {
1638
+ l == null || l(R.target.value);
1639
+ }, { wrapperProps: A, inputProps: y } = ie(p);
1640
+ return /* @__PURE__ */ o(
1641
+ ee,
1642
+ {
1643
+ label: e,
1644
+ htmlFor: s,
1645
+ helpText: t,
1646
+ errorText: a,
1647
+ required: r,
1648
+ size: c,
1649
+ ...A,
1650
+ children: /* @__PURE__ */ o(K, { "data-select": !0, className: u, disabled: d, children: /* @__PURE__ */ o(
1651
+ D,
1652
+ {
1653
+ as: "select",
1654
+ ref: f,
1655
+ id: s,
1656
+ name: x,
1657
+ disabled: d,
1658
+ required: r,
1659
+ onChange: m,
1660
+ ...y,
1661
+ children: i.map(
1662
+ (R) => "options" in R ? k(R) : v(R)
1663
+ )
1664
+ }
1665
+ ) })
1666
+ }
1667
+ );
1668
+ }
1669
+ );
1670
+ ot.displayName = "Select";
1671
+ const je = (e, t) => e > t ? "exceeded" : e >= t * 0.9 ? "warning" : "normal", Te = (e, t, a) => Math.abs(e) === 1 ? t : a, it = N.forwardRef(
1672
+ ({
1673
+ // FormItem props
1674
+ label: e,
1675
+ hideLabel: t,
1676
+ helpText: a,
1677
+ errorText: r,
1678
+ size: c,
1679
+ required: s,
1680
+ // TextArea-specific
1681
+ onChange: n,
1682
+ value: i = "",
1683
+ characterLimit: l,
1684
+ wordLimit: d,
1685
+ // Input props
1686
+ id: u,
1687
+ name: p,
1688
+ rows: f,
1689
+ cols: x,
1690
+ minLength: v,
1691
+ maxLength: k,
1692
+ placeholder: m,
1693
+ readOnly: A,
1694
+ disabled: y,
1695
+ autoComplete: R,
1696
+ // Validation (unused but destructured to not pass to DOM)
1697
+ validateThis: T,
1698
+ valid: V,
1699
+ invalid: F,
1700
+ ...E
1701
+ }, P) => {
1702
+ const b = Y(null), L = (C) => {
1703
+ n == null || n(C.target.value);
1704
+ }, _ = () => {
1705
+ const C = [];
1706
+ if (l) {
1707
+ const B = i.length, g = je(B, l), $ = Math.max(0, B - l), h = l - B;
1708
+ C.push(
1709
+ /* @__PURE__ */ o("span", { className: `limit-${g}`, children: $ > 0 ? `${$} ${Te($, "char", "chars")} over limit` : `${h} ${Te(h, "char", "chars")} left` }, "char-limit")
1710
+ );
1711
+ }
1712
+ if (d) {
1713
+ const B = i.trim().split(/\s+/).filter(Boolean).length, g = je(B, d), $ = Math.max(0, B - d), h = d - B;
1714
+ C.push(
1715
+ /* @__PURE__ */ o("span", { className: `limit-${g}`, children: $ > 0 ? `${$} ${Te($, "word", "words")} over limit` : `${h} ${Te(h, "word", "words")} left` }, "word-limit")
1716
+ );
1717
+ }
1718
+ if (!(!C.length && !a))
1719
+ return /* @__PURE__ */ I(Ee, { children: [
1720
+ a,
1721
+ a && C.length > 0 && /* @__PURE__ */ o("span", { className: "separator", children: " • " }),
1722
+ C.map((B, g) => /* @__PURE__ */ I(N.Fragment, { children: [
1723
+ g > 0 && /* @__PURE__ */ o("span", { className: "separator", children: " • " }),
1724
+ B
1725
+ ] }, g))
1726
+ ] });
1727
+ }, S = (C) => {
1728
+ b.current = C, typeof P == "function" ? P(C) : P && (P.current = C);
1729
+ }, { wrapperProps: w, inputProps: z } = ie(E);
1730
+ return /* @__PURE__ */ o(
1731
+ ee,
1732
+ {
1733
+ label: e,
1734
+ htmlFor: u,
1735
+ helpText: _(),
1736
+ errorText: r,
1737
+ required: s,
1738
+ size: c,
1739
+ ...w,
1740
+ children: /* @__PURE__ */ o(
1741
+ D,
1742
+ {
1743
+ as: "textarea",
1744
+ ref: S,
1745
+ "data-textarea": !0,
1746
+ id: u,
1747
+ name: p,
1748
+ value: i,
1749
+ rows: f,
1750
+ cols: x,
1751
+ minLength: v,
1752
+ maxLength: k,
1753
+ placeholder: m,
1754
+ readOnly: A,
1755
+ disabled: y,
1756
+ required: s,
1757
+ autoComplete: R,
1758
+ onChange: L,
1759
+ ...z
1760
+ }
1761
+ )
1762
+ }
1763
+ );
1764
+ }
1765
+ );
1766
+ it.displayName = "TextArea";
1767
+ const Ft = {
1768
+ Checkbox: ze,
1769
+ Switch: He,
1770
+ InputField: Se,
1771
+ FileUpload: tt,
1772
+ InputLabel: Pe,
1773
+ RadioButton: rt,
1774
+ RadioGroup: st,
1775
+ Select: ot,
1776
+ TextArea: it,
1777
+ Empty: "div"
1778
+ }, Wt = (e, t) => {
1779
+ const { as: a, name: r, ...c } = e, s = (i) => {
1780
+ t(r, i);
1781
+ }, n = Ft[a] || Se;
1782
+ return /* @__PURE__ */ o(
1783
+ D,
1784
+ {
1785
+ as: n,
1786
+ ...c,
1787
+ name: r,
1788
+ isFullWidth: !0,
1789
+ onChange: s
1790
+ }
1791
+ );
1792
+ }, zt = (e, t, a) => {
1793
+ const r = e.map((c, s) => {
1794
+ const {
1795
+ desktopSpan: n,
1796
+ tabletLandscapeSpan: i,
1797
+ tabletPortraitSpan: l,
1798
+ mobileSpan: d,
1799
+ isHorizontal: u,
1800
+ ...p
1801
+ } = c;
1802
+ return /* @__PURE__ */ xt(at, { ...{
1803
+ desktopSpan: n,
1804
+ tabletLandscapeSpan: i,
1805
+ tabletPortraitSpan: l,
1806
+ mobileSpan: d,
1807
+ isHorizontal: u
1808
+ }, key: `${c.name}-${s}` }, Wt(p, t));
1809
+ });
1810
+ return /* @__PURE__ */ o(nt, { gutters: a, children: r });
1811
+ }, Ht = N.forwardRef(
1812
+ ({ spacing: e = "small", fields: t, onFieldsChange: a, children: r, errorText: c, ...s }, n) => {
1813
+ let i = [];
1814
+ e && i.push(`spacing-${e}`);
1815
+ const l = (u, p) => {
1816
+ a && a({
1817
+ [u]: p
1818
+ });
1819
+ }, d = t != null && t.length ? zt(t, l, e) : r;
1820
+ return /* @__PURE__ */ I(
1821
+ D,
1822
+ {
1823
+ as: "form",
1824
+ "data-form": !0,
1825
+ ref: n,
1826
+ classNames: i,
1827
+ ...s,
1828
+ children: [
1829
+ d,
1830
+ c && /* @__PURE__ */ o(Ze, { kind: "error", children: c })
1831
+ ]
1832
+ }
1833
+ );
1834
+ }
1835
+ );
1836
+ Ht.displayName = "Form";
1837
+ const _t = N.forwardRef(
1838
+ ({
1839
+ isJoint: e,
1840
+ equalWidthForChildren: t,
1841
+ retainLayout: a,
1842
+ children: r,
1843
+ legend: c,
1844
+ id: s,
1845
+ ...n
1846
+ }, i) => {
1847
+ const l = s || `form-group-${Math.random().toString(36).substring(2, 9)}`;
1848
+ let d = [];
1849
+ return e && d.push("is-joint"), t && d.push("equal-width-for-children"), a && d.push("retain-layout"), /* @__PURE__ */ o(
1850
+ D,
1851
+ {
1852
+ as: "div",
1853
+ "data-form-item-group": !0,
1854
+ ref: i,
1855
+ id: l,
1856
+ role: "group",
1857
+ "aria-label": c,
1858
+ classNames: d,
1859
+ ...n,
1860
+ children: r
1861
+ }
1862
+ );
1863
+ }
1864
+ );
1865
+ _t.displayName = "FormItemGroup";
1866
+ const Gt = (e, t) => {
1867
+ const a = [], r = e.length, c = t.length;
1868
+ if (r === 0) return c;
1869
+ if (c === 0) return r;
1870
+ for (let s = 0; s <= c; s++)
1871
+ a[s] = [s];
1872
+ for (let s = 0; s <= r; s++)
1873
+ a[0][s] = s;
1874
+ for (let s = 1; s <= c; s++)
1875
+ for (let n = 1; n <= r; n++)
1876
+ t[s - 1] === e[n - 1] ? a[s][n] = a[s - 1][n - 1] : a[s][n] = Math.min(
1877
+ a[s - 1][n] + 1,
1878
+ // Deletion
1879
+ a[s][n - 1] + 1,
1880
+ // Insertion
1881
+ a[s - 1][n - 1] + 1
1882
+ // Substitution
1883
+ );
1884
+ return a[c][r];
1885
+ }, Kt = (e, t) => {
1886
+ let a = 0, r = 0;
1887
+ for (; a < e.length && r < t.length; )
1888
+ e[a] === t[r] && a++, r++;
1889
+ return a === e.length;
1890
+ }, jt = (e) => e.split(/[\s\-_]+/).map((t) => t.slice(0, 2)).join("").toLowerCase(), Xt = (e, t) => {
1891
+ if (!t) return e;
1892
+ const a = t.toLowerCase().trim(), r = Math.floor(a.length / 2);
1893
+ return e.map((s) => {
1894
+ const n = s.label.toLowerCase(), i = Gt(a, n), l = n.split(/[\s\-_]+/), d = a.split(/[\s\-_]+/), u = n.includes(a) || d.every(
1895
+ (x) => l.some((v) => v.startsWith(x))
1896
+ ), p = jt(n), f = Kt(a, p);
1897
+ return {
1898
+ option: s,
1899
+ distance: i,
1900
+ isPartialMatch: u,
1901
+ isAcronymMatch: f
1902
+ };
1903
+ }).filter(
1904
+ ({ distance: s, isPartialMatch: n, isAcronymMatch: i }) => n || i || s <= r
1905
+ ).sort((s, n) => s.isPartialMatch && !n.isPartialMatch ? -1 : !s.isPartialMatch && n.isPartialMatch ? 1 : s.isAcronymMatch && !n.isAcronymMatch ? -1 : !s.isAcronymMatch && n.isAcronymMatch ? 1 : s.distance - n.distance).map(({ option: s }) => s);
1906
+ }, Ut = N.forwardRef(
1907
+ ({
1908
+ options: e = [],
1909
+ label: t,
1910
+ helpText: a,
1911
+ errorText: r,
1912
+ placeholder: c = "Select an option",
1913
+ id: s,
1914
+ defaultValue: n,
1915
+ onChange: i,
1916
+ disabled: l,
1917
+ selectionLimit: d,
1918
+ allowMultiSelect: u = !1,
1919
+ allowCustomEntries: p = !1,
1920
+ isLoading: f,
1921
+ value: x,
1922
+ isFullWidth: v,
1923
+ className: k,
1924
+ required: m,
1925
+ size: A,
1926
+ ...y
1927
+ }, R) => {
1928
+ const [T, V] = j(!1), [F, E] = j(""), [P, b] = j(-1), [L, _] = j(null), [S, w] = j([]), [z, C] = j(!1);
1929
+ q(() => {
1930
+ n && i && i(n);
1931
+ }, []);
1932
+ const B = N.useMemo(() => [...e], [e]), g = Y(null), $ = Y(null), h = Y(null), M = s || `listbox-${Math.random().toString(36).substring(2, 9)}`, O = Xt(B, F), H = (W) => {
1933
+ if (W.disabled) return;
1934
+ let X;
1935
+ if (u) {
1936
+ if (S.some((se) => se.value === W.value))
1937
+ X = S.filter((se) => se.value !== W.value);
1938
+ else {
1939
+ if (d && S.length >= d)
1940
+ return;
1941
+ X = [...S, W];
1942
+ }
1943
+ w(X), i == null || i(X.map((se) => se.value));
1944
+ } else
1945
+ X = [W], _(W), w(X), i == null || i(W.value), V(!1);
1946
+ E(""), b(-1);
1947
+ }, Z = (W) => {
1948
+ E(W);
1949
+ }, le = () => {
1950
+ if (!F.trim() || !p) return;
1951
+ const W = F.trim(), X = {
1952
+ value: W,
1953
+ label: W
1954
+ };
1955
+ B.some((Q) => Q.value === W) || H(X);
1956
+ }, te = (W) => {
1957
+ if (u) {
1958
+ const X = S.filter((Q) => Q.value !== W);
1959
+ w(X), i == null || i(X.map((Q) => Q.value));
1960
+ } else
1961
+ _(null), w([]), i == null || i("");
1962
+ }, ae = () => {
1963
+ _(null), w([]), i == null || i(u ? [] : "");
1964
+ }, re = (W) => {
1965
+ switch (W.key) {
1966
+ case "ArrowDown":
1967
+ W.preventDefault(), T ? b(
1968
+ (X) => X < O.length - 1 ? X + 1 : X
1969
+ ) : (V(!0), b(0));
1970
+ break;
1971
+ case "ArrowUp":
1972
+ W.preventDefault(), b((X) => X > 0 ? X - 1 : X);
1973
+ break;
1974
+ case "Enter":
1975
+ if (W.preventDefault(), p && F.trim()) {
1976
+ const X = O.find(
1977
+ (Q) => Q.label.toLowerCase() === F.trim().toLowerCase()
1978
+ );
1979
+ X ? H(X) : le();
1980
+ } else P >= 0 && O[P] && H(O[P]);
1981
+ break;
1982
+ case "Escape":
1983
+ W.preventDefault(), V(!1), b(-1);
1984
+ break;
1985
+ case " ":
1986
+ T || (W.preventDefault(), V(!0), b(0));
1987
+ break;
1988
+ case "Home":
1989
+ T && (W.preventDefault(), b(0));
1990
+ break;
1991
+ case "End":
1992
+ T && (W.preventDefault(), b(O.length - 1));
1993
+ break;
1994
+ }
1995
+ };
1996
+ Fe(g, () => {
1997
+ V(!1), b(-1);
1998
+ }), q(() => {
1999
+ T && $.current && $.current.focus();
2000
+ }, [T]), q(() => {
2001
+ if (T && g.current) {
2002
+ const W = g.current.getBoundingClientRect(), X = window.innerHeight, Q = 300, se = X - W.bottom, xe = W.top;
2003
+ C(se < Q && xe > se);
2004
+ } else
2005
+ C(!1);
2006
+ }, [T]), q(() => {
2007
+ if (P >= 0) {
2008
+ const W = document.querySelector(`[data-index="${P}"]`);
2009
+ W == null || W.scrollIntoView({ block: "nearest" });
2010
+ }
2011
+ }, [P]);
2012
+ const { wrapperProps: $e, inputProps: we } = ie(y);
2013
+ return /* @__PURE__ */ o(
2014
+ ee,
2015
+ {
2016
+ label: t,
2017
+ htmlFor: s,
2018
+ helpText: a,
2019
+ errorText: r,
2020
+ required: m,
2021
+ isFullWidth: v,
2022
+ size: A,
2023
+ ...$e,
2024
+ children: /* @__PURE__ */ I(
2025
+ D,
2026
+ {
2027
+ as: "div",
2028
+ "data-list-box": !0,
2029
+ classNames: ["list-box-wrapper", l ? "disabled" : "", k || ""],
2030
+ ref: g,
2031
+ isFullWidth: v,
2032
+ ...we,
2033
+ children: [
2034
+ /* @__PURE__ */ I(
2035
+ K,
2036
+ {
2037
+ className: "list-box-input-wrapper",
2038
+ onClick: () => !l && V(!T),
2039
+ role: "combobox",
2040
+ "aria-haspopup": "listbox",
2041
+ "aria-expanded": T,
2042
+ "aria-controls": `${M}-listbox`,
2043
+ "aria-owns": `${M}-listbox`,
2044
+ tabIndex: l ? -1 : 0,
2045
+ children: [
2046
+ u ? /* @__PURE__ */ I(Ee, { children: [
2047
+ S.length > 0 ? /* @__PURE__ */ I(K, { className: "options-wrapper", children: [
2048
+ /* @__PURE__ */ o(K, { className: "options-list", children: S.map((W) => /* @__PURE__ */ o(
2049
+ Oe,
2050
+ {
2051
+ actionIcon: "cross",
2052
+ onActionClick: () => te(W.value),
2053
+ actionAriaLabel: `Remove ${W.label}`,
2054
+ size: "small",
2055
+ shape: "rounded",
2056
+ children: /* @__PURE__ */ o(J, { children: W.label })
2057
+ },
2058
+ W.value
2059
+ )) }),
2060
+ d && S.length >= d && /* @__PURE__ */ I(J, { className: "options-limit-warning", textColour: "red", size: "tiny", children: [
2061
+ "You can choose only ",
2062
+ d,
2063
+ " option",
2064
+ d === 1 ? "" : "s"
2065
+ ] })
2066
+ ] }) : /* @__PURE__ */ o("span", { className: "placeholder", children: c }),
2067
+ S.length > 0 && /* @__PURE__ */ o(
2068
+ K,
2069
+ {
2070
+ className: "icon-wrapper clear-all",
2071
+ title: "Clear all options",
2072
+ onClick: () => ae(),
2073
+ children: /* @__PURE__ */ I("svg", { viewBox: "0 0 24 24", children: [
2074
+ /* @__PURE__ */ o("line", { x1: "5", y1: "5", x2: "19", y2: "19" }),
2075
+ /* @__PURE__ */ o("line", { x1: "5", y1: "19", x2: "19", y2: "5" })
2076
+ ] })
2077
+ }
2078
+ )
2079
+ ] }) : S[0] ? /* @__PURE__ */ o(J, { className: "selected-option", children: S[0].label }) : /* @__PURE__ */ o("span", { className: "placeholder", children: c }),
2080
+ /* @__PURE__ */ o(K, { className: "icon-wrapper chevrons", children: /* @__PURE__ */ I("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", children: [
2081
+ /* @__PURE__ */ o("polyline", { points: "6 9 12 4 18 9" }),
2082
+ /* @__PURE__ */ o("polyline", { points: "6 15 12 20 18 15" })
2083
+ ] }) })
2084
+ ]
2085
+ }
2086
+ ),
2087
+ T && !l && /* @__PURE__ */ I(
2088
+ K,
2089
+ {
2090
+ ref: h,
2091
+ className: `list-box-dropdown${z ? " opens-upward" : ""}`,
2092
+ children: [
2093
+ /* @__PURE__ */ I(K, { className: "list-box-search-wrapper", children: [
2094
+ /* @__PURE__ */ o(
2095
+ Se,
2096
+ {
2097
+ type: "text",
2098
+ ref: $,
2099
+ className: "list-box-search",
2100
+ placeholder: p ? "Type to search or add new" : "Search",
2101
+ value: F,
2102
+ onChange: Z,
2103
+ onKeyDown: re,
2104
+ "aria-controls": `${M}-listbox`,
2105
+ "aria-label": "Search options",
2106
+ isFullWidth: !0
2107
+ }
2108
+ ),
2109
+ p && F.trim() && !S.some((W) => W.label.toLowerCase() === F.trim().toLowerCase()) && /* @__PURE__ */ o(
2110
+ "kbd",
2111
+ {
2112
+ className: "list-box-enter-key",
2113
+ "aria-label": "Press Enter to add custom option",
2114
+ children: "↵"
2115
+ }
2116
+ )
2117
+ ] }),
2118
+ /* @__PURE__ */ o(
2119
+ D,
2120
+ {
2121
+ as: "ul",
2122
+ id: `${M}-listbox`,
2123
+ className: "list-box-options",
2124
+ role: "listbox",
2125
+ "aria-multiselectable": u,
2126
+ "aria-busy": f,
2127
+ tabIndex: -1,
2128
+ children: O.length > 0 ? O.map((W, X) => /* @__PURE__ */ o(
2129
+ "li",
2130
+ {
2131
+ id: `${M}-option-${W.value}`,
2132
+ className: `list-box-option ${W.disabled ? "disabled" : ""} ${P === X ? "active" : ""}`,
2133
+ role: "option",
2134
+ "aria-selected": S.some((Q) => Q.value === W.value),
2135
+ "aria-disabled": W.disabled,
2136
+ onClick: () => H(W),
2137
+ "data-index": X,
2138
+ tabIndex: -1,
2139
+ children: W.customLabel || W.label
2140
+ },
2141
+ W.value
2142
+ )) : /* @__PURE__ */ o(
2143
+ "li",
2144
+ {
2145
+ className: "list-box-option disabled",
2146
+ role: "alert",
2147
+ "aria-live": "polite",
2148
+ children: p ? "Type and press Enter to add new option" : "No matches found"
2149
+ }
2150
+ )
2151
+ }
2152
+ )
2153
+ ]
2154
+ }
2155
+ )
2156
+ ]
2157
+ }
2158
+ )
2159
+ }
2160
+ );
2161
+ }
2162
+ );
2163
+ Ut.displayName = "ListBox";
2164
+ function Xe(e, t) {
2165
+ return (t === "alphanumeric" ? /^[a-zA-Z0-9]+$/i : /^[0-9]+$/).test(e);
2166
+ }
2167
+ const qt = N.forwardRef(
2168
+ ({
2169
+ numberOfFields: e,
2170
+ onChange: t,
2171
+ type: a = "number",
2172
+ mask: r = !1,
2173
+ isOTP: c = !1,
2174
+ autoFocus: s = !1,
2175
+ pasteFromClipboard: n = "enabled",
2176
+ focusFirstInputOnReset: i = !0,
2177
+ isFullWidth: l,
2178
+ ariaLabel: d,
2179
+ ...u
2180
+ }, p) => {
2181
+ const f = Y(null), [x, v] = j([]), [k, m] = j([]), [A, y] = j(!0), [R, T] = j(-1), V = u.id || `pin-input-${Math.random().toString(36).substring(2, 9)}`, F = d || "Enter verification code", E = G(
2182
+ (B) => {
2183
+ var $;
2184
+ const g = x[B];
2185
+ ($ = g == null ? void 0 : g.current) == null || $.focus();
2186
+ },
2187
+ [x]
2188
+ ), P = G(
2189
+ (B) => {
2190
+ if (!A) return;
2191
+ const g = B + 1 < e ? B + 1 : null;
2192
+ g && E(g);
2193
+ },
2194
+ [E, e, A]
2195
+ ), b = G(() => {
2196
+ m(Array(e).fill("")), t == null || t(""), i && (E(0), T(0));
2197
+ }, [e, t, E, i]), L = G(
2198
+ (B, g) => {
2199
+ const $ = [...k];
2200
+ $[g] = B, m($), t == null || t($.join("")), B !== "" && $.length === e && $.every((M) => M != null && M !== "") && g === e - 1 || (y(!0), P(g));
2201
+ },
2202
+ [P, e, t, k]
2203
+ ), _ = G((B, g) => {
2204
+ var M;
2205
+ const $ = typeof B == "string" ? B : B.target.value, h = k[g];
2206
+ if ($ === "") {
2207
+ L("", g);
2208
+ return;
2209
+ }
2210
+ if ($.length > 1 && g < e - 1) {
2211
+ if (Xe($, a)) {
2212
+ let O = [];
2213
+ const H = $.split("");
2214
+ h === "" ? O = H.filter((te, ae) => g + ae < e) : ((M = x[g].current) == null ? void 0 : M.selectionEnd) === $.length ? O = H.filter((ae, re) => re > 0 && g + re - 1 < e) : O = H.filter((ae, re) => re < $.length - 1 && g + re < e);
2215
+ const Z = k.map(
2216
+ (te, ae) => ae >= g && ae < g + O.length ? O[ae - g] : te
2217
+ );
2218
+ m(Z), t == null || t(Z.join(""));
2219
+ const le = Math.min(g + O.length, e - 1);
2220
+ E(le);
2221
+ }
2222
+ } else {
2223
+ let O = $;
2224
+ (h == null ? void 0 : h.length) > 0 && (O = $.charAt($.length - 1)), Xe(O, a) && L(O, g);
2225
+ }
2226
+ }, [e, t, L, a, k, E, x]), S = G((B, g) => {
2227
+ var $;
2228
+ if (B.key === "Backspace")
2229
+ if (B.target.value === "") {
2230
+ if (g > 0) {
2231
+ const h = g - 1;
2232
+ L("", h), E(h), y(!0);
2233
+ }
2234
+ } else
2235
+ y(!1);
2236
+ else B.key === "Escape" ? (($ = x[g].current) == null || $.blur(), C()) : B.key === "ArrowRight" ? g < e - 1 && E(g + 1) : B.key === "ArrowLeft" && g > 0 && E(g - 1);
2237
+ }, [E, L, x, e]), w = G((B, g) => {
2238
+ T(g);
2239
+ }, []), z = G((B) => {
2240
+ const g = B.target;
2241
+ setTimeout(() => {
2242
+ g.setSelectionRange(g.value.length, g.value.length);
2243
+ }, 0);
2244
+ }, []), C = G(() => {
2245
+ T(-1);
2246
+ }, []);
2247
+ return q(() => {
2248
+ v((B) => Array(e).fill(0).map(($, h) => {
2249
+ var O;
2250
+ const M = B[h] || Rt();
2251
+ return s && h === 0 && ((O = M.current) == null || O.focus()), M;
2252
+ }));
2253
+ }, [e, s]), Je(
2254
+ p,
2255
+ () => ({
2256
+ ...f.current,
2257
+ reset: b
2258
+ }),
2259
+ [b]
2260
+ ), /* @__PURE__ */ o(
2261
+ K,
2262
+ {
2263
+ "data-pin-input-field": !0,
2264
+ ref: f,
2265
+ classNames: l ? ["full-width"] : [],
2266
+ role: "group",
2267
+ "aria-label": F,
2268
+ "aria-required": u.required,
2269
+ ...u,
2270
+ children: Array.from({ length: e }, (B, g) => /* @__PURE__ */ o(
2271
+ Se,
2272
+ {
2273
+ id: `${V}-${g}`,
2274
+ ref: x[g],
2275
+ type: r ? "password" : a === "number" ? "tel" : "text",
2276
+ inputMode: a === "number" ? "numeric" : "text",
2277
+ onChange: ($) => _($, g),
2278
+ onKeyDown: ($) => S($, g),
2279
+ onFocus: ($) => w($, g),
2280
+ onSelect: z,
2281
+ onBlur: C,
2282
+ placeholder: R !== g ? "⦁" : void 0,
2283
+ autoComplete: c ? "one-time-code" : "off",
2284
+ value: k[g] || "",
2285
+ autoFocus: s && g === 0,
2286
+ onCopy: ($) => n === "disabled" && $.preventDefault(),
2287
+ onPaste: ($) => n === "disabled" && $.preventDefault(),
2288
+ "aria-label": `Digit ${g + 1} of ${e}`,
2289
+ "aria-required": u.required
2290
+ },
2291
+ g
2292
+ ))
2293
+ }
2294
+ );
2295
+ }
2296
+ );
2297
+ qt.displayName = "PinInputField";
2298
+ const Yt = N.forwardRef(
2299
+ ({
2300
+ id: e,
2301
+ name: t,
2302
+ label: a,
2303
+ helpText: r,
2304
+ errorText: c,
2305
+ options: s,
2306
+ defaultValue: n,
2307
+ value: i,
2308
+ required: l,
2309
+ onChange: d,
2310
+ size: u = "medium",
2311
+ bgColour: p,
2312
+ disabled: f,
2313
+ ...x
2314
+ }, v) => {
2315
+ const k = ye(() => t || e, [t, e]), m = Y(null), [A, y] = j({
2316
+ width: 0,
2317
+ transform: "translateX(0)"
2318
+ }), [R, T] = j(!1), [V, F] = j(0), [E, P] = j(0), b = Y([]), L = G(() => {
2319
+ if (!m.current) return;
2320
+ const $ = m.current, h = $.closest("[data-input-wrapper]");
2321
+ if ($ && h) {
2322
+ const M = $.scrollWidth, O = h.clientWidth, H = M > O;
2323
+ T(H), P(H ? M - O : 0);
2324
+ }
2325
+ }, []);
2326
+ q(() => {
2327
+ const $ = m.current;
2328
+ if (!$) return;
2329
+ L();
2330
+ const h = new ResizeObserver(() => {
2331
+ L();
2332
+ });
2333
+ return h.observe($), $.closest("[data-input-wrapper]") && h.observe($.closest("[data-input-wrapper]")), () => h.disconnect();
2334
+ }, [L]), q(() => {
2335
+ const $ = s.findIndex((h) => h.value === i);
2336
+ if ($ >= 0) {
2337
+ const h = () => {
2338
+ const M = b.current[$];
2339
+ if (M) {
2340
+ const O = M.offsetWidth;
2341
+ let H = "translateX(0)";
2342
+ $ > 0 && (H = `translateX(${b.current.slice(0, $).reduce((le, te) => le + ((te == null ? void 0 : te.offsetWidth) || 0), 0)}px)`), y({ width: O, transform: H });
2343
+ }
2344
+ };
2345
+ if (document.fonts && document.fonts.ready)
2346
+ document.fonts.ready.then(() => {
2347
+ requestAnimationFrame(() => {
2348
+ requestAnimationFrame(h);
2349
+ });
2350
+ });
2351
+ else {
2352
+ const M = setTimeout(h, 100);
2353
+ return () => clearTimeout(M);
2354
+ }
2355
+ }
2356
+ }, [i, s]);
2357
+ const _ = ($) => {
2358
+ d == null || d($.target.value);
2359
+ }, { wrapperProps: S, inputProps: w } = ie(x), z = G(($) => {
2360
+ const h = m.current;
2361
+ if (!h) return;
2362
+ const O = h.clientWidth * 0.8;
2363
+ let H = $ === "right" ? Math.min(V + O, E) : Math.max(V - O, 0);
2364
+ F(H), requestAnimationFrame(() => {
2365
+ h.style.transform = `translateX(-${H}px)`;
2366
+ });
2367
+ }, [V, E]), C = V > 0, B = V < E, g = [];
2368
+ return u && g.push(`size-${u}`), /* @__PURE__ */ o(
2369
+ ee,
2370
+ {
2371
+ label: a,
2372
+ htmlFor: e,
2373
+ helpText: r,
2374
+ errorText: c,
2375
+ required: l,
2376
+ size: u,
2377
+ ...S,
2378
+ children: /* @__PURE__ */ I(
2379
+ D,
2380
+ {
2381
+ as: "div",
2382
+ "data-radio-tab-group": !0,
2383
+ ref: v,
2384
+ classNames: g,
2385
+ name: k,
2386
+ ...w,
2387
+ children: [
2388
+ R && C && /* @__PURE__ */ o(
2389
+ K,
2390
+ {
2391
+ className: "scroll-button left",
2392
+ onClick: () => z("left"),
2393
+ children: /* @__PURE__ */ o("svg", { viewBox: "0 0 24 24", children: /* @__PURE__ */ o("polyline", { points: "15 18 9 12 15 6" }) })
2394
+ }
2395
+ ),
2396
+ /* @__PURE__ */ I(K, { className: "rtg-options-container", children: [
2397
+ /* @__PURE__ */ I(
2398
+ K,
2399
+ {
2400
+ className: "rtg-options-wrapper",
2401
+ ref: m,
2402
+ children: [
2403
+ /* @__PURE__ */ o(
2404
+ K,
2405
+ {
2406
+ className: "indicator",
2407
+ style: {
2408
+ width: `${A.width}px`,
2409
+ transform: A.transform
2410
+ }
2411
+ }
2412
+ ),
2413
+ s.map(($, h) => {
2414
+ const { id: M, ...O } = $, H = M || `${e}-option-${h}`;
2415
+ return /* @__PURE__ */ I(N.Fragment, { children: [
2416
+ /* @__PURE__ */ o(
2417
+ "input",
2418
+ {
2419
+ type: "radio",
2420
+ ...O,
2421
+ id: H,
2422
+ name: k,
2423
+ checked: i === $.value,
2424
+ disabled: f || $.disabled,
2425
+ onChange: _
2426
+ }
2427
+ ),
2428
+ /* @__PURE__ */ o(
2429
+ "label",
2430
+ {
2431
+ ref: (Z) => {
2432
+ b.current[h] = Z;
2433
+ },
2434
+ htmlFor: H,
2435
+ children: $.label
2436
+ }
2437
+ )
2438
+ ] }, H);
2439
+ })
2440
+ ]
2441
+ }
2442
+ ),
2443
+ R && B && /* @__PURE__ */ o(
2444
+ K,
2445
+ {
2446
+ className: "scroll-button right",
2447
+ onClick: () => z("right"),
2448
+ children: /* @__PURE__ */ o("svg", { viewBox: "0 0 24 24", children: /* @__PURE__ */ o("polyline", { points: "9 6 15 12 9 18" }) })
2449
+ }
2450
+ )
2451
+ ] })
2452
+ ]
2453
+ }
2454
+ )
2455
+ }
2456
+ );
2457
+ }
2458
+ );
2459
+ Yt.displayName = "RadioTabGroup";
2460
+ function Jt(e) {
2461
+ return Array.isArray(e.value);
2462
+ }
2463
+ const Zt = N.forwardRef(
2464
+ (e, t) => Jt(e) ? /* @__PURE__ */ o(ct, { ...e, forwardedRef: t }) : /* @__PURE__ */ o(lt, { ...e, forwardedRef: t })
2465
+ );
2466
+ Zt.displayName = "Range";
2467
+ const lt = ({
2468
+ label: e,
2469
+ helpText: t,
2470
+ errorText: a,
2471
+ value: r = 0,
2472
+ suffix: c,
2473
+ onChange: s,
2474
+ min: n = 0,
2475
+ max: i = 100,
2476
+ step: l = 1,
2477
+ id: d,
2478
+ disabled: u,
2479
+ size: p,
2480
+ ...f
2481
+ }) => {
2482
+ const { wrapperProps: x } = ie(f), v = Y(null), k = Y(null), [m, A] = j(!1), [y, R] = j(!1), T = Math.max(n, Math.min(i, r)), V = G((S) => i <= n ? 0 : (Math.max(n, Math.min(i, S)) - n) / (i - n) * 100, [n, i]), F = G((S) => {
2483
+ if (!k.current) return n;
2484
+ const w = k.current.getBoundingClientRect(), z = Math.max(0, Math.min(1, (S - w.left) / w.width)), C = n + z * (i - n), B = Math.round(C / l) * l;
2485
+ return Math.max(n, Math.min(i, B));
2486
+ }, [n, i, l]), E = G((S) => {
2487
+ const w = F(S);
2488
+ s == null || s(w);
2489
+ }, [F, s]), P = G((S) => {
2490
+ u || (S.preventDefault(), A(!0), R(!0), E(S.clientX));
2491
+ }, [u, E]);
2492
+ q(() => {
2493
+ if (!m) return;
2494
+ const S = (z) => {
2495
+ E(z.clientX);
2496
+ }, w = () => {
2497
+ A(!1);
2498
+ };
2499
+ return document.addEventListener("mousemove", S), document.addEventListener("mouseup", w), () => {
2500
+ document.removeEventListener("mousemove", S), document.removeEventListener("mouseup", w);
2501
+ };
2502
+ }, [m, E]);
2503
+ const b = G((S) => {
2504
+ u || (A(!0), R(!0), E(S.touches[0].clientX));
2505
+ }, [u, E]);
2506
+ q(() => {
2507
+ if (!m) return;
2508
+ const S = (z) => {
2509
+ z.preventDefault(), E(z.touches[0].clientX);
2510
+ }, w = () => {
2511
+ A(!1);
2512
+ };
2513
+ return document.addEventListener("touchmove", S, { passive: !1 }), document.addEventListener("touchend", w), () => {
2514
+ document.removeEventListener("touchmove", S), document.removeEventListener("touchend", w);
2515
+ };
2516
+ }, [m, E]);
2517
+ const L = G((S) => {
2518
+ if (u) return;
2519
+ let w = T;
2520
+ switch (S.key) {
2521
+ case "ArrowRight":
2522
+ case "ArrowUp":
2523
+ S.preventDefault(), w = Math.min(T + l, i);
2524
+ break;
2525
+ case "ArrowLeft":
2526
+ case "ArrowDown":
2527
+ S.preventDefault(), w = Math.max(T - l, n);
2528
+ break;
2529
+ case "Home":
2530
+ S.preventDefault(), w = n;
2531
+ break;
2532
+ case "End":
2533
+ S.preventDefault(), w = i;
2534
+ break;
2535
+ case "PageUp":
2536
+ S.preventDefault(), w = Math.min(T + l * 10, i);
2537
+ break;
2538
+ case "PageDown":
2539
+ S.preventDefault(), w = Math.max(T - l * 10, n);
2540
+ break;
2541
+ default:
2542
+ return;
2543
+ }
2544
+ s == null || s(w);
2545
+ }, [u, T, n, i, l, s]), _ = V(T);
2546
+ return /* @__PURE__ */ o(
2547
+ ee,
2548
+ {
2549
+ customLabel: e && /* @__PURE__ */ I(K, { "data-range-meta": !0, children: [
2550
+ /* @__PURE__ */ o(
2551
+ Pe,
2552
+ {
2553
+ className: "range-label",
2554
+ label: e,
2555
+ htmlFor: d
2556
+ }
2557
+ ),
2558
+ /* @__PURE__ */ I(J, { className: "range-value", children: [
2559
+ T,
2560
+ c && c
2561
+ ] })
2562
+ ] }),
2563
+ helpText: t,
2564
+ errorText: a,
2565
+ size: p,
2566
+ ...x,
2567
+ children: /* @__PURE__ */ I(
2568
+ K,
2569
+ {
2570
+ ref: k,
2571
+ "data-range-single": !0,
2572
+ className: u ? "disabled" : "",
2573
+ role: "group",
2574
+ "aria-labelledby": e ? `${d}-label` : void 0,
2575
+ children: [
2576
+ /* @__PURE__ */ o(K, { className: "range-track", "aria-hidden": "true" }),
2577
+ /* @__PURE__ */ o(
2578
+ K,
2579
+ {
2580
+ className: "range-track-fill",
2581
+ style: {
2582
+ left: "0%",
2583
+ right: `${100 - _}%`
2584
+ },
2585
+ "aria-hidden": "true"
2586
+ }
2587
+ ),
2588
+ /* @__PURE__ */ o(
2589
+ "button",
2590
+ {
2591
+ ref: v,
2592
+ id: d,
2593
+ type: "button",
2594
+ className: "range-thumb",
2595
+ style: { left: `${_}%` },
2596
+ disabled: u,
2597
+ onMouseDown: P,
2598
+ onTouchStart: b,
2599
+ onKeyDown: L,
2600
+ onFocus: () => R(!0),
2601
+ onBlur: () => R(!1),
2602
+ "data-active": y || m,
2603
+ role: "slider",
2604
+ "aria-valuemin": n,
2605
+ "aria-valuemax": i,
2606
+ "aria-valuenow": T,
2607
+ "aria-valuetext": `${T}${c ? ` ${c}` : ""}`,
2608
+ "aria-orientation": "horizontal"
2609
+ }
2610
+ )
2611
+ ]
2612
+ }
2613
+ )
2614
+ }
2615
+ );
2616
+ };
2617
+ lt.displayName = "SingleThumbRange";
2618
+ const ct = ({
2619
+ label: e,
2620
+ helpText: t,
2621
+ errorText: a,
2622
+ value: r = [0, 100],
2623
+ suffix: c,
2624
+ onChange: s,
2625
+ min: n = 0,
2626
+ max: i = 100,
2627
+ step: l = 1,
2628
+ minLabel: d = "Minimum value",
2629
+ maxLabel: u = "Maximum value",
2630
+ id: p,
2631
+ disabled: f,
2632
+ size: x,
2633
+ ...v
2634
+ }) => {
2635
+ const { wrapperProps: k } = ie(v), [m, A] = r, y = Math.max(n, Math.min(i, m)), R = Math.max(n, Math.min(i, A)), T = Y(null), V = Y(null), F = Y(null), [E, P] = j(null), [b, L] = j(null), _ = G((h) => i <= n ? 0 : (Math.max(n, Math.min(i, h)) - n) / (i - n) * 100, [n, i]), S = G((h) => {
2636
+ if (!F.current) return n;
2637
+ const M = F.current.getBoundingClientRect(), O = Math.max(0, Math.min(1, (h - M.left) / M.width)), H = n + O * (i - n), Z = Math.round(H / l) * l;
2638
+ return Math.max(n, Math.min(i, Z));
2639
+ }, [n, i, l]), w = G((h, M) => {
2640
+ const O = S(h);
2641
+ if (M === "min") {
2642
+ const H = Math.min(O, R - l);
2643
+ s == null || s([H, R]);
2644
+ } else {
2645
+ const H = Math.max(O, y + l);
2646
+ s == null || s([y, H]);
2647
+ }
2648
+ }, [S, y, R, l, s]), z = G((h) => (M) => {
2649
+ f || (M.preventDefault(), P(h), L(h), w(M.clientX, h));
2650
+ }, [f, w]);
2651
+ q(() => {
2652
+ if (!E) return;
2653
+ const h = (O) => {
2654
+ w(O.clientX, E);
2655
+ }, M = () => {
2656
+ P(null);
2657
+ };
2658
+ return document.addEventListener("mousemove", h), document.addEventListener("mouseup", M), () => {
2659
+ document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", M);
2660
+ };
2661
+ }, [E, w]);
2662
+ const C = G((h) => (M) => {
2663
+ f || (P(h), L(h), w(M.touches[0].clientX, h));
2664
+ }, [f, w]);
2665
+ q(() => {
2666
+ if (!E) return;
2667
+ const h = (O) => {
2668
+ O.preventDefault(), w(O.touches[0].clientX, E);
2669
+ }, M = () => {
2670
+ P(null);
2671
+ };
2672
+ return document.addEventListener("touchmove", h, { passive: !1 }), document.addEventListener("touchend", M), () => {
2673
+ document.removeEventListener("touchmove", h), document.removeEventListener("touchend", M);
2674
+ };
2675
+ }, [E, w]);
2676
+ const B = G((h) => (M) => {
2677
+ if (f) return;
2678
+ const O = h === "min" ? y : R;
2679
+ let H = O;
2680
+ switch (M.key) {
2681
+ case "ArrowRight":
2682
+ case "ArrowUp":
2683
+ M.preventDefault(), H = Math.min(O + l, i);
2684
+ break;
2685
+ case "ArrowLeft":
2686
+ case "ArrowDown":
2687
+ M.preventDefault(), H = Math.max(O - l, n);
2688
+ break;
2689
+ case "Home":
2690
+ M.preventDefault(), H = h === "min" ? n : y + l;
2691
+ break;
2692
+ case "End":
2693
+ M.preventDefault(), H = h === "max" ? i : R - l;
2694
+ break;
2695
+ case "PageUp":
2696
+ M.preventDefault(), H = Math.min(O + l * 10, i);
2697
+ break;
2698
+ case "PageDown":
2699
+ M.preventDefault(), H = Math.max(O - l * 10, n);
2700
+ break;
2701
+ default:
2702
+ return;
2703
+ }
2704
+ if (h === "min") {
2705
+ const Z = Math.min(H, R - l);
2706
+ s == null || s([Z, R]);
2707
+ } else {
2708
+ const Z = Math.max(H, y + l);
2709
+ s == null || s([y, Z]);
2710
+ }
2711
+ }, [f, y, R, n, i, l, s]), g = _(y), $ = _(R);
2712
+ return /* @__PURE__ */ o(
2713
+ ee,
2714
+ {
2715
+ customLabel: e && /* @__PURE__ */ I(K, { "data-range-meta": !0, children: [
2716
+ /* @__PURE__ */ o(
2717
+ Pe,
2718
+ {
2719
+ className: "range-label",
2720
+ label: e,
2721
+ htmlFor: p
2722
+ }
2723
+ ),
2724
+ /* @__PURE__ */ I(J, { className: "range-value", children: [
2725
+ y,
2726
+ "–",
2727
+ R,
2728
+ c && c
2729
+ ] })
2730
+ ] }),
2731
+ helpText: t,
2732
+ errorText: a,
2733
+ size: x,
2734
+ ...k,
2735
+ children: /* @__PURE__ */ I(
2736
+ K,
2737
+ {
2738
+ ref: F,
2739
+ "data-range-dual": !0,
2740
+ className: f ? "disabled" : "",
2741
+ role: "group",
2742
+ "aria-labelledby": e ? `${p}-label` : void 0,
2743
+ children: [
2744
+ /* @__PURE__ */ o(K, { className: "range-track", "aria-hidden": "true" }),
2745
+ /* @__PURE__ */ o(
2746
+ K,
2747
+ {
2748
+ className: "range-track-fill",
2749
+ style: {
2750
+ left: `${g}%`,
2751
+ right: `${100 - $}%`
2752
+ },
2753
+ "aria-hidden": "true"
2754
+ }
2755
+ ),
2756
+ /* @__PURE__ */ o(
2757
+ "button",
2758
+ {
2759
+ ref: T,
2760
+ id: `${p}-min`,
2761
+ type: "button",
2762
+ className: "range-thumb range-thumb-min",
2763
+ style: { left: `${g}%` },
2764
+ disabled: f,
2765
+ onMouseDown: z("min"),
2766
+ onTouchStart: C("min"),
2767
+ onKeyDown: B("min"),
2768
+ onFocus: () => L("min"),
2769
+ onBlur: () => L(null),
2770
+ "data-active": b === "min" || E === "min",
2771
+ role: "slider",
2772
+ "aria-label": d,
2773
+ "aria-valuemin": n,
2774
+ "aria-valuemax": R - l,
2775
+ "aria-valuenow": y,
2776
+ "aria-valuetext": `${y}${c ? ` ${c}` : ""}`,
2777
+ "aria-orientation": "horizontal"
2778
+ }
2779
+ ),
2780
+ /* @__PURE__ */ o(
2781
+ "button",
2782
+ {
2783
+ ref: V,
2784
+ id: `${p}-max`,
2785
+ type: "button",
2786
+ className: "range-thumb range-thumb-max",
2787
+ style: { left: `${$}%` },
2788
+ disabled: f,
2789
+ onMouseDown: z("max"),
2790
+ onTouchStart: C("max"),
2791
+ onKeyDown: B("max"),
2792
+ onFocus: () => L("max"),
2793
+ onBlur: () => L(null),
2794
+ "data-active": b === "max" || E === "max",
2795
+ role: "slider",
2796
+ "aria-label": u,
2797
+ "aria-valuemin": y + l,
2798
+ "aria-valuemax": i,
2799
+ "aria-valuenow": R,
2800
+ "aria-valuetext": `${R}${c ? ` ${c}` : ""}`,
2801
+ "aria-orientation": "horizontal"
2802
+ }
2803
+ )
2804
+ ]
2805
+ }
2806
+ )
2807
+ }
2808
+ );
2809
+ };
2810
+ ct.displayName = "DualThumbRange";
2811
+ const Qt = N.forwardRef(
2812
+ ({
2813
+ label: e,
2814
+ value: t,
2815
+ height: a,
2816
+ suffix: r,
2817
+ showOptimumMarker: c,
2818
+ ariaLabel: s,
2819
+ description: n,
2820
+ min: i,
2821
+ max: l,
2822
+ low: d,
2823
+ high: u,
2824
+ optimum: p,
2825
+ ...f
2826
+ }, x) => {
2827
+ const v = p ? (p - i) / (l - i) * 100 : 0, k = () => {
2828
+ const y = (t - i) / (l - i) * 100;
2829
+ let R;
2830
+ return t <= d ? R = "Low" : t >= u ? R = "High" : R = "Normal", `Current value is ${t}${r || ""} (${y.toFixed(1)}%). Status: ${R}`;
2831
+ }, { wrapperProps: m, inputProps: A } = ie(f);
2832
+ return /* @__PURE__ */ I(
2833
+ D,
2834
+ {
2835
+ as: "div",
2836
+ role: "region",
2837
+ "aria-label": s || "Meter indicator",
2838
+ ...m,
2839
+ children: [
2840
+ e && /* @__PURE__ */ I(
2841
+ D,
2842
+ {
2843
+ as: "div",
2844
+ "data-meter-meta": !0,
2845
+ id: `meter-label-${e.toLowerCase().replace(/\s+/g, "-")}`,
2846
+ children: [
2847
+ /* @__PURE__ */ o(J, { children: e }),
2848
+ /* @__PURE__ */ I(J, { children: [
2849
+ t,
2850
+ r && r
2851
+ ] })
2852
+ ]
2853
+ }
2854
+ ),
2855
+ /* @__PURE__ */ I(
2856
+ "div",
2857
+ {
2858
+ className: "meter-wrapper",
2859
+ role: "presentation",
2860
+ children: [
2861
+ /* @__PURE__ */ o(
2862
+ D,
2863
+ {
2864
+ as: "meter",
2865
+ "data-meter": !0,
2866
+ ref: x,
2867
+ value: t,
2868
+ min: i,
2869
+ max: l,
2870
+ low: d,
2871
+ high: u,
2872
+ optimum: p,
2873
+ ...A,
2874
+ style: { height: a },
2875
+ "aria-label": e || s || "Progress meter",
2876
+ "aria-valuemin": i,
2877
+ "aria-valuemax": l,
2878
+ "aria-valuenow": t,
2879
+ "aria-valuetext": k(),
2880
+ "aria-describedby": n ? `meter-description-${e == null ? void 0 : e.toLowerCase().replace(/\s+/g, "-")}` : void 0
2881
+ }
2882
+ ),
2883
+ c && p && /* @__PURE__ */ o(
2884
+ "div",
2885
+ {
2886
+ className: "optimum-marker",
2887
+ style: { left: `calc(${v}% - var(--meter-border-width))` },
2888
+ title: `Optimum: ${p}`,
2889
+ role: "presentation",
2890
+ "aria-hidden": "true"
2891
+ }
2892
+ )
2893
+ ]
2894
+ }
2895
+ ),
2896
+ n && /* @__PURE__ */ o(
2897
+ "div",
2898
+ {
2899
+ id: `meter-description-${e == null ? void 0 : e.toLowerCase().replace(/\s+/g, "-")}`,
2900
+ className: "sr-only",
2901
+ children: n
2902
+ }
2903
+ )
2904
+ ]
2905
+ }
2906
+ );
2907
+ }
2908
+ );
2909
+ Qt.displayName = "Meter";
2910
+ const ea = N.forwardRef(
2911
+ ({
2912
+ id: e,
2913
+ children: t,
2914
+ classNames: a = [],
2915
+ isOpen: r = !1,
2916
+ onClose: c,
2917
+ isDismissible: s = !0,
2918
+ showBackdrop: n,
2919
+ blurBackdrop: i,
2920
+ label: l,
2921
+ description: d,
2922
+ ...u
2923
+ }, p) => {
2924
+ const f = `${e}`, x = d ? `${f}-description` : void 0;
2925
+ return n && a.push("show-backdrop"), i && a.push("blur-backdrop"), q(() => {
2926
+ const v = document.querySelector(`#${f}[data-modal]`);
2927
+ if (!(!v || !(v instanceof HTMLElement)))
2928
+ if (r) {
2929
+ v.showPopover();
2930
+ const k = v.querySelectorAll(
2931
+ 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
2932
+ );
2933
+ k.length && k[0].focus();
2934
+ } else
2935
+ v.matches(":popover-open") && v.hidePopover();
2936
+ }, [r, f]), q(() => {
2937
+ const v = document.querySelector(`#${f}[data-modal]`);
2938
+ if (!v || !(v instanceof HTMLElement)) return;
2939
+ const k = (m) => {
2940
+ m.newState === "closed" && r && c && c();
2941
+ };
2942
+ return v.addEventListener("toggle", k), () => v.removeEventListener("toggle", k);
2943
+ }, [f, r, c]), /* @__PURE__ */ I(
2944
+ D,
2945
+ {
2946
+ as: "dialog",
2947
+ id: f,
2948
+ "data-modal": !0,
2949
+ popover: s ? "auto" : "manual",
2950
+ ref: p,
2951
+ classNames: a,
2952
+ role: "dialog",
2953
+ "aria-modal": "true",
2954
+ "aria-label": l || "Modal dialog",
2955
+ "aria-describedby": x,
2956
+ ...u,
2957
+ children: [
2958
+ s && c && /* @__PURE__ */ o(
2959
+ J,
2960
+ {
2961
+ className: "dismiss-button",
2962
+ onClick: c,
2963
+ "aria-label": "Close modal",
2964
+ tabIndex: 0,
2965
+ children: "×"
2966
+ }
2967
+ ),
2968
+ d && /* @__PURE__ */ o("div", { id: x, className: "sr-only", children: d }),
2969
+ /* @__PURE__ */ o("div", { role: "document", children: t })
2970
+ ]
2971
+ }
2972
+ );
2973
+ }
2974
+ );
2975
+ ea.displayName = "Modal";
2976
+ const dt = N.forwardRef(
2977
+ ({
2978
+ position: e = "right",
2979
+ anchor: t = "top",
2980
+ order: a = "new-on-top",
2981
+ kind: r = "list",
2982
+ children: c,
2983
+ label: s,
2984
+ ...n
2985
+ }, i) => {
2986
+ let l = [];
2987
+ return e && l.push(e), t && l.push(t), a && l.push(a), r && l.push(r), N.Children.count(c) === 0 ? null : /* @__PURE__ */ o(
2988
+ D,
2989
+ {
2990
+ as: "section",
2991
+ "data-notifications-wrapper": !0,
2992
+ ref: i,
2993
+ classNames: l,
2994
+ "aria-label": s || "Notifications",
2995
+ "aria-relevant": "additions removals",
2996
+ role: "log",
2997
+ ...n,
2998
+ children: c
2999
+ }
3000
+ );
3001
+ }
3002
+ );
3003
+ dt.displayName = "NotificationsWrapper";
3004
+ const ta = {
3005
+ generic: "status",
3006
+ info: "status",
3007
+ warning: "alert",
3008
+ error: "alert",
3009
+ success: "status"
3010
+ }, ut = ({
3011
+ id: e,
3012
+ kind: t = "generic",
3013
+ duration: a = 4,
3014
+ isDismissible: r = !0,
3015
+ onClose: c,
3016
+ children: s
3017
+ }) => {
3018
+ const [n, i] = j(!1);
3019
+ q(() => {
3020
+ if (a === 0) return;
3021
+ const f = setTimeout(() => {
3022
+ i(!0);
3023
+ }, a * 1e3);
3024
+ return () => clearTimeout(f);
3025
+ }, [a]), q(() => {
3026
+ if (!n) return;
3027
+ const f = setTimeout(() => {
3028
+ c();
3029
+ }, 500);
3030
+ return () => clearTimeout(f);
3031
+ }, [n, c]);
3032
+ const l = (f) => {
3033
+ f.preventDefault(), i(!0);
3034
+ }, d = (f) => {
3035
+ (f.key === "Enter" || f.key === " ") && (f.preventDefault(), i(!0));
3036
+ }, u = () => {
3037
+ n && c();
3038
+ }, p = [t];
3039
+ return r && p.push("dismissible"), n && p.push("dismissed"), /* @__PURE__ */ I(
3040
+ D,
3041
+ {
3042
+ as: "div",
3043
+ "data-notification-item": !0,
3044
+ id: e,
3045
+ classNames: p,
3046
+ onTransitionEnd: u,
3047
+ role: ta[t],
3048
+ "aria-live": t === "error" || t === "warning" ? "assertive" : "polite",
3049
+ "aria-atomic": "true",
3050
+ children: [
3051
+ /* @__PURE__ */ o("div", { className: "notification-content", children: s }),
3052
+ r && /* @__PURE__ */ o(
3053
+ K,
3054
+ {
3055
+ className: "dismiss-button",
3056
+ onClick: l,
3057
+ onKeyDown: d,
3058
+ "aria-label": "Dismiss notification",
3059
+ tabIndex: 0,
3060
+ children: /* @__PURE__ */ o("span", { className: "sr-only", children: "Close notification" })
3061
+ }
3062
+ )
3063
+ ]
3064
+ }
3065
+ );
3066
+ };
3067
+ ut.displayName = "NotificationItem";
3068
+ const ft = Be(null), aa = ({
3069
+ children: e,
3070
+ position: t = "right",
3071
+ anchor: a = "top",
3072
+ order: r = "new-on-top",
3073
+ kind: c = "list"
3074
+ }) => {
3075
+ const [s, n] = j([]), i = G((p) => {
3076
+ n((f) => f.filter((x) => x.id !== p));
3077
+ }, []), l = G((p, f = "generic", x = 4, v = !0) => {
3078
+ const k = `notification-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
3079
+ return n((m) => [...m, {
3080
+ id: k,
3081
+ content: p,
3082
+ kind: f,
3083
+ duration: x,
3084
+ isDismissible: v
3085
+ }]), k;
3086
+ }, []), d = G((p) => {
3087
+ if (typeof p == "string") {
3088
+ l(p);
3089
+ return;
3090
+ }
3091
+ if (p !== null && typeof p == "object" && "content" in p) {
3092
+ const f = p;
3093
+ l(
3094
+ f.content,
3095
+ f.kind ?? "generic",
3096
+ f.duration ?? 4,
3097
+ f.isDismissible ?? !0
3098
+ );
3099
+ return;
3100
+ }
3101
+ l(p);
3102
+ }, [l]), u = G(() => {
3103
+ const p = d;
3104
+ return p.success = (f) => {
3105
+ l(f, "success");
3106
+ }, p.error = (f) => {
3107
+ l(f, "error");
3108
+ }, p.warning = (f) => {
3109
+ l(f, "warning");
3110
+ }, p.info = (f) => {
3111
+ l(f, "info");
3112
+ }, p;
3113
+ }, [d, l])();
3114
+ return /* @__PURE__ */ I(ft.Provider, { value: { notify: u }, children: [
3115
+ e,
3116
+ /* @__PURE__ */ o(
3117
+ dt,
3118
+ {
3119
+ position: t,
3120
+ anchor: a,
3121
+ order: r,
3122
+ kind: c,
3123
+ children: s.map(({ id: p, content: f, kind: x, duration: v, isDismissible: k }) => /* @__PURE__ */ o(
3124
+ ut,
3125
+ {
3126
+ id: p,
3127
+ kind: x,
3128
+ duration: v,
3129
+ isDismissible: k,
3130
+ onClose: () => i(p),
3131
+ children: typeof f == "function" ? f({ close: () => i(p) }) : f
3132
+ },
3133
+ p
3134
+ ))
3135
+ }
3136
+ )
3137
+ ] });
3138
+ };
3139
+ aa.displayName = "NotificationsProvider";
3140
+ const Xa = () => {
3141
+ const e = Ne(ft);
3142
+ if (!e)
3143
+ throw new Error("useNotifications must be used within a NotificationsProvider");
3144
+ return e.notify;
3145
+ }, pt = N.forwardRef(
3146
+ ({
3147
+ size: e = "medium",
3148
+ loadingText: t = "Loading...",
3149
+ ...a
3150
+ }, r) => {
3151
+ let c = [];
3152
+ return e && c.push(`size-${e}`), /* @__PURE__ */ o(
3153
+ D,
3154
+ {
3155
+ as: "div",
3156
+ "data-spinner": !0,
3157
+ ref: r,
3158
+ classNames: c,
3159
+ role: "status",
3160
+ "aria-busy": "true",
3161
+ "aria-live": "polite",
3162
+ "aria-label": t,
3163
+ ...a
3164
+ }
3165
+ );
3166
+ }
3167
+ );
3168
+ pt.displayName = "Spinner";
3169
+ const Ue = (e, t) => {
3170
+ const a = t - e + 1;
3171
+ return Array.from({ length: a }, (r, c) => e + c);
3172
+ }, ra = ({
3173
+ totalItems: e,
3174
+ currentPage: t,
3175
+ itemsToShowEachSide: a
3176
+ }) => {
3177
+ const r = e;
3178
+ return {
3179
+ items: (() => {
3180
+ const s = a * 2 + 1;
3181
+ let n = [];
3182
+ if (r <= s)
3183
+ n = Ue(1, r);
3184
+ else {
3185
+ const i = Math.min(t - 1, a), l = Math.min(r - t, a);
3186
+ n.push(1), t - a > 2 && n.push("...");
3187
+ const d = Math.max(2, t - i), u = Math.min(r - 1, t + l);
3188
+ n.push(...Ue(d, u)), r - t > a + 1 && n.push("..."), u < r && n.push(r);
3189
+ }
3190
+ return n;
3191
+ })(),
3192
+ totalPages: r,
3193
+ rangeStart: t,
3194
+ rangeEnd: t,
3195
+ hasPrevPage: t > 1,
3196
+ hasNextPage: t < r
3197
+ };
3198
+ }, sa = ({
3199
+ type: e,
3200
+ page: t,
3201
+ selected: a,
3202
+ disabled: r,
3203
+ onClick: c,
3204
+ key: s,
3205
+ ...n
3206
+ }) => {
3207
+ if (e === "ellipsis")
3208
+ return /* @__PURE__ */ o(J, { className: "pagination-ellipsis", children: "..." });
3209
+ const i = {
3210
+ type: "button",
3211
+ className: `pagination-item ${a ? "selected" : ""} ${r ? "disabled" : ""}`,
3212
+ onClick: c,
3213
+ disabled: r,
3214
+ ...n
3215
+ };
3216
+ let l;
3217
+ switch (e) {
3218
+ case "first":
3219
+ l = l = /* @__PURE__ */ I("svg", { viewBox: "0 0 24 24", children: [
3220
+ /* @__PURE__ */ o("line", { x1: "5", y1: "18", x2: "5", y2: "6" }),
3221
+ /* @__PURE__ */ o("polyline", { points: "14 18 9 12 14 6" }),
3222
+ /* @__PURE__ */ o("line", { x1: "10", y1: "12", x2: "19", y2: "12" })
3223
+ ] });
3224
+ break;
3225
+ case "previous":
3226
+ l = /* @__PURE__ */ I("svg", { viewBox: "0 0 24 24", children: [
3227
+ /* @__PURE__ */ o("polyline", { points: "12 18 7 12 12 6" }),
3228
+ /* @__PURE__ */ o("line", { x1: "8", y1: "12", x2: "17", y2: "12" })
3229
+ ] });
3230
+ break;
3231
+ case "next":
3232
+ l = l = /* @__PURE__ */ I("svg", { viewBox: "0 0 24 24", children: [
3233
+ /* @__PURE__ */ o("polyline", { points: "12 6 17 12 12 18" }),
3234
+ /* @__PURE__ */ o("line", { x1: "16", y1: "12", x2: "7", y2: "12" })
3235
+ ] });
3236
+ break;
3237
+ case "last":
3238
+ l = l = /* @__PURE__ */ I("svg", { viewBox: "0 0 24 24", children: [
3239
+ /* @__PURE__ */ o("polyline", { points: "10 6 15 12 10 18" }),
3240
+ /* @__PURE__ */ o("line", { x1: "19", y1: "6", x2: "19", y2: "18" }),
3241
+ /* @__PURE__ */ o("line", { x1: "14", y1: "12", x2: "5", y2: "12" })
3242
+ ] });
3243
+ break;
3244
+ default:
3245
+ l = t;
3246
+ }
3247
+ return /* @__PURE__ */ o(
3248
+ We,
3249
+ {
3250
+ kind: "custom",
3251
+ ...i,
3252
+ children: l
3253
+ }
3254
+ );
3255
+ }, na = N.forwardRef(
3256
+ ({
3257
+ totalItems: e,
3258
+ currentPage: t,
3259
+ onPageChange: a,
3260
+ itemsToShowEachSide: r = 1,
3261
+ kind: c = "plain",
3262
+ showGoToFirstItemButton: s = !0,
3263
+ showGoToLastItemButton: n = !0,
3264
+ showPreviousButton: i = !0,
3265
+ showNextButton: l = !0,
3266
+ showGoToInput: d = !1,
3267
+ disabled: u = !1,
3268
+ hideDisabledButtons: p = !1,
3269
+ renderItem: f = sa,
3270
+ isLoading: x = !1,
3271
+ loadingText: v,
3272
+ emptyText: k,
3273
+ itemDisplayText: m = "Page",
3274
+ ...A
3275
+ }, y) => {
3276
+ const {
3277
+ items: R,
3278
+ totalPages: T,
3279
+ rangeStart: V,
3280
+ hasPrevPage: F,
3281
+ hasNextPage: E
3282
+ } = ra({
3283
+ totalItems: e,
3284
+ currentPage: t,
3285
+ itemsToShowEachSide: r
3286
+ }), [P, b] = N.useState(""), L = (w) => {
3287
+ b(w.target.value);
3288
+ }, _ = (w) => {
3289
+ if (w.key === "Enter") {
3290
+ const z = parseInt(P);
3291
+ !isNaN(z) && z >= 1 && z <= T && (a(z), b(""));
3292
+ }
3293
+ };
3294
+ if (e === 0)
3295
+ return /* @__PURE__ */ o(J, { className: "pagination-empty", children: k || "No items to display" });
3296
+ let S = ["pagination"];
3297
+ return c && S.push(c), u && S.push("disabled"), x && S.push("loading"), /* @__PURE__ */ I(
3298
+ D,
3299
+ {
3300
+ as: "nav",
3301
+ "data-pagination": !0,
3302
+ ref: y,
3303
+ classNames: S,
3304
+ role: "navigation",
3305
+ "aria-label": "pagination",
3306
+ ...A,
3307
+ children: [
3308
+ /* @__PURE__ */ I(K, { className: "pagination-controls", children: [
3309
+ s && (!p || F) && f({
3310
+ type: "first",
3311
+ disabled: !F || u,
3312
+ selected: !1,
3313
+ onClick: () => a(1)
3314
+ }),
3315
+ i && (!p || F) && f({
3316
+ type: "previous",
3317
+ disabled: !F || u,
3318
+ selected: !1,
3319
+ onClick: () => a(t - 1)
3320
+ }),
3321
+ R.map((w, z) => {
3322
+ const C = w === "..." ? {
3323
+ key: `ellipsis-${z}`,
3324
+ type: "ellipsis",
3325
+ selected: !1,
3326
+ disabled: !0
3327
+ } : {
3328
+ key: w.toString(),
3329
+ type: "page",
3330
+ page: w,
3331
+ selected: w === t,
3332
+ disabled: u,
3333
+ "aria-current": w === t ? "page" : void 0,
3334
+ onClick: () => a(w)
3335
+ };
3336
+ return f(C);
3337
+ }),
3338
+ l && (!p || E) && f({
3339
+ type: "next",
3340
+ disabled: !E || u,
3341
+ selected: !1,
3342
+ onClick: () => a(t + 1)
3343
+ }),
3344
+ n && (!p || E) && f({
3345
+ type: "last",
3346
+ disabled: !E || u,
3347
+ selected: !1,
3348
+ onClick: () => a(T)
3349
+ }),
3350
+ x && /* @__PURE__ */ I(K, { className: "pagination-loading", children: [
3351
+ /* @__PURE__ */ o(pt, {}),
3352
+ v && /* @__PURE__ */ o(J, { size: "small", children: v })
3353
+ ] })
3354
+ ] }),
3355
+ /* @__PURE__ */ I(K, { className: "pagination-info", children: [
3356
+ /* @__PURE__ */ I(J, { size: "tiny", children: [
3357
+ m,
3358
+ " ",
3359
+ V,
3360
+ " of ",
3361
+ e
3362
+ ] }),
3363
+ d && /* @__PURE__ */ o(K, { className: "pagination-go-to", children: /* @__PURE__ */ o(
3364
+ "input",
3365
+ {
3366
+ type: "number",
3367
+ min: 1,
3368
+ max: T,
3369
+ value: P,
3370
+ onChange: L,
3371
+ onKeyDown: _,
3372
+ placeholder: `Go to ${m}`,
3373
+ "aria-label": `Go to ${m}`,
3374
+ disabled: u
3375
+ }
3376
+ ) })
3377
+ ] })
3378
+ ]
3379
+ }
3380
+ );
3381
+ }
3382
+ );
3383
+ na.displayName = "Pagination";
3384
+ const oa = N.forwardRef(
3385
+ ({
3386
+ label: e,
3387
+ value: t,
3388
+ height: a,
3389
+ max: r = 100,
3390
+ shape: c,
3391
+ bgColor: s,
3392
+ bgColour: n,
3393
+ fillColor: i,
3394
+ fillColour: l,
3395
+ ...d
3396
+ }, u) => {
3397
+ const p = Math.max(0, Math.min(r, Number(t) || 0)), f = `${p}${d.suffix || ""}`, x = n || s, v = l || i, k = {
3398
+ height: a,
3399
+ ...x && { "--progress-bar-bg": `var(--${x})` },
3400
+ ...v && { "--progress-bar-fill": `var(--${v})` }
3401
+ };
3402
+ return /* @__PURE__ */ I(Ee, { children: [
3403
+ e && /* @__PURE__ */ I(
3404
+ D,
3405
+ {
3406
+ as: "div",
3407
+ "data-progress-bar-meta": !0,
3408
+ "aria-hidden": "true",
3409
+ children: [
3410
+ /* @__PURE__ */ o(J, { children: e }),
3411
+ /* @__PURE__ */ o(J, { children: f })
3412
+ ]
3413
+ }
3414
+ ),
3415
+ /* @__PURE__ */ o(
3416
+ D,
3417
+ {
3418
+ as: "progress",
3419
+ "data-progress-bar": !0,
3420
+ ref: u,
3421
+ value: p,
3422
+ max: r,
3423
+ "aria-label": e,
3424
+ "aria-valuemin": 0,
3425
+ "aria-valuemax": r,
3426
+ "aria-valuenow": p,
3427
+ "aria-valuetext": `${e ? `${e}: ` : ""}${f}`,
3428
+ shape: c,
3429
+ ...d,
3430
+ style: k
3431
+ }
3432
+ )
3433
+ ] });
3434
+ }
3435
+ );
3436
+ oa.displayName = "ProgressBar";
3437
+ const Ce = Be({
3438
+ isSelected: () => !1,
3439
+ toggleSelection: () => {
3440
+ },
3441
+ showTickIcon: !1,
3442
+ tickPosition: "top-right",
3443
+ selectAll: () => {
3444
+ },
3445
+ selectNone: () => {
3446
+ },
3447
+ selectInverse: () => {
3448
+ },
3449
+ registerOption: () => {
3450
+ },
3451
+ unregisterOption: () => {
3452
+ }
3453
+ }), ia = N.forwardRef(
3454
+ ({
3455
+ children: e,
3456
+ allowMultipleSelections: t = !1,
3457
+ showTickIcon: a,
3458
+ onSelectionChange: r,
3459
+ tickPosition: c = "top-right",
3460
+ selectionLimit: s,
3461
+ defaultSelectedIds: n,
3462
+ selectedIds: i,
3463
+ ...l
3464
+ }, d) => {
3465
+ const u = i !== void 0, [p, f] = j(
3466
+ n ? new Set(n) : /* @__PURE__ */ new Set()
3467
+ ), x = Y(/* @__PURE__ */ new Map()), v = u ? i : p, k = G((P) => {
3468
+ u || f(P), r == null || r(P);
3469
+ }, [u, r]), m = G((P, b) => {
3470
+ x.current.set(P, b);
3471
+ }, []), A = G((P) => {
3472
+ x.current.delete(P);
3473
+ }, []), y = G((P) => {
3474
+ const b = new Set(v);
3475
+ if (t)
3476
+ if (b.has(P))
3477
+ b.delete(P);
3478
+ else {
3479
+ if (s && b.size >= s)
3480
+ return;
3481
+ b.add(P);
3482
+ }
3483
+ else
3484
+ b.has(P) && v.size === 1 ? b.clear() : (b.clear(), b.add(P));
3485
+ k(b);
3486
+ }, [v, t, s, k]), R = G(() => {
3487
+ if (!t) return;
3488
+ const P = Array.from(x.current.entries()).filter(([L, _]) => !_).map(([L]) => L), b = s ? P.slice(0, s) : P;
3489
+ k(new Set(b));
3490
+ }, [t, s, k]), T = G(() => {
3491
+ k(/* @__PURE__ */ new Set());
3492
+ }, [k]), V = G(() => {
3493
+ if (!t) return;
3494
+ const b = Array.from(x.current.entries()).filter(([_, S]) => !S).map(([_]) => _).filter((_) => !v.has(_)), L = s ? b.slice(0, s) : b;
3495
+ k(new Set(L));
3496
+ }, [v, t, s, k]), F = G((P) => v.has(P), [v]);
3497
+ N.useImperativeHandle(d, () => ({
3498
+ selectAll: R,
3499
+ selectNone: T,
3500
+ selectInverse: V
3501
+ }), [R, T, V]);
3502
+ const E = {
3503
+ isSelected: F,
3504
+ toggleSelection: y,
3505
+ showTickIcon: a,
3506
+ tickPosition: c,
3507
+ selectAll: R,
3508
+ selectNone: T,
3509
+ selectInverse: V,
3510
+ registerOption: m,
3511
+ unregisterOption: A
3512
+ };
3513
+ return /* @__PURE__ */ o(Ce.Provider, { value: E, children: /* @__PURE__ */ o(K, { "data-option-cards-group": !0, className: `tick-${c}`, children: e }) });
3514
+ }
3515
+ );
3516
+ ia.displayName = "OptionCardsGroup";
3517
+ const Ua = (e) => {
3518
+ const t = Ne(Ce);
3519
+ return {
3520
+ isSelected: t.isSelected(e),
3521
+ toggleSelection: () => t.toggleSelection(e),
3522
+ showTickIcon: t.showTickIcon
3523
+ };
3524
+ }, qa = () => {
3525
+ const { selectAll: e, selectNone: t, selectInverse: a } = Ne(Ce);
3526
+ return { selectAll: e, selectNone: t, selectInverse: a };
3527
+ }, Ya = ({ id: e, children: t, disabled: a = !1, ...r }) => {
3528
+ const { isSelected: c, toggleSelection: s, showTickIcon: n, registerOption: i, unregisterOption: l } = Ne(Ce), [d, u] = j(!1), [p, f] = j(!0);
3529
+ N.useEffect(() => (i(e, a), () => l(e)), [e, a, i, l]);
3530
+ let x = [];
3531
+ c(e) && x.push("selected"), a && x.push("disabled"), d && x.push("show-deselect");
3532
+ const v = () => {
3533
+ c(e) && !p && u(!0);
3534
+ }, k = () => {
3535
+ u(!1), f(!1);
3536
+ }, m = (y) => {
3537
+ var R;
3538
+ a || (f(!0), u(!1), s(e), (R = r.onClick) == null || R.call(r, y));
3539
+ }, A = (y) => {
3540
+ (y.key === "Enter" || y.key === " ") && !a && (y.preventDefault(), f(!0), u(!1), s(e));
3541
+ };
3542
+ return /* @__PURE__ */ I(
3543
+ D,
3544
+ {
3545
+ as: Qe,
3546
+ "data-option-card": !0,
3547
+ role: "button",
3548
+ tabIndex: a ? -1 : 0,
3549
+ "aria-disabled": a,
3550
+ "aria-selected": c(e),
3551
+ classNames: x,
3552
+ onClick: m,
3553
+ onKeyDown: A,
3554
+ onMouseEnter: v,
3555
+ onMouseLeave: k,
3556
+ ...r,
3557
+ children: [
3558
+ n && /* @__PURE__ */ I(Ee, { children: [
3559
+ /* @__PURE__ */ I("svg", { viewBox: "0 0 24 24", className: "tick-icon", children: [
3560
+ /* @__PURE__ */ o("circle", { cx: "12", cy: "12", r: "11" }),
3561
+ /* @__PURE__ */ o("path", { d: "M8 13 L11 15 L16 9" })
3562
+ ] }),
3563
+ /* @__PURE__ */ I("svg", { viewBox: "0 0 24 24", className: "deselect-icon", children: [
3564
+ /* @__PURE__ */ o("circle", { cx: "12", cy: "12", r: "11" }),
3565
+ /* @__PURE__ */ o("path", { d: "M8 8 L16 16 M16 8 L8 16" })
3566
+ ] })
3567
+ ] }),
3568
+ t
3569
+ ]
3570
+ }
3571
+ );
3572
+ }, la = N.forwardRef(
3573
+ ({
3574
+ collapsed: e,
3575
+ closeOnClickOutside: t,
3576
+ showMobileSidebar: a,
3577
+ ...r
3578
+ }, c) => {
3579
+ const s = Y(null);
3580
+ Je(c, () => s.current), Fe(s, () => {
3581
+ typeof t == "function" && t();
3582
+ });
3583
+ let n = [];
3584
+ return e && n.push("collapsed"), a && n.push("show-sidebar"), /* @__PURE__ */ o(
3585
+ D,
3586
+ {
3587
+ as: "aside",
3588
+ "data-sidebar-wrapper": !0,
3589
+ ref: s,
3590
+ classNames: n,
3591
+ ...r
3592
+ }
3593
+ );
3594
+ }
3595
+ );
3596
+ la.displayName = "SidebarWrapper";
3597
+ const ca = N.forwardRef(
3598
+ ({ label: e, ...t }, a) => /* @__PURE__ */ o(
3599
+ D,
3600
+ {
3601
+ as: "main",
3602
+ "data-content-wrapper": !0,
3603
+ ref: a,
3604
+ role: "main",
3605
+ "aria-label": e || "Main content",
3606
+ ...t
3607
+ }
3608
+ )
3609
+ );
3610
+ ca.displayName = "ContentWrapper";
3611
+ const da = N.forwardRef(
3612
+ ({ isSticky: e, ...t }, a) => {
3613
+ let r = [];
3614
+ return e && r.push("is-sticky"), /* @__PURE__ */ o(
3615
+ D,
3616
+ {
3617
+ as: "header",
3618
+ "data-sidebar-header": !0,
3619
+ ref: a,
3620
+ classNames: r,
3621
+ ...t
3622
+ }
3623
+ );
3624
+ }
3625
+ );
3626
+ da.displayName = "SidebarHeader";
3627
+ const ua = N.forwardRef(
3628
+ ({ hasAlert: e, hasEmptyIcon: t, hasNoIcon: a, children: r, ...c }, s) => {
3629
+ let n = [];
3630
+ return e && n.push("has-alert"), t ? n.push("has-empty-icon") : a && n.push("has-no-icon"), /* @__PURE__ */ I(
3631
+ D,
3632
+ {
3633
+ as: "div",
3634
+ "data-sidebar-item": !0,
3635
+ ref: s,
3636
+ classNames: n,
3637
+ ...c,
3638
+ children: [
3639
+ t && /* @__PURE__ */ o(K, { className: "empty-icon-wrapper" }),
3640
+ r
3641
+ ]
3642
+ }
3643
+ );
3644
+ }
3645
+ );
3646
+ ua.displayName = "SidebarItem";
3647
+ const fa = N.forwardRef(
3648
+ ({ isSticky: e, ...t }, a) => {
3649
+ let r = [];
3650
+ return e && r.push("is-sticky"), /* @__PURE__ */ o(
3651
+ D,
3652
+ {
3653
+ as: "footer",
3654
+ "data-sidebar-footer": !0,
3655
+ ref: a,
3656
+ classNames: r,
3657
+ ...t
3658
+ }
3659
+ );
3660
+ }
3661
+ );
3662
+ fa.displayName = "SidebarFooter";
3663
+ const mt = Be({
3664
+ effect: "wave",
3665
+ animate: !0
3666
+ }), pa = N.forwardRef(({
3667
+ variant: e = "line",
3668
+ width: t,
3669
+ height: a,
3670
+ shape: r,
3671
+ effect: c,
3672
+ loadingLabel: s,
3673
+ ...n
3674
+ }, i) => {
3675
+ const l = Ne(mt), d = c || l.effect, u = s || l.loadingLabel || "Loading...";
3676
+ let p = [];
3677
+ e && p.push(`variant-${e}`), r && p.push(`shape-${r}`), d && p.push(`effect-${d}`);
3678
+ const f = t || "100%", x = e === "circle" ? (typeof t == "number" ? `${t}px` : t) || a || "100%" : a, v = {
3679
+ width: f,
3680
+ height: x,
3681
+ aspectRatio: e === "circle" ? "1 / 1" : "auto",
3682
+ ...n.style
3683
+ };
3684
+ return /* @__PURE__ */ o(
3685
+ D,
3686
+ {
3687
+ as: "div",
3688
+ "data-skeleton": !0,
3689
+ ref: i,
3690
+ classNames: p,
3691
+ style: v,
3692
+ role: "progressbar",
3693
+ "aria-busy": "true",
3694
+ "aria-valuemin": 0,
3695
+ "aria-valuemax": 100,
3696
+ "aria-valuetext": u,
3697
+ "aria-label": u,
3698
+ ...n
3699
+ }
3700
+ );
3701
+ });
3702
+ pa.displayName = "Skeleton";
3703
+ const ma = N.forwardRef(({
3704
+ effect: e = "wave",
3705
+ spacing: t = "small",
3706
+ animate: a = !0,
3707
+ repeat: r = 1,
3708
+ direction: c = "vertical",
3709
+ children: s,
3710
+ classNames: n = [],
3711
+ loadingLabel: i = "Loading content...",
3712
+ ...l
3713
+ }, d) => {
3714
+ const u = [
3715
+ `direction-${c}`,
3716
+ e && `effect-${e}`,
3717
+ ...n
3718
+ ];
3719
+ return t && u.push(`spacing-${t}`), /* @__PURE__ */ o(mt.Provider, { value: { effect: e, animate: a, loadingLabel: i }, children: /* @__PURE__ */ o(
3720
+ D,
3721
+ {
3722
+ as: "div",
3723
+ ref: d,
3724
+ "data-skeleton-group": !0,
3725
+ classNames: u,
3726
+ role: "alert",
3727
+ "aria-busy": "true",
3728
+ "aria-label": i,
3729
+ ...l,
3730
+ children: Array(r).fill(s).map((p, f) => N.cloneElement(p, {
3731
+ key: f
3732
+ }))
3733
+ }
3734
+ ) });
3735
+ });
3736
+ ma.displayName = "SkeletonGroup";
3737
+ const ha = N.forwardRef(
3738
+ ({
3739
+ bordersFor: e,
3740
+ isStriped: t,
3741
+ highlightRowOnHover: a,
3742
+ isFullWidth: r,
3743
+ alignText: c,
3744
+ caption: s,
3745
+ summary: n,
3746
+ hasColSpan: i,
3747
+ children: l,
3748
+ ...d
3749
+ }, u) => {
3750
+ let p = [];
3751
+ e && p.push(`bordered-${e}`), t && p.push("striped"), a && p.push("hoverable"), r && p.push("full-width"), c && p.push(`align-text-${c}`);
3752
+ const f = N.Children.count(l);
3753
+ return /* @__PURE__ */ I(
3754
+ D,
3755
+ {
3756
+ as: "table",
3757
+ classNames: p,
3758
+ ref: u,
3759
+ role: "table",
3760
+ "aria-rowcount": f || void 0,
3761
+ "aria-colcount": i ? void 0 : (() => {
3762
+ if (!l || !N.isValidElement(l)) return;
3763
+ const v = N.Children.toArray(l)[0];
3764
+ if (N.isValidElement(v)) {
3765
+ const k = v.props;
3766
+ if (k.children)
3767
+ return N.Children.count(k.children);
3768
+ }
3769
+ })(),
3770
+ summary: n,
3771
+ ...d,
3772
+ children: [
3773
+ s && /* @__PURE__ */ o("caption", { children: s }),
3774
+ l
3775
+ ]
3776
+ }
3777
+ );
3778
+ }
3779
+ );
3780
+ ha.displayName = "Table";
3781
+ const va = N.forwardRef(
3782
+ ({ tabs: e, additionalNavContentWrapper: t, defaultActiveTab: a, align: r = "left", isFullWidth: c, ...s }, n) => {
3783
+ const i = e.findIndex((m) => m.key === a), l = i > -1 ? i : 0, [d, u] = N.useState(
3784
+ e.length > 0 ? e[l] : void 0
3785
+ ), [p, f] = N.useState(!1), x = Y([]), v = G((m) => {
3786
+ (d == null ? void 0 : d.key) !== m.key && (f(!0), setTimeout(() => {
3787
+ u(m), f(!1);
3788
+ }, 150));
3789
+ }, [d == null ? void 0 : d.key]);
3790
+ q(() => {
3791
+ e.length > 0 ? e.find((A) => A.key === (d == null ? void 0 : d.key)) || u(e[l]) : u(void 0);
3792
+ }, [e, l, d == null ? void 0 : d.key]);
3793
+ const k = G((m, A) => {
3794
+ var T;
3795
+ let y = A;
3796
+ if (m.key === "ArrowRight")
3797
+ y = (A + 1) % e.length;
3798
+ else if (m.key === "ArrowLeft")
3799
+ y = (A - 1 + e.length) % e.length;
3800
+ else if (m.key === "Home")
3801
+ y = 0;
3802
+ else if (m.key === "End")
3803
+ y = e.length - 1;
3804
+ else
3805
+ return;
3806
+ m.preventDefault();
3807
+ const R = e[y];
3808
+ R && (v(R), (T = x.current[y]) == null || T.focus());
3809
+ }, [e, v]);
3810
+ return d ? /* @__PURE__ */ I(
3811
+ D,
3812
+ {
3813
+ as: "div",
3814
+ "data-tabs": !0,
3815
+ ref: n,
3816
+ "data-align": r,
3817
+ "data-full-width": c,
3818
+ ...s,
3819
+ children: [
3820
+ /* @__PURE__ */ o(Pt, { "data-tabs-nav": !0, role: "tablist", "aria-label": "Tab Navigation", children: /* @__PURE__ */ I("ul", { className: "tab-labels-list", children: [
3821
+ e.map((m, A) => /* @__PURE__ */ o("li", { children: /* @__PURE__ */ o(
3822
+ D,
3823
+ {
3824
+ as: "button",
3825
+ ref: (y) => x.current[A] = y,
3826
+ id: `tab-${m.key}`,
3827
+ role: "tab",
3828
+ "aria-selected": d.key === m.key,
3829
+ "aria-controls": `tab-panel-${m.key}`,
3830
+ tabIndex: d.key === m.key ? 0 : -1,
3831
+ "data-tab-label": !0,
3832
+ "data-active": d.key === m.key,
3833
+ "data-alert": m.hasAlert,
3834
+ onClick: () => v(m),
3835
+ onKeyDown: (y) => k(y, A),
3836
+ className: `tab-button ${d.key === m.key ? "is-active" : ""}`,
3837
+ marginBottom: "nano",
3838
+ children: /* @__PURE__ */ o(
3839
+ J,
3840
+ {
3841
+ className: `tab-label ${d.key === m.key ? "is-active" : ""} ${m.hasAlert ? "has-alert" : ""}`,
3842
+ children: m.label
3843
+ }
3844
+ )
3845
+ }
3846
+ ) }, m.key)),
3847
+ t
3848
+ ] }) }),
3849
+ /* @__PURE__ */ o(et, { kind: "tertiary", marginTop: "none", marginBottom: "micro" }),
3850
+ e.map((m) => /* @__PURE__ */ o(
3851
+ K,
3852
+ {
3853
+ id: `tab-panel-${m.key}`,
3854
+ role: "tabpanel",
3855
+ "aria-labelledby": `tab-${m.key}`,
3856
+ tabIndex: d.key === m.key ? 0 : -1,
3857
+ "data-tab-content": !0,
3858
+ "data-active": d.key === m.key,
3859
+ "data-exiting": d.key === m.key && p,
3860
+ hidden: d.key !== m.key,
3861
+ children: m.content
3862
+ },
3863
+ m.key
3864
+ ))
3865
+ ]
3866
+ }
3867
+ ) : null;
3868
+ }
3869
+ );
3870
+ va.displayName = "Tabs";
3871
+ const De = () => {
3872
+ if (typeof window < "u") {
3873
+ const e = window.location.hostname, t = window.location.port;
3874
+ let a = e.replace(/\./g, "-");
3875
+ return t && (a += `-${t}`), `${a}-theme`;
3876
+ }
3877
+ return "fictoan-theme";
3878
+ }, ya = ["", (e) => {
3879
+ }], ht = N.createContext(void 0), Ja = () => {
3880
+ const e = N.useContext(ht);
3881
+ return e === void 0 ? ya : e;
3882
+ }, qe = (e, t) => {
3883
+ let a;
3884
+ try {
3885
+ a = localStorage.getItem(e) || void 0;
3886
+ } catch {
3887
+ }
3888
+ return a || t;
3889
+ }, wa = N.forwardRef(
3890
+ ({ currentTheme: e, themeList: t, children: a, ...r }, c) => {
3891
+ const [s, n] = j(!1), [i, l] = j(() => qe(De()) || e), d = G(
3892
+ (u) => {
3893
+ const p = typeof u == "function" ? u(i) : u;
3894
+ if (!t.includes(p)) {
3895
+ const f = t[0];
3896
+ l(f), document.documentElement.className = "", document.documentElement.classList.add(f);
3897
+ try {
3898
+ localStorage.setItem(De(), f);
3899
+ } catch {
3900
+ }
3901
+ return;
3902
+ }
3903
+ l(p), document.documentElement.className = "", document.documentElement.classList.add(p), s || n(!0);
3904
+ try {
3905
+ localStorage.setItem(De(), p);
3906
+ } catch {
3907
+ }
3908
+ },
3909
+ [i, t]
3910
+ );
3911
+ return q(() => {
3912
+ const u = qe(De());
3913
+ d(u || e);
3914
+ }, [e, d]), /* @__PURE__ */ o(ht.Provider, { value: [i, d], children: /* @__PURE__ */ o(D, { as: "div", "data-theme-provider": !0, ref: c, ...r, children: s && a }) });
3915
+ }
3916
+ );
3917
+ wa.displayName = "ThemeProvider";
3918
+ const vt = N.forwardRef(
3919
+ ({
3920
+ anchor: e = "top",
3921
+ children: t,
3922
+ ...a
3923
+ }, r) => N.Children.count(t) === 0 ? null : /* @__PURE__ */ o(
3924
+ D,
3925
+ {
3926
+ as: "section",
3927
+ "data-toasts-wrapper": !0,
3928
+ ref: r,
3929
+ classNames: [e],
3930
+ "aria-label": "Toasts",
3931
+ "aria-relevant": "additions removals",
3932
+ role: "log",
3933
+ ...a,
3934
+ children: t
3935
+ }
3936
+ )
3937
+ );
3938
+ vt.displayName = "ToastsWrapper";
3939
+ const yt = ({
3940
+ id: e,
3941
+ duration: t = 4,
3942
+ onClose: a,
3943
+ children: r
3944
+ }) => {
3945
+ const [c, s] = j(!1);
3946
+ return q(() => {
3947
+ if (t === 0) return;
3948
+ const i = setTimeout(() => {
3949
+ s(!0);
3950
+ }, t * 1e3);
3951
+ return () => clearTimeout(i);
3952
+ }, [t]), q(() => {
3953
+ if (!c) return;
3954
+ const i = setTimeout(() => {
3955
+ a();
3956
+ }, 500);
3957
+ return () => clearTimeout(i);
3958
+ }, [c, a]), /* @__PURE__ */ o(
3959
+ D,
3960
+ {
3961
+ as: "div",
3962
+ "data-toast-item": !0,
3963
+ id: e,
3964
+ classNames: c ? ["dismissed"] : [],
3965
+ onTransitionEnd: () => {
3966
+ c && a();
3967
+ },
3968
+ role: "status",
3969
+ "aria-live": "polite",
3970
+ "aria-atomic": "true",
3971
+ shadow: "soft",
3972
+ children: r
3973
+ }
3974
+ );
3975
+ };
3976
+ yt.displayName = "ToastItem";
3977
+ const wt = Be(null), ga = ({
3978
+ children: e,
3979
+ anchor: t = "top"
3980
+ }) => {
3981
+ const [a, r] = j([]), c = G((n) => {
3982
+ r((i) => i.filter((l) => l.id !== n));
3983
+ }, []), s = G((n, i = 4) => {
3984
+ const l = `toast-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
3985
+ r((d) => [...d, {
3986
+ id: l,
3987
+ message: n,
3988
+ duration: i
3989
+ }]);
3990
+ }, []);
3991
+ return /* @__PURE__ */ I(wt.Provider, { value: { toast: s }, children: [
3992
+ e,
3993
+ /* @__PURE__ */ o(vt, { anchor: t, children: a.map(({ id: n, message: i, duration: l }) => /* @__PURE__ */ o(
3994
+ yt,
3995
+ {
3996
+ id: n,
3997
+ duration: l,
3998
+ onClose: () => c(n),
3999
+ children: i
4000
+ },
4001
+ n
4002
+ )) })
4003
+ ] });
4004
+ };
4005
+ ga.displayName = "ToastsProvider";
4006
+ const Za = () => {
4007
+ const e = Ne(wt);
4008
+ if (!e)
4009
+ throw new Error("useToasts must be used within a ToastsProvider");
4010
+ return e.toast;
4011
+ }, fe = 8, ne = 16;
4012
+ let oe = null, pe = null, Ve = !1, ce = null, ve = null;
4013
+ const me = /* @__PURE__ */ new Map(), ba = (e, t, a) => {
4014
+ const r = e.getBoundingClientRect(), c = t.getBoundingClientRect(), s = window.innerHeight, n = window.innerWidth;
4015
+ let i, l;
4016
+ switch (a) {
4017
+ case "top":
4018
+ i = c.top - r.height - fe, l = c.left + (c.width - r.width) / 2, i < ne && (i = c.bottom + fe);
4019
+ break;
4020
+ case "bottom":
4021
+ i = c.bottom + fe, l = c.left + (c.width - r.width) / 2, i + r.height > s - ne && (i = c.top - r.height - fe);
4022
+ break;
4023
+ case "left":
4024
+ i = c.top + (c.height - r.height) / 2, l = c.left - r.width - fe, l < ne && (l = c.right + fe);
4025
+ break;
4026
+ case "right":
4027
+ i = c.top + (c.height - r.height) / 2, l = c.right + fe, l + r.width > n - ne && (l = c.left - r.width - fe);
4028
+ break;
4029
+ default:
4030
+ i = c.top - r.height - fe, l = c.left + (c.width - r.width) / 2;
4031
+ }
4032
+ return l < ne ? l = ne : l + r.width > n - ne && (l = n - r.width - ne), i < ne ? i = ne : i + r.height > s - ne && (i = s - r.height - ne), { top: i, left: l };
4033
+ }, Ae = ({ content: e, isVisible: t, position: a, zIndex: r }) => /* @__PURE__ */ o(
4034
+ "div",
4035
+ {
4036
+ "data-tooltip": !0,
4037
+ className: t ? "visible" : "",
4038
+ role: "tooltip",
4039
+ style: {
4040
+ position: "fixed",
4041
+ zIndex: r,
4042
+ top: `${a.top}px`,
4043
+ left: `${a.left}px`
4044
+ },
4045
+ children: e
4046
+ }
4047
+ ), Me = (e, t) => {
4048
+ if (!(!pe || !oe)) {
4049
+ if (!e || !t) {
4050
+ pe.render(
4051
+ /* @__PURE__ */ o(Ae, { content: null, isVisible: !1, position: { top: -9999, left: -9999 }, zIndex: 1e5 })
4052
+ );
4053
+ return;
4054
+ }
4055
+ pe.render(
4056
+ /* @__PURE__ */ o(Ae, { content: e.content, isVisible: !1, position: { top: -9999, left: -9999 }, zIndex: e.zIndex })
4057
+ ), requestAnimationFrame(() => {
4058
+ if (!oe || !t) return;
4059
+ const a = oe.firstElementChild;
4060
+ if (!a) return;
4061
+ const { top: r, left: c } = ba(a, t, e.position);
4062
+ pe == null || pe.render(
4063
+ /* @__PURE__ */ o(Ae, { content: e.content, isVisible: !0, position: { top: r, left: c }, zIndex: e.zIndex })
4064
+ );
4065
+ });
4066
+ }
4067
+ }, Ye = () => {
4068
+ if (!ce || !ve) return;
4069
+ const e = me.get(ce);
4070
+ e && Me(e, ve);
4071
+ }, gt = (e, t) => {
4072
+ const a = me.get(e);
4073
+ a && (ce = e, ve = t, Me(a, t));
4074
+ }, Le = (e) => {
4075
+ e && ce !== e || (ce = null, ve = null, Me(null, null));
4076
+ }, Na = (e) => {
4077
+ const t = e.target.closest("[id]");
4078
+ if (!(t != null && t.id)) return;
4079
+ const a = me.get(t.id);
4080
+ (a == null ? void 0 : a.showOn) === "hover" && gt(t.id, t);
4081
+ }, ka = (e) => {
4082
+ const t = e.target.closest("[id]");
4083
+ if (!(t != null && t.id)) return;
4084
+ const a = me.get(t.id);
4085
+ (a == null ? void 0 : a.showOn) === "hover" && Le(t.id);
4086
+ }, $a = (e) => {
4087
+ if (oe != null && oe.contains(e.target))
4088
+ return;
4089
+ const t = e.target.closest("[id]");
4090
+ if (t != null && t.id) {
4091
+ const a = me.get(t.id);
4092
+ if ((a == null ? void 0 : a.showOn) === "click") {
4093
+ ce === t.id ? Le() : gt(t.id, t);
4094
+ return;
4095
+ }
4096
+ }
4097
+ if (ce) {
4098
+ const a = me.get(ce);
4099
+ (a == null ? void 0 : a.showOn) === "click" && Le();
4100
+ }
4101
+ }, xa = () => {
4102
+ if (typeof document > "u") return;
4103
+ const e = document.getElementById("fictoan-tooltip-singleton");
4104
+ if (e && Ve) {
4105
+ oe = e;
4106
+ return;
4107
+ }
4108
+ Ve = !1, oe = null, pe = null, oe = document.createElement("div"), oe.id = "fictoan-tooltip-singleton", document.body.appendChild(oe), pe = Mt(oe), pe.render(
4109
+ /* @__PURE__ */ o(Ae, { content: null, isVisible: !1, position: { top: -9999, left: -9999 }, zIndex: 1e5 })
4110
+ ), document.addEventListener("mouseover", Na), document.addEventListener("mouseout", ka), document.addEventListener("click", $a), window.addEventListener("scroll", Ye, !0), window.addEventListener("resize", Ye), Ve = !0;
4111
+ }, Qa = ({
4112
+ children: e,
4113
+ isTooltipFor: t,
4114
+ showOn: a = "hover",
4115
+ position: r = "top",
4116
+ zIndex: c = 1e5
4117
+ }) => {
4118
+ const s = Y({ content: e, position: r, showOn: a, zIndex: c });
4119
+ return s.current = { content: e, position: r, showOn: a, zIndex: c }, q(() => (xa(), me.set(t, s.current), ce === t && ve && Me(s.current, ve), () => {
4120
+ me.delete(t), ce === t && Le();
4121
+ }), [t]), q(() => {
4122
+ me.set(t, s.current), ce === t && ve && Me(s.current, ve);
4123
+ }, [e, r, a, c, t]), null;
4124
+ }, ke = N.forwardRef(
4125
+ ({ fontStyle: e = "sans-serif", weight: t, align: a, ...r }, c) => {
4126
+ let s = [];
4127
+ return t && s.push(`weight-${t}`), e && s.push(`font-${e}`), a && s.push(`text-${a}`), /* @__PURE__ */ o(D, { ref: c, classNames: s, ...r });
4128
+ }
4129
+ ), Ra = N.forwardRef((e, t) => /* @__PURE__ */ o(ke, { as: "h1", ref: t, ...e }));
4130
+ Ra.displayName = "Heading1";
4131
+ const Ma = N.forwardRef((e, t) => /* @__PURE__ */ o(ke, { as: "h2", ref: t, ...e }));
4132
+ Ma.displayName = "Heading2";
4133
+ const Ea = N.forwardRef((e, t) => /* @__PURE__ */ o(ke, { as: "h3", ref: t, ...e }));
4134
+ Ea.displayName = "Heading3";
4135
+ const Pa = N.forwardRef((e, t) => /* @__PURE__ */ o(ke, { as: "h4", ref: t, ...e }));
4136
+ Pa.displayName = "Heading4";
4137
+ const Sa = N.forwardRef((e, t) => /* @__PURE__ */ o(ke, { as: "h5", ref: t, ...e }));
4138
+ Sa.displayName = "Heading5";
4139
+ const Ia = N.forwardRef((e, t) => /* @__PURE__ */ o(ke, { as: "h6", ref: t, ...e }));
4140
+ Ia.displayName = "Heading6";
4141
+ const Ta = N.forwardRef(
4142
+ ({ summary: e, children: t, isOpen: a = !1, ...r }, c) => /* @__PURE__ */ I(
4143
+ D,
4144
+ {
4145
+ as: "details",
4146
+ "data-expandable-content": !0,
4147
+ ref: c,
4148
+ ...r,
4149
+ open: a,
4150
+ role: "region",
4151
+ "aria-labelledby": "accordion-summary",
4152
+ children: [
4153
+ /* @__PURE__ */ o(
4154
+ "summary",
4155
+ {
4156
+ role: "button",
4157
+ tabIndex: 0,
4158
+ "aria-controls": "accordion-content",
4159
+ "aria-expanded": a,
4160
+ children: typeof e == "string" ? /* @__PURE__ */ o(J, { margin: "none", children: e }) : e
4161
+ }
4162
+ ),
4163
+ t
4164
+ ]
4165
+ }
4166
+ )
4167
+ );
4168
+ Ta.displayName = "Accordion";
4169
+ export {
4170
+ ca as $,
4171
+ Ta as A,
4172
+ Oe as B,
4173
+ Ze as C,
4174
+ It as D,
4175
+ D as E,
4176
+ za as F,
4177
+ ea as G,
4178
+ Ha as H,
4179
+ Se as I,
4180
+ aa as J,
4181
+ Xa as K,
4182
+ Ut as L,
4183
+ _a as M,
4184
+ Pt as N,
4185
+ na as O,
4186
+ qt as P,
4187
+ at as Q,
4188
+ rt as R,
4189
+ Ga as S,
4190
+ it as T,
4191
+ oa as U,
4192
+ nt as V,
4193
+ Ya as W,
4194
+ Ua as X,
4195
+ qa as Y,
4196
+ ia as Z,
4197
+ la as _,
4198
+ We as a,
4199
+ da as a0,
4200
+ ua as a1,
4201
+ fa as a2,
4202
+ pa as a3,
4203
+ ma as a4,
4204
+ pt as a5,
4205
+ ha as a6,
4206
+ va as a7,
4207
+ wa as a8,
4208
+ Ja as a9,
4209
+ ga as aa,
4210
+ Za as ab,
4211
+ Qa as ac,
4212
+ Ra as ad,
4213
+ Ma as ae,
4214
+ Ea as af,
4215
+ Pa as ag,
4216
+ Sa as ah,
4217
+ Ia as ai,
4218
+ J as aj,
4219
+ Tt as b,
4220
+ At as c,
4221
+ Qe as d,
4222
+ Lt as e,
4223
+ et as f,
4224
+ K as g,
4225
+ Va as h,
4226
+ Fa as i,
4227
+ Wa as j,
4228
+ Ka as k,
4229
+ ja as l,
4230
+ ze as m,
4231
+ Ct as n,
4232
+ tt as o,
4233
+ Ht as p,
4234
+ ee as q,
4235
+ _t as r,
4236
+ Pe as s,
4237
+ st as t,
4238
+ Yt as u,
4239
+ Zt as v,
4240
+ ot as w,
4241
+ He as x,
4242
+ Vt as y,
4243
+ Qt as z
4244
+ };
4245
+ //# sourceMappingURL=Accordion-CylcN4Ed.js.map