@pstdio/ui 0.0.4 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/chat-ui.js +1162 -193
  2. package/dist/chat-ui.js.map +1 -1
  3. package/dist/components/chat-ui/index.d.ts +8 -5
  4. package/dist/components/chat-ui/tool-rendering/build-timeline.d.ts +2 -2
  5. package/dist/components/checkbox.d.ts +8 -0
  6. package/dist/components/checkbox.stories.d.ts +15 -0
  7. package/dist/components/documentation/docs-changelog.d.ts +20 -0
  8. package/dist/components/documentation/docs-changelog.stories.d.ts +15 -0
  9. package/dist/components/documentation/docs-outline.d.ts +13 -0
  10. package/dist/components/documentation/docs-outline.stories.d.ts +16 -0
  11. package/dist/components/documentation/docs-pagination.d.ts +10 -0
  12. package/dist/components/documentation/docs-pagination.stories.d.ts +14 -0
  13. package/dist/components/documentation/docs-sidebar.d.ts +14 -0
  14. package/dist/components/documentation/docs-sidebar.stories.d.ts +7 -0
  15. package/dist/components/folder-picker-dialog.d.ts +25 -0
  16. package/dist/components/folder-picker-dialog.stories.d.ts +11 -0
  17. package/dist/components/item-section.d.ts +1 -1
  18. package/dist/components/panel-menu.d.ts +2 -0
  19. package/dist/components/panel-menu.stories.d.ts +1 -0
  20. package/dist/components/properties.d.ts +4 -4
  21. package/dist/components/rich-text/markdown-editor/markdown-editor.d.ts +1 -0
  22. package/dist/components/rich-text/markdown-editor/markdown-editor.stories.d.ts +1 -0
  23. package/dist/components/rich-text/utils/inferResourceType.d.ts +1 -1
  24. package/dist/components/scroll-area.d.ts +16 -0
  25. package/dist/components/scroll-area.stories.d.ts +7 -0
  26. package/dist/components/session-indicator.d.ts +1 -1
  27. package/dist/components/switch.d.ts +15 -0
  28. package/dist/components/switch.stories.d.ts +16 -0
  29. package/dist/components/{ticket-card.d.ts → tickets/ticket-card.d.ts} +2 -1
  30. package/dist/components/tickets/ticket-list.d.ts +23 -0
  31. package/dist/components/tickets/ticket-list.stories.d.ts +10 -0
  32. package/dist/empty-state-B8mbv7ZH.js +128 -0
  33. package/dist/empty-state-B8mbv7ZH.js.map +1 -0
  34. package/dist/index.d.ts +33 -0
  35. package/dist/index.js +1330 -321
  36. package/dist/index.js.map +1 -1
  37. package/dist/{rich-message-CiA3ripk.js → rich-message-CNDoACE7.js} +8 -7
  38. package/dist/{rich-message-CiA3ripk.js.map → rich-message-CNDoACE7.js.map} +1 -1
  39. package/dist/rich-text.js +267 -262
  40. package/dist/rich-text.js.map +1 -1
  41. package/dist/style.css +1 -1
  42. package/dist/theme/primitives/colors.d.ts +12 -28
  43. package/dist/theme/recipes/menu.d.ts +1 -1
  44. package/dist/theme/recipes/progress-circle.d.ts +3 -3
  45. package/dist/theme/tokens/borders.d.ts +6 -6
  46. package/dist/theme/tokens/colors.d.ts +180 -0
  47. package/dist/{theme-9E0MRtZk.js → theme-C7CIuIPZ.js} +197 -115
  48. package/dist/theme-C7CIuIPZ.js.map +1 -0
  49. package/dist/theme.js +1 -1
  50. package/package.json +10 -8
  51. package/dist/theme-9E0MRtZk.js.map +0 -1
  52. /package/dist/components/{ticket-board.d.ts → tickets/ticket-board.d.ts} +0 -0
  53. /package/dist/components/{ticket-board.stories.d.ts → tickets/ticket-board.stories.d.ts} +0 -0
  54. /package/dist/components/{ticket-card.stories.d.ts → tickets/ticket-card.stories.d.ts} +0 -0
package/dist/chat-ui.js CHANGED
@@ -1,10 +1,10 @@
1
- import { defineSlotRecipe as ht, createSlotRecipeContext as bt, chakra as at, AbsoluteCenter as gt, IconButton as ct, Tooltip as $, Portal as St, Kbd as xt, Text as Ct, Spacer as vt, HStack as yt, Flex as wt, Box as Rt } from "@chakra-ui/react";
2
- import { jsx as l, jsxs as K, Fragment as _t } from "react/jsx-runtime";
3
- import { c as N } from "react/compiler-runtime";
4
- import { ArrowDownIcon as zt, Square as Bt, ArrowUp as Tt } from "lucide-react";
5
- import { StickToBottom as dt, useStickToBottomContext as mt } from "use-stick-to-bottom";
6
- import { useRef as ut, useEffect as ft, useState as q } from "react";
7
- import { g as rt, P as Pt, a as Et } from "./rich-message-CiA3ripk.js";
1
+ import { jsx as l, jsxs as x, Fragment as De } from "react/jsx-runtime";
2
+ import { c as y } from "react/compiler-runtime";
3
+ import { chakra as je, AbsoluteCenter as ft, IconButton as Ue, defineSlotRecipe as pt, createSlotRecipeContext as mt, Text as Q, Code as Me, Button as Ae, HStack as qe, Box as T, Flex as pe, Tooltip as fe, Portal as ht, Kbd as gt, Spacer as bt, Timeline as xt, Span as se, Avatar as Z, Card as M, Link as Ve, Stack as Ke, Spinner as yt } from "@chakra-ui/react";
4
+ import { ArrowDownIcon as St, ShieldX as kt, ShieldCheck as Tt, Square as wt, ArrowUp as Ct, Move as Pt, FileDown as _t, FileUp as Rt, FileDiff as It, Trash2 as Bt, FilePen as At, FileText as Dt, ListTree as vt, Terminal as Ge, File as Ft, Globe as $t, Search as zt, AlertTriangle as Mt, DotIcon as Ot, ChevronUpIcon as Lt, MessageCircleIcon as Et } from "lucide-react";
5
+ import { StickToBottom as Ye, useStickToBottomContext as Je } from "use-stick-to-bottom";
6
+ import { useRef as Xe, useEffect as Qe, useState as oe } from "react";
7
+ import { f as Re, P as Wt, g as Nt, R as Ze, h as Ht } from "./rich-message-CNDoACE7.js";
8
8
  import "@lexical/react/LexicalCollaborationContext";
9
9
  import "@lexical/react/LexicalCollaborationPlugin";
10
10
  import "@lexical/react/LexicalComposer";
@@ -25,10 +25,47 @@ import "@lexical/utils";
25
25
  import "react-dom";
26
26
  import "./tooltip-Gm7PLwZG.js";
27
27
  import "@lexical/markdown";
28
+ import "@lexical/react/LexicalAutoFocusPlugin";
28
29
  import "@lexical/react/LexicalHistoryPlugin";
29
30
  import "@lexical/react/LexicalOnChangePlugin";
30
31
  import "@lexical/react/LexicalTreeView";
31
- const kt = ht({
32
+ import { D as jt, a as Ut, E as qt } from "./empty-state-B8mbv7ZH.js";
33
+ const Vt = {
34
+ "aria-roledescription": "conversation",
35
+ initial: "instant",
36
+ resize: "instant",
37
+ role: "log"
38
+ }, Kt = je(Ye, {
39
+ base: {
40
+ position: "relative",
41
+ flex: 1,
42
+ overflowY: "auto",
43
+ height: "full"
44
+ }
45
+ }, {
46
+ forwardProps: ["resize"],
47
+ defaultProps: Vt
48
+ }), Gt = je(Ye.Content, {
49
+ base: {
50
+ p: "0"
51
+ }
52
+ }, {
53
+ defaultProps: {
54
+ "aria-live": "polite",
55
+ role: "list"
56
+ }
57
+ }), Yt = (t) => {
58
+ const e = y(4), {
59
+ isAtBottom: n,
60
+ scrollToBottom: s
61
+ } = Je();
62
+ let r;
63
+ return e[0] !== n || e[1] !== t || e[2] !== s ? (r = !n && /* @__PURE__ */ l(ft, { axis: "horizontal", bottom: "md", children: /* @__PURE__ */ l(Ue, { rounded: "full", onClick: () => s(), variant: "outline", size: "xs", ...t, children: /* @__PURE__ */ l(St, { size: 16 }) }) }), e[0] = n, e[1] = t, e[2] = s, e[3] = r) : r = e[3], r;
64
+ }, Ie = {
65
+ Root: Kt,
66
+ Viewport: Gt,
67
+ ScrollToBottom: Yt
68
+ }, Jt = pt({
32
69
  className: "ai-message",
33
70
  slots: ["root", "content"],
34
71
  base: {
@@ -134,214 +171,1146 @@ const kt = ht({
134
171
  shape: "rounded"
135
172
  }
136
173
  }), {
137
- withProvider: Dt,
138
- withContext: Mt
139
- } = bt({
140
- recipe: kt
141
- }), It = Dt("div", "root"), At = Mt("div", "content"), ve = {
142
- Root: It,
143
- Content: At
144
- }, jt = {
145
- "aria-roledescription": "conversation",
146
- initial: "instant",
147
- resize: "instant",
148
- role: "log"
149
- }, Ft = at(dt, {
150
- base: {
151
- position: "relative",
152
- flex: 1,
153
- overflowY: "auto",
154
- height: "full"
155
- }
156
- }, {
157
- forwardProps: ["resize"],
158
- defaultProps: jt
159
- }), Lt = at(dt.Content, {
160
- base: {
161
- p: "0"
162
- }
163
- }, {
164
- defaultProps: {
165
- "aria-live": "polite",
166
- role: "list"
167
- }
168
- }), Wt = (n) => {
169
- const t = N(4), {
170
- isAtBottom: e,
171
- scrollToBottom: i
172
- } = mt();
173
- let o;
174
- return t[0] !== e || t[1] !== n || t[2] !== i ? (o = !e && /* @__PURE__ */ l(gt, { axis: "horizontal", bottom: "md", children: /* @__PURE__ */ l(ct, { rounded: "full", onClick: () => i(), variant: "outline", size: "xs", ...n, children: /* @__PURE__ */ l(zt, { size: 16 }) }) }), t[0] = e, t[1] = n, t[2] = i, t[3] = o) : o = t[3], o;
175
- }, ye = {
176
- Root: Ft,
177
- Viewport: Lt,
178
- ScrollToBottom: Wt
179
- }, $t = (n) => {
174
+ withProvider: Xt,
175
+ withContext: Qt
176
+ } = mt({
177
+ recipe: Jt
178
+ }), Zt = Xt("div", "root"), en = Qt("div", "content"), Oe = {
179
+ Root: Zt,
180
+ Content: en
181
+ }, tn = (t) => {
182
+ if (t == null) return null;
183
+ const e = typeof t == "string" ? t : JSON.stringify(t, null, 2);
184
+ return e.length === 0 ? null : e.length > 200 ? `${e.slice(0, 200)}...` : e;
185
+ }, lo = (t) => {
186
+ const e = y(19), {
187
+ toolName: n,
188
+ toolInput: s,
189
+ onApprove: r,
190
+ onDeny: o
191
+ } = t;
192
+ let i;
193
+ e[0] !== s ? (i = tn(s), e[0] = s, e[1] = i) : i = e[1];
194
+ const c = i;
195
+ let d;
196
+ e[2] !== n ? (d = /* @__PURE__ */ x(Q, { textStyle: "label/S/medium", color: "fg", children: [
197
+ "Allow ",
198
+ /* @__PURE__ */ l(Me, { size: "sm", children: n }),
199
+ "?"
200
+ ] }), e[2] = n, e[3] = d) : d = e[3];
201
+ let a;
202
+ e[4] !== c ? (a = c ? /* @__PURE__ */ l(Me, { size: "sm", whiteSpace: "pre-wrap", maxH: "6rem", overflowY: "auto", children: c }) : null, e[4] = c, e[5] = a) : a = e[5];
203
+ let u;
204
+ e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ l(kt, { size: 14 }), e[6] = u) : u = e[6];
205
+ let f;
206
+ e[7] !== o ? (f = /* @__PURE__ */ x(Ae, { size: "xs", variant: "outline", onClick: o, children: [
207
+ u,
208
+ "Deny"
209
+ ] }), e[7] = o, e[8] = f) : f = e[8];
210
+ let p;
211
+ e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ l(Tt, { size: 14 }), e[9] = p) : p = e[9];
212
+ let m;
213
+ e[10] !== r ? (m = /* @__PURE__ */ x(Ae, { size: "xs", colorPalette: "green", onClick: r, children: [
214
+ p,
215
+ "Allow"
216
+ ] }), e[10] = r, e[11] = m) : m = e[11];
217
+ let h;
218
+ e[12] !== f || e[13] !== m ? (h = /* @__PURE__ */ x(qe, { gap: "xs", justifyContent: "flex-end", children: [
219
+ f,
220
+ m
221
+ ] }), e[12] = f, e[13] = m, e[14] = h) : h = e[14];
222
+ let g;
223
+ return e[15] !== d || e[16] !== a || e[17] !== h ? (g = /* @__PURE__ */ l(T, { px: "sm", py: "xs", mx: "sm", borderWidth: "1px", borderColor: "border.warning", borderRadius: "lg", bg: "bg.warning", children: /* @__PURE__ */ x(pe, { direction: "column", gap: "xs", children: [
224
+ d,
225
+ a,
226
+ h
227
+ ] }) }), e[15] = d, e[16] = a, e[17] = h, e[18] = g) : g = e[18], g;
228
+ }, nn = (t) => {
180
229
  const {
181
- previousUserMessageCount: t,
182
- userMessageCount: e
183
- } = n;
184
- return t === 0 ? !1 : e > t;
230
+ previousUserMessageCount: e,
231
+ userMessageCount: n
232
+ } = t;
233
+ return e === 0 ? !1 : n > e;
185
234
  };
186
- function we(n) {
187
- const t = N(4), {
188
- userMessageCount: e
189
- } = n, {
190
- scrollToBottom: i
191
- } = mt(), o = ut(e);
192
- let r, d;
193
- return t[0] !== i || t[1] !== e ? (r = () => {
194
- $t({
195
- previousUserMessageCount: o.current,
196
- userMessageCount: e
197
- }) && i(), o.current = e;
198
- }, d = [e, i], t[0] = i, t[1] = e, t[2] = r, t[3] = d) : (r = t[2], d = t[3]), ft(r, d), null;
235
+ function rn(t) {
236
+ const e = y(4), {
237
+ userMessageCount: n
238
+ } = t, {
239
+ scrollToBottom: s
240
+ } = Je(), r = Xe(n);
241
+ let o, i;
242
+ return e[0] !== s || e[1] !== n ? (o = () => {
243
+ nn({
244
+ previousUserMessageCount: r.current,
245
+ userMessageCount: n
246
+ }) && s(), r.current = n;
247
+ }, i = [n, s], e[0] = s, e[1] = n, e[2] = o, e[3] = i) : (o = e[2], i = e[3]), Qe(o, i), null;
199
248
  }
200
- const qt = (n) => {
201
- const t = N(22);
202
- let e, i, o, r;
203
- t[0] !== n ? ({
204
- title: r,
205
- shortcut: o,
206
- canInterrupt: e,
207
- ...i
208
- } = n, t[0] = n, t[1] = e, t[2] = i, t[3] = o, t[4] = r) : (e = t[1], i = t[2], o = t[3], r = t[4]);
209
- const d = i["aria-label"] ?? r;
210
- let p;
211
- t[5] !== e ? (p = e ? /* @__PURE__ */ l(Bt, { size: 16, strokeWidth: 2, fill: "currentColor" }) : /* @__PURE__ */ l(Tt, { size: 16, strokeWidth: 2 }), t[5] = e, t[6] = p) : p = t[6];
212
- const x = p;
249
+ const on = (t) => {
250
+ const e = y(22);
251
+ let n, s, r, o;
252
+ e[0] !== t ? ({
253
+ title: o,
254
+ shortcut: r,
255
+ canInterrupt: n,
256
+ ...s
257
+ } = t, e[0] = t, e[1] = n, e[2] = s, e[3] = r, e[4] = o) : (n = e[1], s = e[2], r = e[3], o = e[4]);
258
+ const i = s["aria-label"] ?? o;
259
+ let c;
260
+ e[5] !== n ? (c = n ? /* @__PURE__ */ l(wt, { size: 16, strokeWidth: 2, fill: "currentColor" }) : /* @__PURE__ */ l(Ct, { size: 16, strokeWidth: 2 }), e[5] = n, e[6] = c) : c = e[6];
261
+ const d = c;
213
262
  let a;
214
- t[7] !== d || t[8] !== x || t[9] !== i || t[10] !== r ? (a = /* @__PURE__ */ l(ct, { size: "sm", variant: "solid", borderRadius: "full", colorPalette: "primary", "aria-label": d, title: r, ...i, children: x }), t[7] = d, t[8] = x, t[9] = i, t[10] = r, t[11] = a) : a = t[11];
263
+ e[7] !== i || e[8] !== d || e[9] !== s || e[10] !== o ? (a = /* @__PURE__ */ l(Ue, { size: "sm", variant: "solid", borderRadius: "full", colorPalette: "primary", "aria-label": i, title: o, ...s, children: d }), e[7] = i, e[8] = d, e[9] = s, e[10] = o, e[11] = a) : a = e[11];
215
264
  const u = a;
216
- if (r) {
217
- let h;
218
- t[12] !== o || t[13] !== r ? (h = o ? /* @__PURE__ */ K(_t, { children: [
219
- r,
265
+ if (o) {
266
+ let f;
267
+ e[12] !== r || e[13] !== o ? (f = r ? /* @__PURE__ */ x(De, { children: [
268
+ o,
220
269
  " ",
221
- /* @__PURE__ */ l(xt, { fontSize: "xs", children: o })
222
- ] }) : r, t[12] = o, t[13] = r, t[14] = h) : h = t[14];
223
- const b = h;
270
+ /* @__PURE__ */ l(gt, { fontSize: "xs", children: r })
271
+ ] }) : o, e[12] = r, e[13] = o, e[14] = f) : f = e[14];
272
+ const p = f;
224
273
  let m;
225
- t[15] !== u ? (m = /* @__PURE__ */ l($.Trigger, { asChild: !0, children: u }), t[15] = u, t[16] = m) : m = t[16];
226
- let s;
227
- t[17] !== b ? (s = /* @__PURE__ */ l(St, { children: /* @__PURE__ */ l($.Positioner, { children: /* @__PURE__ */ l($.Content, { children: b }) }) }), t[17] = b, t[18] = s) : s = t[18];
228
- let f;
229
- return t[19] !== m || t[20] !== s ? (f = /* @__PURE__ */ K($.Root, { closeDelay: 50, openDelay: 100, children: [
274
+ e[15] !== u ? (m = /* @__PURE__ */ l(fe.Trigger, { asChild: !0, children: u }), e[15] = u, e[16] = m) : m = e[16];
275
+ let h;
276
+ e[17] !== p ? (h = /* @__PURE__ */ l(ht, { children: /* @__PURE__ */ l(fe.Positioner, { children: /* @__PURE__ */ l(fe.Content, { children: p }) }) }), e[17] = p, e[18] = h) : h = e[18];
277
+ let g;
278
+ return e[19] !== m || e[20] !== h ? (g = /* @__PURE__ */ x(fe.Root, { closeDelay: 50, openDelay: 100, children: [
230
279
  m,
231
- s
232
- ] }), t[19] = m, t[20] = s, t[21] = f) : f = t[21], f;
280
+ h
281
+ ] }), e[19] = m, e[20] = h, e[21] = g) : g = e[21], g;
233
282
  }
234
283
  return u;
235
- }, Re = (n) => {
236
- const t = N(60), {
237
- defaultState: e,
238
- onSubmit: i,
239
- onInterrupt: o,
240
- streaming: r,
241
- attachedResources: d,
242
- onClearAttachments: p,
243
- isDisabled: x,
284
+ }, sn = (t) => {
285
+ const e = y(61), {
286
+ defaultState: n,
287
+ onSubmit: s,
288
+ onInterrupt: r,
289
+ streaming: o,
290
+ attachedResources: i,
291
+ onClearAttachments: c,
292
+ isDisabled: d,
244
293
  onChange: a,
245
294
  placeholder: u,
246
- attachmentList: h,
247
- actions: b
248
- } = n, m = i === void 0 ? Kt : i, s = r === void 0 ? !1 : r;
249
- let f;
250
- t[0] !== d ? (f = d === void 0 ? [] : d, t[0] = d, t[1] = f) : f = t[1];
251
- const U = f, g = x === void 0 ? !1 : x, [H, nt] = q(!1), [V, it] = q(e), [Y, st] = q(0);
252
- let P;
253
- t[2] !== e ? (P = () => rt(e), t[2] = e, t[3] = P) : P = t[3];
254
- const [C, J] = q(P), lt = ut(null);
255
- let E, k;
256
- t[4] !== e || t[5] !== a ? (E = () => {
257
- const c = rt(e);
258
- it(e), st(Nt), J(c), a?.(c);
259
- }, k = [e, a], t[4] = e, t[5] = a, t[6] = E, t[7] = k) : (E = t[6], k = t[7]), ft(E, k);
260
- let D;
261
- t[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (D = () => {
262
- nt(!0);
263
- const c = lt.current?.querySelector('[contenteditable="true"]');
264
- c instanceof HTMLElement && c.focus();
265
- }, t[8] = D) : D = t[8];
266
- const pt = D;
267
- let M;
268
- t[9] !== e || t[10] !== a ? (M = () => {
269
- it(e), st(Ut);
270
- const c = rt(e);
271
- J(c), a?.(c);
272
- }, t[9] = e, t[10] = a, t[11] = M) : M = t[11];
273
- const O = M;
274
- let I;
275
- t[12] !== U || t[13] !== g || t[14] !== p || t[15] !== o || t[16] !== m || t[17] !== O || t[18] !== s || t[19] !== C ? (I = () => {
276
- if (g)
295
+ attachmentList: f,
296
+ actions: p
297
+ } = t, m = s === void 0 ? ln : s, h = o === void 0 ? !1 : o;
298
+ let g;
299
+ e[0] !== i ? (g = i === void 0 ? [] : i, e[0] = i, e[1] = g) : g = e[1];
300
+ const S = g, k = d === void 0 ? !1 : d, [P, D] = oe(!1), [B, v] = oe(n), [A, F] = oe(0);
301
+ let _;
302
+ e[2] !== n ? (_ = () => Re(n), e[2] = n, e[3] = _) : _ = e[3];
303
+ const [C, O] = oe(_), $ = Xe(null);
304
+ let R, I;
305
+ e[4] !== n || e[5] !== a ? (R = () => {
306
+ const w = Re(n);
307
+ v(n), F(cn), O(w), a?.(w);
308
+ }, I = [n, a], e[4] = n, e[5] = a, e[6] = R, e[7] = I) : (R = e[6], I = e[7]), Qe(R, I);
309
+ let z;
310
+ e[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (z = () => {
311
+ const w = $.current?.querySelector('[contenteditable="true"]');
312
+ w instanceof HTMLElement && w.focus();
313
+ }, e[8] = z) : z = e[8];
314
+ const N = z;
315
+ let H;
316
+ e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (H = () => {
317
+ D(!0), N();
318
+ }, e[9] = H) : H = e[9];
319
+ const ye = H;
320
+ let L;
321
+ e[10] !== n || e[11] !== a ? (L = (w) => {
322
+ const ut = w === void 0 ? !1 : w;
323
+ v(n), F(an);
324
+ const ze = Re(n);
325
+ O(ze), a?.(ze), ut && requestAnimationFrame(() => {
326
+ N();
327
+ });
328
+ }, e[10] = n, e[11] = a, e[12] = L) : L = e[12];
329
+ const j = L;
330
+ let ie;
331
+ e[13] !== S || e[14] !== k || e[15] !== c || e[16] !== r || e[17] !== m || e[18] !== j || e[19] !== h || e[20] !== C ? (ie = () => {
332
+ if (k)
277
333
  return;
278
- if (s) {
279
- o?.();
334
+ if (h) {
335
+ r?.();
280
336
  return;
281
337
  }
282
- const c = C.trim();
283
- c && (m(c, U), O(), p?.());
284
- }, t[12] = U, t[13] = g, t[14] = p, t[15] = o, t[16] = m, t[17] = O, t[18] = s, t[19] = C, t[20] = I) : I = t[20];
285
- const v = I, S = s && !!o;
286
- let A;
287
- t[21] !== u ? (A = u ? /* @__PURE__ */ l(Ct, { textStyle: "label/M/regular", color: "fg.subtle", pointerEvents: "none", position: "absolute", top: "0", children: u }) : void 0, t[21] = u, t[22] = A) : A = t[22];
288
- const X = A, G = H ? "blue.border" : "border.muted", Q = H ? "mid" : "low", Z = H ? "blue.border" : "border";
289
- let y;
290
- t[23] !== Z ? (y = {
291
- borderColor: Z,
338
+ const w = C.trim();
339
+ w && (m(w, S), j(!0), c?.());
340
+ }, e[13] = S, e[14] = k, e[15] = c, e[16] = r, e[17] = m, e[18] = j, e[19] = h, e[20] = C, e[21] = ie) : ie = e[21];
341
+ const U = ie, W = h && !!r;
342
+ let le;
343
+ e[22] !== u ? (le = u ? /* @__PURE__ */ l(Q, { textStyle: "label/M/regular", color: "fg.subtle", pointerEvents: "none", position: "absolute", top: "0", children: u }) : void 0, e[22] = u, e[23] = le) : le = e[23];
344
+ const Se = le, ke = P ? "blue.border" : "border.muted", Te = P ? "mid" : "low", we = P ? "blue.border" : "border";
345
+ let q;
346
+ e[24] !== we ? (q = {
347
+ borderColor: we,
292
348
  boxShadow: "mid"
293
- }, t[23] = Z, t[24] = y) : y = t[24];
294
- let j;
295
- t[25] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (j = {
349
+ }, e[24] = we, e[25] = q) : q = e[25];
350
+ let ce;
351
+ e[26] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (ce = {
296
352
  borderColor: "blue.border",
297
353
  boxShadow: "mid"
298
- }, t[25] = j) : j = t[25];
299
- let F;
300
- t[26] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (F = () => nt(!1), t[26] = F) : F = t[26];
301
- const tt = !g;
302
- let w;
303
- t[27] !== a ? (w = (c) => {
304
- J(c), a?.(c);
305
- }, t[27] = a, t[28] = w) : w = t[28];
354
+ }, e[26] = ce) : ce = e[26];
355
+ let ae;
356
+ e[27] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (ae = () => D(!1), e[27] = ae) : ae = e[27];
357
+ const Ce = !k;
358
+ let V;
359
+ e[28] !== a ? (V = (w) => {
360
+ O(w), a?.(w);
361
+ }, e[28] = a, e[29] = V) : V = e[29];
362
+ let K;
363
+ e[30] !== A || e[31] !== B || e[32] !== U || e[33] !== Se || e[34] !== Ce || e[35] !== V ? (K = /* @__PURE__ */ l(Wt, { defaultState: B, isEditable: Ce, placeholder: Se, onChange: V, onSubmit: U }, A), e[30] = A, e[31] = B, e[32] = U, e[33] = Se, e[34] = Ce, e[35] = V, e[36] = K) : K = e[36];
364
+ let de;
365
+ e[37] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (de = /* @__PURE__ */ l(bt, {}), e[37] = de) : de = e[37];
366
+ const Pe = W ? "Stop Response" : "Message Sending", _e = h ? void 0 : "Enter";
367
+ let G;
368
+ e[38] !== W || e[39] !== k || e[40] !== h || e[41] !== C ? (G = h && !W || !h && !C.trim() || k, e[38] = W, e[39] = k, e[40] = h, e[41] = C, e[42] = G) : G = e[42];
369
+ let Y;
370
+ e[43] !== W || e[44] !== U || e[45] !== Pe || e[46] !== _e || e[47] !== G ? (Y = /* @__PURE__ */ l(on, { canInterrupt: W, title: Pe, shortcut: _e, onClick: U, disabled: G }), e[43] = W, e[44] = U, e[45] = Pe, e[46] = _e, e[47] = G, e[48] = Y) : Y = e[48];
371
+ let J;
372
+ e[49] !== p || e[50] !== Y ? (J = /* @__PURE__ */ x(qe, { gap: "1", mt: "md", children: [
373
+ p,
374
+ de,
375
+ Y
376
+ ] }), e[49] = p, e[50] = Y, e[51] = J) : J = e[51];
377
+ let X;
378
+ e[52] !== f || e[53] !== K || e[54] !== J ? (X = /* @__PURE__ */ x(pe, { direction: "column", color: "fg", children: [
379
+ f,
380
+ K,
381
+ J
382
+ ] }), e[52] = f, e[53] = K, e[54] = J, e[55] = X) : X = e[55];
383
+ let ue;
384
+ return e[56] !== ke || e[57] !== Te || e[58] !== q || e[59] !== X ? (ue = /* @__PURE__ */ l(T, { ref: $, width: "100%", paddingX: "lg", paddingY: "md", bg: "bg", borderRadius: "md", borderWidth: "1px", borderStyle: "solid", borderColor: ke, boxShadow: Te, transition: "box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out", _hover: q, _focusWithin: ce, onClick: ye, onBlur: ae, children: X }), e[56] = ke, e[57] = Te, e[58] = q, e[59] = X, e[60] = ue) : ue = e[60], ue;
385
+ };
386
+ function ln() {
387
+ }
388
+ function cn(t) {
389
+ return t + 1;
390
+ }
391
+ function an(t) {
392
+ return t + 1;
393
+ }
394
+ const dn = (t = "") => JSON.stringify(Nt(t)), un = (t) => {
395
+ const e = y(8);
396
+ let n, s;
397
+ e[0] !== t ? ({
398
+ children: n,
399
+ ...s
400
+ } = t, e[0] = t, e[1] = n, e[2] = s) : (n = e[1], s = e[2]);
401
+ let r;
402
+ e[3] !== n ? (r = /* @__PURE__ */ l(Ze, { defaultState: n }), e[3] = n, e[4] = r) : r = e[4];
403
+ let o;
404
+ return e[5] !== s || e[6] !== r ? (o = /* @__PURE__ */ l(T, { ...s, children: r }), e[5] = s, e[6] = r, e[7] = o) : o = e[7], o;
405
+ }, fn = un, et = {
406
+ shell: Ge,
407
+ ls: vt,
408
+ read_file: Dt,
409
+ write_file: At,
410
+ delete_file: Bt,
411
+ patch: It,
412
+ upload_files: Rt,
413
+ download_file: _t,
414
+ move_file: Pt
415
+ }, pn = {
416
+ dot: Ot,
417
+ danger: Mt,
418
+ search: zt,
419
+ browser: $t,
420
+ file: Ft,
421
+ terminal: Ge,
422
+ ...et
423
+ }, Le = "dot", mn = (t) => Object.hasOwn(et, t), hn = (t) => pn[t], tt = (t) => {
424
+ if (!t) return Le;
425
+ const e = t.replace(/^tool-/, "");
426
+ if (mn(e)) return e;
427
+ switch (e) {
428
+ case "read":
429
+ return "file";
430
+ case "bash":
431
+ return "terminal";
432
+ case "apply_patch":
433
+ return "patch";
434
+ case "grep":
435
+ return "search";
436
+ case "glob":
437
+ return "file";
438
+ case "search":
439
+ return "search";
440
+ case "browser":
441
+ return "browser";
442
+ case "fs":
443
+ case "file":
444
+ return "file";
445
+ default:
446
+ return Le;
447
+ }
448
+ };
449
+ function ve(t) {
450
+ const e = t.lastIndexOf("/");
451
+ return e >= 0 ? t.slice(e + 1) : t;
452
+ }
453
+ function me(t) {
454
+ if (!t) return null;
455
+ const e = t.split(" ")[0].trim();
456
+ if (e === "/dev/null") return null;
457
+ let n = e;
458
+ return (n.startsWith("a/") || n.startsWith("b/")) && (n = n.slice(2)), n.replace(/^\/+/, "").replace(/\\/g, "/");
459
+ }
460
+ const ge = (t) => t.startsWith("--- "), Fe = (t) => t.startsWith("+++ "), $e = (t) => t.startsWith("@@"), gn = (t) => t.startsWith("+") && !(Fe(t) || t === "+++"), bn = (t) => t.startsWith("-") && !(ge(t) || t === "---"), xn = (t, e) => {
461
+ t.has(e) || t.set(e, {
462
+ additions: 0,
463
+ deletions: 0
464
+ });
465
+ }, yn = (t, e) => {
466
+ const n = t.get(e);
467
+ n && (n.additions += 1);
468
+ }, Sn = (t, e) => {
469
+ const n = t.get(e);
470
+ n && (n.deletions += 1);
471
+ }, kn = (t, e, n) => {
472
+ if (ge(t))
473
+ return {
474
+ ...e,
475
+ lastMinusHeader: me(t.slice(4)),
476
+ inHunk: !1
477
+ };
478
+ if (Fe(t)) {
479
+ const r = me(t.slice(4)) ?? e.lastMinusHeader;
480
+ return r && xn(n, r), {
481
+ ...e,
482
+ currentPath: r,
483
+ inHunk: !1
484
+ };
485
+ }
486
+ return e.currentPath ? $e(t) ? {
487
+ ...e,
488
+ inHunk: !0
489
+ } : e.inHunk ? gn(t) ? (yn(n, e.currentPath), e) : (bn(t) && Sn(n, e.currentPath), e) : e : e;
490
+ };
491
+ function nt(t) {
492
+ if (!t || typeof t != "string") return [];
493
+ const e = /* @__PURE__ */ new Map();
494
+ let n = {
495
+ currentPath: null,
496
+ lastMinusHeader: null,
497
+ inHunk: !1
498
+ };
499
+ const s = t.split(/\r?\n/);
500
+ for (const r of s)
501
+ n = kn(r, n, e);
502
+ return Array.from(e.entries()).map(([r, {
503
+ additions: o,
504
+ deletions: i
505
+ }]) => ({
506
+ filePath: r,
507
+ additions: o,
508
+ deletions: i
509
+ }));
510
+ }
511
+ function Tn(t) {
512
+ return nt(t).map((e) => ({
513
+ kind: "diff",
514
+ fileName: ve(e.filePath),
515
+ filePath: e.filePath,
516
+ additions: e.additions,
517
+ deletions: e.deletions
518
+ }));
519
+ }
520
+ function wn(t) {
521
+ return nt(t).map((e) => e.filePath);
522
+ }
523
+ const rt = (t) => ge(t) || t.startsWith("diff --git "), Cn = (t) => t.startsWith(" ") || t.startsWith("+") || t.startsWith("-") ? !1 : t.trim() !== "", Pn = (t, e, n) => {
524
+ if (t.startsWith(" ")) {
525
+ const s = t.slice(1);
526
+ e.push(s), n.push(s);
527
+ return;
528
+ }
529
+ if (t.startsWith("-")) {
530
+ e.push(t.slice(1));
531
+ return;
532
+ }
533
+ t.startsWith("+") && n.push(t.slice(1));
534
+ }, _n = (t, e, n, s) => {
535
+ let r = e;
536
+ for (; r < t.length; ) {
537
+ const o = t[r] || "";
538
+ if (rt(o) || $e(o) || Cn(o))
539
+ break;
540
+ Pn(o, n, s), r += 1;
541
+ }
542
+ return (n.length > 0 || s.length > 0) && (n.push(""), s.push("")), r;
543
+ }, Rn = (t, e) => {
544
+ const n = me((t[e] || "").slice(4)), s = t[e + 1] || "";
545
+ if (!Fe(s)) return {
546
+ nextIndex: e + 1
547
+ };
548
+ const o = me(s.slice(4)) ?? n ?? "", i = [], c = [];
549
+ let d = e + 2;
550
+ for (; d < t.length; ) {
551
+ const a = t[d] || "";
552
+ if (rt(a)) break;
553
+ if (!$e(a)) {
554
+ d += 1;
555
+ continue;
556
+ }
557
+ d = _n(t, d + 1, i, c);
558
+ }
559
+ return {
560
+ nextIndex: d,
561
+ preview: {
562
+ filePath: o,
563
+ original: i.join(`
564
+ `),
565
+ modified: c.join(`
566
+ `)
567
+ }
568
+ };
569
+ };
570
+ function In(t) {
571
+ if (!t || typeof t != "string") return [];
572
+ const e = t.split(/\r?\n/), n = [];
573
+ let s = 0;
574
+ for (; s < e.length; ) {
575
+ const r = e[s] || "";
576
+ if (!ge(r)) {
577
+ s += 1;
578
+ continue;
579
+ }
580
+ const {
581
+ nextIndex: o,
582
+ preview: i
583
+ } = Rn(e, s);
584
+ i && n.push(i), s = Math.max(o, s + 1);
585
+ }
586
+ return n;
587
+ }
588
+ const Bn = {
589
+ apply_patch: "Apply patch",
590
+ read: "Read file",
591
+ bash: "Run",
592
+ grep: "Search files",
593
+ glob: "Find files",
594
+ skill: "Load skill"
595
+ }, Ee = {
596
+ pending: "queued",
597
+ error: "failed",
598
+ "output-error": "failed",
599
+ "input-streaming": "running",
600
+ "input-available": "queued"
601
+ }, ot = (t) => t.replace(/^tool-/, ""), An = (t) => t.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), Dn = (t) => ot(t.tool ?? "tool"), vn = (t) => {
602
+ const e = ot(t);
603
+ return Bn[e] ?? An(e.replace(/_/g, " "));
604
+ }, Fn = (t) => !t || typeof t != "string" ? null : Ee[t] ? Ee[t] : t.includes("stream") ? "running" : null, st = (t) => t === "error" || t === "output-error", ee = (t) => st(t.state?.status) ? {
605
+ type: "icon",
606
+ icon: "danger"
607
+ } : {
608
+ type: "icon",
609
+ icon: tt(Dn(t))
610
+ }, te = (t, e, n) => {
611
+ const r = [{
612
+ kind: "text",
613
+ text: n ?? vn(t.tool ?? "tool"),
614
+ bold: !0
615
+ }];
616
+ e && r.push({
617
+ kind: "text",
618
+ text: e,
619
+ muted: !0
620
+ });
621
+ const o = Fn(t.state?.status);
622
+ return o && r.push({
623
+ kind: "text",
624
+ text: o,
625
+ muted: !0
626
+ }), r;
627
+ }, ne = (t) => {
628
+ const e = t.state?.input;
629
+ return !e || typeof e != "object" || Array.isArray(e) ? null : e;
630
+ }, be = (t) => {
631
+ const e = t.state?.output;
632
+ return !e || typeof e != "object" || Array.isArray(e) ? null : e;
633
+ }, b = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, he = (t) => !t || typeof t != "object" || Array.isArray(t) ? null : t, $n = (t, e) => {
634
+ const n = he(t.state);
635
+ return n ? he(n[e]) : null;
636
+ }, zn = (t) => t.replace(/\\/g, "/").replace(/^\/+/, ""), Mn = (t) => t.includes("--- ") && t.includes("+++ ") && t.includes("@@"), it = (t) => {
637
+ const e = be(t);
638
+ return [$n(t, "metadata"), he(e?.metadata)].filter(Boolean);
639
+ }, On = (t) => {
640
+ const e = he(t);
641
+ if (!e) return null;
642
+ const n = b(e.filePath) ?? b(e.relativePath) ?? b(e.path);
643
+ return n ? {
644
+ filePath: zn(n),
645
+ additions: typeof e.additions == "number" ? e.additions : 0,
646
+ deletions: typeof e.deletions == "number" ? e.deletions : 0,
647
+ diff: b(e.diff) ?? void 0,
648
+ before: b(e.before) ?? void 0,
649
+ after: b(e.after) ?? void 0
650
+ } : null;
651
+ }, lt = (t) => {
652
+ const e = [];
653
+ for (const n of it(t)) {
654
+ const s = Array.isArray(n.files) ? n.files : [];
655
+ for (const r of s) {
656
+ const o = On(r);
657
+ o && e.push(o);
658
+ }
659
+ }
660
+ return e;
661
+ }, Ln = (t) => {
662
+ const e = ne(t), n = b(e?.diff);
663
+ if (n) return n;
664
+ for (const o of it(t)) {
665
+ const i = b(o.diff);
666
+ if (i) return i;
667
+ }
668
+ const s = lt(t).map((o) => o.diff).filter((o) => !!o);
669
+ if (s.length > 0) return s.join(`
670
+ `);
671
+ const r = b(e?.patchText);
672
+ return r && Mn(r) ? r : null;
673
+ }, En = (t) => {
674
+ const e = /* @__PURE__ */ new Set(), n = [];
675
+ for (const s of t)
676
+ e.has(s.filePath) || (e.add(s.filePath), n.push({
677
+ kind: "diff",
678
+ fileName: ve(s.filePath),
679
+ filePath: s.filePath,
680
+ additions: s.additions,
681
+ deletions: s.deletions
682
+ }));
683
+ return n;
684
+ }, Wn = (t) => Array.from(new Set(t.map((e) => e.filePath))), xe = (t) => {
685
+ const e = be(t);
686
+ return b(t.state?.output) ?? b(e?.returnDisplay) ?? b(e?.preview) ?? b(e?.stdout);
687
+ }, Nn = (t) => {
688
+ const e = t.match(/<skill_content(?:\s+name="([^"]+)")?>([\s\S]*?)<\/skill_content>/);
689
+ return e ? {
690
+ skillName: b(e[1]) ?? void 0,
691
+ content: b(e[2]) ?? ""
692
+ } : null;
693
+ }, Hn = (t) => {
694
+ const e = ne(t);
695
+ return b(e?.name) ?? b(e?.skillName) ?? b(e?.skill) ?? b(e?.skill_name) ?? void 0;
696
+ }, jn = (t) => ({
697
+ kind: "link",
698
+ text: ve(t),
699
+ filePath: t
700
+ }), re = (t, e) => !st(t.state?.status) || !t.state?.errorText ? e : [{
701
+ type: "comment",
702
+ text: t.state.errorText
703
+ }, ...e], Un = (t) => {
704
+ const e = Ln(t), n = lt(t), s = te(t, void 0, "Apply patch"), r = Tn(e ?? void 0);
705
+ r.length > 0 ? s.push(...r) : s.push(...En(n));
706
+ const o = [], i = In(e ?? void 0);
707
+ for (const c of i)
708
+ o.push({
709
+ type: "diff",
710
+ language: "diff",
711
+ original: c.original,
712
+ modified: c.modified,
713
+ sideBySide: !1
714
+ });
715
+ if (o.length === 0)
716
+ for (const c of n)
717
+ !c.before && !c.after || o.push({
718
+ type: "diff",
719
+ language: "diff",
720
+ original: c.before ?? "",
721
+ modified: c.after ?? "",
722
+ sideBySide: !1
723
+ });
724
+ if (o.length === 0) {
725
+ const c = wn(e ?? void 0);
726
+ c.length === 0 && c.push(...Wn(n)), c.length > 0 && o.push({
727
+ type: "references",
728
+ references: c
729
+ });
730
+ }
731
+ return {
732
+ indicator: ee(t),
733
+ title: s,
734
+ blocks: re(t, o)
735
+ };
736
+ }, qn = (t) => {
737
+ const e = ne(t), n = be(t), s = b(e?.filePath) ?? b(e?.file) ?? b(n?.filePath) ?? b(n?.file) ?? b(n?.path) ?? void 0, r = te(t, void 0, "Read file");
738
+ return s && r.push(jn(s)), {
739
+ indicator: ee(t),
740
+ title: r,
741
+ blocks: re(t, [])
742
+ };
743
+ }, Vn = (t) => {
744
+ const e = ne(t), n = be(t), s = b(e?.command) ?? void 0, r = te(t, s, "Run command"), o = [], i = xe(t);
745
+ i && o.push({
746
+ type: "code",
747
+ language: "text",
748
+ code: i
749
+ });
750
+ const c = b(n?.stderr);
751
+ return c && c !== i && o.push({
752
+ type: "code",
753
+ language: "text",
754
+ code: c
755
+ }), typeof n?.exitCode == "number" && o.push({
756
+ type: "text",
757
+ text: `Exit code: ${n.exitCode}`
758
+ }), {
759
+ indicator: ee(t),
760
+ title: r,
761
+ blocks: re(t, o)
762
+ };
763
+ }, Kn = (t) => {
764
+ const e = ne(t), n = xe(t), s = b(e?.pattern) ?? void 0, r = te(t, s, "Search files"), o = n ? [{
765
+ type: "code",
766
+ language: "text",
767
+ code: n
768
+ }] : [];
769
+ return {
770
+ indicator: ee(t),
771
+ title: r,
772
+ blocks: re(t, o)
773
+ };
774
+ }, Gn = (t) => {
775
+ const e = ne(t), n = xe(t), s = b(e?.pattern) ?? void 0, r = te(t, s, "Find files"), o = [];
776
+ if (n) {
777
+ const i = n.split(/\r?\n/).map((c) => c.trim()).filter((c) => c.length > 0);
778
+ i.length > 0 && o.push({
779
+ type: "references",
780
+ references: i
781
+ });
782
+ }
783
+ return {
784
+ indicator: ee(t),
785
+ title: r,
786
+ blocks: re(t, o)
787
+ };
788
+ }, Yn = (t) => {
789
+ const e = xe(t), n = e ? Nn(e) : null, s = Hn(t) ?? n?.skillName, r = te(t, s, "Load skill"), o = n?.content ?? e, i = o ? [{
790
+ type: "code",
791
+ language: "markdown",
792
+ code: o
793
+ }] : [];
794
+ return {
795
+ indicator: ee(t),
796
+ title: r,
797
+ blocks: re(t, i)
798
+ };
799
+ }, We = () => ({
800
+ apply_patch: Un,
801
+ read: qn,
802
+ bash: Vn,
803
+ grep: Kn,
804
+ glob: Gn,
805
+ skill: Yn
806
+ }), Ne = {
807
+ pending: "queued",
808
+ error: "failed",
809
+ "output-error": "failed",
810
+ "input-streaming": "running",
811
+ "input-available": "queued"
812
+ }, ct = (t) => t.replace(/^tool-/, ""), Jn = (t) => t.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), Xn = (t) => {
813
+ const e = ct(t ?? "tool").replace(/_/g, " ");
814
+ return Jn(e);
815
+ }, at = (t) => t === "error" || t === "output-error", Qn = (t) => at(t.state?.status) ? {
816
+ type: "icon",
817
+ icon: "danger"
818
+ } : {
819
+ type: "icon",
820
+ icon: tt(t.tool ?? "tool")
821
+ }, Zn = (t) => !t || typeof t != "string" ? null : Ne[t] ? Ne[t] : t.includes("stream") ? "running" : null, He = (t) => {
822
+ if (typeof t == "string") return t;
823
+ if (t == null) return null;
824
+ try {
825
+ return JSON.stringify(t, null, 2);
826
+ } catch {
827
+ return null;
828
+ }
829
+ }, er = (t) => {
830
+ const e = [];
831
+ at(t.state?.status) && t.state?.errorText && e.push({
832
+ type: "comment",
833
+ text: t.state.errorText
834
+ });
835
+ const n = He(t.state?.input);
836
+ n && e.push({
837
+ type: "code",
838
+ language: "json",
839
+ code: n
840
+ });
841
+ const s = He(t.state?.output);
842
+ return s && e.push({
843
+ type: "code",
844
+ language: "json",
845
+ code: s
846
+ }), e;
847
+ }, tr = (t) => {
848
+ const e = [{
849
+ kind: "text",
850
+ text: Xn(t.tool),
851
+ bold: !0
852
+ }], n = Zn(t.state?.status);
853
+ return n && e.push({
854
+ kind: "text",
855
+ text: n,
856
+ muted: !0
857
+ }), {
858
+ indicator: Qn(t),
859
+ title: e,
860
+ blocks: er(t)
861
+ };
862
+ }, nr = (t) => t ? {
863
+ ...We(),
864
+ ...t
865
+ } : We(), rr = (t, e) => {
866
+ const n = t.tool ?? "tool";
867
+ return e[n] ?? e[ct(n)];
868
+ }, or = (t, e, n) => {
869
+ const s = rr(t, e);
870
+ if (s) {
871
+ const r = s(t, n);
872
+ if (r) return r;
873
+ }
874
+ return tr(t);
875
+ }, sr = (t, e) => {
876
+ const n = nr(e?.toolRenderers);
877
+ return {
878
+ items: t.map((r) => or(r, n, e))
879
+ };
880
+ }, E = xt, dt = (t, e, n, s = !1) => {
881
+ s && t.stopPropagation(), e.href || t.preventDefault(), e.filePath && n?.(e.filePath);
882
+ };
883
+ function ir(t) {
884
+ const e = y(6), {
885
+ seg: n
886
+ } = t;
887
+ let s;
888
+ e[0] !== n.alt || e[1] !== n.src ? (s = /* @__PURE__ */ l(Z.Image, { src: n.src, alt: n.alt }), e[0] = n.alt, e[1] = n.src, e[2] = s) : s = e[2];
889
+ let r;
890
+ e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ l(Z.Fallback, {}), e[3] = r) : r = e[3];
891
+ let o;
892
+ return e[4] !== s ? (o = /* @__PURE__ */ x(Z.Root, { width: "1.5rem", height: "1.5rem", children: [
893
+ s,
894
+ r
895
+ ] }), e[4] = s, e[5] = o) : o = e[5], o;
896
+ }
897
+ function lr(t) {
898
+ const e = y(9), {
899
+ seg: n,
900
+ onOpenFile: s
901
+ } = t, r = n.additions ?? 0, o = n.deletions ?? 0;
902
+ let i;
903
+ e[0] !== s || e[1] !== n.fileName || e[2] !== n.filePath ? (i = () => {
904
+ const d = n.filePath ?? n.fileName;
905
+ s?.(d);
906
+ }, e[0] = s, e[1] = n.fileName, e[2] = n.filePath, e[3] = i) : i = e[3];
907
+ let c;
908
+ return e[4] !== n.fileName || e[5] !== r || e[6] !== o || e[7] !== i ? (c = /* @__PURE__ */ l(Ut, { fileName: n.fileName, additions: r, deletions: o, onClickFileLink: i }), e[4] = n.fileName, e[5] = r, e[6] = o, e[7] = i, e[8] = c) : c = e[8], c;
909
+ }
910
+ function cr(t) {
911
+ const e = y(13), {
912
+ seg: n,
913
+ onOpenFile: s
914
+ } = t, r = n.bold ? "medium" : void 0, o = !!(n.href || n.filePath), i = n.href ?? "#", c = (n.muted, "fg.muted"), d = o ? "pointer" : "default";
915
+ let a;
916
+ e[0] !== s || e[1] !== n ? (a = (m) => dt(m, n, s, !0), e[0] = s, e[1] = n, e[2] = a) : a = e[2];
917
+ const u = n.muted ? "fg.muted" : "fg.blue-dark";
918
+ let f;
919
+ e[3] !== u ? (f = {
920
+ textDecoration: "underline",
921
+ color: u
922
+ }, e[3] = u, e[4] = f) : f = e[4];
923
+ let p;
924
+ return e[5] !== r || e[6] !== n.text || e[7] !== i || e[8] !== c || e[9] !== d || e[10] !== a || e[11] !== f ? (p = /* @__PURE__ */ l(Ve, { href: i, fontWeight: r, color: c, textDecoration: "none", cursor: d, onClick: a, _hover: f, children: n.text }), e[5] = r, e[6] = n.text, e[7] = i, e[8] = c, e[9] = d, e[10] = a, e[11] = f, e[12] = p) : p = e[12], p;
925
+ }
926
+ function ar(t) {
927
+ const e = y(12), {
928
+ seg: n,
929
+ onOpenFile: s
930
+ } = t, r = n.bold ? "medium" : void 0, o = n.href ?? "#", i = n.muted ? "fg.muted" : "accent.primary";
931
+ let c;
932
+ e[0] !== s || e[1] !== n ? (c = (f) => dt(f, n, s), e[0] = s, e[1] = n, e[2] = c) : c = e[2];
933
+ const d = n.muted ? "fg.muted" : "accent.primary";
934
+ let a;
935
+ e[3] !== d ? (a = {
936
+ color: d,
937
+ textDecoration: "underline"
938
+ }, e[3] = d, e[4] = a) : a = e[4];
939
+ let u;
940
+ return e[5] !== r || e[6] !== n.text || e[7] !== o || e[8] !== i || e[9] !== c || e[10] !== a ? (u = /* @__PURE__ */ l(Ve, { href: o, fontWeight: r, color: i, textDecoration: "underline", onClick: c, _hover: a, children: n.text }), e[5] = r, e[6] = n.text, e[7] = o, e[8] = i, e[9] = c, e[10] = a, e[11] = u) : u = e[11], u;
941
+ }
942
+ function dr(t) {
943
+ const e = y(6), {
944
+ seg: n,
945
+ isClickable: s
946
+ } = t, r = n.bold ? "medium" : void 0, o = s && !n.muted ? "fg" : "fg.muted";
947
+ let i;
948
+ e[0] !== o ? (i = {
949
+ color: o
950
+ }, e[0] = o, e[1] = i) : i = e[1];
951
+ let c;
952
+ return e[2] !== n.text || e[3] !== r || e[4] !== i ? (c = /* @__PURE__ */ l(se, { fontWeight: r, color: "fg.muted", _groupHover: i, children: n.text }), e[2] = n.text, e[3] = r, e[4] = i, e[5] = c) : c = e[5], c;
953
+ }
954
+ function ur(t) {
955
+ const e = y(11), {
956
+ seg: n,
957
+ isClickable: s,
958
+ onOpenFile: r
959
+ } = t;
960
+ switch (n.kind) {
961
+ case "avatar": {
962
+ let o;
963
+ return e[0] !== n ? (o = /* @__PURE__ */ l(ir, { seg: n }), e[0] = n, e[1] = o) : o = e[1], o;
964
+ }
965
+ case "diff": {
966
+ let o;
967
+ return e[2] !== r || e[3] !== n ? (o = /* @__PURE__ */ l(lr, { seg: n, onOpenFile: r }), e[2] = r, e[3] = n, e[4] = o) : o = e[4], o;
968
+ }
969
+ case "link": {
970
+ let o;
971
+ return e[5] !== r || e[6] !== n ? (o = n.variant === "bubble" ? /* @__PURE__ */ l(cr, { seg: n, onOpenFile: r }) : /* @__PURE__ */ l(ar, { seg: n, onOpenFile: r }), e[5] = r, e[6] = n, e[7] = o) : o = e[7], o;
972
+ }
973
+ case "text": {
974
+ let o;
975
+ return e[8] !== s || e[9] !== n ? (o = /* @__PURE__ */ l(dr, { seg: n, isClickable: s }), e[8] = s, e[9] = n, e[10] = o) : o = e[10], o;
976
+ }
977
+ default:
978
+ return null;
979
+ }
980
+ }
981
+ function fr(t) {
982
+ const e = y(10), {
983
+ ind: n
984
+ } = t;
985
+ if (!n || n.type === "none")
986
+ return null;
987
+ if (n.type === "icon") {
988
+ let i;
989
+ e[0] !== n.icon ? (i = hn(n.icon), e[0] = n.icon, e[1] = i) : i = e[1];
990
+ const c = i;
991
+ let d;
992
+ return e[2] !== c ? (d = /* @__PURE__ */ l(E.Indicator, { outline: "none", shadow: "none", border: "none", background: "bg", color: "fg", children: /* @__PURE__ */ l(se, { display: "inline-flex", alignItems: "center", children: /* @__PURE__ */ l(c, { size: 14, strokeWidth: 1 }) }) }), e[2] = c, e[3] = d) : d = e[3], d;
993
+ }
994
+ let s;
995
+ e[4] !== n.alt || e[5] !== n.src ? (s = /* @__PURE__ */ l(Z.Image, { src: n.src, alt: n.alt }), e[4] = n.alt, e[5] = n.src, e[6] = s) : s = e[6];
996
+ let r;
997
+ e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ l(Z.Fallback, {}), e[7] = r) : r = e[7];
998
+ let o;
999
+ return e[8] !== s ? (o = /* @__PURE__ */ l(E.Indicator, { children: /* @__PURE__ */ x(Z.Root, { boxSize: "full", children: [
1000
+ s,
1001
+ r
1002
+ ] }) }), e[8] = s, e[9] = o) : o = e[9], o;
1003
+ }
1004
+ function pr(t) {
1005
+ const e = y(5), {
1006
+ code: n,
1007
+ language: s
1008
+ } = t, r = s ? `${s} code block` : "code block";
1009
+ let o;
1010
+ e[0] !== n ? (o = /* @__PURE__ */ l(T, { as: "code", children: n }), e[0] = n, e[1] = o) : o = e[1];
1011
+ let i;
1012
+ return e[2] !== r || e[3] !== o ? (i = /* @__PURE__ */ l(T, { as: "pre", background: "bg.muted", color: "fg", borderRadius: "md", padding: "sm", fontFamily: "mono", fontSize: "xs", lineHeight: "shorter", overflowX: "auto", whiteSpace: "pre", "aria-label": r, children: o }), e[2] = r, e[3] = o, e[4] = i) : i = e[4], i;
1013
+ }
1014
+ function mr(t) {
1015
+ const e = y(26), {
1016
+ b: n,
1017
+ onOpenFile: s
1018
+ } = t;
1019
+ switch (n.type) {
1020
+ case "comment": {
1021
+ let r;
1022
+ e[0] !== n.text ? (r = /* @__PURE__ */ l(M.Body, { children: n.text }), e[0] = n.text, e[1] = r) : r = e[1];
1023
+ let o;
1024
+ e[2] !== n.reactions ? (o = n.reactions?.clap ? /* @__PURE__ */ l(M.Footer, { children: /* @__PURE__ */ x(Ae, { children: [
1025
+ "👏 ",
1026
+ n.reactions.clap
1027
+ ] }) }) : null, e[2] = n.reactions, e[3] = o) : o = e[3];
1028
+ let i;
1029
+ return e[4] !== r || e[5] !== o ? (i = /* @__PURE__ */ x(M.Root, { children: [
1030
+ r,
1031
+ o
1032
+ ] }), e[4] = r, e[5] = o, e[6] = i) : i = e[6], i;
1033
+ }
1034
+ case "code": {
1035
+ let r;
1036
+ return e[7] !== n.code || e[8] !== n.language ? (r = /* @__PURE__ */ l(M.Root, { border: "0", padding: "0", children: /* @__PURE__ */ l(M.Body, { padding: "0", children: /* @__PURE__ */ l(pr, { language: n.language, code: n.code }) }) }), e[7] = n.code, e[8] = n.language, e[9] = r) : r = e[9], r;
1037
+ }
1038
+ case "diff": {
1039
+ const r = n.sideBySide ?? !1;
1040
+ let o;
1041
+ return e[10] !== n.language || e[11] !== n.modified || e[12] !== n.original || e[13] !== r ? (o = /* @__PURE__ */ l(M.Root, { border: "0", padding: "0", children: /* @__PURE__ */ l(M.Body, { padding: "0", children: /* @__PURE__ */ l(T, { height: "240px", minW: "320px", overflow: "hidden", children: /* @__PURE__ */ l(jt, { original: n.original, modified: n.modified, language: n.language, sideBySide: r, disableScroll: !0 }) }) }) }), e[10] = n.language, e[11] = n.modified, e[12] = n.original, e[13] = r, e[14] = o) : o = e[14], o;
1042
+ }
1043
+ case "text": {
1044
+ let r;
1045
+ return e[15] !== n.text ? (r = /* @__PURE__ */ l(M.Root, { background: "transparent", children: /* @__PURE__ */ l(M.Body, { padding: "sm", children: /* @__PURE__ */ l(Q, { textStyle: "label/S/regular", children: n.text }) }) }), e[15] = n.text, e[16] = r) : r = e[16], r;
1046
+ }
1047
+ case "references": {
1048
+ let r;
1049
+ e[17] !== n.references ? (r = n.references.map(hr), e[17] = n.references, e[18] = r) : r = e[18];
1050
+ let o;
1051
+ return e[19] !== r ? (o = /* @__PURE__ */ l(Ke, { mt: "xs", gap: "xs", flexDir: "row", flexWrap: "wrap", children: r }), e[19] = r, e[20] = o) : o = e[20], o;
1052
+ }
1053
+ case "component": {
1054
+ let r;
1055
+ e[21] !== n || e[22] !== s ? (r = n.render({
1056
+ onOpenFile: s
1057
+ }), e[21] = n, e[22] = s, e[23] = r) : r = e[23];
1058
+ let o;
1059
+ return e[24] !== r ? (o = /* @__PURE__ */ l(De, { children: r }), e[24] = r, e[25] = o) : o = e[25], o;
1060
+ }
1061
+ }
1062
+ }
1063
+ function hr(t) {
1064
+ return /* @__PURE__ */ l(Ht, { fileName: t }, t);
1065
+ }
1066
+ function gr(t) {
1067
+ const e = y(22), {
1068
+ item: n,
1069
+ itemKey: s,
1070
+ isOpen: r,
1071
+ canExpand: o,
1072
+ hasBlocks: i,
1073
+ onToggle: c,
1074
+ onOpenFile: d
1075
+ } = t;
1076
+ let a;
1077
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (a = /* @__PURE__ */ l(E.Separator, {}), e[0] = a) : a = e[0];
1078
+ let u;
1079
+ e[1] !== n.indicator ? (u = /* @__PURE__ */ x(E.Connector, { children: [
1080
+ a,
1081
+ /* @__PURE__ */ l(fr, { ind: n.indicator })
1082
+ ] }), e[1] = n.indicator, e[2] = u) : u = e[2];
1083
+ let f;
1084
+ e[3] !== o || e[4] !== r || e[5] !== n.title || e[6] !== s || e[7] !== d || e[8] !== c ? (f = n.title.length > 0 && /* @__PURE__ */ l(E.Title, { className: "group", fontWeight: "normal", display: "flex", alignItems: "center", justifyContent: "space-between", cursor: o ? "pointer" : "default", onClick: o ? () => c(s) : void 0, children: /* @__PURE__ */ x(se, { display: "inline-flex", alignItems: "center", gap: "sm", flexWrap: "wrap", children: [
1085
+ /* @__PURE__ */ l(se, { display: "inline-flex", alignItems: "center", gap: "xs", flexWrap: "wrap", children: n.title.map((g, S) => /* @__PURE__ */ l(ur, { seg: g, isClickable: o, onOpenFile: d }, S)) }),
1086
+ o ? /* @__PURE__ */ l(se, { display: "inline-flex", alignItems: "center", transition: "transform 200ms ease, color 200ms ease", transform: r ? "rotate(0deg)" : "rotate(-180deg)", color: "transparent", _groupHover: {
1087
+ color: "fg"
1088
+ }, children: /* @__PURE__ */ l(Lt, { size: 12 }) }) : null
1089
+ ] }) }), e[3] = o, e[4] = r, e[5] = n.title, e[6] = s, e[7] = d, e[8] = c, e[9] = f) : f = e[9];
1090
+ let p;
1091
+ e[10] !== i || e[11] !== r || e[12] !== n.blocks || e[13] !== d ? (p = i ? /* @__PURE__ */ l(T, { display: "grid", gridTemplateRows: r ? "1fr" : "0fr", transition: "grid-template-rows 220ms ease", children: r ? /* @__PURE__ */ l(T, { overflow: "hidden", opacity: 1, transform: "translateY(0)", transition: "opacity 200ms ease, transform 200ms ease", children: n.blocks.map((g, S) => /* @__PURE__ */ l(T, { children: /* @__PURE__ */ l(mr, { b: g, onOpenFile: d }) }, S)) }) : null }) : null, e[10] = i, e[11] = r, e[12] = n.blocks, e[13] = d, e[14] = p) : p = e[14];
1092
+ let m;
1093
+ e[15] !== f || e[16] !== p ? (m = /* @__PURE__ */ x(E.Content, { pb: "xs", children: [
1094
+ f,
1095
+ p
1096
+ ] }), e[15] = f, e[16] = p, e[17] = m) : m = e[17];
1097
+ let h;
1098
+ return e[18] !== s || e[19] !== u || e[20] !== m ? (h = /* @__PURE__ */ x(E.Item, { gap: "xs", children: [
1099
+ u,
1100
+ m
1101
+ ] }, s), e[18] = s, e[19] = u, e[20] = m, e[21] = h) : h = e[21], h;
1102
+ }
1103
+ function br(t) {
1104
+ const e = y(11), {
1105
+ data: n,
1106
+ onOpenFile: s
1107
+ } = t;
1108
+ let r;
1109
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (r = {}, e[0] = r) : r = e[0];
1110
+ const [o, i] = oe(r), c = xr;
1111
+ let d;
1112
+ e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d = (p) => {
1113
+ i((m) => ({
1114
+ ...m,
1115
+ [p]: !m[p]
1116
+ }));
1117
+ }, e[1] = d) : d = e[1];
1118
+ const a = d;
1119
+ let u;
1120
+ if (e[2] !== n.items || e[3] !== o || e[4] !== s) {
1121
+ let p;
1122
+ e[6] !== o || e[7] !== s ? (p = (m, h) => {
1123
+ const g = c(m, h), S = (m.blocks?.length ?? 0) > 0, k = (m.expandable ?? !0) && S, P = k ? o[g] ?? !1 : S;
1124
+ return /* @__PURE__ */ l(gr, { item: m, itemKey: g, isOpen: P, canExpand: k, hasBlocks: S, onToggle: a, onOpenFile: s }, g);
1125
+ }, e[6] = o, e[7] = s, e[8] = p) : p = e[8], u = n.items.map(p), e[2] = n.items, e[3] = o, e[4] = s, e[5] = u;
1126
+ } else
1127
+ u = e[5];
1128
+ let f;
1129
+ return e[9] !== u ? (f = /* @__PURE__ */ l(E.Root, { children: u }), e[9] = u, e[10] = f) : f = e[10], f;
1130
+ }
1131
+ function xr(t, e) {
1132
+ return t.id ? `id:${t.id}` : `idx:${e}`;
1133
+ }
1134
+ function yr(t) {
1135
+ const e = y(6), {
1136
+ invocations: n,
1137
+ labeledBlocks: s,
1138
+ onOpenFile: r
1139
+ } = t;
1140
+ let o;
1141
+ e[0] !== n || e[1] !== s ? (o = sr(n, {
1142
+ labeledBlocks: s
1143
+ }), e[0] = n, e[1] = s, e[2] = o) : o = e[2];
1144
+ const i = o;
1145
+ let c;
1146
+ return e[3] !== i || e[4] !== r ? (c = /* @__PURE__ */ l(br, { data: i, onOpenFile: r }), e[3] = i, e[4] = r, e[5] = c) : c = e[5], c;
1147
+ }
1148
+ const Sr = (t) => t.type === "tool", Be = (t) => t >= 1e3 ? `${(t / 1e3).toFixed(1)}k` : String(t), kr = (t) => {
1149
+ switch (t) {
1150
+ case "timeout":
1151
+ return "Session timed out.";
1152
+ case "crash":
1153
+ return "Session crashed unexpectedly.";
1154
+ case "permission":
1155
+ return "Permission denied.";
1156
+ default:
1157
+ return "An error occurred.";
1158
+ }
1159
+ }, Tr = (t, e) => {
1160
+ const n = [];
1161
+ let s = e;
1162
+ for (; s < t.length; ) {
1163
+ const r = t[s];
1164
+ if (!Sr(r)) break;
1165
+ n.push(r), s += 1;
1166
+ }
1167
+ return {
1168
+ invocations: n,
1169
+ nextIndex: s - 1
1170
+ };
1171
+ };
1172
+ function wr(t) {
1173
+ const e = y(7), {
1174
+ message: n,
1175
+ onOpenFile: s,
1176
+ toolInvocationTimeline: r
1177
+ } = t, o = r ?? yr;
1178
+ let i;
1179
+ e[0] !== n.parts ? (i = n.parts ?? [], e[0] = n.parts, e[1] = i) : i = e[1];
1180
+ const c = i;
1181
+ let d;
1182
+ if (e[2] !== o || e[3] !== n.id || e[4] !== s || e[5] !== c) {
1183
+ const a = [];
1184
+ for (let u = 0; u < c.length; u = u + 1, u) {
1185
+ const f = c[u], p = `${n.id}-${u}`;
1186
+ e: switch (f.type) {
1187
+ case "text": {
1188
+ a.push(/* @__PURE__ */ l("div", { children: /* @__PURE__ */ l(fn, { children: f.text }) }, p));
1189
+ break e;
1190
+ }
1191
+ case "reasoning": {
1192
+ a.push(/* @__PURE__ */ l(T, { padding: "0", css: {
1193
+ "& .rich-text, & .rich-text *": {
1194
+ color: "fg.subtle !important",
1195
+ fontSize: ".75rem !important",
1196
+ fontWeight: "normal !important"
1197
+ }
1198
+ }, children: /* @__PURE__ */ l(Ze, { defaultState: f.text }) }, p));
1199
+ break e;
1200
+ }
1201
+ case "tool": {
1202
+ const {
1203
+ invocations: m,
1204
+ nextIndex: h
1205
+ } = Tr(c, u);
1206
+ u = h, a.push(/* @__PURE__ */ l(T, { width: "full", children: /* @__PURE__ */ l(o, { invocations: m, labeledBlocks: !0, onOpenFile: s }) }, p));
1207
+ break e;
1208
+ }
1209
+ case "loading": {
1210
+ a.push(/* @__PURE__ */ x(T, { display: "flex", alignItems: "center", gap: "2", py: "2", children: [
1211
+ /* @__PURE__ */ l(yt, { size: "sm" }),
1212
+ /* @__PURE__ */ l(Q, { fontSize: "sm", color: "fg.muted", children: "Thinking..." })
1213
+ ] }, p));
1214
+ break e;
1215
+ }
1216
+ case "error": {
1217
+ a.push(/* @__PURE__ */ l(T, { py: "2", children: /* @__PURE__ */ l(Q, { fontSize: "sm", color: "fg.error", children: kr(f.errorType) }) }, p));
1218
+ break e;
1219
+ }
1220
+ case "token_usage": {
1221
+ a.push(/* @__PURE__ */ l(T, { py: "1", children: /* @__PURE__ */ x(Q, { fontSize: "xs", color: "fg.subtle", children: [
1222
+ "Tokens: ",
1223
+ Be(f.inputTokens),
1224
+ " in / ",
1225
+ Be(f.outputTokens),
1226
+ " out",
1227
+ f.cacheReadTokens ? ` / ${Be(f.cacheReadTokens)} cache read` : ""
1228
+ ] }) }, p));
1229
+ break e;
1230
+ }
1231
+ default:
1232
+ a.push(null);
1233
+ }
1234
+ }
1235
+ d = /* @__PURE__ */ l(De, { children: a }), e[2] = o, e[3] = n.id, e[4] = s, e[5] = c, e[6] = d;
1236
+ } else
1237
+ d = e[6];
1238
+ return d;
1239
+ }
1240
+ const Cr = (t) => t === "user" || t === "assistant" || t === "developer" ? t : "assistant", Pr = (t) => {
1241
+ const e = t.parts ?? [];
1242
+ return e.length === 0 || e.some((s) => s.type === "text" && "text" in s) ? !1 : e.some((s) => s.type === "reasoning" || s.type === "tool");
1243
+ }, _r = (t) => {
1244
+ const e = [];
1245
+ for (const n of t) {
1246
+ const s = e[e.length - 1];
1247
+ if (s && s.role === n.role && Pr(n)) {
1248
+ s.parts = [...s.parts ?? [], ...n.parts ?? []];
1249
+ continue;
1250
+ }
1251
+ e.push({
1252
+ ...n,
1253
+ parts: [...n.parts ?? []]
1254
+ });
1255
+ }
1256
+ return e;
1257
+ }, Rr = dn(), co = (t) => {
1258
+ const e = y(43), {
1259
+ messages: n,
1260
+ streaming: s,
1261
+ emptyStateTitle: r,
1262
+ emptyStateDescription: o,
1263
+ chatInputPlaceholder: i,
1264
+ onSubmitMessage: c,
1265
+ actions: d,
1266
+ repoMenu: a,
1267
+ attachedResources: u,
1268
+ onClearAttachments: f,
1269
+ attachmentList: p,
1270
+ approvalPrompt: m
1271
+ } = t, h = s === void 0 ? !1 : s;
1272
+ let g, S, k, P, D, B, v, A, F, _;
1273
+ if (e[0] !== o || e[1] !== r || e[2] !== n || e[3] !== h) {
1274
+ const N = _r(n), H = N.length > 0, ye = N.reduce(Ir, 0);
1275
+ k = pe, B = "relative", v = "column", A = "full", F = "full", _ = "hidden", S = Ie.Root, D = /* @__PURE__ */ l(rn, { userMessageCount: ye }), g = Ie.Viewport, P = H ? /* @__PURE__ */ l(Ke, { gap: "sm", children: N.map((L) => {
1276
+ const j = Cr(L.role);
1277
+ return /* @__PURE__ */ l(Oe.Root, { from: j, children: /* @__PURE__ */ l(Oe.Content, { from: j, children: /* @__PURE__ */ l(wr, { message: L, streaming: h }) }) }, L.id);
1278
+ }) }) : /* @__PURE__ */ l(qt, { icon: /* @__PURE__ */ l(Et, { size: 48, strokeWidth: 1.5 }), title: r, description: o }), e[0] = o, e[1] = r, e[2] = n, e[3] = h, e[4] = g, e[5] = S, e[6] = k, e[7] = P, e[8] = D, e[9] = B, e[10] = v, e[11] = A, e[12] = F, e[13] = _;
1279
+ } else
1280
+ g = e[4], S = e[5], k = e[6], P = e[7], D = e[8], B = e[9], v = e[10], A = e[11], F = e[12], _ = e[13];
1281
+ let C;
1282
+ e[14] !== g || e[15] !== P ? (C = /* @__PURE__ */ l(g, { children: P }), e[14] = g, e[15] = P, e[16] = C) : C = e[16];
1283
+ let O;
1284
+ e[17] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (O = /* @__PURE__ */ l(Ie.ScrollToBottom, { "aria-label": "Scroll to latest message" }), e[17] = O) : O = e[17];
1285
+ let $;
1286
+ e[18] !== S || e[19] !== D || e[20] !== C ? ($ = /* @__PURE__ */ x(S, { children: [
1287
+ D,
1288
+ C,
1289
+ O
1290
+ ] }), e[18] = S, e[19] = D, e[20] = C, e[21] = $) : $ = e[21];
306
1291
  let R;
307
- t[29] !== Y || t[30] !== V || t[31] !== v || t[32] !== X || t[33] !== tt || t[34] !== w ? (R = /* @__PURE__ */ l(Pt, { defaultState: V, isEditable: tt, placeholder: X, onChange: w, onSubmit: v }, Y), t[29] = Y, t[30] = V, t[31] = v, t[32] = X, t[33] = tt, t[34] = w, t[35] = R) : R = t[35];
308
- let L;
309
- t[36] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (L = /* @__PURE__ */ l(vt, {}), t[36] = L) : L = t[36];
310
- const et = S ? "Stop Response" : "Message Sending", ot = s ? void 0 : "Enter";
311
- let _;
312
- t[37] !== S || t[38] !== g || t[39] !== s || t[40] !== C ? (_ = s && !S || !s && !C.trim() || g, t[37] = S, t[38] = g, t[39] = s, t[40] = C, t[41] = _) : _ = t[41];
1292
+ e[22] !== d || e[23] !== u || e[24] !== p || e[25] !== i || e[26] !== f || e[27] !== c || e[28] !== h ? (R = /* @__PURE__ */ l(T, { px: "sm", children: /* @__PURE__ */ l(sn, { placeholder: i, defaultState: Rr, streaming: h, onSubmit: c, actions: d, attachedResources: u, onClearAttachments: f, attachmentList: p }) }), e[22] = d, e[23] = u, e[24] = p, e[25] = i, e[26] = f, e[27] = c, e[28] = h, e[29] = R) : R = e[29];
1293
+ let I;
1294
+ e[30] !== a ? (I = /* @__PURE__ */ l(pe, { p: "2xs", justifyContent: "flex-end", children: a }), e[30] = a, e[31] = I) : I = e[31];
313
1295
  let z;
314
- t[42] !== S || t[43] !== v || t[44] !== et || t[45] !== ot || t[46] !== _ ? (z = /* @__PURE__ */ l(qt, { canInterrupt: S, title: et, shortcut: ot, onClick: v, disabled: _ }), t[42] = S, t[43] = v, t[44] = et, t[45] = ot, t[46] = _, t[47] = z) : z = t[47];
315
- let B;
316
- t[48] !== b || t[49] !== z ? (B = /* @__PURE__ */ K(yt, { gap: "1", mt: "md", children: [
317
- b,
318
- L,
319
- z
320
- ] }), t[48] = b, t[49] = z, t[50] = B) : B = t[50];
321
- let T;
322
- t[51] !== h || t[52] !== R || t[53] !== B ? (T = /* @__PURE__ */ K(wt, { direction: "column", color: "fg", children: [
323
- h,
1296
+ return e[32] !== k || e[33] !== m || e[34] !== $ || e[35] !== R || e[36] !== I || e[37] !== B || e[38] !== v || e[39] !== A || e[40] !== F || e[41] !== _ ? (z = /* @__PURE__ */ x(k, { position: B, direction: v, w: A, h: F, overflow: _, children: [
1297
+ $,
1298
+ m,
324
1299
  R,
325
- B
326
- ] }), t[51] = h, t[52] = R, t[53] = B, t[54] = T) : T = t[54];
327
- let W;
328
- return t[55] !== G || t[56] !== Q || t[57] !== y || t[58] !== T ? (W = /* @__PURE__ */ l(Rt, { ref: lt, width: "100%", paddingX: "lg", paddingY: "md", bg: "bg", borderRadius: "md", borderWidth: "1px", borderStyle: "solid", borderColor: G, boxShadow: Q, transition: "box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out", _hover: y, _focusWithin: j, onClick: pt, onBlur: F, children: T }), t[55] = G, t[56] = Q, t[57] = y, t[58] = T, t[59] = W) : W = t[59], W;
1300
+ I
1301
+ ] }), e[32] = k, e[33] = m, e[34] = $, e[35] = R, e[36] = I, e[37] = B, e[38] = v, e[39] = A, e[40] = F, e[41] = _, e[42] = z) : z = e[42], z;
329
1302
  };
330
- function Kt() {
331
- }
332
- function Nt(n) {
333
- return n + 1;
334
- }
335
- function Ut(n) {
336
- return n + 1;
1303
+ function Ir(t, e) {
1304
+ return t + (e.role === "user" ? 1 : 0);
337
1305
  }
338
- const _e = (n = "") => JSON.stringify(Et(n));
339
1306
  export {
340
- we as AutoScroll,
341
- Re as ChatInput,
342
- ve as ChatMessage,
343
- ye as ChatPrimitives,
344
- qt as SendButton,
345
- _e as createSerializedPromptState
1307
+ lo as ApprovalPrompt,
1308
+ rn as AutoScroll,
1309
+ sn as ChatInput,
1310
+ Oe as ChatMessage,
1311
+ co as ChatPanel,
1312
+ Ie as ChatPrimitives,
1313
+ on as SendButton,
1314
+ dn as createSerializedPromptState
346
1315
  };
347
1316
  //# sourceMappingURL=chat-ui.js.map