@pstdio/ui 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/{MermaidComponent-DwEDwpo2.js → MermaidComponent-x3aKzNXm.js} +2 -2
  2. package/dist/{MermaidComponent-DwEDwpo2.js.map → MermaidComponent-x3aKzNXm.js.map} +1 -1
  3. package/dist/chat-ui.js +1335 -870
  4. package/dist/chat-ui.js.map +1 -1
  5. package/dist/components/chat-ui/agent-types.d.ts +4 -0
  6. package/dist/components/chat-ui/components/chat-input-question-prompt.d.ts +33 -0
  7. package/dist/components/chat-ui/components/chat-input.d.ts +3 -1
  8. package/dist/components/chat-ui/components/chat-panel-sticky-user-message.d.ts +9 -0
  9. package/dist/components/chat-ui/components/chat-panel.d.ts +3 -1
  10. package/dist/components/chat-ui/components/message-parts-renderer.d.ts +1 -0
  11. package/dist/components/chat-ui/components/timeline-tool-blocks.d.ts +14 -0
  12. package/dist/components/chat-ui/components/timeline.d.ts +22 -0
  13. package/dist/components/chat-ui/components/tool-invocation-timeline.d.ts +2 -1
  14. package/dist/components/chat-ui/index.d.ts +1 -0
  15. package/dist/components/chat-ui/tool-rendering/build-timeline.d.ts +2 -2
  16. package/dist/components/chat-ui/tool-rendering/default-renderers.d.ts +2 -0
  17. package/dist/components/chat-ui/tool-rendering/question-renderer.d.ts +10 -0
  18. package/dist/components/chat-ui/tool-rendering/shared.d.ts +1 -1
  19. package/dist/components/chat-ui/tool-rendering/todowrite-renderer.d.ts +10 -0
  20. package/dist/components/chat-ui/utils/get-icon.d.ts +2 -0
  21. package/dist/components/chat-ui/utils/tool-name.d.ts +2 -0
  22. package/dist/components/radio.d.ts +8 -0
  23. package/dist/components/tickets/ticket-board.d.ts +6 -2
  24. package/dist/components/tickets/ticket-list.d.ts +3 -0
  25. package/dist/components/tickets/tickets-workspace.d.ts +2 -0
  26. package/dist/components/tickets/workspace-helpers.d.ts +6 -1
  27. package/dist/index.d.ts +2 -0
  28. package/dist/index.js +1593 -1524
  29. package/dist/index.js.map +1 -1
  30. package/dist/radio-C42qncrD.js +236 -0
  31. package/dist/radio-C42qncrD.js.map +1 -0
  32. package/dist/{rich-message-BVRk9BSD.js → rich-message-CoXTd5kw.js} +364 -355
  33. package/dist/rich-message-CoXTd5kw.js.map +1 -0
  34. package/dist/rich-text.js +2 -2
  35. package/dist/theme/recipes/button.d.ts +6 -0
  36. package/dist/{theme-D0VvFB1Y.js → theme-BLGUwVOD.js} +7 -1
  37. package/dist/theme-BLGUwVOD.js.map +1 -0
  38. package/dist/theme.js +1 -1
  39. package/package.json +1 -1
  40. package/dist/components/chat-ui/tool-rendering/todo-write-renderer.d.ts +0 -2
  41. package/dist/empty-state-yGspgiPl.js +0 -185
  42. package/dist/empty-state-yGspgiPl.js.map +0 -1
  43. package/dist/rich-message-BVRk9BSD.js.map +0 -1
  44. package/dist/theme-D0VvFB1Y.js.map +0 -1
package/dist/chat-ui.js CHANGED
@@ -1,11 +1,11 @@
1
- import { jsx as i, jsxs as b, Fragment as tt } from "react/jsx-runtime";
2
- import { c as y } from "react/compiler-runtime";
3
- import { chakra as Ot, AbsoluteCenter as Ht, IconButton as yt, defineSlotRecipe as jt, createSlotRecipeContext as Nt, Text as K, Code as at, Button as Ce, HStack as ge, Box as k, Flex as $, Tooltip as De, Portal as Ut, Kbd as Vt, Spacer as Kt, Stack as te, Badge as ct, Timeline as qt, Span as we, Avatar as he, Card as E, Link as St, Spinner as nt, Skeleton as Gt } from "@chakra-ui/react";
4
- import { ArrowDownIcon as Xt, ShieldX as Yt, ShieldCheck as Jt, Square as Qt, ArrowUp as Zt, Move as en, FileDown as tn, FileUp as nn, FileDiff as rn, Trash2 as on, FilePen as sn, FileText as ln, ListTree as an, Terminal as kt, File as cn, Globe as dn, Search as un, AlertTriangle as Tt, DotIcon as fn, ChevronUpIcon as pn, MessageCircleIcon as mn } from "lucide-react";
5
- import { StickToBottom as hn, useStickToBottomContext as rt } from "use-stick-to-bottom";
6
- import { S as wt } from "./get-file-type-icon-Bwqf1WXA.js";
7
- import { useRef as Ze, useEffect as et, useState as me } from "react";
8
- import { h as Ye, P as gn, g as bn, R as Ct, i as xn } from "./rich-message-BVRk9BSD.js";
1
+ import { jsx as l, jsxs as k, Fragment as At } from "react/jsx-runtime";
2
+ import { c as S } from "react/compiler-runtime";
3
+ import { chakra as kn, AbsoluteCenter as wn, IconButton as jt, defineSlotRecipe as Tn, createSlotRecipeContext as Cn, Text as z, Code as Et, Button as Ee, HStack as Re, Box as P, Flex as ae, Stack as F, Textarea as _n, Tooltip as Ye, Portal as An, Kbd as Rn, Spacer as Bn, Timeline as In, Span as Oe, Avatar as _e, Card as Y, Link as Nt, Spinner as Rt, Skeleton as Pn } from "@chakra-ui/react";
4
+ import { ArrowDownIcon as Mn, ShieldX as $n, ShieldCheck as On, Check as En, Square as Dn, ArrowUp as Ln, Move as Qn, FileDown as qn, FileUp as vn, FileDiff as zn, Trash2 as Fn, FilePen as Wn, FileText as Hn, ListTree as jn, Terminal as Vt, ListTodo as Nn, CircleQuestionMark as Vn, File as Un, Globe as Gn, Search as Kn, AlertTriangle as Ut, DotIcon as Xn, ChevronUpIcon as Yn, MessageCircleIcon as Jn } from "lucide-react";
5
+ import { StickToBottom as Zn, useStickToBottomContext as Bt } from "use-stick-to-bottom";
6
+ import { S as Gt, T as eo } from "./get-file-type-icon-Bwqf1WXA.js";
7
+ import { useRef as Je, useEffect as Ze, useState as J } from "react";
8
+ import { h as St, P as to, g as no, R as Kt, i as oo } from "./rich-message-CoXTd5kw.js";
9
9
  import "@lexical/react/LexicalCollaborationContext";
10
10
  import "@lexical/react/LexicalCollaborationPlugin";
11
11
  import "@lexical/react/LexicalComposer";
@@ -31,13 +31,13 @@ import "@lexical/react/LexicalCheckListPlugin";
31
31
  import "@lexical/react/LexicalHistoryPlugin";
32
32
  import "@lexical/react/LexicalOnChangePlugin";
33
33
  import "@lexical/react/LexicalTreeView";
34
- import { D as yn, a as _t, A as dt, E as Sn } from "./empty-state-yGspgiPl.js";
35
- const kn = {
34
+ import { C as Xt, R as so, a as ro, D as io, b as Yt, A as Dt, E as lo } from "./radio-C42qncrD.js";
35
+ const co = {
36
36
  "aria-roledescription": "conversation",
37
37
  initial: "instant",
38
38
  resize: "instant",
39
39
  role: "log"
40
- }, Tn = Ot(hn, {
40
+ }, ao = kn(Zn, {
41
41
  base: {
42
42
  position: "relative",
43
43
  flex: 1,
@@ -46,42 +46,42 @@ const kn = {
46
46
  }
47
47
  }, {
48
48
  forwardProps: ["resize"],
49
- defaultProps: kn
50
- }), wn = (t) => {
51
- const e = y(9);
52
- let n, r;
49
+ defaultProps: co
50
+ }), uo = (t) => {
51
+ const e = S(9);
52
+ let n, s;
53
53
  e[0] !== t ? ({
54
54
  children: n,
55
- ...r
56
- } = t, e[0] = t, e[1] = n, e[2] = r) : (n = e[1], r = e[2]);
55
+ ...s
56
+ } = t, e[0] = t, e[1] = n, e[2] = s) : (n = e[1], s = e[2]);
57
57
  const {
58
58
  contentRef: o,
59
- scrollRef: s
60
- } = rt(), l = s, a = o;
61
- let c;
62
- e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (c = {
59
+ scrollRef: r
60
+ } = Bt(), i = r, c = o;
61
+ let a;
62
+ e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (a = {
63
63
  p: "sm",
64
64
  "aria-live": "polite",
65
65
  role: "list"
66
- }, e[3] = c) : c = e[3];
67
- let d;
68
- return e[4] !== n || e[5] !== r || e[6] !== l || e[7] !== a ? (d = /* @__PURE__ */ i(wt, { ...r, height: "full", width: "full", showHorizontalScrollbar: !1, viewportRef: l, contentRef: a, contentProps: c, children: n }), e[4] = n, e[5] = r, e[6] = l, e[7] = a, e[8] = d) : d = e[8], d;
69
- }, Cn = {
66
+ }, e[3] = a) : a = e[3];
67
+ let u;
68
+ return e[4] !== n || e[5] !== s || e[6] !== i || e[7] !== c ? (u = /* @__PURE__ */ l(Gt, { ...s, height: "full", width: "full", showHorizontalScrollbar: !1, viewportRef: i, contentRef: c, contentProps: a, children: n }), e[4] = n, e[5] = s, e[6] = i, e[7] = c, e[8] = u) : u = e[8], u;
69
+ }, fo = {
70
70
  axis: "horizontal",
71
71
  bottom: "md",
72
72
  zIndex: 2
73
- }, _n = (t) => {
74
- const e = y(4), {
73
+ }, po = (t) => {
74
+ const e = S(4), {
75
75
  isAtBottom: n,
76
- scrollToBottom: r
77
- } = rt();
76
+ scrollToBottom: s
77
+ } = Bt();
78
78
  let o;
79
- return e[0] !== n || e[1] !== t || e[2] !== r ? (o = !n && /* @__PURE__ */ i(Ht, { ...Cn, children: /* @__PURE__ */ i(yt, { rounded: "full", onClick: () => r(), variant: "outline", size: "xs", ...t, children: /* @__PURE__ */ i(Xt, { size: 16 }) }) }), e[0] = n, e[1] = t, e[2] = r, e[3] = o) : o = e[3], o;
80
- }, Je = {
81
- Root: Tn,
82
- Viewport: wn,
83
- ScrollToBottom: _n
84
- }, Pn = jt({
79
+ return e[0] !== n || e[1] !== t || e[2] !== s ? (o = !n && /* @__PURE__ */ l(wn, { ...fo, children: /* @__PURE__ */ l(jt, { rounded: "full", onClick: () => s(), variant: "outline", size: "xs", ...t, children: /* @__PURE__ */ l(Mn, { size: 16 }) }) }), e[0] = n, e[1] = t, e[2] = s, e[3] = o) : o = e[3], o;
80
+ }, kt = {
81
+ Root: ao,
82
+ Viewport: uo,
83
+ ScrollToBottom: po
84
+ }, mo = Tn({
85
85
  className: "ai-message",
86
86
  slots: ["root", "content"],
87
87
  base: {
@@ -186,304 +186,594 @@ const kn = {
186
186
  shape: "rounded"
187
187
  }
188
188
  }), {
189
- withProvider: Rn,
190
- withContext: In
191
- } = Nt({
192
- recipe: Pn
193
- }), An = Rn("div", "root"), vn = In("div", "content"), V = {
194
- Root: An,
195
- Content: vn
196
- }, Bn = (t) => {
189
+ withProvider: ho,
190
+ withContext: go
191
+ } = Cn({
192
+ recipe: mo
193
+ }), bo = ho("div", "root"), xo = go("div", "content"), ce = {
194
+ Root: bo,
195
+ Content: xo
196
+ }, yo = (t) => {
197
197
  if (t == null) return null;
198
198
  const e = typeof t == "string" ? t : JSON.stringify(t, null, 2);
199
199
  return e.length === 0 ? null : e.length > 200 ? `${e.slice(0, 200)}...` : e;
200
- }, Jo = (t) => {
201
- const e = y(19), {
200
+ }, bi = (t) => {
201
+ const e = S(19), {
202
202
  toolName: n,
203
- toolInput: r,
203
+ toolInput: s,
204
204
  onApprove: o,
205
- onDeny: s
205
+ onDeny: r
206
206
  } = t;
207
- let l;
208
- e[0] !== r ? (l = Bn(r), e[0] = r, e[1] = l) : l = e[1];
209
- const a = l;
210
- let c;
211
- e[2] !== n ? (c = /* @__PURE__ */ b(K, { textStyle: "label/S/medium", color: "fg", children: [
207
+ let i;
208
+ e[0] !== s ? (i = yo(s), e[0] = s, e[1] = i) : i = e[1];
209
+ const c = i;
210
+ let a;
211
+ e[2] !== n ? (a = /* @__PURE__ */ k(z, { textStyle: "label/S/medium", color: "fg", children: [
212
212
  "Allow ",
213
- /* @__PURE__ */ i(at, { size: "sm", children: n }),
213
+ /* @__PURE__ */ l(Et, { size: "sm", children: n }),
214
214
  "?"
215
- ] }), e[2] = n, e[3] = c) : c = e[3];
215
+ ] }), e[2] = n, e[3] = a) : a = e[3];
216
+ let u;
217
+ e[4] !== c ? (u = c ? /* @__PURE__ */ l(Et, { size: "sm", whiteSpace: "pre-wrap", maxH: "6rem", overflowY: "auto", children: c }) : null, e[4] = c, e[5] = u) : u = e[5];
216
218
  let d;
217
- e[4] !== a ? (d = a ? /* @__PURE__ */ i(at, { size: "sm", whiteSpace: "pre-wrap", maxH: "6rem", overflowY: "auto", children: a }) : null, e[4] = a, e[5] = d) : d = e[5];
219
+ e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ l($n, { size: 14 }), e[6] = d) : d = e[6];
218
220
  let f;
219
- e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ i(Yt, { size: 14 }), e[6] = f) : f = e[6];
220
- let u;
221
- e[7] !== s ? (u = /* @__PURE__ */ b(Ce, { size: "xs", variant: "outline", onClick: s, children: [
222
- f,
221
+ e[7] !== r ? (f = /* @__PURE__ */ k(Ee, { size: "xs", variant: "outline", onClick: r, children: [
222
+ d,
223
223
  "Deny"
224
- ] }), e[7] = s, e[8] = u) : u = e[8];
225
- let p;
226
- e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ i(Jt, { size: 14 }), e[9] = p) : p = e[9];
224
+ ] }), e[7] = r, e[8] = f) : f = e[8];
227
225
  let m;
228
- e[10] !== o ? (m = /* @__PURE__ */ b(Ce, { size: "xs", colorPalette: "green", onClick: o, children: [
229
- p,
226
+ e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (m = /* @__PURE__ */ l(On, { size: 14 }), e[9] = m) : m = e[9];
227
+ let p;
228
+ e[10] !== o ? (p = /* @__PURE__ */ k(Ee, { size: "xs", colorPalette: "green", onClick: o, children: [
229
+ m,
230
230
  "Allow"
231
- ] }), e[10] = o, e[11] = m) : m = e[11];
231
+ ] }), e[10] = o, e[11] = p) : p = e[11];
232
+ let h;
233
+ e[12] !== f || e[13] !== p ? (h = /* @__PURE__ */ k(Re, { gap: "xs", justifyContent: "flex-end", children: [
234
+ f,
235
+ p
236
+ ] }), e[12] = f, e[13] = p, e[14] = h) : h = e[14];
232
237
  let g;
233
- e[12] !== u || e[13] !== m ? (g = /* @__PURE__ */ b(ge, { gap: "xs", justifyContent: "flex-end", children: [
238
+ return e[15] !== a || e[16] !== u || e[17] !== h ? (g = /* @__PURE__ */ l(P, { px: "sm", py: "xs", mx: "sm", borderWidth: "1px", borderColor: "border.warning", borderRadius: "lg", bg: "bg.warning", children: /* @__PURE__ */ k(ae, { direction: "column", gap: "xs", children: [
239
+ a,
234
240
  u,
235
- m
236
- ] }), e[12] = u, e[13] = m, e[14] = g) : g = e[14];
237
- let x;
238
- return e[15] !== c || e[16] !== d || e[17] !== g ? (x = /* @__PURE__ */ i(k, { px: "sm", py: "xs", mx: "sm", borderWidth: "1px", borderColor: "border.warning", borderRadius: "lg", bg: "bg.warning", children: /* @__PURE__ */ b($, { direction: "column", gap: "xs", children: [
239
- c,
240
- d,
241
- g
242
- ] }) }), e[15] = c, e[16] = d, e[17] = g, e[18] = x) : x = e[18], x;
243
- }, Dn = (t) => {
241
+ h
242
+ ] }) }), e[15] = a, e[16] = u, e[17] = h, e[18] = g) : g = e[18], g;
243
+ }, So = (t) => {
244
244
  const {
245
245
  previousUserMessageCount: e,
246
246
  userMessageCount: n
247
247
  } = t;
248
248
  return e === 0 ? !1 : n > e;
249
249
  };
250
- function Mn(t) {
251
- const e = y(4), {
250
+ function ko(t) {
251
+ const e = S(4), {
252
252
  userMessageCount: n
253
253
  } = t, {
254
- scrollToBottom: r
255
- } = rt(), o = Ze(n);
256
- let s, l;
257
- return e[0] !== r || e[1] !== n ? (s = () => {
258
- Dn({
254
+ scrollToBottom: s
255
+ } = Bt(), o = Je(n);
256
+ let r, i;
257
+ return e[0] !== s || e[1] !== n ? (r = () => {
258
+ So({
259
259
  previousUserMessageCount: o.current,
260
260
  userMessageCount: n
261
- }) && r(), o.current = n;
262
- }, l = [n, r], e[0] = r, e[1] = n, e[2] = s, e[3] = l) : (s = e[2], l = e[3]), et(s, l), null;
261
+ }) && s(), o.current = n;
262
+ }, i = [n, s], e[0] = s, e[1] = n, e[2] = r, e[3] = i) : (r = e[2], i = e[3]), Ze(r, i), null;
263
263
  }
264
- const Pt = (t) => t.trim().length > 0, zn = (t) => {
264
+ const Jt = (t) => t.trim().length > 0, wo = (t) => {
265
265
  const {
266
266
  isDisabled: e,
267
267
  streaming: n,
268
- text: r
268
+ text: s
269
269
  } = t;
270
- return e || n || !Pt(r) ? "none" : "submit";
271
- }, En = (t) => {
270
+ return e || n || !Jt(s) ? "none" : "submit";
271
+ }, To = (t) => {
272
272
  const {
273
273
  canInterrupt: e,
274
274
  isDisabled: n,
275
- streaming: r,
275
+ streaming: s,
276
276
  text: o
277
277
  } = t;
278
- return n ? "none" : r ? e ? "interrupt" : "none" : Pt(o) ? "submit" : "none";
279
- }, $n = (t) => {
280
- const e = y(22);
281
- let n, r, o, s;
278
+ return n ? "none" : s ? e ? "interrupt" : "none" : Jt(o) ? "submit" : "none";
279
+ }, Co = (t) => {
280
+ t.preventDefault();
281
+ }, Zt = (t) => {
282
+ const e = S(7), {
283
+ option: n
284
+ } = t;
285
+ let s;
286
+ e[0] !== n.label ? (s = /* @__PURE__ */ l(z, { textStyle: "label/S/regular", color: "fg", children: n.label }), e[0] = n.label, e[1] = s) : s = e[1];
287
+ let o;
288
+ e[2] !== n.description ? (o = n.description ? /* @__PURE__ */ l(z, { textStyle: "label/XS/regular", color: "fg.muted", children: n.description }) : null, e[2] = n.description, e[3] = o) : o = e[3];
289
+ let r;
290
+ return e[4] !== s || e[5] !== o ? (r = /* @__PURE__ */ k(F, { gap: "0", minWidth: "0", children: [
291
+ s,
292
+ o
293
+ ] }), e[4] = s, e[5] = o, e[6] = r) : r = e[6], r;
294
+ }, _o = (t) => {
295
+ const e = S(12), {
296
+ option: n,
297
+ name: s,
298
+ checked: o,
299
+ editable: r,
300
+ onToggle: i
301
+ } = t, c = !r, a = r ? void 0 : "true";
302
+ let u;
303
+ e[0] !== r ? (u = r ? void 0 : {
304
+ tabIndex: -1
305
+ }, e[0] = r, e[1] = u) : u = e[1];
306
+ const d = r ? i : void 0;
307
+ let f;
308
+ e[2] !== n ? (f = /* @__PURE__ */ l(Zt, { option: n }), e[2] = n, e[3] = f) : f = e[3];
309
+ let m;
310
+ return e[4] !== o || e[5] !== s || e[6] !== c || e[7] !== a || e[8] !== u || e[9] !== d || e[10] !== f ? (m = /* @__PURE__ */ l(Xt, { name: s, checked: o, readOnly: c, "aria-readonly": a, inputProps: u, alignItems: "flex-start", onCheckedChange: d, children: f }), e[4] = o, e[5] = s, e[6] = c, e[7] = a, e[8] = u, e[9] = d, e[10] = f, e[11] = m) : m = e[11], m;
311
+ }, Ao = (t) => {
312
+ const e = S(17), {
313
+ question: n,
314
+ questionIndex: s,
315
+ name: o,
316
+ selectedOption: r,
317
+ editable: i,
318
+ onToggleOption: c
319
+ } = t, a = r ?? null, u = !i, d = i ? void 0 : "true";
320
+ let f;
321
+ e[0] !== i || e[1] !== c || e[2] !== n || e[3] !== s ? (f = i ? (h) => {
322
+ h.value && c?.(n, s, h.value);
323
+ } : void 0, e[0] = i, e[1] = c, e[2] = n, e[3] = s, e[4] = f) : f = e[4];
324
+ let m;
325
+ if (e[5] !== i || e[6] !== n.options) {
326
+ let h;
327
+ e[8] !== i ? (h = (g) => /* @__PURE__ */ l(so, { value: g.label, inputProps: i ? void 0 : {
328
+ tabIndex: -1
329
+ }, alignItems: "flex-start", children: /* @__PURE__ */ l(Zt, { option: g }) }, g.label), e[8] = i, e[9] = h) : h = e[9], m = n.options.map(h), e[5] = i, e[6] = n.options, e[7] = m;
330
+ } else
331
+ m = e[7];
332
+ let p;
333
+ return e[10] !== o || e[11] !== a || e[12] !== u || e[13] !== d || e[14] !== f || e[15] !== m ? (p = /* @__PURE__ */ l(ro, { name: o, value: a, readOnly: u, "aria-readonly": d, display: "flex", flexDirection: "column", gap: "xs", onValueChange: f, children: m }), e[10] = o, e[11] = a, e[12] = u, e[13] = d, e[14] = f, e[15] = m, e[16] = p) : p = e[16], p;
334
+ }, Ro = (t) => {
335
+ const e = S(4), {
336
+ items: n
337
+ } = t;
338
+ let s;
339
+ e[0] !== n ? (s = n.map(Bo), e[0] = n, e[1] = s) : s = e[1];
340
+ let o;
341
+ return e[2] !== s ? (o = /* @__PURE__ */ l(F, { as: "ul", gap: "2xs", listStyleType: "none", margin: "0", padding: "0", children: s }), e[2] = s, e[3] = o) : o = e[3], o;
342
+ }, en = (t) => {
343
+ const e = S(19), {
344
+ questions: n,
345
+ editable: s,
346
+ selectedOptionsByQuestion: o,
347
+ customAnswersByQuestion: r,
348
+ onToggleOption: i,
349
+ onCustomAnswerChange: c
350
+ } = t, a = s === void 0 ? !1 : s;
351
+ let u;
352
+ e[0] !== o ? (u = o === void 0 ? {} : o, e[0] = o, e[1] = u) : u = e[1];
353
+ const d = u;
354
+ let f;
355
+ e[2] !== r ? (f = r === void 0 ? {} : r, e[2] = r, e[3] = f) : f = e[3];
356
+ const m = f;
357
+ let p;
358
+ if (e[4] !== m || e[5] !== a || e[6] !== c || e[7] !== i || e[8] !== n || e[9] !== d) {
359
+ let g;
360
+ e[11] !== m || e[12] !== a || e[13] !== c || e[14] !== i || e[15] !== d ? (g = (b, y) => {
361
+ const w = b.id ?? `question-${y}`, T = b.multiple ? "checkbox" : "radio", R = d[w] ?? [];
362
+ return /* @__PURE__ */ k(F, { as: "fieldset", gap: "xs", borderWidth: "1px", borderColor: "border.muted", borderRadius: "sm", padding: "sm", minWidth: "0", children: [
363
+ /* @__PURE__ */ l(z, { as: "legend", textStyle: "label/S/medium", color: "fg", paddingX: "2xs", children: b.question }),
364
+ T === "radio" ? /* @__PURE__ */ l(Ao, { question: b, questionIndex: y, name: w, selectedOption: R[0], editable: a, onToggleOption: i }) : b.options.map((C) => /* @__PURE__ */ l(_o, { option: C, name: w, checked: R.includes(C.label), editable: a, onToggle: () => i?.(b, y, C.label) }, C.label)),
365
+ b.allowCustomAnswer ? /* @__PURE__ */ l(_n, { readOnly: !a, "aria-readonly": a ? void 0 : "true", value: m[w] ?? "", placeholder: a ? "Answer..." : "Custom answer", "aria-label": b.question, rows: 2, borderWidth: "1px", borderColor: "border.muted", borderRadius: "sm", padding: "xs", resize: a ? "vertical" : "none", color: "fg", onChange: (C) => c?.(b, y, C.currentTarget.value) }) : null
366
+ ] }, w);
367
+ }, e[11] = m, e[12] = a, e[13] = c, e[14] = i, e[15] = d, e[16] = g) : g = e[16], p = n.map(g), e[4] = m, e[5] = a, e[6] = c, e[7] = i, e[8] = n, e[9] = d, e[10] = p;
368
+ } else
369
+ p = e[10];
370
+ let h;
371
+ return e[17] !== p ? (h = /* @__PURE__ */ l(F, { as: "form", gap: "sm", onSubmit: Co, "aria-label": "Question form", children: p }), e[17] = p, e[18] = h) : h = e[18], h;
372
+ };
373
+ function Bo(t, e) {
374
+ return /* @__PURE__ */ l(P, { as: "li", children: /* @__PURE__ */ l(Xt, { checked: t.checked, readOnly: !0, "aria-readonly": "true", inputProps: {
375
+ tabIndex: -1
376
+ }, children: /* @__PURE__ */ l(z, { textStyle: "label/S/regular", color: "fg", children: t.label }) }) }, `${t.label}-${e}`);
377
+ }
378
+ const Z = (t, e) => t.id ?? `question-${e}`, _t = (t) => t ? JSON.stringify(t.questions.map((e, n) => ({
379
+ id: Z(e, n),
380
+ question: e.question,
381
+ multiple: !!e.multiple,
382
+ required: !!e.required,
383
+ allowCustomAnswer: !!e.allowCustomAnswer,
384
+ options: e.options.map((s) => ({
385
+ label: s.label,
386
+ description: s.description ?? ""
387
+ }))
388
+ }))) : "", Io = (t, e, n) => {
389
+ const s = [];
390
+ for (let o = 0; o < t.questions.length; o += 1) {
391
+ const r = t.questions[o], i = Z(r, o), c = e[i] ?? [], a = n[i]?.trim(), u = a ? [...c, a] : c;
392
+ u.length !== 0 && s.push(`${r.question}: ${u.join(", ")}`);
393
+ }
394
+ return s;
395
+ }, Po = (t) => typeof t != "string", It = (t, e) => {
396
+ if (Po(e)) return e;
397
+ const n = e.trim();
398
+ if (n.length === 0) return {};
399
+ const s = {};
400
+ for (let o = 0; o < t.questions.length; o += 1) {
401
+ const r = t.questions[o];
402
+ r.allowCustomAnswer && (s[Z(r, o)] = n);
403
+ }
404
+ return s;
405
+ }, Mo = (t, e, n) => {
406
+ if (!t) return typeof n == "string" ? n.trim() : "";
407
+ const s = It(t, n), o = Io(t, e, s), r = typeof n == "string" ? n.trim() : "", i = t.questions.some((c) => c.allowCustomAnswer);
408
+ return r.length > 0 && !i && o.push(`Additional response: ${r}`), o.join(`
409
+ `);
410
+ }, $o = (t, e, n) => {
411
+ const s = It(t, n);
412
+ return t.questions.map((o, r) => {
413
+ const i = Z(o, r), c = e[i] ?? [], a = s[i]?.trim();
414
+ return a ? [...c, a] : c;
415
+ });
416
+ }, Oo = (t, e, n) => {
417
+ if (!t) return !1;
418
+ const s = It(t, n);
419
+ for (let o = 0; o < t.questions.length; o += 1) {
420
+ const r = t.questions[o];
421
+ if (!r.required) continue;
422
+ const i = Z(r, o);
423
+ if (!((e[i] ?? []).length > 0) && !(r.allowCustomAnswer && s[i]?.trim()))
424
+ return !0;
425
+ }
426
+ return !1;
427
+ }, Eo = (t) => t.questions.map((e, n) => ({
428
+ id: Z(e, n),
429
+ question: e.question,
430
+ options: e.options,
431
+ multiple: !!e.multiple,
432
+ required: !!e.required,
433
+ allowCustomAnswer: !!e.allowCustomAnswer
434
+ })), Do = (t, e, n, s) => {
435
+ const o = Z(t, e);
436
+ return (n[o] ?? []).length > 0 || !!s[o]?.trim();
437
+ }, Lo = (t) => {
438
+ const e = S(22), {
439
+ question: n,
440
+ sourceQuestion: s,
441
+ questionIndex: o,
442
+ isActive: r,
443
+ selectedOptionsByQuestion: i,
444
+ customAnswersByQuestion: c,
445
+ onSelectStep: a
446
+ } = t;
447
+ let u;
448
+ e[0] !== c || e[1] !== o || e[2] !== i || e[3] !== s ? (u = Do(s, o, i, c), e[0] = c, e[1] = o, e[2] = i, e[3] = s, e[4] = u) : u = e[4];
449
+ const d = u, f = d ? "answered" : "not answered", m = r ? "outline" : "ghost", p = `question-step-tab-${n.id}`, h = `${n.question} (${f})`, g = `question-step-panel-${n.id}`;
450
+ let b;
451
+ e[5] !== a || e[6] !== o ? (b = () => a(o), e[5] = a, e[6] = o, e[7] = b) : b = e[7];
452
+ let y;
453
+ e[8] !== d || e[9] !== o ? (y = d ? /* @__PURE__ */ l(En, { "aria-hidden": "true" }) : o + 1, e[8] = d, e[9] = o, e[10] = y) : y = e[10];
454
+ let w;
455
+ e[11] !== r || e[12] !== p || e[13] !== h || e[14] !== g || e[15] !== b || e[16] !== y || e[17] !== m ? (w = /* @__PURE__ */ l(Ee, { id: p, role: "tab", "aria-label": h, "aria-selected": r, "aria-controls": g, size: "xs", variant: m, minW: "8", onClick: b, children: y }), e[11] = r, e[12] = p, e[13] = h, e[14] = g, e[15] = b, e[16] = y, e[17] = m, e[18] = w) : w = e[18];
456
+ let T;
457
+ return e[19] !== n.question || e[20] !== w ? (T = /* @__PURE__ */ l(eo, { content: n.question, showArrow: !0, children: w }), e[19] = n.question, e[20] = w, e[21] = T) : T = e[21], T;
458
+ }, Qo = (t) => {
459
+ const e = S(31), {
460
+ questionPrompt: n,
461
+ selectedOptionsByQuestion: s,
462
+ customAnswersByQuestion: o,
463
+ onToggleOption: r,
464
+ onCustomAnswerChange: i
465
+ } = t, {
466
+ questions: c
467
+ } = t, [a, u] = J(0), d = Math.min(a, c.length - 1), f = c[d], m = c.length > 1;
468
+ let p;
469
+ e[0] !== o || e[1] !== m || e[2] !== n.questions || e[3] !== c || e[4] !== d || e[5] !== s ? (p = m ? /* @__PURE__ */ l(Re, { role: "tablist", "aria-label": "Question steps", gap: "1", minWidth: "0", children: c.map((_, I) => /* @__PURE__ */ l(Lo, { question: _, sourceQuestion: n.questions[I], questionIndex: I, isActive: I === d, selectedOptionsByQuestion: s, customAnswersByQuestion: o, onSelectStep: u }, _.id)) }) : null, e[0] = o, e[1] = m, e[2] = n.questions, e[3] = c, e[4] = d, e[5] = s, e[6] = p) : p = e[6];
470
+ const h = `question-step-panel-${f.id}`, g = m ? "tabpanel" : void 0, b = m ? `question-step-tab-${f.id}` : void 0;
471
+ let y;
472
+ e[7] !== f ? (y = [f], e[7] = f, e[8] = y) : y = e[8];
473
+ let w;
474
+ e[9] !== r || e[10] !== n.questions || e[11] !== d ? (w = (_, I, M) => {
475
+ r(n.questions[d], d, M);
476
+ }, e[9] = r, e[10] = n.questions, e[11] = d, e[12] = w) : w = e[12];
477
+ let T;
478
+ e[13] !== i || e[14] !== n.questions || e[15] !== d ? (T = (_, I, M) => {
479
+ i(n.questions[d], d, M);
480
+ }, e[13] = i, e[14] = n.questions, e[15] = d, e[16] = T) : T = e[16];
481
+ let R;
482
+ e[17] !== o || e[18] !== s || e[19] !== y || e[20] !== w || e[21] !== T ? (R = /* @__PURE__ */ l(en, { questions: y, editable: !0, selectedOptionsByQuestion: s, customAnswersByQuestion: o, onToggleOption: w, onCustomAnswerChange: T }), e[17] = o, e[18] = s, e[19] = y, e[20] = w, e[21] = T, e[22] = R) : R = e[22];
483
+ let C;
484
+ e[23] !== h || e[24] !== g || e[25] !== b || e[26] !== R ? (C = /* @__PURE__ */ l(F, { id: h, role: g, "aria-labelledby": b, gap: "0", children: R }), e[23] = h, e[24] = g, e[25] = b, e[26] = R, e[27] = C) : C = e[27];
485
+ let B;
486
+ return e[28] !== p || e[29] !== C ? (B = /* @__PURE__ */ k(F, { gap: "xs", pb: "sm", children: [
487
+ p,
488
+ C
489
+ ] }), e[28] = p, e[29] = C, e[30] = B) : B = e[30], B;
490
+ }, qo = (t) => {
491
+ const e = S(8), {
492
+ questionPrompt: n
493
+ } = t;
494
+ let s;
495
+ e[0] !== n ? (s = Eo(n), e[0] = n, e[1] = s) : s = e[1];
496
+ const o = s;
497
+ let r;
498
+ e[2] !== n ? (r = _t(n), e[2] = n, e[3] = r) : r = e[3];
499
+ const i = r;
500
+ let c;
501
+ return e[4] !== t || e[5] !== i || e[6] !== o ? (c = /* @__PURE__ */ l(Qo, { ...t, questions: o }, i), e[4] = t, e[5] = i, e[6] = o, e[7] = c) : c = e[7], c;
502
+ }, vo = (t) => {
503
+ const e = S(22);
504
+ let n, s, o, r;
282
505
  e[0] !== t ? ({
283
- title: s,
506
+ title: r,
284
507
  shortcut: o,
285
508
  canInterrupt: n,
286
- ...r
287
- } = t, e[0] = t, e[1] = n, e[2] = r, e[3] = o, e[4] = s) : (n = e[1], r = e[2], o = e[3], s = e[4]);
288
- const l = r["aria-label"] ?? s;
289
- let a;
290
- e[5] !== n ? (a = n ? /* @__PURE__ */ i(Qt, { size: 16, strokeWidth: 2, fill: "currentColor" }) : /* @__PURE__ */ i(Zt, { size: 16, strokeWidth: 2 }), e[5] = n, e[6] = a) : a = e[6];
291
- const c = a;
292
- let d;
293
- e[7] !== l || e[8] !== c || e[9] !== r || e[10] !== s ? (d = /* @__PURE__ */ i(yt, { "data-testid": "send-message-button", size: "sm", variant: "solid", borderRadius: "full", colorPalette: "primary", "aria-label": l, title: s, ...r, children: c }), e[7] = l, e[8] = c, e[9] = r, e[10] = s, e[11] = d) : d = e[11];
294
- const f = d;
295
- if (s) {
296
- let u;
297
- e[12] !== o || e[13] !== s ? (u = o ? /* @__PURE__ */ b(tt, { children: [
298
- s,
509
+ ...s
510
+ } = 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]);
511
+ const i = s["aria-label"] ?? r;
512
+ let c;
513
+ e[5] !== n ? (c = n ? /* @__PURE__ */ l(Dn, { size: 16, strokeWidth: 2, fill: "currentColor" }) : /* @__PURE__ */ l(Ln, { size: 16, strokeWidth: 2 }), e[5] = n, e[6] = c) : c = e[6];
514
+ const a = c;
515
+ let u;
516
+ e[7] !== i || e[8] !== a || e[9] !== s || e[10] !== r ? (u = /* @__PURE__ */ l(jt, { "data-testid": "send-message-button", size: "sm", variant: "solid", borderRadius: "full", colorPalette: "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];
517
+ const d = u;
518
+ if (r) {
519
+ let f;
520
+ e[12] !== o || e[13] !== r ? (f = o ? /* @__PURE__ */ k(At, { children: [
521
+ r,
299
522
  " ",
300
- /* @__PURE__ */ i(Vt, { fontSize: "xs", children: o })
301
- ] }) : s, e[12] = o, e[13] = s, e[14] = u) : u = e[14];
302
- const p = u;
303
- let m;
304
- e[15] !== f ? (m = /* @__PURE__ */ i(De.Trigger, { asChild: !0, children: f }), e[15] = f, e[16] = m) : m = e[16];
523
+ /* @__PURE__ */ l(Rn, { fontSize: "xs", children: o })
524
+ ] }) : r, e[12] = o, e[13] = r, e[14] = f) : f = e[14];
525
+ const m = f;
526
+ let p;
527
+ e[15] !== d ? (p = /* @__PURE__ */ l(Ye.Trigger, { asChild: !0, children: d }), e[15] = d, e[16] = p) : p = e[16];
528
+ let h;
529
+ e[17] !== m ? (h = /* @__PURE__ */ l(An, { children: /* @__PURE__ */ l(Ye.Positioner, { children: /* @__PURE__ */ l(Ye.Content, { children: m }) }) }), e[17] = m, e[18] = h) : h = e[18];
305
530
  let g;
306
- e[17] !== p ? (g = /* @__PURE__ */ i(Ut, { children: /* @__PURE__ */ i(De.Positioner, { children: /* @__PURE__ */ i(De.Content, { children: p }) }) }), e[17] = p, e[18] = g) : g = e[18];
307
- let x;
308
- return e[19] !== m || e[20] !== g ? (x = /* @__PURE__ */ b(De.Root, { closeDelay: 50, openDelay: 100, children: [
309
- m,
310
- g
311
- ] }), e[19] = m, e[20] = g, e[21] = x) : x = e[21], x;
531
+ return e[19] !== p || e[20] !== h ? (g = /* @__PURE__ */ k(Ye.Root, { closeDelay: 50, openDelay: 100, children: [
532
+ p,
533
+ h
534
+ ] }), e[19] = p, e[20] = h, e[21] = g) : g = e[21], g;
312
535
  }
313
- return f;
314
- }, Ln = (t) => {
315
- const e = y(73), {
536
+ return d;
537
+ }, zo = (t) => {
538
+ const e = S(91), {
316
539
  defaultState: n,
317
- onSubmit: r,
540
+ onSubmit: s,
318
541
  onInterrupt: o,
319
- streaming: s,
320
- attachedResources: l,
321
- onClearAttachments: a,
322
- isDisabled: c,
323
- onChange: d,
324
- placeholder: f,
325
- attachmentList: u,
326
- actions: p,
327
- attachedToTop: m
328
- } = t, g = r === void 0 ? Fn : r, x = s === void 0 ? !1 : s;
329
- let w;
330
- e[0] !== l ? (w = l === void 0 ? [] : l, e[0] = l, e[1] = w) : w = e[1];
331
- const v = w, L = c === void 0 ? !1 : c, J = m === void 0 ? !1 : m, [Q, xe] = me(!1), [C, ne] = me(n), [ye, re] = me(0);
332
- let F;
333
- e[2] !== n ? (F = () => Ye(n), e[2] = n, e[3] = F) : F = e[3];
334
- const [D, Se] = me(F), _e = Ze(null), ke = Ze(d);
335
- let oe, se;
336
- e[4] !== d ? (oe = () => {
337
- ke.current = d;
338
- }, se = [d], e[4] = d, e[5] = oe, e[6] = se) : (oe = e[5], se = e[6]), et(oe, se);
339
- let ie, M;
340
- e[7] !== n ? (M = () => {
341
- const T = Ye(n);
342
- ne(n), re(Wn), Se(T), ke.current?.(T);
343
- }, ie = [n], e[7] = n, e[8] = ie, e[9] = M) : (ie = e[8], M = e[9]), et(M, ie);
344
- let W;
345
- e[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (W = () => {
346
- const T = _e.current?.querySelector('[contenteditable="true"]');
347
- T instanceof HTMLElement && T.focus();
348
- }, e[10] = W) : W = e[10];
349
- const Z = W;
350
- let ee;
351
- e[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (ee = () => {
352
- xe(!0), Z();
353
- }, e[11] = ee) : ee = e[11];
354
- const Te = ee;
355
- let O;
356
- e[12] !== n ? (O = (T) => {
357
- const Wt = T === void 0 ? !1 : T;
358
- ne(n), re(On);
359
- const lt = Ye(n);
360
- Se(lt), ke.current?.(lt), Wt && requestAnimationFrame(() => {
361
- Z();
542
+ streaming: r,
543
+ attachedResources: i,
544
+ onClearAttachments: c,
545
+ isDisabled: a,
546
+ onChange: u,
547
+ placeholder: d,
548
+ attachmentList: f,
549
+ actions: m,
550
+ attachedToTop: p,
551
+ questionPrompt: h
552
+ } = t, g = s === void 0 ? Fo : s, b = r === void 0 ? !1 : r;
553
+ let y;
554
+ e[0] !== i ? (y = i === void 0 ? [] : i, e[0] = i, e[1] = y) : y = e[1];
555
+ const w = y, T = a === void 0 ? !1 : a, R = p === void 0 ? !1 : p, [C, B] = J(!1), [_, I] = J(n), [M, O] = J(0);
556
+ let E;
557
+ e[2] !== n ? (E = () => St(n), e[2] = n, e[3] = E) : E = e[3];
558
+ const [Q, ue] = J(E);
559
+ let oe;
560
+ e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (oe = {}, e[4] = oe) : oe = e[4];
561
+ const [D, be] = J(oe);
562
+ let xe;
563
+ e[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (xe = {}, e[5] = xe) : xe = e[5];
564
+ const [L, W] = J(xe), Be = Je(null), de = Je(u);
565
+ let H;
566
+ e[6] !== h ? (H = _t(h), e[6] = h, e[7] = H) : H = e[7];
567
+ const Qe = Je(H);
568
+ let se, re;
569
+ e[8] !== u ? (se = () => {
570
+ de.current = u;
571
+ }, re = [u], e[8] = u, e[9] = se, e[10] = re) : (se = e[9], re = e[10]), Ze(se, re);
572
+ let j, N;
573
+ e[11] !== n ? (j = () => {
574
+ const A = St(n);
575
+ I(n), O(Wo), ue(A), be({}), W({}), de.current?.(A);
576
+ }, N = [n], e[11] = n, e[12] = j, e[13] = N) : (j = e[12], N = e[13]), Ze(j, N);
577
+ let V;
578
+ e[14] !== h ? (V = _t(h), e[14] = h, e[15] = V) : V = e[15];
579
+ const U = V;
580
+ let q, v;
581
+ e[16] !== U ? (q = () => {
582
+ Qe.current !== U && (Qe.current = U, be({}), W({}));
583
+ }, v = [U], e[16] = U, e[17] = q, e[18] = v) : (q = e[17], v = e[18]), Ze(q, v);
584
+ let G;
585
+ e[19] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (G = () => {
586
+ const A = Be.current?.querySelector('[contenteditable="true"]');
587
+ A instanceof HTMLElement && A.focus();
588
+ }, e[19] = G) : G = e[19];
589
+ const fe = G;
590
+ let $;
591
+ e[20] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? ($ = () => {
592
+ B(!0), fe();
593
+ }, e[20] = $) : $ = e[20];
594
+ const Ie = $;
595
+ let K;
596
+ e[21] !== n ? (K = (A) => {
597
+ const Pe = A === void 0 ? !1 : A;
598
+ I(n), O(Ho);
599
+ const X = St(n);
600
+ ue(X), be({}), W({}), de.current?.(X), Pe && requestAnimationFrame(() => {
601
+ fe();
362
602
  });
363
- }, e[12] = n, e[13] = O) : O = e[13];
364
- const H = O, _ = x && !!o;
365
- let P, j;
366
- e[14] !== _ || e[15] !== L || e[16] !== x || e[17] !== D ? (P = {
367
- canInterrupt: _,
368
- isDisabled: L,
369
- streaming: x,
370
- text: D
371
- }, j = En(P), e[14] = _, e[15] = L, e[16] = x, e[17] = D, e[18] = P, e[19] = j) : (P = e[18], j = e[19]);
372
- const I = j;
373
- let A;
374
- e[20] !== v || e[21] !== a || e[22] !== g || e[23] !== H || e[24] !== D ? (A = () => {
375
- const T = D.trim();
376
- T && (g(T, v), H(!0), a?.());
377
- }, e[20] = v, e[21] = a, e[22] = g, e[23] = H, e[24] = D, e[25] = A) : A = e[25];
378
- const N = A;
379
- let z;
380
- e[26] !== o || e[27] !== N ? (z = (T) => {
381
- if (T === "interrupt") {
603
+ }, e[21] = n, e[22] = K) : K = e[22];
604
+ const rt = K, pe = b && !!o;
605
+ let me, ie, qe;
606
+ if (e[23] !== pe || e[24] !== L || e[25] !== T || e[26] !== h || e[27] !== D || e[28] !== b || e[29] !== Q) {
607
+ ie = h ? Mo(h, D, L) : Q.trim();
608
+ const A = Oo(h, D, L);
609
+ me = {
610
+ canInterrupt: pe,
611
+ isDisabled: T || A,
612
+ streaming: b,
613
+ text: ie
614
+ }, qe = To(me), e[23] = pe, e[24] = L, e[25] = T, e[26] = h, e[27] = D, e[28] = b, e[29] = Q, e[30] = me, e[31] = ie, e[32] = qe;
615
+ } else
616
+ me = e[30], ie = e[31], qe = e[32];
617
+ const ve = qe;
618
+ let ze;
619
+ e[33] !== w || e[34] !== L || e[35] !== c || e[36] !== g || e[37] !== h || e[38] !== rt || e[39] !== ie || e[40] !== D ? (ze = () => {
620
+ if (!ie)
621
+ return;
622
+ const A = h ? {
623
+ answers: $o(h, D, L)
624
+ } : void 0;
625
+ g(ie, w, A), rt(!0), c?.();
626
+ }, e[33] = w, e[34] = L, e[35] = c, e[36] = g, e[37] = h, e[38] = rt, e[39] = ie, e[40] = D, e[41] = ze) : ze = e[41];
627
+ const it = ze;
628
+ let Fe;
629
+ e[42] !== o || e[43] !== it ? (Fe = (A) => {
630
+ if (A === "interrupt") {
382
631
  o?.();
383
632
  return;
384
633
  }
385
- T === "submit" && N();
386
- }, e[26] = o, e[27] = N, e[28] = z) : z = e[28];
387
- const S = z;
388
- let B;
389
- e[29] !== P || e[30] !== S ? (B = () => {
390
- S(zn(P));
391
- }, e[29] = P, e[30] = S, e[31] = B) : B = e[31];
392
- const R = B;
393
- let le;
394
- e[32] !== I || e[33] !== S ? (le = () => {
395
- S(I);
396
- }, e[32] = I, e[33] = S, e[34] = le) : le = e[34];
397
- const Fe = le;
398
- let Pe;
399
- e[35] !== f ? (Pe = f ? /* @__PURE__ */ i(K, { textStyle: "label/M/regular", color: "fg.subtle", pointerEvents: "none", position: "absolute", top: "0", children: f }) : void 0, e[35] = f, e[36] = Pe) : Pe = e[36];
400
- const We = Pe, Oe = J ? "-1px" : void 0, He = J ? "0" : void 0, je = Q ? "blue.border" : "border.muted", Ne = Q ? "mid" : "low", Ue = Q ? 1 : 0, Ve = Q ? "blue.border" : "border";
401
- let ae;
402
- e[37] !== Ve ? (ae = {
403
- borderColor: Ve,
634
+ A === "submit" && it();
635
+ }, e[42] = o, e[43] = it, e[44] = Fe) : Fe = e[44];
636
+ const ye = Fe;
637
+ let We;
638
+ e[45] !== me || e[46] !== ye ? (We = () => {
639
+ ye(wo(me));
640
+ }, e[45] = me, e[46] = ye, e[47] = We) : We = e[47];
641
+ const lt = We;
642
+ let He;
643
+ e[48] !== ve || e[49] !== ye ? (He = () => {
644
+ ye(ve);
645
+ }, e[48] = ve, e[49] = ye, e[50] = He) : He = e[50];
646
+ const ct = He;
647
+ let je;
648
+ e[51] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (je = (A, Pe, X) => {
649
+ const Me = Z(A, Pe);
650
+ be(($e) => {
651
+ const yt = $e[Me] ?? [], Ot = yt.includes(X);
652
+ return A.multiple ? {
653
+ ...$e,
654
+ [Me]: Ot ? yt.filter((Sn) => Sn !== X) : [...yt, X]
655
+ } : {
656
+ ...$e,
657
+ [Me]: Ot ? [] : [X]
658
+ };
659
+ });
660
+ }, e[51] = je) : je = e[51];
661
+ const xn = je;
662
+ let Ne;
663
+ e[52] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Ne = (A, Pe, X) => {
664
+ const Me = Z(A, Pe);
665
+ W(($e) => ({
666
+ ...$e,
667
+ [Me]: X
668
+ }));
669
+ }, e[52] = Ne) : Ne = e[52];
670
+ const yn = Ne;
671
+ let Ve;
672
+ e[53] !== d ? (Ve = d ? /* @__PURE__ */ l(z, { textStyle: "label/M/regular", color: "fg.subtle", pointerEvents: "none", position: "absolute", top: "0", children: d }) : void 0, e[53] = d, e[54] = Ve) : Ve = e[54];
673
+ const at = Ve, ut = R ? "-1px" : void 0, dt = R ? "0" : void 0, ft = C ? "blue.border" : "border.muted", pt = C ? "mid" : "low", mt = C ? 1 : 0, ht = C ? "blue.border" : "border";
674
+ let Se;
675
+ e[55] !== ht ? (Se = {
676
+ borderColor: ht,
404
677
  boxShadow: "mid",
405
678
  zIndex: 1
406
- }, e[37] = Ve, e[38] = ae) : ae = e[38];
407
- let Re;
408
- e[39] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Re = {
679
+ }, e[55] = ht, e[56] = Se) : Se = e[56];
680
+ let Ue;
681
+ e[57] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Ue = {
409
682
  borderColor: "blue.border",
410
683
  boxShadow: "mid",
411
684
  zIndex: 1
412
- }, e[39] = Re) : Re = e[39];
413
- let Ie;
414
- e[40] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Ie = () => xe(!1), e[40] = Ie) : Ie = e[40];
415
- let Ae;
416
- e[41] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Ae = {
685
+ }, e[57] = Ue) : Ue = e[57];
686
+ let Ge;
687
+ e[58] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Ge = () => B(!1), e[58] = Ge) : Ge = e[58];
688
+ let ke;
689
+ e[59] !== L || e[60] !== M || e[61] !== _ || e[62] !== lt || e[63] !== T || e[64] !== u || e[65] !== at || e[66] !== h || e[67] !== D ? (ke = h ? /* @__PURE__ */ l(qo, { questionPrompt: h, selectedOptionsByQuestion: D, customAnswersByQuestion: L, onToggleOption: xn, onCustomAnswerChange: yn }) : /* @__PURE__ */ l(Gt, { maxH: "10rem", showHorizontalScrollbar: !1, contentProps: {
417
690
  pr: "2xs"
418
- }, e[41] = Ae) : Ae = e[41];
419
- const Ke = !L;
420
- let ce;
421
- e[42] !== d ? (ce = (T) => {
422
- Se(T), d?.(T);
423
- }, e[42] = d, e[43] = ce) : ce = e[43];
424
- let de;
425
- e[44] !== ye || e[45] !== C || e[46] !== R || e[47] !== We || e[48] !== Ke || e[49] !== ce ? (de = /* @__PURE__ */ i(wt, { maxH: "10rem", showHorizontalScrollbar: !1, contentProps: Ae, children: /* @__PURE__ */ i(gn, { defaultState: C, isEditable: Ke, placeholder: We, onChange: ce, onSubmit: R }, ye) }), e[44] = ye, e[45] = C, e[46] = R, e[47] = We, e[48] = Ke, e[49] = ce, e[50] = de) : de = e[50];
426
- let ve;
427
- e[51] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (ve = /* @__PURE__ */ i(Kt, {}), e[51] = ve) : ve = e[51];
428
- const qe = _ ? "Stop Response" : "Message Sending", Ge = x ? void 0 : "Enter", Xe = I === "none";
429
- let ue;
430
- e[52] !== _ || e[53] !== Fe || e[54] !== qe || e[55] !== Ge || e[56] !== Xe ? (ue = /* @__PURE__ */ i($n, { canInterrupt: _, title: qe, shortcut: Ge, onClick: Fe, disabled: Xe }), e[52] = _, e[53] = Fe, e[54] = qe, e[55] = Ge, e[56] = Xe, e[57] = ue) : ue = e[57];
431
- let fe;
432
- e[58] !== p || e[59] !== ue ? (fe = /* @__PURE__ */ b(ge, { gap: "1", mt: "md", children: [
433
- p,
434
- ve,
435
- ue
436
- ] }), e[58] = p, e[59] = ue, e[60] = fe) : fe = e[60];
437
- let pe;
438
- e[61] !== u || e[62] !== de || e[63] !== fe ? (pe = /* @__PURE__ */ b($, { direction: "column", color: "fg", children: [
439
- u,
440
- de,
441
- fe
442
- ] }), e[61] = u, e[62] = de, e[63] = fe, e[64] = pe) : pe = e[64];
443
- let Be;
444
- return e[65] !== Oe || e[66] !== He || e[67] !== je || e[68] !== Ne || e[69] !== Ue || e[70] !== ae || e[71] !== pe ? (Be = /* @__PURE__ */ i(k, { ref: _e, position: "relative", width: "100%", paddingX: "lg", paddingY: "md", mt: Oe, bg: "bg", borderRadius: "md", borderTopRadius: He, borderWidth: "1px", borderStyle: "solid", borderColor: je, boxShadow: Ne, zIndex: Ue, transition: "box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out", _hover: ae, _focusWithin: Re, onClick: Te, onBlur: Ie, children: pe }), e[65] = Oe, e[66] = He, e[67] = je, e[68] = Ne, e[69] = Ue, e[70] = ae, e[71] = pe, e[72] = Be) : Be = e[72], Be;
691
+ }, children: /* @__PURE__ */ l(to, { defaultState: _, isEditable: !T, placeholder: at, onChange: (A) => {
692
+ ue(A), u?.(A);
693
+ }, onSubmit: lt }, M) }), e[59] = L, e[60] = M, e[61] = _, e[62] = lt, e[63] = T, e[64] = u, e[65] = at, e[66] = h, e[67] = D, e[68] = ke) : ke = e[68];
694
+ let Ke;
695
+ e[69] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Ke = /* @__PURE__ */ l(Bn, {}), e[69] = Ke) : Ke = e[69];
696
+ const gt = pe ? "Stop Response" : "Message Sending", bt = b ? void 0 : "Enter", xt = ve === "none";
697
+ let we;
698
+ e[70] !== pe || e[71] !== ct || e[72] !== gt || e[73] !== bt || e[74] !== xt ? (we = /* @__PURE__ */ l(vo, { canInterrupt: pe, title: gt, shortcut: bt, onClick: ct, disabled: xt }), e[70] = pe, e[71] = ct, e[72] = gt, e[73] = bt, e[74] = xt, e[75] = we) : we = e[75];
699
+ let Te;
700
+ e[76] !== m || e[77] !== we ? (Te = /* @__PURE__ */ k(Re, { gap: "1", mt: "md", children: [
701
+ m,
702
+ Ke,
703
+ we
704
+ ] }), e[76] = m, e[77] = we, e[78] = Te) : Te = e[78];
705
+ let Ce;
706
+ e[79] !== f || e[80] !== ke || e[81] !== Te ? (Ce = /* @__PURE__ */ k(ae, { direction: "column", color: "fg", children: [
707
+ f,
708
+ ke,
709
+ Te
710
+ ] }), e[79] = f, e[80] = ke, e[81] = Te, e[82] = Ce) : Ce = e[82];
711
+ let Xe;
712
+ return e[83] !== ut || e[84] !== dt || e[85] !== ft || e[86] !== pt || e[87] !== mt || e[88] !== Se || e[89] !== Ce ? (Xe = /* @__PURE__ */ l(P, { ref: Be, position: "relative", width: "100%", paddingX: "lg", paddingY: "md", mt: ut, bg: "bg", borderRadius: "md", borderTopRadius: dt, borderWidth: "1px", borderStyle: "solid", borderColor: ft, boxShadow: pt, zIndex: mt, transition: "box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out", _hover: Se, _focusWithin: Ue, onClick: Ie, onBlur: Ge, children: Ce }), e[83] = ut, e[84] = dt, e[85] = ft, e[86] = pt, e[87] = mt, e[88] = Se, e[89] = Ce, e[90] = Xe) : Xe = e[90], Xe;
445
713
  };
446
- function Fn() {
714
+ function Fo() {
447
715
  }
448
- function Wn(t) {
716
+ function Wo(t) {
449
717
  return t + 1;
450
718
  }
451
- function On(t) {
719
+ function Ho(t) {
452
720
  return t + 1;
453
721
  }
454
- const Hn = (t = "") => JSON.stringify(bn(t)), jn = 360, Nn = "min(10vh, 4rem)", Un = (t) => t.parts.reduce((e, n) => n.type !== "text" ? e : e + n.text.length, 0), Vn = (t) => t.role !== "user" ? !1 : Un(t) > jn, Kn = (t) => {
455
- const e = y(8);
456
- let n, r;
722
+ const jo = (t = "") => JSON.stringify(no(t)), No = 360, Vo = 4, Uo = "min(10vh, 4rem)", tn = "min(70dvh, calc(100dvh - 12rem), 22rem)", wt = 1, Go = (t) => t.parts.reduce((e, n) => n.type !== "text" ? e : {
723
+ lineCount: e.lineCount + n.text.split(/\r\n|\r|\n/).length,
724
+ textLength: e.textLength + n.text.length
725
+ }, {
726
+ lineCount: 0,
727
+ textLength: 0
728
+ }), Ko = (t) => {
729
+ if (t.role !== "user") return !1;
730
+ const {
731
+ lineCount: e,
732
+ textLength: n
733
+ } = Go(t);
734
+ return n > No || e > Vo;
735
+ }, Xo = (t, e) => {
736
+ const n = Math.max(0, t.scrollHeight - t.clientHeight);
737
+ return e === 0 || n <= wt ? !1 : e < 0 ? t.scrollTop > wt : t.scrollTop < n - wt;
738
+ }, Yo = (t) => {
739
+ const e = S(8);
740
+ let n, s;
457
741
  e[0] !== t ? ({
458
742
  children: n,
459
- ...r
460
- } = t, e[0] = t, e[1] = n, e[2] = r) : (n = e[1], r = e[2]);
743
+ ...s
744
+ } = t, e[0] = t, e[1] = n, e[2] = s) : (n = e[1], s = e[2]);
461
745
  let o;
462
- e[3] !== n ? (o = /* @__PURE__ */ i(Ct, { defaultState: n, fullWidth: !0 }), e[3] = n, e[4] = o) : o = e[4];
463
- let s;
464
- return e[5] !== r || e[6] !== o ? (s = /* @__PURE__ */ i(k, { ...r, children: o }), e[5] = r, e[6] = o, e[7] = s) : s = e[7], s;
465
- }, qn = Kn, Rt = {
466
- shell: kt,
467
- ls: an,
468
- read_file: ln,
469
- write_file: sn,
470
- delete_file: on,
471
- patch: rn,
472
- upload_files: nn,
473
- download_file: tn,
474
- move_file: en
475
- }, Gn = {
476
- dot: fn,
477
- danger: Tt,
478
- search: un,
479
- browser: dn,
480
- file: cn,
481
- terminal: kt,
482
- ...Rt
483
- }, ut = "dot", Xn = (t) => Object.hasOwn(Rt, t), Yn = (t) => Gn[t], It = (t) => {
484
- if (!t) return ut;
485
- const e = t.replace(/^tool-/, "");
486
- if (Xn(e)) return e;
746
+ e[3] !== n ? (o = /* @__PURE__ */ l(Kt, { defaultState: n, fullWidth: !0 }), e[3] = n, e[4] = o) : o = e[4];
747
+ let r;
748
+ return e[5] !== s || e[6] !== o ? (r = /* @__PURE__ */ l(P, { ...s, children: o }), e[5] = s, e[6] = o, e[7] = r) : r = e[7], r;
749
+ }, Jo = Yo, nt = (t) => t.replace(/^tool-/i, "").replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[\s-]+/g, "_").toLowerCase(), Zo = (t) => {
750
+ const e = nt(t), n = e.replace(/_/g, "");
751
+ return [.../* @__PURE__ */ new Set([t, e, n])];
752
+ }, nn = {
753
+ shell: Vt,
754
+ ls: jn,
755
+ read_file: Hn,
756
+ write_file: Wn,
757
+ delete_file: Fn,
758
+ patch: zn,
759
+ upload_files: vn,
760
+ download_file: qn,
761
+ move_file: Qn
762
+ }, es = {
763
+ dot: Xn,
764
+ danger: Ut,
765
+ search: Kn,
766
+ browser: Gn,
767
+ file: Un,
768
+ question: Vn,
769
+ todo: Nn,
770
+ terminal: Vt,
771
+ ...nn
772
+ }, Lt = "dot", ts = (t) => Object.hasOwn(nn, t), ns = (t) => es[t], on = (t) => {
773
+ if (!t) return Lt;
774
+ const e = nt(t);
775
+ if (ts(e)) return e;
776
+ const n = e.replace(/_/g, "");
487
777
  switch (e) {
488
778
  case "read":
489
779
  return "file";
@@ -498,61 +788,63 @@ const Hn = (t = "") => JSON.stringify(bn(t)), jn = 360, Nn = "min(10vh, 4rem)",
498
788
  case "glob":
499
789
  return "file";
500
790
  case "todowrite":
501
- return "ls";
791
+ return "todo";
502
792
  case "search":
503
793
  return "search";
504
794
  case "browser":
505
795
  return "browser";
796
+ case "question":
797
+ return "question";
506
798
  case "fs":
507
799
  case "file":
508
800
  return "file";
509
801
  default:
510
- return ut;
802
+ return n === "todowrite" || n === "todo" ? "todo" : Lt;
511
803
  }
512
804
  };
513
- function ot(t) {
805
+ function Pt(t) {
514
806
  const e = t.lastIndexOf("/");
515
807
  return e >= 0 ? t.slice(e + 1) : t;
516
808
  }
517
- function Me(t) {
809
+ function et(t) {
518
810
  if (!t) return null;
519
811
  const e = t.split(" ")[0].trim();
520
812
  if (e === "/dev/null") return null;
521
813
  let n = e;
522
814
  return (n.startsWith("a/") || n.startsWith("b/")) && (n = n.slice(2)), n.replace(/^\/+/, "").replace(/\\/g, "/");
523
815
  }
524
- const Ee = (t) => t.startsWith("--- "), st = (t) => t.startsWith("+++ "), it = (t) => t.startsWith("@@"), Jn = (t) => t.startsWith("+") && !(st(t) || t === "+++"), Qn = (t) => t.startsWith("-") && !(Ee(t) || t === "---"), Zn = (t, e) => {
816
+ const ot = (t) => t.startsWith("--- "), Mt = (t) => t.startsWith("+++ "), $t = (t) => t.startsWith("@@"), os = (t) => t.startsWith("+") && !(Mt(t) || t === "+++"), ss = (t) => t.startsWith("-") && !(ot(t) || t === "---"), rs = (t, e) => {
525
817
  t.has(e) || t.set(e, {
526
818
  additions: 0,
527
819
  deletions: 0
528
820
  });
529
- }, er = (t, e) => {
821
+ }, is = (t, e) => {
530
822
  const n = t.get(e);
531
823
  n && (n.additions += 1);
532
- }, tr = (t, e) => {
824
+ }, ls = (t, e) => {
533
825
  const n = t.get(e);
534
826
  n && (n.deletions += 1);
535
- }, nr = (t, e, n) => {
536
- if (Ee(t))
827
+ }, cs = (t, e, n) => {
828
+ if (ot(t))
537
829
  return {
538
830
  ...e,
539
- lastMinusHeader: Me(t.slice(4)),
831
+ lastMinusHeader: et(t.slice(4)),
540
832
  inHunk: !1
541
833
  };
542
- if (st(t)) {
543
- const o = Me(t.slice(4)) ?? e.lastMinusHeader;
544
- return o && Zn(n, o), {
834
+ if (Mt(t)) {
835
+ const o = et(t.slice(4)) ?? e.lastMinusHeader;
836
+ return o && rs(n, o), {
545
837
  ...e,
546
838
  currentPath: o,
547
839
  inHunk: !1
548
840
  };
549
841
  }
550
- return e.currentPath ? it(t) ? {
842
+ return e.currentPath ? $t(t) ? {
551
843
  ...e,
552
844
  inHunk: !0
553
- } : e.inHunk ? Jn(t) ? (er(n, e.currentPath), e) : (Qn(t) && tr(n, e.currentPath), e) : e : e;
845
+ } : e.inHunk ? os(t) ? (is(n, e.currentPath), e) : (ss(t) && ls(n, e.currentPath), e) : e : e;
554
846
  };
555
- function At(t) {
847
+ function sn(t) {
556
848
  if (!t || typeof t != "string") return [];
557
849
  const e = /* @__PURE__ */ new Map();
558
850
  let n = {
@@ -560,34 +852,34 @@ function At(t) {
560
852
  lastMinusHeader: null,
561
853
  inHunk: !1
562
854
  };
563
- const r = t.split(/\r?\n/);
564
- for (const o of r)
565
- n = nr(o, n, e);
855
+ const s = t.split(/\r?\n/);
856
+ for (const o of s)
857
+ n = cs(o, n, e);
566
858
  return Array.from(e.entries()).map(([o, {
567
- additions: s,
568
- deletions: l
859
+ additions: r,
860
+ deletions: i
569
861
  }]) => ({
570
862
  filePath: o,
571
- additions: s,
572
- deletions: l
863
+ additions: r,
864
+ deletions: i
573
865
  }));
574
866
  }
575
- function rr(t) {
576
- return At(t).map((e) => ({
867
+ function as(t) {
868
+ return sn(t).map((e) => ({
577
869
  kind: "diff",
578
- fileName: ot(e.filePath),
870
+ fileName: Pt(e.filePath),
579
871
  filePath: e.filePath,
580
872
  additions: e.additions,
581
873
  deletions: e.deletions
582
874
  }));
583
875
  }
584
- function or(t) {
585
- return At(t).map((e) => e.filePath);
876
+ function us(t) {
877
+ return sn(t).map((e) => e.filePath);
586
878
  }
587
- const vt = (t) => Ee(t) || t.startsWith("diff --git "), sr = (t) => t.startsWith(" ") || t.startsWith("+") || t.startsWith("-") ? !1 : t.trim() !== "", ir = (t, e, n) => {
879
+ const rn = (t) => ot(t) || t.startsWith("diff --git "), ds = (t) => t.startsWith(" ") || t.startsWith("+") || t.startsWith("-") ? !1 : t.trim() !== "", fs = (t, e, n) => {
588
880
  if (t.startsWith(" ")) {
589
- const r = t.slice(1);
590
- e.push(r), n.push(r);
881
+ const s = t.slice(1);
882
+ e.push(s), n.push(s);
591
883
  return;
592
884
  }
593
885
  if (t.startsWith("-")) {
@@ -595,61 +887,61 @@ const vt = (t) => Ee(t) || t.startsWith("diff --git "), sr = (t) => t.startsWith
595
887
  return;
596
888
  }
597
889
  t.startsWith("+") && n.push(t.slice(1));
598
- }, lr = (t, e, n, r) => {
890
+ }, ps = (t, e, n, s) => {
599
891
  let o = e;
600
892
  for (; o < t.length; ) {
601
- const s = t[o] || "";
602
- if (vt(s) || it(s) || sr(s))
893
+ const r = t[o] || "";
894
+ if (rn(r) || $t(r) || ds(r))
603
895
  break;
604
- ir(s, n, r), o += 1;
896
+ fs(r, n, s), o += 1;
605
897
  }
606
- return (n.length > 0 || r.length > 0) && (n.push(""), r.push("")), o;
607
- }, ar = (t, e) => {
608
- const n = Me((t[e] || "").slice(4)), r = t[e + 1] || "";
609
- if (!st(r)) return {
898
+ return (n.length > 0 || s.length > 0) && (n.push(""), s.push("")), o;
899
+ }, ms = (t, e) => {
900
+ const n = et((t[e] || "").slice(4)), s = t[e + 1] || "";
901
+ if (!Mt(s)) return {
610
902
  nextIndex: e + 1
611
903
  };
612
- const s = Me(r.slice(4)) ?? n ?? "", l = [], a = [];
613
- let c = e + 2;
614
- for (; c < t.length; ) {
615
- const d = t[c] || "";
616
- if (vt(d)) break;
617
- if (!it(d)) {
618
- c += 1;
904
+ const r = et(s.slice(4)) ?? n ?? "", i = [], c = [];
905
+ let a = e + 2;
906
+ for (; a < t.length; ) {
907
+ const u = t[a] || "";
908
+ if (rn(u)) break;
909
+ if (!$t(u)) {
910
+ a += 1;
619
911
  continue;
620
912
  }
621
- c = lr(t, c + 1, l, a);
913
+ a = ps(t, a + 1, i, c);
622
914
  }
623
915
  return {
624
- nextIndex: c,
916
+ nextIndex: a,
625
917
  preview: {
626
- filePath: s,
627
- original: l.join(`
918
+ filePath: r,
919
+ original: i.join(`
628
920
  `),
629
- modified: a.join(`
921
+ modified: c.join(`
630
922
  `)
631
923
  }
632
924
  };
633
925
  };
634
- function cr(t) {
926
+ function hs(t) {
635
927
  if (!t || typeof t != "string") return [];
636
928
  const e = t.split(/\r?\n/), n = [];
637
- let r = 0;
638
- for (; r < e.length; ) {
639
- const o = e[r] || "";
640
- if (!Ee(o)) {
641
- r += 1;
929
+ let s = 0;
930
+ for (; s < e.length; ) {
931
+ const o = e[s] || "";
932
+ if (!ot(o)) {
933
+ s += 1;
642
934
  continue;
643
935
  }
644
936
  const {
645
- nextIndex: s,
646
- preview: l
647
- } = ar(e, r);
648
- l && n.push(l), r = Math.max(s, r + 1);
937
+ nextIndex: r,
938
+ preview: i
939
+ } = ms(e, s);
940
+ i && n.push(i), s = Math.max(r, s + 1);
649
941
  }
650
942
  return n;
651
943
  }
652
- const dr = {
944
+ const gs = {
653
945
  apply_patch: "Apply patch",
654
946
  bash: "Run command",
655
947
  edit: "Edit file",
@@ -658,7 +950,7 @@ const dr = {
658
950
  read: "Read file",
659
951
  skill: "Load skill",
660
952
  todowrite: "Update todos"
661
- }, ft = {
953
+ }, Qt = {
662
954
  pending: "queued",
663
955
  error: "failed",
664
956
  "output-error": "failed",
@@ -667,27 +959,27 @@ const dr = {
667
959
  running: "running",
668
960
  completed: "completed",
669
961
  failed: "failed"
670
- }, $e = (t) => t.replace(/^tool-/, "").toLowerCase(), ur = (t) => t.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), fr = (t) => $e(t.tool ?? "tool"), pr = (t) => {
671
- const e = $e(t);
672
- return dr[e] ?? ur(e.replace(/_/g, " "));
673
- }, mr = (t) => {
962
+ }, ln = (t) => t.replace(/^tool-/, "").toLowerCase(), bs = (t) => t.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), xs = (t) => ln(t.tool ?? "tool"), ys = (t) => {
963
+ const e = ln(t);
964
+ return gs[e] ?? bs(e.replace(/_/g, " "));
965
+ }, Ss = (t) => {
674
966
  const e = t.state?.status ?? t.status;
675
967
  if (!e || typeof e != "string") return null;
676
968
  const n = e.replace(/-/g, "_");
677
- return ft[n] ? ft[n] : n.includes("stream") ? "running" : null;
678
- }, Bt = (t) => {
969
+ return Qt[n] ? Qt[n] : n.includes("stream") ? "running" : null;
970
+ }, cn = (t) => {
679
971
  const e = t.state?.status ?? t.status;
680
972
  return e === "error" || e === "output-error" || e === "failed";
681
- }, q = (t) => Bt(t) ? {
973
+ }, ee = (t) => cn(t) ? {
682
974
  type: "icon",
683
975
  icon: "danger"
684
976
  } : {
685
977
  type: "icon",
686
- icon: It(fr(t))
687
- }, G = (t, e, n) => {
978
+ icon: on(xs(t))
979
+ }, te = (t, e, n) => {
688
980
  const o = [{
689
981
  kind: "text",
690
- text: n ?? pr(t.tool ?? "tool"),
982
+ text: n ?? ys(t.tool ?? "tool"),
691
983
  bold: !0
692
984
  }];
693
985
  e && o.push({
@@ -695,258 +987,354 @@ const dr = {
695
987
  text: e,
696
988
  muted: !0
697
989
  });
698
- const s = mr(t);
699
- return s && s !== "completed" && o.push({
990
+ const r = Ss(t);
991
+ return r && r !== "completed" && o.push({
700
992
  kind: "text",
701
- text: s,
993
+ text: r,
702
994
  muted: !0
703
995
  }), o;
704
- }, X = (t) => {
996
+ }, ge = (t) => {
705
997
  const e = t.state?.input;
706
998
  return !e || typeof e != "object" || Array.isArray(e) ? null : e;
707
- }, be = (t) => {
999
+ }, De = (t) => {
708
1000
  const e = t.state?.output;
709
1001
  return !e || typeof e != "object" || Array.isArray(e) ? null : e;
710
- }, h = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, ze = (t) => !t || typeof t != "object" || Array.isArray(t) ? null : t, hr = (t, e) => {
711
- const n = ze(t.state);
712
- return n ? ze(n[e]) : null;
713
- }, gr = (t) => t.replace(/\\/g, "/").replace(/^\/+/, ""), br = (t) => t.includes("--- ") && t.includes("+++ ") && t.includes("@@"), Dt = (t) => {
714
- const e = be(t);
715
- return [hr(t, "metadata"), ze(e?.metadata)].filter(Boolean);
716
- }, xr = (t) => {
717
- const e = ze(t);
1002
+ }, x = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, tt = (t) => !t || typeof t != "object" || Array.isArray(t) ? null : t, ks = (t, e) => {
1003
+ const n = tt(t.state);
1004
+ return n ? tt(n[e]) : null;
1005
+ }, ws = (t) => t.replace(/\\/g, "/").replace(/^\/+/, ""), Ts = (t) => t.includes("--- ") && t.includes("+++ ") && t.includes("@@"), an = (t) => {
1006
+ const e = De(t);
1007
+ return [ks(t, "metadata"), tt(e?.metadata)].filter(Boolean);
1008
+ }, Cs = (t) => {
1009
+ const e = tt(t);
718
1010
  if (!e) return null;
719
- const n = h(e.filePath) ?? h(e.relativePath) ?? h(e.path);
1011
+ const n = x(e.filePath) ?? x(e.relativePath) ?? x(e.path);
720
1012
  return n ? {
721
- filePath: gr(n),
1013
+ filePath: ws(n),
722
1014
  additions: typeof e.additions == "number" ? e.additions : 0,
723
1015
  deletions: typeof e.deletions == "number" ? e.deletions : 0,
724
- diff: h(e.diff) ?? void 0,
725
- before: h(e.before) ?? void 0,
726
- after: h(e.after) ?? void 0
1016
+ diff: x(e.diff) ?? void 0,
1017
+ before: x(e.before) ?? void 0,
1018
+ after: x(e.after) ?? void 0
727
1019
  } : null;
728
- }, Mt = (t) => {
1020
+ }, un = (t) => {
729
1021
  const e = [];
730
- for (const n of Dt(t)) {
731
- const r = Array.isArray(n.files) ? n.files : [];
732
- for (const o of r) {
733
- const s = xr(o);
734
- s && e.push(s);
1022
+ for (const n of an(t)) {
1023
+ const s = Array.isArray(n.files) ? n.files : [];
1024
+ for (const o of s) {
1025
+ const r = Cs(o);
1026
+ r && e.push(r);
735
1027
  }
736
1028
  }
737
1029
  return e;
738
- }, yr = (t) => {
739
- const e = X(t), n = h(e?.diff);
1030
+ }, _s = (t) => {
1031
+ const e = ge(t), n = x(e?.diff);
740
1032
  if (n) return n;
741
- for (const s of Dt(t)) {
742
- const l = h(s.diff);
743
- if (l) return l;
1033
+ for (const r of an(t)) {
1034
+ const i = x(r.diff);
1035
+ if (i) return i;
744
1036
  }
745
- const r = Mt(t).map((s) => s.diff).filter((s) => !!s);
746
- if (r.length > 0) return r.join(`
1037
+ const s = un(t).map((r) => r.diff).filter((r) => !!r);
1038
+ if (s.length > 0) return s.join(`
747
1039
  `);
748
- const o = h(e?.patchText);
749
- return o && br(o) ? o : null;
750
- }, Sr = (t) => {
1040
+ const o = x(e?.patchText);
1041
+ return o && Ts(o) ? o : null;
1042
+ }, As = (t) => {
751
1043
  const e = /* @__PURE__ */ new Set(), n = [];
752
- for (const r of t)
753
- e.has(r.filePath) || (e.add(r.filePath), n.push({
1044
+ for (const s of t)
1045
+ e.has(s.filePath) || (e.add(s.filePath), n.push({
754
1046
  kind: "diff",
755
- fileName: ot(r.filePath),
756
- filePath: r.filePath,
757
- additions: r.additions,
758
- deletions: r.deletions
1047
+ fileName: Pt(s.filePath),
1048
+ filePath: s.filePath,
1049
+ additions: s.additions,
1050
+ deletions: s.deletions
759
1051
  }));
760
1052
  return n;
761
- }, kr = (t) => Array.from(new Set(t.map((e) => e.filePath))), Le = (t) => {
762
- const e = be(t);
763
- return h(t.state?.output) ?? h(e?.returnDisplay) ?? h(e?.preview) ?? h(e?.stdout) ?? h(e?.content);
764
- }, Tr = (t) => {
1053
+ }, Rs = (t) => Array.from(new Set(t.map((e) => e.filePath))), st = (t) => {
1054
+ const e = De(t);
1055
+ return x(t.state?.output) ?? x(e?.returnDisplay) ?? x(e?.preview) ?? x(e?.stdout) ?? x(e?.content);
1056
+ }, Bs = (t) => {
765
1057
  const e = t.match(/<skill_content(?:\s+name="([^"]+)")?>([\s\S]*?)<\/skill_content>/);
766
1058
  return e ? {
767
- skillName: h(e[1]) ?? void 0,
768
- content: h(e[2]) ?? ""
1059
+ skillName: x(e[1]) ?? void 0,
1060
+ content: x(e[2]) ?? ""
769
1061
  } : null;
770
- }, wr = (t) => {
771
- const e = X(t);
772
- return h(e?.name) ?? h(e?.skillName) ?? h(e?.skill) ?? h(e?.skill_name) ?? void 0;
773
- }, zt = (t) => ({
1062
+ }, Is = (t) => {
1063
+ const e = ge(t);
1064
+ return x(e?.name) ?? x(e?.skillName) ?? x(e?.skill) ?? x(e?.skill_name) ?? void 0;
1065
+ }, dn = (t) => ({
774
1066
  kind: "link",
775
- text: ot(t),
1067
+ text: Pt(t),
776
1068
  filePath: t
777
- }), Y = (t, e) => !Bt(t) || !t.state?.errorText ? e : [{
1069
+ }), ne = (t, e) => !cn(t) || !t.state?.errorText ? e : [{
778
1070
  type: "comment",
779
1071
  text: t.state.errorText
780
- }, ...e], Et = (t) => cr(t ?? void 0).map((e) => ({
1072
+ }, ...e], fn = (t) => hs(t ?? void 0).map((e) => ({
781
1073
  type: "diff",
782
1074
  language: "diff",
783
1075
  original: e.original,
784
1076
  modified: e.modified,
785
1077
  sideBySide: !1
786
- })), Cr = (t) => rr(t ?? void 0), _r = (t) => or(t ?? void 0), Pr = (t) => {
787
- const e = yr(t), n = Mt(t), r = G(t, void 0, "Apply patch"), o = Cr(e);
788
- o.length > 0 ? r.push(...o) : r.push(...Sr(n));
789
- const s = [...Et(e)];
790
- if (s.length === 0)
791
- for (const l of n)
792
- !l.before && !l.after || s.push({
1078
+ })), Ps = (t) => as(t ?? void 0), Ms = (t) => us(t ?? void 0), $s = (t) => {
1079
+ const e = _s(t), n = un(t), s = te(t, void 0, "Apply patch"), o = Ps(e);
1080
+ o.length > 0 ? s.push(...o) : s.push(...As(n));
1081
+ const r = [...fn(e)];
1082
+ if (r.length === 0)
1083
+ for (const i of n)
1084
+ !i.before && !i.after || r.push({
793
1085
  type: "diff",
794
1086
  language: "diff",
795
- original: l.before ?? "",
796
- modified: l.after ?? "",
1087
+ original: i.before ?? "",
1088
+ modified: i.after ?? "",
797
1089
  sideBySide: !1
798
1090
  });
799
- if (s.length === 0) {
800
- const l = _r(e);
801
- l.length === 0 && l.push(...kr(n)), l.length > 0 && s.push({
1091
+ if (r.length === 0) {
1092
+ const i = Ms(e);
1093
+ i.length === 0 && i.push(...Rs(n)), i.length > 0 && r.push({
802
1094
  type: "references",
803
- references: l
1095
+ references: i
804
1096
  });
805
1097
  }
806
1098
  return {
807
- indicator: q(t),
808
- title: r,
809
- blocks: Y(t, s)
1099
+ indicator: ee(t),
1100
+ title: s,
1101
+ blocks: ne(t, r)
810
1102
  };
811
- }, Rr = (t, e) => [{
1103
+ }, Os = (t, e) => [{
812
1104
  type: "diff",
813
1105
  language: "text",
814
1106
  original: t,
815
1107
  modified: e,
816
1108
  sideBySide: !1
817
- }], Ir = (t) => {
818
- const e = X(t), n = be(t), r = h(e?.filePath) ?? h(e?.file_path) ?? h(n?.filePath) ?? void 0, o = h(n?.oldString) ?? h(e?.old_string) ?? void 0, s = h(n?.newString) ?? h(e?.new_string) ?? void 0, l = G(t, void 0, "Edit file");
819
- r && l.push(zt(r));
820
- const a = o !== void 0 && s !== void 0 ? Rr(o, s) : Et(h(n?.diff));
1109
+ }], Es = (t) => {
1110
+ const e = ge(t), n = De(t), s = x(e?.filePath) ?? x(e?.file_path) ?? x(n?.filePath) ?? void 0, o = x(n?.oldString) ?? x(e?.old_string) ?? void 0, r = x(n?.newString) ?? x(e?.new_string) ?? void 0, i = te(t, void 0, "Edit file");
1111
+ s && i.push(dn(s));
1112
+ const c = o !== void 0 && r !== void 0 ? Os(o, r) : fn(x(n?.diff));
821
1113
  return {
822
- indicator: q(t),
823
- title: l,
824
- blocks: Y(t, a)
1114
+ indicator: ee(t),
1115
+ title: i,
1116
+ blocks: ne(t, c)
1117
+ };
1118
+ }, Le = (t) => typeof t == "object" && t !== null && !Array.isArray(t), Ds = (t) => {
1119
+ try {
1120
+ const e = JSON.parse(t);
1121
+ return Le(e) ? e : null;
1122
+ } catch {
1123
+ return null;
1124
+ }
1125
+ }, Ls = (t) => Le(t) ? t : typeof t == "string" && t.trim().length > 0 ? Ds(t) : null, Ae = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, he = (t) => {
1126
+ const e = Ae(t);
1127
+ if (e) return e;
1128
+ if (Array.isArray(t)) {
1129
+ const n = t.map(he).filter((s) => s !== null);
1130
+ return n.length > 0 ? n.join(`
1131
+ `) : null;
1132
+ }
1133
+ return Le(t) ? he(t.response) ?? he(t.answer) ?? he(t.text) ?? he(t.answers) : null;
1134
+ }, Qs = (t) => {
1135
+ if (typeof t == "string" && t.trim().length > 0)
1136
+ return {
1137
+ label: t,
1138
+ description: void 0
1139
+ };
1140
+ if (!Le(t)) return null;
1141
+ const e = Ae(t.label);
1142
+ return e ? {
1143
+ label: e,
1144
+ description: Ae(t.description) ?? void 0
1145
+ } : null;
1146
+ }, qs = (t, e) => {
1147
+ if (!Le(t)) return null;
1148
+ const n = Ae(t.question);
1149
+ if (!n) return null;
1150
+ const s = Array.isArray(t.options) ? t.options.map(Qs).filter((i) => i !== null) : [], o = Ae(t.type), r = typeof t.custom == "boolean" ? t.custom : typeof t.allowCustomAnswer == "boolean" ? t.allowCustomAnswer : o === "freeform" || o === "text";
1151
+ return s.length === 0 && !r ? null : {
1152
+ id: Ae(t.id) ?? `question-${e}`,
1153
+ question: n,
1154
+ options: s,
1155
+ multiple: typeof t.multiple == "boolean" ? t.multiple : o === "multi_choice" || o === "multiple_choice",
1156
+ required: typeof t.required == "boolean" ? t.required : !1,
1157
+ allowCustomAnswer: r
1158
+ };
1159
+ }, vs = (t) => {
1160
+ const e = Ls(t);
1161
+ if (!e || !Array.isArray(e.questions)) return null;
1162
+ const n = e.questions.map(qs).filter((s) => s !== null);
1163
+ return n.length === 0 ? null : {
1164
+ type: "question-form",
1165
+ questions: n
1166
+ };
1167
+ }, zs = (t) => {
1168
+ const {
1169
+ buildBaseTitle: e,
1170
+ buildIndicator: n,
1171
+ prependErrorBlock: s
1172
+ } = t;
1173
+ return (o) => {
1174
+ const r = he(o.state?.output) ?? he(o.state?.metadata), i = vs(o.state?.input);
1175
+ if (!r && !i) return null;
1176
+ const c = i ? `${i.questions.length} field${i.questions.length === 1 ? "" : "s"}` : void 0, a = r ? [] : [i];
1177
+ return {
1178
+ indicator: n(o),
1179
+ title: e(o, c, "Question"),
1180
+ blocks: s(o, a),
1181
+ expandable: !1
1182
+ };
825
1183
  };
826
- }, Ar = (t) => {
827
- const e = X(t), n = be(t), r = h(e?.filePath) ?? h(e?.file_path) ?? h(e?.file) ?? h(n?.filePath) ?? h(n?.file) ?? h(n?.path) ?? void 0, o = G(t, void 0, "Read file");
828
- return r && o.push(zt(r)), {
829
- indicator: q(t),
1184
+ }, Fs = (t) => {
1185
+ const e = ge(t), n = De(t), s = x(e?.filePath) ?? x(e?.file_path) ?? x(e?.file) ?? x(n?.filePath) ?? x(n?.file) ?? x(n?.path) ?? void 0, o = te(t, void 0, "Read file");
1186
+ return s && o.push(dn(s)), {
1187
+ indicator: ee(t),
830
1188
  title: o,
831
- blocks: Y(t, [])
1189
+ blocks: ne(t, [])
832
1190
  };
833
- }, vr = (t) => {
834
- const e = X(t), n = be(t), r = h(e?.command) ?? void 0, o = G(t, r, "Run command"), s = [], l = Le(t);
835
- l && s.push({
1191
+ }, Ws = (t) => {
1192
+ const e = ge(t), n = De(t), s = x(e?.command) ?? void 0, o = te(t, s, "Run command"), r = [], i = st(t);
1193
+ i && r.push({
836
1194
  type: "code",
837
1195
  language: "text",
838
- code: l
1196
+ code: i
839
1197
  });
840
- const a = h(n?.stderr);
841
- return a && a !== l && s.push({
1198
+ const c = x(n?.stderr);
1199
+ return c && c !== i && r.push({
842
1200
  type: "code",
843
1201
  language: "text",
844
- code: a
845
- }), typeof n?.exitCode == "number" && s.push({
1202
+ code: c
1203
+ }), typeof n?.exitCode == "number" && r.push({
846
1204
  type: "text",
847
1205
  text: `Exit code: ${n.exitCode}`
848
1206
  }), {
849
- indicator: q(t),
1207
+ indicator: ee(t),
850
1208
  title: o,
851
- blocks: Y(t, s)
1209
+ blocks: ne(t, r)
852
1210
  };
853
- }, Br = (t) => {
854
- const e = X(t), n = Le(t), r = h(e?.pattern) ?? void 0, o = G(t, r, "Search files"), s = n ? [{
1211
+ }, Hs = (t) => {
1212
+ const e = ge(t), n = st(t), s = x(e?.pattern) ?? void 0, o = te(t, s, "Search files"), r = n ? [{
855
1213
  type: "code",
856
1214
  language: "text",
857
1215
  code: n
858
1216
  }] : [];
859
1217
  return {
860
- indicator: q(t),
1218
+ indicator: ee(t),
861
1219
  title: o,
862
- blocks: Y(t, s)
1220
+ blocks: ne(t, r)
863
1221
  };
864
- }, Dr = (t) => {
865
- const e = X(t), n = Le(t), r = h(e?.pattern) ?? void 0, o = G(t, r, "Find files"), s = [];
1222
+ }, js = (t) => {
1223
+ const e = ge(t), n = st(t), s = x(e?.pattern) ?? void 0, o = te(t, s, "Find files"), r = [];
866
1224
  if (n) {
867
- const l = n.split(/\r?\n/).map((a) => a.trim()).filter((a) => a.length > 0);
868
- l.length > 0 && s.push({
1225
+ const i = n.split(/\r?\n/).map((c) => c.trim()).filter((c) => c.length > 0);
1226
+ i.length > 0 && r.push({
869
1227
  type: "references",
870
- references: l
1228
+ references: i
871
1229
  });
872
1230
  }
873
1231
  return {
874
- indicator: q(t),
1232
+ indicator: ee(t),
875
1233
  title: o,
876
- blocks: Y(t, s)
1234
+ blocks: ne(t, r)
877
1235
  };
878
- }, Mr = (t) => {
879
- const e = Le(t), n = e ? Tr(e) : null, r = wr(t) ?? n?.skillName, o = G(t, r, "Load skill"), s = n?.content ?? e, l = s ? [{
1236
+ }, Ns = (t) => {
1237
+ const e = st(t), n = e ? Bs(e) : null, s = Is(t) ?? n?.skillName, o = te(t, s, "Load skill"), r = n?.content ?? e, i = r ? [{
880
1238
  type: "code",
881
1239
  language: "markdown",
882
- code: s
1240
+ code: r
883
1241
  }] : [];
884
1242
  return {
885
- indicator: q(t),
1243
+ indicator: ee(t),
886
1244
  title: o,
887
- blocks: Y(t, l)
1245
+ blocks: ne(t, i)
888
1246
  };
889
- }, zr = (t) => {
890
- const e = be(t), n = X(t), r = [e?.newTodos, e?.todos, n?.todos];
891
- for (const o of r) {
892
- if (!Array.isArray(o)) continue;
893
- const s = [];
894
- for (const l of o) {
895
- if (!l || typeof l != "object" || Array.isArray(l)) continue;
896
- const a = l;
897
- typeof a.content != "string" || a.content.trim().length === 0 || s.push({
898
- content: a.content,
899
- status: typeof a.status == "string" ? a.status : void 0,
900
- priority: typeof a.priority == "string" ? a.priority : void 0
901
- });
902
- }
903
- if (s.length > 0) return s;
904
- }
905
- return [];
906
- }, pt = (t) => t?.replace(/_/g, " ") ?? null, Er = (t) => {
907
- const e = zr(t);
1247
+ }, Tt = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, pn = (t) => !t || typeof t != "object" || Array.isArray(t) ? null : t, Vs = (t) => {
1248
+ const e = pn(t);
1249
+ if (!e) return null;
1250
+ const n = Tt(e.content) ?? Tt(e.title);
1251
+ if (!n) return null;
1252
+ const s = Tt(e.status);
908
1253
  return {
909
- indicator: q(t),
910
- title: G(t, void 0, "Update todos"),
911
- blocks: Y(t, [{
912
- type: "component",
913
- render: () => /* @__PURE__ */ i(te, { gap: "sm", children: e.map((n) => {
914
- const r = pt(n.status), o = pt(n.priority);
915
- return /* @__PURE__ */ i(k, { borderWidth: "1px", borderRadius: "md", p: "sm", children: /* @__PURE__ */ b(te, { gap: "xs", children: [
916
- /* @__PURE__ */ i(K, { textStyle: "label/M/regular", children: n.content }),
917
- /* @__PURE__ */ b(ge, { gap: "xs", wrap: "wrap", children: [
918
- r ? /* @__PURE__ */ i(ct, { variant: "outline", children: r }) : null,
919
- o ? /* @__PURE__ */ i(ct, { variant: "subtle", children: o }) : null
920
- ] })
921
- ] }) }, `${n.content}-${n.status}-${n.priority}`);
922
- }) })
923
- }])
1254
+ label: n,
1255
+ checked: s === "completed"
1256
+ };
1257
+ }, qt = (t) => {
1258
+ if (!t) return {
1259
+ items: [],
1260
+ explicit: !1
1261
+ };
1262
+ const e = (() => {
1263
+ if (Array.isArray(t)) return t;
1264
+ const n = pn(t);
1265
+ return !n || !Array.isArray(n.todos) ? null : n.todos;
1266
+ })();
1267
+ return e ? {
1268
+ items: e.map(Vs).filter((n) => n !== null),
1269
+ explicit: !0
1270
+ } : {
1271
+ items: [],
1272
+ explicit: !1
1273
+ };
1274
+ }, Us = (t) => {
1275
+ const {
1276
+ buildBaseTitle: e,
1277
+ buildIndicator: n,
1278
+ prependErrorBlock: s
1279
+ } = t;
1280
+ return (o) => {
1281
+ const r = qt(o.state?.input), i = qt(o.state?.output), c = i.explicit ? i : r;
1282
+ if (!c.explicit) return null;
1283
+ const a = c.items, u = `${a.length} item${a.length === 1 ? "" : "s"}`, d = e(o, u, "Update todos");
1284
+ if (a.length === 0)
1285
+ return {
1286
+ indicator: n(o),
1287
+ title: d,
1288
+ blocks: s(o, [{
1289
+ type: "comment",
1290
+ text: "No todos"
1291
+ }])
1292
+ };
1293
+ const f = [{
1294
+ type: "todo-list",
1295
+ items: a
1296
+ }];
1297
+ return {
1298
+ indicator: n(o),
1299
+ title: d,
1300
+ blocks: s(o, f)
1301
+ };
924
1302
  };
925
- }, mt = () => ({
926
- apply_patch: Pr,
927
- bash: vr,
928
- edit: Ir,
929
- glob: Dr,
930
- grep: Br,
931
- read: Ar,
932
- skill: Mr,
933
- todowrite: Er
934
- }), ht = {
1303
+ }, Gs = zs({
1304
+ buildBaseTitle: te,
1305
+ buildIndicator: ee,
1306
+ prependErrorBlock: ne
1307
+ }), vt = Us({
1308
+ buildBaseTitle: te,
1309
+ buildIndicator: ee,
1310
+ prependErrorBlock: ne
1311
+ }), zt = () => ({
1312
+ apply_patch: $s,
1313
+ bash: Ws,
1314
+ edit: Es,
1315
+ glob: js,
1316
+ grep: Hs,
1317
+ question: Gs,
1318
+ read: Fs,
1319
+ skill: Ns,
1320
+ todo_write: vt,
1321
+ todowrite: vt
1322
+ }), Ft = {
935
1323
  pending: "queued",
936
1324
  error: "failed",
937
1325
  "output-error": "failed",
938
1326
  "input-streaming": "running",
939
1327
  "input-available": "queued"
940
- }, $r = (t) => t.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), Lr = (t) => {
941
- const e = $e(t ?? "tool").replace(/_/g, " ");
942
- return $r(e);
943
- }, $t = (t) => t === "error" || t === "output-error", Fr = (t) => $t(t.state?.status) ? {
1328
+ }, Ks = (t) => t.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), Xs = (t) => {
1329
+ const e = nt(t ?? "tool").replace(/_/g, " ");
1330
+ return Ks(e);
1331
+ }, mn = (t) => t === "error" || t === "output-error", Ys = (t) => mn(t.state?.status) ? {
944
1332
  type: "icon",
945
1333
  icon: "danger"
946
1334
  } : {
947
1335
  type: "icon",
948
- icon: It(t.tool ?? "tool")
949
- }, Wr = (t) => !t || typeof t != "string" ? null : ht[t] ? ht[t] : t.includes("stream") ? "running" : null, gt = (t) => {
1336
+ icon: on(t.tool ?? "tool")
1337
+ }, Js = (t) => !t || typeof t != "string" ? null : Ft[t] ? Ft[t] : t.includes("stream") ? "running" : null, Wt = (t) => {
950
1338
  if (typeof t == "string") return t;
951
1339
  if (t == null) return null;
952
1340
  try {
@@ -954,326 +1342,359 @@ const dr = {
954
1342
  } catch {
955
1343
  return null;
956
1344
  }
957
- }, Or = (t) => {
1345
+ }, Zs = (t) => {
958
1346
  const e = [];
959
- $t(t.state?.status) && t.state?.errorText && e.push({
1347
+ mn(t.state?.status) && t.state?.errorText && e.push({
960
1348
  type: "comment",
961
1349
  text: t.state.errorText
962
1350
  });
963
- const n = gt(t.state?.input);
1351
+ const n = Wt(t.state?.input);
964
1352
  n && e.push({
965
1353
  type: "code",
966
1354
  language: "json",
967
1355
  code: n
968
1356
  });
969
- const r = gt(t.state?.output);
970
- return r && e.push({
1357
+ const s = Wt(t.state?.output);
1358
+ return s && e.push({
971
1359
  type: "code",
972
1360
  language: "json",
973
- code: r
1361
+ code: s
974
1362
  }), e;
975
- }, Hr = (t) => {
1363
+ }, er = (t) => {
976
1364
  const e = [{
977
1365
  kind: "text",
978
- text: Lr(t.tool),
1366
+ text: Xs(t.tool),
979
1367
  bold: !0
980
- }], n = Wr(t.state?.status);
1368
+ }], n = Js(t.state?.status);
981
1369
  return n && e.push({
982
1370
  kind: "text",
983
1371
  text: n,
984
1372
  muted: !0
985
1373
  }), {
986
- indicator: Fr(t),
1374
+ indicator: Ys(t),
987
1375
  title: e,
988
- blocks: Or(t)
1376
+ blocks: Zs(t)
989
1377
  };
990
- }, jr = (t) => t ? {
991
- ...mt(),
1378
+ }, tr = (t) => t ? {
1379
+ ...zt(),
992
1380
  ...t
993
- } : mt(), Nr = (t, e) => {
1381
+ } : zt(), nr = (t, e) => {
994
1382
  const n = t.tool ?? "tool";
995
- return e[n] ?? e[$e(n)];
996
- }, Ur = (t, e, n) => {
997
- const r = Nr(t, e);
998
- if (r) {
999
- const o = r(t, n);
1383
+ for (const s of Zo(n)) {
1384
+ const o = e[s];
1385
+ if (o) return o;
1386
+ }
1387
+ }, or = (t, e, n) => {
1388
+ const s = nr(t, e);
1389
+ if (s) {
1390
+ const o = s(t, n);
1000
1391
  if (o) return o;
1001
1392
  }
1002
- return Hr(t);
1003
- }, Vr = (t, e) => {
1004
- const n = jr(e?.toolRenderers);
1393
+ return er(t);
1394
+ }, sr = (t, e) => {
1395
+ const n = tr(e?.toolRenderers);
1005
1396
  return {
1006
- items: t.map((o) => Ur(o, n, e))
1397
+ items: t.map((o) => or(o, n, e))
1007
1398
  };
1008
- }, U = qt, Lt = (t, e, n, r = !1) => {
1009
- r && t.stopPropagation(), e.href || t.preventDefault(), e.filePath && n?.(e.filePath);
1399
+ }, le = In, hn = (t, e, n, s = !1) => {
1400
+ s && t.stopPropagation(), e.href || t.preventDefault(), e.filePath && n?.(e.filePath);
1010
1401
  };
1011
- function Kr(t) {
1012
- const e = y(6), {
1402
+ function rr(t) {
1403
+ const e = S(6), {
1013
1404
  seg: n
1014
1405
  } = t;
1015
- let r;
1016
- e[0] !== n.alt || e[1] !== n.src ? (r = /* @__PURE__ */ i(he.Image, { src: n.src, alt: n.alt }), e[0] = n.alt, e[1] = n.src, e[2] = r) : r = e[2];
1017
- let o;
1018
- e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ i(he.Fallback, {}), e[3] = o) : o = e[3];
1019
1406
  let s;
1020
- return e[4] !== r ? (s = /* @__PURE__ */ b(he.Root, { width: "1.5rem", height: "1.5rem", children: [
1021
- r,
1407
+ e[0] !== n.alt || e[1] !== n.src ? (s = /* @__PURE__ */ l(_e.Image, { src: n.src, alt: n.alt }), e[0] = n.alt, e[1] = n.src, e[2] = s) : s = e[2];
1408
+ let o;
1409
+ e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ l(_e.Fallback, {}), e[3] = o) : o = e[3];
1410
+ let r;
1411
+ return e[4] !== s ? (r = /* @__PURE__ */ k(_e.Root, { width: "1.5rem", height: "1.5rem", children: [
1412
+ s,
1022
1413
  o
1023
- ] }), e[4] = r, e[5] = s) : s = e[5], s;
1414
+ ] }), e[4] = s, e[5] = r) : r = e[5], r;
1024
1415
  }
1025
- function qr(t) {
1026
- const e = y(9), {
1416
+ function ir(t) {
1417
+ const e = S(9), {
1027
1418
  seg: n,
1028
- onOpenFile: r
1029
- } = t, o = n.additions ?? 0, s = n.deletions ?? 0;
1030
- let l;
1031
- e[0] !== r || e[1] !== n.fileName || e[2] !== n.filePath ? (l = () => {
1032
- const c = n.filePath ?? n.fileName;
1033
- r?.(c);
1034
- }, e[0] = r, e[1] = n.fileName, e[2] = n.filePath, e[3] = l) : l = e[3];
1035
- let a;
1036
- return e[4] !== n.fileName || e[5] !== o || e[6] !== s || e[7] !== l ? (a = /* @__PURE__ */ i(_t, { fileName: n.fileName, additions: o, deletions: s, onClickFileLink: l }), e[4] = n.fileName, e[5] = o, e[6] = s, e[7] = l, e[8] = a) : a = e[8], a;
1419
+ onOpenFile: s
1420
+ } = t, o = n.additions ?? 0, r = n.deletions ?? 0;
1421
+ let i;
1422
+ e[0] !== s || e[1] !== n.fileName || e[2] !== n.filePath ? (i = () => {
1423
+ const a = n.filePath ?? n.fileName;
1424
+ s?.(a);
1425
+ }, e[0] = s, e[1] = n.fileName, e[2] = n.filePath, e[3] = i) : i = e[3];
1426
+ let c;
1427
+ return e[4] !== n.fileName || e[5] !== o || e[6] !== r || e[7] !== i ? (c = /* @__PURE__ */ l(Yt, { fileName: n.fileName, additions: o, deletions: r, onClickFileLink: i }), e[4] = n.fileName, e[5] = o, e[6] = r, e[7] = i, e[8] = c) : c = e[8], c;
1037
1428
  }
1038
- function Gr(t) {
1039
- const e = y(13), {
1429
+ function lr(t) {
1430
+ const e = S(13), {
1040
1431
  seg: n,
1041
- onOpenFile: r
1042
- } = t, o = n.bold ? "medium" : void 0, s = !!(n.href || n.filePath), l = n.href ?? "#", a = (n.muted, "fg.muted"), c = s ? "pointer" : "default";
1043
- let d;
1044
- e[0] !== r || e[1] !== n ? (d = (m) => Lt(m, n, r, !0), e[0] = r, e[1] = n, e[2] = d) : d = e[2];
1045
- const f = n.muted ? "fg.muted" : "fg.blue-dark";
1432
+ onOpenFile: s
1433
+ } = t, o = n.bold ? "medium" : void 0, r = !!(n.href || n.filePath), i = n.href ?? "#", c = (n.muted, "fg.muted"), a = r ? "pointer" : "default";
1046
1434
  let u;
1047
- e[3] !== f ? (u = {
1435
+ e[0] !== s || e[1] !== n ? (u = (p) => hn(p, n, s, !0), e[0] = s, e[1] = n, e[2] = u) : u = e[2];
1436
+ const d = n.muted ? "fg.muted" : "fg.blue-dark";
1437
+ let f;
1438
+ e[3] !== d ? (f = {
1048
1439
  textDecoration: "underline",
1049
- color: f
1050
- }, e[3] = f, e[4] = u) : u = e[4];
1051
- let p;
1052
- return e[5] !== o || e[6] !== n.text || e[7] !== l || e[8] !== a || e[9] !== c || e[10] !== d || e[11] !== u ? (p = /* @__PURE__ */ i(St, { href: l, fontWeight: o, color: a, textDecoration: "none", cursor: c, onClick: d, _hover: u, children: n.text }), e[5] = o, e[6] = n.text, e[7] = l, e[8] = a, e[9] = c, e[10] = d, e[11] = u, e[12] = p) : p = e[12], p;
1440
+ color: d
1441
+ }, e[3] = d, e[4] = f) : f = e[4];
1442
+ let m;
1443
+ return e[5] !== o || e[6] !== n.text || e[7] !== i || e[8] !== c || e[9] !== a || e[10] !== u || e[11] !== f ? (m = /* @__PURE__ */ l(Nt, { href: i, fontWeight: o, color: c, textDecoration: "none", cursor: a, onClick: u, _hover: f, children: n.text }), e[5] = o, e[6] = n.text, e[7] = i, e[8] = c, e[9] = a, e[10] = u, e[11] = f, e[12] = m) : m = e[12], m;
1053
1444
  }
1054
- function Xr(t) {
1055
- const e = y(12), {
1445
+ function cr(t) {
1446
+ const e = S(12), {
1056
1447
  seg: n,
1057
- onOpenFile: r
1058
- } = t, o = n.bold ? "medium" : void 0, s = n.href ?? "#", l = n.muted ? "fg.muted" : "accent.primary";
1059
- let a;
1060
- e[0] !== r || e[1] !== n ? (a = (u) => Lt(u, n, r), e[0] = r, e[1] = n, e[2] = a) : a = e[2];
1061
- const c = n.muted ? "fg.muted" : "accent.primary";
1062
- let d;
1063
- e[3] !== c ? (d = {
1064
- color: c,
1448
+ onOpenFile: s
1449
+ } = t, o = n.bold ? "medium" : void 0, r = n.href ?? "#", i = n.muted ? "fg.muted" : "accent.primary";
1450
+ let c;
1451
+ e[0] !== s || e[1] !== n ? (c = (f) => hn(f, n, s), e[0] = s, e[1] = n, e[2] = c) : c = e[2];
1452
+ const a = n.muted ? "fg.muted" : "accent.primary";
1453
+ let u;
1454
+ e[3] !== a ? (u = {
1455
+ color: a,
1065
1456
  textDecoration: "underline"
1066
- }, e[3] = c, e[4] = d) : d = e[4];
1067
- let f;
1068
- return e[5] !== o || e[6] !== n.text || e[7] !== s || e[8] !== l || e[9] !== a || e[10] !== d ? (f = /* @__PURE__ */ i(St, { href: s, fontWeight: o, color: l, textDecoration: "underline", onClick: a, _hover: d, children: n.text }), e[5] = o, e[6] = n.text, e[7] = s, e[8] = l, e[9] = a, e[10] = d, e[11] = f) : f = e[11], f;
1457
+ }, e[3] = a, e[4] = u) : u = e[4];
1458
+ let d;
1459
+ return e[5] !== o || e[6] !== n.text || e[7] !== r || e[8] !== i || e[9] !== c || e[10] !== u ? (d = /* @__PURE__ */ l(Nt, { href: r, fontWeight: o, color: i, textDecoration: "underline", onClick: c, _hover: u, children: n.text }), e[5] = o, e[6] = n.text, e[7] = r, e[8] = i, e[9] = c, e[10] = u, e[11] = d) : d = e[11], d;
1069
1460
  }
1070
- function Yr(t) {
1071
- const e = y(6), {
1461
+ function ar(t) {
1462
+ const e = S(6), {
1072
1463
  seg: n,
1073
- isClickable: r
1074
- } = t, o = n.bold ? "medium" : void 0, s = r && !n.muted ? "fg" : "fg.muted";
1075
- let l;
1076
- e[0] !== s ? (l = {
1077
- color: s
1078
- }, e[0] = s, e[1] = l) : l = e[1];
1079
- let a;
1080
- return e[2] !== n.text || e[3] !== o || e[4] !== l ? (a = /* @__PURE__ */ i(we, { fontWeight: o, color: "fg.muted", _groupHover: l, children: n.text }), e[2] = n.text, e[3] = o, e[4] = l, e[5] = a) : a = e[5], a;
1464
+ isClickable: s
1465
+ } = t, o = n.bold ? "medium" : void 0, r = s && !n.muted ? "fg" : "fg.muted";
1466
+ let i;
1467
+ e[0] !== r ? (i = {
1468
+ color: r
1469
+ }, e[0] = r, e[1] = i) : i = e[1];
1470
+ let c;
1471
+ return e[2] !== n.text || e[3] !== o || e[4] !== i ? (c = /* @__PURE__ */ l(Oe, { fontWeight: o, color: "fg.muted", _groupHover: i, children: n.text }), e[2] = n.text, e[3] = o, e[4] = i, e[5] = c) : c = e[5], c;
1081
1472
  }
1082
- function Jr(t) {
1083
- const e = y(11), {
1473
+ function ur(t) {
1474
+ const e = S(11), {
1084
1475
  seg: n,
1085
- isClickable: r,
1476
+ isClickable: s,
1086
1477
  onOpenFile: o
1087
1478
  } = t;
1088
1479
  switch (n.kind) {
1089
1480
  case "avatar": {
1090
- let s;
1091
- return e[0] !== n ? (s = /* @__PURE__ */ i(Kr, { seg: n }), e[0] = n, e[1] = s) : s = e[1], s;
1481
+ let r;
1482
+ return e[0] !== n ? (r = /* @__PURE__ */ l(rr, { seg: n }), e[0] = n, e[1] = r) : r = e[1], r;
1092
1483
  }
1093
1484
  case "diff": {
1094
- let s;
1095
- return e[2] !== o || e[3] !== n ? (s = /* @__PURE__ */ i(qr, { seg: n, onOpenFile: o }), e[2] = o, e[3] = n, e[4] = s) : s = e[4], s;
1485
+ let r;
1486
+ return e[2] !== o || e[3] !== n ? (r = /* @__PURE__ */ l(ir, { seg: n, onOpenFile: o }), e[2] = o, e[3] = n, e[4] = r) : r = e[4], r;
1096
1487
  }
1097
1488
  case "link": {
1098
- let s;
1099
- return e[5] !== o || e[6] !== n ? (s = n.variant === "bubble" ? /* @__PURE__ */ i(Gr, { seg: n, onOpenFile: o }) : /* @__PURE__ */ i(Xr, { seg: n, onOpenFile: o }), e[5] = o, e[6] = n, e[7] = s) : s = e[7], s;
1489
+ let r;
1490
+ return e[5] !== o || e[6] !== n ? (r = n.variant === "bubble" ? /* @__PURE__ */ l(lr, { seg: n, onOpenFile: o }) : /* @__PURE__ */ l(cr, { seg: n, onOpenFile: o }), e[5] = o, e[6] = n, e[7] = r) : r = e[7], r;
1100
1491
  }
1101
1492
  case "text": {
1102
- let s;
1103
- return e[8] !== r || e[9] !== n ? (s = /* @__PURE__ */ i(Yr, { seg: n, isClickable: r }), e[8] = r, e[9] = n, e[10] = s) : s = e[10], s;
1493
+ let r;
1494
+ return e[8] !== s || e[9] !== n ? (r = /* @__PURE__ */ l(ar, { seg: n, isClickable: s }), e[8] = s, e[9] = n, e[10] = r) : r = e[10], r;
1104
1495
  }
1105
1496
  default:
1106
1497
  return null;
1107
1498
  }
1108
1499
  }
1109
- function Qr(t) {
1110
- const e = y(10), {
1500
+ function dr(t) {
1501
+ const e = S(10), {
1111
1502
  ind: n
1112
1503
  } = t;
1113
1504
  if (!n || n.type === "none")
1114
1505
  return null;
1115
1506
  if (n.type === "icon") {
1116
- let l;
1117
- e[0] !== n.icon ? (l = Yn(n.icon), e[0] = n.icon, e[1] = l) : l = e[1];
1118
- const a = l;
1119
- let c;
1120
- return e[2] !== a ? (c = /* @__PURE__ */ i(U.Indicator, { outline: "none", shadow: "none", border: "none", background: "bg", color: "fg", children: /* @__PURE__ */ i(we, { display: "inline-flex", alignItems: "center", children: /* @__PURE__ */ i(a, { size: 14, strokeWidth: 1 }) }) }), e[2] = a, e[3] = c) : c = e[3], c;
1507
+ let i;
1508
+ e[0] !== n.icon ? (i = ns(n.icon), e[0] = n.icon, e[1] = i) : i = e[1];
1509
+ const c = i;
1510
+ let a;
1511
+ return e[2] !== c ? (a = /* @__PURE__ */ l(le.Indicator, { outline: "none", shadow: "none", border: "none", background: "bg", color: "fg", children: /* @__PURE__ */ l(Oe, { display: "inline-flex", alignItems: "center", children: /* @__PURE__ */ l(c, { size: 14, strokeWidth: 1 }) }) }), e[2] = c, e[3] = a) : a = e[3], a;
1121
1512
  }
1122
- let r;
1123
- e[4] !== n.alt || e[5] !== n.src ? (r = /* @__PURE__ */ i(he.Image, { src: n.src, alt: n.alt }), e[4] = n.alt, e[5] = n.src, e[6] = r) : r = e[6];
1124
- let o;
1125
- e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ i(he.Fallback, {}), e[7] = o) : o = e[7];
1126
1513
  let s;
1127
- return e[8] !== r ? (s = /* @__PURE__ */ i(U.Indicator, { children: /* @__PURE__ */ b(he.Root, { boxSize: "full", children: [
1128
- r,
1514
+ e[4] !== n.alt || e[5] !== n.src ? (s = /* @__PURE__ */ l(_e.Image, { src: n.src, alt: n.alt }), e[4] = n.alt, e[5] = n.src, e[6] = s) : s = e[6];
1515
+ let o;
1516
+ e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ l(_e.Fallback, {}), e[7] = o) : o = e[7];
1517
+ let r;
1518
+ return e[8] !== s ? (r = /* @__PURE__ */ l(le.Indicator, { children: /* @__PURE__ */ k(_e.Root, { boxSize: "full", children: [
1519
+ s,
1129
1520
  o
1130
- ] }) }), e[8] = r, e[9] = s) : s = e[9], s;
1521
+ ] }) }), e[8] = s, e[9] = r) : r = e[9], r;
1131
1522
  }
1132
- function Zr(t) {
1133
- const e = y(5), {
1523
+ function fr(t) {
1524
+ const e = S(5), {
1134
1525
  code: n,
1135
- language: r
1136
- } = t, o = r ? `${r} code block` : "code block";
1137
- let s;
1138
- e[0] !== n ? (s = /* @__PURE__ */ i(k, { as: "code", children: n }), e[0] = n, e[1] = s) : s = e[1];
1139
- let l;
1140
- return e[2] !== o || e[3] !== s ? (l = /* @__PURE__ */ i(k, { as: "pre", background: "bg.muted", color: "fg", borderRadius: "md", padding: "sm", fontFamily: "mono", fontSize: "xs", lineHeight: "shorter", overflowX: "auto", whiteSpace: "pre", "aria-label": o, children: s }), e[2] = o, e[3] = s, e[4] = l) : l = e[4], l;
1526
+ language: s
1527
+ } = t, o = s ? `${s} code block` : "code block";
1528
+ let r;
1529
+ e[0] !== n ? (r = /* @__PURE__ */ l(P, { as: "code", children: n }), e[0] = n, e[1] = r) : r = e[1];
1530
+ let i;
1531
+ return e[2] !== o || e[3] !== r ? (i = /* @__PURE__ */ l(P, { as: "pre", background: "bg.muted", color: "fg", borderRadius: "md", padding: "sm", fontFamily: "mono", fontSize: "xs", lineHeight: "shorter", overflowX: "auto", whiteSpace: "pre", "aria-label": o, children: r }), e[2] = o, e[3] = r, e[4] = i) : i = e[4], i;
1141
1532
  }
1142
- function eo(t) {
1143
- const e = y(26), {
1533
+ function pr(t) {
1534
+ const e = S(30), {
1144
1535
  b: n,
1145
- onOpenFile: r
1536
+ onOpenFile: s
1146
1537
  } = t;
1147
1538
  switch (n.type) {
1148
1539
  case "comment": {
1149
1540
  let o;
1150
- e[0] !== n.text ? (o = /* @__PURE__ */ i(E.Body, { children: n.text }), e[0] = n.text, e[1] = o) : o = e[1];
1151
- let s;
1152
- e[2] !== n.reactions ? (s = n.reactions?.clap ? /* @__PURE__ */ i(E.Footer, { children: /* @__PURE__ */ b(Ce, { children: [
1541
+ e[0] !== n.text ? (o = /* @__PURE__ */ l(Y.Body, { children: n.text }), e[0] = n.text, e[1] = o) : o = e[1];
1542
+ let r;
1543
+ e[2] !== n.reactions ? (r = n.reactions?.clap ? /* @__PURE__ */ l(Y.Footer, { children: /* @__PURE__ */ k(Ee, { children: [
1153
1544
  "👏 ",
1154
1545
  n.reactions.clap
1155
- ] }) }) : null, e[2] = n.reactions, e[3] = s) : s = e[3];
1156
- let l;
1157
- return e[4] !== o || e[5] !== s ? (l = /* @__PURE__ */ b(E.Root, { children: [
1546
+ ] }) }) : null, e[2] = n.reactions, e[3] = r) : r = e[3];
1547
+ let i;
1548
+ return e[4] !== o || e[5] !== r ? (i = /* @__PURE__ */ k(Y.Root, { children: [
1158
1549
  o,
1159
- s
1160
- ] }), e[4] = o, e[5] = s, e[6] = l) : l = e[6], l;
1550
+ r
1551
+ ] }), e[4] = o, e[5] = r, e[6] = i) : i = e[6], i;
1161
1552
  }
1162
1553
  case "code": {
1163
1554
  let o;
1164
- return e[7] !== n.code || e[8] !== n.language ? (o = /* @__PURE__ */ i(E.Root, { border: "0", padding: "0", children: /* @__PURE__ */ i(E.Body, { padding: "0", children: /* @__PURE__ */ i(Zr, { language: n.language, code: n.code }) }) }), e[7] = n.code, e[8] = n.language, e[9] = o) : o = e[9], o;
1555
+ return e[7] !== n.code || e[8] !== n.language ? (o = /* @__PURE__ */ l(Y.Root, { border: "0", padding: "0", children: /* @__PURE__ */ l(Y.Body, { padding: "0", children: /* @__PURE__ */ l(fr, { language: n.language, code: n.code }) }) }), e[7] = n.code, e[8] = n.language, e[9] = o) : o = e[9], o;
1165
1556
  }
1166
1557
  case "diff": {
1167
1558
  const o = n.sideBySide ?? !1;
1168
- let s;
1169
- return e[10] !== n.language || e[11] !== n.modified || e[12] !== n.original || e[13] !== o ? (s = /* @__PURE__ */ i(E.Root, { border: "0", padding: "0", children: /* @__PURE__ */ i(E.Body, { padding: "0", children: /* @__PURE__ */ i(k, { height: "240px", minW: "320px", overflow: "hidden", children: /* @__PURE__ */ i(yn, { 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] = s) : s = e[14], s;
1559
+ let r;
1560
+ return e[10] !== n.language || e[11] !== n.modified || e[12] !== n.original || e[13] !== o ? (r = /* @__PURE__ */ l(Y.Root, { border: "0", padding: "0", children: /* @__PURE__ */ l(Y.Body, { padding: "0", children: /* @__PURE__ */ l(P, { height: "240px", minW: "320px", overflow: "hidden", children: /* @__PURE__ */ l(io, { 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;
1170
1561
  }
1171
1562
  case "text": {
1172
1563
  let o;
1173
- return e[15] !== n.text ? (o = /* @__PURE__ */ i(E.Root, { background: "transparent", children: /* @__PURE__ */ i(E.Body, { padding: "sm", children: /* @__PURE__ */ i(K, { textStyle: "label/S/regular", children: n.text }) }) }), e[15] = n.text, e[16] = o) : o = e[16], o;
1564
+ return e[15] !== n.text ? (o = /* @__PURE__ */ l(Y.Root, { background: "transparent", children: /* @__PURE__ */ l(Y.Body, { padding: "sm", children: /* @__PURE__ */ l(z, { textStyle: "label/S/regular", children: n.text }) }) }), e[15] = n.text, e[16] = o) : o = e[16], o;
1565
+ }
1566
+ case "todo-list": {
1567
+ let o;
1568
+ return e[17] !== n.items ? (o = /* @__PURE__ */ l(Ro, { items: n.items }), e[17] = n.items, e[18] = o) : o = e[18], o;
1569
+ }
1570
+ case "question-form": {
1571
+ let o;
1572
+ return e[19] !== n.questions ? (o = /* @__PURE__ */ l(en, { questions: n.questions }), e[19] = n.questions, e[20] = o) : o = e[20], o;
1174
1573
  }
1175
1574
  case "references": {
1176
1575
  let o;
1177
- e[17] !== n.references ? (o = n.references.map(to), e[17] = n.references, e[18] = o) : o = e[18];
1178
- let s;
1179
- return e[19] !== o ? (s = /* @__PURE__ */ i(te, { mt: "xs", gap: "xs", flexDir: "row", flexWrap: "wrap", children: o }), e[19] = o, e[20] = s) : s = e[20], s;
1576
+ e[21] !== n.references ? (o = n.references.map(mr), e[21] = n.references, e[22] = o) : o = e[22];
1577
+ let r;
1578
+ return e[23] !== o ? (r = /* @__PURE__ */ l(F, { mt: "xs", gap: "xs", flexDir: "row", flexWrap: "wrap", children: o }), e[23] = o, e[24] = r) : r = e[24], r;
1180
1579
  }
1181
1580
  case "component": {
1182
1581
  let o;
1183
- e[21] !== n || e[22] !== r ? (o = n.render({
1184
- onOpenFile: r
1185
- }), e[21] = n, e[22] = r, e[23] = o) : o = e[23];
1186
- let s;
1187
- return e[24] !== o ? (s = /* @__PURE__ */ i(tt, { children: o }), e[24] = o, e[25] = s) : s = e[25], s;
1582
+ e[25] !== n || e[26] !== s ? (o = n.render({
1583
+ onOpenFile: s
1584
+ }), e[25] = n, e[26] = s, e[27] = o) : o = e[27];
1585
+ let r;
1586
+ return e[28] !== o ? (r = /* @__PURE__ */ l(At, { children: o }), e[28] = o, e[29] = r) : r = e[29], r;
1188
1587
  }
1189
1588
  }
1190
1589
  }
1191
- function to(t) {
1192
- return /* @__PURE__ */ i(xn, { fileName: t }, t);
1590
+ function mr(t) {
1591
+ return /* @__PURE__ */ l(oo, { fileName: t }, t);
1193
1592
  }
1194
- function no(t) {
1195
- const e = y(22), {
1593
+ function hr(t) {
1594
+ const e = S(22), {
1196
1595
  item: n,
1197
- itemKey: r,
1596
+ itemKey: s,
1198
1597
  isOpen: o,
1199
- canExpand: s,
1200
- hasBlocks: l,
1201
- onToggle: a,
1202
- onOpenFile: c
1598
+ canExpand: r,
1599
+ hasBlocks: i,
1600
+ onToggle: c,
1601
+ onOpenFile: a
1203
1602
  } = t;
1603
+ let u;
1604
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ l(le.Separator, {}), e[0] = u) : u = e[0];
1204
1605
  let d;
1205
- e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ i(U.Separator, {}), e[0] = d) : d = e[0];
1606
+ e[1] !== n.indicator ? (d = /* @__PURE__ */ k(le.Connector, { children: [
1607
+ u,
1608
+ /* @__PURE__ */ l(dr, { ind: n.indicator })
1609
+ ] }), e[1] = n.indicator, e[2] = d) : d = e[2];
1206
1610
  let f;
1207
- e[1] !== n.indicator ? (f = /* @__PURE__ */ b(U.Connector, { children: [
1208
- d,
1209
- /* @__PURE__ */ i(Qr, { ind: n.indicator })
1210
- ] }), e[1] = n.indicator, e[2] = f) : f = e[2];
1211
- let u;
1212
- e[3] !== s || e[4] !== o || e[5] !== n.title || e[6] !== r || e[7] !== c || e[8] !== a ? (u = n.title.length > 0 && /* @__PURE__ */ i(U.Title, { className: "group", fontWeight: "normal", display: "flex", alignItems: "center", justifyContent: "space-between", cursor: s ? "pointer" : "default", onClick: s ? () => a(r) : void 0, children: /* @__PURE__ */ b(we, { display: "inline-flex", alignItems: "center", gap: "sm", flexWrap: "wrap", children: [
1213
- /* @__PURE__ */ i(we, { display: "inline-flex", alignItems: "center", gap: "xs", flexWrap: "wrap", children: n.title.map((x, w) => /* @__PURE__ */ i(Jr, { seg: x, isClickable: s, onOpenFile: c }, w)) }),
1214
- s ? /* @__PURE__ */ i(we, { display: "inline-flex", alignItems: "center", transition: "transform 200ms ease, color 200ms ease", transform: o ? "rotate(0deg)" : "rotate(-180deg)", color: "transparent", _groupHover: {
1611
+ e[3] !== r || e[4] !== o || e[5] !== n.title || e[6] !== s || e[7] !== a || e[8] !== c ? (f = n.title.length > 0 && /* @__PURE__ */ l(le.Title, { className: "group", fontWeight: "normal", display: "flex", alignItems: "center", justifyContent: "space-between", cursor: r ? "pointer" : "default", onClick: r ? () => c(s) : void 0, children: /* @__PURE__ */ k(Oe, { display: "inline-flex", alignItems: "center", gap: "sm", flexWrap: "wrap", children: [
1612
+ /* @__PURE__ */ l(Oe, { display: "inline-flex", alignItems: "center", gap: "xs", flexWrap: "wrap", children: n.title.map((g, b) => /* @__PURE__ */ l(ur, { seg: g, isClickable: r, onOpenFile: a }, b)) }),
1613
+ r ? /* @__PURE__ */ l(Oe, { display: "inline-flex", alignItems: "center", transition: "transform 200ms ease, color 200ms ease", transform: o ? "rotate(0deg)" : "rotate(-180deg)", color: "transparent", _groupHover: {
1215
1614
  color: "fg"
1216
- }, children: /* @__PURE__ */ i(pn, { size: 12 }) }) : null
1217
- ] }) }), e[3] = s, e[4] = o, e[5] = n.title, e[6] = r, e[7] = c, e[8] = a, e[9] = u) : u = e[9];
1218
- let p;
1219
- e[10] !== l || e[11] !== o || e[12] !== n.blocks || e[13] !== c ? (p = l ? /* @__PURE__ */ i(k, { display: "grid", gridTemplateRows: o ? "1fr" : "0fr", transition: "grid-template-rows 220ms ease", children: o ? /* @__PURE__ */ i(k, { overflow: "hidden", opacity: 1, transform: "translateY(0)", transition: "opacity 200ms ease, transform 200ms ease", children: n.blocks.map((x, w) => /* @__PURE__ */ i(k, { children: /* @__PURE__ */ i(eo, { b: x, onOpenFile: c }) }, w)) }) : null }) : null, e[10] = l, e[11] = o, e[12] = n.blocks, e[13] = c, e[14] = p) : p = e[14];
1615
+ }, children: /* @__PURE__ */ l(Yn, { size: 12 }) }) : null
1616
+ ] }) }), e[3] = r, e[4] = o, e[5] = n.title, e[6] = s, e[7] = a, e[8] = c, e[9] = f) : f = e[9];
1220
1617
  let m;
1221
- e[15] !== u || e[16] !== p ? (m = /* @__PURE__ */ b(U.Content, { pb: "xs", children: [
1222
- u,
1223
- p
1224
- ] }), e[15] = u, e[16] = p, e[17] = m) : m = e[17];
1225
- let g;
1226
- return e[18] !== r || e[19] !== f || e[20] !== m ? (g = /* @__PURE__ */ b(U.Item, { gap: "xs", children: [
1618
+ e[10] !== i || e[11] !== o || e[12] !== n.blocks || e[13] !== a ? (m = i ? /* @__PURE__ */ l(P, { display: "grid", gridTemplateRows: o ? "1fr" : "0fr", transition: "grid-template-rows 220ms ease", children: o ? /* @__PURE__ */ l(P, { overflow: "hidden", opacity: 1, transform: "translateY(0)", transition: "opacity 200ms ease, transform 200ms ease", children: n.blocks.map((g, b) => /* @__PURE__ */ l(P, { children: /* @__PURE__ */ l(pr, { b: g, onOpenFile: a }) }, b)) }) : null }) : null, e[10] = i, e[11] = o, e[12] = n.blocks, e[13] = a, e[14] = m) : m = e[14];
1619
+ let p;
1620
+ e[15] !== f || e[16] !== m ? (p = /* @__PURE__ */ k(le.Content, { pb: "xs", children: [
1227
1621
  f,
1228
1622
  m
1229
- ] }, r), e[18] = r, e[19] = f, e[20] = m, e[21] = g) : g = e[21], g;
1623
+ ] }), e[15] = f, e[16] = m, e[17] = p) : p = e[17];
1624
+ let h;
1625
+ return e[18] !== s || e[19] !== d || e[20] !== p ? (h = /* @__PURE__ */ k(le.Item, { gap: "xs", children: [
1626
+ d,
1627
+ p
1628
+ ] }, s), e[18] = s, e[19] = d, e[20] = p, e[21] = h) : h = e[21], h;
1230
1629
  }
1231
- function ro(t) {
1232
- const e = y(11), {
1630
+ function gr(t) {
1631
+ const e = S(11), {
1233
1632
  data: n,
1234
- onOpenFile: r
1633
+ onOpenFile: s
1235
1634
  } = t;
1236
1635
  let o;
1237
1636
  e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = {}, e[0] = o) : o = e[0];
1238
- const [s, l] = me(o), a = oo;
1239
- let c;
1240
- e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (c = (p) => {
1241
- l((m) => ({
1242
- ...m,
1243
- [p]: !m[p]
1637
+ const [r, i] = J(o), c = br;
1638
+ let a;
1639
+ e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (a = (m) => {
1640
+ i((p) => ({
1641
+ ...p,
1642
+ [m]: !p[m]
1244
1643
  }));
1245
- }, e[1] = c) : c = e[1];
1246
- const d = c;
1247
- let f;
1248
- if (e[2] !== n.items || e[3] !== s || e[4] !== r) {
1249
- let p;
1250
- e[6] !== s || e[7] !== r ? (p = (m, g) => {
1251
- const x = a(m, g), w = (m.blocks?.length ?? 0) > 0, v = (m.expandable ?? !0) && w, L = v ? s[x] ?? !1 : w;
1252
- return /* @__PURE__ */ i(no, { item: m, itemKey: x, isOpen: L, canExpand: v, hasBlocks: w, onToggle: d, onOpenFile: r }, x);
1253
- }, e[6] = s, e[7] = r, e[8] = p) : p = e[8], f = n.items.map(p), e[2] = n.items, e[3] = s, e[4] = r, e[5] = f;
1644
+ }, e[1] = a) : a = e[1];
1645
+ const u = a;
1646
+ let d;
1647
+ if (e[2] !== n.items || e[3] !== r || e[4] !== s) {
1648
+ let m;
1649
+ e[6] !== r || e[7] !== s ? (m = (p, h) => {
1650
+ const g = c(p, h), b = (p.blocks?.length ?? 0) > 0, y = (p.expandable ?? !0) && b, w = y ? r[g] ?? !1 : b;
1651
+ return /* @__PURE__ */ l(hr, { item: p, itemKey: g, isOpen: w, canExpand: y, hasBlocks: b, onToggle: u, onOpenFile: s }, g);
1652
+ }, e[6] = r, e[7] = s, e[8] = m) : m = e[8], d = n.items.map(m), e[2] = n.items, e[3] = r, e[4] = s, e[5] = d;
1254
1653
  } else
1255
- f = e[5];
1256
- let u;
1257
- return e[9] !== f ? (u = /* @__PURE__ */ i(U.Root, { children: f }), e[9] = f, e[10] = u) : u = e[10], u;
1654
+ d = e[5];
1655
+ let f;
1656
+ return e[9] !== d ? (f = /* @__PURE__ */ l(le.Root, { children: d }), e[9] = d, e[10] = f) : f = e[10], f;
1258
1657
  }
1259
- function oo(t, e) {
1658
+ function br(t, e) {
1260
1659
  return t.id ? `id:${t.id}` : `idx:${e}`;
1261
1660
  }
1262
- function so(t) {
1263
- const e = y(6), {
1661
+ const xr = (t) => nt(t.tool ?? "").replace(/_/g, "") === "question", yr = (t) => {
1662
+ const e = t.state?.output;
1663
+ 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;
1664
+ };
1665
+ function Sr(t) {
1666
+ const e = S(8), {
1264
1667
  invocations: n,
1265
- labeledBlocks: r,
1266
- onOpenFile: o
1267
- } = t;
1268
- let s;
1269
- e[0] !== n || e[1] !== r ? (s = Vr(n, {
1270
- labeledBlocks: r
1271
- }), e[0] = n, e[1] = r, e[2] = s) : s = e[2];
1272
- const l = s;
1273
- let a;
1274
- return e[3] !== l || e[4] !== o ? (a = /* @__PURE__ */ i(ro, { data: l, onOpenFile: o }), e[3] = l, e[4] = o, e[5] = a) : a = e[5], a;
1668
+ labeledBlocks: s,
1669
+ hideQuestionForms: o,
1670
+ onOpenFile: r
1671
+ } = t, i = o === void 0 ? !1 : o;
1672
+ let c, a;
1673
+ if (e[0] !== i || e[1] !== n || e[2] !== s) {
1674
+ a = /* @__PURE__ */ Symbol.for("react.early_return_sentinel");
1675
+ e: {
1676
+ const f = i ? n.filter(kr) : n;
1677
+ if (f.length === 0) {
1678
+ a = null;
1679
+ break e;
1680
+ }
1681
+ c = sr(f, {
1682
+ labeledBlocks: s
1683
+ });
1684
+ }
1685
+ e[0] = i, e[1] = n, e[2] = s, e[3] = c, e[4] = a;
1686
+ } else
1687
+ c = e[3], a = e[4];
1688
+ if (a !== /* @__PURE__ */ Symbol.for("react.early_return_sentinel"))
1689
+ return a;
1690
+ const u = c;
1691
+ let d;
1692
+ return e[5] !== u || e[6] !== r ? (d = /* @__PURE__ */ l(gr, { data: u, onOpenFile: r }), e[5] = u, e[6] = r, e[7] = d) : d = e[7], d;
1275
1693
  }
1276
- const io = (t) => t.type === "tool", Qe = (t) => t >= 1e3 ? `${(t / 1e3).toFixed(1)}k` : String(t), lo = (t) => {
1694
+ function kr(t) {
1695
+ return !xr(t) || yr(t);
1696
+ }
1697
+ const wr = (t) => t.type === "tool", Ct = (t) => t >= 1e3 ? `${(t / 1e3).toFixed(1)}k` : String(t), Tr = (t) => {
1277
1698
  if (t.message && t.message.trim().length > 0)
1278
1699
  return t.message;
1279
1700
  const {
@@ -1289,99 +1710,100 @@ const io = (t) => t.type === "tool", Qe = (t) => t >= 1e3 ? `${(t / 1e3).toFixed
1289
1710
  default:
1290
1711
  return "An error occurred.";
1291
1712
  }
1292
- }, ao = {
1713
+ }, Cr = {
1293
1714
  info: "blue",
1294
1715
  warning: "orange",
1295
1716
  error: "red",
1296
1717
  success: "green",
1297
1718
  loading: "blue"
1298
- }, co = (t, e) => {
1719
+ }, _r = (t, e) => {
1299
1720
  const n = [];
1300
- let r = e;
1301
- for (; r < t.length; ) {
1302
- const o = t[r];
1303
- if (!io(o)) break;
1304
- n.push(o), r += 1;
1721
+ let s = e;
1722
+ for (; s < t.length; ) {
1723
+ const o = t[s];
1724
+ if (!wr(o)) break;
1725
+ n.push(o), s += 1;
1305
1726
  }
1306
1727
  return {
1307
1728
  invocations: n,
1308
- nextIndex: r - 1
1729
+ nextIndex: s - 1
1309
1730
  };
1310
1731
  };
1311
- function Ft(t) {
1312
- const e = y(7), {
1732
+ function gn(t) {
1733
+ const e = S(8), {
1313
1734
  message: n,
1314
- onOpenFile: r,
1315
- toolInvocationTimeline: o
1316
- } = t, s = o ?? so;
1317
- let l;
1318
- e[0] !== n.parts ? (l = n.parts ?? [], e[0] = n.parts, e[1] = l) : l = e[1];
1319
- const a = l;
1320
- let c;
1321
- if (e[2] !== s || e[3] !== n.id || e[4] !== r || e[5] !== a) {
1322
- const d = [];
1323
- for (let f = 0; f < a.length; f = f + 1, f) {
1324
- const u = a[f], p = `${n.id}-${f}`;
1325
- e: switch (u.type) {
1735
+ hideQuestionForms: s,
1736
+ onOpenFile: o,
1737
+ toolInvocationTimeline: r
1738
+ } = t, i = s === void 0 ? !1 : s, c = r ?? Sr;
1739
+ let a;
1740
+ e[0] !== n.parts ? (a = n.parts ?? [], e[0] = n.parts, e[1] = a) : a = e[1];
1741
+ const u = a;
1742
+ let d;
1743
+ if (e[2] !== c || e[3] !== i || e[4] !== n.id || e[5] !== o || e[6] !== u) {
1744
+ const f = [];
1745
+ for (let m = 0; m < u.length; m = m + 1, m) {
1746
+ const p = u[m], h = `${n.id}-${m}`;
1747
+ e: switch (p.type) {
1326
1748
  case "text": {
1327
- d.push(/* @__PURE__ */ i("div", { children: /* @__PURE__ */ i(qn, { children: u.text }) }, p));
1749
+ f.push(/* @__PURE__ */ l("div", { children: /* @__PURE__ */ l(Jo, { children: p.text }) }, h));
1328
1750
  break e;
1329
1751
  }
1330
1752
  case "reasoning": {
1331
- d.push(/* @__PURE__ */ i(k, { padding: "0", css: {
1753
+ f.push(/* @__PURE__ */ l(P, { padding: "0", css: {
1332
1754
  "& .rich-text, & .rich-text *": {
1333
1755
  color: "fg.subtle !important",
1334
1756
  fontSize: ".75rem !important",
1335
1757
  fontWeight: "normal !important"
1336
1758
  }
1337
- }, children: /* @__PURE__ */ i(Ct, { defaultState: u.text, fullWidth: !0 }) }, p));
1759
+ }, children: /* @__PURE__ */ l(Kt, { defaultState: p.text, fullWidth: !0 }) }, h));
1338
1760
  break e;
1339
1761
  }
1340
1762
  case "tool": {
1341
1763
  const {
1342
- invocations: m,
1343
- nextIndex: g
1344
- } = co(a, f);
1345
- f = g, d.push(/* @__PURE__ */ i(k, { width: "full", children: /* @__PURE__ */ i(s, { invocations: m, labeledBlocks: !0, onOpenFile: r }) }, p));
1764
+ invocations: g,
1765
+ nextIndex: b
1766
+ } = _r(u, m);
1767
+ m = b, f.push(/* @__PURE__ */ l(P, { width: "full", children: /* @__PURE__ */ l(c, { invocations: g, labeledBlocks: !0, hideQuestionForms: i, onOpenFile: o }) }, h));
1346
1768
  break e;
1347
1769
  }
1348
1770
  case "error": {
1349
- d.push(/* @__PURE__ */ i(k, { py: "2", width: "full", children: /* @__PURE__ */ i(dt, { borderRadius: "xs", status: "error", colorPalette: "red", title: lo(u), size: "sm" }) }, p));
1771
+ f.push(/* @__PURE__ */ l(P, { py: "2", width: "full", children: /* @__PURE__ */ l(Dt, { borderRadius: "xs", status: "error", colorPalette: "red", title: Tr(p), size: "sm" }) }, h));
1350
1772
  break e;
1351
1773
  }
1352
1774
  case "token_usage": {
1353
- d.push(/* @__PURE__ */ i(k, { children: /* @__PURE__ */ b(K, { fontSize: "xs", color: "fg.subtle", children: [
1775
+ f.push(/* @__PURE__ */ l(P, { children: /* @__PURE__ */ k(z, { fontSize: "xs", color: "fg.subtle", children: [
1354
1776
  "Tokens: ",
1355
- Qe(u.inputTokens),
1777
+ Ct(p.inputTokens),
1356
1778
  " in / ",
1357
- Qe(u.outputTokens),
1779
+ Ct(p.outputTokens),
1358
1780
  " out",
1359
- u.cacheReadTokens ? ` / ${Qe(u.cacheReadTokens)} cache read` : ""
1360
- ] }) }, p));
1781
+ p.cacheReadTokens ? ` / ${Ct(p.cacheReadTokens)} cache read` : ""
1782
+ ] }) }, h));
1361
1783
  break e;
1362
1784
  }
1363
1785
  case "alert": {
1364
- d.push(/* @__PURE__ */ i(k, { width: "full", children: /* @__PURE__ */ i(dt, { borderRadius: "xs", status: u.status === "loading" ? "info" : u.status, colorPalette: ao[u.status], title: u.title, icon: u.status === "loading" ? /* @__PURE__ */ i(nt, { size: "sm" }) : void 0, size: "sm", children: u.message }) }, p));
1786
+ f.push(/* @__PURE__ */ l(P, { width: "full", children: /* @__PURE__ */ l(Dt, { borderRadius: "xs", status: p.status === "loading" ? "info" : p.status, colorPalette: Cr[p.status], title: p.title, icon: p.status === "loading" ? /* @__PURE__ */ l(Rt, { size: "sm" }) : void 0, size: "sm", children: p.message }) }, h));
1365
1787
  break e;
1366
1788
  }
1367
1789
  default:
1368
- d.push(null);
1790
+ f.push(null);
1369
1791
  }
1370
1792
  }
1371
- c = /* @__PURE__ */ i(tt, { children: d }), e[2] = s, e[3] = n.id, e[4] = r, e[5] = a, e[6] = c;
1793
+ d = /* @__PURE__ */ l(At, { children: f }), e[2] = c, e[3] = i, e[4] = n.id, e[5] = o, e[6] = u, e[7] = d;
1372
1794
  } else
1373
- c = e[6];
1374
- return c;
1795
+ d = e[7];
1796
+ return d;
1375
1797
  }
1376
- const uo = (t) => t === "user" || t === "assistant" || t === "developer" ? t : "assistant", fo = (t) => {
1798
+ const Ar = (t) => t === "user" || t === "assistant" || t === "developer" ? t : "assistant", Rr = (t) => {
1377
1799
  const e = t.parts ?? [];
1378
- return e.length === 0 || e.some((r) => r.type === "text" && "text" in r) ? !1 : e.some((r) => r.type === "reasoning" || r.type === "tool");
1379
- }, po = (t) => {
1800
+ return e.length === 0 || e.some((s) => s.type === "text" && "text" in s) ? !1 : e.some((s) => s.type === "reasoning" || s.type === "tool");
1801
+ }, Br = (t) => {
1380
1802
  const e = [];
1381
1803
  for (const n of t) {
1382
- const r = e[e.length - 1];
1383
- if (r && r.role === n.role && fo(n)) {
1384
- r.parts = [...r.parts ?? [], ...n.parts ?? []];
1804
+ const s = e[e.length - 1];
1805
+ if (s && s.role === n.role && Rr(n)) {
1806
+ s.parts = [...s.parts ?? [], ...n.parts ?? []];
1385
1807
  continue;
1386
1808
  }
1387
1809
  e.push({
@@ -1390,153 +1812,196 @@ const uo = (t) => t === "user" || t === "assistant" || t === "developer" ? t : "
1390
1812
  });
1391
1813
  }
1392
1814
  return e;
1393
- }, mo = (t) => {
1815
+ }, Ir = (t) => {
1394
1816
  const e = [], n = [];
1395
- for (const r of t)
1396
- r.role === "user" ? e.push({
1397
- userMessage: r,
1817
+ for (const s of t)
1818
+ s.role === "user" ? e.push({
1819
+ userMessage: s,
1398
1820
  responses: []
1399
- }) : e.length > 0 ? e[e.length - 1].responses.push(r) : n.push(r);
1821
+ }) : e.length > 0 ? e[e.length - 1].responses.push(s) : n.push(s);
1400
1822
  return {
1401
1823
  groups: e,
1402
1824
  leadingResponses: n
1403
1825
  };
1404
- }, bt = (t, e) => {
1405
- const n = uo(t.role);
1406
- return /* @__PURE__ */ i(V.Root, { from: n, children: /* @__PURE__ */ i(V.Content, { from: n, children: /* @__PURE__ */ i(Ft, { message: t, streaming: e }) }) }, t.id);
1407
- }, Qo = (t) => {
1408
- const e = y(28), {
1826
+ }, Pr = (t) => {
1827
+ const e = S(3), {
1828
+ label: n,
1829
+ onClick: s
1830
+ } = t;
1831
+ let o;
1832
+ return e[0] !== n || e[1] !== s ? (o = /* @__PURE__ */ l(ae, { position: "absolute", bottom: "0", left: "0", right: "0", justifyContent: "flex-end", alignItems: "flex-end", px: "xs", pb: "xs", pt: "lg", bgGradient: "to-t", gradientFrom: "bg.subtle", gradientTo: "transparent", borderBottomRadius: "xs", pointerEvents: "none", children: /* @__PURE__ */ l(Ee, { size: "2xs", variant: "solid", pointerEvents: "auto", onClick: s, children: n }) }), e[0] = n, e[1] = s, e[2] = o) : o = e[2], o;
1833
+ }, bn = (t, e, n = !1) => {
1834
+ const s = Ar(t.role);
1835
+ return /* @__PURE__ */ l(ce.Root, { from: s, children: /* @__PURE__ */ l(ce.Content, { from: s, children: /* @__PURE__ */ l(gn, { message: t, streaming: e, hideQuestionForms: n }) }) }, t.id);
1836
+ }, Mr = (t) => {
1837
+ Xo(t.currentTarget, t.deltaY) && t.stopPropagation();
1838
+ }, $r = (t, e) => {
1839
+ if (t)
1840
+ return e ? tn : Uo;
1841
+ }, Or = (t) => {
1842
+ if (t)
1843
+ return tn;
1844
+ }, Er = (t) => {
1845
+ const e = S(42), {
1846
+ group: n,
1847
+ streaming: s,
1848
+ hideQuestionForms: o,
1849
+ isExpanded: r,
1850
+ onToggleStickyMessage: i
1851
+ } = t;
1852
+ let c, a, u;
1853
+ e[0] !== n.userMessage || e[1] !== r ? (c = Ko(n.userMessage), a = c && r, u = $r(c, r), e[0] = n.userMessage, e[1] = r, e[2] = c, e[3] = a, e[4] = u) : (c = e[2], a = e[3], u = e[4]);
1854
+ const d = u;
1855
+ let f;
1856
+ e[5] !== n.userMessage.id || e[6] !== i ? (f = () => i(n.userMessage.id), e[5] = n.userMessage.id, e[6] = i, e[7] = f) : f = e[7];
1857
+ const m = f, p = c ? "0" : void 0, h = c ? "relative" : void 0, g = c ? r ? "expanded" : "collapsed" : void 0;
1858
+ let b;
1859
+ e[8] !== a ? (b = Or(a), e[8] = a, e[9] = b) : b = e[9];
1860
+ const y = a ? "auto" : "visible", w = c ? "xs" : void 0, T = c ? "xs" : void 0, R = a ? "3rem" : void 0, C = a ? Mr : void 0;
1861
+ let B;
1862
+ e[10] !== n.userMessage || e[11] !== s ? (B = /* @__PURE__ */ l(gn, { message: n.userMessage, streaming: s }), e[10] = n.userMessage, e[11] = s, e[12] = B) : B = e[12];
1863
+ let _;
1864
+ e[13] !== C || e[14] !== B || e[15] !== g || e[16] !== b || e[17] !== y || e[18] !== w || e[19] !== T || e[20] !== R ? (_ = /* @__PURE__ */ l(P, { "data-sticky-user-message-content": g, display: "flex", flexDirection: "column", gap: "sm", maxH: b, minH: "0", overflowY: y, px: w, py: T, pb: R, onWheel: C, children: B }), e[13] = C, e[14] = B, e[15] = g, e[16] = b, e[17] = y, e[18] = w, e[19] = T, e[20] = R, e[21] = _) : _ = e[21];
1865
+ let I;
1866
+ e[22] !== c || e[23] !== r || e[24] !== m ? (I = c && /* @__PURE__ */ l(Pr, { label: r ? "Show less" : "Show more", onClick: m }), e[22] = c, e[23] = r, e[24] = m, e[25] = I) : I = e[25];
1867
+ let M;
1868
+ e[26] !== d || e[27] !== _ || e[28] !== I || e[29] !== p || e[30] !== h ? (M = /* @__PURE__ */ l(P, { position: "sticky", top: "0", zIndex: 1, children: /* @__PURE__ */ l(ce.Root, { from: "user", children: /* @__PURE__ */ k(ce.Content, { from: "user", maxH: d, overflow: "hidden", p, position: h, children: [
1869
+ _,
1870
+ I
1871
+ ] }) }) }), e[26] = d, e[27] = _, e[28] = I, e[29] = p, e[30] = h, e[31] = M) : M = e[31];
1872
+ let O;
1873
+ if (e[32] !== n.responses || e[33] !== o || e[34] !== s) {
1874
+ let Q;
1875
+ e[36] !== o || e[37] !== s ? (Q = (ue) => bn(ue, s, o), e[36] = o, e[37] = s, e[38] = Q) : Q = e[38], O = n.responses.map(Q), e[32] = n.responses, e[33] = o, e[34] = s, e[35] = O;
1876
+ } else
1877
+ O = e[35];
1878
+ let E;
1879
+ return e[39] !== M || e[40] !== O ? (E = /* @__PURE__ */ k(P, { children: [
1880
+ M,
1881
+ O
1882
+ ] }), e[39] = M, e[40] = O, e[41] = E) : E = e[41], E;
1883
+ }, xi = (t) => {
1884
+ const e = S(29), {
1409
1885
  messages: n,
1410
- streaming: r,
1886
+ streaming: s,
1411
1887
  emptyStateTitle: o,
1412
- emptyStateDescription: s,
1413
- emptyStateContent: l,
1414
- loadingContent: a,
1415
- chatInputPlaceholder: c,
1416
- chatInputDefaultValue: d,
1417
- onSubmitMessage: f,
1418
- onInterrupt: u,
1419
- onChatInputChange: p,
1420
- actions: m,
1421
- repoMenu: g,
1422
- attachedResources: x,
1423
- onClearAttachments: w,
1424
- attachmentList: v,
1425
- approvalPrompt: L,
1426
- workspaceHub: J,
1427
- workspaceInitializing: Q,
1428
- inputDisabled: xe
1429
- } = t, C = r === void 0 ? !1 : r, ne = d === void 0 ? "" : d, ye = Q === void 0 ? !1 : Q, re = xe === void 0 ? !1 : xe, F = po(n), D = F.length > 0, Se = F.reduce(ho, 0), {
1430
- groups: _e,
1431
- leadingResponses: ke
1432
- } = mo(F), [oe, se] = me(go), ie = C ? a ?? l : l, M = !!J, W = C && D && !ye;
1433
- let Z;
1434
- e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Z = (S) => {
1435
- se((B) => {
1436
- const R = new Set(B);
1437
- return R.has(S) ? R.delete(S) : R.add(S), R;
1438
- });
1439
- }, e[0] = Z) : Z = e[0];
1440
- const ee = Z, Te = Je, O = D ? /* @__PURE__ */ b(te, { gap: "sm", children: [
1441
- ke.map((S) => bt(S, C)),
1442
- _e.map((S) => {
1443
- const B = Vn(S.userMessage), R = oe.has(S.userMessage.id);
1444
- return /* @__PURE__ */ b(k, { children: [
1445
- /* @__PURE__ */ b(k, { position: "sticky", top: "0", zIndex: 1, children: [
1446
- /* @__PURE__ */ b(k, { position: "relative", children: [
1447
- /* @__PURE__ */ i(V.Root, { from: "user", children: /* @__PURE__ */ i(V.Content, { from: "user", maxH: B && !R ? Nn : void 0, overflowY: "hidden", children: /* @__PURE__ */ i(Ft, { message: S.userMessage, streaming: C }) }) }),
1448
- B && !R && /* @__PURE__ */ i($, { position: "absolute", bottom: "0", left: "0", right: "0", justifyContent: "flex-end", alignItems: "flex-end", px: "xs", pb: "xs", pt: "lg", bgGradient: "to-t", gradientFrom: "bg.subtle", gradientTo: "transparent", borderBottomRadius: "xs", children: /* @__PURE__ */ i(Ce, { size: "2xs", variant: "solid", onClick: () => ee(S.userMessage.id), children: "Show more" }) })
1449
- ] }),
1450
- B && R && /* @__PURE__ */ i($, { justifyContent: "flex-end", mt: "2xs", mb: "sm", children: /* @__PURE__ */ i(Ce, { size: "2xs", variant: "ghost", onClick: () => ee(S.userMessage.id), children: "Show less" }) })
1451
- ] }),
1452
- S.responses.map((le) => bt(le, C))
1453
- ] }, S.userMessage.id);
1454
- })
1455
- ] }) : ie ?? /* @__PURE__ */ i(Sn, { icon: /* @__PURE__ */ i(mn, { size: 48, strokeWidth: 1.5 }), title: o, description: s });
1888
+ emptyStateDescription: r,
1889
+ emptyStateContent: i,
1890
+ loadingContent: c,
1891
+ chatInputPlaceholder: a,
1892
+ chatInputDefaultValue: u,
1893
+ onSubmitMessage: d,
1894
+ onInterrupt: f,
1895
+ onChatInputChange: m,
1896
+ actions: p,
1897
+ repoMenu: h,
1898
+ attachedResources: g,
1899
+ onClearAttachments: b,
1900
+ attachmentList: y,
1901
+ approvalPrompt: w,
1902
+ workspaceHub: T,
1903
+ workspaceInitializing: R,
1904
+ inputDisabled: C,
1905
+ chatInputQuestionPrompt: B
1906
+ } = t, _ = s === void 0 ? !1 : s, I = u === void 0 ? "" : u, M = R === void 0 ? !1 : R, O = C === void 0 ? !1 : C, E = Br(n), Q = E.length > 0, ue = E.reduce(Dr, 0), {
1907
+ groups: oe,
1908
+ leadingResponses: D
1909
+ } = Ir(E), [be, xe] = J(Lr), L = _ ? c ?? i : i, W = !!T, Be = !!B, de = _ && Q && !M;
1456
1910
  let H;
1457
- e[1] !== Te.Viewport || e[2] !== O ? (H = /* @__PURE__ */ i(Te.Viewport, { children: O }), e[1] = Te.Viewport, e[2] = O, e[3] = H) : H = e[3];
1458
- let _;
1459
- e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (_ = /* @__PURE__ */ i(Je.ScrollToBottom, { "aria-label": "Scroll to latest message" }), e[4] = _) : _ = e[4];
1460
- let P;
1461
- e[5] !== W ? (P = W ? /* @__PURE__ */ b(ge, { gap: "xs", px: "sm", py: "2xs", children: [
1462
- /* @__PURE__ */ i(nt, { size: "xs", color: "fg.muted" }),
1463
- /* @__PURE__ */ i(K, { textStyle: "label/XS/regular", color: "fg.muted", children: "Working..." })
1464
- ] }) : null, e[5] = W, e[6] = P) : P = e[6];
1465
- const j = M ? "0" : "xs";
1466
- let I;
1467
- e[7] !== ne ? (I = Hn(ne), e[7] = ne, e[8] = I) : I = e[8];
1468
- let A;
1469
- e[9] !== m || e[10] !== x || e[11] !== v || e[12] !== c || e[13] !== M || e[14] !== re || e[15] !== p || e[16] !== w || e[17] !== u || e[18] !== f || e[19] !== C || e[20] !== I ? (A = /* @__PURE__ */ i(Ln, { placeholder: c, defaultState: I, streaming: C, onSubmit: f, onInterrupt: u, onChange: p, actions: m, attachedResources: x, onClearAttachments: w, attachmentList: v, isDisabled: re, attachedToTop: M }), e[9] = m, e[10] = x, e[11] = v, e[12] = c, e[13] = M, e[14] = re, e[15] = p, e[16] = w, e[17] = u, e[18] = f, e[19] = C, e[20] = I, e[21] = A) : A = e[21];
1911
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (H = ($) => {
1912
+ xe((Ie) => {
1913
+ const K = new Set(Ie);
1914
+ return K.has($) ? K.delete($) : K.add($), K;
1915
+ });
1916
+ }, e[0] = H) : H = e[0];
1917
+ const Qe = H, se = kt, re = Q ? /* @__PURE__ */ k(F, { gap: "sm", children: [
1918
+ D.map(($) => bn($, _, oe.length > 0 || Be)),
1919
+ oe.map(($, Ie) => /* @__PURE__ */ l(Er, { group: $, streaming: _, hideQuestionForms: Ie < oe.length - 1 || Be, isExpanded: be.has($.userMessage.id), onToggleStickyMessage: Qe }, $.userMessage.id))
1920
+ ] }) : L ?? /* @__PURE__ */ l(lo, { icon: /* @__PURE__ */ l(Jn, { size: 48, strokeWidth: 1.5 }), title: o, description: r });
1921
+ let j;
1922
+ e[1] !== se.Viewport || e[2] !== re ? (j = /* @__PURE__ */ l(se.Viewport, { children: re }), e[1] = se.Viewport, e[2] = re, e[3] = j) : j = e[3];
1470
1923
  let N;
1471
- e[22] !== j || e[23] !== A || e[24] !== J ? (N = /* @__PURE__ */ b(te, { px: "sm", gap: j, children: [
1472
- J,
1473
- A
1474
- ] }), e[22] = j, e[23] = A, e[24] = J, e[25] = N) : N = e[25];
1475
- let z;
1476
- return e[26] !== g ? (z = /* @__PURE__ */ i($, { p: "2xs", justifyContent: "flex-end", children: g }), e[26] = g, e[27] = z) : z = e[27], /* @__PURE__ */ b($, { position: "relative", direction: "column", w: "full", h: "full", overflow: "hidden", children: [
1477
- /* @__PURE__ */ b(Je.Root, { children: [
1478
- /* @__PURE__ */ i(Mn, { userMessageCount: Se }),
1479
- H,
1480
- _
1924
+ e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (N = /* @__PURE__ */ l(kt.ScrollToBottom, { "aria-label": "Scroll to latest message" }), e[4] = N) : N = e[4];
1925
+ let V;
1926
+ e[5] !== de ? (V = de ? /* @__PURE__ */ k(Re, { gap: "xs", px: "sm", py: "2xs", children: [
1927
+ /* @__PURE__ */ l(Rt, { size: "xs", color: "fg.muted" }),
1928
+ /* @__PURE__ */ l(z, { textStyle: "label/XS/regular", color: "fg.muted", children: "Working..." })
1929
+ ] }) : null, e[5] = de, e[6] = V) : V = e[6];
1930
+ const U = W ? "0" : "xs";
1931
+ let q;
1932
+ e[7] !== I ? (q = jo(I), e[7] = I, e[8] = q) : q = e[8];
1933
+ let v;
1934
+ e[9] !== p || e[10] !== g || e[11] !== y || e[12] !== a || e[13] !== B || e[14] !== W || e[15] !== O || e[16] !== m || e[17] !== b || e[18] !== f || e[19] !== d || e[20] !== _ || e[21] !== q ? (v = /* @__PURE__ */ l(zo, { placeholder: a, defaultState: q, streaming: _, onSubmit: d, onInterrupt: f, onChange: m, actions: p, attachedResources: g, onClearAttachments: b, attachmentList: y, isDisabled: O, attachedToTop: W, questionPrompt: B }), e[9] = p, e[10] = g, e[11] = y, e[12] = a, e[13] = B, e[14] = W, e[15] = O, e[16] = m, e[17] = b, e[18] = f, e[19] = d, e[20] = _, e[21] = q, e[22] = v) : v = e[22];
1935
+ let G;
1936
+ e[23] !== U || e[24] !== v || e[25] !== T ? (G = /* @__PURE__ */ k(F, { px: "sm", gap: U, children: [
1937
+ T,
1938
+ v
1939
+ ] }), e[23] = U, e[24] = v, e[25] = T, e[26] = G) : G = e[26];
1940
+ let fe;
1941
+ return e[27] !== h ? (fe = /* @__PURE__ */ l(ae, { p: "2xs", justifyContent: "flex-end", children: h }), e[27] = h, e[28] = fe) : fe = e[28], /* @__PURE__ */ k(ae, { position: "relative", direction: "column", w: "full", h: "full", overflow: "hidden", children: [
1942
+ /* @__PURE__ */ k(kt.Root, { children: [
1943
+ /* @__PURE__ */ l(ko, { userMessageCount: ue }),
1944
+ j,
1945
+ N
1481
1946
  ] }),
1482
- L,
1483
- P,
1484
- N,
1485
- z
1947
+ w,
1948
+ V,
1949
+ G,
1950
+ fe
1486
1951
  ] });
1487
1952
  };
1488
- function ho(t, e) {
1953
+ function Dr(t, e) {
1489
1954
  return t + (e.role === "user" ? 1 : 0);
1490
1955
  }
1491
- function go() {
1956
+ function Lr() {
1492
1957
  return /* @__PURE__ */ new Set();
1493
1958
  }
1494
- const xt = (t) => /* @__PURE__ */ i(te, { gap: "xs", w: "full", children: t.map((e, n) => /* @__PURE__ */ i(Gt, { height: "3", width: e, borderRadius: "xs" }, `${e}-${n}`)) }), Zo = () => {
1495
- const t = y(2);
1959
+ const Ht = (t) => /* @__PURE__ */ l(F, { gap: "xs", w: "full", children: t.map((e, n) => /* @__PURE__ */ l(Pn, { height: "3", width: e, borderRadius: "xs" }, `${e}-${n}`)) }), yi = () => {
1960
+ const t = S(2);
1496
1961
  let e;
1497
- t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ i(V.Root, { from: "user", children: /* @__PURE__ */ i(V.Content, { from: "user", children: xt(["72%", "46%"]) }) }), t[0] = e) : e = t[0];
1962
+ t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ l(ce.Root, { from: "user", children: /* @__PURE__ */ l(ce.Content, { from: "user", children: Ht(["72%", "46%"]) }) }), t[0] = e) : e = t[0];
1498
1963
  let n;
1499
- return t[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (n = /* @__PURE__ */ b(te, { minH: "full", py: "xs", gap: "0", children: [
1964
+ return t[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (n = /* @__PURE__ */ k(F, { minH: "full", py: "xs", gap: "0", children: [
1500
1965
  e,
1501
- /* @__PURE__ */ i(V.Root, { from: "assistant", children: /* @__PURE__ */ i(V.Content, { from: "assistant", children: xt(["76%", "62%", "40%"]) }) })
1966
+ /* @__PURE__ */ l(ce.Root, { from: "assistant", children: /* @__PURE__ */ l(ce.Content, { from: "assistant", children: Ht(["76%", "62%", "40%"]) }) })
1502
1967
  ] }), t[1] = n) : n = t[1], n;
1503
- }, es = (t) => {
1504
- const e = y(14), {
1968
+ }, Si = (t) => {
1969
+ const e = S(14), {
1505
1970
  changesLabel: n,
1506
- additions: r,
1971
+ additions: s,
1507
1972
  deletions: o,
1508
- action: s,
1509
- status: l,
1510
- statusLabel: a
1511
- } = t, c = l === void 0 ? "ready" : l, d = r > 0 || o > 0, f = c === "error" ? "border.error" : "border.muted", u = c === "error" ? "bg.error" : "bg.subtle";
1512
- let p;
1513
- e[0] !== r || e[1] !== n || e[2] !== o || e[3] !== d || e[4] !== c || e[5] !== a ? (p = c === "loading" ? /* @__PURE__ */ b(ge, { gap: "xs", minW: "0", children: [
1514
- /* @__PURE__ */ i(nt, { size: "xs", color: "fg.muted" }),
1515
- /* @__PURE__ */ i(K, { textStyle: "label/S/regular", color: "fg.muted", truncate: !0, children: a ?? "Setting up workspace..." })
1516
- ] }) : c === "error" ? /* @__PURE__ */ b(ge, { gap: "xs", minW: "0", children: [
1517
- /* @__PURE__ */ i(Tt, { size: 14, color: "var(--chakra-colors-fg-error)" }),
1518
- /* @__PURE__ */ i(K, { textStyle: "label/S/regular", color: "fg.error", truncate: !0, children: a ?? "Workspace setup failed" })
1519
- ] }) : d ? /* @__PURE__ */ i(_t, { label: n, additions: r, deletions: o, variant: "ghost", size: "small", _hover: {
1520
- background: "transparent"
1521
- } }) : /* @__PURE__ */ i($, { flex: "1" }), e[0] = r, e[1] = n, e[2] = o, e[3] = d, e[4] = c, e[5] = a, e[6] = p) : p = e[6];
1973
+ action: r,
1974
+ status: i,
1975
+ statusLabel: c
1976
+ } = t, a = i === void 0 ? "ready" : i, u = s > 0 || o > 0, d = a === "error" ? "border.error" : "border.muted", f = a === "error" ? "bg.error" : "bg.subtle";
1522
1977
  let m;
1523
- e[7] !== s ? (m = s ? /* @__PURE__ */ i($, { flexShrink: 0, ml: "auto", children: s }) : null, e[7] = s, e[8] = m) : m = e[8];
1524
- let g;
1525
- return e[9] !== f || e[10] !== u || e[11] !== p || e[12] !== m ? (g = /* @__PURE__ */ b($, { align: "center", justify: "space-between", gap: "sm", minW: "0", px: "sm", py: "xs", borderWidth: "1px", borderColor: f, borderRadius: "xs", borderBottomRadius: "0", bg: u, children: [
1526
- p,
1527
- m
1528
- ] }), e[9] = f, e[10] = u, e[11] = p, e[12] = m, e[13] = g) : g = e[13], g;
1978
+ e[0] !== s || e[1] !== n || e[2] !== o || e[3] !== u || e[4] !== a || e[5] !== c ? (m = a === "loading" ? /* @__PURE__ */ k(Re, { gap: "xs", minW: "0", children: [
1979
+ /* @__PURE__ */ l(Rt, { size: "xs", color: "fg.muted" }),
1980
+ /* @__PURE__ */ l(z, { textStyle: "label/S/regular", color: "fg.muted", truncate: !0, children: c ?? "Setting up workspace..." })
1981
+ ] }) : a === "error" ? /* @__PURE__ */ k(Re, { gap: "xs", minW: "0", children: [
1982
+ /* @__PURE__ */ l(Ut, { size: 14, color: "var(--chakra-colors-fg-error)" }),
1983
+ /* @__PURE__ */ l(z, { textStyle: "label/S/regular", color: "fg.error", truncate: !0, children: c ?? "Workspace setup failed" })
1984
+ ] }) : u ? /* @__PURE__ */ l(Yt, { label: n, additions: s, deletions: o, variant: "ghost", size: "small", _hover: {
1985
+ background: "transparent"
1986
+ } }) : /* @__PURE__ */ l(ae, { flex: "1" }), e[0] = s, e[1] = n, e[2] = o, e[3] = u, e[4] = a, e[5] = c, e[6] = m) : m = e[6];
1987
+ let p;
1988
+ e[7] !== r ? (p = r ? /* @__PURE__ */ l(ae, { flexShrink: 0, ml: "auto", children: r }) : null, e[7] = r, e[8] = p) : p = e[8];
1989
+ let h;
1990
+ return e[9] !== d || e[10] !== f || e[11] !== m || e[12] !== p ? (h = /* @__PURE__ */ k(ae, { align: "center", justify: "space-between", gap: "sm", minW: "0", px: "sm", py: "xs", borderWidth: "1px", borderColor: d, borderRadius: "xs", borderBottomRadius: "0", bg: f, children: [
1991
+ m,
1992
+ p
1993
+ ] }), e[9] = d, e[10] = f, e[11] = m, e[12] = p, e[13] = h) : h = e[13], h;
1529
1994
  };
1530
1995
  export {
1531
- Jo as ApprovalPrompt,
1532
- Mn as AutoScroll,
1533
- Ln as ChatInput,
1534
- V as ChatMessage,
1535
- Qo as ChatPanel,
1536
- Je as ChatPrimitives,
1537
- Zo as ChatSkeleton,
1538
- es as ChatWorkspaceHub,
1539
- $n as SendButton,
1540
- Hn as createSerializedPromptState
1996
+ bi as ApprovalPrompt,
1997
+ ko as AutoScroll,
1998
+ zo as ChatInput,
1999
+ ce as ChatMessage,
2000
+ xi as ChatPanel,
2001
+ kt as ChatPrimitives,
2002
+ yi as ChatSkeleton,
2003
+ Si as ChatWorkspaceHub,
2004
+ vo as SendButton,
2005
+ jo as createSerializedPromptState
1541
2006
  };
1542
2007
  //# sourceMappingURL=chat-ui.js.map