@epam/ai-dial-conversation-stages 1.2.0-dev.225 → 1.2.0-dev.229

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,46 +1,65 @@
1
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 } from "@epam/ai-dial-chat-shared";
2
2
  import { Accordion as d, DIAL_ICON_SIZE as f, DIAL_KIT_ICON_STROKE as p, ElementSize as m, EllipsisTooltip as h, Highlight as g, Skeleton as _, SkeletonVariant as v, Spinner as y, StaticIconButton as b } from "@epam/ai-dial-ui-kit";
3
- import { IconAlertCircle as x, IconCheck as S, IconClipboard as C, IconDownload as w, IconExternalLink as T, IconFile as E, IconFileTypeBmp as D, IconFileTypeCss as O, IconFileTypeCsv as k, IconFileTypeDoc as A, IconFileTypeDocx as j, IconFileTypeHtml as M, IconFileTypeJpg as N, IconFileTypeJs as P, IconFileTypeJsx as F, IconFileTypePdf as I, IconFileTypePhp as L, IconFileTypePng as ee, IconFileTypePpt as R, IconFileTypeRs as z, IconFileTypeSql as te, IconFileTypeSvg as ne, IconFileTypeTs as re, IconFileTypeTsx as B, IconFileTypeTxt as ie, IconFileTypeVue as ae, IconFileTypeXls as oe, IconFileTypeXml as se, IconFileTypeZip as ce, IconMusic as le, IconPhoto as ue, IconReload as de, IconTerminal2 as fe, IconVideo as pe, IconX as me } from "@tabler/icons-react";
4
- import { memo as he, useCallback as ge, useEffect as V, useId as _e, useMemo as H, useRef as ve, useState as U } from "react";
5
- import { Fragment as W, jsx as G, jsxs as K } from "react/jsx-runtime";
3
+ import { IconAlertCircle as x, IconCheck as S, IconClipboard as C, IconDownload as w, IconExternalLink as T, IconFile as E, IconFileTypeBmp as D, IconFileTypeCss as O, IconFileTypeCsv as k, IconFileTypeDoc as A, IconFileTypeDocx as j, IconFileTypeHtml as M, IconFileTypeJpg as N, IconFileTypeJs as P, IconFileTypeJsx as F, IconFileTypePdf as I, IconFileTypePhp as L, IconFileTypePng as ee, IconFileTypePpt as R, IconFileTypeRs as te, IconFileTypeSql as z, IconFileTypeSvg as ne, IconFileTypeTs as re, IconFileTypeTsx as B, IconFileTypeTxt as ie, IconFileTypeVue as ae, IconFileTypeXls as oe, IconFileTypeXml as se, IconFileTypeZip as ce, IconMusic as le, IconPhoto as ue, IconReload as de, IconTerminal2 as fe, IconVideo as pe, IconX as me } from "@tabler/icons-react";
4
+ import { memo as he, useCallback as V, useEffect as H, useId as ge, useMemo as U, useRef as _e, useState as W } from "react";
5
+ import { Fragment as ve, jsx as G, jsxs as K } from "react/jsx-runtime";
6
6
  //#region src/constants/public-class-names.ts
7
7
  var q = {
8
8
  panel: "dial-conversation-stages-panel",
9
9
  group: "dial-conversation-stages-group",
10
10
  groupToggle: "dial-conversation-stages-group-toggle"
11
- }, ye = /[([][^()[\]]*[)\]]/g, be = /(\d+(?:\.\d+)?)\s*s\b/, xe = /\bStart:\s*(\d{1,2}):([0-5]\d):([0-5]\d(?:\.\d+)?)\b/i, Se = (e) => {
11
+ }, ye = () => {
12
+ let [e, t] = W(() => /* @__PURE__ */ new Set()), n = V((e, n) => {
13
+ t((t) => {
14
+ if (t.has(e) === n) return t;
15
+ let r = new Set(t);
16
+ return n ? r.add(e) : r.delete(e), r;
17
+ });
18
+ }, []), r = V(() => {
19
+ t((e) => e.size ? /* @__PURE__ */ new Set() : e);
20
+ }, []);
21
+ return U(() => ({
22
+ isExpanded: (t) => e.has(t),
23
+ onToggle: n,
24
+ reset: r
25
+ }), [
26
+ e,
27
+ n,
28
+ r
29
+ ]);
30
+ }, be = /[([][^()[\]]*[)\]]/g, xe = /(\d+(?:\.\d+)?)\s*s\b/, Se = /\bStart:\s*(\d{1,2}):([0-5]\d):([0-5]\d(?:\.\d+)?)\b/i, Ce = (e) => {
12
31
  let t = e.trimEnd();
13
32
  return t.endsWith(":") ? t.slice(0, -1) : t;
14
- }, Ce = 1440 * 60, we = Ce / 2, Te = (e) => {
15
- let t = xe.exec(e);
33
+ }, we = 1440 * 60, Te = we / 2, Ee = (e) => {
34
+ let t = Se.exec(e);
16
35
  if (!t) return;
17
36
  let n = Number(t[1]);
18
37
  if (!(n > 23)) return n * 60 * 60 + Number(t[2]) * 60 + Number(t[3]);
19
- }, Ee = (e) => {
20
- ye.lastIndex = 0;
38
+ }, De = (e) => {
39
+ be.lastIndex = 0;
21
40
  let t;
22
- for (; t = ye.exec(e);) {
23
- let e = t[0].slice(1, -1), n = be.exec(e);
41
+ for (; t = be.exec(e);) {
42
+ let e = t[0].slice(1, -1), n = xe.exec(e);
24
43
  if (n) return {
25
44
  durationLabel: `${n[1]}s`,
26
45
  groupIndex: t.index,
27
46
  groupLength: t[0].length,
28
- startTimeSeconds: Te(e)
47
+ startTimeSeconds: Ee(e)
29
48
  };
30
49
  }
31
50
  }, J = (e) => {
32
- let t = e ?? "", n = Ee(t);
51
+ let t = e ?? "", n = De(t);
33
52
  return {
34
- name: Se(n ? t.slice(0, n.groupIndex) + t.slice(n.groupIndex + n.groupLength) : t).trim().replace(/ {2,}/g, " "),
53
+ name: Ce(n ? t.slice(0, n.groupIndex) + t.slice(n.groupIndex + n.groupLength) : t).trim().replace(/ {2,}/g, " "),
35
54
  durationLabel: n?.durationLabel
36
55
  };
37
- }, De = (e) => e.length > 0 && !/\s/.test(e) && e.includes("_"), Oe = (e) => e >= 60 ? `${Math.floor(e / 60)}m ${Math.round(e % 60)}s` : `${e.toFixed(1)}s`, ke = (e) => {
56
+ }, Oe = (e) => e.length > 0 && !/\s/.test(e) && e.includes("_"), ke = (e) => e >= 60 ? `${Math.floor(e / 60)}m ${Math.round(e % 60)}s` : `${e.toFixed(1)}s`, Ae = (e) => {
38
57
  if (!e) return;
39
58
  let t = /^(\d+(?:\.\d+)?)s$/.exec(e);
40
59
  return t ? parseFloat(t[1]) : void 0;
41
- }, Ae = (e) => {
60
+ }, je = (e) => {
42
61
  let t = e.flatMap((e) => {
43
- let t = Ee(e ?? ""), n = ke(t?.durationLabel);
62
+ let t = De(e ?? ""), n = Ae(t?.durationLabel);
44
63
  return n == null ? [] : [{
45
64
  durationSeconds: n,
46
65
  startTimeSeconds: t?.startTimeSeconds
@@ -51,50 +70,65 @@ var q = {
51
70
  let n = 0, r, i = t.flatMap(({ durationSeconds: e, startTimeSeconds: t }) => {
52
71
  if (t == null) return [];
53
72
  let i = t + n;
54
- return r != null && r - i > we && (n += Ce, i += Ce), r = i, {
73
+ return r != null && r - i > Te && (n += we, i += we), r = i, {
55
74
  start: i,
56
75
  end: i + e
57
76
  };
58
77
  }).sort((e, t) => e.start - t.start), a = 0, o = i[0].start, s = i[0].end;
59
78
  for (let e of i.slice(1)) e.start <= s ? s = Math.max(s, e.end) : (a += s - o, o = e.start, s = e.end);
60
79
  return a + s - o;
61
- }, je = (e) => [...e].reverse().find((e) => e.status == null), Me = "overflow-visible py-0", Ne = "justify-start gap-2 rounded-lg px-2 py-1.5 text-start", Pe = (e) => {
80
+ }, Me = (e) => [...e].reverse().find((e) => e.status == null), Ne = (e, t) => {
81
+ let n = e.parent_stage_index;
82
+ if (!(n == null || !Number.isInteger(n) || n < 0 || n >= e.index)) return t.get(n);
83
+ }, Pe = (e) => {
84
+ let t = e.map((e) => ({
85
+ stage: e,
86
+ children: []
87
+ })), n = /* @__PURE__ */ new Map();
88
+ for (let e of t) n.has(e.stage.index) || n.set(e.stage.index, e);
89
+ let r = [];
90
+ for (let e of t) {
91
+ let t = Ne(e.stage, n);
92
+ t ? t.children.push(e) : r.push(e);
93
+ }
94
+ return r;
95
+ }, Fe = (e) => `stage:${e}`, Ie = (e) => `group:${e}`, Le = "min-w-0 overflow-visible py-0", Re = "min-w-0 justify-start gap-2 rounded-lg px-2 py-1.5 text-start mobile:min-h-11", ze = (e) => {
62
96
  let t = [], n = 0;
63
97
  for (; n < e.length;) {
64
- let r = e[n], i = J(r.name).name, a = n + 1;
65
- for (; a < e.length && J(e[a].name).name === i;) a += 1;
98
+ let r = e[n], i = J(r.stage.name).name, a = n + 1;
99
+ for (; a < e.length && J(e[a].stage.name).name === i;) a += 1;
66
100
  let o = e.slice(n, a);
67
101
  o.length > 1 ? t.push({
68
- key: r.index,
102
+ key: r.stage.index,
69
103
  name: i,
70
104
  attempts: o
71
105
  }) : t.push({
72
- key: r.index,
73
- stage: r
106
+ key: r.stage.index,
107
+ node: r
74
108
  }), n = a;
75
109
  }
76
110
  return t;
77
111
  }, Y = {
78
- panel: "_panel_8he9e_1",
79
- row: "_row_8he9e_5",
80
- collapseButton: "_collapseButton_8he9e_9",
81
- stageHeader: "_stageHeader_8he9e_18",
82
- stageRegion: "_stageRegion_8he9e_27",
83
- stageName: "_stageName_8he9e_31",
84
- stageNameFailed: "_stageNameFailed_8he9e_35",
85
- monoName: "_monoName_8he9e_39",
86
- tag: "_tag_8he9e_43",
87
- count: "_count_8he9e_47",
88
- duration: "_duration_8he9e_52",
89
- iconSecondary: "_iconSecondary_8he9e_57",
90
- iconCompleted: "_iconCompleted_8he9e_62",
91
- iconError: "_iconError_8he9e_66",
92
- stageContent: "_stageContent_8he9e_70",
93
- codeBlock: "_codeBlock_8he9e_74",
94
- codeInline: "_codeInline_8he9e_80",
95
- blockquote: "_blockquote_8he9e_86",
96
- tableCell: "_tableCell_8he9e_91"
97
- }, Fe = ({ status: e, isLive: t, runningLabel: n = "Running", failedLabel: r = "Failed" }) => e === o.Failed ? /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ G(x, {
112
+ panel: "_panel_10qci_1",
113
+ row: "_row_10qci_5",
114
+ collapseButton: "_collapseButton_10qci_9",
115
+ stageHeader: "_stageHeader_10qci_18",
116
+ stageRegion: "_stageRegion_10qci_27",
117
+ stageName: "_stageName_10qci_31",
118
+ stageNameFailed: "_stageNameFailed_10qci_35",
119
+ monoName: "_monoName_10qci_39",
120
+ tag: "_tag_10qci_43",
121
+ count: "_count_10qci_47",
122
+ duration: "_duration_10qci_52",
123
+ iconSecondary: "_iconSecondary_10qci_57",
124
+ iconCompleted: "_iconCompleted_10qci_62",
125
+ iconError: "_iconError_10qci_66",
126
+ stageContent: "_stageContent_10qci_70",
127
+ codeBlock: "_codeBlock_10qci_74",
128
+ codeInline: "_codeInline_10qci_80",
129
+ blockquote: "_blockquote_10qci_86",
130
+ tableCell: "_tableCell_10qci_91"
131
+ }, Be = ({ status: e, isLive: t, runningLabel: n = "Running", failedLabel: r = "Failed" }) => e === o.Failed ? /* @__PURE__ */ K(ve, { children: [/* @__PURE__ */ G(x, {
98
132
  size: f.MD,
99
133
  className: Y.iconError,
100
134
  "aria-hidden": !0,
@@ -110,11 +144,11 @@ var q = {
110
144
  }) : t ? /* @__PURE__ */ G(y, {
111
145
  size: 16,
112
146
  ariaLabel: n
113
- }) : null, Ie = (e) => {
147
+ }) : null, Ve = (e) => {
114
148
  if (e == null) return "";
115
149
  let t = e.lastIndexOf(".");
116
150
  return t > 0 ? e.slice(0, t) : e;
117
- }, Le = (e) => {
151
+ }, He = (e) => {
118
152
  if (!e) return E;
119
153
  let t = u(e);
120
154
  if (t.startsWith("image/")) switch (t) {
@@ -144,48 +178,48 @@ var q = {
144
178
  case "text/html":
145
179
  case "application/xhtml+xml": return M;
146
180
  case "application/xml": return se;
147
- case "application/sql": return te;
181
+ case "application/sql": return z;
148
182
  case "text/javascript": return P;
149
183
  case "text/jsx": return F;
150
184
  case "text/typescript": return re;
151
185
  case "text/tsx": return B;
152
186
  case "text/css": return O;
153
187
  case "text/x-php": return L;
154
- case "text/x-rustsrc": return z;
188
+ case "text/x-rustsrc": return te;
155
189
  case "text/x-vue": return ae;
156
190
  default: return E;
157
191
  }
158
- }, Re = (e) => {
192
+ }, Ue = (e) => {
159
193
  let { type: n, contentType: r } = e;
160
- return n === t.Prompt ? fe : n === t.Pasted ? C : n === t.Image ? ue : Le(r ?? "");
161
- }, ze = (e) => {
194
+ return n === t.Prompt ? fe : n === t.Pasted ? C : n === t.Image ? ue : He(r ?? "");
195
+ }, We = (e) => {
162
196
  let t = u(e), r = n[t];
163
197
  if (r) return r;
164
198
  let i = t.split("/")[1];
165
199
  if (i && !i.startsWith("vnd.") && !i.includes("+")) return i;
166
- }, Be = (e, n) => {
200
+ }, Ge = (e, n) => {
167
201
  let { type: r, name: i, contentType: a } = e;
168
202
  if (r === t.Prompt) return n.promptLabel ?? "Prompt";
169
203
  if (r === t.Pasted) return n.pastedLabel ?? "Pasted";
170
204
  if (r === t.Image) return n.imageLabel ?? "Image";
171
205
  if (a) {
172
- let e = ze(a);
206
+ let e = We(a);
173
207
  if (e) return `.${e}`;
174
208
  }
175
209
  if (i == null) return "";
176
210
  let o = i.lastIndexOf(".");
177
211
  return o > 0 && o < i.length - 1 ? `.${i.slice(o + 1).toLowerCase()}` : i;
178
- }, Ve = (e, n = {}) => {
212
+ }, Ke = (e, n = {}) => {
179
213
  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
214
  return {
181
215
  isLoading: c,
182
216
  isError: l,
183
217
  isImage: u,
184
218
  isLink: d,
185
- BottomIcon: d ? null : Re(e),
186
- typeLabel: d ? null : Be(e, n)
219
+ BottomIcon: d ? null : Ue(e),
220
+ typeLabel: d ? null : Ge(e, n)
187
221
  };
188
- }, He = "flex size-[84px] items-center justify-center rounded-xl border", X = {
222
+ }, qe = "flex size-[84px] items-center justify-center rounded-xl border", X = {
189
223
  tray: "dial-ai-attachment-tray",
190
224
  trayItem: "dial-ai-attachment-tray-item",
191
225
  tile: "dial-ai-attachment-tile",
@@ -213,7 +247,7 @@ var q = {
213
247
  onClick: (e) => {
214
248
  e.stopPropagation(), r(i);
215
249
  }
216
- }), Ue = ({ ...e }) => /* @__PURE__ */ G(Q, {
250
+ }), Je = ({ ...e }) => /* @__PURE__ */ G(Q, {
217
251
  icon: /* @__PURE__ */ G(de, {
218
252
  size: f.SM,
219
253
  "aria-hidden": !0,
@@ -221,37 +255,37 @@ var q = {
221
255
  }),
222
256
  className: Z.retryIcon,
223
257
  ...e
224
- }), We = ({ ...e }) => /* @__PURE__ */ G(Q, {
258
+ }), Ye = ({ ...e }) => /* @__PURE__ */ G(Q, {
225
259
  icon: /* @__PURE__ */ G(w, {
226
260
  size: f.SM,
227
261
  "aria-hidden": !0,
228
262
  stroke: p
229
263
  }),
230
264
  ...e
231
- }), Ge = ({ ...e }) => /* @__PURE__ */ G(Q, {
265
+ }), Xe = ({ ...e }) => /* @__PURE__ */ G(Q, {
232
266
  icon: /* @__PURE__ */ G(T, {
233
267
  size: f.SM,
234
268
  "aria-hidden": !0,
235
269
  stroke: p
236
270
  }),
237
271
  ...e
238
- }), Ke = ({ ...e }) => /* @__PURE__ */ G(Q, {
272
+ }), Ze = ({ ...e }) => /* @__PURE__ */ G(Q, {
239
273
  icon: /* @__PURE__ */ G(me, {
240
274
  size: f.SM,
241
275
  "aria-hidden": !0,
242
276
  stroke: p
243
277
  }),
244
278
  ...e
245
- }), qe = {
279
+ }), Qe = {
246
280
  [e.Network]: "Upload failed · network error",
247
281
  [e.UnsupportedType]: "Upload failed · unsupported file type",
248
282
  [e.FileTooLarge]: "Upload failed · file too large"
249
- }, Je = ({ attachment: t, searchQuery: n = "", onClick: r, onRetry: i, labels: o, styles: s, onDownload: l, isPasted: u, isLink: d, cssVars: f, onExpand: p, isExpandable: m, onRemove: h, isSelected: _ }) => {
250
- let { clickLabel: v = "Download attachment", retryLabel: b = "Retry upload", removeLabel: x = "Remove attachment", openInNewTabLabel: S = "Open in new tab", sizeLabel: C, uploadingLabel: w = "Uploading", errorReasonLabels: T, genericErrorLabel: E = "Upload failed" } = o ?? {}, { typography: D, className: O } = s ?? {}, { id: k, name: A, status: j, errorReason: M } = t, N = j === a.Loading, P = j === a.Error, F = _e(), I = P ? M && (T?.[M] ?? qe[M]) || E : "", { BottomIcon: L, typeLabel: ee } = Ve(t), R = !P && !N && l && !d, z = P && !!i && M !== e.UnsupportedType && M !== e.FileTooLarge, te = Number(!!R) + Number(!!z) + Number(!!d) + Number(!!h), ne = te > 1 ? "pe-11" : te === 1 ? "pe-5" : void 0, re = (e) => {
283
+ }, $e = ({ attachment: t, searchQuery: n = "", onClick: r, onRetry: i, labels: o, styles: s, onDownload: l, isPasted: u, isLink: d, cssVars: f, onExpand: p, isExpandable: m, onRemove: h, isSelected: _ }) => {
284
+ let { clickLabel: v = "Download attachment", retryLabel: b = "Retry upload", removeLabel: x = "Remove attachment", openInNewTabLabel: S = "Open in new tab", sizeLabel: C, uploadingLabel: w = "Uploading", errorReasonLabels: T, genericErrorLabel: E = "Upload failed" } = o ?? {}, { typography: D, className: O } = s ?? {}, { id: k, name: A, status: j, errorReason: M } = t, N = j === a.Loading, P = j === a.Error, F = ge(), I = P ? M && (T?.[M] ?? Qe[M]) || E : "", { BottomIcon: L, typeLabel: ee } = Ke(t), R = !P && !N && l && !d, te = P && !!i && M !== e.UnsupportedType && M !== e.FileTooLarge, z = Number(!!R) + Number(!!te) + Number(!!d) + Number(!!h), ne = z > 1 ? "pe-11" : z === 1 ? "pe-5" : void 0, re = (e) => {
251
285
  e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), r?.(t.id));
252
- }, B = H(() => u ? A : Ie(A), [u, A]), ie = ge(() => {
286
+ }, B = U(() => u ? A : Ve(A), [u, A]), ie = V(() => {
253
287
  window.open(t.referenceUrl, "_blank", "noopener,noreferrer");
254
- }, [t]), ae = c(He, "group/attachment-tile relative flex-col justify-between items-start gap-1 overflow-hidden p-1.5", Z.tile, !P && Z.hovered, _ && Z.selected, P && Z.tileError, X.tile, _ && X.tileSelected), oe = /* @__PURE__ */ G("div", {
288
+ }, [t]), ae = c(qe, "group/attachment-tile relative flex-col justify-between items-start gap-1 overflow-hidden p-1.5", Z.tile, !P && Z.hovered, _ && Z.selected, P && Z.tileError, X.tile, _ && X.tileSelected), oe = /* @__PURE__ */ G("div", {
255
289
  title: B,
256
290
  className: c(D?.nameClassName ?? "dial-caption-text", "line-clamp-2 w-full min-w-0 break-words", Z.nameText, !P && ne, X.tileName),
257
291
  children: n ? /* @__PURE__ */ G(g, {
@@ -271,7 +305,7 @@ var q = {
271
305
  })]
272
306
  }), ce = () => {
273
307
  m && p ? p(k) : r && r(k);
274
- }, le = /* @__PURE__ */ K(W, { children: [
308
+ }, le = /* @__PURE__ */ K(ve, { children: [
275
309
  oe,
276
310
  se,
277
311
  N && /* @__PURE__ */ G("div", {
@@ -283,27 +317,27 @@ var q = {
283
317
  /* @__PURE__ */ K("div", {
284
318
  className: "absolute end-1 top-1 flex gap-1",
285
319
  children: [
286
- R && /* @__PURE__ */ G(We, {
320
+ R && /* @__PURE__ */ G(Ye, {
287
321
  ariaLabel: v,
288
322
  errorTitle: I,
289
323
  errorDescId: F,
290
324
  onClick: l,
291
325
  id: k
292
326
  }),
293
- z && /* @__PURE__ */ G(Ue, {
327
+ te && /* @__PURE__ */ G(Je, {
294
328
  ariaLabel: b,
295
329
  errorTitle: I,
296
330
  errorDescId: F,
297
331
  onClick: i,
298
332
  id: k
299
333
  }),
300
- d && /* @__PURE__ */ G(Ge, {
334
+ d && /* @__PURE__ */ G(Xe, {
301
335
  ariaLabel: S,
302
336
  errorTitle: I,
303
337
  errorDescId: F,
304
338
  onClick: ie
305
339
  }),
306
- h && /* @__PURE__ */ G(Ke, {
340
+ h && /* @__PURE__ */ G(Ze, {
307
341
  ariaLabel: x,
308
342
  errorTitle: I,
309
343
  errorDescId: F,
@@ -335,13 +369,13 @@ var q = {
335
369
  children: le
336
370
  })
337
371
  });
338
- }, Ye = /* @__PURE__ */ function(e) {
372
+ }, et = /* @__PURE__ */ function(e) {
339
373
  return e.Idle = "idle", e.Loading = "loading", e.Loaded = "loaded", e.Error = "error", e;
340
- }({}), Xe = ({ enabled: e, src: t }) => {
341
- let n = ve(null), [r, i] = U("idle");
342
- return V(() => {
374
+ }({}), tt = ({ enabled: e, src: t }) => {
375
+ let n = _e(null), [r, i] = W("idle");
376
+ return H(() => {
343
377
  i(e && t ? "loading" : "idle");
344
- }, [e, t]), V(() => {
378
+ }, [e, t]), H(() => {
345
379
  let r = n.current;
346
380
  if (!r || !e || !t) return;
347
381
  let a = () => i("loaded"), o = () => i("error");
@@ -352,15 +386,15 @@ var q = {
352
386
  imageRef: n,
353
387
  imageLoadStatus: r
354
388
  };
355
- }, Ze = ({ attachment: e, onExpand: n, onClick: r, labels: i, onRemove: a, cssVars: o, onDownload: s, styles: l, isSelected: u }) => {
356
- let { clickLabel: d = "Open attachment", expandLabel: m = "Expand pasted text", removeLabel: h = "Remove attachment", downloadLabel: g = "Download attachment" } = i ?? {}, { className: y } = l ?? {}, { id: b, name: x } = e, S = e.previewUrl ?? e.url, C = e.type === t.Pasted && n !== void 0, { isLoading: w, isError: T, isImage: E } = H(() => Ve(e), [e]), D = r !== void 0 && !C && !w && !T, { imageRef: O, imageLoadStatus: k } = Xe({
389
+ }, nt = ({ attachment: e, onExpand: n, onClick: r, labels: i, onRemove: a, cssVars: o, onDownload: s, styles: l, isSelected: u }) => {
390
+ let { clickLabel: d = "Open attachment", expandLabel: m = "Expand pasted text", removeLabel: h = "Remove attachment", downloadLabel: g = "Download attachment" } = i ?? {}, { className: y } = l ?? {}, { id: b, name: x } = e, S = e.previewUrl ?? e.url, C = e.type === t.Pasted && n !== void 0, { isLoading: w, isError: T, isImage: E } = U(() => Ke(e), [e]), D = r !== void 0 && !C && !w && !T, { imageRef: O, imageLoadStatus: k } = tt({
357
391
  enabled: E,
358
392
  src: S
359
393
  }), A = () => {
360
394
  C && n ? n(b) : D && r && r(b);
361
395
  };
362
396
  return /* @__PURE__ */ G("div", {
363
- className: c(He, "group/attachment-tile", D && "cursor-pointer", Z.tile, u && Z.selected, y, X.tile, u && X.tileSelected),
397
+ className: c(qe, "group/attachment-tile", D && "cursor-pointer", Z.tile, u && Z.selected, y, X.tile, u && X.tileSelected),
364
398
  onClick: A,
365
399
  onKeyDown: (e) => {
366
400
  e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), A());
@@ -374,23 +408,23 @@ var q = {
374
408
  children: [
375
409
  /* @__PURE__ */ K("div", {
376
410
  className: "absolute end-1 top-1 z-10 flex gap-1",
377
- children: [a && /* @__PURE__ */ G(Ke, {
411
+ children: [a && /* @__PURE__ */ G(Ze, {
378
412
  ariaLabel: h,
379
413
  onClick: a,
380
414
  id: b,
381
415
  className: Z.imageActionButton
382
- }), s && /* @__PURE__ */ G(We, {
416
+ }), s && /* @__PURE__ */ G(Ye, {
383
417
  ariaLabel: g,
384
418
  onClick: s,
385
419
  id: b,
386
420
  className: Z.imageActionButton
387
421
  })]
388
422
  }),
389
- k !== Ye.Loaded && /* @__PURE__ */ G(_, {
423
+ k !== et.Loaded && /* @__PURE__ */ G(_, {
390
424
  variant: v.Rectangular,
391
425
  width: "100%",
392
426
  height: "100%",
393
- active: k === Ye.Loading,
427
+ active: k === et.Loading,
394
428
  overlay: /* @__PURE__ */ G(ue, {
395
429
  size: f.LG,
396
430
  className: Z.typeText,
@@ -405,12 +439,12 @@ var q = {
405
439
  alt: x,
406
440
  loading: "lazy",
407
441
  decoding: "async",
408
- className: c("h-full w-full rounded-xl object-cover transition-opacity duration-200", k === Ye.Loaded ? "opacity-100" : "opacity-0")
442
+ className: c("h-full w-full rounded-xl object-cover transition-opacity duration-200", k === et.Loaded ? "opacity-100" : "opacity-0")
409
443
  })
410
444
  ]
411
445
  })
412
446
  });
413
- }, Qe = ({ attachment: e, searchQuery: n = "", onRemove: r, onRetry: i, onExpand: a, onClick: o, onDownload: c, labels: l, styles: u, isSelected: d }) => {
447
+ }, rt = ({ attachment: e, searchQuery: n = "", onRemove: r, onRetry: i, onExpand: a, onClick: o, onDownload: c, labels: l, styles: u, isSelected: d }) => {
414
448
  let { colors: f } = u ?? {}, p = e.type === t.Pasted, m = p && a !== void 0, h = s({
415
449
  "--ai-tile-bg": f?.background,
416
450
  "--ai-tile-border": f?.border,
@@ -427,8 +461,8 @@ var q = {
427
461
  "--ai-tile-hover-icon-bg": f?.hoverIconBackground,
428
462
  "--ai-tile-hover-icon-color": f?.hoverIconColor,
429
463
  "--ai-tile-progress-track": f?.trackBackground
430
- }), { isImage: g, isLink: _ } = H(() => Ve(e), [e]);
431
- return g ? /* @__PURE__ */ G(Ze, {
464
+ }), { isImage: g, isLink: _ } = U(() => Ke(e), [e]);
465
+ return g ? /* @__PURE__ */ G(nt, {
432
466
  attachment: e,
433
467
  labels: l,
434
468
  onClick: o,
@@ -438,7 +472,7 @@ var q = {
438
472
  cssVars: h,
439
473
  onDownload: c,
440
474
  isSelected: d
441
- }) : /* @__PURE__ */ G(Je, {
475
+ }) : /* @__PURE__ */ G($e, {
442
476
  attachment: e,
443
477
  searchQuery: n,
444
478
  onClick: o,
@@ -454,7 +488,7 @@ var q = {
454
488
  isExpandable: m,
455
489
  isSelected: d
456
490
  });
457
- }, $e = (e) => {
491
+ }, it = (e) => {
458
492
  let t = l(e);
459
493
  if (!e?.length) return t;
460
494
  let n = /* @__PURE__ */ new Map();
@@ -469,14 +503,14 @@ var q = {
469
503
  contentType: t
470
504
  } : e;
471
505
  });
472
- }, et = ({ children: e, codeClassName: t, blockClassName: n = "dial-code-text", copyAriaLabel: i }) => /* @__PURE__ */ G(r, {
506
+ }, at = ({ children: e, codeClassName: t, blockClassName: n = "dial-code-text", copyAriaLabel: i }) => /* @__PURE__ */ G(r, {
473
507
  language: t?.replace(/^language-/, "") ?? "",
474
508
  value: typeof e == "string" ? e : String(e ?? ""),
475
509
  codeClassName: n,
476
510
  containerClassName: c(Y.codeBlock, n),
477
511
  copyLabel: i,
478
512
  hideDownload: !0
479
- }), tt = he(({ content: e, typography: t, copyAriaLabel: n = "Copy" }) => {
513
+ }), ot = he(({ content: e, typography: t, copyAriaLabel: n = "Copy" }) => {
480
514
  let r = "mb-1.5 last:mb-0", a = c(t?.headingClassName ?? "dial-small-semi-text", Y.stageContent, r);
481
515
  return /* @__PURE__ */ G(i, {
482
516
  content: e,
@@ -496,7 +530,7 @@ var q = {
496
530
  link: c(t?.contentClassName ?? "dial-tiny-text", Y.stageContent),
497
531
  tableCell: c(t?.contentClassName ?? "dial-tiny-text", Y.tableCell)
498
532
  },
499
- components: { code: ({ children: e, className: r }) => r?.includes("language-") ? /* @__PURE__ */ G(et, {
533
+ components: { code: ({ children: e, className: r }) => r?.includes("language-") ? /* @__PURE__ */ G(at, {
500
534
  codeClassName: r,
501
535
  blockClassName: t?.codeBlockClassName,
502
536
  copyAriaLabel: n,
@@ -506,8 +540,8 @@ var q = {
506
540
  children: e
507
541
  }) }
508
542
  });
509
- }), nt = ({ attachments: e, clickLabel: t, onAttachmentClick: n }) => {
510
- let r = ge((t) => {
543
+ }), st = ({ attachments: e, clickLabel: t, onAttachmentClick: n }) => {
544
+ let r = V((t) => {
511
545
  let r = e.find((e) => e.id === t);
512
546
  r && n?.(r);
513
547
  }, [e, n]);
@@ -516,158 +550,199 @@ var q = {
516
550
  className: "flex flex-wrap gap-3",
517
551
  children: e.map((e) => /* @__PURE__ */ G("div", {
518
552
  role: "listitem",
519
- children: /* @__PURE__ */ G(Qe, {
553
+ children: /* @__PURE__ */ G(rt, {
520
554
  attachment: e,
521
555
  onClick: n && r,
522
556
  labels: { clickLabel: t }
523
557
  })
524
558
  }, e.id))
525
559
  });
526
- }, rt = ({ stage: e, isLive: t, typography: n, labels: r, nameOverride: i, onAttachmentClick: a }) => {
527
- let [s, l] = U(!1), { copyAriaLabel: u = "Copy stage content", runningAriaLabel: f, failedAriaLabel: p, attachmentClickLabel: m = "Preview search result" } = r ?? {}, g = H(() => $e(e.attachments), [e.attachments]), { name: _, durationLabel: v } = J(e.name), y = i ?? _, b = !i && De(_), x = e.status === o.Failed, S = !!e.content || !!e.attachments?.length, C = /* @__PURE__ */ K(W, { children: [
560
+ }, ct = ({ stage: e, isLive: t, typography: n, labels: r, nameOverride: i, onAttachmentClick: a, childList: s, isExpanded: l, onToggle: u }) => {
561
+ let [f, p] = W(!1), m = l ?? f, g = V((e) => {
562
+ l === void 0 && p(e), u?.(e);
563
+ }, [l, u]), { copyAriaLabel: _ = "Copy stage content", runningAriaLabel: v, failedAriaLabel: y, attachmentClickLabel: b = "Preview search result" } = r ?? {}, x = U(() => it(e.attachments), [e.attachments]), { name: S, durationLabel: C } = J(e.name), w = i ?? S, T = !i && Oe(S), E = e.status === o.Failed, D = !!e.content || !!e.attachments?.length, O = D || s != null, k = /* @__PURE__ */ K(ve, { children: [
528
564
  /* @__PURE__ */ G("span", {
529
565
  className: "flex flex-none items-center",
530
- children: /* @__PURE__ */ G(Fe, {
566
+ children: /* @__PURE__ */ G(Be, {
531
567
  status: e.status,
532
568
  isLive: t,
533
- runningLabel: f,
534
- failedLabel: p
569
+ runningLabel: v,
570
+ failedLabel: y
535
571
  })
536
572
  }),
537
573
  /* @__PURE__ */ G("span", {
538
- className: c("min-w-0 max-w-[22rem] truncate", n?.fontClassName ?? "dial-small-text", Y.stageName, x && Y.stageNameFailed, b && Y.monoName),
539
- children: /* @__PURE__ */ G(h, { text: y || e.status || "" })
574
+ className: c("min-w-0 max-w-[22rem] truncate", n?.fontClassName ?? "dial-small-text", Y.stageName, E && Y.stageNameFailed, T && Y.monoName),
575
+ children: /* @__PURE__ */ G(h, { text: w || e.status || "" })
540
576
  }),
541
577
  e.tag && /* @__PURE__ */ G("span", {
542
578
  className: c("flex-none", n?.tagClassName ?? "dial-tiny-lead-text", Y.tag),
543
579
  children: e.tag
544
580
  }),
545
- v && /* @__PURE__ */ G("span", {
581
+ C && /* @__PURE__ */ G("span", {
546
582
  className: c("flex-none", n?.countFontClassName ?? "dial-tiny-text", Y.duration),
547
- children: v
583
+ children: C
548
584
  })
549
585
  ] });
550
- return S ? /* @__PURE__ */ K(d, {
551
- expanded: s,
552
- onToggle: l,
586
+ return O ? /* @__PURE__ */ K(d, {
587
+ expanded: m,
588
+ onToggle: g,
553
589
  title: /* @__PURE__ */ G("span", {
554
590
  className: "flex min-w-0 items-center gap-2",
555
- children: C
591
+ children: k
556
592
  }),
557
- className: Me,
558
- headerClassName: c(Ne, Y.row, Y.stageHeader),
559
- contentClassName: c("-mt-1 flex flex-col gap-3 px-0 py-1 ps-8", Y.stageRegion),
560
- children: [s && e.content && /* @__PURE__ */ G("div", {
561
- className: "max-h-[300px] overflow-y-auto",
562
- children: /* @__PURE__ */ G(tt, {
563
- content: e.content,
564
- typography: n,
565
- copyAriaLabel: u
566
- })
567
- }), s && g.length > 0 && /* @__PURE__ */ G(nt, {
568
- attachments: g,
569
- clickLabel: m,
570
- onAttachmentClick: a
571
- })]
593
+ className: Le,
594
+ headerClassName: c(Re, Y.row, Y.stageHeader),
595
+ contentClassName: c("-mt-1 flex min-w-0 flex-col gap-3 px-0 py-1", Y.stageRegion),
596
+ children: [m && D && /* @__PURE__ */ K("div", {
597
+ className: "flex min-w-0 flex-col gap-3 ps-8",
598
+ children: [e.content && /* @__PURE__ */ G("div", {
599
+ className: "max-h-[300px] min-w-0 overflow-y-auto",
600
+ children: /* @__PURE__ */ G(ot, {
601
+ content: e.content,
602
+ typography: n,
603
+ copyAriaLabel: _
604
+ })
605
+ }), x.length > 0 && /* @__PURE__ */ G(st, {
606
+ attachments: x,
607
+ clickLabel: b,
608
+ onAttachmentClick: a
609
+ })]
610
+ }), m && s]
572
611
  }) : /* @__PURE__ */ G("div", {
573
612
  className: c("flex w-full items-center gap-2 px-2 py-1.5", Y.row),
574
- children: C
613
+ children: k
575
614
  });
576
- }, it = ({ row: e, isLive: t, typography: n, labels: r, onAttachmentClick: i }) => {
577
- let { runningAriaLabel: a, failedAriaLabel: s, attemptLabel: l = (e) => `Attempt ${e}` } = r ?? {}, [u, f] = U(!1), p = e.attempts?.some((e) => e.status == null) ?? !1, m = e.attempts?.some((e) => e.status === o.Failed), g = p ? null : m ? o.Failed : o.Completed, _ = Ae((e.attempts || []).map((e) => e.name)), v = _ > 0 ? Oe(_) : void 0;
615
+ }, lt = (e) => e <= 3 ? "ps-4" : "ps-0", ut = (e) => e <= 3 ? "ps-6" : "ps-0", dt = ({ node: e, depth: t, nameOverride: n, isStreaming: r, expansion: i, typography: a, labels: o, onAttachmentClick: s }) => {
616
+ let c = Fe(e.stage.index), l = t + 1;
617
+ return /* @__PURE__ */ G(ct, {
618
+ stage: e.stage,
619
+ nameOverride: n,
620
+ isLive: r && e.stage.status == null,
621
+ typography: a,
622
+ labels: o,
623
+ onAttachmentClick: s,
624
+ isExpanded: i.isExpanded(c),
625
+ onToggle: (e) => i.onToggle(c, e),
626
+ childList: e.children.length > 0 ? /* @__PURE__ */ G(pt, {
627
+ nodes: e.children,
628
+ depth: l,
629
+ className: lt(l),
630
+ isStreaming: r,
631
+ expansion: i,
632
+ typography: a,
633
+ labels: o,
634
+ onAttachmentClick: s
635
+ }) : void 0
636
+ });
637
+ }, ft = ({ row: e, depth: t, isStreaming: n, expansion: r, typography: i, labels: a, onAttachmentClick: s }) => {
638
+ let { runningAriaLabel: l, failedAriaLabel: u, attemptLabel: f = (e) => `Attempt ${e}` } = a ?? {}, p = e.attempts ?? [], m = p.some((e) => e.stage.status == null), g = p.some((e) => e.stage.status === o.Failed), _ = o.Completed;
639
+ m ? _ = null : g && (_ = o.Failed);
640
+ let v = je(p.map((e) => e.stage.name)), y = v > 0 ? ke(v) : void 0, b = Ie(e.key), x = r.isExpanded(b), S = t + 1;
578
641
  return /* @__PURE__ */ G(d, {
579
- expanded: u,
580
- onToggle: f,
581
642
  title: /* @__PURE__ */ K("span", {
582
643
  className: "flex min-w-0 items-center gap-2",
583
644
  children: [
584
645
  /* @__PURE__ */ G("span", {
585
646
  className: "flex flex-none items-center",
586
- children: /* @__PURE__ */ G(Fe, {
587
- status: g,
588
- isLive: t,
589
- runningLabel: a,
590
- failedLabel: s
647
+ children: /* @__PURE__ */ G(Be, {
648
+ status: _,
649
+ isLive: n && m,
650
+ runningLabel: l,
651
+ failedLabel: u
591
652
  })
592
653
  }),
593
654
  /* @__PURE__ */ G("span", {
594
- className: c("min-w-0 max-w-[22rem] truncate", n?.fontClassName ?? "dial-small-text", Y.stageName, m && Y.stageNameFailed),
655
+ className: c("min-w-0 max-w-[22rem] truncate", i?.fontClassName ?? "dial-small-text", Y.stageName, g && Y.stageNameFailed),
595
656
  children: /* @__PURE__ */ G(h, { text: e.name })
596
657
  }),
597
658
  /* @__PURE__ */ K("span", {
598
- className: c("flex-none", n?.countFontClassName ?? "dial-tiny-text", Y.count),
599
- children: ["×", e.attempts?.length ?? 0]
659
+ className: c("flex-none", i?.countFontClassName ?? "dial-tiny-text", Y.count),
660
+ children: ["×", p.length]
600
661
  }),
601
- v && /* @__PURE__ */ G("span", {
602
- className: c("flex-none", n?.countFontClassName ?? "dial-tiny-text", Y.duration),
603
- children: v
662
+ y && /* @__PURE__ */ G("span", {
663
+ className: c("flex-none", i?.countFontClassName ?? "dial-tiny-text", Y.duration),
664
+ children: y
604
665
  })
605
666
  ]
606
667
  }),
607
- className: Me,
608
- headerClassName: c(Ne, Y.collapseButton, Y.row, Y.stageHeader),
609
- contentClassName: c("-mt-2 px-0 ps-6", Y.stageRegion),
668
+ expanded: x,
669
+ onToggle: (e) => r.onToggle(b, e),
670
+ className: Le,
671
+ headerClassName: c(Re, Y.collapseButton, Y.row, Y.stageHeader),
672
+ contentClassName: c("-mt-2 min-w-0 px-0", ut(S), Y.stageRegion),
610
673
  children: /* @__PURE__ */ G("ul", {
611
674
  role: "list",
612
- className: "flex flex-col gap-0.5",
613
- children: u && e.attempts?.map((e, a) => /* @__PURE__ */ G("li", {
675
+ className: "flex min-w-0 flex-col gap-0.5",
676
+ children: x && p.map((e, t) => /* @__PURE__ */ G("li", {
614
677
  role: "listitem",
615
- children: /* @__PURE__ */ G(rt, {
616
- stage: e,
617
- nameOverride: l(a + 1),
618
- isLive: t && e.status == null,
619
- typography: n,
620
- labels: r,
621
- onAttachmentClick: i
678
+ className: "min-w-0",
679
+ children: /* @__PURE__ */ G(dt, {
680
+ node: e,
681
+ depth: S,
682
+ nameOverride: f(t + 1),
683
+ isStreaming: n,
684
+ expansion: r,
685
+ typography: i,
686
+ labels: a,
687
+ onAttachmentClick: s
622
688
  })
623
- }, e.index))
689
+ }, e.stage.index))
624
690
  })
625
691
  });
626
- }, at = ({ stages: e, isStreaming: t, className: n, styles: r, labels: i, onAttachmentClick: a }) => {
627
- let { colors: o, typography: l } = r ?? {}, u = s({
628
- "--cs-text": o?.text,
629
- "--cs-row-hover": o?.rowHoverColor,
630
- "--cs-button-bg": o?.collapsedButtonBg,
631
- "--cs-stage-text": o?.stageTextColor,
632
- "--cs-failed-text": o?.failedColor,
633
- "--cs-tag-text": o?.tagTextColor,
634
- "--cs-count-text": o?.countTextColor,
635
- "--cs-duration-text": o?.durationTextColor,
636
- "--cs-icon-secondary": o?.iconSecondaryColor,
637
- "--cs-icon-completed": o?.iconCompletedColor,
638
- "--cs-icon-error": o?.iconErrorColor,
639
- "--cs-code-bg": o?.codeBg,
640
- "--cs-code-border": o?.codeBorderColor,
641
- "--cs-code-text": o?.codeTextColor,
642
- "--cs-border": o?.borderColor
643
- }), d = Pe(e);
692
+ }, pt = ({ nodes: e, depth: t, className: n, ...r }) => /* @__PURE__ */ G("ul", {
693
+ role: "list",
694
+ className: c("flex min-w-0 flex-col gap-0.5", n),
695
+ children: ze(e).map((e) => /* @__PURE__ */ G("li", {
696
+ role: "listitem",
697
+ className: "min-w-0",
698
+ children: e.node ? /* @__PURE__ */ G(dt, {
699
+ node: e.node,
700
+ depth: t,
701
+ ...r
702
+ }) : /* @__PURE__ */ G(ft, {
703
+ row: e,
704
+ depth: t,
705
+ ...r
706
+ })
707
+ }, e.key))
708
+ }), mt = ({ stages: e, isStreaming: t, className: n, styles: r, labels: i, onAttachmentClick: a, expansion: o }) => {
709
+ let { colors: l, typography: u } = r ?? {}, d = s({
710
+ "--cs-text": l?.text,
711
+ "--cs-row-hover": l?.rowHoverColor,
712
+ "--cs-button-bg": l?.collapsedButtonBg,
713
+ "--cs-stage-text": l?.stageTextColor,
714
+ "--cs-failed-text": l?.failedColor,
715
+ "--cs-tag-text": l?.tagTextColor,
716
+ "--cs-count-text": l?.countTextColor,
717
+ "--cs-duration-text": l?.durationTextColor,
718
+ "--cs-icon-secondary": l?.iconSecondaryColor,
719
+ "--cs-icon-completed": l?.iconCompletedColor,
720
+ "--cs-icon-error": l?.iconErrorColor,
721
+ "--cs-code-bg": l?.codeBg,
722
+ "--cs-code-border": l?.codeBorderColor,
723
+ "--cs-code-text": l?.codeTextColor,
724
+ "--cs-border": l?.borderColor
725
+ }), f = U(() => Pe(e), [e]);
644
726
  return /* @__PURE__ */ G("div", {
645
- style: u,
646
- className: c("w-full", Y.panel, n, q.panel),
647
- children: /* @__PURE__ */ G("ul", {
648
- role: "list",
649
- className: "flex w-full flex-col gap-0.5 ps-5",
650
- children: d.map((e) => e.stage ? /* @__PURE__ */ G("li", {
651
- role: "listitem",
652
- children: /* @__PURE__ */ G(rt, {
653
- stage: e.stage,
654
- isLive: t && e.stage.status == null,
655
- typography: l,
656
- labels: i,
657
- onAttachmentClick: a
658
- })
659
- }, e.key) : /* @__PURE__ */ G("li", {
660
- role: "listitem",
661
- children: /* @__PURE__ */ G(it, {
662
- row: e,
663
- isLive: t && (e.attempts?.some((e) => e.status == null) ?? !1),
664
- typography: l,
665
- labels: i,
666
- onAttachmentClick: a
667
- })
668
- }, e.key))
727
+ style: d,
728
+ className: c("w-full min-w-0", Y.panel, n, q.panel),
729
+ children: /* @__PURE__ */ G(pt, {
730
+ nodes: f,
731
+ depth: 0,
732
+ className: "w-full ps-5",
733
+ isStreaming: t,
734
+ expansion: o,
735
+ typography: u,
736
+ labels: i,
737
+ onAttachmentClick: a
669
738
  })
670
739
  });
740
+ }, ht = (e) => {
741
+ let t = ye();
742
+ return /* @__PURE__ */ G(mt, {
743
+ ...e,
744
+ expansion: t
745
+ });
671
746
  }, $ = {
672
747
  toggleButton: "_toggleButton_1kyyc_7",
673
748
  groupRegion: "_groupRegion_1kyyc_28",
@@ -676,56 +751,65 @@ var q = {
676
751
  doneIcon: "_doneIcon_1kyyc_41",
677
752
  failedText: "_failedText_1kyyc_45",
678
753
  liveName: "_liveName_1kyyc_49"
679
- }, ot = ({ stages: e, isStreaming: t, labels: n, className: r, styles: i, onAttachmentClick: a }) => {
680
- let { executedLabel: l = "Executed", stepsLabel: u = () => "steps", failedCountLabel: m = (e) => `${e} failed`, runningAriaLabel: g = "Running", copyAriaLabel: _, failedAriaLabel: v, attemptLabel: b, attachmentClickLabel: x } = n ?? {}, [C, w] = U(t), T = ve(t);
681
- V(() => {
682
- T.current && !t && w(!1), T.current = t;
754
+ }, gt = ({ stages: e, isStreaming: t, labels: n, className: r, styles: i, onAttachmentClick: a }) => {
755
+ let { executedLabel: l = "Executed", stepsLabel: u = () => "steps", failedCountLabel: m = (e) => `${e} failed`, runningAriaLabel: g = "Running", copyAriaLabel: _, failedAriaLabel: v, attemptLabel: b, attachmentClickLabel: x } = n ?? {}, [C, w] = W(t), T = ye(), { reset: E } = T, D = e.length > 1;
756
+ H(() => {
757
+ D && !C && E();
758
+ }, [
759
+ D,
760
+ C,
761
+ E
762
+ ]);
763
+ let O = _e(t);
764
+ H(() => {
765
+ O.current && !t && w(!1), O.current = t;
683
766
  }, [t]);
684
- let { colors: E, panel: D } = i ?? {}, O = i?.typography ?? { fontClassName: "dial-small-text" }, k = s({
685
- "--cs-cg-label": E?.labelColor,
686
- "--cs-cg-label-hover": E?.labelHoverColor,
687
- "--cs-cg-steps-count": E?.stepsCountColor,
688
- "--cs-cg-done": E?.doneColor,
689
- "--cs-cg-failed": E?.failedColor,
690
- "--cs-text": D?.text,
691
- "--cs-row-hover": D?.rowHoverColor,
692
- "--cs-button-bg": D?.collapsedButtonBg,
693
- "--cs-stage-text": D?.stageTextColor,
694
- "--cs-failed-text": D?.failedColor,
695
- "--cs-tag-text": D?.tagTextColor,
696
- "--cs-count-text": D?.countTextColor,
697
- "--cs-duration-text": D?.durationTextColor,
698
- "--cs-icon-secondary": D?.iconSecondaryColor,
699
- "--cs-icon-completed": D?.iconCompletedColor,
700
- "--cs-icon-error": D?.iconErrorColor,
701
- "--cs-code-bg": D?.codeBg,
702
- "--cs-code-border": D?.codeBorderColor,
703
- "--cs-code-text": D?.codeTextColor,
704
- "--cs-border": D?.borderColor
767
+ let { colors: k, panel: A } = i ?? {}, j = i?.typography ?? { fontClassName: "dial-small-text" }, M = s({
768
+ "--cs-cg-label": k?.labelColor,
769
+ "--cs-cg-label-hover": k?.labelHoverColor,
770
+ "--cs-cg-steps-count": k?.stepsCountColor,
771
+ "--cs-cg-done": k?.doneColor,
772
+ "--cs-cg-failed": k?.failedColor,
773
+ "--cs-text": A?.text,
774
+ "--cs-row-hover": A?.rowHoverColor,
775
+ "--cs-button-bg": A?.collapsedButtonBg,
776
+ "--cs-stage-text": A?.stageTextColor,
777
+ "--cs-failed-text": A?.failedColor,
778
+ "--cs-tag-text": A?.tagTextColor,
779
+ "--cs-count-text": A?.countTextColor,
780
+ "--cs-duration-text": A?.durationTextColor,
781
+ "--cs-icon-secondary": A?.iconSecondaryColor,
782
+ "--cs-icon-completed": A?.iconCompletedColor,
783
+ "--cs-icon-error": A?.iconErrorColor,
784
+ "--cs-code-bg": A?.codeBg,
785
+ "--cs-code-border": A?.codeBorderColor,
786
+ "--cs-code-text": A?.codeTextColor,
787
+ "--cs-border": A?.borderColor
705
788
  });
706
789
  if (e.length === 0) return null;
707
- let A = {
790
+ let N = {
708
791
  copyAriaLabel: _,
709
792
  runningAriaLabel: g,
710
793
  failedAriaLabel: v,
711
794
  attemptLabel: b,
712
795
  attachmentClickLabel: x
713
796
  };
714
- if (e.length === 1) return /* @__PURE__ */ G(at, {
797
+ if (e.length === 1) return /* @__PURE__ */ G(mt, {
715
798
  stages: e,
716
799
  isStreaming: t,
800
+ expansion: T,
717
801
  className: r,
718
802
  styles: {
719
- colors: D,
803
+ colors: A,
720
804
  typography: i?.typography
721
805
  },
722
- labels: A,
806
+ labels: N,
723
807
  onAttachmentClick: a
724
808
  });
725
- let j = e.some((e) => e.status === o.Failed), M = Ae(e.map((e) => e.name)), N = M > 0 ? Oe(M) : void 0, P;
809
+ let P = e.some((e) => e.status === o.Failed), F = je(e.map((e) => e.name)), I = F > 0 ? ke(F) : void 0, L;
726
810
  if (t) {
727
- let t = J((je(e) ?? e[e.length - 1]).name).name;
728
- P = /* @__PURE__ */ K("span", {
811
+ let t = J((Me(e) ?? e[e.length - 1]).name).name;
812
+ L = /* @__PURE__ */ K("span", {
729
813
  role: "status",
730
814
  "aria-live": "polite",
731
815
  className: "flex min-w-0 items-center gap-2",
@@ -736,17 +820,17 @@ var q = {
736
820
  ariaLabel: g
737
821
  })
738
822
  }), t && /* @__PURE__ */ G("span", {
739
- className: c("min-w-0 max-w-[22rem] truncate", O.fontClassName, $.liveName),
823
+ className: c("min-w-0 max-w-[22rem] truncate", j.fontClassName, $.liveName),
740
824
  children: /* @__PURE__ */ G(h, { text: t })
741
825
  })]
742
826
  });
743
- } else if (j) {
827
+ } else if (P) {
744
828
  let t = e.filter((e) => e.status === o.Failed).length;
745
- P = /* @__PURE__ */ K("span", {
829
+ L = /* @__PURE__ */ K("span", {
746
830
  className: "inline-flex items-center gap-1",
747
831
  children: [
748
832
  /* @__PURE__ */ K("span", {
749
- className: c(O.fontClassName, $.executedLabel),
833
+ className: c(j.fontClassName, $.executedLabel),
750
834
  children: [
751
835
  l,
752
836
  " ",
@@ -756,16 +840,16 @@ var q = {
756
840
  ]
757
841
  }),
758
842
  /* @__PURE__ */ G("span", {
759
- className: c(O.fontClassName, $.failedText),
843
+ className: c(j.fontClassName, $.failedText),
760
844
  children: m(t)
761
845
  }),
762
- N && /* @__PURE__ */ G("span", {
763
- className: c(O.fontClassName, $.stepsCount),
764
- children: N
846
+ I && /* @__PURE__ */ G("span", {
847
+ className: c(j.fontClassName, $.stepsCount),
848
+ children: I
765
849
  })
766
850
  ]
767
851
  });
768
- } else P = /* @__PURE__ */ K("span", {
852
+ } else L = /* @__PURE__ */ K("span", {
769
853
  className: "inline-flex items-center gap-1",
770
854
  children: [
771
855
  /* @__PURE__ */ G(S, {
@@ -775,7 +859,7 @@ var q = {
775
859
  stroke: p
776
860
  }),
777
861
  /* @__PURE__ */ K("span", {
778
- className: c(O.fontClassName, $.executedLabel),
862
+ className: c(j.fontClassName, $.executedLabel),
779
863
  children: [
780
864
  l,
781
865
  " ",
@@ -784,30 +868,31 @@ var q = {
784
868
  u(e.length)
785
869
  ]
786
870
  }),
787
- N && /* @__PURE__ */ G("span", {
788
- className: c(O.fontClassName, $.stepsCount),
789
- children: N
871
+ I && /* @__PURE__ */ G("span", {
872
+ className: c(j.fontClassName, $.stepsCount),
873
+ children: I
790
874
  })
791
875
  ]
792
876
  });
793
877
  return /* @__PURE__ */ G("div", {
794
- style: k,
878
+ style: M,
795
879
  className: c("flex w-full flex-col gap-1", r, q.group),
796
880
  children: /* @__PURE__ */ G(d, {
797
- title: P,
881
+ title: L,
798
882
  expanded: C,
799
883
  onToggle: w,
800
884
  className: "overflow-visible py-0",
801
885
  headerClassName: c("justify-start gap-1 rounded-none px-0", $.toggleButton, q.groupToggle),
802
886
  contentClassName: c("-mt-2 px-0", $.groupRegion),
803
- children: C && /* @__PURE__ */ G(at, {
887
+ children: C && /* @__PURE__ */ G(mt, {
804
888
  stages: e,
805
889
  isStreaming: t,
890
+ expansion: T,
806
891
  styles: {
807
- colors: D,
892
+ colors: A,
808
893
  typography: i?.typography
809
894
  },
810
- labels: A,
895
+ labels: N,
811
896
  className: "pt-1",
812
897
  onAttachmentClick: a
813
898
  })
@@ -815,4 +900,4 @@ var q = {
815
900
  });
816
901
  };
817
902
  //#endregion
818
- export { q as CONVERSATION_STAGES_CLASS, ot as CollapsedGroup, at as StagesPanel };
903
+ export { q as CONVERSATION_STAGES_CLASS, gt as CollapsedGroup, ht as StagesPanel };