@timbal-ai/timbal-react 0.8.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +100 -6
  3. package/dist/app.cjs +2538 -1262
  4. package/dist/app.d.cts +11 -6
  5. package/dist/app.d.ts +11 -6
  6. package/dist/app.esm.js +43 -6
  7. package/dist/{button-ClSgD6OF.d.cts → button-BoyX5pM_.d.cts} +1 -1
  8. package/dist/{button-ClSgD6OF.d.ts → button-BoyX5pM_.d.ts} +1 -1
  9. package/dist/{chart-artifact-Bl67kre7.d.ts → chart-artifact-BZp7nmaf.d.ts} +430 -14
  10. package/dist/{chart-artifact-BzcvblDe.d.cts → chart-artifact-CX-rh9nq.d.cts} +430 -14
  11. package/dist/{chat-Bed4FQSl.d.cts → chat-DCms8pJ_.d.cts} +31 -4
  12. package/dist/{chat-Bed4FQSl.d.ts → chat-DCms8pJ_.d.ts} +31 -4
  13. package/dist/chat.cjs +1111 -776
  14. package/dist/chat.d.cts +1 -1
  15. package/dist/chat.d.ts +1 -1
  16. package/dist/chat.esm.js +3 -3
  17. package/dist/{chunk-QVAUCVQA.esm.js → chunk-4AKJ6FKE.esm.js} +277 -4
  18. package/dist/chunk-6HWMJNZT.esm.js +3439 -0
  19. package/dist/{chunk-VWHHKAHN.esm.js → chunk-FRZOEYBO.esm.js} +4 -4
  20. package/dist/chunk-JEAUF54A.esm.js +52 -0
  21. package/dist/{chunk-OISVICYF.esm.js → chunk-P3KDAYX6.esm.js} +1 -1
  22. package/dist/{chunk-6YVKCVEP.esm.js → chunk-TK2AGIME.esm.js} +1106 -298
  23. package/dist/{chunk-CFU3YDTV.esm.js → chunk-XCM3V6RK.esm.js} +5 -5
  24. package/dist/{chunk-5ZKLPWVN.esm.js → chunk-YXZ22OJN.esm.js} +849 -667
  25. package/dist/index.cjs +6070 -1605
  26. package/dist/index.d.cts +8 -6
  27. package/dist/index.d.ts +8 -6
  28. package/dist/index.esm.js +427 -11
  29. package/dist/pill-segmented-tabs-Ba5q0feL.d.cts +500 -0
  30. package/dist/pill-segmented-tabs-Ba5q0feL.d.ts +500 -0
  31. package/dist/studio.cjs +1333 -998
  32. package/dist/studio.d.cts +2 -2
  33. package/dist/studio.d.ts +2 -2
  34. package/dist/studio.esm.js +5 -5
  35. package/dist/styles.css +220 -0
  36. package/dist/ui.cjs +3592 -89
  37. package/dist/ui.d.cts +72 -96
  38. package/dist/ui.d.ts +72 -96
  39. package/dist/ui.esm.js +400 -6
  40. package/dist/{welcome-COOb05a5.d.cts → welcome-CRqOPKMp.d.cts} +1 -1
  41. package/dist/{welcome-DE08m9ca.d.ts → welcome-DlHUa3OL.d.ts} +1 -1
  42. package/package.json +9 -3
  43. package/dist/chunk-P4SN7M67.esm.js +0 -435
package/dist/studio.cjs CHANGED
@@ -898,10 +898,10 @@ function findParentIdFromAuiParent(messages, auiParentId) {
898
898
  }
899
899
 
900
900
  // src/chat/thread.tsx
901
- var import_react29 = require("react");
902
- var import_react30 = require("@assistant-ui/react");
901
+ var import_react27 = require("react");
902
+ var import_react28 = require("@assistant-ui/react");
903
903
  var import_lucide_react8 = require("lucide-react");
904
- var import_react31 = require("motion/react");
904
+ var import_react29 = require("motion/react");
905
905
 
906
906
  // src/chat/attachment.tsx
907
907
  var import_react5 = require("react");
@@ -1522,131 +1522,251 @@ var import_react_markdown = require("@assistant-ui/react-markdown");
1522
1522
  var import_remark_gfm = __toESM(require("remark-gfm"), 1);
1523
1523
  var import_remark_math = __toESM(require("remark-math"), 1);
1524
1524
  var import_rehype_katex = __toESM(require("rehype-katex"), 1);
1525
- var import_react19 = require("react");
1525
+ var import_react17 = require("react");
1526
1526
  var import_lucide_react4 = require("lucide-react");
1527
1527
 
1528
1528
  // src/chat/syntax-highlighter.tsx
1529
- var import_react18 = require("react");
1529
+ var import_react16 = require("react");
1530
1530
  var import_core = require("shiki/core");
1531
1531
  var import_javascript = require("shiki/engine/javascript");
1532
1532
 
1533
1533
  // src/artifacts/registry.tsx
1534
- var import_react17 = require("react");
1534
+ var import_react15 = require("react");
1535
1535
 
1536
1536
  // src/artifacts/chart-artifact.tsx
1537
- var import_react9 = require("react");
1537
+ var import_react7 = require("react");
1538
1538
 
1539
1539
  // src/charts/line-area-chart.tsx
1540
- var import_react8 = require("react");
1540
+ var import_recharts = require("recharts");
1541
1541
 
1542
- // src/charts/use-chart-width.ts
1543
- var import_react7 = require("react");
1544
- function useChartWidth(initial = 640) {
1545
- const ref = (0, import_react7.useRef)(null);
1546
- const [width, setWidth] = (0, import_react7.useState)(initial);
1547
- (0, import_react7.useEffect)(() => {
1548
- const el = ref.current;
1549
- if (!el || typeof ResizeObserver === "undefined") return;
1550
- const ro = new ResizeObserver((entries) => {
1551
- const w = entries[0]?.contentRect.width;
1552
- if (w && w > 0) setWidth(w);
1553
- });
1554
- ro.observe(el);
1555
- return () => ro.disconnect();
1556
- }, []);
1557
- return { ref, width };
1542
+ // src/ui/chart.tsx
1543
+ var React2 = __toESM(require("react"), 1);
1544
+ var RechartsPrimitive = __toESM(require("recharts"), 1);
1545
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1546
+ var THEMES = { light: "", dark: ".dark" };
1547
+ var ChartContext = React2.createContext(null);
1548
+ function useChart() {
1549
+ const context = React2.useContext(ChartContext);
1550
+ if (!context) {
1551
+ throw new Error("useChart must be used within a <ChartContainer />");
1552
+ }
1553
+ return context;
1558
1554
  }
1559
-
1560
- // src/charts/geometry.ts
1561
- function toNum(value) {
1562
- const n = typeof value === "number" ? value : Number(value);
1563
- return Number.isFinite(n) ? n : 0;
1555
+ function ChartContainer({
1556
+ id,
1557
+ className,
1558
+ children,
1559
+ config,
1560
+ ...props
1561
+ }) {
1562
+ const uniqueId = React2.useId();
1563
+ const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
1564
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChartContext.Provider, { value: { config }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1565
+ "div",
1566
+ {
1567
+ "data-slot": "chart",
1568
+ "data-chart": chartId,
1569
+ className: cn(
1570
+ "[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",
1571
+ className
1572
+ ),
1573
+ ...props,
1574
+ children: [
1575
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChartStyle, { id: chartId, config }),
1576
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(RechartsPrimitive.ResponsiveContainer, { children })
1577
+ ]
1578
+ }
1579
+ ) });
1564
1580
  }
1565
- function monotoneLinePath(points) {
1566
- const n = points.length;
1567
- if (n === 0) return "";
1568
- if (n === 1) return `M ${points[0].x},${points[0].y}`;
1569
- if (n === 2) {
1570
- return `M ${points[0].x},${points[0].y} L ${points[1].x},${points[1].y}`;
1571
- }
1572
- const tangents = monotoneTangents(points);
1573
- let d = `M ${points[0].x},${points[0].y}`;
1574
- for (let i = 0; i < n - 1; i++) {
1575
- const p0 = points[i];
1576
- const p1 = points[i + 1];
1577
- const dx = (p1.x - p0.x) / 3;
1578
- const c1x = p0.x + dx;
1579
- const c1y = p0.y + dx * tangents[i];
1580
- const c2x = p1.x - dx;
1581
- const c2y = p1.y - dx * tangents[i + 1];
1582
- d += ` C ${c1x},${c1y} ${c2x},${c2y} ${p1.x},${p1.y}`;
1583
- }
1584
- return d;
1585
- }
1586
- function monotoneAreaPath(points, baseY) {
1587
- if (points.length === 0) return "";
1588
- const line = monotoneLinePath(points);
1589
- const last = points[points.length - 1];
1590
- const first = points[0];
1591
- return `${line} L ${last.x},${baseY} L ${first.x},${baseY} Z`;
1592
- }
1593
- function monotoneTangents(points) {
1594
- const n = points.length;
1595
- const slopes = new Array(n - 1);
1596
- for (let i = 0; i < n - 1; i++) {
1597
- const dx = points[i + 1].x - points[i].x || 1;
1598
- slopes[i] = (points[i + 1].y - points[i].y) / dx;
1581
+ var ChartStyle = ({ id, config }) => {
1582
+ const colorConfig = Object.entries(config).filter(
1583
+ ([, c]) => c.theme || c.color
1584
+ );
1585
+ if (!colorConfig.length) {
1586
+ return null;
1599
1587
  }
1600
- const tangents = new Array(n);
1601
- tangents[0] = slopes[0];
1602
- tangents[n - 1] = slopes[n - 2];
1603
- for (let i = 1; i < n - 1; i++) {
1604
- const s0 = slopes[i - 1];
1605
- const s1 = slopes[i];
1606
- if (s0 * s1 <= 0) {
1607
- tangents[i] = 0;
1608
- } else {
1609
- tangents[i] = (s0 + s1) / 2;
1588
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1589
+ "style",
1590
+ {
1591
+ dangerouslySetInnerHTML: {
1592
+ __html: Object.entries(THEMES).map(
1593
+ ([theme, prefix]) => `
1594
+ ${prefix} [data-chart=${id}] {
1595
+ ${colorConfig.map(([key, itemConfig]) => {
1596
+ const color = itemConfig.theme?.[theme] || itemConfig.color;
1597
+ return color ? ` --color-${key}: ${color};` : null;
1598
+ }).join("\n")}
1599
+ }
1600
+ `
1601
+ ).join("\n")
1602
+ }
1610
1603
  }
1611
- }
1612
- for (let i = 0; i < n - 1; i++) {
1613
- const s = slopes[i];
1614
- if (s === 0) {
1615
- tangents[i] = 0;
1616
- tangents[i + 1] = 0;
1617
- continue;
1604
+ );
1605
+ };
1606
+ var ChartTooltip = RechartsPrimitive.Tooltip;
1607
+ function ChartTooltipContent({
1608
+ active,
1609
+ payload,
1610
+ className,
1611
+ indicator = "dot",
1612
+ hideLabel = false,
1613
+ hideIndicator = false,
1614
+ label,
1615
+ labelFormatter,
1616
+ labelClassName,
1617
+ formatter,
1618
+ color,
1619
+ nameKey,
1620
+ labelKey
1621
+ }) {
1622
+ const { config } = useChart();
1623
+ const tooltipLabel = React2.useMemo(() => {
1624
+ if (hideLabel || !payload?.length) {
1625
+ return null;
1618
1626
  }
1619
- const a = tangents[i] / s;
1620
- const b = tangents[i + 1] / s;
1621
- const h = Math.hypot(a, b);
1622
- if (h > 3) {
1623
- const t = 3 / h;
1624
- tangents[i] = t * a * s;
1625
- tangents[i + 1] = t * b * s;
1627
+ const [item] = payload;
1628
+ const key = `${labelKey || item?.dataKey || item?.name || "value"}`;
1629
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
1630
+ const value = !labelKey && typeof label === "string" ? config[label]?.label || label : itemConfig?.label;
1631
+ if (labelFormatter) {
1632
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: cn("font-medium", labelClassName), children: labelFormatter(value, payload) });
1626
1633
  }
1634
+ if (!value) {
1635
+ return null;
1636
+ }
1637
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: cn("font-medium", labelClassName), children: value });
1638
+ }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
1639
+ if (!active || !payload?.length) {
1640
+ return null;
1627
1641
  }
1628
- return tangents;
1642
+ const nestLabel = payload.length === 1 && indicator !== "dot";
1643
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1644
+ "div",
1645
+ {
1646
+ className: cn(
1647
+ "border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl",
1648
+ "animate-in fade-in-0 zoom-in-95 duration-150",
1649
+ className
1650
+ ),
1651
+ children: [
1652
+ !nestLabel ? tooltipLabel : null,
1653
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "grid gap-1.5", children: payload.filter((item) => item.type !== "none").map((item, index) => {
1654
+ const key = `${nameKey || item.name || item.dataKey || "value"}`;
1655
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
1656
+ const indicatorColor = color || item.payload?.fill || item.color;
1657
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1658
+ "div",
1659
+ {
1660
+ className: cn(
1661
+ "[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",
1662
+ indicator === "dot" && "items-center"
1663
+ ),
1664
+ children: formatter && item?.value !== void 0 && item.name ? formatter(item.value, item.name, item, index, item.payload) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
1665
+ itemConfig?.icon ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(itemConfig.icon, {}) : !hideIndicator && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1666
+ "div",
1667
+ {
1668
+ className: cn(
1669
+ "shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",
1670
+ {
1671
+ "h-2.5 w-2.5": indicator === "dot",
1672
+ "w-1": indicator === "line",
1673
+ "w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
1674
+ "my-0.5": nestLabel && indicator === "dashed"
1675
+ }
1676
+ ),
1677
+ style: {
1678
+ "--color-bg": indicatorColor,
1679
+ "--color-border": indicatorColor
1680
+ }
1681
+ }
1682
+ ),
1683
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1684
+ "div",
1685
+ {
1686
+ className: cn(
1687
+ "flex flex-1 justify-between leading-none",
1688
+ nestLabel ? "items-end" : "items-center"
1689
+ ),
1690
+ children: [
1691
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "grid gap-1.5", children: [
1692
+ nestLabel ? tooltipLabel : null,
1693
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-muted-foreground", children: itemConfig?.label || item.name })
1694
+ ] }),
1695
+ item.value != null && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-foreground font-mono font-medium tabular-nums", children: typeof item.value === "number" ? item.value.toLocaleString() : String(item.value) })
1696
+ ]
1697
+ }
1698
+ )
1699
+ ] })
1700
+ },
1701
+ `${item.dataKey ?? index}`
1702
+ );
1703
+ }) })
1704
+ ]
1705
+ }
1706
+ );
1707
+ }
1708
+ var ChartLegend = RechartsPrimitive.Legend;
1709
+ function ChartLegendContent({
1710
+ className,
1711
+ hideIcon = false,
1712
+ payload,
1713
+ verticalAlign = "bottom",
1714
+ nameKey
1715
+ }) {
1716
+ const { config } = useChart();
1717
+ if (!payload?.length) {
1718
+ return null;
1719
+ }
1720
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1721
+ "div",
1722
+ {
1723
+ className: cn(
1724
+ "flex items-center justify-center gap-4",
1725
+ verticalAlign === "top" ? "pb-3" : "pt-3",
1726
+ className
1727
+ ),
1728
+ children: payload.filter((item) => item.type !== "none").map((item, index) => {
1729
+ const key = `${nameKey || item.dataKey || "value"}`;
1730
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
1731
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1732
+ "div",
1733
+ {
1734
+ className: "[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3",
1735
+ children: [
1736
+ itemConfig?.icon && !hideIcon ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(itemConfig.icon, {}) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1737
+ "div",
1738
+ {
1739
+ className: "h-2 w-2 shrink-0 rounded-[2px]",
1740
+ style: { backgroundColor: item.color }
1741
+ }
1742
+ ),
1743
+ itemConfig?.label
1744
+ ]
1745
+ },
1746
+ `${item.value ?? index}`
1747
+ );
1748
+ })
1749
+ }
1750
+ );
1629
1751
  }
1630
- function niceTicks(min, max, count = 4) {
1631
- if (!Number.isFinite(min) || !Number.isFinite(max) || max === min) {
1632
- return [min || 0];
1752
+ function getPayloadConfigFromPayload(config, payload, key) {
1753
+ if (typeof payload !== "object" || payload === null) {
1754
+ return void 0;
1633
1755
  }
1634
- const step = niceStep((max - min) / count);
1635
- const start = Math.floor(min / step) * step;
1636
- const out = [];
1637
- for (let v = start; v <= max + step / 2; v += step) {
1638
- out.push(round(v));
1756
+ const payloadPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null ? payload.payload : void 0;
1757
+ let configLabelKey = key;
1758
+ if (key in payload && typeof payload[key] === "string") {
1759
+ configLabelKey = payload[key];
1760
+ } else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === "string") {
1761
+ configLabelKey = payloadPayload[key];
1639
1762
  }
1640
- return out;
1763
+ return configLabelKey in config ? config[configLabelKey] : config[key];
1641
1764
  }
1642
- function niceStep(raw) {
1643
- const exp = Math.floor(Math.log10(Math.abs(raw) || 1));
1644
- const base = Math.pow(10, exp);
1645
- const norm = raw / base;
1646
- let nice = 1;
1647
- if (norm >= 5) nice = 5;
1648
- else if (norm >= 2) nice = 2;
1649
- return nice * base;
1765
+
1766
+ // src/charts/geometry.ts
1767
+ function toNum(value) {
1768
+ const n = typeof value === "number" ? value : Number(value);
1769
+ return Number.isFinite(n) ? n : 0;
1650
1770
  }
1651
1771
  function round(v) {
1652
1772
  return Math.round(v * 1e6) / 1e6;
@@ -1661,17 +1781,15 @@ function formatCompact(value, unit) {
1661
1781
  }
1662
1782
 
1663
1783
  // src/charts/line-area-chart.tsx
1664
- var import_jsx_runtime9 = require("react/jsx-runtime");
1784
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1665
1785
  var CHART_PALETTE = [
1666
- "var(--primary, #6366f1)",
1667
- "#10b981",
1668
- "#f59e0b",
1669
- "#06b6d4",
1670
- "#a855f7",
1671
- "#ef4444"
1786
+ "var(--chart-1, #6366f1)",
1787
+ "var(--chart-2, #10b981)",
1788
+ "var(--chart-3, #f59e0b)",
1789
+ "var(--chart-4, #a855f7)",
1790
+ "var(--chart-5, #ef4444)",
1791
+ "var(--chart-6, #06b6d4)"
1672
1792
  ];
1673
- var PAD_DEFAULT = { top: 12, right: 16, bottom: 26, left: 44 };
1674
- var PAD_FLUSH = { top: 20, right: 0, bottom: 8, left: 0 };
1675
1793
  var LineAreaChart = ({
1676
1794
  data = [],
1677
1795
  xKey: xKeyProp,
@@ -1680,308 +1798,222 @@ var LineAreaChart = ({
1680
1798
  height = 240,
1681
1799
  unit,
1682
1800
  yMax,
1801
+ curve = "monotone",
1802
+ stacked = false,
1803
+ dots = false,
1804
+ orientation = "vertical",
1805
+ barRadius = 4,
1806
+ gridLines,
1683
1807
  layout = "default",
1684
1808
  showGrid = true,
1685
1809
  showXAxis: showXAxisProp,
1686
1810
  showYAxis: showYAxisProp,
1687
1811
  showLegend: showLegendProp,
1688
1812
  showTooltip = true,
1813
+ tooltipIndicator = "dot",
1689
1814
  formatValue,
1690
1815
  formatX,
1691
1816
  className,
1692
1817
  ariaLabel = "Chart"
1693
1818
  }) => {
1694
- const uid = (0, import_react8.useId)();
1695
- const { ref, width } = useChartWidth();
1696
- const [active, setActive] = (0, import_react8.useState)(null);
1697
- const [grown, setGrown] = (0, import_react8.useState)(false);
1698
1819
  const xKey = xKeyProp ?? inferXKey(data);
1699
- const series = (0, import_react8.useMemo)(
1700
- () => resolveSeries(seriesProp, data, xKey),
1701
- [seriesProp, data, xKey]
1702
- );
1703
- const pad = layout === "flush" ? PAD_FLUSH : PAD_DEFAULT;
1704
- const showXAxis = showXAxisProp ?? layout !== "flush";
1705
- const showYAxis = showYAxisProp ?? layout !== "flush";
1706
- const showLegend = showLegendProp ?? (layout !== "flush" && series.length > 1);
1707
- (0, import_react8.useEffect)(() => {
1708
- const t = requestAnimationFrame(() => setGrown(true));
1709
- return () => cancelAnimationFrame(t);
1710
- }, []);
1711
- const innerW = Math.max(0, width - pad.left - pad.right);
1712
- const innerH = Math.max(0, height - pad.top - pad.bottom);
1713
- const { minV, maxV } = (0, import_react8.useMemo)(() => {
1714
- let lo = 0;
1715
- let hi = yMax ?? 0;
1716
- for (const s of series) {
1717
- for (const d of data) {
1718
- const v = toNum(d[s.dataKey]);
1719
- if (v > hi && yMax == null) hi = v;
1720
- if (v < lo) lo = v;
1721
- }
1722
- }
1723
- if (hi === lo) hi = lo + 1;
1724
- return { minV: lo, maxV: yMax != null ? yMax : hi * 1.08 };
1725
- }, [series, data, yMax]);
1726
- const ticks = (0, import_react8.useMemo)(() => niceTicks(minV, maxV, 4), [minV, maxV]);
1820
+ const series = resolveSeries(seriesProp, data, xKey);
1821
+ const flush = layout === "flush";
1822
+ const horizontal = orientation === "horizontal" && variant === "bar";
1823
+ const showXAxis = showXAxisProp ?? !flush;
1824
+ const showYAxis = showYAxisProp ?? !flush;
1825
+ const showLegend = showLegendProp ?? (!flush && series.length > 1);
1826
+ const grid = gridLines ?? (horizontal ? "vertical" : "horizontal");
1727
1827
  if (data.length === 0 || series.length === 0) {
1728
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChartEmpty, { className, height });
1828
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ChartEmpty, { className, height, ariaLabel });
1729
1829
  }
1730
- const yScale = (v) => pad.top + innerH - (v - minV) / (maxV - minV || 1) * innerH;
1731
- const xCount = data.length;
1732
- const xStep = xCount > 1 ? innerW / (xCount - 1) : innerW;
1733
- const xPos = (i) => variant === "bar" ? pad.left + innerW * (i + 0.5) / xCount : pad.left + i * xStep;
1734
- const baseY = yScale(Math.max(0, minV));
1735
- const fmtV = (v) => formatValue ? formatValue(v) : formatCompact(v, unit);
1736
- const fmtX = (i) => formatX ? formatX(data[i]?.[xKey], i) : String(data[i]?.[xKey] ?? i);
1737
- const onMove = (event) => {
1738
- const rect = event.currentTarget.getBoundingClientRect();
1739
- const px2 = event.clientX - rect.left - pad.left;
1740
- const i = Math.round(px2 / (xStep || 1));
1741
- setActive(Math.max(0, Math.min(xCount - 1, i)));
1742
- };
1743
- const labelIdx = pickXLabels(xCount, innerW);
1744
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { ref, className: cn("relative w-full", className), style: { height }, children: [
1745
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1746
- "svg",
1830
+ const config = {};
1831
+ series.forEach((s, i) => {
1832
+ config[s.dataKey] = {
1833
+ label: s.label ?? s.dataKey,
1834
+ color: s.color ?? CHART_PALETTE[i % CHART_PALETTE.length]
1835
+ };
1836
+ });
1837
+ const valueFmt = (v) => formatValue ? formatValue(toNum(v)) : formatCompact(toNum(v), unit);
1838
+ const xFmt = (v, i) => formatX ? formatX(v, i) : String(v ?? "");
1839
+ const margin = flush ? { top: 8, right: 4, bottom: 0, left: 0 } : { top: 8, right: 12, bottom: 0, left: 0 };
1840
+ const showVGrid = showGrid && (grid === "vertical" || grid === "both");
1841
+ const showHGrid = showGrid && (grid === "horizontal" || grid === "both");
1842
+ const tooltipEl = showTooltip ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1843
+ ChartTooltip,
1844
+ {
1845
+ cursor: variant === "bar",
1846
+ content: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ChartTooltipContent, { indicator: tooltipIndicator })
1847
+ }
1848
+ ) : null;
1849
+ const legendEl = showLegend ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ChartLegend, { content: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ChartLegendContent, {}) }) : null;
1850
+ const gridEl = showGrid && grid !== "none" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_recharts.CartesianGrid, { vertical: showVGrid, horizontal: showHGrid, strokeDasharray: "4 4" }) : null;
1851
+ const yDomain = yMax != null ? [0, yMax] : void 0;
1852
+ if (variant === "bar") {
1853
+ const bars = series.map((s) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1854
+ import_recharts.Bar,
1747
1855
  {
1748
- width,
1749
- height,
1750
- role: "img",
1751
- "aria-label": ariaLabel,
1752
- className: "block overflow-visible",
1753
- children: [
1754
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("defs", { children: [
1755
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("clipPath", { id: `${uid}-grow`, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1756
- "rect",
1757
- {
1758
- x: pad.left,
1759
- y: 0,
1760
- height,
1761
- width: grown ? innerW : 0,
1762
- style: { transition: "width 900ms cubic-bezier(0.22,1,0.36,1)" }
1763
- }
1764
- ) }),
1765
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("linearGradient", { id: `${uid}-gridfade`, x1: "0%", x2: "100%", y1: "0", y2: "0", children: [
1766
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("stop", { offset: "0%", stopColor: "white", stopOpacity: 0 }),
1767
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("stop", { offset: "8%", stopColor: "white", stopOpacity: 1 }),
1768
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("stop", { offset: "92%", stopColor: "white", stopOpacity: 1 }),
1769
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("stop", { offset: "100%", stopColor: "white", stopOpacity: 0 })
1770
- ] }),
1771
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("mask", { id: `${uid}-gridmask`, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1772
- "rect",
1773
- {
1774
- x: pad.left,
1775
- y: pad.top,
1776
- width: innerW,
1777
- height: innerH,
1778
- fill: `url(#${uid}-gridfade)`
1779
- }
1780
- ) }),
1781
- series.map((s, i) => {
1782
- const color = s.color ?? CHART_PALETTE[i % CHART_PALETTE.length];
1783
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1784
- "linearGradient",
1785
- {
1786
- id: `${uid}-fill-${i}`,
1787
- x1: "0",
1788
- x2: "0",
1789
- y1: "0",
1790
- y2: "1",
1791
- children: [
1792
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("stop", { offset: "0%", style: { stopColor: color, stopOpacity: 0.28 } }),
1793
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("stop", { offset: "100%", style: { stopColor: color, stopOpacity: 0 } })
1794
- ]
1795
- },
1796
- s.dataKey
1797
- );
1798
- })
1799
- ] }),
1800
- showGrid && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("g", { mask: `url(#${uid}-gridmask)`, children: ticks.map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1801
- "line",
1802
- {
1803
- x1: pad.left,
1804
- x2: width - pad.right,
1805
- y1: yScale(t),
1806
- y2: yScale(t),
1807
- stroke: "currentColor",
1808
- strokeOpacity: 0.14,
1809
- strokeDasharray: "4 4",
1810
- className: "text-muted-foreground"
1811
- },
1812
- i
1813
- )) }),
1814
- showYAxis && ticks.map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1815
- "text",
1816
- {
1817
- x: pad.left - 8,
1818
- y: yScale(t),
1819
- textAnchor: "end",
1820
- dominantBaseline: "middle",
1821
- className: "fill-muted-foreground text-[10px] tabular-nums",
1822
- children: fmtV(t)
1823
- },
1824
- i
1825
- )),
1826
- showXAxis && labelIdx.map((i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1827
- "text",
1828
- {
1829
- x: xPos(i),
1830
- y: height - pad.bottom + 16,
1831
- textAnchor: i === 0 ? "start" : i === xCount - 1 ? "end" : "middle",
1832
- className: "fill-muted-foreground text-[10px] tabular-nums",
1833
- children: fmtX(i)
1834
- },
1835
- i
1836
- )),
1837
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("g", { clipPath: `url(#${uid}-grow)`, children: variant === "bar" ? renderBars({ data, series, xCount, xPos, yScale, baseY, innerW, uid }) : series.map((s, si) => {
1838
- const color = s.color ?? CHART_PALETTE[si % CHART_PALETTE.length];
1839
- const pts = data.map((d, i) => ({
1840
- x: xPos(i),
1841
- y: yScale(toNum(d[s.dataKey]))
1842
- }));
1843
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("g", { children: [
1844
- variant === "area" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: monotoneAreaPath(pts, baseY), fill: `url(#${uid}-fill-${si})` }),
1845
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1846
- "path",
1847
- {
1848
- d: monotoneLinePath(pts),
1849
- fill: "none",
1850
- stroke: color,
1851
- strokeWidth: 2,
1852
- strokeLinecap: "round",
1853
- strokeLinejoin: "round"
1854
- }
1855
- )
1856
- ] }, s.dataKey);
1857
- }) }),
1858
- showTooltip && active != null && variant !== "bar" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("g", { pointerEvents: "none", children: [
1859
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1860
- "line",
1861
- {
1862
- x1: xPos(active),
1863
- x2: xPos(active),
1864
- y1: pad.top,
1865
- y2: pad.top + innerH,
1866
- stroke: "currentColor",
1867
- strokeOpacity: 0.25,
1868
- className: "text-foreground"
1869
- }
1870
- ),
1871
- series.map((s, si) => {
1872
- const color = s.color ?? CHART_PALETTE[si % CHART_PALETTE.length];
1873
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1874
- "circle",
1875
- {
1876
- cx: xPos(active),
1877
- cy: yScale(toNum(data[active]?.[s.dataKey])),
1878
- r: 4,
1879
- fill: color,
1880
- stroke: "var(--background, #fff)",
1881
- strokeWidth: 2
1882
- },
1883
- s.dataKey
1884
- );
1885
- })
1886
- ] }),
1887
- showTooltip && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1888
- "rect",
1889
- {
1890
- x: pad.left,
1891
- y: pad.top,
1892
- width: innerW,
1893
- height: innerH,
1894
- fill: "transparent",
1895
- style: { cursor: "crosshair" },
1896
- onMouseMove: onMove,
1897
- onMouseLeave: () => setActive(null)
1898
- }
1899
- )
1900
- ]
1856
+ dataKey: s.dataKey,
1857
+ fill: `var(--color-${s.dataKey})`,
1858
+ radius: barCornerRadius(barRadius, horizontal, stacked),
1859
+ stackId: stacked ? "stack" : void 0,
1860
+ isAnimationActive: true
1861
+ },
1862
+ s.dataKey
1863
+ ));
1864
+ if (horizontal) {
1865
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ChartShell, { config, height, className, ariaLabel, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_recharts.BarChart, { accessibilityLayer: true, data, layout: "vertical", margin, children: [
1866
+ gridEl,
1867
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1868
+ import_recharts.XAxis,
1869
+ {
1870
+ type: "number",
1871
+ hide: !showXAxis,
1872
+ tickLine: false,
1873
+ axisLine: false,
1874
+ tickMargin: 8,
1875
+ tickFormatter: (v) => valueFmt(v),
1876
+ domain: yDomain
1877
+ }
1878
+ ),
1879
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1880
+ import_recharts.YAxis,
1881
+ {
1882
+ type: "category",
1883
+ dataKey: xKey,
1884
+ hide: !showYAxis,
1885
+ tickLine: false,
1886
+ axisLine: false,
1887
+ tickMargin: 8,
1888
+ width: showYAxis ? void 0 : 0,
1889
+ tickFormatter: (v, i) => xFmt(v, i)
1890
+ }
1891
+ ),
1892
+ tooltipEl,
1893
+ legendEl,
1894
+ bars
1895
+ ] }) });
1896
+ }
1897
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ChartShell, { config, height, className, ariaLabel, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_recharts.BarChart, { accessibilityLayer: true, data, margin, children: [
1898
+ gridEl,
1899
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1900
+ import_recharts.XAxis,
1901
+ {
1902
+ dataKey: xKey,
1903
+ hide: !showXAxis,
1904
+ tickLine: false,
1905
+ axisLine: false,
1906
+ tickMargin: 8,
1907
+ minTickGap: 16,
1908
+ tickFormatter: (v, i) => xFmt(v, i)
1909
+ }
1910
+ ),
1911
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1912
+ import_recharts.YAxis,
1913
+ {
1914
+ hide: !showYAxis,
1915
+ tickLine: false,
1916
+ axisLine: false,
1917
+ tickMargin: 8,
1918
+ width: showYAxis ? 44 : 0,
1919
+ tickFormatter: (v) => valueFmt(v),
1920
+ domain: yDomain
1921
+ }
1922
+ ),
1923
+ tooltipEl,
1924
+ legendEl,
1925
+ bars
1926
+ ] }) });
1927
+ }
1928
+ const axes = /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1929
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1930
+ import_recharts.XAxis,
1931
+ {
1932
+ dataKey: xKey,
1933
+ hide: !showXAxis,
1934
+ tickLine: false,
1935
+ axisLine: false,
1936
+ tickMargin: 8,
1937
+ minTickGap: 24,
1938
+ tickFormatter: (v, i) => xFmt(v, i)
1901
1939
  }
1902
1940
  ),
1903
- showTooltip && active != null && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1904
- ChartTooltip,
1941
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1942
+ import_recharts.YAxis,
1905
1943
  {
1906
- x: xPos(active),
1907
- width,
1908
- title: fmtX(active),
1909
- rows: series.map((s, si) => ({
1910
- color: s.color ?? CHART_PALETTE[si % CHART_PALETTE.length],
1911
- label: s.label ?? s.dataKey,
1912
- value: fmtV(toNum(data[active]?.[s.dataKey]))
1913
- }))
1944
+ hide: !showYAxis,
1945
+ tickLine: false,
1946
+ axisLine: false,
1947
+ tickMargin: 8,
1948
+ width: showYAxis ? 44 : 0,
1949
+ tickFormatter: (v) => valueFmt(v),
1950
+ domain: yDomain
1914
1951
  }
1915
- ),
1916
- showLegend ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChartLegend, { series }) : null
1952
+ )
1917
1953
  ] });
1918
- };
1919
- function renderBars(args) {
1920
- const { data, series, xCount, xPos, yScale, baseY, innerW } = args;
1921
- const groupWidth = innerW / xCount * 0.66;
1922
- const barWidth = groupWidth / series.length;
1923
- return series.flatMap(
1924
- (s, si) => data.map((d, i) => {
1925
- const color = s.color ?? CHART_PALETTE[si % CHART_PALETTE.length];
1926
- const y = yScale(toNum(d[s.dataKey]));
1927
- const x = xPos(i) - groupWidth / 2 + si * barWidth;
1928
- const top = Math.min(y, baseY);
1929
- const h = Math.max(1, Math.abs(y - baseY));
1930
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1931
- "rect",
1954
+ if (variant === "area") {
1955
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ChartShell, { config, height, className, ariaLabel, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_recharts.AreaChart, { accessibilityLayer: true, data, margin, children: [
1956
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("defs", { children: series.map((s) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("linearGradient", { id: `fill-${s.dataKey}`, x1: "0", y1: "0", x2: "0", y2: "1", children: [
1957
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("stop", { offset: "5%", stopColor: `var(--color-${s.dataKey})`, stopOpacity: 0.3 }),
1958
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("stop", { offset: "95%", stopColor: `var(--color-${s.dataKey})`, stopOpacity: 0.04 })
1959
+ ] }, s.dataKey)) }),
1960
+ gridEl,
1961
+ axes,
1962
+ tooltipEl,
1963
+ legendEl,
1964
+ series.map((s) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1965
+ import_recharts.Area,
1932
1966
  {
1933
- x,
1934
- y: top,
1935
- width: Math.max(1, barWidth - 2),
1936
- height: h,
1937
- rx: 3,
1938
- fill: color
1967
+ dataKey: s.dataKey,
1968
+ type: curve,
1969
+ stackId: stacked ? "stack" : void 0,
1970
+ stroke: `var(--color-${s.dataKey})`,
1971
+ strokeWidth: 2,
1972
+ fill: `url(#fill-${s.dataKey})`,
1973
+ dot: dots === true ? { r: 3 } : false,
1974
+ activeDot: { r: 4 },
1975
+ isAnimationActive: true
1939
1976
  },
1940
- `${s.dataKey}-${i}`
1941
- );
1942
- })
1943
- );
1944
- }
1945
- var ChartTooltip = ({ x, width, title, rows }) => {
1946
- const flip = x > width - 160;
1947
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1948
- "div",
1949
- {
1950
- className: "pointer-events-none absolute top-2 z-10 min-w-[8rem] rounded-lg border border-border bg-popover/95 px-2.5 py-2 text-popover-foreground shadow-card-elevated backdrop-blur-sm",
1951
- style: {
1952
- left: flip ? void 0 : Math.min(x + 12, width - 8),
1953
- right: flip ? Math.max(width - x + 12, 8) : void 0
1977
+ s.dataKey
1978
+ ))
1979
+ ] }) });
1980
+ }
1981
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ChartShell, { config, height, className, ariaLabel, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_recharts.LineChart, { accessibilityLayer: true, data, margin, children: [
1982
+ gridEl,
1983
+ axes,
1984
+ tooltipEl,
1985
+ legendEl,
1986
+ series.map((s) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1987
+ import_recharts.Line,
1988
+ {
1989
+ dataKey: s.dataKey,
1990
+ type: curve,
1991
+ stroke: `var(--color-${s.dataKey})`,
1992
+ strokeWidth: 2,
1993
+ dot: dots === true ? { r: 3 } : false,
1994
+ activeDot: { r: 4 },
1995
+ isAnimationActive: true
1954
1996
  },
1955
- children: [
1956
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mb-1.5 text-[11px] text-muted-foreground", children: title }),
1957
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex flex-col gap-1", children: rows.map((r) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
1958
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "inline-flex items-center gap-1.5 text-xs text-muted-foreground", children: [
1959
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1960
- "span",
1961
- {
1962
- className: "inline-block size-2 rounded-full",
1963
- style: { background: r.color }
1964
- }
1965
- ),
1966
- r.label
1967
- ] }),
1968
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs font-medium tabular-nums text-foreground", children: r.value })
1969
- ] }, r.label)) })
1970
- ]
1971
- }
1972
- );
1997
+ s.dataKey
1998
+ ))
1999
+ ] }) });
1973
2000
  };
1974
- var ChartLegend = ({ series }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 pl-10 text-xs text-muted-foreground", children: series.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "inline-flex items-center gap-1.5", children: [
1975
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1976
- "span",
1977
- {
1978
- className: "inline-block size-2 rounded-sm",
1979
- style: { background: s.color ?? CHART_PALETTE[i % CHART_PALETTE.length] }
1980
- }
1981
- ),
1982
- s.label ?? s.dataKey
1983
- ] }, s.dataKey)) });
1984
- var ChartEmpty = ({ className, height }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2001
+ var ChartShell = ({ config, height, className, ariaLabel, children }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2002
+ ChartContainer,
2003
+ {
2004
+ config,
2005
+ role: "img",
2006
+ "aria-label": ariaLabel,
2007
+ className: cn("aspect-auto w-full", className),
2008
+ style: { height },
2009
+ children
2010
+ }
2011
+ );
2012
+ var ChartEmpty = ({
2013
+ className,
2014
+ height,
2015
+ ariaLabel
2016
+ }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1985
2017
  "div",
1986
2018
  {
1987
2019
  className: cn(
@@ -1989,9 +2021,15 @@ var ChartEmpty = ({ className, height }) => /* @__PURE__ */ (0, import_jsx_runti
1989
2021
  className
1990
2022
  ),
1991
2023
  style: { height },
2024
+ role: "img",
2025
+ "aria-label": ariaLabel,
1992
2026
  children: "No data yet"
1993
2027
  }
1994
2028
  );
2029
+ function barCornerRadius(r, horizontal, stacked) {
2030
+ if (stacked) return r;
2031
+ return horizontal ? [0, r, r, 0] : [r, r, 0, 0];
2032
+ }
1995
2033
  function inferXKey(data) {
1996
2034
  if (data.length === 0) return "x";
1997
2035
  for (const k of Object.keys(data[0])) {
@@ -2006,21 +2044,304 @@ function resolveSeries(seriesProp, data, xKey) {
2006
2044
  if (data.length === 0) return [];
2007
2045
  return Object.keys(data[0]).filter((k) => k !== xKey && typeof data[0][k] === "number").map((dataKey) => ({ dataKey }));
2008
2046
  }
2009
- function pickXLabels(count, innerW) {
2010
- if (count <= 1) return [0];
2011
- const maxLabels = Math.max(2, Math.min(count, Math.floor(innerW / 64) + 1));
2012
- if (maxLabels >= count) return Array.from({ length: count }, (_, i) => i);
2013
- const out = /* @__PURE__ */ new Set([0, count - 1]);
2014
- const step = (count - 1) / (maxLabels - 1);
2015
- for (let i = 1; i < maxLabels - 1; i++) out.add(Math.round(i * step));
2016
- return [...out].sort((a, b) => a - b);
2047
+
2048
+ // src/charts/pie-chart.tsx
2049
+ var import_recharts2 = require("recharts");
2050
+ var import_jsx_runtime11 = require("react/jsx-runtime");
2051
+ var PieChart = ({
2052
+ data,
2053
+ nameKey: nameKeyProp,
2054
+ dataKey = "value",
2055
+ innerRadius = 0,
2056
+ colors,
2057
+ height = 260,
2058
+ showLegend = true,
2059
+ showLabels = false,
2060
+ showTooltip = true,
2061
+ tooltipIndicator = "dot",
2062
+ centerValue,
2063
+ centerLabel,
2064
+ className,
2065
+ ariaLabel = "Pie chart"
2066
+ }) => {
2067
+ const nameKey = nameKeyProp ?? inferNameKey(data, dataKey);
2068
+ const palette = colors ?? CHART_PALETTE;
2069
+ if (data.length === 0) {
2070
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PieEmpty, { className, height, ariaLabel });
2071
+ }
2072
+ const slices = data.map((d, i) => ({
2073
+ name: String(d[nameKey] ?? i),
2074
+ value: toNum(d[dataKey]),
2075
+ fill: palette[i % palette.length]
2076
+ }));
2077
+ const config = {};
2078
+ for (const s of slices) config[s.name] = { label: s.name };
2079
+ const innerPct = innerRadius > 0 ? `${Math.round(innerRadius * 75)}%` : 0;
2080
+ const hasCenter = innerRadius > 0 && (centerValue != null || centerLabel != null);
2081
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2082
+ ChartContainer,
2083
+ {
2084
+ config,
2085
+ role: "img",
2086
+ "aria-label": ariaLabel,
2087
+ className: cn("aspect-auto w-full", className),
2088
+ style: { height },
2089
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_recharts2.PieChart, { children: [
2090
+ showTooltip && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2091
+ ChartTooltip,
2092
+ {
2093
+ content: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ChartTooltipContent, { nameKey: "name", indicator: tooltipIndicator, hideLabel: true })
2094
+ }
2095
+ ),
2096
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2097
+ import_recharts2.Pie,
2098
+ {
2099
+ data: slices,
2100
+ dataKey: "value",
2101
+ nameKey: "name",
2102
+ innerRadius: innerPct,
2103
+ outerRadius: "75%",
2104
+ paddingAngle: innerRadius > 0 ? 2 : 0,
2105
+ strokeWidth: 2,
2106
+ label: showLabels,
2107
+ isAnimationActive: true,
2108
+ children: [
2109
+ slices.map((s) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_recharts2.Cell, { fill: s.fill }, s.name)),
2110
+ hasCenter && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2111
+ import_recharts2.Label,
2112
+ {
2113
+ content: ({ viewBox }) => {
2114
+ if (!viewBox || !("cx" in viewBox)) return null;
2115
+ const { cx, cy } = viewBox;
2116
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("text", { x: cx, y: cy, textAnchor: "middle", dominantBaseline: "middle", children: [
2117
+ centerValue != null && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("tspan", { x: cx, y: cy - 2, className: "fill-foreground text-2xl tabular-nums", children: centerValue }),
2118
+ centerLabel != null && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("tspan", { x: cx, y: cy + 18, className: "fill-muted-foreground text-[11px]", children: centerLabel })
2119
+ ] });
2120
+ }
2121
+ }
2122
+ )
2123
+ ]
2124
+ }
2125
+ ),
2126
+ showLegend && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ChartLegend, { content: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ChartLegendContent, { nameKey: "name" }) })
2127
+ ] })
2128
+ }
2129
+ );
2130
+ };
2131
+ var PieEmpty = ({
2132
+ className,
2133
+ height,
2134
+ ariaLabel
2135
+ }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2136
+ "div",
2137
+ {
2138
+ className: cn("flex w-full items-center justify-center text-xs text-muted-foreground", className),
2139
+ style: { height },
2140
+ role: "img",
2141
+ "aria-label": ariaLabel,
2142
+ children: "No data yet"
2143
+ }
2144
+ );
2145
+ function inferNameKey(data, dataKey) {
2146
+ if (data.length === 0) return "name";
2147
+ for (const k of Object.keys(data[0])) {
2148
+ if (k !== dataKey && typeof data[0][k] !== "number") return k;
2149
+ }
2150
+ return Object.keys(data[0]).find((k) => k !== dataKey) ?? "name";
2151
+ }
2152
+
2153
+ // src/charts/radial-chart.tsx
2154
+ var import_recharts3 = require("recharts");
2155
+ var import_jsx_runtime12 = require("react/jsx-runtime");
2156
+ var RadialChart = ({
2157
+ data,
2158
+ nameKey: nameKeyProp,
2159
+ dataKey = "value",
2160
+ maxValue,
2161
+ colors,
2162
+ height = 260,
2163
+ ringWidth = 16,
2164
+ ringGap = 4,
2165
+ showLegend = true,
2166
+ centerValue,
2167
+ centerLabel,
2168
+ className,
2169
+ ariaLabel = "Radial chart"
2170
+ }) => {
2171
+ const nameKey = nameKeyProp ?? inferNameKey2(data, dataKey);
2172
+ const palette = colors ?? CHART_PALETTE;
2173
+ if (data.length === 0) {
2174
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RadialEmpty, { className, height, ariaLabel });
2175
+ }
2176
+ const rows = data.map((d, i) => ({
2177
+ name: String(d[nameKey] ?? i),
2178
+ value: toNum(d[dataKey]),
2179
+ fill: palette[i % palette.length]
2180
+ }));
2181
+ const max = maxValue ?? Math.max(...rows.map((r) => r.value), 1);
2182
+ const config = {};
2183
+ for (const r of rows) config[r.name] = { label: r.name };
2184
+ const hasCenter = centerValue != null || centerLabel != null;
2185
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn("flex w-full flex-col items-center gap-3", className), children: [
2186
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2187
+ ChartContainer,
2188
+ {
2189
+ config,
2190
+ role: "img",
2191
+ "aria-label": ariaLabel,
2192
+ className: "aspect-auto w-full",
2193
+ style: { height: height - (showLegend ? 32 : 0) },
2194
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2195
+ import_recharts3.RadialBarChart,
2196
+ {
2197
+ data: rows,
2198
+ startAngle: 90,
2199
+ endAngle: -270,
2200
+ innerRadius: "30%",
2201
+ outerRadius: "100%",
2202
+ barSize: ringWidth,
2203
+ barGap: ringGap,
2204
+ children: [
2205
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_recharts3.PolarAngleAxis, { type: "number", domain: [0, max], tick: false, axisLine: false }),
2206
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChartTooltip, { content: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChartTooltipContent, { nameKey: "name", hideLabel: true }) }),
2207
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_recharts3.RadialBar, { dataKey: "value", background: true, cornerRadius: ringWidth / 2, isAnimationActive: true, children: rows.map((r) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_recharts3.Cell, { fill: r.fill }, r.name)) }),
2208
+ hasCenter && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_recharts3.PolarRadiusAxis, { tick: false, tickLine: false, axisLine: false, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2209
+ import_recharts3.Label,
2210
+ {
2211
+ content: ({ viewBox }) => {
2212
+ if (!viewBox || !("cx" in viewBox)) return null;
2213
+ const { cx, cy } = viewBox;
2214
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("text", { x: cx, y: cy, textAnchor: "middle", dominantBaseline: "middle", children: [
2215
+ centerValue != null && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tspan", { x: cx, y: cy - 2, className: "fill-foreground text-2xl tabular-nums", children: centerValue }),
2216
+ centerLabel != null && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tspan", { x: cx, y: cy + 18, className: "fill-muted-foreground text-[11px]", children: centerLabel })
2217
+ ] });
2218
+ }
2219
+ }
2220
+ ) })
2221
+ ]
2222
+ }
2223
+ )
2224
+ }
2225
+ ),
2226
+ showLegend && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex flex-wrap items-center justify-center gap-x-4 gap-y-1 text-xs text-muted-foreground", children: rows.map((r) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "inline-flex items-center gap-1.5", children: [
2227
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "inline-block size-2.5 rounded-[3px]", style: { background: r.fill } }),
2228
+ r.name
2229
+ ] }, r.name)) })
2230
+ ] });
2231
+ };
2232
+ var RadialEmpty = ({
2233
+ className,
2234
+ height,
2235
+ ariaLabel
2236
+ }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2237
+ "div",
2238
+ {
2239
+ className: cn("flex w-full items-center justify-center text-xs text-muted-foreground", className),
2240
+ style: { height },
2241
+ role: "img",
2242
+ "aria-label": ariaLabel,
2243
+ children: "No data yet"
2244
+ }
2245
+ );
2246
+ function inferNameKey2(data, dataKey) {
2247
+ if (data.length === 0) return "name";
2248
+ for (const k of Object.keys(data[0])) {
2249
+ if (k !== dataKey && typeof data[0][k] !== "number") return k;
2250
+ }
2251
+ return Object.keys(data[0]).find((k) => k !== dataKey) ?? "name";
2252
+ }
2253
+
2254
+ // src/charts/radar-chart.tsx
2255
+ var import_recharts4 = require("recharts");
2256
+ var import_jsx_runtime13 = require("react/jsx-runtime");
2257
+ var RadarChart = ({
2258
+ data,
2259
+ nameKey: nameKeyProp,
2260
+ series: seriesProp,
2261
+ maxValue,
2262
+ height = 280,
2263
+ showLegend = true,
2264
+ fill = true,
2265
+ className,
2266
+ ariaLabel = "Radar chart"
2267
+ }) => {
2268
+ const nameKey = nameKeyProp ?? inferNameKey3(data);
2269
+ const series = resolveSeries2(seriesProp, data, nameKey);
2270
+ if (data.length < 3 || series.length === 0) {
2271
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2272
+ "div",
2273
+ {
2274
+ className: cn("flex items-center justify-center text-xs text-muted-foreground", className),
2275
+ style: { height },
2276
+ role: "img",
2277
+ "aria-label": ariaLabel,
2278
+ children: "Radar needs at least 3 axes"
2279
+ }
2280
+ );
2281
+ }
2282
+ const config = {};
2283
+ series.forEach((s, i) => {
2284
+ config[s.dataKey] = {
2285
+ label: s.label ?? s.dataKey,
2286
+ color: s.color ?? CHART_PALETTE[i % CHART_PALETTE.length]
2287
+ };
2288
+ });
2289
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2290
+ ChartContainer,
2291
+ {
2292
+ config,
2293
+ role: "img",
2294
+ "aria-label": ariaLabel,
2295
+ className: cn("mx-auto aspect-square", className),
2296
+ style: { height },
2297
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_recharts4.RadarChart, { data, outerRadius: "70%", children: [
2298
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ChartTooltip, { content: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ChartTooltipContent, { indicator: "line" }) }),
2299
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_recharts4.PolarGrid, {}),
2300
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2301
+ import_recharts4.PolarAngleAxis,
2302
+ {
2303
+ dataKey: nameKey,
2304
+ tick: { fontSize: 10, fill: "var(--color-muted-foreground)" }
2305
+ }
2306
+ ),
2307
+ series.map((s) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2308
+ import_recharts4.Radar,
2309
+ {
2310
+ dataKey: s.dataKey,
2311
+ stroke: `var(--color-${s.dataKey})`,
2312
+ fill: `var(--color-${s.dataKey})`,
2313
+ fillOpacity: fill ? 0.18 : 0,
2314
+ strokeWidth: 2,
2315
+ dot: { r: 2.5, fillOpacity: 1 },
2316
+ isAnimationActive: true
2317
+ },
2318
+ s.dataKey
2319
+ )),
2320
+ showLegend && series.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ChartLegend, { content: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ChartLegendContent, {}) })
2321
+ ] })
2322
+ }
2323
+ );
2324
+ };
2325
+ function inferNameKey3(data) {
2326
+ if (data.length === 0) return "name";
2327
+ for (const k of Object.keys(data[0])) {
2328
+ if (typeof data[0][k] !== "number") return k;
2329
+ }
2330
+ return Object.keys(data[0])[0] ?? "name";
2331
+ }
2332
+ function resolveSeries2(seriesProp, data, nameKey) {
2333
+ if (seriesProp && seriesProp.length > 0) {
2334
+ return seriesProp.map((s) => typeof s === "string" ? { dataKey: s } : s);
2335
+ }
2336
+ if (data.length === 0) return [];
2337
+ return Object.keys(data[0]).filter((k) => k !== nameKey && typeof data[0][k] === "number").map((dataKey) => ({ dataKey }));
2017
2338
  }
2018
2339
 
2019
2340
  // src/artifacts/artifact-card.tsx
2020
- var import_jsx_runtime10 = require("react/jsx-runtime");
2341
+ var import_jsx_runtime14 = require("react/jsx-runtime");
2021
2342
  var ArtifactCard = ({ title, kind, className, bodyClassName, toolbar, children }) => {
2022
2343
  const hasHeader = Boolean(title || toolbar);
2023
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2344
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2024
2345
  "div",
2025
2346
  {
2026
2347
  className: cn(
@@ -2029,29 +2350,29 @@ var ArtifactCard = ({ title, kind, className, bodyClassName, toolbar, children }
2029
2350
  ),
2030
2351
  "data-artifact-kind": kind,
2031
2352
  children: [
2032
- hasHeader && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "aui-artifact-header flex items-center gap-2 border-b border-border/40 bg-muted/30 px-3 py-1.5", children: [
2033
- title && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "aui-artifact-title flex-1 truncate text-xs font-semibold text-foreground/80", children: title }),
2034
- !title && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "flex-1" }),
2353
+ hasHeader && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "aui-artifact-header flex items-center gap-2 border-b border-border/40 bg-muted/30 px-3 py-1.5", children: [
2354
+ title && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "aui-artifact-title flex-1 truncate text-xs font-semibold text-foreground/80", children: title }),
2355
+ !title && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "flex-1" }),
2035
2356
  toolbar
2036
2357
  ] }),
2037
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: cn("aui-artifact-body", bodyClassName), children })
2358
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cn("aui-artifact-body", bodyClassName), children })
2038
2359
  ]
2039
2360
  }
2040
2361
  );
2041
2362
  };
2042
2363
 
2043
2364
  // src/artifacts/chart-artifact.tsx
2044
- var import_jsx_runtime11 = require("react/jsx-runtime");
2365
+ var import_jsx_runtime15 = require("react/jsx-runtime");
2045
2366
  var ChartArtifactView = ({
2046
2367
  artifact,
2047
2368
  embedded = false,
2048
2369
  height = 300
2049
2370
  }) => {
2050
- const plot = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ChartArtifactPlot, { artifact, height });
2371
+ const plot = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChartArtifactPlot, { artifact, height });
2051
2372
  if (embedded) {
2052
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "aui-artifact-chart w-full", children: plot });
2373
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "aui-artifact-chart w-full", children: plot });
2053
2374
  }
2054
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ArtifactCard, { title: artifact.title, kind: "chart", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "aui-artifact-chart pt-2", children: plot }) });
2375
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ArtifactCard, { title: artifact.title, kind: "chart", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "aui-artifact-chart pt-2", children: plot }) });
2055
2376
  };
2056
2377
  function ChartArtifactPlot({
2057
2378
  artifact,
@@ -2059,14 +2380,58 @@ function ChartArtifactPlot({
2059
2380
  }) {
2060
2381
  const { chartType = "bar", data = [] } = artifact;
2061
2382
  const xKey = artifact.xKey ?? inferXKey2(data);
2062
- const series = (0, import_react9.useMemo)(() => {
2383
+ const series = (0, import_react7.useMemo)(() => {
2384
+ if (artifact.series && artifact.series.length > 0) {
2385
+ return artifact.series.map((s) => ({
2386
+ dataKey: s.dataKey,
2387
+ label: s.label,
2388
+ color: s.color
2389
+ }));
2390
+ }
2063
2391
  const keys = Array.isArray(artifact.dataKey) ? artifact.dataKey : typeof artifact.dataKey === "string" ? [artifact.dataKey] : inferDataKeys(data, xKey);
2064
- return keys.map((dataKey) => ({ dataKey }));
2065
- }, [artifact.dataKey, data, xKey]);
2066
- if (chartType === "pie") {
2067
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "px-3 pb-3 pt-2", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PieChart, { data, xKey, dataKey: series[0]?.dataKey ?? "value" }) });
2392
+ const colors = artifact.colors;
2393
+ return keys.map((dataKey, i) => ({
2394
+ dataKey,
2395
+ color: colors?.[i]
2396
+ }));
2397
+ }, [artifact.series, artifact.dataKey, artifact.colors, data, xKey]);
2398
+ const aria = typeof artifact.title === "string" ? artifact.title : "Chart";
2399
+ if (chartType === "pie" || chartType === "donut") {
2400
+ const total = data.reduce((sum, d) => sum + toNum(d[series[0]?.dataKey ?? "value"]), 0);
2401
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "px-3 pb-3 pt-2", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2402
+ PieChart,
2403
+ {
2404
+ data,
2405
+ nameKey: xKey,
2406
+ dataKey: series[0]?.dataKey ?? "value",
2407
+ innerRadius: chartType === "donut" ? 0.6 : 0,
2408
+ colors: artifact.colors,
2409
+ height,
2410
+ unit: artifact.unit,
2411
+ centerValue: chartType === "donut" ? formatCompact(total, artifact.unit) : void 0,
2412
+ centerLabel: chartType === "donut" ? "Total" : void 0,
2413
+ ariaLabel: aria
2414
+ }
2415
+ ) });
2068
2416
  }
2069
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2417
+ if (chartType === "radial") {
2418
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "px-3 pb-3 pt-2", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2419
+ RadialChart,
2420
+ {
2421
+ data,
2422
+ nameKey: xKey,
2423
+ dataKey: series[0]?.dataKey ?? "value",
2424
+ colors: artifact.colors,
2425
+ height,
2426
+ ariaLabel: aria
2427
+ }
2428
+ ) });
2429
+ }
2430
+ if (chartType === "radar") {
2431
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "px-3 pb-3 pt-2", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(RadarChart, { data, nameKey: xKey, series, height, ariaLabel: aria }) });
2432
+ }
2433
+ const horizontal = chartType === "horizontalBar";
2434
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2070
2435
  LineAreaChart,
2071
2436
  {
2072
2437
  data,
@@ -2075,71 +2440,19 @@ function ChartArtifactPlot({
2075
2440
  layout: "flush",
2076
2441
  height,
2077
2442
  variant: chartType === "line" ? "line" : chartType === "area" ? "area" : "bar",
2443
+ orientation: horizontal ? "horizontal" : "vertical",
2444
+ stacked: artifact.stacked,
2445
+ curve: artifact.curve,
2446
+ dots: artifact.dots,
2447
+ tooltipIndicator: artifact.tooltipIndicator,
2448
+ showXAxis: true,
2449
+ showYAxis: horizontal,
2450
+ showLegend: artifact.legend ?? series.length > 1,
2078
2451
  unit: artifact.unit,
2079
- ariaLabel: typeof artifact.title === "string" ? artifact.title : "Chart"
2452
+ ariaLabel: aria
2080
2453
  }
2081
2454
  );
2082
2455
  }
2083
- var PIE_W = 320;
2084
- var PIE_H = 220;
2085
- var PieChart = ({ data, xKey, dataKey }) => {
2086
- if (data.length === 0) {
2087
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex h-32 items-center justify-center text-xs text-muted-foreground", children: "No data" });
2088
- }
2089
- const cx = PIE_W / 2;
2090
- const cy = PIE_H / 2;
2091
- const r = Math.min(PIE_W, PIE_H) / 2 - 16;
2092
- const total = data.reduce((sum, d) => sum + toNum(d[dataKey]), 0) || 1;
2093
- let acc = 0;
2094
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col items-center gap-3", children: [
2095
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2096
- "svg",
2097
- {
2098
- viewBox: `0 0 ${PIE_W} ${PIE_H}`,
2099
- className: "w-full max-w-[20rem]",
2100
- role: "img",
2101
- "aria-label": "Pie chart",
2102
- children: data.map((d, i) => {
2103
- const value = toNum(d[dataKey]);
2104
- const start = acc / total * Math.PI * 2;
2105
- acc += value;
2106
- const end = acc / total * Math.PI * 2;
2107
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2108
- PieSlice,
2109
- {
2110
- cx,
2111
- cy,
2112
- r,
2113
- start,
2114
- end,
2115
- color: CHART_PALETTE[i % CHART_PALETTE.length]
2116
- },
2117
- i
2118
- );
2119
- })
2120
- }
2121
- ),
2122
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex flex-wrap items-center justify-center gap-x-3 gap-y-1 text-xs text-muted-foreground", children: data.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "inline-flex items-center gap-1.5", children: [
2123
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2124
- "span",
2125
- {
2126
- className: "inline-block size-2 rounded-sm",
2127
- style: { background: CHART_PALETTE[i % CHART_PALETTE.length] }
2128
- }
2129
- ),
2130
- String(d[xKey] ?? i)
2131
- ] }, i)) })
2132
- ] });
2133
- };
2134
- var PieSlice = ({ cx, cy, r, start, end, color }) => {
2135
- const x1 = cx + Math.sin(start) * r;
2136
- const y1 = cy - Math.cos(start) * r;
2137
- const x2 = cx + Math.sin(end) * r;
2138
- const y2 = cy - Math.cos(end) * r;
2139
- const large = end - start > Math.PI ? 1 : 0;
2140
- const path = `M ${cx} ${cy} L ${x1} ${y1} A ${r} ${r} 0 ${large} 1 ${x2} ${y2} Z`;
2141
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: path, fill: color, stroke: "var(--background, #fff)", strokeWidth: 1.5 });
2142
- };
2143
2456
  function inferXKey2(data) {
2144
2457
  if (data.length === 0) return "x";
2145
2458
  for (const k of Object.keys(data[0])) {
@@ -2155,8 +2468,8 @@ function inferDataKeys(data, xKey) {
2155
2468
  }
2156
2469
 
2157
2470
  // src/artifacts/question-artifact.tsx
2158
- var import_react10 = require("react");
2159
- var import_react11 = require("@assistant-ui/react");
2471
+ var import_react8 = require("react");
2472
+ var import_react9 = require("@assistant-ui/react");
2160
2473
  var import_lucide_react3 = require("lucide-react");
2161
2474
 
2162
2475
  // src/design/classes.ts
@@ -2271,12 +2584,12 @@ var studioQuestionOptionSelectedClass = cn(
2271
2584
  );
2272
2585
 
2273
2586
  // src/artifacts/question-artifact.tsx
2274
- var import_jsx_runtime12 = require("react/jsx-runtime");
2587
+ var import_jsx_runtime16 = require("react/jsx-runtime");
2275
2588
  function optionKey(option, index) {
2276
2589
  const id = option.id?.trim();
2277
2590
  return id ? id : `__option-${index}`;
2278
2591
  }
2279
- var OptionRadio = ({ selected }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2592
+ var OptionRadio = ({ selected }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2280
2593
  "span",
2281
2594
  {
2282
2595
  className: cn(
@@ -2284,18 +2597,18 @@ var OptionRadio = ({ selected }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx
2284
2597
  selected ? "border-foreground bg-foreground text-background" : "border-border bg-background"
2285
2598
  ),
2286
2599
  "aria-hidden": true,
2287
- children: selected ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react3.CheckIcon, { className: "size-2.5 stroke-[3]" }) : null
2600
+ children: selected ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react3.CheckIcon, { className: "size-2.5 stroke-[3]" }) : null
2288
2601
  }
2289
2602
  );
2290
2603
  var QuestionArtifactView = ({
2291
2604
  artifact
2292
2605
  }) => {
2293
- const runtime = (0, import_react11.useThreadRuntime)();
2294
- const [selected, setSelected] = (0, import_react10.useState)([]);
2295
- const [submittedIds, setSubmittedIds] = (0, import_react10.useState)(null);
2606
+ const runtime = (0, import_react9.useThreadRuntime)();
2607
+ const [selected, setSelected] = (0, import_react8.useState)([]);
2608
+ const [submittedIds, setSubmittedIds] = (0, import_react8.useState)(null);
2296
2609
  const isMulti = artifact.multi === true;
2297
2610
  const isDisabled = submittedIds !== null;
2298
- const send = (0, import_react10.useCallback)(
2611
+ const send = (0, import_react8.useCallback)(
2299
2612
  (keys) => {
2300
2613
  if (keys.length === 0) return;
2301
2614
  const labels = artifact.options.map((option, index) => ({ option, key: optionKey(option, index) })).filter(({ key }) => keys.includes(key)).map(({ option }) => option.label);
@@ -2307,7 +2620,7 @@ var QuestionArtifactView = ({
2307
2620
  },
2308
2621
  [artifact.options, runtime]
2309
2622
  );
2310
- const onPick = (0, import_react10.useCallback)(
2623
+ const onPick = (0, import_react8.useCallback)(
2311
2624
  (key) => {
2312
2625
  if (isDisabled) return;
2313
2626
  if (!isMulti) {
@@ -2320,15 +2633,15 @@ var QuestionArtifactView = ({
2320
2633
  },
2321
2634
  [isDisabled, isMulti, send]
2322
2635
  );
2323
- const onConfirm = (0, import_react10.useCallback)(() => {
2636
+ const onConfirm = (0, import_react8.useCallback)(() => {
2324
2637
  send(selected);
2325
2638
  }, [selected, send]);
2326
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: studioArtifactShellClass, "data-artifact-kind": "question", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "px-2.5 py-2", children: [
2327
- artifact.prompt ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mb-2 text-sm font-normal leading-snug text-foreground", children: artifact.prompt }) : null,
2328
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex flex-col gap-0.5", role: "list", children: artifact.options.map((option, index) => {
2639
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: studioArtifactShellClass, "data-artifact-kind": "question", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "px-2.5 py-2", children: [
2640
+ artifact.prompt ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "mb-2 text-sm font-normal leading-snug text-foreground", children: artifact.prompt }) : null,
2641
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex flex-col gap-0.5", role: "list", children: artifact.options.map((option, index) => {
2329
2642
  const key = optionKey(option, index);
2330
2643
  const isSelected = submittedIds ? submittedIds.includes(key) : isMulti && selected.includes(key);
2331
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2644
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
2332
2645
  "button",
2333
2646
  {
2334
2647
  type: "button",
@@ -2340,17 +2653,17 @@ var QuestionArtifactView = ({
2340
2653
  isDisabled && (isSelected ? "cursor-default" : "cursor-not-allowed opacity-50")
2341
2654
  ),
2342
2655
  children: [
2343
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(OptionRadio, { selected: isSelected }),
2344
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "min-w-0 flex-1 text-left", children: [
2345
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "block font-normal text-foreground", children: option.label }),
2346
- option.description ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: option.description }) : null
2656
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(OptionRadio, { selected: isSelected }),
2657
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "min-w-0 flex-1 text-left", children: [
2658
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "block font-normal text-foreground", children: option.label }),
2659
+ option.description ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: option.description }) : null
2347
2660
  ] })
2348
2661
  ]
2349
2662
  },
2350
2663
  key
2351
2664
  );
2352
2665
  }) }),
2353
- isMulti && !submittedIds ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "mt-2 flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2666
+ isMulti && !submittedIds ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "mt-2 flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2354
2667
  TimbalV2Button,
2355
2668
  {
2356
2669
  type: "button",
@@ -2365,12 +2678,12 @@ var QuestionArtifactView = ({
2365
2678
  };
2366
2679
 
2367
2680
  // src/artifacts/html-artifact.tsx
2368
- var import_jsx_runtime13 = require("react/jsx-runtime");
2681
+ var import_jsx_runtime17 = require("react/jsx-runtime");
2369
2682
  var HtmlArtifactView = ({ artifact }) => {
2370
2683
  const sandboxed = artifact.sandboxed !== false;
2371
2684
  const sandbox = sandboxed ? "allow-scripts allow-same-origin allow-forms allow-modals allow-popups allow-pointer-lock" : void 0;
2372
2685
  const height = artifact.height ?? "320px";
2373
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ArtifactCard, { title: artifact.title, kind: "html", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2686
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ArtifactCard, { title: artifact.title, kind: "html", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2374
2687
  "iframe",
2375
2688
  {
2376
2689
  title: artifact.title ?? "HTML artifact",
@@ -2383,7 +2696,7 @@ var HtmlArtifactView = ({ artifact }) => {
2383
2696
  };
2384
2697
 
2385
2698
  // src/artifacts/json-artifact.tsx
2386
- var import_jsx_runtime14 = require("react/jsx-runtime");
2699
+ var import_jsx_runtime18 = require("react/jsx-runtime");
2387
2700
  var JsonArtifactView = ({
2388
2701
  artifact
2389
2702
  }) => {
@@ -2395,16 +2708,16 @@ var JsonArtifactView = ({
2395
2708
  } catch {
2396
2709
  body = String(data);
2397
2710
  }
2398
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ArtifactCard, { title, kind: "json", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("pre", { className: "aui-artifact-json m-0 max-h-[420px] overflow-auto p-3 font-mono text-[12px] leading-relaxed text-foreground/85", children: body }) });
2711
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ArtifactCard, { title, kind: "json", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("pre", { className: "aui-artifact-json m-0 max-h-[420px] overflow-auto p-3 font-mono text-[12px] leading-relaxed text-foreground/85", children: body }) });
2399
2712
  };
2400
2713
 
2401
2714
  // src/artifacts/table-artifact.tsx
2402
- var import_jsx_runtime15 = require("react/jsx-runtime");
2715
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2403
2716
  var TableArtifactView = ({ artifact }) => {
2404
2717
  const rows = artifact.rows ?? [];
2405
2718
  const columns = artifact.columns ?? deriveColumns(rows);
2406
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ArtifactCard, { title: artifact.title, kind: "table", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "aui-artifact-table-wrap overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("table", { className: "aui-artifact-table w-full border-collapse text-sm", children: [
2407
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tr", { className: "border-b border-border/40 bg-muted/20", children: columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2719
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ArtifactCard, { title: artifact.title, kind: "table", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "aui-artifact-table-wrap overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("table", { className: "aui-artifact-table w-full border-collapse text-sm", children: [
2720
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("tr", { className: "border-b border-border/40 bg-muted/20", children: columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2408
2721
  "th",
2409
2722
  {
2410
2723
  className: "px-3 py-2 text-left text-xs font-semibold uppercase tracking-wider text-muted-foreground",
@@ -2412,11 +2725,11 @@ var TableArtifactView = ({ artifact }) => {
2412
2725
  },
2413
2726
  col.key
2414
2727
  )) }) }),
2415
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tbody", { children: rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2728
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("tbody", { children: rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2416
2729
  "tr",
2417
2730
  {
2418
2731
  className: "border-b border-border/30 transition-colors last:border-b-0 hover:bg-muted/20",
2419
- children: columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2732
+ children: columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2420
2733
  "td",
2421
2734
  {
2422
2735
  className: "px-3 py-2 align-top text-foreground/85",
@@ -2449,7 +2762,7 @@ function formatCell(value) {
2449
2762
  }
2450
2763
 
2451
2764
  // src/artifacts/ui/ui-artifact.tsx
2452
- var import_react16 = require("react");
2765
+ var import_react14 = require("react");
2453
2766
 
2454
2767
  // src/artifacts/ui/types.ts
2455
2768
  function isUiBinding(value) {
@@ -2502,38 +2815,38 @@ function resolveBindable(value, state) {
2502
2815
  }
2503
2816
 
2504
2817
  // src/artifacts/ui/registry.tsx
2505
- var import_react12 = require("react");
2506
- var import_jsx_runtime16 = require("react/jsx-runtime");
2507
- var UiStateContext = (0, import_react12.createContext)({});
2508
- var UiDispatchContext = (0, import_react12.createContext)(() => {
2818
+ var import_react10 = require("react");
2819
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2820
+ var UiStateContext = (0, import_react10.createContext)({});
2821
+ var UiDispatchContext = (0, import_react10.createContext)(() => {
2509
2822
  });
2510
- var UiStateProvider = ({ state, dispatch, children }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(UiStateContext.Provider, { value: state, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(UiDispatchContext.Provider, { value: dispatch, children }) });
2823
+ var UiStateProvider = ({ state, dispatch, children }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(UiStateContext.Provider, { value: state, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(UiDispatchContext.Provider, { value: dispatch, children }) });
2511
2824
  function useUiState() {
2512
- return (0, import_react12.useContext)(UiStateContext);
2825
+ return (0, import_react10.useContext)(UiStateContext);
2513
2826
  }
2514
2827
  function useUiDispatch() {
2515
- return (0, import_react12.useContext)(UiDispatchContext);
2828
+ return (0, import_react10.useContext)(UiDispatchContext);
2516
2829
  }
2517
- var UiEventContext = (0, import_react12.createContext)(
2830
+ var UiEventContext = (0, import_react10.createContext)(
2518
2831
  null
2519
2832
  );
2520
- var UiEventProvider = ({ onEvent, children }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(UiEventContext.Provider, { value: onEvent, children });
2833
+ var UiEventProvider = ({ onEvent, children }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(UiEventContext.Provider, { value: onEvent, children });
2521
2834
  function useUiEventEmitter() {
2522
- return (0, import_react12.useContext)(UiEventContext);
2835
+ return (0, import_react10.useContext)(UiEventContext);
2523
2836
  }
2524
- var UiCustomNodeRegistryContext = (0, import_react12.createContext)({});
2837
+ var UiCustomNodeRegistryContext = (0, import_react10.createContext)({});
2525
2838
  function useUiCustomNodeRegistry() {
2526
- return (0, import_react12.useContext)(UiCustomNodeRegistryContext);
2839
+ return (0, import_react10.useContext)(UiCustomNodeRegistryContext);
2527
2840
  }
2528
2841
 
2529
2842
  // src/artifacts/ui/nodes.tsx
2530
- var import_react13 = require("react");
2531
- var import_react14 = require("motion/react");
2532
- var import_react15 = require("@assistant-ui/react");
2843
+ var import_react11 = require("react");
2844
+ var import_react12 = require("motion/react");
2845
+ var import_react13 = require("@assistant-ui/react");
2533
2846
 
2534
2847
  // src/ui/button.tsx
2535
2848
  var import_class_variance_authority = require("class-variance-authority");
2536
- var import_jsx_runtime17 = require("react/jsx-runtime");
2849
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2537
2850
  var LEGACY_SIZE_TO_V2 = {
2538
2851
  default: "md",
2539
2852
  xs: "xs",
@@ -2583,7 +2896,7 @@ function Button({
2583
2896
  const v2Variant = TIMBAL_V2_FROM_LEGACY_BUTTON[variant ?? "default"];
2584
2897
  const v2Size = LEGACY_SIZE_TO_V2[size ?? "default"];
2585
2898
  const isIconOnly = typeof size === "string" && size.startsWith("icon");
2586
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2899
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2587
2900
  TimbalV2Button,
2588
2901
  {
2589
2902
  "data-slot": "button",
@@ -2601,29 +2914,29 @@ function Button({
2601
2914
  }
2602
2915
 
2603
2916
  // src/artifacts/ui/nodes.tsx
2604
- var import_jsx_runtime18 = require("react/jsx-runtime");
2917
+ var import_jsx_runtime22 = require("react/jsx-runtime");
2605
2918
  var UiNodeView = ({ node }) => {
2606
2919
  switch (node.kind) {
2607
2920
  case "box":
2608
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(BoxNode, { node });
2921
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(BoxNode, { node });
2609
2922
  case "text":
2610
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TextNode, { node });
2923
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TextNode, { node });
2611
2924
  case "heading":
2612
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(HeadingNode, { node });
2925
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(HeadingNode, { node });
2613
2926
  case "badge":
2614
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(BadgeNode, { node });
2927
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(BadgeNode, { node });
2615
2928
  case "button":
2616
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ButtonNode, { node });
2929
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonNode, { node });
2617
2930
  case "toggle":
2618
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ToggleNode, { node });
2931
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToggleNode, { node });
2619
2932
  case "slider":
2620
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SliderNode, { node });
2933
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SliderNode, { node });
2621
2934
  case "tooltip":
2622
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TooltipNode, { node });
2935
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipNode, { node });
2623
2936
  case "draggable":
2624
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DraggableNode, { node });
2937
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DraggableNode, { node });
2625
2938
  case "custom":
2626
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CustomNode, { node });
2939
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CustomNode, { node });
2627
2940
  default:
2628
2941
  return null;
2629
2942
  }
@@ -2631,9 +2944,9 @@ var UiNodeView = ({ node }) => {
2631
2944
  function useActionRunner() {
2632
2945
  const state = useUiState();
2633
2946
  const dispatch = useUiDispatch();
2634
- const runtime = (0, import_react15.useThreadRuntime)();
2947
+ const runtime = (0, import_react13.useThreadRuntime)();
2635
2948
  const emit = useUiEventEmitter();
2636
- return (0, import_react13.useCallback)(
2949
+ return (0, import_react11.useCallback)(
2637
2950
  (actions) => {
2638
2951
  if (!actions) return;
2639
2952
  const list = Array.isArray(actions) ? actions : [actions];
@@ -2683,7 +2996,7 @@ var JUSTIFY_CLS = {
2683
2996
  };
2684
2997
  var BoxNode = ({ node }) => {
2685
2998
  const dir = node.direction ?? "col";
2686
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2999
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2687
3000
  "div",
2688
3001
  {
2689
3002
  className: cn(
@@ -2698,7 +3011,7 @@ var BoxNode = ({ node }) => {
2698
3011
  gap: node.gap !== void 0 ? `${node.gap * 0.25}rem` : void 0,
2699
3012
  padding: node.padding !== void 0 ? `${node.padding * 0.25}rem` : void 0
2700
3013
  },
2701
- children: node.children?.map((child, i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(UiNodeView, { node: child }, child.id ?? i))
3014
+ children: node.children?.map((child, i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(UiNodeView, { node: child }, child.id ?? i))
2702
3015
  }
2703
3016
  );
2704
3017
  };
@@ -2717,7 +3030,7 @@ var TEXT_WEIGHT = {
2717
3030
  var TextNode = ({ node }) => {
2718
3031
  const state = useUiState();
2719
3032
  const value = resolveBindable(node.value, state);
2720
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3033
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2721
3034
  "span",
2722
3035
  {
2723
3036
  className: cn(
@@ -2748,13 +3061,13 @@ var HeadingNode = ({ node }) => {
2748
3061
  );
2749
3062
  switch (level) {
2750
3063
  case 1:
2751
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h1", { className: cls, children: value });
3064
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h1", { className: cls, children: value });
2752
3065
  case 2:
2753
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h2", { className: cls, children: value });
3066
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h2", { className: cls, children: value });
2754
3067
  case 3:
2755
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h3", { className: cls, children: value });
3068
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h3", { className: cls, children: value });
2756
3069
  case 4:
2757
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h4", { className: cls, children: value });
3070
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h4", { className: cls, children: value });
2758
3071
  }
2759
3072
  };
2760
3073
  var BADGE_TONE = {
@@ -2767,7 +3080,7 @@ var BADGE_TONE = {
2767
3080
  var BadgeNode = ({ node }) => {
2768
3081
  const state = useUiState();
2769
3082
  const value = String(resolveBindable(node.value, state) ?? "");
2770
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3083
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2771
3084
  "span",
2772
3085
  {
2773
3086
  className: cn(
@@ -2784,7 +3097,7 @@ var ButtonNode = ({ node }) => {
2784
3097
  const run = useActionRunner();
2785
3098
  const label = String(resolveBindable(node.label, state) ?? "");
2786
3099
  const disabled = node.disabled !== void 0 ? Boolean(resolveBindable(node.disabled, state)) : false;
2787
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3100
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2788
3101
  Button,
2789
3102
  {
2790
3103
  variant: node.variant ?? "default",
@@ -2806,7 +3119,7 @@ var ToggleNode = ({ node }) => {
2806
3119
  dispatch({ type: "toggle", path: node.binding });
2807
3120
  run(node.onChange);
2808
3121
  };
2809
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3122
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2810
3123
  "label",
2811
3124
  {
2812
3125
  className: cn(
@@ -2814,7 +3127,7 @@ var ToggleNode = ({ node }) => {
2814
3127
  node.className
2815
3128
  ),
2816
3129
  children: [
2817
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3130
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2818
3131
  "button",
2819
3132
  {
2820
3133
  type: "button",
@@ -2825,7 +3138,7 @@ var ToggleNode = ({ node }) => {
2825
3138
  "relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-[background,box-shadow,border-color] duration-200",
2826
3139
  value ? "border-foreground/15 bg-gradient-to-b from-primary-fill-from to-primary-fill-to shadow-card" : cn(TIMBAL_V2_SWITCH_TRACK_OFF, "hover:from-secondary-fill-hover-from hover:to-secondary-fill-hover-to")
2827
3140
  ),
2828
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3141
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2829
3142
  "span",
2830
3143
  {
2831
3144
  className: cn(
@@ -2838,7 +3151,7 @@ var ToggleNode = ({ node }) => {
2838
3151
  )
2839
3152
  }
2840
3153
  ),
2841
- label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-foreground/85", children: label })
3154
+ label && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-foreground/85", children: label })
2842
3155
  ]
2843
3156
  }
2844
3157
  );
@@ -2858,12 +3171,12 @@ var SliderNode = ({ node }) => {
2858
3171
  const next = Number(e.target.value);
2859
3172
  dispatch({ type: "set", path: node.binding, value: next });
2860
3173
  };
2861
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: cn("aui-ui-slider flex flex-col gap-1", node.className), children: [
2862
- (label || showValue) && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center justify-between text-xs text-muted-foreground", children: [
2863
- label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: label }),
2864
- showValue && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "font-mono", children: value })
3174
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: cn("aui-ui-slider flex flex-col gap-1", node.className), children: [
3175
+ (label || showValue) && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center justify-between text-xs text-muted-foreground", children: [
3176
+ label && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: label }),
3177
+ showValue && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "font-mono", children: value })
2865
3178
  ] }),
2866
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3179
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2867
3180
  "input",
2868
3181
  {
2869
3182
  type: "range",
@@ -2885,9 +3198,9 @@ var SliderNode = ({ node }) => {
2885
3198
  var TooltipNode = ({ node }) => {
2886
3199
  const state = useUiState();
2887
3200
  const content = String(resolveBindable(node.content, state) ?? "");
2888
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Tooltip, { children: [
2889
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: cn("aui-ui-tooltip-trigger inline-flex", node.className), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(UiNodeView, { node: node.child }) }) }),
2890
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TooltipContent, { side: node.side ?? "top", children: content })
3201
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
3202
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: cn("aui-ui-tooltip-trigger inline-flex", node.className), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(UiNodeView, { node: node.child }) }) }),
3203
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: node.side ?? "top", children: content })
2891
3204
  ] }) });
2892
3205
  };
2893
3206
  var DraggableNode = ({ node }) => {
@@ -2895,8 +3208,8 @@ var DraggableNode = ({ node }) => {
2895
3208
  const snapBack = node.snapBack ?? true;
2896
3209
  const axis = node.axis ?? "both";
2897
3210
  const dragProp = axis === "both" ? true : axis;
2898
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2899
- import_react14.motion.div,
3211
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3212
+ import_react12.motion.div,
2900
3213
  {
2901
3214
  drag: dragProp,
2902
3215
  dragMomentum: false,
@@ -2907,7 +3220,7 @@ var DraggableNode = ({ node }) => {
2907
3220
  "aui-ui-draggable inline-block cursor-grab touch-none",
2908
3221
  node.className
2909
3222
  ),
2910
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(UiNodeView, { node: node.child })
3223
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(UiNodeView, { node: node.child })
2911
3224
  }
2912
3225
  );
2913
3226
  };
@@ -2917,8 +3230,8 @@ var CustomNode = ({ node }) => {
2917
3230
  const Renderer = registry[node.name];
2918
3231
  if (!Renderer) return null;
2919
3232
  const resolvedProps = resolveProps(node.props ?? {}, state);
2920
- const children = node.children?.map((child, i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(UiNodeView, { node: child }, child.id ?? i));
2921
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Renderer, { props: resolvedProps, children });
3233
+ const children = node.children?.map((child, i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(UiNodeView, { node: child }, child.id ?? i));
3234
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Renderer, { props: resolvedProps, children });
2922
3235
  };
2923
3236
  function resolveProps(props, state) {
2924
3237
  const out = {};
@@ -2929,17 +3242,17 @@ function resolveProps(props, state) {
2929
3242
  }
2930
3243
 
2931
3244
  // src/artifacts/ui/ui-artifact.tsx
2932
- var import_jsx_runtime19 = require("react/jsx-runtime");
3245
+ var import_jsx_runtime23 = require("react/jsx-runtime");
2933
3246
  var UiArtifactView = ({ artifact }) => {
2934
- const [state, dispatch] = (0, import_react16.useReducer)(
3247
+ const [state, dispatch] = (0, import_react14.useReducer)(
2935
3248
  uiStateReducer,
2936
3249
  artifact.initialState ?? {}
2937
3250
  );
2938
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ArtifactCard, { title: artifact.title, kind: "ui", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(UiStateProvider, { state, dispatch, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "aui-ui-root p-3", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(UiNodeView, { node: artifact.root }) }) }) });
3251
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ArtifactCard, { title: artifact.title, kind: "ui", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(UiStateProvider, { state, dispatch, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "aui-ui-root p-3", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(UiNodeView, { node: artifact.root }) }) }) });
2939
3252
  };
2940
3253
 
2941
3254
  // src/artifacts/registry.tsx
2942
- var import_jsx_runtime20 = require("react/jsx-runtime");
3255
+ var import_jsx_runtime24 = require("react/jsx-runtime");
2943
3256
  var defaultArtifactRenderers = {
2944
3257
  chart: ChartArtifactView,
2945
3258
  question: QuestionArtifactView,
@@ -2948,25 +3261,25 @@ var defaultArtifactRenderers = {
2948
3261
  table: TableArtifactView,
2949
3262
  ui: UiArtifactView
2950
3263
  };
2951
- var ArtifactRegistryContext = (0, import_react17.createContext)(
3264
+ var ArtifactRegistryContext = (0, import_react15.createContext)(
2952
3265
  defaultArtifactRenderers
2953
3266
  );
2954
3267
  var ArtifactRegistryProvider = ({ renderers, override, children }) => {
2955
- const merged = (0, import_react17.useMemo)(() => {
3268
+ const merged = (0, import_react15.useMemo)(() => {
2956
3269
  if (!renderers) return defaultArtifactRenderers;
2957
3270
  if (override) return renderers;
2958
3271
  return { ...defaultArtifactRenderers, ...renderers };
2959
3272
  }, [renderers, override]);
2960
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ArtifactRegistryContext.Provider, { value: merged, children });
3273
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ArtifactRegistryContext.Provider, { value: merged, children });
2961
3274
  };
2962
3275
  function useArtifactRegistry() {
2963
- return (0, import_react17.useContext)(ArtifactRegistryContext);
3276
+ return (0, import_react15.useContext)(ArtifactRegistryContext);
2964
3277
  }
2965
3278
  var ArtifactView = ({ artifact }) => {
2966
3279
  const registry = useArtifactRegistry();
2967
3280
  const Renderer = registry[artifact.type] ?? registry.json;
2968
3281
  if (!Renderer) return null;
2969
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Renderer, { artifact });
3282
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Renderer, { artifact });
2970
3283
  };
2971
3284
 
2972
3285
  // src/artifacts/parse.ts
@@ -3042,7 +3355,7 @@ var import_c = __toESM(require("shiki/langs/c.mjs"), 1);
3042
3355
  var import_cpp = __toESM(require("shiki/langs/cpp.mjs"), 1);
3043
3356
  var import_vitesse_dark = __toESM(require("shiki/themes/vitesse-dark.mjs"), 1);
3044
3357
  var import_vitesse_light = __toESM(require("shiki/themes/vitesse-light.mjs"), 1);
3045
- var import_jsx_runtime21 = require("react/jsx-runtime");
3358
+ var import_jsx_runtime25 = require("react/jsx-runtime");
3046
3359
  var SHIKI_THEME_DARK = "vitesse-dark";
3047
3360
  var SHIKI_THEME_LIGHT = "vitesse-light";
3048
3361
  var highlighterPromise = null;
@@ -3080,8 +3393,8 @@ var ShikiSyntaxHighlighter = ({
3080
3393
  language,
3081
3394
  code
3082
3395
  }) => {
3083
- const [html, setHtml] = (0, import_react18.useState)(null);
3084
- (0, import_react18.useEffect)(() => {
3396
+ const [html, setHtml] = (0, import_react16.useState)(null);
3397
+ (0, import_react16.useEffect)(() => {
3085
3398
  let cancelled = false;
3086
3399
  (async () => {
3087
3400
  try {
@@ -3111,13 +3424,13 @@ var ShikiSyntaxHighlighter = ({
3111
3424
  try {
3112
3425
  const parsed = JSON.parse(code);
3113
3426
  if (isArtifact(parsed)) {
3114
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ArtifactView, { artifact: parsed });
3427
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ArtifactView, { artifact: parsed });
3115
3428
  }
3116
3429
  } catch {
3117
3430
  }
3118
3431
  }
3119
3432
  if (html) {
3120
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3433
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3121
3434
  "div",
3122
3435
  {
3123
3436
  className: "shiki-wrapper [&>pre]:!m-0 [&>pre]:!rounded-t-none [&>pre]:!rounded-b-lg [&>pre]:!border [&>pre]:!border-t-0 [&>pre]:!border-border/50 [&>pre]:!p-3 [&>pre]:!text-xs [&>pre]:!leading-relaxed [&>pre]:overflow-x-auto",
@@ -3125,14 +3438,14 @@ var ShikiSyntaxHighlighter = ({
3125
3438
  }
3126
3439
  );
3127
3440
  }
3128
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Pre, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Code2, { children: code }) });
3441
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Pre, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Code2, { children: code }) });
3129
3442
  };
3130
3443
  var syntax_highlighter_default = ShikiSyntaxHighlighter;
3131
3444
 
3132
3445
  // src/chat/markdown-text.tsx
3133
- var import_jsx_runtime22 = require("react/jsx-runtime");
3446
+ var import_jsx_runtime26 = require("react/jsx-runtime");
3134
3447
  var MarkdownTextImpl = () => {
3135
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3448
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3136
3449
  import_react_markdown.MarkdownTextPrimitive,
3137
3450
  {
3138
3451
  remarkPlugins: [import_remark_gfm.default, import_remark_math.default],
@@ -3145,7 +3458,7 @@ var MarkdownTextImpl = () => {
3145
3458
  }
3146
3459
  );
3147
3460
  };
3148
- var MarkdownText = (0, import_react19.memo)(MarkdownTextImpl);
3461
+ var MarkdownText = (0, import_react17.memo)(MarkdownTextImpl);
3149
3462
  var CodeHeader = ({ language, code }) => {
3150
3463
  const { isCopied, copyToClipboard } = useCopyToClipboard();
3151
3464
  if (isArtifactFenceLanguage(language)) return null;
@@ -3153,20 +3466,20 @@ var CodeHeader = ({ language, code }) => {
3153
3466
  if (!code || isCopied) return;
3154
3467
  copyToClipboard(code);
3155
3468
  };
3156
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "aui-code-header flex items-center justify-between rounded-t-lg border border-b-0 border-border/50 bg-code-header-bg px-4 py-2", children: [
3157
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "flex items-center gap-2 text-xs font-semibold tracking-wide text-muted-foreground/80 uppercase", children: [
3158
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-block h-2 w-2 rounded-full bg-primary/40" }),
3469
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "aui-code-header flex items-center justify-between rounded-t-lg border border-b-0 border-border/50 bg-code-header-bg px-4 py-2", children: [
3470
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex items-center gap-2 text-xs font-semibold tracking-wide text-muted-foreground/80 uppercase", children: [
3471
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "inline-block h-2 w-2 rounded-full bg-primary/40" }),
3159
3472
  language
3160
3473
  ] }),
3161
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
3474
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3162
3475
  TooltipIconButton,
3163
3476
  {
3164
3477
  tooltip: isCopied ? "Copied!" : "Copy",
3165
3478
  onClick: onCopy,
3166
3479
  className: "transition-colors hover:text-foreground",
3167
3480
  children: [
3168
- !isCopied && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react4.CopyIcon, { className: "h-3.5 w-3.5" }),
3169
- isCopied && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react4.CheckIcon, { className: "h-3.5 w-3.5 text-emerald-500" })
3481
+ !isCopied && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react4.CopyIcon, { className: "h-3.5 w-3.5" }),
3482
+ isCopied && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react4.CheckIcon, { className: "h-3.5 w-3.5 text-emerald-500" })
3170
3483
  ]
3171
3484
  }
3172
3485
  )
@@ -3175,7 +3488,7 @@ var CodeHeader = ({ language, code }) => {
3175
3488
  var useCopyToClipboard = ({
3176
3489
  copiedDuration = 3e3
3177
3490
  } = {}) => {
3178
- const [isCopied, setIsCopied] = (0, import_react19.useState)(false);
3491
+ const [isCopied, setIsCopied] = (0, import_react17.useState)(false);
3179
3492
  const copyToClipboard = (value) => {
3180
3493
  if (!value) return;
3181
3494
  navigator.clipboard.writeText(value).then(() => {
@@ -3186,7 +3499,7 @@ var useCopyToClipboard = ({
3186
3499
  return { isCopied, copyToClipboard };
3187
3500
  };
3188
3501
  var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownComponents)({
3189
- h1: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3502
+ h1: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3190
3503
  "h1",
3191
3504
  {
3192
3505
  className: cn(
@@ -3196,7 +3509,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3196
3509
  ...props
3197
3510
  }
3198
3511
  ),
3199
- h2: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3512
+ h2: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3200
3513
  "h2",
3201
3514
  {
3202
3515
  className: cn(
@@ -3206,7 +3519,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3206
3519
  ...props
3207
3520
  }
3208
3521
  ),
3209
- h3: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3522
+ h3: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3210
3523
  "h3",
3211
3524
  {
3212
3525
  className: cn(
@@ -3216,7 +3529,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3216
3529
  ...props
3217
3530
  }
3218
3531
  ),
3219
- h4: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3532
+ h4: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3220
3533
  "h4",
3221
3534
  {
3222
3535
  className: cn(
@@ -3226,7 +3539,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3226
3539
  ...props
3227
3540
  }
3228
3541
  ),
3229
- h5: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3542
+ h5: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3230
3543
  "h5",
3231
3544
  {
3232
3545
  className: cn(
@@ -3236,7 +3549,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3236
3549
  ...props
3237
3550
  }
3238
3551
  ),
3239
- h6: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3552
+ h6: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3240
3553
  "h6",
3241
3554
  {
3242
3555
  className: cn(
@@ -3246,7 +3559,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3246
3559
  ...props
3247
3560
  }
3248
3561
  ),
3249
- p: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3562
+ p: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3250
3563
  "p",
3251
3564
  {
3252
3565
  className: cn(
@@ -3256,7 +3569,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3256
3569
  ...props
3257
3570
  }
3258
3571
  ),
3259
- a: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3572
+ a: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3260
3573
  "a",
3261
3574
  {
3262
3575
  className: cn(
@@ -3268,7 +3581,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3268
3581
  ...props
3269
3582
  }
3270
3583
  ),
3271
- blockquote: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3584
+ blockquote: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3272
3585
  "blockquote",
3273
3586
  {
3274
3587
  className: cn(
@@ -3278,7 +3591,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3278
3591
  ...props
3279
3592
  }
3280
3593
  ),
3281
- ul: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3594
+ ul: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3282
3595
  "ul",
3283
3596
  {
3284
3597
  className: cn(
@@ -3288,7 +3601,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3288
3601
  ...props
3289
3602
  }
3290
3603
  ),
3291
- ol: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3604
+ ol: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3292
3605
  "ol",
3293
3606
  {
3294
3607
  className: cn(
@@ -3298,7 +3611,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3298
3611
  ...props
3299
3612
  }
3300
3613
  ),
3301
- hr: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3614
+ hr: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3302
3615
  "hr",
3303
3616
  {
3304
3617
  className: cn(
@@ -3308,14 +3621,14 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3308
3621
  ...props
3309
3622
  }
3310
3623
  ),
3311
- table: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "my-4 w-full overflow-x-auto rounded-lg border border-border/50", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3624
+ table: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "my-4 w-full overflow-x-auto rounded-lg border border-border/50", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3312
3625
  "table",
3313
3626
  {
3314
3627
  className: cn("aui-md-table w-full border-collapse text-sm", className),
3315
3628
  ...props
3316
3629
  }
3317
3630
  ) }),
3318
- th: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3631
+ th: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3319
3632
  "th",
3320
3633
  {
3321
3634
  className: cn(
@@ -3325,7 +3638,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3325
3638
  ...props
3326
3639
  }
3327
3640
  ),
3328
- td: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3641
+ td: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3329
3642
  "td",
3330
3643
  {
3331
3644
  className: cn(
@@ -3335,7 +3648,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3335
3648
  ...props
3336
3649
  }
3337
3650
  ),
3338
- tr: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3651
+ tr: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3339
3652
  "tr",
3340
3653
  {
3341
3654
  className: cn(
@@ -3345,8 +3658,8 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3345
3658
  ...props
3346
3659
  }
3347
3660
  ),
3348
- li: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("li", { className: cn("aui-md-li leading-[1.7]", className), ...props }),
3349
- sup: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3661
+ li: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("li", { className: cn("aui-md-li leading-[1.7]", className), ...props }),
3662
+ sup: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3350
3663
  "sup",
3351
3664
  {
3352
3665
  className: cn(
@@ -3356,7 +3669,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3356
3669
  ...props
3357
3670
  }
3358
3671
  ),
3359
- pre: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3672
+ pre: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3360
3673
  "pre",
3361
3674
  {
3362
3675
  className: cn(
@@ -3368,7 +3681,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3368
3681
  ),
3369
3682
  code: function Code({ className, ...props }) {
3370
3683
  const isCodeBlock = (0, import_react_markdown.useIsMarkdownCodeBlock)();
3371
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3684
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3372
3685
  "code",
3373
3686
  {
3374
3687
  className: cn(
@@ -3379,20 +3692,20 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3379
3692
  }
3380
3693
  );
3381
3694
  },
3382
- strong: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("strong", { className: cn("font-semibold text-foreground", className), ...props }),
3383
- em: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("em", { className: cn("italic", className), ...props }),
3695
+ strong: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("strong", { className: cn("font-semibold text-foreground", className), ...props }),
3696
+ em: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("em", { className: cn("italic", className), ...props }),
3384
3697
  CodeHeader
3385
3698
  });
3386
3699
 
3387
3700
  // src/chat/tool-fallback.tsx
3388
- var import_react23 = require("react");
3701
+ var import_react21 = require("react");
3389
3702
  var import_lucide_react5 = require("lucide-react");
3390
- var import_react24 = require("@assistant-ui/react");
3703
+ var import_react22 = require("@assistant-ui/react");
3391
3704
 
3392
3705
  // src/ui/shimmer.tsx
3393
- var import_react20 = require("motion/react");
3394
- var import_react21 = require("react");
3395
- var import_jsx_runtime23 = require("react/jsx-runtime");
3706
+ var import_react18 = require("motion/react");
3707
+ var import_react19 = require("react");
3708
+ var import_jsx_runtime27 = require("react/jsx-runtime");
3396
3709
  var ShimmerComponent = ({
3397
3710
  children,
3398
3711
  as: Component = "p",
@@ -3400,14 +3713,14 @@ var ShimmerComponent = ({
3400
3713
  duration = 2,
3401
3714
  spread = 2
3402
3715
  }) => {
3403
- const MotionComponent = import_react20.motion.create(
3716
+ const MotionComponent = import_react18.motion.create(
3404
3717
  Component
3405
3718
  );
3406
- const dynamicSpread = (0, import_react21.useMemo)(
3719
+ const dynamicSpread = (0, import_react19.useMemo)(
3407
3720
  () => (children?.length ?? 0) * spread,
3408
3721
  [children, spread]
3409
3722
  );
3410
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3723
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3411
3724
  MotionComponent,
3412
3725
  {
3413
3726
  animate: { backgroundPosition: "0% center" },
@@ -3430,11 +3743,11 @@ var ShimmerComponent = ({
3430
3743
  }
3431
3744
  );
3432
3745
  };
3433
- var Shimmer = (0, import_react21.memo)(ShimmerComponent);
3746
+ var Shimmer = (0, import_react19.memo)(ShimmerComponent);
3434
3747
 
3435
3748
  // src/chat/motion.tsx
3436
- var import_react22 = require("motion/react");
3437
- var import_jsx_runtime24 = require("react/jsx-runtime");
3749
+ var import_react20 = require("motion/react");
3750
+ var import_jsx_runtime28 = require("react/jsx-runtime");
3438
3751
  var luxuryEase = [0.16, 1, 0.3, 1];
3439
3752
  var TOOL_ENTER_MS = 0.78;
3440
3753
  var TOOL_EXIT_MS = 0.28;
@@ -3460,10 +3773,10 @@ function toolMotionState(reduced, entering, variant) {
3460
3773
  return entering ? { opacity: 0, y: 14, filter: "blur(10px)" } : { opacity: 1, y: 0, filter: "blur(0px)" };
3461
3774
  }
3462
3775
  function ToolMotion({ children, className, motionKey }) {
3463
- const reduced = (0, import_react22.useReducedMotion)() ?? false;
3776
+ const reduced = (0, import_react20.useReducedMotion)() ?? false;
3464
3777
  const { enter, exit } = toolPresenceTransition(reduced);
3465
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3466
- import_react22.motion.div,
3778
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3779
+ import_react20.motion.div,
3467
3780
  {
3468
3781
  className: cn("aui-tool-motion w-full min-w-0", className),
3469
3782
  initial: toolMotionState(reduced, true, "settled"),
@@ -3482,11 +3795,11 @@ function ToolPresence({
3482
3795
  className,
3483
3796
  variant = "settled"
3484
3797
  }) {
3485
- const reduced = (0, import_react22.useReducedMotion)() ?? false;
3798
+ const reduced = (0, import_react20.useReducedMotion)() ?? false;
3486
3799
  const { enter, exit } = toolPresenceTransition(reduced);
3487
3800
  const enterTransition = variant === "executing" ? { duration: reduced ? 0.3 : 0.52, ease: luxuryEase } : enter;
3488
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react22.AnimatePresence, { mode: "wait", initial: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3489
- import_react22.motion.div,
3801
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react20.AnimatePresence, { mode: "wait", initial: true, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3802
+ import_react20.motion.div,
3490
3803
  {
3491
3804
  className: cn("aui-tool-presence w-full min-w-0", className),
3492
3805
  initial: toolMotionState(reduced, true, variant),
@@ -3506,8 +3819,8 @@ function ToolBodyPresence({
3506
3819
  children,
3507
3820
  className
3508
3821
  }) {
3509
- const reduced = (0, import_react22.useReducedMotion)() ?? false;
3510
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3822
+ const reduced = (0, import_react20.useReducedMotion)() ?? false;
3823
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3511
3824
  "div",
3512
3825
  {
3513
3826
  className: cn(
@@ -3515,7 +3828,7 @@ function ToolBodyPresence({
3515
3828
  open ? reduced ? "duration-200 ease-out" : "duration-[340ms] ease-[cubic-bezier(0.16,1,0.3,1)]" : reduced ? "duration-150 ease-[cubic-bezier(0.4,0,0.2,1)]" : "duration-200 ease-[cubic-bezier(0.4,0,0.2,1)]"
3516
3829
  ),
3517
3830
  style: { gridTemplateRows: open ? "1fr" : "0fr" },
3518
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "min-h-0 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3831
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "min-h-0 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3519
3832
  "div",
3520
3833
  {
3521
3834
  className: cn(
@@ -3531,7 +3844,7 @@ function ToolBodyPresence({
3531
3844
  }
3532
3845
 
3533
3846
  // src/chat/tool-fallback.tsx
3534
- var import_jsx_runtime25 = require("react/jsx-runtime");
3847
+ var import_jsx_runtime29 = require("react/jsx-runtime");
3535
3848
  function detectRunning({
3536
3849
  status,
3537
3850
  result,
@@ -3545,7 +3858,7 @@ function detectRunning({
3545
3858
  }
3546
3859
  function useToolRunning(props) {
3547
3860
  const { isRunning: streamRunning } = useTimbalRuntime();
3548
- const partStatus = (0, import_react24.useAuiState)((s) => s.part.status);
3861
+ const partStatus = (0, import_react22.useAuiState)((s) => s.part.status);
3549
3862
  return detectRunning({
3550
3863
  status: partStatus ?? props.status,
3551
3864
  result: props.result,
@@ -3563,8 +3876,8 @@ function formatToolResult(result) {
3563
3876
  return String(result);
3564
3877
  }
3565
3878
  }
3566
- var TimelineActionLabel = ({ action, detail, shimmer = false }) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "inline-flex min-w-0 max-w-full items-baseline gap-1", children: [
3567
- action ? shimmer ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3879
+ var TimelineActionLabel = ({ action, detail, shimmer = false }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "inline-flex min-w-0 max-w-full items-baseline gap-1", children: [
3880
+ action ? shimmer ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3568
3881
  Shimmer,
3569
3882
  {
3570
3883
  as: "span",
@@ -3573,10 +3886,10 @@ var TimelineActionLabel = ({ action, detail, shimmer = false }) => /* @__PURE__
3573
3886
  spread: 2.5,
3574
3887
  children: action
3575
3888
  }
3576
- ) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: studioTimelineActionClass, children: action }) : null,
3577
- detail ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: studioTimelineDetailClass, children: detail }) : null
3889
+ ) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: studioTimelineActionClass, children: action }) : null,
3890
+ detail ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: studioTimelineDetailClass, children: detail }) : null
3578
3891
  ] });
3579
- var TimelineHoverChevron = ({ expanded }) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3892
+ var TimelineHoverChevron = ({ expanded }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3580
3893
  import_lucide_react5.ChevronRightIcon,
3581
3894
  {
3582
3895
  className: studioTimelineChevronClass(expanded),
@@ -3584,9 +3897,9 @@ var TimelineHoverChevron = ({ expanded }) => /* @__PURE__ */ (0, import_jsx_runt
3584
3897
  }
3585
3898
  );
3586
3899
  var ToolPanel = ({ toolName, argsText, result, isError }) => {
3587
- const [open, setOpen] = (0, import_react23.useState)(false);
3900
+ const [open, setOpen] = (0, import_react21.useState)(false);
3588
3901
  const detail = formatToolLabel(toolName);
3589
- const formattedArgs = (0, import_react23.useMemo)(() => {
3902
+ const formattedArgs = (0, import_react21.useMemo)(() => {
3590
3903
  if (!argsText || argsText === "{}") return null;
3591
3904
  try {
3592
3905
  return JSON.stringify(JSON.parse(argsText), null, 2);
@@ -3594,17 +3907,17 @@ var ToolPanel = ({ toolName, argsText, result, isError }) => {
3594
3907
  return argsText;
3595
3908
  }
3596
3909
  }, [argsText]);
3597
- const formattedResult = (0, import_react23.useMemo)(() => {
3910
+ const formattedResult = (0, import_react21.useMemo)(() => {
3598
3911
  if (result === void 0 || result === null) return null;
3599
3912
  return formatToolResult(result);
3600
3913
  }, [result]);
3601
3914
  const hasBody = Boolean(formattedArgs || formattedResult);
3602
3915
  const action = isError ? "Failed" : "Used";
3603
3916
  if (!hasBody) {
3604
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "aui-tool-row w-full min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TimelineActionLabel, { action, detail }) });
3917
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "aui-tool-row w-full min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TimelineActionLabel, { action, detail }) });
3605
3918
  }
3606
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "aui-tool-row w-full min-w-0", children: [
3607
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3919
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "aui-tool-row w-full min-w-0", children: [
3920
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3608
3921
  "button",
3609
3922
  {
3610
3923
  type: "button",
@@ -3612,7 +3925,7 @@ var ToolPanel = ({ toolName, argsText, result, isError }) => {
3612
3925
  "aria-expanded": open,
3613
3926
  "aria-label": `${action} ${detail}`,
3614
3927
  className: studioTimelineRowButtonClass,
3615
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3928
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3616
3929
  "span",
3617
3930
  {
3618
3931
  className: cn(
@@ -3621,37 +3934,37 @@ var ToolPanel = ({ toolName, argsText, result, isError }) => {
3621
3934
  "text-foreground"
3622
3935
  ),
3623
3936
  children: [
3624
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TimelineActionLabel, { action, detail }),
3625
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TimelineHoverChevron, { expanded: open })
3937
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TimelineActionLabel, { action, detail }),
3938
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TimelineHoverChevron, { expanded: open })
3626
3939
  ]
3627
3940
  }
3628
3941
  )
3629
3942
  }
3630
3943
  ),
3631
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3944
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3632
3945
  ToolBodyPresence,
3633
3946
  {
3634
3947
  open,
3635
3948
  className: cn(studioTimelineBodyPadClass, "gap-2"),
3636
3949
  children: [
3637
- formattedArgs ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3950
+ formattedArgs ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3638
3951
  "div",
3639
3952
  {
3640
3953
  className: cn(
3641
3954
  studioComposerIoWellClass,
3642
3955
  "max-h-48 overflow-auto px-2.5 py-2"
3643
3956
  ),
3644
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("pre", { className: "whitespace-pre-wrap break-words font-mono text-[11px] font-normal leading-relaxed text-foreground", children: formattedArgs })
3957
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("pre", { className: "whitespace-pre-wrap break-words font-mono text-[11px] font-normal leading-relaxed text-foreground", children: formattedArgs })
3645
3958
  }
3646
3959
  ) : null,
3647
- formattedResult ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3960
+ formattedResult ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3648
3961
  "div",
3649
3962
  {
3650
3963
  className: cn(
3651
3964
  studioComposerIoWellClass,
3652
3965
  "max-h-48 overflow-auto px-2.5 py-2"
3653
3966
  ),
3654
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("pre", { className: "whitespace-pre-wrap break-words font-mono text-[11px] font-normal leading-relaxed text-foreground", children: formattedResult })
3967
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("pre", { className: "whitespace-pre-wrap break-words font-mono text-[11px] font-normal leading-relaxed text-foreground", children: formattedResult })
3655
3968
  }
3656
3969
  ) : null
3657
3970
  ]
@@ -3668,20 +3981,20 @@ var ToolFallbackImpl = ({
3668
3981
  const isRunning = useToolRunning({ status, result });
3669
3982
  const isError = status?.type === "incomplete" && status.reason !== "cancelled";
3670
3983
  const presenceKey = isRunning ? "running" : isError ? "error" : "complete";
3671
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3984
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3672
3985
  ToolPresence,
3673
3986
  {
3674
3987
  presenceKey,
3675
3988
  variant: isRunning ? "executing" : "settled",
3676
3989
  className: "py-0.5",
3677
- children: isRunning ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "aui-tool-running", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3990
+ children: isRunning ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "aui-tool-running", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3678
3991
  TimelineActionLabel,
3679
3992
  {
3680
3993
  action: "Using",
3681
3994
  detail: formatToolLabel(toolName),
3682
3995
  shimmer: true
3683
3996
  }
3684
- ) }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3997
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3685
3998
  ToolPanel,
3686
3999
  {
3687
4000
  toolName,
@@ -3693,13 +4006,13 @@ var ToolFallbackImpl = ({
3693
4006
  }
3694
4007
  );
3695
4008
  };
3696
- var ToolFallback = (0, import_react23.memo)(
4009
+ var ToolFallback = (0, import_react21.memo)(
3697
4010
  ToolFallbackImpl
3698
4011
  );
3699
4012
  ToolFallback.displayName = "ToolFallback";
3700
4013
 
3701
4014
  // src/artifacts/tool-artifact.tsx
3702
- var import_jsx_runtime26 = require("react/jsx-runtime");
4015
+ var import_jsx_runtime30 = require("react/jsx-runtime");
3703
4016
  var ToolArtifactFallback = (props) => {
3704
4017
  const registry = useArtifactRegistry();
3705
4018
  const isRunning = useToolRunning({
@@ -3711,24 +4024,24 @@ var ToolArtifactFallback = (props) => {
3711
4024
  if (artifact) {
3712
4025
  const Renderer = registry[artifact.type];
3713
4026
  if (Renderer) {
3714
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4027
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3715
4028
  ToolMotion,
3716
4029
  {
3717
4030
  motionKey: `artifact-${artifact.type}`,
3718
4031
  className: "aui-tool-artifact",
3719
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Renderer, { artifact })
4032
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Renderer, { artifact })
3720
4033
  }
3721
4034
  );
3722
4035
  }
3723
4036
  }
3724
4037
  }
3725
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ToolFallback, { ...props });
4038
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ToolFallback, { ...props });
3726
4039
  };
3727
4040
 
3728
4041
  // src/chat/composer.tsx
3729
- var import_react25 = require("@assistant-ui/react");
4042
+ var import_react23 = require("@assistant-ui/react");
3730
4043
  var import_lucide_react6 = require("lucide-react");
3731
- var import_jsx_runtime27 = require("react/jsx-runtime");
4044
+ var import_jsx_runtime31 = require("react/jsx-runtime");
3732
4045
  var Composer = ({
3733
4046
  placeholder = "Send a message...",
3734
4047
  showAttachments,
@@ -3739,10 +4052,10 @@ var Composer = ({
3739
4052
  }) => {
3740
4053
  const attachmentsEnabled = useTimbalAttachmentsEnabled();
3741
4054
  const attachUi = showAttachments !== false && attachmentsEnabled;
3742
- const shell = /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
3743
- attachUi && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ComposerAttachments, {}),
3744
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ComposerInput, { placeholder, autoFocus: !noAutoFocus }),
3745
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4055
+ const shell = /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
4056
+ attachUi && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ComposerAttachments, {}),
4057
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ComposerInput, { placeholder, autoFocus: !noAutoFocus }),
4058
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
3746
4059
  ComposerToolbar,
3747
4060
  {
3748
4061
  showAttachments: attachUi,
@@ -3751,15 +4064,15 @@ var Composer = ({
3751
4064
  }
3752
4065
  )
3753
4066
  ] });
3754
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3755
- import_react25.ComposerPrimitive.Root,
4067
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4068
+ import_react23.ComposerPrimitive.Root,
3756
4069
  {
3757
4070
  className: cn(
3758
4071
  "aui-composer-root relative flex w-full flex-col",
3759
4072
  className
3760
4073
  ),
3761
- children: attachUi ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3762
- import_react25.ComposerPrimitive.AttachmentDropzone,
4074
+ children: attachUi ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4075
+ import_react23.ComposerPrimitive.AttachmentDropzone,
3763
4076
  {
3764
4077
  className: cn(
3765
4078
  studioComposeInputShellClass,
@@ -3767,7 +4080,7 @@ var Composer = ({
3767
4080
  ),
3768
4081
  children: shell
3769
4082
  }
3770
- ) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: studioComposeInputShellClass, children: shell })
4083
+ ) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: studioComposeInputShellClass, children: shell })
3771
4084
  }
3772
4085
  );
3773
4086
  };
@@ -3775,7 +4088,7 @@ var ComposerInput = ({
3775
4088
  placeholder,
3776
4089
  autoFocus
3777
4090
  }) => {
3778
- const composer = (0, import_react25.useComposerRuntime)();
4091
+ const composer = (0, import_react23.useComposerRuntime)();
3779
4092
  const onKeyDown = (e) => {
3780
4093
  if (e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing) {
3781
4094
  e.preventDefault();
@@ -3787,8 +4100,8 @@ var ComposerInput = ({
3787
4100
  el.style.height = "auto";
3788
4101
  el.style.height = `${Math.min(el.scrollHeight, 240)}px`;
3789
4102
  };
3790
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3791
- import_react25.ComposerPrimitive.Input,
4103
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4104
+ import_react23.ComposerPrimitive.Input,
3792
4105
  {
3793
4106
  placeholder,
3794
4107
  className: "aui-composer-input max-h-60 min-h-14 w-full resize-none bg-composer-bg px-3 pt-3 pb-1 text-sm outline-none placeholder:text-muted-foreground/70 focus-visible:ring-0",
@@ -3801,17 +4114,17 @@ var ComposerInput = ({
3801
4114
  );
3802
4115
  };
3803
4116
  var ComposerToolbar = ({ showAttachments, toolbar, sendTooltip }) => {
3804
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "aui-composer-action-wrapper relative z-[1] flex items-center justify-between gap-1 bg-composer-bg px-2.5 pb-2.5", children: [
3805
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-1", children: [
3806
- showAttachments && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ComposerAddAttachment, {}),
4117
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "aui-composer-action-wrapper relative z-[1] flex items-center justify-between gap-1 bg-composer-bg px-2.5 pb-2.5", children: [
4118
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-1", children: [
4119
+ showAttachments && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ComposerAddAttachment, {}),
3807
4120
  toolbar
3808
4121
  ] }),
3809
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ComposerSendOrCancel, { sendTooltip })
4122
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ComposerSendOrCancel, { sendTooltip })
3810
4123
  ] });
3811
4124
  };
3812
4125
  var ComposerSendOrCancel = ({ sendTooltip }) => {
3813
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
3814
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react25.AuiIf, { condition: (s) => !s.thread.isRunning, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react25.ComposerPrimitive.Send, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4126
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
4127
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react23.AuiIf, { condition: (s) => !s.thread.isRunning, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react23.ComposerPrimitive.Send, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
3815
4128
  TooltipIconButton,
3816
4129
  {
3817
4130
  tooltip: sendTooltip,
@@ -3819,34 +4132,34 @@ var ComposerSendOrCancel = ({ sendTooltip }) => {
3819
4132
  type: "submit",
3820
4133
  className: "aui-composer-send shrink-0 disabled:opacity-30",
3821
4134
  "aria-label": "Send message",
3822
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react6.ArrowUpIcon, { className: "aui-composer-send-icon size-4" })
4135
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react6.ArrowUpIcon, { className: "aui-composer-send-icon size-4" })
3823
4136
  }
3824
4137
  ) }) }),
3825
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react25.AuiIf, { condition: (s) => s.thread.isRunning, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react25.ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4138
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react23.AuiIf, { condition: (s) => s.thread.isRunning, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react23.ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
3826
4139
  TooltipIconButton,
3827
4140
  {
3828
4141
  tooltip: "Stop generating",
3829
4142
  variant: "primary",
3830
4143
  className: "aui-composer-cancel shrink-0",
3831
4144
  "aria-label": "Stop generating",
3832
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react6.SquareIcon, { className: "aui-composer-cancel-icon size-3 fill-current" })
4145
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react6.SquareIcon, { className: "aui-composer-cancel-icon size-3 fill-current" })
3833
4146
  }
3834
4147
  ) }) })
3835
4148
  ] });
3836
4149
  };
3837
4150
 
3838
4151
  // src/chat/suggestions.tsx
3839
- var import_react26 = require("react");
3840
- var import_react27 = require("@assistant-ui/react");
4152
+ var import_react24 = require("react");
4153
+ var import_react25 = require("@assistant-ui/react");
3841
4154
  var import_lucide_react7 = require("lucide-react");
3842
- var import_jsx_runtime28 = require("react/jsx-runtime");
4155
+ var import_jsx_runtime32 = require("react/jsx-runtime");
3843
4156
  var Suggestions = ({
3844
4157
  suggestions,
3845
4158
  className
3846
4159
  }) => {
3847
4160
  const items = useResolvedSuggestions(suggestions);
3848
4161
  if (!items || items.length === 0) return null;
3849
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4162
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
3850
4163
  "div",
3851
4164
  {
3852
4165
  className: cn(
@@ -3855,17 +4168,17 @@ var Suggestions = ({
3855
4168
  ),
3856
4169
  role: "list",
3857
4170
  "aria-label": "Suggested prompts",
3858
- children: items.map((suggestion, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(SuggestionRow, { suggestion }, (suggestion.prompt ?? suggestion.title) + i))
4171
+ children: items.map((suggestion, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SuggestionRow, { suggestion }, (suggestion.prompt ?? suggestion.title) + i))
3859
4172
  }
3860
4173
  );
3861
4174
  };
3862
4175
  var SuggestionRow = ({ suggestion }) => {
3863
- const runtime = (0, import_react27.useThreadRuntime)();
4176
+ const runtime = (0, import_react25.useThreadRuntime)();
3864
4177
  const onClick = () => {
3865
4178
  const text = suggestion.prompt ?? suggestion.title;
3866
4179
  runtime.append({ role: "user", content: [{ type: "text", text }] });
3867
4180
  };
3868
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4181
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
3869
4182
  "button",
3870
4183
  {
3871
4184
  type: "button",
@@ -3873,20 +4186,20 @@ var SuggestionRow = ({ suggestion }) => {
3873
4186
  onClick,
3874
4187
  className: cn("aui-thread-suggestion", studioListRowButtonClass),
3875
4188
  children: [
3876
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "aui-thread-suggestion-icon shrink-0 text-muted-foreground", children: suggestion.icon ?? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react7.ArrowUpIcon, { className: "size-4", strokeWidth: 1.75, "aria-hidden": true }) }),
3877
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "aui-thread-suggestion-text min-w-0 flex-1 text-left", children: [
3878
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "aui-thread-suggestion-text-1 block truncate text-sm font-normal text-foreground", children: suggestion.title }),
3879
- suggestion.description && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "aui-thread-suggestion-text-2 mt-0.5 block truncate text-xs text-muted-foreground", children: suggestion.description })
4189
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "aui-thread-suggestion-icon shrink-0 text-muted-foreground", children: suggestion.icon ?? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react7.ArrowUpIcon, { className: "size-4", strokeWidth: 1.75, "aria-hidden": true }) }),
4190
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "aui-thread-suggestion-text min-w-0 flex-1 text-left", children: [
4191
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "aui-thread-suggestion-text-1 block truncate text-sm font-normal text-foreground", children: suggestion.title }),
4192
+ suggestion.description && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "aui-thread-suggestion-text-2 mt-0.5 block truncate text-xs text-muted-foreground", children: suggestion.description })
3880
4193
  ] })
3881
4194
  ]
3882
4195
  }
3883
4196
  );
3884
4197
  };
3885
4198
  function useResolvedSuggestions(source) {
3886
- const [resolved, setResolved] = (0, import_react26.useState)(
4199
+ const [resolved, setResolved] = (0, import_react24.useState)(
3887
4200
  () => Array.isArray(source) ? source : void 0
3888
4201
  );
3889
- (0, import_react26.useEffect)(() => {
4202
+ (0, import_react24.useEffect)(() => {
3890
4203
  if (!source) {
3891
4204
  setResolved(void 0);
3892
4205
  return;
@@ -3905,7 +4218,7 @@ function useResolvedSuggestions(source) {
3905
4218
  cancelled = true;
3906
4219
  };
3907
4220
  }, [source]);
3908
- return (0, import_react26.useMemo)(() => resolved, [resolved]);
4221
+ return (0, import_react24.useMemo)(() => resolved, [resolved]);
3909
4222
  }
3910
4223
 
3911
4224
  // src/design/theme-sanity.ts
@@ -3978,15 +4291,15 @@ function scheduleThemeSanityCheck() {
3978
4291
  }
3979
4292
 
3980
4293
  // src/chat/thread-variant.tsx
3981
- var import_react28 = require("react");
3982
- var ThreadVariantContext = (0, import_react28.createContext)("default");
4294
+ var import_react26 = require("react");
4295
+ var ThreadVariantContext = (0, import_react26.createContext)("default");
3983
4296
  var ThreadVariantProvider = ThreadVariantContext.Provider;
3984
4297
  function useThreadVariant() {
3985
- return (0, import_react28.useContext)(ThreadVariantContext);
4298
+ return (0, import_react26.useContext)(ThreadVariantContext);
3986
4299
  }
3987
4300
 
3988
4301
  // src/chat/thread.tsx
3989
- var import_jsx_runtime29 = require("react/jsx-runtime");
4302
+ var import_jsx_runtime33 = require("react/jsx-runtime");
3990
4303
  var Thread = ({
3991
4304
  className,
3992
4305
  variant = "default",
@@ -4009,17 +4322,17 @@ var Thread = ({
4009
4322
  const EditComposerSlot = components?.EditComposer ?? EditComposer;
4010
4323
  const ScrollToBottomSlot = components?.ScrollToBottom ?? ThreadScrollToBottom;
4011
4324
  const SuggestionsSlot = components?.Suggestions ?? Suggestions;
4012
- (0, import_react29.useEffect)(() => {
4325
+ (0, import_react27.useEffect)(() => {
4013
4326
  scheduleThemeSanityCheck();
4014
4327
  }, []);
4015
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ThreadVariantProvider, { value: variant, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4328
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ThreadVariantProvider, { value: variant, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4016
4329
  ArtifactRegistryProvider,
4017
4330
  {
4018
4331
  renderers: artifacts?.renderers,
4019
4332
  override: artifacts?.override,
4020
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(UiEventProvider, { onEvent: onArtifactEvent ?? (() => {
4021
- }), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4022
- import_react30.ThreadPrimitive.Root,
4333
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(UiEventProvider, { onEvent: onArtifactEvent ?? (() => {
4334
+ }), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4335
+ import_react28.ThreadPrimitive.Root,
4023
4336
  {
4024
4337
  className: cn(
4025
4338
  "aui-root aui-thread-root @container flex h-full flex-col bg-transparent",
@@ -4028,8 +4341,8 @@ var Thread = ({
4028
4341
  ),
4029
4342
  style: { ["--thread-max-width"]: maxWidth },
4030
4343
  "data-thread-variant": variant,
4031
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4032
- import_react30.ThreadPrimitive.Viewport,
4344
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4345
+ import_react28.ThreadPrimitive.Viewport,
4033
4346
  {
4034
4347
  turnAnchor: "bottom",
4035
4348
  className: cn(
@@ -4037,7 +4350,7 @@ var Thread = ({
4037
4350
  isPanel ? "px-2 pt-2" : "px-4 pt-4"
4038
4351
  ),
4039
4352
  children: [
4040
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4353
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4041
4354
  WelcomeSlot,
4042
4355
  {
4043
4356
  config: welcome,
@@ -4046,8 +4359,8 @@ var Thread = ({
4046
4359
  Suggestions: SuggestionsSlot
4047
4360
  }
4048
4361
  ),
4049
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4050
- import_react30.ThreadPrimitive.Messages,
4362
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4363
+ import_react28.ThreadPrimitive.Messages,
4051
4364
  {
4052
4365
  components: {
4053
4366
  UserMessage: UserMessageSlot,
@@ -4056,14 +4369,14 @@ var Thread = ({
4056
4369
  }
4057
4370
  }
4058
4371
  ),
4059
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4060
- import_react30.ThreadPrimitive.ViewportFooter,
4372
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4373
+ import_react28.ThreadPrimitive.ViewportFooter,
4061
4374
  {
4062
4375
  className: cn(
4063
4376
  "aui-thread-viewport-footer sticky bottom-0 z-10 mt-auto w-full isolate pt-2",
4064
4377
  isPanel ? "bg-card pb-2" : "bg-background pb-4 md:pb-6"
4065
4378
  ),
4066
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4379
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4067
4380
  "div",
4068
4381
  {
4069
4382
  className: cn(
@@ -4071,8 +4384,8 @@ var Thread = ({
4071
4384
  isPanel ? "gap-2" : "gap-4"
4072
4385
  ),
4073
4386
  children: [
4074
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ScrollToBottomSlot, {}),
4075
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ComposerSlot, { placeholder })
4387
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ScrollToBottomSlot, {}),
4388
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ComposerSlot, { placeholder })
4076
4389
  ]
4077
4390
  }
4078
4391
  )
@@ -4087,13 +4400,13 @@ var Thread = ({
4087
4400
  ) });
4088
4401
  };
4089
4402
  var ThreadScrollToBottom = () => {
4090
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react30.ThreadPrimitive.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4403
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.ThreadPrimitive.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4091
4404
  TooltipIconButton,
4092
4405
  {
4093
4406
  tooltip: "Scroll to bottom",
4094
4407
  variant: "secondary",
4095
4408
  className: "aui-thread-scroll-to-bottom absolute -top-12 z-10 self-center disabled:invisible",
4096
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react8.ArrowDownIcon, { className: "size-4" })
4409
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react8.ArrowDownIcon, { className: "size-4" })
4097
4410
  }
4098
4411
  ) });
4099
4412
  };
@@ -4126,15 +4439,15 @@ var ThreadWelcome = ({
4126
4439
  showWelcomeSuggestions: showWelcomeSuggestionsProp,
4127
4440
  Suggestions: SuggestionsSlot = Suggestions
4128
4441
  }) => {
4129
- const isEmpty = (0, import_react30.useThread)((s) => s.messages.length === 0);
4442
+ const isEmpty = (0, import_react28.useThread)((s) => s.messages.length === 0);
4130
4443
  const isPanel = useThreadVariant() === "panel";
4131
4444
  const showWelcomeSuggestions = showWelcomeSuggestionsProp ?? !isPanel;
4132
4445
  if (!isEmpty) return null;
4133
4446
  const defaultHeading = isPanel ? "Ask about this page" : "How can I help you today?";
4134
4447
  const defaultSubheading = isPanel ? "The assistant can use dashboard context from your app." : "Send a message to start a conversation.";
4135
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "aui-thread-welcome-root mx-auto my-auto flex w-full max-w-(--thread-max-width) grow flex-col", children: [
4136
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "aui-thread-welcome-center flex w-full grow flex-col items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4137
- import_react31.motion.div,
4448
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "aui-thread-welcome-root mx-auto my-auto flex w-full max-w-(--thread-max-width) grow flex-col", children: [
4449
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "aui-thread-welcome-center flex w-full grow flex-col items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4450
+ import_react29.motion.div,
4138
4451
  {
4139
4452
  className: cn(
4140
4453
  "aui-thread-welcome-message flex flex-col items-center justify-center text-center",
@@ -4144,9 +4457,9 @@ var ThreadWelcome = ({
4144
4457
  initial: "initial",
4145
4458
  animate: "animate",
4146
4459
  children: [
4147
- config?.icon && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react31.motion.div, { variants: welcomeIcon, className: isPanel ? "mb-3" : "mb-5", children: config.icon }),
4148
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4149
- import_react31.motion.h1,
4460
+ config?.icon && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react29.motion.div, { variants: welcomeIcon, className: isPanel ? "mb-3" : "mb-5", children: config.icon }),
4461
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4462
+ import_react29.motion.h1,
4150
4463
  {
4151
4464
  variants: welcomeItem,
4152
4465
  className: cn(
@@ -4156,8 +4469,8 @@ var ThreadWelcome = ({
4156
4469
  children: config?.heading ?? defaultHeading
4157
4470
  }
4158
4471
  ),
4159
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4160
- import_react31.motion.p,
4472
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4473
+ import_react29.motion.p,
4161
4474
  {
4162
4475
  variants: welcomeItem,
4163
4476
  className: "aui-thread-welcome-message-inner mt-1.5 text-muted-foreground text-sm",
@@ -4167,16 +4480,16 @@ var ThreadWelcome = ({
4167
4480
  ]
4168
4481
  }
4169
4482
  ) }),
4170
- showWelcomeSuggestions && suggestions ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "aui-thread-welcome-suggestions mx-auto w-full max-w-(--thread-max-width) px-2", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SuggestionsSlot, { suggestions }) }) : null
4483
+ showWelcomeSuggestions && suggestions ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "aui-thread-welcome-suggestions mx-auto w-full max-w-(--thread-max-width) px-2", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SuggestionsSlot, { suggestions }) }) : null
4171
4484
  ] });
4172
4485
  };
4173
4486
  var MessageError = () => {
4174
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react30.MessagePrimitive.Error, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react30.ErrorPrimitive.Root, { className: "aui-message-error-root mt-2 rounded-md border border-destructive bg-destructive/10 p-3 text-destructive text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react30.ErrorPrimitive.Message, { className: "aui-message-error-message line-clamp-2" }) }) });
4487
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.MessagePrimitive.Error, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.ErrorPrimitive.Root, { className: "aui-message-error-root mt-2 rounded-md border border-destructive bg-destructive/10 p-3 text-destructive text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.ErrorPrimitive.Message, { className: "aui-message-error-message line-clamp-2" }) }) });
4175
4488
  };
4176
4489
  var AssistantMessage = () => {
4177
4490
  const isPanel = useThreadVariant() === "panel";
4178
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4179
- import_react30.MessagePrimitive.Root,
4491
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4492
+ import_react28.MessagePrimitive.Root,
4180
4493
  {
4181
4494
  className: cn(
4182
4495
  "aui-assistant-message-root fade-in slide-in-from-bottom-1 relative mx-auto w-full max-w-(--thread-max-width) animate-in duration-150",
@@ -4184,7 +4497,7 @@ var AssistantMessage = () => {
4184
4497
  ),
4185
4498
  "data-role": "assistant",
4186
4499
  children: [
4187
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4500
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4188
4501
  "div",
4189
4502
  {
4190
4503
  className: cn(
@@ -4192,8 +4505,8 @@ var AssistantMessage = () => {
4192
4505
  isPanel ? "px-1 text-sm" : "px-2"
4193
4506
  ),
4194
4507
  children: [
4195
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4196
- import_react30.MessagePrimitive.Parts,
4508
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4509
+ import_react28.MessagePrimitive.Parts,
4197
4510
  {
4198
4511
  components: {
4199
4512
  Text: MarkdownText,
@@ -4203,11 +4516,11 @@ var AssistantMessage = () => {
4203
4516
  }
4204
4517
  }
4205
4518
  ),
4206
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(MessageError, {})
4519
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(MessageError, {})
4207
4520
  ]
4208
4521
  }
4209
4522
  ),
4210
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "aui-assistant-message-footer mt-1 mb-3 ml-1 flex", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AssistantActionBar, {}) })
4523
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "aui-assistant-message-footer mt-1 mb-3 ml-1 flex", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(AssistantActionBar, {}) })
4211
4524
  ]
4212
4525
  }
4213
4526
  );
@@ -4220,36 +4533,36 @@ var ASSISTANT_ACTION_ICON_CLASS = cn(
4220
4533
  "[&>span:first-child]:group-hover/tbv2:bg-ghost-fill-hover"
4221
4534
  );
4222
4535
  var AssistantActionBar = () => {
4223
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4224
- import_react30.ActionBarPrimitive.Root,
4536
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4537
+ import_react28.ActionBarPrimitive.Root,
4225
4538
  {
4226
4539
  hideWhenRunning: true,
4227
4540
  autohide: "never",
4228
4541
  className: "aui-assistant-action-bar-root flex items-center gap-0 bg-transparent px-0 py-0.5 text-muted-foreground/60",
4229
4542
  children: [
4230
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react30.ActionBarPrimitive.Copy, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4543
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.ActionBarPrimitive.Copy, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4231
4544
  TooltipIconButton,
4232
4545
  {
4233
4546
  tooltip: "Copy",
4234
4547
  variant: "ghost",
4235
4548
  className: ASSISTANT_ACTION_ICON_CLASS,
4236
4549
  children: [
4237
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react30.AuiIf, { condition: (s) => s.message.isCopied, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react8.CheckIcon, { className: "size-3" }) }),
4238
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react30.AuiIf, { condition: (s) => !s.message.isCopied, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react8.CopyIcon, { className: "size-3" }) })
4550
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.AuiIf, { condition: (s) => s.message.isCopied, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react8.CheckIcon, { className: "size-3" }) }),
4551
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.AuiIf, { condition: (s) => !s.message.isCopied, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react8.CopyIcon, { className: "size-3" }) })
4239
4552
  ]
4240
4553
  }
4241
4554
  ) }),
4242
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react30.ActionBarPrimitive.Reload, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4555
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.ActionBarPrimitive.Reload, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4243
4556
  TooltipIconButton,
4244
4557
  {
4245
4558
  tooltip: "Regenerate",
4246
4559
  variant: "ghost",
4247
4560
  className: ASSISTANT_ACTION_ICON_CLASS,
4248
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react8.RefreshCwIcon, { className: "size-3" })
4561
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react8.RefreshCwIcon, { className: "size-3" })
4249
4562
  }
4250
4563
  ) }),
4251
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_react30.ActionBarMorePrimitive.Root, { children: [
4252
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react30.ActionBarMorePrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4564
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react28.ActionBarMorePrimitive.Root, { children: [
4565
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.ActionBarMorePrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4253
4566
  TooltipIconButton,
4254
4567
  {
4255
4568
  tooltip: "More",
@@ -4258,17 +4571,17 @@ var AssistantActionBar = () => {
4258
4571
  ASSISTANT_ACTION_ICON_CLASS,
4259
4572
  "data-[state=open]:text-muted-foreground/80"
4260
4573
  ),
4261
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react8.MoreHorizontalIcon, { className: "size-3" })
4574
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react8.MoreHorizontalIcon, { className: "size-3" })
4262
4575
  }
4263
4576
  ) }),
4264
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4265
- import_react30.ActionBarMorePrimitive.Content,
4577
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4578
+ import_react28.ActionBarMorePrimitive.Content,
4266
4579
  {
4267
4580
  side: "bottom",
4268
4581
  align: "start",
4269
4582
  className: "aui-action-bar-more-content z-50 min-w-36 overflow-hidden rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-card-elevated",
4270
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react30.ActionBarPrimitive.ExportMarkdown, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_react30.ActionBarMorePrimitive.Item, { className: "aui-action-bar-more-item flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none hover:bg-muted focus:bg-muted", children: [
4271
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react8.DownloadIcon, { className: "size-4 shrink-0" }),
4583
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.ActionBarPrimitive.ExportMarkdown, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react28.ActionBarMorePrimitive.Item, { className: "aui-action-bar-more-item flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none hover:bg-muted focus:bg-muted", children: [
4584
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react8.DownloadIcon, { className: "size-4 shrink-0" }),
4272
4585
  "Export as Markdown"
4273
4586
  ] }) })
4274
4587
  }
@@ -4279,12 +4592,12 @@ var AssistantActionBar = () => {
4279
4592
  );
4280
4593
  };
4281
4594
  var UserMessageText = () => {
4282
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "whitespace-pre-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react30.MessagePartPrimitive.Text, { smooth: false }) });
4595
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "whitespace-pre-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.MessagePartPrimitive.Text, { smooth: false }) });
4283
4596
  };
4284
4597
  var UserMessage = () => {
4285
4598
  const isPanel = useThreadVariant() === "panel";
4286
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4287
- import_react30.MessagePrimitive.Root,
4599
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4600
+ import_react28.MessagePrimitive.Root,
4288
4601
  {
4289
4602
  className: cn(
4290
4603
  "aui-user-message-root mx-auto flex w-full max-w-(--thread-max-width) flex-col items-end gap-2",
@@ -4292,9 +4605,9 @@ var UserMessage = () => {
4292
4605
  ),
4293
4606
  "data-role": "user",
4294
4607
  children: [
4295
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(UserMessageAttachments, {}),
4296
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4297
- import_react31.motion.div,
4608
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(UserMessageAttachments, {}),
4609
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4610
+ import_react29.motion.div,
4298
4611
  {
4299
4612
  className: cn(
4300
4613
  "aui-user-message-content relative inline-block max-w-[85%] rounded-2xl bg-bubble-user text-bubble-user-foreground",
@@ -4304,8 +4617,8 @@ var UserMessage = () => {
4304
4617
  animate: { opacity: 1, y: 0, scale: 1 },
4305
4618
  transition: { duration: 0.65, ease: luxuryEase },
4306
4619
  children: [
4307
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react30.MessagePrimitive.Parts, { components: { Text: UserMessageText } }),
4308
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "aui-user-action-bar-wrapper absolute top-1/2 left-0 -translate-x-full -translate-y-1/2 pr-2", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(UserActionBar, {}) })
4620
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.MessagePrimitive.Parts, { components: { Text: UserMessageText } }),
4621
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "aui-user-action-bar-wrapper absolute top-1/2 left-0 -translate-x-full -translate-y-1/2 pr-2", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(UserActionBar, {}) })
4309
4622
  ]
4310
4623
  }
4311
4624
  )
@@ -4314,42 +4627,42 @@ var UserMessage = () => {
4314
4627
  );
4315
4628
  };
4316
4629
  var UserActionBar = () => {
4317
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4318
- import_react30.ActionBarPrimitive.Root,
4630
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4631
+ import_react28.ActionBarPrimitive.Root,
4319
4632
  {
4320
4633
  hideWhenRunning: true,
4321
4634
  autohide: "always",
4322
4635
  className: "aui-user-action-bar-root flex flex-col items-end",
4323
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react30.ActionBarPrimitive.Edit, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4636
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.ActionBarPrimitive.Edit, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4324
4637
  TooltipIconButton,
4325
4638
  {
4326
4639
  tooltip: "Edit",
4327
4640
  variant: "ghost",
4328
4641
  className: ASSISTANT_ACTION_ICON_CLASS,
4329
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react8.PencilIcon, { className: "size-3" })
4642
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react8.PencilIcon, { className: "size-3" })
4330
4643
  }
4331
4644
  ) })
4332
4645
  }
4333
4646
  );
4334
4647
  };
4335
4648
  var EditComposer = () => {
4336
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react30.MessagePrimitive.Root, { className: "aui-edit-composer-wrapper mx-auto flex w-full max-w-(--thread-max-width) flex-col px-2 py-3", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_react30.ComposerPrimitive.Root, { className: "aui-edit-composer-root ml-auto flex w-full max-w-[85%] flex-col rounded-2xl bg-muted", children: [
4337
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4338
- import_react30.ComposerPrimitive.Input,
4649
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.MessagePrimitive.Root, { className: "aui-edit-composer-wrapper mx-auto flex w-full max-w-(--thread-max-width) flex-col px-2 py-3", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react28.ComposerPrimitive.Root, { className: "aui-edit-composer-root ml-auto flex w-full max-w-[85%] flex-col rounded-2xl bg-muted", children: [
4650
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4651
+ import_react28.ComposerPrimitive.Input,
4339
4652
  {
4340
4653
  className: "aui-edit-composer-input min-h-14 w-full resize-none bg-transparent p-4 text-foreground text-sm outline-none",
4341
4654
  autoFocus: true
4342
4655
  }
4343
4656
  ),
4344
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "aui-edit-composer-footer mx-3 mb-3 flex items-center gap-2 self-end", children: [
4345
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react30.ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TimbalV2Button, { variant: "ghost", size: "sm", children: "Cancel" }) }),
4346
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react30.ComposerPrimitive.Send, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TimbalV2Button, { variant: "primary", size: "sm", children: "Update" }) })
4657
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "aui-edit-composer-footer mx-3 mb-3 flex items-center gap-2 self-end", children: [
4658
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TimbalV2Button, { variant: "ghost", size: "sm", children: "Cancel" }) }),
4659
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.ComposerPrimitive.Send, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TimbalV2Button, { variant: "primary", size: "sm", children: "Update" }) })
4347
4660
  ] })
4348
4661
  ] }) });
4349
4662
  };
4350
4663
 
4351
4664
  // src/chat/chat.tsx
4352
- var import_jsx_runtime30 = require("react/jsx-runtime");
4665
+ var import_jsx_runtime34 = require("react/jsx-runtime");
4353
4666
  function TimbalChat({
4354
4667
  workforceId,
4355
4668
  baseUrl,
@@ -4360,7 +4673,7 @@ function TimbalChat({
4360
4673
  debug,
4361
4674
  ...threadProps
4362
4675
  }) {
4363
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4676
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4364
4677
  TimbalRuntimeProvider,
4365
4678
  {
4366
4679
  workforceId,
@@ -4370,14 +4683,36 @@ function TimbalChat({
4370
4683
  attachmentsUploadUrl,
4371
4684
  attachmentsAccept,
4372
4685
  debug,
4373
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Thread, { ...threadProps })
4686
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Thread, { ...threadProps })
4374
4687
  }
4375
4688
  );
4376
4689
  }
4377
4690
 
4378
4691
  // src/chat/workforce-selector.tsx
4379
4692
  var import_lucide_react9 = require("lucide-react");
4380
- var import_jsx_runtime31 = require("react/jsx-runtime");
4693
+
4694
+ // src/design/control-surface.ts
4695
+ var controlSurfaceClass = cn(
4696
+ TIMBAL_V2_SECONDARY_CHROME,
4697
+ "text-sm text-foreground outline-none",
4698
+ "placeholder:text-muted-foreground/70",
4699
+ "focus-visible:ring-2 focus-visible:ring-foreground/10",
4700
+ "focus-within:ring-2 focus-within:ring-foreground/10",
4701
+ "disabled:cursor-not-allowed disabled:opacity-50",
4702
+ "data-[placeholder]:text-muted-foreground"
4703
+ );
4704
+ var overlayAnimationClass = "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2";
4705
+ var overlaySurfaceClass = cn(
4706
+ "z-[80] border border-border bg-popover text-popover-foreground shadow-card",
4707
+ overlayAnimationClass
4708
+ );
4709
+ var overlayListPanelClass = cn(
4710
+ overlaySurfaceClass,
4711
+ "overflow-hidden rounded-lg p-0 outline-hidden"
4712
+ );
4713
+
4714
+ // src/chat/workforce-selector.tsx
4715
+ var import_jsx_runtime35 = require("react/jsx-runtime");
4381
4716
  var WorkforceSelector = ({
4382
4717
  workforces,
4383
4718
  value,
@@ -4388,18 +4723,18 @@ var WorkforceSelector = ({
4388
4723
  }) => {
4389
4724
  if (workforces.length === 0) return null;
4390
4725
  if (hideWhenSingle && workforces.length === 1) return null;
4391
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
4726
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
4392
4727
  "div",
4393
4728
  {
4394
4729
  className: cn(
4395
4730
  "aui-workforce-selector relative inline-flex items-center",
4731
+ controlSurfaceClass,
4396
4732
  studioTopbarPillHeightClass,
4397
- studioSecondaryChromeClass,
4398
4733
  "rounded-full",
4399
4734
  className
4400
4735
  ),
4401
4736
  children: [
4402
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
4737
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
4403
4738
  "select",
4404
4739
  {
4405
4740
  className: "aui-workforce-selector-input h-full cursor-pointer appearance-none rounded-full border-none bg-transparent pr-8 pl-3.5 text-sm font-medium text-foreground outline-none focus:outline-none",
@@ -4407,15 +4742,15 @@ var WorkforceSelector = ({
4407
4742
  onChange: (e) => onChange(e.target.value),
4408
4743
  "aria-label": placeholder,
4409
4744
  children: [
4410
- !value && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: "", children: placeholder }),
4745
+ !value && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: "", children: placeholder }),
4411
4746
  workforces.map((w) => {
4412
4747
  const id = idOf(w);
4413
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: id, children: w.name ?? id }, id);
4748
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: id, children: w.name ?? id }, id);
4414
4749
  })
4415
4750
  ]
4416
4751
  }
4417
4752
  ),
4418
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4753
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4419
4754
  import_lucide_react9.ChevronDownIcon,
4420
4755
  {
4421
4756
  className: "aui-workforce-selector-icon pointer-events-none absolute right-3 size-3.5 text-muted-foreground/70",
@@ -4431,22 +4766,22 @@ function idOf(item) {
4431
4766
  }
4432
4767
 
4433
4768
  // src/hooks/use-workforces.ts
4434
- var import_react32 = require("react");
4769
+ var import_react30 = require("react");
4435
4770
  function useWorkforces(options = {}) {
4436
4771
  const { baseUrl = "/api", fetch: fetchFn, pickInitial, enabled = true } = options;
4437
- const [workforces, setWorkforces] = (0, import_react32.useState)([]);
4438
- const [selectedId, setSelectedId] = (0, import_react32.useState)("");
4439
- const [isLoading, setIsLoading] = (0, import_react32.useState)(enabled);
4440
- const [error, setError] = (0, import_react32.useState)(null);
4441
- const fetchFnRef = (0, import_react32.useRef)(fetchFn ?? authFetch);
4442
- (0, import_react32.useEffect)(() => {
4772
+ const [workforces, setWorkforces] = (0, import_react30.useState)([]);
4773
+ const [selectedId, setSelectedId] = (0, import_react30.useState)("");
4774
+ const [isLoading, setIsLoading] = (0, import_react30.useState)(enabled);
4775
+ const [error, setError] = (0, import_react30.useState)(null);
4776
+ const fetchFnRef = (0, import_react30.useRef)(fetchFn ?? authFetch);
4777
+ (0, import_react30.useEffect)(() => {
4443
4778
  fetchFnRef.current = fetchFn ?? authFetch;
4444
4779
  }, [fetchFn]);
4445
- const pickInitialRef = (0, import_react32.useRef)(pickInitial);
4446
- (0, import_react32.useEffect)(() => {
4780
+ const pickInitialRef = (0, import_react30.useRef)(pickInitial);
4781
+ (0, import_react30.useEffect)(() => {
4447
4782
  pickInitialRef.current = pickInitial;
4448
4783
  }, [pickInitial]);
4449
- const load = (0, import_react32.useMemo)(() => {
4784
+ const load = (0, import_react30.useMemo)(() => {
4450
4785
  return async () => {
4451
4786
  if (!enabled) {
4452
4787
  setIsLoading(false);
@@ -4471,10 +4806,10 @@ function useWorkforces(options = {}) {
4471
4806
  }
4472
4807
  };
4473
4808
  }, [baseUrl, enabled]);
4474
- (0, import_react32.useEffect)(() => {
4809
+ (0, import_react30.useEffect)(() => {
4475
4810
  load();
4476
4811
  }, [load]);
4477
- const selected = (0, import_react32.useMemo)(
4812
+ const selected = (0, import_react30.useMemo)(
4478
4813
  () => workforces.find((w) => idOf2(w) === selectedId),
4479
4814
  [workforces, selectedId]
4480
4815
  );
@@ -4538,7 +4873,7 @@ var DOM_IDS = {
4538
4873
  };
4539
4874
 
4540
4875
  // src/studio/shell/chat-shell.tsx
4541
- var import_jsx_runtime32 = require("react/jsx-runtime");
4876
+ var import_jsx_runtime36 = require("react/jsx-runtime");
4542
4877
  var TimbalChatShell = ({
4543
4878
  workforceId,
4544
4879
  brand,
@@ -4556,7 +4891,7 @@ var TimbalChatShell = ({
4556
4891
  });
4557
4892
  const effectiveId = workforceId ?? selectedId;
4558
4893
  const showSelector = !hideWorkforceSelector && !workforceId && workforces.length > 0;
4559
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
4894
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
4560
4895
  "div",
4561
4896
  {
4562
4897
  className: cn(
@@ -4565,7 +4900,7 @@ var TimbalChatShell = ({
4565
4900
  ),
4566
4901
  style: studioChromeShellStyle,
4567
4902
  children: [
4568
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4903
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4569
4904
  "div",
4570
4905
  {
4571
4906
  className: cn(
@@ -4575,7 +4910,7 @@ var TimbalChatShell = ({
4575
4910
  "aria-hidden": true
4576
4911
  }
4577
4912
  ),
4578
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
4913
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
4579
4914
  "header",
4580
4915
  {
4581
4916
  className: cn(
@@ -4584,9 +4919,9 @@ var TimbalChatShell = ({
4584
4919
  ),
4585
4920
  style: { minHeight: "var(--studio-topbar-height)" },
4586
4921
  children: [
4587
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
4922
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
4588
4923
  brand,
4589
- showSelector && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4924
+ showSelector && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4590
4925
  WorkforceSelector,
4591
4926
  {
4592
4927
  workforces,
@@ -4595,11 +4930,11 @@ var TimbalChatShell = ({
4595
4930
  }
4596
4931
  )
4597
4932
  ] }),
4598
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex shrink-0 items-center gap-1", children: headerActions })
4933
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "flex shrink-0 items-center gap-1", children: headerActions })
4599
4934
  ]
4600
4935
  }
4601
4936
  ),
4602
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4937
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4603
4938
  TimbalChat,
4604
4939
  {
4605
4940
  workforceId: effectiveId,
@@ -4616,9 +4951,9 @@ var TimbalChatShell = ({
4616
4951
  };
4617
4952
 
4618
4953
  // src/studio/shell/studio-shell.tsx
4619
- var import_react47 = require("react");
4954
+ var import_react45 = require("react");
4620
4955
  var import_lucide_react13 = require("lucide-react");
4621
- var import_react48 = require("motion/react");
4956
+ var import_react46 = require("motion/react");
4622
4957
 
4623
4958
  // src/design/sidebar-motion.ts
4624
4959
  var STUDIO_SIDEBAR_EASE_ENTER = [0, 0, 0.2, 1];
@@ -4689,16 +5024,16 @@ function studioSidebarBackdropTransition(reduced) {
4689
5024
  }
4690
5025
 
4691
5026
  // src/hooks/use-sidebar-collapse-phase.ts
4692
- var import_react33 = require("react");
5027
+ var import_react31 = require("react");
4693
5028
  var WIDTH_OVERLAP_FRAC = 0.7;
4694
5029
  function useSidebarCollapsePhase(collapsed, reducedMotion) {
4695
- const [widthCollapsed, setWidthCollapsed] = (0, import_react33.useState)(collapsed);
4696
- const [entriesVisible, setEntriesVisible] = (0, import_react33.useState)(true);
4697
- const collapsedTarget = (0, import_react33.useRef)(collapsed);
4698
- const isFirstRender = (0, import_react33.useRef)(true);
4699
- const widthTimerRef = (0, import_react33.useRef)(null);
4700
- const revealTimerRef = (0, import_react33.useRef)(null);
4701
- (0, import_react33.useEffect)(() => {
5030
+ const [widthCollapsed, setWidthCollapsed] = (0, import_react31.useState)(collapsed);
5031
+ const [entriesVisible, setEntriesVisible] = (0, import_react31.useState)(true);
5032
+ const collapsedTarget = (0, import_react31.useRef)(collapsed);
5033
+ const isFirstRender = (0, import_react31.useRef)(true);
5034
+ const widthTimerRef = (0, import_react31.useRef)(null);
5035
+ const revealTimerRef = (0, import_react31.useRef)(null);
5036
+ (0, import_react31.useEffect)(() => {
4702
5037
  collapsedTarget.current = collapsed;
4703
5038
  }, [collapsed]);
4704
5039
  const clearWidthTimer = () => {
@@ -4713,7 +5048,7 @@ function useSidebarCollapsePhase(collapsed, reducedMotion) {
4713
5048
  revealTimerRef.current = null;
4714
5049
  }
4715
5050
  };
4716
- const applyWidthTarget = (0, import_react33.useCallback)(() => {
5051
+ const applyWidthTarget = (0, import_react31.useCallback)(() => {
4717
5052
  const willExpand = !collapsedTarget.current;
4718
5053
  setWidthCollapsed(collapsedTarget.current);
4719
5054
  clearRevealTimer();
@@ -4724,7 +5059,7 @@ function useSidebarCollapsePhase(collapsed, reducedMotion) {
4724
5059
  );
4725
5060
  }
4726
5061
  }, [reducedMotion]);
4727
- (0, import_react33.useEffect)(() => {
5062
+ (0, import_react31.useEffect)(() => {
4728
5063
  clearWidthTimer();
4729
5064
  clearRevealTimer();
4730
5065
  if (reducedMotion) {
@@ -4748,10 +5083,10 @@ function useSidebarCollapsePhase(collapsed, reducedMotion) {
4748
5083
  clearRevealTimer();
4749
5084
  };
4750
5085
  }, [collapsed, reducedMotion, applyWidthTarget]);
4751
- const onEntriesBlurOutComplete = (0, import_react33.useCallback)(() => {
5086
+ const onEntriesBlurOutComplete = (0, import_react31.useCallback)(() => {
4752
5087
  applyWidthTarget();
4753
5088
  }, [applyWidthTarget]);
4754
- const onPanelWidthComplete = (0, import_react33.useCallback)(() => {
5089
+ const onPanelWidthComplete = (0, import_react31.useCallback)(() => {
4755
5090
  clearRevealTimer();
4756
5091
  setEntriesVisible(true);
4757
5092
  }, []);
@@ -4766,15 +5101,15 @@ function useSidebarCollapsePhase(collapsed, reducedMotion) {
4766
5101
  }
4767
5102
 
4768
5103
  // src/studio/sidebar/sidebar-backdrop.tsx
4769
- var import_react34 = require("motion/react");
4770
- var import_jsx_runtime33 = require("react/jsx-runtime");
5104
+ var import_react32 = require("motion/react");
5105
+ var import_jsx_runtime37 = require("react/jsx-runtime");
4771
5106
  var StudioSidebarBackdrop = ({
4772
5107
  open,
4773
5108
  onClose
4774
5109
  }) => {
4775
- const reducedMotion = (0, import_react34.useReducedMotion)();
4776
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react34.AnimatePresence, { children: open ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4777
- import_react34.motion.button,
5110
+ const reducedMotion = (0, import_react32.useReducedMotion)();
5111
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react32.AnimatePresence, { children: open ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5112
+ import_react32.motion.button,
4778
5113
  {
4779
5114
  type: "button",
4780
5115
  className: "fixed inset-0 z-40 bg-foreground/30 backdrop-blur-[2px] md:hidden",
@@ -4789,36 +5124,36 @@ var StudioSidebarBackdrop = ({
4789
5124
  };
4790
5125
 
4791
5126
  // src/studio/sidebar/sidebar-context.tsx
4792
- var import_react35 = require("react");
4793
- var StudioSidebarContext = (0, import_react35.createContext)({
5127
+ var import_react33 = require("react");
5128
+ var StudioSidebarContext = (0, import_react33.createContext)({
4794
5129
  collapsed: false,
4795
5130
  isMobile: false,
4796
5131
  isCollapsedRail: false,
4797
5132
  iconOnlyLayout: false
4798
5133
  });
4799
5134
  function useStudioSidebarLayout() {
4800
- return (0, import_react35.useContext)(StudioSidebarContext);
5135
+ return (0, import_react33.useContext)(StudioSidebarContext);
4801
5136
  }
4802
5137
 
4803
5138
  // src/studio/sidebar/sidebar.tsx
4804
- var import_react41 = require("react");
4805
- var import_react42 = require("motion/react");
5139
+ var import_react39 = require("react");
5140
+ var import_react40 = require("motion/react");
4806
5141
 
4807
5142
  // src/studio/sidebar/sidebar-entries.tsx
4808
- var import_react36 = require("motion/react");
4809
- var import_jsx_runtime34 = require("react/jsx-runtime");
5143
+ var import_react34 = require("motion/react");
5144
+ var import_jsx_runtime38 = require("react/jsx-runtime");
4810
5145
  var StudioSidebarEntries = ({
4811
5146
  visible,
4812
5147
  onBlurOutComplete,
4813
5148
  children,
4814
5149
  className
4815
5150
  }) => {
4816
- const reducedMotion = (0, import_react36.useReducedMotion)();
5151
+ const reducedMotion = (0, import_react34.useReducedMotion)();
4817
5152
  if (reducedMotion) {
4818
- return visible ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: cn("flex min-h-0 flex-1 flex-col", className), children }) : null;
5153
+ return visible ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: cn("flex min-h-0 flex-1 flex-col", className), children }) : null;
4819
5154
  }
4820
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4821
- import_react36.motion.div,
5155
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
5156
+ import_react34.motion.div,
4822
5157
  {
4823
5158
  className: cn("flex min-h-0 flex-1 flex-col", className),
4824
5159
  initial: false,
@@ -4841,11 +5176,11 @@ var StudioSidebarEntries = ({
4841
5176
  var import_lucide_react10 = require("lucide-react");
4842
5177
 
4843
5178
  // src/auth/provider.tsx
4844
- var import_react37 = require("react");
4845
- var import_jsx_runtime35 = require("react/jsx-runtime");
4846
- var SessionContext = (0, import_react37.createContext)(void 0);
5179
+ var import_react35 = require("react");
5180
+ var import_jsx_runtime39 = require("react/jsx-runtime");
5181
+ var SessionContext = (0, import_react35.createContext)(void 0);
4847
5182
  var useOptionalSession = () => {
4848
- const context = (0, import_react37.useContext)(SessionContext);
5183
+ const context = (0, import_react35.useContext)(SessionContext);
4849
5184
  return context ?? null;
4850
5185
  };
4851
5186
 
@@ -4872,35 +5207,35 @@ function studioSidebarNavItemClasses(iconOnly, isActive) {
4872
5207
  }
4873
5208
 
4874
5209
  // src/studio/sidebar/sidebar-entry-motion.tsx
4875
- var import_react38 = require("motion/react");
4876
- var import_jsx_runtime36 = require("react/jsx-runtime");
5210
+ var import_react36 = require("motion/react");
5211
+ var import_jsx_runtime40 = require("react/jsx-runtime");
4877
5212
  var StudioSidebarEntryMotion = ({
4878
5213
  children,
4879
5214
  className
4880
5215
  }) => {
4881
- const reducedMotion = (0, import_react38.useReducedMotion)();
5216
+ const reducedMotion = (0, import_react36.useReducedMotion)();
4882
5217
  if (reducedMotion) {
4883
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className, children });
5218
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className, children });
4884
5219
  }
4885
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react38.motion.div, { variants: studioSidebarEntryItemVariants, className: cn(className), children });
5220
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react36.motion.div, { variants: studioSidebarEntryItemVariants, className: cn(className), children });
4886
5221
  };
4887
5222
 
4888
5223
  // src/studio/sidebar/sidebar-tooltip.tsx
4889
- var import_jsx_runtime37 = require("react/jsx-runtime");
5224
+ var import_jsx_runtime41 = require("react/jsx-runtime");
4890
5225
  var StudioSidebarTooltip = ({
4891
5226
  label,
4892
5227
  enabled,
4893
5228
  children
4894
5229
  }) => {
4895
- if (!enabled) return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children });
4896
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Tooltip, { children: [
4897
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TooltipTrigger, { asChild: true, children }),
4898
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TooltipContent, { side: "right", className: "text-xs", children: label })
5230
+ if (!enabled) return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment, { children });
5231
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Tooltip, { children: [
5232
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipTrigger, { asChild: true, children }),
5233
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipContent, { side: "right", className: "text-xs", children: label })
4899
5234
  ] });
4900
5235
  };
4901
5236
 
4902
5237
  // src/studio/sidebar/sidebar-footer.tsx
4903
- var import_jsx_runtime38 = require("react/jsx-runtime");
5238
+ var import_jsx_runtime42 = require("react/jsx-runtime");
4904
5239
  function userInitials(name, email) {
4905
5240
  const fromName = name.trim().split(/\s+/).map((part) => part.charAt(0)).join("").slice(0, 2).toUpperCase();
4906
5241
  if (fromName) return fromName;
@@ -4918,32 +5253,32 @@ var StudioSidebarFooter = ({
4918
5253
  session?.logout();
4919
5254
  onSignOut?.();
4920
5255
  };
4921
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(StudioSidebarEntryMotion, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
5256
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(StudioSidebarEntryMotion, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4922
5257
  "footer",
4923
5258
  {
4924
5259
  className: cn(
4925
5260
  "mt-auto w-full shrink-0 py-2.5",
4926
5261
  iconOnlyLayout ? studioSidebarCollapsedRailInsetClass : "px-2.5"
4927
5262
  ),
4928
- children: user ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-2", children: [
4929
- iconOnlyLayout ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: studioSidebarCollapsedRailChipRowClass, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Avatar, { size: "sm", className: "size-8", children: [
4930
- user.user_photo_url ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(AvatarImage, { src: user.user_photo_url, alt: user.user_name }) : null,
4931
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(AvatarFallback, { className: "text-[10px]", children: userInitials(user.user_name, user.user_email) })
4932
- ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex min-w-0 items-center gap-2.5", children: [
4933
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Avatar, { size: "sm", children: [
4934
- user.user_photo_url ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(AvatarImage, { src: user.user_photo_url, alt: user.user_name }) : null,
4935
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(AvatarFallback, { children: userInitials(user.user_name, user.user_email) })
5263
+ children: user ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex flex-col gap-2", children: [
5264
+ iconOnlyLayout ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: studioSidebarCollapsedRailChipRowClass, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Avatar, { size: "sm", className: "size-8", children: [
5265
+ user.user_photo_url ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AvatarImage, { src: user.user_photo_url, alt: user.user_name }) : null,
5266
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AvatarFallback, { className: "text-[10px]", children: userInitials(user.user_name, user.user_email) })
5267
+ ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex min-w-0 items-center gap-2.5", children: [
5268
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Avatar, { size: "sm", children: [
5269
+ user.user_photo_url ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AvatarImage, { src: user.user_photo_url, alt: user.user_name }) : null,
5270
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AvatarFallback, { children: userInitials(user.user_name, user.user_email) })
4936
5271
  ] }),
4937
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "min-w-0 flex-1", children: [
4938
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "truncate text-sm font-medium text-foreground", children: user.user_name }),
4939
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "truncate text-xs text-muted-foreground", children: user.user_email })
5272
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "min-w-0 flex-1", children: [
5273
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "truncate text-sm font-medium text-foreground", children: user.user_name }),
5274
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "truncate text-xs text-muted-foreground", children: user.user_email })
4940
5275
  ] })
4941
5276
  ] }),
4942
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
5277
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4943
5278
  "div",
4944
5279
  {
4945
5280
  className: iconOnlyLayout ? studioSidebarCollapsedRailChipRowClass : void 0,
4946
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(StudioSidebarTooltip, { label: "Sign out", enabled: showTooltips, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
5281
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(StudioSidebarTooltip, { label: "Sign out", enabled: showTooltips, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
4947
5282
  "button",
4948
5283
  {
4949
5284
  type: "button",
@@ -4954,28 +5289,28 @@ var StudioSidebarFooter = ({
4954
5289
  ),
4955
5290
  "aria-label": "Sign out",
4956
5291
  children: [
4957
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_lucide_react10.LogOut, { className: "size-3.5 shrink-0" }),
5292
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_lucide_react10.LogOut, { className: "size-3.5 shrink-0" }),
4958
5293
  !iconOnlyLayout ? "Sign out" : null
4959
5294
  ]
4960
5295
  }
4961
5296
  ) })
4962
5297
  }
4963
5298
  )
4964
- ] }) : !iconOnlyLayout && emptyCaption ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "px-1 text-xs text-muted-foreground", children: emptyCaption }) : null
5299
+ ] }) : !iconOnlyLayout && emptyCaption ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "px-1 text-xs text-muted-foreground", children: emptyCaption }) : null
4965
5300
  }
4966
5301
  ) });
4967
5302
  };
4968
5303
 
4969
5304
  // src/studio/sidebar/sidebar-header.tsx
4970
5305
  var import_lucide_react11 = require("lucide-react");
4971
- var import_jsx_runtime39 = require("react/jsx-runtime");
5306
+ var import_jsx_runtime43 = require("react/jsx-runtime");
4972
5307
  var sidebarHeaderClass = "flex h-12 shrink-0 items-center px-2";
4973
5308
  var toggleButtonClass = cn(
4974
5309
  "flex shrink-0 items-center justify-center rounded-lg text-muted-foreground transition-colors",
4975
5310
  "hover:bg-muted hover:text-foreground",
4976
5311
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-foreground/15"
4977
5312
  );
4978
- var SidebarToggleButton = ({ ariaLabel, expanded, onClick, children }) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
5313
+ var SidebarToggleButton = ({ ariaLabel, expanded, onClick, children }) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4979
5314
  "button",
4980
5315
  {
4981
5316
  type: "button",
@@ -4989,7 +5324,7 @@ var SidebarToggleButton = ({ ariaLabel, expanded, onClick, children }) => /* @__
4989
5324
  var CollapsedBrandToggle = ({
4990
5325
  onExpand,
4991
5326
  brand
4992
- }) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: studioSidebarCollapsedRailChipRowClass, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(StudioSidebarTooltip, { label: "Expand sidebar", enabled: true, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
5327
+ }) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: studioSidebarCollapsedRailChipRowClass, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(StudioSidebarTooltip, { label: "Expand sidebar", enabled: true, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
4993
5328
  "button",
4994
5329
  {
4995
5330
  type: "button",
@@ -5001,7 +5336,7 @@ var CollapsedBrandToggle = ({
5001
5336
  "group relative inline-flex size-8 items-center justify-center overflow-hidden rounded-lg"
5002
5337
  ),
5003
5338
  children: [
5004
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
5339
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
5005
5340
  "span",
5006
5341
  {
5007
5342
  "aria-hidden": true,
@@ -5013,7 +5348,7 @@ var CollapsedBrandToggle = ({
5013
5348
  children: brand
5014
5349
  }
5015
5350
  ),
5016
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
5351
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
5017
5352
  import_lucide_react11.ChevronRight,
5018
5353
  {
5019
5354
  "aria-hidden": true,
@@ -5035,40 +5370,40 @@ var StudioSidebarHeader = ({
5035
5370
  brand
5036
5371
  }) => {
5037
5372
  if (isMobile) {
5038
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("header", { className: cn(sidebarHeaderClass, "justify-between gap-2 pr-2"), children: [
5373
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("header", { className: cn(sidebarHeaderClass, "justify-between gap-2 pr-2"), children: [
5039
5374
  brand,
5040
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
5375
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
5041
5376
  SidebarToggleButton,
5042
5377
  {
5043
5378
  ariaLabel: "Close menu",
5044
5379
  expanded: mobileOpen,
5045
5380
  onClick: onToggle,
5046
- children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react11.X, { className: "size-3.5" })
5381
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react11.X, { className: "size-3.5" })
5047
5382
  }
5048
5383
  )
5049
5384
  ] });
5050
5385
  }
5051
5386
  if (isCollapsedRail) {
5052
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
5387
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
5053
5388
  "header",
5054
5389
  {
5055
5390
  className: cn(
5056
5391
  "flex h-12 shrink-0 items-center",
5057
5392
  studioSidebarCollapsedRailInsetClass
5058
5393
  ),
5059
- children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CollapsedBrandToggle, { onExpand: onToggle, brand })
5394
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(CollapsedBrandToggle, { onExpand: onToggle, brand })
5060
5395
  }
5061
5396
  );
5062
5397
  }
5063
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("header", { className: cn(sidebarHeaderClass, "justify-between gap-1 pr-2"), children: [
5398
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("header", { className: cn(sidebarHeaderClass, "justify-between gap-1 pr-2"), children: [
5064
5399
  brand,
5065
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
5400
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
5066
5401
  SidebarToggleButton,
5067
5402
  {
5068
5403
  ariaLabel: "Collapse sidebar",
5069
5404
  expanded: true,
5070
5405
  onClick: onToggle,
5071
- children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react11.ChevronLeft, { className: "size-4" })
5406
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react11.ChevronLeft, { className: "size-4" })
5072
5407
  }
5073
5408
  )
5074
5409
  ] });
@@ -5087,7 +5422,7 @@ function workforceItemInitial(w) {
5087
5422
  }
5088
5423
 
5089
5424
  // src/studio/sidebar/sidebar-nav.tsx
5090
- var import_jsx_runtime40 = require("react/jsx-runtime");
5425
+ var import_jsx_runtime44 = require("react/jsx-runtime");
5091
5426
  var StudioSidebarNav = ({
5092
5427
  workforces,
5093
5428
  selectedId,
@@ -5096,7 +5431,7 @@ var StudioSidebarNav = ({
5096
5431
  showTooltips
5097
5432
  }) => {
5098
5433
  if (workforces.length === 0) return null;
5099
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
5434
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
5100
5435
  "nav",
5101
5436
  {
5102
5437
  className: cn(
@@ -5108,11 +5443,11 @@ var StudioSidebarNav = ({
5108
5443
  const id = workforceItemId(w);
5109
5444
  const isActive = id === selectedId;
5110
5445
  const label = workforceItemLabel(w);
5111
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
5446
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
5112
5447
  StudioSidebarEntryMotion,
5113
5448
  {
5114
5449
  className: iconOnlyLayout ? studioSidebarCollapsedRailChipRowClass : void 0,
5115
- children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(StudioSidebarTooltip, { label, enabled: showTooltips, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
5450
+ children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(StudioSidebarTooltip, { label, enabled: showTooltips, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
5116
5451
  "button",
5117
5452
  {
5118
5453
  type: "button",
@@ -5123,7 +5458,7 @@ var StudioSidebarNav = ({
5123
5458
  studioSidebarNavItemClasses(iconOnlyLayout, isActive),
5124
5459
  iconOnlyLayout && "inline-flex"
5125
5460
  ),
5126
- children: iconOnlyLayout ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-xs font-semibold leading-none", children: workforceItemInitial(w) }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "min-w-0 truncate", children: label })
5461
+ children: iconOnlyLayout ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "text-xs font-semibold leading-none", children: workforceItemInitial(w) }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "min-w-0 truncate", children: label })
5127
5462
  }
5128
5463
  ) })
5129
5464
  },
@@ -5136,7 +5471,7 @@ var StudioSidebarNav = ({
5136
5471
 
5137
5472
  // src/studio/sidebar/timbal-mark.tsx
5138
5473
  var import_shaders_react = require("@paper-design/shaders-react");
5139
- var import_jsx_runtime41 = require("react/jsx-runtime");
5474
+ var import_jsx_runtime45 = require("react/jsx-runtime");
5140
5475
  var DEFAULT_SIZE = 64;
5141
5476
  var TRANSPARENT_BACK = "#00000000";
5142
5477
  var TIMBAL_SYMBOL_DATA_URI = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAACWCAYAAAA8AXHiAAAH6ElEQVR4Aeyci7EcNRBFFxIBIgEygUiASCATyASIBOa4rFrZntmPPq1W93218o5nZyTd26dbmnX5fX3TjxyY4IDAmmCqurzdBJYomOKAwJpiqzoVWGJgigMCa4qt6lRgZWHAWKfAMjY8y3ACK0ukjXUKLGPDswwnsLJE2linwDI2PMtwAitLpI11Cixjw+/DxT4SWLHju0ydwHrP+p/euzzE1T8cKr492lsvgfWaXZj733Hp90fL9Pr1EPvn0QTWYcLoF8bS6Pdf/kjQAAnNv7RqVcW6do4q9ffxMe/HW5oXy323boF1zkvzEnDe3RZnS5X6fcRsBdbdRY6oTl1LAJ1s2NDdXaVq3QLr7kapUph8Pxv/iESiDVUqsG63sgQ0b1Rve/6QQEOrVG1DdrCGbFRrQzc5Zh9FlSKppkw5M1gYi8FTjHXaaalSJNTUKWYEC3P5spP3qeY667zsIadVqVpvNrCoUrTag+jHgIRm0z2ka7AGRpzqNG2jOnCeo7uiSi3RnQEszCVjydzRgfPaH1rRbFqlajMig0WVWmpubbThMRvzJVWq1hgVrFKlgKvWG/2YRHLxpBsNrOVLwCJySSBXT7qRwHKxBCwAiypFWzD09ZARwCpVysUScG318E+oUsv3Uleq3gPrqpd1512bO9GWsockqSYO0971zmBR/mnt6ve7k0RC87KvEV61bEewMNftEvCq8Q3XlSqF/obbbW/ZDSz2UWSs2yVgQvjQimb3VarWvgtYZCnm8uRXzz/6MXq3rM47gLXVEjCI9FKlqNCDurTtxjNYxdytloAB4aM6r65S3TK8grXtEtAZEZZ7Wmc362/3BlapUtsuAY0hDVGlau2ewApnbm30g+OyhySpHly210dewKL80/Zyr2+2JBKaQ+4hV4OFudtvVBv4KlUK/Q23+79lJVjso8jYUEvAk5CjFc0hq1StfQVYZCnm8uRXzyX6MXqbq/Nu5liDFX4JOAGgVCkq9MnHMU9ZgVXMDb8EfIYJ1TlNlaq1W4BFlcpoLss9rfY7zfFMsFSl0mD0pdBZYKXaqFa2so+iSpFU1el8hzPAwlgMzuQmeyl0k1ARdf/zrqiRYGGuq/+C9K4Zb11/v5g9JFCh/342+dEosDCWlslOljs0Z3vSfSnGvWCRpRmf+KhSGXW/BBUX9YCFuWQsmUtfGdo3h0g0q0odRjx6tYAFSFnNZXNOlX7kqT47HGgB67jtJnNv+nnkQCtYj/rUZ3LgFggsRdOTAwLLUzQCzUVgBQqmJykCy1M0As1FYAUKpicpAstTNALNRWAFCqYnKTPB8qRTczF2QGAZG55lOIGVJdLGOgWWseFZhhNYWSJtrFNgGRueZTiBlSXSM3We9C2wTkzRqX4HBFa/h+rhxAGBdWKKTvU7ILD6PVQPJw4IrBNTdKrfAYHV76F6OHFAYJ2Ysv+p9QoE1voYhJyBwAoZ1vWiBNb6GIScgcAKGdb1ogTW+hiEnIHAChnW9aIElk0M0o0isNKF3EawwLLxOd0oAitdyN8W/Ndxx9LfmnyMH/aFuX+EVXct7Lfjox+P9vZLFeu5ZcXcf59fGuYKKhRA8Xtmm0QJrGvbqFJd5l537foTKvN3xwzRf7y1vdKC9cSuUqW6zH0yhsePSaSfR0xMYH3qYvcS8Gl32/yNBPrqmC3vx1v/S2DdPRyyBNy72+aIKkUbOuEWsPg970MnsbizUqWGLAGLtbwzPNWpey91NWALWFd97Xh+qrmODSl7SJJqyjQzg0X5p00x1mmnJBKam79GeFVXRrAwd9oS8KrxC64rVQr904f3A9Z0qR8GYB9Fxk5bAj6M4usPtKJ5epWqZWcBiyzFXJ78av3Rj9G7pDpnAMt0CXBCaqlSVOglU4oMVjHXdAlYEsVPB6U6L6lS9TSigkWVWm5ubbTRMcs9zWi462GigaUqdR1r008igbVso2oasS8HYx9FlSKpvvx00ZkHYC2aUduwGIvBbXfveRd7KXSTUO4U7A4W5g79V3l3ETqfEHtIoEL/+RWLz+4MFsbSFltoOjzLHZrdP+nuCBZZmvGJjyVvG927gVWWADLXtFQsHAytVKmt9pC7gEWVwlz3S8BgANG9TZWqte8AVqlSmFzPPfoxiUSbrnPGAJ7BKkuAqtSMyE/u0ytYW21UB8aIfRRViqQa2K19Vx7BwlgMtndj3Ygs8+gmodbNYuDInsDCXH3ZOTC4K7vyAhbZSlvphfXYLHdoDrmHXA0WVWrLx+lOCnnSDa17JViYS8aSuZ1x2uZ2tKL5cZXaRs71RFeARZVKYe5ntrMxD12lar3WYJUqBVz1PKIfk0ipnnStwEqzBHyWISRQxifdmwVYqZaACiyqFK06ledwJlilSqVaAg50qFJp9lKH3tPXLLCymlv2kCTVqeFZTs4Ai/JPC+ThUykkEprDf43w1ImPF4wEC3MzLgGlSqH/o616GwUW+ygyNtMSgFY0q0qd5FEvWGQp5vLkd9J92FPozVidXw5oD1hZlwASiQr9sskZL2wBK+sSgO6UX3a2JEYrWCyBLePtfA/L387zN517C1imE7wYTKedOyCwnAdo1+kJrF0j53zeAst5gHadnsDaNXLO5y2wnAdo1+kJrF0j53zew8ByrlPTM3ZAYBkbnmU4gZUl0sY6BZax4VmGE1hZIm2sU2AZG55lOIGVJdLDdL7W0f8AAAD//x3VUCQAAAAGSURBVAMArsj7LTb9pqMAAAAASUVORK5CYII=";
@@ -5145,14 +5480,14 @@ function TimbalMark({
5145
5480
  size = DEFAULT_SIZE,
5146
5481
  src = TIMBAL_SYMBOL_DATA_URI
5147
5482
  }) {
5148
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
5483
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
5149
5484
  "div",
5150
5485
  {
5151
5486
  className: cn("relative shrink-0 bg-transparent", className),
5152
5487
  style: { width: size, height: size },
5153
5488
  role: "img",
5154
5489
  "aria-label": "Timbal",
5155
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
5490
+ children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
5156
5491
  import_shaders_react.LiquidMetal,
5157
5492
  {
5158
5493
  width: size,
@@ -5184,14 +5519,14 @@ function TimbalMark({
5184
5519
  }
5185
5520
 
5186
5521
  // src/studio/sidebar/shell-inset-bridge-context.tsx
5187
- var import_react40 = require("react");
5522
+ var import_react38 = require("react");
5188
5523
 
5189
5524
  // src/layout/shell-inset-context.tsx
5190
- var import_react39 = require("react");
5191
- var ShellInsetContext = (0, import_react39.createContext)(null);
5525
+ var import_react37 = require("react");
5526
+ var ShellInsetContext = (0, import_react37.createContext)(null);
5192
5527
  var ShellInsetProvider = ShellInsetContext.Provider;
5193
5528
  function useShellInsetReporter() {
5194
- return (0, import_react39.useContext)(ShellInsetContext);
5529
+ return (0, import_react37.useContext)(ShellInsetContext);
5195
5530
  }
5196
5531
 
5197
5532
  // src/studio/sidebar/shell-inset-bridge-context.tsx
@@ -5200,7 +5535,7 @@ var StudioSidebarShellInsetBridge = ({
5200
5535
  }) => {
5201
5536
  const reportInset = useShellInsetReporter();
5202
5537
  const { isMobile, isCollapsedRail } = useStudioSidebarLayout();
5203
- (0, import_react40.useLayoutEffect)(() => {
5538
+ (0, import_react38.useLayoutEffect)(() => {
5204
5539
  const insetPx = isMobile ? 0 : isCollapsedRail ? SIDEBAR_INSET_PX_COLLAPSED : SIDEBAR_INSET_PX_EXPANDED;
5205
5540
  reportInset?.(insetPx);
5206
5541
  onInsetChange?.(insetPx);
@@ -5209,7 +5544,7 @@ var StudioSidebarShellInsetBridge = ({
5209
5544
  };
5210
5545
 
5211
5546
  // src/studio/sidebar/sidebar.tsx
5212
- var import_jsx_runtime42 = require("react/jsx-runtime");
5547
+ var import_jsx_runtime46 = require("react/jsx-runtime");
5213
5548
  var DEFAULT_BREAKPOINT_PX = 768;
5214
5549
  function readPersistedCollapsed(key) {
5215
5550
  if (!key || typeof window === "undefined") return false;
@@ -5242,7 +5577,7 @@ var StudioSidebarPanel = ({
5242
5577
  brand,
5243
5578
  emptyCaption = null
5244
5579
  }) => {
5245
- const reducedMotion = (0, import_react42.useReducedMotion)();
5580
+ const reducedMotion = (0, import_react40.useReducedMotion)();
5246
5581
  const isCollapsedRail = widthCollapsed && !isMobile;
5247
5582
  const iconOnlyLayout = studioSidebarIconOnlyLayout(isMobile, isCollapsedRail);
5248
5583
  const isDrawerOpen = isMobile && mobileOpen;
@@ -5259,9 +5594,9 @@ var StudioSidebarPanel = ({
5259
5594
  onCollapsedChange(!collapsed);
5260
5595
  };
5261
5596
  const panelWidthPx = isMobile ? SIDEBAR_MOBILE_PX : widthCollapsed ? SIDEBAR_WIDTH_COLLAPSED_PX : SIDEBAR_WIDTH_PX;
5262
- const brandNode = brand ?? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TimbalMark, { size: 32 });
5263
- const panel = /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
5264
- import_react42.motion.div,
5597
+ const brandNode = brand ?? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(TimbalMark, { size: 32 });
5598
+ const panel = /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
5599
+ import_react40.motion.div,
5265
5600
  {
5266
5601
  "data-sidebar-collapsed": isCollapsedRail ? "" : void 0,
5267
5602
  className: cn(
@@ -5275,7 +5610,7 @@ var StudioSidebarPanel = ({
5275
5610
  style: { willChange: entriesVisible ? void 0 : "width" },
5276
5611
  onAnimationComplete: isMobile || entriesVisible ? void 0 : () => onPanelWidthComplete(),
5277
5612
  children: [
5278
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
5613
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
5279
5614
  StudioSidebarHeader,
5280
5615
  {
5281
5616
  isCollapsedRail,
@@ -5285,13 +5620,13 @@ var StudioSidebarPanel = ({
5285
5620
  brand: brandNode
5286
5621
  }
5287
5622
  ),
5288
- /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
5623
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
5289
5624
  StudioSidebarEntries,
5290
5625
  {
5291
5626
  visible: entriesVisible,
5292
5627
  onBlurOutComplete: onEntriesBlurOutComplete,
5293
5628
  children: [
5294
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
5629
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
5295
5630
  "div",
5296
5631
  {
5297
5632
  id: DOM_IDS.sidebarRuntimeAnchor,
@@ -5301,7 +5636,7 @@ var StudioSidebarPanel = ({
5301
5636
  )
5302
5637
  }
5303
5638
  ),
5304
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
5639
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
5305
5640
  StudioSidebarNav,
5306
5641
  {
5307
5642
  workforces,
@@ -5311,8 +5646,8 @@ var StudioSidebarPanel = ({
5311
5646
  showTooltips: isCollapsedRail
5312
5647
  }
5313
5648
  ),
5314
- workforces.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "min-h-0 flex-1" }) : null,
5315
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
5649
+ workforces.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "min-h-0 flex-1" }) : null,
5650
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
5316
5651
  StudioSidebarFooter,
5317
5652
  {
5318
5653
  iconOnlyLayout,
@@ -5328,8 +5663,8 @@ var StudioSidebarPanel = ({
5328
5663
  }
5329
5664
  );
5330
5665
  if (isMobile) {
5331
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
5332
- import_react42.motion.aside,
5666
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
5667
+ import_react40.motion.aside,
5333
5668
  {
5334
5669
  className: "fixed inset-y-0 left-0 z-[60] flex",
5335
5670
  "aria-label": "Studio navigation",
@@ -5344,7 +5679,7 @@ var StudioSidebarPanel = ({
5344
5679
  }
5345
5680
  );
5346
5681
  }
5347
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
5682
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
5348
5683
  "aside",
5349
5684
  {
5350
5685
  className: "absolute inset-y-0 left-0 z-[60] flex py-[var(--studio-sidebar-gap)] pl-[var(--studio-sidebar-gap)]",
@@ -5366,51 +5701,51 @@ var StudioSidebar = ({
5366
5701
  onMobileOpenChange: onMobileOpenChangeProp,
5367
5702
  onInsetChange
5368
5703
  }) => {
5369
- const reducedMotion = (0, import_react42.useReducedMotion)();
5704
+ const reducedMotion = (0, import_react40.useReducedMotion)();
5370
5705
  const fetched = useWorkforces({ enabled: workforcesProp === void 0 });
5371
5706
  const workforces = workforcesProp ?? fetched.workforces;
5372
- const [internalSelected, setInternalSelected] = (0, import_react41.useState)(
5707
+ const [internalSelected, setInternalSelected] = (0, import_react39.useState)(
5373
5708
  selectedIdProp ?? ""
5374
5709
  );
5375
- (0, import_react41.useEffect)(() => {
5710
+ (0, import_react39.useEffect)(() => {
5376
5711
  if (selectedIdProp !== void 0) return;
5377
5712
  if (internalSelected) return;
5378
5713
  const first = workforces[0]?.id ?? workforces[0]?.uid ?? workforces[0]?.name;
5379
5714
  if (first) setInternalSelected(first);
5380
5715
  }, [workforces, selectedIdProp, internalSelected]);
5381
5716
  const selectedId = selectedIdProp ?? internalSelected ?? workforces[0]?.id ?? workforces[0]?.uid ?? workforces[0]?.name ?? "";
5382
- const handleSelect = (0, import_react41.useCallback)(
5717
+ const handleSelect = (0, import_react39.useCallback)(
5383
5718
  (id) => {
5384
5719
  if (selectedIdProp === void 0) setInternalSelected(id);
5385
5720
  onSelect?.(id);
5386
5721
  },
5387
5722
  [selectedIdProp, onSelect]
5388
5723
  );
5389
- const [collapsed, setCollapsed] = (0, import_react41.useState)(() => {
5724
+ const [collapsed, setCollapsed] = (0, import_react39.useState)(() => {
5390
5725
  const persisted = readPersistedCollapsed(persistKey);
5391
5726
  return persisted || defaultCollapsed;
5392
5727
  });
5393
- const handleCollapsedChange = (0, import_react41.useCallback)(
5728
+ const handleCollapsedChange = (0, import_react39.useCallback)(
5394
5729
  (next) => {
5395
5730
  setCollapsed(next);
5396
5731
  writePersistedCollapsed(persistKey, next);
5397
5732
  },
5398
5733
  [persistKey]
5399
5734
  );
5400
- const [isMobile, setIsMobile] = (0, import_react41.useState)(() => {
5735
+ const [isMobile, setIsMobile] = (0, import_react39.useState)(() => {
5401
5736
  if (typeof window === "undefined") return false;
5402
5737
  return window.innerWidth < mobileBreakpointPx;
5403
5738
  });
5404
- (0, import_react41.useEffect)(() => {
5739
+ (0, import_react39.useEffect)(() => {
5405
5740
  if (typeof window === "undefined") return;
5406
5741
  const onResize = () => setIsMobile(window.innerWidth < mobileBreakpointPx);
5407
5742
  onResize();
5408
5743
  window.addEventListener("resize", onResize);
5409
5744
  return () => window.removeEventListener("resize", onResize);
5410
5745
  }, [mobileBreakpointPx]);
5411
- const [internalMobileOpen, setInternalMobileOpen] = (0, import_react41.useState)(false);
5746
+ const [internalMobileOpen, setInternalMobileOpen] = (0, import_react39.useState)(false);
5412
5747
  const mobileOpen = mobileOpenProp ?? internalMobileOpen;
5413
- const setMobileOpen = (0, import_react41.useCallback)(
5748
+ const setMobileOpen = (0, import_react39.useCallback)(
5414
5749
  (next) => {
5415
5750
  if (mobileOpenProp === void 0) setInternalMobileOpen(next);
5416
5751
  onMobileOpenChangeProp?.(next);
@@ -5427,7 +5762,7 @@ var StudioSidebar = ({
5427
5762
  const entriesVisible = isMobile || phaseEntriesVisible;
5428
5763
  const isCollapsedRail = widthCollapsed && !isMobile;
5429
5764
  const iconOnlyLayout = studioSidebarIconOnlyLayout(isMobile, isCollapsedRail);
5430
- const contextValue = (0, import_react41.useMemo)(
5765
+ const contextValue = (0, import_react39.useMemo)(
5431
5766
  () => ({
5432
5767
  collapsed: effectiveCollapsed,
5433
5768
  isMobile,
@@ -5436,9 +5771,9 @@ var StudioSidebar = ({
5436
5771
  }),
5437
5772
  [effectiveCollapsed, isMobile, isCollapsedRail, iconOnlyLayout]
5438
5773
  );
5439
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(StudioSidebarContext.Provider, { value: contextValue, children: [
5440
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(StudioSidebarShellInsetBridge, { onInsetChange }),
5441
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
5774
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(StudioSidebarContext.Provider, { value: contextValue, children: [
5775
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(StudioSidebarShellInsetBridge, { onInsetChange }),
5776
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
5442
5777
  StudioSidebarPanel,
5443
5778
  {
5444
5779
  workforces,
@@ -5461,26 +5796,26 @@ var StudioSidebar = ({
5461
5796
  };
5462
5797
 
5463
5798
  // src/studio/sidebar/sidebar-runtime-portal.tsx
5464
- var import_react43 = require("react");
5799
+ var import_react41 = require("react");
5465
5800
  var import_react_dom = require("react-dom");
5466
5801
  var import_lucide_react12 = require("lucide-react");
5467
- var import_react44 = require("@assistant-ui/react");
5468
- var import_jsx_runtime43 = require("react/jsx-runtime");
5802
+ var import_react42 = require("@assistant-ui/react");
5803
+ var import_jsx_runtime47 = require("react/jsx-runtime");
5469
5804
  var StudioSidebarRuntimePortal = ({
5470
5805
  label = "New chat"
5471
5806
  }) => {
5472
5807
  const { iconOnlyLayout } = useStudioSidebarLayout();
5473
- const hasMessages = (0, import_react44.useThread)((s) => s.messages.length > 0);
5808
+ const hasMessages = (0, import_react42.useThread)((s) => s.messages.length > 0);
5474
5809
  const { clear } = useTimbalRuntime();
5475
- const [anchor, setAnchor] = (0, import_react43.useState)(null);
5476
- const startNewChat = (0, import_react43.useCallback)(() => {
5810
+ const [anchor, setAnchor] = (0, import_react41.useState)(null);
5811
+ const startNewChat = (0, import_react41.useCallback)(() => {
5477
5812
  clear();
5478
5813
  }, [clear]);
5479
- (0, import_react43.useLayoutEffect)(() => {
5814
+ (0, import_react41.useLayoutEffect)(() => {
5480
5815
  setAnchor(document.getElementById(DOM_IDS.sidebarRuntimeAnchor));
5481
5816
  }, []);
5482
5817
  if (!anchor || !hasMessages) return null;
5483
- const button = /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
5818
+ const button = /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
5484
5819
  "button",
5485
5820
  {
5486
5821
  type: "button",
@@ -5488,24 +5823,24 @@ var StudioSidebarRuntimePortal = ({
5488
5823
  "aria-label": label,
5489
5824
  className: studioSidebarNavItemClasses(iconOnlyLayout, false),
5490
5825
  children: [
5491
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react12.MessageSquarePlus, { className: "size-3.5 shrink-0" }),
5492
- !iconOnlyLayout ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "min-w-0 truncate", children: label }) : null
5826
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react12.MessageSquarePlus, { className: "size-3.5 shrink-0" }),
5827
+ !iconOnlyLayout ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "min-w-0 truncate", children: label }) : null
5493
5828
  ]
5494
5829
  }
5495
5830
  );
5496
5831
  return (0, import_react_dom.createPortal)(
5497
- iconOnlyLayout ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Tooltip, { children: [
5498
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(TooltipTrigger, { asChild: true, children: button }),
5499
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(TooltipContent, { side: "right", className: "text-xs", children: label })
5832
+ iconOnlyLayout ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Tooltip, { children: [
5833
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TooltipTrigger, { asChild: true, children: button }),
5834
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TooltipContent, { side: "right", className: "text-xs", children: label })
5500
5835
  ] }) : button,
5501
5836
  anchor
5502
5837
  );
5503
5838
  };
5504
5839
 
5505
5840
  // src/studio/sidebar/welcome.tsx
5506
- var import_react45 = require("motion/react");
5507
- var import_react46 = require("@assistant-ui/react");
5508
- var import_jsx_runtime44 = require("react/jsx-runtime");
5841
+ var import_react43 = require("motion/react");
5842
+ var import_react44 = require("@assistant-ui/react");
5843
+ var import_jsx_runtime48 = require("react/jsx-runtime");
5509
5844
  var welcomeStagger2 = {
5510
5845
  initial: {},
5511
5846
  animate: {
@@ -5530,34 +5865,34 @@ var welcomeIcon2 = {
5530
5865
  }
5531
5866
  };
5532
5867
  var StudioWelcome = ({ config, icon }) => {
5533
- const isEmpty = (0, import_react46.useThread)((s) => s.messages.length === 0);
5868
+ const isEmpty = (0, import_react44.useThread)((s) => s.messages.length === 0);
5534
5869
  if (!isEmpty) return null;
5535
- const iconNode = icon ?? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
5870
+ const iconNode = icon ?? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
5536
5871
  TimbalMark,
5537
5872
  {
5538
5873
  size: 112,
5539
5874
  className: "max-md:scale-[0.58] max-md:origin-center"
5540
5875
  }
5541
5876
  );
5542
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "aui-thread-welcome-root mx-auto my-auto flex w-full max-w-(--thread-max-width) grow flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "aui-thread-welcome-center flex w-full grow flex-col items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
5543
- import_react45.motion.div,
5877
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "aui-thread-welcome-root mx-auto my-auto flex w-full max-w-(--thread-max-width) grow flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "aui-thread-welcome-center flex w-full grow flex-col items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
5878
+ import_react43.motion.div,
5544
5879
  {
5545
5880
  className: "aui-thread-welcome-message flex flex-col items-center justify-center px-2 text-center sm:px-4",
5546
5881
  variants: welcomeStagger2,
5547
5882
  initial: "initial",
5548
5883
  animate: "animate",
5549
5884
  children: [
5550
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react45.motion.div, { variants: welcomeIcon2, className: "mb-4 md:mb-5", children: iconNode }),
5551
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
5552
- import_react45.motion.h1,
5885
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react43.motion.div, { variants: welcomeIcon2, className: "mb-4 md:mb-5", children: iconNode }),
5886
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
5887
+ import_react43.motion.h1,
5553
5888
  {
5554
5889
  variants: welcomeItem2,
5555
5890
  className: "aui-thread-welcome-message-inner text-xl font-semibold sm:text-2xl",
5556
5891
  children: config?.heading ?? "How can I help you today?"
5557
5892
  }
5558
5893
  ),
5559
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
5560
- import_react45.motion.p,
5894
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
5895
+ import_react43.motion.p,
5561
5896
  {
5562
5897
  variants: welcomeItem2,
5563
5898
  className: "aui-thread-welcome-message-inner mt-2 text-muted-foreground",
@@ -5570,8 +5905,8 @@ var StudioWelcome = ({ config, icon }) => {
5570
5905
  };
5571
5906
 
5572
5907
  // src/studio/shell/studio-shell.tsx
5573
- var import_jsx_runtime45 = require("react/jsx-runtime");
5574
- var import_react49 = require("react");
5908
+ var import_jsx_runtime49 = require("react/jsx-runtime");
5909
+ var import_react47 = require("react");
5575
5910
  var DEFAULT_BREAKPOINT_PX2 = 768;
5576
5911
  function readPersistedCollapsed2(key) {
5577
5912
  if (!key || typeof window === "undefined") return false;
@@ -5591,9 +5926,9 @@ function writePersistedCollapsed2(key, collapsed) {
5591
5926
  function makeComposerWithPortal(BaseComposer) {
5592
5927
  const Resolved = BaseComposer ?? Composer;
5593
5928
  return function StudioComposerWithSidebar(props) {
5594
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
5595
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(StudioSidebarRuntimePortal, {}),
5596
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Resolved, { ...props })
5929
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
5930
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(StudioSidebarRuntimePortal, {}),
5931
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Resolved, { ...props })
5597
5932
  ] });
5598
5933
  };
5599
5934
  }
@@ -5613,7 +5948,7 @@ var TimbalStudioShell = ({
5613
5948
  components,
5614
5949
  ...chatProps
5615
5950
  }) => {
5616
- const reducedMotion = (0, import_react48.useReducedMotion)();
5951
+ const reducedMotion = (0, import_react46.useReducedMotion)();
5617
5952
  const shouldFetchWorkforces = !workforceId && workforcesProp === void 0;
5618
5953
  const fetched = useWorkforces({
5619
5954
  enabled: shouldFetchWorkforces,
@@ -5621,36 +5956,36 @@ var TimbalStudioShell = ({
5621
5956
  baseUrl: workforcesBaseUrl
5622
5957
  });
5623
5958
  const workforces = workforcesProp ?? fetched.workforces;
5624
- const [internalSelected, setInternalSelected] = (0, import_react47.useState)(
5959
+ const [internalSelected, setInternalSelected] = (0, import_react45.useState)(
5625
5960
  workforceId ?? ""
5626
5961
  );
5627
- (0, import_react47.useEffect)(() => {
5962
+ (0, import_react45.useEffect)(() => {
5628
5963
  if (workforceId) return;
5629
5964
  if (internalSelected) return;
5630
5965
  const first = workforces[0]?.id ?? workforces[0]?.uid ?? workforces[0]?.name;
5631
5966
  if (first) setInternalSelected(first);
5632
5967
  }, [workforces, workforceId, internalSelected]);
5633
5968
  const activeWorkforceId = workforceId ?? internalSelected ?? fetched.selectedId ?? "";
5634
- const [collapsed, setCollapsed] = (0, import_react47.useState)(() => {
5969
+ const [collapsed, setCollapsed] = (0, import_react45.useState)(() => {
5635
5970
  const persisted = readPersistedCollapsed2(persistKey);
5636
5971
  return persisted || defaultCollapsed;
5637
5972
  });
5638
- const [isMobile, setIsMobile] = (0, import_react47.useState)(() => {
5973
+ const [isMobile, setIsMobile] = (0, import_react45.useState)(() => {
5639
5974
  if (typeof window === "undefined") return false;
5640
5975
  return window.innerWidth < mobileBreakpointPx;
5641
5976
  });
5642
- const [mobileSidebarOpen, setMobileSidebarOpen] = (0, import_react47.useState)(false);
5643
- (0, import_react47.useEffect)(() => {
5977
+ const [mobileSidebarOpen, setMobileSidebarOpen] = (0, import_react45.useState)(false);
5978
+ (0, import_react45.useEffect)(() => {
5644
5979
  if (typeof window === "undefined") return;
5645
5980
  const onResize = () => setIsMobile(window.innerWidth < mobileBreakpointPx);
5646
5981
  onResize();
5647
5982
  window.addEventListener("resize", onResize);
5648
5983
  return () => window.removeEventListener("resize", onResize);
5649
5984
  }, [mobileBreakpointPx]);
5650
- (0, import_react47.useEffect)(() => {
5985
+ (0, import_react45.useEffect)(() => {
5651
5986
  if (!isMobile) setMobileSidebarOpen(false);
5652
5987
  }, [isMobile]);
5653
- (0, import_react47.useEffect)(() => {
5988
+ (0, import_react45.useEffect)(() => {
5654
5989
  if (!mobileSidebarOpen) return;
5655
5990
  const onKeyDown = (e) => {
5656
5991
  if (e.key === "Escape") setMobileSidebarOpen(false);
@@ -5674,21 +6009,21 @@ var TimbalStudioShell = ({
5674
6009
  layoutDirection
5675
6010
  );
5676
6011
  const desktopInsetPx = widthCollapsed ? SIDEBAR_INSET_PX_COLLAPSED : SIDEBAR_INSET_PX_EXPANDED;
5677
- const onCollapsedChange = (0, import_react47.useCallback)(
6012
+ const onCollapsedChange = (0, import_react45.useCallback)(
5678
6013
  (next) => {
5679
6014
  setCollapsed(next);
5680
6015
  writePersistedCollapsed2(persistKey, next);
5681
6016
  },
5682
6017
  [persistKey]
5683
6018
  );
5684
- const handleSelectWorkforce = (0, import_react47.useCallback)(
6019
+ const handleSelectWorkforce = (0, import_react45.useCallback)(
5685
6020
  (id) => {
5686
6021
  if (!workforceId) setInternalSelected(id);
5687
6022
  if (isMobile) setMobileSidebarOpen(false);
5688
6023
  },
5689
6024
  [workforceId, isMobile]
5690
6025
  );
5691
- const sidebarContext = (0, import_react47.useMemo)(
6026
+ const sidebarContext = (0, import_react45.useMemo)(
5692
6027
  () => ({
5693
6028
  collapsed: effectiveCollapsed,
5694
6029
  isMobile,
@@ -5697,12 +6032,12 @@ var TimbalStudioShell = ({
5697
6032
  }),
5698
6033
  [effectiveCollapsed, isMobile, isCollapsedRail, iconOnlyLayout]
5699
6034
  );
5700
- const resolvedComponents = (0, import_react47.useMemo)(() => {
6035
+ const resolvedComponents = (0, import_react45.useMemo)(() => {
5701
6036
  const next = { Welcome: StudioWelcome, ...components };
5702
6037
  next.Composer = makeComposerWithPortal(components?.Composer);
5703
6038
  return next;
5704
6039
  }, [components]);
5705
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(StudioSidebarContext.Provider, { value: sidebarContext, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
6040
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(StudioSidebarContext.Provider, { value: sidebarContext, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
5706
6041
  "div",
5707
6042
  {
5708
6043
  className: cn(
@@ -5711,14 +6046,14 @@ var TimbalStudioShell = ({
5711
6046
  ),
5712
6047
  style: studioChromeShellStyle,
5713
6048
  children: [
5714
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
6049
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
5715
6050
  "div",
5716
6051
  {
5717
6052
  className: "pointer-events-none absolute inset-0 z-0 bg-background",
5718
6053
  "aria-hidden": true
5719
6054
  }
5720
6055
  ),
5721
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
6056
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
5722
6057
  "div",
5723
6058
  {
5724
6059
  className: cn(
@@ -5728,14 +6063,14 @@ var TimbalStudioShell = ({
5728
6063
  "aria-hidden": true
5729
6064
  }
5730
6065
  ),
5731
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
6066
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
5732
6067
  StudioSidebarBackdrop,
5733
6068
  {
5734
6069
  open: isMobile && mobileSidebarOpen,
5735
6070
  onClose: () => setMobileSidebarOpen(false)
5736
6071
  }
5737
6072
  ),
5738
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
6073
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
5739
6074
  StudioSidebarPanel,
5740
6075
  {
5741
6076
  workforces,
@@ -5754,8 +6089,8 @@ var TimbalStudioShell = ({
5754
6089
  emptyCaption: sidebarEmptyCaption
5755
6090
  }
5756
6091
  ),
5757
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
5758
- import_react48.motion.header,
6092
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
6093
+ import_react46.motion.header,
5759
6094
  {
5760
6095
  className: cn(
5761
6096
  "absolute top-0 right-0 z-40 flex items-start justify-between gap-2",
@@ -5766,7 +6101,7 @@ var TimbalStudioShell = ({
5766
6101
  animate: { left: isMobile ? 0 : desktopInsetPx },
5767
6102
  transition: layoutTransition,
5768
6103
  children: [
5769
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
6104
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
5770
6105
  "div",
5771
6106
  {
5772
6107
  className: cn(
@@ -5774,7 +6109,7 @@ var TimbalStudioShell = ({
5774
6109
  studioTopbarPillHeightClass
5775
6110
  ),
5776
6111
  children: [
5777
- isMobile && !mobileSidebarOpen ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
6112
+ isMobile && !mobileSidebarOpen ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
5778
6113
  TimbalV2Button,
5779
6114
  {
5780
6115
  variant: "secondary",
@@ -5784,19 +6119,19 @@ var TimbalStudioShell = ({
5784
6119
  onClick: () => setMobileSidebarOpen(true),
5785
6120
  "aria-label": "Open menu",
5786
6121
  "aria-expanded": false,
5787
- children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_lucide_react13.Menu, { className: "size-4" })
6122
+ children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lucide_react13.Menu, { className: "size-4" })
5788
6123
  }
5789
6124
  ) : null,
5790
6125
  headerStart
5791
6126
  ]
5792
6127
  }
5793
6128
  ),
5794
- headerActions ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "flex shrink-0 items-center gap-1", children: headerActions }) : null
6129
+ headerActions ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "flex shrink-0 items-center gap-1", children: headerActions }) : null
5795
6130
  ]
5796
6131
  }
5797
6132
  ),
5798
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
5799
- import_react48.motion.main,
6133
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
6134
+ import_react46.motion.main,
5800
6135
  {
5801
6136
  className: cn(
5802
6137
  "relative z-10 flex h-full min-w-0 flex-col",
@@ -5806,7 +6141,7 @@ var TimbalStudioShell = ({
5806
6141
  initial: false,
5807
6142
  animate: { paddingLeft: isMobile ? 12 : desktopInsetPx },
5808
6143
  transition: layoutTransition,
5809
- children: activeWorkforceId ? /* @__PURE__ */ (0, import_react49.createElement)(
6144
+ children: activeWorkforceId ? /* @__PURE__ */ (0, import_react47.createElement)(
5810
6145
  TimbalChat,
5811
6146
  {
5812
6147
  ...chatProps,
@@ -5825,9 +6160,9 @@ var TimbalStudioShell = ({
5825
6160
  };
5826
6161
 
5827
6162
  // src/studio/sidebar/mode-toggle.tsx
5828
- var import_react50 = require("react");
6163
+ var import_react48 = require("react");
5829
6164
  var import_lucide_react14 = require("lucide-react");
5830
- var import_jsx_runtime46 = require("react/jsx-runtime");
6165
+ var import_jsx_runtime50 = require("react/jsx-runtime");
5831
6166
  function readStoredTheme() {
5832
6167
  if (typeof window === "undefined") return null;
5833
6168
  try {
@@ -5855,8 +6190,8 @@ var ModeToggle = ({
5855
6190
  label = "Toggle theme"
5856
6191
  }) => {
5857
6192
  const isControlled = theme !== void 0;
5858
- const [internalIsDark, setInternalIsDark] = (0, import_react50.useState)(false);
5859
- (0, import_react50.useLayoutEffect)(() => {
6193
+ const [internalIsDark, setInternalIsDark] = (0, import_react48.useState)(false);
6194
+ (0, import_react48.useLayoutEffect)(() => {
5860
6195
  if (isControlled) return;
5861
6196
  const stored = readStoredTheme();
5862
6197
  if (stored) {
@@ -5868,7 +6203,7 @@ var ModeToggle = ({
5868
6203
  setInternalIsDark(document.documentElement.classList.contains("dark"));
5869
6204
  }, [isControlled]);
5870
6205
  const isDark = isControlled ? theme === "dark" : internalIsDark;
5871
- const onClick = (0, import_react50.useCallback)(() => {
6206
+ const onClick = (0, import_react48.useCallback)(() => {
5872
6207
  const next = isDark ? "light" : "dark";
5873
6208
  if (setTheme) {
5874
6209
  setTheme(next);
@@ -5879,7 +6214,7 @@ var ModeToggle = ({
5879
6214
  writeStoredTheme(isDarkNext ? "dark" : "light");
5880
6215
  setInternalIsDark(isDarkNext);
5881
6216
  }, [isDark, setTheme]);
5882
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
6217
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
5883
6218
  TimbalV2Button,
5884
6219
  {
5885
6220
  variant: "secondary",
@@ -5895,20 +6230,20 @@ var ModeToggle = ({
5895
6230
  "aria-label": label,
5896
6231
  title: label,
5897
6232
  children: [
5898
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_lucide_react14.Sun, { className: "size-3.5 scale-100 rotate-0 transition-all dark:scale-0 dark:-rotate-90" }),
5899
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_lucide_react14.Moon, { className: "absolute size-3.5 scale-0 rotate-90 transition-all dark:scale-100 dark:rotate-0" }),
5900
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "sr-only", children: label })
6233
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_lucide_react14.Sun, { className: "size-3.5 scale-100 rotate-0 transition-all dark:scale-0 dark:-rotate-90" }),
6234
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_lucide_react14.Moon, { className: "absolute size-3.5 scale-0 rotate-90 transition-all dark:scale-100 dark:rotate-0" }),
6235
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "sr-only", children: label })
5901
6236
  ]
5902
6237
  }
5903
6238
  );
5904
6239
  };
5905
6240
 
5906
6241
  // src/studio/mode-switch.tsx
5907
- var import_react53 = require("react");
6242
+ var import_react51 = require("react");
5908
6243
 
5909
6244
  // src/ui/pill-segmented-tabs.tsx
5910
- var import_react51 = require("react");
5911
- var import_react52 = require("motion/react");
6245
+ var import_react49 = require("react");
6246
+ var import_react50 = require("motion/react");
5912
6247
 
5913
6248
  // src/design/pill-segmented-classes.ts
5914
6249
  var pillSegmentedTrackBase = "inline-flex w-fit max-w-max shrink-0 self-start items-center rounded-full";
@@ -5941,7 +6276,7 @@ var pillSegmentedActiveIndicatorClass = cn(
5941
6276
  );
5942
6277
 
5943
6278
  // src/ui/pill-segmented-tabs.tsx
5944
- var import_jsx_runtime47 = require("react/jsx-runtime");
6279
+ var import_jsx_runtime51 = require("react/jsx-runtime");
5945
6280
  var PillTab = ({
5946
6281
  tabKey,
5947
6282
  label,
@@ -5952,10 +6287,10 @@ var PillTab = ({
5952
6287
  segmentClassName,
5953
6288
  animateIndicator
5954
6289
  }) => {
5955
- const handlePress = (0, import_react51.useCallback)(() => {
6290
+ const handlePress = (0, import_react49.useCallback)(() => {
5956
6291
  if (!disabled) onSelect(tabKey);
5957
6292
  }, [disabled, onSelect, tabKey]);
5958
- return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
6293
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
5959
6294
  "button",
5960
6295
  {
5961
6296
  type: "button",
@@ -5968,15 +6303,15 @@ var PillTab = ({
5968
6303
  !disabled && (isActive ? "text-foreground" : "text-muted-foreground hover:text-foreground")
5969
6304
  ),
5970
6305
  children: [
5971
- isActive && animateIndicator ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
5972
- import_react52.motion.div,
6306
+ isActive && animateIndicator ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
6307
+ import_react50.motion.div,
5973
6308
  {
5974
6309
  layoutId,
5975
6310
  className: pillSegmentedActiveIndicatorClass,
5976
6311
  transition: { type: "spring", duration: 0.3, bounce: 0.15 }
5977
6312
  }
5978
- ) : isActive ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: pillSegmentedActiveIndicatorClass, "aria-hidden": true }) : null,
5979
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "relative z-10 whitespace-nowrap", children: label })
6313
+ ) : isActive ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: pillSegmentedActiveIndicatorClass, "aria-hidden": true }) : null,
6314
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "relative z-10 whitespace-nowrap", children: label })
5980
6315
  ]
5981
6316
  }
5982
6317
  );
@@ -5990,13 +6325,13 @@ var PillSegmentedTabs = ({
5990
6325
  layoutId: layoutIdProp,
5991
6326
  "aria-label": ariaLabel
5992
6327
  }) => {
5993
- const reactId = (0, import_react51.useId)();
6328
+ const reactId = (0, import_react49.useId)();
5994
6329
  const layoutId = layoutIdProp ?? `pill-segmented-${reactId.replace(/:/g, "")}`;
5995
- const reducedMotion = (0, import_react52.useReducedMotion)();
6330
+ const reducedMotion = (0, import_react50.useReducedMotion)();
5996
6331
  const isFlush = trackVariant === "flush";
5997
6332
  const trackClass = isFlush ? pillSegmentedTrackFlushClass : pillSegmentedTrackClass;
5998
6333
  const segmentClassName = isFlush ? pillSegmentedFlushSegmentClass : pillSegmentedSegmentClass;
5999
- return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { role: "group", "aria-label": ariaLabel, className: cn(trackClass, className), children: tabs.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
6334
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { role: "group", "aria-label": ariaLabel, className: cn(trackClass, className), children: tabs.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
6000
6335
  PillTab,
6001
6336
  {
6002
6337
  tabKey: tab.key,
@@ -6011,15 +6346,15 @@ var PillSegmentedTabs = ({
6011
6346
  tab.key
6012
6347
  )) });
6013
6348
  };
6014
- var MemoPillSegmentedTabs = (0, import_react51.memo)(PillSegmentedTabs);
6349
+ var MemoPillSegmentedTabs = (0, import_react49.memo)(PillSegmentedTabs);
6015
6350
 
6016
6351
  // src/studio/mode-switch.tsx
6017
- var import_jsx_runtime48 = require("react/jsx-runtime");
6352
+ var import_jsx_runtime52 = require("react/jsx-runtime");
6018
6353
  var STUDIO_NAV_MODE = {
6019
6354
  BUILD: "build",
6020
6355
  OPERATE: "operate"
6021
6356
  };
6022
- var StudioModeSwitch = (0, import_react53.memo)(
6357
+ var StudioModeSwitch = (0, import_react51.memo)(
6023
6358
  function StudioModeSwitch2({
6024
6359
  value,
6025
6360
  onChange,
@@ -6028,14 +6363,14 @@ var StudioModeSwitch = (0, import_react53.memo)(
6028
6363
  manageLabel = "Manage",
6029
6364
  "aria-label": ariaLabel = "Studio mode"
6030
6365
  }) {
6031
- const tabs = (0, import_react53.useMemo)(
6366
+ const tabs = (0, import_react51.useMemo)(
6032
6367
  () => [
6033
6368
  { key: STUDIO_NAV_MODE.BUILD, label: buildLabel },
6034
6369
  { key: STUDIO_NAV_MODE.OPERATE, label: manageLabel }
6035
6370
  ],
6036
6371
  [buildLabel, manageLabel]
6037
6372
  );
6038
- const handleChange = (0, import_react53.useCallback)(
6373
+ const handleChange = (0, import_react51.useCallback)(
6039
6374
  (key) => {
6040
6375
  if (key === STUDIO_NAV_MODE.BUILD || key === STUDIO_NAV_MODE.OPERATE) {
6041
6376
  onChange(key);
@@ -6043,14 +6378,14 @@ var StudioModeSwitch = (0, import_react53.memo)(
6043
6378
  },
6044
6379
  [onChange]
6045
6380
  );
6046
- return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
6381
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
6047
6382
  "div",
6048
6383
  {
6049
6384
  "data-tour": "studio-mode-switch",
6050
6385
  "data-studio-chrome-align": "mode-switch",
6051
6386
  id: "studio-chrome-mode-switch",
6052
6387
  className,
6053
- children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
6388
+ children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
6054
6389
  PillSegmentedTabs,
6055
6390
  {
6056
6391
  value,