@pstdio/ui 0.43.1 → 0.44.0-nightly.20261016075735
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.
- package/dist/{MermaidComponent-_cmVeKKR.js → MermaidComponent-b-SNuwm6.js} +2 -2
- package/dist/{MermaidComponent-_cmVeKKR.js.map → MermaidComponent-b-SNuwm6.js.map} +1 -1
- package/dist/chat-ui.d.ts +2 -4
- package/dist/chat-ui.js +956 -920
- package/dist/chat-ui.js.map +1 -1
- package/dist/{collection-view-fields-B3fhsgn7.d.ts → collection-view-fields-Sa5HO5P7.d.ts} +2 -0
- package/dist/{collection-view-grouping-jIqOrBG8.js → collection-view-grouping-aKZhxYfX.js} +2 -2
- package/dist/{collection-view-grouping-jIqOrBG8.js.map → collection-view-grouping-aKZhxYfX.js.map} +1 -1
- package/dist/{collection-view-search-KbQpKHdn.js → collection-view-search-mHPkdyxT.js} +70 -70
- package/dist/collection-view-search-mHPkdyxT.js.map +1 -0
- package/dist/collection-view.d.ts +3 -90
- package/dist/collection-view.js +1 -1
- package/dist/data-table-stat-chart-content-waJAm_nt.js +125 -0
- package/dist/data-table-stat-chart-content-waJAm_nt.js.map +1 -0
- package/dist/data-table.d.ts +3 -2
- package/dist/data-table.js +701 -400
- package/dist/data-table.js.map +1 -1
- package/dist/diff.js +1 -1
- package/dist/{display-sort-control-BCkgKET1.js → display-sort-control-0_gG-W9g.js} +58 -59
- package/dist/display-sort-control-0_gG-W9g.js.map +1 -0
- package/dist/{edit-mode-data-table-ScVJJT9F.js → edit-mode-data-table-BhJa4Z76.js} +4 -4
- package/dist/{edit-mode-data-table-ScVJJT9F.js.map → edit-mode-data-table-BhJa4Z76.js.map} +1 -1
- package/dist/index-BoDmVqmq.d.ts +91 -0
- package/dist/{index-DXpADqIg.d.ts → index-CLxCZUKu.d.ts} +13 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +56 -41
- package/dist/index.js.map +1 -1
- package/dist/kanban-renderer.d.ts +3 -3
- package/dist/kanban-renderer.js +269 -269
- package/dist/kanban-renderer.js.map +1 -1
- package/dist/{markdown-editor-Dm4Fi3sX.js → markdown-editor-hLUXSAns.js} +4 -4
- package/dist/{markdown-editor-Dm4Fi3sX.js.map → markdown-editor-hLUXSAns.js.map} +1 -1
- package/dist/{param-editor-B9ASM5Lv.js → param-editor-3B1GmtMi.js} +2 -2
- package/dist/{param-editor-B9ASM5Lv.js.map → param-editor-3B1GmtMi.js.map} +1 -1
- package/dist/{param-editor-field-BmNUziwI.js → param-editor-field-ZdF0maaH.js} +2 -2
- package/dist/{param-editor-field-BmNUziwI.js.map → param-editor-field-ZdF0maaH.js.map} +1 -1
- package/dist/param-editor.js +2 -2
- package/dist/{rich-text-Dx5F8Zm1.js → rich-text-tfMib9o3.js} +394 -340
- package/dist/rich-text-tfMib9o3.js.map +1 -0
- package/dist/rich-text.js +3 -3
- package/dist/terminal.js +1 -1
- package/dist/{theme-CWDvF5Yn.js → theme-O8cKWJIk.js} +5 -16
- package/dist/theme-O8cKWJIk.js.map +1 -0
- package/dist/theme.js +1 -1
- package/package.json +2 -2
- package/dist/collection-view-search-KbQpKHdn.js.map +0 -1
- package/dist/data-table-stats-row-83mX8b1B.js +0 -415
- package/dist/data-table-stats-row-83mX8b1B.js.map +0 -1
- package/dist/display-sort-control-BCkgKET1.js.map +0 -1
- package/dist/rich-text-Dx5F8Zm1.js.map +0 -1
- package/dist/theme-CWDvF5Yn.js.map +0 -1
package/dist/chat-ui.js
CHANGED
|
@@ -8,17 +8,50 @@ import { t as c } from "./empty-state-3mVV_pV-.js";
|
|
|
8
8
|
import { t as l } from "./icon-options-Tt6Wzhtv.js";
|
|
9
9
|
import { n as u, t as d } from "./radio-CiFrDN6O.js";
|
|
10
10
|
import { n as f, t as p } from "./queued-follow-up-Bj_vtMgd.js";
|
|
11
|
-
import { A as m, C as h, E as g, M as _, S as v, T as y, j as b, k as x, w as S } from "./markdown-editor-
|
|
12
|
-
import { c as C, l as w, o as T, s as E } from "./rich-text-
|
|
11
|
+
import { A as m, C as h, E as g, M as _, S as v, T as y, j as b, k as x, w as S } from "./markdown-editor-hLUXSAns.js";
|
|
12
|
+
import { c as C, l as w, o as T, s as E } from "./rich-text-tfMib9o3.js";
|
|
13
13
|
import { t as D } from "./diff-bubble-DewUd_2w.js";
|
|
14
|
-
import { AbsoluteCenter as O, Avatar as k, Box as A, Button as j, Card as M, Code as N, Field as P, Flex as F, HStack as I, Icon as L, IconButton as
|
|
14
|
+
import { AbsoluteCenter as O, Avatar as k, Box as A, Button as j, Card as M, Code as N, Field as P, Flex as F, HStack as I, Icon as L, IconButton as R, Image as z, Input as ee, Kbd as B, Link as te, Menu as V, Popover as ne, Portal as H, Skeleton as re, Span as U, Spinner as ie, Stack as W, Tag as ae, Text as G, Textarea as oe, Timeline as se, Tooltip as ce, chakra as K, createSlotRecipeContext as le, defineSlotRecipe as ue, useRecipe as de, useSlotRecipe as fe } from "@chakra-ui/react";
|
|
15
15
|
import { c as q } from "react/compiler-runtime";
|
|
16
16
|
import { Fragment as pe, jsx as J, jsxs as Y } from "react/jsx-runtime";
|
|
17
17
|
import { Fragment as me, Suspense as he, createContext as ge, lazy as _e, useContext as ve, useEffect as X, useLayoutEffect as ye, useRef as Z, useState as Q } from "react";
|
|
18
18
|
import { AlertTriangle as be, ArrowDownIcon as xe, ArrowRight as Se, ArrowUp as Ce, Check as we, ChevronUpIcon as Te, CircleQuestionMark as Ee, Copy as De, DotIcon as Oe, File as ke, FileDiff as Ae, FileDown as je, FilePen as Me, FileText as Ne, FileUp as Pe, Globe as Fe, GripVertical as Ie, ListTodo as Le, ListTree as Re, MessageCircleIcon as ze, Move as Be, Pause as Ve, Search as He, ShieldCheck as Ue, ShieldX as We, Terminal as Ge, Trash2 as Ke } from "lucide-react";
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
|
|
19
|
+
import { defaultRangeExtractor as qe } from "@tanstack/react-virtual";
|
|
20
|
+
import { DndContext as Je, KeyboardSensor as Ye, PointerSensor as Xe, pointerWithin as Ze, rectIntersection as Qe, useDraggable as $e, useDroppable as et, useSensor as tt, useSensors as nt } from "@dnd-kit/core";
|
|
21
|
+
import { StickToBottom as rt, useStickToBottomContext as it } from "use-stick-to-bottom";
|
|
22
|
+
//#region src/components/chat-ui/components/use-conversation-visibility.ts
|
|
23
|
+
var at = () => {
|
|
24
|
+
let e = q(5), { scrollRef: t, stopScroll: n, scrollToBottom: r } = it(), i, a;
|
|
25
|
+
e[0] !== t || e[1] !== r || e[2] !== n ? (i = () => {
|
|
26
|
+
let e = t.current;
|
|
27
|
+
if (!e) return;
|
|
28
|
+
let i = !1, a = {
|
|
29
|
+
top: e.scrollTop,
|
|
30
|
+
atTail: !0
|
|
31
|
+
}, o = 0, s = () => {
|
|
32
|
+
i || e.getClientRects().length === 0 || (a = {
|
|
33
|
+
top: e.scrollTop,
|
|
34
|
+
atTail: e.scrollHeight - e.clientHeight - e.scrollTop < 3
|
|
35
|
+
});
|
|
36
|
+
}, c = new ResizeObserver(() => {
|
|
37
|
+
if (e.getClientRects().length === 0) i = !0, n();
|
|
38
|
+
else if (i) {
|
|
39
|
+
i = !1;
|
|
40
|
+
let t = a;
|
|
41
|
+
n(), e.scrollTop = t.top, o = requestAnimationFrame(() => {
|
|
42
|
+
t.atTail ? r("instant") : e.scrollTop = t.top;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return e.addEventListener("scroll", s), c.observe(e), () => {
|
|
47
|
+
cancelAnimationFrame(o), c.disconnect(), e.removeEventListener("scroll", s);
|
|
48
|
+
};
|
|
49
|
+
}, a = [
|
|
50
|
+
t,
|
|
51
|
+
n,
|
|
52
|
+
r
|
|
53
|
+
], e[0] = t, e[1] = r, e[2] = n, e[3] = i, e[4] = a) : (i = e[3], a = e[4]), ye(i, a);
|
|
54
|
+
}, ot = K(rt, { base: {
|
|
22
55
|
position: "relative",
|
|
23
56
|
flex: 1,
|
|
24
57
|
overflow: "hidden",
|
|
@@ -31,10 +64,12 @@ var it = K(nt, { base: {
|
|
|
31
64
|
resize: "instant",
|
|
32
65
|
role: "log"
|
|
33
66
|
}
|
|
34
|
-
}),
|
|
67
|
+
}), st = (e) => {
|
|
35
68
|
let t = q(10), r, i;
|
|
36
69
|
t[0] === e ? (r = t[1], i = t[2]) : ({children: r, ...i} = e, t[0] = e, t[1] = r, t[2] = i);
|
|
37
|
-
let { contentRef: a, scrollRef: o } =
|
|
70
|
+
let { contentRef: a, scrollRef: o } = it();
|
|
71
|
+
at();
|
|
72
|
+
let s = o, c = a, l, u;
|
|
38
73
|
t[3] === Symbol.for("react.memo_cache_sentinel") ? (l = { zIndex: 2 }, u = {
|
|
39
74
|
layerStyle: "chatContent",
|
|
40
75
|
py: "sm",
|
|
@@ -53,18 +88,18 @@ var it = K(nt, { base: {
|
|
|
53
88
|
contentProps: u,
|
|
54
89
|
children: r
|
|
55
90
|
}), t[5] = r, t[6] = i, t[7] = s, t[8] = c, t[9] = d) : d = t[9], d;
|
|
56
|
-
},
|
|
91
|
+
}, ct = {
|
|
57
92
|
axis: "horizontal",
|
|
58
93
|
bottom: "md",
|
|
59
94
|
zIndex: 2
|
|
60
|
-
},
|
|
61
|
-
Root:
|
|
62
|
-
Viewport:
|
|
95
|
+
}, lt = {
|
|
96
|
+
Root: ot,
|
|
97
|
+
Viewport: st,
|
|
63
98
|
ScrollToBottom: (e) => {
|
|
64
|
-
let t = q(4), { isAtBottom: n, scrollToBottom: r } =
|
|
99
|
+
let t = q(4), { isAtBottom: n, scrollToBottom: r } = it(), i;
|
|
65
100
|
return t[0] !== n || t[1] !== e || t[2] !== r ? (i = !n && /* @__PURE__ */ J(O, {
|
|
66
|
-
...
|
|
67
|
-
children: /* @__PURE__ */ J(
|
|
101
|
+
...ct,
|
|
102
|
+
children: /* @__PURE__ */ J(R, {
|
|
68
103
|
rounded: "full",
|
|
69
104
|
onClick: () => r(),
|
|
70
105
|
variant: "outline",
|
|
@@ -74,7 +109,7 @@ var it = K(nt, { base: {
|
|
|
74
109
|
})
|
|
75
110
|
}), t[0] = n, t[1] = e, t[2] = r, t[3] = i) : i = t[3], i;
|
|
76
111
|
}
|
|
77
|
-
},
|
|
112
|
+
}, ut = ue({
|
|
78
113
|
className: "ai-message",
|
|
79
114
|
slots: ["root", "content"],
|
|
80
115
|
base: {
|
|
@@ -157,16 +192,16 @@ var it = K(nt, { base: {
|
|
|
157
192
|
shape: "rounded",
|
|
158
193
|
delivery: "sent"
|
|
159
194
|
}
|
|
160
|
-
}), { withProvider:
|
|
161
|
-
Root:
|
|
162
|
-
Content:
|
|
163
|
-
},
|
|
195
|
+
}), { withProvider: dt, withContext: ft } = le({ recipe: ut }), pt = {
|
|
196
|
+
Root: dt("div", "root"),
|
|
197
|
+
Content: ft("div", "content")
|
|
198
|
+
}, mt = (e) => {
|
|
164
199
|
if (e == null) return null;
|
|
165
200
|
let t = typeof e == "string" ? e : JSON.stringify(e, null, 2);
|
|
166
201
|
return t.length === 0 ? null : t.length > 200 ? `${t.slice(0, 200)}...` : t;
|
|
167
|
-
},
|
|
202
|
+
}, ht = (e) => {
|
|
168
203
|
let t = q(19), { toolName: r, toolInput: i, onApprove: a, onDeny: o } = e, s;
|
|
169
|
-
t[0] === i ? s = t[1] : (s =
|
|
204
|
+
t[0] === i ? s = t[1] : (s = mt(i), t[0] = i, t[1] = s);
|
|
170
205
|
let c = s, l;
|
|
171
206
|
t[2] === r ? l = t[3] : (l = /* @__PURE__ */ Y(G, {
|
|
172
207
|
textStyle: "label/S/medium",
|
|
@@ -234,10 +269,10 @@ var it = K(nt, { base: {
|
|
|
234
269
|
]
|
|
235
270
|
})
|
|
236
271
|
}), t[15] = l, t[16] = u, t[17] = h, t[18] = g) : g = t[18], g;
|
|
237
|
-
},
|
|
272
|
+
}, gt = "md", _t = "neutral", vt = (e) => {
|
|
238
273
|
let t = q(17), { attachments: n, onSelect: r, onRemove: i, renderBadge: a, size: s, tone: c } = e, l;
|
|
239
274
|
t[0] === n ? l = t[1] : (l = n === void 0 ? [] : n, t[0] = n, t[1] = l);
|
|
240
|
-
let u = l, d = s === void 0 ?
|
|
275
|
+
let u = l, d = s === void 0 ? gt : s, f = c === void 0 ? _t : c;
|
|
241
276
|
if (u.length === 0) return null;
|
|
242
277
|
let p;
|
|
243
278
|
if (t[2] !== u || t[3] !== i || t[4] !== r || t[5] !== a || t[6] !== d || t[7] !== f) {
|
|
@@ -271,13 +306,13 @@ var it = K(nt, { base: {
|
|
|
271
306
|
flexWrap: "wrap",
|
|
272
307
|
children: p
|
|
273
308
|
}), t[15] = p, t[16] = m), m;
|
|
274
|
-
},
|
|
309
|
+
}, yt = (e) => {
|
|
275
310
|
let { previousUserMessageCount: t, userMessageCount: n } = e;
|
|
276
311
|
return t !== 0 && n > t;
|
|
277
|
-
},
|
|
312
|
+
}, bt = (e) => {
|
|
278
313
|
let t = e.conversationKey ?? null;
|
|
279
314
|
return e.state.conversationKey === t ? {
|
|
280
|
-
shouldScroll:
|
|
315
|
+
shouldScroll: yt({
|
|
281
316
|
previousUserMessageCount: e.state.userMessageCount,
|
|
282
317
|
userMessageCount: e.userMessageCount
|
|
283
318
|
}),
|
|
@@ -292,19 +327,19 @@ var it = K(nt, { base: {
|
|
|
292
327
|
userMessageCount: e.userMessageCount
|
|
293
328
|
}
|
|
294
329
|
};
|
|
295
|
-
},
|
|
296
|
-
let t =
|
|
330
|
+
}, xt = (e) => {
|
|
331
|
+
let t = bt(e);
|
|
297
332
|
return t.shouldScroll && e.scrollToBottom("instant"), t;
|
|
298
333
|
};
|
|
299
|
-
function
|
|
300
|
-
let t = q(8), { conversationKey: n, userMessageCount: r } = e, { scrollToBottom: i } =
|
|
334
|
+
function St(e) {
|
|
335
|
+
let t = q(8), { conversationKey: n, userMessageCount: r } = e, { scrollToBottom: i } = it(), a = n ?? null, o;
|
|
301
336
|
t[0] !== a || t[1] !== r ? (o = {
|
|
302
337
|
conversationKey: a,
|
|
303
338
|
userMessageCount: r
|
|
304
339
|
}, t[0] = a, t[1] = r, t[2] = o) : o = t[2];
|
|
305
340
|
let s = Z(o), c, l;
|
|
306
341
|
return t[3] !== n || t[4] !== i || t[5] !== r ? (c = () => {
|
|
307
|
-
let e =
|
|
342
|
+
let e = xt({
|
|
308
343
|
state: s.current,
|
|
309
344
|
conversationKey: n,
|
|
310
345
|
userMessageCount: r,
|
|
@@ -318,14 +353,43 @@ function bt(e) {
|
|
|
318
353
|
], t[3] = n, t[4] = i, t[5] = r, t[6] = c, t[7] = l) : (c = t[6], l = t[7]), X(c, l), null;
|
|
319
354
|
}
|
|
320
355
|
//#endregion
|
|
321
|
-
//#region src/
|
|
322
|
-
var
|
|
356
|
+
//#region src/theme/recipes/chat-composer.ts
|
|
357
|
+
var Ct = ue({
|
|
358
|
+
className: "ps-chat-composer",
|
|
359
|
+
slots: ["input", "workspace"],
|
|
360
|
+
base: {
|
|
361
|
+
input: {
|
|
362
|
+
position: "relative",
|
|
363
|
+
width: "full",
|
|
364
|
+
padding: "xs",
|
|
365
|
+
bg: "bg",
|
|
366
|
+
borderRadius: "xs",
|
|
367
|
+
_focusWithin: {
|
|
368
|
+
outline: "{borders.accent-light}",
|
|
369
|
+
outlineOffset: "-1px"
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
workspace: {
|
|
373
|
+
display: "flex",
|
|
374
|
+
flexDirection: "column",
|
|
375
|
+
gap: "0"
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
variants: {
|
|
379
|
+
attachedToTop: { true: { input: { borderTopRadius: "0" } } },
|
|
380
|
+
workspace: { true: { workspace: {
|
|
381
|
+
padding: "2xs",
|
|
382
|
+
borderRadius: "xs",
|
|
383
|
+
bg: "bg.muted"
|
|
384
|
+
} } }
|
|
385
|
+
}
|
|
386
|
+
}), wt = (e = "") => JSON.stringify(C(e)), Tt = (e) => e.trim().length > 0, Et = (e) => {
|
|
323
387
|
let { canSubmit: t, isDisabled: n, text: r } = e;
|
|
324
|
-
return n || !t || !
|
|
325
|
-
},
|
|
388
|
+
return n || !t || !Tt(r) ? "none" : "submit";
|
|
389
|
+
}, Dt = (e) => {
|
|
326
390
|
let { canInterrupt: t, canSubmit: n, hasQuestionPrompt: r, isDisabled: i, streaming: a, text: o } = e;
|
|
327
|
-
return i ? "none" : n &&
|
|
328
|
-
},
|
|
391
|
+
return i ? "none" : n && Tt(o) ? "submit" : a && !r && t ? "interrupt" : "none";
|
|
392
|
+
}, Ot = (e, t = 200) => e.length > 0 && e.split(/\r\n|\r|\n/).length > t, kt = (e) => {
|
|
329
393
|
let { onAttachFiles: t, onAttachText: n, textAttachmentPasteLineThreshold: r } = e;
|
|
330
394
|
return {
|
|
331
395
|
onDragOver: (e) => {
|
|
@@ -342,10 +406,10 @@ var xt = (e = "") => JSON.stringify(C(e)), St = (e) => e.trim().length > 0, Ct =
|
|
|
342
406
|
return;
|
|
343
407
|
}
|
|
344
408
|
let a = e.clipboardData.getData("text/plain");
|
|
345
|
-
n &&
|
|
409
|
+
n && Ot(a, r) && (e.preventDefault(), n(a));
|
|
346
410
|
}
|
|
347
411
|
};
|
|
348
|
-
},
|
|
412
|
+
}, At = (e) => {
|
|
349
413
|
let t = q(22), n, r, i, a;
|
|
350
414
|
t[0] === e ? (n = t[1], r = t[2], i = t[3], a = t[4]) : ({title: a, shortcut: i, canInterrupt: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r, t[3] = i, t[4] = a);
|
|
351
415
|
let o = r["aria-label"] ?? a, s;
|
|
@@ -358,7 +422,7 @@ var xt = (e = "") => JSON.stringify(C(e)), St = (e) => e.trim().length > 0, Ct =
|
|
|
358
422
|
strokeWidth: 2
|
|
359
423
|
}), t[5] = n, t[6] = s);
|
|
360
424
|
let c = s, l;
|
|
361
|
-
t[7] !== o || t[8] !== c || t[9] !== r || t[10] !== a ? (l = /* @__PURE__ */ J(
|
|
425
|
+
t[7] !== o || t[8] !== c || t[9] !== r || t[10] !== a ? (l = /* @__PURE__ */ J(R, {
|
|
362
426
|
"data-testid": "send-message-button",
|
|
363
427
|
size: "xs",
|
|
364
428
|
variant: "primary",
|
|
@@ -384,7 +448,7 @@ var xt = (e = "") => JSON.stringify(C(e)), St = (e) => e.trim().length > 0, Ct =
|
|
|
384
448
|
children: u
|
|
385
449
|
}), t[15] = u, t[16] = r);
|
|
386
450
|
let o;
|
|
387
|
-
t[17] === n ? o = t[18] : (o = /* @__PURE__ */ J(
|
|
451
|
+
t[17] === n ? o = t[18] : (o = /* @__PURE__ */ J(H, { children: /* @__PURE__ */ J(ce.Positioner, { children: /* @__PURE__ */ J(ce.Content, { children: n }) }) }), t[17] = n, t[18] = o);
|
|
388
452
|
let s;
|
|
389
453
|
return t[19] !== r || t[20] !== o ? (s = /* @__PURE__ */ Y(ce.Root, {
|
|
390
454
|
closeDelay: 50,
|
|
@@ -393,7 +457,7 @@ var xt = (e = "") => JSON.stringify(C(e)), St = (e) => e.trim().length > 0, Ct =
|
|
|
393
457
|
}), t[19] = r, t[20] = o, t[21] = s) : s = t[21], s;
|
|
394
458
|
}
|
|
395
459
|
return u;
|
|
396
|
-
},
|
|
460
|
+
}, jt = (e) => {
|
|
397
461
|
let t = q(18), { actions: r, submitActions: i, questionPrompt: a, skipDisabled: o, skipTitle: s, onSkip: c, buttonAction: l, submitTitle: u, submitLabel: d, messageTitle: f, runAction: p } = e, m;
|
|
398
462
|
t[0] === r ? m = t[1] : (m = /* @__PURE__ */ J(n, {
|
|
399
463
|
flex: "1",
|
|
@@ -423,7 +487,7 @@ var xt = (e = "") => JSON.stringify(C(e)), St = (e) => e.trim().length > 0, Ct =
|
|
|
423
487
|
disabled: l === "none",
|
|
424
488
|
onClick: () => p(l),
|
|
425
489
|
children: d
|
|
426
|
-
}) : /* @__PURE__ */ J(
|
|
490
|
+
}) : /* @__PURE__ */ J(At, {
|
|
427
491
|
canInterrupt: l === "interrupt",
|
|
428
492
|
title: l === "interrupt" ? "Stop Response" : u ?? f,
|
|
429
493
|
shortcut: l === "submit" ? "Enter" : void 0,
|
|
@@ -442,19 +506,19 @@ var xt = (e = "") => JSON.stringify(C(e)), St = (e) => e.trim().length > 0, Ct =
|
|
|
442
506
|
g
|
|
443
507
|
]
|
|
444
508
|
}), t[13] = i, t[14] = m, t[15] = h, t[16] = g, t[17] = _) : _ = t[17], _;
|
|
445
|
-
},
|
|
509
|
+
}, Mt = async (e) => {
|
|
446
510
|
await e.onSubmit(e.text, e.response ? [] : e.attachments, e.response), e.response || e.onClearAttachments?.();
|
|
447
|
-
},
|
|
448
|
-
let { [
|
|
511
|
+
}, Nt = "Other", Pt = "__pstdio_other__", Ft = (e, t) => Object.hasOwn(e, t) ? e[t] : void 0, It = (e) => !!e.allowCustomAnswer && e.options.length > 0, Lt = (e, t) => e.id ?? `question-${t}`, Rt = (e, t, n) => Object.hasOwn(e, Lt(t, n)), zt = (e, t, n) => {
|
|
512
|
+
let { [Lt(t, n)]: r, ...i } = e;
|
|
449
513
|
return i;
|
|
450
|
-
},
|
|
514
|
+
}, Bt = (e, t, n) => Rt(e, t, n) ? zt(e, t, n) : {
|
|
451
515
|
...e,
|
|
452
|
-
[
|
|
453
|
-
},
|
|
516
|
+
[Lt(t, n)]: ""
|
|
517
|
+
}, Vt = "Skipped the question.", Ht = (e, t) => e.callId ? {
|
|
454
518
|
answers: t,
|
|
455
519
|
callId: e.callId
|
|
456
|
-
} : { answers: t },
|
|
457
|
-
let i =
|
|
520
|
+
} : { answers: t }, Ut = (e) => Ht(e, []), Wt = (e, t, n, r) => {
|
|
521
|
+
let i = Lt(t, n), a = Ft(e, i) ?? [], o = a.includes(r);
|
|
458
522
|
return t.multiple ? {
|
|
459
523
|
...e,
|
|
460
524
|
[i]: o ? a.filter((e) => e !== r) : [...a, r]
|
|
@@ -462,11 +526,11 @@ var xt = (e = "") => JSON.stringify(C(e)), St = (e) => e.trim().length > 0, Ct =
|
|
|
462
526
|
...e,
|
|
463
527
|
[i]: o ? [] : [r]
|
|
464
528
|
};
|
|
465
|
-
},
|
|
529
|
+
}, Gt = (e) => e ? JSON.stringify({
|
|
466
530
|
callId: e.callId,
|
|
467
531
|
delivery: e.delivery,
|
|
468
532
|
questions: e.questions.map((e, t) => ({
|
|
469
|
-
id:
|
|
533
|
+
id: Lt(e, t),
|
|
470
534
|
question: e.question,
|
|
471
535
|
multiple: !!e.multiple,
|
|
472
536
|
required: !!e.required,
|
|
@@ -476,38 +540,38 @@ var xt = (e = "") => JSON.stringify(C(e)), St = (e) => e.trim().length > 0, Ct =
|
|
|
476
540
|
description: e.description ?? ""
|
|
477
541
|
}))
|
|
478
542
|
}))
|
|
479
|
-
}) : "",
|
|
543
|
+
}) : "", Kt = (e, t, n) => {
|
|
480
544
|
let r = n?.trim();
|
|
481
545
|
return r ? e.multiple ? [...t, r] : [r] : t;
|
|
482
|
-
},
|
|
546
|
+
}, qt = (e, t, n, r) => Kt(e, Ft(n, t) ?? [], Ft(r, t)), Jt = (e, t, n) => {
|
|
483
547
|
let r = [];
|
|
484
548
|
for (let i = 0; i < e.questions.length; i += 1) {
|
|
485
|
-
let a = e.questions[i], o =
|
|
549
|
+
let a = e.questions[i], o = qt(a, Lt(a, i), t, n);
|
|
486
550
|
o.length !== 0 && r.push(`${a.question}: ${o.join(", ")}`);
|
|
487
551
|
}
|
|
488
552
|
return r;
|
|
489
|
-
},
|
|
490
|
-
if (
|
|
553
|
+
}, Yt = (e) => typeof e != "string", Xt = (e, t) => {
|
|
554
|
+
if (Yt(t)) return t;
|
|
491
555
|
let n = t.trim();
|
|
492
|
-
return n.length === 0 ? {} : Object.fromEntries(e.questions.flatMap((e, t) => e.allowCustomAnswer ? [[
|
|
493
|
-
},
|
|
556
|
+
return n.length === 0 ? {} : Object.fromEntries(e.questions.flatMap((e, t) => e.allowCustomAnswer ? [[Lt(e, t), n]] : []));
|
|
557
|
+
}, Zt = (e, t, n) => {
|
|
494
558
|
if (!e) return typeof n == "string" ? n.trim() : "";
|
|
495
|
-
let r =
|
|
559
|
+
let r = Jt(e, t, Xt(e, n)), i = typeof n == "string" ? n.trim() : "", a = e.questions.some((e) => e.allowCustomAnswer);
|
|
496
560
|
return i.length > 0 && !a && r.push(`Additional response: ${i}`), r.join("\n");
|
|
497
|
-
},
|
|
498
|
-
let r =
|
|
499
|
-
return e.questions.map((e, n) =>
|
|
500
|
-
},
|
|
561
|
+
}, Qt = (e, t, n) => {
|
|
562
|
+
let r = Xt(e, n);
|
|
563
|
+
return e.questions.map((e, n) => qt(e, Lt(e, n), t, r));
|
|
564
|
+
}, $t = (e, t, n) => {
|
|
501
565
|
if (!e) return !1;
|
|
502
|
-
let r =
|
|
566
|
+
let r = Xt(e, n);
|
|
503
567
|
for (let n = 0; n < e.questions.length; n += 1) {
|
|
504
568
|
let i = e.questions[n];
|
|
505
|
-
if (!(!i.required ||
|
|
569
|
+
if (!(!i.required || qt(i, Lt(i, n), t, r).length > 0)) return !0;
|
|
506
570
|
}
|
|
507
571
|
return !1;
|
|
508
|
-
},
|
|
572
|
+
}, en = (e, t, n, r) => qt(e, Lt(e, t), n, r).length > 0, tn = (e) => {
|
|
509
573
|
let n = q(22), { question: r, questionIndex: i, isActive: a, selectedOptionsByQuestion: o, customAnswersByQuestion: s, onSelectStep: c } = e, l;
|
|
510
|
-
n[0] !== s || n[1] !== r || n[2] !== i || n[3] !== o ? (l =
|
|
574
|
+
n[0] !== s || n[1] !== r || n[2] !== i || n[3] !== o ? (l = en(r, i, o, s), n[0] = s, n[1] = r, n[2] = i, n[3] = o, n[4] = l) : l = n[4];
|
|
511
575
|
let u = l, d = u ? "answered" : "not answered", f = a ? "outline" : "ghost", p = `question-step-tab-${r.id}`, m = `${r.question} (${d})`, h = `question-step-panel-${r.id}`, g;
|
|
512
576
|
n[5] !== c || n[6] !== i ? (g = () => c(i), n[5] = c, n[6] = i, n[7] = g) : g = n[7];
|
|
513
577
|
let _;
|
|
@@ -530,92 +594,92 @@ var xt = (e = "") => JSON.stringify(C(e)), St = (e) => e.trim().length > 0, Ct =
|
|
|
530
594
|
content: r.question,
|
|
531
595
|
children: v
|
|
532
596
|
}), n[19] = r.question, n[20] = v, n[21] = y) : y = n[21], y;
|
|
533
|
-
},
|
|
597
|
+
}, nn = (e) => typeof e == "object" && !!e && !Array.isArray(e), rn = (e) => {
|
|
534
598
|
try {
|
|
535
599
|
let t = JSON.parse(e);
|
|
536
|
-
return
|
|
600
|
+
return nn(t) ? t : null;
|
|
537
601
|
} catch {
|
|
538
602
|
return null;
|
|
539
603
|
}
|
|
540
|
-
},
|
|
541
|
-
let t =
|
|
604
|
+
}, an = (e) => nn(e) ? e : typeof e == "string" && e.trim().length > 0 ? rn(e) : null, on = (e) => typeof e == "string" && e.trim().length > 0 ? e : null, sn = (e) => {
|
|
605
|
+
let t = on(e);
|
|
542
606
|
if (t) return t;
|
|
543
607
|
if (Array.isArray(e)) {
|
|
544
|
-
let t = e.map(
|
|
608
|
+
let t = e.map(sn).filter((e) => e !== null);
|
|
545
609
|
return t.length > 0 ? t.join("\n") : null;
|
|
546
610
|
}
|
|
547
|
-
return
|
|
548
|
-
},
|
|
611
|
+
return nn(e) ? sn(e.response) ?? sn(e.answer) ?? sn(e.text) ?? sn(e.answers) : null;
|
|
612
|
+
}, cn = (e) => nn(e) ? Array.isArray(e.answers) ? !0 : cn(e.response) || cn(e.answer) : !1, ln = (e) => sn(e) !== null || cn(e), un = (e) => {
|
|
549
613
|
if (typeof e == "string" && e.trim().length > 0) return {
|
|
550
614
|
label: e,
|
|
551
615
|
description: void 0
|
|
552
616
|
};
|
|
553
|
-
if (
|
|
554
|
-
let t =
|
|
617
|
+
if (!nn(e)) return null;
|
|
618
|
+
let t = on(e.label);
|
|
555
619
|
return t ? {
|
|
556
620
|
label: t,
|
|
557
|
-
description:
|
|
621
|
+
description: on(e.description) ?? void 0
|
|
558
622
|
} : null;
|
|
559
|
-
},
|
|
560
|
-
if (
|
|
561
|
-
let n =
|
|
623
|
+
}, dn = (e, t) => {
|
|
624
|
+
if (!nn(e)) return null;
|
|
625
|
+
let n = on(e.question);
|
|
562
626
|
if (!n) return null;
|
|
563
|
-
let r = Array.isArray(e.options) ? e.options.map(
|
|
627
|
+
let r = Array.isArray(e.options) ? e.options.map(un).filter((e) => e !== null) : [], i = on(e.type), a = typeof e.allowCustomAnswer == "boolean" ? e.allowCustomAnswer : r.length === 0 || i === "freeform" || i === "text", o = typeof e.custom == "boolean" ? e.custom : a;
|
|
564
628
|
return {
|
|
565
|
-
id:
|
|
629
|
+
id: on(e.id) ?? `question-${t}`,
|
|
566
630
|
question: n,
|
|
567
631
|
options: r,
|
|
568
632
|
multiple: typeof e.multiple == "boolean" ? e.multiple : i === "multi_choice" || i === "multiple_choice",
|
|
569
633
|
required: typeof e.required != "boolean" || e.required,
|
|
570
634
|
allowCustomAnswer: o
|
|
571
635
|
};
|
|
572
|
-
},
|
|
573
|
-
let t =
|
|
636
|
+
}, fn = (e) => {
|
|
637
|
+
let t = an(e);
|
|
574
638
|
if (!t || !Array.isArray(t.questions)) return null;
|
|
575
|
-
let n = t.questions.map(
|
|
639
|
+
let n = t.questions.map(dn).filter((e) => e !== null);
|
|
576
640
|
return n.length === 0 ? null : {
|
|
577
641
|
questions: n,
|
|
578
642
|
...t.delivery === "async" ? { delivery: "async" } : {}
|
|
579
643
|
};
|
|
580
|
-
},
|
|
644
|
+
}, pn = (e) => e.tool.toLowerCase() === "question", mn = (e) => {
|
|
581
645
|
let t = /* @__PURE__ */ new Map();
|
|
582
|
-
for (let n of e) if (n.role === "assistant") for (let e of n.parts) e.type === "tool" &&
|
|
646
|
+
for (let n of e) if (n.role === "assistant") for (let e of n.parts) e.type === "tool" && pn(e) && t.set(e.callId ?? e, e);
|
|
583
647
|
return t.values();
|
|
584
|
-
},
|
|
585
|
-
if (!
|
|
586
|
-
let t =
|
|
648
|
+
}, hn = (e) => e.callId ?? JSON.stringify(e.state?.input), gn = (e) => e.status !== "failed" && e.status !== "denied" && !ln(e.state?.output) && !ln(e.state?.metadata), _n = (e) => {
|
|
649
|
+
if (!gn(e)) return;
|
|
650
|
+
let t = fn(e.state?.input);
|
|
587
651
|
return t ? {
|
|
588
652
|
...t,
|
|
589
653
|
...e.callId ? { callId: e.callId } : {}
|
|
590
654
|
} : void 0;
|
|
591
|
-
},
|
|
592
|
-
let n = [...
|
|
593
|
-
return n ?
|
|
594
|
-
},
|
|
595
|
-
for (let t of
|
|
596
|
-
let e =
|
|
655
|
+
}, vn = (e, t) => {
|
|
656
|
+
let n = [...mn(e)].find((e) => hn(e) === t);
|
|
657
|
+
return n ? _n(n) : void 0;
|
|
658
|
+
}, yn = (e) => {
|
|
659
|
+
for (let t of mn(e)) {
|
|
660
|
+
let e = _n(t);
|
|
597
661
|
if (e && e.delivery !== "async") return e;
|
|
598
662
|
}
|
|
599
|
-
},
|
|
663
|
+
}, bn = (e, t) => {
|
|
600
664
|
for (let n of [e.state?.metadata, e.state?.output]) {
|
|
601
|
-
let e =
|
|
665
|
+
let e = an(n);
|
|
602
666
|
if (Array.isArray(e?.answers)) {
|
|
603
667
|
let n = e.answers[t];
|
|
604
668
|
return Array.isArray(n) && n.length ? n.join(", ") : "Skipped";
|
|
605
669
|
}
|
|
606
670
|
}
|
|
607
|
-
if (
|
|
608
|
-
let n =
|
|
671
|
+
if (gn(e)) return;
|
|
672
|
+
let n = fn(e.state?.input), r = sn(e.state?.output);
|
|
609
673
|
if (!r || !n) return e.status === "failed" || e.status === "denied" ? "Unavailable" : "Answered";
|
|
610
674
|
let i = n.questions[t].question, a = r.split(/\n\n/).find((e) => e.startsWith(`${i}\n`));
|
|
611
675
|
return a ? a.slice(i.length + 1).trim() || "Skipped" : n.questions.length === 1 ? r : "Answered";
|
|
612
|
-
},
|
|
676
|
+
}, xn = ge(void 0), Sn = () => ve(xn), Cn = (e, t) => {
|
|
613
677
|
let n = q(14), [r, i] = Q(), a = r?.conversationKey === t ? r : void 0, o;
|
|
614
|
-
n[0] !== a || n[1] !== e ? (o = a ?
|
|
678
|
+
n[0] !== a || n[1] !== e ? (o = a ? vn(e, a.key) : void 0, n[0] = a, n[1] = e, n[2] = o) : o = n[2];
|
|
615
679
|
let s = o, c = s ? a?.key : void 0, l = s ? a : void 0, u;
|
|
616
680
|
n[3] === t ? u = n[4] : (u = (e, n) => i((r) => ({
|
|
617
681
|
conversationKey: t,
|
|
618
|
-
key:
|
|
682
|
+
key: hn(e),
|
|
619
683
|
index: n,
|
|
620
684
|
revision: (r?.revision ?? 0) + 1
|
|
621
685
|
})), n[3] = t, n[4] = u);
|
|
@@ -637,9 +701,9 @@ var xt = (e = "") => JSON.stringify(C(e)), St = (e) => e.trim().length > 0, Ct =
|
|
|
637
701
|
prompt: s,
|
|
638
702
|
value: m
|
|
639
703
|
}, n[11] = s, n[12] = m, n[13] = h) : h = n[13], h;
|
|
640
|
-
},
|
|
704
|
+
}, wn = (e) => {
|
|
641
705
|
e.preventDefault();
|
|
642
|
-
},
|
|
706
|
+
}, Tn = (e) => {
|
|
643
707
|
let t = q(7), { option: n } = e, r;
|
|
644
708
|
t[0] === n.label ? r = t[1] : (r = /* @__PURE__ */ J(G, {
|
|
645
709
|
textStyle: "label/S/regular",
|
|
@@ -658,11 +722,11 @@ var xt = (e = "") => JSON.stringify(C(e)), St = (e) => e.trim().length > 0, Ct =
|
|
|
658
722
|
minWidth: "0",
|
|
659
723
|
children: [r, i]
|
|
660
724
|
}), t[4] = r, t[5] = i, t[6] = a) : a = t[6], a;
|
|
661
|
-
},
|
|
725
|
+
}, En = (e) => {
|
|
662
726
|
let t = q(12), { option: n, name: i, checked: a, editable: o, onToggle: s } = e, c = !o, l = o ? void 0 : "true", u;
|
|
663
727
|
t[0] === o ? u = t[1] : (u = o ? void 0 : { tabIndex: -1 }, t[0] = o, t[1] = u);
|
|
664
728
|
let d = o ? s : void 0, f;
|
|
665
|
-
t[2] === n ? f = t[3] : (f = /* @__PURE__ */ J(
|
|
729
|
+
t[2] === n ? f = t[3] : (f = /* @__PURE__ */ J(Tn, { option: n }), t[2] = n, t[3] = f);
|
|
666
730
|
let p;
|
|
667
731
|
return t[4] !== a || t[5] !== i || t[6] !== c || t[7] !== l || t[8] !== u || t[9] !== d || t[10] !== f ? (p = /* @__PURE__ */ J(r, {
|
|
668
732
|
name: i,
|
|
@@ -674,15 +738,15 @@ var xt = (e = "") => JSON.stringify(C(e)), St = (e) => e.trim().length > 0, Ct =
|
|
|
674
738
|
onCheckedChange: d,
|
|
675
739
|
children: f
|
|
676
740
|
}), t[4] = a, t[5] = i, t[6] = c, t[7] = l, t[8] = u, t[9] = d, t[10] = f, t[11] = p) : p = t[11], p;
|
|
677
|
-
},
|
|
741
|
+
}, Dn = (e) => {
|
|
678
742
|
let t = q(30), { question: n, questionIndex: r, name: i, selectedOption: a, otherSelected: o, editable: s, onToggleOption: c, onToggleOther: l } = e, { otherField: f } = e, p;
|
|
679
|
-
t[0] === n ? p = t[1] : (p =
|
|
743
|
+
t[0] === n ? p = t[1] : (p = It(n), t[0] = n, t[1] = p);
|
|
680
744
|
let m = p, h;
|
|
681
745
|
if (t[2] !== n.options || t[3] !== a) {
|
|
682
746
|
let e;
|
|
683
747
|
t[5] === a ? e = t[6] : (e = (e) => e.label === a, t[5] = a, t[6] = e), h = n.options.findIndex(e), t[2] = n.options, t[3] = a, t[4] = h;
|
|
684
748
|
} else h = t[4];
|
|
685
|
-
let g = h, _ = o ?
|
|
749
|
+
let g = h, _ = o ? Pt : g === -1 ? null : String(g), v = !s, y = s ? void 0 : "true", b;
|
|
686
750
|
t[7] !== s || t[8] !== c || t[9] !== l || t[10] !== n || t[11] !== r ? (b = s ? (e) => {
|
|
687
751
|
e.value && (e.value === "__pstdio_other__" ? l?.(n, r) : c?.(n, r, n.options[Number(e.value)].label));
|
|
688
752
|
} : void 0, t[7] = s, t[8] = c, t[9] = l, t[10] = n, t[11] = r, t[12] = b) : b = t[12];
|
|
@@ -693,15 +757,15 @@ var xt = (e = "") => JSON.stringify(C(e)), St = (e) => e.trim().length > 0, Ct =
|
|
|
693
757
|
value: String(t),
|
|
694
758
|
inputProps: s ? void 0 : { tabIndex: -1 },
|
|
695
759
|
alignItems: "flex-start",
|
|
696
|
-
children: /* @__PURE__ */ J(
|
|
760
|
+
children: /* @__PURE__ */ J(Tn, { option: e })
|
|
697
761
|
}, e.label), t[16] = s, t[17] = e), x = n.options.map(e), t[13] = s, t[14] = n.options, t[15] = x;
|
|
698
762
|
} else x = t[15];
|
|
699
763
|
let S;
|
|
700
764
|
t[18] !== s || t[19] !== m ? (S = m ? /* @__PURE__ */ J(d, {
|
|
701
|
-
value:
|
|
765
|
+
value: Pt,
|
|
702
766
|
inputProps: s ? void 0 : { tabIndex: -1 },
|
|
703
767
|
alignItems: "flex-start",
|
|
704
|
-
children: /* @__PURE__ */ J(
|
|
768
|
+
children: /* @__PURE__ */ J(Tn, { option: { label: Nt } })
|
|
705
769
|
}) : null, t[18] = s, t[19] = m, t[20] = S) : S = t[20];
|
|
706
770
|
let C = o ? f : null, w;
|
|
707
771
|
return t[21] !== i || t[22] !== _ || t[23] !== v || t[24] !== y || t[25] !== b || t[26] !== x || t[27] !== S || t[28] !== C ? (w = /* @__PURE__ */ Y(u, {
|
|
@@ -719,9 +783,9 @@ var xt = (e = "") => JSON.stringify(C(e)), St = (e) => e.trim().length > 0, Ct =
|
|
|
719
783
|
C
|
|
720
784
|
]
|
|
721
785
|
}), t[21] = i, t[22] = _, t[23] = v, t[24] = y, t[25] = b, t[26] = x, t[27] = S, t[28] = C, t[29] = w) : w = t[29], w;
|
|
722
|
-
},
|
|
786
|
+
}, On = (e) => {
|
|
723
787
|
let t = q(4), { items: n } = e, r;
|
|
724
|
-
t[0] === n ? r = t[1] : (r = n.map(
|
|
788
|
+
t[0] === n ? r = t[1] : (r = n.map(Nn), t[0] = n, t[1] = r);
|
|
725
789
|
let i;
|
|
726
790
|
return t[2] === r ? i = t[3] : (i = /* @__PURE__ */ J(W, {
|
|
727
791
|
as: "ul",
|
|
@@ -731,8 +795,8 @@ var xt = (e = "") => JSON.stringify(C(e)), St = (e) => e.trim().length > 0, Ct =
|
|
|
731
795
|
padding: "0",
|
|
732
796
|
children: r
|
|
733
797
|
}), t[2] = r, t[3] = i), i;
|
|
734
|
-
},
|
|
735
|
-
let t = q(12), { question: n, questionIndex: r, editable: i, customAnswer: a, onCustomAnswerChange: o, hasOtherChoice: s } = e, c = s ? "Type your answer..." : "Answer...", l = !i, u = i ? void 0 : "true", d = a ?? "", f = i ? c : "Answer", p = s ? `${n.question} (${
|
|
798
|
+
}, kn = (e) => {
|
|
799
|
+
let t = q(12), { question: n, questionIndex: r, editable: i, customAnswer: a, onCustomAnswerChange: o, hasOtherChoice: s } = e, c = s ? "Type your answer..." : "Answer...", l = !i, u = i ? void 0 : "true", d = a ?? "", f = i ? c : "Answer", p = s ? `${n.question} (${Nt})` : n.question, m = i ? "vertical" : "none", h;
|
|
736
800
|
t[0] !== o || t[1] !== n || t[2] !== r ? (h = (e) => o?.(n, r, e.currentTarget.value), t[0] = o, t[1] = n, t[2] = r, t[3] = h) : h = t[3];
|
|
737
801
|
let g;
|
|
738
802
|
return t[4] !== l || t[5] !== u || t[6] !== d || t[7] !== f || t[8] !== p || t[9] !== m || t[10] !== h ? (g = /* @__PURE__ */ J(oe, {
|
|
@@ -750,11 +814,11 @@ var xt = (e = "") => JSON.stringify(C(e)), St = (e) => e.trim().length > 0, Ct =
|
|
|
750
814
|
color: "fg",
|
|
751
815
|
onChange: h
|
|
752
816
|
}), t[4] = l, t[5] = u, t[6] = d, t[7] = f, t[8] = p, t[9] = m, t[10] = h, t[11] = g) : g = t[11], g;
|
|
753
|
-
},
|
|
817
|
+
}, An = (e) => {
|
|
754
818
|
let t = q(21), { question: n, questionIndex: r, editable: i, selectedOptions: a, customAnswer: o, onToggleOption: s, onToggleOther: c } = e, { name: l, otherField: u } = e, d;
|
|
755
|
-
t[0] === n ? d = t[1] : (d =
|
|
819
|
+
t[0] === n ? d = t[1] : (d = It(n), t[0] = n, t[1] = d);
|
|
756
820
|
let f = d, p = o !== void 0, m;
|
|
757
|
-
t[2] !== i || t[3] !== l || t[4] !== s || t[5] !== n || t[6] !== r || t[7] !== a ? (m = n.options.map((e) => /* @__PURE__ */ J(
|
|
821
|
+
t[2] !== i || t[3] !== l || t[4] !== s || t[5] !== n || t[6] !== r || t[7] !== a ? (m = n.options.map((e) => /* @__PURE__ */ J(En, {
|
|
758
822
|
option: e,
|
|
759
823
|
name: l,
|
|
760
824
|
checked: a.includes(e.label),
|
|
@@ -762,8 +826,8 @@ var xt = (e = "") => JSON.stringify(C(e)), St = (e) => e.trim().length > 0, Ct =
|
|
|
762
826
|
onToggle: () => s?.(n, r, e.label)
|
|
763
827
|
}, e.label)), t[2] = i, t[3] = l, t[4] = s, t[5] = n, t[6] = r, t[7] = a, t[8] = m) : m = t[8];
|
|
764
828
|
let h;
|
|
765
|
-
t[9] !== i || t[10] !== f || t[11] !== l || t[12] !== c || t[13] !== p || t[14] !== n || t[15] !== r ? (h = f ? /* @__PURE__ */ J(
|
|
766
|
-
option: { label:
|
|
829
|
+
t[9] !== i || t[10] !== f || t[11] !== l || t[12] !== c || t[13] !== p || t[14] !== n || t[15] !== r ? (h = f ? /* @__PURE__ */ J(En, {
|
|
830
|
+
option: { label: Nt },
|
|
767
831
|
name: l,
|
|
768
832
|
checked: p,
|
|
769
833
|
editable: i,
|
|
@@ -775,11 +839,11 @@ var xt = (e = "") => JSON.stringify(C(e)), St = (e) => e.trim().length > 0, Ct =
|
|
|
775
839
|
h,
|
|
776
840
|
g
|
|
777
841
|
] }), t[17] = m, t[18] = h, t[19] = g, t[20] = _) : _ = t[20], _;
|
|
778
|
-
},
|
|
842
|
+
}, jn = (e) => {
|
|
779
843
|
let t = q(30), { question: n, questionIndex: r, editable: i, selectedOptions: a, customAnswer: o, onToggleOption: s, onToggleOther: c } = e, l = n.id ?? `question-${r}`, u;
|
|
780
|
-
t[0] === n ? u = t[1] : (u =
|
|
844
|
+
t[0] === n ? u = t[1] : (u = It(n), t[0] = n, t[1] = u);
|
|
781
845
|
let d = u, f;
|
|
782
|
-
t[2] !== d || t[3] !== e || t[4] !== n.allowCustomAnswer ? (f = n.allowCustomAnswer ? /* @__PURE__ */ J(
|
|
846
|
+
t[2] !== d || t[3] !== e || t[4] !== n.allowCustomAnswer ? (f = n.allowCustomAnswer ? /* @__PURE__ */ J(kn, {
|
|
783
847
|
...e,
|
|
784
848
|
hasOtherChoice: d
|
|
785
849
|
}) : null, t[2] = d, t[3] = e, t[4] = n.allowCustomAnswer, t[5] = f) : f = t[5];
|
|
@@ -792,13 +856,13 @@ var xt = (e = "") => JSON.stringify(C(e)), St = (e) => e.trim().length > 0, Ct =
|
|
|
792
856
|
children: n.question
|
|
793
857
|
}), t[6] = n.question, t[7] = h);
|
|
794
858
|
let g;
|
|
795
|
-
t[8] !== m || t[9] !== l || t[10] !== p || t[11] !== e || t[12] !== n.multiple ? (g = m && n.multiple ? /* @__PURE__ */ J(
|
|
859
|
+
t[8] !== m || t[9] !== l || t[10] !== p || t[11] !== e || t[12] !== n.multiple ? (g = m && n.multiple ? /* @__PURE__ */ J(An, {
|
|
796
860
|
...e,
|
|
797
861
|
name: l,
|
|
798
862
|
otherField: p
|
|
799
863
|
}) : null, t[8] = m, t[9] = l, t[10] = p, t[11] = e, t[12] = n.multiple, t[13] = g) : g = t[13];
|
|
800
864
|
let _;
|
|
801
|
-
t[14] !== o || t[15] !== i || t[16] !== m || t[17] !== l || t[18] !== s || t[19] !== c || t[20] !== p || t[21] !== n || t[22] !== r || t[23] !== a ? (_ = m && !n.multiple ? /* @__PURE__ */ J(
|
|
865
|
+
t[14] !== o || t[15] !== i || t[16] !== m || t[17] !== l || t[18] !== s || t[19] !== c || t[20] !== p || t[21] !== n || t[22] !== r || t[23] !== a ? (_ = m && !n.multiple ? /* @__PURE__ */ J(Dn, {
|
|
802
866
|
question: n,
|
|
803
867
|
questionIndex: r,
|
|
804
868
|
name: l,
|
|
@@ -825,7 +889,7 @@ var xt = (e = "") => JSON.stringify(C(e)), St = (e) => e.trim().length > 0, Ct =
|
|
|
825
889
|
v
|
|
826
890
|
]
|
|
827
891
|
}), t[25] = h, t[26] = g, t[27] = _, t[28] = v, t[29] = y) : y = t[29], y;
|
|
828
|
-
},
|
|
892
|
+
}, Mn = (e) => {
|
|
829
893
|
let t = q(21), { questions: n, editable: r, selectedOptionsByQuestion: i, customAnswersByQuestion: a, onToggleOption: o, onToggleOther: s, onCustomAnswerChange: c } = e, l = r !== void 0 && r, u;
|
|
830
894
|
t[0] === i ? u = t[1] : (u = i === void 0 ? {} : i, t[0] = i, t[1] = u);
|
|
831
895
|
let d = u, f;
|
|
@@ -835,12 +899,12 @@ var xt = (e = "") => JSON.stringify(C(e)), St = (e) => e.trim().length > 0, Ct =
|
|
|
835
899
|
let e;
|
|
836
900
|
t[12] !== p || t[13] !== l || t[14] !== c || t[15] !== o || t[16] !== s || t[17] !== d ? (e = (e, t) => {
|
|
837
901
|
let n = e.id ?? `question-${t}`;
|
|
838
|
-
return /* @__PURE__ */ J(
|
|
902
|
+
return /* @__PURE__ */ J(jn, {
|
|
839
903
|
question: e,
|
|
840
904
|
questionIndex: t,
|
|
841
905
|
editable: l,
|
|
842
|
-
selectedOptions:
|
|
843
|
-
customAnswer:
|
|
906
|
+
selectedOptions: Ft(d, n) ?? [],
|
|
907
|
+
customAnswer: Ft(p, n),
|
|
844
908
|
onToggleOption: o,
|
|
845
909
|
onToggleOther: s,
|
|
846
910
|
onCustomAnswerChange: c
|
|
@@ -851,12 +915,12 @@ var xt = (e = "") => JSON.stringify(C(e)), St = (e) => e.trim().length > 0, Ct =
|
|
|
851
915
|
return t[19] === m ? h = t[20] : (h = /* @__PURE__ */ J(W, {
|
|
852
916
|
as: "form",
|
|
853
917
|
gap: "sm",
|
|
854
|
-
onSubmit:
|
|
918
|
+
onSubmit: wn,
|
|
855
919
|
"aria-label": "Question form",
|
|
856
920
|
children: m
|
|
857
921
|
}), t[19] = m, t[20] = h), h;
|
|
858
922
|
};
|
|
859
|
-
function
|
|
923
|
+
function Nn(e, t) {
|
|
860
924
|
return /* @__PURE__ */ J(A, {
|
|
861
925
|
as: "li",
|
|
862
926
|
children: /* @__PURE__ */ J(r, {
|
|
@@ -875,15 +939,15 @@ function An(e, t) {
|
|
|
875
939
|
}
|
|
876
940
|
//#endregion
|
|
877
941
|
//#region src/components/chat-ui/components/chat-input-question-prompt.tsx
|
|
878
|
-
var
|
|
879
|
-
id:
|
|
942
|
+
var Pn = (e) => e.questions.map((e, t) => ({
|
|
943
|
+
id: Lt(e, t),
|
|
880
944
|
question: e.question,
|
|
881
945
|
options: e.options,
|
|
882
946
|
multiple: !!e.multiple,
|
|
883
947
|
required: !!e.required,
|
|
884
948
|
allowCustomAnswer: !!e.allowCustomAnswer
|
|
885
|
-
})),
|
|
886
|
-
let t = q(49), { questionPrompt: n, selectedOptionsByQuestion: r, customAnswersByQuestion: i, onToggleOption: a, onCustomAnswerChange: o } = e, { onToggleOther: s } = e, { questions: c, isEditable: l } = e, [u, d] = Q(0), f = Z(null), p =
|
|
949
|
+
})), Fn = (e) => {
|
|
950
|
+
let t = q(49), { questionPrompt: n, selectedOptionsByQuestion: r, customAnswersByQuestion: i, onToggleOption: a, onCustomAnswerChange: o } = e, { onToggleOther: s } = e, { questions: c, isEditable: l } = e, [u, d] = Q(0), f = Z(null), p = Sn(), m = p?.selection, h = m?.revision, g, _;
|
|
887
951
|
t[0] === h ? (g = t[1], _ = t[2]) : (g = () => {
|
|
888
952
|
h !== void 0 && f.current?.focus();
|
|
889
953
|
}, _ = [h], t[0] = h, t[1] = g, t[2] = _), X(g, _);
|
|
@@ -897,7 +961,7 @@ var jn = (e) => e.questions.map((e, t) => ({
|
|
|
897
961
|
"aria-label": "Question steps",
|
|
898
962
|
gap: "1",
|
|
899
963
|
minWidth: "0",
|
|
900
|
-
children: c.map((e, t) => /* @__PURE__ */ J(
|
|
964
|
+
children: c.map((e, t) => /* @__PURE__ */ J(tn, {
|
|
901
965
|
question: e,
|
|
902
966
|
questionIndex: t,
|
|
903
967
|
isActive: t === b,
|
|
@@ -910,7 +974,7 @@ var jn = (e) => e.questions.map((e, t) => ({
|
|
|
910
974
|
t[13] === x ? O = t[14] : (O = [x], t[13] = x, t[14] = O);
|
|
911
975
|
let k;
|
|
912
976
|
t[15] !== x.id || t[16] !== i || t[17] !== a || t[18] !== n.questions || t[19] !== c.length || t[20] !== b || t[21] !== y || t[22] !== r ? (k = (e, t, o) => {
|
|
913
|
-
let s = n.questions[b], l = (
|
|
977
|
+
let s = n.questions[b], l = (Ft(r, x.id) ?? []).length > 0 || Rt(i, s, b);
|
|
914
978
|
a(s, b, o), !s.multiple && !l && b < c.length - 1 && (f.current?.focus(), y(b + 1));
|
|
915
979
|
}, t[15] = x.id, t[16] = i, t[17] = a, t[18] = n.questions, t[19] = c.length, t[20] = b, t[21] = y, t[22] = r, t[23] = k) : k = t[23];
|
|
916
980
|
let A;
|
|
@@ -922,7 +986,7 @@ var jn = (e) => e.questions.map((e, t) => ({
|
|
|
922
986
|
o(n.questions[b], b, r);
|
|
923
987
|
}, t[28] = o, t[29] = n.questions, t[30] = b, t[31] = j) : j = t[31];
|
|
924
988
|
let M;
|
|
925
|
-
t[32] !== i || t[33] !== l || t[34] !== r || t[35] !== A || t[36] !== j || t[37] !== O || t[38] !== k ? (M = /* @__PURE__ */ J(
|
|
989
|
+
t[32] !== i || t[33] !== l || t[34] !== r || t[35] !== A || t[36] !== j || t[37] !== O || t[38] !== k ? (M = /* @__PURE__ */ J(Mn, {
|
|
926
990
|
questions: O,
|
|
927
991
|
editable: l,
|
|
928
992
|
selectedOptionsByQuestion: r,
|
|
@@ -948,21 +1012,21 @@ var jn = (e) => e.questions.map((e, t) => ({
|
|
|
948
1012
|
pt: C,
|
|
949
1013
|
children: [w, N]
|
|
950
1014
|
}), t[45] = N, t[46] = C, t[47] = w, t[48] = P) : P = t[48], P;
|
|
951
|
-
},
|
|
1015
|
+
}, In = (e) => {
|
|
952
1016
|
let t = q(8), { questionPrompt: n } = e, r;
|
|
953
|
-
t[0] === n ? r = t[1] : (r =
|
|
1017
|
+
t[0] === n ? r = t[1] : (r = Pn(n), t[0] = n, t[1] = r);
|
|
954
1018
|
let i = r, a;
|
|
955
|
-
t[2] === n ? a = t[3] : (a =
|
|
1019
|
+
t[2] === n ? a = t[3] : (a = Gt(n), t[2] = n, t[3] = a);
|
|
956
1020
|
let o = a, s;
|
|
957
|
-
return t[4] !== e || t[5] !== o || t[6] !== i ? (s = /* @__PURE__ */ J(
|
|
1021
|
+
return t[4] !== e || t[5] !== o || t[6] !== i ? (s = /* @__PURE__ */ J(Fn, {
|
|
958
1022
|
...e,
|
|
959
1023
|
questions: i
|
|
960
1024
|
}, o), t[4] = e, t[5] = o, t[6] = i, t[7] = s) : s = t[7], s;
|
|
961
|
-
},
|
|
962
|
-
let [n, r] = Q(() =>
|
|
1025
|
+
}, Ln = (e) => Object.fromEntries((e?.questions ?? []).flatMap((t, n) => e?.delivery === "async" && t.options.length ? [[Lt(t, n), [t.options[0].label]]] : [])), Rn = (e, t) => {
|
|
1026
|
+
let [n, r] = Q(() => Ln(e)), [i, a] = Q({}), o = Gt(e), s = Z(JSON.stringify([o, t ?? null]));
|
|
963
1027
|
return X(() => {
|
|
964
1028
|
let n = JSON.stringify([o, t ?? null]);
|
|
965
|
-
s.current !== n && (s.current = n, r(
|
|
1029
|
+
s.current !== n && (s.current = n, r(Ln(e)), a({}));
|
|
966
1030
|
}, [
|
|
967
1031
|
o,
|
|
968
1032
|
t,
|
|
@@ -972,33 +1036,33 @@ var jn = (e) => e.questions.map((e, t) => ({
|
|
|
972
1036
|
selectedOptionsByQuestion: n,
|
|
973
1037
|
customAnswersByQuestion: i,
|
|
974
1038
|
reset: () => {
|
|
975
|
-
r(
|
|
1039
|
+
r(Ln(e)), a({});
|
|
976
1040
|
},
|
|
977
1041
|
restore: (e, t) => {
|
|
978
1042
|
r(e), a(t);
|
|
979
1043
|
},
|
|
980
1044
|
toggleOption: (e, t, n) => {
|
|
981
|
-
r((r) =>
|
|
1045
|
+
r((r) => Wt(r, e, t, n)), e.multiple || a((n) => zt(n, e, t));
|
|
982
1046
|
},
|
|
983
1047
|
toggleOther: (e, t) => {
|
|
984
|
-
a((n) =>
|
|
1048
|
+
a((n) => Bt(n, e, t)), e.multiple || r((n) => ({
|
|
985
1049
|
...n,
|
|
986
|
-
[
|
|
1050
|
+
[Lt(e, t)]: []
|
|
987
1051
|
}));
|
|
988
1052
|
},
|
|
989
1053
|
setCustomAnswer: (e, t, n) => {
|
|
990
|
-
let r =
|
|
1054
|
+
let r = Lt(e, t);
|
|
991
1055
|
a((e) => ({
|
|
992
1056
|
...e,
|
|
993
1057
|
[r]: n
|
|
994
1058
|
}));
|
|
995
1059
|
},
|
|
996
|
-
responseText: e ?
|
|
997
|
-
hasMissingRequiredAnswer:
|
|
998
|
-
buildAnswers: () => e ?
|
|
1060
|
+
responseText: e ? Zt(e, n, i) : "",
|
|
1061
|
+
hasMissingRequiredAnswer: $t(e, n, i),
|
|
1062
|
+
buildAnswers: () => e ? Qt(e, n, i) : []
|
|
999
1063
|
};
|
|
1000
|
-
},
|
|
1001
|
-
let t = q(33), { prompt: n, actions: r, disabled: i, onSubmit: a } = e, o =
|
|
1064
|
+
}, zn = (e) => {
|
|
1065
|
+
let t = q(33), { prompt: n, actions: r, disabled: i, onSubmit: a } = e, o = Rn(n), s = Sn(), [c, l] = Q(!1), u = Z(!1), d;
|
|
1002
1066
|
t[0] !== i || t[1] !== a || t[2] !== n || t[3] !== o ? (d = async (e) => {
|
|
1003
1067
|
let t = e !== void 0 && e;
|
|
1004
1068
|
if (u.current || i || !t && o.hasMissingRequiredAnswer) return;
|
|
@@ -1006,7 +1070,7 @@ var jn = (e) => e.questions.map((e, t) => ({
|
|
|
1006
1070
|
let r = {
|
|
1007
1071
|
selectedOptions: o.selectedOptionsByQuestion,
|
|
1008
1072
|
customAnswers: o.customAnswersByQuestion
|
|
1009
|
-
}, s = t ?
|
|
1073
|
+
}, s = t ? Vt : o.responseText, c = t ? Ut(n) : Ht(n, o.buildAnswers());
|
|
1010
1074
|
o.reset();
|
|
1011
1075
|
try {
|
|
1012
1076
|
await a(s, c);
|
|
@@ -1015,7 +1079,7 @@ var jn = (e) => e.questions.map((e, t) => ({
|
|
|
1015
1079
|
}
|
|
1016
1080
|
}, t[0] = i, t[1] = a, t[2] = n, t[3] = o, t[4] = d) : d = t[4];
|
|
1017
1081
|
let f = d, p = !i && !c, m;
|
|
1018
|
-
t[5] !== n || t[6] !== o.customAnswersByQuestion || t[7] !== o.selectedOptionsByQuestion || t[8] !== o.setCustomAnswer || t[9] !== o.toggleOption || t[10] !== o.toggleOther || t[11] !== p ? (m = /* @__PURE__ */ J(
|
|
1082
|
+
t[5] !== n || t[6] !== o.customAnswersByQuestion || t[7] !== o.selectedOptionsByQuestion || t[8] !== o.setCustomAnswer || t[9] !== o.toggleOption || t[10] !== o.toggleOther || t[11] !== p ? (m = /* @__PURE__ */ J(In, {
|
|
1019
1083
|
isEditable: p,
|
|
1020
1084
|
questionPrompt: n,
|
|
1021
1085
|
selectedOptionsByQuestion: o.selectedOptionsByQuestion,
|
|
@@ -1041,7 +1105,7 @@ var jn = (e) => e.questions.map((e, t) => ({
|
|
|
1041
1105
|
e === "submit" && f();
|
|
1042
1106
|
}, t[22] = f, t[23] = b);
|
|
1043
1107
|
let x;
|
|
1044
|
-
t[24] !== g || t[25] !== _ || t[26] !== v || t[27] !== y || t[28] !== b ? (x = /* @__PURE__ */ J(
|
|
1108
|
+
t[24] !== g || t[25] !== _ || t[26] !== v || t[27] !== y || t[28] !== b ? (x = /* @__PURE__ */ J(jt, {
|
|
1045
1109
|
actions: g,
|
|
1046
1110
|
questionPrompt: !0,
|
|
1047
1111
|
skipDisabled: _,
|
|
@@ -1053,7 +1117,7 @@ var jn = (e) => e.questions.map((e, t) => ({
|
|
|
1053
1117
|
}), t[24] = g, t[25] = _, t[26] = v, t[27] = y, t[28] = b, t[29] = x) : x = t[29];
|
|
1054
1118
|
let S;
|
|
1055
1119
|
return t[30] !== m || t[31] !== x ? (S = /* @__PURE__ */ Y(pe, { children: [m, x] }), t[30] = m, t[31] = x, t[32] = S) : S = t[32], S;
|
|
1056
|
-
},
|
|
1120
|
+
}, Bn = (e) => {
|
|
1057
1121
|
let { decision: t, disabled: n } = e, [r, i] = Q(!1), a = Z(!1), o = async (e) => {
|
|
1058
1122
|
let r = t.actions.find((t) => t.id === e);
|
|
1059
1123
|
if (!(a.current || n || t.pending || !r || r.disabled)) {
|
|
@@ -1095,20 +1159,20 @@ var jn = (e) => e.questions.map((e, t) => ({
|
|
|
1095
1159
|
})
|
|
1096
1160
|
]
|
|
1097
1161
|
});
|
|
1098
|
-
},
|
|
1162
|
+
}, Vn = (e) => {
|
|
1099
1163
|
let t = q(11), { request: n, question: r, decision: i, actions: a, disabled: o, submitDisabled: s, onSubmit: c } = e;
|
|
1100
1164
|
if (n?.kind === "decision" && i) {
|
|
1101
1165
|
let e;
|
|
1102
|
-
return t[0] !== i || t[1] !== o ? (e = /* @__PURE__ */ J(
|
|
1166
|
+
return t[0] !== i || t[1] !== o ? (e = /* @__PURE__ */ J(Bn, {
|
|
1103
1167
|
decision: i,
|
|
1104
1168
|
disabled: o
|
|
1105
1169
|
}, i.id), t[0] = i, t[1] = o, t[2] = e) : e = t[2], e;
|
|
1106
1170
|
}
|
|
1107
1171
|
if (n?.kind === "question" && r) {
|
|
1108
1172
|
let e;
|
|
1109
|
-
t[3] === r ? e = t[4] : (e =
|
|
1173
|
+
t[3] === r ? e = t[4] : (e = Gt(r), t[3] = r, t[4] = e);
|
|
1110
1174
|
let n = o || s, i;
|
|
1111
|
-
return t[5] !== a || t[6] !== c || t[7] !== r || t[8] !== e || t[9] !== n ? (i = /* @__PURE__ */ J(
|
|
1175
|
+
return t[5] !== a || t[6] !== c || t[7] !== r || t[8] !== e || t[9] !== n ? (i = /* @__PURE__ */ J(zn, {
|
|
1112
1176
|
prompt: r,
|
|
1113
1177
|
actions: a,
|
|
1114
1178
|
disabled: n,
|
|
@@ -1116,7 +1180,7 @@ var jn = (e) => e.questions.map((e, t) => ({
|
|
|
1116
1180
|
}, e), t[5] = a, t[6] = c, t[7] = r, t[8] = e, t[9] = n, t[10] = i) : i = t[10], i;
|
|
1117
1181
|
}
|
|
1118
1182
|
return null;
|
|
1119
|
-
},
|
|
1183
|
+
}, Hn = (e, t) => {
|
|
1120
1184
|
let n = q(7), [r, i] = Q(e || t !== 0), a;
|
|
1121
1185
|
n[0] !== e || n[1] !== t ? (a = {
|
|
1122
1186
|
autoFocus: e,
|
|
@@ -1135,7 +1199,7 @@ var jn = (e) => e.questions.map((e, t) => ({
|
|
|
1135
1199
|
request: c,
|
|
1136
1200
|
complete: l
|
|
1137
1201
|
}, n[5] = r, n[6] = u), u;
|
|
1138
|
-
},
|
|
1202
|
+
}, Un = (e) => {
|
|
1139
1203
|
let t = [];
|
|
1140
1204
|
for (let n = e.length - 1; n >= 0 && t.length < 10; n--) {
|
|
1141
1205
|
let r = e[n];
|
|
@@ -1144,7 +1208,7 @@ var jn = (e) => e.questions.map((e, t) => ({
|
|
|
1144
1208
|
i.trim() && t.push(i);
|
|
1145
1209
|
}
|
|
1146
1210
|
return t;
|
|
1147
|
-
},
|
|
1211
|
+
}, Wn = (e, t, n, r) => r === 0 ? null : e === null ? t === "previous" && n === "" ? { index: 0 } : null : t === "previous" ? { index: Math.min(e + 1, r - 1) } : { index: e === 0 ? null : e - 1 }, Gn = (e) => {
|
|
1148
1212
|
let t = q(24), { recentUserMessages: n, text: r, blocked: i, resetKey: a, onChange: o } = e, s = Z(null), c = Z(null), l, u;
|
|
1149
1213
|
if (t[0] !== i || t[1] !== n || t[2] !== a) {
|
|
1150
1214
|
l = n.slice(0, 10);
|
|
@@ -1170,7 +1234,7 @@ var jn = (e) => e.questions.map((e, t) => ({
|
|
|
1170
1234
|
let v = _, y;
|
|
1171
1235
|
t[12] !== i || t[13] !== o || t[14] !== l || t[15] !== r ? (y = (e) => {
|
|
1172
1236
|
if (i) return !1;
|
|
1173
|
-
let t =
|
|
1237
|
+
let t = Wn(c.current, e, r, l.length);
|
|
1174
1238
|
if (!t) return !1;
|
|
1175
1239
|
c.current = t.index;
|
|
1176
1240
|
let n = t.index === null ? "" : l[t.index];
|
|
@@ -1186,12 +1250,12 @@ var jn = (e) => e.questions.map((e, t) => ({
|
|
|
1186
1250
|
recallPrevious: x,
|
|
1187
1251
|
recallNext: S
|
|
1188
1252
|
}, t[20] = v, t[21] = x, t[22] = S, t[23] = C) : C = t[23], C;
|
|
1189
|
-
},
|
|
1253
|
+
}, Kn = (e) => {
|
|
1190
1254
|
let t = q(7), [n, r] = Q(e), [i, a] = Q(e), [o, s] = Q(0), c;
|
|
1191
1255
|
t[0] === e ? c = t[1] : (c = () => w(e), t[0] = e, t[1] = c);
|
|
1192
1256
|
let [l, u] = Q(c), d;
|
|
1193
1257
|
t[2] === Symbol.for("react.memo_cache_sentinel") ? (d = (e) => {
|
|
1194
|
-
a(e), s(
|
|
1258
|
+
a(e), s(qn);
|
|
1195
1259
|
}, t[2] = d) : d = t[2];
|
|
1196
1260
|
let f = d;
|
|
1197
1261
|
if (n !== e) {
|
|
@@ -1209,24 +1273,24 @@ var jn = (e) => e.questions.map((e, t) => ({
|
|
|
1209
1273
|
text: l
|
|
1210
1274
|
}, t[3] = o, t[4] = i, t[5] = l, t[6] = p) : p = t[6], p;
|
|
1211
1275
|
};
|
|
1212
|
-
function
|
|
1276
|
+
function qn(e) {
|
|
1213
1277
|
return e + 1;
|
|
1214
1278
|
}
|
|
1215
1279
|
//#endregion
|
|
1216
1280
|
//#region src/components/chat-ui/components/composer-request.ts
|
|
1217
|
-
var
|
|
1281
|
+
var Jn = (e, t, n) => {
|
|
1218
1282
|
let r = [];
|
|
1219
1283
|
return e && r.push({
|
|
1220
1284
|
kind: "question",
|
|
1221
|
-
id: e.callId ??
|
|
1285
|
+
id: e.callId ?? Gt(e)
|
|
1222
1286
|
}), t && r.push({
|
|
1223
1287
|
kind: "decision",
|
|
1224
1288
|
id: t.id
|
|
1225
1289
|
}), r.find((e) => e.kind === n?.kind && e.id === n.id) ?? r[0];
|
|
1226
|
-
},
|
|
1227
|
-
let [n, r] = Q(), i =
|
|
1290
|
+
}, Yn = (e, t) => {
|
|
1291
|
+
let [n, r] = Q(), i = Jn(e, t, n);
|
|
1228
1292
|
return (i?.kind !== n?.kind || i?.id !== n?.id) && r(i), i;
|
|
1229
|
-
},
|
|
1293
|
+
}, Xn = (e) => {
|
|
1230
1294
|
let t = q(2), { placeholder: n } = e;
|
|
1231
1295
|
if (!n) return null;
|
|
1232
1296
|
let r;
|
|
@@ -1238,86 +1302,70 @@ var Gn = (e, t, n) => {
|
|
|
1238
1302
|
top: "0",
|
|
1239
1303
|
children: n
|
|
1240
1304
|
}), t[0] = n, t[1] = r), r;
|
|
1241
|
-
},
|
|
1242
|
-
let { defaultState: t, recentUserMessages: r = [], onSubmit: i = () => {}, onInterrupt: a, onAttachFiles: o, onAttachText: s, textAttachmentPasteLineThreshold: c = 200, streaming: l = !1, attachedResources: u = [], onClearAttachments: d, isDisabled: f = !1, submitDisabled: p = !1, onChange: m, placeholder: h, attachmentList: g, actions: _, submitActions: v, attachmentActions: y, attachedToTop: b = !1,
|
|
1305
|
+
}, Zn = (e) => {
|
|
1306
|
+
let { defaultState: t, recentUserMessages: r = [], onSubmit: i = () => {}, onInterrupt: a, onAttachFiles: o, onAttachText: s, textAttachmentPasteLineThreshold: c = 200, streaming: l = !1, attachedResources: u = [], onClearAttachments: d, isDisabled: f = !1, submitDisabled: p = !1, onChange: m, placeholder: h, attachmentList: g, actions: _, submitActions: v, attachmentActions: y, attachedToTop: b = !1, questionPrompt: x, decision: S, autoFocus: C = !1, focusSignal: w = 0, submitTitle: T, submitLabel: D, initialSelection: O, onSelectionChange: k, onEditorStateChange: j, retainTextUntilAcknowledged: M = !1, commands: N = [] } = e, P = Yn(x, S), I = !!P, L = fe({ recipe: Ct })({ attachedToTop: b }), [R, z] = Q(!1), { editorKey: ee, editorState: B, remountEditor: te, setEditorState: V, setText: ne, text: H } = Kn(t), re = Hn(C, w), U = Gn({
|
|
1243
1307
|
recentUserMessages: r,
|
|
1244
|
-
text:
|
|
1245
|
-
blocked: f || R ||
|
|
1246
|
-
resetKey: String(
|
|
1308
|
+
text: H,
|
|
1309
|
+
blocked: f || R || I,
|
|
1310
|
+
resetKey: String(ee),
|
|
1247
1311
|
onChange: (e) => {
|
|
1248
|
-
|
|
1312
|
+
ne(e), m?.(e);
|
|
1249
1313
|
}
|
|
1250
|
-
}),
|
|
1314
|
+
}), ie = (e) => {
|
|
1251
1315
|
let t = e.target;
|
|
1252
|
-
t instanceof Element && e.currentTarget.contains(t) && (t.closest("button, input, textarea, select, a, label, [role=button], [role=combobox]") ||
|
|
1253
|
-
},
|
|
1254
|
-
|
|
1255
|
-
},
|
|
1256
|
-
canInterrupt: !
|
|
1257
|
-
canSubmit: !p && !
|
|
1258
|
-
hasQuestionPrompt:
|
|
1316
|
+
t instanceof Element && e.currentTarget.contains(t) && (t.closest("button, input, textarea, select, a, label, [role=button], [role=combobox]") || I || re.request());
|
|
1317
|
+
}, W = (e) => {
|
|
1318
|
+
te(wt(e)), U.change(e);
|
|
1319
|
+
}, ae = !f && !R && !p && !I, G = {
|
|
1320
|
+
canInterrupt: !I && !!a,
|
|
1321
|
+
canSubmit: !p && !I,
|
|
1322
|
+
hasQuestionPrompt: I,
|
|
1259
1323
|
isDisabled: f || R,
|
|
1260
1324
|
streaming: l,
|
|
1261
|
-
text:
|
|
1262
|
-
},
|
|
1263
|
-
if (!
|
|
1264
|
-
let e =
|
|
1265
|
-
U.reset(), z(!0),
|
|
1325
|
+
text: H
|
|
1326
|
+
}, oe = Dt(G), se = l ? "Queue message" : "Send message", ce = async () => {
|
|
1327
|
+
if (!ae || !H.trim()) return;
|
|
1328
|
+
let e = H;
|
|
1329
|
+
U.reset(), z(!0), M || W("");
|
|
1266
1330
|
try {
|
|
1267
|
-
await
|
|
1268
|
-
text:
|
|
1331
|
+
await Mt({
|
|
1332
|
+
text: H.trim(),
|
|
1269
1333
|
attachments: u,
|
|
1270
1334
|
onSubmit: i,
|
|
1271
1335
|
onClearAttachments: d
|
|
1272
1336
|
});
|
|
1273
1337
|
} catch {
|
|
1274
|
-
|
|
1338
|
+
M || W(e);
|
|
1275
1339
|
} finally {
|
|
1276
|
-
z(!1),
|
|
1340
|
+
z(!1), re.request();
|
|
1277
1341
|
}
|
|
1278
|
-
},
|
|
1279
|
-
e === "interrupt" && a?.(), e === "submit" &&
|
|
1280
|
-
},
|
|
1342
|
+
}, K = (e) => {
|
|
1343
|
+
e === "interrupt" && a?.(), e === "submit" && ce();
|
|
1344
|
+
}, le = kt({
|
|
1281
1345
|
onAttachFiles: o,
|
|
1282
1346
|
onAttachText: s,
|
|
1283
1347
|
textAttachmentPasteLineThreshold: c
|
|
1284
1348
|
});
|
|
1285
1349
|
return /* @__PURE__ */ J(A, {
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
borderRadius: "xs",
|
|
1293
|
-
borderTopRadius: b ? "0" : void 0,
|
|
1294
|
-
borderWidth: "1px",
|
|
1295
|
-
borderStyle: "solid",
|
|
1296
|
-
borderColor: ee,
|
|
1297
|
-
zIndex: 0,
|
|
1298
|
-
transition: "border-color 0.2s ease-in-out",
|
|
1299
|
-
_hover: { zIndex: 1 },
|
|
1300
|
-
_focusWithin: {
|
|
1301
|
-
borderColor: Jn,
|
|
1302
|
-
zIndex: 1
|
|
1303
|
-
},
|
|
1304
|
-
onPasteCapture: L ? void 0 : ue.onPasteCapture,
|
|
1305
|
-
onDropCapture: L ? void 0 : ue.onDropCapture,
|
|
1306
|
-
onDragOver: L ? void 0 : ue.onDragOver,
|
|
1307
|
-
onClick: W,
|
|
1350
|
+
className: "ps-chat-composer__input",
|
|
1351
|
+
css: L.input,
|
|
1352
|
+
onPasteCapture: I ? void 0 : le.onPasteCapture,
|
|
1353
|
+
onDropCapture: I ? void 0 : le.onDropCapture,
|
|
1354
|
+
onDragOver: I ? void 0 : le.onDragOver,
|
|
1355
|
+
onClick: ie,
|
|
1308
1356
|
children: /* @__PURE__ */ Y(F, {
|
|
1309
1357
|
direction: "column",
|
|
1310
1358
|
color: "fg",
|
|
1311
1359
|
gap: "xs",
|
|
1312
1360
|
children: [
|
|
1313
|
-
/* @__PURE__ */ J(
|
|
1314
|
-
request:
|
|
1315
|
-
question:
|
|
1316
|
-
decision:
|
|
1361
|
+
/* @__PURE__ */ J(Vn, {
|
|
1362
|
+
request: P,
|
|
1363
|
+
question: x,
|
|
1364
|
+
decision: S,
|
|
1317
1365
|
actions: _,
|
|
1318
1366
|
disabled: f,
|
|
1319
1367
|
submitDisabled: p,
|
|
1320
|
-
onSubmit: (e, t) =>
|
|
1368
|
+
onSubmit: (e, t) => Mt({
|
|
1321
1369
|
text: e,
|
|
1322
1370
|
response: t,
|
|
1323
1371
|
attachments: u,
|
|
@@ -1326,7 +1374,7 @@ var Gn = (e, t, n) => {
|
|
|
1326
1374
|
})
|
|
1327
1375
|
}),
|
|
1328
1376
|
/* @__PURE__ */ Y(A, {
|
|
1329
|
-
display:
|
|
1377
|
+
display: I ? "none" : void 0,
|
|
1330
1378
|
children: [g ? /* @__PURE__ */ J(A, {
|
|
1331
1379
|
mb: "xs",
|
|
1332
1380
|
children: g
|
|
@@ -1341,43 +1389,43 @@ var Gn = (e, t, n) => {
|
|
|
1341
1389
|
ref: U.editorRef,
|
|
1342
1390
|
onRecallPrevious: U.recallPrevious,
|
|
1343
1391
|
onRecallNext: U.recallNext,
|
|
1344
|
-
defaultState:
|
|
1345
|
-
initialSelection:
|
|
1346
|
-
onSelectionChange:
|
|
1347
|
-
isEditable: !f && !R && !
|
|
1348
|
-
focusRequested:
|
|
1349
|
-
onFocusRequestComplete:
|
|
1350
|
-
placeholder: /* @__PURE__ */ J(
|
|
1392
|
+
defaultState: B,
|
|
1393
|
+
initialSelection: O,
|
|
1394
|
+
onSelectionChange: k,
|
|
1395
|
+
isEditable: !f && !R && !I,
|
|
1396
|
+
focusRequested: re.requested,
|
|
1397
|
+
onFocusRequestComplete: re.complete,
|
|
1398
|
+
placeholder: /* @__PURE__ */ J(Xn, { placeholder: h }),
|
|
1351
1399
|
onChange: (e, t) => {
|
|
1352
|
-
|
|
1400
|
+
V(JSON.stringify(t)), j?.(e, JSON.stringify(t)), U.change(e);
|
|
1353
1401
|
},
|
|
1354
|
-
onSubmit: () =>
|
|
1355
|
-
commands:
|
|
1356
|
-
},
|
|
1402
|
+
onSubmit: () => K(Et(G)),
|
|
1403
|
+
commands: N
|
|
1404
|
+
}, ee)
|
|
1357
1405
|
})
|
|
1358
1406
|
})]
|
|
1359
1407
|
}),
|
|
1360
|
-
|
|
1408
|
+
I ? null : /* @__PURE__ */ J(jt, {
|
|
1361
1409
|
actions: /* @__PURE__ */ Y(pe, { children: [y, _] }),
|
|
1362
1410
|
questionPrompt: !1,
|
|
1363
1411
|
skipDisabled: !1,
|
|
1364
1412
|
skipTitle: "",
|
|
1365
1413
|
onSkip: () => {},
|
|
1366
|
-
buttonAction:
|
|
1367
|
-
submitTitle:
|
|
1368
|
-
submitLabel:
|
|
1414
|
+
buttonAction: oe,
|
|
1415
|
+
submitTitle: T,
|
|
1416
|
+
submitLabel: D,
|
|
1369
1417
|
submitActions: v,
|
|
1370
|
-
messageTitle:
|
|
1371
|
-
runAction:
|
|
1418
|
+
messageTitle: se,
|
|
1419
|
+
runAction: K
|
|
1372
1420
|
})
|
|
1373
1421
|
]
|
|
1374
1422
|
})
|
|
1375
1423
|
});
|
|
1376
|
-
},
|
|
1424
|
+
}, Qn = {
|
|
1377
1425
|
animationName: "message-fade-in",
|
|
1378
1426
|
animationDuration: "200ms",
|
|
1379
1427
|
animationTimingFunction: "ease-out"
|
|
1380
|
-
},
|
|
1428
|
+
}, $n = (e) => {
|
|
1381
1429
|
let t = /* @__PURE__ */ new Set(), n = new Set(e.state.seenKeys);
|
|
1382
1430
|
for (let r of e.itemKeys) e.state.initialized && !n.has(r) && t.add(r), n.add(r);
|
|
1383
1431
|
return {
|
|
@@ -1387,17 +1435,17 @@ var Gn = (e, t, n) => {
|
|
|
1387
1435
|
seenKeys: n
|
|
1388
1436
|
}
|
|
1389
1437
|
};
|
|
1390
|
-
},
|
|
1438
|
+
}, er = (e, t) => {
|
|
1391
1439
|
if (e.length !== t.length) return !1;
|
|
1392
1440
|
for (let n = 0; n < e.length; n += 1) if (e[n] !== t[n]) return !1;
|
|
1393
1441
|
return !0;
|
|
1394
|
-
},
|
|
1442
|
+
}, tr = (e) => {
|
|
1395
1443
|
let t = Z({
|
|
1396
1444
|
initialized: !1,
|
|
1397
1445
|
seenKeys: /* @__PURE__ */ new Set()
|
|
1398
1446
|
}), n = Z(null);
|
|
1399
|
-
if (n.current &&
|
|
1400
|
-
let r =
|
|
1447
|
+
if (n.current && er(n.current.itemKeys, e)) return n.current.animatedKeys;
|
|
1448
|
+
let r = $n({
|
|
1401
1449
|
itemKeys: e,
|
|
1402
1450
|
state: t.current
|
|
1403
1451
|
});
|
|
@@ -1405,15 +1453,15 @@ var Gn = (e, t, n) => {
|
|
|
1405
1453
|
itemKeys: [...e],
|
|
1406
1454
|
animatedKeys: r.animatedKeys
|
|
1407
1455
|
}, r.animatedKeys;
|
|
1408
|
-
},
|
|
1456
|
+
}, nr = (e) => e.type === "text", rr = (e) => (e.parts ?? []).filter(nr).map((e) => e.text.trim()).filter(Boolean).join("\n\n"), ir = (e, t, n) => e.delivery === "unsent" ? "Not sent" : e.createdAt ? new Intl.DateTimeFormat(t, {
|
|
1409
1457
|
hour: "numeric",
|
|
1410
1458
|
minute: "2-digit",
|
|
1411
1459
|
timeZone: n
|
|
1412
|
-
}).format(new Date(e.createdAt)) : "",
|
|
1460
|
+
}).format(new Date(e.createdAt)) : "", ar = (e) => {
|
|
1413
1461
|
let n = q(20), { message: r, alwaysVisible: i, copyAlwaysVisible: a } = e, o = i !== void 0 && i, s = a === void 0 ? o : a, [c, l] = Q(!1), u = Z(null), d;
|
|
1414
|
-
n[0] === r ? d = n[1] : (d =
|
|
1462
|
+
n[0] === r ? d = n[1] : (d = rr(r), n[0] = r, n[1] = d);
|
|
1415
1463
|
let f = d, p;
|
|
1416
|
-
n[2] === r ? p = n[3] : (p =
|
|
1464
|
+
n[2] === r ? p = n[3] : (p = ir(r), n[2] = r, n[3] = p);
|
|
1417
1465
|
let m = p, h, g;
|
|
1418
1466
|
n[4] === Symbol.for("react.memo_cache_sentinel") ? (h = () => () => {
|
|
1419
1467
|
u.current !== null && window.clearTimeout(u.current);
|
|
@@ -1439,10 +1487,10 @@ var Gn = (e, t, n) => {
|
|
|
1439
1487
|
opacity: s ? "1" : "0",
|
|
1440
1488
|
pointerEvents: s ? "auto" : "none",
|
|
1441
1489
|
transition: "opacity 120ms ease",
|
|
1442
|
-
css:
|
|
1490
|
+
css: or,
|
|
1443
1491
|
children: /* @__PURE__ */ J(t, {
|
|
1444
1492
|
content: c ? "Copied" : "Copy message",
|
|
1445
|
-
children: /* @__PURE__ */ J(
|
|
1493
|
+
children: /* @__PURE__ */ J(R, {
|
|
1446
1494
|
"aria-label": c ? "Copied" : "Copy message",
|
|
1447
1495
|
variant: "ghost",
|
|
1448
1496
|
size: "2xs",
|
|
@@ -1459,10 +1507,10 @@ var Gn = (e, t, n) => {
|
|
|
1459
1507
|
opacity: y,
|
|
1460
1508
|
pointerEvents: b,
|
|
1461
1509
|
transition: "opacity 120ms ease",
|
|
1462
|
-
css:
|
|
1510
|
+
css: or,
|
|
1463
1511
|
children: [x, S]
|
|
1464
1512
|
}), n[15] = S, n[16] = y, n[17] = b, n[18] = x, n[19] = C) : C = n[19], C;
|
|
1465
|
-
},
|
|
1513
|
+
}, or = {
|
|
1466
1514
|
"[data-chat-message-with-actions]:hover &, [data-chat-message-with-actions]:focus-within &": {
|
|
1467
1515
|
opacity: 1,
|
|
1468
1516
|
pointerEvents: "auto"
|
|
@@ -1475,7 +1523,7 @@ var Gn = (e, t, n) => {
|
|
|
1475
1523
|
opacity: 1,
|
|
1476
1524
|
pointerEvents: "auto"
|
|
1477
1525
|
}
|
|
1478
|
-
},
|
|
1526
|
+
}, sr = (e) => {
|
|
1479
1527
|
let t = q(12), n, r, i, a;
|
|
1480
1528
|
t[0] === e ? (n = t[1], r = t[2], i = t[3], a = t[4]) : ({children: n, linkHandler: r, streaming: a, ...i} = e, t[0] = e, t[1] = n, t[2] = r, t[3] = i, t[4] = a);
|
|
1481
1529
|
let o;
|
|
@@ -1490,16 +1538,16 @@ var Gn = (e, t, n) => {
|
|
|
1490
1538
|
...i,
|
|
1491
1539
|
children: o
|
|
1492
1540
|
}), t[9] = i, t[10] = o, t[11] = s) : s = t[11], s;
|
|
1493
|
-
},
|
|
1494
|
-
let t = q(12), { part: n } = e, r =
|
|
1541
|
+
}, cr = (e) => {
|
|
1542
|
+
let t = q(12), { part: n } = e, r = fn(n.state?.input), i = Sn(), a;
|
|
1495
1543
|
t[0] === Symbol.for("react.memo_cache_sentinel") ? (a = { recipe: f }, t[0] = a) : a = t[0];
|
|
1496
1544
|
let o = de(a);
|
|
1497
1545
|
if (!r) return null;
|
|
1498
1546
|
let s;
|
|
1499
|
-
t[1] === n ? s = t[2] : (s =
|
|
1547
|
+
t[1] === n ? s = t[2] : (s = gn(n), t[1] = n, t[2] = s);
|
|
1500
1548
|
let c = s, l = c && !!i, u = W, d;
|
|
1501
1549
|
t[3] !== l || t[4] !== i || t[5] !== n || t[6] !== c || t[7] !== o ? (d = (e, t) => {
|
|
1502
|
-
let r =
|
|
1550
|
+
let r = bn(n, t) ?? e.options[0]?.label ?? "Your answer", a = i?.activeKey === hn(n) && i?.selection?.index === t;
|
|
1503
1551
|
return /* @__PURE__ */ Y(K.button, {
|
|
1504
1552
|
type: "button",
|
|
1505
1553
|
css: o({ multiline: e.question.includes("\n") }),
|
|
@@ -1526,14 +1574,14 @@ var Gn = (e, t, n) => {
|
|
|
1526
1574
|
align: "start",
|
|
1527
1575
|
children: p
|
|
1528
1576
|
}), t[9] = u, t[10] = p, t[11] = m) : m = t[11], m;
|
|
1529
|
-
},
|
|
1530
|
-
let t =
|
|
1577
|
+
}, lr = (e) => e.replace(/^tool-/i, "").replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[\s-]+/g, "_").toLowerCase(), ur = (e) => {
|
|
1578
|
+
let t = lr(e), n = t.replace(/_/g, "");
|
|
1531
1579
|
return [.../* @__PURE__ */ new Set([
|
|
1532
1580
|
e,
|
|
1533
1581
|
t,
|
|
1534
1582
|
n
|
|
1535
1583
|
])];
|
|
1536
|
-
},
|
|
1584
|
+
}, dr = {
|
|
1537
1585
|
shell: Ge,
|
|
1538
1586
|
ls: Re,
|
|
1539
1587
|
read_file: Ne,
|
|
@@ -1543,7 +1591,7 @@ var Gn = (e, t, n) => {
|
|
|
1543
1591
|
upload_files: Pe,
|
|
1544
1592
|
download_file: je,
|
|
1545
1593
|
move_file: Be
|
|
1546
|
-
},
|
|
1594
|
+
}, fr = {
|
|
1547
1595
|
dot: Oe,
|
|
1548
1596
|
danger: be,
|
|
1549
1597
|
search: He,
|
|
@@ -1552,11 +1600,11 @@ var Gn = (e, t, n) => {
|
|
|
1552
1600
|
question: Ee,
|
|
1553
1601
|
todo: Le,
|
|
1554
1602
|
terminal: Ge,
|
|
1555
|
-
...
|
|
1556
|
-
},
|
|
1557
|
-
if (!e) return
|
|
1558
|
-
let t =
|
|
1559
|
-
if (
|
|
1603
|
+
...dr
|
|
1604
|
+
}, pr = "dot", mr = (e) => Object.hasOwn(dr, e), hr = (e) => fr[e], gr = (e) => {
|
|
1605
|
+
if (!e) return pr;
|
|
1606
|
+
let t = lr(e);
|
|
1607
|
+
if (mr(t)) return t;
|
|
1560
1608
|
let n = t.replace(/_/g, "");
|
|
1561
1609
|
switch (t) {
|
|
1562
1610
|
case "read": return "file";
|
|
@@ -1571,79 +1619,79 @@ var Gn = (e, t, n) => {
|
|
|
1571
1619
|
case "question": return "question";
|
|
1572
1620
|
case "fs":
|
|
1573
1621
|
case "file": return "file";
|
|
1574
|
-
default: return n === "todowrite" || n === "todo" ? "todo" :
|
|
1622
|
+
default: return n === "todowrite" || n === "todo" ? "todo" : pr;
|
|
1575
1623
|
}
|
|
1576
1624
|
};
|
|
1577
1625
|
//#endregion
|
|
1578
1626
|
//#region src/components/chat-ui/utils/diff.ts
|
|
1579
|
-
function
|
|
1627
|
+
function _r(e) {
|
|
1580
1628
|
let t = e.lastIndexOf("/");
|
|
1581
1629
|
return t >= 0 ? e.slice(t + 1) : e;
|
|
1582
1630
|
}
|
|
1583
|
-
function
|
|
1631
|
+
function vr(e) {
|
|
1584
1632
|
if (!e) return null;
|
|
1585
1633
|
let t = e.split(" ")[0].trim();
|
|
1586
1634
|
if (t === "/dev/null") return null;
|
|
1587
1635
|
let n = t;
|
|
1588
1636
|
return (n.startsWith("a/") || n.startsWith("b/")) && (n = n.slice(2)), n.replace(/^\/+/, "").replace(/\\/g, "/");
|
|
1589
1637
|
}
|
|
1590
|
-
var
|
|
1638
|
+
var yr = (e) => e.startsWith("--- "), br = (e) => e.startsWith("+++ "), xr = (e) => e.startsWith("@@"), Sr = (e) => e.startsWith("+") && !(br(e) || e === "+++"), Cr = (e) => e.startsWith("-") && !(yr(e) || e === "---"), wr = (e, t) => {
|
|
1591
1639
|
e.has(t) || e.set(t, {
|
|
1592
1640
|
additions: 0,
|
|
1593
1641
|
deletions: 0
|
|
1594
1642
|
});
|
|
1595
|
-
},
|
|
1643
|
+
}, Tr = (e, t) => {
|
|
1596
1644
|
let n = e.get(t);
|
|
1597
1645
|
n && (n.additions += 1);
|
|
1598
|
-
},
|
|
1646
|
+
}, Er = (e, t) => {
|
|
1599
1647
|
let n = e.get(t);
|
|
1600
1648
|
n && (n.deletions += 1);
|
|
1601
|
-
},
|
|
1602
|
-
if (
|
|
1649
|
+
}, Dr = (e, t, n) => {
|
|
1650
|
+
if (yr(e)) return {
|
|
1603
1651
|
...t,
|
|
1604
|
-
lastMinusHeader:
|
|
1652
|
+
lastMinusHeader: vr(e.slice(4)),
|
|
1605
1653
|
inHunk: !1
|
|
1606
1654
|
};
|
|
1607
|
-
if (
|
|
1608
|
-
let r =
|
|
1609
|
-
return r &&
|
|
1655
|
+
if (br(e)) {
|
|
1656
|
+
let r = vr(e.slice(4)) ?? t.lastMinusHeader;
|
|
1657
|
+
return r && wr(n, r), {
|
|
1610
1658
|
...t,
|
|
1611
1659
|
currentPath: r,
|
|
1612
1660
|
inHunk: !1
|
|
1613
1661
|
};
|
|
1614
1662
|
}
|
|
1615
|
-
return t.currentPath ?
|
|
1663
|
+
return t.currentPath ? xr(e) ? {
|
|
1616
1664
|
...t,
|
|
1617
1665
|
inHunk: !0
|
|
1618
|
-
} : t.inHunk ?
|
|
1666
|
+
} : t.inHunk ? Sr(e) ? (Tr(n, t.currentPath), t) : (Cr(e) && Er(n, t.currentPath), t) : t : t;
|
|
1619
1667
|
};
|
|
1620
|
-
function
|
|
1668
|
+
function Or(e) {
|
|
1621
1669
|
if (!e || typeof e != "string") return [];
|
|
1622
1670
|
let t = /* @__PURE__ */ new Map(), n = {
|
|
1623
1671
|
currentPath: null,
|
|
1624
1672
|
lastMinusHeader: null,
|
|
1625
1673
|
inHunk: !1
|
|
1626
1674
|
}, r = e.split(/\r?\n/);
|
|
1627
|
-
for (let e of r) n =
|
|
1675
|
+
for (let e of r) n = Dr(e, n, t);
|
|
1628
1676
|
return Array.from(t.entries()).map(([e, { additions: t, deletions: n }]) => ({
|
|
1629
1677
|
filePath: e,
|
|
1630
1678
|
additions: t,
|
|
1631
1679
|
deletions: n
|
|
1632
1680
|
}));
|
|
1633
1681
|
}
|
|
1634
|
-
function
|
|
1635
|
-
return
|
|
1682
|
+
function kr(e) {
|
|
1683
|
+
return Or(e).map((e) => ({
|
|
1636
1684
|
kind: "diff",
|
|
1637
|
-
fileName:
|
|
1685
|
+
fileName: _r(e.filePath),
|
|
1638
1686
|
filePath: e.filePath,
|
|
1639
1687
|
additions: e.additions,
|
|
1640
1688
|
deletions: e.deletions
|
|
1641
1689
|
}));
|
|
1642
1690
|
}
|
|
1643
|
-
function
|
|
1644
|
-
return
|
|
1691
|
+
function Ar(e) {
|
|
1692
|
+
return Or(e).map((e) => e.filePath);
|
|
1645
1693
|
}
|
|
1646
|
-
var
|
|
1694
|
+
var jr = (e) => yr(e) || e.startsWith("diff --git "), Mr = (e) => e.startsWith(" ") || e.startsWith("+") || e.startsWith("-") ? !1 : e.trim() !== "", Nr = (e, t, n) => {
|
|
1647
1695
|
if (e.startsWith(" ")) {
|
|
1648
1696
|
let r = e.slice(1);
|
|
1649
1697
|
t.push(r), n.push(r);
|
|
@@ -1654,26 +1702,26 @@ var kr = (e) => _r(e) || e.startsWith("diff --git "), Ar = (e) => e.startsWith("
|
|
|
1654
1702
|
return;
|
|
1655
1703
|
}
|
|
1656
1704
|
e.startsWith("+") && n.push(e.slice(1));
|
|
1657
|
-
},
|
|
1705
|
+
}, Pr = (e, t, n, r) => {
|
|
1658
1706
|
let i = t;
|
|
1659
1707
|
for (; i < e.length;) {
|
|
1660
1708
|
let t = e[i] || "";
|
|
1661
|
-
if (
|
|
1662
|
-
|
|
1709
|
+
if (jr(t) || xr(t) || Mr(t)) break;
|
|
1710
|
+
Nr(t, n, r), i += 1;
|
|
1663
1711
|
}
|
|
1664
1712
|
return (n.length > 0 || r.length > 0) && (n.push(""), r.push("")), i;
|
|
1665
|
-
},
|
|
1666
|
-
let n =
|
|
1667
|
-
if (!
|
|
1668
|
-
let i =
|
|
1713
|
+
}, Fr = (e, t) => {
|
|
1714
|
+
let n = vr((e[t] || "").slice(4)), r = e[t + 1] || "";
|
|
1715
|
+
if (!br(r)) return { nextIndex: t + 1 };
|
|
1716
|
+
let i = vr(r.slice(4)) ?? n ?? "", a = [], o = [], s = t + 2;
|
|
1669
1717
|
for (; s < e.length;) {
|
|
1670
1718
|
let t = e[s] || "";
|
|
1671
|
-
if (
|
|
1672
|
-
if (!
|
|
1719
|
+
if (jr(t)) break;
|
|
1720
|
+
if (!xr(t)) {
|
|
1673
1721
|
s += 1;
|
|
1674
1722
|
continue;
|
|
1675
1723
|
}
|
|
1676
|
-
s =
|
|
1724
|
+
s = Pr(e, s + 1, a, o);
|
|
1677
1725
|
}
|
|
1678
1726
|
return {
|
|
1679
1727
|
nextIndex: s,
|
|
@@ -1684,22 +1732,22 @@ var kr = (e) => _r(e) || e.startsWith("diff --git "), Ar = (e) => e.startsWith("
|
|
|
1684
1732
|
}
|
|
1685
1733
|
};
|
|
1686
1734
|
};
|
|
1687
|
-
function
|
|
1735
|
+
function Ir(e) {
|
|
1688
1736
|
if (!e || typeof e != "string") return [];
|
|
1689
1737
|
let t = e.split(/\r?\n/), n = [], r = 0;
|
|
1690
1738
|
for (; r < t.length;) {
|
|
1691
|
-
if (!
|
|
1739
|
+
if (!yr(t[r] || "")) {
|
|
1692
1740
|
r += 1;
|
|
1693
1741
|
continue;
|
|
1694
1742
|
}
|
|
1695
|
-
let { nextIndex: e, preview: i } =
|
|
1743
|
+
let { nextIndex: e, preview: i } = Fr(t, r);
|
|
1696
1744
|
i && n.push(i), r = Math.max(e, r + 1);
|
|
1697
1745
|
}
|
|
1698
1746
|
return n;
|
|
1699
1747
|
}
|
|
1700
1748
|
//#endregion
|
|
1701
1749
|
//#region src/components/chat-ui/tool-rendering/shared.ts
|
|
1702
|
-
var
|
|
1750
|
+
var Lr = {
|
|
1703
1751
|
apply_patch: "Apply patch",
|
|
1704
1752
|
bash: "Run command",
|
|
1705
1753
|
edit: "Edit file",
|
|
@@ -1708,34 +1756,34 @@ var Fr = {
|
|
|
1708
1756
|
read: "Read file",
|
|
1709
1757
|
skill: "Load skill",
|
|
1710
1758
|
todowrite: "Update todos"
|
|
1711
|
-
},
|
|
1759
|
+
}, Rr = {
|
|
1712
1760
|
error: "failed",
|
|
1713
1761
|
"output-error": "failed",
|
|
1714
1762
|
input_streaming: "running",
|
|
1715
1763
|
running: "running",
|
|
1716
1764
|
completed: "completed",
|
|
1717
1765
|
failed: "failed"
|
|
1718
|
-
},
|
|
1719
|
-
let t =
|
|
1720
|
-
return
|
|
1721
|
-
},
|
|
1766
|
+
}, zr = (e) => e.replace(/^tool-/, "").toLowerCase(), Br = (e) => e.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), Vr = (e) => zr(e.tool ?? "tool"), Hr = (e) => {
|
|
1767
|
+
let t = zr(e);
|
|
1768
|
+
return Lr[t] ?? Br(t.replace(/_/g, " "));
|
|
1769
|
+
}, Ur = (e) => {
|
|
1722
1770
|
let t = e.state?.status ?? e.status;
|
|
1723
1771
|
if (!t || typeof t != "string") return null;
|
|
1724
1772
|
let n = t.replace(/-/g, "_");
|
|
1725
|
-
return
|
|
1726
|
-
},
|
|
1773
|
+
return Rr[n] ? Rr[n] : n.includes("stream") ? "running" : null;
|
|
1774
|
+
}, Wr = (e) => {
|
|
1727
1775
|
let t = e.state?.status ?? e.status;
|
|
1728
1776
|
return t === "error" || t === "output-error" || t === "failed";
|
|
1729
|
-
},
|
|
1777
|
+
}, Gr = (e) => Wr(e) ? {
|
|
1730
1778
|
type: "icon",
|
|
1731
1779
|
icon: "danger"
|
|
1732
1780
|
} : {
|
|
1733
1781
|
type: "icon",
|
|
1734
|
-
icon:
|
|
1735
|
-
},
|
|
1782
|
+
icon: gr(Vr(e))
|
|
1783
|
+
}, Kr = (e, t, n, r) => {
|
|
1736
1784
|
let i = [{
|
|
1737
1785
|
kind: "text",
|
|
1738
|
-
text: n ??
|
|
1786
|
+
text: n ?? Hr(e.tool ?? "tool"),
|
|
1739
1787
|
bold: !0
|
|
1740
1788
|
}];
|
|
1741
1789
|
t && i.push({
|
|
@@ -1747,100 +1795,100 @@ var Fr = {
|
|
|
1747
1795
|
monospace: !0
|
|
1748
1796
|
} : {}
|
|
1749
1797
|
});
|
|
1750
|
-
let a =
|
|
1798
|
+
let a = Ur(e);
|
|
1751
1799
|
return a && a !== "completed" && i.push({
|
|
1752
1800
|
kind: "text",
|
|
1753
1801
|
text: a,
|
|
1754
1802
|
muted: !0
|
|
1755
1803
|
}), i;
|
|
1756
|
-
},
|
|
1804
|
+
}, qr = (e) => {
|
|
1757
1805
|
let t = e.state?.input;
|
|
1758
1806
|
return !t || typeof t != "object" || Array.isArray(t) ? null : t;
|
|
1759
|
-
},
|
|
1807
|
+
}, Jr = (e) => {
|
|
1760
1808
|
let t = e.state?.output;
|
|
1761
1809
|
return !t || typeof t != "object" || Array.isArray(t) ? null : t;
|
|
1762
|
-
}, $ = (e) => typeof e == "string" && e.trim().length > 0 ? e : null,
|
|
1763
|
-
let n =
|
|
1764
|
-
return n ?
|
|
1765
|
-
},
|
|
1766
|
-
let t =
|
|
1767
|
-
return [
|
|
1768
|
-
},
|
|
1769
|
-
let t =
|
|
1810
|
+
}, $ = (e) => typeof e == "string" && e.trim().length > 0 ? e : null, Yr = (e) => !e || typeof e != "object" || Array.isArray(e) ? null : e, Xr = (e, t) => {
|
|
1811
|
+
let n = Yr(e.state);
|
|
1812
|
+
return n ? Yr(n[t]) : null;
|
|
1813
|
+
}, Zr = (e) => e.replace(/\\/g, "/").replace(/^\/+/, ""), Qr = (e) => e.includes("--- ") && e.includes("+++ ") && e.includes("@@"), $r = (e) => {
|
|
1814
|
+
let t = Jr(e);
|
|
1815
|
+
return [Xr(e, "metadata"), Yr(t?.metadata)].filter(Boolean);
|
|
1816
|
+
}, ei = (e) => {
|
|
1817
|
+
let t = Yr(e);
|
|
1770
1818
|
if (!t) return null;
|
|
1771
1819
|
let n = $(t.filePath) ?? $(t.relativePath) ?? $(t.path);
|
|
1772
1820
|
return n ? {
|
|
1773
|
-
filePath:
|
|
1821
|
+
filePath: Zr(n),
|
|
1774
1822
|
additions: typeof t.additions == "number" ? t.additions : 0,
|
|
1775
1823
|
deletions: typeof t.deletions == "number" ? t.deletions : 0,
|
|
1776
1824
|
diff: $(t.diff) ?? void 0,
|
|
1777
1825
|
before: $(t.before) ?? void 0,
|
|
1778
1826
|
after: $(t.after) ?? void 0
|
|
1779
1827
|
} : null;
|
|
1780
|
-
},
|
|
1828
|
+
}, ti = (e) => {
|
|
1781
1829
|
let t = [];
|
|
1782
|
-
for (let n of
|
|
1830
|
+
for (let n of $r(e)) {
|
|
1783
1831
|
let e = Array.isArray(n.files) ? n.files : [];
|
|
1784
1832
|
for (let n of e) {
|
|
1785
|
-
let e =
|
|
1833
|
+
let e = ei(n);
|
|
1786
1834
|
e && t.push(e);
|
|
1787
1835
|
}
|
|
1788
1836
|
}
|
|
1789
1837
|
return t;
|
|
1790
|
-
},
|
|
1791
|
-
let t =
|
|
1838
|
+
}, ni = (e) => {
|
|
1839
|
+
let t = qr(e), n = (Array.isArray(t?.changes) ? t.changes : []).map((e) => $(Yr(e)?.path)).filter((e) => !!e).map(Zr);
|
|
1792
1840
|
return Array.from(new Set(n));
|
|
1793
|
-
},
|
|
1794
|
-
let t =
|
|
1841
|
+
}, ri = (e) => {
|
|
1842
|
+
let t = qr(e), n = $(t?.diff);
|
|
1795
1843
|
if (n) return n;
|
|
1796
|
-
for (let t of
|
|
1844
|
+
for (let t of $r(e)) {
|
|
1797
1845
|
let e = $(t.diff);
|
|
1798
1846
|
if (e) return e;
|
|
1799
1847
|
}
|
|
1800
|
-
let r =
|
|
1848
|
+
let r = ti(e).map((e) => e.diff).filter((e) => !!e);
|
|
1801
1849
|
if (r.length > 0) return r.join("\n");
|
|
1802
1850
|
let i = $(t?.patchText);
|
|
1803
|
-
return i &&
|
|
1804
|
-
},
|
|
1851
|
+
return i && Qr(i) ? i : null;
|
|
1852
|
+
}, ii = (e) => {
|
|
1805
1853
|
let t = /* @__PURE__ */ new Set(), n = [];
|
|
1806
1854
|
for (let r of e) t.has(r.filePath) || (t.add(r.filePath), n.push({
|
|
1807
1855
|
kind: "diff",
|
|
1808
|
-
fileName:
|
|
1856
|
+
fileName: _r(r.filePath),
|
|
1809
1857
|
filePath: r.filePath,
|
|
1810
1858
|
additions: r.additions,
|
|
1811
1859
|
deletions: r.deletions
|
|
1812
1860
|
}));
|
|
1813
1861
|
return n;
|
|
1814
|
-
},
|
|
1815
|
-
let t =
|
|
1862
|
+
}, ai = (e) => Array.from(new Set(e.map((e) => e.filePath))), oi = (e) => {
|
|
1863
|
+
let t = Jr(e);
|
|
1816
1864
|
return $(e.state?.output) ?? $(t?.returnDisplay) ?? $(t?.preview) ?? $(t?.stdout) ?? $(t?.content);
|
|
1817
|
-
},
|
|
1865
|
+
}, si = (e) => {
|
|
1818
1866
|
let t = e.match(/<skill_content(?:\s+name="([^"]+)")?>([\s\S]*?)<\/skill_content>/);
|
|
1819
1867
|
return t ? {
|
|
1820
1868
|
skillName: $(t[1]) ?? void 0,
|
|
1821
1869
|
content: $(t[2]) ?? ""
|
|
1822
1870
|
} : null;
|
|
1823
|
-
},
|
|
1824
|
-
let t =
|
|
1871
|
+
}, ci = (e) => {
|
|
1872
|
+
let t = qr(e);
|
|
1825
1873
|
return $(t?.name) ?? $(t?.skillName) ?? $(t?.skill) ?? $(t?.skill_name) ?? void 0;
|
|
1826
|
-
},
|
|
1874
|
+
}, li = (e, t) => ({
|
|
1827
1875
|
kind: "link",
|
|
1828
|
-
text:
|
|
1876
|
+
text: _r(e),
|
|
1829
1877
|
filePath: e,
|
|
1830
1878
|
...t ? { variant: t } : {}
|
|
1831
|
-
}),
|
|
1879
|
+
}), ui = (e, t) => !Wr(e) || !e.state?.errorText ? t : [{
|
|
1832
1880
|
type: "comment",
|
|
1833
1881
|
text: e.state.errorText
|
|
1834
|
-
}, ...t],
|
|
1882
|
+
}, ...t], di = (e) => Ir(e ?? void 0).map((e) => ({
|
|
1835
1883
|
type: "diff",
|
|
1836
1884
|
language: "diff",
|
|
1837
1885
|
original: e.original,
|
|
1838
1886
|
modified: e.modified,
|
|
1839
1887
|
sideBySide: !1
|
|
1840
|
-
})),
|
|
1841
|
-
let t =
|
|
1842
|
-
a.length > 0 ? i.push(...a) : n.length > 0 ? i.push(...
|
|
1843
|
-
let o = [...
|
|
1888
|
+
})), fi = (e) => kr(e ?? void 0), pi = (e) => Ar(e ?? void 0), mi = (e) => {
|
|
1889
|
+
let t = ri(e), n = ti(e), r = ni(e), i = Kr(e, void 0, "Apply patch"), a = fi(t);
|
|
1890
|
+
a.length > 0 ? i.push(...a) : n.length > 0 ? i.push(...ii(n)) : i.push(...r.map((e) => li(e, "bubble")));
|
|
1891
|
+
let o = [...di(t)];
|
|
1844
1892
|
if (o.length === 0) for (let e of n) (e.before || e.after) && o.push({
|
|
1845
1893
|
type: "diff",
|
|
1846
1894
|
language: "diff",
|
|
@@ -1849,36 +1897,36 @@ var Fr = {
|
|
|
1849
1897
|
sideBySide: !1
|
|
1850
1898
|
});
|
|
1851
1899
|
if (o.length === 0) {
|
|
1852
|
-
let e =
|
|
1853
|
-
e.length === 0 && e.push(...
|
|
1900
|
+
let e = pi(t);
|
|
1901
|
+
e.length === 0 && e.push(...ai(n)), e.length === 0 && e.push(...r), e.length > 0 && o.push({
|
|
1854
1902
|
type: "references",
|
|
1855
1903
|
references: e
|
|
1856
1904
|
});
|
|
1857
1905
|
}
|
|
1858
1906
|
return {
|
|
1859
|
-
indicator:
|
|
1907
|
+
indicator: Gr(e),
|
|
1860
1908
|
title: i,
|
|
1861
|
-
blocks:
|
|
1909
|
+
blocks: ui(e, o)
|
|
1862
1910
|
};
|
|
1863
|
-
},
|
|
1911
|
+
}, hi = (e, t) => [{
|
|
1864
1912
|
type: "diff",
|
|
1865
1913
|
language: "text",
|
|
1866
1914
|
original: e,
|
|
1867
1915
|
modified: t,
|
|
1868
1916
|
sideBySide: !1
|
|
1869
|
-
}],
|
|
1870
|
-
let t =
|
|
1871
|
-
r && o.push(
|
|
1872
|
-
let s = i !== void 0 && a !== void 0 ?
|
|
1917
|
+
}], gi = (e) => {
|
|
1918
|
+
let t = qr(e), n = Jr(e), r = $(t?.filePath) ?? $(t?.file_path) ?? $(n?.filePath) ?? void 0, i = $(n?.oldString) ?? $(t?.old_string) ?? void 0, a = $(n?.newString) ?? $(t?.new_string) ?? void 0, o = Kr(e, void 0, "Edit file");
|
|
1919
|
+
r && o.push(li(r));
|
|
1920
|
+
let s = i !== void 0 && a !== void 0 ? hi(i, a) : di($(n?.diff));
|
|
1873
1921
|
return {
|
|
1874
|
-
indicator:
|
|
1922
|
+
indicator: Gr(e),
|
|
1875
1923
|
title: o,
|
|
1876
|
-
blocks:
|
|
1924
|
+
blocks: ui(e, s)
|
|
1877
1925
|
};
|
|
1878
|
-
},
|
|
1926
|
+
}, _i = (e) => {
|
|
1879
1927
|
let { buildBaseTitle: t, buildIndicator: n, prependErrorBlock: r } = e;
|
|
1880
1928
|
return (e) => {
|
|
1881
|
-
let i =
|
|
1929
|
+
let i = ln(e.state?.output) || ln(e.state?.metadata), a = fn(e.state?.input), o = a ? {
|
|
1882
1930
|
type: "question-form",
|
|
1883
1931
|
questions: a.questions
|
|
1884
1932
|
} : null;
|
|
@@ -1891,15 +1939,15 @@ var Fr = {
|
|
|
1891
1939
|
expandable: !1
|
|
1892
1940
|
};
|
|
1893
1941
|
};
|
|
1894
|
-
},
|
|
1895
|
-
let t =
|
|
1896
|
-
return r && i.push(
|
|
1897
|
-
indicator:
|
|
1942
|
+
}, vi = (e) => {
|
|
1943
|
+
let t = qr(e), n = Jr(e), r = $(t?.filePath) ?? $(t?.file_path) ?? $(t?.file) ?? $(n?.filePath) ?? $(n?.file) ?? $(n?.path) ?? void 0, i = Kr(e, void 0, "Read file");
|
|
1944
|
+
return r && i.push(li(r)), {
|
|
1945
|
+
indicator: Gr(e),
|
|
1898
1946
|
title: i,
|
|
1899
|
-
blocks:
|
|
1947
|
+
blocks: ui(e, [])
|
|
1900
1948
|
};
|
|
1901
|
-
},
|
|
1902
|
-
let n =
|
|
1949
|
+
}, yi = (e, t) => {
|
|
1950
|
+
let n = qr(e), r = Jr(e), i = Kr(e, $(n?.command) ?? void 0, t, "monospace"), a = [], o = oi(e);
|
|
1903
1951
|
o && a.push({
|
|
1904
1952
|
type: "code",
|
|
1905
1953
|
language: "text",
|
|
@@ -1914,23 +1962,23 @@ var Fr = {
|
|
|
1914
1962
|
type: "text",
|
|
1915
1963
|
text: `Exit code: ${r.exitCode}`
|
|
1916
1964
|
}), {
|
|
1917
|
-
indicator:
|
|
1965
|
+
indicator: Gr(e),
|
|
1918
1966
|
title: i,
|
|
1919
|
-
blocks:
|
|
1967
|
+
blocks: ui(e, a)
|
|
1920
1968
|
};
|
|
1921
|
-
},
|
|
1922
|
-
let t =
|
|
1969
|
+
}, bi = (e) => yi(e, "Run command"), xi = (e) => yi(e, "Shell"), Si = (e) => {
|
|
1970
|
+
let t = qr(e), n = oi(e), r = Kr(e, $(t?.pattern) ?? void 0, "Search files"), i = n ? [{
|
|
1923
1971
|
type: "code",
|
|
1924
1972
|
language: "text",
|
|
1925
1973
|
code: n
|
|
1926
1974
|
}] : [];
|
|
1927
1975
|
return {
|
|
1928
|
-
indicator:
|
|
1976
|
+
indicator: Gr(e),
|
|
1929
1977
|
title: r,
|
|
1930
|
-
blocks:
|
|
1978
|
+
blocks: ui(e, i)
|
|
1931
1979
|
};
|
|
1932
|
-
},
|
|
1933
|
-
let t =
|
|
1980
|
+
}, Ci = (e) => {
|
|
1981
|
+
let t = qr(e), n = oi(e), r = Kr(e, $(t?.pattern) ?? void 0, "Find files"), i = [];
|
|
1934
1982
|
if (n) {
|
|
1935
1983
|
let e = n.split(/\r?\n/).map((e) => e.trim()).filter((e) => e.length > 0);
|
|
1936
1984
|
e.length > 0 && i.push({
|
|
@@ -1939,50 +1987,50 @@ var Fr = {
|
|
|
1939
1987
|
});
|
|
1940
1988
|
}
|
|
1941
1989
|
return {
|
|
1942
|
-
indicator:
|
|
1990
|
+
indicator: Gr(e),
|
|
1943
1991
|
title: r,
|
|
1944
|
-
blocks:
|
|
1992
|
+
blocks: ui(e, i)
|
|
1945
1993
|
};
|
|
1946
|
-
},
|
|
1947
|
-
let t =
|
|
1994
|
+
}, wi = (e) => {
|
|
1995
|
+
let t = oi(e), n = t ? si(t) : null, r = Kr(e, ci(e) ?? n?.skillName, "Load skill"), i = n?.content ?? t, a = i ? [{
|
|
1948
1996
|
type: "code",
|
|
1949
1997
|
language: "markdown",
|
|
1950
1998
|
code: i
|
|
1951
1999
|
}] : [];
|
|
1952
2000
|
return {
|
|
1953
|
-
indicator:
|
|
2001
|
+
indicator: Gr(e),
|
|
1954
2002
|
title: r,
|
|
1955
|
-
blocks:
|
|
2003
|
+
blocks: ui(e, a)
|
|
1956
2004
|
};
|
|
1957
|
-
},
|
|
1958
|
-
let t =
|
|
2005
|
+
}, Ti = (e) => typeof e == "string" && e.trim().length > 0 ? e : null, Ei = (e) => !e || typeof e != "object" || Array.isArray(e) ? null : e, Di = (e) => {
|
|
2006
|
+
let t = Ei(e);
|
|
1959
2007
|
if (!t) return null;
|
|
1960
|
-
let n =
|
|
2008
|
+
let n = Ti(t.content) ?? Ti(t.title);
|
|
1961
2009
|
return n ? {
|
|
1962
2010
|
label: n,
|
|
1963
|
-
checked:
|
|
2011
|
+
checked: Ti(t.status) === "completed"
|
|
1964
2012
|
} : null;
|
|
1965
|
-
},
|
|
2013
|
+
}, Oi = (e) => {
|
|
1966
2014
|
if (!e) return {
|
|
1967
2015
|
items: [],
|
|
1968
2016
|
explicit: !1
|
|
1969
2017
|
};
|
|
1970
2018
|
let t = (() => {
|
|
1971
2019
|
if (Array.isArray(e)) return e;
|
|
1972
|
-
let t =
|
|
2020
|
+
let t = Ei(e);
|
|
1973
2021
|
return !t || !Array.isArray(t.todos) ? null : t.todos;
|
|
1974
2022
|
})();
|
|
1975
2023
|
return t ? {
|
|
1976
|
-
items: t.map(
|
|
2024
|
+
items: t.map(Di).filter((e) => e !== null),
|
|
1977
2025
|
explicit: !0
|
|
1978
2026
|
} : {
|
|
1979
2027
|
items: [],
|
|
1980
2028
|
explicit: !1
|
|
1981
2029
|
};
|
|
1982
|
-
},
|
|
2030
|
+
}, ki = (e) => {
|
|
1983
2031
|
let { buildBaseTitle: t, buildIndicator: n, prependErrorBlock: r } = e;
|
|
1984
2032
|
return (e) => {
|
|
1985
|
-
let i =
|
|
2033
|
+
let i = Oi(e.state?.input), a = Oi(e.state?.output), o = a.explicit ? a : i;
|
|
1986
2034
|
if (!o.explicit) return null;
|
|
1987
2035
|
let s = o.items, c = `${s.length} item${s.length === 1 ? "" : "s"}`, l = t(e, c, "Update todos");
|
|
1988
2036
|
if (s.length === 0) return {
|
|
@@ -2003,37 +2051,37 @@ var Fr = {
|
|
|
2003
2051
|
blocks: r(e, u)
|
|
2004
2052
|
};
|
|
2005
2053
|
};
|
|
2006
|
-
},
|
|
2007
|
-
buildBaseTitle:
|
|
2008
|
-
buildIndicator:
|
|
2009
|
-
prependErrorBlock:
|
|
2010
|
-
}),
|
|
2011
|
-
buildBaseTitle:
|
|
2012
|
-
buildIndicator:
|
|
2013
|
-
prependErrorBlock:
|
|
2014
|
-
}),
|
|
2015
|
-
apply_patch:
|
|
2016
|
-
bash:
|
|
2017
|
-
edit:
|
|
2018
|
-
glob:
|
|
2019
|
-
grep:
|
|
2020
|
-
question:
|
|
2021
|
-
read:
|
|
2022
|
-
shell:
|
|
2023
|
-
skill:
|
|
2024
|
-
todo_write:
|
|
2025
|
-
todowrite:
|
|
2026
|
-
}),
|
|
2054
|
+
}, Ai = _i({
|
|
2055
|
+
buildBaseTitle: Kr,
|
|
2056
|
+
buildIndicator: Gr,
|
|
2057
|
+
prependErrorBlock: ui
|
|
2058
|
+
}), ji = ki({
|
|
2059
|
+
buildBaseTitle: Kr,
|
|
2060
|
+
buildIndicator: Gr,
|
|
2061
|
+
prependErrorBlock: ui
|
|
2062
|
+
}), Mi = () => ({
|
|
2063
|
+
apply_patch: mi,
|
|
2064
|
+
bash: bi,
|
|
2065
|
+
edit: gi,
|
|
2066
|
+
glob: Ci,
|
|
2067
|
+
grep: Si,
|
|
2068
|
+
question: Ai,
|
|
2069
|
+
read: vi,
|
|
2070
|
+
shell: xi,
|
|
2071
|
+
skill: wi,
|
|
2072
|
+
todo_write: ji,
|
|
2073
|
+
todowrite: ji
|
|
2074
|
+
}), Ni = {
|
|
2027
2075
|
error: "failed",
|
|
2028
2076
|
"output-error": "failed",
|
|
2029
2077
|
"input-streaming": "running"
|
|
2030
|
-
},
|
|
2078
|
+
}, Pi = (e) => e.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), Fi = (e) => Pi(lr(e ?? "tool").replace(/_/g, " ")), Ii = (e) => e === "error" || e === "output-error", Li = (e) => Ii(e.state?.status) ? {
|
|
2031
2079
|
type: "icon",
|
|
2032
2080
|
icon: "danger"
|
|
2033
2081
|
} : {
|
|
2034
2082
|
type: "icon",
|
|
2035
|
-
icon:
|
|
2036
|
-
},
|
|
2083
|
+
icon: gr(e.tool ?? "tool")
|
|
2084
|
+
}, Ri = (e) => !e || typeof e != "string" ? null : Ni[e] ? Ni[e] : e.includes("stream") ? "running" : null, zi = (e) => {
|
|
2037
2085
|
if (typeof e == "string") return e;
|
|
2038
2086
|
if (e == null) return null;
|
|
2039
2087
|
try {
|
|
@@ -2041,30 +2089,30 @@ var Fr = {
|
|
|
2041
2089
|
} catch {
|
|
2042
2090
|
return null;
|
|
2043
2091
|
}
|
|
2044
|
-
},
|
|
2045
|
-
let n =
|
|
2092
|
+
}, Bi = (e) => e == null ? !0 : typeof e == "string" ? e.trim().length === 0 : Array.isArray(e) ? e.length === 0 || e.every(Bi) : typeof e == "object" && Object.values(e).every(Bi), Vi = (e) => !e || typeof e != "object" || Array.isArray(e) ? null : e, Hi = (e) => typeof e == "string" && e.trim().length > 0 ? e : null, Ui = (e) => Hi(e.mime_type) ?? Hi(e.mediaType) ?? Hi(e.mimeType), Wi = (e) => !!e?.startsWith("image/"), Gi = /\.(avif|bmp|gif|jpe?g|png|svg|webp)(\?.*)?$/i, Ki = (e, t) => {
|
|
2093
|
+
let n = Vi(e);
|
|
2046
2094
|
if (!n) return null;
|
|
2047
|
-
let r =
|
|
2048
|
-
if (i &&
|
|
2095
|
+
let r = Ui(n), i = Hi(n.data);
|
|
2096
|
+
if (i && Wi(r)) return {
|
|
2049
2097
|
type: "image",
|
|
2050
2098
|
src: `data:${r};base64,${i}`,
|
|
2051
2099
|
alt: t
|
|
2052
2100
|
};
|
|
2053
|
-
let a =
|
|
2054
|
-
return a && (
|
|
2101
|
+
let a = Hi(n.url) ?? Hi(n.src);
|
|
2102
|
+
return a && (Wi(r) || Gi.test(a)) ? {
|
|
2055
2103
|
type: "image",
|
|
2056
2104
|
src: a,
|
|
2057
2105
|
alt: t
|
|
2058
2106
|
} : null;
|
|
2059
|
-
},
|
|
2060
|
-
let t =
|
|
2107
|
+
}, qi = (e) => {
|
|
2108
|
+
let t = Vi(e);
|
|
2061
2109
|
if (!t) return null;
|
|
2062
|
-
let n =
|
|
2110
|
+
let n = Hi(t.path) ?? Hi(t.filePath) ?? Hi(t.filename), r = Hi(t.content) ?? Hi(t.body) ?? Hi(t.text);
|
|
2063
2111
|
return !n || r === null ? null : {
|
|
2064
2112
|
filePath: n,
|
|
2065
2113
|
content: r
|
|
2066
2114
|
};
|
|
2067
|
-
},
|
|
2115
|
+
}, Ji = {
|
|
2068
2116
|
css: "css",
|
|
2069
2117
|
html: "html",
|
|
2070
2118
|
js: "js",
|
|
@@ -2076,88 +2124,88 @@ var Fr = {
|
|
|
2076
2124
|
tsx: "tsx",
|
|
2077
2125
|
yaml: "yaml",
|
|
2078
2126
|
yml: "yaml"
|
|
2079
|
-
},
|
|
2127
|
+
}, Yi = (e) => {
|
|
2080
2128
|
let t = e.split(".").pop()?.toLowerCase();
|
|
2081
|
-
return t ?
|
|
2082
|
-
},
|
|
2129
|
+
return t ? Ji[t] ?? t : "text";
|
|
2130
|
+
}, Xi = (e, t) => t.length === 0 ? [] : [{
|
|
2083
2131
|
type: "text",
|
|
2084
2132
|
text: e
|
|
2085
|
-
}, ...t],
|
|
2133
|
+
}, ...t], Zi = (e, t) => {
|
|
2086
2134
|
let n = [];
|
|
2087
2135
|
for (let r of e) {
|
|
2088
|
-
let e =
|
|
2136
|
+
let e = Vi(r), i = Hi(e?.type);
|
|
2089
2137
|
if (i === "image") {
|
|
2090
|
-
let e =
|
|
2138
|
+
let e = Ki(r, t);
|
|
2091
2139
|
e && n.push(e);
|
|
2092
2140
|
continue;
|
|
2093
2141
|
}
|
|
2094
2142
|
if (i === "text") {
|
|
2095
|
-
let t =
|
|
2143
|
+
let t = Hi(e?.text);
|
|
2096
2144
|
t && n.push({
|
|
2097
2145
|
type: "text",
|
|
2098
2146
|
text: t
|
|
2099
2147
|
});
|
|
2100
2148
|
continue;
|
|
2101
2149
|
}
|
|
2102
|
-
n.push(...
|
|
2150
|
+
n.push(...ea(r, t));
|
|
2103
2151
|
}
|
|
2104
2152
|
return n;
|
|
2105
|
-
},
|
|
2106
|
-
let t =
|
|
2153
|
+
}, Qi = (e) => {
|
|
2154
|
+
let t = qi(e);
|
|
2107
2155
|
return t ? [{
|
|
2108
2156
|
type: "code",
|
|
2109
|
-
language:
|
|
2157
|
+
language: Yi(t.filePath),
|
|
2110
2158
|
code: t.content
|
|
2111
2159
|
}] : null;
|
|
2112
|
-
},
|
|
2113
|
-
let t =
|
|
2160
|
+
}, $i = (e) => {
|
|
2161
|
+
let t = Vi(e), n = Hi(t?.attachment_name) ?? Hi(t?.attachmentName), r = Hi(t?.attachment_file_id) ?? Hi(t?.attachmentFileId);
|
|
2114
2162
|
return !n && !r ? null : [{
|
|
2115
2163
|
type: "text",
|
|
2116
2164
|
text: n ?? `Attachment ${r}`
|
|
2117
2165
|
}];
|
|
2118
|
-
},
|
|
2119
|
-
if (
|
|
2120
|
-
let n =
|
|
2166
|
+
}, ea = (e, t) => {
|
|
2167
|
+
if (Bi(e)) return [];
|
|
2168
|
+
let n = Ki(e, t);
|
|
2121
2169
|
if (n) return [n];
|
|
2122
|
-
if (Array.isArray(e)) return
|
|
2123
|
-
let r =
|
|
2170
|
+
if (Array.isArray(e)) return Zi(e, t);
|
|
2171
|
+
let r = Qi(e);
|
|
2124
2172
|
if (r) return r;
|
|
2125
|
-
let i =
|
|
2173
|
+
let i = $i(e);
|
|
2126
2174
|
if (i) return i;
|
|
2127
|
-
let a =
|
|
2175
|
+
let a = zi(e);
|
|
2128
2176
|
return a?.trim() ? [{
|
|
2129
2177
|
type: "code",
|
|
2130
2178
|
language: typeof e == "string" ? "text" : "json",
|
|
2131
2179
|
code: a
|
|
2132
2180
|
}] : [];
|
|
2133
|
-
},
|
|
2134
|
-
let t = [], n =
|
|
2135
|
-
return
|
|
2181
|
+
}, ta = (e) => {
|
|
2182
|
+
let t = [], n = Fi(e.tool);
|
|
2183
|
+
return Ii(e.state?.status) && e.state?.errorText && t.push({
|
|
2136
2184
|
type: "comment",
|
|
2137
2185
|
text: e.state.errorText
|
|
2138
|
-
}), t.push(...
|
|
2139
|
-
},
|
|
2186
|
+
}), t.push(...Xi("Input", ea(e.state?.input, `${n} input`))), t.push(...Xi("Output", ea(e.state?.output, `${n} output`))), t;
|
|
2187
|
+
}, na = (e) => {
|
|
2140
2188
|
let t = [{
|
|
2141
2189
|
kind: "text",
|
|
2142
|
-
text:
|
|
2190
|
+
text: Fi(e.tool),
|
|
2143
2191
|
bold: !0
|
|
2144
|
-
}], n =
|
|
2192
|
+
}], n = qi(e.state?.output);
|
|
2145
2193
|
n && t.push({
|
|
2146
2194
|
kind: "link",
|
|
2147
2195
|
text: n.filePath,
|
|
2148
2196
|
filePath: n.filePath
|
|
2149
2197
|
});
|
|
2150
|
-
let r =
|
|
2198
|
+
let r = Ri(e.state?.status);
|
|
2151
2199
|
return r && t.push({
|
|
2152
2200
|
kind: "text",
|
|
2153
2201
|
text: r,
|
|
2154
2202
|
muted: !0
|
|
2155
2203
|
}), {
|
|
2156
|
-
indicator:
|
|
2204
|
+
indicator: Li(e),
|
|
2157
2205
|
title: t,
|
|
2158
|
-
blocks:
|
|
2206
|
+
blocks: ta(e)
|
|
2159
2207
|
};
|
|
2160
|
-
},
|
|
2208
|
+
}, ra = (e) => e.kind === "text" || e.kind === "link" ? e.text.trim().length > 0 : e.kind !== "diff" || e.fileName.trim().length > 0, ia = (e) => {
|
|
2161
2209
|
switch (e.type) {
|
|
2162
2210
|
case "comment":
|
|
2163
2211
|
case "code":
|
|
@@ -2170,50 +2218,50 @@ var Fr = {
|
|
|
2170
2218
|
case "input":
|
|
2171
2219
|
case "component": return !0;
|
|
2172
2220
|
}
|
|
2173
|
-
},
|
|
2174
|
-
let t = e.title.some(
|
|
2221
|
+
}, aa = (e) => {
|
|
2222
|
+
let t = e.title.some(ra), n = (e.blocks ?? []).some(ia);
|
|
2175
2223
|
return t || n;
|
|
2176
|
-
},
|
|
2177
|
-
...
|
|
2224
|
+
}, oa = (e) => e ? {
|
|
2225
|
+
...Mi(),
|
|
2178
2226
|
...e
|
|
2179
|
-
} :
|
|
2227
|
+
} : Mi(), sa = (e, t) => {
|
|
2180
2228
|
let n = e.tool ?? "tool";
|
|
2181
|
-
for (let e of
|
|
2229
|
+
for (let e of ur(n)) {
|
|
2182
2230
|
let n = t[e];
|
|
2183
2231
|
if (n) return n;
|
|
2184
2232
|
}
|
|
2185
|
-
},
|
|
2186
|
-
let r =
|
|
2233
|
+
}, ca = (e, t, n) => {
|
|
2234
|
+
let r = sa(e, t);
|
|
2187
2235
|
if (r) {
|
|
2188
2236
|
let t = r(e, n);
|
|
2189
2237
|
if (t) return t;
|
|
2190
2238
|
}
|
|
2191
|
-
return
|
|
2192
|
-
},
|
|
2193
|
-
let n =
|
|
2194
|
-
return { items: e.map((e) =>
|
|
2195
|
-
},
|
|
2239
|
+
return na(e);
|
|
2240
|
+
}, la = (e, t) => {
|
|
2241
|
+
let n = oa(t?.toolRenderers);
|
|
2242
|
+
return { items: e.map((e) => ca(e, n, t)).filter(aa) };
|
|
2243
|
+
}, ua = _e(() => import("./diff-editor-CGpeyoCE.js").then((e) => e.n).then((e) => ({ default: e.DiffEditor }))), da = (e) => {
|
|
2196
2244
|
let t = q(2), n;
|
|
2197
2245
|
return t[0] === e ? n = t[1] : (n = /* @__PURE__ */ J(he, {
|
|
2198
2246
|
fallback: null,
|
|
2199
|
-
children: /* @__PURE__ */ J(
|
|
2247
|
+
children: /* @__PURE__ */ J(ua, { ...e })
|
|
2200
2248
|
}), t[0] = e, t[1] = n), n;
|
|
2201
2249
|
};
|
|
2202
2250
|
//#endregion
|
|
2203
2251
|
//#region src/components/chat-ui/components/timeline-indicator.tsx
|
|
2204
|
-
function
|
|
2252
|
+
function fa(e) {
|
|
2205
2253
|
let t = q(10), { ind: n } = e;
|
|
2206
2254
|
if (!n || n.type === "none") return null;
|
|
2207
2255
|
if (n.type === "icon") {
|
|
2208
2256
|
let e;
|
|
2209
|
-
t[0] === n.icon ? e = t[1] : (e =
|
|
2257
|
+
t[0] === n.icon ? e = t[1] : (e = hr(n.icon), t[0] = n.icon, t[1] = e);
|
|
2210
2258
|
let r = e, i;
|
|
2211
2259
|
return t[2] === r ? i = t[3] : (i = /* @__PURE__ */ J(se.Indicator, {
|
|
2212
2260
|
outline: "none",
|
|
2213
2261
|
border: "none",
|
|
2214
2262
|
background: "bg",
|
|
2215
2263
|
color: "fg",
|
|
2216
|
-
children: /* @__PURE__ */ J(
|
|
2264
|
+
children: /* @__PURE__ */ J(U, {
|
|
2217
2265
|
display: "inline-flex",
|
|
2218
2266
|
alignItems: "center",
|
|
2219
2267
|
children: /* @__PURE__ */ J(r, {
|
|
@@ -2241,10 +2289,10 @@ function ua(e) {
|
|
|
2241
2289
|
}
|
|
2242
2290
|
//#endregion
|
|
2243
2291
|
//#region src/components/chat-ui/components/timeline-title.tsx
|
|
2244
|
-
var
|
|
2292
|
+
var pa = (e, t, n, r = !1) => {
|
|
2245
2293
|
r && e.stopPropagation(), t.href || e.preventDefault(), t.filePath && n?.(t.filePath);
|
|
2246
2294
|
};
|
|
2247
|
-
function
|
|
2295
|
+
function ma(e) {
|
|
2248
2296
|
let t = q(6), { seg: n } = e, r;
|
|
2249
2297
|
t[0] !== n.alt || t[1] !== n.src ? (r = /* @__PURE__ */ J(k.Image, {
|
|
2250
2298
|
src: n.src,
|
|
@@ -2262,7 +2310,7 @@ function fa(e) {
|
|
|
2262
2310
|
children: [r, i]
|
|
2263
2311
|
}), t[4] = r, t[5] = a), a;
|
|
2264
2312
|
}
|
|
2265
|
-
function
|
|
2313
|
+
function ha(e) {
|
|
2266
2314
|
let t = q(9), { seg: n, onOpenFile: r } = e, i = n.additions ?? 0, a = n.deletions ?? 0, o;
|
|
2267
2315
|
t[0] !== r || t[1] !== n.fileName || t[2] !== n.filePath ? (o = () => {
|
|
2268
2316
|
let e = n.filePath ?? n.fileName;
|
|
@@ -2276,9 +2324,9 @@ function pa(e) {
|
|
|
2276
2324
|
onClickFileLink: o
|
|
2277
2325
|
}), t[4] = n.fileName, t[5] = i, t[6] = a, t[7] = o, t[8] = s) : s = t[8], s;
|
|
2278
2326
|
}
|
|
2279
|
-
function
|
|
2327
|
+
function ga(e) {
|
|
2280
2328
|
let t = q(13), { seg: n, onOpenFile: r } = e, i = n.bold ? "medium" : void 0, a = !!(n.href || n.filePath), o = n.href ?? "#", s = (n.muted, "fg.muted"), c = a ? "pointer" : "default", l;
|
|
2281
|
-
t[0] !== r || t[1] !== n ? (l = (e) =>
|
|
2329
|
+
t[0] !== r || t[1] !== n ? (l = (e) => pa(e, n, r, !0), t[0] = r, t[1] = n, t[2] = l) : l = t[2];
|
|
2282
2330
|
let u = n.muted ? "fg.muted" : "fg.blue-dark", d;
|
|
2283
2331
|
t[3] === u ? d = t[4] : (d = {
|
|
2284
2332
|
textDecoration: "underline",
|
|
@@ -2296,9 +2344,9 @@ function ma(e) {
|
|
|
2296
2344
|
children: n.text
|
|
2297
2345
|
}), t[5] = i, t[6] = n.text, t[7] = o, t[8] = s, t[9] = c, t[10] = l, t[11] = d, t[12] = f) : f = t[12], f;
|
|
2298
2346
|
}
|
|
2299
|
-
function
|
|
2347
|
+
function _a(e) {
|
|
2300
2348
|
let t = q(12), { seg: n, onOpenFile: r } = e, i = n.bold ? "medium" : void 0, a = n.href ?? "#", o = n.muted ? "fg.muted" : "accent.primary", s;
|
|
2301
|
-
t[0] !== r || t[1] !== n ? (s = (e) =>
|
|
2349
|
+
t[0] !== r || t[1] !== n ? (s = (e) => pa(e, n, r), t[0] = r, t[1] = n, t[2] = s) : s = t[2];
|
|
2302
2350
|
let c = n.muted ? "fg.muted" : "accent.primary", l;
|
|
2303
2351
|
t[3] === c ? l = t[4] : (l = {
|
|
2304
2352
|
color: c,
|
|
@@ -2315,11 +2363,11 @@ function ha(e) {
|
|
|
2315
2363
|
children: n.text
|
|
2316
2364
|
}), t[5] = i, t[6] = n.text, t[7] = a, t[8] = o, t[9] = s, t[10] = l, t[11] = u) : u = t[11], u;
|
|
2317
2365
|
}
|
|
2318
|
-
function
|
|
2366
|
+
function va(e) {
|
|
2319
2367
|
let n = q(14), { seg: r, isClickable: i } = e, a = r.bold ? "medium" : void 0, o = r.monospace ? "mono/XS" : void 0, s = r.truncate ? "0" : void 0, c = r.truncate ? "hidden" : void 0, l = r.truncate ? "ellipsis" : void 0, u = r.truncate ? "nowrap" : void 0, d = i && !r.muted ? "fg" : "fg.muted", f;
|
|
2320
2368
|
n[0] === d ? f = n[1] : (f = { color: d }, n[0] = d, n[1] = f);
|
|
2321
2369
|
let p;
|
|
2322
|
-
n[2] !== r.text || n[3] !== a || n[4] !== o || n[5] !== s || n[6] !== c || n[7] !== l || n[8] !== u || n[9] !== f ? (p = /* @__PURE__ */ J(
|
|
2370
|
+
n[2] !== r.text || n[3] !== a || n[4] !== o || n[5] !== s || n[6] !== c || n[7] !== l || n[8] !== u || n[9] !== f ? (p = /* @__PURE__ */ J(U, {
|
|
2323
2371
|
fontWeight: a,
|
|
2324
2372
|
textStyle: o,
|
|
2325
2373
|
color: "fg.muted",
|
|
@@ -2338,7 +2386,7 @@ function ga(e) {
|
|
|
2338
2386
|
children: m
|
|
2339
2387
|
}), n[11] = r.text, n[12] = m, n[13] = h) : h = n[13], h;
|
|
2340
2388
|
}
|
|
2341
|
-
function
|
|
2389
|
+
function ya(e) {
|
|
2342
2390
|
let t = q(22), { seg: n, isClickable: r, onOpenFile: i } = e;
|
|
2343
2391
|
if (b() && (n.kind === "link" || n.kind === "diff") && (n.filePath || n.kind === "diff")) {
|
|
2344
2392
|
let e = n.filePath ?? (n.kind === "diff" ? n.fileName : n.text), r;
|
|
@@ -2361,28 +2409,28 @@ function _a(e) {
|
|
|
2361
2409
|
switch (n.kind) {
|
|
2362
2410
|
case "avatar": {
|
|
2363
2411
|
let e;
|
|
2364
|
-
return t[11] === n ? e = t[12] : (e = /* @__PURE__ */ J(
|
|
2412
|
+
return t[11] === n ? e = t[12] : (e = /* @__PURE__ */ J(ma, { seg: n }), t[11] = n, t[12] = e), e;
|
|
2365
2413
|
}
|
|
2366
2414
|
case "diff": {
|
|
2367
2415
|
let e;
|
|
2368
|
-
return t[13] !== i || t[14] !== n ? (e = /* @__PURE__ */ J(
|
|
2416
|
+
return t[13] !== i || t[14] !== n ? (e = /* @__PURE__ */ J(ha, {
|
|
2369
2417
|
seg: n,
|
|
2370
2418
|
onOpenFile: i
|
|
2371
2419
|
}), t[13] = i, t[14] = n, t[15] = e) : e = t[15], e;
|
|
2372
2420
|
}
|
|
2373
2421
|
case "link": {
|
|
2374
2422
|
let e;
|
|
2375
|
-
return t[16] !== i || t[17] !== n ? (e = n.variant === "bubble" ? /* @__PURE__ */ J(
|
|
2423
|
+
return t[16] !== i || t[17] !== n ? (e = n.variant === "bubble" ? /* @__PURE__ */ J(ga, {
|
|
2376
2424
|
seg: n,
|
|
2377
2425
|
onOpenFile: i
|
|
2378
|
-
}) : /* @__PURE__ */ J(
|
|
2426
|
+
}) : /* @__PURE__ */ J(_a, {
|
|
2379
2427
|
seg: n,
|
|
2380
2428
|
onOpenFile: i
|
|
2381
2429
|
}), t[16] = i, t[17] = n, t[18] = e) : e = t[18], e;
|
|
2382
2430
|
}
|
|
2383
2431
|
case "text": {
|
|
2384
2432
|
let e;
|
|
2385
|
-
return t[19] !== r || t[20] !== n ? (e = /* @__PURE__ */ J(
|
|
2433
|
+
return t[19] !== r || t[20] !== n ? (e = /* @__PURE__ */ J(va, {
|
|
2386
2434
|
seg: n,
|
|
2387
2435
|
isClickable: r
|
|
2388
2436
|
}), t[19] = r, t[20] = n, t[21] = e) : e = t[21], e;
|
|
@@ -2392,8 +2440,8 @@ function _a(e) {
|
|
|
2392
2440
|
}
|
|
2393
2441
|
//#endregion
|
|
2394
2442
|
//#region src/components/chat-ui/components/timeline.tsx
|
|
2395
|
-
var
|
|
2396
|
-
function
|
|
2443
|
+
var ba = se;
|
|
2444
|
+
function xa(e) {
|
|
2397
2445
|
let t = q(5), { code: r, language: i } = e, a = i ? `${i} code block` : "code block", o;
|
|
2398
2446
|
t[0] === r ? o = t[1] : (o = /* @__PURE__ */ J(A, {
|
|
2399
2447
|
as: "code",
|
|
@@ -2418,7 +2466,7 @@ function ya(e) {
|
|
|
2418
2466
|
})
|
|
2419
2467
|
}), t[2] = a, t[3] = o, t[4] = s) : s = t[4], s;
|
|
2420
2468
|
}
|
|
2421
|
-
function
|
|
2469
|
+
function Sa(e) {
|
|
2422
2470
|
let t = q(38), { b: n, onOpenFile: r } = e;
|
|
2423
2471
|
switch (n.type) {
|
|
2424
2472
|
case "comment": {
|
|
@@ -2436,7 +2484,7 @@ function ba(e) {
|
|
|
2436
2484
|
padding: "0",
|
|
2437
2485
|
children: /* @__PURE__ */ J(M.Body, {
|
|
2438
2486
|
padding: "0",
|
|
2439
|
-
children: /* @__PURE__ */ J(
|
|
2487
|
+
children: /* @__PURE__ */ J(xa, {
|
|
2440
2488
|
language: n.language,
|
|
2441
2489
|
code: n.code
|
|
2442
2490
|
})
|
|
@@ -2454,7 +2502,7 @@ function ba(e) {
|
|
|
2454
2502
|
height: "240px",
|
|
2455
2503
|
minW: "320px",
|
|
2456
2504
|
overflow: "hidden",
|
|
2457
|
-
children: /* @__PURE__ */ J(
|
|
2505
|
+
children: /* @__PURE__ */ J(da, {
|
|
2458
2506
|
original: n.original,
|
|
2459
2507
|
modified: n.modified,
|
|
2460
2508
|
language: n.language,
|
|
@@ -2480,15 +2528,15 @@ function ba(e) {
|
|
|
2480
2528
|
}
|
|
2481
2529
|
case "todo-list": {
|
|
2482
2530
|
let e;
|
|
2483
|
-
return t[17] === n.items ? e = t[18] : (e = /* @__PURE__ */ J(
|
|
2531
|
+
return t[17] === n.items ? e = t[18] : (e = /* @__PURE__ */ J(On, { items: n.items }), t[17] = n.items, t[18] = e), e;
|
|
2484
2532
|
}
|
|
2485
2533
|
case "question-form": {
|
|
2486
2534
|
let e;
|
|
2487
|
-
return t[19] === n.questions ? e = t[20] : (e = /* @__PURE__ */ J(
|
|
2535
|
+
return t[19] === n.questions ? e = t[20] : (e = /* @__PURE__ */ J(Mn, { questions: n.questions }), t[19] = n.questions, t[20] = e), e;
|
|
2488
2536
|
}
|
|
2489
2537
|
case "references": {
|
|
2490
2538
|
let e;
|
|
2491
|
-
t[21] === n.references ? e = t[22] : (e = n.references.map(
|
|
2539
|
+
t[21] === n.references ? e = t[22] : (e = n.references.map(Ca), t[21] = n.references, t[22] = e);
|
|
2492
2540
|
let r;
|
|
2493
2541
|
return t[23] === e ? r = t[24] : (r = /* @__PURE__ */ J(W, {
|
|
2494
2542
|
mt: "xs",
|
|
@@ -2501,7 +2549,7 @@ function ba(e) {
|
|
|
2501
2549
|
case "image": {
|
|
2502
2550
|
if (!n.src.trim()) return null;
|
|
2503
2551
|
let e;
|
|
2504
|
-
t[25] !== n.alt || t[26] !== n.src ? (e = /* @__PURE__ */ J(
|
|
2552
|
+
t[25] !== n.alt || t[26] !== n.src ? (e = /* @__PURE__ */ J(z, {
|
|
2505
2553
|
src: n.src,
|
|
2506
2554
|
alt: n.alt,
|
|
2507
2555
|
maxH: "18rem",
|
|
@@ -2537,7 +2585,7 @@ function ba(e) {
|
|
|
2537
2585
|
}
|
|
2538
2586
|
}
|
|
2539
2587
|
}
|
|
2540
|
-
function
|
|
2588
|
+
function Ca(e) {
|
|
2541
2589
|
return /* @__PURE__ */ J(x, {
|
|
2542
2590
|
candidate: {
|
|
2543
2591
|
source: e,
|
|
@@ -2546,13 +2594,13 @@ function xa(e) {
|
|
|
2546
2594
|
children: /* @__PURE__ */ J(o, { fileName: e })
|
|
2547
2595
|
}, e);
|
|
2548
2596
|
}
|
|
2549
|
-
function
|
|
2597
|
+
function wa(e) {
|
|
2550
2598
|
let t = q(23), { item: n, itemKey: r, isOpen: i, canExpand: a, hasBlocks: o, onToggle: s, onOpenFile: c } = e, l;
|
|
2551
|
-
t[0] === Symbol.for("react.memo_cache_sentinel") ? (l = /* @__PURE__ */ J(
|
|
2599
|
+
t[0] === Symbol.for("react.memo_cache_sentinel") ? (l = /* @__PURE__ */ J(ba.Separator, {}), t[0] = l) : l = t[0];
|
|
2552
2600
|
let u;
|
|
2553
|
-
t[1] === n.indicator ? u = t[2] : (u = /* @__PURE__ */ Y(
|
|
2601
|
+
t[1] === n.indicator ? u = t[2] : (u = /* @__PURE__ */ Y(ba.Connector, { children: [l, /* @__PURE__ */ J(fa, { ind: n.indicator })] }), t[1] = n.indicator, t[2] = u);
|
|
2554
2602
|
let d = i ? "auto" : "20px", f;
|
|
2555
|
-
t[3] !== a || t[4] !== i || t[5] !== n.title || t[6] !== r || t[7] !== c || t[8] !== s ? (f = n.title.length > 0 && /* @__PURE__ */ J(
|
|
2603
|
+
t[3] !== a || t[4] !== i || t[5] !== n.title || t[6] !== r || t[7] !== c || t[8] !== s ? (f = n.title.length > 0 && /* @__PURE__ */ J(ba.Title, {
|
|
2556
2604
|
className: "group",
|
|
2557
2605
|
fontWeight: "normal",
|
|
2558
2606
|
display: "flex",
|
|
@@ -2562,14 +2610,14 @@ function Sa(e) {
|
|
|
2562
2610
|
overflow: "hidden",
|
|
2563
2611
|
cursor: a ? "pointer" : "default",
|
|
2564
2612
|
onClick: a ? () => s(r) : void 0,
|
|
2565
|
-
children: /* @__PURE__ */ Y(
|
|
2613
|
+
children: /* @__PURE__ */ Y(U, {
|
|
2566
2614
|
display: "flex",
|
|
2567
2615
|
alignItems: "center",
|
|
2568
2616
|
gap: "sm",
|
|
2569
2617
|
flexWrap: "nowrap",
|
|
2570
2618
|
minW: "0",
|
|
2571
2619
|
width: "full",
|
|
2572
|
-
children: [/* @__PURE__ */ J(
|
|
2620
|
+
children: [/* @__PURE__ */ J(U, {
|
|
2573
2621
|
display: "flex",
|
|
2574
2622
|
alignItems: "center",
|
|
2575
2623
|
gap: "xs",
|
|
@@ -2577,12 +2625,12 @@ function Sa(e) {
|
|
|
2577
2625
|
minW: "0",
|
|
2578
2626
|
flex: "1",
|
|
2579
2627
|
overflow: "hidden",
|
|
2580
|
-
children: n.title.map((e, t) => /* @__PURE__ */ J(
|
|
2628
|
+
children: n.title.map((e, t) => /* @__PURE__ */ J(ya, {
|
|
2581
2629
|
seg: e,
|
|
2582
2630
|
isClickable: a,
|
|
2583
2631
|
onOpenFile: c
|
|
2584
2632
|
}, t))
|
|
2585
|
-
}), a ? /* @__PURE__ */ J(
|
|
2633
|
+
}), a ? /* @__PURE__ */ J(U, {
|
|
2586
2634
|
display: "inline-flex",
|
|
2587
2635
|
alignItems: "center",
|
|
2588
2636
|
transition: "transform 200ms ease, color 200ms ease",
|
|
@@ -2604,33 +2652,33 @@ function Sa(e) {
|
|
|
2604
2652
|
opacity: 1,
|
|
2605
2653
|
transform: "translateY(0)",
|
|
2606
2654
|
transition: "opacity 200ms ease, transform 200ms ease",
|
|
2607
|
-
children: n.blocks.map((e, t) => /* @__PURE__ */ J(A, { children: /* @__PURE__ */ J(
|
|
2655
|
+
children: n.blocks.map((e, t) => /* @__PURE__ */ J(A, { children: /* @__PURE__ */ J(Sa, {
|
|
2608
2656
|
b: e,
|
|
2609
2657
|
onOpenFile: c
|
|
2610
2658
|
}) }, t))
|
|
2611
2659
|
}) : null
|
|
2612
2660
|
}) : null, t[10] = o, t[11] = i, t[12] = n.blocks, t[13] = c, t[14] = p) : p = t[14];
|
|
2613
2661
|
let m;
|
|
2614
|
-
t[15] !== d || t[16] !== f || t[17] !== p ? (m = /* @__PURE__ */ Y(
|
|
2662
|
+
t[15] !== d || t[16] !== f || t[17] !== p ? (m = /* @__PURE__ */ Y(ba.Content, {
|
|
2615
2663
|
h: d,
|
|
2616
2664
|
children: [f, p]
|
|
2617
2665
|
}), t[15] = d, t[16] = f, t[17] = p, t[18] = m) : m = t[18];
|
|
2618
2666
|
let h;
|
|
2619
|
-
return t[19] !== r || t[20] !== u || t[21] !== m ? (h = /* @__PURE__ */ Y(
|
|
2667
|
+
return t[19] !== r || t[20] !== u || t[21] !== m ? (h = /* @__PURE__ */ Y(ba.Item, {
|
|
2620
2668
|
gap: "xs",
|
|
2621
2669
|
children: [u, m]
|
|
2622
2670
|
}, r), t[19] = r, t[20] = u, t[21] = m, t[22] = h) : h = t[22], h;
|
|
2623
2671
|
}
|
|
2624
|
-
function
|
|
2672
|
+
function Ta(e) {
|
|
2625
2673
|
let t = q(5), n = b(), r = e.linkHandler ?? n, i;
|
|
2626
|
-
t[0] === e ? i = t[1] : (i = /* @__PURE__ */ J(
|
|
2674
|
+
t[0] === e ? i = t[1] : (i = /* @__PURE__ */ J(Ea, { ...e }), t[0] = e, t[1] = i);
|
|
2627
2675
|
let a;
|
|
2628
2676
|
return t[2] !== r || t[3] !== i ? (a = /* @__PURE__ */ J(m, {
|
|
2629
2677
|
handler: r,
|
|
2630
2678
|
children: i
|
|
2631
2679
|
}), t[2] = r, t[3] = i, t[4] = a) : a = t[4], a;
|
|
2632
2680
|
}
|
|
2633
|
-
function
|
|
2681
|
+
function Ea(e) {
|
|
2634
2682
|
let t = q(14), { data: n, onOpenFile: r } = e, i = b(), a;
|
|
2635
2683
|
t[0] !== i || t[1] !== r ? (a = i ? (e) => {
|
|
2636
2684
|
i.open({
|
|
@@ -2640,7 +2688,7 @@ function wa(e) {
|
|
|
2640
2688
|
} : r, t[0] = i, t[1] = r, t[2] = a) : a = t[2];
|
|
2641
2689
|
let o = a, s;
|
|
2642
2690
|
t[3] === Symbol.for("react.memo_cache_sentinel") ? (s = {}, t[3] = s) : s = t[3];
|
|
2643
|
-
let [c, l] = Q(s), u =
|
|
2691
|
+
let [c, l] = Q(s), u = Da, d;
|
|
2644
2692
|
t[4] === Symbol.for("react.memo_cache_sentinel") ? (d = (e) => {
|
|
2645
2693
|
l((t) => ({
|
|
2646
2694
|
...t,
|
|
@@ -2652,7 +2700,7 @@ function wa(e) {
|
|
|
2652
2700
|
let e;
|
|
2653
2701
|
t[9] !== c || t[10] !== o ? (e = (e, t) => {
|
|
2654
2702
|
let n = u(e, t), r = (e.blocks?.length ?? 0) > 0, i = (e.expandable ?? !0) && r, a = i ? c[n] ?? !1 : r;
|
|
2655
|
-
return /* @__PURE__ */ J(
|
|
2703
|
+
return /* @__PURE__ */ J(wa, {
|
|
2656
2704
|
item: e,
|
|
2657
2705
|
itemKey: n,
|
|
2658
2706
|
isOpen: a,
|
|
@@ -2664,60 +2712,60 @@ function wa(e) {
|
|
|
2664
2712
|
}, t[9] = c, t[10] = o, t[11] = e) : e = t[11], p = n.items.map(e), t[5] = n.items, t[6] = c, t[7] = o, t[8] = p;
|
|
2665
2713
|
} else p = t[8];
|
|
2666
2714
|
let m;
|
|
2667
|
-
return t[12] === p ? m = t[13] : (m = /* @__PURE__ */ J(
|
|
2715
|
+
return t[12] === p ? m = t[13] : (m = /* @__PURE__ */ J(ba.Root, {
|
|
2668
2716
|
variant: "tool",
|
|
2669
2717
|
children: p
|
|
2670
2718
|
}), t[12] = p, t[13] = m), m;
|
|
2671
2719
|
}
|
|
2672
|
-
function
|
|
2720
|
+
function Da(e, t) {
|
|
2673
2721
|
return e.id ? `id:${e.id}` : `idx:${t}`;
|
|
2674
2722
|
}
|
|
2675
2723
|
//#endregion
|
|
2676
2724
|
//#region src/components/chat-ui/components/tool-invocation-timeline.tsx
|
|
2677
|
-
var
|
|
2725
|
+
var Oa = (e) => lr(e.tool ?? "").replace(/_/g, "") === "question", ka = (e) => {
|
|
2678
2726
|
let t = e.state?.output;
|
|
2679
2727
|
return typeof t == "string" ? t.trim().length > 0 : Array.isArray(t) ? t.length > 0 : t && typeof t == "object" ? Object.keys(t).length > 0 : t != null;
|
|
2680
2728
|
};
|
|
2681
|
-
function
|
|
2729
|
+
function Aa(e) {
|
|
2682
2730
|
let t = q(9), { invocations: n, labeledBlocks: r, hideQuestionForms: i, onOpenFile: a, linkHandler: o } = e, s = i !== void 0 && i, c, l;
|
|
2683
2731
|
if (t[0] !== s || t[1] !== n || t[2] !== r) {
|
|
2684
2732
|
l = Symbol.for("react.early_return_sentinel");
|
|
2685
2733
|
bb0: {
|
|
2686
|
-
let e = s ? n.filter(
|
|
2734
|
+
let e = s ? n.filter(ja) : n;
|
|
2687
2735
|
if (e.length === 0) {
|
|
2688
2736
|
l = null;
|
|
2689
2737
|
break bb0;
|
|
2690
2738
|
}
|
|
2691
|
-
c =
|
|
2739
|
+
c = la(e, { labeledBlocks: r });
|
|
2692
2740
|
}
|
|
2693
2741
|
t[0] = s, t[1] = n, t[2] = r, t[3] = c, t[4] = l;
|
|
2694
2742
|
} else c = t[3], l = t[4];
|
|
2695
2743
|
if (l !== Symbol.for("react.early_return_sentinel")) return l;
|
|
2696
2744
|
let u = c, d;
|
|
2697
|
-
return t[5] !== u || t[6] !== o || t[7] !== a ? (d = /* @__PURE__ */ J(
|
|
2745
|
+
return t[5] !== u || t[6] !== o || t[7] !== a ? (d = /* @__PURE__ */ J(Ta, {
|
|
2698
2746
|
data: u,
|
|
2699
2747
|
linkHandler: o,
|
|
2700
2748
|
onOpenFile: a
|
|
2701
2749
|
}), t[5] = u, t[6] = o, t[7] = a, t[8] = d) : d = t[8], d;
|
|
2702
2750
|
}
|
|
2703
|
-
function
|
|
2704
|
-
return !
|
|
2751
|
+
function ja(e) {
|
|
2752
|
+
return !Oa(e) || ka(e);
|
|
2705
2753
|
}
|
|
2706
2754
|
//#endregion
|
|
2707
2755
|
//#region src/components/chat-ui/components/message-parts-renderer.tsx
|
|
2708
|
-
var
|
|
2756
|
+
var Ma = (e) => e.type === "tool", Na = (e) => e.filename ?? e.url.split("/").pop() ?? "attachment", Pa = /\.(avif|bmp|gif|jpe?g|png|svg|webp)$/i, Fa = (e) => e.mediaType?.startsWith("image/") || Pa.test(Na(e)), Ia = (e) => Fa(e) ? /* @__PURE__ */ J(z, {
|
|
2709
2757
|
src: e.url,
|
|
2710
|
-
alt: `${
|
|
2758
|
+
alt: `${Na(e)} preview thumbnail`,
|
|
2711
2759
|
boxSize: "18px",
|
|
2712
2760
|
borderRadius: "xs",
|
|
2713
2761
|
objectFit: "cover"
|
|
2714
|
-
}) : void 0,
|
|
2762
|
+
}) : void 0, La = (e, t) => {
|
|
2715
2763
|
if (t) {
|
|
2716
2764
|
t(e.url);
|
|
2717
2765
|
return;
|
|
2718
2766
|
}
|
|
2719
2767
|
typeof window < "u" && window.open(e.url, "_blank", "noopener,noreferrer");
|
|
2720
|
-
},
|
|
2768
|
+
}, Ra = (e) => {
|
|
2721
2769
|
if (e.message && e.message.trim().length > 0) return e.message;
|
|
2722
2770
|
let { errorType: t } = e;
|
|
2723
2771
|
switch (t) {
|
|
@@ -2726,17 +2774,17 @@ var Aa = (e) => e.type === "tool", ja = (e) => e.filename ?? e.url.split("/").po
|
|
|
2726
2774
|
case "permission": return "Permission denied.";
|
|
2727
2775
|
default: return "An error occurred.";
|
|
2728
2776
|
}
|
|
2729
|
-
},
|
|
2777
|
+
}, za = {
|
|
2730
2778
|
info: "blue",
|
|
2731
2779
|
warning: "orange",
|
|
2732
2780
|
error: "red",
|
|
2733
2781
|
success: "green",
|
|
2734
2782
|
loading: "blue"
|
|
2735
|
-
},
|
|
2783
|
+
}, Ba = (e, t) => {
|
|
2736
2784
|
let n = [], r = t;
|
|
2737
2785
|
for (; r < e.length;) {
|
|
2738
2786
|
let t = e[r];
|
|
2739
|
-
if (!
|
|
2787
|
+
if (!Ma(t) || t.tool === "question" && fn(t.state?.input)) break;
|
|
2740
2788
|
n.push(t), r += 1;
|
|
2741
2789
|
}
|
|
2742
2790
|
return {
|
|
@@ -2744,19 +2792,19 @@ var Aa = (e) => e.type === "tool", ja = (e) => e.filename ?? e.url.split("/").po
|
|
|
2744
2792
|
nextIndex: r - 1
|
|
2745
2793
|
};
|
|
2746
2794
|
};
|
|
2747
|
-
function
|
|
2795
|
+
function Va(e) {
|
|
2748
2796
|
let t = q(5), n = b(), r = e.linkHandler ?? n, i;
|
|
2749
|
-
t[0] === e ? i = t[1] : (i = /* @__PURE__ */ J(
|
|
2797
|
+
t[0] === e ? i = t[1] : (i = /* @__PURE__ */ J(Ha, { ...e }), t[0] = e, t[1] = i);
|
|
2750
2798
|
let a;
|
|
2751
2799
|
return t[2] !== r || t[3] !== i ? (a = /* @__PURE__ */ J(m, {
|
|
2752
2800
|
handler: r,
|
|
2753
2801
|
children: i
|
|
2754
2802
|
}), t[2] = r, t[3] = i, t[4] = a) : a = t[4], a;
|
|
2755
2803
|
}
|
|
2756
|
-
function
|
|
2804
|
+
function Ha(t) {
|
|
2757
2805
|
let n = q(10), { message: r, streaming: i, hideQuestionForms: a, onOpenFile: s, toolInvocationTimeline: c } = t, l = i !== void 0 && i, u = a !== void 0 && a, d = b(), f = g(), p;
|
|
2758
2806
|
if (n[0] !== u || n[1] !== f || n[2] !== d || n[3] !== r || n[4] !== s || n[5] !== l || n[6] !== c) {
|
|
2759
|
-
let t = y([r], d), i = c ??
|
|
2807
|
+
let t = y([r], d), i = c ?? Aa, a;
|
|
2760
2808
|
n[8] === r.parts ? a = n[9] : (a = r.parts ?? [], n[8] = r.parts, n[9] = a);
|
|
2761
2809
|
let m = a, g = [];
|
|
2762
2810
|
for (let n = 0; n < m.length; n += 1) {
|
|
@@ -2765,7 +2813,7 @@ function Ba(t) {
|
|
|
2765
2813
|
case "text":
|
|
2766
2814
|
g.push(/* @__PURE__ */ J(h, {
|
|
2767
2815
|
value: f.get(a) ?? t.get(a) ?? S,
|
|
2768
|
-
children: /* @__PURE__ */ J("div", { children: /* @__PURE__ */ J(
|
|
2816
|
+
children: /* @__PURE__ */ J("div", { children: /* @__PURE__ */ J(sr, {
|
|
2769
2817
|
streaming: l,
|
|
2770
2818
|
children: a.text
|
|
2771
2819
|
}) })
|
|
@@ -2786,11 +2834,11 @@ function Ba(t) {
|
|
|
2786
2834
|
}, c));
|
|
2787
2835
|
break bb0;
|
|
2788
2836
|
case "tool": {
|
|
2789
|
-
if (a.tool === "question" &&
|
|
2790
|
-
g.push(/* @__PURE__ */ J(
|
|
2837
|
+
if (a.tool === "question" && fn(a.state?.input)) {
|
|
2838
|
+
g.push(/* @__PURE__ */ J(cr, { part: a }, c));
|
|
2791
2839
|
break bb0;
|
|
2792
2840
|
}
|
|
2793
|
-
let { invocations: e, nextIndex: t } =
|
|
2841
|
+
let { invocations: e, nextIndex: t } = Ba(m, n);
|
|
2794
2842
|
n = t, g.push(/* @__PURE__ */ J(A, {
|
|
2795
2843
|
width: "full",
|
|
2796
2844
|
children: /* @__PURE__ */ J(i, {
|
|
@@ -2807,11 +2855,11 @@ function Ba(t) {
|
|
|
2807
2855
|
g.push(/* @__PURE__ */ J(A, {
|
|
2808
2856
|
width: "fit-content",
|
|
2809
2857
|
children: /* @__PURE__ */ J(o, {
|
|
2810
|
-
fileName:
|
|
2858
|
+
fileName: Na(a),
|
|
2811
2859
|
size: "sm",
|
|
2812
2860
|
tone: "neutral",
|
|
2813
|
-
icon:
|
|
2814
|
-
onSelect: () =>
|
|
2861
|
+
icon: Ia(a),
|
|
2862
|
+
onSelect: () => La(a, s)
|
|
2815
2863
|
})
|
|
2816
2864
|
}, c));
|
|
2817
2865
|
break bb0;
|
|
@@ -2823,7 +2871,7 @@ function Ba(t) {
|
|
|
2823
2871
|
borderRadius: "xs",
|
|
2824
2872
|
status: "error",
|
|
2825
2873
|
colorPalette: "red",
|
|
2826
|
-
title:
|
|
2874
|
+
title: Ra(a),
|
|
2827
2875
|
size: "sm"
|
|
2828
2876
|
})
|
|
2829
2877
|
}, c));
|
|
@@ -2835,9 +2883,9 @@ function Ba(t) {
|
|
|
2835
2883
|
children: /* @__PURE__ */ J(e, {
|
|
2836
2884
|
borderRadius: "xs",
|
|
2837
2885
|
status: a.status === "loading" ? "info" : a.status,
|
|
2838
|
-
colorPalette:
|
|
2886
|
+
colorPalette: za[a.status],
|
|
2839
2887
|
title: a.title,
|
|
2840
|
-
icon: a.status === "loading" ? /* @__PURE__ */ J(
|
|
2888
|
+
icon: a.status === "loading" ? /* @__PURE__ */ J(ie, { size: "sm" }) : void 0,
|
|
2841
2889
|
size: "sm",
|
|
2842
2890
|
children: a.message
|
|
2843
2891
|
})
|
|
@@ -2852,17 +2900,17 @@ function Ba(t) {
|
|
|
2852
2900
|
}
|
|
2853
2901
|
//#endregion
|
|
2854
2902
|
//#region src/components/chat-ui/components/message-types.ts
|
|
2855
|
-
var
|
|
2903
|
+
var Ua = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "assistant", Wa = (e) => e.text.trim().length > 0, Ga = (e) => e.title.trim().length > 0 || !!e.message?.trim(), Ka = (e) => {
|
|
2856
2904
|
switch (e.type) {
|
|
2857
2905
|
case "text":
|
|
2858
|
-
case "reasoning": return
|
|
2906
|
+
case "reasoning": return Wa(e);
|
|
2859
2907
|
case "tool":
|
|
2860
2908
|
case "file":
|
|
2861
2909
|
case "error": return !0;
|
|
2862
|
-
case "alert": return
|
|
2910
|
+
case "alert": return Ga(e);
|
|
2863
2911
|
default: return !1;
|
|
2864
2912
|
}
|
|
2865
|
-
},
|
|
2913
|
+
}, qa = (e) => e.type === "reasoning" || e.type === "tool" && e.tool.toLowerCase() !== "question", Ja = (e) => e.role === "user" || e.parts.length === 0 ? !1 : e.parts.every(qa), Ya = (e) => {
|
|
2866
2914
|
if (e.length === 0) return null;
|
|
2867
2915
|
let [t, ...n] = e;
|
|
2868
2916
|
return t ? {
|
|
@@ -2872,12 +2920,12 @@ var Va = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2872
2920
|
modelId: n.at(-1)?.modelId ?? t.modelId,
|
|
2873
2921
|
providerId: n.at(-1)?.providerId ?? t.providerId
|
|
2874
2922
|
} : null;
|
|
2875
|
-
},
|
|
2923
|
+
}, Xa = (e, t = {}) => {
|
|
2876
2924
|
let n = [], r = [], i = () => {
|
|
2877
2925
|
r = [];
|
|
2878
2926
|
};
|
|
2879
2927
|
for (let t of e) {
|
|
2880
|
-
let e = (t.parts ?? []).filter(
|
|
2928
|
+
let e = (t.parts ?? []).filter(Ka);
|
|
2881
2929
|
if (e.length === 0) continue;
|
|
2882
2930
|
let a = e.length === t.parts.length ? t : {
|
|
2883
2931
|
...t,
|
|
@@ -2887,7 +2935,7 @@ var Va = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2887
2935
|
i(), n.push(a);
|
|
2888
2936
|
continue;
|
|
2889
2937
|
}
|
|
2890
|
-
if (
|
|
2938
|
+
if (Ja(a)) {
|
|
2891
2939
|
r.push(a);
|
|
2892
2940
|
continue;
|
|
2893
2941
|
}
|
|
@@ -2901,14 +2949,14 @@ var Va = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2901
2949
|
n.push(a);
|
|
2902
2950
|
}
|
|
2903
2951
|
if (t.streaming && r.length > 0) {
|
|
2904
|
-
let e =
|
|
2952
|
+
let e = Ya(r);
|
|
2905
2953
|
e && n.push(e);
|
|
2906
2954
|
}
|
|
2907
2955
|
return n;
|
|
2908
|
-
},
|
|
2956
|
+
}, Za = (e) => {
|
|
2909
2957
|
let t = e.at(-1);
|
|
2910
|
-
return t?.role === "assistant" && t.parts.some((e) => e.type === "text" &&
|
|
2911
|
-
},
|
|
2958
|
+
return t?.role === "assistant" && t.parts.some((e) => e.type === "text" && Wa(e)) ? t.id : null;
|
|
2959
|
+
}, Qa = (e) => {
|
|
2912
2960
|
let t = [], n = [];
|
|
2913
2961
|
for (let r of e) r.role === "user" ? t.push({
|
|
2914
2962
|
userMessage: r,
|
|
@@ -2918,42 +2966,33 @@ var Va = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2918
2966
|
groups: t,
|
|
2919
2967
|
leadingResponses: n
|
|
2920
2968
|
};
|
|
2921
|
-
},
|
|
2969
|
+
}, $a = (e) => {
|
|
2922
2970
|
let t = q(18), { message: n, streaming: r, hideQuestionForms: i, animate: a, showAssistantActions: o } = e, s = i !== void 0 && i, c = a !== void 0 && a, l;
|
|
2923
|
-
t[0] === n.role ? l = t[1] : (l =
|
|
2924
|
-
let u = l, d = u === "user" || u === "assistant" && o, f = c ?
|
|
2925
|
-
t[2] !== s || t[3] !== n || t[4] !== p ? (m = /* @__PURE__ */ J(
|
|
2971
|
+
t[0] === n.role ? l = t[1] : (l = Ua(n.role), t[0] = n.role, t[1] = l);
|
|
2972
|
+
let u = l, d = u === "user" || u === "assistant" && o, f = c ? Qn : void 0, p = r && u === "assistant", m;
|
|
2973
|
+
t[2] !== s || t[3] !== n || t[4] !== p ? (m = /* @__PURE__ */ J(Va, {
|
|
2926
2974
|
message: n,
|
|
2927
2975
|
streaming: p,
|
|
2928
2976
|
hideQuestionForms: s
|
|
2929
2977
|
}), t[2] = s, t[3] = n, t[4] = p, t[5] = m) : m = t[5];
|
|
2930
2978
|
let h;
|
|
2931
|
-
t[6] !== u || t[7] !== n || t[8] !== d ? (h = d ? /* @__PURE__ */ J(
|
|
2979
|
+
t[6] !== u || t[7] !== n || t[8] !== d ? (h = d ? /* @__PURE__ */ J(ar, {
|
|
2932
2980
|
message: n,
|
|
2933
2981
|
alwaysVisible: u === "user",
|
|
2934
2982
|
copyAlwaysVisible: u !== "user"
|
|
2935
2983
|
}) : null, t[6] = u, t[7] = n, t[8] = d, t[9] = h) : h = t[9];
|
|
2936
2984
|
let g;
|
|
2937
|
-
t[10] !== u || t[11] !== m || t[12] !== h ? (g = /* @__PURE__ */ Y(
|
|
2985
|
+
t[10] !== u || t[11] !== m || t[12] !== h ? (g = /* @__PURE__ */ Y(pt.Content, {
|
|
2938
2986
|
from: u,
|
|
2939
2987
|
children: [m, h]
|
|
2940
2988
|
}), t[10] = u, t[11] = m, t[12] = h, t[13] = g) : g = t[13];
|
|
2941
2989
|
let _;
|
|
2942
|
-
return t[14] !== u || t[15] !== f || t[16] !== g ? (_ = /* @__PURE__ */ J(
|
|
2990
|
+
return t[14] !== u || t[15] !== f || t[16] !== g ? (_ = /* @__PURE__ */ J(pt.Root, {
|
|
2943
2991
|
from: u,
|
|
2944
2992
|
...f,
|
|
2945
2993
|
children: g
|
|
2946
2994
|
}), t[14] = u, t[15] = f, t[16] = g, t[17] = _) : _ = t[17], _;
|
|
2947
|
-
},
|
|
2948
|
-
let t = q(6), { message: n, streaming: r, hideQuestionForms: i, animate: a, showAssistantActions: o } = e, s;
|
|
2949
|
-
return t[0] !== a || t[1] !== i || t[2] !== n || t[3] !== o || t[4] !== r ? (s = /* @__PURE__ */ J(A, { children: /* @__PURE__ */ J(Za, {
|
|
2950
|
-
message: n,
|
|
2951
|
-
streaming: r,
|
|
2952
|
-
hideQuestionForms: i,
|
|
2953
|
-
animate: a,
|
|
2954
|
-
showAssistantActions: o
|
|
2955
|
-
}) }), t[0] = a, t[1] = i, t[2] = n, t[3] = o, t[4] = r, t[5] = s) : s = t[5], s;
|
|
2956
|
-
}, $a = (e) => {
|
|
2995
|
+
}, eo = (e) => {
|
|
2957
2996
|
let t = q(11), { expanded: n, label: r, onClick: i, actionPanel: a } = e, o;
|
|
2958
2997
|
t[0] === Symbol.for("react.memo_cache_sentinel") ? (o = { key: "stickyUserMessage" }, t[0] = o) : o = t[0];
|
|
2959
2998
|
let s = fe(o), c;
|
|
@@ -2971,18 +3010,51 @@ var Va = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2971
3010
|
css: l.footer,
|
|
2972
3011
|
children: [a, u]
|
|
2973
3012
|
}), t[7] = a, t[8] = l.footer, t[9] = u, t[10] = d) : d = t[10], d;
|
|
2974
|
-
},
|
|
3013
|
+
}, to = (e, t) => {
|
|
3014
|
+
let n = Za(e), r = e.map((e) => ({
|
|
3015
|
+
type: "response",
|
|
3016
|
+
key: e.id,
|
|
3017
|
+
message: e,
|
|
3018
|
+
userIndex: null,
|
|
3019
|
+
showAssistantActions: e.id === n,
|
|
3020
|
+
isActiveTurn: t.length === 0
|
|
3021
|
+
}));
|
|
3022
|
+
for (let [e, n] of t.entries()) {
|
|
3023
|
+
let i = r.length, a = Za(n.responses);
|
|
3024
|
+
r.push({
|
|
3025
|
+
type: "user",
|
|
3026
|
+
key: n.userMessage.id,
|
|
3027
|
+
message: n.userMessage,
|
|
3028
|
+
endIndex: i + n.responses.length
|
|
3029
|
+
});
|
|
3030
|
+
for (let o of n.responses) r.push({
|
|
3031
|
+
type: "response",
|
|
3032
|
+
key: o.id,
|
|
3033
|
+
message: o,
|
|
3034
|
+
userIndex: i,
|
|
3035
|
+
showAssistantActions: o.id === a,
|
|
3036
|
+
isActiveTurn: e === t.length - 1
|
|
3037
|
+
});
|
|
3038
|
+
}
|
|
3039
|
+
return r;
|
|
3040
|
+
}, no = (e, t) => {
|
|
3041
|
+
let n = e[t];
|
|
3042
|
+
return n?.type === "user" ? t : n?.userIndex ?? null;
|
|
3043
|
+
}, ro = (e, t) => {
|
|
3044
|
+
let n = e[t + 1];
|
|
3045
|
+
return !!n && (n.type === "user" || no(e, t) === null);
|
|
3046
|
+
}, io = 1, ao = (e, t) => {
|
|
2975
3047
|
let n = Math.max(0, e.scrollHeight - e.clientHeight);
|
|
2976
|
-
return t === 0 || n <=
|
|
2977
|
-
},
|
|
2978
|
-
|
|
3048
|
+
return t === 0 || n <= io ? !1 : t < 0 ? e.scrollTop > io : e.scrollTop < n - io;
|
|
3049
|
+
}, oo = (e) => {
|
|
3050
|
+
ao(e.currentTarget, e.deltaY) && e.stopPropagation();
|
|
2979
3051
|
};
|
|
2980
|
-
function
|
|
3052
|
+
function so(e) {
|
|
2981
3053
|
let t = q(46), { message: r, expanded: i, animate: a, onToggle: o } = e, s = Z(null), c = Z(null), l = Z(null), [u, d] = Q(!1), f = u && i, p;
|
|
2982
3054
|
t[0] === Symbol.for("react.memo_cache_sentinel") ? (p = { key: "stickyUserMessage" }, t[0] = p) : p = t[0];
|
|
2983
3055
|
let m = fe(p), h;
|
|
2984
3056
|
t[1] !== f || t[2] !== m ? (h = m({ expanded: f }), t[1] = f, t[2] = m, t[3] = h) : h = t[3];
|
|
2985
|
-
let g = h, _ = f ? "expanded" : "collapsed", v = f ?
|
|
3057
|
+
let g = h, _ = f ? "expanded" : "collapsed", v = f ? oo : void 0, y;
|
|
2986
3058
|
t[4] !== g.viewport || t[5] !== _ || t[6] !== v ? (y = {
|
|
2987
3059
|
css: g.viewport,
|
|
2988
3060
|
"data-sticky-user-message-content": _,
|
|
@@ -3000,19 +3072,19 @@ function ro(e) {
|
|
|
3000
3072
|
f || (s.current.scrollTop = 0);
|
|
3001
3073
|
}, w = [f], t[10] = f, t[11] = C, t[12] = w), ye(C, w);
|
|
3002
3074
|
let T;
|
|
3003
|
-
t[13] === r ? T = t[14] : (T = /* @__PURE__ */ J(
|
|
3075
|
+
t[13] === r ? T = t[14] : (T = /* @__PURE__ */ J(ar, {
|
|
3004
3076
|
message: r,
|
|
3005
3077
|
alwaysVisible: !0,
|
|
3006
3078
|
copyAlwaysVisible: !1
|
|
3007
3079
|
}), t[13] = r, t[14] = T);
|
|
3008
|
-
let E = T, D = r.delivery ?? "sent", O = a ?
|
|
3080
|
+
let E = T, D = r.delivery ?? "sent", O = a ? Qn : void 0, k;
|
|
3009
3081
|
t[15] === g.preview ? k = t[16] : (k = /* @__PURE__ */ J(A, {
|
|
3010
3082
|
ref: l,
|
|
3011
3083
|
css: g.preview,
|
|
3012
3084
|
"aria-hidden": "true"
|
|
3013
3085
|
}), t[15] = g.preview, t[16] = k);
|
|
3014
3086
|
let j;
|
|
3015
|
-
t[17] === r ? j = t[18] : (j = /* @__PURE__ */ J(
|
|
3087
|
+
t[17] === r ? j = t[18] : (j = /* @__PURE__ */ J(Va, { message: r }), t[17] = r, t[18] = j);
|
|
3016
3088
|
let M;
|
|
3017
3089
|
t[19] !== g.body || t[20] !== j ? (M = /* @__PURE__ */ J(A, {
|
|
3018
3090
|
ref: c,
|
|
@@ -3032,14 +3104,14 @@ function ro(e) {
|
|
|
3032
3104
|
children: E
|
|
3033
3105
|
}), t[26] = E, t[27] = u, t[28] = g.actions, t[29] = P) : P = t[29];
|
|
3034
3106
|
let F;
|
|
3035
|
-
t[30] !== E || t[31] !== u || t[32] !== f || t[33] !== r.id || t[34] !== o ? (F = u ? /* @__PURE__ */ J(
|
|
3107
|
+
t[30] !== E || t[31] !== u || t[32] !== f || t[33] !== r.id || t[34] !== o ? (F = u ? /* @__PURE__ */ J(eo, {
|
|
3036
3108
|
expanded: f,
|
|
3037
3109
|
label: f ? "Show less" : "Show more",
|
|
3038
3110
|
onClick: () => o(r.id),
|
|
3039
3111
|
actionPanel: E
|
|
3040
3112
|
}) : null, t[30] = E, t[31] = u, t[32] = f, t[33] = r.id, t[34] = o, t[35] = F) : F = t[35];
|
|
3041
3113
|
let I;
|
|
3042
|
-
t[36] !== g.root || t[37] !== k || t[38] !== N || t[39] !== P || t[40] !== F ? (I = /* @__PURE__ */ Y(
|
|
3114
|
+
t[36] !== g.root || t[37] !== k || t[38] !== N || t[39] !== P || t[40] !== F ? (I = /* @__PURE__ */ Y(pt.Content, {
|
|
3043
3115
|
from: "user",
|
|
3044
3116
|
css: g.root,
|
|
3045
3117
|
children: [
|
|
@@ -3050,7 +3122,7 @@ function ro(e) {
|
|
|
3050
3122
|
]
|
|
3051
3123
|
}), t[36] = g.root, t[37] = k, t[38] = N, t[39] = P, t[40] = F, t[41] = I) : I = t[41];
|
|
3052
3124
|
let L;
|
|
3053
|
-
return t[42] !== D || t[43] !== O || t[44] !== I ? (L = /* @__PURE__ */ J(
|
|
3125
|
+
return t[42] !== D || t[43] !== O || t[44] !== I ? (L = /* @__PURE__ */ J(pt.Root, {
|
|
3054
3126
|
from: "user",
|
|
3055
3127
|
delivery: D,
|
|
3056
3128
|
...O,
|
|
@@ -3059,24 +3131,24 @@ function ro(e) {
|
|
|
3059
3131
|
}
|
|
3060
3132
|
//#endregion
|
|
3061
3133
|
//#region src/components/chat-ui/components/use-chat-tail-ready.ts
|
|
3062
|
-
var
|
|
3134
|
+
var co = 3, lo = 20, uo = 1, fo = (e, t) => Math.abs(e.scrollTop - t.scrollTop) <= uo && Math.abs(e.totalSize - t.totalSize) <= uo, po = (e, t) => !!e && Math.max(e.scrollHeight, t) <= e.clientHeight, mo = (e, t) => ({
|
|
3063
3135
|
scrollTop: e?.scrollTop ?? 0,
|
|
3064
3136
|
totalSize: t
|
|
3065
|
-
}),
|
|
3137
|
+
}), ho = (e) => {
|
|
3066
3138
|
let t = q(8), { itemCount: n, onReady: r, scrollRef: i, totalSize: a } = e, o = Z(r), s, c;
|
|
3067
3139
|
t[0] === r ? (s = t[1], c = t[2]) : (s = () => {
|
|
3068
3140
|
o.current = r;
|
|
3069
3141
|
}, c = [r], t[0] = r, t[1] = s, t[2] = c), X(s, c);
|
|
3070
3142
|
let l, u;
|
|
3071
3143
|
t[3] !== n || t[4] !== i || t[5] !== a ? (l = () => {
|
|
3072
|
-
if (n === 0 || typeof requestAnimationFrame > "u" ||
|
|
3144
|
+
if (n === 0 || typeof requestAnimationFrame > "u" || po(i.current, a)) {
|
|
3073
3145
|
o.current?.();
|
|
3074
3146
|
return;
|
|
3075
3147
|
}
|
|
3076
3148
|
let e = 0, t = 0, r = 0, s = null, c = () => {
|
|
3077
3149
|
t += 1;
|
|
3078
|
-
let n =
|
|
3079
|
-
if (r = s &&
|
|
3150
|
+
let n = mo(i.current, a);
|
|
3151
|
+
if (r = s && fo(n, s) ? r + 1 : 0, s = n, r >= co || t >= lo) {
|
|
3080
3152
|
o.current?.();
|
|
3081
3153
|
return;
|
|
3082
3154
|
}
|
|
@@ -3088,130 +3160,95 @@ var io = 3, ao = 20, oo = 1, so = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3088
3160
|
i,
|
|
3089
3161
|
a
|
|
3090
3162
|
], t[3] = n, t[4] = i, t[5] = a, t[6] = l, t[7] = u) : (l = t[6], u = t[7]), ye(l, u);
|
|
3091
|
-
},
|
|
3092
|
-
let n =
|
|
3093
|
-
return [...e.map((e) => ({
|
|
3094
|
-
type: "leading-response",
|
|
3095
|
-
key: e.id,
|
|
3096
|
-
message: e,
|
|
3097
|
-
showAssistantActions: e.id === n
|
|
3098
|
-
})), ...t.map((e, t) => ({
|
|
3099
|
-
type: "group",
|
|
3100
|
-
key: e.userMessage.id,
|
|
3101
|
-
group: e,
|
|
3102
|
-
groupIndex: t
|
|
3103
|
-
}))];
|
|
3104
|
-
}, _o = (e, t) => {
|
|
3105
|
-
if (e === 0) return 0;
|
|
3106
|
-
let n = e * fo + (e - 1) * ho;
|
|
3107
|
-
return Math.max(n - t, 0);
|
|
3108
|
-
}, vo = (e) => e?.clientHeight || po, yo = (e) => {
|
|
3109
|
-
let t = q(19), { group: n, streaming: r, hideQuestionForms: i, isExpanded: a, animate: o, onToggleStickyMessage: s } = e, c;
|
|
3110
|
-
t[0] === n.responses ? c = t[1] : (c = Ya(n.responses), t[0] = n.responses, t[1] = c);
|
|
3111
|
-
let l = c, u;
|
|
3112
|
-
t[2] !== o || t[3] !== n.userMessage || t[4] !== a || t[5] !== s ? (u = /* @__PURE__ */ J(A, {
|
|
3113
|
-
position: "sticky",
|
|
3114
|
-
top: "0",
|
|
3115
|
-
zIndex: 1,
|
|
3116
|
-
children: /* @__PURE__ */ J(ro, {
|
|
3117
|
-
message: n.userMessage,
|
|
3118
|
-
expanded: a,
|
|
3119
|
-
animate: o,
|
|
3120
|
-
onToggle: s
|
|
3121
|
-
})
|
|
3122
|
-
}), t[2] = o, t[3] = n.userMessage, t[4] = a, t[5] = s, t[6] = u) : u = t[6];
|
|
3123
|
-
let d;
|
|
3124
|
-
if (t[7] !== l || t[8] !== n.responses || t[9] !== i || t[10] !== r) {
|
|
3125
|
-
let e;
|
|
3126
|
-
t[12] !== l || t[13] !== i || t[14] !== r ? (e = (e) => /* @__PURE__ */ J(Qa, {
|
|
3127
|
-
message: e,
|
|
3128
|
-
streaming: r && e.id === l,
|
|
3129
|
-
hideQuestionForms: i,
|
|
3130
|
-
showAssistantActions: e.id === l
|
|
3131
|
-
}, e.id), t[12] = l, t[13] = i, t[14] = r, t[15] = e) : e = t[15], d = n.responses.map(e), t[7] = l, t[8] = n.responses, t[9] = i, t[10] = r, t[11] = d;
|
|
3132
|
-
} else d = t[11];
|
|
3133
|
-
let f;
|
|
3134
|
-
return t[16] !== u || t[17] !== d ? (f = /* @__PURE__ */ Y(A, { children: [u, d] }), t[16] = u, t[17] = d, t[18] = f) : f = t[18], f;
|
|
3135
|
-
}, bo = (e) => {
|
|
3136
|
-
let t = q(16), { item: n, groupCount: r, streaming: i, hideActiveQuestionForms: a, expandedStickyMessageIds: o, animate: s, onToggleStickyMessage: c } = e;
|
|
3137
|
-
if (n.type === "leading-response") {
|
|
3138
|
-
let e = i && r === 0 && n.showAssistantActions, o = r > 0 || a, c;
|
|
3139
|
-
return t[0] !== s || t[1] !== n.message || t[2] !== n.showAssistantActions || t[3] !== e || t[4] !== o ? (c = /* @__PURE__ */ J(Za, {
|
|
3140
|
-
message: n.message,
|
|
3141
|
-
streaming: e,
|
|
3142
|
-
hideQuestionForms: o,
|
|
3143
|
-
animate: s,
|
|
3144
|
-
showAssistantActions: n.showAssistantActions
|
|
3145
|
-
}), t[0] = s, t[1] = n.message, t[2] = n.showAssistantActions, t[3] = e, t[4] = o, t[5] = c) : c = t[5], c;
|
|
3146
|
-
}
|
|
3147
|
-
let l = n.group, u = i && n.groupIndex === r - 1, d = n.groupIndex < r - 1 || a, f;
|
|
3148
|
-
t[6] !== o || t[7] !== n.group.userMessage.id ? (f = o.has(n.group.userMessage.id), t[6] = o, t[7] = n.group.userMessage.id, t[8] = f) : f = t[8];
|
|
3149
|
-
let p;
|
|
3150
|
-
return t[9] !== s || t[10] !== n.group || t[11] !== c || t[12] !== u || t[13] !== d || t[14] !== f ? (p = /* @__PURE__ */ J(yo, {
|
|
3151
|
-
group: l,
|
|
3152
|
-
streaming: u,
|
|
3153
|
-
hideQuestionForms: d,
|
|
3154
|
-
isExpanded: f,
|
|
3155
|
-
animate: s,
|
|
3156
|
-
onToggleStickyMessage: c
|
|
3157
|
-
}), t[9] = s, t[10] = n.group, t[11] = c, t[12] = u, t[13] = d, t[14] = f, t[15] = p) : p = t[15], p;
|
|
3158
|
-
}, xo = (e) => {
|
|
3159
|
-
let { leadingResponses: t, groups: n, streaming: r, hideActiveQuestionForms: i, expandedStickyMessageIds: o, onToggleStickyMessage: s, onReady: c } = e, { scrollRef: l } = rt(), u = go(t, n), d = $n(u.map((e) => e.key)), f = vo(l.current), p = a({
|
|
3163
|
+
}, go = 360, _o = 4, vo = 8, yo = (e) => {
|
|
3164
|
+
let { leadingResponses: t, groups: n, streaming: r, hideActiveQuestionForms: i, expandedStickyMessageIds: o, onToggleStickyMessage: s, onReady: c } = e, { scrollRef: l } = it(), u = to(t, n), d = tr(u.map((e) => e.key)), f = l.current?.clientHeight || 1, p = Math.max(t.length + n.length - 1, 0), m = a({
|
|
3160
3165
|
count: u.length,
|
|
3161
3166
|
getScrollElement: () => l.current,
|
|
3162
|
-
estimateSize: () =>
|
|
3163
|
-
getItemKey: (e) => u[e]
|
|
3164
|
-
overscan:
|
|
3165
|
-
gap: ho,
|
|
3167
|
+
estimateSize: (e) => go + (ro(u, e) ? vo : 0),
|
|
3168
|
+
getItemKey: (e) => u[e].key,
|
|
3169
|
+
overscan: _o,
|
|
3166
3170
|
initialRect: {
|
|
3167
3171
|
width: 0,
|
|
3168
3172
|
height: f
|
|
3169
3173
|
},
|
|
3170
|
-
initialOffset: () =>
|
|
3171
|
-
|
|
3172
|
-
|
|
3174
|
+
initialOffset: () => Math.max(u.length * go + p * vo - f, 0),
|
|
3175
|
+
rangeExtractor: (e) => {
|
|
3176
|
+
let t = qe(e), n = no(u, e.startIndex);
|
|
3177
|
+
return n !== null && !t.includes(n) && t.unshift(n), t;
|
|
3178
|
+
}
|
|
3179
|
+
}), h = m.getTotalSize(), g = m.measurementsCache;
|
|
3180
|
+
return ho({
|
|
3173
3181
|
itemCount: u.length,
|
|
3174
3182
|
onReady: c,
|
|
3175
3183
|
scrollRef: l,
|
|
3176
|
-
totalSize:
|
|
3184
|
+
totalSize: h
|
|
3177
3185
|
}), /* @__PURE__ */ J(A, {
|
|
3178
3186
|
px: "xs",
|
|
3179
3187
|
children: /* @__PURE__ */ J(A, {
|
|
3180
3188
|
position: "relative",
|
|
3181
3189
|
width: "100%",
|
|
3182
|
-
style: { height:
|
|
3183
|
-
children:
|
|
3190
|
+
style: { height: h },
|
|
3191
|
+
children: m.getVirtualItems().map((e) => {
|
|
3184
3192
|
let t = u[e.index];
|
|
3185
|
-
|
|
3186
|
-
|
|
3193
|
+
if (t.type === "user") {
|
|
3194
|
+
let n = (g[t.endIndex]?.end ?? h) - (ro(u, t.endIndex) ? vo : 0);
|
|
3195
|
+
return /* @__PURE__ */ J(A, {
|
|
3196
|
+
position: "absolute",
|
|
3197
|
+
left: "0",
|
|
3198
|
+
width: "100%",
|
|
3199
|
+
zIndex: 1,
|
|
3200
|
+
pointerEvents: "none",
|
|
3201
|
+
style: {
|
|
3202
|
+
top: e.start,
|
|
3203
|
+
height: Math.max(e.size, n - e.start)
|
|
3204
|
+
},
|
|
3205
|
+
children: /* @__PURE__ */ J(A, {
|
|
3206
|
+
ref: m.measureElement,
|
|
3207
|
+
"data-index": e.index,
|
|
3208
|
+
"data-chat-message-list-item": "user",
|
|
3209
|
+
"data-chat-message-id": t.key,
|
|
3210
|
+
position: "sticky",
|
|
3211
|
+
top: "0",
|
|
3212
|
+
pointerEvents: "auto",
|
|
3213
|
+
pb: ro(u, e.index) ? "xs" : void 0,
|
|
3214
|
+
children: /* @__PURE__ */ J(so, {
|
|
3215
|
+
message: t.message,
|
|
3216
|
+
expanded: o.has(t.key),
|
|
3217
|
+
animate: d.has(t.key),
|
|
3218
|
+
onToggle: s
|
|
3219
|
+
})
|
|
3220
|
+
})
|
|
3221
|
+
}, e.key);
|
|
3222
|
+
}
|
|
3223
|
+
return /* @__PURE__ */ J(A, {
|
|
3224
|
+
ref: m.measureElement,
|
|
3187
3225
|
"data-index": e.index,
|
|
3188
3226
|
"data-chat-message-list-item": t.type,
|
|
3227
|
+
"data-chat-message-id": t.key,
|
|
3189
3228
|
position: "absolute",
|
|
3190
|
-
top: "0",
|
|
3191
3229
|
left: "0",
|
|
3192
3230
|
width: "100%",
|
|
3231
|
+
pb: ro(u, e.index) ? "xs" : void 0,
|
|
3193
3232
|
style: { top: e.start },
|
|
3194
|
-
children: /* @__PURE__ */ J(
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
hideActiveQuestionForms: i,
|
|
3199
|
-
expandedStickyMessageIds: o,
|
|
3233
|
+
children: /* @__PURE__ */ J($a, {
|
|
3234
|
+
message: t.message,
|
|
3235
|
+
streaming: r && t.isActiveTurn && t.showAssistantActions,
|
|
3236
|
+
hideQuestionForms: !t.isActiveTurn || i,
|
|
3200
3237
|
animate: d.has(t.key),
|
|
3201
|
-
|
|
3238
|
+
showAssistantActions: t.showAssistantActions
|
|
3202
3239
|
})
|
|
3203
|
-
}, e.key)
|
|
3240
|
+
}, e.key);
|
|
3204
3241
|
})
|
|
3205
3242
|
})
|
|
3206
3243
|
});
|
|
3207
|
-
},
|
|
3244
|
+
}, bo = (e) => {
|
|
3208
3245
|
let { queuedFollowUps: t, defaultValue: n, onChange: r, onSubmit: i, onUpdate: a, onCreate: o, onRestoreDraft: s, canRestoreDraft: c = !1, disabled: l = !1, onSelect: u, onDiscard: d } = e, [f, p] = Q(null), [m, h] = Q({}), [g, _] = Q(null), [v, y] = Q(0), [b, x] = Q({}), [S, C] = Q(null), [w, T] = Q(!1), [E, D] = Q(null), [O, k] = Q(null), A = t.find((e) => e.id === f?.id), j = !(!f || A), M = !!(f && A && f.revision && f.revision !== A.revision), N = f ? m[f.id]?.text ?? f.prompt : n, P = g?.text === n ? g.state : void 0, F = f ? m[f.id]?.state : P, I = (e) => {
|
|
3209
3246
|
p(e), C(null), k(null), u?.(e), y((e) => e + 1);
|
|
3210
3247
|
};
|
|
3211
3248
|
X(() => {
|
|
3212
3249
|
!f || A || w || l || E === f.id || (D(f.id), c && r && !n.trim() && !t.length && (s?.(f.id), _({
|
|
3213
3250
|
text: N,
|
|
3214
|
-
state: F ??
|
|
3251
|
+
state: F ?? wt(N)
|
|
3215
3252
|
}), x((e) => ({
|
|
3216
3253
|
...e,
|
|
3217
3254
|
draft: e[f.id]
|
|
@@ -3243,10 +3280,10 @@ var io = 3, ao = 20, oo = 1, so = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3243
3280
|
...t,
|
|
3244
3281
|
[f.id]: {
|
|
3245
3282
|
text: e,
|
|
3246
|
-
state:
|
|
3283
|
+
state: wt(e)
|
|
3247
3284
|
}
|
|
3248
3285
|
}));
|
|
3249
|
-
},
|
|
3286
|
+
}, R = (e, t) => {
|
|
3250
3287
|
if (!f) {
|
|
3251
3288
|
_({
|
|
3252
3289
|
text: e,
|
|
@@ -3261,12 +3298,12 @@ var io = 3, ao = 20, oo = 1, so = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3261
3298
|
state: t
|
|
3262
3299
|
}
|
|
3263
3300
|
}));
|
|
3264
|
-
},
|
|
3301
|
+
}, z = () => {
|
|
3265
3302
|
f && (d?.(f.id), h((e) => {
|
|
3266
3303
|
let t = { ...e };
|
|
3267
3304
|
return delete t[f.id], t;
|
|
3268
3305
|
})), I(null);
|
|
3269
|
-
},
|
|
3306
|
+
}, ee = async (e, t, n) => {
|
|
3270
3307
|
if (n) return i?.(e, t, n);
|
|
3271
3308
|
if (!f) return i?.(e, t);
|
|
3272
3309
|
if (M || w) throw Error("Select the saved request again before updating.");
|
|
@@ -3294,21 +3331,21 @@ var io = 3, ao = 20, oo = 1, so = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3294
3331
|
})),
|
|
3295
3332
|
draftValue: n,
|
|
3296
3333
|
change: L,
|
|
3297
|
-
changeState:
|
|
3334
|
+
changeState: R,
|
|
3298
3335
|
edit: (e) => {
|
|
3299
3336
|
w || I(e);
|
|
3300
3337
|
},
|
|
3301
3338
|
selectDraft: () => {
|
|
3302
3339
|
w || I(null);
|
|
3303
3340
|
},
|
|
3304
|
-
discard:
|
|
3341
|
+
discard: z,
|
|
3305
3342
|
editingItem: f,
|
|
3306
3343
|
editingItemId: f?.id ?? null,
|
|
3307
3344
|
focusSignal: v,
|
|
3308
3345
|
inputValue: N,
|
|
3309
3346
|
editorState: F,
|
|
3310
3347
|
isEditing: !!f,
|
|
3311
|
-
submit:
|
|
3348
|
+
submit: ee,
|
|
3312
3349
|
error: S,
|
|
3313
3350
|
notice: O ?? (j ? "This request was sent. Create a new queue item to keep your edits." : null),
|
|
3314
3351
|
createNew: j,
|
|
@@ -3316,65 +3353,64 @@ var io = 3, ao = 20, oo = 1, so = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3316
3353
|
stale: M,
|
|
3317
3354
|
dirtyItemIds: Object.keys(m).filter((e) => m[e].text !== t.find((t) => t.id === e)?.prompt)
|
|
3318
3355
|
};
|
|
3319
|
-
},
|
|
3320
|
-
let t = q(
|
|
3321
|
-
t[0] !==
|
|
3322
|
-
e.key !== "Escape" || e.defaultPrevented || e.nativeEvent.isComposing || !
|
|
3323
|
-
}, t[0] =
|
|
3324
|
-
let
|
|
3325
|
-
t[4] !==
|
|
3326
|
-
let
|
|
3327
|
-
t[7] !==
|
|
3356
|
+
}, xo = (e) => {
|
|
3357
|
+
let t = q(50), { conversationKey: n, recentUserMessages: r, actions: i, attachmentActions: a, attachedResources: o, attachmentList: s, chatInputAutoFocus: c, chatInputPlaceholder: l, chatInputQuestionPrompt: u, composerDecision: d, chatInputCommands: f, inputDisabled: p, submitDisabled: m, onAttachFiles: h, onAttachText: g, onClearAttachments: _, onInterrupt: v, queuedComposer: y, streaming: b } = e, { editing: x, hasQueuedFollowUps: S } = e, C = y.createNew ? "Create new queue item" : "Update", w = y.updating ? "Saving…" : C, T;
|
|
3358
|
+
t[0] !== x || t[1] !== p || t[2] !== y ? (T = (e) => {
|
|
3359
|
+
e.key !== "Escape" || e.defaultPrevented || e.nativeEvent.isComposing || !x || p || y.updating || !e.currentTarget.contains(e.target) || (e.preventDefault(), e.stopPropagation(), y.discard());
|
|
3360
|
+
}, t[0] = x, t[1] = p, t[2] = y, t[3] = T) : T = t[3];
|
|
3361
|
+
let E = `${n ?? ""}:${y.editingItemId ?? "draft"}`, D;
|
|
3362
|
+
t[4] !== y.editorState || t[5] !== y.inputValue ? (D = y.editorState ?? wt(y.inputValue), t[4] = y.editorState, t[5] = y.inputValue, t[6] = D) : D = t[6];
|
|
3363
|
+
let O = !x && b, k = x ? void 0 : v, M;
|
|
3364
|
+
t[7] !== x || t[8] !== p || t[9] !== y.discard || t[10] !== y.updating ? (M = x ? /* @__PURE__ */ J(j, {
|
|
3328
3365
|
size: "xs",
|
|
3329
3366
|
variant: "ghost",
|
|
3330
|
-
onClick:
|
|
3331
|
-
disabled:
|
|
3367
|
+
onClick: y.discard,
|
|
3368
|
+
disabled: y.updating || p,
|
|
3332
3369
|
children: "Cancel"
|
|
3333
|
-
}) : null, t[7] =
|
|
3334
|
-
let
|
|
3335
|
-
t[12] !== i || t[13] !== o || t[14] !== a || t[15] !== s || t[16] !== c || t[17] !== f || t[18] !== l || t[19] !== u || t[20] !== d || t[21] !==
|
|
3370
|
+
}) : null, t[7] = x, t[8] = p, t[9] = y.discard, t[10] = y.updating, t[11] = M) : M = t[11];
|
|
3371
|
+
let N = p || y.updating, P = m || x && y.stale, F = !x && S, I = x ? C : void 0, L = x ? w : void 0, R;
|
|
3372
|
+
t[12] !== i || t[13] !== o || t[14] !== a || t[15] !== s || t[16] !== c || t[17] !== f || t[18] !== l || t[19] !== u || t[20] !== d || t[21] !== x || t[22] !== h || t[23] !== g || t[24] !== _ || t[25] !== y.change || t[26] !== y.changeSelection || t[27] !== y.changeState || t[28] !== y.focusSignal || t[29] !== y.initialSelection || t[30] !== y.submit || t[31] !== r || t[32] !== E || t[33] !== L || t[34] !== D || t[35] !== O || t[36] !== k || t[37] !== M || t[38] !== N || t[39] !== P || t[40] !== F || t[41] !== I ? (R = /* @__PURE__ */ J(Zn, {
|
|
3336
3373
|
recentUserMessages: r,
|
|
3337
3374
|
placeholder: l,
|
|
3338
|
-
defaultState:
|
|
3339
|
-
streaming:
|
|
3340
|
-
onSubmit:
|
|
3341
|
-
onInterrupt:
|
|
3342
|
-
onAttachFiles:
|
|
3343
|
-
onAttachText:
|
|
3344
|
-
onChange:
|
|
3345
|
-
onEditorStateChange:
|
|
3346
|
-
initialSelection:
|
|
3347
|
-
onSelectionChange:
|
|
3375
|
+
defaultState: D,
|
|
3376
|
+
streaming: O,
|
|
3377
|
+
onSubmit: y.submit,
|
|
3378
|
+
onInterrupt: k,
|
|
3379
|
+
onAttachFiles: h,
|
|
3380
|
+
onAttachText: g,
|
|
3381
|
+
onChange: y.change,
|
|
3382
|
+
onEditorStateChange: y.changeState,
|
|
3383
|
+
initialSelection: y.initialSelection,
|
|
3384
|
+
onSelectionChange: y.changeSelection,
|
|
3348
3385
|
actions: i,
|
|
3349
|
-
submitActions:
|
|
3386
|
+
submitActions: M,
|
|
3350
3387
|
attachmentActions: a,
|
|
3351
3388
|
attachedResources: o,
|
|
3352
|
-
onClearAttachments:
|
|
3389
|
+
onClearAttachments: _,
|
|
3353
3390
|
attachmentList: s,
|
|
3354
|
-
isDisabled:
|
|
3355
|
-
submitDisabled:
|
|
3356
|
-
attachedToTop:
|
|
3357
|
-
recessed: p,
|
|
3391
|
+
isDisabled: N,
|
|
3392
|
+
submitDisabled: P,
|
|
3393
|
+
attachedToTop: F,
|
|
3358
3394
|
questionPrompt: u,
|
|
3359
3395
|
decision: d,
|
|
3360
3396
|
autoFocus: c,
|
|
3361
|
-
focusSignal:
|
|
3362
|
-
submitTitle:
|
|
3363
|
-
submitLabel:
|
|
3364
|
-
retainTextUntilAcknowledged:
|
|
3397
|
+
focusSignal: y.focusSignal,
|
|
3398
|
+
submitTitle: I,
|
|
3399
|
+
submitLabel: L,
|
|
3400
|
+
retainTextUntilAcknowledged: x,
|
|
3365
3401
|
commands: f
|
|
3366
|
-
},
|
|
3402
|
+
}, E), t[12] = i, t[13] = o, t[14] = a, t[15] = s, t[16] = c, t[17] = f, t[18] = l, t[19] = u, t[20] = d, t[21] = x, t[22] = h, t[23] = g, t[24] = _, t[25] = y.change, t[26] = y.changeSelection, t[27] = y.changeState, t[28] = y.focusSignal, t[29] = y.initialSelection, t[30] = y.submit, t[31] = r, t[32] = E, t[33] = L, t[34] = D, t[35] = O, t[36] = k, t[37] = M, t[38] = N, t[39] = P, t[40] = F, t[41] = I, t[42] = R) : R = t[42];
|
|
3367
3403
|
let z;
|
|
3368
|
-
t[
|
|
3369
|
-
queuedComposer:
|
|
3370
|
-
editing:
|
|
3371
|
-
}), t[
|
|
3372
|
-
let
|
|
3373
|
-
return t[
|
|
3374
|
-
onKeyDown:
|
|
3404
|
+
t[43] !== x || t[44] !== y ? (z = /* @__PURE__ */ J(So, {
|
|
3405
|
+
queuedComposer: y,
|
|
3406
|
+
editing: x
|
|
3407
|
+
}), t[43] = x, t[44] = y, t[45] = z) : z = t[45];
|
|
3408
|
+
let ee;
|
|
3409
|
+
return t[46] !== T || t[47] !== R || t[48] !== z ? (ee = /* @__PURE__ */ Y(A, {
|
|
3410
|
+
onKeyDown: T,
|
|
3375
3411
|
children: [R, z]
|
|
3376
|
-
}), t[
|
|
3377
|
-
},
|
|
3412
|
+
}), t[46] = T, t[47] = R, t[48] = z, t[49] = ee) : ee = t[49], ee;
|
|
3413
|
+
}, So = (e) => {
|
|
3378
3414
|
let t = q(4), { queuedComposer: n, editing: r } = e, i = r && n.stale, a = n.error ?? (i ? "This request changed. Your edit is kept; select the saved request again before updating." : n.notice);
|
|
3379
3415
|
if (!a) return null;
|
|
3380
3416
|
let o = !!(n.error || i), s = o ? "fg.error" : "fg.muted", c = o ? "alert" : "status", l;
|
|
@@ -3386,7 +3422,7 @@ var io = 3, ao = 20, oo = 1, so = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3386
3422
|
"aria-label": "Queued edit notice",
|
|
3387
3423
|
children: a
|
|
3388
3424
|
}), t[0] = a, t[1] = s, t[2] = c, t[3] = l) : l = t[3], l;
|
|
3389
|
-
},
|
|
3425
|
+
}, Co = (e, { context: t }, n) => {
|
|
3390
3426
|
if (![
|
|
3391
3427
|
"ArrowUp",
|
|
3392
3428
|
"ArrowDown",
|
|
@@ -3401,8 +3437,8 @@ var io = 3, ao = 20, oo = 1, so = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3401
3437
|
x: o.left + (o.width - (t.collisionRect?.width ?? 0)) / 2,
|
|
3402
3438
|
y: o.top + (o.height - (t.collisionRect?.height ?? 0)) / 2
|
|
3403
3439
|
};
|
|
3404
|
-
},
|
|
3405
|
-
let { item: t, index: n, kind: r } = e, i =
|
|
3440
|
+
}, wo = (e) => {
|
|
3441
|
+
let { item: t, index: n, kind: r } = e, i = et({
|
|
3406
3442
|
id: `${t.id}:${r}`,
|
|
3407
3443
|
disabled: !!(t.sending || t.steeringDelivery),
|
|
3408
3444
|
data: {
|
|
@@ -3435,8 +3471,8 @@ var io = 3, ao = 20, oo = 1, so = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3435
3471
|
pointerEvents: "none",
|
|
3436
3472
|
...a
|
|
3437
3473
|
});
|
|
3438
|
-
},
|
|
3439
|
-
let { visible: t, targeted: n, reason: r } = e, i =
|
|
3474
|
+
}, To = (e) => {
|
|
3475
|
+
let { visible: t, targeted: n, reason: r } = e, i = et({
|
|
3440
3476
|
id: "queue-send-now",
|
|
3441
3477
|
disabled: !t,
|
|
3442
3478
|
data: {
|
|
@@ -3457,8 +3493,8 @@ var io = 3, ao = 20, oo = 1, so = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3457
3493
|
children: [/* @__PURE__ */ J(Ce, { size: 14 }), /* @__PURE__ */ J(G, { children: "drop here to send now" })]
|
|
3458
3494
|
})
|
|
3459
3495
|
}) : null;
|
|
3460
|
-
},
|
|
3461
|
-
let { item: t, index: n, editor: r, source: i, destination: a, unavailableReason: o, editing: c, onEdit: l, onRemove: u } = e, d = !!(t.sending || t.steeringDelivery), f =
|
|
3496
|
+
}, Eo = (e) => {
|
|
3497
|
+
let { item: t, index: n, editor: r, source: i, destination: a, unavailableReason: o, editing: c, onEdit: l, onRemove: u } = e, d = !!(t.sending || t.steeringDelivery), f = $e({
|
|
3462
3498
|
id: t.id,
|
|
3463
3499
|
data: { item: t },
|
|
3464
3500
|
disabled: d
|
|
@@ -3494,7 +3530,7 @@ var io = 3, ao = 20, oo = 1, so = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3494
3530
|
!t.sending && S && !e.target.closest("button") && l?.(t);
|
|
3495
3531
|
},
|
|
3496
3532
|
children: [
|
|
3497
|
-
/* @__PURE__ */ J(
|
|
3533
|
+
/* @__PURE__ */ J(R, {
|
|
3498
3534
|
ref: f.setActivatorNodeRef,
|
|
3499
3535
|
...f.listeners,
|
|
3500
3536
|
...f.attributes,
|
|
@@ -3541,7 +3577,7 @@ var io = 3, ao = 20, oo = 1, so = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3541
3577
|
u && !r && !d ? /* @__PURE__ */ J(I, {
|
|
3542
3578
|
css: m.actions,
|
|
3543
3579
|
"data-visible": h || _ || c,
|
|
3544
|
-
children: /* @__PURE__ */ J(
|
|
3580
|
+
children: /* @__PURE__ */ J(R, {
|
|
3545
3581
|
"aria-label": "Remove queued follow-up",
|
|
3546
3582
|
size: "2xs",
|
|
3547
3583
|
variant: "destructive-ghost",
|
|
@@ -3551,17 +3587,17 @@ var io = 3, ao = 20, oo = 1, so = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3551
3587
|
children: /* @__PURE__ */ J(Ke, { size: 14 })
|
|
3552
3588
|
})
|
|
3553
3589
|
}) : null,
|
|
3554
|
-
/* @__PURE__ */ J(
|
|
3590
|
+
/* @__PURE__ */ J(wo, {
|
|
3555
3591
|
item: t,
|
|
3556
3592
|
index: n,
|
|
3557
3593
|
kind: "before"
|
|
3558
3594
|
}),
|
|
3559
|
-
/* @__PURE__ */ J(
|
|
3595
|
+
/* @__PURE__ */ J(wo, {
|
|
3560
3596
|
item: t,
|
|
3561
3597
|
index: n,
|
|
3562
3598
|
kind: "combine"
|
|
3563
3599
|
}),
|
|
3564
|
-
/* @__PURE__ */ J(
|
|
3600
|
+
/* @__PURE__ */ J(wo, {
|
|
3565
3601
|
item: t,
|
|
3566
3602
|
index: n,
|
|
3567
3603
|
kind: "after"
|
|
@@ -3570,7 +3606,7 @@ var io = 3, ao = 20, oo = 1, so = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3570
3606
|
a === "after" ? /* @__PURE__ */ J(s, { bottom: "0" }) : null
|
|
3571
3607
|
]
|
|
3572
3608
|
});
|
|
3573
|
-
},
|
|
3609
|
+
}, Do = (e) => JSON.stringify([e.model, Object.entries(e.params ?? {}).sort(([e], [t]) => e.localeCompare(t))]), Oo = (e) => {
|
|
3574
3610
|
let t = q(87), { items: r, editingItemId: i, editor: a, retainedEditor: o, retainedEditorPosition: s, dirtyItemIds: c, steeringUnavailableReason: l, onEdit: u, onRemove: d, onMove: f, onSteer: m, onCombine: h } = e, g;
|
|
3575
3611
|
t[0] === c ? g = t[1] : (g = c === void 0 ? [] : c, t[0] = c, t[1] = g);
|
|
3576
3612
|
let _ = g, v;
|
|
@@ -3580,41 +3616,41 @@ var io = 3, ao = 20, oo = 1, so = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3580
3616
|
let x = b, [S, C] = Q(null), w;
|
|
3581
3617
|
t[5] === Symbol.for("react.memo_cache_sentinel") ? (w = { activationConstraint: { distance: 4 } }, t[5] = w) : w = t[5];
|
|
3582
3618
|
let T;
|
|
3583
|
-
t[6] === Symbol.for("react.memo_cache_sentinel") ? (T = { coordinateGetter: (e, t) =>
|
|
3584
|
-
let E = tt(
|
|
3619
|
+
t[6] === Symbol.for("react.memo_cache_sentinel") ? (T = { coordinateGetter: (e, t) => Co(e, t, C) }, t[6] = T) : T = t[6];
|
|
3620
|
+
let E = nt(tt(Xe, w), tt(Ye, T)), [D, O] = Q(null), k;
|
|
3585
3621
|
t[7] === Symbol.for("react.memo_cache_sentinel") ? (k = [], t[7] = k) : k = t[7];
|
|
3586
|
-
let [j, M] = Q(k), [N, P] = Q(null), [F, I] = Q(null), [L,
|
|
3622
|
+
let [j, M] = Q(k), [N, P] = Q(null), [F, I] = Q(null), [L, R] = Q(!1);
|
|
3587
3623
|
if (!r.length && !o) return null;
|
|
3588
|
-
let
|
|
3589
|
-
t[8] !== r || t[9] !== s ? (
|
|
3590
|
-
let
|
|
3624
|
+
let z;
|
|
3625
|
+
t[8] !== r || t[9] !== s ? (z = ko(r, s), t[8] = r, t[9] = s, t[10] = z) : z = t[10];
|
|
3626
|
+
let ee = z, B;
|
|
3591
3627
|
t[11] !== _ || t[12] !== m || t[13] !== D || t[14] !== l ? (B = D?.steeringUnavailableReason ?? l ?? (D && _.includes(D.id) ? "Update or Cancel this edit before sending." : null) ?? (m ? null : "This conversation cannot accept live input."), t[11] = _, t[12] = m, t[13] = D, t[14] = l, t[15] = B) : B = t[15];
|
|
3592
3628
|
let te = B, V = !!(D && m && !l), ne;
|
|
3593
|
-
t[16] !== _ || t[17] !== D ? (ne = (e) => !D || D.id === e.id ? "Choose another request." : _.includes(D.id) || _.includes(e.id) ? "Update or Cancel the edits first." :
|
|
3594
|
-
let
|
|
3595
|
-
t[19] !== j || t[20] !== f ? (
|
|
3596
|
-
let r = j.filter(
|
|
3629
|
+
t[16] !== _ || t[17] !== D ? (ne = (e) => !D || D.id === e.id ? "Choose another request." : _.includes(D.id) || _.includes(e.id) ? "Update or Cancel the edits first." : Do(D) === Do(e) ? e.steeringDelivery ? "Delivery is still being confirmed." : null : "Model and thinking settings must match.", t[16] = _, t[17] = D, t[18] = ne) : ne = t[18];
|
|
3630
|
+
let H = ne, re;
|
|
3631
|
+
t[19] !== j || t[20] !== f ? (re = (e, t, n) => {
|
|
3632
|
+
let r = j.filter(jo), i = r.findIndex((t) => t.id === e.id), a = r.findIndex((e) => e.id === t.id);
|
|
3597
3633
|
if (i < 0 || a < 0 || i === a) return;
|
|
3598
3634
|
let o = a + +(n === "after"), s = o - +(i < o);
|
|
3599
3635
|
if (s !== i) return f?.(e.id, s < i ? "up" : "down", Math.abs(s - i), {
|
|
3600
3636
|
source: e,
|
|
3601
3637
|
items: j
|
|
3602
3638
|
});
|
|
3603
|
-
}, t[19] = j, t[20] = f, t[21] =
|
|
3604
|
-
let
|
|
3605
|
-
t[22] !==
|
|
3639
|
+
}, t[19] = j, t[20] = f, t[21] = re) : re = t[21];
|
|
3640
|
+
let U = re, ie;
|
|
3641
|
+
t[22] !== H || t[23] !== h || t[24] !== m || t[25] !== U || t[26] !== te ? (ie = (e, t) => {
|
|
3606
3642
|
if (t.kind === "steer") {
|
|
3607
3643
|
if (!te) return m?.(e);
|
|
3608
3644
|
I(te);
|
|
3609
3645
|
return;
|
|
3610
3646
|
}
|
|
3611
|
-
if (t.item) return t.kind === "combine" ?
|
|
3612
|
-
}, t[22] =
|
|
3613
|
-
let W =
|
|
3647
|
+
if (t.item) return t.kind === "combine" ? H(t.item) ? void 0 : h?.(e, t.item) : U(e, t.item, t.kind);
|
|
3648
|
+
}, t[22] = H, t[23] = h, t[24] = m, t[25] = U, t[26] = te, t[27] = ie) : ie = t[27];
|
|
3649
|
+
let W = ie, ae;
|
|
3614
3650
|
t[28] === S ? ae = t[29] : (ae = (e) => {
|
|
3615
3651
|
if (!e.pointerCoordinates && S !== null) return [{ id: S }];
|
|
3616
|
-
let t =
|
|
3617
|
-
return t.length ? t :
|
|
3652
|
+
let t = Ze(e);
|
|
3653
|
+
return t.length ? t : Qe(e);
|
|
3618
3654
|
}, t[28] = S, t[29] = ae);
|
|
3619
3655
|
let oe;
|
|
3620
3656
|
t[30] === r ? oe = t[31] : (oe = (e) => {
|
|
@@ -3627,10 +3663,10 @@ var io = 3, ao = 20, oo = 1, so = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3627
3663
|
let K;
|
|
3628
3664
|
t[34] !== L || t[35] !== W || t[36] !== D ? (K = (e) => {
|
|
3629
3665
|
let t = D, n = e.over?.data.current;
|
|
3630
|
-
O(null), P(null), t && n && !L && (
|
|
3666
|
+
O(null), P(null), t && n && !L && (R(!0), Promise.resolve().then(() => W(t, n)).catch((e) => I(e instanceof Error ? e.message : "Could not change the queue. Saved input is kept.")).finally(() => R(!1)));
|
|
3631
3667
|
}, t[34] = L, t[35] = W, t[36] = D, t[37] = K) : K = t[37];
|
|
3632
3668
|
let le = x.root, ue = N?.kind === "steer", de;
|
|
3633
|
-
t[38] !== V || t[39] !== te || t[40] !== ue ? (de = /* @__PURE__ */ J(
|
|
3669
|
+
t[38] !== V || t[39] !== te || t[40] !== ue ? (de = /* @__PURE__ */ J(To, {
|
|
3634
3670
|
visible: V,
|
|
3635
3671
|
targeted: ue,
|
|
3636
3672
|
reason: te
|
|
@@ -3638,22 +3674,22 @@ var io = 3, ao = 20, oo = 1, so = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3638
3674
|
let pe;
|
|
3639
3675
|
t[42] === Symbol.for("react.memo_cache_sentinel") ? (pe = { maxH: "queue-viewport" }, t[42] = pe) : pe = t[42];
|
|
3640
3676
|
let he;
|
|
3641
|
-
if (t[43] !==
|
|
3677
|
+
if (t[43] !== H || t[44] !== N || t[45] !== i || t[46] !== a || t[47] !== r || t[48] !== u || t[49] !== d || t[50] !== o || t[51] !== ee || t[52] !== D?.id) {
|
|
3642
3678
|
let e;
|
|
3643
|
-
t[54] !==
|
|
3679
|
+
t[54] !== H || t[55] !== N || t[56] !== i || t[57] !== a || t[58] !== u || t[59] !== d || t[60] !== o || t[61] !== ee || t[62] !== D?.id ? (e = (e, t) => /* @__PURE__ */ Y(me, { children: [o && t === ee ? /* @__PURE__ */ J(Ao, { children: o }) : null, /* @__PURE__ */ J(Eo, {
|
|
3644
3680
|
item: e,
|
|
3645
3681
|
index: t,
|
|
3646
3682
|
source: D?.id === e.id,
|
|
3647
3683
|
destination: N?.item?.id === e.id ? N.kind : void 0,
|
|
3648
|
-
unavailableReason: N?.kind === "combine" ?
|
|
3684
|
+
unavailableReason: N?.kind === "combine" ? H(e) : null,
|
|
3649
3685
|
editing: i === e.id,
|
|
3650
3686
|
editor: i === e.id ? a : void 0,
|
|
3651
3687
|
onEdit: u,
|
|
3652
3688
|
onRemove: d
|
|
3653
|
-
})] }, e.id), t[54] =
|
|
3689
|
+
})] }, e.id), t[54] = H, t[55] = N, t[56] = i, t[57] = a, t[58] = u, t[59] = d, t[60] = o, t[61] = ee, t[62] = D?.id, t[63] = e) : e = t[63], he = r.map(e), t[43] = H, t[44] = N, t[45] = i, t[46] = a, t[47] = r, t[48] = u, t[49] = d, t[50] = o, t[51] = ee, t[52] = D?.id, t[53] = he;
|
|
3654
3690
|
} else he = t[53];
|
|
3655
3691
|
let ge;
|
|
3656
|
-
t[64] !== r.length || t[65] !== o || t[66] !==
|
|
3692
|
+
t[64] !== r.length || t[65] !== o || t[66] !== ee ? (ge = o && ee === r.length ? /* @__PURE__ */ J(Ao, { children: o }) : null, t[64] = r.length, t[65] = o, t[66] = ee, t[67] = ge) : ge = t[67];
|
|
3657
3693
|
let _e;
|
|
3658
3694
|
t[68] !== he || t[69] !== ge ? (_e = /* @__PURE__ */ Y(n, {
|
|
3659
3695
|
maxH: "queue-viewport",
|
|
@@ -3679,7 +3715,7 @@ var io = 3, ao = 20, oo = 1, so = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3679
3715
|
]
|
|
3680
3716
|
}), t[74] = L, t[75] = V, t[76] = x.root, t[77] = de, t[78] = _e, t[79] = ve, t[80] = X) : X = t[80];
|
|
3681
3717
|
let ye;
|
|
3682
|
-
return t[81] !== E || t[82] !== ae || t[83] !== oe || t[84] !== K || t[85] !== X ? (ye = /* @__PURE__ */ J(
|
|
3718
|
+
return t[81] !== E || t[82] !== ae || t[83] !== oe || t[84] !== K || t[85] !== X ? (ye = /* @__PURE__ */ J(Je, {
|
|
3683
3719
|
sensors: E,
|
|
3684
3720
|
collisionDetection: ae,
|
|
3685
3721
|
autoScroll: !0,
|
|
@@ -3689,10 +3725,10 @@ var io = 3, ao = 20, oo = 1, so = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3689
3725
|
onDragEnd: K,
|
|
3690
3726
|
children: X
|
|
3691
3727
|
}), t[81] = E, t[82] = ae, t[83] = oe, t[84] = K, t[85] = X, t[86] = ye) : ye = t[86], ye;
|
|
3692
|
-
},
|
|
3728
|
+
}, ko = (e, t = Infinity) => {
|
|
3693
3729
|
let n = e.findIndex((e) => (e.position ?? Infinity) > t);
|
|
3694
3730
|
return n < 0 ? e.length : n;
|
|
3695
|
-
},
|
|
3731
|
+
}, Ao = (e) => {
|
|
3696
3732
|
let t = q(8), { children: n } = e, r;
|
|
3697
3733
|
t[0] === Symbol.for("react.memo_cache_sentinel") ? (r = { recipe: p }, t[0] = r) : r = t[0];
|
|
3698
3734
|
let i = fe(r), a;
|
|
@@ -3709,43 +3745,47 @@ var io = 3, ao = 20, oo = 1, so = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3709
3745
|
children: s
|
|
3710
3746
|
}), t[5] = o.row, t[6] = s, t[7] = c) : c = t[7], c;
|
|
3711
3747
|
};
|
|
3712
|
-
function
|
|
3748
|
+
function jo(e) {
|
|
3713
3749
|
return !e.sending && !e.steeringDelivery;
|
|
3714
3750
|
}
|
|
3715
3751
|
//#endregion
|
|
3716
3752
|
//#region src/components/chat-ui/components/chat-panel-composer.tsx
|
|
3717
|
-
var
|
|
3718
|
-
let t = q(
|
|
3753
|
+
var Mo = (e) => {
|
|
3754
|
+
let t = q(41), { composerHeader: n, chatInputQuestionPrompt: r, composerDecision: i, hasWorkspaceHub: a, onQueuedFollowUpMove: o, onQueuedFollowUpRemove: s, onQueuedFollowUpUpdate: c, onQueuedFollowUpSteer: l, onQueuedFollowUpCombine: u, queueSteeringUnavailableReason: d, unsavedQueueItemIds: f, queuedComposer: m, queuedFollowUps: h, workspaceHub: g } = e, _;
|
|
3719
3755
|
t[0] === f ? _ = t[1] : (_ = f === void 0 ? [] : f, t[0] = f, t[1] = _);
|
|
3720
3756
|
let v = _, y;
|
|
3721
3757
|
t[2] === Symbol.for("react.memo_cache_sentinel") ? (y = { recipe: p }, t[2] = y) : y = t[2];
|
|
3722
3758
|
let b = fe(y), x;
|
|
3723
3759
|
t[3] === b ? x = t[4] : (x = b(), t[3] = b, t[4] = x);
|
|
3724
|
-
let S = x, C
|
|
3725
|
-
t[5]
|
|
3760
|
+
let S = x, C;
|
|
3761
|
+
t[5] === Symbol.for("react.memo_cache_sentinel") ? (C = { recipe: Ct }, t[5] = C) : C = t[5];
|
|
3762
|
+
let w = fe(C), T;
|
|
3763
|
+
t[6] !== a || t[7] !== w ? (T = w({ workspace: a }), t[6] = a, t[7] = w, t[8] = T) : T = t[8];
|
|
3764
|
+
let E = T, D = h.length > 0, O = m.isEditing && !r && !i, k;
|
|
3765
|
+
t[9] !== O || t[10] !== D || t[11] !== e ? (k = /* @__PURE__ */ J(xo, {
|
|
3726
3766
|
...e,
|
|
3727
|
-
editing:
|
|
3728
|
-
hasQueuedFollowUps:
|
|
3729
|
-
}), t[
|
|
3730
|
-
let
|
|
3731
|
-
t[
|
|
3732
|
-
let
|
|
3733
|
-
t[
|
|
3767
|
+
editing: O,
|
|
3768
|
+
hasQueuedFollowUps: D
|
|
3769
|
+
}), t[9] = O, t[10] = D, t[11] = e, t[12] = k) : k = t[12];
|
|
3770
|
+
let j = k, M = O ? j : void 0, N = O && m.createNew ? j : void 0, P = m.editingItem?.position, F;
|
|
3771
|
+
t[13] !== m.dirtyItemIds || t[14] !== v ? (F = [...m.dirtyItemIds, ...v], t[13] = m.dirtyItemIds, t[14] = v, t[15] = F) : F = t[15];
|
|
3772
|
+
let I = c ? m.edit : void 0, L;
|
|
3773
|
+
t[16] !== u || t[17] !== o || t[18] !== s || t[19] !== l || t[20] !== d || t[21] !== m.editingItemId || t[22] !== h || t[23] !== N || t[24] !== P || t[25] !== F || t[26] !== I || t[27] !== M ? (L = /* @__PURE__ */ J(Oo, {
|
|
3734
3774
|
items: h,
|
|
3735
|
-
editor:
|
|
3736
|
-
retainedEditor:
|
|
3737
|
-
retainedEditorPosition:
|
|
3738
|
-
dirtyItemIds:
|
|
3775
|
+
editor: M,
|
|
3776
|
+
retainedEditor: N,
|
|
3777
|
+
retainedEditorPosition: P,
|
|
3778
|
+
dirtyItemIds: F,
|
|
3739
3779
|
steeringUnavailableReason: d,
|
|
3740
3780
|
onSteer: l,
|
|
3741
3781
|
onCombine: u,
|
|
3742
3782
|
editingItemId: m.editingItemId,
|
|
3743
|
-
onEdit:
|
|
3783
|
+
onEdit: I,
|
|
3744
3784
|
onRemove: s,
|
|
3745
3785
|
onMove: o
|
|
3746
|
-
}), t[
|
|
3747
|
-
let
|
|
3748
|
-
t[
|
|
3786
|
+
}), t[16] = u, t[17] = o, t[18] = s, t[19] = l, t[20] = d, t[21] = m.editingItemId, t[22] = h, t[23] = N, t[24] = P, t[25] = F, t[26] = I, t[27] = M, t[28] = L) : L = t[28];
|
|
3787
|
+
let R;
|
|
3788
|
+
t[29] !== O || t[30] !== j || t[31] !== m.draftValue || t[32] !== m.selectDraft || t[33] !== S ? (R = O ? /* @__PURE__ */ J(A, {
|
|
3749
3789
|
css: S.draft,
|
|
3750
3790
|
asChild: !0,
|
|
3751
3791
|
children: /* @__PURE__ */ J("button", {
|
|
@@ -3754,32 +3794,28 @@ var Po = (e) => {
|
|
|
3754
3794
|
"aria-label": "Edit saved draft",
|
|
3755
3795
|
children: m.draftValue || "Saved draft · select to edit"
|
|
3756
3796
|
})
|
|
3757
|
-
}) :
|
|
3758
|
-
let
|
|
3759
|
-
return t[
|
|
3797
|
+
}) : j, t[29] = O, t[30] = j, t[31] = m.draftValue, t[32] = m.selectDraft, t[33] = S, t[34] = R) : R = t[34];
|
|
3798
|
+
let z;
|
|
3799
|
+
return t[35] !== n || t[36] !== E.workspace || t[37] !== L || t[38] !== R || t[39] !== g ? (z = /* @__PURE__ */ J(W, {
|
|
3760
3800
|
p: "xs",
|
|
3761
3801
|
gap: "0",
|
|
3762
|
-
children: /* @__PURE__ */ Y(
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
borderWidth: k,
|
|
3766
|
-
borderColor: j,
|
|
3767
|
-
borderRadius: M,
|
|
3768
|
-
bg: N,
|
|
3802
|
+
children: /* @__PURE__ */ Y(A, {
|
|
3803
|
+
className: "ps-chat-composer__workspace",
|
|
3804
|
+
css: E.workspace,
|
|
3769
3805
|
children: [
|
|
3770
3806
|
g,
|
|
3771
3807
|
n,
|
|
3772
|
-
|
|
3773
|
-
|
|
3808
|
+
L,
|
|
3809
|
+
R
|
|
3774
3810
|
]
|
|
3775
3811
|
})
|
|
3776
|
-
}), t[
|
|
3777
|
-
},
|
|
3812
|
+
}), t[35] = n, t[36] = E.workspace, t[37] = L, t[38] = R, t[39] = g, t[40] = z) : z = t[40], z;
|
|
3813
|
+
}, No = (e) => {
|
|
3778
3814
|
let t = Math.max(0, Math.floor(e));
|
|
3779
3815
|
if (t < 60) return `${t}s`;
|
|
3780
3816
|
let n = Math.floor(t / 60);
|
|
3781
3817
|
return n < 60 ? `${n}m ${String(t % 60).padStart(2, "0")}s` : `${Math.floor(n / 60)}h ${String(n % 60).padStart(2, "0")}m`;
|
|
3782
|
-
},
|
|
3818
|
+
}, Po = (e) => {
|
|
3783
3819
|
let t = q(8), { startedAt: n, hidden: r } = e, i = r !== void 0 && r, [a] = Q(Date.now), [o, s] = Q(Date.now), c, l;
|
|
3784
3820
|
if (t[0] === i ? (c = t[1], l = t[2]) : (c = () => {
|
|
3785
3821
|
if (i) return;
|
|
@@ -3789,12 +3825,12 @@ var Po = (e) => {
|
|
|
3789
3825
|
return () => clearInterval(t);
|
|
3790
3826
|
}, l = [i], t[0] = i, t[1] = c, t[2] = l), X(c, l), i) return null;
|
|
3791
3827
|
let u;
|
|
3792
|
-
t[3] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ J(
|
|
3828
|
+
t[3] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ J(ie, {
|
|
3793
3829
|
size: "xs",
|
|
3794
3830
|
color: "fg.muted"
|
|
3795
3831
|
}), t[3] = u) : u = t[3];
|
|
3796
3832
|
let d = (o - (n ?? a)) / 1e3, f;
|
|
3797
|
-
t[4] === d ? f = t[5] : (f =
|
|
3833
|
+
t[4] === d ? f = t[5] : (f = No(d), t[4] = d, t[5] = f);
|
|
3798
3834
|
let p;
|
|
3799
3835
|
return t[6] === f ? p = t[7] : (p = /* @__PURE__ */ Y(I, {
|
|
3800
3836
|
gap: "2xs",
|
|
@@ -3808,17 +3844,17 @@ var Po = (e) => {
|
|
|
3808
3844
|
children: f
|
|
3809
3845
|
})]
|
|
3810
3846
|
}), t[6] = f, t[7] = p), p;
|
|
3811
|
-
},
|
|
3812
|
-
let t = q(
|
|
3813
|
-
t[0] ===
|
|
3847
|
+
}, Fo = (e) => {
|
|
3848
|
+
let t = q(113), { conversationKey: n, linkHandler: r, messages: i, loading: a, streaming: o, streamingStartedAt: s, emptyStateTitle: l, emptyStateDescription: u, emptyStateContent: d, loaderComponent: f, chatInputPlaceholder: p, chatInputDefaultValue: h, onSubmitMessage: g, onInterrupt: _, onAttachFiles: b, onAttachText: x, onChatInputChange: S, actions: C, attachmentActions: w, composerHeader: T, attachedResources: E, onClearAttachments: D, attachmentList: O, approvalPrompt: k, conversationNotices: j, workspaceHub: M, workspaceInitializing: N, inputDisabled: P, submitDisabled: I, chatInputQuestionPrompt: L, composerDecision: R, chatInputAutoFocus: z, queuedFollowUps: ee, onQueuedFollowUpUpdate: B, onQueuedFollowUpCreate: te, onQueuedFollowUpRestoreDraft: V, canRestoreQueuedEditToDraft: ne, onQueuedFollowUpSelect: H, onQueuedFollowUpDiscard: re, onQueuedFollowUpSteer: U, onQueuedFollowUpCombine: ie, queueSteeringUnavailableReason: W, unsavedQueueItemIds: ae, onQueuedFollowUpRemove: G, onQueuedFollowUpMove: oe, chatInputCommands: se } = e, ce = a !== void 0 && a, K = o !== void 0 && o, le = h === void 0 ? "" : h, ue = N !== void 0 && N, de = P !== void 0 && P, fe = I !== void 0 && I, me = z !== void 0 && z, he;
|
|
3849
|
+
t[0] === ee ? he = t[1] : (he = ee === void 0 ? [] : ee, t[0] = ee, t[1] = he);
|
|
3814
3850
|
let ge = he, _e;
|
|
3815
3851
|
t[2] === se ? _e = t[3] : (_e = se === void 0 ? [] : se, t[2] = se, t[3] = _e);
|
|
3816
3852
|
let ve = _e, X, ye, Z, be, xe;
|
|
3817
3853
|
if (t[4] !== n || t[5] !== i || t[6] !== K) {
|
|
3818
|
-
let e =
|
|
3819
|
-
X = e.length > 0, Z = n ?? e[0]?.id, ye = X ? Z ?? "active-conversation" : null, xe = e.reduce(
|
|
3854
|
+
let e = Xa(i, { streaming: K });
|
|
3855
|
+
X = e.length > 0, Z = n ?? e[0]?.id, ye = X ? Z ?? "active-conversation" : null, xe = e.reduce(Io, 0), be = Qa(e), t[4] = n, t[5] = i, t[6] = K, t[7] = X, t[8] = ye, t[9] = Z, t[10] = be, t[11] = xe;
|
|
3820
3856
|
} else X = t[7], ye = t[8], Z = t[9], be = t[10], xe = t[11];
|
|
3821
|
-
let { groups: Se, leadingResponses: Ce } = be, [we, Te] = Q(
|
|
3857
|
+
let { groups: Se, leadingResponses: Ce } = be, [we, Te] = Q(Lo), [Ee, De] = Q(null), Oe = !X && ce, ke;
|
|
3822
3858
|
t[12] === Symbol.for("react.memo_cache_sentinel") ? (ke = /* @__PURE__ */ J(ze, {
|
|
3823
3859
|
size: 48,
|
|
3824
3860
|
strokeWidth: 1.5
|
|
@@ -3829,10 +3865,10 @@ var Po = (e) => {
|
|
|
3829
3865
|
title: l,
|
|
3830
3866
|
description: u
|
|
3831
3867
|
}), t[13] = u, t[14] = l, t[15] = Ae) : Ae = t[15];
|
|
3832
|
-
let je = Oe ? f : d ?? Ae, Me = !!M, Ne =
|
|
3833
|
-
t[16] !== L || t[17] !== i || t[18] !== Ne.prompt ? (Pe = Ne.prompt ?? L ??
|
|
3868
|
+
let je = Oe ? f : d ?? Ae, Me = !!M, Ne = Cn(i, n ?? i[0]?.id), Pe;
|
|
3869
|
+
t[16] !== L || t[17] !== i || t[18] !== Ne.prompt ? (Pe = Ne.prompt ?? L ?? yn(i), t[16] = L, t[17] = i, t[18] = Ne.prompt, t[19] = Pe) : Pe = t[19];
|
|
3834
3870
|
let Fe = Pe, Ie = !!Fe, Le = K && X && !ue && !Fe, Re = !ye || Ee === ye, Be;
|
|
3835
|
-
t[20] !== ne || t[21] !== le || t[22] !== de || t[23] !== S || t[24] !== te || t[25] !==
|
|
3871
|
+
t[20] !== ne || t[21] !== le || t[22] !== de || t[23] !== S || t[24] !== te || t[25] !== re || t[26] !== V || t[27] !== H || t[28] !== B || t[29] !== g || t[30] !== ge ? (Be = {
|
|
3836
3872
|
queuedFollowUps: ge,
|
|
3837
3873
|
defaultValue: le,
|
|
3838
3874
|
onChange: S,
|
|
@@ -3842,10 +3878,10 @@ var Po = (e) => {
|
|
|
3842
3878
|
onRestoreDraft: V,
|
|
3843
3879
|
canRestoreDraft: ne,
|
|
3844
3880
|
disabled: de,
|
|
3845
|
-
onSelect:
|
|
3846
|
-
onDiscard:
|
|
3847
|
-
}, t[20] = ne, t[21] = le, t[22] = de, t[23] = S, t[24] = te, t[25] =
|
|
3848
|
-
let Ve =
|
|
3881
|
+
onSelect: H,
|
|
3882
|
+
onDiscard: re
|
|
3883
|
+
}, t[20] = ne, t[21] = le, t[22] = de, t[23] = S, t[24] = te, t[25] = re, t[26] = V, t[27] = H, t[28] = B, t[29] = g, t[30] = ge, t[31] = Be) : Be = t[31];
|
|
3884
|
+
let Ve = bo(Be), He;
|
|
3849
3885
|
t[32] === Symbol.for("react.memo_cache_sentinel") ? (He = (e) => {
|
|
3850
3886
|
Te((t) => {
|
|
3851
3887
|
let n = new Set(t);
|
|
@@ -3855,12 +3891,12 @@ var Po = (e) => {
|
|
|
3855
3891
|
let Ue = He, We;
|
|
3856
3892
|
t[33] !== r || t[34] !== i ? (We = y(i, r), t[33] = r, t[34] = i, t[35] = We) : We = t[35];
|
|
3857
3893
|
let Ge = Ne.value, Ke = Z ?? null, qe;
|
|
3858
|
-
t[36] !== Ke || t[37] !== xe ? (qe = /* @__PURE__ */ J(
|
|
3894
|
+
t[36] !== Ke || t[37] !== xe ? (qe = /* @__PURE__ */ J(St, {
|
|
3859
3895
|
conversationKey: Ke,
|
|
3860
3896
|
userMessageCount: xe
|
|
3861
3897
|
}), t[36] = Ke, t[37] = xe, t[38] = qe) : qe = t[38];
|
|
3862
3898
|
let Je = Re ? "visible" : "hidden", Ye;
|
|
3863
|
-
t[39] !== j || t[40] !== je || t[41] !== we || t[42] !== Se || t[43] !== X || t[44] !== Ie || t[45] !== Ce || t[46] !== ye || t[47] !== K ? (Ye = X ? /* @__PURE__ */ Y(pe, { children: [/* @__PURE__ */ J(
|
|
3899
|
+
t[39] !== j || t[40] !== je || t[41] !== we || t[42] !== Se || t[43] !== X || t[44] !== Ie || t[45] !== Ce || t[46] !== ye || t[47] !== K ? (Ye = X ? /* @__PURE__ */ Y(pe, { children: [/* @__PURE__ */ J(yo, {
|
|
3864
3900
|
leadingResponses: Ce,
|
|
3865
3901
|
groups: Se,
|
|
3866
3902
|
streaming: K,
|
|
@@ -3870,27 +3906,27 @@ var Po = (e) => {
|
|
|
3870
3906
|
onReady: () => De(ye)
|
|
3871
3907
|
}, ye), j] }) : /* @__PURE__ */ Y(pe, { children: [j, je] }), t[39] = j, t[40] = je, t[41] = we, t[42] = Se, t[43] = X, t[44] = Ie, t[45] = Ce, t[46] = ye, t[47] = K, t[48] = Ye) : Ye = t[48];
|
|
3872
3908
|
let Xe;
|
|
3873
|
-
t[49] !== Je || t[50] !== Ye ? (Xe = /* @__PURE__ */ J(
|
|
3909
|
+
t[49] !== Je || t[50] !== Ye ? (Xe = /* @__PURE__ */ J(lt.Viewport, {
|
|
3874
3910
|
visibility: Je,
|
|
3875
3911
|
children: Ye
|
|
3876
3912
|
}), t[49] = Je, t[50] = Ye, t[51] = Xe) : Xe = t[51];
|
|
3877
3913
|
let Ze;
|
|
3878
|
-
t[52] === Re ? Ze = t[53] : (Ze = Re ? /* @__PURE__ */ J(
|
|
3914
|
+
t[52] === Re ? Ze = t[53] : (Ze = Re ? /* @__PURE__ */ J(lt.ScrollToBottom, { "aria-label": "Scroll to latest message" }) : null, t[52] = Re, t[53] = Ze);
|
|
3879
3915
|
let Qe;
|
|
3880
|
-
t[54] !==
|
|
3916
|
+
t[54] !== Z || t[55] !== qe || t[56] !== Xe || t[57] !== Ze ? (Qe = /* @__PURE__ */ Y(lt.Root, { children: [
|
|
3881
3917
|
qe,
|
|
3882
3918
|
Xe,
|
|
3883
3919
|
Ze
|
|
3884
|
-
] }), t[54] =
|
|
3920
|
+
] }, Z), t[54] = Z, t[55] = qe, t[56] = Xe, t[57] = Ze, t[58] = Qe) : Qe = t[58];
|
|
3885
3921
|
let $e;
|
|
3886
|
-
t[
|
|
3922
|
+
t[59] !== Z || t[60] !== Le || t[61] !== K || t[62] !== s ? ($e = K ? /* @__PURE__ */ J(Po, {
|
|
3887
3923
|
startedAt: s,
|
|
3888
3924
|
hidden: !Le
|
|
3889
|
-
}, Z) : null, t[
|
|
3925
|
+
}, Z) : null, t[59] = Z, t[60] = Le, t[61] = K, t[62] = s, t[63] = $e) : $e = t[63];
|
|
3890
3926
|
let et = n ?? i[0]?.id, tt;
|
|
3891
|
-
t[
|
|
3892
|
-
let nt = Ne.prompt ? void 0 :
|
|
3893
|
-
t[
|
|
3927
|
+
t[64] === i ? tt = t[65] : (tt = Un(i), t[64] = i, t[65] = tt);
|
|
3928
|
+
let nt = Ne.prompt ? void 0 : R, rt;
|
|
3929
|
+
t[66] !== C || t[67] !== Fe || t[68] !== E || t[69] !== w || t[70] !== O || t[71] !== me || t[72] !== ve || t[73] !== p || t[74] !== T || t[75] !== Me || t[76] !== de || t[77] !== b || t[78] !== x || t[79] !== D || t[80] !== _ || t[81] !== ie || t[82] !== oe || t[83] !== G || t[84] !== U || t[85] !== B || t[86] !== W || t[87] !== Ve || t[88] !== ge || t[89] !== K || t[90] !== fe || t[91] !== et || t[92] !== tt || t[93] !== nt || t[94] !== ae || t[95] !== M ? (rt = /* @__PURE__ */ J(Mo, {
|
|
3894
3930
|
conversationKey: et,
|
|
3895
3931
|
recentUserMessages: tt,
|
|
3896
3932
|
actions: C,
|
|
@@ -3913,17 +3949,17 @@ var Po = (e) => {
|
|
|
3913
3949
|
onQueuedFollowUpMove: oe,
|
|
3914
3950
|
onQueuedFollowUpRemove: G,
|
|
3915
3951
|
onQueuedFollowUpUpdate: B,
|
|
3916
|
-
onQueuedFollowUpSteer:
|
|
3917
|
-
onQueuedFollowUpCombine:
|
|
3952
|
+
onQueuedFollowUpSteer: U,
|
|
3953
|
+
onQueuedFollowUpCombine: ie,
|
|
3918
3954
|
queueSteeringUnavailableReason: W,
|
|
3919
3955
|
unsavedQueueItemIds: ae,
|
|
3920
3956
|
queuedComposer: Ve,
|
|
3921
3957
|
queuedFollowUps: ge,
|
|
3922
3958
|
streaming: K,
|
|
3923
3959
|
workspaceHub: M
|
|
3924
|
-
}), t[
|
|
3960
|
+
}), t[66] = C, t[67] = Fe, t[68] = E, t[69] = w, t[70] = O, t[71] = me, t[72] = ve, t[73] = p, t[74] = T, t[75] = Me, t[76] = de, t[77] = b, t[78] = x, t[79] = D, t[80] = _, t[81] = ie, t[82] = oe, t[83] = G, t[84] = U, t[85] = B, t[86] = W, t[87] = Ve, t[88] = ge, t[89] = K, t[90] = fe, t[91] = et, t[92] = tt, t[93] = nt, t[94] = ae, t[95] = M, t[96] = rt) : rt = t[96];
|
|
3925
3961
|
let it;
|
|
3926
|
-
t[
|
|
3962
|
+
t[97] !== k || t[98] !== $e || t[99] !== rt ? (it = /* @__PURE__ */ Y(A, {
|
|
3927
3963
|
layerStyle: "chatContent",
|
|
3928
3964
|
flexShrink: "0",
|
|
3929
3965
|
children: [
|
|
@@ -3931,56 +3967,56 @@ var Po = (e) => {
|
|
|
3931
3967
|
$e,
|
|
3932
3968
|
rt
|
|
3933
3969
|
]
|
|
3934
|
-
}), t[
|
|
3970
|
+
}), t[97] = k, t[98] = $e, t[99] = rt, t[100] = it) : it = t[100];
|
|
3935
3971
|
let at;
|
|
3936
|
-
t[
|
|
3972
|
+
t[101] !== Qe || t[102] !== it ? (at = /* @__PURE__ */ Y(F, {
|
|
3937
3973
|
position: "relative",
|
|
3938
3974
|
direction: "column",
|
|
3939
3975
|
w: "full",
|
|
3940
3976
|
h: "full",
|
|
3941
3977
|
overflow: "hidden",
|
|
3942
3978
|
children: [Qe, it]
|
|
3943
|
-
}), t[
|
|
3979
|
+
}), t[101] = Qe, t[102] = it, t[103] = at) : at = t[103];
|
|
3944
3980
|
let ot;
|
|
3945
|
-
t[
|
|
3981
|
+
t[104] !== Ne.value || t[105] !== at ? (ot = /* @__PURE__ */ J(xn, {
|
|
3946
3982
|
value: Ge,
|
|
3947
3983
|
children: at
|
|
3948
|
-
}), t[
|
|
3949
|
-
let
|
|
3950
|
-
t[
|
|
3984
|
+
}), t[104] = Ne.value, t[105] = at, t[106] = ot) : ot = t[106];
|
|
3985
|
+
let st;
|
|
3986
|
+
t[107] !== r || t[108] !== ot ? (st = /* @__PURE__ */ J(m, {
|
|
3951
3987
|
handler: r,
|
|
3952
3988
|
children: ot
|
|
3953
|
-
}), t[
|
|
3954
|
-
let
|
|
3955
|
-
return t[
|
|
3989
|
+
}), t[107] = r, t[108] = ot, t[109] = st) : st = t[109];
|
|
3990
|
+
let ct;
|
|
3991
|
+
return t[110] !== We || t[111] !== st ? (ct = /* @__PURE__ */ J(v, {
|
|
3956
3992
|
value: We,
|
|
3957
|
-
children:
|
|
3958
|
-
}), t[
|
|
3993
|
+
children: st
|
|
3994
|
+
}), t[110] = We, t[111] = st, t[112] = ct) : ct = t[112], ct;
|
|
3959
3995
|
};
|
|
3960
|
-
function
|
|
3996
|
+
function Io(e, t) {
|
|
3961
3997
|
return e + +(t.role === "user");
|
|
3962
3998
|
}
|
|
3963
|
-
function
|
|
3999
|
+
function Lo() {
|
|
3964
4000
|
return /* @__PURE__ */ new Set();
|
|
3965
4001
|
}
|
|
3966
4002
|
//#endregion
|
|
3967
4003
|
//#region src/components/chat-ui/components/chat-skeleton.tsx
|
|
3968
|
-
var
|
|
4004
|
+
var Ro = (e) => {
|
|
3969
4005
|
let t = q(4), { widths: n } = e, r;
|
|
3970
|
-
t[0] === n ? r = t[1] : (r = n.map(
|
|
4006
|
+
t[0] === n ? r = t[1] : (r = n.map(Bo), t[0] = n, t[1] = r);
|
|
3971
4007
|
let i;
|
|
3972
4008
|
return t[2] === r ? i = t[3] : (i = /* @__PURE__ */ J(W, {
|
|
3973
4009
|
gap: "xs",
|
|
3974
4010
|
w: "full",
|
|
3975
4011
|
children: r
|
|
3976
4012
|
}), t[2] = r, t[3] = i), i;
|
|
3977
|
-
},
|
|
4013
|
+
}, zo = () => {
|
|
3978
4014
|
let e = q(2), t;
|
|
3979
|
-
e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ J(
|
|
4015
|
+
e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ J(pt.Root, {
|
|
3980
4016
|
from: "user",
|
|
3981
|
-
children: /* @__PURE__ */ J(
|
|
4017
|
+
children: /* @__PURE__ */ J(pt.Content, {
|
|
3982
4018
|
from: "user",
|
|
3983
|
-
children: /* @__PURE__ */ J(
|
|
4019
|
+
children: /* @__PURE__ */ J(Ro, { widths: ["72%", "46%"] })
|
|
3984
4020
|
})
|
|
3985
4021
|
}), e[0] = t) : t = e[0];
|
|
3986
4022
|
let n;
|
|
@@ -3988,11 +4024,11 @@ var Bo = (e) => {
|
|
|
3988
4024
|
minH: "full",
|
|
3989
4025
|
py: "xs",
|
|
3990
4026
|
gap: "0",
|
|
3991
|
-
children: [t, /* @__PURE__ */ J(
|
|
4027
|
+
children: [t, /* @__PURE__ */ J(pt.Root, {
|
|
3992
4028
|
from: "assistant",
|
|
3993
|
-
children: /* @__PURE__ */ J(
|
|
4029
|
+
children: /* @__PURE__ */ J(pt.Content, {
|
|
3994
4030
|
from: "assistant",
|
|
3995
|
-
children: /* @__PURE__ */ J(
|
|
4031
|
+
children: /* @__PURE__ */ J(Ro, { widths: [
|
|
3996
4032
|
"76%",
|
|
3997
4033
|
"62%",
|
|
3998
4034
|
"40%"
|
|
@@ -4001,8 +4037,8 @@ var Bo = (e) => {
|
|
|
4001
4037
|
})]
|
|
4002
4038
|
}), e[1] = n) : n = e[1], n;
|
|
4003
4039
|
};
|
|
4004
|
-
function
|
|
4005
|
-
return /* @__PURE__ */ J(
|
|
4040
|
+
function Bo(e, t) {
|
|
4041
|
+
return /* @__PURE__ */ J(re, {
|
|
4006
4042
|
height: "3",
|
|
4007
4043
|
width: e,
|
|
4008
4044
|
borderRadius: "xs"
|
|
@@ -4010,15 +4046,15 @@ function Ho(e, t) {
|
|
|
4010
4046
|
}
|
|
4011
4047
|
//#endregion
|
|
4012
4048
|
//#region src/components/chat-ui/components/conversation-browse.tsx
|
|
4013
|
-
var
|
|
4049
|
+
var Vo = 3, Ho = 10, Uo = 4, Wo = (e, t) => {
|
|
4014
4050
|
if (t === null) return 0;
|
|
4015
4051
|
let n = Math.abs(e - t);
|
|
4016
|
-
return n >=
|
|
4017
|
-
},
|
|
4052
|
+
return n >= Uo ? 0 : (1 + Math.cos(Math.PI * n / Uo)) / 2;
|
|
4053
|
+
}, Go = (e, t) => {
|
|
4018
4054
|
if (t === null) return "fg.subtle";
|
|
4019
4055
|
let n = Math.abs(e - t);
|
|
4020
|
-
return n < .5 ? "fg" : n <
|
|
4021
|
-
},
|
|
4056
|
+
return n < .5 ? "fg" : n < Uo ? "fg.muted" : "fg.subtle";
|
|
4057
|
+
}, Ko = (e) => {
|
|
4022
4058
|
let t = q(11), { item: n, position: r } = e, i = `${r.left}px`, a = `${r.top}px`, o;
|
|
4023
4059
|
t[0] === n.message ? o = t[1] : (o = /* @__PURE__ */ J(G, {
|
|
4024
4060
|
textStyle: "label/S/medium",
|
|
@@ -4044,7 +4080,7 @@ var Uo = 3, Wo = 10, Go = 4, Ko = (e, t) => {
|
|
|
4044
4080
|
children: [o, s]
|
|
4045
4081
|
}), t[4] = o, t[5] = s, t[6] = c) : c = t[6];
|
|
4046
4082
|
let l;
|
|
4047
|
-
return t[7] !== i || t[8] !== a || t[9] !== c ? (l = /* @__PURE__ */ J(
|
|
4083
|
+
return t[7] !== i || t[8] !== a || t[9] !== c ? (l = /* @__PURE__ */ J(H, { children: /* @__PURE__ */ J(A, {
|
|
4048
4084
|
position: "fixed",
|
|
4049
4085
|
left: i,
|
|
4050
4086
|
ml: "2xs",
|
|
@@ -4056,9 +4092,9 @@ var Uo = 3, Wo = 10, Go = 4, Ko = (e, t) => {
|
|
|
4056
4092
|
pointerEvents: "none",
|
|
4057
4093
|
children: c
|
|
4058
4094
|
}) }), t[7] = i, t[8] = a, t[9] = c, t[10] = l) : l = t[10], l;
|
|
4059
|
-
},
|
|
4095
|
+
}, qo = (e) => {
|
|
4060
4096
|
let t = q(22), { items: n, onSelect: r, floating: i } = e, a = i !== void 0 && i, [o, s] = Q(null), [c, l] = Q(null);
|
|
4061
|
-
if (n.length <
|
|
4097
|
+
if (n.length < Vo) return null;
|
|
4062
4098
|
let u;
|
|
4063
4099
|
t[0] === n.length ? u = t[1] : (u = (e) => {
|
|
4064
4100
|
let t = e.currentTarget.getBoundingClientRect(), r = (e.clientY - t.top) / t.height, i = Math.min(n.length - 1, Math.max(0, r * n.length - .5)), a = Math.round(i);
|
|
@@ -4083,8 +4119,8 @@ var Uo = 3, Wo = 10, Go = 4, Ko = (e, t) => {
|
|
|
4083
4119
|
t[9] !== r || t[10] !== o ? (e = (e, t) => /* @__PURE__ */ J(K.button, {
|
|
4084
4120
|
type: "button",
|
|
4085
4121
|
h: "2px",
|
|
4086
|
-
w: `${
|
|
4087
|
-
bg:
|
|
4122
|
+
w: `${Ho + 16 * Wo(t, o)}px`,
|
|
4123
|
+
bg: Go(t, o),
|
|
4088
4124
|
borderRadius: "1px",
|
|
4089
4125
|
transition: "width 80ms linear, background-color 80ms linear",
|
|
4090
4126
|
"aria-label": `Jump to message ${t + 1}`,
|
|
@@ -4105,7 +4141,7 @@ var Uo = 3, Wo = 10, Go = 4, Ko = (e, t) => {
|
|
|
4105
4141
|
children: g
|
|
4106
4142
|
}), t[12] = d, t[13] = h, t[14] = g, t[15] = _) : _ = t[15];
|
|
4107
4143
|
let v;
|
|
4108
|
-
t[16] !== p || t[17] !== c ? (v = p && c ? /* @__PURE__ */ J(
|
|
4144
|
+
t[16] !== p || t[17] !== c ? (v = p && c ? /* @__PURE__ */ J(Ko, {
|
|
4109
4145
|
item: p,
|
|
4110
4146
|
position: c
|
|
4111
4147
|
}) : null, t[16] = p, t[17] = c, t[18] = v) : v = t[18];
|
|
@@ -4116,7 +4152,7 @@ var Uo = 3, Wo = 10, Go = 4, Ko = (e, t) => {
|
|
|
4116
4152
|
flexShrink: 0,
|
|
4117
4153
|
children: [_, v]
|
|
4118
4154
|
}), t[19] = _, t[20] = v, t[21] = y) : y = t[21], y;
|
|
4119
|
-
},
|
|
4155
|
+
}, Jo = (e) => {
|
|
4120
4156
|
let n = q(17), { tag: r } = e, i;
|
|
4121
4157
|
n[0] !== r.description || n[1] !== r.label ? (i = /* @__PURE__ */ J(V.Trigger, {
|
|
4122
4158
|
asChild: !0,
|
|
@@ -4148,7 +4184,7 @@ var Uo = 3, Wo = 10, Go = 4, Ko = (e, t) => {
|
|
|
4148
4184
|
children: s
|
|
4149
4185
|
}), n[9] = s, n[10] = r.description, n[11] = c) : c = n[11];
|
|
4150
4186
|
let l;
|
|
4151
|
-
n[12] === r.description ? l = n[13] : (l = /* @__PURE__ */ J(
|
|
4187
|
+
n[12] === r.description ? l = n[13] : (l = /* @__PURE__ */ J(H, { children: /* @__PURE__ */ J(V.Positioner, { children: /* @__PURE__ */ J(V.Content, { children: /* @__PURE__ */ J(G, {
|
|
4152
4188
|
p: "sm",
|
|
4153
4189
|
textStyle: "label/S/regular",
|
|
4154
4190
|
overflowWrap: "anywhere",
|
|
@@ -4156,7 +4192,7 @@ var Uo = 3, Wo = 10, Go = 4, Ko = (e, t) => {
|
|
|
4156
4192
|
}) }) }) }), n[12] = r.description, n[13] = l);
|
|
4157
4193
|
let u;
|
|
4158
4194
|
return n[14] !== c || n[15] !== l ? (u = /* @__PURE__ */ Y(V.Root, { children: [c, l] }), n[14] = c, n[15] = l, n[16] = u) : u = n[16], u;
|
|
4159
|
-
},
|
|
4195
|
+
}, Yo = (e) => {
|
|
4160
4196
|
let n = q(64), { mode: r, pending: a, unavailable: o, onRequestConfirmation: s, onAction: c } = e, u;
|
|
4161
4197
|
n[0] === Symbol.for("react.memo_cache_sentinel") ? (u = { key: "menu" }, n[0] = u) : u = n[0];
|
|
4162
4198
|
let d = fe(u), f;
|
|
@@ -4223,11 +4259,11 @@ var Uo = 3, Wo = 10, Go = 4, Ko = (e, t) => {
|
|
|
4223
4259
|
closeDelay: 150,
|
|
4224
4260
|
children: N
|
|
4225
4261
|
}), n[28] = N, n[29] = D, n[30] = F) : F = n[30];
|
|
4226
|
-
let
|
|
4227
|
-
n[31] === r.label ?
|
|
4262
|
+
let R = `${r.label} details`, z;
|
|
4263
|
+
n[31] === r.label ? z = n[32] : (z = /* @__PURE__ */ J(G, {
|
|
4228
4264
|
textStyle: "label/S/medium",
|
|
4229
4265
|
children: r.label
|
|
4230
|
-
}), n[31] = r.label, n[32] =
|
|
4266
|
+
}), n[31] = r.label, n[32] = z);
|
|
4231
4267
|
let B;
|
|
4232
4268
|
n[33] === r.description ? B = n[34] : (B = /* @__PURE__ */ J(G, {
|
|
4233
4269
|
textStyle: "label/S/regular",
|
|
@@ -4243,7 +4279,7 @@ var Uo = 3, Wo = 10, Go = 4, Ko = (e, t) => {
|
|
|
4243
4279
|
let V;
|
|
4244
4280
|
n[37] !== g || n[38] !== m || n[39] !== C || n[40] !== a || n[41] !== o ? (V = m?.action.argument ? /* @__PURE__ */ Y(P.Root, { children: [
|
|
4245
4281
|
/* @__PURE__ */ J(P.Label, { children: m.action.argument.label }),
|
|
4246
|
-
/* @__PURE__ */ J(
|
|
4282
|
+
/* @__PURE__ */ J(ee, {
|
|
4247
4283
|
autoFocus: !0,
|
|
4248
4284
|
size: "sm",
|
|
4249
4285
|
value: g,
|
|
@@ -4262,19 +4298,19 @@ var Uo = 3, Wo = 10, Go = 4, Ko = (e, t) => {
|
|
|
4262
4298
|
children: "Apply"
|
|
4263
4299
|
})] })
|
|
4264
4300
|
] }) : null, n[37] = g, n[38] = m, n[39] = C, n[40] = a, n[41] = o, n[42] = V) : V = n[42];
|
|
4265
|
-
let
|
|
4266
|
-
n[43] !==
|
|
4301
|
+
let re;
|
|
4302
|
+
n[43] !== z || n[44] !== B || n[45] !== te || n[46] !== V ? (re = /* @__PURE__ */ Y(W, {
|
|
4267
4303
|
p: "sm",
|
|
4268
4304
|
gap: "xs",
|
|
4269
4305
|
children: [
|
|
4270
|
-
|
|
4306
|
+
z,
|
|
4271
4307
|
B,
|
|
4272
4308
|
te,
|
|
4273
4309
|
V
|
|
4274
4310
|
]
|
|
4275
|
-
}), n[43] =
|
|
4276
|
-
let
|
|
4277
|
-
n[48] !== m || n[49] !== C || n[50] !== r || n[51] !== s || n[52] !== a || n[53] !== o ? (
|
|
4311
|
+
}), n[43] = z, n[44] = B, n[45] = te, n[46] = V, n[47] = re) : re = n[47];
|
|
4312
|
+
let U;
|
|
4313
|
+
n[48] !== m || n[49] !== C || n[50] !== r || n[51] !== s || n[52] !== a || n[53] !== o ? (U = m ? null : r.actions.map((e) => /* @__PURE__ */ J(i, {
|
|
4278
4314
|
role: "button",
|
|
4279
4315
|
variant: "full-width",
|
|
4280
4316
|
label: e.label,
|
|
@@ -4289,25 +4325,25 @@ var Uo = 3, Wo = 10, Go = 4, Ko = (e, t) => {
|
|
|
4289
4325
|
mode: r
|
|
4290
4326
|
})) : C(e);
|
|
4291
4327
|
}
|
|
4292
|
-
}, e.id)), n[48] = m, n[49] = C, n[50] = r, n[51] = s, n[52] = a, n[53] = o, n[54] =
|
|
4293
|
-
let
|
|
4294
|
-
n[55] !== p.content || n[56] !==
|
|
4328
|
+
}, e.id)), n[48] = m, n[49] = C, n[50] = r, n[51] = s, n[52] = a, n[53] = o, n[54] = U) : U = n[54];
|
|
4329
|
+
let ie;
|
|
4330
|
+
n[55] !== p.content || n[56] !== R || n[57] !== re || n[58] !== U ? (ie = /* @__PURE__ */ J(H, { children: /* @__PURE__ */ J(ne.Positioner, { children: /* @__PURE__ */ Y(ne.Content, {
|
|
4295
4331
|
css: p.content,
|
|
4296
|
-
"aria-label":
|
|
4297
|
-
children: [
|
|
4298
|
-
}) }) }), n[55] = p.content, n[56] =
|
|
4332
|
+
"aria-label": R,
|
|
4333
|
+
children: [re, U]
|
|
4334
|
+
}) }) }), n[55] = p.content, n[56] = R, n[57] = re, n[58] = U, n[59] = ie) : ie = n[59];
|
|
4299
4335
|
let oe;
|
|
4300
|
-
return n[60] !== v || n[61] !== F || n[62] !==
|
|
4336
|
+
return n[60] !== v || n[61] !== F || n[62] !== ie ? (oe = /* @__PURE__ */ Y(ne.Root, {
|
|
4301
4337
|
open: v,
|
|
4302
4338
|
positioning: T,
|
|
4303
4339
|
onOpenChange: E,
|
|
4304
|
-
children: [F,
|
|
4305
|
-
}), n[60] = v, n[61] = F, n[62] =
|
|
4306
|
-
},
|
|
4340
|
+
children: [F, ie]
|
|
4341
|
+
}), n[60] = v, n[61] = F, n[62] = ie, n[63] = oe) : oe = n[63], oe;
|
|
4342
|
+
}, Xo = (e) => {
|
|
4307
4343
|
let t = q(19), { modes: n, draftTag: r, sentTag: i, pending: a, unavailable: o, onRequestConfirmation: s, onAction: c } = e, l;
|
|
4308
4344
|
if (t[0] !== n || t[1] !== c || t[2] !== s || t[3] !== a || t[4] !== o) {
|
|
4309
4345
|
let e;
|
|
4310
|
-
t[6] !== c || t[7] !== s || t[8] !== a || t[9] !== o ? (e = (e) => /* @__PURE__ */ J(
|
|
4346
|
+
t[6] !== c || t[7] !== s || t[8] !== a || t[9] !== o ? (e = (e) => /* @__PURE__ */ J(Yo, {
|
|
4311
4347
|
mode: e,
|
|
4312
4348
|
pending: a,
|
|
4313
4349
|
unavailable: o,
|
|
@@ -4316,9 +4352,9 @@ var Uo = 3, Wo = 10, Go = 4, Ko = (e, t) => {
|
|
|
4316
4352
|
}, e.id), t[6] = c, t[7] = s, t[8] = a, t[9] = o, t[10] = e) : e = t[10], l = n.map(e), t[0] = n, t[1] = c, t[2] = s, t[3] = a, t[4] = o, t[5] = l;
|
|
4317
4353
|
} else l = t[5];
|
|
4318
4354
|
let u;
|
|
4319
|
-
t[11] === r ? u = t[12] : (u = r ? /* @__PURE__ */ J(
|
|
4355
|
+
t[11] === r ? u = t[12] : (u = r ? /* @__PURE__ */ J(Jo, { tag: r }) : null, t[11] = r, t[12] = u);
|
|
4320
4356
|
let d;
|
|
4321
|
-
t[13] === i ? d = t[14] : (d = i ? /* @__PURE__ */ J(
|
|
4357
|
+
t[13] === i ? d = t[14] : (d = i ? /* @__PURE__ */ J(Jo, { tag: i }) : null, t[13] = i, t[14] = d);
|
|
4322
4358
|
let f;
|
|
4323
4359
|
return t[15] !== l || t[16] !== u || t[17] !== d ? (f = /* @__PURE__ */ Y(I, {
|
|
4324
4360
|
gap: "2xs",
|
|
@@ -4330,11 +4366,11 @@ var Uo = 3, Wo = 10, Go = 4, Ko = (e, t) => {
|
|
|
4330
4366
|
d
|
|
4331
4367
|
]
|
|
4332
4368
|
}), t[15] = l, t[16] = u, t[17] = d, t[18] = f) : f = t[18], f;
|
|
4333
|
-
},
|
|
4369
|
+
}, Zo = (e) => {
|
|
4334
4370
|
let t = q(13), { status: n, statusLabel: r, additions: i, deletions: a } = e;
|
|
4335
4371
|
if (n === "loading") {
|
|
4336
4372
|
let e;
|
|
4337
|
-
t[0] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ J(
|
|
4373
|
+
t[0] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ J(ie, {
|
|
4338
4374
|
size: "xs",
|
|
4339
4375
|
color: "fg.muted"
|
|
4340
4376
|
}), t[0] = e) : e = t[0];
|
|
@@ -4386,9 +4422,9 @@ var Uo = 3, Wo = 10, Go = 4, Ko = (e, t) => {
|
|
|
4386
4422
|
gap: "2xs",
|
|
4387
4423
|
children: [o, s]
|
|
4388
4424
|
}), t[10] = o, t[11] = s, t[12] = c) : c = t[12], c;
|
|
4389
|
-
},
|
|
4425
|
+
}, Qo = (e) => {
|
|
4390
4426
|
let t = q(13), { workspaceControl: n, additions: r, deletions: i, action: a, status: o, statusLabel: s } = e, c = o === void 0 ? "ready" : o, l;
|
|
4391
|
-
t[0] !== r || t[1] !== i || t[2] !== c || t[3] !== s ? (l = /* @__PURE__ */ J(
|
|
4427
|
+
t[0] !== r || t[1] !== i || t[2] !== c || t[3] !== s ? (l = /* @__PURE__ */ J(Zo, {
|
|
4392
4428
|
status: c,
|
|
4393
4429
|
statusLabel: s,
|
|
4394
4430
|
additions: r,
|
|
@@ -4418,6 +4454,6 @@ var Uo = 3, Wo = 10, Go = 4, Ko = (e, t) => {
|
|
|
4418
4454
|
}), t[10] = u, t[11] = d, t[12] = f) : f = t[12], f;
|
|
4419
4455
|
};
|
|
4420
4456
|
//#endregion
|
|
4421
|
-
export {
|
|
4457
|
+
export { ht as ApprovalPrompt, vt as AttachmentList, St as AutoScroll, Zn as ChatInput, pt as ChatMessage, Fo as ChatPanel, lt as ChatPrimitives, zo as ChatSkeleton, Qo as ChatWorkspaceHub, qo as ConversationBrowse, Xo as HarnessControls, In as QuestionPromptControls, At as SendButton, wt as createSerializedPromptState, _ as parseChatLink, Rn as useQuestionPromptState };
|
|
4422
4458
|
|
|
4423
4459
|
//# sourceMappingURL=chat-ui.js.map
|