@febkosq8/arc 0.3.0 → 0.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +64 -5
  2. package/components/index.css +263 -114
  3. package/dist/arc.js +1115 -0
  4. package/dist/avatar.d.ts +18 -0
  5. package/dist/button-double-click.d.ts +18 -0
  6. package/dist/button-group.d.ts +8 -0
  7. package/dist/button-long-press.d.ts +20 -0
  8. package/dist/button.d.ts +21 -0
  9. package/dist/card.d.ts +17 -0
  10. package/dist/date-handler.d.ts +13 -0
  11. package/dist/divider.d.ts +2 -0
  12. package/dist/dropdown-multi.d.ts +16 -0
  13. package/dist/dropdown.d.ts +19 -0
  14. package/dist/error-text.d.ts +5 -0
  15. package/dist/hash-navigation.d.ts +34 -0
  16. package/dist/index.d.ts +41 -0
  17. package/dist/input-timestamp.d.ts +7 -0
  18. package/dist/input.d.ts +19 -0
  19. package/dist/menu.d.ts +29 -0
  20. package/dist/modal.d.ts +15 -0
  21. package/dist/pill-link.d.ts +8 -0
  22. package/dist/pill.d.ts +5 -0
  23. package/dist/preview-card.d.ts +12 -0
  24. package/dist/select.d.ts +18 -0
  25. package/dist/switch.d.ts +10 -0
  26. package/dist/tag.d.ts +6 -0
  27. package/dist/text-link.d.ts +6 -0
  28. package/dist/theme-switcher.d.ts +5 -0
  29. package/dist/typing-animation.d.ts +23 -0
  30. package/package.json +49 -35
  31. package/.prettierrc +0 -8
  32. package/components/button.tsx +0 -42
  33. package/components/card.tsx +0 -32
  34. package/components/index.ts +0 -8
  35. package/components/input.tsx +0 -21
  36. package/components/menu.tsx +0 -80
  37. package/components/pill.tsx +0 -20
  38. package/components/switch.tsx +0 -82
  39. package/components/text-area.tsx +0 -21
  40. package/components/theme-switcher.tsx +0 -81
  41. package/eslint.config.mjs +0 -36
  42. package/index.html +0 -11
  43. package/tsconfig.json +0 -27
  44. package/vite.config.ts +0 -37
package/dist/arc.js ADDED
@@ -0,0 +1,1115 @@
1
+ import { cva as e, cx as t } from "@rinzai/zen";
2
+ import { Children as n, Fragment as r, cloneElement as i, isValidElement as a, useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
3
+ import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
4
+ import { Combobox as p } from "@base-ui/react/combobox";
5
+ import { FaCheck as m, FaChevronDown as h } from "react-icons/fa6";
6
+ import { DateTime as g } from "luxon";
7
+ import { Menu as _ } from "@base-ui/react/menu";
8
+ import { FiChevronDown as v, FiChevronRight as y, FiMonitor as b, FiMoon as x, FiSun as S } from "react-icons/fi";
9
+ import { Dialog as C } from "@base-ui/react/dialog";
10
+ import { RxCross1 as w } from "react-icons/rx";
11
+ import { Popover as T } from "@base-ui/react/popover";
12
+ import { Select as E } from "@base-ui/react/select";
13
+ import { Switch as D } from "@base-ui/react/switch";
14
+ //#region components/button-group.tsx
15
+ var O = ({ className: e, orientation: r = "horizontal", selectedVariant: o, children: s, ...c }) => /* @__PURE__ */ d("div", {
16
+ role: "group",
17
+ className: t("arc-button-group inline-flex w-fit gap-0 overflow-hidden rounded-md border border-border", "[&>.arc-button]:rounded-none! [&>.arc-button:not(:first-child)]:border-l [&>.arc-button:not(:first-child)]:border-border", "[&>.arc-double-click-button]:z-1 [&>.arc-double-click-button]:m-0 [&>.arc-double-click-button]:rounded-none! [&>.arc-double-click-button]:p-0", "[&>.arc-double-click-button>.arc-button]:rounded-none! [&>.arc-double-click-button>.arc-double-click-progress-ring]:inset-0 [&>.arc-double-click-button>.arc-double-click-progress-ring]:z-2 [&>.arc-double-click-button>.arc-double-click-progress-ring]:rounded-[inherit]", "[&>.arc-long-press-button]:z-1 [&>.arc-long-press-button]:m-0 [&>.arc-long-press-button]:rounded-none! [&>.arc-long-press-button]:p-0", "[&>.arc-long-press-button>.arc-button]:rounded-none! [&>.arc-long-press-button>.arc-double-click-progress-ring]:inset-0 [&>.arc-long-press-button>.arc-double-click-progress-ring]:z-2 [&>.arc-long-press-button>.arc-double-click-progress-ring]:rounded-[inherit]", r === "vertical" && "flex-col items-stretch [&>.arc-button]:w-full [&>.arc-double-click-button]:w-full [&>.arc-long-press-button]:w-full [&>.arc-button:not(:first-child)]:border-t [&>.arc-button:not(:first-child)]:border-l-0 [&>.arc-double-click-button:not(:first-child)]:border-t [&>.arc-double-click-button:not(:first-child)]:border-l-0 [&>.arc-long-press-button:not(:first-child)]:border-t [&>.arc-long-press-button:not(:first-child)]:border-l-0 [&>.arc-double-click-button:first-child]:rounded-t-md [&>.arc-double-click-button:last-child]:rounded-b-md [&>.arc-long-press-button:first-child]:rounded-t-md [&>.arc-long-press-button:last-child]:rounded-b-md", r === "horizontal" && "[&>.arc-double-click-button:not(:first-child)]:border-l [&>.arc-double-click-button:not(:first-child)]:border-border [&>.arc-long-press-button:not(:first-child)]:border-l [&>.arc-long-press-button:not(:first-child)]:border-border [&>.arc-double-click-button:first-child]:rounded-l-md [&>.arc-double-click-button:last-child]:rounded-r-md [&>.arc-long-press-button:first-child]:rounded-l-md [&>.arc-long-press-button:last-child]:rounded-r-md", e),
18
+ ...c,
19
+ children: n.map(s, (e) => !o || !a(e) ? e : e.props["aria-pressed"] === !0 ? i(e, { variant: o }) : e)
20
+ }), k = e("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 truncate", {
21
+ variants: {
22
+ variant: {
23
+ primary: "bg-primary text-primary-foreground hover:bg-primary/90",
24
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
25
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
26
+ ghost: "text-foreground hover:bg-accent hover:text-accent-foreground [&>svg]:text-inherit",
27
+ warning: "bg-warning text-warning-foreground hover:bg-warning/90",
28
+ "outline-primary": "border border-primary bg-background text-primary hover:bg-primary hover:text-primary-foreground",
29
+ "outline-secondary": "border border-secondary-foreground bg-background text-secondary-foreground hover:bg-secondary",
30
+ "outline-destructive": "border border-destructive bg-background text-destructive hover:bg-destructive hover:text-destructive-foreground",
31
+ "outline-ghost": "border border-transparent bg-background text-foreground hover:bg-accent hover:text-accent-foreground [&>svg]:text-inherit",
32
+ "outline-warning": "border border-warning bg-background text-warning hover:bg-warning hover:text-warning-foreground"
33
+ },
34
+ size: {
35
+ xs: "h-7 rounded-md px-2 text-xs",
36
+ sm: "h-8 pointer-coarse:min-h-10 rounded-md px-3 text-xs",
37
+ md: "h-10 pointer-coarse:min-h-11 px-4 py-2",
38
+ lg: "h-11 rounded-md px-8",
39
+ xl: "h-12 rounded-md px-10",
40
+ "icon-xs": "h-7 w-7",
41
+ "icon-sm": "h-8 w-8",
42
+ "icon-md": "h-10 w-10 pointer-coarse:min-h-11 pointer-coarse:min-w-11",
43
+ "icon-lg": "h-12 w-12",
44
+ "icon-xl": "h-14 w-14"
45
+ }
46
+ },
47
+ defaultVariants: {
48
+ variant: "primary",
49
+ size: "md"
50
+ }
51
+ }), A = Object.assign(({ className: e, variant: n, size: r, ...i }) => /* @__PURE__ */ d("button", {
52
+ className: t("arc-button", k({
53
+ variant: n,
54
+ size: r,
55
+ className: e
56
+ })),
57
+ ...i
58
+ }), { Group: O }), j = ({ doubleClickMsDuration: e = 2e3, feedbackVariant: n = "warning", feedbackContent: r, variant: i = "primary", children: a, onClick: s, onDoubleClick: u, className: p, style: m, ...h }) => {
59
+ let [g, _] = l(!1), [v, y] = l(0), b = c(void 0), x = c(void 0), S = c(0), C = {
60
+ primary: "var(--color-primary)",
61
+ secondary: "var(--color-secondary-foreground)",
62
+ destructive: "var(--color-destructive)",
63
+ warning: "var(--color-warning)"
64
+ }[n ?? "warning"];
65
+ o(() => () => {
66
+ b.current && clearTimeout(b.current), x.current && clearInterval(x.current);
67
+ }, []);
68
+ let w = typeof r == "function" ? r({
69
+ isWaiting: g,
70
+ isActive: !1,
71
+ doubleClickMsDuration: e,
72
+ remainingTime: v,
73
+ variant: i,
74
+ feedbackVariant: n
75
+ }) : r, T = w === void 0 ? a : /* @__PURE__ */ f("span", {
76
+ className: "grid",
77
+ children: [/* @__PURE__ */ d("span", {
78
+ className: t("col-start-1 row-start-1", g ? "invisible" : "visible"),
79
+ "aria-hidden": g,
80
+ children: a
81
+ }), /* @__PURE__ */ d("span", {
82
+ className: t("col-start-1 row-start-1", g ? "visible" : "invisible"),
83
+ "aria-hidden": !g,
84
+ children: w
85
+ })]
86
+ }), E = /* @__PURE__ */ d(A, {
87
+ ...h,
88
+ children: T,
89
+ className: t(p),
90
+ style: { ...m },
91
+ variant: i,
92
+ "data-double-click-state": g ? "waiting" : void 0,
93
+ onClick: (t) => {
94
+ if (g && Date.now() <= S.current) _(!1), y(0), b.current && clearTimeout(b.current), x.current && clearInterval(x.current), u?.(t);
95
+ else {
96
+ let t = Date.now() + e;
97
+ S.current = t, _(!0), y(e), b.current && clearTimeout(b.current), x.current && clearInterval(x.current), x.current = setInterval(() => {
98
+ y(Math.max(0, S.current - Date.now()));
99
+ }, 50), b.current = setTimeout(() => {
100
+ _(!1), y(0), x.current && clearInterval(x.current);
101
+ }, e);
102
+ }
103
+ s?.(t);
104
+ }
105
+ });
106
+ return /* @__PURE__ */ f("span", {
107
+ "aria-label": g ? "Waiting for second click" : void 0,
108
+ className: "arc-double-click-button relative inline-flex",
109
+ "data-double-click-state": g ? "waiting" : void 0,
110
+ children: [E, /* @__PURE__ */ d("span", {
111
+ "aria-hidden": "true",
112
+ className: "arc-double-click-progress-ring pointer-events-none absolute inset-0 rounded-md p-px",
113
+ style: {
114
+ background: g ? `conic-gradient(from 90deg, color-mix(in srgb, ${C} 90%, white) calc(var(--double-click-progress) * 1%), transparent 0)` : "transparent",
115
+ "--double-click-progress": 100,
116
+ "--double-click-timeout": `${e}ms`,
117
+ animation: g ? "double-click-countdown var(--double-click-timeout) linear forwards" : "none"
118
+ }
119
+ })]
120
+ });
121
+ }, M = ({ longPressMsDuration: e = 2500, onLongPress: n, onClick: r, preventClick: i = !0, feedbackVariant: a = "warning", feedbackContent: s, variant: u = "primary", children: p, ...m }) => {
122
+ let h = c(void 0), g = c(void 0), _ = c(0), v = c(!1), [y, b] = l(!1), [x, S] = l(0), C = () => {
123
+ h.current && clearTimeout(h.current), g.current && clearInterval(g.current), h.current = void 0, g.current = void 0;
124
+ };
125
+ o(() => C, []);
126
+ let w = {
127
+ primary: "var(--color-primary)",
128
+ secondary: "var(--color-secondary-foreground)",
129
+ destructive: "var(--color-destructive)",
130
+ warning: "var(--color-warning)"
131
+ }[a], T = typeof s == "function" ? s({
132
+ isPressing: y,
133
+ isActive: v.current,
134
+ longPressMsDuration: e,
135
+ remainingTime: x,
136
+ variant: u,
137
+ feedbackVariant: a
138
+ }) : s, E = T === void 0 ? p : /* @__PURE__ */ f("span", {
139
+ className: "grid",
140
+ children: [/* @__PURE__ */ d("span", {
141
+ className: t("col-start-1 row-start-1", y ? "invisible" : "visible"),
142
+ "aria-hidden": y,
143
+ children: p
144
+ }), /* @__PURE__ */ d("span", {
145
+ className: t("col-start-1 row-start-1", y ? "visible" : "invisible"),
146
+ "aria-hidden": !y,
147
+ children: T
148
+ })]
149
+ });
150
+ return /* @__PURE__ */ f("span", {
151
+ className: "arc-long-press-button relative inline-flex",
152
+ "data-long-press-state": y ? "pressing" : void 0,
153
+ children: [/* @__PURE__ */ d(A, {
154
+ ...m,
155
+ children: E,
156
+ variant: u,
157
+ className: t(m.className),
158
+ "data-long-press-state": y ? "pressing" : void 0,
159
+ onPointerDown: (t) => {
160
+ m.onPointerDown?.(t), v.current = !1, C();
161
+ let r = Date.now() + e;
162
+ _.current = r, b(!0), S(e), g.current = setInterval(() => {
163
+ S(Math.max(0, _.current - Date.now()));
164
+ }, 50), h.current = setTimeout(() => {
165
+ v.current = !0, b(!1), S(0), C(), n?.(t);
166
+ }, e);
167
+ },
168
+ onPointerUp: (e) => {
169
+ m.onPointerUp?.(e), b(!1), S(0), C();
170
+ },
171
+ onPointerLeave: (e) => {
172
+ m.onPointerLeave?.(e), b(!1), S(0), C();
173
+ },
174
+ onClick: (e) => {
175
+ v.current && i ? (e.preventDefault(), e.stopPropagation(), v.current = !1) : r?.(e);
176
+ }
177
+ }), /* @__PURE__ */ d("span", {
178
+ "aria-hidden": "true",
179
+ className: "arc-double-click-progress-ring pointer-events-none absolute inset-0 rounded-md p-px",
180
+ style: {
181
+ background: y ? `conic-gradient(from 90deg, color-mix(in srgb, ${w} 90%, white) calc(var(--double-click-progress) * 1%), transparent 0)` : "transparent",
182
+ "--double-click-progress": 100,
183
+ "--double-click-timeout": `${e}ms`,
184
+ animation: y ? "double-click-countdown var(--double-click-timeout) linear forwards" : "none"
185
+ }
186
+ })]
187
+ });
188
+ };
189
+ //#endregion
190
+ //#region components/hash-navigation.ts
191
+ function N({ intervalMs: e = 500, maxAttempts: t = 20, behavior: n = "smooth", block: r } = {}) {
192
+ if (typeof window > "u") return () => {};
193
+ let i = 0, a = setInterval(() => {
194
+ i += 1;
195
+ let { hash: e } = window.location;
196
+ if (!e || i > t) clearInterval(a);
197
+ else try {
198
+ let t = document.querySelector(e);
199
+ t && (t.scrollIntoView({
200
+ behavior: n,
201
+ block: r
202
+ }), clearInterval(a));
203
+ } catch (t) {
204
+ console.error(`Invalid hash in URL: ${e}`, t), clearInterval(a);
205
+ }
206
+ }, e);
207
+ return () => clearInterval(a);
208
+ }
209
+ function P(e) {
210
+ o(() => N(e), []);
211
+ }
212
+ function F({ container: e, sectionIds: t, hashFirstSection: n = !0, onActiveChange: r }) {
213
+ let i = t.map((e) => document.getElementById(e)).filter((e) => e !== null), a = window.location.hash.toLowerCase().slice(1) || null, o = () => {
214
+ let t = e.getBoundingClientRect(), o = t.top + t.height / 2, s = i.find((e) => {
215
+ let t = e.getBoundingClientRect();
216
+ return t.top <= o && t.bottom > o;
217
+ }), c = s ? i.indexOf(s) : -1;
218
+ if (r?.(c, i), !s || (a === s.id.toLowerCase() && (a = null), c === 0 && a)) return;
219
+ let l = c === 0 && !n ? "" : `#${s.id}`;
220
+ window.location.hash !== l && (window.history.replaceState(window.history.state, "", `${window.location.pathname}${window.location.search}${l}`), window.dispatchEvent(new HashChangeEvent("hashchange")));
221
+ };
222
+ return o(), e.addEventListener("scroll", o, { passive: !0 }), () => e.removeEventListener("scroll", o);
223
+ }
224
+ //#endregion
225
+ //#region components/avatar.tsx
226
+ var I = e("arc-avatar inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full bg-muted ring-1 ring-border transition-all", {
227
+ variants: { size: {
228
+ xs: "size-6 text-xs",
229
+ sm: "size-7 text-sm",
230
+ md: "size-8 text-base",
231
+ lg: "size-10 text-lg",
232
+ xl: "size-12 text-xl"
233
+ } },
234
+ defaultVariants: { size: "md" }
235
+ }), L = ({ name: e, image: n, size: r, className: i, ...a }) => {
236
+ let [c, u] = l(!1), f = n?.trim(), p = !!f && !c, m = s(() => e?.split(" ", 3)?.map((e) => e[0])?.filter((e) => /[A-Za-z]/.test(e))?.join("") || "U", [e]);
237
+ return o(() => {
238
+ u(!1);
239
+ }, [f]), /* @__PURE__ */ d("span", {
240
+ className: t(I({
241
+ size: r,
242
+ className: i
243
+ })),
244
+ ...a,
245
+ children: p ? /* @__PURE__ */ d("img", {
246
+ src: f,
247
+ alt: e ?? "User avatar",
248
+ title: e ?? "User",
249
+ className: "h-full w-full object-cover",
250
+ onError: () => u(!0)
251
+ }) : /* @__PURE__ */ d("span", {
252
+ className: "font-medium leading-none text-foreground",
253
+ title: e ?? "User",
254
+ children: m
255
+ })
256
+ });
257
+ }, R = ({ className: e, ...n }) => /* @__PURE__ */ d("div", {
258
+ role: "separator",
259
+ className: t("arc-divider w-full border-b border-border", e),
260
+ ...n
261
+ }), z = ({ items: e, value: n, onChange: r, className: i, placeholder: a = "Select an option", disabled: o, name: s, preventEmpty: c = !1, "data-name": l, "data-required": u }) => {
262
+ let g = e.find((e) => String(e.key) === String(n)) ?? null;
263
+ return /* @__PURE__ */ d(p.Root, {
264
+ items: e,
265
+ value: g,
266
+ onValueChange: (e) => {
267
+ if (c && e === null) return;
268
+ let t = e !== null && g !== null && String(e.key) === String(g.key);
269
+ r?.(!c && t ? null : e);
270
+ },
271
+ itemToStringLabel: (e) => e?.label ?? "",
272
+ itemToStringValue: (e) => String(e?.key ?? ""),
273
+ isItemEqualToValue: (e, t) => String(e.key) === String(t.key),
274
+ name: s,
275
+ disabled: o,
276
+ children: /* @__PURE__ */ f("div", {
277
+ className: t("arc-dropdown relative", i),
278
+ children: [/* @__PURE__ */ f(p.InputGroup, {
279
+ className: t("relative flex min-h-10 w-full items-center justify-between gap-5 rounded-md border border-border bg-background pr-2 text-foreground shadow-xs", "focus-within:border-transparent focus-within:outline-hidden focus-within:ring-2 focus-within:ring-ring", "data-disabled:cursor-not-allowed data-disabled:bg-muted data-disabled:text-muted-foreground"),
280
+ children: [/* @__PURE__ */ d(p.Input, {
281
+ className: "h-full grow border-none bg-transparent py-2 pl-3 outline-hidden placeholder:text-muted-foreground focus:ring-0 focus:outline-hidden disabled:cursor-not-allowed",
282
+ placeholder: a,
283
+ "data-name": l,
284
+ "data-required": u,
285
+ "data-disabled": o
286
+ }), /* @__PURE__ */ d(p.Trigger, {
287
+ className: "shrink-0 self-center rounded-md focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
288
+ "aria-label": "Toggle options",
289
+ children: /* @__PURE__ */ d(h, {
290
+ className: "h-5 w-5 text-foreground",
291
+ "aria-hidden": "true"
292
+ })
293
+ })]
294
+ }), /* @__PURE__ */ d(p.Portal, { children: /* @__PURE__ */ d(p.Positioner, {
295
+ className: "z-50",
296
+ sideOffset: 8,
297
+ children: /* @__PURE__ */ f(p.Popup, {
298
+ className: "max-h-60 min-w-(--anchor-width) overflow-auto rounded-md border border-border bg-popover text-foreground shadow-lg outline-0",
299
+ children: [/* @__PURE__ */ d(p.Empty, {
300
+ className: "relative cursor-default select-none px-4 py-2 text-muted-foreground empty:hidden",
301
+ children: "No values to show."
302
+ }), /* @__PURE__ */ d(p.List, { children: (e) => /* @__PURE__ */ f(p.Item, {
303
+ value: e,
304
+ disabled: e.disabled,
305
+ className: t("relative flex h-8 w-full cursor-default select-none items-center gap-2 border-b border-border px-4 py-1 last:border-b-0", "data-selected:font-medium data-selected:text-primary", "data-highlighted:bg-accent data-highlighted:text-primary", "data-disabled:cursor-not-allowed data-disabled:opacity-50"),
306
+ children: [/* @__PURE__ */ d(p.ItemIndicator, {
307
+ className: "flex items-center",
308
+ children: /* @__PURE__ */ d(m, {
309
+ className: "h-3 w-3",
310
+ "aria-hidden": "true"
311
+ })
312
+ }), /* @__PURE__ */ d("span", {
313
+ title: e.label,
314
+ className: "block truncate",
315
+ children: e.label
316
+ })]
317
+ }, e.key) })]
318
+ })
319
+ }) })]
320
+ })
321
+ });
322
+ }, B = ({ data: e, className: n, ...r }) => {
323
+ let i = Array.isArray(e) ? e.join(", ") : typeof e == "string" ? e : null;
324
+ return /* @__PURE__ */ d("em", {
325
+ role: "alert",
326
+ className: t("arc-error-text animate-pulse whitespace-nowrap text-base font-semibold text-destructive", n),
327
+ title: i ?? void 0,
328
+ ...r,
329
+ children: i
330
+ });
331
+ }, V = e("arc-input rounded border text-foreground placeholder:text-muted-foreground focus:border-transparent focus:outline-hidden focus:ring-2 focus:ring-ring disabled:cursor-not-allowed disabled:border-muted disabled:bg-muted", {
332
+ variants: {
333
+ variant: {
334
+ default: "border-border bg-background",
335
+ ghost: "border-transparent bg-transparent"
336
+ },
337
+ as: {
338
+ input: "h-10 pointer-coarse:h-11 p-1 pl-2",
339
+ textarea: "min-h-50 max-h-250 resize-y overflow-auto! p-2 whitespace-pre-wrap"
340
+ }
341
+ },
342
+ defaultVariants: {
343
+ variant: "default",
344
+ as: "input"
345
+ }
346
+ }), H = ({ as: e = "input", className: n, variant: r, ...i }) => {
347
+ let a = t(V({
348
+ as: e,
349
+ variant: r
350
+ }), n);
351
+ return d(e === "textarea" ? "textarea" : "input", {
352
+ ...i,
353
+ autoComplete: "off",
354
+ className: a
355
+ });
356
+ }, ee = e("arc-card group relative rounded-lg border border-foreground/40 bg-card/90 p-3 shadow-xs", {
357
+ variants: { variant: {
358
+ primary: "border-primary bg-primary text-primary-foreground",
359
+ secondary: "border-secondary bg-secondary text-secondary-foreground",
360
+ destructive: "border-destructive bg-destructive text-destructive-foreground",
361
+ warning: "border-warning bg-warning text-warning-foreground",
362
+ "outline-primary": "border-primary bg-background text-primary",
363
+ "outline-secondary": "border-secondary-foreground bg-background text-secondary-foreground",
364
+ "outline-destructive": "border-destructive bg-background text-destructive",
365
+ "outline-warning": "border-warning bg-background text-warning"
366
+ } },
367
+ defaultVariants: { variant: "outline-secondary" }
368
+ }), U = (e) => {
369
+ let { className: n, variant: r, hoverable: i = !0, hoverLift: a = !0, hoverBorder: o = !0, hoverGradient: s = !0, postHeaderBorder: c = !0, preFooterBorder: l = !0, onPointerMove: u, ...f } = e, p = i && a, m = i && o, h = i && s;
370
+ return /* @__PURE__ */ d("div", {
371
+ className: t(ee({ variant: r }), h && "arc-card-cursor-border", c && "[&_.arc-card-header]:border-b", !c && "[&_.arc-card-header]:border-b-0", l && "[&_.arc-card-footer]:border-t", !l && "[&_.arc-card-footer]:border-t-0", (p || m) && "transition-[border-color,transform] duration-300 ease-out", p && "hover:-translate-y-1", m && "hover:border-primary", n),
372
+ onPointerMove: h ? (e) => {
373
+ if (u?.(e), !h) return;
374
+ let t = e.currentTarget.getBoundingClientRect();
375
+ e.currentTarget.style.setProperty("--card-pointer-x", `${e.clientX - t.left}px`), e.currentTarget.style.setProperty("--card-pointer-y", `${e.clientY - t.top}px`);
376
+ } : u,
377
+ ...f
378
+ });
379
+ };
380
+ U.Header = (e) => {
381
+ let { className: n, ...r } = e;
382
+ return /* @__PURE__ */ d("h2", {
383
+ className: t("arc-card-header flex w-full typography-heading-3 flex-col border-foreground/40 px-0 pb-1", n),
384
+ ...r
385
+ });
386
+ }, U.Content = (e) => {
387
+ let { className: n, ...r } = e;
388
+ return /* @__PURE__ */ d("div", {
389
+ className: t("arc-card-content typography-paragraph mt-0! w-full justify-between px-0 py-1 whitespace-pre-wrap", n),
390
+ ...r
391
+ });
392
+ }, U.Footer = (e) => {
393
+ let { className: n, ...r } = e;
394
+ return /* @__PURE__ */ d("div", {
395
+ className: t("arc-card-footer typography-muted mt-auto mb-0 flex w-full items-end justify-start border-foreground/40 px-0 pt-1", n),
396
+ ...r
397
+ });
398
+ };
399
+ //#endregion
400
+ //#region components/date-handler.ts
401
+ var W = class e {
402
+ static toDateTime(e) {
403
+ if (e == null || e === "") return g.invalid("missing date");
404
+ if (e instanceof Date) return g.fromJSDate(e);
405
+ if (typeof e == "number") return g.fromMillis(e);
406
+ if (typeof e == "bigint") return g.fromMillis(Number(e));
407
+ if (typeof e == "string") {
408
+ let t = e.trim();
409
+ if (t === "") return g.invalid("missing date");
410
+ if (/^-?\d+$/.test(t)) {
411
+ let e = Number(t.length === 10 ? Number(t) * 1e3 : t);
412
+ return g.fromMillis(e);
413
+ }
414
+ return g.fromISO(t);
415
+ }
416
+ return g.fromJSDate(new Date(String(e)));
417
+ }
418
+ static getDateTime(t, n = "dd/MM/yyyy hh:mm:ss a") {
419
+ let r = e.toDateTime(t);
420
+ return r.isValid ? r.toFormat(n) : "";
421
+ }
422
+ static getRelativeTime(t, n) {
423
+ let r = e.toDateTime(t);
424
+ return r.isValid ? r.toRelative(n) ?? "" : "";
425
+ }
426
+ static getTimeDiff(t) {
427
+ let n = e.toDateTime(t);
428
+ if (!n.isValid) return null;
429
+ let r = n.diffNow([
430
+ "years",
431
+ "quarters",
432
+ "months",
433
+ "weeks",
434
+ "days",
435
+ "hours",
436
+ "minutes",
437
+ "seconds"
438
+ ]).toObject(), i = [];
439
+ for (let e of [
440
+ "years",
441
+ "quarters",
442
+ "months",
443
+ "weeks",
444
+ "days",
445
+ "hours",
446
+ "minutes",
447
+ "seconds"
448
+ ]) r[e] && Math.abs(r[e]) >= 1 && i.push(`${Math.abs(Math.floor(r[e]))} ${e}`);
449
+ return i.length > 0 ? i.join(", ") : null;
450
+ }
451
+ static generateOffsetDateTime({ offset: e, future: t = !0, format: n = "dd/MM/yyyy hh:mm:ss a" }) {
452
+ let r = t ? g.now().plus(e) : g.now().minus(e);
453
+ return n ? r.toFormat(n) : r.toISO();
454
+ }
455
+ static getFormattedTime(t, n = "$ISO$ ($RELATIVE$)") {
456
+ let r = e.getDateTime(t), i = e.getRelativeTime(t);
457
+ return n.replace("$ISO$", r).replace("$RELATIVE$", i);
458
+ }
459
+ }, te = ({ value: e, format: t = "$ISO$ ($RELATIVE$)", ...n }) => {
460
+ let r = s(() => e ? W.getFormattedTime(e, t) : "", [e, t]);
461
+ return /* @__PURE__ */ d(H, {
462
+ type: "text",
463
+ disabled: !0,
464
+ readOnly: !0,
465
+ value: r,
466
+ size: Math.max(r.length, 1),
467
+ ...n
468
+ });
469
+ }, ne = e("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", {
470
+ variants: {
471
+ variant: {
472
+ pill: "arc-pill-link min-w-fit border border-transparent text-base text-muted-foreground transition hover:text-primary hover:outline-none hover:ring-0 focus:outline-none focus-visible:ring-opacity-75",
473
+ primary: "bg-primary text-primary-foreground! hover:bg-primary/90",
474
+ outline: "border border-foreground/40 bg-transparent text-foreground hover:bg-accent hover:text-accent-foreground"
475
+ },
476
+ size: {
477
+ sm: "h-9 px-3",
478
+ md: "h-10 px-4 py-2"
479
+ }
480
+ },
481
+ compoundVariants: [{
482
+ variant: "pill",
483
+ size: "md",
484
+ class: "h-10 pointer-coarse:h-11 px-3 py-2"
485
+ }],
486
+ defaultVariants: {
487
+ variant: "pill",
488
+ size: "md"
489
+ }
490
+ }), re = ({ active: e = !1, className: n, size: r = "md", variant: i = "pill", ...a }) => /* @__PURE__ */ d("a", {
491
+ className: t(ne({
492
+ variant: i,
493
+ size: r
494
+ }), e && {
495
+ pill: "text-primary!",
496
+ primary: "bg-primary/80 ring-2 ring-ring ring-offset-2",
497
+ outline: "border-primary bg-accent text-primary"
498
+ }[i], n),
499
+ "aria-current": e ? "page" : void 0,
500
+ ...a
501
+ }), G = ({ active: e = !1, className: n, ...r }) => /* @__PURE__ */ d("button", {
502
+ type: "button",
503
+ className: t("arc-pill", "inline-flex h-10 pointer-coarse:h-11 w-full items-center justify-center whitespace-nowrap rounded-md border border-transparent px-3 py-2 text-base font-medium text-foreground transition hover:text-primary hover:outline-none hover:ring-0 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-opacity-75", e ? "text-primary!" : "text-muted-foreground", n),
504
+ "aria-pressed": e,
505
+ ...r
506
+ }), K = ({ children: e }) => n.toArray(e).map((e, t) => /* @__PURE__ */ f(r, { children: [t > 0 && /* @__PURE__ */ d(_.Separator, { className: "mx-2 h-px bg-border" }), e] }, t)), q = Object.assign(({ className: e, contentClassName: n, active: r, activeClassName: i, buttonText: a, children: o }) => /* @__PURE__ */ f(_.Root, {
507
+ loopFocus: !0,
508
+ children: [/* @__PURE__ */ f(_.Trigger, {
509
+ render: /* @__PURE__ */ d(G, {
510
+ active: r,
511
+ className: t("w-fit", r && i, e)
512
+ }),
513
+ children: [a, /* @__PURE__ */ d(v, {
514
+ className: "-mr-1 ml-2 h-4 w-4",
515
+ "aria-hidden": "true"
516
+ })]
517
+ }), /* @__PURE__ */ d(_.Portal, { children: /* @__PURE__ */ d(_.Positioner, {
518
+ className: "z-50",
519
+ sideOffset: 8,
520
+ collisionPadding: 8,
521
+ children: /* @__PURE__ */ d(_.Popup, {
522
+ className: t("arc-menu-content z-50 flex bg-popover w-fit min-w-40 max-w-[calc(100vw-1rem)] origin-top-right flex-col overflow-hidden rounded-md border border-border text-foreground shadow-lg ring-1 ring-foreground/10 focus:outline-none", n),
523
+ children: /* @__PURE__ */ d(K, { children: o })
524
+ })
525
+ }) })]
526
+ }), {
527
+ Item: ({ active: e, asChild: r = !1, className: i, nativeButton: o, children: s, ...c }) => {
528
+ let l = t("flex min-h-10 pointer-coarse:min-h-11 w-full cursor-default items-center justify-start rounded-md border border-transparent px-3 py-2 text-base font-medium text-foreground outline-none select-none", "data-highlighted:bg-accent data-highlighted:text-primary", "focus-visible:ring-0", e && "text-primary!", i);
529
+ if (r) {
530
+ let e = n.only(s);
531
+ if (!a(e)) throw Error("Menu.Item with asChild requires a single React element child.");
532
+ return /* @__PURE__ */ d(_.Item, {
533
+ ...c,
534
+ className: l,
535
+ nativeButton: o ?? !0,
536
+ render: e
537
+ });
538
+ }
539
+ return /* @__PURE__ */ d(_.Item, {
540
+ ...c,
541
+ className: l,
542
+ nativeButton: o,
543
+ children: s
544
+ });
545
+ },
546
+ Sub: ({ active: e, buttonText: r, children: i }) => {
547
+ let o = n.toArray(i).some((e) => a(e) && e.props.active), s = e || o;
548
+ return /* @__PURE__ */ f(_.SubmenuRoot, {
549
+ loopFocus: !0,
550
+ children: [/* @__PURE__ */ f(_.SubmenuTrigger, {
551
+ className: t("arc-pill arc-menu-sub-trigger inline-flex h-10 pointer-coarse:h-11 w-full items-center justify-between whitespace-nowrap rounded-md border border-transparent px-3 py-2 text-base font-medium text-foreground transition focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-opacity-75", "data-highlighted:bg-accent data-highlighted:text-primary", s && "text-primary!"),
552
+ children: [r, /* @__PURE__ */ d(y, {
553
+ className: "-mr-1 ml-2 h-4 w-4",
554
+ "aria-hidden": "true"
555
+ })]
556
+ }), /* @__PURE__ */ d(_.Portal, { children: /* @__PURE__ */ d(_.Positioner, {
557
+ className: "z-50",
558
+ side: "right",
559
+ align: "start",
560
+ sideOffset: 8,
561
+ collisionPadding: 8,
562
+ children: /* @__PURE__ */ d(_.Popup, {
563
+ className: "arc-menu-content z-50 flex bg-popover w-fit min-w-40 max-w-[calc(100vw-1rem)] origin-top-right flex-col overflow-hidden rounded-md border border-border text-foreground shadow-lg ring-1 ring-foreground/10 focus:outline-none",
564
+ children: /* @__PURE__ */ d(K, { children: i })
565
+ })
566
+ }) })]
567
+ });
568
+ }
569
+ }), ie = ({ open: e = !1, setOpen: n, children: r, initialFocus: i, headerContent: a, footerContent: s, width: c, height: l, className: u, customKeyHandler: p }) => (o(() => {
570
+ if (!e) return;
571
+ let t = (e) => {
572
+ let t = e.key === "Escape" ? "esc" : (e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "s" ? "ctrl+s" : null;
573
+ t && (e.preventDefault(), t === "esc" && n(!1), p?.(t, e));
574
+ };
575
+ return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
576
+ }, [
577
+ e,
578
+ n,
579
+ p
580
+ ]), /* @__PURE__ */ d(C.Root, {
581
+ open: e,
582
+ onOpenChange: n,
583
+ children: /* @__PURE__ */ f(C.Portal, { children: [/* @__PURE__ */ d(C.Backdrop, { className: t("fixed inset-0 z-10 bg-black/80 transition-opacity duration-300", "data-ending-style:opacity-0 data-starting-style:opacity-0") }), /* @__PURE__ */ d(C.Viewport, {
584
+ className: "fixed inset-0 z-10 flex min-h-dvh items-center justify-center p-4",
585
+ children: /* @__PURE__ */ f(C.Popup, {
586
+ initialFocus: i,
587
+ className: t("arc-modal flex max-h-full w-fit max-w-full flex-col overflow-auto rounded-md border border-border bg-card p-6 text-left align-middle text-foreground shadow-xl", "transition-all duration-300", "data-starting-style:scale-95 data-starting-style:opacity-0", "data-ending-style:scale-95 data-ending-style:opacity-0", u),
588
+ style: {
589
+ width: c,
590
+ height: l
591
+ },
592
+ children: [
593
+ /* @__PURE__ */ d(C.Title, {
594
+ className: "mb-4 border-b border-border pb-2 text-lg font-bold leading-6 text-foreground",
595
+ children: a
596
+ }),
597
+ /* @__PURE__ */ d("div", {
598
+ className: "grow",
599
+ children: r
600
+ }),
601
+ s && /* @__PURE__ */ d("div", {
602
+ className: "mt-auto border-t border-border pt-2",
603
+ children: s
604
+ })
605
+ ]
606
+ })
607
+ })] })
608
+ })), ae = ({ id: e, items: n, value: r, onChange: i, className: a, placeholder: o = "Select options", disabled: s, name: c, preventEmpty: l = !1, "data-name": u, "data-required": g }) => {
609
+ let _ = n.filter((e) => r?.includes(String(e.key)));
610
+ return /* @__PURE__ */ d(p.Root, {
611
+ multiple: !0,
612
+ items: n,
613
+ value: _,
614
+ onValueChange: (e) => {
615
+ l && e.length === 0 || i?.(e);
616
+ },
617
+ itemToStringLabel: (e) => e?.label ?? "",
618
+ itemToStringValue: (e) => String(e?.key ?? ""),
619
+ isItemEqualToValue: (e, t) => String(e.key) === String(t.key),
620
+ name: c,
621
+ disabled: s,
622
+ children: /* @__PURE__ */ f("div", {
623
+ className: t("arc-dropdown-multi relative", a),
624
+ children: [/* @__PURE__ */ f(p.InputGroup, {
625
+ className: t("relative flex min-h-10 w-full items-center justify-between gap-1.5 rounded-md border border-border bg-background py-1 pr-2 pl-2 text-foreground shadow-xs", "focus-within:border-transparent focus-within:outline-hidden focus-within:ring-2 focus-within:ring-ring", "data-disabled:cursor-not-allowed data-disabled:bg-muted data-disabled:text-muted-foreground"),
626
+ children: [/* @__PURE__ */ d(p.Value, { children: (n) => /* @__PURE__ */ f("div", {
627
+ className: "flex min-w-0 grow flex-wrap items-center gap-1.5",
628
+ children: [/* @__PURE__ */ d(p.Chips, {
629
+ className: "flex flex-wrap gap-1.5",
630
+ children: n.map((e) => /* @__PURE__ */ f(p.Chip, {
631
+ className: "inline-flex items-center gap-1 rounded-md border border-border bg-muted px-2 py-0.5 text-sm text-foreground",
632
+ children: [/* @__PURE__ */ d("span", {
633
+ className: "max-w-32 truncate",
634
+ children: e.label
635
+ }), !s && (!l || n.length > 1) && /* @__PURE__ */ d(p.ChipRemove, {
636
+ className: "ml-0.5 cursor-pointer rounded-md hover:text-destructive focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
637
+ "aria-label": `Remove ${e.label}`,
638
+ children: /* @__PURE__ */ d(w, {
639
+ className: "h-3 w-3",
640
+ "aria-hidden": "true"
641
+ })
642
+ })]
643
+ }, e.key))
644
+ }), /* @__PURE__ */ d(p.Input, {
645
+ id: e,
646
+ className: t("h-full min-w-20 grow border-none bg-transparent py-0.5 pl-1 outline-hidden placeholder:text-muted-foreground focus:ring-0 focus:outline-hidden disabled:cursor-not-allowed", n.length > 0 && "placeholder-transparent"),
647
+ placeholder: o,
648
+ "data-name": u,
649
+ "data-required": g,
650
+ "data-disabled": s
651
+ })]
652
+ }) }), /* @__PURE__ */ d(p.Trigger, {
653
+ className: "shrink-0 self-center rounded-md focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
654
+ "aria-label": "Toggle options",
655
+ children: /* @__PURE__ */ d(h, {
656
+ className: "h-5 w-5 text-foreground",
657
+ "aria-hidden": "true"
658
+ })
659
+ })]
660
+ }), /* @__PURE__ */ d(p.Portal, { children: /* @__PURE__ */ d(p.Positioner, {
661
+ className: "z-50",
662
+ sideOffset: 8,
663
+ children: /* @__PURE__ */ f(p.Popup, {
664
+ className: "max-h-60 min-w-(--anchor-width) overflow-auto rounded-md border border-border bg-popover text-foreground shadow-lg outline-0",
665
+ children: [/* @__PURE__ */ d(p.Empty, {
666
+ className: "relative cursor-default select-none px-4 py-2 text-muted-foreground empty:hidden",
667
+ children: "No values to show."
668
+ }), /* @__PURE__ */ d(p.List, { children: (e) => /* @__PURE__ */ f(p.Item, {
669
+ value: e,
670
+ disabled: e.disabled,
671
+ className: t("relative flex h-8 w-full cursor-default select-none items-center gap-2 border-b border-border px-4 py-1 last:border-b-0", "data-selected:font-medium data-selected:text-primary", "data-highlighted:bg-accent data-highlighted:text-primary", "data-disabled:cursor-not-allowed data-disabled:opacity-50"),
672
+ children: [/* @__PURE__ */ d(p.ItemIndicator, {
673
+ className: "flex items-center",
674
+ children: /* @__PURE__ */ d(m, {
675
+ className: "h-3 w-3",
676
+ "aria-hidden": "true"
677
+ })
678
+ }), /* @__PURE__ */ d("span", {
679
+ title: e.label,
680
+ className: "block truncate",
681
+ children: e.label
682
+ })]
683
+ }, e.key) })]
684
+ })
685
+ }) })]
686
+ })
687
+ });
688
+ }, oe = ({ cardContent: e, children: n, trigger: r = "hover", triggerRender: i, side: a = "bottom", align: o = "center", className: s }) => /* @__PURE__ */ f(T.Root, { children: [/* @__PURE__ */ d(T.Trigger, {
689
+ nativeButton: !!i,
690
+ openOnHover: r === "hover",
691
+ render: i ?? /* @__PURE__ */ d("span", {}),
692
+ children: n
693
+ }), /* @__PURE__ */ d(T.Portal, { children: /* @__PURE__ */ d(T.Positioner, {
694
+ className: "z-50",
695
+ side: a,
696
+ align: o,
697
+ sideOffset: 8,
698
+ children: /* @__PURE__ */ d(T.Popup, {
699
+ className: t("arc-preview-card relative w-fit max-w-[calc(100vw-1rem)] rounded-md border border-border bg-popover px-2 py-3 text-foreground shadow-lg ring-1 ring-border/60", "data-[side=bottom]:before:absolute data-[side=bottom]:before:top-0 data-[side=bottom]:before:left-1/2 data-[side=bottom]:before:h-3 data-[side=bottom]:before:w-3 data-[side=bottom]:before:-translate-x-1/2 data-[side=bottom]:before:-translate-y-1/2 data-[side=bottom]:before:rotate-45", "data-[side=bottom]:before:border-t data-[side=bottom]:before:border-l data-[side=bottom]:before:border-border data-[side=bottom]:before:bg-popover", s),
700
+ children: e
701
+ })
702
+ }) })] }), se = ({ id: e, value: n, onChange: r, data: i, className: a, disabled: o, placeholder: s, ...c }) => /* @__PURE__ */ f(E.Root, {
703
+ value: n,
704
+ onValueChange: (e) => {
705
+ e !== null && r(e);
706
+ },
707
+ disabled: o,
708
+ items: i.map((e) => ({
709
+ value: e.key,
710
+ label: typeof e.label == "string" ? e.label : e.key
711
+ })),
712
+ ...c,
713
+ children: [/* @__PURE__ */ f(E.Trigger, {
714
+ id: e,
715
+ className: t("arc-select flex w-full items-center gap-2 overflow-hidden rounded-md border border-border bg-background px-2 py-1 text-foreground shadow-xs focus:outline-none focus-visible:ring-2 focus-visible:ring-ring", "disabled:cursor-not-allowed disabled:bg-muted disabled:text-muted-foreground", a),
716
+ children: [/* @__PURE__ */ d(E.Value, {
717
+ placeholder: s,
718
+ className: "min-w-0 flex-1 truncate text-left"
719
+ }), /* @__PURE__ */ d(E.Icon, {
720
+ className: "shrink-0",
721
+ children: /* @__PURE__ */ d(h, {
722
+ className: "h-3.5 w-3.5 text-muted-foreground",
723
+ "aria-hidden": "true"
724
+ })
725
+ })]
726
+ }), /* @__PURE__ */ d(E.Portal, { children: /* @__PURE__ */ d(E.Positioner, {
727
+ className: "z-50 outline-none",
728
+ sideOffset: 8,
729
+ alignItemWithTrigger: !1,
730
+ side: "bottom",
731
+ align: "start",
732
+ children: /* @__PURE__ */ d(E.Popup, {
733
+ className: "min-w-(--anchor-width) overflow-hidden rounded-md border border-border bg-popover text-foreground shadow-lg outline-none",
734
+ children: /* @__PURE__ */ d(E.List, {
735
+ className: "max-h-60 overflow-auto outline-none",
736
+ children: i.map((e) => /* @__PURE__ */ f(E.Item, {
737
+ value: e.key,
738
+ disabled: e.disabled ?? !1,
739
+ className: t("relative flex w-full cursor-default select-none items-center gap-2 px-2 py-1 outline-none", "data-highlighted:bg-accent data-highlighted:text-primary", "data-selected:font-medium data-selected:text-primary", "data-disabled:cursor-not-allowed data-disabled:opacity-50"),
740
+ children: [/* @__PURE__ */ d(E.ItemIndicator, {
741
+ className: "flex items-center",
742
+ children: /* @__PURE__ */ d(m, {
743
+ className: "h-3 w-3",
744
+ "aria-hidden": "true"
745
+ })
746
+ }), /* @__PURE__ */ d(E.ItemText, {
747
+ className: "block truncate",
748
+ children: e.label
749
+ })]
750
+ }, e.key))
751
+ })
752
+ })
753
+ }) })]
754
+ }), ce = e("arc-tag inline-flex w-fit items-center rounded-full border border-transparent px-1.5 py-0.5 text-xs font-bold", {
755
+ variants: { variant: {
756
+ primary: "bg-primary text-primary-foreground",
757
+ secondary: "border-border bg-secondary text-secondary-foreground",
758
+ success: "bg-success text-success-foreground",
759
+ warning: "bg-warning text-warning-foreground",
760
+ destructive: "bg-destructive text-destructive-foreground",
761
+ outline: "border-border bg-transparent text-foreground"
762
+ } },
763
+ defaultVariants: { variant: "primary" }
764
+ }), le = ({ className: e, variant: n, ...r }) => /* @__PURE__ */ d("div", {
765
+ className: t(ce({
766
+ variant: n,
767
+ className: e
768
+ })),
769
+ ...r
770
+ }), ue = ({ className: e, href: n, text: r, target: i = "_blank", rel: a, ...o }) => /* @__PURE__ */ d("a", {
771
+ className: t("arc-text-link rounded-md text-primary underline transition hover:text-primary/80 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-opacity-75", e),
772
+ href: n,
773
+ target: i,
774
+ rel: a ?? (i === "_blank" ? "noopener noreferrer" : void 0),
775
+ ...o,
776
+ children: r
777
+ }), de = ({ checked: e = !1, onChange: n, disabled: r = !1, variant: i = "primary", children: a, ...o }) => /* @__PURE__ */ d(D.Root, {
778
+ checked: e,
779
+ disabled: r,
780
+ onCheckedChange: n,
781
+ className: t("arc-switch", fe({
782
+ variant: i,
783
+ disabled: r
784
+ })),
785
+ ...o,
786
+ children: a ? a(e) : /* @__PURE__ */ d(D.Thumb, {
787
+ "aria-hidden": "true",
788
+ className: pe({
789
+ variant: i,
790
+ checked: e,
791
+ disabled: r
792
+ })
793
+ })
794
+ }), fe = e("relative inline-flex h-7 w-12 items-center rounded-full border border-border bg-muted transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 hover:not-data-disabled:ring-2 hover:not-data-disabled:ring-ring/60 data-disabled:cursor-not-allowed data-disabled:opacity-60", { variants: {
795
+ variant: {
796
+ danger: "data-checked:bg-destructive",
797
+ success: "data-checked:bg-success",
798
+ primary: "data-checked:bg-primary",
799
+ secondary: "data-checked:bg-secondary"
800
+ },
801
+ disabled: {
802
+ true: "ring-2 ring-border",
803
+ false: ""
804
+ }
805
+ } }), pe = e("absolute top-1/2 inline-block h-5 w-5 -translate-y-1/2 transform rounded-full border shadow-sm transition-[left,background-color,border-color] duration-300 ease-out", {
806
+ variants: {
807
+ variant: {
808
+ primary: "",
809
+ secondary: "",
810
+ danger: "",
811
+ success: ""
812
+ },
813
+ checked: {
814
+ true: "left-6",
815
+ false: "left-1 border-foreground/60 bg-background"
816
+ },
817
+ disabled: {
818
+ true: "border-muted-foreground bg-muted-foreground",
819
+ false: ""
820
+ }
821
+ },
822
+ compoundVariants: [
823
+ {
824
+ variant: "primary",
825
+ checked: !0,
826
+ className: "border-primary-foreground bg-primary-foreground"
827
+ },
828
+ {
829
+ variant: "secondary",
830
+ checked: !0,
831
+ className: "border-secondary-foreground bg-secondary-foreground"
832
+ },
833
+ {
834
+ variant: "danger",
835
+ checked: !0,
836
+ className: "border-destructive-foreground bg-destructive-foreground"
837
+ },
838
+ {
839
+ variant: "success",
840
+ checked: !0,
841
+ className: "border-success-foreground bg-success-foreground"
842
+ },
843
+ {
844
+ variant: "primary",
845
+ checked: !1,
846
+ disabled: !1,
847
+ className: "bg-primary/70"
848
+ },
849
+ {
850
+ variant: "secondary",
851
+ checked: !1,
852
+ disabled: !1,
853
+ className: "bg-secondary/70"
854
+ },
855
+ {
856
+ variant: "danger",
857
+ checked: !1,
858
+ disabled: !1,
859
+ className: "bg-destructive/70"
860
+ },
861
+ {
862
+ variant: "success",
863
+ checked: !1,
864
+ disabled: !1,
865
+ className: "bg-success/70"
866
+ },
867
+ {
868
+ variant: "primary",
869
+ checked: !1,
870
+ disabled: !0,
871
+ className: "border-primary bg-primary/70"
872
+ },
873
+ {
874
+ variant: "secondary",
875
+ checked: !1,
876
+ disabled: !0,
877
+ className: "border-secondary bg-secondary/70"
878
+ },
879
+ {
880
+ variant: "secondary",
881
+ checked: !1,
882
+ disabled: !0,
883
+ className: "border-secondary-foreground/70 bg-secondary-foreground/40"
884
+ },
885
+ {
886
+ variant: "danger",
887
+ checked: !1,
888
+ disabled: !0,
889
+ className: "border-destructive bg-destructive/70"
890
+ },
891
+ {
892
+ variant: "success",
893
+ checked: !1,
894
+ disabled: !0,
895
+ className: "border-success bg-success/70"
896
+ }
897
+ ]
898
+ }), J = {
899
+ light: S,
900
+ dark: x,
901
+ system: b
902
+ }, Y = {
903
+ light: "Light",
904
+ dark: "Dark",
905
+ system: "System"
906
+ }, X = "theme", Z = (e) => e === "dark" || e === "system" && typeof window < "u" && window.matchMedia("(prefers-color-scheme: dark)").matches, me = () => {
907
+ if (typeof window > "u") return "system";
908
+ let e = window.localStorage.getItem(X);
909
+ return e === "light" || e === "dark" || e === "system" ? e : "system";
910
+ }, Q = (e) => e === "system" ? "light" : e === "light" ? "dark" : "system";
911
+ function he({ variant: e = "dropdown", showLabel: n = !1 }) {
912
+ let [r, i] = l(me);
913
+ o(() => {
914
+ typeof window < "u" && (document.documentElement.classList.toggle("dark", Z(r)), window.localStorage.setItem(X, r));
915
+ }, [r]);
916
+ let a = () => {
917
+ i(Q(r));
918
+ };
919
+ if (e === "toggle") {
920
+ let e = J[r], t = Q(r);
921
+ return /* @__PURE__ */ d("div", {
922
+ className: "arc-theme-switcher",
923
+ children: /* @__PURE__ */ f(G, {
924
+ active: Z(r),
925
+ "aria-label": `Switch to ${t} theme`,
926
+ title: `Switch to ${t} theme`,
927
+ onClick: a,
928
+ className: "w-fit gap-3",
929
+ children: [/* @__PURE__ */ d(e, { "aria-hidden": "true" }), n && Y[r]]
930
+ })
931
+ });
932
+ }
933
+ let s = J[r];
934
+ return /* @__PURE__ */ d("div", {
935
+ className: "arc-theme-switcher",
936
+ children: /* @__PURE__ */ f(q, {
937
+ className: "gap-3",
938
+ contentClassName: "min-w-(--anchor-width)",
939
+ buttonText: /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(s, { "aria-hidden": "true" }), n && Y[r]] }),
940
+ children: [
941
+ /* @__PURE__ */ d(q.Item, {
942
+ asChild: !0,
943
+ className: t("border-0! focus-visible:outline-none", n ? "px-3!" : "justify-center! p-0!"),
944
+ children: /* @__PURE__ */ f(G, {
945
+ active: r === "system",
946
+ title: "System Theme",
947
+ onClick: () => {
948
+ i("system");
949
+ },
950
+ className: t("flex w-full gap-3 whitespace-nowrap rounded-t-md rounded-b-none p-2", n ? "justify-start" : "justify-center"),
951
+ children: [/* @__PURE__ */ d(b, {
952
+ className: "size-4",
953
+ "aria-hidden": "true"
954
+ }), n && Y.system]
955
+ })
956
+ }),
957
+ /* @__PURE__ */ d(q.Item, {
958
+ asChild: !0,
959
+ className: t("border-0! focus-visible:outline-none", n ? "px-3!" : "justify-center! p-0!"),
960
+ children: /* @__PURE__ */ f(G, {
961
+ active: r === "light",
962
+ title: "Light Theme",
963
+ onClick: () => {
964
+ i("light");
965
+ },
966
+ className: t("flex w-full gap-3 whitespace-nowrap rounded-none p-2", n ? "justify-start" : "justify-center"),
967
+ children: [/* @__PURE__ */ d(S, {
968
+ className: "size-4",
969
+ "aria-hidden": "true"
970
+ }), n && Y.light]
971
+ })
972
+ }),
973
+ /* @__PURE__ */ d(q.Item, {
974
+ asChild: !0,
975
+ className: t("border-0! focus-visible:outline-none", n ? "px-3!" : "justify-center! p-0!"),
976
+ children: /* @__PURE__ */ f(G, {
977
+ active: r === "dark",
978
+ title: "Dark Theme",
979
+ onClick: () => {
980
+ i("dark");
981
+ },
982
+ className: t("flex w-full gap-3 whitespace-nowrap rounded-b-md rounded-t-none p-2", n ? "justify-start" : "justify-center"),
983
+ children: [/* @__PURE__ */ d(x, {
984
+ className: "size-4",
985
+ "aria-hidden": "true"
986
+ }), n && Y.dark]
987
+ })
988
+ })
989
+ ]
990
+ })
991
+ });
992
+ }
993
+ //#endregion
994
+ //#region components/typing-animation.tsx
995
+ function ge(e) {
996
+ return e === "newline" ? "\n" : e === "comma" ? ", " : "";
997
+ }
998
+ function $(e, t, n, r, i) {
999
+ if (r === "character") return Math.max(0, Math.min(e.length, t + n * i));
1000
+ let a = [...e.matchAll(/\S+\s*/g)].map((e) => e.index + e[0].length), o = t;
1001
+ for (let t = 0; t < n; t += 1) o = i === 1 ? a.find((e) => e > o) ?? e.length : [...a].reverse().find((e) => e < o) ?? 0;
1002
+ return o;
1003
+ }
1004
+ function _e({ strings: e, placeholder: t, perTick: n = {
1005
+ amount: 1,
1006
+ unit: "character"
1007
+ }, msDelay: r = {
1008
+ typing: 110,
1009
+ deleting: 55,
1010
+ hold: 1800,
1011
+ dot: 500
1012
+ }, waitTillVisible: i = !0, pauseWhenHidden: a = !0, loop: s = e.length > 1, minVisiblePercent: u = 0, afterString: p = "clear", trailingDot: m = !1 }) {
1013
+ let h = r?.typing ?? 110, g = r?.deleting ?? 55, _ = r?.hold ?? 1800, v = r?.dot ?? 500, y = n?.amount ?? 1, b = Number.isFinite(y) ? Math.max(1, Math.floor(y)) : 1, x = n?.unit ?? "character", [S, C] = l(""), [w, T] = l([]), [E, D] = l(!i), [O, k] = l(!1), [A, j] = l(!1), M = c(null), N = c(0), P = c(0), F = c(0), I = c(""), L = c(!1);
1014
+ o(() => {
1015
+ if (!i) return;
1016
+ let e = M.current;
1017
+ if (!e) return;
1018
+ let t = new IntersectionObserver(([e]) => {
1019
+ e.isIntersecting ? D(!0) : a && D(!1);
1020
+ }, {
1021
+ root: e.closest("main"),
1022
+ threshold: Math.min(100, Math.max(0, u)) / 100
1023
+ });
1024
+ return t.observe(e), () => t.disconnect();
1025
+ }, [
1026
+ a,
1027
+ i,
1028
+ u
1029
+ ]), o(() => {
1030
+ if (!E || e.length === 0) return;
1031
+ let t, n = p !== "clear";
1032
+ N.current = 0, P.current = 0, F.current = 0, I.current = "", L.current = !1, C(""), T([]), k(!1);
1033
+ let r = () => {
1034
+ if (!s && N.current >= e.length) return;
1035
+ k(!1);
1036
+ let i = e[N.current], a = i.match(/^<--delay-(\d+)-->$/);
1037
+ if (a) {
1038
+ if (F.current === 0 && (F.current = Number(a[1]), I.current = ""), F.current <= 0) {
1039
+ N.current += 1, t = setTimeout(r, h);
1040
+ return;
1041
+ }
1042
+ I.current += `${I.current ? " " : ""}.`, C(I.current), --F.current, F.current === 0 && (N.current += 1), t = setTimeout(r, 1e3);
1043
+ return;
1044
+ }
1045
+ if (n && i === "<--clearAll-->") {
1046
+ T([]), C(""), N.current += 1, P.current = 0, t = setTimeout(r, _);
1047
+ return;
1048
+ }
1049
+ if (L.current) P.current = $(i, P.current, b, x, -1), C(i.slice(0, P.current)), P.current === 0 && (L.current = !1, N.current = (N.current + 1) % e.length);
1050
+ else {
1051
+ if (P.current = $(i, P.current, b, x, 1), C(i.slice(0, P.current)), L.current = !n && P.current === i.length && (s || N.current < e.length - 1), !n && P.current === i.length && !L.current && !s) {
1052
+ k(!0);
1053
+ return;
1054
+ }
1055
+ n && P.current === i.length && (T((e) => [...e, i]), C(""), N.current += 1, P.current = 0);
1056
+ }
1057
+ let o = P.current >= i.length || n && P.current === 0 ? _ : L.current ? g : h;
1058
+ k(o === _), t = setTimeout(r, o);
1059
+ };
1060
+ return r(), () => clearTimeout(t);
1061
+ }, [
1062
+ g,
1063
+ E,
1064
+ s,
1065
+ _,
1066
+ p,
1067
+ e,
1068
+ b,
1069
+ x,
1070
+ h
1071
+ ]), o(() => {
1072
+ if (!m || !O) {
1073
+ j(!1);
1074
+ return;
1075
+ }
1076
+ j(!0);
1077
+ let e = setInterval(() => j((e) => !e), v);
1078
+ return () => clearInterval(e);
1079
+ }, [
1080
+ m,
1081
+ O,
1082
+ v
1083
+ ]);
1084
+ let R = A ? "." : "", z = p !== "clear", B = ge(p), V = w.reduce((e, t) => e + t.split("\n").length, 0);
1085
+ return z ? /* @__PURE__ */ d("div", {
1086
+ ref: (e) => {
1087
+ M.current = e;
1088
+ },
1089
+ className: "arc-typing-animation overflow-hidden",
1090
+ style: { "--typing-roll-offset": V },
1091
+ children: /* @__PURE__ */ f("div", {
1092
+ className: "whitespace-pre-line",
1093
+ children: [
1094
+ w.join(B),
1095
+ S && `${w.length > 0 ? B : ""}${S}`,
1096
+ R
1097
+ ]
1098
+ })
1099
+ }) : /* @__PURE__ */ f("span", {
1100
+ ref: (e) => {
1101
+ M.current = e;
1102
+ },
1103
+ className: "arc-typing-animation inline-grid align-top",
1104
+ children: [/* @__PURE__ */ f("span", {
1105
+ "aria-hidden": "true",
1106
+ className: "invisible col-start-1 row-start-1 whitespace-pre-line",
1107
+ children: [t ?? e[0], m && "."]
1108
+ }), /* @__PURE__ */ f("span", {
1109
+ className: "col-start-1 row-start-1 whitespace-pre-line",
1110
+ children: [S, R]
1111
+ })]
1112
+ });
1113
+ }
1114
+ //#endregion
1115
+ export { L as Avatar, A as Button, O as ButtonGroup, U as Card, W as DateHandler, R as Divider, j as DoubleClickButton, z as Dropdown, B as ErrorText, H as Input, te as InputTimestamp, M as LongPressButton, q as Menu, ie as Modal, ae as MultiDropdown, G as Pill, re as PillLink, oe as PreviewCard, se as Select, de as Switch, le as Tag, ue as TextLink, he as ThemeSwitcher, _e as TypingAnimation, N as navigateToHashOnLoad, F as updateHashOnScroll, P as useHashNavigationOnLoad };