@pstdio/ui 0.38.0 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{MermaidComponent-BLMDb5XE.js → MermaidComponent-81jr28u4.js} +2 -2
- package/dist/{MermaidComponent-BLMDb5XE.js.map → MermaidComponent-81jr28u4.js.map} +1 -1
- package/dist/chat-ui.d.ts +13 -11
- package/dist/chat-ui.js +1029 -915
- package/dist/chat-ui.js.map +1 -1
- package/dist/{data-table-stats-row-BrpOFzgn.js → data-table-stats-row-CpRe_xK2.js} +2 -2
- package/dist/{data-table-stats-row-BrpOFzgn.js.map → data-table-stats-row-CpRe_xK2.js.map} +1 -1
- package/dist/data-table.d.ts +3 -1
- package/dist/data-table.js +7 -10
- package/dist/data-table.js.map +1 -1
- package/dist/{diff-viewer-hGkaF_zW.js → diff-viewer-BP_mI6Wx.js} +3 -3
- package/dist/{diff-viewer-hGkaF_zW.js.map → diff-viewer-BP_mI6Wx.js.map} +1 -1
- package/dist/diff.js +1 -1
- package/dist/{index-BfFLdci8.d.ts → index-Bfddrlz8.d.ts} +1 -1
- package/dist/{index-DlmvvQ6x.d.ts → index-CbtbcvKm.d.ts} +1 -1
- package/dist/index.d.ts +11 -9
- package/dist/index.js +111 -99
- package/dist/index.js.map +1 -1
- package/dist/kanban-renderer.d.ts +9 -21
- package/dist/kanban-renderer.js +276 -274
- package/dist/kanban-renderer.js.map +1 -1
- package/dist/{list-row-De9R2zKU.js → list-row-uqD-q4gv.js} +20 -10
- package/dist/list-row-uqD-q4gv.js.map +1 -0
- package/dist/{param-editor-BsyIOdrP.js → param-editor-BQd4AOUP.js} +2 -2
- package/dist/{param-editor-BsyIOdrP.js.map → param-editor-BQd4AOUP.js.map} +1 -1
- package/dist/{param-editor-field-qEWoluWT.js → param-editor-field-BJ_rLUnV.js} +728 -722
- package/dist/param-editor-field-BJ_rLUnV.js.map +1 -0
- package/dist/param-editor.d.ts +1 -0
- package/dist/param-editor.js +2 -2
- package/dist/{rich-text-CQAntEuA.js → rich-text-VYAmEigU.js} +1142 -1184
- package/dist/rich-text-VYAmEigU.js.map +1 -0
- package/dist/rich-text.d.ts +1 -1
- package/dist/rich-text.js +1 -1
- package/dist/style.css +1 -1
- package/dist/{theme-BH-rGipZ.js → theme-CbmSEbRF.js} +37 -6
- package/dist/theme-CbmSEbRF.js.map +1 -0
- package/dist/theme.js +1 -1
- package/dist/tree-list-BNZwjQZA.js +1616 -0
- package/dist/tree-list-BNZwjQZA.js.map +1 -0
- package/dist/{types-yjKBk07w.d.ts → types-DWA3enV6.d.ts} +22 -1
- package/package.json +2 -2
- package/dist/list-row-De9R2zKU.js.map +0 -1
- package/dist/param-editor-field-qEWoluWT.js.map +0 -1
- package/dist/rich-text-CQAntEuA.js.map +0 -1
- package/dist/theme-BH-rGipZ.js.map +0 -1
- package/dist/tree-list-BUfDQz3v.js +0 -1449
- package/dist/tree-list-BUfDQz3v.js.map +0 -1
package/dist/chat-ui.js
CHANGED
|
@@ -2,16 +2,16 @@ import { a as e, o as t, r as n } from "./prism-BStPsJSB.js";
|
|
|
2
2
|
import { n as r, t as i } from "./scroll-area-Cr1lNXAr.js";
|
|
3
3
|
import { t as a } from "./empty-state-3mVV_pV-.js";
|
|
4
4
|
import { n as o, t as s } from "./radio-CiFrDN6O.js";
|
|
5
|
-
import { c, l, o as u, s as d } from "./rich-text-
|
|
5
|
+
import { c, l, o as u, s as d } from "./rich-text-VYAmEigU.js";
|
|
6
6
|
import { t as f } from "./diff-bubble-DZsarmSG.js";
|
|
7
7
|
import { AbsoluteCenter as p, Avatar as m, Badge as h, Box as g, Button as _, Card as v, Code as y, Flex as b, HStack as x, Icon as S, IconButton as C, Image as w, Kbd as T, Link as E, Portal as D, Skeleton as O, Spacer as k, Span as A, Spinner as j, Stack as M, Text as N, Textarea as P, Timeline as F, Tooltip as I, chakra as L, createSlotRecipeContext as R, defineSlotRecipe as z } from "@chakra-ui/react";
|
|
8
8
|
import { c as B } from "react/compiler-runtime";
|
|
9
9
|
import { Fragment as V, jsx as H, jsxs as U } from "react/jsx-runtime";
|
|
10
|
-
import { Fragment as ee, Suspense as
|
|
11
|
-
import { AlertTriangle as
|
|
12
|
-
import { useVirtualizer as
|
|
13
|
-
import { StickToBottom as
|
|
14
|
-
var
|
|
10
|
+
import { Fragment as ee, Suspense as te, lazy as W, useEffect as G, useLayoutEffect as ne, useRef as K, useState as q } from "react";
|
|
11
|
+
import { AlertTriangle as re, ArrowDownIcon as ie, ArrowUp as ae, Check as J, ChevronUpIcon as Y, CircleQuestionMark as oe, Copy as se, DotIcon as ce, File as le, FileDiff as ue, FileDown as de, FilePen as fe, FileText as pe, FileUp as me, Globe as he, GripVertical as ge, ListTodo as _e, ListTree as ve, MessageCircleIcon as ye, Move as be, Pause as xe, Pencil as Se, Search as Ce, ShieldCheck as we, ShieldX as Te, Terminal as Ee, Trash2 as De } from "lucide-react";
|
|
12
|
+
import { useVirtualizer as Oe } from "@tanstack/react-virtual";
|
|
13
|
+
import { StickToBottom as ke, useStickToBottomContext as Ae } from "use-stick-to-bottom";
|
|
14
|
+
var je = L(ke, { base: {
|
|
15
15
|
position: "relative",
|
|
16
16
|
flex: 1,
|
|
17
17
|
overflow: "hidden",
|
|
@@ -24,10 +24,10 @@ var ke = L(De, { base: {
|
|
|
24
24
|
resize: "instant",
|
|
25
25
|
role: "log"
|
|
26
26
|
}
|
|
27
|
-
}),
|
|
27
|
+
}), Me = (e) => {
|
|
28
28
|
let t = B(10), n, r;
|
|
29
29
|
t[0] === e ? (n = t[1], r = t[2]) : ({children: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r);
|
|
30
|
-
let { contentRef: a, scrollRef: o } =
|
|
30
|
+
let { contentRef: a, scrollRef: o } = Ae(), s = o, c = a, l, u;
|
|
31
31
|
t[3] === Symbol.for("react.memo_cache_sentinel") ? (l = { zIndex: 2 }, u = {
|
|
32
32
|
py: "sm",
|
|
33
33
|
"aria-live": "polite",
|
|
@@ -45,28 +45,28 @@ var ke = L(De, { base: {
|
|
|
45
45
|
contentProps: u,
|
|
46
46
|
children: n
|
|
47
47
|
}), t[5] = n, t[6] = r, t[7] = s, t[8] = c, t[9] = d) : d = t[9], d;
|
|
48
|
-
},
|
|
48
|
+
}, Ne = {
|
|
49
49
|
axis: "horizontal",
|
|
50
50
|
bottom: "md",
|
|
51
51
|
zIndex: 2
|
|
52
|
-
},
|
|
53
|
-
Root:
|
|
54
|
-
Viewport:
|
|
52
|
+
}, Pe = {
|
|
53
|
+
Root: je,
|
|
54
|
+
Viewport: Me,
|
|
55
55
|
ScrollToBottom: (e) => {
|
|
56
|
-
let t = B(4), { isAtBottom: n, scrollToBottom: r } =
|
|
56
|
+
let t = B(4), { isAtBottom: n, scrollToBottom: r } = Ae(), i;
|
|
57
57
|
return t[0] !== n || t[1] !== e || t[2] !== r ? (i = !n && /* @__PURE__ */ H(p, {
|
|
58
|
-
...
|
|
58
|
+
...Ne,
|
|
59
59
|
children: /* @__PURE__ */ H(C, {
|
|
60
60
|
rounded: "full",
|
|
61
61
|
onClick: () => r(),
|
|
62
62
|
variant: "outline",
|
|
63
63
|
size: "xs",
|
|
64
64
|
...e,
|
|
65
|
-
children: /* @__PURE__ */ H(
|
|
65
|
+
children: /* @__PURE__ */ H(ie, { size: 16 })
|
|
66
66
|
})
|
|
67
67
|
}), t[0] = n, t[1] = e, t[2] = r, t[3] = i) : i = t[3], i;
|
|
68
68
|
}
|
|
69
|
-
},
|
|
69
|
+
}, Fe = z({
|
|
70
70
|
className: "ai-message",
|
|
71
71
|
slots: ["root", "content"],
|
|
72
72
|
base: {
|
|
@@ -153,16 +153,16 @@ var ke = L(De, { base: {
|
|
|
153
153
|
shape: "rounded",
|
|
154
154
|
delivery: "sent"
|
|
155
155
|
}
|
|
156
|
-
}), { withProvider:
|
|
157
|
-
Root:
|
|
158
|
-
Content:
|
|
159
|
-
},
|
|
156
|
+
}), { withProvider: Ie, withContext: Le } = R({ recipe: Fe }), X = {
|
|
157
|
+
Root: Ie("div", "root"),
|
|
158
|
+
Content: Le("div", "content")
|
|
159
|
+
}, Re = (e) => {
|
|
160
160
|
if (e == null) return null;
|
|
161
161
|
let t = typeof e == "string" ? e : JSON.stringify(e, null, 2);
|
|
162
162
|
return t.length === 0 ? null : t.length > 200 ? `${t.slice(0, 200)}...` : t;
|
|
163
|
-
},
|
|
163
|
+
}, ze = (e) => {
|
|
164
164
|
let t = B(19), { toolName: n, toolInput: r, onApprove: a, onDeny: o } = e, s;
|
|
165
|
-
t[0] === r ? s = t[1] : (s =
|
|
165
|
+
t[0] === r ? s = t[1] : (s = Re(r), t[0] = r, t[1] = s);
|
|
166
166
|
let c = s, l;
|
|
167
167
|
t[2] === n ? l = t[3] : (l = /* @__PURE__ */ U(N, {
|
|
168
168
|
textStyle: "label/S/medium",
|
|
@@ -188,7 +188,7 @@ var ke = L(De, { base: {
|
|
|
188
188
|
})
|
|
189
189
|
}) : null, t[4] = c, t[5] = u);
|
|
190
190
|
let d;
|
|
191
|
-
t[6] === Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ H(
|
|
191
|
+
t[6] === Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ H(Te, { size: 14 }), t[6] = d) : d = t[6];
|
|
192
192
|
let f;
|
|
193
193
|
t[7] === o ? f = t[8] : (f = /* @__PURE__ */ U(_, {
|
|
194
194
|
size: "xs",
|
|
@@ -197,7 +197,7 @@ var ke = L(De, { base: {
|
|
|
197
197
|
children: [d, "Deny"]
|
|
198
198
|
}), t[7] = o, t[8] = f);
|
|
199
199
|
let p;
|
|
200
|
-
t[9] === Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ H(
|
|
200
|
+
t[9] === Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ H(we, { size: 14 }), t[9] = p) : p = t[9];
|
|
201
201
|
let m;
|
|
202
202
|
t[10] === a ? m = t[11] : (m = /* @__PURE__ */ U(_, {
|
|
203
203
|
size: "xs",
|
|
@@ -230,10 +230,10 @@ var ke = L(De, { base: {
|
|
|
230
230
|
]
|
|
231
231
|
})
|
|
232
232
|
}), t[15] = l, t[16] = u, t[17] = h, t[18] = v) : v = t[18], v;
|
|
233
|
-
},
|
|
233
|
+
}, Be = "md", Ve = "neutral", He = (e) => {
|
|
234
234
|
let t = B(17), { attachments: r, onSelect: i, onRemove: a, renderBadge: o, size: s, tone: c } = e, l;
|
|
235
235
|
t[0] === r ? l = t[1] : (l = r === void 0 ? [] : r, t[0] = r, t[1] = l);
|
|
236
|
-
let u = l, d = s === void 0 ?
|
|
236
|
+
let u = l, d = s === void 0 ? Be : s, f = c === void 0 ? Ve : c;
|
|
237
237
|
if (u.length === 0) return null;
|
|
238
238
|
let p;
|
|
239
239
|
if (t[2] !== u || t[3] !== a || t[4] !== i || t[5] !== o || t[6] !== d || t[7] !== f) {
|
|
@@ -267,13 +267,13 @@ var ke = L(De, { base: {
|
|
|
267
267
|
flexWrap: "wrap",
|
|
268
268
|
children: p
|
|
269
269
|
}), t[15] = p, t[16] = m), m;
|
|
270
|
-
},
|
|
270
|
+
}, Ue = (e) => {
|
|
271
271
|
let { previousUserMessageCount: t, userMessageCount: n } = e;
|
|
272
272
|
return t !== 0 && n > t;
|
|
273
|
-
},
|
|
273
|
+
}, We = (e) => {
|
|
274
274
|
let t = e.conversationKey ?? null;
|
|
275
275
|
return e.state.conversationKey === t ? {
|
|
276
|
-
shouldScroll:
|
|
276
|
+
shouldScroll: Ue({
|
|
277
277
|
previousUserMessageCount: e.state.userMessageCount,
|
|
278
278
|
userMessageCount: e.userMessageCount
|
|
279
279
|
}),
|
|
@@ -288,19 +288,19 @@ var ke = L(De, { base: {
|
|
|
288
288
|
userMessageCount: e.userMessageCount
|
|
289
289
|
}
|
|
290
290
|
};
|
|
291
|
-
},
|
|
292
|
-
let t =
|
|
291
|
+
}, Ge = (e) => {
|
|
292
|
+
let t = We(e);
|
|
293
293
|
return t.shouldScroll && e.scrollToBottom("instant"), t;
|
|
294
294
|
};
|
|
295
|
-
function
|
|
296
|
-
let t = B(8), { conversationKey: n, userMessageCount: r } = e, { scrollToBottom: i } =
|
|
295
|
+
function Ke(e) {
|
|
296
|
+
let t = B(8), { conversationKey: n, userMessageCount: r } = e, { scrollToBottom: i } = Ae(), a = n ?? null, o;
|
|
297
297
|
t[0] !== a || t[1] !== r ? (o = {
|
|
298
298
|
conversationKey: a,
|
|
299
299
|
userMessageCount: r
|
|
300
300
|
}, t[0] = a, t[1] = r, t[2] = o) : o = t[2];
|
|
301
|
-
let s =
|
|
301
|
+
let s = K(o), c, l;
|
|
302
302
|
return t[3] !== n || t[4] !== i || t[5] !== r ? (c = () => {
|
|
303
|
-
let e =
|
|
303
|
+
let e = Ge({
|
|
304
304
|
state: s.current,
|
|
305
305
|
conversationKey: n,
|
|
306
306
|
userMessageCount: r,
|
|
@@ -311,17 +311,17 @@ function Ge(e) {
|
|
|
311
311
|
n,
|
|
312
312
|
r,
|
|
313
313
|
i
|
|
314
|
-
], t[3] = n, t[4] = i, t[5] = r, t[6] = c, t[7] = l) : (c = t[6], l = t[7]),
|
|
314
|
+
], t[3] = n, t[4] = i, t[5] = r, t[6] = c, t[7] = l) : (c = t[6], l = t[7]), G(c, l), null;
|
|
315
315
|
}
|
|
316
316
|
//#endregion
|
|
317
317
|
//#region src/components/chat-ui/components/chat-input-actions.ts
|
|
318
|
-
var
|
|
318
|
+
var qe = (e) => e.trim().length > 0, Je = (e) => {
|
|
319
319
|
let { canSubmit: t, isDisabled: n, text: r } = e;
|
|
320
|
-
return n || !t || !
|
|
321
|
-
},
|
|
320
|
+
return n || !t || !qe(r) ? "none" : "submit";
|
|
321
|
+
}, Ye = (e) => {
|
|
322
322
|
let { canInterrupt: t, canSubmit: n, hasQuestionPrompt: r, isDisabled: i, streaming: a, text: o } = e;
|
|
323
|
-
return i ? "none" : n &&
|
|
324
|
-
},
|
|
323
|
+
return i ? "none" : n && qe(o) ? "submit" : a && !r && t ? "interrupt" : "none";
|
|
324
|
+
}, Xe = (e, t = 200) => e.length > 0 && e.split(/\r\n|\r|\n/).length > t, Ze = (e) => {
|
|
325
325
|
let { onAttachFiles: t, onAttachText: n, textAttachmentPasteLineThreshold: r } = e;
|
|
326
326
|
return {
|
|
327
327
|
onDragOver: (e) => {
|
|
@@ -338,12 +338,91 @@ var Ke = (e) => e.trim().length > 0, qe = (e) => {
|
|
|
338
338
|
return;
|
|
339
339
|
}
|
|
340
340
|
let a = e.clipboardData.getData("text/plain");
|
|
341
|
-
n &&
|
|
341
|
+
n && Xe(a, r) && (e.preventDefault(), n(a));
|
|
342
342
|
}
|
|
343
343
|
};
|
|
344
|
-
},
|
|
344
|
+
}, Qe = "Other", $e = "__pstdio_other__", et = (e, t) => Object.hasOwn(e, t) ? e[t] : void 0, tt = (e) => !!e.allowCustomAnswer && e.options.length > 0, Z = (e, t) => e.id ?? `question-${t}`, nt = (e, t, n) => Object.hasOwn(e, Z(t, n)), rt = (e, t, n) => {
|
|
345
|
+
let { [Z(t, n)]: r, ...i } = e;
|
|
346
|
+
return i;
|
|
347
|
+
}, it = (e, t, n) => nt(e, t, n) ? rt(e, t, n) : {
|
|
348
|
+
...e,
|
|
349
|
+
[Z(t, n)]: ""
|
|
350
|
+
}, at = "Skipped the question.", ot = () => ({ answers: [] }), st = (e, t, n, r) => {
|
|
351
|
+
let i = Z(t, n), a = et(e, i) ?? [], o = a.includes(r);
|
|
352
|
+
return t.multiple ? {
|
|
353
|
+
...e,
|
|
354
|
+
[i]: o ? a.filter((e) => e !== r) : [...a, r]
|
|
355
|
+
} : {
|
|
356
|
+
...e,
|
|
357
|
+
[i]: o ? [] : [r]
|
|
358
|
+
};
|
|
359
|
+
}, ct = (e) => e ? JSON.stringify(e.questions.map((e, t) => ({
|
|
360
|
+
id: Z(e, t),
|
|
361
|
+
question: e.question,
|
|
362
|
+
multiple: !!e.multiple,
|
|
363
|
+
required: !!e.required,
|
|
364
|
+
allowCustomAnswer: !!e.allowCustomAnswer,
|
|
365
|
+
options: e.options.map((e) => ({
|
|
366
|
+
label: e.label,
|
|
367
|
+
description: e.description ?? ""
|
|
368
|
+
}))
|
|
369
|
+
}))) : "", lt = (e, t, n) => {
|
|
370
|
+
let r = n?.trim();
|
|
371
|
+
return r ? e.multiple ? [...t, r] : [r] : t;
|
|
372
|
+
}, ut = (e, t, n, r) => lt(e, et(n, t) ?? [], et(r, t)), dt = (e, t, n) => {
|
|
373
|
+
let r = [];
|
|
374
|
+
for (let i = 0; i < e.questions.length; i += 1) {
|
|
375
|
+
let a = e.questions[i], o = ut(a, Z(a, i), t, n);
|
|
376
|
+
o.length !== 0 && r.push(`${a.question}: ${o.join(", ")}`);
|
|
377
|
+
}
|
|
378
|
+
return r;
|
|
379
|
+
}, ft = (e) => typeof e != "string", pt = (e, t) => {
|
|
380
|
+
if (ft(t)) return t;
|
|
381
|
+
let n = t.trim();
|
|
382
|
+
return n.length === 0 ? {} : Object.fromEntries(e.questions.flatMap((e, t) => e.allowCustomAnswer ? [[Z(e, t), n]] : []));
|
|
383
|
+
}, mt = (e, t, n) => {
|
|
384
|
+
if (!e) return typeof n == "string" ? n.trim() : "";
|
|
385
|
+
let r = dt(e, t, pt(e, n)), i = typeof n == "string" ? n.trim() : "", a = e.questions.some((e) => e.allowCustomAnswer);
|
|
386
|
+
return i.length > 0 && !a && r.push(`Additional response: ${i}`), r.join("\n");
|
|
387
|
+
}, ht = (e, t, n) => {
|
|
388
|
+
let r = pt(e, n);
|
|
389
|
+
return e.questions.map((e, n) => ut(e, Z(e, n), t, r));
|
|
390
|
+
}, gt = (e, t, n) => {
|
|
391
|
+
if (!e) return !1;
|
|
392
|
+
let r = pt(e, n);
|
|
393
|
+
for (let n = 0; n < e.questions.length; n += 1) {
|
|
394
|
+
let i = e.questions[n];
|
|
395
|
+
if (!(!i.required || ut(i, Z(i, n), t, r).length > 0)) return !0;
|
|
396
|
+
}
|
|
397
|
+
return !1;
|
|
398
|
+
}, _t = (e, t, n, r) => ut(e, Z(e, t), n, r).length > 0, vt = (e) => {
|
|
399
|
+
let t = B(22), { question: n, questionIndex: i, isActive: a, selectedOptionsByQuestion: o, customAnswersByQuestion: s, onSelectStep: c } = e, l;
|
|
400
|
+
t[0] !== s || t[1] !== n || t[2] !== i || t[3] !== o ? (l = _t(n, i, o, s), t[0] = s, t[1] = n, t[2] = i, t[3] = o, t[4] = l) : l = t[4];
|
|
401
|
+
let u = l, d = u ? "answered" : "not answered", f = a ? "outline" : "ghost", p = `question-step-tab-${n.id}`, m = `${n.question} (${d})`, h = `question-step-panel-${n.id}`, g;
|
|
402
|
+
t[5] !== c || t[6] !== i ? (g = () => c(i), t[5] = c, t[6] = i, t[7] = g) : g = t[7];
|
|
403
|
+
let v;
|
|
404
|
+
t[8] !== u || t[9] !== i ? (v = u ? /* @__PURE__ */ H(J, { "aria-hidden": "true" }) : i + 1, t[8] = u, t[9] = i, t[10] = v) : v = t[10];
|
|
405
|
+
let y;
|
|
406
|
+
t[11] !== a || t[12] !== p || t[13] !== m || t[14] !== h || t[15] !== g || t[16] !== v || t[17] !== f ? (y = /* @__PURE__ */ H(_, {
|
|
407
|
+
id: p,
|
|
408
|
+
role: "tab",
|
|
409
|
+
"aria-label": m,
|
|
410
|
+
"aria-selected": a,
|
|
411
|
+
"aria-controls": h,
|
|
412
|
+
size: "xs",
|
|
413
|
+
variant: f,
|
|
414
|
+
minW: "8",
|
|
415
|
+
onClick: g,
|
|
416
|
+
children: v
|
|
417
|
+
}), t[11] = a, t[12] = p, t[13] = m, t[14] = h, t[15] = g, t[16] = v, t[17] = f, t[18] = y) : y = t[18];
|
|
418
|
+
let b;
|
|
419
|
+
return t[19] !== n.question || t[20] !== y ? (b = /* @__PURE__ */ H(r, {
|
|
420
|
+
content: n.question,
|
|
421
|
+
children: y
|
|
422
|
+
}), t[19] = n.question, t[20] = y, t[21] = b) : b = t[21], b;
|
|
423
|
+
}, yt = (e) => {
|
|
345
424
|
e.preventDefault();
|
|
346
|
-
},
|
|
425
|
+
}, bt = (e) => {
|
|
347
426
|
let t = B(7), { option: n } = e, r;
|
|
348
427
|
t[0] === n.label ? r = t[1] : (r = /* @__PURE__ */ H(N, {
|
|
349
428
|
textStyle: "label/S/regular",
|
|
@@ -362,11 +441,11 @@ var Ke = (e) => e.trim().length > 0, qe = (e) => {
|
|
|
362
441
|
minWidth: "0",
|
|
363
442
|
children: [r, i]
|
|
364
443
|
}), t[4] = r, t[5] = i, t[6] = a) : a = t[6], a;
|
|
365
|
-
},
|
|
444
|
+
}, xt = (t) => {
|
|
366
445
|
let n = B(12), { option: r, name: i, checked: a, editable: o, onToggle: s } = t, c = !o, l = o ? void 0 : "true", u;
|
|
367
446
|
n[0] === o ? u = n[1] : (u = o ? void 0 : { tabIndex: -1 }, n[0] = o, n[1] = u);
|
|
368
447
|
let d = o ? s : void 0, f;
|
|
369
|
-
n[2] === r ? f = n[3] : (f = /* @__PURE__ */ H(
|
|
448
|
+
n[2] === r ? f = n[3] : (f = /* @__PURE__ */ H(bt, { option: r }), n[2] = r, n[3] = f);
|
|
370
449
|
let p;
|
|
371
450
|
return n[4] !== a || n[5] !== i || n[6] !== c || n[7] !== l || n[8] !== u || n[9] !== d || n[10] !== f ? (p = /* @__PURE__ */ H(e, {
|
|
372
451
|
name: i,
|
|
@@ -378,36 +457,54 @@ var Ke = (e) => e.trim().length > 0, qe = (e) => {
|
|
|
378
457
|
onCheckedChange: d,
|
|
379
458
|
children: f
|
|
380
459
|
}), n[4] = a, n[5] = i, n[6] = c, n[7] = l, n[8] = u, n[9] = d, n[10] = f, n[11] = p) : p = n[11], p;
|
|
381
|
-
},
|
|
382
|
-
let t = B(
|
|
383
|
-
t[0]
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
460
|
+
}, St = (e) => {
|
|
461
|
+
let t = B(30), { question: n, questionIndex: r, name: i, selectedOption: a, otherSelected: c, editable: l, onToggleOption: u, onToggleOther: d } = e, { otherField: f } = e, p;
|
|
462
|
+
t[0] === n ? p = t[1] : (p = tt(n), t[0] = n, t[1] = p);
|
|
463
|
+
let m = p, h;
|
|
464
|
+
if (t[2] !== n.options || t[3] !== a) {
|
|
465
|
+
let e;
|
|
466
|
+
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;
|
|
467
|
+
} else h = t[4];
|
|
468
|
+
let g = h, _ = c ? $e : g === -1 ? null : String(g), v = !l, y = l ? void 0 : "true", b;
|
|
469
|
+
t[7] !== l || t[8] !== u || t[9] !== d || t[10] !== n || t[11] !== r ? (b = l ? (e) => {
|
|
470
|
+
e.value && (e.value === "__pstdio_other__" ? d?.(n, r) : u?.(n, r, n.options[Number(e.value)].label));
|
|
471
|
+
} : void 0, t[7] = l, t[8] = u, t[9] = d, t[10] = n, t[11] = r, t[12] = b) : b = t[12];
|
|
472
|
+
let x;
|
|
473
|
+
if (t[13] !== l || t[14] !== n.options) {
|
|
388
474
|
let e;
|
|
389
|
-
t[
|
|
390
|
-
value:
|
|
391
|
-
inputProps:
|
|
475
|
+
t[16] === l ? e = t[17] : (e = (e, t) => /* @__PURE__ */ H(s, {
|
|
476
|
+
value: String(t),
|
|
477
|
+
inputProps: l ? void 0 : { tabIndex: -1 },
|
|
392
478
|
alignItems: "flex-start",
|
|
393
|
-
children: /* @__PURE__ */ H(
|
|
394
|
-
}, e.label), t[
|
|
395
|
-
} else
|
|
396
|
-
let
|
|
397
|
-
|
|
479
|
+
children: /* @__PURE__ */ H(bt, { option: e })
|
|
480
|
+
}, e.label), t[16] = l, t[17] = e), x = n.options.map(e), t[13] = l, t[14] = n.options, t[15] = x;
|
|
481
|
+
} else x = t[15];
|
|
482
|
+
let S;
|
|
483
|
+
t[18] !== l || t[19] !== m ? (S = m ? /* @__PURE__ */ H(s, {
|
|
484
|
+
value: $e,
|
|
485
|
+
inputProps: l ? void 0 : { tabIndex: -1 },
|
|
486
|
+
alignItems: "flex-start",
|
|
487
|
+
children: /* @__PURE__ */ H(bt, { option: { label: Qe } })
|
|
488
|
+
}) : null, t[18] = l, t[19] = m, t[20] = S) : S = t[20];
|
|
489
|
+
let C = c ? f : null, w;
|
|
490
|
+
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__ */ U(o, {
|
|
398
491
|
name: i,
|
|
399
|
-
value:
|
|
400
|
-
readOnly:
|
|
401
|
-
"aria-readonly":
|
|
492
|
+
value: _,
|
|
493
|
+
readOnly: v,
|
|
494
|
+
"aria-readonly": y,
|
|
402
495
|
display: "flex",
|
|
403
496
|
flexDirection: "column",
|
|
404
497
|
gap: "xs",
|
|
405
|
-
onValueChange:
|
|
406
|
-
children:
|
|
407
|
-
|
|
408
|
-
|
|
498
|
+
onValueChange: b,
|
|
499
|
+
children: [
|
|
500
|
+
x,
|
|
501
|
+
S,
|
|
502
|
+
C
|
|
503
|
+
]
|
|
504
|
+
}), 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;
|
|
505
|
+
}, Ct = (e) => {
|
|
409
506
|
let t = B(4), { items: n } = e, r;
|
|
410
|
-
t[0] === n ? r = t[1] : (r = n.map(
|
|
507
|
+
t[0] === n ? r = t[1] : (r = n.map(Ot), t[0] = n, t[1] = r);
|
|
411
508
|
let i;
|
|
412
509
|
return t[2] === r ? i = t[3] : (i = /* @__PURE__ */ H(M, {
|
|
413
510
|
as: "ul",
|
|
@@ -417,75 +514,132 @@ var Ke = (e) => e.trim().length > 0, qe = (e) => {
|
|
|
417
514
|
padding: "0",
|
|
418
515
|
children: r
|
|
419
516
|
}), t[2] = r, t[3] = i), i;
|
|
420
|
-
},
|
|
421
|
-
let t = B(
|
|
422
|
-
t[0]
|
|
423
|
-
let
|
|
424
|
-
t[
|
|
425
|
-
|
|
426
|
-
|
|
517
|
+
}, wt = (e) => {
|
|
518
|
+
let t = B(12), { question: n, questionIndex: r, editable: i, customAnswer: a, onCustomAnswerChange: o, hasOtherChoice: s } = e, c = !i, l = i ? void 0 : "true", u = a ?? "", d = i ? s ? "Type your answer..." : "Answer..." : "Answer", f = s ? `${n.question} (${Qe})` : n.question, p = i ? "vertical" : "none", m;
|
|
519
|
+
t[0] !== o || t[1] !== n || t[2] !== r ? (m = (e) => o?.(n, r, e.currentTarget.value), t[0] = o, t[1] = n, t[2] = r, t[3] = m) : m = t[3];
|
|
520
|
+
let h;
|
|
521
|
+
return t[4] !== c || t[5] !== l || t[6] !== u || t[7] !== d || t[8] !== f || t[9] !== p || t[10] !== m ? (h = /* @__PURE__ */ H(P, {
|
|
522
|
+
readOnly: c,
|
|
523
|
+
"aria-readonly": l,
|
|
524
|
+
value: u,
|
|
525
|
+
placeholder: d,
|
|
526
|
+
"aria-label": f,
|
|
527
|
+
rows: 2,
|
|
528
|
+
borderWidth: "1px",
|
|
529
|
+
borderColor: "border.subtle",
|
|
530
|
+
borderRadius: "sm",
|
|
531
|
+
padding: "xs",
|
|
532
|
+
resize: p,
|
|
533
|
+
color: "fg",
|
|
534
|
+
onChange: m
|
|
535
|
+
}), t[4] = c, t[5] = l, t[6] = u, t[7] = d, t[8] = f, t[9] = p, t[10] = m, t[11] = h) : h = t[11], h;
|
|
536
|
+
}, Tt = (e) => {
|
|
537
|
+
let t = B(21), { question: n, questionIndex: r, editable: i, selectedOptions: a, customAnswer: o, onToggleOption: s, onToggleOther: c } = e, { name: l, otherField: u } = e, d;
|
|
538
|
+
t[0] === n ? d = t[1] : (d = tt(n), t[0] = n, t[1] = d);
|
|
539
|
+
let f = d, p = o !== void 0, m;
|
|
540
|
+
t[2] !== i || t[3] !== l || t[4] !== s || t[5] !== n || t[6] !== r || t[7] !== a ? (m = n.options.map((e) => /* @__PURE__ */ H(xt, {
|
|
541
|
+
option: e,
|
|
542
|
+
name: l,
|
|
543
|
+
checked: a.includes(e.label),
|
|
544
|
+
editable: i,
|
|
545
|
+
onToggle: () => s?.(n, r, e.label)
|
|
546
|
+
}, 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];
|
|
547
|
+
let h;
|
|
548
|
+
t[9] !== i || t[10] !== f || t[11] !== l || t[12] !== c || t[13] !== p || t[14] !== n || t[15] !== r ? (h = f ? /* @__PURE__ */ H(xt, {
|
|
549
|
+
option: { label: Qe },
|
|
550
|
+
name: l,
|
|
551
|
+
checked: p,
|
|
552
|
+
editable: i,
|
|
553
|
+
onToggle: () => c?.(n, r)
|
|
554
|
+
}) : null, t[9] = i, t[10] = f, t[11] = l, t[12] = c, t[13] = p, t[14] = n, t[15] = r, t[16] = h) : h = t[16];
|
|
555
|
+
let g = p ? u : null, _;
|
|
556
|
+
return t[17] !== m || t[18] !== h || t[19] !== g ? (_ = /* @__PURE__ */ U(V, { children: [
|
|
557
|
+
m,
|
|
558
|
+
h,
|
|
559
|
+
g
|
|
560
|
+
] }), t[17] = m, t[18] = h, t[19] = g, t[20] = _) : _ = t[20], _;
|
|
561
|
+
}, Et = (e) => {
|
|
562
|
+
let t = B(30), { question: n, questionIndex: r, editable: i, selectedOptions: a, customAnswer: o, onToggleOption: s, onToggleOther: c } = e, l = n.id ?? `question-${r}`, u;
|
|
563
|
+
t[0] === n ? u = t[1] : (u = tt(n), t[0] = n, t[1] = u);
|
|
564
|
+
let d = u, f;
|
|
565
|
+
t[2] !== d || t[3] !== e || t[4] !== n.allowCustomAnswer ? (f = n.allowCustomAnswer ? /* @__PURE__ */ H(wt, {
|
|
566
|
+
...e,
|
|
567
|
+
hasOtherChoice: d
|
|
568
|
+
}) : null, t[2] = d, t[3] = e, t[4] = n.allowCustomAnswer, t[5] = f) : f = t[5];
|
|
569
|
+
let p = f, m = n.options.length > 0 || d, h;
|
|
570
|
+
t[6] === n.question ? h = t[7] : (h = /* @__PURE__ */ H(N, {
|
|
571
|
+
as: "legend",
|
|
572
|
+
textStyle: "label/S/medium",
|
|
573
|
+
color: "fg",
|
|
574
|
+
paddingX: "2xs",
|
|
575
|
+
children: n.question
|
|
576
|
+
}), t[6] = n.question, t[7] = h);
|
|
577
|
+
let g;
|
|
578
|
+
t[8] !== m || t[9] !== l || t[10] !== p || t[11] !== e || t[12] !== n.multiple ? (g = m && n.multiple ? /* @__PURE__ */ H(Tt, {
|
|
579
|
+
...e,
|
|
580
|
+
name: l,
|
|
581
|
+
otherField: p
|
|
582
|
+
}) : null, t[8] = m, t[9] = l, t[10] = p, t[11] = e, t[12] = n.multiple, t[13] = g) : g = t[13];
|
|
583
|
+
let _;
|
|
584
|
+
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__ */ H(St, {
|
|
585
|
+
question: n,
|
|
586
|
+
questionIndex: r,
|
|
587
|
+
name: l,
|
|
588
|
+
selectedOption: a[0],
|
|
589
|
+
otherSelected: o !== void 0,
|
|
590
|
+
editable: i,
|
|
591
|
+
onToggleOption: s,
|
|
592
|
+
onToggleOther: c,
|
|
593
|
+
otherField: p
|
|
594
|
+
}) : null, 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, t[24] = _) : _ = t[24];
|
|
595
|
+
let v = m ? null : p, y;
|
|
596
|
+
return t[25] !== h || t[26] !== g || t[27] !== _ || t[28] !== v ? (y = /* @__PURE__ */ U(M, {
|
|
597
|
+
as: "fieldset",
|
|
598
|
+
gap: "xs",
|
|
599
|
+
borderWidth: "1px",
|
|
600
|
+
borderColor: "border.subtle",
|
|
601
|
+
borderRadius: "sm",
|
|
602
|
+
padding: "sm",
|
|
603
|
+
minWidth: "0",
|
|
604
|
+
children: [
|
|
605
|
+
h,
|
|
606
|
+
g,
|
|
607
|
+
_,
|
|
608
|
+
v
|
|
609
|
+
]
|
|
610
|
+
}), t[25] = h, t[26] = g, t[27] = _, t[28] = v, t[29] = y) : y = t[29], y;
|
|
611
|
+
}, Dt = (e) => {
|
|
612
|
+
let t = B(21), { questions: n, editable: r, selectedOptionsByQuestion: i, customAnswersByQuestion: a, onToggleOption: o, onToggleOther: s, onCustomAnswerChange: c } = e, l = r !== void 0 && r, u;
|
|
613
|
+
t[0] === i ? u = t[1] : (u = i === void 0 ? {} : i, t[0] = i, t[1] = u);
|
|
614
|
+
let d = u, f;
|
|
615
|
+
t[2] === a ? f = t[3] : (f = a === void 0 ? {} : a, t[2] = a, t[3] = f);
|
|
616
|
+
let p = f, m;
|
|
617
|
+
if (t[4] !== p || t[5] !== l || t[6] !== c || t[7] !== o || t[8] !== s || t[9] !== n || t[10] !== d) {
|
|
427
618
|
let e;
|
|
428
|
-
t[
|
|
429
|
-
let n = e.id ?? `question-${t}
|
|
430
|
-
return /* @__PURE__ */
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
/* @__PURE__ */ H(N, {
|
|
440
|
-
as: "legend",
|
|
441
|
-
textStyle: "label/S/medium",
|
|
442
|
-
color: "fg",
|
|
443
|
-
paddingX: "2xs",
|
|
444
|
-
children: e.question
|
|
445
|
-
}),
|
|
446
|
-
r === "radio" ? /* @__PURE__ */ H(et, {
|
|
447
|
-
question: e,
|
|
448
|
-
questionIndex: t,
|
|
449
|
-
name: n,
|
|
450
|
-
selectedOption: i[0],
|
|
451
|
-
editable: c,
|
|
452
|
-
onToggleOption: o
|
|
453
|
-
}) : e.options.map((r) => /* @__PURE__ */ H($e, {
|
|
454
|
-
option: r,
|
|
455
|
-
name: n,
|
|
456
|
-
checked: i.includes(r.label),
|
|
457
|
-
editable: c,
|
|
458
|
-
onToggle: () => o?.(e, t, r.label)
|
|
459
|
-
}, r.label)),
|
|
460
|
-
e.allowCustomAnswer ? /* @__PURE__ */ H(P, {
|
|
461
|
-
readOnly: !c,
|
|
462
|
-
"aria-readonly": c ? void 0 : "true",
|
|
463
|
-
value: f[n] ?? "",
|
|
464
|
-
placeholder: c ? "Answer..." : "Custom answer",
|
|
465
|
-
"aria-label": e.question,
|
|
466
|
-
rows: 2,
|
|
467
|
-
borderWidth: "1px",
|
|
468
|
-
borderColor: "border.subtle",
|
|
469
|
-
borderRadius: "sm",
|
|
470
|
-
padding: "xs",
|
|
471
|
-
resize: c ? "vertical" : "none",
|
|
472
|
-
color: "fg",
|
|
473
|
-
onChange: (n) => s?.(e, t, n.currentTarget.value)
|
|
474
|
-
}) : null
|
|
475
|
-
]
|
|
619
|
+
t[12] !== p || t[13] !== l || t[14] !== c || t[15] !== o || t[16] !== s || t[17] !== d ? (e = (e, t) => {
|
|
620
|
+
let n = e.id ?? `question-${t}`;
|
|
621
|
+
return /* @__PURE__ */ H(Et, {
|
|
622
|
+
question: e,
|
|
623
|
+
questionIndex: t,
|
|
624
|
+
editable: l,
|
|
625
|
+
selectedOptions: et(d, n) ?? [],
|
|
626
|
+
customAnswer: et(p, n),
|
|
627
|
+
onToggleOption: o,
|
|
628
|
+
onToggleOther: s,
|
|
629
|
+
onCustomAnswerChange: c
|
|
476
630
|
}, n);
|
|
477
|
-
}, t[
|
|
478
|
-
} else
|
|
479
|
-
let
|
|
480
|
-
return t[
|
|
631
|
+
}, t[12] = p, t[13] = l, t[14] = c, t[15] = o, t[16] = s, t[17] = d, t[18] = e) : e = t[18], m = n.map(e), t[4] = p, t[5] = l, t[6] = c, t[7] = o, t[8] = s, t[9] = n, t[10] = d, t[11] = m;
|
|
632
|
+
} else m = t[11];
|
|
633
|
+
let h;
|
|
634
|
+
return t[19] === m ? h = t[20] : (h = /* @__PURE__ */ H(M, {
|
|
481
635
|
as: "form",
|
|
482
636
|
gap: "sm",
|
|
483
|
-
onSubmit:
|
|
637
|
+
onSubmit: yt,
|
|
484
638
|
"aria-label": "Question form",
|
|
485
|
-
children:
|
|
486
|
-
}), t[
|
|
639
|
+
children: m
|
|
640
|
+
}), t[19] = m, t[20] = h), h;
|
|
487
641
|
};
|
|
488
|
-
function
|
|
642
|
+
function Ot(t, n) {
|
|
489
643
|
return /* @__PURE__ */ H(g, {
|
|
490
644
|
as: "li",
|
|
491
645
|
children: /* @__PURE__ */ H(e, {
|
|
@@ -504,166 +658,86 @@ function rt(t, n) {
|
|
|
504
658
|
}
|
|
505
659
|
//#endregion
|
|
506
660
|
//#region src/components/chat-ui/components/chat-input-question-prompt.tsx
|
|
507
|
-
var
|
|
508
|
-
|
|
509
|
-
return t.multiple ? {
|
|
510
|
-
...e,
|
|
511
|
-
[i]: o ? a.filter((e) => e !== r) : [...a, r]
|
|
512
|
-
} : {
|
|
513
|
-
...e,
|
|
514
|
-
[i]: o ? [] : [r]
|
|
515
|
-
};
|
|
516
|
-
}, ot = (e) => e ? JSON.stringify(e.questions.map((e, t) => ({
|
|
517
|
-
id: it(e, t),
|
|
518
|
-
question: e.question,
|
|
519
|
-
multiple: !!e.multiple,
|
|
520
|
-
required: !!e.required,
|
|
521
|
-
allowCustomAnswer: !!e.allowCustomAnswer,
|
|
522
|
-
options: e.options.map((e) => ({
|
|
523
|
-
label: e.label,
|
|
524
|
-
description: e.description ?? ""
|
|
525
|
-
}))
|
|
526
|
-
}))) : "", st = (e, t, n) => {
|
|
527
|
-
let r = [];
|
|
528
|
-
for (let i = 0; i < e.questions.length; i += 1) {
|
|
529
|
-
let a = e.questions[i], o = it(a, i), s = t[o] ?? [], c = n[o]?.trim(), l = c ? [...s, c] : s;
|
|
530
|
-
l.length !== 0 && r.push(`${a.question}: ${l.join(", ")}`);
|
|
531
|
-
}
|
|
532
|
-
return r;
|
|
533
|
-
}, ct = (e) => typeof e != "string", lt = (e, t) => {
|
|
534
|
-
if (ct(t)) return t;
|
|
535
|
-
let n = t.trim();
|
|
536
|
-
if (n.length === 0) return {};
|
|
537
|
-
let r = {};
|
|
538
|
-
for (let t = 0; t < e.questions.length; t += 1) {
|
|
539
|
-
let i = e.questions[t];
|
|
540
|
-
i.allowCustomAnswer && (r[it(i, t)] = n);
|
|
541
|
-
}
|
|
542
|
-
return r;
|
|
543
|
-
}, ut = (e, t, n) => {
|
|
544
|
-
if (!e) return typeof n == "string" ? n.trim() : "";
|
|
545
|
-
let r = st(e, t, lt(e, n)), i = typeof n == "string" ? n.trim() : "", a = e.questions.some((e) => e.allowCustomAnswer);
|
|
546
|
-
return i.length > 0 && !a && r.push(`Additional response: ${i}`), r.join("\n");
|
|
547
|
-
}, dt = (e, t, n) => {
|
|
548
|
-
let r = lt(e, n);
|
|
549
|
-
return e.questions.map((e, n) => {
|
|
550
|
-
let i = it(e, n), a = t[i] ?? [], o = r[i]?.trim();
|
|
551
|
-
return o ? [...a, o] : a;
|
|
552
|
-
});
|
|
553
|
-
}, ft = (e, t, n) => {
|
|
554
|
-
if (!e) return !1;
|
|
555
|
-
let r = lt(e, n);
|
|
556
|
-
for (let n = 0; n < e.questions.length; n += 1) {
|
|
557
|
-
let i = e.questions[n];
|
|
558
|
-
if (!i.required) continue;
|
|
559
|
-
let a = it(i, n);
|
|
560
|
-
if (!((t[a] ?? []).length > 0) && !(i.allowCustomAnswer && r[a]?.trim())) return !0;
|
|
561
|
-
}
|
|
562
|
-
return !1;
|
|
563
|
-
}, pt = (e) => e.questions.map((e, t) => ({
|
|
564
|
-
id: it(e, t),
|
|
661
|
+
var kt = (e) => e.questions.map((e, t) => ({
|
|
662
|
+
id: Z(e, t),
|
|
565
663
|
question: e.question,
|
|
566
664
|
options: e.options,
|
|
567
665
|
multiple: !!e.multiple,
|
|
568
666
|
required: !!e.required,
|
|
569
667
|
allowCustomAnswer: !!e.allowCustomAnswer
|
|
570
|
-
})),
|
|
571
|
-
let i =
|
|
572
|
-
|
|
573
|
-
}, ht = (e) => {
|
|
574
|
-
let t = B(22), { question: n, sourceQuestion: i, questionIndex: a, isActive: o, selectedOptionsByQuestion: s, customAnswersByQuestion: c, onSelectStep: l } = e, u;
|
|
575
|
-
t[0] !== c || t[1] !== a || t[2] !== s || t[3] !== i ? (u = mt(i, a, s, c), t[0] = c, t[1] = a, t[2] = s, t[3] = i, t[4] = u) : u = t[4];
|
|
576
|
-
let d = u, f = d ? "answered" : "not answered", p = o ? "outline" : "ghost", m = `question-step-tab-${n.id}`, h = `${n.question} (${f})`, g = `question-step-panel-${n.id}`, v;
|
|
577
|
-
t[5] !== l || t[6] !== a ? (v = () => l(a), t[5] = l, t[6] = a, t[7] = v) : v = t[7];
|
|
578
|
-
let y;
|
|
579
|
-
t[8] !== d || t[9] !== a ? (y = d ? /* @__PURE__ */ H(X, { "aria-hidden": "true" }) : a + 1, t[8] = d, t[9] = a, t[10] = y) : y = t[10];
|
|
580
|
-
let b;
|
|
581
|
-
t[11] !== o || t[12] !== m || t[13] !== h || t[14] !== g || t[15] !== v || t[16] !== y || t[17] !== p ? (b = /* @__PURE__ */ H(_, {
|
|
582
|
-
id: m,
|
|
583
|
-
role: "tab",
|
|
584
|
-
"aria-label": h,
|
|
585
|
-
"aria-selected": o,
|
|
586
|
-
"aria-controls": g,
|
|
587
|
-
size: "xs",
|
|
588
|
-
variant: p,
|
|
589
|
-
minW: "8",
|
|
590
|
-
onClick: v,
|
|
591
|
-
children: y
|
|
592
|
-
}), t[11] = o, t[12] = m, t[13] = h, t[14] = g, t[15] = v, t[16] = y, t[17] = p, t[18] = b) : b = t[18];
|
|
593
|
-
let x;
|
|
594
|
-
return t[19] !== n.question || t[20] !== b ? (x = /* @__PURE__ */ H(r, {
|
|
595
|
-
content: n.question,
|
|
596
|
-
children: b
|
|
597
|
-
}), t[19] = n.question, t[20] = b, t[21] = x) : x = t[21], x;
|
|
598
|
-
}, gt = (e) => {
|
|
599
|
-
let t = B(31), { questionPrompt: n, selectedOptionsByQuestion: r, customAnswersByQuestion: i, onToggleOption: a, onCustomAnswerChange: o } = e, { questions: s } = e, [c, l] = J(0), u = Math.min(c, s.length - 1), d = s[u], f = s.length > 1, p;
|
|
600
|
-
t[0] !== i || t[1] !== f || t[2] !== n.questions || t[3] !== s || t[4] !== u || t[5] !== r ? (p = f ? /* @__PURE__ */ H(x, {
|
|
668
|
+
})), At = (e) => {
|
|
669
|
+
let t = B(35), { questionPrompt: n, selectedOptionsByQuestion: r, customAnswersByQuestion: i, onToggleOption: a, onCustomAnswerChange: o } = e, { onToggleOther: s } = e, { questions: c } = e, [l, u] = q(0), d = Math.min(l, c.length - 1), f = c[d], p = c.length > 1, m;
|
|
670
|
+
t[0] !== i || t[1] !== p || t[2] !== c || t[3] !== d || t[4] !== r ? (m = p ? /* @__PURE__ */ H(x, {
|
|
601
671
|
role: "tablist",
|
|
602
672
|
"aria-label": "Question steps",
|
|
603
673
|
gap: "1",
|
|
604
674
|
minWidth: "0",
|
|
605
|
-
children:
|
|
675
|
+
children: c.map((e, t) => /* @__PURE__ */ H(vt, {
|
|
606
676
|
question: e,
|
|
607
|
-
sourceQuestion: n.questions[t],
|
|
608
677
|
questionIndex: t,
|
|
609
|
-
isActive: t ===
|
|
678
|
+
isActive: t === d,
|
|
610
679
|
selectedOptionsByQuestion: r,
|
|
611
680
|
customAnswersByQuestion: i,
|
|
612
|
-
onSelectStep:
|
|
681
|
+
onSelectStep: u
|
|
613
682
|
}, e.id))
|
|
614
|
-
}) : null, t[0] = i, t[1] =
|
|
615
|
-
let
|
|
616
|
-
t[
|
|
617
|
-
let v;
|
|
618
|
-
t[9] !== a || t[10] !== n.questions || t[11] !== u ? (v = (e, t, r) => {
|
|
619
|
-
a(n.questions[u], u, r);
|
|
620
|
-
}, t[9] = a, t[10] = n.questions, t[11] = u, t[12] = v) : v = t[12];
|
|
683
|
+
}) : null, t[0] = i, t[1] = p, t[2] = c, t[3] = d, t[4] = r, t[5] = m) : m = t[5];
|
|
684
|
+
let h = `question-step-panel-${f.id}`, g = p ? "tabpanel" : void 0, _ = p ? `question-step-tab-${f.id}` : void 0, v;
|
|
685
|
+
t[6] === f ? v = t[7] : (v = [f], t[6] = f, t[7] = v);
|
|
621
686
|
let y;
|
|
622
|
-
t[
|
|
623
|
-
|
|
624
|
-
}, t[
|
|
687
|
+
t[8] !== a || t[9] !== n.questions || t[10] !== d ? (y = (e, t, r) => {
|
|
688
|
+
a(n.questions[d], d, r);
|
|
689
|
+
}, t[8] = a, t[9] = n.questions, t[10] = d, t[11] = y) : y = t[11];
|
|
625
690
|
let b;
|
|
626
|
-
t[
|
|
627
|
-
questions
|
|
691
|
+
t[12] !== s || t[13] !== n.questions || t[14] !== d ? (b = () => {
|
|
692
|
+
s(n.questions[d], d);
|
|
693
|
+
}, t[12] = s, t[13] = n.questions, t[14] = d, t[15] = b) : b = t[15];
|
|
694
|
+
let S;
|
|
695
|
+
t[16] !== o || t[17] !== n.questions || t[18] !== d ? (S = (e, t, r) => {
|
|
696
|
+
o(n.questions[d], d, r);
|
|
697
|
+
}, t[16] = o, t[17] = n.questions, t[18] = d, t[19] = S) : S = t[19];
|
|
698
|
+
let C;
|
|
699
|
+
t[20] !== i || t[21] !== r || t[22] !== v || t[23] !== y || t[24] !== b || t[25] !== S ? (C = /* @__PURE__ */ H(Dt, {
|
|
700
|
+
questions: v,
|
|
628
701
|
editable: !0,
|
|
629
702
|
selectedOptionsByQuestion: r,
|
|
630
703
|
customAnswersByQuestion: i,
|
|
631
|
-
onToggleOption:
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
704
|
+
onToggleOption: y,
|
|
705
|
+
onToggleOther: b,
|
|
706
|
+
onCustomAnswerChange: S
|
|
707
|
+
}), t[20] = i, t[21] = r, t[22] = v, t[23] = y, t[24] = b, t[25] = S, t[26] = C) : C = t[26];
|
|
708
|
+
let w;
|
|
709
|
+
t[27] !== h || t[28] !== g || t[29] !== _ || t[30] !== C ? (w = /* @__PURE__ */ H(M, {
|
|
710
|
+
id: h,
|
|
711
|
+
role: g,
|
|
712
|
+
"aria-labelledby": _,
|
|
639
713
|
gap: "0",
|
|
640
|
-
children:
|
|
641
|
-
}), t[
|
|
642
|
-
let
|
|
643
|
-
return t[
|
|
714
|
+
children: C
|
|
715
|
+
}), t[27] = h, t[28] = g, t[29] = _, t[30] = C, t[31] = w) : w = t[31];
|
|
716
|
+
let T;
|
|
717
|
+
return t[32] !== m || t[33] !== w ? (T = /* @__PURE__ */ U(M, {
|
|
644
718
|
gap: "xs",
|
|
645
719
|
pb: "sm",
|
|
646
|
-
children: [
|
|
647
|
-
}), t[
|
|
648
|
-
},
|
|
720
|
+
children: [m, w]
|
|
721
|
+
}), t[32] = m, t[33] = w, t[34] = T) : T = t[34], T;
|
|
722
|
+
}, jt = (e) => {
|
|
649
723
|
let t = B(8), { questionPrompt: n } = e, r;
|
|
650
|
-
t[0] === n ? r = t[1] : (r =
|
|
724
|
+
t[0] === n ? r = t[1] : (r = kt(n), t[0] = n, t[1] = r);
|
|
651
725
|
let i = r, a;
|
|
652
|
-
t[2] === n ? a = t[3] : (a =
|
|
726
|
+
t[2] === n ? a = t[3] : (a = ct(n), t[2] = n, t[3] = a);
|
|
653
727
|
let o = a, s;
|
|
654
|
-
return t[4] !== e || t[5] !== o || t[6] !== i ? (s = /* @__PURE__ */ H(
|
|
728
|
+
return t[4] !== e || t[5] !== o || t[6] !== i ? (s = /* @__PURE__ */ H(At, {
|
|
655
729
|
...e,
|
|
656
730
|
questions: i
|
|
657
731
|
}, o), t[4] = e, t[5] = o, t[6] = i, t[7] = s) : s = t[7], s;
|
|
658
|
-
},
|
|
732
|
+
}, Mt = (e) => {
|
|
659
733
|
let t = B(22), n, r, i, a;
|
|
660
734
|
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);
|
|
661
735
|
let o = r["aria-label"] ?? a, s;
|
|
662
|
-
t[5] === n ? s = t[6] : (s = n ? /* @__PURE__ */ H(
|
|
736
|
+
t[5] === n ? s = t[6] : (s = n ? /* @__PURE__ */ H(xe, {
|
|
663
737
|
size: 16,
|
|
664
738
|
strokeWidth: 2,
|
|
665
739
|
fill: "currentColor"
|
|
666
|
-
}) : /* @__PURE__ */ H(
|
|
740
|
+
}) : /* @__PURE__ */ H(ae, {
|
|
667
741
|
size: 16,
|
|
668
742
|
strokeWidth: 2
|
|
669
743
|
}), t[5] = n, t[6] = s);
|
|
@@ -703,7 +777,7 @@ var it = (e, t) => e.id ?? `question-${t}`, at = (e, t, n, r) => {
|
|
|
703
777
|
}), t[19] = r, t[20] = o, t[21] = s) : s = t[21], s;
|
|
704
778
|
}
|
|
705
779
|
return u;
|
|
706
|
-
},
|
|
780
|
+
}, Nt = (e) => {
|
|
707
781
|
let t = [];
|
|
708
782
|
for (let n = e.length - 1; n >= 0 && t.length < 10; n--) {
|
|
709
783
|
let r = e[n];
|
|
@@ -712,8 +786,8 @@ var it = (e, t) => e.id ?? `question-${t}`, at = (e, t, n, r) => {
|
|
|
712
786
|
i.trim() && t.push(i);
|
|
713
787
|
}
|
|
714
788
|
return t;
|
|
715
|
-
},
|
|
716
|
-
let t = B(24), { recentUserMessages: n, text: r, blocked: i, resetKey: a, onChange: o } = e, s =
|
|
789
|
+
}, Pt = (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 }, Ft = (e) => {
|
|
790
|
+
let t = B(24), { recentUserMessages: n, text: r, blocked: i, resetKey: a, onChange: o } = e, s = K(null), c = K(null), l, u;
|
|
717
791
|
if (t[0] !== i || t[1] !== n || t[2] !== a) {
|
|
718
792
|
l = n.slice(0, 10);
|
|
719
793
|
let e = JSON.stringify(l);
|
|
@@ -723,10 +797,10 @@ var it = (e, t) => e.id ?? `question-${t}`, at = (e, t, n, r) => {
|
|
|
723
797
|
i
|
|
724
798
|
]), t[0] = i, t[1] = n, t[2] = a, t[3] = l, t[4] = u;
|
|
725
799
|
} else l = t[3], u = t[4];
|
|
726
|
-
let d = u, f =
|
|
800
|
+
let d = u, f = K(d), p, m;
|
|
727
801
|
t[5] === d ? (p = t[6], m = t[7]) : (p = () => {
|
|
728
802
|
f.current !== d && (f.current = d, c.current = null);
|
|
729
|
-
}, m = [d], t[5] = d, t[6] = p, t[7] = m),
|
|
803
|
+
}, m = [d], t[5] = d, t[6] = p, t[7] = m), G(p, m);
|
|
730
804
|
let h;
|
|
731
805
|
t[8] === Symbol.for("react.memo_cache_sentinel") ? (h = () => {
|
|
732
806
|
c.current = null;
|
|
@@ -738,7 +812,7 @@ var it = (e, t) => e.id ?? `question-${t}`, at = (e, t, n, r) => {
|
|
|
738
812
|
let v = _, y;
|
|
739
813
|
t[12] !== i || t[13] !== o || t[14] !== l || t[15] !== r ? (y = (e) => {
|
|
740
814
|
if (i) return !1;
|
|
741
|
-
let t =
|
|
815
|
+
let t = Pt(c.current, e, r, l.length);
|
|
742
816
|
if (!t) return !1;
|
|
743
817
|
c.current = t.index;
|
|
744
818
|
let n = t.index === null ? "" : l[t.index];
|
|
@@ -754,7 +828,39 @@ var it = (e, t) => e.id ?? `question-${t}`, at = (e, t, n, r) => {
|
|
|
754
828
|
recallPrevious: x,
|
|
755
829
|
recallNext: S
|
|
756
830
|
}, t[20] = v, t[21] = x, t[22] = S, t[23] = C) : C = t[23], C;
|
|
757
|
-
},
|
|
831
|
+
}, It = (e, t) => {
|
|
832
|
+
let [n, r] = q({}), [i, a] = q({}), o = ct(e), s = K(JSON.stringify([o, t ?? null]));
|
|
833
|
+
return G(() => {
|
|
834
|
+
let e = JSON.stringify([o, t ?? null]);
|
|
835
|
+
s.current !== e && (s.current = e, r({}), a({}));
|
|
836
|
+
}, [o, t]), {
|
|
837
|
+
signature: o,
|
|
838
|
+
selectedOptionsByQuestion: n,
|
|
839
|
+
customAnswersByQuestion: i,
|
|
840
|
+
reset: () => {
|
|
841
|
+
r({}), a({});
|
|
842
|
+
},
|
|
843
|
+
toggleOption: (e, t, n) => {
|
|
844
|
+
r((r) => st(r, e, t, n)), e.multiple || a((n) => rt(n, e, t));
|
|
845
|
+
},
|
|
846
|
+
toggleOther: (e, t) => {
|
|
847
|
+
a((n) => it(n, e, t)), e.multiple || r((n) => ({
|
|
848
|
+
...n,
|
|
849
|
+
[Z(e, t)]: []
|
|
850
|
+
}));
|
|
851
|
+
},
|
|
852
|
+
setCustomAnswer: (e, t, n) => {
|
|
853
|
+
let r = Z(e, t);
|
|
854
|
+
a((e) => ({
|
|
855
|
+
...e,
|
|
856
|
+
[r]: n
|
|
857
|
+
}));
|
|
858
|
+
},
|
|
859
|
+
responseText: e ? mt(e, n, i) : "",
|
|
860
|
+
hasMissingRequiredAnswer: gt(e, n, i),
|
|
861
|
+
buildAnswers: () => e ? ht(e, n, i) : []
|
|
862
|
+
};
|
|
863
|
+
}, Lt = (e) => {
|
|
758
864
|
let t = B(2), { placeholder: n } = e;
|
|
759
865
|
if (!n) return null;
|
|
760
866
|
let r;
|
|
@@ -766,133 +872,129 @@ var it = (e, t) => e.id ?? `question-${t}`, at = (e, t, n, r) => {
|
|
|
766
872
|
top: "0",
|
|
767
873
|
children: n
|
|
768
874
|
}), t[0] = n, t[1] = r), r;
|
|
769
|
-
},
|
|
875
|
+
}, Rt = "border.accent-light", zt = (e) => {
|
|
770
876
|
let t = e?.querySelector("[contenteditable=\"true\"]");
|
|
771
877
|
t instanceof HTMLElement && t.focus();
|
|
772
|
-
},
|
|
773
|
-
|
|
774
|
-
}),
|
|
878
|
+
}, Bt = (e, t) => requestAnimationFrame(() => {
|
|
879
|
+
zt(e), t?.();
|
|
880
|
+
}), Vt = (e, t, n, r) => {
|
|
775
881
|
let i = B(10), a, o;
|
|
776
882
|
i[0] !== t || i[1] !== e || i[2] !== r ? (a = () => {
|
|
777
883
|
if (!t) return;
|
|
778
|
-
let n =
|
|
884
|
+
let n = Bt(e.current, () => r(!0));
|
|
779
885
|
return () => cancelAnimationFrame(n);
|
|
780
886
|
}, o = [
|
|
781
887
|
t,
|
|
782
888
|
e,
|
|
783
889
|
r
|
|
784
|
-
], i[0] = t, i[1] = e, i[2] = r, i[3] = a, i[4] = o) : (a = i[3], o = i[4]),
|
|
890
|
+
], i[0] = t, i[1] = e, i[2] = r, i[3] = a, i[4] = o) : (a = i[3], o = i[4]), G(a, o);
|
|
785
891
|
let s, c;
|
|
786
892
|
i[5] !== e || i[6] !== n || i[7] !== r ? (s = () => {
|
|
787
893
|
if (n === 0) return;
|
|
788
|
-
let t =
|
|
894
|
+
let t = Bt(e.current, () => r(!0));
|
|
789
895
|
return () => cancelAnimationFrame(t);
|
|
790
896
|
}, c = [
|
|
791
897
|
n,
|
|
792
898
|
e,
|
|
793
899
|
r
|
|
794
|
-
], i[5] = e, i[6] = n, i[7] = r, i[8] = s, i[9] = c) : (s = i[8], c = i[9]),
|
|
795
|
-
},
|
|
796
|
-
let { defaultState: t, recentUserMessages: n = [], onSubmit: r = () => {}, onInterrupt: a, onAttachFiles: o, onAttachText: s, textAttachmentPasteLineThreshold: c = 200, streaming: u = !1, attachedResources: f = [], onClearAttachments: p, isDisabled: m = !1, submitDisabled: h = !1, onChange:
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
}, [
|
|
900
|
+
], i[5] = e, i[6] = n, i[7] = r, i[8] = s, i[9] = c) : (s = i[8], c = i[9]), G(s, c);
|
|
901
|
+
}, Ht = (e) => {
|
|
902
|
+
let { defaultState: t, recentUserMessages: n = [], onSubmit: r = () => {}, onInterrupt: a, onAttachFiles: o, onAttachText: s, textAttachmentPasteLineThreshold: c = 200, streaming: u = !1, attachedResources: f = [], onClearAttachments: p, isDisabled: m = !1, submitDisabled: h = !1, onChange: v, placeholder: y, attachmentList: S, actions: C, attachedToTop: w = !1, recessed: T = !1, questionPrompt: E, autoFocus: D = !1, focusSignal: O = 0, submitTitle: A, references: j = [], onAddReference: M } = e, N = T ? "border.subtle" : "border", [P, F] = q(!1), [I, L] = q(!1), [R, z] = q(t), [B, V] = q(0), [ee, te] = q(() => l(t)), W = It(E, t), ne = K(null), re = K(v);
|
|
903
|
+
G(() => {
|
|
904
|
+
re.current = v;
|
|
905
|
+
}, [v]), G(() => {
|
|
800
906
|
let e = l(t);
|
|
801
|
-
|
|
802
|
-
}, [t]);
|
|
803
|
-
let ie =
|
|
804
|
-
K(() => {
|
|
805
|
-
X.current !== ie && (X.current = ie, G({}), ne({}));
|
|
806
|
-
}, [ie]), Et(re, E, D, I);
|
|
807
|
-
let Z = xt({
|
|
907
|
+
z(t), V((e) => e + 1), te(e), re.current?.(e);
|
|
908
|
+
}, [t]), Vt(ne, D, O, L);
|
|
909
|
+
let ie = Ft({
|
|
808
910
|
recentUserMessages: n,
|
|
809
|
-
text:
|
|
810
|
-
blocked: m ||
|
|
911
|
+
text: ee,
|
|
912
|
+
blocked: m || P || !!E,
|
|
811
913
|
resetKey: JSON.stringify([
|
|
812
914
|
t,
|
|
813
|
-
|
|
814
|
-
|
|
915
|
+
B,
|
|
916
|
+
W.signature
|
|
815
917
|
]),
|
|
816
918
|
onChange: (e) => {
|
|
817
|
-
|
|
919
|
+
te(e), v?.(e);
|
|
818
920
|
}
|
|
819
921
|
}), ae = () => {
|
|
820
|
-
|
|
821
|
-
},
|
|
822
|
-
|
|
823
|
-
|
|
922
|
+
L(!0), zt(ne.current);
|
|
923
|
+
}, J = (e = !1) => {
|
|
924
|
+
W.reset(), ie.reset(), E || (V((e) => e + 1), z(t), ie.change(l(t))), e && requestAnimationFrame(() => {
|
|
925
|
+
zt(ne.current);
|
|
824
926
|
});
|
|
825
|
-
},
|
|
826
|
-
canInterrupt: u && !
|
|
927
|
+
}, Y = E ? W.responseText : ee.trim(), oe = W.hasMissingRequiredAnswer, se = {
|
|
928
|
+
canInterrupt: u && !E && !!a,
|
|
827
929
|
canSubmit: !h,
|
|
828
|
-
hasQuestionPrompt: !!
|
|
829
|
-
isDisabled: m ||
|
|
930
|
+
hasQuestionPrompt: !!E,
|
|
931
|
+
isDisabled: m || P || oe,
|
|
830
932
|
streaming: u,
|
|
831
|
-
text:
|
|
832
|
-
},
|
|
833
|
-
if (!
|
|
834
|
-
let e =
|
|
835
|
-
|
|
933
|
+
text: Y
|
|
934
|
+
}, ce = Ye(se), le = u && !E ? "Queue message" : "Send message", ue = async () => {
|
|
935
|
+
if (!Y) return;
|
|
936
|
+
let e = E ? { answers: W.buildAnswers() } : void 0;
|
|
937
|
+
ie.reset(), F(!0);
|
|
836
938
|
try {
|
|
837
|
-
await r(
|
|
939
|
+
await r(Y, f, e), J(!0), p?.();
|
|
838
940
|
} catch {} finally {
|
|
839
|
-
|
|
941
|
+
F(!1);
|
|
840
942
|
}
|
|
841
|
-
},
|
|
842
|
-
e === "interrupt" && a?.(), e === "submit" &&
|
|
843
|
-
},
|
|
943
|
+
}, de = (e) => {
|
|
944
|
+
e === "interrupt" && a?.(), e === "submit" && ue();
|
|
945
|
+
}, fe = Ze({
|
|
844
946
|
onAttachFiles: o,
|
|
845
947
|
onAttachText: s,
|
|
846
948
|
textAttachmentPasteLineThreshold: c
|
|
847
|
-
})
|
|
949
|
+
}), pe = async () => {
|
|
950
|
+
F(!0);
|
|
951
|
+
try {
|
|
952
|
+
await r(at, f, ot()), J(!0), p?.();
|
|
953
|
+
} catch {} finally {
|
|
954
|
+
F(!1);
|
|
955
|
+
}
|
|
956
|
+
};
|
|
848
957
|
return /* @__PURE__ */ H(g, {
|
|
849
|
-
ref:
|
|
958
|
+
ref: ne,
|
|
850
959
|
position: "relative",
|
|
851
960
|
width: "100%",
|
|
852
961
|
paddingX: "xs",
|
|
853
962
|
paddingY: "xs",
|
|
854
|
-
mt:
|
|
963
|
+
mt: w ? "-1px" : void 0,
|
|
855
964
|
bg: "bg",
|
|
856
965
|
borderRadius: "xs",
|
|
857
|
-
borderTopRadius:
|
|
966
|
+
borderTopRadius: w ? "0" : void 0,
|
|
858
967
|
borderWidth: "1px",
|
|
859
968
|
borderStyle: "solid",
|
|
860
|
-
borderColor:
|
|
861
|
-
zIndex: +!!
|
|
969
|
+
borderColor: I ? Rt : N,
|
|
970
|
+
zIndex: +!!I,
|
|
862
971
|
transition: "border-color 0.2s ease-in-out",
|
|
863
972
|
_hover: {
|
|
864
|
-
borderColor:
|
|
973
|
+
borderColor: I ? Rt : N,
|
|
865
974
|
zIndex: 1
|
|
866
975
|
},
|
|
867
976
|
_focusWithin: {
|
|
868
|
-
borderColor:
|
|
977
|
+
borderColor: Rt,
|
|
869
978
|
zIndex: 1
|
|
870
979
|
},
|
|
871
|
-
onPasteCapture:
|
|
872
|
-
onDropCapture:
|
|
873
|
-
onDragOver:
|
|
980
|
+
onPasteCapture: fe.onPasteCapture,
|
|
981
|
+
onDropCapture: fe.onDropCapture,
|
|
982
|
+
onDragOver: fe.onDragOver,
|
|
874
983
|
onClick: ae,
|
|
875
|
-
onBlur: () =>
|
|
984
|
+
onBlur: () => L(!1),
|
|
876
985
|
children: /* @__PURE__ */ U(b, {
|
|
877
986
|
direction: "column",
|
|
878
987
|
color: "fg",
|
|
879
988
|
gap: "xs",
|
|
880
989
|
children: [
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
questionPrompt:
|
|
884
|
-
selectedOptionsByQuestion: W,
|
|
885
|
-
customAnswersByQuestion:
|
|
886
|
-
onToggleOption:
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
onCustomAnswerChange: (e, t, n) => {
|
|
890
|
-
let r = it(e, t);
|
|
891
|
-
ne((e) => ({
|
|
892
|
-
...e,
|
|
893
|
-
[r]: n
|
|
894
|
-
}));
|
|
895
|
-
}
|
|
990
|
+
S ? /* @__PURE__ */ H(g, { children: S }) : null,
|
|
991
|
+
E ? /* @__PURE__ */ H(jt, {
|
|
992
|
+
questionPrompt: E,
|
|
993
|
+
selectedOptionsByQuestion: W.selectedOptionsByQuestion,
|
|
994
|
+
customAnswersByQuestion: W.customAnswersByQuestion,
|
|
995
|
+
onToggleOption: W.toggleOption,
|
|
996
|
+
onToggleOther: W.toggleOther,
|
|
997
|
+
onCustomAnswerChange: W.setCustomAnswer
|
|
896
998
|
}) : /* @__PURE__ */ H(i, {
|
|
897
999
|
maxH: "10rem",
|
|
898
1000
|
showHorizontalScrollbar: !1,
|
|
@@ -901,17 +1003,19 @@ var it = (e, t) => e.id ?? `question-${t}`, at = (e, t, n, r) => {
|
|
|
901
1003
|
minH: "7",
|
|
902
1004
|
align: "center",
|
|
903
1005
|
children: /* @__PURE__ */ H(d, {
|
|
904
|
-
ref:
|
|
905
|
-
onRecallPrevious:
|
|
906
|
-
onRecallNext:
|
|
907
|
-
defaultState:
|
|
908
|
-
isEditable: !m && !
|
|
909
|
-
placeholder: /* @__PURE__ */ H(
|
|
910
|
-
onChange:
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
1006
|
+
ref: ie.editorRef,
|
|
1007
|
+
onRecallPrevious: ie.recallPrevious,
|
|
1008
|
+
onRecallNext: ie.recallNext,
|
|
1009
|
+
defaultState: R,
|
|
1010
|
+
isEditable: !m && !P,
|
|
1011
|
+
placeholder: /* @__PURE__ */ H(Lt, { placeholder: y }),
|
|
1012
|
+
onChange: (e, t) => {
|
|
1013
|
+
z(JSON.stringify(t)), ie.change(e);
|
|
1014
|
+
},
|
|
1015
|
+
onSubmit: () => de(Je(se)),
|
|
1016
|
+
references: j,
|
|
1017
|
+
onAddReference: M
|
|
1018
|
+
}, B)
|
|
915
1019
|
})
|
|
916
1020
|
}),
|
|
917
1021
|
/* @__PURE__ */ U(x, {
|
|
@@ -919,77 +1023,85 @@ var it = (e, t) => e.id ?? `question-${t}`, at = (e, t, n, r) => {
|
|
|
919
1023
|
minH: "7",
|
|
920
1024
|
align: "center",
|
|
921
1025
|
children: [
|
|
922
|
-
|
|
1026
|
+
C,
|
|
923
1027
|
/* @__PURE__ */ H(k, {}),
|
|
924
|
-
/* @__PURE__ */ H(
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
1028
|
+
E ? /* @__PURE__ */ H(_, {
|
|
1029
|
+
size: "xs",
|
|
1030
|
+
variant: "ghost",
|
|
1031
|
+
disabled: m || P || h,
|
|
1032
|
+
title: "Skip this question and let the agent continue",
|
|
1033
|
+
onClick: () => void pe(),
|
|
1034
|
+
children: "Skip"
|
|
1035
|
+
}) : null,
|
|
1036
|
+
/* @__PURE__ */ H(Mt, {
|
|
1037
|
+
canInterrupt: ce === "interrupt",
|
|
1038
|
+
title: ce === "interrupt" ? "Stop Response" : A ?? le,
|
|
1039
|
+
shortcut: ce === "submit" ? "Enter" : void 0,
|
|
1040
|
+
onClick: () => de(ce),
|
|
1041
|
+
disabled: ce === "none"
|
|
930
1042
|
})
|
|
931
1043
|
]
|
|
932
1044
|
})
|
|
933
1045
|
]
|
|
934
1046
|
})
|
|
935
1047
|
});
|
|
936
|
-
},
|
|
1048
|
+
}, Ut = (e) => typeof e == "object" && !!e && !Array.isArray(e), Wt = (e) => {
|
|
937
1049
|
try {
|
|
938
1050
|
let t = JSON.parse(e);
|
|
939
|
-
return
|
|
1051
|
+
return Ut(t) ? t : null;
|
|
940
1052
|
} catch {
|
|
941
1053
|
return null;
|
|
942
1054
|
}
|
|
943
|
-
},
|
|
944
|
-
let t =
|
|
1055
|
+
}, Gt = (e) => Ut(e) ? e : typeof e == "string" && e.trim().length > 0 ? Wt(e) : null, Kt = (e) => typeof e == "string" && e.trim().length > 0 ? e : null, qt = (e) => {
|
|
1056
|
+
let t = Kt(e);
|
|
945
1057
|
if (t) return t;
|
|
946
1058
|
if (Array.isArray(e)) {
|
|
947
|
-
let t = e.map(
|
|
1059
|
+
let t = e.map(qt).filter((e) => e !== null);
|
|
948
1060
|
return t.length > 0 ? t.join("\n") : null;
|
|
949
1061
|
}
|
|
950
|
-
return
|
|
951
|
-
},
|
|
1062
|
+
return Ut(e) ? qt(e.response) ?? qt(e.answer) ?? qt(e.text) ?? qt(e.answers) : null;
|
|
1063
|
+
}, Jt = (e) => Ut(e) ? Array.isArray(e.answers) ? !0 : Jt(e.response) || Jt(e.answer) : !1, Yt = (e) => qt(e) !== null || Jt(e), Xt = (e) => {
|
|
952
1064
|
if (typeof e == "string" && e.trim().length > 0) return {
|
|
953
1065
|
label: e,
|
|
954
1066
|
description: void 0
|
|
955
1067
|
};
|
|
956
|
-
if (!
|
|
957
|
-
let t =
|
|
1068
|
+
if (!Ut(e)) return null;
|
|
1069
|
+
let t = Kt(e.label);
|
|
958
1070
|
return t ? {
|
|
959
1071
|
label: t,
|
|
960
|
-
description:
|
|
1072
|
+
description: Kt(e.description) ?? void 0
|
|
961
1073
|
} : null;
|
|
962
|
-
},
|
|
963
|
-
if (!
|
|
964
|
-
let n =
|
|
1074
|
+
}, Zt = (e, t) => {
|
|
1075
|
+
if (!Ut(e)) return null;
|
|
1076
|
+
let n = Kt(e.question);
|
|
965
1077
|
if (!n) return null;
|
|
966
|
-
let r = Array.isArray(e.options) ? e.options.map(
|
|
1078
|
+
let r = Array.isArray(e.options) ? e.options.map(Xt).filter((e) => e !== null) : [], i = Kt(e.type), a = typeof e.custom == "boolean" ? e.custom : typeof e.allowCustomAnswer == "boolean" ? e.allowCustomAnswer : r.length === 0 || i === "freeform" || i === "text";
|
|
967
1079
|
return {
|
|
968
|
-
id:
|
|
1080
|
+
id: Kt(e.id) ?? `question-${t}`,
|
|
969
1081
|
question: n,
|
|
970
1082
|
options: r,
|
|
971
1083
|
multiple: typeof e.multiple == "boolean" ? e.multiple : i === "multi_choice" || i === "multiple_choice",
|
|
972
1084
|
required: typeof e.required != "boolean" || e.required,
|
|
973
1085
|
allowCustomAnswer: a
|
|
974
1086
|
};
|
|
975
|
-
},
|
|
976
|
-
let t =
|
|
1087
|
+
}, Qt = (e) => {
|
|
1088
|
+
let t = Gt(e);
|
|
977
1089
|
if (!t || !Array.isArray(t.questions)) return null;
|
|
978
|
-
let n = t.questions.map(
|
|
1090
|
+
let n = t.questions.map(Zt).filter((e) => e !== null);
|
|
979
1091
|
return n.length === 0 ? null : { questions: n };
|
|
980
|
-
},
|
|
1092
|
+
}, $t = (e) => e.tool.toLowerCase() === "question", en = (e) => {
|
|
981
1093
|
for (let t = e.length - 1; t >= 0; --t) {
|
|
982
1094
|
let n = e[t];
|
|
983
1095
|
if (n.role === "assistant") for (let e = n.parts.length - 1; e >= 0; --e) {
|
|
984
1096
|
let t = n.parts[e];
|
|
985
|
-
if (t.type === "tool" &&
|
|
1097
|
+
if (t.type === "tool" && $t(t)) return Yt(t.state?.output) || Yt(t.state?.metadata) ? void 0 : Qt(t.state?.input) ?? void 0;
|
|
986
1098
|
}
|
|
987
1099
|
}
|
|
988
|
-
},
|
|
1100
|
+
}, tn = {
|
|
989
1101
|
animationName: "message-fade-in",
|
|
990
1102
|
animationDuration: "200ms",
|
|
991
1103
|
animationTimingFunction: "ease-out"
|
|
992
|
-
},
|
|
1104
|
+
}, nn = (e) => {
|
|
993
1105
|
let t = /* @__PURE__ */ new Set(), n = new Set(e.state.seenKeys);
|
|
994
1106
|
for (let r of e.itemKeys) e.state.initialized && !n.has(r) && t.add(r), n.add(r);
|
|
995
1107
|
return {
|
|
@@ -999,17 +1111,17 @@ var it = (e, t) => e.id ?? `question-${t}`, at = (e, t, n, r) => {
|
|
|
999
1111
|
seenKeys: n
|
|
1000
1112
|
}
|
|
1001
1113
|
};
|
|
1002
|
-
},
|
|
1114
|
+
}, rn = (e, t) => {
|
|
1003
1115
|
if (e.length !== t.length) return !1;
|
|
1004
1116
|
for (let n = 0; n < e.length; n += 1) if (e[n] !== t[n]) return !1;
|
|
1005
1117
|
return !0;
|
|
1006
|
-
},
|
|
1007
|
-
let t =
|
|
1118
|
+
}, an = (e) => {
|
|
1119
|
+
let t = K({
|
|
1008
1120
|
initialized: !1,
|
|
1009
1121
|
seenKeys: /* @__PURE__ */ new Set()
|
|
1010
|
-
}), n =
|
|
1011
|
-
if (n.current &&
|
|
1012
|
-
let r =
|
|
1122
|
+
}), n = K(null);
|
|
1123
|
+
if (n.current && rn(n.current.itemKeys, e)) return n.current.animatedKeys;
|
|
1124
|
+
let r = nn({
|
|
1013
1125
|
itemKeys: e,
|
|
1014
1126
|
state: t.current
|
|
1015
1127
|
});
|
|
@@ -1017,19 +1129,19 @@ var it = (e, t) => e.id ?? `question-${t}`, at = (e, t, n, r) => {
|
|
|
1017
1129
|
itemKeys: [...e],
|
|
1018
1130
|
animatedKeys: r.animatedKeys
|
|
1019
1131
|
}, r.animatedKeys;
|
|
1020
|
-
},
|
|
1132
|
+
}, on = (e) => e.type === "text", sn = (e) => (e.parts ?? []).filter(on).map((e) => e.text.trim()).filter(Boolean).join("\n\n"), cn = (e, t, n) => e.delivery === "unsent" ? "Not sent" : e.createdAt ? new Intl.DateTimeFormat(t, {
|
|
1021
1133
|
hour: "numeric",
|
|
1022
1134
|
minute: "2-digit",
|
|
1023
1135
|
timeZone: n
|
|
1024
|
-
}).format(new Date(e.createdAt)) : "",
|
|
1025
|
-
let t = B(20), { message: n, alwaysVisible: i, copyAlwaysVisible: a } = e, o = i !== void 0 && i, s = a === void 0 ? o : a, [c, l] =
|
|
1026
|
-
t[0] === n ? d = t[1] : (d =
|
|
1136
|
+
}).format(new Date(e.createdAt)) : "", ln = (e) => {
|
|
1137
|
+
let t = B(20), { message: n, alwaysVisible: i, copyAlwaysVisible: a } = e, o = i !== void 0 && i, s = a === void 0 ? o : a, [c, l] = q(!1), u = K(null), d;
|
|
1138
|
+
t[0] === n ? d = t[1] : (d = sn(n), t[0] = n, t[1] = d);
|
|
1027
1139
|
let f = d, p;
|
|
1028
|
-
t[2] === n ? p = t[3] : (p =
|
|
1140
|
+
t[2] === n ? p = t[3] : (p = cn(n), t[2] = n, t[3] = p);
|
|
1029
1141
|
let m = p, h, _;
|
|
1030
1142
|
t[4] === Symbol.for("react.memo_cache_sentinel") ? (h = () => () => {
|
|
1031
1143
|
u.current !== null && window.clearTimeout(u.current);
|
|
1032
|
-
}, _ = [], t[4] = h, t[5] = _) : (h = t[4], _ = t[5]),
|
|
1144
|
+
}, _ = [], t[4] = h, t[5] = _) : (h = t[4], _ = t[5]), G(h, _);
|
|
1033
1145
|
let v;
|
|
1034
1146
|
t[6] === f ? v = t[7] : (v = async () => {
|
|
1035
1147
|
if (f) try {
|
|
@@ -1051,7 +1163,7 @@ var it = (e, t) => e.id ?? `question-${t}`, at = (e, t, n, r) => {
|
|
|
1051
1163
|
opacity: s ? "1" : "0",
|
|
1052
1164
|
pointerEvents: s ? "auto" : "none",
|
|
1053
1165
|
transition: "opacity 120ms ease",
|
|
1054
|
-
css:
|
|
1166
|
+
css: un,
|
|
1055
1167
|
children: /* @__PURE__ */ H(r, {
|
|
1056
1168
|
content: c ? "Copied" : "Copy message",
|
|
1057
1169
|
children: /* @__PURE__ */ H(C, {
|
|
@@ -1059,7 +1171,7 @@ var it = (e, t) => e.id ?? `question-${t}`, at = (e, t, n, r) => {
|
|
|
1059
1171
|
variant: "ghost",
|
|
1060
1172
|
size: "2xs",
|
|
1061
1173
|
onClick: y,
|
|
1062
|
-
children: H(c ?
|
|
1174
|
+
children: H(c ? J : se, { size: 12 })
|
|
1063
1175
|
})
|
|
1064
1176
|
})
|
|
1065
1177
|
}) : null, t[10] = s, t[11] = y, t[12] = f, t[13] = c, t[14] = T) : T = t[14];
|
|
@@ -1071,10 +1183,10 @@ var it = (e, t) => e.id ?? `question-${t}`, at = (e, t, n, r) => {
|
|
|
1071
1183
|
opacity: b,
|
|
1072
1184
|
pointerEvents: S,
|
|
1073
1185
|
transition: "opacity 120ms ease",
|
|
1074
|
-
css:
|
|
1186
|
+
css: un,
|
|
1075
1187
|
children: [w, T]
|
|
1076
1188
|
}), t[15] = T, t[16] = b, t[17] = S, t[18] = w, t[19] = E) : E = t[19], E;
|
|
1077
|
-
},
|
|
1189
|
+
}, un = {
|
|
1078
1190
|
"[data-chat-message-with-actions]:hover &, [data-chat-message-with-actions]:focus-within &": {
|
|
1079
1191
|
opacity: 1,
|
|
1080
1192
|
pointerEvents: "auto"
|
|
@@ -1087,7 +1199,7 @@ var it = (e, t) => e.id ?? `question-${t}`, at = (e, t, n, r) => {
|
|
|
1087
1199
|
opacity: 1,
|
|
1088
1200
|
pointerEvents: "auto"
|
|
1089
1201
|
}
|
|
1090
|
-
},
|
|
1202
|
+
}, dn = (e) => {
|
|
1091
1203
|
let t = B(8), n, r;
|
|
1092
1204
|
t[0] === e ? (n = t[1], r = t[2]) : ({children: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r);
|
|
1093
1205
|
let i;
|
|
@@ -1100,37 +1212,37 @@ var it = (e, t) => e.id ?? `question-${t}`, at = (e, t, n, r) => {
|
|
|
1100
1212
|
...r,
|
|
1101
1213
|
children: i
|
|
1102
1214
|
}), t[5] = r, t[6] = i, t[7] = a) : a = t[7], a;
|
|
1103
|
-
},
|
|
1104
|
-
let t =
|
|
1215
|
+
}, fn = (e) => e.replace(/^tool-/i, "").replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[\s-]+/g, "_").toLowerCase(), pn = (e) => {
|
|
1216
|
+
let t = fn(e), n = t.replace(/_/g, "");
|
|
1105
1217
|
return [.../* @__PURE__ */ new Set([
|
|
1106
1218
|
e,
|
|
1107
1219
|
t,
|
|
1108
1220
|
n
|
|
1109
1221
|
])];
|
|
1110
|
-
},
|
|
1111
|
-
shell:
|
|
1112
|
-
ls:
|
|
1113
|
-
read_file:
|
|
1114
|
-
write_file:
|
|
1115
|
-
delete_file:
|
|
1116
|
-
patch:
|
|
1117
|
-
upload_files:
|
|
1118
|
-
download_file:
|
|
1119
|
-
move_file:
|
|
1120
|
-
},
|
|
1121
|
-
dot:
|
|
1122
|
-
danger:
|
|
1123
|
-
search:
|
|
1124
|
-
browser:
|
|
1125
|
-
file:
|
|
1126
|
-
question:
|
|
1127
|
-
todo:
|
|
1128
|
-
terminal:
|
|
1129
|
-
...
|
|
1130
|
-
},
|
|
1131
|
-
if (!e) return
|
|
1132
|
-
let t =
|
|
1133
|
-
if (
|
|
1222
|
+
}, mn = {
|
|
1223
|
+
shell: Ee,
|
|
1224
|
+
ls: ve,
|
|
1225
|
+
read_file: pe,
|
|
1226
|
+
write_file: fe,
|
|
1227
|
+
delete_file: De,
|
|
1228
|
+
patch: ue,
|
|
1229
|
+
upload_files: me,
|
|
1230
|
+
download_file: de,
|
|
1231
|
+
move_file: be
|
|
1232
|
+
}, hn = {
|
|
1233
|
+
dot: ce,
|
|
1234
|
+
danger: re,
|
|
1235
|
+
search: Ce,
|
|
1236
|
+
browser: he,
|
|
1237
|
+
file: le,
|
|
1238
|
+
question: oe,
|
|
1239
|
+
todo: _e,
|
|
1240
|
+
terminal: Ee,
|
|
1241
|
+
...mn
|
|
1242
|
+
}, gn = "dot", _n = (e) => Object.hasOwn(mn, e), vn = (e) => hn[e], yn = (e) => {
|
|
1243
|
+
if (!e) return gn;
|
|
1244
|
+
let t = fn(e);
|
|
1245
|
+
if (_n(t)) return t;
|
|
1134
1246
|
let n = t.replace(/_/g, "");
|
|
1135
1247
|
switch (t) {
|
|
1136
1248
|
case "read": return "file";
|
|
@@ -1145,79 +1257,79 @@ var it = (e, t) => e.id ?? `question-${t}`, at = (e, t, n, r) => {
|
|
|
1145
1257
|
case "question": return "question";
|
|
1146
1258
|
case "fs":
|
|
1147
1259
|
case "file": return "file";
|
|
1148
|
-
default: return n === "todowrite" || n === "todo" ? "todo" :
|
|
1260
|
+
default: return n === "todowrite" || n === "todo" ? "todo" : gn;
|
|
1149
1261
|
}
|
|
1150
1262
|
};
|
|
1151
1263
|
//#endregion
|
|
1152
1264
|
//#region src/components/chat-ui/utils/diff.ts
|
|
1153
|
-
function
|
|
1265
|
+
function bn(e) {
|
|
1154
1266
|
let t = e.lastIndexOf("/");
|
|
1155
1267
|
return t >= 0 ? e.slice(t + 1) : e;
|
|
1156
1268
|
}
|
|
1157
|
-
function
|
|
1269
|
+
function xn(e) {
|
|
1158
1270
|
if (!e) return null;
|
|
1159
1271
|
let t = e.split(" ")[0].trim();
|
|
1160
1272
|
if (t === "/dev/null") return null;
|
|
1161
1273
|
let n = t;
|
|
1162
1274
|
return (n.startsWith("a/") || n.startsWith("b/")) && (n = n.slice(2)), n.replace(/^\/+/, "").replace(/\\/g, "/");
|
|
1163
1275
|
}
|
|
1164
|
-
var
|
|
1276
|
+
var Sn = (e) => e.startsWith("--- "), Cn = (e) => e.startsWith("+++ "), wn = (e) => e.startsWith("@@"), Tn = (e) => e.startsWith("+") && !(Cn(e) || e === "+++"), En = (e) => e.startsWith("-") && !(Sn(e) || e === "---"), Dn = (e, t) => {
|
|
1165
1277
|
e.has(t) || e.set(t, {
|
|
1166
1278
|
additions: 0,
|
|
1167
1279
|
deletions: 0
|
|
1168
1280
|
});
|
|
1169
|
-
},
|
|
1281
|
+
}, On = (e, t) => {
|
|
1170
1282
|
let n = e.get(t);
|
|
1171
1283
|
n && (n.additions += 1);
|
|
1172
|
-
},
|
|
1284
|
+
}, kn = (e, t) => {
|
|
1173
1285
|
let n = e.get(t);
|
|
1174
1286
|
n && (n.deletions += 1);
|
|
1175
|
-
},
|
|
1176
|
-
if (
|
|
1287
|
+
}, An = (e, t, n) => {
|
|
1288
|
+
if (Sn(e)) return {
|
|
1177
1289
|
...t,
|
|
1178
|
-
lastMinusHeader:
|
|
1290
|
+
lastMinusHeader: xn(e.slice(4)),
|
|
1179
1291
|
inHunk: !1
|
|
1180
1292
|
};
|
|
1181
|
-
if (
|
|
1182
|
-
let r =
|
|
1183
|
-
return r &&
|
|
1293
|
+
if (Cn(e)) {
|
|
1294
|
+
let r = xn(e.slice(4)) ?? t.lastMinusHeader;
|
|
1295
|
+
return r && Dn(n, r), {
|
|
1184
1296
|
...t,
|
|
1185
1297
|
currentPath: r,
|
|
1186
1298
|
inHunk: !1
|
|
1187
1299
|
};
|
|
1188
1300
|
}
|
|
1189
|
-
return t.currentPath ?
|
|
1301
|
+
return t.currentPath ? wn(e) ? {
|
|
1190
1302
|
...t,
|
|
1191
1303
|
inHunk: !0
|
|
1192
|
-
} : t.inHunk ?
|
|
1304
|
+
} : t.inHunk ? Tn(e) ? (On(n, t.currentPath), t) : (En(e) && kn(n, t.currentPath), t) : t : t;
|
|
1193
1305
|
};
|
|
1194
|
-
function
|
|
1306
|
+
function jn(e) {
|
|
1195
1307
|
if (!e || typeof e != "string") return [];
|
|
1196
1308
|
let t = /* @__PURE__ */ new Map(), n = {
|
|
1197
1309
|
currentPath: null,
|
|
1198
1310
|
lastMinusHeader: null,
|
|
1199
1311
|
inHunk: !1
|
|
1200
1312
|
}, r = e.split(/\r?\n/);
|
|
1201
|
-
for (let e of r) n =
|
|
1313
|
+
for (let e of r) n = An(e, n, t);
|
|
1202
1314
|
return Array.from(t.entries()).map(([e, { additions: t, deletions: n }]) => ({
|
|
1203
1315
|
filePath: e,
|
|
1204
1316
|
additions: t,
|
|
1205
1317
|
deletions: n
|
|
1206
1318
|
}));
|
|
1207
1319
|
}
|
|
1208
|
-
function
|
|
1209
|
-
return
|
|
1320
|
+
function Mn(e) {
|
|
1321
|
+
return jn(e).map((e) => ({
|
|
1210
1322
|
kind: "diff",
|
|
1211
|
-
fileName:
|
|
1323
|
+
fileName: bn(e.filePath),
|
|
1212
1324
|
filePath: e.filePath,
|
|
1213
1325
|
additions: e.additions,
|
|
1214
1326
|
deletions: e.deletions
|
|
1215
1327
|
}));
|
|
1216
1328
|
}
|
|
1217
|
-
function
|
|
1218
|
-
return
|
|
1329
|
+
function Nn(e) {
|
|
1330
|
+
return jn(e).map((e) => e.filePath);
|
|
1219
1331
|
}
|
|
1220
|
-
var
|
|
1332
|
+
var Pn = (e) => Sn(e) || e.startsWith("diff --git "), Fn = (e) => e.startsWith(" ") || e.startsWith("+") || e.startsWith("-") ? !1 : e.trim() !== "", In = (e, t, n) => {
|
|
1221
1333
|
if (e.startsWith(" ")) {
|
|
1222
1334
|
let r = e.slice(1);
|
|
1223
1335
|
t.push(r), n.push(r);
|
|
@@ -1228,26 +1340,26 @@ var _n = (e) => an(e) || e.startsWith("diff --git "), vn = (e) => e.startsWith("
|
|
|
1228
1340
|
return;
|
|
1229
1341
|
}
|
|
1230
1342
|
e.startsWith("+") && n.push(e.slice(1));
|
|
1231
|
-
},
|
|
1343
|
+
}, Ln = (e, t, n, r) => {
|
|
1232
1344
|
let i = t;
|
|
1233
1345
|
for (; i < e.length;) {
|
|
1234
1346
|
let t = e[i] || "";
|
|
1235
|
-
if (
|
|
1236
|
-
|
|
1347
|
+
if (Pn(t) || wn(t) || Fn(t)) break;
|
|
1348
|
+
In(t, n, r), i += 1;
|
|
1237
1349
|
}
|
|
1238
1350
|
return (n.length > 0 || r.length > 0) && (n.push(""), r.push("")), i;
|
|
1239
|
-
},
|
|
1240
|
-
let n =
|
|
1241
|
-
if (!
|
|
1242
|
-
let i =
|
|
1351
|
+
}, Rn = (e, t) => {
|
|
1352
|
+
let n = xn((e[t] || "").slice(4)), r = e[t + 1] || "";
|
|
1353
|
+
if (!Cn(r)) return { nextIndex: t + 1 };
|
|
1354
|
+
let i = xn(r.slice(4)) ?? n ?? "", a = [], o = [], s = t + 2;
|
|
1243
1355
|
for (; s < e.length;) {
|
|
1244
1356
|
let t = e[s] || "";
|
|
1245
|
-
if (
|
|
1246
|
-
if (!
|
|
1357
|
+
if (Pn(t)) break;
|
|
1358
|
+
if (!wn(t)) {
|
|
1247
1359
|
s += 1;
|
|
1248
1360
|
continue;
|
|
1249
1361
|
}
|
|
1250
|
-
s =
|
|
1362
|
+
s = Ln(e, s + 1, a, o);
|
|
1251
1363
|
}
|
|
1252
1364
|
return {
|
|
1253
1365
|
nextIndex: s,
|
|
@@ -1258,22 +1370,22 @@ var _n = (e) => an(e) || e.startsWith("diff --git "), vn = (e) => e.startsWith("
|
|
|
1258
1370
|
}
|
|
1259
1371
|
};
|
|
1260
1372
|
};
|
|
1261
|
-
function
|
|
1373
|
+
function zn(e) {
|
|
1262
1374
|
if (!e || typeof e != "string") return [];
|
|
1263
1375
|
let t = e.split(/\r?\n/), n = [], r = 0;
|
|
1264
1376
|
for (; r < t.length;) {
|
|
1265
|
-
if (!
|
|
1377
|
+
if (!Sn(t[r] || "")) {
|
|
1266
1378
|
r += 1;
|
|
1267
1379
|
continue;
|
|
1268
1380
|
}
|
|
1269
|
-
let { nextIndex: e, preview: i } =
|
|
1381
|
+
let { nextIndex: e, preview: i } = Rn(t, r);
|
|
1270
1382
|
i && n.push(i), r = Math.max(e, r + 1);
|
|
1271
1383
|
}
|
|
1272
1384
|
return n;
|
|
1273
1385
|
}
|
|
1274
1386
|
//#endregion
|
|
1275
1387
|
//#region src/components/chat-ui/tool-rendering/shared.ts
|
|
1276
|
-
var
|
|
1388
|
+
var Bn = {
|
|
1277
1389
|
apply_patch: "Apply patch",
|
|
1278
1390
|
bash: "Run command",
|
|
1279
1391
|
edit: "Edit file",
|
|
@@ -1282,34 +1394,34 @@ var Cn = {
|
|
|
1282
1394
|
read: "Read file",
|
|
1283
1395
|
skill: "Load skill",
|
|
1284
1396
|
todowrite: "Update todos"
|
|
1285
|
-
},
|
|
1397
|
+
}, Vn = {
|
|
1286
1398
|
error: "failed",
|
|
1287
1399
|
"output-error": "failed",
|
|
1288
1400
|
input_streaming: "running",
|
|
1289
1401
|
running: "running",
|
|
1290
1402
|
completed: "completed",
|
|
1291
1403
|
failed: "failed"
|
|
1292
|
-
},
|
|
1293
|
-
let t =
|
|
1294
|
-
return
|
|
1295
|
-
},
|
|
1404
|
+
}, Hn = (e) => e.replace(/^tool-/, "").toLowerCase(), Un = (e) => e.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), Wn = (e) => Hn(e.tool ?? "tool"), Gn = (e) => {
|
|
1405
|
+
let t = Hn(e);
|
|
1406
|
+
return Bn[t] ?? Un(t.replace(/_/g, " "));
|
|
1407
|
+
}, Kn = (e) => {
|
|
1296
1408
|
let t = e.state?.status ?? e.status;
|
|
1297
1409
|
if (!t || typeof t != "string") return null;
|
|
1298
1410
|
let n = t.replace(/-/g, "_");
|
|
1299
|
-
return
|
|
1300
|
-
},
|
|
1411
|
+
return Vn[n] ? Vn[n] : n.includes("stream") ? "running" : null;
|
|
1412
|
+
}, qn = (e) => {
|
|
1301
1413
|
let t = e.state?.status ?? e.status;
|
|
1302
1414
|
return t === "error" || t === "output-error" || t === "failed";
|
|
1303
|
-
},
|
|
1415
|
+
}, Jn = (e) => qn(e) ? {
|
|
1304
1416
|
type: "icon",
|
|
1305
1417
|
icon: "danger"
|
|
1306
1418
|
} : {
|
|
1307
1419
|
type: "icon",
|
|
1308
|
-
icon:
|
|
1309
|
-
},
|
|
1420
|
+
icon: yn(Wn(e))
|
|
1421
|
+
}, Yn = (e, t, n, r) => {
|
|
1310
1422
|
let i = [{
|
|
1311
1423
|
kind: "text",
|
|
1312
|
-
text: n ??
|
|
1424
|
+
text: n ?? Gn(e.tool ?? "tool"),
|
|
1313
1425
|
bold: !0
|
|
1314
1426
|
}];
|
|
1315
1427
|
t && i.push({
|
|
@@ -1321,100 +1433,100 @@ var Cn = {
|
|
|
1321
1433
|
monospace: !0
|
|
1322
1434
|
} : {}
|
|
1323
1435
|
});
|
|
1324
|
-
let a =
|
|
1436
|
+
let a = Kn(e);
|
|
1325
1437
|
return a && a !== "completed" && i.push({
|
|
1326
1438
|
kind: "text",
|
|
1327
1439
|
text: a,
|
|
1328
1440
|
muted: !0
|
|
1329
1441
|
}), i;
|
|
1330
|
-
},
|
|
1442
|
+
}, Xn = (e) => {
|
|
1331
1443
|
let t = e.state?.input;
|
|
1332
1444
|
return !t || typeof t != "object" || Array.isArray(t) ? null : t;
|
|
1333
|
-
},
|
|
1445
|
+
}, Zn = (e) => {
|
|
1334
1446
|
let t = e.state?.output;
|
|
1335
1447
|
return !t || typeof t != "object" || Array.isArray(t) ? null : t;
|
|
1336
|
-
}, Q = (e) => typeof e == "string" && e.trim().length > 0 ? e : null,
|
|
1337
|
-
let n =
|
|
1338
|
-
return n ?
|
|
1339
|
-
},
|
|
1340
|
-
let t =
|
|
1341
|
-
return [
|
|
1342
|
-
},
|
|
1343
|
-
let t =
|
|
1448
|
+
}, Q = (e) => typeof e == "string" && e.trim().length > 0 ? e : null, Qn = (e) => !e || typeof e != "object" || Array.isArray(e) ? null : e, $n = (e, t) => {
|
|
1449
|
+
let n = Qn(e.state);
|
|
1450
|
+
return n ? Qn(n[t]) : null;
|
|
1451
|
+
}, er = (e) => e.replace(/\\/g, "/").replace(/^\/+/, ""), tr = (e) => e.includes("--- ") && e.includes("+++ ") && e.includes("@@"), nr = (e) => {
|
|
1452
|
+
let t = Zn(e);
|
|
1453
|
+
return [$n(e, "metadata"), Qn(t?.metadata)].filter(Boolean);
|
|
1454
|
+
}, rr = (e) => {
|
|
1455
|
+
let t = Qn(e);
|
|
1344
1456
|
if (!t) return null;
|
|
1345
1457
|
let n = Q(t.filePath) ?? Q(t.relativePath) ?? Q(t.path);
|
|
1346
1458
|
return n ? {
|
|
1347
|
-
filePath:
|
|
1459
|
+
filePath: er(n),
|
|
1348
1460
|
additions: typeof t.additions == "number" ? t.additions : 0,
|
|
1349
1461
|
deletions: typeof t.deletions == "number" ? t.deletions : 0,
|
|
1350
1462
|
diff: Q(t.diff) ?? void 0,
|
|
1351
1463
|
before: Q(t.before) ?? void 0,
|
|
1352
1464
|
after: Q(t.after) ?? void 0
|
|
1353
1465
|
} : null;
|
|
1354
|
-
},
|
|
1466
|
+
}, ir = (e) => {
|
|
1355
1467
|
let t = [];
|
|
1356
|
-
for (let n of
|
|
1468
|
+
for (let n of nr(e)) {
|
|
1357
1469
|
let e = Array.isArray(n.files) ? n.files : [];
|
|
1358
1470
|
for (let n of e) {
|
|
1359
|
-
let e =
|
|
1471
|
+
let e = rr(n);
|
|
1360
1472
|
e && t.push(e);
|
|
1361
1473
|
}
|
|
1362
1474
|
}
|
|
1363
1475
|
return t;
|
|
1364
|
-
},
|
|
1365
|
-
let t =
|
|
1476
|
+
}, ar = (e) => {
|
|
1477
|
+
let t = Xn(e), n = (Array.isArray(t?.changes) ? t.changes : []).map((e) => Q(Qn(e)?.path)).filter((e) => !!e).map(er);
|
|
1366
1478
|
return Array.from(new Set(n));
|
|
1367
|
-
},
|
|
1368
|
-
let t =
|
|
1479
|
+
}, or = (e) => {
|
|
1480
|
+
let t = Xn(e), n = Q(t?.diff);
|
|
1369
1481
|
if (n) return n;
|
|
1370
|
-
for (let t of
|
|
1482
|
+
for (let t of nr(e)) {
|
|
1371
1483
|
let e = Q(t.diff);
|
|
1372
1484
|
if (e) return e;
|
|
1373
1485
|
}
|
|
1374
|
-
let r =
|
|
1486
|
+
let r = ir(e).map((e) => e.diff).filter((e) => !!e);
|
|
1375
1487
|
if (r.length > 0) return r.join("\n");
|
|
1376
1488
|
let i = Q(t?.patchText);
|
|
1377
|
-
return i &&
|
|
1378
|
-
},
|
|
1489
|
+
return i && tr(i) ? i : null;
|
|
1490
|
+
}, sr = (e) => {
|
|
1379
1491
|
let t = /* @__PURE__ */ new Set(), n = [];
|
|
1380
1492
|
for (let r of e) t.has(r.filePath) || (t.add(r.filePath), n.push({
|
|
1381
1493
|
kind: "diff",
|
|
1382
|
-
fileName:
|
|
1494
|
+
fileName: bn(r.filePath),
|
|
1383
1495
|
filePath: r.filePath,
|
|
1384
1496
|
additions: r.additions,
|
|
1385
1497
|
deletions: r.deletions
|
|
1386
1498
|
}));
|
|
1387
1499
|
return n;
|
|
1388
|
-
},
|
|
1389
|
-
let t =
|
|
1500
|
+
}, cr = (e) => Array.from(new Set(e.map((e) => e.filePath))), lr = (e) => {
|
|
1501
|
+
let t = Zn(e);
|
|
1390
1502
|
return Q(e.state?.output) ?? Q(t?.returnDisplay) ?? Q(t?.preview) ?? Q(t?.stdout) ?? Q(t?.content);
|
|
1391
|
-
},
|
|
1503
|
+
}, ur = (e) => {
|
|
1392
1504
|
let t = e.match(/<skill_content(?:\s+name="([^"]+)")?>([\s\S]*?)<\/skill_content>/);
|
|
1393
1505
|
return t ? {
|
|
1394
1506
|
skillName: Q(t[1]) ?? void 0,
|
|
1395
1507
|
content: Q(t[2]) ?? ""
|
|
1396
1508
|
} : null;
|
|
1397
|
-
},
|
|
1398
|
-
let t =
|
|
1509
|
+
}, dr = (e) => {
|
|
1510
|
+
let t = Xn(e);
|
|
1399
1511
|
return Q(t?.name) ?? Q(t?.skillName) ?? Q(t?.skill) ?? Q(t?.skill_name) ?? void 0;
|
|
1400
|
-
},
|
|
1512
|
+
}, fr = (e, t) => ({
|
|
1401
1513
|
kind: "link",
|
|
1402
|
-
text:
|
|
1514
|
+
text: bn(e),
|
|
1403
1515
|
filePath: e,
|
|
1404
1516
|
...t ? { variant: t } : {}
|
|
1405
|
-
}),
|
|
1517
|
+
}), pr = (e, t) => !qn(e) || !e.state?.errorText ? t : [{
|
|
1406
1518
|
type: "comment",
|
|
1407
1519
|
text: e.state.errorText
|
|
1408
|
-
}, ...t],
|
|
1520
|
+
}, ...t], mr = (e) => zn(e ?? void 0).map((e) => ({
|
|
1409
1521
|
type: "diff",
|
|
1410
1522
|
language: "diff",
|
|
1411
1523
|
original: e.original,
|
|
1412
1524
|
modified: e.modified,
|
|
1413
1525
|
sideBySide: !1
|
|
1414
|
-
})),
|
|
1415
|
-
let t =
|
|
1416
|
-
a.length > 0 ? i.push(...a) : n.length > 0 ? i.push(...
|
|
1417
|
-
let o = [...
|
|
1526
|
+
})), hr = (e) => Mn(e ?? void 0), gr = (e) => Nn(e ?? void 0), _r = (e) => {
|
|
1527
|
+
let t = or(e), n = ir(e), r = ar(e), i = Yn(e, void 0, "Apply patch"), a = hr(t);
|
|
1528
|
+
a.length > 0 ? i.push(...a) : n.length > 0 ? i.push(...sr(n)) : i.push(...r.map((e) => fr(e, "bubble")));
|
|
1529
|
+
let o = [...mr(t)];
|
|
1418
1530
|
if (o.length === 0) for (let e of n) (e.before || e.after) && o.push({
|
|
1419
1531
|
type: "diff",
|
|
1420
1532
|
language: "diff",
|
|
@@ -1423,36 +1535,36 @@ var Cn = {
|
|
|
1423
1535
|
sideBySide: !1
|
|
1424
1536
|
});
|
|
1425
1537
|
if (o.length === 0) {
|
|
1426
|
-
let e =
|
|
1427
|
-
e.length === 0 && e.push(...
|
|
1538
|
+
let e = gr(t);
|
|
1539
|
+
e.length === 0 && e.push(...cr(n)), e.length === 0 && e.push(...r), e.length > 0 && o.push({
|
|
1428
1540
|
type: "references",
|
|
1429
1541
|
references: e
|
|
1430
1542
|
});
|
|
1431
1543
|
}
|
|
1432
1544
|
return {
|
|
1433
|
-
indicator:
|
|
1545
|
+
indicator: Jn(e),
|
|
1434
1546
|
title: i,
|
|
1435
|
-
blocks:
|
|
1547
|
+
blocks: pr(e, o)
|
|
1436
1548
|
};
|
|
1437
|
-
},
|
|
1549
|
+
}, vr = (e, t) => [{
|
|
1438
1550
|
type: "diff",
|
|
1439
1551
|
language: "text",
|
|
1440
1552
|
original: e,
|
|
1441
1553
|
modified: t,
|
|
1442
1554
|
sideBySide: !1
|
|
1443
|
-
}],
|
|
1444
|
-
let t =
|
|
1445
|
-
r && o.push(
|
|
1446
|
-
let s = i !== void 0 && a !== void 0 ?
|
|
1555
|
+
}], yr = (e) => {
|
|
1556
|
+
let t = Xn(e), n = Zn(e), r = Q(t?.filePath) ?? Q(t?.file_path) ?? Q(n?.filePath) ?? void 0, i = Q(n?.oldString) ?? Q(t?.old_string) ?? void 0, a = Q(n?.newString) ?? Q(t?.new_string) ?? void 0, o = Yn(e, void 0, "Edit file");
|
|
1557
|
+
r && o.push(fr(r));
|
|
1558
|
+
let s = i !== void 0 && a !== void 0 ? vr(i, a) : mr(Q(n?.diff));
|
|
1447
1559
|
return {
|
|
1448
|
-
indicator:
|
|
1560
|
+
indicator: Jn(e),
|
|
1449
1561
|
title: o,
|
|
1450
|
-
blocks:
|
|
1562
|
+
blocks: pr(e, s)
|
|
1451
1563
|
};
|
|
1452
|
-
},
|
|
1564
|
+
}, br = (e) => {
|
|
1453
1565
|
let { buildBaseTitle: t, buildIndicator: n, prependErrorBlock: r } = e;
|
|
1454
1566
|
return (e) => {
|
|
1455
|
-
let i =
|
|
1567
|
+
let i = Yt(e.state?.output) || Yt(e.state?.metadata), a = Qt(e.state?.input), o = a ? {
|
|
1456
1568
|
type: "question-form",
|
|
1457
1569
|
questions: a.questions
|
|
1458
1570
|
} : null;
|
|
@@ -1465,15 +1577,15 @@ var Cn = {
|
|
|
1465
1577
|
expandable: !1
|
|
1466
1578
|
};
|
|
1467
1579
|
};
|
|
1468
|
-
},
|
|
1469
|
-
let t =
|
|
1470
|
-
return r && i.push(
|
|
1471
|
-
indicator:
|
|
1580
|
+
}, xr = (e) => {
|
|
1581
|
+
let t = Xn(e), n = Zn(e), r = Q(t?.filePath) ?? Q(t?.file_path) ?? Q(t?.file) ?? Q(n?.filePath) ?? Q(n?.file) ?? Q(n?.path) ?? void 0, i = Yn(e, void 0, "Read file");
|
|
1582
|
+
return r && i.push(fr(r)), {
|
|
1583
|
+
indicator: Jn(e),
|
|
1472
1584
|
title: i,
|
|
1473
|
-
blocks:
|
|
1585
|
+
blocks: pr(e, [])
|
|
1474
1586
|
};
|
|
1475
|
-
},
|
|
1476
|
-
let n =
|
|
1587
|
+
}, Sr = (e, t) => {
|
|
1588
|
+
let n = Xn(e), r = Zn(e), i = Yn(e, Q(n?.command) ?? void 0, t, "monospace"), a = [], o = lr(e);
|
|
1477
1589
|
o && a.push({
|
|
1478
1590
|
type: "code",
|
|
1479
1591
|
language: "text",
|
|
@@ -1488,23 +1600,23 @@ var Cn = {
|
|
|
1488
1600
|
type: "text",
|
|
1489
1601
|
text: `Exit code: ${r.exitCode}`
|
|
1490
1602
|
}), {
|
|
1491
|
-
indicator:
|
|
1603
|
+
indicator: Jn(e),
|
|
1492
1604
|
title: i,
|
|
1493
|
-
blocks:
|
|
1605
|
+
blocks: pr(e, a)
|
|
1494
1606
|
};
|
|
1495
|
-
},
|
|
1496
|
-
let t =
|
|
1607
|
+
}, Cr = (e) => Sr(e, "Run command"), wr = (e) => Sr(e, "Shell"), Tr = (e) => {
|
|
1608
|
+
let t = Xn(e), n = lr(e), r = Yn(e, Q(t?.pattern) ?? void 0, "Search files"), i = n ? [{
|
|
1497
1609
|
type: "code",
|
|
1498
1610
|
language: "text",
|
|
1499
1611
|
code: n
|
|
1500
1612
|
}] : [];
|
|
1501
1613
|
return {
|
|
1502
|
-
indicator:
|
|
1614
|
+
indicator: Jn(e),
|
|
1503
1615
|
title: r,
|
|
1504
|
-
blocks:
|
|
1616
|
+
blocks: pr(e, i)
|
|
1505
1617
|
};
|
|
1506
|
-
},
|
|
1507
|
-
let t =
|
|
1618
|
+
}, Er = (e) => {
|
|
1619
|
+
let t = Xn(e), n = lr(e), r = Yn(e, Q(t?.pattern) ?? void 0, "Find files"), i = [];
|
|
1508
1620
|
if (n) {
|
|
1509
1621
|
let e = n.split(/\r?\n/).map((e) => e.trim()).filter((e) => e.length > 0);
|
|
1510
1622
|
e.length > 0 && i.push({
|
|
@@ -1513,50 +1625,50 @@ var Cn = {
|
|
|
1513
1625
|
});
|
|
1514
1626
|
}
|
|
1515
1627
|
return {
|
|
1516
|
-
indicator:
|
|
1628
|
+
indicator: Jn(e),
|
|
1517
1629
|
title: r,
|
|
1518
|
-
blocks:
|
|
1630
|
+
blocks: pr(e, i)
|
|
1519
1631
|
};
|
|
1520
|
-
},
|
|
1521
|
-
let t =
|
|
1632
|
+
}, Dr = (e) => {
|
|
1633
|
+
let t = lr(e), n = t ? ur(t) : null, r = Yn(e, dr(e) ?? n?.skillName, "Load skill"), i = n?.content ?? t, a = i ? [{
|
|
1522
1634
|
type: "code",
|
|
1523
1635
|
language: "markdown",
|
|
1524
1636
|
code: i
|
|
1525
1637
|
}] : [];
|
|
1526
1638
|
return {
|
|
1527
|
-
indicator:
|
|
1639
|
+
indicator: Jn(e),
|
|
1528
1640
|
title: r,
|
|
1529
|
-
blocks:
|
|
1641
|
+
blocks: pr(e, a)
|
|
1530
1642
|
};
|
|
1531
|
-
},
|
|
1532
|
-
let t =
|
|
1643
|
+
}, Or = (e) => typeof e == "string" && e.trim().length > 0 ? e : null, kr = (e) => !e || typeof e != "object" || Array.isArray(e) ? null : e, Ar = (e) => {
|
|
1644
|
+
let t = kr(e);
|
|
1533
1645
|
if (!t) return null;
|
|
1534
|
-
let n =
|
|
1646
|
+
let n = Or(t.content) ?? Or(t.title);
|
|
1535
1647
|
return n ? {
|
|
1536
1648
|
label: n,
|
|
1537
|
-
checked:
|
|
1649
|
+
checked: Or(t.status) === "completed"
|
|
1538
1650
|
} : null;
|
|
1539
|
-
},
|
|
1651
|
+
}, jr = (e) => {
|
|
1540
1652
|
if (!e) return {
|
|
1541
1653
|
items: [],
|
|
1542
1654
|
explicit: !1
|
|
1543
1655
|
};
|
|
1544
1656
|
let t = (() => {
|
|
1545
1657
|
if (Array.isArray(e)) return e;
|
|
1546
|
-
let t =
|
|
1658
|
+
let t = kr(e);
|
|
1547
1659
|
return !t || !Array.isArray(t.todos) ? null : t.todos;
|
|
1548
1660
|
})();
|
|
1549
1661
|
return t ? {
|
|
1550
|
-
items: t.map(
|
|
1662
|
+
items: t.map(Ar).filter((e) => e !== null),
|
|
1551
1663
|
explicit: !0
|
|
1552
1664
|
} : {
|
|
1553
1665
|
items: [],
|
|
1554
1666
|
explicit: !1
|
|
1555
1667
|
};
|
|
1556
|
-
},
|
|
1668
|
+
}, Mr = (e) => {
|
|
1557
1669
|
let { buildBaseTitle: t, buildIndicator: n, prependErrorBlock: r } = e;
|
|
1558
1670
|
return (e) => {
|
|
1559
|
-
let i =
|
|
1671
|
+
let i = jr(e.state?.input), a = jr(e.state?.output), o = a.explicit ? a : i;
|
|
1560
1672
|
if (!o.explicit) return null;
|
|
1561
1673
|
let s = o.items, c = `${s.length} item${s.length === 1 ? "" : "s"}`, l = t(e, c, "Update todos");
|
|
1562
1674
|
if (s.length === 0) return {
|
|
@@ -1577,37 +1689,37 @@ var Cn = {
|
|
|
1577
1689
|
blocks: r(e, u)
|
|
1578
1690
|
};
|
|
1579
1691
|
};
|
|
1580
|
-
},
|
|
1581
|
-
buildBaseTitle:
|
|
1582
|
-
buildIndicator:
|
|
1583
|
-
prependErrorBlock:
|
|
1584
|
-
}),
|
|
1585
|
-
buildBaseTitle:
|
|
1586
|
-
buildIndicator:
|
|
1587
|
-
prependErrorBlock:
|
|
1588
|
-
}),
|
|
1589
|
-
apply_patch:
|
|
1590
|
-
bash:
|
|
1591
|
-
edit:
|
|
1592
|
-
glob:
|
|
1593
|
-
grep:
|
|
1594
|
-
question:
|
|
1595
|
-
read:
|
|
1596
|
-
shell:
|
|
1597
|
-
skill:
|
|
1598
|
-
todo_write:
|
|
1599
|
-
todowrite:
|
|
1600
|
-
}),
|
|
1692
|
+
}, Nr = br({
|
|
1693
|
+
buildBaseTitle: Yn,
|
|
1694
|
+
buildIndicator: Jn,
|
|
1695
|
+
prependErrorBlock: pr
|
|
1696
|
+
}), Pr = Mr({
|
|
1697
|
+
buildBaseTitle: Yn,
|
|
1698
|
+
buildIndicator: Jn,
|
|
1699
|
+
prependErrorBlock: pr
|
|
1700
|
+
}), Fr = () => ({
|
|
1701
|
+
apply_patch: _r,
|
|
1702
|
+
bash: Cr,
|
|
1703
|
+
edit: yr,
|
|
1704
|
+
glob: Er,
|
|
1705
|
+
grep: Tr,
|
|
1706
|
+
question: Nr,
|
|
1707
|
+
read: xr,
|
|
1708
|
+
shell: wr,
|
|
1709
|
+
skill: Dr,
|
|
1710
|
+
todo_write: Pr,
|
|
1711
|
+
todowrite: Pr
|
|
1712
|
+
}), Ir = {
|
|
1601
1713
|
error: "failed",
|
|
1602
1714
|
"output-error": "failed",
|
|
1603
1715
|
"input-streaming": "running"
|
|
1604
|
-
},
|
|
1716
|
+
}, Lr = (e) => e.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), Rr = (e) => Lr(fn(e ?? "tool").replace(/_/g, " ")), zr = (e) => e === "error" || e === "output-error", Br = (e) => zr(e.state?.status) ? {
|
|
1605
1717
|
type: "icon",
|
|
1606
1718
|
icon: "danger"
|
|
1607
1719
|
} : {
|
|
1608
1720
|
type: "icon",
|
|
1609
|
-
icon:
|
|
1610
|
-
},
|
|
1721
|
+
icon: yn(e.tool ?? "tool")
|
|
1722
|
+
}, Vr = (e) => !e || typeof e != "string" ? null : Ir[e] ? Ir[e] : e.includes("stream") ? "running" : null, Hr = (e) => {
|
|
1611
1723
|
if (typeof e == "string") return e;
|
|
1612
1724
|
if (e == null) return null;
|
|
1613
1725
|
try {
|
|
@@ -1615,30 +1727,30 @@ var Cn = {
|
|
|
1615
1727
|
} catch {
|
|
1616
1728
|
return null;
|
|
1617
1729
|
}
|
|
1618
|
-
},
|
|
1619
|
-
let n =
|
|
1730
|
+
}, Ur = (e) => e == null ? !0 : typeof e == "string" ? e.trim().length === 0 : Array.isArray(e) ? e.length === 0 || e.every(Ur) : typeof e == "object" && Object.values(e).every(Ur), Wr = (e) => !e || typeof e != "object" || Array.isArray(e) ? null : e, $ = (e) => typeof e == "string" && e.trim().length > 0 ? e : null, Gr = (e) => $(e.mime_type) ?? $(e.mediaType) ?? $(e.mimeType), Kr = (e) => !!e?.startsWith("image/"), qr = /\.(avif|bmp|gif|jpe?g|png|svg|webp)(\?.*)?$/i, Jr = (e, t) => {
|
|
1731
|
+
let n = Wr(e);
|
|
1620
1732
|
if (!n) return null;
|
|
1621
|
-
let r =
|
|
1622
|
-
if (i &&
|
|
1733
|
+
let r = Gr(n), i = $(n.data);
|
|
1734
|
+
if (i && Kr(r)) return {
|
|
1623
1735
|
type: "image",
|
|
1624
1736
|
src: `data:${r};base64,${i}`,
|
|
1625
1737
|
alt: t
|
|
1626
1738
|
};
|
|
1627
1739
|
let a = $(n.url) ?? $(n.src);
|
|
1628
|
-
return a && (
|
|
1740
|
+
return a && (Kr(r) || qr.test(a)) ? {
|
|
1629
1741
|
type: "image",
|
|
1630
1742
|
src: a,
|
|
1631
1743
|
alt: t
|
|
1632
1744
|
} : null;
|
|
1633
|
-
},
|
|
1634
|
-
let t =
|
|
1745
|
+
}, Yr = (e) => {
|
|
1746
|
+
let t = Wr(e);
|
|
1635
1747
|
if (!t) return null;
|
|
1636
1748
|
let n = $(t.path) ?? $(t.filePath) ?? $(t.filename), r = $(t.content) ?? $(t.body) ?? $(t.text);
|
|
1637
1749
|
return !n || r === null ? null : {
|
|
1638
1750
|
filePath: n,
|
|
1639
1751
|
content: r
|
|
1640
1752
|
};
|
|
1641
|
-
},
|
|
1753
|
+
}, Xr = {
|
|
1642
1754
|
css: "css",
|
|
1643
1755
|
html: "html",
|
|
1644
1756
|
js: "js",
|
|
@@ -1650,18 +1762,18 @@ var Cn = {
|
|
|
1650
1762
|
tsx: "tsx",
|
|
1651
1763
|
yaml: "yaml",
|
|
1652
1764
|
yml: "yaml"
|
|
1653
|
-
},
|
|
1765
|
+
}, Zr = (e) => {
|
|
1654
1766
|
let t = e.split(".").pop()?.toLowerCase();
|
|
1655
|
-
return t ?
|
|
1656
|
-
},
|
|
1767
|
+
return t ? Xr[t] ?? t : "text";
|
|
1768
|
+
}, Qr = (e, t) => t.length === 0 ? [] : [{
|
|
1657
1769
|
type: "text",
|
|
1658
1770
|
text: e
|
|
1659
|
-
}, ...t],
|
|
1771
|
+
}, ...t], $r = (e, t) => {
|
|
1660
1772
|
let n = [];
|
|
1661
1773
|
for (let r of e) {
|
|
1662
|
-
let e =
|
|
1774
|
+
let e = Wr(r), i = $(e?.type);
|
|
1663
1775
|
if (i === "image") {
|
|
1664
|
-
let e =
|
|
1776
|
+
let e = Jr(r, t);
|
|
1665
1777
|
e && n.push(e);
|
|
1666
1778
|
continue;
|
|
1667
1779
|
}
|
|
@@ -1673,65 +1785,65 @@ var Cn = {
|
|
|
1673
1785
|
});
|
|
1674
1786
|
continue;
|
|
1675
1787
|
}
|
|
1676
|
-
n.push(...
|
|
1788
|
+
n.push(...ni(r, t));
|
|
1677
1789
|
}
|
|
1678
1790
|
return n;
|
|
1679
|
-
},
|
|
1680
|
-
let t =
|
|
1791
|
+
}, ei = (e) => {
|
|
1792
|
+
let t = Yr(e);
|
|
1681
1793
|
return t ? [{
|
|
1682
1794
|
type: "code",
|
|
1683
|
-
language:
|
|
1795
|
+
language: Zr(t.filePath),
|
|
1684
1796
|
code: t.content
|
|
1685
1797
|
}] : null;
|
|
1686
|
-
},
|
|
1687
|
-
let t =
|
|
1798
|
+
}, ti = (e) => {
|
|
1799
|
+
let t = Wr(e), n = $(t?.attachment_name) ?? $(t?.attachmentName), r = $(t?.attachment_file_id) ?? $(t?.attachmentFileId);
|
|
1688
1800
|
return !n && !r ? null : [{
|
|
1689
1801
|
type: "text",
|
|
1690
1802
|
text: n ?? `Attachment ${r}`
|
|
1691
1803
|
}];
|
|
1692
|
-
},
|
|
1693
|
-
if (
|
|
1694
|
-
let n =
|
|
1804
|
+
}, ni = (e, t) => {
|
|
1805
|
+
if (Ur(e)) return [];
|
|
1806
|
+
let n = Jr(e, t);
|
|
1695
1807
|
if (n) return [n];
|
|
1696
|
-
if (Array.isArray(e)) return
|
|
1697
|
-
let r =
|
|
1808
|
+
if (Array.isArray(e)) return $r(e, t);
|
|
1809
|
+
let r = ei(e);
|
|
1698
1810
|
if (r) return r;
|
|
1699
|
-
let i =
|
|
1811
|
+
let i = ti(e);
|
|
1700
1812
|
if (i) return i;
|
|
1701
|
-
let a =
|
|
1813
|
+
let a = Hr(e);
|
|
1702
1814
|
return a?.trim() ? [{
|
|
1703
1815
|
type: "code",
|
|
1704
1816
|
language: typeof e == "string" ? "text" : "json",
|
|
1705
1817
|
code: a
|
|
1706
1818
|
}] : [];
|
|
1707
|
-
},
|
|
1708
|
-
let t = [], n =
|
|
1709
|
-
return
|
|
1819
|
+
}, ri = (e) => {
|
|
1820
|
+
let t = [], n = Rr(e.tool);
|
|
1821
|
+
return zr(e.state?.status) && e.state?.errorText && t.push({
|
|
1710
1822
|
type: "comment",
|
|
1711
1823
|
text: e.state.errorText
|
|
1712
|
-
}), t.push(...
|
|
1713
|
-
},
|
|
1824
|
+
}), t.push(...Qr("Input", ni(e.state?.input, `${n} input`))), t.push(...Qr("Output", ni(e.state?.output, `${n} output`))), t;
|
|
1825
|
+
}, ii = (e) => {
|
|
1714
1826
|
let t = [{
|
|
1715
1827
|
kind: "text",
|
|
1716
|
-
text:
|
|
1828
|
+
text: Rr(e.tool),
|
|
1717
1829
|
bold: !0
|
|
1718
|
-
}], n =
|
|
1830
|
+
}], n = Yr(e.state?.output);
|
|
1719
1831
|
n && t.push({
|
|
1720
1832
|
kind: "link",
|
|
1721
1833
|
text: n.filePath,
|
|
1722
1834
|
filePath: n.filePath
|
|
1723
1835
|
});
|
|
1724
|
-
let r =
|
|
1836
|
+
let r = Vr(e.state?.status);
|
|
1725
1837
|
return r && t.push({
|
|
1726
1838
|
kind: "text",
|
|
1727
1839
|
text: r,
|
|
1728
1840
|
muted: !0
|
|
1729
1841
|
}), {
|
|
1730
|
-
indicator:
|
|
1842
|
+
indicator: Br(e),
|
|
1731
1843
|
title: t,
|
|
1732
|
-
blocks:
|
|
1844
|
+
blocks: ri(e)
|
|
1733
1845
|
};
|
|
1734
|
-
},
|
|
1846
|
+
}, ai = (e) => e.kind === "text" || e.kind === "link" ? e.text.trim().length > 0 : e.kind !== "diff" || e.fileName.trim().length > 0, oi = (e) => {
|
|
1735
1847
|
switch (e.type) {
|
|
1736
1848
|
case "comment":
|
|
1737
1849
|
case "code":
|
|
@@ -1744,38 +1856,38 @@ var Cn = {
|
|
|
1744
1856
|
case "input":
|
|
1745
1857
|
case "component": return !0;
|
|
1746
1858
|
}
|
|
1747
|
-
},
|
|
1748
|
-
let t = e.title.some(
|
|
1859
|
+
}, si = (e) => {
|
|
1860
|
+
let t = e.title.some(ai), n = (e.blocks ?? []).some(oi);
|
|
1749
1861
|
return t || n;
|
|
1750
|
-
},
|
|
1751
|
-
...
|
|
1862
|
+
}, ci = (e) => e ? {
|
|
1863
|
+
...Fr(),
|
|
1752
1864
|
...e
|
|
1753
|
-
} :
|
|
1865
|
+
} : Fr(), li = (e, t) => {
|
|
1754
1866
|
let n = e.tool ?? "tool";
|
|
1755
|
-
for (let e of
|
|
1867
|
+
for (let e of pn(n)) {
|
|
1756
1868
|
let n = t[e];
|
|
1757
1869
|
if (n) return n;
|
|
1758
1870
|
}
|
|
1759
|
-
},
|
|
1760
|
-
let r =
|
|
1871
|
+
}, ui = (e, t, n) => {
|
|
1872
|
+
let r = li(e, t);
|
|
1761
1873
|
if (r) {
|
|
1762
1874
|
let t = r(e, n);
|
|
1763
1875
|
if (t) return t;
|
|
1764
1876
|
}
|
|
1765
|
-
return
|
|
1766
|
-
},
|
|
1767
|
-
let n =
|
|
1768
|
-
return { items: e.map((e) =>
|
|
1769
|
-
},
|
|
1877
|
+
return ii(e);
|
|
1878
|
+
}, di = (e, t) => {
|
|
1879
|
+
let n = ci(t?.toolRenderers);
|
|
1880
|
+
return { items: e.map((e) => ui(e, n, t)).filter(si) };
|
|
1881
|
+
}, fi = W(() => import("./diff-editor-CGpeyoCE.js").then((e) => e.n).then((e) => ({ default: e.DiffEditor }))), pi = (e) => {
|
|
1770
1882
|
let t = B(2), n;
|
|
1771
|
-
return t[0] === e ? n = t[1] : (n = /* @__PURE__ */ H(
|
|
1883
|
+
return t[0] === e ? n = t[1] : (n = /* @__PURE__ */ H(te, {
|
|
1772
1884
|
fallback: null,
|
|
1773
|
-
children: /* @__PURE__ */ H(
|
|
1885
|
+
children: /* @__PURE__ */ H(fi, { ...e })
|
|
1774
1886
|
}), t[0] = e, t[1] = n), n;
|
|
1775
|
-
},
|
|
1887
|
+
}, mi = (e, t, n, r = !1) => {
|
|
1776
1888
|
r && e.stopPropagation(), t.href || e.preventDefault(), t.filePath && n?.(t.filePath);
|
|
1777
1889
|
};
|
|
1778
|
-
function
|
|
1890
|
+
function hi(e) {
|
|
1779
1891
|
let t = B(6), { seg: n } = e, r;
|
|
1780
1892
|
t[0] !== n.alt || t[1] !== n.src ? (r = /* @__PURE__ */ H(m.Image, {
|
|
1781
1893
|
src: n.src,
|
|
@@ -1793,7 +1905,7 @@ function Qr(e) {
|
|
|
1793
1905
|
children: [r, i]
|
|
1794
1906
|
}), t[4] = r, t[5] = a), a;
|
|
1795
1907
|
}
|
|
1796
|
-
function
|
|
1908
|
+
function gi(e) {
|
|
1797
1909
|
let t = B(9), { seg: n, onOpenFile: r } = e, i = n.additions ?? 0, a = n.deletions ?? 0, o;
|
|
1798
1910
|
t[0] !== r || t[1] !== n.fileName || t[2] !== n.filePath ? (o = () => {
|
|
1799
1911
|
let e = n.filePath ?? n.fileName;
|
|
@@ -1807,9 +1919,9 @@ function $r(e) {
|
|
|
1807
1919
|
onClickFileLink: o
|
|
1808
1920
|
}), t[4] = n.fileName, t[5] = i, t[6] = a, t[7] = o, t[8] = s) : s = t[8], s;
|
|
1809
1921
|
}
|
|
1810
|
-
function
|
|
1922
|
+
function _i(e) {
|
|
1811
1923
|
let t = B(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;
|
|
1812
|
-
t[0] !== r || t[1] !== n ? (l = (e) =>
|
|
1924
|
+
t[0] !== r || t[1] !== n ? (l = (e) => mi(e, n, r, !0), t[0] = r, t[1] = n, t[2] = l) : l = t[2];
|
|
1813
1925
|
let u = n.muted ? "fg.muted" : "fg.blue-dark", d;
|
|
1814
1926
|
t[3] === u ? d = t[4] : (d = {
|
|
1815
1927
|
textDecoration: "underline",
|
|
@@ -1827,9 +1939,9 @@ function ei(e) {
|
|
|
1827
1939
|
children: n.text
|
|
1828
1940
|
}), 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;
|
|
1829
1941
|
}
|
|
1830
|
-
function
|
|
1942
|
+
function vi(e) {
|
|
1831
1943
|
let t = B(12), { seg: n, onOpenFile: r } = e, i = n.bold ? "medium" : void 0, a = n.href ?? "#", o = n.muted ? "fg.muted" : "accent.primary", s;
|
|
1832
|
-
t[0] !== r || t[1] !== n ? (s = (e) =>
|
|
1944
|
+
t[0] !== r || t[1] !== n ? (s = (e) => mi(e, n, r), t[0] = r, t[1] = n, t[2] = s) : s = t[2];
|
|
1833
1945
|
let c = n.muted ? "fg.muted" : "accent.primary", l;
|
|
1834
1946
|
t[3] === c ? l = t[4] : (l = {
|
|
1835
1947
|
color: c,
|
|
@@ -1846,7 +1958,7 @@ function ti(e) {
|
|
|
1846
1958
|
children: n.text
|
|
1847
1959
|
}), 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;
|
|
1848
1960
|
}
|
|
1849
|
-
function
|
|
1961
|
+
function yi(e) {
|
|
1850
1962
|
let t = B(14), { seg: n, isClickable: i } = e, a = n.bold ? "medium" : void 0, o = n.monospace ? "mono/XS" : void 0, s = n.truncate ? "0" : void 0, c = n.truncate ? "hidden" : void 0, l = n.truncate ? "ellipsis" : void 0, u = n.truncate ? "nowrap" : void 0, d = i && !n.muted ? "fg" : "fg.muted", f;
|
|
1851
1963
|
t[0] === d ? f = t[1] : (f = { color: d }, t[0] = d, t[1] = f);
|
|
1852
1964
|
let p;
|
|
@@ -1869,33 +1981,33 @@ function ni(e) {
|
|
|
1869
1981
|
children: m
|
|
1870
1982
|
}), t[11] = n.text, t[12] = m, t[13] = h) : h = t[13], h;
|
|
1871
1983
|
}
|
|
1872
|
-
function
|
|
1984
|
+
function bi(e) {
|
|
1873
1985
|
let t = B(11), { seg: n, isClickable: r, onOpenFile: i } = e;
|
|
1874
1986
|
switch (n.kind) {
|
|
1875
1987
|
case "avatar": {
|
|
1876
1988
|
let e;
|
|
1877
|
-
return t[0] === n ? e = t[1] : (e = /* @__PURE__ */ H(
|
|
1989
|
+
return t[0] === n ? e = t[1] : (e = /* @__PURE__ */ H(hi, { seg: n }), t[0] = n, t[1] = e), e;
|
|
1878
1990
|
}
|
|
1879
1991
|
case "diff": {
|
|
1880
1992
|
let e;
|
|
1881
|
-
return t[2] !== i || t[3] !== n ? (e = /* @__PURE__ */ H(
|
|
1993
|
+
return t[2] !== i || t[3] !== n ? (e = /* @__PURE__ */ H(gi, {
|
|
1882
1994
|
seg: n,
|
|
1883
1995
|
onOpenFile: i
|
|
1884
1996
|
}), t[2] = i, t[3] = n, t[4] = e) : e = t[4], e;
|
|
1885
1997
|
}
|
|
1886
1998
|
case "link": {
|
|
1887
1999
|
let e;
|
|
1888
|
-
return t[5] !== i || t[6] !== n ? (e = n.variant === "bubble" ? /* @__PURE__ */ H(
|
|
2000
|
+
return t[5] !== i || t[6] !== n ? (e = n.variant === "bubble" ? /* @__PURE__ */ H(_i, {
|
|
1889
2001
|
seg: n,
|
|
1890
2002
|
onOpenFile: i
|
|
1891
|
-
}) : /* @__PURE__ */ H(
|
|
2003
|
+
}) : /* @__PURE__ */ H(vi, {
|
|
1892
2004
|
seg: n,
|
|
1893
2005
|
onOpenFile: i
|
|
1894
2006
|
}), t[5] = i, t[6] = n, t[7] = e) : e = t[7], e;
|
|
1895
2007
|
}
|
|
1896
2008
|
case "text": {
|
|
1897
2009
|
let e;
|
|
1898
|
-
return t[8] !== r || t[9] !== n ? (e = /* @__PURE__ */ H(
|
|
2010
|
+
return t[8] !== r || t[9] !== n ? (e = /* @__PURE__ */ H(yi, {
|
|
1899
2011
|
seg: n,
|
|
1900
2012
|
isClickable: r
|
|
1901
2013
|
}), t[8] = r, t[9] = n, t[10] = e) : e = t[10], e;
|
|
@@ -1905,15 +2017,15 @@ function ri(e) {
|
|
|
1905
2017
|
}
|
|
1906
2018
|
//#endregion
|
|
1907
2019
|
//#region src/components/chat-ui/components/timeline.tsx
|
|
1908
|
-
var
|
|
1909
|
-
function
|
|
2020
|
+
var xi = F;
|
|
2021
|
+
function Si(e) {
|
|
1910
2022
|
let t = B(10), { ind: n } = e;
|
|
1911
2023
|
if (!n || n.type === "none") return null;
|
|
1912
2024
|
if (n.type === "icon") {
|
|
1913
2025
|
let e;
|
|
1914
|
-
t[0] === n.icon ? e = t[1] : (e =
|
|
2026
|
+
t[0] === n.icon ? e = t[1] : (e = vn(n.icon), t[0] = n.icon, t[1] = e);
|
|
1915
2027
|
let r = e, i;
|
|
1916
|
-
return t[2] === r ? i = t[3] : (i = /* @__PURE__ */ H(
|
|
2028
|
+
return t[2] === r ? i = t[3] : (i = /* @__PURE__ */ H(xi.Indicator, {
|
|
1917
2029
|
outline: "none",
|
|
1918
2030
|
border: "none",
|
|
1919
2031
|
background: "bg",
|
|
@@ -1939,12 +2051,12 @@ function ai(e) {
|
|
|
1939
2051
|
color: "fg.muted"
|
|
1940
2052
|
}), t[7] = i) : i = t[7];
|
|
1941
2053
|
let a;
|
|
1942
|
-
return t[8] === r ? a = t[9] : (a = /* @__PURE__ */ H(
|
|
2054
|
+
return t[8] === r ? a = t[9] : (a = /* @__PURE__ */ H(xi.Indicator, { children: /* @__PURE__ */ U(m.Root, {
|
|
1943
2055
|
boxSize: "full",
|
|
1944
2056
|
children: [r, i]
|
|
1945
2057
|
}) }), t[8] = r, t[9] = a), a;
|
|
1946
2058
|
}
|
|
1947
|
-
function
|
|
2059
|
+
function Ci(e) {
|
|
1948
2060
|
let t = B(5), { code: n, language: r } = e, a = r ? `${r} code block` : "code block", o;
|
|
1949
2061
|
t[0] === n ? o = t[1] : (o = /* @__PURE__ */ H(g, {
|
|
1950
2062
|
as: "code",
|
|
@@ -1969,7 +2081,7 @@ function oi(e) {
|
|
|
1969
2081
|
})
|
|
1970
2082
|
}), t[2] = a, t[3] = o, t[4] = s) : s = t[4], s;
|
|
1971
2083
|
}
|
|
1972
|
-
function
|
|
2084
|
+
function wi(e) {
|
|
1973
2085
|
let t = B(38), { b: n, onOpenFile: r } = e;
|
|
1974
2086
|
switch (n.type) {
|
|
1975
2087
|
case "comment": {
|
|
@@ -1987,7 +2099,7 @@ function si(e) {
|
|
|
1987
2099
|
padding: "0",
|
|
1988
2100
|
children: /* @__PURE__ */ H(v.Body, {
|
|
1989
2101
|
padding: "0",
|
|
1990
|
-
children: /* @__PURE__ */ H(
|
|
2102
|
+
children: /* @__PURE__ */ H(Ci, {
|
|
1991
2103
|
language: n.language,
|
|
1992
2104
|
code: n.code
|
|
1993
2105
|
})
|
|
@@ -2005,7 +2117,7 @@ function si(e) {
|
|
|
2005
2117
|
height: "240px",
|
|
2006
2118
|
minW: "320px",
|
|
2007
2119
|
overflow: "hidden",
|
|
2008
|
-
children: /* @__PURE__ */ H(
|
|
2120
|
+
children: /* @__PURE__ */ H(pi, {
|
|
2009
2121
|
original: n.original,
|
|
2010
2122
|
modified: n.modified,
|
|
2011
2123
|
language: n.language,
|
|
@@ -2031,15 +2143,15 @@ function si(e) {
|
|
|
2031
2143
|
}
|
|
2032
2144
|
case "todo-list": {
|
|
2033
2145
|
let e;
|
|
2034
|
-
return t[17] === n.items ? e = t[18] : (e = /* @__PURE__ */ H(
|
|
2146
|
+
return t[17] === n.items ? e = t[18] : (e = /* @__PURE__ */ H(Ct, { items: n.items }), t[17] = n.items, t[18] = e), e;
|
|
2035
2147
|
}
|
|
2036
2148
|
case "question-form": {
|
|
2037
2149
|
let e;
|
|
2038
|
-
return t[19] === n.questions ? e = t[20] : (e = /* @__PURE__ */ H(
|
|
2150
|
+
return t[19] === n.questions ? e = t[20] : (e = /* @__PURE__ */ H(Dt, { questions: n.questions }), t[19] = n.questions, t[20] = e), e;
|
|
2039
2151
|
}
|
|
2040
2152
|
case "references": {
|
|
2041
2153
|
let e;
|
|
2042
|
-
t[21] === n.references ? e = t[22] : (e = n.references.map(
|
|
2154
|
+
t[21] === n.references ? e = t[22] : (e = n.references.map(Ti), t[21] = n.references, t[22] = e);
|
|
2043
2155
|
let r;
|
|
2044
2156
|
return t[23] === e ? r = t[24] : (r = /* @__PURE__ */ H(M, {
|
|
2045
2157
|
mt: "xs",
|
|
@@ -2088,16 +2200,16 @@ function si(e) {
|
|
|
2088
2200
|
}
|
|
2089
2201
|
}
|
|
2090
2202
|
}
|
|
2091
|
-
function
|
|
2203
|
+
function Ti(e) {
|
|
2092
2204
|
return /* @__PURE__ */ H(n, { fileName: e }, e);
|
|
2093
2205
|
}
|
|
2094
|
-
function
|
|
2206
|
+
function Ei(e) {
|
|
2095
2207
|
let t = B(23), { item: n, itemKey: r, isOpen: i, canExpand: a, hasBlocks: o, onToggle: s, onOpenFile: c } = e, l;
|
|
2096
|
-
t[0] === Symbol.for("react.memo_cache_sentinel") ? (l = /* @__PURE__ */ H(
|
|
2208
|
+
t[0] === Symbol.for("react.memo_cache_sentinel") ? (l = /* @__PURE__ */ H(xi.Separator, {}), t[0] = l) : l = t[0];
|
|
2097
2209
|
let u;
|
|
2098
|
-
t[1] === n.indicator ? u = t[2] : (u = /* @__PURE__ */ U(
|
|
2210
|
+
t[1] === n.indicator ? u = t[2] : (u = /* @__PURE__ */ U(xi.Connector, { children: [l, /* @__PURE__ */ H(Si, { ind: n.indicator })] }), t[1] = n.indicator, t[2] = u);
|
|
2099
2211
|
let d = i ? "auto" : "20px", f;
|
|
2100
|
-
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__ */ H(
|
|
2212
|
+
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__ */ H(xi.Title, {
|
|
2101
2213
|
className: "group",
|
|
2102
2214
|
fontWeight: "normal",
|
|
2103
2215
|
display: "flex",
|
|
@@ -2122,7 +2234,7 @@ function li(e) {
|
|
|
2122
2234
|
minW: "0",
|
|
2123
2235
|
flex: "1",
|
|
2124
2236
|
overflow: "hidden",
|
|
2125
|
-
children: n.title.map((e, t) => /* @__PURE__ */ H(
|
|
2237
|
+
children: n.title.map((e, t) => /* @__PURE__ */ H(bi, {
|
|
2126
2238
|
seg: e,
|
|
2127
2239
|
isClickable: a,
|
|
2128
2240
|
onOpenFile: c
|
|
@@ -2135,7 +2247,7 @@ function li(e) {
|
|
|
2135
2247
|
color: "transparent",
|
|
2136
2248
|
flexShrink: "0",
|
|
2137
2249
|
_groupHover: { color: "fg" },
|
|
2138
|
-
children: /* @__PURE__ */ H(
|
|
2250
|
+
children: /* @__PURE__ */ H(Y, { size: 12 })
|
|
2139
2251
|
}) : null]
|
|
2140
2252
|
})
|
|
2141
2253
|
}), t[3] = a, t[4] = i, t[5] = n.title, t[6] = r, t[7] = c, t[8] = s, t[9] = f) : f = t[9];
|
|
@@ -2149,27 +2261,27 @@ function li(e) {
|
|
|
2149
2261
|
opacity: 1,
|
|
2150
2262
|
transform: "translateY(0)",
|
|
2151
2263
|
transition: "opacity 200ms ease, transform 200ms ease",
|
|
2152
|
-
children: n.blocks.map((e, t) => /* @__PURE__ */ H(g, { children: /* @__PURE__ */ H(
|
|
2264
|
+
children: n.blocks.map((e, t) => /* @__PURE__ */ H(g, { children: /* @__PURE__ */ H(wi, {
|
|
2153
2265
|
b: e,
|
|
2154
2266
|
onOpenFile: c
|
|
2155
2267
|
}) }, t))
|
|
2156
2268
|
}) : null
|
|
2157
2269
|
}) : null, t[10] = o, t[11] = i, t[12] = n.blocks, t[13] = c, t[14] = p) : p = t[14];
|
|
2158
2270
|
let m;
|
|
2159
|
-
t[15] !== d || t[16] !== f || t[17] !== p ? (m = /* @__PURE__ */ U(
|
|
2271
|
+
t[15] !== d || t[16] !== f || t[17] !== p ? (m = /* @__PURE__ */ U(xi.Content, {
|
|
2160
2272
|
h: d,
|
|
2161
2273
|
children: [f, p]
|
|
2162
2274
|
}), t[15] = d, t[16] = f, t[17] = p, t[18] = m) : m = t[18];
|
|
2163
2275
|
let h;
|
|
2164
|
-
return t[19] !== r || t[20] !== u || t[21] !== m ? (h = /* @__PURE__ */ U(
|
|
2276
|
+
return t[19] !== r || t[20] !== u || t[21] !== m ? (h = /* @__PURE__ */ U(xi.Item, {
|
|
2165
2277
|
gap: "xs",
|
|
2166
2278
|
children: [u, m]
|
|
2167
2279
|
}, r), t[19] = r, t[20] = u, t[21] = m, t[22] = h) : h = t[22], h;
|
|
2168
2280
|
}
|
|
2169
|
-
function
|
|
2281
|
+
function Di(e) {
|
|
2170
2282
|
let t = B(11), { data: n, onOpenFile: r } = e, i;
|
|
2171
2283
|
t[0] === Symbol.for("react.memo_cache_sentinel") ? (i = {}, t[0] = i) : i = t[0];
|
|
2172
|
-
let [a, o] =
|
|
2284
|
+
let [a, o] = q(i), s = Oi, c;
|
|
2173
2285
|
t[1] === Symbol.for("react.memo_cache_sentinel") ? (c = (e) => {
|
|
2174
2286
|
o((t) => ({
|
|
2175
2287
|
...t,
|
|
@@ -2181,7 +2293,7 @@ function ui(e) {
|
|
|
2181
2293
|
let e;
|
|
2182
2294
|
t[6] !== a || t[7] !== r ? (e = (e, t) => {
|
|
2183
2295
|
let n = s(e, t), i = (e.blocks?.length ?? 0) > 0, o = (e.expandable ?? !0) && i, c = o ? a[n] ?? !1 : i;
|
|
2184
|
-
return /* @__PURE__ */ H(
|
|
2296
|
+
return /* @__PURE__ */ H(Ei, {
|
|
2185
2297
|
item: e,
|
|
2186
2298
|
itemKey: n,
|
|
2187
2299
|
isOpen: c,
|
|
@@ -2193,59 +2305,59 @@ function ui(e) {
|
|
|
2193
2305
|
}, t[6] = a, t[7] = r, t[8] = e) : e = t[8], u = n.items.map(e), t[2] = n.items, t[3] = a, t[4] = r, t[5] = u;
|
|
2194
2306
|
} else u = t[5];
|
|
2195
2307
|
let d;
|
|
2196
|
-
return t[9] === u ? d = t[10] : (d = /* @__PURE__ */ H(
|
|
2308
|
+
return t[9] === u ? d = t[10] : (d = /* @__PURE__ */ H(xi.Root, {
|
|
2197
2309
|
variant: "tool",
|
|
2198
2310
|
children: u
|
|
2199
2311
|
}), t[9] = u, t[10] = d), d;
|
|
2200
2312
|
}
|
|
2201
|
-
function
|
|
2313
|
+
function Oi(e, t) {
|
|
2202
2314
|
return e.id ? `id:${e.id}` : `idx:${t}`;
|
|
2203
2315
|
}
|
|
2204
2316
|
//#endregion
|
|
2205
2317
|
//#region src/components/chat-ui/components/tool-invocation-timeline.tsx
|
|
2206
|
-
var
|
|
2318
|
+
var ki = (e) => fn(e.tool ?? "").replace(/_/g, "") === "question", Ai = (e) => {
|
|
2207
2319
|
let t = e.state?.output;
|
|
2208
2320
|
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;
|
|
2209
2321
|
};
|
|
2210
|
-
function
|
|
2322
|
+
function ji(e) {
|
|
2211
2323
|
let t = B(8), { invocations: n, labeledBlocks: r, hideQuestionForms: i, onOpenFile: a } = e, o = i !== void 0 && i, s, c;
|
|
2212
2324
|
if (t[0] !== o || t[1] !== n || t[2] !== r) {
|
|
2213
2325
|
c = Symbol.for("react.early_return_sentinel");
|
|
2214
2326
|
bb0: {
|
|
2215
|
-
let e = o ? n.filter(
|
|
2327
|
+
let e = o ? n.filter(Mi) : n;
|
|
2216
2328
|
if (e.length === 0) {
|
|
2217
2329
|
c = null;
|
|
2218
2330
|
break bb0;
|
|
2219
2331
|
}
|
|
2220
|
-
s =
|
|
2332
|
+
s = di(e, { labeledBlocks: r });
|
|
2221
2333
|
}
|
|
2222
2334
|
t[0] = o, t[1] = n, t[2] = r, t[3] = s, t[4] = c;
|
|
2223
2335
|
} else s = t[3], c = t[4];
|
|
2224
2336
|
if (c !== Symbol.for("react.early_return_sentinel")) return c;
|
|
2225
2337
|
let l = s, u;
|
|
2226
|
-
return t[5] !== l || t[6] !== a ? (u = /* @__PURE__ */ H(
|
|
2338
|
+
return t[5] !== l || t[6] !== a ? (u = /* @__PURE__ */ H(Di, {
|
|
2227
2339
|
data: l,
|
|
2228
2340
|
onOpenFile: a
|
|
2229
2341
|
}), t[5] = l, t[6] = a, t[7] = u) : u = t[7], u;
|
|
2230
2342
|
}
|
|
2231
|
-
function
|
|
2232
|
-
return !
|
|
2343
|
+
function Mi(e) {
|
|
2344
|
+
return !ki(e) || Ai(e);
|
|
2233
2345
|
}
|
|
2234
2346
|
//#endregion
|
|
2235
2347
|
//#region src/components/chat-ui/components/message-parts-renderer.tsx
|
|
2236
|
-
var
|
|
2348
|
+
var Ni = (e) => e.type === "tool", Pi = (e) => e.filename ?? e.url.split("/").pop() ?? "attachment", Fi = /\.(avif|bmp|gif|jpe?g|png|svg|webp)$/i, Ii = (e) => e.mediaType?.startsWith("image/") || Fi.test(Pi(e)), Li = (e) => Ii(e) ? /* @__PURE__ */ H(w, {
|
|
2237
2349
|
src: e.url,
|
|
2238
|
-
alt: `${
|
|
2350
|
+
alt: `${Pi(e)} preview thumbnail`,
|
|
2239
2351
|
boxSize: "18px",
|
|
2240
2352
|
borderRadius: "xs",
|
|
2241
2353
|
objectFit: "cover"
|
|
2242
|
-
}) : void 0,
|
|
2354
|
+
}) : void 0, Ri = (e, t) => {
|
|
2243
2355
|
if (t) {
|
|
2244
2356
|
t(e.url);
|
|
2245
2357
|
return;
|
|
2246
2358
|
}
|
|
2247
2359
|
typeof window < "u" && window.open(e.url, "_blank", "noopener,noreferrer");
|
|
2248
|
-
},
|
|
2360
|
+
}, zi = (e) => {
|
|
2249
2361
|
if (e.message && e.message.trim().length > 0) return e.message;
|
|
2250
2362
|
let { errorType: t } = e;
|
|
2251
2363
|
switch (t) {
|
|
@@ -2254,17 +2366,17 @@ var gi = (e) => e.type === "tool", _i = (e) => e.filename ?? e.url.split("/").po
|
|
|
2254
2366
|
case "permission": return "Permission denied.";
|
|
2255
2367
|
default: return "An error occurred.";
|
|
2256
2368
|
}
|
|
2257
|
-
},
|
|
2369
|
+
}, Bi = {
|
|
2258
2370
|
info: "blue",
|
|
2259
2371
|
warning: "orange",
|
|
2260
2372
|
error: "red",
|
|
2261
2373
|
success: "green",
|
|
2262
2374
|
loading: "blue"
|
|
2263
|
-
},
|
|
2375
|
+
}, Vi = (e, t) => {
|
|
2264
2376
|
let n = [], r = t;
|
|
2265
2377
|
for (; r < e.length;) {
|
|
2266
2378
|
let t = e[r];
|
|
2267
|
-
if (!
|
|
2379
|
+
if (!Ni(t)) break;
|
|
2268
2380
|
n.push(t), r += 1;
|
|
2269
2381
|
}
|
|
2270
2382
|
return {
|
|
@@ -2272,8 +2384,8 @@ var gi = (e) => e.type === "tool", _i = (e) => e.filename ?? e.url.split("/").po
|
|
|
2272
2384
|
nextIndex: r - 1
|
|
2273
2385
|
};
|
|
2274
2386
|
};
|
|
2275
|
-
function
|
|
2276
|
-
let r = B(8), { message: i, hideQuestionForms: a, onOpenFile: o, toolInvocationTimeline: s } = e, c = a !== void 0 && a, l = s ??
|
|
2387
|
+
function Hi(e) {
|
|
2388
|
+
let r = B(8), { message: i, hideQuestionForms: a, onOpenFile: o, toolInvocationTimeline: s } = e, c = a !== void 0 && a, l = s ?? ji, d;
|
|
2277
2389
|
r[0] === i.parts ? d = r[1] : (d = i.parts ?? [], r[0] = i.parts, r[1] = d);
|
|
2278
2390
|
let f = d, p;
|
|
2279
2391
|
if (r[2] !== l || r[3] !== c || r[4] !== i.id || r[5] !== o || r[6] !== f) {
|
|
@@ -2282,7 +2394,7 @@ function Ti(e) {
|
|
|
2282
2394
|
let a = f[r], s = `${i.id}-${r}`;
|
|
2283
2395
|
bb0: switch (a.type) {
|
|
2284
2396
|
case "text":
|
|
2285
|
-
e.push(/* @__PURE__ */ H("div", { children: /* @__PURE__ */ H(
|
|
2397
|
+
e.push(/* @__PURE__ */ H("div", { children: /* @__PURE__ */ H(dn, { children: a.text }) }, s));
|
|
2286
2398
|
break bb0;
|
|
2287
2399
|
case "reasoning":
|
|
2288
2400
|
e.push(/* @__PURE__ */ H(g, {
|
|
@@ -2299,7 +2411,7 @@ function Ti(e) {
|
|
|
2299
2411
|
}, s));
|
|
2300
2412
|
break bb0;
|
|
2301
2413
|
case "tool": {
|
|
2302
|
-
let { invocations: t, nextIndex: n } =
|
|
2414
|
+
let { invocations: t, nextIndex: n } = Vi(f, r);
|
|
2303
2415
|
r = n, e.push(/* @__PURE__ */ H(g, {
|
|
2304
2416
|
width: "full",
|
|
2305
2417
|
children: /* @__PURE__ */ H(l, {
|
|
@@ -2315,11 +2427,11 @@ function Ti(e) {
|
|
|
2315
2427
|
e.push(/* @__PURE__ */ H(g, {
|
|
2316
2428
|
width: "fit-content",
|
|
2317
2429
|
children: /* @__PURE__ */ H(n, {
|
|
2318
|
-
fileName:
|
|
2430
|
+
fileName: Pi(a),
|
|
2319
2431
|
size: "sm",
|
|
2320
2432
|
tone: "neutral",
|
|
2321
|
-
icon:
|
|
2322
|
-
onSelect: () =>
|
|
2433
|
+
icon: Li(a),
|
|
2434
|
+
onSelect: () => Ri(a, o)
|
|
2323
2435
|
})
|
|
2324
2436
|
}, s));
|
|
2325
2437
|
break bb0;
|
|
@@ -2331,7 +2443,7 @@ function Ti(e) {
|
|
|
2331
2443
|
borderRadius: "xs",
|
|
2332
2444
|
status: "error",
|
|
2333
2445
|
colorPalette: "red",
|
|
2334
|
-
title:
|
|
2446
|
+
title: zi(a),
|
|
2335
2447
|
size: "sm"
|
|
2336
2448
|
})
|
|
2337
2449
|
}, s));
|
|
@@ -2343,7 +2455,7 @@ function Ti(e) {
|
|
|
2343
2455
|
children: /* @__PURE__ */ H(t, {
|
|
2344
2456
|
borderRadius: "xs",
|
|
2345
2457
|
status: a.status === "loading" ? "info" : a.status,
|
|
2346
|
-
colorPalette:
|
|
2458
|
+
colorPalette: Bi[a.status],
|
|
2347
2459
|
title: a.title,
|
|
2348
2460
|
icon: a.status === "loading" ? /* @__PURE__ */ H(j, { size: "sm" }) : void 0,
|
|
2349
2461
|
size: "sm",
|
|
@@ -2360,17 +2472,17 @@ function Ti(e) {
|
|
|
2360
2472
|
}
|
|
2361
2473
|
//#endregion
|
|
2362
2474
|
//#region src/components/chat-ui/components/message-types.ts
|
|
2363
|
-
var
|
|
2475
|
+
var Ui = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "assistant", Wi = (e) => e.text.trim().length > 0, Gi = (e) => e.title.trim().length > 0 || !!e.message?.trim(), Ki = (e) => {
|
|
2364
2476
|
switch (e.type) {
|
|
2365
2477
|
case "text":
|
|
2366
|
-
case "reasoning": return
|
|
2478
|
+
case "reasoning": return Wi(e);
|
|
2367
2479
|
case "tool":
|
|
2368
2480
|
case "file":
|
|
2369
2481
|
case "error": return !0;
|
|
2370
|
-
case "alert": return
|
|
2482
|
+
case "alert": return Gi(e);
|
|
2371
2483
|
default: return !1;
|
|
2372
2484
|
}
|
|
2373
|
-
},
|
|
2485
|
+
}, qi = (e) => e.type === "reasoning" || e.type === "tool", Ji = (e) => e.role === "user" || e.parts.length === 0 ? !1 : e.parts.every(qi), Yi = (e) => {
|
|
2374
2486
|
if (e.length === 0) return null;
|
|
2375
2487
|
let [t, ...n] = e;
|
|
2376
2488
|
return t ? {
|
|
@@ -2380,12 +2492,12 @@ var Ei = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2380
2492
|
modelId: n.at(-1)?.modelId ?? t.modelId,
|
|
2381
2493
|
providerId: n.at(-1)?.providerId ?? t.providerId
|
|
2382
2494
|
} : null;
|
|
2383
|
-
},
|
|
2495
|
+
}, Xi = (e, t = {}) => {
|
|
2384
2496
|
let n = [], r = [], i = () => {
|
|
2385
2497
|
r = [];
|
|
2386
2498
|
};
|
|
2387
2499
|
for (let t of e) {
|
|
2388
|
-
let e = (t.parts ?? []).filter(
|
|
2500
|
+
let e = (t.parts ?? []).filter(Ki);
|
|
2389
2501
|
if (e.length === 0) continue;
|
|
2390
2502
|
let a = {
|
|
2391
2503
|
...t,
|
|
@@ -2395,7 +2507,7 @@ var Ei = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2395
2507
|
i(), n.push(a);
|
|
2396
2508
|
continue;
|
|
2397
2509
|
}
|
|
2398
|
-
if (
|
|
2510
|
+
if (Ji(a)) {
|
|
2399
2511
|
r.push(a);
|
|
2400
2512
|
continue;
|
|
2401
2513
|
}
|
|
@@ -2409,14 +2521,14 @@ var Ei = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2409
2521
|
n.push(a);
|
|
2410
2522
|
}
|
|
2411
2523
|
if (t.streaming && r.length > 0) {
|
|
2412
|
-
let e =
|
|
2524
|
+
let e = Yi(r);
|
|
2413
2525
|
e && n.push(e);
|
|
2414
2526
|
}
|
|
2415
2527
|
return n;
|
|
2416
|
-
},
|
|
2528
|
+
}, Zi = (e) => {
|
|
2417
2529
|
let t = e.at(-1);
|
|
2418
|
-
return t?.role === "assistant" && t.parts.some((e) => e.type === "text" &&
|
|
2419
|
-
},
|
|
2530
|
+
return t?.role === "assistant" && t.parts.some((e) => e.type === "text" && Wi(e)) ? t.id : null;
|
|
2531
|
+
}, Qi = (e) => {
|
|
2420
2532
|
let t = [], n = [];
|
|
2421
2533
|
for (let r of e) r.role === "user" ? t.push({
|
|
2422
2534
|
userMessage: r,
|
|
@@ -2426,33 +2538,33 @@ var Ei = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2426
2538
|
groups: t,
|
|
2427
2539
|
leadingResponses: n
|
|
2428
2540
|
};
|
|
2429
|
-
},
|
|
2541
|
+
}, $i = (e) => {
|
|
2430
2542
|
let t = B(18), { message: n, streaming: r, hideQuestionForms: i, animate: a, showAssistantActions: o } = e, s = i !== void 0 && i, c = a !== void 0 && a, l;
|
|
2431
|
-
t[0] === n.role ? l = t[1] : (l =
|
|
2432
|
-
let u = l, d = u === "user" || u === "assistant" && o, f = c ?
|
|
2433
|
-
t[2] !== s || t[3] !== n || t[4] !== r ? (p = /* @__PURE__ */ H(
|
|
2543
|
+
t[0] === n.role ? l = t[1] : (l = Ui(n.role), t[0] = n.role, t[1] = l);
|
|
2544
|
+
let u = l, d = u === "user" || u === "assistant" && o, f = c ? tn : void 0, p;
|
|
2545
|
+
t[2] !== s || t[3] !== n || t[4] !== r ? (p = /* @__PURE__ */ H(Hi, {
|
|
2434
2546
|
message: n,
|
|
2435
2547
|
streaming: r,
|
|
2436
2548
|
hideQuestionForms: s
|
|
2437
2549
|
}), t[2] = s, t[3] = n, t[4] = r, t[5] = p) : p = t[5];
|
|
2438
2550
|
let m;
|
|
2439
|
-
t[6] !== u || t[7] !== n || t[8] !== d ? (m = d ? /* @__PURE__ */ H(
|
|
2551
|
+
t[6] !== u || t[7] !== n || t[8] !== d ? (m = d ? /* @__PURE__ */ H(ln, {
|
|
2440
2552
|
message: n,
|
|
2441
2553
|
alwaysVisible: u === "user",
|
|
2442
2554
|
copyAlwaysVisible: u !== "user"
|
|
2443
2555
|
}) : null, t[6] = u, t[7] = n, t[8] = d, t[9] = m) : m = t[9];
|
|
2444
2556
|
let h;
|
|
2445
|
-
t[10] !== u || t[11] !== p || t[12] !== m ? (h = /* @__PURE__ */ U(
|
|
2557
|
+
t[10] !== u || t[11] !== p || t[12] !== m ? (h = /* @__PURE__ */ U(X.Content, {
|
|
2446
2558
|
from: u,
|
|
2447
2559
|
children: [p, m]
|
|
2448
2560
|
}), t[10] = u, t[11] = p, t[12] = m, t[13] = h) : h = t[13];
|
|
2449
2561
|
let g;
|
|
2450
|
-
return t[14] !== u || t[15] !== f || t[16] !== h ? (g = /* @__PURE__ */ H(
|
|
2562
|
+
return t[14] !== u || t[15] !== f || t[16] !== h ? (g = /* @__PURE__ */ H(X.Root, {
|
|
2451
2563
|
from: u,
|
|
2452
2564
|
...f,
|
|
2453
2565
|
children: h
|
|
2454
2566
|
}), t[14] = u, t[15] = f, t[16] = h, t[17] = g) : g = t[17], g;
|
|
2455
|
-
},
|
|
2567
|
+
}, ea = (e) => {
|
|
2456
2568
|
let t = B(7), { label: n, onClick: r, actionPanel: i } = e, a = i ? "space-between" : "flex-end", o;
|
|
2457
2569
|
t[0] !== n || t[1] !== r ? (o = /* @__PURE__ */ H(_, {
|
|
2458
2570
|
size: "2xs",
|
|
@@ -2479,21 +2591,21 @@ var Ei = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2479
2591
|
pointerEvents: "none",
|
|
2480
2592
|
children: [i, o]
|
|
2481
2593
|
}), t[3] = i, t[4] = a, t[5] = o, t[6] = s) : s = t[6], s;
|
|
2482
|
-
},
|
|
2594
|
+
}, ta = "min(10vh, 4rem)", na = "min(70dvh, calc(100dvh - 12rem), 22rem)", ra = 1, ia = (e) => e.parts.reduce((e, t) => t.type === "text" ? {
|
|
2483
2595
|
lineCount: e.lineCount + t.text.split(/\r\n|\r|\n/).length,
|
|
2484
2596
|
textLength: e.textLength + t.text.length
|
|
2485
2597
|
} : e, {
|
|
2486
2598
|
lineCount: 0,
|
|
2487
2599
|
textLength: 0
|
|
2488
|
-
}),
|
|
2600
|
+
}), aa = (e) => {
|
|
2489
2601
|
if (e.role !== "user") return !1;
|
|
2490
|
-
let { lineCount: t, textLength: n } =
|
|
2602
|
+
let { lineCount: t, textLength: n } = ia(e);
|
|
2491
2603
|
return n > 360 || t > 4;
|
|
2492
|
-
},
|
|
2604
|
+
}, oa = (e, t) => {
|
|
2493
2605
|
let n = Math.max(0, e.scrollHeight - e.clientHeight);
|
|
2494
|
-
return t === 0 || n <=
|
|
2495
|
-
},
|
|
2496
|
-
let n =
|
|
2606
|
+
return t === 0 || n <= ra ? !1 : t < 0 ? e.scrollTop > ra : e.scrollTop < n - ra;
|
|
2607
|
+
}, sa = 720, ca = 1, la = 3, ua = 20, da = 1, fa = 4, pa = 8, ma = (e, t) => {
|
|
2608
|
+
let n = Zi(e);
|
|
2497
2609
|
return [...e.map((e) => ({
|
|
2498
2610
|
type: "leading-response",
|
|
2499
2611
|
key: e.id,
|
|
@@ -2505,28 +2617,28 @@ var Ei = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2505
2617
|
group: e,
|
|
2506
2618
|
groupIndex: t
|
|
2507
2619
|
}))];
|
|
2508
|
-
},
|
|
2620
|
+
}, ha = (e, t) => {
|
|
2509
2621
|
if (e === 0) return 0;
|
|
2510
|
-
let n = e *
|
|
2622
|
+
let n = e * sa + (e - 1) * pa;
|
|
2511
2623
|
return Math.max(n - t, 0);
|
|
2512
|
-
},
|
|
2624
|
+
}, ga = (e) => e?.clientHeight || ca, _a = (e, t) => Math.abs(e.scrollTop - t.scrollTop) <= da && Math.abs(e.totalSize - t.totalSize) <= da, va = (e, t) => !!e && Math.max(e.scrollHeight, t) <= e.clientHeight, ya = (e, t) => ({
|
|
2513
2625
|
scrollTop: e?.scrollTop ?? 0,
|
|
2514
2626
|
totalSize: t
|
|
2515
|
-
}),
|
|
2516
|
-
let t = B(8), { itemCount: n, onReady: r, scrollRef: i, totalSize: a } = e, o =
|
|
2627
|
+
}), ba = (e) => {
|
|
2628
|
+
let t = B(8), { itemCount: n, onReady: r, scrollRef: i, totalSize: a } = e, o = K(r), s, c;
|
|
2517
2629
|
t[0] === r ? (s = t[1], c = t[2]) : (s = () => {
|
|
2518
2630
|
o.current = r;
|
|
2519
|
-
}, c = [r], t[0] = r, t[1] = s, t[2] = c),
|
|
2631
|
+
}, c = [r], t[0] = r, t[1] = s, t[2] = c), G(s, c);
|
|
2520
2632
|
let l, u;
|
|
2521
2633
|
t[3] !== n || t[4] !== i || t[5] !== a ? (l = () => {
|
|
2522
|
-
if (n === 0 || typeof requestAnimationFrame > "u" ||
|
|
2634
|
+
if (n === 0 || typeof requestAnimationFrame > "u" || va(i.current, a)) {
|
|
2523
2635
|
o.current?.();
|
|
2524
2636
|
return;
|
|
2525
2637
|
}
|
|
2526
2638
|
let e = 0, t = 0, r = 0, s = null, c = () => {
|
|
2527
2639
|
t += 1;
|
|
2528
|
-
let n =
|
|
2529
|
-
if (r = s &&
|
|
2640
|
+
let n = ya(i.current, a);
|
|
2641
|
+
if (r = s && _a(n, s) ? r + 1 : 0, s = n, r >= la || t >= ua) {
|
|
2530
2642
|
o.current?.();
|
|
2531
2643
|
return;
|
|
2532
2644
|
}
|
|
@@ -2537,24 +2649,24 @@ var Ei = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2537
2649
|
n,
|
|
2538
2650
|
i,
|
|
2539
2651
|
a
|
|
2540
|
-
], t[3] = n, t[4] = i, t[5] = a, t[6] = l, t[7] = u) : (l = t[6], u = t[7]),
|
|
2541
|
-
},
|
|
2542
|
-
|
|
2543
|
-
},
|
|
2544
|
-
if (e) return t ?
|
|
2545
|
-
},
|
|
2546
|
-
if (e) return
|
|
2547
|
-
},
|
|
2652
|
+
], t[3] = n, t[4] = i, t[5] = a, t[6] = l, t[7] = u) : (l = t[6], u = t[7]), ne(l, u);
|
|
2653
|
+
}, xa = (e) => {
|
|
2654
|
+
oa(e.currentTarget, e.deltaY) && e.stopPropagation();
|
|
2655
|
+
}, Sa = (e, t) => {
|
|
2656
|
+
if (e) return t ? na : ta;
|
|
2657
|
+
}, Ca = (e) => {
|
|
2658
|
+
if (e) return na;
|
|
2659
|
+
}, wa = (e) => {
|
|
2548
2660
|
let t = B(51), { group: n, streaming: r, hideQuestionForms: i, isExpanded: a, animate: o, onToggleStickyMessage: s } = e, c, l, u;
|
|
2549
|
-
t[0] !== n.userMessage || t[1] !== a ? (c =
|
|
2661
|
+
t[0] !== n.userMessage || t[1] !== a ? (c = aa(n.userMessage), l = c && a, u = Sa(c, a), t[0] = n.userMessage, t[1] = a, t[2] = c, t[3] = l, t[4] = u) : (c = t[2], l = t[3], u = t[4]);
|
|
2550
2662
|
let d = u, f;
|
|
2551
2663
|
t[5] !== n.userMessage.id || t[6] !== s ? (f = () => s(n.userMessage.id), t[5] = n.userMessage.id, t[6] = s, t[7] = f) : f = t[7];
|
|
2552
2664
|
let p = f, m;
|
|
2553
|
-
t[8] === n.responses ? m = t[9] : (m =
|
|
2554
|
-
let h = m, _ = n.userMessage.delivery ?? "sent", v = o ?
|
|
2555
|
-
t[10] === l ? S = t[11] : (S =
|
|
2556
|
-
let C = l ? "auto" : "visible", w = c ? "xs" : void 0, T = c ? "xs" : void 0, E = l ? "3rem" : void 0, D = l ?
|
|
2557
|
-
t[12] !== n.userMessage || t[13] !== r ? (O = /* @__PURE__ */ H(
|
|
2665
|
+
t[8] === n.responses ? m = t[9] : (m = Zi(n.responses), t[8] = n.responses, t[9] = m);
|
|
2666
|
+
let h = m, _ = n.userMessage.delivery ?? "sent", v = o ? tn : void 0, y = c ? "0" : void 0, b = c ? "relative" : void 0, x = c ? a ? "expanded" : "collapsed" : void 0, S;
|
|
2667
|
+
t[10] === l ? S = t[11] : (S = Ca(l), t[10] = l, t[11] = S);
|
|
2668
|
+
let C = l ? "auto" : "visible", w = c ? "xs" : void 0, T = c ? "xs" : void 0, E = l ? "3rem" : void 0, D = l ? xa : void 0, O;
|
|
2669
|
+
t[12] !== n.userMessage || t[13] !== r ? (O = /* @__PURE__ */ H(Hi, {
|
|
2558
2670
|
message: n.userMessage,
|
|
2559
2671
|
streaming: r
|
|
2560
2672
|
}), t[12] = n.userMessage, t[13] = r, t[14] = O) : O = t[14];
|
|
@@ -2574,21 +2686,21 @@ var Ei = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2574
2686
|
children: O
|
|
2575
2687
|
}), t[15] = w, t[16] = T, t[17] = E, t[18] = D, t[19] = O, t[20] = x, t[21] = S, t[22] = C, t[23] = k) : k = t[23];
|
|
2576
2688
|
let A;
|
|
2577
|
-
t[24] !== n.userMessage || t[25] !== c || t[26] !== a || t[27] !== p ? (A = c ? /* @__PURE__ */ H(
|
|
2689
|
+
t[24] !== n.userMessage || t[25] !== c || t[26] !== a || t[27] !== p ? (A = c ? /* @__PURE__ */ H(ea, {
|
|
2578
2690
|
label: a ? "Show less" : "Show more",
|
|
2579
2691
|
onClick: p,
|
|
2580
|
-
actionPanel: /* @__PURE__ */ H(
|
|
2692
|
+
actionPanel: /* @__PURE__ */ H(ln, {
|
|
2581
2693
|
message: n.userMessage,
|
|
2582
2694
|
alwaysVisible: !0,
|
|
2583
2695
|
copyAlwaysVisible: !1
|
|
2584
2696
|
})
|
|
2585
|
-
}) : /* @__PURE__ */ H(
|
|
2697
|
+
}) : /* @__PURE__ */ H(ln, {
|
|
2586
2698
|
message: n.userMessage,
|
|
2587
2699
|
alwaysVisible: !0,
|
|
2588
2700
|
copyAlwaysVisible: !1
|
|
2589
2701
|
}), t[24] = n.userMessage, t[25] = c, t[26] = a, t[27] = p, t[28] = A) : A = t[28];
|
|
2590
2702
|
let j;
|
|
2591
|
-
t[29] !== d || t[30] !== k || t[31] !== A || t[32] !== y || t[33] !== b ? (j = /* @__PURE__ */ U(
|
|
2703
|
+
t[29] !== d || t[30] !== k || t[31] !== A || t[32] !== y || t[33] !== b ? (j = /* @__PURE__ */ U(X.Content, {
|
|
2592
2704
|
from: "user",
|
|
2593
2705
|
maxH: d,
|
|
2594
2706
|
overflow: "hidden",
|
|
@@ -2601,7 +2713,7 @@ var Ei = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2601
2713
|
position: "sticky",
|
|
2602
2714
|
top: "0",
|
|
2603
2715
|
zIndex: 1,
|
|
2604
|
-
children: /* @__PURE__ */ H(
|
|
2716
|
+
children: /* @__PURE__ */ H(X.Root, {
|
|
2605
2717
|
from: "user",
|
|
2606
2718
|
delivery: _,
|
|
2607
2719
|
...v,
|
|
@@ -2611,7 +2723,7 @@ var Ei = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2611
2723
|
let N;
|
|
2612
2724
|
if (t[39] !== h || t[40] !== n.responses || t[41] !== i || t[42] !== r) {
|
|
2613
2725
|
let e;
|
|
2614
|
-
t[44] !== h || t[45] !== i || t[46] !== r ? (e = (e) => /* @__PURE__ */ H(g, { children: /* @__PURE__ */ H(
|
|
2726
|
+
t[44] !== h || t[45] !== i || t[46] !== r ? (e = (e) => /* @__PURE__ */ H(g, { children: /* @__PURE__ */ H($i, {
|
|
2615
2727
|
message: e,
|
|
2616
2728
|
streaming: r,
|
|
2617
2729
|
hideQuestionForms: i,
|
|
@@ -2620,15 +2732,15 @@ var Ei = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2620
2732
|
} else N = t[43];
|
|
2621
2733
|
let P;
|
|
2622
2734
|
return t[48] !== M || t[49] !== N ? (P = /* @__PURE__ */ U(g, { children: [M, N] }), t[48] = M, t[49] = N, t[50] = P) : P = t[50], P;
|
|
2623
|
-
},
|
|
2735
|
+
}, Ta = (e, t) => {
|
|
2624
2736
|
let { groups: n, streaming: r, hideActiveQuestionForms: i, expandedStickyMessageIds: a, animatedItemKeys: o, onToggleStickyMessage: s } = t;
|
|
2625
|
-
return e.type === "leading-response" ? /* @__PURE__ */ H(
|
|
2737
|
+
return e.type === "leading-response" ? /* @__PURE__ */ H($i, {
|
|
2626
2738
|
message: e.message,
|
|
2627
2739
|
streaming: r,
|
|
2628
2740
|
hideQuestionForms: n.length > 0 || i,
|
|
2629
2741
|
animate: o.has(e.key),
|
|
2630
2742
|
showAssistantActions: e.showAssistantActions
|
|
2631
|
-
}) : /* @__PURE__ */ H(
|
|
2743
|
+
}) : /* @__PURE__ */ H(wa, {
|
|
2632
2744
|
group: e.group,
|
|
2633
2745
|
streaming: r,
|
|
2634
2746
|
hideQuestionForms: e.groupIndex < n.length - 1 || i,
|
|
@@ -2636,21 +2748,21 @@ var Ei = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2636
2748
|
animate: o.has(e.key),
|
|
2637
2749
|
onToggleStickyMessage: s
|
|
2638
2750
|
});
|
|
2639
|
-
},
|
|
2640
|
-
let { leadingResponses: t, groups: n, streaming: r, hideActiveQuestionForms: i, expandedStickyMessageIds: a, onToggleStickyMessage: o, onReady: s } = e, { scrollRef: c } =
|
|
2751
|
+
}, Ea = (e) => {
|
|
2752
|
+
let { leadingResponses: t, groups: n, streaming: r, hideActiveQuestionForms: i, expandedStickyMessageIds: a, onToggleStickyMessage: o, onReady: s } = e, { scrollRef: c } = Ae(), l = ma(t, n), u = an(l.map((e) => e.key)), d = ga(c.current), f = Oe({
|
|
2641
2753
|
count: l.length,
|
|
2642
2754
|
getScrollElement: () => c.current,
|
|
2643
|
-
estimateSize: () =>
|
|
2755
|
+
estimateSize: () => sa,
|
|
2644
2756
|
getItemKey: (e) => l[e]?.key ?? e,
|
|
2645
|
-
overscan:
|
|
2646
|
-
gap:
|
|
2757
|
+
overscan: fa,
|
|
2758
|
+
gap: pa,
|
|
2647
2759
|
initialRect: {
|
|
2648
2760
|
width: 0,
|
|
2649
2761
|
height: d
|
|
2650
2762
|
},
|
|
2651
|
-
initialOffset: () =>
|
|
2763
|
+
initialOffset: () => ha(l.length, d)
|
|
2652
2764
|
}), p = f.getTotalSize();
|
|
2653
|
-
return
|
|
2765
|
+
return ba({
|
|
2654
2766
|
itemCount: l.length,
|
|
2655
2767
|
onReady: s,
|
|
2656
2768
|
scrollRef: c,
|
|
@@ -2672,7 +2784,7 @@ var Ei = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2672
2784
|
left: "0",
|
|
2673
2785
|
width: "100%",
|
|
2674
2786
|
style: { top: e.start },
|
|
2675
|
-
children:
|
|
2787
|
+
children: Ta(t, {
|
|
2676
2788
|
groups: n,
|
|
2677
2789
|
streaming: r,
|
|
2678
2790
|
hideActiveQuestionForms: i,
|
|
@@ -2684,7 +2796,7 @@ var Ei = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2684
2796
|
})
|
|
2685
2797
|
})
|
|
2686
2798
|
});
|
|
2687
|
-
},
|
|
2799
|
+
}, Da = (e = "") => JSON.stringify(c(e)), Oa = (e) => {
|
|
2688
2800
|
let t = B(48), { item: n, index: r, isFirst: i, isLast: a, isEditing: o, isDragTarget: s, onEdit: c, onRemove: l, onDragStart: u, onDragEnd: d, onDragOver: f, onDrop: p } = e, m = !!c, _ = !!l, v = !i || !a, y = `Drag queued follow-up ${r + 1}`, b = i ? "0" : "1px", w = s ? "border.accent-light" : "border.subtle", T = i ? "0" : "2xs", E = o ? "bg.muted" : void 0, D;
|
|
2689
2801
|
t[0] !== n.id || t[1] !== f ? (D = (e) => f(e, n.id), t[0] = n.id, t[1] = f, t[2] = D) : D = t[2];
|
|
2690
2802
|
let O;
|
|
@@ -2695,7 +2807,7 @@ var Ei = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2695
2807
|
}, t[6] = n.id, t[7] = u, t[8] = j) : j = t[8];
|
|
2696
2808
|
let P;
|
|
2697
2809
|
t[9] === Symbol.for("react.memo_cache_sentinel") ? (P = /* @__PURE__ */ H(S, {
|
|
2698
|
-
as:
|
|
2810
|
+
as: ge,
|
|
2699
2811
|
boxSize: "14px"
|
|
2700
2812
|
}), t[9] = P) : P = t[9];
|
|
2701
2813
|
let F;
|
|
@@ -2742,7 +2854,7 @@ var Ei = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2742
2854
|
"aria-label": "Edit queued follow-up",
|
|
2743
2855
|
onClick: () => c?.(n),
|
|
2744
2856
|
children: /* @__PURE__ */ H(S, {
|
|
2745
|
-
as:
|
|
2857
|
+
as: Se,
|
|
2746
2858
|
boxSize: "14px"
|
|
2747
2859
|
})
|
|
2748
2860
|
}) : null, t[24] = m, t[25] = n, t[26] = c, t[27] = z) : z = t[27];
|
|
@@ -2754,7 +2866,7 @@ var Ei = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2754
2866
|
colorPalette: "red",
|
|
2755
2867
|
onClick: () => l?.(n.id),
|
|
2756
2868
|
children: /* @__PURE__ */ H(S, {
|
|
2757
|
-
as:
|
|
2869
|
+
as: De,
|
|
2758
2870
|
boxSize: "14px"
|
|
2759
2871
|
})
|
|
2760
2872
|
}) : null, t[28] = _, t[29] = n.id, t[30] = l, t[31] = V) : V = t[31];
|
|
@@ -2764,8 +2876,8 @@ var Ei = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2764
2876
|
flexShrink: 0,
|
|
2765
2877
|
children: [z, V]
|
|
2766
2878
|
}), t[32] = z, t[33] = V, t[34] = ee) : ee = t[34];
|
|
2767
|
-
let
|
|
2768
|
-
t[35] !== F || t[36] !== R || t[37] !== ee ? (
|
|
2879
|
+
let te;
|
|
2880
|
+
t[35] !== F || t[36] !== R || t[37] !== ee ? (te = /* @__PURE__ */ U(x, {
|
|
2769
2881
|
gap: "xs",
|
|
2770
2882
|
alignItems: "flex-start",
|
|
2771
2883
|
children: [
|
|
@@ -2773,9 +2885,9 @@ var Ei = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2773
2885
|
R,
|
|
2774
2886
|
ee
|
|
2775
2887
|
]
|
|
2776
|
-
}), t[35] = F, t[36] = R, t[37] = ee, t[38] =
|
|
2777
|
-
let
|
|
2778
|
-
return t[39] !== n.id || t[40] !== b || t[41] !== w || t[42] !==
|
|
2888
|
+
}), t[35] = F, t[36] = R, t[37] = ee, t[38] = te) : te = t[38];
|
|
2889
|
+
let W;
|
|
2890
|
+
return t[39] !== n.id || t[40] !== b || t[41] !== w || t[42] !== te || t[43] !== T || t[44] !== E || t[45] !== D || t[46] !== O ? (W = /* @__PURE__ */ H(g, {
|
|
2779
2891
|
minWidth: "0",
|
|
2780
2892
|
borderTopWidth: b,
|
|
2781
2893
|
borderColor: w,
|
|
@@ -2785,10 +2897,10 @@ var Ei = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2785
2897
|
onDragOver: D,
|
|
2786
2898
|
onDrop: O,
|
|
2787
2899
|
"data-queued-follow-up-id": n.id,
|
|
2788
|
-
children:
|
|
2789
|
-
}), t[39] = n.id, t[40] = b, t[41] = w, t[42] =
|
|
2790
|
-
},
|
|
2791
|
-
let t = B(24), { items: n, editingItemId: r, onEdit: i, onRemove: a, onMove: o } = e, [s, c] =
|
|
2900
|
+
children: te
|
|
2901
|
+
}), t[39] = n.id, t[40] = b, t[41] = w, t[42] = te, t[43] = T, t[44] = E, t[45] = D, t[46] = O, t[47] = W) : W = t[47], W;
|
|
2902
|
+
}, ka = (e) => {
|
|
2903
|
+
let t = B(24), { items: n, editingItemId: r, onEdit: i, onRemove: a, onMove: o } = e, [s, c] = q(null), [l, u] = q(null);
|
|
2792
2904
|
if (n.length === 0) return null;
|
|
2793
2905
|
let d;
|
|
2794
2906
|
t[0] === s ? d = t[1] : (d = (e, t) => {
|
|
@@ -2805,7 +2917,7 @@ var Ei = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2805
2917
|
let m = p, h;
|
|
2806
2918
|
if (t[6] !== l || t[7] !== r || t[8] !== f || t[9] !== m || t[10] !== n || t[11] !== i || t[12] !== a) {
|
|
2807
2919
|
let e;
|
|
2808
|
-
t[14] !== l || t[15] !== r || t[16] !== f || t[17] !== m || t[18] !== n.length || t[19] !== i || t[20] !== a ? (e = (e, t) => /* @__PURE__ */ H(
|
|
2920
|
+
t[14] !== l || t[15] !== r || t[16] !== f || t[17] !== m || t[18] !== n.length || t[19] !== i || t[20] !== a ? (e = (e, t) => /* @__PURE__ */ H(Oa, {
|
|
2809
2921
|
item: e,
|
|
2810
2922
|
index: t,
|
|
2811
2923
|
isFirst: t === 0,
|
|
@@ -2834,14 +2946,14 @@ var Ei = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2834
2946
|
background: "bg",
|
|
2835
2947
|
children: h
|
|
2836
2948
|
}), t[22] = h, t[23] = g), g;
|
|
2837
|
-
},
|
|
2838
|
-
let t = B(19), { queuedFollowUps: n, defaultValue: r, onChange: i, onSubmit: a, onUpdate: o } = e, [s, c] =
|
|
2949
|
+
}, Aa = (e) => {
|
|
2950
|
+
let t = B(19), { queuedFollowUps: n, defaultValue: r, onChange: i, onSubmit: a, onUpdate: o } = e, [s, c] = q(null), [l, u] = q(""), [d, f] = q(0), p = s ? l : r, m, h;
|
|
2839
2951
|
t[0] !== s || t[1] !== n ? (m = () => {
|
|
2840
2952
|
s && (n.some((e) => e.id === s) || (c(null), u("")));
|
|
2841
|
-
}, h = [s, n], t[0] = s, t[1] = n, t[2] = m, t[3] = h) : (m = t[2], h = t[3]),
|
|
2953
|
+
}, h = [s, n], t[0] = s, t[1] = n, t[2] = m, t[3] = h) : (m = t[2], h = t[3]), G(m, h);
|
|
2842
2954
|
let g;
|
|
2843
2955
|
t[4] === Symbol.for("react.memo_cache_sentinel") ? (g = (e) => {
|
|
2844
|
-
c(e.id), u(e.prompt), f(
|
|
2956
|
+
c(e.id), u(e.prompt), f(Ma);
|
|
2845
2957
|
}, t[4] = g) : g = t[4];
|
|
2846
2958
|
let _ = g, v;
|
|
2847
2959
|
t[5] !== s || t[6] !== i ? (v = (e) => {
|
|
@@ -2849,6 +2961,7 @@ var Ei = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2849
2961
|
}, t[5] = s, t[6] = i, t[7] = v) : v = t[7];
|
|
2850
2962
|
let y = v, b;
|
|
2851
2963
|
t[8] !== s || t[9] !== a || t[10] !== o ? (b = (e, t, n) => {
|
|
2964
|
+
if (n) return a?.(e, t, n);
|
|
2852
2965
|
if (s) {
|
|
2853
2966
|
o?.(s, e), c(null), u("");
|
|
2854
2967
|
return;
|
|
@@ -2865,9 +2978,9 @@ var Ei = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2865
2978
|
isEditing: S,
|
|
2866
2979
|
submit: x
|
|
2867
2980
|
}, t[12] = y, t[13] = s, t[14] = d, t[15] = p, t[16] = x, t[17] = S, t[18] = C) : C = t[18], C;
|
|
2868
|
-
},
|
|
2981
|
+
}, ja = (e) => {
|
|
2869
2982
|
let t = B(43), { conversationKey: n, recentUserMessages: r, actions: i, attachedResources: a, attachmentList: o, chatInputAutoFocus: s, chatInputPlaceholder: c, chatInputQuestionPrompt: l, chatInputReferences: u, hasWorkspaceHub: d, inputDisabled: f, submitDisabled: p, onAttachFiles: m, onAttachText: h, onChatInputAddReference: g, onClearAttachments: _, onInterrupt: v, onQueuedFollowUpMove: y, onQueuedFollowUpRemove: b, onQueuedFollowUpUpdate: x, queuedComposer: S, queuedFollowUps: C, streaming: w, workspaceHub: T } = e, E = C.length > 0, D = d ? "2xs" : "0", O = d ? "2xs" : void 0, k = d ? "1px" : void 0, A = d ? "border" : void 0, j = d ? "xs" : void 0, N = d ? "bg.subtle" : void 0, P = x ? S.edit : void 0, F;
|
|
2870
|
-
t[0] !== y || t[1] !== b || t[2] !== S.editingItemId || t[3] !== C || t[4] !== P ? (F = /* @__PURE__ */ H(
|
|
2983
|
+
t[0] !== y || t[1] !== b || t[2] !== S.editingItemId || t[3] !== C || t[4] !== P ? (F = /* @__PURE__ */ H(ka, {
|
|
2871
2984
|
items: C,
|
|
2872
2985
|
editingItemId: S.editingItemId,
|
|
2873
2986
|
onEdit: P,
|
|
@@ -2875,9 +2988,9 @@ var Ei = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2875
2988
|
onMove: y
|
|
2876
2989
|
}), t[0] = y, t[1] = b, t[2] = S.editingItemId, t[3] = C, t[4] = P, t[5] = F) : F = t[5];
|
|
2877
2990
|
let I;
|
|
2878
|
-
t[6] === S.inputValue ? I = t[7] : (I =
|
|
2879
|
-
let L = S.isEditing ? "Save queued follow-up" : void 0, R;
|
|
2880
|
-
t[8] !== i || t[9] !== a || t[10] !== o || t[11] !== s || t[12] !== c || t[13] !== l || t[14] !== u || t[15] !== n || t[16] !== E || t[17] !== d || t[18] !== f || t[19] !== m || t[20] !== h || t[21] !== g || t[22] !== _ || t[23] !== v || t[24] !== S.change || t[25] !== S.focusSignal || t[26] !== S.submit || t[27] !== r || t[28] !== w || t[29] !== p || t[30] !== I || t[31] !== L ? (R = /* @__PURE__ */ H(
|
|
2991
|
+
t[6] === S.inputValue ? I = t[7] : (I = Da(S.inputValue), t[6] = S.inputValue, t[7] = I);
|
|
2992
|
+
let L = S.isEditing && !l ? "Save queued follow-up" : void 0, R;
|
|
2993
|
+
t[8] !== i || t[9] !== a || t[10] !== o || t[11] !== s || t[12] !== c || t[13] !== l || t[14] !== u || t[15] !== n || t[16] !== E || t[17] !== d || t[18] !== f || t[19] !== m || t[20] !== h || t[21] !== g || t[22] !== _ || t[23] !== v || t[24] !== S.change || t[25] !== S.focusSignal || t[26] !== S.submit || t[27] !== r || t[28] !== w || t[29] !== p || t[30] !== I || t[31] !== L ? (R = /* @__PURE__ */ H(Ht, {
|
|
2881
2994
|
recentUserMessages: r,
|
|
2882
2995
|
placeholder: c,
|
|
2883
2996
|
defaultState: I,
|
|
@@ -2921,36 +3034,34 @@ var Ei = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2921
3034
|
})
|
|
2922
3035
|
}), t[33] = D, t[34] = O, t[35] = R, t[36] = k, t[37] = A, t[38] = j, t[39] = N, t[40] = F, t[41] = T, t[42] = z) : z = t[42], z;
|
|
2923
3036
|
};
|
|
2924
|
-
function
|
|
3037
|
+
function Ma(e) {
|
|
2925
3038
|
return e + 1;
|
|
2926
3039
|
}
|
|
2927
3040
|
//#endregion
|
|
2928
3041
|
//#region src/components/chat-ui/components/working-indicator.tsx
|
|
2929
|
-
var
|
|
3042
|
+
var Na = (e) => {
|
|
2930
3043
|
let t = Math.max(0, Math.floor(e));
|
|
2931
3044
|
if (t < 60) return `${t}s`;
|
|
2932
3045
|
let n = Math.floor(t / 60);
|
|
2933
3046
|
return n < 60 ? `${n}m ${String(t % 60).padStart(2, "0")}s` : `${Math.floor(n / 60)}h ${String(n % 60).padStart(2, "0")}m`;
|
|
2934
|
-
},
|
|
2935
|
-
let t = B(
|
|
2936
|
-
t[0] ===
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
if (r) return;
|
|
2940
|
-
let e = () => a((Date.now() - s.current) / 1e3);
|
|
3047
|
+
}, Pa = (e) => {
|
|
3048
|
+
let t = B(8), { startedAt: n, hidden: r } = e, i = r !== void 0 && r, [a] = q(Date.now), [o, s] = q(Date.now), c, l;
|
|
3049
|
+
if (t[0] === i ? (c = t[1], l = t[2]) : (c = () => {
|
|
3050
|
+
if (i) return;
|
|
3051
|
+
let e = () => s(Date.now());
|
|
2941
3052
|
e();
|
|
2942
3053
|
let t = setInterval(e, 1e3);
|
|
2943
3054
|
return () => clearInterval(t);
|
|
2944
|
-
}, l = [
|
|
3055
|
+
}, l = [i], t[0] = i, t[1] = c, t[2] = l), G(c, l), i) return null;
|
|
2945
3056
|
let u;
|
|
2946
|
-
t[
|
|
3057
|
+
t[3] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ H(j, {
|
|
2947
3058
|
size: "xs",
|
|
2948
3059
|
color: "fg.muted"
|
|
2949
|
-
}), t[
|
|
2950
|
-
let d;
|
|
2951
|
-
t[
|
|
2952
|
-
let
|
|
2953
|
-
return t[
|
|
3060
|
+
}), t[3] = u) : u = t[3];
|
|
3061
|
+
let d = (o - (n ?? a)) / 1e3, f;
|
|
3062
|
+
t[4] === d ? f = t[5] : (f = Na(d), t[4] = d, t[5] = f);
|
|
3063
|
+
let p;
|
|
3064
|
+
return t[6] === f ? p = t[7] : (p = /* @__PURE__ */ U(x, {
|
|
2954
3065
|
gap: "2xs",
|
|
2955
3066
|
px: "sm",
|
|
2956
3067
|
py: "xs",
|
|
@@ -2959,130 +3070,133 @@ var ga = (e) => {
|
|
|
2959
3070
|
fontSize: "xs",
|
|
2960
3071
|
color: "fg.muted",
|
|
2961
3072
|
letterSpacing: "-0.2px",
|
|
2962
|
-
children:
|
|
3073
|
+
children: f
|
|
2963
3074
|
})]
|
|
2964
|
-
}), t[
|
|
2965
|
-
},
|
|
2966
|
-
let t = B(
|
|
2967
|
-
t[0] ===
|
|
2968
|
-
let
|
|
2969
|
-
t[2] ===
|
|
2970
|
-
let
|
|
2971
|
-
if (t[4] !== n || t[5] !== r || t[6] !==
|
|
2972
|
-
let e =
|
|
2973
|
-
|
|
2974
|
-
} else
|
|
2975
|
-
let { groups:
|
|
2976
|
-
t[12] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
3075
|
+
}), t[6] = f, t[7] = p), p;
|
|
3076
|
+
}, Fa = (e) => {
|
|
3077
|
+
let t = B(85), { conversationKey: n, messages: r, loading: i, streaming: o, streamingStartedAt: s, emptyStateTitle: c, emptyStateDescription: l, emptyStateContent: u, loaderComponent: d, chatInputPlaceholder: f, chatInputDefaultValue: p, onSubmitMessage: m, onInterrupt: h, onAttachFiles: g, onAttachText: _, onChatInputChange: v, actions: y, attachedResources: x, onClearAttachments: S, attachmentList: C, approvalPrompt: w, conversationNotices: T, workspaceHub: E, workspaceInitializing: D, inputDisabled: O, submitDisabled: k, chatInputQuestionPrompt: A, chatInputAutoFocus: j, queuedFollowUps: M, onQueuedFollowUpUpdate: N, onQueuedFollowUpRemove: P, onQueuedFollowUpMove: F, chatInputReferences: I, onChatInputAddReference: L } = e, R = i !== void 0 && i, z = o !== void 0 && o, ee = p === void 0 ? "" : p, te = D !== void 0 && D, W = O !== void 0 && O, G = k !== void 0 && k, ne = j !== void 0 && j, K;
|
|
3078
|
+
t[0] === M ? K = t[1] : (K = M === void 0 ? [] : M, t[0] = M, t[1] = K);
|
|
3079
|
+
let re = K, ie;
|
|
3080
|
+
t[2] === I ? ie = t[3] : (ie = I === void 0 ? [] : I, t[2] = I, t[3] = ie);
|
|
3081
|
+
let ae = ie, J, Y, oe, se, ce;
|
|
3082
|
+
if (t[4] !== n || t[5] !== r || t[6] !== z) {
|
|
3083
|
+
let e = Xi(r, { streaming: z });
|
|
3084
|
+
J = e.length > 0, oe = n ?? e[0]?.id, Y = J ? oe ?? "active-conversation" : null, ce = e.reduce(Ia, 0), se = Qi(e), t[4] = n, t[5] = r, t[6] = z, t[7] = J, t[8] = Y, t[9] = oe, t[10] = se, t[11] = ce;
|
|
3085
|
+
} else J = t[7], Y = t[8], oe = t[9], se = t[10], ce = t[11];
|
|
3086
|
+
let { groups: le, leadingResponses: ue } = se, [de, fe] = q(La), [pe, me] = q(null), he = !J && R, ge;
|
|
3087
|
+
t[12] === Symbol.for("react.memo_cache_sentinel") ? (ge = /* @__PURE__ */ H(ye, {
|
|
2977
3088
|
size: 48,
|
|
2978
3089
|
strokeWidth: 1.5
|
|
2979
|
-
}), t[12] =
|
|
2980
|
-
let
|
|
2981
|
-
t[13] !==
|
|
2982
|
-
icon:
|
|
2983
|
-
title:
|
|
2984
|
-
description:
|
|
2985
|
-
}), t[13] =
|
|
2986
|
-
let
|
|
2987
|
-
t[16] !==
|
|
2988
|
-
let
|
|
2989
|
-
t[19] !==
|
|
2990
|
-
queuedFollowUps:
|
|
2991
|
-
defaultValue:
|
|
2992
|
-
onChange:
|
|
2993
|
-
onSubmit:
|
|
2994
|
-
onUpdate:
|
|
2995
|
-
}, t[19] =
|
|
2996
|
-
let
|
|
2997
|
-
t[25] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
2998
|
-
|
|
3090
|
+
}), t[12] = ge) : ge = t[12];
|
|
3091
|
+
let _e;
|
|
3092
|
+
t[13] !== l || t[14] !== c ? (_e = /* @__PURE__ */ H(a, {
|
|
3093
|
+
icon: ge,
|
|
3094
|
+
title: c,
|
|
3095
|
+
description: l
|
|
3096
|
+
}), t[13] = l, t[14] = c, t[15] = _e) : _e = t[15];
|
|
3097
|
+
let ve = he ? d : u ?? _e, be = !!E, xe;
|
|
3098
|
+
t[16] !== A || t[17] !== r ? (xe = A ?? en(r), t[16] = A, t[17] = r, t[18] = xe) : xe = t[18];
|
|
3099
|
+
let Se = xe, Ce = !!Se, we = z && J && !te && !Se, Te = !Y || pe === Y, Ee;
|
|
3100
|
+
t[19] !== ee || t[20] !== v || t[21] !== N || t[22] !== m || t[23] !== re ? (Ee = {
|
|
3101
|
+
queuedFollowUps: re,
|
|
3102
|
+
defaultValue: ee,
|
|
3103
|
+
onChange: v,
|
|
3104
|
+
onSubmit: m,
|
|
3105
|
+
onUpdate: N
|
|
3106
|
+
}, t[19] = ee, t[20] = v, t[21] = N, t[22] = m, t[23] = re, t[24] = Ee) : Ee = t[24];
|
|
3107
|
+
let De = Aa(Ee), Oe;
|
|
3108
|
+
t[25] === Symbol.for("react.memo_cache_sentinel") ? (Oe = (e) => {
|
|
3109
|
+
fe((t) => {
|
|
2999
3110
|
let n = new Set(t);
|
|
3000
3111
|
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
3001
3112
|
});
|
|
3002
|
-
}, t[25] =
|
|
3003
|
-
let
|
|
3004
|
-
t[26] !==
|
|
3005
|
-
conversationKey:
|
|
3006
|
-
userMessageCount:
|
|
3007
|
-
}), t[26] =
|
|
3008
|
-
let
|
|
3009
|
-
t[29] !==
|
|
3010
|
-
leadingResponses:
|
|
3011
|
-
groups:
|
|
3012
|
-
streaming:
|
|
3013
|
-
hideActiveQuestionForms:
|
|
3014
|
-
expandedStickyMessageIds:
|
|
3015
|
-
onToggleStickyMessage:
|
|
3016
|
-
onReady: () =>
|
|
3017
|
-
},
|
|
3018
|
-
let je;
|
|
3019
|
-
t[39] !== ke || t[40] !== Ae ? (je = /* @__PURE__ */ H(Me.Viewport, {
|
|
3020
|
-
visibility: ke,
|
|
3021
|
-
children: Ae
|
|
3022
|
-
}), t[39] = ke, t[40] = Ae, t[41] = je) : je = t[41];
|
|
3023
|
-
let Ne;
|
|
3024
|
-
t[42] === Se ? Ne = t[43] : (Ne = Se ? /* @__PURE__ */ H(Me.ScrollToBottom, { "aria-label": "Scroll to latest message" }) : null, t[42] = Se, t[43] = Ne);
|
|
3025
|
-
let Pe;
|
|
3026
|
-
t[44] !== Oe || t[45] !== je || t[46] !== Ne ? (Pe = /* @__PURE__ */ U(Me.Root, { children: [
|
|
3027
|
-
Oe,
|
|
3028
|
-
je,
|
|
3029
|
-
Ne
|
|
3030
|
-
] }), t[44] = Oe, t[45] = je, t[46] = Ne, t[47] = Pe) : Pe = t[47];
|
|
3113
|
+
}, t[25] = Oe) : Oe = t[25];
|
|
3114
|
+
let ke = Oe, Ae = oe ?? null, je;
|
|
3115
|
+
t[26] !== Ae || t[27] !== ce ? (je = /* @__PURE__ */ H(Ke, {
|
|
3116
|
+
conversationKey: Ae,
|
|
3117
|
+
userMessageCount: ce
|
|
3118
|
+
}), t[26] = Ae, t[27] = ce, t[28] = je) : je = t[28];
|
|
3119
|
+
let Me = Te ? "visible" : "hidden", Ne;
|
|
3120
|
+
t[29] !== T || t[30] !== ve || t[31] !== de || t[32] !== le || t[33] !== J || t[34] !== Ce || t[35] !== ue || t[36] !== Y || t[37] !== z ? (Ne = J ? /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H(Ea, {
|
|
3121
|
+
leadingResponses: ue,
|
|
3122
|
+
groups: le,
|
|
3123
|
+
streaming: z,
|
|
3124
|
+
hideActiveQuestionForms: Ce,
|
|
3125
|
+
expandedStickyMessageIds: de,
|
|
3126
|
+
onToggleStickyMessage: ke,
|
|
3127
|
+
onReady: () => me(Y)
|
|
3128
|
+
}, Y), T] }) : /* @__PURE__ */ U(V, { children: [T, ve] }), t[29] = T, t[30] = ve, t[31] = de, t[32] = le, t[33] = J, t[34] = Ce, t[35] = ue, t[36] = Y, t[37] = z, t[38] = Ne) : Ne = t[38];
|
|
3031
3129
|
let Fe;
|
|
3032
|
-
t[
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3130
|
+
t[39] !== Me || t[40] !== Ne ? (Fe = /* @__PURE__ */ H(Pe.Viewport, {
|
|
3131
|
+
visibility: Me,
|
|
3132
|
+
children: Ne
|
|
3133
|
+
}), t[39] = Me, t[40] = Ne, t[41] = Fe) : Fe = t[41];
|
|
3134
|
+
let Ie;
|
|
3135
|
+
t[42] === Te ? Ie = t[43] : (Ie = Te ? /* @__PURE__ */ H(Pe.ScrollToBottom, { "aria-label": "Scroll to latest message" }) : null, t[42] = Te, t[43] = Ie);
|
|
3136
|
+
let Le;
|
|
3137
|
+
t[44] !== je || t[45] !== Fe || t[46] !== Ie ? (Le = /* @__PURE__ */ U(Pe.Root, { children: [
|
|
3138
|
+
je,
|
|
3139
|
+
Fe,
|
|
3140
|
+
Ie
|
|
3141
|
+
] }), t[44] = je, t[45] = Fe, t[46] = Ie, t[47] = Le) : Le = t[47];
|
|
3142
|
+
let X;
|
|
3143
|
+
t[48] !== oe || t[49] !== we || t[50] !== z || t[51] !== s ? (X = z ? /* @__PURE__ */ H(Pa, {
|
|
3144
|
+
startedAt: s,
|
|
3145
|
+
hidden: !we
|
|
3146
|
+
}, oe) : null, t[48] = oe, t[49] = we, t[50] = z, t[51] = s, t[52] = X) : X = t[52];
|
|
3147
|
+
let Re = n ?? r[0]?.id, ze;
|
|
3148
|
+
t[53] === r ? ze = t[54] : (ze = Nt(r), t[53] = r, t[54] = ze);
|
|
3149
|
+
let Be;
|
|
3150
|
+
t[55] !== y || t[56] !== Se || t[57] !== x || t[58] !== C || t[59] !== ne || t[60] !== f || t[61] !== ae || t[62] !== be || t[63] !== W || t[64] !== g || t[65] !== _ || t[66] !== L || t[67] !== S || t[68] !== h || t[69] !== F || t[70] !== P || t[71] !== N || t[72] !== De || t[73] !== re || t[74] !== z || t[75] !== G || t[76] !== Re || t[77] !== ze || t[78] !== E ? (Be = /* @__PURE__ */ H(ja, {
|
|
3151
|
+
conversationKey: Re,
|
|
3152
|
+
recentUserMessages: ze,
|
|
3153
|
+
actions: y,
|
|
3154
|
+
attachedResources: x,
|
|
3155
|
+
attachmentList: C,
|
|
3156
|
+
chatInputAutoFocus: ne,
|
|
3157
|
+
chatInputPlaceholder: f,
|
|
3158
|
+
chatInputQuestionPrompt: Se,
|
|
3159
|
+
chatInputReferences: ae,
|
|
3160
|
+
hasWorkspaceHub: be,
|
|
3047
3161
|
inputDisabled: W,
|
|
3048
3162
|
submitDisabled: G,
|
|
3049
|
-
onAttachFiles:
|
|
3050
|
-
onAttachText:
|
|
3051
|
-
onChatInputAddReference:
|
|
3052
|
-
onClearAttachments:
|
|
3053
|
-
onInterrupt:
|
|
3054
|
-
onQueuedFollowUpMove:
|
|
3055
|
-
onQueuedFollowUpRemove:
|
|
3056
|
-
onQueuedFollowUpUpdate:
|
|
3057
|
-
queuedComposer:
|
|
3058
|
-
queuedFollowUps:
|
|
3059
|
-
streaming:
|
|
3060
|
-
workspaceHub:
|
|
3061
|
-
}), t[
|
|
3062
|
-
let
|
|
3063
|
-
return t[
|
|
3163
|
+
onAttachFiles: g,
|
|
3164
|
+
onAttachText: _,
|
|
3165
|
+
onChatInputAddReference: L,
|
|
3166
|
+
onClearAttachments: S,
|
|
3167
|
+
onInterrupt: h,
|
|
3168
|
+
onQueuedFollowUpMove: F,
|
|
3169
|
+
onQueuedFollowUpRemove: P,
|
|
3170
|
+
onQueuedFollowUpUpdate: N,
|
|
3171
|
+
queuedComposer: De,
|
|
3172
|
+
queuedFollowUps: re,
|
|
3173
|
+
streaming: z,
|
|
3174
|
+
workspaceHub: E
|
|
3175
|
+
}), t[55] = y, t[56] = Se, t[57] = x, t[58] = C, t[59] = ne, t[60] = f, t[61] = ae, t[62] = be, t[63] = W, t[64] = g, t[65] = _, t[66] = L, t[67] = S, t[68] = h, t[69] = F, t[70] = P, t[71] = N, t[72] = De, t[73] = re, t[74] = z, t[75] = G, t[76] = Re, t[77] = ze, t[78] = E, t[79] = Be) : Be = t[79];
|
|
3176
|
+
let Ve;
|
|
3177
|
+
return t[80] !== w || t[81] !== Le || t[82] !== X || t[83] !== Be ? (Ve = /* @__PURE__ */ U(b, {
|
|
3064
3178
|
position: "relative",
|
|
3065
3179
|
direction: "column",
|
|
3066
3180
|
w: "full",
|
|
3067
3181
|
h: "full",
|
|
3068
3182
|
overflow: "hidden",
|
|
3069
3183
|
children: [
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3184
|
+
Le,
|
|
3185
|
+
w,
|
|
3186
|
+
X,
|
|
3187
|
+
Be
|
|
3074
3188
|
]
|
|
3075
|
-
}), t[
|
|
3189
|
+
}), t[80] = w, t[81] = Le, t[82] = X, t[83] = Be, t[84] = Ve) : Ve = t[84], Ve;
|
|
3076
3190
|
};
|
|
3077
|
-
function
|
|
3191
|
+
function Ia(e, t) {
|
|
3078
3192
|
return e + +(t.role === "user");
|
|
3079
3193
|
}
|
|
3080
|
-
function
|
|
3194
|
+
function La() {
|
|
3081
3195
|
return /* @__PURE__ */ new Set();
|
|
3082
3196
|
}
|
|
3083
3197
|
//#endregion
|
|
3084
3198
|
//#region src/components/chat-ui/components/chat-skeleton.tsx
|
|
3085
|
-
var
|
|
3199
|
+
var Ra = (e) => /* @__PURE__ */ H(M, {
|
|
3086
3200
|
gap: "xs",
|
|
3087
3201
|
w: "full",
|
|
3088
3202
|
children: e.map((e, t) => /* @__PURE__ */ H(O, {
|
|
@@ -3090,13 +3204,13 @@ var xa = (e) => /* @__PURE__ */ H(M, {
|
|
|
3090
3204
|
width: e,
|
|
3091
3205
|
borderRadius: "xs"
|
|
3092
3206
|
}, `${e}-${t}`))
|
|
3093
|
-
}),
|
|
3207
|
+
}), za = () => {
|
|
3094
3208
|
let e = B(2), t;
|
|
3095
|
-
e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ H(
|
|
3209
|
+
e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ H(X.Root, {
|
|
3096
3210
|
from: "user",
|
|
3097
|
-
children: /* @__PURE__ */ H(
|
|
3211
|
+
children: /* @__PURE__ */ H(X.Content, {
|
|
3098
3212
|
from: "user",
|
|
3099
|
-
children:
|
|
3213
|
+
children: Ra(["72%", "46%"])
|
|
3100
3214
|
})
|
|
3101
3215
|
}), e[0] = t) : t = e[0];
|
|
3102
3216
|
let n;
|
|
@@ -3104,11 +3218,11 @@ var xa = (e) => /* @__PURE__ */ H(M, {
|
|
|
3104
3218
|
minH: "full",
|
|
3105
3219
|
py: "xs",
|
|
3106
3220
|
gap: "0",
|
|
3107
|
-
children: [t, /* @__PURE__ */ H(
|
|
3221
|
+
children: [t, /* @__PURE__ */ H(X.Root, {
|
|
3108
3222
|
from: "assistant",
|
|
3109
|
-
children: /* @__PURE__ */ H(
|
|
3223
|
+
children: /* @__PURE__ */ H(X.Content, {
|
|
3110
3224
|
from: "assistant",
|
|
3111
|
-
children:
|
|
3225
|
+
children: Ra([
|
|
3112
3226
|
"76%",
|
|
3113
3227
|
"62%",
|
|
3114
3228
|
"40%"
|
|
@@ -3116,15 +3230,15 @@ var xa = (e) => /* @__PURE__ */ H(M, {
|
|
|
3116
3230
|
})
|
|
3117
3231
|
})]
|
|
3118
3232
|
}), e[1] = n) : n = e[1], n;
|
|
3119
|
-
},
|
|
3233
|
+
}, Ba = 3, Va = 10, Ha = 4, Ua = (e, t) => {
|
|
3120
3234
|
if (t === null) return 0;
|
|
3121
3235
|
let n = Math.abs(e - t);
|
|
3122
|
-
return n >=
|
|
3123
|
-
},
|
|
3236
|
+
return n >= Ha ? 0 : (1 + Math.cos(Math.PI * n / Ha)) / 2;
|
|
3237
|
+
}, Wa = (e, t) => {
|
|
3124
3238
|
if (t === null) return "fg.subtle";
|
|
3125
3239
|
let n = Math.abs(e - t);
|
|
3126
|
-
return n < .5 ? "fg" : n <
|
|
3127
|
-
},
|
|
3240
|
+
return n < .5 ? "fg" : n < Ha ? "fg.muted" : "fg.subtle";
|
|
3241
|
+
}, Ga = (e) => {
|
|
3128
3242
|
let t = B(11), { item: n, position: r } = e, i = `${r.left}px`, a = `${r.top}px`, o;
|
|
3129
3243
|
t[0] === n.message ? o = t[1] : (o = /* @__PURE__ */ H(N, {
|
|
3130
3244
|
textStyle: "label/S/medium",
|
|
@@ -3162,9 +3276,9 @@ var xa = (e) => /* @__PURE__ */ H(M, {
|
|
|
3162
3276
|
pointerEvents: "none",
|
|
3163
3277
|
children: c
|
|
3164
3278
|
}) }), t[7] = i, t[8] = a, t[9] = c, t[10] = l) : l = t[10], l;
|
|
3165
|
-
},
|
|
3166
|
-
let t = B(22), { items: n, onSelect: r, floating: i } = e, a = i !== void 0 && i, [o, s] =
|
|
3167
|
-
if (n.length <
|
|
3279
|
+
}, Ka = (e) => {
|
|
3280
|
+
let t = B(22), { items: n, onSelect: r, floating: i } = e, a = i !== void 0 && i, [o, s] = q(null), [c, l] = q(null);
|
|
3281
|
+
if (n.length < Ba) return null;
|
|
3168
3282
|
let u;
|
|
3169
3283
|
t[0] === n.length ? u = t[1] : (u = (e) => {
|
|
3170
3284
|
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);
|
|
@@ -3189,8 +3303,8 @@ var xa = (e) => /* @__PURE__ */ H(M, {
|
|
|
3189
3303
|
t[9] !== r || t[10] !== o ? (e = (e, t) => /* @__PURE__ */ H(L.button, {
|
|
3190
3304
|
type: "button",
|
|
3191
3305
|
h: "2px",
|
|
3192
|
-
w: `${
|
|
3193
|
-
bg:
|
|
3306
|
+
w: `${Va + 16 * Ua(t, o)}px`,
|
|
3307
|
+
bg: Wa(t, o),
|
|
3194
3308
|
borderRadius: "1px",
|
|
3195
3309
|
transition: "width 80ms linear, background-color 80ms linear",
|
|
3196
3310
|
"aria-label": `Jump to message ${t + 1}`,
|
|
@@ -3211,7 +3325,7 @@ var xa = (e) => /* @__PURE__ */ H(M, {
|
|
|
3211
3325
|
children: _
|
|
3212
3326
|
}), t[12] = d, t[13] = h, t[14] = _, t[15] = v) : v = t[15];
|
|
3213
3327
|
let y;
|
|
3214
|
-
t[16] !== p || t[17] !== c ? (y = p && c ? /* @__PURE__ */ H(
|
|
3328
|
+
t[16] !== p || t[17] !== c ? (y = p && c ? /* @__PURE__ */ H(Ga, {
|
|
3215
3329
|
item: p,
|
|
3216
3330
|
position: c
|
|
3217
3331
|
}) : null, t[16] = p, t[17] = c, t[18] = y) : y = t[18];
|
|
@@ -3222,7 +3336,7 @@ var xa = (e) => /* @__PURE__ */ H(M, {
|
|
|
3222
3336
|
flexShrink: 0,
|
|
3223
3337
|
children: [v, y]
|
|
3224
3338
|
}), t[19] = v, t[20] = y, t[21] = x) : x = t[21], x;
|
|
3225
|
-
},
|
|
3339
|
+
}, qa = (e) => {
|
|
3226
3340
|
let t = B(13), { status: n, statusLabel: r, additions: i, deletions: a } = e;
|
|
3227
3341
|
if (n === "loading") {
|
|
3228
3342
|
let e;
|
|
@@ -3244,7 +3358,7 @@ var xa = (e) => /* @__PURE__ */ H(M, {
|
|
|
3244
3358
|
}
|
|
3245
3359
|
if (n === "error") {
|
|
3246
3360
|
let e;
|
|
3247
|
-
t[3] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ H(
|
|
3361
|
+
t[3] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ H(re, {
|
|
3248
3362
|
size: 14,
|
|
3249
3363
|
color: "var(--chakra-colors-fg-error)"
|
|
3250
3364
|
}), t[3] = e) : e = t[3];
|
|
@@ -3278,9 +3392,9 @@ var xa = (e) => /* @__PURE__ */ H(M, {
|
|
|
3278
3392
|
gap: "2xs",
|
|
3279
3393
|
children: [o, s]
|
|
3280
3394
|
}), t[10] = o, t[11] = s, t[12] = c) : c = t[12], c;
|
|
3281
|
-
},
|
|
3395
|
+
}, Ja = (e) => {
|
|
3282
3396
|
let t = B(13), { workspaceControl: n, additions: r, deletions: i, action: a, status: o, statusLabel: s } = e, c = o === void 0 ? "ready" : o, l;
|
|
3283
|
-
t[0] !== r || t[1] !== i || t[2] !== c || t[3] !== s ? (l = /* @__PURE__ */ H(
|
|
3397
|
+
t[0] !== r || t[1] !== i || t[2] !== c || t[3] !== s ? (l = /* @__PURE__ */ H(qa, {
|
|
3284
3398
|
status: c,
|
|
3285
3399
|
statusLabel: s,
|
|
3286
3400
|
additions: r,
|
|
@@ -3310,6 +3424,6 @@ var xa = (e) => /* @__PURE__ */ H(M, {
|
|
|
3310
3424
|
}), t[10] = u, t[11] = d, t[12] = f) : f = t[12], f;
|
|
3311
3425
|
};
|
|
3312
3426
|
//#endregion
|
|
3313
|
-
export {
|
|
3427
|
+
export { ze as ApprovalPrompt, He as AttachmentList, Ke as AutoScroll, Ht as ChatInput, X as ChatMessage, Fa as ChatPanel, Pe as ChatPrimitives, za as ChatSkeleton, Ja as ChatWorkspaceHub, Ka as ConversationBrowse, Mt as SendButton, Da as createSerializedPromptState };
|
|
3314
3428
|
|
|
3315
3429
|
//# sourceMappingURL=chat-ui.js.map
|