@pstdio/ui 0.4.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 (134) hide show
  1. package/dist/MermaidComponent-x3aKzNXm.js +124 -0
  2. package/dist/MermaidComponent-x3aKzNXm.js.map +1 -0
  3. package/dist/chat-ui.js +1364 -795
  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-actions.d.ts +10 -0
  7. package/dist/components/chat-ui/components/chat-input-question-prompt.d.ts +33 -0
  8. package/dist/components/chat-ui/components/chat-input.d.ts +3 -1
  9. package/dist/components/chat-ui/components/chat-panel-sticky-user-message.d.ts +9 -0
  10. package/dist/components/chat-ui/components/chat-panel.d.ts +4 -1
  11. package/dist/components/chat-ui/components/message-parts-renderer.d.ts +1 -0
  12. package/dist/components/chat-ui/components/timeline-tool-blocks.d.ts +14 -0
  13. package/dist/components/chat-ui/components/timeline.d.ts +22 -0
  14. package/dist/components/chat-ui/components/tool-invocation-timeline.d.ts +2 -1
  15. package/dist/components/chat-ui/index.d.ts +1 -0
  16. package/dist/components/chat-ui/tool-rendering/apply-patch-renderer.d.ts +2 -0
  17. package/dist/components/chat-ui/tool-rendering/build-timeline.d.ts +2 -2
  18. package/dist/components/chat-ui/tool-rendering/default-renderers.d.ts +10 -7
  19. package/dist/components/chat-ui/tool-rendering/edit-renderer.d.ts +2 -0
  20. package/dist/components/chat-ui/tool-rendering/question-renderer.d.ts +10 -0
  21. package/dist/components/chat-ui/tool-rendering/shared.d.ts +52 -0
  22. package/dist/components/chat-ui/tool-rendering/standard-renderers.d.ts +6 -0
  23. package/dist/components/chat-ui/tool-rendering/todowrite-renderer.d.ts +10 -0
  24. package/dist/components/chat-ui/utils/get-icon.d.ts +2 -0
  25. package/dist/components/chat-ui/utils/tool-name.d.ts +2 -0
  26. package/dist/components/menu-item.d.ts +2 -1
  27. package/dist/components/radio.d.ts +8 -0
  28. package/dist/components/resource-context-menu.d.ts +20 -0
  29. package/dist/components/rich-text/prompt-input/plugins/ReferencePlugin/nodes/ReferenceNode/ReferenceNode.d.ts +2 -1
  30. package/dist/components/rich-text/shared/plugins/CodePlugin/CodeBlockActionsPlugin.d.ts +4 -0
  31. package/dist/components/rich-text/shared/plugins/CodePlugin/CodeBlockPlugin.d.ts +2 -0
  32. package/dist/components/rich-text/shared/plugins/CodePlugin/CodeHighlightingPlugin.d.ts +1 -0
  33. package/dist/components/rich-text/shared/plugins/FloatingTextFormatToolbarPlugin/should-show-floating-toolbar.d.ts +11 -0
  34. package/dist/components/rich-text/shared/plugins/MermaidPlugin/MermaidComponent.d.ts +6 -0
  35. package/dist/components/rich-text/shared/plugins/MermaidPlugin/MermaidNode.d.ts +23 -0
  36. package/dist/components/rich-text/shared/plugins/MermaidPlugin/index.d.ts +1 -0
  37. package/dist/components/rich-text/utils/markdown.d.ts +1 -0
  38. package/dist/components/session-indicator.d.ts +1 -1
  39. package/dist/components/sidebar-tree/sidebar-tree.types.d.ts +5 -1
  40. package/dist/components/tickets/tag-badge.d.ts +10 -0
  41. package/dist/components/tickets/tag-option-icon.d.ts +2 -0
  42. package/dist/components/tickets/ticket-board.d.ts +8 -2
  43. package/dist/components/tickets/ticket-card.d.ts +10 -0
  44. package/dist/components/tickets/ticket-grouping.d.ts +2 -2
  45. package/dist/components/tickets/ticket-list.d.ts +9 -1
  46. package/dist/components/tickets/tickets-workspace.d.ts +11 -3
  47. package/dist/components/tickets/types.d.ts +22 -5
  48. package/dist/components/tickets/workspace-helpers.d.ts +18 -0
  49. package/dist/get-file-type-icon-Bwqf1WXA.js +101 -0
  50. package/dist/get-file-type-icon-Bwqf1WXA.js.map +1 -0
  51. package/dist/index.d.ts +6 -2
  52. package/dist/index.js +1886 -1583
  53. package/dist/index.js.map +1 -1
  54. package/dist/radio-C42qncrD.js +236 -0
  55. package/dist/radio-C42qncrD.js.map +1 -0
  56. package/dist/rich-message-CoXTd5kw.js +1512 -0
  57. package/dist/rich-message-CoXTd5kw.js.map +1 -0
  58. package/dist/rich-text.js +414 -255
  59. package/dist/rich-text.js.map +1 -1
  60. package/dist/style.css +1 -1
  61. package/dist/theme/recipes/button.d.ts +6 -0
  62. package/dist/{theme-D0VvFB1Y.js → theme-BLGUwVOD.js} +7 -1
  63. package/dist/theme-BLGUwVOD.js.map +1 -0
  64. package/dist/theme.js +1 -1
  65. package/package.json +3 -1
  66. package/dist/components/attached-panel.utils.test.d.ts +0 -1
  67. package/dist/components/breadcrumb.stories.d.ts +0 -25
  68. package/dist/components/button.stories.d.ts +0 -18
  69. package/dist/components/chat-ui/components/ai-conversation.stories.d.ts +0 -6
  70. package/dist/components/chat-ui/components/ai-message.stories.d.ts +0 -6
  71. package/dist/components/chat-ui/components/ai-response.stories.d.ts +0 -7
  72. package/dist/components/chat-ui/components/attachment-list.stories.d.ts +0 -6
  73. package/dist/components/chat-ui/components/chat-input.stories.d.ts +0 -7
  74. package/dist/components/chat-ui/components/chat-panel-alerts.stories.d.ts +0 -9
  75. package/dist/components/chat-ui/components/chat-panel.stories.d.ts +0 -10
  76. package/dist/components/chat-ui/components/message-parts-renderer.stories.d.ts +0 -9
  77. package/dist/components/chat-ui/components/model-swap-separator.stories.d.ts +0 -6
  78. package/dist/components/chat-ui/components/tool-invocation-timeline.stories.d.ts +0 -6
  79. package/dist/components/chat-ui/components/workspace-hub.stories.d.ts +0 -6
  80. package/dist/components/checkbox.stories.d.ts +0 -15
  81. package/dist/components/column-file-browser.stories.d.ts +0 -15
  82. package/dist/components/data-table/data-table.stories.d.ts +0 -33
  83. package/dist/components/delete-confirmation-modal.stories.d.ts +0 -11
  84. package/dist/components/diff-bubble.stories.d.ts +0 -13
  85. package/dist/components/diff-drawer.stories.d.ts +0 -8
  86. package/dist/components/diff-view-adapter.test.d.ts +0 -1
  87. package/dist/components/drawer-inline.stories.d.ts +0 -8
  88. package/dist/components/empty-state.stories.d.ts +0 -34
  89. package/dist/components/file-selector.stories.d.ts +0 -17
  90. package/dist/components/folder-picker-dialog.stories.d.ts +0 -11
  91. package/dist/components/info-card.stories.d.ts +0 -41
  92. package/dist/components/item-section.stories.d.ts +0 -17
  93. package/dist/components/layout.stories.d.ts +0 -11
  94. package/dist/components/menu-item.stories.d.ts +0 -72
  95. package/dist/components/open-source-notices-screen.stories.d.ts +0 -12
  96. package/dist/components/param-editor-horizontal.stories.d.ts +0 -19
  97. package/dist/components/param-editor.stories.d.ts +0 -24
  98. package/dist/components/properties.stories.d.ts +0 -17
  99. package/dist/components/resource-badge.stories.d.ts +0 -7
  100. package/dist/components/rich-text/collaborative-markdown-editor/collaborative-markdown-editor.stories.d.ts +0 -9
  101. package/dist/components/rich-text/markdown-editor/markdown-editor.stories.d.ts +0 -7
  102. package/dist/components/rich-text/prompt-input/prompt-input.stories.d.ts +0 -8
  103. package/dist/components/rich-text/rich-message/rich-message.stories.d.ts +0 -6
  104. package/dist/components/rich-text/shared/nodes/DataTableNode.stories.d.ts +0 -7
  105. package/dist/components/rich-text/shared/plugins/CodePlugin/CodeNode.d.ts +0 -21
  106. package/dist/components/rich-text/shared/plugins/CodePlugin/CodeNode.test.d.ts +0 -1
  107. package/dist/components/rich-text/shared/transformers/markdown-transformers.test.d.ts +0 -1
  108. package/dist/components/scroll-area.stories.d.ts +0 -7
  109. package/dist/components/searchable-menu.stories.d.ts +0 -8
  110. package/dist/components/session-indicator.stories.d.ts +0 -12
  111. package/dist/components/sidebar/sidebar.store.test.d.ts +0 -1
  112. package/dist/components/sidebar/sidebar.stories.d.ts +0 -11
  113. package/dist/components/sidebar-tree/sidebar-tree-searchable-action-menu.stories.d.ts +0 -6
  114. package/dist/components/sidebar-tree/sidebar-tree.stories.d.ts +0 -13
  115. package/dist/components/slider.stories.d.ts +0 -15
  116. package/dist/components/style-guide.stories.d.ts +0 -23
  117. package/dist/components/switch.stories.d.ts +0 -16
  118. package/dist/components/tickets/display-menu.stories.d.ts +0 -6
  119. package/dist/components/tickets/filter-menu.stories.d.ts +0 -6
  120. package/dist/components/tickets/ticket-board.stories.d.ts +0 -5
  121. package/dist/components/tickets/ticket-card.stories.d.ts +0 -18
  122. package/dist/components/tickets/ticket-grouping.test.d.ts +0 -1
  123. package/dist/components/tickets/ticket-list.stories.d.ts +0 -10
  124. package/dist/components/tickets/tickets-workspace.stories.d.ts +0 -10
  125. package/dist/components/tickets/use-workspace-store.test.d.ts +0 -1
  126. package/dist/components/toaster.stories.d.ts +0 -11
  127. package/dist/components/workspace-badge.stories.d.ts +0 -13
  128. package/dist/empty-state-yGspgiPl.js +0 -185
  129. package/dist/empty-state-yGspgiPl.js.map +0 -1
  130. package/dist/get-file-type-icon-CirIyuE8.js +0 -92
  131. package/dist/get-file-type-icon-CirIyuE8.js.map +0 -1
  132. package/dist/rich-message-Bad4GxH2.js +0 -1423
  133. package/dist/rich-message-Bad4GxH2.js.map +0 -1
  134. 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 Ve } from "react/jsx-runtime";
2
- import { c as y } from "react/compiler-runtime";
3
- import { chakra as Pt, AbsoluteCenter as It, IconButton as lt, defineSlotRecipe as vt, createSlotRecipeContext as At, Text as Y, Code as Qe, Button as Se, HStack as ke, Box as k, Flex as $, Tooltip as Ae, Portal as Bt, Kbd as Dt, Spacer as Mt, Timeline as zt, Span as ye, Avatar as ae, Card as E, Link as at, Stack as Te, Spinner as qe, Skeleton as Et } from "@chakra-ui/react";
4
- import { ArrowDownIcon as $t, ShieldX as Lt, ShieldCheck as Ft, Square as Ot, ArrowUp as Wt, Move as Ht, FileDown as jt, FileUp as Nt, FileDiff as Ut, Trash2 as Vt, FilePen as qt, FileText as Gt, ListTree as Kt, Terminal as ct, File as Xt, Globe as Yt, Search as Jt, AlertTriangle as dt, DotIcon as Qt, ChevronUpIcon as Zt, MessageCircleIcon as en } from "lucide-react";
5
- import { StickToBottom as tn, useStickToBottomContext as Ge } from "use-stick-to-bottom";
6
- import { S as ut } from "./get-file-type-icon-CirIyuE8.js";
7
- import { useRef as Ne, useEffect as Ue, useState as le } from "react";
8
- import { f as We, P as nn, g as rn, R as ft, h as on } from "./rich-message-Bad4GxH2.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";
@@ -14,29 +14,30 @@ import "@lexical/react/LexicalHorizontalRulePlugin";
14
14
  import "@lexical/react/LexicalLinkPlugin";
15
15
  import "@lexical/react/LexicalListPlugin";
16
16
  import "@lexical/react/LexicalRichTextPlugin";
17
+ import "@lexical/react/LexicalTabIndentationPlugin";
17
18
  import "y-websocket";
18
19
  import "yjs";
19
20
  import "@lexical/code";
20
21
  import "@lexical/react/LexicalComposerContext";
22
+ import "@lexical/utils";
21
23
  import "lexical";
24
+ import "react-dom";
22
25
  import "@lexical/list";
23
26
  import "@lexical/rich-text";
24
27
  import "@lexical/selection";
25
- import "@lexical/utils";
26
- import "react-dom";
27
28
  import "@lexical/markdown";
28
29
  import "@lexical/react/LexicalAutoFocusPlugin";
29
30
  import "@lexical/react/LexicalCheckListPlugin";
30
31
  import "@lexical/react/LexicalHistoryPlugin";
31
32
  import "@lexical/react/LexicalOnChangePlugin";
32
33
  import "@lexical/react/LexicalTreeView";
33
- import { D as sn, a as pt, A as Ze, E as ln } from "./empty-state-yGspgiPl.js";
34
- const an = {
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 = {
35
36
  "aria-roledescription": "conversation",
36
37
  initial: "instant",
37
38
  resize: "instant",
38
39
  role: "log"
39
- }, cn = Pt(tn, {
40
+ }, ao = kn(Zn, {
40
41
  base: {
41
42
  position: "relative",
42
43
  flex: 1,
@@ -45,42 +46,42 @@ const an = {
45
46
  }
46
47
  }, {
47
48
  forwardProps: ["resize"],
48
- defaultProps: an
49
- }), dn = (t) => {
50
- const e = y(9);
51
- let n, r;
49
+ defaultProps: co
50
+ }), uo = (t) => {
51
+ const e = S(9);
52
+ let n, s;
52
53
  e[0] !== t ? ({
53
54
  children: n,
54
- ...r
55
- } = 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]);
56
57
  const {
57
58
  contentRef: o,
58
- scrollRef: s
59
- } = Ge(), l = s, a = o;
60
- let c;
61
- 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 = {
62
63
  p: "sm",
63
64
  "aria-live": "polite",
64
65
  role: "list"
65
- }, e[3] = c) : c = e[3];
66
- let d;
67
- return e[4] !== n || e[5] !== r || e[6] !== l || e[7] !== a ? (d = /* @__PURE__ */ i(ut, { ...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;
68
- }, un = {
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 = {
69
70
  axis: "horizontal",
70
71
  bottom: "md",
71
72
  zIndex: 2
72
- }, fn = (t) => {
73
- const e = y(4), {
73
+ }, po = (t) => {
74
+ const e = S(4), {
74
75
  isAtBottom: n,
75
- scrollToBottom: r
76
- } = Ge();
76
+ scrollToBottom: s
77
+ } = Bt();
77
78
  let o;
78
- return e[0] !== n || e[1] !== t || e[2] !== r ? (o = !n && /* @__PURE__ */ i(It, { ...un, children: /* @__PURE__ */ i(lt, { rounded: "full", onClick: () => r(), variant: "outline", size: "xs", ...t, children: /* @__PURE__ */ i($t, { size: 16 }) }) }), e[0] = n, e[1] = t, e[2] = r, e[3] = o) : o = e[3], o;
79
- }, He = {
80
- Root: cn,
81
- Viewport: dn,
82
- ScrollToBottom: fn
83
- }, pn = vt({
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({
84
85
  className: "ai-message",
85
86
  slots: ["root", "content"],
86
87
  base: {
@@ -185,335 +186,665 @@ const an = {
185
186
  shape: "rounded"
186
187
  }
187
188
  }), {
188
- withProvider: mn,
189
- withContext: hn
190
- } = At({
191
- recipe: pn
192
- }), gn = mn("div", "root"), bn = hn("div", "content"), V = {
193
- Root: gn,
194
- Content: bn
195
- }, xn = (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) => {
196
197
  if (t == null) return null;
197
198
  const e = typeof t == "string" ? t : JSON.stringify(t, null, 2);
198
199
  return e.length === 0 ? null : e.length > 200 ? `${e.slice(0, 200)}...` : e;
199
- }, Ao = (t) => {
200
- const e = y(19), {
200
+ }, bi = (t) => {
201
+ const e = S(19), {
201
202
  toolName: n,
202
- toolInput: r,
203
+ toolInput: s,
203
204
  onApprove: o,
204
- onDeny: s
205
+ onDeny: r
205
206
  } = t;
206
- let l;
207
- e[0] !== r ? (l = xn(r), e[0] = r, e[1] = l) : l = e[1];
208
- const a = l;
209
- let c;
210
- e[2] !== n ? (c = /* @__PURE__ */ b(Y, { 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: [
211
212
  "Allow ",
212
- /* @__PURE__ */ i(Qe, { size: "sm", children: n }),
213
+ /* @__PURE__ */ l(Et, { size: "sm", children: n }),
213
214
  "?"
214
- ] }), 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];
215
218
  let d;
216
- e[4] !== a ? (d = a ? /* @__PURE__ */ i(Qe, { 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];
217
220
  let f;
218
- e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ i(Lt, { size: 14 }), e[6] = f) : f = e[6];
219
- let u;
220
- e[7] !== s ? (u = /* @__PURE__ */ b(Se, { size: "xs", variant: "outline", onClick: s, children: [
221
- f,
221
+ e[7] !== r ? (f = /* @__PURE__ */ k(Ee, { size: "xs", variant: "outline", onClick: r, children: [
222
+ d,
222
223
  "Deny"
223
- ] }), e[7] = s, e[8] = u) : u = e[8];
224
- let p;
225
- e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ i(Ft, { size: 14 }), e[9] = p) : p = e[9];
224
+ ] }), e[7] = r, e[8] = f) : f = e[8];
226
225
  let m;
227
- e[10] !== o ? (m = /* @__PURE__ */ b(Se, { size: "xs", colorPalette: "green", onClick: o, children: [
228
- 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,
229
230
  "Allow"
230
- ] }), e[10] = o, e[11] = m) : m = e[11];
231
+ ] }), e[10] = o, e[11] = p) : p = e[11];
231
232
  let h;
232
- e[12] !== u || e[13] !== m ? (h = /* @__PURE__ */ b(ke, { gap: "xs", justifyContent: "flex-end", children: [
233
- u,
234
- m
235
- ] }), e[12] = u, e[13] = m, e[14] = h) : h = e[14];
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];
236
237
  let g;
237
- return e[15] !== c || e[16] !== d || e[17] !== h ? (g = /* @__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: [
238
- c,
239
- d,
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,
240
+ u,
240
241
  h
241
- ] }) }), e[15] = c, e[16] = d, e[17] = h, e[18] = g) : g = e[18], g;
242
- }, yn = (t) => {
242
+ ] }) }), e[15] = a, e[16] = u, e[17] = h, e[18] = g) : g = e[18], g;
243
+ }, So = (t) => {
243
244
  const {
244
245
  previousUserMessageCount: e,
245
246
  userMessageCount: n
246
247
  } = t;
247
248
  return e === 0 ? !1 : n > e;
248
249
  };
249
- function Sn(t) {
250
- const e = y(4), {
250
+ function ko(t) {
251
+ const e = S(4), {
251
252
  userMessageCount: n
252
253
  } = t, {
253
- scrollToBottom: r
254
- } = Ge(), o = Ne(n);
255
- let s, l;
256
- return e[0] !== r || e[1] !== n ? (s = () => {
257
- yn({
254
+ scrollToBottom: s
255
+ } = Bt(), o = Je(n);
256
+ let r, i;
257
+ return e[0] !== s || e[1] !== n ? (r = () => {
258
+ So({
258
259
  previousUserMessageCount: o.current,
259
260
  userMessageCount: n
260
- }) && r(), o.current = n;
261
- }, l = [n, r], e[0] = r, e[1] = n, e[2] = s, e[3] = l) : (s = e[2], l = e[3]), Ue(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
+ }
264
+ const Jt = (t) => t.trim().length > 0, wo = (t) => {
265
+ const {
266
+ isDisabled: e,
267
+ streaming: n,
268
+ text: s
269
+ } = t;
270
+ return e || n || !Jt(s) ? "none" : "submit";
271
+ }, To = (t) => {
272
+ const {
273
+ canInterrupt: e,
274
+ isDisabled: n,
275
+ streaming: s,
276
+ text: o
277
+ } = t;
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}`);
262
377
  }
263
- const kn = (t) => {
264
- const e = y(22);
265
- let n, r, o, s;
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;
266
505
  e[0] !== t ? ({
267
- title: s,
506
+ title: r,
268
507
  shortcut: o,
269
508
  canInterrupt: n,
270
- ...r
271
- } = 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]);
272
- const l = r["aria-label"] ?? s;
273
- let a;
274
- e[5] !== n ? (a = n ? /* @__PURE__ */ i(Ot, { size: 16, strokeWidth: 2, fill: "currentColor" }) : /* @__PURE__ */ i(Wt, { size: 16, strokeWidth: 2 }), e[5] = n, e[6] = a) : a = e[6];
275
- const c = a;
276
- let d;
277
- e[7] !== l || e[8] !== c || e[9] !== r || e[10] !== s ? (d = /* @__PURE__ */ i(lt, { "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];
278
- const f = d;
279
- if (s) {
280
- let u;
281
- e[12] !== o || e[13] !== s ? (u = o ? /* @__PURE__ */ b(Ve, { children: [
282
- 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,
283
522
  " ",
284
- /* @__PURE__ */ i(Dt, { fontSize: "xs", children: o })
285
- ] }) : s, e[12] = o, e[13] = s, e[14] = u) : u = e[14];
286
- const p = u;
287
- let m;
288
- e[15] !== f ? (m = /* @__PURE__ */ i(Ae.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];
289
528
  let h;
290
- e[17] !== p ? (h = /* @__PURE__ */ i(Bt, { children: /* @__PURE__ */ i(Ae.Positioner, { children: /* @__PURE__ */ i(Ae.Content, { children: p }) }) }), e[17] = p, e[18] = h) : h = e[18];
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];
291
530
  let g;
292
- return e[19] !== m || e[20] !== h ? (g = /* @__PURE__ */ b(Ae.Root, { closeDelay: 50, openDelay: 100, children: [
293
- m,
531
+ return e[19] !== p || e[20] !== h ? (g = /* @__PURE__ */ k(Ye.Root, { closeDelay: 50, openDelay: 100, children: [
532
+ p,
294
533
  h
295
- ] }), e[19] = m, e[20] = h, e[21] = g) : g = e[21], g;
534
+ ] }), e[19] = p, e[20] = h, e[21] = g) : g = e[21], g;
296
535
  }
297
- return f;
298
- }, Tn = (t) => {
299
- const e = y(66), {
536
+ return d;
537
+ }, zo = (t) => {
538
+ const e = S(91), {
300
539
  defaultState: n,
301
- onSubmit: r,
540
+ onSubmit: s,
302
541
  onInterrupt: o,
303
- streaming: s,
304
- attachedResources: l,
305
- onClearAttachments: a,
306
- isDisabled: c,
307
- onChange: d,
308
- placeholder: f,
309
- attachmentList: u,
310
- actions: p,
311
- attachedToTop: m
312
- } = t, h = r === void 0 ? wn : r, g = s === void 0 ? !1 : s;
313
- let T;
314
- e[0] !== l ? (T = l === void 0 ? [] : l, e[0] = l, e[1] = T) : T = e[1];
315
- const L = T, w = c === void 0 ? !1 : c, pe = m === void 0 ? !1 : m, [q, P] = le(!1), [G, we] = le(n), [K, J] = le(0);
316
- let X;
317
- e[2] !== n ? (X = () => We(n), e[2] = n, e[3] = X) : X = e[3];
318
- const [F, me] = le(X), Ce = Ne(null), he = Ne(d);
319
- let Q, Z;
320
- e[4] !== d ? (Q = () => {
321
- he.current = d;
322
- }, Z = [d], e[4] = d, e[5] = Q, e[6] = Z) : (Q = e[5], Z = e[6]), Ue(Q, Z);
323
- let A, O;
324
- e[7] !== n ? (O = () => {
325
- const _ = We(n);
326
- we(n), J(Cn), me(_), he.current?.(_);
327
- }, A = [n], e[7] = n, e[8] = A, e[9] = O) : (A = e[8], O = e[9]), Ue(O, A);
328
- let B;
329
- e[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (B = () => {
330
- const _ = Ce.current?.querySelector('[contenteditable="true"]');
331
- _ instanceof HTMLElement && _.focus();
332
- }, e[10] = B) : B = e[10];
333
- const ge = B;
334
- let W;
335
- e[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (W = () => {
336
- P(!0), ge();
337
- }, e[11] = W) : W = e[11];
338
- const be = W;
339
- let D;
340
- e[12] !== n ? (D = (_) => {
341
- const Rt = _ === void 0 ? !1 : _;
342
- we(n), J(_n);
343
- const Je = We(n);
344
- me(Je), he.current?.(Je), Rt && requestAnimationFrame(() => {
345
- ge();
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();
346
602
  });
347
- }, e[12] = n, e[13] = D) : D = e[13];
348
- const H = D;
349
- let M;
350
- e[14] !== L || e[15] !== w || e[16] !== a || e[17] !== o || e[18] !== h || e[19] !== H || e[20] !== g || e[21] !== F ? (M = () => {
351
- if (w)
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)
352
621
  return;
353
- if (g) {
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") {
354
631
  o?.();
355
632
  return;
356
633
  }
357
- const _ = F.trim();
358
- _ && (h(_, L), H(!0), a?.());
359
- }, e[14] = L, e[15] = w, e[16] = a, e[17] = o, e[18] = h, e[19] = H, e[20] = g, e[21] = F, e[22] = M) : M = e[22];
360
- const v = M, C = g && !!o;
361
- let I;
362
- e[23] !== f ? (I = f ? /* @__PURE__ */ i(Y, { textStyle: "label/M/regular", color: "fg.subtle", pointerEvents: "none", position: "absolute", top: "0", children: f }) : void 0, e[23] = f, e[24] = I) : I = e[24];
363
- const j = I, N = pe ? "-1px" : void 0, S = pe ? "0" : void 0, z = q ? "blue.border" : "border.muted", R = q ? "mid" : "low", xe = q ? 1 : 0, $e = q ? "blue.border" : "border";
364
- let ee;
365
- e[25] !== $e ? (ee = {
366
- borderColor: $e,
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,
367
677
  boxShadow: "mid",
368
678
  zIndex: 1
369
- }, e[25] = $e, e[26] = ee) : ee = e[26];
370
- let _e;
371
- e[27] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (_e = {
679
+ }, e[55] = ht, e[56] = Se) : Se = e[56];
680
+ let Ue;
681
+ e[57] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Ue = {
372
682
  borderColor: "blue.border",
373
683
  boxShadow: "mid",
374
684
  zIndex: 1
375
- }, e[27] = _e) : _e = e[27];
376
- let Re;
377
- e[28] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Re = () => P(!1), e[28] = Re) : Re = e[28];
378
- let Pe;
379
- e[29] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Pe = {
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: {
380
690
  pr: "2xs"
381
- }, e[29] = Pe) : Pe = e[29];
382
- const Le = !w;
383
- let te;
384
- e[30] !== d ? (te = (_) => {
385
- me(_), d?.(_);
386
- }, e[30] = d, e[31] = te) : te = e[31];
387
- let ne;
388
- e[32] !== K || e[33] !== G || e[34] !== v || e[35] !== j || e[36] !== Le || e[37] !== te ? (ne = /* @__PURE__ */ i(ut, { maxH: "10rem", showHorizontalScrollbar: !1, contentProps: Pe, children: /* @__PURE__ */ i(nn, { defaultState: G, isEditable: Le, placeholder: j, onChange: te, onSubmit: v }, K) }), e[32] = K, e[33] = G, e[34] = v, e[35] = j, e[36] = Le, e[37] = te, e[38] = ne) : ne = e[38];
389
- let Ie;
390
- e[39] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Ie = /* @__PURE__ */ i(Mt, {}), e[39] = Ie) : Ie = e[39];
391
- const Fe = C ? "Stop Response" : "Message Sending", Oe = g ? void 0 : "Enter";
392
- let re;
393
- e[40] !== C || e[41] !== w || e[42] !== g || e[43] !== F ? (re = g && !C || !g && !F.trim() || w, e[40] = C, e[41] = w, e[42] = g, e[43] = F, e[44] = re) : re = e[44];
394
- let oe;
395
- e[45] !== C || e[46] !== v || e[47] !== Fe || e[48] !== Oe || e[49] !== re ? (oe = /* @__PURE__ */ i(kn, { canInterrupt: C, title: Fe, shortcut: Oe, onClick: v, disabled: re }), e[45] = C, e[46] = v, e[47] = Fe, e[48] = Oe, e[49] = re, e[50] = oe) : oe = e[50];
396
- let se;
397
- e[51] !== p || e[52] !== oe ? (se = /* @__PURE__ */ b(ke, { gap: "1", mt: "md", children: [
398
- p,
399
- Ie,
400
- oe
401
- ] }), e[51] = p, e[52] = oe, e[53] = se) : se = e[53];
402
- let ie;
403
- e[54] !== u || e[55] !== ne || e[56] !== se ? (ie = /* @__PURE__ */ b($, { direction: "column", color: "fg", children: [
404
- u,
405
- ne,
406
- se
407
- ] }), e[54] = u, e[55] = ne, e[56] = se, e[57] = ie) : ie = e[57];
408
- let ve;
409
- return e[58] !== N || e[59] !== S || e[60] !== z || e[61] !== R || e[62] !== xe || e[63] !== ee || e[64] !== ie ? (ve = /* @__PURE__ */ i(k, { ref: Ce, position: "relative", width: "100%", paddingX: "lg", paddingY: "md", mt: N, bg: "bg", borderRadius: "md", borderTopRadius: S, borderWidth: "1px", borderStyle: "solid", borderColor: z, boxShadow: R, zIndex: xe, transition: "box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out", _hover: ee, _focusWithin: _e, onClick: be, onBlur: Re, children: ie }), e[58] = N, e[59] = S, e[60] = z, e[61] = R, e[62] = xe, e[63] = ee, e[64] = ie, e[65] = ve) : ve = e[65], ve;
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;
410
713
  };
411
- function wn() {
714
+ function Fo() {
412
715
  }
413
- function Cn(t) {
716
+ function Wo(t) {
414
717
  return t + 1;
415
718
  }
416
- function _n(t) {
719
+ function Ho(t) {
417
720
  return t + 1;
418
721
  }
419
- const Rn = (t = "") => JSON.stringify(rn(t)), Pn = 360, In = "min(10vh, 4rem)", vn = (t) => t.parts.reduce((e, n) => n.type !== "text" ? e : e + n.text.length, 0), An = (t) => t.role !== "user" ? !1 : vn(t) > Pn, Bn = (t) => {
420
- const e = y(8);
421
- 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;
422
741
  e[0] !== t ? ({
423
742
  children: n,
424
- ...r
425
- } = 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]);
426
745
  let o;
427
- e[3] !== n ? (o = /* @__PURE__ */ i(ft, { defaultState: n, fullWidth: !0 }), e[3] = n, e[4] = o) : o = e[4];
428
- let s;
429
- 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;
430
- }, Dn = Bn, mt = {
431
- shell: ct,
432
- ls: Kt,
433
- read_file: Gt,
434
- write_file: qt,
435
- delete_file: Vt,
436
- patch: Ut,
437
- upload_files: Nt,
438
- download_file: jt,
439
- move_file: Ht
440
- }, Mn = {
441
- dot: Qt,
442
- danger: dt,
443
- search: Jt,
444
- browser: Yt,
445
- file: Xt,
446
- terminal: ct,
447
- ...mt
448
- }, et = "dot", zn = (t) => Object.hasOwn(mt, t), En = (t) => Mn[t], ht = (t) => {
449
- if (!t) return et;
450
- const e = t.replace(/^tool-/, "");
451
- if (zn(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, "");
452
777
  switch (e) {
453
778
  case "read":
454
779
  return "file";
455
780
  case "bash":
456
781
  return "terminal";
782
+ case "edit":
783
+ return "write_file";
457
784
  case "apply_patch":
458
785
  return "patch";
459
786
  case "grep":
460
787
  return "search";
461
788
  case "glob":
462
789
  return "file";
790
+ case "todowrite":
791
+ return "todo";
463
792
  case "search":
464
793
  return "search";
465
794
  case "browser":
466
795
  return "browser";
796
+ case "question":
797
+ return "question";
467
798
  case "fs":
468
799
  case "file":
469
800
  return "file";
470
801
  default:
471
- return et;
802
+ return n === "todowrite" || n === "todo" ? "todo" : Lt;
472
803
  }
473
804
  };
474
- function Ke(t) {
805
+ function Pt(t) {
475
806
  const e = t.lastIndexOf("/");
476
807
  return e >= 0 ? t.slice(e + 1) : t;
477
808
  }
478
- function Be(t) {
809
+ function et(t) {
479
810
  if (!t) return null;
480
811
  const e = t.split(" ")[0].trim();
481
812
  if (e === "/dev/null") return null;
482
813
  let n = e;
483
814
  return (n.startsWith("a/") || n.startsWith("b/")) && (n = n.slice(2)), n.replace(/^\/+/, "").replace(/\\/g, "/");
484
815
  }
485
- const Me = (t) => t.startsWith("--- "), Xe = (t) => t.startsWith("+++ "), Ye = (t) => t.startsWith("@@"), $n = (t) => t.startsWith("+") && !(Xe(t) || t === "+++"), Ln = (t) => t.startsWith("-") && !(Me(t) || t === "---"), Fn = (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) => {
486
817
  t.has(e) || t.set(e, {
487
818
  additions: 0,
488
819
  deletions: 0
489
820
  });
490
- }, On = (t, e) => {
821
+ }, is = (t, e) => {
491
822
  const n = t.get(e);
492
823
  n && (n.additions += 1);
493
- }, Wn = (t, e) => {
824
+ }, ls = (t, e) => {
494
825
  const n = t.get(e);
495
826
  n && (n.deletions += 1);
496
- }, Hn = (t, e, n) => {
497
- if (Me(t))
827
+ }, cs = (t, e, n) => {
828
+ if (ot(t))
498
829
  return {
499
830
  ...e,
500
- lastMinusHeader: Be(t.slice(4)),
831
+ lastMinusHeader: et(t.slice(4)),
501
832
  inHunk: !1
502
833
  };
503
- if (Xe(t)) {
504
- const o = Be(t.slice(4)) ?? e.lastMinusHeader;
505
- return o && Fn(n, o), {
834
+ if (Mt(t)) {
835
+ const o = et(t.slice(4)) ?? e.lastMinusHeader;
836
+ return o && rs(n, o), {
506
837
  ...e,
507
838
  currentPath: o,
508
839
  inHunk: !1
509
840
  };
510
841
  }
511
- return e.currentPath ? Ye(t) ? {
842
+ return e.currentPath ? $t(t) ? {
512
843
  ...e,
513
844
  inHunk: !0
514
- } : e.inHunk ? $n(t) ? (On(n, e.currentPath), e) : (Ln(t) && Wn(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;
515
846
  };
516
- function gt(t) {
847
+ function sn(t) {
517
848
  if (!t || typeof t != "string") return [];
518
849
  const e = /* @__PURE__ */ new Map();
519
850
  let n = {
@@ -521,34 +852,34 @@ function gt(t) {
521
852
  lastMinusHeader: null,
522
853
  inHunk: !1
523
854
  };
524
- const r = t.split(/\r?\n/);
525
- for (const o of r)
526
- n = Hn(o, n, e);
855
+ const s = t.split(/\r?\n/);
856
+ for (const o of s)
857
+ n = cs(o, n, e);
527
858
  return Array.from(e.entries()).map(([o, {
528
- additions: s,
529
- deletions: l
859
+ additions: r,
860
+ deletions: i
530
861
  }]) => ({
531
862
  filePath: o,
532
- additions: s,
533
- deletions: l
863
+ additions: r,
864
+ deletions: i
534
865
  }));
535
866
  }
536
- function jn(t) {
537
- return gt(t).map((e) => ({
867
+ function as(t) {
868
+ return sn(t).map((e) => ({
538
869
  kind: "diff",
539
- fileName: Ke(e.filePath),
870
+ fileName: Pt(e.filePath),
540
871
  filePath: e.filePath,
541
872
  additions: e.additions,
542
873
  deletions: e.deletions
543
874
  }));
544
875
  }
545
- function Nn(t) {
546
- return gt(t).map((e) => e.filePath);
876
+ function us(t) {
877
+ return sn(t).map((e) => e.filePath);
547
878
  }
548
- const bt = (t) => Me(t) || t.startsWith("diff --git "), Un = (t) => t.startsWith(" ") || t.startsWith("+") || t.startsWith("-") ? !1 : t.trim() !== "", Vn = (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) => {
549
880
  if (t.startsWith(" ")) {
550
- const r = t.slice(1);
551
- e.push(r), n.push(r);
881
+ const s = t.slice(1);
882
+ e.push(s), n.push(s);
552
883
  return;
553
884
  }
554
885
  if (t.startsWith("-")) {
@@ -556,86 +887,99 @@ const bt = (t) => Me(t) || t.startsWith("diff --git "), Un = (t) => t.startsWith
556
887
  return;
557
888
  }
558
889
  t.startsWith("+") && n.push(t.slice(1));
559
- }, qn = (t, e, n, r) => {
890
+ }, ps = (t, e, n, s) => {
560
891
  let o = e;
561
892
  for (; o < t.length; ) {
562
- const s = t[o] || "";
563
- if (bt(s) || Ye(s) || Un(s))
893
+ const r = t[o] || "";
894
+ if (rn(r) || $t(r) || ds(r))
564
895
  break;
565
- Vn(s, n, r), o += 1;
896
+ fs(r, n, s), o += 1;
566
897
  }
567
- return (n.length > 0 || r.length > 0) && (n.push(""), r.push("")), o;
568
- }, Gn = (t, e) => {
569
- const n = Be((t[e] || "").slice(4)), r = t[e + 1] || "";
570
- if (!Xe(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 {
571
902
  nextIndex: e + 1
572
903
  };
573
- const s = Be(r.slice(4)) ?? n ?? "", l = [], a = [];
574
- let c = e + 2;
575
- for (; c < t.length; ) {
576
- const d = t[c] || "";
577
- if (bt(d)) break;
578
- if (!Ye(d)) {
579
- 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;
580
911
  continue;
581
912
  }
582
- c = qn(t, c + 1, l, a);
913
+ a = ps(t, a + 1, i, c);
583
914
  }
584
915
  return {
585
- nextIndex: c,
916
+ nextIndex: a,
586
917
  preview: {
587
- filePath: s,
588
- original: l.join(`
918
+ filePath: r,
919
+ original: i.join(`
589
920
  `),
590
- modified: a.join(`
921
+ modified: c.join(`
591
922
  `)
592
923
  }
593
924
  };
594
925
  };
595
- function Kn(t) {
926
+ function hs(t) {
596
927
  if (!t || typeof t != "string") return [];
597
928
  const e = t.split(/\r?\n/), n = [];
598
- let r = 0;
599
- for (; r < e.length; ) {
600
- const o = e[r] || "";
601
- if (!Me(o)) {
602
- r += 1;
929
+ let s = 0;
930
+ for (; s < e.length; ) {
931
+ const o = e[s] || "";
932
+ if (!ot(o)) {
933
+ s += 1;
603
934
  continue;
604
935
  }
605
936
  const {
606
- nextIndex: s,
607
- preview: l
608
- } = Gn(e, r);
609
- 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);
610
941
  }
611
942
  return n;
612
943
  }
613
- const Xn = {
944
+ const gs = {
614
945
  apply_patch: "Apply patch",
615
- read: "Read file",
616
- bash: "Run",
617
- grep: "Search files",
946
+ bash: "Run command",
947
+ edit: "Edit file",
618
948
  glob: "Find files",
619
- skill: "Load skill"
620
- }, tt = {
949
+ grep: "Search files",
950
+ read: "Read file",
951
+ skill: "Load skill",
952
+ todowrite: "Update todos"
953
+ }, Qt = {
621
954
  pending: "queued",
622
955
  error: "failed",
623
956
  "output-error": "failed",
624
- "input-streaming": "running",
625
- "input-available": "queued"
626
- }, xt = (t) => t.replace(/^tool-/, ""), Yn = (t) => t.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), Jn = (t) => xt(t.tool ?? "tool"), Qn = (t) => {
627
- const e = xt(t);
628
- return Xn[e] ?? Yn(e.replace(/_/g, " "));
629
- }, Zn = (t) => !t || typeof t != "string" ? null : tt[t] ? tt[t] : t.includes("stream") ? "running" : null, yt = (t) => t === "error" || t === "output-error", ce = (t) => yt(t.state?.status) ? {
957
+ input_streaming: "running",
958
+ input_available: "queued",
959
+ running: "running",
960
+ completed: "completed",
961
+ failed: "failed"
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) => {
966
+ const e = t.state?.status ?? t.status;
967
+ if (!e || typeof e != "string") return null;
968
+ const n = e.replace(/-/g, "_");
969
+ return Qt[n] ? Qt[n] : n.includes("stream") ? "running" : null;
970
+ }, cn = (t) => {
971
+ const e = t.state?.status ?? t.status;
972
+ return e === "error" || e === "output-error" || e === "failed";
973
+ }, ee = (t) => cn(t) ? {
630
974
  type: "icon",
631
975
  icon: "danger"
632
976
  } : {
633
977
  type: "icon",
634
- icon: ht(Jn(t))
635
- }, de = (t, e, n) => {
978
+ icon: on(xs(t))
979
+ }, te = (t, e, n) => {
636
980
  const o = [{
637
981
  kind: "text",
638
- text: n ?? Qn(t.tool ?? "tool"),
982
+ text: n ?? ys(t.tool ?? "tool"),
639
983
  bold: !0
640
984
  }];
641
985
  e && o.push({
@@ -643,207 +987,354 @@ const Xn = {
643
987
  text: e,
644
988
  muted: !0
645
989
  });
646
- const s = Zn(t.state?.status);
647
- return s && o.push({
990
+ const r = Ss(t);
991
+ return r && r !== "completed" && o.push({
648
992
  kind: "text",
649
- text: s,
993
+ text: r,
650
994
  muted: !0
651
995
  }), o;
652
- }, ue = (t) => {
996
+ }, ge = (t) => {
653
997
  const e = t.state?.input;
654
998
  return !e || typeof e != "object" || Array.isArray(e) ? null : e;
655
- }, ze = (t) => {
999
+ }, De = (t) => {
656
1000
  const e = t.state?.output;
657
1001
  return !e || typeof e != "object" || Array.isArray(e) ? null : e;
658
- }, x = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, De = (t) => !t || typeof t != "object" || Array.isArray(t) ? null : t, er = (t, e) => {
659
- const n = De(t.state);
660
- return n ? De(n[e]) : null;
661
- }, tr = (t) => t.replace(/\\/g, "/").replace(/^\/+/, ""), nr = (t) => t.includes("--- ") && t.includes("+++ ") && t.includes("@@"), St = (t) => {
662
- const e = ze(t);
663
- return [er(t, "metadata"), De(e?.metadata)].filter(Boolean);
664
- }, rr = (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) => {
665
1006
  const e = De(t);
1007
+ return [ks(t, "metadata"), tt(e?.metadata)].filter(Boolean);
1008
+ }, Cs = (t) => {
1009
+ const e = tt(t);
666
1010
  if (!e) return null;
667
1011
  const n = x(e.filePath) ?? x(e.relativePath) ?? x(e.path);
668
1012
  return n ? {
669
- filePath: tr(n),
1013
+ filePath: ws(n),
670
1014
  additions: typeof e.additions == "number" ? e.additions : 0,
671
1015
  deletions: typeof e.deletions == "number" ? e.deletions : 0,
672
1016
  diff: x(e.diff) ?? void 0,
673
1017
  before: x(e.before) ?? void 0,
674
1018
  after: x(e.after) ?? void 0
675
1019
  } : null;
676
- }, kt = (t) => {
1020
+ }, un = (t) => {
677
1021
  const e = [];
678
- for (const n of St(t)) {
679
- const r = Array.isArray(n.files) ? n.files : [];
680
- for (const o of r) {
681
- const s = rr(o);
682
- 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);
683
1027
  }
684
1028
  }
685
1029
  return e;
686
- }, or = (t) => {
687
- const e = ue(t), n = x(e?.diff);
1030
+ }, _s = (t) => {
1031
+ const e = ge(t), n = x(e?.diff);
688
1032
  if (n) return n;
689
- for (const s of St(t)) {
690
- const l = x(s.diff);
691
- if (l) return l;
1033
+ for (const r of an(t)) {
1034
+ const i = x(r.diff);
1035
+ if (i) return i;
692
1036
  }
693
- const r = kt(t).map((s) => s.diff).filter((s) => !!s);
694
- 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(`
695
1039
  `);
696
1040
  const o = x(e?.patchText);
697
- return o && nr(o) ? o : null;
698
- }, sr = (t) => {
1041
+ return o && Ts(o) ? o : null;
1042
+ }, As = (t) => {
699
1043
  const e = /* @__PURE__ */ new Set(), n = [];
700
- for (const r of t)
701
- 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({
702
1046
  kind: "diff",
703
- fileName: Ke(r.filePath),
704
- filePath: r.filePath,
705
- additions: r.additions,
706
- deletions: r.deletions
1047
+ fileName: Pt(s.filePath),
1048
+ filePath: s.filePath,
1049
+ additions: s.additions,
1050
+ deletions: s.deletions
707
1051
  }));
708
1052
  return n;
709
- }, ir = (t) => Array.from(new Set(t.map((e) => e.filePath))), Ee = (t) => {
710
- const e = ze(t);
711
- return x(t.state?.output) ?? x(e?.returnDisplay) ?? x(e?.preview) ?? x(e?.stdout);
712
- }, lr = (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) => {
713
1057
  const e = t.match(/<skill_content(?:\s+name="([^"]+)")?>([\s\S]*?)<\/skill_content>/);
714
1058
  return e ? {
715
1059
  skillName: x(e[1]) ?? void 0,
716
1060
  content: x(e[2]) ?? ""
717
1061
  } : null;
718
- }, ar = (t) => {
719
- const e = ue(t);
1062
+ }, Is = (t) => {
1063
+ const e = ge(t);
720
1064
  return x(e?.name) ?? x(e?.skillName) ?? x(e?.skill) ?? x(e?.skill_name) ?? void 0;
721
- }, cr = (t) => ({
1065
+ }, dn = (t) => ({
722
1066
  kind: "link",
723
- text: Ke(t),
1067
+ text: Pt(t),
724
1068
  filePath: t
725
- }), fe = (t, e) => !yt(t.state?.status) || !t.state?.errorText ? e : [{
1069
+ }), ne = (t, e) => !cn(t) || !t.state?.errorText ? e : [{
726
1070
  type: "comment",
727
1071
  text: t.state.errorText
728
- }, ...e], dr = (t) => {
729
- const e = or(t), n = kt(t), r = de(t, void 0, "Apply patch"), o = jn(e ?? void 0);
730
- o.length > 0 ? r.push(...o) : r.push(...sr(n));
731
- const s = [], l = Kn(e ?? void 0);
732
- for (const a of l)
733
- s.push({
734
- type: "diff",
735
- language: "diff",
736
- original: a.original,
737
- modified: a.modified,
738
- sideBySide: !1
739
- });
740
- if (s.length === 0)
741
- for (const a of n)
742
- !a.before && !a.after || s.push({
1072
+ }, ...e], fn = (t) => hs(t ?? void 0).map((e) => ({
1073
+ type: "diff",
1074
+ language: "diff",
1075
+ original: e.original,
1076
+ modified: e.modified,
1077
+ sideBySide: !1
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({
743
1085
  type: "diff",
744
1086
  language: "diff",
745
- original: a.before ?? "",
746
- modified: a.after ?? "",
1087
+ original: i.before ?? "",
1088
+ modified: i.after ?? "",
747
1089
  sideBySide: !1
748
1090
  });
749
- if (s.length === 0) {
750
- const a = Nn(e ?? void 0);
751
- a.length === 0 && a.push(...ir(n)), a.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({
752
1094
  type: "references",
753
- references: a
1095
+ references: i
754
1096
  });
755
1097
  }
756
1098
  return {
757
- indicator: ce(t),
758
- title: r,
759
- blocks: fe(t, s)
1099
+ indicator: ee(t),
1100
+ title: s,
1101
+ blocks: ne(t, r)
1102
+ };
1103
+ }, Os = (t, e) => [{
1104
+ type: "diff",
1105
+ language: "text",
1106
+ original: t,
1107
+ modified: e,
1108
+ sideBySide: !1
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));
1113
+ return {
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
760
1158
  };
761
- }, ur = (t) => {
762
- const e = ue(t), n = ze(t), r = x(e?.filePath) ?? x(e?.file) ?? x(n?.filePath) ?? x(n?.file) ?? x(n?.path) ?? void 0, o = de(t, void 0, "Read file");
763
- return r && o.push(cr(r)), {
764
- indicator: ce(t),
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
+ };
1183
+ };
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),
765
1188
  title: o,
766
- blocks: fe(t, [])
1189
+ blocks: ne(t, [])
767
1190
  };
768
- }, fr = (t) => {
769
- const e = ue(t), n = ze(t), r = x(e?.command) ?? void 0, o = de(t, r, "Run command"), s = [], l = Ee(t);
770
- 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({
771
1194
  type: "code",
772
1195
  language: "text",
773
- code: l
1196
+ code: i
774
1197
  });
775
- const a = x(n?.stderr);
776
- return a && a !== l && s.push({
1198
+ const c = x(n?.stderr);
1199
+ return c && c !== i && r.push({
777
1200
  type: "code",
778
1201
  language: "text",
779
- code: a
780
- }), typeof n?.exitCode == "number" && s.push({
1202
+ code: c
1203
+ }), typeof n?.exitCode == "number" && r.push({
781
1204
  type: "text",
782
1205
  text: `Exit code: ${n.exitCode}`
783
1206
  }), {
784
- indicator: ce(t),
1207
+ indicator: ee(t),
785
1208
  title: o,
786
- blocks: fe(t, s)
1209
+ blocks: ne(t, r)
787
1210
  };
788
- }, pr = (t) => {
789
- const e = ue(t), n = Ee(t), r = x(e?.pattern) ?? void 0, o = de(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 ? [{
790
1213
  type: "code",
791
1214
  language: "text",
792
1215
  code: n
793
1216
  }] : [];
794
1217
  return {
795
- indicator: ce(t),
1218
+ indicator: ee(t),
796
1219
  title: o,
797
- blocks: fe(t, s)
1220
+ blocks: ne(t, r)
798
1221
  };
799
- }, mr = (t) => {
800
- const e = ue(t), n = Ee(t), r = x(e?.pattern) ?? void 0, o = de(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 = [];
801
1224
  if (n) {
802
- const l = n.split(/\r?\n/).map((a) => a.trim()).filter((a) => a.length > 0);
803
- 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({
804
1227
  type: "references",
805
- references: l
1228
+ references: i
806
1229
  });
807
1230
  }
808
1231
  return {
809
- indicator: ce(t),
1232
+ indicator: ee(t),
810
1233
  title: o,
811
- blocks: fe(t, s)
1234
+ blocks: ne(t, r)
812
1235
  };
813
- }, hr = (t) => {
814
- const e = Ee(t), n = e ? lr(e) : null, r = ar(t) ?? n?.skillName, o = de(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 ? [{
815
1238
  type: "code",
816
1239
  language: "markdown",
817
- code: s
1240
+ code: r
818
1241
  }] : [];
819
1242
  return {
820
- indicator: ce(t),
1243
+ indicator: ee(t),
821
1244
  title: o,
822
- blocks: fe(t, l)
1245
+ blocks: ne(t, i)
1246
+ };
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);
1253
+ return {
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
+ };
823
1302
  };
824
- }, nt = () => ({
825
- apply_patch: dr,
826
- read: ur,
827
- bash: fr,
828
- grep: pr,
829
- glob: mr,
830
- skill: hr
831
- }), rt = {
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 = {
832
1323
  pending: "queued",
833
1324
  error: "failed",
834
1325
  "output-error": "failed",
835
1326
  "input-streaming": "running",
836
1327
  "input-available": "queued"
837
- }, Tt = (t) => t.replace(/^tool-/, ""), gr = (t) => t.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), br = (t) => {
838
- const e = Tt(t ?? "tool").replace(/_/g, " ");
839
- return gr(e);
840
- }, wt = (t) => t === "error" || t === "output-error", xr = (t) => wt(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) ? {
841
1332
  type: "icon",
842
1333
  icon: "danger"
843
1334
  } : {
844
1335
  type: "icon",
845
- icon: ht(t.tool ?? "tool")
846
- }, yr = (t) => !t || typeof t != "string" ? null : rt[t] ? rt[t] : t.includes("stream") ? "running" : null, ot = (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) => {
847
1338
  if (typeof t == "string") return t;
848
1339
  if (t == null) return null;
849
1340
  try {
@@ -851,326 +1342,359 @@ const Xn = {
851
1342
  } catch {
852
1343
  return null;
853
1344
  }
854
- }, Sr = (t) => {
1345
+ }, Zs = (t) => {
855
1346
  const e = [];
856
- wt(t.state?.status) && t.state?.errorText && e.push({
1347
+ mn(t.state?.status) && t.state?.errorText && e.push({
857
1348
  type: "comment",
858
1349
  text: t.state.errorText
859
1350
  });
860
- const n = ot(t.state?.input);
1351
+ const n = Wt(t.state?.input);
861
1352
  n && e.push({
862
1353
  type: "code",
863
1354
  language: "json",
864
1355
  code: n
865
1356
  });
866
- const r = ot(t.state?.output);
867
- return r && e.push({
1357
+ const s = Wt(t.state?.output);
1358
+ return s && e.push({
868
1359
  type: "code",
869
1360
  language: "json",
870
- code: r
1361
+ code: s
871
1362
  }), e;
872
- }, kr = (t) => {
1363
+ }, er = (t) => {
873
1364
  const e = [{
874
1365
  kind: "text",
875
- text: br(t.tool),
1366
+ text: Xs(t.tool),
876
1367
  bold: !0
877
- }], n = yr(t.state?.status);
1368
+ }], n = Js(t.state?.status);
878
1369
  return n && e.push({
879
1370
  kind: "text",
880
1371
  text: n,
881
1372
  muted: !0
882
1373
  }), {
883
- indicator: xr(t),
1374
+ indicator: Ys(t),
884
1375
  title: e,
885
- blocks: Sr(t)
1376
+ blocks: Zs(t)
886
1377
  };
887
- }, Tr = (t) => t ? {
888
- ...nt(),
1378
+ }, tr = (t) => t ? {
1379
+ ...zt(),
889
1380
  ...t
890
- } : nt(), wr = (t, e) => {
1381
+ } : zt(), nr = (t, e) => {
891
1382
  const n = t.tool ?? "tool";
892
- return e[n] ?? e[Tt(n)];
893
- }, Cr = (t, e, n) => {
894
- const r = wr(t, e);
895
- if (r) {
896
- const o = r(t, n);
1383
+ for (const s of Zo(n)) {
1384
+ const o = e[s];
897
1385
  if (o) return o;
898
1386
  }
899
- return kr(t);
900
- }, _r = (t, e) => {
901
- const n = Tr(e?.toolRenderers);
1387
+ }, or = (t, e, n) => {
1388
+ const s = nr(t, e);
1389
+ if (s) {
1390
+ const o = s(t, n);
1391
+ if (o) return o;
1392
+ }
1393
+ return er(t);
1394
+ }, sr = (t, e) => {
1395
+ const n = tr(e?.toolRenderers);
902
1396
  return {
903
- items: t.map((o) => Cr(o, n, e))
1397
+ items: t.map((o) => or(o, n, e))
904
1398
  };
905
- }, U = zt, Ct = (t, e, n, r = !1) => {
906
- 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);
907
1401
  };
908
- function Rr(t) {
909
- const e = y(6), {
1402
+ function rr(t) {
1403
+ const e = S(6), {
910
1404
  seg: n
911
1405
  } = t;
912
- let r;
913
- e[0] !== n.alt || e[1] !== n.src ? (r = /* @__PURE__ */ i(ae.Image, { src: n.src, alt: n.alt }), e[0] = n.alt, e[1] = n.src, e[2] = r) : r = e[2];
914
- let o;
915
- e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ i(ae.Fallback, {}), e[3] = o) : o = e[3];
916
1406
  let s;
917
- return e[4] !== r ? (s = /* @__PURE__ */ b(ae.Root, { width: "1.5rem", height: "1.5rem", children: [
918
- 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,
919
1413
  o
920
- ] }), e[4] = r, e[5] = s) : s = e[5], s;
1414
+ ] }), e[4] = s, e[5] = r) : r = e[5], r;
921
1415
  }
922
- function Pr(t) {
923
- const e = y(9), {
1416
+ function ir(t) {
1417
+ const e = S(9), {
924
1418
  seg: n,
925
- onOpenFile: r
926
- } = t, o = n.additions ?? 0, s = n.deletions ?? 0;
927
- let l;
928
- e[0] !== r || e[1] !== n.fileName || e[2] !== n.filePath ? (l = () => {
929
- const c = n.filePath ?? n.fileName;
930
- r?.(c);
931
- }, e[0] = r, e[1] = n.fileName, e[2] = n.filePath, e[3] = l) : l = e[3];
932
- let a;
933
- return e[4] !== n.fileName || e[5] !== o || e[6] !== s || e[7] !== l ? (a = /* @__PURE__ */ i(pt, { 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;
934
1428
  }
935
- function Ir(t) {
936
- const e = y(13), {
1429
+ function lr(t) {
1430
+ const e = S(13), {
937
1431
  seg: n,
938
- onOpenFile: r
939
- } = t, o = n.bold ? "medium" : void 0, s = !!(n.href || n.filePath), l = n.href ?? "#", a = (n.muted, "fg.muted"), c = s ? "pointer" : "default";
940
- let d;
941
- e[0] !== r || e[1] !== n ? (d = (m) => Ct(m, n, r, !0), e[0] = r, e[1] = n, e[2] = d) : d = e[2];
942
- 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";
943
1434
  let u;
944
- 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 = {
945
1439
  textDecoration: "underline",
946
- color: f
947
- }, e[3] = f, e[4] = u) : u = e[4];
948
- let p;
949
- 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(at, { 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;
950
1444
  }
951
- function vr(t) {
952
- const e = y(12), {
1445
+ function cr(t) {
1446
+ const e = S(12), {
953
1447
  seg: n,
954
- onOpenFile: r
955
- } = t, o = n.bold ? "medium" : void 0, s = n.href ?? "#", l = n.muted ? "fg.muted" : "accent.primary";
956
- let a;
957
- e[0] !== r || e[1] !== n ? (a = (u) => Ct(u, n, r), e[0] = r, e[1] = n, e[2] = a) : a = e[2];
958
- const c = n.muted ? "fg.muted" : "accent.primary";
959
- let d;
960
- e[3] !== c ? (d = {
961
- 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,
962
1456
  textDecoration: "underline"
963
- }, e[3] = c, e[4] = d) : d = e[4];
964
- let f;
965
- return e[5] !== o || e[6] !== n.text || e[7] !== s || e[8] !== l || e[9] !== a || e[10] !== d ? (f = /* @__PURE__ */ i(at, { 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;
966
1460
  }
967
- function Ar(t) {
968
- const e = y(6), {
1461
+ function ar(t) {
1462
+ const e = S(6), {
969
1463
  seg: n,
970
- isClickable: r
971
- } = t, o = n.bold ? "medium" : void 0, s = r && !n.muted ? "fg" : "fg.muted";
972
- let l;
973
- e[0] !== s ? (l = {
974
- color: s
975
- }, e[0] = s, e[1] = l) : l = e[1];
976
- let a;
977
- return e[2] !== n.text || e[3] !== o || e[4] !== l ? (a = /* @__PURE__ */ i(ye, { 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;
978
1472
  }
979
- function Br(t) {
980
- const e = y(11), {
1473
+ function ur(t) {
1474
+ const e = S(11), {
981
1475
  seg: n,
982
- isClickable: r,
1476
+ isClickable: s,
983
1477
  onOpenFile: o
984
1478
  } = t;
985
1479
  switch (n.kind) {
986
1480
  case "avatar": {
987
- let s;
988
- return e[0] !== n ? (s = /* @__PURE__ */ i(Rr, { 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;
989
1483
  }
990
1484
  case "diff": {
991
- let s;
992
- return e[2] !== o || e[3] !== n ? (s = /* @__PURE__ */ i(Pr, { 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;
993
1487
  }
994
1488
  case "link": {
995
- let s;
996
- return e[5] !== o || e[6] !== n ? (s = n.variant === "bubble" ? /* @__PURE__ */ i(Ir, { seg: n, onOpenFile: o }) : /* @__PURE__ */ i(vr, { 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;
997
1491
  }
998
1492
  case "text": {
999
- let s;
1000
- return e[8] !== r || e[9] !== n ? (s = /* @__PURE__ */ i(Ar, { 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;
1001
1495
  }
1002
1496
  default:
1003
1497
  return null;
1004
1498
  }
1005
1499
  }
1006
- function Dr(t) {
1007
- const e = y(10), {
1500
+ function dr(t) {
1501
+ const e = S(10), {
1008
1502
  ind: n
1009
1503
  } = t;
1010
1504
  if (!n || n.type === "none")
1011
1505
  return null;
1012
1506
  if (n.type === "icon") {
1013
- let l;
1014
- e[0] !== n.icon ? (l = En(n.icon), e[0] = n.icon, e[1] = l) : l = e[1];
1015
- const a = l;
1016
- let c;
1017
- return e[2] !== a ? (c = /* @__PURE__ */ i(U.Indicator, { outline: "none", shadow: "none", border: "none", background: "bg", color: "fg", children: /* @__PURE__ */ i(ye, { 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;
1018
1512
  }
1019
- let r;
1020
- e[4] !== n.alt || e[5] !== n.src ? (r = /* @__PURE__ */ i(ae.Image, { src: n.src, alt: n.alt }), e[4] = n.alt, e[5] = n.src, e[6] = r) : r = e[6];
1021
- let o;
1022
- e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ i(ae.Fallback, {}), e[7] = o) : o = e[7];
1023
1513
  let s;
1024
- return e[8] !== r ? (s = /* @__PURE__ */ i(U.Indicator, { children: /* @__PURE__ */ b(ae.Root, { boxSize: "full", children: [
1025
- 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,
1026
1520
  o
1027
- ] }) }), e[8] = r, e[9] = s) : s = e[9], s;
1521
+ ] }) }), e[8] = s, e[9] = r) : r = e[9], r;
1028
1522
  }
1029
- function Mr(t) {
1030
- const e = y(5), {
1523
+ function fr(t) {
1524
+ const e = S(5), {
1031
1525
  code: n,
1032
- language: r
1033
- } = t, o = r ? `${r} code block` : "code block";
1034
- let s;
1035
- e[0] !== n ? (s = /* @__PURE__ */ i(k, { as: "code", children: n }), e[0] = n, e[1] = s) : s = e[1];
1036
- let l;
1037
- 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;
1038
1532
  }
1039
- function zr(t) {
1040
- const e = y(26), {
1533
+ function pr(t) {
1534
+ const e = S(30), {
1041
1535
  b: n,
1042
- onOpenFile: r
1536
+ onOpenFile: s
1043
1537
  } = t;
1044
1538
  switch (n.type) {
1045
1539
  case "comment": {
1046
1540
  let o;
1047
- e[0] !== n.text ? (o = /* @__PURE__ */ i(E.Body, { children: n.text }), e[0] = n.text, e[1] = o) : o = e[1];
1048
- let s;
1049
- e[2] !== n.reactions ? (s = n.reactions?.clap ? /* @__PURE__ */ i(E.Footer, { children: /* @__PURE__ */ b(Se, { 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: [
1050
1544
  "👏 ",
1051
1545
  n.reactions.clap
1052
- ] }) }) : null, e[2] = n.reactions, e[3] = s) : s = e[3];
1053
- let l;
1054
- 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: [
1055
1549
  o,
1056
- s
1057
- ] }), 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;
1058
1552
  }
1059
1553
  case "code": {
1060
1554
  let o;
1061
- 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(Mr, { 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;
1062
1556
  }
1063
1557
  case "diff": {
1064
1558
  const o = n.sideBySide ?? !1;
1065
- let s;
1066
- 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(sn, { 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;
1067
1561
  }
1068
1562
  case "text": {
1069
1563
  let o;
1070
- return e[15] !== n.text ? (o = /* @__PURE__ */ i(E.Root, { background: "transparent", children: /* @__PURE__ */ i(E.Body, { padding: "sm", children: /* @__PURE__ */ i(Y, { 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;
1071
1573
  }
1072
1574
  case "references": {
1073
1575
  let o;
1074
- e[17] !== n.references ? (o = n.references.map(Er), e[17] = n.references, e[18] = o) : o = e[18];
1075
- let s;
1076
- 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;
1077
1579
  }
1078
1580
  case "component": {
1079
1581
  let o;
1080
- e[21] !== n || e[22] !== r ? (o = n.render({
1081
- onOpenFile: r
1082
- }), e[21] = n, e[22] = r, e[23] = o) : o = e[23];
1083
- let s;
1084
- return e[24] !== o ? (s = /* @__PURE__ */ i(Ve, { 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;
1085
1587
  }
1086
1588
  }
1087
1589
  }
1088
- function Er(t) {
1089
- return /* @__PURE__ */ i(on, { fileName: t }, t);
1590
+ function mr(t) {
1591
+ return /* @__PURE__ */ l(oo, { fileName: t }, t);
1090
1592
  }
1091
- function $r(t) {
1092
- const e = y(22), {
1593
+ function hr(t) {
1594
+ const e = S(22), {
1093
1595
  item: n,
1094
- itemKey: r,
1596
+ itemKey: s,
1095
1597
  isOpen: o,
1096
- canExpand: s,
1097
- hasBlocks: l,
1098
- onToggle: a,
1099
- onOpenFile: c
1598
+ canExpand: r,
1599
+ hasBlocks: i,
1600
+ onToggle: c,
1601
+ onOpenFile: a
1100
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];
1101
1605
  let d;
1102
- 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];
1103
1610
  let f;
1104
- e[1] !== n.indicator ? (f = /* @__PURE__ */ b(U.Connector, { children: [
1105
- d,
1106
- /* @__PURE__ */ i(Dr, { ind: n.indicator })
1107
- ] }), e[1] = n.indicator, e[2] = f) : f = e[2];
1108
- let u;
1109
- 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(ye, { display: "inline-flex", alignItems: "center", gap: "sm", flexWrap: "wrap", children: [
1110
- /* @__PURE__ */ i(ye, { display: "inline-flex", alignItems: "center", gap: "xs", flexWrap: "wrap", children: n.title.map((g, T) => /* @__PURE__ */ i(Br, { seg: g, isClickable: s, onOpenFile: c }, T)) }),
1111
- s ? /* @__PURE__ */ i(ye, { 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: {
1112
1614
  color: "fg"
1113
- }, children: /* @__PURE__ */ i(Zt, { size: 12 }) }) : null
1114
- ] }) }), 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];
1115
- let p;
1116
- 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((g, T) => /* @__PURE__ */ i(k, { children: /* @__PURE__ */ i(zr, { b: g, onOpenFile: c }) }, T)) }) : 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];
1117
1617
  let m;
1118
- e[15] !== u || e[16] !== p ? (m = /* @__PURE__ */ b(U.Content, { pb: "xs", children: [
1119
- u,
1120
- p
1121
- ] }), e[15] = u, e[16] = p, e[17] = m) : m = e[17];
1122
- let h;
1123
- return e[18] !== r || e[19] !== f || e[20] !== m ? (h = /* @__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: [
1124
1621
  f,
1125
1622
  m
1126
- ] }, r), e[18] = r, e[19] = f, e[20] = m, e[21] = h) : h = e[21], h;
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;
1127
1629
  }
1128
- function Lr(t) {
1129
- const e = y(11), {
1630
+ function gr(t) {
1631
+ const e = S(11), {
1130
1632
  data: n,
1131
- onOpenFile: r
1633
+ onOpenFile: s
1132
1634
  } = t;
1133
1635
  let o;
1134
1636
  e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = {}, e[0] = o) : o = e[0];
1135
- const [s, l] = le(o), a = Fr;
1136
- let c;
1137
- e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (c = (p) => {
1138
- l((m) => ({
1139
- ...m,
1140
- [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]
1141
1643
  }));
1142
- }, e[1] = c) : c = e[1];
1143
- const d = c;
1144
- let f;
1145
- if (e[2] !== n.items || e[3] !== s || e[4] !== r) {
1146
- let p;
1147
- e[6] !== s || e[7] !== r ? (p = (m, h) => {
1148
- const g = a(m, h), T = (m.blocks?.length ?? 0) > 0, L = (m.expandable ?? !0) && T, w = L ? s[g] ?? !1 : T;
1149
- return /* @__PURE__ */ i($r, { item: m, itemKey: g, isOpen: w, canExpand: L, hasBlocks: T, onToggle: d, onOpenFile: r }, g);
1150
- }, 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;
1151
1653
  } else
1152
- f = e[5];
1153
- let u;
1154
- 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;
1155
1657
  }
1156
- function Fr(t, e) {
1658
+ function br(t, e) {
1157
1659
  return t.id ? `id:${t.id}` : `idx:${e}`;
1158
1660
  }
1159
- function Or(t) {
1160
- 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), {
1161
1667
  invocations: n,
1162
- labeledBlocks: r,
1163
- onOpenFile: o
1164
- } = t;
1165
- let s;
1166
- e[0] !== n || e[1] !== r ? (s = _r(n, {
1167
- labeledBlocks: r
1168
- }), e[0] = n, e[1] = r, e[2] = s) : s = e[2];
1169
- const l = s;
1170
- let a;
1171
- return e[3] !== l || e[4] !== o ? (a = /* @__PURE__ */ i(Lr, { 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;
1693
+ }
1694
+ function kr(t) {
1695
+ return !xr(t) || yr(t);
1172
1696
  }
1173
- const Wr = (t) => t.type === "tool", je = (t) => t >= 1e3 ? `${(t / 1e3).toFixed(1)}k` : String(t), Hr = (t) => {
1697
+ const wr = (t) => t.type === "tool", Ct = (t) => t >= 1e3 ? `${(t / 1e3).toFixed(1)}k` : String(t), Tr = (t) => {
1174
1698
  if (t.message && t.message.trim().length > 0)
1175
1699
  return t.message;
1176
1700
  const {
@@ -1186,99 +1710,100 @@ const Wr = (t) => t.type === "tool", je = (t) => t >= 1e3 ? `${(t / 1e3).toFixed
1186
1710
  default:
1187
1711
  return "An error occurred.";
1188
1712
  }
1189
- }, jr = {
1713
+ }, Cr = {
1190
1714
  info: "blue",
1191
1715
  warning: "orange",
1192
1716
  error: "red",
1193
1717
  success: "green",
1194
1718
  loading: "blue"
1195
- }, Nr = (t, e) => {
1719
+ }, _r = (t, e) => {
1196
1720
  const n = [];
1197
- let r = e;
1198
- for (; r < t.length; ) {
1199
- const o = t[r];
1200
- if (!Wr(o)) break;
1201
- 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;
1202
1726
  }
1203
1727
  return {
1204
1728
  invocations: n,
1205
- nextIndex: r - 1
1729
+ nextIndex: s - 1
1206
1730
  };
1207
1731
  };
1208
- function _t(t) {
1209
- const e = y(7), {
1732
+ function gn(t) {
1733
+ const e = S(8), {
1210
1734
  message: n,
1211
- onOpenFile: r,
1212
- toolInvocationTimeline: o
1213
- } = t, s = o ?? Or;
1214
- let l;
1215
- e[0] !== n.parts ? (l = n.parts ?? [], e[0] = n.parts, e[1] = l) : l = e[1];
1216
- const a = l;
1217
- let c;
1218
- if (e[2] !== s || e[3] !== n.id || e[4] !== r || e[5] !== a) {
1219
- const d = [];
1220
- for (let f = 0; f < a.length; f = f + 1, f) {
1221
- const u = a[f], p = `${n.id}-${f}`;
1222
- 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) {
1223
1748
  case "text": {
1224
- d.push(/* @__PURE__ */ i("div", { children: /* @__PURE__ */ i(Dn, { children: u.text }) }, p));
1749
+ f.push(/* @__PURE__ */ l("div", { children: /* @__PURE__ */ l(Jo, { children: p.text }) }, h));
1225
1750
  break e;
1226
1751
  }
1227
1752
  case "reasoning": {
1228
- d.push(/* @__PURE__ */ i(k, { padding: "0", css: {
1753
+ f.push(/* @__PURE__ */ l(P, { padding: "0", css: {
1229
1754
  "& .rich-text, & .rich-text *": {
1230
1755
  color: "fg.subtle !important",
1231
1756
  fontSize: ".75rem !important",
1232
1757
  fontWeight: "normal !important"
1233
1758
  }
1234
- }, children: /* @__PURE__ */ i(ft, { defaultState: u.text, fullWidth: !0 }) }, p));
1759
+ }, children: /* @__PURE__ */ l(Kt, { defaultState: p.text, fullWidth: !0 }) }, h));
1235
1760
  break e;
1236
1761
  }
1237
1762
  case "tool": {
1238
1763
  const {
1239
- invocations: m,
1240
- nextIndex: h
1241
- } = Nr(a, f);
1242
- f = h, 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));
1243
1768
  break e;
1244
1769
  }
1245
1770
  case "error": {
1246
- d.push(/* @__PURE__ */ i(k, { py: "2", width: "full", children: /* @__PURE__ */ i(Ze, { borderRadius: "xs", status: "error", colorPalette: "red", title: Hr(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));
1247
1772
  break e;
1248
1773
  }
1249
1774
  case "token_usage": {
1250
- d.push(/* @__PURE__ */ i(k, { children: /* @__PURE__ */ b(Y, { fontSize: "xs", color: "fg.subtle", children: [
1775
+ f.push(/* @__PURE__ */ l(P, { children: /* @__PURE__ */ k(z, { fontSize: "xs", color: "fg.subtle", children: [
1251
1776
  "Tokens: ",
1252
- je(u.inputTokens),
1777
+ Ct(p.inputTokens),
1253
1778
  " in / ",
1254
- je(u.outputTokens),
1779
+ Ct(p.outputTokens),
1255
1780
  " out",
1256
- u.cacheReadTokens ? ` / ${je(u.cacheReadTokens)} cache read` : ""
1257
- ] }) }, p));
1781
+ p.cacheReadTokens ? ` / ${Ct(p.cacheReadTokens)} cache read` : ""
1782
+ ] }) }, h));
1258
1783
  break e;
1259
1784
  }
1260
1785
  case "alert": {
1261
- d.push(/* @__PURE__ */ i(k, { width: "full", children: /* @__PURE__ */ i(Ze, { borderRadius: "xs", status: u.status === "loading" ? "info" : u.status, colorPalette: jr[u.status], title: u.title, icon: u.status === "loading" ? /* @__PURE__ */ i(qe, { 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));
1262
1787
  break e;
1263
1788
  }
1264
1789
  default:
1265
- d.push(null);
1790
+ f.push(null);
1266
1791
  }
1267
1792
  }
1268
- c = /* @__PURE__ */ i(Ve, { 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;
1269
1794
  } else
1270
- c = e[6];
1271
- return c;
1795
+ d = e[7];
1796
+ return d;
1272
1797
  }
1273
- const Ur = (t) => t === "user" || t === "assistant" || t === "developer" ? t : "assistant", Vr = (t) => {
1798
+ const Ar = (t) => t === "user" || t === "assistant" || t === "developer" ? t : "assistant", Rr = (t) => {
1274
1799
  const e = t.parts ?? [];
1275
- return e.length === 0 || e.some((r) => r.type === "text" && "text" in r) ? !1 : e.some((r) => r.type === "reasoning" || r.type === "tool");
1276
- }, qr = (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) => {
1277
1802
  const e = [];
1278
1803
  for (const n of t) {
1279
- const r = e[e.length - 1];
1280
- if (r && r.role === n.role && Vr(n)) {
1281
- 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 ?? []];
1282
1807
  continue;
1283
1808
  }
1284
1809
  e.push({
@@ -1287,152 +1812,196 @@ const Ur = (t) => t === "user" || t === "assistant" || t === "developer" ? t : "
1287
1812
  });
1288
1813
  }
1289
1814
  return e;
1290
- }, Gr = (t) => {
1815
+ }, Ir = (t) => {
1291
1816
  const e = [], n = [];
1292
- for (const r of t)
1293
- r.role === "user" ? e.push({
1294
- userMessage: r,
1817
+ for (const s of t)
1818
+ s.role === "user" ? e.push({
1819
+ userMessage: s,
1295
1820
  responses: []
1296
- }) : 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);
1297
1822
  return {
1298
1823
  groups: e,
1299
1824
  leadingResponses: n
1300
1825
  };
1301
- }, st = (t, e) => {
1302
- const n = Ur(t.role);
1303
- return /* @__PURE__ */ i(V.Root, { from: n, children: /* @__PURE__ */ i(V.Content, { from: n, children: /* @__PURE__ */ i(_t, { message: t, streaming: e }) }) }, t.id);
1304
- }, Bo = (t) => {
1305
- const e = y(27), {
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), {
1306
1885
  messages: n,
1307
- streaming: r,
1886
+ streaming: s,
1308
1887
  emptyStateTitle: o,
1309
- emptyStateDescription: s,
1310
- emptyStateContent: l,
1311
- loadingContent: a,
1312
- chatInputPlaceholder: c,
1313
- chatInputDefaultValue: d,
1314
- onSubmitMessage: f,
1315
- onChatInputChange: u,
1888
+ emptyStateDescription: r,
1889
+ emptyStateContent: i,
1890
+ loadingContent: c,
1891
+ chatInputPlaceholder: a,
1892
+ chatInputDefaultValue: u,
1893
+ onSubmitMessage: d,
1894
+ onInterrupt: f,
1895
+ onChatInputChange: m,
1316
1896
  actions: p,
1317
- repoMenu: m,
1318
- attachedResources: h,
1319
- onClearAttachments: g,
1320
- attachmentList: T,
1321
- approvalPrompt: L,
1322
- workspaceHub: w,
1323
- workspaceInitializing: pe,
1324
- inputDisabled: q
1325
- } = t, P = r === void 0 ? !1 : r, G = d === void 0 ? "" : d, we = pe === void 0 ? !1 : pe, K = q === void 0 ? !1 : q, J = qr(n), X = J.length > 0, F = J.reduce(Kr, 0), {
1326
- groups: me,
1327
- leadingResponses: Ce
1328
- } = Gr(J), [he, Q] = le(Xr), Z = P ? a ?? l : l, A = !!w, O = P && X && !we;
1329
- let B;
1330
- e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (B = (S) => {
1331
- Q((z) => {
1332
- const R = new Set(z);
1333
- return R.has(S) ? R.delete(S) : R.add(S), R;
1334
- });
1335
- }, e[0] = B) : B = e[0];
1336
- const ge = B, W = He, be = X ? /* @__PURE__ */ b(Te, { gap: "sm", children: [
1337
- Ce.map((S) => st(S, P)),
1338
- me.map((S) => {
1339
- const z = An(S.userMessage), R = he.has(S.userMessage.id);
1340
- return /* @__PURE__ */ b(k, { children: [
1341
- /* @__PURE__ */ b(k, { position: "sticky", top: "0", zIndex: 1, children: [
1342
- /* @__PURE__ */ b(k, { position: "relative", children: [
1343
- /* @__PURE__ */ i(V.Root, { from: "user", children: /* @__PURE__ */ i(V.Content, { from: "user", maxH: z && !R ? In : void 0, overflowY: "hidden", children: /* @__PURE__ */ i(_t, { message: S.userMessage, streaming: P }) }) }),
1344
- z && !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(Se, { size: "2xs", variant: "solid", onClick: () => ge(S.userMessage.id), children: "Show more" }) })
1345
- ] }),
1346
- z && R && /* @__PURE__ */ i($, { justifyContent: "flex-end", mt: "2xs", mb: "sm", children: /* @__PURE__ */ i(Se, { size: "2xs", variant: "ghost", onClick: () => ge(S.userMessage.id), children: "Show less" }) })
1347
- ] }),
1348
- S.responses.map((xe) => st(xe, P))
1349
- ] }, S.userMessage.id);
1350
- })
1351
- ] }) : Z ?? /* @__PURE__ */ i(ln, { icon: /* @__PURE__ */ i(en, { size: 48, strokeWidth: 1.5 }), title: o, description: s });
1352
- let D;
1353
- e[1] !== W.Viewport || e[2] !== be ? (D = /* @__PURE__ */ i(W.Viewport, { children: be }), e[1] = W.Viewport, e[2] = be, e[3] = D) : D = e[3];
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;
1354
1910
  let H;
1355
- e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (H = /* @__PURE__ */ i(He.ScrollToBottom, { "aria-label": "Scroll to latest message" }), e[4] = H) : H = e[4];
1356
- let M;
1357
- e[5] !== O ? (M = O ? /* @__PURE__ */ b(ke, { gap: "xs", px: "sm", py: "2xs", children: [
1358
- /* @__PURE__ */ i(qe, { size: "xs", color: "fg.muted" }),
1359
- /* @__PURE__ */ i(Y, { textStyle: "label/XS/regular", color: "fg.muted", children: "Working..." })
1360
- ] }) : null, e[5] = O, e[6] = M) : M = e[6];
1361
- const v = A ? "0" : "xs";
1362
- let C;
1363
- e[7] !== G ? (C = Rn(G), e[7] = G, e[8] = C) : C = e[8];
1364
- let I;
1365
- e[9] !== p || e[10] !== h || e[11] !== T || e[12] !== c || e[13] !== A || e[14] !== K || e[15] !== u || e[16] !== g || e[17] !== f || e[18] !== P || e[19] !== C ? (I = /* @__PURE__ */ i(Tn, { placeholder: c, defaultState: C, streaming: P, onSubmit: f, onChange: u, actions: p, attachedResources: h, onClearAttachments: g, attachmentList: T, isDisabled: K, attachedToTop: A }), e[9] = p, e[10] = h, e[11] = T, e[12] = c, e[13] = A, e[14] = K, e[15] = u, e[16] = g, e[17] = f, e[18] = P, e[19] = C, e[20] = I) : I = e[20];
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 });
1366
1921
  let j;
1367
- e[21] !== v || e[22] !== I || e[23] !== w ? (j = /* @__PURE__ */ b(Te, { px: "sm", gap: v, children: [
1368
- w,
1369
- I
1370
- ] }), e[21] = v, e[22] = I, e[23] = w, e[24] = j) : j = e[24];
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];
1371
1923
  let N;
1372
- return e[25] !== m ? (N = /* @__PURE__ */ i($, { p: "2xs", justifyContent: "flex-end", children: m }), e[25] = m, e[26] = N) : N = e[26], /* @__PURE__ */ b($, { position: "relative", direction: "column", w: "full", h: "full", overflow: "hidden", children: [
1373
- /* @__PURE__ */ b(He.Root, { children: [
1374
- /* @__PURE__ */ i(Sn, { userMessageCount: F }),
1375
- D,
1376
- H
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
1377
1946
  ] }),
1378
- L,
1379
- M,
1380
- j,
1381
- N
1947
+ w,
1948
+ V,
1949
+ G,
1950
+ fe
1382
1951
  ] });
1383
1952
  };
1384
- function Kr(t, e) {
1953
+ function Dr(t, e) {
1385
1954
  return t + (e.role === "user" ? 1 : 0);
1386
1955
  }
1387
- function Xr() {
1956
+ function Lr() {
1388
1957
  return /* @__PURE__ */ new Set();
1389
1958
  }
1390
- const it = (t) => /* @__PURE__ */ i(Te, { gap: "xs", w: "full", children: t.map((e, n) => /* @__PURE__ */ i(Et, { height: "3", width: e, borderRadius: "xs" }, `${e}-${n}`)) }), Do = () => {
1391
- 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);
1392
1961
  let e;
1393
- t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ i(V.Root, { from: "user", children: /* @__PURE__ */ i(V.Content, { from: "user", children: it(["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];
1394
1963
  let n;
1395
- 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: [
1396
1965
  e,
1397
- /* @__PURE__ */ i(V.Root, { from: "assistant", children: /* @__PURE__ */ i(V.Content, { from: "assistant", children: it(["76%", "62%", "40%"]) }) })
1966
+ /* @__PURE__ */ l(ce.Root, { from: "assistant", children: /* @__PURE__ */ l(ce.Content, { from: "assistant", children: Ht(["76%", "62%", "40%"]) }) })
1398
1967
  ] }), t[1] = n) : n = t[1], n;
1399
- }, Mo = (t) => {
1400
- const e = y(14), {
1968
+ }, Si = (t) => {
1969
+ const e = S(14), {
1401
1970
  changesLabel: n,
1402
- additions: r,
1971
+ additions: s,
1403
1972
  deletions: o,
1404
- action: s,
1405
- status: l,
1406
- statusLabel: a
1407
- } = 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";
1408
- let p;
1409
- e[0] !== r || e[1] !== n || e[2] !== o || e[3] !== d || e[4] !== c || e[5] !== a ? (p = c === "loading" ? /* @__PURE__ */ b(ke, { gap: "xs", minW: "0", children: [
1410
- /* @__PURE__ */ i(qe, { size: "xs", color: "fg.muted" }),
1411
- /* @__PURE__ */ i(Y, { textStyle: "label/S/regular", color: "fg.muted", truncate: !0, children: a ?? "Setting up workspace..." })
1412
- ] }) : c === "error" ? /* @__PURE__ */ b(ke, { gap: "xs", minW: "0", children: [
1413
- /* @__PURE__ */ i(dt, { size: 14, color: "var(--chakra-colors-fg-error)" }),
1414
- /* @__PURE__ */ i(Y, { textStyle: "label/S/regular", color: "fg.error", truncate: !0, children: a ?? "Workspace setup failed" })
1415
- ] }) : d ? /* @__PURE__ */ i(pt, { label: n, additions: r, deletions: o, variant: "ghost", size: "small", _hover: {
1416
- background: "transparent"
1417
- } }) : /* @__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";
1418
1977
  let m;
1419
- e[7] !== s ? (m = s ? /* @__PURE__ */ i($, { flexShrink: 0, ml: "auto", children: s }) : null, e[7] = s, e[8] = m) : m = e[8];
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];
1420
1989
  let h;
1421
- return e[9] !== f || e[10] !== u || e[11] !== p || e[12] !== m ? (h = /* @__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: [
1422
- p,
1423
- m
1424
- ] }), e[9] = f, e[10] = u, e[11] = p, e[12] = m, e[13] = h) : h = e[13], 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;
1425
1994
  };
1426
1995
  export {
1427
- Ao as ApprovalPrompt,
1428
- Sn as AutoScroll,
1429
- Tn as ChatInput,
1430
- V as ChatMessage,
1431
- Bo as ChatPanel,
1432
- He as ChatPrimitives,
1433
- Do as ChatSkeleton,
1434
- Mo as ChatWorkspaceHub,
1435
- kn as SendButton,
1436
- Rn 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
1437
2006
  };
1438
2007
  //# sourceMappingURL=chat-ui.js.map