@epam/ai-dial-conversation-messages 1.0.0-dev.469 → 1.0.0-dev.473
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/{Message → MessageActions}/MessageActions.d.ts +1 -1
- package/components/MessageActions/MessageActions.d.ts.map +1 -0
- package/components/MessageBubble/AssistantMessageBubble.d.ts +2 -2
- package/components/MessageBubble/AssistantMessageBubble.d.ts.map +1 -1
- package/components/MessageBubble/MessageBubble.d.ts +1 -1
- package/components/MessageBubble/MessageBubble.d.ts.map +1 -1
- package/components/MessageBubble/StatusMessageBubble.d.ts.map +1 -1
- package/components/MessageBubble/UserMessageBubble.d.ts +2 -2
- package/components/MessageBubble/UserMessageBubble.d.ts.map +1 -1
- package/components/MessageSource/MessageSource.d.ts +1 -1
- package/components/MessageSource/MessageSource.d.ts.map +1 -1
- package/index.css +1 -1
- package/index.d.ts +4 -4
- package/index.d.ts.map +1 -1
- package/index.js +278 -234
- package/models/{MessageActions.d.ts → message-actions.d.ts} +16 -5
- package/models/message-actions.d.ts.map +1 -0
- package/models/{MessageBubble.d.ts → message-bubble.d.ts} +77 -150
- package/models/message-bubble.d.ts.map +1 -0
- package/models/{MessageSource.d.ts → message-source.d.ts} +4 -10
- package/models/message-source.d.ts.map +1 -0
- package/package.json +4 -4
- package/components/Message/MessageActions.d.ts.map +0 -1
- package/models/MessageActions.d.ts.map +0 -1
- package/models/MessageBubble.d.ts.map +0 -1
- package/models/MessageSource.d.ts.map +0 -1
package/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { AttachmentErrorReason as e, AttachmentType as t, CodeBlockTheme as n, DeploymentIcon as r, Highlight as i, MDMessageViewer as a, MIME_TYPE_EXT_MAP as o, MessageRating as s, MessageRole as c, RequestStatus as l, ResponseFormat as u, buildCssVars as d, mergeClasses as f, useCollapsedText as p } from "@epam/ai-dial-chat-shared";
|
|
2
2
|
import { DIAL_ICON_SIZE as m, DialGhostIconButton as h, DialInput as g, DialLinkButton as _, DialNotification as v, DialPopup as y, DialPrimaryButton as b, DialRadioGroup as x, DialRoundedButton as S, DialSkeleton as C, DialSkeletonVariant as w, DialSlider as T, DialSpinner as E, DialTag as D, DialTooltip as O, ElementSize as k, PopupSize as A, RadioGroupOrientation as j } from "@epam/ai-dial-ui-kit";
|
|
3
|
-
import { IconCheck as M, IconChevronDown as N, IconChevronUp as P, IconClipboard as F, IconCopy as I, IconDownload as L, IconFile as R, IconFileTypeBmp as
|
|
3
|
+
import { IconCheck as M, IconChevronDown as N, IconChevronUp as P, IconClipboard as F, IconCopy as I, IconDownload as L, IconFile as R, IconFileTypeBmp as z, IconFileTypeCss as B, IconFileTypeCsv as V, IconFileTypeDoc as ee, IconFileTypeDocx as H, IconFileTypeHtml as U, IconFileTypeJpg as te, IconFileTypeJs as ne, IconFileTypeJsx as W, IconFileTypePdf as G, 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, IconMarkdown as ge, IconMusic as _e, IconPaperclip as ve, IconPencilMinus as ye, IconPhoto as be, IconRefresh as xe, IconReload as Se, IconTerminal2 as Ce, IconThumbDown as we, IconThumbUp as Te, IconTrashX as Ee, IconVideo as De, IconX as Oe } from "@tabler/icons-react";
|
|
4
4
|
import "react-dom";
|
|
5
|
-
import { memo as ke, useCallback as Ae, useEffect as je,
|
|
5
|
+
import { memo as ke, useCallback as Ae, useEffect as je, useId as Me, useMemo as Ne, useRef as Pe, useState as K } from "react";
|
|
6
6
|
import { Fragment as q, jsx as J, jsxs as Y } from "react/jsx-runtime";
|
|
7
7
|
//#region ../attachment-input/dist/index.js
|
|
8
|
-
var
|
|
8
|
+
var Fe = /* @__PURE__ */ function(e) {
|
|
9
9
|
return e.Idle = "idle", e.Loading = "loading", e.Loaded = "loaded", e.Error = "error", e;
|
|
10
|
-
}({}),
|
|
11
|
-
let n =
|
|
10
|
+
}({}), Ie = ({ enabled: e, src: t }) => {
|
|
11
|
+
let n = Pe(null), [r, i] = K("idle");
|
|
12
12
|
return je(() => {
|
|
13
13
|
i(e && t ? "loading" : "idle");
|
|
14
14
|
}, [e, t]), je(() => {
|
|
@@ -34,75 +34,75 @@ var Pe = /* @__PURE__ */ function(e) {
|
|
|
34
34
|
actionBtn: "_actionBtn_1wsze_32",
|
|
35
35
|
removeBtnImage: "_removeBtnImage_1wsze_43",
|
|
36
36
|
hoverDownloadIcon: "_hoverDownloadIcon_1wsze_51"
|
|
37
|
-
},
|
|
37
|
+
}, Le = (e) => {
|
|
38
38
|
if (!e) return R;
|
|
39
39
|
if (e.startsWith("image/")) switch (e) {
|
|
40
40
|
case "image/jpeg":
|
|
41
|
-
case "image/jpg": return
|
|
42
|
-
case "image/png": return
|
|
43
|
-
case "image/svg+xml": return
|
|
44
|
-
case "image/bmp": return
|
|
45
|
-
default: return
|
|
41
|
+
case "image/jpg": return te;
|
|
42
|
+
case "image/png": return ie;
|
|
43
|
+
case "image/svg+xml": return ce;
|
|
44
|
+
case "image/bmp": return z;
|
|
45
|
+
default: return be;
|
|
46
46
|
}
|
|
47
47
|
if (e.startsWith("video/")) return De;
|
|
48
|
-
if (e.startsWith("audio/")) return
|
|
48
|
+
if (e.startsWith("audio/")) return _e;
|
|
49
49
|
switch (e) {
|
|
50
|
-
case "application/pdf": return
|
|
50
|
+
case "application/pdf": return G;
|
|
51
51
|
case "application/msword":
|
|
52
|
-
case "application/vnd.ms-word": return
|
|
53
|
-
case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return
|
|
54
|
-
case "application/vnd.ms-powerpoint": return
|
|
55
|
-
case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return
|
|
56
|
-
case "application/vnd.ms-excel": return
|
|
57
|
-
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return
|
|
52
|
+
case "application/vnd.ms-word": return ee;
|
|
53
|
+
case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return H;
|
|
54
|
+
case "application/vnd.ms-powerpoint": return ae;
|
|
55
|
+
case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return ae;
|
|
56
|
+
case "application/vnd.ms-excel": return pe;
|
|
57
|
+
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return pe;
|
|
58
58
|
case "application/zip":
|
|
59
59
|
case "application/x-zip-compressed":
|
|
60
60
|
case "application/x-rar-compressed":
|
|
61
61
|
case "application/x-7z-compressed":
|
|
62
62
|
case "application/gzip":
|
|
63
|
-
case "application/x-tar": return
|
|
64
|
-
case "text/csv": return
|
|
65
|
-
case "text/plain": return
|
|
63
|
+
case "application/x-tar": return he;
|
|
64
|
+
case "text/csv": return V;
|
|
65
|
+
case "text/plain": return de;
|
|
66
66
|
case "text/html":
|
|
67
|
-
case "application/xhtml+xml": return
|
|
67
|
+
case "application/xhtml+xml": return U;
|
|
68
68
|
case "text/xml":
|
|
69
|
-
case "application/xml": return
|
|
69
|
+
case "application/xml": return me;
|
|
70
70
|
case "application/sql":
|
|
71
|
-
case "text/x-sql": return
|
|
71
|
+
case "text/x-sql": return se;
|
|
72
72
|
case "text/javascript":
|
|
73
|
-
case "application/javascript": return
|
|
74
|
-
case "text/jsx": return
|
|
73
|
+
case "application/javascript": return ne;
|
|
74
|
+
case "text/jsx": return W;
|
|
75
75
|
case "application/typescript":
|
|
76
|
-
case "text/typescript": return
|
|
77
|
-
case "text/tsx": return
|
|
78
|
-
case "text/css": return
|
|
76
|
+
case "text/typescript": return le;
|
|
77
|
+
case "text/tsx": return ue;
|
|
78
|
+
case "text/css": return B;
|
|
79
79
|
case "text/x-php":
|
|
80
|
-
case "application/x-php": return
|
|
80
|
+
case "application/x-php": return re;
|
|
81
81
|
case "text/x-rustsrc":
|
|
82
|
-
case "application/x-rust": return
|
|
83
|
-
case "text/x-vue": return
|
|
82
|
+
case "application/x-rust": return oe;
|
|
83
|
+
case "text/x-vue": return fe;
|
|
84
84
|
default: return R;
|
|
85
85
|
}
|
|
86
|
-
}, Le = (e) => {
|
|
87
|
-
let { type: n, contentType: r } = e;
|
|
88
|
-
return n === t.Prompt ? Ce : n === t.Pasted ? F : n === t.Image ? G : Ie(r ?? "");
|
|
89
86
|
}, Re = (e) => {
|
|
87
|
+
let { type: n, contentType: r } = e;
|
|
88
|
+
return n === t.Prompt ? Ce : n === t.Pasted ? F : n === t.Image ? be : Le(r ?? "");
|
|
89
|
+
}, ze = (e) => {
|
|
90
90
|
let t = e.toLowerCase().split(";")[0].trim(), n = o[t];
|
|
91
91
|
if (n) return n;
|
|
92
92
|
let r = t.split("/")[1];
|
|
93
93
|
if (r && !r.startsWith("vnd.") && !r.includes("+")) return r;
|
|
94
|
-
},
|
|
94
|
+
}, Be = (e) => {
|
|
95
95
|
let { type: n, name: r, contentType: i } = e;
|
|
96
96
|
if (n === t.Prompt) return "Prompt";
|
|
97
97
|
if (n === t.Pasted) return "Pasted";
|
|
98
98
|
if (n === t.Image) return "Image";
|
|
99
99
|
if (i) {
|
|
100
|
-
let e =
|
|
100
|
+
let e = ze(i);
|
|
101
101
|
if (e) return `.${e}`;
|
|
102
102
|
}
|
|
103
103
|
let a = r.lastIndexOf(".");
|
|
104
104
|
return a > 0 && a < r.length - 1 ? `.${r.slice(a + 1).toLowerCase()}` : r;
|
|
105
|
-
},
|
|
105
|
+
}, Ve = (e, n, r) => {
|
|
106
106
|
let { type: i, status: a, previewUrl: o, url: s } = e, c = a === l.Loading, u = a === l.Error, d = i === t.Image && !!(o ?? s) && !u, p = i === t.Audio && !u, m = f(X.card, u && X.cardError, n && X.cardSelected, !u && !n && i === t.Prompt && X.cardPrompt, !u && !n && i === t.Pasted && X.cardPasted);
|
|
107
107
|
return {
|
|
108
108
|
isLoading: c,
|
|
@@ -110,35 +110,35 @@ var Pe = /* @__PURE__ */ function(e) {
|
|
|
110
110
|
isImage: d,
|
|
111
111
|
isAudio: p,
|
|
112
112
|
areActionsVisible: u || r,
|
|
113
|
-
BottomIcon:
|
|
114
|
-
typeLabel:
|
|
113
|
+
BottomIcon: Re(e),
|
|
114
|
+
typeLabel: Be(e),
|
|
115
115
|
cardColorClass: m,
|
|
116
116
|
removeBtnClass: d ? X.removeBtnImage : X.actionBtn
|
|
117
117
|
};
|
|
118
|
-
},
|
|
118
|
+
}, He = (e) => {
|
|
119
119
|
let t = e.lastIndexOf(".");
|
|
120
120
|
return t > 0 ? e.slice(0, t) : e;
|
|
121
|
-
},
|
|
122
|
-
let { id: T, name: D } = n, O = n.previewUrl ?? n.url, A = n.type === t.Pasted, j = A && s !== void 0, M =
|
|
121
|
+
}, Ue = ({ attachment: n, searchQuery: r = "", onRemove: a, onRetry: o, onExpand: s, onClick: c, isSelected: l, shouldAlwaysShowActions: u, removeLabel: p = "Remove attachment", retryLabel: g = "Retry upload", clickLabel: _ = "Open attachment", colors: v, typography: y, roundedClassName: b = "rounded-xl", showHoverDownloadIcon: x = !1, className: S }) => {
|
|
122
|
+
let { id: T, name: D } = n, O = n.previewUrl ?? n.url, A = n.type === t.Pasted, j = A && s !== void 0, M = Ne(() => A ? D : He(D), [A, D]), N = d({
|
|
123
123
|
"--ci-card-border": v?.border,
|
|
124
124
|
"--ci-card-bg": v?.background,
|
|
125
125
|
"--ci-card-name": v?.nameText,
|
|
126
126
|
"--ci-card-meta": v?.metaText
|
|
127
|
-
}), { isLoading: P, isError: F, isImage: I, isAudio: R, areActionsVisible:
|
|
127
|
+
}), { isLoading: P, isError: F, isImage: I, isAudio: R, areActionsVisible: z, BottomIcon: B, typeLabel: V, cardColorClass: ee, removeBtnClass: H } = Ne(() => Ve(n, l ?? !1, u ?? !1), [
|
|
128
128
|
n,
|
|
129
129
|
l,
|
|
130
130
|
u
|
|
131
|
-
]),
|
|
131
|
+
]), U = c !== void 0 && !j && !P && !F, te = j || U, { imageRef: ne, imageLoadStatus: W } = Ie({
|
|
132
132
|
enabled: I,
|
|
133
133
|
src: O
|
|
134
|
-
}),
|
|
135
|
-
j && s ? s(T) :
|
|
136
|
-
},
|
|
137
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
134
|
+
}), G = () => {
|
|
135
|
+
j && s ? s(T) : U && c && c(T);
|
|
136
|
+
}, re = (e) => {
|
|
137
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), G());
|
|
138
138
|
};
|
|
139
139
|
if (R) return /* @__PURE__ */ Y("div", {
|
|
140
140
|
style: N,
|
|
141
|
-
className: f("group flex w-full min-w-[280px] max-w-[300px] flex-col gap-2 border p-3", b,
|
|
141
|
+
className: f("group flex w-full min-w-[280px] max-w-[300px] flex-col gap-2 border p-3", b, ee, S),
|
|
142
142
|
children: [/* @__PURE__ */ Y("div", {
|
|
143
143
|
className: "flex items-center justify-between gap-2",
|
|
144
144
|
children: [/* @__PURE__ */ J("span", {
|
|
@@ -155,7 +155,7 @@ var Pe = /* @__PURE__ */ function(e) {
|
|
|
155
155
|
"aria-hidden": !0
|
|
156
156
|
}),
|
|
157
157
|
size: k.Small,
|
|
158
|
-
className: f("h-6 w-6 shrink-0 rounded",
|
|
158
|
+
className: f("h-6 w-6 shrink-0 rounded", H),
|
|
159
159
|
"aria-label": _,
|
|
160
160
|
onClick: (e) => {
|
|
161
161
|
e.stopPropagation(), c(T);
|
|
@@ -168,38 +168,38 @@ var Pe = /* @__PURE__ */ function(e) {
|
|
|
168
168
|
preload: "metadata"
|
|
169
169
|
})]
|
|
170
170
|
});
|
|
171
|
-
let
|
|
171
|
+
let ie = f("group relative flex h-[100px] w-[100px] flex-shrink-0 border focus-within:outline focus-within:outline-1 focus-within:outline-offset-1", b, ee, !I && "flex-col gap-3 p-3", te && "cursor-pointer", S), ae = /* @__PURE__ */ Y(q, { children: [
|
|
172
172
|
I ? /* @__PURE__ */ Y("div", {
|
|
173
173
|
className: "relative h-full w-full overflow-hidden",
|
|
174
|
-
children: [
|
|
174
|
+
children: [W !== Fe.Loaded && /* @__PURE__ */ J(C, {
|
|
175
175
|
variant: w.Rectangular,
|
|
176
176
|
width: "100%",
|
|
177
177
|
height: "100%",
|
|
178
|
-
active:
|
|
179
|
-
overlay: /* @__PURE__ */ J(
|
|
178
|
+
active: W === Fe.Loading,
|
|
179
|
+
overlay: /* @__PURE__ */ J(be, {
|
|
180
180
|
size: m.LG,
|
|
181
181
|
className: y?.placeholderIconClassName ?? "text-secondary",
|
|
182
182
|
"aria-hidden": !0
|
|
183
183
|
}),
|
|
184
184
|
className: f("absolute inset-0", b)
|
|
185
185
|
}), /* @__PURE__ */ J("img", {
|
|
186
|
-
ref:
|
|
186
|
+
ref: ne,
|
|
187
187
|
src: O,
|
|
188
188
|
alt: D,
|
|
189
189
|
loading: "lazy",
|
|
190
190
|
decoding: "async",
|
|
191
|
-
className: f("h-full w-full object-cover transition-opacity duration-200",
|
|
191
|
+
className: f("h-full w-full object-cover transition-opacity duration-200", W === Fe.Loaded ? "opacity-100" : "opacity-0", b)
|
|
192
192
|
})]
|
|
193
193
|
}) : F ? /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ Y("div", {
|
|
194
194
|
className: "flex flex-row items-center gap-1 overflow-hidden",
|
|
195
|
-
children: [/* @__PURE__ */ J(
|
|
195
|
+
children: [/* @__PURE__ */ J(B, {
|
|
196
196
|
size: m.SM,
|
|
197
197
|
className: f("shrink-0", X.meta),
|
|
198
198
|
"aria-hidden": !0
|
|
199
199
|
}), /* @__PURE__ */ J("span", {
|
|
200
|
-
title:
|
|
200
|
+
title: V,
|
|
201
201
|
className: f(y?.metaClassName ?? "dial-tiny-text", "min-w-0 truncate", X.meta),
|
|
202
|
-
children:
|
|
202
|
+
children: V
|
|
203
203
|
})]
|
|
204
204
|
}), /* @__PURE__ */ J("div", {
|
|
205
205
|
className: "min-w-0 flex-1",
|
|
@@ -225,14 +225,14 @@ var Pe = /* @__PURE__ */ function(e) {
|
|
|
225
225
|
})
|
|
226
226
|
}), /* @__PURE__ */ Y("div", {
|
|
227
227
|
className: "flex flex-row items-center gap-1 overflow-hidden",
|
|
228
|
-
children: [/* @__PURE__ */ J(
|
|
228
|
+
children: [/* @__PURE__ */ J(B, {
|
|
229
229
|
size: m.SM,
|
|
230
230
|
className: f("shrink-0", X.meta),
|
|
231
231
|
"aria-hidden": !0
|
|
232
232
|
}), /* @__PURE__ */ J("span", {
|
|
233
|
-
title:
|
|
233
|
+
title: V,
|
|
234
234
|
className: f(y?.metaClassName ?? "dial-tiny-text", "min-w-0 truncate", X.meta),
|
|
235
|
-
children:
|
|
235
|
+
children: V
|
|
236
236
|
})]
|
|
237
237
|
})] }),
|
|
238
238
|
P && /* @__PURE__ */ J("span", {
|
|
@@ -244,7 +244,7 @@ var Pe = /* @__PURE__ */ function(e) {
|
|
|
244
244
|
})
|
|
245
245
|
}),
|
|
246
246
|
!P && /* @__PURE__ */ Y("div", {
|
|
247
|
-
className: f("absolute end-1 top-1 flex gap-1 transition-opacity",
|
|
247
|
+
className: f("absolute end-1 top-1 flex gap-1 transition-opacity", z ? "opacity-100" : "opacity-0 group-focus-within:opacity-100 group-hover:opacity-100 mobile:opacity-100"),
|
|
248
248
|
children: [
|
|
249
249
|
F && o && n.errorReason !== e.UnsupportedType && /* @__PURE__ */ J(h, {
|
|
250
250
|
icon: /* @__PURE__ */ J(Se, {
|
|
@@ -252,7 +252,7 @@ var Pe = /* @__PURE__ */ function(e) {
|
|
|
252
252
|
"aria-hidden": !0
|
|
253
253
|
}),
|
|
254
254
|
size: k.Small,
|
|
255
|
-
className: f("h-6 w-6 rounded",
|
|
255
|
+
className: f("h-6 w-6 rounded", H),
|
|
256
256
|
"aria-label": g,
|
|
257
257
|
onClick: (e) => {
|
|
258
258
|
e.stopPropagation(), o(T);
|
|
@@ -264,7 +264,7 @@ var Pe = /* @__PURE__ */ function(e) {
|
|
|
264
264
|
"aria-hidden": !0
|
|
265
265
|
}),
|
|
266
266
|
size: k.Small,
|
|
267
|
-
className: f("h-6 w-6 rounded",
|
|
267
|
+
className: f("h-6 w-6 rounded", H),
|
|
268
268
|
"aria-label": p,
|
|
269
269
|
onClick: (e) => {
|
|
270
270
|
e.stopPropagation(), a?.(T);
|
|
@@ -278,23 +278,23 @@ var Pe = /* @__PURE__ */ function(e) {
|
|
|
278
278
|
]
|
|
279
279
|
})
|
|
280
280
|
] });
|
|
281
|
-
return
|
|
281
|
+
return te ? /* @__PURE__ */ J("div", {
|
|
282
282
|
style: N,
|
|
283
|
-
className:
|
|
284
|
-
onClick:
|
|
285
|
-
onKeyDown:
|
|
283
|
+
className: ie,
|
|
284
|
+
onClick: G,
|
|
285
|
+
onKeyDown: re,
|
|
286
286
|
tabIndex: 0,
|
|
287
287
|
role: "button",
|
|
288
|
-
"aria-label":
|
|
289
|
-
children:
|
|
288
|
+
"aria-label": U ? _ : void 0,
|
|
289
|
+
children: ae
|
|
290
290
|
}) : /* @__PURE__ */ J("div", {
|
|
291
291
|
style: N,
|
|
292
|
-
className:
|
|
293
|
-
children:
|
|
292
|
+
className: ie,
|
|
293
|
+
children: ae
|
|
294
294
|
});
|
|
295
|
-
},
|
|
295
|
+
}, We = /* @__PURE__ */ function(e) {
|
|
296
296
|
return e.None = "none", e.AllVisible = "all-visible", e.Collapsed = "collapsed", e;
|
|
297
|
-
}({}),
|
|
297
|
+
}({}), Ge = (e, t) => e <= 0 ? {
|
|
298
298
|
layout: "none",
|
|
299
299
|
visibleCount: 0,
|
|
300
300
|
hiddenCount: 0
|
|
@@ -317,11 +317,11 @@ var Pe = /* @__PURE__ */ function(e) {
|
|
|
317
317
|
track: "_track_1x7ag_60",
|
|
318
318
|
indeterminateFill: "_indeterminateFill_1x7ag_64",
|
|
319
319
|
"attachment-tile-indeterminate": "_attachment-tile-indeterminate_1x7ag_1"
|
|
320
|
-
},
|
|
320
|
+
}, Ke = {
|
|
321
321
|
[e.Network]: "Upload failed · network error",
|
|
322
322
|
[e.UnsupportedType]: "Upload failed · unsupported file type"
|
|
323
|
-
},
|
|
324
|
-
let { id: u, name: d, status: p, errorReason: g } = t, _ = p === l.Loading, v = p === l.Error, y = v && (g &&
|
|
323
|
+
}, qe = ({ attachment: t, onClick: r, onRetry: i, clickLabel: a = "Download attachment", retryLabel: o = "Retry upload", theme: s = n.Dark, className: c }) => {
|
|
324
|
+
let { id: u, name: d, status: p, errorReason: g } = t, _ = p === l.Loading, v = p === l.Error, y = v && (g && Ke[g] || "Upload failed"), { BottomIcon: b, typeLabel: x } = Ve(t, !1, !1), S = !v && !_ && r !== void 0, C = v && !!i && g !== e.UnsupportedType, w = S || C ? "pe-5" : void 0, T = () => {
|
|
325
325
|
S && r?.(t);
|
|
326
326
|
}, E = (e) => {
|
|
327
327
|
(e.key === "Enter" || e.key === " ") && S && (e.preventDefault(), T());
|
|
@@ -381,11 +381,11 @@ var Pe = /* @__PURE__ */ function(e) {
|
|
|
381
381
|
children: j
|
|
382
382
|
})
|
|
383
383
|
});
|
|
384
|
-
},
|
|
384
|
+
}, Je = { tile: "_tile_kvom5_1" }, Ye = ({ count: e, onClick: t, ariaLabel: n, children: r, className: i }) => /* @__PURE__ */ J("button", {
|
|
385
385
|
type: "button",
|
|
386
386
|
onClick: t,
|
|
387
387
|
"aria-label": n ?? `Show ${e} more attachments`,
|
|
388
|
-
className: f("dial-small-semi-text flex size-[84px] items-center justify-center rounded-xl border",
|
|
388
|
+
className: f("dial-small-semi-text flex size-[84px] items-center justify-center rounded-xl border", Je.tile, i),
|
|
389
389
|
children: r ?? /* @__PURE__ */ J("bdi", {
|
|
390
390
|
dir: "ltr",
|
|
391
391
|
children: `+${e}`
|
|
@@ -396,10 +396,10 @@ var Pe = /* @__PURE__ */ function(e) {
|
|
|
396
396
|
headerLabel: "_headerLabel_4zxg9_7",
|
|
397
397
|
downloadAllButton: "_downloadAllButton_4zxg9_8",
|
|
398
398
|
imageTile: "_imageTile_4zxg9_12"
|
|
399
|
-
},
|
|
400
|
-
let [_, v] = K(!1), y =
|
|
399
|
+
}, Xe = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, Ze = ({ attachments: e, onAttachmentClick: n, onDownloadAll: r, onRetry: i, getSizeLabel: a, ariaLabel: o = "Attachments", clickLabel: s = "Download attachment", retryLabel: c = "Retry upload", showLessLabel: u = "Show less", downloadAllLabel: d = "Download all", theme: p, className: g }) => {
|
|
400
|
+
let [_, v] = K(!1), y = Ne(() => Ge(e.length, _), [e.length, _]);
|
|
401
401
|
if (e.length === 0) return null;
|
|
402
|
-
let b = e.some((e) => e.type === t.Image), x = e.some((e) => e.type !== t.Image), S = b && x, C = e.length >= 5, w = S ?
|
|
402
|
+
let b = e.some((e) => e.type === t.Image), x = e.some((e) => e.type !== t.Image), S = b && x, C = e.length >= 5, w = S ? ve : b ? be : R, T = Xe(e.length, "attachment"), E = e.slice(0, y.visibleCount);
|
|
403
403
|
return /* @__PURE__ */ Y("div", {
|
|
404
404
|
role: "group",
|
|
405
405
|
"aria-label": o,
|
|
@@ -436,7 +436,7 @@ var Pe = /* @__PURE__ */ function(e) {
|
|
|
436
436
|
children: [
|
|
437
437
|
E.map((e) => /* @__PURE__ */ J("div", {
|
|
438
438
|
role: "listitem",
|
|
439
|
-
children: e.type === t.Image ? /* @__PURE__ */ J(
|
|
439
|
+
children: e.type === t.Image ? /* @__PURE__ */ J(Ue, {
|
|
440
440
|
attachment: e,
|
|
441
441
|
onClick: n ? () => n(e) : void 0,
|
|
442
442
|
onRetry: i,
|
|
@@ -445,7 +445,7 @@ var Pe = /* @__PURE__ */ function(e) {
|
|
|
445
445
|
roundedClassName: "rounded-xl",
|
|
446
446
|
showHoverDownloadIcon: !0,
|
|
447
447
|
className: f("size-[84px]", Q.imageTile)
|
|
448
|
-
}) : /* @__PURE__ */ J(
|
|
448
|
+
}) : /* @__PURE__ */ J(qe, {
|
|
449
449
|
attachment: e,
|
|
450
450
|
sizeLabel: a?.(e),
|
|
451
451
|
onClick: n,
|
|
@@ -455,16 +455,16 @@ var Pe = /* @__PURE__ */ function(e) {
|
|
|
455
455
|
theme: p
|
|
456
456
|
})
|
|
457
457
|
}, e.id)),
|
|
458
|
-
y.layout ===
|
|
458
|
+
y.layout === We.Collapsed && /* @__PURE__ */ J("div", {
|
|
459
459
|
role: "listitem",
|
|
460
|
-
children: /* @__PURE__ */ J(
|
|
460
|
+
children: /* @__PURE__ */ J(Ye, {
|
|
461
461
|
count: y.hiddenCount,
|
|
462
462
|
onClick: () => v(!0)
|
|
463
463
|
})
|
|
464
464
|
}),
|
|
465
465
|
C && _ && /* @__PURE__ */ J("div", {
|
|
466
466
|
role: "listitem",
|
|
467
|
-
children: /* @__PURE__ */ J(
|
|
467
|
+
children: /* @__PURE__ */ J(Ye, {
|
|
468
468
|
count: 0,
|
|
469
469
|
onClick: () => v(!1),
|
|
470
470
|
ariaLabel: u,
|
|
@@ -477,7 +477,7 @@ var Pe = /* @__PURE__ */ function(e) {
|
|
|
477
477
|
]
|
|
478
478
|
})]
|
|
479
479
|
});
|
|
480
|
-
},
|
|
480
|
+
}, Qe = {
|
|
481
481
|
tab: "_tab_1mi6x_1",
|
|
482
482
|
tabActive: "_tabActive_1mi6x_13"
|
|
483
483
|
};
|
|
@@ -489,12 +489,12 @@ ke(({ tabs: e, activeTabId: t, onTabChange: n, tabClassName: r = "dial-tiny-semi
|
|
|
489
489
|
label: e.label,
|
|
490
490
|
selected: i,
|
|
491
491
|
onClick: () => n(e.id),
|
|
492
|
-
className: f("box-border h-auto shrink-0 justify-center rounded-full p-2 text-center", r,
|
|
492
|
+
className: f("box-border h-auto shrink-0 justify-center rounded-full p-2 text-center", r, Qe.tab, i && Qe.tabActive)
|
|
493
493
|
}, e.id);
|
|
494
494
|
})
|
|
495
495
|
}));
|
|
496
|
-
var
|
|
497
|
-
let [s, c] = K(t), [l, u] = K(n), [d, f] = K(r), p =
|
|
496
|
+
var $e = (e) => /* @__PURE__ */ J(b, { ...e }), et = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
|
|
497
|
+
let [s, c] = K(t), [l, u] = K(n), [d, f] = K(r), p = Pe(o);
|
|
498
498
|
je(() => {
|
|
499
499
|
o && !p.current && (c(t), u(n), f(r)), p.current = o;
|
|
500
500
|
}, [
|
|
@@ -526,7 +526,7 @@ var Qe = (e) => /* @__PURE__ */ J(b, { ...e }), $e = ({ features: e, initialResp
|
|
|
526
526
|
a
|
|
527
527
|
])
|
|
528
528
|
};
|
|
529
|
-
},
|
|
529
|
+
}, 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: l = "Markdown", responseFormatPlainTextLabel: d = "Plain text", systemPromptLabel: f = "System prompt", systemPromptTooltip: p = "Enter a prompt", temperatureLabel: m = "Temperature", temperatureLabels: h = [
|
|
530
530
|
"Precise",
|
|
531
531
|
"Neutral",
|
|
532
532
|
"Creative"
|
|
@@ -569,7 +569,7 @@ var Qe = (e) => /* @__PURE__ */ J(b, { ...e }), $e = ({ features: e, initialResp
|
|
|
569
569
|
]
|
|
570
570
|
});
|
|
571
571
|
ke(({ 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: h, saveLabel: g = "Apply changes", saveDisabledTooltip: _ }) => {
|
|
572
|
-
let { responseFormat: v, systemPrompt: b, temperature: x, canSubmit: S, setResponseFormat: C, setSystemPrompt: w, setTemperature: T, handleSubmit: E } =
|
|
572
|
+
let { responseFormat: v, systemPrompt: b, temperature: x, canSubmit: S, setResponseFormat: C, setSystemPrompt: w, setTemperature: T, handleSubmit: E } = et({
|
|
573
573
|
features: e,
|
|
574
574
|
initialResponseFormat: t,
|
|
575
575
|
initialSystemPrompt: n,
|
|
@@ -588,14 +588,14 @@ ke(({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemp
|
|
|
588
588
|
children: /* @__PURE__ */ J(O, {
|
|
589
589
|
tooltip: _,
|
|
590
590
|
hideTooltip: S || !_,
|
|
591
|
-
children: /* @__PURE__ */ J(
|
|
591
|
+
children: /* @__PURE__ */ J($e, {
|
|
592
592
|
label: g,
|
|
593
593
|
onClick: E,
|
|
594
594
|
disabled: !S
|
|
595
595
|
})
|
|
596
596
|
})
|
|
597
597
|
}),
|
|
598
|
-
children: /* @__PURE__ */ J(
|
|
598
|
+
children: /* @__PURE__ */ J(tt, {
|
|
599
599
|
features: e,
|
|
600
600
|
responseFormat: v,
|
|
601
601
|
systemPrompt: b,
|
|
@@ -616,230 +616,274 @@ ke(({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemp
|
|
|
616
616
|
});
|
|
617
617
|
});
|
|
618
618
|
//#endregion
|
|
619
|
-
//#region src/components/
|
|
620
|
-
var
|
|
621
|
-
let
|
|
622
|
-
a?.(),
|
|
623
|
-
}, [a]),
|
|
624
|
-
o?.(),
|
|
625
|
-
}, [o]);
|
|
626
|
-
return /* @__PURE__ */
|
|
619
|
+
//#region src/components/MessageActions/MessageActions.tsx
|
|
620
|
+
var nt = 2e3, rt = ({ role: e = c.User, onEdit: t, onEditHover: n, onDelete: r, onRegenerate: i, onCopy: a, onCopyMarkdown: o, onLike: l, onDislike: u, activeRating: d, isAlwaysVisible: p, className: g, labels: _ }) => {
|
|
621
|
+
let { tooltips: v, ariaLabels: y } = _ ?? {}, [b, x] = K(null), [S, C] = K(""), w = Ae(() => {
|
|
622
|
+
a?.(), x("copy"), C(y?.copiedStatus ?? "Copied to clipboard"), setTimeout(() => x(null), nt);
|
|
623
|
+
}, [a, y?.copiedStatus]), T = Ae(() => {
|
|
624
|
+
o?.(), x("markdown"), C(y?.copiedMarkdownStatus ?? "Copied as Markdown to clipboard"), setTimeout(() => x(null), nt);
|
|
625
|
+
}, [o, y?.copiedMarkdownStatus]);
|
|
626
|
+
return /* @__PURE__ */ Y("div", {
|
|
627
|
+
role: "toolbar",
|
|
628
|
+
"aria-label": y?.actionsGroup ?? "Message actions",
|
|
627
629
|
className: f("flex gap-1", !p && "opacity-0 group-hover:opacity-100", g),
|
|
628
|
-
children:
|
|
629
|
-
|
|
630
|
+
children: [/* @__PURE__ */ J("span", {
|
|
631
|
+
role: "status",
|
|
632
|
+
"aria-live": "polite",
|
|
633
|
+
className: "sr-only",
|
|
634
|
+
children: S
|
|
635
|
+
}), e === c.User ? /* @__PURE__ */ Y(q, { children: [t && /* @__PURE__ */ J(h, {
|
|
636
|
+
icon: /* @__PURE__ */ J(ye, {
|
|
637
|
+
size: m.SM,
|
|
638
|
+
"aria-hidden": !0
|
|
639
|
+
}),
|
|
630
640
|
size: k.Small,
|
|
631
|
-
"aria-label":
|
|
632
|
-
tooltipProps: { tooltip:
|
|
641
|
+
"aria-label": y?.editMessage ?? "Edit message",
|
|
642
|
+
tooltipProps: { tooltip: v?.edit ?? "Edit" },
|
|
633
643
|
onClick: t,
|
|
634
|
-
onMouseEnter: n
|
|
644
|
+
onMouseEnter: n,
|
|
645
|
+
onFocus: n
|
|
635
646
|
}), r && /* @__PURE__ */ J(h, {
|
|
636
|
-
icon: /* @__PURE__ */ J(Ee, {
|
|
647
|
+
icon: /* @__PURE__ */ J(Ee, {
|
|
648
|
+
size: m.SM,
|
|
649
|
+
"aria-hidden": !0
|
|
650
|
+
}),
|
|
637
651
|
size: k.Small,
|
|
638
|
-
"aria-label":
|
|
639
|
-
tooltipProps: { tooltip:
|
|
652
|
+
"aria-label": y?.deleteMessage ?? "Delete message",
|
|
653
|
+
tooltipProps: { tooltip: v?.delete ?? "Delete" },
|
|
640
654
|
onClick: r
|
|
641
655
|
})] }) : /* @__PURE__ */ Y(q, { children: [
|
|
642
656
|
i && /* @__PURE__ */ J(h, {
|
|
643
|
-
icon: /* @__PURE__ */ J(xe, {
|
|
657
|
+
icon: /* @__PURE__ */ J(xe, {
|
|
658
|
+
size: m.SM,
|
|
659
|
+
"aria-hidden": !0
|
|
660
|
+
}),
|
|
644
661
|
size: k.Small,
|
|
645
|
-
"aria-label":
|
|
646
|
-
tooltipProps: { tooltip:
|
|
662
|
+
"aria-label": y?.regenerateResponse ?? "Regenerate response",
|
|
663
|
+
tooltipProps: { tooltip: v?.regenerate ?? "Regenerate" },
|
|
647
664
|
onClick: i
|
|
648
665
|
}),
|
|
649
666
|
a && /* @__PURE__ */ J(h, {
|
|
650
|
-
icon: J(
|
|
667
|
+
icon: J(b === "copy" ? M : I, {
|
|
668
|
+
size: m.SM,
|
|
669
|
+
"aria-hidden": !0
|
|
670
|
+
}),
|
|
651
671
|
size: k.Small,
|
|
652
|
-
"aria-label":
|
|
653
|
-
tooltipProps: { tooltip:
|
|
654
|
-
onClick:
|
|
672
|
+
"aria-label": y?.copyResponse ?? "Copy response",
|
|
673
|
+
tooltipProps: { tooltip: b === "copy" ? v?.copied ?? "Copied!" : v?.copy ?? "Copy" },
|
|
674
|
+
onClick: w
|
|
655
675
|
}),
|
|
656
676
|
o && /* @__PURE__ */ J(h, {
|
|
657
|
-
icon: J(
|
|
677
|
+
icon: J(b === "markdown" ? M : ge, {
|
|
678
|
+
size: m.SM,
|
|
679
|
+
"aria-hidden": !0
|
|
680
|
+
}),
|
|
658
681
|
size: k.Small,
|
|
659
|
-
"aria-label":
|
|
660
|
-
tooltipProps: { tooltip:
|
|
661
|
-
onClick:
|
|
682
|
+
"aria-label": y?.copyAsMarkdown ?? "Copy as markdown",
|
|
683
|
+
tooltipProps: { tooltip: b === "markdown" ? v?.copiedMarkdown ?? "Copied!" : v?.copyMarkdown ?? "Copy as Markdown" },
|
|
684
|
+
onClick: T
|
|
662
685
|
}),
|
|
663
686
|
l && /* @__PURE__ */ J(h, {
|
|
664
|
-
icon: /* @__PURE__ */ J(Te, {
|
|
687
|
+
icon: /* @__PURE__ */ J(Te, {
|
|
688
|
+
size: m.SM,
|
|
689
|
+
"aria-hidden": !0
|
|
690
|
+
}),
|
|
665
691
|
size: k.Small,
|
|
666
|
-
"aria-label":
|
|
692
|
+
"aria-label": y?.likeResponse ?? "Like response",
|
|
693
|
+
"aria-pressed": d === s.Like,
|
|
667
694
|
className: d === s.Like ? "!text-accent-primary" : void 0,
|
|
668
|
-
tooltipProps: { tooltip:
|
|
695
|
+
tooltipProps: { tooltip: v?.like ?? "Like" },
|
|
669
696
|
onClick: l
|
|
670
697
|
}),
|
|
671
698
|
u && /* @__PURE__ */ J(h, {
|
|
672
|
-
icon: /* @__PURE__ */ J(we, {
|
|
699
|
+
icon: /* @__PURE__ */ J(we, {
|
|
700
|
+
size: m.SM,
|
|
701
|
+
"aria-hidden": !0
|
|
702
|
+
}),
|
|
673
703
|
size: k.Small,
|
|
674
|
-
"aria-label":
|
|
704
|
+
"aria-label": y?.dislikeResponse ?? "Dislike response",
|
|
705
|
+
"aria-pressed": d === s.Dislike,
|
|
675
706
|
className: d === s.Dislike ? "!text-accent-primary" : void 0,
|
|
676
|
-
tooltipProps: { tooltip:
|
|
707
|
+
tooltipProps: { tooltip: v?.dislike ?? "Dislike" },
|
|
677
708
|
onClick: u
|
|
678
709
|
})
|
|
679
|
-
] })
|
|
710
|
+
] })]
|
|
680
711
|
});
|
|
681
712
|
}, $ = {
|
|
682
|
-
userBubble: "
|
|
683
|
-
collapsibleText: "
|
|
684
|
-
expandedText: "
|
|
685
|
-
collapsedText: "
|
|
686
|
-
startersDivider: "
|
|
687
|
-
text: "
|
|
688
|
-
},
|
|
689
|
-
let { colors:
|
|
690
|
-
"--cm-bubble-text":
|
|
691
|
-
"--cm-starters-divider":
|
|
692
|
-
}),
|
|
713
|
+
userBubble: "_userBubble_1pywn_1",
|
|
714
|
+
collapsibleText: "_collapsibleText_1pywn_6",
|
|
715
|
+
expandedText: "_expandedText_1pywn_11",
|
|
716
|
+
collapsedText: "_collapsedText_1pywn_15",
|
|
717
|
+
startersDivider: "_startersDivider_1pywn_26",
|
|
718
|
+
text: "_text_1pywn_30"
|
|
719
|
+
}, it = ({ text: e, styles: n, actions: i, hasAlwaysVisibleActions: o, isStreaming: s, attachments: l, afterContent: u, starters: p, onSelectStarter: m, deploymentIconUrl: h, deploymentDisplayName: g, markdownComponents: _, onAttachmentClick: v, onDownloadAll: y, onAttachmentRetry: b, getAttachmentSizeLabel: x, attachmentTheme: C, codeBlockTheme: w, labels: T }) => {
|
|
720
|
+
let { colors: E, typography: D, className: O, bubbleClassName: k } = n ?? {}, { attachmentClickLabel: A, attachmentRetryLabel: j, startersAriaLabel: M = "Quick reply buttons", thinkingLabel: N, codeBlockCopyLabel: P, codeBlockCopiedLabel: F, assistantMessageAriaLabel: I = "Assistant message", deploymentIconFallbackLabel: L = "AI" } = T ?? {}, R = s ? (l ?? []).filter((e) => e.type !== t.Audio) : l ?? [], z = d({
|
|
721
|
+
"--cm-bubble-text": E?.text,
|
|
722
|
+
"--cm-starters-divider": E?.startersDivider
|
|
723
|
+
}), B = f($.text, D?.fontClassName), V = !!(h || g);
|
|
693
724
|
return /* @__PURE__ */ Y("div", {
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
725
|
+
role: "group",
|
|
726
|
+
"aria-label": I,
|
|
727
|
+
style: z,
|
|
728
|
+
className: f("flex w-full items-start gap-3", O),
|
|
729
|
+
children: [V && /* @__PURE__ */ J(r, {
|
|
730
|
+
src: h,
|
|
698
731
|
size: 28,
|
|
699
|
-
initialsName:
|
|
700
|
-
tooltip:
|
|
732
|
+
initialsName: g || L,
|
|
733
|
+
tooltip: g ?? L
|
|
701
734
|
}), /* @__PURE__ */ Y("div", {
|
|
702
735
|
className: "flex w-full min-w-0 max-w-full flex-col items-start gap-5",
|
|
703
736
|
children: [/* @__PURE__ */ Y("div", {
|
|
704
|
-
className: f("flex w-full min-w-0 max-w-full flex-col items-start gap-4",
|
|
737
|
+
className: f("flex w-full min-w-0 max-w-full flex-col items-start gap-4", k),
|
|
705
738
|
children: [
|
|
706
|
-
(e ||
|
|
707
|
-
|
|
739
|
+
(e || s) && /* @__PURE__ */ J("div", {
|
|
740
|
+
"aria-live": "polite",
|
|
741
|
+
"aria-atomic": "false",
|
|
742
|
+
className: f(B, "min-w-0 max-w-full text-start"),
|
|
708
743
|
children: /* @__PURE__ */ J(a, {
|
|
709
744
|
content: e,
|
|
710
|
-
isStreaming:
|
|
711
|
-
thinkingLabel:
|
|
712
|
-
components:
|
|
713
|
-
codeBlockCopyLabel:
|
|
714
|
-
codeBlockCopiedLabel:
|
|
715
|
-
codeBlockTheme:
|
|
745
|
+
isStreaming: s,
|
|
746
|
+
thinkingLabel: N,
|
|
747
|
+
components: _,
|
|
748
|
+
codeBlockCopyLabel: P,
|
|
749
|
+
codeBlockCopiedLabel: F,
|
|
750
|
+
codeBlockTheme: w
|
|
716
751
|
})
|
|
717
752
|
}),
|
|
718
|
-
/* @__PURE__ */ J(
|
|
719
|
-
attachments:
|
|
720
|
-
onAttachmentClick:
|
|
721
|
-
onDownloadAll:
|
|
722
|
-
onRetry:
|
|
723
|
-
clickLabel:
|
|
724
|
-
retryLabel:
|
|
725
|
-
getSizeLabel:
|
|
726
|
-
theme:
|
|
753
|
+
/* @__PURE__ */ J(Ze, {
|
|
754
|
+
attachments: R,
|
|
755
|
+
onAttachmentClick: v,
|
|
756
|
+
onDownloadAll: y,
|
|
757
|
+
onRetry: b,
|
|
758
|
+
clickLabel: A,
|
|
759
|
+
retryLabel: j,
|
|
760
|
+
getSizeLabel: x,
|
|
761
|
+
theme: C
|
|
727
762
|
}),
|
|
728
|
-
|
|
729
|
-
/* @__PURE__ */ J(
|
|
730
|
-
...
|
|
731
|
-
isAlwaysVisible:
|
|
763
|
+
u,
|
|
764
|
+
/* @__PURE__ */ J(rt, {
|
|
765
|
+
...i,
|
|
766
|
+
isAlwaysVisible: o,
|
|
732
767
|
role: c.Assistant
|
|
733
768
|
})
|
|
734
769
|
]
|
|
735
|
-
}),
|
|
770
|
+
}), p && p.length > 0 && m && /* @__PURE__ */ J("div", {
|
|
736
771
|
role: "list",
|
|
737
|
-
"aria-label":
|
|
772
|
+
"aria-label": M,
|
|
738
773
|
className: f("flex w-full flex-wrap gap-2 border-t pt-5", $.startersDivider),
|
|
739
|
-
children:
|
|
774
|
+
children: p.map((e, t) => /* @__PURE__ */ J("div", {
|
|
740
775
|
role: "listitem",
|
|
741
776
|
className: "min-w-[40px]",
|
|
742
777
|
children: /* @__PURE__ */ J(S, {
|
|
743
778
|
label: e.title,
|
|
744
779
|
className: "min-w-[40px]",
|
|
745
|
-
onClick: () =>
|
|
780
|
+
onClick: () => m(e)
|
|
746
781
|
})
|
|
747
782
|
}, t))
|
|
748
783
|
})]
|
|
749
784
|
})]
|
|
750
785
|
});
|
|
751
|
-
},
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
786
|
+
}, at = ({ titleText: e = "Model switched.", bodyText: t }) => /* @__PURE__ */ J("div", {
|
|
787
|
+
role: "status",
|
|
788
|
+
"aria-live": "polite",
|
|
789
|
+
children: /* @__PURE__ */ J(v, {
|
|
790
|
+
title: e,
|
|
791
|
+
message: t,
|
|
792
|
+
textClassName: "flex-row flex-wrap gap-1"
|
|
793
|
+
})
|
|
794
|
+
}), ot = /* @__PURE__ */ function(e) {
|
|
756
795
|
return e.Bottom = "Bottom", e.Top = "Top", e;
|
|
757
|
-
}({}),
|
|
758
|
-
let { colors:
|
|
796
|
+
}({}), st = 10, ct = ({ text: e, position: t = ot.Bottom, styles: n, actions: r, hasAlwaysVisibleActions: i, attachments: a, collapsedLineCount: o = st, labels: s, onAttachmentClick: l, onDownloadAll: u, onAttachmentRetry: h, getAttachmentSizeLabel: g, attachmentTheme: v }) => {
|
|
797
|
+
let { colors: y, typography: b, className: x, bubbleClassName: S } = n ?? {}, { showMoreLabel: C = "Show more", showLessLabel: w = "Show less", showMoreAriaLabel: T, showLessAriaLabel: E, attachmentClickLabel: D, attachmentRetryLabel: O, userMessageAriaLabel: A = "User message" } = s ?? {}, { textRef: j, isTextCollapsed: M, isOverflowing: F, collapsedMaxHeight: I, expandedMaxHeight: L, isCollapsed: R, toggleCollapsed: z } = p({
|
|
759
798
|
text: e,
|
|
760
|
-
collapsedLineCount:
|
|
761
|
-
}),
|
|
762
|
-
"--cm-bubble-user-bg":
|
|
763
|
-
"--cm-bubble-
|
|
764
|
-
"--cm-bubble-
|
|
765
|
-
"--cm-bubble-
|
|
766
|
-
|
|
799
|
+
collapsedLineCount: o
|
|
800
|
+
}), B = d({
|
|
801
|
+
"--cm-bubble-user-bg": y?.userBackground,
|
|
802
|
+
"--cm-bubble-user-border": y?.userBorder,
|
|
803
|
+
"--cm-bubble-fade-start": y?.fadeStart,
|
|
804
|
+
"--cm-bubble-text": y?.text,
|
|
805
|
+
"--cm-bubble-collapsed-height": F ? `${I}px` : void 0,
|
|
806
|
+
"--cm-bubble-expanded-height": F ? `${L}px` : void 0
|
|
807
|
+
}), V = t === ot.Top ? "rounded-ee-[6px] rounded-se-[16px]" : "rounded-se-[6px] rounded-ee-[16px]", ee = f($.text, b?.fontClassName), H = T ?? C, U = E ?? w, te = R ? C : w, ne = R ? H : U, W = R ? N : P, G = Me();
|
|
767
808
|
return /* @__PURE__ */ J("div", {
|
|
768
|
-
|
|
769
|
-
|
|
809
|
+
role: "group",
|
|
810
|
+
"aria-label": A,
|
|
811
|
+
style: B,
|
|
812
|
+
className: f("flex w-full", x),
|
|
770
813
|
children: /* @__PURE__ */ Y("div", {
|
|
771
814
|
className: "ms-auto flex w-fit min-w-0 max-w-full flex-col items-end gap-4",
|
|
772
815
|
children: [
|
|
773
|
-
/* @__PURE__ */ J(
|
|
774
|
-
attachments:
|
|
775
|
-
onAttachmentClick:
|
|
776
|
-
onDownloadAll:
|
|
777
|
-
onRetry:
|
|
778
|
-
clickLabel:
|
|
779
|
-
retryLabel:
|
|
780
|
-
getSizeLabel:
|
|
781
|
-
theme:
|
|
816
|
+
/* @__PURE__ */ J(Ze, {
|
|
817
|
+
attachments: a ?? [],
|
|
818
|
+
onAttachmentClick: l,
|
|
819
|
+
onDownloadAll: u,
|
|
820
|
+
onRetry: h,
|
|
821
|
+
clickLabel: D,
|
|
822
|
+
retryLabel: O,
|
|
823
|
+
getSizeLabel: g,
|
|
824
|
+
theme: v,
|
|
782
825
|
className: "max-w-[640px]"
|
|
783
826
|
}),
|
|
784
827
|
e && /* @__PURE__ */ J("div", {
|
|
785
|
-
className: f($.userBubble, "flex w-fit items-center justify-end rounded-es-
|
|
828
|
+
className: f($.userBubble, "flex w-fit items-center justify-end rounded-es-2xl rounded-ss-2xl border px-6 py-4", V, S),
|
|
786
829
|
children: /* @__PURE__ */ Y("div", {
|
|
787
830
|
className: "flex min-w-0 flex-col items-start",
|
|
788
831
|
children: [/* @__PURE__ */ J("div", {
|
|
789
|
-
|
|
832
|
+
id: G,
|
|
833
|
+
className: f("relative overflow-hidden", F && $.collapsibleText, F && !R && $.expandedText, M && $.collapsedText),
|
|
790
834
|
children: /* @__PURE__ */ J("p", {
|
|
791
|
-
ref:
|
|
792
|
-
className: f(
|
|
835
|
+
ref: j,
|
|
836
|
+
className: f(ee, "whitespace-pre-wrap text-start [overflow-wrap:anywhere]"),
|
|
793
837
|
children: e
|
|
794
838
|
})
|
|
795
|
-
}),
|
|
796
|
-
label: /* @__PURE__ */ J(q, { children:
|
|
797
|
-
iconBefore: /* @__PURE__ */ J(
|
|
839
|
+
}), F && /* @__PURE__ */ J(_, {
|
|
840
|
+
label: /* @__PURE__ */ J(q, { children: te }),
|
|
841
|
+
iconBefore: /* @__PURE__ */ J(W, {
|
|
798
842
|
size: m.SM,
|
|
799
843
|
"aria-hidden": "true"
|
|
800
844
|
}),
|
|
801
|
-
"aria-label":
|
|
845
|
+
"aria-label": ne,
|
|
846
|
+
"aria-expanded": !R,
|
|
847
|
+
"aria-controls": G,
|
|
802
848
|
className: "mt-3",
|
|
803
|
-
onClick:
|
|
849
|
+
onClick: z,
|
|
804
850
|
size: k.Small
|
|
805
851
|
})]
|
|
806
852
|
})
|
|
807
853
|
}),
|
|
808
|
-
/* @__PURE__ */ J(
|
|
809
|
-
...
|
|
810
|
-
isAlwaysVisible:
|
|
854
|
+
/* @__PURE__ */ J(rt, {
|
|
855
|
+
...r,
|
|
856
|
+
isAlwaysVisible: i,
|
|
811
857
|
role: c.User
|
|
812
858
|
})
|
|
813
859
|
]
|
|
814
860
|
})
|
|
815
861
|
});
|
|
816
|
-
},
|
|
817
|
-
titleText:
|
|
818
|
-
bodyText:
|
|
819
|
-
}) : e === c.User ? /* @__PURE__ */ J(
|
|
820
|
-
...
|
|
821
|
-
onAttachmentClick: t
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
}), lt = { button: "_button_dcr6u_1" }, ut = ({ label: e, className: t, onClick: n, styles: r }) => {
|
|
829
|
-
let { colors: i, typography: a } = r ?? {};
|
|
862
|
+
}, lt = ({ role: e, onAttachmentClick: t, markdownComponents: n, ...r }) => e === c.Status ? /* @__PURE__ */ J(at, {
|
|
863
|
+
titleText: r.labels?.statusTitleText,
|
|
864
|
+
bodyText: r.labels?.statusBodyText ?? ""
|
|
865
|
+
}) : e === c.User ? /* @__PURE__ */ J(ct, {
|
|
866
|
+
...r,
|
|
867
|
+
onAttachmentClick: t
|
|
868
|
+
}) : /* @__PURE__ */ J(it, {
|
|
869
|
+
...r,
|
|
870
|
+
markdownComponents: n,
|
|
871
|
+
onAttachmentClick: t
|
|
872
|
+
}), ut = { button: "_button_15boc_1" }, dt = ({ label: e, onClick: t, styles: n }) => {
|
|
873
|
+
let { colors: r, typography: i, className: a } = n ?? {};
|
|
830
874
|
return /* @__PURE__ */ J("button", {
|
|
831
875
|
type: "button",
|
|
832
|
-
onClick:
|
|
876
|
+
onClick: t,
|
|
833
877
|
style: d({
|
|
834
|
-
"--cm-source-bg":
|
|
835
|
-
"--cm-source-border":
|
|
836
|
-
"--cm-source-text":
|
|
837
|
-
"--cm-source-bg-hover":
|
|
838
|
-
"--cm-source-border-hover":
|
|
878
|
+
"--cm-source-bg": r?.background,
|
|
879
|
+
"--cm-source-border": r?.border,
|
|
880
|
+
"--cm-source-text": r?.text,
|
|
881
|
+
"--cm-source-bg-hover": r?.backgroundHover,
|
|
882
|
+
"--cm-source-border-hover": r?.borderHover
|
|
839
883
|
}),
|
|
840
|
-
className: f(
|
|
884
|
+
className: f(ut.button, "relative flex h-6 items-center justify-center px-2", "border border-solid", "outline-none focus-visible:outline focus-visible:outline-1", "focus-visible:outline-offset-[3px]", "cursor-pointer whitespace-nowrap", i?.fontClassName, a),
|
|
841
885
|
children: e
|
|
842
886
|
});
|
|
843
887
|
};
|
|
844
888
|
//#endregion
|
|
845
|
-
export {
|
|
889
|
+
export { it as AssistantMessageBubble, ot as BubblePosition, rt as MessageActions, lt as MessageBubble, dt as MessageSource, at as StatusMessageBubble, ct as UserMessageBubble };
|