@veevarts/design-system 2.0.0-alpha.61 → 2.0.0-alpha.63
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/README.md +10 -1
- package/dist/assistant.cjs +2 -1
- package/dist/assistant.d.ts +10 -0
- package/dist/assistant.js +1046 -389
- package/dist/index.cjs +6 -6
- package/dist/index.js +4047 -3950
- package/dist/patterns/ActionsMenu/ActionsMenu.d.ts +3 -0
- package/dist/patterns/ActionsMenu/icons.d.ts +2 -0
- package/dist/patterns/ActionsMenu/index.d.ts +2 -0
- package/dist/patterns/ActionsMenu/styles.d.ts +20 -0
- package/dist/patterns/ActionsMenu/types.d.ts +35 -0
- package/dist/patterns/ArtifactCard/ArtifactCard.d.ts +19 -0
- package/dist/patterns/ArtifactCard/index.d.ts +2 -0
- package/dist/patterns/ArtifactCard/styles.d.ts +31 -0
- package/dist/patterns/ArtifactCard/types.d.ts +36 -0
- package/dist/patterns/AssistantMarkdown/AssistantMarkdown.d.ts +17 -0
- package/dist/patterns/AssistantMarkdown/index.d.ts +3 -0
- package/dist/patterns/AssistantMarkdown/links.d.ts +43 -0
- package/dist/patterns/AssistantMarkdown/parser.d.ts +5 -0
- package/dist/patterns/AssistantMarkdown/styles.d.ts +39 -0
- package/dist/patterns/AssistantMarkdown/types.d.ts +48 -0
- package/dist/patterns/CitationMarker/CitationMarker.d.ts +16 -0
- package/dist/patterns/CitationMarker/index.d.ts +2 -0
- package/dist/patterns/CitationMarker/styles.d.ts +19 -0
- package/dist/patterns/CitationMarker/types.d.ts +13 -0
- package/dist/patterns/SourceList/SourceList.d.ts +14 -0
- package/dist/patterns/SourceList/index.d.ts +2 -0
- package/dist/patterns/SourceList/styles.d.ts +20 -0
- package/dist/patterns/SourceList/types.d.ts +32 -0
- package/dist/patterns/SourcePill/SourcePill.d.ts +13 -0
- package/dist/patterns/SourcePill/index.d.ts +2 -0
- package/dist/patterns/SourcePill/styles.d.ts +19 -0
- package/dist/patterns/SourcePill/types.d.ts +20 -0
- package/dist/patterns/index.d.ts +2 -0
- package/package.json +3 -1
package/dist/assistant.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useId as
|
|
3
|
-
import { h as
|
|
4
|
-
import { cn as
|
|
1
|
+
import { jsx as n, jsxs as f, Fragment as me } from "react/jsx-runtime";
|
|
2
|
+
import { useId as G, useState as q, useRef as F, useLayoutEffect as re, useEffect as Z, useCallback as X, useMemo as he, Fragment as U, createElement as Se, forwardRef as _e, useImperativeHandle as ke, Children as Le } from "react";
|
|
3
|
+
import { h as D, I as R, a as le, s as be, B as z, b as Me } from "./hasContent-BCRxiry-.js";
|
|
4
|
+
import { cn as u, Accordion as ge, AccordionItem as xe, Chip as Ee, Alert as Fe, Spinner as we, Textarea as Re, ScrollShadow as Oe, Card as je, CardHeader as De, CardBody as Ue, CardFooter as We } from "@heroui/react";
|
|
5
5
|
import "lucide-react";
|
|
6
|
-
|
|
6
|
+
import Pe from "markdown-it";
|
|
7
|
+
const S = {
|
|
7
8
|
base: "flex w-full min-w-0 flex-col gap-1.5",
|
|
8
9
|
baseUser: "items-end",
|
|
9
10
|
baseAssistant: "items-start",
|
|
@@ -27,118 +28,118 @@ const x = {
|
|
|
27
28
|
userLabel: "sr-only",
|
|
28
29
|
/** The default status word when `statusLabel` is empty, for screen readers only: the icon shows it. */
|
|
29
30
|
statusFallback: "sr-only"
|
|
30
|
-
},
|
|
31
|
+
}, ze = {
|
|
31
32
|
stopped: "text-default-600",
|
|
32
33
|
error: "text-danger-600 dark:text-danger-500"
|
|
33
|
-
},
|
|
34
|
+
}, Ie = {
|
|
34
35
|
stopped: "solar:stop-circle-linear",
|
|
35
36
|
error: "solar:danger-circle-linear"
|
|
36
|
-
},
|
|
37
|
+
}, Be = "solar:stars-minimalistic-linear", He = {
|
|
37
38
|
stopped: "Stopped",
|
|
38
39
|
error: "Failed"
|
|
39
40
|
};
|
|
40
|
-
function
|
|
41
|
-
return typeof
|
|
41
|
+
function ve(e) {
|
|
42
|
+
return typeof e == "string" ? e.trim() !== "" : Array.isArray(e) ? e.some(ve) : D(e);
|
|
42
43
|
}
|
|
43
|
-
function
|
|
44
|
-
author:
|
|
45
|
-
authorLabel:
|
|
46
|
-
children:
|
|
47
|
-
status:
|
|
48
|
-
statusLabel:
|
|
49
|
-
meta:
|
|
50
|
-
actions:
|
|
51
|
-
icon:
|
|
52
|
-
className:
|
|
53
|
-
classNames:
|
|
54
|
-
"data-testid":
|
|
44
|
+
function Ke({
|
|
45
|
+
author: e,
|
|
46
|
+
authorLabel: t,
|
|
47
|
+
children: a,
|
|
48
|
+
status: r = "complete",
|
|
49
|
+
statusLabel: s,
|
|
50
|
+
meta: l,
|
|
51
|
+
actions: d,
|
|
52
|
+
icon: x = Be,
|
|
53
|
+
className: p,
|
|
54
|
+
classNames: o = {},
|
|
55
|
+
"data-testid": w = "assistant-message"
|
|
55
56
|
}) {
|
|
56
|
-
const
|
|
57
|
-
return /* @__PURE__ */
|
|
57
|
+
const b = G(), g = e === "user", i = r === "complete" ? null : r === "stopped" ? "stopped" : "error", v = D(l) ? /* @__PURE__ */ n("span", { "data-testid": `${w}-meta`, className: u(S.meta, o.meta), children: l }) : null;
|
|
58
|
+
return /* @__PURE__ */ f(
|
|
58
59
|
"article",
|
|
59
60
|
{
|
|
60
|
-
"aria-labelledby":
|
|
61
|
-
"data-author":
|
|
62
|
-
"data-status":
|
|
63
|
-
"data-testid":
|
|
64
|
-
className:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
61
|
+
"aria-labelledby": b,
|
|
62
|
+
"data-author": e,
|
|
63
|
+
"data-status": r,
|
|
64
|
+
"data-testid": w,
|
|
65
|
+
className: u(
|
|
66
|
+
S.base,
|
|
67
|
+
g ? S.baseUser : S.baseAssistant,
|
|
68
|
+
p,
|
|
69
|
+
o.base
|
|
69
70
|
),
|
|
70
71
|
children: [
|
|
71
|
-
|
|
72
|
+
g ? /* @__PURE__ */ n("span", { id: b, className: S.userLabel, children: t }) : /* @__PURE__ */ f(
|
|
72
73
|
"header",
|
|
73
74
|
{
|
|
74
|
-
"data-testid": `${
|
|
75
|
-
className:
|
|
75
|
+
"data-testid": `${w}-header`,
|
|
76
|
+
className: u(S.header, o.header),
|
|
76
77
|
children: [
|
|
77
|
-
|
|
78
|
+
x ? /* @__PURE__ */ n(
|
|
78
79
|
"span",
|
|
79
80
|
{
|
|
80
81
|
"aria-hidden": "true",
|
|
81
|
-
"data-testid": `${
|
|
82
|
-
className:
|
|
83
|
-
children: /* @__PURE__ */
|
|
82
|
+
"data-testid": `${w}-mark`,
|
|
83
|
+
className: S.mark,
|
|
84
|
+
children: /* @__PURE__ */ n(R, { icon: x, width: 14, height: 14 })
|
|
84
85
|
}
|
|
85
86
|
) : null,
|
|
86
|
-
/* @__PURE__ */
|
|
87
|
-
|
|
87
|
+
/* @__PURE__ */ n("span", { id: b, "data-testid": `${w}-author`, className: S.author, children: t }),
|
|
88
|
+
v
|
|
88
89
|
]
|
|
89
90
|
}
|
|
90
91
|
),
|
|
91
|
-
|
|
92
|
+
D(a) ? /* @__PURE__ */ n(
|
|
92
93
|
"div",
|
|
93
94
|
{
|
|
94
|
-
"data-testid": `${
|
|
95
|
-
className:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
typeof
|
|
99
|
-
|
|
95
|
+
"data-testid": `${w}-body`,
|
|
96
|
+
className: u(
|
|
97
|
+
S.body,
|
|
98
|
+
g ? S.bodyUser : S.bodyAssistant,
|
|
99
|
+
typeof a == "string" && S.plain,
|
|
100
|
+
o.body
|
|
100
101
|
),
|
|
101
|
-
children:
|
|
102
|
+
children: a
|
|
102
103
|
}
|
|
103
104
|
) : null,
|
|
104
|
-
|
|
105
|
+
i ? /* @__PURE__ */ f(
|
|
105
106
|
"p",
|
|
106
107
|
{
|
|
107
|
-
"data-testid": `${
|
|
108
|
-
className:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
"data-testid": `${w}-status`,
|
|
109
|
+
className: u(
|
|
110
|
+
S.status,
|
|
111
|
+
ze[i],
|
|
112
|
+
o.status
|
|
112
113
|
),
|
|
113
114
|
children: [
|
|
114
|
-
/* @__PURE__ */
|
|
115
|
+
/* @__PURE__ */ n(
|
|
115
116
|
"span",
|
|
116
117
|
{
|
|
117
118
|
"aria-hidden": "true",
|
|
118
|
-
"data-testid": `${
|
|
119
|
-
className:
|
|
120
|
-
children: /* @__PURE__ */
|
|
119
|
+
"data-testid": `${w}-status-icon`,
|
|
120
|
+
className: S.statusIcon,
|
|
121
|
+
children: /* @__PURE__ */ n(R, { icon: Ie[i], width: 14, height: 14 })
|
|
121
122
|
}
|
|
122
123
|
),
|
|
123
|
-
|
|
124
|
+
ve(s) ? /* @__PURE__ */ n("span", { children: s }) : /* @__PURE__ */ n("span", { className: S.statusFallback, children: He[i] })
|
|
124
125
|
]
|
|
125
126
|
}
|
|
126
127
|
) : null,
|
|
127
|
-
|
|
128
|
-
|
|
128
|
+
g ? v : null,
|
|
129
|
+
D(d) ? /* @__PURE__ */ n(
|
|
129
130
|
"div",
|
|
130
131
|
{
|
|
131
|
-
"data-testid": `${
|
|
132
|
-
className:
|
|
133
|
-
children:
|
|
132
|
+
"data-testid": `${w}-actions`,
|
|
133
|
+
className: u(S.actions, o.actions),
|
|
134
|
+
children: d
|
|
134
135
|
}
|
|
135
136
|
) : null
|
|
136
137
|
]
|
|
137
138
|
}
|
|
138
139
|
);
|
|
139
140
|
}
|
|
140
|
-
|
|
141
|
-
const
|
|
141
|
+
Ke.displayName = "AssistantMessage";
|
|
142
|
+
const E = {
|
|
142
143
|
base: "w-full px-0",
|
|
143
144
|
item: "shadow-none",
|
|
144
145
|
trigger: "gap-2 py-1.5",
|
|
@@ -159,113 +160,113 @@ const A = {
|
|
|
159
160
|
duration: "mt-px flex-none text-xs tabular-nums text-default-500",
|
|
160
161
|
/** "Done:" before a done row, for screen readers only. */
|
|
161
162
|
stateLabel: "sr-only"
|
|
162
|
-
},
|
|
163
|
+
}, Te = {
|
|
163
164
|
done: { icon: "solar:check-circle-linear", className: "text-success-600" },
|
|
164
165
|
failed: { icon: "solar:close-circle-linear", className: "text-danger-600" }
|
|
165
166
|
};
|
|
166
|
-
function
|
|
167
|
-
if (!Number.isFinite(
|
|
168
|
-
if (
|
|
169
|
-
if (
|
|
170
|
-
const
|
|
171
|
-
return
|
|
167
|
+
function qe(e) {
|
|
168
|
+
if (!Number.isFinite(e) || e < 0) return "";
|
|
169
|
+
if (e < 1e3) return `${Math.floor(e)} ms`;
|
|
170
|
+
if (e < 1e4) return `${(Math.floor(e / 100) / 10).toFixed(1)} s`;
|
|
171
|
+
const t = Math.floor(e / 1e3);
|
|
172
|
+
return t < 60 ? `${t} s` : `${Math.floor(t / 60)} min ${String(t % 60).padStart(2, "0")} s`;
|
|
172
173
|
}
|
|
173
|
-
const
|
|
174
|
-
function
|
|
175
|
-
items:
|
|
176
|
-
title:
|
|
177
|
-
titleText:
|
|
178
|
-
isExpanded:
|
|
179
|
-
defaultExpanded:
|
|
180
|
-
onExpandedChange:
|
|
181
|
-
stateLabels:
|
|
182
|
-
formatDuration:
|
|
183
|
-
className:
|
|
184
|
-
"data-testid":
|
|
174
|
+
const ee = "activity", Ge = { done: "Done", failed: "Failed" };
|
|
175
|
+
function Ve({
|
|
176
|
+
items: e,
|
|
177
|
+
title: t,
|
|
178
|
+
titleText: a,
|
|
179
|
+
isExpanded: r,
|
|
180
|
+
defaultExpanded: s = !0,
|
|
181
|
+
onExpandedChange: l,
|
|
182
|
+
stateLabels: d,
|
|
183
|
+
formatDuration: x = qe,
|
|
184
|
+
className: p,
|
|
185
|
+
"data-testid": o = "assistant-activity"
|
|
185
186
|
}) {
|
|
186
|
-
const [
|
|
187
|
-
return
|
|
188
|
-
|
|
187
|
+
const [w, b] = q(s), g = le(), i = r ?? w, v = { ...Ge, ...d };
|
|
188
|
+
return e.length === 0 ? null : /* @__PURE__ */ n(
|
|
189
|
+
ge,
|
|
189
190
|
{
|
|
190
|
-
"data-testid":
|
|
191
|
-
disableAnimation:
|
|
192
|
-
selectedKeys:
|
|
193
|
-
onSelectionChange: (
|
|
194
|
-
const
|
|
195
|
-
|
|
191
|
+
"data-testid": o,
|
|
192
|
+
disableAnimation: g,
|
|
193
|
+
selectedKeys: i ? /* @__PURE__ */ new Set([ee]) : /* @__PURE__ */ new Set(),
|
|
194
|
+
onSelectionChange: (m) => {
|
|
195
|
+
const C = m === "all" || m.has(ee);
|
|
196
|
+
r === void 0 && b(C), l?.(C);
|
|
196
197
|
},
|
|
197
|
-
className:
|
|
198
|
-
children: /* @__PURE__ */
|
|
199
|
-
|
|
198
|
+
className: u(E.base, p),
|
|
199
|
+
children: /* @__PURE__ */ n(
|
|
200
|
+
xe,
|
|
200
201
|
{
|
|
201
|
-
"data-testid": `${
|
|
202
|
-
title:
|
|
203
|
-
textValue: typeof
|
|
202
|
+
"data-testid": `${o}-group`,
|
|
203
|
+
title: t,
|
|
204
|
+
textValue: typeof t == "string" ? t : a,
|
|
204
205
|
classNames: {
|
|
205
|
-
base:
|
|
206
|
-
trigger:
|
|
207
|
-
title:
|
|
208
|
-
indicator:
|
|
209
|
-
content:
|
|
206
|
+
base: E.item,
|
|
207
|
+
trigger: E.trigger,
|
|
208
|
+
title: E.title,
|
|
209
|
+
indicator: E.indicator,
|
|
210
|
+
content: E.content
|
|
210
211
|
},
|
|
211
|
-
children: /* @__PURE__ */
|
|
212
|
-
const
|
|
213
|
-
return /* @__PURE__ */
|
|
212
|
+
children: /* @__PURE__ */ n("ol", { "data-testid": `${o}-list`, className: E.list, children: e.map((m) => {
|
|
213
|
+
const C = Te[m.state], A = `${o}-item-${m.id}`;
|
|
214
|
+
return /* @__PURE__ */ f(
|
|
214
215
|
"li",
|
|
215
216
|
{
|
|
216
|
-
"data-testid":
|
|
217
|
-
"data-state":
|
|
218
|
-
className:
|
|
217
|
+
"data-testid": A,
|
|
218
|
+
"data-state": m.state,
|
|
219
|
+
className: E.row,
|
|
219
220
|
children: [
|
|
220
|
-
/* @__PURE__ */
|
|
221
|
-
|
|
221
|
+
/* @__PURE__ */ n(
|
|
222
|
+
R,
|
|
222
223
|
{
|
|
223
|
-
icon:
|
|
224
|
+
icon: C.icon,
|
|
224
225
|
width: 16,
|
|
225
226
|
height: 16,
|
|
226
227
|
"aria-hidden": "true",
|
|
227
|
-
className:
|
|
228
|
+
className: u(E.icon, C.className)
|
|
228
229
|
}
|
|
229
230
|
),
|
|
230
|
-
/* @__PURE__ */
|
|
231
|
-
|
|
232
|
-
|
|
231
|
+
/* @__PURE__ */ f("span", { className: E.label, children: [
|
|
232
|
+
m.state === "done" ? /* @__PURE__ */ f("span", { className: E.stateLabel, children: [
|
|
233
|
+
v.done,
|
|
233
234
|
": "
|
|
234
235
|
] }) : null,
|
|
235
|
-
|
|
236
|
+
m.label
|
|
236
237
|
] }),
|
|
237
|
-
|
|
238
|
-
|
|
238
|
+
m.state === "failed" ? /* @__PURE__ */ n(
|
|
239
|
+
Ee,
|
|
239
240
|
{
|
|
240
241
|
size: "sm",
|
|
241
242
|
variant: "flat",
|
|
242
243
|
color: "danger",
|
|
243
|
-
"data-testid": `${
|
|
244
|
-
className:
|
|
245
|
-
children:
|
|
244
|
+
"data-testid": `${A}-failed`,
|
|
245
|
+
className: E.failed,
|
|
246
|
+
children: v.failed
|
|
246
247
|
}
|
|
247
248
|
) : null,
|
|
248
|
-
|
|
249
|
+
m.durationMs !== void 0 ? /* @__PURE__ */ n(
|
|
249
250
|
"span",
|
|
250
251
|
{
|
|
251
|
-
"data-testid": `${
|
|
252
|
-
className:
|
|
253
|
-
children:
|
|
252
|
+
"data-testid": `${A}-duration`,
|
|
253
|
+
className: E.duration,
|
|
254
|
+
children: x(m.durationMs)
|
|
254
255
|
}
|
|
255
256
|
) : null
|
|
256
257
|
]
|
|
257
258
|
},
|
|
258
|
-
|
|
259
|
+
m.id
|
|
259
260
|
);
|
|
260
261
|
}) })
|
|
261
262
|
},
|
|
262
|
-
|
|
263
|
+
ee
|
|
263
264
|
)
|
|
264
265
|
}
|
|
265
266
|
);
|
|
266
267
|
}
|
|
267
|
-
|
|
268
|
-
const
|
|
268
|
+
Ve.displayName = "AssistantActivity";
|
|
269
|
+
const te = "dark:bg-default-100", Ye = {
|
|
269
270
|
thinking: {
|
|
270
271
|
color: "default",
|
|
271
272
|
base: "bg-ai-fill dark:bg-ai-fill",
|
|
@@ -282,7 +283,7 @@ const V = "dark:bg-default-100", Ae = {
|
|
|
282
283
|
},
|
|
283
284
|
empty: {
|
|
284
285
|
color: "default",
|
|
285
|
-
base:
|
|
286
|
+
base: te,
|
|
286
287
|
title: "text-foreground",
|
|
287
288
|
description: "text-default-600",
|
|
288
289
|
icon: "solar:chat-round-line-linear"
|
|
@@ -303,19 +304,19 @@ const V = "dark:bg-default-100", Ae = {
|
|
|
303
304
|
},
|
|
304
305
|
offline: {
|
|
305
306
|
color: "default",
|
|
306
|
-
base:
|
|
307
|
+
base: te,
|
|
307
308
|
title: "text-foreground",
|
|
308
309
|
description: "text-default-600",
|
|
309
310
|
icon: "solar:cloud-cross-linear"
|
|
310
311
|
},
|
|
311
312
|
blocked: {
|
|
312
313
|
color: "default",
|
|
313
|
-
base:
|
|
314
|
+
base: te,
|
|
314
315
|
title: "text-foreground",
|
|
315
316
|
description: "text-default-600",
|
|
316
317
|
icon: "solar:lock-keyhole-minimalistic-linear"
|
|
317
318
|
}
|
|
318
|
-
},
|
|
319
|
+
}, k = {
|
|
319
320
|
/** Alert centres a body with no title prop; the copy here is children, so pin it to the top-left. */
|
|
320
321
|
base: "items-start gap-x-3 px-4 py-3",
|
|
321
322
|
mainWrapper: "ms-0 min-h-0 min-w-0 items-start justify-start gap-0.5",
|
|
@@ -346,10 +347,10 @@ const V = "dark:bg-default-100", Ae = {
|
|
|
346
347
|
action: "mt-2 flex flex-wrap items-center gap-2",
|
|
347
348
|
detailsToggle: "-ms-1.5 h-7 min-w-0 gap-1 px-1.5 text-xs font-medium text-current",
|
|
348
349
|
detailsWrapper: "w-full min-w-0",
|
|
349
|
-
detailsChevron: `transition-transform ${
|
|
350
|
+
detailsChevron: `transition-transform ${be}`,
|
|
350
351
|
detailsChevronOpen: "rotate-180",
|
|
351
352
|
details: "mt-1 max-h-48 overflow-auto whitespace-pre-wrap rounded-md bg-content1 p-2 font-mono text-xs text-foreground [overflow-wrap:anywhere]"
|
|
352
|
-
},
|
|
353
|
+
}, Je = {
|
|
353
354
|
thinking: "status",
|
|
354
355
|
info: "status",
|
|
355
356
|
empty: "status",
|
|
@@ -358,157 +359,157 @@ const V = "dark:bg-default-100", Ae = {
|
|
|
358
359
|
offline: "status",
|
|
359
360
|
blocked: "status"
|
|
360
361
|
};
|
|
361
|
-
function
|
|
362
|
-
kind:
|
|
363
|
-
title:
|
|
364
|
-
description:
|
|
365
|
-
elapsed:
|
|
366
|
-
action:
|
|
367
|
-
details:
|
|
368
|
-
detailsLabel:
|
|
369
|
-
icon:
|
|
370
|
-
role:
|
|
371
|
-
ariaLive:
|
|
372
|
-
className:
|
|
373
|
-
classNames:
|
|
374
|
-
"data-testid":
|
|
362
|
+
function Ze({
|
|
363
|
+
kind: e,
|
|
364
|
+
title: t,
|
|
365
|
+
description: a,
|
|
366
|
+
elapsed: r,
|
|
367
|
+
action: s,
|
|
368
|
+
details: l,
|
|
369
|
+
detailsLabel: d = "Details",
|
|
370
|
+
icon: x,
|
|
371
|
+
role: p = Je[e],
|
|
372
|
+
ariaLive: o = p === "alert" ? "assertive" : "polite",
|
|
373
|
+
className: w,
|
|
374
|
+
classNames: b = {},
|
|
375
|
+
"data-testid": g = "assistant-notice"
|
|
375
376
|
}) {
|
|
376
|
-
const
|
|
377
|
-
return /* @__PURE__ */
|
|
378
|
-
|
|
377
|
+
const i = Ye[e], v = r != null && r !== !1, m = x === void 0 ? i.icon : x, C = e === "thinking" && x === void 0 ? /* @__PURE__ */ n(we, { size: "sm", color: "current" }) : m ? /* @__PURE__ */ n(R, { icon: m, width: 20, height: 20 }) : null;
|
|
378
|
+
return /* @__PURE__ */ f(
|
|
379
|
+
Fe,
|
|
379
380
|
{
|
|
380
381
|
role: "none",
|
|
381
|
-
"data-kind":
|
|
382
|
-
"data-testid":
|
|
383
|
-
color:
|
|
382
|
+
"data-kind": e,
|
|
383
|
+
"data-testid": g,
|
|
384
|
+
color: i.color,
|
|
384
385
|
variant: "flat",
|
|
385
386
|
hideIcon: !0,
|
|
386
|
-
startContent:
|
|
387
|
+
startContent: C ? /* @__PURE__ */ n(
|
|
387
388
|
"span",
|
|
388
389
|
{
|
|
389
390
|
"aria-hidden": "true",
|
|
390
|
-
"data-testid": `${
|
|
391
|
-
className:
|
|
392
|
-
children:
|
|
391
|
+
"data-testid": `${g}-icon`,
|
|
392
|
+
className: u(k.icon, i.title),
|
|
393
|
+
children: C
|
|
393
394
|
}
|
|
394
395
|
) : void 0,
|
|
395
396
|
classNames: {
|
|
396
|
-
base:
|
|
397
|
-
mainWrapper:
|
|
397
|
+
base: u(k.base, i.base, w, b.base),
|
|
398
|
+
mainWrapper: k.mainWrapper
|
|
398
399
|
},
|
|
399
400
|
children: [
|
|
400
|
-
/* @__PURE__ */
|
|
401
|
-
/* @__PURE__ */
|
|
401
|
+
/* @__PURE__ */ f("div", { className: u(k.text, v && k.textWithClock), children: [
|
|
402
|
+
/* @__PURE__ */ f(
|
|
402
403
|
"div",
|
|
403
404
|
{
|
|
404
|
-
role:
|
|
405
|
-
"aria-live":
|
|
405
|
+
role: p,
|
|
406
|
+
"aria-live": o,
|
|
406
407
|
"aria-atomic": "true",
|
|
407
|
-
"data-testid": `${
|
|
408
|
-
className:
|
|
408
|
+
"data-testid": `${g}-live`,
|
|
409
|
+
className: k.live,
|
|
409
410
|
children: [
|
|
410
|
-
/* @__PURE__ */
|
|
411
|
+
/* @__PURE__ */ n(
|
|
411
412
|
"p",
|
|
412
413
|
{
|
|
413
|
-
"data-testid": `${
|
|
414
|
-
className:
|
|
415
|
-
children:
|
|
414
|
+
"data-testid": `${g}-title`,
|
|
415
|
+
className: u(k.title, i.title, b.title),
|
|
416
|
+
children: t
|
|
416
417
|
}
|
|
417
418
|
),
|
|
418
|
-
|
|
419
|
+
a != null && a !== !1 ? /* @__PURE__ */ n(
|
|
419
420
|
"p",
|
|
420
421
|
{
|
|
421
|
-
"data-testid": `${
|
|
422
|
-
className:
|
|
423
|
-
children:
|
|
422
|
+
"data-testid": `${g}-description`,
|
|
423
|
+
className: u(k.description, i.description, b.description),
|
|
424
|
+
children: a
|
|
424
425
|
}
|
|
425
426
|
) : null
|
|
426
427
|
]
|
|
427
428
|
}
|
|
428
429
|
),
|
|
429
|
-
|
|
430
|
+
v ? /* @__PURE__ */ n(
|
|
430
431
|
"span",
|
|
431
432
|
{
|
|
432
433
|
"aria-hidden": "true",
|
|
433
|
-
"data-testid": `${
|
|
434
|
-
className:
|
|
435
|
-
children:
|
|
434
|
+
"data-testid": `${g}-elapsed`,
|
|
435
|
+
className: u(k.elapsed, i.title),
|
|
436
|
+
children: r
|
|
436
437
|
}
|
|
437
438
|
) : null
|
|
438
439
|
] }),
|
|
439
|
-
|
|
440
|
+
s != null && s !== !1 ? /* @__PURE__ */ n(
|
|
440
441
|
"div",
|
|
441
442
|
{
|
|
442
|
-
"data-testid": `${
|
|
443
|
-
className:
|
|
444
|
-
children:
|
|
443
|
+
"data-testid": `${g}-action`,
|
|
444
|
+
className: u(k.action, b.action),
|
|
445
|
+
children: s
|
|
445
446
|
}
|
|
446
447
|
) : null,
|
|
447
|
-
|
|
448
|
-
|
|
448
|
+
l != null && l !== !1 ? /* @__PURE__ */ n(
|
|
449
|
+
Qe,
|
|
449
450
|
{
|
|
450
|
-
label:
|
|
451
|
-
toneClass:
|
|
452
|
-
className:
|
|
453
|
-
dataTestId:
|
|
454
|
-
children:
|
|
451
|
+
label: d,
|
|
452
|
+
toneClass: i.description,
|
|
453
|
+
className: b.details,
|
|
454
|
+
dataTestId: g,
|
|
455
|
+
children: l
|
|
455
456
|
}
|
|
456
457
|
) : null
|
|
457
458
|
]
|
|
458
459
|
}
|
|
459
460
|
);
|
|
460
461
|
}
|
|
461
|
-
function
|
|
462
|
-
label:
|
|
463
|
-
toneClass:
|
|
464
|
-
className:
|
|
465
|
-
dataTestId:
|
|
466
|
-
children:
|
|
462
|
+
function Qe({
|
|
463
|
+
label: e,
|
|
464
|
+
toneClass: t,
|
|
465
|
+
className: a,
|
|
466
|
+
dataTestId: r,
|
|
467
|
+
children: s
|
|
467
468
|
}) {
|
|
468
|
-
const [
|
|
469
|
-
return /* @__PURE__ */
|
|
470
|
-
/* @__PURE__ */
|
|
471
|
-
|
|
469
|
+
const [l, d] = q(!1), x = G();
|
|
470
|
+
return /* @__PURE__ */ f("div", { className: k.detailsWrapper, children: [
|
|
471
|
+
/* @__PURE__ */ n(
|
|
472
|
+
z,
|
|
472
473
|
{
|
|
473
474
|
size: "sm",
|
|
474
475
|
variant: "light",
|
|
475
476
|
color: "default",
|
|
476
477
|
radius: "sm",
|
|
477
|
-
"aria-expanded":
|
|
478
|
-
"aria-controls":
|
|
479
|
-
onPress: () =>
|
|
480
|
-
testId: `${
|
|
481
|
-
className:
|
|
482
|
-
endContent: /* @__PURE__ */
|
|
483
|
-
|
|
478
|
+
"aria-expanded": l,
|
|
479
|
+
"aria-controls": x,
|
|
480
|
+
onPress: () => d((p) => !p),
|
|
481
|
+
testId: `${r}-details-toggle`,
|
|
482
|
+
className: u(k.detailsToggle, t),
|
|
483
|
+
endContent: /* @__PURE__ */ n(
|
|
484
|
+
R,
|
|
484
485
|
{
|
|
485
486
|
icon: "solar:alt-arrow-down-linear",
|
|
486
487
|
width: 14,
|
|
487
488
|
height: 14,
|
|
488
489
|
"aria-hidden": "true",
|
|
489
|
-
className:
|
|
490
|
-
|
|
491
|
-
|
|
490
|
+
className: u(
|
|
491
|
+
k.detailsChevron,
|
|
492
|
+
l && k.detailsChevronOpen
|
|
492
493
|
)
|
|
493
494
|
}
|
|
494
495
|
),
|
|
495
|
-
children:
|
|
496
|
+
children: e
|
|
496
497
|
}
|
|
497
498
|
),
|
|
498
|
-
/* @__PURE__ */
|
|
499
|
+
/* @__PURE__ */ n(
|
|
499
500
|
"div",
|
|
500
501
|
{
|
|
501
|
-
id:
|
|
502
|
-
hidden: !
|
|
503
|
-
"data-testid": `${
|
|
504
|
-
className:
|
|
505
|
-
children:
|
|
502
|
+
id: x,
|
|
503
|
+
hidden: !l,
|
|
504
|
+
"data-testid": `${r}-details`,
|
|
505
|
+
className: u(k.details, a),
|
|
506
|
+
children: s
|
|
506
507
|
}
|
|
507
508
|
)
|
|
508
509
|
] });
|
|
509
510
|
}
|
|
510
|
-
|
|
511
|
-
const
|
|
511
|
+
Ze.displayName = "AssistantNotice";
|
|
512
|
+
const O = {
|
|
512
513
|
base: "flex w-full min-w-0 flex-col gap-2",
|
|
513
514
|
suggestions: "flex flex-wrap gap-2",
|
|
514
515
|
/**
|
|
@@ -537,254 +538,910 @@ const k = {
|
|
|
537
538
|
count: "ms-auto flex-none tabular-nums",
|
|
538
539
|
button: "flex-none"
|
|
539
540
|
};
|
|
540
|
-
function
|
|
541
|
-
value:
|
|
542
|
-
onValueChange:
|
|
543
|
-
onSubmit:
|
|
544
|
-
onStop:
|
|
545
|
-
isRunning:
|
|
546
|
-
isStopDisabled:
|
|
547
|
-
isDisabled:
|
|
548
|
-
label:
|
|
549
|
-
placeholder:
|
|
550
|
-
description:
|
|
551
|
-
sendLabel:
|
|
552
|
-
stopLabel:
|
|
553
|
-
suggestions:
|
|
554
|
-
suggestionsLabel:
|
|
555
|
-
onSuggestionSelect:
|
|
556
|
-
maxLength:
|
|
557
|
-
minRows:
|
|
558
|
-
maxRows:
|
|
559
|
-
className:
|
|
560
|
-
"data-testid":
|
|
541
|
+
function Xe({
|
|
542
|
+
value: e,
|
|
543
|
+
onValueChange: t,
|
|
544
|
+
onSubmit: a,
|
|
545
|
+
onStop: r,
|
|
546
|
+
isRunning: s = !1,
|
|
547
|
+
isStopDisabled: l = !1,
|
|
548
|
+
isDisabled: d = !1,
|
|
549
|
+
label: x,
|
|
550
|
+
placeholder: p,
|
|
551
|
+
description: o,
|
|
552
|
+
sendLabel: w = "Send",
|
|
553
|
+
stopLabel: b = "Stop",
|
|
554
|
+
suggestions: g,
|
|
555
|
+
suggestionsLabel: i = "Suggestions",
|
|
556
|
+
onSuggestionSelect: v,
|
|
557
|
+
maxLength: m,
|
|
558
|
+
minRows: C = 2,
|
|
559
|
+
maxRows: A = 8,
|
|
560
|
+
className: W,
|
|
561
|
+
"data-testid": M = "assistant-composer"
|
|
561
562
|
}) {
|
|
562
|
-
const
|
|
563
|
-
|
|
564
|
-
},
|
|
565
|
-
|
|
566
|
-
},
|
|
567
|
-
|
|
568
|
-
},
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
}, [
|
|
572
|
-
|
|
573
|
-
}, [
|
|
574
|
-
const
|
|
575
|
-
|
|
576
|
-
},
|
|
577
|
-
const
|
|
578
|
-
|
|
579
|
-
},
|
|
580
|
-
|
|
581
|
-
|
|
563
|
+
const _ = F(null), j = G(), $ = e.trim(), B = m === void 0 || e.length <= m, h = !d && !s && $.length > 0 && B, c = s && r !== void 0, N = () => {
|
|
564
|
+
h && a($);
|
|
565
|
+
}, L = () => _.current?.focus(), H = (y) => {
|
|
566
|
+
y.target === _.current && (y.key !== "Enter" || y.shiftKey || y.nativeEvent.isComposing || y.keyCode === 229 || (y.preventDefault(), N()));
|
|
567
|
+
}, V = (y) => {
|
|
568
|
+
y.preventDefault(), N(), L();
|
|
569
|
+
}, P = F(!1), ie = F(c);
|
|
570
|
+
re(() => {
|
|
571
|
+
ie.current && !c && P.current && (P.current = !1, _.current?.focus()), ie.current = c;
|
|
572
|
+
}, [c]), re(() => {
|
|
573
|
+
l && P.current && (P.current = !1, _.current?.focus());
|
|
574
|
+
}, [l]);
|
|
575
|
+
const Ce = () => {
|
|
576
|
+
L(), r?.();
|
|
577
|
+
}, Ae = (y) => {
|
|
578
|
+
const ce = y.prompt ?? y.label;
|
|
579
|
+
t(m === void 0 ? ce : ce.slice(0, m)), _.current?.focus(), v?.(y);
|
|
580
|
+
}, Q = m !== void 0 ? `${e.length}/${m}` : null, oe = D(o) || Q ? /* @__PURE__ */ f("p", { id: j, "data-testid": `${M}-helper`, className: O.helper, children: [
|
|
581
|
+
D(o) ? /* @__PURE__ */ n("span", { children: o }) : null,
|
|
582
|
+
Q ? /* @__PURE__ */ n("span", { "data-testid": `${M}-count`, className: O.count, children: Q }) : null
|
|
582
583
|
] }) : null;
|
|
583
|
-
return /* @__PURE__ */
|
|
584
|
+
return /* @__PURE__ */ f(
|
|
584
585
|
"form",
|
|
585
586
|
{
|
|
586
587
|
noValidate: !0,
|
|
587
|
-
"data-testid":
|
|
588
|
-
"data-running":
|
|
589
|
-
onSubmit:
|
|
590
|
-
onKeyDown:
|
|
591
|
-
className:
|
|
588
|
+
"data-testid": M,
|
|
589
|
+
"data-running": s || void 0,
|
|
590
|
+
onSubmit: V,
|
|
591
|
+
onKeyDown: H,
|
|
592
|
+
className: u(O.base, W),
|
|
592
593
|
children: [
|
|
593
|
-
|
|
594
|
+
g && g.length > 0 ? /* @__PURE__ */ n(
|
|
594
595
|
"div",
|
|
595
596
|
{
|
|
596
597
|
role: "group",
|
|
597
|
-
"aria-label":
|
|
598
|
-
"data-testid": `${
|
|
599
|
-
className:
|
|
600
|
-
children:
|
|
601
|
-
|
|
598
|
+
"aria-label": i,
|
|
599
|
+
"data-testid": `${M}-suggestions`,
|
|
600
|
+
className: O.suggestions,
|
|
601
|
+
children: g.map((y) => /* @__PURE__ */ n(
|
|
602
|
+
z,
|
|
602
603
|
{
|
|
603
604
|
type: "button",
|
|
604
605
|
size: "sm",
|
|
605
606
|
variant: "flat",
|
|
606
607
|
color: "default",
|
|
607
|
-
isDisabled:
|
|
608
|
-
onPress: () =>
|
|
609
|
-
testId: `${
|
|
610
|
-
className:
|
|
611
|
-
children:
|
|
608
|
+
isDisabled: d,
|
|
609
|
+
onPress: () => Ae(y),
|
|
610
|
+
testId: `${M}-suggestion-${y.key}`,
|
|
611
|
+
className: O.suggestion,
|
|
612
|
+
children: y.label
|
|
612
613
|
},
|
|
613
|
-
|
|
614
|
+
y.key
|
|
614
615
|
))
|
|
615
616
|
}
|
|
616
617
|
) : null,
|
|
617
|
-
/* @__PURE__ */
|
|
618
|
+
/* @__PURE__ */ f(
|
|
618
619
|
"div",
|
|
619
620
|
{
|
|
620
|
-
className:
|
|
621
|
-
onMouseDown: (
|
|
622
|
-
|
|
621
|
+
className: O.row,
|
|
622
|
+
onMouseDown: (y) => {
|
|
623
|
+
y.target === y.currentTarget && y.preventDefault();
|
|
623
624
|
},
|
|
624
625
|
children: [
|
|
625
|
-
/* @__PURE__ */
|
|
626
|
-
|
|
626
|
+
/* @__PURE__ */ n(
|
|
627
|
+
Re,
|
|
627
628
|
{
|
|
628
|
-
ref:
|
|
629
|
-
"aria-label":
|
|
630
|
-
placeholder:
|
|
631
|
-
value:
|
|
632
|
-
onValueChange:
|
|
633
|
-
isDisabled:
|
|
634
|
-
maxLength:
|
|
635
|
-
minRows:
|
|
636
|
-
maxRows:
|
|
629
|
+
ref: _,
|
|
630
|
+
"aria-label": x,
|
|
631
|
+
placeholder: p,
|
|
632
|
+
value: e,
|
|
633
|
+
onValueChange: t,
|
|
634
|
+
isDisabled: d,
|
|
635
|
+
maxLength: m,
|
|
636
|
+
minRows: C,
|
|
637
|
+
maxRows: A,
|
|
637
638
|
variant: "bordered",
|
|
638
|
-
"aria-describedby":
|
|
639
|
-
"data-testid": `${
|
|
640
|
-
className:
|
|
639
|
+
"aria-describedby": oe ? j : void 0,
|
|
640
|
+
"data-testid": `${M}-field`,
|
|
641
|
+
className: O.field,
|
|
641
642
|
classNames: {
|
|
642
|
-
inputWrapper:
|
|
643
|
-
input:
|
|
643
|
+
inputWrapper: O.inputWrapper,
|
|
644
|
+
input: O.input
|
|
644
645
|
}
|
|
645
646
|
}
|
|
646
647
|
),
|
|
647
|
-
|
|
648
|
-
|
|
648
|
+
c ? /* @__PURE__ */ n(
|
|
649
|
+
z,
|
|
649
650
|
{
|
|
650
651
|
type: "button",
|
|
651
652
|
isIconOnly: !0,
|
|
652
653
|
color: "default",
|
|
653
654
|
variant: "flat",
|
|
654
|
-
"aria-label":
|
|
655
|
-
isDisabled:
|
|
656
|
-
onPress:
|
|
655
|
+
"aria-label": b,
|
|
656
|
+
isDisabled: l,
|
|
657
|
+
onPress: Ce,
|
|
657
658
|
onFocus: () => {
|
|
658
|
-
|
|
659
|
+
P.current = !0;
|
|
659
660
|
},
|
|
660
|
-
onBlur: (
|
|
661
|
-
|
|
661
|
+
onBlur: (y) => {
|
|
662
|
+
y.target.disabled || (P.current = !1);
|
|
662
663
|
},
|
|
663
|
-
testId: `${
|
|
664
|
-
className:
|
|
665
|
-
children: /* @__PURE__ */
|
|
664
|
+
testId: `${M}-stop`,
|
|
665
|
+
className: O.button,
|
|
666
|
+
children: /* @__PURE__ */ n(R, { icon: "solar:stop-bold", width: 18, height: 18, "aria-hidden": "true" })
|
|
666
667
|
},
|
|
667
668
|
"stop"
|
|
668
|
-
) : /* @__PURE__ */
|
|
669
|
-
|
|
669
|
+
) : /* @__PURE__ */ n(
|
|
670
|
+
z,
|
|
670
671
|
{
|
|
671
672
|
type: "submit",
|
|
672
673
|
isIconOnly: !0,
|
|
673
674
|
color: "primary",
|
|
674
|
-
"aria-label":
|
|
675
|
-
isDisabled: !
|
|
676
|
-
testId: `${
|
|
677
|
-
className:
|
|
678
|
-
children: /* @__PURE__ */
|
|
675
|
+
"aria-label": w,
|
|
676
|
+
isDisabled: !h,
|
|
677
|
+
testId: `${M}-send`,
|
|
678
|
+
className: O.button,
|
|
679
|
+
children: /* @__PURE__ */ n(R, { icon: "solar:arrow-up-linear", width: 18, height: 18, "aria-hidden": "true" })
|
|
679
680
|
},
|
|
680
681
|
"send"
|
|
681
682
|
)
|
|
682
683
|
]
|
|
683
684
|
}
|
|
684
685
|
),
|
|
685
|
-
|
|
686
|
+
oe
|
|
686
687
|
]
|
|
687
688
|
}
|
|
688
689
|
);
|
|
689
690
|
}
|
|
690
|
-
|
|
691
|
-
const
|
|
691
|
+
Xe.displayName = "AssistantComposer";
|
|
692
|
+
const K = {
|
|
692
693
|
base: "relative flex min-h-0 w-full flex-col",
|
|
693
694
|
scroller: "min-h-0 flex-1 overflow-y-auto overscroll-contain rounded-[inherit] outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ai-focus",
|
|
694
695
|
content: "min-w-0",
|
|
695
696
|
jumpBar: "pointer-events-none absolute inset-x-0 bottom-3 flex justify-center",
|
|
696
697
|
jump: "pointer-events-auto border border-divider bg-content1 text-foreground shadow-medium"
|
|
697
|
-
},
|
|
698
|
-
function
|
|
699
|
-
children:
|
|
700
|
-
label:
|
|
701
|
-
followKey:
|
|
702
|
-
jumpLabel:
|
|
703
|
-
onFollowChange:
|
|
704
|
-
threshold:
|
|
705
|
-
className:
|
|
706
|
-
classNames:
|
|
707
|
-
"data-testid":
|
|
698
|
+
}, de = (e, t) => e.scrollHeight - e.scrollTop - e.clientHeight <= t, ue = (e) => e.clientHeight > 0;
|
|
699
|
+
function et({
|
|
700
|
+
children: e,
|
|
701
|
+
label: t,
|
|
702
|
+
followKey: a,
|
|
703
|
+
jumpLabel: r = "Jump to newest",
|
|
704
|
+
onFollowChange: s,
|
|
705
|
+
threshold: l = 32,
|
|
706
|
+
className: d,
|
|
707
|
+
classNames: x = {},
|
|
708
|
+
"data-testid": p = "scroll-to-latest"
|
|
708
709
|
}) {
|
|
709
|
-
const
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
}, [
|
|
713
|
-
|
|
714
|
-
}, [
|
|
715
|
-
const
|
|
716
|
-
|
|
717
|
-
}, []),
|
|
718
|
-
const
|
|
719
|
-
|
|
720
|
-
}, [
|
|
721
|
-
const
|
|
722
|
-
|
|
710
|
+
const o = F(null), w = F(null), b = F(!0), g = F(0), i = F(s), v = F(l), [m, C] = q(!0), [A, W] = q(!1), M = le();
|
|
711
|
+
Z(() => {
|
|
712
|
+
i.current = s;
|
|
713
|
+
}, [s]), Z(() => {
|
|
714
|
+
v.current = l;
|
|
715
|
+
}, [l]);
|
|
716
|
+
const _ = X((c) => {
|
|
717
|
+
b.current !== c && (b.current = c, C(c), i.current?.(c));
|
|
718
|
+
}, []), j = X(() => {
|
|
719
|
+
const c = o.current;
|
|
720
|
+
c && (W(c.scrollHeight > c.clientHeight), ue(c) && de(c, v.current) && _(!0));
|
|
721
|
+
}, [_]), $ = X((c) => {
|
|
722
|
+
const N = o.current;
|
|
723
|
+
N && (typeof N.scrollTo == "function" ? N.scrollTo({ top: N.scrollHeight, behavior: c }) : N.scrollTop = N.scrollHeight, g.current = N.scrollTop);
|
|
723
724
|
}, []);
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
}, [
|
|
727
|
-
const
|
|
728
|
-
if (!
|
|
729
|
-
const
|
|
730
|
-
|
|
725
|
+
re(() => {
|
|
726
|
+
b.current && $("auto"), j();
|
|
727
|
+
}, [a, $, j]), Z(() => {
|
|
728
|
+
const c = w.current, N = o.current;
|
|
729
|
+
if (!c || !N || typeof ResizeObserver > "u") return;
|
|
730
|
+
const L = new ResizeObserver(() => {
|
|
731
|
+
b.current && $("auto"), j();
|
|
731
732
|
});
|
|
732
|
-
return
|
|
733
|
-
}, [j
|
|
733
|
+
return L.observe(c), L.observe(N), () => L.disconnect();
|
|
734
|
+
}, [$, j]);
|
|
734
735
|
const B = () => {
|
|
735
|
-
const
|
|
736
|
-
if (!
|
|
737
|
-
const
|
|
738
|
-
|
|
739
|
-
},
|
|
740
|
-
|
|
736
|
+
const c = o.current;
|
|
737
|
+
if (!c || !ue(c)) return;
|
|
738
|
+
const N = c.scrollTop;
|
|
739
|
+
de(c, l) ? _(!0) : N < g.current - 1 && _(!1), g.current = N, j();
|
|
740
|
+
}, h = () => {
|
|
741
|
+
_(!0), $(M ? "auto" : "smooth"), o.current?.focus({ preventScroll: !0 });
|
|
741
742
|
};
|
|
742
|
-
return /* @__PURE__ */
|
|
743
|
+
return /* @__PURE__ */ f(
|
|
743
744
|
"div",
|
|
744
745
|
{
|
|
745
|
-
"data-testid":
|
|
746
|
-
"data-following":
|
|
747
|
-
className:
|
|
746
|
+
"data-testid": p,
|
|
747
|
+
"data-following": m,
|
|
748
|
+
className: u(K.base, d, x.base),
|
|
748
749
|
children: [
|
|
749
|
-
/* @__PURE__ */
|
|
750
|
-
|
|
750
|
+
/* @__PURE__ */ n(
|
|
751
|
+
Oe,
|
|
751
752
|
{
|
|
752
|
-
ref:
|
|
753
|
+
ref: o,
|
|
753
754
|
role: "region",
|
|
754
|
-
"aria-label":
|
|
755
|
+
"aria-label": t,
|
|
755
756
|
tabIndex: 0,
|
|
756
757
|
size: 24,
|
|
757
758
|
onScroll: B,
|
|
758
|
-
"data-testid": `${
|
|
759
|
-
className:
|
|
760
|
-
children: /* @__PURE__ */
|
|
759
|
+
"data-testid": `${p}-scroller`,
|
|
760
|
+
className: u(K.scroller, x.scroller),
|
|
761
|
+
children: /* @__PURE__ */ n("div", { ref: w, className: u(K.content, x.content), children: e })
|
|
761
762
|
}
|
|
762
763
|
),
|
|
763
|
-
!
|
|
764
|
-
|
|
764
|
+
!m && A ? /* @__PURE__ */ n("div", { className: K.jumpBar, children: /* @__PURE__ */ n(
|
|
765
|
+
z,
|
|
765
766
|
{
|
|
766
767
|
type: "button",
|
|
767
768
|
size: "sm",
|
|
768
769
|
radius: "full",
|
|
769
770
|
color: "default",
|
|
770
771
|
variant: "solid",
|
|
771
|
-
onPress:
|
|
772
|
-
testId: `${
|
|
773
|
-
startContent: /* @__PURE__ */
|
|
774
|
-
className:
|
|
775
|
-
children:
|
|
772
|
+
onPress: h,
|
|
773
|
+
testId: `${p}-jump`,
|
|
774
|
+
startContent: /* @__PURE__ */ n(R, { icon: "solar:arrow-down-linear", width: 16, height: 16, "aria-hidden": "true" }),
|
|
775
|
+
className: u(K.jump, x.jump),
|
|
776
|
+
children: r
|
|
776
777
|
}
|
|
777
778
|
) }) : null
|
|
778
779
|
]
|
|
779
780
|
}
|
|
780
781
|
);
|
|
781
782
|
}
|
|
782
|
-
|
|
783
|
+
et.displayName = "ScrollToLatest";
|
|
784
|
+
const I = {
|
|
785
|
+
root: "min-w-0 space-y-3 text-sm leading-relaxed text-foreground [overflow-wrap:anywhere]",
|
|
786
|
+
paragraph: "m-0",
|
|
787
|
+
heading: {
|
|
788
|
+
1: "m-0 text-xl font-bold",
|
|
789
|
+
2: "m-0 text-lg font-semibold",
|
|
790
|
+
3: "m-0 text-base font-semibold",
|
|
791
|
+
4: "m-0 text-sm font-semibold",
|
|
792
|
+
5: "m-0 text-sm font-semibold",
|
|
793
|
+
6: "m-0 text-sm font-medium"
|
|
794
|
+
},
|
|
795
|
+
bulletList: "m-0 list-disc space-y-1 ps-5",
|
|
796
|
+
orderedList: "m-0 list-decimal space-y-1 ps-5",
|
|
797
|
+
listItem: "ps-1 [&>ol]:mt-1 [&>ul]:mt-1",
|
|
798
|
+
/** Quoted third-party text (an email, a call note): set apart, never styled as the assistant's own words. */
|
|
799
|
+
blockquote: "m-0 space-y-2 border-s-2 border-default-300 ps-3 text-default-600",
|
|
800
|
+
code: "rounded bg-default-100 px-1 py-0.5 font-mono text-[0.8125em]",
|
|
801
|
+
/** The code block's scroll box: named and focusable like the table's, so a long line can be scrolled by keyboard in every browser. */
|
|
802
|
+
codeWrap: "max-w-full overflow-x-auto rounded-md bg-default-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ai-focus",
|
|
803
|
+
pre: "m-0 whitespace-pre p-3 font-mono text-xs [overflow-wrap:normal]",
|
|
804
|
+
rule: "my-3 border-0 border-t border-divider",
|
|
805
|
+
tableWrap: "max-w-full overflow-x-auto rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ai-focus",
|
|
806
|
+
table: "w-full border-collapse text-sm",
|
|
807
|
+
/**
|
|
808
|
+
* Cells break between words only (the root's `overflow-wrap: anywhere`
|
|
809
|
+
* would split them mid-word and squeeze a wide table to fit), and headers
|
|
810
|
+
* stay on one line, so a wide table scrolls inside its box instead.
|
|
811
|
+
*/
|
|
812
|
+
headerCell: "whitespace-nowrap border-b border-divider px-2 py-1.5 font-semibold",
|
|
813
|
+
cell: "border-b border-divider px-2 py-1.5 align-top [overflow-wrap:normal]",
|
|
814
|
+
align: { left: "text-start", center: "text-center", right: "text-end" },
|
|
815
|
+
link: "text-ai-accent underline underline-offset-2 hover:no-underline",
|
|
816
|
+
/**
|
|
817
|
+
* `inline-block` keeps the link's underline off the domain. `isolate`
|
|
818
|
+
* keeps a bidi control in the link's text from changing how the domain
|
|
819
|
+
* reads, even if the box stops being an inline-block.
|
|
820
|
+
*/
|
|
821
|
+
linkDomain: "inline-block text-default-500 [unicode-bidi:isolate]",
|
|
822
|
+
srOnly: "sr-only"
|
|
823
|
+
}, tt = [
|
|
824
|
+
"reference",
|
|
825
|
+
"autolink",
|
|
826
|
+
"html_block",
|
|
827
|
+
"html_inline",
|
|
828
|
+
"strikethrough",
|
|
829
|
+
"replacements",
|
|
830
|
+
"smartquotes",
|
|
831
|
+
"linkify",
|
|
832
|
+
"text_join"
|
|
833
|
+
];
|
|
834
|
+
let Y = null;
|
|
835
|
+
function nt() {
|
|
836
|
+
return Y || (Y = new Pe("default", { html: !1, linkify: !1, typographer: !1, breaks: !1 }), Y.disable(tt, !0)), Y;
|
|
837
|
+
}
|
|
838
|
+
function rt(e) {
|
|
839
|
+
let t = 0, a = e.length;
|
|
840
|
+
for (; t < a && e.charCodeAt(t) <= 32; ) t += 1;
|
|
841
|
+
for (; a > t && e.charCodeAt(a - 1) <= 32; ) a -= 1;
|
|
842
|
+
return e.slice(t, a).replace(/[\t\n\r]/g, "");
|
|
843
|
+
}
|
|
844
|
+
const at = /^([a-z][a-z\d+.-]*):/i, st = /[\p{Cc}\p{Cf}\p{Z}]/u;
|
|
845
|
+
function Ne(e) {
|
|
846
|
+
let t;
|
|
847
|
+
try {
|
|
848
|
+
t = decodeURIComponent(e.pathname);
|
|
849
|
+
} catch {
|
|
850
|
+
return null;
|
|
851
|
+
}
|
|
852
|
+
return t && !st.test(t) ? t : null;
|
|
853
|
+
}
|
|
854
|
+
function lt(e) {
|
|
855
|
+
const t = e.indexOf("=");
|
|
856
|
+
if (t < 0) return !1;
|
|
857
|
+
let a, r;
|
|
858
|
+
try {
|
|
859
|
+
a = decodeURIComponent(e.slice(0, t)).toLowerCase(), r = decodeURIComponent(e.slice(t + 1));
|
|
860
|
+
} catch {
|
|
861
|
+
return !1;
|
|
862
|
+
}
|
|
863
|
+
return r.includes("&") ? !1 : a === "body" ? !0 : a === "subject" && !new RegExp("\\p{Cc}", "u").test(r);
|
|
864
|
+
}
|
|
865
|
+
function it(e) {
|
|
866
|
+
if (!Ne(e)) return null;
|
|
867
|
+
const t = e.search.slice(1).split("&").filter(lt);
|
|
868
|
+
return `mailto:${e.pathname}${t.length > 0 ? `?${t.join("&")}` : ""}`;
|
|
869
|
+
}
|
|
870
|
+
function ae(e) {
|
|
871
|
+
const t = rt(e), a = at.exec(t)?.[1].toLowerCase();
|
|
872
|
+
if (a === "http" || a === "https") {
|
|
873
|
+
if (!/^https?:\/\//i.test(t)) return null;
|
|
874
|
+
try {
|
|
875
|
+
return new URL(t).href;
|
|
876
|
+
} catch {
|
|
877
|
+
return null;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
if (a === "mailto")
|
|
881
|
+
try {
|
|
882
|
+
return it(new URL(t));
|
|
883
|
+
} catch {
|
|
884
|
+
return null;
|
|
885
|
+
}
|
|
886
|
+
return a || /^[/\\]{2}/.test(t) ? null : e;
|
|
887
|
+
}
|
|
888
|
+
const ot = (e) => {
|
|
889
|
+
if (/^https?:/i.test(e)) return ae(e);
|
|
890
|
+
if (/^mailto:/i.test(e)) {
|
|
891
|
+
const t = e.slice(7).split(/[?#]/)[0];
|
|
892
|
+
return t ? ae(`mailto:${t}`) : null;
|
|
893
|
+
}
|
|
894
|
+
return null;
|
|
895
|
+
};
|
|
896
|
+
function ct(e) {
|
|
897
|
+
try {
|
|
898
|
+
const t = new URL(e);
|
|
899
|
+
return t.protocol === "http:" || t.protocol === "https:" ? t.hostname.replace(/^www\./, "") : t.protocol === "mailto:" ? Ne(t) ?? "" : "";
|
|
900
|
+
} catch {
|
|
901
|
+
return "";
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
function se(e) {
|
|
905
|
+
const t = [], a = [t];
|
|
906
|
+
for (const r of e) {
|
|
907
|
+
const s = a[a.length - 1];
|
|
908
|
+
if (r.nesting === 1) {
|
|
909
|
+
const l = { token: r, children: [] };
|
|
910
|
+
s.push(l), a.push(l.children);
|
|
911
|
+
} else r.nesting === -1 ? a.length > 1 && a.pop() : s.push({ token: r, children: [] });
|
|
912
|
+
}
|
|
913
|
+
return t;
|
|
914
|
+
}
|
|
915
|
+
const fe = /(\[[1-9]\d{0,2}\])/;
|
|
916
|
+
function dt(e, t, a) {
|
|
917
|
+
return !t.renderCitation || t.inLink || !fe.test(e) ? e : /* @__PURE__ */ n(U, { children: e.split(fe).map((r, s) => {
|
|
918
|
+
const l = /^\[([1-9]\d{0,2})\]$/.exec(r);
|
|
919
|
+
return l ? /* @__PURE__ */ n(U, { children: t.renderCitation?.(Number(l[1])) }, s) : r;
|
|
920
|
+
}) }, a);
|
|
921
|
+
}
|
|
922
|
+
function ut(e, t, a, r) {
|
|
923
|
+
const s = a.linkPolicy(e.attrGet("href") ?? ""), l = s ? ae(s) : null;
|
|
924
|
+
if (!l) return /* @__PURE__ */ n(U, { children: t }, r);
|
|
925
|
+
const d = ct(l);
|
|
926
|
+
return /* @__PURE__ */ f(
|
|
927
|
+
"a",
|
|
928
|
+
{
|
|
929
|
+
href: l,
|
|
930
|
+
target: "_blank",
|
|
931
|
+
rel: "noopener noreferrer nofollow",
|
|
932
|
+
"data-testid": `${a.dataTestId}-link`,
|
|
933
|
+
className: I.link,
|
|
934
|
+
children: [
|
|
935
|
+
t,
|
|
936
|
+
d ? /* @__PURE__ */ f("span", { className: I.linkDomain, children: [
|
|
937
|
+
" (",
|
|
938
|
+
d,
|
|
939
|
+
")"
|
|
940
|
+
] }) : null,
|
|
941
|
+
/* @__PURE__ */ f("span", { className: I.srOnly, children: [
|
|
942
|
+
" (",
|
|
943
|
+
a.newTabLabel,
|
|
944
|
+
")"
|
|
945
|
+
] })
|
|
946
|
+
]
|
|
947
|
+
},
|
|
948
|
+
r
|
|
949
|
+
);
|
|
950
|
+
}
|
|
951
|
+
function pe(e) {
|
|
952
|
+
const t = /text-align:\s*(left|center|right)/.exec(e.attrGet("style") ?? "");
|
|
953
|
+
return t ? I.align[t[1]] : void 0;
|
|
954
|
+
}
|
|
955
|
+
function T(e, t, a) {
|
|
956
|
+
return e.map((r, s) => ft(r, t, `${a}.${s}`));
|
|
957
|
+
}
|
|
958
|
+
function ft({ token: e, children: t }, a, r) {
|
|
959
|
+
const s = () => T(t, a, r), l = I;
|
|
960
|
+
switch (e.type) {
|
|
961
|
+
case "paragraph_open":
|
|
962
|
+
return e.hidden ? /* @__PURE__ */ n(U, { children: s() }, r) : /* @__PURE__ */ n("p", { className: l.paragraph, children: s() }, r);
|
|
963
|
+
case "heading_open": {
|
|
964
|
+
const d = Math.min(6, Math.max(1, Number(e.tag.slice(1)) + a.headingOffset));
|
|
965
|
+
return Se(`h${d}`, { key: r, className: l.heading[d] }, s());
|
|
966
|
+
}
|
|
967
|
+
case "bullet_list_open":
|
|
968
|
+
return /* @__PURE__ */ n("ul", { className: l.bulletList, children: s() }, r);
|
|
969
|
+
case "ordered_list_open": {
|
|
970
|
+
const d = Number(e.attrGet("start") ?? 1);
|
|
971
|
+
return /* @__PURE__ */ n("ol", { start: d === 1 ? void 0 : d, className: l.orderedList, children: s() }, r);
|
|
972
|
+
}
|
|
973
|
+
case "list_item_open":
|
|
974
|
+
return /* @__PURE__ */ n("li", { className: l.listItem, children: s() }, r);
|
|
975
|
+
case "blockquote_open":
|
|
976
|
+
return /* @__PURE__ */ n("blockquote", { className: l.blockquote, children: s() }, r);
|
|
977
|
+
case "table_open":
|
|
978
|
+
return /* @__PURE__ */ n(
|
|
979
|
+
"div",
|
|
980
|
+
{
|
|
981
|
+
role: "group",
|
|
982
|
+
"aria-label": a.tableLabel,
|
|
983
|
+
tabIndex: 0,
|
|
984
|
+
"data-testid": `${a.dataTestId}-table`,
|
|
985
|
+
className: l.tableWrap,
|
|
986
|
+
children: /* @__PURE__ */ n("table", { className: l.table, children: s() })
|
|
987
|
+
},
|
|
988
|
+
r
|
|
989
|
+
);
|
|
990
|
+
case "thead_open":
|
|
991
|
+
return /* @__PURE__ */ n("thead", { children: s() }, r);
|
|
992
|
+
case "tbody_open":
|
|
993
|
+
return /* @__PURE__ */ n("tbody", { children: s() }, r);
|
|
994
|
+
case "tr_open":
|
|
995
|
+
return /* @__PURE__ */ n("tr", { children: s() }, r);
|
|
996
|
+
case "th_open":
|
|
997
|
+
return /* @__PURE__ */ n("th", { scope: "col", className: u(l.headerCell, pe(e) ?? l.align.left), children: s() }, r);
|
|
998
|
+
case "td_open":
|
|
999
|
+
return /* @__PURE__ */ n("td", { className: u(l.cell, pe(e)), children: s() }, r);
|
|
1000
|
+
case "strong_open":
|
|
1001
|
+
return /* @__PURE__ */ n("strong", { children: s() }, r);
|
|
1002
|
+
case "em_open":
|
|
1003
|
+
return /* @__PURE__ */ n("em", { children: s() }, r);
|
|
1004
|
+
case "link_open":
|
|
1005
|
+
return ut(e, T(t, { ...a, inLink: !0 }, r), a, r);
|
|
1006
|
+
case "inline":
|
|
1007
|
+
return /* @__PURE__ */ n(U, { children: T(se(e.children ?? []), a, r) }, r);
|
|
1008
|
+
case "text":
|
|
1009
|
+
return dt(e.content, a, r);
|
|
1010
|
+
case "text_special":
|
|
1011
|
+
return e.content;
|
|
1012
|
+
case "softbreak":
|
|
1013
|
+
return `
|
|
1014
|
+
`;
|
|
1015
|
+
case "hardbreak":
|
|
1016
|
+
return /* @__PURE__ */ n("br", {}, r);
|
|
1017
|
+
case "code_inline":
|
|
1018
|
+
return /* @__PURE__ */ n("code", { className: l.code, children: e.content }, r);
|
|
1019
|
+
case "code_block":
|
|
1020
|
+
case "fence":
|
|
1021
|
+
return /* @__PURE__ */ n(
|
|
1022
|
+
"div",
|
|
1023
|
+
{
|
|
1024
|
+
role: "group",
|
|
1025
|
+
"aria-label": a.codeLabel,
|
|
1026
|
+
tabIndex: 0,
|
|
1027
|
+
"data-testid": `${a.dataTestId}-code`,
|
|
1028
|
+
className: l.codeWrap,
|
|
1029
|
+
children: /* @__PURE__ */ n("pre", { className: l.pre, children: /* @__PURE__ */ n("code", { children: e.content }) })
|
|
1030
|
+
},
|
|
1031
|
+
r
|
|
1032
|
+
);
|
|
1033
|
+
case "hr":
|
|
1034
|
+
return /* @__PURE__ */ n("hr", { className: l.rule }, r);
|
|
1035
|
+
case "image":
|
|
1036
|
+
return /* @__PURE__ */ n(U, { children: T(se(e.children ?? []), a, r) }, r);
|
|
1037
|
+
default:
|
|
1038
|
+
return t.length > 0 ? /* @__PURE__ */ n(U, { children: s() }, r) : e.content ? /* @__PURE__ */ n(U, { children: e.content }, r) : null;
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
function pt({
|
|
1042
|
+
source: e,
|
|
1043
|
+
linkPolicy: t = ot,
|
|
1044
|
+
headingOffset: a = 2,
|
|
1045
|
+
renderCitation: r,
|
|
1046
|
+
newTabLabel: s = "opens in a new tab",
|
|
1047
|
+
tableLabel: l = "Table",
|
|
1048
|
+
codeLabel: d = "Code",
|
|
1049
|
+
className: x,
|
|
1050
|
+
"data-testid": p = "assistant-markdown"
|
|
1051
|
+
}) {
|
|
1052
|
+
const o = he(() => se(nt().parse(e, {})), [e]), w = {
|
|
1053
|
+
// A whole number of levels: `1.5` or `NaN` would make an `h2.5` or `hNaN` element.
|
|
1054
|
+
headingOffset: Number.isFinite(a) ? Math.trunc(a) : 2,
|
|
1055
|
+
linkPolicy: t,
|
|
1056
|
+
renderCitation: r,
|
|
1057
|
+
newTabLabel: s,
|
|
1058
|
+
tableLabel: l,
|
|
1059
|
+
codeLabel: d,
|
|
1060
|
+
dataTestId: p,
|
|
1061
|
+
inLink: !1
|
|
1062
|
+
};
|
|
1063
|
+
return /* @__PURE__ */ n("div", { "data-testid": p, className: u(I.root, x), children: T(o, w, "md") });
|
|
1064
|
+
}
|
|
1065
|
+
pt.displayName = "AssistantMarkdown";
|
|
1066
|
+
const ye = "inline-flex items-center rounded border border-ai-border bg-ai-fill px-1 text-[0.6875rem] font-semibold leading-4 tabular-nums text-ai-accent", J = {
|
|
1067
|
+
/**
|
|
1068
|
+
* Inline in a sentence: baseline-aligned, a left margin only (a right one
|
|
1069
|
+
* would strand the punctuation after it), no fixed height.
|
|
1070
|
+
*/
|
|
1071
|
+
base: `ms-0.5 align-baseline ${ye}`,
|
|
1072
|
+
interactive: "cursor-pointer transition-colors hover:border-ai-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ai-focus motion-reduce:transition-none",
|
|
1073
|
+
srOnly: "sr-only"
|
|
1074
|
+
};
|
|
1075
|
+
function mt({
|
|
1076
|
+
index: e,
|
|
1077
|
+
label: t,
|
|
1078
|
+
onSelect: a,
|
|
1079
|
+
"data-testid": r = `citation-marker-${e}`
|
|
1080
|
+
}) {
|
|
1081
|
+
return a ? /* @__PURE__ */ f(
|
|
1082
|
+
"button",
|
|
1083
|
+
{
|
|
1084
|
+
type: "button",
|
|
1085
|
+
"aria-label": t,
|
|
1086
|
+
onClick: a,
|
|
1087
|
+
"data-testid": r,
|
|
1088
|
+
className: u(J.base, J.interactive),
|
|
1089
|
+
children: [
|
|
1090
|
+
"[",
|
|
1091
|
+
e,
|
|
1092
|
+
"]"
|
|
1093
|
+
]
|
|
1094
|
+
}
|
|
1095
|
+
) : /* @__PURE__ */ f("span", { "data-testid": r, className: J.base, children: [
|
|
1096
|
+
/* @__PURE__ */ f("span", { "aria-hidden": "true", children: [
|
|
1097
|
+
"[",
|
|
1098
|
+
e,
|
|
1099
|
+
"]"
|
|
1100
|
+
] }),
|
|
1101
|
+
/* @__PURE__ */ n("span", { className: J.srOnly, children: t })
|
|
1102
|
+
] });
|
|
1103
|
+
}
|
|
1104
|
+
mt.displayName = "CitationMarker";
|
|
1105
|
+
const ht = {
|
|
1106
|
+
base: "inline-flex h-auto min-h-8 min-w-0 max-w-full items-center justify-start gap-1.5 rounded-full border border-default-200 bg-content1 px-2.5 py-1 text-xs text-foreground",
|
|
1107
|
+
interactive: "data-[hover=true]:bg-default-100 data-[focus-visible=true]:outline-none data-[focus-visible=true]:ring-2 data-[focus-visible=true]:ring-ai-focus",
|
|
1108
|
+
disabled: "border-dashed",
|
|
1109
|
+
/** The same badge as `CitationMarker`, so `[n]` in the text and on the pill match. */
|
|
1110
|
+
marker: `flex-none ${ye}`,
|
|
1111
|
+
srOnly: "sr-only",
|
|
1112
|
+
icon: "flex-none text-default-600",
|
|
1113
|
+
kind: "flex-none font-semibold",
|
|
1114
|
+
title: "min-w-0 truncate",
|
|
1115
|
+
date: "flex-none tabular-nums text-default-600",
|
|
1116
|
+
reason: "flex flex-none items-center gap-1 text-default-600",
|
|
1117
|
+
separator: "flex-none text-default-600"
|
|
1118
|
+
};
|
|
1119
|
+
function $e({
|
|
1120
|
+
kindLabel: e,
|
|
1121
|
+
title: t,
|
|
1122
|
+
date: a,
|
|
1123
|
+
icon: r,
|
|
1124
|
+
marker: s,
|
|
1125
|
+
onOpen: l,
|
|
1126
|
+
isDisabled: d = !1,
|
|
1127
|
+
disabledReason: x,
|
|
1128
|
+
"data-testid": p = "source-pill"
|
|
1129
|
+
}) {
|
|
1130
|
+
const o = ht, w = /* @__PURE__ */ f(me, { children: [
|
|
1131
|
+
s !== void 0 && (d || !l) ? /* @__PURE__ */ f("span", { className: o.srOnly, children: [
|
|
1132
|
+
"[",
|
|
1133
|
+
s,
|
|
1134
|
+
"], "
|
|
1135
|
+
] }) : null,
|
|
1136
|
+
s !== void 0 ? /* @__PURE__ */ n("span", { "aria-hidden": "true", "data-testid": `${p}-marker`, className: o.marker, children: s }) : null,
|
|
1137
|
+
r ? /* @__PURE__ */ n(R, { icon: r, width: 14, height: 14, "aria-hidden": "true", className: o.icon }) : null,
|
|
1138
|
+
/* @__PURE__ */ n("span", { className: o.kind, children: e }),
|
|
1139
|
+
/* @__PURE__ */ n("span", { "aria-hidden": "true", className: o.separator, children: "·" }),
|
|
1140
|
+
/* @__PURE__ */ n("span", { "data-testid": `${p}-title`, className: o.title, children: t }),
|
|
1141
|
+
a ? /* @__PURE__ */ n("span", { className: o.date, children: a }) : null
|
|
1142
|
+
] });
|
|
1143
|
+
return d || !l ? /* @__PURE__ */ f(
|
|
1144
|
+
"span",
|
|
1145
|
+
{
|
|
1146
|
+
"data-testid": p,
|
|
1147
|
+
"data-disabled": d || void 0,
|
|
1148
|
+
title: t,
|
|
1149
|
+
className: u(o.base, d && o.disabled),
|
|
1150
|
+
children: [
|
|
1151
|
+
w,
|
|
1152
|
+
d && x ? /* @__PURE__ */ f("span", { "data-testid": `${p}-reason`, className: o.reason, children: [
|
|
1153
|
+
/* @__PURE__ */ n(R, { icon: "solar:unlink-minimalistic-linear", width: 14, height: 14, "aria-hidden": "true" }),
|
|
1154
|
+
x
|
|
1155
|
+
] }) : null
|
|
1156
|
+
]
|
|
1157
|
+
}
|
|
1158
|
+
) : /* @__PURE__ */ n(
|
|
1159
|
+
z,
|
|
1160
|
+
{
|
|
1161
|
+
variant: "light",
|
|
1162
|
+
color: "default",
|
|
1163
|
+
radius: "full",
|
|
1164
|
+
onPress: l,
|
|
1165
|
+
title: t,
|
|
1166
|
+
"aria-label": [s !== void 0 ? `[${s}]` : null, e, t, a].filter(Boolean).join(", "),
|
|
1167
|
+
testId: p,
|
|
1168
|
+
className: u(o.base, o.interactive),
|
|
1169
|
+
children: w
|
|
1170
|
+
}
|
|
1171
|
+
);
|
|
1172
|
+
}
|
|
1173
|
+
$e.displayName = "SourcePill";
|
|
1174
|
+
const bt = {
|
|
1175
|
+
base: "w-full px-0",
|
|
1176
|
+
item: "shadow-none",
|
|
1177
|
+
trigger: `gap-2 py-1.5 ${be}`,
|
|
1178
|
+
title: "text-sm font-medium text-default-700",
|
|
1179
|
+
count: "ms-1 tabular-nums text-default-600",
|
|
1180
|
+
indicator: "text-default-500",
|
|
1181
|
+
content: "pb-2 pt-0",
|
|
1182
|
+
groups: "flex flex-col gap-3",
|
|
1183
|
+
group: "flex flex-col gap-1.5",
|
|
1184
|
+
groupLabel: "m-0 text-xs font-semibold uppercase tracking-wide text-default-600",
|
|
1185
|
+
list: "m-0 flex list-none flex-wrap gap-1.5 p-0",
|
|
1186
|
+
/**
|
|
1187
|
+
* The item takes focus only from `reveal()`, a script focus that follows a
|
|
1188
|
+
* mouse click as often as a key, and `:focus-visible` would not match the
|
|
1189
|
+
* click. So the ring is on `:focus`: the revealed source is marked either way.
|
|
1190
|
+
*/
|
|
1191
|
+
listItem: "max-w-full rounded-full outline-none focus:ring-2 focus:ring-ai-focus"
|
|
1192
|
+
}, ne = "sources", gt = 1e3, xt = 700;
|
|
1193
|
+
function wt(e) {
|
|
1194
|
+
const t = /* @__PURE__ */ new Map();
|
|
1195
|
+
for (const a of e) {
|
|
1196
|
+
const r = t.get(a.groupKey) ?? { key: a.groupKey, label: a.groupLabel, items: [] };
|
|
1197
|
+
r.items.push(a), t.set(a.groupKey, r);
|
|
1198
|
+
}
|
|
1199
|
+
return [...t.values()];
|
|
1200
|
+
}
|
|
1201
|
+
const Et = /* @__PURE__ */ Object.assign(
|
|
1202
|
+
/* @__PURE__ */ _e(function({
|
|
1203
|
+
items: t,
|
|
1204
|
+
title: a,
|
|
1205
|
+
titleText: r,
|
|
1206
|
+
isExpanded: s,
|
|
1207
|
+
defaultExpanded: l = !1,
|
|
1208
|
+
onExpandedChange: d,
|
|
1209
|
+
className: x,
|
|
1210
|
+
"data-testid": p = "source-list"
|
|
1211
|
+
}, o) {
|
|
1212
|
+
const [w, b] = q(l), g = F(/* @__PURE__ */ new Map()), i = F(null), v = F(null), m = G(), C = le(), A = s ?? w, W = (h) => {
|
|
1213
|
+
s === void 0 && b(h), d?.(h);
|
|
1214
|
+
}, M = (h, c) => h.scrollIntoView?.({ block: "nearest", behavior: c ? "smooth" : "auto" }), _ = (h, c) => {
|
|
1215
|
+
if (h.focus({ preventScroll: !0 }), v.current) {
|
|
1216
|
+
v.current = h;
|
|
1217
|
+
return;
|
|
1218
|
+
}
|
|
1219
|
+
if (!c || C) {
|
|
1220
|
+
M(h, !C);
|
|
1221
|
+
return;
|
|
1222
|
+
}
|
|
1223
|
+
v.current = h, window.setTimeout(() => {
|
|
1224
|
+
const N = v.current;
|
|
1225
|
+
N && (v.current = null, M(N, !0));
|
|
1226
|
+
}, xt);
|
|
1227
|
+
}, j = he(
|
|
1228
|
+
() => ({
|
|
1229
|
+
onAnimationComplete: (h) => {
|
|
1230
|
+
const c = v.current;
|
|
1231
|
+
h !== "enter" || !c || (v.current = null, c.scrollIntoView?.({ block: "nearest", behavior: "smooth" }));
|
|
1232
|
+
}
|
|
1233
|
+
}),
|
|
1234
|
+
[]
|
|
1235
|
+
);
|
|
1236
|
+
if (Z(() => {
|
|
1237
|
+
A || (i.current = null, v.current = null);
|
|
1238
|
+
}, [A]), ke(o, () => ({
|
|
1239
|
+
reveal: (h) => {
|
|
1240
|
+
if (!t.some((N) => N.id === h)) return;
|
|
1241
|
+
const c = g.current.get(h);
|
|
1242
|
+
if (A && c) {
|
|
1243
|
+
_(c, !1);
|
|
1244
|
+
return;
|
|
1245
|
+
}
|
|
1246
|
+
i.current = { id: h, at: Date.now() }, A || W(!0);
|
|
1247
|
+
}
|
|
1248
|
+
})), t.length === 0) return null;
|
|
1249
|
+
const $ = bt, B = wt(t);
|
|
1250
|
+
return /* @__PURE__ */ n(
|
|
1251
|
+
ge,
|
|
1252
|
+
{
|
|
1253
|
+
"data-testid": p,
|
|
1254
|
+
disableAnimation: C,
|
|
1255
|
+
selectedKeys: A ? /* @__PURE__ */ new Set([ne]) : /* @__PURE__ */ new Set(),
|
|
1256
|
+
onSelectionChange: (h) => W(h === "all" || h.has(ne)),
|
|
1257
|
+
className: u($.base, x),
|
|
1258
|
+
children: /* @__PURE__ */ n(
|
|
1259
|
+
xe,
|
|
1260
|
+
{
|
|
1261
|
+
"data-testid": `${p}-group`,
|
|
1262
|
+
motionProps: j,
|
|
1263
|
+
title: /* @__PURE__ */ f(me, { children: [
|
|
1264
|
+
a,
|
|
1265
|
+
/* @__PURE__ */ f("span", { className: $.count, children: [
|
|
1266
|
+
"(",
|
|
1267
|
+
t.length,
|
|
1268
|
+
")"
|
|
1269
|
+
] })
|
|
1270
|
+
] }),
|
|
1271
|
+
textValue: `${typeof a == "string" ? a : r ?? ""} (${t.length})`,
|
|
1272
|
+
classNames: {
|
|
1273
|
+
base: $.item,
|
|
1274
|
+
trigger: $.trigger,
|
|
1275
|
+
title: $.title,
|
|
1276
|
+
indicator: $.indicator,
|
|
1277
|
+
content: $.content
|
|
1278
|
+
},
|
|
1279
|
+
children: /* @__PURE__ */ n("div", { className: $.groups, onFocus: (h) => h.stopPropagation(), children: B.map((h, c) => {
|
|
1280
|
+
const N = `${m}-group-${c}`;
|
|
1281
|
+
return /* @__PURE__ */ f(
|
|
1282
|
+
"div",
|
|
1283
|
+
{
|
|
1284
|
+
role: "group",
|
|
1285
|
+
"aria-labelledby": N,
|
|
1286
|
+
"data-testid": `${p}-kind-${h.key}`,
|
|
1287
|
+
className: $.group,
|
|
1288
|
+
children: [
|
|
1289
|
+
/* @__PURE__ */ f("p", { id: N, className: $.groupLabel, children: [
|
|
1290
|
+
h.label,
|
|
1291
|
+
" (",
|
|
1292
|
+
h.items.length,
|
|
1293
|
+
")"
|
|
1294
|
+
] }),
|
|
1295
|
+
/* @__PURE__ */ n("ul", { className: $.list, children: h.items.map((L) => /* @__PURE__ */ n(
|
|
1296
|
+
"li",
|
|
1297
|
+
{
|
|
1298
|
+
tabIndex: -1,
|
|
1299
|
+
ref: (H) => {
|
|
1300
|
+
if (!H) {
|
|
1301
|
+
g.current.delete(L.id);
|
|
1302
|
+
return;
|
|
1303
|
+
}
|
|
1304
|
+
g.current.set(L.id, H);
|
|
1305
|
+
const V = i.current;
|
|
1306
|
+
V?.id === L.id && (i.current = null, Date.now() - V.at <= gt && _(H, !0));
|
|
1307
|
+
},
|
|
1308
|
+
"data-testid": `${p}-item-${L.id}`,
|
|
1309
|
+
className: $.listItem,
|
|
1310
|
+
children: /* @__PURE__ */ n($e, { ...L, "data-testid": `${p}-pill-${L.id}` })
|
|
1311
|
+
},
|
|
1312
|
+
L.id
|
|
1313
|
+
)) })
|
|
1314
|
+
]
|
|
1315
|
+
},
|
|
1316
|
+
h.key
|
|
1317
|
+
);
|
|
1318
|
+
}) })
|
|
1319
|
+
},
|
|
1320
|
+
ne
|
|
1321
|
+
)
|
|
1322
|
+
}
|
|
1323
|
+
);
|
|
1324
|
+
}),
|
|
1325
|
+
{ displayName: "SourceList" }
|
|
1326
|
+
), vt = {
|
|
1327
|
+
base: "w-full border border-default-200 bg-content1 shadow-none",
|
|
1328
|
+
deleted: "border-dashed",
|
|
1329
|
+
header: "flex flex-col items-start gap-1 px-4 pb-0 pt-3",
|
|
1330
|
+
kindRow: "flex min-w-0 flex-wrap items-center gap-2 text-xs text-default-600",
|
|
1331
|
+
kind: "inline-flex items-center gap-1.5 font-medium",
|
|
1332
|
+
badge: "inline-flex items-center gap-1 rounded-md border border-default-300 bg-default-100 px-1.5 py-0.5 text-[0.6875rem] font-semibold uppercase tracking-wide text-default-700",
|
|
1333
|
+
title: "m-0 min-w-0 text-sm font-semibold text-foreground [overflow-wrap:anywhere]",
|
|
1334
|
+
titleDeleted: "text-default-600",
|
|
1335
|
+
meta: "text-xs tabular-nums text-default-600 [overflow-wrap:anywhere]",
|
|
1336
|
+
body: "min-w-0 px-4 py-3",
|
|
1337
|
+
skeleton: "flex flex-col gap-2",
|
|
1338
|
+
skeletonLine: "h-3 rounded-md",
|
|
1339
|
+
/** Three lines of a preview that has not arrived yet. */
|
|
1340
|
+
skeletonWidths: ["w-3/4", "w-full", "w-2/3"],
|
|
1341
|
+
footer: "flex flex-wrap items-center justify-between gap-2 border-t border-divider px-4 py-2.5",
|
|
1342
|
+
status: "flex min-w-0 items-center gap-1.5 text-xs font-medium [overflow-wrap:anywhere]",
|
|
1343
|
+
/** HeroUI's small spinner is 20px; sized to the 14px status icons so the footer keeps its height when the save ends. */
|
|
1344
|
+
spinner: "size-3.5",
|
|
1345
|
+
actions: "flex flex-wrap items-center gap-1.5"
|
|
1346
|
+
}, Nt = {
|
|
1347
|
+
saving: "text-default-600",
|
|
1348
|
+
saved: "text-success-700",
|
|
1349
|
+
failed: "text-danger-700",
|
|
1350
|
+
deleted: "text-default-600"
|
|
1351
|
+
}, yt = {
|
|
1352
|
+
saved: "solar:check-circle-linear",
|
|
1353
|
+
failed: "solar:danger-triangle-linear",
|
|
1354
|
+
deleted: "solar:trash-bin-minimalistic-linear"
|
|
1355
|
+
};
|
|
1356
|
+
function $t(e) {
|
|
1357
|
+
return Le.toArray(e).some((t) => t !== "");
|
|
1358
|
+
}
|
|
1359
|
+
function Ct({
|
|
1360
|
+
title: e,
|
|
1361
|
+
kindLabel: t,
|
|
1362
|
+
icon: a,
|
|
1363
|
+
status: r = "saved",
|
|
1364
|
+
statusLabel: s,
|
|
1365
|
+
meta: l,
|
|
1366
|
+
badge: d,
|
|
1367
|
+
children: x,
|
|
1368
|
+
actions: p,
|
|
1369
|
+
titleAs: o = "p",
|
|
1370
|
+
className: w,
|
|
1371
|
+
"data-testid": b = "artifact-card"
|
|
1372
|
+
}) {
|
|
1373
|
+
const g = G(), i = vt, v = r === "deleted", m = $t(x), C = !v && (m || r === "saving");
|
|
1374
|
+
return /* @__PURE__ */ f(
|
|
1375
|
+
je,
|
|
1376
|
+
{
|
|
1377
|
+
as: "article",
|
|
1378
|
+
"aria-labelledby": g,
|
|
1379
|
+
shadow: "none",
|
|
1380
|
+
radius: "lg",
|
|
1381
|
+
"data-status": r,
|
|
1382
|
+
"data-testid": b,
|
|
1383
|
+
className: u(i.base, v && i.deleted, w),
|
|
1384
|
+
children: [
|
|
1385
|
+
/* @__PURE__ */ f(De, { className: i.header, children: [
|
|
1386
|
+
/* @__PURE__ */ f("div", { className: i.kindRow, children: [
|
|
1387
|
+
/* @__PURE__ */ f("span", { "data-testid": `${b}-kind`, className: i.kind, children: [
|
|
1388
|
+
a ? /* @__PURE__ */ n(R, { icon: a, width: 16, height: 16, "aria-hidden": "true" }) : null,
|
|
1389
|
+
t
|
|
1390
|
+
] }),
|
|
1391
|
+
D(d) ? /* @__PURE__ */ n("span", { "data-testid": `${b}-badge`, className: i.badge, children: d }) : null
|
|
1392
|
+
] }),
|
|
1393
|
+
/* @__PURE__ */ n(
|
|
1394
|
+
o,
|
|
1395
|
+
{
|
|
1396
|
+
id: g,
|
|
1397
|
+
"data-testid": `${b}-title`,
|
|
1398
|
+
className: u(i.title, v && i.titleDeleted),
|
|
1399
|
+
children: e
|
|
1400
|
+
}
|
|
1401
|
+
),
|
|
1402
|
+
D(l) ? /* @__PURE__ */ n("div", { "data-testid": `${b}-meta`, className: i.meta, children: l }) : null
|
|
1403
|
+
] }),
|
|
1404
|
+
C ? /* @__PURE__ */ n(Ue, { "data-testid": `${b}-body`, className: i.body, children: m ? x : /* @__PURE__ */ n("div", { "aria-hidden": "true", "data-testid": `${b}-skeleton`, className: i.skeleton, children: i.skeletonWidths.map((A) => /* @__PURE__ */ n(Me, { className: u(i.skeletonLine, A) }, A)) }) }) : null,
|
|
1405
|
+
/* @__PURE__ */ f(We, { className: i.footer, children: [
|
|
1406
|
+
/* @__PURE__ */ f(
|
|
1407
|
+
"div",
|
|
1408
|
+
{
|
|
1409
|
+
role: "status",
|
|
1410
|
+
"aria-live": "polite",
|
|
1411
|
+
"data-testid": `${b}-status`,
|
|
1412
|
+
className: u(i.status, Nt[r]),
|
|
1413
|
+
children: [
|
|
1414
|
+
r === "saving" ? /* @__PURE__ */ n(
|
|
1415
|
+
we,
|
|
1416
|
+
{
|
|
1417
|
+
size: "sm",
|
|
1418
|
+
color: "current",
|
|
1419
|
+
"aria-hidden": "true",
|
|
1420
|
+
classNames: { base: i.spinner, wrapper: i.spinner }
|
|
1421
|
+
}
|
|
1422
|
+
) : /* @__PURE__ */ n(R, { icon: yt[r], width: 14, height: 14, "aria-hidden": "true" }),
|
|
1423
|
+
/* @__PURE__ */ n("span", { children: s })
|
|
1424
|
+
]
|
|
1425
|
+
}
|
|
1426
|
+
),
|
|
1427
|
+
D(p) ? /* @__PURE__ */ n("div", { "data-testid": `${b}-actions`, className: i.actions, children: p }) : null
|
|
1428
|
+
] })
|
|
1429
|
+
]
|
|
1430
|
+
}
|
|
1431
|
+
);
|
|
1432
|
+
}
|
|
1433
|
+
Ct.displayName = "ArtifactCard";
|
|
783
1434
|
export {
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
1435
|
+
Ct as ArtifactCard,
|
|
1436
|
+
Ve as AssistantActivity,
|
|
1437
|
+
Xe as AssistantComposer,
|
|
1438
|
+
pt as AssistantMarkdown,
|
|
1439
|
+
Ke as AssistantMessage,
|
|
1440
|
+
Ze as AssistantNotice,
|
|
1441
|
+
mt as CitationMarker,
|
|
1442
|
+
et as ScrollToLatest,
|
|
1443
|
+
Et as SourceList,
|
|
1444
|
+
$e as SourcePill,
|
|
1445
|
+
ot as defaultAssistantLinkPolicy,
|
|
1446
|
+
qe as formatAssistantDuration
|
|
790
1447
|
};
|