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