fictoan-react 2.0.0-beta.1 → 2.0.0-beta.2

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