@pstdio/ui 0.23.0 → 0.24.2

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 (66) hide show
  1. package/dist/{MermaidComponent-BTgLnpLA.js → MermaidComponent-DSvPk-J8.js} +2 -2
  2. package/dist/{MermaidComponent-BTgLnpLA.js.map → MermaidComponent-DSvPk-J8.js.map} +1 -1
  3. package/dist/chat-ui.js +1308 -1391
  4. package/dist/chat-ui.js.map +1 -1
  5. package/dist/components/chat-ui/components/chat-input-actions.d.ts +2 -0
  6. package/dist/components/chat-ui/components/chat-input-question-prompt.d.ts +3 -0
  7. package/dist/components/chat-ui/components/chat-input.d.ts +3 -1
  8. package/dist/components/chat-ui/components/chat-panel.d.ts +3 -1
  9. package/dist/components/chat-ui/components/timeline-title.d.ts +6 -0
  10. package/dist/components/layout/index.d.ts +1 -0
  11. package/dist/components/layout/resizable-split-layout.d.ts +4 -3
  12. package/dist/components/layout/resizable-split-layout.handle.d.ts +6 -2
  13. package/dist/components/layout/resizable-split-layout.panels.d.ts +6 -2
  14. package/dist/components/layout/resizable-split-layout.root-size.d.ts +3 -0
  15. package/dist/components/primitives/index.d.ts +2 -0
  16. package/dist/components/tab-strip/window-tabs.d.ts +1 -0
  17. package/dist/data-table.js +5 -5
  18. package/dist/{diff-editor-BnfV8cYB.js → diff-bubble-DvUPRnfB.js} +49 -48
  19. package/dist/diff-bubble-DvUPRnfB.js.map +1 -0
  20. package/dist/diff.js +112 -112
  21. package/dist/diff.js.map +1 -1
  22. package/dist/{edit-mode-data-table-BrydKuMM.js → edit-mode-data-table-2E4GSOou.js} +4 -4
  23. package/dist/{edit-mode-data-table-BrydKuMM.js.map → edit-mode-data-table-2E4GSOou.js.map} +1 -1
  24. package/dist/index.js +1232 -1152
  25. package/dist/index.js.map +1 -1
  26. package/dist/{kanban-renderer-toolbar-ebqlG13w.js → kanban-renderer-toolbar-Dcbxujbk.js} +3 -3
  27. package/dist/{kanban-renderer-toolbar-ebqlG13w.js.map → kanban-renderer-toolbar-Dcbxujbk.js.map} +1 -1
  28. package/dist/kanban-renderer.js +8 -8
  29. package/dist/kanban-renderer.js.map +1 -1
  30. package/dist/{lazy-markdown-editor-Obb0M8xc.js → lazy-markdown-editor-DSlelhHV.js} +2 -2
  31. package/dist/{lazy-markdown-editor-Obb0M8xc.js.map → lazy-markdown-editor-DSlelhHV.js.map} +1 -1
  32. package/dist/{list-row-CRi3Luog.js → list-row-BDoV_iMV.js} +3 -3
  33. package/dist/list-row-BDoV_iMV.js.map +1 -0
  34. package/dist/{markdown-kuU19Oh3.js → markdown-Cli3KGu9.js} +4 -4
  35. package/dist/{markdown-kuU19Oh3.js.map → markdown-Cli3KGu9.js.map} +1 -1
  36. package/dist/{markdown-editor-Bj_QX4oN.js → markdown-editor-BHoRATej.js} +2 -2
  37. package/dist/{markdown-editor-Bj_QX4oN.js.map → markdown-editor-BHoRATej.js.map} +1 -1
  38. package/dist/{param-editor-DgzVeyJ0.js → param-editor-CaRflJ3e.js} +2 -2
  39. package/dist/{param-editor-DgzVeyJ0.js.map → param-editor-CaRflJ3e.js.map} +1 -1
  40. package/dist/{param-editor-field-BMvuSAP5.js → param-editor-field-DVQlXbid.js} +45 -44
  41. package/dist/param-editor-field-DVQlXbid.js.map +1 -0
  42. package/dist/{rich-message-dNYvLDd4.js → rich-message-gWYlm8Ji.js} +2 -2
  43. package/dist/{rich-message-dNYvLDd4.js.map → rich-message-gWYlm8Ji.js.map} +1 -1
  44. package/dist/rich-text.js +5 -5
  45. package/dist/theme/primitives/colors.d.ts +34 -0
  46. package/dist/theme/primitives/sizes.d.ts +9 -0
  47. package/dist/theme/recipes/landing-story.d.ts +10 -0
  48. package/dist/theme/recipes/landing-tool-demo.d.ts +1 -0
  49. package/dist/theme/recipes/landing.d.ts +23 -0
  50. package/dist/theme/recipes/resizable-split-layout.d.ts +106 -0
  51. package/dist/theme/recipes/window-title-bar.d.ts +3 -0
  52. package/dist/theme/tokens/colors-background.d.ts +260 -0
  53. package/dist/theme/tokens/colors-visualization.d.ts +162 -0
  54. package/dist/theme/tokens/colors.d.ts +2 -422
  55. package/dist/{theme-C0empEin.js → theme-B5OVwYEU.js} +1413 -563
  56. package/dist/theme-B5OVwYEU.js.map +1 -0
  57. package/dist/theme.js +1 -1
  58. package/dist/tree-list-CZvcg3_6.js +1348 -0
  59. package/dist/tree-list-CZvcg3_6.js.map +1 -0
  60. package/package.json +2 -2
  61. package/dist/diff-editor-BnfV8cYB.js.map +0 -1
  62. package/dist/list-row-CRi3Luog.js.map +0 -1
  63. package/dist/param-editor-field-BMvuSAP5.js.map +0 -1
  64. package/dist/theme-C0empEin.js.map +0 -1
  65. package/dist/tree-list-BHFSyvIZ.js +0 -1262
  66. package/dist/tree-list-BHFSyvIZ.js.map +0 -1
package/dist/chat-ui.js CHANGED
@@ -1,22 +1,22 @@
1
- import { jsx as c, jsxs as k, Fragment as tn } from "react/jsx-runtime";
2
- import { c as C } from "react/compiler-runtime";
3
- import { AbsoluteCenter as ys, IconButton as nt, chakra as Rn, createSlotRecipeContext as xs, defineSlotRecipe as Ss, Text as U, Code as pn, Button as ft, HStack as ae, Box as B, Flex as Qe, Stack as G, Textarea as ws, Tooltip as Ct, Portal as Mn, Kbd as Ts, Spacer as As, Timeline as Cs, Span as dt, Avatar as st, Image as Pn, Card as ie, Link as En, Spinner as nn, Badge as ks, Icon as Ht, Skeleton as Is } from "@chakra-ui/react";
4
- import { ArrowDownIcon as _s, ShieldX as vs, ShieldCheck as Rs, Check as Dn, Pause as Ms, ArrowUp as Ps, Copy as Es, Move as Ds, FileDown as Bs, FileUp as Fs, FileDiff as Ls, Trash2 as Bn, FilePen as $s, FileText as Os, ListTree as zs, Terminal as Fn, ListTodo as Qs, CircleQuestionMark as qs, File as Ws, Globe as Hs, Search as Vs, AlertTriangle as Ln, DotIcon as Ns, ChevronUpIcon as Us, GripVertical as js, Pencil as Ks, MessageCircleIcon as Xs } from "lucide-react";
5
- import { useStickToBottomContext as It, StickToBottom as Gs } from "use-stick-to-bottom";
6
- import { S as _t, T as sn } from "./browser-storage-DPtOQJx0.js";
7
- import { Fragment as Ys, useRef as Te, useEffect as le, useState as H } from "react";
8
- import { R as on, C as $n } from "./lazy-markdown-editor-Obb0M8xc.js";
9
- import { a as Vt, P as Js, g as Zs, R as On } from "./rich-message-dNYvLDd4.js";
10
- import { R as eo, a as to, A as mn } from "./radio-cLMEBBZk.js";
11
- import { E as no } from "./empty-state-Bo4HVrgr.js";
12
- import { useVirtualizer as so } from "@tanstack/react-virtual";
13
- import { D as oo, a as ro } from "./diff-editor-BnfV8cYB.js";
14
- const io = {
1
+ import { jsx as c, jsxs as k, Fragment as At } from "react/jsx-runtime";
2
+ import { c as A } from "react/compiler-runtime";
3
+ import { AbsoluteCenter as zn, IconButton as Pe, chakra as Gt, createSlotRecipeContext as Qn, defineSlotRecipe as qn, Text as U, Code as Bt, Button as Oe, HStack as Z, Box as P, Flex as be, Stack as j, Textarea as Wn, Tooltip as Ke, Portal as Yt, Kbd as Hn, Spacer as Vn, Link as Jt, Span as $e, Avatar as Ee, Timeline as Nn, Image as Zt, Card as Y, Spinner as kt, Badge as Un, Icon as dt, Skeleton as jn } from "@chakra-ui/react";
4
+ import { ArrowDownIcon as Kn, ShieldX as Xn, ShieldCheck as Gn, Check as en, Pause as Yn, ArrowUp as Jn, Copy as Zn, Move as es, FileDown as ts, FileUp as ns, FileDiff as ss, Trash2 as tn, FilePen as os, FileText as rs, ListTree as is, Terminal as nn, ListTodo as ls, CircleQuestionMark as as, File as cs, Globe as us, Search as ds, AlertTriangle as sn, DotIcon as fs, ChevronUpIcon as ps, GripVertical as ms, Pencil as hs, MessageCircleIcon as gs } from "lucide-react";
5
+ import { useStickToBottomContext as Ge, StickToBottom as bs } from "use-stick-to-bottom";
6
+ import { S as Ye, T as Ct } from "./browser-storage-DPtOQJx0.js";
7
+ import { Fragment as ys, useRef as ie, useEffect as J, useState as V } from "react";
8
+ import { R as It, C as on } from "./lazy-markdown-editor-DSlelhHV.js";
9
+ import { a as ft, P as xs, g as Ss, R as rn } from "./rich-message-gWYlm8Ji.js";
10
+ import { R as ws, a as Ts, A as Ft } from "./radio-cLMEBBZk.js";
11
+ import { E as As } from "./empty-state-Bo4HVrgr.js";
12
+ import { useVirtualizer as ks } from "@tanstack/react-virtual";
13
+ import { a as Cs, D as Is } from "./diff-bubble-DvUPRnfB.js";
14
+ const _s = {
15
15
  "aria-roledescription": "conversation",
16
16
  initial: "instant",
17
17
  resize: "instant",
18
18
  role: "log"
19
- }, lo = Rn(Gs, {
19
+ }, Rs = Gt(bs, {
20
20
  base: {
21
21
  position: "relative",
22
22
  flex: 1,
@@ -25,18 +25,18 @@ const io = {
25
25
  }
26
26
  }, {
27
27
  forwardProps: ["initial", "resize"],
28
- defaultProps: io
29
- }), ao = (t) => {
30
- const e = C(10);
31
- let n, o;
28
+ defaultProps: _s
29
+ }), vs = (t) => {
30
+ const e = A(10);
31
+ let n, s;
32
32
  e[0] !== t ? ({
33
33
  children: n,
34
- ...o
35
- } = t, e[0] = t, e[1] = n, e[2] = o) : (n = e[1], o = e[2]);
34
+ ...s
35
+ } = t, e[0] = t, e[1] = n, e[2] = s) : (n = e[1], s = e[2]);
36
36
  const {
37
- contentRef: s,
37
+ contentRef: o,
38
38
  scrollRef: r
39
- } = It(), i = r, l = s;
39
+ } = Ge(), i = r, l = o;
40
40
  let a, u;
41
41
  e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (a = {
42
42
  zIndex: 2
@@ -46,23 +46,23 @@ const io = {
46
46
  role: "list"
47
47
  }, e[3] = a, e[4] = u) : (a = e[3], u = e[4]);
48
48
  let d;
49
- return e[5] !== n || e[6] !== o || e[7] !== i || e[8] !== l ? (d = /* @__PURE__ */ c(_t, { ...o, height: "full", width: "full", showHorizontalScrollbar: !1, viewportRef: i, contentRef: l, verticalScrollbarProps: a, contentProps: u, children: n }), e[5] = n, e[6] = o, e[7] = i, e[8] = l, e[9] = d) : d = e[9], d;
50
- }, co = {
49
+ return e[5] !== n || e[6] !== s || e[7] !== i || e[8] !== l ? (d = /* @__PURE__ */ c(Ye, { ...s, height: "full", width: "full", showHorizontalScrollbar: !1, viewportRef: i, contentRef: l, verticalScrollbarProps: a, contentProps: u, children: n }), e[5] = n, e[6] = s, e[7] = i, e[8] = l, e[9] = d) : d = e[9], d;
50
+ }, Ms = {
51
51
  axis: "horizontal",
52
52
  bottom: "md",
53
53
  zIndex: 2
54
- }, uo = (t) => {
55
- const e = C(4), {
54
+ }, Ps = (t) => {
55
+ const e = A(4), {
56
56
  isAtBottom: n,
57
- scrollToBottom: o
58
- } = It();
59
- let s;
60
- return e[0] !== n || e[1] !== t || e[2] !== o ? (s = !n && /* @__PURE__ */ c(ys, { ...co, children: /* @__PURE__ */ c(nt, { rounded: "full", onClick: () => o(), variant: "outline", size: "xs", ...t, children: /* @__PURE__ */ c(_s, { size: 16 }) }) }), e[0] = n, e[1] = t, e[2] = o, e[3] = s) : s = e[3], s;
61
- }, Nt = {
62
- Root: lo,
63
- Viewport: ao,
64
- ScrollToBottom: uo
65
- }, fo = Ss({
57
+ scrollToBottom: s
58
+ } = Ge();
59
+ let o;
60
+ return e[0] !== n || e[1] !== t || e[2] !== s ? (o = !n && /* @__PURE__ */ c(zn, { ...Ms, children: /* @__PURE__ */ c(Pe, { rounded: "full", onClick: () => s(), variant: "outline", size: "xs", ...t, children: /* @__PURE__ */ c(Kn, { size: 16 }) }) }), e[0] = n, e[1] = t, e[2] = s, e[3] = o) : o = e[3], o;
61
+ }, pt = {
62
+ Root: Rs,
63
+ Viewport: vs,
64
+ ScrollToBottom: Ps
65
+ }, Es = qn({
66
66
  className: "ai-message",
67
67
  slots: ["root", "content"],
68
68
  base: {
@@ -169,102 +169,102 @@ const io = {
169
169
  shape: "rounded"
170
170
  }
171
171
  }), {
172
- withProvider: po,
173
- withContext: mo
174
- } = xs({
175
- recipe: fo
176
- }), ho = po("div", "root"), go = mo("div", "content"), ze = {
177
- Root: ho,
178
- Content: go
179
- }, bo = (t) => {
172
+ withProvider: Ds,
173
+ withContext: Bs
174
+ } = Qn({
175
+ recipe: Es
176
+ }), Fs = Ds("div", "root"), Ls = Bs("div", "content"), ge = {
177
+ Root: Fs,
178
+ Content: Ls
179
+ }, $s = (t) => {
180
180
  if (t == null) return null;
181
181
  const e = typeof t == "string" ? t : JSON.stringify(t, null, 2);
182
182
  return e.length === 0 ? null : e.length > 200 ? `${e.slice(0, 200)}...` : e;
183
- }, Jl = (t) => {
184
- const e = C(19), {
183
+ }, bl = (t) => {
184
+ const e = A(19), {
185
185
  toolName: n,
186
- toolInput: o,
187
- onApprove: s,
186
+ toolInput: s,
187
+ onApprove: o,
188
188
  onDeny: r
189
189
  } = t;
190
190
  let i;
191
- e[0] !== o ? (i = bo(o), e[0] = o, e[1] = i) : i = e[1];
191
+ e[0] !== s ? (i = $s(s), e[0] = s, e[1] = i) : i = e[1];
192
192
  const l = i;
193
193
  let a;
194
194
  e[2] !== n ? (a = /* @__PURE__ */ k(U, { textStyle: "label/S/medium", color: "fg", children: [
195
195
  "Allow ",
196
- /* @__PURE__ */ c(pn, { size: "sm", children: n }),
196
+ /* @__PURE__ */ c(Bt, { size: "sm", children: n }),
197
197
  "?"
198
198
  ] }), e[2] = n, e[3] = a) : a = e[3];
199
199
  let u;
200
- e[4] !== l ? (u = l ? /* @__PURE__ */ c(_t, { maxH: "6rem", children: /* @__PURE__ */ c(pn, { size: "sm", whiteSpace: "pre-wrap", display: "block", width: "100%", children: l }) }) : null, e[4] = l, e[5] = u) : u = e[5];
200
+ e[4] !== l ? (u = l ? /* @__PURE__ */ c(Ye, { maxH: "6rem", children: /* @__PURE__ */ c(Bt, { size: "sm", whiteSpace: "pre-wrap", display: "block", width: "100%", children: l }) }) : null, e[4] = l, e[5] = u) : u = e[5];
201
201
  let d;
202
- e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ c(vs, { size: 14 }), e[6] = d) : d = e[6];
202
+ e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ c(Xn, { size: 14 }), e[6] = d) : d = e[6];
203
203
  let f;
204
- e[7] !== r ? (f = /* @__PURE__ */ k(ft, { size: "xs", variant: "outline", onClick: r, children: [
204
+ e[7] !== r ? (f = /* @__PURE__ */ k(Oe, { size: "xs", variant: "outline", onClick: r, children: [
205
205
  d,
206
206
  "Deny"
207
207
  ] }), e[7] = r, e[8] = f) : f = e[8];
208
208
  let p;
209
- e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ c(Rs, { size: 14 }), e[9] = p) : p = e[9];
209
+ e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ c(Gn, { size: 14 }), e[9] = p) : p = e[9];
210
210
  let m;
211
- e[10] !== s ? (m = /* @__PURE__ */ k(ft, { size: "xs", colorPalette: "green", onClick: s, children: [
211
+ e[10] !== o ? (m = /* @__PURE__ */ k(Oe, { size: "xs", colorPalette: "green", onClick: o, children: [
212
212
  p,
213
213
  "Allow"
214
- ] }), e[10] = s, e[11] = m) : m = e[11];
214
+ ] }), e[10] = o, e[11] = m) : m = e[11];
215
215
  let h;
216
- e[12] !== f || e[13] !== m ? (h = /* @__PURE__ */ k(ae, { gap: "xs", justifyContent: "flex-end", children: [
216
+ e[12] !== f || e[13] !== m ? (h = /* @__PURE__ */ k(Z, { gap: "xs", justifyContent: "flex-end", children: [
217
217
  f,
218
218
  m
219
219
  ] }), e[12] = f, e[13] = m, e[14] = h) : h = e[14];
220
220
  let g;
221
- return e[15] !== a || e[16] !== u || e[17] !== h ? (g = /* @__PURE__ */ c(B, { px: "sm", py: "xs", mx: "sm", borderWidth: "1px", borderColor: "border.warning", borderRadius: "lg", bg: "bg.warning", children: /* @__PURE__ */ k(Qe, { direction: "column", gap: "xs", children: [
221
+ return e[15] !== a || e[16] !== u || e[17] !== h ? (g = /* @__PURE__ */ c(P, { px: "sm", py: "xs", mx: "sm", borderWidth: "1px", borderColor: "border.warning", borderRadius: "lg", bg: "bg.warning", children: /* @__PURE__ */ k(be, { direction: "column", gap: "xs", children: [
222
222
  a,
223
223
  u,
224
224
  h
225
225
  ] }) }), e[15] = a, e[16] = u, e[17] = h, e[18] = g) : g = e[18], g;
226
- }, yo = "md", xo = "neutral", Zl = (t) => {
227
- const e = C(17), {
226
+ }, Os = "md", zs = "neutral", yl = (t) => {
227
+ const e = A(17), {
228
228
  attachments: n,
229
- onSelect: o,
230
- onRemove: s,
229
+ onSelect: s,
230
+ onRemove: o,
231
231
  renderBadge: r,
232
232
  size: i,
233
233
  tone: l
234
234
  } = t;
235
235
  let a;
236
236
  e[0] !== n ? (a = n === void 0 ? [] : n, e[0] = n, e[1] = a) : a = e[1];
237
- const u = a, d = i === void 0 ? yo : i, f = l === void 0 ? xo : l;
237
+ const u = a, d = i === void 0 ? Os : i, f = l === void 0 ? zs : l;
238
238
  if (u.length === 0)
239
239
  return null;
240
240
  let p;
241
- if (e[2] !== u || e[3] !== s || e[4] !== o || e[5] !== r || e[6] !== d || e[7] !== f) {
241
+ if (e[2] !== u || e[3] !== o || e[4] !== s || e[5] !== r || e[6] !== d || e[7] !== f) {
242
242
  let h;
243
- e[9] !== s || e[10] !== o || e[11] !== r || e[12] !== d || e[13] !== f ? (h = (g) => {
244
- const y = o ? () => o(g) : void 0, x = s ? () => s(g) : void 0;
243
+ e[9] !== o || e[10] !== s || e[11] !== r || e[12] !== d || e[13] !== f ? (h = (g) => {
244
+ const b = s ? () => s(g) : void 0, x = o ? () => o(g) : void 0;
245
245
  if (r) {
246
- const b = r({
246
+ const y = r({
247
247
  attachmentId: g,
248
- onSelect: y,
248
+ onSelect: b,
249
249
  onRemove: x,
250
250
  size: d,
251
251
  tone: f
252
252
  });
253
- return /* @__PURE__ */ c(Ys, { children: b }, g);
253
+ return /* @__PURE__ */ c(ys, { children: y }, g);
254
254
  }
255
- return /* @__PURE__ */ c(on, { fileName: g, onSelect: y, onRemove: x, size: d, tone: f }, g);
256
- }, e[9] = s, e[10] = o, e[11] = r, e[12] = d, e[13] = f, e[14] = h) : h = e[14], p = u.map(h), e[2] = u, e[3] = s, e[4] = o, e[5] = r, e[6] = d, e[7] = f, e[8] = p;
255
+ return /* @__PURE__ */ c(It, { fileName: g, onSelect: b, onRemove: x, size: d, tone: f }, g);
256
+ }, e[9] = o, e[10] = s, e[11] = r, e[12] = d, e[13] = f, e[14] = h) : h = e[14], p = u.map(h), e[2] = u, e[3] = o, e[4] = s, e[5] = r, e[6] = d, e[7] = f, e[8] = p;
257
257
  } else
258
258
  p = e[8];
259
259
  let m;
260
- return e[15] !== p ? (m = /* @__PURE__ */ c(G, { marginBottom: "sm", gap: "1", flexDir: "row", flexWrap: "wrap", children: p }), e[15] = p, e[16] = m) : m = e[16], m;
261
- }, So = (t) => {
260
+ return e[15] !== p ? (m = /* @__PURE__ */ c(j, { marginBottom: "sm", gap: "1", flexDir: "row", flexWrap: "wrap", children: p }), e[15] = p, e[16] = m) : m = e[16], m;
261
+ }, Qs = (t) => {
262
262
  const {
263
263
  previousUserMessageCount: e,
264
264
  userMessageCount: n
265
265
  } = t;
266
266
  return e === 0 ? !1 : n > e;
267
- }, wo = (t) => {
267
+ }, qs = (t) => {
268
268
  const e = t.conversationKey ?? null;
269
269
  return t.state.conversationKey !== e ? {
270
270
  shouldScroll: !1,
@@ -273,7 +273,7 @@ const io = {
273
273
  userMessageCount: t.userMessageCount
274
274
  }
275
275
  } : {
276
- shouldScroll: So({
276
+ shouldScroll: Qs({
277
277
  previousUserMessageCount: t.state.userMessageCount,
278
278
  userMessageCount: t.userMessageCount
279
279
  }),
@@ -282,56 +282,56 @@ const io = {
282
282
  userMessageCount: Math.max(t.state.userMessageCount, t.userMessageCount)
283
283
  }
284
284
  };
285
- }, To = (t) => {
286
- const e = wo(t);
285
+ }, Ws = (t) => {
286
+ const e = qs(t);
287
287
  return e.shouldScroll && t.scrollToBottom("instant"), e;
288
288
  };
289
- function Ao(t) {
290
- const e = C(8), {
289
+ function Hs(t) {
290
+ const e = A(8), {
291
291
  conversationKey: n,
292
- userMessageCount: o
292
+ userMessageCount: s
293
293
  } = t, {
294
- scrollToBottom: s
295
- } = It(), r = n ?? null;
294
+ scrollToBottom: o
295
+ } = Ge(), r = n ?? null;
296
296
  let i;
297
- e[0] !== r || e[1] !== o ? (i = {
297
+ e[0] !== r || e[1] !== s ? (i = {
298
298
  conversationKey: r,
299
- userMessageCount: o
300
- }, e[0] = r, e[1] = o, e[2] = i) : i = e[2];
301
- const l = Te(i);
299
+ userMessageCount: s
300
+ }, e[0] = r, e[1] = s, e[2] = i) : i = e[2];
301
+ const l = ie(i);
302
302
  let a, u;
303
- return e[3] !== n || e[4] !== s || e[5] !== o ? (a = () => {
304
- const d = To({
303
+ return e[3] !== n || e[4] !== o || e[5] !== s ? (a = () => {
304
+ const d = Ws({
305
305
  state: l.current,
306
306
  conversationKey: n,
307
- userMessageCount: o,
308
- scrollToBottom: s
307
+ userMessageCount: s,
308
+ scrollToBottom: o
309
309
  });
310
310
  l.current = d.state;
311
- }, u = [n, o, s], e[3] = n, e[4] = s, e[5] = o, e[6] = a, e[7] = u) : (a = e[6], u = e[7]), le(a, u), null;
311
+ }, u = [n, s, o], e[3] = n, e[4] = o, e[5] = s, e[6] = a, e[7] = u) : (a = e[6], u = e[7]), J(a, u), null;
312
312
  }
313
- const zn = (t) => t.trim().length > 0, Co = (t) => {
313
+ const ln = (t) => t.trim().length > 0, Vs = (t) => {
314
314
  const {
315
- hasQuestionPrompt: e,
315
+ canSubmit: e,
316
316
  isDisabled: n,
317
- streaming: o,
318
317
  text: s
319
318
  } = t;
320
- return n || o && !e || !zn(s) ? "none" : "submit";
321
- }, ko = (t) => {
319
+ return n || !e || !ln(s) ? "none" : "submit";
320
+ }, Ns = (t) => {
322
321
  const {
323
322
  canInterrupt: e,
324
- hasQuestionPrompt: n,
323
+ canSubmit: n,
324
+ hasQuestionPrompt: s,
325
325
  isDisabled: o,
326
- streaming: s,
327
- text: r
326
+ streaming: r,
327
+ text: i
328
328
  } = t;
329
- return o ? "none" : s && !n ? e ? "interrupt" : "none" : zn(r) ? "submit" : "none";
330
- }, Qn = 200, Io = (t, e = Qn) => t.length > 0 && t.split(/\r\n|\r|\n/).length > e, _o = (t) => {
329
+ return o ? "none" : n && ln(i) ? "submit" : r && !s && e ? "interrupt" : "none";
330
+ }, an = 200, Us = (t, e = an) => t.length > 0 && t.split(/\r\n|\r|\n/).length > e, js = (t) => {
331
331
  const {
332
332
  onAttachFiles: e,
333
333
  onAttachText: n,
334
- textAttachmentPasteLineThreshold: o
334
+ textAttachmentPasteLineThreshold: s
335
335
  } = t;
336
336
  return {
337
337
  onDragOver: (l) => {
@@ -348,29 +348,29 @@ const zn = (t) => t.trim().length > 0, Co = (t) => {
348
348
  return;
349
349
  }
350
350
  const u = l.clipboardData.getData("text/plain");
351
- n && Io(u, o) && (l.preventDefault(), n(u));
351
+ n && Us(u, s) && (l.preventDefault(), n(u));
352
352
  }
353
353
  };
354
- }, vo = (t) => {
354
+ }, Ks = (t) => {
355
355
  t.preventDefault();
356
- }, qn = (t) => {
357
- const e = C(7), {
356
+ }, cn = (t) => {
357
+ const e = A(7), {
358
358
  option: n
359
359
  } = t;
360
- let o;
361
- e[0] !== n.label ? (o = /* @__PURE__ */ c(U, { textStyle: "label/S/regular", color: "fg", children: n.label }), e[0] = n.label, e[1] = o) : o = e[1];
362
360
  let s;
363
- e[2] !== n.description ? (s = n.description ? /* @__PURE__ */ c(U, { textStyle: "label/XS/regular", color: "fg.muted", children: n.description }) : null, e[2] = n.description, e[3] = s) : s = e[3];
361
+ e[0] !== n.label ? (s = /* @__PURE__ */ c(U, { textStyle: "label/S/regular", color: "fg", children: n.label }), e[0] = n.label, e[1] = s) : s = e[1];
362
+ let o;
363
+ e[2] !== n.description ? (o = n.description ? /* @__PURE__ */ c(U, { textStyle: "label/XS/regular", color: "fg.muted", children: n.description }) : null, e[2] = n.description, e[3] = o) : o = e[3];
364
364
  let r;
365
- return e[4] !== o || e[5] !== s ? (r = /* @__PURE__ */ k(G, { gap: "0", minWidth: "0", children: [
366
- o,
367
- s
368
- ] }), e[4] = o, e[5] = s, e[6] = r) : r = e[6], r;
369
- }, Ro = (t) => {
370
- const e = C(12), {
365
+ return e[4] !== s || e[5] !== o ? (r = /* @__PURE__ */ k(j, { gap: "0", minWidth: "0", children: [
366
+ s,
367
+ o
368
+ ] }), e[4] = s, e[5] = o, e[6] = r) : r = e[6], r;
369
+ }, Xs = (t) => {
370
+ const e = A(12), {
371
371
  option: n,
372
- name: o,
373
- checked: s,
372
+ name: s,
373
+ checked: o,
374
374
  editable: r,
375
375
  onToggle: i
376
376
  } = t, l = !r, a = r ? void 0 : "true";
@@ -380,51 +380,51 @@ const zn = (t) => t.trim().length > 0, Co = (t) => {
380
380
  }, e[0] = r, e[1] = u) : u = e[1];
381
381
  const d = r ? i : void 0;
382
382
  let f;
383
- e[2] !== n ? (f = /* @__PURE__ */ c(qn, { option: n }), e[2] = n, e[3] = f) : f = e[3];
383
+ e[2] !== n ? (f = /* @__PURE__ */ c(cn, { option: n }), e[2] = n, e[3] = f) : f = e[3];
384
384
  let p;
385
- return e[4] !== s || e[5] !== o || e[6] !== l || e[7] !== a || e[8] !== u || e[9] !== d || e[10] !== f ? (p = /* @__PURE__ */ c($n, { name: o, checked: s, readOnly: l, "aria-readonly": a, inputProps: u, alignItems: "flex-start", onCheckedChange: d, children: f }), e[4] = s, e[5] = o, e[6] = l, e[7] = a, e[8] = u, e[9] = d, e[10] = f, e[11] = p) : p = e[11], p;
386
- }, Mo = (t) => {
387
- const e = C(17), {
385
+ return e[4] !== o || e[5] !== s || e[6] !== l || e[7] !== a || e[8] !== u || e[9] !== d || e[10] !== f ? (p = /* @__PURE__ */ c(on, { name: s, checked: o, readOnly: l, "aria-readonly": a, inputProps: u, alignItems: "flex-start", onCheckedChange: d, children: f }), e[4] = o, e[5] = s, e[6] = l, e[7] = a, e[8] = u, e[9] = d, e[10] = f, e[11] = p) : p = e[11], p;
386
+ }, Gs = (t) => {
387
+ const e = A(17), {
388
388
  question: n,
389
- questionIndex: o,
390
- name: s,
389
+ questionIndex: s,
390
+ name: o,
391
391
  selectedOption: r,
392
392
  editable: i,
393
393
  onToggleOption: l
394
394
  } = t, a = r ?? null, u = !i, d = i ? void 0 : "true";
395
395
  let f;
396
- e[0] !== i || e[1] !== l || e[2] !== n || e[3] !== o ? (f = i ? (h) => {
397
- h.value && l?.(n, o, h.value);
398
- } : void 0, e[0] = i, e[1] = l, e[2] = n, e[3] = o, e[4] = f) : f = e[4];
396
+ e[0] !== i || e[1] !== l || e[2] !== n || e[3] !== s ? (f = i ? (h) => {
397
+ h.value && l?.(n, s, h.value);
398
+ } : void 0, e[0] = i, e[1] = l, e[2] = n, e[3] = s, e[4] = f) : f = e[4];
399
399
  let p;
400
400
  if (e[5] !== i || e[6] !== n.options) {
401
401
  let h;
402
- e[8] !== i ? (h = (g) => /* @__PURE__ */ c(eo, { value: g.label, inputProps: i ? void 0 : {
402
+ e[8] !== i ? (h = (g) => /* @__PURE__ */ c(ws, { value: g.label, inputProps: i ? void 0 : {
403
403
  tabIndex: -1
404
- }, alignItems: "flex-start", children: /* @__PURE__ */ c(qn, { option: g }) }, g.label), e[8] = i, e[9] = h) : h = e[9], p = n.options.map(h), e[5] = i, e[6] = n.options, e[7] = p;
404
+ }, alignItems: "flex-start", children: /* @__PURE__ */ c(cn, { option: g }) }, g.label), e[8] = i, e[9] = h) : h = e[9], p = n.options.map(h), e[5] = i, e[6] = n.options, e[7] = p;
405
405
  } else
406
406
  p = e[7];
407
407
  let m;
408
- return e[10] !== s || e[11] !== a || e[12] !== u || e[13] !== d || e[14] !== f || e[15] !== p ? (m = /* @__PURE__ */ c(to, { name: s, value: a, readOnly: u, "aria-readonly": d, display: "flex", flexDirection: "column", gap: "xs", onValueChange: f, children: p }), e[10] = s, e[11] = a, e[12] = u, e[13] = d, e[14] = f, e[15] = p, e[16] = m) : m = e[16], m;
409
- }, Po = (t) => {
410
- const e = C(4), {
408
+ return e[10] !== o || e[11] !== a || e[12] !== u || e[13] !== d || e[14] !== f || e[15] !== p ? (m = /* @__PURE__ */ c(Ts, { name: o, value: a, readOnly: u, "aria-readonly": d, display: "flex", flexDirection: "column", gap: "xs", onValueChange: f, children: p }), e[10] = o, e[11] = a, e[12] = u, e[13] = d, e[14] = f, e[15] = p, e[16] = m) : m = e[16], m;
409
+ }, Ys = (t) => {
410
+ const e = A(4), {
411
411
  items: n
412
412
  } = t;
413
- let o;
414
- e[0] !== n ? (o = n.map(Eo), e[0] = n, e[1] = o) : o = e[1];
415
413
  let s;
416
- return e[2] !== o ? (s = /* @__PURE__ */ c(G, { as: "ul", gap: "0", listStyleType: "none", margin: "0", padding: "0", children: o }), e[2] = o, e[3] = s) : s = e[3], s;
417
- }, Wn = (t) => {
418
- const e = C(19), {
414
+ e[0] !== n ? (s = n.map(Js), e[0] = n, e[1] = s) : s = e[1];
415
+ let o;
416
+ return e[2] !== s ? (o = /* @__PURE__ */ c(j, { as: "ul", gap: "0", listStyleType: "none", margin: "0", padding: "0", children: s }), e[2] = s, e[3] = o) : o = e[3], o;
417
+ }, un = (t) => {
418
+ const e = A(19), {
419
419
  questions: n,
420
- editable: o,
421
- selectedOptionsByQuestion: s,
420
+ editable: s,
421
+ selectedOptionsByQuestion: o,
422
422
  customAnswersByQuestion: r,
423
423
  onToggleOption: i,
424
424
  onCustomAnswerChange: l
425
- } = t, a = o === void 0 ? !1 : o;
425
+ } = t, a = s === void 0 ? !1 : s;
426
426
  let u;
427
- e[0] !== s ? (u = s === void 0 ? {} : s, e[0] = s, e[1] = u) : u = e[1];
427
+ e[0] !== o ? (u = o === void 0 ? {} : o, e[0] = o, e[1] = u) : u = e[1];
428
428
  const d = u;
429
429
  let f;
430
430
  e[2] !== r ? (f = r === void 0 ? {} : r, e[2] = r, e[3] = f) : f = e[3];
@@ -432,468 +432,382 @@ const zn = (t) => t.trim().length > 0, Co = (t) => {
432
432
  let m;
433
433
  if (e[4] !== p || e[5] !== a || e[6] !== l || e[7] !== i || e[8] !== n || e[9] !== d) {
434
434
  let g;
435
- e[11] !== p || e[12] !== a || e[13] !== l || e[14] !== i || e[15] !== d ? (g = (y, x) => {
436
- const b = y.id ?? `question-${x}`, S = y.multiple ? "checkbox" : "radio", w = d[b] ?? [];
437
- return /* @__PURE__ */ k(G, { as: "fieldset", gap: "xs", borderWidth: "1px", borderColor: "border.subtle", borderRadius: "sm", padding: "sm", minWidth: "0", children: [
438
- /* @__PURE__ */ c(U, { as: "legend", textStyle: "label/S/medium", color: "fg", paddingX: "2xs", children: y.question }),
439
- S === "radio" ? /* @__PURE__ */ c(Mo, { question: y, questionIndex: x, name: b, selectedOption: w[0], editable: a, onToggleOption: i }) : y.options.map((T) => /* @__PURE__ */ c(Ro, { option: T, name: b, checked: w.includes(T.label), editable: a, onToggle: () => i?.(y, x, T.label) }, T.label)),
440
- y.allowCustomAnswer ? /* @__PURE__ */ c(ws, { readOnly: !a, "aria-readonly": a ? void 0 : "true", value: p[b] ?? "", placeholder: a ? "Answer..." : "Custom answer", "aria-label": y.question, rows: 2, borderWidth: "1px", borderColor: "border.subtle", borderRadius: "sm", padding: "xs", resize: a ? "vertical" : "none", color: "fg", onChange: (T) => l?.(y, x, T.currentTarget.value) }) : null
441
- ] }, b);
435
+ e[11] !== p || e[12] !== a || e[13] !== l || e[14] !== i || e[15] !== d ? (g = (b, x) => {
436
+ const y = b.id ?? `question-${x}`, T = b.multiple ? "checkbox" : "radio", S = d[y] ?? [];
437
+ return /* @__PURE__ */ k(j, { as: "fieldset", gap: "xs", borderWidth: "1px", borderColor: "border.subtle", borderRadius: "sm", padding: "sm", minWidth: "0", children: [
438
+ /* @__PURE__ */ c(U, { as: "legend", textStyle: "label/S/medium", color: "fg", paddingX: "2xs", children: b.question }),
439
+ T === "radio" ? /* @__PURE__ */ c(Gs, { question: b, questionIndex: x, name: y, selectedOption: S[0], editable: a, onToggleOption: i }) : b.options.map((w) => /* @__PURE__ */ c(Xs, { option: w, name: y, checked: S.includes(w.label), editable: a, onToggle: () => i?.(b, x, w.label) }, w.label)),
440
+ b.allowCustomAnswer ? /* @__PURE__ */ c(Wn, { readOnly: !a, "aria-readonly": a ? void 0 : "true", value: p[y] ?? "", placeholder: a ? "Answer..." : "Custom answer", "aria-label": b.question, rows: 2, borderWidth: "1px", borderColor: "border.subtle", borderRadius: "sm", padding: "xs", resize: a ? "vertical" : "none", color: "fg", onChange: (w) => l?.(b, x, w.currentTarget.value) }) : null
441
+ ] }, y);
442
442
  }, e[11] = p, e[12] = a, e[13] = l, e[14] = i, e[15] = d, e[16] = g) : g = e[16], m = n.map(g), e[4] = p, e[5] = a, e[6] = l, e[7] = i, e[8] = n, e[9] = d, e[10] = m;
443
443
  } else
444
444
  m = e[10];
445
445
  let h;
446
- return e[17] !== m ? (h = /* @__PURE__ */ c(G, { as: "form", gap: "sm", onSubmit: vo, "aria-label": "Question form", children: m }), e[17] = m, e[18] = h) : h = e[18], h;
446
+ return e[17] !== m ? (h = /* @__PURE__ */ c(j, { as: "form", gap: "sm", onSubmit: Ks, "aria-label": "Question form", children: m }), e[17] = m, e[18] = h) : h = e[18], h;
447
447
  };
448
- function Eo(t, e) {
449
- return /* @__PURE__ */ c(B, { as: "li", children: /* @__PURE__ */ c($n, { checked: t.checked, readOnly: !0, "aria-readonly": "true", inputProps: {
448
+ function Js(t, e) {
449
+ return /* @__PURE__ */ c(P, { as: "li", children: /* @__PURE__ */ c(on, { checked: t.checked, readOnly: !0, "aria-readonly": "true", inputProps: {
450
450
  tabIndex: -1
451
451
  }, size: "xs", children: /* @__PURE__ */ c(U, { textStyle: "label/XS/regular", color: "fg", children: t.label }) }) }, `${t.label}-${e}`);
452
452
  }
453
- const Ae = (t, e) => t.id ?? `question-${e}`, Xt = (t) => t ? JSON.stringify(t.questions.map((e, n) => ({
454
- id: Ae(e, n),
453
+ const le = (t, e) => t.id ?? `question-${e}`, Zs = (t, e, n, s) => {
454
+ const o = le(e, n), r = t[o] ?? [], i = r.includes(s);
455
+ return e.multiple ? {
456
+ ...t,
457
+ [o]: i ? r.filter((l) => l !== s) : [...r, s]
458
+ } : {
459
+ ...t,
460
+ [o]: i ? [] : [s]
461
+ };
462
+ }, bt = (t) => t ? JSON.stringify(t.questions.map((e, n) => ({
463
+ id: le(e, n),
455
464
  question: e.question,
456
465
  multiple: !!e.multiple,
457
466
  required: !!e.required,
458
467
  allowCustomAnswer: !!e.allowCustomAnswer,
459
- options: e.options.map((o) => ({
460
- label: o.label,
461
- description: o.description ?? ""
468
+ options: e.options.map((s) => ({
469
+ label: s.label,
470
+ description: s.description ?? ""
462
471
  }))
463
- }))) : "", Do = (t, e, n) => {
464
- const o = [];
465
- for (let s = 0; s < t.questions.length; s += 1) {
466
- const r = t.questions[s], i = Ae(r, s), l = e[i] ?? [], a = n[i]?.trim(), u = a ? [...l, a] : l;
467
- u.length !== 0 && o.push(`${r.question}: ${u.join(", ")}`);
472
+ }))) : "", eo = (t, e, n) => {
473
+ const s = [];
474
+ for (let o = 0; o < t.questions.length; o += 1) {
475
+ const r = t.questions[o], i = le(r, o), l = e[i] ?? [], a = n[i]?.trim(), u = a ? [...l, a] : l;
476
+ u.length !== 0 && s.push(`${r.question}: ${u.join(", ")}`);
468
477
  }
469
- return o;
470
- }, Bo = (t) => typeof t != "string", rn = (t, e) => {
471
- if (Bo(e)) return e;
478
+ return s;
479
+ }, to = (t) => typeof t != "string", _t = (t, e) => {
480
+ if (to(e)) return e;
472
481
  const n = e.trim();
473
482
  if (n.length === 0) return {};
474
- const o = {};
475
- for (let s = 0; s < t.questions.length; s += 1) {
476
- const r = t.questions[s];
477
- r.allowCustomAnswer && (o[Ae(r, s)] = n);
483
+ const s = {};
484
+ for (let o = 0; o < t.questions.length; o += 1) {
485
+ const r = t.questions[o];
486
+ r.allowCustomAnswer && (s[le(r, o)] = n);
478
487
  }
479
- return o;
480
- }, Fo = (t, e, n) => {
488
+ return s;
489
+ }, no = (t, e, n) => {
481
490
  if (!t) return typeof n == "string" ? n.trim() : "";
482
- const o = rn(t, n), s = Do(t, e, o), r = typeof n == "string" ? n.trim() : "", i = t.questions.some((l) => l.allowCustomAnswer);
483
- return r.length > 0 && !i && s.push(`Additional response: ${r}`), s.join(`
491
+ const s = _t(t, n), o = eo(t, e, s), r = typeof n == "string" ? n.trim() : "", i = t.questions.some((l) => l.allowCustomAnswer);
492
+ return r.length > 0 && !i && o.push(`Additional response: ${r}`), o.join(`
484
493
  `);
485
- }, Lo = (t, e, n) => {
486
- const o = rn(t, n);
487
- return t.questions.map((s, r) => {
488
- const i = Ae(s, r), l = e[i] ?? [], a = o[i]?.trim();
494
+ }, so = (t, e, n) => {
495
+ const s = _t(t, n);
496
+ return t.questions.map((o, r) => {
497
+ const i = le(o, r), l = e[i] ?? [], a = s[i]?.trim();
489
498
  return a ? [...l, a] : l;
490
499
  });
491
- }, $o = (t, e, n) => {
500
+ }, oo = (t, e, n) => {
492
501
  if (!t) return !1;
493
- const o = rn(t, n);
494
- for (let s = 0; s < t.questions.length; s += 1) {
495
- const r = t.questions[s];
502
+ const s = _t(t, n);
503
+ for (let o = 0; o < t.questions.length; o += 1) {
504
+ const r = t.questions[o];
496
505
  if (!r.required) continue;
497
- const i = Ae(r, s);
498
- if (!((e[i] ?? []).length > 0) && !(r.allowCustomAnswer && o[i]?.trim()))
506
+ const i = le(r, o);
507
+ if (!((e[i] ?? []).length > 0) && !(r.allowCustomAnswer && s[i]?.trim()))
499
508
  return !0;
500
509
  }
501
510
  return !1;
502
- }, Oo = (t) => t.questions.map((e, n) => ({
503
- id: Ae(e, n),
511
+ }, ro = (t) => t.questions.map((e, n) => ({
512
+ id: le(e, n),
504
513
  question: e.question,
505
514
  options: e.options,
506
515
  multiple: !!e.multiple,
507
516
  required: !!e.required,
508
517
  allowCustomAnswer: !!e.allowCustomAnswer
509
- })), zo = (t, e, n, o) => {
510
- const s = Ae(t, e);
511
- return (n[s] ?? []).length > 0 || !!o[s]?.trim();
512
- }, Qo = (t) => {
513
- const e = C(22), {
518
+ })), io = (t, e, n, s) => {
519
+ const o = le(t, e);
520
+ return (n[o] ?? []).length > 0 || !!s[o]?.trim();
521
+ }, lo = (t) => {
522
+ const e = A(22), {
514
523
  question: n,
515
- sourceQuestion: o,
516
- questionIndex: s,
524
+ sourceQuestion: s,
525
+ questionIndex: o,
517
526
  isActive: r,
518
527
  selectedOptionsByQuestion: i,
519
528
  customAnswersByQuestion: l,
520
529
  onSelectStep: a
521
530
  } = t;
522
531
  let u;
523
- e[0] !== l || e[1] !== s || e[2] !== i || e[3] !== o ? (u = zo(o, s, i, l), e[0] = l, e[1] = s, e[2] = i, e[3] = o, e[4] = u) : u = e[4];
532
+ e[0] !== l || e[1] !== o || e[2] !== i || e[3] !== s ? (u = io(s, o, i, l), e[0] = l, e[1] = o, e[2] = i, e[3] = s, e[4] = u) : u = e[4];
524
533
  const d = u, f = d ? "answered" : "not answered", p = r ? "outline" : "ghost", m = `question-step-tab-${n.id}`, h = `${n.question} (${f})`, g = `question-step-panel-${n.id}`;
525
- let y;
526
- e[5] !== a || e[6] !== s ? (y = () => a(s), e[5] = a, e[6] = s, e[7] = y) : y = e[7];
527
- let x;
528
- e[8] !== d || e[9] !== s ? (x = d ? /* @__PURE__ */ c(Dn, { "aria-hidden": "true" }) : s + 1, e[8] = d, e[9] = s, e[10] = x) : x = e[10];
529
534
  let b;
530
- e[11] !== r || e[12] !== m || e[13] !== h || e[14] !== g || e[15] !== y || e[16] !== x || e[17] !== p ? (b = /* @__PURE__ */ c(ft, { id: m, role: "tab", "aria-label": h, "aria-selected": r, "aria-controls": g, size: "xs", variant: p, minW: "8", onClick: y, children: x }), e[11] = r, e[12] = m, e[13] = h, e[14] = g, e[15] = y, e[16] = x, e[17] = p, e[18] = b) : b = e[18];
531
- let S;
532
- return e[19] !== n.question || e[20] !== b ? (S = /* @__PURE__ */ c(sn, { content: n.question, children: b }), e[19] = n.question, e[20] = b, e[21] = S) : S = e[21], S;
533
- }, qo = (t) => {
534
- const e = C(31), {
535
+ e[5] !== a || e[6] !== o ? (b = () => a(o), e[5] = a, e[6] = o, e[7] = b) : b = e[7];
536
+ let x;
537
+ e[8] !== d || e[9] !== o ? (x = d ? /* @__PURE__ */ c(en, { "aria-hidden": "true" }) : o + 1, e[8] = d, e[9] = o, e[10] = x) : x = e[10];
538
+ let y;
539
+ e[11] !== r || e[12] !== m || e[13] !== h || e[14] !== g || e[15] !== b || e[16] !== x || e[17] !== p ? (y = /* @__PURE__ */ c(Oe, { id: m, role: "tab", "aria-label": h, "aria-selected": r, "aria-controls": g, size: "xs", variant: p, minW: "8", onClick: b, children: x }), e[11] = r, e[12] = m, e[13] = h, e[14] = g, e[15] = b, e[16] = x, e[17] = p, e[18] = y) : y = e[18];
540
+ let T;
541
+ return e[19] !== n.question || e[20] !== y ? (T = /* @__PURE__ */ c(Ct, { content: n.question, children: y }), e[19] = n.question, e[20] = y, e[21] = T) : T = e[21], T;
542
+ }, ao = (t) => {
543
+ const e = A(31), {
535
544
  questionPrompt: n,
536
- selectedOptionsByQuestion: o,
537
- customAnswersByQuestion: s,
545
+ selectedOptionsByQuestion: s,
546
+ customAnswersByQuestion: o,
538
547
  onToggleOption: r,
539
548
  onCustomAnswerChange: i
540
549
  } = t, {
541
550
  questions: l
542
- } = t, [a, u] = H(0), d = Math.min(a, l.length - 1), f = l[d], p = l.length > 1;
551
+ } = t, [a, u] = V(0), d = Math.min(a, l.length - 1), f = l[d], p = l.length > 1;
543
552
  let m;
544
- e[0] !== s || e[1] !== p || e[2] !== n.questions || e[3] !== l || e[4] !== d || e[5] !== o ? (m = p ? /* @__PURE__ */ c(ae, { role: "tablist", "aria-label": "Question steps", gap: "1", minWidth: "0", children: l.map((_, v) => /* @__PURE__ */ c(Qo, { question: _, sourceQuestion: n.questions[v], questionIndex: v, isActive: v === d, selectedOptionsByQuestion: o, customAnswersByQuestion: s, onSelectStep: u }, _.id)) }) : null, e[0] = s, e[1] = p, e[2] = n.questions, e[3] = l, e[4] = d, e[5] = o, e[6] = m) : m = e[6];
545
- const h = `question-step-panel-${f.id}`, g = p ? "tabpanel" : void 0, y = p ? `question-step-tab-${f.id}` : void 0;
553
+ e[0] !== o || e[1] !== p || e[2] !== n.questions || e[3] !== l || e[4] !== d || e[5] !== s ? (m = p ? /* @__PURE__ */ c(Z, { role: "tablist", "aria-label": "Question steps", gap: "1", minWidth: "0", children: l.map((_, R) => /* @__PURE__ */ c(lo, { question: _, sourceQuestion: n.questions[R], questionIndex: R, isActive: R === d, selectedOptionsByQuestion: s, customAnswersByQuestion: o, onSelectStep: u }, _.id)) }) : null, e[0] = o, e[1] = p, e[2] = n.questions, e[3] = l, e[4] = d, e[5] = s, e[6] = m) : m = e[6];
554
+ const h = `question-step-panel-${f.id}`, g = p ? "tabpanel" : void 0, b = p ? `question-step-tab-${f.id}` : void 0;
546
555
  let x;
547
556
  e[7] !== f ? (x = [f], e[7] = f, e[8] = x) : x = e[8];
548
- let b;
549
- e[9] !== r || e[10] !== n.questions || e[11] !== d ? (b = (_, v, F) => {
550
- r(n.questions[d], d, F);
551
- }, e[9] = r, e[10] = n.questions, e[11] = d, e[12] = b) : b = e[12];
557
+ let y;
558
+ e[9] !== r || e[10] !== n.questions || e[11] !== d ? (y = (_, R, L) => {
559
+ r(n.questions[d], d, L);
560
+ }, e[9] = r, e[10] = n.questions, e[11] = d, e[12] = y) : y = e[12];
561
+ let T;
562
+ e[13] !== i || e[14] !== n.questions || e[15] !== d ? (T = (_, R, L) => {
563
+ i(n.questions[d], d, L);
564
+ }, e[13] = i, e[14] = n.questions, e[15] = d, e[16] = T) : T = e[16];
552
565
  let S;
553
- e[13] !== i || e[14] !== n.questions || e[15] !== d ? (S = (_, v, F) => {
554
- i(n.questions[d], d, F);
555
- }, e[13] = i, e[14] = n.questions, e[15] = d, e[16] = S) : S = e[16];
566
+ e[17] !== o || e[18] !== s || e[19] !== x || e[20] !== y || e[21] !== T ? (S = /* @__PURE__ */ c(un, { questions: x, editable: !0, selectedOptionsByQuestion: s, customAnswersByQuestion: o, onToggleOption: y, onCustomAnswerChange: T }), e[17] = o, e[18] = s, e[19] = x, e[20] = y, e[21] = T, e[22] = S) : S = e[22];
556
567
  let w;
557
- e[17] !== s || e[18] !== o || e[19] !== x || e[20] !== b || e[21] !== S ? (w = /* @__PURE__ */ c(Wn, { questions: x, editable: !0, selectedOptionsByQuestion: o, customAnswersByQuestion: s, onToggleOption: b, onCustomAnswerChange: S }), e[17] = s, e[18] = o, e[19] = x, e[20] = b, e[21] = S, e[22] = w) : w = e[22];
558
- let T;
559
- e[23] !== h || e[24] !== g || e[25] !== y || e[26] !== w ? (T = /* @__PURE__ */ c(G, { id: h, role: g, "aria-labelledby": y, gap: "0", children: w }), e[23] = h, e[24] = g, e[25] = y, e[26] = w, e[27] = T) : T = e[27];
560
- let A;
561
- return e[28] !== m || e[29] !== T ? (A = /* @__PURE__ */ k(G, { gap: "xs", pb: "sm", children: [
568
+ e[23] !== h || e[24] !== g || e[25] !== b || e[26] !== S ? (w = /* @__PURE__ */ c(j, { id: h, role: g, "aria-labelledby": b, gap: "0", children: S }), e[23] = h, e[24] = g, e[25] = b, e[26] = S, e[27] = w) : w = e[27];
569
+ let C;
570
+ return e[28] !== m || e[29] !== w ? (C = /* @__PURE__ */ k(j, { gap: "xs", pb: "sm", children: [
562
571
  m,
563
- T
564
- ] }), e[28] = m, e[29] = T, e[30] = A) : A = e[30], A;
565
- }, Wo = (t) => {
566
- const e = C(8), {
572
+ w
573
+ ] }), e[28] = m, e[29] = w, e[30] = C) : C = e[30], C;
574
+ }, co = (t) => {
575
+ const e = A(8), {
567
576
  questionPrompt: n
568
577
  } = t;
569
- let o;
570
- e[0] !== n ? (o = Oo(n), e[0] = n, e[1] = o) : o = e[1];
571
- const s = o;
578
+ let s;
579
+ e[0] !== n ? (s = ro(n), e[0] = n, e[1] = s) : s = e[1];
580
+ const o = s;
572
581
  let r;
573
- e[2] !== n ? (r = Xt(n), e[2] = n, e[3] = r) : r = e[3];
582
+ e[2] !== n ? (r = bt(n), e[2] = n, e[3] = r) : r = e[3];
574
583
  const i = r;
575
584
  let l;
576
- return e[4] !== t || e[5] !== i || e[6] !== s ? (l = /* @__PURE__ */ c(qo, { ...t, questions: s }, i), e[4] = t, e[5] = i, e[6] = s, e[7] = l) : l = e[7], l;
577
- }, hn = "7", Ho = (t) => {
578
- const e = C(22);
579
- let n, o, s, r;
585
+ return e[4] !== t || e[5] !== i || e[6] !== o ? (l = /* @__PURE__ */ c(ao, { ...t, questions: o }, i), e[4] = t, e[5] = i, e[6] = o, e[7] = l) : l = e[7], l;
586
+ }, Lt = "7", uo = (t) => {
587
+ const e = A(22);
588
+ let n, s, o, r;
580
589
  e[0] !== t ? ({
581
590
  title: r,
582
- shortcut: s,
591
+ shortcut: o,
583
592
  canInterrupt: n,
584
- ...o
585
- } = t, e[0] = t, e[1] = n, e[2] = o, e[3] = s, e[4] = r) : (n = e[1], o = e[2], s = e[3], r = e[4]);
586
- const i = o["aria-label"] ?? r;
593
+ ...s
594
+ } = t, e[0] = t, e[1] = n, e[2] = s, e[3] = o, e[4] = r) : (n = e[1], s = e[2], o = e[3], r = e[4]);
595
+ const i = s["aria-label"] ?? r;
587
596
  let l;
588
- e[5] !== n ? (l = n ? /* @__PURE__ */ c(Ms, { size: 16, strokeWidth: 2, fill: "currentColor" }) : /* @__PURE__ */ c(Ps, { size: 16, strokeWidth: 2 }), e[5] = n, e[6] = l) : l = e[6];
597
+ e[5] !== n ? (l = n ? /* @__PURE__ */ c(Yn, { size: 16, strokeWidth: 2, fill: "currentColor" }) : /* @__PURE__ */ c(Jn, { size: 16, strokeWidth: 2 }), e[5] = n, e[6] = l) : l = e[6];
589
598
  const a = l;
590
599
  let u;
591
- e[7] !== i || e[8] !== a || e[9] !== o || e[10] !== r ? (u = /* @__PURE__ */ c(nt, { "data-testid": "send-message-button", size: "xs", variant: "primary", "aria-label": i, title: r, ...o, children: a }), e[7] = i, e[8] = a, e[9] = o, e[10] = r, e[11] = u) : u = e[11];
600
+ e[7] !== i || e[8] !== a || e[9] !== s || e[10] !== r ? (u = /* @__PURE__ */ c(Pe, { "data-testid": "send-message-button", size: "xs", variant: "primary", "aria-label": i, title: r, ...s, children: a }), e[7] = i, e[8] = a, e[9] = s, e[10] = r, e[11] = u) : u = e[11];
592
601
  const d = u;
593
602
  if (r) {
594
603
  let f;
595
- e[12] !== s || e[13] !== r ? (f = s ? /* @__PURE__ */ k(tn, { children: [
604
+ e[12] !== o || e[13] !== r ? (f = o ? /* @__PURE__ */ k(At, { children: [
596
605
  r,
597
606
  " ",
598
- /* @__PURE__ */ c(Ts, { fontSize: "xs", children: s })
599
- ] }) : r, e[12] = s, e[13] = r, e[14] = f) : f = e[14];
607
+ /* @__PURE__ */ c(Hn, { fontSize: "xs", children: o })
608
+ ] }) : r, e[12] = o, e[13] = r, e[14] = f) : f = e[14];
600
609
  const p = f;
601
610
  let m;
602
- e[15] !== d ? (m = /* @__PURE__ */ c(Ct.Trigger, { asChild: !0, children: d }), e[15] = d, e[16] = m) : m = e[16];
611
+ e[15] !== d ? (m = /* @__PURE__ */ c(Ke.Trigger, { asChild: !0, children: d }), e[15] = d, e[16] = m) : m = e[16];
603
612
  let h;
604
- e[17] !== p ? (h = /* @__PURE__ */ c(Mn, { children: /* @__PURE__ */ c(Ct.Positioner, { children: /* @__PURE__ */ c(Ct.Content, { children: p }) }) }), e[17] = p, e[18] = h) : h = e[18];
613
+ e[17] !== p ? (h = /* @__PURE__ */ c(Yt, { children: /* @__PURE__ */ c(Ke.Positioner, { children: /* @__PURE__ */ c(Ke.Content, { children: p }) }) }), e[17] = p, e[18] = h) : h = e[18];
605
614
  let g;
606
- return e[19] !== m || e[20] !== h ? (g = /* @__PURE__ */ k(Ct.Root, { closeDelay: 50, openDelay: 100, children: [
615
+ return e[19] !== m || e[20] !== h ? (g = /* @__PURE__ */ k(Ke.Root, { closeDelay: 50, openDelay: 100, children: [
607
616
  m,
608
617
  h
609
618
  ] }), e[19] = m, e[20] = h, e[21] = g) : g = e[21], g;
610
619
  }
611
620
  return d;
612
- }, Vo = (t) => {
613
- const e = C(2), {
621
+ }, fo = (t) => {
622
+ const e = A(2), {
614
623
  placeholder: n
615
624
  } = t;
616
625
  if (!n)
617
626
  return null;
618
- let o;
619
- return e[0] !== n ? (o = /* @__PURE__ */ c(U, { textStyle: "label/M/regular", color: "fg.subtle", pointerEvents: "none", position: "absolute", top: "0", children: n }), e[0] = n, e[1] = o) : o = e[1], o;
620
- }, Ut = "border.accent-light", Gt = (t) => {
627
+ let s;
628
+ return e[0] !== n ? (s = /* @__PURE__ */ c(U, { textStyle: "label/M/regular", color: "fg.subtle", pointerEvents: "none", position: "absolute", top: "0", children: n }), e[0] = n, e[1] = s) : s = e[1], s;
629
+ }, mt = "border.accent-light", yt = (t) => {
621
630
  const e = t?.querySelector('[contenteditable="true"]');
622
631
  e instanceof HTMLElement && e.focus();
623
- }, gn = (t, e) => requestAnimationFrame(() => {
624
- Gt(t), e?.();
625
- }), No = (t) => {
626
- const e = C(106), {
627
- defaultState: n,
628
- onSubmit: o,
632
+ }, $t = (t, e) => requestAnimationFrame(() => {
633
+ yt(t), e?.();
634
+ }), po = (t) => {
635
+ const {
636
+ defaultState: e,
637
+ onSubmit: n = () => {
638
+ },
629
639
  onInterrupt: s,
630
- onAttachFiles: r,
631
- onAttachText: i,
632
- textAttachmentPasteLineThreshold: l,
633
- streaming: a,
634
- attachedResources: u,
635
- onClearAttachments: d,
636
- isDisabled: f,
640
+ onAttachFiles: o,
641
+ onAttachText: r,
642
+ textAttachmentPasteLineThreshold: i = an,
643
+ streaming: l = !1,
644
+ attachedResources: a = [],
645
+ onClearAttachments: u,
646
+ isDisabled: d = !1,
647
+ submitDisabled: f = !1,
637
648
  onChange: p,
638
649
  placeholder: m,
639
650
  attachmentList: h,
640
651
  actions: g,
641
- attachedToTop: y,
642
- recessed: x,
643
- questionPrompt: b,
644
- autoFocus: S,
645
- focusSignal: w,
646
- submitTitle: T,
647
- references: A,
652
+ attachedToTop: b = !1,
653
+ recessed: x = !1,
654
+ questionPrompt: y,
655
+ autoFocus: T = !1,
656
+ focusSignal: S = 0,
657
+ submitTitle: w,
658
+ references: C = [],
648
659
  onAddReference: _
649
- } = t, v = o === void 0 ? Uo : o, F = l === void 0 ? Qn : l, M = a === void 0 ? !1 : a;
650
- let L;
651
- e[0] !== u ? (L = u === void 0 ? [] : u, e[0] = u, e[1] = L) : L = e[1];
652
- const P = L, E = f === void 0 ? !1 : f, O = y === void 0 ? !1 : y, z = x === void 0 ? !1 : x, D = S === void 0 ? !1 : S, $ = w === void 0 ? 0 : w;
653
- let R;
654
- e[2] !== A ? (R = A === void 0 ? [] : A, e[2] = A, e[3] = R) : R = e[3];
655
- const q = R, j = z ? "border.subtle" : "border", [W, _e] = H(!1), [ve, ue] = H(n), [Re, Ne] = H(0);
656
- let Y;
657
- e[4] !== n ? (Y = () => Vt(n), e[4] = n, e[5] = Y) : Y = e[5];
658
- const [ee, de] = H(Y);
659
- let fe;
660
- e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (fe = {}, e[6] = fe) : fe = e[6];
661
- const [N, Me] = H(fe);
662
- let Pe;
663
- e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Pe = {}, e[7] = Pe) : Pe = e[7];
664
- const [J, Ue] = H(Pe), We = Te(null), rt = Te(p);
665
- let je;
666
- e[8] !== b ? (je = Xt(b), e[8] = b, e[9] = je) : je = e[9];
667
- const He = Te(je);
668
- let pe, it;
669
- e[10] !== p ? (pe = () => {
670
- rt.current = p;
671
- }, it = [p], e[10] = p, e[11] = pe, e[12] = it) : (pe = e[11], it = e[12]), le(pe, it);
672
- let Ee, De;
673
- e[13] !== n ? (Ee = () => {
674
- const Q = Vt(n);
675
- ue(n), Ne(jo), de(Q), Me({}), Ue({}), rt.current?.(Q);
676
- }, De = [n], e[13] = n, e[14] = Ee, e[15] = De) : (Ee = e[14], De = e[15]), le(Ee, De);
677
- let me;
678
- e[16] !== b ? (me = Xt(b), e[16] = b, e[17] = me) : me = e[17];
679
- const ne = me;
680
- let Be, Fe;
681
- e[18] !== ne ? (Be = () => {
682
- He.current !== ne && (He.current = ne, Me({}), Ue({}));
683
- }, Fe = [ne], e[18] = ne, e[19] = Be, e[20] = Fe) : (Be = e[19], Fe = e[20]), le(Be, Fe);
684
- let he, ge;
685
- e[21] !== D ? (he = () => {
686
- if (!D)
687
- return;
688
- const Q = gn(We.current, () => _e(!0));
689
- return () => cancelAnimationFrame(Q);
690
- }, ge = [D], e[21] = D, e[22] = he, e[23] = ge) : (he = e[22], ge = e[23]), le(he, ge);
691
- let Le, be;
692
- e[24] !== $ ? (Le = () => {
693
- if ($ === 0)
694
- return;
695
- const Q = gn(We.current, () => _e(!0));
696
- return () => cancelAnimationFrame(Q);
697
- }, be = [$], e[24] = $, e[25] = Le, e[26] = be) : (Le = e[25], be = e[26]), le(Le, be);
698
- let Ke;
699
- e[27] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Ke = () => {
700
- _e(!0), Gt(We.current);
701
- }, e[27] = Ke) : Ke = e[27];
702
- const lt = Ke;
703
- let se;
704
- e[28] !== n ? (se = (Q) => {
705
- const at = Q === void 0 ? !1 : Q;
706
- ue(n), Ne(Ko);
707
- const Se = Vt(n);
708
- de(Se), Me({}), Ue({}), rt.current?.(Se), at && requestAnimationFrame(() => {
709
- Gt(We.current);
660
+ } = t, R = x ? "border.subtle" : "border", [L, E] = V(!1), [Q, M] = V(!1), [D, B] = V(e), [$, O] = V(0), [F, z] = V(() => ft(e)), [v, W] = V({}), [H, K] = V({}), oe = ie(null), xe = ie(p), Se = ie(bt(y));
661
+ J(() => {
662
+ xe.current = p;
663
+ }, [p]), J(() => {
664
+ const q = ft(e);
665
+ B(e), O((ne) => ne + 1), z(q), W({}), K({}), xe.current?.(q);
666
+ }, [e]);
667
+ const ee = bt(y);
668
+ J(() => {
669
+ Se.current !== ee && (Se.current = ee, W({}), K({}));
670
+ }, [ee]), J(() => {
671
+ if (!T) return;
672
+ const q = $t(oe.current, () => M(!0));
673
+ return () => cancelAnimationFrame(q);
674
+ }, [T]), J(() => {
675
+ if (S === 0) return;
676
+ const q = $t(oe.current, () => M(!0));
677
+ return () => cancelAnimationFrame(q);
678
+ }, [S]);
679
+ const Te = () => {
680
+ M(!0), yt(oe.current);
681
+ }, Be = (q = !1) => {
682
+ B(e), O((se) => se + 1);
683
+ const ne = ft(e);
684
+ z(ne), W({}), K({}), xe.current?.(ne), q && requestAnimationFrame(() => {
685
+ yt(oe.current);
710
686
  });
711
- }, e[28] = n, e[29] = se) : se = e[29];
712
- const Ve = se;
713
- let Z, K, oe;
714
- if (e[30] !== J || e[31] !== E || e[32] !== s || e[33] !== b || e[34] !== N || e[35] !== M || e[36] !== ee) {
715
- K = b ? Fo(b, N, J) : ee.trim();
716
- const Q = $o(b, N, J);
717
- Z = {
718
- canInterrupt: M && !b && !!s,
719
- hasQuestionPrompt: !!b,
720
- isDisabled: E || Q,
721
- streaming: M,
722
- text: K
723
- }, oe = ko(Z), e[30] = J, e[31] = E, e[32] = s, e[33] = b, e[34] = N, e[35] = M, e[36] = ee, e[37] = Z, e[38] = K, e[39] = oe;
724
- } else
725
- Z = e[37], K = e[38], oe = e[39];
726
- const te = oe;
727
- let re;
728
- e[40] !== P || e[41] !== J || e[42] !== d || e[43] !== v || e[44] !== b || e[45] !== Ve || e[46] !== K || e[47] !== N ? (re = () => {
729
- if (!K)
730
- return;
731
- const Q = b ? {
732
- answers: Lo(b, N, J)
687
+ }, X = y ? no(y, v, H) : F.trim(), G = oo(y, v, H), de = {
688
+ canInterrupt: l && !y && !!s,
689
+ canSubmit: !f,
690
+ hasQuestionPrompt: !!y,
691
+ isDisabled: d || L || G,
692
+ streaming: l,
693
+ text: X
694
+ }, te = Ns(de), fe = l && !y ? "Queue message" : "Send message", Fe = async () => {
695
+ if (!X) return;
696
+ const q = y ? {
697
+ answers: so(y, v, H)
733
698
  } : void 0;
734
- v(K, P, Q), Ve(!0), d?.();
735
- }, e[40] = P, e[41] = J, e[42] = d, e[43] = v, e[44] = b, e[45] = Ve, e[46] = K, e[47] = N, e[48] = re) : re = e[48];
736
- const ce = re;
737
- let ye;
738
- e[49] !== s || e[50] !== ce ? (ye = (Q) => {
739
- if (Q === "interrupt") {
740
- s?.();
741
- return;
699
+ E(!0);
700
+ try {
701
+ await n(X, a, q), Be(!0), u?.();
702
+ } catch {
703
+ } finally {
704
+ E(!1);
742
705
  }
743
- Q === "submit" && ce();
744
- }, e[49] = s, e[50] = ce, e[51] = ye) : ye = e[51];
745
- const X = ye;
746
- let Xe;
747
- e[52] !== Z || e[53] !== X ? (Xe = () => X(Co(Z)), e[52] = Z, e[53] = X, e[54] = Xe) : Xe = e[54];
748
- const $e = Xe;
749
- let gt;
750
- e[55] !== te || e[56] !== X ? (gt = () => X(te), e[55] = te, e[56] = X, e[57] = gt) : gt = e[57];
751
- const Et = gt;
752
- let bt;
753
- e[58] !== r || e[59] !== i || e[60] !== F ? (bt = _o({
754
- onAttachFiles: r,
755
- onAttachText: i,
756
- textAttachmentPasteLineThreshold: F
757
- }), e[58] = r, e[59] = i, e[60] = F, e[61] = bt) : bt = e[61];
758
- const xe = bt;
759
- let yt;
760
- e[62] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (yt = (Q, at, Se) => {
761
- const ct = Ae(Q, at);
762
- Me((ut) => {
763
- const Wt = ut[ct] ?? [], fn = Wt.includes(Se);
764
- return Q.multiple ? {
765
- ...ut,
766
- [ct]: fn ? Wt.filter((bs) => bs !== Se) : [...Wt, Se]
767
- } : {
768
- ...ut,
769
- [ct]: fn ? [] : [Se]
770
- };
771
- });
772
- }, e[62] = yt) : yt = e[62];
773
- const hs = yt;
774
- let xt;
775
- e[63] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (xt = (Q, at, Se) => {
776
- const ct = Ae(Q, at);
777
- Ue((ut) => ({
778
- ...ut,
779
- [ct]: Se
706
+ }, Ae = (q) => {
707
+ q === "interrupt" && s?.(), q === "submit" && Fe();
708
+ }, we = js({
709
+ onAttachFiles: o,
710
+ onAttachText: r,
711
+ textAttachmentPasteLineThreshold: i
712
+ }), nt = (q, ne, se) => {
713
+ W((pe) => Zs(pe, q, ne, se));
714
+ }, st = (q, ne, se) => {
715
+ const pe = le(q, ne);
716
+ K((Dt) => ({
717
+ ...Dt,
718
+ [pe]: se
780
719
  }));
781
- }, e[63] = xt) : xt = e[63];
782
- const gs = xt, Dt = O ? "-1px" : void 0, Bt = O ? "0" : void 0, Ft = W ? Ut : j, Lt = W ? 1 : 0, $t = W ? Ut : j;
783
- let Ge;
784
- e[64] !== $t ? (Ge = {
785
- borderColor: $t,
720
+ };
721
+ return /* @__PURE__ */ c(P, { ref: oe, position: "relative", width: "100%", paddingX: "xs", paddingY: "xs", mt: b ? "-1px" : void 0, bg: "bg", borderRadius: "xs", borderTopRadius: b ? "0" : void 0, borderWidth: "1px", borderStyle: "solid", borderColor: Q ? mt : R, zIndex: Q ? 1 : 0, transition: "border-color 0.2s ease-in-out", _hover: {
722
+ borderColor: Q ? mt : R,
786
723
  zIndex: 1
787
- }, e[64] = $t, e[65] = Ge) : Ge = e[65];
788
- let St;
789
- e[66] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (St = {
790
- borderColor: Ut,
724
+ }, _focusWithin: {
725
+ borderColor: mt,
791
726
  zIndex: 1
792
- }, e[66] = St) : St = e[66];
793
- let wt;
794
- e[67] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (wt = () => _e(!1), e[67] = wt) : wt = e[67];
795
- let Ye;
796
- e[68] !== h ? (Ye = h ? /* @__PURE__ */ c(B, { children: h }) : null, e[68] = h, e[69] = Ye) : Ye = e[69];
797
- let Je;
798
- e[70] !== J || e[71] !== Re || e[72] !== ve || e[73] !== $e || e[74] !== E || e[75] !== _ || e[76] !== p || e[77] !== m || e[78] !== b || e[79] !== q || e[80] !== N ? (Je = b ? /* @__PURE__ */ c(Wo, { questionPrompt: b, selectedOptionsByQuestion: N, customAnswersByQuestion: J, onToggleOption: hs, onCustomAnswerChange: gs }) : /* @__PURE__ */ c(_t, { maxH: "10rem", showHorizontalScrollbar: !1, contentProps: {
799
- pr: "2xs"
800
- }, children: /* @__PURE__ */ c(Qe, { minH: hn, align: "center", children: /* @__PURE__ */ c(Js, { defaultState: ve, isEditable: !E, placeholder: /* @__PURE__ */ c(Vo, { placeholder: m }), onChange: (Q) => {
801
- de(Q), p?.(Q);
802
- }, onSubmit: $e, references: q, onAddReference: _ }, Re) }) }), e[70] = J, e[71] = Re, e[72] = ve, e[73] = $e, e[74] = E, e[75] = _, e[76] = p, e[77] = m, e[78] = b, e[79] = q, e[80] = N, e[81] = Je) : Je = e[81];
803
- let Tt;
804
- e[82] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Tt = /* @__PURE__ */ c(As, {}), e[82] = Tt) : Tt = e[82];
805
- const Ot = te === "interrupt", zt = te === "interrupt" ? "Stop Response" : T ?? "Send message", Qt = M && !b ? void 0 : "Enter", qt = te === "none";
806
- let Ze;
807
- e[83] !== Et || e[84] !== Ot || e[85] !== zt || e[86] !== Qt || e[87] !== qt ? (Ze = /* @__PURE__ */ c(Ho, { canInterrupt: Ot, title: zt, shortcut: Qt, onClick: Et, disabled: qt }), e[83] = Et, e[84] = Ot, e[85] = zt, e[86] = Qt, e[87] = qt, e[88] = Ze) : Ze = e[88];
808
- let et;
809
- e[89] !== g || e[90] !== Ze ? (et = /* @__PURE__ */ k(ae, { gap: "1", minH: hn, align: "center", children: [
810
- g,
811
- Tt,
812
- Ze
813
- ] }), e[89] = g, e[90] = Ze, e[91] = et) : et = e[91];
814
- let tt;
815
- e[92] !== Ye || e[93] !== Je || e[94] !== et ? (tt = /* @__PURE__ */ k(Qe, { direction: "column", color: "fg", gap: "xs", children: [
816
- Ye,
817
- Je,
818
- et
819
- ] }), e[92] = Ye, e[93] = Je, e[94] = et, e[95] = tt) : tt = e[95];
820
- let At;
821
- return e[96] !== xe.onDragOver || e[97] !== xe.onDropCapture || e[98] !== xe.onPasteCapture || e[99] !== Dt || e[100] !== Bt || e[101] !== Ft || e[102] !== Lt || e[103] !== Ge || e[104] !== tt ? (At = /* @__PURE__ */ c(B, { ref: We, position: "relative", width: "100%", paddingX: "xs", paddingY: "xs", mt: Dt, bg: "bg", borderRadius: "xs", borderTopRadius: Bt, borderWidth: "1px", borderStyle: "solid", borderColor: Ft, zIndex: Lt, transition: "border-color 0.2s ease-in-out", _hover: Ge, _focusWithin: St, onPasteCapture: xe.onPasteCapture, onDropCapture: xe.onDropCapture, onDragOver: xe.onDragOver, onClick: lt, onBlur: wt, children: tt }), e[96] = xe.onDragOver, e[97] = xe.onDropCapture, e[98] = xe.onPasteCapture, e[99] = Dt, e[100] = Bt, e[101] = Ft, e[102] = Lt, e[103] = Ge, e[104] = tt, e[105] = At) : At = e[105], At;
822
- };
823
- function Uo() {
824
- }
825
- function jo(t) {
826
- return t + 1;
827
- }
828
- function Ko(t) {
829
- return t + 1;
830
- }
831
- const mt = (t) => typeof t == "object" && t !== null && !Array.isArray(t), Xo = (t) => {
727
+ }, onPasteCapture: we.onPasteCapture, onDropCapture: we.onDropCapture, onDragOver: we.onDragOver, onClick: Te, onBlur: () => M(!1), children: /* @__PURE__ */ k(be, { direction: "column", color: "fg", gap: "xs", children: [
728
+ h ? /* @__PURE__ */ c(P, { children: h }) : null,
729
+ y ? /* @__PURE__ */ c(co, { questionPrompt: y, selectedOptionsByQuestion: v, customAnswersByQuestion: H, onToggleOption: nt, onCustomAnswerChange: st }) : (
730
+ // The editor is its own composer row: it centres a single line at the shared
731
+ // control height and grows with content, never shrinking below it, so the row
732
+ // aligns with the toolbar beneath it.
733
+ /* @__PURE__ */ c(Ye, { maxH: "10rem", showHorizontalScrollbar: !1, contentProps: {
734
+ pr: "2xs"
735
+ }, children: /* @__PURE__ */ c(be, { minH: Lt, align: "center", children: /* @__PURE__ */ c(xs, { defaultState: D, isEditable: !d && !L, placeholder: /* @__PURE__ */ c(fo, { placeholder: m }), onChange: (q) => {
736
+ z(q), p?.(q);
737
+ }, onSubmit: () => Ae(Vs(de)), references: C, onAddReference: _ }, $) }) })
738
+ ),
739
+ /* @__PURE__ */ k(Z, { gap: "1", minH: Lt, align: "center", children: [
740
+ g,
741
+ /* @__PURE__ */ c(Vn, {}),
742
+ /* @__PURE__ */ c(uo, { canInterrupt: te === "interrupt", title: te === "interrupt" ? "Stop Response" : w ?? fe, shortcut: te === "submit" ? "Enter" : void 0, onClick: () => Ae(te), disabled: te === "none" })
743
+ ] })
744
+ ] }) });
745
+ }, Qe = (t) => typeof t == "object" && t !== null && !Array.isArray(t), mo = (t) => {
832
746
  try {
833
747
  const e = JSON.parse(t);
834
- return mt(e) ? e : null;
748
+ return Qe(e) ? e : null;
835
749
  } catch {
836
750
  return null;
837
751
  }
838
- }, Go = (t) => mt(t) ? t : typeof t == "string" && t.trim().length > 0 ? Xo(t) : null, ot = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, we = (t) => {
839
- const e = ot(t);
752
+ }, ho = (t) => Qe(t) ? t : typeof t == "string" && t.trim().length > 0 ? mo(t) : null, De = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, re = (t) => {
753
+ const e = De(t);
840
754
  if (e) return e;
841
755
  if (Array.isArray(t)) {
842
- const n = t.map(we).filter((o) => o !== null);
756
+ const n = t.map(re).filter((s) => s !== null);
843
757
  return n.length > 0 ? n.join(`
844
758
  `) : null;
845
759
  }
846
- return mt(t) ? we(t.response) ?? we(t.answer) ?? we(t.text) ?? we(t.answers) : null;
847
- }, Yo = (t) => {
760
+ return Qe(t) ? re(t.response) ?? re(t.answer) ?? re(t.text) ?? re(t.answers) : null;
761
+ }, go = (t) => {
848
762
  if (typeof t == "string" && t.trim().length > 0)
849
763
  return {
850
764
  label: t,
851
765
  description: void 0
852
766
  };
853
- if (!mt(t)) return null;
854
- const e = ot(t.label);
767
+ if (!Qe(t)) return null;
768
+ const e = De(t.label);
855
769
  return e ? {
856
770
  label: e,
857
- description: ot(t.description) ?? void 0
771
+ description: De(t.description) ?? void 0
858
772
  } : null;
859
- }, Jo = (t, e) => {
860
- if (!mt(t)) return null;
861
- const n = ot(t.question);
773
+ }, bo = (t, e) => {
774
+ if (!Qe(t)) return null;
775
+ const n = De(t.question);
862
776
  if (!n) return null;
863
- const o = Array.isArray(t.options) ? t.options.map(Yo).filter((i) => i !== null) : [], s = ot(t.type), r = typeof t.custom == "boolean" ? t.custom : typeof t.allowCustomAnswer == "boolean" ? t.allowCustomAnswer : o.length === 0 || s === "freeform" || s === "text";
777
+ const s = Array.isArray(t.options) ? t.options.map(go).filter((i) => i !== null) : [], o = De(t.type), r = typeof t.custom == "boolean" ? t.custom : typeof t.allowCustomAnswer == "boolean" ? t.allowCustomAnswer : s.length === 0 || o === "freeform" || o === "text";
864
778
  return {
865
- id: ot(t.id) ?? `question-${e}`,
779
+ id: De(t.id) ?? `question-${e}`,
866
780
  question: n,
867
- options: o,
868
- multiple: typeof t.multiple == "boolean" ? t.multiple : s === "multi_choice" || s === "multiple_choice",
781
+ options: s,
782
+ multiple: typeof t.multiple == "boolean" ? t.multiple : o === "multi_choice" || o === "multiple_choice",
869
783
  required: typeof t.required == "boolean" ? t.required : !0,
870
784
  allowCustomAnswer: r
871
785
  };
872
- }, Hn = (t) => {
873
- const e = Go(t);
786
+ }, dn = (t) => {
787
+ const e = ho(t);
874
788
  if (!e || !Array.isArray(e.questions)) return null;
875
- const n = e.questions.map(Jo).filter((o) => o !== null);
789
+ const n = e.questions.map(bo).filter((s) => s !== null);
876
790
  return n.length === 0 ? null : {
877
791
  questions: n
878
792
  };
879
- }, Zo = (t) => t.tool.toLowerCase() === "question", er = (t) => {
793
+ }, yo = (t) => t.tool.toLowerCase() === "question", xo = (t) => {
880
794
  for (let e = t.length - 1; e >= 0; e -= 1) {
881
795
  const n = t[e];
882
796
  if (n.role === "assistant")
883
- for (let o = n.parts.length - 1; o >= 0; o -= 1) {
884
- const s = n.parts[o];
885
- if (s.type !== "tool" || !Zo(s)) continue;
886
- return we(s.state?.output) ?? we(s.state?.metadata) ? void 0 : Hn(s.state?.input) ?? void 0;
797
+ for (let s = n.parts.length - 1; s >= 0; s -= 1) {
798
+ const o = n.parts[s];
799
+ if (o.type !== "tool" || !yo(o)) continue;
800
+ return re(o.state?.output) ?? re(o.state?.metadata) ? void 0 : dn(o.state?.input) ?? void 0;
887
801
  }
888
802
  }
889
- }, tr = (t = "") => JSON.stringify(Zs(t)), Vn = {
803
+ }, So = (t = "") => JSON.stringify(Ss(t)), fn = {
890
804
  animationName: "message-fade-in",
891
805
  animationDuration: "200ms",
892
806
  animationTimingFunction: "ease-out"
893
- }, nr = (t) => {
807
+ }, wo = (t) => {
894
808
  const e = /* @__PURE__ */ new Set(), n = new Set(t.state.seenKeys);
895
- for (const o of t.itemKeys)
896
- t.state.initialized && !n.has(o) && e.add(o), n.add(o);
809
+ for (const s of t.itemKeys)
810
+ t.state.initialized && !n.has(s) && e.add(s), n.add(s);
897
811
  return {
898
812
  animatedKeys: e,
899
813
  state: {
@@ -901,70 +815,70 @@ const mt = (t) => typeof t == "object" && t !== null && !Array.isArray(t), Xo =
901
815
  seenKeys: n
902
816
  }
903
817
  };
904
- }, sr = (t, e) => {
818
+ }, To = (t, e) => {
905
819
  if (t.length !== e.length) return !1;
906
820
  for (let n = 0; n < t.length; n += 1) if (t[n] !== e[n]) return !1;
907
821
  return !0;
908
- }, or = (t) => {
909
- const e = Te({
822
+ }, Ao = (t) => {
823
+ const e = ie({
910
824
  initialized: !1,
911
825
  seenKeys: /* @__PURE__ */ new Set()
912
- }), n = Te(null);
913
- if (n.current && sr(n.current.itemKeys, t))
826
+ }), n = ie(null);
827
+ if (n.current && To(n.current.itemKeys, t))
914
828
  return n.current.animatedKeys;
915
- const o = nr({
829
+ const s = wo({
916
830
  itemKeys: t,
917
831
  state: e.current
918
832
  });
919
- return e.current = o.state, n.current = {
833
+ return e.current = s.state, n.current = {
920
834
  itemKeys: [...t],
921
- animatedKeys: o.animatedKeys
922
- }, o.animatedKeys;
923
- }, rr = (t) => t.type === "text", ir = (t) => (t.parts ?? []).filter(rr).map((e) => e.text.trim()).filter(Boolean).join(`
835
+ animatedKeys: s.animatedKeys
836
+ }, s.animatedKeys;
837
+ }, ko = (t) => t.type === "text", Co = (t) => (t.parts ?? []).filter(ko).map((e) => e.text.trim()).filter(Boolean).join(`
924
838
 
925
- `), lr = (t, e, n) => t.createdAt ? new Intl.DateTimeFormat(e, {
839
+ `), Io = (t, e, n) => t.createdAt ? new Intl.DateTimeFormat(e, {
926
840
  hour: "numeric",
927
841
  minute: "2-digit",
928
842
  timeZone: n
929
- }).format(new Date(t.createdAt)) : "", Yt = (t) => {
930
- const e = C(20), {
843
+ }).format(new Date(t.createdAt)) : "", xt = (t) => {
844
+ const e = A(20), {
931
845
  message: n,
932
- alwaysVisible: o,
933
- copyAlwaysVisible: s
934
- } = t, r = o === void 0 ? !1 : o, i = s === void 0 ? r : s, [l, a] = H(!1), u = Te(null);
846
+ alwaysVisible: s,
847
+ copyAlwaysVisible: o
848
+ } = t, r = s === void 0 ? !1 : s, i = o === void 0 ? r : o, [l, a] = V(!1), u = ie(null);
935
849
  let d;
936
- e[0] !== n ? (d = ir(n), e[0] = n, e[1] = d) : d = e[1];
850
+ e[0] !== n ? (d = Co(n), e[0] = n, e[1] = d) : d = e[1];
937
851
  const f = d;
938
852
  let p;
939
- e[2] !== n ? (p = lr(n), e[2] = n, e[3] = p) : p = e[3];
853
+ e[2] !== n ? (p = Io(n), e[2] = n, e[3] = p) : p = e[3];
940
854
  const m = p;
941
855
  let h, g;
942
856
  e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (h = () => () => {
943
857
  u.current !== null && window.clearTimeout(u.current);
944
- }, g = [], e[4] = h, e[5] = g) : (h = e[4], g = e[5]), le(h, g);
945
- let y;
946
- e[6] !== f ? (y = async () => {
858
+ }, g = [], e[4] = h, e[5] = g) : (h = e[4], g = e[5]), J(h, g);
859
+ let b;
860
+ e[6] !== f ? (b = async () => {
947
861
  if (f)
948
862
  try {
949
863
  await navigator.clipboard.writeText(f), a(!0), u.current !== null && window.clearTimeout(u.current), u.current = window.setTimeout(() => a(!1), 1200);
950
864
  } catch {
951
865
  a(!1);
952
866
  }
953
- }, e[6] = f, e[7] = y) : y = e[7];
954
- const x = y;
867
+ }, e[6] = f, e[7] = b) : b = e[7];
868
+ const x = b;
955
869
  if (!f && !m)
956
870
  return null;
957
- const b = r ? "1" : "0", S = r ? "auto" : "none";
871
+ const y = r ? "1" : "0", T = r ? "auto" : "none";
872
+ let S;
873
+ e[8] !== m ? (S = m ? /* @__PURE__ */ c(U, { textStyle: "label/XS/regular", color: "fg.muted", children: m }) : null, e[8] = m, e[9] = S) : S = e[9];
958
874
  let w;
959
- e[8] !== m ? (w = m ? /* @__PURE__ */ c(U, { textStyle: "label/XS/regular", color: "fg.muted", children: m }) : null, e[8] = m, e[9] = w) : w = e[9];
960
- let T;
961
- e[10] !== i || e[11] !== x || e[12] !== f || e[13] !== l ? (T = f ? /* @__PURE__ */ c(B, { opacity: i ? "1" : "0", pointerEvents: i ? "auto" : "none", transition: "opacity 120ms ease", css: bn, children: /* @__PURE__ */ c(sn, { content: l ? "Copied" : "Copy message", children: /* @__PURE__ */ c(nt, { "aria-label": l ? "Copied" : "Copy message", variant: "ghost", size: "2xs", onClick: x, children: l ? /* @__PURE__ */ c(Dn, { size: 12 }) : /* @__PURE__ */ c(Es, { size: 12 }) }) }) }) : null, e[10] = i, e[11] = x, e[12] = f, e[13] = l, e[14] = T) : T = e[14];
962
- let A;
963
- return e[15] !== T || e[16] !== b || e[17] !== S || e[18] !== w ? (A = /* @__PURE__ */ k(ae, { "data-chat-message-action-panel": "true", gap: "2xs", minH: "6", opacity: b, pointerEvents: S, transition: "opacity 120ms ease", css: bn, children: [
964
- w,
965
- T
966
- ] }), e[15] = T, e[16] = b, e[17] = S, e[18] = w, e[19] = A) : A = e[19], A;
967
- }, bn = {
875
+ e[10] !== i || e[11] !== x || e[12] !== f || e[13] !== l ? (w = f ? /* @__PURE__ */ c(P, { opacity: i ? "1" : "0", pointerEvents: i ? "auto" : "none", transition: "opacity 120ms ease", css: Ot, children: /* @__PURE__ */ c(Ct, { content: l ? "Copied" : "Copy message", children: /* @__PURE__ */ c(Pe, { "aria-label": l ? "Copied" : "Copy message", variant: "ghost", size: "2xs", onClick: x, children: l ? /* @__PURE__ */ c(en, { size: 12 }) : /* @__PURE__ */ c(Zn, { size: 12 }) }) }) }) : null, e[10] = i, e[11] = x, e[12] = f, e[13] = l, e[14] = w) : w = e[14];
876
+ let C;
877
+ return e[15] !== w || e[16] !== y || e[17] !== T || e[18] !== S ? (C = /* @__PURE__ */ k(Z, { "data-chat-message-action-panel": "true", gap: "2xs", minH: "6", opacity: y, pointerEvents: T, transition: "opacity 120ms ease", css: Ot, children: [
878
+ S,
879
+ w
880
+ ] }), e[15] = w, e[16] = y, e[17] = T, e[18] = S, e[19] = C) : C = e[19], C;
881
+ }, Ot = {
968
882
  "[data-chat-message-with-actions]:hover &, [data-chat-message-with-actions]:focus-within &": {
969
883
  opacity: 1,
970
884
  pointerEvents: "auto"
@@ -977,44 +891,44 @@ const mt = (t) => typeof t == "object" && t !== null && !Array.isArray(t), Xo =
977
891
  opacity: 1,
978
892
  pointerEvents: "auto"
979
893
  }
980
- }, ar = (t) => {
981
- const e = C(8);
982
- let n, o;
894
+ }, _o = (t) => {
895
+ const e = A(8);
896
+ let n, s;
983
897
  e[0] !== t ? ({
984
898
  children: n,
985
- ...o
986
- } = t, e[0] = t, e[1] = n, e[2] = o) : (n = e[1], o = e[2]);
987
- let s;
988
- e[3] !== n ? (s = /* @__PURE__ */ c(On, { defaultState: n, fullWidth: !0 }), e[3] = n, e[4] = s) : s = e[4];
899
+ ...s
900
+ } = t, e[0] = t, e[1] = n, e[2] = s) : (n = e[1], s = e[2]);
901
+ let o;
902
+ e[3] !== n ? (o = /* @__PURE__ */ c(rn, { defaultState: n, fullWidth: !0 }), e[3] = n, e[4] = o) : o = e[4];
989
903
  let r;
990
- return e[5] !== o || e[6] !== s ? (r = /* @__PURE__ */ c(B, { ...o, children: s }), e[5] = o, e[6] = s, e[7] = r) : r = e[7], r;
991
- }, cr = ar, vt = (t) => t.replace(/^tool-/i, "").replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[\s-]+/g, "_").toLowerCase(), ur = (t) => {
992
- const e = vt(t), n = e.replace(/_/g, "");
904
+ return e[5] !== s || e[6] !== o ? (r = /* @__PURE__ */ c(P, { ...s, children: o }), e[5] = s, e[6] = o, e[7] = r) : r = e[7], r;
905
+ }, Ro = _o, Je = (t) => t.replace(/^tool-/i, "").replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[\s-]+/g, "_").toLowerCase(), vo = (t) => {
906
+ const e = Je(t), n = e.replace(/_/g, "");
993
907
  return [.../* @__PURE__ */ new Set([t, e, n])];
994
- }, Nn = {
995
- shell: Fn,
996
- ls: zs,
997
- read_file: Os,
998
- write_file: $s,
999
- delete_file: Bn,
1000
- patch: Ls,
1001
- upload_files: Fs,
1002
- download_file: Bs,
1003
- move_file: Ds
1004
- }, dr = {
1005
- dot: Ns,
1006
- danger: Ln,
1007
- search: Vs,
1008
- browser: Hs,
1009
- file: Ws,
1010
- question: qs,
1011
- todo: Qs,
1012
- terminal: Fn,
1013
- ...Nn
1014
- }, yn = "dot", fr = (t) => Object.hasOwn(Nn, t), pr = (t) => dr[t], Un = (t) => {
1015
- if (!t) return yn;
1016
- const e = vt(t);
1017
- if (fr(e)) return e;
908
+ }, pn = {
909
+ shell: nn,
910
+ ls: is,
911
+ read_file: rs,
912
+ write_file: os,
913
+ delete_file: tn,
914
+ patch: ss,
915
+ upload_files: ns,
916
+ download_file: ts,
917
+ move_file: es
918
+ }, Mo = {
919
+ dot: fs,
920
+ danger: sn,
921
+ search: ds,
922
+ browser: us,
923
+ file: cs,
924
+ question: as,
925
+ todo: ls,
926
+ terminal: nn,
927
+ ...pn
928
+ }, zt = "dot", Po = (t) => Object.hasOwn(pn, t), Eo = (t) => Mo[t], mn = (t) => {
929
+ if (!t) return zt;
930
+ const e = Je(t);
931
+ if (Po(e)) return e;
1018
932
  const n = e.replace(/_/g, "");
1019
933
  switch (e) {
1020
934
  case "read":
@@ -1041,52 +955,52 @@ const mt = (t) => typeof t == "object" && t !== null && !Array.isArray(t), Xo =
1041
955
  case "file":
1042
956
  return "file";
1043
957
  default:
1044
- return n === "todowrite" || n === "todo" ? "todo" : yn;
958
+ return n === "todowrite" || n === "todo" ? "todo" : zt;
1045
959
  }
1046
960
  };
1047
- function ln(t) {
961
+ function Rt(t) {
1048
962
  const e = t.lastIndexOf("/");
1049
963
  return e >= 0 ? t.slice(e + 1) : t;
1050
964
  }
1051
- function kt(t) {
965
+ function Xe(t) {
1052
966
  if (!t) return null;
1053
967
  const e = t.split(" ")[0].trim();
1054
968
  if (e === "/dev/null") return null;
1055
969
  let n = e;
1056
970
  return (n.startsWith("a/") || n.startsWith("b/")) && (n = n.slice(2)), n.replace(/^\/+/, "").replace(/\\/g, "/");
1057
971
  }
1058
- const Rt = (t) => t.startsWith("--- "), an = (t) => t.startsWith("+++ "), cn = (t) => t.startsWith("@@"), mr = (t) => t.startsWith("+") && !(an(t) || t === "+++"), hr = (t) => t.startsWith("-") && !(Rt(t) || t === "---"), gr = (t, e) => {
972
+ const Ze = (t) => t.startsWith("--- "), vt = (t) => t.startsWith("+++ "), Mt = (t) => t.startsWith("@@"), Do = (t) => t.startsWith("+") && !(vt(t) || t === "+++"), Bo = (t) => t.startsWith("-") && !(Ze(t) || t === "---"), Fo = (t, e) => {
1059
973
  t.has(e) || t.set(e, {
1060
974
  additions: 0,
1061
975
  deletions: 0
1062
976
  });
1063
- }, br = (t, e) => {
977
+ }, Lo = (t, e) => {
1064
978
  const n = t.get(e);
1065
979
  n && (n.additions += 1);
1066
- }, yr = (t, e) => {
980
+ }, $o = (t, e) => {
1067
981
  const n = t.get(e);
1068
982
  n && (n.deletions += 1);
1069
- }, xr = (t, e, n) => {
1070
- if (Rt(t))
983
+ }, Oo = (t, e, n) => {
984
+ if (Ze(t))
1071
985
  return {
1072
986
  ...e,
1073
- lastMinusHeader: kt(t.slice(4)),
987
+ lastMinusHeader: Xe(t.slice(4)),
1074
988
  inHunk: !1
1075
989
  };
1076
- if (an(t)) {
1077
- const s = kt(t.slice(4)) ?? e.lastMinusHeader;
1078
- return s && gr(n, s), {
990
+ if (vt(t)) {
991
+ const o = Xe(t.slice(4)) ?? e.lastMinusHeader;
992
+ return o && Fo(n, o), {
1079
993
  ...e,
1080
- currentPath: s,
994
+ currentPath: o,
1081
995
  inHunk: !1
1082
996
  };
1083
997
  }
1084
- return e.currentPath ? cn(t) ? {
998
+ return e.currentPath ? Mt(t) ? {
1085
999
  ...e,
1086
1000
  inHunk: !0
1087
- } : e.inHunk ? mr(t) ? (br(n, e.currentPath), e) : (hr(t) && yr(n, e.currentPath), e) : e : e;
1001
+ } : e.inHunk ? Do(t) ? (Lo(n, e.currentPath), e) : (Bo(t) && $o(n, e.currentPath), e) : e : e;
1088
1002
  };
1089
- function jn(t) {
1003
+ function hn(t) {
1090
1004
  if (!t || typeof t != "string") return [];
1091
1005
  const e = /* @__PURE__ */ new Map();
1092
1006
  let n = {
@@ -1094,34 +1008,34 @@ function jn(t) {
1094
1008
  lastMinusHeader: null,
1095
1009
  inHunk: !1
1096
1010
  };
1097
- const o = t.split(/\r?\n/);
1098
- for (const s of o)
1099
- n = xr(s, n, e);
1100
- return Array.from(e.entries()).map(([s, {
1011
+ const s = t.split(/\r?\n/);
1012
+ for (const o of s)
1013
+ n = Oo(o, n, e);
1014
+ return Array.from(e.entries()).map(([o, {
1101
1015
  additions: r,
1102
1016
  deletions: i
1103
1017
  }]) => ({
1104
- filePath: s,
1018
+ filePath: o,
1105
1019
  additions: r,
1106
1020
  deletions: i
1107
1021
  }));
1108
1022
  }
1109
- function Sr(t) {
1110
- return jn(t).map((e) => ({
1023
+ function zo(t) {
1024
+ return hn(t).map((e) => ({
1111
1025
  kind: "diff",
1112
- fileName: ln(e.filePath),
1026
+ fileName: Rt(e.filePath),
1113
1027
  filePath: e.filePath,
1114
1028
  additions: e.additions,
1115
1029
  deletions: e.deletions
1116
1030
  }));
1117
1031
  }
1118
- function wr(t) {
1119
- return jn(t).map((e) => e.filePath);
1032
+ function Qo(t) {
1033
+ return hn(t).map((e) => e.filePath);
1120
1034
  }
1121
- const Kn = (t) => Rt(t) || t.startsWith("diff --git "), Tr = (t) => t.startsWith(" ") || t.startsWith("+") || t.startsWith("-") ? !1 : t.trim() !== "", Ar = (t, e, n) => {
1035
+ const gn = (t) => Ze(t) || t.startsWith("diff --git "), qo = (t) => t.startsWith(" ") || t.startsWith("+") || t.startsWith("-") ? !1 : t.trim() !== "", Wo = (t, e, n) => {
1122
1036
  if (t.startsWith(" ")) {
1123
- const o = t.slice(1);
1124
- e.push(o), n.push(o);
1037
+ const s = t.slice(1);
1038
+ e.push(s), n.push(s);
1125
1039
  return;
1126
1040
  }
1127
1041
  if (t.startsWith("-")) {
@@ -1129,30 +1043,30 @@ const Kn = (t) => Rt(t) || t.startsWith("diff --git "), Tr = (t) => t.startsWith
1129
1043
  return;
1130
1044
  }
1131
1045
  t.startsWith("+") && n.push(t.slice(1));
1132
- }, Cr = (t, e, n, o) => {
1133
- let s = e;
1134
- for (; s < t.length; ) {
1135
- const r = t[s] || "";
1136
- if (Kn(r) || cn(r) || Tr(r))
1046
+ }, Ho = (t, e, n, s) => {
1047
+ let o = e;
1048
+ for (; o < t.length; ) {
1049
+ const r = t[o] || "";
1050
+ if (gn(r) || Mt(r) || qo(r))
1137
1051
  break;
1138
- Ar(r, n, o), s += 1;
1052
+ Wo(r, n, s), o += 1;
1139
1053
  }
1140
- return (n.length > 0 || o.length > 0) && (n.push(""), o.push("")), s;
1141
- }, kr = (t, e) => {
1142
- const n = kt((t[e] || "").slice(4)), o = t[e + 1] || "";
1143
- if (!an(o)) return {
1054
+ return (n.length > 0 || s.length > 0) && (n.push(""), s.push("")), o;
1055
+ }, Vo = (t, e) => {
1056
+ const n = Xe((t[e] || "").slice(4)), s = t[e + 1] || "";
1057
+ if (!vt(s)) return {
1144
1058
  nextIndex: e + 1
1145
1059
  };
1146
- const r = kt(o.slice(4)) ?? n ?? "", i = [], l = [];
1060
+ const r = Xe(s.slice(4)) ?? n ?? "", i = [], l = [];
1147
1061
  let a = e + 2;
1148
1062
  for (; a < t.length; ) {
1149
1063
  const u = t[a] || "";
1150
- if (Kn(u)) break;
1151
- if (!cn(u)) {
1064
+ if (gn(u)) break;
1065
+ if (!Mt(u)) {
1152
1066
  a += 1;
1153
1067
  continue;
1154
1068
  }
1155
- a = Cr(t, a + 1, i, l);
1069
+ a = Ho(t, a + 1, i, l);
1156
1070
  }
1157
1071
  return {
1158
1072
  nextIndex: a,
@@ -1165,25 +1079,25 @@ const Kn = (t) => Rt(t) || t.startsWith("diff --git "), Tr = (t) => t.startsWith
1165
1079
  }
1166
1080
  };
1167
1081
  };
1168
- function Ir(t) {
1082
+ function No(t) {
1169
1083
  if (!t || typeof t != "string") return [];
1170
1084
  const e = t.split(/\r?\n/), n = [];
1171
- let o = 0;
1172
- for (; o < e.length; ) {
1173
- const s = e[o] || "";
1174
- if (!Rt(s)) {
1175
- o += 1;
1085
+ let s = 0;
1086
+ for (; s < e.length; ) {
1087
+ const o = e[s] || "";
1088
+ if (!Ze(o)) {
1089
+ s += 1;
1176
1090
  continue;
1177
1091
  }
1178
1092
  const {
1179
1093
  nextIndex: r,
1180
1094
  preview: i
1181
- } = kr(e, o);
1182
- i && n.push(i), o = Math.max(r, o + 1);
1095
+ } = Vo(e, s);
1096
+ i && n.push(i), s = Math.max(r, s + 1);
1183
1097
  }
1184
1098
  return n;
1185
1099
  }
1186
- const _r = {
1100
+ const Uo = {
1187
1101
  apply_patch: "Apply patch",
1188
1102
  bash: "Run command",
1189
1103
  edit: "Edit file",
@@ -1192,143 +1106,143 @@ const _r = {
1192
1106
  read: "Read file",
1193
1107
  skill: "Load skill",
1194
1108
  todowrite: "Update todos"
1195
- }, xn = {
1109
+ }, Qt = {
1196
1110
  error: "failed",
1197
1111
  "output-error": "failed",
1198
1112
  input_streaming: "running",
1199
1113
  running: "running",
1200
1114
  completed: "completed",
1201
1115
  failed: "failed"
1202
- }, Xn = (t) => t.replace(/^tool-/, "").toLowerCase(), vr = (t) => t.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), Rr = (t) => Xn(t.tool ?? "tool"), Mr = (t) => {
1203
- const e = Xn(t);
1204
- return _r[e] ?? vr(e.replace(/_/g, " "));
1205
- }, Pr = (t) => {
1116
+ }, bn = (t) => t.replace(/^tool-/, "").toLowerCase(), jo = (t) => t.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), Ko = (t) => bn(t.tool ?? "tool"), Xo = (t) => {
1117
+ const e = bn(t);
1118
+ return Uo[e] ?? jo(e.replace(/_/g, " "));
1119
+ }, Go = (t) => {
1206
1120
  const e = t.state?.status ?? t.status;
1207
1121
  if (!e || typeof e != "string") return null;
1208
1122
  const n = e.replace(/-/g, "_");
1209
- return xn[n] ? xn[n] : n.includes("stream") ? "running" : null;
1210
- }, Gn = (t) => {
1123
+ return Qt[n] ? Qt[n] : n.includes("stream") ? "running" : null;
1124
+ }, yn = (t) => {
1211
1125
  const e = t.state?.status ?? t.status;
1212
1126
  return e === "error" || e === "output-error" || e === "failed";
1213
- }, Ce = (t) => Gn(t) ? {
1127
+ }, ae = (t) => yn(t) ? {
1214
1128
  type: "icon",
1215
1129
  icon: "danger"
1216
1130
  } : {
1217
1131
  type: "icon",
1218
- icon: Un(Rr(t))
1219
- }, ke = (t, e, n, o) => {
1132
+ icon: mn(Ko(t))
1133
+ }, ce = (t, e, n, s) => {
1220
1134
  const r = [{
1221
1135
  kind: "text",
1222
- text: n ?? Mr(t.tool ?? "tool"),
1136
+ text: n ?? Xo(t.tool ?? "tool"),
1223
1137
  bold: !0
1224
1138
  }];
1225
1139
  e && r.push({
1226
1140
  kind: "text",
1227
1141
  text: e,
1228
1142
  muted: !0,
1229
- ...o === "monospace" ? {
1143
+ ...s === "monospace" ? {
1230
1144
  truncate: !0,
1231
1145
  monospace: !0
1232
1146
  } : {}
1233
1147
  });
1234
- const i = Pr(t);
1148
+ const i = Go(t);
1235
1149
  return i && i !== "completed" && r.push({
1236
1150
  kind: "text",
1237
1151
  text: i,
1238
1152
  muted: !0
1239
1153
  }), r;
1240
- }, qe = (t) => {
1154
+ }, ye = (t) => {
1241
1155
  const e = t.state?.input;
1242
1156
  return !e || typeof e != "object" || Array.isArray(e) ? null : e;
1243
- }, ht = (t) => {
1157
+ }, qe = (t) => {
1244
1158
  const e = t.state?.output;
1245
1159
  return !e || typeof e != "object" || Array.isArray(e) ? null : e;
1246
- }, I = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, pt = (t) => !t || typeof t != "object" || Array.isArray(t) ? null : t, Er = (t, e) => {
1247
- const n = pt(t.state);
1248
- return n ? pt(n[e]) : null;
1249
- }, Yn = (t) => t.replace(/\\/g, "/").replace(/^\/+/, ""), Dr = (t) => t.includes("--- ") && t.includes("+++ ") && t.includes("@@"), Jn = (t) => {
1250
- const e = ht(t);
1251
- return [Er(t, "metadata"), pt(e?.metadata)].filter(Boolean);
1252
- }, Br = (t) => {
1253
- const e = pt(t);
1160
+ }, I = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, ze = (t) => !t || typeof t != "object" || Array.isArray(t) ? null : t, Yo = (t, e) => {
1161
+ const n = ze(t.state);
1162
+ return n ? ze(n[e]) : null;
1163
+ }, xn = (t) => t.replace(/\\/g, "/").replace(/^\/+/, ""), Jo = (t) => t.includes("--- ") && t.includes("+++ ") && t.includes("@@"), Sn = (t) => {
1164
+ const e = qe(t);
1165
+ return [Yo(t, "metadata"), ze(e?.metadata)].filter(Boolean);
1166
+ }, Zo = (t) => {
1167
+ const e = ze(t);
1254
1168
  if (!e) return null;
1255
1169
  const n = I(e.filePath) ?? I(e.relativePath) ?? I(e.path);
1256
1170
  return n ? {
1257
- filePath: Yn(n),
1171
+ filePath: xn(n),
1258
1172
  additions: typeof e.additions == "number" ? e.additions : 0,
1259
1173
  deletions: typeof e.deletions == "number" ? e.deletions : 0,
1260
1174
  diff: I(e.diff) ?? void 0,
1261
1175
  before: I(e.before) ?? void 0,
1262
1176
  after: I(e.after) ?? void 0
1263
1177
  } : null;
1264
- }, Zn = (t) => {
1178
+ }, wn = (t) => {
1265
1179
  const e = [];
1266
- for (const n of Jn(t)) {
1267
- const o = Array.isArray(n.files) ? n.files : [];
1268
- for (const s of o) {
1269
- const r = Br(s);
1180
+ for (const n of Sn(t)) {
1181
+ const s = Array.isArray(n.files) ? n.files : [];
1182
+ for (const o of s) {
1183
+ const r = Zo(o);
1270
1184
  r && e.push(r);
1271
1185
  }
1272
1186
  }
1273
1187
  return e;
1274
- }, Fr = (t) => {
1275
- const e = qe(t), o = (Array.isArray(e?.changes) ? e.changes : []).map((s) => I(pt(s)?.path)).filter((s) => !!s).map(Yn);
1276
- return Array.from(new Set(o));
1277
- }, Lr = (t) => {
1278
- const e = qe(t), n = I(e?.diff);
1188
+ }, er = (t) => {
1189
+ const e = ye(t), s = (Array.isArray(e?.changes) ? e.changes : []).map((o) => I(ze(o)?.path)).filter((o) => !!o).map(xn);
1190
+ return Array.from(new Set(s));
1191
+ }, tr = (t) => {
1192
+ const e = ye(t), n = I(e?.diff);
1279
1193
  if (n) return n;
1280
- for (const r of Jn(t)) {
1194
+ for (const r of Sn(t)) {
1281
1195
  const i = I(r.diff);
1282
1196
  if (i) return i;
1283
1197
  }
1284
- const o = Zn(t).map((r) => r.diff).filter((r) => !!r);
1285
- if (o.length > 0) return o.join(`
1198
+ const s = wn(t).map((r) => r.diff).filter((r) => !!r);
1199
+ if (s.length > 0) return s.join(`
1286
1200
  `);
1287
- const s = I(e?.patchText);
1288
- return s && Dr(s) ? s : null;
1289
- }, $r = (t) => {
1201
+ const o = I(e?.patchText);
1202
+ return o && Jo(o) ? o : null;
1203
+ }, nr = (t) => {
1290
1204
  const e = /* @__PURE__ */ new Set(), n = [];
1291
- for (const o of t)
1292
- e.has(o.filePath) || (e.add(o.filePath), n.push({
1205
+ for (const s of t)
1206
+ e.has(s.filePath) || (e.add(s.filePath), n.push({
1293
1207
  kind: "diff",
1294
- fileName: ln(o.filePath),
1295
- filePath: o.filePath,
1296
- additions: o.additions,
1297
- deletions: o.deletions
1208
+ fileName: Rt(s.filePath),
1209
+ filePath: s.filePath,
1210
+ additions: s.additions,
1211
+ deletions: s.deletions
1298
1212
  }));
1299
1213
  return n;
1300
- }, Or = (t) => Array.from(new Set(t.map((e) => e.filePath))), Mt = (t) => {
1301
- const e = ht(t);
1214
+ }, sr = (t) => Array.from(new Set(t.map((e) => e.filePath))), et = (t) => {
1215
+ const e = qe(t);
1302
1216
  return I(t.state?.output) ?? I(e?.returnDisplay) ?? I(e?.preview) ?? I(e?.stdout) ?? I(e?.content);
1303
- }, zr = (t) => {
1217
+ }, or = (t) => {
1304
1218
  const e = t.match(/<skill_content(?:\s+name="([^"]+)")?>([\s\S]*?)<\/skill_content>/);
1305
1219
  return e ? {
1306
1220
  skillName: I(e[1]) ?? void 0,
1307
1221
  content: I(e[2]) ?? ""
1308
1222
  } : null;
1309
- }, Qr = (t) => {
1310
- const e = qe(t);
1223
+ }, rr = (t) => {
1224
+ const e = ye(t);
1311
1225
  return I(e?.name) ?? I(e?.skillName) ?? I(e?.skill) ?? I(e?.skill_name) ?? void 0;
1312
- }, un = (t, e) => ({
1226
+ }, Pt = (t, e) => ({
1313
1227
  kind: "link",
1314
- text: ln(t),
1228
+ text: Rt(t),
1315
1229
  filePath: t,
1316
1230
  ...e ? {
1317
1231
  variant: e
1318
1232
  } : {}
1319
- }), Ie = (t, e) => !Gn(t) || !t.state?.errorText ? e : [{
1233
+ }), ue = (t, e) => !yn(t) || !t.state?.errorText ? e : [{
1320
1234
  type: "comment",
1321
1235
  text: t.state.errorText
1322
- }, ...e], es = (t) => Ir(t ?? void 0).map((e) => ({
1236
+ }, ...e], Tn = (t) => No(t ?? void 0).map((e) => ({
1323
1237
  type: "diff",
1324
1238
  language: "diff",
1325
1239
  original: e.original,
1326
1240
  modified: e.modified,
1327
1241
  sideBySide: !1
1328
- })), qr = (t) => Sr(t ?? void 0), Wr = (t) => wr(t ?? void 0), Hr = (t) => {
1329
- const e = Lr(t), n = Zn(t), o = Fr(t), s = ke(t, void 0, "Apply patch"), r = qr(e);
1330
- r.length > 0 ? s.push(...r) : n.length > 0 ? s.push(...$r(n)) : s.push(...o.map((l) => un(l, "bubble")));
1331
- const i = [...es(e)];
1242
+ })), ir = (t) => zo(t ?? void 0), lr = (t) => Qo(t ?? void 0), ar = (t) => {
1243
+ const e = tr(t), n = wn(t), s = er(t), o = ce(t, void 0, "Apply patch"), r = ir(e);
1244
+ r.length > 0 ? o.push(...r) : n.length > 0 ? o.push(...nr(n)) : o.push(...s.map((l) => Pt(l, "bubble")));
1245
+ const i = [...Tn(e)];
1332
1246
  if (i.length === 0)
1333
1247
  for (const l of n)
1334
1248
  !l.before && !l.after || i.push({
@@ -1339,92 +1253,92 @@ const _r = {
1339
1253
  sideBySide: !1
1340
1254
  });
1341
1255
  if (i.length === 0) {
1342
- const l = Wr(e);
1343
- l.length === 0 && l.push(...Or(n)), l.length === 0 && l.push(...o), l.length > 0 && i.push({
1256
+ const l = lr(e);
1257
+ l.length === 0 && l.push(...sr(n)), l.length === 0 && l.push(...s), l.length > 0 && i.push({
1344
1258
  type: "references",
1345
1259
  references: l
1346
1260
  });
1347
1261
  }
1348
1262
  return {
1349
- indicator: Ce(t),
1350
- title: s,
1351
- blocks: Ie(t, i)
1263
+ indicator: ae(t),
1264
+ title: o,
1265
+ blocks: ue(t, i)
1352
1266
  };
1353
- }, Vr = (t, e) => [{
1267
+ }, cr = (t, e) => [{
1354
1268
  type: "diff",
1355
1269
  language: "text",
1356
1270
  original: t,
1357
1271
  modified: e,
1358
1272
  sideBySide: !1
1359
- }], Nr = (t) => {
1360
- const e = qe(t), n = ht(t), o = I(e?.filePath) ?? I(e?.file_path) ?? I(n?.filePath) ?? void 0, s = I(n?.oldString) ?? I(e?.old_string) ?? void 0, r = I(n?.newString) ?? I(e?.new_string) ?? void 0, i = ke(t, void 0, "Edit file");
1361
- o && i.push(un(o));
1362
- const l = s !== void 0 && r !== void 0 ? Vr(s, r) : es(I(n?.diff));
1273
+ }], ur = (t) => {
1274
+ const e = ye(t), n = qe(t), s = I(e?.filePath) ?? I(e?.file_path) ?? I(n?.filePath) ?? void 0, o = I(n?.oldString) ?? I(e?.old_string) ?? void 0, r = I(n?.newString) ?? I(e?.new_string) ?? void 0, i = ce(t, void 0, "Edit file");
1275
+ s && i.push(Pt(s));
1276
+ const l = o !== void 0 && r !== void 0 ? cr(o, r) : Tn(I(n?.diff));
1363
1277
  return {
1364
- indicator: Ce(t),
1278
+ indicator: ae(t),
1365
1279
  title: i,
1366
- blocks: Ie(t, l)
1280
+ blocks: ue(t, l)
1367
1281
  };
1368
- }, Ur = (t) => {
1282
+ }, dr = (t) => {
1369
1283
  const {
1370
1284
  buildBaseTitle: e,
1371
1285
  buildIndicator: n,
1372
- prependErrorBlock: o
1286
+ prependErrorBlock: s
1373
1287
  } = t;
1374
- return (s) => {
1375
- const r = we(s.state?.output) ?? we(s.state?.metadata), i = Hn(s.state?.input), l = i ? {
1288
+ return (o) => {
1289
+ const r = re(o.state?.output) ?? re(o.state?.metadata), i = dn(o.state?.input), l = i ? {
1376
1290
  type: "question-form",
1377
1291
  questions: i.questions
1378
1292
  } : null;
1379
1293
  if (!r && !l) return null;
1380
1294
  const a = l ? `${l.questions.length} field${l.questions.length === 1 ? "" : "s"}` : void 0, u = r ? [] : [l];
1381
1295
  return {
1382
- indicator: n(s),
1383
- title: e(s, a, "Question"),
1384
- blocks: o(s, u),
1296
+ indicator: n(o),
1297
+ title: e(o, a, "Question"),
1298
+ blocks: s(o, u),
1385
1299
  expandable: !1
1386
1300
  };
1387
1301
  };
1388
- }, jr = (t) => {
1389
- const e = qe(t), n = ht(t), o = I(e?.filePath) ?? I(e?.file_path) ?? I(e?.file) ?? I(n?.filePath) ?? I(n?.file) ?? I(n?.path) ?? void 0, s = ke(t, void 0, "Read file");
1390
- return o && s.push(un(o)), {
1391
- indicator: Ce(t),
1392
- title: s,
1393
- blocks: Ie(t, [])
1302
+ }, fr = (t) => {
1303
+ const e = ye(t), n = qe(t), s = I(e?.filePath) ?? I(e?.file_path) ?? I(e?.file) ?? I(n?.filePath) ?? I(n?.file) ?? I(n?.path) ?? void 0, o = ce(t, void 0, "Read file");
1304
+ return s && o.push(Pt(s)), {
1305
+ indicator: ae(t),
1306
+ title: o,
1307
+ blocks: ue(t, [])
1394
1308
  };
1395
- }, ts = (t, e) => {
1396
- const n = qe(t), o = ht(t), s = I(n?.command) ?? void 0, r = ke(t, s, e, "monospace"), i = [], l = Mt(t);
1309
+ }, An = (t, e) => {
1310
+ const n = ye(t), s = qe(t), o = I(n?.command) ?? void 0, r = ce(t, o, e, "monospace"), i = [], l = et(t);
1397
1311
  l && i.push({
1398
1312
  type: "code",
1399
1313
  language: "text",
1400
1314
  code: l
1401
1315
  });
1402
- const a = I(o?.stderr);
1316
+ const a = I(s?.stderr);
1403
1317
  return a && a !== l && i.push({
1404
1318
  type: "code",
1405
1319
  language: "text",
1406
1320
  code: a
1407
- }), typeof o?.exitCode == "number" && i.push({
1321
+ }), typeof s?.exitCode == "number" && i.push({
1408
1322
  type: "text",
1409
- text: `Exit code: ${o.exitCode}`
1323
+ text: `Exit code: ${s.exitCode}`
1410
1324
  }), {
1411
- indicator: Ce(t),
1325
+ indicator: ae(t),
1412
1326
  title: r,
1413
- blocks: Ie(t, i)
1327
+ blocks: ue(t, i)
1414
1328
  };
1415
- }, Kr = (t) => ts(t, "Run command"), Xr = (t) => ts(t, "Shell"), Gr = (t) => {
1416
- const e = qe(t), n = Mt(t), o = I(e?.pattern) ?? void 0, s = ke(t, o, "Search files"), r = n ? [{
1329
+ }, pr = (t) => An(t, "Run command"), mr = (t) => An(t, "Shell"), hr = (t) => {
1330
+ const e = ye(t), n = et(t), s = I(e?.pattern) ?? void 0, o = ce(t, s, "Search files"), r = n ? [{
1417
1331
  type: "code",
1418
1332
  language: "text",
1419
1333
  code: n
1420
1334
  }] : [];
1421
1335
  return {
1422
- indicator: Ce(t),
1423
- title: s,
1424
- blocks: Ie(t, r)
1336
+ indicator: ae(t),
1337
+ title: o,
1338
+ blocks: ue(t, r)
1425
1339
  };
1426
- }, Yr = (t) => {
1427
- const e = qe(t), n = Mt(t), o = I(e?.pattern) ?? void 0, s = ke(t, o, "Find files"), r = [];
1340
+ }, gr = (t) => {
1341
+ const e = ye(t), n = et(t), s = I(e?.pattern) ?? void 0, o = ce(t, s, "Find files"), r = [];
1428
1342
  if (n) {
1429
1343
  const i = n.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0);
1430
1344
  i.length > 0 && r.push({
@@ -1433,63 +1347,63 @@ const _r = {
1433
1347
  });
1434
1348
  }
1435
1349
  return {
1436
- indicator: Ce(t),
1437
- title: s,
1438
- blocks: Ie(t, r)
1350
+ indicator: ae(t),
1351
+ title: o,
1352
+ blocks: ue(t, r)
1439
1353
  };
1440
- }, Jr = (t) => {
1441
- const e = Mt(t), n = e ? zr(e) : null, o = Qr(t) ?? n?.skillName, s = ke(t, o, "Load skill"), r = n?.content ?? e, i = r ? [{
1354
+ }, br = (t) => {
1355
+ const e = et(t), n = e ? or(e) : null, s = rr(t) ?? n?.skillName, o = ce(t, s, "Load skill"), r = n?.content ?? e, i = r ? [{
1442
1356
  type: "code",
1443
1357
  language: "markdown",
1444
1358
  code: r
1445
1359
  }] : [];
1446
1360
  return {
1447
- indicator: Ce(t),
1448
- title: s,
1449
- blocks: Ie(t, i)
1361
+ indicator: ae(t),
1362
+ title: o,
1363
+ blocks: ue(t, i)
1450
1364
  };
1451
- }, jt = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, ns = (t) => !t || typeof t != "object" || Array.isArray(t) ? null : t, Zr = (t) => {
1452
- const e = ns(t);
1365
+ }, ht = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, kn = (t) => !t || typeof t != "object" || Array.isArray(t) ? null : t, yr = (t) => {
1366
+ const e = kn(t);
1453
1367
  if (!e) return null;
1454
- const n = jt(e.content) ?? jt(e.title);
1368
+ const n = ht(e.content) ?? ht(e.title);
1455
1369
  if (!n) return null;
1456
- const o = jt(e.status);
1370
+ const s = ht(e.status);
1457
1371
  return {
1458
1372
  label: n,
1459
- checked: o === "completed"
1373
+ checked: s === "completed"
1460
1374
  };
1461
- }, Sn = (t) => {
1375
+ }, qt = (t) => {
1462
1376
  if (!t) return {
1463
1377
  items: [],
1464
1378
  explicit: !1
1465
1379
  };
1466
1380
  const e = (() => {
1467
1381
  if (Array.isArray(t)) return t;
1468
- const n = ns(t);
1382
+ const n = kn(t);
1469
1383
  return !n || !Array.isArray(n.todos) ? null : n.todos;
1470
1384
  })();
1471
1385
  return e ? {
1472
- items: e.map(Zr).filter((n) => n !== null),
1386
+ items: e.map(yr).filter((n) => n !== null),
1473
1387
  explicit: !0
1474
1388
  } : {
1475
1389
  items: [],
1476
1390
  explicit: !1
1477
1391
  };
1478
- }, ei = (t) => {
1392
+ }, xr = (t) => {
1479
1393
  const {
1480
1394
  buildBaseTitle: e,
1481
1395
  buildIndicator: n,
1482
- prependErrorBlock: o
1396
+ prependErrorBlock: s
1483
1397
  } = t;
1484
- return (s) => {
1485
- const r = Sn(s.state?.input), i = Sn(s.state?.output), l = i.explicit ? i : r;
1398
+ return (o) => {
1399
+ const r = qt(o.state?.input), i = qt(o.state?.output), l = i.explicit ? i : r;
1486
1400
  if (!l.explicit) return null;
1487
- const a = l.items, u = `${a.length} item${a.length === 1 ? "" : "s"}`, d = e(s, u, "Update todos");
1401
+ const a = l.items, u = `${a.length} item${a.length === 1 ? "" : "s"}`, d = e(o, u, "Update todos");
1488
1402
  if (a.length === 0)
1489
1403
  return {
1490
- indicator: n(s),
1404
+ indicator: n(o),
1491
1405
  title: d,
1492
- blocks: o(s, [{
1406
+ blocks: s(o, [{
1493
1407
  type: "comment",
1494
1408
  text: "No todos"
1495
1409
  }])
@@ -1499,45 +1413,45 @@ const _r = {
1499
1413
  items: a
1500
1414
  }];
1501
1415
  return {
1502
- indicator: n(s),
1416
+ indicator: n(o),
1503
1417
  title: d,
1504
- blocks: o(s, f)
1418
+ blocks: s(o, f)
1505
1419
  };
1506
1420
  };
1507
- }, ti = Ur({
1508
- buildBaseTitle: ke,
1509
- buildIndicator: Ce,
1510
- prependErrorBlock: Ie
1511
- }), wn = ei({
1512
- buildBaseTitle: ke,
1513
- buildIndicator: Ce,
1514
- prependErrorBlock: Ie
1515
- }), Tn = () => ({
1516
- apply_patch: Hr,
1517
- bash: Kr,
1518
- edit: Nr,
1519
- glob: Yr,
1520
- grep: Gr,
1521
- question: ti,
1522
- read: jr,
1523
- shell: Xr,
1524
- skill: Jr,
1525
- todo_write: wn,
1526
- todowrite: wn
1527
- }), An = {
1421
+ }, Sr = dr({
1422
+ buildBaseTitle: ce,
1423
+ buildIndicator: ae,
1424
+ prependErrorBlock: ue
1425
+ }), Wt = xr({
1426
+ buildBaseTitle: ce,
1427
+ buildIndicator: ae,
1428
+ prependErrorBlock: ue
1429
+ }), Ht = () => ({
1430
+ apply_patch: ar,
1431
+ bash: pr,
1432
+ edit: ur,
1433
+ glob: gr,
1434
+ grep: hr,
1435
+ question: Sr,
1436
+ read: fr,
1437
+ shell: mr,
1438
+ skill: br,
1439
+ todo_write: Wt,
1440
+ todowrite: Wt
1441
+ }), Vt = {
1528
1442
  error: "failed",
1529
1443
  "output-error": "failed",
1530
1444
  "input-streaming": "running"
1531
- }, ni = (t) => t.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), ss = (t) => {
1532
- const e = vt(t ?? "tool").replace(/_/g, " ");
1533
- return ni(e);
1534
- }, os = (t) => t === "error" || t === "output-error", si = (t) => os(t.state?.status) ? {
1445
+ }, wr = (t) => t.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), Cn = (t) => {
1446
+ const e = Je(t ?? "tool").replace(/_/g, " ");
1447
+ return wr(e);
1448
+ }, In = (t) => t === "error" || t === "output-error", Tr = (t) => In(t.state?.status) ? {
1535
1449
  type: "icon",
1536
1450
  icon: "danger"
1537
1451
  } : {
1538
1452
  type: "icon",
1539
- icon: Un(t.tool ?? "tool")
1540
- }, oi = (t) => !t || typeof t != "string" ? null : An[t] ? An[t] : t.includes("stream") ? "running" : null, ri = (t) => {
1453
+ icon: mn(t.tool ?? "tool")
1454
+ }, Ar = (t) => !t || typeof t != "string" ? null : Vt[t] ? Vt[t] : t.includes("stream") ? "running" : null, kr = (t) => {
1541
1455
  if (typeof t == "string") return t;
1542
1456
  if (t == null) return null;
1543
1457
  try {
@@ -1545,31 +1459,31 @@ const _r = {
1545
1459
  } catch {
1546
1460
  return null;
1547
1461
  }
1548
- }, Jt = (t) => t == null ? !0 : typeof t == "string" ? t.trim().length === 0 : Array.isArray(t) ? t.length === 0 || t.every(Jt) : typeof t == "object" ? Object.values(t).every(Jt) : !1, Pt = (t) => !t || typeof t != "object" || Array.isArray(t) ? null : t, V = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, ii = (t) => V(t.mime_type) ?? V(t.mediaType) ?? V(t.mimeType), Cn = (t) => !!t?.startsWith("image/"), li = /\.(avif|bmp|gif|jpe?g|png|svg|webp)(\?.*)?$/i, rs = (t, e) => {
1549
- const n = Pt(t);
1462
+ }, St = (t) => t == null ? !0 : typeof t == "string" ? t.trim().length === 0 : Array.isArray(t) ? t.length === 0 || t.every(St) : typeof t == "object" ? Object.values(t).every(St) : !1, tt = (t) => !t || typeof t != "object" || Array.isArray(t) ? null : t, N = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, Cr = (t) => N(t.mime_type) ?? N(t.mediaType) ?? N(t.mimeType), Nt = (t) => !!t?.startsWith("image/"), Ir = /\.(avif|bmp|gif|jpe?g|png|svg|webp)(\?.*)?$/i, _n = (t, e) => {
1463
+ const n = tt(t);
1550
1464
  if (!n) return null;
1551
- const o = ii(n), s = V(n.data);
1552
- if (s && Cn(o))
1465
+ const s = Cr(n), o = N(n.data);
1466
+ if (o && Nt(s))
1553
1467
  return {
1554
1468
  type: "image",
1555
- src: `data:${o};base64,${s}`,
1469
+ src: `data:${s};base64,${o}`,
1556
1470
  alt: e
1557
1471
  };
1558
- const r = V(n.url) ?? V(n.src);
1559
- return r && (Cn(o) || li.test(r)) ? {
1472
+ const r = N(n.url) ?? N(n.src);
1473
+ return r && (Nt(s) || Ir.test(r)) ? {
1560
1474
  type: "image",
1561
1475
  src: r,
1562
1476
  alt: e
1563
1477
  } : null;
1564
- }, is = (t) => {
1565
- const e = Pt(t);
1478
+ }, Rn = (t) => {
1479
+ const e = tt(t);
1566
1480
  if (!e) return null;
1567
- const n = V(e.path) ?? V(e.filePath) ?? V(e.filename), o = V(e.content) ?? V(e.body) ?? V(e.text);
1568
- return !n || o === null ? null : {
1481
+ const n = N(e.path) ?? N(e.filePath) ?? N(e.filename), s = N(e.content) ?? N(e.body) ?? N(e.text);
1482
+ return !n || s === null ? null : {
1569
1483
  filePath: n,
1570
- content: o
1484
+ content: s
1571
1485
  };
1572
- }, ai = {
1486
+ }, _r = {
1573
1487
  css: "css",
1574
1488
  html: "html",
1575
1489
  js: "js",
@@ -1581,88 +1495,88 @@ const _r = {
1581
1495
  tsx: "tsx",
1582
1496
  yaml: "yaml",
1583
1497
  yml: "yaml"
1584
- }, ci = (t) => {
1498
+ }, Rr = (t) => {
1585
1499
  const e = t.split(".").pop()?.toLowerCase();
1586
- return e ? ai[e] ?? e : "text";
1587
- }, kn = (t, e) => e.length === 0 ? [] : [{
1500
+ return e ? _r[e] ?? e : "text";
1501
+ }, Ut = (t, e) => e.length === 0 ? [] : [{
1588
1502
  type: "text",
1589
1503
  text: t
1590
- }, ...e], ui = (t, e) => {
1504
+ }, ...e], vr = (t, e) => {
1591
1505
  const n = [];
1592
- for (const o of t) {
1593
- const s = Pt(o), r = V(s?.type);
1506
+ for (const s of t) {
1507
+ const o = tt(s), r = N(o?.type);
1594
1508
  if (r === "image") {
1595
- const i = rs(o, e);
1509
+ const i = _n(s, e);
1596
1510
  i && n.push(i);
1597
1511
  continue;
1598
1512
  }
1599
1513
  if (r === "text") {
1600
- const i = V(s?.text);
1514
+ const i = N(o?.text);
1601
1515
  i && n.push({
1602
1516
  type: "text",
1603
1517
  text: i
1604
1518
  });
1605
1519
  continue;
1606
1520
  }
1607
- n.push(...Zt(o, e));
1521
+ n.push(...wt(s, e));
1608
1522
  }
1609
1523
  return n;
1610
- }, di = (t) => {
1611
- const e = is(t);
1524
+ }, Mr = (t) => {
1525
+ const e = Rn(t);
1612
1526
  return e ? [{
1613
1527
  type: "code",
1614
- language: ci(e.filePath),
1528
+ language: Rr(e.filePath),
1615
1529
  code: e.content
1616
1530
  }] : null;
1617
- }, fi = (t) => {
1618
- const e = Pt(t), n = V(e?.attachment_name) ?? V(e?.attachmentName), o = V(e?.attachment_file_id) ?? V(e?.attachmentFileId);
1619
- return !n && !o ? null : [{
1531
+ }, Pr = (t) => {
1532
+ const e = tt(t), n = N(e?.attachment_name) ?? N(e?.attachmentName), s = N(e?.attachment_file_id) ?? N(e?.attachmentFileId);
1533
+ return !n && !s ? null : [{
1620
1534
  type: "text",
1621
- text: n ?? `Attachment ${o}`
1535
+ text: n ?? `Attachment ${s}`
1622
1536
  }];
1623
- }, Zt = (t, e) => {
1624
- if (Jt(t)) return [];
1625
- const n = rs(t, e);
1537
+ }, wt = (t, e) => {
1538
+ if (St(t)) return [];
1539
+ const n = _n(t, e);
1626
1540
  if (n) return [n];
1627
- if (Array.isArray(t)) return ui(t, e);
1628
- const o = di(t);
1629
- if (o) return o;
1630
- const s = fi(t);
1541
+ if (Array.isArray(t)) return vr(t, e);
1542
+ const s = Mr(t);
1631
1543
  if (s) return s;
1632
- const r = ri(t);
1544
+ const o = Pr(t);
1545
+ if (o) return o;
1546
+ const r = kr(t);
1633
1547
  return r?.trim() ? [{
1634
1548
  type: "code",
1635
1549
  language: typeof t == "string" ? "text" : "json",
1636
1550
  code: r
1637
1551
  }] : [];
1638
- }, pi = (t) => {
1639
- const e = [], n = ss(t.tool);
1640
- return os(t.state?.status) && t.state?.errorText && e.push({
1552
+ }, Er = (t) => {
1553
+ const e = [], n = Cn(t.tool);
1554
+ return In(t.state?.status) && t.state?.errorText && e.push({
1641
1555
  type: "comment",
1642
1556
  text: t.state.errorText
1643
- }), e.push(...kn("Input", Zt(t.state?.input, `${n} input`))), e.push(...kn("Output", Zt(t.state?.output, `${n} output`))), e;
1644
- }, mi = (t) => {
1557
+ }), e.push(...Ut("Input", wt(t.state?.input, `${n} input`))), e.push(...Ut("Output", wt(t.state?.output, `${n} output`))), e;
1558
+ }, Dr = (t) => {
1645
1559
  const e = [{
1646
1560
  kind: "text",
1647
- text: ss(t.tool),
1561
+ text: Cn(t.tool),
1648
1562
  bold: !0
1649
- }], n = is(t.state?.output);
1563
+ }], n = Rn(t.state?.output);
1650
1564
  n && e.push({
1651
1565
  kind: "link",
1652
1566
  text: n.filePath,
1653
1567
  filePath: n.filePath
1654
1568
  });
1655
- const o = oi(t.state?.status);
1656
- return o && e.push({
1569
+ const s = Ar(t.state?.status);
1570
+ return s && e.push({
1657
1571
  kind: "text",
1658
- text: o,
1572
+ text: s,
1659
1573
  muted: !0
1660
1574
  }), {
1661
- indicator: si(t),
1575
+ indicator: Tr(t),
1662
1576
  title: e,
1663
- blocks: pi(t)
1577
+ blocks: Er(t)
1664
1578
  };
1665
- }, hi = (t) => t.kind === "text" || t.kind === "link" ? t.text.trim().length > 0 : t.kind === "diff" ? t.fileName.trim().length > 0 : !0, gi = (t) => {
1579
+ }, Br = (t) => t.kind === "text" || t.kind === "link" ? t.text.trim().length > 0 : t.kind === "diff" ? t.fileName.trim().length > 0 : !0, Fr = (t) => {
1666
1580
  switch (t.type) {
1667
1581
  case "comment":
1668
1582
  case "code":
@@ -1682,67 +1596,67 @@ const _r = {
1682
1596
  case "component":
1683
1597
  return !0;
1684
1598
  }
1685
- }, bi = (t) => {
1686
- const e = t.title.some(hi), n = (t.blocks ?? []).some(gi);
1599
+ }, Lr = (t) => {
1600
+ const e = t.title.some(Br), n = (t.blocks ?? []).some(Fr);
1687
1601
  return e || n;
1688
- }, yi = (t) => t ? {
1689
- ...Tn(),
1602
+ }, $r = (t) => t ? {
1603
+ ...Ht(),
1690
1604
  ...t
1691
- } : Tn(), xi = (t, e) => {
1605
+ } : Ht(), Or = (t, e) => {
1692
1606
  const n = t.tool ?? "tool";
1693
- for (const o of ur(n)) {
1694
- const s = e[o];
1695
- if (s) return s;
1607
+ for (const s of vo(n)) {
1608
+ const o = e[s];
1609
+ if (o) return o;
1696
1610
  }
1697
- }, Si = (t, e, n) => {
1698
- const o = xi(t, e);
1699
- if (o) {
1700
- const s = o(t, n);
1701
- if (s) return s;
1611
+ }, zr = (t, e, n) => {
1612
+ const s = Or(t, e);
1613
+ if (s) {
1614
+ const o = s(t, n);
1615
+ if (o) return o;
1702
1616
  }
1703
- return mi(t);
1704
- }, wi = (t, e) => {
1705
- const n = yi(e?.toolRenderers);
1617
+ return Dr(t);
1618
+ }, Qr = (t, e) => {
1619
+ const n = $r(e?.toolRenderers);
1706
1620
  return {
1707
- items: t.map((s) => Si(s, n, e)).filter(bi)
1621
+ items: t.map((o) => zr(o, n, e)).filter(Lr)
1708
1622
  };
1709
- }, Oe = Cs, ls = (t, e, n, o = !1) => {
1710
- o && t.stopPropagation(), e.href || t.preventDefault(), e.filePath && n?.(e.filePath);
1623
+ }, vn = (t, e, n, s = !1) => {
1624
+ s && t.stopPropagation(), e.href || t.preventDefault(), e.filePath && n?.(e.filePath);
1711
1625
  };
1712
- function Ti(t) {
1713
- const e = C(6), {
1626
+ function qr(t) {
1627
+ const e = A(6), {
1714
1628
  seg: n
1715
1629
  } = t;
1716
- let o;
1717
- e[0] !== n.alt || e[1] !== n.src ? (o = /* @__PURE__ */ c(st.Image, { src: n.src, alt: n.alt }), e[0] = n.alt, e[1] = n.src, e[2] = o) : o = e[2];
1718
1630
  let s;
1719
- e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = /* @__PURE__ */ c(st.Fallback, { background: "bg.muted", color: "fg.muted" }), e[3] = s) : s = e[3];
1631
+ e[0] !== n.alt || e[1] !== n.src ? (s = /* @__PURE__ */ c(Ee.Image, { src: n.src, alt: n.alt }), e[0] = n.alt, e[1] = n.src, e[2] = s) : s = e[2];
1632
+ let o;
1633
+ e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ c(Ee.Fallback, { background: "bg.muted", color: "fg.muted" }), e[3] = o) : o = e[3];
1720
1634
  let r;
1721
- return e[4] !== o ? (r = /* @__PURE__ */ k(st.Root, { width: "1.5rem", height: "1.5rem", children: [
1722
- o,
1723
- s
1724
- ] }), e[4] = o, e[5] = r) : r = e[5], r;
1635
+ return e[4] !== s ? (r = /* @__PURE__ */ k(Ee.Root, { width: "1.5rem", height: "1.5rem", children: [
1636
+ s,
1637
+ o
1638
+ ] }), e[4] = s, e[5] = r) : r = e[5], r;
1725
1639
  }
1726
- function Ai(t) {
1727
- const e = C(9), {
1640
+ function Wr(t) {
1641
+ const e = A(9), {
1728
1642
  seg: n,
1729
- onOpenFile: o
1730
- } = t, s = n.additions ?? 0, r = n.deletions ?? 0;
1643
+ onOpenFile: s
1644
+ } = t, o = n.additions ?? 0, r = n.deletions ?? 0;
1731
1645
  let i;
1732
- e[0] !== o || e[1] !== n.fileName || e[2] !== n.filePath ? (i = () => {
1646
+ e[0] !== s || e[1] !== n.fileName || e[2] !== n.filePath ? (i = () => {
1733
1647
  const a = n.filePath ?? n.fileName;
1734
- o?.(a);
1735
- }, e[0] = o, e[1] = n.fileName, e[2] = n.filePath, e[3] = i) : i = e[3];
1648
+ s?.(a);
1649
+ }, e[0] = s, e[1] = n.fileName, e[2] = n.filePath, e[3] = i) : i = e[3];
1736
1650
  let l;
1737
- return e[4] !== n.fileName || e[5] !== s || e[6] !== r || e[7] !== i ? (l = /* @__PURE__ */ c(ro, { fileName: n.fileName, additions: s, deletions: r, onClickFileLink: i }), e[4] = n.fileName, e[5] = s, e[6] = r, e[7] = i, e[8] = l) : l = e[8], l;
1651
+ return e[4] !== n.fileName || e[5] !== o || e[6] !== r || e[7] !== i ? (l = /* @__PURE__ */ c(Cs, { fileName: n.fileName, additions: o, deletions: r, onClickFileLink: i }), e[4] = n.fileName, e[5] = o, e[6] = r, e[7] = i, e[8] = l) : l = e[8], l;
1738
1652
  }
1739
- function Ci(t) {
1740
- const e = C(13), {
1653
+ function Hr(t) {
1654
+ const e = A(13), {
1741
1655
  seg: n,
1742
- onOpenFile: o
1743
- } = t, s = n.bold ? "medium" : void 0, r = !!(n.href || n.filePath), i = n.href ?? "#", l = (n.muted, "fg.muted"), a = r ? "pointer" : "default";
1656
+ onOpenFile: s
1657
+ } = t, o = n.bold ? "medium" : void 0, r = !!(n.href || n.filePath), i = n.href ?? "#", l = (n.muted, "fg.muted"), a = r ? "pointer" : "default";
1744
1658
  let u;
1745
- e[0] !== o || e[1] !== n ? (u = (m) => ls(m, n, o, !0), e[0] = o, e[1] = n, e[2] = u) : u = e[2];
1659
+ e[0] !== s || e[1] !== n ? (u = (m) => vn(m, n, s, !0), e[0] = s, e[1] = n, e[2] = u) : u = e[2];
1746
1660
  const d = n.muted ? "fg.muted" : "fg.blue-dark";
1747
1661
  let f;
1748
1662
  e[3] !== d ? (f = {
@@ -1750,15 +1664,15 @@ function Ci(t) {
1750
1664
  color: d
1751
1665
  }, e[3] = d, e[4] = f) : f = e[4];
1752
1666
  let p;
1753
- return e[5] !== s || e[6] !== n.text || e[7] !== i || e[8] !== l || e[9] !== a || e[10] !== u || e[11] !== f ? (p = /* @__PURE__ */ c(En, { href: i, fontWeight: s, color: l, textDecoration: "none", cursor: a, onClick: u, _hover: f, children: n.text }), e[5] = s, e[6] = n.text, e[7] = i, e[8] = l, e[9] = a, e[10] = u, e[11] = f, e[12] = p) : p = e[12], p;
1667
+ return e[5] !== o || e[6] !== n.text || e[7] !== i || e[8] !== l || e[9] !== a || e[10] !== u || e[11] !== f ? (p = /* @__PURE__ */ c(Jt, { href: i, fontWeight: o, color: l, textDecoration: "none", cursor: a, onClick: u, _hover: f, children: n.text }), e[5] = o, e[6] = n.text, e[7] = i, e[8] = l, e[9] = a, e[10] = u, e[11] = f, e[12] = p) : p = e[12], p;
1754
1668
  }
1755
- function ki(t) {
1756
- const e = C(12), {
1669
+ function Vr(t) {
1670
+ const e = A(12), {
1757
1671
  seg: n,
1758
- onOpenFile: o
1759
- } = t, s = n.bold ? "medium" : void 0, r = n.href ?? "#", i = n.muted ? "fg.muted" : "accent.primary";
1672
+ onOpenFile: s
1673
+ } = t, o = n.bold ? "medium" : void 0, r = n.href ?? "#", i = n.muted ? "fg.muted" : "accent.primary";
1760
1674
  let l;
1761
- e[0] !== o || e[1] !== n ? (l = (f) => ls(f, n, o), e[0] = o, e[1] = n, e[2] = l) : l = e[2];
1675
+ e[0] !== s || e[1] !== n ? (l = (f) => vn(f, n, s), e[0] = s, e[1] = n, e[2] = l) : l = e[2];
1762
1676
  const a = n.muted ? "fg.muted" : "accent.primary";
1763
1677
  let u;
1764
1678
  e[3] !== a ? (u = {
@@ -1766,204 +1680,205 @@ function ki(t) {
1766
1680
  textDecoration: "underline"
1767
1681
  }, e[3] = a, e[4] = u) : u = e[4];
1768
1682
  let d;
1769
- return e[5] !== s || e[6] !== n.text || e[7] !== r || e[8] !== i || e[9] !== l || e[10] !== u ? (d = /* @__PURE__ */ c(En, { href: r, fontWeight: s, color: i, textDecoration: "underline", onClick: l, _hover: u, children: n.text }), e[5] = s, e[6] = n.text, e[7] = r, e[8] = i, e[9] = l, e[10] = u, e[11] = d) : d = e[11], d;
1683
+ return e[5] !== o || e[6] !== n.text || e[7] !== r || e[8] !== i || e[9] !== l || e[10] !== u ? (d = /* @__PURE__ */ c(Jt, { href: r, fontWeight: o, color: i, textDecoration: "underline", onClick: l, _hover: u, children: n.text }), e[5] = o, e[6] = n.text, e[7] = r, e[8] = i, e[9] = l, e[10] = u, e[11] = d) : d = e[11], d;
1770
1684
  }
1771
- function Ii(t) {
1772
- const e = C(14), {
1685
+ function Nr(t) {
1686
+ const e = A(14), {
1773
1687
  seg: n,
1774
- isClickable: o
1775
- } = t, s = n.bold ? "medium" : void 0, r = n.monospace ? "mono/XS" : void 0, i = n.truncate ? "0" : void 0, l = n.truncate ? "hidden" : void 0, a = n.truncate ? "ellipsis" : void 0, u = n.truncate ? "nowrap" : void 0, d = o && !n.muted ? "fg" : "fg.muted";
1688
+ isClickable: s
1689
+ } = t, o = n.bold ? "medium" : void 0, r = n.monospace ? "mono/XS" : void 0, i = n.truncate ? "0" : void 0, l = n.truncate ? "hidden" : void 0, a = n.truncate ? "ellipsis" : void 0, u = n.truncate ? "nowrap" : void 0, d = s && !n.muted ? "fg" : "fg.muted";
1776
1690
  let f;
1777
1691
  e[0] !== d ? (f = {
1778
1692
  color: d
1779
1693
  }, e[0] = d, e[1] = f) : f = e[1];
1780
1694
  let p;
1781
- e[2] !== n.text || e[3] !== s || e[4] !== r || e[5] !== i || e[6] !== l || e[7] !== a || e[8] !== u || e[9] !== f ? (p = /* @__PURE__ */ c(dt, { fontWeight: s, textStyle: r, color: "fg.muted", minW: i, overflow: l, textOverflow: a, whiteSpace: u, _groupHover: f, children: n.text }), e[2] = n.text, e[3] = s, e[4] = r, e[5] = i, e[6] = l, e[7] = a, e[8] = u, e[9] = f, e[10] = p) : p = e[10];
1695
+ e[2] !== n.text || e[3] !== o || e[4] !== r || e[5] !== i || e[6] !== l || e[7] !== a || e[8] !== u || e[9] !== f ? (p = /* @__PURE__ */ c($e, { fontWeight: o, textStyle: r, color: "fg.muted", minW: i, overflow: l, textOverflow: a, whiteSpace: u, _groupHover: f, children: n.text }), e[2] = n.text, e[3] = o, e[4] = r, e[5] = i, e[6] = l, e[7] = a, e[8] = u, e[9] = f, e[10] = p) : p = e[10];
1782
1696
  const m = p;
1783
1697
  if (!n.truncate)
1784
1698
  return m;
1785
1699
  let h;
1786
- return e[11] !== n.text || e[12] !== m ? (h = /* @__PURE__ */ c(sn, { content: n.text, children: m }), e[11] = n.text, e[12] = m, e[13] = h) : h = e[13], h;
1700
+ return e[11] !== n.text || e[12] !== m ? (h = /* @__PURE__ */ c(Ct, { content: n.text, children: m }), e[11] = n.text, e[12] = m, e[13] = h) : h = e[13], h;
1787
1701
  }
1788
- function _i(t) {
1789
- const e = C(11), {
1702
+ function Ur(t) {
1703
+ const e = A(11), {
1790
1704
  seg: n,
1791
- isClickable: o,
1792
- onOpenFile: s
1705
+ isClickable: s,
1706
+ onOpenFile: o
1793
1707
  } = t;
1794
1708
  switch (n.kind) {
1795
1709
  case "avatar": {
1796
1710
  let r;
1797
- return e[0] !== n ? (r = /* @__PURE__ */ c(Ti, { seg: n }), e[0] = n, e[1] = r) : r = e[1], r;
1711
+ return e[0] !== n ? (r = /* @__PURE__ */ c(qr, { seg: n }), e[0] = n, e[1] = r) : r = e[1], r;
1798
1712
  }
1799
1713
  case "diff": {
1800
1714
  let r;
1801
- return e[2] !== s || e[3] !== n ? (r = /* @__PURE__ */ c(Ai, { seg: n, onOpenFile: s }), e[2] = s, e[3] = n, e[4] = r) : r = e[4], r;
1715
+ return e[2] !== o || e[3] !== n ? (r = /* @__PURE__ */ c(Wr, { seg: n, onOpenFile: o }), e[2] = o, e[3] = n, e[4] = r) : r = e[4], r;
1802
1716
  }
1803
1717
  case "link": {
1804
1718
  let r;
1805
- return e[5] !== s || e[6] !== n ? (r = n.variant === "bubble" ? /* @__PURE__ */ c(Ci, { seg: n, onOpenFile: s }) : /* @__PURE__ */ c(ki, { seg: n, onOpenFile: s }), e[5] = s, e[6] = n, e[7] = r) : r = e[7], r;
1719
+ return e[5] !== o || e[6] !== n ? (r = n.variant === "bubble" ? /* @__PURE__ */ c(Hr, { seg: n, onOpenFile: o }) : /* @__PURE__ */ c(Vr, { seg: n, onOpenFile: o }), e[5] = o, e[6] = n, e[7] = r) : r = e[7], r;
1806
1720
  }
1807
1721
  case "text": {
1808
1722
  let r;
1809
- return e[8] !== o || e[9] !== n ? (r = /* @__PURE__ */ c(Ii, { seg: n, isClickable: o }), e[8] = o, e[9] = n, e[10] = r) : r = e[10], r;
1723
+ return e[8] !== s || e[9] !== n ? (r = /* @__PURE__ */ c(Nr, { seg: n, isClickable: s }), e[8] = s, e[9] = n, e[10] = r) : r = e[10], r;
1810
1724
  }
1811
1725
  default:
1812
1726
  return null;
1813
1727
  }
1814
1728
  }
1815
- function vi(t) {
1816
- const e = C(10), {
1729
+ const he = Nn;
1730
+ function jr(t) {
1731
+ const e = A(10), {
1817
1732
  ind: n
1818
1733
  } = t;
1819
1734
  if (!n || n.type === "none")
1820
1735
  return null;
1821
1736
  if (n.type === "icon") {
1822
1737
  let i;
1823
- e[0] !== n.icon ? (i = pr(n.icon), e[0] = n.icon, e[1] = i) : i = e[1];
1738
+ e[0] !== n.icon ? (i = Eo(n.icon), e[0] = n.icon, e[1] = i) : i = e[1];
1824
1739
  const l = i;
1825
1740
  let a;
1826
- return e[2] !== l ? (a = /* @__PURE__ */ c(Oe.Indicator, { outline: "none", border: "none", background: "bg", color: "fg", children: /* @__PURE__ */ c(dt, { display: "inline-flex", alignItems: "center", children: /* @__PURE__ */ c(l, { size: 14, strokeWidth: 1 }) }) }), e[2] = l, e[3] = a) : a = e[3], a;
1741
+ return e[2] !== l ? (a = /* @__PURE__ */ c(he.Indicator, { outline: "none", border: "none", background: "bg", color: "fg", children: /* @__PURE__ */ c($e, { display: "inline-flex", alignItems: "center", children: /* @__PURE__ */ c(l, { size: 14, strokeWidth: 1 }) }) }), e[2] = l, e[3] = a) : a = e[3], a;
1827
1742
  }
1828
- let o;
1829
- e[4] !== n.alt || e[5] !== n.src ? (o = /* @__PURE__ */ c(st.Image, { src: n.src, alt: n.alt }), e[4] = n.alt, e[5] = n.src, e[6] = o) : o = e[6];
1830
1743
  let s;
1831
- e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = /* @__PURE__ */ c(st.Fallback, { background: "bg.muted", color: "fg.muted" }), e[7] = s) : s = e[7];
1744
+ e[4] !== n.alt || e[5] !== n.src ? (s = /* @__PURE__ */ c(Ee.Image, { src: n.src, alt: n.alt }), e[4] = n.alt, e[5] = n.src, e[6] = s) : s = e[6];
1745
+ let o;
1746
+ e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ c(Ee.Fallback, { background: "bg.muted", color: "fg.muted" }), e[7] = o) : o = e[7];
1832
1747
  let r;
1833
- return e[8] !== o ? (r = /* @__PURE__ */ c(Oe.Indicator, { children: /* @__PURE__ */ k(st.Root, { boxSize: "full", children: [
1834
- o,
1835
- s
1836
- ] }) }), e[8] = o, e[9] = r) : r = e[9], r;
1748
+ return e[8] !== s ? (r = /* @__PURE__ */ c(he.Indicator, { children: /* @__PURE__ */ k(Ee.Root, { boxSize: "full", children: [
1749
+ s,
1750
+ o
1751
+ ] }) }), e[8] = s, e[9] = r) : r = e[9], r;
1837
1752
  }
1838
- function Ri(t) {
1839
- const e = C(5), {
1753
+ function Kr(t) {
1754
+ const e = A(5), {
1840
1755
  code: n,
1841
- language: o
1842
- } = t, s = o ? `${o} code block` : "code block";
1756
+ language: s
1757
+ } = t, o = s ? `${s} code block` : "code block";
1843
1758
  let r;
1844
- e[0] !== n ? (r = /* @__PURE__ */ c(B, { as: "code", children: n }), e[0] = n, e[1] = r) : r = e[1];
1759
+ e[0] !== n ? (r = /* @__PURE__ */ c(P, { as: "code", children: n }), e[0] = n, e[1] = r) : r = e[1];
1845
1760
  let i;
1846
- return e[2] !== s || e[3] !== r ? (i = /* @__PURE__ */ c(_t, { background: "bg.code", color: "fg.muted", borderWidth: "1px", borderColor: "border.subtle", borderRadius: "md", showHorizontalScrollbar: !0, showVerticalScrollbar: !1, children: /* @__PURE__ */ c(B, { as: "pre", padding: "sm", textStyle: "mono/XS", whiteSpace: "pre", "aria-label": s, children: r }) }), e[2] = s, e[3] = r, e[4] = i) : i = e[4], i;
1761
+ return e[2] !== o || e[3] !== r ? (i = /* @__PURE__ */ c(Ye, { background: "bg.code", color: "fg.muted", borderWidth: "1px", borderColor: "border.subtle", borderRadius: "md", showHorizontalScrollbar: !0, showVerticalScrollbar: !1, children: /* @__PURE__ */ c(P, { as: "pre", padding: "sm", textStyle: "mono/XS", whiteSpace: "pre", "aria-label": o, children: r }) }), e[2] = o, e[3] = r, e[4] = i) : i = e[4], i;
1847
1762
  }
1848
- function Mi(t) {
1849
- const e = C(38), {
1763
+ function Xr(t) {
1764
+ const e = A(38), {
1850
1765
  b: n,
1851
- onOpenFile: o
1766
+ onOpenFile: s
1852
1767
  } = t;
1853
1768
  switch (n.type) {
1854
1769
  case "comment": {
1855
- let s;
1856
- e[0] !== n.text ? (s = /* @__PURE__ */ c(ie.Body, { children: n.text }), e[0] = n.text, e[1] = s) : s = e[1];
1770
+ let o;
1771
+ e[0] !== n.text ? (o = /* @__PURE__ */ c(Y.Body, { children: n.text }), e[0] = n.text, e[1] = o) : o = e[1];
1857
1772
  let r;
1858
- e[2] !== n.reactions ? (r = n.reactions?.clap ? /* @__PURE__ */ c(ie.Footer, { children: /* @__PURE__ */ k(ft, { children: [
1773
+ e[2] !== n.reactions ? (r = n.reactions?.clap ? /* @__PURE__ */ c(Y.Footer, { children: /* @__PURE__ */ k(Oe, { children: [
1859
1774
  "👏 ",
1860
1775
  n.reactions.clap
1861
1776
  ] }) }) : null, e[2] = n.reactions, e[3] = r) : r = e[3];
1862
1777
  let i;
1863
- return e[4] !== s || e[5] !== r ? (i = /* @__PURE__ */ k(ie.Root, { children: [
1864
- s,
1778
+ return e[4] !== o || e[5] !== r ? (i = /* @__PURE__ */ k(Y.Root, { children: [
1779
+ o,
1865
1780
  r
1866
- ] }), e[4] = s, e[5] = r, e[6] = i) : i = e[6], i;
1781
+ ] }), e[4] = o, e[5] = r, e[6] = i) : i = e[6], i;
1867
1782
  }
1868
1783
  case "code": {
1869
- let s;
1870
- return e[7] !== n.code || e[8] !== n.language ? (s = /* @__PURE__ */ c(ie.Root, { border: "0", padding: "0", children: /* @__PURE__ */ c(ie.Body, { padding: "0", children: /* @__PURE__ */ c(Ri, { language: n.language, code: n.code }) }) }), e[7] = n.code, e[8] = n.language, e[9] = s) : s = e[9], s;
1784
+ let o;
1785
+ return e[7] !== n.code || e[8] !== n.language ? (o = /* @__PURE__ */ c(Y.Root, { border: "0", padding: "0", children: /* @__PURE__ */ c(Y.Body, { padding: "0", children: /* @__PURE__ */ c(Kr, { language: n.language, code: n.code }) }) }), e[7] = n.code, e[8] = n.language, e[9] = o) : o = e[9], o;
1871
1786
  }
1872
1787
  case "diff": {
1873
- const s = n.sideBySide ?? !1;
1788
+ const o = n.sideBySide ?? !1;
1874
1789
  let r;
1875
- return e[10] !== n.language || e[11] !== n.modified || e[12] !== n.original || e[13] !== s ? (r = /* @__PURE__ */ c(ie.Root, { border: "0", padding: "0", children: /* @__PURE__ */ c(ie.Body, { padding: "0", children: /* @__PURE__ */ c(B, { height: "240px", minW: "320px", overflow: "hidden", children: /* @__PURE__ */ c(oo, { original: n.original, modified: n.modified, language: n.language, sideBySide: s, disableScroll: !0 }) }) }) }), e[10] = n.language, e[11] = n.modified, e[12] = n.original, e[13] = s, e[14] = r) : r = e[14], r;
1790
+ return e[10] !== n.language || e[11] !== n.modified || e[12] !== n.original || e[13] !== o ? (r = /* @__PURE__ */ c(Y.Root, { border: "0", padding: "0", children: /* @__PURE__ */ c(Y.Body, { padding: "0", children: /* @__PURE__ */ c(P, { height: "240px", minW: "320px", overflow: "hidden", children: /* @__PURE__ */ c(Is, { original: n.original, modified: n.modified, language: n.language, sideBySide: o, disableScroll: !0 }) }) }) }), e[10] = n.language, e[11] = n.modified, e[12] = n.original, e[13] = o, e[14] = r) : r = e[14], r;
1876
1791
  }
1877
1792
  case "text": {
1878
- let s;
1879
- return e[15] !== n.text ? (s = /* @__PURE__ */ c(ie.Root, { background: "transparent", children: /* @__PURE__ */ c(ie.Body, { padding: "sm", children: /* @__PURE__ */ c(U, { textStyle: "label/S/regular", children: n.text }) }) }), e[15] = n.text, e[16] = s) : s = e[16], s;
1793
+ let o;
1794
+ return e[15] !== n.text ? (o = /* @__PURE__ */ c(Y.Root, { background: "transparent", children: /* @__PURE__ */ c(Y.Body, { padding: "sm", children: /* @__PURE__ */ c(U, { textStyle: "label/S/regular", children: n.text }) }) }), e[15] = n.text, e[16] = o) : o = e[16], o;
1880
1795
  }
1881
1796
  case "todo-list": {
1882
- let s;
1883
- return e[17] !== n.items ? (s = /* @__PURE__ */ c(Po, { items: n.items }), e[17] = n.items, e[18] = s) : s = e[18], s;
1797
+ let o;
1798
+ return e[17] !== n.items ? (o = /* @__PURE__ */ c(Ys, { items: n.items }), e[17] = n.items, e[18] = o) : o = e[18], o;
1884
1799
  }
1885
1800
  case "question-form": {
1886
- let s;
1887
- return e[19] !== n.questions ? (s = /* @__PURE__ */ c(Wn, { questions: n.questions }), e[19] = n.questions, e[20] = s) : s = e[20], s;
1801
+ let o;
1802
+ return e[19] !== n.questions ? (o = /* @__PURE__ */ c(un, { questions: n.questions }), e[19] = n.questions, e[20] = o) : o = e[20], o;
1888
1803
  }
1889
1804
  case "references": {
1890
- let s;
1891
- e[21] !== n.references ? (s = n.references.map(Pi), e[21] = n.references, e[22] = s) : s = e[22];
1805
+ let o;
1806
+ e[21] !== n.references ? (o = n.references.map(Gr), e[21] = n.references, e[22] = o) : o = e[22];
1892
1807
  let r;
1893
- return e[23] !== s ? (r = /* @__PURE__ */ c(G, { mt: "xs", gap: "xs", flexDir: "row", flexWrap: "wrap", children: s }), e[23] = s, e[24] = r) : r = e[24], r;
1808
+ return e[23] !== o ? (r = /* @__PURE__ */ c(j, { mt: "xs", gap: "xs", flexDir: "row", flexWrap: "wrap", children: o }), e[23] = o, e[24] = r) : r = e[24], r;
1894
1809
  }
1895
1810
  case "image": {
1896
1811
  if (!n.src.trim())
1897
1812
  return null;
1898
- let s;
1899
- e[25] !== n.alt || e[26] !== n.src ? (s = /* @__PURE__ */ c(Pn, { src: n.src, alt: n.alt, maxH: "18rem", maxW: "full", objectFit: "contain", borderRadius: "sm", borderWidth: "1px", borderColor: "border.subtle" }), e[25] = n.alt, e[26] = n.src, e[27] = s) : s = e[27];
1813
+ let o;
1814
+ e[25] !== n.alt || e[26] !== n.src ? (o = /* @__PURE__ */ c(Zt, { src: n.src, alt: n.alt, maxH: "18rem", maxW: "full", objectFit: "contain", borderRadius: "sm", borderWidth: "1px", borderColor: "border.subtle" }), e[25] = n.alt, e[26] = n.src, e[27] = o) : o = e[27];
1900
1815
  let r;
1901
1816
  e[28] !== n.caption ? (r = n.caption ? /* @__PURE__ */ c(U, { mt: "2xs", textStyle: "label/XS/regular", color: "fg.muted", children: n.caption }) : null, e[28] = n.caption, e[29] = r) : r = e[29];
1902
1817
  let i;
1903
- return e[30] !== s || e[31] !== r ? (i = /* @__PURE__ */ c(ie.Root, { border: "0", padding: "0", background: "transparent", children: /* @__PURE__ */ k(ie.Body, { padding: "0", children: [
1904
- s,
1818
+ return e[30] !== o || e[31] !== r ? (i = /* @__PURE__ */ c(Y.Root, { border: "0", padding: "0", background: "transparent", children: /* @__PURE__ */ k(Y.Body, { padding: "0", children: [
1819
+ o,
1905
1820
  r
1906
- ] }) }), e[30] = s, e[31] = r, e[32] = i) : i = e[32], i;
1821
+ ] }) }), e[30] = o, e[31] = r, e[32] = i) : i = e[32], i;
1907
1822
  }
1908
1823
  case "component": {
1909
- let s;
1910
- e[33] !== n || e[34] !== o ? (s = n.render({
1911
- onOpenFile: o
1912
- }), e[33] = n, e[34] = o, e[35] = s) : s = e[35];
1824
+ let o;
1825
+ e[33] !== n || e[34] !== s ? (o = n.render({
1826
+ onOpenFile: s
1827
+ }), e[33] = n, e[34] = s, e[35] = o) : o = e[35];
1913
1828
  let r;
1914
- return e[36] !== s ? (r = /* @__PURE__ */ c(tn, { children: s }), e[36] = s, e[37] = r) : r = e[37], r;
1829
+ return e[36] !== o ? (r = /* @__PURE__ */ c(At, { children: o }), e[36] = o, e[37] = r) : r = e[37], r;
1915
1830
  }
1916
1831
  }
1917
1832
  }
1918
- function Pi(t) {
1919
- return /* @__PURE__ */ c(on, { fileName: t }, t);
1833
+ function Gr(t) {
1834
+ return /* @__PURE__ */ c(It, { fileName: t }, t);
1920
1835
  }
1921
- function Ei(t) {
1922
- const e = C(23), {
1836
+ function Yr(t) {
1837
+ const e = A(23), {
1923
1838
  item: n,
1924
- itemKey: o,
1925
- isOpen: s,
1839
+ itemKey: s,
1840
+ isOpen: o,
1926
1841
  canExpand: r,
1927
1842
  hasBlocks: i,
1928
1843
  onToggle: l,
1929
1844
  onOpenFile: a
1930
1845
  } = t;
1931
1846
  let u;
1932
- e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ c(Oe.Separator, {}), e[0] = u) : u = e[0];
1847
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ c(he.Separator, {}), e[0] = u) : u = e[0];
1933
1848
  let d;
1934
- e[1] !== n.indicator ? (d = /* @__PURE__ */ k(Oe.Connector, { children: [
1849
+ e[1] !== n.indicator ? (d = /* @__PURE__ */ k(he.Connector, { children: [
1935
1850
  u,
1936
- /* @__PURE__ */ c(vi, { ind: n.indicator })
1851
+ /* @__PURE__ */ c(jr, { ind: n.indicator })
1937
1852
  ] }), e[1] = n.indicator, e[2] = d) : d = e[2];
1938
- const f = s ? "auto" : "20px";
1853
+ const f = o ? "auto" : "20px";
1939
1854
  let p;
1940
- e[3] !== r || e[4] !== s || e[5] !== n.title || e[6] !== o || e[7] !== a || e[8] !== l ? (p = n.title.length > 0 && /* @__PURE__ */ c(Oe.Title, { className: "group", fontWeight: "normal", display: "flex", alignItems: "center", minW: "0", width: "full", overflow: "hidden", cursor: r ? "pointer" : "default", onClick: r ? () => l(o) : void 0, children: /* @__PURE__ */ k(dt, { display: "flex", alignItems: "center", gap: "sm", flexWrap: "nowrap", minW: "0", width: "full", children: [
1941
- /* @__PURE__ */ c(dt, { display: "flex", alignItems: "center", gap: "xs", flexWrap: "nowrap", minW: "0", flex: "1", overflow: "hidden", children: n.title.map((y, x) => /* @__PURE__ */ c(_i, { seg: y, isClickable: r, onOpenFile: a }, x)) }),
1942
- r ? /* @__PURE__ */ c(dt, { display: "inline-flex", alignItems: "center", transition: "transform 200ms ease, color 200ms ease", transform: s ? "rotate(0deg)" : "rotate(-180deg)", color: "transparent", flexShrink: "0", _groupHover: {
1855
+ e[3] !== r || e[4] !== o || e[5] !== n.title || e[6] !== s || e[7] !== a || e[8] !== l ? (p = n.title.length > 0 && /* @__PURE__ */ c(he.Title, { className: "group", fontWeight: "normal", display: "flex", alignItems: "center", minW: "0", width: "full", overflow: "hidden", cursor: r ? "pointer" : "default", onClick: r ? () => l(s) : void 0, children: /* @__PURE__ */ k($e, { display: "flex", alignItems: "center", gap: "sm", flexWrap: "nowrap", minW: "0", width: "full", children: [
1856
+ /* @__PURE__ */ c($e, { display: "flex", alignItems: "center", gap: "xs", flexWrap: "nowrap", minW: "0", flex: "1", overflow: "hidden", children: n.title.map((b, x) => /* @__PURE__ */ c(Ur, { seg: b, isClickable: r, onOpenFile: a }, x)) }),
1857
+ r ? /* @__PURE__ */ c($e, { display: "inline-flex", alignItems: "center", transition: "transform 200ms ease, color 200ms ease", transform: o ? "rotate(0deg)" : "rotate(-180deg)", color: "transparent", flexShrink: "0", _groupHover: {
1943
1858
  color: "fg"
1944
- }, children: /* @__PURE__ */ c(Us, { size: 12 }) }) : null
1945
- ] }) }), e[3] = r, e[4] = s, e[5] = n.title, e[6] = o, e[7] = a, e[8] = l, e[9] = p) : p = e[9];
1859
+ }, children: /* @__PURE__ */ c(ps, { size: 12 }) }) : null
1860
+ ] }) }), e[3] = r, e[4] = o, e[5] = n.title, e[6] = s, e[7] = a, e[8] = l, e[9] = p) : p = e[9];
1946
1861
  let m;
1947
- e[10] !== i || e[11] !== s || e[12] !== n.blocks || e[13] !== a ? (m = i ? /* @__PURE__ */ c(B, { display: "grid", gridTemplateRows: s ? "1fr" : "0fr", transition: "grid-template-rows 220ms ease", children: s ? /* @__PURE__ */ c(B, { overflow: "hidden", opacity: 1, transform: "translateY(0)", transition: "opacity 200ms ease, transform 200ms ease", children: n.blocks.map((y, x) => /* @__PURE__ */ c(B, { children: /* @__PURE__ */ c(Mi, { b: y, onOpenFile: a }) }, x)) }) : null }) : null, e[10] = i, e[11] = s, e[12] = n.blocks, e[13] = a, e[14] = m) : m = e[14];
1862
+ e[10] !== i || e[11] !== o || e[12] !== n.blocks || e[13] !== a ? (m = i ? /* @__PURE__ */ c(P, { display: "grid", gridTemplateRows: o ? "1fr" : "0fr", transition: "grid-template-rows 220ms ease", children: o ? /* @__PURE__ */ c(P, { overflow: "hidden", opacity: 1, transform: "translateY(0)", transition: "opacity 200ms ease, transform 200ms ease", children: n.blocks.map((b, x) => /* @__PURE__ */ c(P, { children: /* @__PURE__ */ c(Xr, { b, onOpenFile: a }) }, x)) }) : null }) : null, e[10] = i, e[11] = o, e[12] = n.blocks, e[13] = a, e[14] = m) : m = e[14];
1948
1863
  let h;
1949
- e[15] !== f || e[16] !== p || e[17] !== m ? (h = /* @__PURE__ */ k(Oe.Content, { h: f, children: [
1864
+ e[15] !== f || e[16] !== p || e[17] !== m ? (h = /* @__PURE__ */ k(he.Content, { h: f, children: [
1950
1865
  p,
1951
1866
  m
1952
1867
  ] }), e[15] = f, e[16] = p, e[17] = m, e[18] = h) : h = e[18];
1953
1868
  let g;
1954
- return e[19] !== o || e[20] !== d || e[21] !== h ? (g = /* @__PURE__ */ k(Oe.Item, { gap: "xs", children: [
1869
+ return e[19] !== s || e[20] !== d || e[21] !== h ? (g = /* @__PURE__ */ k(he.Item, { gap: "xs", children: [
1955
1870
  d,
1956
1871
  h
1957
- ] }, o), e[19] = o, e[20] = d, e[21] = h, e[22] = g) : g = e[22], g;
1872
+ ] }, s), e[19] = s, e[20] = d, e[21] = h, e[22] = g) : g = e[22], g;
1958
1873
  }
1959
- function Di(t) {
1960
- const e = C(11), {
1874
+ function Jr(t) {
1875
+ const e = A(11), {
1961
1876
  data: n,
1962
- onOpenFile: o
1877
+ onOpenFile: s
1963
1878
  } = t;
1964
- let s;
1965
- e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = {}, e[0] = s) : s = e[0];
1966
- const [r, i] = H(s), l = Bi;
1879
+ let o;
1880
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = {}, e[0] = o) : o = e[0];
1881
+ const [r, i] = V(o), l = Zr;
1967
1882
  let a;
1968
1883
  e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (a = (p) => {
1969
1884
  i((m) => ({
@@ -1973,63 +1888,63 @@ function Di(t) {
1973
1888
  }, e[1] = a) : a = e[1];
1974
1889
  const u = a;
1975
1890
  let d;
1976
- if (e[2] !== n.items || e[3] !== r || e[4] !== o) {
1891
+ if (e[2] !== n.items || e[3] !== r || e[4] !== s) {
1977
1892
  let p;
1978
- e[6] !== r || e[7] !== o ? (p = (m, h) => {
1979
- const g = l(m, h), y = (m.blocks?.length ?? 0) > 0, x = (m.expandable ?? !0) && y, b = x ? r[g] ?? !1 : y;
1980
- return /* @__PURE__ */ c(Ei, { item: m, itemKey: g, isOpen: b, canExpand: x, hasBlocks: y, onToggle: u, onOpenFile: o }, g);
1981
- }, e[6] = r, e[7] = o, e[8] = p) : p = e[8], d = n.items.map(p), e[2] = n.items, e[3] = r, e[4] = o, e[5] = d;
1893
+ e[6] !== r || e[7] !== s ? (p = (m, h) => {
1894
+ const g = l(m, h), b = (m.blocks?.length ?? 0) > 0, x = (m.expandable ?? !0) && b, y = x ? r[g] ?? !1 : b;
1895
+ return /* @__PURE__ */ c(Yr, { item: m, itemKey: g, isOpen: y, canExpand: x, hasBlocks: b, onToggle: u, onOpenFile: s }, g);
1896
+ }, e[6] = r, e[7] = s, e[8] = p) : p = e[8], d = n.items.map(p), e[2] = n.items, e[3] = r, e[4] = s, e[5] = d;
1982
1897
  } else
1983
1898
  d = e[5];
1984
1899
  let f;
1985
- return e[9] !== d ? (f = /* @__PURE__ */ c(Oe.Root, { children: d }), e[9] = d, e[10] = f) : f = e[10], f;
1900
+ return e[9] !== d ? (f = /* @__PURE__ */ c(he.Root, { children: d }), e[9] = d, e[10] = f) : f = e[10], f;
1986
1901
  }
1987
- function Bi(t, e) {
1902
+ function Zr(t, e) {
1988
1903
  return t.id ? `id:${t.id}` : `idx:${e}`;
1989
1904
  }
1990
- const Fi = (t) => vt(t.tool ?? "").replace(/_/g, "") === "question", Li = (t) => {
1905
+ const ei = (t) => Je(t.tool ?? "").replace(/_/g, "") === "question", ti = (t) => {
1991
1906
  const e = t.state?.output;
1992
1907
  return typeof e == "string" ? e.trim().length > 0 : Array.isArray(e) ? e.length > 0 : e && typeof e == "object" ? Object.keys(e).length > 0 : e != null;
1993
1908
  };
1994
- function $i(t) {
1995
- const e = C(8), {
1909
+ function ni(t) {
1910
+ const e = A(8), {
1996
1911
  invocations: n,
1997
- labeledBlocks: o,
1998
- hideQuestionForms: s,
1912
+ labeledBlocks: s,
1913
+ hideQuestionForms: o,
1999
1914
  onOpenFile: r
2000
- } = t, i = s === void 0 ? !1 : s;
1915
+ } = t, i = o === void 0 ? !1 : o;
2001
1916
  let l, a;
2002
- if (e[0] !== i || e[1] !== n || e[2] !== o) {
1917
+ if (e[0] !== i || e[1] !== n || e[2] !== s) {
2003
1918
  a = /* @__PURE__ */ Symbol.for("react.early_return_sentinel");
2004
1919
  e: {
2005
- const f = i ? n.filter(Oi) : n;
1920
+ const f = i ? n.filter(si) : n;
2006
1921
  if (f.length === 0) {
2007
1922
  a = null;
2008
1923
  break e;
2009
1924
  }
2010
- l = wi(f, {
2011
- labeledBlocks: o
1925
+ l = Qr(f, {
1926
+ labeledBlocks: s
2012
1927
  });
2013
1928
  }
2014
- e[0] = i, e[1] = n, e[2] = o, e[3] = l, e[4] = a;
1929
+ e[0] = i, e[1] = n, e[2] = s, e[3] = l, e[4] = a;
2015
1930
  } else
2016
1931
  l = e[3], a = e[4];
2017
1932
  if (a !== /* @__PURE__ */ Symbol.for("react.early_return_sentinel"))
2018
1933
  return a;
2019
1934
  const u = l;
2020
1935
  let d;
2021
- return e[5] !== u || e[6] !== r ? (d = /* @__PURE__ */ c(Di, { data: u, onOpenFile: r }), e[5] = u, e[6] = r, e[7] = d) : d = e[7], d;
1936
+ return e[5] !== u || e[6] !== r ? (d = /* @__PURE__ */ c(Jr, { data: u, onOpenFile: r }), e[5] = u, e[6] = r, e[7] = d) : d = e[7], d;
2022
1937
  }
2023
- function Oi(t) {
2024
- return !Fi(t) || Li(t);
1938
+ function si(t) {
1939
+ return !ei(t) || ti(t);
2025
1940
  }
2026
- const zi = (t) => t.type === "tool", dn = (t) => t.filename ?? t.url.split("/").pop() ?? "attachment", Qi = /\.(avif|bmp|gif|jpe?g|png|svg|webp)$/i, qi = (t) => t.mediaType?.startsWith("image/") || Qi.test(dn(t)), Wi = (t) => qi(t) ? /* @__PURE__ */ c(Pn, { src: t.url, alt: `${dn(t)} preview thumbnail`, boxSize: "18px", borderRadius: "xs", objectFit: "cover" }) : void 0, Hi = (t, e) => {
1941
+ const oi = (t) => t.type === "tool", Et = (t) => t.filename ?? t.url.split("/").pop() ?? "attachment", ri = /\.(avif|bmp|gif|jpe?g|png|svg|webp)$/i, ii = (t) => t.mediaType?.startsWith("image/") || ri.test(Et(t)), li = (t) => ii(t) ? /* @__PURE__ */ c(Zt, { src: t.url, alt: `${Et(t)} preview thumbnail`, boxSize: "18px", borderRadius: "xs", objectFit: "cover" }) : void 0, ai = (t, e) => {
2027
1942
  if (e) {
2028
1943
  e(t.url);
2029
1944
  return;
2030
1945
  }
2031
1946
  typeof window < "u" && window.open(t.url, "_blank", "noopener,noreferrer");
2032
- }, Vi = (t) => {
1947
+ }, ci = (t) => {
2033
1948
  if (t.message && t.message.trim().length > 0)
2034
1949
  return t.message;
2035
1950
  const {
@@ -2045,243 +1960,243 @@ const zi = (t) => t.type === "tool", dn = (t) => t.filename ?? t.url.split("/").
2045
1960
  default:
2046
1961
  return "An error occurred.";
2047
1962
  }
2048
- }, Ni = {
1963
+ }, ui = {
2049
1964
  info: "blue",
2050
1965
  warning: "orange",
2051
1966
  error: "red",
2052
1967
  success: "green",
2053
1968
  loading: "blue"
2054
- }, Ui = (t, e) => {
1969
+ }, di = (t, e) => {
2055
1970
  const n = [];
2056
- let o = e;
2057
- for (; o < t.length; ) {
2058
- const s = t[o];
2059
- if (!zi(s)) break;
2060
- n.push(s), o += 1;
1971
+ let s = e;
1972
+ for (; s < t.length; ) {
1973
+ const o = t[s];
1974
+ if (!oi(o)) break;
1975
+ n.push(o), s += 1;
2061
1976
  }
2062
1977
  return {
2063
1978
  invocations: n,
2064
- nextIndex: o - 1
1979
+ nextIndex: s - 1
2065
1980
  };
2066
1981
  };
2067
- function as(t) {
2068
- const e = C(8), {
1982
+ function Mn(t) {
1983
+ const e = A(8), {
2069
1984
  message: n,
2070
- hideQuestionForms: o,
2071
- onOpenFile: s,
1985
+ hideQuestionForms: s,
1986
+ onOpenFile: o,
2072
1987
  toolInvocationTimeline: r
2073
- } = t, i = o === void 0 ? !1 : o, l = r ?? $i;
1988
+ } = t, i = s === void 0 ? !1 : s, l = r ?? ni;
2074
1989
  let a;
2075
1990
  e[0] !== n.parts ? (a = n.parts ?? [], e[0] = n.parts, e[1] = a) : a = e[1];
2076
1991
  const u = a;
2077
1992
  let d;
2078
- if (e[2] !== l || e[3] !== i || e[4] !== n.id || e[5] !== s || e[6] !== u) {
1993
+ if (e[2] !== l || e[3] !== i || e[4] !== n.id || e[5] !== o || e[6] !== u) {
2079
1994
  const f = [];
2080
1995
  for (let p = 0; p < u.length; p = p + 1, p) {
2081
1996
  const m = u[p], h = `${n.id}-${p}`;
2082
1997
  e: switch (m.type) {
2083
1998
  case "text": {
2084
- f.push(/* @__PURE__ */ c("div", { children: /* @__PURE__ */ c(cr, { children: m.text }) }, h));
1999
+ f.push(/* @__PURE__ */ c("div", { children: /* @__PURE__ */ c(Ro, { children: m.text }) }, h));
2085
2000
  break e;
2086
2001
  }
2087
2002
  case "reasoning": {
2088
- f.push(/* @__PURE__ */ c(B, { padding: "0", css: {
2003
+ f.push(/* @__PURE__ */ c(P, { padding: "0", css: {
2089
2004
  "& .rich-text, & .rich-text *": {
2090
2005
  color: "fg.subtle !important",
2091
2006
  fontSize: ".75rem !important",
2092
2007
  fontWeight: "normal !important"
2093
2008
  }
2094
- }, children: /* @__PURE__ */ c(On, { defaultState: m.text, fullWidth: !0 }) }, h));
2009
+ }, children: /* @__PURE__ */ c(rn, { defaultState: m.text, fullWidth: !0 }) }, h));
2095
2010
  break e;
2096
2011
  }
2097
2012
  case "tool": {
2098
2013
  const {
2099
2014
  invocations: g,
2100
- nextIndex: y
2101
- } = Ui(u, p);
2102
- p = y, f.push(/* @__PURE__ */ c(B, { width: "full", children: /* @__PURE__ */ c(l, { invocations: g, labeledBlocks: !0, hideQuestionForms: i, onOpenFile: s }) }, h));
2015
+ nextIndex: b
2016
+ } = di(u, p);
2017
+ p = b, f.push(/* @__PURE__ */ c(P, { width: "full", children: /* @__PURE__ */ c(l, { invocations: g, labeledBlocks: !0, hideQuestionForms: i, onOpenFile: o }) }, h));
2103
2018
  break e;
2104
2019
  }
2105
2020
  case "file": {
2106
- f.push(/* @__PURE__ */ c(B, { width: "fit-content", children: /* @__PURE__ */ c(on, { fileName: dn(m), size: "sm", tone: "neutral", icon: Wi(m), onSelect: () => Hi(m, s) }) }, h));
2021
+ f.push(/* @__PURE__ */ c(P, { width: "fit-content", children: /* @__PURE__ */ c(It, { fileName: Et(m), size: "sm", tone: "neutral", icon: li(m), onSelect: () => ai(m, o) }) }, h));
2107
2022
  break e;
2108
2023
  }
2109
2024
  case "error": {
2110
- f.push(/* @__PURE__ */ c(B, { py: "2", width: "full", children: /* @__PURE__ */ c(mn, { borderRadius: "xs", status: "error", colorPalette: "red", title: Vi(m), size: "sm" }) }, h));
2025
+ f.push(/* @__PURE__ */ c(P, { py: "2", width: "full", children: /* @__PURE__ */ c(Ft, { borderRadius: "xs", status: "error", colorPalette: "red", title: ci(m), size: "sm" }) }, h));
2111
2026
  break e;
2112
2027
  }
2113
2028
  case "token_usage":
2114
2029
  break e;
2115
2030
  case "alert": {
2116
- f.push(/* @__PURE__ */ c(B, { width: "full", children: /* @__PURE__ */ c(mn, { borderRadius: "xs", status: m.status === "loading" ? "info" : m.status, colorPalette: Ni[m.status], title: m.title, icon: m.status === "loading" ? /* @__PURE__ */ c(nn, { size: "sm" }) : void 0, size: "sm", children: m.message }) }, h));
2031
+ f.push(/* @__PURE__ */ c(P, { width: "full", children: /* @__PURE__ */ c(Ft, { borderRadius: "xs", status: m.status === "loading" ? "info" : m.status, colorPalette: ui[m.status], title: m.title, icon: m.status === "loading" ? /* @__PURE__ */ c(kt, { size: "sm" }) : void 0, size: "sm", children: m.message }) }, h));
2117
2032
  break e;
2118
2033
  }
2119
2034
  default:
2120
2035
  f.push(null);
2121
2036
  }
2122
2037
  }
2123
- d = /* @__PURE__ */ c(tn, { children: f }), e[2] = l, e[3] = i, e[4] = n.id, e[5] = s, e[6] = u, e[7] = d;
2038
+ d = /* @__PURE__ */ c(At, { children: f }), e[2] = l, e[3] = i, e[4] = n.id, e[5] = o, e[6] = u, e[7] = d;
2124
2039
  } else
2125
2040
  d = e[7];
2126
2041
  return d;
2127
2042
  }
2128
- const ji = (t) => t === "user" || t === "assistant" || t === "developer" ? t : "assistant", cs = (t) => t.text.trim().length > 0, Ki = (t) => t.title.trim().length > 0 || !!t.message?.trim(), Xi = (t) => {
2043
+ const fi = (t) => t === "user" || t === "assistant" || t === "developer" ? t : "assistant", Pn = (t) => t.text.trim().length > 0, pi = (t) => t.title.trim().length > 0 || !!t.message?.trim(), mi = (t) => {
2129
2044
  switch (t.type) {
2130
2045
  case "text":
2131
2046
  case "reasoning":
2132
- return cs(t);
2047
+ return Pn(t);
2133
2048
  case "tool":
2134
2049
  case "file":
2135
2050
  case "error":
2136
2051
  return !0;
2137
2052
  case "alert":
2138
- return Ki(t);
2053
+ return pi(t);
2139
2054
  default:
2140
2055
  return !1;
2141
2056
  }
2142
- }, Gi = (t) => t.type === "reasoning" || t.type === "tool", Yi = (t) => t.role === "user" || t.parts.length === 0 ? !1 : t.parts.every(Gi), Ji = (t) => {
2057
+ }, hi = (t) => t.type === "reasoning" || t.type === "tool", gi = (t) => t.role === "user" || t.parts.length === 0 ? !1 : t.parts.every(hi), bi = (t) => {
2143
2058
  if (t.length === 0) return null;
2144
2059
  const [e, ...n] = t;
2145
2060
  return e ? {
2146
2061
  ...e,
2147
2062
  role: "assistant",
2148
- parts: t.flatMap((o) => o.parts),
2063
+ parts: t.flatMap((s) => s.parts),
2149
2064
  modelId: n.at(-1)?.modelId ?? e.modelId,
2150
2065
  providerId: n.at(-1)?.providerId ?? e.providerId
2151
2066
  } : null;
2152
- }, Zi = (t, e = {}) => {
2067
+ }, yi = (t, e = {}) => {
2153
2068
  const n = [];
2154
- let o = [];
2155
- const s = () => {
2156
- o = [];
2069
+ let s = [];
2070
+ const o = () => {
2071
+ s = [];
2157
2072
  };
2158
2073
  for (const r of t) {
2159
- const i = (r.parts ?? []).filter(Xi);
2074
+ const i = (r.parts ?? []).filter(mi);
2160
2075
  if (i.length === 0) continue;
2161
2076
  const l = {
2162
2077
  ...r,
2163
2078
  parts: i
2164
2079
  };
2165
2080
  if (l.role === "user") {
2166
- s(), n.push(l);
2081
+ o(), n.push(l);
2167
2082
  continue;
2168
2083
  }
2169
- if (Yi(l)) {
2170
- o.push(l);
2084
+ if (gi(l)) {
2085
+ s.push(l);
2171
2086
  continue;
2172
2087
  }
2173
- if (o.length > 0) {
2088
+ if (s.length > 0) {
2174
2089
  n.push({
2175
2090
  ...l,
2176
- parts: [...o.flatMap((a) => a.parts), ...l.parts]
2177
- }), s();
2091
+ parts: [...s.flatMap((a) => a.parts), ...l.parts]
2092
+ }), o();
2178
2093
  continue;
2179
2094
  }
2180
2095
  n.push(l);
2181
2096
  }
2182
- if (e.streaming && o.length > 0) {
2183
- const r = Ji(o);
2097
+ if (e.streaming && s.length > 0) {
2098
+ const r = bi(s);
2184
2099
  r && n.push(r);
2185
2100
  }
2186
2101
  return n;
2187
- }, us = (t) => {
2102
+ }, En = (t) => {
2188
2103
  const e = t.at(-1);
2189
- return e?.role !== "assistant" ? null : e.parts.some((o) => o.type === "text" && cs(o)) ? e.id : null;
2190
- }, el = (t) => {
2104
+ return e?.role !== "assistant" ? null : e.parts.some((s) => s.type === "text" && Pn(s)) ? e.id : null;
2105
+ }, xi = (t) => {
2191
2106
  const e = [], n = [];
2192
- for (const o of t)
2193
- o.role === "user" ? e.push({
2194
- userMessage: o,
2107
+ for (const s of t)
2108
+ s.role === "user" ? e.push({
2109
+ userMessage: s,
2195
2110
  responses: []
2196
- }) : e.length > 0 ? e[e.length - 1].responses.push(o) : n.push(o);
2111
+ }) : e.length > 0 ? e[e.length - 1].responses.push(s) : n.push(s);
2197
2112
  return {
2198
2113
  groups: e,
2199
2114
  leadingResponses: n
2200
2115
  };
2201
- }, ds = (t) => {
2202
- const e = C(18), {
2116
+ }, Dn = (t) => {
2117
+ const e = A(18), {
2203
2118
  message: n,
2204
- streaming: o,
2205
- hideQuestionForms: s,
2119
+ streaming: s,
2120
+ hideQuestionForms: o,
2206
2121
  animate: r,
2207
2122
  showAssistantActions: i
2208
- } = t, l = s === void 0 ? !1 : s, a = r === void 0 ? !1 : r;
2123
+ } = t, l = o === void 0 ? !1 : o, a = r === void 0 ? !1 : r;
2209
2124
  let u;
2210
- e[0] !== n.role ? (u = ji(n.role), e[0] = n.role, e[1] = u) : u = e[1];
2211
- const d = u, f = d === "user" || d === "assistant" && i, p = a ? Vn : void 0;
2125
+ e[0] !== n.role ? (u = fi(n.role), e[0] = n.role, e[1] = u) : u = e[1];
2126
+ const d = u, f = d === "user" || d === "assistant" && i, p = a ? fn : void 0;
2212
2127
  let m;
2213
- e[2] !== l || e[3] !== n || e[4] !== o ? (m = /* @__PURE__ */ c(as, { message: n, streaming: o, hideQuestionForms: l }), e[2] = l, e[3] = n, e[4] = o, e[5] = m) : m = e[5];
2128
+ e[2] !== l || e[3] !== n || e[4] !== s ? (m = /* @__PURE__ */ c(Mn, { message: n, streaming: s, hideQuestionForms: l }), e[2] = l, e[3] = n, e[4] = s, e[5] = m) : m = e[5];
2214
2129
  let h;
2215
- e[6] !== d || e[7] !== n || e[8] !== f ? (h = f ? /* @__PURE__ */ c(Yt, { message: n, alwaysVisible: d === "user", copyAlwaysVisible: d !== "user" }) : null, e[6] = d, e[7] = n, e[8] = f, e[9] = h) : h = e[9];
2130
+ e[6] !== d || e[7] !== n || e[8] !== f ? (h = f ? /* @__PURE__ */ c(xt, { message: n, alwaysVisible: d === "user", copyAlwaysVisible: d !== "user" }) : null, e[6] = d, e[7] = n, e[8] = f, e[9] = h) : h = e[9];
2216
2131
  let g;
2217
- e[10] !== d || e[11] !== m || e[12] !== h ? (g = /* @__PURE__ */ k(ze.Content, { from: d, children: [
2132
+ e[10] !== d || e[11] !== m || e[12] !== h ? (g = /* @__PURE__ */ k(ge.Content, { from: d, children: [
2218
2133
  m,
2219
2134
  h
2220
2135
  ] }), e[10] = d, e[11] = m, e[12] = h, e[13] = g) : g = e[13];
2221
- let y;
2222
- return e[14] !== d || e[15] !== p || e[16] !== g ? (y = /* @__PURE__ */ c(ze.Root, { from: d, ...p, children: g }), e[14] = d, e[15] = p, e[16] = g, e[17] = y) : y = e[17], y;
2223
- }, tl = (t) => {
2224
- const e = C(7), {
2136
+ let b;
2137
+ return e[14] !== d || e[15] !== p || e[16] !== g ? (b = /* @__PURE__ */ c(ge.Root, { from: d, ...p, children: g }), e[14] = d, e[15] = p, e[16] = g, e[17] = b) : b = e[17], b;
2138
+ }, Si = (t) => {
2139
+ const e = A(7), {
2225
2140
  label: n,
2226
- onClick: o,
2227
- actionPanel: s
2228
- } = t, r = s ? "space-between" : "flex-end";
2141
+ onClick: s,
2142
+ actionPanel: o
2143
+ } = t, r = o ? "space-between" : "flex-end";
2229
2144
  let i;
2230
- e[0] !== n || e[1] !== o ? (i = /* @__PURE__ */ c(ft, { size: "2xs", variant: "outline", pointerEvents: "auto", onClick: o, children: n }), e[0] = n, e[1] = o, e[2] = i) : i = e[2];
2145
+ e[0] !== n || e[1] !== s ? (i = /* @__PURE__ */ c(Oe, { size: "2xs", variant: "outline", pointerEvents: "auto", onClick: s, children: n }), e[0] = n, e[1] = s, e[2] = i) : i = e[2];
2231
2146
  let l;
2232
- return e[3] !== s || e[4] !== r || e[5] !== i ? (l = /* @__PURE__ */ k(Qe, { position: "absolute", bottom: "0", left: "0", right: "0", justifyContent: r, alignItems: "flex-end", px: "xs", pb: "xs", pt: "lg", bgGradient: "to-t", gradientFrom: "bg.subtle", gradientTo: "transparent", borderBottomRadius: "xs", pointerEvents: "none", children: [
2233
- s,
2147
+ return e[3] !== o || e[4] !== r || e[5] !== i ? (l = /* @__PURE__ */ k(be, { position: "absolute", bottom: "0", left: "0", right: "0", justifyContent: r, alignItems: "flex-end", px: "xs", pb: "xs", pt: "lg", bgGradient: "to-t", gradientFrom: "bg.subtle", gradientTo: "transparent", borderBottomRadius: "xs", pointerEvents: "none", children: [
2148
+ o,
2234
2149
  i
2235
- ] }), e[3] = s, e[4] = r, e[5] = i, e[6] = l) : l = e[6], l;
2236
- }, nl = 360, sl = 4, ol = "min(10vh, 4rem)", fs = "min(70dvh, calc(100dvh - 12rem), 22rem)", Kt = 1, rl = (t) => t.parts.reduce((e, n) => n.type !== "text" ? e : {
2150
+ ] }), e[3] = o, e[4] = r, e[5] = i, e[6] = l) : l = e[6], l;
2151
+ }, wi = 360, Ti = 4, Ai = "min(10vh, 4rem)", Bn = "min(70dvh, calc(100dvh - 12rem), 22rem)", gt = 1, ki = (t) => t.parts.reduce((e, n) => n.type !== "text" ? e : {
2237
2152
  lineCount: e.lineCount + n.text.split(/\r\n|\r|\n/).length,
2238
2153
  textLength: e.textLength + n.text.length
2239
2154
  }, {
2240
2155
  lineCount: 0,
2241
2156
  textLength: 0
2242
- }), il = (t) => {
2157
+ }), Ci = (t) => {
2243
2158
  if (t.role !== "user") return !1;
2244
2159
  const {
2245
2160
  lineCount: e,
2246
2161
  textLength: n
2247
- } = rl(t);
2248
- return n > nl || e > sl;
2249
- }, ll = (t, e) => {
2162
+ } = ki(t);
2163
+ return n > wi || e > Ti;
2164
+ }, Ii = (t, e) => {
2250
2165
  const n = Math.max(0, t.scrollHeight - t.clientHeight);
2251
- return e === 0 || n <= Kt ? !1 : e < 0 ? t.scrollTop > Kt : t.scrollTop < n - Kt;
2252
- }, ps = 720, al = 1, cl = 3, ul = 20, In = 1, dl = 4, ms = 8, fl = (t, e) => {
2253
- const n = us(t);
2254
- return [...t.map((o) => ({
2166
+ return e === 0 || n <= gt ? !1 : e < 0 ? t.scrollTop > gt : t.scrollTop < n - gt;
2167
+ }, Fn = 720, _i = 1, Ri = 3, vi = 20, jt = 1, Mi = 4, Ln = 8, Pi = (t, e) => {
2168
+ const n = En(t);
2169
+ return [...t.map((s) => ({
2255
2170
  type: "leading-response",
2256
- key: o.id,
2257
- message: o,
2258
- showAssistantActions: o.id === n
2259
- })), ...e.map((o, s) => ({
2171
+ key: s.id,
2172
+ message: s,
2173
+ showAssistantActions: s.id === n
2174
+ })), ...e.map((s, o) => ({
2260
2175
  type: "group",
2261
- key: o.userMessage.id,
2262
- group: o,
2263
- groupIndex: s
2176
+ key: s.userMessage.id,
2177
+ group: s,
2178
+ groupIndex: o
2264
2179
  }))];
2265
- }, pl = (t, e) => {
2180
+ }, Ei = (t, e) => {
2266
2181
  if (t === 0) return 0;
2267
- const n = t * ps + (t - 1) * ms;
2182
+ const n = t * Fn + (t - 1) * Ln;
2268
2183
  return Math.max(n - e, 0);
2269
- }, ml = (t) => t?.clientHeight || al, hl = (t, e) => Math.abs(t.scrollTop - e.scrollTop) <= In && Math.abs(t.totalSize - e.totalSize) <= In, gl = (t, e) => ({
2184
+ }, Di = (t) => t?.clientHeight || _i, Bi = (t, e) => Math.abs(t.scrollTop - e.scrollTop) <= jt && Math.abs(t.totalSize - e.totalSize) <= jt, Fi = (t, e) => ({
2270
2185
  scrollTop: t?.scrollTop ?? 0,
2271
2186
  totalSize: e
2272
- }), bl = (t) => {
2273
- const e = C(8), {
2187
+ }), Li = (t) => {
2188
+ const e = A(8), {
2274
2189
  itemCount: n,
2275
- onReady: o,
2276
- scrollRef: s,
2190
+ onReady: s,
2191
+ scrollRef: o,
2277
2192
  totalSize: r
2278
- } = t, i = Te(o);
2193
+ } = t, i = ie(s);
2279
2194
  let l, a;
2280
- e[0] !== o ? (l = () => {
2281
- i.current = o;
2282
- }, a = [o], e[0] = o, e[1] = l, e[2] = a) : (l = e[1], a = e[2]), le(l, a);
2195
+ e[0] !== s ? (l = () => {
2196
+ i.current = s;
2197
+ }, a = [s], e[0] = s, e[1] = l, e[2] = a) : (l = e[1], a = e[2]), J(l, a);
2283
2198
  let u, d;
2284
- e[3] !== n || e[4] !== s || e[5] !== r ? (u = () => {
2199
+ e[3] !== n || e[4] !== o || e[5] !== r ? (u = () => {
2285
2200
  if (n === 0 || typeof requestAnimationFrame > "u") {
2286
2201
  i.current?.();
2287
2202
  return;
@@ -2289,127 +2204,127 @@ const ji = (t) => t === "user" || t === "assistant" || t === "developer" ? t : "
2289
2204
  let f = 0, p = 0, m = 0, h = null;
2290
2205
  const g = () => {
2291
2206
  p = p + 1;
2292
- const y = gl(s.current, r);
2293
- if (m = h && hl(y, h) ? m + 1 : 0, h = y, m >= cl || p >= ul) {
2207
+ const b = Fi(o.current, r);
2208
+ if (m = h && Bi(b, h) ? m + 1 : 0, h = b, m >= Ri || p >= vi) {
2294
2209
  i.current?.();
2295
2210
  return;
2296
2211
  }
2297
2212
  f = requestAnimationFrame(g);
2298
2213
  };
2299
2214
  return f = requestAnimationFrame(g), () => cancelAnimationFrame(f);
2300
- }, d = [n, s, r], e[3] = n, e[4] = s, e[5] = r, e[6] = u, e[7] = d) : (u = e[6], d = e[7]), le(u, d);
2301
- }, yl = (t) => {
2302
- ll(t.currentTarget, t.deltaY) && t.stopPropagation();
2303
- }, xl = (t, e) => {
2215
+ }, d = [n, o, r], e[3] = n, e[4] = o, e[5] = r, e[6] = u, e[7] = d) : (u = e[6], d = e[7]), J(u, d);
2216
+ }, $i = (t) => {
2217
+ Ii(t.currentTarget, t.deltaY) && t.stopPropagation();
2218
+ }, Oi = (t, e) => {
2304
2219
  if (t)
2305
- return e ? fs : ol;
2306
- }, Sl = (t) => {
2220
+ return e ? Bn : Ai;
2221
+ }, zi = (t) => {
2307
2222
  if (t)
2308
- return fs;
2309
- }, wl = (t) => {
2310
- const e = C(50), {
2223
+ return Bn;
2224
+ }, Qi = (t) => {
2225
+ const e = A(50), {
2311
2226
  group: n,
2312
- streaming: o,
2313
- hideQuestionForms: s,
2227
+ streaming: s,
2228
+ hideQuestionForms: o,
2314
2229
  isExpanded: r,
2315
2230
  animate: i,
2316
2231
  onToggleStickyMessage: l
2317
2232
  } = t;
2318
2233
  let a, u, d;
2319
- e[0] !== n.userMessage || e[1] !== r ? (a = il(n.userMessage), u = a && r, d = xl(a, r), e[0] = n.userMessage, e[1] = r, e[2] = a, e[3] = u, e[4] = d) : (a = e[2], u = e[3], d = e[4]);
2234
+ e[0] !== n.userMessage || e[1] !== r ? (a = Ci(n.userMessage), u = a && r, d = Oi(a, r), e[0] = n.userMessage, e[1] = r, e[2] = a, e[3] = u, e[4] = d) : (a = e[2], u = e[3], d = e[4]);
2320
2235
  const f = d;
2321
2236
  let p;
2322
2237
  e[5] !== n.userMessage.id || e[6] !== l ? (p = () => l(n.userMessage.id), e[5] = n.userMessage.id, e[6] = l, e[7] = p) : p = e[7];
2323
2238
  const m = p;
2324
2239
  let h;
2325
- e[8] !== n.responses ? (h = us(n.responses), e[8] = n.responses, e[9] = h) : h = e[9];
2326
- const g = h, y = i ? Vn : void 0, x = a ? "0" : void 0, b = a ? "relative" : void 0, S = a ? r ? "expanded" : "collapsed" : void 0;
2327
- let w;
2328
- e[10] !== u ? (w = Sl(u), e[10] = u, e[11] = w) : w = e[11];
2329
- const T = u ? "auto" : "visible", A = a ? "xs" : void 0, _ = a ? "xs" : void 0, v = u ? "3rem" : void 0, F = u ? yl : void 0;
2330
- let M;
2331
- e[12] !== n.userMessage || e[13] !== o ? (M = /* @__PURE__ */ c(as, { message: n.userMessage, streaming: o }), e[12] = n.userMessage, e[13] = o, e[14] = M) : M = e[14];
2332
- let L;
2333
- e[15] !== _ || e[16] !== v || e[17] !== F || e[18] !== M || e[19] !== S || e[20] !== w || e[21] !== T || e[22] !== A ? (L = /* @__PURE__ */ c(B, { "data-sticky-user-message-content": S, display: "flex", flexDirection: "column", gap: "sm", maxH: w, minH: "0", overflowY: T, px: A, py: _, pb: v, onWheel: F, children: M }), e[15] = _, e[16] = v, e[17] = F, e[18] = M, e[19] = S, e[20] = w, e[21] = T, e[22] = A, e[23] = L) : L = e[23];
2334
- let P;
2335
- e[24] !== n.userMessage || e[25] !== a || e[26] !== r || e[27] !== m ? (P = a ? /* @__PURE__ */ c(tl, { label: r ? "Show less" : "Show more", onClick: m, actionPanel: /* @__PURE__ */ c(Yt, { message: n.userMessage, alwaysVisible: !0, copyAlwaysVisible: !1 }) }) : /* @__PURE__ */ c(Yt, { message: n.userMessage, alwaysVisible: !0, copyAlwaysVisible: !1 }), e[24] = n.userMessage, e[25] = a, e[26] = r, e[27] = m, e[28] = P) : P = e[28];
2240
+ e[8] !== n.responses ? (h = En(n.responses), e[8] = n.responses, e[9] = h) : h = e[9];
2241
+ const g = h, b = i ? fn : void 0, x = a ? "0" : void 0, y = a ? "relative" : void 0, T = a ? r ? "expanded" : "collapsed" : void 0;
2242
+ let S;
2243
+ e[10] !== u ? (S = zi(u), e[10] = u, e[11] = S) : S = e[11];
2244
+ const w = u ? "auto" : "visible", C = a ? "xs" : void 0, _ = a ? "xs" : void 0, R = u ? "3rem" : void 0, L = u ? $i : void 0;
2336
2245
  let E;
2337
- e[29] !== f || e[30] !== L || e[31] !== P || e[32] !== x || e[33] !== b ? (E = /* @__PURE__ */ k(ze.Content, { from: "user", maxH: f, overflow: "hidden", p: x, position: b, children: [
2338
- L,
2339
- P
2340
- ] }), e[29] = f, e[30] = L, e[31] = P, e[32] = x, e[33] = b, e[34] = E) : E = e[34];
2341
- let O;
2342
- e[35] !== E || e[36] !== y ? (O = /* @__PURE__ */ c(B, { position: "sticky", top: "0", zIndex: 1, children: /* @__PURE__ */ c(ze.Root, { from: "user", ...y, children: E }) }), e[35] = E, e[36] = y, e[37] = O) : O = e[37];
2343
- let z;
2344
- if (e[38] !== g || e[39] !== n.responses || e[40] !== s || e[41] !== o) {
2345
- let $;
2346
- e[43] !== g || e[44] !== s || e[45] !== o ? ($ = (R) => /* @__PURE__ */ c(B, { children: /* @__PURE__ */ c(ds, { message: R, streaming: o, hideQuestionForms: s, showAssistantActions: R.id === g }) }, R.id), e[43] = g, e[44] = s, e[45] = o, e[46] = $) : $ = e[46], z = n.responses.map($), e[38] = g, e[39] = n.responses, e[40] = s, e[41] = o, e[42] = z;
2347
- } else
2348
- z = e[42];
2246
+ e[12] !== n.userMessage || e[13] !== s ? (E = /* @__PURE__ */ c(Mn, { message: n.userMessage, streaming: s }), e[12] = n.userMessage, e[13] = s, e[14] = E) : E = e[14];
2247
+ let Q;
2248
+ e[15] !== _ || e[16] !== R || e[17] !== L || e[18] !== E || e[19] !== T || e[20] !== S || e[21] !== w || e[22] !== C ? (Q = /* @__PURE__ */ c(P, { "data-sticky-user-message-content": T, display: "flex", flexDirection: "column", gap: "sm", maxH: S, minH: "0", overflowY: w, px: C, py: _, pb: R, onWheel: L, children: E }), e[15] = _, e[16] = R, e[17] = L, e[18] = E, e[19] = T, e[20] = S, e[21] = w, e[22] = C, e[23] = Q) : Q = e[23];
2249
+ let M;
2250
+ e[24] !== n.userMessage || e[25] !== a || e[26] !== r || e[27] !== m ? (M = a ? /* @__PURE__ */ c(Si, { label: r ? "Show less" : "Show more", onClick: m, actionPanel: /* @__PURE__ */ c(xt, { message: n.userMessage, alwaysVisible: !0, copyAlwaysVisible: !1 }) }) : /* @__PURE__ */ c(xt, { message: n.userMessage, alwaysVisible: !0, copyAlwaysVisible: !1 }), e[24] = n.userMessage, e[25] = a, e[26] = r, e[27] = m, e[28] = M) : M = e[28];
2349
2251
  let D;
2350
- return e[47] !== O || e[48] !== z ? (D = /* @__PURE__ */ k(B, { children: [
2351
- O,
2352
- z
2353
- ] }), e[47] = O, e[48] = z, e[49] = D) : D = e[49], D;
2354
- }, Tl = (t, e) => {
2252
+ e[29] !== f || e[30] !== Q || e[31] !== M || e[32] !== x || e[33] !== y ? (D = /* @__PURE__ */ k(ge.Content, { from: "user", maxH: f, overflow: "hidden", p: x, position: y, children: [
2253
+ Q,
2254
+ M
2255
+ ] }), e[29] = f, e[30] = Q, e[31] = M, e[32] = x, e[33] = y, e[34] = D) : D = e[34];
2256
+ let B;
2257
+ e[35] !== D || e[36] !== b ? (B = /* @__PURE__ */ c(P, { position: "sticky", top: "0", zIndex: 1, children: /* @__PURE__ */ c(ge.Root, { from: "user", ...b, children: D }) }), e[35] = D, e[36] = b, e[37] = B) : B = e[37];
2258
+ let $;
2259
+ if (e[38] !== g || e[39] !== n.responses || e[40] !== o || e[41] !== s) {
2260
+ let F;
2261
+ e[43] !== g || e[44] !== o || e[45] !== s ? (F = (z) => /* @__PURE__ */ c(P, { children: /* @__PURE__ */ c(Dn, { message: z, streaming: s, hideQuestionForms: o, showAssistantActions: z.id === g }) }, z.id), e[43] = g, e[44] = o, e[45] = s, e[46] = F) : F = e[46], $ = n.responses.map(F), e[38] = g, e[39] = n.responses, e[40] = o, e[41] = s, e[42] = $;
2262
+ } else
2263
+ $ = e[42];
2264
+ let O;
2265
+ return e[47] !== B || e[48] !== $ ? (O = /* @__PURE__ */ k(P, { children: [
2266
+ B,
2267
+ $
2268
+ ] }), e[47] = B, e[48] = $, e[49] = O) : O = e[49], O;
2269
+ }, qi = (t, e) => {
2355
2270
  const {
2356
2271
  groups: n,
2357
- streaming: o,
2358
- hideActiveQuestionForms: s,
2272
+ streaming: s,
2273
+ hideActiveQuestionForms: o,
2359
2274
  expandedStickyMessageIds: r,
2360
2275
  animatedItemKeys: i,
2361
2276
  onToggleStickyMessage: l
2362
2277
  } = e;
2363
- return t.type === "leading-response" ? /* @__PURE__ */ c(ds, { message: t.message, streaming: o, hideQuestionForms: n.length > 0 || s, animate: i.has(t.key), showAssistantActions: t.showAssistantActions }) : /* @__PURE__ */ c(wl, { group: t.group, streaming: o, hideQuestionForms: t.groupIndex < n.length - 1 || s, isExpanded: r.has(t.group.userMessage.id), animate: i.has(t.key), onToggleStickyMessage: l });
2364
- }, Al = (t) => {
2278
+ return t.type === "leading-response" ? /* @__PURE__ */ c(Dn, { message: t.message, streaming: s, hideQuestionForms: n.length > 0 || o, animate: i.has(t.key), showAssistantActions: t.showAssistantActions }) : /* @__PURE__ */ c(Qi, { group: t.group, streaming: s, hideQuestionForms: t.groupIndex < n.length - 1 || o, isExpanded: r.has(t.group.userMessage.id), animate: i.has(t.key), onToggleStickyMessage: l });
2279
+ }, Wi = (t) => {
2365
2280
  const {
2366
2281
  leadingResponses: e,
2367
2282
  groups: n,
2368
- streaming: o,
2369
- hideActiveQuestionForms: s,
2283
+ streaming: s,
2284
+ hideActiveQuestionForms: o,
2370
2285
  expandedStickyMessageIds: r,
2371
2286
  onToggleStickyMessage: i,
2372
2287
  onReady: l
2373
2288
  } = t, {
2374
2289
  scrollRef: a
2375
- } = It(), u = fl(e, n), d = or(u.map((h) => h.key)), f = ml(a.current), p = so({
2290
+ } = Ge(), u = Pi(e, n), d = Ao(u.map((h) => h.key)), f = Di(a.current), p = ks({
2376
2291
  count: u.length,
2377
2292
  getScrollElement: () => a.current,
2378
- estimateSize: () => ps,
2293
+ estimateSize: () => Fn,
2379
2294
  getItemKey: (h) => u[h]?.key ?? h,
2380
- overscan: dl,
2381
- gap: ms,
2295
+ overscan: Mi,
2296
+ gap: Ln,
2382
2297
  initialRect: {
2383
2298
  width: 0,
2384
2299
  height: f
2385
2300
  },
2386
- initialOffset: () => pl(u.length, f)
2301
+ initialOffset: () => Ei(u.length, f)
2387
2302
  }), m = p.getTotalSize();
2388
- return bl({
2303
+ return Li({
2389
2304
  itemCount: u.length,
2390
2305
  onReady: l,
2391
2306
  scrollRef: a,
2392
2307
  totalSize: m
2393
- }), /* @__PURE__ */ c(B, { px: "xs", children: /* @__PURE__ */ c(B, { position: "relative", width: "100%", style: {
2308
+ }), /* @__PURE__ */ c(P, { px: "xs", children: /* @__PURE__ */ c(P, { position: "relative", width: "100%", style: {
2394
2309
  height: m
2395
2310
  }, children: p.getVirtualItems().map((h) => {
2396
2311
  const g = u[h.index];
2397
- return g ? /* @__PURE__ */ c(B, { ref: p.measureElement, "data-index": h.index, "data-chat-message-list-item": g.type, position: "absolute", top: "0", left: "0", width: "100%", style: {
2312
+ return g ? /* @__PURE__ */ c(P, { ref: p.measureElement, "data-index": h.index, "data-chat-message-list-item": g.type, position: "absolute", top: "0", left: "0", width: "100%", style: {
2398
2313
  top: h.start
2399
- }, children: Tl(g, {
2314
+ }, children: qi(g, {
2400
2315
  groups: n,
2401
- streaming: o,
2402
- hideActiveQuestionForms: s,
2316
+ streaming: s,
2317
+ hideActiveQuestionForms: o,
2403
2318
  expandedStickyMessageIds: r,
2404
2319
  animatedItemKeys: d,
2405
2320
  onToggleStickyMessage: i
2406
2321
  }) }, h.key) : null;
2407
2322
  }) }) });
2408
- }, Cl = (t) => {
2409
- const e = C(48), {
2323
+ }, Hi = (t) => {
2324
+ const e = A(48), {
2410
2325
  item: n,
2411
- index: o,
2412
- isFirst: s,
2326
+ index: s,
2327
+ isFirst: o,
2413
2328
  isLast: r,
2414
2329
  isEditing: i,
2415
2330
  isDragTarget: l,
@@ -2419,203 +2334,204 @@ const ji = (t) => t === "user" || t === "assistant" || t === "developer" ? t : "
2419
2334
  onDragEnd: f,
2420
2335
  onDragOver: p,
2421
2336
  onDrop: m
2422
- } = t, h = !!a, g = !!u, y = !s || !r, x = `Drag queued follow-up ${o + 1}`, b = s ? "0" : "1px", S = l ? "border.accent-light" : "border.subtle", w = s ? "0" : "2xs", T = i ? "bg.muted" : void 0;
2423
- let A;
2424
- e[0] !== n.id || e[1] !== p ? (A = (W) => p(W, n.id), e[0] = n.id, e[1] = p, e[2] = A) : A = e[2];
2337
+ } = t, h = !!a, g = !!u, b = !o || !r, x = `Drag queued follow-up ${s + 1}`, y = o ? "0" : "1px", T = l ? "border.accent-light" : "border.subtle", S = o ? "0" : "2xs", w = i ? "bg.muted" : void 0;
2338
+ let C;
2339
+ e[0] !== n.id || e[1] !== p ? (C = (H) => p(H, n.id), e[0] = n.id, e[1] = p, e[2] = C) : C = e[2];
2425
2340
  let _;
2426
- e[3] !== n.id || e[4] !== m ? (_ = (W) => m(W, n.id), e[3] = n.id, e[4] = m, e[5] = _) : _ = e[5];
2427
- const v = y ? "grab" : "default", F = !y;
2428
- let M;
2429
- e[6] !== n.id || e[7] !== d ? (M = (W) => {
2430
- W.dataTransfer.effectAllowed = "move", W.dataTransfer.setData("text/plain", n.id), d(n.id);
2431
- }, e[6] = n.id, e[7] = d, e[8] = M) : M = e[8];
2432
- let L;
2433
- e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (L = /* @__PURE__ */ c(Ht, { as: js, boxSize: "14px" }), e[9] = L) : L = e[9];
2434
- let P;
2435
- e[10] !== y || e[11] !== x || e[12] !== f || e[13] !== v || e[14] !== F || e[15] !== M ? (P = /* @__PURE__ */ c(nt, { size: "2xs", variant: "ghost", draggable: y, "aria-label": x, title: x, color: "fg.muted", cursor: v, disabled: F, onDragStart: M, onDragEnd: f, children: L }), e[10] = y, e[11] = x, e[12] = f, e[13] = v, e[14] = F, e[15] = M, e[16] = P) : P = e[16];
2341
+ e[3] !== n.id || e[4] !== m ? (_ = (H) => m(H, n.id), e[3] = n.id, e[4] = m, e[5] = _) : _ = e[5];
2342
+ const R = b ? "grab" : "default", L = !b;
2436
2343
  let E;
2437
- e[17] !== n.prompt ? (E = /* @__PURE__ */ c(U, { textStyle: "label/S/regular", color: "fg", lineClamp: 2, minWidth: "0", children: n.prompt }), e[17] = n.prompt, e[18] = E) : E = e[18];
2438
- let O;
2439
- e[19] !== n.attachments ? (O = n.attachments?.length ? /* @__PURE__ */ k(ks, { width: "fit-content", size: "sm", variant: "outline", colorPalette: "gray", children: [
2344
+ e[6] !== n.id || e[7] !== d ? (E = (H) => {
2345
+ H.dataTransfer.effectAllowed = "move", H.dataTransfer.setData("text/plain", n.id), d(n.id);
2346
+ }, e[6] = n.id, e[7] = d, e[8] = E) : E = e[8];
2347
+ let Q;
2348
+ e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Q = /* @__PURE__ */ c(dt, { as: ms, boxSize: "14px" }), e[9] = Q) : Q = e[9];
2349
+ let M;
2350
+ e[10] !== b || e[11] !== x || e[12] !== f || e[13] !== R || e[14] !== L || e[15] !== E ? (M = /* @__PURE__ */ c(Pe, { size: "2xs", variant: "ghost", draggable: b, "aria-label": x, title: x, color: "fg.muted", cursor: R, disabled: L, onDragStart: E, onDragEnd: f, children: Q }), e[10] = b, e[11] = x, e[12] = f, e[13] = R, e[14] = L, e[15] = E, e[16] = M) : M = e[16];
2351
+ let D;
2352
+ e[17] !== n.prompt ? (D = /* @__PURE__ */ c(U, { textStyle: "label/S/regular", color: "fg", lineClamp: 2, minWidth: "0", children: n.prompt }), e[17] = n.prompt, e[18] = D) : D = e[18];
2353
+ let B;
2354
+ e[19] !== n.attachments ? (B = n.attachments?.length ? /* @__PURE__ */ k(Un, { width: "fit-content", size: "sm", variant: "outline", colorPalette: "gray", children: [
2440
2355
  n.attachments.length,
2441
2356
  " attachments"
2442
- ] }) : null, e[19] = n.attachments, e[20] = O) : O = e[20];
2443
- let z;
2444
- e[21] !== E || e[22] !== O ? (z = /* @__PURE__ */ k(G, { gap: "2xs", flex: "1", minWidth: "0", children: [
2445
- E,
2446
- O
2447
- ] }), e[21] = E, e[22] = O, e[23] = z) : z = e[23];
2448
- let D;
2449
- e[24] !== h || e[25] !== n || e[26] !== a ? (D = h ? /* @__PURE__ */ c(nt, { size: "2xs", variant: "ghost", "aria-label": "Edit queued follow-up", onClick: () => a?.(n), children: /* @__PURE__ */ c(Ht, { as: Ks, boxSize: "14px" }) }) : null, e[24] = h, e[25] = n, e[26] = a, e[27] = D) : D = e[27];
2357
+ ] }) : null, e[19] = n.attachments, e[20] = B) : B = e[20];
2450
2358
  let $;
2451
- e[28] !== g || e[29] !== n.id || e[30] !== u ? ($ = g ? /* @__PURE__ */ c(nt, { size: "2xs", variant: "ghost", "aria-label": "Remove queued follow-up", colorPalette: "red", onClick: () => u?.(n.id), children: /* @__PURE__ */ c(Ht, { as: Bn, boxSize: "14px" }) }) : null, e[28] = g, e[29] = n.id, e[30] = u, e[31] = $) : $ = e[31];
2452
- let R;
2453
- e[32] !== D || e[33] !== $ ? (R = /* @__PURE__ */ k(ae, { gap: "2xs", flexShrink: 0, children: [
2359
+ e[21] !== D || e[22] !== B ? ($ = /* @__PURE__ */ k(j, { gap: "2xs", flex: "1", minWidth: "0", children: [
2454
2360
  D,
2455
- $
2456
- ] }), e[32] = D, e[33] = $, e[34] = R) : R = e[34];
2457
- let q;
2458
- e[35] !== P || e[36] !== z || e[37] !== R ? (q = /* @__PURE__ */ k(ae, { gap: "xs", alignItems: "flex-start", children: [
2459
- P,
2460
- z,
2461
- R
2462
- ] }), e[35] = P, e[36] = z, e[37] = R, e[38] = q) : q = e[38];
2463
- let j;
2464
- return e[39] !== n.id || e[40] !== b || e[41] !== S || e[42] !== q || e[43] !== w || e[44] !== T || e[45] !== A || e[46] !== _ ? (j = /* @__PURE__ */ c(B, { minWidth: "0", borderTopWidth: b, borderColor: S, paddingTop: w, paddingBottom: "2xs", bg: T, onDragOver: A, onDrop: _, "data-queued-follow-up-id": n.id, children: q }), e[39] = n.id, e[40] = b, e[41] = S, e[42] = q, e[43] = w, e[44] = T, e[45] = A, e[46] = _, e[47] = j) : j = e[47], j;
2465
- }, kl = (t) => {
2466
- const e = C(24), {
2361
+ B
2362
+ ] }), e[21] = D, e[22] = B, e[23] = $) : $ = e[23];
2363
+ let O;
2364
+ e[24] !== h || e[25] !== n || e[26] !== a ? (O = h ? /* @__PURE__ */ c(Pe, { size: "2xs", variant: "ghost", "aria-label": "Edit queued follow-up", onClick: () => a?.(n), children: /* @__PURE__ */ c(dt, { as: hs, boxSize: "14px" }) }) : null, e[24] = h, e[25] = n, e[26] = a, e[27] = O) : O = e[27];
2365
+ let F;
2366
+ e[28] !== g || e[29] !== n.id || e[30] !== u ? (F = g ? /* @__PURE__ */ c(Pe, { size: "2xs", variant: "ghost", "aria-label": "Remove queued follow-up", colorPalette: "red", onClick: () => u?.(n.id), children: /* @__PURE__ */ c(dt, { as: tn, boxSize: "14px" }) }) : null, e[28] = g, e[29] = n.id, e[30] = u, e[31] = F) : F = e[31];
2367
+ let z;
2368
+ e[32] !== O || e[33] !== F ? (z = /* @__PURE__ */ k(Z, { gap: "2xs", flexShrink: 0, children: [
2369
+ O,
2370
+ F
2371
+ ] }), e[32] = O, e[33] = F, e[34] = z) : z = e[34];
2372
+ let v;
2373
+ e[35] !== M || e[36] !== $ || e[37] !== z ? (v = /* @__PURE__ */ k(Z, { gap: "xs", alignItems: "flex-start", children: [
2374
+ M,
2375
+ $,
2376
+ z
2377
+ ] }), e[35] = M, e[36] = $, e[37] = z, e[38] = v) : v = e[38];
2378
+ let W;
2379
+ return e[39] !== n.id || e[40] !== y || e[41] !== T || e[42] !== v || e[43] !== S || e[44] !== w || e[45] !== C || e[46] !== _ ? (W = /* @__PURE__ */ c(P, { minWidth: "0", borderTopWidth: y, borderColor: T, paddingTop: S, paddingBottom: "2xs", bg: w, onDragOver: C, onDrop: _, "data-queued-follow-up-id": n.id, children: v }), e[39] = n.id, e[40] = y, e[41] = T, e[42] = v, e[43] = S, e[44] = w, e[45] = C, e[46] = _, e[47] = W) : W = e[47], W;
2380
+ }, Vi = (t) => {
2381
+ const e = A(24), {
2467
2382
  items: n,
2468
- editingItemId: o,
2469
- onEdit: s,
2383
+ editingItemId: s,
2384
+ onEdit: o,
2470
2385
  onRemove: r,
2471
2386
  onMove: i
2472
- } = t, [l, a] = H(null), [u, d] = H(null);
2387
+ } = t, [l, a] = V(null), [u, d] = V(null);
2473
2388
  if (n.length === 0)
2474
2389
  return null;
2475
2390
  let f;
2476
- e[0] !== l ? (f = (x, b) => {
2477
- !l || l === b || (x.preventDefault(), x.dataTransfer.dropEffect = "move", d(b));
2391
+ e[0] !== l ? (f = (x, y) => {
2392
+ !l || l === y || (x.preventDefault(), x.dataTransfer.dropEffect = "move", d(y));
2478
2393
  }, e[0] = l, e[1] = f) : f = e[1];
2479
2394
  const p = f;
2480
2395
  let m;
2481
- e[2] !== l || e[3] !== n || e[4] !== i ? (m = (x, b) => {
2396
+ e[2] !== l || e[3] !== n || e[4] !== i ? (m = (x, y) => {
2482
2397
  x.preventDefault();
2483
- const S = l ?? x.dataTransfer.getData("text/plain");
2484
- if (a(null), d(null), !S || S === b)
2398
+ const T = l ?? x.dataTransfer.getData("text/plain");
2399
+ if (a(null), d(null), !T || T === y)
2485
2400
  return;
2486
- const w = n.findIndex((_) => _.id === S), T = n.findIndex((_) => _.id === b);
2487
- if (w === -1 || T === -1 || w === T)
2401
+ const S = n.findIndex((_) => _.id === T), w = n.findIndex((_) => _.id === y);
2402
+ if (S === -1 || w === -1 || S === w)
2488
2403
  return;
2489
- const A = T < w ? "up" : "down";
2490
- i?.(S, A, Math.abs(T - w));
2404
+ const C = w < S ? "up" : "down";
2405
+ i?.(T, C, Math.abs(w - S));
2491
2406
  }, e[2] = l, e[3] = n, e[4] = i, e[5] = m) : m = e[5];
2492
2407
  const h = m;
2493
2408
  let g;
2494
- if (e[6] !== u || e[7] !== o || e[8] !== p || e[9] !== h || e[10] !== n || e[11] !== s || e[12] !== r) {
2409
+ if (e[6] !== u || e[7] !== s || e[8] !== p || e[9] !== h || e[10] !== n || e[11] !== o || e[12] !== r) {
2495
2410
  let x;
2496
- e[14] !== u || e[15] !== o || e[16] !== p || e[17] !== h || e[18] !== n.length || e[19] !== s || e[20] !== r ? (x = (b, S) => /* @__PURE__ */ c(Cl, { item: b, index: S, isFirst: S === 0, isLast: S === n.length - 1, isEditing: o === b.id, isDragTarget: u === b.id, onEdit: s, onRemove: r, onDragStart: a, onDragEnd: () => {
2411
+ e[14] !== u || e[15] !== s || e[16] !== p || e[17] !== h || e[18] !== n.length || e[19] !== o || e[20] !== r ? (x = (y, T) => /* @__PURE__ */ c(Hi, { item: y, index: T, isFirst: T === 0, isLast: T === n.length - 1, isEditing: s === y.id, isDragTarget: u === y.id, onEdit: o, onRemove: r, onDragStart: a, onDragEnd: () => {
2497
2412
  a(null), d(null);
2498
- }, onDragOver: p, onDrop: h }, b.id), e[14] = u, e[15] = o, e[16] = p, e[17] = h, e[18] = n.length, e[19] = s, e[20] = r, e[21] = x) : x = e[21], g = n.map(x), e[6] = u, e[7] = o, e[8] = p, e[9] = h, e[10] = n, e[11] = s, e[12] = r, e[13] = g;
2413
+ }, onDragOver: p, onDrop: h }, y.id), e[14] = u, e[15] = s, e[16] = p, e[17] = h, e[18] = n.length, e[19] = o, e[20] = r, e[21] = x) : x = e[21], g = n.map(x), e[6] = u, e[7] = s, e[8] = p, e[9] = h, e[10] = n, e[11] = o, e[12] = r, e[13] = g;
2499
2414
  } else
2500
2415
  g = e[13];
2501
- let y;
2502
- return e[22] !== g ? (y = /* @__PURE__ */ c(G, { gap: "2xs", paddingX: "0", paddingY: "xs", borderWidth: "1px", borderBottomWidth: "0", borderColor: "border", borderTopRadius: "xs", background: "bg", children: g }), e[22] = g, e[23] = y) : y = e[23], y;
2503
- }, Il = (t) => {
2416
+ let b;
2417
+ return e[22] !== g ? (b = /* @__PURE__ */ c(j, { gap: "2xs", paddingX: "0", paddingY: "xs", borderWidth: "1px", borderBottomWidth: "0", borderColor: "border", borderTopRadius: "xs", background: "bg", children: g }), e[22] = g, e[23] = b) : b = e[23], b;
2418
+ }, Ni = (t) => {
2504
2419
  const e = Math.max(0, Math.floor(t));
2505
2420
  if (e < 60) return `${e}s`;
2506
2421
  const n = Math.floor(e / 60);
2507
2422
  return n < 60 ? `${n}m ${String(e % 60).padStart(2, "0")}s` : `${Math.floor(n / 60)}h ${String(n % 60).padStart(2, "0")}m`;
2508
- }, _l = (t) => {
2509
- const e = C(9), {
2423
+ }, Ui = (t) => {
2424
+ const e = A(9), {
2510
2425
  hidden: n
2511
- } = t, o = n === void 0 ? !1 : n, [s, r] = H(0);
2426
+ } = t, s = n === void 0 ? !1 : n, [o, r] = V(0);
2512
2427
  let i;
2513
2428
  e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (i = Date.now(), e[0] = i) : i = e[0];
2514
- const l = Te(i);
2429
+ const l = ie(i);
2515
2430
  let a, u;
2516
- if (e[1] !== o ? (a = () => {
2517
- if (o)
2431
+ if (e[1] !== s ? (a = () => {
2432
+ if (s)
2518
2433
  return;
2519
2434
  const m = () => r((Date.now() - l.current) / 1e3);
2520
2435
  m();
2521
2436
  const h = setInterval(m, 1e3);
2522
2437
  return () => clearInterval(h);
2523
- }, u = [o], e[1] = o, e[2] = a, e[3] = u) : (a = e[2], u = e[3]), le(a, u), o)
2438
+ }, u = [s], e[1] = s, e[2] = a, e[3] = u) : (a = e[2], u = e[3]), J(a, u), s)
2524
2439
  return null;
2525
2440
  let d;
2526
- e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ c(nn, { size: "xs", color: "fg.muted" }), e[4] = d) : d = e[4];
2441
+ e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ c(kt, { size: "xs", color: "fg.muted" }), e[4] = d) : d = e[4];
2527
2442
  let f;
2528
- e[5] !== s ? (f = Il(s), e[5] = s, e[6] = f) : f = e[6];
2443
+ e[5] !== o ? (f = Ni(o), e[5] = o, e[6] = f) : f = e[6];
2529
2444
  let p;
2530
- return e[7] !== f ? (p = /* @__PURE__ */ k(ae, { gap: "2xs", px: "sm", py: "xs", children: [
2445
+ return e[7] !== f ? (p = /* @__PURE__ */ k(Z, { gap: "2xs", px: "sm", py: "xs", children: [
2531
2446
  d,
2532
2447
  /* @__PURE__ */ c(U, { fontFamily: "mono", fontSize: "xs", color: "fg.muted", letterSpacing: "-0.2px", children: f })
2533
2448
  ] }), e[7] = f, e[8] = p) : p = e[8], p;
2534
- }, vl = (t) => {
2535
- const e = C(19), {
2449
+ }, ji = (t) => {
2450
+ const e = A(19), {
2536
2451
  queuedFollowUps: n,
2537
- defaultValue: o,
2538
- onChange: s,
2452
+ defaultValue: s,
2453
+ onChange: o,
2539
2454
  onSubmit: r,
2540
2455
  onUpdate: i
2541
- } = t, [l, a] = H(null), [u, d] = H(""), [f, p] = H(0), m = l ? u : o;
2456
+ } = t, [l, a] = V(null), [u, d] = V(""), [f, p] = V(0), m = l ? u : s;
2542
2457
  let h, g;
2543
2458
  e[0] !== l || e[1] !== n ? (h = () => {
2544
- l && (n.some((v) => v.id === l) || (a(null), d("")));
2545
- }, g = [l, n], e[0] = l, e[1] = n, e[2] = h, e[3] = g) : (h = e[2], g = e[3]), le(h, g);
2546
- let y;
2547
- e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (y = (v) => {
2548
- a(v.id), d(v.prompt), p(Ml);
2549
- }, e[4] = y) : y = e[4];
2550
- const x = y;
2459
+ l && (n.some((R) => R.id === l) || (a(null), d("")));
2460
+ }, g = [l, n], e[0] = l, e[1] = n, e[2] = h, e[3] = g) : (h = e[2], g = e[3]), J(h, g);
2551
2461
  let b;
2552
- e[5] !== l || e[6] !== s ? (b = (v) => {
2553
- l || s?.(v);
2554
- }, e[5] = l, e[6] = s, e[7] = b) : b = e[7];
2555
- const S = b;
2556
- let w;
2557
- e[8] !== l || e[9] !== r || e[10] !== i ? (w = (v, F, M) => {
2462
+ e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (b = (R) => {
2463
+ a(R.id), d(R.prompt), p(Xi);
2464
+ }, e[4] = b) : b = e[4];
2465
+ const x = b;
2466
+ let y;
2467
+ e[5] !== l || e[6] !== o ? (y = (R) => {
2468
+ l || o?.(R);
2469
+ }, e[5] = l, e[6] = o, e[7] = y) : y = e[7];
2470
+ const T = y;
2471
+ let S;
2472
+ e[8] !== l || e[9] !== r || e[10] !== i ? (S = (R, L, E) => {
2558
2473
  if (l) {
2559
- i?.(l, v), a(null), d("");
2474
+ i?.(l, R), a(null), d("");
2560
2475
  return;
2561
2476
  }
2562
- r?.(v, F, M);
2563
- }, e[8] = l, e[9] = r, e[10] = i, e[11] = w) : w = e[11];
2564
- const T = w, A = !!l;
2477
+ return r?.(R, L, E);
2478
+ }, e[8] = l, e[9] = r, e[10] = i, e[11] = S) : S = e[11];
2479
+ const w = S, C = !!l;
2565
2480
  let _;
2566
- return e[12] !== S || e[13] !== l || e[14] !== f || e[15] !== m || e[16] !== T || e[17] !== A ? (_ = {
2567
- change: S,
2481
+ return e[12] !== T || e[13] !== l || e[14] !== f || e[15] !== m || e[16] !== w || e[17] !== C ? (_ = {
2482
+ change: T,
2568
2483
  edit: x,
2569
2484
  editingItemId: l,
2570
2485
  focusSignal: f,
2571
2486
  inputValue: m,
2572
- isEditing: A,
2573
- submit: T
2574
- }, e[12] = S, e[13] = l, e[14] = f, e[15] = m, e[16] = T, e[17] = A, e[18] = _) : _ = e[18], _;
2575
- }, Rl = (t) => {
2576
- const e = C(43), {
2487
+ isEditing: C,
2488
+ submit: w
2489
+ }, e[12] = T, e[13] = l, e[14] = f, e[15] = m, e[16] = w, e[17] = C, e[18] = _) : _ = e[18], _;
2490
+ }, Ki = (t) => {
2491
+ const e = A(44), {
2577
2492
  actions: n,
2578
- attachedResources: o,
2579
- attachmentList: s,
2493
+ attachedResources: s,
2494
+ attachmentList: o,
2580
2495
  chatInputAutoFocus: r,
2581
2496
  chatInputPlaceholder: i,
2582
2497
  chatInputQuestionPrompt: l,
2583
2498
  chatInputReferences: a,
2584
2499
  hasWorkspaceHub: u,
2585
2500
  inputDisabled: d,
2586
- onAttachFiles: f,
2587
- onAttachText: p,
2588
- onChatInputAddReference: m,
2589
- onClearAttachments: h,
2590
- onInterrupt: g,
2591
- onQueuedFollowUpMove: y,
2592
- onQueuedFollowUpRemove: x,
2593
- onQueuedFollowUpUpdate: b,
2501
+ submitDisabled: f,
2502
+ onAttachFiles: p,
2503
+ onAttachText: m,
2504
+ onChatInputAddReference: h,
2505
+ onClearAttachments: g,
2506
+ onInterrupt: b,
2507
+ onQueuedFollowUpMove: x,
2508
+ onQueuedFollowUpRemove: y,
2509
+ onQueuedFollowUpUpdate: T,
2594
2510
  queuedComposer: S,
2595
2511
  queuedFollowUps: w,
2596
- streaming: T,
2597
- workspaceHub: A
2598
- } = t, _ = w.length > 0, v = u ? "2xs" : "xs", F = u ? "2xs" : "0", M = u ? "2xs" : void 0, L = u ? "1px" : void 0, P = u ? "border" : void 0, E = u ? "sm" : void 0, O = u ? "bg.subtle" : void 0, z = b ? S.edit : void 0;
2599
- let D;
2600
- e[0] !== y || e[1] !== x || e[2] !== S.editingItemId || e[3] !== w || e[4] !== z ? (D = /* @__PURE__ */ c(kl, { items: w, editingItemId: S.editingItemId, onEdit: z, onRemove: x, onMove: y }), e[0] = y, e[1] = x, e[2] = S.editingItemId, e[3] = w, e[4] = z, e[5] = D) : D = e[5];
2601
- let $;
2602
- e[6] !== S.inputValue ? ($ = tr(S.inputValue), e[6] = S.inputValue, e[7] = $) : $ = e[7];
2603
- const R = S.isEditing ? "Save queued follow-up" : void 0;
2604
- let q;
2605
- e[8] !== n || e[9] !== o || e[10] !== s || e[11] !== r || e[12] !== i || e[13] !== l || e[14] !== a || e[15] !== _ || e[16] !== u || e[17] !== d || e[18] !== f || e[19] !== p || e[20] !== m || e[21] !== h || e[22] !== g || e[23] !== S.change || e[24] !== S.focusSignal || e[25] !== S.submit || e[26] !== T || e[27] !== R || e[28] !== $ ? (q = /* @__PURE__ */ c(No, { placeholder: i, defaultState: $, streaming: T, onSubmit: S.submit, onInterrupt: g, onAttachFiles: f, onAttachText: p, onChange: S.change, actions: n, attachedResources: o, onClearAttachments: h, attachmentList: s, isDisabled: d, attachedToTop: _, recessed: u, questionPrompt: l, autoFocus: r, focusSignal: S.focusSignal, submitTitle: R, references: a, onAddReference: m }), e[8] = n, e[9] = o, e[10] = s, e[11] = r, e[12] = i, e[13] = l, e[14] = a, e[15] = _, e[16] = u, e[17] = d, e[18] = f, e[19] = p, e[20] = m, e[21] = h, e[22] = g, e[23] = S.change, e[24] = S.focusSignal, e[25] = S.submit, e[26] = T, e[27] = R, e[28] = $, e[29] = q) : q = e[29];
2606
- let j;
2607
- e[30] !== F || e[31] !== q || e[32] !== M || e[33] !== L || e[34] !== P || e[35] !== E || e[36] !== O || e[37] !== D || e[38] !== A ? (j = /* @__PURE__ */ k(G, { gap: F, p: M, borderWidth: L, borderColor: P, borderRadius: E, bg: O, children: [
2608
- A,
2609
- D,
2610
- q
2611
- ] }), e[30] = F, e[31] = q, e[32] = M, e[33] = L, e[34] = P, e[35] = E, e[36] = O, e[37] = D, e[38] = A, e[39] = j) : j = e[39];
2512
+ streaming: C,
2513
+ workspaceHub: _
2514
+ } = t, R = w.length > 0, L = u ? "2xs" : "xs", E = u ? "2xs" : "0", Q = u ? "2xs" : void 0, M = u ? "1px" : void 0, D = u ? "border" : void 0, B = u ? "sm" : void 0, $ = u ? "bg.subtle" : void 0, O = T ? S.edit : void 0;
2515
+ let F;
2516
+ e[0] !== x || e[1] !== y || e[2] !== S.editingItemId || e[3] !== w || e[4] !== O ? (F = /* @__PURE__ */ c(Vi, { items: w, editingItemId: S.editingItemId, onEdit: O, onRemove: y, onMove: x }), e[0] = x, e[1] = y, e[2] = S.editingItemId, e[3] = w, e[4] = O, e[5] = F) : F = e[5];
2517
+ let z;
2518
+ e[6] !== S.inputValue ? (z = So(S.inputValue), e[6] = S.inputValue, e[7] = z) : z = e[7];
2519
+ const v = S.isEditing ? "Save queued follow-up" : void 0;
2612
2520
  let W;
2613
- return e[40] !== v || e[41] !== j ? (W = /* @__PURE__ */ c(G, { px: v, gap: "0", children: j }), e[40] = v, e[41] = j, e[42] = W) : W = e[42], W;
2614
- }, ea = (t) => {
2615
- const e = C(77), {
2521
+ e[8] !== n || e[9] !== s || e[10] !== o || e[11] !== r || e[12] !== i || e[13] !== l || e[14] !== a || e[15] !== R || e[16] !== u || e[17] !== d || e[18] !== p || e[19] !== m || e[20] !== h || e[21] !== g || e[22] !== b || e[23] !== S.change || e[24] !== S.focusSignal || e[25] !== S.submit || e[26] !== C || e[27] !== f || e[28] !== v || e[29] !== z ? (W = /* @__PURE__ */ c(po, { placeholder: i, defaultState: z, streaming: C, onSubmit: S.submit, onInterrupt: b, onAttachFiles: p, onAttachText: m, onChange: S.change, actions: n, attachedResources: s, onClearAttachments: g, attachmentList: o, isDisabled: d, submitDisabled: f, attachedToTop: R, recessed: u, questionPrompt: l, autoFocus: r, focusSignal: S.focusSignal, submitTitle: v, references: a, onAddReference: h }), e[8] = n, e[9] = s, e[10] = o, e[11] = r, e[12] = i, e[13] = l, e[14] = a, e[15] = R, e[16] = u, e[17] = d, e[18] = p, e[19] = m, e[20] = h, e[21] = g, e[22] = b, e[23] = S.change, e[24] = S.focusSignal, e[25] = S.submit, e[26] = C, e[27] = f, e[28] = v, e[29] = z, e[30] = W) : W = e[30];
2522
+ let H;
2523
+ e[31] !== E || e[32] !== W || e[33] !== Q || e[34] !== M || e[35] !== D || e[36] !== B || e[37] !== $ || e[38] !== F || e[39] !== _ ? (H = /* @__PURE__ */ k(j, { gap: E, p: Q, borderWidth: M, borderColor: D, borderRadius: B, bg: $, children: [
2524
+ _,
2525
+ F,
2526
+ W
2527
+ ] }), e[31] = E, e[32] = W, e[33] = Q, e[34] = M, e[35] = D, e[36] = B, e[37] = $, e[38] = F, e[39] = _, e[40] = H) : H = e[40];
2528
+ let K;
2529
+ return e[41] !== L || e[42] !== H ? (K = /* @__PURE__ */ c(j, { px: L, gap: "0", children: H }), e[41] = L, e[42] = H, e[43] = K) : K = e[43], K;
2530
+ }, xl = (t) => {
2531
+ const e = A(78), {
2616
2532
  conversationKey: n,
2617
- messages: o,
2618
- loading: s,
2533
+ messages: s,
2534
+ loading: o,
2619
2535
  streaming: r,
2620
2536
  emptyStateTitle: i,
2621
2537
  emptyStateDescription: l,
@@ -2627,150 +2543,151 @@ const ji = (t) => t === "user" || t === "assistant" || t === "developer" ? t : "
2627
2543
  onInterrupt: m,
2628
2544
  onAttachFiles: h,
2629
2545
  onAttachText: g,
2630
- onChatInputChange: y,
2546
+ onChatInputChange: b,
2631
2547
  actions: x,
2632
- attachedResources: b,
2633
- onClearAttachments: S,
2634
- attachmentList: w,
2635
- approvalPrompt: T,
2636
- workspaceHub: A,
2548
+ attachedResources: y,
2549
+ onClearAttachments: T,
2550
+ attachmentList: S,
2551
+ approvalPrompt: w,
2552
+ workspaceHub: C,
2637
2553
  workspaceInitializing: _,
2638
- inputDisabled: v,
2639
- chatInputQuestionPrompt: F,
2640
- chatInputAutoFocus: M,
2641
- queuedFollowUps: L,
2642
- onQueuedFollowUpUpdate: P,
2643
- onQueuedFollowUpRemove: E,
2644
- onQueuedFollowUpMove: O,
2645
- chatInputReferences: z,
2646
- onChatInputAddReference: D
2647
- } = t, $ = s === void 0 ? !1 : s, R = r === void 0 ? !1 : r, q = f === void 0 ? "" : f, j = _ === void 0 ? !1 : _, W = v === void 0 ? !1 : v, _e = M === void 0 ? !1 : M;
2648
- let ve;
2649
- e[0] !== L ? (ve = L === void 0 ? [] : L, e[0] = L, e[1] = ve) : ve = e[1];
2650
- const ue = ve;
2651
- let Re;
2652
- e[2] !== z ? (Re = z === void 0 ? [] : z, e[2] = z, e[3] = Re) : Re = e[3];
2653
- const Ne = Re;
2654
- let Y, ee, de, fe, N;
2655
- if (e[4] !== n || e[5] !== o || e[6] !== R) {
2656
- const X = Zi(o, {
2657
- streaming: R
2554
+ inputDisabled: R,
2555
+ submitDisabled: L,
2556
+ chatInputQuestionPrompt: E,
2557
+ chatInputAutoFocus: Q,
2558
+ queuedFollowUps: M,
2559
+ onQueuedFollowUpUpdate: D,
2560
+ onQueuedFollowUpRemove: B,
2561
+ onQueuedFollowUpMove: $,
2562
+ chatInputReferences: O,
2563
+ onChatInputAddReference: F
2564
+ } = t, z = o === void 0 ? !1 : o, v = r === void 0 ? !1 : r, W = f === void 0 ? "" : f, H = _ === void 0 ? !1 : _, K = R === void 0 ? !1 : R, oe = L === void 0 ? !1 : L, xe = Q === void 0 ? !1 : Q;
2565
+ let Se;
2566
+ e[0] !== M ? (Se = M === void 0 ? [] : M, e[0] = M, e[1] = Se) : Se = e[1];
2567
+ const ee = Se;
2568
+ let Te;
2569
+ e[2] !== O ? (Te = O === void 0 ? [] : O, e[2] = O, e[3] = Te) : Te = e[3];
2570
+ const Be = Te;
2571
+ let X, G, de, te, fe;
2572
+ if (e[4] !== n || e[5] !== s || e[6] !== v) {
2573
+ const me = yi(s, {
2574
+ streaming: v
2658
2575
  });
2659
- Y = X.length > 0, de = n ?? X[0]?.id, ee = Y ? de ?? "active-conversation" : null, N = X.reduce(Pl, 0), fe = el(X), e[4] = n, e[5] = o, e[6] = R, e[7] = Y, e[8] = ee, e[9] = de, e[10] = fe, e[11] = N;
2576
+ X = me.length > 0, de = n ?? me[0]?.id, G = X ? de ?? "active-conversation" : null, fe = me.reduce(Gi, 0), te = xi(me), e[4] = n, e[5] = s, e[6] = v, e[7] = X, e[8] = G, e[9] = de, e[10] = te, e[11] = fe;
2660
2577
  } else
2661
- Y = e[7], ee = e[8], de = e[9], fe = e[10], N = e[11];
2578
+ X = e[7], G = e[8], de = e[9], te = e[10], fe = e[11];
2662
2579
  const {
2663
- groups: Me,
2664
- leadingResponses: Pe
2665
- } = fe, [J, Ue] = H(El), [We, rt] = H(null), je = !Y && $;
2666
- let He;
2667
- e[12] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (He = /* @__PURE__ */ c(Xs, { size: 48, strokeWidth: 1.5 }), e[12] = He) : He = e[12];
2580
+ groups: Fe,
2581
+ leadingResponses: Ae
2582
+ } = te, [we, nt] = V(Yi), [st, q] = V(null), ne = !X && z;
2583
+ let se;
2584
+ e[12] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (se = /* @__PURE__ */ c(gs, { size: 48, strokeWidth: 1.5 }), e[12] = se) : se = e[12];
2668
2585
  let pe;
2669
- e[13] !== l || e[14] !== i ? (pe = /* @__PURE__ */ c(no, { icon: He, title: i, description: l }), e[13] = l, e[14] = i, e[15] = pe) : pe = e[15];
2670
- const Ee = je ? u : a ?? pe, De = !!A;
2671
- let me;
2672
- e[16] !== F || e[17] !== o ? (me = F ?? er(o), e[16] = F, e[17] = o, e[18] = me) : me = e[18];
2673
- const ne = me, Be = !!ne, Fe = R && Y && !j && !ne, he = !ee || We === ee;
2674
- let ge;
2675
- e[19] !== q || e[20] !== y || e[21] !== P || e[22] !== p || e[23] !== ue ? (ge = {
2676
- queuedFollowUps: ue,
2677
- defaultValue: q,
2678
- onChange: y,
2586
+ e[13] !== l || e[14] !== i ? (pe = /* @__PURE__ */ c(As, { icon: se, title: i, description: l }), e[13] = l, e[14] = i, e[15] = pe) : pe = e[15];
2587
+ const ot = ne ? u : a ?? pe, rt = !!C;
2588
+ let We;
2589
+ e[16] !== E || e[17] !== s ? (We = E ?? xo(s), e[16] = E, e[17] = s, e[18] = We) : We = e[18];
2590
+ const Le = We, it = !!Le, lt = v && X && !H && !Le, He = !G || st === G;
2591
+ let Ve;
2592
+ e[19] !== W || e[20] !== b || e[21] !== D || e[22] !== p || e[23] !== ee ? (Ve = {
2593
+ queuedFollowUps: ee,
2594
+ defaultValue: W,
2595
+ onChange: b,
2679
2596
  onSubmit: p,
2680
- onUpdate: P
2681
- }, e[19] = q, e[20] = y, e[21] = P, e[22] = p, e[23] = ue, e[24] = ge) : ge = e[24];
2682
- const Le = vl(ge);
2683
- let be;
2684
- e[25] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (be = (X) => {
2685
- Ue((Xe) => {
2686
- const $e = new Set(Xe);
2687
- return $e.has(X) ? $e.delete(X) : $e.add(X), $e;
2597
+ onUpdate: D
2598
+ }, e[19] = W, e[20] = b, e[21] = D, e[22] = p, e[23] = ee, e[24] = Ve) : Ve = e[24];
2599
+ const at = ji(Ve);
2600
+ let Ne;
2601
+ e[25] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Ne = (me) => {
2602
+ nt((On) => {
2603
+ const je = new Set(On);
2604
+ return je.has(me) ? je.delete(me) : je.add(me), je;
2688
2605
  });
2689
- }, e[25] = be) : be = e[25];
2690
- const Ke = be, lt = de ?? null;
2691
- let se;
2692
- e[26] !== lt || e[27] !== N ? (se = /* @__PURE__ */ c(Ao, { conversationKey: lt, userMessageCount: N }), e[26] = lt, e[27] = N, e[28] = se) : se = e[28];
2693
- const Ve = he ? "visible" : "hidden";
2694
- let Z;
2695
- e[29] !== Ee || e[30] !== J || e[31] !== Me || e[32] !== Y || e[33] !== Be || e[34] !== Pe || e[35] !== ee || e[36] !== R ? (Z = Y ? /* @__PURE__ */ c(Al, { leadingResponses: Pe, groups: Me, streaming: R, hideActiveQuestionForms: Be, expandedStickyMessageIds: J, onToggleStickyMessage: Ke, onReady: () => rt(ee) }, ee) : Ee, e[29] = Ee, e[30] = J, e[31] = Me, e[32] = Y, e[33] = Be, e[34] = Pe, e[35] = ee, e[36] = R, e[37] = Z) : Z = e[37];
2696
- let K;
2697
- e[38] !== Ve || e[39] !== Z ? (K = /* @__PURE__ */ c(Nt.Viewport, { visibility: Ve, children: Z }), e[38] = Ve, e[39] = Z, e[40] = K) : K = e[40];
2698
- let oe;
2699
- e[41] !== he ? (oe = he ? /* @__PURE__ */ c(Nt.ScrollToBottom, { "aria-label": "Scroll to latest message" }) : null, e[41] = he, e[42] = oe) : oe = e[42];
2700
- let te;
2701
- e[43] !== se || e[44] !== K || e[45] !== oe ? (te = /* @__PURE__ */ k(Nt.Root, { children: [
2702
- se,
2703
- K,
2704
- oe
2705
- ] }), e[43] = se, e[44] = K, e[45] = oe, e[46] = te) : te = e[46];
2706
- let re;
2707
- e[47] !== Fe || e[48] !== R ? (re = R ? /* @__PURE__ */ c(_l, { hidden: !Fe }) : null, e[47] = Fe, e[48] = R, e[49] = re) : re = e[49];
2708
- let ce;
2709
- e[50] !== x || e[51] !== ne || e[52] !== b || e[53] !== w || e[54] !== _e || e[55] !== d || e[56] !== Ne || e[57] !== De || e[58] !== W || e[59] !== h || e[60] !== g || e[61] !== D || e[62] !== S || e[63] !== m || e[64] !== O || e[65] !== E || e[66] !== P || e[67] !== Le || e[68] !== ue || e[69] !== R || e[70] !== A ? (ce = /* @__PURE__ */ c(Rl, { actions: x, attachedResources: b, attachmentList: w, chatInputAutoFocus: _e, chatInputPlaceholder: d, chatInputQuestionPrompt: ne, chatInputReferences: Ne, hasWorkspaceHub: De, inputDisabled: W, onAttachFiles: h, onAttachText: g, onChatInputAddReference: D, onClearAttachments: S, onInterrupt: m, onQueuedFollowUpMove: O, onQueuedFollowUpRemove: E, onQueuedFollowUpUpdate: P, queuedComposer: Le, queuedFollowUps: ue, streaming: R, workspaceHub: A }), e[50] = x, e[51] = ne, e[52] = b, e[53] = w, e[54] = _e, e[55] = d, e[56] = Ne, e[57] = De, e[58] = W, e[59] = h, e[60] = g, e[61] = D, e[62] = S, e[63] = m, e[64] = O, e[65] = E, e[66] = P, e[67] = Le, e[68] = ue, e[69] = R, e[70] = A, e[71] = ce) : ce = e[71];
2710
- let ye;
2711
- return e[72] !== T || e[73] !== te || e[74] !== re || e[75] !== ce ? (ye = /* @__PURE__ */ k(Qe, { position: "relative", direction: "column", w: "full", h: "full", overflow: "hidden", children: [
2712
- te,
2713
- T,
2714
- re,
2715
- ce
2716
- ] }), e[72] = T, e[73] = te, e[74] = re, e[75] = ce, e[76] = ye) : ye = e[76], ye;
2606
+ }, e[25] = Ne) : Ne = e[25];
2607
+ const $n = Ne, ct = de ?? null;
2608
+ let ke;
2609
+ e[26] !== ct || e[27] !== fe ? (ke = /* @__PURE__ */ c(Hs, { conversationKey: ct, userMessageCount: fe }), e[26] = ct, e[27] = fe, e[28] = ke) : ke = e[28];
2610
+ const ut = He ? "visible" : "hidden";
2611
+ let Ce;
2612
+ e[29] !== ot || e[30] !== we || e[31] !== Fe || e[32] !== X || e[33] !== it || e[34] !== Ae || e[35] !== G || e[36] !== v ? (Ce = X ? /* @__PURE__ */ c(Wi, { leadingResponses: Ae, groups: Fe, streaming: v, hideActiveQuestionForms: it, expandedStickyMessageIds: we, onToggleStickyMessage: $n, onReady: () => q(G) }, G) : ot, e[29] = ot, e[30] = we, e[31] = Fe, e[32] = X, e[33] = it, e[34] = Ae, e[35] = G, e[36] = v, e[37] = Ce) : Ce = e[37];
2613
+ let Ie;
2614
+ e[38] !== ut || e[39] !== Ce ? (Ie = /* @__PURE__ */ c(pt.Viewport, { visibility: ut, children: Ce }), e[38] = ut, e[39] = Ce, e[40] = Ie) : Ie = e[40];
2615
+ let _e;
2616
+ e[41] !== He ? (_e = He ? /* @__PURE__ */ c(pt.ScrollToBottom, { "aria-label": "Scroll to latest message" }) : null, e[41] = He, e[42] = _e) : _e = e[42];
2617
+ let Re;
2618
+ e[43] !== ke || e[44] !== Ie || e[45] !== _e ? (Re = /* @__PURE__ */ k(pt.Root, { children: [
2619
+ ke,
2620
+ Ie,
2621
+ _e
2622
+ ] }), e[43] = ke, e[44] = Ie, e[45] = _e, e[46] = Re) : Re = e[46];
2623
+ let ve;
2624
+ e[47] !== lt || e[48] !== v ? (ve = v ? /* @__PURE__ */ c(Ui, { hidden: !lt }) : null, e[47] = lt, e[48] = v, e[49] = ve) : ve = e[49];
2625
+ let Me;
2626
+ e[50] !== x || e[51] !== Le || e[52] !== y || e[53] !== S || e[54] !== xe || e[55] !== d || e[56] !== Be || e[57] !== rt || e[58] !== K || e[59] !== h || e[60] !== g || e[61] !== F || e[62] !== T || e[63] !== m || e[64] !== $ || e[65] !== B || e[66] !== D || e[67] !== at || e[68] !== ee || e[69] !== v || e[70] !== oe || e[71] !== C ? (Me = /* @__PURE__ */ c(Ki, { actions: x, attachedResources: y, attachmentList: S, chatInputAutoFocus: xe, chatInputPlaceholder: d, chatInputQuestionPrompt: Le, chatInputReferences: Be, hasWorkspaceHub: rt, inputDisabled: K, submitDisabled: oe, onAttachFiles: h, onAttachText: g, onChatInputAddReference: F, onClearAttachments: T, onInterrupt: m, onQueuedFollowUpMove: $, onQueuedFollowUpRemove: B, onQueuedFollowUpUpdate: D, queuedComposer: at, queuedFollowUps: ee, streaming: v, workspaceHub: C }), e[50] = x, e[51] = Le, e[52] = y, e[53] = S, e[54] = xe, e[55] = d, e[56] = Be, e[57] = rt, e[58] = K, e[59] = h, e[60] = g, e[61] = F, e[62] = T, e[63] = m, e[64] = $, e[65] = B, e[66] = D, e[67] = at, e[68] = ee, e[69] = v, e[70] = oe, e[71] = C, e[72] = Me) : Me = e[72];
2627
+ let Ue;
2628
+ return e[73] !== w || e[74] !== Re || e[75] !== ve || e[76] !== Me ? (Ue = /* @__PURE__ */ k(be, { position: "relative", direction: "column", w: "full", h: "full", overflow: "hidden", children: [
2629
+ Re,
2630
+ w,
2631
+ ve,
2632
+ Me
2633
+ ] }), e[73] = w, e[74] = Re, e[75] = ve, e[76] = Me, e[77] = Ue) : Ue = e[77], Ue;
2717
2634
  };
2718
- function Ml(t) {
2635
+ function Xi(t) {
2719
2636
  return t + 1;
2720
2637
  }
2721
- function Pl(t, e) {
2638
+ function Gi(t, e) {
2722
2639
  return t + (e.role === "user" ? 1 : 0);
2723
2640
  }
2724
- function El() {
2641
+ function Yi() {
2725
2642
  return /* @__PURE__ */ new Set();
2726
2643
  }
2727
- const _n = (t) => /* @__PURE__ */ c(G, { gap: "xs", w: "full", children: t.map((e, n) => /* @__PURE__ */ c(Is, { height: "3", width: e, borderRadius: "xs" }, `${e}-${n}`)) }), ta = () => {
2728
- const t = C(2);
2644
+ const Kt = (t) => /* @__PURE__ */ c(j, { gap: "xs", w: "full", children: t.map((e, n) => /* @__PURE__ */ c(jn, { height: "3", width: e, borderRadius: "xs" }, `${e}-${n}`)) }), Sl = () => {
2645
+ const t = A(2);
2729
2646
  let e;
2730
- t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ c(ze.Root, { from: "user", children: /* @__PURE__ */ c(ze.Content, { from: "user", children: _n(["72%", "46%"]) }) }), t[0] = e) : e = t[0];
2647
+ t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ c(ge.Root, { from: "user", children: /* @__PURE__ */ c(ge.Content, { from: "user", children: Kt(["72%", "46%"]) }) }), t[0] = e) : e = t[0];
2731
2648
  let n;
2732
- return t[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (n = /* @__PURE__ */ k(G, { minH: "full", py: "xs", gap: "0", children: [
2649
+ return t[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (n = /* @__PURE__ */ k(j, { minH: "full", py: "xs", gap: "0", children: [
2733
2650
  e,
2734
- /* @__PURE__ */ c(ze.Root, { from: "assistant", children: /* @__PURE__ */ c(ze.Content, { from: "assistant", children: _n(["76%", "62%", "40%"]) }) })
2651
+ /* @__PURE__ */ c(ge.Root, { from: "assistant", children: /* @__PURE__ */ c(ge.Content, { from: "assistant", children: Kt(["76%", "62%", "40%"]) }) })
2735
2652
  ] }), t[1] = n) : n = t[1], n;
2736
- }, Dl = 3, vn = 10, Bl = 26, en = 4, Fl = (t, e) => {
2653
+ }, Ji = 3, Xt = 10, Zi = 26, Tt = 4, el = (t, e) => {
2737
2654
  if (e === null) return 0;
2738
2655
  const n = Math.abs(t - e);
2739
- return n >= en ? 0 : (1 + Math.cos(Math.PI * n / en)) / 2;
2740
- }, Ll = (t, e) => {
2656
+ return n >= Tt ? 0 : (1 + Math.cos(Math.PI * n / Tt)) / 2;
2657
+ }, tl = (t, e) => {
2741
2658
  if (e === null) return "fg.subtle";
2742
2659
  const n = Math.abs(t - e);
2743
- return n < 0.5 ? "fg" : n < en ? "fg.muted" : "fg.subtle";
2744
- }, $l = (t) => {
2745
- const e = C(11), {
2660
+ return n < 0.5 ? "fg" : n < Tt ? "fg.muted" : "fg.subtle";
2661
+ }, nl = (t) => {
2662
+ const e = A(11), {
2746
2663
  item: n,
2747
- position: o
2748
- } = t, s = `${o.left}px`, r = `${o.top}px`;
2664
+ position: s
2665
+ } = t, o = `${s.left}px`, r = `${s.top}px`;
2749
2666
  let i;
2750
2667
  e[0] !== n.message ? (i = /* @__PURE__ */ c(U, { textStyle: "label/S/medium", color: "fg", lineClamp: 2, children: n.message }), e[0] = n.message, e[1] = i) : i = e[1];
2751
2668
  let l;
2752
2669
  e[2] !== n.reply ? (l = n.reply ? /* @__PURE__ */ c(U, { textStyle: "label/XS/regular", color: "fg.muted", lineClamp: 2, children: n.reply }) : null, e[2] = n.reply, e[3] = l) : l = e[3];
2753
2670
  let a;
2754
- e[4] !== i || e[5] !== l ? (a = /* @__PURE__ */ k(G, { gap: "1.5", p: "3", bg: "bg.elevated", borderWidth: "1px", borderColor: "border", borderRadius: "lg", children: [
2671
+ e[4] !== i || e[5] !== l ? (a = /* @__PURE__ */ k(j, { gap: "1.5", p: "3", bg: "bg.elevated", borderWidth: "1px", borderColor: "border", borderRadius: "lg", children: [
2755
2672
  i,
2756
2673
  l
2757
2674
  ] }), e[4] = i, e[5] = l, e[6] = a) : a = e[6];
2758
2675
  let u;
2759
- return e[7] !== s || e[8] !== r || e[9] !== a ? (u = /* @__PURE__ */ c(Mn, { children: /* @__PURE__ */ c(B, { position: "fixed", left: s, ml: "2xs", top: r, transform: "translateY(-50%)", w: "80", maxW: "80", zIndex: "popover", pointerEvents: "none", children: a }) }), e[7] = s, e[8] = r, e[9] = a, e[10] = u) : u = e[10], u;
2760
- }, na = (t) => {
2761
- const e = C(22), {
2676
+ return e[7] !== o || e[8] !== r || e[9] !== a ? (u = /* @__PURE__ */ c(Yt, { children: /* @__PURE__ */ c(P, { position: "fixed", left: o, ml: "2xs", top: r, transform: "translateY(-50%)", w: "80", maxW: "80", zIndex: "popover", pointerEvents: "none", children: a }) }), e[7] = o, e[8] = r, e[9] = a, e[10] = u) : u = e[10], u;
2677
+ }, wl = (t) => {
2678
+ const e = A(22), {
2762
2679
  items: n,
2763
- onSelect: o,
2764
- floating: s
2765
- } = t, r = s === void 0 ? !1 : s, [i, l] = H(null), [a, u] = H(null);
2766
- if (n.length < Dl)
2680
+ onSelect: s,
2681
+ floating: o
2682
+ } = t, r = o === void 0 ? !1 : o, [i, l] = V(null), [a, u] = V(null);
2683
+ if (n.length < Ji)
2767
2684
  return null;
2768
2685
  let d;
2769
- e[0] !== n.length ? (d = (w) => {
2770
- const T = w.currentTarget.getBoundingClientRect(), A = (w.clientY - T.top) / T.height, _ = Math.min(n.length - 1, Math.max(0, A * n.length - 0.5)), v = Math.round(_);
2686
+ e[0] !== n.length ? (d = (S) => {
2687
+ const w = S.currentTarget.getBoundingClientRect(), C = (S.clientY - w.top) / w.height, _ = Math.min(n.length - 1, Math.max(0, C * n.length - 0.5)), R = Math.round(_);
2771
2688
  l(_), u({
2772
- left: T.right,
2773
- top: T.top + (v + 0.5) / n.length * T.height
2689
+ left: w.right,
2690
+ top: w.top + (R + 0.5) / n.length * w.height
2774
2691
  });
2775
2692
  }, e[0] = n.length, e[1] = d) : d = e[1];
2776
2693
  const f = d, p = i === null ? null : Math.round(i), m = p === null ? null : n[p];
@@ -2784,101 +2701,101 @@ const _n = (t) => /* @__PURE__ */ c(G, { gap: "xs", w: "full", children: t.map((
2784
2701
  bottom: 0,
2785
2702
  bg: "bg"
2786
2703
  } : {}, e[3] = r, e[4] = g) : g = e[4];
2787
- let y;
2788
- if (e[5] !== n || e[6] !== o || e[7] !== i) {
2789
- let w;
2790
- e[9] !== o || e[10] !== i ? (w = (T, A) => /* @__PURE__ */ c(Rn.button, { type: "button", h: "2px", w: `${vn + (Bl - vn) * Fl(A, i)}px`, bg: Ll(A, i), borderRadius: "1px", transition: "width 80ms linear, background-color 80ms linear", "aria-label": `Jump to message ${A + 1}`, onClick: () => o?.(T.id) }, T.id), e[9] = o, e[10] = i, e[11] = w) : w = e[11], y = n.map(w), e[5] = n, e[6] = o, e[7] = i, e[8] = y;
2704
+ let b;
2705
+ if (e[5] !== n || e[6] !== s || e[7] !== i) {
2706
+ let S;
2707
+ e[9] !== s || e[10] !== i ? (S = (w, C) => /* @__PURE__ */ c(Gt.button, { type: "button", h: "2px", w: `${Xt + (Zi - Xt) * el(C, i)}px`, bg: tl(C, i), borderRadius: "1px", transition: "width 80ms linear, background-color 80ms linear", "aria-label": `Jump to message ${C + 1}`, onClick: () => s?.(w.id) }, w.id), e[9] = s, e[10] = i, e[11] = S) : S = e[11], b = n.map(S), e[5] = n, e[6] = s, e[7] = i, e[8] = b;
2791
2708
  } else
2792
- y = e[8];
2709
+ b = e[8];
2793
2710
  let x;
2794
- e[12] !== f || e[13] !== g || e[14] !== y ? (x = /* @__PURE__ */ c(Qe, { direction: "column", align: "flex-start", gap: "1.5", px: "1.5", py: "2", w: "10", onPointerMove: f, onPointerLeave: h, ...g, children: y }), e[12] = f, e[13] = g, e[14] = y, e[15] = x) : x = e[15];
2795
- let b;
2796
- e[16] !== m || e[17] !== a ? (b = m && a ? /* @__PURE__ */ c($l, { item: m, position: a }) : null, e[16] = m, e[17] = a, e[18] = b) : b = e[18];
2797
- let S;
2798
- return e[19] !== x || e[20] !== b ? (S = /* @__PURE__ */ k(B, { position: "relative", w: "10", flexShrink: 0, children: [
2711
+ e[12] !== f || e[13] !== g || e[14] !== b ? (x = /* @__PURE__ */ c(be, { direction: "column", align: "flex-start", gap: "1.5", px: "1.5", py: "2", w: "10", onPointerMove: f, onPointerLeave: h, ...g, children: b }), e[12] = f, e[13] = g, e[14] = b, e[15] = x) : x = e[15];
2712
+ let y;
2713
+ e[16] !== m || e[17] !== a ? (y = m && a ? /* @__PURE__ */ c(nl, { item: m, position: a }) : null, e[16] = m, e[17] = a, e[18] = y) : y = e[18];
2714
+ let T;
2715
+ return e[19] !== x || e[20] !== y ? (T = /* @__PURE__ */ k(P, { position: "relative", w: "10", flexShrink: 0, children: [
2799
2716
  x,
2800
- b
2801
- ] }), e[19] = x, e[20] = b, e[21] = S) : S = e[21], S;
2802
- }, Ol = (t) => {
2803
- const e = C(13), {
2717
+ y
2718
+ ] }), e[19] = x, e[20] = y, e[21] = T) : T = e[21], T;
2719
+ }, sl = (t) => {
2720
+ const e = A(13), {
2804
2721
  status: n,
2805
- statusLabel: o,
2806
- additions: s,
2722
+ statusLabel: s,
2723
+ additions: o,
2807
2724
  deletions: r
2808
2725
  } = t;
2809
2726
  if (n === "loading") {
2810
2727
  let u;
2811
- e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ c(nn, { size: "xs", color: "fg.muted" }), e[0] = u) : u = e[0];
2812
- const d = o ?? "Setting up workspace...";
2728
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ c(kt, { size: "xs", color: "fg.muted" }), e[0] = u) : u = e[0];
2729
+ const d = s ?? "Setting up workspace...";
2813
2730
  let f;
2814
- return e[1] !== d ? (f = /* @__PURE__ */ k(ae, { gap: "2xs", minW: "0", children: [
2731
+ return e[1] !== d ? (f = /* @__PURE__ */ k(Z, { gap: "2xs", minW: "0", children: [
2815
2732
  u,
2816
2733
  /* @__PURE__ */ c(U, { textStyle: "label/XS/regular", color: "fg.muted", truncate: !0, children: d })
2817
2734
  ] }), e[1] = d, e[2] = f) : f = e[2], f;
2818
2735
  }
2819
2736
  if (n === "error") {
2820
2737
  let u;
2821
- e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ c(Ln, { size: 14, color: "var(--chakra-colors-fg-error)" }), e[3] = u) : u = e[3];
2822
- const d = o ?? "Workspace setup failed";
2738
+ e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ c(sn, { size: 14, color: "var(--chakra-colors-fg-error)" }), e[3] = u) : u = e[3];
2739
+ const d = s ?? "Workspace setup failed";
2823
2740
  let f;
2824
- return e[4] !== d ? (f = /* @__PURE__ */ k(ae, { gap: "2xs", minW: "0", children: [
2741
+ return e[4] !== d ? (f = /* @__PURE__ */ k(Z, { gap: "2xs", minW: "0", children: [
2825
2742
  u,
2826
2743
  /* @__PURE__ */ c(U, { textStyle: "label/XS/regular", color: "fg.error", truncate: !0, children: d })
2827
2744
  ] }), e[4] = d, e[5] = f) : f = e[5], f;
2828
2745
  }
2829
- if (s <= 0 && r <= 0)
2746
+ if (o <= 0 && r <= 0)
2830
2747
  return null;
2831
2748
  let i;
2832
- e[6] !== s ? (i = /* @__PURE__ */ k(U, { textStyle: "label/XS/medium", color: "fg.success", children: [
2749
+ e[6] !== o ? (i = /* @__PURE__ */ k(U, { textStyle: "label/XS/medium", color: "fg.success", children: [
2833
2750
  "+",
2834
- s
2835
- ] }), e[6] = s, e[7] = i) : i = e[7];
2751
+ o
2752
+ ] }), e[6] = o, e[7] = i) : i = e[7];
2836
2753
  let l;
2837
2754
  e[8] !== r ? (l = /* @__PURE__ */ k(U, { textStyle: "label/XS/medium", color: "fg.error", children: [
2838
2755
  "−",
2839
2756
  r
2840
2757
  ] }), e[8] = r, e[9] = l) : l = e[9];
2841
2758
  let a;
2842
- return e[10] !== i || e[11] !== l ? (a = /* @__PURE__ */ k(ae, { gap: "2xs", children: [
2759
+ return e[10] !== i || e[11] !== l ? (a = /* @__PURE__ */ k(Z, { gap: "2xs", children: [
2843
2760
  i,
2844
2761
  l
2845
2762
  ] }), e[10] = i, e[11] = l, e[12] = a) : a = e[12], a;
2846
- }, sa = (t) => {
2847
- const e = C(13), {
2763
+ }, Tl = (t) => {
2764
+ const e = A(13), {
2848
2765
  workspaceControl: n,
2849
- additions: o,
2850
- deletions: s,
2766
+ additions: s,
2767
+ deletions: o,
2851
2768
  action: r,
2852
2769
  status: i,
2853
2770
  statusLabel: l
2854
2771
  } = t, a = i === void 0 ? "ready" : i;
2855
2772
  let u;
2856
- e[0] !== o || e[1] !== s || e[2] !== a || e[3] !== l ? (u = /* @__PURE__ */ c(Ol, { status: a, statusLabel: l, additions: o, deletions: s }), e[0] = o, e[1] = s, e[2] = a, e[3] = l, e[4] = u) : u = e[4];
2773
+ e[0] !== s || e[1] !== o || e[2] !== a || e[3] !== l ? (u = /* @__PURE__ */ c(sl, { status: a, statusLabel: l, additions: s, deletions: o }), e[0] = s, e[1] = o, e[2] = a, e[3] = l, e[4] = u) : u = e[4];
2857
2774
  let d;
2858
- e[5] !== u || e[6] !== n ? (d = /* @__PURE__ */ k(ae, { gap: "sm", minW: "0", children: [
2775
+ e[5] !== u || e[6] !== n ? (d = /* @__PURE__ */ k(Z, { gap: "sm", minW: "0", children: [
2859
2776
  n,
2860
2777
  u
2861
2778
  ] }), e[5] = u, e[6] = n, e[7] = d) : d = e[7];
2862
2779
  let f;
2863
- e[8] !== r ? (f = r ? /* @__PURE__ */ c(Qe, { flexShrink: 0, children: r }) : null, e[8] = r, e[9] = f) : f = e[9];
2780
+ e[8] !== r ? (f = r ? /* @__PURE__ */ c(be, { flexShrink: 0, children: r }) : null, e[8] = r, e[9] = f) : f = e[9];
2864
2781
  let p;
2865
- return e[10] !== d || e[11] !== f ? (p = /* @__PURE__ */ k(Qe, { align: "center", justify: "space-between", gap: "sm", minW: "0", pl: "xs", pr: "2xs", py: "2xs", children: [
2782
+ return e[10] !== d || e[11] !== f ? (p = /* @__PURE__ */ k(be, { align: "center", justify: "space-between", gap: "sm", minW: "0", pl: "xs", pr: "2xs", py: "2xs", children: [
2866
2783
  d,
2867
2784
  f
2868
2785
  ] }), e[10] = d, e[11] = f, e[12] = p) : p = e[12], p;
2869
2786
  };
2870
2787
  export {
2871
- Jl as ApprovalPrompt,
2872
- Zl as AttachmentList,
2873
- Ao as AutoScroll,
2874
- No as ChatInput,
2875
- ze as ChatMessage,
2876
- ea as ChatPanel,
2877
- Nt as ChatPrimitives,
2878
- ta as ChatSkeleton,
2879
- sa as ChatWorkspaceHub,
2880
- na as ConversationBrowse,
2881
- Ho as SendButton,
2882
- tr as createSerializedPromptState
2788
+ bl as ApprovalPrompt,
2789
+ yl as AttachmentList,
2790
+ Hs as AutoScroll,
2791
+ po as ChatInput,
2792
+ ge as ChatMessage,
2793
+ xl as ChatPanel,
2794
+ pt as ChatPrimitives,
2795
+ Sl as ChatSkeleton,
2796
+ Tl as ChatWorkspaceHub,
2797
+ wl as ConversationBrowse,
2798
+ uo as SendButton,
2799
+ So as createSerializedPromptState
2883
2800
  };
2884
2801
  //# sourceMappingURL=chat-ui.js.map