@timbal-ai/timbal-react 1.1.0 → 1.2.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 (42) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/README.md +13 -7
  3. package/dist/app.cjs +1234 -867
  4. package/dist/app.d.cts +2 -2
  5. package/dist/app.d.ts +2 -2
  6. package/dist/app.esm.js +14 -6
  7. package/dist/{chart-artifact-CX-rh9nq.d.cts → chart-artifact-E58ve76I.d.cts} +29 -3
  8. package/dist/{chart-artifact-BZp7nmaf.d.ts → chart-artifact-_PEJgCpQ.d.ts} +29 -3
  9. package/dist/{chat-DCms8pJ_.d.cts → chat-ClmzWzCX.d.cts} +2 -0
  10. package/dist/{chat-DCms8pJ_.d.ts → chat-ClmzWzCX.d.ts} +2 -0
  11. package/dist/chat.cjs +868 -511
  12. package/dist/chat.d.cts +1 -1
  13. package/dist/chat.d.ts +1 -1
  14. package/dist/chat.esm.js +3 -3
  15. package/dist/{chunk-6HWMJNZT.esm.js → chunk-4VULP3CJ.esm.js} +1 -1
  16. package/dist/{chunk-XCM3V6RK.esm.js → chunk-AGJKK6R7.esm.js} +2 -2
  17. package/dist/{chunk-4AKJ6FKE.esm.js → chunk-BMXFXLVV.esm.js} +120 -22
  18. package/dist/{chunk-JEAUF54A.esm.js → chunk-FEYZUVBM.esm.js} +1 -1
  19. package/dist/{chunk-FRZOEYBO.esm.js → chunk-MTYXREHK.esm.js} +4 -4
  20. package/dist/{chunk-P3KDAYX6.esm.js → chunk-NAMKO2MU.esm.js} +1 -1
  21. package/dist/{chunk-YXZ22OJN.esm.js → chunk-UY7AKWJL.esm.js} +670 -402
  22. package/dist/{chunk-TK2AGIME.esm.js → chunk-XDIY2WSL.esm.js} +15 -13
  23. package/dist/index.cjs +1871 -1497
  24. package/dist/index.d.cts +5 -5
  25. package/dist/index.d.ts +5 -5
  26. package/dist/index.esm.js +21 -9
  27. package/dist/{pill-segmented-tabs-Ba5q0feL.d.cts → pill-segmented-tabs-BsIOW1Lo.d.cts} +32 -4
  28. package/dist/{pill-segmented-tabs-Ba5q0feL.d.ts → pill-segmented-tabs-BsIOW1Lo.d.ts} +32 -4
  29. package/dist/studio.cjs +1089 -732
  30. package/dist/studio.d.cts +2 -2
  31. package/dist/studio.d.ts +2 -2
  32. package/dist/studio.esm.js +5 -5
  33. package/dist/styles.css +14 -16
  34. package/dist/ui.cjs +122 -22
  35. package/dist/ui.d.cts +1 -1
  36. package/dist/ui.d.ts +1 -1
  37. package/dist/ui.esm.js +8 -4
  38. package/dist/{welcome-CRqOPKMp.d.cts → welcome-BFGRoNfK.d.cts} +1 -1
  39. package/dist/{welcome-DlHUa3OL.d.ts → welcome-DXqsGTwH.d.ts} +1 -1
  40. package/package.json +1 -1
  41. package/vite/local-dev.d.ts +5 -1
  42. package/vite/local-dev.mjs +17 -13
package/dist/studio.cjs CHANGED
@@ -898,10 +898,10 @@ function findParentIdFromAuiParent(messages, auiParentId) {
898
898
  }
899
899
 
900
900
  // src/chat/thread.tsx
901
- var import_react27 = require("react");
902
- var import_react28 = require("@assistant-ui/react");
901
+ var import_react30 = require("react");
902
+ var import_react31 = require("@assistant-ui/react");
903
903
  var import_lucide_react8 = require("lucide-react");
904
- var import_react29 = require("motion/react");
904
+ var import_react32 = require("motion/react");
905
905
 
906
906
  // src/chat/attachment.tsx
907
907
  var import_react5 = require("react");
@@ -1058,6 +1058,33 @@ var TIMBAL_V2_SHADOW = {
1058
1058
  ghost: "",
1059
1059
  link: ""
1060
1060
  };
1061
+ var TIMBAL_V2_PRIMARY_SURFACE = cn(
1062
+ TIMBAL_V2_PRIMARY_GRADIENT,
1063
+ TIMBAL_V2_SHADOW.primary,
1064
+ TIMBAL_V2_BORDER.primary
1065
+ );
1066
+ var TIMBAL_V2_PRIMARY_PILL_ROOT = cn(
1067
+ "relative box-border inline-flex items-center justify-center overflow-hidden rounded-full border-0 bg-transparent p-0 font-normal shadow-none transition duration-200 ease-in-out",
1068
+ TIMBAL_V2_SHADOW.primary,
1069
+ TIMBAL_V2_BORDER.primary
1070
+ );
1071
+ var TIMBAL_V2_PRIMARY_PILL_FILL_LAYER = cn(
1072
+ "pointer-events-none absolute inset-0 transition duration-200 ease-in-out",
1073
+ "bg-gradient-to-b from-primary-fill-from to-primary-fill-to",
1074
+ "group-hover/avatar:from-primary-fill-hover-from group-hover/avatar:to-primary-fill-hover-to",
1075
+ "group-active/avatar:from-primary-fill-active-from group-active/avatar:to-primary-fill-active-to"
1076
+ );
1077
+ var TIMBAL_V2_SECONDARY_PILL_ROOT = cn(
1078
+ "relative box-border inline-flex items-center justify-center overflow-hidden rounded-full bg-transparent p-0 font-normal shadow-none transition duration-200 ease-in-out",
1079
+ TIMBAL_V2_SHADOW.secondary,
1080
+ TIMBAL_V2_BORDER.secondary
1081
+ );
1082
+ var TIMBAL_V2_SECONDARY_PILL_FILL_LAYER = cn(
1083
+ "pointer-events-none absolute inset-0 transition duration-200 ease-in-out",
1084
+ TIMBAL_V2_ELEVATED_GRADIENT,
1085
+ "group-hover/avatar:from-secondary-fill-hover-from group-hover/avatar:to-secondary-fill-hover-to",
1086
+ "group-active/avatar:from-secondary-fill-active-from group-active/avatar:to-secondary-fill-active-to"
1087
+ );
1061
1088
  var TIMBAL_V2_SWITCH_TRACK_OFF = cn(
1062
1089
  TIMBAL_V2_ELEVATED_GRADIENT,
1063
1090
  "border border-border shadow-card"
@@ -1167,25 +1194,71 @@ function DialogTitle({
1167
1194
  }
1168
1195
 
1169
1196
  // src/ui/avatar.tsx
1197
+ var React = __toESM(require("react"), 1);
1170
1198
  var import_radix_ui3 = require("radix-ui");
1171
1199
  var import_jsx_runtime5 = require("react/jsx-runtime");
1200
+ var AVATAR_PRIMARY_FALLBACK_CLASS = cn(
1201
+ TIMBAL_V2_SECONDARY_PILL_ROOT,
1202
+ TIMBAL_V2_LABEL.secondary,
1203
+ "font-medium"
1204
+ );
1205
+ var AVATAR_SECONDARY_FILL_STYLE = {
1206
+ backgroundImage: "linear-gradient(to bottom, var(--elevated-from), var(--elevated-to))"
1207
+ };
1208
+ var AvatarChromeContext = React.createContext(
1209
+ null
1210
+ );
1211
+ function useAvatarChrome() {
1212
+ return React.useContext(AvatarChromeContext);
1213
+ }
1214
+ function isBrandedVariant(variant) {
1215
+ return variant === "secondary" || variant === "primary" || variant === "chart";
1216
+ }
1217
+ var AVATAR_SIZE_CLASS = {
1218
+ default: "size-8",
1219
+ sm: "size-6",
1220
+ lg: "size-10"
1221
+ };
1172
1222
  function Avatar({
1173
1223
  className,
1174
1224
  size = "default",
1225
+ variant: rootVariant,
1226
+ children,
1175
1227
  ...props
1176
1228
  }) {
1177
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1229
+ const [chrome, setChrome] = React.useState(rootVariant ?? "muted");
1230
+ React.useLayoutEffect(() => {
1231
+ if (rootVariant !== void 0) {
1232
+ setChrome(rootVariant);
1233
+ }
1234
+ }, [rootVariant]);
1235
+ const branded = isBrandedVariant(chrome);
1236
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AvatarChromeContext.Provider, { value: { chrome, setChrome }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1178
1237
  import_radix_ui3.Avatar.Root,
1179
1238
  {
1180
1239
  "data-slot": "avatar",
1181
1240
  "data-size": size,
1241
+ "data-variant": branded ? "secondary" : chrome,
1182
1242
  className: cn(
1183
- "group/avatar relative flex size-8 shrink-0 overflow-hidden rounded-full select-none data-[size=lg]:size-10 data-[size=sm]:size-6",
1243
+ "group/avatar relative shrink-0 select-none",
1244
+ AVATAR_SIZE_CLASS[size],
1245
+ branded ? TIMBAL_V2_SECONDARY_PILL_ROOT : "flex overflow-hidden rounded-full",
1184
1246
  className
1185
1247
  ),
1186
- ...props
1248
+ ...props,
1249
+ children: [
1250
+ branded ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1251
+ "span",
1252
+ {
1253
+ "aria-hidden": true,
1254
+ className: TIMBAL_V2_SECONDARY_PILL_FILL_LAYER,
1255
+ style: AVATAR_SECONDARY_FILL_STYLE
1256
+ }
1257
+ ) : null,
1258
+ children
1259
+ ]
1187
1260
  }
1188
- );
1261
+ ) });
1189
1262
  }
1190
1263
  function AvatarImage({
1191
1264
  className,
@@ -1195,24 +1268,44 @@ function AvatarImage({
1195
1268
  import_radix_ui3.Avatar.Image,
1196
1269
  {
1197
1270
  "data-slot": "avatar-image",
1198
- className: cn("aspect-square size-full", className),
1271
+ className: cn(
1272
+ "relative z-10 aspect-square size-full rounded-full object-cover",
1273
+ className
1274
+ ),
1199
1275
  ...props
1200
1276
  }
1201
1277
  );
1202
1278
  }
1203
1279
  function AvatarFallback({
1204
1280
  className,
1281
+ variant = "muted",
1282
+ seed: _seed,
1283
+ children,
1284
+ style,
1205
1285
  ...props
1206
1286
  }) {
1287
+ const chromeCtx = useAvatarChrome();
1288
+ React.useLayoutEffect(() => {
1289
+ chromeCtx?.setChrome(variant);
1290
+ }, [chromeCtx, variant]);
1291
+ const branded = isBrandedVariant(variant);
1207
1292
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1208
1293
  import_radix_ui3.Avatar.Fallback,
1209
1294
  {
1210
1295
  "data-slot": "avatar-fallback",
1296
+ "data-variant": branded ? "secondary" : variant,
1211
1297
  className: cn(
1212
- "bg-muted text-muted-foreground flex size-full items-center justify-center rounded-full text-sm group-data-[size=sm]/avatar:text-xs",
1298
+ "relative z-10 flex size-full items-center justify-center rounded-full",
1299
+ branded ? cn(
1300
+ "bg-transparent font-medium",
1301
+ TIMBAL_V2_LABEL.secondary,
1302
+ "text-sm group-data-[size=sm]/avatar:text-xs"
1303
+ ) : "bg-muted font-normal text-muted-foreground text-sm group-data-[size=sm]/avatar:text-xs",
1213
1304
  className
1214
1305
  ),
1215
- ...props
1306
+ style,
1307
+ ...props,
1308
+ children
1216
1309
  }
1217
1310
  );
1218
1311
  }
@@ -1221,7 +1314,7 @@ function AvatarFallback({
1221
1314
  var import_react4 = require("react");
1222
1315
 
1223
1316
  // src/ui/timbal-v2-button.tsx
1224
- var React = __toESM(require("react"), 1);
1317
+ var React2 = __toESM(require("react"), 1);
1225
1318
  var import_radix_ui4 = require("radix-ui");
1226
1319
  var import_jsx_runtime6 = require("react/jsx-runtime");
1227
1320
  var TIMBAL_V2_FILL_AS_CHILD = {
@@ -1257,7 +1350,7 @@ var TIMBAL_V2_LABEL_AS_CHILD = {
1257
1350
  ...TIMBAL_V2_LABEL,
1258
1351
  link: "text-foreground underline decoration-foreground/25 underline-offset-2 hover:decoration-foreground/45"
1259
1352
  };
1260
- var TimbalV2Button = React.forwardRef(function TimbalV2Button2({
1353
+ var TimbalV2Button = React2.forwardRef(function TimbalV2Button2({
1261
1354
  variant = "secondary",
1262
1355
  size = "sm",
1263
1356
  isIconOnly = false,
@@ -1522,31 +1615,32 @@ var import_react_markdown = require("@assistant-ui/react-markdown");
1522
1615
  var import_remark_gfm = __toESM(require("remark-gfm"), 1);
1523
1616
  var import_remark_math = __toESM(require("remark-math"), 1);
1524
1617
  var import_rehype_katex = __toESM(require("rehype-katex"), 1);
1525
- var import_react17 = require("react");
1618
+ var import_react20 = require("react");
1526
1619
  var import_lucide_react4 = require("lucide-react");
1527
1620
 
1528
1621
  // src/chat/syntax-highlighter.tsx
1529
- var import_react16 = require("react");
1622
+ var import_react19 = require("react");
1530
1623
  var import_core = require("shiki/core");
1531
1624
  var import_javascript = require("shiki/engine/javascript");
1532
1625
 
1533
1626
  // src/artifacts/registry.tsx
1534
- var import_react15 = require("react");
1627
+ var import_react18 = require("react");
1535
1628
 
1536
1629
  // src/artifacts/chart-artifact.tsx
1537
- var import_react7 = require("react");
1630
+ var import_react10 = require("react");
1538
1631
 
1539
1632
  // src/charts/line-area-chart.tsx
1633
+ var import_react7 = require("react");
1540
1634
  var import_recharts = require("recharts");
1541
1635
 
1542
1636
  // src/ui/chart.tsx
1543
- var React2 = __toESM(require("react"), 1);
1637
+ var React3 = __toESM(require("react"), 1);
1544
1638
  var RechartsPrimitive = __toESM(require("recharts"), 1);
1545
1639
  var import_jsx_runtime9 = require("react/jsx-runtime");
1546
1640
  var THEMES = { light: "", dark: ".dark" };
1547
- var ChartContext = React2.createContext(null);
1641
+ var ChartContext = React3.createContext(null);
1548
1642
  function useChart() {
1549
- const context = React2.useContext(ChartContext);
1643
+ const context = React3.useContext(ChartContext);
1550
1644
  if (!context) {
1551
1645
  throw new Error("useChart must be used within a <ChartContainer />");
1552
1646
  }
@@ -1559,7 +1653,7 @@ function ChartContainer({
1559
1653
  config,
1560
1654
  ...props
1561
1655
  }) {
1562
- const uniqueId = React2.useId();
1656
+ const uniqueId = React3.useId();
1563
1657
  const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
1564
1658
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChartContext.Provider, { value: { config }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1565
1659
  "div",
@@ -1620,7 +1714,7 @@ function ChartTooltipContent({
1620
1714
  labelKey
1621
1715
  }) {
1622
1716
  const { config } = useChart();
1623
- const tooltipLabel = React2.useMemo(() => {
1717
+ const tooltipLabel = React3.useMemo(() => {
1624
1718
  if (hideLabel || !payload?.length) {
1625
1719
  return null;
1626
1720
  }
@@ -1731,7 +1825,7 @@ function ChartLegendContent({
1731
1825
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1732
1826
  "div",
1733
1827
  {
1734
- className: "[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3",
1828
+ className: "[&>svg]:text-muted-foreground flex min-w-0 max-w-[8rem] items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3",
1735
1829
  children: [
1736
1830
  itemConfig?.icon && !hideIcon ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(itemConfig.icon, {}) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1737
1831
  "div",
@@ -1740,7 +1834,7 @@ function ChartLegendContent({
1740
1834
  style: { backgroundColor: item.color }
1741
1835
  }
1742
1836
  ),
1743
- itemConfig?.label
1837
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "min-w-0 truncate", children: itemConfig?.label ?? (item.value != null ? String(item.value) : null) })
1744
1838
  ]
1745
1839
  },
1746
1840
  `${item.value ?? index}`
@@ -1763,6 +1857,83 @@ function getPayloadConfigFromPayload(config, payload, key) {
1763
1857
  return configLabelKey in config ? config[configLabelKey] : config[key];
1764
1858
  }
1765
1859
 
1860
+ // src/charts/chart-gradient-utils.ts
1861
+ function barGradientId(scopeId, dataKey) {
1862
+ return `bar-${scopeId}-${sanitizeId(dataKey)}`;
1863
+ }
1864
+ function pieGradientId(scopeId, key) {
1865
+ return `pie-${scopeId}-${sanitizeId(key)}`;
1866
+ }
1867
+ function sanitizeId(key) {
1868
+ return key.replace(/[^a-zA-Z0-9_-]/g, "_");
1869
+ }
1870
+ function truncateLabel(text, maxChars = 14) {
1871
+ const s = String(text ?? "");
1872
+ if (s.length <= maxChars) return s;
1873
+ if (maxChars <= 1) return "\u2026";
1874
+ return `${s.slice(0, maxChars - 1)}\u2026`;
1875
+ }
1876
+ function estimateYAxisWidth(labels, { min = 48, max = 112, charWidth = 6.5 } = {}) {
1877
+ if (labels.length === 0) return min;
1878
+ const longest = labels.reduce((a, b) => a.length >= b.length ? a : b, "");
1879
+ return Math.min(max, Math.max(min, Math.ceil(longest.length * charWidth) + 12));
1880
+ }
1881
+
1882
+ // src/charts/chart-axis-tick.tsx
1883
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1884
+ var ChartAxisTick = ({
1885
+ x = 0,
1886
+ y = 0,
1887
+ payload,
1888
+ textAnchor = "end",
1889
+ maxChars = 14,
1890
+ clipTicks = true
1891
+ }) => {
1892
+ const raw = String(payload?.value ?? "");
1893
+ const label = clipTicks ? truncateLabel(raw, maxChars) : raw;
1894
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("g", { transform: `translate(${x},${y})`, children: [
1895
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("title", { children: raw }),
1896
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1897
+ "text",
1898
+ {
1899
+ textAnchor,
1900
+ fill: "currentColor",
1901
+ className: "fill-muted-foreground",
1902
+ dominantBaseline: "middle",
1903
+ children: label
1904
+ }
1905
+ )
1906
+ ] });
1907
+ };
1908
+
1909
+ // src/charts/chart-gradients.tsx
1910
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1911
+ var BarGradientDefs = ({
1912
+ scopeId,
1913
+ dataKeys,
1914
+ horizontal
1915
+ }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("defs", { children: dataKeys.map((dataKey) => {
1916
+ const id = barGradientId(scopeId, dataKey);
1917
+ const color = `var(--color-${dataKey})`;
1918
+ if (horizontal) {
1919
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("linearGradient", { id, x1: "0", y1: "0", x2: "1", y2: "0", children: [
1920
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("stop", { offset: "0%", stopColor: color, stopOpacity: 1 }),
1921
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("stop", { offset: "100%", stopColor: color, stopOpacity: 0.55 })
1922
+ ] }, dataKey);
1923
+ }
1924
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("linearGradient", { id, x1: "0", y1: "0", x2: "0", y2: "1", children: [
1925
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("stop", { offset: "0%", stopColor: color, stopOpacity: 1 }),
1926
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("stop", { offset: "100%", stopColor: color, stopOpacity: 0.55 })
1927
+ ] }, dataKey);
1928
+ }) });
1929
+ var PieGradientDefs = ({ scopeId, slices }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("defs", { children: slices.map(({ key, color }) => {
1930
+ const id = pieGradientId(scopeId, key);
1931
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("linearGradient", { id, x1: "0", y1: "0", x2: "1", y2: "1", children: [
1932
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("stop", { offset: "0%", stopColor: color, stopOpacity: 1 }),
1933
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("stop", { offset: "100%", stopColor: color, stopOpacity: 0.65 })
1934
+ ] }, key);
1935
+ }) });
1936
+
1766
1937
  // src/charts/geometry.ts
1767
1938
  function toNum(value) {
1768
1939
  const n = typeof value === "number" ? value : Number(value);
@@ -1780,15 +1951,52 @@ function formatCompact(value, unit) {
1780
1951
  return unit ? `${s}${unit}` : s;
1781
1952
  }
1782
1953
 
1954
+ // src/charts/line-area-chart-utils.ts
1955
+ function resolveChartMargin(options) {
1956
+ const { flush, showXAxis, showYAxis } = options;
1957
+ if (!flush) {
1958
+ return { top: 8, right: 12, bottom: 0, left: 0 };
1959
+ }
1960
+ const anyAxis = showXAxis || showYAxis;
1961
+ if (!anyAxis) {
1962
+ return { top: 8, right: 12, bottom: 8, left: 12 };
1963
+ }
1964
+ return {
1965
+ top: 8,
1966
+ right: 12,
1967
+ bottom: showXAxis ? 24 : 8,
1968
+ left: showYAxis ? 8 : 12
1969
+ };
1970
+ }
1971
+ function flushBarCategoryGap(flush, showCategoryAxis) {
1972
+ return flush && showCategoryAxis ? "0%" : void 0;
1973
+ }
1974
+ function flushLineAreaEdgeToEdge(flush, variant, showXAxis, showYAxis) {
1975
+ return flush && (variant === "line" || variant === "area") && showXAxis && !showYAxis;
1976
+ }
1977
+ function resolveTooltipCategory(label, payload, xKey, data, formatX) {
1978
+ const row = payload?.[0]?.payload;
1979
+ if (row && xKey in row) {
1980
+ const idx = data.indexOf(row);
1981
+ return formatX(row[xKey], idx >= 0 ? idx : 0);
1982
+ }
1983
+ if (label != null && label !== "") {
1984
+ const idx = typeof label === "number" ? label : data.findIndex((r) => r[xKey] === label || String(r[xKey]) === String(label));
1985
+ return formatX(label, idx >= 0 ? idx : 0);
1986
+ }
1987
+ return "";
1988
+ }
1989
+
1783
1990
  // src/charts/line-area-chart.tsx
1784
- var import_jsx_runtime10 = require("react/jsx-runtime");
1991
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1992
+ var INDEX_X_KEY = "__index";
1785
1993
  var CHART_PALETTE = [
1786
- "var(--chart-1, #6366f1)",
1787
- "var(--chart-2, #10b981)",
1788
- "var(--chart-3, #f59e0b)",
1789
- "var(--chart-4, #a855f7)",
1790
- "var(--chart-5, #ef4444)",
1791
- "var(--chart-6, #06b6d4)"
1994
+ "var(--chart-1, #4f46e5)",
1995
+ "var(--chart-2, #3b82f6)",
1996
+ "var(--chart-3, #0ea5e9)",
1997
+ "var(--chart-4, #6366f1)",
1998
+ "var(--chart-5, #60a5fa)",
1999
+ "var(--chart-6, #2563eb)"
1792
2000
  ];
1793
2001
  var LineAreaChart = ({
1794
2002
  data = [],
@@ -1813,9 +2021,11 @@ var LineAreaChart = ({
1813
2021
  tooltipIndicator = "dot",
1814
2022
  formatValue,
1815
2023
  formatX,
2024
+ clipTicks = true,
1816
2025
  className,
1817
2026
  ariaLabel = "Chart"
1818
2027
  }) => {
2028
+ const gradientScopeId = (0, import_react7.useId)().replace(/:/g, "");
1819
2029
  const xKey = xKeyProp ?? inferXKey(data);
1820
2030
  const series = resolveSeries(seriesProp, data, xKey);
1821
2031
  const flush = layout === "flush";
@@ -1825,7 +2035,7 @@ var LineAreaChart = ({
1825
2035
  const showLegend = showLegendProp ?? (!flush && series.length > 1);
1826
2036
  const grid = gridLines ?? (horizontal ? "vertical" : "horizontal");
1827
2037
  if (data.length === 0 || series.length === 0) {
1828
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ChartEmpty, { className, height, ariaLabel });
2038
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChartEmpty, { className, height, ariaLabel });
1829
2039
  }
1830
2040
  const config = {};
1831
2041
  series.forEach((s, i) => {
@@ -1836,25 +2046,52 @@ var LineAreaChart = ({
1836
2046
  });
1837
2047
  const valueFmt = (v) => formatValue ? formatValue(toNum(v)) : formatCompact(toNum(v), unit);
1838
2048
  const xFmt = (v, i) => formatX ? formatX(v, i) : String(v ?? "");
1839
- const margin = flush ? { top: 8, right: 4, bottom: 0, left: 0 } : { top: 8, right: 12, bottom: 0, left: 0 };
2049
+ const margin = resolveChartMargin({ flush, showXAxis, showYAxis });
2050
+ const flushCategoryXAxisProps = flush && showXAxis && flushLineAreaEdgeToEdge(flush, variant, showXAxis, showYAxis) ? { scale: "point", padding: "no-gap", interval: 0 } : flush && showXAxis && variant === "bar" ? { interval: 0 } : {};
2051
+ const useIndexX = flushLineAreaEdgeToEdge(flush, variant, showXAxis, showYAxis);
2052
+ const chartData = useIndexX ? data.map((row, i) => ({ ...row, [INDEX_X_KEY]: i })) : data;
2053
+ const chartXKey = useIndexX ? INDEX_X_KEY : xKey;
2054
+ const categoryTick = (textAnchor) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChartAxisTick, { textAnchor, clipTicks });
1840
2055
  const showVGrid = showGrid && (grid === "vertical" || grid === "both");
1841
2056
  const showHGrid = showGrid && (grid === "horizontal" || grid === "both");
1842
- const tooltipEl = showTooltip ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2057
+ const tooltipEl = showTooltip ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1843
2058
  ChartTooltip,
1844
2059
  {
1845
2060
  cursor: variant === "bar",
1846
- content: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ChartTooltipContent, { indicator: tooltipIndicator })
2061
+ content: ({ active, payload, label }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2062
+ ChartTooltipContent,
2063
+ {
2064
+ active,
2065
+ payload,
2066
+ label,
2067
+ indicator: tooltipIndicator,
2068
+ labelFormatter: (_value, items) => {
2069
+ const category = resolveTooltipCategory(label, items, xKey, data, xFmt);
2070
+ return category || null;
2071
+ },
2072
+ formatter: (value, name, item) => {
2073
+ const key = String(item.dataKey ?? name ?? "value");
2074
+ const seriesLabel = config[key]?.label ?? name;
2075
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-1 items-center justify-between leading-none", children: [
2076
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-muted-foreground", children: seriesLabel }),
2077
+ value != null ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-foreground font-mono font-medium tabular-nums", children: valueFmt(value) }) : null
2078
+ ] });
2079
+ }
2080
+ }
2081
+ )
1847
2082
  }
1848
2083
  ) : null;
1849
- const legendEl = showLegend ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ChartLegend, { content: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ChartLegendContent, {}) }) : null;
1850
- const gridEl = showGrid && grid !== "none" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_recharts.CartesianGrid, { vertical: showVGrid, horizontal: showHGrid, strokeDasharray: "4 4" }) : null;
2084
+ const legendEl = showLegend ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChartLegend, { content: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChartLegendContent, {}) }) : null;
2085
+ const gridEl = showGrid && grid !== "none" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_recharts.CartesianGrid, { vertical: showVGrid, horizontal: showHGrid, strokeDasharray: "4 4" }) : null;
1851
2086
  const yDomain = yMax != null ? [0, yMax] : void 0;
1852
2087
  if (variant === "bar") {
1853
- const bars = series.map((s) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2088
+ const dataKeys = series.map((s) => s.dataKey);
2089
+ const barDefs = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BarGradientDefs, { scopeId: gradientScopeId, dataKeys, horizontal });
2090
+ const bars = series.map((s) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1854
2091
  import_recharts.Bar,
1855
2092
  {
1856
2093
  dataKey: s.dataKey,
1857
- fill: `var(--color-${s.dataKey})`,
2094
+ fill: `url(#${barGradientId(gradientScopeId, s.dataKey)})`,
1858
2095
  radius: barCornerRadius(barRadius, horizontal, stacked),
1859
2096
  stackId: stacked ? "stack" : void 0,
1860
2097
  isAnimationActive: true
@@ -1862,149 +2099,212 @@ var LineAreaChart = ({
1862
2099
  s.dataKey
1863
2100
  ));
1864
2101
  if (horizontal) {
1865
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ChartShell, { config, height, className, ariaLabel, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_recharts.BarChart, { accessibilityLayer: true, data, layout: "vertical", margin, children: [
1866
- gridEl,
1867
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1868
- import_recharts.XAxis,
1869
- {
1870
- type: "number",
1871
- hide: !showXAxis,
1872
- tickLine: false,
1873
- axisLine: false,
1874
- tickMargin: 8,
1875
- tickFormatter: (v) => valueFmt(v),
1876
- domain: yDomain
1877
- }
1878
- ),
1879
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1880
- import_recharts.YAxis,
1881
- {
1882
- type: "category",
1883
- dataKey: xKey,
1884
- hide: !showYAxis,
1885
- tickLine: false,
1886
- axisLine: false,
1887
- tickMargin: 8,
1888
- width: showYAxis ? void 0 : 0,
1889
- tickFormatter: (v, i) => xFmt(v, i)
1890
- }
1891
- ),
1892
- tooltipEl,
1893
- legendEl,
1894
- bars
1895
- ] }) });
1896
- }
1897
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ChartShell, { config, height, className, ariaLabel, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_recharts.BarChart, { accessibilityLayer: true, data, margin, children: [
1898
- gridEl,
1899
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1900
- import_recharts.XAxis,
1901
- {
1902
- dataKey: xKey,
1903
- hide: !showXAxis,
1904
- tickLine: false,
1905
- axisLine: false,
1906
- tickMargin: 8,
1907
- minTickGap: 16,
1908
- tickFormatter: (v, i) => xFmt(v, i)
1909
- }
1910
- ),
1911
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1912
- import_recharts.YAxis,
2102
+ const categoryLabels = data.map((row, i) => xFmt(row[xKey], i));
2103
+ const yAxisWidth = showYAxis ? estimateYAxisWidth(
2104
+ clipTicks ? categoryLabels.map((l) => l.slice(0, 14)) : categoryLabels
2105
+ ) : 0;
2106
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChartShell, { config, height, className, ariaLabel, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2107
+ import_recharts.BarChart,
1913
2108
  {
1914
- hide: !showYAxis,
1915
- tickLine: false,
1916
- axisLine: false,
1917
- tickMargin: 8,
1918
- width: showYAxis ? 44 : 0,
1919
- tickFormatter: (v) => valueFmt(v),
1920
- domain: yDomain
2109
+ accessibilityLayer: true,
2110
+ data,
2111
+ layout: "vertical",
2112
+ margin,
2113
+ barCategoryGap: flushBarCategoryGap(flush, showYAxis),
2114
+ children: [
2115
+ barDefs,
2116
+ gridEl,
2117
+ showXAxis ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2118
+ import_recharts.XAxis,
2119
+ {
2120
+ type: "number",
2121
+ tickLine: false,
2122
+ axisLine: false,
2123
+ tickMargin: 8,
2124
+ tickFormatter: (v) => valueFmt(v),
2125
+ domain: yDomain
2126
+ }
2127
+ ) : null,
2128
+ showYAxis ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2129
+ import_recharts.YAxis,
2130
+ {
2131
+ type: "category",
2132
+ dataKey: xKey,
2133
+ tickLine: false,
2134
+ axisLine: false,
2135
+ tickMargin: 8,
2136
+ width: yAxisWidth,
2137
+ minTickGap: 16,
2138
+ tick: categoryTick("end")
2139
+ }
2140
+ ) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_recharts.YAxis, { type: "category", dataKey: xKey, hide: true, width: 0 }),
2141
+ tooltipEl,
2142
+ legendEl,
2143
+ bars
2144
+ ]
1921
2145
  }
1922
- ),
1923
- tooltipEl,
1924
- legendEl,
1925
- bars
1926
- ] }) });
2146
+ ) });
2147
+ }
2148
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChartShell, { config, height, className, ariaLabel, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2149
+ import_recharts.BarChart,
2150
+ {
2151
+ accessibilityLayer: true,
2152
+ data,
2153
+ margin,
2154
+ barCategoryGap: flushBarCategoryGap(flush, showXAxis),
2155
+ children: [
2156
+ barDefs,
2157
+ gridEl,
2158
+ showXAxis ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2159
+ import_recharts.XAxis,
2160
+ {
2161
+ dataKey: xKey,
2162
+ tickLine: false,
2163
+ axisLine: false,
2164
+ tickMargin: 8,
2165
+ minTickGap: 16,
2166
+ tick: categoryTick("middle"),
2167
+ ...flushCategoryXAxisProps
2168
+ }
2169
+ ) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_recharts.XAxis, { dataKey: xKey, hide: true }),
2170
+ showYAxis ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2171
+ import_recharts.YAxis,
2172
+ {
2173
+ tickLine: false,
2174
+ axisLine: false,
2175
+ tickMargin: 8,
2176
+ width: 44,
2177
+ tickFormatter: (v) => valueFmt(v),
2178
+ domain: yDomain
2179
+ }
2180
+ ) : null,
2181
+ tooltipEl,
2182
+ legendEl,
2183
+ bars
2184
+ ]
2185
+ }
2186
+ ) });
1927
2187
  }
1928
- const axes = /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1929
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2188
+ const lineAreaAxes = /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
2189
+ showXAxis && useIndexX ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2190
+ import_recharts.XAxis,
2191
+ {
2192
+ type: "number",
2193
+ dataKey: INDEX_X_KEY,
2194
+ domain: [0, Math.max(0, chartData.length - 1)],
2195
+ allowDecimals: false,
2196
+ ticks: chartData.map((_, i) => i),
2197
+ tickLine: false,
2198
+ axisLine: false,
2199
+ tickMargin: 8,
2200
+ tickFormatter: (i) => {
2201
+ const row = chartData[Number(i)];
2202
+ return row ? xFmt(row[xKey], Number(i)) : "";
2203
+ }
2204
+ }
2205
+ ) : showXAxis ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1930
2206
  import_recharts.XAxis,
1931
2207
  {
1932
2208
  dataKey: xKey,
1933
- hide: !showXAxis,
1934
2209
  tickLine: false,
1935
2210
  axisLine: false,
1936
2211
  tickMargin: 8,
1937
- minTickGap: 24,
1938
- tickFormatter: (v, i) => xFmt(v, i)
2212
+ minTickGap: flush ? 8 : 24,
2213
+ tickFormatter: (v, i) => xFmt(v, i),
2214
+ ...flushCategoryXAxisProps
1939
2215
  }
1940
- ),
1941
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2216
+ ) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_recharts.XAxis, { dataKey: chartXKey, hide: true }),
2217
+ showYAxis ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1942
2218
  import_recharts.YAxis,
1943
2219
  {
1944
- hide: !showYAxis,
1945
2220
  tickLine: false,
1946
2221
  axisLine: false,
1947
2222
  tickMargin: 8,
1948
- width: showYAxis ? 44 : 0,
2223
+ width: 44,
1949
2224
  tickFormatter: (v) => valueFmt(v),
1950
2225
  domain: yDomain
1951
2226
  }
1952
- )
2227
+ ) : null
1953
2228
  ] });
2229
+ const chartA11y = flush ? {} : { accessibilityLayer: true };
1954
2230
  if (variant === "area") {
1955
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ChartShell, { config, height, className, ariaLabel, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_recharts.AreaChart, { accessibilityLayer: true, data, margin, children: [
1956
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("defs", { children: series.map((s) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("linearGradient", { id: `fill-${s.dataKey}`, x1: "0", y1: "0", x2: "0", y2: "1", children: [
1957
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("stop", { offset: "5%", stopColor: `var(--color-${s.dataKey})`, stopOpacity: 0.3 }),
1958
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("stop", { offset: "95%", stopColor: `var(--color-${s.dataKey})`, stopOpacity: 0.04 })
1959
- ] }, s.dataKey)) }),
1960
- gridEl,
1961
- axes,
1962
- tooltipEl,
1963
- legendEl,
1964
- series.map((s) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1965
- import_recharts.Area,
1966
- {
1967
- dataKey: s.dataKey,
1968
- type: curve,
1969
- stackId: stacked ? "stack" : void 0,
1970
- stroke: `var(--color-${s.dataKey})`,
1971
- strokeWidth: 2,
1972
- fill: `url(#fill-${s.dataKey})`,
1973
- dot: dots === true ? { r: 3 } : false,
1974
- activeDot: { r: 4 },
1975
- isAnimationActive: true
1976
- },
1977
- s.dataKey
1978
- ))
1979
- ] }) });
1980
- }
1981
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ChartShell, { config, height, className, ariaLabel, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_recharts.LineChart, { accessibilityLayer: true, data, margin, children: [
1982
- gridEl,
1983
- axes,
1984
- tooltipEl,
1985
- legendEl,
1986
- series.map((s) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1987
- import_recharts.Line,
2231
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2232
+ ChartShell,
1988
2233
  {
1989
- dataKey: s.dataKey,
1990
- type: curve,
1991
- stroke: `var(--color-${s.dataKey})`,
1992
- strokeWidth: 2,
1993
- dot: dots === true ? { r: 3 } : false,
1994
- activeDot: { r: 4 },
1995
- isAnimationActive: true
1996
- },
1997
- s.dataKey
1998
- ))
1999
- ] }) });
2234
+ config,
2235
+ height,
2236
+ className,
2237
+ ariaLabel,
2238
+ flush,
2239
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_recharts.AreaChart, { ...chartA11y, data: chartData, margin, children: [
2240
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("defs", { children: series.map((s) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("linearGradient", { id: `fill-${s.dataKey}`, x1: "0", y1: "0", x2: "0", y2: "1", children: [
2241
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("stop", { offset: "5%", stopColor: `var(--color-${s.dataKey})`, stopOpacity: 0.3 }),
2242
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("stop", { offset: "95%", stopColor: `var(--color-${s.dataKey})`, stopOpacity: 0.04 })
2243
+ ] }, s.dataKey)) }),
2244
+ gridEl,
2245
+ lineAreaAxes,
2246
+ tooltipEl,
2247
+ legendEl,
2248
+ series.map((s) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2249
+ import_recharts.Area,
2250
+ {
2251
+ dataKey: s.dataKey,
2252
+ type: curve,
2253
+ stackId: stacked ? "stack" : void 0,
2254
+ stroke: `var(--color-${s.dataKey})`,
2255
+ strokeWidth: 2,
2256
+ fill: `url(#fill-${s.dataKey})`,
2257
+ dot: dots === true ? { r: 3 } : false,
2258
+ activeDot: { r: 4 },
2259
+ isAnimationActive: true
2260
+ },
2261
+ s.dataKey
2262
+ ))
2263
+ ] })
2264
+ }
2265
+ );
2266
+ }
2267
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2268
+ ChartShell,
2269
+ {
2270
+ config,
2271
+ height,
2272
+ className,
2273
+ ariaLabel,
2274
+ flush,
2275
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_recharts.LineChart, { ...chartA11y, data: chartData, margin, children: [
2276
+ gridEl,
2277
+ lineAreaAxes,
2278
+ tooltipEl,
2279
+ legendEl,
2280
+ series.map((s) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2281
+ import_recharts.Line,
2282
+ {
2283
+ dataKey: s.dataKey,
2284
+ type: curve,
2285
+ stroke: `var(--color-${s.dataKey})`,
2286
+ strokeWidth: 2,
2287
+ dot: dots === true ? { r: 3 } : false,
2288
+ activeDot: { r: 4 },
2289
+ isAnimationActive: true
2290
+ },
2291
+ s.dataKey
2292
+ ))
2293
+ ] })
2294
+ }
2295
+ );
2000
2296
  };
2001
- var ChartShell = ({ config, height, className, ariaLabel, children }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2297
+ var ChartShell = ({ config, height, className, ariaLabel, flush = false, children }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2002
2298
  ChartContainer,
2003
2299
  {
2004
2300
  config,
2005
2301
  role: "img",
2006
2302
  "aria-label": ariaLabel,
2007
- className: cn("aspect-auto w-full", className),
2303
+ className: cn(
2304
+ "aspect-auto w-full",
2305
+ flush && "justify-start [&_.recharts-responsive-container]:!mx-0 [&_.recharts-responsive-container]:w-full",
2306
+ className
2307
+ ),
2008
2308
  style: { height },
2009
2309
  children
2010
2310
  }
@@ -2013,7 +2313,7 @@ var ChartEmpty = ({
2013
2313
  className,
2014
2314
  height,
2015
2315
  ariaLabel
2016
- }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2316
+ }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2017
2317
  "div",
2018
2318
  {
2019
2319
  className: cn(
@@ -2046,8 +2346,35 @@ function resolveSeries(seriesProp, data, xKey) {
2046
2346
  }
2047
2347
 
2048
2348
  // src/charts/pie-chart.tsx
2349
+ var import_react8 = require("react");
2049
2350
  var import_recharts2 = require("recharts");
2050
- var import_jsx_runtime11 = require("react/jsx-runtime");
2351
+
2352
+ // src/charts/chart-center-label.tsx
2353
+ var import_jsx_runtime13 = require("react/jsx-runtime");
2354
+ var CENTER_BOX_W = 96;
2355
+ var CENTER_BOX_H = 52;
2356
+ var ChartCenterLabel = ({ cx, cy, value, label }) => {
2357
+ const hasValue = value != null && value !== "";
2358
+ const hasLabel = label != null && label !== "";
2359
+ if (!hasValue && !hasLabel) return null;
2360
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2361
+ "foreignObject",
2362
+ {
2363
+ x: cx - CENTER_BOX_W / 2,
2364
+ y: cy - CENTER_BOX_H / 2,
2365
+ width: CENTER_BOX_W,
2366
+ height: CENTER_BOX_H,
2367
+ className: "overflow-visible",
2368
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "pointer-events-none flex h-full flex-col items-center justify-center gap-0.5 text-center", children: [
2369
+ hasValue ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "text-2xl font-normal leading-none tabular-nums text-foreground", children: value }) : null,
2370
+ hasLabel ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "text-[11px] leading-none text-muted-foreground", children: label }) : null
2371
+ ] })
2372
+ }
2373
+ );
2374
+ };
2375
+
2376
+ // src/charts/pie-chart.tsx
2377
+ var import_jsx_runtime14 = require("react/jsx-runtime");
2051
2378
  var PieChart = ({
2052
2379
  data,
2053
2380
  nameKey: nameKeyProp,
@@ -2064,10 +2391,11 @@ var PieChart = ({
2064
2391
  className,
2065
2392
  ariaLabel = "Pie chart"
2066
2393
  }) => {
2394
+ const gradientScopeId = (0, import_react8.useId)().replace(/:/g, "");
2067
2395
  const nameKey = nameKeyProp ?? inferNameKey(data, dataKey);
2068
2396
  const palette = colors ?? CHART_PALETTE;
2069
2397
  if (data.length === 0) {
2070
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PieEmpty, { className, height, ariaLabel });
2398
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PieEmpty, { className, height, ariaLabel });
2071
2399
  }
2072
2400
  const slices = data.map((d, i) => ({
2073
2401
  name: String(d[nameKey] ?? i),
@@ -2078,7 +2406,7 @@ var PieChart = ({
2078
2406
  for (const s of slices) config[s.name] = { label: s.name };
2079
2407
  const innerPct = innerRadius > 0 ? `${Math.round(innerRadius * 75)}%` : 0;
2080
2408
  const hasCenter = innerRadius > 0 && (centerValue != null || centerLabel != null);
2081
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2409
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2082
2410
  ChartContainer,
2083
2411
  {
2084
2412
  config,
@@ -2086,14 +2414,21 @@ var PieChart = ({
2086
2414
  "aria-label": ariaLabel,
2087
2415
  className: cn("aspect-auto w-full", className),
2088
2416
  style: { height },
2089
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_recharts2.PieChart, { children: [
2090
- showTooltip && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2417
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_recharts2.PieChart, { children: [
2418
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2419
+ PieGradientDefs,
2420
+ {
2421
+ scopeId: gradientScopeId,
2422
+ slices: slices.map((s) => ({ key: s.name, color: s.fill }))
2423
+ }
2424
+ ),
2425
+ showTooltip && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2091
2426
  ChartTooltip,
2092
2427
  {
2093
- content: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ChartTooltipContent, { nameKey: "name", indicator: tooltipIndicator, hideLabel: true })
2428
+ content: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ChartTooltipContent, { nameKey: "name", indicator: tooltipIndicator, hideLabel: true })
2094
2429
  }
2095
2430
  ),
2096
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2431
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2097
2432
  import_recharts2.Pie,
2098
2433
  {
2099
2434
  data: slices,
@@ -2106,24 +2441,30 @@ var PieChart = ({
2106
2441
  label: showLabels,
2107
2442
  isAnimationActive: true,
2108
2443
  children: [
2109
- slices.map((s) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_recharts2.Cell, { fill: s.fill }, s.name)),
2110
- hasCenter && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2444
+ slices.map((s) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_recharts2.Cell, { fill: `url(#${pieGradientId(gradientScopeId, s.name)})` }, s.name)),
2445
+ hasCenter && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2111
2446
  import_recharts2.Label,
2112
2447
  {
2448
+ position: "center",
2113
2449
  content: ({ viewBox }) => {
2114
2450
  if (!viewBox || !("cx" in viewBox)) return null;
2115
2451
  const { cx, cy } = viewBox;
2116
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("text", { x: cx, y: cy, textAnchor: "middle", dominantBaseline: "middle", children: [
2117
- centerValue != null && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("tspan", { x: cx, y: cy - 2, className: "fill-foreground text-2xl tabular-nums", children: centerValue }),
2118
- centerLabel != null && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("tspan", { x: cx, y: cy + 18, className: "fill-muted-foreground text-[11px]", children: centerLabel })
2119
- ] });
2452
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2453
+ ChartCenterLabel,
2454
+ {
2455
+ cx,
2456
+ cy,
2457
+ value: centerValue,
2458
+ label: centerLabel
2459
+ }
2460
+ );
2120
2461
  }
2121
2462
  }
2122
2463
  )
2123
2464
  ]
2124
2465
  }
2125
2466
  ),
2126
- showLegend && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ChartLegend, { content: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ChartLegendContent, { nameKey: "name" }) })
2467
+ showLegend && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ChartLegend, { content: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ChartLegendContent, { nameKey: "name" }) })
2127
2468
  ] })
2128
2469
  }
2129
2470
  );
@@ -2132,7 +2473,7 @@ var PieEmpty = ({
2132
2473
  className,
2133
2474
  height,
2134
2475
  ariaLabel
2135
- }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2476
+ }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2136
2477
  "div",
2137
2478
  {
2138
2479
  className: cn("flex w-full items-center justify-center text-xs text-muted-foreground", className),
@@ -2151,8 +2492,9 @@ function inferNameKey(data, dataKey) {
2151
2492
  }
2152
2493
 
2153
2494
  // src/charts/radial-chart.tsx
2495
+ var import_react9 = require("react");
2154
2496
  var import_recharts3 = require("recharts");
2155
- var import_jsx_runtime12 = require("react/jsx-runtime");
2497
+ var import_jsx_runtime15 = require("react/jsx-runtime");
2156
2498
  var RadialChart = ({
2157
2499
  data,
2158
2500
  nameKey: nameKeyProp,
@@ -2168,10 +2510,11 @@ var RadialChart = ({
2168
2510
  className,
2169
2511
  ariaLabel = "Radial chart"
2170
2512
  }) => {
2513
+ const gradientScopeId = (0, import_react9.useId)().replace(/:/g, "");
2171
2514
  const nameKey = nameKeyProp ?? inferNameKey2(data, dataKey);
2172
2515
  const palette = colors ?? CHART_PALETTE;
2173
2516
  if (data.length === 0) {
2174
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RadialEmpty, { className, height, ariaLabel });
2517
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(RadialEmpty, { className, height, ariaLabel });
2175
2518
  }
2176
2519
  const rows = data.map((d, i) => ({
2177
2520
  name: String(d[nameKey] ?? i),
@@ -2182,8 +2525,8 @@ var RadialChart = ({
2182
2525
  const config = {};
2183
2526
  for (const r of rows) config[r.name] = { label: r.name };
2184
2527
  const hasCenter = centerValue != null || centerLabel != null;
2185
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn("flex w-full flex-col items-center gap-3", className), children: [
2186
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2528
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: cn("flex w-full flex-col items-center gap-3", className), children: [
2529
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2187
2530
  ChartContainer,
2188
2531
  {
2189
2532
  config,
@@ -2191,7 +2534,7 @@ var RadialChart = ({
2191
2534
  "aria-label": ariaLabel,
2192
2535
  className: "aspect-auto w-full",
2193
2536
  style: { height: height - (showLegend ? 32 : 0) },
2194
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2537
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2195
2538
  import_recharts3.RadialBarChart,
2196
2539
  {
2197
2540
  data: rows,
@@ -2202,19 +2545,32 @@ var RadialChart = ({
2202
2545
  barSize: ringWidth,
2203
2546
  barGap: ringGap,
2204
2547
  children: [
2205
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_recharts3.PolarAngleAxis, { type: "number", domain: [0, max], tick: false, axisLine: false }),
2206
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChartTooltip, { content: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChartTooltipContent, { nameKey: "name", hideLabel: true }) }),
2207
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_recharts3.RadialBar, { dataKey: "value", background: true, cornerRadius: ringWidth / 2, isAnimationActive: true, children: rows.map((r) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_recharts3.Cell, { fill: r.fill }, r.name)) }),
2208
- hasCenter && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_recharts3.PolarRadiusAxis, { tick: false, tickLine: false, axisLine: false, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2548
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2549
+ PieGradientDefs,
2550
+ {
2551
+ scopeId: gradientScopeId,
2552
+ slices: rows.map((r) => ({ key: r.name, color: r.fill }))
2553
+ }
2554
+ ),
2555
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_recharts3.PolarAngleAxis, { type: "number", domain: [0, max], tick: false, axisLine: false }),
2556
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChartTooltip, { content: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChartTooltipContent, { nameKey: "name", hideLabel: true }) }),
2557
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_recharts3.RadialBar, { dataKey: "value", background: true, cornerRadius: ringWidth / 2, isAnimationActive: true, children: rows.map((r) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_recharts3.Cell, { fill: `url(#${pieGradientId(gradientScopeId, r.name)})` }, r.name)) }),
2558
+ hasCenter && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_recharts3.PolarRadiusAxis, { tick: false, tickLine: false, axisLine: false, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2209
2559
  import_recharts3.Label,
2210
2560
  {
2561
+ position: "center",
2211
2562
  content: ({ viewBox }) => {
2212
2563
  if (!viewBox || !("cx" in viewBox)) return null;
2213
2564
  const { cx, cy } = viewBox;
2214
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("text", { x: cx, y: cy, textAnchor: "middle", dominantBaseline: "middle", children: [
2215
- centerValue != null && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tspan", { x: cx, y: cy - 2, className: "fill-foreground text-2xl tabular-nums", children: centerValue }),
2216
- centerLabel != null && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tspan", { x: cx, y: cy + 18, className: "fill-muted-foreground text-[11px]", children: centerLabel })
2217
- ] });
2565
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2566
+ ChartCenterLabel,
2567
+ {
2568
+ cx,
2569
+ cy,
2570
+ value: centerValue,
2571
+ label: centerLabel
2572
+ }
2573
+ );
2218
2574
  }
2219
2575
  }
2220
2576
  ) })
@@ -2223,8 +2579,8 @@ var RadialChart = ({
2223
2579
  )
2224
2580
  }
2225
2581
  ),
2226
- showLegend && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex flex-wrap items-center justify-center gap-x-4 gap-y-1 text-xs text-muted-foreground", children: rows.map((r) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "inline-flex items-center gap-1.5", children: [
2227
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "inline-block size-2.5 rounded-[3px]", style: { background: r.fill } }),
2582
+ showLegend && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex flex-wrap items-center justify-center gap-x-4 gap-y-1 text-xs text-muted-foreground", children: rows.map((r) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "inline-flex items-center gap-1.5", children: [
2583
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "inline-block size-2.5 rounded-[3px]", style: { background: r.fill } }),
2228
2584
  r.name
2229
2585
  ] }, r.name)) })
2230
2586
  ] });
@@ -2233,7 +2589,7 @@ var RadialEmpty = ({
2233
2589
  className,
2234
2590
  height,
2235
2591
  ariaLabel
2236
- }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2592
+ }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2237
2593
  "div",
2238
2594
  {
2239
2595
  className: cn("flex w-full items-center justify-center text-xs text-muted-foreground", className),
@@ -2253,7 +2609,7 @@ function inferNameKey2(data, dataKey) {
2253
2609
 
2254
2610
  // src/charts/radar-chart.tsx
2255
2611
  var import_recharts4 = require("recharts");
2256
- var import_jsx_runtime13 = require("react/jsx-runtime");
2612
+ var import_jsx_runtime16 = require("react/jsx-runtime");
2257
2613
  var RadarChart = ({
2258
2614
  data,
2259
2615
  nameKey: nameKeyProp,
@@ -2268,7 +2624,7 @@ var RadarChart = ({
2268
2624
  const nameKey = nameKeyProp ?? inferNameKey3(data);
2269
2625
  const series = resolveSeries2(seriesProp, data, nameKey);
2270
2626
  if (data.length < 3 || series.length === 0) {
2271
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2627
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2272
2628
  "div",
2273
2629
  {
2274
2630
  className: cn("flex items-center justify-center text-xs text-muted-foreground", className),
@@ -2286,7 +2642,7 @@ var RadarChart = ({
2286
2642
  color: s.color ?? CHART_PALETTE[i % CHART_PALETTE.length]
2287
2643
  };
2288
2644
  });
2289
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2645
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2290
2646
  ChartContainer,
2291
2647
  {
2292
2648
  config,
@@ -2294,17 +2650,17 @@ var RadarChart = ({
2294
2650
  "aria-label": ariaLabel,
2295
2651
  className: cn("mx-auto aspect-square", className),
2296
2652
  style: { height },
2297
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_recharts4.RadarChart, { data, outerRadius: "70%", children: [
2298
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ChartTooltip, { content: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ChartTooltipContent, { indicator: "line" }) }),
2299
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_recharts4.PolarGrid, {}),
2300
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2653
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_recharts4.RadarChart, { data, outerRadius: "70%", children: [
2654
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ChartTooltip, { content: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ChartTooltipContent, { indicator: "line" }) }),
2655
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_recharts4.PolarGrid, {}),
2656
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2301
2657
  import_recharts4.PolarAngleAxis,
2302
2658
  {
2303
2659
  dataKey: nameKey,
2304
2660
  tick: { fontSize: 10, fill: "var(--color-muted-foreground)" }
2305
2661
  }
2306
2662
  ),
2307
- series.map((s) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2663
+ series.map((s) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2308
2664
  import_recharts4.Radar,
2309
2665
  {
2310
2666
  dataKey: s.dataKey,
@@ -2317,7 +2673,7 @@ var RadarChart = ({
2317
2673
  },
2318
2674
  s.dataKey
2319
2675
  )),
2320
- showLegend && series.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ChartLegend, { content: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ChartLegendContent, {}) })
2676
+ showLegend && series.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ChartLegend, { content: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ChartLegendContent, {}) })
2321
2677
  ] })
2322
2678
  }
2323
2679
  );
@@ -2338,10 +2694,10 @@ function resolveSeries2(seriesProp, data, nameKey) {
2338
2694
  }
2339
2695
 
2340
2696
  // src/artifacts/artifact-card.tsx
2341
- var import_jsx_runtime14 = require("react/jsx-runtime");
2697
+ var import_jsx_runtime17 = require("react/jsx-runtime");
2342
2698
  var ArtifactCard = ({ title, kind, className, bodyClassName, toolbar, children }) => {
2343
2699
  const hasHeader = Boolean(title || toolbar);
2344
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2700
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2345
2701
  "div",
2346
2702
  {
2347
2703
  className: cn(
@@ -2350,29 +2706,29 @@ var ArtifactCard = ({ title, kind, className, bodyClassName, toolbar, children }
2350
2706
  ),
2351
2707
  "data-artifact-kind": kind,
2352
2708
  children: [
2353
- hasHeader && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "aui-artifact-header flex items-center gap-2 border-b border-border/40 bg-muted/30 px-3 py-1.5", children: [
2354
- title && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "aui-artifact-title flex-1 truncate text-xs font-semibold text-foreground/80", children: title }),
2355
- !title && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "flex-1" }),
2709
+ hasHeader && /* @__PURE__ */ (0, import_jsx_runtime17.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: [
2710
+ title && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "aui-artifact-title flex-1 truncate text-xs font-semibold text-foreground/80", children: title }),
2711
+ !title && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "flex-1" }),
2356
2712
  toolbar
2357
2713
  ] }),
2358
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cn("aui-artifact-body", bodyClassName), children })
2714
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: cn("aui-artifact-body", bodyClassName), children })
2359
2715
  ]
2360
2716
  }
2361
2717
  );
2362
2718
  };
2363
2719
 
2364
2720
  // src/artifacts/chart-artifact.tsx
2365
- var import_jsx_runtime15 = require("react/jsx-runtime");
2721
+ var import_jsx_runtime18 = require("react/jsx-runtime");
2366
2722
  var ChartArtifactView = ({
2367
2723
  artifact,
2368
2724
  embedded = false,
2369
2725
  height = 300
2370
2726
  }) => {
2371
- const plot = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChartArtifactPlot, { artifact, height });
2727
+ const plot = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChartArtifactPlot, { artifact, height });
2372
2728
  if (embedded) {
2373
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "aui-artifact-chart w-full", children: plot });
2729
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "aui-artifact-chart w-full", children: plot });
2374
2730
  }
2375
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ArtifactCard, { title: artifact.title, kind: "chart", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "aui-artifact-chart pt-2", children: plot }) });
2731
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ArtifactCard, { title: artifact.title, kind: "chart", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "aui-artifact-chart pt-2", children: plot }) });
2376
2732
  };
2377
2733
  function ChartArtifactPlot({
2378
2734
  artifact,
@@ -2380,7 +2736,7 @@ function ChartArtifactPlot({
2380
2736
  }) {
2381
2737
  const { chartType = "bar", data = [] } = artifact;
2382
2738
  const xKey = artifact.xKey ?? inferXKey2(data);
2383
- const series = (0, import_react7.useMemo)(() => {
2739
+ const series = (0, import_react10.useMemo)(() => {
2384
2740
  if (artifact.series && artifact.series.length > 0) {
2385
2741
  return artifact.series.map((s) => ({
2386
2742
  dataKey: s.dataKey,
@@ -2398,7 +2754,7 @@ function ChartArtifactPlot({
2398
2754
  const aria = typeof artifact.title === "string" ? artifact.title : "Chart";
2399
2755
  if (chartType === "pie" || chartType === "donut") {
2400
2756
  const total = data.reduce((sum, d) => sum + toNum(d[series[0]?.dataKey ?? "value"]), 0);
2401
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "px-3 pb-3 pt-2", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2757
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "px-3 pb-3 pt-2", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2402
2758
  PieChart,
2403
2759
  {
2404
2760
  data,
@@ -2415,7 +2771,7 @@ function ChartArtifactPlot({
2415
2771
  ) });
2416
2772
  }
2417
2773
  if (chartType === "radial") {
2418
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "px-3 pb-3 pt-2", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2774
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "px-3 pb-3 pt-2", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2419
2775
  RadialChart,
2420
2776
  {
2421
2777
  data,
@@ -2428,10 +2784,11 @@ function ChartArtifactPlot({
2428
2784
  ) });
2429
2785
  }
2430
2786
  if (chartType === "radar") {
2431
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "px-3 pb-3 pt-2", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(RadarChart, { data, nameKey: xKey, series, height, ariaLabel: aria }) });
2787
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "px-3 pb-3 pt-2", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RadarChart, { data, nameKey: xKey, series, height, ariaLabel: aria }) });
2432
2788
  }
2433
2789
  const horizontal = chartType === "horizontalBar";
2434
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2790
+ const showAxes = artifact.showAxes === true;
2791
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2435
2792
  LineAreaChart,
2436
2793
  {
2437
2794
  data,
@@ -2445,8 +2802,8 @@ function ChartArtifactPlot({
2445
2802
  curve: artifact.curve,
2446
2803
  dots: artifact.dots,
2447
2804
  tooltipIndicator: artifact.tooltipIndicator,
2448
- showXAxis: true,
2449
- showYAxis: horizontal,
2805
+ showXAxis: showAxes,
2806
+ showYAxis: showAxes && horizontal,
2450
2807
  showLegend: artifact.legend ?? series.length > 1,
2451
2808
  unit: artifact.unit,
2452
2809
  ariaLabel: aria
@@ -2468,8 +2825,8 @@ function inferDataKeys(data, xKey) {
2468
2825
  }
2469
2826
 
2470
2827
  // src/artifacts/question-artifact.tsx
2471
- var import_react8 = require("react");
2472
- var import_react9 = require("@assistant-ui/react");
2828
+ var import_react11 = require("react");
2829
+ var import_react12 = require("@assistant-ui/react");
2473
2830
  var import_lucide_react3 = require("lucide-react");
2474
2831
 
2475
2832
  // src/design/classes.ts
@@ -2584,12 +2941,12 @@ var studioQuestionOptionSelectedClass = cn(
2584
2941
  );
2585
2942
 
2586
2943
  // src/artifacts/question-artifact.tsx
2587
- var import_jsx_runtime16 = require("react/jsx-runtime");
2944
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2588
2945
  function optionKey(option, index) {
2589
2946
  const id = option.id?.trim();
2590
2947
  return id ? id : `__option-${index}`;
2591
2948
  }
2592
- var OptionRadio = ({ selected }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2949
+ var OptionRadio = ({ selected }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2593
2950
  "span",
2594
2951
  {
2595
2952
  className: cn(
@@ -2597,18 +2954,18 @@ var OptionRadio = ({ selected }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx
2597
2954
  selected ? "border-foreground bg-foreground text-background" : "border-border bg-background"
2598
2955
  ),
2599
2956
  "aria-hidden": true,
2600
- children: selected ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react3.CheckIcon, { className: "size-2.5 stroke-[3]" }) : null
2957
+ children: selected ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react3.CheckIcon, { className: "size-2.5 stroke-[3]" }) : null
2601
2958
  }
2602
2959
  );
2603
2960
  var QuestionArtifactView = ({
2604
2961
  artifact
2605
2962
  }) => {
2606
- const runtime = (0, import_react9.useThreadRuntime)();
2607
- const [selected, setSelected] = (0, import_react8.useState)([]);
2608
- const [submittedIds, setSubmittedIds] = (0, import_react8.useState)(null);
2963
+ const runtime = (0, import_react12.useThreadRuntime)();
2964
+ const [selected, setSelected] = (0, import_react11.useState)([]);
2965
+ const [submittedIds, setSubmittedIds] = (0, import_react11.useState)(null);
2609
2966
  const isMulti = artifact.multi === true;
2610
2967
  const isDisabled = submittedIds !== null;
2611
- const send = (0, import_react8.useCallback)(
2968
+ const send = (0, import_react11.useCallback)(
2612
2969
  (keys) => {
2613
2970
  if (keys.length === 0) return;
2614
2971
  const labels = artifact.options.map((option, index) => ({ option, key: optionKey(option, index) })).filter(({ key }) => keys.includes(key)).map(({ option }) => option.label);
@@ -2620,7 +2977,7 @@ var QuestionArtifactView = ({
2620
2977
  },
2621
2978
  [artifact.options, runtime]
2622
2979
  );
2623
- const onPick = (0, import_react8.useCallback)(
2980
+ const onPick = (0, import_react11.useCallback)(
2624
2981
  (key) => {
2625
2982
  if (isDisabled) return;
2626
2983
  if (!isMulti) {
@@ -2633,15 +2990,15 @@ var QuestionArtifactView = ({
2633
2990
  },
2634
2991
  [isDisabled, isMulti, send]
2635
2992
  );
2636
- const onConfirm = (0, import_react8.useCallback)(() => {
2993
+ const onConfirm = (0, import_react11.useCallback)(() => {
2637
2994
  send(selected);
2638
2995
  }, [selected, send]);
2639
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: studioArtifactShellClass, "data-artifact-kind": "question", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "px-2.5 py-2", children: [
2640
- artifact.prompt ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "mb-2 text-sm font-normal leading-snug text-foreground", children: artifact.prompt }) : null,
2641
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex flex-col gap-0.5", role: "list", children: artifact.options.map((option, index) => {
2996
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: studioArtifactShellClass, "data-artifact-kind": "question", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "px-2.5 py-2", children: [
2997
+ artifact.prompt ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "mb-2 text-sm font-normal leading-snug text-foreground", children: artifact.prompt }) : null,
2998
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex flex-col gap-0.5", role: "list", children: artifact.options.map((option, index) => {
2642
2999
  const key = optionKey(option, index);
2643
3000
  const isSelected = submittedIds ? submittedIds.includes(key) : isMulti && selected.includes(key);
2644
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3001
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2645
3002
  "button",
2646
3003
  {
2647
3004
  type: "button",
@@ -2653,17 +3010,17 @@ var QuestionArtifactView = ({
2653
3010
  isDisabled && (isSelected ? "cursor-default" : "cursor-not-allowed opacity-50")
2654
3011
  ),
2655
3012
  children: [
2656
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(OptionRadio, { selected: isSelected }),
2657
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "min-w-0 flex-1 text-left", children: [
2658
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "block font-normal text-foreground", children: option.label }),
2659
- option.description ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: option.description }) : null
3013
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(OptionRadio, { selected: isSelected }),
3014
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "min-w-0 flex-1 text-left", children: [
3015
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "block font-normal text-foreground", children: option.label }),
3016
+ option.description ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: option.description }) : null
2660
3017
  ] })
2661
3018
  ]
2662
3019
  },
2663
3020
  key
2664
3021
  );
2665
3022
  }) }),
2666
- isMulti && !submittedIds ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "mt-2 flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3023
+ isMulti && !submittedIds ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "mt-2 flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2667
3024
  TimbalV2Button,
2668
3025
  {
2669
3026
  type: "button",
@@ -2678,12 +3035,12 @@ var QuestionArtifactView = ({
2678
3035
  };
2679
3036
 
2680
3037
  // src/artifacts/html-artifact.tsx
2681
- var import_jsx_runtime17 = require("react/jsx-runtime");
3038
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2682
3039
  var HtmlArtifactView = ({ artifact }) => {
2683
3040
  const sandboxed = artifact.sandboxed !== false;
2684
3041
  const sandbox = sandboxed ? "allow-scripts allow-same-origin allow-forms allow-modals allow-popups allow-pointer-lock" : void 0;
2685
3042
  const height = artifact.height ?? "320px";
2686
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ArtifactCard, { title: artifact.title, kind: "html", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3043
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ArtifactCard, { title: artifact.title, kind: "html", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2687
3044
  "iframe",
2688
3045
  {
2689
3046
  title: artifact.title ?? "HTML artifact",
@@ -2696,7 +3053,7 @@ var HtmlArtifactView = ({ artifact }) => {
2696
3053
  };
2697
3054
 
2698
3055
  // src/artifacts/json-artifact.tsx
2699
- var import_jsx_runtime18 = require("react/jsx-runtime");
3056
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2700
3057
  var JsonArtifactView = ({
2701
3058
  artifact
2702
3059
  }) => {
@@ -2708,16 +3065,16 @@ var JsonArtifactView = ({
2708
3065
  } catch {
2709
3066
  body = String(data);
2710
3067
  }
2711
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ArtifactCard, { title, kind: "json", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("pre", { className: "aui-artifact-json m-0 max-h-[420px] overflow-auto p-3 font-mono text-[12px] leading-relaxed text-foreground/85", children: body }) });
3068
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ArtifactCard, { title, kind: "json", children: /* @__PURE__ */ (0, import_jsx_runtime21.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 }) });
2712
3069
  };
2713
3070
 
2714
3071
  // src/artifacts/table-artifact.tsx
2715
- var import_jsx_runtime19 = require("react/jsx-runtime");
3072
+ var import_jsx_runtime22 = require("react/jsx-runtime");
2716
3073
  var TableArtifactView = ({ artifact }) => {
2717
3074
  const rows = artifact.rows ?? [];
2718
3075
  const columns = artifact.columns ?? deriveColumns(rows);
2719
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ArtifactCard, { title: artifact.title, kind: "table", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "aui-artifact-table-wrap overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("table", { className: "aui-artifact-table w-full border-collapse text-sm", children: [
2720
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("tr", { className: "border-b border-border/40 bg-muted/20", children: columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3076
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ArtifactCard, { title: artifact.title, kind: "table", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "aui-artifact-table-wrap overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("table", { className: "aui-artifact-table w-full border-collapse text-sm", children: [
3077
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("tr", { className: "border-b border-border/40 bg-muted/20", children: columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2721
3078
  "th",
2722
3079
  {
2723
3080
  className: "px-3 py-2 text-left text-xs font-semibold uppercase tracking-wider text-muted-foreground",
@@ -2725,11 +3082,11 @@ var TableArtifactView = ({ artifact }) => {
2725
3082
  },
2726
3083
  col.key
2727
3084
  )) }) }),
2728
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("tbody", { children: rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3085
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("tbody", { children: rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2729
3086
  "tr",
2730
3087
  {
2731
3088
  className: "border-b border-border/30 transition-colors last:border-b-0 hover:bg-muted/20",
2732
- children: columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3089
+ children: columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2733
3090
  "td",
2734
3091
  {
2735
3092
  className: "px-3 py-2 align-top text-foreground/85",
@@ -2762,7 +3119,7 @@ function formatCell(value) {
2762
3119
  }
2763
3120
 
2764
3121
  // src/artifacts/ui/ui-artifact.tsx
2765
- var import_react14 = require("react");
3122
+ var import_react17 = require("react");
2766
3123
 
2767
3124
  // src/artifacts/ui/types.ts
2768
3125
  function isUiBinding(value) {
@@ -2815,38 +3172,38 @@ function resolveBindable(value, state) {
2815
3172
  }
2816
3173
 
2817
3174
  // src/artifacts/ui/registry.tsx
2818
- var import_react10 = require("react");
2819
- var import_jsx_runtime20 = require("react/jsx-runtime");
2820
- var UiStateContext = (0, import_react10.createContext)({});
2821
- var UiDispatchContext = (0, import_react10.createContext)(() => {
3175
+ var import_react13 = require("react");
3176
+ var import_jsx_runtime23 = require("react/jsx-runtime");
3177
+ var UiStateContext = (0, import_react13.createContext)({});
3178
+ var UiDispatchContext = (0, import_react13.createContext)(() => {
2822
3179
  });
2823
- var UiStateProvider = ({ state, dispatch, children }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(UiStateContext.Provider, { value: state, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(UiDispatchContext.Provider, { value: dispatch, children }) });
3180
+ var UiStateProvider = ({ state, dispatch, children }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(UiStateContext.Provider, { value: state, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(UiDispatchContext.Provider, { value: dispatch, children }) });
2824
3181
  function useUiState() {
2825
- return (0, import_react10.useContext)(UiStateContext);
3182
+ return (0, import_react13.useContext)(UiStateContext);
2826
3183
  }
2827
3184
  function useUiDispatch() {
2828
- return (0, import_react10.useContext)(UiDispatchContext);
3185
+ return (0, import_react13.useContext)(UiDispatchContext);
2829
3186
  }
2830
- var UiEventContext = (0, import_react10.createContext)(
3187
+ var UiEventContext = (0, import_react13.createContext)(
2831
3188
  null
2832
3189
  );
2833
- var UiEventProvider = ({ onEvent, children }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(UiEventContext.Provider, { value: onEvent, children });
3190
+ var UiEventProvider = ({ onEvent, children }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(UiEventContext.Provider, { value: onEvent, children });
2834
3191
  function useUiEventEmitter() {
2835
- return (0, import_react10.useContext)(UiEventContext);
3192
+ return (0, import_react13.useContext)(UiEventContext);
2836
3193
  }
2837
- var UiCustomNodeRegistryContext = (0, import_react10.createContext)({});
3194
+ var UiCustomNodeRegistryContext = (0, import_react13.createContext)({});
2838
3195
  function useUiCustomNodeRegistry() {
2839
- return (0, import_react10.useContext)(UiCustomNodeRegistryContext);
3196
+ return (0, import_react13.useContext)(UiCustomNodeRegistryContext);
2840
3197
  }
2841
3198
 
2842
3199
  // src/artifacts/ui/nodes.tsx
2843
- var import_react11 = require("react");
2844
- var import_react12 = require("motion/react");
2845
- var import_react13 = require("@assistant-ui/react");
3200
+ var import_react14 = require("react");
3201
+ var import_react15 = require("motion/react");
3202
+ var import_react16 = require("@assistant-ui/react");
2846
3203
 
2847
3204
  // src/ui/button.tsx
2848
3205
  var import_class_variance_authority = require("class-variance-authority");
2849
- var import_jsx_runtime21 = require("react/jsx-runtime");
3206
+ var import_jsx_runtime24 = require("react/jsx-runtime");
2850
3207
  var LEGACY_SIZE_TO_V2 = {
2851
3208
  default: "md",
2852
3209
  xs: "xs",
@@ -2896,7 +3253,7 @@ function Button({
2896
3253
  const v2Variant = TIMBAL_V2_FROM_LEGACY_BUTTON[variant ?? "default"];
2897
3254
  const v2Size = LEGACY_SIZE_TO_V2[size ?? "default"];
2898
3255
  const isIconOnly = typeof size === "string" && size.startsWith("icon");
2899
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3256
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2900
3257
  TimbalV2Button,
2901
3258
  {
2902
3259
  "data-slot": "button",
@@ -2914,29 +3271,29 @@ function Button({
2914
3271
  }
2915
3272
 
2916
3273
  // src/artifacts/ui/nodes.tsx
2917
- var import_jsx_runtime22 = require("react/jsx-runtime");
3274
+ var import_jsx_runtime25 = require("react/jsx-runtime");
2918
3275
  var UiNodeView = ({ node }) => {
2919
3276
  switch (node.kind) {
2920
3277
  case "box":
2921
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(BoxNode, { node });
3278
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(BoxNode, { node });
2922
3279
  case "text":
2923
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TextNode, { node });
3280
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TextNode, { node });
2924
3281
  case "heading":
2925
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(HeadingNode, { node });
3282
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(HeadingNode, { node });
2926
3283
  case "badge":
2927
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(BadgeNode, { node });
3284
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(BadgeNode, { node });
2928
3285
  case "button":
2929
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonNode, { node });
3286
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ButtonNode, { node });
2930
3287
  case "toggle":
2931
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToggleNode, { node });
3288
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ToggleNode, { node });
2932
3289
  case "slider":
2933
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SliderNode, { node });
3290
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SliderNode, { node });
2934
3291
  case "tooltip":
2935
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipNode, { node });
3292
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TooltipNode, { node });
2936
3293
  case "draggable":
2937
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DraggableNode, { node });
3294
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DraggableNode, { node });
2938
3295
  case "custom":
2939
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CustomNode, { node });
3296
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CustomNode, { node });
2940
3297
  default:
2941
3298
  return null;
2942
3299
  }
@@ -2944,9 +3301,9 @@ var UiNodeView = ({ node }) => {
2944
3301
  function useActionRunner() {
2945
3302
  const state = useUiState();
2946
3303
  const dispatch = useUiDispatch();
2947
- const runtime = (0, import_react13.useThreadRuntime)();
3304
+ const runtime = (0, import_react16.useThreadRuntime)();
2948
3305
  const emit = useUiEventEmitter();
2949
- return (0, import_react11.useCallback)(
3306
+ return (0, import_react14.useCallback)(
2950
3307
  (actions) => {
2951
3308
  if (!actions) return;
2952
3309
  const list = Array.isArray(actions) ? actions : [actions];
@@ -2996,7 +3353,7 @@ var JUSTIFY_CLS = {
2996
3353
  };
2997
3354
  var BoxNode = ({ node }) => {
2998
3355
  const dir = node.direction ?? "col";
2999
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3356
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3000
3357
  "div",
3001
3358
  {
3002
3359
  className: cn(
@@ -3011,7 +3368,7 @@ var BoxNode = ({ node }) => {
3011
3368
  gap: node.gap !== void 0 ? `${node.gap * 0.25}rem` : void 0,
3012
3369
  padding: node.padding !== void 0 ? `${node.padding * 0.25}rem` : void 0
3013
3370
  },
3014
- children: node.children?.map((child, i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(UiNodeView, { node: child }, child.id ?? i))
3371
+ children: node.children?.map((child, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(UiNodeView, { node: child }, child.id ?? i))
3015
3372
  }
3016
3373
  );
3017
3374
  };
@@ -3030,7 +3387,7 @@ var TEXT_WEIGHT = {
3030
3387
  var TextNode = ({ node }) => {
3031
3388
  const state = useUiState();
3032
3389
  const value = resolveBindable(node.value, state);
3033
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3390
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3034
3391
  "span",
3035
3392
  {
3036
3393
  className: cn(
@@ -3061,13 +3418,13 @@ var HeadingNode = ({ node }) => {
3061
3418
  );
3062
3419
  switch (level) {
3063
3420
  case 1:
3064
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h1", { className: cls, children: value });
3421
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h1", { className: cls, children: value });
3065
3422
  case 2:
3066
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h2", { className: cls, children: value });
3423
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h2", { className: cls, children: value });
3067
3424
  case 3:
3068
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h3", { className: cls, children: value });
3425
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h3", { className: cls, children: value });
3069
3426
  case 4:
3070
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h4", { className: cls, children: value });
3427
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h4", { className: cls, children: value });
3071
3428
  }
3072
3429
  };
3073
3430
  var BADGE_TONE = {
@@ -3080,7 +3437,7 @@ var BADGE_TONE = {
3080
3437
  var BadgeNode = ({ node }) => {
3081
3438
  const state = useUiState();
3082
3439
  const value = String(resolveBindable(node.value, state) ?? "");
3083
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3440
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3084
3441
  "span",
3085
3442
  {
3086
3443
  className: cn(
@@ -3097,7 +3454,7 @@ var ButtonNode = ({ node }) => {
3097
3454
  const run = useActionRunner();
3098
3455
  const label = String(resolveBindable(node.label, state) ?? "");
3099
3456
  const disabled = node.disabled !== void 0 ? Boolean(resolveBindable(node.disabled, state)) : false;
3100
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3457
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3101
3458
  Button,
3102
3459
  {
3103
3460
  variant: node.variant ?? "default",
@@ -3119,7 +3476,7 @@ var ToggleNode = ({ node }) => {
3119
3476
  dispatch({ type: "toggle", path: node.binding });
3120
3477
  run(node.onChange);
3121
3478
  };
3122
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
3479
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3123
3480
  "label",
3124
3481
  {
3125
3482
  className: cn(
@@ -3127,7 +3484,7 @@ var ToggleNode = ({ node }) => {
3127
3484
  node.className
3128
3485
  ),
3129
3486
  children: [
3130
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3487
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3131
3488
  "button",
3132
3489
  {
3133
3490
  type: "button",
@@ -3138,7 +3495,7 @@ var ToggleNode = ({ node }) => {
3138
3495
  "relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-[background,box-shadow,border-color] duration-200",
3139
3496
  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")
3140
3497
  ),
3141
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3498
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3142
3499
  "span",
3143
3500
  {
3144
3501
  className: cn(
@@ -3151,7 +3508,7 @@ var ToggleNode = ({ node }) => {
3151
3508
  )
3152
3509
  }
3153
3510
  ),
3154
- label && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-foreground/85", children: label })
3511
+ label && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-foreground/85", children: label })
3155
3512
  ]
3156
3513
  }
3157
3514
  );
@@ -3171,12 +3528,12 @@ var SliderNode = ({ node }) => {
3171
3528
  const next = Number(e.target.value);
3172
3529
  dispatch({ type: "set", path: node.binding, value: next });
3173
3530
  };
3174
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: cn("aui-ui-slider flex flex-col gap-1", node.className), children: [
3175
- (label || showValue) && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center justify-between text-xs text-muted-foreground", children: [
3176
- label && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: label }),
3177
- showValue && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "font-mono", children: value })
3531
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: cn("aui-ui-slider flex flex-col gap-1", node.className), children: [
3532
+ (label || showValue) && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center justify-between text-xs text-muted-foreground", children: [
3533
+ label && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: label }),
3534
+ showValue && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "font-mono", children: value })
3178
3535
  ] }),
3179
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3536
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3180
3537
  "input",
3181
3538
  {
3182
3539
  type: "range",
@@ -3198,9 +3555,9 @@ var SliderNode = ({ node }) => {
3198
3555
  var TooltipNode = ({ node }) => {
3199
3556
  const state = useUiState();
3200
3557
  const content = String(resolveBindable(node.content, state) ?? "");
3201
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
3202
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: cn("aui-ui-tooltip-trigger inline-flex", node.className), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(UiNodeView, { node: node.child }) }) }),
3203
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: node.side ?? "top", children: content })
3558
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Tooltip, { children: [
3559
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: cn("aui-ui-tooltip-trigger inline-flex", node.className), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(UiNodeView, { node: node.child }) }) }),
3560
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TooltipContent, { side: node.side ?? "top", children: content })
3204
3561
  ] }) });
3205
3562
  };
3206
3563
  var DraggableNode = ({ node }) => {
@@ -3208,8 +3565,8 @@ var DraggableNode = ({ node }) => {
3208
3565
  const snapBack = node.snapBack ?? true;
3209
3566
  const axis = node.axis ?? "both";
3210
3567
  const dragProp = axis === "both" ? true : axis;
3211
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3212
- import_react12.motion.div,
3568
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3569
+ import_react15.motion.div,
3213
3570
  {
3214
3571
  drag: dragProp,
3215
3572
  dragMomentum: false,
@@ -3220,7 +3577,7 @@ var DraggableNode = ({ node }) => {
3220
3577
  "aui-ui-draggable inline-block cursor-grab touch-none",
3221
3578
  node.className
3222
3579
  ),
3223
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(UiNodeView, { node: node.child })
3580
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(UiNodeView, { node: node.child })
3224
3581
  }
3225
3582
  );
3226
3583
  };
@@ -3230,8 +3587,8 @@ var CustomNode = ({ node }) => {
3230
3587
  const Renderer = registry[node.name];
3231
3588
  if (!Renderer) return null;
3232
3589
  const resolvedProps = resolveProps(node.props ?? {}, state);
3233
- const children = node.children?.map((child, i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(UiNodeView, { node: child }, child.id ?? i));
3234
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Renderer, { props: resolvedProps, children });
3590
+ const children = node.children?.map((child, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(UiNodeView, { node: child }, child.id ?? i));
3591
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Renderer, { props: resolvedProps, children });
3235
3592
  };
3236
3593
  function resolveProps(props, state) {
3237
3594
  const out = {};
@@ -3242,17 +3599,17 @@ function resolveProps(props, state) {
3242
3599
  }
3243
3600
 
3244
3601
  // src/artifacts/ui/ui-artifact.tsx
3245
- var import_jsx_runtime23 = require("react/jsx-runtime");
3602
+ var import_jsx_runtime26 = require("react/jsx-runtime");
3246
3603
  var UiArtifactView = ({ artifact }) => {
3247
- const [state, dispatch] = (0, import_react14.useReducer)(
3604
+ const [state, dispatch] = (0, import_react17.useReducer)(
3248
3605
  uiStateReducer,
3249
3606
  artifact.initialState ?? {}
3250
3607
  );
3251
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ArtifactCard, { title: artifact.title, kind: "ui", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(UiStateProvider, { state, dispatch, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "aui-ui-root p-3", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(UiNodeView, { node: artifact.root }) }) }) });
3608
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ArtifactCard, { title: artifact.title, kind: "ui", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(UiStateProvider, { state, dispatch, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "aui-ui-root p-3", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(UiNodeView, { node: artifact.root }) }) }) });
3252
3609
  };
3253
3610
 
3254
3611
  // src/artifacts/registry.tsx
3255
- var import_jsx_runtime24 = require("react/jsx-runtime");
3612
+ var import_jsx_runtime27 = require("react/jsx-runtime");
3256
3613
  var defaultArtifactRenderers = {
3257
3614
  chart: ChartArtifactView,
3258
3615
  question: QuestionArtifactView,
@@ -3261,25 +3618,25 @@ var defaultArtifactRenderers = {
3261
3618
  table: TableArtifactView,
3262
3619
  ui: UiArtifactView
3263
3620
  };
3264
- var ArtifactRegistryContext = (0, import_react15.createContext)(
3621
+ var ArtifactRegistryContext = (0, import_react18.createContext)(
3265
3622
  defaultArtifactRenderers
3266
3623
  );
3267
3624
  var ArtifactRegistryProvider = ({ renderers, override, children }) => {
3268
- const merged = (0, import_react15.useMemo)(() => {
3625
+ const merged = (0, import_react18.useMemo)(() => {
3269
3626
  if (!renderers) return defaultArtifactRenderers;
3270
3627
  if (override) return renderers;
3271
3628
  return { ...defaultArtifactRenderers, ...renderers };
3272
3629
  }, [renderers, override]);
3273
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ArtifactRegistryContext.Provider, { value: merged, children });
3630
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ArtifactRegistryContext.Provider, { value: merged, children });
3274
3631
  };
3275
3632
  function useArtifactRegistry() {
3276
- return (0, import_react15.useContext)(ArtifactRegistryContext);
3633
+ return (0, import_react18.useContext)(ArtifactRegistryContext);
3277
3634
  }
3278
3635
  var ArtifactView = ({ artifact }) => {
3279
3636
  const registry = useArtifactRegistry();
3280
3637
  const Renderer = registry[artifact.type] ?? registry.json;
3281
3638
  if (!Renderer) return null;
3282
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Renderer, { artifact });
3639
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Renderer, { artifact });
3283
3640
  };
3284
3641
 
3285
3642
  // src/artifacts/parse.ts
@@ -3355,7 +3712,7 @@ var import_c = __toESM(require("shiki/langs/c.mjs"), 1);
3355
3712
  var import_cpp = __toESM(require("shiki/langs/cpp.mjs"), 1);
3356
3713
  var import_vitesse_dark = __toESM(require("shiki/themes/vitesse-dark.mjs"), 1);
3357
3714
  var import_vitesse_light = __toESM(require("shiki/themes/vitesse-light.mjs"), 1);
3358
- var import_jsx_runtime25 = require("react/jsx-runtime");
3715
+ var import_jsx_runtime28 = require("react/jsx-runtime");
3359
3716
  var SHIKI_THEME_DARK = "vitesse-dark";
3360
3717
  var SHIKI_THEME_LIGHT = "vitesse-light";
3361
3718
  var highlighterPromise = null;
@@ -3393,8 +3750,8 @@ var ShikiSyntaxHighlighter = ({
3393
3750
  language,
3394
3751
  code
3395
3752
  }) => {
3396
- const [html, setHtml] = (0, import_react16.useState)(null);
3397
- (0, import_react16.useEffect)(() => {
3753
+ const [html, setHtml] = (0, import_react19.useState)(null);
3754
+ (0, import_react19.useEffect)(() => {
3398
3755
  let cancelled = false;
3399
3756
  (async () => {
3400
3757
  try {
@@ -3424,13 +3781,13 @@ var ShikiSyntaxHighlighter = ({
3424
3781
  try {
3425
3782
  const parsed = JSON.parse(code);
3426
3783
  if (isArtifact(parsed)) {
3427
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ArtifactView, { artifact: parsed });
3784
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ArtifactView, { artifact: parsed });
3428
3785
  }
3429
3786
  } catch {
3430
3787
  }
3431
3788
  }
3432
3789
  if (html) {
3433
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3790
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3434
3791
  "div",
3435
3792
  {
3436
3793
  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",
@@ -3438,14 +3795,14 @@ var ShikiSyntaxHighlighter = ({
3438
3795
  }
3439
3796
  );
3440
3797
  }
3441
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Pre, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Code2, { children: code }) });
3798
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Pre, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Code2, { children: code }) });
3442
3799
  };
3443
3800
  var syntax_highlighter_default = ShikiSyntaxHighlighter;
3444
3801
 
3445
3802
  // src/chat/markdown-text.tsx
3446
- var import_jsx_runtime26 = require("react/jsx-runtime");
3803
+ var import_jsx_runtime29 = require("react/jsx-runtime");
3447
3804
  var MarkdownTextImpl = () => {
3448
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3805
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3449
3806
  import_react_markdown.MarkdownTextPrimitive,
3450
3807
  {
3451
3808
  remarkPlugins: [import_remark_gfm.default, import_remark_math.default],
@@ -3458,7 +3815,7 @@ var MarkdownTextImpl = () => {
3458
3815
  }
3459
3816
  );
3460
3817
  };
3461
- var MarkdownText = (0, import_react17.memo)(MarkdownTextImpl);
3818
+ var MarkdownText = (0, import_react20.memo)(MarkdownTextImpl);
3462
3819
  var CodeHeader = ({ language, code }) => {
3463
3820
  const { isCopied, copyToClipboard } = useCopyToClipboard();
3464
3821
  if (isArtifactFenceLanguage(language)) return null;
@@ -3466,20 +3823,20 @@ var CodeHeader = ({ language, code }) => {
3466
3823
  if (!code || isCopied) return;
3467
3824
  copyToClipboard(code);
3468
3825
  };
3469
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "aui-code-header flex items-center justify-between rounded-t-lg border border-b-0 border-border/50 bg-code-header-bg px-4 py-2", children: [
3470
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex items-center gap-2 text-xs font-semibold tracking-wide text-muted-foreground/80 uppercase", children: [
3471
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "inline-block h-2 w-2 rounded-full bg-primary/40" }),
3826
+ return /* @__PURE__ */ (0, import_jsx_runtime29.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: [
3827
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "flex items-center gap-2 text-xs font-semibold tracking-wide text-muted-foreground/80 uppercase", children: [
3828
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "inline-block h-2 w-2 rounded-full bg-primary/40" }),
3472
3829
  language
3473
3830
  ] }),
3474
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3831
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
3475
3832
  TooltipIconButton,
3476
3833
  {
3477
3834
  tooltip: isCopied ? "Copied!" : "Copy",
3478
3835
  onClick: onCopy,
3479
3836
  className: "transition-colors hover:text-foreground",
3480
3837
  children: [
3481
- !isCopied && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react4.CopyIcon, { className: "h-3.5 w-3.5" }),
3482
- isCopied && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react4.CheckIcon, { className: "h-3.5 w-3.5 text-emerald-500" })
3838
+ !isCopied && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react4.CopyIcon, { className: "h-3.5 w-3.5" }),
3839
+ isCopied && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react4.CheckIcon, { className: "h-3.5 w-3.5 text-emerald-500" })
3483
3840
  ]
3484
3841
  }
3485
3842
  )
@@ -3488,7 +3845,7 @@ var CodeHeader = ({ language, code }) => {
3488
3845
  var useCopyToClipboard = ({
3489
3846
  copiedDuration = 3e3
3490
3847
  } = {}) => {
3491
- const [isCopied, setIsCopied] = (0, import_react17.useState)(false);
3848
+ const [isCopied, setIsCopied] = (0, import_react20.useState)(false);
3492
3849
  const copyToClipboard = (value) => {
3493
3850
  if (!value) return;
3494
3851
  navigator.clipboard.writeText(value).then(() => {
@@ -3499,7 +3856,7 @@ var useCopyToClipboard = ({
3499
3856
  return { isCopied, copyToClipboard };
3500
3857
  };
3501
3858
  var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownComponents)({
3502
- h1: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3859
+ h1: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3503
3860
  "h1",
3504
3861
  {
3505
3862
  className: cn(
@@ -3509,7 +3866,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3509
3866
  ...props
3510
3867
  }
3511
3868
  ),
3512
- h2: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3869
+ h2: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3513
3870
  "h2",
3514
3871
  {
3515
3872
  className: cn(
@@ -3519,7 +3876,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3519
3876
  ...props
3520
3877
  }
3521
3878
  ),
3522
- h3: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3879
+ h3: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3523
3880
  "h3",
3524
3881
  {
3525
3882
  className: cn(
@@ -3529,7 +3886,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3529
3886
  ...props
3530
3887
  }
3531
3888
  ),
3532
- h4: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3889
+ h4: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3533
3890
  "h4",
3534
3891
  {
3535
3892
  className: cn(
@@ -3539,7 +3896,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3539
3896
  ...props
3540
3897
  }
3541
3898
  ),
3542
- h5: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3899
+ h5: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3543
3900
  "h5",
3544
3901
  {
3545
3902
  className: cn(
@@ -3549,7 +3906,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3549
3906
  ...props
3550
3907
  }
3551
3908
  ),
3552
- h6: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3909
+ h6: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3553
3910
  "h6",
3554
3911
  {
3555
3912
  className: cn(
@@ -3559,7 +3916,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3559
3916
  ...props
3560
3917
  }
3561
3918
  ),
3562
- p: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3919
+ p: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3563
3920
  "p",
3564
3921
  {
3565
3922
  className: cn(
@@ -3569,7 +3926,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3569
3926
  ...props
3570
3927
  }
3571
3928
  ),
3572
- a: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3929
+ a: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3573
3930
  "a",
3574
3931
  {
3575
3932
  className: cn(
@@ -3581,7 +3938,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3581
3938
  ...props
3582
3939
  }
3583
3940
  ),
3584
- blockquote: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3941
+ blockquote: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3585
3942
  "blockquote",
3586
3943
  {
3587
3944
  className: cn(
@@ -3591,7 +3948,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3591
3948
  ...props
3592
3949
  }
3593
3950
  ),
3594
- ul: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3951
+ ul: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3595
3952
  "ul",
3596
3953
  {
3597
3954
  className: cn(
@@ -3601,7 +3958,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3601
3958
  ...props
3602
3959
  }
3603
3960
  ),
3604
- ol: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3961
+ ol: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3605
3962
  "ol",
3606
3963
  {
3607
3964
  className: cn(
@@ -3611,7 +3968,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3611
3968
  ...props
3612
3969
  }
3613
3970
  ),
3614
- hr: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3971
+ hr: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3615
3972
  "hr",
3616
3973
  {
3617
3974
  className: cn(
@@ -3621,14 +3978,14 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3621
3978
  ...props
3622
3979
  }
3623
3980
  ),
3624
- table: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "my-4 w-full overflow-x-auto rounded-lg border border-border/50", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3981
+ table: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "my-4 w-full overflow-x-auto rounded-lg border border-border/50", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3625
3982
  "table",
3626
3983
  {
3627
3984
  className: cn("aui-md-table w-full border-collapse text-sm", className),
3628
3985
  ...props
3629
3986
  }
3630
3987
  ) }),
3631
- th: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3988
+ th: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3632
3989
  "th",
3633
3990
  {
3634
3991
  className: cn(
@@ -3638,7 +3995,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3638
3995
  ...props
3639
3996
  }
3640
3997
  ),
3641
- td: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3998
+ td: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3642
3999
  "td",
3643
4000
  {
3644
4001
  className: cn(
@@ -3648,7 +4005,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3648
4005
  ...props
3649
4006
  }
3650
4007
  ),
3651
- tr: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4008
+ tr: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3652
4009
  "tr",
3653
4010
  {
3654
4011
  className: cn(
@@ -3658,8 +4015,8 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3658
4015
  ...props
3659
4016
  }
3660
4017
  ),
3661
- li: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("li", { className: cn("aui-md-li leading-[1.7]", className), ...props }),
3662
- sup: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4018
+ li: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("li", { className: cn("aui-md-li leading-[1.7]", className), ...props }),
4019
+ sup: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3663
4020
  "sup",
3664
4021
  {
3665
4022
  className: cn(
@@ -3669,7 +4026,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3669
4026
  ...props
3670
4027
  }
3671
4028
  ),
3672
- pre: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4029
+ pre: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3673
4030
  "pre",
3674
4031
  {
3675
4032
  className: cn(
@@ -3681,7 +4038,7 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3681
4038
  ),
3682
4039
  code: function Code({ className, ...props }) {
3683
4040
  const isCodeBlock = (0, import_react_markdown.useIsMarkdownCodeBlock)();
3684
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4041
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3685
4042
  "code",
3686
4043
  {
3687
4044
  className: cn(
@@ -3692,20 +4049,20 @@ var defaultComponents = (0, import_react_markdown.unstable_memoizeMarkdownCompon
3692
4049
  }
3693
4050
  );
3694
4051
  },
3695
- strong: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("strong", { className: cn("font-semibold text-foreground", className), ...props }),
3696
- em: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("em", { className: cn("italic", className), ...props }),
4052
+ strong: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("strong", { className: cn("font-semibold text-foreground", className), ...props }),
4053
+ em: ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("em", { className: cn("italic", className), ...props }),
3697
4054
  CodeHeader
3698
4055
  });
3699
4056
 
3700
4057
  // src/chat/tool-fallback.tsx
3701
- var import_react21 = require("react");
4058
+ var import_react24 = require("react");
3702
4059
  var import_lucide_react5 = require("lucide-react");
3703
- var import_react22 = require("@assistant-ui/react");
4060
+ var import_react25 = require("@assistant-ui/react");
3704
4061
 
3705
4062
  // src/ui/shimmer.tsx
3706
- var import_react18 = require("motion/react");
3707
- var import_react19 = require("react");
3708
- var import_jsx_runtime27 = require("react/jsx-runtime");
4063
+ var import_react21 = require("motion/react");
4064
+ var import_react22 = require("react");
4065
+ var import_jsx_runtime30 = require("react/jsx-runtime");
3709
4066
  var ShimmerComponent = ({
3710
4067
  children,
3711
4068
  as: Component = "p",
@@ -3713,14 +4070,14 @@ var ShimmerComponent = ({
3713
4070
  duration = 2,
3714
4071
  spread = 2
3715
4072
  }) => {
3716
- const MotionComponent = import_react18.motion.create(
4073
+ const MotionComponent = import_react21.motion.create(
3717
4074
  Component
3718
4075
  );
3719
- const dynamicSpread = (0, import_react19.useMemo)(
4076
+ const dynamicSpread = (0, import_react22.useMemo)(
3720
4077
  () => (children?.length ?? 0) * spread,
3721
4078
  [children, spread]
3722
4079
  );
3723
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4080
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
3724
4081
  MotionComponent,
3725
4082
  {
3726
4083
  animate: { backgroundPosition: "0% center" },
@@ -3743,11 +4100,11 @@ var ShimmerComponent = ({
3743
4100
  }
3744
4101
  );
3745
4102
  };
3746
- var Shimmer = (0, import_react19.memo)(ShimmerComponent);
4103
+ var Shimmer = (0, import_react22.memo)(ShimmerComponent);
3747
4104
 
3748
4105
  // src/chat/motion.tsx
3749
- var import_react20 = require("motion/react");
3750
- var import_jsx_runtime28 = require("react/jsx-runtime");
4106
+ var import_react23 = require("motion/react");
4107
+ var import_jsx_runtime31 = require("react/jsx-runtime");
3751
4108
  var luxuryEase = [0.16, 1, 0.3, 1];
3752
4109
  var TOOL_ENTER_MS = 0.78;
3753
4110
  var TOOL_EXIT_MS = 0.28;
@@ -3773,10 +4130,10 @@ function toolMotionState(reduced, entering, variant) {
3773
4130
  return entering ? { opacity: 0, y: 14, filter: "blur(10px)" } : { opacity: 1, y: 0, filter: "blur(0px)" };
3774
4131
  }
3775
4132
  function ToolMotion({ children, className, motionKey }) {
3776
- const reduced = (0, import_react20.useReducedMotion)() ?? false;
4133
+ const reduced = (0, import_react23.useReducedMotion)() ?? false;
3777
4134
  const { enter, exit } = toolPresenceTransition(reduced);
3778
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3779
- import_react20.motion.div,
4135
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4136
+ import_react23.motion.div,
3780
4137
  {
3781
4138
  className: cn("aui-tool-motion w-full min-w-0", className),
3782
4139
  initial: toolMotionState(reduced, true, "settled"),
@@ -3795,11 +4152,11 @@ function ToolPresence({
3795
4152
  className,
3796
4153
  variant = "settled"
3797
4154
  }) {
3798
- const reduced = (0, import_react20.useReducedMotion)() ?? false;
4155
+ const reduced = (0, import_react23.useReducedMotion)() ?? false;
3799
4156
  const { enter, exit } = toolPresenceTransition(reduced);
3800
4157
  const enterTransition = variant === "executing" ? { duration: reduced ? 0.3 : 0.52, ease: luxuryEase } : enter;
3801
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react20.AnimatePresence, { mode: "wait", initial: true, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3802
- import_react20.motion.div,
4158
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react23.AnimatePresence, { mode: "wait", initial: true, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4159
+ import_react23.motion.div,
3803
4160
  {
3804
4161
  className: cn("aui-tool-presence w-full min-w-0", className),
3805
4162
  initial: toolMotionState(reduced, true, variant),
@@ -3819,8 +4176,8 @@ function ToolBodyPresence({
3819
4176
  children,
3820
4177
  className
3821
4178
  }) {
3822
- const reduced = (0, import_react20.useReducedMotion)() ?? false;
3823
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4179
+ const reduced = (0, import_react23.useReducedMotion)() ?? false;
4180
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
3824
4181
  "div",
3825
4182
  {
3826
4183
  className: cn(
@@ -3828,7 +4185,7 @@ function ToolBodyPresence({
3828
4185
  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)]"
3829
4186
  ),
3830
4187
  style: { gridTemplateRows: open ? "1fr" : "0fr" },
3831
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "min-h-0 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4188
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "min-h-0 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
3832
4189
  "div",
3833
4190
  {
3834
4191
  className: cn(
@@ -3844,7 +4201,7 @@ function ToolBodyPresence({
3844
4201
  }
3845
4202
 
3846
4203
  // src/chat/tool-fallback.tsx
3847
- var import_jsx_runtime29 = require("react/jsx-runtime");
4204
+ var import_jsx_runtime32 = require("react/jsx-runtime");
3848
4205
  function detectRunning({
3849
4206
  status,
3850
4207
  result,
@@ -3858,7 +4215,7 @@ function detectRunning({
3858
4215
  }
3859
4216
  function useToolRunning(props) {
3860
4217
  const { isRunning: streamRunning } = useTimbalRuntime();
3861
- const partStatus = (0, import_react22.useAuiState)((s) => s.part.status);
4218
+ const partStatus = (0, import_react25.useAuiState)((s) => s.part.status);
3862
4219
  return detectRunning({
3863
4220
  status: partStatus ?? props.status,
3864
4221
  result: props.result,
@@ -3876,8 +4233,8 @@ function formatToolResult(result) {
3876
4233
  return String(result);
3877
4234
  }
3878
4235
  }
3879
- var TimelineActionLabel = ({ action, detail, shimmer = false }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "inline-flex min-w-0 max-w-full items-baseline gap-1", children: [
3880
- action ? shimmer ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4236
+ var TimelineActionLabel = ({ action, detail, shimmer = false }) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "inline-flex min-w-0 max-w-full items-baseline gap-1", children: [
4237
+ action ? shimmer ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
3881
4238
  Shimmer,
3882
4239
  {
3883
4240
  as: "span",
@@ -3886,10 +4243,10 @@ var TimelineActionLabel = ({ action, detail, shimmer = false }) => /* @__PURE__
3886
4243
  spread: 2.5,
3887
4244
  children: action
3888
4245
  }
3889
- ) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: studioTimelineActionClass, children: action }) : null,
3890
- detail ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: studioTimelineDetailClass, children: detail }) : null
4246
+ ) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: studioTimelineActionClass, children: action }) : null,
4247
+ detail ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: studioTimelineDetailClass, children: detail }) : null
3891
4248
  ] });
3892
- var TimelineHoverChevron = ({ expanded }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4249
+ var TimelineHoverChevron = ({ expanded }) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
3893
4250
  import_lucide_react5.ChevronRightIcon,
3894
4251
  {
3895
4252
  className: studioTimelineChevronClass(expanded),
@@ -3897,9 +4254,9 @@ var TimelineHoverChevron = ({ expanded }) => /* @__PURE__ */ (0, import_jsx_runt
3897
4254
  }
3898
4255
  );
3899
4256
  var ToolPanel = ({ toolName, argsText, result, isError }) => {
3900
- const [open, setOpen] = (0, import_react21.useState)(false);
4257
+ const [open, setOpen] = (0, import_react24.useState)(false);
3901
4258
  const detail = formatToolLabel(toolName);
3902
- const formattedArgs = (0, import_react21.useMemo)(() => {
4259
+ const formattedArgs = (0, import_react24.useMemo)(() => {
3903
4260
  if (!argsText || argsText === "{}") return null;
3904
4261
  try {
3905
4262
  return JSON.stringify(JSON.parse(argsText), null, 2);
@@ -3907,17 +4264,17 @@ var ToolPanel = ({ toolName, argsText, result, isError }) => {
3907
4264
  return argsText;
3908
4265
  }
3909
4266
  }, [argsText]);
3910
- const formattedResult = (0, import_react21.useMemo)(() => {
4267
+ const formattedResult = (0, import_react24.useMemo)(() => {
3911
4268
  if (result === void 0 || result === null) return null;
3912
4269
  return formatToolResult(result);
3913
4270
  }, [result]);
3914
4271
  const hasBody = Boolean(formattedArgs || formattedResult);
3915
4272
  const action = isError ? "Failed" : "Used";
3916
4273
  if (!hasBody) {
3917
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "aui-tool-row w-full min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TimelineActionLabel, { action, detail }) });
4274
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "aui-tool-row w-full min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TimelineActionLabel, { action, detail }) });
3918
4275
  }
3919
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "aui-tool-row w-full min-w-0", children: [
3920
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4276
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "aui-tool-row w-full min-w-0", children: [
4277
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
3921
4278
  "button",
3922
4279
  {
3923
4280
  type: "button",
@@ -3925,7 +4282,7 @@ var ToolPanel = ({ toolName, argsText, result, isError }) => {
3925
4282
  "aria-expanded": open,
3926
4283
  "aria-label": `${action} ${detail}`,
3927
4284
  className: studioTimelineRowButtonClass,
3928
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4285
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
3929
4286
  "span",
3930
4287
  {
3931
4288
  className: cn(
@@ -3934,37 +4291,37 @@ var ToolPanel = ({ toolName, argsText, result, isError }) => {
3934
4291
  "text-foreground"
3935
4292
  ),
3936
4293
  children: [
3937
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TimelineActionLabel, { action, detail }),
3938
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TimelineHoverChevron, { expanded: open })
4294
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TimelineActionLabel, { action, detail }),
4295
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TimelineHoverChevron, { expanded: open })
3939
4296
  ]
3940
4297
  }
3941
4298
  )
3942
4299
  }
3943
4300
  ),
3944
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4301
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
3945
4302
  ToolBodyPresence,
3946
4303
  {
3947
4304
  open,
3948
4305
  className: cn(studioTimelineBodyPadClass, "gap-2"),
3949
4306
  children: [
3950
- formattedArgs ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4307
+ formattedArgs ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
3951
4308
  "div",
3952
4309
  {
3953
4310
  className: cn(
3954
4311
  studioComposerIoWellClass,
3955
4312
  "max-h-48 overflow-auto px-2.5 py-2"
3956
4313
  ),
3957
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("pre", { className: "whitespace-pre-wrap break-words font-mono text-[11px] font-normal leading-relaxed text-foreground", children: formattedArgs })
4314
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("pre", { className: "whitespace-pre-wrap break-words font-mono text-[11px] font-normal leading-relaxed text-foreground", children: formattedArgs })
3958
4315
  }
3959
4316
  ) : null,
3960
- formattedResult ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4317
+ formattedResult ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
3961
4318
  "div",
3962
4319
  {
3963
4320
  className: cn(
3964
4321
  studioComposerIoWellClass,
3965
4322
  "max-h-48 overflow-auto px-2.5 py-2"
3966
4323
  ),
3967
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("pre", { className: "whitespace-pre-wrap break-words font-mono text-[11px] font-normal leading-relaxed text-foreground", children: formattedResult })
4324
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("pre", { className: "whitespace-pre-wrap break-words font-mono text-[11px] font-normal leading-relaxed text-foreground", children: formattedResult })
3968
4325
  }
3969
4326
  ) : null
3970
4327
  ]
@@ -3981,20 +4338,20 @@ var ToolFallbackImpl = ({
3981
4338
  const isRunning = useToolRunning({ status, result });
3982
4339
  const isError = status?.type === "incomplete" && status.reason !== "cancelled";
3983
4340
  const presenceKey = isRunning ? "running" : isError ? "error" : "complete";
3984
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4341
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
3985
4342
  ToolPresence,
3986
4343
  {
3987
4344
  presenceKey,
3988
4345
  variant: isRunning ? "executing" : "settled",
3989
4346
  className: "py-0.5",
3990
- children: isRunning ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "aui-tool-running", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4347
+ children: isRunning ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "aui-tool-running", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
3991
4348
  TimelineActionLabel,
3992
4349
  {
3993
4350
  action: "Using",
3994
4351
  detail: formatToolLabel(toolName),
3995
4352
  shimmer: true
3996
4353
  }
3997
- ) }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4354
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
3998
4355
  ToolPanel,
3999
4356
  {
4000
4357
  toolName,
@@ -4006,13 +4363,13 @@ var ToolFallbackImpl = ({
4006
4363
  }
4007
4364
  );
4008
4365
  };
4009
- var ToolFallback = (0, import_react21.memo)(
4366
+ var ToolFallback = (0, import_react24.memo)(
4010
4367
  ToolFallbackImpl
4011
4368
  );
4012
4369
  ToolFallback.displayName = "ToolFallback";
4013
4370
 
4014
4371
  // src/artifacts/tool-artifact.tsx
4015
- var import_jsx_runtime30 = require("react/jsx-runtime");
4372
+ var import_jsx_runtime33 = require("react/jsx-runtime");
4016
4373
  var ToolArtifactFallback = (props) => {
4017
4374
  const registry = useArtifactRegistry();
4018
4375
  const isRunning = useToolRunning({
@@ -4024,24 +4381,24 @@ var ToolArtifactFallback = (props) => {
4024
4381
  if (artifact) {
4025
4382
  const Renderer = registry[artifact.type];
4026
4383
  if (Renderer) {
4027
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4384
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4028
4385
  ToolMotion,
4029
4386
  {
4030
4387
  motionKey: `artifact-${artifact.type}`,
4031
4388
  className: "aui-tool-artifact",
4032
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Renderer, { artifact })
4389
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Renderer, { artifact })
4033
4390
  }
4034
4391
  );
4035
4392
  }
4036
4393
  }
4037
4394
  }
4038
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ToolFallback, { ...props });
4395
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ToolFallback, { ...props });
4039
4396
  };
4040
4397
 
4041
4398
  // src/chat/composer.tsx
4042
- var import_react23 = require("@assistant-ui/react");
4399
+ var import_react26 = require("@assistant-ui/react");
4043
4400
  var import_lucide_react6 = require("lucide-react");
4044
- var import_jsx_runtime31 = require("react/jsx-runtime");
4401
+ var import_jsx_runtime34 = require("react/jsx-runtime");
4045
4402
  var Composer = ({
4046
4403
  placeholder = "Send a message...",
4047
4404
  showAttachments,
@@ -4052,10 +4409,10 @@ var Composer = ({
4052
4409
  }) => {
4053
4410
  const attachmentsEnabled = useTimbalAttachmentsEnabled();
4054
4411
  const attachUi = showAttachments !== false && attachmentsEnabled;
4055
- const shell = /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
4056
- attachUi && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ComposerAttachments, {}),
4057
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ComposerInput, { placeholder, autoFocus: !noAutoFocus }),
4058
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4412
+ const shell = /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
4413
+ attachUi && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ComposerAttachments, {}),
4414
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ComposerInput, { placeholder, autoFocus: !noAutoFocus }),
4415
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4059
4416
  ComposerToolbar,
4060
4417
  {
4061
4418
  showAttachments: attachUi,
@@ -4064,15 +4421,15 @@ var Composer = ({
4064
4421
  }
4065
4422
  )
4066
4423
  ] });
4067
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4068
- import_react23.ComposerPrimitive.Root,
4424
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4425
+ import_react26.ComposerPrimitive.Root,
4069
4426
  {
4070
4427
  className: cn(
4071
4428
  "aui-composer-root relative flex w-full flex-col",
4072
4429
  className
4073
4430
  ),
4074
- children: attachUi ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4075
- import_react23.ComposerPrimitive.AttachmentDropzone,
4431
+ children: attachUi ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4432
+ import_react26.ComposerPrimitive.AttachmentDropzone,
4076
4433
  {
4077
4434
  className: cn(
4078
4435
  studioComposeInputShellClass,
@@ -4080,7 +4437,7 @@ var Composer = ({
4080
4437
  ),
4081
4438
  children: shell
4082
4439
  }
4083
- ) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: studioComposeInputShellClass, children: shell })
4440
+ ) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: studioComposeInputShellClass, children: shell })
4084
4441
  }
4085
4442
  );
4086
4443
  };
@@ -4088,7 +4445,7 @@ var ComposerInput = ({
4088
4445
  placeholder,
4089
4446
  autoFocus
4090
4447
  }) => {
4091
- const composer = (0, import_react23.useComposerRuntime)();
4448
+ const composer = (0, import_react26.useComposerRuntime)();
4092
4449
  const onKeyDown = (e) => {
4093
4450
  if (e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing) {
4094
4451
  e.preventDefault();
@@ -4100,8 +4457,8 @@ var ComposerInput = ({
4100
4457
  el.style.height = "auto";
4101
4458
  el.style.height = `${Math.min(el.scrollHeight, 240)}px`;
4102
4459
  };
4103
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4104
- import_react23.ComposerPrimitive.Input,
4460
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4461
+ import_react26.ComposerPrimitive.Input,
4105
4462
  {
4106
4463
  placeholder,
4107
4464
  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",
@@ -4114,17 +4471,17 @@ var ComposerInput = ({
4114
4471
  );
4115
4472
  };
4116
4473
  var ComposerToolbar = ({ showAttachments, toolbar, sendTooltip }) => {
4117
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "aui-composer-action-wrapper relative z-[1] flex items-center justify-between gap-1 bg-composer-bg px-2.5 pb-2.5", children: [
4118
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-1", children: [
4119
- showAttachments && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ComposerAddAttachment, {}),
4474
+ return /* @__PURE__ */ (0, import_jsx_runtime34.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: [
4475
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-1", children: [
4476
+ showAttachments && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ComposerAddAttachment, {}),
4120
4477
  toolbar
4121
4478
  ] }),
4122
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ComposerSendOrCancel, { sendTooltip })
4479
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ComposerSendOrCancel, { sendTooltip })
4123
4480
  ] });
4124
4481
  };
4125
4482
  var ComposerSendOrCancel = ({ sendTooltip }) => {
4126
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
4127
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react23.AuiIf, { condition: (s) => !s.thread.isRunning, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react23.ComposerPrimitive.Send, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4483
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
4484
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react26.AuiIf, { condition: (s) => !s.thread.isRunning, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react26.ComposerPrimitive.Send, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4128
4485
  TooltipIconButton,
4129
4486
  {
4130
4487
  tooltip: sendTooltip,
@@ -4132,34 +4489,34 @@ var ComposerSendOrCancel = ({ sendTooltip }) => {
4132
4489
  type: "submit",
4133
4490
  className: "aui-composer-send shrink-0 disabled:opacity-30",
4134
4491
  "aria-label": "Send message",
4135
- children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react6.ArrowUpIcon, { className: "aui-composer-send-icon size-4" })
4492
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react6.ArrowUpIcon, { className: "aui-composer-send-icon size-4" })
4136
4493
  }
4137
4494
  ) }) }),
4138
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react23.AuiIf, { condition: (s) => s.thread.isRunning, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react23.ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4495
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react26.AuiIf, { condition: (s) => s.thread.isRunning, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react26.ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4139
4496
  TooltipIconButton,
4140
4497
  {
4141
4498
  tooltip: "Stop generating",
4142
4499
  variant: "primary",
4143
4500
  className: "aui-composer-cancel shrink-0",
4144
4501
  "aria-label": "Stop generating",
4145
- children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react6.SquareIcon, { className: "aui-composer-cancel-icon size-3 fill-current" })
4502
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react6.SquareIcon, { className: "aui-composer-cancel-icon size-3 fill-current" })
4146
4503
  }
4147
4504
  ) }) })
4148
4505
  ] });
4149
4506
  };
4150
4507
 
4151
4508
  // src/chat/suggestions.tsx
4152
- var import_react24 = require("react");
4153
- var import_react25 = require("@assistant-ui/react");
4509
+ var import_react27 = require("react");
4510
+ var import_react28 = require("@assistant-ui/react");
4154
4511
  var import_lucide_react7 = require("lucide-react");
4155
- var import_jsx_runtime32 = require("react/jsx-runtime");
4512
+ var import_jsx_runtime35 = require("react/jsx-runtime");
4156
4513
  var Suggestions = ({
4157
4514
  suggestions,
4158
4515
  className
4159
4516
  }) => {
4160
4517
  const items = useResolvedSuggestions(suggestions);
4161
4518
  if (!items || items.length === 0) return null;
4162
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4519
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4163
4520
  "div",
4164
4521
  {
4165
4522
  className: cn(
@@ -4168,17 +4525,17 @@ var Suggestions = ({
4168
4525
  ),
4169
4526
  role: "list",
4170
4527
  "aria-label": "Suggested prompts",
4171
- children: items.map((suggestion, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SuggestionRow, { suggestion }, (suggestion.prompt ?? suggestion.title) + i))
4528
+ children: items.map((suggestion, i) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SuggestionRow, { suggestion }, (suggestion.prompt ?? suggestion.title) + i))
4172
4529
  }
4173
4530
  );
4174
4531
  };
4175
4532
  var SuggestionRow = ({ suggestion }) => {
4176
- const runtime = (0, import_react25.useThreadRuntime)();
4533
+ const runtime = (0, import_react28.useThreadRuntime)();
4177
4534
  const onClick = () => {
4178
4535
  const text = suggestion.prompt ?? suggestion.title;
4179
4536
  runtime.append({ role: "user", content: [{ type: "text", text }] });
4180
4537
  };
4181
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
4538
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
4182
4539
  "button",
4183
4540
  {
4184
4541
  type: "button",
@@ -4186,20 +4543,20 @@ var SuggestionRow = ({ suggestion }) => {
4186
4543
  onClick,
4187
4544
  className: cn("aui-thread-suggestion", studioListRowButtonClass),
4188
4545
  children: [
4189
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "aui-thread-suggestion-icon shrink-0 text-muted-foreground", children: suggestion.icon ?? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react7.ArrowUpIcon, { className: "size-4", strokeWidth: 1.75, "aria-hidden": true }) }),
4190
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "aui-thread-suggestion-text min-w-0 flex-1 text-left", children: [
4191
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "aui-thread-suggestion-text-1 block truncate text-sm font-normal text-foreground", children: suggestion.title }),
4192
- suggestion.description && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "aui-thread-suggestion-text-2 mt-0.5 block truncate text-xs text-muted-foreground", children: suggestion.description })
4546
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "aui-thread-suggestion-icon shrink-0 text-muted-foreground", children: suggestion.icon ?? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_lucide_react7.ArrowUpIcon, { className: "size-4", strokeWidth: 1.75, "aria-hidden": true }) }),
4547
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "aui-thread-suggestion-text min-w-0 flex-1 text-left", children: [
4548
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "aui-thread-suggestion-text-1 block truncate text-sm font-normal text-foreground", children: suggestion.title }),
4549
+ suggestion.description && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "aui-thread-suggestion-text-2 mt-0.5 block truncate text-xs text-muted-foreground", children: suggestion.description })
4193
4550
  ] })
4194
4551
  ]
4195
4552
  }
4196
4553
  );
4197
4554
  };
4198
4555
  function useResolvedSuggestions(source) {
4199
- const [resolved, setResolved] = (0, import_react24.useState)(
4556
+ const [resolved, setResolved] = (0, import_react27.useState)(
4200
4557
  () => Array.isArray(source) ? source : void 0
4201
4558
  );
4202
- (0, import_react24.useEffect)(() => {
4559
+ (0, import_react27.useEffect)(() => {
4203
4560
  if (!source) {
4204
4561
  setResolved(void 0);
4205
4562
  return;
@@ -4218,7 +4575,7 @@ function useResolvedSuggestions(source) {
4218
4575
  cancelled = true;
4219
4576
  };
4220
4577
  }, [source]);
4221
- return (0, import_react24.useMemo)(() => resolved, [resolved]);
4578
+ return (0, import_react27.useMemo)(() => resolved, [resolved]);
4222
4579
  }
4223
4580
 
4224
4581
  // src/design/theme-sanity.ts
@@ -4291,15 +4648,15 @@ function scheduleThemeSanityCheck() {
4291
4648
  }
4292
4649
 
4293
4650
  // src/chat/thread-variant.tsx
4294
- var import_react26 = require("react");
4295
- var ThreadVariantContext = (0, import_react26.createContext)("default");
4651
+ var import_react29 = require("react");
4652
+ var ThreadVariantContext = (0, import_react29.createContext)("default");
4296
4653
  var ThreadVariantProvider = ThreadVariantContext.Provider;
4297
4654
  function useThreadVariant() {
4298
- return (0, import_react26.useContext)(ThreadVariantContext);
4655
+ return (0, import_react29.useContext)(ThreadVariantContext);
4299
4656
  }
4300
4657
 
4301
4658
  // src/chat/thread.tsx
4302
- var import_jsx_runtime33 = require("react/jsx-runtime");
4659
+ var import_jsx_runtime36 = require("react/jsx-runtime");
4303
4660
  var Thread = ({
4304
4661
  className,
4305
4662
  variant = "default",
@@ -4322,17 +4679,17 @@ var Thread = ({
4322
4679
  const EditComposerSlot = components?.EditComposer ?? EditComposer;
4323
4680
  const ScrollToBottomSlot = components?.ScrollToBottom ?? ThreadScrollToBottom;
4324
4681
  const SuggestionsSlot = components?.Suggestions ?? Suggestions;
4325
- (0, import_react27.useEffect)(() => {
4682
+ (0, import_react30.useEffect)(() => {
4326
4683
  scheduleThemeSanityCheck();
4327
4684
  }, []);
4328
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ThreadVariantProvider, { value: variant, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4685
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ThreadVariantProvider, { value: variant, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4329
4686
  ArtifactRegistryProvider,
4330
4687
  {
4331
4688
  renderers: artifacts?.renderers,
4332
4689
  override: artifacts?.override,
4333
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(UiEventProvider, { onEvent: onArtifactEvent ?? (() => {
4334
- }), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4335
- import_react28.ThreadPrimitive.Root,
4690
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(UiEventProvider, { onEvent: onArtifactEvent ?? (() => {
4691
+ }), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4692
+ import_react31.ThreadPrimitive.Root,
4336
4693
  {
4337
4694
  className: cn(
4338
4695
  "aui-root aui-thread-root @container flex h-full flex-col bg-transparent",
@@ -4341,8 +4698,8 @@ var Thread = ({
4341
4698
  ),
4342
4699
  style: { ["--thread-max-width"]: maxWidth },
4343
4700
  "data-thread-variant": variant,
4344
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4345
- import_react28.ThreadPrimitive.Viewport,
4701
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
4702
+ import_react31.ThreadPrimitive.Viewport,
4346
4703
  {
4347
4704
  turnAnchor: "bottom",
4348
4705
  className: cn(
@@ -4350,7 +4707,7 @@ var Thread = ({
4350
4707
  isPanel ? "px-2 pt-2" : "px-4 pt-4"
4351
4708
  ),
4352
4709
  children: [
4353
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4710
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4354
4711
  WelcomeSlot,
4355
4712
  {
4356
4713
  config: welcome,
@@ -4359,8 +4716,8 @@ var Thread = ({
4359
4716
  Suggestions: SuggestionsSlot
4360
4717
  }
4361
4718
  ),
4362
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4363
- import_react28.ThreadPrimitive.Messages,
4719
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4720
+ import_react31.ThreadPrimitive.Messages,
4364
4721
  {
4365
4722
  components: {
4366
4723
  UserMessage: UserMessageSlot,
@@ -4369,14 +4726,14 @@ var Thread = ({
4369
4726
  }
4370
4727
  }
4371
4728
  ),
4372
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4373
- import_react28.ThreadPrimitive.ViewportFooter,
4729
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4730
+ import_react31.ThreadPrimitive.ViewportFooter,
4374
4731
  {
4375
4732
  className: cn(
4376
4733
  "aui-thread-viewport-footer sticky bottom-0 z-10 mt-auto w-full isolate pt-2",
4377
4734
  isPanel ? "bg-card pb-2" : "bg-background pb-4 md:pb-6"
4378
4735
  ),
4379
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4736
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
4380
4737
  "div",
4381
4738
  {
4382
4739
  className: cn(
@@ -4384,8 +4741,8 @@ var Thread = ({
4384
4741
  isPanel ? "gap-2" : "gap-4"
4385
4742
  ),
4386
4743
  children: [
4387
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ScrollToBottomSlot, {}),
4388
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ComposerSlot, { placeholder })
4744
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ScrollToBottomSlot, {}),
4745
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ComposerSlot, { placeholder })
4389
4746
  ]
4390
4747
  }
4391
4748
  )
@@ -4400,13 +4757,13 @@ var Thread = ({
4400
4757
  ) });
4401
4758
  };
4402
4759
  var ThreadScrollToBottom = () => {
4403
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.ThreadPrimitive.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4760
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react31.ThreadPrimitive.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4404
4761
  TooltipIconButton,
4405
4762
  {
4406
4763
  tooltip: "Scroll to bottom",
4407
4764
  variant: "secondary",
4408
4765
  className: "aui-thread-scroll-to-bottom absolute -top-12 z-10 self-center disabled:invisible",
4409
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react8.ArrowDownIcon, { className: "size-4" })
4766
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react8.ArrowDownIcon, { className: "size-4" })
4410
4767
  }
4411
4768
  ) });
4412
4769
  };
@@ -4439,15 +4796,15 @@ var ThreadWelcome = ({
4439
4796
  showWelcomeSuggestions: showWelcomeSuggestionsProp,
4440
4797
  Suggestions: SuggestionsSlot = Suggestions
4441
4798
  }) => {
4442
- const isEmpty = (0, import_react28.useThread)((s) => s.messages.length === 0);
4799
+ const isEmpty = (0, import_react31.useThread)((s) => s.messages.length === 0);
4443
4800
  const isPanel = useThreadVariant() === "panel";
4444
4801
  const showWelcomeSuggestions = showWelcomeSuggestionsProp ?? !isPanel;
4445
4802
  if (!isEmpty) return null;
4446
4803
  const defaultHeading = isPanel ? "Ask about this page" : "How can I help you today?";
4447
4804
  const defaultSubheading = isPanel ? "The assistant can use dashboard context from your app." : "Send a message to start a conversation.";
4448
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "aui-thread-welcome-root mx-auto my-auto flex w-full max-w-(--thread-max-width) grow flex-col", children: [
4449
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "aui-thread-welcome-center flex w-full grow flex-col items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4450
- import_react29.motion.div,
4805
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "aui-thread-welcome-root mx-auto my-auto flex w-full max-w-(--thread-max-width) grow flex-col", children: [
4806
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "aui-thread-welcome-center flex w-full grow flex-col items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
4807
+ import_react32.motion.div,
4451
4808
  {
4452
4809
  className: cn(
4453
4810
  "aui-thread-welcome-message flex flex-col items-center justify-center text-center",
@@ -4457,9 +4814,9 @@ var ThreadWelcome = ({
4457
4814
  initial: "initial",
4458
4815
  animate: "animate",
4459
4816
  children: [
4460
- config?.icon && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react29.motion.div, { variants: welcomeIcon, className: isPanel ? "mb-3" : "mb-5", children: config.icon }),
4461
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4462
- import_react29.motion.h1,
4817
+ config?.icon && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react32.motion.div, { variants: welcomeIcon, className: isPanel ? "mb-3" : "mb-5", children: config.icon }),
4818
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4819
+ import_react32.motion.h1,
4463
4820
  {
4464
4821
  variants: welcomeItem,
4465
4822
  className: cn(
@@ -4469,8 +4826,8 @@ var ThreadWelcome = ({
4469
4826
  children: config?.heading ?? defaultHeading
4470
4827
  }
4471
4828
  ),
4472
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4473
- import_react29.motion.p,
4829
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4830
+ import_react32.motion.p,
4474
4831
  {
4475
4832
  variants: welcomeItem,
4476
4833
  className: "aui-thread-welcome-message-inner mt-1.5 text-muted-foreground text-sm",
@@ -4480,16 +4837,16 @@ var ThreadWelcome = ({
4480
4837
  ]
4481
4838
  }
4482
4839
  ) }),
4483
- showWelcomeSuggestions && suggestions ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "aui-thread-welcome-suggestions mx-auto w-full max-w-(--thread-max-width) px-2", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SuggestionsSlot, { suggestions }) }) : null
4840
+ showWelcomeSuggestions && suggestions ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "aui-thread-welcome-suggestions mx-auto w-full max-w-(--thread-max-width) px-2", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(SuggestionsSlot, { suggestions }) }) : null
4484
4841
  ] });
4485
4842
  };
4486
4843
  var MessageError = () => {
4487
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.MessagePrimitive.Error, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.ErrorPrimitive.Root, { className: "aui-message-error-root mt-2 rounded-md border border-destructive bg-destructive/10 p-3 text-destructive text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.ErrorPrimitive.Message, { className: "aui-message-error-message line-clamp-2" }) }) });
4844
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react31.MessagePrimitive.Error, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react31.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_runtime36.jsx)(import_react31.ErrorPrimitive.Message, { className: "aui-message-error-message line-clamp-2" }) }) });
4488
4845
  };
4489
4846
  var AssistantMessage = () => {
4490
4847
  const isPanel = useThreadVariant() === "panel";
4491
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4492
- import_react28.MessagePrimitive.Root,
4848
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
4849
+ import_react31.MessagePrimitive.Root,
4493
4850
  {
4494
4851
  className: cn(
4495
4852
  "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",
@@ -4497,7 +4854,7 @@ var AssistantMessage = () => {
4497
4854
  ),
4498
4855
  "data-role": "assistant",
4499
4856
  children: [
4500
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4857
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
4501
4858
  "div",
4502
4859
  {
4503
4860
  className: cn(
@@ -4505,8 +4862,8 @@ var AssistantMessage = () => {
4505
4862
  isPanel ? "px-1 text-sm" : "px-2"
4506
4863
  ),
4507
4864
  children: [
4508
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4509
- import_react28.MessagePrimitive.Parts,
4865
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4866
+ import_react31.MessagePrimitive.Parts,
4510
4867
  {
4511
4868
  components: {
4512
4869
  Text: MarkdownText,
@@ -4516,11 +4873,11 @@ var AssistantMessage = () => {
4516
4873
  }
4517
4874
  }
4518
4875
  ),
4519
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(MessageError, {})
4876
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(MessageError, {})
4520
4877
  ]
4521
4878
  }
4522
4879
  ),
4523
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "aui-assistant-message-footer mt-1 mb-3 ml-1 flex", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(AssistantActionBar, {}) })
4880
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "aui-assistant-message-footer mt-1 mb-3 ml-1 flex", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AssistantActionBar, {}) })
4524
4881
  ]
4525
4882
  }
4526
4883
  );
@@ -4533,36 +4890,36 @@ var ASSISTANT_ACTION_ICON_CLASS = cn(
4533
4890
  "[&>span:first-child]:group-hover/tbv2:bg-ghost-fill-hover"
4534
4891
  );
4535
4892
  var AssistantActionBar = () => {
4536
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4537
- import_react28.ActionBarPrimitive.Root,
4893
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
4894
+ import_react31.ActionBarPrimitive.Root,
4538
4895
  {
4539
4896
  hideWhenRunning: true,
4540
4897
  autohide: "never",
4541
4898
  className: "aui-assistant-action-bar-root flex items-center gap-0 bg-transparent px-0 py-0.5 text-muted-foreground/60",
4542
4899
  children: [
4543
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.ActionBarPrimitive.Copy, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4900
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react31.ActionBarPrimitive.Copy, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
4544
4901
  TooltipIconButton,
4545
4902
  {
4546
4903
  tooltip: "Copy",
4547
4904
  variant: "ghost",
4548
4905
  className: ASSISTANT_ACTION_ICON_CLASS,
4549
4906
  children: [
4550
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.AuiIf, { condition: (s) => s.message.isCopied, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react8.CheckIcon, { className: "size-3" }) }),
4551
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.AuiIf, { condition: (s) => !s.message.isCopied, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react8.CopyIcon, { className: "size-3" }) })
4907
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react31.AuiIf, { condition: (s) => s.message.isCopied, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react8.CheckIcon, { className: "size-3" }) }),
4908
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react31.AuiIf, { condition: (s) => !s.message.isCopied, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react8.CopyIcon, { className: "size-3" }) })
4552
4909
  ]
4553
4910
  }
4554
4911
  ) }),
4555
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.ActionBarPrimitive.Reload, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4912
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react31.ActionBarPrimitive.Reload, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4556
4913
  TooltipIconButton,
4557
4914
  {
4558
4915
  tooltip: "Regenerate",
4559
4916
  variant: "ghost",
4560
4917
  className: ASSISTANT_ACTION_ICON_CLASS,
4561
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react8.RefreshCwIcon, { className: "size-3" })
4918
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react8.RefreshCwIcon, { className: "size-3" })
4562
4919
  }
4563
4920
  ) }),
4564
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react28.ActionBarMorePrimitive.Root, { children: [
4565
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.ActionBarMorePrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4921
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_react31.ActionBarMorePrimitive.Root, { children: [
4922
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react31.ActionBarMorePrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4566
4923
  TooltipIconButton,
4567
4924
  {
4568
4925
  tooltip: "More",
@@ -4571,17 +4928,17 @@ var AssistantActionBar = () => {
4571
4928
  ASSISTANT_ACTION_ICON_CLASS,
4572
4929
  "data-[state=open]:text-muted-foreground/80"
4573
4930
  ),
4574
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react8.MoreHorizontalIcon, { className: "size-3" })
4931
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react8.MoreHorizontalIcon, { className: "size-3" })
4575
4932
  }
4576
4933
  ) }),
4577
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4578
- import_react28.ActionBarMorePrimitive.Content,
4934
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4935
+ import_react31.ActionBarMorePrimitive.Content,
4579
4936
  {
4580
4937
  side: "bottom",
4581
4938
  align: "start",
4582
4939
  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",
4583
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.ActionBarPrimitive.ExportMarkdown, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react28.ActionBarMorePrimitive.Item, { className: "aui-action-bar-more-item flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none hover:bg-muted focus:bg-muted", children: [
4584
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react8.DownloadIcon, { className: "size-4 shrink-0" }),
4940
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react31.ActionBarPrimitive.ExportMarkdown, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_react31.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: [
4941
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react8.DownloadIcon, { className: "size-4 shrink-0" }),
4585
4942
  "Export as Markdown"
4586
4943
  ] }) })
4587
4944
  }
@@ -4592,12 +4949,12 @@ var AssistantActionBar = () => {
4592
4949
  );
4593
4950
  };
4594
4951
  var UserMessageText = () => {
4595
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "whitespace-pre-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.MessagePartPrimitive.Text, { smooth: false }) });
4952
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "whitespace-pre-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react31.MessagePartPrimitive.Text, { smooth: false }) });
4596
4953
  };
4597
4954
  var UserMessage = () => {
4598
4955
  const isPanel = useThreadVariant() === "panel";
4599
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4600
- import_react28.MessagePrimitive.Root,
4956
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
4957
+ import_react31.MessagePrimitive.Root,
4601
4958
  {
4602
4959
  className: cn(
4603
4960
  "aui-user-message-root mx-auto flex w-full max-w-(--thread-max-width) flex-col items-end gap-2",
@@ -4605,9 +4962,9 @@ var UserMessage = () => {
4605
4962
  ),
4606
4963
  "data-role": "user",
4607
4964
  children: [
4608
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(UserMessageAttachments, {}),
4609
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4610
- import_react29.motion.div,
4965
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(UserMessageAttachments, {}),
4966
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
4967
+ import_react32.motion.div,
4611
4968
  {
4612
4969
  className: cn(
4613
4970
  "aui-user-message-content relative inline-block max-w-[85%] rounded-2xl bg-bubble-user text-bubble-user-foreground",
@@ -4617,8 +4974,8 @@ var UserMessage = () => {
4617
4974
  animate: { opacity: 1, y: 0, scale: 1 },
4618
4975
  transition: { duration: 0.65, ease: luxuryEase },
4619
4976
  children: [
4620
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.MessagePrimitive.Parts, { components: { Text: UserMessageText } }),
4621
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "aui-user-action-bar-wrapper absolute top-1/2 left-0 -translate-x-full -translate-y-1/2 pr-2", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(UserActionBar, {}) })
4977
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react31.MessagePrimitive.Parts, { components: { Text: UserMessageText } }),
4978
+ /* @__PURE__ */ (0, import_jsx_runtime36.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_runtime36.jsx)(UserActionBar, {}) })
4622
4979
  ]
4623
4980
  }
4624
4981
  )
@@ -4627,42 +4984,42 @@ var UserMessage = () => {
4627
4984
  );
4628
4985
  };
4629
4986
  var UserActionBar = () => {
4630
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4631
- import_react28.ActionBarPrimitive.Root,
4987
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4988
+ import_react31.ActionBarPrimitive.Root,
4632
4989
  {
4633
4990
  hideWhenRunning: true,
4634
4991
  autohide: "always",
4635
4992
  className: "aui-user-action-bar-root flex flex-col items-end",
4636
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.ActionBarPrimitive.Edit, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4993
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react31.ActionBarPrimitive.Edit, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4637
4994
  TooltipIconButton,
4638
4995
  {
4639
4996
  tooltip: "Edit",
4640
4997
  variant: "ghost",
4641
4998
  className: ASSISTANT_ACTION_ICON_CLASS,
4642
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react8.PencilIcon, { className: "size-3" })
4999
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_lucide_react8.PencilIcon, { className: "size-3" })
4643
5000
  }
4644
5001
  ) })
4645
5002
  }
4646
5003
  );
4647
5004
  };
4648
5005
  var EditComposer = () => {
4649
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.MessagePrimitive.Root, { className: "aui-edit-composer-wrapper mx-auto flex w-full max-w-(--thread-max-width) flex-col px-2 py-3", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react28.ComposerPrimitive.Root, { className: "aui-edit-composer-root ml-auto flex w-full max-w-[85%] flex-col rounded-2xl bg-muted", children: [
4650
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4651
- import_react28.ComposerPrimitive.Input,
5006
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react31.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_runtime36.jsxs)(import_react31.ComposerPrimitive.Root, { className: "aui-edit-composer-root ml-auto flex w-full max-w-[85%] flex-col rounded-2xl bg-muted", children: [
5007
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
5008
+ import_react31.ComposerPrimitive.Input,
4652
5009
  {
4653
5010
  className: "aui-edit-composer-input min-h-14 w-full resize-none bg-transparent p-4 text-foreground text-sm outline-none",
4654
5011
  autoFocus: true
4655
5012
  }
4656
5013
  ),
4657
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "aui-edit-composer-footer mx-3 mb-3 flex items-center gap-2 self-end", children: [
4658
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TimbalV2Button, { variant: "ghost", size: "sm", children: "Cancel" }) }),
4659
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react28.ComposerPrimitive.Send, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TimbalV2Button, { variant: "primary", size: "sm", children: "Update" }) })
5014
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "aui-edit-composer-footer mx-3 mb-3 flex items-center gap-2 self-end", children: [
5015
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react31.ComposerPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TimbalV2Button, { variant: "ghost", size: "sm", children: "Cancel" }) }),
5016
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react31.ComposerPrimitive.Send, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TimbalV2Button, { variant: "primary", size: "sm", children: "Update" }) })
4660
5017
  ] })
4661
5018
  ] }) });
4662
5019
  };
4663
5020
 
4664
5021
  // src/chat/chat.tsx
4665
- var import_jsx_runtime34 = require("react/jsx-runtime");
5022
+ var import_jsx_runtime37 = require("react/jsx-runtime");
4666
5023
  function TimbalChat({
4667
5024
  workforceId,
4668
5025
  baseUrl,
@@ -4673,7 +5030,7 @@ function TimbalChat({
4673
5030
  debug,
4674
5031
  ...threadProps
4675
5032
  }) {
4676
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
5033
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4677
5034
  TimbalRuntimeProvider,
4678
5035
  {
4679
5036
  workforceId,
@@ -4683,7 +5040,7 @@ function TimbalChat({
4683
5040
  attachmentsUploadUrl,
4684
5041
  attachmentsAccept,
4685
5042
  debug,
4686
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Thread, { ...threadProps })
5043
+ children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Thread, { ...threadProps })
4687
5044
  }
4688
5045
  );
4689
5046
  }
@@ -4712,7 +5069,7 @@ var overlayListPanelClass = cn(
4712
5069
  );
4713
5070
 
4714
5071
  // src/chat/workforce-selector.tsx
4715
- var import_jsx_runtime35 = require("react/jsx-runtime");
5072
+ var import_jsx_runtime38 = require("react/jsx-runtime");
4716
5073
  var WorkforceSelector = ({
4717
5074
  workforces,
4718
5075
  value,
@@ -4723,7 +5080,7 @@ var WorkforceSelector = ({
4723
5080
  }) => {
4724
5081
  if (workforces.length === 0) return null;
4725
5082
  if (hideWhenSingle && workforces.length === 1) return null;
4726
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
5083
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
4727
5084
  "div",
4728
5085
  {
4729
5086
  className: cn(
@@ -4734,7 +5091,7 @@ var WorkforceSelector = ({
4734
5091
  className
4735
5092
  ),
4736
5093
  children: [
4737
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
5094
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
4738
5095
  "select",
4739
5096
  {
4740
5097
  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",
@@ -4742,15 +5099,15 @@ var WorkforceSelector = ({
4742
5099
  onChange: (e) => onChange(e.target.value),
4743
5100
  "aria-label": placeholder,
4744
5101
  children: [
4745
- !value && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: "", children: placeholder }),
5102
+ !value && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("option", { value: "", children: placeholder }),
4746
5103
  workforces.map((w) => {
4747
5104
  const id = idOf(w);
4748
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { value: id, children: w.name ?? id }, id);
5105
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("option", { value: id, children: w.name ?? id }, id);
4749
5106
  })
4750
5107
  ]
4751
5108
  }
4752
5109
  ),
4753
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
5110
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
4754
5111
  import_lucide_react9.ChevronDownIcon,
4755
5112
  {
4756
5113
  className: "aui-workforce-selector-icon pointer-events-none absolute right-3 size-3.5 text-muted-foreground/70",
@@ -4766,22 +5123,22 @@ function idOf(item) {
4766
5123
  }
4767
5124
 
4768
5125
  // src/hooks/use-workforces.ts
4769
- var import_react30 = require("react");
5126
+ var import_react33 = require("react");
4770
5127
  function useWorkforces(options = {}) {
4771
5128
  const { baseUrl = "/api", fetch: fetchFn, pickInitial, enabled = true } = options;
4772
- const [workforces, setWorkforces] = (0, import_react30.useState)([]);
4773
- const [selectedId, setSelectedId] = (0, import_react30.useState)("");
4774
- const [isLoading, setIsLoading] = (0, import_react30.useState)(enabled);
4775
- const [error, setError] = (0, import_react30.useState)(null);
4776
- const fetchFnRef = (0, import_react30.useRef)(fetchFn ?? authFetch);
4777
- (0, import_react30.useEffect)(() => {
5129
+ const [workforces, setWorkforces] = (0, import_react33.useState)([]);
5130
+ const [selectedId, setSelectedId] = (0, import_react33.useState)("");
5131
+ const [isLoading, setIsLoading] = (0, import_react33.useState)(enabled);
5132
+ const [error, setError] = (0, import_react33.useState)(null);
5133
+ const fetchFnRef = (0, import_react33.useRef)(fetchFn ?? authFetch);
5134
+ (0, import_react33.useEffect)(() => {
4778
5135
  fetchFnRef.current = fetchFn ?? authFetch;
4779
5136
  }, [fetchFn]);
4780
- const pickInitialRef = (0, import_react30.useRef)(pickInitial);
4781
- (0, import_react30.useEffect)(() => {
5137
+ const pickInitialRef = (0, import_react33.useRef)(pickInitial);
5138
+ (0, import_react33.useEffect)(() => {
4782
5139
  pickInitialRef.current = pickInitial;
4783
5140
  }, [pickInitial]);
4784
- const load = (0, import_react30.useMemo)(() => {
5141
+ const load = (0, import_react33.useMemo)(() => {
4785
5142
  return async () => {
4786
5143
  if (!enabled) {
4787
5144
  setIsLoading(false);
@@ -4806,10 +5163,10 @@ function useWorkforces(options = {}) {
4806
5163
  }
4807
5164
  };
4808
5165
  }, [baseUrl, enabled]);
4809
- (0, import_react30.useEffect)(() => {
5166
+ (0, import_react33.useEffect)(() => {
4810
5167
  load();
4811
5168
  }, [load]);
4812
- const selected = (0, import_react30.useMemo)(
5169
+ const selected = (0, import_react33.useMemo)(
4813
5170
  () => workforces.find((w) => idOf2(w) === selectedId),
4814
5171
  [workforces, selectedId]
4815
5172
  );
@@ -4873,7 +5230,7 @@ var DOM_IDS = {
4873
5230
  };
4874
5231
 
4875
5232
  // src/studio/shell/chat-shell.tsx
4876
- var import_jsx_runtime36 = require("react/jsx-runtime");
5233
+ var import_jsx_runtime39 = require("react/jsx-runtime");
4877
5234
  var TimbalChatShell = ({
4878
5235
  workforceId,
4879
5236
  brand,
@@ -4891,7 +5248,7 @@ var TimbalChatShell = ({
4891
5248
  });
4892
5249
  const effectiveId = workforceId ?? selectedId;
4893
5250
  const showSelector = !hideWorkforceSelector && !workforceId && workforces.length > 0;
4894
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
5251
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
4895
5252
  "div",
4896
5253
  {
4897
5254
  className: cn(
@@ -4900,7 +5257,7 @@ var TimbalChatShell = ({
4900
5257
  ),
4901
5258
  style: studioChromeShellStyle,
4902
5259
  children: [
4903
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
5260
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4904
5261
  "div",
4905
5262
  {
4906
5263
  className: cn(
@@ -4910,7 +5267,7 @@ var TimbalChatShell = ({
4910
5267
  "aria-hidden": true
4911
5268
  }
4912
5269
  ),
4913
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
5270
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
4914
5271
  "header",
4915
5272
  {
4916
5273
  className: cn(
@@ -4919,9 +5276,9 @@ var TimbalChatShell = ({
4919
5276
  ),
4920
5277
  style: { minHeight: "var(--studio-topbar-height)" },
4921
5278
  children: [
4922
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
5279
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
4923
5280
  brand,
4924
- showSelector && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
5281
+ showSelector && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4925
5282
  WorkforceSelector,
4926
5283
  {
4927
5284
  workforces,
@@ -4930,11 +5287,11 @@ var TimbalChatShell = ({
4930
5287
  }
4931
5288
  )
4932
5289
  ] }),
4933
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "flex shrink-0 items-center gap-1", children: headerActions })
5290
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "flex shrink-0 items-center gap-1", children: headerActions })
4934
5291
  ]
4935
5292
  }
4936
5293
  ),
4937
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
5294
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4938
5295
  TimbalChat,
4939
5296
  {
4940
5297
  workforceId: effectiveId,
@@ -4951,9 +5308,9 @@ var TimbalChatShell = ({
4951
5308
  };
4952
5309
 
4953
5310
  // src/studio/shell/studio-shell.tsx
4954
- var import_react45 = require("react");
5311
+ var import_react48 = require("react");
4955
5312
  var import_lucide_react13 = require("lucide-react");
4956
- var import_react46 = require("motion/react");
5313
+ var import_react49 = require("motion/react");
4957
5314
 
4958
5315
  // src/design/sidebar-motion.ts
4959
5316
  var STUDIO_SIDEBAR_EASE_ENTER = [0, 0, 0.2, 1];
@@ -5024,16 +5381,16 @@ function studioSidebarBackdropTransition(reduced) {
5024
5381
  }
5025
5382
 
5026
5383
  // src/hooks/use-sidebar-collapse-phase.ts
5027
- var import_react31 = require("react");
5384
+ var import_react34 = require("react");
5028
5385
  var WIDTH_OVERLAP_FRAC = 0.7;
5029
5386
  function useSidebarCollapsePhase(collapsed, reducedMotion) {
5030
- const [widthCollapsed, setWidthCollapsed] = (0, import_react31.useState)(collapsed);
5031
- const [entriesVisible, setEntriesVisible] = (0, import_react31.useState)(true);
5032
- const collapsedTarget = (0, import_react31.useRef)(collapsed);
5033
- const isFirstRender = (0, import_react31.useRef)(true);
5034
- const widthTimerRef = (0, import_react31.useRef)(null);
5035
- const revealTimerRef = (0, import_react31.useRef)(null);
5036
- (0, import_react31.useEffect)(() => {
5387
+ const [widthCollapsed, setWidthCollapsed] = (0, import_react34.useState)(collapsed);
5388
+ const [entriesVisible, setEntriesVisible] = (0, import_react34.useState)(true);
5389
+ const collapsedTarget = (0, import_react34.useRef)(collapsed);
5390
+ const isFirstRender = (0, import_react34.useRef)(true);
5391
+ const widthTimerRef = (0, import_react34.useRef)(null);
5392
+ const revealTimerRef = (0, import_react34.useRef)(null);
5393
+ (0, import_react34.useEffect)(() => {
5037
5394
  collapsedTarget.current = collapsed;
5038
5395
  }, [collapsed]);
5039
5396
  const clearWidthTimer = () => {
@@ -5048,7 +5405,7 @@ function useSidebarCollapsePhase(collapsed, reducedMotion) {
5048
5405
  revealTimerRef.current = null;
5049
5406
  }
5050
5407
  };
5051
- const applyWidthTarget = (0, import_react31.useCallback)(() => {
5408
+ const applyWidthTarget = (0, import_react34.useCallback)(() => {
5052
5409
  const willExpand = !collapsedTarget.current;
5053
5410
  setWidthCollapsed(collapsedTarget.current);
5054
5411
  clearRevealTimer();
@@ -5059,7 +5416,7 @@ function useSidebarCollapsePhase(collapsed, reducedMotion) {
5059
5416
  );
5060
5417
  }
5061
5418
  }, [reducedMotion]);
5062
- (0, import_react31.useEffect)(() => {
5419
+ (0, import_react34.useEffect)(() => {
5063
5420
  clearWidthTimer();
5064
5421
  clearRevealTimer();
5065
5422
  if (reducedMotion) {
@@ -5083,10 +5440,10 @@ function useSidebarCollapsePhase(collapsed, reducedMotion) {
5083
5440
  clearRevealTimer();
5084
5441
  };
5085
5442
  }, [collapsed, reducedMotion, applyWidthTarget]);
5086
- const onEntriesBlurOutComplete = (0, import_react31.useCallback)(() => {
5443
+ const onEntriesBlurOutComplete = (0, import_react34.useCallback)(() => {
5087
5444
  applyWidthTarget();
5088
5445
  }, [applyWidthTarget]);
5089
- const onPanelWidthComplete = (0, import_react31.useCallback)(() => {
5446
+ const onPanelWidthComplete = (0, import_react34.useCallback)(() => {
5090
5447
  clearRevealTimer();
5091
5448
  setEntriesVisible(true);
5092
5449
  }, []);
@@ -5101,15 +5458,15 @@ function useSidebarCollapsePhase(collapsed, reducedMotion) {
5101
5458
  }
5102
5459
 
5103
5460
  // src/studio/sidebar/sidebar-backdrop.tsx
5104
- var import_react32 = require("motion/react");
5105
- var import_jsx_runtime37 = require("react/jsx-runtime");
5461
+ var import_react35 = require("motion/react");
5462
+ var import_jsx_runtime40 = require("react/jsx-runtime");
5106
5463
  var StudioSidebarBackdrop = ({
5107
5464
  open,
5108
5465
  onClose
5109
5466
  }) => {
5110
- const reducedMotion = (0, import_react32.useReducedMotion)();
5111
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react32.AnimatePresence, { children: open ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5112
- import_react32.motion.button,
5467
+ const reducedMotion = (0, import_react35.useReducedMotion)();
5468
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react35.AnimatePresence, { children: open ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
5469
+ import_react35.motion.button,
5113
5470
  {
5114
5471
  type: "button",
5115
5472
  className: "fixed inset-0 z-40 bg-foreground/30 backdrop-blur-[2px] md:hidden",
@@ -5124,36 +5481,36 @@ var StudioSidebarBackdrop = ({
5124
5481
  };
5125
5482
 
5126
5483
  // src/studio/sidebar/sidebar-context.tsx
5127
- var import_react33 = require("react");
5128
- var StudioSidebarContext = (0, import_react33.createContext)({
5484
+ var import_react36 = require("react");
5485
+ var StudioSidebarContext = (0, import_react36.createContext)({
5129
5486
  collapsed: false,
5130
5487
  isMobile: false,
5131
5488
  isCollapsedRail: false,
5132
5489
  iconOnlyLayout: false
5133
5490
  });
5134
5491
  function useStudioSidebarLayout() {
5135
- return (0, import_react33.useContext)(StudioSidebarContext);
5492
+ return (0, import_react36.useContext)(StudioSidebarContext);
5136
5493
  }
5137
5494
 
5138
5495
  // src/studio/sidebar/sidebar.tsx
5139
- var import_react39 = require("react");
5140
- var import_react40 = require("motion/react");
5496
+ var import_react42 = require("react");
5497
+ var import_react43 = require("motion/react");
5141
5498
 
5142
5499
  // src/studio/sidebar/sidebar-entries.tsx
5143
- var import_react34 = require("motion/react");
5144
- var import_jsx_runtime38 = require("react/jsx-runtime");
5500
+ var import_react37 = require("motion/react");
5501
+ var import_jsx_runtime41 = require("react/jsx-runtime");
5145
5502
  var StudioSidebarEntries = ({
5146
5503
  visible,
5147
5504
  onBlurOutComplete,
5148
5505
  children,
5149
5506
  className
5150
5507
  }) => {
5151
- const reducedMotion = (0, import_react34.useReducedMotion)();
5508
+ const reducedMotion = (0, import_react37.useReducedMotion)();
5152
5509
  if (reducedMotion) {
5153
- return visible ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: cn("flex min-h-0 flex-1 flex-col", className), children }) : null;
5510
+ return visible ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: cn("flex min-h-0 flex-1 flex-col", className), children }) : null;
5154
5511
  }
5155
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
5156
- import_react34.motion.div,
5512
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
5513
+ import_react37.motion.div,
5157
5514
  {
5158
5515
  className: cn("flex min-h-0 flex-1 flex-col", className),
5159
5516
  initial: false,
@@ -5176,11 +5533,11 @@ var StudioSidebarEntries = ({
5176
5533
  var import_lucide_react10 = require("lucide-react");
5177
5534
 
5178
5535
  // src/auth/provider.tsx
5179
- var import_react35 = require("react");
5180
- var import_jsx_runtime39 = require("react/jsx-runtime");
5181
- var SessionContext = (0, import_react35.createContext)(void 0);
5536
+ var import_react38 = require("react");
5537
+ var import_jsx_runtime42 = require("react/jsx-runtime");
5538
+ var SessionContext = (0, import_react38.createContext)(void 0);
5182
5539
  var useOptionalSession = () => {
5183
- const context = (0, import_react35.useContext)(SessionContext);
5540
+ const context = (0, import_react38.useContext)(SessionContext);
5184
5541
  return context ?? null;
5185
5542
  };
5186
5543
 
@@ -5207,35 +5564,35 @@ function studioSidebarNavItemClasses(iconOnly, isActive) {
5207
5564
  }
5208
5565
 
5209
5566
  // src/studio/sidebar/sidebar-entry-motion.tsx
5210
- var import_react36 = require("motion/react");
5211
- var import_jsx_runtime40 = require("react/jsx-runtime");
5567
+ var import_react39 = require("motion/react");
5568
+ var import_jsx_runtime43 = require("react/jsx-runtime");
5212
5569
  var StudioSidebarEntryMotion = ({
5213
5570
  children,
5214
5571
  className
5215
5572
  }) => {
5216
- const reducedMotion = (0, import_react36.useReducedMotion)();
5573
+ const reducedMotion = (0, import_react39.useReducedMotion)();
5217
5574
  if (reducedMotion) {
5218
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className, children });
5575
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className, children });
5219
5576
  }
5220
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react36.motion.div, { variants: studioSidebarEntryItemVariants, className: cn(className), children });
5577
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react39.motion.div, { variants: studioSidebarEntryItemVariants, className: cn(className), children });
5221
5578
  };
5222
5579
 
5223
5580
  // src/studio/sidebar/sidebar-tooltip.tsx
5224
- var import_jsx_runtime41 = require("react/jsx-runtime");
5581
+ var import_jsx_runtime44 = require("react/jsx-runtime");
5225
5582
  var StudioSidebarTooltip = ({
5226
5583
  label,
5227
5584
  enabled,
5228
5585
  children
5229
5586
  }) => {
5230
- if (!enabled) return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment, { children });
5231
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Tooltip, { children: [
5232
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipTrigger, { asChild: true, children }),
5233
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TooltipContent, { side: "right", className: "text-xs", children: label })
5587
+ if (!enabled) return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_jsx_runtime44.Fragment, { children });
5588
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Tooltip, { children: [
5589
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(TooltipTrigger, { asChild: true, children }),
5590
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(TooltipContent, { side: "right", className: "text-xs", children: label })
5234
5591
  ] });
5235
5592
  };
5236
5593
 
5237
5594
  // src/studio/sidebar/sidebar-footer.tsx
5238
- var import_jsx_runtime42 = require("react/jsx-runtime");
5595
+ var import_jsx_runtime45 = require("react/jsx-runtime");
5239
5596
  function userInitials(name, email) {
5240
5597
  const fromName = name.trim().split(/\s+/).map((part) => part.charAt(0)).join("").slice(0, 2).toUpperCase();
5241
5598
  if (fromName) return fromName;
@@ -5253,32 +5610,32 @@ var StudioSidebarFooter = ({
5253
5610
  session?.logout();
5254
5611
  onSignOut?.();
5255
5612
  };
5256
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(StudioSidebarEntryMotion, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
5613
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(StudioSidebarEntryMotion, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
5257
5614
  "footer",
5258
5615
  {
5259
5616
  className: cn(
5260
5617
  "mt-auto w-full shrink-0 py-2.5",
5261
5618
  iconOnlyLayout ? studioSidebarCollapsedRailInsetClass : "px-2.5"
5262
5619
  ),
5263
- children: user ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex flex-col gap-2", children: [
5264
- iconOnlyLayout ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: studioSidebarCollapsedRailChipRowClass, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Avatar, { size: "sm", className: "size-8", children: [
5265
- user.user_photo_url ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AvatarImage, { src: user.user_photo_url, alt: user.user_name }) : null,
5266
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AvatarFallback, { className: "text-[10px]", children: userInitials(user.user_name, user.user_email) })
5267
- ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex min-w-0 items-center gap-2.5", children: [
5268
- /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Avatar, { size: "sm", children: [
5269
- user.user_photo_url ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AvatarImage, { src: user.user_photo_url, alt: user.user_name }) : null,
5270
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AvatarFallback, { children: userInitials(user.user_name, user.user_email) })
5620
+ children: user ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex flex-col gap-2", children: [
5621
+ iconOnlyLayout ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: studioSidebarCollapsedRailChipRowClass, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Avatar, { size: "sm", className: "size-8", children: [
5622
+ user.user_photo_url ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(AvatarImage, { src: user.user_photo_url, alt: user.user_name }) : null,
5623
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(AvatarFallback, { className: "text-[10px]", children: userInitials(user.user_name, user.user_email) })
5624
+ ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex min-w-0 items-center gap-2.5", children: [
5625
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Avatar, { size: "sm", children: [
5626
+ user.user_photo_url ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(AvatarImage, { src: user.user_photo_url, alt: user.user_name }) : null,
5627
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(AvatarFallback, { children: userInitials(user.user_name, user.user_email) })
5271
5628
  ] }),
5272
- /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "min-w-0 flex-1", children: [
5273
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "truncate text-sm font-medium text-foreground", children: user.user_name }),
5274
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "truncate text-xs text-muted-foreground", children: user.user_email })
5629
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "min-w-0 flex-1", children: [
5630
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "truncate text-sm font-medium text-foreground", children: user.user_name }),
5631
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "truncate text-xs text-muted-foreground", children: user.user_email })
5275
5632
  ] })
5276
5633
  ] }),
5277
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
5634
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
5278
5635
  "div",
5279
5636
  {
5280
5637
  className: iconOnlyLayout ? studioSidebarCollapsedRailChipRowClass : void 0,
5281
- children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(StudioSidebarTooltip, { label: "Sign out", enabled: showTooltips, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
5638
+ children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(StudioSidebarTooltip, { label: "Sign out", enabled: showTooltips, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
5282
5639
  "button",
5283
5640
  {
5284
5641
  type: "button",
@@ -5289,28 +5646,28 @@ var StudioSidebarFooter = ({
5289
5646
  ),
5290
5647
  "aria-label": "Sign out",
5291
5648
  children: [
5292
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_lucide_react10.LogOut, { className: "size-3.5 shrink-0" }),
5649
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_lucide_react10.LogOut, { className: "size-3.5 shrink-0" }),
5293
5650
  !iconOnlyLayout ? "Sign out" : null
5294
5651
  ]
5295
5652
  }
5296
5653
  ) })
5297
5654
  }
5298
5655
  )
5299
- ] }) : !iconOnlyLayout && emptyCaption ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "px-1 text-xs text-muted-foreground", children: emptyCaption }) : null
5656
+ ] }) : !iconOnlyLayout && emptyCaption ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "px-1 text-xs text-muted-foreground", children: emptyCaption }) : null
5300
5657
  }
5301
5658
  ) });
5302
5659
  };
5303
5660
 
5304
5661
  // src/studio/sidebar/sidebar-header.tsx
5305
5662
  var import_lucide_react11 = require("lucide-react");
5306
- var import_jsx_runtime43 = require("react/jsx-runtime");
5663
+ var import_jsx_runtime46 = require("react/jsx-runtime");
5307
5664
  var sidebarHeaderClass = "flex h-12 shrink-0 items-center px-2";
5308
5665
  var toggleButtonClass = cn(
5309
5666
  "flex shrink-0 items-center justify-center rounded-lg text-muted-foreground transition-colors",
5310
5667
  "hover:bg-muted hover:text-foreground",
5311
5668
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-foreground/15"
5312
5669
  );
5313
- var SidebarToggleButton = ({ ariaLabel, expanded, onClick, children }) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
5670
+ var SidebarToggleButton = ({ ariaLabel, expanded, onClick, children }) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
5314
5671
  "button",
5315
5672
  {
5316
5673
  type: "button",
@@ -5324,7 +5681,7 @@ var SidebarToggleButton = ({ ariaLabel, expanded, onClick, children }) => /* @__
5324
5681
  var CollapsedBrandToggle = ({
5325
5682
  onExpand,
5326
5683
  brand
5327
- }) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: studioSidebarCollapsedRailChipRowClass, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(StudioSidebarTooltip, { label: "Expand sidebar", enabled: true, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
5684
+ }) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: studioSidebarCollapsedRailChipRowClass, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(StudioSidebarTooltip, { label: "Expand sidebar", enabled: true, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
5328
5685
  "button",
5329
5686
  {
5330
5687
  type: "button",
@@ -5336,7 +5693,7 @@ var CollapsedBrandToggle = ({
5336
5693
  "group relative inline-flex size-8 items-center justify-center overflow-hidden rounded-lg"
5337
5694
  ),
5338
5695
  children: [
5339
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
5696
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
5340
5697
  "span",
5341
5698
  {
5342
5699
  "aria-hidden": true,
@@ -5348,7 +5705,7 @@ var CollapsedBrandToggle = ({
5348
5705
  children: brand
5349
5706
  }
5350
5707
  ),
5351
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
5708
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
5352
5709
  import_lucide_react11.ChevronRight,
5353
5710
  {
5354
5711
  "aria-hidden": true,
@@ -5370,40 +5727,40 @@ var StudioSidebarHeader = ({
5370
5727
  brand
5371
5728
  }) => {
5372
5729
  if (isMobile) {
5373
- return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("header", { className: cn(sidebarHeaderClass, "justify-between gap-2 pr-2"), children: [
5730
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("header", { className: cn(sidebarHeaderClass, "justify-between gap-2 pr-2"), children: [
5374
5731
  brand,
5375
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
5732
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
5376
5733
  SidebarToggleButton,
5377
5734
  {
5378
5735
  ariaLabel: "Close menu",
5379
5736
  expanded: mobileOpen,
5380
5737
  onClick: onToggle,
5381
- children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react11.X, { className: "size-3.5" })
5738
+ children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_lucide_react11.X, { className: "size-3.5" })
5382
5739
  }
5383
5740
  )
5384
5741
  ] });
5385
5742
  }
5386
5743
  if (isCollapsedRail) {
5387
- return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
5744
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
5388
5745
  "header",
5389
5746
  {
5390
5747
  className: cn(
5391
5748
  "flex h-12 shrink-0 items-center",
5392
5749
  studioSidebarCollapsedRailInsetClass
5393
5750
  ),
5394
- children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(CollapsedBrandToggle, { onExpand: onToggle, brand })
5751
+ children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(CollapsedBrandToggle, { onExpand: onToggle, brand })
5395
5752
  }
5396
5753
  );
5397
5754
  }
5398
- return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("header", { className: cn(sidebarHeaderClass, "justify-between gap-1 pr-2"), children: [
5755
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("header", { className: cn(sidebarHeaderClass, "justify-between gap-1 pr-2"), children: [
5399
5756
  brand,
5400
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
5757
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
5401
5758
  SidebarToggleButton,
5402
5759
  {
5403
5760
  ariaLabel: "Collapse sidebar",
5404
5761
  expanded: true,
5405
5762
  onClick: onToggle,
5406
- children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react11.ChevronLeft, { className: "size-4" })
5763
+ children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_lucide_react11.ChevronLeft, { className: "size-4" })
5407
5764
  }
5408
5765
  )
5409
5766
  ] });
@@ -5422,7 +5779,7 @@ function workforceItemInitial(w) {
5422
5779
  }
5423
5780
 
5424
5781
  // src/studio/sidebar/sidebar-nav.tsx
5425
- var import_jsx_runtime44 = require("react/jsx-runtime");
5782
+ var import_jsx_runtime47 = require("react/jsx-runtime");
5426
5783
  var StudioSidebarNav = ({
5427
5784
  workforces,
5428
5785
  selectedId,
@@ -5431,7 +5788,7 @@ var StudioSidebarNav = ({
5431
5788
  showTooltips
5432
5789
  }) => {
5433
5790
  if (workforces.length === 0) return null;
5434
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
5791
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
5435
5792
  "nav",
5436
5793
  {
5437
5794
  className: cn(
@@ -5443,11 +5800,11 @@ var StudioSidebarNav = ({
5443
5800
  const id = workforceItemId(w);
5444
5801
  const isActive = id === selectedId;
5445
5802
  const label = workforceItemLabel(w);
5446
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
5803
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
5447
5804
  StudioSidebarEntryMotion,
5448
5805
  {
5449
5806
  className: iconOnlyLayout ? studioSidebarCollapsedRailChipRowClass : void 0,
5450
- children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(StudioSidebarTooltip, { label, enabled: showTooltips, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
5807
+ children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(StudioSidebarTooltip, { label, enabled: showTooltips, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
5451
5808
  "button",
5452
5809
  {
5453
5810
  type: "button",
@@ -5458,7 +5815,7 @@ var StudioSidebarNav = ({
5458
5815
  studioSidebarNavItemClasses(iconOnlyLayout, isActive),
5459
5816
  iconOnlyLayout && "inline-flex"
5460
5817
  ),
5461
- children: iconOnlyLayout ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "text-xs font-semibold leading-none", children: workforceItemInitial(w) }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "min-w-0 truncate", children: label })
5818
+ children: iconOnlyLayout ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-xs font-semibold leading-none", children: workforceItemInitial(w) }) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "min-w-0 truncate", children: label })
5462
5819
  }
5463
5820
  ) })
5464
5821
  },
@@ -5471,7 +5828,7 @@ var StudioSidebarNav = ({
5471
5828
 
5472
5829
  // src/studio/sidebar/timbal-mark.tsx
5473
5830
  var import_shaders_react = require("@paper-design/shaders-react");
5474
- var import_jsx_runtime45 = require("react/jsx-runtime");
5831
+ var import_jsx_runtime48 = require("react/jsx-runtime");
5475
5832
  var DEFAULT_SIZE = 64;
5476
5833
  var TRANSPARENT_BACK = "#00000000";
5477
5834
  var TIMBAL_SYMBOL_DATA_URI = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAACWCAYAAAA8AXHiAAAH6ElEQVR4Aeyci7EcNRBFFxIBIgEygUiASCATyASIBOa4rFrZntmPPq1W93218o5nZyTd26dbmnX5fX3TjxyY4IDAmmCqurzdBJYomOKAwJpiqzoVWGJgigMCa4qt6lRgZWHAWKfAMjY8y3ACK0ukjXUKLGPDswwnsLJE2linwDI2PMtwAitLpI11Cixjw+/DxT4SWLHju0ydwHrP+p/euzzE1T8cKr492lsvgfWaXZj733Hp90fL9Pr1EPvn0QTWYcLoF8bS6Pdf/kjQAAnNv7RqVcW6do4q9ffxMe/HW5oXy323boF1zkvzEnDe3RZnS5X6fcRsBdbdRY6oTl1LAJ1s2NDdXaVq3QLr7kapUph8Pxv/iESiDVUqsG63sgQ0b1Rve/6QQEOrVG1DdrCGbFRrQzc5Zh9FlSKppkw5M1gYi8FTjHXaaalSJNTUKWYEC3P5spP3qeY667zsIadVqVpvNrCoUrTag+jHgIRm0z2ka7AGRpzqNG2jOnCeo7uiSi3RnQEszCVjydzRgfPaH1rRbFqlajMig0WVWmpubbThMRvzJVWq1hgVrFKlgKvWG/2YRHLxpBsNrOVLwCJySSBXT7qRwHKxBCwAiypFWzD09ZARwCpVysUScG318E+oUsv3Uleq3gPrqpd1512bO9GWsockqSYO0971zmBR/mnt6ve7k0RC87KvEV61bEewMNftEvCq8Q3XlSqF/obbbW/ZDSz2UWSs2yVgQvjQimb3VarWvgtYZCnm8uRXzz/6MXq3rM47gLXVEjCI9FKlqNCDurTtxjNYxdytloAB4aM6r65S3TK8grXtEtAZEZZ7Wmc362/3BlapUtsuAY0hDVGlau2ewApnbm30g+OyhySpHly210dewKL80/Zyr2+2JBKaQ+4hV4OFudtvVBv4KlUK/Q23+79lJVjso8jYUEvAk5CjFc0hq1StfQVYZCnm8uRXzyX6MXqbq/Nu5liDFX4JOAGgVCkq9MnHMU9ZgVXMDb8EfIYJ1TlNlaq1W4BFlcpoLss9rfY7zfFMsFSl0mD0pdBZYKXaqFa2so+iSpFU1el8hzPAwlgMzuQmeyl0k1ARdf/zrqiRYGGuq/+C9K4Zb11/v5g9JFCh/342+dEosDCWlslOljs0Z3vSfSnGvWCRpRmf+KhSGXW/BBUX9YCFuWQsmUtfGdo3h0g0q0odRjx6tYAFSFnNZXNOlX7kqT47HGgB67jtJnNv+nnkQCtYj/rUZ3LgFggsRdOTAwLLUzQCzUVgBQqmJykCy1M0As1FYAUKpicpAstTNALNRWAFCqYnKTPB8qRTczF2QGAZG55lOIGVJdLGOgWWseFZhhNYWSJtrFNgGRueZTiBlSXSM3We9C2wTkzRqX4HBFa/h+rhxAGBdWKKTvU7ILD6PVQPJw4IrBNTdKrfAYHV76F6OHFAYJ2Ysv+p9QoE1voYhJyBwAoZ1vWiBNb6GIScgcAKGdb1ogTW+hiEnIHAChnW9aIElk0M0o0isNKF3EawwLLxOd0oAitdyN8W/Ndxx9LfmnyMH/aFuX+EVXct7Lfjox+P9vZLFeu5ZcXcf59fGuYKKhRA8Xtmm0QJrGvbqFJd5l537foTKvN3xwzRf7y1vdKC9cSuUqW6zH0yhsePSaSfR0xMYH3qYvcS8Gl32/yNBPrqmC3vx1v/S2DdPRyyBNy72+aIKkUbOuEWsPg970MnsbizUqWGLAGLtbwzPNWpey91NWALWFd97Xh+qrmODSl7SJJqyjQzg0X5p00x1mmnJBKam79GeFVXRrAwd9oS8KrxC64rVQr904f3A9Z0qR8GYB9Fxk5bAj6M4usPtKJ5epWqZWcBiyzFXJ78av3Rj9G7pDpnAMt0CXBCaqlSVOglU4oMVjHXdAlYEsVPB6U6L6lS9TSigkWVWm5ubbTRMcs9zWi462GigaUqdR1r008igbVso2oasS8HYx9FlSKpvvx00ZkHYC2aUduwGIvBbXfveRd7KXSTUO4U7A4W5g79V3l3ETqfEHtIoEL/+RWLz+4MFsbSFltoOjzLHZrdP+nuCBZZmvGJjyVvG927gVWWADLXtFQsHAytVKmt9pC7gEWVwlz3S8BgANG9TZWqte8AVqlSmFzPPfoxiUSbrnPGAJ7BKkuAqtSMyE/u0ytYW21UB8aIfRRViqQa2K19Vx7BwlgMtndj3Ygs8+gmodbNYuDInsDCXH3ZOTC4K7vyAhbZSlvphfXYLHdoDrmHXA0WVWrLx+lOCnnSDa17JViYS8aSuZ1x2uZ2tKL5cZXaRs71RFeARZVKYe5ntrMxD12lar3WYJUqBVz1PKIfk0ipnnStwEqzBHyWISRQxifdmwVYqZaACiyqFK06ledwJlilSqVaAg50qFJp9lKH3tPXLLCymlv2kCTVqeFZTs4Ai/JPC+ThUykkEprDf43w1ImPF4wEC3MzLgGlSqH/o616GwUW+ygyNtMSgFY0q0qd5FEvWGQp5vLkd9J92FPozVidXw5oD1hZlwASiQr9sskZL2wBK+sSgO6UX3a2JEYrWCyBLePtfA/L387zN517C1imE7wYTKedOyCwnAdo1+kJrF0j53zeAst5gHadnsDaNXLO5y2wnAdo1+kJrF0j53zew8ByrlPTM3ZAYBkbnmU4gZUl0sY6BZax4VmGE1hZIm2sU2AZG55lOIGVJdLDdL7W0f8AAAD//x3VUCQAAAAGSURBVAMArsj7LTb9pqMAAAAASUVORK5CYII=";
@@ -5480,14 +5837,14 @@ function TimbalMark({
5480
5837
  size = DEFAULT_SIZE,
5481
5838
  src = TIMBAL_SYMBOL_DATA_URI
5482
5839
  }) {
5483
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
5840
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
5484
5841
  "div",
5485
5842
  {
5486
5843
  className: cn("relative shrink-0 bg-transparent", className),
5487
5844
  style: { width: size, height: size },
5488
5845
  role: "img",
5489
5846
  "aria-label": "Timbal",
5490
- children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
5847
+ children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
5491
5848
  import_shaders_react.LiquidMetal,
5492
5849
  {
5493
5850
  width: size,
@@ -5519,14 +5876,14 @@ function TimbalMark({
5519
5876
  }
5520
5877
 
5521
5878
  // src/studio/sidebar/shell-inset-bridge-context.tsx
5522
- var import_react38 = require("react");
5879
+ var import_react41 = require("react");
5523
5880
 
5524
5881
  // src/layout/shell-inset-context.tsx
5525
- var import_react37 = require("react");
5526
- var ShellInsetContext = (0, import_react37.createContext)(null);
5882
+ var import_react40 = require("react");
5883
+ var ShellInsetContext = (0, import_react40.createContext)(null);
5527
5884
  var ShellInsetProvider = ShellInsetContext.Provider;
5528
5885
  function useShellInsetReporter() {
5529
- return (0, import_react37.useContext)(ShellInsetContext);
5886
+ return (0, import_react40.useContext)(ShellInsetContext);
5530
5887
  }
5531
5888
 
5532
5889
  // src/studio/sidebar/shell-inset-bridge-context.tsx
@@ -5535,7 +5892,7 @@ var StudioSidebarShellInsetBridge = ({
5535
5892
  }) => {
5536
5893
  const reportInset = useShellInsetReporter();
5537
5894
  const { isMobile, isCollapsedRail } = useStudioSidebarLayout();
5538
- (0, import_react38.useLayoutEffect)(() => {
5895
+ (0, import_react41.useLayoutEffect)(() => {
5539
5896
  const insetPx = isMobile ? 0 : isCollapsedRail ? SIDEBAR_INSET_PX_COLLAPSED : SIDEBAR_INSET_PX_EXPANDED;
5540
5897
  reportInset?.(insetPx);
5541
5898
  onInsetChange?.(insetPx);
@@ -5544,7 +5901,7 @@ var StudioSidebarShellInsetBridge = ({
5544
5901
  };
5545
5902
 
5546
5903
  // src/studio/sidebar/sidebar.tsx
5547
- var import_jsx_runtime46 = require("react/jsx-runtime");
5904
+ var import_jsx_runtime49 = require("react/jsx-runtime");
5548
5905
  var DEFAULT_BREAKPOINT_PX = 768;
5549
5906
  function readPersistedCollapsed(key) {
5550
5907
  if (!key || typeof window === "undefined") return false;
@@ -5577,7 +5934,7 @@ var StudioSidebarPanel = ({
5577
5934
  brand,
5578
5935
  emptyCaption = null
5579
5936
  }) => {
5580
- const reducedMotion = (0, import_react40.useReducedMotion)();
5937
+ const reducedMotion = (0, import_react43.useReducedMotion)();
5581
5938
  const isCollapsedRail = widthCollapsed && !isMobile;
5582
5939
  const iconOnlyLayout = studioSidebarIconOnlyLayout(isMobile, isCollapsedRail);
5583
5940
  const isDrawerOpen = isMobile && mobileOpen;
@@ -5594,9 +5951,9 @@ var StudioSidebarPanel = ({
5594
5951
  onCollapsedChange(!collapsed);
5595
5952
  };
5596
5953
  const panelWidthPx = isMobile ? SIDEBAR_MOBILE_PX : widthCollapsed ? SIDEBAR_WIDTH_COLLAPSED_PX : SIDEBAR_WIDTH_PX;
5597
- const brandNode = brand ?? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(TimbalMark, { size: 32 });
5598
- const panel = /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
5599
- import_react40.motion.div,
5954
+ const brandNode = brand ?? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TimbalMark, { size: 32 });
5955
+ const panel = /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
5956
+ import_react43.motion.div,
5600
5957
  {
5601
5958
  "data-sidebar-collapsed": isCollapsedRail ? "" : void 0,
5602
5959
  className: cn(
@@ -5610,7 +5967,7 @@ var StudioSidebarPanel = ({
5610
5967
  style: { willChange: entriesVisible ? void 0 : "width" },
5611
5968
  onAnimationComplete: isMobile || entriesVisible ? void 0 : () => onPanelWidthComplete(),
5612
5969
  children: [
5613
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
5970
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
5614
5971
  StudioSidebarHeader,
5615
5972
  {
5616
5973
  isCollapsedRail,
@@ -5620,13 +5977,13 @@ var StudioSidebarPanel = ({
5620
5977
  brand: brandNode
5621
5978
  }
5622
5979
  ),
5623
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
5980
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
5624
5981
  StudioSidebarEntries,
5625
5982
  {
5626
5983
  visible: entriesVisible,
5627
5984
  onBlurOutComplete: onEntriesBlurOutComplete,
5628
5985
  children: [
5629
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
5986
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
5630
5987
  "div",
5631
5988
  {
5632
5989
  id: DOM_IDS.sidebarRuntimeAnchor,
@@ -5636,7 +5993,7 @@ var StudioSidebarPanel = ({
5636
5993
  )
5637
5994
  }
5638
5995
  ),
5639
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
5996
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
5640
5997
  StudioSidebarNav,
5641
5998
  {
5642
5999
  workforces,
@@ -5646,8 +6003,8 @@ var StudioSidebarPanel = ({
5646
6003
  showTooltips: isCollapsedRail
5647
6004
  }
5648
6005
  ),
5649
- workforces.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "min-h-0 flex-1" }) : null,
5650
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
6006
+ workforces.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "min-h-0 flex-1" }) : null,
6007
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
5651
6008
  StudioSidebarFooter,
5652
6009
  {
5653
6010
  iconOnlyLayout,
@@ -5663,8 +6020,8 @@ var StudioSidebarPanel = ({
5663
6020
  }
5664
6021
  );
5665
6022
  if (isMobile) {
5666
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
5667
- import_react40.motion.aside,
6023
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
6024
+ import_react43.motion.aside,
5668
6025
  {
5669
6026
  className: "fixed inset-y-0 left-0 z-[60] flex",
5670
6027
  "aria-label": "Studio navigation",
@@ -5679,7 +6036,7 @@ var StudioSidebarPanel = ({
5679
6036
  }
5680
6037
  );
5681
6038
  }
5682
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
6039
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
5683
6040
  "aside",
5684
6041
  {
5685
6042
  className: "absolute inset-y-0 left-0 z-[60] flex py-[var(--studio-sidebar-gap)] pl-[var(--studio-sidebar-gap)]",
@@ -5701,51 +6058,51 @@ var StudioSidebar = ({
5701
6058
  onMobileOpenChange: onMobileOpenChangeProp,
5702
6059
  onInsetChange
5703
6060
  }) => {
5704
- const reducedMotion = (0, import_react40.useReducedMotion)();
6061
+ const reducedMotion = (0, import_react43.useReducedMotion)();
5705
6062
  const fetched = useWorkforces({ enabled: workforcesProp === void 0 });
5706
6063
  const workforces = workforcesProp ?? fetched.workforces;
5707
- const [internalSelected, setInternalSelected] = (0, import_react39.useState)(
6064
+ const [internalSelected, setInternalSelected] = (0, import_react42.useState)(
5708
6065
  selectedIdProp ?? ""
5709
6066
  );
5710
- (0, import_react39.useEffect)(() => {
6067
+ (0, import_react42.useEffect)(() => {
5711
6068
  if (selectedIdProp !== void 0) return;
5712
6069
  if (internalSelected) return;
5713
6070
  const first = workforces[0]?.id ?? workforces[0]?.uid ?? workforces[0]?.name;
5714
6071
  if (first) setInternalSelected(first);
5715
6072
  }, [workforces, selectedIdProp, internalSelected]);
5716
6073
  const selectedId = selectedIdProp ?? internalSelected ?? workforces[0]?.id ?? workforces[0]?.uid ?? workforces[0]?.name ?? "";
5717
- const handleSelect = (0, import_react39.useCallback)(
6074
+ const handleSelect = (0, import_react42.useCallback)(
5718
6075
  (id) => {
5719
6076
  if (selectedIdProp === void 0) setInternalSelected(id);
5720
6077
  onSelect?.(id);
5721
6078
  },
5722
6079
  [selectedIdProp, onSelect]
5723
6080
  );
5724
- const [collapsed, setCollapsed] = (0, import_react39.useState)(() => {
6081
+ const [collapsed, setCollapsed] = (0, import_react42.useState)(() => {
5725
6082
  const persisted = readPersistedCollapsed(persistKey);
5726
6083
  return persisted || defaultCollapsed;
5727
6084
  });
5728
- const handleCollapsedChange = (0, import_react39.useCallback)(
6085
+ const handleCollapsedChange = (0, import_react42.useCallback)(
5729
6086
  (next) => {
5730
6087
  setCollapsed(next);
5731
6088
  writePersistedCollapsed(persistKey, next);
5732
6089
  },
5733
6090
  [persistKey]
5734
6091
  );
5735
- const [isMobile, setIsMobile] = (0, import_react39.useState)(() => {
6092
+ const [isMobile, setIsMobile] = (0, import_react42.useState)(() => {
5736
6093
  if (typeof window === "undefined") return false;
5737
6094
  return window.innerWidth < mobileBreakpointPx;
5738
6095
  });
5739
- (0, import_react39.useEffect)(() => {
6096
+ (0, import_react42.useEffect)(() => {
5740
6097
  if (typeof window === "undefined") return;
5741
6098
  const onResize = () => setIsMobile(window.innerWidth < mobileBreakpointPx);
5742
6099
  onResize();
5743
6100
  window.addEventListener("resize", onResize);
5744
6101
  return () => window.removeEventListener("resize", onResize);
5745
6102
  }, [mobileBreakpointPx]);
5746
- const [internalMobileOpen, setInternalMobileOpen] = (0, import_react39.useState)(false);
6103
+ const [internalMobileOpen, setInternalMobileOpen] = (0, import_react42.useState)(false);
5747
6104
  const mobileOpen = mobileOpenProp ?? internalMobileOpen;
5748
- const setMobileOpen = (0, import_react39.useCallback)(
6105
+ const setMobileOpen = (0, import_react42.useCallback)(
5749
6106
  (next) => {
5750
6107
  if (mobileOpenProp === void 0) setInternalMobileOpen(next);
5751
6108
  onMobileOpenChangeProp?.(next);
@@ -5762,7 +6119,7 @@ var StudioSidebar = ({
5762
6119
  const entriesVisible = isMobile || phaseEntriesVisible;
5763
6120
  const isCollapsedRail = widthCollapsed && !isMobile;
5764
6121
  const iconOnlyLayout = studioSidebarIconOnlyLayout(isMobile, isCollapsedRail);
5765
- const contextValue = (0, import_react39.useMemo)(
6122
+ const contextValue = (0, import_react42.useMemo)(
5766
6123
  () => ({
5767
6124
  collapsed: effectiveCollapsed,
5768
6125
  isMobile,
@@ -5771,9 +6128,9 @@ var StudioSidebar = ({
5771
6128
  }),
5772
6129
  [effectiveCollapsed, isMobile, isCollapsedRail, iconOnlyLayout]
5773
6130
  );
5774
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(StudioSidebarContext.Provider, { value: contextValue, children: [
5775
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(StudioSidebarShellInsetBridge, { onInsetChange }),
5776
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
6131
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(StudioSidebarContext.Provider, { value: contextValue, children: [
6132
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(StudioSidebarShellInsetBridge, { onInsetChange }),
6133
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
5777
6134
  StudioSidebarPanel,
5778
6135
  {
5779
6136
  workforces,
@@ -5796,26 +6153,26 @@ var StudioSidebar = ({
5796
6153
  };
5797
6154
 
5798
6155
  // src/studio/sidebar/sidebar-runtime-portal.tsx
5799
- var import_react41 = require("react");
6156
+ var import_react44 = require("react");
5800
6157
  var import_react_dom = require("react-dom");
5801
6158
  var import_lucide_react12 = require("lucide-react");
5802
- var import_react42 = require("@assistant-ui/react");
5803
- var import_jsx_runtime47 = require("react/jsx-runtime");
6159
+ var import_react45 = require("@assistant-ui/react");
6160
+ var import_jsx_runtime50 = require("react/jsx-runtime");
5804
6161
  var StudioSidebarRuntimePortal = ({
5805
6162
  label = "New chat"
5806
6163
  }) => {
5807
6164
  const { iconOnlyLayout } = useStudioSidebarLayout();
5808
- const hasMessages = (0, import_react42.useThread)((s) => s.messages.length > 0);
6165
+ const hasMessages = (0, import_react45.useThread)((s) => s.messages.length > 0);
5809
6166
  const { clear } = useTimbalRuntime();
5810
- const [anchor, setAnchor] = (0, import_react41.useState)(null);
5811
- const startNewChat = (0, import_react41.useCallback)(() => {
6167
+ const [anchor, setAnchor] = (0, import_react44.useState)(null);
6168
+ const startNewChat = (0, import_react44.useCallback)(() => {
5812
6169
  clear();
5813
6170
  }, [clear]);
5814
- (0, import_react41.useLayoutEffect)(() => {
6171
+ (0, import_react44.useLayoutEffect)(() => {
5815
6172
  setAnchor(document.getElementById(DOM_IDS.sidebarRuntimeAnchor));
5816
6173
  }, []);
5817
6174
  if (!anchor || !hasMessages) return null;
5818
- const button = /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
6175
+ const button = /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
5819
6176
  "button",
5820
6177
  {
5821
6178
  type: "button",
@@ -5823,24 +6180,24 @@ var StudioSidebarRuntimePortal = ({
5823
6180
  "aria-label": label,
5824
6181
  className: studioSidebarNavItemClasses(iconOnlyLayout, false),
5825
6182
  children: [
5826
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react12.MessageSquarePlus, { className: "size-3.5 shrink-0" }),
5827
- !iconOnlyLayout ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "min-w-0 truncate", children: label }) : null
6183
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_lucide_react12.MessageSquarePlus, { className: "size-3.5 shrink-0" }),
6184
+ !iconOnlyLayout ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "min-w-0 truncate", children: label }) : null
5828
6185
  ]
5829
6186
  }
5830
6187
  );
5831
6188
  return (0, import_react_dom.createPortal)(
5832
- iconOnlyLayout ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Tooltip, { children: [
5833
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TooltipTrigger, { asChild: true, children: button }),
5834
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TooltipContent, { side: "right", className: "text-xs", children: label })
6189
+ iconOnlyLayout ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(Tooltip, { children: [
6190
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(TooltipTrigger, { asChild: true, children: button }),
6191
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(TooltipContent, { side: "right", className: "text-xs", children: label })
5835
6192
  ] }) : button,
5836
6193
  anchor
5837
6194
  );
5838
6195
  };
5839
6196
 
5840
6197
  // src/studio/sidebar/welcome.tsx
5841
- var import_react43 = require("motion/react");
5842
- var import_react44 = require("@assistant-ui/react");
5843
- var import_jsx_runtime48 = require("react/jsx-runtime");
6198
+ var import_react46 = require("motion/react");
6199
+ var import_react47 = require("@assistant-ui/react");
6200
+ var import_jsx_runtime51 = require("react/jsx-runtime");
5844
6201
  var welcomeStagger2 = {
5845
6202
  initial: {},
5846
6203
  animate: {
@@ -5865,34 +6222,34 @@ var welcomeIcon2 = {
5865
6222
  }
5866
6223
  };
5867
6224
  var StudioWelcome = ({ config, icon }) => {
5868
- const isEmpty = (0, import_react44.useThread)((s) => s.messages.length === 0);
6225
+ const isEmpty = (0, import_react47.useThread)((s) => s.messages.length === 0);
5869
6226
  if (!isEmpty) return null;
5870
- const iconNode = icon ?? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
6227
+ const iconNode = icon ?? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
5871
6228
  TimbalMark,
5872
6229
  {
5873
6230
  size: 112,
5874
6231
  className: "max-md:scale-[0.58] max-md:origin-center"
5875
6232
  }
5876
6233
  );
5877
- return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "aui-thread-welcome-root mx-auto my-auto flex w-full max-w-(--thread-max-width) grow flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "aui-thread-welcome-center flex w-full grow flex-col items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
5878
- import_react43.motion.div,
6234
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "aui-thread-welcome-root mx-auto my-auto flex w-full max-w-(--thread-max-width) grow flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "aui-thread-welcome-center flex w-full grow flex-col items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
6235
+ import_react46.motion.div,
5879
6236
  {
5880
6237
  className: "aui-thread-welcome-message flex flex-col items-center justify-center px-2 text-center sm:px-4",
5881
6238
  variants: welcomeStagger2,
5882
6239
  initial: "initial",
5883
6240
  animate: "animate",
5884
6241
  children: [
5885
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react43.motion.div, { variants: welcomeIcon2, className: "mb-4 md:mb-5", children: iconNode }),
5886
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
5887
- import_react43.motion.h1,
6242
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react46.motion.div, { variants: welcomeIcon2, className: "mb-4 md:mb-5", children: iconNode }),
6243
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
6244
+ import_react46.motion.h1,
5888
6245
  {
5889
6246
  variants: welcomeItem2,
5890
6247
  className: "aui-thread-welcome-message-inner text-xl font-semibold sm:text-2xl",
5891
6248
  children: config?.heading ?? "How can I help you today?"
5892
6249
  }
5893
6250
  ),
5894
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
5895
- import_react43.motion.p,
6251
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
6252
+ import_react46.motion.p,
5896
6253
  {
5897
6254
  variants: welcomeItem2,
5898
6255
  className: "aui-thread-welcome-message-inner mt-2 text-muted-foreground",
@@ -5905,8 +6262,8 @@ var StudioWelcome = ({ config, icon }) => {
5905
6262
  };
5906
6263
 
5907
6264
  // src/studio/shell/studio-shell.tsx
5908
- var import_jsx_runtime49 = require("react/jsx-runtime");
5909
- var import_react47 = require("react");
6265
+ var import_jsx_runtime52 = require("react/jsx-runtime");
6266
+ var import_react50 = require("react");
5910
6267
  var DEFAULT_BREAKPOINT_PX2 = 768;
5911
6268
  function readPersistedCollapsed2(key) {
5912
6269
  if (!key || typeof window === "undefined") return false;
@@ -5926,9 +6283,9 @@ function writePersistedCollapsed2(key, collapsed) {
5926
6283
  function makeComposerWithPortal(BaseComposer) {
5927
6284
  const Resolved = BaseComposer ?? Composer;
5928
6285
  return function StudioComposerWithSidebar(props) {
5929
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
5930
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(StudioSidebarRuntimePortal, {}),
5931
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Resolved, { ...props })
6286
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [
6287
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(StudioSidebarRuntimePortal, {}),
6288
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Resolved, { ...props })
5932
6289
  ] });
5933
6290
  };
5934
6291
  }
@@ -5948,7 +6305,7 @@ var TimbalStudioShell = ({
5948
6305
  components,
5949
6306
  ...chatProps
5950
6307
  }) => {
5951
- const reducedMotion = (0, import_react46.useReducedMotion)();
6308
+ const reducedMotion = (0, import_react49.useReducedMotion)();
5952
6309
  const shouldFetchWorkforces = !workforceId && workforcesProp === void 0;
5953
6310
  const fetched = useWorkforces({
5954
6311
  enabled: shouldFetchWorkforces,
@@ -5956,36 +6313,36 @@ var TimbalStudioShell = ({
5956
6313
  baseUrl: workforcesBaseUrl
5957
6314
  });
5958
6315
  const workforces = workforcesProp ?? fetched.workforces;
5959
- const [internalSelected, setInternalSelected] = (0, import_react45.useState)(
6316
+ const [internalSelected, setInternalSelected] = (0, import_react48.useState)(
5960
6317
  workforceId ?? ""
5961
6318
  );
5962
- (0, import_react45.useEffect)(() => {
6319
+ (0, import_react48.useEffect)(() => {
5963
6320
  if (workforceId) return;
5964
6321
  if (internalSelected) return;
5965
6322
  const first = workforces[0]?.id ?? workforces[0]?.uid ?? workforces[0]?.name;
5966
6323
  if (first) setInternalSelected(first);
5967
6324
  }, [workforces, workforceId, internalSelected]);
5968
6325
  const activeWorkforceId = workforceId ?? internalSelected ?? fetched.selectedId ?? "";
5969
- const [collapsed, setCollapsed] = (0, import_react45.useState)(() => {
6326
+ const [collapsed, setCollapsed] = (0, import_react48.useState)(() => {
5970
6327
  const persisted = readPersistedCollapsed2(persistKey);
5971
6328
  return persisted || defaultCollapsed;
5972
6329
  });
5973
- const [isMobile, setIsMobile] = (0, import_react45.useState)(() => {
6330
+ const [isMobile, setIsMobile] = (0, import_react48.useState)(() => {
5974
6331
  if (typeof window === "undefined") return false;
5975
6332
  return window.innerWidth < mobileBreakpointPx;
5976
6333
  });
5977
- const [mobileSidebarOpen, setMobileSidebarOpen] = (0, import_react45.useState)(false);
5978
- (0, import_react45.useEffect)(() => {
6334
+ const [mobileSidebarOpen, setMobileSidebarOpen] = (0, import_react48.useState)(false);
6335
+ (0, import_react48.useEffect)(() => {
5979
6336
  if (typeof window === "undefined") return;
5980
6337
  const onResize = () => setIsMobile(window.innerWidth < mobileBreakpointPx);
5981
6338
  onResize();
5982
6339
  window.addEventListener("resize", onResize);
5983
6340
  return () => window.removeEventListener("resize", onResize);
5984
6341
  }, [mobileBreakpointPx]);
5985
- (0, import_react45.useEffect)(() => {
6342
+ (0, import_react48.useEffect)(() => {
5986
6343
  if (!isMobile) setMobileSidebarOpen(false);
5987
6344
  }, [isMobile]);
5988
- (0, import_react45.useEffect)(() => {
6345
+ (0, import_react48.useEffect)(() => {
5989
6346
  if (!mobileSidebarOpen) return;
5990
6347
  const onKeyDown = (e) => {
5991
6348
  if (e.key === "Escape") setMobileSidebarOpen(false);
@@ -6009,21 +6366,21 @@ var TimbalStudioShell = ({
6009
6366
  layoutDirection
6010
6367
  );
6011
6368
  const desktopInsetPx = widthCollapsed ? SIDEBAR_INSET_PX_COLLAPSED : SIDEBAR_INSET_PX_EXPANDED;
6012
- const onCollapsedChange = (0, import_react45.useCallback)(
6369
+ const onCollapsedChange = (0, import_react48.useCallback)(
6013
6370
  (next) => {
6014
6371
  setCollapsed(next);
6015
6372
  writePersistedCollapsed2(persistKey, next);
6016
6373
  },
6017
6374
  [persistKey]
6018
6375
  );
6019
- const handleSelectWorkforce = (0, import_react45.useCallback)(
6376
+ const handleSelectWorkforce = (0, import_react48.useCallback)(
6020
6377
  (id) => {
6021
6378
  if (!workforceId) setInternalSelected(id);
6022
6379
  if (isMobile) setMobileSidebarOpen(false);
6023
6380
  },
6024
6381
  [workforceId, isMobile]
6025
6382
  );
6026
- const sidebarContext = (0, import_react45.useMemo)(
6383
+ const sidebarContext = (0, import_react48.useMemo)(
6027
6384
  () => ({
6028
6385
  collapsed: effectiveCollapsed,
6029
6386
  isMobile,
@@ -6032,12 +6389,12 @@ var TimbalStudioShell = ({
6032
6389
  }),
6033
6390
  [effectiveCollapsed, isMobile, isCollapsedRail, iconOnlyLayout]
6034
6391
  );
6035
- const resolvedComponents = (0, import_react45.useMemo)(() => {
6392
+ const resolvedComponents = (0, import_react48.useMemo)(() => {
6036
6393
  const next = { Welcome: StudioWelcome, ...components };
6037
6394
  next.Composer = makeComposerWithPortal(components?.Composer);
6038
6395
  return next;
6039
6396
  }, [components]);
6040
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(StudioSidebarContext.Provider, { value: sidebarContext, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
6397
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(StudioSidebarContext.Provider, { value: sidebarContext, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
6041
6398
  "div",
6042
6399
  {
6043
6400
  className: cn(
@@ -6046,14 +6403,14 @@ var TimbalStudioShell = ({
6046
6403
  ),
6047
6404
  style: studioChromeShellStyle,
6048
6405
  children: [
6049
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
6406
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
6050
6407
  "div",
6051
6408
  {
6052
6409
  className: "pointer-events-none absolute inset-0 z-0 bg-background",
6053
6410
  "aria-hidden": true
6054
6411
  }
6055
6412
  ),
6056
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
6413
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
6057
6414
  "div",
6058
6415
  {
6059
6416
  className: cn(
@@ -6063,14 +6420,14 @@ var TimbalStudioShell = ({
6063
6420
  "aria-hidden": true
6064
6421
  }
6065
6422
  ),
6066
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
6423
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
6067
6424
  StudioSidebarBackdrop,
6068
6425
  {
6069
6426
  open: isMobile && mobileSidebarOpen,
6070
6427
  onClose: () => setMobileSidebarOpen(false)
6071
6428
  }
6072
6429
  ),
6073
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
6430
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
6074
6431
  StudioSidebarPanel,
6075
6432
  {
6076
6433
  workforces,
@@ -6089,8 +6446,8 @@ var TimbalStudioShell = ({
6089
6446
  emptyCaption: sidebarEmptyCaption
6090
6447
  }
6091
6448
  ),
6092
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
6093
- import_react46.motion.header,
6449
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
6450
+ import_react49.motion.header,
6094
6451
  {
6095
6452
  className: cn(
6096
6453
  "absolute top-0 right-0 z-40 flex items-start justify-between gap-2",
@@ -6101,7 +6458,7 @@ var TimbalStudioShell = ({
6101
6458
  animate: { left: isMobile ? 0 : desktopInsetPx },
6102
6459
  transition: layoutTransition,
6103
6460
  children: [
6104
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
6461
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
6105
6462
  "div",
6106
6463
  {
6107
6464
  className: cn(
@@ -6109,7 +6466,7 @@ var TimbalStudioShell = ({
6109
6466
  studioTopbarPillHeightClass
6110
6467
  ),
6111
6468
  children: [
6112
- isMobile && !mobileSidebarOpen ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
6469
+ isMobile && !mobileSidebarOpen ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
6113
6470
  TimbalV2Button,
6114
6471
  {
6115
6472
  variant: "secondary",
@@ -6119,19 +6476,19 @@ var TimbalStudioShell = ({
6119
6476
  onClick: () => setMobileSidebarOpen(true),
6120
6477
  "aria-label": "Open menu",
6121
6478
  "aria-expanded": false,
6122
- children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lucide_react13.Menu, { className: "size-4" })
6479
+ children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_lucide_react13.Menu, { className: "size-4" })
6123
6480
  }
6124
6481
  ) : null,
6125
6482
  headerStart
6126
6483
  ]
6127
6484
  }
6128
6485
  ),
6129
- headerActions ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "flex shrink-0 items-center gap-1", children: headerActions }) : null
6486
+ headerActions ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "flex shrink-0 items-center gap-1", children: headerActions }) : null
6130
6487
  ]
6131
6488
  }
6132
6489
  ),
6133
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
6134
- import_react46.motion.main,
6490
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
6491
+ import_react49.motion.main,
6135
6492
  {
6136
6493
  className: cn(
6137
6494
  "relative z-10 flex h-full min-w-0 flex-col",
@@ -6141,7 +6498,7 @@ var TimbalStudioShell = ({
6141
6498
  initial: false,
6142
6499
  animate: { paddingLeft: isMobile ? 12 : desktopInsetPx },
6143
6500
  transition: layoutTransition,
6144
- children: activeWorkforceId ? /* @__PURE__ */ (0, import_react47.createElement)(
6501
+ children: activeWorkforceId ? /* @__PURE__ */ (0, import_react50.createElement)(
6145
6502
  TimbalChat,
6146
6503
  {
6147
6504
  ...chatProps,
@@ -6160,9 +6517,9 @@ var TimbalStudioShell = ({
6160
6517
  };
6161
6518
 
6162
6519
  // src/studio/sidebar/mode-toggle.tsx
6163
- var import_react48 = require("react");
6520
+ var import_react51 = require("react");
6164
6521
  var import_lucide_react14 = require("lucide-react");
6165
- var import_jsx_runtime50 = require("react/jsx-runtime");
6522
+ var import_jsx_runtime53 = require("react/jsx-runtime");
6166
6523
  function readStoredTheme() {
6167
6524
  if (typeof window === "undefined") return null;
6168
6525
  try {
@@ -6190,8 +6547,8 @@ var ModeToggle = ({
6190
6547
  label = "Toggle theme"
6191
6548
  }) => {
6192
6549
  const isControlled = theme !== void 0;
6193
- const [internalIsDark, setInternalIsDark] = (0, import_react48.useState)(false);
6194
- (0, import_react48.useLayoutEffect)(() => {
6550
+ const [internalIsDark, setInternalIsDark] = (0, import_react51.useState)(false);
6551
+ (0, import_react51.useLayoutEffect)(() => {
6195
6552
  if (isControlled) return;
6196
6553
  const stored = readStoredTheme();
6197
6554
  if (stored) {
@@ -6203,7 +6560,7 @@ var ModeToggle = ({
6203
6560
  setInternalIsDark(document.documentElement.classList.contains("dark"));
6204
6561
  }, [isControlled]);
6205
6562
  const isDark = isControlled ? theme === "dark" : internalIsDark;
6206
- const onClick = (0, import_react48.useCallback)(() => {
6563
+ const onClick = (0, import_react51.useCallback)(() => {
6207
6564
  const next = isDark ? "light" : "dark";
6208
6565
  if (setTheme) {
6209
6566
  setTheme(next);
@@ -6214,7 +6571,7 @@ var ModeToggle = ({
6214
6571
  writeStoredTheme(isDarkNext ? "dark" : "light");
6215
6572
  setInternalIsDark(isDarkNext);
6216
6573
  }, [isDark, setTheme]);
6217
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
6574
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
6218
6575
  TimbalV2Button,
6219
6576
  {
6220
6577
  variant: "secondary",
@@ -6230,20 +6587,20 @@ var ModeToggle = ({
6230
6587
  "aria-label": label,
6231
6588
  title: label,
6232
6589
  children: [
6233
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_lucide_react14.Sun, { className: "size-3.5 scale-100 rotate-0 transition-all dark:scale-0 dark:-rotate-90" }),
6234
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_lucide_react14.Moon, { className: "absolute size-3.5 scale-0 rotate-90 transition-all dark:scale-100 dark:rotate-0" }),
6235
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "sr-only", children: label })
6590
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_lucide_react14.Sun, { className: "size-3.5 scale-100 rotate-0 transition-all dark:scale-0 dark:-rotate-90" }),
6591
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_lucide_react14.Moon, { className: "absolute size-3.5 scale-0 rotate-90 transition-all dark:scale-100 dark:rotate-0" }),
6592
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "sr-only", children: label })
6236
6593
  ]
6237
6594
  }
6238
6595
  );
6239
6596
  };
6240
6597
 
6241
6598
  // src/studio/mode-switch.tsx
6242
- var import_react51 = require("react");
6599
+ var import_react54 = require("react");
6243
6600
 
6244
6601
  // src/ui/pill-segmented-tabs.tsx
6245
- var import_react49 = require("react");
6246
- var import_react50 = require("motion/react");
6602
+ var import_react52 = require("react");
6603
+ var import_react53 = require("motion/react");
6247
6604
 
6248
6605
  // src/design/pill-segmented-classes.ts
6249
6606
  var pillSegmentedTrackBase = "inline-flex w-fit max-w-max shrink-0 self-start items-center rounded-full";
@@ -6276,7 +6633,7 @@ var pillSegmentedActiveIndicatorClass = cn(
6276
6633
  );
6277
6634
 
6278
6635
  // src/ui/pill-segmented-tabs.tsx
6279
- var import_jsx_runtime51 = require("react/jsx-runtime");
6636
+ var import_jsx_runtime54 = require("react/jsx-runtime");
6280
6637
  var PillTab = ({
6281
6638
  tabKey,
6282
6639
  label,
@@ -6287,10 +6644,10 @@ var PillTab = ({
6287
6644
  segmentClassName,
6288
6645
  animateIndicator
6289
6646
  }) => {
6290
- const handlePress = (0, import_react49.useCallback)(() => {
6647
+ const handlePress = (0, import_react52.useCallback)(() => {
6291
6648
  if (!disabled) onSelect(tabKey);
6292
6649
  }, [disabled, onSelect, tabKey]);
6293
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
6650
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
6294
6651
  "button",
6295
6652
  {
6296
6653
  type: "button",
@@ -6303,15 +6660,15 @@ var PillTab = ({
6303
6660
  !disabled && (isActive ? "text-foreground" : "text-muted-foreground hover:text-foreground")
6304
6661
  ),
6305
6662
  children: [
6306
- isActive && animateIndicator ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
6307
- import_react50.motion.div,
6663
+ isActive && animateIndicator ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
6664
+ import_react53.motion.div,
6308
6665
  {
6309
6666
  layoutId,
6310
6667
  className: pillSegmentedActiveIndicatorClass,
6311
6668
  transition: { type: "spring", duration: 0.3, bounce: 0.15 }
6312
6669
  }
6313
- ) : isActive ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: pillSegmentedActiveIndicatorClass, "aria-hidden": true }) : null,
6314
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "relative z-10 whitespace-nowrap", children: label })
6670
+ ) : isActive ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: pillSegmentedActiveIndicatorClass, "aria-hidden": true }) : null,
6671
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "relative z-10 whitespace-nowrap", children: label })
6315
6672
  ]
6316
6673
  }
6317
6674
  );
@@ -6325,13 +6682,13 @@ var PillSegmentedTabs = ({
6325
6682
  layoutId: layoutIdProp,
6326
6683
  "aria-label": ariaLabel
6327
6684
  }) => {
6328
- const reactId = (0, import_react49.useId)();
6685
+ const reactId = (0, import_react52.useId)();
6329
6686
  const layoutId = layoutIdProp ?? `pill-segmented-${reactId.replace(/:/g, "")}`;
6330
- const reducedMotion = (0, import_react50.useReducedMotion)();
6687
+ const reducedMotion = (0, import_react53.useReducedMotion)();
6331
6688
  const isFlush = trackVariant === "flush";
6332
6689
  const trackClass = isFlush ? pillSegmentedTrackFlushClass : pillSegmentedTrackClass;
6333
6690
  const segmentClassName = isFlush ? pillSegmentedFlushSegmentClass : pillSegmentedSegmentClass;
6334
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { role: "group", "aria-label": ariaLabel, className: cn(trackClass, className), children: tabs.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
6691
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { role: "group", "aria-label": ariaLabel, className: cn(trackClass, className), children: tabs.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
6335
6692
  PillTab,
6336
6693
  {
6337
6694
  tabKey: tab.key,
@@ -6346,15 +6703,15 @@ var PillSegmentedTabs = ({
6346
6703
  tab.key
6347
6704
  )) });
6348
6705
  };
6349
- var MemoPillSegmentedTabs = (0, import_react49.memo)(PillSegmentedTabs);
6706
+ var MemoPillSegmentedTabs = (0, import_react52.memo)(PillSegmentedTabs);
6350
6707
 
6351
6708
  // src/studio/mode-switch.tsx
6352
- var import_jsx_runtime52 = require("react/jsx-runtime");
6709
+ var import_jsx_runtime55 = require("react/jsx-runtime");
6353
6710
  var STUDIO_NAV_MODE = {
6354
6711
  BUILD: "build",
6355
6712
  OPERATE: "operate"
6356
6713
  };
6357
- var StudioModeSwitch = (0, import_react51.memo)(
6714
+ var StudioModeSwitch = (0, import_react54.memo)(
6358
6715
  function StudioModeSwitch2({
6359
6716
  value,
6360
6717
  onChange,
@@ -6363,14 +6720,14 @@ var StudioModeSwitch = (0, import_react51.memo)(
6363
6720
  manageLabel = "Manage",
6364
6721
  "aria-label": ariaLabel = "Studio mode"
6365
6722
  }) {
6366
- const tabs = (0, import_react51.useMemo)(
6723
+ const tabs = (0, import_react54.useMemo)(
6367
6724
  () => [
6368
6725
  { key: STUDIO_NAV_MODE.BUILD, label: buildLabel },
6369
6726
  { key: STUDIO_NAV_MODE.OPERATE, label: manageLabel }
6370
6727
  ],
6371
6728
  [buildLabel, manageLabel]
6372
6729
  );
6373
- const handleChange = (0, import_react51.useCallback)(
6730
+ const handleChange = (0, import_react54.useCallback)(
6374
6731
  (key) => {
6375
6732
  if (key === STUDIO_NAV_MODE.BUILD || key === STUDIO_NAV_MODE.OPERATE) {
6376
6733
  onChange(key);
@@ -6378,14 +6735,14 @@ var StudioModeSwitch = (0, import_react51.memo)(
6378
6735
  },
6379
6736
  [onChange]
6380
6737
  );
6381
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
6738
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
6382
6739
  "div",
6383
6740
  {
6384
6741
  "data-tour": "studio-mode-switch",
6385
6742
  "data-studio-chrome-align": "mode-switch",
6386
6743
  id: "studio-chrome-mode-switch",
6387
6744
  className,
6388
- children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
6745
+ children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
6389
6746
  PillSegmentedTabs,
6390
6747
  {
6391
6748
  value,