@openwarelabs/ui 0.11.1 → 0.12.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 (43) hide show
  1. package/dist/components/AppShell/AppShell.context.d.cts +21 -0
  2. package/dist/components/AppShell/AppShell.context.d.ts +21 -0
  3. package/dist/components/AppShell/AppShell.d.cts +17 -0
  4. package/dist/components/AppShell/AppShell.d.ts +17 -0
  5. package/dist/components/AppShell/AppShell.types.d.cts +46 -0
  6. package/dist/components/AppShell/AppShell.types.d.ts +46 -0
  7. package/dist/components/Chart/BarChart.d.cts +6 -0
  8. package/dist/components/Chart/BarChart.d.ts +6 -0
  9. package/dist/components/Chart/Cartesian.d.cts +8 -0
  10. package/dist/components/Chart/Cartesian.d.ts +8 -0
  11. package/dist/components/Chart/Chart.d.cts +5 -0
  12. package/dist/components/Chart/Chart.d.ts +5 -0
  13. package/dist/components/Chart/Chart.types.d.cts +83 -0
  14. package/dist/components/Chart/Chart.types.d.ts +83 -0
  15. package/dist/components/Chart/ChartParts.d.cts +16 -0
  16. package/dist/components/Chart/ChartParts.d.ts +16 -0
  17. package/dist/components/Chart/DonutChart.d.cts +6 -0
  18. package/dist/components/Chart/DonutChart.d.ts +6 -0
  19. package/dist/components/Chart/LineChart.d.cts +6 -0
  20. package/dist/components/Chart/LineChart.d.ts +6 -0
  21. package/dist/components/Chart/Sparkline.d.cts +6 -0
  22. package/dist/components/Chart/Sparkline.d.ts +6 -0
  23. package/dist/components/Chart/chartUtils.d.cts +13 -0
  24. package/dist/components/Chart/chartUtils.d.ts +13 -0
  25. package/dist/components/NavList/NavList.d.cts +6 -24
  26. package/dist/components/NavList/NavList.d.ts +6 -24
  27. package/dist/components/NavList/NavList.types.d.cts +23 -0
  28. package/dist/components/NavList/NavList.types.d.ts +23 -0
  29. package/dist/components.css +511 -0
  30. package/dist/icons.d.cts +3 -0
  31. package/dist/icons.d.ts +3 -0
  32. package/dist/index.cjs +1299 -729
  33. package/dist/index.cjs.map +4 -4
  34. package/dist/index.d.cts +4 -0
  35. package/dist/index.d.ts +4 -0
  36. package/dist/index.js +1281 -711
  37. package/dist/index.js.map +4 -4
  38. package/dist/openware-ui.iife.js +8 -8
  39. package/dist/styles.css +541 -0
  40. package/dist/tailwind.css +10 -0
  41. package/dist/tokens.css +30 -0
  42. package/dist/tokens.json +80 -0
  43. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -23,9 +23,11 @@ __export(index_exports, {
23
23
  Accordion: () => Accordion,
24
24
  AccordionItem: () => AccordionItem,
25
25
  Alert: () => Alert,
26
+ AppShell: () => AppShell,
26
27
  Avatar: () => Avatar,
27
28
  AvatarGroup: () => AvatarGroup,
28
29
  Badge: () => Badge,
30
+ BarChart: () => BarChart,
29
31
  Breadcrumbs: () => Breadcrumbs,
30
32
  Button: () => Button,
31
33
  ButtonGroup: () => ButtonGroup,
@@ -63,6 +65,7 @@ __export(index_exports, {
63
65
  DateRangePicker: () => DateRangePicker,
64
66
  Dialog: () => Dialog,
65
67
  Disclosure: () => Disclosure,
68
+ DonutChart: () => DonutChart,
66
69
  DotGrid: () => DotGrid,
67
70
  Drawer: () => Drawer,
68
71
  EmptyState: () => EmptyState,
@@ -75,6 +78,7 @@ __export(index_exports, {
75
78
  Input: () => Input,
76
79
  InputOTP: () => InputOTP,
77
80
  Kbd: () => Kbd,
81
+ LineChart: () => LineChart,
78
82
  Link: () => Link,
79
83
  ListBox: () => ListBox,
80
84
  Menu: () => Menu,
@@ -104,11 +108,16 @@ __export(index_exports, {
104
108
  Select: () => Select,
105
109
  Separator: () => Separator,
106
110
  SettingsRow: () => SettingsRow,
111
+ SidebarContent: () => SidebarContent,
112
+ SidebarFooter: () => SidebarFooter,
113
+ SidebarHeader: () => SidebarHeader,
114
+ SidebarToggle: () => SidebarToggle,
107
115
  SiteHeader: () => SiteHeader,
108
116
  Skeleton: () => Skeleton,
109
117
  SkeletonRows: () => SkeletonRows,
110
118
  Slider: () => Slider,
111
119
  Snippet: () => Snippet,
120
+ Sparkline: () => Sparkline2,
112
121
  Spinner: () => Spinner,
113
122
  Stack: () => Stack,
114
123
  Stat: () => Stat,
@@ -154,6 +163,7 @@ __export(index_exports, {
154
163
  toISO: () => toISO,
155
164
  toast: () => import_sonner.toast,
156
165
  todayISO: () => todayISO,
166
+ useAppShell: () => useAppShell,
157
167
  useControllableState: () => useControllableState,
158
168
  useDismiss: () => useDismiss,
159
169
  useFloating: () => useFloating,
@@ -312,8 +322,8 @@ var import_react3 = require("react");
312
322
 
313
323
  // src/hooks/useControllableState.ts
314
324
  var import_react2 = require("react");
315
- function useControllableState(value, defaultValue, onChange) {
316
- const [internal, setInternal] = (0, import_react2.useState)(defaultValue);
325
+ function useControllableState(value, defaultValue2, onChange) {
326
+ const [internal, setInternal] = (0, import_react2.useState)(defaultValue2);
317
327
  const isControlled = value !== void 0;
318
328
  const current = isControlled ? value : internal;
319
329
  const currentRef = (0, import_react2.useRef)(current);
@@ -497,6 +507,27 @@ var InboxIcon = /* @__PURE__ */ icon(
497
507
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z" })
498
508
  ] })
499
509
  );
510
+ var MenuIcon = /* @__PURE__ */ icon(
511
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
512
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M4 5h16" }),
513
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M4 12h16" }),
514
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M4 19h16" })
515
+ ] })
516
+ );
517
+ var PanelLeftOpenIcon = /* @__PURE__ */ icon(
518
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
519
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
520
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M9 3v18" }),
521
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "m14 9 3 3-3 3" })
522
+ ] })
523
+ );
524
+ var PanelLeftCloseIcon = /* @__PURE__ */ icon(
525
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
526
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2" }),
527
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M9 3v18" }),
528
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "m16 15-3-3 3-3" })
529
+ ] })
530
+ );
500
531
 
501
532
  // src/components/Button/ButtonGroup.tsx
502
533
  var import_jsx_runtime5 = require("react/jsx-runtime");
@@ -592,7 +623,7 @@ var import_jsx_runtime6 = require("react/jsx-runtime");
592
623
  function SegmentedControl({
593
624
  options,
594
625
  value,
595
- defaultValue,
626
+ defaultValue: defaultValue2,
596
627
  onChange,
597
628
  size: size2 = "md",
598
629
  fullWidth = false,
@@ -600,7 +631,7 @@ function SegmentedControl({
600
631
  className,
601
632
  ...aria
602
633
  }) {
603
- const [current, setCurrent] = useControllableState(value, defaultValue ?? options[0]?.value ?? "", onChange);
634
+ const [current, setCurrent] = useControllableState(value, defaultValue2 ?? options[0]?.value ?? "", onChange);
604
635
  const refs = (0, import_react5.useRef)([]);
605
636
  const groupRef = (0, import_react5.useRef)(null);
606
637
  useIndicator(groupRef, '[aria-checked="true"]', current);
@@ -1115,7 +1146,7 @@ function ToggleButtonGroup(props) {
1115
1146
  options,
1116
1147
  selectionMode = "single",
1117
1148
  value,
1118
- defaultValue,
1149
+ defaultValue: defaultValue2,
1119
1150
  onChange,
1120
1151
  disallowEmptySelection = false,
1121
1152
  size: sizeProp,
@@ -1133,7 +1164,7 @@ function ToggleButtonGroup(props) {
1133
1164
  const multiple = selectionMode === "multiple";
1134
1165
  const [selected, setSelected] = useControllableState(
1135
1166
  toList(value),
1136
- toList(defaultValue) ?? [],
1167
+ toList(defaultValue2) ?? [],
1137
1168
  (next) => onChange?.(multiple ? next : next[0] ?? "")
1138
1169
  );
1139
1170
  const [focusedValue, setFocusedValue] = (0, import_react12.useState)(null);
@@ -1289,7 +1320,7 @@ function CheckboxGroup({
1289
1320
  label,
1290
1321
  description,
1291
1322
  value,
1292
- defaultValue = [],
1323
+ defaultValue: defaultValue2 = [],
1293
1324
  onChange,
1294
1325
  orientation = "vertical",
1295
1326
  error,
@@ -1298,7 +1329,7 @@ function CheckboxGroup({
1298
1329
  children,
1299
1330
  className
1300
1331
  }) {
1301
- const [current, setCurrent] = useControllableState(value, defaultValue, onChange);
1332
+ const [current, setCurrent] = useControllableState(value, defaultValue2, onChange);
1302
1333
  const generatedName = (0, import_react13.useId)();
1303
1334
  const errorId = (0, import_react13.useId)();
1304
1335
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
@@ -1757,7 +1788,7 @@ function assignRef2(ref, value) {
1757
1788
  }
1758
1789
  var SearchField = /* @__PURE__ */ (0, import_react17.forwardRef)(function SearchField2({
1759
1790
  value,
1760
- defaultValue = "",
1791
+ defaultValue: defaultValue2 = "",
1761
1792
  onChange,
1762
1793
  onSubmit,
1763
1794
  loading = false,
@@ -1767,7 +1798,7 @@ var SearchField = /* @__PURE__ */ (0, import_react17.forwardRef)(function Search
1767
1798
  onKeyDown,
1768
1799
  ...inputProps
1769
1800
  }, ref) {
1770
- const [text, setText] = useControllableState(value, defaultValue, onChange);
1801
+ const [text, setText] = useControllableState(value, defaultValue2, onChange);
1771
1802
  const inputRef = (0, import_react17.useRef)(null);
1772
1803
  function handleKeyDown(event) {
1773
1804
  onKeyDown?.(event);
@@ -1817,7 +1848,7 @@ var import_jsx_runtime18 = require("react/jsx-runtime");
1817
1848
  var decimals = (step) => (String(step).split(".")[1] ?? "").length;
1818
1849
  var NumberField = /* @__PURE__ */ (0, import_react18.forwardRef)(function NumberField2({
1819
1850
  value,
1820
- defaultValue = null,
1851
+ defaultValue: defaultValue2 = null,
1821
1852
  onChange,
1822
1853
  min,
1823
1854
  max,
@@ -1834,7 +1865,7 @@ var NumberField = /* @__PURE__ */ (0, import_react18.forwardRef)(function Number
1834
1865
  form,
1835
1866
  ...inputProps
1836
1867
  }, ref) {
1837
- const [number, setNumber] = useControllableState(value, defaultValue, onChange);
1868
+ const [number2, setNumber] = useControllableState(value, defaultValue2, onChange);
1838
1869
  const [draft, setDraft] = (0, import_react18.useState)(null);
1839
1870
  const format = (n) => n === null ? "" : formatOptions ? new Intl.NumberFormat(void 0, formatOptions).format(n) : String(n);
1840
1871
  const clamp3 = (n) => {
@@ -1855,7 +1886,7 @@ var NumberField = /* @__PURE__ */ (0, import_react18.forwardRef)(function Number
1855
1886
  if (keepEditing) setDraft(String(next));
1856
1887
  }
1857
1888
  function stepBy(multiple) {
1858
- const base = draft !== null && draft !== "" && !Number.isNaN(Number(draft)) ? Number(draft) : number ?? min ?? 0;
1889
+ const base = draft !== null && draft !== "" && !Number.isNaN(Number(draft)) ? Number(draft) : number2 ?? min ?? 0;
1859
1890
  const next = clamp3(base + step * multiple);
1860
1891
  setNumber(next);
1861
1892
  if (draft !== null) setDraft(String(next));
@@ -1877,8 +1908,8 @@ var NumberField = /* @__PURE__ */ (0, import_react18.forwardRef)(function Number
1877
1908
  event.preventDefault();
1878
1909
  move();
1879
1910
  }
1880
- const atMin = min !== void 0 && number !== null && number <= min;
1881
- const atMax = max !== void 0 && number !== null && number >= max;
1911
+ const atMin = min !== void 0 && number2 !== null && number2 <= min;
1912
+ const atMax = max !== void 0 && number2 !== null && number2 >= max;
1882
1913
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1883
1914
  "div",
1884
1915
  {
@@ -1911,16 +1942,16 @@ var NumberField = /* @__PURE__ */ (0, import_react18.forwardRef)(function Number
1911
1942
  role: "spinbutton",
1912
1943
  autoComplete: "off",
1913
1944
  className: "ow-number-field__input",
1914
- "aria-valuenow": number ?? void 0,
1945
+ "aria-valuenow": number2 ?? void 0,
1915
1946
  "aria-valuemin": min,
1916
1947
  "aria-valuemax": max,
1917
- "aria-valuetext": number === null ? void 0 : format(number),
1948
+ "aria-valuetext": number2 === null ? void 0 : format(number2),
1918
1949
  "aria-invalid": isInvalid || void 0,
1919
1950
  disabled,
1920
- value: draft ?? format(number),
1951
+ value: draft ?? format(number2),
1921
1952
  onFocus: (event) => {
1922
1953
  onFocus?.(event);
1923
- setDraft(number === null ? "" : String(number));
1954
+ setDraft(number2 === null ? "" : String(number2));
1924
1955
  },
1925
1956
  onChange: (event) => setDraft(event.target.value),
1926
1957
  onBlur: (event) => {
@@ -1931,7 +1962,7 @@ var NumberField = /* @__PURE__ */ (0, import_react18.forwardRef)(function Number
1931
1962
  ...inputProps
1932
1963
  }
1933
1964
  ),
1934
- name ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "hidden", name, form, value: number ?? "", disabled }) : null,
1965
+ name ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "hidden", name, form, value: number2 ?? "", disabled }) : null,
1935
1966
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1936
1967
  "button",
1937
1968
  {
@@ -1955,7 +1986,7 @@ var import_jsx_runtime19 = require("react/jsx-runtime");
1955
1986
  function InputOTP({
1956
1987
  length = 6,
1957
1988
  value,
1958
- defaultValue = "",
1989
+ defaultValue: defaultValue2 = "",
1959
1990
  onChange,
1960
1991
  onComplete,
1961
1992
  type = "numeric",
@@ -1970,7 +2001,7 @@ function InputOTP({
1970
2001
  name,
1971
2002
  className
1972
2003
  }) {
1973
- const [code, setCode] = useControllableState(value, defaultValue, onChange);
2004
+ const [code, setCode] = useControllableState(value, defaultValue2, onChange);
1974
2005
  const refs = (0, import_react19.useRef)([]);
1975
2006
  const latest = (0, import_react19.useRef)(code);
1976
2007
  latest.current = code;
@@ -2067,35 +2098,35 @@ var import_react21 = require("react");
2067
2098
 
2068
2099
  // src/components/Calendar/dates.ts
2069
2100
  var pad = (n) => String(n).padStart(2, "0");
2070
- function toISO(year, month, day) {
2101
+ function toISO(year, month, day2) {
2071
2102
  const date = /* @__PURE__ */ new Date(0);
2072
- date.setUTCFullYear(year, month, day);
2103
+ date.setUTCFullYear(year, month, day2);
2073
2104
  return `${String(date.getUTCFullYear()).padStart(4, "0")}-${pad(date.getUTCMonth() + 1)}-${pad(date.getUTCDate())}`;
2074
2105
  }
2075
2106
  function parseISO(iso) {
2076
- const [year, month, day] = iso.split("-").map(Number);
2077
- return { year, month: month - 1, day };
2107
+ const [year, month, day2] = iso.split("-").map(Number);
2108
+ return { year, month: month - 1, day: day2 };
2078
2109
  }
2079
2110
  function todayISO() {
2080
2111
  const now = /* @__PURE__ */ new Date();
2081
2112
  return toISO(now.getFullYear(), now.getMonth(), now.getDate());
2082
2113
  }
2083
2114
  function addDays(iso, days) {
2084
- const { year, month, day } = parseISO(iso);
2085
- return toISO(year, month, day + days);
2115
+ const { year, month, day: day2 } = parseISO(iso);
2116
+ return toISO(year, month, day2 + days);
2086
2117
  }
2087
2118
  function addMonths(iso, months) {
2088
- const { year, month, day } = parseISO(iso);
2119
+ const { year, month, day: day2 } = parseISO(iso);
2089
2120
  const lastDay = new Date(Date.UTC(year, month + months + 1, 0)).getUTCDate();
2090
- return toISO(year, month + months, Math.min(day, lastDay));
2121
+ return toISO(year, month + months, Math.min(day2, lastDay));
2091
2122
  }
2092
2123
  function weekday(iso) {
2093
- const { year, month, day } = parseISO(iso);
2094
- return new Date(Date.UTC(year, month, day)).getUTCDay();
2124
+ const { year, month, day: day2 } = parseISO(iso);
2125
+ return new Date(Date.UTC(year, month, day2)).getUTCDay();
2095
2126
  }
2096
2127
  function toDate(iso) {
2097
- const { year, month, day } = parseISO(iso);
2098
- return new Date(Date.UTC(year, month, day));
2128
+ const { year, month, day: day2 } = parseISO(iso);
2129
+ return new Date(Date.UTC(year, month, day2));
2099
2130
  }
2100
2131
  function formatDate(iso, locale, options) {
2101
2132
  return new Intl.DateTimeFormat(locale, { ...options, timeZone: "UTC" }).format(toDate(iso));
@@ -2336,9 +2367,9 @@ function SegmentedField({
2336
2367
  segmentRefs.current.slice(0, segments.length).forEach((element, index) => {
2337
2368
  if (!element) return;
2338
2369
  const box = element.getBoundingClientRect();
2339
- const gap = event.clientX < box.left ? box.left - event.clientX : Math.max(0, event.clientX - box.right);
2340
- if (gap < distance) {
2341
- distance = gap;
2370
+ const gap2 = event.clientX < box.left ? box.left - event.clientX : Math.max(0, event.clientX - box.right);
2371
+ if (gap2 < distance) {
2372
+ distance = gap2;
2342
2373
  nearest = index;
2343
2374
  }
2344
2375
  });
@@ -2506,12 +2537,12 @@ function daysIn(year, month) {
2506
2537
  function fromISO(iso) {
2507
2538
  const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(iso);
2508
2539
  if (!match) return {};
2509
- const [year, month, day] = [Number(match[1]), Number(match[2]), Number(match[3])];
2510
- if (year < 1 || month < 1 || month > 12 || day < 1 || day > daysIn(year, month)) return {};
2511
- return { year, month, day };
2540
+ const [year, month, day2] = [Number(match[1]), Number(match[2]), Number(match[3])];
2541
+ if (year < 1 || month < 1 || month > 12 || day2 < 1 || day2 > daysIn(year, month)) return {};
2542
+ return { year, month, day: day2 };
2512
2543
  }
2513
- function toISOValue({ day, month, year }) {
2514
- return day === void 0 || month === void 0 || year === void 0 ? "" : `${pad2(year, 4)}-${pad2(month)}-${pad2(day)}`;
2544
+ function toISOValue({ day: day2, month, year }) {
2545
+ return day2 === void 0 || month === void 0 || year === void 0 ? "" : `${pad2(year, 4)}-${pad2(month)}-${pad2(day2)}`;
2515
2546
  }
2516
2547
  function constrain(parts) {
2517
2548
  const last = daysIn(parts.year, parts.month);
@@ -2528,7 +2559,7 @@ function dateLayout(locale) {
2528
2559
  }
2529
2560
  var DateField = /* @__PURE__ */ (0, import_react21.forwardRef)(function DateField2({
2530
2561
  value,
2531
- defaultValue = "",
2562
+ defaultValue: defaultValue2 = "",
2532
2563
  onChange,
2533
2564
  min,
2534
2565
  max,
@@ -2545,7 +2576,7 @@ var DateField = /* @__PURE__ */ (0, import_react21.forwardRef)(function DateFiel
2545
2576
  "aria-describedby": ariaDescribedBy,
2546
2577
  className
2547
2578
  }, ref) {
2548
- const [current, setCurrent] = useControllableState(value, defaultValue, onChange);
2579
+ const [current, setCurrent] = useControllableState(value, defaultValue2, onChange);
2549
2580
  const [parts, setParts] = (0, import_react21.useState)(() => fromISO(current));
2550
2581
  const partsRef = (0, import_react21.useRef)(parts);
2551
2582
  partsRef.current = parts;
@@ -2691,7 +2722,7 @@ function timeLayout(locale, twelve, seconds) {
2691
2722
  }
2692
2723
  var TimeField = /* @__PURE__ */ (0, import_react22.forwardRef)(function TimeField2({
2693
2724
  value,
2694
- defaultValue = "",
2725
+ defaultValue: defaultValue2 = "",
2695
2726
  onChange,
2696
2727
  hourCycle,
2697
2728
  granularity = "minute",
@@ -2711,7 +2742,7 @@ var TimeField = /* @__PURE__ */ (0, import_react22.forwardRef)(function TimeFiel
2711
2742
  "aria-describedby": ariaDescribedBy,
2712
2743
  className
2713
2744
  }, ref) {
2714
- const [current, setCurrent] = useControllableState(value, defaultValue, onChange);
2745
+ const [current, setCurrent] = useControllableState(value, defaultValue2, onChange);
2715
2746
  const localeCycle = (0, import_react22.useMemo)(() => localeHourCycle(locale), [locale]);
2716
2747
  const twelve = (hourCycle ?? localeCycle) === 12;
2717
2748
  const seconds = granularity === "second";
@@ -3195,7 +3226,7 @@ function ListBoxWithRef({
3195
3226
  options,
3196
3227
  selectionMode,
3197
3228
  value,
3198
- defaultValue,
3229
+ defaultValue: defaultValue2,
3199
3230
  onChange,
3200
3231
  disallowEmptySelection = false,
3201
3232
  emptyMessage = "No options",
@@ -3213,7 +3244,7 @@ function ListBoxWithRef({
3213
3244
  const multiple = selectionMode === "multiple";
3214
3245
  const [current, setCurrent] = useControllableState(
3215
3246
  value,
3216
- defaultValue ?? (multiple ? [] : ""),
3247
+ defaultValue2 ?? (multiple ? [] : ""),
3217
3248
  onChange
3218
3249
  );
3219
3250
  const listRef = (0, import_react25.useRef)(null);
@@ -3497,7 +3528,7 @@ function assignRef4(ref, value) {
3497
3528
  var Combobox = /* @__PURE__ */ (0, import_react26.forwardRef)(function Combobox2({
3498
3529
  options,
3499
3530
  value,
3500
- defaultValue = "",
3531
+ defaultValue: defaultValue2 = "",
3501
3532
  onChange,
3502
3533
  onInputChange,
3503
3534
  placeholder = "Search\u2026",
@@ -3510,7 +3541,7 @@ var Combobox = /* @__PURE__ */ (0, import_react26.forwardRef)(function Combobox2
3510
3541
  className,
3511
3542
  ...aria
3512
3543
  }, ref) {
3513
- const [selected, setSelected] = useControllableState(value, defaultValue, onChange);
3544
+ const [selected, setSelected] = useControllableState(value, defaultValue2, onChange);
3514
3545
  const labelOf = (v) => options.find((option) => option.value === v)?.label ?? (allowCustomValue ? v : "");
3515
3546
  const [text, setText] = (0, import_react26.useState)(() => labelOf(selected));
3516
3547
  const [isOpen, setOpen] = (0, import_react26.useState)(false);
@@ -3725,7 +3756,7 @@ function RadioGroup({
3725
3756
  label,
3726
3757
  description,
3727
3758
  value,
3728
- defaultValue = "",
3759
+ defaultValue: defaultValue2 = "",
3729
3760
  onChange,
3730
3761
  orientation = "vertical",
3731
3762
  variant = "default",
@@ -3735,7 +3766,7 @@ function RadioGroup({
3735
3766
  children,
3736
3767
  className
3737
3768
  }) {
3738
- const [current, select] = useControllableState(value, defaultValue, onChange);
3769
+ const [current, select] = useControllableState(value, defaultValue2, onChange);
3739
3770
  const generatedName = (0, import_react27.useId)();
3740
3771
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(RadioGroupContext.Provider, { value: { name: name ?? generatedName, value: current, select, disabled }, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3741
3772
  Fieldset,
@@ -3806,7 +3837,7 @@ var import_react29 = require("react");
3806
3837
  var import_jsx_runtime29 = require("react/jsx-runtime");
3807
3838
  function Slider({
3808
3839
  value,
3809
- defaultValue,
3840
+ defaultValue: defaultValue2,
3810
3841
  onChange,
3811
3842
  onChangeEnd,
3812
3843
  min = 0,
@@ -3822,7 +3853,7 @@ function Slider({
3822
3853
  disabled,
3823
3854
  className
3824
3855
  }) {
3825
- const [current, setCurrent] = useControllableState(value, defaultValue ?? min, onChange);
3856
+ const [current, setCurrent] = useControllableState(value, defaultValue2 ?? min, onChange);
3826
3857
  const labelId = (0, import_react29.useId)();
3827
3858
  const isRange = Array.isArray(current);
3828
3859
  const [low, high] = isRange ? current : [min, current];
@@ -4003,8 +4034,8 @@ function FileDropZone({
4003
4034
  // src/components/Calendar/Calendar.tsx
4004
4035
  var import_react31 = require("react");
4005
4036
  var import_jsx_runtime31 = require("react/jsx-runtime");
4006
- var Calendar = /* @__PURE__ */ (0, import_react31.forwardRef)(function Calendar2({ value, defaultValue = "", onChange, min, max, isDateDisabled, locale, weekStartsOn = 1, autoFocus = false, className }, ref) {
4007
- const [selected, setSelected] = useControllableState(value, defaultValue, onChange);
4037
+ var Calendar = /* @__PURE__ */ (0, import_react31.forwardRef)(function Calendar2({ value, defaultValue: defaultValue2 = "", onChange, min, max, isDateDisabled, locale, weekStartsOn = 1, autoFocus = false, className }, ref) {
4038
+ const [selected, setSelected] = useControllableState(value, defaultValue2, onChange);
4008
4039
  const today = todayISO();
4009
4040
  const [focused, setFocused] = (0, import_react31.useState)(() => selected || clampDate(today, min, max));
4010
4041
  const [shouldFocus, setShouldFocus] = (0, import_react31.useState)(autoFocus);
@@ -4078,14 +4109,14 @@ function canShowAfter(last, max) {
4078
4109
  return !max || addMonths(last, 1) <= max;
4079
4110
  }
4080
4111
  function dateForKey(event, date, weekStartsOn) {
4081
- const day = (weekday(date) - weekStartsOn + 7) % 7;
4112
+ const day2 = (weekday(date) - weekStartsOn + 7) % 7;
4082
4113
  const moves = {
4083
4114
  ArrowLeft: () => addDays(date, -1),
4084
4115
  ArrowRight: () => addDays(date, 1),
4085
4116
  ArrowUp: () => addDays(date, -7),
4086
4117
  ArrowDown: () => addDays(date, 7),
4087
- Home: () => addDays(date, -day),
4088
- End: () => addDays(date, 6 - day),
4118
+ Home: () => addDays(date, -day2),
4119
+ End: () => addDays(date, 6 - day2),
4089
4120
  PageUp: () => addMonths(date, event.shiftKey ? -12 : -1),
4090
4121
  PageDown: () => addMonths(date, event.shiftKey ? 12 : 1)
4091
4122
  };
@@ -4199,7 +4230,7 @@ function assignRef5(ref, value) {
4199
4230
  }
4200
4231
  var DatePicker = /* @__PURE__ */ (0, import_react32.forwardRef)(function DatePicker2({
4201
4232
  value,
4202
- defaultValue = "",
4233
+ defaultValue: defaultValue2 = "",
4203
4234
  onChange,
4204
4235
  placeholder = "Pick a date",
4205
4236
  formatOptions = { dateStyle: "medium" },
@@ -4214,7 +4245,7 @@ var DatePicker = /* @__PURE__ */ (0, import_react32.forwardRef)(function DatePic
4214
4245
  "aria-describedby": ariaDescribedBy,
4215
4246
  ...calendarProps
4216
4247
  }, ref) {
4217
- const [date, setDate] = useControllableState(value, defaultValue, onChange);
4248
+ const [date, setDate] = useControllableState(value, defaultValue2, onChange);
4218
4249
  const [isOpen, setOpen] = (0, import_react32.useState)(false);
4219
4250
  const triggerRef = (0, import_react32.useRef)(null);
4220
4251
  const panelRef = (0, import_react32.useRef)(null);
@@ -4297,9 +4328,9 @@ var DatePicker = /* @__PURE__ */ (0, import_react32.forwardRef)(function DatePic
4297
4328
  // src/components/Calendar/RangeCalendar.tsx
4298
4329
  var import_react33 = require("react");
4299
4330
  var import_jsx_runtime33 = require("react/jsx-runtime");
4300
- var RangeCalendar = /* @__PURE__ */ (0, import_react33.forwardRef)(function RangeCalendar2({ value, defaultValue = null, onChange, min, max, isDateDisabled, locale, weekStartsOn = 1, visibleMonths = 1, autoFocus = false, className }, ref) {
4331
+ var RangeCalendar = /* @__PURE__ */ (0, import_react33.forwardRef)(function RangeCalendar2({ value, defaultValue: defaultValue2 = null, onChange, min, max, isDateDisabled, locale, weekStartsOn = 1, visibleMonths = 1, autoFocus = false, className }, ref) {
4301
4332
  const months = visibleMonths;
4302
- const [range, setRange] = useControllableState(value, defaultValue, onChange);
4333
+ const [range, setRange] = useControllableState(value, defaultValue2, onChange);
4303
4334
  const today = todayISO();
4304
4335
  const [focused, setFocused] = (0, import_react33.useState)(() => range ? ordered(range.start, range.end).start : clampDate(today, min, max));
4305
4336
  const [firstMonth, setFirstMonth] = (0, import_react33.useState)(() => fitMonths(startOfMonth(focused), months, min, max));
@@ -4371,8 +4402,8 @@ var RangeCalendar = /* @__PURE__ */ (0, import_react33.forwardRef)(function Rang
4371
4402
  }
4372
4403
  function cellClassName(date, column) {
4373
4404
  if (!shown || shown.start === shown.end || !inShown(date)) return void 0;
4374
- const { day } = parseISO(date);
4375
- const monthStart = months > 1 && day === 1;
4405
+ const { day: day2 } = parseISO(date);
4406
+ const monthStart = months > 1 && day2 === 1;
4376
4407
  const monthEnd = months > 1 && parseISO(addDays(date, 1)).day === 1;
4377
4408
  return cx("ow-range-calendar__cell--in-range", {
4378
4409
  "ow-range-calendar__cell--start": date === shown.start,
@@ -4482,7 +4513,7 @@ function useMediaQuery(query) {
4482
4513
  }
4483
4514
  var DateRangePicker = /* @__PURE__ */ (0, import_react34.forwardRef)(function DateRangePicker2({
4484
4515
  value,
4485
- defaultValue = null,
4516
+ defaultValue: defaultValue2 = null,
4486
4517
  onChange,
4487
4518
  presets,
4488
4519
  visibleMonths = 2,
@@ -4499,7 +4530,7 @@ var DateRangePicker = /* @__PURE__ */ (0, import_react34.forwardRef)(function Da
4499
4530
  "aria-describedby": ariaDescribedBy,
4500
4531
  ...calendarProps
4501
4532
  }, ref) {
4502
- const [range, setRange] = useControllableState(value, defaultValue, onChange);
4533
+ const [range, setRange] = useControllableState(value, defaultValue2, onChange);
4503
4534
  const [isOpen, setOpen] = (0, import_react34.useState)(false);
4504
4535
  const fieldRef = (0, import_react34.useRef)(null);
4505
4536
  const triggerRef = (0, import_react34.useRef)(null);
@@ -4698,8 +4729,8 @@ function ProgressCircle({
4698
4729
  className
4699
4730
  }) {
4700
4731
  const { box, stroke } = circleSizes[size2];
4701
- const radius = (box - stroke) / 2;
4702
- const circumference = 2 * Math.PI * radius;
4732
+ const radius2 = (box - stroke) / 2;
4733
+ const circumference = 2 * Math.PI * radius2;
4703
4734
  const indeterminate = value === void 0;
4704
4735
  const pct = indeterminate ? 25 : Math.min(100, Math.max(0, value / max * 100));
4705
4736
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
@@ -4719,14 +4750,14 @@ function ProgressCircle({
4719
4750
  style: { width: box, height: box },
4720
4751
  children: [
4721
4752
  /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("svg", { width: box, height: box, viewBox: `0 0 ${box} ${box}`, "aria-hidden": "true", children: [
4722
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("circle", { className: "ow-progress-circle__track", cx: box / 2, cy: box / 2, r: radius, strokeWidth: stroke, fill: "none" }),
4753
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("circle", { className: "ow-progress-circle__track", cx: box / 2, cy: box / 2, r: radius2, strokeWidth: stroke, fill: "none" }),
4723
4754
  /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4724
4755
  "circle",
4725
4756
  {
4726
4757
  className: "ow-progress-circle__fill",
4727
4758
  cx: box / 2,
4728
4759
  cy: box / 2,
4729
- r: radius,
4760
+ r: radius2,
4730
4761
  strokeWidth: stroke,
4731
4762
  fill: "none",
4732
4763
  strokeLinecap: "round",
@@ -4865,7 +4896,7 @@ function Toaster({
4865
4896
  duration = 6e3,
4866
4897
  closeButton = true,
4867
4898
  offset = 16,
4868
- gap = 10,
4899
+ gap: gap2 = 10,
4869
4900
  id,
4870
4901
  className
4871
4902
  }) {
@@ -4898,7 +4929,7 @@ function Toaster({
4898
4929
  closeButton,
4899
4930
  offset,
4900
4931
  mobileOffset: offset,
4901
- gap,
4932
+ gap: gap2,
4902
4933
  icons: icons2,
4903
4934
  className: cx("ow-toaster", className),
4904
4935
  containerAriaLabel: "Notifications",
@@ -5514,8 +5545,8 @@ function useTabs(component) {
5514
5545
  return context;
5515
5546
  }
5516
5547
  var idPart = (value) => value.replace(/[^\w-]/g, "_");
5517
- function Tabs({ value, defaultValue = "", onValueChange, variant = "segmented", className, children, ...props }) {
5518
- const [current, select] = useControllableState(value, defaultValue, onValueChange);
5548
+ function Tabs({ value, defaultValue: defaultValue2 = "", onValueChange, variant = "segmented", className, children, ...props }) {
5549
+ const [current, select] = useControllableState(value, defaultValue2, onValueChange);
5519
5550
  const baseId = (0, import_react46.useId)();
5520
5551
  return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(TabsContext.Provider, { value: { value: current, select, baseId, variant }, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: cx("ow-tabs", `ow-tabs--${variant}`, className), ...props, children }) });
5521
5552
  }
@@ -5676,7 +5707,7 @@ var AccordionContext = /* @__PURE__ */ (0, import_react47.createContext)(null);
5676
5707
  function Accordion({
5677
5708
  type = "single",
5678
5709
  value,
5679
- defaultValue = [],
5710
+ defaultValue: defaultValue2 = [],
5680
5711
  onValueChange,
5681
5712
  variant = "bordered",
5682
5713
  headingLevel = 3,
@@ -5685,7 +5716,7 @@ function Accordion({
5685
5716
  onKeyDown,
5686
5717
  ...props
5687
5718
  }) {
5688
- const [openValues, setOpenValues] = useControllableState(value, defaultValue, onValueChange);
5719
+ const [openValues, setOpenValues] = useControllableState(value, defaultValue2, onValueChange);
5689
5720
  function toggle(item) {
5690
5721
  const isOpen = openValues.includes(item);
5691
5722
  if (type === "single") setOpenValues(isOpen ? [] : [item]);
@@ -5880,7 +5911,16 @@ function Steps({ items: items2, current = 0, orientation = "vertical", title, la
5880
5911
  }
5881
5912
 
5882
5913
  // src/components/NavList/NavList.tsx
5914
+ var import_react51 = require("react");
5915
+
5916
+ // src/components/AppShell/AppShell.context.ts
5883
5917
  var import_react50 = require("react");
5918
+ var AppShellContext = /* @__PURE__ */ (0, import_react50.createContext)(null);
5919
+ function useAppShell() {
5920
+ return (0, import_react50.useContext)(AppShellContext);
5921
+ }
5922
+
5923
+ // src/components/NavList/NavList.tsx
5884
5924
  var import_jsx_runtime50 = require("react/jsx-runtime");
5885
5925
  function NavList({ label, heading, orientation = "vertical", children, className }) {
5886
5926
  return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("nav", { "aria-label": label, className: cx("ow-nav", `ow-nav--${orientation}`, className), children: [
@@ -5888,7 +5928,8 @@ function NavList({ label, heading, orientation = "vertical", children, className
5888
5928
  children
5889
5929
  ] });
5890
5930
  }
5891
- var NavItem = /* @__PURE__ */ (0, import_react50.forwardRef)(function NavItem2({ icon: icon2, active = false, className, children, type = "button", href, end, ...buttonProps }, ref) {
5931
+ var NavItem = /* @__PURE__ */ (0, import_react51.forwardRef)(function NavItem2({ icon: icon2, active = false, className, children, type = "button", href, end, ...buttonProps }, ref) {
5932
+ const collapsed = (0, import_react51.useContext)(AppShellContext)?.collapsed ?? false;
5892
5933
  const content = /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
5893
5934
  icon2 ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "ow-nav__icon", children: icon2 }) : null,
5894
5935
  /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "ow-nav__label", children }),
@@ -5898,24 +5939,211 @@ var NavItem = /* @__PURE__ */ (0, import_react50.forwardRef)(function NavItem2({
5898
5939
  "aria-current": active ? "page" : void 0,
5899
5940
  className: cx("ow-nav__item", active && "ow-nav__item--active", className)
5900
5941
  };
5901
- if (href !== void 0) {
5902
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
5903
- "a",
5904
- {
5905
- ref,
5906
- href,
5907
- ...shared,
5908
- ...buttonProps,
5909
- children: content
5910
- }
5911
- );
5912
- }
5913
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { ref, type, ...shared, ...buttonProps, children: content });
5942
+ const item = href !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("a", { ref, href, ...shared, ...buttonProps, children: content }) : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { ref, type, ...shared, ...buttonProps, children: content });
5943
+ return collapsed ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Tooltip, { label: children, placement: "right", children: item }) : item;
5914
5944
  });
5915
5945
 
5916
- // src/components/Table/Table.tsx
5917
- var import_react51 = require("react");
5946
+ // src/components/AppShell/AppShell.tsx
5947
+ var import_react53 = require("react");
5948
+
5949
+ // src/components/Layout/Layout.tsx
5950
+ var import_react52 = require("react");
5918
5951
  var import_jsx_runtime51 = require("react/jsx-runtime");
5952
+ var space = (token) => token === "none" ? "0" : `var(--ow-space-${token})`;
5953
+ var alignments = { start: "flex-start", center: "center", end: "flex-end", stretch: "stretch", baseline: "baseline", between: "space-between" };
5954
+ function Stack({
5955
+ direction = "column",
5956
+ gap: gap2 = "md",
5957
+ align,
5958
+ justify,
5959
+ wrap = false,
5960
+ as = "div",
5961
+ className,
5962
+ style,
5963
+ children,
5964
+ ...props
5965
+ }) {
5966
+ const Element2 = as;
5967
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
5968
+ Element2,
5969
+ {
5970
+ className: cx("ow-stack", className),
5971
+ style: {
5972
+ flexDirection: direction,
5973
+ gap: space(gap2),
5974
+ alignItems: align ? alignments[align] : void 0,
5975
+ justifyContent: justify ? alignments[justify] : void 0,
5976
+ flexWrap: wrap ? "wrap" : void 0,
5977
+ ...style
5978
+ },
5979
+ ...props,
5980
+ children
5981
+ }
5982
+ );
5983
+ }
5984
+ function Separator({ orientation = "horizontal", label, spacing = "none", className }) {
5985
+ const margin2 = orientation === "horizontal" ? `${space(spacing)} 0` : `0 ${space(spacing)}`;
5986
+ if (label && orientation === "horizontal") {
5987
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { role: "separator", className: cx("ow-separator-label", className), style: { margin: margin2 }, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "ow-separator-label__text", children: label }) });
5988
+ }
5989
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
5990
+ "div",
5991
+ {
5992
+ role: "separator",
5993
+ "aria-orientation": orientation,
5994
+ className: cx("ow-separator", `ow-separator--${orientation}`, className),
5995
+ style: { margin: margin2 }
5996
+ }
5997
+ );
5998
+ }
5999
+ function ScrollShadow({
6000
+ orientation = "vertical",
6001
+ size: size2 = 32,
6002
+ maxSize,
6003
+ className,
6004
+ style,
6005
+ children,
6006
+ "aria-label": ariaLabel,
6007
+ ...props
6008
+ }) {
6009
+ const ref = (0, import_react52.useRef)(null);
6010
+ const [edges, setEdges] = (0, import_react52.useState)({ start: false, end: false });
6011
+ (0, import_react52.useEffect)(() => {
6012
+ const element = ref.current;
6013
+ if (!element) return;
6014
+ const update = () => {
6015
+ const position = orientation === "vertical" ? element.scrollTop : element.scrollLeft;
6016
+ const extent = orientation === "vertical" ? element.scrollHeight - element.clientHeight : element.scrollWidth - element.clientWidth;
6017
+ setEdges({ start: position > 1, end: position < extent - 1 });
6018
+ };
6019
+ update();
6020
+ element.addEventListener("scroll", update, { passive: true });
6021
+ const observer = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver(update);
6022
+ observer?.observe(element);
6023
+ if (element.firstElementChild) observer?.observe(element.firstElementChild);
6024
+ return () => {
6025
+ element.removeEventListener("scroll", update);
6026
+ observer?.disconnect();
6027
+ };
6028
+ }, [orientation]);
6029
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
6030
+ "div",
6031
+ {
6032
+ ref,
6033
+ className: cx("ow-scroll-shadow", `ow-scroll-shadow--${orientation}`, className),
6034
+ "data-start": edges.start || void 0,
6035
+ "data-end": edges.end || void 0,
6036
+ tabIndex: ariaLabel ? 0 : void 0,
6037
+ role: ariaLabel ? "region" : void 0,
6038
+ "aria-label": ariaLabel,
6039
+ style: {
6040
+ "--ow-scroll-shadow": `${size2}px`,
6041
+ [orientation === "vertical" ? "maxHeight" : "maxWidth"]: maxSize,
6042
+ ...style
6043
+ },
6044
+ ...props,
6045
+ children
6046
+ }
6047
+ );
6048
+ }
6049
+ function VisuallyHidden({ className, ...props }) {
6050
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: cx("ow-visually-hidden", className), ...props });
6051
+ }
6052
+
6053
+ // src/components/AppShell/AppShell.tsx
6054
+ var import_jsx_runtime52 = require("react/jsx-runtime");
6055
+ function AppShell({
6056
+ sidebar,
6057
+ children,
6058
+ variant = "inset",
6059
+ collapsible = false,
6060
+ collapsed,
6061
+ defaultCollapsed = false,
6062
+ onCollapsedChange,
6063
+ breakpoint = "md",
6064
+ topbar,
6065
+ topbarActions,
6066
+ labels = {},
6067
+ className,
6068
+ ...props
6069
+ }) {
6070
+ const sidebarId = (0, import_react53.useId)();
6071
+ const [ownCollapsed, setOwnCollapsed] = useControllableState(collapsed, defaultCollapsed, onCollapsedChange);
6072
+ const [drawerOpen, setDrawerOpen] = (0, import_react53.useState)(false);
6073
+ const folded = collapsible && ownCollapsed;
6074
+ const openNavigation = (0, import_react53.useCallback)(() => setDrawerOpen(true), []);
6075
+ const closeNavigation = (0, import_react53.useCallback)(() => setDrawerOpen(false), []);
6076
+ const shared = (0, import_react53.useMemo)(
6077
+ () => ({
6078
+ collapsible,
6079
+ setCollapsed: setOwnCollapsed,
6080
+ toggleCollapsed: () => setOwnCollapsed((previous) => !previous),
6081
+ openNavigation,
6082
+ closeNavigation,
6083
+ sidebarId
6084
+ }),
6085
+ [collapsible, setOwnCollapsed, openNavigation, closeNavigation, sidebarId]
6086
+ );
6087
+ const beside = (0, import_react53.useMemo)(() => ({ ...shared, collapsed: folded, inDrawer: false }), [shared, folded]);
6088
+ const inDrawer = (0, import_react53.useMemo)(() => ({ ...shared, collapsed: false, inDrawer: true }), [shared]);
6089
+ const closeOnChoice = (event) => {
6090
+ if (event.target.closest(".ow-nav__item, [data-closes-navigation]")) setDrawerOpen(false);
6091
+ };
6092
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
6093
+ "div",
6094
+ {
6095
+ className: cx("ow-app-shell", `ow-app-shell--${variant}`, `ow-app-shell--${breakpoint}`, folded && "ow-app-shell--collapsed", className),
6096
+ ...props,
6097
+ children: [
6098
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "ow-app-shell__frame", children: [
6099
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(AppShellContext.Provider, { value: beside, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("aside", { id: sidebarId, className: "ow-app-shell__sidebar", "aria-label": labels.navigation ?? "Main navigation", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "ow-sidebar", children: sidebar }) }) }),
6100
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "ow-app-shell__body", children: [
6101
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("header", { className: "ow-app-shell__topbar", children: [
6102
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Button, { variant: "ghost", iconOnly: true, "aria-label": labels.openNavigation ?? "Open navigation", onClick: openNavigation, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(MenuIcon, { size: 18 }) }),
6103
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "ow-app-shell__topbar-start", children: topbar }),
6104
+ topbarActions ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "ow-app-shell__topbar-end", children: topbarActions }) : null
6105
+ ] }),
6106
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("main", { className: "ow-app-shell__main", children })
6107
+ ] })
6108
+ ] }),
6109
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Drawer, { open: drawerOpen, onClose: closeNavigation, side: "left", size: 300, title: labels.menu ?? "Menu", className: "ow-app-shell__drawer", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(AppShellContext.Provider, { value: inDrawer, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "ow-sidebar ow-sidebar--drawer", onClick: closeOnChoice, children: sidebar }) }) })
6110
+ ]
6111
+ }
6112
+ );
6113
+ }
6114
+ function SidebarHeader({ className, ...props }) {
6115
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: cx("ow-sidebar__header", className), ...props });
6116
+ }
6117
+ function SidebarContent({ className, children, ...props }) {
6118
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ScrollShadow, { className: cx("ow-sidebar__content", className), ...props, children });
6119
+ }
6120
+ function SidebarFooter({ className, ...props }) {
6121
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: cx("ow-sidebar__footer", className), ...props });
6122
+ }
6123
+ function SidebarToggle({ labels = {}, className }) {
6124
+ const shell = useAppShell();
6125
+ if (!shell?.collapsible || shell.inDrawer) return null;
6126
+ const label = shell.collapsed ? labels.expand ?? "Expand sidebar" : labels.collapse ?? "Collapse sidebar";
6127
+ const Icon = shell.collapsed ? PanelLeftOpenIcon : PanelLeftCloseIcon;
6128
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Tooltip, { label, placement: "right", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
6129
+ Button,
6130
+ {
6131
+ variant: "ghost",
6132
+ iconOnly: true,
6133
+ size: "sm",
6134
+ "aria-label": label,
6135
+ "aria-expanded": !shell.collapsed,
6136
+ "aria-controls": shell.sidebarId,
6137
+ className: cx("ow-sidebar__toggle", className),
6138
+ onClick: shell.toggleCollapsed,
6139
+ children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Icon, { size: 16 })
6140
+ }
6141
+ ) });
6142
+ }
6143
+
6144
+ // src/components/Table/Table.tsx
6145
+ var import_react54 = require("react");
6146
+ var import_jsx_runtime53 = require("react/jsx-runtime");
5919
6147
  function compare(a, b) {
5920
6148
  if (typeof a === "number" && typeof b === "number") return a - b;
5921
6149
  return String(a).localeCompare(String(b), void 0, { numeric: true, sensitivity: "base" });
@@ -5950,7 +6178,7 @@ function Table({
5950
6178
  return typeof first === "string" || typeof first === "number" ? String(first) : `row ${index + 1}`;
5951
6179
  };
5952
6180
  const field = (row, key) => row[key];
5953
- const sorted = (0, import_react51.useMemo)(() => {
6181
+ const sorted = (0, import_react54.useMemo)(() => {
5954
6182
  if (!currentSort || manualSort) return rows;
5955
6183
  const column = columns.find((c) => c.key === currentSort.key);
5956
6184
  if (!column) return rows;
@@ -5966,16 +6194,16 @@ function Table({
5966
6194
  );
5967
6195
  }
5968
6196
  const selectable = selectionMode === "multiple";
5969
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
6197
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
5970
6198
  "div",
5971
6199
  {
5972
6200
  className: cx("ow-table-wrap", stickyHeader && "ow-table-wrap--sticky", className),
5973
6201
  style: maxHeight ? { maxHeight } : void 0,
5974
6202
  tabIndex: maxHeight ? 0 : void 0,
5975
- children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("table", { className: cx("ow-table", `ow-table--${density}`), children: [
5976
- caption ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("caption", { className: cx("ow-table__caption", hideCaption && "ow-visually-hidden"), children: caption }) : null,
5977
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("tr", { children: [
5978
- selectable ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("th", { className: "ow-table__select", scope: "col", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
6203
+ children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("table", { className: cx("ow-table", `ow-table--${density}`), children: [
6204
+ caption ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("caption", { className: cx("ow-table__caption", hideCaption && "ow-visually-hidden"), children: caption }) : null,
6205
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("tr", { children: [
6206
+ selectable ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("th", { className: "ow-table__select", scope: "col", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
5979
6207
  Checkbox,
5980
6208
  {
5981
6209
  size: "sm",
@@ -5989,27 +6217,27 @@ function Table({
5989
6217
  ) }) : null,
5990
6218
  columns.map((column) => {
5991
6219
  const direction = currentSort?.key === column.key ? currentSort.direction : void 0;
5992
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
6220
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
5993
6221
  "th",
5994
6222
  {
5995
6223
  scope: "col",
5996
6224
  "aria-sort": direction ?? (column.sortable ? "none" : void 0),
5997
6225
  className: cx(`ow-table__cell--${column.align ?? "start"}`),
5998
6226
  style: column.width !== void 0 ? { width: column.width } : void 0,
5999
- children: column.sortable ? /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("button", { type: "button", className: "ow-table__sort", onClick: () => toggleSort(column.key), children: [
6227
+ children: column.sortable ? /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("button", { type: "button", className: "ow-table__sort", onClick: () => toggleSort(column.key), children: [
6000
6228
  column.header,
6001
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: cx("ow-table__sort-icon", direction && "ow-table__sort-icon--active"), children: direction === "ascending" ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ArrowUpIcon, { size: 12 }) : direction === "descending" ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ArrowDownIcon, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ChevronsUpDownIcon, { size: 12 }) })
6229
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: cx("ow-table__sort-icon", direction && "ow-table__sort-icon--active"), children: direction === "ascending" ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ArrowUpIcon, { size: 12 }) : direction === "descending" ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ArrowDownIcon, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ChevronsUpDownIcon, { size: 12 }) })
6002
6230
  ] }) : column.header
6003
6231
  },
6004
6232
  column.key
6005
6233
  );
6006
6234
  })
6007
6235
  ] }) }),
6008
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("tbody", { children: sorted.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("td", { className: "ow-table__empty", colSpan: columns.length + (selectable ? 1 : 0), children: emptyContent }) }) : sorted.map((row, index) => {
6236
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("tbody", { children: sorted.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("td", { className: "ow-table__empty", colSpan: columns.length + (selectable ? 1 : 0), children: emptyContent }) }) : sorted.map((row, index) => {
6009
6237
  const key = keyOf2(row);
6010
6238
  const isSelected = selected.includes(key);
6011
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("tr", { className: cx(isSelected && "ow-table__row--selected"), children: [
6012
- selectable ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("td", { className: "ow-table__select", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
6239
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("tr", { className: cx(isSelected && "ow-table__row--selected"), children: [
6240
+ selectable ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("td", { className: "ow-table__select", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
6013
6241
  Checkbox,
6014
6242
  {
6015
6243
  size: "sm",
@@ -6020,7 +6248,7 @@ function Table({
6020
6248
  )
6021
6249
  }
6022
6250
  ) }) : null,
6023
- columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("td", { className: cx(`ow-table__cell--${column.align ?? "start"}`), children: column.render ? column.render(row) : field(row, column.key) }, column.key))
6251
+ columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("td", { className: cx(`ow-table__cell--${column.align ?? "start"}`), children: column.render ? column.render(row) : field(row, column.key) }, column.key))
6024
6252
  ] }, key);
6025
6253
  }) })
6026
6254
  ] })
@@ -6029,7 +6257,7 @@ function Table({
6029
6257
  }
6030
6258
 
6031
6259
  // src/components/Stat/Stat.tsx
6032
- var import_jsx_runtime52 = require("react/jsx-runtime");
6260
+ var import_jsx_runtime54 = require("react/jsx-runtime");
6033
6261
  function Sparkline({ values }) {
6034
6262
  const max = Math.max(...values);
6035
6263
  const min = Math.min(...values);
@@ -6041,37 +6269,483 @@ function Sparkline({ values }) {
6041
6269
  });
6042
6270
  const line = points.map(([x, y], index) => `${index ? "L" : "M"}${x.toFixed(2)} ${y.toFixed(2)}`).join(" ");
6043
6271
  const [lastX, lastY] = points[points.length - 1];
6044
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "ow-stat__trend", "aria-hidden": "true", children: [
6045
- /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("svg", { viewBox: "0 0 100 40", preserveAspectRatio: "none", children: [
6046
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("path", { d: `${line} L100 40 L0 40 Z`, className: "ow-stat__trend-area" }),
6047
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("path", { d: line, className: "ow-stat__trend-line", vectorEffect: "non-scaling-stroke" })
6272
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "ow-stat__trend", "aria-hidden": "true", children: [
6273
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("svg", { viewBox: "0 0 100 40", preserveAspectRatio: "none", children: [
6274
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("path", { d: `${line} L100 40 L0 40 Z`, className: "ow-stat__trend-area" }),
6275
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("path", { d: line, className: "ow-stat__trend-line", vectorEffect: "non-scaling-stroke" })
6048
6276
  ] }),
6049
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "ow-stat__trend-end", style: { left: `${lastX}%`, top: `${lastY / 40 * 100}%` } })
6277
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "ow-stat__trend-end", style: { left: `${lastX}%`, top: `${lastY / 40 * 100}%` } })
6050
6278
  ] });
6051
6279
  }
6052
6280
  function Stat({ label, value, icon: icon2, change, changeTone, description, trend, className }) {
6053
6281
  const tone = changeTone ?? (change?.startsWith("+") ? "positive" : /^[-−]/.test(change ?? "") ? "negative" : "neutral");
6054
6282
  const rising = change ? !/^[-−]/.test(change) : false;
6055
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: cx("ow-stat", className), children: [
6056
- /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "ow-stat__label", children: [
6057
- icon2 ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "ow-stat__icon", children: icon2 }) : null,
6058
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { children: label })
6283
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: cx("ow-stat", className), children: [
6284
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "ow-stat__label", children: [
6285
+ icon2 ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "ow-stat__icon", children: icon2 }) : null,
6286
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: label })
6059
6287
  ] }),
6060
- /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "ow-stat__row", children: [
6061
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "ow-stat__value", children: value }),
6062
- change ? /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("span", { className: cx("ow-stat__change", `ow-stat__change--${tone}`), children: [
6063
- tone === "neutral" ? null : rising ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ArrowUpIcon, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ArrowDownIcon, { size: 12 }),
6288
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "ow-stat__row", children: [
6289
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "ow-stat__value", children: value }),
6290
+ change ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: cx("ow-stat__change", `ow-stat__change--${tone}`), children: [
6291
+ tone === "neutral" ? null : rising ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ArrowUpIcon, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ArrowDownIcon, { size: 12 }),
6064
6292
  change
6065
6293
  ] }) : null
6066
6294
  ] }),
6067
- description ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "ow-stat__description", children: description }) : null,
6068
- trend && trend.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Sparkline, { values: trend }) : null
6295
+ description ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "ow-stat__description", children: description }) : null,
6296
+ trend && trend.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Sparkline, { values: trend }) : null
6297
+ ] });
6298
+ }
6299
+
6300
+ // src/components/Chart/Cartesian.tsx
6301
+ var import_react56 = require("react");
6302
+
6303
+ // src/components/Chart/chartUtils.ts
6304
+ var import_react55 = require("react");
6305
+ var colorOf = (color, index) => color === void 0 ? `var(--ow-chart-${index % 8 + 1})` : typeof color === "number" ? `var(--ow-chart-${color})` : color;
6306
+ var seriesColors = (series) => series.map((entry, index) => colorOf(entry.color, index));
6307
+ var number = new Intl.NumberFormat();
6308
+ var compact = new Intl.NumberFormat(void 0, { notation: "compact", maximumFractionDigits: 1 });
6309
+ var day = new Intl.DateTimeFormat(void 0, { day: "numeric", month: "short" });
6310
+ var defaultValue = (value) => number.format(value);
6311
+ var defaultTick = (value) => compact.format(value);
6312
+ var defaultIndex = (value) => value instanceof Date ? day.format(value) : String(value ?? "");
6313
+ var valueOf = (row, key) => {
6314
+ const value = row?.[key];
6315
+ return typeof value === "number" && Number.isFinite(value) ? value : 0;
6316
+ };
6317
+ function niceTicks(min, max) {
6318
+ const low = Math.min(0, min);
6319
+ const high = Math.max(0, max);
6320
+ const rough = (high - low || 1) / 4;
6321
+ const power = 10 ** Math.floor(Math.log10(rough));
6322
+ const step = [1, 2, 2.5, 5, 10].map((factor) => factor * power).find((candidate) => candidate >= rough);
6323
+ const start = Math.floor(low / step) * step;
6324
+ const end = Math.ceil(high / step) * step || step;
6325
+ const ticks = [];
6326
+ for (let tick = start; tick <= end + step / 2; tick += step) ticks.push(Math.round(tick / step) * step);
6327
+ return ticks;
6328
+ }
6329
+ function useWidth() {
6330
+ const ref = (0, import_react55.useRef)(null);
6331
+ const [width, setWidth] = (0, import_react55.useState)(0);
6332
+ (0, import_react55.useLayoutEffect)(() => {
6333
+ const element = ref.current;
6334
+ if (!element) return;
6335
+ const measure = () => setWidth(element.clientWidth);
6336
+ measure();
6337
+ if (typeof ResizeObserver === "undefined") return;
6338
+ const observer = new ResizeObserver(measure);
6339
+ observer.observe(element);
6340
+ return () => observer.disconnect();
6341
+ }, []);
6342
+ return [ref, width];
6343
+ }
6344
+ var textWidth = (text) => text.length * 6.6;
6345
+
6346
+ // src/components/Chart/ChartParts.tsx
6347
+ var import_jsx_runtime55 = require("react/jsx-runtime");
6348
+ function ChartLegend({ items: items2, shape }) {
6349
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("ul", { className: "ow-chart__legend", children: items2.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("li", { className: "ow-chart__legend-item", children: [
6350
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: `ow-chart__key ow-chart__key--${shape}`, style: { background: item.color }, "aria-hidden": "true" }),
6351
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "ow-chart__legend-label", children: item.label }),
6352
+ item.value !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "ow-chart__legend-value", children: item.value }) : null
6353
+ ] }, i)) });
6354
+ }
6355
+ function ChartTable({ caption, head, rows }) {
6356
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("table", { className: "ow-visually-hidden", children: [
6357
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("caption", { children: caption }),
6358
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("tr", { children: head.map((cell, i) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("th", { scope: "col", children: cell }, i)) }) }),
6359
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("tbody", { children: rows.map((row, r) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("tr", { children: row.map(
6360
+ (cell, i) => i === 0 ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("th", { scope: "row", children: cell }, i) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("td", { children: cell }, i)
6361
+ ) }, r)) })
6362
+ ] });
6363
+ }
6364
+
6365
+ // src/components/Chart/Cartesian.tsx
6366
+ var import_jsx_runtime56 = require("react/jsx-runtime");
6367
+ var gap = 2;
6368
+ var maxBar = 24;
6369
+ var radius = 4;
6370
+ function barPath(x, top, width, bottom, round) {
6371
+ const height = bottom - top;
6372
+ if (height <= 0 || width <= 0) return "";
6373
+ const r = round ? Math.min(radius, width / 2, height) : 0;
6374
+ return `M${x} ${bottom}V${top + r}${r ? `Q${x} ${top} ${x + r} ${top}` : ""}H${x + width - r}${r ? `Q${x + width} ${top} ${x + width} ${top + r}` : ""}V${bottom}Z`;
6375
+ }
6376
+ function linePath(points, curved) {
6377
+ if (!points.length) return "";
6378
+ const fixed = (n2) => n2.toFixed(1);
6379
+ if (!curved || points.length < 3) return points.map(([x, y], i) => `${i ? "L" : "M"}${fixed(x)} ${fixed(y)}`).join("");
6380
+ const n = points.length;
6381
+ const slopes = points.slice(0, -1).map(([x, y], i) => (points[i + 1][1] - y) / (points[i + 1][0] - x || 1));
6382
+ const tangents = points.map((_, i) => {
6383
+ if (i === 0) return slopes[0];
6384
+ if (i === n - 1) return slopes[n - 2];
6385
+ const a = slopes[i - 1];
6386
+ const b = slopes[i];
6387
+ return a * b <= 0 ? 0 : 3 * a * b / (Math.max(a, b) * 2 + Math.min(a, b));
6388
+ });
6389
+ let d = `M${fixed(points[0][0])} ${fixed(points[0][1])}`;
6390
+ for (let i = 0; i < n - 1; i++) {
6391
+ const [x0, y0] = points[i];
6392
+ const [x1, y1] = points[i + 1];
6393
+ const h = (x1 - x0) / 3;
6394
+ d += `C${fixed(x0 + h)} ${fixed(y0 + tangents[i] * h)} ${fixed(x1 - h)} ${fixed(y1 - tangents[i + 1] * h)} ${fixed(x1)} ${fixed(y1)}`;
6395
+ }
6396
+ return d;
6397
+ }
6398
+ function CartesianChart(props) {
6399
+ const {
6400
+ kind,
6401
+ data,
6402
+ index,
6403
+ series,
6404
+ label,
6405
+ height = 240,
6406
+ formatValue = defaultValue,
6407
+ formatTick = defaultTick,
6408
+ formatIndex = defaultIndex,
6409
+ legend = series.length > 1,
6410
+ className
6411
+ } = props;
6412
+ const stacked = kind === "bar" && Boolean(props.stacked);
6413
+ const area = kind === "line" && Boolean(props.area);
6414
+ const curved = kind === "line" && Boolean(props.curved);
6415
+ const [plotRef, width] = useWidth();
6416
+ const [active, setActive] = (0, import_react56.useState)(null);
6417
+ const colors = seriesColors(series);
6418
+ const count = data.length;
6419
+ const totals = data.map((row) => series.reduce((sum, entry) => sum + Math.max(0, valueOf(row, entry.key)), 0));
6420
+ const values = data.flatMap((row) => series.map((entry) => valueOf(row, entry.key)));
6421
+ const ticks = niceTicks(Math.min(0, ...values), stacked ? Math.max(0, ...totals) : Math.max(0, ...values));
6422
+ const low = ticks[0];
6423
+ const high = ticks[ticks.length - 1];
6424
+ const tickLabels = ticks.map(formatTick);
6425
+ const margin2 = { top: 8, right: kind === "line" ? 10 : 4, bottom: 26, left: Math.ceil(Math.max(...tickLabels.map(textWidth))) + 12 };
6426
+ const plotWidth = Math.max(0, width - margin2.left - margin2.right);
6427
+ const plotHeight = Math.max(0, height - margin2.top - margin2.bottom);
6428
+ const y = (value) => margin2.top + plotHeight - (value - low) / (high - low || 1) * plotHeight;
6429
+ const band = count ? plotWidth / count : 0;
6430
+ const inset = 6;
6431
+ const step = count > 1 ? (plotWidth - inset * 2) / (count - 1) : 0;
6432
+ const x = (i) => kind === "bar" ? margin2.left + band * (i + 0.5) : count > 1 ? margin2.left + inset + i * step : margin2.left + plotWidth / 2;
6433
+ const indexLabels = data.map((row) => formatIndex(row[index]));
6434
+ const spacing = kind === "bar" ? band : step || plotWidth;
6435
+ const every = Math.max(1, Math.ceil((Math.max(0, ...indexLabels.map(textWidth)) + 14) / (spacing || 1)));
6436
+ const labelled = data.map((_, i) => i).filter((i) => kind === "line" ? (count - 1 - i) % every === 0 : i % every === 0);
6437
+ const pick = (event) => {
6438
+ const left = event.currentTarget.getBoundingClientRect().left - margin2.left;
6439
+ const position = event.clientX - left;
6440
+ const i = kind === "bar" ? Math.floor((position - margin2.left) / (band || 1)) : Math.round((position - margin2.left - inset) / (step || 1));
6441
+ setActive(Math.min(count - 1, Math.max(0, i)));
6442
+ };
6443
+ const onKeyDown = (event) => {
6444
+ if (!count) return;
6445
+ const current = active ?? count - 1;
6446
+ const moves = { ArrowLeft: current - 1, ArrowRight: current + 1, Home: 0, End: count - 1 };
6447
+ if (event.key === "Escape") return setActive(null);
6448
+ if (!(event.key in moves)) return;
6449
+ event.preventDefault();
6450
+ setActive(Math.min(count - 1, Math.max(0, moves[event.key])));
6451
+ };
6452
+ const shown = active === null ? null : Math.min(active, count - 1);
6453
+ const describe = (i) => `${indexLabels[i]}: ${series.map((entry) => `${entry.label} ${formatValue(valueOf(data[i], entry.key))}`).join(", ")}.`;
6454
+ const groupSeries = stacked ? 1 : series.length;
6455
+ const groupWidth = Math.min(band * 0.72, groupSeries * maxBar + (groupSeries - 1) * gap);
6456
+ const barWidth = Math.max(1, (groupWidth - (groupSeries - 1) * gap) / groupSeries);
6457
+ const bars = () => data.map((row, i) => {
6458
+ const start = x(i) - groupWidth / 2;
6459
+ if (stacked) {
6460
+ let base = 0;
6461
+ const parts = series.map((entry, s) => {
6462
+ const value = Math.max(0, valueOf(row, entry.key));
6463
+ const part = { s, from: base, to: base + value };
6464
+ base += value;
6465
+ return part;
6466
+ });
6467
+ const top = [...parts].reverse().find((part) => part.to > part.from)?.s;
6468
+ return parts.map(
6469
+ ({ s, from, to }) => to > from ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("path", { d: barPath(start, y(to), barWidth, y(from) - (from > 0 ? gap : 0), s === top), fill: colors[s] }, `${i}-${s}`) : null
6470
+ );
6471
+ }
6472
+ return series.map((entry, s) => {
6473
+ const value = valueOf(row, entry.key);
6474
+ const left = start + s * (barWidth + gap);
6475
+ const d = value >= 0 ? barPath(left, y(value), barWidth, y(0), true) : y(value) > y(0) ? flipped(left, y(0), barWidth, y(value)) : "";
6476
+ return d ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("path", { d, fill: colors[s] }, `${i}-${s}`) : null;
6477
+ });
6478
+ });
6479
+ const lines = () => series.map((entry, s) => {
6480
+ const points = data.map((row, i) => [x(i), y(valueOf(row, entry.key))]);
6481
+ const line = linePath(points, curved);
6482
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("g", { children: [
6483
+ area && points.length ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
6484
+ "path",
6485
+ {
6486
+ className: "ow-chart__area",
6487
+ d: `${line}L${points[points.length - 1][0].toFixed(1)} ${y(Math.max(low, 0))}L${points[0][0].toFixed(1)} ${y(Math.max(low, 0))}Z`,
6488
+ fill: colors[s]
6489
+ }
6490
+ ) : null,
6491
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("path", { className: "ow-chart__line", d: line, stroke: colors[s] }),
6492
+ count === 1 ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("circle", { className: "ow-chart__point", cx: points[0][0], cy: points[0][1], r: 4, fill: colors[s] }) : null
6493
+ ] }, entry.key);
6494
+ });
6495
+ const onRight = shown !== null && x(shown) > width / 2;
6496
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("figure", { className: cx("ow-chart", `ow-chart--${kind}`, className), children: [
6497
+ legend ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ChartLegend, { items: series.map((entry, s) => ({ label: entry.label, color: colors[s] })), shape: kind === "line" ? "line" : "square" }) : null,
6498
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
6499
+ "div",
6500
+ {
6501
+ ref: plotRef,
6502
+ className: "ow-chart__plot",
6503
+ style: { height },
6504
+ tabIndex: count ? 0 : void 0,
6505
+ role: "group",
6506
+ "aria-label": `${label}. Use the left and right arrow keys to read each point.`,
6507
+ onKeyDown,
6508
+ onFocus: (event) => {
6509
+ if (event.target === event.currentTarget) setActive((current) => current ?? count - 1);
6510
+ },
6511
+ onBlur: () => setActive(null),
6512
+ children: [
6513
+ width > 0 ? /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("svg", { width, height, "aria-hidden": "true", className: "ow-chart__svg", children: [
6514
+ ticks.map((tick, t) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("g", { children: [
6515
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
6516
+ "line",
6517
+ {
6518
+ className: tick === 0 ? "ow-chart__baseline" : "ow-chart__grid",
6519
+ x1: margin2.left,
6520
+ x2: width - margin2.right,
6521
+ y1: Math.round(y(tick)) + 0.5,
6522
+ y2: Math.round(y(tick)) + 0.5
6523
+ }
6524
+ ),
6525
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("text", { className: "ow-chart__tick", x: margin2.left - 10, y: y(tick), dy: "0.32em", textAnchor: "end", children: tickLabels[t] })
6526
+ ] }, tick)),
6527
+ labelled.map((i) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
6528
+ "text",
6529
+ {
6530
+ className: "ow-chart__tick",
6531
+ x: x(i),
6532
+ y: height - 6,
6533
+ textAnchor: kind === "line" && count > 1 && i === 0 ? "start" : kind === "line" && count > 1 && i === count - 1 ? "end" : "middle",
6534
+ children: indexLabels[i]
6535
+ },
6536
+ i
6537
+ )),
6538
+ kind === "bar" && shown !== null ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("rect", { className: "ow-chart__band", x: x(shown) - band / 2, y: margin2.top, width: band, height: plotHeight, rx: 6 }) : null,
6539
+ kind === "bar" ? bars() : lines(),
6540
+ kind === "line" && shown !== null ? /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
6541
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("line", { className: "ow-chart__crosshair", x1: x(shown), x2: x(shown), y1: margin2.top, y2: margin2.top + plotHeight }),
6542
+ series.map((entry, s) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
6543
+ "circle",
6544
+ {
6545
+ className: "ow-chart__point",
6546
+ cx: x(shown),
6547
+ cy: y(valueOf(data[shown], entry.key)),
6548
+ r: 4,
6549
+ fill: colors[s]
6550
+ },
6551
+ entry.key
6552
+ ))
6553
+ ] }) : null,
6554
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
6555
+ "rect",
6556
+ {
6557
+ className: "ow-chart__hit",
6558
+ x: margin2.left,
6559
+ y: margin2.top,
6560
+ width: plotWidth,
6561
+ height: plotHeight,
6562
+ onPointerMove: pick,
6563
+ onPointerDown: pick,
6564
+ onPointerLeave: () => setActive(null)
6565
+ }
6566
+ )
6567
+ ] }) : null,
6568
+ shown !== null && width > 0 ? /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "ow-chart__readout", style: onRight ? { right: width - x(shown) + 12 } : { left: x(shown) + 12 }, "aria-hidden": "true", children: [
6569
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "ow-chart__readout-title", children: indexLabels[shown] }),
6570
+ series.map((entry, s) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { className: "ow-chart__readout-row", children: [
6571
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: `ow-chart__key ow-chart__key--${kind === "line" ? "line" : "square"}`, style: { background: colors[s] } }),
6572
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "ow-chart__readout-label", children: entry.label }),
6573
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("strong", { children: formatValue(valueOf(data[shown], entry.key)) })
6574
+ ] }, entry.key))
6575
+ ] }) : null,
6576
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "ow-visually-hidden", "aria-live": "polite", children: shown !== null ? describe(shown) : "" })
6577
+ ]
6578
+ }
6579
+ ),
6580
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
6581
+ ChartTable,
6582
+ {
6583
+ caption: label,
6584
+ head: ["", ...series.map((entry) => entry.label)],
6585
+ rows: data.map((row, i) => [indexLabels[i], ...series.map((entry) => formatValue(valueOf(row, entry.key)))])
6586
+ }
6587
+ )
6588
+ ] });
6589
+ }
6590
+ function flipped(x, top, width, bottom) {
6591
+ const height = bottom - top;
6592
+ const r = Math.min(radius, width / 2, height);
6593
+ return `M${x} ${top}V${bottom - r}Q${x} ${bottom} ${x + r} ${bottom}H${x + width - r}Q${x + width} ${bottom} ${x + width} ${bottom - r}V${top}Z`;
6594
+ }
6595
+
6596
+ // src/components/Chart/LineChart.tsx
6597
+ var import_jsx_runtime57 = require("react/jsx-runtime");
6598
+ function LineChart(props) {
6599
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(CartesianChart, { kind: "line", ...props });
6600
+ }
6601
+
6602
+ // src/components/Chart/BarChart.tsx
6603
+ var import_jsx_runtime58 = require("react/jsx-runtime");
6604
+ function BarChart(props) {
6605
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(CartesianChart, { kind: "bar", ...props });
6606
+ }
6607
+
6608
+ // src/components/Chart/DonutChart.tsx
6609
+ var import_react57 = require("react");
6610
+ var import_jsx_runtime59 = require("react/jsx-runtime");
6611
+ var percent = new Intl.NumberFormat(void 0, { style: "percent", maximumFractionDigits: 1 });
6612
+ function slicePath(cx2, cy, outer, inner, start, end) {
6613
+ const point = (r, a) => `${(cx2 + r * Math.sin(a)).toFixed(2)} ${(cy - r * Math.cos(a)).toFixed(2)}`;
6614
+ const large = end - start > Math.PI ? 1 : 0;
6615
+ return `M${point(outer, start)}A${outer} ${outer} 0 ${large} 1 ${point(outer, end)}L${point(inner, end)}A${inner} ${inner} 0 ${large} 0 ${point(inner, start)}Z`;
6616
+ }
6617
+ function DonutChart({ data, label, formatValue = defaultValue, center, centerLabel = "Total", size: size2 = 180, legend = true, className }) {
6618
+ const [active, setActive] = (0, import_react57.useState)(null);
6619
+ const slices = data.map((slice, i) => ({ ...slice, value: Math.max(0, slice.value), fill: colorOf(slice.color, i) }));
6620
+ const total = slices.reduce((sum, slice) => sum + slice.value, 0);
6621
+ const share = (value) => percent.format(total ? value / total : 0);
6622
+ const outer = size2 / 2;
6623
+ const inner = outer - Math.max(14, Math.round(size2 * 0.13));
6624
+ const pad4 = (radius2) => slices.filter((slice) => slice.value > 0).length > 1 ? 1 / radius2 : 0;
6625
+ let angle = 0;
6626
+ const arcs = slices.map((slice) => {
6627
+ const start = angle;
6628
+ angle += total ? slice.value / total * Math.PI * 2 : 0;
6629
+ return { start, end: angle };
6630
+ });
6631
+ const onKeyDown = (event) => {
6632
+ if (!slices.length) return;
6633
+ const current = active ?? 0;
6634
+ const moves = {
6635
+ ArrowRight: (current + 1) % slices.length,
6636
+ ArrowDown: (current + 1) % slices.length,
6637
+ ArrowLeft: (current - 1 + slices.length) % slices.length,
6638
+ ArrowUp: (current - 1 + slices.length) % slices.length,
6639
+ Home: 0,
6640
+ End: slices.length - 1
6641
+ };
6642
+ if (event.key === "Escape") return setActive(null);
6643
+ if (!(event.key in moves)) return;
6644
+ event.preventDefault();
6645
+ setActive(moves[event.key]);
6646
+ };
6647
+ const shown = active === null ? null : slices[active];
6648
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("figure", { className: cx("ow-chart", "ow-chart--donut", className), children: [
6649
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
6650
+ "div",
6651
+ {
6652
+ className: "ow-chart__donut",
6653
+ style: { width: size2, height: size2 },
6654
+ tabIndex: slices.length ? 0 : void 0,
6655
+ role: "group",
6656
+ "aria-label": `${label}. Use the arrow keys to read each part.`,
6657
+ onKeyDown,
6658
+ onFocus: () => setActive((current) => current ?? 0),
6659
+ onBlur: () => setActive(null),
6660
+ onPointerLeave: () => setActive(null),
6661
+ children: [
6662
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("svg", { width: size2, height: size2, viewBox: `0 0 ${size2} ${size2}`, "aria-hidden": "true", children: [
6663
+ total === 0 ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("circle", { className: "ow-chart__empty", cx: outer, cy: outer, r: (outer + inner) / 2, strokeWidth: outer - inner }) : null,
6664
+ slices.map((slice, i) => {
6665
+ const { start, end } = arcs[i];
6666
+ if (end - start <= 0) return null;
6667
+ const whole = end - start >= Math.PI * 2 - 1e-6;
6668
+ const d = whole ? `${slicePath(outer, outer, outer, inner, 0, Math.PI)}${slicePath(outer, outer, outer, inner, Math.PI, Math.PI * 2)}` : innerPadded(outer, inner, start, end, pad4(outer), pad4(inner));
6669
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
6670
+ "path",
6671
+ {
6672
+ d,
6673
+ fill: slice.fill,
6674
+ className: cx("ow-chart__slice", active !== null && active !== i && "ow-chart__slice--dim"),
6675
+ onPointerEnter: () => setActive(i)
6676
+ },
6677
+ i
6678
+ );
6679
+ })
6680
+ ] }),
6681
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ow-chart__center", "aria-hidden": "true", children: [
6682
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("strong", { className: "ow-chart__center-value", children: shown ? formatValue(shown.value) : center ?? formatValue(total) }),
6683
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "ow-chart__center-label", children: shown ? `${shown.label} \xB7 ${share(shown.value)}` : centerLabel })
6684
+ ] }),
6685
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "ow-visually-hidden", "aria-live": "polite", children: shown ? `${shown.label}: ${formatValue(shown.value)}, ${share(shown.value)}.` : "" })
6686
+ ]
6687
+ }
6688
+ ),
6689
+ legend ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
6690
+ ChartLegend,
6691
+ {
6692
+ shape: "square",
6693
+ items: slices.map((slice) => ({ label: slice.label, color: slice.fill, value: `${formatValue(slice.value)} \xB7 ${share(slice.value)}` }))
6694
+ }
6695
+ ) : null,
6696
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
6697
+ ChartTable,
6698
+ {
6699
+ caption: label,
6700
+ head: ["", "Value", "Share"],
6701
+ rows: slices.map((slice) => [slice.label, formatValue(slice.value), share(slice.value)])
6702
+ }
6703
+ )
6069
6704
  ] });
6070
6705
  }
6706
+ function innerPadded(outer, inner, start, end, padOuter, padInner) {
6707
+ const c = outer;
6708
+ const point = (r, a) => `${(c + r * Math.sin(a)).toFixed(2)} ${(c - r * Math.cos(a)).toFixed(2)}`;
6709
+ const os = start + padOuter;
6710
+ const oe = Math.max(os, end - padOuter);
6711
+ const is = start + padInner;
6712
+ const ie = Math.max(is, end - padInner);
6713
+ const largeOuter = oe - os > Math.PI ? 1 : 0;
6714
+ const largeInner = ie - is > Math.PI ? 1 : 0;
6715
+ return `M${point(outer, os)}A${outer} ${outer} 0 ${largeOuter} 1 ${point(outer, oe)}L${point(inner, ie)}A${inner} ${inner} 0 ${largeInner} 0 ${point(inner, is)}Z`;
6716
+ }
6717
+
6718
+ // src/components/Chart/Sparkline.tsx
6719
+ var import_jsx_runtime60 = require("react/jsx-runtime");
6720
+ function Sparkline2({ data, "aria-label": ariaLabel, color = 1, area = true, width = 120, height = 32, className }) {
6721
+ const min = Math.min(...data);
6722
+ const max = Math.max(...data);
6723
+ const pad4 = 3;
6724
+ const y = (value) => pad4 + (1 - (value - min) / (max - min || 1)) * (height - pad4 * 2) - (max === min ? (height - pad4 * 2) / 2 : 0);
6725
+ const x = (i) => data.length > 1 ? i / (data.length - 1) * 100 : 50;
6726
+ const line = data.map((value, i) => `${i ? "L" : "M"}${x(i).toFixed(2)} ${y(value).toFixed(2)}`).join("");
6727
+ const last = data.length - 1;
6728
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
6729
+ "span",
6730
+ {
6731
+ role: "img",
6732
+ "aria-label": ariaLabel,
6733
+ className: cx("ow-sparkline", className),
6734
+ style: { width, height, "--ow-sparkline-color": colorOf(color, 0) },
6735
+ children: data.length ? /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
6736
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("svg", { viewBox: `0 0 100 ${height}`, preserveAspectRatio: "none", "aria-hidden": "true", children: [
6737
+ area ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("path", { className: "ow-sparkline__area", d: `${line}L100 ${height}L0 ${height}Z` }) : null,
6738
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("path", { className: "ow-sparkline__line", d: line, vectorEffect: "non-scaling-stroke" })
6739
+ ] }),
6740
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "ow-sparkline__end", style: { left: `${x(last)}%`, top: y(data[last]) }, "aria-hidden": "true" })
6741
+ ] }) : null
6742
+ }
6743
+ );
6744
+ }
6071
6745
 
6072
6746
  // src/components/FileTree/FileTree.tsx
6073
- var import_react52 = require("react");
6074
- var import_jsx_runtime53 = require("react/jsx-runtime");
6747
+ var import_react58 = require("react");
6748
+ var import_jsx_runtime61 = require("react/jsx-runtime");
6075
6749
  function flatten(nodes, expanded, parent, level = 1) {
6076
6750
  return nodes.flatMap((node) => {
6077
6751
  const path = parent ? `${parent}/${node.name}` : node.name;
@@ -6096,10 +6770,10 @@ function FileTree({
6096
6770
  className
6097
6771
  }) {
6098
6772
  const [current, setCurrent] = useControllableState(selected, defaultSelected, onSelect);
6099
- const [expanded, setExpanded] = (0, import_react52.useState)(() => new Set(defaultExpanded === "all" ? allFolders(items2) : defaultExpanded));
6100
- const rows = (0, import_react52.useMemo)(() => flatten(items2, expanded), [items2, expanded]);
6101
- const [focusPath, setFocusPath] = (0, import_react52.useState)();
6102
- const refs = (0, import_react52.useRef)(/* @__PURE__ */ new Map());
6773
+ const [expanded, setExpanded] = (0, import_react58.useState)(() => new Set(defaultExpanded === "all" ? allFolders(items2) : defaultExpanded));
6774
+ const rows = (0, import_react58.useMemo)(() => flatten(items2, expanded), [items2, expanded]);
6775
+ const [focusPath, setFocusPath] = (0, import_react58.useState)();
6776
+ const refs = (0, import_react58.useRef)(/* @__PURE__ */ new Map());
6103
6777
  const tabStop = rows.some((row) => row.path === focusPath) ? focusPath : (rows.find((row) => row.path === current) ?? rows[0])?.path;
6104
6778
  function focus(path) {
6105
6779
  if (!path) return;
@@ -6149,8 +6823,8 @@ function FileTree({
6149
6823
  const row = rows.find((entry) => entry.path === path);
6150
6824
  if (!row) return null;
6151
6825
  const isOpen = row.isFolder && expanded.has(path);
6152
- const icon2 = node.icon ?? (row.isFolder ? isOpen ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(FolderOpenIcon, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(FolderIcon, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(FileIcon, { size: 16 }));
6153
- return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
6826
+ const icon2 = node.icon ?? (row.isFolder ? isOpen ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(FolderOpenIcon, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(FolderIcon, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(FileIcon, { size: 16 }));
6827
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
6154
6828
  "li",
6155
6829
  {
6156
6830
  ref: (element) => {
@@ -6168,7 +6842,7 @@ function FileTree({
6168
6842
  if (event.target === event.currentTarget) setFocusPath(path);
6169
6843
  },
6170
6844
  children: [
6171
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
6845
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
6172
6846
  "div",
6173
6847
  {
6174
6848
  className: cx("ow-tree__row", !row.isFolder && current === path && "ow-tree__row--selected"),
@@ -6178,51 +6852,51 @@ function FileTree({
6178
6852
  activate(row);
6179
6853
  },
6180
6854
  children: [
6181
- row.isFolder ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ChevronRightIcon, { size: 14, className: cx("ow-tree__chevron", isOpen && "ow-tree__chevron--open") }) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "ow-tree__spacer" }),
6182
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: cx("ow-tree__icon", row.isFolder && "ow-tree__icon--folder"), children: icon2 }),
6183
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "ow-tree__name", children: node.name }),
6184
- node.meta ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "ow-tree__meta", children: node.meta }) : null
6855
+ row.isFolder ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ChevronRightIcon, { size: 14, className: cx("ow-tree__chevron", isOpen && "ow-tree__chevron--open") }) : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "ow-tree__spacer" }),
6856
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: cx("ow-tree__icon", row.isFolder && "ow-tree__icon--folder"), children: icon2 }),
6857
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "ow-tree__name", children: node.name }),
6858
+ node.meta ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "ow-tree__meta", children: node.meta }) : null
6185
6859
  ]
6186
6860
  }
6187
6861
  ),
6188
- isOpen && node.children.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("ul", { role: "group", className: "ow-tree__group", children: render(node.children, path, level + 1) }) : null
6862
+ isOpen && node.children.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("ul", { role: "group", className: "ow-tree__group", children: render(node.children, path, level + 1) }) : null
6189
6863
  ]
6190
6864
  },
6191
6865
  path
6192
6866
  );
6193
6867
  });
6194
6868
  }
6195
- return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("ul", { role: "tree", "aria-label": label, className: cx("ow-tree", className), children: render(items2) });
6869
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("ul", { role: "tree", "aria-label": label, className: cx("ow-tree", className), children: render(items2) });
6196
6870
  }
6197
6871
 
6198
6872
  // src/components/EmptyState/EmptyState.tsx
6199
- var import_jsx_runtime54 = require("react/jsx-runtime");
6873
+ var import_jsx_runtime62 = require("react/jsx-runtime");
6200
6874
  function EmptyState({ title, description, icon: icon2, actions, bordered = false, className }) {
6201
- return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: cx("ow-empty", bordered && "ow-empty--bordered", className), children: [
6202
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "ow-empty__icon", "aria-hidden": "true", children: icon2 ?? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(InboxIcon, { size: 20 }) }),
6203
- /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "ow-empty__text", children: [
6204
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "ow-empty__title", children: title }),
6205
- description ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "ow-empty__description", children: description }) : null
6875
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: cx("ow-empty", bordered && "ow-empty--bordered", className), children: [
6876
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ow-empty__icon", "aria-hidden": "true", children: icon2 ?? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(InboxIcon, { size: 20 }) }),
6877
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "ow-empty__text", children: [
6878
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "ow-empty__title", children: title }),
6879
+ description ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "ow-empty__description", children: description }) : null
6206
6880
  ] }),
6207
- actions ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "ow-empty__actions", children: actions }) : null
6881
+ actions ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "ow-empty__actions", children: actions }) : null
6208
6882
  ] });
6209
6883
  }
6210
6884
 
6211
6885
  // src/components/Tag/Tag.tsx
6212
- var import_jsx_runtime55 = require("react/jsx-runtime");
6886
+ var import_jsx_runtime63 = require("react/jsx-runtime");
6213
6887
  function Tag({ onRemove, variant = "neutral", size: size2 = "md", icon: icon2, removeLabel, className, children, ...props }) {
6214
6888
  const name = removeLabel ?? (typeof children === "string" ? children : "tag");
6215
- return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: cx("ow-tag", `ow-tag--${variant}`, `ow-tag--${size2}`, onRemove && "ow-tag--removable", className), ...props, children: [
6216
- icon2 ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "ow-tag__icon", children: icon2 }) : null,
6217
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "ow-tag__label", children }),
6218
- onRemove ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("button", { type: "button", className: "ow-tag__remove", "aria-label": `Remove ${name}`, onClick: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(XIcon, { size: 12 }) }) : null
6889
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("span", { className: cx("ow-tag", `ow-tag--${variant}`, `ow-tag--${size2}`, onRemove && "ow-tag--removable", className), ...props, children: [
6890
+ icon2 ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "ow-tag__icon", children: icon2 }) : null,
6891
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "ow-tag__label", children }),
6892
+ onRemove ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("button", { type: "button", className: "ow-tag__remove", "aria-label": `Remove ${name}`, onClick: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(XIcon, { size: 12 }) }) : null
6219
6893
  ] });
6220
6894
  }
6221
6895
  function TagGroup({ label, className, children, ...props }) {
6222
- return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { role: "group", "aria-label": label, className: cx("ow-tag-group", className), ...props, children });
6896
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { role: "group", "aria-label": label, className: cx("ow-tag-group", className), ...props, children });
6223
6897
  }
6224
6898
  function ColorSwatch({ color, name, value, size: size2 = "md", shape = "square", className }) {
6225
- const swatch = /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
6899
+ const swatch = /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
6226
6900
  "span",
6227
6901
  {
6228
6902
  className: cx("ow-swatch", `ow-swatch--${size2}`, shape === "circle" && "ow-swatch--circle"),
@@ -6230,19 +6904,19 @@ function ColorSwatch({ color, name, value, size: size2 = "md", shape = "square",
6230
6904
  ...name && !value ? { role: "img", "aria-label": name } : { "aria-hidden": true }
6231
6905
  }
6232
6906
  );
6233
- if (!name && !value) return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className, children: swatch });
6234
- return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: cx("ow-swatch-label", className), children: [
6907
+ if (!name && !value) return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className, children: swatch });
6908
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("span", { className: cx("ow-swatch-label", className), children: [
6235
6909
  swatch,
6236
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "ow-swatch-label__text", children: [
6237
- name ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "ow-swatch-label__name", children: name }) : null,
6238
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "ow-swatch-label__value", children: value })
6910
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("span", { className: "ow-swatch-label__text", children: [
6911
+ name ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "ow-swatch-label__name", children: name }) : null,
6912
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "ow-swatch-label__value", children: value })
6239
6913
  ] })
6240
6914
  ] });
6241
6915
  }
6242
6916
 
6243
6917
  // src/components/Avatar/Avatar.tsx
6244
- var import_react53 = require("react");
6245
- var import_jsx_runtime56 = require("react/jsx-runtime");
6918
+ var import_react59 = require("react");
6919
+ var import_jsx_runtime64 = require("react/jsx-runtime");
6246
6920
  var namedSizes = { sm: 24, md: 28, lg: 36, xl: 48 };
6247
6921
  function avatarSize(size2) {
6248
6922
  if (typeof size2 === "number") {
@@ -6252,37 +6926,37 @@ function avatarSize(size2) {
6252
6926
  }
6253
6927
  function Avatar({ name, src, size: size2 = "md", label, className }) {
6254
6928
  const initials = getInitials(name);
6255
- const [failedImage, setFailedImage] = (0, import_react53.useState)();
6929
+ const [failedImage, setFailedImage] = (0, import_react59.useState)();
6256
6930
  const showImage = src && src !== failedImage;
6257
6931
  const sizing = avatarSize(size2);
6258
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
6932
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
6259
6933
  "span",
6260
6934
  {
6261
6935
  className: cx("ow-avatar", sizing.className, !initials && !showImage && "ow-avatar--empty", className),
6262
6936
  style: sizing.style,
6263
6937
  ...label ? { role: "img", "aria-label": label } : { "aria-hidden": true },
6264
6938
  "data-initials": !showImage && initials ? initials : void 0,
6265
- children: showImage ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("img", { src, alt: "", className: "ow-avatar__image", onError: () => setFailedImage(src) }) : initials ? null : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(UserIcon, { size: Math.round(sizing.pixels * 0.52) })
6939
+ children: showImage ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("img", { src, alt: "", className: "ow-avatar__image", onError: () => setFailedImage(src) }) : initials ? null : /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(UserIcon, { size: Math.round(sizing.pixels * 0.52) })
6266
6940
  }
6267
6941
  );
6268
6942
  }
6269
6943
 
6270
6944
  // src/components/Avatar/AvatarGroup.tsx
6271
- var import_react54 = require("react");
6272
- var import_jsx_runtime57 = require("react/jsx-runtime");
6945
+ var import_react60 = require("react");
6946
+ var import_jsx_runtime65 = require("react/jsx-runtime");
6273
6947
  function AvatarGroup({ children, max = 4, size: size2 = "md", label, className }) {
6274
- const avatars = import_react54.Children.toArray(children).filter(import_react54.isValidElement);
6948
+ const avatars = import_react60.Children.toArray(children).filter(import_react60.isValidElement);
6275
6949
  const sizing = avatarSize(size2);
6276
6950
  const shown = avatars.slice(0, max);
6277
6951
  const hidden = avatars.length - shown.length;
6278
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { role: "group", "aria-label": label, className: cx("ow-avatar-group", className), children: [
6279
- shown.map((avatar) => (0, import_react54.cloneElement)(avatar, { size: size2 })),
6280
- hidden > 0 ? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { className: cx("ow-avatar", sizing.className, "ow-avatar--count"), style: sizing.style, children: [
6281
- /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { "aria-hidden": "true", children: [
6952
+ return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { role: "group", "aria-label": label, className: cx("ow-avatar-group", className), children: [
6953
+ shown.map((avatar) => (0, import_react60.cloneElement)(avatar, { size: size2 })),
6954
+ hidden > 0 ? /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("span", { className: cx("ow-avatar", sizing.className, "ow-avatar--count"), style: sizing.style, children: [
6955
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("span", { "aria-hidden": "true", children: [
6282
6956
  "+",
6283
6957
  hidden
6284
6958
  ] }),
6285
- /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { className: "ow-visually-hidden", children: [
6959
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("span", { className: "ow-visually-hidden", children: [
6286
6960
  "and ",
6287
6961
  hidden,
6288
6962
  " more"
@@ -6295,160 +6969,56 @@ function userSize(size2) {
6295
6969
  return size2 >= 48 ? "ow-user--xl" : size2 >= 36 ? "ow-user--lg" : size2 >= 28 ? "ow-user--md" : "ow-user--sm";
6296
6970
  }
6297
6971
  function User({ name, description, src, size: size2 = "md", className }) {
6298
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: cx("ow-user", userSize(size2), className), children: [
6299
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Avatar, { name, src, size: size2 }),
6300
- /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "ow-user__text", children: [
6301
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "ow-user__name", children: name }),
6302
- description ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "ow-user__description", children: description }) : null
6972
+ return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: cx("ow-user", userSize(size2), className), children: [
6973
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Avatar, { name, src, size: size2 }),
6974
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "ow-user__text", children: [
6975
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "ow-user__name", children: name }),
6976
+ description ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "ow-user__description", children: description }) : null
6303
6977
  ] })
6304
6978
  ] });
6305
6979
  }
6306
6980
 
6307
6981
  // src/components/Kbd/Kbd.tsx
6308
- var import_jsx_runtime58 = require("react/jsx-runtime");
6982
+ var import_jsx_runtime66 = require("react/jsx-runtime");
6309
6983
  function Kbd({ className, ...props }) {
6310
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("kbd", { className: cx("ow-kbd", className), ...props });
6984
+ return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("kbd", { className: cx("ow-kbd", className), ...props });
6311
6985
  }
6312
6986
  function Code({ className, ...props }) {
6313
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("code", { className: cx("ow-code", className), ...props });
6987
+ return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("code", { className: cx("ow-code", className), ...props });
6314
6988
  }
6315
6989
 
6316
6990
  // src/components/Card/Card.tsx
6317
- var import_jsx_runtime59 = require("react/jsx-runtime");
6991
+ var import_jsx_runtime67 = require("react/jsx-runtime");
6318
6992
  function Card({ className, padding = "md", ...props }) {
6319
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: cx("ow-card", `ow-card--pad-${padding}`, className), ...props });
6993
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: cx("ow-card", `ow-card--pad-${padding}`, className), ...props });
6320
6994
  }
6321
6995
  function SettingsRow({ children, description, label, className }) {
6322
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: cx("ow-settings-row", className), children: [
6323
- /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ow-settings-row__text", children: [
6324
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "ow-settings-row__label", children: label }),
6325
- description ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ow-settings-row__description", children: description }) : null
6996
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: cx("ow-settings-row", className), children: [
6997
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "ow-settings-row__text", children: [
6998
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "ow-settings-row__label", children: label }),
6999
+ description ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "ow-settings-row__description", children: description }) : null
6326
7000
  ] }),
6327
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "ow-settings-row__control", children })
7001
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "ow-settings-row__control", children })
6328
7002
  ] });
6329
7003
  }
6330
7004
 
6331
- // src/components/Layout/Layout.tsx
6332
- var import_react55 = require("react");
6333
- var import_jsx_runtime60 = require("react/jsx-runtime");
6334
- var space = (token) => token === "none" ? "0" : `var(--ow-space-${token})`;
6335
- var alignments = { start: "flex-start", center: "center", end: "flex-end", stretch: "stretch", baseline: "baseline", between: "space-between" };
6336
- function Stack({
6337
- direction = "column",
6338
- gap = "md",
6339
- align,
6340
- justify,
6341
- wrap = false,
6342
- as = "div",
6343
- className,
6344
- style,
6345
- children,
6346
- ...props
6347
- }) {
6348
- const Element2 = as;
6349
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
6350
- Element2,
6351
- {
6352
- className: cx("ow-stack", className),
6353
- style: {
6354
- flexDirection: direction,
6355
- gap: space(gap),
6356
- alignItems: align ? alignments[align] : void 0,
6357
- justifyContent: justify ? alignments[justify] : void 0,
6358
- flexWrap: wrap ? "wrap" : void 0,
6359
- ...style
6360
- },
6361
- ...props,
6362
- children
6363
- }
6364
- );
6365
- }
6366
- function Separator({ orientation = "horizontal", label, spacing = "none", className }) {
6367
- const margin2 = orientation === "horizontal" ? `${space(spacing)} 0` : `0 ${space(spacing)}`;
6368
- if (label && orientation === "horizontal") {
6369
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { role: "separator", className: cx("ow-separator-label", className), style: { margin: margin2 }, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "ow-separator-label__text", children: label }) });
6370
- }
6371
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
6372
- "div",
6373
- {
6374
- role: "separator",
6375
- "aria-orientation": orientation,
6376
- className: cx("ow-separator", `ow-separator--${orientation}`, className),
6377
- style: { margin: margin2 }
6378
- }
6379
- );
6380
- }
6381
- function ScrollShadow({
6382
- orientation = "vertical",
6383
- size: size2 = 32,
6384
- maxSize,
6385
- className,
6386
- style,
6387
- children,
6388
- "aria-label": ariaLabel,
6389
- ...props
6390
- }) {
6391
- const ref = (0, import_react55.useRef)(null);
6392
- const [edges, setEdges] = (0, import_react55.useState)({ start: false, end: false });
6393
- (0, import_react55.useEffect)(() => {
6394
- const element = ref.current;
6395
- if (!element) return;
6396
- const update = () => {
6397
- const position = orientation === "vertical" ? element.scrollTop : element.scrollLeft;
6398
- const extent = orientation === "vertical" ? element.scrollHeight - element.clientHeight : element.scrollWidth - element.clientWidth;
6399
- setEdges({ start: position > 1, end: position < extent - 1 });
6400
- };
6401
- update();
6402
- element.addEventListener("scroll", update, { passive: true });
6403
- const observer = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver(update);
6404
- observer?.observe(element);
6405
- if (element.firstElementChild) observer?.observe(element.firstElementChild);
6406
- return () => {
6407
- element.removeEventListener("scroll", update);
6408
- observer?.disconnect();
6409
- };
6410
- }, [orientation]);
6411
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
6412
- "div",
6413
- {
6414
- ref,
6415
- className: cx("ow-scroll-shadow", `ow-scroll-shadow--${orientation}`, className),
6416
- "data-start": edges.start || void 0,
6417
- "data-end": edges.end || void 0,
6418
- tabIndex: ariaLabel ? 0 : void 0,
6419
- role: ariaLabel ? "region" : void 0,
6420
- "aria-label": ariaLabel,
6421
- style: {
6422
- "--ow-scroll-shadow": `${size2}px`,
6423
- [orientation === "vertical" ? "maxHeight" : "maxWidth"]: maxSize,
6424
- ...style
6425
- },
6426
- ...props,
6427
- children
6428
- }
6429
- );
6430
- }
6431
- function VisuallyHidden({ className, ...props }) {
6432
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: cx("ow-visually-hidden", className), ...props });
6433
- }
6434
-
6435
7005
  // src/components/Container/Container.tsx
6436
- var import_jsx_runtime61 = require("react/jsx-runtime");
7006
+ var import_jsx_runtime68 = require("react/jsx-runtime");
6437
7007
  function Container({ size: size2 = "page", as: Element2 = "div", className, ...props }) {
6438
- return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Element2, { className: cx("ow-container", `ow-container--${size2}`, className), ...props });
7008
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Element2, { className: cx("ow-container", `ow-container--${size2}`, className), ...props });
6439
7009
  }
6440
7010
 
6441
7011
  // src/components/Section/Section.tsx
6442
- var import_jsx_runtime62 = require("react/jsx-runtime");
7012
+ var import_jsx_runtime69 = require("react/jsx-runtime");
6443
7013
  function Section({ tone = "paper", spacing = "md", size: size2 = "page", as: Element2 = "section", className, children, ...props }) {
6444
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Element2, { className: cx("ow-section", `ow-section--${tone}`, `ow-section--space-${spacing}`, className), ...props, children: size2 === false ? children : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Container, { size: size2, children }) });
7014
+ return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Element2, { className: cx("ow-section", `ow-section--${tone}`, `ow-section--space-${spacing}`, className), ...props, children: size2 === false ? children : /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Container, { size: size2, children }) });
6445
7015
  }
6446
7016
 
6447
7017
  // src/components/Marketing/Marketing.tsx
6448
- var import_react56 = require("react");
6449
- var import_jsx_runtime63 = require("react/jsx-runtime");
7018
+ var import_react61 = require("react");
7019
+ var import_jsx_runtime70 = require("react/jsx-runtime");
6450
7020
  function Chip({ className, ...props }) {
6451
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: cx("ow-chip", className), ...props });
7021
+ return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: cx("ow-chip", className), ...props });
6452
7022
  }
6453
7023
  function SectionHeading({
6454
7024
  eyebrow,
@@ -6458,21 +7028,21 @@ function SectionHeading({
6458
7028
  as: Heading = "h2",
6459
7029
  className
6460
7030
  }) {
6461
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: cx("ow-section-heading", align === "center" && "ow-section-heading--center", className), children: [
6462
- eyebrow ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Chip, { children: eyebrow }) : null,
6463
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Heading, { className: "ow-section-heading__title", children: title }),
6464
- intro ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("p", { className: "ow-section-heading__intro", children: intro }) : null
7031
+ return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: cx("ow-section-heading", align === "center" && "ow-section-heading--center", className), children: [
7032
+ eyebrow ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Chip, { children: eyebrow }) : null,
7033
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Heading, { className: "ow-section-heading__title", children: title }),
7034
+ intro ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("p", { className: "ow-section-heading__intro", children: intro }) : null
6465
7035
  ] });
6466
7036
  }
6467
7037
  function SiteHeader({ brand, nav, actions, className }) {
6468
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("header", { className: cx("ow-site-header", className), children: [
6469
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "ow-site-header__brand", children: brand }),
6470
- nav ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("nav", { className: "ow-site-header__nav", children: nav }) : null,
6471
- actions ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "ow-site-header__actions", children: actions }) : null
7038
+ return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("header", { className: cx("ow-site-header", className), children: [
7039
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "ow-site-header__brand", children: brand }),
7040
+ nav ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("nav", { className: "ow-site-header__nav", children: nav }) : null,
7041
+ actions ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "ow-site-header__actions", children: actions }) : null
6472
7042
  ] });
6473
7043
  }
6474
7044
  function DotGrid({ fade = false, interactive = false, className, children, onPointerMove, ...props }) {
6475
- const ref = (0, import_react56.useRef)(null);
7045
+ const ref = (0, import_react61.useRef)(null);
6476
7046
  function track(event) {
6477
7047
  onPointerMove?.(event);
6478
7048
  const element = ref.current;
@@ -6481,7 +7051,7 @@ function DotGrid({ fade = false, interactive = false, className, children, onPoi
6481
7051
  element.style.setProperty("--ow-pointer-x", `${event.clientX - rect.left}px`);
6482
7052
  element.style.setProperty("--ow-pointer-y", `${event.clientY - rect.top}px`);
6483
7053
  }
6484
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
7054
+ return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
6485
7055
  "div",
6486
7056
  {
6487
7057
  ref,
@@ -6489,21 +7059,21 @@ function DotGrid({ fade = false, interactive = false, className, children, onPoi
6489
7059
  onPointerMove: track,
6490
7060
  ...props,
6491
7061
  children: [
6492
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "ow-dot-grid__dots", "aria-hidden": "true" }),
6493
- interactive ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "ow-dot-grid__brass", "aria-hidden": "true" }) : null,
6494
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "ow-dot-grid__content", children })
7062
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "ow-dot-grid__dots", "aria-hidden": "true" }),
7063
+ interactive ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "ow-dot-grid__brass", "aria-hidden": "true" }) : null,
7064
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "ow-dot-grid__content", children })
6495
7065
  ]
6496
7066
  }
6497
7067
  );
6498
7068
  }
6499
7069
 
6500
7070
  // src/components/Prose/Prose.tsx
6501
- var import_react57 = require("react");
6502
- var import_jsx_runtime64 = require("react/jsx-runtime");
6503
- var Prose = /* @__PURE__ */ (0, import_react57.forwardRef)(function Prose2({ size: size2 = "md", fullWidth = false, as = "div", className, children, ...props }, ref) {
7071
+ var import_react62 = require("react");
7072
+ var import_jsx_runtime71 = require("react/jsx-runtime");
7073
+ var Prose = /* @__PURE__ */ (0, import_react62.forwardRef)(function Prose2({ size: size2 = "md", fullWidth = false, as = "div", className, children, ...props }, ref) {
6504
7074
  const Element2 = as;
6505
- const root = (0, import_react57.useRef)(null);
6506
- (0, import_react57.useEffect)(() => {
7075
+ const root = (0, import_react62.useRef)(null);
7076
+ (0, import_react62.useEffect)(() => {
6507
7077
  const element = root.current;
6508
7078
  if (!element) return;
6509
7079
  for (const scroller of element.querySelectorAll("pre, .ow-table-wrap")) {
@@ -6515,7 +7085,7 @@ var Prose = /* @__PURE__ */ (0, import_react57.forwardRef)(function Prose2({ siz
6515
7085
  if (text) box.setAttribute("aria-label", text);
6516
7086
  }
6517
7087
  });
6518
- return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
7088
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
6519
7089
  Element2,
6520
7090
  {
6521
7091
  ref: (node) => {
@@ -6531,10 +7101,10 @@ var Prose = /* @__PURE__ */ (0, import_react57.forwardRef)(function Prose2({ siz
6531
7101
  });
6532
7102
 
6533
7103
  // src/components/TextShimmer/TextShimmer.tsx
6534
- var import_jsx_runtime65 = require("react/jsx-runtime");
7104
+ var import_jsx_runtime72 = require("react/jsx-runtime");
6535
7105
  function TextShimmer({ children, as = "span", duration = 2, active = true, className }) {
6536
7106
  const Element2 = as;
6537
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
7107
+ return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
6538
7108
  Element2,
6539
7109
  {
6540
7110
  className: cx("ow-shimmer", active && "ow-shimmer--active", className),
@@ -6545,13 +7115,13 @@ function TextShimmer({ children, as = "span", duration = 2, active = true, class
6545
7115
  }
6546
7116
 
6547
7117
  // src/components/PromptInput/PromptInput.tsx
6548
- var import_react58 = require("react");
6549
- var import_jsx_runtime66 = require("react/jsx-runtime");
7118
+ var import_react63 = require("react");
7119
+ var import_jsx_runtime73 = require("react/jsx-runtime");
6550
7120
  var noAttachments = [];
6551
7121
  var counterFrom = 0.8;
6552
7122
  var announceDelay = 1e3;
6553
7123
  function Glyph({ children }) {
6554
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
7124
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
6555
7125
  "svg",
6556
7126
  {
6557
7127
  xmlns: "http://www.w3.org/2000/svg",
@@ -6571,29 +7141,29 @@ function Glyph({ children }) {
6571
7141
  }
6572
7142
  var sheet = "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z";
6573
7143
  var fold = "M14 2v5a1 1 0 0 0 1 1h5";
6574
- var PaperclipIcon = () => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Glyph, { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { d: "m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551" }) });
6575
- var StopIcon = () => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Glyph, { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2", fill: "currentColor", stroke: "none" }) });
7144
+ var PaperclipIcon = () => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Glyph, { children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("path", { d: "m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551" }) });
7145
+ var StopIcon = () => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Glyph, { children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2", fill: "currentColor", stroke: "none" }) });
6576
7146
  var fileIcons = {
6577
- image: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Glyph, { children: [
6578
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { d: sheet }),
6579
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { d: fold }),
6580
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("circle", { cx: "10", cy: "12", r: "2" }),
6581
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { d: "m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22" })
7147
+ image: /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(Glyph, { children: [
7148
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("path", { d: sheet }),
7149
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("path", { d: fold }),
7150
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("circle", { cx: "10", cy: "12", r: "2" }),
7151
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("path", { d: "m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22" })
6582
7152
  ] }),
6583
- code: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Glyph, { children: [
6584
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { d: sheet }),
6585
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { d: fold }),
6586
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { d: "M10 12.5 8 15l2 2.5" }),
6587
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { d: "m14 12.5 2 2.5-2 2.5" })
7153
+ code: /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(Glyph, { children: [
7154
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("path", { d: sheet }),
7155
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("path", { d: fold }),
7156
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("path", { d: "M10 12.5 8 15l2 2.5" }),
7157
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("path", { d: "m14 12.5 2 2.5-2 2.5" })
6588
7158
  ] }),
6589
- text: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Glyph, { children: [
6590
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { d: sheet }),
6591
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { d: fold }),
6592
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { d: "M10 9H8" }),
6593
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { d: "M16 13H8" }),
6594
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { d: "M16 17H8" })
7159
+ text: /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(Glyph, { children: [
7160
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("path", { d: sheet }),
7161
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("path", { d: fold }),
7162
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("path", { d: "M10 9H8" }),
7163
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("path", { d: "M16 13H8" }),
7164
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("path", { d: "M16 17H8" })
6595
7165
  ] }),
6596
- file: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FileIcon, { size: 16 })
7166
+ file: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(FileIcon, { size: 16 })
6597
7167
  };
6598
7168
  function kindOf({ name, type = "" }) {
6599
7169
  const lower = name.toLowerCase();
@@ -6633,9 +7203,9 @@ function accepts(file, accept) {
6633
7203
  });
6634
7204
  }
6635
7205
  var hasFiles = (event) => Array.from(event.dataTransfer.types).includes("Files");
6636
- var PromptInput = /* @__PURE__ */ (0, import_react58.forwardRef)(function PromptInput2({
7206
+ var PromptInput = /* @__PURE__ */ (0, import_react63.forwardRef)(function PromptInput2({
6637
7207
  value,
6638
- defaultValue = "",
7208
+ defaultValue: defaultValue2 = "",
6639
7209
  onChange,
6640
7210
  onSubmit,
6641
7211
  isStreaming = false,
@@ -6664,18 +7234,18 @@ var PromptInput = /* @__PURE__ */ (0, import_react58.forwardRef)(function Prompt
6664
7234
  onKeyDown,
6665
7235
  className
6666
7236
  }, ref) {
6667
- const [text, setText] = useControllableState(value, defaultValue, onChange);
6668
- const textAreaRef = (0, import_react58.useRef)(null);
6669
- const actionRef = (0, import_react58.useRef)(null);
6670
- const pickerRef = (0, import_react58.useRef)(null);
6671
- const listRef = (0, import_react58.useRef)(null);
6672
- const composing = (0, import_react58.useRef)(false);
6673
- const dragDepth = (0, import_react58.useRef)(0);
6674
- const pendingFocus = (0, import_react58.useRef)(null);
6675
- const [isDragging, setIsDragging] = (0, import_react58.useState)(false);
6676
- const [notice, setNotice] = (0, import_react58.useState)();
6677
- const [announcement, setAnnouncement] = (0, import_react58.useState)("");
6678
- const hintId = (0, import_react58.useId)();
7237
+ const [text, setText] = useControllableState(value, defaultValue2, onChange);
7238
+ const textAreaRef = (0, import_react63.useRef)(null);
7239
+ const actionRef = (0, import_react63.useRef)(null);
7240
+ const pickerRef = (0, import_react63.useRef)(null);
7241
+ const listRef = (0, import_react63.useRef)(null);
7242
+ const composing = (0, import_react63.useRef)(false);
7243
+ const dragDepth = (0, import_react63.useRef)(0);
7244
+ const pendingFocus = (0, import_react63.useRef)(null);
7245
+ const [isDragging, setIsDragging] = (0, import_react63.useState)(false);
7246
+ const [notice, setNotice] = (0, import_react63.useState)();
7247
+ const [announcement, setAnnouncement] = (0, import_react63.useState)("");
7248
+ const hintId = (0, import_react63.useId)();
6679
7249
  const rows = Math.max(1, Math.round(minRows));
6680
7250
  const maxRowCount = Math.max(rows, Math.round(maxRows));
6681
7251
  const canAttach = Boolean(onAttach) && !disabled;
@@ -6685,7 +7255,7 @@ var PromptInput = /* @__PURE__ */ (0, import_react58.forwardRef)(function Prompt
6685
7255
  const inline = !toolbarStart && !endActions;
6686
7256
  const showCounter = maxLength !== void 0 && maxLength > 0 && text.length >= maxLength * counterFrom;
6687
7257
  const remaining = maxLength === void 0 ? 0 : Math.max(0, maxLength - text.length);
6688
- const number = (count) => new Intl.NumberFormat(locale).format(count);
7258
+ const number2 = (count) => new Intl.NumberFormat(locale).format(count);
6689
7259
  const shownHint = notice ?? hint;
6690
7260
  const describedBy = [ariaDescribedBy, hint && !notice ? hintId : void 0].filter(Boolean).join(" ") || void 0;
6691
7261
  const name = ariaLabel ?? (ariaLabelledBy || id ? void 0 : "Message");
@@ -6694,7 +7264,7 @@ var PromptInput = /* @__PURE__ */ (0, import_react58.forwardRef)(function Prompt
6694
7264
  if (typeof ref === "function") ref(element);
6695
7265
  else if (ref) ref.current = element;
6696
7266
  }
6697
- (0, import_react58.useEffect)(() => {
7267
+ (0, import_react63.useEffect)(() => {
6698
7268
  const textArea = textAreaRef.current;
6699
7269
  if (!textArea || typeof ResizeObserver === "undefined") return;
6700
7270
  let width = textArea.clientWidth;
@@ -6706,20 +7276,20 @@ var PromptInput = /* @__PURE__ */ (0, import_react58.forwardRef)(function Prompt
6706
7276
  observer.observe(textArea);
6707
7277
  return () => observer.disconnect();
6708
7278
  }, []);
6709
- (0, import_react58.useLayoutEffect)(() => {
7279
+ (0, import_react63.useLayoutEffect)(() => {
6710
7280
  if (textAreaRef.current) resizeTextArea(textAreaRef.current);
6711
7281
  }, [size2, rows]);
6712
- const wasStreaming = (0, import_react58.useRef)(isStreaming);
6713
- const actionHadFocus = (0, import_react58.useRef)(false);
7282
+ const wasStreaming = (0, import_react63.useRef)(isStreaming);
7283
+ const actionHadFocus = (0, import_react63.useRef)(false);
6714
7284
  if (wasStreaming.current !== isStreaming) {
6715
7285
  actionHadFocus.current = typeof document !== "undefined" && document.activeElement === actionRef.current;
6716
7286
  }
6717
- (0, import_react58.useLayoutEffect)(() => {
7287
+ (0, import_react63.useLayoutEffect)(() => {
6718
7288
  if (wasStreaming.current && !isStreaming && actionHadFocus.current && !hasContent) textAreaRef.current?.focus();
6719
7289
  wasStreaming.current = isStreaming;
6720
7290
  actionHadFocus.current = false;
6721
7291
  }, [isStreaming, hasContent]);
6722
- (0, import_react58.useLayoutEffect)(() => {
7292
+ (0, import_react63.useLayoutEffect)(() => {
6723
7293
  const pending = pendingFocus.current;
6724
7294
  if (!pending) return;
6725
7295
  pendingFocus.current = null;
@@ -6728,10 +7298,10 @@ var PromptInput = /* @__PURE__ */ (0, import_react58.forwardRef)(function Prompt
6728
7298
  const next = buttons?.length ? buttons[Math.min(pending.index, buttons.length - 1)] : void 0;
6729
7299
  (next ?? textAreaRef.current)?.focus();
6730
7300
  }, [attachments]);
6731
- (0, import_react58.useEffect)(() => {
7301
+ (0, import_react63.useEffect)(() => {
6732
7302
  if (!showCounter || document.activeElement !== textAreaRef.current) return;
6733
7303
  const timer = window.setTimeout(() => {
6734
- setAnnouncement(`${number(remaining)} ${remaining === 1 ? "character" : "characters"} left`);
7304
+ setAnnouncement(`${number2(remaining)} ${remaining === 1 ? "character" : "characters"} left`);
6735
7305
  }, announceDelay);
6736
7306
  return () => window.clearTimeout(timer);
6737
7307
  }, [showCounter, remaining, locale]);
@@ -6786,7 +7356,7 @@ var PromptInput = /* @__PURE__ */ (0, import_react58.forwardRef)(function Prompt
6786
7356
  event.preventDefault();
6787
7357
  textAreaRef.current?.focus();
6788
7358
  }
6789
- const attachButton = onAttach ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Tooltip, { label: "Attach files", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
7359
+ const attachButton = onAttach ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Tooltip, { label: "Attach files", children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
6790
7360
  Button,
6791
7361
  {
6792
7362
  className: "ow-prompt-input__attach",
@@ -6796,11 +7366,11 @@ var PromptInput = /* @__PURE__ */ (0, import_react58.forwardRef)(function Prompt
6796
7366
  "aria-label": multiple ? "Attach files" : "Attach a file",
6797
7367
  disabled,
6798
7368
  onClick: () => pickerRef.current?.click(),
6799
- children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(PaperclipIcon, {})
7369
+ children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(PaperclipIcon, {})
6800
7370
  }
6801
7371
  ) }) : null;
6802
7372
  const actionLabel = isStreaming ? "Stop" : "Send";
6803
- const actionButton = /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Tooltip, { label: actionLabel, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
7373
+ const actionButton = /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Tooltip, { label: actionLabel, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
6804
7374
  Button,
6805
7375
  {
6806
7376
  ref: actionRef,
@@ -6815,10 +7385,10 @@ var PromptInput = /* @__PURE__ */ (0, import_react58.forwardRef)(function Prompt
6815
7385
  else submit();
6816
7386
  textAreaRef.current?.focus();
6817
7387
  },
6818
- children: isStreaming ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(StopIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ArrowUpIcon, { size: 16 })
7388
+ children: isStreaming ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(StopIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ArrowUpIcon, { size: 16 })
6819
7389
  }
6820
7390
  ) });
6821
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
7391
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
6822
7392
  "div",
6823
7393
  {
6824
7394
  className: cx(
@@ -6832,7 +7402,7 @@ var PromptInput = /* @__PURE__ */ (0, import_react58.forwardRef)(function Prompt
6832
7402
  ),
6833
7403
  style: { "--ow-prompt-min-rows": rows, "--ow-prompt-max-rows": maxRowCount },
6834
7404
  children: [
6835
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
7405
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
6836
7406
  "fieldset",
6837
7407
  {
6838
7408
  role: "presentation",
@@ -6862,12 +7432,12 @@ var PromptInput = /* @__PURE__ */ (0, import_react58.forwardRef)(function Prompt
6862
7432
  take(Array.from(event.dataTransfer.files));
6863
7433
  },
6864
7434
  children: [
6865
- attachments.length ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("ul", { ref: listRef, className: "ow-prompt-input__attachments", "aria-label": "Attachments", children: attachments.map((attachment, index) => {
7435
+ attachments.length ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("ul", { ref: listRef, className: "ow-prompt-input__attachments", "aria-label": "Attachments", children: attachments.map((attachment, index) => {
6866
7436
  const [base, extension] = splitName(attachment.name);
6867
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("li", { className: "ow-prompt-input__attachment", children: [
6868
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("span", { className: "ow-prompt-input__thumb", "aria-hidden": "true", children: [
7437
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("li", { className: "ow-prompt-input__attachment", children: [
7438
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { className: "ow-prompt-input__thumb", "aria-hidden": "true", children: [
6869
7439
  fileIcons[kindOf(attachment)],
6870
- attachment.previewUrl ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
7440
+ attachment.previewUrl ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
6871
7441
  "img",
6872
7442
  {
6873
7443
  src: attachment.previewUrl,
@@ -6878,26 +7448,26 @@ var PromptInput = /* @__PURE__ */ (0, import_react58.forwardRef)(function Prompt
6878
7448
  }
6879
7449
  ) : null
6880
7450
  ] }),
6881
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("span", { className: "ow-prompt-input__file", children: [
6882
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("span", { className: "ow-prompt-input__file-name", title: attachment.name, children: [
6883
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "ow-prompt-input__file-base", children: base }),
7451
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { className: "ow-prompt-input__file", children: [
7452
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { className: "ow-prompt-input__file-name", title: attachment.name, children: [
7453
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ow-prompt-input__file-base", children: base }),
6884
7454
  extension
6885
7455
  ] }),
6886
- attachment.size !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "ow-prompt-input__file-size", children: formatBytes(attachment.size, locale) }) : null
7456
+ attachment.size !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ow-prompt-input__file-size", children: formatBytes(attachment.size, locale) }) : null
6887
7457
  ] }),
6888
- onRemoveAttachment ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
7458
+ onRemoveAttachment ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
6889
7459
  "button",
6890
7460
  {
6891
7461
  type: "button",
6892
7462
  className: "ow-prompt-input__remove",
6893
7463
  "aria-label": `Remove ${attachment.name}`,
6894
7464
  onClick: () => remove(attachment, index),
6895
- children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(XIcon, { size: 14 })
7465
+ children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(XIcon, { size: 14 })
6896
7466
  }
6897
7467
  ) : null
6898
7468
  ] }, attachment.id);
6899
7469
  }) }) : null,
6900
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
7470
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
6901
7471
  Textarea,
6902
7472
  {
6903
7473
  ref: setTextAreaRef,
@@ -6928,22 +7498,22 @@ var PromptInput = /* @__PURE__ */ (0, import_react58.forwardRef)(function Prompt
6928
7498
  }
6929
7499
  }
6930
7500
  ),
6931
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "ow-prompt-input__toolbar", "data-prompt-blank": "", children: [
6932
- toolbarStart ? /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "ow-prompt-input__start", "data-prompt-blank": "", children: [
7501
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "ow-prompt-input__toolbar", "data-prompt-blank": "", children: [
7502
+ toolbarStart ? /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "ow-prompt-input__start", "data-prompt-blank": "", children: [
6933
7503
  attachButton,
6934
7504
  startActions
6935
7505
  ] }) : null,
6936
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "ow-prompt-input__end", "data-prompt-blank": "", children: [
6937
- showCounter ? /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("span", { className: cx("ow-prompt-input__counter", remaining === 0 && "ow-prompt-input__counter--full"), "aria-hidden": "true", children: [
6938
- number(text.length),
7506
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "ow-prompt-input__end", "data-prompt-blank": "", children: [
7507
+ showCounter ? /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { className: cx("ow-prompt-input__counter", remaining === 0 && "ow-prompt-input__counter--full"), "aria-hidden": "true", children: [
7508
+ number2(text.length),
6939
7509
  " / ",
6940
- number(maxLength)
7510
+ number2(maxLength)
6941
7511
  ] }) : null,
6942
7512
  endActions,
6943
7513
  actionButton
6944
7514
  ] })
6945
7515
  ] }),
6946
- onAttach ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
7516
+ onAttach ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
6947
7517
  "input",
6948
7518
  {
6949
7519
  ref: pickerRef,
@@ -6959,14 +7529,14 @@ var PromptInput = /* @__PURE__ */ (0, import_react58.forwardRef)(function Prompt
6959
7529
  }
6960
7530
  }
6961
7531
  ) : null,
6962
- isDragging ? /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "ow-prompt-input__drop", "aria-hidden": "true", children: [
6963
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(UploadIcon, { size: 16 }),
7532
+ isDragging ? /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "ow-prompt-input__drop", "aria-hidden": "true", children: [
7533
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(UploadIcon, { size: 16 }),
6964
7534
  "Drop to attach"
6965
7535
  ] }) : null
6966
7536
  ]
6967
7537
  }
6968
7538
  ),
6969
- shownHint ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
7539
+ shownHint ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
6970
7540
  "div",
6971
7541
  {
6972
7542
  className: cx("ow-prompt-input__hint", notice && "ow-prompt-input__hint--notice"),
@@ -6975,26 +7545,26 @@ var PromptInput = /* @__PURE__ */ (0, import_react58.forwardRef)(function Prompt
6975
7545
  children: shownHint
6976
7546
  }
6977
7547
  ) : null,
6978
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "ow-visually-hidden", role: "status", children: announcement })
7548
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ow-visually-hidden", role: "status", children: announcement })
6979
7549
  ]
6980
7550
  }
6981
7551
  );
6982
7552
  });
6983
7553
 
6984
7554
  // src/components/PromptInput/PromptSuggestion.tsx
6985
- var import_react59 = require("react");
6986
- var import_jsx_runtime67 = require("react/jsx-runtime");
6987
- var PromptSuggestion = /* @__PURE__ */ (0, import_react59.forwardRef)(function PromptSuggestion2({ children, icon: icon2, description, variant = description ? "card" : "pill", type = "button", className, ...buttonProps }, ref) {
7555
+ var import_react64 = require("react");
7556
+ var import_jsx_runtime74 = require("react/jsx-runtime");
7557
+ var PromptSuggestion = /* @__PURE__ */ (0, import_react64.forwardRef)(function PromptSuggestion2({ children, icon: icon2, description, variant = description ? "card" : "pill", type = "button", className, ...buttonProps }, ref) {
6988
7558
  if (variant === "card") {
6989
- return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("button", { ref, type, className: cx("ow-prompt-suggestion", "ow-prompt-suggestion--card", className), ...buttonProps, children: [
6990
- icon2 ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "ow-prompt-suggestion__icon", children: icon2 }) : null,
6991
- /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("span", { className: "ow-prompt-suggestion__text", children: [
6992
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "ow-prompt-suggestion__title", children }),
6993
- description ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "ow-prompt-suggestion__description", children: description }) : null
7559
+ return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("button", { ref, type, className: cx("ow-prompt-suggestion", "ow-prompt-suggestion--card", className), ...buttonProps, children: [
7560
+ icon2 ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "ow-prompt-suggestion__icon", children: icon2 }) : null,
7561
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("span", { className: "ow-prompt-suggestion__text", children: [
7562
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "ow-prompt-suggestion__title", children }),
7563
+ description ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "ow-prompt-suggestion__description", children: description }) : null
6994
7564
  ] })
6995
7565
  ] });
6996
7566
  }
6997
- return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
7567
+ return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
6998
7568
  "button",
6999
7569
  {
7000
7570
  ref,
@@ -7007,8 +7577,8 @@ var PromptSuggestion = /* @__PURE__ */ (0, import_react59.forwardRef)(function P
7007
7577
  ),
7008
7578
  ...buttonProps,
7009
7579
  children: [
7010
- icon2 ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "ow-prompt-suggestion__icon", children: icon2 }) : null,
7011
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "ow-prompt-suggestion__label", children })
7580
+ icon2 ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "ow-prompt-suggestion__icon", children: icon2 }) : null,
7581
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "ow-prompt-suggestion__label", children })
7012
7582
  ]
7013
7583
  }
7014
7584
  );
@@ -7023,7 +7593,7 @@ function PromptSuggestions({
7023
7593
  style,
7024
7594
  ...props
7025
7595
  }) {
7026
- return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
7596
+ return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
7027
7597
  "div",
7028
7598
  {
7029
7599
  role: "group",
@@ -7037,13 +7607,13 @@ function PromptSuggestions({
7037
7607
  }
7038
7608
 
7039
7609
  // src/components/Chat/ChatConversation.tsx
7040
- var import_react60 = require("react");
7041
- var import_jsx_runtime68 = require("react/jsx-runtime");
7042
- var ChatConversationContext = /* @__PURE__ */ (0, import_react60.createContext)(null);
7610
+ var import_react65 = require("react");
7611
+ var import_jsx_runtime75 = require("react/jsx-runtime");
7612
+ var ChatConversationContext = /* @__PURE__ */ (0, import_react65.createContext)(null);
7043
7613
  var stickyDistance = 32;
7044
7614
  var defaultCount = (count) => `${count} new`;
7045
7615
  var prefersReducedMotion = () => typeof window !== "undefined" && Boolean(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches);
7046
- var ChatConversation = /* @__PURE__ */ (0, import_react60.forwardRef)(function ChatConversation2({
7616
+ var ChatConversation = /* @__PURE__ */ (0, import_react65.forwardRef)(function ChatConversation2({
7047
7617
  children,
7048
7618
  empty,
7049
7619
  footer,
@@ -7055,17 +7625,17 @@ var ChatConversation = /* @__PURE__ */ (0, import_react60.forwardRef)(function C
7055
7625
  className,
7056
7626
  ...props
7057
7627
  }, ref) {
7058
- const scrollerRef = (0, import_react60.useRef)(null);
7059
- const contentRef = (0, import_react60.useRef)(null);
7060
- const jumpRef = (0, import_react60.useRef)(null);
7061
- const following = (0, import_react60.useRef)(true);
7062
- const lastTop = (0, import_react60.useRef)(0);
7063
- const ready = (0, import_react60.useRef)(false);
7064
- const unseen = (0, import_react60.useRef)(/* @__PURE__ */ new Set());
7065
- const [isFollowing, setIsFollowing] = (0, import_react60.useState)(true);
7066
- const [newCount, setNewCount] = (0, import_react60.useState)(0);
7067
- const isEmpty = import_react60.Children.toArray(children).length === 0;
7068
- const follow = (0, import_react60.useCallback)((next) => {
7628
+ const scrollerRef = (0, import_react65.useRef)(null);
7629
+ const contentRef = (0, import_react65.useRef)(null);
7630
+ const jumpRef = (0, import_react65.useRef)(null);
7631
+ const following = (0, import_react65.useRef)(true);
7632
+ const lastTop = (0, import_react65.useRef)(0);
7633
+ const ready = (0, import_react65.useRef)(false);
7634
+ const unseen = (0, import_react65.useRef)(/* @__PURE__ */ new Set());
7635
+ const [isFollowing, setIsFollowing] = (0, import_react65.useState)(true);
7636
+ const [newCount, setNewCount] = (0, import_react65.useState)(0);
7637
+ const isEmpty = import_react65.Children.toArray(children).length === 0;
7638
+ const follow = (0, import_react65.useCallback)((next) => {
7069
7639
  following.current = next;
7070
7640
  setIsFollowing(next);
7071
7641
  if (next && unseen.current.size > 0) {
@@ -7073,13 +7643,13 @@ var ChatConversation = /* @__PURE__ */ (0, import_react60.forwardRef)(function C
7073
7643
  setNewCount(0);
7074
7644
  }
7075
7645
  }, []);
7076
- const stick = (0, import_react60.useCallback)(() => {
7646
+ const stick = (0, import_react65.useCallback)(() => {
7077
7647
  const scroller = scrollerRef.current;
7078
7648
  if (!scroller) return;
7079
7649
  scroller.scrollTop = scroller.scrollHeight;
7080
7650
  lastTop.current = scroller.scrollTop;
7081
7651
  }, []);
7082
- const scrollToBottom = (0, import_react60.useCallback)(
7652
+ const scrollToBottom = (0, import_react65.useCallback)(
7083
7653
  (options) => {
7084
7654
  const scroller = scrollerRef.current;
7085
7655
  if (!scroller) return;
@@ -7088,12 +7658,12 @@ var ChatConversation = /* @__PURE__ */ (0, import_react60.forwardRef)(function C
7088
7658
  },
7089
7659
  [follow]
7090
7660
  );
7091
- (0, import_react60.useImperativeHandle)(ref, () => ({ scrollToBottom }), [scrollToBottom]);
7092
- (0, import_react60.useLayoutEffect)(stick, [stick]);
7093
- (0, import_react60.useEffect)(() => {
7661
+ (0, import_react65.useImperativeHandle)(ref, () => ({ scrollToBottom }), [scrollToBottom]);
7662
+ (0, import_react65.useLayoutEffect)(stick, [stick]);
7663
+ (0, import_react65.useEffect)(() => {
7094
7664
  ready.current = true;
7095
7665
  }, []);
7096
- (0, import_react60.useEffect)(() => {
7666
+ (0, import_react65.useEffect)(() => {
7097
7667
  const scroller = scrollerRef.current;
7098
7668
  const content = contentRef.current;
7099
7669
  if (!scroller || !content || typeof ResizeObserver === "undefined") return void 0;
@@ -7116,7 +7686,7 @@ var ChatConversation = /* @__PURE__ */ (0, import_react60.forwardRef)(function C
7116
7686
  }
7117
7687
  lastTop.current = top;
7118
7688
  }
7119
- const context = (0, import_react60.useMemo)(
7689
+ const context = (0, import_react65.useMemo)(
7120
7690
  () => ({
7121
7691
  ready,
7122
7692
  register(id) {
@@ -7133,9 +7703,9 @@ var ChatConversation = /* @__PURE__ */ (0, import_react60.forwardRef)(function C
7133
7703
  );
7134
7704
  const showJump = !isFollowing && !isEmpty;
7135
7705
  const jump = usePresence(showJump);
7136
- return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: cx("ow-chat-conversation", width === "full" && "ow-chat-conversation--full", className), ...props, children: [
7137
- /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "ow-chat-conversation__viewport", children: [
7138
- /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
7706
+ return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: cx("ow-chat-conversation", width === "full" && "ow-chat-conversation--full", className), ...props, children: [
7707
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "ow-chat-conversation__viewport", children: [
7708
+ /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
7139
7709
  "div",
7140
7710
  {
7141
7711
  ref: scrollerRef,
@@ -7147,17 +7717,17 @@ var ChatConversation = /* @__PURE__ */ (0, import_react60.forwardRef)(function C
7147
7717
  "aria-labelledby": ariaLabelledBy,
7148
7718
  tabIndex: isEmpty ? void 0 : 0,
7149
7719
  onScroll,
7150
- children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { ref: contentRef, className: "ow-chat-conversation__content", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ChatConversationContext.Provider, { value: context, children }) })
7720
+ children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { ref: contentRef, className: "ow-chat-conversation__content", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(ChatConversationContext.Provider, { value: context, children }) })
7151
7721
  }
7152
7722
  ),
7153
- isEmpty && empty ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "ow-chat-conversation__empty", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "ow-chat-conversation__empty-inner", children: empty }) }) : null,
7154
- jump.mounted ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "ow-chat-conversation__jump", "data-state": jump.state, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
7723
+ isEmpty && empty ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "ow-chat-conversation__empty", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "ow-chat-conversation__empty-inner", children: empty }) }) : null,
7724
+ jump.mounted ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "ow-chat-conversation__jump", "data-state": jump.state, children: /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
7155
7725
  Button,
7156
7726
  {
7157
7727
  ref: jumpRef,
7158
7728
  size: "sm",
7159
7729
  shape: "pill",
7160
- startIcon: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ArrowDownIcon, { size: 16 }),
7730
+ startIcon: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(ArrowDownIcon, { size: 16 }),
7161
7731
  "aria-label": newCount > 0 ? `${jumpLabel}, ${formatNewCount(newCount)}` : jumpLabel,
7162
7732
  tabIndex: showJump ? void 0 : -1,
7163
7733
  onClick: () => {
@@ -7166,21 +7736,21 @@ var ChatConversation = /* @__PURE__ */ (0, import_react60.forwardRef)(function C
7166
7736
  },
7167
7737
  children: [
7168
7738
  jumpLabel,
7169
- newCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "ow-chat-conversation__count", children: formatNewCount(newCount) }) : null
7739
+ newCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "ow-chat-conversation__count", children: formatNewCount(newCount) }) : null
7170
7740
  ]
7171
7741
  }
7172
7742
  ) }) : null
7173
7743
  ] }),
7174
- footer != null && footer !== false ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "ow-chat-conversation__footer", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "ow-chat-conversation__footer-inner", children: footer }) }) : null
7744
+ footer != null && footer !== false ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "ow-chat-conversation__footer", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "ow-chat-conversation__footer-inner", children: footer }) }) : null
7175
7745
  ] });
7176
7746
  });
7177
7747
 
7178
7748
  // src/components/Chat/ChatMessage.tsx
7179
- var import_react61 = require("react");
7180
- var import_jsx_runtime69 = require("react/jsx-runtime");
7749
+ var import_react66 = require("react");
7750
+ var import_jsx_runtime76 = require("react/jsx-runtime");
7181
7751
  function lucide(paths) {
7182
7752
  return function Icon({ size: size2 = 16, strokeWidth = 2, ...props }) {
7183
- return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
7753
+ return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
7184
7754
  "svg",
7185
7755
  {
7186
7756
  xmlns: "http://www.w3.org/2000/svg",
@@ -7201,55 +7771,55 @@ function lucide(paths) {
7201
7771
  };
7202
7772
  }
7203
7773
  var BotIcon = /* @__PURE__ */ lucide(
7204
- /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
7205
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("path", { d: "M12 8V4H8" }),
7206
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("rect", { width: "16", height: "12", x: "4", y: "8", rx: "2" }),
7207
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("path", { d: "M2 14h2" }),
7208
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("path", { d: "M20 14h2" }),
7209
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("path", { d: "M15 13v2" }),
7210
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("path", { d: "M9 13v2" })
7774
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_jsx_runtime76.Fragment, { children: [
7775
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("path", { d: "M12 8V4H8" }),
7776
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("rect", { width: "16", height: "12", x: "4", y: "8", rx: "2" }),
7777
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("path", { d: "M2 14h2" }),
7778
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("path", { d: "M20 14h2" }),
7779
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("path", { d: "M15 13v2" }),
7780
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("path", { d: "M9 13v2" })
7211
7781
  ] })
7212
7782
  );
7213
7783
  var RotateCcwIcon = /* @__PURE__ */ lucide(
7214
- /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
7215
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }),
7216
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("path", { d: "M3 3v5h5" })
7784
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_jsx_runtime76.Fragment, { children: [
7785
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }),
7786
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("path", { d: "M3 3v5h5" })
7217
7787
  ] })
7218
7788
  );
7219
7789
  var ThumbsUpIcon = /* @__PURE__ */ lucide(
7220
- /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
7221
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("path", { d: "M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z" }),
7222
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("path", { d: "M7 10v12" })
7790
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_jsx_runtime76.Fragment, { children: [
7791
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("path", { d: "M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z" }),
7792
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("path", { d: "M7 10v12" })
7223
7793
  ] })
7224
7794
  );
7225
7795
  var ThumbsDownIcon = /* @__PURE__ */ lucide(
7226
- /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
7227
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("path", { d: "M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z" }),
7228
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("path", { d: "M17 14V2" })
7796
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_jsx_runtime76.Fragment, { children: [
7797
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("path", { d: "M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z" }),
7798
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("path", { d: "M17 14V2" })
7229
7799
  ] })
7230
7800
  );
7231
7801
  var PencilIcon = /* @__PURE__ */ lucide(
7232
- /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
7233
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("path", { d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" }),
7234
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("path", { d: "m15 5 4 4" })
7802
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_jsx_runtime76.Fragment, { children: [
7803
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("path", { d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" }),
7804
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("path", { d: "m15 5 4 4" })
7235
7805
  ] })
7236
7806
  );
7237
7807
  var botSizes = { sm: 14, md: 16, lg: 18 };
7238
7808
  function ChatAgentAvatar({ size: size2 = "md", label, className }) {
7239
- return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
7809
+ return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
7240
7810
  "span",
7241
7811
  {
7242
7812
  className: cx("ow-chat-avatar", size2 !== "md" && `ow-chat-avatar--${size2}`, className),
7243
7813
  role: label ? "img" : void 0,
7244
7814
  "aria-label": label,
7245
7815
  "aria-hidden": label ? void 0 : true,
7246
- children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(BotIcon, { size: botSizes[size2] })
7816
+ children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(BotIcon, { size: botSizes[size2] })
7247
7817
  }
7248
7818
  );
7249
7819
  }
7250
7820
  function useChatEntrance() {
7251
- const conversation = (0, import_react61.useContext)(ChatConversationContext);
7252
- const [entering] = (0, import_react61.useState)(() => conversation?.ready.current ?? false);
7821
+ const conversation = (0, import_react66.useContext)(ChatConversationContext);
7822
+ const [entering] = (0, import_react66.useState)(() => conversation?.ready.current ?? false);
7253
7823
  return entering;
7254
7824
  }
7255
7825
  var formatters = /* @__PURE__ */ new Map();
@@ -7268,14 +7838,14 @@ function formattersFor(locale) {
7268
7838
  function MessageTime({ time, locale }) {
7269
7839
  const date = typeof time === "string" ? new Date(time) : time;
7270
7840
  if (Number.isNaN(date.getTime())) {
7271
- return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("time", { className: "ow-chat-message__time", children: String(time) });
7841
+ return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("time", { className: "ow-chat-message__time", children: String(time) });
7272
7842
  }
7273
7843
  const { short, full } = formattersFor(locale);
7274
- return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("time", { className: "ow-chat-message__time", dateTime: date.toISOString(), title: full.format(date), children: short.format(date) });
7844
+ return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("time", { className: "ow-chat-message__time", dateTime: date.toISOString(), title: full.format(date), children: short.format(date) });
7275
7845
  }
7276
7846
  var skipCaret = '[aria-hidden="true"], .ow-visually-hidden';
7277
7847
  function useStreamingCaret(bodyRef, contentRef, caretRef, active) {
7278
- (0, import_react61.useLayoutEffect)(() => {
7848
+ (0, import_react66.useLayoutEffect)(() => {
7279
7849
  const body = bodyRef.current;
7280
7850
  const content = contentRef.current;
7281
7851
  const caret = caretRef.current;
@@ -7320,38 +7890,38 @@ function useStreamingCaret(bodyRef, contentRef, caretRef, active) {
7320
7890
  };
7321
7891
  }, [active, bodyRef, contentRef, caretRef]);
7322
7892
  }
7323
- var ChatMessage = /* @__PURE__ */ (0, import_react61.forwardRef)(function ChatMessage2({ from, children, name, avatar, time, locale, status = "done", error, onRetry, retryLabel = "Retry", actions, showActions = "hover", className, ...props }, ref) {
7324
- const conversation = (0, import_react61.useContext)(ChatConversationContext);
7893
+ var ChatMessage = /* @__PURE__ */ (0, import_react66.forwardRef)(function ChatMessage2({ from, children, name, avatar, time, locale, status = "done", error, onRetry, retryLabel = "Retry", actions, showActions = "hover", className, ...props }, ref) {
7894
+ const conversation = (0, import_react66.useContext)(ChatConversationContext);
7325
7895
  const entering = useChatEntrance();
7326
- const id = (0, import_react61.useId)();
7327
- const bodyRef = (0, import_react61.useRef)(null);
7328
- const contentRef = (0, import_react61.useRef)(null);
7329
- const caretRef = (0, import_react61.useRef)(null);
7896
+ const id = (0, import_react66.useId)();
7897
+ const bodyRef = (0, import_react66.useRef)(null);
7898
+ const contentRef = (0, import_react66.useRef)(null);
7899
+ const caretRef = (0, import_react66.useRef)(null);
7330
7900
  const streaming = status === "streaming";
7331
- (0, import_react61.useEffect)(() => conversation?.register(id), [conversation, id]);
7901
+ (0, import_react66.useEffect)(() => conversation?.register(id), [conversation, id]);
7332
7902
  useStreamingCaret(bodyRef, contentRef, caretRef, streaming && from !== "system");
7333
7903
  if (from === "system") {
7334
- return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
7904
+ return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
7335
7905
  "div",
7336
7906
  {
7337
7907
  ref,
7338
7908
  className: cx("ow-chat-message", "ow-chat-message--system", entering && "ow-chat-message--enter", className),
7339
7909
  ...props,
7340
- children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("span", { className: "ow-chat-message__system-text", children: [
7910
+ children: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("span", { className: "ow-chat-message__system-text", children: [
7341
7911
  children,
7342
- time !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
7343
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { "aria-hidden": "true", children: " \xB7 " }),
7344
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(MessageTime, { time, locale })
7912
+ time !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_jsx_runtime76.Fragment, { children: [
7913
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { "aria-hidden": "true", children: " \xB7 " }),
7914
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(MessageTime, { time, locale })
7345
7915
  ] }) : null
7346
7916
  ] })
7347
7917
  }
7348
7918
  );
7349
7919
  }
7350
7920
  const isUser = from === "user";
7351
- const avatarNode = avatar !== void 0 ? avatar : isUser ? null : /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ChatAgentAvatar, {});
7921
+ const avatarNode = avatar !== void 0 ? avatar : isUser ? null : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(ChatAgentAvatar, {});
7352
7922
  const hasHeader = name != null || time !== void 0;
7353
7923
  const errorText = error ?? (isUser ? "Couldn't send this message." : "The answer didn't finish.");
7354
- return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
7924
+ return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
7355
7925
  "article",
7356
7926
  {
7357
7927
  ref,
@@ -7367,22 +7937,22 @@ var ChatMessage = /* @__PURE__ */ (0, import_react61.forwardRef)(function ChatMe
7367
7937
  "aria-busy": streaming || void 0,
7368
7938
  ...props,
7369
7939
  children: [
7370
- avatarNode != null && avatarNode !== false ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "ow-chat-message__avatar", children: avatarNode }) : null,
7371
- /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "ow-chat-message__main", children: [
7372
- hasHeader ? /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "ow-chat-message__header", children: [
7373
- name != null ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "ow-chat-message__name", children: name }) : /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "ow-visually-hidden", children: isUser ? "You" : "Agent" }),
7374
- time !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(MessageTime, { time, locale }) : null
7375
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "ow-visually-hidden", children: isUser ? "You" : "Agent" }),
7376
- /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { ref: bodyRef, className: "ow-chat-message__body", children: [
7377
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { ref: contentRef, className: "ow-chat-message__content", children }),
7378
- streaming ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { ref: caretRef, className: "ow-chat-message__caret", "aria-hidden": "true" }) : null
7940
+ avatarNode != null && avatarNode !== false ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "ow-chat-message__avatar", children: avatarNode }) : null,
7941
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "ow-chat-message__main", children: [
7942
+ hasHeader ? /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "ow-chat-message__header", children: [
7943
+ name != null ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "ow-chat-message__name", children: name }) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "ow-visually-hidden", children: isUser ? "You" : "Agent" }),
7944
+ time !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(MessageTime, { time, locale }) : null
7945
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "ow-visually-hidden", children: isUser ? "You" : "Agent" }),
7946
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { ref: bodyRef, className: "ow-chat-message__body", children: [
7947
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { ref: contentRef, className: "ow-chat-message__content", children }),
7948
+ streaming ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { ref: caretRef, className: "ow-chat-message__caret", "aria-hidden": "true" }) : null
7379
7949
  ] }),
7380
- status === "error" ? /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: cx("ow-chat-message__error", onRetry && "ow-chat-message__error--retry"), children: [
7381
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(CircleAlertIcon, { size: 16, className: "ow-chat-message__error-icon" }),
7382
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "ow-chat-message__error-text", children: errorText }),
7383
- onRetry ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Button, { size: "sm", startIcon: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(RotateCcwIcon, { size: 16 }), onClick: onRetry, children: retryLabel }) : null
7950
+ status === "error" ? /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: cx("ow-chat-message__error", onRetry && "ow-chat-message__error--retry"), children: [
7951
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(CircleAlertIcon, { size: 16, className: "ow-chat-message__error-icon" }),
7952
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "ow-chat-message__error-text", children: errorText }),
7953
+ onRetry ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Button, { size: "sm", startIcon: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(RotateCcwIcon, { size: 16 }), onClick: onRetry, children: retryLabel }) : null
7384
7954
  ] }) : null,
7385
- actions && !streaming ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "ow-chat-message__actions", children: actions }) : null
7955
+ actions && !streaming ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "ow-chat-message__actions", children: actions }) : null
7386
7956
  ] })
7387
7957
  ]
7388
7958
  }
@@ -7390,12 +7960,12 @@ var ChatMessage = /* @__PURE__ */ (0, import_react61.forwardRef)(function ChatMe
7390
7960
  });
7391
7961
  var defaultLabels = { copy: "Copy", copied: "Copied", edit: "Edit", retry: "Retry", good: "Good response", bad: "Bad response" };
7392
7962
  function CopyAction({ text, label, copiedLabel }) {
7393
- const [copied, setCopied] = (0, import_react61.useState)(false);
7394
- const timer = (0, import_react61.useRef)(0);
7395
- (0, import_react61.useEffect)(() => () => window.clearTimeout(timer.current), []);
7963
+ const [copied, setCopied] = (0, import_react66.useState)(false);
7964
+ const timer = (0, import_react66.useRef)(0);
7965
+ (0, import_react66.useEffect)(() => () => window.clearTimeout(timer.current), []);
7396
7966
  const current = copied ? copiedLabel : label;
7397
- return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
7398
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Tooltip, { label: current, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
7967
+ return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_jsx_runtime76.Fragment, { children: [
7968
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Tooltip, { label: current, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
7399
7969
  Button,
7400
7970
  {
7401
7971
  variant: "ghost",
@@ -7410,13 +7980,13 @@ function CopyAction({ text, label, copiedLabel }) {
7410
7980
  timer.current = window.setTimeout(() => setCopied(false), 2e3);
7411
7981
  }
7412
7982
  },
7413
- children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("span", { className: "ow-chat-actions__copy-icon", children: [
7414
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(CopyIcon, { size: 16 }),
7415
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(CheckIcon, { size: 16 })
7983
+ children: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("span", { className: "ow-chat-actions__copy-icon", children: [
7984
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(CopyIcon, { size: 16 }),
7985
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(CheckIcon, { size: 16 })
7416
7986
  ] })
7417
7987
  }
7418
7988
  ) }),
7419
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "ow-visually-hidden", "aria-live": "polite", children: copied ? copiedLabel : "" })
7989
+ /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "ow-visually-hidden", "aria-live": "polite", children: copied ? copiedLabel : "" })
7420
7990
  ] });
7421
7991
  }
7422
7992
  function ChatMessageActions({
@@ -7435,7 +8005,7 @@ function ChatMessageActions({
7435
8005
  const [current, setCurrent] = useControllableState(rating, defaultRating, onRate);
7436
8006
  const rate = (value, label, Icon) => {
7437
8007
  const pressed = current === value;
7438
- return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Tooltip, { label, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
8008
+ return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Tooltip, { label, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
7439
8009
  ToggleButton,
7440
8010
  {
7441
8011
  variant: "ghost",
@@ -7445,15 +8015,15 @@ function ChatMessageActions({
7445
8015
  pressed,
7446
8016
  className: "ow-chat-actions__rate",
7447
8017
  onPressedChange: () => setCurrent(pressed ? null : value),
7448
- children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Icon, { size: 16 })
8018
+ children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Icon, { size: 16 })
7449
8019
  }
7450
8020
  ) });
7451
8021
  };
7452
- return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(Toolbar, { variant: "plain", size: "sm", "aria-label": ariaLabel, className: cx("ow-chat-actions", className), children: [
7453
- text !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(CopyAction, { text, label: words.copy, copiedLabel: words.copied }) : null,
7454
- onEdit ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Tooltip, { label: words.edit, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Button, { variant: "ghost", size: "sm", iconOnly: true, "aria-label": words.edit, onClick: onEdit, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(PencilIcon, { size: 16 }) }) }) : null,
7455
- onRetry ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Tooltip, { label: words.retry, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Button, { variant: "ghost", size: "sm", iconOnly: true, "aria-label": words.retry, onClick: onRetry, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(RotateCcwIcon, { size: 16 }) }) }) : null,
7456
- onRate ? /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
8022
+ return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(Toolbar, { variant: "plain", size: "sm", "aria-label": ariaLabel, className: cx("ow-chat-actions", className), children: [
8023
+ text !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(CopyAction, { text, label: words.copy, copiedLabel: words.copied }) : null,
8024
+ onEdit ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Tooltip, { label: words.edit, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Button, { variant: "ghost", size: "sm", iconOnly: true, "aria-label": words.edit, onClick: onEdit, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(PencilIcon, { size: 16 }) }) }) : null,
8025
+ onRetry ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Tooltip, { label: words.retry, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(Button, { variant: "ghost", size: "sm", iconOnly: true, "aria-label": words.retry, onClick: onRetry, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(RotateCcwIcon, { size: 16 }) }) }) : null,
8026
+ onRate ? /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_jsx_runtime76.Fragment, { children: [
7457
8027
  rate("up", words.good, ThumbsUpIcon),
7458
8028
  rate("down", words.bad, ThumbsDownIcon)
7459
8029
  ] }) : null,
@@ -7462,31 +8032,31 @@ function ChatMessageActions({
7462
8032
  }
7463
8033
 
7464
8034
  // src/components/Chat/ChatLoader.tsx
7465
- var import_jsx_runtime70 = require("react/jsx-runtime");
8035
+ var import_jsx_runtime77 = require("react/jsx-runtime");
7466
8036
  function ChatLoader({ label, inline = false, name, avatar, srLabel = "Working\u2026", className }) {
7467
8037
  const entering = useChatEntrance();
7468
- const indicator = label != null ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(TextShimmer, { className: "ow-chat-loader__label", children: label }) : /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("span", { className: "ow-chat-loader__dots", children: [
7469
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "ow-chat-loader__dot", "aria-hidden": "true" }),
7470
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "ow-chat-loader__dot", "aria-hidden": "true" }),
7471
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "ow-chat-loader__dot", "aria-hidden": "true" }),
7472
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "ow-visually-hidden", children: srLabel })
8038
+ const indicator = label != null ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(TextShimmer, { className: "ow-chat-loader__label", children: label }) : /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("span", { className: "ow-chat-loader__dots", children: [
8039
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "ow-chat-loader__dot", "aria-hidden": "true" }),
8040
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "ow-chat-loader__dot", "aria-hidden": "true" }),
8041
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "ow-chat-loader__dot", "aria-hidden": "true" }),
8042
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "ow-visually-hidden", children: srLabel })
7473
8043
  ] });
7474
8044
  if (inline) {
7475
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { role: "status", className: cx("ow-chat-loader", "ow-chat-loader--inline", className), children: indicator });
8045
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { role: "status", className: cx("ow-chat-loader", "ow-chat-loader--inline", className), children: indicator });
7476
8046
  }
7477
- const avatarNode = avatar === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ChatAgentAvatar, {}) : avatar;
7478
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { role: "status", className: cx("ow-chat-message", "ow-chat-message--assistant", "ow-chat-loader", entering && "ow-chat-loader--enter", className), children: [
7479
- avatarNode != null && avatarNode !== false ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "ow-chat-message__avatar", children: avatarNode }) : null,
7480
- /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "ow-chat-message__main", children: [
7481
- name != null ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "ow-chat-message__header", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "ow-chat-message__name", children: name }) }) : null,
7482
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "ow-chat-loader__line", children: indicator })
8047
+ const avatarNode = avatar === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ChatAgentAvatar, {}) : avatar;
8048
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { role: "status", className: cx("ow-chat-message", "ow-chat-message--assistant", "ow-chat-loader", entering && "ow-chat-loader--enter", className), children: [
8049
+ avatarNode != null && avatarNode !== false ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "ow-chat-message__avatar", children: avatarNode }) : null,
8050
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "ow-chat-message__main", children: [
8051
+ name != null ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "ow-chat-message__header", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "ow-chat-message__name", children: name }) }) : null,
8052
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "ow-chat-loader__line", children: indicator })
7483
8053
  ] })
7484
8054
  ] });
7485
8055
  }
7486
8056
 
7487
8057
  // src/components/ChatTool/ChatTool.tsx
7488
- var import_react62 = require("react");
7489
- var import_jsx_runtime71 = require("react/jsx-runtime");
8058
+ var import_react67 = require("react");
8059
+ var import_jsx_runtime78 = require("react/jsx-runtime");
7490
8060
  var statusWords = {
7491
8061
  pending: "Not started",
7492
8062
  running: "Running",
@@ -7496,7 +8066,7 @@ var statusWords = {
7496
8066
  cancelled: "Cancelled"
7497
8067
  };
7498
8068
  function SlashIcon() {
7499
- return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
8069
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
7500
8070
  "svg",
7501
8071
  {
7502
8072
  width: 12,
@@ -7508,12 +8078,12 @@ function SlashIcon() {
7508
8078
  strokeLinecap: "round",
7509
8079
  "aria-hidden": "true",
7510
8080
  focusable: "false",
7511
- children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("path", { d: "M7 17 17 7" })
8081
+ children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("path", { d: "M7 17 17 7" })
7512
8082
  }
7513
8083
  );
7514
8084
  }
7515
8085
  function ExclamationIcon() {
7516
- return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
8086
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
7517
8087
  "svg",
7518
8088
  {
7519
8089
  width: 12,
@@ -7526,41 +8096,41 @@ function ExclamationIcon() {
7526
8096
  "aria-hidden": "true",
7527
8097
  focusable: "false",
7528
8098
  children: [
7529
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("path", { d: "M12 5v9" }),
7530
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("path", { d: "M12 19h.01" })
8099
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("path", { d: "M12 5v9" }),
8100
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("path", { d: "M12 19h.01" })
7531
8101
  ]
7532
8102
  }
7533
8103
  );
7534
8104
  }
7535
8105
  function ChatStatusMarker({ status, icon: icon2 }) {
7536
8106
  const showsIcon = Boolean(icon2) && (status === "success" || status === "pending");
7537
- const glyph = status === "running" ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Spinner, { size: "sm", label: "" }) : status === "error" ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(XIcon, { size: 12, strokeWidth: 3 }) : status === "approval" ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ExclamationIcon, {}) : status === "cancelled" ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(SlashIcon, {}) : showsIcon ? icon2 : status === "success" ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(CheckIcon, { size: 12, strokeWidth: 3 }) : null;
7538
- return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("span", { className: cx("ow-chat-status", `ow-chat-status--${status}`, showsIcon && "ow-chat-status--icon"), children: [
7539
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "ow-chat-status__glyph", "aria-hidden": "true", children: glyph }),
7540
- /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("span", { className: "ow-visually-hidden", children: [
8107
+ const glyph = status === "running" ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Spinner, { size: "sm", label: "" }) : status === "error" ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(XIcon, { size: 12, strokeWidth: 3 }) : status === "approval" ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(ExclamationIcon, {}) : status === "cancelled" ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(SlashIcon, {}) : showsIcon ? icon2 : status === "success" ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(CheckIcon, { size: 12, strokeWidth: 3 }) : null;
8108
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("span", { className: cx("ow-chat-status", `ow-chat-status--${status}`, showsIcon && "ow-chat-status--icon"), children: [
8109
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "ow-chat-status__glyph", "aria-hidden": "true", children: glyph }),
8110
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("span", { className: "ow-visually-hidden", children: [
7541
8111
  statusWords[status],
7542
8112
  ": "
7543
8113
  ] })
7544
8114
  ] });
7545
8115
  }
7546
8116
  function formatDuration(ms, locale) {
7547
- const number = (value, digits = 0) => new Intl.NumberFormat(locale, { maximumFractionDigits: digits }).format(value);
8117
+ const number2 = (value, digits = 0) => new Intl.NumberFormat(locale, { maximumFractionDigits: digits }).format(value);
7548
8118
  const safe = Math.max(0, ms);
7549
- if (safe < 1e3) return `${number(Math.round(safe))} ms`;
8119
+ if (safe < 1e3) return `${number2(Math.round(safe))} ms`;
7550
8120
  const seconds = safe / 1e3;
7551
- if (seconds < 10) return `${number(Math.floor(seconds * 10) / 10, 1)} s`;
7552
- if (seconds < 60) return `${number(Math.floor(seconds))} s`;
8121
+ if (seconds < 10) return `${number2(Math.floor(seconds * 10) / 10, 1)} s`;
8122
+ if (seconds < 60) return `${number2(Math.floor(seconds))} s`;
7553
8123
  const minutes = Math.floor(seconds / 60);
7554
8124
  if (minutes < 60) {
7555
8125
  const rest2 = Math.floor(seconds % 60);
7556
- return rest2 ? `${number(minutes)} min ${number(rest2)} s` : `${number(minutes)} min`;
8126
+ return rest2 ? `${number2(minutes)} min ${number2(rest2)} s` : `${number2(minutes)} min`;
7557
8127
  }
7558
8128
  const hours = Math.floor(minutes / 60);
7559
8129
  const rest = minutes % 60;
7560
- return rest ? `${number(hours)} h ${number(rest)} min` : `${number(hours)} h`;
8130
+ return rest ? `${number2(hours)} h ${number2(rest)} min` : `${number2(hours)} h`;
7561
8131
  }
7562
8132
  function ChatDuration({ ms, locale, className }) {
7563
- return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("time", { dateTime: `PT${Math.max(0, Math.round(ms)) / 1e3}S`, className, children: formatDuration(ms, locale) });
8133
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("time", { dateTime: `PT${Math.max(0, Math.round(ms)) / 1e3}S`, className, children: formatDuration(ms, locale) });
7564
8134
  }
7565
8135
  function useStatusExpansion({
7566
8136
  expanded,
@@ -7571,9 +8141,9 @@ function useStatusExpansion({
7571
8141
  initial = wantsOpen
7572
8142
  }) {
7573
8143
  const [isOpen, setOpen] = useControllableState(expanded, defaultExpanded ?? initial, onExpandedChange);
7574
- const touched = (0, import_react62.useRef)(false);
7575
- const previous = (0, import_react62.useRef)(wantsOpen);
7576
- (0, import_react62.useEffect)(() => {
8144
+ const touched = (0, import_react67.useRef)(false);
8145
+ const previous = (0, import_react67.useRef)(wantsOpen);
8146
+ (0, import_react67.useEffect)(() => {
7577
8147
  if (previous.current === wantsOpen) return;
7578
8148
  previous.current = wantsOpen;
7579
8149
  if (expanded !== void 0) return;
@@ -7599,11 +8169,11 @@ function ChatCollapse({
7599
8169
  className,
7600
8170
  children
7601
8171
  }) {
7602
- const ref = (0, import_react62.useRef)(null);
7603
- (0, import_react62.useEffect)(() => {
8172
+ const ref = (0, import_react67.useRef)(null);
8173
+ (0, import_react67.useEffect)(() => {
7604
8174
  if (ref.current) ref.current.inert = !open;
7605
8175
  }, [open]);
7606
- return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { ref, id, className: cx("ow-chat-collapse", bleed && "ow-chat-collapse--bleed"), "data-open": open, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "ow-chat-collapse__clip", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className, children }) }) });
8176
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { ref, id, className: cx("ow-chat-collapse", bleed && "ow-chat-collapse--bleed"), "data-open": open, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "ow-chat-collapse__clip", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className, children }) }) });
7607
8177
  }
7608
8178
  var codeMaxHeight = 280;
7609
8179
  function formatInput(input) {
@@ -7614,7 +8184,7 @@ function formatInput(input) {
7614
8184
  return String(input);
7615
8185
  }
7616
8186
  }
7617
- var ChatTool = /* @__PURE__ */ (0, import_react62.forwardRef)(function ChatTool2({
8187
+ var ChatTool = /* @__PURE__ */ (0, import_react67.forwardRef)(function ChatTool2({
7618
8188
  title,
7619
8189
  name,
7620
8190
  icon: icon2,
@@ -7636,12 +8206,12 @@ var ChatTool = /* @__PURE__ */ (0, import_react62.forwardRef)(function ChatTool2
7636
8206
  className,
7637
8207
  ...props
7638
8208
  }, ref) {
7639
- const id = (0, import_react62.useId)();
7640
- const rootRef = (0, import_react62.useRef)(null);
7641
- const triggerRef = (0, import_react62.useRef)(null);
7642
- const messageRef = (0, import_react62.useRef)(null);
7643
- const decided = (0, import_react62.useRef)(false);
7644
- const [announcement, setAnnouncement] = (0, import_react62.useState)("");
8209
+ const id = (0, import_react67.useId)();
8210
+ const rootRef = (0, import_react67.useRef)(null);
8211
+ const triggerRef = (0, import_react67.useRef)(null);
8212
+ const messageRef = (0, import_react67.useRef)(null);
8213
+ const decided = (0, import_react67.useRef)(false);
8214
+ const [announcement, setAnnouncement] = (0, import_react67.useState)("");
7645
8215
  const needsApproval = status === "approval";
7646
8216
  const [isOpen, toggle] = useStatusExpansion({
7647
8217
  expanded,
@@ -7654,7 +8224,7 @@ var ChatTool = /* @__PURE__ */ (0, import_react62.forwardRef)(function ChatTool2
7654
8224
  const hasError = error !== void 0 && error !== null && error !== false && error !== "";
7655
8225
  const hasDetails = hasInput || hasOutput || hasError;
7656
8226
  const hasMeta = Boolean(summary) || duration !== void 0;
7657
- (0, import_react62.useEffect)(() => {
8227
+ (0, import_react67.useEffect)(() => {
7658
8228
  if (!needsApproval) {
7659
8229
  setAnnouncement("");
7660
8230
  return;
@@ -7665,30 +8235,30 @@ var ChatTool = /* @__PURE__ */ (0, import_react62.forwardRef)(function ChatTool2
7665
8235
  }, 150);
7666
8236
  return () => window.clearTimeout(timer);
7667
8237
  }, [needsApproval]);
7668
- (0, import_react62.useEffect)(() => {
8238
+ (0, import_react67.useEffect)(() => {
7669
8239
  if (needsApproval || !decided.current) return;
7670
8240
  decided.current = false;
7671
8241
  const active = document.activeElement;
7672
8242
  if (!active || active === document.body) (triggerRef.current ?? rootRef.current)?.focus();
7673
8243
  }, [needsApproval]);
7674
8244
  const running = status === "running";
7675
- const header = /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_jsx_runtime71.Fragment, { children: [
7676
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChatStatusMarker, { status }),
7677
- icon2 ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "ow-chat-tool__icon", "aria-hidden": "true", children: icon2 }) : null,
7678
- /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("span", { className: "ow-chat-tool__main", children: [
7679
- /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("span", { className: "ow-chat-tool__heading", children: [
7680
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "ow-chat-tool__title", children: running ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(TextShimmer, { children: title }) : title }),
7681
- name ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Code, { className: "ow-chat-tool__name", children: name }) : null
8245
+ const header = /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_jsx_runtime78.Fragment, { children: [
8246
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(ChatStatusMarker, { status }),
8247
+ icon2 ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "ow-chat-tool__icon", "aria-hidden": "true", children: icon2 }) : null,
8248
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("span", { className: "ow-chat-tool__main", children: [
8249
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("span", { className: "ow-chat-tool__heading", children: [
8250
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "ow-chat-tool__title", children: running ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(TextShimmer, { children: title }) : title }),
8251
+ name ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Code, { className: "ow-chat-tool__name", children: name }) : null
7682
8252
  ] }),
7683
- hasMeta ? /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("span", { className: "ow-chat-tool__meta", children: [
7684
- summary ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "ow-chat-tool__summary", children: summary }) : null,
7685
- summary && duration !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "ow-chat-tool__dot", "aria-hidden": "true", children: "\xB7" }) : null,
7686
- duration !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChatDuration, { ms: duration, locale, className: "ow-chat-tool__duration" }) : null
8253
+ hasMeta ? /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("span", { className: "ow-chat-tool__meta", children: [
8254
+ summary ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "ow-chat-tool__summary", children: summary }) : null,
8255
+ summary && duration !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "ow-chat-tool__dot", "aria-hidden": "true", children: "\xB7" }) : null,
8256
+ duration !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(ChatDuration, { ms: duration, locale, className: "ow-chat-tool__duration" }) : null
7687
8257
  ] }) : null
7688
8258
  ] }),
7689
- hasDetails ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "ow-chat-tool__chevron", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChevronRightIcon, { size: 14 }) }) : null
8259
+ hasDetails ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "ow-chat-tool__chevron", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(ChevronRightIcon, { size: 14 }) }) : null
7690
8260
  ] });
7691
- return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
8261
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
7692
8262
  "div",
7693
8263
  {
7694
8264
  ref: (element) => {
@@ -7703,7 +8273,7 @@ var ChatTool = /* @__PURE__ */ (0, import_react62.forwardRef)(function ChatTool2
7703
8273
  tabIndex: hasDetails ? void 0 : -1,
7704
8274
  ...props,
7705
8275
  children: [
7706
- hasDetails ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
8276
+ hasDetails ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
7707
8277
  "button",
7708
8278
  {
7709
8279
  ref: triggerRef,
@@ -7715,28 +8285,28 @@ var ChatTool = /* @__PURE__ */ (0, import_react62.forwardRef)(function ChatTool2
7715
8285
  onClick: toggle,
7716
8286
  children: header
7717
8287
  }
7718
- ) : /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "ow-chat-tool__header", children: header }),
7719
- hasDetails ? /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(ChatCollapse, { id: `${id}-details`, open: isOpen, className: "ow-chat-tool__details", children: [
7720
- hasInput ? /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "ow-chat-tool__section", children: [
7721
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "ow-chat-tool__label", children: "Input" }),
7722
- typeof input === "string" && !input.includes("\n") ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Snippet, { value: input, prompt: null }) : /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(CodeBlock, { code: formatInput(input), language: typeof input === "string" ? void 0 : "json", maxHeight: codeMaxHeight })
8288
+ ) : /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "ow-chat-tool__header", children: header }),
8289
+ hasDetails ? /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(ChatCollapse, { id: `${id}-details`, open: isOpen, className: "ow-chat-tool__details", children: [
8290
+ hasInput ? /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "ow-chat-tool__section", children: [
8291
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "ow-chat-tool__label", children: "Input" }),
8292
+ typeof input === "string" && !input.includes("\n") ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Snippet, { value: input, prompt: null }) : /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(CodeBlock, { code: formatInput(input), language: typeof input === "string" ? void 0 : "json", maxHeight: codeMaxHeight })
7723
8293
  ] }) : null,
7724
- hasOutput ? /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "ow-chat-tool__section", children: [
7725
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "ow-chat-tool__label", children: "Output" }),
7726
- typeof output === "string" ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(CodeBlock, { code: output, maxHeight: codeMaxHeight }) : /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "ow-chat-tool__output", children: output })
8294
+ hasOutput ? /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "ow-chat-tool__section", children: [
8295
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "ow-chat-tool__label", children: "Output" }),
8296
+ typeof output === "string" ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(CodeBlock, { code: output, maxHeight: codeMaxHeight }) : /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "ow-chat-tool__output", children: output })
7727
8297
  ] }) : null,
7728
- hasError ? /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "ow-chat-tool__section", children: [
7729
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "ow-chat-tool__label", children: "Error" }),
7730
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "ow-chat-tool__error", children: error })
8298
+ hasError ? /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "ow-chat-tool__section", children: [
8299
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "ow-chat-tool__label", children: "Error" }),
8300
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "ow-chat-tool__error", children: error })
7731
8301
  ] }) : null
7732
8302
  ] }) : null,
7733
- needsApproval ? /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "ow-chat-tool__approval", role: "group", "aria-labelledby": `${id}-request`, children: [
7734
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("p", { ref: messageRef, id: `${id}-request`, className: "ow-chat-tool__request", children: approvalMessage ?? (name ? /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_jsx_runtime71.Fragment, { children: [
8303
+ needsApproval ? /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "ow-chat-tool__approval", role: "group", "aria-labelledby": `${id}-request`, children: [
8304
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("p", { ref: messageRef, id: `${id}-request`, className: "ow-chat-tool__request", children: approvalMessage ?? (name ? /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_jsx_runtime78.Fragment, { children: [
7735
8305
  "Wants to run ",
7736
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Code, { children: name })
8306
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Code, { children: name })
7737
8307
  ] }) : "Wants to go ahead") }),
7738
- /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "ow-chat-tool__actions", children: [
7739
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
8308
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "ow-chat-tool__actions", children: [
8309
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
7740
8310
  Button,
7741
8311
  {
7742
8312
  variant: "primary",
@@ -7748,7 +8318,7 @@ var ChatTool = /* @__PURE__ */ (0, import_react62.forwardRef)(function ChatTool2
7748
8318
  children: approveLabel
7749
8319
  }
7750
8320
  ),
7751
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
8321
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
7752
8322
  Button,
7753
8323
  {
7754
8324
  size: "sm",
@@ -7761,17 +8331,17 @@ var ChatTool = /* @__PURE__ */ (0, import_react62.forwardRef)(function ChatTool2
7761
8331
  )
7762
8332
  ] })
7763
8333
  ] }) : null,
7764
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "ow-visually-hidden", "aria-live": "polite", children: announcement })
8334
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "ow-visually-hidden", "aria-live": "polite", children: announcement })
7765
8335
  ]
7766
8336
  }
7767
8337
  );
7768
8338
  });
7769
8339
 
7770
8340
  // src/components/ChainOfThought/ChainOfThought.tsx
7771
- var import_react63 = require("react");
7772
- var import_jsx_runtime72 = require("react/jsx-runtime");
8341
+ var import_react68 = require("react");
8342
+ var import_jsx_runtime79 = require("react/jsx-runtime");
7773
8343
  var plural = (count, word) => `${count} ${word}${count === 1 ? "" : "s"}`;
7774
- var ChainOfThought = /* @__PURE__ */ (0, import_react63.forwardRef)(function ChainOfThought2({
8344
+ var ChainOfThought = /* @__PURE__ */ (0, import_react68.forwardRef)(function ChainOfThought2({
7775
8345
  steps = [],
7776
8346
  status = "success",
7777
8347
  duration,
@@ -7785,7 +8355,7 @@ var ChainOfThought = /* @__PURE__ */ (0, import_react63.forwardRef)(function Cha
7785
8355
  className,
7786
8356
  ...props
7787
8357
  }, ref) {
7788
- const id = (0, import_react63.useId)();
8358
+ const id = (0, import_react68.useId)();
7789
8359
  const running = status === "running";
7790
8360
  const [isOpen, toggle] = useStatusExpansion({
7791
8361
  expanded,
@@ -7801,30 +8371,30 @@ var ChainOfThought = /* @__PURE__ */ (0, import_react63.forwardRef)(function Cha
7801
8371
  const failed = steps.filter((step) => step.status === "error").length;
7802
8372
  const heading = label ?? (running ? "Thinking\u2026" : duration !== void 0 ? `Thought for ${formatDuration(duration, locale)}` : "Reasoning");
7803
8373
  const count = steps.length > 0 ? running ? `${finished} of ${plural(steps.length, "step")}` : plural(steps.length, "step") : null;
7804
- const headerText = /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "ow-chat-toggle__text", children: [
7805
- /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "ow-chain-of-thought__label", children: running ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(TextShimmer, { children: heading }) : heading }),
7806
- count ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "ow-chat-toggle__meta", children: [
7807
- /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { "aria-hidden": "true", children: "\xB7 " }),
8374
+ const headerText = /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("span", { className: "ow-chat-toggle__text", children: [
8375
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { className: "ow-chain-of-thought__label", children: running ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(TextShimmer, { children: heading }) : heading }),
8376
+ count ? /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("span", { className: "ow-chat-toggle__meta", children: [
8377
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { "aria-hidden": "true", children: "\xB7 " }),
7808
8378
  count,
7809
- failed > 0 ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "ow-chain-of-thought__failed", children: [
8379
+ failed > 0 ? /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("span", { className: "ow-chain-of-thought__failed", children: [
7810
8380
  ", ",
7811
8381
  failed,
7812
8382
  " failed"
7813
8383
  ] }) : null
7814
8384
  ] }) : null
7815
8385
  ] });
7816
- return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { ref, className: cx("ow-chain-of-thought", className), "data-status": status, "aria-busy": running || void 0, ...props, children: [
7817
- hasBody ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("button", { type: "button", className: "ow-chat-toggle", "aria-expanded": isOpen, "aria-controls": `${id}-body`, onClick: toggle, children: [
7818
- /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "ow-chat-toggle__chevron", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ChevronRightIcon, { size: 14 }) }),
8386
+ return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { ref, className: cx("ow-chain-of-thought", className), "data-status": status, "aria-busy": running || void 0, ...props, children: [
8387
+ hasBody ? /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("button", { type: "button", className: "ow-chat-toggle", "aria-expanded": isOpen, "aria-controls": `${id}-body`, onClick: toggle, children: [
8388
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { className: "ow-chat-toggle__chevron", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(ChevronRightIcon, { size: 14 }) }),
7819
8389
  headerText
7820
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "ow-chat-toggle ow-chain-of-thought__static", children: headerText }),
7821
- hasBody ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(ChatCollapse, { id: `${id}-body`, open: isOpen, bleed: true, className: "ow-chain-of-thought__body", children: [
7822
- hasReasoning ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "ow-chain-of-thought__reasoning", children }) : null,
7823
- steps.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("ol", { className: "ow-chain-of-thought__steps", children: steps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("li", { className: "ow-chain-of-thought__step", "data-status": step.status, children: [
7824
- /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ChatStatusMarker, { status: step.status, icon: step.icon }),
7825
- /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "ow-chain-of-thought__step-body", children: [
7826
- /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "ow-chain-of-thought__step-title", children: step.status === "running" ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(TextShimmer, { children: step.title }) : step.title }),
7827
- step.detail !== void 0 && step.detail !== null ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "ow-chain-of-thought__detail", children: step.detail }) : null
8390
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "ow-chat-toggle ow-chain-of-thought__static", children: headerText }),
8391
+ hasBody ? /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(ChatCollapse, { id: `${id}-body`, open: isOpen, bleed: true, className: "ow-chain-of-thought__body", children: [
8392
+ hasReasoning ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "ow-chain-of-thought__reasoning", children }) : null,
8393
+ steps.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("ol", { className: "ow-chain-of-thought__steps", children: steps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("li", { className: "ow-chain-of-thought__step", "data-status": step.status, children: [
8394
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(ChatStatusMarker, { status: step.status, icon: step.icon }),
8395
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "ow-chain-of-thought__step-body", children: [
8396
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { className: "ow-chain-of-thought__step-title", children: step.status === "running" ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(TextShimmer, { children: step.title }) : step.title }),
8397
+ step.detail !== void 0 && step.detail !== null ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "ow-chain-of-thought__detail", children: step.detail }) : null
7828
8398
  ] })
7829
8399
  ] }, step.id)) }) : null
7830
8400
  ] }) : null
@@ -7832,11 +8402,11 @@ var ChainOfThought = /* @__PURE__ */ (0, import_react63.forwardRef)(function Cha
7832
8402
  });
7833
8403
 
7834
8404
  // src/components/ChatSource/ChatSource.tsx
7835
- var import_react64 = require("react");
7836
- var import_jsx_runtime73 = require("react/jsx-runtime");
8405
+ var import_react69 = require("react");
8406
+ var import_jsx_runtime80 = require("react/jsx-runtime");
7837
8407
  var openDelay = 250;
7838
8408
  var closeDelay = 150;
7839
- var ChatSource = /* @__PURE__ */ (0, import_react64.forwardRef)(function ChatSource2({
8409
+ var ChatSource = /* @__PURE__ */ (0, import_react69.forwardRef)(function ChatSource2({
7840
8410
  title,
7841
8411
  source,
7842
8412
  snippet,
@@ -7851,13 +8421,13 @@ var ChatSource = /* @__PURE__ */ (0, import_react64.forwardRef)(function ChatSou
7851
8421
  "aria-label": ariaLabel,
7852
8422
  className
7853
8423
  }, ref) {
7854
- const id = (0, import_react64.useId)();
7855
- const wrapperRef = (0, import_react64.useRef)(null);
7856
- const chipRef = (0, import_react64.useRef)(null);
7857
- const cardRef = (0, import_react64.useRef)(null);
7858
- const timer = (0, import_react64.useRef)(0);
7859
- const pointer = (0, import_react64.useRef)("mouse");
7860
- const [open, setOpen] = (0, import_react64.useState)(false);
8424
+ const id = (0, import_react69.useId)();
8425
+ const wrapperRef = (0, import_react69.useRef)(null);
8426
+ const chipRef = (0, import_react69.useRef)(null);
8427
+ const cardRef = (0, import_react69.useRef)(null);
8428
+ const timer = (0, import_react69.useRef)(0);
8429
+ const pointer = (0, import_react69.useRef)("mouse");
8430
+ const [open, setOpen] = (0, import_react69.useState)(false);
7861
8431
  const { mounted, state } = usePresence(open);
7862
8432
  const style = useFloating({ open: mounted, anchorRef: chipRef, floatingRef: cardRef, placement: "bottom-start", offset: 6, maxHeight: 360 });
7863
8433
  const schedule = (next, delay) => {
@@ -7865,12 +8435,12 @@ var ChatSource = /* @__PURE__ */ (0, import_react64.forwardRef)(function ChatSou
7865
8435
  if (delay === 0) setOpen(next);
7866
8436
  else timer.current = window.setTimeout(() => setOpen(next), delay);
7867
8437
  };
7868
- const close = (0, import_react64.useCallback)(() => {
8438
+ const close = (0, import_react69.useCallback)(() => {
7869
8439
  window.clearTimeout(timer.current);
7870
8440
  setOpen(false);
7871
8441
  }, []);
7872
8442
  useDismiss(open, [wrapperRef], close);
7873
- (0, import_react64.useEffect)(() => () => window.clearTimeout(timer.current), []);
8443
+ (0, import_react69.useEffect)(() => () => window.clearTimeout(timer.current), []);
7874
8444
  const name = ariaLabel ?? (index !== void 0 ? `Source ${index}` : label ?? "Source");
7875
8445
  const describedBy = [`${id}-title`, source ? `${id}-source` : null, snippet ? `${id}-snippet` : null].filter(Boolean).join(" ");
7876
8446
  const externalProps = external ? { target: "_blank", rel: "noopener noreferrer" } : {};
@@ -7902,8 +8472,8 @@ var ChatSource = /* @__PURE__ */ (0, import_react64.forwardRef)(function ChatSou
7902
8472
  onClick?.(event);
7903
8473
  }
7904
8474
  };
7905
- const chipText = /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ow-chat-source__chip-text", children: index ?? label });
7906
- return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
8475
+ const chipText = /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "ow-chat-source__chip-text", children: index ?? label });
8476
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
7907
8477
  "span",
7908
8478
  {
7909
8479
  ref: wrapperRef,
@@ -7915,19 +8485,19 @@ var ChatSource = /* @__PURE__ */ (0, import_react64.forwardRef)(function ChatSou
7915
8485
  if (event.pointerType === "mouse") schedule(false, closeDelay);
7916
8486
  },
7917
8487
  children: [
7918
- href ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("a", { href, ...externalProps, ...chipProps, children: chipText }) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("button", { type: "button", ...chipProps, children: chipText }),
7919
- /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { ref: cardRef, ...manualPopover, hidden: !mounted, "data-state": state, className: "ow-chat-source-card ow-floating", style, children: [
7920
- /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { className: "ow-chat-source-card__header", children: [
7921
- icon2 ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ow-chat-source-card__icon", "aria-hidden": "true", children: icon2 }) : null,
7922
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { id: `${id}-title`, className: "ow-chat-source-card__title", children: title })
8488
+ href ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("a", { href, ...externalProps, ...chipProps, children: chipText }) : /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("button", { type: "button", ...chipProps, children: chipText }),
8489
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { ref: cardRef, ...manualPopover, hidden: !mounted, "data-state": state, className: "ow-chat-source-card ow-floating", style, children: [
8490
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: "ow-chat-source-card__header", children: [
8491
+ icon2 ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "ow-chat-source-card__icon", "aria-hidden": "true", children: icon2 }) : null,
8492
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { id: `${id}-title`, className: "ow-chat-source-card__title", children: title })
7923
8493
  ] }),
7924
- source ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { id: `${id}-source`, className: "ow-chat-source-card__source", children: source }) : null,
7925
- snippet ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { id: `${id}-snippet`, className: cx("ow-chat-source-card__snippet", `ow-chat-source-card__snippet--${snippetFormat}`), children: snippet }) : null,
8494
+ source ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { id: `${id}-source`, className: "ow-chat-source-card__source", children: source }) : null,
8495
+ snippet ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { id: `${id}-snippet`, className: cx("ow-chat-source-card__snippet", `ow-chat-source-card__snippet--${snippetFormat}`), children: snippet }) : null,
7926
8496
  href ? (
7927
8497
  // The chip is the same link, so this one stays out of the tab order.
7928
- /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("a", { href, ...externalProps, tabIndex: -1, className: cx(linkClassName({ variant: "standalone" }), "ow-chat-source-card__open"), children: [
8498
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("a", { href, ...externalProps, tabIndex: -1, className: cx(linkClassName({ variant: "standalone" }), "ow-chat-source-card__open"), children: [
7929
8499
  openLabel,
7930
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ArrowUpRightIcon, { size: 13 })
8500
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ArrowUpRightIcon, { size: 13 })
7931
8501
  ] })
7932
8502
  ) : null
7933
8503
  ] })
@@ -7935,34 +8505,34 @@ var ChatSource = /* @__PURE__ */ (0, import_react64.forwardRef)(function ChatSou
7935
8505
  }
7936
8506
  );
7937
8507
  });
7938
- var ChatSources = /* @__PURE__ */ (0, import_react64.forwardRef)(function ChatSources2({ sources, label, expanded, defaultExpanded = false, onExpandedChange, className, ...props }, ref) {
7939
- const id = (0, import_react64.useId)();
8508
+ var ChatSources = /* @__PURE__ */ (0, import_react69.forwardRef)(function ChatSources2({ sources, label, expanded, defaultExpanded = false, onExpandedChange, className, ...props }, ref) {
8509
+ const id = (0, import_react69.useId)();
7940
8510
  const [isOpen, setOpen] = useControllableState(expanded, defaultExpanded, onExpandedChange);
7941
8511
  if (sources.length === 0) return null;
7942
- return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { ref, className: cx("ow-chat-sources", className), ...props, children: [
7943
- /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("button", { type: "button", className: "ow-chat-toggle", "aria-expanded": isOpen, "aria-controls": `${id}-list`, onClick: () => setOpen(!isOpen), children: [
7944
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ow-chat-toggle__chevron", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ChevronRightIcon, { size: 14 }) }),
7945
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ow-chat-toggle__text", children: label ?? `${sources.length} ${sources.length === 1 ? "source" : "sources"}` })
8512
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { ref, className: cx("ow-chat-sources", className), ...props, children: [
8513
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("button", { type: "button", className: "ow-chat-toggle", "aria-expanded": isOpen, "aria-controls": `${id}-list`, onClick: () => setOpen(!isOpen), children: [
8514
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "ow-chat-toggle__chevron", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ChevronRightIcon, { size: 14 }) }),
8515
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "ow-chat-toggle__text", children: label ?? `${sources.length} ${sources.length === 1 ? "source" : "sources"}` })
7946
8516
  ] }),
7947
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ChatCollapse, { id: `${id}-list`, open: isOpen, bleed: true, className: "ow-chat-sources__body", children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("ul", { className: "ow-chat-sources__list", children: sources.map((item, position) => {
7948
- const content = /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
7949
- /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { className: "ow-chat-sources__lead", children: [
7950
- item.index !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { className: "ow-chat-sources__index", children: [
7951
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ow-visually-hidden", children: "Source " }),
8517
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ChatCollapse, { id: `${id}-list`, open: isOpen, bleed: true, className: "ow-chat-sources__body", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("ul", { className: "ow-chat-sources__list", children: sources.map((item, position) => {
8518
+ const content = /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_jsx_runtime80.Fragment, { children: [
8519
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: "ow-chat-sources__lead", children: [
8520
+ item.index !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: "ow-chat-sources__index", children: [
8521
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "ow-visually-hidden", children: "Source " }),
7952
8522
  item.index
7953
8523
  ] }) : null,
7954
- item.icon || item.index === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ow-chat-sources__icon", "aria-hidden": "true", children: item.icon ?? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(FileIcon, { size: 15 }) }) : null
8524
+ item.icon || item.index === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "ow-chat-sources__icon", "aria-hidden": "true", children: item.icon ?? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(FileIcon, { size: 15 }) }) : null
7955
8525
  ] }),
7956
- /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { className: "ow-chat-sources__text", children: [
7957
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ow-chat-sources__title", children: item.title }),
7958
- item.source ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ow-chat-sources__source", children: item.source }) : null
8526
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: "ow-chat-sources__text", children: [
8527
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "ow-chat-sources__title", children: item.title }),
8528
+ item.source ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "ow-chat-sources__source", children: item.source }) : null
7959
8529
  ] }),
7960
- item.href && item.external ? /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
7961
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ow-chat-sources__external", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ArrowUpRightIcon, { size: 14 }) }),
7962
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ow-visually-hidden", children: " (opens in a new tab)" })
8530
+ item.href && item.external ? /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_jsx_runtime80.Fragment, { children: [
8531
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "ow-chat-sources__external", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(ArrowUpRightIcon, { size: 14 }) }),
8532
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "ow-visually-hidden", children: " (opens in a new tab)" })
7963
8533
  ] }) : null
7964
8534
  ] });
7965
- return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("li", { children: item.href ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
8535
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("li", { children: item.href ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
7966
8536
  "a",
7967
8537
  {
7968
8538
  href: item.href,
@@ -7970,21 +8540,21 @@ var ChatSources = /* @__PURE__ */ (0, import_react64.forwardRef)(function ChatSo
7970
8540
  ...item.external ? { target: "_blank", rel: "noopener noreferrer" } : {},
7971
8541
  children: content
7972
8542
  }
7973
- ) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "ow-chat-sources__card", children: content }) }, item.id ?? item.index ?? position);
8543
+ ) : /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "ow-chat-sources__card", children: content }) }, item.id ?? item.index ?? position);
7974
8544
  }) }) })
7975
8545
  ] });
7976
8546
  });
7977
8547
 
7978
8548
  // src/components/ColorPicker/ColorPicker.tsx
7979
- var import_react65 = require("react");
8549
+ var import_react70 = require("react");
7980
8550
  var import_react_colorful = require("react-colorful");
7981
- var import_jsx_runtime74 = require("react/jsx-runtime");
8551
+ var import_jsx_runtime81 = require("react/jsx-runtime");
7982
8552
  var swatchColor = (swatch) => typeof swatch === "string" ? swatch : swatch.color;
7983
8553
  var swatchName = (swatch) => typeof swatch === "string" ? swatch : swatch.name;
7984
8554
  var same = (a, b) => a.toLowerCase().replace(/^#/, "") === b.toLowerCase().replace(/^#/, "");
7985
8555
  function ColorPicker({
7986
8556
  value,
7987
- defaultValue = "#312c7e",
8557
+ defaultValue: defaultValue2 = "#312c7e",
7988
8558
  onChange,
7989
8559
  alpha = false,
7990
8560
  swatches,
@@ -7993,11 +8563,11 @@ function ColorPicker({
7993
8563
  "aria-label": ariaLabel = "Colour",
7994
8564
  className
7995
8565
  }) {
7996
- const [color, setColor] = useControllableState(value, defaultValue, onChange);
7997
- const [canPick, setCanPick] = (0, import_react65.useState)(false);
7998
- const rootRef = (0, import_react65.useRef)(null);
7999
- (0, import_react65.useEffect)(() => setCanPick(typeof window !== "undefined" && "EyeDropper" in window), []);
8000
- (0, import_react65.useEffect)(() => {
8566
+ const [color, setColor] = useControllableState(value, defaultValue2, onChange);
8567
+ const [canPick, setCanPick] = (0, import_react70.useState)(false);
8568
+ const rootRef = (0, import_react70.useRef)(null);
8569
+ (0, import_react70.useEffect)(() => setCanPick(typeof window !== "undefined" && "EyeDropper" in window), []);
8570
+ (0, import_react70.useEffect)(() => {
8001
8571
  const names = { saturation: "Colour", hue: "Hue", alpha: "Opacity" };
8002
8572
  for (const [part, label] of Object.entries(names)) {
8003
8573
  rootRef.current?.querySelector(`.react-colorful__${part} .react-colorful__interactive`)?.setAttribute("aria-label", label);
@@ -8013,13 +8583,13 @@ function ColorPicker({
8013
8583
  } catch {
8014
8584
  }
8015
8585
  }
8016
- return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { ref: rootRef, role: "group", "aria-label": ariaLabel, className: cx("ow-color-picker", className), children: [
8017
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Picker, { color, onChange: change }),
8018
- showInput || eyeDropper && canPick ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "ow-color-picker__row", children: [
8019
- eyeDropper && canPick ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("button", { type: "button", className: "ow-color-picker__dropper", "aria-label": "Pick a colour from the screen", onClick: pickFromScreen, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(PipetteIcon, { size: 15 }) }) : null,
8020
- showInput ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("span", { className: "ow-input-group ow-input-group--sm ow-color-picker__input", children: [
8021
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "ow-input-group__addon", "aria-hidden": "true", children: "#" }),
8022
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
8586
+ return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { ref: rootRef, role: "group", "aria-label": ariaLabel, className: cx("ow-color-picker", className), children: [
8587
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Picker, { color, onChange: change }),
8588
+ showInput || eyeDropper && canPick ? /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "ow-color-picker__row", children: [
8589
+ eyeDropper && canPick ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("button", { type: "button", className: "ow-color-picker__dropper", "aria-label": "Pick a colour from the screen", onClick: pickFromScreen, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(PipetteIcon, { size: 15 }) }) : null,
8590
+ showInput ? /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("span", { className: "ow-input-group ow-input-group--sm ow-color-picker__input", children: [
8591
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: "ow-input-group__addon", "aria-hidden": "true", children: "#" }),
8592
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
8023
8593
  import_react_colorful.HexColorInput,
8024
8594
  {
8025
8595
  className: "ow-input-group__input",
@@ -8031,11 +8601,11 @@ function ColorPicker({
8031
8601
  }
8032
8602
  )
8033
8603
  ] }) : null,
8034
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "ow-color-picker__preview", style: { "--ow-color-picker-value": color }, "aria-hidden": "true" })
8604
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: "ow-color-picker__preview", style: { "--ow-color-picker-value": color }, "aria-hidden": "true" })
8035
8605
  ] }) : null,
8036
- swatches?.length ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "ow-color-picker__swatches", role: "group", "aria-label": "Swatches", children: swatches.map((swatch) => {
8606
+ swatches?.length ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "ow-color-picker__swatches", role: "group", "aria-label": "Swatches", children: swatches.map((swatch) => {
8037
8607
  const swatchValue = swatchColor(swatch);
8038
- return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
8608
+ return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
8039
8609
  "button",
8040
8610
  {
8041
8611
  type: "button",
@@ -8055,9 +8625,9 @@ function assignRef7(ref, value) {
8055
8625
  if (typeof ref === "function") ref(value);
8056
8626
  else if (ref) ref.current = value;
8057
8627
  }
8058
- var ColorField = /* @__PURE__ */ (0, import_react65.forwardRef)(function ColorField2({
8628
+ var ColorField = /* @__PURE__ */ (0, import_react70.forwardRef)(function ColorField2({
8059
8629
  value,
8060
- defaultValue = "#312c7e",
8630
+ defaultValue: defaultValue2 = "#312c7e",
8061
8631
  onChange,
8062
8632
  size: size2 = "md",
8063
8633
  isInvalid = false,
@@ -8070,25 +8640,25 @@ var ColorField = /* @__PURE__ */ (0, import_react65.forwardRef)(function ColorFi
8070
8640
  "aria-describedby": ariaDescribedBy,
8071
8641
  ...pickerProps
8072
8642
  }, ref) {
8073
- const [color, setColor] = useControllableState(value, defaultValue, onChange);
8074
- const [isOpen, setOpen] = (0, import_react65.useState)(false);
8075
- const triggerRef = (0, import_react65.useRef)(null);
8076
- const panelRef = (0, import_react65.useRef)(null);
8077
- const panelId = (0, import_react65.useId)();
8643
+ const [color, setColor] = useControllableState(value, defaultValue2, onChange);
8644
+ const [isOpen, setOpen] = (0, import_react70.useState)(false);
8645
+ const triggerRef = (0, import_react70.useRef)(null);
8646
+ const panelRef = (0, import_react70.useRef)(null);
8647
+ const panelId = (0, import_react70.useId)();
8078
8648
  const { mounted, state } = usePresence(isOpen);
8079
8649
  const style = useFloating({ open: mounted, anchorRef: triggerRef, floatingRef: panelRef, placement, offset: 6, maxHeight: 640 });
8080
- const close = (0, import_react65.useCallback)((reason) => {
8650
+ const close = (0, import_react70.useCallback)((reason) => {
8081
8651
  setOpen(false);
8082
8652
  if (reason !== "outside") triggerRef.current?.focus();
8083
8653
  }, []);
8084
8654
  useDismiss(isOpen, [panelRef, triggerRef], close);
8085
- (0, import_react65.useEffect)(() => {
8655
+ (0, import_react70.useEffect)(() => {
8086
8656
  if (!isOpen) return void 0;
8087
8657
  const frame = requestAnimationFrame(() => panelRef.current?.querySelector(".react-colorful__interactive")?.focus());
8088
8658
  return () => cancelAnimationFrame(frame);
8089
8659
  }, [isOpen]);
8090
- return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
8091
- /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
8660
+ return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(import_jsx_runtime81.Fragment, { children: [
8661
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
8092
8662
  "button",
8093
8663
  {
8094
8664
  ref: (element) => {
@@ -8120,13 +8690,13 @@ var ColorField = /* @__PURE__ */ (0, import_react65.forwardRef)(function ColorFi
8120
8690
  }
8121
8691
  },
8122
8692
  children: [
8123
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "ow-color-field__swatch", style: { "--ow-color-picker-value": color }, "aria-hidden": "true" }),
8124
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { id: `${panelId}-value`, className: "ow-select__value ow-color-field__value", children: color.toUpperCase() }),
8125
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ChevronDownIcon, { size: size2 === "sm" ? 14 : 16, className: "ow-select__chevron" })
8693
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: "ow-color-field__swatch", style: { "--ow-color-picker-value": color }, "aria-hidden": "true" }),
8694
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { id: `${panelId}-value`, className: "ow-select__value ow-color-field__value", children: color.toUpperCase() }),
8695
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ChevronDownIcon, { size: size2 === "sm" ? 14 : 16, className: "ow-select__chevron" })
8126
8696
  ]
8127
8697
  }
8128
8698
  ),
8129
- mounted ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
8699
+ mounted ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
8130
8700
  "div",
8131
8701
  {
8132
8702
  ref: panelRef,
@@ -8140,17 +8710,17 @@ var ColorField = /* @__PURE__ */ (0, import_react65.forwardRef)(function ColorFi
8140
8710
  onKeyDown: (event) => {
8141
8711
  if (event.key === "Enter" && event.target.closest(".react-colorful")) close();
8142
8712
  },
8143
- children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ColorPicker, { ...pickerProps, value: color, onChange: setColor })
8713
+ children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(ColorPicker, { ...pickerProps, value: color, onChange: setColor })
8144
8714
  }
8145
8715
  ) : null
8146
8716
  ] });
8147
8717
  });
8148
8718
 
8149
8719
  // src/components/ColorPicker/ColorArea.tsx
8150
- var import_react67 = require("react");
8720
+ var import_react72 = require("react");
8151
8721
 
8152
8722
  // src/components/ColorPicker/color.ts
8153
- var import_react66 = require("react");
8723
+ var import_react71 = require("react");
8154
8724
  var clamp2 = (n, min, max) => Math.min(max, Math.max(min, n));
8155
8725
  function parseHex(color) {
8156
8726
  let hex = color.trim().replace(/^#/, "");
@@ -8225,10 +8795,10 @@ var hslModel = {
8225
8795
  write: (model) => hsvToRgb(hslToHsv(model))
8226
8796
  };
8227
8797
  var fallback = { r: 0, g: 0, b: 0, a: 1 };
8228
- function useColorModel(value, defaultValue, onChange, model, { hue, alpha = false } = {}) {
8229
- const [color, setColor] = useControllableState(value, defaultValue, onChange);
8230
- const memory = (0, import_react66.useRef)(null);
8231
- const [, rerender] = (0, import_react66.useReducer)((n) => n + 1, 0);
8798
+ function useColorModel(value, defaultValue2, onChange, model, { hue, alpha = false } = {}) {
8799
+ const [color, setColor] = useControllableState(value, defaultValue2, onChange);
8800
+ const memory = (0, import_react71.useRef)(null);
8801
+ const [, rerender] = (0, import_react71.useReducer)((n) => n + 1, 0);
8232
8802
  const incoming = normalizeHex(color);
8233
8803
  if (!memory.current || memory.current.hex !== incoming || memory.current.model !== model) {
8234
8804
  const rgba2 = parseHex(incoming);
@@ -8239,7 +8809,7 @@ function useColorModel(value, defaultValue, onChange, model, { hue, alpha = fals
8239
8809
  const isGrey = rgba.r === rgba.g && rgba.g === rgba.b;
8240
8810
  const current = isGrey && hue !== void 0 ? { ...memory.current.value, h: hue } : memory.current.value;
8241
8811
  const withAlpha = alpha || hasAlpha(color);
8242
- const set = (0, import_react66.useCallback)(
8812
+ const set = (0, import_react71.useCallback)(
8243
8813
  (next) => {
8244
8814
  const hex = toHex(model.write(next), withAlpha);
8245
8815
  memory.current = { hex, model, value: next };
@@ -8249,7 +8819,7 @@ function useColorModel(value, defaultValue, onChange, model, { hue, alpha = fals
8249
8819
  },
8250
8820
  [model, withAlpha, setColor]
8251
8821
  );
8252
- const latest = (0, import_react66.useCallback)(() => memory.current?.hex ?? incoming, [incoming]);
8822
+ const latest = (0, import_react71.useCallback)(() => memory.current?.hex ?? incoming, [incoming]);
8253
8823
  return { value: current, rgba: model.write(current), hex: memory.current.hex, set, latest };
8254
8824
  }
8255
8825
  function useDrag({
@@ -8258,8 +8828,8 @@ function useDrag({
8258
8828
  onStart,
8259
8829
  disabled = false
8260
8830
  }) {
8261
- const [dragging, setDragging] = (0, import_react66.useState)(false);
8262
- const [pointerFocus, setPointerFocus] = (0, import_react66.useState)(false);
8831
+ const [dragging, setDragging] = (0, import_react71.useState)(false);
8832
+ const [pointerFocus, setPointerFocus] = (0, import_react71.useState)(false);
8263
8833
  const move = (event) => {
8264
8834
  const rect = event.currentTarget.getBoundingClientRect();
8265
8835
  onMove(clamp2((event.clientX - rect.left) / (rect.width || 1), 0, 1), clamp2((event.clientY - rect.top) / (rect.height || 1), 0, 1));
@@ -8331,15 +8901,15 @@ var hueHex = (h) => toHex(hsvToRgb({ h, s: 100, v: 100, a: 1 }));
8331
8901
  var hueStops = "#ff0000 0%, #ffff00 16.67%, #00ff00 33.33%, #00ffff 50%, #0000ff 66.67%, #ff00ff 83.33%, #ff0000 100%";
8332
8902
 
8333
8903
  // src/components/ColorPicker/ColorArea.tsx
8334
- var import_jsx_runtime75 = require("react/jsx-runtime");
8904
+ var import_jsx_runtime82 = require("react/jsx-runtime");
8335
8905
  var size = (length) => typeof length === "number" ? `${length}px` : length;
8336
8906
  function assignRef8(ref, value) {
8337
8907
  if (typeof ref === "function") ref(value);
8338
8908
  else if (ref) ref.current = value;
8339
8909
  }
8340
- var ColorArea = /* @__PURE__ */ (0, import_react67.forwardRef)(function ColorArea2({
8910
+ var ColorArea = /* @__PURE__ */ (0, import_react72.forwardRef)(function ColorArea2({
8341
8911
  value,
8342
- defaultValue = "#312c7e",
8912
+ defaultValue: defaultValue2 = "#312c7e",
8343
8913
  onChange,
8344
8914
  onChangeEnd,
8345
8915
  hue,
@@ -8354,10 +8924,10 @@ var ColorArea = /* @__PURE__ */ (0, import_react67.forwardRef)(function ColorAre
8354
8924
  id,
8355
8925
  className
8356
8926
  }, ref) {
8357
- const { value: hsv, rgba, hex, set, latest } = useColorModel(value, defaultValue, onChange, hsvModel, { hue });
8358
- const rootRef = (0, import_react67.useRef)(null);
8359
- const inputs = (0, import_react67.useRef)({ x: null, y: null });
8360
- const [axis, setAxis] = (0, import_react67.useState)("x");
8927
+ const { value: hsv, rgba, hex, set, latest } = useColorModel(value, defaultValue2, onChange, hsvModel, { hue });
8928
+ const rootRef = (0, import_react72.useRef)(null);
8929
+ const inputs = (0, import_react72.useRef)({ x: null, y: null });
8930
+ const [axis, setAxis] = (0, import_react72.useState)("x");
8361
8931
  const isRtl = () => rootRef.current ? getComputedStyle(rootRef.current).direction === "rtl" : false;
8362
8932
  const end = () => onChangeEnd?.(latest());
8363
8933
  const drag = useDrag({
@@ -8408,11 +8978,11 @@ var ColorArea = /* @__PURE__ */ (0, import_react67.forwardRef)(function ColorAre
8408
8978
  function onKeyUp(event) {
8409
8979
  if (/^(Arrow|Page|Home|End)/.test(event.key)) end();
8410
8980
  }
8411
- const percent = new Intl.NumberFormat(locale, { style: "percent", maximumFractionDigits: 0 });
8412
- const saturation = `Saturation ${percent.format(hsv.s / 100)}`;
8413
- const brightness = `brightness ${percent.format(hsv.v / 100)}`;
8981
+ const percent2 = new Intl.NumberFormat(locale, { style: "percent", maximumFractionDigits: 0 });
8982
+ const saturation = `Saturation ${percent2.format(hsv.s / 100)}`;
8983
+ const brightness = `brightness ${percent2.format(hsv.v / 100)}`;
8414
8984
  const colorName = describeColor(rgba);
8415
- const input = (which) => /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
8985
+ const input = (which) => /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
8416
8986
  "input",
8417
8987
  {
8418
8988
  ref: (element) => {
@@ -8439,7 +9009,7 @@ var ColorArea = /* @__PURE__ */ (0, import_react67.forwardRef)(function ColorAre
8439
9009
  onKeyUp
8440
9010
  }
8441
9011
  );
8442
- return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
9012
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
8443
9013
  "div",
8444
9014
  {
8445
9015
  ref: rootRef,
@@ -8460,7 +9030,7 @@ var ColorArea = /* @__PURE__ */ (0, import_react67.forwardRef)(function ColorAre
8460
9030
  },
8461
9031
  ...drag.handlers,
8462
9032
  children: [
8463
- /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
9033
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
8464
9034
  "div",
8465
9035
  {
8466
9036
  className: "ow-color-area__thumb",
@@ -8471,15 +9041,15 @@ var ColorArea = /* @__PURE__ */ (0, import_react67.forwardRef)(function ColorAre
8471
9041
  ]
8472
9042
  }
8473
9043
  ),
8474
- name ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("input", { type: "hidden", name, value: hex }) : null
9044
+ name ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("input", { type: "hidden", name, value: hex }) : null
8475
9045
  ]
8476
9046
  }
8477
9047
  );
8478
9048
  });
8479
9049
 
8480
9050
  // src/components/ColorPicker/ColorSlider.tsx
8481
- var import_react68 = require("react");
8482
- var import_jsx_runtime76 = require("react/jsx-runtime");
9051
+ var import_react73 = require("react");
9052
+ var import_jsx_runtime83 = require("react/jsx-runtime");
8483
9053
  var channels = {
8484
9054
  hue: { name: "Hue", max: 360, unit: "degree" },
8485
9055
  saturation: { name: "Saturation", max: 100, unit: "percent" },
@@ -8526,10 +9096,10 @@ function assignRef9(ref, value) {
8526
9096
  if (typeof ref === "function") ref(value);
8527
9097
  else if (ref) ref.current = value;
8528
9098
  }
8529
- var ColorSlider = /* @__PURE__ */ (0, import_react68.forwardRef)(function ColorSlider2({
9099
+ var ColorSlider = /* @__PURE__ */ (0, import_react73.forwardRef)(function ColorSlider2({
8530
9100
  channel,
8531
9101
  value,
8532
- defaultValue = "#312c7e",
9102
+ defaultValue: defaultValue2 = "#312c7e",
8533
9103
  onChange,
8534
9104
  onChangeEnd,
8535
9105
  hue,
@@ -8548,15 +9118,15 @@ var ColorSlider = /* @__PURE__ */ (0, import_react68.forwardRef)(function ColorS
8548
9118
  }, ref) {
8549
9119
  const spec = channels[channel];
8550
9120
  const isHsl = channel === "saturation" || channel === "lightness";
8551
- const color = useColorModel(value, defaultValue, onChange, isHsl ? hslModel : hsvModel, {
9121
+ const color = useColorModel(value, defaultValue2, onChange, isHsl ? hslModel : hsvModel, {
8552
9122
  hue,
8553
9123
  alpha: channel === "alpha"
8554
9124
  });
8555
9125
  const { rgba, latest } = color;
8556
9126
  const current = read(channel, color.value, rgba);
8557
- const labelId = (0, import_react68.useId)();
8558
- const trackRef = (0, import_react68.useRef)(null);
8559
- const inputRef = (0, import_react68.useRef)(null);
9127
+ const labelId = (0, import_react73.useId)();
9128
+ const trackRef = (0, import_react73.useRef)(null);
9129
+ const inputRef = (0, import_react73.useRef)(null);
8560
9130
  const vertical = orientation === "vertical";
8561
9131
  const isRtl = () => !vertical && trackRef.current !== null && getComputedStyle(trackRef.current).direction === "rtl";
8562
9132
  const end = () => onChangeEnd?.(latest());
@@ -8594,7 +9164,7 @@ var ColorSlider = /* @__PURE__ */ (0, import_react68.forwardRef)(function ColorS
8594
9164
  const shown = format.format(spec.unit === "percent" ? current / 100 : current);
8595
9165
  const named = channel === "hue" ? describeColor(parseHex(hueHex(color.value.h))) : describeColor({ ...rgba, a: 1 });
8596
9166
  const fill = channel === "hue" ? hueHex(color.value.h) : toHex(rgba, channel === "alpha");
8597
- return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
9167
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
8598
9168
  "div",
8599
9169
  {
8600
9170
  className: cx(
@@ -8609,11 +9179,11 @@ var ColorSlider = /* @__PURE__ */ (0, import_react68.forwardRef)(function ColorS
8609
9179
  className
8610
9180
  ),
8611
9181
  children: [
8612
- label || showValue ? /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "ow-color-slider__header", children: [
8613
- label ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { id: labelId, className: "ow-color-slider__label", children: label }) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", {}),
8614
- showValue ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("output", { className: "ow-color-slider__value", "aria-hidden": "true", children: shown }) : null
9182
+ label || showValue ? /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "ow-color-slider__header", children: [
9183
+ label ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { id: labelId, className: "ow-color-slider__label", children: label }) : /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", {}),
9184
+ showValue ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("output", { className: "ow-color-slider__value", "aria-hidden": "true", children: shown }) : null
8615
9185
  ] }) : null,
8616
- /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
9186
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
8617
9187
  "div",
8618
9188
  {
8619
9189
  ref: trackRef,
@@ -8622,12 +9192,12 @@ var ColorSlider = /* @__PURE__ */ (0, import_react68.forwardRef)(function ColorS
8622
9192
  "--ow-color-slider-gradient": `linear-gradient(var(--ow-color-slider-direction), ${gradient(channel, color.value, rgba)})`
8623
9193
  },
8624
9194
  ...drag.handlers,
8625
- children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
9195
+ children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
8626
9196
  "div",
8627
9197
  {
8628
9198
  className: "ow-color-slider__thumb",
8629
9199
  style: { "--ow-color-slider-position": `${current / spec.max * 100}%`, "--ow-color-slider-thumb": fill },
8630
- children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
9200
+ children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
8631
9201
  "input",
8632
9202
  {
8633
9203
  ref: (element) => {
@@ -8659,18 +9229,18 @@ var ColorSlider = /* @__PURE__ */ (0, import_react68.forwardRef)(function ColorS
8659
9229
  )
8660
9230
  }
8661
9231
  ),
8662
- name ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("input", { type: "hidden", name, value: color.hex }) : null
9232
+ name ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("input", { type: "hidden", name, value: color.hex }) : null
8663
9233
  ]
8664
9234
  }
8665
9235
  );
8666
9236
  });
8667
9237
 
8668
9238
  // src/components/ColorPicker/ColorSwatchPicker.tsx
8669
- var import_react69 = require("react");
8670
- var import_jsx_runtime77 = require("react/jsx-runtime");
8671
- var ColorSwatchPicker = /* @__PURE__ */ (0, import_react69.forwardRef)(function ColorSwatchPicker2({ options, value, defaultValue, onChange, size: size2 = "md", shape = "square", disabled = false, name, className, ...aria }, ref) {
8672
- const [current, setCurrent] = useControllableState(value, defaultValue ?? "", onChange);
8673
- const refs = (0, import_react69.useRef)([]);
9239
+ var import_react74 = require("react");
9240
+ var import_jsx_runtime84 = require("react/jsx-runtime");
9241
+ var ColorSwatchPicker = /* @__PURE__ */ (0, import_react74.forwardRef)(function ColorSwatchPicker2({ options, value, defaultValue: defaultValue2, onChange, size: size2 = "md", shape = "square", disabled = false, name, className, ...aria }, ref) {
9242
+ const [current, setCurrent] = useControllableState(value, defaultValue2 ?? "", onChange);
9243
+ const refs = (0, import_react74.useRef)([]);
8674
9244
  const items2 = options.map((option) => {
8675
9245
  const item = typeof option === "string" ? { value: option } : option;
8676
9246
  const rgba = parseHex(item.value);
@@ -8704,7 +9274,7 @@ var ColorSwatchPicker = /* @__PURE__ */ (0, import_react69.forwardRef)(function
8704
9274
  refs.current[target]?.focus();
8705
9275
  choose(target);
8706
9276
  }
8707
- return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
9277
+ return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
8708
9278
  "div",
8709
9279
  {
8710
9280
  ref,
@@ -8721,7 +9291,7 @@ var ColorSwatchPicker = /* @__PURE__ */ (0, import_react69.forwardRef)(function
8721
9291
  items2.map((item, index) => {
8722
9292
  const isSelected = index === selectedIndex;
8723
9293
  const isDisabled = disabled || Boolean(item.disabled);
8724
- return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
9294
+ return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
8725
9295
  "div",
8726
9296
  {
8727
9297
  ref: (element) => {
@@ -8738,12 +9308,12 @@ var ColorSwatchPicker = /* @__PURE__ */ (0, import_react69.forwardRef)(function
8738
9308
  style: { "--ow-color-swatch-picker-value": item.value },
8739
9309
  onClick: () => choose(index),
8740
9310
  onKeyDown: (event) => onKeyDown(event, index),
8741
- children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(CheckIcon, { size: size2 === "sm" ? 14 : 16, strokeWidth: 2.5, className: "ow-color-swatch-picker__check", "aria-hidden": "true" })
9311
+ children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(CheckIcon, { size: size2 === "sm" ? 14 : 16, strokeWidth: 2.5, className: "ow-color-swatch-picker__check", "aria-hidden": "true" })
8742
9312
  },
8743
9313
  `${item.value}-${index}`
8744
9314
  );
8745
9315
  }),
8746
- name ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("input", { type: "hidden", name, value: selectedIndex >= 0 ? items2[selectedIndex].value : "" }) : null
9316
+ name ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("input", { type: "hidden", name, value: selectedIndex >= 0 ? items2[selectedIndex].value : "" }) : null
8747
9317
  ]
8748
9318
  }
8749
9319
  );