@epam/ai-dial-conversation-messages 1.3.0-dev.29 → 1.3.0-dev.290
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/ConversationStartTimestamp/ConversationStartTimestamp.d.ts +5 -0
- package/components/ConversationStartTimestamp/ConversationStartTimestamp.d.ts.map +1 -0
- package/components/MessageActions/MessageActions.d.ts.map +1 -1
- package/components/MessageBubble/AssistantMessageBubble.d.ts.map +1 -1
- package/components/MessageBubble/MessageBubble.d.ts.map +1 -1
- package/components/MessageBubble/StatusMessageBubble.d.ts.map +1 -1
- package/components/MessageBubble/UserMessageBubble.d.ts.map +1 -1
- package/components/MessageSelectionReply/MessageSelectionReply.d.ts.map +1 -1
- package/components/MessageTimestamp/MessageTimestamp.d.ts +5 -0
- package/components/MessageTimestamp/MessageTimestamp.d.ts.map +1 -0
- package/hooks/useNow/useNow.d.ts +3 -0
- package/hooks/useNow/useNow.d.ts.map +1 -0
- package/index.css +3 -2
- package/index.d.ts +3 -1
- package/index.d.ts.map +1 -1
- package/index.js +444 -316
- package/models/conversation-start.d.ts +43 -0
- package/models/conversation-start.d.ts.map +1 -0
- package/models/message-actions.d.ts +5 -0
- package/models/message-actions.d.ts.map +1 -1
- package/models/message-bubble.d.ts +44 -27
- package/models/message-bubble.d.ts.map +1 -1
- package/package.json +5 -5
- package/types/conversation-start-kind.d.ts +10 -0
- package/types/conversation-start-kind.d.ts.map +1 -0
- package/utils/date-time.d.ts +10 -0
- package/utils/date-time.d.ts.map +1 -0
package/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { AttachmentType as e, CopyIconButton as t, DeploymentIcon as n, MDMessageViewer as r, MessageRating as i, MessageRole as a, ResponseFormat as o, buildCssVars as s,
|
|
2
|
-
import { AttachmentGroup as
|
|
3
|
-
import { Button as
|
|
4
|
-
import { useCallback as
|
|
5
|
-
import { IconArrowBackUp as
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { createPortal as
|
|
1
|
+
import { AttachmentType as e, CopyIconButton as t, DeploymentIcon as n, MDMessageViewer as r, MessageRating as i, MessageRole as a, ResponseFormat as o, buildCssVars as s, buildInlineSegmentSource as c, createInlineSegmentComponents as l, createRehypeInlineSegments as u, mergeClasses as d, useCollapsedText as f } from "@epam/ai-dial-chat-shared";
|
|
2
|
+
import { AttachmentGroup as p } from "@epam/ai-dial-attachment-input";
|
|
3
|
+
import { Button as m, ButtonVariant as h, DIAL_ICON_SIZE as g, DIAL_KIT_ICON_STROKE as _, ElementSize as v, GhostIconButton as y, InfoMessageNotification as b, LinkButton as x, LiveRegion as S, LiveRegionElement as C, NeutralButton as w, Tooltip as T } from "@epam/ai-dial-ui-kit";
|
|
4
|
+
import { useCallback as E, useEffect as D, useId as ee, useLayoutEffect as O, useMemo as k, useRef as te, useState as A } from "react";
|
|
5
|
+
import { IconArrowBackUp as j, IconChevronDown as M, IconChevronUp as N, IconMarkdown as ne, IconPencilMinus as P, IconRefresh as F, IconThumbDown as re, IconThumbDownFilled as ie, IconThumbUp as ae, IconThumbUpFilled as oe, IconTrashX as I } from "@tabler/icons-react";
|
|
6
|
+
import { Fragment as L, jsx as R, jsxs as z } from "react/jsx-runtime";
|
|
7
|
+
import { createPortal as B } from "react-dom";
|
|
8
8
|
//#region src/constants/public-class-names.ts
|
|
9
|
-
var
|
|
9
|
+
var V = {
|
|
10
10
|
userBubble: "dial-cm-user-bubble",
|
|
11
11
|
assistantContent: "dial-cm-assistant-content"
|
|
12
|
-
},
|
|
13
|
-
let t =
|
|
14
|
-
return
|
|
12
|
+
}, H = 4, U = (e) => {
|
|
13
|
+
let t = te(null), [n, r] = A(0);
|
|
14
|
+
return D(() => {
|
|
15
15
|
if (!e) return;
|
|
16
16
|
let n = t.current;
|
|
17
17
|
if (n == null) return;
|
|
@@ -22,416 +22,536 @@ var z = {
|
|
|
22
22
|
return i.observe(n), () => i.disconnect();
|
|
23
23
|
}, [e]), {
|
|
24
24
|
slotRef: t,
|
|
25
|
-
firstLineIndent: e ? `calc(${n}px + ${
|
|
25
|
+
firstLineIndent: e ? `calc(${n}px + ${H}px)` : void 0
|
|
26
26
|
};
|
|
27
|
-
},
|
|
27
|
+
}, se = [
|
|
28
28
|
"href",
|
|
29
29
|
"src",
|
|
30
30
|
"alt",
|
|
31
31
|
"colspan",
|
|
32
32
|
"rowspan",
|
|
33
33
|
"start"
|
|
34
|
-
],
|
|
34
|
+
], ce = /* @__PURE__ */ new Set([
|
|
35
35
|
"pre",
|
|
36
36
|
"pre-wrap",
|
|
37
37
|
"pre-line",
|
|
38
38
|
"break-spaces"
|
|
39
39
|
]), W = (e) => {
|
|
40
40
|
let t = document.createElement(e.tagName.toLowerCase());
|
|
41
|
-
|
|
41
|
+
se.forEach((n) => {
|
|
42
42
|
let r = e.getAttribute(n);
|
|
43
43
|
r !== null && t.setAttribute(n, r);
|
|
44
44
|
});
|
|
45
45
|
let { whiteSpace: n } = window.getComputedStyle(e);
|
|
46
|
-
return
|
|
47
|
-
},
|
|
46
|
+
return ce.has(n) && (t.style.whiteSpace = "pre-wrap"), t;
|
|
47
|
+
}, le = (e) => e instanceof SVGElement || window.getComputedStyle(e).display === "none", ue = (e, t) => {
|
|
48
48
|
if (!t.intersectsNode(e)) return null;
|
|
49
49
|
if (e.nodeType === Node.TEXT_NODE) {
|
|
50
50
|
let n = e.data, r = e === t.startContainer ? t.startOffset : 0, i = e === t.endContainer ? t.endOffset : n.length;
|
|
51
51
|
return document.createTextNode(n.slice(r, i));
|
|
52
52
|
}
|
|
53
|
-
if (!(e instanceof Element) ||
|
|
53
|
+
if (!(e instanceof Element) || le(e)) return null;
|
|
54
54
|
let n = W(e);
|
|
55
55
|
return e.childNodes.forEach((e) => {
|
|
56
|
-
let r =
|
|
56
|
+
let r = ue(e, t);
|
|
57
57
|
r && n.appendChild(r);
|
|
58
58
|
}), n;
|
|
59
|
-
},
|
|
59
|
+
}, de = (e, t, n) => {
|
|
60
60
|
let r = e, i = t;
|
|
61
61
|
for (; i && i !== n && n.contains(i);) {
|
|
62
62
|
let e = W(i);
|
|
63
63
|
e.appendChild(r), r = e, i = i.parentElement;
|
|
64
64
|
}
|
|
65
65
|
return r;
|
|
66
|
-
},
|
|
66
|
+
}, fe = (e, t) => {
|
|
67
67
|
let n = e.commonAncestorContainer, r = n instanceof Element ? n : n.parentElement;
|
|
68
68
|
if (!r) return null;
|
|
69
|
-
let i =
|
|
70
|
-
return i ?
|
|
71
|
-
},
|
|
69
|
+
let i = ue(r, e);
|
|
70
|
+
return i ? de(i, r.parentElement, t) : null;
|
|
71
|
+
}, pe = (e) => {
|
|
72
72
|
let t = window.getSelection();
|
|
73
73
|
if (!t || t.isCollapsed || t.rangeCount === 0 || !e.clipboardData) return;
|
|
74
74
|
let n = t.toString();
|
|
75
75
|
if (!n) return;
|
|
76
76
|
let r = document.createElement("div");
|
|
77
77
|
for (let n = 0; n < t.rangeCount; n++) {
|
|
78
|
-
let i =
|
|
78
|
+
let i = fe(t.getRangeAt(n), e.currentTarget);
|
|
79
79
|
i && r.appendChild(i);
|
|
80
80
|
}
|
|
81
81
|
e.clipboardData.setData("text/html", r.innerHTML), e.clipboardData.setData("text/plain", n), e.preventDefault();
|
|
82
|
-
},
|
|
83
|
-
let { tooltips:
|
|
84
|
-
|
|
82
|
+
}, G = { activeRating: "_activeRating_ygoee_1" }, K = 2e3, me = ({ role: e = a.User, onEdit: n, onEditHover: r, onDelete: o, onRegenerate: c, onCopy: l, onCopyMarkdown: u, onLike: f, onDislike: p, activeRating: m, isAlwaysVisible: h, leadingContent: b, trailingContent: x, isDisabled: w = !1, className: T, labels: ee, colors: O }) => {
|
|
83
|
+
let { tooltips: k, ariaLabels: j } = ee ?? {}, [M, N] = A(null), [B, V] = A(""), H = te(void 0);
|
|
84
|
+
D(() => () => clearTimeout(H.current), []);
|
|
85
|
+
let U = E(() => {
|
|
86
|
+
clearTimeout(H.current), H.current = setTimeout(() => N(null), K);
|
|
87
|
+
}, []), se = n != null || o != null || c != null || l != null || u != null || f != null || p != null || b != null || x != null, ce = s({ "--ma-active-rating-text": O?.activeRatingText }), W = E(() => {
|
|
88
|
+
l?.(), N("copy"), V(e === a.User ? j?.copiedMessageStatus ?? "Message copied to clipboard" : j?.copiedStatus ?? "Copied to clipboard"), U();
|
|
85
89
|
}, [
|
|
86
|
-
|
|
90
|
+
l,
|
|
87
91
|
e,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
j?.copiedStatus,
|
|
93
|
+
j?.copiedMessageStatus,
|
|
94
|
+
U
|
|
95
|
+
]), le = E(() => {
|
|
96
|
+
u?.(), N("markdown"), V(j?.copiedMarkdownStatus ?? "Copied as Markdown to clipboard"), U();
|
|
97
|
+
}, [
|
|
98
|
+
u,
|
|
99
|
+
j?.copiedMarkdownStatus,
|
|
100
|
+
U
|
|
101
|
+
]);
|
|
102
|
+
return se ? /* @__PURE__ */ z("div", {
|
|
94
103
|
role: "toolbar",
|
|
95
|
-
"aria-label":
|
|
96
|
-
style:
|
|
97
|
-
className:
|
|
98
|
-
children: [
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
u && /* @__PURE__ */ I(t, {
|
|
105
|
-
iconSize: p.SM,
|
|
106
|
-
onClick: H,
|
|
107
|
-
size: h.Small,
|
|
108
|
-
isCopied: D === "copy",
|
|
109
|
-
copyLabel: w?.copyMessage ?? "Copy message",
|
|
110
|
-
copiedLabel: w?.copied ?? "Copied!",
|
|
111
|
-
ariaLabel: E?.copyMessage ?? "Copy message",
|
|
112
|
-
isDisabled: x
|
|
104
|
+
"aria-label": j?.actionsGroup ?? "Message actions",
|
|
105
|
+
style: ce,
|
|
106
|
+
className: d("flex items-center gap-1", !h && "opacity-0 group-hover:opacity-100", T),
|
|
107
|
+
children: [
|
|
108
|
+
b,
|
|
109
|
+
/* @__PURE__ */ R(S, {
|
|
110
|
+
visuallyHidden: !0,
|
|
111
|
+
as: C.Span,
|
|
112
|
+
children: B
|
|
113
113
|
}),
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
114
|
+
e === a.User ? /* @__PURE__ */ z(L, { children: [
|
|
115
|
+
l && /* @__PURE__ */ R(t, {
|
|
116
|
+
iconSize: g.SM,
|
|
117
|
+
onClick: W,
|
|
118
|
+
size: v.Small,
|
|
119
|
+
isCopied: M === "copy",
|
|
120
|
+
copyLabel: k?.copyMessage ?? "Copy message",
|
|
121
|
+
copiedLabel: k?.copied ?? "Copied!",
|
|
122
|
+
ariaLabel: j?.copyMessage ?? "Copy message",
|
|
123
|
+
isDisabled: w
|
|
119
124
|
}),
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
125
|
+
n && /* @__PURE__ */ R(y, {
|
|
126
|
+
icon: /* @__PURE__ */ R(P, {
|
|
127
|
+
size: g.SM,
|
|
128
|
+
"aria-hidden": !0,
|
|
129
|
+
stroke: _
|
|
130
|
+
}),
|
|
131
|
+
size: v.Small,
|
|
132
|
+
"aria-label": j?.editMessage ?? "Edit message",
|
|
133
|
+
tooltipProps: { tooltip: k?.edit ?? "Edit" },
|
|
134
|
+
onClick: n,
|
|
135
|
+
onMouseEnter: r,
|
|
136
|
+
onFocus: r,
|
|
137
|
+
disabled: w
|
|
133
138
|
}),
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
139
|
+
o && /* @__PURE__ */ R(y, {
|
|
140
|
+
icon: /* @__PURE__ */ R(I, {
|
|
141
|
+
size: g.SM,
|
|
142
|
+
"aria-hidden": !0,
|
|
143
|
+
stroke: _
|
|
144
|
+
}),
|
|
145
|
+
size: v.Small,
|
|
146
|
+
"aria-label": j?.deleteMessage ?? "Delete message",
|
|
147
|
+
tooltipProps: { tooltip: k?.delete ?? "Delete" },
|
|
148
|
+
onClick: o,
|
|
149
|
+
disabled: w
|
|
150
|
+
})
|
|
151
|
+
] }) : /* @__PURE__ */ z(L, { children: [
|
|
152
|
+
c && /* @__PURE__ */ R(y, {
|
|
153
|
+
icon: /* @__PURE__ */ R(F, {
|
|
154
|
+
size: g.SM,
|
|
155
|
+
"aria-hidden": !0,
|
|
156
|
+
stroke: _
|
|
157
|
+
}),
|
|
158
|
+
size: v.Small,
|
|
159
|
+
"aria-label": j?.regenerateResponse ?? "Regenerate response",
|
|
160
|
+
tooltipProps: { tooltip: k?.regenerate ?? "Regenerate" },
|
|
161
|
+
onClick: c,
|
|
162
|
+
disabled: w
|
|
146
163
|
}),
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
size: h.Small,
|
|
157
|
-
isCopied: D === "copy",
|
|
158
|
-
copyLabel: w?.copy ?? "Copy",
|
|
159
|
-
copiedLabel: w?.copied ?? "Copied!",
|
|
160
|
-
ariaLabel: E?.copyResponse ?? "Copy response",
|
|
161
|
-
isDisabled: x
|
|
162
|
-
}),
|
|
163
|
-
d && /* @__PURE__ */ I(t, {
|
|
164
|
-
iconSize: p.SM,
|
|
165
|
-
onClick: U,
|
|
166
|
-
size: h.Small,
|
|
167
|
-
isCopied: D === "markdown",
|
|
168
|
-
iconCopy: /* @__PURE__ */ I(k, {
|
|
169
|
-
size: p.SM,
|
|
170
|
-
"aria-hidden": !0,
|
|
171
|
-
stroke: m
|
|
164
|
+
l && /* @__PURE__ */ R(t, {
|
|
165
|
+
iconSize: g.SM,
|
|
166
|
+
onClick: W,
|
|
167
|
+
size: v.Small,
|
|
168
|
+
isCopied: M === "copy",
|
|
169
|
+
copyLabel: k?.copy ?? "Copy",
|
|
170
|
+
copiedLabel: k?.copied ?? "Copied!",
|
|
171
|
+
ariaLabel: j?.copyResponse ?? "Copy response",
|
|
172
|
+
isDisabled: w
|
|
172
173
|
}),
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
"
|
|
186
|
-
|
|
174
|
+
u && /* @__PURE__ */ R(t, {
|
|
175
|
+
iconSize: g.SM,
|
|
176
|
+
onClick: le,
|
|
177
|
+
size: v.Small,
|
|
178
|
+
isCopied: M === "markdown",
|
|
179
|
+
iconCopy: /* @__PURE__ */ R(ne, {
|
|
180
|
+
size: g.SM,
|
|
181
|
+
"aria-hidden": !0,
|
|
182
|
+
stroke: _
|
|
183
|
+
}),
|
|
184
|
+
copyLabel: k?.copyMarkdown ?? "Copy as Markdown",
|
|
185
|
+
copiedLabel: k?.copiedMarkdown ?? "Copied!",
|
|
186
|
+
ariaLabel: j?.copyAsMarkdown ?? "Copy as markdown",
|
|
187
|
+
isDisabled: w
|
|
187
188
|
}),
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
size:
|
|
199
|
-
"aria-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
189
|
+
f && /* @__PURE__ */ R(y, {
|
|
190
|
+
icon: m === i.Like ? /* @__PURE__ */ R(oe, {
|
|
191
|
+
className: G.activeRating,
|
|
192
|
+
size: g.SM,
|
|
193
|
+
"aria-hidden": !0
|
|
194
|
+
}) : /* @__PURE__ */ R(ae, {
|
|
195
|
+
size: g.SM,
|
|
196
|
+
"aria-hidden": !0,
|
|
197
|
+
stroke: _
|
|
198
|
+
}),
|
|
199
|
+
size: v.Small,
|
|
200
|
+
"aria-label": j?.likeResponse ?? "Like response",
|
|
201
|
+
"aria-pressed": m === i.Like,
|
|
202
|
+
tooltipProps: { tooltip: k?.like ?? "Like" },
|
|
203
|
+
onClick: f,
|
|
204
|
+
disabled: w
|
|
204
205
|
}),
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
206
|
+
p && /* @__PURE__ */ R(y, {
|
|
207
|
+
icon: m === i.Dislike ? /* @__PURE__ */ R(ie, {
|
|
208
|
+
className: G.activeRating,
|
|
209
|
+
size: g.SM,
|
|
210
|
+
"aria-hidden": !0
|
|
211
|
+
}) : /* @__PURE__ */ R(re, {
|
|
212
|
+
size: g.SM,
|
|
213
|
+
"aria-hidden": !0,
|
|
214
|
+
stroke: _
|
|
215
|
+
}),
|
|
216
|
+
size: v.Small,
|
|
217
|
+
"aria-label": j?.dislikeResponse ?? "Dislike response",
|
|
218
|
+
"aria-pressed": m === i.Dislike,
|
|
219
|
+
tooltipProps: { tooltip: k?.dislike ?? "Dislike" },
|
|
220
|
+
onClick: p,
|
|
221
|
+
disabled: w
|
|
222
|
+
})
|
|
223
|
+
] }),
|
|
224
|
+
x
|
|
225
|
+
]
|
|
213
226
|
}) : null;
|
|
214
|
-
},
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
+
}, q = (e) => {
|
|
228
|
+
let [t, n] = A(() => /* @__PURE__ */ new Date());
|
|
229
|
+
return D(() => {
|
|
230
|
+
let t = setInterval(() => n(/* @__PURE__ */ new Date()), e);
|
|
231
|
+
return () => clearInterval(t);
|
|
232
|
+
}, [e]), t;
|
|
233
|
+
}, J = /* @__PURE__ */ function(e) {
|
|
234
|
+
return e.Today = "today", e.Yesterday = "yesterday", e.Absolute = "absolute", e;
|
|
235
|
+
}({}), Y = {
|
|
236
|
+
hour: "numeric",
|
|
237
|
+
minute: "2-digit"
|
|
238
|
+
}, he = {
|
|
239
|
+
year: "numeric",
|
|
240
|
+
month: "short",
|
|
241
|
+
day: "numeric",
|
|
242
|
+
...Y
|
|
243
|
+
}, ge = 60, _e = 3600, X = 24 * _e, ve = [
|
|
244
|
+
["year", 365 * X],
|
|
245
|
+
["month", 30 * X],
|
|
246
|
+
["week", 7 * X],
|
|
247
|
+
["day", X],
|
|
248
|
+
["hour", _e],
|
|
249
|
+
["minute", ge]
|
|
250
|
+
], ye = (e, t) => e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate(), Z = (e) => {
|
|
251
|
+
if (!e) return null;
|
|
252
|
+
let t = new Date(e);
|
|
253
|
+
return Number.isNaN(t.getTime()) ? null : t;
|
|
254
|
+
}, be = (e, t) => new Intl.DateTimeFormat(t, he).format(e), xe = (e, t, n) => {
|
|
255
|
+
let r = new Date(t.getFullYear(), t.getMonth(), t.getDate() - 1);
|
|
256
|
+
return ye(e, t) ? {
|
|
257
|
+
kind: J.Today,
|
|
258
|
+
text: new Intl.DateTimeFormat(n, Y).format(e)
|
|
259
|
+
} : ye(e, r) ? {
|
|
260
|
+
kind: J.Yesterday,
|
|
261
|
+
text: new Intl.DateTimeFormat(n, Y).format(e)
|
|
262
|
+
} : {
|
|
263
|
+
kind: J.Absolute,
|
|
264
|
+
text: be(e, n)
|
|
265
|
+
};
|
|
266
|
+
}, Q = (e, t, n) => {
|
|
267
|
+
let r = new Intl.RelativeTimeFormat(n, { numeric: "auto" }), i = (t.getTime() - e.getTime()) / 1e3;
|
|
268
|
+
for (let [e, t] of ve) {
|
|
269
|
+
let n = Math.floor(i / t);
|
|
270
|
+
if (n >= 1) return r.format(-n, e);
|
|
271
|
+
}
|
|
272
|
+
return r.format(0, "second");
|
|
273
|
+
}, Se = { time: "_time_16pwx_2" }, Ce = 6e4, we = "opacity-0 transition-opacity group-hover/message:opacity-100 group-focus-within/message:opacity-100 [@media(hover:none)]:opacity-100", Te = ({ timestamp: e, locale: t, className: n = "dial-small-text" }) => {
|
|
274
|
+
let r = q(Ce), i = Z(e);
|
|
275
|
+
return i == null ? null : /* @__PURE__ */ R(T, {
|
|
276
|
+
tooltip: be(i, t),
|
|
277
|
+
asChild: !0,
|
|
278
|
+
children: /* @__PURE__ */ R("time", {
|
|
279
|
+
dateTime: e,
|
|
280
|
+
tabIndex: 0,
|
|
281
|
+
className: d("px-1 whitespace-nowrap", Se.time, n, we),
|
|
282
|
+
children: Q(i, r, t)
|
|
283
|
+
})
|
|
284
|
+
});
|
|
285
|
+
}, $ = {
|
|
286
|
+
userBubble: "_userBubble_17fln_1",
|
|
287
|
+
collapsibleText: "_collapsibleText_17fln_6",
|
|
288
|
+
expandedText: "_expandedText_17fln_11",
|
|
289
|
+
collapsedText: "_collapsedText_17fln_15",
|
|
290
|
+
startersDivider: "_startersDivider_17fln_31",
|
|
291
|
+
text: "_text_17fln_35"
|
|
292
|
+
}, Ee = "[&>.cm-bubble-markdown>div>*:first-child]:indent-[var(--cm-bubble-first-line-indent,0px)]", De = ({ text: t, contentRef: i, styles: c, actions: l, hasAlwaysVisibleActions: u, timestamp: f, locale: m, isStreaming: h, attachments: g, beforeContent: _, responseFormat: v, afterContent: y, hasThinkingPlaceholder: b = !0, starters: x, onSelectStarter: S, deploymentIconUrl: C, deploymentDisplayName: T, markdownComponents: E, markdownClassNames: D, markdownUrlTransform: ee, onAttachmentClick: O, onDownloadAll: te, isAttachmentDownloadable: A, onAttachmentRetry: j, codeBlockTheme: M, tableOnOpenInCanvas: N, labels: ne, selectedAttachmentId: P }) => {
|
|
293
|
+
let { colors: F, typography: re, className: ie, bubbleClassName: ae, timestampClassName: oe } = c ?? {}, I = f == null ? void 0 : /* @__PURE__ */ R(Te, {
|
|
294
|
+
timestamp: f,
|
|
295
|
+
locale: m,
|
|
296
|
+
className: oe
|
|
297
|
+
}), { attachmentClickLabel: B, attachmentDownloadLabel: H, attachmentRetryLabel: se, attachmentOpenInNewTabLabel: ce, startersAriaLabel: W = "Quick reply buttons", thinkingLabel: le, codeBlockCopyLabel: ue, codeBlockCopiedLabel: de, codeBlockDownloadLabel: fe, tableCopyLabel: G, tableCopiedLabel: K, tableDownloadCsvLabel: q, tableOpenInCanvasLabel: J, tableDownloadFilename: Y, tableScrollRegionAriaLabel: he, mathScrollRegionAriaLabel: ge, assistantMessageAriaLabel: _e = "Assistant message", deploymentIconFallbackLabel: X = "AI" } = ne ?? {}, ve = k(() => ({
|
|
298
|
+
copyLabel: G,
|
|
299
|
+
copiedLabel: K,
|
|
300
|
+
downloadCsvLabel: q,
|
|
301
|
+
openInCanvasLabel: J
|
|
227
302
|
}), [
|
|
303
|
+
G,
|
|
228
304
|
K,
|
|
229
305
|
q,
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
"--cm-
|
|
234
|
-
"--cm-
|
|
235
|
-
"--cm-bubble-first-line-indent":
|
|
236
|
-
}),
|
|
237
|
-
return /* @__PURE__ */
|
|
306
|
+
J
|
|
307
|
+
]), ye = h ? (g ?? []).filter((t) => t.type !== e.Audio) : g ?? [], Z = !!t?.trim(), { slotRef: be, firstLineIndent: xe } = U(_ != null && Z), Q = s({
|
|
308
|
+
"--cm-bubble-text": F?.text,
|
|
309
|
+
"--cm-starters-divider": F?.startersDivider,
|
|
310
|
+
"--cm-timestamp-text": F?.timestampText,
|
|
311
|
+
"--cm-bubble-first-line-indent": xe
|
|
312
|
+
}), Se = d($.text, re?.fontClassName), Ce = !!(C || T);
|
|
313
|
+
return /* @__PURE__ */ z("div", {
|
|
238
314
|
role: "group",
|
|
239
|
-
"aria-label":
|
|
240
|
-
style:
|
|
241
|
-
onCopy:
|
|
242
|
-
className:
|
|
243
|
-
children: [
|
|
244
|
-
src:
|
|
315
|
+
"aria-label": _e,
|
|
316
|
+
style: Q,
|
|
317
|
+
onCopy: pe,
|
|
318
|
+
className: d("group/message flex w-full items-start gap-3", ie),
|
|
319
|
+
children: [Ce && /* @__PURE__ */ R(n, {
|
|
320
|
+
src: C,
|
|
245
321
|
size: 28,
|
|
246
|
-
initialsName:
|
|
247
|
-
labels: { tooltip:
|
|
248
|
-
}), /* @__PURE__ */
|
|
249
|
-
className: "flex w-full
|
|
250
|
-
children: [/* @__PURE__ */
|
|
251
|
-
className:
|
|
322
|
+
initialsName: T || X,
|
|
323
|
+
labels: { tooltip: T ?? X }
|
|
324
|
+
}), /* @__PURE__ */ z("div", {
|
|
325
|
+
className: "flex w-full max-w-full min-w-0 flex-col items-start gap-5",
|
|
326
|
+
children: [/* @__PURE__ */ z("div", {
|
|
327
|
+
className: d("flex w-full max-w-full min-w-0 flex-col items-start gap-4", ae),
|
|
252
328
|
children: [
|
|
253
|
-
|
|
329
|
+
_ != null && !Z && /* @__PURE__ */ R("div", {
|
|
254
330
|
className: "min-w-0",
|
|
255
|
-
children:
|
|
331
|
+
children: _
|
|
256
332
|
}),
|
|
257
|
-
(
|
|
333
|
+
(Z || h && b) && /* @__PURE__ */ z("div", {
|
|
258
334
|
"aria-live": "polite",
|
|
259
335
|
"aria-atomic": "false",
|
|
260
|
-
className:
|
|
261
|
-
children: [
|
|
262
|
-
ref:
|
|
263
|
-
className: "absolute
|
|
264
|
-
children:
|
|
265
|
-
}), /* @__PURE__ */
|
|
336
|
+
className: d(Se, "relative max-w-full min-w-0 text-start", _ != null && Z && Ee, V.assistantContent),
|
|
337
|
+
children: [_ != null && Z && /* @__PURE__ */ R("div", {
|
|
338
|
+
ref: be,
|
|
339
|
+
className: "absolute inset-s-0 top-0",
|
|
340
|
+
children: _
|
|
341
|
+
}), /* @__PURE__ */ R("div", {
|
|
266
342
|
ref: i,
|
|
267
|
-
className: "cm-bubble-markdown min-w-0
|
|
268
|
-
children: /* @__PURE__ */
|
|
343
|
+
className: "cm-bubble-markdown max-w-full min-w-0 wrap-anywhere",
|
|
344
|
+
children: /* @__PURE__ */ R(r, {
|
|
269
345
|
content: t ?? "",
|
|
270
|
-
isPlainText:
|
|
271
|
-
isStreaming:
|
|
272
|
-
thinkingLabel:
|
|
273
|
-
components:
|
|
274
|
-
classNames:
|
|
275
|
-
urlTransform:
|
|
276
|
-
codeBlockCopyLabel:
|
|
277
|
-
codeBlockCopiedLabel:
|
|
278
|
-
codeBlockDownloadLabel:
|
|
279
|
-
codeBlockTheme:
|
|
280
|
-
tableActionLabels:
|
|
281
|
-
tableDownloadFilename:
|
|
282
|
-
tableOnOpenInCanvas:
|
|
283
|
-
tableScrollRegionAriaLabel:
|
|
284
|
-
mathScrollRegionAriaLabel:
|
|
346
|
+
isPlainText: v === o.PlainText,
|
|
347
|
+
isStreaming: h,
|
|
348
|
+
thinkingLabel: le,
|
|
349
|
+
components: E,
|
|
350
|
+
classNames: D,
|
|
351
|
+
urlTransform: ee,
|
|
352
|
+
codeBlockCopyLabel: ue,
|
|
353
|
+
codeBlockCopiedLabel: de,
|
|
354
|
+
codeBlockDownloadLabel: fe,
|
|
355
|
+
codeBlockTheme: M,
|
|
356
|
+
tableActionLabels: ve,
|
|
357
|
+
tableDownloadFilename: Y,
|
|
358
|
+
tableOnOpenInCanvas: N,
|
|
359
|
+
tableScrollRegionAriaLabel: he,
|
|
360
|
+
mathScrollRegionAriaLabel: ge
|
|
285
361
|
})
|
|
286
362
|
})]
|
|
287
363
|
}),
|
|
288
|
-
/* @__PURE__ */
|
|
289
|
-
attachments:
|
|
290
|
-
onAttachmentClick:
|
|
291
|
-
let t =
|
|
292
|
-
t &&
|
|
364
|
+
/* @__PURE__ */ R(p, {
|
|
365
|
+
attachments: ye,
|
|
366
|
+
onAttachmentClick: O ? (e) => {
|
|
367
|
+
let t = g?.find((t) => t.id === e);
|
|
368
|
+
t && O(t);
|
|
293
369
|
} : void 0,
|
|
294
|
-
onDownloadAll:
|
|
295
|
-
|
|
370
|
+
onDownloadAll: te,
|
|
371
|
+
isAttachmentDownloadable: A,
|
|
372
|
+
onRetry: j,
|
|
296
373
|
labels: {
|
|
297
|
-
clickLabel:
|
|
298
|
-
downloadLabel:
|
|
299
|
-
retryLabel:
|
|
300
|
-
openInNewTabLabel:
|
|
374
|
+
clickLabel: B,
|
|
375
|
+
downloadLabel: H,
|
|
376
|
+
retryLabel: se,
|
|
377
|
+
openInNewTabLabel: ce
|
|
301
378
|
},
|
|
302
|
-
selectedAttachmentId:
|
|
379
|
+
selectedAttachmentId: P
|
|
303
380
|
}),
|
|
304
|
-
|
|
305
|
-
/* @__PURE__ */
|
|
306
|
-
...
|
|
307
|
-
isAlwaysVisible:
|
|
381
|
+
y,
|
|
382
|
+
/* @__PURE__ */ R(me, {
|
|
383
|
+
...l,
|
|
384
|
+
isAlwaysVisible: u,
|
|
385
|
+
trailingContent: I == null ? l?.trailingContent : /* @__PURE__ */ z(L, { children: [l?.trailingContent, I] }),
|
|
308
386
|
role: a.Assistant
|
|
309
387
|
})
|
|
310
388
|
]
|
|
311
|
-
}),
|
|
389
|
+
}), x && x.length > 0 && S && /* @__PURE__ */ R("div", {
|
|
312
390
|
role: "list",
|
|
313
391
|
"aria-label": W,
|
|
314
|
-
className:
|
|
315
|
-
children:
|
|
392
|
+
className: d("flex w-full flex-wrap gap-2 border-t pt-5", $.startersDivider),
|
|
393
|
+
children: x.map((e, t) => /* @__PURE__ */ R("div", {
|
|
316
394
|
role: "listitem",
|
|
317
395
|
className: "min-w-[40px]",
|
|
318
|
-
children: /* @__PURE__ */
|
|
396
|
+
children: /* @__PURE__ */ R(w, {
|
|
319
397
|
label: e.title,
|
|
320
398
|
className: "min-w-[40px]",
|
|
321
|
-
onClick: () =>
|
|
399
|
+
onClick: () => S(e)
|
|
322
400
|
})
|
|
323
401
|
}, t))
|
|
324
402
|
})]
|
|
325
403
|
})]
|
|
326
404
|
});
|
|
327
|
-
},
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
message: t,
|
|
333
|
-
textClassName: "flex-row flex-wrap gap-1"
|
|
334
|
-
})
|
|
335
|
-
}), Z = /* @__PURE__ */ function(e) {
|
|
405
|
+
}, Oe = ({ labels: { titleText: e = "Model switched.", bodyText: t } }) => /* @__PURE__ */ R(b, {
|
|
406
|
+
title: e,
|
|
407
|
+
message: t,
|
|
408
|
+
textClassName: "flex-row flex-wrap gap-1"
|
|
409
|
+
}), ke = /* @__PURE__ */ function(e) {
|
|
336
410
|
return e.Bottom = "Bottom", e.Top = "Top", e;
|
|
337
|
-
}({}),
|
|
338
|
-
let { colors:
|
|
411
|
+
}({}), Ae = 10, je = "[&>div>*:first-child]:mt-0 [&>div>*:last-child]:mb-0", Me = [], Ne = ({ text: e, contentRef: t, position: n = ke.Bottom, styles: i, actions: o, hasAlwaysVisibleActions: m, timestamp: h, locale: _, attachments: y, collapsedLineCount: b = Ae, labels: S, textSegments: C, onAttachmentClick: w, onDownloadAll: T, isAttachmentDownloadable: E, onAttachmentRetry: D, selectedAttachmentId: O, markdownClassNames: te, markdownUrlTransform: A, codeBlockTheme: j, tableOnOpenInCanvas: ne }) => {
|
|
412
|
+
let { colors: P, typography: F, className: re, bubbleClassName: ie, timestampClassName: ae } = i ?? {}, oe = h == null ? void 0 : /* @__PURE__ */ R(Te, {
|
|
413
|
+
timestamp: h,
|
|
414
|
+
locale: _,
|
|
415
|
+
className: ae
|
|
416
|
+
}), { showMoreLabel: I = "Show more", showLessLabel: B = "Show less", showMoreAriaLabel: H, showLessAriaLabel: U, attachmentClickLabel: se, attachmentDownloadLabel: ce, attachmentRetryLabel: W, attachmentOpenInNewTabLabel: le, userMessageAriaLabel: ue = "User message", codeBlockCopyLabel: de, codeBlockCopiedLabel: fe, codeBlockDownloadLabel: G, tableCopyLabel: K, tableCopiedLabel: q, tableDownloadCsvLabel: J, tableOpenInCanvasLabel: Y, tableDownloadFilename: he, tableScrollRegionAriaLabel: ge, mathScrollRegionAriaLabel: _e } = S ?? {}, X = k(() => ({
|
|
417
|
+
copyLabel: K,
|
|
418
|
+
copiedLabel: q,
|
|
419
|
+
downloadCsvLabel: J,
|
|
420
|
+
openInCanvasLabel: Y
|
|
421
|
+
}), [
|
|
422
|
+
K,
|
|
423
|
+
q,
|
|
424
|
+
J,
|
|
425
|
+
Y
|
|
426
|
+
]), { textRef: ve, isTextCollapsed: ye, isOverflowing: Z, collapsedMaxHeight: be, expandedMaxHeight: xe, isCollapsed: Q, toggleCollapsed: Se } = f({
|
|
339
427
|
text: e ?? "",
|
|
340
|
-
collapsedLineCount:
|
|
341
|
-
}),
|
|
342
|
-
"--cm-bubble-user-bg":
|
|
343
|
-
"--cm-bubble-user-border":
|
|
344
|
-
"--cm-bubble-fade-start":
|
|
345
|
-
"--cm-bubble-text":
|
|
346
|
-
"--cm-
|
|
347
|
-
"--cm-bubble-
|
|
348
|
-
|
|
349
|
-
|
|
428
|
+
collapsedLineCount: b
|
|
429
|
+
}), Ce = s({
|
|
430
|
+
"--cm-bubble-user-bg": P?.userBackground,
|
|
431
|
+
"--cm-bubble-user-border": P?.userBorder,
|
|
432
|
+
"--cm-bubble-fade-start": P?.fadeStart,
|
|
433
|
+
"--cm-bubble-text": P?.text,
|
|
434
|
+
"--cm-timestamp-text": P?.timestampText,
|
|
435
|
+
"--cm-bubble-collapsed-height": Z ? `${be}px` : void 0,
|
|
436
|
+
"--cm-bubble-expanded-height": Z ? `${xe}px` : void 0
|
|
437
|
+
}), we = n === ke.Top ? "rounded-ee-md rounded-se-2xl" : "rounded-se-md rounded-ee-2xl", Ee = d($.text, F?.fontClassName), { markdownSource: De, segmentRehypePlugins: Oe, segmentComponents: Ne } = k(() => {
|
|
438
|
+
if (C == null) return {
|
|
439
|
+
markdownSource: e ?? "",
|
|
440
|
+
segmentRehypePlugins: Me,
|
|
441
|
+
segmentComponents: void 0
|
|
442
|
+
};
|
|
443
|
+
let { source: t, inlineSegments: n } = c(C);
|
|
444
|
+
return {
|
|
445
|
+
markdownSource: t,
|
|
446
|
+
segmentRehypePlugins: [u(n)],
|
|
447
|
+
segmentComponents: l(n)
|
|
448
|
+
};
|
|
449
|
+
}, [e, C]), Pe = H ?? I, Fe = U ?? B, Ie = Q ? I : B, Le = Q ? Pe : Fe, Re = Q ? M : N, ze = ee();
|
|
450
|
+
return /* @__PURE__ */ R("div", {
|
|
350
451
|
role: "group",
|
|
351
|
-
"aria-label":
|
|
352
|
-
style:
|
|
353
|
-
onCopy:
|
|
354
|
-
className:
|
|
355
|
-
children: /* @__PURE__ */
|
|
356
|
-
className: "ms-auto flex w-fit
|
|
452
|
+
"aria-label": ue,
|
|
453
|
+
style: Ce,
|
|
454
|
+
onCopy: pe,
|
|
455
|
+
className: d("group/message flex w-full", re),
|
|
456
|
+
children: /* @__PURE__ */ z("div", {
|
|
457
|
+
className: "ms-auto flex w-fit max-w-full min-w-0 flex-col items-end gap-4",
|
|
357
458
|
children: [
|
|
358
|
-
/* @__PURE__ */
|
|
359
|
-
attachments:
|
|
360
|
-
onAttachmentClick:
|
|
361
|
-
let t =
|
|
362
|
-
t &&
|
|
459
|
+
/* @__PURE__ */ R(p, {
|
|
460
|
+
attachments: y ?? [],
|
|
461
|
+
onAttachmentClick: w ? (e) => {
|
|
462
|
+
let t = y?.find((t) => t.id === e);
|
|
463
|
+
t && w(t);
|
|
363
464
|
} : void 0,
|
|
364
|
-
onDownloadAll:
|
|
365
|
-
|
|
465
|
+
onDownloadAll: T,
|
|
466
|
+
isAttachmentDownloadable: E,
|
|
467
|
+
onRetry: D,
|
|
366
468
|
labels: {
|
|
367
|
-
clickLabel:
|
|
368
|
-
downloadLabel:
|
|
369
|
-
retryLabel:
|
|
370
|
-
openInNewTabLabel:
|
|
469
|
+
clickLabel: se,
|
|
470
|
+
downloadLabel: ce,
|
|
471
|
+
retryLabel: W,
|
|
472
|
+
openInNewTabLabel: le
|
|
371
473
|
},
|
|
372
474
|
styles: { className: "max-w-[640px]" },
|
|
373
|
-
selectedAttachmentId:
|
|
475
|
+
selectedAttachmentId: O
|
|
374
476
|
}),
|
|
375
|
-
e && /* @__PURE__ */
|
|
376
|
-
className:
|
|
377
|
-
children: /* @__PURE__ */
|
|
477
|
+
e && /* @__PURE__ */ R("div", {
|
|
478
|
+
className: d($.userBubble, "flex w-fit max-w-full min-w-0 items-center justify-end rounded-ss-2xl rounded-es-2xl border px-6 py-4 wrap-anywhere", we, ie, V.userBubble),
|
|
479
|
+
children: /* @__PURE__ */ z("div", {
|
|
378
480
|
className: "flex min-w-0 flex-col items-start",
|
|
379
|
-
children: [/* @__PURE__ */
|
|
380
|
-
id:
|
|
481
|
+
children: [/* @__PURE__ */ R("div", {
|
|
482
|
+
id: ze,
|
|
381
483
|
ref: t,
|
|
382
|
-
className:
|
|
383
|
-
children: /* @__PURE__ */
|
|
384
|
-
ref:
|
|
385
|
-
className:
|
|
386
|
-
children:
|
|
484
|
+
className: d("relative -ms-1 -me-1 w-[calc(100%+8px)] overflow-hidden ps-1 pe-1", Z && $.collapsibleText, Z && !Q && $.expandedText, ye && $.collapsedText),
|
|
485
|
+
children: /* @__PURE__ */ R("div", {
|
|
486
|
+
ref: ve,
|
|
487
|
+
className: d(Ee, "max-w-full min-w-0 text-start", je),
|
|
488
|
+
children: /* @__PURE__ */ R(r, {
|
|
489
|
+
content: De,
|
|
490
|
+
isRawHtmlEnabled: !1,
|
|
491
|
+
rehypePlugins: Oe,
|
|
492
|
+
components: Ne,
|
|
493
|
+
classNames: te,
|
|
494
|
+
urlTransform: A,
|
|
495
|
+
codeBlockCopyLabel: de,
|
|
496
|
+
codeBlockCopiedLabel: fe,
|
|
497
|
+
codeBlockDownloadLabel: G,
|
|
498
|
+
codeBlockTheme: j,
|
|
499
|
+
tableActionLabels: X,
|
|
500
|
+
tableDownloadFilename: he,
|
|
501
|
+
tableOnOpenInCanvas: ne,
|
|
502
|
+
tableScrollRegionAriaLabel: ge,
|
|
503
|
+
mathScrollRegionAriaLabel: _e
|
|
504
|
+
})
|
|
387
505
|
})
|
|
388
|
-
}),
|
|
389
|
-
label: /* @__PURE__ */
|
|
390
|
-
iconBefore: /* @__PURE__ */
|
|
391
|
-
size:
|
|
506
|
+
}), Z && /* @__PURE__ */ R(x, {
|
|
507
|
+
label: /* @__PURE__ */ R(L, { children: Ie }),
|
|
508
|
+
iconBefore: /* @__PURE__ */ R(Re, {
|
|
509
|
+
size: g.SM,
|
|
392
510
|
"aria-hidden": "true"
|
|
393
511
|
}),
|
|
394
|
-
"aria-label":
|
|
395
|
-
"aria-expanded": !
|
|
396
|
-
"aria-controls":
|
|
512
|
+
"aria-label": Le,
|
|
513
|
+
"aria-expanded": !Q,
|
|
514
|
+
"aria-controls": ze,
|
|
397
515
|
className: "mt-3",
|
|
398
|
-
onClick:
|
|
399
|
-
size:
|
|
516
|
+
onClick: Se,
|
|
517
|
+
size: v.Small
|
|
400
518
|
})]
|
|
401
519
|
})
|
|
402
520
|
}),
|
|
403
|
-
/* @__PURE__ */
|
|
404
|
-
...
|
|
405
|
-
isAlwaysVisible:
|
|
521
|
+
/* @__PURE__ */ R(me, {
|
|
522
|
+
...o,
|
|
523
|
+
isAlwaysVisible: m,
|
|
524
|
+
leadingContent: oe == null ? o?.leadingContent : /* @__PURE__ */ z(L, { children: [oe, o?.leadingContent] }),
|
|
406
525
|
role: a.User
|
|
407
526
|
})
|
|
408
527
|
]
|
|
409
528
|
})
|
|
410
529
|
});
|
|
411
|
-
},
|
|
530
|
+
}, Pe = ({ role: e, beforeContent: t, textSegments: n, onAttachmentClick: r, responseFormat: i, markdownComponents: o, markdownUrlTransform: s, ...c }) => e === a.Status ? /* @__PURE__ */ R(Oe, { labels: {
|
|
412
531
|
titleText: c.labels?.statusTitleText,
|
|
413
532
|
bodyText: c.labels?.statusBodyText ?? ""
|
|
414
|
-
} }) : e === a.User ? /* @__PURE__ */
|
|
533
|
+
} }) : e === a.User ? /* @__PURE__ */ R(Ne, {
|
|
415
534
|
...c,
|
|
416
535
|
textSegments: n,
|
|
536
|
+
markdownUrlTransform: s,
|
|
417
537
|
onAttachmentClick: r
|
|
418
|
-
}) : /* @__PURE__ */
|
|
538
|
+
}) : /* @__PURE__ */ R(De, {
|
|
419
539
|
...c,
|
|
420
540
|
beforeContent: t,
|
|
421
541
|
responseFormat: i,
|
|
422
542
|
markdownComponents: o,
|
|
423
543
|
markdownUrlTransform: s,
|
|
424
544
|
onAttachmentClick: r
|
|
425
|
-
}),
|
|
426
|
-
let { colors:
|
|
427
|
-
"--cm-reply-background":
|
|
428
|
-
"--cm-reply-hover-background":
|
|
429
|
-
"--cm-reply-text":
|
|
430
|
-
}), [b, x] =
|
|
545
|
+
}), Fe = { button: "_button_tqo4d_3" }, Ie = ({ rect: e, actionRef: t, onReply: n, addedRevision: r, labels: i, styles: a, portalContainer: o }) => {
|
|
546
|
+
let { colors: c, typography: l, className: u, buttonClassName: f } = a ?? {}, p = l?.fontClassName ?? "dial-small-text", g = o === void 0 ? typeof document > "u" ? null : document.body : o, y = s({
|
|
547
|
+
"--cm-reply-background": c?.background,
|
|
548
|
+
"--cm-reply-hover-background": c?.hoverBackground,
|
|
549
|
+
"--cm-reply-text": c?.text
|
|
550
|
+
}), [b, x] = A({
|
|
431
551
|
x: 0,
|
|
432
552
|
y: 0
|
|
433
553
|
});
|
|
434
|
-
return
|
|
554
|
+
return O(() => {
|
|
435
555
|
if (!e || !t.current) return;
|
|
436
556
|
let n = t.current.getBoundingClientRect(), r = window.visualViewport, i = r?.offsetLeft ?? 0, a = r?.offsetTop ?? 0, o = r?.width ?? document.documentElement.clientWidth, s = r?.height ?? document.documentElement.clientHeight, c = e.top - n.height - 8 >= a + 8 ? e.top - n.height - 8 : e.bottom + 8;
|
|
437
557
|
x({
|
|
@@ -441,38 +561,46 @@ var z = {
|
|
|
441
561
|
}, [
|
|
442
562
|
e,
|
|
443
563
|
t,
|
|
444
|
-
v,
|
|
445
|
-
p,
|
|
446
564
|
g,
|
|
447
|
-
|
|
565
|
+
u,
|
|
566
|
+
f,
|
|
567
|
+
p,
|
|
448
568
|
i.reply
|
|
449
|
-
]),
|
|
569
|
+
]), g ? B(/* @__PURE__ */ z(L, { children: [e && /* @__PURE__ */ R("div", {
|
|
450
570
|
ref: t,
|
|
451
|
-
className:
|
|
571
|
+
className: d("fixed top-0 left-0 z-50 max-w-[calc(100vw-16px)]", u),
|
|
452
572
|
style: {
|
|
453
573
|
...y,
|
|
454
574
|
transform: `translate(${b.x}px, ${b.y}px)`
|
|
455
575
|
},
|
|
456
|
-
children: /* @__PURE__ */
|
|
457
|
-
variant:
|
|
458
|
-
size:
|
|
576
|
+
children: /* @__PURE__ */ R(m, {
|
|
577
|
+
variant: h.Neutral,
|
|
578
|
+
size: v.Small,
|
|
459
579
|
label: i.reply,
|
|
460
580
|
onClick: n,
|
|
461
|
-
textClassName:
|
|
462
|
-
className:
|
|
463
|
-
iconAfter: /* @__PURE__ */
|
|
581
|
+
textClassName: p,
|
|
582
|
+
className: d(Fe.button, "h-8 min-h-8 min-w-11 px-2 shadow-lg mobile:h-11 mobile:min-h-11", f),
|
|
583
|
+
iconAfter: /* @__PURE__ */ R(j, {
|
|
464
584
|
size: 16,
|
|
465
|
-
stroke:
|
|
585
|
+
stroke: _,
|
|
466
586
|
"aria-hidden": "true",
|
|
467
587
|
className: "rtl:scale-x-[-1]"
|
|
468
588
|
})
|
|
469
589
|
})
|
|
470
|
-
}), /* @__PURE__ */
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
590
|
+
}), /* @__PURE__ */ R(S, {
|
|
591
|
+
visuallyHidden: !0,
|
|
592
|
+
children: e ? i.selectionAvailable : r > 0 ? /* @__PURE__ */ R("span", { children: i.attachmentAdded }, r) : null
|
|
593
|
+
})] }), g) : null;
|
|
594
|
+
}, Le = { label: "_label_1nohb_1" }, Re = (e) => `Today ${e}`, ze = (e) => `Yesterday ${e}`, Be = ({ timestamp: e, locale: t, labels: n, className: r = "dial-small-text", colors: i }) => {
|
|
595
|
+
let a = Z(e);
|
|
596
|
+
if (a == null) return null;
|
|
597
|
+
let { kind: o, text: c } = xe(a, /* @__PURE__ */ new Date(), t), l = c;
|
|
598
|
+
return o === J.Today ? l = (n?.today ?? Re)(c) : o === J.Yesterday && (l = (n?.yesterday ?? ze)(c)), /* @__PURE__ */ R("time", {
|
|
599
|
+
dateTime: e,
|
|
600
|
+
className: d("self-center text-center", Le.label, r),
|
|
601
|
+
style: s({ "--cst-text": i?.text }),
|
|
602
|
+
children: l
|
|
603
|
+
});
|
|
476
604
|
};
|
|
477
605
|
//#endregion
|
|
478
|
-
export {
|
|
606
|
+
export { De as AssistantMessageBubble, ke as BubblePosition, V as CONVERSATION_MESSAGES_CLASS, Be as ConversationStartTimestamp, me as MessageActions, Pe as MessageBubble, Ie as MessageSelectionReply, Oe as StatusMessageBubble, Ne as UserMessageBubble };
|