@epam/ai-dial-conversation-messages 1.3.0-dev.98 → 1.3.0-rc.0

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