@mithrl/design-system 0.1.0

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 (39) hide show
  1. package/README.md +63 -0
  2. package/dist/components/account-menu/AccountMenu.d.ts +27 -0
  3. package/dist/components/avatar/Avatar.d.ts +38 -0
  4. package/dist/components/badge/Badge.d.ts +28 -0
  5. package/dist/components/button/Button.d.ts +28 -0
  6. package/dist/components/checkbox/Checkbox.d.ts +27 -0
  7. package/dist/components/dialog/Dialog.d.ts +94 -0
  8. package/dist/components/dropdown-menu/DropdownMenu.d.ts +102 -0
  9. package/dist/components/field/Field.d.ts +62 -0
  10. package/dist/components/field-label/FieldLabel.d.ts +32 -0
  11. package/dist/components/field-message/FieldMessage.d.ts +23 -0
  12. package/dist/components/file-dropzone/FileDropzone.d.ts +54 -0
  13. package/dist/components/global-app-bar/GlobalAppBar.d.ts +77 -0
  14. package/dist/components/icon/Icon.d.ts +41 -0
  15. package/dist/components/icon-button/IconButton.d.ts +57 -0
  16. package/dist/components/link/Link.d.ts +39 -0
  17. package/dist/components/panel-tabs/PanelTabs.d.ts +46 -0
  18. package/dist/components/progress-indicator/ProgressIndicator.d.ts +28 -0
  19. package/dist/components/project-card/ProjectCard.d.ts +59 -0
  20. package/dist/components/radio/Radio.d.ts +23 -0
  21. package/dist/components/segmented-tabs/SegmentedTabs.d.ts +61 -0
  22. package/dist/components/select/Select.d.ts +40 -0
  23. package/dist/components/separator/Separator.d.ts +35 -0
  24. package/dist/components/skeleton/Skeleton.d.ts +17 -0
  25. package/dist/components/standard-tabs/StandardTabs.d.ts +54 -0
  26. package/dist/components/switch/Switch.d.ts +61 -0
  27. package/dist/components/tag/Tag.d.ts +27 -0
  28. package/dist/components/text-field/TextField.d.ts +46 -0
  29. package/dist/components/textarea/Textarea.d.ts +44 -0
  30. package/dist/components/toggle-button/ToggleButton.d.ts +47 -0
  31. package/dist/components/tooltip/Tooltip.d.ts +46 -0
  32. package/dist/components/upload-queue/UploadQueue.d.ts +73 -0
  33. package/dist/index.d.ts +67 -0
  34. package/dist/index.js +3869 -0
  35. package/dist/patterns/new-project-dialog/NewProjectDialog.d.ts +42 -0
  36. package/dist/patterns/project-library/ProjectLibrary.d.ts +101 -0
  37. package/dist/styles.css +2 -0
  38. package/dist/styles.d.ts +1 -0
  39. package/package.json +79 -0
package/dist/index.js ADDED
@@ -0,0 +1,3869 @@
1
+ import { cva as e } from "class-variance-authority";
2
+ import { ArrowUpDown as t, Check as n, ChevronDown as r, CircleAlert as i, CircleCheck as a, File as o, FilePlus2 as s, Folder as c, FolderPlus as l, Grid2X2 as u, List as d, LoaderCircle as f, LogOut as p, Minus as m, Moon as h, Plus as g, RotateCcw as _, Search as v, Settings as y, Sun as b, Upload as x, UserRound as S, X as C } from "lucide-react";
3
+ import { Fragment as w, cloneElement as T, forwardRef as E, isValidElement as D, useCallback as O, useEffect as k, useId as A, useImperativeHandle as j, useLayoutEffect as M, useMemo as N, useRef as P, useState as F } from "react";
4
+ import { Fragment as I, jsx as L, jsxs as R } from "react/jsx-runtime";
5
+ import { createPortal as ee, flushSync as te } from "react-dom";
6
+ import { Menu as z } from "@base-ui/react/menu";
7
+ import { Dialog as B } from "@base-ui/react/dialog";
8
+ //#region src/components/button/Button.tsx
9
+ var V = e("mithrl-button", {
10
+ variants: {
11
+ variant: {
12
+ brand: "mithrl-button--brand",
13
+ primary: "mithrl-button--primary",
14
+ secondary: "mithrl-button--secondary",
15
+ outline: "mithrl-button--outline",
16
+ ghost: "mithrl-button--ghost",
17
+ destructive: "mithrl-button--destructive",
18
+ text: "mithrl-button--text"
19
+ },
20
+ size: {
21
+ compact: "mithrl-button--compact",
22
+ default: "mithrl-button--default",
23
+ comfortable: "mithrl-button--comfortable",
24
+ large: "mithrl-button--large"
25
+ }
26
+ },
27
+ defaultVariants: {
28
+ variant: "primary",
29
+ size: "default"
30
+ }
31
+ }), H = {
32
+ compact: "var(--size-icon-small)",
33
+ default: "var(--size-icon-default)",
34
+ comfortable: "var(--size-icon-default)",
35
+ large: "var(--size-icon-medium)"
36
+ }, U = E(function({ variant: e = "primary", size: t = "default", loading: n = !1, leadingIcon: r, trailingIcon: i, disabled: a, children: o, className: s, type: c = "button", style: l, ...u }, d) {
37
+ let p = e ?? "primary", m = t ?? "default", h = a || n, g = H[m], _ = {
38
+ ...l,
39
+ "--button-spinner-size": g
40
+ };
41
+ return /* @__PURE__ */ R("button", {
42
+ ...u,
43
+ ref: d,
44
+ type: c,
45
+ className: V({
46
+ variant: p,
47
+ size: m,
48
+ className: s
49
+ }),
50
+ style: _,
51
+ disabled: h,
52
+ "aria-busy": n || void 0,
53
+ "data-variant": p,
54
+ "data-size": m,
55
+ "data-loading": n ? "" : void 0,
56
+ children: [/* @__PURE__ */ R("span", {
57
+ className: "mithrl-button__content",
58
+ children: [
59
+ r ? /* @__PURE__ */ L("span", {
60
+ className: "mithrl-button__icon",
61
+ "aria-hidden": "true",
62
+ children: r
63
+ }) : null,
64
+ /* @__PURE__ */ L("span", {
65
+ className: "mithrl-button__label",
66
+ children: o
67
+ }),
68
+ i ? /* @__PURE__ */ L("span", {
69
+ className: "mithrl-button__icon",
70
+ "aria-hidden": "true",
71
+ children: i
72
+ }) : null
73
+ ]
74
+ }), n ? /* @__PURE__ */ L(f, {
75
+ className: "mithrl-button__spinner",
76
+ size: "var(--button-spinner-size)",
77
+ strokeWidth: 2,
78
+ "aria-hidden": "true"
79
+ }) : null]
80
+ });
81
+ }), W = e("mithrl-icon", {
82
+ variants: { size: {
83
+ xsmall: "mithrl-icon--xsmall",
84
+ small: "mithrl-icon--small",
85
+ default: "mithrl-icon--default",
86
+ medium: "mithrl-icon--medium",
87
+ large: "mithrl-icon--large"
88
+ } },
89
+ defaultVariants: { size: "default" }
90
+ });
91
+ function G({ glyph: e, size: t = "default", label: n, className: r, ...i }) {
92
+ let a = t ?? "default", o = n?.trim(), s = o ? {
93
+ role: "img",
94
+ "aria-label": o
95
+ } : { "aria-hidden": !0 };
96
+ return /* @__PURE__ */ L("span", {
97
+ ...i,
98
+ ...s,
99
+ className: W({
100
+ size: a,
101
+ className: r
102
+ }),
103
+ "data-size": a,
104
+ children: /* @__PURE__ */ L(e, {
105
+ strokeWidth: 2,
106
+ "aria-hidden": "true",
107
+ focusable: "false"
108
+ })
109
+ });
110
+ }
111
+ //#endregion
112
+ //#region src/components/icon-button/IconButton.tsx
113
+ var ne = e("mithrl-icon-button", {
114
+ variants: {
115
+ variant: {
116
+ brand: "mithrl-icon-button--brand",
117
+ primary: "mithrl-icon-button--primary",
118
+ secondary: "mithrl-icon-button--secondary",
119
+ outline: "mithrl-icon-button--outline",
120
+ ghost: "mithrl-icon-button--ghost",
121
+ destructive: "mithrl-icon-button--destructive"
122
+ },
123
+ size: {
124
+ compact: "mithrl-icon-button--compact",
125
+ default: "mithrl-icon-button--default",
126
+ comfortable: "mithrl-icon-button--comfortable",
127
+ large: "mithrl-icon-button--large"
128
+ }
129
+ },
130
+ defaultVariants: {
131
+ variant: "primary",
132
+ size: "default"
133
+ }
134
+ }), K = {
135
+ compact: "small",
136
+ default: "default",
137
+ comfortable: "medium",
138
+ large: "large"
139
+ }, q = E(function({ variant: e = "primary", size: t = "default", loading: n = !1, icon: r, disabled: i, className: a, type: o = "button", style: s, "aria-label": c, ...l }, u) {
140
+ let d = e ?? "primary", p = t ?? "default", m = c?.trim();
141
+ if (!m) throw Error("IconButton requires a non-empty aria-label.");
142
+ let h = i || n, g = K[p], _ = {
143
+ ...s,
144
+ "--icon-button-spinner-size": `var(--size-icon-${g})`
145
+ };
146
+ return /* @__PURE__ */ L("button", {
147
+ ...l,
148
+ ref: u,
149
+ type: o,
150
+ "aria-label": m,
151
+ className: ne({
152
+ variant: d,
153
+ size: p,
154
+ className: a
155
+ }),
156
+ style: _,
157
+ disabled: h,
158
+ "aria-busy": n || void 0,
159
+ "data-variant": d,
160
+ "data-size": p,
161
+ "data-loading": n ? "" : void 0,
162
+ children: n ? /* @__PURE__ */ L(f, {
163
+ className: "mithrl-icon-button__spinner",
164
+ size: "var(--icon-button-spinner-size)",
165
+ strokeWidth: 2,
166
+ "aria-hidden": "true"
167
+ }) : /* @__PURE__ */ L(G, {
168
+ glyph: r,
169
+ size: g
170
+ })
171
+ });
172
+ }), J = e("mithrl-segmented-tabs", {
173
+ variants: { size: {
174
+ sm: "mithrl-segmented-tabs--sm",
175
+ md: "mithrl-segmented-tabs--md",
176
+ lg: "mithrl-segmented-tabs--lg"
177
+ } },
178
+ defaultVariants: { size: "md" }
179
+ }), Y = typeof window > "u" ? k : M, X = {
180
+ sm: "small",
181
+ md: "default",
182
+ lg: "medium"
183
+ };
184
+ function re(e) {
185
+ if (e.length < 2) throw Error("SegmentedTabs requires at least two items.");
186
+ let t = /* @__PURE__ */ new Set();
187
+ for (let n of e) {
188
+ let e = n.value.trim(), r = n.label.trim();
189
+ if (!e || !r) throw Error("SegmentedTabs items require non-empty value and label fields.");
190
+ if (t.has(e)) throw Error(`SegmentedTabs item values must be unique: "${e}".`);
191
+ t.add(e);
192
+ }
193
+ }
194
+ function ie(e) {
195
+ return e.trim().replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-|-$/g, "");
196
+ }
197
+ var ae = E(function({ items: e, value: t, defaultValue: n, onValueChange: r, size: i = "md", activationMode: a = "automatic", fullWidth: o = !1, className: s, style: c, "aria-label": l, "aria-labelledby": u, ...d }, f) {
198
+ if (re(e), !l?.trim() && !u?.trim()) throw Error("SegmentedTabs requires aria-label or aria-labelledby.");
199
+ let p = e.filter((e) => !e.disabled), m = p[0]?.value ?? e[0].value, h = P(e);
200
+ if (n !== void 0 && !h.current.some((e) => e.value === n)) throw Error("SegmentedTabs defaultValue must reference an item.");
201
+ if (t !== void 0 && !e.some((e) => e.value === t)) throw Error("SegmentedTabs value must reference an item.");
202
+ let [g, _] = F(n ?? m), v = e.some((e) => e.value === g) ? g : m, y = t ?? v, b = e.find((e) => e.value === y)?.disabled ? p[0]?.value : y, x = i ?? "md", S = A().replace(/:/g, ""), C = P(null), w = P([]), [T, E] = F({
203
+ ready: !1,
204
+ width: 0,
205
+ x: 0
206
+ }), [D, j] = F([]);
207
+ k(() => {
208
+ t === void 0 && g !== v && (_(v), r?.(v));
209
+ }, [
210
+ v,
211
+ g,
212
+ r,
213
+ t
214
+ ]);
215
+ let M = O((e) => {
216
+ C.current = e, typeof f == "function" ? f(e) : f && (f.current = e);
217
+ }, [f]);
218
+ Y(() => {
219
+ let t = C.current, n = e.findIndex((e) => e.value === y), r = w.current[n];
220
+ if (!t || !r) return;
221
+ let i = () => {
222
+ let n = t.getBoundingClientRect(), i = r.getBoundingClientRect(), a = i.width, o = i.left - n.left;
223
+ E((e) => e.ready && e.width === a && e.x === o ? e : {
224
+ ready: !0,
225
+ width: a,
226
+ x: o
227
+ });
228
+ let s = e.filter((e, t) => {
229
+ let n = w.current[t]?.querySelector(".mithrl-segmented-tabs__label");
230
+ return n ? n.scrollWidth > n.clientWidth + 1 : !1;
231
+ }).map((e) => e.value);
232
+ j((e) => e.length === s.length && e.every((e, t) => e === s[t]) ? e : s);
233
+ };
234
+ if (i(), typeof ResizeObserver > "u") return window.addEventListener("resize", i), () => window.removeEventListener("resize", i);
235
+ let a = new ResizeObserver(i);
236
+ return a.observe(t), w.current.forEach((e) => {
237
+ e && a.observe(e);
238
+ }), () => a.disconnect();
239
+ }, [
240
+ o,
241
+ e,
242
+ x,
243
+ y
244
+ ]);
245
+ let N = {
246
+ ...c,
247
+ "--segmented-tabs-indicator-width": `${T.width}px`,
248
+ "--segmented-tabs-indicator-x": `${T.x}px`
249
+ }, I = (e) => {
250
+ t === void 0 && _(e), e !== y && r?.(e);
251
+ }, ee = (t, n) => {
252
+ let r = e.map((e, t) => e.disabled ? -1 : t).filter((e) => e >= 0), i = r.indexOf(n), o = getComputedStyle(t.currentTarget).direction, s;
253
+ switch (t.key) {
254
+ case "ArrowRight":
255
+ s = o === "rtl" ? i - 1 : i + 1;
256
+ break;
257
+ case "ArrowLeft":
258
+ s = o === "rtl" ? i + 1 : i - 1;
259
+ break;
260
+ case "Home":
261
+ s = 0;
262
+ break;
263
+ case "End":
264
+ s = r.length - 1;
265
+ break;
266
+ case "Enter":
267
+ case " ":
268
+ a === "manual" && (t.preventDefault(), I(e[n].value));
269
+ return;
270
+ default: return;
271
+ }
272
+ t.preventDefault();
273
+ let c = r[((s ?? 0) % r.length + r.length) % r.length], l = e[c];
274
+ w.current[c]?.focus(), a === "automatic" && I(l.value);
275
+ };
276
+ return /* @__PURE__ */ R("div", {
277
+ ...d,
278
+ ref: M,
279
+ role: "tablist",
280
+ "aria-label": l?.trim() || void 0,
281
+ "aria-labelledby": u?.trim() || void 0,
282
+ className: J({
283
+ size: x,
284
+ className: s
285
+ }),
286
+ "data-size": x,
287
+ "data-full-width": o ? "" : void 0,
288
+ "data-activation-mode": a,
289
+ "data-indicator-ready": T.ready ? "" : void 0,
290
+ style: N,
291
+ children: [/* @__PURE__ */ L("span", {
292
+ className: "mithrl-segmented-tabs__indicator",
293
+ "aria-hidden": "true"
294
+ }), e.map((e, t) => {
295
+ let n = e.value === y, r = D.includes(e.value);
296
+ return /* @__PURE__ */ R("button", {
297
+ ref: (e) => {
298
+ w.current[t] = e;
299
+ },
300
+ id: e.id ?? `mithrl-segmented-tabs-${S}-${t}-${ie(e.value) || "tab"}`,
301
+ className: "mithrl-segmented-tabs__tab",
302
+ type: "button",
303
+ role: "tab",
304
+ "aria-selected": n,
305
+ "aria-controls": e.panelId,
306
+ "aria-disabled": e.disabled || void 0,
307
+ disabled: e.disabled,
308
+ tabIndex: e.value === b && !e.disabled ? 0 : -1,
309
+ "data-value": e.value,
310
+ "data-selected": n ? "" : void 0,
311
+ "data-disabled": e.disabled ? "" : void 0,
312
+ title: r ? e.label : void 0,
313
+ onClick: () => I(e.value),
314
+ onKeyDown: (e) => ee(e, t),
315
+ children: [
316
+ e.icon ? /* @__PURE__ */ L(G, {
317
+ className: "mithrl-segmented-tabs__icon",
318
+ glyph: e.icon,
319
+ size: X[x]
320
+ }) : null,
321
+ /* @__PURE__ */ L("span", {
322
+ className: "mithrl-segmented-tabs__label",
323
+ "data-overflowing": r ? "" : void 0,
324
+ children: e.label
325
+ }),
326
+ e.badge !== void 0 && e.badge !== null ? /* @__PURE__ */ L("span", {
327
+ className: "mithrl-segmented-tabs__badge",
328
+ children: e.badge
329
+ }) : null
330
+ ]
331
+ }, e.value);
332
+ })]
333
+ });
334
+ });
335
+ //#endregion
336
+ //#region src/components/panel-tabs/PanelTabs.tsx
337
+ function oe(e, t, n) {
338
+ if (e.length === 0) throw Error("PanelTabs requires at least one item.");
339
+ let r = /* @__PURE__ */ new Set();
340
+ for (let t of e) {
341
+ let e = t.value.trim(), i = t.label.trim();
342
+ if (!e || !i) throw Error("PanelTabs items require non-empty value and label fields.");
343
+ if (t.value !== e) throw Error("PanelTabs item values must not contain leading or trailing whitespace.");
344
+ if (r.has(t.value)) throw Error(`PanelTabs item values must be unique: "${t.value}".`);
345
+ if (t.closable && !n) throw Error("PanelTabs closable items require an onClose callback.");
346
+ if (t.closeLabel !== void 0 && !t.closeLabel.trim()) throw Error("PanelTabs closeLabel must not be empty.");
347
+ r.add(t.value);
348
+ }
349
+ if (t !== void 0 && !r.has(t)) throw Error("PanelTabs value must reference an item.");
350
+ }
351
+ function se(e) {
352
+ return e.trim().replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-|-$/g, "");
353
+ }
354
+ function ce({ children: e }) {
355
+ let t = P(null), [n, r] = F(!1), [i, a] = F("ltr");
356
+ return k(() => {
357
+ let e = t.current;
358
+ if (!e) return;
359
+ let n = () => {
360
+ r(e.scrollWidth > e.clientWidth + 1);
361
+ let t = getComputedStyle(e).direction === "rtl" ? "rtl" : "ltr";
362
+ a((e) => e === t ? e : t);
363
+ };
364
+ n();
365
+ let i;
366
+ typeof ResizeObserver > "u" ? window.addEventListener("resize", n) : (i = new ResizeObserver(n), i.observe(e));
367
+ let o;
368
+ if (typeof MutationObserver < "u") {
369
+ o = new MutationObserver(n);
370
+ let t = e;
371
+ for (; t;) o.observe(t, {
372
+ attributes: !0,
373
+ attributeFilter: [
374
+ "class",
375
+ "dir",
376
+ "style"
377
+ ]
378
+ }), t = t.parentElement;
379
+ }
380
+ return () => {
381
+ window.removeEventListener("resize", n), i?.disconnect(), o?.disconnect();
382
+ };
383
+ }, [e]), /* @__PURE__ */ L("span", {
384
+ ref: t,
385
+ className: "mithrl-panel-tabs__label",
386
+ "data-truncated": n ? "" : void 0,
387
+ "data-direction": i,
388
+ children: e
389
+ });
390
+ }
391
+ var le = E(function({ items: e, value: t, defaultValue: n, onValueChange: r, onClose: i, className: a, "aria-label": o, "aria-labelledby": s, ...c }, l) {
392
+ if (oe(e, t, i), !o?.trim() && !s?.trim()) throw Error("PanelTabs requires aria-label or aria-labelledby.");
393
+ let u = P(e);
394
+ if (n !== void 0 && !u.current.some((e) => e.value === n)) throw Error("PanelTabs defaultValue must reference an item.");
395
+ let d = A().replace(/:/g, ""), [f, p] = F(n ?? e[0].value), m = P(null), h = m.current?.focusValue, g = e.some((e) => e.value === f) ? f : h && e.some((e) => e.value === h) ? h : e[0].value, _ = t ?? g, v = P([]);
396
+ k(() => {
397
+ t === void 0 && f !== g && (p(g), r?.(g));
398
+ }, [
399
+ g,
400
+ f,
401
+ r,
402
+ t
403
+ ]), k(() => {
404
+ let t = m.current;
405
+ if (!t || e.some((e) => e.value === t.closedValue)) return;
406
+ let n = e.findIndex((e) => e.value === t.focusValue), r = e.findIndex((e) => e.value === _);
407
+ v.current[n >= 0 ? n : Math.max(r, 0)]?.focus(), m.current = null;
408
+ }, [e, _]), k(() => {
409
+ let t = e.findIndex((e) => e.value === _);
410
+ v.current[t]?.scrollIntoView?.({
411
+ block: "nearest",
412
+ inline: "nearest"
413
+ });
414
+ }, [_]);
415
+ let y = (e) => {
416
+ t === void 0 && p(e), e !== _ && r?.(e);
417
+ }, b = (t) => {
418
+ let n = e[t];
419
+ if (!n.closable || !i) return;
420
+ let r = e[t + 1] ?? e[t - 1], a = n.value === _ ? r?.value : _;
421
+ m.current = a ? {
422
+ closedValue: n.value,
423
+ focusValue: a
424
+ } : null, i(n.value);
425
+ }, x = (t, n) => {
426
+ let r = getComputedStyle(t.currentTarget).direction, i;
427
+ switch (t.key) {
428
+ case "ArrowRight":
429
+ i = r === "rtl" ? n - 1 : n + 1;
430
+ break;
431
+ case "ArrowLeft":
432
+ i = r === "rtl" ? n + 1 : n - 1;
433
+ break;
434
+ case "Home":
435
+ i = 0;
436
+ break;
437
+ case "End":
438
+ i = e.length - 1;
439
+ break;
440
+ case "Delete":
441
+ e[n].closable && (t.preventDefault(), b(n));
442
+ return;
443
+ default: return;
444
+ }
445
+ t.preventDefault();
446
+ let a = ((i ?? 0) % e.length + e.length) % e.length, o = e[a];
447
+ v.current[a]?.focus(), y(o.value);
448
+ }, S = (e, t) => {
449
+ e.stopPropagation(), b(t);
450
+ }, w = ["mithrl-panel-tabs", a].filter(Boolean).join(" ");
451
+ return /* @__PURE__ */ L("div", {
452
+ ...c,
453
+ ref: l,
454
+ role: "tablist",
455
+ "aria-label": o?.trim() || void 0,
456
+ "aria-labelledby": s?.trim() || void 0,
457
+ "aria-orientation": "horizontal",
458
+ className: w,
459
+ "data-count": e.length,
460
+ children: e.map((e, t) => {
461
+ let n = e.value === _, r = e.id ?? `mithrl-panel-tab-${d}-${t}-${se(e.value) || "tab"}`, i = e.closeLabel?.trim() || `Close ${e.label}`;
462
+ return /* @__PURE__ */ R("div", {
463
+ className: "mithrl-panel-tabs__item",
464
+ role: "presentation",
465
+ "data-selected": n ? "" : void 0,
466
+ "data-closable": e.closable ? "" : void 0,
467
+ children: [/* @__PURE__ */ R("button", {
468
+ ref: (e) => {
469
+ v.current[t] = e;
470
+ },
471
+ id: r,
472
+ className: "mithrl-panel-tabs__tab",
473
+ type: "button",
474
+ role: "tab",
475
+ "aria-selected": n,
476
+ "aria-controls": e.panelId,
477
+ tabIndex: n ? 0 : -1,
478
+ title: e.label,
479
+ "data-value": e.value,
480
+ onClick: () => y(e.value),
481
+ onKeyDown: (e) => x(e, t),
482
+ children: [e.icon ? /* @__PURE__ */ L(G, {
483
+ className: "mithrl-panel-tabs__icon",
484
+ glyph: e.icon,
485
+ size: "small"
486
+ }) : null, /* @__PURE__ */ L(ce, { children: e.label })]
487
+ }), e.closable ? /* @__PURE__ */ L("button", {
488
+ className: "mithrl-panel-tabs__close",
489
+ type: "button",
490
+ "aria-label": i,
491
+ title: i,
492
+ tabIndex: n ? 0 : -1,
493
+ onClick: (e) => S(e, t),
494
+ children: /* @__PURE__ */ L(G, {
495
+ glyph: C,
496
+ size: "xsmall"
497
+ })
498
+ }) : null]
499
+ }, e.value);
500
+ })
501
+ });
502
+ });
503
+ //#endregion
504
+ //#region src/components/switch/Switch.tsx
505
+ function ue(...e) {
506
+ return e.filter(Boolean).join(" ");
507
+ }
508
+ function de(e, t, n) {
509
+ if (!t?.trim() && !n?.trim()) throw Error(`${e} requires aria-label or aria-labelledby.`);
510
+ }
511
+ var fe = E(function({ checked: e, defaultChecked: t = !1, onCheckedChange: n, onClick: r, disabled: i = !1, className: a, type: o = "button", "aria-label": s, "aria-labelledby": c, ...l }, u) {
512
+ de("Switch", s, c);
513
+ let d = e !== void 0, [f, p] = F(t), m = e ?? f, h = (e) => {
514
+ if (r?.(e), e.defaultPrevented || i) return;
515
+ let t = !m;
516
+ d || p(t), n?.(t);
517
+ };
518
+ return /* @__PURE__ */ L("button", {
519
+ ...l,
520
+ ref: u,
521
+ type: o,
522
+ role: "switch",
523
+ "aria-checked": m,
524
+ "aria-label": s?.trim() || void 0,
525
+ "aria-labelledby": c?.trim() || void 0,
526
+ className: ue("mithrl-switch", a),
527
+ disabled: i,
528
+ "data-checked": m ? "" : void 0,
529
+ onClick: h,
530
+ children: /* @__PURE__ */ L("span", {
531
+ className: "mithrl-switch__track",
532
+ "aria-hidden": "true",
533
+ children: /* @__PURE__ */ L("span", { className: "mithrl-switch__thumb" })
534
+ })
535
+ });
536
+ }), pe = E(function({ theme: e, defaultTheme: t = "light", onThemeChange: n, onClick: r, disabled: i = !1, className: a, type: o = "button", "aria-label": s, "aria-labelledby": c, ...l }, u) {
537
+ let d = e !== void 0, [f, p] = F(t), m = e ?? f, g = m === "dark" ? "light" : "dark", _ = s?.trim() || (c?.trim() ? void 0 : `Switch to ${g} mode`);
538
+ de("ThemeSwitch", _, c);
539
+ let v = (e) => {
540
+ r?.(e), !(e.defaultPrevented || i) && (d || p(g), n?.(g));
541
+ };
542
+ return /* @__PURE__ */ L("button", {
543
+ ...l,
544
+ ref: u,
545
+ type: o,
546
+ role: "switch",
547
+ "aria-checked": m === "dark",
548
+ "aria-label": _,
549
+ "aria-labelledby": c?.trim() || void 0,
550
+ className: ue("mithrl-switch mithrl-theme-switch", a),
551
+ disabled: i,
552
+ "data-theme-mode": m,
553
+ "data-checked": m === "dark" ? "" : void 0,
554
+ onClick: v,
555
+ children: /* @__PURE__ */ R("span", {
556
+ className: "mithrl-switch__track",
557
+ "aria-hidden": "true",
558
+ children: [
559
+ /* @__PURE__ */ L(G, {
560
+ className: "mithrl-theme-switch__icon mithrl-theme-switch__icon--light",
561
+ glyph: b,
562
+ size: "small"
563
+ }),
564
+ /* @__PURE__ */ L(G, {
565
+ className: "mithrl-theme-switch__icon mithrl-theme-switch__icon--dark",
566
+ glyph: h,
567
+ size: "small"
568
+ }),
569
+ /* @__PURE__ */ L("span", { className: "mithrl-switch__thumb" })
570
+ ]
571
+ })
572
+ });
573
+ }), Z = e("mithrl-toggle-button", {
574
+ variants: { size: {
575
+ compact: "mithrl-toggle-button--compact",
576
+ default: "mithrl-toggle-button--default",
577
+ comfortable: "mithrl-toggle-button--comfortable"
578
+ } },
579
+ defaultVariants: { size: "compact" }
580
+ }), me = {
581
+ compact: "small",
582
+ default: "default",
583
+ comfortable: "medium"
584
+ };
585
+ function he(e, t) {
586
+ if (!e?.trim() && !t?.trim()) throw Error("ToggleButton requires aria-label or aria-labelledby.");
587
+ }
588
+ var ge = E(function({ icon: e, size: t = "compact", pressed: n, defaultPressed: r = !1, onPressedChange: i, onClick: a, disabled: o = !1, className: s, "aria-label": c, "aria-labelledby": l, ...u }, d) {
589
+ he(c, l);
590
+ let f = t ?? "compact", p = n !== void 0, [m, h] = F(r), g = n ?? m, _ = (e) => {
591
+ if (a?.(e), e.defaultPrevented || o) return;
592
+ let t = !g;
593
+ p || h(t), i?.(t);
594
+ };
595
+ return /* @__PURE__ */ L("button", {
596
+ ...u,
597
+ ref: d,
598
+ type: "button",
599
+ "aria-label": c?.trim() || void 0,
600
+ "aria-labelledby": l?.trim() || void 0,
601
+ "aria-pressed": g,
602
+ className: Z({
603
+ size: f,
604
+ className: s
605
+ }),
606
+ disabled: o,
607
+ "data-pressed": g ? "" : void 0,
608
+ "data-size": f,
609
+ onClick: _,
610
+ children: /* @__PURE__ */ L(G, {
611
+ glyph: e,
612
+ size: me[f]
613
+ })
614
+ });
615
+ }), Q = 8, _e = 4, ve = 5, ye = typeof window > "u" ? k : M;
616
+ function be(e, t, n) {
617
+ return n < t ? t : Math.min(Math.max(e, t), n);
618
+ }
619
+ function xe(e, t) {
620
+ typeof e == "function" ? e(t) : e && (e.current = t);
621
+ }
622
+ function $(e, t) {
623
+ return Array.from(new Set(`${e ?? ""} ${t}`.trim().split(/\s+/).filter(Boolean))).join(" ");
624
+ }
625
+ function Se({ children: e, content: t, placement: n = "top", arrow: r = !0, delayDuration: i = 400, closeDelayDuration: a = 80, open: o, defaultOpen: s = !1, onOpenChange: c, disabled: l = !1, id: u, className: d, portalContainer: f }) {
626
+ if (!D(e) || e.type === w) throw Error("Tooltip requires one non-Fragment trigger element.");
627
+ if (t == null || t === !1 || t === "") throw Error("Tooltip requires non-empty content.");
628
+ if (i < 0 || a < 0) throw Error("Tooltip delays must be zero or greater.");
629
+ let p = A().replace(/:/g, ""), m = u ?? `mithrl-tooltip-${p}`, h = o !== void 0, [g, _] = F(s), [v, y] = F(!1), [b, x] = F(null), [S, C] = F(), E = h ? o : g, j = !l && E, M = P(null), N = P(null), te = P(null), z = P(null), B = P(!1), V = P(!1), H = P(!1), U = O(() => {
630
+ te.current !== null && (clearTimeout(te.current), te.current = null);
631
+ }, []), W = O(() => {
632
+ z.current !== null && (clearTimeout(z.current), z.current = null);
633
+ }, []), G = O((e) => {
634
+ let t = !l && e;
635
+ t !== E && (h || _(t), c?.(t));
636
+ }, [
637
+ l,
638
+ h,
639
+ c,
640
+ E
641
+ ]), ne = O(() => {
642
+ U(), W(), G(!0);
643
+ }, [
644
+ W,
645
+ U,
646
+ G
647
+ ]), K = O(() => {
648
+ U(), W(), !(l || j) && (te.current = setTimeout(() => G(!0), i));
649
+ }, [
650
+ W,
651
+ U,
652
+ i,
653
+ l,
654
+ j,
655
+ G
656
+ ]), q = O(() => {
657
+ U(), W(), G(!1);
658
+ }, [
659
+ W,
660
+ U,
661
+ G
662
+ ]), J = O(() => {
663
+ U(), W(), !(B.current || V.current || H.current) && (z.current = setTimeout(() => {
664
+ !B.current && !V.current && !H.current && G(!1);
665
+ }, a));
666
+ }, [
667
+ W,
668
+ U,
669
+ a,
670
+ G
671
+ ]);
672
+ k(() => (y(!0), () => {
673
+ U(), W();
674
+ }), [W, U]), k(() => {
675
+ l && q();
676
+ }, [q, l]), k(() => {
677
+ if (!j) {
678
+ V.current = !1, x(null);
679
+ return;
680
+ }
681
+ let e = (e) => {
682
+ e.key === "Escape" && q();
683
+ };
684
+ return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
685
+ }, [q, j]);
686
+ let Y = O(() => {
687
+ let e = M.current, t = N.current;
688
+ if (!e || !t) return;
689
+ let i = e.getBoundingClientRect(), a = t.getBoundingClientRect(), o = e.closest("[data-theme]")?.dataset.theme || void 0;
690
+ C((e) => e === o ? e : o);
691
+ let s = _e + (r ? ve : 0), c = i.left + i.width / 2, l = i.top + i.height / 2, u = c - a.width / 2, d = i.top - a.height - s;
692
+ n === "bottom" ? d = i.bottom + s : n === "right" ? (u = i.right + s, d = l - a.height / 2) : n === "left" && (u = i.left - a.width - s, d = l - a.height / 2), u = be(u, Q, window.innerWidth - a.width - Q), d = be(d, Q, window.innerHeight - a.height - Q);
693
+ let f = n === "top" || n === "bottom" ? be(c - u, 8, a.width - 8) : be(l - d, 8, a.height - 8);
694
+ x((e) => {
695
+ let t = {
696
+ left: u,
697
+ top: d,
698
+ arrowOffset: f
699
+ };
700
+ return e && Math.abs(e.left - t.left) < .1 && Math.abs(e.top - t.top) < .1 && Math.abs(e.arrowOffset - t.arrowOffset) < .1 ? e : t;
701
+ });
702
+ }, [r, n]);
703
+ ye(() => {
704
+ if (!v || !j) return;
705
+ Y();
706
+ let e = requestAnimationFrame(Y), t = typeof ResizeObserver > "u" ? null : new ResizeObserver(Y);
707
+ return M.current && t?.observe(M.current), N.current && t?.observe(N.current), window.addEventListener("resize", Y), window.addEventListener("scroll", Y, !0), () => {
708
+ cancelAnimationFrame(e), t?.disconnect(), window.removeEventListener("resize", Y), window.removeEventListener("scroll", Y, !0);
709
+ };
710
+ }, [
711
+ j,
712
+ v,
713
+ Y
714
+ ]);
715
+ let X = e.ref, re = T(e, {
716
+ ref: (e) => {
717
+ M.current = e, xe(X, e);
718
+ },
719
+ "aria-describedby": (v && j ? $(e.props["aria-describedby"], m) : e.props["aria-describedby"]) || void 0,
720
+ onPointerEnter: (t) => {
721
+ B.current = !0, e.props.onPointerEnter?.(t), !t.defaultPrevented && t.pointerType !== "touch" && K();
722
+ },
723
+ onPointerLeave: (t) => {
724
+ if (B.current = !1, e.props.onPointerLeave?.(t), t.defaultPrevented) return;
725
+ let n = t.relatedTarget;
726
+ n instanceof Node && N.current?.contains(n) || J();
727
+ },
728
+ onFocus: (t) => {
729
+ H.current = !0, e.props.onFocus?.(t), t.defaultPrevented || ne();
730
+ },
731
+ onBlur: (t) => {
732
+ if (H.current = !1, e.props.onBlur?.(t), t.defaultPrevented) return;
733
+ let n = t.relatedTarget;
734
+ n instanceof Node && N.current?.contains(n) || J();
735
+ }
736
+ }), ie = v && j ? /* @__PURE__ */ R("div", {
737
+ ref: N,
738
+ id: m,
739
+ role: "tooltip",
740
+ className: ["mithrl-tooltip", d].filter(Boolean).join(" "),
741
+ "data-placement": n,
742
+ "data-arrow": r ? "" : void 0,
743
+ "data-theme": S,
744
+ style: {
745
+ left: b?.left ?? 0,
746
+ top: b?.top ?? 0,
747
+ visibility: b ? "visible" : "hidden",
748
+ "--tooltip-arrow-offset": `${b?.arrowOffset ?? 8}px`
749
+ },
750
+ onPointerEnter: () => {
751
+ V.current = !0, W();
752
+ },
753
+ onPointerLeave: (e) => {
754
+ V.current = !1;
755
+ let t = e.relatedTarget;
756
+ t instanceof Node && M.current?.contains(t) || J();
757
+ },
758
+ children: [/* @__PURE__ */ L("span", {
759
+ className: "mithrl-tooltip__surface",
760
+ children: t
761
+ }), r ? /* @__PURE__ */ L("span", {
762
+ className: "mithrl-tooltip__arrow",
763
+ "aria-hidden": "true"
764
+ }) : null]
765
+ }) : null;
766
+ return /* @__PURE__ */ R(I, { children: [re, ie ? ee(ie, f ?? document.body) : null] });
767
+ }
768
+ //#endregion
769
+ //#region src/components/text-field/TextField.tsx
770
+ var Ce = e("mithrl-text-field", {
771
+ variants: {
772
+ surface: {
773
+ surface: "mithrl-text-field--surface",
774
+ transparent: "mithrl-text-field--transparent"
775
+ },
776
+ status: {
777
+ default: "mithrl-text-field--default",
778
+ warning: "mithrl-text-field--warning",
779
+ invalid: "mithrl-text-field--invalid"
780
+ }
781
+ },
782
+ defaultVariants: {
783
+ surface: "surface",
784
+ status: "default"
785
+ }
786
+ });
787
+ function we(...e) {
788
+ return e.filter(Boolean).join(" ");
789
+ }
790
+ function Te(e) {
791
+ return e !== void 0 && e !== !1 && e !== "false";
792
+ }
793
+ var Ee = E(function({ surface: e = "surface", status: t = "default", leadingVisual: n, trailingVisual: r, className: a, inputClassName: o, disabled: s = !1, readOnly: c = !1, "aria-invalid": l, "data-preview-state": u, ...d }, f) {
794
+ let [p, m] = F(!1), h = e ?? "surface", g = Te(l) ? "invalid" : t ?? "default", _ = g !== "default";
795
+ return /* @__PURE__ */ R("span", {
796
+ className: Ce({
797
+ surface: h,
798
+ status: g,
799
+ className: a
800
+ }),
801
+ "data-surface": h,
802
+ "data-status": g,
803
+ "data-disabled": s ? "" : void 0,
804
+ "data-read-only": c ? "" : void 0,
805
+ "data-read-only-pointer-focus": c && p ? "" : void 0,
806
+ "data-preview-state": u,
807
+ onBlur: (e) => {
808
+ e.currentTarget.contains(e.relatedTarget) || m(!1);
809
+ },
810
+ onClick: (e) => {
811
+ let t = e.currentTarget.querySelector(".mithrl-text-field__control");
812
+ s || (c && m(!0), e.target !== t && t?.focus());
813
+ },
814
+ children: [
815
+ n ? /* @__PURE__ */ L("span", {
816
+ className: "mithrl-text-field__visual mithrl-text-field__visual--leading",
817
+ "aria-hidden": "true",
818
+ children: n
819
+ }) : null,
820
+ /* @__PURE__ */ L("input", {
821
+ ...d,
822
+ ref: f,
823
+ className: we("mithrl-text-field__control", o),
824
+ disabled: s,
825
+ readOnly: c,
826
+ "aria-invalid": l
827
+ }),
828
+ _ ? /* @__PURE__ */ L("span", {
829
+ className: "mithrl-text-field__visual mithrl-text-field__visual--status",
830
+ "aria-hidden": "true",
831
+ children: /* @__PURE__ */ L(G, { glyph: i })
832
+ }) : r ? /* @__PURE__ */ L("span", {
833
+ className: "mithrl-text-field__visual mithrl-text-field__visual--trailing",
834
+ "aria-hidden": "true",
835
+ children: r
836
+ }) : null
837
+ ]
838
+ });
839
+ }), De = e("mithrl-textarea", {
840
+ variants: {
841
+ surface: {
842
+ surface: "mithrl-textarea--surface",
843
+ transparent: "mithrl-textarea--transparent"
844
+ },
845
+ status: {
846
+ default: "mithrl-textarea--default",
847
+ warning: "mithrl-textarea--warning",
848
+ invalid: "mithrl-textarea--invalid"
849
+ },
850
+ resize: {
851
+ vertical: "mithrl-textarea--resize-vertical",
852
+ none: "mithrl-textarea--resize-none"
853
+ }
854
+ },
855
+ defaultVariants: {
856
+ surface: "surface",
857
+ status: "default",
858
+ resize: "vertical"
859
+ }
860
+ });
861
+ function Oe(...e) {
862
+ return e.filter(Boolean).join(" ");
863
+ }
864
+ function ke(e) {
865
+ return e !== void 0 && e !== !1 && e !== "false";
866
+ }
867
+ var Ae = E(function({ surface: e = "surface", status: t = "default", resize: n = "vertical", className: r, textareaClassName: a, disabled: o = !1, readOnly: s = !1, "aria-invalid": c, "data-preview-state": l, ...u }, d) {
868
+ let f = e ?? "surface", p = n ?? "vertical", m = ke(c) ? "invalid" : t ?? "default", h = !o && m !== "default";
869
+ return /* @__PURE__ */ R("span", {
870
+ className: De({
871
+ surface: f,
872
+ status: m,
873
+ resize: p,
874
+ className: r
875
+ }),
876
+ "data-surface": f,
877
+ "data-status": m,
878
+ "data-resize": p,
879
+ "data-disabled": o ? "" : void 0,
880
+ "data-read-only": s ? "" : void 0,
881
+ "data-preview-state": l,
882
+ children: [/* @__PURE__ */ L("textarea", {
883
+ ...u,
884
+ ref: d,
885
+ className: Oe("mithrl-textarea__control", a),
886
+ disabled: o,
887
+ readOnly: s,
888
+ "aria-invalid": c
889
+ }), h ? /* @__PURE__ */ L("span", {
890
+ className: "mithrl-textarea__status",
891
+ "aria-hidden": "true",
892
+ children: /* @__PURE__ */ L(G, { glyph: i })
893
+ }) : null]
894
+ });
895
+ }), je = e("mithrl-select", {
896
+ variants: { size: {
897
+ comfortable: "mithrl-select--comfortable",
898
+ large: "mithrl-select--large"
899
+ } },
900
+ defaultVariants: { size: "comfortable" }
901
+ });
902
+ function Me(...e) {
903
+ return e.filter(Boolean).join(" ");
904
+ }
905
+ function Ne(e) {
906
+ return e !== void 0 && e !== !1 && e !== "false";
907
+ }
908
+ var Pe = E(function(e, t) {
909
+ let { multiple: n, ...i } = e;
910
+ if (n !== void 0 && n !== !1) throw Error("Select does not support multiple selection.");
911
+ let { size: a = "comfortable", leadingVisual: o, className: s, selectClassName: c, disabled: l = !1, children: u, "aria-invalid": d, "data-preview-state": f, ...p } = i, m = a ?? "comfortable", h = Ne(d);
912
+ return /* @__PURE__ */ R("span", {
913
+ className: je({
914
+ size: m,
915
+ className: s
916
+ }),
917
+ "data-size": m,
918
+ "data-leading": o ? "" : void 0,
919
+ "data-disabled": l ? "" : void 0,
920
+ "data-invalid": h ? "" : void 0,
921
+ "data-preview-state": f,
922
+ children: [
923
+ o ? /* @__PURE__ */ L("span", {
924
+ className: "mithrl-select__visual mithrl-select__visual--leading",
925
+ "aria-hidden": "true",
926
+ children: o
927
+ }) : null,
928
+ /* @__PURE__ */ L("select", {
929
+ ...p,
930
+ ref: t,
931
+ className: Me("mithrl-select__control", c),
932
+ disabled: l,
933
+ "aria-invalid": d,
934
+ children: u
935
+ }),
936
+ /* @__PURE__ */ L("span", {
937
+ className: "mithrl-select__visual mithrl-select__visual--trailing",
938
+ "aria-hidden": "true",
939
+ children: /* @__PURE__ */ L(G, { glyph: r })
940
+ })
941
+ ]
942
+ });
943
+ }), Fe = e("mithrl-link", {
944
+ variants: { context: {
945
+ inline: "mithrl-link--inline",
946
+ standalone: "mithrl-link--standalone"
947
+ } },
948
+ defaultVariants: { context: "inline" }
949
+ }), Ie = E(function({ context: e = "inline", leadingIcon: t, trailingIcon: n, children: r, className: i, href: a, "data-preview-state": o, ...s }, c) {
950
+ let l = e ?? "inline", u = !!t, d = !!n;
951
+ if (typeof a != "string" || !a.trim()) throw Error("Link requires a non-empty href.");
952
+ if ("aria-disabled" in s) throw Error("Link does not support aria-disabled.");
953
+ if (u && d) throw Error("Link supports at most one icon.");
954
+ if (l === "inline" && (u || d)) throw Error("Link icons are supported only in Standalone context.");
955
+ return /* @__PURE__ */ R("a", {
956
+ ...s,
957
+ ref: c,
958
+ href: a,
959
+ className: Fe({
960
+ context: l,
961
+ className: i
962
+ }),
963
+ "data-context": l,
964
+ "data-preview-state": o,
965
+ children: [
966
+ t ? /* @__PURE__ */ L("span", {
967
+ className: "mithrl-link__icon",
968
+ "aria-hidden": "true",
969
+ children: /* @__PURE__ */ L(G, {
970
+ glyph: t,
971
+ size: "small"
972
+ })
973
+ }) : null,
974
+ /* @__PURE__ */ L("span", {
975
+ className: "mithrl-link__label",
976
+ children: r
977
+ }),
978
+ n ? /* @__PURE__ */ L("span", {
979
+ className: "mithrl-link__icon",
980
+ "aria-hidden": "true",
981
+ children: /* @__PURE__ */ L(G, {
982
+ glyph: n,
983
+ size: "small"
984
+ })
985
+ }) : null
986
+ ]
987
+ });
988
+ }), Le = e("mithrl-separator", {
989
+ variants: {
990
+ orientation: {
991
+ horizontal: "mithrl-separator--horizontal",
992
+ vertical: "mithrl-separator--vertical"
993
+ },
994
+ emphasis: {
995
+ default: "mithrl-separator--default",
996
+ soft: "mithrl-separator--soft"
997
+ }
998
+ },
999
+ defaultVariants: {
1000
+ orientation: "horizontal",
1001
+ emphasis: "default"
1002
+ }
1003
+ }), Re = E(function({ orientation: e = "horizontal", emphasis: t = "default", decorative: n = !0, className: r, ...i }, a) {
1004
+ let o = [
1005
+ "aria-valuemax",
1006
+ "aria-valuemin",
1007
+ "aria-valuenow",
1008
+ "children",
1009
+ "tabIndex"
1010
+ ].find((e) => e in i);
1011
+ if (o) throw Error(`Separator does not support ${o}.`);
1012
+ let s = e ?? "horizontal", c = t ?? "default", l = n === !1 ? {
1013
+ role: "separator",
1014
+ "aria-hidden": void 0,
1015
+ "aria-orientation": s
1016
+ } : {
1017
+ role: void 0,
1018
+ "aria-hidden": !0,
1019
+ "aria-orientation": void 0
1020
+ };
1021
+ return /* @__PURE__ */ L("div", {
1022
+ ...i,
1023
+ ...l,
1024
+ ref: a,
1025
+ className: Le({
1026
+ orientation: s,
1027
+ emphasis: c,
1028
+ className: r
1029
+ }),
1030
+ "data-orientation": s,
1031
+ "data-emphasis": c
1032
+ });
1033
+ }), ze = e("mithrl-badge", {
1034
+ variants: { tone: {
1035
+ neutral: "mithrl-badge--neutral",
1036
+ success: "mithrl-badge--success",
1037
+ warning: "mithrl-badge--warning",
1038
+ information: "mithrl-badge--information",
1039
+ destructive: "mithrl-badge--destructive"
1040
+ } },
1041
+ defaultVariants: { tone: "neutral" }
1042
+ }), Be = [
1043
+ "aria-live",
1044
+ "onClick",
1045
+ "onDoubleClick",
1046
+ "onKeyDown",
1047
+ "onKeyUp",
1048
+ "role",
1049
+ "tabIndex"
1050
+ ], Ve = E(function({ children: e, icon: t, tone: n = "neutral", className: r, ...i }, a) {
1051
+ let o = Be.find((e) => e in i);
1052
+ if (o) throw Error(`Badge does not support ${o}.`);
1053
+ let s = n ?? "neutral";
1054
+ return /* @__PURE__ */ R("span", {
1055
+ ...i,
1056
+ ref: a,
1057
+ className: ze({
1058
+ tone: s,
1059
+ className: r
1060
+ }),
1061
+ "data-tone": s,
1062
+ children: [t ? /* @__PURE__ */ L(G, {
1063
+ glyph: t,
1064
+ size: "xsmall"
1065
+ }) : null, /* @__PURE__ */ L("span", {
1066
+ className: "mithrl-badge__label",
1067
+ children: e
1068
+ })]
1069
+ });
1070
+ }), He = e("mithrl-tag", {
1071
+ variants: { tone: {
1072
+ neutral: "mithrl-tag--neutral",
1073
+ success: "mithrl-tag--success",
1074
+ warning: "mithrl-tag--warning",
1075
+ information: "mithrl-tag--information",
1076
+ destructive: "mithrl-tag--destructive"
1077
+ } },
1078
+ defaultVariants: { tone: "neutral" }
1079
+ }), Ue = [
1080
+ "aria-live",
1081
+ "onClick",
1082
+ "onDoubleClick",
1083
+ "onKeyDown",
1084
+ "onKeyUp",
1085
+ "role",
1086
+ "tabIndex"
1087
+ ], We = E(function({ children: e, icon: t, tone: n = "neutral", className: r, ...i }, a) {
1088
+ let o = Ue.find((e) => e in i);
1089
+ if (o) throw Error(`Tag does not support ${o}.`);
1090
+ let s = n ?? "neutral";
1091
+ return /* @__PURE__ */ R("span", {
1092
+ ...i,
1093
+ ref: a,
1094
+ className: He({
1095
+ tone: s,
1096
+ className: r
1097
+ }),
1098
+ "data-tone": s,
1099
+ children: [t ? /* @__PURE__ */ L(G, {
1100
+ glyph: t,
1101
+ size: "xsmall"
1102
+ }) : null, /* @__PURE__ */ L("span", {
1103
+ className: "mithrl-tag__label",
1104
+ children: e
1105
+ })]
1106
+ });
1107
+ }), Ge = e("mithrl-avatar", {
1108
+ variants: { size: {
1109
+ small: "mithrl-avatar--small",
1110
+ default: "mithrl-avatar--default",
1111
+ large: "mithrl-avatar--large"
1112
+ } },
1113
+ defaultVariants: { size: "default" }
1114
+ }), Ke = {
1115
+ small: "small",
1116
+ default: "default",
1117
+ large: "large"
1118
+ }, qe = [
1119
+ "aria-hidden",
1120
+ "aria-label",
1121
+ "aria-live",
1122
+ "children",
1123
+ "onClick",
1124
+ "onDoubleClick",
1125
+ "onKeyDown",
1126
+ "onKeyUp",
1127
+ "role",
1128
+ "tabIndex"
1129
+ ], Je = typeof window > "u" ? k : M, Ye = E(function({ src: e, initials: t, size: n = "default", label: r, className: i, ...a }, o) {
1130
+ let s = n ?? "default", c = t?.trim(), l = r?.trim(), [u, d] = F(null);
1131
+ Je(() => {
1132
+ d(null);
1133
+ }, [e]);
1134
+ let f = qe.find((e) => e in a);
1135
+ if (f) throw Error(`Avatar does not support ${f}.`);
1136
+ let p = !!(e && u?.src === e && u.state === "loaded"), m = p ? "image" : c ? "initials" : "fallback", h = l ? {
1137
+ role: "img",
1138
+ "aria-label": l
1139
+ } : { "aria-hidden": !0 };
1140
+ return /* @__PURE__ */ R("span", {
1141
+ ...a,
1142
+ ...h,
1143
+ ref: o,
1144
+ className: Ge({
1145
+ size: s,
1146
+ className: i
1147
+ }),
1148
+ "data-size": s,
1149
+ "data-content": m,
1150
+ "data-image-loaded": p ? "" : void 0,
1151
+ children: [/* @__PURE__ */ L("span", {
1152
+ className: "mithrl-avatar__fallback",
1153
+ "aria-hidden": "true",
1154
+ children: c ? /* @__PURE__ */ L("span", {
1155
+ className: "mithrl-avatar__initials",
1156
+ children: c
1157
+ }) : /* @__PURE__ */ L(G, {
1158
+ className: "mithrl-avatar__icon",
1159
+ glyph: S,
1160
+ size: Ke[s]
1161
+ })
1162
+ }), e ? /* @__PURE__ */ L("img", {
1163
+ className: "mithrl-avatar__image",
1164
+ src: e,
1165
+ alt: "",
1166
+ "aria-hidden": "true",
1167
+ onLoad: () => d({
1168
+ src: e,
1169
+ state: "loaded"
1170
+ }),
1171
+ onError: () => d({
1172
+ src: e,
1173
+ state: "failed"
1174
+ })
1175
+ }, e) : null]
1176
+ });
1177
+ }), Xe = e("mithrl-progress-indicator", {
1178
+ variants: {
1179
+ size: {
1180
+ xsmall: "mithrl-progress-indicator--xsmall",
1181
+ small: "mithrl-progress-indicator--small",
1182
+ default: "mithrl-progress-indicator--default"
1183
+ },
1184
+ tone: {
1185
+ neutral: "mithrl-progress-indicator--neutral",
1186
+ brand: "mithrl-progress-indicator--brand"
1187
+ }
1188
+ },
1189
+ defaultVariants: {
1190
+ size: "small",
1191
+ tone: "neutral"
1192
+ }
1193
+ }), Ze = {
1194
+ xsmall: "xsmall",
1195
+ small: "small",
1196
+ default: "default"
1197
+ }, Qe = [
1198
+ "aria-atomic",
1199
+ "aria-busy",
1200
+ "aria-hidden",
1201
+ "aria-label",
1202
+ "aria-live",
1203
+ "children",
1204
+ "onClick",
1205
+ "onDoubleClick",
1206
+ "onKeyDown",
1207
+ "onKeyUp",
1208
+ "role",
1209
+ "tabIndex"
1210
+ ], $e = E(function({ size: e = "small", tone: t = "neutral", label: n, decorative: r, className: i, ...a }, o) {
1211
+ let s = e ?? "small", c = t ?? "neutral", l = n?.trim(), u = n !== void 0, d = r === !0, p = Qe.find((e) => e in a);
1212
+ if (p) throw Error(`ProgressIndicator does not support ${p}.`);
1213
+ if (u && !l) throw Error("ProgressIndicator label must not be empty.");
1214
+ if (l && d) throw Error("ProgressIndicator cannot be both labelled and decorative.");
1215
+ if (!l && !d) throw Error("ProgressIndicator requires a label or decorative={true}.");
1216
+ let m = d ? { "aria-hidden": !0 } : {
1217
+ role: "status",
1218
+ "aria-label": l
1219
+ };
1220
+ return /* @__PURE__ */ R("span", {
1221
+ ...a,
1222
+ ...m,
1223
+ ref: o,
1224
+ className: Xe({
1225
+ size: s,
1226
+ tone: c,
1227
+ className: i
1228
+ }),
1229
+ "data-size": s,
1230
+ "data-tone": c,
1231
+ children: [/* @__PURE__ */ L(G, {
1232
+ className: "mithrl-progress-indicator__active",
1233
+ glyph: f,
1234
+ size: Ze[s]
1235
+ }), /* @__PURE__ */ L("svg", {
1236
+ className: "mithrl-progress-indicator__gap",
1237
+ viewBox: "0 0 24 24",
1238
+ fill: "none",
1239
+ "aria-hidden": "true",
1240
+ focusable: "false",
1241
+ children: /* @__PURE__ */ L("path", {
1242
+ className: "mithrl-progress-indicator__gap-path",
1243
+ d: "M14.781 3.4404 A9 9 0 0 1 21 12",
1244
+ stroke: "currentColor",
1245
+ strokeWidth: "2",
1246
+ strokeLinecap: "round",
1247
+ opacity: "0.18"
1248
+ })
1249
+ })]
1250
+ });
1251
+ }), et = e("mithrl-skeleton", {
1252
+ variants: { radius: {
1253
+ small: "mithrl-skeleton--small",
1254
+ medium: "mithrl-skeleton--medium",
1255
+ large: "mithrl-skeleton--large",
1256
+ full: "mithrl-skeleton--full"
1257
+ } },
1258
+ defaultVariants: { radius: "medium" }
1259
+ }), tt = [
1260
+ "aria-atomic",
1261
+ "aria-busy",
1262
+ "aria-hidden",
1263
+ "aria-label",
1264
+ "aria-live",
1265
+ "children",
1266
+ "onClick",
1267
+ "onDoubleClick",
1268
+ "onKeyDown",
1269
+ "onKeyUp",
1270
+ "role",
1271
+ "tabIndex"
1272
+ ], nt = E(function({ radius: e = "medium", className: t, ...n }, r) {
1273
+ let i = tt.find((e) => e in n);
1274
+ if (i) throw Error(`Skeleton does not support ${i}.`);
1275
+ let a = e ?? "medium";
1276
+ return /* @__PURE__ */ L("div", {
1277
+ ...n,
1278
+ ref: r,
1279
+ "aria-hidden": "true",
1280
+ className: et({
1281
+ radius: a,
1282
+ className: t
1283
+ }),
1284
+ "data-radius": a
1285
+ });
1286
+ });
1287
+ //#endregion
1288
+ //#region src/components/checkbox/Checkbox.tsx
1289
+ function rt(...e) {
1290
+ return e.filter(Boolean).join(" ");
1291
+ }
1292
+ var it = typeof window > "u" ? k : M, at = E(function({ indeterminate: e = !1, className: t, inputClassName: r, disabled: i = !1, onChange: a, "data-preview-state": o, ...s }, c) {
1293
+ if ("aria-checked" in s) throw Error("Checkbox does not support aria-checked.");
1294
+ let l = P(null), u = O((e) => {
1295
+ l.current = e, typeof c == "function" ? c(e) : c && (c.current = e);
1296
+ }, [c]);
1297
+ it(() => {
1298
+ l.current && (l.current.indeterminate = e);
1299
+ });
1300
+ let d = (t) => {
1301
+ a?.(t), t.currentTarget.indeterminate = e;
1302
+ };
1303
+ return /* @__PURE__ */ R("span", {
1304
+ className: rt("mithrl-checkbox", t),
1305
+ "data-indeterminate": e ? "" : void 0,
1306
+ "data-preview-state": o,
1307
+ children: [/* @__PURE__ */ L("input", {
1308
+ ...s,
1309
+ ref: u,
1310
+ className: rt("mithrl-checkbox__input", r),
1311
+ type: "checkbox",
1312
+ disabled: i,
1313
+ onChange: d
1314
+ }), /* @__PURE__ */ R("span", {
1315
+ className: "mithrl-checkbox__visual",
1316
+ "aria-hidden": "true",
1317
+ children: [/* @__PURE__ */ L(G, {
1318
+ className: "mithrl-checkbox__icon mithrl-checkbox__icon--check",
1319
+ glyph: n,
1320
+ size: "xsmall"
1321
+ }), /* @__PURE__ */ L(G, {
1322
+ className: "mithrl-checkbox__icon mithrl-checkbox__icon--minus",
1323
+ glyph: m,
1324
+ size: "xsmall"
1325
+ })]
1326
+ })]
1327
+ });
1328
+ });
1329
+ //#endregion
1330
+ //#region src/components/radio/Radio.tsx
1331
+ function ot(...e) {
1332
+ return e.filter(Boolean).join(" ");
1333
+ }
1334
+ var st = E(function({ className: e, inputClassName: t, disabled: n = !1, "data-preview-state": r, ...i }, a) {
1335
+ if ("aria-checked" in i) throw Error("Radio does not support aria-checked.");
1336
+ return /* @__PURE__ */ R("span", {
1337
+ className: ot("mithrl-radio", e),
1338
+ "data-preview-state": r,
1339
+ children: [/* @__PURE__ */ L("input", {
1340
+ ...i,
1341
+ ref: a,
1342
+ className: ot("mithrl-radio__input", t),
1343
+ type: "radio",
1344
+ disabled: n
1345
+ }), /* @__PURE__ */ L("span", {
1346
+ className: "mithrl-radio__visual",
1347
+ "aria-hidden": "true"
1348
+ })]
1349
+ });
1350
+ }), ct = e("mithrl-field-label", {
1351
+ variants: { size: {
1352
+ standard: "mithrl-field-label--standard",
1353
+ compact: "mithrl-field-label--compact"
1354
+ } },
1355
+ defaultVariants: { size: "standard" }
1356
+ }), lt = E(function({ size: e = "standard", optional: t = !1, disabled: n = !1, className: r, children: i, ...a }, o) {
1357
+ let s = e ?? "standard";
1358
+ return /* @__PURE__ */ R("label", {
1359
+ ...a,
1360
+ ref: o,
1361
+ className: ct({
1362
+ size: s,
1363
+ className: r
1364
+ }),
1365
+ "data-size": s,
1366
+ "data-disabled": n ? "" : void 0,
1367
+ children: [/* @__PURE__ */ L("span", {
1368
+ className: "mithrl-field-label__text",
1369
+ children: i
1370
+ }), t ? /* @__PURE__ */ L("span", {
1371
+ className: "mithrl-field-label__optional",
1372
+ children: "(optional)"
1373
+ }) : null]
1374
+ });
1375
+ }), ut = e("mithrl-standard-tabs", {
1376
+ variants: { size: {
1377
+ compact: "mithrl-standard-tabs--compact",
1378
+ default: "mithrl-standard-tabs--default"
1379
+ } },
1380
+ defaultVariants: { size: "default" }
1381
+ });
1382
+ function dt(e, t) {
1383
+ if (e.length < 2) throw Error("StandardTabs requires at least two items.");
1384
+ let n = /* @__PURE__ */ new Set(), r = 0;
1385
+ for (let t of e) {
1386
+ let e = t.value.trim(), i = t.label.trim();
1387
+ if (!e || !i) throw Error("StandardTabs items require non-empty value and label fields.");
1388
+ if (e !== t.value) throw Error("StandardTabs item values must not contain leading or trailing whitespace.");
1389
+ if (n.has(t.value)) throw Error(`StandardTabs item values must be unique: "${t.value}".`);
1390
+ t.disabled || (r += 1), n.add(t.value);
1391
+ }
1392
+ if (r === 0) throw Error("StandardTabs requires at least one enabled item.");
1393
+ if (t !== void 0 && !n.has(t)) throw Error("StandardTabs value must reference an item.");
1394
+ }
1395
+ function ft(e) {
1396
+ return e.replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-|-$/g, "");
1397
+ }
1398
+ var pt = E(function({ items: e, value: t, defaultValue: n, onValueChange: r, activationMode: i = "automatic", fullWidth: a = !1, size: o = "default", className: s, "aria-label": c, "aria-labelledby": l, ...u }, d) {
1399
+ if (dt(e, t), !c?.trim() && !l?.trim()) throw Error("StandardTabs requires aria-label or aria-labelledby.");
1400
+ let f = e.filter((e) => !e.disabled)[0].value, [p, m] = F(() => {
1401
+ if (n !== void 0 && !e.some((e) => e.value === n)) throw Error("StandardTabs defaultValue must reference an item.");
1402
+ return n ?? f;
1403
+ }), h = e.some((e) => e.value === p) ? p : f, g = t ?? h, _ = e.find((e) => e.value === g)?.disabled ? f : g, v = o ?? "default", y = A().replace(/:/g, ""), b = P(null), x = P([]), S = P(null), C = P(null), [w, T] = F([]), [E, D] = F("ltr");
1404
+ k(() => {
1405
+ t === void 0 && p !== h && (m(h), r?.(h));
1406
+ }, [
1407
+ h,
1408
+ p,
1409
+ r,
1410
+ t
1411
+ ]), k(() => {
1412
+ let t = () => {
1413
+ let t = b.current && getComputedStyle(b.current).direction === "rtl" ? "rtl" : "ltr";
1414
+ D((e) => e === t ? e : t);
1415
+ let n = e.filter((e, t) => {
1416
+ let n = x.current[t]?.querySelector(".mithrl-standard-tabs__label");
1417
+ return n ? n.scrollWidth > n.clientWidth + 1 : !1;
1418
+ }).map((e) => e.value);
1419
+ T((e) => e.length === n.length && e.every((e, t) => e === n[t]) ? e : n);
1420
+ };
1421
+ t();
1422
+ let n;
1423
+ typeof ResizeObserver > "u" ? window.addEventListener("resize", t) : (n = new ResizeObserver(t), x.current.forEach((e) => {
1424
+ e && n?.observe(e);
1425
+ }));
1426
+ let r;
1427
+ if (typeof MutationObserver < "u") {
1428
+ r = new MutationObserver(t);
1429
+ let e = b.current;
1430
+ for (; e;) r.observe(e, {
1431
+ attributes: !0,
1432
+ attributeFilter: [
1433
+ "class",
1434
+ "dir",
1435
+ "style"
1436
+ ]
1437
+ }), e = e.parentElement;
1438
+ }
1439
+ return () => {
1440
+ window.removeEventListener("resize", t), n?.disconnect(), r?.disconnect();
1441
+ };
1442
+ }, [
1443
+ a,
1444
+ e,
1445
+ v
1446
+ ]);
1447
+ let O = (n) => {
1448
+ let i = e.find((e) => e.value === n);
1449
+ !i || i.disabled || (t === void 0 && m(n), n !== g && r?.(n));
1450
+ }, j = (t, n) => {
1451
+ let r = e.map((e, t) => e.disabled ? -1 : t).filter((e) => e >= 0), a = r.indexOf(n), o = getComputedStyle(t.currentTarget).direction, s;
1452
+ switch (t.key) {
1453
+ case "ArrowRight":
1454
+ s = o === "rtl" ? a - 1 : a + 1;
1455
+ break;
1456
+ case "ArrowLeft":
1457
+ s = o === "rtl" ? a + 1 : a - 1;
1458
+ break;
1459
+ case "Home":
1460
+ s = 0;
1461
+ break;
1462
+ case "End":
1463
+ s = r.length - 1;
1464
+ break;
1465
+ case "Enter":
1466
+ case " ":
1467
+ i === "manual" && (t.preventDefault(), O(e[n].value));
1468
+ return;
1469
+ default: return;
1470
+ }
1471
+ t.preventDefault();
1472
+ let c = r[((s ?? 0) % r.length + r.length) % r.length], l = x.current[c], u = document.activeElement === l;
1473
+ l?.focus(), i === "automatic" && u && O(e[c].value);
1474
+ };
1475
+ return /* @__PURE__ */ L("div", {
1476
+ ...u,
1477
+ ref: (e) => {
1478
+ b.current = e, typeof d == "function" ? d(e) : d && (d.current = e);
1479
+ },
1480
+ role: "tablist",
1481
+ "aria-label": c?.trim() || void 0,
1482
+ "aria-labelledby": l?.trim() || void 0,
1483
+ "aria-orientation": "horizontal",
1484
+ className: ut({
1485
+ size: v,
1486
+ className: s
1487
+ }),
1488
+ "data-size": v,
1489
+ "data-full-width": a ? "" : void 0,
1490
+ "data-activation-mode": i,
1491
+ "data-direction": E,
1492
+ children: e.map((e, t) => {
1493
+ let n = e.value === g, r = w.includes(e.value);
1494
+ return /* @__PURE__ */ L("button", {
1495
+ ref: (e) => {
1496
+ x.current[t] = e;
1497
+ },
1498
+ id: e.id ?? `mithrl-standard-tabs-${y}-${t}-${ft(e.value) || "tab"}`,
1499
+ className: "mithrl-standard-tabs__tab",
1500
+ type: "button",
1501
+ role: "tab",
1502
+ "aria-selected": n,
1503
+ "aria-controls": e.panelId,
1504
+ "aria-disabled": e.disabled || void 0,
1505
+ disabled: e.disabled,
1506
+ tabIndex: e.value === _ && !e.disabled ? 0 : -1,
1507
+ "data-value": e.value,
1508
+ "data-selected": n ? "" : void 0,
1509
+ title: r ? e.label : void 0,
1510
+ onPointerDown: () => {
1511
+ S.current = e.value, C.current = null;
1512
+ },
1513
+ onFocus: () => {
1514
+ i === "automatic" && (O(e.value), S.current === e.value && (C.current = e.value));
1515
+ },
1516
+ onClick: () => {
1517
+ let t = C.current === e.value;
1518
+ S.current = null, C.current = null, (i === "manual" || !t) && O(e.value);
1519
+ },
1520
+ onKeyDown: (e) => j(e, t),
1521
+ children: /* @__PURE__ */ L("span", {
1522
+ className: "mithrl-standard-tabs__label",
1523
+ "data-overflowing": r ? "" : void 0,
1524
+ children: e.label
1525
+ })
1526
+ }, e.value);
1527
+ })
1528
+ });
1529
+ }), mt = e("mithrl-field-message", {
1530
+ variants: { tone: {
1531
+ helper: "mithrl-field-message--helper",
1532
+ warning: "mithrl-field-message--warning",
1533
+ error: "mithrl-field-message--error"
1534
+ } },
1535
+ defaultVariants: { tone: "helper" }
1536
+ }), ht = E(function({ children: e, tone: t = "helper", className: n, ...r }, i) {
1537
+ let a = t ?? "helper";
1538
+ return /* @__PURE__ */ L("p", {
1539
+ ...r,
1540
+ ref: i,
1541
+ className: mt({
1542
+ tone: a,
1543
+ className: n
1544
+ }),
1545
+ "data-tone": a,
1546
+ children: e
1547
+ });
1548
+ });
1549
+ //#endregion
1550
+ //#region src/components/field/Field.tsx
1551
+ function gt(...e) {
1552
+ return e.filter(Boolean).join(" ");
1553
+ }
1554
+ function _t(...e) {
1555
+ let t = e.flatMap((e) => e?.trim().split(/\s+/) ?? []).filter(Boolean);
1556
+ return t.length > 0 ? [...new Set(t)].join(" ") : void 0;
1557
+ }
1558
+ function vt(e) {
1559
+ return e == null || typeof e == "boolean" || e === 0 ? !1 : typeof e == "string" ? e.trim().length > 0 : !Array.isArray(e) || e.some(vt);
1560
+ }
1561
+ function yt({ label: e, children: t, controlId: n, describedBy: r, size: i = "standard", description: a, warning: o, error: s, required: c = !1, optional: l = !1, disabled: u = !1, className: d, ...f }) {
1562
+ let p = A(), m = i ?? "standard", h = n ?? `mithrl-field-${p.replace(/[^a-zA-Z0-9_-]/g, "")}`, g = vt(a), _ = vt(o), v = vt(s), y = v ? "error" : _ ? "warning" : "default", b = g ? `${h}-description` : void 0, x = _ ? `${h}-warning` : void 0, S = v ? `${h}-error` : void 0, C = _t(r, x, y === "warning" ? void 0 : b), w = {
1563
+ id: h,
1564
+ required: c || void 0,
1565
+ disabled: u || void 0,
1566
+ "aria-invalid": y === "error" || void 0,
1567
+ "aria-describedby": C,
1568
+ "aria-errormessage": S
1569
+ };
1570
+ return /* @__PURE__ */ R("div", {
1571
+ ...f,
1572
+ className: gt("mithrl-field", `mithrl-field--${m}`, d),
1573
+ "data-size": m,
1574
+ "data-state": y,
1575
+ "data-disabled": u ? "" : void 0,
1576
+ children: [/* @__PURE__ */ L(lt, {
1577
+ htmlFor: h,
1578
+ size: m,
1579
+ optional: l,
1580
+ disabled: u,
1581
+ children: e
1582
+ }), /* @__PURE__ */ R("div", {
1583
+ className: "mithrl-field__control-and-messages",
1584
+ children: [/* @__PURE__ */ L("div", {
1585
+ className: "mithrl-field__control",
1586
+ children: t({
1587
+ controlProps: w,
1588
+ status: y === "warning" ? "warning" : "default"
1589
+ })
1590
+ }), _ || v || g ? /* @__PURE__ */ R("div", {
1591
+ className: "mithrl-field__messages",
1592
+ children: [
1593
+ _ ? /* @__PURE__ */ L(ht, {
1594
+ id: x,
1595
+ tone: "warning",
1596
+ children: o
1597
+ }) : null,
1598
+ v ? /* @__PURE__ */ L(ht, {
1599
+ id: S,
1600
+ tone: "error",
1601
+ children: s
1602
+ }) : null,
1603
+ g ? /* @__PURE__ */ L(ht, {
1604
+ id: b,
1605
+ tone: "helper",
1606
+ children: a
1607
+ }) : null
1608
+ ]
1609
+ }) : null]
1610
+ })]
1611
+ });
1612
+ }
1613
+ //#endregion
1614
+ //#region src/components/dropdown-menu/DropdownMenu.tsx
1615
+ var bt = e("mithrl-dropdown-menu__popup", {
1616
+ variants: { width: {
1617
+ compact: "mithrl-dropdown-menu__popup--compact",
1618
+ default: "mithrl-dropdown-menu__popup--default",
1619
+ maximum: "mithrl-dropdown-menu__popup--maximum"
1620
+ } },
1621
+ defaultVariants: { width: "default" }
1622
+ });
1623
+ function xt(...e) {
1624
+ return e.filter(Boolean).join(" ");
1625
+ }
1626
+ var St = z.Trigger;
1627
+ function Ct({ modal: e = !1, ...t }) {
1628
+ return /* @__PURE__ */ L(z.Root, {
1629
+ ...t,
1630
+ modal: e
1631
+ });
1632
+ }
1633
+ var wt = E(function({ children: e, width: t = "default", side: n = "bottom", align: r = "start", sideOffset: i = 4, collisionPadding: a = 8, collisionAvoidance: o = {
1634
+ side: "flip",
1635
+ align: "shift",
1636
+ fallbackAxisSide: "none"
1637
+ }, positionMethod: s = "fixed", positionerClassName: c, className: l, keepMounted: u, portalContainer: d, finalFocus: f = !0, "aria-label": p, ...m }, h) {
1638
+ let g = t ?? "default";
1639
+ return /* @__PURE__ */ L(z.Portal, {
1640
+ keepMounted: u,
1641
+ container: d,
1642
+ children: /* @__PURE__ */ L(z.Positioner, {
1643
+ ...m,
1644
+ className: xt("mithrl-dropdown-menu__positioner", c),
1645
+ side: n,
1646
+ align: r,
1647
+ sideOffset: i,
1648
+ collisionPadding: a,
1649
+ collisionAvoidance: o,
1650
+ positionMethod: s,
1651
+ children: /* @__PURE__ */ L(z.Popup, {
1652
+ ref: h,
1653
+ className: bt({
1654
+ width: g,
1655
+ className: l
1656
+ }),
1657
+ finalFocus: f,
1658
+ "aria-label": p,
1659
+ "data-width": g,
1660
+ children: e
1661
+ })
1662
+ })
1663
+ });
1664
+ }), Tt = E(function({ className: e, ...t }, n) {
1665
+ return /* @__PURE__ */ L(z.Group, {
1666
+ ...t,
1667
+ ref: n,
1668
+ className: xt("mithrl-dropdown-menu__group", e)
1669
+ });
1670
+ }), Et = E(function({ className: e, ...t }, n) {
1671
+ return /* @__PURE__ */ L(z.GroupLabel, {
1672
+ ...t,
1673
+ ref: n,
1674
+ className: xt("mithrl-dropdown-menu__label", e)
1675
+ });
1676
+ }), Dt = E(function({ children: e, leadingIcon: t, shortcut: n, tone: r = "neutral", className: i, disabled: a = !1, id: o, label: s, closeOnClick: c, onClick: l, ...u }, d) {
1677
+ let f = r ?? "neutral", p = /* @__PURE__ */ R(I, { children: [
1678
+ t ? /* @__PURE__ */ L("span", {
1679
+ className: "mithrl-dropdown-menu__icon",
1680
+ "aria-hidden": "true",
1681
+ children: t
1682
+ }) : null,
1683
+ /* @__PURE__ */ L("span", {
1684
+ className: "mithrl-dropdown-menu__item-label",
1685
+ children: e
1686
+ }),
1687
+ n ? /* @__PURE__ */ L("span", {
1688
+ className: "mithrl-dropdown-menu__shortcut",
1689
+ "aria-hidden": "true",
1690
+ children: n
1691
+ }) : null
1692
+ ] });
1693
+ if (a) {
1694
+ let { style: e, ...t } = u, n = t, r = typeof e == "function" ? e({
1695
+ disabled: !0,
1696
+ highlighted: !1
1697
+ }) : e;
1698
+ return /* @__PURE__ */ L("div", {
1699
+ ...n,
1700
+ ref: d,
1701
+ id: o,
1702
+ role: "menuitem",
1703
+ "aria-disabled": "true",
1704
+ className: xt("mithrl-dropdown-menu__item", i),
1705
+ style: r,
1706
+ "data-disabled": "",
1707
+ "data-tone": f,
1708
+ children: p
1709
+ });
1710
+ }
1711
+ return /* @__PURE__ */ L(z.Item, {
1712
+ ...u,
1713
+ ref: d,
1714
+ id: o,
1715
+ label: s,
1716
+ closeOnClick: c,
1717
+ onClick: l,
1718
+ render: /* @__PURE__ */ L("button", { type: "button" }),
1719
+ nativeButton: !0,
1720
+ className: xt("mithrl-dropdown-menu__item", i),
1721
+ "data-tone": f,
1722
+ children: p
1723
+ });
1724
+ }), Ot = E(function({ children: e, leadingIcon: t, shortcut: n, className: r, closeOnClick: i = !0, ...a }, o) {
1725
+ return /* @__PURE__ */ R(z.LinkItem, {
1726
+ ...a,
1727
+ ref: o,
1728
+ closeOnClick: i,
1729
+ className: xt("mithrl-dropdown-menu__item", r),
1730
+ "data-tone": "neutral",
1731
+ children: [
1732
+ t ? /* @__PURE__ */ L("span", {
1733
+ className: "mithrl-dropdown-menu__icon",
1734
+ "aria-hidden": "true",
1735
+ children: t
1736
+ }) : null,
1737
+ /* @__PURE__ */ L("span", {
1738
+ className: "mithrl-dropdown-menu__item-label",
1739
+ children: e
1740
+ }),
1741
+ n ? /* @__PURE__ */ L("span", {
1742
+ className: "mithrl-dropdown-menu__shortcut",
1743
+ "aria-hidden": "true",
1744
+ children: n
1745
+ }) : null
1746
+ ]
1747
+ });
1748
+ }), kt = E(function({ className: e, ...t }, n) {
1749
+ return /* @__PURE__ */ L(z.Separator, {
1750
+ ...t,
1751
+ ref: n,
1752
+ className: xt("mithrl-dropdown-menu__separator-slot", e),
1753
+ orientation: "horizontal",
1754
+ children: /* @__PURE__ */ L(Re, { decorative: !0 })
1755
+ });
1756
+ });
1757
+ function At({ className: e, ...t }) {
1758
+ return /* @__PURE__ */ L("span", {
1759
+ ...t,
1760
+ className: xt("mithrl-dropdown-menu__shortcut", e),
1761
+ "aria-hidden": "true"
1762
+ });
1763
+ }
1764
+ //#endregion
1765
+ //#region src/components/account-menu/AccountMenu.tsx
1766
+ function jt({ href: e, onSelect: t, disabled: n, children: r, icon: i }) {
1767
+ return e && !n ? /* @__PURE__ */ L(Ot, {
1768
+ href: e,
1769
+ leadingIcon: i,
1770
+ onClick: t,
1771
+ children: r
1772
+ }) : /* @__PURE__ */ L(Dt, {
1773
+ leadingIcon: i,
1774
+ disabled: n,
1775
+ onClick: t,
1776
+ children: r
1777
+ });
1778
+ }
1779
+ function Mt({ displayName: e, message: t = "Authenticated account", account: n = {}, settings: r = {}, signOut: i = {}, labels: a, align: o = "end", ...s }) {
1780
+ let c = e.trim(), l = t.trim();
1781
+ if (!c) throw Error("AccountMenu requires a non-empty displayName.");
1782
+ return /* @__PURE__ */ R(wt, {
1783
+ ...s,
1784
+ align: o,
1785
+ width: "default",
1786
+ "aria-label": "Account menu",
1787
+ className: ["mithrl-account-menu", s.className].filter(Boolean).join(" "),
1788
+ children: [
1789
+ /* @__PURE__ */ R(Tt, { children: [
1790
+ /* @__PURE__ */ R(Et, {
1791
+ className: "mithrl-account-menu__identity",
1792
+ children: [/* @__PURE__ */ L("span", {
1793
+ className: "mithrl-account-menu__display-name",
1794
+ children: c
1795
+ }), l ? /* @__PURE__ */ L("span", {
1796
+ className: "mithrl-account-menu__message",
1797
+ children: l
1798
+ }) : null]
1799
+ }),
1800
+ /* @__PURE__ */ L(jt, {
1801
+ ...n,
1802
+ icon: /* @__PURE__ */ L(G, { glyph: S }),
1803
+ children: a?.account ?? "Account"
1804
+ }),
1805
+ /* @__PURE__ */ L(jt, {
1806
+ ...r,
1807
+ icon: /* @__PURE__ */ L(G, { glyph: y }),
1808
+ children: a?.settings ?? "Settings"
1809
+ })
1810
+ ] }),
1811
+ /* @__PURE__ */ L(kt, {}),
1812
+ /* @__PURE__ */ L(Tt, { children: /* @__PURE__ */ L(jt, {
1813
+ ...i,
1814
+ icon: /* @__PURE__ */ L(G, { glyph: p }),
1815
+ children: a?.signOut ?? "Sign out"
1816
+ }) })
1817
+ ]
1818
+ });
1819
+ }
1820
+ //#endregion
1821
+ //#region src/components/global-app-bar/assets/horizontal-logo-dark.svg
1822
+ var Nt = "data:image/svg+xml,%3csvg%20width='1297'%20height='233'%20viewBox='0%200%201297%20233'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M362.582%20232.028C343.936%20232.028%20328.736%20216.86%20328.736%20198.182V48.3378H290.027C284.713%2048.3378%20280.366%2052.6853%20280.366%2057.9989V193.383C280.366%20214.702%20263.04%20232.028%20241.721%20232.028H203.012C185.043%20232.028%20169.875%20219.694%20165.592%20203.012H145.013C129.04%20203.012%20116.03%20190.002%20116.03%20174.029V48.2412H77.3212C72.0075%2048.2412%2067.66%2052.5887%2067.66%2057.9023V198.214C67.66%20216.86%2052.4921%20232.028%2033.8461%20232.028C15.2002%20232.028%200%20216.86%200%20198.214V38.6445C0%2017.3256%2017.3256%200%2038.6445%200H96.7078C114.645%200%20129.781%2012.3018%20134.128%2028.9189H154.739C170.712%2028.9189%20183.722%2041.9292%20183.722%2057.9023V183.69H203.077C208.39%20183.69%20212.738%20179.343%20212.738%20174.029V38.6445C212.738%2017.3256%20230.063%200%20251.382%200H309.446C327.415%200%20342.583%2012.334%20346.866%2029.0156H367.444C383.418%2029.0156%20396.428%2042.0259%20396.428%2057.9989V198.214C396.428%20216.86%20381.26%20232.06%20362.582%20232.06V232.028ZM348.058%2048.3378V198.214C348.058%20206.2%20354.563%20212.738%20362.582%20212.738C370.6%20212.738%20377.106%20206.233%20377.106%20198.214V57.9989C377.106%2052.6853%20372.758%2048.3378%20367.444%2048.3378H348.09H348.058ZM186.299%20203.012C189.648%20208.809%20195.895%20212.706%20203.045%20212.706H241.753C252.413%20212.706%20261.076%20204.043%20261.076%20193.383V57.9989C261.076%2042.0259%20274.086%2029.0156%20290.059%2029.0156H326.159C322.81%2023.2189%20316.563%2019.3222%20309.413%2019.3222H251.35C240.691%2019.3222%20232.028%2027.985%20232.028%2038.6445V174.029C232.028%20190.002%20219.018%20203.012%20203.045%20203.012H186.266H186.299ZM38.6767%2019.3222C28.0173%2019.3222%2019.3545%2027.985%2019.3545%2038.6445V198.182C19.3545%20206.168%2025.8596%20212.673%2033.8783%20212.673C41.897%20212.673%2048.37%20206.168%2048.37%20198.182V57.9023C48.37%2041.9292%2061.3803%2028.9189%2077.3533%2028.9189H113.422C110.072%2023.1867%20103.825%2019.3222%2096.74%2019.3222H38.6767ZM135.352%2048.2412V174.029C135.352%20179.343%20139.7%20183.69%20145.013%20183.69H164.368V57.9023C164.368%2052.5887%20160.02%2048.2412%20154.707%2048.2412H135.352ZM905.375%20196.572C902.638%20193.995%20901.253%20189.422%20901.253%20182.821V83.3432H937.772V51.7836H901.253V0H862.705V51.7514H830.953V83.311H862.705V188.07C862.705%20202.851%20866.924%20213.833%20875.329%20221.079C883.735%20228.324%20896.648%20231.931%20914.07%20231.931H937.805V200.404H920.06C912.975%20200.404%20908.08%20199.116%20905.375%20196.572ZM777.945%200V38.5156H816.493V0H777.945ZM777.816%20231.963H816.396V51.7836H777.816V231.996V231.963ZM724.101%2055.487C715.051%2050.592%20704.843%2048.1446%20693.475%2048.1446C683.556%2048.1446%20674.443%2049.948%20666.166%2053.6192C657.825%2057.2582%20650.902%2062.2176%20645.266%2068.4651C641.627%2072.5228%20638.729%2077.0313%20636.474%2081.9263C633.383%2073.4245%20628.069%2066.1464%20620.437%2060.0921C610.422%2052.1378%20598.474%2048.1446%20584.594%2048.1446C576.157%2048.1446%20568.235%2049.7225%20560.796%2052.8463C553.389%2055.9701%20546.755%2060.6718%20541.022%2066.9515C537.48%2070.816%20534.453%2075.2923%20531.812%2080.2839V51.7514H493.136V231.931H531.748V123.759C531.748%20114.452%20533.551%20106.691%20537.126%20100.476C540.701%2094.2603%20545.402%2089.5585%20551.295%2086.306C557.124%2083.0534%20563.436%2081.4432%20570.135%2081.4432C580.15%2081.4432%20588.394%2084.5348%20594.899%2090.6857C601.372%2096.8366%20604.625%20104.952%20604.625%20115.096V231.963H642.496V120.023C642.496%20112.52%20644.01%20105.854%20647.005%20100.057C650.032%2094.2603%20654.315%2089.7196%20659.886%2086.4026C665.425%2083.1178%20672.156%2081.4754%20680.014%2081.4754C689.417%2081.4754%20697.661%2084.3093%20704.65%2089.9772C711.638%2095.6451%20715.148%20104.823%20715.148%20117.447V231.931H753.728V113.325C753.728%2098.962%20751.055%2086.9822%20745.709%2077.3211C740.364%2067.6278%20733.15%2060.382%20724.133%2055.4548L724.101%2055.487ZM1257.91%200V231.931H1296.49V0H1257.91ZM1083.04%2056.2277C1073.29%2050.8497%201062.18%2048.1124%201049.78%2048.1124C1034.51%2048.1124%201021.66%2052.17%201011.2%2060.3176C1005.27%2064.9227%201000.12%2070.8482%20995.675%2078.0296V0H957.094V231.963H995.675V128.847C995.675%20117.93%20997.51%20109.042%201001.21%20102.215C1004.92%2095.3874%201009.94%2090.3314%201016.32%2087.1111C1022.69%2083.8585%201029.81%2082.2483%201037.64%2082.2483C1049.81%2082.2483%201059.28%2085.8229%201065.98%2092.9721C1072.67%20100.121%201076.02%20110.716%201076.02%20124.693V231.835H1114.76V119.572C1114.76%20103.857%201111.93%2090.7501%201106.26%2080.1551C1100.56%2069.5922%201092.83%2061.5735%201083.04%2056.1955V56.2277ZM1206.22%2053.3938C1200.78%2054.7463%201196.08%2056.9684%201192.12%2060.0599C1185.81%2064.9871%201181.01%2071.7499%201177.69%2080.3483L1176.6%2083.3432H1177.46V51.7836H1138.88V231.996H1177.46V129.298C1177.46%20119.605%201179.07%20111.586%201182.39%20105.21C1185.68%2098.8332%201190.12%2094.0993%201195.69%2090.9755C1201.26%2087.8517%201207.38%2086.2738%201214.08%2086.2738C1214.08%2086.2738%201214.08%2086.2738%201214.11%2086.2738C1214.11%2086.2738%201214.18%2086.2738%201214.21%2086.2738H1238.62V51.7836H1220.26C1215.14%2051.7836%201210.47%2052.3632%201206.22%2053.426V53.3938Z'%20fill='white'/%3e%3c/svg%3e", Pt = "data:image/svg+xml,%3csvg%20width='1297'%20height='233'%20viewBox='0%200%201297%20233'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M362.582%20232.028C343.936%20232.028%20328.736%20216.86%20328.736%20198.182V48.3378H290.027C284.713%2048.3378%20280.366%2052.6853%20280.366%2057.9989V193.383C280.366%20214.702%20263.04%20232.028%20241.721%20232.028H203.012C185.043%20232.028%20169.875%20219.694%20165.592%20203.012H145.013C129.04%20203.012%20116.03%20190.002%20116.03%20174.029V48.2412H77.3212C72.0075%2048.2412%2067.66%2052.5887%2067.66%2057.9023V198.214C67.66%20216.86%2052.4921%20232.028%2033.8461%20232.028C15.2002%20232.028%200%20216.86%200%20198.214V38.6445C0%2017.3256%2017.3256%200%2038.6445%200H96.7078C114.645%200%20129.781%2012.3018%20134.128%2028.9189H154.739C170.712%2028.9189%20183.722%2041.9292%20183.722%2057.9023V183.69H203.077C208.39%20183.69%20212.738%20179.343%20212.738%20174.029V38.6445C212.738%2017.3256%20230.063%200%20251.382%200H309.446C327.415%200%20342.583%2012.334%20346.866%2029.0156H367.444C383.418%2029.0156%20396.428%2042.0259%20396.428%2057.9989V198.214C396.428%20216.86%20381.26%20232.06%20362.582%20232.06V232.028ZM348.058%2048.3378V198.214C348.058%20206.2%20354.563%20212.738%20362.582%20212.738C370.6%20212.738%20377.106%20206.233%20377.106%20198.214V57.9989C377.106%2052.6853%20372.758%2048.3378%20367.444%2048.3378H348.09H348.058ZM186.299%20203.012C189.648%20208.809%20195.895%20212.706%20203.045%20212.706H241.753C252.413%20212.706%20261.076%20204.043%20261.076%20193.383V57.9989C261.076%2042.0259%20274.086%2029.0156%20290.059%2029.0156H326.159C322.81%2023.2189%20316.563%2019.3222%20309.413%2019.3222H251.35C240.691%2019.3222%20232.028%2027.985%20232.028%2038.6445V174.029C232.028%20190.002%20219.018%20203.012%20203.045%20203.012H186.266H186.299ZM38.6767%2019.3222C28.0173%2019.3222%2019.3545%2027.985%2019.3545%2038.6445V198.182C19.3545%20206.168%2025.8596%20212.673%2033.8783%20212.673C41.897%20212.673%2048.37%20206.168%2048.37%20198.182V57.9023C48.37%2041.9292%2061.3803%2028.9189%2077.3533%2028.9189H113.422C110.072%2023.1867%20103.825%2019.3222%2096.74%2019.3222H38.6767ZM135.352%2048.2412V174.029C135.352%20179.343%20139.7%20183.69%20145.013%20183.69H164.368V57.9023C164.368%2052.5887%20160.02%2048.2412%20154.707%2048.2412H135.352ZM905.375%20196.572C902.638%20193.995%20901.253%20189.422%20901.253%20182.821V83.3432H937.772V51.7836H901.253V0H862.705V51.7514H830.953V83.311H862.705V188.07C862.705%20202.851%20866.924%20213.833%20875.329%20221.079C883.735%20228.324%20896.648%20231.931%20914.07%20231.931H937.804V200.404H920.06C912.975%20200.404%20908.08%20199.116%20905.375%20196.572ZM777.945%200V38.5156H816.493V0H777.945ZM777.816%20231.963H816.396V51.7836H777.816V231.996V231.963ZM724.101%2055.487C715.051%2050.592%20704.843%2048.1446%20693.475%2048.1446C683.556%2048.1446%20674.443%2049.948%20666.166%2053.6192C657.825%2057.2582%20650.902%2062.2176%20645.266%2068.4651C641.627%2072.5228%20638.729%2077.0313%20636.474%2081.9263C633.383%2073.4245%20628.069%2066.1464%20620.437%2060.0921C610.422%2052.1378%20598.474%2048.1446%20584.594%2048.1446C576.157%2048.1446%20568.235%2049.7225%20560.796%2052.8463C553.389%2055.9701%20546.755%2060.6718%20541.022%2066.9515C537.48%2070.816%20534.453%2075.2923%20531.812%2080.2839V51.7514H493.136V231.931H531.748V123.759C531.748%20114.452%20533.551%20106.691%20537.126%20100.476C540.7%2094.2603%20545.402%2089.5585%20551.295%2086.306C557.124%2083.0534%20563.436%2081.4432%20570.135%2081.4432C580.15%2081.4432%20588.394%2084.5348%20594.899%2090.6857C601.372%2096.8366%20604.625%20104.952%20604.625%20115.096V231.963H642.496V120.023C642.496%20112.52%20644.01%20105.854%20647.005%20100.057C650.032%2094.2603%20654.315%2089.7196%20659.886%2086.4026C665.425%2083.1178%20672.156%2081.4754%20680.014%2081.4754C689.417%2081.4754%20697.661%2084.3093%20704.65%2089.9772C711.638%2095.645%20715.148%20104.823%20715.148%20117.447V231.931H753.728V113.325C753.728%2098.962%20751.055%2086.9822%20745.709%2077.3211C740.364%2067.6278%20733.15%2060.382%20724.133%2055.4548L724.101%2055.487ZM1257.91%200V231.931H1296.49V0H1257.91ZM1083.04%2056.2277C1073.29%2050.8497%201062.18%2048.1124%201049.78%2048.1124C1034.51%2048.1124%201021.66%2052.17%201011.2%2060.3176C1005.27%2064.9227%201000.12%2070.8482%20995.675%2078.0296V0H957.094V231.963H995.675V128.847C995.675%20117.93%20997.51%20109.042%201001.21%20102.215C1004.92%2095.3874%201009.94%2090.3314%201016.32%2087.1111C1022.69%2083.8585%201029.81%2082.2483%201037.64%2082.2483C1049.81%2082.2483%201059.28%2085.8229%201065.98%2092.9721C1072.67%20100.121%201076.02%20110.716%201076.02%20124.693V231.835H1114.76V119.572C1114.76%20103.857%201111.93%2090.7501%201106.26%2080.1551C1100.56%2069.5922%201092.83%2061.5735%201083.04%2056.1955V56.2277ZM1206.22%2053.3938C1200.78%2054.7463%201196.08%2056.9684%201192.12%2060.0599C1185.81%2064.9871%201181.01%2071.7499%201177.69%2080.3483L1176.6%2083.3432H1177.46V51.7836H1138.88V231.996H1177.46V129.298C1177.46%20119.605%201179.07%20111.586%201182.39%20105.21C1185.68%2098.8332%201190.12%2094.0993%201195.69%2090.9755C1201.26%2087.8517%201207.38%2086.2738%201214.08%2086.2738C1214.08%2086.2738%201214.08%2086.2738%201214.11%2086.2738C1214.11%2086.2738%201214.18%2086.2738%201214.21%2086.2738H1238.62V51.7836H1220.26C1215.14%2051.7836%201210.47%2052.3632%201206.22%2053.426V53.3938Z'%20fill='%23181818'/%3e%3c/svg%3e", Ft = [
1823
+ "aria-controls",
1824
+ "aria-expanded",
1825
+ "aria-haspopup",
1826
+ "aria-label",
1827
+ "children",
1828
+ "className",
1829
+ "onClick",
1830
+ "type"
1831
+ ];
1832
+ function It(...e) {
1833
+ return e.filter(Boolean).join(" ");
1834
+ }
1835
+ var Lt = E(function({ brandHref: e = "/", brandLabel: t = "Mithrl home", brandLinkProps: n, theme: r, defaultTheme: i = "light", onThemeChange: a, accountLabel: o, accountMenu: s, accountImageSrc: c, accountInitials: l, onAccountClick: u, accountMenuOpen: d, defaultAccountMenuOpen: f, onAccountMenuOpenChange: p, accountButtonProps: m, className: h, ...g }, _) {
1836
+ let v = P(null), y = r !== void 0, [b, x] = F(i), S = o.trim(), C = t.trim();
1837
+ if (!S) throw Error("GlobalAppBar requires a non-empty accountLabel.");
1838
+ if (!C) throw Error("GlobalAppBar requires a non-empty brandLabel.");
1839
+ let w = Ft.find((e) => e in (m ?? {}));
1840
+ if (w) throw Error(`GlobalAppBar accountButtonProps does not support ${w}.`);
1841
+ let T = r ?? b, E = (e) => {
1842
+ y || x(e), a?.(e);
1843
+ };
1844
+ return /* @__PURE__ */ R("header", {
1845
+ ...g,
1846
+ ref: _,
1847
+ className: It("mithrl-global-app-bar", h),
1848
+ "data-theme": T,
1849
+ children: [
1850
+ /* @__PURE__ */ R("a", {
1851
+ ...n,
1852
+ className: "mithrl-global-app-bar__brand",
1853
+ href: e,
1854
+ "aria-label": C,
1855
+ children: [/* @__PURE__ */ L("img", {
1856
+ className: "mithrl-global-app-bar__brand-artwork mithrl-global-app-bar__brand-artwork--light",
1857
+ src: Pt,
1858
+ alt: "",
1859
+ "aria-hidden": "true"
1860
+ }), /* @__PURE__ */ L("img", {
1861
+ className: "mithrl-global-app-bar__brand-artwork mithrl-global-app-bar__brand-artwork--dark",
1862
+ src: Nt,
1863
+ alt: "",
1864
+ "aria-hidden": "true"
1865
+ })]
1866
+ }),
1867
+ /* @__PURE__ */ L("span", {
1868
+ className: "mithrl-global-app-bar__spacer",
1869
+ "aria-hidden": "true"
1870
+ }),
1871
+ /* @__PURE__ */ L(pe, {
1872
+ theme: T,
1873
+ onThemeChange: E
1874
+ }),
1875
+ /* @__PURE__ */ R(Ct, {
1876
+ open: d,
1877
+ defaultOpen: f,
1878
+ onOpenChange: p,
1879
+ children: [/* @__PURE__ */ L(St, { render: /* @__PURE__ */ L("button", {
1880
+ ...m,
1881
+ className: "mithrl-global-app-bar__account",
1882
+ type: "button",
1883
+ "aria-label": S,
1884
+ onClick: u,
1885
+ children: /* @__PURE__ */ L(Ye, {
1886
+ size: "small",
1887
+ src: c,
1888
+ initials: l
1889
+ })
1890
+ }) }), /* @__PURE__ */ L(Mt, {
1891
+ ...s,
1892
+ portalContainer: s.portalContainer ?? v
1893
+ })]
1894
+ }),
1895
+ /* @__PURE__ */ L("div", {
1896
+ className: "mithrl-global-app-bar__account-menu-portal",
1897
+ ref: v
1898
+ })
1899
+ ]
1900
+ });
1901
+ }), Rt = {
1902
+ rings: 1,
1903
+ "split-response": 2,
1904
+ "mini-matrices": 3,
1905
+ "dot-series": 4,
1906
+ "broken-chain": 5,
1907
+ "orbital-pairs": 1,
1908
+ "pulse-clusters": 2,
1909
+ "ladder-sequence": 3,
1910
+ "alternating-targets": 4,
1911
+ "offset-constellations": 5,
1912
+ "mirrored-waves": 1,
1913
+ "binary-colonies": 2,
1914
+ "crossing-signals": 3,
1915
+ "nested-cadence": 4,
1916
+ "fragmented-axis": 5
1917
+ };
1918
+ function zt(e, t) {
1919
+ typeof e == "function" ? e(t) : e && (e.current = t);
1920
+ }
1921
+ function Bt() {
1922
+ return /* @__PURE__ */ L(I, { children: [
1923
+ -10,
1924
+ 38,
1925
+ 84,
1926
+ 130,
1927
+ 176,
1928
+ 224,
1929
+ 270,
1930
+ 316,
1931
+ 362,
1932
+ 408
1933
+ ].map((e, t) => {
1934
+ let n = t % 4;
1935
+ return n === 0 ? /* @__PURE__ */ L("circle", {
1936
+ cx: e,
1937
+ cy: "44",
1938
+ r: "12",
1939
+ fill: "currentColor"
1940
+ }, e) : n === 1 ? /* @__PURE__ */ R("g", { children: [/* @__PURE__ */ L("circle", {
1941
+ cx: e,
1942
+ cy: "44",
1943
+ r: "14",
1944
+ fill: "none",
1945
+ stroke: "currentColor",
1946
+ strokeWidth: "1.5"
1947
+ }), /* @__PURE__ */ L("circle", {
1948
+ cx: e,
1949
+ cy: "44",
1950
+ r: "9",
1951
+ fill: "currentColor"
1952
+ })] }, e) : /* @__PURE__ */ L("circle", {
1953
+ cx: e,
1954
+ cy: "44",
1955
+ r: n === 2 ? 12 : 14,
1956
+ fill: "none",
1957
+ stroke: "currentColor",
1958
+ strokeWidth: n === 2 ? 2.5 : 1.5,
1959
+ strokeDasharray: n === 3 ? "3 3" : void 0
1960
+ }, e);
1961
+ }) });
1962
+ }
1963
+ function Vt() {
1964
+ return /* @__PURE__ */ R(I, { children: [
1965
+ /* @__PURE__ */ L("circle", {
1966
+ cx: "60",
1967
+ cy: "44",
1968
+ r: "12",
1969
+ fill: "currentColor"
1970
+ }),
1971
+ /* @__PURE__ */ L("circle", {
1972
+ cx: "340",
1973
+ cy: "44",
1974
+ r: "12",
1975
+ fill: "currentColor"
1976
+ }),
1977
+ [
1978
+ 154,
1979
+ 174,
1980
+ 188,
1981
+ 212,
1982
+ 226,
1983
+ 246
1984
+ ].map((e) => /* @__PURE__ */ L("circle", {
1985
+ cx: e,
1986
+ cy: "44",
1987
+ r: "2.5",
1988
+ fill: "currentColor"
1989
+ }, e)),
1990
+ /* @__PURE__ */ L("line", {
1991
+ x1: "200",
1992
+ y1: "16",
1993
+ x2: "200",
1994
+ y2: "72",
1995
+ stroke: "currentColor",
1996
+ strokeWidth: "2"
1997
+ })
1998
+ ] });
1999
+ }
2000
+ function Ht() {
2001
+ return /* @__PURE__ */ L(I, { children: [
2002
+ 38,
2003
+ 74,
2004
+ 110,
2005
+ 146,
2006
+ 182,
2007
+ 218,
2008
+ 254,
2009
+ 290,
2010
+ 326,
2011
+ 362
2012
+ ].map((e) => /* @__PURE__ */ L("g", {
2013
+ transform: `translate(${e - 9.5} 34)`,
2014
+ children: Array.from({ length: 5 }, (e, t) => Array.from({ length: 5 }, (e, n) => /* @__PURE__ */ L("rect", {
2015
+ x: n * 4,
2016
+ y: t * 4,
2017
+ width: "3",
2018
+ height: "3",
2019
+ fill: "none",
2020
+ stroke: "currentColor",
2021
+ strokeWidth: "0.75"
2022
+ }, `${t}-${n}`)))
2023
+ }, e)) });
2024
+ }
2025
+ function Ut() {
2026
+ return /* @__PURE__ */ L(I, { children: [
2027
+ -8,
2028
+ 38,
2029
+ 84,
2030
+ 130,
2031
+ 176,
2032
+ 224,
2033
+ 270,
2034
+ 316,
2035
+ 362,
2036
+ 408
2037
+ ].map((e) => /* @__PURE__ */ L("circle", {
2038
+ cx: e,
2039
+ cy: "44",
2040
+ r: "12",
2041
+ fill: "currentColor"
2042
+ }, e)) });
2043
+ }
2044
+ function Wt() {
2045
+ return /* @__PURE__ */ R(I, { children: [
2046
+ /* @__PURE__ */ L("path", {
2047
+ d: "M-24 44H54 M54 44H116 M284 44H346 M346 44H424",
2048
+ fill: "none",
2049
+ stroke: "currentColor",
2050
+ strokeWidth: "2"
2051
+ }),
2052
+ /* @__PURE__ */ L("path", {
2053
+ d: "M116 30L144 58 M256 58L284 30",
2054
+ fill: "none",
2055
+ stroke: "currentColor",
2056
+ strokeWidth: "2"
2057
+ }),
2058
+ [
2059
+ 54,
2060
+ 146,
2061
+ 254,
2062
+ 346
2063
+ ].map((e) => /* @__PURE__ */ L("circle", {
2064
+ cx: e,
2065
+ cy: "44",
2066
+ r: "11",
2067
+ fill: "currentColor"
2068
+ }, e))
2069
+ ] });
2070
+ }
2071
+ function Gt() {
2072
+ return /* @__PURE__ */ L(I, { children: [
2073
+ 72,
2074
+ 200,
2075
+ 328
2076
+ ].map((e, t) => /* @__PURE__ */ R("g", {
2077
+ transform: `rotate(${t % 2 ? 90 : 0} ${e} 44)`,
2078
+ children: [
2079
+ /* @__PURE__ */ L("ellipse", {
2080
+ cx: e,
2081
+ cy: "44",
2082
+ rx: "34",
2083
+ ry: "18",
2084
+ fill: "none",
2085
+ stroke: "currentColor",
2086
+ strokeWidth: "1.5"
2087
+ }),
2088
+ /* @__PURE__ */ L("circle", {
2089
+ cx: e - 24,
2090
+ cy: "44",
2091
+ r: "6",
2092
+ fill: "currentColor"
2093
+ }),
2094
+ /* @__PURE__ */ L("circle", {
2095
+ cx: e + 24,
2096
+ cy: "44",
2097
+ r: "6",
2098
+ fill: "currentColor"
2099
+ })
2100
+ ]
2101
+ }, e)) });
2102
+ }
2103
+ function Kt() {
2104
+ return /* @__PURE__ */ L(I, { children: [
2105
+ -150,
2106
+ -90,
2107
+ -30,
2108
+ 30,
2109
+ 90,
2110
+ 150
2111
+ ].map((e, t) => /* @__PURE__ */ R("g", {
2112
+ transform: `translate(${200 + e} 44)`,
2113
+ children: [/* @__PURE__ */ L("circle", {
2114
+ r: [
2115
+ 9,
2116
+ 5,
2117
+ 9,
2118
+ 9,
2119
+ 5,
2120
+ 9
2121
+ ][t],
2122
+ fill: "currentColor"
2123
+ }), /* @__PURE__ */ L("circle", {
2124
+ r: [
2125
+ 17,
2126
+ 13,
2127
+ 17,
2128
+ 17,
2129
+ 13,
2130
+ 17
2131
+ ][t],
2132
+ fill: "none",
2133
+ stroke: "currentColor",
2134
+ strokeWidth: "1.25",
2135
+ opacity: "0.65"
2136
+ })]
2137
+ }, e)) });
2138
+ }
2139
+ function qt() {
2140
+ return /* @__PURE__ */ R(I, { children: [[
2141
+ -8,
2142
+ 38,
2143
+ 84,
2144
+ 130,
2145
+ 176,
2146
+ 224,
2147
+ 270,
2148
+ 316,
2149
+ 362,
2150
+ 408
2151
+ ].map((e, t) => {
2152
+ let n = 24 + t % 3 * 20;
2153
+ return /* @__PURE__ */ L("rect", {
2154
+ x: e - 13,
2155
+ y: n - 4,
2156
+ width: "26",
2157
+ height: "8",
2158
+ rx: "3",
2159
+ fill: "currentColor"
2160
+ }, e);
2161
+ }), /* @__PURE__ */ L("line", {
2162
+ x1: "-20",
2163
+ y1: "44",
2164
+ x2: "420",
2165
+ y2: "44",
2166
+ stroke: "currentColor",
2167
+ strokeWidth: "1",
2168
+ opacity: "0.45"
2169
+ })] });
2170
+ }
2171
+ function Jt() {
2172
+ return /* @__PURE__ */ L(I, { children: [
2173
+ -11,
2174
+ 38,
2175
+ 84,
2176
+ 130,
2177
+ 176,
2178
+ 224,
2179
+ 270,
2180
+ 316,
2181
+ 362,
2182
+ 408
2183
+ ].map((e, t) => t % 2 ? /* @__PURE__ */ R("g", { children: [/* @__PURE__ */ L("circle", {
2184
+ cx: e,
2185
+ cy: "44",
2186
+ r: "14",
2187
+ fill: "none",
2188
+ stroke: "currentColor",
2189
+ strokeWidth: "1.5"
2190
+ }), /* @__PURE__ */ L("circle", {
2191
+ cx: e,
2192
+ cy: "44",
2193
+ r: "6",
2194
+ fill: "currentColor"
2195
+ })] }, e) : /* @__PURE__ */ L("circle", {
2196
+ cx: e,
2197
+ cy: "44",
2198
+ r: "11",
2199
+ fill: "currentColor"
2200
+ }, e)) });
2201
+ }
2202
+ function Yt() {
2203
+ return /* @__PURE__ */ R(I, { children: [/* @__PURE__ */ L("path", {
2204
+ d: "M44 30L76 54L112 26L148 60L176 38 M224 38L252 60L288 26L324 54L356 30",
2205
+ fill: "none",
2206
+ stroke: "currentColor",
2207
+ strokeWidth: "1.25",
2208
+ opacity: "0.7"
2209
+ }), [
2210
+ [44, 30],
2211
+ [76, 54],
2212
+ [112, 26],
2213
+ [148, 60],
2214
+ [176, 38],
2215
+ [224, 38],
2216
+ [252, 60],
2217
+ [288, 26],
2218
+ [324, 54],
2219
+ [356, 30]
2220
+ ].map(([e, t], n) => /* @__PURE__ */ L("circle", {
2221
+ cx: e,
2222
+ cy: t,
2223
+ r: n % 3 == 0 ? 6 : 4,
2224
+ fill: "currentColor"
2225
+ }, n))] });
2226
+ }
2227
+ function Xt() {
2228
+ return /* @__PURE__ */ R(I, { children: [/* @__PURE__ */ L("path", {
2229
+ d: "M-20 44C20 6 60 6 100 44S180 82 200 44S280 6 300 44S380 82 420 44",
2230
+ fill: "none",
2231
+ stroke: "currentColor",
2232
+ strokeWidth: "2"
2233
+ }), /* @__PURE__ */ L("path", {
2234
+ d: "M-20 44C20 82 60 82 100 44S180 6 200 44S280 82 300 44S380 6 420 44",
2235
+ fill: "none",
2236
+ stroke: "currentColor",
2237
+ strokeWidth: "1",
2238
+ opacity: "0.55"
2239
+ })] });
2240
+ }
2241
+ function Zt() {
2242
+ return /* @__PURE__ */ L(I, { children: [
2243
+ -8,
2244
+ 38,
2245
+ 84,
2246
+ 130,
2247
+ 176,
2248
+ 224,
2249
+ 270,
2250
+ 316,
2251
+ 362,
2252
+ 408
2253
+ ].map((e, t) => /* @__PURE__ */ R("g", { children: [/* @__PURE__ */ L("circle", {
2254
+ cx: e,
2255
+ cy: t % 2 ? 30 : 44,
2256
+ r: t % 3 ? 7 : 11,
2257
+ fill: t % 2 ? "currentColor" : "none",
2258
+ stroke: "currentColor",
2259
+ strokeWidth: "1.5"
2260
+ }), /* @__PURE__ */ L("circle", {
2261
+ cx: e,
2262
+ cy: t % 2 ? 58 : 66,
2263
+ r: "3",
2264
+ fill: "currentColor",
2265
+ opacity: "0.65"
2266
+ })] }, e)) });
2267
+ }
2268
+ function Qt() {
2269
+ return /* @__PURE__ */ R(I, { children: [
2270
+ /* @__PURE__ */ L("path", {
2271
+ d: "M-20 68L120 20L200 68L280 20L420 68",
2272
+ fill: "none",
2273
+ stroke: "currentColor",
2274
+ strokeWidth: "1.5"
2275
+ }),
2276
+ /* @__PURE__ */ L("path", {
2277
+ d: "M-20 20L120 68L200 20L280 68L420 20",
2278
+ fill: "none",
2279
+ stroke: "currentColor",
2280
+ strokeWidth: "1.5",
2281
+ opacity: "0.55"
2282
+ }),
2283
+ [
2284
+ 120,
2285
+ 200,
2286
+ 280
2287
+ ].map((e) => /* @__PURE__ */ L("circle", {
2288
+ cx: e,
2289
+ cy: "44",
2290
+ r: "7",
2291
+ fill: "currentColor"
2292
+ }, e))
2293
+ ] });
2294
+ }
2295
+ function $t() {
2296
+ return /* @__PURE__ */ L(I, { children: [
2297
+ 44,
2298
+ 96,
2299
+ 148,
2300
+ 200,
2301
+ 252,
2302
+ 304,
2303
+ 356
2304
+ ].map((e, t) => /* @__PURE__ */ R("g", { children: [t % 2 ? /* @__PURE__ */ L("rect", {
2305
+ x: e - 14,
2306
+ y: "30",
2307
+ width: "28",
2308
+ height: "28",
2309
+ rx: "6",
2310
+ fill: "none",
2311
+ stroke: "currentColor",
2312
+ strokeWidth: "1.5"
2313
+ }) : /* @__PURE__ */ L("circle", {
2314
+ cx: e,
2315
+ cy: "44",
2316
+ r: "14",
2317
+ fill: "none",
2318
+ stroke: "currentColor",
2319
+ strokeWidth: "1.5"
2320
+ }), /* @__PURE__ */ L("circle", {
2321
+ cx: e,
2322
+ cy: "44",
2323
+ r: t % 2 ? 5 : 8,
2324
+ fill: "currentColor"
2325
+ })] }, e)) });
2326
+ }
2327
+ function en() {
2328
+ return /* @__PURE__ */ R(I, { children: [/* @__PURE__ */ L("line", {
2329
+ x1: "-20",
2330
+ y1: "44",
2331
+ x2: "420",
2332
+ y2: "44",
2333
+ stroke: "currentColor",
2334
+ strokeWidth: "1",
2335
+ opacity: "0.45"
2336
+ }), [
2337
+ [-8, 38],
2338
+ [54, 104],
2339
+ [122, 176],
2340
+ [224, 278],
2341
+ [296, 346],
2342
+ [362, 408]
2343
+ ].map(([e, t], n) => /* @__PURE__ */ R(w, { children: [/* @__PURE__ */ L("line", {
2344
+ x1: e,
2345
+ y1: n % 2 ? 34 : 54,
2346
+ x2: t,
2347
+ y2: n % 2 ? 34 : 54,
2348
+ stroke: "currentColor",
2349
+ strokeWidth: "4",
2350
+ strokeLinecap: "round"
2351
+ }), /* @__PURE__ */ L("circle", {
2352
+ cx: (e + t) / 2,
2353
+ cy: n % 2 ? 34 : 54,
2354
+ r: "6",
2355
+ fill: "currentColor"
2356
+ })] }, e))] });
2357
+ }
2358
+ function tn({ artwork: e }) {
2359
+ let t;
2360
+ switch (e) {
2361
+ case "rings":
2362
+ t = /* @__PURE__ */ L(Bt, {});
2363
+ break;
2364
+ case "split-response":
2365
+ t = /* @__PURE__ */ L(Vt, {});
2366
+ break;
2367
+ case "mini-matrices":
2368
+ t = /* @__PURE__ */ L(Ht, {});
2369
+ break;
2370
+ case "dot-series":
2371
+ t = /* @__PURE__ */ L(Ut, {});
2372
+ break;
2373
+ case "broken-chain":
2374
+ t = /* @__PURE__ */ L(Wt, {});
2375
+ break;
2376
+ case "orbital-pairs":
2377
+ t = /* @__PURE__ */ L(Gt, {});
2378
+ break;
2379
+ case "pulse-clusters":
2380
+ t = /* @__PURE__ */ L(Kt, {});
2381
+ break;
2382
+ case "ladder-sequence":
2383
+ t = /* @__PURE__ */ L(qt, {});
2384
+ break;
2385
+ case "alternating-targets":
2386
+ t = /* @__PURE__ */ L(Jt, {});
2387
+ break;
2388
+ case "offset-constellations":
2389
+ t = /* @__PURE__ */ L(Yt, {});
2390
+ break;
2391
+ case "mirrored-waves":
2392
+ t = /* @__PURE__ */ L(Xt, {});
2393
+ break;
2394
+ case "binary-colonies":
2395
+ t = /* @__PURE__ */ L(Zt, {});
2396
+ break;
2397
+ case "crossing-signals":
2398
+ t = /* @__PURE__ */ L(Qt, {});
2399
+ break;
2400
+ case "nested-cadence":
2401
+ t = /* @__PURE__ */ L($t, {});
2402
+ break;
2403
+ case "fragmented-axis":
2404
+ t = /* @__PURE__ */ L(en, {});
2405
+ break;
2406
+ }
2407
+ return /* @__PURE__ */ L("svg", {
2408
+ className: `mithrl-project-card__artwork mithrl-project-card__artwork--chart-${Rt[e]}`,
2409
+ "data-artwork": e,
2410
+ viewBox: "0 0 400 88",
2411
+ width: "400",
2412
+ height: "88",
2413
+ "aria-hidden": "true",
2414
+ focusable: "false",
2415
+ children: /* @__PURE__ */ L("g", {
2416
+ "data-artwork-content": "",
2417
+ children: t
2418
+ })
2419
+ });
2420
+ }
2421
+ function nn(e) {
2422
+ return e === "updated" ? "Updated" : "Created";
2423
+ }
2424
+ function rn(...e) {
2425
+ return e.filter(Boolean).join(" ");
2426
+ }
2427
+ var an = E(function({ href: e, name: t, presentation: n = "grid", previewArtwork: r, activity: i, description: a, creator: o, metrics: s = [], headingLevel: c = "h3", className: l, "aria-label": u, "aria-describedby": d, "data-preview-state": f, title: p, ...m }, h) {
2428
+ let g = P(null), [_, v] = F(!1), y = A(), b = t.trim(), x = a?.trim(), S = o?.name.trim(), C = s.map((e) => ({
2429
+ ...e,
2430
+ label: e.label.trim()
2431
+ })).filter((e) => e.label), T = O((e) => {
2432
+ g.current = e, zt(h, e);
2433
+ }, [h]);
2434
+ if (k(() => {
2435
+ let e = g.current;
2436
+ if (!e || typeof ResizeObserver > "u") return;
2437
+ let t = (e) => v(e <= 280);
2438
+ t(e.getBoundingClientRect().width);
2439
+ let n = new ResizeObserver(([e]) => t(e.contentRect.width));
2440
+ return n.observe(e), () => n.disconnect();
2441
+ }, []), !e.trim()) throw Error("ProjectCard requires a non-empty href.");
2442
+ if (!b) throw Error("ProjectCard requires a non-empty name.");
2443
+ if (!i.label.trim() || !i.dateTime.trim()) throw Error("ProjectCard activity requires label and dateTime.");
2444
+ if (s.length > 3) throw Error("ProjectCard supports at most three metrics.");
2445
+ if (o && !S) throw Error("ProjectCard creator requires a non-empty name.");
2446
+ let E = c, D = `${nn(i.kind)} ${i.label.trim()}`;
2447
+ return /* @__PURE__ */ R("a", {
2448
+ ...m,
2449
+ ref: T,
2450
+ href: e,
2451
+ "aria-label": u ?? b,
2452
+ "aria-describedby": rn(d, S ? y : void 0) || void 0,
2453
+ className: rn("mithrl-project-card", l),
2454
+ "data-presentation": n,
2455
+ "data-preview-state": f,
2456
+ children: [/* @__PURE__ */ L("span", {
2457
+ className: "mithrl-project-card__preview-shell",
2458
+ children: /* @__PURE__ */ R("span", {
2459
+ className: "mithrl-project-card__preview",
2460
+ children: [/* @__PURE__ */ L(We, {
2461
+ className: "mithrl-project-card__activity",
2462
+ children: /* @__PURE__ */ L("time", {
2463
+ dateTime: i.dateTime,
2464
+ children: D
2465
+ })
2466
+ }), /* @__PURE__ */ L(tn, { artwork: r })]
2467
+ })
2468
+ }), /* @__PURE__ */ R("span", {
2469
+ className: "mithrl-project-card__body",
2470
+ children: [/* @__PURE__ */ R("span", {
2471
+ className: "mithrl-project-card__primary",
2472
+ children: [/* @__PURE__ */ L(E, {
2473
+ className: "mithrl-project-card__title",
2474
+ children: b
2475
+ }), x ? /* @__PURE__ */ L("span", {
2476
+ className: "mithrl-project-card__description",
2477
+ children: x
2478
+ }) : null]
2479
+ }), C.length || S ? /* @__PURE__ */ R("span", {
2480
+ className: "mithrl-project-card__metadata",
2481
+ children: [C.length ? /* @__PURE__ */ L("span", {
2482
+ className: "mithrl-project-card__metrics",
2483
+ children: C.map((e, t) => /* @__PURE__ */ R(w, { children: [t ? /* @__PURE__ */ L("span", {
2484
+ className: "mithrl-project-card__metric-separator",
2485
+ "aria-hidden": "true",
2486
+ children: "·"
2487
+ }) : null, /* @__PURE__ */ R("span", { children: [
2488
+ e.value,
2489
+ " ",
2490
+ e.label
2491
+ ] })] }, `${e.label}-${t}`))
2492
+ }) : /* @__PURE__ */ L("span", {}), o && S ? /* @__PURE__ */ R("span", {
2493
+ className: "mithrl-project-card__creator",
2494
+ children: [
2495
+ /* @__PURE__ */ R("span", {
2496
+ id: y,
2497
+ className: "mithrl-project-card__creator-accessible-name",
2498
+ children: ["Project creator: ", S]
2499
+ }),
2500
+ /* @__PURE__ */ L(Se, {
2501
+ content: S,
2502
+ placement: "top",
2503
+ arrow: !0,
2504
+ disabled: !_,
2505
+ children: /* @__PURE__ */ L("span", {
2506
+ className: "mithrl-project-card__creator-avatar",
2507
+ children: /* @__PURE__ */ L(Ye, {
2508
+ size: "small",
2509
+ src: o.imageSrc,
2510
+ initials: o.initials
2511
+ })
2512
+ })
2513
+ }),
2514
+ /* @__PURE__ */ L("span", {
2515
+ className: "mithrl-project-card__creator-name",
2516
+ "aria-hidden": "true",
2517
+ children: S
2518
+ })
2519
+ ]
2520
+ }) : null]
2521
+ }) : null]
2522
+ })]
2523
+ });
2524
+ }), on = {
2525
+ ready: "Ready to add",
2526
+ uploading: "Uploading",
2527
+ completed: "Uploaded",
2528
+ failed: "Upload failed",
2529
+ canceled: "Canceled"
2530
+ };
2531
+ function sn(...e) {
2532
+ return e.filter(Boolean).join(" ");
2533
+ }
2534
+ function cn(e) {
2535
+ return e === 1 ? "resource" : "resources";
2536
+ }
2537
+ function ln(e) {
2538
+ let t = e.length, n = e.filter((e) => e.state === "uploading").length, r = e.filter((e) => e.state === "completed").length, i = e.filter((e) => e.state === "failed").length, a = e.filter((e) => e.state === "canceled").length, o = e.filter((e) => e.state === "ready").length;
2539
+ if (t === 0) return "No resources selected";
2540
+ if (n === t) return `Uploading ${t} ${cn(t)}`;
2541
+ if (r === t) return `${t} ${cn(t)} uploaded`;
2542
+ if (i === t) return `${t} ${t === 1 ? "resource needs" : "resources need"} attention`;
2543
+ if (a === t) return `${t} ${cn(t)} canceled`;
2544
+ if (o === t) return `${t} ${cn(t)} ready to add`;
2545
+ let s = [];
2546
+ return n > 0 && s.push(`${n} uploading`), r > 0 && s.push(`${r} uploaded`), i > 0 && s.push(`${i} ${i === 1 ? "needs" : "need"} attention`), a > 0 && s.push(`${a} canceled`), o > 0 && s.push(`${o} ready`), s.join(", ");
2547
+ }
2548
+ function un(e) {
2549
+ let t = e.id.trim(), n = e.name.trim(), r = e.metadata?.trim(), i = e.errorMessage?.trim();
2550
+ if (!t) throw Error("UploadQueue resources require a non-empty id.");
2551
+ if (!n) throw Error("UploadQueue resources require a non-empty name.");
2552
+ if (e.errorMessage !== void 0 && !i) throw Error("UploadQueue resource errorMessage must not be empty.");
2553
+ return {
2554
+ ...e,
2555
+ id: t,
2556
+ name: n,
2557
+ metadata: r,
2558
+ errorMessage: i
2559
+ };
2560
+ }
2561
+ function dn({ state: e }) {
2562
+ return e === "uploading" ? /* @__PURE__ */ L($e, {
2563
+ decorative: !0,
2564
+ size: "small"
2565
+ }) : e === "completed" ? /* @__PURE__ */ L(G, {
2566
+ glyph: a,
2567
+ size: "default"
2568
+ }) : e === "failed" ? /* @__PURE__ */ L(G, {
2569
+ glyph: i,
2570
+ size: "default"
2571
+ }) : e === "canceled" ? /* @__PURE__ */ L(G, {
2572
+ glyph: _,
2573
+ size: "default"
2574
+ }) : null;
2575
+ }
2576
+ var fn = E(function({ resource: e, stateLabels: t, onRemove: n, onCancel: r, onRetry: i, className: a, ...s }, l) {
2577
+ let u = un(e), d = {
2578
+ ...on,
2579
+ ...t
2580
+ }, f = u.state === "failed" && u.errorMessage ? u.errorMessage : d[u.state], p = u.disabled || u.actionPending, m = u.kind === "folder" ? c : o, h = n ? /* @__PURE__ */ L(q, {
2581
+ variant: "ghost",
2582
+ size: "comfortable",
2583
+ icon: C,
2584
+ "aria-label": `Remove ${u.name}`,
2585
+ disabled: u.disabled,
2586
+ loading: u.actionPending,
2587
+ onClick: () => n(u)
2588
+ }) : null, g = null;
2589
+ return u.state === "ready" ? g = h : u.state === "uploading" && r ? g = /* @__PURE__ */ L(q, {
2590
+ variant: "ghost",
2591
+ size: "comfortable",
2592
+ icon: C,
2593
+ "aria-label": `Cancel upload for ${u.name}`,
2594
+ disabled: u.disabled,
2595
+ loading: u.actionPending,
2596
+ onClick: () => r(u)
2597
+ }) : (u.state === "failed" || u.state === "canceled") && (i || n) && (g = /* @__PURE__ */ R(I, { children: [i ? /* @__PURE__ */ L(U, {
2598
+ variant: "text",
2599
+ size: "compact",
2600
+ "aria-label": `Retry upload for ${u.name}`,
2601
+ disabled: u.disabled,
2602
+ loading: u.actionPending,
2603
+ onClick: () => i(u),
2604
+ children: "Retry"
2605
+ }) : null, h] })), /* @__PURE__ */ R("li", {
2606
+ ...s,
2607
+ ref: l,
2608
+ className: sn("mithrl-upload-queue__item", a),
2609
+ "data-kind": u.kind,
2610
+ "data-state": u.state,
2611
+ "data-action-pending": u.actionPending ? "" : void 0,
2612
+ children: [
2613
+ /* @__PURE__ */ L("span", {
2614
+ className: "mithrl-upload-queue__leading",
2615
+ "aria-hidden": "true",
2616
+ children: /* @__PURE__ */ L(G, {
2617
+ glyph: m,
2618
+ size: "default"
2619
+ })
2620
+ }),
2621
+ /* @__PURE__ */ R("span", {
2622
+ className: "mithrl-upload-queue__copy",
2623
+ children: [/* @__PURE__ */ L(Se, {
2624
+ content: u.name,
2625
+ placement: "top",
2626
+ children: /* @__PURE__ */ L("span", {
2627
+ className: "mithrl-upload-queue__name",
2628
+ tabIndex: 0,
2629
+ children: u.name
2630
+ })
2631
+ }), /* @__PURE__ */ R("span", {
2632
+ className: "mithrl-upload-queue__metadata",
2633
+ children: [u.metadata ? /* @__PURE__ */ R(I, { children: [/* @__PURE__ */ L("span", { children: u.metadata }), /* @__PURE__ */ L("span", {
2634
+ "aria-hidden": "true",
2635
+ children: " · "
2636
+ })] }) : null, /* @__PURE__ */ L("span", {
2637
+ className: "mithrl-upload-queue__status-text",
2638
+ "data-tone": u.state === "failed" ? "destructive" : "neutral",
2639
+ children: f
2640
+ })]
2641
+ })]
2642
+ }),
2643
+ /* @__PURE__ */ R("span", {
2644
+ className: "mithrl-upload-queue__tail",
2645
+ children: [u.state === "ready" ? null : /* @__PURE__ */ L("span", {
2646
+ className: "mithrl-upload-queue__status-icon",
2647
+ "data-state": u.state,
2648
+ "aria-hidden": "true",
2649
+ children: /* @__PURE__ */ L(dn, { state: u.state })
2650
+ }), g ? /* @__PURE__ */ L("span", {
2651
+ className: "mithrl-upload-queue__actions",
2652
+ "aria-disabled": p || void 0,
2653
+ children: g
2654
+ }) : null]
2655
+ })
2656
+ ]
2657
+ });
2658
+ }), pn = E(function({ items: e, label: t = "Selected files and folders", summary: n, showSummary: r = !0, stateLabels: i, onRemove: a, onCancel: o, onRetry: s, announcement: c, className: l, ...u }, d) {
2659
+ let f = `mithrl-upload-queue-label-${A().replace(/:/g, "")}`, p = t.trim(), m = n?.trim(), h = c?.trim(), g = e.map(un), _ = /* @__PURE__ */ new Set();
2660
+ if (!p) throw Error("UploadQueue requires a non-empty label.");
2661
+ if (n !== void 0 && !m) throw Error("UploadQueue summary must not be empty.");
2662
+ if (c !== void 0 && !h) throw Error("UploadQueue announcement must not be empty.");
2663
+ for (let e of g) {
2664
+ if (_.has(e.id)) throw Error(`UploadQueue resource id must be unique: ${e.id}.`);
2665
+ _.add(e.id);
2666
+ }
2667
+ return /* @__PURE__ */ R("section", {
2668
+ ...u,
2669
+ ref: d,
2670
+ role: "region",
2671
+ "aria-labelledby": f,
2672
+ className: sn("mithrl-upload-queue", l),
2673
+ children: [
2674
+ /* @__PURE__ */ R("header", {
2675
+ className: "mithrl-upload-queue__header",
2676
+ children: [/* @__PURE__ */ L("span", {
2677
+ id: f,
2678
+ className: "mithrl-upload-queue__label",
2679
+ children: p
2680
+ }), r ? /* @__PURE__ */ L("span", {
2681
+ className: "mithrl-upload-queue__summary",
2682
+ children: m ?? ln(g)
2683
+ }) : null]
2684
+ }),
2685
+ /* @__PURE__ */ L("ul", {
2686
+ className: "mithrl-upload-queue__list",
2687
+ children: g.map((e) => /* @__PURE__ */ L(fn, {
2688
+ resource: e,
2689
+ stateLabels: i,
2690
+ onRemove: a,
2691
+ onCancel: o,
2692
+ onRetry: s
2693
+ }, e.id))
2694
+ }),
2695
+ /* @__PURE__ */ L("span", {
2696
+ className: "mithrl-upload-queue__announcement",
2697
+ role: "status",
2698
+ "aria-live": "polite",
2699
+ "aria-atomic": "true",
2700
+ children: h ?? ""
2701
+ })
2702
+ ]
2703
+ });
2704
+ });
2705
+ //#endregion
2706
+ //#region src/patterns/project-library/ProjectLibrary.tsx
2707
+ function mn(...e) {
2708
+ return e.filter(Boolean).join(" ");
2709
+ }
2710
+ function hn({ variant: e }) {
2711
+ return /* @__PURE__ */ L("div", {
2712
+ className: "mithrl-project-library__empty-illustration",
2713
+ "data-variant": e,
2714
+ "aria-hidden": "true",
2715
+ children: e === "no-match" ? /* @__PURE__ */ R("svg", {
2716
+ viewBox: "0 0 96 96",
2717
+ focusable: "false",
2718
+ children: [
2719
+ /* @__PURE__ */ L("path", {
2720
+ className: "empty-art__path",
2721
+ d: "M15 33C25 22 35 20 45 29"
2722
+ }),
2723
+ /* @__PURE__ */ L("path", {
2724
+ className: "empty-art__path empty-art__path--quiet",
2725
+ d: "M56 66C67 75 77 72 83 61"
2726
+ }),
2727
+ /* @__PURE__ */ L("circle", {
2728
+ className: "empty-art__node",
2729
+ cx: "19",
2730
+ cy: "58",
2731
+ r: "5"
2732
+ }),
2733
+ /* @__PURE__ */ L("circle", {
2734
+ className: "empty-art__node empty-art__node--quiet",
2735
+ cx: "76",
2736
+ cy: "31",
2737
+ r: "5"
2738
+ }),
2739
+ /* @__PURE__ */ L("circle", {
2740
+ className: "empty-art__target",
2741
+ cx: "47",
2742
+ cy: "48",
2743
+ r: "13"
2744
+ }),
2745
+ /* @__PURE__ */ L("path", {
2746
+ className: "empty-art__gap",
2747
+ d: "M58 58L69 69"
2748
+ })
2749
+ ]
2750
+ }) : /* @__PURE__ */ R("svg", {
2751
+ viewBox: "0 0 96 96",
2752
+ focusable: "false",
2753
+ children: [
2754
+ /* @__PURE__ */ L("circle", {
2755
+ className: "empty-art__orbit",
2756
+ cx: "48",
2757
+ cy: "48",
2758
+ r: "29"
2759
+ }),
2760
+ /* @__PURE__ */ L("circle", {
2761
+ className: "empty-art__target",
2762
+ cx: "48",
2763
+ cy: "48",
2764
+ r: "12"
2765
+ }),
2766
+ /* @__PURE__ */ L("rect", {
2767
+ className: "empty-art__tile",
2768
+ x: "19",
2769
+ y: "25",
2770
+ width: "10",
2771
+ height: "10",
2772
+ rx: "3"
2773
+ }),
2774
+ /* @__PURE__ */ L("rect", {
2775
+ className: "empty-art__tile empty-art__tile--quiet",
2776
+ x: "67",
2777
+ y: "27",
2778
+ width: "10",
2779
+ height: "10",
2780
+ rx: "3"
2781
+ }),
2782
+ /* @__PURE__ */ L("rect", {
2783
+ className: "empty-art__tile",
2784
+ x: "43",
2785
+ y: "70",
2786
+ width: "10",
2787
+ height: "10",
2788
+ rx: "3"
2789
+ }),
2790
+ /* @__PURE__ */ L("path", {
2791
+ className: "empty-art__path",
2792
+ d: "M29 34L38 41M66 36L58 42M48 60V70"
2793
+ })
2794
+ ]
2795
+ })
2796
+ });
2797
+ }
2798
+ function gn({ variant: e }) {
2799
+ return /* @__PURE__ */ L("div", {
2800
+ className: "mithrl-project-library__state-illustration",
2801
+ "data-variant": e,
2802
+ "aria-hidden": "true",
2803
+ children: e === "empty" ? /* @__PURE__ */ R(I, { children: [
2804
+ /* @__PURE__ */ L("span", { className: "state-art__orbit" }),
2805
+ /* @__PURE__ */ L("span", { className: "state-art__project" }),
2806
+ /* @__PURE__ */ L("span", { className: "state-art__node state-art__node--one" }),
2807
+ /* @__PURE__ */ L("span", { className: "state-art__node state-art__node--two" }),
2808
+ /* @__PURE__ */ L("span", { className: "state-art__node state-art__node--three" })
2809
+ ] }) : /* @__PURE__ */ R(I, { children: [
2810
+ /* @__PURE__ */ L("span", { className: "state-art__source" }),
2811
+ /* @__PURE__ */ L("span", { className: "state-art__connection state-art__connection--one" }),
2812
+ /* @__PURE__ */ L("span", { className: "state-art__connection state-art__connection--two" }),
2813
+ /* @__PURE__ */ L("span", { className: "state-art__destination" })
2814
+ ] })
2815
+ });
2816
+ }
2817
+ function _n({ className: e }) {
2818
+ return /* @__PURE__ */ L("li", {
2819
+ className: mn("mithrl-project-library__skeleton-item", e),
2820
+ "aria-hidden": "true",
2821
+ children: /* @__PURE__ */ R("div", {
2822
+ className: "mithrl-project-library__skeleton-card",
2823
+ children: [/* @__PURE__ */ L(nt, {
2824
+ className: "mithrl-project-library__skeleton-preview",
2825
+ radius: "large"
2826
+ }), /* @__PURE__ */ R("div", {
2827
+ className: "mithrl-project-library__skeleton-body",
2828
+ children: [
2829
+ /* @__PURE__ */ L(nt, {
2830
+ className: "mithrl-project-library__skeleton-title",
2831
+ radius: "small"
2832
+ }),
2833
+ /* @__PURE__ */ L(nt, {
2834
+ className: "mithrl-project-library__skeleton-description",
2835
+ radius: "small"
2836
+ }),
2837
+ /* @__PURE__ */ R("div", {
2838
+ className: "mithrl-project-library__skeleton-metadata",
2839
+ children: [
2840
+ /* @__PURE__ */ L(nt, {
2841
+ className: "mithrl-project-library__skeleton-avatar",
2842
+ radius: "full"
2843
+ }),
2844
+ /* @__PURE__ */ L(nt, {
2845
+ className: "mithrl-project-library__skeleton-creator",
2846
+ radius: "small"
2847
+ }),
2848
+ /* @__PURE__ */ L(nt, {
2849
+ className: "mithrl-project-library__skeleton-activity",
2850
+ radius: "small"
2851
+ })
2852
+ ]
2853
+ })
2854
+ ]
2855
+ })]
2856
+ })
2857
+ });
2858
+ }
2859
+ function vn({ value: e, defaultValue: t, onChange: n }) {
2860
+ let [r, i] = F(t), a = e !== void 0;
2861
+ return [e ?? r, O((e) => {
2862
+ a || i(e), n?.(e);
2863
+ }, [a, n])];
2864
+ }
2865
+ function yn(e, t) {
2866
+ let n = Date.parse(e.activity.dateTime), r = Date.parse(t.activity.dateTime), i = Number.isNaN(n) ? 0 : n;
2867
+ return (Number.isNaN(r) ? 0 : r) - i;
2868
+ }
2869
+ function bn(e) {
2870
+ return e.trim().toLocaleLowerCase();
2871
+ }
2872
+ var xn = typeof window > "u" ? k : M;
2873
+ function Sn(e) {
2874
+ let t = /* @__PURE__ */ new Set();
2875
+ for (let n of e) {
2876
+ let e = n.id.trim();
2877
+ if (!e) throw Error("ProjectLibrary projects require a non-empty id.");
2878
+ if (t.has(e)) throw Error(`ProjectLibrary project ids must be unique: "${e}".`);
2879
+ t.add(e);
2880
+ }
2881
+ }
2882
+ var Cn = E(function({ projects: e, state: n = "ready", resultCount: r, scope: i, defaultScope: a = "mine", onScopeChange: o, query: s, defaultQuery: c = "", onQueryChange: l, sort: f, defaultSort: p = "activity", onSortChange: m, presentation: h, defaultPresentation: _ = "grid", onPresentationChange: y, initialVisibleCount: b = 12, loadMoreCount: x = 12, onLoadMore: S, loadingMore: C = !1, retrying: w = !1, onRetry: T, onNewProject: E, newProjectTriggerId: D, newProjectLabel: O = "New project", hideCreatorInMyProjects: j = !0, className: M, ...I }, ee) {
2883
+ let [z, B] = vn({
2884
+ value: i,
2885
+ defaultValue: a,
2886
+ onChange: o
2887
+ }), [V, H] = vn({
2888
+ value: s,
2889
+ defaultValue: c,
2890
+ onChange: l
2891
+ }), [W, ne] = vn({
2892
+ value: f,
2893
+ defaultValue: p,
2894
+ onChange: m
2895
+ }), [K, q] = vn({
2896
+ value: h,
2897
+ defaultValue: _,
2898
+ onChange: y
2899
+ }), [J, Y] = F(b), [X, re] = F(0), ie = P(null), oe = P([]), se = P(null), ce = A().replace(/:/g, ""), le = `project-library-heading-${ce}`, ue = `project-library-results-${ce}`, de = `project-library-scope-mine-${ce}`, fe = `project-library-scope-all-${ce}`, pe = `project-library-view-label-${ce}`, Z = bn(V);
2900
+ if (Sn(e), b < 1 || !Number.isInteger(b)) throw Error("ProjectLibrary initialVisibleCount must be a positive integer.");
2901
+ if (x < 1 || !Number.isInteger(x)) throw Error("ProjectLibrary loadMoreCount must be a positive integer.");
2902
+ if (r !== void 0 && r < 0) throw Error("ProjectLibrary resultCount cannot be negative.");
2903
+ if (!O.trim()) throw Error("ProjectLibrary requires a non-empty newProjectLabel.");
2904
+ if (n === "error" && !T) throw Error("ProjectLibrary requires onRetry when state is error.");
2905
+ if (w && n !== "error") throw Error("ProjectLibrary retrying is only valid when state is error.");
2906
+ let me = N(() => {
2907
+ let t = z === "mine" ? e.filter((e) => e.ownedByCurrentUser) : [...e];
2908
+ return [...Z ? t.filter((e) => [e.name, e.description].filter(Boolean).some((e) => e.toLocaleLowerCase().includes(Z))) : t].sort((e, t) => W === "name" ? e.name.localeCompare(t.name) : yn(e, t));
2909
+ }, [
2910
+ Z,
2911
+ e,
2912
+ z,
2913
+ W
2914
+ ]), he = s === void 0 && Z || i === void 0 && z === "mine" ? me.length : Math.max(r ?? 0, me.length), Q = me.slice(0, J), _e = Q.length, ve = _e < he, ye = X >= 760, be = K === "list" && ye ? "list" : "grid", xe = be === "grid" && Q.length % 3 == 2, $ = n === "loading", Se = n === "ready", Ce = $ || C || w, we = n === "ready" || n === "loading", Te = n !== "empty", De = C ? Math.min(x, Math.max(he - _e, 0)) : 0;
2915
+ k(() => {
2916
+ Y(b);
2917
+ }, [
2918
+ b,
2919
+ Z,
2920
+ z,
2921
+ W
2922
+ ]), xn(() => {
2923
+ let e = ie.current;
2924
+ if (!e) return;
2925
+ let t = () => re(e.getBoundingClientRect().width);
2926
+ if (t(), typeof ResizeObserver > "u") return;
2927
+ let n = new ResizeObserver(t);
2928
+ return n.observe(e), () => n.disconnect();
2929
+ }, []), xn(() => {
2930
+ let e = se.current;
2931
+ if (e === null || _e <= e) return;
2932
+ if (ve) {
2933
+ se.current = null;
2934
+ return;
2935
+ }
2936
+ let t = oe.current[e];
2937
+ t && (t.focus(), se.current = null);
2938
+ }, [_e, ve]);
2939
+ let Oe = (e) => {
2940
+ if (e === K) return;
2941
+ let t = () => q(e), n = document;
2942
+ !window.matchMedia?.("(prefers-reduced-motion: reduce)").matches && n.startViewTransition ? n.startViewTransition(() => {
2943
+ te(t);
2944
+ }) : t();
2945
+ }, ke = () => {
2946
+ C || (se.current = _e, Y((e) => e + x), S?.());
2947
+ }, Ae = Z ? `No projects match “${V.trim()}”.` : z === "mine" ? "No projects in My projects yet." : "No projects in All projects.", je = $ ? "Loading projects." : n === "empty" ? "No projects are available." : n === "error" ? w ? "Retrying projects." : "Projects could not be loaded." : `${he} ${he === 1 ? "project" : "projects"} shown in ${z === "mine" ? "My projects" : "All projects"}.${K === "list" && !ye ? " List preference is temporarily displayed as Grid at this width." : ""}`;
2948
+ return /* @__PURE__ */ L("main", {
2949
+ ...I,
2950
+ ref: ee,
2951
+ className: mn("mithrl-project-library", M),
2952
+ "aria-labelledby": le,
2953
+ "data-presentation": K,
2954
+ "data-effective-presentation": be,
2955
+ "data-state": n,
2956
+ "data-list-fallback": K === "list" && !ye ? "" : void 0,
2957
+ children: /* @__PURE__ */ R("div", {
2958
+ className: "mithrl-project-library__frame",
2959
+ children: [
2960
+ /* @__PURE__ */ R("div", {
2961
+ className: "mithrl-project-library__toolbar",
2962
+ "aria-label": "Project controls",
2963
+ children: [
2964
+ /* @__PURE__ */ R("div", {
2965
+ className: "mithrl-project-library__primary-controls",
2966
+ children: [/* @__PURE__ */ R("div", {
2967
+ className: "mithrl-project-library__heading-group",
2968
+ children: [/* @__PURE__ */ L("h1", {
2969
+ id: le,
2970
+ children: "Projects"
2971
+ }), $ ? /* @__PURE__ */ L(nt, {
2972
+ className: "mithrl-project-library__count-skeleton",
2973
+ radius: "full"
2974
+ }) : n === "error" ? null : /* @__PURE__ */ L(Ve, {
2975
+ className: "mithrl-project-library__count",
2976
+ children: n === "empty" ? 0 : he
2977
+ })]
2978
+ }), we ? /* @__PURE__ */ L(ae, {
2979
+ className: "mithrl-project-library__scope",
2980
+ "aria-label": "Project scope",
2981
+ items: [{
2982
+ value: "mine",
2983
+ label: "My projects",
2984
+ panelId: ue,
2985
+ id: de,
2986
+ disabled: $
2987
+ }, {
2988
+ value: "all",
2989
+ label: "All projects",
2990
+ panelId: ue,
2991
+ id: fe,
2992
+ disabled: $
2993
+ }],
2994
+ value: z,
2995
+ onValueChange: (e) => B(e),
2996
+ size: "md"
2997
+ }) : null]
2998
+ }),
2999
+ we ? /* @__PURE__ */ R("div", {
3000
+ className: "mithrl-project-library__secondary-controls",
3001
+ children: [
3002
+ /* @__PURE__ */ L(Ee, {
3003
+ className: "mithrl-project-library__search",
3004
+ "aria-label": "Search projects",
3005
+ placeholder: "Search projects",
3006
+ surface: "transparent",
3007
+ value: V,
3008
+ disabled: $,
3009
+ onChange: (e) => H(e.currentTarget.value),
3010
+ leadingVisual: /* @__PURE__ */ L(G, {
3011
+ glyph: v,
3012
+ size: "default"
3013
+ })
3014
+ }),
3015
+ /* @__PURE__ */ R(Pe, {
3016
+ className: "mithrl-project-library__sort",
3017
+ "aria-label": "Sort projects",
3018
+ value: W,
3019
+ disabled: $,
3020
+ onChange: (e) => ne(e.currentTarget.value),
3021
+ leadingVisual: /* @__PURE__ */ L(G, {
3022
+ glyph: t,
3023
+ size: "default"
3024
+ }),
3025
+ children: [/* @__PURE__ */ L("option", {
3026
+ value: "activity",
3027
+ children: "Last activity"
3028
+ }), /* @__PURE__ */ L("option", {
3029
+ value: "name",
3030
+ children: "Name"
3031
+ })]
3032
+ }),
3033
+ /* @__PURE__ */ R("div", {
3034
+ className: "mithrl-project-library__view",
3035
+ role: "group",
3036
+ "aria-labelledby": pe,
3037
+ children: [
3038
+ /* @__PURE__ */ L("span", {
3039
+ id: pe,
3040
+ className: "mithrl-project-library__sr-only",
3041
+ children: "Project presentation"
3042
+ }),
3043
+ /* @__PURE__ */ L(ge, {
3044
+ icon: u,
3045
+ size: "default",
3046
+ "aria-label": "Grid view",
3047
+ disabled: $,
3048
+ pressed: K === "grid",
3049
+ onPressedChange: (e) => e && Oe("grid")
3050
+ }),
3051
+ /* @__PURE__ */ L(ge, {
3052
+ icon: d,
3053
+ size: "default",
3054
+ "aria-label": "List view",
3055
+ disabled: $,
3056
+ pressed: K === "list",
3057
+ onPressedChange: (e) => e && Oe("list")
3058
+ })
3059
+ ]
3060
+ })
3061
+ ]
3062
+ }) : null,
3063
+ Te ? /* @__PURE__ */ L(U, {
3064
+ id: D,
3065
+ className: "mithrl-project-library__new-project",
3066
+ variant: "brand",
3067
+ size: "comfortable",
3068
+ leadingIcon: /* @__PURE__ */ L(G, {
3069
+ glyph: g,
3070
+ size: "default"
3071
+ }),
3072
+ "aria-label": O,
3073
+ onClick: E,
3074
+ children: O
3075
+ }) : null
3076
+ ]
3077
+ }),
3078
+ /* @__PURE__ */ L("p", {
3079
+ className: "mithrl-project-library__sr-only",
3080
+ "aria-live": "polite",
3081
+ "aria-atomic": "true",
3082
+ children: je
3083
+ }),
3084
+ /* @__PURE__ */ R("div", {
3085
+ id: ue,
3086
+ ref: ie,
3087
+ className: "mithrl-project-library__results",
3088
+ role: we ? "tabpanel" : "region",
3089
+ "aria-labelledby": we ? z === "mine" ? de : fe : le,
3090
+ "aria-busy": Ce || void 0,
3091
+ children: [$ ? /* @__PURE__ */ L("ul", {
3092
+ className: "mithrl-project-library__skeleton-collection",
3093
+ "aria-hidden": "true",
3094
+ children: Array.from({ length: 6 }, (e, t) => /* @__PURE__ */ L(_n, { className: `mithrl-project-library__skeleton-item--${t + 1}` }, t))
3095
+ }) : n === "empty" ? /* @__PURE__ */ R("section", {
3096
+ className: "mithrl-project-library__structural-state",
3097
+ children: [
3098
+ /* @__PURE__ */ L(gn, { variant: "empty" }),
3099
+ /* @__PURE__ */ L("h2", { children: "Create your first project" }),
3100
+ /* @__PURE__ */ L("p", { children: "Start a workspace for your research, files, and agent context." }),
3101
+ /* @__PURE__ */ L(U, {
3102
+ id: D,
3103
+ variant: "brand",
3104
+ size: "comfortable",
3105
+ leadingIcon: /* @__PURE__ */ L(G, {
3106
+ glyph: g,
3107
+ size: "default"
3108
+ }),
3109
+ onClick: E,
3110
+ children: O
3111
+ })
3112
+ ]
3113
+ }) : n === "error" ? /* @__PURE__ */ R("section", {
3114
+ className: "mithrl-project-library__structural-state",
3115
+ children: [
3116
+ /* @__PURE__ */ L(gn, { variant: "error" }),
3117
+ /* @__PURE__ */ L("h2", { children: "We couldn’t load projects" }),
3118
+ /* @__PURE__ */ L("p", { children: "Check the connection and try again. Creating a new project remains available." }),
3119
+ /* @__PURE__ */ L(U, {
3120
+ className: "mithrl-project-library__retry-button",
3121
+ variant: "outline",
3122
+ "aria-disabled": w || void 0,
3123
+ leadingIcon: w ? /* @__PURE__ */ L($e, {
3124
+ size: "xsmall",
3125
+ decorative: !0
3126
+ }) : void 0,
3127
+ onClick: () => {
3128
+ w || T?.();
3129
+ },
3130
+ children: "Try again"
3131
+ })
3132
+ ]
3133
+ }) : Q.length ? /* @__PURE__ */ R("ul", {
3134
+ className: "mithrl-project-library__collection",
3135
+ "data-presentation": be,
3136
+ "data-balanced-final-pair": xe ? "" : void 0,
3137
+ children: [Q.map((e, t) => {
3138
+ let { id: n, ownedByCurrentUser: r, creator: i, ...a } = e;
3139
+ return /* @__PURE__ */ L("li", {
3140
+ className: mn("mithrl-project-library__item", xe && t >= Q.length - 2 ? "mithrl-project-library__item--balanced-final-pair" : void 0),
3141
+ "aria-posinset": t + 1,
3142
+ "aria-setsize": he,
3143
+ style: { viewTransitionName: `project-${n.replace(/[^a-zA-Z0-9_-]/g, "-")}` },
3144
+ children: /* @__PURE__ */ L(an, {
3145
+ ...a,
3146
+ ref: (e) => {
3147
+ oe.current[t] = e;
3148
+ },
3149
+ creator: z === "mine" && j ? void 0 : i,
3150
+ headingLevel: "h2",
3151
+ presentation: be
3152
+ })
3153
+ }, n);
3154
+ }), Array.from({ length: De }, (e, t) => /* @__PURE__ */ L(_n, { className: "mithrl-project-library__skeleton-item--incoming" }, `incoming-${t}`))]
3155
+ }) : /* @__PURE__ */ R("section", {
3156
+ className: "mithrl-project-library__empty",
3157
+ "aria-live": "polite",
3158
+ children: [
3159
+ /* @__PURE__ */ L(hn, { variant: Z ? "no-match" : "mine" }),
3160
+ /* @__PURE__ */ L("h2", { children: Ae }),
3161
+ /* @__PURE__ */ L("p", { children: Z ? "Clear Search to restore projects in the active scope." : z === "mine" ? "Create a project or switch to All projects to discover shared work." : "Change scope or create a new project to continue." }),
3162
+ /* @__PURE__ */ R("div", {
3163
+ className: "mithrl-project-library__empty-actions",
3164
+ children: [Z ? /* @__PURE__ */ L(U, {
3165
+ variant: "outline",
3166
+ onClick: () => H(""),
3167
+ children: "Clear search"
3168
+ }) : null, !Z && z === "mine" ? /* @__PURE__ */ L(U, {
3169
+ variant: "outline",
3170
+ onClick: () => B("all"),
3171
+ children: "View all projects"
3172
+ }) : null]
3173
+ })
3174
+ ]
3175
+ }), Se && Q.length && ve ? /* @__PURE__ */ R("div", {
3176
+ className: "mithrl-project-library__continuation",
3177
+ children: [/* @__PURE__ */ L(U, {
3178
+ variant: "outline",
3179
+ loading: C,
3180
+ onClick: ke,
3181
+ onBlur: (e) => {
3182
+ e.relatedTarget !== null && (se.current = null);
3183
+ },
3184
+ children: "Load more projects"
3185
+ }), /* @__PURE__ */ R("span", { children: [
3186
+ _e,
3187
+ " of ",
3188
+ he,
3189
+ " projects"
3190
+ ] })]
3191
+ }) : null]
3192
+ })
3193
+ ]
3194
+ })
3195
+ });
3196
+ });
3197
+ //#endregion
3198
+ //#region src/components/dialog/Dialog.tsx
3199
+ function wn(...e) {
3200
+ return e.filter(Boolean).join(" ");
3201
+ }
3202
+ var Tn = e("mithrl-dialog__popup", {
3203
+ variants: { size: {
3204
+ small: "mithrl-dialog__popup--small",
3205
+ default: "mithrl-dialog__popup--default",
3206
+ large: "mithrl-dialog__popup--large"
3207
+ } },
3208
+ defaultVariants: { size: "default" }
3209
+ });
3210
+ function En(e) {
3211
+ return /* @__PURE__ */ L(B.Root, {
3212
+ ...e,
3213
+ modal: !0
3214
+ });
3215
+ }
3216
+ var Dn = B.Trigger, On = B.Portal, kn = E(function({ className: e, ...t }, n) {
3217
+ return /* @__PURE__ */ L(B.Backdrop, {
3218
+ ...t,
3219
+ ref: n,
3220
+ className: wn("mithrl-dialog__backdrop", e)
3221
+ });
3222
+ }), An = E(function({ className: e, ...t }, n) {
3223
+ return /* @__PURE__ */ L(B.Viewport, {
3224
+ ...t,
3225
+ ref: n,
3226
+ className: wn("mithrl-dialog__viewport", e)
3227
+ });
3228
+ }), jn = E(function({ size: e = "default", className: t, ...n }, r) {
3229
+ let i = e ?? "default";
3230
+ return /* @__PURE__ */ L(B.Popup, {
3231
+ ...n,
3232
+ ref: r,
3233
+ className: Tn({
3234
+ size: i,
3235
+ className: t
3236
+ }),
3237
+ "data-size": i
3238
+ });
3239
+ }), Mn = E(function({ className: e, ...t }, n) {
3240
+ return /* @__PURE__ */ L("header", {
3241
+ ...t,
3242
+ ref: n,
3243
+ className: wn("mithrl-dialog__header", e)
3244
+ });
3245
+ }), Nn = E(function({ className: e, ...t }, n) {
3246
+ return /* @__PURE__ */ L(B.Title, {
3247
+ ...t,
3248
+ ref: n,
3249
+ className: wn("mithrl-dialog__title", e)
3250
+ });
3251
+ }), Pn = E(function({ className: e, ...t }, n) {
3252
+ return /* @__PURE__ */ L(B.Description, {
3253
+ ...t,
3254
+ ref: n,
3255
+ className: wn("mithrl-dialog__description", e)
3256
+ });
3257
+ }), Fn = E(function({ className: e, onScroll: t, ...n }, r) {
3258
+ let [i, a] = F(!1), o = (e) => {
3259
+ a(e.currentTarget.scrollTop > 0), t?.(e);
3260
+ };
3261
+ return /* @__PURE__ */ L("div", {
3262
+ ...n,
3263
+ ref: r,
3264
+ className: wn("mithrl-dialog__body", e),
3265
+ "data-scrolled": i ? "" : void 0,
3266
+ onScroll: o
3267
+ });
3268
+ }), In = E(function({ className: e, ...t }, n) {
3269
+ return /* @__PURE__ */ L("footer", {
3270
+ ...t,
3271
+ ref: n,
3272
+ className: wn("mithrl-dialog__footer", e)
3273
+ });
3274
+ }), Ln = B.Close, Rn = E(function({ label: e = "Close", className: t, ...n }, r) {
3275
+ let i = e.trim();
3276
+ if (!i) throw Error("DialogCloseButton requires a non-empty label.");
3277
+ return /* @__PURE__ */ L(B.Close, {
3278
+ ref: r,
3279
+ render: /* @__PURE__ */ L(q, {
3280
+ ...n,
3281
+ icon: C,
3282
+ variant: "ghost",
3283
+ size: "comfortable",
3284
+ "aria-label": i,
3285
+ className: wn("mithrl-dialog__close-button", t)
3286
+ })
3287
+ });
3288
+ }), zn = E(function({ children: e, portalContainer: t, keepMounted: n, backdropProps: r, viewportProps: i, ...a }, o) {
3289
+ return /* @__PURE__ */ R(On, {
3290
+ container: t,
3291
+ keepMounted: n,
3292
+ children: [/* @__PURE__ */ L(kn, { ...r }), /* @__PURE__ */ L(An, {
3293
+ ...i,
3294
+ children: /* @__PURE__ */ L(jn, {
3295
+ ...a,
3296
+ ref: o,
3297
+ children: e
3298
+ })
3299
+ })]
3300
+ });
3301
+ });
3302
+ //#endregion
3303
+ //#region src/components/file-dropzone/FileDropzone.tsx
3304
+ function Bn(...e) {
3305
+ return e.filter(Boolean).join(" ");
3306
+ }
3307
+ function Vn(e, t) {
3308
+ let n = t.split(",").map((e) => e.trim().toLowerCase()).filter(Boolean);
3309
+ if (!n.length) return !0;
3310
+ let r = e.name.toLowerCase(), i = e.type.toLowerCase(), a = r.split("."), o = a.slice(1).map((e, t) => `.${a.slice(t + 1).join(".")}`);
3311
+ return n.some((e) => e.startsWith(".") ? o.includes(e) : e.endsWith("/*") ? i.startsWith(e.slice(0, -1)) : i === e);
3312
+ }
3313
+ function Hn(e, { accept: t, maxFiles: n, maxFileSize: r, multiple: i }) {
3314
+ let a = i === !1 ? 1 : n;
3315
+ return a !== void 0 && e.length > a ? {
3316
+ valid: !1,
3317
+ reason: "count",
3318
+ message: a === 1 ? "Choose one file at a time." : `Choose no more than ${a} files at a time.`
3319
+ } : r !== void 0 && e.some((e) => e.size > r) ? {
3320
+ valid: !1,
3321
+ reason: "size",
3322
+ message: "One or more files exceed the allowed size."
3323
+ } : t && e.some((e) => !Vn(e, t)) ? {
3324
+ valid: !1,
3325
+ reason: "type",
3326
+ message: "One or more file types are not supported."
3327
+ } : { valid: !0 };
3328
+ }
3329
+ function Un(e) {
3330
+ return Array.from(e.dataTransfer.files);
3331
+ }
3332
+ function Wn(e) {
3333
+ return e.webkitGetAsEntry?.() ?? null;
3334
+ }
3335
+ function Gn(e) {
3336
+ return new Promise((t, n) => e.file(t, n));
3337
+ }
3338
+ async function Kn(e) {
3339
+ let t = e.createReader(), n = [];
3340
+ for (;;) {
3341
+ let e = await new Promise((e, n) => t.readEntries(e, n));
3342
+ if (!e.length) return n;
3343
+ n.push(...e);
3344
+ }
3345
+ }
3346
+ function qn(e, t) {
3347
+ if (e.webkitRelativePath === t) return e;
3348
+ try {
3349
+ return Object.defineProperty(e, "webkitRelativePath", {
3350
+ configurable: !0,
3351
+ value: t
3352
+ }), e;
3353
+ } catch {
3354
+ let n = new File([e], e.name, {
3355
+ lastModified: e.lastModified,
3356
+ type: e.type
3357
+ });
3358
+ return Object.defineProperty(n, "webkitRelativePath", {
3359
+ configurable: !0,
3360
+ value: t
3361
+ }), n;
3362
+ }
3363
+ }
3364
+ async function Jn(e, t = "") {
3365
+ let n = t ? `${t}/${e.name}` : e.name;
3366
+ if (e.isFile) {
3367
+ let r = await Gn(e);
3368
+ return [t ? qn(r, n) : r];
3369
+ }
3370
+ let r = await Kn(e);
3371
+ return (await Promise.all(r.map((e) => Jn(e, n)))).flat();
3372
+ }
3373
+ async function Yn(e) {
3374
+ let t = Array.from(e.files), n = Array.from(e.items).filter((e) => e.kind === "file").map(Wn).filter((e) => e !== null);
3375
+ if (!(n.some((e) => e.isDirectory) || t.length === 0 && n.length > 0)) return t;
3376
+ try {
3377
+ return (await Promise.all(n.map((e) => Jn(e)))).flat();
3378
+ } catch {
3379
+ return t;
3380
+ }
3381
+ }
3382
+ function Xn(e) {
3383
+ return Array.from(e.dataTransfer.items).filter((e) => e.kind === "file").map((e) => e.getAsFile()).filter((e) => e !== null);
3384
+ }
3385
+ function Zn(e, t) {
3386
+ let n = Array.from(e.dataTransfer.items).filter((e) => e.kind === "file"), r = t.multiple === !1 ? 1 : t.maxFiles;
3387
+ if (r !== void 0 && n.length > r) return {
3388
+ valid: !1,
3389
+ reason: "count",
3390
+ message: r === 1 ? "Choose one file at a time." : `Choose no more than ${r} files at a time.`
3391
+ };
3392
+ if (!t.accept || !n.length) return { valid: !0 };
3393
+ let i = t.accept.split(",").map((e) => e.trim().toLowerCase()).filter(Boolean), a = i.some((e) => e.startsWith(".")), o = i.filter((e) => !e.startsWith("."));
3394
+ return !a && o.length > 0 && n.some((e) => {
3395
+ let t = e.type.toLowerCase();
3396
+ return t ? !o.some((e) => e.endsWith("/*") ? t.startsWith(e.slice(0, -1)) : t === e) : !1;
3397
+ }) ? {
3398
+ valid: !1,
3399
+ reason: "type",
3400
+ message: "One or more file types are not supported."
3401
+ } : { valid: !0 };
3402
+ }
3403
+ var Qn = E(function({ label: e, accept: t, multiple: n = !0, enableFolderSelection: r = !1, maxFiles: i, maxFileSize: a, disabled: o = !1, onSelection: s, onReject: c, className: l, "data-preview-state": u, ...d }, f) {
3404
+ let p = e.trim(), m = `${A()}-helper`, h = P(null), g = P(null), _ = P(null), v = P(!1), y = P(0), b = P(!0), [S, C] = F("idle"), [w, T] = F(!1), [E, D] = F(!1), [O, M] = F("One or more files cannot be added."), [ee, te] = F("One or more files cannot be added."), z = N(() => ({
3405
+ accept: t,
3406
+ maxFiles: i,
3407
+ maxFileSize: a,
3408
+ multiple: n
3409
+ }), [
3410
+ t,
3411
+ a,
3412
+ i,
3413
+ n
3414
+ ]), B = P({
3415
+ disabled: o,
3416
+ onReject: c,
3417
+ onSelection: s,
3418
+ validationPolicy: z
3419
+ });
3420
+ B.current = {
3421
+ disabled: o,
3422
+ onReject: c,
3423
+ onSelection: s,
3424
+ validationPolicy: z
3425
+ }, k(() => (b.current = !0, () => {
3426
+ b.current = !1, y.current += 1;
3427
+ }), []), k(() => {
3428
+ o && (v.current = !1, y.current += 1, C("idle"));
3429
+ }, [o]);
3430
+ let V = o ? "disabled" : u ?? (S === "rejected" ? "drag-rejected" : S === "active" ? "drag-active" : E ? "drag-rejected" : w ? "selection-received" : "default"), H = (e, t) => {
3431
+ let n = B.current;
3432
+ if (n.disabled) return;
3433
+ if (!e.length) {
3434
+ C("idle");
3435
+ return;
3436
+ }
3437
+ let r = Hn(e, n.validationPolicy);
3438
+ if (!r.valid) {
3439
+ C("idle"), D(!0), T(!1), M(r.message), n.onReject?.({
3440
+ files: e,
3441
+ reason: r.reason,
3442
+ message: r.message
3443
+ });
3444
+ return;
3445
+ }
3446
+ C("idle"), D(!1), T(!0), n.onSelection?.({
3447
+ files: e,
3448
+ source: t
3449
+ });
3450
+ };
3451
+ if (j(f, () => ({
3452
+ browseFiles: () => {
3453
+ o || h.current?.click();
3454
+ },
3455
+ browseFolder: () => {
3456
+ !o && r && g.current?.click();
3457
+ },
3458
+ focusBrowse: () => _.current?.focus()
3459
+ }), [o, r]), !p) throw Error("FileDropzone requires a non-empty label.");
3460
+ if (i !== void 0 && i < 1) throw Error("FileDropzone maxFiles must be at least 1.");
3461
+ if (a !== void 0 && a < 1) throw Error("FileDropzone maxFileSize must be at least 1 byte.");
3462
+ let U = (e, t) => {
3463
+ y.current += 1, H(Array.from(e.currentTarget.files ?? []), t), e.currentTarget.value = "";
3464
+ }, W = (e) => {
3465
+ if (e.preventDefault(), o) {
3466
+ v.current = !1, C("idle");
3467
+ return;
3468
+ }
3469
+ let t = Un(e), n = t.length ? t : Xn(e), r = n.length ? Hn(n, z) : Zn(e, z);
3470
+ if (!(n.length > 0 || Array.from(e.dataTransfer.items).some((e) => e.kind === "file") || Array.from(e.dataTransfer.types).includes("Files"))) {
3471
+ v.current = !1, C("idle");
3472
+ return;
3473
+ }
3474
+ v.current = r.valid, C(r.valid ? "active" : "rejected"), r.valid || te(r.message);
3475
+ }, ne = (e) => {
3476
+ if (e.preventDefault(), o) {
3477
+ e.dataTransfer.dropEffect = "none";
3478
+ return;
3479
+ }
3480
+ e.dataTransfer.dropEffect = v.current ? "copy" : "none";
3481
+ }, K = (e) => {
3482
+ if (e.preventDefault(), o) {
3483
+ v.current = !1, C("idle");
3484
+ return;
3485
+ }
3486
+ let t = e.currentTarget.getBoundingClientRect();
3487
+ e.clientX >= t.left && e.clientX <= t.right && e.clientY >= t.top && e.clientY <= t.bottom || (v.current = !1, C("idle"));
3488
+ }, q = async (e) => {
3489
+ if (e.preventDefault(), o) {
3490
+ v.current = !1, C("idle");
3491
+ return;
3492
+ }
3493
+ v.current = !1, C("idle");
3494
+ let t = ++y.current, n = await Yn(e.dataTransfer);
3495
+ !b.current || t !== y.current || H(n, "drop");
3496
+ }, J = {
3497
+ default: {
3498
+ instruction: "Drag and drop files or folders",
3499
+ helper: "browse"
3500
+ },
3501
+ "drag-active": {
3502
+ instruction: "Drop to add files or folders",
3503
+ helper: "Release anywhere inside this target."
3504
+ },
3505
+ "drag-rejected": {
3506
+ instruction: "These files can’t be added",
3507
+ helper: S === "rejected" ? ee : O
3508
+ },
3509
+ disabled: {
3510
+ instruction: "File selection unavailable",
3511
+ helper: "This control is currently disabled."
3512
+ },
3513
+ "selection-received": {
3514
+ instruction: "Files added",
3515
+ helper: "browse"
3516
+ }
3517
+ }[V], Y = V === "default" || V === "drag-rejected" || V === "selection-received", X = r ? {
3518
+ webkitdirectory: "",
3519
+ directory: ""
3520
+ } : {};
3521
+ return /* @__PURE__ */ R("div", {
3522
+ ...d,
3523
+ className: Bn("mithrl-file-dropzone", l),
3524
+ role: "group",
3525
+ "aria-label": p,
3526
+ "aria-describedby": m,
3527
+ "aria-disabled": o || void 0,
3528
+ "data-state": V,
3529
+ onDragEnter: W,
3530
+ onDragOver: ne,
3531
+ onDragLeave: K,
3532
+ onDrop: q,
3533
+ children: [
3534
+ /* @__PURE__ */ L("input", {
3535
+ ref: h,
3536
+ className: "mithrl-file-dropzone__input",
3537
+ type: "file",
3538
+ tabIndex: -1,
3539
+ "aria-hidden": "true",
3540
+ accept: t,
3541
+ multiple: n,
3542
+ disabled: o,
3543
+ onChange: (e) => U(e, "browse")
3544
+ }),
3545
+ r ? /* @__PURE__ */ L("input", {
3546
+ ...X,
3547
+ ref: g,
3548
+ className: "mithrl-file-dropzone__input",
3549
+ type: "file",
3550
+ tabIndex: -1,
3551
+ "aria-hidden": "true",
3552
+ accept: t,
3553
+ multiple: !0,
3554
+ disabled: o,
3555
+ onChange: (e) => U(e, "folder")
3556
+ }) : null,
3557
+ /* @__PURE__ */ L("span", {
3558
+ className: "mithrl-file-dropzone__icon",
3559
+ "aria-hidden": "true",
3560
+ children: /* @__PURE__ */ L(G, {
3561
+ glyph: x,
3562
+ size: "large"
3563
+ })
3564
+ }),
3565
+ /* @__PURE__ */ R("span", {
3566
+ className: "mithrl-file-dropzone__copy",
3567
+ children: [/* @__PURE__ */ L("strong", { children: J.instruction }), /* @__PURE__ */ R("span", {
3568
+ id: m,
3569
+ children: [/* @__PURE__ */ L("span", {
3570
+ role: V === "drag-rejected" ? "alert" : void 0,
3571
+ children: J.helper === "browse" ? "or " : J.helper
3572
+ }), Y ? /* @__PURE__ */ R(I, { children: [
3573
+ J.helper === "browse" ? null : " ",
3574
+ /* @__PURE__ */ L("button", {
3575
+ ref: _,
3576
+ className: "mithrl-file-dropzone__browse",
3577
+ type: "button",
3578
+ disabled: o,
3579
+ onClick: () => h.current?.click(),
3580
+ children: "click to browse"
3581
+ }),
3582
+ " ",
3583
+ "files",
3584
+ V === "drag-rejected" ? " again" : null
3585
+ ] }) : null]
3586
+ })]
3587
+ })
3588
+ ]
3589
+ });
3590
+ });
3591
+ //#endregion
3592
+ //#region src/patterns/new-project-dialog/NewProjectDialog.tsx
3593
+ function $n(...e) {
3594
+ return e.filter(Boolean).join(" ");
3595
+ }
3596
+ function er(e) {
3597
+ return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${Math.round(e / 1024)} KB` : e < 1024 * 1024 * 1024 ? `${(e / (1024 * 1024)).toFixed(1)} MB` : `${(e / (1024 * 1024 * 1024)).toFixed(1)} GB`;
3598
+ }
3599
+ function tr(e) {
3600
+ return [
3601
+ e.webkitRelativePath || e.name,
3602
+ e.size,
3603
+ e.lastModified
3604
+ ].join(":");
3605
+ }
3606
+ function nr(e) {
3607
+ let t = /* @__PURE__ */ new Map(), n = [];
3608
+ for (let r of e.files) {
3609
+ let e = r.webkitRelativePath?.trim(), i = e?.includes("/") ? e.split("/")[0] : void 0;
3610
+ i ? t.set(i, [...t.get(i) ?? [], r]) : n.push(r);
3611
+ }
3612
+ let r = Array.from(t, ([e, t]) => ({
3613
+ id: `folder:${e}:${t.map(tr).join("|")}`,
3614
+ name: e,
3615
+ kind: "folder",
3616
+ metadata: `${t.length} ${t.length === 1 ? "file" : "files"}`,
3617
+ files: t
3618
+ })), i = n.map((e) => ({
3619
+ id: `file:${tr(e)}`,
3620
+ name: e.name,
3621
+ kind: "file",
3622
+ metadata: er(e.size),
3623
+ files: [e]
3624
+ }));
3625
+ return [...r, ...i];
3626
+ }
3627
+ function rr(e, t = !1) {
3628
+ return {
3629
+ id: e.id,
3630
+ name: e.name,
3631
+ kind: e.kind,
3632
+ metadata: e.metadata,
3633
+ state: "ready",
3634
+ disabled: t
3635
+ };
3636
+ }
3637
+ function ir(e, t) {
3638
+ return e.length === t.length && e.every((e, n) => {
3639
+ let r = t[n];
3640
+ return e.id === r.id && e.name === r.name && e.kind === r.kind && e.metadata === r.metadata && e.files.length === r.files.length && e.files.every((e, t) => e === r.files[t]);
3641
+ });
3642
+ }
3643
+ function ar(e) {
3644
+ return {
3645
+ name: e?.name ?? "",
3646
+ description: e?.description ?? "",
3647
+ agentContext: e?.agentContext ?? "",
3648
+ resources: [...e?.resources ?? []]
3649
+ };
3650
+ }
3651
+ function or({ open: e, defaultOpen: t = !1, onOpenChange: n, triggerId: r, initialValue: i, onCreate: a, onResourcesChange: o, submitting: c, submitError: u, accept: d, maxFiles: f, maxFileSize: p, portalContainer: m, className: h }) {
3652
+ let g = ar(i), [_, v] = F(t), [y, b] = F(g.name), [x, S] = F(g.description), [C, w] = F(g.agentContext), [T, E] = F(g.resources), [D, O] = F(), [j, M] = F(), [N, I] = F(!1), [ee, te] = F(!1), [z, B] = F(0), V = P(null), H = P(null), W = P(null), ne = P(), K = P(!1), q = P(T);
3653
+ q.current = T;
3654
+ let J = `mithrl-new-project-dialog-resources-${A().replace(/:/g, "")}`, Y = e ?? _, X = !!c || ee, re = N ? j : u ?? j, ie = (e) => {
3655
+ let t = q.current;
3656
+ ir(t, e) || (q.current = e, E(e), t.length > 0 && e.length === 0 && B((e) => e + 1), o?.(e));
3657
+ }, ae = () => {
3658
+ let e = ar(i);
3659
+ b(e.name), S(e.description), w(e.agentContext), ie(e.resources), O(void 0), M(void 0), I(!1), te(!1);
3660
+ };
3661
+ k(() => {
3662
+ Y || ae();
3663
+ }, [Y, i]), k(() => {
3664
+ I(!1);
3665
+ }, [u]), k(() => {
3666
+ let e = ne.current;
3667
+ if (e === void 0) return;
3668
+ ne.current = void 0;
3669
+ let t = W.current?.querySelectorAll("button[aria-label^=\"Remove \"]"), n = Math.min(e, Math.max((t?.length ?? 1) - 1, 0)), r = t?.[n];
3670
+ r ? r.focus() : H.current?.focusBrowse();
3671
+ }, [z, T]);
3672
+ let oe = (t, r) => {
3673
+ if (X && !t) {
3674
+ r.cancel();
3675
+ return;
3676
+ }
3677
+ e === void 0 && v(t), n?.(t);
3678
+ }, se = (e) => {
3679
+ let t = nr(e), n = q.current, r = new Set(n.map((e) => e.id)), i = [];
3680
+ for (let e of t) r.has(e.id) || (r.add(e.id), i.push(e));
3681
+ ie([...n, ...i]);
3682
+ }, ce = (e) => {
3683
+ if (X) return;
3684
+ let t = q.current, n = t.findIndex((t) => t.id === e);
3685
+ n < 0 || (ne.current = n, ie(t.filter((t) => t.id !== e)));
3686
+ };
3687
+ return /* @__PURE__ */ L(En, {
3688
+ open: Y,
3689
+ onOpenChange: oe,
3690
+ triggerId: r,
3691
+ disablePointerDismissal: X,
3692
+ children: /* @__PURE__ */ L(zn, {
3693
+ size: "large",
3694
+ initialFocus: V,
3695
+ portalContainer: m,
3696
+ className: $n("mithrl-new-project-dialog", h),
3697
+ children: /* @__PURE__ */ R("form", {
3698
+ className: "mithrl-new-project-dialog__form",
3699
+ noValidate: !0,
3700
+ onSubmit: async (t) => {
3701
+ if (t.preventDefault(), X || K.current) return;
3702
+ M(void 0), I(!0);
3703
+ let r = y.trim();
3704
+ if (!r) {
3705
+ O("Enter a project name."), V.current?.focus();
3706
+ return;
3707
+ }
3708
+ O(void 0), K.current = !0, te(!0);
3709
+ try {
3710
+ await a({
3711
+ name: r,
3712
+ description: x.trim(),
3713
+ agentContext: C.trim(),
3714
+ resources: T
3715
+ }), e === void 0 && v(!1), n?.(!1);
3716
+ } catch {
3717
+ M("We couldn’t create the project. Review your connection and try again.");
3718
+ } finally {
3719
+ K.current = !1, te(!1);
3720
+ }
3721
+ },
3722
+ children: [
3723
+ /* @__PURE__ */ R(Mn, { children: [
3724
+ /* @__PURE__ */ L(Nn, { children: "Create a project" }),
3725
+ /* @__PURE__ */ L(Pn, { children: "Start with a name and optionally add resources and context." }),
3726
+ /* @__PURE__ */ L(Rn, { disabled: X })
3727
+ ] }),
3728
+ /* @__PURE__ */ R(Fn, {
3729
+ className: "mithrl-new-project-dialog__body",
3730
+ children: [
3731
+ /* @__PURE__ */ R("div", {
3732
+ className: "mithrl-new-project-dialog__fields",
3733
+ children: [/* @__PURE__ */ L(yt, {
3734
+ label: "Project name",
3735
+ required: !0,
3736
+ error: D,
3737
+ disabled: X,
3738
+ children: ({ controlProps: e, status: t }) => /* @__PURE__ */ L(Ee, {
3739
+ ...e,
3740
+ ref: V,
3741
+ status: t,
3742
+ value: y,
3743
+ placeholder: "My research project",
3744
+ autoComplete: "off",
3745
+ disabled: X,
3746
+ onChange: (e) => {
3747
+ b(e.currentTarget.value), D && O(void 0);
3748
+ }
3749
+ })
3750
+ }), /* @__PURE__ */ L(yt, {
3751
+ label: "Description",
3752
+ optional: !0,
3753
+ description: "Shown on the project card for quick reference.",
3754
+ disabled: X,
3755
+ children: ({ controlProps: e, status: t }) => /* @__PURE__ */ L(Ae, {
3756
+ ...e,
3757
+ status: t,
3758
+ resize: "none",
3759
+ rows: 3,
3760
+ value: x,
3761
+ placeholder: "What is this project about?",
3762
+ disabled: X,
3763
+ onChange: (e) => S(e.currentTarget.value)
3764
+ })
3765
+ })]
3766
+ }),
3767
+ /* @__PURE__ */ L(Re, {}),
3768
+ /* @__PURE__ */ R("section", {
3769
+ className: "mithrl-new-project-dialog__resources",
3770
+ "aria-labelledby": J,
3771
+ children: [
3772
+ /* @__PURE__ */ R("div", {
3773
+ className: "mithrl-new-project-dialog__resources-header",
3774
+ children: [/* @__PURE__ */ R("div", { children: [/* @__PURE__ */ R("p", {
3775
+ id: J,
3776
+ children: ["Add files and folders ", /* @__PURE__ */ L("span", { children: "Optional" })]
3777
+ }), /* @__PURE__ */ L("span", { children: "Folder structure is preserved." })] }), /* @__PURE__ */ R("div", {
3778
+ className: "mithrl-new-project-dialog__resource-actions",
3779
+ children: [/* @__PURE__ */ L(U, {
3780
+ variant: "secondary",
3781
+ size: "comfortable",
3782
+ leadingIcon: /* @__PURE__ */ L(G, {
3783
+ glyph: s,
3784
+ size: "default"
3785
+ }),
3786
+ disabled: X,
3787
+ onClick: () => H.current?.browseFiles(),
3788
+ children: "Add files"
3789
+ }), /* @__PURE__ */ L(U, {
3790
+ variant: "secondary",
3791
+ size: "comfortable",
3792
+ leadingIcon: /* @__PURE__ */ L(G, {
3793
+ glyph: l,
3794
+ size: "default"
3795
+ }),
3796
+ disabled: X,
3797
+ onClick: () => H.current?.browseFolder(),
3798
+ children: "Add folder"
3799
+ })]
3800
+ })]
3801
+ }),
3802
+ /* @__PURE__ */ L(Qn, {
3803
+ ref: H,
3804
+ className: $n("mithrl-new-project-dialog__dropzone", T.length > 0 ? "mithrl-new-project-dialog__dropzone--compact" : void 0),
3805
+ label: "Project files and folders",
3806
+ accept: d,
3807
+ maxFiles: f,
3808
+ maxFileSize: p,
3809
+ enableFolderSelection: !0,
3810
+ disabled: X,
3811
+ onSelection: se
3812
+ }, z),
3813
+ T.length > 0 ? /* @__PURE__ */ L(pn, {
3814
+ ref: W,
3815
+ items: T.map((e) => rr(e, X)),
3816
+ summary: `${T.length} ${T.length === 1 ? "resource" : "resources"} ready to add`,
3817
+ onRemove: (e) => ce(e.id)
3818
+ }) : null,
3819
+ /* @__PURE__ */ L("p", {
3820
+ className: "mithrl-new-project-dialog__upload-note",
3821
+ children: "Upload begins when you create the project."
3822
+ })
3823
+ ]
3824
+ }),
3825
+ /* @__PURE__ */ L(yt, {
3826
+ label: "Agent context",
3827
+ optional: !0,
3828
+ description: "Included as background for every agent working in this project.",
3829
+ disabled: X,
3830
+ children: ({ controlProps: e, status: t }) => /* @__PURE__ */ L(Ae, {
3831
+ ...e,
3832
+ status: t,
3833
+ resize: "none",
3834
+ rows: 4,
3835
+ value: C,
3836
+ placeholder: "Goals, experimental design, conventions, and constraints.",
3837
+ disabled: X,
3838
+ onChange: (e) => w(e.currentTarget.value)
3839
+ })
3840
+ }),
3841
+ re ? /* @__PURE__ */ L("div", {
3842
+ className: "mithrl-new-project-dialog__submit-error",
3843
+ role: "alert",
3844
+ children: /* @__PURE__ */ L(ht, {
3845
+ tone: "error",
3846
+ children: re
3847
+ })
3848
+ }) : null
3849
+ ]
3850
+ }),
3851
+ /* @__PURE__ */ R(In, { children: [/* @__PURE__ */ L(Ln, { render: /* @__PURE__ */ L(U, {
3852
+ variant: "outline",
3853
+ size: "comfortable",
3854
+ disabled: X,
3855
+ children: "Cancel"
3856
+ }) }), /* @__PURE__ */ L(U, {
3857
+ variant: "brand",
3858
+ size: "comfortable",
3859
+ type: "submit",
3860
+ loading: X,
3861
+ children: "Create project"
3862
+ })] })
3863
+ ]
3864
+ })
3865
+ })
3866
+ });
3867
+ }
3868
+ //#endregion
3869
+ export { Mt as AccountMenu, Ye as Avatar, Ve as Badge, U as Button, at as Checkbox, kn as DialogBackdrop, Fn as DialogBody, Ln as DialogClose, Rn as DialogCloseButton, zn as DialogContent, Pn as DialogDescription, In as DialogFooter, Mn as DialogHeader, jn as DialogPopup, On as DialogPortal, En as DialogRoot, Nn as DialogTitle, Dn as DialogTrigger, An as DialogViewport, Ct as DropdownMenu, wt as DropdownMenuContent, Tt as DropdownMenuGroup, Dt as DropdownMenuItem, Et as DropdownMenuLabel, Ot as DropdownMenuLinkItem, kt as DropdownMenuSeparator, At as DropdownMenuShortcut, St as DropdownMenuTrigger, yt as Field, lt as FieldLabel, ht as FieldMessage, Qn as FileDropzone, Lt as GlobalAppBar, G as Icon, q as IconButton, Ie as Link, or as NewProjectDialog, le as PanelTabs, $e as ProgressIndicator, an as ProjectCard, Cn as ProjectLibrary, st as Radio, ae as SegmentedTabs, Pe as Select, Re as Separator, nt as Skeleton, pt as StandardTabs, fe as Switch, We as Tag, Ee as TextField, Ae as Textarea, pe as ThemeSwitch, ge as ToggleButton, Se as Tooltip, pn as UploadQueue, fn as UploadQueueItem, Ge as avatarVariants, ze as badgeVariants, V as buttonVariants, Tn as dialogPopupVariants, bt as dropdownMenuContentVariants, ct as fieldLabelVariants, mt as fieldMessageVariants, ne as iconButtonVariants, W as iconVariants, Fe as linkVariants, Xe as progressIndicatorVariants, J as segmentedTabsVariants, je as selectVariants, Le as separatorVariants, et as skeletonVariants, ut as standardTabsVariants, He as tagVariants, Ce as textFieldVariants, De as textareaVariants, Z as toggleButtonVariants };