@pstdio/ui 0.5.2 → 0.7.0

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