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