@epam/ai-dial-conversation-stages 1.3.0-dev.35 → 1.3.0-dev.37
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/index.js +286 -272
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { AttachmentErrorReason as e, AttachmentType as t, MIME_TYPE_EXT_MAP as n, MarkdownCodeBlock as r, MarkdownRenderer as i, RequestStatus as a, StageStatus as o, buildCssVars as s, mergeClasses as c, messageAttachmentsToDisplayAttachments as l, normalizeMimeType as u } from "@epam/ai-dial-chat-shared";
|
|
2
|
-
import { Accordion as d, DIAL_ICON_SIZE as f, DIAL_KIT_ICON_STROKE as p,
|
|
3
|
-
import { IconAlertCircle as
|
|
4
|
-
import { memo as me, useCallback as
|
|
5
|
-
import { Fragment as _e, jsx as
|
|
2
|
+
import { Accordion as d, DIAL_ICON_SIZE as f, DIAL_KIT_ICON_STROKE as p, DialItemType as m, ElementSize as h, EllipsisTooltip as g, FileIcon as _, Highlight as v, Skeleton as y, SkeletonVariant as b, Spinner as x, StaticIconButton as S } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { IconAlertCircle as C, IconCheck as w, IconClipboard as T, IconDownload as E, IconExternalLink as D, IconFile as O, IconFileTypeBmp as k, IconFileTypeCss as A, IconFileTypeCsv as j, IconFileTypeDoc as M, IconFileTypeDocx as N, IconFileTypeHtml as P, IconFileTypeJpg as F, IconFileTypeJs as I, IconFileTypeJsx as L, IconFileTypePdf as R, IconFileTypePhp as z, IconFileTypePng as B, IconFileTypePpt as V, IconFileTypeRs as ee, IconFileTypeSql as te, IconFileTypeSvg as ne, IconFileTypeTs as re, IconFileTypeTsx as ie, IconFileTypeTxt as ae, IconFileTypeVue as oe, IconFileTypeXls as H, IconFileTypeXml as se, IconFileTypeZip as ce, IconMusic as le, IconPhoto as U, IconReload as ue, IconTerminal2 as de, IconVideo as fe, IconX as pe } from "@tabler/icons-react";
|
|
4
|
+
import { memo as me, useCallback as W, useEffect as G, useId as he, useMemo as K, useRef as ge, useState as q } from "react";
|
|
5
|
+
import { Fragment as _e, jsx as J, jsxs as Y } from "react/jsx-runtime";
|
|
6
6
|
//#region src/constants/public-class-names.ts
|
|
7
|
-
var
|
|
7
|
+
var ve = {
|
|
8
8
|
panel: "dial-conversation-stages-panel",
|
|
9
9
|
group: "dial-conversation-stages-group",
|
|
10
10
|
groupToggle: "dial-conversation-stages-group-toggle"
|
|
11
|
-
},
|
|
12
|
-
let [e, t] =
|
|
11
|
+
}, ye = () => {
|
|
12
|
+
let [e, t] = q(() => /* @__PURE__ */ new Set()), n = W((e, n) => {
|
|
13
13
|
t((t) => {
|
|
14
14
|
if (t.has(e) === n) return t;
|
|
15
15
|
let r = new Set(t);
|
|
16
16
|
return n ? r.add(e) : r.delete(e), r;
|
|
17
17
|
});
|
|
18
|
-
}, []), r =
|
|
18
|
+
}, []), r = W(() => {
|
|
19
19
|
t((e) => e.size ? /* @__PURE__ */ new Set() : e);
|
|
20
20
|
}, []);
|
|
21
|
-
return
|
|
21
|
+
return K(() => ({
|
|
22
22
|
isExpanded: (t) => e.has(t),
|
|
23
23
|
onToggle: n,
|
|
24
24
|
reset: r
|
|
@@ -27,30 +27,30 @@ var J = {
|
|
|
27
27
|
n,
|
|
28
28
|
r
|
|
29
29
|
]);
|
|
30
|
-
},
|
|
30
|
+
}, be = /[([][^()[\]]*[)\]]/g, xe = /(\d+(?:\.\d+)?)\s*s\b/, Se = (e) => {
|
|
31
31
|
let t = e.trimEnd();
|
|
32
32
|
return t.endsWith(":") ? t.slice(0, -1) : t;
|
|
33
|
-
},
|
|
34
|
-
|
|
33
|
+
}, Ce = (e) => {
|
|
34
|
+
be.lastIndex = 0;
|
|
35
35
|
let t;
|
|
36
|
-
for (; t =
|
|
37
|
-
let e = t[0].slice(1, -1), n =
|
|
36
|
+
for (; t = be.exec(e);) {
|
|
37
|
+
let e = t[0].slice(1, -1), n = xe.exec(e);
|
|
38
38
|
if (n) return {
|
|
39
39
|
durationLabel: `${n[1]}s`,
|
|
40
40
|
groupIndex: t.index,
|
|
41
41
|
groupLength: t[0].length
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
},
|
|
45
|
-
let t = e ?? "", n =
|
|
44
|
+
}, we = (e) => {
|
|
45
|
+
let t = e ?? "", n = Ce(t);
|
|
46
46
|
return {
|
|
47
|
-
name:
|
|
47
|
+
name: Se(n ? t.slice(0, n.groupIndex) + t.slice(n.groupIndex + n.groupLength) : t).trim().replace(/ {2,}/g, " "),
|
|
48
48
|
durationLabel: n?.durationLabel
|
|
49
49
|
};
|
|
50
|
-
},
|
|
50
|
+
}, Te = (e) => e.length > 0 && !/\s/.test(e) && e.includes("_"), Ee = (e) => [...e].reverse().find((e) => e.status == null), De = (e, t) => {
|
|
51
51
|
let n = e.parent_stage_index;
|
|
52
52
|
if (!(n == null || !Number.isInteger(n) || n < 0 || n >= e.index)) return t.get(n);
|
|
53
|
-
},
|
|
53
|
+
}, Oe = (e) => {
|
|
54
54
|
let t = e.map((e) => ({
|
|
55
55
|
stage: e,
|
|
56
56
|
children: []
|
|
@@ -58,15 +58,15 @@ var J = {
|
|
|
58
58
|
for (let e of t) n.has(e.stage.index) || n.set(e.stage.index, e);
|
|
59
59
|
let r = [];
|
|
60
60
|
for (let e of t) {
|
|
61
|
-
let t =
|
|
61
|
+
let t = De(e.stage, n);
|
|
62
62
|
t ? t.children.push(e) : r.push(e);
|
|
63
63
|
}
|
|
64
64
|
return r;
|
|
65
|
-
},
|
|
65
|
+
}, ke = (e) => `stage:${e}`, Ae = (e) => `group:${e}`, je = "min-w-0 overflow-visible py-0", Me = "min-w-0 justify-start gap-2 rounded-lg px-2 py-1.5 text-start mobile:min-h-11", Ne = (e) => {
|
|
66
66
|
let t = [], n = 0;
|
|
67
67
|
for (; n < e.length;) {
|
|
68
|
-
let r = e[n], i =
|
|
69
|
-
for (; a < e.length &&
|
|
68
|
+
let r = e[n], i = we(r.stage.name).name, a = n + 1;
|
|
69
|
+
for (; a < e.length && we(e[a].stage.name).name === i;) a += 1;
|
|
70
70
|
let o = e.slice(n, a);
|
|
71
71
|
o.length > 1 ? t.push({
|
|
72
72
|
key: r.stage.index,
|
|
@@ -98,98 +98,102 @@ var J = {
|
|
|
98
98
|
codeInline: "_codeInline_w65is_84",
|
|
99
99
|
blockquote: "_blockquote_w65is_91",
|
|
100
100
|
tableCell: "_tableCell_w65is_96"
|
|
101
|
-
},
|
|
101
|
+
}, Pe = ({ status: e, isLive: t, runningLabel: n = "Running", failedLabel: r = "Failed" }) => e === o.Failed ? /* @__PURE__ */ Y(_e, { children: [/* @__PURE__ */ J(C, {
|
|
102
102
|
size: f.MD,
|
|
103
103
|
className: X.iconError,
|
|
104
104
|
"aria-hidden": !0,
|
|
105
105
|
stroke: p
|
|
106
|
-
}), /* @__PURE__ */
|
|
106
|
+
}), /* @__PURE__ */ J("span", {
|
|
107
107
|
className: "sr-only",
|
|
108
108
|
children: r
|
|
109
|
-
})] }) : e === o.Completed ? /* @__PURE__ */
|
|
109
|
+
})] }) : e === o.Completed ? /* @__PURE__ */ J(w, {
|
|
110
110
|
size: f.SM,
|
|
111
111
|
className: X.iconCompleted,
|
|
112
112
|
"aria-hidden": !0,
|
|
113
113
|
stroke: p
|
|
114
|
-
}) : t ? /* @__PURE__ */
|
|
114
|
+
}) : t ? /* @__PURE__ */ J(x, {
|
|
115
115
|
size: 16,
|
|
116
116
|
ariaLabel: n
|
|
117
|
-
}) : null,
|
|
117
|
+
}) : null, Fe = (e) => {
|
|
118
118
|
if (e == null) return "";
|
|
119
119
|
let t = e.lastIndexOf(".");
|
|
120
120
|
return t > 0 ? e.slice(0, t) : e;
|
|
121
|
-
},
|
|
122
|
-
if (!e) return
|
|
121
|
+
}, Ie = (e) => {
|
|
122
|
+
if (!e) return O;
|
|
123
123
|
let t = u(e);
|
|
124
124
|
if (t.startsWith("image/")) switch (t) {
|
|
125
|
-
case "image/jpeg": return
|
|
126
|
-
case "image/png": return
|
|
125
|
+
case "image/jpeg": return F;
|
|
126
|
+
case "image/png": return B;
|
|
127
127
|
case "image/svg+xml": return ne;
|
|
128
|
-
case "image/bmp": return
|
|
129
|
-
default: return
|
|
128
|
+
case "image/bmp": return k;
|
|
129
|
+
default: return U;
|
|
130
130
|
}
|
|
131
131
|
if (t.startsWith("video/")) return fe;
|
|
132
132
|
if (t.startsWith("audio/")) return le;
|
|
133
133
|
switch (t) {
|
|
134
|
-
case "application/pdf": return
|
|
135
|
-
case "application/msword": return
|
|
136
|
-
case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return
|
|
137
|
-
case "application/vnd.ms-powerpoint": return
|
|
138
|
-
case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return
|
|
139
|
-
case "application/vnd.ms-excel": return
|
|
140
|
-
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return
|
|
134
|
+
case "application/pdf": return R;
|
|
135
|
+
case "application/msword": return M;
|
|
136
|
+
case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return N;
|
|
137
|
+
case "application/vnd.ms-powerpoint": return V;
|
|
138
|
+
case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return V;
|
|
139
|
+
case "application/vnd.ms-excel": return H;
|
|
140
|
+
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return H;
|
|
141
141
|
case "application/zip":
|
|
142
142
|
case "application/vnd.rar":
|
|
143
143
|
case "application/x-7z-compressed":
|
|
144
144
|
case "application/gzip":
|
|
145
145
|
case "application/x-tar": return ce;
|
|
146
|
-
case "text/csv": return
|
|
147
|
-
case "text/plain": return
|
|
146
|
+
case "text/csv": return j;
|
|
147
|
+
case "text/plain": return ae;
|
|
148
148
|
case "text/html":
|
|
149
|
-
case "application/xhtml+xml": return
|
|
149
|
+
case "application/xhtml+xml": return P;
|
|
150
150
|
case "application/xml": return se;
|
|
151
151
|
case "application/sql": return te;
|
|
152
|
-
case "text/javascript": return
|
|
153
|
-
case "text/jsx": return
|
|
152
|
+
case "text/javascript": return I;
|
|
153
|
+
case "text/jsx": return L;
|
|
154
154
|
case "text/typescript": return re;
|
|
155
|
-
case "text/tsx": return
|
|
156
|
-
case "text/css": return
|
|
157
|
-
case "text/x-php": return
|
|
155
|
+
case "text/tsx": return ie;
|
|
156
|
+
case "text/css": return A;
|
|
157
|
+
case "text/x-php": return z;
|
|
158
158
|
case "text/x-rustsrc": return ee;
|
|
159
|
-
case "text/x-vue": return
|
|
160
|
-
default: return
|
|
159
|
+
case "text/x-vue": return oe;
|
|
160
|
+
default: return O;
|
|
161
161
|
}
|
|
162
|
-
},
|
|
162
|
+
}, Le = (e) => {
|
|
163
163
|
let { type: n, contentType: r } = e;
|
|
164
|
-
return n === t.Prompt ? de : n === t.Pasted ?
|
|
165
|
-
},
|
|
164
|
+
return n === t.Prompt ? de : n === t.Pasted ? T : n === t.Image ? U : Ie(r ?? "");
|
|
165
|
+
}, Re = (e) => {
|
|
166
166
|
let t = u(e), r = n[t];
|
|
167
167
|
if (r) return r;
|
|
168
168
|
let i = t.split("/")[1];
|
|
169
169
|
if (i && !i.startsWith("vnd.") && !i.includes("+")) return i;
|
|
170
|
-
},
|
|
171
|
-
let {
|
|
170
|
+
}, ze = (e) => {
|
|
171
|
+
let { name: t, contentType: n } = e;
|
|
172
|
+
if (n) {
|
|
173
|
+
let e = Re(n);
|
|
174
|
+
if (e) return e;
|
|
175
|
+
}
|
|
176
|
+
if (t == null) return;
|
|
177
|
+
let r = t.lastIndexOf(".");
|
|
178
|
+
if (r > 0 && r < t.length - 1) return t.slice(r + 1).toLowerCase();
|
|
179
|
+
}, Be = (e) => e.type !== t.Prompt && e.type !== t.Pasted, Ve = (e, n) => {
|
|
180
|
+
let { type: r, name: i } = e;
|
|
172
181
|
if (r === t.Prompt) return n.promptLabel ?? "Prompt";
|
|
173
182
|
if (r === t.Pasted) return n.pastedLabel ?? "Pasted";
|
|
174
183
|
if (r === t.Image) return n.imageLabel ?? "Image";
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
if (i == null) return "";
|
|
180
|
-
let o = i.lastIndexOf(".");
|
|
181
|
-
return o > 0 && o < i.length - 1 ? `.${i.slice(o + 1).toLowerCase()}` : i;
|
|
182
|
-
}, Re = (e, n = {}) => {
|
|
184
|
+
let a = ze(e);
|
|
185
|
+
return a ? `.${a}` : i ?? "";
|
|
186
|
+
}, He = (e, n = {}) => {
|
|
183
187
|
let { type: r, status: i, previewUrl: o, url: s } = e, c = i === a.Loading, l = i === a.Error, u = r === t.Image && !!(o ?? s) && !l, d = r === t.Link && !l;
|
|
184
188
|
return {
|
|
185
189
|
isLoading: c,
|
|
186
190
|
isError: l,
|
|
187
191
|
isImage: u,
|
|
188
192
|
isLink: d,
|
|
189
|
-
BottomIcon: d ? null :
|
|
190
|
-
typeLabel: d ? null :
|
|
193
|
+
BottomIcon: d ? null : Le(e),
|
|
194
|
+
typeLabel: d ? null : Ve(e, n)
|
|
191
195
|
};
|
|
192
|
-
},
|
|
196
|
+
}, Ue = "flex size-[100px] items-center justify-center rounded-xl border", Z = {
|
|
193
197
|
tray: "dial-ai-attachment-tray",
|
|
194
198
|
trayItem: "dial-ai-attachment-tray-item",
|
|
195
199
|
tile: "dial-ai-attachment-tile",
|
|
@@ -198,156 +202,165 @@ var J = {
|
|
|
198
202
|
tileType: "dial-ai-attachment-tile-type",
|
|
199
203
|
tileAction: "dial-ai-attachment-tile-action"
|
|
200
204
|
}, Q = {
|
|
201
|
-
tile: "
|
|
202
|
-
hovered: "
|
|
203
|
-
selected: "
|
|
204
|
-
tileError: "
|
|
205
|
-
nameText: "
|
|
206
|
-
typeText: "
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
205
|
+
tile: "_tile_1wxo2_12",
|
|
206
|
+
hovered: "_hovered_1wxo2_18",
|
|
207
|
+
selected: "_selected_1wxo2_28",
|
|
208
|
+
tileError: "_tileError_1wxo2_33",
|
|
209
|
+
nameText: "_nameText_1wxo2_38",
|
|
210
|
+
typeText: "_typeText_1wxo2_42",
|
|
211
|
+
placeholderIcon: "_placeholderIcon_1wxo2_46",
|
|
212
|
+
retryIcon: "_retryIcon_1wxo2_50",
|
|
213
|
+
track: "_track_1wxo2_54",
|
|
214
|
+
actionButton: "_actionButton_1wxo2_60",
|
|
215
|
+
imageActionButton: "_imageActionButton_1wxo2_64"
|
|
216
|
+
}, We = ({ ariaLabel: e, errorTitle: t, errorDescId: n, onClick: r, id: i, icon: a, className: o }) => /* @__PURE__ */ J(S, {
|
|
212
217
|
icon: a,
|
|
213
|
-
size:
|
|
218
|
+
size: h.Small,
|
|
214
219
|
className: c("opacity-0 focus-visible:opacity-100 group-focus-within/attachment-tile:opacity-100 group-hover/attachment-tile:opacity-100", Q.actionButton, o, Z.tileAction),
|
|
215
220
|
"aria-label": e,
|
|
216
221
|
"aria-describedby": t ? n : void 0,
|
|
217
222
|
onClick: (e) => {
|
|
218
223
|
e.stopPropagation(), r(i);
|
|
219
224
|
}
|
|
220
|
-
}),
|
|
221
|
-
icon: /* @__PURE__ */
|
|
225
|
+
}), Ge = ({ ...e }) => /* @__PURE__ */ J(We, {
|
|
226
|
+
icon: /* @__PURE__ */ J(ue, {
|
|
222
227
|
size: f.SM,
|
|
223
228
|
"aria-hidden": !0,
|
|
224
229
|
stroke: p
|
|
225
230
|
}),
|
|
226
231
|
className: Q.retryIcon,
|
|
227
232
|
...e
|
|
228
|
-
}),
|
|
229
|
-
icon: /* @__PURE__ */
|
|
233
|
+
}), Ke = ({ ...e }) => /* @__PURE__ */ J(We, {
|
|
234
|
+
icon: /* @__PURE__ */ J(E, {
|
|
230
235
|
size: f.SM,
|
|
231
236
|
"aria-hidden": !0,
|
|
232
237
|
stroke: p
|
|
233
238
|
}),
|
|
234
239
|
...e
|
|
235
|
-
}),
|
|
236
|
-
icon: /* @__PURE__ */
|
|
240
|
+
}), qe = ({ ...e }) => /* @__PURE__ */ J(We, {
|
|
241
|
+
icon: /* @__PURE__ */ J(D, {
|
|
237
242
|
size: f.SM,
|
|
238
243
|
"aria-hidden": !0,
|
|
239
244
|
stroke: p
|
|
240
245
|
}),
|
|
241
246
|
...e
|
|
242
|
-
}),
|
|
243
|
-
icon: /* @__PURE__ */
|
|
247
|
+
}), Je = ({ className: e, ...t }) => /* @__PURE__ */ J(We, {
|
|
248
|
+
icon: /* @__PURE__ */ J(pe, {
|
|
244
249
|
size: f.SM,
|
|
245
250
|
"aria-hidden": !0,
|
|
246
251
|
stroke: p
|
|
247
252
|
}),
|
|
248
|
-
|
|
249
|
-
|
|
253
|
+
className: c("mobile:opacity-100", e),
|
|
254
|
+
...t
|
|
255
|
+
}), Ye = {
|
|
250
256
|
[e.Network]: "Upload failed · network error",
|
|
251
257
|
[e.UnsupportedType]: "Upload failed · unsupported file type",
|
|
252
258
|
[e.FileTooLarge]: "Upload failed · file too large"
|
|
253
|
-
},
|
|
254
|
-
let { clickLabel:
|
|
255
|
-
|
|
256
|
-
},
|
|
257
|
-
e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
258
|
-
},
|
|
259
|
+
}, Xe = ({ attachment: t, searchQuery: n = "", onClick: r, onRetry: i, labels: o, styles: s, onDownload: l, isLink: u, cssVars: d, onExpand: h, isExpandable: g, onRemove: y, isSelected: b }) => {
|
|
260
|
+
let { clickLabel: S = "Download attachment", expandLabel: C = "Expand pasted text", downloadLabel: w = "Download attachment", retryLabel: T = "Retry upload", removeLabel: E = "Remove attachment", openInNewTabLabel: D = "Open in new tab", sizeLabel: O, uploadingLabel: k = "Uploading", errorReasonLabels: A, genericErrorLabel: j = "Upload failed" } = o ?? {}, { typography: M, className: N } = s ?? {}, { id: P, name: F, status: I, errorReason: L } = t, R = I === a.Loading, z = I === a.Error, B = he(), V = z ? L && (A?.[L] ?? Ye[L]) || j : "", { BottomIcon: ee, typeLabel: te } = He(t), ne = Be(t), re = !z && !R && l && !u, ie = z && !!i && L !== e.UnsupportedType && L !== e.FileTooLarge, ae = Number(!!re) + Number(!!ie) + Number(!!u) + Number(!!y), oe = ae > 1 ? "pe-11" : ae === 1 ? "pe-5" : void 0, H = !!g && h !== void 0, se = H || r !== void 0, ce = () => {
|
|
261
|
+
H ? h(P) : r?.(P);
|
|
262
|
+
}, le = (e) => {
|
|
263
|
+
e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), ce());
|
|
264
|
+
}, U = K(() => Fe(F), [F]), ue = W(() => {
|
|
259
265
|
window.open(t.referenceUrl, "_blank", "noopener,noreferrer");
|
|
260
|
-
}, [t]),
|
|
261
|
-
title:
|
|
262
|
-
className: c(
|
|
263
|
-
children: n ? /* @__PURE__ */
|
|
264
|
-
text:
|
|
266
|
+
}, [t]), de = c(Ue, "group/attachment-tile relative flex-col justify-between items-start gap-1 overflow-hidden p-3", Q.tile, !z && Q.hovered, b && Q.selected, z && Q.tileError, Z.tile, b && Z.tileSelected), fe = /* @__PURE__ */ J("div", {
|
|
267
|
+
title: U,
|
|
268
|
+
className: c(M?.nameClassName ?? "dial-tiny-text", "line-clamp-2 w-full min-w-0 break-words", Q.nameText, !z && oe, Z.tileName),
|
|
269
|
+
children: n ? /* @__PURE__ */ J(v, {
|
|
270
|
+
text: U,
|
|
265
271
|
query: n,
|
|
266
272
|
maxLines: 2
|
|
267
|
-
}) :
|
|
268
|
-
}),
|
|
269
|
-
className: c("flex w-full items-center gap-1",
|
|
270
|
-
children: [/* @__PURE__ */
|
|
271
|
-
|
|
273
|
+
}) : U
|
|
274
|
+
}), pe = ee && /* @__PURE__ */ Y("div", {
|
|
275
|
+
className: c("flex w-full items-center gap-1", z && oe, Z.tileType),
|
|
276
|
+
children: [ne ? /* @__PURE__ */ J(_, {
|
|
277
|
+
type: m.File,
|
|
278
|
+
name: F ?? "",
|
|
279
|
+
fileExtension: ze(t),
|
|
280
|
+
size: f.SM,
|
|
281
|
+
decorative: !0
|
|
282
|
+
}) : /* @__PURE__ */ J(ee, {
|
|
283
|
+
size: f.SM,
|
|
272
284
|
className: Q.typeText,
|
|
285
|
+
stroke: p,
|
|
273
286
|
"aria-hidden": !0
|
|
274
|
-
}), /* @__PURE__ */
|
|
275
|
-
className: c(
|
|
276
|
-
children:
|
|
287
|
+
}), /* @__PURE__ */ J("span", {
|
|
288
|
+
className: c(M?.metaClassName ?? "dial-tiny-text", "min-w-0 flex-1 truncate", Q.typeText),
|
|
289
|
+
children: O ? `${te} · ${O}` : te
|
|
277
290
|
})]
|
|
278
|
-
}),
|
|
291
|
+
}), me = se ? {
|
|
279
292
|
role: "button",
|
|
280
293
|
tabIndex: 0,
|
|
281
|
-
"aria-label":
|
|
282
|
-
onClick:
|
|
283
|
-
onKeyDown:
|
|
284
|
-
} : {},
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
294
|
+
"aria-label": H ? C : S,
|
|
295
|
+
onClick: ce,
|
|
296
|
+
onKeyDown: le
|
|
297
|
+
} : {}, G = /* @__PURE__ */ Y(_e, { children: [
|
|
298
|
+
fe,
|
|
299
|
+
pe,
|
|
300
|
+
R && /* @__PURE__ */ J("div", {
|
|
288
301
|
role: "progressbar",
|
|
289
|
-
"aria-label":
|
|
302
|
+
"aria-label": k,
|
|
290
303
|
className: c("absolute start-[-1px] top-[-1px] flex size-full items-center justify-center rounded", Q.track),
|
|
291
|
-
children: /* @__PURE__ */
|
|
304
|
+
children: /* @__PURE__ */ J(x, { size: 32 })
|
|
292
305
|
}),
|
|
293
|
-
/* @__PURE__ */
|
|
306
|
+
/* @__PURE__ */ Y("div", {
|
|
294
307
|
className: "absolute end-1 top-1 flex gap-1",
|
|
295
308
|
children: [
|
|
296
|
-
|
|
297
|
-
ariaLabel:
|
|
298
|
-
errorTitle:
|
|
299
|
-
errorDescId:
|
|
309
|
+
re && /* @__PURE__ */ J(Ke, {
|
|
310
|
+
ariaLabel: w,
|
|
311
|
+
errorTitle: V,
|
|
312
|
+
errorDescId: B,
|
|
300
313
|
onClick: l,
|
|
301
|
-
id:
|
|
314
|
+
id: P
|
|
302
315
|
}),
|
|
303
|
-
|
|
304
|
-
ariaLabel:
|
|
305
|
-
errorTitle:
|
|
306
|
-
errorDescId:
|
|
316
|
+
ie && /* @__PURE__ */ J(Ge, {
|
|
317
|
+
ariaLabel: T,
|
|
318
|
+
errorTitle: V,
|
|
319
|
+
errorDescId: B,
|
|
307
320
|
onClick: i,
|
|
308
|
-
id:
|
|
321
|
+
id: P
|
|
309
322
|
}),
|
|
310
|
-
u && /* @__PURE__ */
|
|
311
|
-
ariaLabel:
|
|
312
|
-
errorTitle:
|
|
313
|
-
errorDescId:
|
|
314
|
-
onClick:
|
|
323
|
+
u && /* @__PURE__ */ J(qe, {
|
|
324
|
+
ariaLabel: D,
|
|
325
|
+
errorTitle: V,
|
|
326
|
+
errorDescId: B,
|
|
327
|
+
onClick: ue
|
|
315
328
|
}),
|
|
316
|
-
|
|
317
|
-
ariaLabel:
|
|
318
|
-
errorTitle:
|
|
319
|
-
errorDescId:
|
|
320
|
-
onClick:
|
|
321
|
-
id:
|
|
329
|
+
y && /* @__PURE__ */ J(Je, {
|
|
330
|
+
ariaLabel: E,
|
|
331
|
+
errorTitle: V,
|
|
332
|
+
errorDescId: B,
|
|
333
|
+
onClick: y,
|
|
334
|
+
id: P
|
|
322
335
|
})
|
|
323
336
|
]
|
|
324
337
|
}),
|
|
325
|
-
|
|
326
|
-
id:
|
|
338
|
+
z && /* @__PURE__ */ J("span", {
|
|
339
|
+
id: B,
|
|
327
340
|
role: "status",
|
|
328
341
|
"aria-live": "polite",
|
|
329
342
|
className: "sr-only",
|
|
330
|
-
children:
|
|
343
|
+
children: V
|
|
331
344
|
})
|
|
332
345
|
] });
|
|
333
|
-
return /* @__PURE__ */
|
|
346
|
+
return /* @__PURE__ */ J("div", {
|
|
334
347
|
style: d,
|
|
335
|
-
className: c("inline-flex",
|
|
336
|
-
children: /* @__PURE__ */
|
|
337
|
-
...
|
|
338
|
-
"aria-busy":
|
|
348
|
+
className: c("inline-flex", N),
|
|
349
|
+
children: /* @__PURE__ */ J("div", {
|
|
350
|
+
...me,
|
|
351
|
+
"aria-busy": R,
|
|
339
352
|
style: d,
|
|
340
|
-
className: c(
|
|
341
|
-
children:
|
|
353
|
+
className: c(de, se && "cursor-pointer", "focus-within:outline focus-within:outline-1 focus-within:outline-offset-1"),
|
|
354
|
+
children: G
|
|
342
355
|
})
|
|
343
356
|
});
|
|
344
|
-
},
|
|
357
|
+
}, Ze = /* @__PURE__ */ function(e) {
|
|
345
358
|
return e.Idle = "idle", e.Loading = "loading", e.Loaded = "loaded", e.Error = "error", e;
|
|
346
|
-
}({}),
|
|
347
|
-
let n = ge(null), [r, i] =
|
|
348
|
-
return
|
|
359
|
+
}({}), Qe = ({ enabled: e, src: t }) => {
|
|
360
|
+
let n = ge(null), [r, i] = q("idle");
|
|
361
|
+
return G(() => {
|
|
349
362
|
i(e && t ? "loading" : "idle");
|
|
350
|
-
}, [e, t]),
|
|
363
|
+
}, [e, t]), G(() => {
|
|
351
364
|
let r = n.current;
|
|
352
365
|
if (!r || !e || !t) return;
|
|
353
366
|
let a = () => i("loaded"), o = () => i("error");
|
|
@@ -358,12 +371,12 @@ var J = {
|
|
|
358
371
|
imageRef: n,
|
|
359
372
|
imageLoadStatus: r
|
|
360
373
|
};
|
|
361
|
-
},
|
|
362
|
-
let { clickLabel: d = "Open attachment", expandLabel: m = "Expand pasted text", removeLabel: h = "Remove attachment", downloadLabel: g = "Download attachment" } = i ?? {}, { className:
|
|
374
|
+
}, $e = ({ attachment: e, onExpand: n, onClick: r, labels: i, onRemove: a, cssVars: o, onDownload: s, styles: l, isSelected: u }) => {
|
|
375
|
+
let { clickLabel: d = "Open attachment", expandLabel: m = "Expand pasted text", removeLabel: h = "Remove attachment", downloadLabel: g = "Download attachment" } = i ?? {}, { className: _ } = l ?? {}, { id: v, name: x } = e, S = e.previewUrl ?? e.url, C = e.type === t.Pasted && n !== void 0, { isLoading: w, isError: T, isImage: E } = K(() => He(e), [e]), D = r !== void 0 && !C && !w && !T, O = C || D, { imageRef: k, imageLoadStatus: A } = Qe({
|
|
363
376
|
enabled: E,
|
|
364
377
|
src: S
|
|
365
378
|
}), j = () => {
|
|
366
|
-
C && n ? n(
|
|
379
|
+
C && n ? n(v) : D && r && r(v);
|
|
367
380
|
}, M = O ? {
|
|
368
381
|
role: "button",
|
|
369
382
|
tabIndex: 0,
|
|
@@ -373,52 +386,52 @@ var J = {
|
|
|
373
386
|
e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), j());
|
|
374
387
|
}
|
|
375
388
|
} : {};
|
|
376
|
-
return /* @__PURE__ */
|
|
377
|
-
className: c(
|
|
389
|
+
return /* @__PURE__ */ J("div", {
|
|
390
|
+
className: c(Ue, "group/attachment-tile", O && "cursor-pointer", Q.tile, u && Q.selected, _, Z.tile, u && Z.tileSelected),
|
|
378
391
|
...M,
|
|
379
392
|
style: o,
|
|
380
|
-
children: /* @__PURE__ */
|
|
393
|
+
children: /* @__PURE__ */ Y("div", {
|
|
381
394
|
className: "relative h-full w-full overflow-hidden",
|
|
382
395
|
children: [
|
|
383
|
-
/* @__PURE__ */
|
|
396
|
+
/* @__PURE__ */ Y("div", {
|
|
384
397
|
className: "absolute end-1 top-1 z-10 flex gap-1",
|
|
385
|
-
children: [a && /* @__PURE__ */
|
|
398
|
+
children: [a && /* @__PURE__ */ J(Je, {
|
|
386
399
|
ariaLabel: h,
|
|
387
400
|
onClick: a,
|
|
388
|
-
id:
|
|
401
|
+
id: v,
|
|
389
402
|
className: Q.imageActionButton
|
|
390
|
-
}), s && /* @__PURE__ */
|
|
403
|
+
}), s && /* @__PURE__ */ J(Ke, {
|
|
391
404
|
ariaLabel: g,
|
|
392
405
|
onClick: s,
|
|
393
|
-
id:
|
|
406
|
+
id: v,
|
|
394
407
|
className: Q.imageActionButton
|
|
395
408
|
})]
|
|
396
409
|
}),
|
|
397
|
-
A !==
|
|
398
|
-
variant:
|
|
410
|
+
A !== Ze.Loaded && /* @__PURE__ */ J(y, {
|
|
411
|
+
variant: b.Rectangular,
|
|
399
412
|
width: "100%",
|
|
400
413
|
height: "100%",
|
|
401
|
-
active: A ===
|
|
402
|
-
overlay: /* @__PURE__ */
|
|
414
|
+
active: A === Ze.Loading,
|
|
415
|
+
overlay: /* @__PURE__ */ J(U, {
|
|
403
416
|
size: f.LG,
|
|
404
|
-
className: Q.
|
|
417
|
+
className: Q.placeholderIcon,
|
|
405
418
|
"aria-hidden": !0,
|
|
406
419
|
stroke: p
|
|
407
420
|
}),
|
|
408
421
|
className: "absolute inset-0 rounded-xl"
|
|
409
422
|
}),
|
|
410
|
-
/* @__PURE__ */
|
|
423
|
+
/* @__PURE__ */ J("img", {
|
|
411
424
|
ref: k,
|
|
412
425
|
src: S,
|
|
413
426
|
alt: x,
|
|
414
427
|
loading: "lazy",
|
|
415
428
|
decoding: "async",
|
|
416
|
-
className: c("h-full w-full rounded-xl object-cover transition-opacity duration-200", A ===
|
|
429
|
+
className: c("h-full w-full rounded-xl object-cover transition-opacity duration-200", A === Ze.Loaded ? "opacity-100" : "opacity-0")
|
|
417
430
|
})
|
|
418
431
|
]
|
|
419
432
|
})
|
|
420
433
|
});
|
|
421
|
-
},
|
|
434
|
+
}, et = ({ attachment: e, searchQuery: n = "", onRemove: r, onRetry: i, onExpand: a, onClick: o, onDownload: c, labels: l, styles: u, isSelected: d }) => {
|
|
422
435
|
let { colors: f } = u ?? {}, p = e.type === t.Pasted && a !== void 0, m = s({
|
|
423
436
|
"--ai-tile-bg": f?.background,
|
|
424
437
|
"--ai-tile-border": f?.border,
|
|
@@ -432,11 +445,12 @@ var J = {
|
|
|
432
445
|
"--ai-tile-error-text": f?.errorText,
|
|
433
446
|
"--ai-tile-name-text": f?.nameText,
|
|
434
447
|
"--ai-tile-type-text": f?.typeText,
|
|
448
|
+
"--ai-tile-placeholder-icon": f?.placeholderIcon,
|
|
435
449
|
"--ai-tile-hover-icon-bg": f?.hoverIconBackground,
|
|
436
450
|
"--ai-tile-hover-icon-color": f?.hoverIconColor,
|
|
437
451
|
"--ai-tile-progress-track": f?.trackBackground
|
|
438
|
-
}), { isImage: h, isLink: g } =
|
|
439
|
-
return h ? /* @__PURE__ */
|
|
452
|
+
}), { isImage: h, isLink: g } = K(() => He(e), [e]);
|
|
453
|
+
return h ? /* @__PURE__ */ J($e, {
|
|
440
454
|
attachment: e,
|
|
441
455
|
labels: l,
|
|
442
456
|
onClick: o,
|
|
@@ -446,7 +460,7 @@ var J = {
|
|
|
446
460
|
cssVars: m,
|
|
447
461
|
onDownload: c,
|
|
448
462
|
isSelected: d
|
|
449
|
-
}) : /* @__PURE__ */
|
|
463
|
+
}) : /* @__PURE__ */ J(Xe, {
|
|
450
464
|
attachment: e,
|
|
451
465
|
searchQuery: n,
|
|
452
466
|
onClick: o,
|
|
@@ -461,7 +475,7 @@ var J = {
|
|
|
461
475
|
isExpandable: p,
|
|
462
476
|
isSelected: d
|
|
463
477
|
});
|
|
464
|
-
},
|
|
478
|
+
}, tt = (e) => {
|
|
465
479
|
let t = l(e);
|
|
466
480
|
if (!e?.length) return t;
|
|
467
481
|
let n = /* @__PURE__ */ new Map();
|
|
@@ -476,7 +490,7 @@ var J = {
|
|
|
476
490
|
contentType: t
|
|
477
491
|
} : e;
|
|
478
492
|
});
|
|
479
|
-
},
|
|
493
|
+
}, nt = ({ children: e, codeClassName: t, blockClassName: n = "dial-code-text", copyAriaLabel: i, copiedLabel: a }) => /* @__PURE__ */ J(r, {
|
|
480
494
|
language: t?.replace(/^language-/, "") ?? "",
|
|
481
495
|
value: typeof e == "string" ? e : String(e ?? ""),
|
|
482
496
|
codeClassName: n,
|
|
@@ -484,9 +498,9 @@ var J = {
|
|
|
484
498
|
copyLabel: i,
|
|
485
499
|
copiedLabel: a,
|
|
486
500
|
hideDownload: !0
|
|
487
|
-
}),
|
|
501
|
+
}), rt = me(({ content: e, typography: t, copyAriaLabel: n = "Copy", copiedLabel: r, tableScrollRegionAriaLabel: a, mathScrollRegionAriaLabel: o }) => {
|
|
488
502
|
let s = "mb-1.5 last:mb-0", l = c(t?.headingClassName ?? "dial-small-semi-text", X.stageContent, s);
|
|
489
|
-
return /* @__PURE__ */
|
|
503
|
+
return /* @__PURE__ */ J(i, {
|
|
490
504
|
content: e,
|
|
491
505
|
tableScrollRegionAriaLabel: a,
|
|
492
506
|
mathScrollRegionAriaLabel: o,
|
|
@@ -506,75 +520,75 @@ var J = {
|
|
|
506
520
|
link: c(t?.contentClassName ?? "dial-tiny-text", X.stageContent),
|
|
507
521
|
tableCell: c(t?.contentClassName ?? "dial-tiny-text", X.tableCell)
|
|
508
522
|
},
|
|
509
|
-
components: { code: ({ children: e, className: i }) => i?.includes("language-") ? /* @__PURE__ */
|
|
523
|
+
components: { code: ({ children: e, className: i }) => i?.includes("language-") ? /* @__PURE__ */ J(nt, {
|
|
510
524
|
codeClassName: i,
|
|
511
525
|
blockClassName: t?.codeBlockClassName,
|
|
512
526
|
copyAriaLabel: n,
|
|
513
527
|
copiedLabel: r,
|
|
514
528
|
children: e
|
|
515
|
-
}) : /* @__PURE__ */
|
|
529
|
+
}) : /* @__PURE__ */ J("code", {
|
|
516
530
|
className: c("px-1 py-0.5", t?.codeClassName ?? "dial-tiny-text rounded-md", X.codeInline),
|
|
517
531
|
children: e
|
|
518
532
|
}) }
|
|
519
533
|
});
|
|
520
|
-
}),
|
|
521
|
-
let r =
|
|
534
|
+
}), it = ({ attachments: e, clickLabel: t, onAttachmentClick: n }) => {
|
|
535
|
+
let r = W((t) => {
|
|
522
536
|
let r = e.find((e) => e.id === t);
|
|
523
537
|
r && n?.(r);
|
|
524
538
|
}, [e, n]);
|
|
525
|
-
return /* @__PURE__ */
|
|
539
|
+
return /* @__PURE__ */ J("div", {
|
|
526
540
|
role: "list",
|
|
527
|
-
className: "flex flex-wrap gap-
|
|
528
|
-
children: e.map((e) => /* @__PURE__ */
|
|
541
|
+
className: "flex flex-wrap gap-2",
|
|
542
|
+
children: e.map((e) => /* @__PURE__ */ J("div", {
|
|
529
543
|
role: "listitem",
|
|
530
|
-
children: /* @__PURE__ */
|
|
544
|
+
children: /* @__PURE__ */ J(et, {
|
|
531
545
|
attachment: e,
|
|
532
546
|
onClick: n && r,
|
|
533
547
|
labels: { clickLabel: t }
|
|
534
548
|
})
|
|
535
549
|
}, e.id))
|
|
536
550
|
});
|
|
537
|
-
},
|
|
538
|
-
let [f, p] =
|
|
551
|
+
}, at = ({ stage: e, isLive: t, typography: n, labels: r, nameOverride: i, onAttachmentClick: a, childList: s, isExpanded: l, onToggle: u }) => {
|
|
552
|
+
let [f, p] = q(!1), m = l ?? f, h = W((e) => {
|
|
539
553
|
l === void 0 && p(e), u?.(e);
|
|
540
|
-
}, [l, u]), { copyAriaLabel: _ = "Copy stage content", codeBlockCopiedLabel: v, tableScrollRegionAriaLabel: y, mathScrollRegionAriaLabel: b, runningAriaLabel: x, failedAriaLabel: S, attachmentClickLabel: C = "Preview search result" } = r ?? {}, w =
|
|
541
|
-
/* @__PURE__ */
|
|
554
|
+
}, [l, u]), { copyAriaLabel: _ = "Copy stage content", codeBlockCopiedLabel: v, tableScrollRegionAriaLabel: y, mathScrollRegionAriaLabel: b, runningAriaLabel: x, failedAriaLabel: S, attachmentClickLabel: C = "Preview search result" } = r ?? {}, w = K(() => tt(e.attachments), [e.attachments]), { name: T, durationLabel: E } = we(e.name), D = i ?? T, O = !i && Te(T), k = e.status === o.Failed, A = !!e.content || !!e.attachments?.length, j = A || s != null, M = /* @__PURE__ */ Y(_e, { children: [
|
|
555
|
+
/* @__PURE__ */ J("span", {
|
|
542
556
|
className: "flex flex-none items-center",
|
|
543
|
-
children: /* @__PURE__ */
|
|
557
|
+
children: /* @__PURE__ */ J(Pe, {
|
|
544
558
|
status: e.status,
|
|
545
559
|
isLive: t,
|
|
546
560
|
runningLabel: x,
|
|
547
561
|
failedLabel: S
|
|
548
562
|
})
|
|
549
563
|
}),
|
|
550
|
-
/* @__PURE__ */
|
|
564
|
+
/* @__PURE__ */ J("span", {
|
|
551
565
|
className: c("min-w-0 max-w-[22rem] truncate", n?.fontClassName ?? "dial-small-text", X.stageName, k && X.stageNameFailed, O && X.monoName),
|
|
552
|
-
children: /* @__PURE__ */
|
|
566
|
+
children: /* @__PURE__ */ J(g, { text: D || e.status || "" })
|
|
553
567
|
}),
|
|
554
|
-
e.tag && /* @__PURE__ */
|
|
568
|
+
e.tag && /* @__PURE__ */ J("span", {
|
|
555
569
|
className: c("flex-none", n?.tagClassName ?? "dial-tiny-lead-text", X.tag),
|
|
556
570
|
children: e.tag
|
|
557
571
|
}),
|
|
558
|
-
E && /* @__PURE__ */
|
|
572
|
+
E && /* @__PURE__ */ J("span", {
|
|
559
573
|
className: c("flex-none", n?.countFontClassName ?? "dial-tiny-text", X.duration),
|
|
560
574
|
children: E
|
|
561
575
|
})
|
|
562
576
|
] });
|
|
563
|
-
return j ? /* @__PURE__ */
|
|
577
|
+
return j ? /* @__PURE__ */ Y(d, {
|
|
564
578
|
expanded: m,
|
|
565
|
-
onToggle:
|
|
566
|
-
title: /* @__PURE__ */
|
|
579
|
+
onToggle: h,
|
|
580
|
+
title: /* @__PURE__ */ J("span", {
|
|
567
581
|
className: "flex min-w-0 items-center gap-2",
|
|
568
582
|
children: M
|
|
569
583
|
}),
|
|
570
|
-
className:
|
|
571
|
-
headerClassName: c(
|
|
584
|
+
className: je,
|
|
585
|
+
headerClassName: c(Me, X.row, X.stageHeader),
|
|
572
586
|
contentClassName: c("-mt-1 flex min-w-0 flex-col gap-3 px-0 py-1", X.stageRegion),
|
|
573
|
-
children: [m && A && /* @__PURE__ */
|
|
587
|
+
children: [m && A && /* @__PURE__ */ Y("div", {
|
|
574
588
|
className: "flex min-w-0 flex-col gap-3 ps-8",
|
|
575
|
-
children: [e.content && /* @__PURE__ */
|
|
589
|
+
children: [e.content && /* @__PURE__ */ J("div", {
|
|
576
590
|
className: "max-h-[300px] min-w-0 overflow-y-auto",
|
|
577
|
-
children: /* @__PURE__ */
|
|
591
|
+
children: /* @__PURE__ */ J(rt, {
|
|
578
592
|
content: e.content,
|
|
579
593
|
typography: n,
|
|
580
594
|
copyAriaLabel: _,
|
|
@@ -582,19 +596,19 @@ var J = {
|
|
|
582
596
|
tableScrollRegionAriaLabel: y,
|
|
583
597
|
mathScrollRegionAriaLabel: b
|
|
584
598
|
})
|
|
585
|
-
}), w.length > 0 && /* @__PURE__ */
|
|
599
|
+
}), w.length > 0 && /* @__PURE__ */ J(it, {
|
|
586
600
|
attachments: w,
|
|
587
601
|
clickLabel: C,
|
|
588
602
|
onAttachmentClick: a
|
|
589
603
|
})]
|
|
590
604
|
}), m && s]
|
|
591
|
-
}) : /* @__PURE__ */
|
|
605
|
+
}) : /* @__PURE__ */ J("div", {
|
|
592
606
|
className: c("flex w-full items-center gap-2 px-2 py-1.5", X.row),
|
|
593
607
|
children: M
|
|
594
608
|
});
|
|
595
|
-
},
|
|
596
|
-
let c =
|
|
597
|
-
return /* @__PURE__ */
|
|
609
|
+
}, ot = (e) => e <= 3 ? "ps-4" : "ps-0", st = (e) => e <= 3 ? "ps-6" : "ps-0", ct = ({ node: e, depth: t, nameOverride: n, isStreaming: r, expansion: i, typography: a, labels: o, onAttachmentClick: s }) => {
|
|
610
|
+
let c = ke(e.stage.index), l = t + 1;
|
|
611
|
+
return /* @__PURE__ */ J(at, {
|
|
598
612
|
stage: e.stage,
|
|
599
613
|
nameOverride: n,
|
|
600
614
|
isLive: r && e.stage.status == null,
|
|
@@ -603,10 +617,10 @@ var J = {
|
|
|
603
617
|
onAttachmentClick: s,
|
|
604
618
|
isExpanded: i.isExpanded(c),
|
|
605
619
|
onToggle: (e) => i.onToggle(c, e),
|
|
606
|
-
childList: e.children.length > 0 ? /* @__PURE__ */
|
|
620
|
+
childList: e.children.length > 0 ? /* @__PURE__ */ J(ut, {
|
|
607
621
|
nodes: e.children,
|
|
608
622
|
depth: l,
|
|
609
|
-
className:
|
|
623
|
+
className: ot(l),
|
|
610
624
|
isStreaming: r,
|
|
611
625
|
expansion: i,
|
|
612
626
|
typography: a,
|
|
@@ -614,28 +628,28 @@ var J = {
|
|
|
614
628
|
onAttachmentClick: s
|
|
615
629
|
}) : void 0
|
|
616
630
|
});
|
|
617
|
-
},
|
|
618
|
-
let { runningAriaLabel: l, failedAriaLabel: u, attemptLabel: f = (e) => `Attempt ${e}` } = a ?? {}, p = e.attempts ?? [], m = p.some((e) => e.stage.status == null),
|
|
619
|
-
m ? _ = null :
|
|
620
|
-
let v =
|
|
621
|
-
return /* @__PURE__ */
|
|
622
|
-
title: /* @__PURE__ */
|
|
631
|
+
}, lt = ({ row: e, depth: t, isStreaming: n, expansion: r, typography: i, labels: a, onAttachmentClick: s }) => {
|
|
632
|
+
let { runningAriaLabel: l, failedAriaLabel: u, attemptLabel: f = (e) => `Attempt ${e}` } = a ?? {}, p = e.attempts ?? [], m = p.some((e) => e.stage.status == null), h = p.some((e) => e.stage.status === o.Failed), _ = o.Completed;
|
|
633
|
+
m ? _ = null : h && (_ = o.Failed);
|
|
634
|
+
let v = Ae(e.key), y = r.isExpanded(v), b = t + 1;
|
|
635
|
+
return /* @__PURE__ */ J(d, {
|
|
636
|
+
title: /* @__PURE__ */ Y("span", {
|
|
623
637
|
className: "flex min-w-0 items-center gap-2",
|
|
624
638
|
children: [
|
|
625
|
-
/* @__PURE__ */
|
|
639
|
+
/* @__PURE__ */ J("span", {
|
|
626
640
|
className: "flex flex-none items-center",
|
|
627
|
-
children: /* @__PURE__ */
|
|
641
|
+
children: /* @__PURE__ */ J(Pe, {
|
|
628
642
|
status: _,
|
|
629
643
|
isLive: n && m,
|
|
630
644
|
runningLabel: l,
|
|
631
645
|
failedLabel: u
|
|
632
646
|
})
|
|
633
647
|
}),
|
|
634
|
-
/* @__PURE__ */
|
|
635
|
-
className: c("min-w-0 max-w-[22rem] truncate", i?.fontClassName ?? "dial-small-text", X.stageName,
|
|
636
|
-
children: /* @__PURE__ */
|
|
648
|
+
/* @__PURE__ */ J("span", {
|
|
649
|
+
className: c("min-w-0 max-w-[22rem] truncate", i?.fontClassName ?? "dial-small-text", X.stageName, h && X.stageNameFailed),
|
|
650
|
+
children: /* @__PURE__ */ J(g, { text: e.name })
|
|
637
651
|
}),
|
|
638
|
-
/* @__PURE__ */
|
|
652
|
+
/* @__PURE__ */ Y("span", {
|
|
639
653
|
className: c("flex-none", i?.countFontClassName ?? "dial-tiny-text", X.count),
|
|
640
654
|
children: ["×", p.length]
|
|
641
655
|
})
|
|
@@ -643,16 +657,16 @@ var J = {
|
|
|
643
657
|
}),
|
|
644
658
|
expanded: y,
|
|
645
659
|
onToggle: (e) => r.onToggle(v, e),
|
|
646
|
-
className:
|
|
647
|
-
headerClassName: c(
|
|
648
|
-
contentClassName: c("-mt-2 min-w-0 px-0",
|
|
649
|
-
children: /* @__PURE__ */
|
|
660
|
+
className: je,
|
|
661
|
+
headerClassName: c(Me, X.collapseButton, X.row, X.stageHeader),
|
|
662
|
+
contentClassName: c("-mt-2 min-w-0 px-0", st(b), X.stageRegion),
|
|
663
|
+
children: /* @__PURE__ */ J("ul", {
|
|
650
664
|
role: "list",
|
|
651
665
|
className: "flex min-w-0 flex-col gap-0.5",
|
|
652
|
-
children: y && p.map((e, t) => /* @__PURE__ */
|
|
666
|
+
children: y && p.map((e, t) => /* @__PURE__ */ J("li", {
|
|
653
667
|
role: "listitem",
|
|
654
668
|
className: "min-w-0",
|
|
655
|
-
children: /* @__PURE__ */
|
|
669
|
+
children: /* @__PURE__ */ J(ct, {
|
|
656
670
|
node: e,
|
|
657
671
|
depth: b,
|
|
658
672
|
nameOverride: f(t + 1),
|
|
@@ -665,23 +679,23 @@ var J = {
|
|
|
665
679
|
}, e.stage.index))
|
|
666
680
|
})
|
|
667
681
|
});
|
|
668
|
-
},
|
|
682
|
+
}, ut = ({ nodes: e, depth: t, className: n, ...r }) => /* @__PURE__ */ J("ul", {
|
|
669
683
|
role: "list",
|
|
670
684
|
className: c("flex min-w-0 flex-col gap-0.5", n),
|
|
671
|
-
children:
|
|
685
|
+
children: Ne(e).map((e) => /* @__PURE__ */ J("li", {
|
|
672
686
|
role: "listitem",
|
|
673
687
|
className: "min-w-0",
|
|
674
|
-
children: e.node ? /* @__PURE__ */
|
|
688
|
+
children: e.node ? /* @__PURE__ */ J(ct, {
|
|
675
689
|
node: e.node,
|
|
676
690
|
depth: t,
|
|
677
691
|
...r
|
|
678
|
-
}) : /* @__PURE__ */
|
|
692
|
+
}) : /* @__PURE__ */ J(lt, {
|
|
679
693
|
row: e,
|
|
680
694
|
depth: t,
|
|
681
695
|
...r
|
|
682
696
|
})
|
|
683
697
|
}, e.key))
|
|
684
|
-
}),
|
|
698
|
+
}), dt = ({ stages: e, isStreaming: t, className: n, styles: r, labels: i, onAttachmentClick: a, expansion: o }) => {
|
|
685
699
|
let { colors: l, typography: u } = r ?? {}, d = s({
|
|
686
700
|
"--cs-text": l?.text,
|
|
687
701
|
"--cs-row-hover": l?.rowHoverColor,
|
|
@@ -698,11 +712,11 @@ var J = {
|
|
|
698
712
|
"--cs-code-border": l?.codeBorderColor,
|
|
699
713
|
"--cs-code-text": l?.codeTextColor,
|
|
700
714
|
"--cs-border": l?.borderColor
|
|
701
|
-
}), f =
|
|
702
|
-
return /* @__PURE__ */
|
|
715
|
+
}), f = K(() => Oe(e), [e]);
|
|
716
|
+
return /* @__PURE__ */ J("div", {
|
|
703
717
|
style: d,
|
|
704
|
-
className: c("w-full min-w-0", X.panel, n,
|
|
705
|
-
children: /* @__PURE__ */
|
|
718
|
+
className: c("w-full min-w-0", X.panel, n, ve.panel),
|
|
719
|
+
children: /* @__PURE__ */ J(ut, {
|
|
706
720
|
nodes: f,
|
|
707
721
|
depth: 0,
|
|
708
722
|
className: "w-full ps-5",
|
|
@@ -713,9 +727,9 @@ var J = {
|
|
|
713
727
|
onAttachmentClick: a
|
|
714
728
|
})
|
|
715
729
|
});
|
|
716
|
-
},
|
|
717
|
-
let t =
|
|
718
|
-
return /* @__PURE__ */
|
|
730
|
+
}, ft = (e) => {
|
|
731
|
+
let t = ye();
|
|
732
|
+
return /* @__PURE__ */ J(dt, {
|
|
719
733
|
...e,
|
|
720
734
|
expansion: t
|
|
721
735
|
});
|
|
@@ -726,9 +740,9 @@ var J = {
|
|
|
726
740
|
doneIcon: "_doneIcon_16fae_36",
|
|
727
741
|
failedText: "_failedText_16fae_40",
|
|
728
742
|
liveName: "_liveName_16fae_44"
|
|
729
|
-
},
|
|
730
|
-
let { executedLabel: l = "Executed", stepsLabel: u = () => "steps", failedCountLabel: m = (e) => `${e} failed`, runningAriaLabel:
|
|
731
|
-
|
|
743
|
+
}, pt = ({ stages: e, isStreaming: t, labels: n, className: r, styles: i, onAttachmentClick: a }) => {
|
|
744
|
+
let { executedLabel: l = "Executed", stepsLabel: u = () => "steps", failedCountLabel: m = (e) => `${e} failed`, runningAriaLabel: h = "Running", copyAriaLabel: _, codeBlockCopiedLabel: v, tableScrollRegionAriaLabel: y, mathScrollRegionAriaLabel: b, failedAriaLabel: S, attemptLabel: C, attachmentClickLabel: T } = n ?? {}, [E, D] = q(t), O = ye(), { reset: k } = O, A = e.length > 1;
|
|
745
|
+
G(() => {
|
|
732
746
|
A && !E && k();
|
|
733
747
|
}, [
|
|
734
748
|
A,
|
|
@@ -736,7 +750,7 @@ var J = {
|
|
|
736
750
|
k
|
|
737
751
|
]);
|
|
738
752
|
let j = ge(t);
|
|
739
|
-
|
|
753
|
+
G(() => {
|
|
740
754
|
j.current && !t && D(!1), j.current = t;
|
|
741
755
|
}, [t]);
|
|
742
756
|
let { colors: M, panel: N } = i ?? {}, P = i?.typography ?? { fontClassName: "dial-small-text" }, F = s({
|
|
@@ -764,14 +778,14 @@ var J = {
|
|
|
764
778
|
let I = {
|
|
765
779
|
copyAriaLabel: _,
|
|
766
780
|
codeBlockCopiedLabel: v,
|
|
767
|
-
tableScrollRegionAriaLabel:
|
|
768
|
-
mathScrollRegionAriaLabel:
|
|
769
|
-
runningAriaLabel:
|
|
770
|
-
failedAriaLabel:
|
|
771
|
-
attemptLabel:
|
|
781
|
+
tableScrollRegionAriaLabel: y,
|
|
782
|
+
mathScrollRegionAriaLabel: b,
|
|
783
|
+
runningAriaLabel: h,
|
|
784
|
+
failedAriaLabel: S,
|
|
785
|
+
attemptLabel: C,
|
|
772
786
|
attachmentClickLabel: T
|
|
773
787
|
};
|
|
774
|
-
if (e.length === 1) return /* @__PURE__ */
|
|
788
|
+
if (e.length === 1) return /* @__PURE__ */ J(dt, {
|
|
775
789
|
stages: e,
|
|
776
790
|
isStreaming: t,
|
|
777
791
|
expansion: O,
|
|
@@ -785,27 +799,27 @@ var J = {
|
|
|
785
799
|
});
|
|
786
800
|
let L = e.some((e) => e.status === o.Failed), R;
|
|
787
801
|
if (t) {
|
|
788
|
-
let t =
|
|
789
|
-
R = /* @__PURE__ */
|
|
802
|
+
let t = we((Ee(e) ?? e[e.length - 1]).name).name;
|
|
803
|
+
R = /* @__PURE__ */ Y("span", {
|
|
790
804
|
role: "status",
|
|
791
805
|
"aria-live": "polite",
|
|
792
806
|
className: "flex min-w-0 items-center gap-2",
|
|
793
|
-
children: [/* @__PURE__ */
|
|
807
|
+
children: [/* @__PURE__ */ J("span", {
|
|
794
808
|
className: "flex flex-none items-center",
|
|
795
|
-
children: /* @__PURE__ */
|
|
809
|
+
children: /* @__PURE__ */ J(x, {
|
|
796
810
|
size: 14,
|
|
797
|
-
ariaLabel:
|
|
811
|
+
ariaLabel: h
|
|
798
812
|
})
|
|
799
|
-
}), t && /* @__PURE__ */
|
|
813
|
+
}), t && /* @__PURE__ */ J("span", {
|
|
800
814
|
className: c("min-w-0 max-w-[22rem] truncate", P.fontClassName, $.liveName),
|
|
801
|
-
children: /* @__PURE__ */
|
|
815
|
+
children: /* @__PURE__ */ J(g, { text: t })
|
|
802
816
|
})]
|
|
803
817
|
});
|
|
804
818
|
} else if (L) {
|
|
805
819
|
let t = e.filter((e) => e.status === o.Failed).length;
|
|
806
|
-
R = /* @__PURE__ */
|
|
820
|
+
R = /* @__PURE__ */ Y("span", {
|
|
807
821
|
className: "inline-flex items-center gap-1",
|
|
808
|
-
children: [/* @__PURE__ */
|
|
822
|
+
children: [/* @__PURE__ */ Y("span", {
|
|
809
823
|
className: c(P.fontClassName, $.executedLabel),
|
|
810
824
|
children: [
|
|
811
825
|
l,
|
|
@@ -814,19 +828,19 @@ var J = {
|
|
|
814
828
|
" ",
|
|
815
829
|
u(e.length)
|
|
816
830
|
]
|
|
817
|
-
}), /* @__PURE__ */
|
|
831
|
+
}), /* @__PURE__ */ J("span", {
|
|
818
832
|
className: c(P.fontClassName, $.failedText),
|
|
819
833
|
children: m(t)
|
|
820
834
|
})]
|
|
821
835
|
});
|
|
822
|
-
} else R = /* @__PURE__ */
|
|
836
|
+
} else R = /* @__PURE__ */ Y("span", {
|
|
823
837
|
className: "inline-flex items-center gap-1",
|
|
824
|
-
children: [/* @__PURE__ */
|
|
838
|
+
children: [/* @__PURE__ */ J(w, {
|
|
825
839
|
size: f.SM,
|
|
826
840
|
className: $.doneIcon,
|
|
827
841
|
"aria-hidden": !0,
|
|
828
842
|
stroke: p
|
|
829
|
-
}), /* @__PURE__ */
|
|
843
|
+
}), /* @__PURE__ */ Y("span", {
|
|
830
844
|
className: c(P.fontClassName, $.executedLabel),
|
|
831
845
|
children: [
|
|
832
846
|
l,
|
|
@@ -837,17 +851,17 @@ var J = {
|
|
|
837
851
|
]
|
|
838
852
|
})]
|
|
839
853
|
});
|
|
840
|
-
return /* @__PURE__ */
|
|
854
|
+
return /* @__PURE__ */ J("div", {
|
|
841
855
|
style: F,
|
|
842
|
-
className: c("flex w-full flex-col gap-1", r,
|
|
843
|
-
children: /* @__PURE__ */
|
|
856
|
+
className: c("flex w-full flex-col gap-1", r, ve.group),
|
|
857
|
+
children: /* @__PURE__ */ J(d, {
|
|
844
858
|
title: R,
|
|
845
859
|
expanded: E,
|
|
846
860
|
onToggle: D,
|
|
847
861
|
className: "overflow-visible py-0",
|
|
848
|
-
headerClassName: c("justify-start gap-1 rounded-none px-0", $.toggleButton,
|
|
862
|
+
headerClassName: c("justify-start gap-1 rounded-none px-0", $.toggleButton, ve.groupToggle),
|
|
849
863
|
contentClassName: c("-mt-2 px-0", $.groupRegion),
|
|
850
|
-
children: E && /* @__PURE__ */
|
|
864
|
+
children: E && /* @__PURE__ */ J(dt, {
|
|
851
865
|
stages: e,
|
|
852
866
|
isStreaming: t,
|
|
853
867
|
expansion: O,
|
|
@@ -863,4 +877,4 @@ var J = {
|
|
|
863
877
|
});
|
|
864
878
|
};
|
|
865
879
|
//#endregion
|
|
866
|
-
export {
|
|
880
|
+
export { ve as CONVERSATION_STAGES_CLASS, pt as CollapsedGroup, ft as StagesPanel };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-conversation-stages",
|
|
3
3
|
"description": "Panel for displaying agent processing stages during LLM response streaming",
|
|
4
|
-
"version": "1.3.0-dev.
|
|
4
|
+
"version": "1.3.0-dev.37",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@tabler/icons-react": "^3.44.0",
|
|
21
|
-
"@epam/ai-dial-attachment-input": "1.3.0-dev.
|
|
21
|
+
"@epam/ai-dial-attachment-input": "1.3.0-dev.37"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"react": "^19.2.8",
|
|
25
|
-
"@epam/ai-dial-chat-shared": "1.3.0-dev.
|
|
25
|
+
"@epam/ai-dial-chat-shared": "1.3.0-dev.37",
|
|
26
26
|
"@epam/ai-dial-ui-kit": "^0.15.3"
|
|
27
27
|
},
|
|
28
28
|
"repository": {
|