@epam/ai-dial-conversation-stages 1.3.0-rc.0 → 1.4.0-dev.5

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 +373 -378
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -1,15 +1,15 @@
1
- import { AttachmentErrorReason as e, AttachmentType as t, MIME_TYPE_EXT_MAP as n, MarkdownCodeBlock as r, MarkdownRenderer as i, RequestStatus as a, StageStatus as o, buildCssVars as s, mergeClasses as c, messageAttachmentsToDisplayAttachments as l, normalizeMimeType as u, useIsVerticallyClamped as d } from "@epam/ai-dial-chat-shared";
2
- import { Accordion as f, DIAL_ICON_SIZE as p, DIAL_KIT_ICON_STROKE as m, DialItemType as h, ElementSize as g, EllipsisTooltip as ee, FileIcon as _, Highlight as v, LiveRegion as y, LiveRegionElement as b, Skeleton as x, SkeletonVariant as S, Spinner as te, StaticIconButton as C, Tooltip as w } from "@epam/ai-dial-ui-kit";
3
- import { IconAlertCircle as T, IconCheck as E, IconClipboard as D, IconDownload as O, IconExternalLink as k, IconFile as A, IconFileTypeBmp as j, IconFileTypeCss as M, IconFileTypeCsv as N, IconFileTypeDoc as P, IconFileTypeDocx as ne, IconFileTypeHtml as F, IconFileTypeJpg as I, IconFileTypeJs as L, IconFileTypeJsx as R, IconFileTypePdf as z, IconFileTypePhp as B, IconFileTypePng as V, IconFileTypePpt as H, IconFileTypeRs as re, IconFileTypeSql as ie, IconFileTypeSvg as ae, IconFileTypeTs as oe, IconFileTypeTsx as se, IconFileTypeTxt as U, IconFileTypeVue as W, IconFileTypeXls as ce, IconFileTypeXml as le, IconFileTypeZip as ue, IconMusic as G, IconPhoto as de, IconReload as fe, IconTerminal2 as pe, IconVideo as me, IconX as he } from "@tabler/icons-react";
4
- import { memo as ge, useCallback as K, useEffect as _e, useId as ve, useMemo as q, useRef as ye, useState as be } from "react";
5
- import { Fragment as xe, jsx as J, jsxs as Y } from "react/jsx-runtime";
1
+ import { AttachmentErrorReason as e, AttachmentType as t, MIMEType as n, MIME_TYPE_EXT_MAP as r, MarkdownCodeBlock as i, MarkdownRenderer as a, RequestStatus as o, StageStatus as s, buildCssVars as c, mergeClasses as l, messageAttachmentsToDisplayAttachments as u, normalizeMimeType as d, useIsVerticallyClamped as f } from "@epam/ai-dial-chat-shared";
2
+ import { Accordion as p, DIAL_ICON_SIZE as m, DIAL_KIT_ICON_STROKE as h, DialItemType as g, ElementSize as _, EllipsisTooltip as v, FileIcon as y, Highlight as b, LiveRegion as x, LiveRegionElement as S, Skeleton as C, SkeletonVariant as ee, Spinner as w, StaticIconButton as T, Tooltip as E } from "@epam/ai-dial-ui-kit";
3
+ import { IconAlertCircle as D, IconCheck as O, IconClipboard as k, IconDownload as A, IconExternalLink as j, IconFile as M, IconFileTypeBmp as N, IconFileTypeCss as P, IconFileTypeCsv as F, IconFileTypeDoc as te, IconFileTypeDocx as I, IconFileTypeHtml as L, IconFileTypeJpg as R, IconFileTypeJs as z, IconFileTypeJsx as B, IconFileTypePdf as V, IconFileTypePhp as H, IconFileTypePng as U, IconFileTypePpt as ne, IconFileTypeRs as re, IconFileTypeSql as ie, IconFileTypeSvg as ae, IconFileTypeTs as oe, IconFileTypeTsx as se, IconFileTypeTxt as W, IconFileTypeVue as ce, IconFileTypeXls as le, IconFileTypeXml as ue, IconFileTypeZip as G, IconMusic as de, IconPhoto as fe, IconReload as pe, IconTerminal2 as me, IconVideo as he, IconX as ge } from "@tabler/icons-react";
4
+ import { memo as _e, useCallback as K, useEffect as ve, useId as ye, useMemo as q, useRef as be, useState as xe } from "react";
5
+ import { Fragment as Se, jsx as J, jsxs as Y } from "react/jsx-runtime";
6
6
  //#region src/constants/public-class-names.ts
7
- var Se = {
7
+ var Ce = {
8
8
  panel: "dial-conversation-stages-panel",
9
9
  group: "dial-conversation-stages-group",
10
10
  groupToggle: "dial-conversation-stages-group-toggle"
11
- }, Ce = () => {
12
- let [e, t] = be(() => /* @__PURE__ */ new Set()), n = K((e, n) => {
11
+ }, we = () => {
12
+ let [e, t] = xe(() => /* @__PURE__ */ new Set()), n = K((e, n) => {
13
13
  t((t) => {
14
14
  if (t.has(e) === n) return t;
15
15
  let r = new Set(t);
@@ -27,30 +27,30 @@ var Se = {
27
27
  n,
28
28
  r
29
29
  ]);
30
- }, we = /[([][^()[\]]*[)\]]/g, Te = /(\d+(?:\.\d+)?)\s*s\b/, Ee = (e) => {
30
+ }, Te = /[([][^()[\]]*[)\]]/g, Ee = /(\d+(?:\.\d+)?)\s*s\b/, De = (e) => {
31
31
  let t = e.trimEnd();
32
32
  return t.endsWith(":") ? t.slice(0, -1) : t;
33
- }, De = (e) => {
34
- we.lastIndex = 0;
33
+ }, Oe = (e) => {
34
+ Te.lastIndex = 0;
35
35
  let t;
36
- for (; t = we.exec(e);) {
37
- let e = t[0].slice(1, -1), n = Te.exec(e);
36
+ for (; t = Te.exec(e);) {
37
+ let e = t[0].slice(1, -1), n = Ee.exec(e);
38
38
  if (n) return {
39
39
  durationLabel: `${n[1]}s`,
40
40
  groupIndex: t.index,
41
41
  groupLength: t[0].length
42
42
  };
43
43
  }
44
- }, Oe = (e) => {
45
- let t = e ?? "", n = De(t);
44
+ }, ke = (e) => {
45
+ let t = e ?? "", n = Oe(t);
46
46
  return {
47
- name: Ee(n ? t.slice(0, n.groupIndex) + t.slice(n.groupIndex + n.groupLength) : t).trim().replace(/ {2,}/g, " "),
47
+ name: De(n ? t.slice(0, n.groupIndex) + t.slice(n.groupIndex + n.groupLength) : t).trim().replace(/ {2,}/g, " "),
48
48
  durationLabel: n?.durationLabel
49
49
  };
50
- }, ke = (e) => e.length > 0 && !/\s/.test(e) && e.includes("_"), Ae = (e) => [...e].reverse().find((e) => e.status == null), je = (e, t) => {
50
+ }, Ae = (e) => e.length > 0 && !/\s/.test(e) && e.includes("_"), je = (e) => [...e].reverse().find((e) => e.status == null), Me = (e, t) => {
51
51
  let n = e.parent_stage_index;
52
52
  if (!(n == null || !Number.isInteger(n) || n < 0 || n >= e.index)) return t.get(n);
53
- }, Me = (e) => {
53
+ }, Ne = (e) => {
54
54
  let t = e.map((e) => ({
55
55
  stage: e,
56
56
  children: []
@@ -58,15 +58,15 @@ var Se = {
58
58
  for (let e of t) n.has(e.stage.index) || n.set(e.stage.index, e);
59
59
  let r = [];
60
60
  for (let e of t) {
61
- let t = je(e.stage, n);
61
+ let t = Me(e.stage, n);
62
62
  t ? t.children.push(e) : r.push(e);
63
63
  }
64
64
  return r;
65
- }, Ne = (e) => `stage:${e}`, Pe = (e) => `group:${e}`, Fe = "min-w-0 overflow-visible py-0", Ie = "min-w-0 justify-start gap-2 rounded-lg px-2 py-1.5 text-start mobile:min-h-11", Le = (e) => {
65
+ }, Pe = (e) => `stage:${e}`, Fe = (e) => `group:${e}`, Ie = "min-w-0 overflow-visible py-0", Le = "min-w-0 justify-start gap-2 rounded-lg px-2 py-1.5 text-start mobile:min-h-11", Re = (e) => {
66
66
  let t = [], n = 0;
67
67
  for (; n < e.length;) {
68
- let r = e[n], i = Oe(r.stage.name).name, a = n + 1;
69
- for (; a < e.length && Oe(e[a].stage.name).name === i;) a += 1;
68
+ let r = e[n], i = ke(r.stage.name).name, a = n + 1;
69
+ for (; a < e.length && ke(e[a].stage.name).name === i;) a += 1;
70
70
  let o = e.slice(n, a);
71
71
  o.length > 1 ? t.push({
72
72
  key: r.stage.index,
@@ -97,102 +97,97 @@ var Se = {
97
97
  codeInline: "_codeInline_msss2_76",
98
98
  blockquote: "_blockquote_msss2_82",
99
99
  tableCell: "_tableCell_msss2_87"
100
- }, Re = ({ status: e, isLive: t, runningLabel: n = "Running", failedLabel: r = "Failed" }) => e === o.Failed ? /* @__PURE__ */ Y(xe, { children: [/* @__PURE__ */ J(T, {
101
- size: p.MD,
100
+ }, ze = ({ status: e, isLive: t, runningLabel: n = "Running", failedLabel: r = "Failed" }) => e === s.Failed ? /* @__PURE__ */ Y(Se, { children: [/* @__PURE__ */ J(D, {
101
+ size: m.MD,
102
102
  className: X.iconError,
103
103
  "aria-hidden": !0,
104
- stroke: m
104
+ stroke: h
105
105
  }), /* @__PURE__ */ J("span", {
106
106
  className: "sr-only",
107
107
  children: r
108
- })] }) : e === o.Completed ? /* @__PURE__ */ J(E, {
109
- size: p.SM,
108
+ })] }) : e === s.Completed ? /* @__PURE__ */ J(O, {
109
+ size: m.SM,
110
110
  className: X.iconCompleted,
111
111
  "aria-hidden": !0,
112
- stroke: m
113
- }) : t ? /* @__PURE__ */ J(te, {
112
+ stroke: h
113
+ }) : t ? /* @__PURE__ */ J(w, {
114
114
  size: 16,
115
115
  ariaLabel: n
116
- }) : null, ze = (e) => {
116
+ }) : null, Be = (e) => {
117
117
  if (e == null) return "";
118
118
  let t = e.lastIndexOf(".");
119
119
  return t > 0 ? e.slice(0, t) : e;
120
- }, Be = (e) => {
121
- if (!e) return A;
122
- let t = u(e);
123
- if (t.startsWith("image/")) switch (t) {
124
- case "image/jpeg": return I;
125
- case "image/png": return V;
126
- case "image/svg+xml": return ae;
127
- case "image/bmp": return j;
128
- default: return de;
129
- }
130
- if (t.startsWith("video/")) return me;
131
- if (t.startsWith("audio/")) return G;
132
- switch (t) {
133
- case "application/pdf": return z;
134
- case "application/msword": return P;
135
- case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return ne;
136
- case "application/vnd.ms-powerpoint": return H;
137
- case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return H;
138
- case "application/vnd.ms-excel": return ce;
139
- case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return ce;
140
- case "application/zip":
141
- case "application/vnd.rar":
142
- case "application/x-7z-compressed":
143
- case "application/gzip":
144
- case "application/x-tar": return ue;
145
- case "text/csv": return N;
146
- case "text/plain": return U;
147
- case "text/html":
148
- case "application/xhtml+xml": return F;
149
- case "application/xml": return le;
150
- case "application/sql": return ie;
151
- case "text/javascript": return L;
152
- case "text/jsx": return R;
153
- case "text/typescript": return oe;
154
- case "text/tsx": return se;
155
- case "text/css": return M;
156
- case "text/x-php": return B;
157
- case "text/x-rustsrc": return re;
158
- case "text/x-vue": return W;
159
- default: return A;
160
- }
161
- }, Ve = (e) => {
120
+ }, Ve = () => ({
121
+ [n.JPEG]: R,
122
+ [n.PNG]: U,
123
+ [n.SVG]: ae,
124
+ [n.BMP]: N
125
+ }), He = () => ({
126
+ [n.PDF]: V,
127
+ [n.DOC]: te,
128
+ [n.DOCX]: I,
129
+ [n.PPT]: ne,
130
+ [n.PPTX]: ne,
131
+ [n.XLS]: le,
132
+ [n.XLSX]: le,
133
+ [n.ZIP]: G,
134
+ [n.RAR]: G,
135
+ [n.SevenZip]: G,
136
+ [n.GZIP]: G,
137
+ [n.TAR]: G,
138
+ [n.CSV]: F,
139
+ [n.Plain]: W,
140
+ [n.HTML]: L,
141
+ [n.XHTML]: L,
142
+ [n.XML]: ue,
143
+ [n.SQL]: ie,
144
+ [n.JavaScript]: z,
145
+ [n.JSX]: B,
146
+ [n.TypeScript]: oe,
147
+ [n.TSX]: se,
148
+ [n.CSS]: P,
149
+ [n.PHP]: H,
150
+ [n.Rust]: re,
151
+ [n.Vue]: ce
152
+ }), Ue, We, Ge = (e) => {
153
+ if (!e) return M;
154
+ let t = d(e);
155
+ return t.startsWith("image/") ? (Ue ??= Ve(), Ue[t] ?? fe) : t.startsWith("video/") ? he : t.startsWith("audio/") ? de : (We ??= He(), We[t] ?? M);
156
+ }, Ke = (e) => {
162
157
  let { type: n, contentType: r } = e;
163
- return n === t.Prompt ? pe : n === t.Pasted ? D : n === t.Image ? de : Be(r ?? "");
164
- }, He = (e) => {
165
- let t = u(e), r = n[t];
166
- if (r) return r;
158
+ return n === t.Prompt ? me : n === t.Pasted ? k : n === t.Image ? fe : Ge(r ?? "");
159
+ }, qe = (e) => {
160
+ let t = d(e), n = r[t];
161
+ if (n) return n;
167
162
  let i = t.split("/")[1];
168
163
  if (i && !i.startsWith("vnd.") && !i.includes("+")) return i;
169
- }, Ue = (e) => {
164
+ }, Je = (e) => {
170
165
  let { name: t, contentType: n } = e;
171
166
  if (n) {
172
- let e = He(n);
167
+ let e = qe(n);
173
168
  if (e) return e;
174
169
  }
175
170
  if (t == null) return;
176
171
  let r = t.lastIndexOf(".");
177
172
  if (r > 0 && r < t.length - 1) return t.slice(r + 1).toLowerCase();
178
- }, We = (e) => e.type !== t.Prompt && e.type !== t.Pasted, Ge = (e, n) => {
173
+ }, Ye = (e) => e.type !== t.Prompt && e.type !== t.Pasted, Xe = (e, n) => {
179
174
  let { type: r, name: i } = e;
180
175
  if (r === t.Prompt) return n.promptLabel ?? "Prompt";
181
176
  if (r === t.Pasted) return n.pastedLabel ?? "Pasted";
182
177
  if (r === t.Image) return n.imageLabel ?? "Image";
183
- let a = Ue(e);
178
+ let a = Je(e);
184
179
  return a ? `.${a}` : i ?? "";
185
- }, Ke = (e, n = {}) => {
186
- let { type: r, status: i, previewUrl: o, url: s } = e, c = i === a.Loading, l = i === a.Error, u = r === t.Image && !!(o ?? s) && !l, d = r === t.Link && !l;
180
+ }, Ze = (e, n = {}) => {
181
+ let { type: r, status: i, previewUrl: a, url: s } = e, c = i === o.Loading, l = i === o.Error, u = r === t.Image && !!(a ?? s) && !l, d = r === t.Link && !l;
187
182
  return {
188
183
  isLoading: c,
189
184
  isError: l,
190
185
  isImage: u,
191
186
  isLink: d,
192
- BottomIcon: d ? null : Ve(e),
193
- typeLabel: d ? null : Ge(e, n)
187
+ BottomIcon: d ? null : Ke(e),
188
+ typeLabel: d ? null : Xe(e, n)
194
189
  };
195
- }, qe = "flex size-[100px] items-center justify-center rounded-xl border", Je = "outline-offset-1 focus-visible:outline-1", Z = {
190
+ }, Qe = "flex size-[100px] items-center justify-center rounded-xl border", $e = "outline-offset-1 focus-visible:outline-1", Z = {
196
191
  tray: "dial-ai-attachment-tray",
197
192
  trayItem: "dial-ai-attachment-tray-item",
198
193
  tile: "dial-ai-attachment-tile",
@@ -215,162 +210,162 @@ var Se = {
215
210
  imageActionButton: "_imageActionButton_hb2mo_87",
216
211
  tileAction: "_tileAction_hb2mo_99",
217
212
  proxyFocus: "_proxyFocus_hb2mo_108"
218
- }, Ye = ({ ariaLabel: e, errorTitle: t, errorDescId: n, onClick: r, id: i, icon: a, className: o, isAlwaysVisible: s }) => /* @__PURE__ */ J(C, {
213
+ }, et = ({ ariaLabel: e, errorTitle: t, errorDescId: n, onClick: r, id: i, icon: a, className: o, isAlwaysVisible: s }) => /* @__PURE__ */ J(T, {
219
214
  icon: a,
220
- size: g.Small,
221
- className: c(s ? "opacity-100" : "opacity-0 group-hover/attachment-tile:opacity-100 group-focus-visible/attachment-tile:opacity-100 group-has-focus-visible/attachment-tile:opacity-100", Q.actionButton, o, Z.tileAction),
215
+ size: _.Small,
216
+ className: l(s ? "opacity-100" : "opacity-0 group-hover/attachment-tile:opacity-100 group-focus-visible/attachment-tile:opacity-100 group-has-focus-visible/attachment-tile:opacity-100", Q.actionButton, o, Z.tileAction),
222
217
  "aria-label": e,
223
218
  "aria-describedby": t ? n : void 0,
224
219
  onClick: (e) => {
225
220
  e.stopPropagation(), r(i);
226
221
  }
227
- }), Xe = ({ ...e }) => /* @__PURE__ */ J(Ye, {
228
- icon: /* @__PURE__ */ J(fe, {
229
- size: p.SM,
222
+ }), tt = ({ ...e }) => /* @__PURE__ */ J(et, {
223
+ icon: /* @__PURE__ */ J(pe, {
224
+ size: m.SM,
230
225
  "aria-hidden": !0,
231
- stroke: m
226
+ stroke: h
232
227
  }),
233
228
  className: Q.retryIcon,
234
229
  ...e
235
- }), Ze = ({ ...e }) => /* @__PURE__ */ J(Ye, {
236
- icon: /* @__PURE__ */ J(O, {
237
- size: p.SM,
230
+ }), nt = ({ ...e }) => /* @__PURE__ */ J(et, {
231
+ icon: /* @__PURE__ */ J(A, {
232
+ size: m.SM,
238
233
  "aria-hidden": !0,
239
- stroke: m
234
+ stroke: h
240
235
  }),
241
236
  ...e
242
- }), Qe = ({ ...e }) => /* @__PURE__ */ J(Ye, {
243
- icon: /* @__PURE__ */ J(k, {
244
- size: p.SM,
237
+ }), rt = ({ ...e }) => /* @__PURE__ */ J(et, {
238
+ icon: /* @__PURE__ */ J(j, {
239
+ size: m.SM,
245
240
  "aria-hidden": !0,
246
- stroke: m
241
+ stroke: h
247
242
  }),
248
243
  ...e
249
- }), $e = ({ className: e, ...t }) => /* @__PURE__ */ J(Ye, {
250
- icon: /* @__PURE__ */ J(he, {
251
- size: p.SM,
244
+ }), it = ({ className: e, ...t }) => /* @__PURE__ */ J(et, {
245
+ icon: /* @__PURE__ */ J(ge, {
246
+ size: m.SM,
252
247
  "aria-hidden": !0,
253
- stroke: m
248
+ stroke: h
254
249
  }),
255
- className: c("mobile:opacity-100", e),
250
+ className: l("mobile:opacity-100", e),
256
251
  ...t
257
- }), et = {
252
+ }), at = {
258
253
  [e.Network]: "Upload failed · network error",
259
254
  [e.UnsupportedType]: "Upload failed · unsupported file type",
260
255
  [e.FileTooLarge]: "Upload failed · file too large"
261
- }, tt = ({ attachment: t, searchQuery: n = "", onClick: r, onRetry: i, labels: o, styles: s, onDownload: l, isLink: u, cssVars: f, onExpand: g, isExpandable: ee, onRemove: x, isSelected: S }) => {
262
- let { clickLabel: C = "Download attachment", expandLabel: T = "Expand pasted text", downloadLabel: E = "Download attachment", retryLabel: D = "Retry upload", removeLabel: O = "Remove attachment", openInNewTabLabel: k = "Open in new tab", sizeLabel: A, uploadingLabel: j = "Uploading", errorReasonLabels: M, genericErrorLabel: N = "Upload failed" } = o ?? {}, { typography: P, className: ne } = s ?? {}, { id: F, name: I, status: L, errorReason: R } = t, z = L === a.Loading, B = L === a.Error, V = ve(), H = B ? R && (M?.[R] ?? et[R]) || N : "", { BottomIcon: re, typeLabel: ie } = Ke(t), ae = We(t), oe = !B && !z && l && !u, se = B && !!i && R !== e.UnsupportedType && R !== e.FileTooLarge, U = !!ee && g !== void 0, W = U || r !== void 0, ce = Number(!!oe) + Number(!!se) + Number(!!u) + Number(!!x), le = !W && ce === 1, ue = () => {
263
- U ? g(F) : r?.(F);
264
- }, G = q(() => ze(I), [I]), { ref: de, isClamped: fe } = d(G), pe = K(() => {
256
+ }, ot = ({ attachment: t, searchQuery: n = "", onClick: r, onRetry: i, labels: a, styles: s, onDownload: c, isLink: u, cssVars: d, onExpand: p, isExpandable: _, onRemove: v, isSelected: C }) => {
257
+ let { clickLabel: ee = "Download attachment", expandLabel: T = "Expand pasted text", downloadLabel: D = "Download attachment", retryLabel: O = "Retry upload", removeLabel: k = "Remove attachment", openInNewTabLabel: A = "Open in new tab", sizeLabel: j, uploadingLabel: M = "Uploading", errorReasonLabels: N, genericErrorLabel: P = "Upload failed" } = a ?? {}, { typography: F, className: te } = s ?? {}, { id: I, name: L, status: R, errorReason: z } = t, B = R === o.Loading, V = R === o.Error, H = ye(), U = V ? z && (N?.[z] ?? at[z]) || P : "", { BottomIcon: ne, typeLabel: re } = Ze(t), ie = Ye(t), ae = !V && !B && c && !u, oe = V && !!i && z !== e.UnsupportedType && z !== e.FileTooLarge, se = !!_ && p !== void 0, W = se || r !== void 0, ce = Number(!!ae) + Number(!!oe) + Number(!!u) + Number(!!v), le = !W && ce === 1, ue = () => {
258
+ se ? p(I) : r?.(I);
259
+ }, G = q(() => Be(L), [L]), { ref: de, isClamped: fe } = f(G), pe = K(() => {
265
260
  window.open(t.referenceUrl, "_blank", "noopener,noreferrer");
266
- }, [t]), me = c(qe, "group/attachment-tile relative flex-col justify-between items-start gap-2 overflow-hidden p-3", Q.tile, W && !B && !z && Q.hovered, z && Q.loading, S && Q.selected, B && Q.tileError, le && Q.proxyFocus, Z.tile, S && Z.tileSelected), he = /* @__PURE__ */ J("div", {
261
+ }, [t]), me = l(Qe, "group/attachment-tile relative flex-col justify-between items-start gap-2 overflow-hidden p-3", Q.tile, W && !V && !B && Q.hovered, B && Q.loading, C && Q.selected, V && Q.tileError, le && Q.proxyFocus, Z.tile, C && Z.tileSelected), he = /* @__PURE__ */ J("div", {
267
262
  ref: de,
268
263
  title: G,
269
- className: c(P?.nameClassName ?? "dial-tiny-text", "line-clamp-2 w-full min-w-0 wrap-break-word", Q.nameText, Z.tileName),
270
- children: n ? /* @__PURE__ */ J(v, {
264
+ className: l(F?.nameClassName ?? "dial-tiny-text", "line-clamp-2 w-full min-w-0 wrap-break-word", Q.nameText, Z.tileName),
265
+ children: n ? /* @__PURE__ */ J(b, {
271
266
  text: G,
272
267
  query: n,
273
268
  maxLines: 2
274
269
  }) : G
275
- }), ge = re && /* @__PURE__ */ Y("div", {
276
- className: c("flex w-full items-end gap-1", Z.tileType),
277
- children: [ae ? /* @__PURE__ */ J(_, {
278
- type: h.File,
279
- name: I ?? "",
280
- fileExtension: Ue(t),
281
- size: p.MD,
270
+ }), ge = ne && /* @__PURE__ */ Y("div", {
271
+ className: l("flex w-full items-end gap-1", Z.tileType),
272
+ children: [ie ? /* @__PURE__ */ J(y, {
273
+ type: g.File,
274
+ name: L ?? "",
275
+ fileExtension: Je(t),
276
+ size: m.MD,
282
277
  decorative: !0
283
- }) : /* @__PURE__ */ J(re, {
284
- size: p.MD,
278
+ }) : /* @__PURE__ */ J(ne, {
279
+ size: m.MD,
285
280
  className: Q.typeText,
286
- stroke: m,
281
+ stroke: h,
287
282
  "aria-hidden": !0
288
283
  }), /* @__PURE__ */ J("span", {
289
- className: c(P?.metaClassName ?? "dial-tiny-text", "min-w-0 flex-1 truncate", Q.typeText),
290
- children: A ? `${ie} · ${A}` : ie
284
+ className: l(F?.metaClassName ?? "dial-tiny-text", "min-w-0 flex-1 truncate", Q.typeText),
285
+ children: j ? `${re} · ${j}` : re
291
286
  })]
292
- }), _e = /* @__PURE__ */ Y(xe, { children: [
287
+ }), _e = /* @__PURE__ */ Y(Se, { children: [
293
288
  he,
294
289
  ge,
295
- W && /* @__PURE__ */ J(w, {
296
- tooltip: I,
290
+ W && /* @__PURE__ */ J(E, {
291
+ tooltip: L,
297
292
  hideTooltip: !fe,
298
293
  triggerClassName: "absolute inset-0",
299
294
  children: /* @__PURE__ */ J("button", {
300
295
  type: "button",
301
- "aria-label": U ? T : C,
302
- "aria-pressed": !U && r !== void 0 ? S : void 0,
296
+ "aria-label": se ? T : ee,
297
+ "aria-pressed": !se && r !== void 0 ? C : void 0,
303
298
  onClick: ue,
304
- className: c("absolute inset-0 cursor-pointer rounded-[11px]", Q.tileAction)
299
+ className: l("absolute inset-0 cursor-pointer rounded-[11px]", Q.tileAction)
305
300
  })
306
301
  }),
307
- z && /* @__PURE__ */ J("div", {
302
+ B && /* @__PURE__ */ J("div", {
308
303
  role: "progressbar",
309
- "aria-label": j,
310
- className: c("absolute inset-0 flex items-center justify-center rounded-[11px]", Q.track),
304
+ "aria-label": M,
305
+ className: l("absolute inset-0 flex items-center justify-center rounded-[11px]", Q.track),
311
306
  children: /* @__PURE__ */ J("span", {
312
307
  "aria-hidden": !0,
313
308
  className: "flex",
314
- children: /* @__PURE__ */ J(te, { size: 32 })
309
+ children: /* @__PURE__ */ J(w, { size: 32 })
315
310
  })
316
311
  }),
317
312
  /* @__PURE__ */ Y("div", {
318
313
  className: "absolute inset-e-1 top-1 flex",
319
314
  children: [
320
- oe && /* @__PURE__ */ J(Ze, {
321
- ariaLabel: E,
322
- errorTitle: H,
323
- errorDescId: V,
324
- onClick: l,
325
- id: F
326
- }),
327
- se && /* @__PURE__ */ J(Xe, {
315
+ ae && /* @__PURE__ */ J(nt, {
328
316
  ariaLabel: D,
329
- errorTitle: H,
330
- errorDescId: V,
317
+ errorTitle: U,
318
+ errorDescId: H,
319
+ onClick: c,
320
+ id: I
321
+ }),
322
+ oe && /* @__PURE__ */ J(tt, {
323
+ ariaLabel: O,
324
+ errorTitle: U,
325
+ errorDescId: H,
331
326
  onClick: i,
332
- id: F
327
+ id: I
333
328
  }),
334
- u && /* @__PURE__ */ J(Qe, {
335
- ariaLabel: k,
336
- errorTitle: H,
337
- errorDescId: V,
329
+ u && /* @__PURE__ */ J(rt, {
330
+ ariaLabel: A,
331
+ errorTitle: U,
332
+ errorDescId: H,
338
333
  onClick: pe
339
334
  }),
340
- x && /* @__PURE__ */ J($e, {
341
- ariaLabel: O,
342
- errorTitle: H,
343
- errorDescId: V,
344
- onClick: x,
345
- id: F,
346
- isAlwaysVisible: z
335
+ v && /* @__PURE__ */ J(it, {
336
+ ariaLabel: k,
337
+ errorTitle: U,
338
+ errorDescId: H,
339
+ onClick: v,
340
+ id: I,
341
+ isAlwaysVisible: B
347
342
  })
348
343
  ]
349
344
  }),
350
- /* @__PURE__ */ J(y, {
351
- id: V,
345
+ /* @__PURE__ */ J(x, {
346
+ id: H,
352
347
  visuallyHidden: !0,
353
- as: b.Span,
354
- children: B ? H : ""
348
+ as: S.Span,
349
+ children: V ? U : ""
355
350
  })
356
351
  ] });
357
352
  return /* @__PURE__ */ J("div", {
358
- style: f,
359
- className: c("inline-flex", ne),
353
+ style: d,
354
+ className: l("inline-flex", te),
360
355
  children: /* @__PURE__ */ J("div", {
361
- "aria-busy": z,
362
- style: f,
363
- className: c(me, W && "cursor-pointer", Je),
356
+ "aria-busy": B,
357
+ style: d,
358
+ className: l(me, W && "cursor-pointer", $e),
364
359
  children: _e
365
360
  })
366
361
  });
367
- }, nt = /* @__PURE__ */ function(e) {
362
+ }, st = /* @__PURE__ */ function(e) {
368
363
  return e.Idle = "idle", e.Loading = "loading", e.Loaded = "loaded", e.Error = "error", e;
369
- }({}), rt = ({ enabled: e, src: t }) => {
370
- let n = ye(null), [r, i] = be("idle");
371
- return _e(() => {
364
+ }({}), ct = ({ enabled: e, src: t }) => {
365
+ let n = be(null), [r, i] = xe("idle");
366
+ return ve(() => {
372
367
  i(e && t ? "loading" : "idle");
373
- }, [e, t]), _e(() => {
368
+ }, [e, t]), ve(() => {
374
369
  let r = n.current;
375
370
  if (!r || !e || !t) return;
376
371
  let a = () => i("loaded"), o = () => i("error");
@@ -381,78 +376,78 @@ var Se = {
381
376
  imageRef: n,
382
377
  imageLoadStatus: r
383
378
  };
384
- }, it = ({ attachment: e, onExpand: n, onClick: r, labels: i, onRemove: a, cssVars: o, onDownload: s, styles: l, isSelected: u }) => {
385
- let { clickLabel: d = "Open attachment", expandLabel: f = "Expand pasted text", removeLabel: h = "Remove attachment", downloadLabel: g = "Download attachment", uploadingLabel: ee = "Uploading" } = i ?? {}, { className: _ } = l ?? {}, { id: v, name: y } = e, b = e.previewUrl ?? e.url, C = e.type === t.Pasted && n !== void 0, { isLoading: w, isError: T, isImage: E } = q(() => Ke(e), [e]), D = r !== void 0 && !C && !w && !T, O = C || D, k = !!s && !w, A = !O && Number(!!a) + Number(k) === 1, { imageRef: j, imageLoadStatus: M } = rt({
386
- enabled: E,
387
- src: b
388
- }), N = () => {
389
- C && n ? n(v) : D && r && r(v);
390
- }, P = c(qe, "group/attachment-tile", O && "cursor-pointer", Q.tile, u && Q.selected, w && Q.loading, A && Q.proxyFocus, Je, _, Z.tile, u && Z.tileSelected);
379
+ }, lt = ({ attachment: e, onExpand: n, onClick: r, labels: i, onRemove: a, cssVars: o, onDownload: s, styles: c, isSelected: u }) => {
380
+ let { clickLabel: d = "Open attachment", expandLabel: f = "Expand pasted text", removeLabel: p = "Remove attachment", downloadLabel: g = "Download attachment", uploadingLabel: _ = "Uploading" } = i ?? {}, { className: v } = c ?? {}, { id: y, name: b } = e, x = e.previewUrl ?? e.url, S = e.type === t.Pasted && n !== void 0, { isLoading: T, isError: E, isImage: D } = q(() => Ze(e), [e]), O = r !== void 0 && !S && !T && !E, k = S || O, A = !!s && !T, j = !k && Number(!!a) + Number(A) === 1, { imageRef: M, imageLoadStatus: N } = ct({
381
+ enabled: D,
382
+ src: x
383
+ }), P = () => {
384
+ S && n ? n(y) : O && r && r(y);
385
+ }, F = l(Qe, "group/attachment-tile", k && "cursor-pointer", Q.tile, u && Q.selected, T && Q.loading, j && Q.proxyFocus, $e, v, Z.tile, u && Z.tileSelected);
391
386
  return /* @__PURE__ */ J("div", {
392
- className: P,
393
- "aria-busy": w,
387
+ className: F,
388
+ "aria-busy": T,
394
389
  style: o,
395
390
  children: /* @__PURE__ */ Y("div", {
396
391
  className: "relative h-full w-full overflow-hidden",
397
392
  children: [
398
393
  /* @__PURE__ */ Y("div", {
399
394
  className: "absolute inset-e-1 top-1 z-10 flex",
400
- children: [a && /* @__PURE__ */ J($e, {
401
- ariaLabel: h,
395
+ children: [a && /* @__PURE__ */ J(it, {
396
+ ariaLabel: p,
402
397
  onClick: a,
403
- id: v,
398
+ id: y,
404
399
  className: Q.imageActionButton,
405
- isAlwaysVisible: w
406
- }), k && /* @__PURE__ */ J(Ze, {
400
+ isAlwaysVisible: T
401
+ }), A && /* @__PURE__ */ J(nt, {
407
402
  ariaLabel: g,
408
403
  onClick: s,
409
- id: v,
404
+ id: y,
410
405
  className: Q.imageActionButton
411
406
  })]
412
407
  }),
413
- M !== nt.Loaded && /* @__PURE__ */ J(x, {
414
- variant: S.Rectangular,
408
+ N !== st.Loaded && /* @__PURE__ */ J(C, {
409
+ variant: ee.Rectangular,
415
410
  width: "100%",
416
411
  height: "100%",
417
- active: M === nt.Loading,
418
- overlay: /* @__PURE__ */ J(de, {
419
- size: p.LG,
412
+ active: N === st.Loading,
413
+ overlay: /* @__PURE__ */ J(fe, {
414
+ size: m.LG,
420
415
  className: Q.placeholderIcon,
421
416
  "aria-hidden": !0,
422
- stroke: m
417
+ stroke: h
423
418
  }),
424
419
  className: "absolute inset-0 rounded-xl"
425
420
  }),
426
421
  /* @__PURE__ */ J("img", {
427
- ref: j,
428
- src: b,
429
- alt: y,
422
+ ref: M,
423
+ src: x,
424
+ alt: b,
430
425
  loading: "lazy",
431
426
  decoding: "async",
432
- className: c("h-full w-full rounded-xl object-cover transition-opacity duration-200", M === nt.Loaded ? "opacity-100" : "opacity-0")
427
+ className: l("h-full w-full rounded-xl object-cover transition-opacity duration-200", N === st.Loaded ? "opacity-100" : "opacity-0")
433
428
  }),
434
- O && /* @__PURE__ */ J("button", {
429
+ k && /* @__PURE__ */ J("button", {
435
430
  type: "button",
436
- "aria-label": C ? f : d,
437
- "aria-pressed": D ? u : void 0,
438
- onClick: N,
439
- className: c("absolute inset-0 cursor-pointer rounded-xl", Q.tileAction)
431
+ "aria-label": S ? f : d,
432
+ "aria-pressed": O ? u : void 0,
433
+ onClick: P,
434
+ className: l("absolute inset-0 cursor-pointer rounded-xl", Q.tileAction)
440
435
  }),
441
- w && /* @__PURE__ */ J("div", {
436
+ T && /* @__PURE__ */ J("div", {
442
437
  role: "progressbar",
443
- "aria-label": ee,
444
- className: c("absolute inset-0 flex items-center justify-center rounded-xl", Q.track),
438
+ "aria-label": _,
439
+ className: l("absolute inset-0 flex items-center justify-center rounded-xl", Q.track),
445
440
  children: /* @__PURE__ */ J("span", {
446
441
  "aria-hidden": !0,
447
442
  className: "flex",
448
- children: /* @__PURE__ */ J(te, { size: 32 })
443
+ children: /* @__PURE__ */ J(w, { size: 32 })
449
444
  })
450
445
  })
451
446
  ]
452
447
  })
453
448
  });
454
- }, at = ({ attachment: e, searchQuery: n = "", onRemove: r, onRetry: i, onExpand: a, onClick: o, onDownload: c, labels: l, styles: u, isSelected: d }) => {
455
- let { colors: f } = u ?? {}, p = e.type === t.Pasted && a !== void 0, m = s({
449
+ }, ut = ({ attachment: e, searchQuery: n = "", onRemove: r, onRetry: i, onExpand: a, onClick: o, onDownload: s, labels: l, styles: u, isSelected: d }) => {
450
+ let { colors: f } = u ?? {}, p = e.type === t.Pasted && a !== void 0, m = c({
456
451
  "--ai-tile-bg": f?.background,
457
452
  "--ai-tile-border": f?.border,
458
453
  "--ai-tile-bg-hover": f?.backgroundHover,
@@ -469,8 +464,8 @@ var Se = {
469
464
  "--ai-tile-hover-icon-bg": f?.hoverIconBackground,
470
465
  "--ai-tile-hover-icon-color": f?.hoverIconColor,
471
466
  "--ai-tile-progress-track": f?.trackBackground
472
- }), { isImage: h, isLink: g } = q(() => Ke(e), [e]);
473
- return h ? /* @__PURE__ */ J(it, {
467
+ }), { isImage: h, isLink: g } = q(() => Ze(e), [e]);
468
+ return h ? /* @__PURE__ */ J(lt, {
474
469
  attachment: e,
475
470
  labels: l,
476
471
  onClick: o,
@@ -478,15 +473,15 @@ var Se = {
478
473
  styles: u,
479
474
  onRemove: r,
480
475
  cssVars: m,
481
- onDownload: c,
476
+ onDownload: s,
482
477
  isSelected: d
483
- }) : /* @__PURE__ */ J(tt, {
478
+ }) : /* @__PURE__ */ J(ot, {
484
479
  attachment: e,
485
480
  searchQuery: n,
486
481
  onClick: o,
487
482
  onRetry: i,
488
483
  onRemove: r,
489
- onDownload: c,
484
+ onDownload: s,
490
485
  isLink: g,
491
486
  styles: u,
492
487
  labels: l,
@@ -495,8 +490,8 @@ var Se = {
495
490
  isExpandable: p,
496
491
  isSelected: d
497
492
  });
498
- }, ot = (e, t) => {
499
- let n = l(e, t);
493
+ }, dt = (e, t) => {
494
+ let n = u(e, t);
500
495
  if (!e?.length) return n;
501
496
  let r = /* @__PURE__ */ new Map();
502
497
  for (let t of e) {
@@ -510,27 +505,27 @@ var Se = {
510
505
  contentType: t
511
506
  } : e;
512
507
  });
513
- }, st = ({ children: e, codeClassName: t, blockClassName: n = "dial-code-text", copyAriaLabel: i, copiedLabel: a }) => {
508
+ }, ft = ({ children: e, codeClassName: t, blockClassName: n = "dial-code-text", copyAriaLabel: r, copiedLabel: a }) => {
514
509
  let o = t?.replace(/^language-/, "") ?? "";
515
- return /* @__PURE__ */ J(r, {
510
+ return /* @__PURE__ */ J(i, {
516
511
  language: o,
517
512
  value: typeof e == "string" ? e : String(e ?? ""),
518
513
  codeClassName: n,
519
- containerClassName: c(X.codeBlock, n),
520
- copyLabel: i,
514
+ containerClassName: l(X.codeBlock, n),
515
+ copyLabel: r,
521
516
  copiedLabel: a,
522
517
  hideDownload: !0
523
518
  });
524
- }, ct = ge(({ content: e, typography: t, copyAriaLabel: n = "Copy", copiedLabel: r, tableScrollRegionAriaLabel: a, mathScrollRegionAriaLabel: o, renderCitation: s }) => {
525
- let l = "mb-1.5 last:mb-0", u = c(t?.headingClassName ?? "dial-small-semi-text", X.stageContent, l), d = q(() => ({
526
- code: ({ children: e, className: i }) => i?.includes("language-") ? /* @__PURE__ */ J(st, {
519
+ }, pt = _e(({ content: e, typography: t, copyAriaLabel: n = "Copy", copiedLabel: r, tableScrollRegionAriaLabel: i, mathScrollRegionAriaLabel: o, renderCitation: s }) => {
520
+ let c = "mb-1.5 last:mb-0", u = l(t?.headingClassName ?? "dial-small-semi-text", X.stageContent, c), d = q(() => ({
521
+ code: ({ children: e, className: i }) => i?.includes("language-") ? /* @__PURE__ */ J(ft, {
527
522
  codeClassName: i,
528
523
  blockClassName: t?.codeBlockClassName,
529
524
  copyAriaLabel: n,
530
525
  copiedLabel: r,
531
526
  children: e
532
527
  }) : /* @__PURE__ */ J("code", {
533
- className: c("px-1 py-0.5", t?.codeClassName ?? "dial-tiny-code-text rounded-md", X.codeInline),
528
+ className: l("px-1 py-0.5", t?.codeClassName ?? "dial-tiny-code-text rounded-md", X.codeInline),
534
529
  children: e
535
530
  }),
536
531
  ...s != null && { cit: (e) => s(e["data-id"], e.children) }
@@ -541,9 +536,9 @@ var Se = {
541
536
  r,
542
537
  s
543
538
  ]);
544
- return /* @__PURE__ */ J(i, {
539
+ return /* @__PURE__ */ J(a, {
545
540
  content: e,
546
- tableScrollRegionAriaLabel: a,
541
+ tableScrollRegionAriaLabel: i,
547
542
  mathScrollRegionAriaLabel: o,
548
543
  classNames: {
549
544
  h1: u,
@@ -552,18 +547,18 @@ var Se = {
552
547
  h4: u,
553
548
  h5: u,
554
549
  h6: u,
555
- p: c(t?.contentClassName ?? "dial-tiny-text", X.stageContent, "mb-1.5"),
556
- ul: c(t?.contentClassName ?? "dial-tiny-text", X.stageContent, l),
557
- ol: c(t?.contentClassName ?? "dial-tiny-text", X.stageContent, l),
558
- strong: c(t?.strongClassName ?? t?.contentClassName ?? "dial-tiny-text", X.stageContent),
550
+ p: l(t?.contentClassName ?? "dial-tiny-text", X.stageContent, "mb-1.5"),
551
+ ul: l(t?.contentClassName ?? "dial-tiny-text", X.stageContent, c),
552
+ ol: l(t?.contentClassName ?? "dial-tiny-text", X.stageContent, c),
553
+ strong: l(t?.strongClassName ?? t?.contentClassName ?? "dial-tiny-text", X.stageContent),
559
554
  codeInline: X.codeInline,
560
- blockquote: c(t?.contentClassName ?? "dial-tiny-text", X.blockquote, l),
561
- link: c(t?.contentClassName ?? "dial-tiny-text", X.stageContent),
562
- tableCell: c(t?.contentClassName ?? "dial-tiny-text", X.tableCell)
555
+ blockquote: l(t?.contentClassName ?? "dial-tiny-text", X.blockquote, c),
556
+ link: l(t?.contentClassName ?? "dial-tiny-text", X.stageContent),
557
+ tableCell: l(t?.contentClassName ?? "dial-tiny-text", X.tableCell)
563
558
  },
564
559
  components: d
565
560
  });
566
- }), lt = ({ attachments: e, clickLabel: t, onAttachmentClick: n }) => {
561
+ }), mt = ({ attachments: e, clickLabel: t, onAttachmentClick: n }) => {
567
562
  let r = K((t) => {
568
563
  let r = e.find((e) => e.id === t);
569
564
  r && n?.(r);
@@ -573,75 +568,75 @@ var Se = {
573
568
  className: "flex flex-wrap gap-2",
574
569
  children: e.map((e) => /* @__PURE__ */ J("div", {
575
570
  role: "listitem",
576
- children: /* @__PURE__ */ J(at, {
571
+ children: /* @__PURE__ */ J(ut, {
577
572
  attachment: e,
578
573
  onClick: n && r,
579
574
  labels: { clickLabel: t }
580
575
  })
581
576
  }, e.id))
582
577
  });
583
- }, ut = ({ stage: e, isLive: t, typography: n, labels: r, nameOverride: i, onAttachmentClick: a, attachmentDisplayResolvers: s, renderCitation: l, childList: u, isExpanded: d, onToggle: p }) => {
584
- let [m, h] = be(!1), g = d ?? m, _ = K((e) => {
585
- d === void 0 && h(e), p?.(e);
586
- }, [d, p]), { copyAriaLabel: v = "Copy stage content", codeBlockCopiedLabel: y, tableScrollRegionAriaLabel: b, mathScrollRegionAriaLabel: x, runningAriaLabel: S, failedAriaLabel: te, attachmentClickLabel: C = "Preview search result" } = r ?? {}, w = q(() => ot(e.attachments, s), [e.attachments, s]), { name: T, durationLabel: E } = Oe(e.name), D = i ?? T, O = !i && ke(T), k = e.status === o.Failed, A = !!e.content || !!e.attachments?.length, j = A || u != null, M = /* @__PURE__ */ Y(xe, { children: [
578
+ }, ht = ({ stage: e, isLive: t, typography: n, labels: r, nameOverride: i, onAttachmentClick: a, attachmentDisplayResolvers: o, renderCitation: c, childList: u, isExpanded: d, onToggle: f }) => {
579
+ let [m, h] = xe(!1), g = d ?? m, _ = K((e) => {
580
+ d === void 0 && h(e), f?.(e);
581
+ }, [d, f]), { copyAriaLabel: y = "Copy stage content", codeBlockCopiedLabel: b, tableScrollRegionAriaLabel: x, mathScrollRegionAriaLabel: S, runningAriaLabel: C, failedAriaLabel: ee, attachmentClickLabel: w = "Preview search result" } = r ?? {}, T = q(() => dt(e.attachments, o), [e.attachments, o]), { name: E, durationLabel: D } = ke(e.name), O = i ?? E, k = !i && Ae(E), A = e.status === s.Failed, j = !!e.content || !!e.attachments?.length, M = j || u != null, N = /* @__PURE__ */ Y(Se, { children: [
587
582
  /* @__PURE__ */ J("span", {
588
583
  className: "flex flex-none items-center",
589
- children: /* @__PURE__ */ J(Re, {
584
+ children: /* @__PURE__ */ J(ze, {
590
585
  status: e.status,
591
586
  isLive: t,
592
- runningLabel: S,
593
- failedLabel: te
587
+ runningLabel: C,
588
+ failedLabel: ee
594
589
  })
595
590
  }),
596
591
  /* @__PURE__ */ J("span", {
597
- className: c("max-w-88 min-w-0 truncate", O ? n?.monoFontClassName ?? "dial-code-text" : n?.fontClassName ?? "dial-small-text", X.stageName, k && X.stageNameFailed),
598
- children: /* @__PURE__ */ J(ee, { text: D || e.status || "" })
592
+ className: l("max-w-88 min-w-0 truncate", k ? n?.monoFontClassName ?? "dial-code-text" : n?.fontClassName ?? "dial-small-text", X.stageName, A && X.stageNameFailed),
593
+ children: /* @__PURE__ */ J(v, { text: O || e.status || "" })
599
594
  }),
600
595
  e.tag && /* @__PURE__ */ J("span", {
601
- className: c("flex-none", n?.tagClassName ?? "dial-tiny-lead-text", X.tag),
596
+ className: l("flex-none", n?.tagClassName ?? "dial-tiny-lead-text", X.tag),
602
597
  children: e.tag
603
598
  }),
604
- E && /* @__PURE__ */ J("span", {
605
- className: c("flex-none", n?.countFontClassName ?? "dial-tiny-text", X.duration),
606
- children: E
599
+ D && /* @__PURE__ */ J("span", {
600
+ className: l("flex-none", n?.countFontClassName ?? "dial-tiny-text", X.duration),
601
+ children: D
607
602
  })
608
603
  ] });
609
- return j ? /* @__PURE__ */ Y(f, {
604
+ return M ? /* @__PURE__ */ Y(p, {
610
605
  expanded: g,
611
606
  onToggle: _,
612
607
  title: /* @__PURE__ */ J("span", {
613
608
  className: "flex min-w-0 items-center gap-2",
614
- children: M
609
+ children: N
615
610
  }),
616
- className: Fe,
617
- headerClassName: c(Ie, X.row, X.stageHeader),
618
- contentClassName: c("-mt-1 flex min-w-0 flex-col gap-3 px-0 py-1", X.stageRegion),
619
- children: [g && A && /* @__PURE__ */ Y("div", {
611
+ className: Ie,
612
+ headerClassName: l(Le, X.row, X.stageHeader),
613
+ contentClassName: l("-mt-1 flex min-w-0 flex-col gap-3 px-0 py-1", X.stageRegion),
614
+ children: [g && j && /* @__PURE__ */ Y("div", {
620
615
  className: "flex min-w-0 flex-col gap-3 ps-8",
621
616
  children: [e.content && /* @__PURE__ */ J("div", {
622
617
  className: "max-h-[300px] min-w-0 overflow-y-auto",
623
- children: /* @__PURE__ */ J(ct, {
618
+ children: /* @__PURE__ */ J(pt, {
624
619
  content: e.content,
625
620
  typography: n,
626
- copyAriaLabel: v,
627
- copiedLabel: y,
628
- tableScrollRegionAriaLabel: b,
629
- mathScrollRegionAriaLabel: x,
630
- renderCitation: l
621
+ copyAriaLabel: y,
622
+ copiedLabel: b,
623
+ tableScrollRegionAriaLabel: x,
624
+ mathScrollRegionAriaLabel: S,
625
+ renderCitation: c
631
626
  })
632
- }), w.length > 0 && /* @__PURE__ */ J(lt, {
633
- attachments: w,
634
- clickLabel: C,
627
+ }), T.length > 0 && /* @__PURE__ */ J(mt, {
628
+ attachments: T,
629
+ clickLabel: w,
635
630
  onAttachmentClick: a
636
631
  })]
637
632
  }), g && u]
638
633
  }) : /* @__PURE__ */ J("div", {
639
- className: c("flex w-full items-center gap-2 px-2 py-1.5", X.row),
640
- children: M
634
+ className: l("flex w-full items-center gap-2 px-2 py-1.5", X.row),
635
+ children: N
641
636
  });
642
- }, dt = (e) => e <= 3 ? "ps-4" : "ps-0", ft = (e) => e <= 3 ? "ps-6" : "ps-0", pt = ({ node: e, depth: t, nameOverride: n, isStreaming: r, expansion: i, typography: a, labels: o, onAttachmentClick: s, attachmentDisplayResolvers: c, renderCitation: l }) => {
643
- let u = Ne(e.stage.index), d = t + 1;
644
- return /* @__PURE__ */ J(ut, {
637
+ }, gt = (e) => e <= 3 ? "ps-4" : "ps-0", _t = (e) => e <= 3 ? "ps-6" : "ps-0", vt = ({ node: e, depth: t, nameOverride: n, isStreaming: r, expansion: i, typography: a, labels: o, onAttachmentClick: s, attachmentDisplayResolvers: c, renderCitation: l }) => {
638
+ let u = Pe(e.stage.index), d = t + 1;
639
+ return /* @__PURE__ */ J(ht, {
645
640
  stage: e.stage,
646
641
  nameOverride: n,
647
642
  isLive: r && e.stage.status == null,
@@ -652,10 +647,10 @@ var Se = {
652
647
  renderCitation: l,
653
648
  isExpanded: i.isExpanded(u),
654
649
  onToggle: (e) => i.onToggle(u, e),
655
- childList: e.children.length > 0 ? /* @__PURE__ */ J(ht, {
650
+ childList: e.children.length > 0 ? /* @__PURE__ */ J(bt, {
656
651
  nodes: e.children,
657
652
  depth: d,
658
- className: dt(d),
653
+ className: gt(d),
659
654
  isStreaming: r,
660
655
  expansion: i,
661
656
  typography: a,
@@ -665,77 +660,77 @@ var Se = {
665
660
  renderCitation: l
666
661
  }) : void 0
667
662
  });
668
- }, mt = ({ row: e, depth: t, isStreaming: n, expansion: r, typography: i, labels: a, onAttachmentClick: s, attachmentDisplayResolvers: l, renderCitation: u }) => {
669
- let { runningAriaLabel: d, failedAriaLabel: p, attemptLabel: m = (e) => `Attempt ${e}` } = a ?? {}, h = e.attempts ?? [], g = h.some((e) => e.stage.status == null), _ = h.some((e) => e.stage.status === o.Failed), v = o.Completed;
670
- g ? v = null : _ && (v = o.Failed);
671
- let y = Pe(e.key), b = r.isExpanded(y), x = t + 1, S = /* @__PURE__ */ Y("span", {
663
+ }, yt = ({ row: e, depth: t, isStreaming: n, expansion: r, typography: i, labels: a, onAttachmentClick: o, attachmentDisplayResolvers: c, renderCitation: u }) => {
664
+ let { runningAriaLabel: d, failedAriaLabel: f, attemptLabel: m = (e) => `Attempt ${e}` } = a ?? {}, h = e.attempts ?? [], g = h.some((e) => e.stage.status == null), _ = h.some((e) => e.stage.status === s.Failed), y = s.Completed;
665
+ g ? y = null : _ && (y = s.Failed);
666
+ let b = Fe(e.key), x = r.isExpanded(b), S = t + 1, C = /* @__PURE__ */ Y("span", {
672
667
  className: "flex min-w-0 items-center gap-2",
673
668
  children: [
674
669
  /* @__PURE__ */ J("span", {
675
670
  className: "flex flex-none items-center",
676
- children: /* @__PURE__ */ J(Re, {
677
- status: v,
671
+ children: /* @__PURE__ */ J(ze, {
672
+ status: y,
678
673
  isLive: n && g,
679
674
  runningLabel: d,
680
- failedLabel: p
675
+ failedLabel: f
681
676
  })
682
677
  }),
683
678
  /* @__PURE__ */ J("span", {
684
- className: c("max-w-88 min-w-0 truncate", i?.fontClassName ?? "dial-small-text", X.stageName, _ && X.stageNameFailed),
685
- children: /* @__PURE__ */ J(ee, { text: e.name })
679
+ className: l("max-w-88 min-w-0 truncate", i?.fontClassName ?? "dial-small-text", X.stageName, _ && X.stageNameFailed),
680
+ children: /* @__PURE__ */ J(v, { text: e.name })
686
681
  }),
687
682
  /* @__PURE__ */ Y("span", {
688
- className: c("flex-none", i?.countFontClassName ?? "dial-tiny-text", X.count),
683
+ className: l("flex-none", i?.countFontClassName ?? "dial-tiny-text", X.count),
689
684
  children: ["×", h.length]
690
685
  })
691
686
  ]
692
687
  });
693
- return /* @__PURE__ */ J(f, {
694
- title: S,
695
- expanded: b,
696
- onToggle: (e) => r.onToggle(y, e),
697
- className: Fe,
698
- headerClassName: c(Ie, X.collapseButton, X.row, X.stageHeader),
699
- contentClassName: c("-mt-2 min-w-0 px-0", ft(x), X.stageRegion),
688
+ return /* @__PURE__ */ J(p, {
689
+ title: C,
690
+ expanded: x,
691
+ onToggle: (e) => r.onToggle(b, e),
692
+ className: Ie,
693
+ headerClassName: l(Le, X.collapseButton, X.row, X.stageHeader),
694
+ contentClassName: l("-mt-2 min-w-0 px-0", _t(S), X.stageRegion),
700
695
  children: /* @__PURE__ */ J("ul", {
701
696
  role: "list",
702
697
  className: "flex min-w-0 flex-col gap-0.5",
703
- children: b && h.map((e, t) => /* @__PURE__ */ J("li", {
698
+ children: x && h.map((e, t) => /* @__PURE__ */ J("li", {
704
699
  role: "listitem",
705
700
  className: "min-w-0",
706
- children: /* @__PURE__ */ J(pt, {
701
+ children: /* @__PURE__ */ J(vt, {
707
702
  node: e,
708
- depth: x,
703
+ depth: S,
709
704
  nameOverride: m(t + 1),
710
705
  isStreaming: n,
711
706
  expansion: r,
712
707
  typography: i,
713
708
  labels: a,
714
- onAttachmentClick: s,
715
- attachmentDisplayResolvers: l,
709
+ onAttachmentClick: o,
710
+ attachmentDisplayResolvers: c,
716
711
  renderCitation: u
717
712
  })
718
713
  }, e.stage.index))
719
714
  })
720
715
  });
721
- }, ht = ({ nodes: e, depth: t, className: n, ...r }) => /* @__PURE__ */ J("ul", {
716
+ }, bt = ({ nodes: e, depth: t, className: n, ...r }) => /* @__PURE__ */ J("ul", {
722
717
  role: "list",
723
- className: c("flex min-w-0 flex-col gap-0.5", n),
724
- children: Le(e).map((e) => /* @__PURE__ */ J("li", {
718
+ className: l("flex min-w-0 flex-col gap-0.5", n),
719
+ children: Re(e).map((e) => /* @__PURE__ */ J("li", {
725
720
  role: "listitem",
726
721
  className: "min-w-0",
727
- children: e.node ? /* @__PURE__ */ J(pt, {
722
+ children: e.node ? /* @__PURE__ */ J(vt, {
728
723
  node: e.node,
729
724
  depth: t,
730
725
  ...r
731
- }) : /* @__PURE__ */ J(mt, {
726
+ }) : /* @__PURE__ */ J(yt, {
732
727
  row: e,
733
728
  depth: t,
734
729
  ...r
735
730
  })
736
731
  }, e.key))
737
- }), gt = ({ stages: e, isStreaming: t, className: n, styles: r, labels: i, onAttachmentClick: a, attachmentDisplayResolvers: o, renderCitation: l, expansion: u }) => {
738
- let { colors: d, typography: f } = r ?? {}, p = s({
732
+ }), xt = ({ stages: e, isStreaming: t, className: n, styles: r, labels: i, onAttachmentClick: a, attachmentDisplayResolvers: o, renderCitation: s, expansion: u }) => {
733
+ let { colors: d, typography: f } = r ?? {}, p = c({
739
734
  "--cs-text": d?.text,
740
735
  "--cs-row-hover": d?.rowHoverColor,
741
736
  "--cs-button-bg": d?.collapsedButtonBg,
@@ -751,11 +746,11 @@ var Se = {
751
746
  "--cs-code-border": d?.codeBorderColor,
752
747
  "--cs-code-text": d?.codeTextColor,
753
748
  "--cs-border": d?.borderColor
754
- }), m = q(() => Me(e), [e]);
749
+ }), m = q(() => Ne(e), [e]);
755
750
  return /* @__PURE__ */ J("div", {
756
751
  style: p,
757
- className: c("w-full min-w-0", X.panel, n, Se.panel),
758
- children: /* @__PURE__ */ J(ht, {
752
+ className: l("w-full min-w-0", X.panel, n, Ce.panel),
753
+ children: /* @__PURE__ */ J(bt, {
759
754
  nodes: m,
760
755
  depth: 0,
761
756
  className: "w-full ps-5",
@@ -765,12 +760,12 @@ var Se = {
765
760
  labels: i,
766
761
  onAttachmentClick: a,
767
762
  attachmentDisplayResolvers: o,
768
- renderCitation: l
763
+ renderCitation: s
769
764
  })
770
765
  });
771
- }, _t = (e) => {
772
- let t = Ce();
773
- return /* @__PURE__ */ J(gt, {
766
+ }, St = (e) => {
767
+ let t = we();
768
+ return /* @__PURE__ */ J(xt, {
774
769
  ...e,
775
770
  expansion: t
776
771
  });
@@ -781,145 +776,145 @@ var Se = {
781
776
  doneIcon: "_doneIcon_16fae_36",
782
777
  failedText: "_failedText_16fae_40",
783
778
  liveName: "_liveName_16fae_44"
784
- }, vt = ({ stages: e, isStreaming: t, labels: n, className: r, styles: i, onAttachmentClick: a, attachmentDisplayResolvers: l, renderCitation: u }) => {
785
- let { executedLabel: d = "Executed", stepsLabel: h = () => "steps", failedCountLabel: g = (e) => `${e} failed`, runningAriaLabel: _ = "Running", copyAriaLabel: v, codeBlockCopiedLabel: y, tableScrollRegionAriaLabel: b, mathScrollRegionAriaLabel: x, failedAriaLabel: S, attemptLabel: C, attachmentClickLabel: w } = n ?? {}, [T, D] = be(t), O = Ce(), { reset: k } = O, A = e.length > 1;
786
- _e(() => {
787
- A && !T && k();
779
+ }, Ct = ({ stages: e, isStreaming: t, labels: n, className: r, styles: i, onAttachmentClick: a, attachmentDisplayResolvers: o, renderCitation: u }) => {
780
+ let { executedLabel: d = "Executed", stepsLabel: f = () => "steps", failedCountLabel: g = (e) => `${e} failed`, runningAriaLabel: _ = "Running", copyAriaLabel: y, codeBlockCopiedLabel: b, tableScrollRegionAriaLabel: x, mathScrollRegionAriaLabel: S, failedAriaLabel: C, attemptLabel: ee, attachmentClickLabel: T } = n ?? {}, [E, D] = xe(t), k = we(), { reset: A } = k, j = e.length > 1;
781
+ ve(() => {
782
+ j && !E && A();
788
783
  }, [
789
- A,
790
- T,
791
- k
784
+ j,
785
+ E,
786
+ A
792
787
  ]);
793
- let j = ye(t);
794
- _e(() => {
795
- j.current && !t && D(!1), j.current = t;
788
+ let M = be(t);
789
+ ve(() => {
790
+ M.current && !t && D(!1), M.current = t;
796
791
  }, [t]);
797
- let { colors: M, panel: N } = i ?? {}, P = i?.typography ?? { fontClassName: "dial-small-text" }, ne = s({
798
- "--cs-cg-label": M?.labelColor,
799
- "--cs-cg-label-hover": M?.labelHoverColor,
800
- "--cs-cg-done": M?.doneColor,
801
- "--cs-cg-failed": M?.failedColor,
802
- "--cs-text": N?.text,
803
- "--cs-row-hover": N?.rowHoverColor,
804
- "--cs-button-bg": N?.collapsedButtonBg,
805
- "--cs-stage-text": N?.stageTextColor,
806
- "--cs-failed-text": N?.failedColor,
807
- "--cs-tag-text": N?.tagTextColor,
808
- "--cs-count-text": N?.countTextColor,
809
- "--cs-duration-text": N?.durationTextColor,
810
- "--cs-icon-secondary": N?.iconSecondaryColor,
811
- "--cs-icon-completed": N?.iconCompletedColor,
812
- "--cs-icon-error": N?.iconErrorColor,
813
- "--cs-code-bg": N?.codeBg,
814
- "--cs-code-border": N?.codeBorderColor,
815
- "--cs-code-text": N?.codeTextColor,
816
- "--cs-border": N?.borderColor
792
+ let { colors: N, panel: P } = i ?? {}, F = i?.typography ?? { fontClassName: "dial-small-text" }, te = c({
793
+ "--cs-cg-label": N?.labelColor,
794
+ "--cs-cg-label-hover": N?.labelHoverColor,
795
+ "--cs-cg-done": N?.doneColor,
796
+ "--cs-cg-failed": N?.failedColor,
797
+ "--cs-text": P?.text,
798
+ "--cs-row-hover": P?.rowHoverColor,
799
+ "--cs-button-bg": P?.collapsedButtonBg,
800
+ "--cs-stage-text": P?.stageTextColor,
801
+ "--cs-failed-text": P?.failedColor,
802
+ "--cs-tag-text": P?.tagTextColor,
803
+ "--cs-count-text": P?.countTextColor,
804
+ "--cs-duration-text": P?.durationTextColor,
805
+ "--cs-icon-secondary": P?.iconSecondaryColor,
806
+ "--cs-icon-completed": P?.iconCompletedColor,
807
+ "--cs-icon-error": P?.iconErrorColor,
808
+ "--cs-code-bg": P?.codeBg,
809
+ "--cs-code-border": P?.codeBorderColor,
810
+ "--cs-code-text": P?.codeTextColor,
811
+ "--cs-border": P?.borderColor
817
812
  });
818
813
  if (e.length === 0) return null;
819
- let F = {
820
- copyAriaLabel: v,
821
- codeBlockCopiedLabel: y,
822
- tableScrollRegionAriaLabel: b,
823
- mathScrollRegionAriaLabel: x,
814
+ let I = {
815
+ copyAriaLabel: y,
816
+ codeBlockCopiedLabel: b,
817
+ tableScrollRegionAriaLabel: x,
818
+ mathScrollRegionAriaLabel: S,
824
819
  runningAriaLabel: _,
825
- failedAriaLabel: S,
826
- attemptLabel: C,
827
- attachmentClickLabel: w
820
+ failedAriaLabel: C,
821
+ attemptLabel: ee,
822
+ attachmentClickLabel: T
828
823
  };
829
- if (e.length === 1) return /* @__PURE__ */ J(gt, {
824
+ if (e.length === 1) return /* @__PURE__ */ J(xt, {
830
825
  stages: e,
831
826
  isStreaming: t,
832
- expansion: O,
827
+ expansion: k,
833
828
  className: r,
834
829
  styles: {
835
- colors: N,
830
+ colors: P,
836
831
  typography: i?.typography
837
832
  },
838
- labels: F,
833
+ labels: I,
839
834
  onAttachmentClick: a,
840
- attachmentDisplayResolvers: l,
835
+ attachmentDisplayResolvers: o,
841
836
  renderCitation: u
842
837
  });
843
- let I = e.some((e) => e.status === o.Failed), L;
838
+ let L = e.some((e) => e.status === s.Failed), R;
844
839
  if (t) {
845
- let t = Oe((Ae(e) ?? e[e.length - 1]).name).name;
846
- L = /* @__PURE__ */ Y("span", {
840
+ let t = ke((je(e) ?? e[e.length - 1]).name).name;
841
+ R = /* @__PURE__ */ Y("span", {
847
842
  role: "status",
848
843
  "aria-live": "polite",
849
844
  className: "flex min-w-0 items-center gap-2",
850
845
  children: [/* @__PURE__ */ J("span", {
851
846
  className: "flex flex-none items-center",
852
- children: /* @__PURE__ */ J(te, {
847
+ children: /* @__PURE__ */ J(w, {
853
848
  size: 14,
854
849
  ariaLabel: _
855
850
  })
856
851
  }), t && /* @__PURE__ */ J("span", {
857
- className: c("max-w-88 min-w-0 truncate", P.fontClassName, $.liveName),
858
- children: /* @__PURE__ */ J(ee, { text: t })
852
+ className: l("max-w-88 min-w-0 truncate", F.fontClassName, $.liveName),
853
+ children: /* @__PURE__ */ J(v, { text: t })
859
854
  })]
860
855
  });
861
- } else if (I) {
862
- let t = e.filter((e) => e.status === o.Failed).length;
863
- L = /* @__PURE__ */ Y("span", {
856
+ } else if (L) {
857
+ let t = e.filter((e) => e.status === s.Failed).length;
858
+ R = /* @__PURE__ */ Y("span", {
864
859
  className: "inline-flex items-center gap-1",
865
860
  children: [/* @__PURE__ */ Y("span", {
866
- className: c(P.fontClassName, $.executedLabel),
861
+ className: l(F.fontClassName, $.executedLabel),
867
862
  children: [
868
863
  d,
869
864
  " ",
870
865
  e.length,
871
866
  " ",
872
- h(e.length)
867
+ f(e.length)
873
868
  ]
874
869
  }), /* @__PURE__ */ J("span", {
875
- className: c(P.fontClassName, $.failedText),
870
+ className: l(F.fontClassName, $.failedText),
876
871
  children: g(t)
877
872
  })]
878
873
  });
879
- } else L = /* @__PURE__ */ Y("span", {
874
+ } else R = /* @__PURE__ */ Y("span", {
880
875
  className: "inline-flex items-center gap-1",
881
- children: [/* @__PURE__ */ J(E, {
882
- size: p.SM,
876
+ children: [/* @__PURE__ */ J(O, {
877
+ size: m.SM,
883
878
  className: $.doneIcon,
884
879
  "aria-hidden": !0,
885
- stroke: m
880
+ stroke: h
886
881
  }), /* @__PURE__ */ Y("span", {
887
- className: c(P.fontClassName, $.executedLabel),
882
+ className: l(F.fontClassName, $.executedLabel),
888
883
  children: [
889
884
  d,
890
885
  " ",
891
886
  e.length,
892
887
  " ",
893
- h(e.length)
888
+ f(e.length)
894
889
  ]
895
890
  })]
896
891
  });
897
892
  return /* @__PURE__ */ J("div", {
898
- style: ne,
899
- className: c("flex w-full flex-col gap-1", r, Se.group),
900
- children: /* @__PURE__ */ J(f, {
901
- title: L,
902
- expanded: T,
893
+ style: te,
894
+ className: l("flex w-full flex-col gap-1", r, Ce.group),
895
+ children: /* @__PURE__ */ J(p, {
896
+ title: R,
897
+ expanded: E,
903
898
  onToggle: D,
904
899
  className: "overflow-visible py-0",
905
- headerClassName: c("justify-start gap-1 rounded-none px-0", $.toggleButton, Se.groupToggle),
906
- contentClassName: c("-mt-2 px-0", $.groupRegion),
907
- children: T && /* @__PURE__ */ J(gt, {
900
+ headerClassName: l("justify-start gap-1 rounded-none px-0", $.toggleButton, Ce.groupToggle),
901
+ contentClassName: l("-mt-2 px-0", $.groupRegion),
902
+ children: E && /* @__PURE__ */ J(xt, {
908
903
  stages: e,
909
904
  isStreaming: t,
910
- expansion: O,
905
+ expansion: k,
911
906
  styles: {
912
- colors: N,
907
+ colors: P,
913
908
  typography: i?.typography
914
909
  },
915
- labels: F,
910
+ labels: I,
916
911
  className: "pt-1",
917
912
  onAttachmentClick: a,
918
- attachmentDisplayResolvers: l,
913
+ attachmentDisplayResolvers: o,
919
914
  renderCitation: u
920
915
  })
921
916
  })
922
917
  });
923
918
  };
924
919
  //#endregion
925
- export { Se as CONVERSATION_STAGES_CLASS, vt as CollapsedGroup, _t as StagesPanel };
920
+ export { Ce as CONVERSATION_STAGES_CLASS, Ct as CollapsedGroup, St as StagesPanel };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@epam/ai-dial-conversation-stages",
3
3
  "description": "Panel for displaying agent processing stages during LLM response streaming",
4
- "version": "1.3.0-rc.0",
4
+ "version": "1.4.0-dev.5",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -18,11 +18,11 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@tabler/icons-react": "^3.50.0",
21
- "@epam/ai-dial-attachment-input": "1.3.0-rc.0"
21
+ "@epam/ai-dial-attachment-input": "1.4.0-dev.5"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "react": "^19.2.8",
25
- "@epam/ai-dial-chat-shared": "1.3.0-rc.0",
25
+ "@epam/ai-dial-chat-shared": "1.4.0-dev.5",
26
26
  "@epam/ai-dial-ui-kit": "^0.16.0"
27
27
  },
28
28
  "repository": {