@timbal-ai/timbal-react 0.6.0 → 0.7.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 (44) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +24 -5
  3. package/dist/app.cjs +2282 -738
  4. package/dist/app.d.cts +4 -1
  5. package/dist/app.d.ts +4 -1
  6. package/dist/app.esm.js +58 -5
  7. package/dist/button-CIKzUrJI.d.cts +18 -0
  8. package/dist/button-CIKzUrJI.d.ts +18 -0
  9. package/dist/chart-artifact-BFDz8Tf9.d.ts +756 -0
  10. package/dist/chart-artifact-bWUa-iSG.d.cts +756 -0
  11. package/dist/chat.cjs +872 -562
  12. package/dist/chat.d.cts +2 -2
  13. package/dist/chat.d.ts +2 -2
  14. package/dist/chat.esm.js +3 -3
  15. package/dist/{chunk-4TCJQSIX.esm.js → chunk-2XZ3S4OP.esm.js} +14 -3
  16. package/dist/chunk-533MK5EA.esm.js +2294 -0
  17. package/dist/{chunk-OVHR7J3J.esm.js → chunk-7O5VY3TP.esm.js} +38 -11
  18. package/dist/{chunk-WLTW56MC.esm.js → chunk-N3PYVTY5.esm.js} +2 -2
  19. package/dist/{chunk-IYENDIRY.esm.js → chunk-TDIJHV4I.esm.js} +1 -1
  20. package/dist/{chunk-YJQLLFKP.esm.js → chunk-TLUF2RUL.esm.js} +813 -507
  21. package/dist/{chunk-OFHLFNJH.esm.js → chunk-Z27GBSOT.esm.js} +3 -1
  22. package/dist/index.cjs +2587 -1016
  23. package/dist/index.d.cts +6 -5
  24. package/dist/index.d.ts +6 -5
  25. package/dist/index.esm.js +57 -7
  26. package/dist/{layout-CQWngNQ7.d.ts → layout-BTJyU8wd.d.ts} +1 -1
  27. package/dist/{layout-B9VayJhZ.d.cts → layout-C2G-FcER.d.cts} +1 -1
  28. package/dist/studio.cjs +1127 -788
  29. package/dist/studio.d.cts +1 -1
  30. package/dist/studio.d.ts +1 -1
  31. package/dist/studio.esm.js +6 -6
  32. package/dist/{timbal-v2-button-F4-z7m33.d.ts → timbal-v2-button-CNfdwGq4.d.cts} +1 -1
  33. package/dist/{timbal-v2-button-F4-z7m33.d.cts → timbal-v2-button-CNfdwGq4.d.ts} +1 -1
  34. package/dist/ui.cjs +12 -3
  35. package/dist/ui.d.cts +5 -16
  36. package/dist/ui.d.ts +5 -16
  37. package/dist/ui.esm.js +2 -2
  38. package/dist/{welcome-BOizSp5h.d.ts → welcome-BBmB3tl7.d.ts} +4 -3
  39. package/dist/{welcome--80i_O0p.d.cts → welcome-C89Mgdaw.d.cts} +4 -3
  40. package/package.json +2 -1
  41. package/vite/local-dev.mjs +91 -5
  42. package/dist/chart-artifact-C71dk4xI.d.ts +0 -329
  43. package/dist/chart-artifact-CPEpOmtV.d.cts +0 -329
  44. package/dist/chunk-M4V6Q6XO.esm.js +0 -1082
package/dist/chat.cjs CHANGED
@@ -910,10 +910,10 @@ function findParentIdFromAuiParent(messages, auiParentId) {
910
910
  }
911
911
 
912
912
  // src/chat/thread.tsx
913
- var import_react27 = require("react");
914
- var import_react28 = require("@assistant-ui/react");
913
+ var import_react29 = require("react");
914
+ var import_react30 = require("@assistant-ui/react");
915
915
  var import_lucide_react8 = require("lucide-react");
916
- var import_react29 = require("motion/react");
916
+ var import_react31 = require("motion/react");
917
917
 
918
918
  // src/chat/attachment.tsx
919
919
  var import_react5 = require("react");
@@ -1078,6 +1078,10 @@ var TIMBAL_V2_SWITCH_THUMB = cn(
1078
1078
  TIMBAL_V2_ELEVATED_GRADIENT,
1079
1079
  "border border-border/80 shadow-sm"
1080
1080
  );
1081
+ var TIMBAL_V2_ELEVATED_SURFACE = cn(
1082
+ TIMBAL_V2_ELEVATED_GRADIENT,
1083
+ "border border-border shadow-card"
1084
+ );
1081
1085
  var TIMBAL_V2_SECONDARY_CHROME = [
1082
1086
  TIMBAL_V2_ELEVATED_GRADIENT,
1083
1087
  "border border-border shadow-card",
@@ -1085,6 +1089,11 @@ var TIMBAL_V2_SECONDARY_CHROME = [
1085
1089
  "hover:from-secondary-fill-hover-from hover:to-secondary-fill-hover-to",
1086
1090
  "active:from-secondary-fill-active-from active:to-secondary-fill-active-to"
1087
1091
  ].join(" ");
1092
+ var TIMBAL_V2_LOGO_TILE = cn(
1093
+ "bg-gradient-to-b from-white to-neutral-100",
1094
+ "border border-neutral-200",
1095
+ "shadow-[0_1px_2px_-0.5px_rgba(0,0,0,0.08)]"
1096
+ );
1088
1097
 
1089
1098
  // src/ui/dialog.tsx
1090
1099
  var import_jsx_runtime4 = require("react/jsx-runtime");
@@ -1266,7 +1275,7 @@ var TimbalV2Button = React.forwardRef(function TimbalV2Button2({
1266
1275
  isIconOnly = false,
1267
1276
  isLoading = false,
1268
1277
  fullWidth = false,
1269
- shape = "pill",
1278
+ shape: _shape = "pill",
1270
1279
  asChild = false,
1271
1280
  className,
1272
1281
  disabled,
@@ -1276,7 +1285,7 @@ var TimbalV2Button = React.forwardRef(function TimbalV2Button2({
1276
1285
  }, ref) {
1277
1286
  const isDisabled = disabled || isLoading;
1278
1287
  const sizeClass = isIconOnly ? TIMBAL_V2_SIZE_ICON[size] : TIMBAL_V2_SIZE_HEIGHT[size];
1279
- const radiusClass = variant === "link" || variant === "ghost" ? "rounded-md" : shape === "rect" ? "rounded-md" : "rounded-full";
1288
+ const radiusClass = "rounded-full";
1280
1289
  const sharedRootClass = cn(
1281
1290
  "relative box-border inline-flex items-center justify-center gap-2 whitespace-nowrap border-0 text-sm font-normal shadow-none transition duration-200 ease-in-out",
1282
1291
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-1 focus-visible:ring-offset-background",
@@ -1525,293 +1534,625 @@ var import_react_markdown = require("@assistant-ui/react-markdown");
1525
1534
  var import_remark_gfm = __toESM(require("remark-gfm"), 1);
1526
1535
  var import_remark_math = __toESM(require("remark-math"), 1);
1527
1536
  var import_rehype_katex = __toESM(require("rehype-katex"), 1);
1528
- var import_react17 = require("react");
1537
+ var import_react19 = require("react");
1529
1538
  var import_lucide_react4 = require("lucide-react");
1530
1539
 
1531
1540
  // src/chat/syntax-highlighter.tsx
1532
- var import_react16 = require("react");
1541
+ var import_react18 = require("react");
1533
1542
  var import_core = require("shiki/core");
1534
1543
  var import_javascript = require("shiki/engine/javascript");
1535
1544
 
1536
1545
  // src/artifacts/registry.tsx
1537
- var import_react15 = require("react");
1546
+ var import_react17 = require("react");
1538
1547
 
1539
1548
  // src/artifacts/chart-artifact.tsx
1549
+ var import_react9 = require("react");
1550
+
1551
+ // src/charts/line-area-chart.tsx
1552
+ var import_react8 = require("react");
1553
+
1554
+ // src/charts/use-chart-width.ts
1540
1555
  var import_react7 = require("react");
1556
+ function useChartWidth(initial = 640) {
1557
+ const ref = (0, import_react7.useRef)(null);
1558
+ const [width, setWidth] = (0, import_react7.useState)(initial);
1559
+ (0, import_react7.useEffect)(() => {
1560
+ const el = ref.current;
1561
+ if (!el || typeof ResizeObserver === "undefined") return;
1562
+ const ro = new ResizeObserver((entries) => {
1563
+ const w = entries[0]?.contentRect.width;
1564
+ if (w && w > 0) setWidth(w);
1565
+ });
1566
+ ro.observe(el);
1567
+ return () => ro.disconnect();
1568
+ }, []);
1569
+ return { ref, width };
1570
+ }
1541
1571
 
1542
- // src/artifacts/artifact-card.tsx
1543
- var import_jsx_runtime9 = require("react/jsx-runtime");
1544
- var ArtifactCard = ({ title, kind, className, bodyClassName, toolbar, children }) => {
1545
- const hasHeader = Boolean(title || toolbar);
1546
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1547
- "div",
1548
- {
1549
- className: cn(
1550
- "aui-artifact-root my-3 overflow-hidden rounded-xl border border-border/60 bg-background shadow-sm",
1551
- className
1552
- ),
1553
- "data-artifact-kind": kind,
1554
- children: [
1555
- hasHeader && /* @__PURE__ */ (0, import_jsx_runtime9.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: [
1556
- title && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "aui-artifact-title flex-1 truncate text-xs font-semibold text-foreground/80", children: title }),
1557
- !title && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "flex-1" }),
1558
- toolbar
1559
- ] }),
1560
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: cn("aui-artifact-body", bodyClassName), children })
1561
- ]
1572
+ // src/charts/geometry.ts
1573
+ function toNum(value) {
1574
+ const n = typeof value === "number" ? value : Number(value);
1575
+ return Number.isFinite(n) ? n : 0;
1576
+ }
1577
+ function monotoneLinePath(points) {
1578
+ const n = points.length;
1579
+ if (n === 0) return "";
1580
+ if (n === 1) return `M ${points[0].x},${points[0].y}`;
1581
+ if (n === 2) {
1582
+ return `M ${points[0].x},${points[0].y} L ${points[1].x},${points[1].y}`;
1583
+ }
1584
+ const tangents = monotoneTangents(points);
1585
+ let d = `M ${points[0].x},${points[0].y}`;
1586
+ for (let i = 0; i < n - 1; i++) {
1587
+ const p0 = points[i];
1588
+ const p1 = points[i + 1];
1589
+ const dx = (p1.x - p0.x) / 3;
1590
+ const c1x = p0.x + dx;
1591
+ const c1y = p0.y + dx * tangents[i];
1592
+ const c2x = p1.x - dx;
1593
+ const c2y = p1.y - dx * tangents[i + 1];
1594
+ d += ` C ${c1x},${c1y} ${c2x},${c2y} ${p1.x},${p1.y}`;
1595
+ }
1596
+ return d;
1597
+ }
1598
+ function monotoneAreaPath(points, baseY) {
1599
+ if (points.length === 0) return "";
1600
+ const line = monotoneLinePath(points);
1601
+ const last = points[points.length - 1];
1602
+ const first = points[0];
1603
+ return `${line} L ${last.x},${baseY} L ${first.x},${baseY} Z`;
1604
+ }
1605
+ function monotoneTangents(points) {
1606
+ const n = points.length;
1607
+ const slopes = new Array(n - 1);
1608
+ for (let i = 0; i < n - 1; i++) {
1609
+ const dx = points[i + 1].x - points[i].x || 1;
1610
+ slopes[i] = (points[i + 1].y - points[i].y) / dx;
1611
+ }
1612
+ const tangents = new Array(n);
1613
+ tangents[0] = slopes[0];
1614
+ tangents[n - 1] = slopes[n - 2];
1615
+ for (let i = 1; i < n - 1; i++) {
1616
+ const s0 = slopes[i - 1];
1617
+ const s1 = slopes[i];
1618
+ if (s0 * s1 <= 0) {
1619
+ tangents[i] = 0;
1620
+ } else {
1621
+ tangents[i] = (s0 + s1) / 2;
1562
1622
  }
1563
- );
1564
- };
1623
+ }
1624
+ for (let i = 0; i < n - 1; i++) {
1625
+ const s = slopes[i];
1626
+ if (s === 0) {
1627
+ tangents[i] = 0;
1628
+ tangents[i + 1] = 0;
1629
+ continue;
1630
+ }
1631
+ const a = tangents[i] / s;
1632
+ const b = tangents[i + 1] / s;
1633
+ const h = Math.hypot(a, b);
1634
+ if (h > 3) {
1635
+ const t = 3 / h;
1636
+ tangents[i] = t * a * s;
1637
+ tangents[i + 1] = t * b * s;
1638
+ }
1639
+ }
1640
+ return tangents;
1641
+ }
1642
+ function niceTicks(min, max, count = 4) {
1643
+ if (!Number.isFinite(min) || !Number.isFinite(max) || max === min) {
1644
+ return [min || 0];
1645
+ }
1646
+ const step = niceStep((max - min) / count);
1647
+ const start = Math.floor(min / step) * step;
1648
+ const out = [];
1649
+ for (let v = start; v <= max + step / 2; v += step) {
1650
+ out.push(round(v));
1651
+ }
1652
+ return out;
1653
+ }
1654
+ function niceStep(raw) {
1655
+ const exp = Math.floor(Math.log10(Math.abs(raw) || 1));
1656
+ const base = Math.pow(10, exp);
1657
+ const norm = raw / base;
1658
+ let nice = 1;
1659
+ if (norm >= 5) nice = 5;
1660
+ else if (norm >= 2) nice = 2;
1661
+ return nice * base;
1662
+ }
1663
+ function round(v) {
1664
+ return Math.round(v * 1e6) / 1e6;
1665
+ }
1666
+ function formatCompact(value, unit) {
1667
+ const abs = Math.abs(value);
1668
+ let s;
1669
+ if (abs >= 1e6) s = `${round(value / 1e6)}M`;
1670
+ else if (abs >= 1e3) s = `${round(value / 1e3)}k`;
1671
+ else s = String(round(value));
1672
+ return unit ? `${s}${unit}` : s;
1673
+ }
1565
1674
 
1566
- // src/artifacts/chart-artifact.tsx
1567
- var import_jsx_runtime10 = require("react/jsx-runtime");
1568
- var ChartArtifactView = ({
1569
- artifact
1570
- }) => {
1571
- const { type: _t, chartType = "bar", data = [] } = artifact;
1572
- const xKey = artifact.xKey ?? inferXKey(data);
1573
- const dataKeys = (0, import_react7.useMemo)(() => {
1574
- if (Array.isArray(artifact.dataKey)) return artifact.dataKey;
1575
- if (typeof artifact.dataKey === "string") return [artifact.dataKey];
1576
- return inferDataKeys(data, xKey);
1577
- }, [artifact.dataKey, data, xKey]);
1578
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ArtifactCard, { title: artifact.title, kind: "chart", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "aui-artifact-chart p-3", children: [
1579
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1580
- ChartSvg,
1581
- {
1582
- chartType,
1583
- data,
1584
- xKey,
1585
- dataKeys,
1586
- unit: artifact.unit
1587
- }
1588
- ),
1589
- dataKeys.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Legend, { dataKeys })
1590
- ] }) });
1591
- };
1592
- var COLORS = [
1675
+ // src/charts/line-area-chart.tsx
1676
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1677
+ var CHART_PALETTE = [
1593
1678
  "var(--primary, #6366f1)",
1594
- "#22c55e",
1679
+ "#10b981",
1595
1680
  "#f59e0b",
1596
- "#ef4444",
1597
1681
  "#06b6d4",
1598
- "#a855f7"
1682
+ "#a855f7",
1683
+ "#ef4444"
1599
1684
  ];
1600
- var W = 600;
1601
- var H = 240;
1602
- var PAD = { top: 12, right: 16, bottom: 28, left: 36 };
1603
- var ChartSvg = ({ chartType, data, xKey, dataKeys, unit }) => {
1604
- if (data.length === 0 || dataKeys.length === 0) {
1605
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(EmptyState, {});
1606
- }
1607
- if (chartType === "pie") {
1608
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PieChart, { data, xKey, dataKey: dataKeys[0] });
1685
+ var PAD_DEFAULT = { top: 12, right: 16, bottom: 26, left: 44 };
1686
+ var PAD_FLUSH = { top: 20, right: 0, bottom: 8, left: 0 };
1687
+ var LineAreaChart = ({
1688
+ data = [],
1689
+ xKey: xKeyProp,
1690
+ series: seriesProp,
1691
+ variant = "area",
1692
+ height = 240,
1693
+ unit,
1694
+ yMax,
1695
+ layout = "default",
1696
+ showGrid = true,
1697
+ showXAxis: showXAxisProp,
1698
+ showYAxis: showYAxisProp,
1699
+ showLegend: showLegendProp,
1700
+ showTooltip = true,
1701
+ formatValue,
1702
+ formatX,
1703
+ className,
1704
+ ariaLabel = "Chart"
1705
+ }) => {
1706
+ const uid = (0, import_react8.useId)();
1707
+ const { ref, width } = useChartWidth();
1708
+ const [active, setActive] = (0, import_react8.useState)(null);
1709
+ const [grown, setGrown] = (0, import_react8.useState)(false);
1710
+ const xKey = xKeyProp ?? inferXKey(data);
1711
+ const series = (0, import_react8.useMemo)(
1712
+ () => resolveSeries(seriesProp, data, xKey),
1713
+ [seriesProp, data, xKey]
1714
+ );
1715
+ const pad = layout === "flush" ? PAD_FLUSH : PAD_DEFAULT;
1716
+ const showXAxis = showXAxisProp ?? layout !== "flush";
1717
+ const showYAxis = showYAxisProp ?? layout !== "flush";
1718
+ const showLegend = showLegendProp ?? (layout !== "flush" && series.length > 1);
1719
+ (0, import_react8.useEffect)(() => {
1720
+ const t = requestAnimationFrame(() => setGrown(true));
1721
+ return () => cancelAnimationFrame(t);
1722
+ }, []);
1723
+ const innerW = Math.max(0, width - pad.left - pad.right);
1724
+ const innerH = Math.max(0, height - pad.top - pad.bottom);
1725
+ const { minV, maxV } = (0, import_react8.useMemo)(() => {
1726
+ let lo = 0;
1727
+ let hi = yMax ?? 0;
1728
+ for (const s of series) {
1729
+ for (const d of data) {
1730
+ const v = toNum(d[s.dataKey]);
1731
+ if (v > hi && yMax == null) hi = v;
1732
+ if (v < lo) lo = v;
1733
+ }
1734
+ }
1735
+ if (hi === lo) hi = lo + 1;
1736
+ return { minV: lo, maxV: yMax != null ? yMax : hi * 1.08 };
1737
+ }, [series, data, yMax]);
1738
+ const ticks = (0, import_react8.useMemo)(() => niceTicks(minV, maxV, 4), [minV, maxV]);
1739
+ if (data.length === 0 || series.length === 0) {
1740
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChartEmpty, { className, height });
1609
1741
  }
1610
- const innerW = W - PAD.left - PAD.right;
1611
- const innerH = H - PAD.top - PAD.bottom;
1612
- const all = dataKeys.flatMap((k) => data.map((d) => toNum(d[k])));
1613
- const maxV = Math.max(0, ...all);
1614
- const minV = Math.min(0, ...all);
1615
- const range = maxV - minV || 1;
1616
- const yScale = (v) => PAD.top + innerH - (v - minV) / range * innerH;
1742
+ const yScale = (v) => pad.top + innerH - (v - minV) / (maxV - minV || 1) * innerH;
1617
1743
  const xCount = data.length;
1618
1744
  const xStep = xCount > 1 ? innerW / (xCount - 1) : innerW;
1619
- const xPos = (i) => chartType === "bar" ? PAD.left + innerW * (i + 0.5) / xCount : PAD.left + i * xStep;
1620
- const ticks = niceTicks(minV, maxV);
1621
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1622
- "svg",
1623
- {
1624
- viewBox: `0 0 ${W} ${H}`,
1625
- className: "aui-artifact-chart-svg w-full",
1626
- role: "img",
1627
- "aria-label": "Chart",
1628
- children: [
1629
- ticks.map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("g", { children: [
1630
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1745
+ const xPos = (i) => variant === "bar" ? pad.left + innerW * (i + 0.5) / xCount : pad.left + i * xStep;
1746
+ const baseY = yScale(Math.max(0, minV));
1747
+ const fmtV = (v) => formatValue ? formatValue(v) : formatCompact(v, unit);
1748
+ const fmtX = (i) => formatX ? formatX(data[i]?.[xKey], i) : String(data[i]?.[xKey] ?? i);
1749
+ const onMove = (event) => {
1750
+ const rect = event.currentTarget.getBoundingClientRect();
1751
+ const px = event.clientX - rect.left - pad.left;
1752
+ const i = Math.round(px / (xStep || 1));
1753
+ setActive(Math.max(0, Math.min(xCount - 1, i)));
1754
+ };
1755
+ const labelIdx = pickXLabels(xCount, innerW);
1756
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { ref, className: cn("relative w-full", className), style: { height }, children: [
1757
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1758
+ "svg",
1759
+ {
1760
+ width,
1761
+ height,
1762
+ role: "img",
1763
+ "aria-label": ariaLabel,
1764
+ className: "block overflow-visible",
1765
+ children: [
1766
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("defs", { children: [
1767
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("clipPath", { id: `${uid}-grow`, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1768
+ "rect",
1769
+ {
1770
+ x: pad.left,
1771
+ y: 0,
1772
+ height,
1773
+ width: grown ? innerW : 0,
1774
+ style: { transition: "width 900ms cubic-bezier(0.22,1,0.36,1)" }
1775
+ }
1776
+ ) }),
1777
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("linearGradient", { id: `${uid}-gridfade`, x1: "0%", x2: "100%", y1: "0", y2: "0", children: [
1778
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("stop", { offset: "0%", stopColor: "white", stopOpacity: 0 }),
1779
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("stop", { offset: "8%", stopColor: "white", stopOpacity: 1 }),
1780
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("stop", { offset: "92%", stopColor: "white", stopOpacity: 1 }),
1781
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("stop", { offset: "100%", stopColor: "white", stopOpacity: 0 })
1782
+ ] }),
1783
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("mask", { id: `${uid}-gridmask`, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1784
+ "rect",
1785
+ {
1786
+ x: pad.left,
1787
+ y: pad.top,
1788
+ width: innerW,
1789
+ height: innerH,
1790
+ fill: `url(#${uid}-gridfade)`
1791
+ }
1792
+ ) }),
1793
+ series.map((s, i) => {
1794
+ const color = s.color ?? CHART_PALETTE[i % CHART_PALETTE.length];
1795
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1796
+ "linearGradient",
1797
+ {
1798
+ id: `${uid}-fill-${i}`,
1799
+ x1: "0",
1800
+ x2: "0",
1801
+ y1: "0",
1802
+ y2: "1",
1803
+ children: [
1804
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("stop", { offset: "0%", style: { stopColor: color, stopOpacity: 0.28 } }),
1805
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("stop", { offset: "100%", style: { stopColor: color, stopOpacity: 0 } })
1806
+ ]
1807
+ },
1808
+ s.dataKey
1809
+ );
1810
+ })
1811
+ ] }),
1812
+ showGrid && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("g", { mask: `url(#${uid}-gridmask)`, children: ticks.map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1631
1813
  "line",
1632
1814
  {
1633
- x1: PAD.left,
1634
- x2: W - PAD.right,
1815
+ x1: pad.left,
1816
+ x2: width - pad.right,
1635
1817
  y1: yScale(t),
1636
1818
  y2: yScale(t),
1637
1819
  stroke: "currentColor",
1638
- strokeOpacity: 0.08
1639
- }
1640
- ),
1641
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1820
+ strokeOpacity: 0.14,
1821
+ strokeDasharray: "4 4",
1822
+ className: "text-muted-foreground"
1823
+ },
1824
+ i
1825
+ )) }),
1826
+ showYAxis && ticks.map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1642
1827
  "text",
1643
1828
  {
1644
- x: PAD.left - 6,
1829
+ x: pad.left - 8,
1645
1830
  y: yScale(t),
1646
1831
  textAnchor: "end",
1647
1832
  dominantBaseline: "middle",
1648
- className: "fill-muted-foreground text-[10px]",
1649
- children: formatTick(t, unit)
1833
+ className: "fill-muted-foreground text-[10px] tabular-nums",
1834
+ children: fmtV(t)
1835
+ },
1836
+ i
1837
+ )),
1838
+ showXAxis && labelIdx.map((i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1839
+ "text",
1840
+ {
1841
+ x: xPos(i),
1842
+ y: height - pad.bottom + 16,
1843
+ textAnchor: i === 0 ? "start" : i === xCount - 1 ? "end" : "middle",
1844
+ className: "fill-muted-foreground text-[10px] tabular-nums",
1845
+ children: fmtX(i)
1846
+ },
1847
+ i
1848
+ )),
1849
+ /* @__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) => {
1850
+ const color = s.color ?? CHART_PALETTE[si % CHART_PALETTE.length];
1851
+ const pts = data.map((d, i) => ({
1852
+ x: xPos(i),
1853
+ y: yScale(toNum(d[s.dataKey]))
1854
+ }));
1855
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("g", { children: [
1856
+ variant === "area" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: monotoneAreaPath(pts, baseY), fill: `url(#${uid}-fill-${si})` }),
1857
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1858
+ "path",
1859
+ {
1860
+ d: monotoneLinePath(pts),
1861
+ fill: "none",
1862
+ stroke: color,
1863
+ strokeWidth: 2,
1864
+ strokeLinecap: "round",
1865
+ strokeLinejoin: "round"
1866
+ }
1867
+ )
1868
+ ] }, s.dataKey);
1869
+ }) }),
1870
+ showTooltip && active != null && variant !== "bar" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("g", { pointerEvents: "none", children: [
1871
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1872
+ "line",
1873
+ {
1874
+ x1: xPos(active),
1875
+ x2: xPos(active),
1876
+ y1: pad.top,
1877
+ y2: pad.top + innerH,
1878
+ stroke: "currentColor",
1879
+ strokeOpacity: 0.25,
1880
+ className: "text-foreground"
1881
+ }
1882
+ ),
1883
+ series.map((s, si) => {
1884
+ const color = s.color ?? CHART_PALETTE[si % CHART_PALETTE.length];
1885
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1886
+ "circle",
1887
+ {
1888
+ cx: xPos(active),
1889
+ cy: yScale(toNum(data[active]?.[s.dataKey])),
1890
+ r: 4,
1891
+ fill: color,
1892
+ stroke: "var(--background, #fff)",
1893
+ strokeWidth: 2
1894
+ },
1895
+ s.dataKey
1896
+ );
1897
+ })
1898
+ ] }),
1899
+ showTooltip && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1900
+ "rect",
1901
+ {
1902
+ x: pad.left,
1903
+ y: pad.top,
1904
+ width: innerW,
1905
+ height: innerH,
1906
+ fill: "transparent",
1907
+ style: { cursor: "crosshair" },
1908
+ onMouseMove: onMove,
1909
+ onMouseLeave: () => setActive(null)
1650
1910
  }
1651
1911
  )
1652
- ] }, i)),
1653
- data.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1654
- "text",
1655
- {
1656
- x: xPos(i),
1657
- y: H - PAD.bottom + 14,
1658
- textAnchor: "middle",
1659
- className: "fill-muted-foreground text-[10px]",
1660
- children: String(d[xKey] ?? i)
1661
- },
1662
- i
1663
- )),
1664
- chartType === "bar" && renderBars({ data, dataKeys, xCount, xPos, yScale, minV, innerW }),
1665
- chartType === "line" && dataKeys.map((k, ki) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1666
- Polyline,
1667
- {
1668
- data,
1669
- dataKey: k,
1670
- xPos,
1671
- yScale,
1672
- color: COLORS[ki % COLORS.length]
1673
- },
1674
- k
1675
- )),
1676
- chartType === "area" && dataKeys.map((k, ki) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1677
- Area,
1678
- {
1679
- data,
1680
- dataKey: k,
1681
- xPos,
1682
- yScale,
1683
- baseY: yScale(Math.max(0, minV)),
1684
- color: COLORS[ki % COLORS.length]
1685
- },
1686
- k
1687
- ))
1688
- ]
1689
- }
1690
- );
1912
+ ]
1913
+ }
1914
+ ),
1915
+ showTooltip && active != null && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1916
+ ChartTooltip,
1917
+ {
1918
+ x: xPos(active),
1919
+ width,
1920
+ title: fmtX(active),
1921
+ rows: series.map((s, si) => ({
1922
+ color: s.color ?? CHART_PALETTE[si % CHART_PALETTE.length],
1923
+ label: s.label ?? s.dataKey,
1924
+ value: fmtV(toNum(data[active]?.[s.dataKey]))
1925
+ }))
1926
+ }
1927
+ ),
1928
+ showLegend ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChartLegend, { series }) : null
1929
+ ] });
1691
1930
  };
1692
1931
  function renderBars(args) {
1693
- const { data, dataKeys, xCount, xPos, yScale, minV, innerW } = args;
1694
- const groupWidth = innerW / xCount * 0.7;
1695
- const barWidth = groupWidth / dataKeys.length;
1696
- const baseY = yScale(Math.max(0, minV));
1697
- return dataKeys.flatMap(
1698
- (k, ki) => data.map((d, i) => {
1699
- const v = toNum(d[k]);
1700
- const y = yScale(v);
1701
- const x = xPos(i) - groupWidth / 2 + ki * barWidth;
1932
+ const { data, series, xCount, xPos, yScale, baseY, innerW } = args;
1933
+ const groupWidth = innerW / xCount * 0.66;
1934
+ const barWidth = groupWidth / series.length;
1935
+ return series.flatMap(
1936
+ (s, si) => data.map((d, i) => {
1937
+ const color = s.color ?? CHART_PALETTE[si % CHART_PALETTE.length];
1938
+ const y = yScale(toNum(d[s.dataKey]));
1939
+ const x = xPos(i) - groupWidth / 2 + si * barWidth;
1702
1940
  const top = Math.min(y, baseY);
1703
- const height = Math.abs(y - baseY);
1704
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1941
+ const h = Math.max(1, Math.abs(y - baseY));
1942
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1705
1943
  "rect",
1706
1944
  {
1707
1945
  x,
1708
1946
  y: top,
1709
1947
  width: Math.max(1, barWidth - 2),
1710
- height: Math.max(1, height),
1711
- rx: 2,
1712
- fill: COLORS[ki % COLORS.length]
1948
+ height: h,
1949
+ rx: 3,
1950
+ fill: color
1713
1951
  },
1714
- `${k}-${i}`
1952
+ `${s.dataKey}-${i}`
1715
1953
  );
1716
1954
  })
1717
1955
  );
1718
1956
  }
1719
- var Polyline = ({ data, dataKey, xPos, yScale, color }) => {
1720
- const points = data.map((d, i) => `${xPos(i)},${yScale(toNum(d[dataKey]))}`).join(" ");
1721
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1722
- "polyline",
1957
+ var ChartTooltip = ({ x, width, title, rows }) => {
1958
+ const flip = x > width - 160;
1959
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1960
+ "div",
1723
1961
  {
1724
- points,
1725
- fill: "none",
1726
- stroke: color,
1727
- strokeWidth: 2,
1728
- strokeLinejoin: "round",
1729
- strokeLinecap: "round"
1962
+ 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",
1963
+ style: {
1964
+ left: flip ? void 0 : Math.min(x + 12, width - 8),
1965
+ right: flip ? Math.max(width - x + 12, 8) : void 0
1966
+ },
1967
+ children: [
1968
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mb-1.5 text-[11px] text-muted-foreground", children: title }),
1969
+ /* @__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: [
1970
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "inline-flex items-center gap-1.5 text-xs text-muted-foreground", children: [
1971
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1972
+ "span",
1973
+ {
1974
+ className: "inline-block size-2 rounded-full",
1975
+ style: { background: r.color }
1976
+ }
1977
+ ),
1978
+ r.label
1979
+ ] }),
1980
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xs font-medium tabular-nums text-foreground", children: r.value })
1981
+ ] }, r.label)) })
1982
+ ]
1730
1983
  }
1731
1984
  );
1732
1985
  };
1733
- var Area = ({ data, dataKey, xPos, yScale, baseY, color }) => {
1734
- if (data.length === 0) return null;
1735
- const top = data.map((d, i) => `${xPos(i)},${yScale(toNum(d[dataKey]))}`).join(" ");
1736
- const path = `M ${xPos(0)},${baseY} L ${top} L ${xPos(data.length - 1)},${baseY} Z`;
1737
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1738
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: path, fill: color, fillOpacity: 0.18 }),
1739
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Polyline, { data, dataKey, xPos, yScale, color })
1740
- ] });
1986
+ 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: [
1987
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1988
+ "span",
1989
+ {
1990
+ className: "inline-block size-2 rounded-sm",
1991
+ style: { background: s.color ?? CHART_PALETTE[i % CHART_PALETTE.length] }
1992
+ }
1993
+ ),
1994
+ s.label ?? s.dataKey
1995
+ ] }, s.dataKey)) });
1996
+ var ChartEmpty = ({ className, height }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1997
+ "div",
1998
+ {
1999
+ className: cn(
2000
+ "flex w-full items-center justify-center text-xs text-muted-foreground",
2001
+ className
2002
+ ),
2003
+ style: { height },
2004
+ children: "No data yet"
2005
+ }
2006
+ );
2007
+ function inferXKey(data) {
2008
+ if (data.length === 0) return "x";
2009
+ for (const k of Object.keys(data[0])) {
2010
+ if (typeof data[0][k] !== "number") return k;
2011
+ }
2012
+ return Object.keys(data[0])[0] ?? "x";
2013
+ }
2014
+ function resolveSeries(seriesProp, data, xKey) {
2015
+ if (seriesProp && seriesProp.length > 0) {
2016
+ return seriesProp.map((s) => typeof s === "string" ? { dataKey: s } : s);
2017
+ }
2018
+ if (data.length === 0) return [];
2019
+ return Object.keys(data[0]).filter((k) => k !== xKey && typeof data[0][k] === "number").map((dataKey) => ({ dataKey }));
2020
+ }
2021
+ function pickXLabels(count, innerW) {
2022
+ if (count <= 1) return [0];
2023
+ const maxLabels = Math.max(2, Math.min(count, Math.floor(innerW / 64) + 1));
2024
+ if (maxLabels >= count) return Array.from({ length: count }, (_, i) => i);
2025
+ const out = /* @__PURE__ */ new Set([0, count - 1]);
2026
+ const step = (count - 1) / (maxLabels - 1);
2027
+ for (let i = 1; i < maxLabels - 1; i++) out.add(Math.round(i * step));
2028
+ return [...out].sort((a, b) => a - b);
2029
+ }
2030
+
2031
+ // src/artifacts/artifact-card.tsx
2032
+ var import_jsx_runtime10 = require("react/jsx-runtime");
2033
+ var ArtifactCard = ({ title, kind, className, bodyClassName, toolbar, children }) => {
2034
+ const hasHeader = Boolean(title || toolbar);
2035
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2036
+ "div",
2037
+ {
2038
+ className: cn(
2039
+ "aui-artifact-root my-3 overflow-hidden rounded-xl border border-border/60 bg-background shadow-sm",
2040
+ className
2041
+ ),
2042
+ "data-artifact-kind": kind,
2043
+ children: [
2044
+ 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: [
2045
+ title && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "aui-artifact-title flex-1 truncate text-xs font-semibold text-foreground/80", children: title }),
2046
+ !title && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "flex-1" }),
2047
+ toolbar
2048
+ ] }),
2049
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: cn("aui-artifact-body", bodyClassName), children })
2050
+ ]
2051
+ }
2052
+ );
1741
2053
  };
1742
- var PieChart = ({ data, xKey, dataKey }) => {
1743
- const cx = W / 2;
1744
- const cy = H / 2;
1745
- const r = Math.min(W, H) / 2 - 16;
1746
- const total = data.reduce((sum, d) => sum + toNum(d[dataKey]), 0) || 1;
1747
- let acc = 0;
1748
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1749
- "svg",
2054
+
2055
+ // src/artifacts/chart-artifact.tsx
2056
+ var import_jsx_runtime11 = require("react/jsx-runtime");
2057
+ var ChartArtifactView = ({
2058
+ artifact,
2059
+ embedded = false,
2060
+ height = 300
2061
+ }) => {
2062
+ const plot = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ChartArtifactPlot, { artifact, height });
2063
+ if (embedded) {
2064
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "aui-artifact-chart w-full", children: plot });
2065
+ }
2066
+ 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 }) });
2067
+ };
2068
+ function ChartArtifactPlot({
2069
+ artifact,
2070
+ height
2071
+ }) {
2072
+ const { chartType = "bar", data = [] } = artifact;
2073
+ const xKey = artifact.xKey ?? inferXKey2(data);
2074
+ const series = (0, import_react9.useMemo)(() => {
2075
+ const keys = Array.isArray(artifact.dataKey) ? artifact.dataKey : typeof artifact.dataKey === "string" ? [artifact.dataKey] : inferDataKeys(data, xKey);
2076
+ return keys.map((dataKey) => ({ dataKey }));
2077
+ }, [artifact.dataKey, data, xKey]);
2078
+ if (chartType === "pie") {
2079
+ 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" }) });
2080
+ }
2081
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2082
+ LineAreaChart,
1750
2083
  {
1751
- viewBox: `0 0 ${W} ${H}`,
1752
- className: "aui-artifact-chart-svg w-full",
1753
- role: "img",
1754
- "aria-label": "Pie chart",
1755
- children: data.map((d, i) => {
1756
- const value = toNum(d[dataKey]);
1757
- const start = acc / total * Math.PI * 2;
1758
- acc += value;
1759
- const end = acc / total * Math.PI * 2;
1760
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1761
- PieSlice,
1762
- {
1763
- cx,
1764
- cy,
1765
- r,
1766
- start,
1767
- end,
1768
- color: COLORS[i % COLORS.length],
1769
- label: String(d[xKey] ?? i)
1770
- },
1771
- i
1772
- );
1773
- })
2084
+ data,
2085
+ xKey,
2086
+ series,
2087
+ layout: "flush",
2088
+ height,
2089
+ variant: chartType === "line" ? "line" : chartType === "area" ? "area" : "bar",
2090
+ unit: artifact.unit,
2091
+ ariaLabel: typeof artifact.title === "string" ? artifact.title : "Chart"
1774
2092
  }
1775
2093
  );
2094
+ }
2095
+ var PIE_W = 320;
2096
+ var PIE_H = 220;
2097
+ var PieChart = ({ data, xKey, dataKey }) => {
2098
+ if (data.length === 0) {
2099
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex h-32 items-center justify-center text-xs text-muted-foreground", children: "No data" });
2100
+ }
2101
+ const cx = PIE_W / 2;
2102
+ const cy = PIE_H / 2;
2103
+ const r = Math.min(PIE_W, PIE_H) / 2 - 16;
2104
+ const total = data.reduce((sum, d) => sum + toNum(d[dataKey]), 0) || 1;
2105
+ let acc = 0;
2106
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col items-center gap-3", children: [
2107
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2108
+ "svg",
2109
+ {
2110
+ viewBox: `0 0 ${PIE_W} ${PIE_H}`,
2111
+ className: "w-full max-w-[20rem]",
2112
+ role: "img",
2113
+ "aria-label": "Pie chart",
2114
+ children: data.map((d, i) => {
2115
+ const value = toNum(d[dataKey]);
2116
+ const start = acc / total * Math.PI * 2;
2117
+ acc += value;
2118
+ const end = acc / total * Math.PI * 2;
2119
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2120
+ PieSlice,
2121
+ {
2122
+ cx,
2123
+ cy,
2124
+ r,
2125
+ start,
2126
+ end,
2127
+ color: CHART_PALETTE[i % CHART_PALETTE.length]
2128
+ },
2129
+ i
2130
+ );
2131
+ })
2132
+ }
2133
+ ),
2134
+ /* @__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: [
2135
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2136
+ "span",
2137
+ {
2138
+ className: "inline-block size-2 rounded-sm",
2139
+ style: { background: CHART_PALETTE[i % CHART_PALETTE.length] }
2140
+ }
2141
+ ),
2142
+ String(d[xKey] ?? i)
2143
+ ] }, i)) })
2144
+ ] });
1776
2145
  };
1777
- var PieSlice = ({ cx, cy, r, start, end, color, label }) => {
2146
+ var PieSlice = ({ cx, cy, r, start, end, color }) => {
1778
2147
  const x1 = cx + Math.sin(start) * r;
1779
2148
  const y1 = cy - Math.cos(start) * r;
1780
2149
  const x2 = cx + Math.sin(end) * r;
1781
2150
  const y2 = cy - Math.cos(end) * r;
1782
2151
  const large = end - start > Math.PI ? 1 : 0;
1783
2152
  const path = `M ${cx} ${cy} L ${x1} ${y1} A ${r} ${r} 0 ${large} 1 ${x2} ${y2} Z`;
1784
- const mid = (start + end) / 2;
1785
- const lx = cx + Math.sin(mid) * (r * 0.65);
1786
- const ly = cy - Math.cos(mid) * (r * 0.65);
1787
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("g", { children: [
1788
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: path, fill: color, stroke: "var(--background, #fff)", strokeWidth: 1 }),
1789
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1790
- "text",
1791
- {
1792
- x: lx,
1793
- y: ly,
1794
- textAnchor: "middle",
1795
- dominantBaseline: "middle",
1796
- className: "fill-white text-[10px] font-semibold",
1797
- children: label
1798
- }
1799
- )
1800
- ] });
2153
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: path, fill: color, stroke: "var(--background, #fff)", strokeWidth: 1.5 });
1801
2154
  };
1802
- var Legend = ({ dataKeys }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "aui-artifact-chart-legend mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground", children: dataKeys.map((k, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "inline-flex items-center gap-1.5", children: [
1803
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1804
- "span",
1805
- {
1806
- className: "inline-block size-2 rounded-sm",
1807
- style: { background: COLORS[i % COLORS.length] },
1808
- "aria-hidden": true
1809
- }
1810
- ),
1811
- k
1812
- ] }, k)) });
1813
- var EmptyState = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "aui-artifact-chart-empty flex h-32 items-center justify-center text-xs text-muted-foreground", children: "No data" });
1814
- function inferXKey(data) {
2155
+ function inferXKey2(data) {
1815
2156
  if (data.length === 0) return "x";
1816
2157
  for (const k of Object.keys(data[0])) {
1817
2158
  if (typeof data[0][k] !== "number") return k;
@@ -1824,41 +2165,10 @@ function inferDataKeys(data, xKey) {
1824
2165
  (k) => k !== xKey && typeof data[0][k] === "number"
1825
2166
  );
1826
2167
  }
1827
- function toNum(value) {
1828
- const n = typeof value === "number" ? value : Number(value);
1829
- return Number.isFinite(n) ? n : 0;
1830
- }
1831
- function niceTicks(min, max, count = 4) {
1832
- if (max === min) return [min];
1833
- const range = max - min;
1834
- const step = niceStep(range / count);
1835
- const start = Math.floor(min / step) * step;
1836
- const out = [];
1837
- for (let v = start; v <= max + step / 2; v += step) {
1838
- out.push(round(v));
1839
- }
1840
- return out;
1841
- }
1842
- function niceStep(raw) {
1843
- const exp = Math.floor(Math.log10(Math.abs(raw))) || 0;
1844
- const base = Math.pow(10, exp);
1845
- const norm = raw / base;
1846
- let nice = 1;
1847
- if (norm >= 5) nice = 5;
1848
- else if (norm >= 2) nice = 2;
1849
- return nice * base;
1850
- }
1851
- function round(v) {
1852
- return Math.round(v * 1e6) / 1e6;
1853
- }
1854
- function formatTick(v, unit) {
1855
- const s = Math.abs(v) >= 1e3 ? `${(v / 1e3).toFixed(1)}k` : String(round(v));
1856
- return unit ? `${s}${unit}` : s;
1857
- }
1858
2168
 
1859
2169
  // src/artifacts/question-artifact.tsx
1860
- var import_react8 = require("react");
1861
- var import_react9 = require("@assistant-ui/react");
2170
+ var import_react10 = require("react");
2171
+ var import_react11 = require("@assistant-ui/react");
1862
2172
  var import_lucide_react3 = require("lucide-react");
1863
2173
 
1864
2174
  // src/design/classes.ts
@@ -1967,12 +2277,12 @@ var studioQuestionOptionSelectedClass = cn(
1967
2277
  );
1968
2278
 
1969
2279
  // src/artifacts/question-artifact.tsx
1970
- var import_jsx_runtime11 = require("react/jsx-runtime");
2280
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1971
2281
  function optionKey(option, index) {
1972
2282
  const id = option.id?.trim();
1973
2283
  return id ? id : `__option-${index}`;
1974
2284
  }
1975
- var OptionRadio = ({ selected }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2285
+ var OptionRadio = ({ selected }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1976
2286
  "span",
1977
2287
  {
1978
2288
  className: cn(
@@ -1980,18 +2290,18 @@ var OptionRadio = ({ selected }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx
1980
2290
  selected ? "border-foreground bg-foreground text-background" : "border-border bg-background"
1981
2291
  ),
1982
2292
  "aria-hidden": true,
1983
- children: selected ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react3.CheckIcon, { className: "size-2.5 stroke-[3]" }) : null
2293
+ children: selected ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react3.CheckIcon, { className: "size-2.5 stroke-[3]" }) : null
1984
2294
  }
1985
2295
  );
1986
2296
  var QuestionArtifactView = ({
1987
2297
  artifact
1988
2298
  }) => {
1989
- const runtime = (0, import_react9.useThreadRuntime)();
1990
- const [selected, setSelected] = (0, import_react8.useState)([]);
1991
- const [submittedIds, setSubmittedIds] = (0, import_react8.useState)(null);
2299
+ const runtime = (0, import_react11.useThreadRuntime)();
2300
+ const [selected, setSelected] = (0, import_react10.useState)([]);
2301
+ const [submittedIds, setSubmittedIds] = (0, import_react10.useState)(null);
1992
2302
  const isMulti = artifact.multi === true;
1993
2303
  const isDisabled = submittedIds !== null;
1994
- const send = (0, import_react8.useCallback)(
2304
+ const send = (0, import_react10.useCallback)(
1995
2305
  (keys) => {
1996
2306
  if (keys.length === 0) return;
1997
2307
  const labels = artifact.options.map((option, index) => ({ option, key: optionKey(option, index) })).filter(({ key }) => keys.includes(key)).map(({ option }) => option.label);
@@ -2003,7 +2313,7 @@ var QuestionArtifactView = ({
2003
2313
  },
2004
2314
  [artifact.options, runtime]
2005
2315
  );
2006
- const onPick = (0, import_react8.useCallback)(
2316
+ const onPick = (0, import_react10.useCallback)(
2007
2317
  (key) => {
2008
2318
  if (isDisabled) return;
2009
2319
  if (!isMulti) {
@@ -2016,15 +2326,15 @@ var QuestionArtifactView = ({
2016
2326
  },
2017
2327
  [isDisabled, isMulti, send]
2018
2328
  );
2019
- const onConfirm = (0, import_react8.useCallback)(() => {
2329
+ const onConfirm = (0, import_react10.useCallback)(() => {
2020
2330
  send(selected);
2021
2331
  }, [selected, send]);
2022
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: studioArtifactShellClass, "data-artifact-kind": "question", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "px-2.5 py-2", children: [
2023
- artifact.prompt ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "mb-2 text-sm font-normal leading-snug text-foreground", children: artifact.prompt }) : null,
2024
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex flex-col gap-0.5", role: "list", children: artifact.options.map((option, index) => {
2332
+ 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: [
2333
+ artifact.prompt ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mb-2 text-sm font-normal leading-snug text-foreground", children: artifact.prompt }) : null,
2334
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex flex-col gap-0.5", role: "list", children: artifact.options.map((option, index) => {
2025
2335
  const key = optionKey(option, index);
2026
2336
  const isSelected = submittedIds ? submittedIds.includes(key) : isMulti && selected.includes(key);
2027
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2337
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2028
2338
  "button",
2029
2339
  {
2030
2340
  type: "button",
@@ -2036,17 +2346,17 @@ var QuestionArtifactView = ({
2036
2346
  isDisabled && (isSelected ? "cursor-default" : "cursor-not-allowed opacity-50")
2037
2347
  ),
2038
2348
  children: [
2039
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(OptionRadio, { selected: isSelected }),
2040
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "min-w-0 flex-1 text-left", children: [
2041
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "block font-normal text-foreground", children: option.label }),
2042
- option.description ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: option.description }) : null
2349
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(OptionRadio, { selected: isSelected }),
2350
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "min-w-0 flex-1 text-left", children: [
2351
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "block font-normal text-foreground", children: option.label }),
2352
+ option.description ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: option.description }) : null
2043
2353
  ] })
2044
2354
  ]
2045
2355
  },
2046
2356
  key
2047
2357
  );
2048
2358
  }) }),
2049
- isMulti && !submittedIds ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "mt-2 flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2359
+ isMulti && !submittedIds ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "mt-2 flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2050
2360
  TimbalV2Button,
2051
2361
  {
2052
2362
  type: "button",
@@ -2061,12 +2371,12 @@ var QuestionArtifactView = ({
2061
2371
  };
2062
2372
 
2063
2373
  // src/artifacts/html-artifact.tsx
2064
- var import_jsx_runtime12 = require("react/jsx-runtime");
2374
+ var import_jsx_runtime13 = require("react/jsx-runtime");
2065
2375
  var HtmlArtifactView = ({ artifact }) => {
2066
2376
  const sandboxed = artifact.sandboxed !== false;
2067
2377
  const sandbox = sandboxed ? "allow-scripts allow-same-origin allow-forms allow-modals allow-popups allow-pointer-lock" : void 0;
2068
2378
  const height = artifact.height ?? "320px";
2069
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ArtifactCard, { title: artifact.title, kind: "html", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2379
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ArtifactCard, { title: artifact.title, kind: "html", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2070
2380
  "iframe",
2071
2381
  {
2072
2382
  title: artifact.title ?? "HTML artifact",
@@ -2079,7 +2389,7 @@ var HtmlArtifactView = ({ artifact }) => {
2079
2389
  };
2080
2390
 
2081
2391
  // src/artifacts/json-artifact.tsx
2082
- var import_jsx_runtime13 = require("react/jsx-runtime");
2392
+ var import_jsx_runtime14 = require("react/jsx-runtime");
2083
2393
  var JsonArtifactView = ({
2084
2394
  artifact
2085
2395
  }) => {
@@ -2091,16 +2401,16 @@ var JsonArtifactView = ({
2091
2401
  } catch {
2092
2402
  body = String(data);
2093
2403
  }
2094
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ArtifactCard, { title, kind: "json", children: /* @__PURE__ */ (0, import_jsx_runtime13.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 }) });
2404
+ 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 }) });
2095
2405
  };
2096
2406
 
2097
2407
  // src/artifacts/table-artifact.tsx
2098
- var import_jsx_runtime14 = require("react/jsx-runtime");
2408
+ var import_jsx_runtime15 = require("react/jsx-runtime");
2099
2409
  var TableArtifactView = ({ artifact }) => {
2100
2410
  const rows = artifact.rows ?? [];
2101
2411
  const columns = artifact.columns ?? deriveColumns(rows);
2102
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ArtifactCard, { title: artifact.title, kind: "table", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "aui-artifact-table-wrap overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("table", { className: "aui-artifact-table w-full border-collapse text-sm", children: [
2103
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tr", { className: "border-b border-border/40 bg-muted/20", children: columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2412
+ 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: [
2413
+ /* @__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)(
2104
2414
  "th",
2105
2415
  {
2106
2416
  className: "px-3 py-2 text-left text-xs font-semibold uppercase tracking-wider text-muted-foreground",
@@ -2108,11 +2418,11 @@ var TableArtifactView = ({ artifact }) => {
2108
2418
  },
2109
2419
  col.key
2110
2420
  )) }) }),
2111
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tbody", { children: rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2421
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tbody", { children: rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2112
2422
  "tr",
2113
2423
  {
2114
2424
  className: "border-b border-border/30 transition-colors last:border-b-0 hover:bg-muted/20",
2115
- children: columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2425
+ children: columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2116
2426
  "td",
2117
2427
  {
2118
2428
  className: "px-3 py-2 align-top text-foreground/85",
@@ -2145,7 +2455,7 @@ function formatCell(value) {
2145
2455
  }
2146
2456
 
2147
2457
  // src/artifacts/ui/ui-artifact.tsx
2148
- var import_react14 = require("react");
2458
+ var import_react16 = require("react");
2149
2459
 
2150
2460
  // src/artifacts/ui/types.ts
2151
2461
  function isUiBinding(value) {
@@ -2198,38 +2508,38 @@ function resolveBindable(value, state) {
2198
2508
  }
2199
2509
 
2200
2510
  // src/artifacts/ui/registry.tsx
2201
- var import_react10 = require("react");
2202
- var import_jsx_runtime15 = require("react/jsx-runtime");
2203
- var UiStateContext = (0, import_react10.createContext)({});
2204
- var UiDispatchContext = (0, import_react10.createContext)(() => {
2511
+ var import_react12 = require("react");
2512
+ var import_jsx_runtime16 = require("react/jsx-runtime");
2513
+ var UiStateContext = (0, import_react12.createContext)({});
2514
+ var UiDispatchContext = (0, import_react12.createContext)(() => {
2205
2515
  });
2206
- var UiStateProvider = ({ state, dispatch, children }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(UiStateContext.Provider, { value: state, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(UiDispatchContext.Provider, { value: dispatch, children }) });
2516
+ 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 }) });
2207
2517
  function useUiState() {
2208
- return (0, import_react10.useContext)(UiStateContext);
2518
+ return (0, import_react12.useContext)(UiStateContext);
2209
2519
  }
2210
2520
  function useUiDispatch() {
2211
- return (0, import_react10.useContext)(UiDispatchContext);
2521
+ return (0, import_react12.useContext)(UiDispatchContext);
2212
2522
  }
2213
- var UiEventContext = (0, import_react10.createContext)(
2523
+ var UiEventContext = (0, import_react12.createContext)(
2214
2524
  null
2215
2525
  );
2216
- var UiEventProvider = ({ onEvent, children }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(UiEventContext.Provider, { value: onEvent, children });
2526
+ var UiEventProvider = ({ onEvent, children }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(UiEventContext.Provider, { value: onEvent, children });
2217
2527
  function useUiEventEmitter() {
2218
- return (0, import_react10.useContext)(UiEventContext);
2528
+ return (0, import_react12.useContext)(UiEventContext);
2219
2529
  }
2220
- var UiCustomNodeRegistryContext = (0, import_react10.createContext)({});
2530
+ var UiCustomNodeRegistryContext = (0, import_react12.createContext)({});
2221
2531
  function useUiCustomNodeRegistry() {
2222
- return (0, import_react10.useContext)(UiCustomNodeRegistryContext);
2532
+ return (0, import_react12.useContext)(UiCustomNodeRegistryContext);
2223
2533
  }
2224
2534
 
2225
2535
  // src/artifacts/ui/nodes.tsx
2226
- var import_react11 = require("react");
2227
- var import_react12 = require("motion/react");
2228
- var import_react13 = require("@assistant-ui/react");
2536
+ var import_react13 = require("react");
2537
+ var import_react14 = require("motion/react");
2538
+ var import_react15 = require("@assistant-ui/react");
2229
2539
 
2230
2540
  // src/ui/button.tsx
2231
2541
  var import_class_variance_authority = require("class-variance-authority");
2232
- var import_jsx_runtime16 = require("react/jsx-runtime");
2542
+ var import_jsx_runtime17 = require("react/jsx-runtime");
2233
2543
  var LEGACY_SIZE_TO_V2 = {
2234
2544
  default: "md",
2235
2545
  xs: "xs",
@@ -2279,7 +2589,7 @@ function Button({
2279
2589
  const v2Variant = TIMBAL_V2_FROM_LEGACY_BUTTON[variant ?? "default"];
2280
2590
  const v2Size = LEGACY_SIZE_TO_V2[size ?? "default"];
2281
2591
  const isIconOnly = typeof size === "string" && size.startsWith("icon");
2282
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2592
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2283
2593
  TimbalV2Button,
2284
2594
  {
2285
2595
  "data-slot": "button",
@@ -2287,7 +2597,7 @@ function Button({
2287
2597
  "data-size": size,
2288
2598
  variant: v2Variant,
2289
2599
  size: v2Size,
2290
- shape: "rect",
2600
+ shape: "pill",
2291
2601
  isIconOnly,
2292
2602
  asChild,
2293
2603
  className: cn(buttonVariants({ variant, size, className })),
@@ -2297,29 +2607,29 @@ function Button({
2297
2607
  }
2298
2608
 
2299
2609
  // src/artifacts/ui/nodes.tsx
2300
- var import_jsx_runtime17 = require("react/jsx-runtime");
2610
+ var import_jsx_runtime18 = require("react/jsx-runtime");
2301
2611
  var UiNodeView = ({ node }) => {
2302
2612
  switch (node.kind) {
2303
2613
  case "box":
2304
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BoxNode, { node });
2614
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(BoxNode, { node });
2305
2615
  case "text":
2306
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TextNode, { node });
2616
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TextNode, { node });
2307
2617
  case "heading":
2308
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(HeadingNode, { node });
2618
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(HeadingNode, { node });
2309
2619
  case "badge":
2310
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BadgeNode, { node });
2620
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(BadgeNode, { node });
2311
2621
  case "button":
2312
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ButtonNode, { node });
2622
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ButtonNode, { node });
2313
2623
  case "toggle":
2314
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToggleNode, { node });
2624
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ToggleNode, { node });
2315
2625
  case "slider":
2316
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SliderNode, { node });
2626
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SliderNode, { node });
2317
2627
  case "tooltip":
2318
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TooltipNode, { node });
2628
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TooltipNode, { node });
2319
2629
  case "draggable":
2320
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DraggableNode, { node });
2630
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DraggableNode, { node });
2321
2631
  case "custom":
2322
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CustomNode, { node });
2632
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CustomNode, { node });
2323
2633
  default:
2324
2634
  return null;
2325
2635
  }
@@ -2327,9 +2637,9 @@ var UiNodeView = ({ node }) => {
2327
2637
  function useActionRunner() {
2328
2638
  const state = useUiState();
2329
2639
  const dispatch = useUiDispatch();
2330
- const runtime = (0, import_react13.useThreadRuntime)();
2640
+ const runtime = (0, import_react15.useThreadRuntime)();
2331
2641
  const emit = useUiEventEmitter();
2332
- return (0, import_react11.useCallback)(
2642
+ return (0, import_react13.useCallback)(
2333
2643
  (actions) => {
2334
2644
  if (!actions) return;
2335
2645
  const list = Array.isArray(actions) ? actions : [actions];
@@ -2379,7 +2689,7 @@ var JUSTIFY_CLS = {
2379
2689
  };
2380
2690
  var BoxNode = ({ node }) => {
2381
2691
  const dir = node.direction ?? "col";
2382
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2692
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2383
2693
  "div",
2384
2694
  {
2385
2695
  className: cn(
@@ -2394,7 +2704,7 @@ var BoxNode = ({ node }) => {
2394
2704
  gap: node.gap !== void 0 ? `${node.gap * 0.25}rem` : void 0,
2395
2705
  padding: node.padding !== void 0 ? `${node.padding * 0.25}rem` : void 0
2396
2706
  },
2397
- children: node.children?.map((child, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(UiNodeView, { node: child }, child.id ?? i))
2707
+ children: node.children?.map((child, i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(UiNodeView, { node: child }, child.id ?? i))
2398
2708
  }
2399
2709
  );
2400
2710
  };
@@ -2413,7 +2723,7 @@ var TEXT_WEIGHT = {
2413
2723
  var TextNode = ({ node }) => {
2414
2724
  const state = useUiState();
2415
2725
  const value = resolveBindable(node.value, state);
2416
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2726
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2417
2727
  "span",
2418
2728
  {
2419
2729
  className: cn(
@@ -2444,13 +2754,13 @@ var HeadingNode = ({ node }) => {
2444
2754
  );
2445
2755
  switch (level) {
2446
2756
  case 1:
2447
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h1", { className: cls, children: value });
2757
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h1", { className: cls, children: value });
2448
2758
  case 2:
2449
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h2", { className: cls, children: value });
2759
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h2", { className: cls, children: value });
2450
2760
  case 3:
2451
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h3", { className: cls, children: value });
2761
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h3", { className: cls, children: value });
2452
2762
  case 4:
2453
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h4", { className: cls, children: value });
2763
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h4", { className: cls, children: value });
2454
2764
  }
2455
2765
  };
2456
2766
  var BADGE_TONE = {
@@ -2463,7 +2773,7 @@ var BADGE_TONE = {
2463
2773
  var BadgeNode = ({ node }) => {
2464
2774
  const state = useUiState();
2465
2775
  const value = String(resolveBindable(node.value, state) ?? "");
2466
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2776
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2467
2777
  "span",
2468
2778
  {
2469
2779
  className: cn(
@@ -2480,7 +2790,7 @@ var ButtonNode = ({ node }) => {
2480
2790
  const run = useActionRunner();
2481
2791
  const label = String(resolveBindable(node.label, state) ?? "");
2482
2792
  const disabled = node.disabled !== void 0 ? Boolean(resolveBindable(node.disabled, state)) : false;
2483
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2793
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2484
2794
  Button,
2485
2795
  {
2486
2796
  variant: node.variant ?? "default",
@@ -2502,7 +2812,7 @@ var ToggleNode = ({ node }) => {
2502
2812
  dispatch({ type: "toggle", path: node.binding });
2503
2813
  run(node.onChange);
2504
2814
  };
2505
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2815
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2506
2816
  "label",
2507
2817
  {
2508
2818
  className: cn(
@@ -2510,7 +2820,7 @@ var ToggleNode = ({ node }) => {
2510
2820
  node.className
2511
2821
  ),
2512
2822
  children: [
2513
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2823
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2514
2824
  "button",
2515
2825
  {
2516
2826
  type: "button",
@@ -2521,7 +2831,7 @@ var ToggleNode = ({ node }) => {
2521
2831
  "relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-[background,box-shadow,border-color] duration-200",
2522
2832
  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")
2523
2833
  ),
2524
- children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2834
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2525
2835
  "span",
2526
2836
  {
2527
2837
  className: cn(
@@ -2534,7 +2844,7 @@ var ToggleNode = ({ node }) => {
2534
2844
  )
2535
2845
  }
2536
2846
  ),
2537
- label && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-foreground/85", children: label })
2847
+ label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-foreground/85", children: label })
2538
2848
  ]
2539
2849
  }
2540
2850
  );
@@ -2554,12 +2864,12 @@ var SliderNode = ({ node }) => {
2554
2864
  const next = Number(e.target.value);
2555
2865
  dispatch({ type: "set", path: node.binding, value: next });
2556
2866
  };
2557
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: cn("aui-ui-slider flex flex-col gap-1", node.className), children: [
2558
- (label || showValue) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center justify-between text-xs text-muted-foreground", children: [
2559
- label && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: label }),
2560
- showValue && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "font-mono", children: value })
2867
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: cn("aui-ui-slider flex flex-col gap-1", node.className), children: [
2868
+ (label || showValue) && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center justify-between text-xs text-muted-foreground", children: [
2869
+ label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: label }),
2870
+ showValue && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "font-mono", children: value })
2561
2871
  ] }),
2562
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2872
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2563
2873
  "input",
2564
2874
  {
2565
2875
  type: "range",
@@ -2581,9 +2891,9 @@ var SliderNode = ({ node }) => {
2581
2891
  var TooltipNode = ({ node }) => {
2582
2892
  const state = useUiState();
2583
2893
  const content = String(resolveBindable(node.content, state) ?? "");
2584
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Tooltip, { children: [
2585
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: cn("aui-ui-tooltip-trigger inline-flex", node.className), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(UiNodeView, { node: node.child }) }) }),
2586
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TooltipContent, { side: node.side ?? "top", children: content })
2894
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Tooltip, { children: [
2895
+ /* @__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 }) }) }),
2896
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TooltipContent, { side: node.side ?? "top", children: content })
2587
2897
  ] }) });
2588
2898
  };
2589
2899
  var DraggableNode = ({ node }) => {
@@ -2591,8 +2901,8 @@ var DraggableNode = ({ node }) => {
2591
2901
  const snapBack = node.snapBack ?? true;
2592
2902
  const axis = node.axis ?? "both";
2593
2903
  const dragProp = axis === "both" ? true : axis;
2594
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2595
- import_react12.motion.div,
2904
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2905
+ import_react14.motion.div,
2596
2906
  {
2597
2907
  drag: dragProp,
2598
2908
  dragMomentum: false,
@@ -2603,7 +2913,7 @@ var DraggableNode = ({ node }) => {
2603
2913
  "aui-ui-draggable inline-block cursor-grab touch-none",
2604
2914
  node.className
2605
2915
  ),
2606
- children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(UiNodeView, { node: node.child })
2916
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(UiNodeView, { node: node.child })
2607
2917
  }
2608
2918
  );
2609
2919
  };
@@ -2613,8 +2923,8 @@ var CustomNode = ({ node }) => {
2613
2923
  const Renderer = registry[node.name];
2614
2924
  if (!Renderer) return null;
2615
2925
  const resolvedProps = resolveProps(node.props ?? {}, state);
2616
- const children = node.children?.map((child, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(UiNodeView, { node: child }, child.id ?? i));
2617
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Renderer, { props: resolvedProps, children });
2926
+ const children = node.children?.map((child, i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(UiNodeView, { node: child }, child.id ?? i));
2927
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Renderer, { props: resolvedProps, children });
2618
2928
  };
2619
2929
  function resolveProps(props, state) {
2620
2930
  const out = {};
@@ -2625,17 +2935,17 @@ function resolveProps(props, state) {
2625
2935
  }
2626
2936
 
2627
2937
  // src/artifacts/ui/ui-artifact.tsx
2628
- var import_jsx_runtime18 = require("react/jsx-runtime");
2938
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2629
2939
  var UiArtifactView = ({ artifact }) => {
2630
- const [state, dispatch] = (0, import_react14.useReducer)(
2940
+ const [state, dispatch] = (0, import_react16.useReducer)(
2631
2941
  uiStateReducer,
2632
2942
  artifact.initialState ?? {}
2633
2943
  );
2634
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ArtifactCard, { title: artifact.title, kind: "ui", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(UiStateProvider, { state, dispatch, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "aui-ui-root p-3", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(UiNodeView, { node: artifact.root }) }) }) });
2944
+ 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 }) }) }) });
2635
2945
  };
2636
2946
 
2637
2947
  // src/artifacts/registry.tsx
2638
- var import_jsx_runtime19 = require("react/jsx-runtime");
2948
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2639
2949
  var defaultArtifactRenderers = {
2640
2950
  chart: ChartArtifactView,
2641
2951
  question: QuestionArtifactView,
@@ -2644,25 +2954,25 @@ var defaultArtifactRenderers = {
2644
2954
  table: TableArtifactView,
2645
2955
  ui: UiArtifactView
2646
2956
  };
2647
- var ArtifactRegistryContext = (0, import_react15.createContext)(
2957
+ var ArtifactRegistryContext = (0, import_react17.createContext)(
2648
2958
  defaultArtifactRenderers
2649
2959
  );
2650
2960
  var ArtifactRegistryProvider = ({ renderers, override, children }) => {
2651
- const merged = (0, import_react15.useMemo)(() => {
2961
+ const merged = (0, import_react17.useMemo)(() => {
2652
2962
  if (!renderers) return defaultArtifactRenderers;
2653
2963
  if (override) return renderers;
2654
2964
  return { ...defaultArtifactRenderers, ...renderers };
2655
2965
  }, [renderers, override]);
2656
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ArtifactRegistryContext.Provider, { value: merged, children });
2966
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ArtifactRegistryContext.Provider, { value: merged, children });
2657
2967
  };
2658
2968
  function useArtifactRegistry() {
2659
- return (0, import_react15.useContext)(ArtifactRegistryContext);
2969
+ return (0, import_react17.useContext)(ArtifactRegistryContext);
2660
2970
  }
2661
2971
  var ArtifactView = ({ artifact }) => {
2662
2972
  const registry = useArtifactRegistry();
2663
2973
  const Renderer = registry[artifact.type] ?? registry.json;
2664
2974
  if (!Renderer) return null;
2665
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Renderer, { artifact });
2975
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Renderer, { artifact });
2666
2976
  };
2667
2977
 
2668
2978
  // src/artifacts/parse.ts
@@ -2738,7 +3048,7 @@ var import_c = __toESM(require("shiki/langs/c.mjs"), 1);
2738
3048
  var import_cpp = __toESM(require("shiki/langs/cpp.mjs"), 1);
2739
3049
  var import_vitesse_dark = __toESM(require("shiki/themes/vitesse-dark.mjs"), 1);
2740
3050
  var import_vitesse_light = __toESM(require("shiki/themes/vitesse-light.mjs"), 1);
2741
- var import_jsx_runtime20 = require("react/jsx-runtime");
3051
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2742
3052
  var SHIKI_THEME_DARK = "vitesse-dark";
2743
3053
  var SHIKI_THEME_LIGHT = "vitesse-light";
2744
3054
  var highlighterPromise = null;
@@ -2776,8 +3086,8 @@ var ShikiSyntaxHighlighter = ({
2776
3086
  language,
2777
3087
  code
2778
3088
  }) => {
2779
- const [html, setHtml] = (0, import_react16.useState)(null);
2780
- (0, import_react16.useEffect)(() => {
3089
+ const [html, setHtml] = (0, import_react18.useState)(null);
3090
+ (0, import_react18.useEffect)(() => {
2781
3091
  let cancelled = false;
2782
3092
  (async () => {
2783
3093
  try {
@@ -2807,13 +3117,13 @@ var ShikiSyntaxHighlighter = ({
2807
3117
  try {
2808
3118
  const parsed = JSON.parse(code);
2809
3119
  if (isArtifact(parsed)) {
2810
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ArtifactView, { artifact: parsed });
3120
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ArtifactView, { artifact: parsed });
2811
3121
  }
2812
3122
  } catch {
2813
3123
  }
2814
3124
  }
2815
3125
  if (html) {
2816
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3126
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2817
3127
  "div",
2818
3128
  {
2819
3129
  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",
@@ -2821,14 +3131,14 @@ var ShikiSyntaxHighlighter = ({
2821
3131
  }
2822
3132
  );
2823
3133
  }
2824
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pre, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Code2, { children: code }) });
3134
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Pre, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Code2, { children: code }) });
2825
3135
  };
2826
3136
  var syntax_highlighter_default = ShikiSyntaxHighlighter;
2827
3137
 
2828
3138
  // src/chat/markdown-text.tsx
2829
- var import_jsx_runtime21 = require("react/jsx-runtime");
3139
+ var import_jsx_runtime22 = require("react/jsx-runtime");
2830
3140
  var MarkdownTextImpl = () => {
2831
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3141
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2832
3142
  import_react_markdown.MarkdownTextPrimitive,
2833
3143
  {
2834
3144
  remarkPlugins: [import_remark_gfm.default, import_remark_math.default],
@@ -2841,7 +3151,7 @@ var MarkdownTextImpl = () => {
2841
3151
  }
2842
3152
  );
2843
3153
  };
2844
- var MarkdownText = (0, import_react17.memo)(MarkdownTextImpl);
3154
+ var MarkdownText = (0, import_react19.memo)(MarkdownTextImpl);
2845
3155
  var CodeHeader = ({ language, code }) => {
2846
3156
  const { isCopied, copyToClipboard } = useCopyToClipboard();
2847
3157
  if (isArtifactFenceLanguage(language)) return null;
@@ -2849,20 +3159,20 @@ var CodeHeader = ({ language, code }) => {
2849
3159
  if (!code || isCopied) return;
2850
3160
  copyToClipboard(code);
2851
3161
  };
2852
- return /* @__PURE__ */ (0, import_jsx_runtime21.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: [
2853
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "flex items-center gap-2 text-xs font-semibold tracking-wide text-muted-foreground/80 uppercase", children: [
2854
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-block h-2 w-2 rounded-full bg-primary/40" }),
3162
+ 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: [
3163
+ /* @__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: [
3164
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-block h-2 w-2 rounded-full bg-primary/40" }),
2855
3165
  language
2856
3166
  ] }),
2857
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3167
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2858
3168
  TooltipIconButton,
2859
3169
  {
2860
3170
  tooltip: isCopied ? "Copied!" : "Copy",
2861
3171
  onClick: onCopy,
2862
3172
  className: "transition-colors hover:text-foreground",
2863
3173
  children: [
2864
- !isCopied && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react4.CopyIcon, { className: "h-3.5 w-3.5" }),
2865
- isCopied && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react4.CheckIcon, { className: "h-3.5 w-3.5 text-emerald-500" })
3174
+ !isCopied && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react4.CopyIcon, { className: "h-3.5 w-3.5" }),
3175
+ isCopied && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react4.CheckIcon, { className: "h-3.5 w-3.5 text-emerald-500" })
2866
3176
  ]
2867
3177
  }
2868
3178
  )
@@ -2871,7 +3181,7 @@ var CodeHeader = ({ language, code }) => {
2871
3181
  var useCopyToClipboard = ({
2872
3182
  copiedDuration = 3e3
2873
3183
  } = {}) => {
2874
- const [isCopied, setIsCopied] = (0, import_react17.useState)(false);
3184
+ const [isCopied, setIsCopied] = (0, import_react19.useState)(false);
2875
3185
  const copyToClipboard = (value) => {
2876
3186
  if (!value) return;
2877
3187
  navigator.clipboard.writeText(value).then(() => {
@@ -2882,7 +3192,7 @@ var useCopyToClipboard = ({
2882
3192
  return { isCopied, copyToClipboard };
2883
3193
  };
2884
3194
  var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownComponents)({
2885
- h1: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3195
+ h1: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2886
3196
  "h1",
2887
3197
  {
2888
3198
  className: cn(
@@ -2892,7 +3202,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
2892
3202
  ...props
2893
3203
  }
2894
3204
  ),
2895
- h2: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3205
+ h2: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2896
3206
  "h2",
2897
3207
  {
2898
3208
  className: cn(
@@ -2902,7 +3212,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
2902
3212
  ...props
2903
3213
  }
2904
3214
  ),
2905
- h3: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3215
+ h3: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2906
3216
  "h3",
2907
3217
  {
2908
3218
  className: cn(
@@ -2912,7 +3222,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
2912
3222
  ...props
2913
3223
  }
2914
3224
  ),
2915
- h4: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3225
+ h4: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2916
3226
  "h4",
2917
3227
  {
2918
3228
  className: cn(
@@ -2922,7 +3232,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
2922
3232
  ...props
2923
3233
  }
2924
3234
  ),
2925
- h5: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3235
+ h5: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2926
3236
  "h5",
2927
3237
  {
2928
3238
  className: cn(
@@ -2932,7 +3242,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
2932
3242
  ...props
2933
3243
  }
2934
3244
  ),
2935
- h6: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3245
+ h6: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2936
3246
  "h6",
2937
3247
  {
2938
3248
  className: cn(
@@ -2942,7 +3252,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
2942
3252
  ...props
2943
3253
  }
2944
3254
  ),
2945
- p: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3255
+ p: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2946
3256
  "p",
2947
3257
  {
2948
3258
  className: cn(
@@ -2952,7 +3262,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
2952
3262
  ...props
2953
3263
  }
2954
3264
  ),
2955
- a: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3265
+ a: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2956
3266
  "a",
2957
3267
  {
2958
3268
  className: cn(
@@ -2964,7 +3274,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
2964
3274
  ...props
2965
3275
  }
2966
3276
  ),
2967
- blockquote: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3277
+ blockquote: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2968
3278
  "blockquote",
2969
3279
  {
2970
3280
  className: cn(
@@ -2974,7 +3284,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
2974
3284
  ...props
2975
3285
  }
2976
3286
  ),
2977
- ul: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3287
+ ul: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2978
3288
  "ul",
2979
3289
  {
2980
3290
  className: cn(
@@ -2984,7 +3294,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
2984
3294
  ...props
2985
3295
  }
2986
3296
  ),
2987
- ol: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3297
+ ol: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2988
3298
  "ol",
2989
3299
  {
2990
3300
  className: cn(
@@ -2994,7 +3304,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
2994
3304
  ...props
2995
3305
  }
2996
3306
  ),
2997
- hr: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3307
+ hr: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2998
3308
  "hr",
2999
3309
  {
3000
3310
  className: cn(
@@ -3004,14 +3314,14 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3004
3314
  ...props
3005
3315
  }
3006
3316
  ),
3007
- table: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "my-4 w-full overflow-x-auto rounded-lg border border-border/50", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3317
+ 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)(
3008
3318
  "table",
3009
3319
  {
3010
3320
  className: cn("aui-md-table w-full border-collapse text-sm", className),
3011
3321
  ...props
3012
3322
  }
3013
3323
  ) }),
3014
- th: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3324
+ th: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3015
3325
  "th",
3016
3326
  {
3017
3327
  className: cn(
@@ -3021,7 +3331,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3021
3331
  ...props
3022
3332
  }
3023
3333
  ),
3024
- td: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3334
+ td: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3025
3335
  "td",
3026
3336
  {
3027
3337
  className: cn(
@@ -3031,7 +3341,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3031
3341
  ...props
3032
3342
  }
3033
3343
  ),
3034
- tr: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3344
+ tr: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3035
3345
  "tr",
3036
3346
  {
3037
3347
  className: cn(
@@ -3041,8 +3351,8 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3041
3351
  ...props
3042
3352
  }
3043
3353
  ),
3044
- li: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("li", { className: cn("aui-md-li leading-[1.7]", className), ...props }),
3045
- sup: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3354
+ li: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("li", { className: cn("aui-md-li leading-[1.7]", className), ...props }),
3355
+ sup: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3046
3356
  "sup",
3047
3357
  {
3048
3358
  className: cn(
@@ -3052,7 +3362,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3052
3362
  ...props
3053
3363
  }
3054
3364
  ),
3055
- pre: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3365
+ pre: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3056
3366
  "pre",
3057
3367
  {
3058
3368
  className: cn(
@@ -3064,7 +3374,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3064
3374
  ),
3065
3375
  code: function Code({ className, ...props }) {
3066
3376
  const isCodeBlock = (0, import_react_markdown.useIsMarkdownCodeBlock)();
3067
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3377
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3068
3378
  "code",
3069
3379
  {
3070
3380
  className: cn(
@@ -3075,20 +3385,20 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3075
3385
  }
3076
3386
  );
3077
3387
  },
3078
- strong: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("strong", { className: cn("font-semibold text-foreground", className), ...props }),
3079
- em: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("em", { className: cn("italic", className), ...props }),
3388
+ strong: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("strong", { className: cn("font-semibold text-foreground", className), ...props }),
3389
+ em: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("em", { className: cn("italic", className), ...props }),
3080
3390
  CodeHeader
3081
3391
  });
3082
3392
 
3083
3393
  // src/chat/tool-fallback.tsx
3084
- var import_react21 = require("react");
3394
+ var import_react23 = require("react");
3085
3395
  var import_lucide_react5 = require("lucide-react");
3086
- var import_react22 = require("@assistant-ui/react");
3396
+ var import_react24 = require("@assistant-ui/react");
3087
3397
 
3088
3398
  // src/ui/shimmer.tsx
3089
- var import_react18 = require("motion/react");
3090
- var import_react19 = require("react");
3091
- var import_jsx_runtime22 = require("react/jsx-runtime");
3399
+ var import_react20 = require("motion/react");
3400
+ var import_react21 = require("react");
3401
+ var import_jsx_runtime23 = require("react/jsx-runtime");
3092
3402
  var ShimmerComponent = ({
3093
3403
  children,
3094
3404
  as: Component = "p",
@@ -3096,14 +3406,14 @@ var ShimmerComponent = ({
3096
3406
  duration = 2,
3097
3407
  spread = 2
3098
3408
  }) => {
3099
- const MotionComponent = import_react18.motion.create(
3409
+ const MotionComponent = import_react20.motion.create(
3100
3410
  Component
3101
3411
  );
3102
- const dynamicSpread = (0, import_react19.useMemo)(
3412
+ const dynamicSpread = (0, import_react21.useMemo)(
3103
3413
  () => (children?.length ?? 0) * spread,
3104
3414
  [children, spread]
3105
3415
  );
3106
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3416
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3107
3417
  MotionComponent,
3108
3418
  {
3109
3419
  animate: { backgroundPosition: "0% center" },
@@ -3126,11 +3436,11 @@ var ShimmerComponent = ({
3126
3436
  }
3127
3437
  );
3128
3438
  };
3129
- var Shimmer = (0, import_react19.memo)(ShimmerComponent);
3439
+ var Shimmer = (0, import_react21.memo)(ShimmerComponent);
3130
3440
 
3131
3441
  // src/chat/motion.tsx
3132
- var import_react20 = require("motion/react");
3133
- var import_jsx_runtime23 = require("react/jsx-runtime");
3442
+ var import_react22 = require("motion/react");
3443
+ var import_jsx_runtime24 = require("react/jsx-runtime");
3134
3444
  var luxuryEase = [0.16, 1, 0.3, 1];
3135
3445
  var TOOL_ENTER_MS = 0.78;
3136
3446
  var TOOL_EXIT_MS = 0.28;
@@ -3156,10 +3466,10 @@ function toolMotionState(reduced, entering, variant) {
3156
3466
  return entering ? { opacity: 0, y: 14, filter: "blur(10px)" } : { opacity: 1, y: 0, filter: "blur(0px)" };
3157
3467
  }
3158
3468
  function ToolMotion({ children, className, motionKey }) {
3159
- const reduced = (0, import_react20.useReducedMotion)() ?? false;
3469
+ const reduced = (0, import_react22.useReducedMotion)() ?? false;
3160
3470
  const { enter, exit } = toolPresenceTransition(reduced);
3161
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3162
- import_react20.motion.div,
3471
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3472
+ import_react22.motion.div,
3163
3473
  {
3164
3474
  className: cn("aui-tool-motion w-full min-w-0", className),
3165
3475
  initial: toolMotionState(reduced, true, "settled"),
@@ -3178,11 +3488,11 @@ function ToolPresence({
3178
3488
  className,
3179
3489
  variant = "settled"
3180
3490
  }) {
3181
- const reduced = (0, import_react20.useReducedMotion)() ?? false;
3491
+ const reduced = (0, import_react22.useReducedMotion)() ?? false;
3182
3492
  const { enter, exit } = toolPresenceTransition(reduced);
3183
3493
  const enterTransition = variant === "executing" ? { duration: reduced ? 0.3 : 0.52, ease: luxuryEase } : enter;
3184
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react20.AnimatePresence, { mode: "wait", initial: true, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3185
- import_react20.motion.div,
3494
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react22.AnimatePresence, { mode: "wait", initial: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3495
+ import_react22.motion.div,
3186
3496
  {
3187
3497
  className: cn("aui-tool-presence w-full min-w-0", className),
3188
3498
  initial: toolMotionState(reduced, true, variant),
@@ -3202,8 +3512,8 @@ function ToolBodyPresence({
3202
3512
  children,
3203
3513
  className
3204
3514
  }) {
3205
- const reduced = (0, import_react20.useReducedMotion)() ?? false;
3206
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3515
+ const reduced = (0, import_react22.useReducedMotion)() ?? false;
3516
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3207
3517
  "div",
3208
3518
  {
3209
3519
  className: cn(
@@ -3211,7 +3521,7 @@ function ToolBodyPresence({
3211
3521
  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)]"
3212
3522
  ),
3213
3523
  style: { gridTemplateRows: open ? "1fr" : "0fr" },
3214
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "min-h-0 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3524
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "min-h-0 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3215
3525
  "div",
3216
3526
  {
3217
3527
  className: cn(
@@ -3227,7 +3537,7 @@ function ToolBodyPresence({
3227
3537
  }
3228
3538
 
3229
3539
  // src/chat/tool-fallback.tsx
3230
- var import_jsx_runtime24 = require("react/jsx-runtime");
3540
+ var import_jsx_runtime25 = require("react/jsx-runtime");
3231
3541
  function detectRunning({
3232
3542
  status,
3233
3543
  result,
@@ -3241,7 +3551,7 @@ function detectRunning({
3241
3551
  }
3242
3552
  function useToolRunning(props) {
3243
3553
  const { isRunning: streamRunning } = useTimbalRuntime();
3244
- const partStatus = (0, import_react22.useAuiState)((s) => s.part.status);
3554
+ const partStatus = (0, import_react24.useAuiState)((s) => s.part.status);
3245
3555
  return detectRunning({
3246
3556
  status: partStatus ?? props.status,
3247
3557
  result: props.result,
@@ -3259,8 +3569,8 @@ function formatToolResult(result) {
3259
3569
  return String(result);
3260
3570
  }
3261
3571
  }
3262
- var TimelineActionLabel = ({ action, detail, shimmer = false }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "inline-flex min-w-0 max-w-full items-baseline gap-1", children: [
3263
- action ? shimmer ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3572
+ 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: [
3573
+ action ? shimmer ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3264
3574
  Shimmer,
3265
3575
  {
3266
3576
  as: "span",
@@ -3269,10 +3579,10 @@ var TimelineActionLabel = ({ action, detail, shimmer = false }) => /* @__PURE__
3269
3579
  spread: 2.5,
3270
3580
  children: action
3271
3581
  }
3272
- ) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: studioTimelineActionClass, children: action }) : null,
3273
- detail ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: studioTimelineDetailClass, children: detail }) : null
3582
+ ) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: studioTimelineActionClass, children: action }) : null,
3583
+ detail ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: studioTimelineDetailClass, children: detail }) : null
3274
3584
  ] });
3275
- var TimelineHoverChevron = ({ expanded }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3585
+ var TimelineHoverChevron = ({ expanded }) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3276
3586
  import_lucide_react5.ChevronRightIcon,
3277
3587
  {
3278
3588
  className: studioTimelineChevronClass(expanded),
@@ -3280,9 +3590,9 @@ var TimelineHoverChevron = ({ expanded }) => /* @__PURE__ */ (0, import_jsx_runt
3280
3590
  }
3281
3591
  );
3282
3592
  var ToolPanel = ({ toolName, argsText, result, isError }) => {
3283
- const [open, setOpen] = (0, import_react21.useState)(false);
3593
+ const [open, setOpen] = (0, import_react23.useState)(false);
3284
3594
  const detail = formatToolLabel(toolName);
3285
- const formattedArgs = (0, import_react21.useMemo)(() => {
3595
+ const formattedArgs = (0, import_react23.useMemo)(() => {
3286
3596
  if (!argsText || argsText === "{}") return null;
3287
3597
  try {
3288
3598
  return JSON.stringify(JSON.parse(argsText), null, 2);
@@ -3290,17 +3600,17 @@ var ToolPanel = ({ toolName, argsText, result, isError }) => {
3290
3600
  return argsText;
3291
3601
  }
3292
3602
  }, [argsText]);
3293
- const formattedResult = (0, import_react21.useMemo)(() => {
3603
+ const formattedResult = (0, import_react23.useMemo)(() => {
3294
3604
  if (result === void 0 || result === null) return null;
3295
3605
  return formatToolResult(result);
3296
3606
  }, [result]);
3297
3607
  const hasBody = Boolean(formattedArgs || formattedResult);
3298
3608
  const action = isError ? "Failed" : "Used";
3299
3609
  if (!hasBody) {
3300
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "aui-tool-row w-full min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TimelineActionLabel, { action, detail }) });
3610
+ 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 }) });
3301
3611
  }
3302
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "aui-tool-row w-full min-w-0", children: [
3303
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3612
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "aui-tool-row w-full min-w-0", children: [
3613
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3304
3614
  "button",
3305
3615
  {
3306
3616
  type: "button",
@@ -3308,7 +3618,7 @@ var ToolPanel = ({ toolName, argsText, result, isError }) => {
3308
3618
  "aria-expanded": open,
3309
3619
  "aria-label": `${action} ${detail}`,
3310
3620
  className: studioTimelineRowButtonClass,
3311
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
3621
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3312
3622
  "span",
3313
3623
  {
3314
3624
  className: cn(
@@ -3317,37 +3627,37 @@ var ToolPanel = ({ toolName, argsText, result, isError }) => {
3317
3627
  "text-foreground"
3318
3628
  ),
3319
3629
  children: [
3320
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TimelineActionLabel, { action, detail }),
3321
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TimelineHoverChevron, { expanded: open })
3630
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TimelineActionLabel, { action, detail }),
3631
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TimelineHoverChevron, { expanded: open })
3322
3632
  ]
3323
3633
  }
3324
3634
  )
3325
3635
  }
3326
3636
  ),
3327
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
3637
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3328
3638
  ToolBodyPresence,
3329
3639
  {
3330
3640
  open,
3331
3641
  className: cn(studioTimelineBodyPadClass, "gap-2"),
3332
3642
  children: [
3333
- formattedArgs ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3643
+ formattedArgs ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3334
3644
  "div",
3335
3645
  {
3336
3646
  className: cn(
3337
3647
  studioComposerIoWellClass,
3338
3648
  "max-h-48 overflow-auto px-2.5 py-2"
3339
3649
  ),
3340
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("pre", { className: "whitespace-pre-wrap break-words font-mono text-[11px] font-normal leading-relaxed text-foreground", children: formattedArgs })
3650
+ 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 })
3341
3651
  }
3342
3652
  ) : null,
3343
- formattedResult ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3653
+ formattedResult ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3344
3654
  "div",
3345
3655
  {
3346
3656
  className: cn(
3347
3657
  studioComposerIoWellClass,
3348
3658
  "max-h-48 overflow-auto px-2.5 py-2"
3349
3659
  ),
3350
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("pre", { className: "whitespace-pre-wrap break-words font-mono text-[11px] font-normal leading-relaxed text-foreground", children: formattedResult })
3660
+ 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 })
3351
3661
  }
3352
3662
  ) : null
3353
3663
  ]
@@ -3364,20 +3674,20 @@ var ToolFallbackImpl = ({
3364
3674
  const isRunning = useToolRunning({ status, result });
3365
3675
  const isError = status?.type === "incomplete" && status.reason !== "cancelled";
3366
3676
  const presenceKey = isRunning ? "running" : isError ? "error" : "complete";
3367
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3677
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3368
3678
  ToolPresence,
3369
3679
  {
3370
3680
  presenceKey,
3371
3681
  variant: isRunning ? "executing" : "settled",
3372
3682
  className: "py-0.5",
3373
- children: isRunning ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "aui-tool-running", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3683
+ children: isRunning ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "aui-tool-running", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3374
3684
  TimelineActionLabel,
3375
3685
  {
3376
3686
  action: "Using",
3377
3687
  detail: formatToolLabel(toolName),
3378
3688
  shimmer: true
3379
3689
  }
3380
- ) }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3690
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3381
3691
  ToolPanel,
3382
3692
  {
3383
3693
  toolName,
@@ -3389,13 +3699,13 @@ var ToolFallbackImpl = ({
3389
3699
  }
3390
3700
  );
3391
3701
  };
3392
- var ToolFallback = (0, import_react21.memo)(
3702
+ var ToolFallback = (0, import_react23.memo)(
3393
3703
  ToolFallbackImpl
3394
3704
  );
3395
3705
  ToolFallback.displayName = "ToolFallback";
3396
3706
 
3397
3707
  // src/artifacts/tool-artifact.tsx
3398
- var import_jsx_runtime25 = require("react/jsx-runtime");
3708
+ var import_jsx_runtime26 = require("react/jsx-runtime");
3399
3709
  var ToolArtifactFallback = (props) => {
3400
3710
  const registry = useArtifactRegistry();
3401
3711
  const isRunning = useToolRunning({
@@ -3407,24 +3717,24 @@ var ToolArtifactFallback = (props) => {
3407
3717
  if (artifact) {
3408
3718
  const Renderer = registry[artifact.type];
3409
3719
  if (Renderer) {
3410
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3720
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3411
3721
  ToolMotion,
3412
3722
  {
3413
3723
  motionKey: `artifact-${artifact.type}`,
3414
3724
  className: "aui-tool-artifact",
3415
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Renderer, { artifact })
3725
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Renderer, { artifact })
3416
3726
  }
3417
3727
  );
3418
3728
  }
3419
3729
  }
3420
3730
  }
3421
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ToolFallback, { ...props });
3731
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ToolFallback, { ...props });
3422
3732
  };
3423
3733
 
3424
3734
  // src/chat/composer.tsx
3425
- var import_react23 = require("@assistant-ui/react");
3735
+ var import_react25 = require("@assistant-ui/react");
3426
3736
  var import_lucide_react6 = require("lucide-react");
3427
- var import_jsx_runtime26 = require("react/jsx-runtime");
3737
+ var import_jsx_runtime27 = require("react/jsx-runtime");
3428
3738
  var Composer = ({
3429
3739
  placeholder = "Send a message...",
3430
3740
  showAttachments,
@@ -3435,10 +3745,10 @@ var Composer = ({
3435
3745
  }) => {
3436
3746
  const attachmentsEnabled = useTimbalAttachmentsEnabled();
3437
3747
  const attachUi = showAttachments !== false && attachmentsEnabled;
3438
- const shell = /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
3439
- attachUi && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ComposerAttachments, {}),
3440
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ComposerInput, { placeholder, autoFocus: !noAutoFocus }),
3441
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3748
+ const shell = /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
3749
+ attachUi && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ComposerAttachments, {}),
3750
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ComposerInput, { placeholder, autoFocus: !noAutoFocus }),
3751
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3442
3752
  ComposerToolbar,
3443
3753
  {
3444
3754
  showAttachments: attachUi,
@@ -3447,15 +3757,15 @@ var Composer = ({
3447
3757
  }
3448
3758
  )
3449
3759
  ] });
3450
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3451
- import_react23.ComposerPrimitive.Root,
3760
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3761
+ import_react25.ComposerPrimitive.Root,
3452
3762
  {
3453
3763
  className: cn(
3454
3764
  "aui-composer-root relative flex w-full flex-col",
3455
3765
  className
3456
3766
  ),
3457
- children: attachUi ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3458
- import_react23.ComposerPrimitive.AttachmentDropzone,
3767
+ children: attachUi ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3768
+ import_react25.ComposerPrimitive.AttachmentDropzone,
3459
3769
  {
3460
3770
  className: cn(
3461
3771
  studioComposeInputShellClass,
@@ -3463,7 +3773,7 @@ var Composer = ({
3463
3773
  ),
3464
3774
  children: shell
3465
3775
  }
3466
- ) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: studioComposeInputShellClass, children: shell })
3776
+ ) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: studioComposeInputShellClass, children: shell })
3467
3777
  }
3468
3778
  );
3469
3779
  };
@@ -3471,7 +3781,7 @@ var ComposerInput = ({
3471
3781
  placeholder,
3472
3782
  autoFocus
3473
3783
  }) => {
3474
- const composer = (0, import_react23.useComposerRuntime)();
3784
+ const composer = (0, import_react25.useComposerRuntime)();
3475
3785
  const onKeyDown = (e) => {
3476
3786
  if (e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing) {
3477
3787
  e.preventDefault();
@@ -3483,8 +3793,8 @@ var ComposerInput = ({
3483
3793
  el.style.height = "auto";
3484
3794
  el.style.height = `${Math.min(el.scrollHeight, 240)}px`;
3485
3795
  };
3486
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3487
- import_react23.ComposerPrimitive.Input,
3796
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3797
+ import_react25.ComposerPrimitive.Input,
3488
3798
  {
3489
3799
  placeholder,
3490
3800
  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",
@@ -3497,17 +3807,17 @@ var ComposerInput = ({
3497
3807
  );
3498
3808
  };
3499
3809
  var ComposerToolbar = ({ showAttachments, toolbar, sendTooltip }) => {
3500
- return /* @__PURE__ */ (0, import_jsx_runtime26.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: [
3501
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-1", children: [
3502
- showAttachments && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ComposerAddAttachment, {}),
3810
+ 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: [
3811
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-1", children: [
3812
+ showAttachments && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ComposerAddAttachment, {}),
3503
3813
  toolbar
3504
3814
  ] }),
3505
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ComposerSendOrCancel, { sendTooltip })
3815
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ComposerSendOrCancel, { sendTooltip })
3506
3816
  ] });
3507
3817
  };
3508
3818
  var ComposerSendOrCancel = ({ sendTooltip }) => {
3509
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
3510
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react23.AuiIf, { condition: (s) => !s.thread.isRunning, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react23.ComposerPrimitive.Send, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3819
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
3820
+ /* @__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)(
3511
3821
  TooltipIconButton,
3512
3822
  {
3513
3823
  tooltip: sendTooltip,
@@ -3515,34 +3825,34 @@ var ComposerSendOrCancel = ({ sendTooltip }) => {
3515
3825
  type: "submit",
3516
3826
  className: "aui-composer-send shrink-0 disabled:opacity-30",
3517
3827
  "aria-label": "Send message",
3518
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react6.ArrowUpIcon, { className: "aui-composer-send-icon size-4" })
3828
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react6.ArrowUpIcon, { className: "aui-composer-send-icon size-4" })
3519
3829
  }
3520
3830
  ) }) }),
3521
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react23.AuiIf, { condition: (s) => s.thread.isRunning, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react23.ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3831
+ /* @__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)(
3522
3832
  TooltipIconButton,
3523
3833
  {
3524
3834
  tooltip: "Stop generating",
3525
3835
  variant: "primary",
3526
3836
  className: "aui-composer-cancel shrink-0",
3527
3837
  "aria-label": "Stop generating",
3528
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react6.SquareIcon, { className: "aui-composer-cancel-icon size-3 fill-current" })
3838
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react6.SquareIcon, { className: "aui-composer-cancel-icon size-3 fill-current" })
3529
3839
  }
3530
3840
  ) }) })
3531
3841
  ] });
3532
3842
  };
3533
3843
 
3534
3844
  // src/chat/suggestions.tsx
3535
- var import_react24 = require("react");
3536
- var import_react25 = require("@assistant-ui/react");
3845
+ var import_react26 = require("react");
3846
+ var import_react27 = require("@assistant-ui/react");
3537
3847
  var import_lucide_react7 = require("lucide-react");
3538
- var import_jsx_runtime27 = require("react/jsx-runtime");
3848
+ var import_jsx_runtime28 = require("react/jsx-runtime");
3539
3849
  var Suggestions = ({
3540
3850
  suggestions,
3541
3851
  className
3542
3852
  }) => {
3543
3853
  const items = useResolvedSuggestions(suggestions);
3544
3854
  if (!items || items.length === 0) return null;
3545
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3855
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3546
3856
  "div",
3547
3857
  {
3548
3858
  className: cn(
@@ -3551,17 +3861,17 @@ var Suggestions = ({
3551
3861
  ),
3552
3862
  role: "list",
3553
3863
  "aria-label": "Suggested prompts",
3554
- children: items.map((suggestion, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(SuggestionRow, { suggestion }, (suggestion.prompt ?? suggestion.title) + i))
3864
+ children: items.map((suggestion, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(SuggestionRow, { suggestion }, (suggestion.prompt ?? suggestion.title) + i))
3555
3865
  }
3556
3866
  );
3557
3867
  };
3558
3868
  var SuggestionRow = ({ suggestion }) => {
3559
- const runtime = (0, import_react25.useThreadRuntime)();
3869
+ const runtime = (0, import_react27.useThreadRuntime)();
3560
3870
  const onClick = () => {
3561
3871
  const text = suggestion.prompt ?? suggestion.title;
3562
3872
  runtime.append({ role: "user", content: [{ type: "text", text }] });
3563
3873
  };
3564
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3874
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3565
3875
  "button",
3566
3876
  {
3567
3877
  type: "button",
@@ -3569,20 +3879,20 @@ var SuggestionRow = ({ suggestion }) => {
3569
3879
  onClick,
3570
3880
  className: cn("aui-thread-suggestion", studioListRowButtonClass),
3571
3881
  children: [
3572
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "aui-thread-suggestion-icon shrink-0 text-muted-foreground", children: suggestion.icon ?? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react7.ArrowUpIcon, { className: "size-4", strokeWidth: 1.75, "aria-hidden": true }) }),
3573
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "aui-thread-suggestion-text min-w-0 flex-1 text-left", children: [
3574
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "aui-thread-suggestion-text-1 block truncate text-sm font-normal text-foreground", children: suggestion.title }),
3575
- suggestion.description && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "aui-thread-suggestion-text-2 mt-0.5 block truncate text-xs text-muted-foreground", children: suggestion.description })
3882
+ /* @__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 }) }),
3883
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "aui-thread-suggestion-text min-w-0 flex-1 text-left", children: [
3884
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "aui-thread-suggestion-text-1 block truncate text-sm font-normal text-foreground", children: suggestion.title }),
3885
+ 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 })
3576
3886
  ] })
3577
3887
  ]
3578
3888
  }
3579
3889
  );
3580
3890
  };
3581
3891
  function useResolvedSuggestions(source) {
3582
- const [resolved, setResolved] = (0, import_react24.useState)(
3892
+ const [resolved, setResolved] = (0, import_react26.useState)(
3583
3893
  () => Array.isArray(source) ? source : void 0
3584
3894
  );
3585
- (0, import_react24.useEffect)(() => {
3895
+ (0, import_react26.useEffect)(() => {
3586
3896
  if (!source) {
3587
3897
  setResolved(void 0);
3588
3898
  return;
@@ -3601,7 +3911,7 @@ function useResolvedSuggestions(source) {
3601
3911
  cancelled = true;
3602
3912
  };
3603
3913
  }, [source]);
3604
- return (0, import_react24.useMemo)(() => resolved, [resolved]);
3914
+ return (0, import_react26.useMemo)(() => resolved, [resolved]);
3605
3915
  }
3606
3916
 
3607
3917
  // src/design/theme-sanity.ts
@@ -3674,15 +3984,15 @@ function scheduleThemeSanityCheck() {
3674
3984
  }
3675
3985
 
3676
3986
  // src/chat/thread-variant.tsx
3677
- var import_react26 = require("react");
3678
- var ThreadVariantContext = (0, import_react26.createContext)("default");
3987
+ var import_react28 = require("react");
3988
+ var ThreadVariantContext = (0, import_react28.createContext)("default");
3679
3989
  var ThreadVariantProvider = ThreadVariantContext.Provider;
3680
3990
  function useThreadVariant() {
3681
- return (0, import_react26.useContext)(ThreadVariantContext);
3991
+ return (0, import_react28.useContext)(ThreadVariantContext);
3682
3992
  }
3683
3993
 
3684
3994
  // src/chat/thread.tsx
3685
- var import_jsx_runtime28 = require("react/jsx-runtime");
3995
+ var import_jsx_runtime29 = require("react/jsx-runtime");
3686
3996
  var Thread = ({
3687
3997
  className,
3688
3998
  variant = "default",
@@ -3704,17 +4014,17 @@ var Thread = ({
3704
4014
  const EditComposerSlot = components?.EditComposer ?? EditComposer;
3705
4015
  const ScrollToBottomSlot = components?.ScrollToBottom ?? ThreadScrollToBottom;
3706
4016
  const SuggestionsSlot = components?.Suggestions ?? Suggestions;
3707
- (0, import_react27.useEffect)(() => {
4017
+ (0, import_react29.useEffect)(() => {
3708
4018
  scheduleThemeSanityCheck();
3709
4019
  }, []);
3710
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ThreadVariantProvider, { value: variant, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4020
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ThreadVariantProvider, { value: variant, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3711
4021
  ArtifactRegistryProvider,
3712
4022
  {
3713
4023
  renderers: artifacts?.renderers,
3714
4024
  override: artifacts?.override,
3715
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(UiEventProvider, { onEvent: onArtifactEvent ?? (() => {
3716
- }), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3717
- import_react28.ThreadPrimitive.Root,
4025
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(UiEventProvider, { onEvent: onArtifactEvent ?? (() => {
4026
+ }), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4027
+ import_react30.ThreadPrimitive.Root,
3718
4028
  {
3719
4029
  className: cn(
3720
4030
  "aui-root aui-thread-root @container flex h-full flex-col bg-transparent",
@@ -3723,8 +4033,8 @@ var Thread = ({
3723
4033
  ),
3724
4034
  style: { ["--thread-max-width"]: maxWidth },
3725
4035
  "data-thread-variant": variant,
3726
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3727
- import_react28.ThreadPrimitive.Viewport,
4036
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4037
+ import_react30.ThreadPrimitive.Viewport,
3728
4038
  {
3729
4039
  turnAnchor: "bottom",
3730
4040
  className: cn(
@@ -3732,7 +4042,7 @@ var Thread = ({
3732
4042
  isPanel ? "px-2 pt-2" : "px-4 pt-4"
3733
4043
  ),
3734
4044
  children: [
3735
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4045
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3736
4046
  WelcomeSlot,
3737
4047
  {
3738
4048
  config: welcome,
@@ -3740,8 +4050,8 @@ var Thread = ({
3740
4050
  Suggestions: SuggestionsSlot
3741
4051
  }
3742
4052
  ),
3743
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3744
- import_react28.ThreadPrimitive.Messages,
4053
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4054
+ import_react30.ThreadPrimitive.Messages,
3745
4055
  {
3746
4056
  components: {
3747
4057
  UserMessage: UserMessageSlot,
@@ -3750,14 +4060,14 @@ var Thread = ({
3750
4060
  }
3751
4061
  }
3752
4062
  ),
3753
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3754
- import_react28.ThreadPrimitive.ViewportFooter,
4063
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4064
+ import_react30.ThreadPrimitive.ViewportFooter,
3755
4065
  {
3756
4066
  className: cn(
3757
4067
  "aui-thread-viewport-footer sticky bottom-0 z-10 mt-auto w-full isolate pt-2",
3758
4068
  isPanel ? "bg-card pb-2" : "bg-background pb-4 md:pb-6"
3759
4069
  ),
3760
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4070
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3761
4071
  "div",
3762
4072
  {
3763
4073
  className: cn(
@@ -3765,8 +4075,8 @@ var Thread = ({
3765
4075
  isPanel ? "gap-2" : "gap-4"
3766
4076
  ),
3767
4077
  children: [
3768
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ScrollToBottomSlot, {}),
3769
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ComposerSlot, { placeholder })
4078
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ScrollToBottomSlot, {}),
4079
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ComposerSlot, { placeholder })
3770
4080
  ]
3771
4081
  }
3772
4082
  )
@@ -3781,13 +4091,13 @@ var Thread = ({
3781
4091
  ) });
3782
4092
  };
3783
4093
  var ThreadScrollToBottom = () => {
3784
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react28.ThreadPrimitive.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4094
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react30.ThreadPrimitive.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3785
4095
  TooltipIconButton,
3786
4096
  {
3787
4097
  tooltip: "Scroll to bottom",
3788
4098
  variant: "secondary",
3789
4099
  className: "aui-thread-scroll-to-bottom absolute -top-12 z-10 self-center disabled:invisible",
3790
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react8.ArrowDownIcon, { className: "size-4" })
4100
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react8.ArrowDownIcon, { className: "size-4" })
3791
4101
  }
3792
4102
  ) });
3793
4103
  };
@@ -3819,14 +4129,14 @@ var ThreadWelcome = ({
3819
4129
  suggestions,
3820
4130
  Suggestions: SuggestionsSlot = Suggestions
3821
4131
  }) => {
3822
- const isEmpty = (0, import_react28.useThread)((s) => s.messages.length === 0);
4132
+ const isEmpty = (0, import_react30.useThread)((s) => s.messages.length === 0);
3823
4133
  const isPanel = useThreadVariant() === "panel";
3824
4134
  if (!isEmpty) return null;
3825
4135
  const defaultHeading = isPanel ? "Ask about this page" : "How can I help you today?";
3826
4136
  const defaultSubheading = isPanel ? "The assistant can use dashboard context from your app." : "Send a message to start a conversation.";
3827
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "aui-thread-welcome-root mx-auto my-auto flex w-full max-w-(--thread-max-width) grow flex-col", children: [
3828
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "aui-thread-welcome-center flex w-full grow flex-col items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3829
- import_react29.motion.div,
4137
+ 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: [
4138
+ /* @__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)(
4139
+ import_react31.motion.div,
3830
4140
  {
3831
4141
  className: cn(
3832
4142
  "aui-thread-welcome-message flex flex-col items-center justify-center text-center",
@@ -3836,9 +4146,9 @@ var ThreadWelcome = ({
3836
4146
  initial: "initial",
3837
4147
  animate: "animate",
3838
4148
  children: [
3839
- config?.icon && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react29.motion.div, { variants: welcomeIcon, className: isPanel ? "mb-3" : "mb-5", children: config.icon }),
3840
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3841
- import_react29.motion.h1,
4149
+ config?.icon && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react31.motion.div, { variants: welcomeIcon, className: isPanel ? "mb-3" : "mb-5", children: config.icon }),
4150
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4151
+ import_react31.motion.h1,
3842
4152
  {
3843
4153
  variants: welcomeItem,
3844
4154
  className: cn(
@@ -3848,8 +4158,8 @@ var ThreadWelcome = ({
3848
4158
  children: config?.heading ?? defaultHeading
3849
4159
  }
3850
4160
  ),
3851
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3852
- import_react29.motion.p,
4161
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4162
+ import_react31.motion.p,
3853
4163
  {
3854
4164
  variants: welcomeItem,
3855
4165
  className: "aui-thread-welcome-message-inner mt-1.5 text-muted-foreground text-sm",
@@ -3859,16 +4169,16 @@ var ThreadWelcome = ({
3859
4169
  ]
3860
4170
  }
3861
4171
  ) }),
3862
- suggestions && !isPanel ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "aui-thread-welcome-suggestions mx-auto w-full max-w-(--thread-max-width) px-2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(SuggestionsSlot, { suggestions }) }) : null
4172
+ suggestions && !isPanel ? /* @__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
3863
4173
  ] });
3864
4174
  };
3865
4175
  var MessageError = () => {
3866
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react28.MessagePrimitive.Error, { children: /* @__PURE__ */ (0, import_jsx_runtime28.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_runtime28.jsx)(import_react28.ErrorPrimitive.Message, { className: "aui-message-error-message line-clamp-2" }) }) });
4176
+ 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" }) }) });
3867
4177
  };
3868
4178
  var AssistantMessage = () => {
3869
4179
  const isPanel = useThreadVariant() === "panel";
3870
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3871
- import_react28.MessagePrimitive.Root,
4180
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4181
+ import_react30.MessagePrimitive.Root,
3872
4182
  {
3873
4183
  className: cn(
3874
4184
  "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",
@@ -3876,7 +4186,7 @@ var AssistantMessage = () => {
3876
4186
  ),
3877
4187
  "data-role": "assistant",
3878
4188
  children: [
3879
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4189
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3880
4190
  "div",
3881
4191
  {
3882
4192
  className: cn(
@@ -3884,8 +4194,8 @@ var AssistantMessage = () => {
3884
4194
  isPanel ? "px-1 text-sm" : "px-2"
3885
4195
  ),
3886
4196
  children: [
3887
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3888
- import_react28.MessagePrimitive.Parts,
4197
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4198
+ import_react30.MessagePrimitive.Parts,
3889
4199
  {
3890
4200
  components: {
3891
4201
  Text: MarkdownText,
@@ -3895,11 +4205,11 @@ var AssistantMessage = () => {
3895
4205
  }
3896
4206
  }
3897
4207
  ),
3898
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(MessageError, {})
4208
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(MessageError, {})
3899
4209
  ]
3900
4210
  }
3901
4211
  ),
3902
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "aui-assistant-message-footer mt-1 mb-3 ml-1 flex", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AssistantActionBar, {}) })
4212
+ /* @__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, {}) })
3903
4213
  ]
3904
4214
  }
3905
4215
  );
@@ -3912,36 +4222,36 @@ var ASSISTANT_ACTION_ICON_CLASS = cn(
3912
4222
  "[&>span:first-child]:group-hover/tbv2:bg-ghost-fill-hover"
3913
4223
  );
3914
4224
  var AssistantActionBar = () => {
3915
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3916
- import_react28.ActionBarPrimitive.Root,
4225
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4226
+ import_react30.ActionBarPrimitive.Root,
3917
4227
  {
3918
4228
  hideWhenRunning: true,
3919
4229
  autohide: "never",
3920
4230
  className: "aui-assistant-action-bar-root flex items-center gap-0 bg-transparent px-0 py-0.5 text-muted-foreground/60",
3921
4231
  children: [
3922
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react28.ActionBarPrimitive.Copy, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4232
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react30.ActionBarPrimitive.Copy, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3923
4233
  TooltipIconButton,
3924
4234
  {
3925
4235
  tooltip: "Copy",
3926
4236
  variant: "ghost",
3927
4237
  className: ASSISTANT_ACTION_ICON_CLASS,
3928
4238
  children: [
3929
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react28.AuiIf, { condition: (s) => s.message.isCopied, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react8.CheckIcon, { className: "size-3" }) }),
3930
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react28.AuiIf, { condition: (s) => !s.message.isCopied, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react8.CopyIcon, { className: "size-3" }) })
4239
+ /* @__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" }) }),
4240
+ /* @__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" }) })
3931
4241
  ]
3932
4242
  }
3933
4243
  ) }),
3934
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react28.ActionBarPrimitive.Reload, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4244
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react30.ActionBarPrimitive.Reload, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3935
4245
  TooltipIconButton,
3936
4246
  {
3937
4247
  tooltip: "Regenerate",
3938
4248
  variant: "ghost",
3939
4249
  className: ASSISTANT_ACTION_ICON_CLASS,
3940
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react8.RefreshCwIcon, { className: "size-3" })
4250
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react8.RefreshCwIcon, { className: "size-3" })
3941
4251
  }
3942
4252
  ) }),
3943
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_react28.ActionBarMorePrimitive.Root, { children: [
3944
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react28.ActionBarMorePrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4253
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_react30.ActionBarMorePrimitive.Root, { children: [
4254
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react30.ActionBarMorePrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3945
4255
  TooltipIconButton,
3946
4256
  {
3947
4257
  tooltip: "More",
@@ -3950,17 +4260,17 @@ var AssistantActionBar = () => {
3950
4260
  ASSISTANT_ACTION_ICON_CLASS,
3951
4261
  "data-[state=open]:text-muted-foreground/80"
3952
4262
  ),
3953
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react8.MoreHorizontalIcon, { className: "size-3" })
4263
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react8.MoreHorizontalIcon, { className: "size-3" })
3954
4264
  }
3955
4265
  ) }),
3956
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3957
- import_react28.ActionBarMorePrimitive.Content,
4266
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4267
+ import_react30.ActionBarMorePrimitive.Content,
3958
4268
  {
3959
4269
  side: "bottom",
3960
4270
  align: "start",
3961
4271
  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",
3962
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react28.ActionBarPrimitive.ExportMarkdown, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime28.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: [
3963
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react8.DownloadIcon, { className: "size-4 shrink-0" }),
4272
+ 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: [
4273
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react8.DownloadIcon, { className: "size-4 shrink-0" }),
3964
4274
  "Export as Markdown"
3965
4275
  ] }) })
3966
4276
  }
@@ -3971,12 +4281,12 @@ var AssistantActionBar = () => {
3971
4281
  );
3972
4282
  };
3973
4283
  var UserMessageText = () => {
3974
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "whitespace-pre-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react28.MessagePartPrimitive.Text, { smooth: false }) });
4284
+ 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 }) });
3975
4285
  };
3976
4286
  var UserMessage = () => {
3977
4287
  const isPanel = useThreadVariant() === "panel";
3978
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3979
- import_react28.MessagePrimitive.Root,
4288
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4289
+ import_react30.MessagePrimitive.Root,
3980
4290
  {
3981
4291
  className: cn(
3982
4292
  "aui-user-message-root mx-auto flex w-full max-w-(--thread-max-width) flex-col items-end gap-2",
@@ -3984,9 +4294,9 @@ var UserMessage = () => {
3984
4294
  ),
3985
4295
  "data-role": "user",
3986
4296
  children: [
3987
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(UserMessageAttachments, {}),
3988
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3989
- import_react29.motion.div,
4297
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(UserMessageAttachments, {}),
4298
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4299
+ import_react31.motion.div,
3990
4300
  {
3991
4301
  className: cn(
3992
4302
  "aui-user-message-content relative inline-block max-w-[85%] rounded-2xl bg-bubble-user text-bubble-user-foreground",
@@ -3996,8 +4306,8 @@ var UserMessage = () => {
3996
4306
  animate: { opacity: 1, y: 0, scale: 1 },
3997
4307
  transition: { duration: 0.65, ease: luxuryEase },
3998
4308
  children: [
3999
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react28.MessagePrimitive.Parts, { components: { Text: UserMessageText } }),
4000
- /* @__PURE__ */ (0, import_jsx_runtime28.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_runtime28.jsx)(UserActionBar, {}) })
4309
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react30.MessagePrimitive.Parts, { components: { Text: UserMessageText } }),
4310
+ /* @__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, {}) })
4001
4311
  ]
4002
4312
  }
4003
4313
  )
@@ -4006,42 +4316,42 @@ var UserMessage = () => {
4006
4316
  );
4007
4317
  };
4008
4318
  var UserActionBar = () => {
4009
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4010
- import_react28.ActionBarPrimitive.Root,
4319
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4320
+ import_react30.ActionBarPrimitive.Root,
4011
4321
  {
4012
4322
  hideWhenRunning: true,
4013
4323
  autohide: "always",
4014
4324
  className: "aui-user-action-bar-root flex flex-col items-end",
4015
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react28.ActionBarPrimitive.Edit, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4325
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react30.ActionBarPrimitive.Edit, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4016
4326
  TooltipIconButton,
4017
4327
  {
4018
4328
  tooltip: "Edit",
4019
4329
  variant: "ghost",
4020
4330
  className: ASSISTANT_ACTION_ICON_CLASS,
4021
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react8.PencilIcon, { className: "size-3" })
4331
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react8.PencilIcon, { className: "size-3" })
4022
4332
  }
4023
4333
  ) })
4024
4334
  }
4025
4335
  );
4026
4336
  };
4027
4337
  var EditComposer = () => {
4028
- return /* @__PURE__ */ (0, import_jsx_runtime28.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_runtime28.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: [
4029
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4030
- import_react28.ComposerPrimitive.Input,
4338
+ 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: [
4339
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4340
+ import_react30.ComposerPrimitive.Input,
4031
4341
  {
4032
4342
  className: "aui-edit-composer-input min-h-14 w-full resize-none bg-transparent p-4 text-foreground text-sm outline-none",
4033
4343
  autoFocus: true
4034
4344
  }
4035
4345
  ),
4036
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "aui-edit-composer-footer mx-3 mb-3 flex items-center gap-2 self-end", children: [
4037
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react28.ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TimbalV2Button, { variant: "ghost", size: "sm", children: "Cancel" }) }),
4038
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react28.ComposerPrimitive.Send, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TimbalV2Button, { variant: "primary", size: "sm", children: "Update" }) })
4346
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "aui-edit-composer-footer mx-3 mb-3 flex items-center gap-2 self-end", children: [
4347
+ /* @__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" }) }),
4348
+ /* @__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" }) })
4039
4349
  ] })
4040
4350
  ] }) });
4041
4351
  };
4042
4352
 
4043
4353
  // src/chat/chat.tsx
4044
- var import_jsx_runtime29 = require("react/jsx-runtime");
4354
+ var import_jsx_runtime30 = require("react/jsx-runtime");
4045
4355
  function TimbalChat({
4046
4356
  workforceId,
4047
4357
  baseUrl,
@@ -4052,7 +4362,7 @@ function TimbalChat({
4052
4362
  debug,
4053
4363
  ...threadProps
4054
4364
  }) {
4055
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4365
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4056
4366
  TimbalRuntimeProvider,
4057
4367
  {
4058
4368
  workforceId,
@@ -4062,14 +4372,14 @@ function TimbalChat({
4062
4372
  attachmentsUploadUrl,
4063
4373
  attachmentsAccept,
4064
4374
  debug,
4065
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Thread, { ...threadProps })
4375
+ children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Thread, { ...threadProps })
4066
4376
  }
4067
4377
  );
4068
4378
  }
4069
4379
 
4070
4380
  // src/chat/workforce-selector.tsx
4071
4381
  var import_lucide_react9 = require("lucide-react");
4072
- var import_jsx_runtime30 = require("react/jsx-runtime");
4382
+ var import_jsx_runtime31 = require("react/jsx-runtime");
4073
4383
  var WorkforceSelector = ({
4074
4384
  workforces,
4075
4385
  value,
@@ -4080,7 +4390,7 @@ var WorkforceSelector = ({
4080
4390
  }) => {
4081
4391
  if (workforces.length === 0) return null;
4082
4392
  if (hideWhenSingle && workforces.length === 1) return null;
4083
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
4393
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
4084
4394
  "div",
4085
4395
  {
4086
4396
  className: cn(
@@ -4091,7 +4401,7 @@ var WorkforceSelector = ({
4091
4401
  className
4092
4402
  ),
4093
4403
  children: [
4094
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
4404
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
4095
4405
  "select",
4096
4406
  {
4097
4407
  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",
@@ -4099,15 +4409,15 @@ var WorkforceSelector = ({
4099
4409
  onChange: (e) => onChange(e.target.value),
4100
4410
  "aria-label": placeholder,
4101
4411
  children: [
4102
- !value && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "", children: placeholder }),
4412
+ !value && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: "", children: placeholder }),
4103
4413
  workforces.map((w) => {
4104
4414
  const id = idOf(w);
4105
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: id, children: w.name ?? id }, id);
4415
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: id, children: w.name ?? id }, id);
4106
4416
  })
4107
4417
  ]
4108
4418
  }
4109
4419
  ),
4110
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4420
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4111
4421
  import_lucide_react9.ChevronDownIcon,
4112
4422
  {
4113
4423
  className: "aui-workforce-selector-icon pointer-events-none absolute right-3 size-3.5 text-muted-foreground/70",