@epam/ai-dial-conversation-messages 1.1.0-dev.294 → 1.1.0-dev.297

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