@epam/ai-dial-conversation-messages 1.1.0-dev.93 → 1.1.0-dev.99
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/components/MessageActions/MessageActions.d.ts.map +1 -1
- package/index.js +265 -269
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageActions.d.ts","sourceRoot":"","sources":["../../../src/components/MessageActions/MessageActions.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MessageActions.d.ts","sourceRoot":"","sources":["../../../src/components/MessageActions/MessageActions.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAE,EAAE,EAAyB,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAKxE,kIAAkI;AAClI,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAiJlD,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
import { AttachmentErrorReason as e, AttachmentType as t,
|
|
2
|
-
import { DIAL_ICON_SIZE as
|
|
3
|
-
import {
|
|
1
|
+
import { AttachmentErrorReason as e, AttachmentType as t, CopyIconButton as n, DeploymentIcon as r, MDMessageViewer as i, MIME_TYPE_EXT_MAP as a, MessageRating as o, MessageRole as s, RequestStatus as c, ResponseFormat as l, buildCssVars as u, mergeClasses as d, useCollapsedText as f } from "@epam/ai-dial-chat-shared";
|
|
2
|
+
import { DIAL_ICON_SIZE as p, DialInput as m, DialPopup as h, DialRadioGroup as g, DialSkeleton as _, DialSkeletonVariant as v, DialSlider as y, DialSpinner as b, DialTag as x, DialTooltip as S, ElementSize as C, GhostIconButton as w, Highlight as T, InfoMessageNotification as E, LinkButton as D, NeutralButton as O, PopupSize as k, PrimaryButton as A, RadioGroupOrientation as j } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { IconChevronDown as M, IconChevronUp as N, IconClipboard as P, IconDownload as F, IconExternalLink as I, IconFile as L, IconFileTypeBmp as R, IconFileTypeCss as z, IconFileTypeCsv as B, IconFileTypeDoc as V, IconFileTypeDocx as H, IconFileTypeHtml as U, IconFileTypeJpg as W, IconFileTypeJs as ee, IconFileTypeJsx as te, IconFileTypePdf as ne, IconFileTypePhp as re, IconFileTypePng as ie, IconFileTypePpt as ae, IconFileTypeRs as oe, IconFileTypeSql as se, IconFileTypeSvg as ce, IconFileTypeTs as le, IconFileTypeTsx as ue, IconFileTypeTxt as de, IconFileTypeVue as fe, IconFileTypeXls as pe, IconFileTypeXml as me, IconFileTypeZip as he, IconMusic as ge, IconPaperclip as _e, IconPencilMinus as ve, IconPhoto as G, IconRefresh as ye, IconReload as be, IconTerminal2 as xe, IconThumbDown as Se, IconThumbUp as Ce, IconTrashX as we, IconVideo as Te, IconX as Ee } from "@tabler/icons-react";
|
|
4
4
|
import "react-dom";
|
|
5
|
-
import { memo as
|
|
5
|
+
import { memo as De, useCallback as K, useEffect as Oe, useId as ke, useMemo as Ae, useRef as je, useState as q } from "react";
|
|
6
6
|
import { Fragment as J, jsx as Y, jsxs as X } from "react/jsx-runtime";
|
|
7
7
|
//#region ../attachment-input/dist/index.js
|
|
8
|
-
var
|
|
8
|
+
var Me = (e) => {
|
|
9
9
|
if (e == null) return "";
|
|
10
10
|
let t = e.lastIndexOf(".");
|
|
11
11
|
return t > 0 ? e.slice(0, t) : e;
|
|
12
|
-
},
|
|
13
|
-
if (!e) return
|
|
12
|
+
}, Ne = (e) => {
|
|
13
|
+
if (!e) return L;
|
|
14
14
|
if (e.startsWith("image/")) switch (e) {
|
|
15
15
|
case "image/jpeg":
|
|
16
|
-
case "image/jpg": return
|
|
17
|
-
case "image/png": return
|
|
18
|
-
case "image/svg+xml": return
|
|
19
|
-
case "image/bmp": return
|
|
16
|
+
case "image/jpg": return W;
|
|
17
|
+
case "image/png": return ie;
|
|
18
|
+
case "image/svg+xml": return ce;
|
|
19
|
+
case "image/bmp": return R;
|
|
20
20
|
default: return G;
|
|
21
21
|
}
|
|
22
|
-
if (e.startsWith("video/")) return
|
|
23
|
-
if (e.startsWith("audio/")) return
|
|
22
|
+
if (e.startsWith("video/")) return Te;
|
|
23
|
+
if (e.startsWith("audio/")) return ge;
|
|
24
24
|
switch (e) {
|
|
25
|
-
case "application/pdf": return
|
|
25
|
+
case "application/pdf": return ne;
|
|
26
26
|
case "application/msword":
|
|
27
|
-
case "application/vnd.ms-word": return
|
|
28
|
-
case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return
|
|
29
|
-
case "application/vnd.ms-powerpoint": return
|
|
30
|
-
case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return
|
|
31
|
-
case "application/vnd.ms-excel": return
|
|
32
|
-
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return
|
|
27
|
+
case "application/vnd.ms-word": return V;
|
|
28
|
+
case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return H;
|
|
29
|
+
case "application/vnd.ms-powerpoint": return ae;
|
|
30
|
+
case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return ae;
|
|
31
|
+
case "application/vnd.ms-excel": return pe;
|
|
32
|
+
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return pe;
|
|
33
33
|
case "application/zip":
|
|
34
34
|
case "application/x-zip-compressed":
|
|
35
35
|
case "application/x-rar-compressed":
|
|
36
36
|
case "application/x-7z-compressed":
|
|
37
37
|
case "application/gzip":
|
|
38
|
-
case "application/x-tar": return
|
|
39
|
-
case "text/csv": return
|
|
40
|
-
case "text/plain": return
|
|
38
|
+
case "application/x-tar": return he;
|
|
39
|
+
case "text/csv": return B;
|
|
40
|
+
case "text/plain": return de;
|
|
41
41
|
case "text/html":
|
|
42
|
-
case "application/xhtml+xml": return
|
|
42
|
+
case "application/xhtml+xml": return U;
|
|
43
43
|
case "text/xml":
|
|
44
|
-
case "application/xml": return
|
|
44
|
+
case "application/xml": return me;
|
|
45
45
|
case "application/sql":
|
|
46
|
-
case "text/x-sql": return
|
|
46
|
+
case "text/x-sql": return se;
|
|
47
47
|
case "text/javascript":
|
|
48
|
-
case "application/javascript": return
|
|
49
|
-
case "text/jsx": return
|
|
48
|
+
case "application/javascript": return ee;
|
|
49
|
+
case "text/jsx": return te;
|
|
50
50
|
case "application/typescript":
|
|
51
|
-
case "text/typescript": return
|
|
52
|
-
case "text/tsx": return
|
|
53
|
-
case "text/css": return
|
|
51
|
+
case "text/typescript": return le;
|
|
52
|
+
case "text/tsx": return ue;
|
|
53
|
+
case "text/css": return z;
|
|
54
54
|
case "text/x-php":
|
|
55
|
-
case "application/x-php": return
|
|
55
|
+
case "application/x-php": return re;
|
|
56
56
|
case "text/x-rustsrc":
|
|
57
|
-
case "application/x-rust": return
|
|
58
|
-
case "text/x-vue": return
|
|
59
|
-
default: return
|
|
57
|
+
case "application/x-rust": return oe;
|
|
58
|
+
case "text/x-vue": return fe;
|
|
59
|
+
default: return L;
|
|
60
60
|
}
|
|
61
|
-
},
|
|
61
|
+
}, Pe = (e) => {
|
|
62
62
|
let { type: n, contentType: r } = e;
|
|
63
|
-
return n === t.Prompt ?
|
|
64
|
-
},
|
|
65
|
-
let t = e.toLowerCase().split(";")[0].trim(), n =
|
|
63
|
+
return n === t.Prompt ? xe : n === t.Pasted ? P : n === t.Image ? G : Ne(r ?? "");
|
|
64
|
+
}, Fe = (e) => {
|
|
65
|
+
let t = e.toLowerCase().split(";")[0].trim(), n = a[t];
|
|
66
66
|
if (n) return n;
|
|
67
67
|
let r = t.split("/")[1];
|
|
68
68
|
if (r && !r.startsWith("vnd.") && !r.includes("+")) return r;
|
|
69
|
-
},
|
|
69
|
+
}, Ie = (e, n) => {
|
|
70
70
|
let { type: r, name: i, contentType: a } = e;
|
|
71
71
|
if (r === t.Prompt) return n.promptLabel ?? "Prompt";
|
|
72
72
|
if (r === t.Pasted) return n.pastedLabel ?? "Pasted";
|
|
73
73
|
if (r === t.Image) return n.imageLabel ?? "Image";
|
|
74
74
|
if (a) {
|
|
75
|
-
let e =
|
|
75
|
+
let e = Fe(a);
|
|
76
76
|
if (e) return `.${e}`;
|
|
77
77
|
}
|
|
78
78
|
let o = i.lastIndexOf(".");
|
|
79
79
|
return o > 0 && o < i.length - 1 ? `.${i.slice(o + 1).toLowerCase()}` : i;
|
|
80
|
-
},
|
|
81
|
-
let { type: r, status: i, previewUrl: a, url: o } = e,
|
|
80
|
+
}, Le = (e, n = {}) => {
|
|
81
|
+
let { type: r, status: i, previewUrl: a, url: o } = e, s = i === c.Loading, l = i === c.Error, u = r === t.Image && !!(a ?? o) && !l, d = r === t.Audio && !l, f = r === t.Link && !l;
|
|
82
82
|
return {
|
|
83
|
-
isLoading:
|
|
83
|
+
isLoading: s,
|
|
84
84
|
isError: l,
|
|
85
85
|
isImage: u,
|
|
86
86
|
isAudio: d,
|
|
87
87
|
isLink: f,
|
|
88
|
-
BottomIcon: f ? null :
|
|
89
|
-
typeLabel: f ? null :
|
|
88
|
+
BottomIcon: f ? null : Pe(e),
|
|
89
|
+
typeLabel: f ? null : Ie(e, n)
|
|
90
90
|
};
|
|
91
91
|
}, Z = {
|
|
92
92
|
tile: "_tile_1x4ax_1",
|
|
@@ -98,43 +98,43 @@ var Pe = (e) => {
|
|
|
98
98
|
retryIcon: "_retryIcon_1x4ax_30",
|
|
99
99
|
track: "_track_1x4ax_34",
|
|
100
100
|
imageActionButton: "_imageActionButton_1x4ax_38"
|
|
101
|
-
}, Q = ({ ariaLabel: e, errorTitle: t, errorDescId: n, onClick: r, id: i, icon: a, className: o }) => /* @__PURE__ */ Y(
|
|
101
|
+
}, Q = ({ ariaLabel: e, errorTitle: t, errorDescId: n, onClick: r, id: i, icon: a, className: o }) => /* @__PURE__ */ Y(w, {
|
|
102
102
|
icon: a,
|
|
103
|
-
size:
|
|
104
|
-
className:
|
|
103
|
+
size: C.Small,
|
|
104
|
+
className: d("absolute end-1 top-1 opacity-0 focus-visible:opacity-100 group-focus-within/attachment-tile:opacity-100 group-hover/attachment-tile:opacity-100", o),
|
|
105
105
|
"aria-label": e,
|
|
106
106
|
"aria-describedby": t ? n : void 0,
|
|
107
107
|
onClick: (e) => {
|
|
108
108
|
e.stopPropagation(), r(i);
|
|
109
109
|
}
|
|
110
|
-
}),
|
|
111
|
-
icon: /* @__PURE__ */ Y(
|
|
112
|
-
size:
|
|
110
|
+
}), Re = ({ ...e }) => /* @__PURE__ */ Y(Q, {
|
|
111
|
+
icon: /* @__PURE__ */ Y(be, {
|
|
112
|
+
size: p.SM,
|
|
113
113
|
"aria-hidden": !0
|
|
114
114
|
}),
|
|
115
115
|
className: Z.retryIcon,
|
|
116
116
|
...e
|
|
117
|
-
}),
|
|
118
|
-
icon: /* @__PURE__ */ Y(
|
|
119
|
-
size:
|
|
117
|
+
}), ze = ({ ...e }) => /* @__PURE__ */ Y(Q, {
|
|
118
|
+
icon: /* @__PURE__ */ Y(F, {
|
|
119
|
+
size: p.SM,
|
|
120
120
|
"aria-hidden": !0
|
|
121
121
|
}),
|
|
122
122
|
...e
|
|
123
|
-
}),
|
|
124
|
-
icon: /* @__PURE__ */ Y(
|
|
125
|
-
size:
|
|
123
|
+
}), Be = ({ ...e }) => /* @__PURE__ */ Y(Q, {
|
|
124
|
+
icon: /* @__PURE__ */ Y(I, {
|
|
125
|
+
size: p.SM,
|
|
126
126
|
"aria-hidden": !0
|
|
127
127
|
}),
|
|
128
128
|
...e
|
|
129
|
-
}),
|
|
130
|
-
icon: /* @__PURE__ */ Y(
|
|
131
|
-
size:
|
|
129
|
+
}), Ve = ({ ...e }) => /* @__PURE__ */ Y(Q, {
|
|
130
|
+
icon: /* @__PURE__ */ Y(Ee, {
|
|
131
|
+
size: p.SM,
|
|
132
132
|
"aria-hidden": !0
|
|
133
133
|
}),
|
|
134
134
|
className: Z.hoverIcon,
|
|
135
135
|
...e
|
|
136
|
-
}),
|
|
137
|
-
let { clickLabel: l = "Open attachment", downloadLabel:
|
|
136
|
+
}), He = ({ attachment: e, searchQuery: t = "", onClick: n, onDownload: r, onRemove: i, labels: a, styles: o, cssVars: s, isSelected: c }) => {
|
|
137
|
+
let { clickLabel: l = "Open attachment", downloadLabel: u = "Download attachment", removeLabel: f = "Remove attachment" } = a ?? {}, { typography: p, className: m } = o ?? {}, h = () => {
|
|
138
138
|
n?.(e.id);
|
|
139
139
|
};
|
|
140
140
|
return /* @__PURE__ */ X("div", {
|
|
@@ -148,12 +148,12 @@ var Pe = (e) => {
|
|
|
148
148
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), h());
|
|
149
149
|
}
|
|
150
150
|
},
|
|
151
|
-
className:
|
|
151
|
+
className: d("group/attachment-tile relative flex w-full min-w-[280px] max-w-[300px] flex-col gap-2 rounded-xl border p-3", n && "cursor-pointer", (r || i) && "pe-8", c && Z.selected, m),
|
|
152
152
|
children: [
|
|
153
153
|
/* @__PURE__ */ Y("span", {
|
|
154
154
|
title: e.name,
|
|
155
|
-
className:
|
|
156
|
-
children: t ? /* @__PURE__ */ Y(
|
|
155
|
+
className: d(p?.fontClassName ?? "dial-tiny-text", "min-w-0 truncate", Z.nameText),
|
|
156
|
+
children: t ? /* @__PURE__ */ Y(T, {
|
|
157
157
|
text: e.name,
|
|
158
158
|
query: t,
|
|
159
159
|
maxLines: 1
|
|
@@ -167,39 +167,39 @@ var Pe = (e) => {
|
|
|
167
167
|
preload: "metadata",
|
|
168
168
|
onClick: (e) => e.stopPropagation()
|
|
169
169
|
}),
|
|
170
|
-
r && /* @__PURE__ */ Y(
|
|
171
|
-
ariaLabel:
|
|
170
|
+
r && /* @__PURE__ */ Y(ze, {
|
|
171
|
+
ariaLabel: u,
|
|
172
172
|
onClick: r,
|
|
173
173
|
id: e.id
|
|
174
174
|
}),
|
|
175
|
-
i && /* @__PURE__ */ Y(
|
|
175
|
+
i && /* @__PURE__ */ Y(Ve, {
|
|
176
176
|
ariaLabel: f,
|
|
177
177
|
onClick: i,
|
|
178
178
|
id: e.id
|
|
179
179
|
})
|
|
180
180
|
]
|
|
181
181
|
});
|
|
182
|
-
},
|
|
182
|
+
}, Ue = "flex size-[84px] items-center justify-center rounded-xl border", We = {
|
|
183
183
|
[e.Network]: "Upload failed · network error",
|
|
184
184
|
[e.UnsupportedType]: "Upload failed · unsupported file type"
|
|
185
|
-
},
|
|
186
|
-
let { clickLabel: _ = "Download attachment", retryLabel: v = "Retry upload", sizeLabel:
|
|
185
|
+
}, Ge = ({ attachment: n, onClick: r, onRetry: i, labels: a, styles: o, onDownload: s, isPasted: l, isLink: u, cssVars: f, onExpand: p, isExpandable: m, onRemove: h, isSelected: g }) => {
|
|
186
|
+
let { clickLabel: _ = "Download attachment", retryLabel: v = "Retry upload", sizeLabel: y, uploadingLabel: x = "Uploading", errorReasonLabels: S, genericErrorLabel: C = "Upload failed" } = a ?? {}, { typography: w, className: T } = o ?? {}, { id: E, name: D, status: O, errorReason: k } = n, A = O === c.Loading, j = O === c.Error, M = ke(), N = j ? k && (S?.[k] ?? We[k]) || C : "", { BottomIcon: P, typeLabel: F } = Le(n), I = !j && !A && s && !u, L = j && !!i && k !== e.UnsupportedType, R = I || L ? "pe-5" : void 0, z = (e) => {
|
|
187
187
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), r?.(n.id));
|
|
188
|
-
}, B =
|
|
188
|
+
}, B = Ae(() => l ? D : Me(D), [l, D]), V = K(() => {
|
|
189
189
|
window.open(n.referenceUrl, "_blank", "noopener,noreferrer");
|
|
190
|
-
}, [n]), H =
|
|
190
|
+
}, [n]), H = d(Ue, "group/attachment-tile relative flex-col justify-between items-start gap-1 overflow-hidden p-1.5", Z.tile, (n.type === t.Prompt || n.type === t.Pasted) && "hovered", g && Z.selected, j && Z.tileError), U = /* @__PURE__ */ Y("div", {
|
|
191
191
|
title: B,
|
|
192
|
-
className:
|
|
192
|
+
className: d(w?.nameClassName ?? "dial-caption-text", "line-clamp-2 min-w-0 break-all", Z.nameText, !j && R),
|
|
193
193
|
children: B
|
|
194
194
|
}), W = P && /* @__PURE__ */ X("div", {
|
|
195
|
-
className:
|
|
195
|
+
className: d("flex w-full items-center gap-1", j && R),
|
|
196
196
|
children: [/* @__PURE__ */ Y(P, {
|
|
197
197
|
size: 16,
|
|
198
198
|
className: Z.typeText,
|
|
199
199
|
"aria-hidden": !0
|
|
200
200
|
}), /* @__PURE__ */ Y("span", {
|
|
201
|
-
className:
|
|
202
|
-
children:
|
|
201
|
+
className: d(w?.metaClassName ?? "dial-caption-text", "min-w-0 flex-1 truncate", Z.typeText),
|
|
202
|
+
children: y ? `${F} · ${y}` : F
|
|
203
203
|
})]
|
|
204
204
|
}), ee = () => {
|
|
205
205
|
m && p ? p(E) : r && r(E);
|
|
@@ -208,30 +208,30 @@ var Pe = (e) => {
|
|
|
208
208
|
A && /* @__PURE__ */ Y("div", {
|
|
209
209
|
role: "progressbar",
|
|
210
210
|
"aria-label": x,
|
|
211
|
-
className:
|
|
212
|
-
children: /* @__PURE__ */ Y(
|
|
211
|
+
className: d("absolute inset-x-2 bottom-2 h-[3px] overflow-hidden rounded-full", Z.track),
|
|
212
|
+
children: /* @__PURE__ */ Y(b, { size: 32 })
|
|
213
213
|
}),
|
|
214
|
-
I && /* @__PURE__ */ Y(
|
|
214
|
+
I && /* @__PURE__ */ Y(ze, {
|
|
215
215
|
ariaLabel: _,
|
|
216
216
|
errorTitle: N,
|
|
217
217
|
errorDescId: M,
|
|
218
|
-
onClick:
|
|
218
|
+
onClick: s,
|
|
219
219
|
id: E
|
|
220
220
|
}),
|
|
221
|
-
L && /* @__PURE__ */ Y(
|
|
221
|
+
L && /* @__PURE__ */ Y(Re, {
|
|
222
222
|
ariaLabel: v,
|
|
223
223
|
errorTitle: N,
|
|
224
224
|
errorDescId: M,
|
|
225
225
|
onClick: i,
|
|
226
226
|
id: E
|
|
227
227
|
}),
|
|
228
|
-
|
|
228
|
+
u && /* @__PURE__ */ Y(Be, {
|
|
229
229
|
ariaLabel: v,
|
|
230
230
|
errorTitle: N,
|
|
231
231
|
errorDescId: M,
|
|
232
232
|
onClick: V
|
|
233
233
|
}),
|
|
234
|
-
h && /* @__PURE__ */ Y(
|
|
234
|
+
h && /* @__PURE__ */ Y(Ve, {
|
|
235
235
|
ariaLabel: v,
|
|
236
236
|
errorTitle: N,
|
|
237
237
|
errorDescId: M,
|
|
@@ -248,7 +248,7 @@ var Pe = (e) => {
|
|
|
248
248
|
] });
|
|
249
249
|
return /* @__PURE__ */ Y("div", {
|
|
250
250
|
style: f,
|
|
251
|
-
className:
|
|
251
|
+
className: d("inline-flex", T),
|
|
252
252
|
children: /* @__PURE__ */ Y("div", {
|
|
253
253
|
role: "button",
|
|
254
254
|
tabIndex: 0,
|
|
@@ -256,17 +256,17 @@ var Pe = (e) => {
|
|
|
256
256
|
onClick: ee,
|
|
257
257
|
onKeyDown: z,
|
|
258
258
|
style: f,
|
|
259
|
-
className:
|
|
259
|
+
className: d(H, "cursor-pointer focus-within:outline focus-within:outline-1 focus-within:outline-offset-1"),
|
|
260
260
|
children: te
|
|
261
261
|
})
|
|
262
262
|
});
|
|
263
|
-
},
|
|
263
|
+
}, Ke = /* @__PURE__ */ function(e) {
|
|
264
264
|
return e.Idle = "idle", e.Loading = "loading", e.Loaded = "loaded", e.Error = "error", e;
|
|
265
|
-
}({}),
|
|
266
|
-
let n =
|
|
267
|
-
return
|
|
265
|
+
}({}), qe = ({ enabled: e, src: t }) => {
|
|
266
|
+
let n = je(null), [r, i] = q("idle");
|
|
267
|
+
return Oe(() => {
|
|
268
268
|
i(e && t ? "loading" : "idle");
|
|
269
|
-
}, [e, t]),
|
|
269
|
+
}, [e, t]), Oe(() => {
|
|
270
270
|
let r = n.current;
|
|
271
271
|
if (!r || !e || !t) return;
|
|
272
272
|
let a = () => i("loaded"), o = () => i("error");
|
|
@@ -277,15 +277,15 @@ var Pe = (e) => {
|
|
|
277
277
|
imageRef: n,
|
|
278
278
|
imageLoadStatus: r
|
|
279
279
|
};
|
|
280
|
-
},
|
|
281
|
-
let { clickLabel:
|
|
280
|
+
}, Je = ({ attachment: e, onExpand: n, onClick: r, labels: i, onRemove: a, cssVars: o, onDownload: s, styles: c, isSelected: l }) => {
|
|
281
|
+
let { clickLabel: u = "Open attachment", expandLabel: f = "Expand pasted text" } = i ?? {}, { className: m } = c ?? {}, { id: h, name: g } = e, y = e.previewUrl ?? e.url, b = e.type === t.Pasted && n !== void 0, { isLoading: x, isError: S, isImage: C } = Ae(() => Le(e), [e]), w = r !== void 0 && !b && !x && !S, { imageRef: T, imageLoadStatus: E } = qe({
|
|
282
282
|
enabled: C,
|
|
283
283
|
src: y
|
|
284
284
|
}), D = () => {
|
|
285
285
|
b && n ? n(h) : w && r && r(h);
|
|
286
286
|
};
|
|
287
287
|
return /* @__PURE__ */ Y("div", {
|
|
288
|
-
className:
|
|
288
|
+
className: d(Ue, "group/attachment-tile", w && "cursor-pointer", Z.tile, l && Z.selected, m),
|
|
289
289
|
onClick: D,
|
|
290
290
|
onKeyDown: (e) => {
|
|
291
291
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), D());
|
|
@@ -293,27 +293,27 @@ var Pe = (e) => {
|
|
|
293
293
|
tabIndex: 0,
|
|
294
294
|
role: "button",
|
|
295
295
|
style: o,
|
|
296
|
-
"aria-label": w ?
|
|
296
|
+
"aria-label": w ? u : b ? f : void 0,
|
|
297
297
|
children: /* @__PURE__ */ X("div", {
|
|
298
298
|
className: "relative h-full w-full overflow-hidden",
|
|
299
299
|
children: [
|
|
300
|
-
a && /* @__PURE__ */ Y(
|
|
300
|
+
a && /* @__PURE__ */ Y(Ve, {
|
|
301
301
|
onClick: a,
|
|
302
302
|
id: h,
|
|
303
303
|
className: Z.imageActionButton
|
|
304
304
|
}),
|
|
305
|
-
s && /* @__PURE__ */ Y(
|
|
305
|
+
s && /* @__PURE__ */ Y(ze, {
|
|
306
306
|
onClick: s,
|
|
307
307
|
id: h,
|
|
308
308
|
className: Z.imageActionButton
|
|
309
309
|
}),
|
|
310
|
-
E !==
|
|
311
|
-
variant:
|
|
310
|
+
E !== Ke.Loaded && /* @__PURE__ */ Y(_, {
|
|
311
|
+
variant: v.Rectangular,
|
|
312
312
|
width: "100%",
|
|
313
313
|
height: "100%",
|
|
314
|
-
active: E ===
|
|
314
|
+
active: E === Ke.Loading,
|
|
315
315
|
overlay: /* @__PURE__ */ Y(G, {
|
|
316
|
-
size:
|
|
316
|
+
size: p.LG,
|
|
317
317
|
className: Z.typeText,
|
|
318
318
|
"aria-hidden": !0
|
|
319
319
|
}),
|
|
@@ -322,16 +322,16 @@ var Pe = (e) => {
|
|
|
322
322
|
/* @__PURE__ */ Y("img", {
|
|
323
323
|
ref: T,
|
|
324
324
|
src: y,
|
|
325
|
-
alt:
|
|
325
|
+
alt: g,
|
|
326
326
|
loading: "lazy",
|
|
327
327
|
decoding: "async",
|
|
328
|
-
className:
|
|
328
|
+
className: d("h-full w-full rounded-xl object-cover transition-opacity duration-200", E === Ke.Loaded ? "opacity-100" : "opacity-0")
|
|
329
329
|
})
|
|
330
330
|
]
|
|
331
331
|
})
|
|
332
332
|
});
|
|
333
|
-
},
|
|
334
|
-
let { colors: f } =
|
|
333
|
+
}, Ye = ({ attachment: e, searchQuery: n = "", onRemove: r, onRetry: i, onExpand: a, onClick: o, onDownload: s, labels: c, styles: l, isSelected: d }) => {
|
|
334
|
+
let { colors: f } = l ?? {}, p = e.type === t.Pasted, m = p && a !== void 0, h = u({
|
|
335
335
|
"--ai-tile-bg": f?.background,
|
|
336
336
|
"--ai-tile-border": f?.border,
|
|
337
337
|
"--ai-tile-bg-hover": f?.backgroundHover,
|
|
@@ -348,28 +348,28 @@ var Pe = (e) => {
|
|
|
348
348
|
"--ai-tile-hover-icon-color": f?.hoverIconColor,
|
|
349
349
|
"--ai-tile-progress-track": f?.trackBackground,
|
|
350
350
|
"--ai-tile-fill-bg": f?.fillBackground
|
|
351
|
-
}), { isImage: g, isAudio: _, isLink: v } =
|
|
352
|
-
return _ ? /* @__PURE__ */ Y(
|
|
351
|
+
}), { isImage: g, isAudio: _, isLink: v } = Ae(() => Le(e), [e]);
|
|
352
|
+
return _ ? /* @__PURE__ */ Y(He, {
|
|
353
353
|
attachment: e,
|
|
354
354
|
labels: c,
|
|
355
355
|
onClick: o,
|
|
356
356
|
onDownload: s,
|
|
357
357
|
onRemove: r,
|
|
358
358
|
searchQuery: n,
|
|
359
|
-
styles:
|
|
359
|
+
styles: l,
|
|
360
360
|
cssVars: h,
|
|
361
361
|
isSelected: d
|
|
362
|
-
}) : g ? /* @__PURE__ */ Y(
|
|
362
|
+
}) : g ? /* @__PURE__ */ Y(Je, {
|
|
363
363
|
attachment: e,
|
|
364
364
|
labels: c,
|
|
365
365
|
onClick: o,
|
|
366
366
|
onExpand: a,
|
|
367
|
-
styles:
|
|
367
|
+
styles: l,
|
|
368
368
|
onRemove: r,
|
|
369
369
|
cssVars: h,
|
|
370
370
|
onDownload: s,
|
|
371
371
|
isSelected: d
|
|
372
|
-
}) : /* @__PURE__ */ Y(
|
|
372
|
+
}) : /* @__PURE__ */ Y(Ge, {
|
|
373
373
|
attachment: e,
|
|
374
374
|
onClick: o,
|
|
375
375
|
onRetry: i,
|
|
@@ -377,21 +377,21 @@ var Pe = (e) => {
|
|
|
377
377
|
onDownload: s,
|
|
378
378
|
isLink: v,
|
|
379
379
|
isPasted: p,
|
|
380
|
-
styles:
|
|
380
|
+
styles: l,
|
|
381
381
|
labels: c,
|
|
382
382
|
onExpand: a,
|
|
383
383
|
cssVars: h,
|
|
384
384
|
isExpandable: m,
|
|
385
385
|
isSelected: d
|
|
386
386
|
});
|
|
387
|
-
},
|
|
387
|
+
}, Xe = {
|
|
388
388
|
headerIcon: "_headerIcon_1sgtq_1",
|
|
389
389
|
headerLabel: "_headerLabel_1sgtq_2"
|
|
390
|
-
},
|
|
391
|
-
let { ariaLabel:
|
|
390
|
+
}, Ze = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, Qe = ({ attachments: e, onAttachmentClick: n, onDownloadAll: r, onRetry: i, labels: a, styles: o, selectedAttachmentId: s }) => {
|
|
391
|
+
let { ariaLabel: l = "Attachments", clickLabel: f = "Download attachment", retryLabel: m = "Retry upload", downloadAllLabel: h = "Download all", openInNewTabLabel: g, getHeaderLabel: _ = (e) => Ze(e, "attachment"), promptLabel: v, pastedLabel: y, imageLabel: b } = a ?? {}, { typography: x, colors: S, className: T } = o ?? {}, E = u({ "--ai-group-text": S?.text });
|
|
392
392
|
if (e.length === 0) return null;
|
|
393
|
-
let D = e.some((e) => e.type === t.Image), O = e.some((e) => e.type !== t.Image), k = D && O, A = e.length >= 5, j = k ?
|
|
394
|
-
let t = e.filter((e) => e.status ===
|
|
393
|
+
let D = e.some((e) => e.type === t.Image), O = e.some((e) => e.type !== t.Image), k = D && O, A = e.length >= 5, j = k ? _e : D ? G : L, M = _(e.length), N = () => {
|
|
394
|
+
let t = e.filter((e) => e.status === c.Idle);
|
|
395
395
|
r ? r(t) : t.forEach((e) => n?.(e.id));
|
|
396
396
|
}, P = (t) => {
|
|
397
397
|
let n = e.find((e) => e.id === t);
|
|
@@ -399,57 +399,57 @@ var Pe = (e) => {
|
|
|
399
399
|
};
|
|
400
400
|
return /* @__PURE__ */ X("div", {
|
|
401
401
|
role: "group",
|
|
402
|
-
"aria-label":
|
|
402
|
+
"aria-label": l,
|
|
403
403
|
style: E,
|
|
404
|
-
className:
|
|
404
|
+
className: d("flex flex-col gap-1", A ? "w-full min-w-0 max-w-[492px]" : "max-w-[420px]", Xe.container, T),
|
|
405
405
|
children: [/* @__PURE__ */ X("div", {
|
|
406
406
|
className: "flex items-center justify-between",
|
|
407
407
|
children: [/* @__PURE__ */ X("div", {
|
|
408
408
|
className: "flex items-center gap-1",
|
|
409
409
|
children: [/* @__PURE__ */ Y(j, {
|
|
410
|
-
size:
|
|
411
|
-
className:
|
|
410
|
+
size: p.SM,
|
|
411
|
+
className: d("shrink-0", Xe.headerIcon),
|
|
412
412
|
"aria-hidden": !0
|
|
413
413
|
}), /* @__PURE__ */ Y("span", {
|
|
414
|
-
className:
|
|
414
|
+
className: d(x?.headerLabelClassName ?? "dial-tiny-semi-text", Xe.headerLabel),
|
|
415
415
|
children: M
|
|
416
416
|
})]
|
|
417
|
-
}), e.length >= 2 && (r || n) && /* @__PURE__ */ Y(
|
|
418
|
-
icon: /* @__PURE__ */ Y(
|
|
419
|
-
size:
|
|
417
|
+
}), e.length >= 2 && (r || n) && /* @__PURE__ */ Y(w, {
|
|
418
|
+
icon: /* @__PURE__ */ Y(F, {
|
|
419
|
+
size: p.SM,
|
|
420
420
|
"aria-hidden": !0
|
|
421
421
|
}),
|
|
422
|
-
size:
|
|
422
|
+
size: C.Small,
|
|
423
423
|
"aria-label": h,
|
|
424
424
|
onClick: N
|
|
425
425
|
})]
|
|
426
426
|
}), /* @__PURE__ */ Y("div", {
|
|
427
427
|
role: "list",
|
|
428
428
|
"aria-label": M,
|
|
429
|
-
className:
|
|
429
|
+
className: d("gap-3", A ? "grid grid-cols-[repeat(5,83px)]" : "flex flex-wrap"),
|
|
430
430
|
children: e.map((e, t) => /* @__PURE__ */ Y("div", {
|
|
431
431
|
role: "listitem",
|
|
432
|
-
children: /* @__PURE__ */ Y(
|
|
432
|
+
children: /* @__PURE__ */ Y(Ye, {
|
|
433
433
|
attachment: e,
|
|
434
434
|
onClick: n,
|
|
435
435
|
onDownload: P,
|
|
436
436
|
onRetry: i,
|
|
437
437
|
labels: {
|
|
438
|
-
clickLabel:
|
|
438
|
+
clickLabel: f,
|
|
439
439
|
retryLabel: m,
|
|
440
440
|
promptLabel: v,
|
|
441
441
|
pastedLabel: y,
|
|
442
442
|
imageLabel: b,
|
|
443
443
|
openInNewTabLabel: g
|
|
444
444
|
},
|
|
445
|
-
isSelected: e.id ===
|
|
445
|
+
isSelected: e.id === s
|
|
446
446
|
})
|
|
447
447
|
}, `${e.id}-${t}`))
|
|
448
448
|
})]
|
|
449
449
|
});
|
|
450
|
-
},
|
|
451
|
-
let [s, c] = q(t), [l, u] = q(n), [d, f] = q(r), p =
|
|
452
|
-
|
|
450
|
+
}, $e = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
|
|
451
|
+
let [s, c] = q(t), [l, u] = q(n), [d, f] = q(r), p = je(o);
|
|
452
|
+
Oe(() => {
|
|
453
453
|
o && !p.current && (c(t), u(n), f(r)), p.current = o;
|
|
454
454
|
}, [
|
|
455
455
|
o,
|
|
@@ -480,44 +480,44 @@ var Pe = (e) => {
|
|
|
480
480
|
a
|
|
481
481
|
])
|
|
482
482
|
};
|
|
483
|
-
},
|
|
483
|
+
}, et = { label: "_label_14i7c_1" }, tt = ({ features: e, responseFormat: t, systemPrompt: n, temperature: r, onResponseFormatChange: i, onSystemPromptChange: a, onTemperatureChange: o, responseFormatLabel: s = "Response format", responseFormatHint: c = "Applies to new and existing messages", responseFormatMarkdownLabel: f = "Markdown", responseFormatPlainTextLabel: p = "Plain text", systemPromptLabel: h = "System prompt", systemPromptTooltip: _ = "Enter a prompt", temperatureLabel: v = "Temperature", temperatureLabels: b = [
|
|
484
484
|
"Precise",
|
|
485
485
|
"Neutral",
|
|
486
486
|
"Creative"
|
|
487
487
|
], temperatureHint: x, labelClassName: S = "!dial-small-semi-text", colors: C }) => {
|
|
488
|
-
let w =
|
|
488
|
+
let w = u({ "--csf-label-text": C?.labelText }), T = d(S, et.label, "gap-1");
|
|
489
489
|
return /* @__PURE__ */ X("div", {
|
|
490
490
|
className: "flex flex-col gap-4 px-6 py-3",
|
|
491
491
|
style: w,
|
|
492
492
|
children: [
|
|
493
|
-
e.responseFormat && /* @__PURE__ */ Y(
|
|
493
|
+
e.responseFormat && /* @__PURE__ */ Y(g, {
|
|
494
494
|
fieldTitle: s,
|
|
495
495
|
labelClassName: T,
|
|
496
496
|
elementId: "response-format",
|
|
497
|
-
orientation:
|
|
498
|
-
activeRadioButton: t ??
|
|
499
|
-
labelDescription:
|
|
497
|
+
orientation: j.Column,
|
|
498
|
+
activeRadioButton: t ?? l.Markdown,
|
|
499
|
+
labelDescription: c,
|
|
500
500
|
radioButtons: [{
|
|
501
|
-
id:
|
|
501
|
+
id: l.Markdown,
|
|
502
502
|
name: f
|
|
503
503
|
}, {
|
|
504
|
-
id:
|
|
505
|
-
name:
|
|
504
|
+
id: l.PlainText,
|
|
505
|
+
name: p
|
|
506
506
|
}],
|
|
507
507
|
onChange: (e) => i(e)
|
|
508
508
|
}),
|
|
509
|
-
e.systemPrompt && /* @__PURE__ */ Y(
|
|
509
|
+
e.systemPrompt && /* @__PURE__ */ Y(m, {
|
|
510
510
|
value: n,
|
|
511
511
|
placeholder: _,
|
|
512
512
|
labelProps: {
|
|
513
513
|
className: T,
|
|
514
|
-
label:
|
|
514
|
+
label: h
|
|
515
515
|
},
|
|
516
516
|
onChange: (e) => a(e ?? "")
|
|
517
517
|
}),
|
|
518
|
-
e.temperature && /* @__PURE__ */ Y(
|
|
518
|
+
e.temperature && /* @__PURE__ */ Y(y, {
|
|
519
519
|
labelProps: {
|
|
520
|
-
label:
|
|
520
|
+
label: v,
|
|
521
521
|
className: T,
|
|
522
522
|
caption: x
|
|
523
523
|
},
|
|
@@ -530,9 +530,9 @@ var Pe = (e) => {
|
|
|
530
530
|
})
|
|
531
531
|
]
|
|
532
532
|
});
|
|
533
|
-
},
|
|
534
|
-
|
|
535
|
-
let { responseFormat: b, systemPrompt:
|
|
533
|
+
}, nt = { modal: "_modal_14b5s_1" };
|
|
534
|
+
De(({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, title: o = "Chat settings", responseFormatLabel: s, responseFormatHint: c, responseFormatMarkdownLabel: l, responseFormatPlainTextLabel: u, systemPromptLabel: d, systemPromptTooltip: f, temperatureLabel: p, temperatureLabels: m, temperatureHint: g, saveLabel: _ = "Apply changes", saveDisabledTooltip: v, backgroundClassName: y = nt.modal }) => {
|
|
535
|
+
let { responseFormat: b, systemPrompt: x, temperature: C, canSubmit: w, setResponseFormat: T, setSystemPrompt: E, setTemperature: D, handleSubmit: O } = $e({
|
|
536
536
|
features: e,
|
|
537
537
|
initialResponseFormat: t,
|
|
538
538
|
initialSystemPrompt: n,
|
|
@@ -540,28 +540,28 @@ ke(({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemp
|
|
|
540
540
|
onSave: i,
|
|
541
541
|
onClose: a
|
|
542
542
|
});
|
|
543
|
-
return /* @__PURE__ */ Y(
|
|
543
|
+
return /* @__PURE__ */ Y(h, {
|
|
544
544
|
open: !0,
|
|
545
545
|
header: o,
|
|
546
|
-
size:
|
|
546
|
+
size: k.Sm,
|
|
547
547
|
onClose: a,
|
|
548
548
|
className: y,
|
|
549
549
|
footer: /* @__PURE__ */ Y("div", {
|
|
550
550
|
className: "flex justify-end px-6 py-4",
|
|
551
|
-
children: /* @__PURE__ */ Y(
|
|
551
|
+
children: /* @__PURE__ */ Y(S, {
|
|
552
552
|
tooltip: v,
|
|
553
553
|
hideTooltip: w || !v,
|
|
554
|
-
children: /* @__PURE__ */ Y(
|
|
554
|
+
children: /* @__PURE__ */ Y(A, {
|
|
555
555
|
label: _,
|
|
556
|
-
onClick:
|
|
556
|
+
onClick: O,
|
|
557
557
|
disabled: !w
|
|
558
558
|
})
|
|
559
559
|
})
|
|
560
560
|
}),
|
|
561
|
-
children: /* @__PURE__ */ Y(
|
|
561
|
+
children: /* @__PURE__ */ Y(tt, {
|
|
562
562
|
features: e,
|
|
563
563
|
responseFormat: b,
|
|
564
|
-
systemPrompt:
|
|
564
|
+
systemPrompt: x,
|
|
565
565
|
temperature: C,
|
|
566
566
|
onResponseFormatChange: T,
|
|
567
567
|
onSystemPromptChange: E,
|
|
@@ -573,16 +573,16 @@ ke(({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemp
|
|
|
573
573
|
systemPromptLabel: d,
|
|
574
574
|
systemPromptTooltip: f,
|
|
575
575
|
temperatureLabel: p,
|
|
576
|
-
temperatureLabels:
|
|
576
|
+
temperatureLabels: m,
|
|
577
577
|
temperatureHint: g
|
|
578
578
|
})
|
|
579
579
|
});
|
|
580
580
|
});
|
|
581
|
-
var
|
|
581
|
+
var rt = {
|
|
582
582
|
tabContainer: "_tabContainer_153ct_1",
|
|
583
583
|
tabActive: "_tabActive_153ct_13"
|
|
584
584
|
};
|
|
585
|
-
|
|
585
|
+
De(({ tabs: e, activeTabId: t, onTabChange: n, styles: r }) => {
|
|
586
586
|
let { tabClassName: i = "dial-tiny-semi-text" } = r?.typography ?? {};
|
|
587
587
|
return /* @__PURE__ */ Y("div", {
|
|
588
588
|
className: "flex flex-nowrap gap-1",
|
|
@@ -593,106 +593,102 @@ ke(({ tabs: e, activeTabId: t, onTabChange: n, styles: r }) => {
|
|
|
593
593
|
role: "tab",
|
|
594
594
|
"aria-selected": r,
|
|
595
595
|
className: "contents",
|
|
596
|
-
children: /* @__PURE__ */ Y(
|
|
596
|
+
children: /* @__PURE__ */ Y(x, {
|
|
597
597
|
label: e.label,
|
|
598
598
|
selected: r,
|
|
599
599
|
onClick: () => n(e.id),
|
|
600
|
-
className:
|
|
600
|
+
className: d("box-border h-auto shrink-0 justify-center rounded-full p-2 text-center", i, rt.tabContainer, r && rt.tabActive)
|
|
601
601
|
})
|
|
602
602
|
}, e.id);
|
|
603
603
|
})
|
|
604
604
|
});
|
|
605
605
|
});
|
|
606
|
-
var
|
|
607
|
-
let { tooltips:
|
|
608
|
-
|
|
609
|
-
}, [
|
|
610
|
-
|
|
611
|
-
}, [
|
|
606
|
+
var it = { activeRating: "_activeRating_7jito_1" }, at = 2e3, ot = ({ role: e = s.User, onEdit: t, onEditHover: r, onDelete: i, onRegenerate: a, onCopy: c, onCopyMarkdown: l, onLike: f, onDislike: m, activeRating: h, isAlwaysVisible: g, className: _, labels: v, colors: y }) => {
|
|
607
|
+
let { tooltips: b, ariaLabels: x } = v ?? {}, [S, T] = q(null), [E, D] = q(""), O = u({ "--ma-active-rating-text": y?.activeRatingText }), k = K(() => {
|
|
608
|
+
c?.(), T("copy"), D(x?.copiedStatus ?? "Copied to clipboard"), setTimeout(() => T(null), at);
|
|
609
|
+
}, [c, x?.copiedStatus]), A = K(() => {
|
|
610
|
+
l?.(), T("markdown"), D(x?.copiedMarkdownStatus ?? "Copied as Markdown to clipboard"), setTimeout(() => T(null), at);
|
|
611
|
+
}, [l, x?.copiedMarkdownStatus]);
|
|
612
612
|
return /* @__PURE__ */ X("div", {
|
|
613
613
|
role: "toolbar",
|
|
614
|
-
"aria-label":
|
|
615
|
-
style:
|
|
616
|
-
className:
|
|
614
|
+
"aria-label": x?.actionsGroup ?? "Message actions",
|
|
615
|
+
style: O,
|
|
616
|
+
className: d("flex gap-1", !g && "opacity-0 group-hover:opacity-100", _),
|
|
617
617
|
children: [/* @__PURE__ */ Y("span", {
|
|
618
618
|
role: "status",
|
|
619
619
|
"aria-live": "polite",
|
|
620
620
|
className: "sr-only",
|
|
621
|
-
children:
|
|
622
|
-
}), e ===
|
|
623
|
-
icon: /* @__PURE__ */ Y(
|
|
624
|
-
size:
|
|
621
|
+
children: E
|
|
622
|
+
}), e === s.User ? /* @__PURE__ */ X(J, { children: [t && /* @__PURE__ */ Y(w, {
|
|
623
|
+
icon: /* @__PURE__ */ Y(ve, {
|
|
624
|
+
size: p.SM,
|
|
625
625
|
"aria-hidden": !0
|
|
626
626
|
}),
|
|
627
|
-
size:
|
|
628
|
-
"aria-label":
|
|
629
|
-
tooltipProps: { tooltip:
|
|
627
|
+
size: C.Small,
|
|
628
|
+
"aria-label": x?.editMessage ?? "Edit message",
|
|
629
|
+
tooltipProps: { tooltip: b?.edit ?? "Edit" },
|
|
630
630
|
onClick: t,
|
|
631
|
-
onMouseEnter:
|
|
632
|
-
onFocus:
|
|
633
|
-
}),
|
|
634
|
-
icon: /* @__PURE__ */ Y(
|
|
635
|
-
size:
|
|
631
|
+
onMouseEnter: r,
|
|
632
|
+
onFocus: r
|
|
633
|
+
}), i && /* @__PURE__ */ Y(w, {
|
|
634
|
+
icon: /* @__PURE__ */ Y(we, {
|
|
635
|
+
size: p.SM,
|
|
636
636
|
"aria-hidden": !0
|
|
637
637
|
}),
|
|
638
|
-
size:
|
|
639
|
-
"aria-label":
|
|
640
|
-
tooltipProps: { tooltip:
|
|
641
|
-
onClick:
|
|
638
|
+
size: C.Small,
|
|
639
|
+
"aria-label": x?.deleteMessage ?? "Delete message",
|
|
640
|
+
tooltipProps: { tooltip: b?.delete ?? "Delete" },
|
|
641
|
+
onClick: i
|
|
642
642
|
})] }) : /* @__PURE__ */ X(J, { children: [
|
|
643
|
-
|
|
644
|
-
icon: /* @__PURE__ */ Y(
|
|
645
|
-
size:
|
|
643
|
+
a && /* @__PURE__ */ Y(w, {
|
|
644
|
+
icon: /* @__PURE__ */ Y(ye, {
|
|
645
|
+
size: p.SM,
|
|
646
646
|
"aria-hidden": !0
|
|
647
647
|
}),
|
|
648
|
-
size:
|
|
649
|
-
"aria-label":
|
|
650
|
-
tooltipProps: { tooltip:
|
|
651
|
-
onClick:
|
|
648
|
+
size: C.Small,
|
|
649
|
+
"aria-label": x?.regenerateResponse ?? "Regenerate response",
|
|
650
|
+
tooltipProps: { tooltip: b?.regenerate ?? "Regenerate" },
|
|
651
|
+
onClick: a
|
|
652
652
|
}),
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
tooltipProps: { tooltip: x === "copy" ? y?.copied ?? "Copied!" : y?.copy ?? "Copy" },
|
|
661
|
-
onClick: O
|
|
653
|
+
c && /* @__PURE__ */ Y(n, {
|
|
654
|
+
onClick: k,
|
|
655
|
+
size: C.Small,
|
|
656
|
+
isCopied: S === "copy",
|
|
657
|
+
copyLabel: b?.copy ?? "Copy",
|
|
658
|
+
copiedLabel: b?.copied ?? "Copied!",
|
|
659
|
+
ariaLabel: x?.copyResponse ?? "Copy response"
|
|
662
660
|
}),
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
tooltipProps: { tooltip: x === "markdown" ? y?.copiedMarkdown ?? "Copied!" : y?.copyMarkdown ?? "Copy as Markdown" },
|
|
671
|
-
onClick: k
|
|
661
|
+
l && /* @__PURE__ */ Y(n, {
|
|
662
|
+
onClick: A,
|
|
663
|
+
size: C.Small,
|
|
664
|
+
isCopied: S === "markdown",
|
|
665
|
+
copyLabel: b?.copyMarkdown ?? "Copy as Markdown",
|
|
666
|
+
copiedLabel: b?.copiedMarkdown ?? "Copied!",
|
|
667
|
+
ariaLabel: x?.copyAsMarkdown ?? "Copy as markdown"
|
|
672
668
|
}),
|
|
673
|
-
|
|
674
|
-
icon: /* @__PURE__ */ Y(
|
|
675
|
-
size:
|
|
669
|
+
f && /* @__PURE__ */ Y(w, {
|
|
670
|
+
icon: /* @__PURE__ */ Y(Ce, {
|
|
671
|
+
size: p.SM,
|
|
676
672
|
"aria-hidden": !0
|
|
677
673
|
}),
|
|
678
|
-
size:
|
|
679
|
-
"aria-label":
|
|
680
|
-
"aria-pressed":
|
|
681
|
-
className:
|
|
682
|
-
tooltipProps: { tooltip:
|
|
683
|
-
onClick:
|
|
674
|
+
size: C.Small,
|
|
675
|
+
"aria-label": x?.likeResponse ?? "Like response",
|
|
676
|
+
"aria-pressed": h === o.Like,
|
|
677
|
+
className: h === o.Like ? it.activeRating : void 0,
|
|
678
|
+
tooltipProps: { tooltip: b?.like ?? "Like" },
|
|
679
|
+
onClick: f
|
|
684
680
|
}),
|
|
685
|
-
|
|
686
|
-
icon: /* @__PURE__ */ Y(
|
|
687
|
-
size:
|
|
681
|
+
m && /* @__PURE__ */ Y(w, {
|
|
682
|
+
icon: /* @__PURE__ */ Y(Se, {
|
|
683
|
+
size: p.SM,
|
|
688
684
|
"aria-hidden": !0
|
|
689
685
|
}),
|
|
690
|
-
size:
|
|
691
|
-
"aria-label":
|
|
692
|
-
"aria-pressed":
|
|
693
|
-
className:
|
|
694
|
-
tooltipProps: { tooltip:
|
|
695
|
-
onClick:
|
|
686
|
+
size: C.Small,
|
|
687
|
+
"aria-label": x?.dislikeResponse ?? "Dislike response",
|
|
688
|
+
"aria-pressed": h === o.Dislike,
|
|
689
|
+
className: h === o.Dislike ? it.activeRating : void 0,
|
|
690
|
+
tooltipProps: { tooltip: b?.dislike ?? "Dislike" },
|
|
691
|
+
onClick: m
|
|
696
692
|
})
|
|
697
693
|
] })]
|
|
698
694
|
});
|
|
@@ -703,17 +699,17 @@ var ot = { activeRating: "_activeRating_7jito_1" }, st = 2e3, ct = ({ role: e =
|
|
|
703
699
|
collapsedText: "_collapsedText_ovjc1_15",
|
|
704
700
|
startersDivider: "_startersDivider_ovjc1_26",
|
|
705
701
|
text: "_text_ovjc1_30"
|
|
706
|
-
},
|
|
707
|
-
let { colors: w, typography: T, className: E, bubbleClassName:
|
|
702
|
+
}, st = ({ text: e, styles: n, actions: a, hasAlwaysVisibleActions: o, isStreaming: c, attachments: l, afterContent: f, starters: p, onSelectStarter: m, deploymentIconUrl: h, deploymentDisplayName: g, markdownComponents: _, onAttachmentClick: v, onDownloadAll: y, onAttachmentRetry: b, codeBlockTheme: x, labels: S, selectedAttachmentId: C }) => {
|
|
703
|
+
let { colors: w, typography: T, className: E, bubbleClassName: D } = n ?? {}, { attachmentClickLabel: k, attachmentRetryLabel: A, attachmentOpenInNewTabLabel: j, startersAriaLabel: M = "Quick reply buttons", thinkingLabel: N, codeBlockCopyLabel: P, codeBlockCopiedLabel: F, assistantMessageAriaLabel: I = "Assistant message", deploymentIconFallbackLabel: L = "AI" } = S ?? {}, R = c ? (l ?? []).filter((e) => e.type !== t.Audio) : l ?? [], z = u({
|
|
708
704
|
"--cm-bubble-text": w?.text,
|
|
709
705
|
"--cm-starters-divider": w?.startersDivider
|
|
710
|
-
}), B =
|
|
706
|
+
}), B = d($.text, T?.fontClassName), V = !!(h || g);
|
|
711
707
|
return /* @__PURE__ */ X("div", {
|
|
712
708
|
role: "group",
|
|
713
709
|
"aria-label": I,
|
|
714
710
|
style: z,
|
|
715
|
-
className:
|
|
716
|
-
children: [V && /* @__PURE__ */ Y(
|
|
711
|
+
className: d("flex w-full items-start gap-3", E),
|
|
712
|
+
children: [V && /* @__PURE__ */ Y(r, {
|
|
717
713
|
src: h,
|
|
718
714
|
size: 28,
|
|
719
715
|
initialsName: g || L,
|
|
@@ -721,13 +717,13 @@ var ot = { activeRating: "_activeRating_7jito_1" }, st = 2e3, ct = ({ role: e =
|
|
|
721
717
|
}), /* @__PURE__ */ X("div", {
|
|
722
718
|
className: "flex w-full min-w-0 max-w-full flex-col items-start gap-5",
|
|
723
719
|
children: [/* @__PURE__ */ X("div", {
|
|
724
|
-
className:
|
|
720
|
+
className: d("flex w-full min-w-0 max-w-full flex-col items-start gap-4", D),
|
|
725
721
|
children: [
|
|
726
722
|
(e || c) && /* @__PURE__ */ Y("div", {
|
|
727
723
|
"aria-live": "polite",
|
|
728
724
|
"aria-atomic": "false",
|
|
729
|
-
className:
|
|
730
|
-
children: /* @__PURE__ */ Y(
|
|
725
|
+
className: d(B, "min-w-0 max-w-full text-start"),
|
|
726
|
+
children: /* @__PURE__ */ Y(i, {
|
|
731
727
|
content: e,
|
|
732
728
|
isStreaming: c,
|
|
733
729
|
thinkingLabel: N,
|
|
@@ -737,9 +733,9 @@ var ot = { activeRating: "_activeRating_7jito_1" }, st = 2e3, ct = ({ role: e =
|
|
|
737
733
|
codeBlockTheme: x
|
|
738
734
|
})
|
|
739
735
|
}),
|
|
740
|
-
/* @__PURE__ */ Y(
|
|
736
|
+
/* @__PURE__ */ Y(Qe, {
|
|
741
737
|
attachments: R,
|
|
742
|
-
onAttachmentClick: (e) => v?.(
|
|
738
|
+
onAttachmentClick: (e) => v?.(l?.find((t) => t.id === e)),
|
|
743
739
|
onDownloadAll: y,
|
|
744
740
|
onRetry: b,
|
|
745
741
|
labels: {
|
|
@@ -750,20 +746,20 @@ var ot = { activeRating: "_activeRating_7jito_1" }, st = 2e3, ct = ({ role: e =
|
|
|
750
746
|
selectedAttachmentId: C
|
|
751
747
|
}),
|
|
752
748
|
f,
|
|
753
|
-
/* @__PURE__ */ Y(
|
|
749
|
+
/* @__PURE__ */ Y(ot, {
|
|
754
750
|
...a,
|
|
755
|
-
isAlwaysVisible:
|
|
756
|
-
role:
|
|
751
|
+
isAlwaysVisible: o,
|
|
752
|
+
role: s.Assistant
|
|
757
753
|
})
|
|
758
754
|
]
|
|
759
755
|
}), p && p.length > 0 && m && /* @__PURE__ */ Y("div", {
|
|
760
756
|
role: "list",
|
|
761
757
|
"aria-label": M,
|
|
762
|
-
className:
|
|
758
|
+
className: d("flex w-full flex-wrap gap-2 border-t pt-5", $.startersDivider),
|
|
763
759
|
children: p.map((e, t) => /* @__PURE__ */ Y("div", {
|
|
764
760
|
role: "listitem",
|
|
765
761
|
className: "min-w-[40px]",
|
|
766
|
-
children: /* @__PURE__ */ Y(
|
|
762
|
+
children: /* @__PURE__ */ Y(O, {
|
|
767
763
|
label: e.title,
|
|
768
764
|
className: "min-w-[40px]",
|
|
769
765
|
onClick: () => m(e)
|
|
@@ -772,43 +768,43 @@ var ot = { activeRating: "_activeRating_7jito_1" }, st = 2e3, ct = ({ role: e =
|
|
|
772
768
|
})]
|
|
773
769
|
})]
|
|
774
770
|
});
|
|
775
|
-
},
|
|
771
|
+
}, ct = ({ labels: { titleText: e = "Model switched.", bodyText: t } }) => /* @__PURE__ */ Y("div", {
|
|
776
772
|
role: "status",
|
|
777
773
|
"aria-live": "polite",
|
|
778
|
-
children: /* @__PURE__ */ Y(
|
|
774
|
+
children: /* @__PURE__ */ Y(E, {
|
|
779
775
|
title: e,
|
|
780
776
|
message: t,
|
|
781
777
|
textClassName: "flex-row flex-wrap gap-1"
|
|
782
778
|
})
|
|
783
|
-
}),
|
|
779
|
+
}), lt = /* @__PURE__ */ function(e) {
|
|
784
780
|
return e.Bottom = "Bottom", e.Top = "Top", e;
|
|
785
|
-
}({}),
|
|
786
|
-
let { colors: _, typography: v, className: y, bubbleClassName: b } = n ?? {}, { showMoreLabel: x = "Show more", showLessLabel:
|
|
781
|
+
}({}), ut = 10, dt = ({ text: e, position: t = lt.Bottom, styles: n, actions: r, hasAlwaysVisibleActions: i, attachments: a, collapsedLineCount: o = ut, labels: c, onAttachmentClick: l, onDownloadAll: m, onAttachmentRetry: h, selectedAttachmentId: g }) => {
|
|
782
|
+
let { colors: _, typography: v, className: y, bubbleClassName: b } = n ?? {}, { showMoreLabel: x = "Show more", showLessLabel: S = "Show less", showMoreAriaLabel: w, showLessAriaLabel: T, attachmentClickLabel: E, attachmentRetryLabel: O, attachmentOpenInNewTabLabel: k, userMessageAriaLabel: A = "User message" } = c ?? {}, { textRef: j, isTextCollapsed: P, isOverflowing: F, collapsedMaxHeight: I, expandedMaxHeight: L, isCollapsed: R, toggleCollapsed: z } = f({
|
|
787
783
|
text: e,
|
|
788
|
-
collapsedLineCount:
|
|
789
|
-
}), B =
|
|
784
|
+
collapsedLineCount: o
|
|
785
|
+
}), B = u({
|
|
790
786
|
"--cm-bubble-user-bg": _?.userBackground,
|
|
791
787
|
"--cm-bubble-user-border": _?.userBorder,
|
|
792
788
|
"--cm-bubble-fade-start": _?.fadeStart,
|
|
793
789
|
"--cm-bubble-text": _?.text,
|
|
794
790
|
"--cm-bubble-collapsed-height": F ? `${I}px` : void 0,
|
|
795
791
|
"--cm-bubble-expanded-height": F ? `${L}px` : void 0
|
|
796
|
-
}), V = t ===
|
|
792
|
+
}), V = t === lt.Top ? "rounded-ee-md rounded-se-2xl" : "rounded-se-md rounded-ee-2xl", H = d($.text, v?.fontClassName), U = w ?? x, W = T ?? S, ee = R ? x : S, te = R ? U : W, ne = R ? M : N, re = ke();
|
|
797
793
|
return /* @__PURE__ */ Y("div", {
|
|
798
794
|
role: "group",
|
|
799
795
|
"aria-label": A,
|
|
800
796
|
style: B,
|
|
801
|
-
className:
|
|
797
|
+
className: d("flex w-full", y),
|
|
802
798
|
children: /* @__PURE__ */ X("div", {
|
|
803
799
|
className: "ms-auto flex w-fit min-w-0 max-w-full flex-col items-end gap-4",
|
|
804
800
|
children: [
|
|
805
|
-
/* @__PURE__ */ Y(
|
|
801
|
+
/* @__PURE__ */ Y(Qe, {
|
|
806
802
|
attachments: a ?? [],
|
|
807
|
-
onAttachmentClick: (e) =>
|
|
803
|
+
onAttachmentClick: (e) => l?.(a?.find((t) => t.id === e)),
|
|
808
804
|
onDownloadAll: m,
|
|
809
805
|
onRetry: h,
|
|
810
806
|
labels: {
|
|
811
|
-
clickLabel:
|
|
807
|
+
clickLabel: E,
|
|
812
808
|
retryLabel: O,
|
|
813
809
|
openInNewTabLabel: k
|
|
814
810
|
},
|
|
@@ -816,21 +812,21 @@ var ot = { activeRating: "_activeRating_7jito_1" }, st = 2e3, ct = ({ role: e =
|
|
|
816
812
|
selectedAttachmentId: g
|
|
817
813
|
}),
|
|
818
814
|
e && /* @__PURE__ */ Y("div", {
|
|
819
|
-
className:
|
|
815
|
+
className: d($.userBubble, "flex w-fit items-center justify-end rounded-es-2xl rounded-ss-2xl border px-6 py-4", V, b),
|
|
820
816
|
children: /* @__PURE__ */ X("div", {
|
|
821
817
|
className: "flex min-w-0 flex-col items-start",
|
|
822
818
|
children: [/* @__PURE__ */ Y("div", {
|
|
823
819
|
id: re,
|
|
824
|
-
className:
|
|
820
|
+
className: d("relative overflow-hidden", F && $.collapsibleText, F && !R && $.expandedText, P && $.collapsedText),
|
|
825
821
|
children: /* @__PURE__ */ Y("p", {
|
|
826
822
|
ref: j,
|
|
827
|
-
className:
|
|
823
|
+
className: d(H, "whitespace-pre-wrap text-start [overflow-wrap:anywhere]"),
|
|
828
824
|
children: e
|
|
829
825
|
})
|
|
830
|
-
}), F && /* @__PURE__ */ Y(
|
|
826
|
+
}), F && /* @__PURE__ */ Y(D, {
|
|
831
827
|
label: /* @__PURE__ */ Y(J, { children: ee }),
|
|
832
828
|
iconBefore: /* @__PURE__ */ Y(ne, {
|
|
833
|
-
size:
|
|
829
|
+
size: p.SM,
|
|
834
830
|
"aria-hidden": "true"
|
|
835
831
|
}),
|
|
836
832
|
"aria-label": te,
|
|
@@ -838,28 +834,28 @@ var ot = { activeRating: "_activeRating_7jito_1" }, st = 2e3, ct = ({ role: e =
|
|
|
838
834
|
"aria-controls": re,
|
|
839
835
|
className: "mt-3",
|
|
840
836
|
onClick: z,
|
|
841
|
-
size:
|
|
837
|
+
size: C.Small
|
|
842
838
|
})]
|
|
843
839
|
})
|
|
844
840
|
}),
|
|
845
|
-
/* @__PURE__ */ Y(
|
|
841
|
+
/* @__PURE__ */ Y(ot, {
|
|
846
842
|
...r,
|
|
847
843
|
isAlwaysVisible: i,
|
|
848
|
-
role:
|
|
844
|
+
role: s.User
|
|
849
845
|
})
|
|
850
846
|
]
|
|
851
847
|
})
|
|
852
848
|
});
|
|
853
|
-
},
|
|
849
|
+
}, ft = ({ role: e, onAttachmentClick: t, markdownComponents: n, ...r }) => e === s.Status ? /* @__PURE__ */ Y(ct, { labels: {
|
|
854
850
|
titleText: r.labels?.statusTitleText,
|
|
855
851
|
bodyText: r.labels?.statusBodyText ?? ""
|
|
856
|
-
} }) : e ===
|
|
852
|
+
} }) : e === s.User ? /* @__PURE__ */ Y(dt, {
|
|
857
853
|
...r,
|
|
858
854
|
onAttachmentClick: t
|
|
859
|
-
}) : /* @__PURE__ */ Y(
|
|
855
|
+
}) : /* @__PURE__ */ Y(st, {
|
|
860
856
|
...r,
|
|
861
857
|
markdownComponents: n,
|
|
862
858
|
onAttachmentClick: t
|
|
863
859
|
});
|
|
864
860
|
//#endregion
|
|
865
|
-
export {
|
|
861
|
+
export { st as AssistantMessageBubble, lt as BubblePosition, ot as MessageActions, ft as MessageBubble, ct as StatusMessageBubble, dt as UserMessageBubble };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-conversation-messages",
|
|
3
3
|
"description": "Message bubble components for rendering conversation history with actions and source citations",
|
|
4
|
-
"version": "1.1.0-dev.
|
|
4
|
+
"version": "1.1.0-dev.99",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"react": "^19.0.0",
|
|
21
21
|
"@tabler/icons-react": "^3.0.0",
|
|
22
|
-
"@epam/ai-dial-chat-shared": "1.1.0-dev.
|
|
23
|
-
"@epam/ai-dial-conversation-input": "1.1.0-dev.
|
|
22
|
+
"@epam/ai-dial-chat-shared": "1.1.0-dev.99",
|
|
23
|
+
"@epam/ai-dial-conversation-input": "1.1.0-dev.99",
|
|
24
24
|
"react-markdown": "^10.1.0",
|
|
25
25
|
"@epam/ai-dial-ui-kit": "^0.13.0-dev.26"
|
|
26
26
|
},
|