@redocly/replay 0.27.0-next.5 → 0.27.0-next.7

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 (52) hide show
  1. package/dist/{replay-AiChatProvider-CVvR1kSd.js → replay-AiChatProvider-Dub7iVgM.js} +273 -271
  2. package/dist/replay-AiChatProvider-e4PWUCRp.js +6 -0
  3. package/dist/{replay-AiChatSqliteDBStorage-DVJ9f2EK.js → replay-AiChatSqliteDBStorage-CpjwxLnF.js} +1 -1
  4. package/dist/{replay-AiChatSqliteDBStorage-BFHRKFlk.js → replay-AiChatSqliteDBStorage-DbxNU-ot.js} +1 -1
  5. package/dist/replay-AiPanel-B_zDmo55.js +868 -0
  6. package/dist/{replay-AiPanel-CynVcVmm.js → replay-AiPanel-DuRA2zAt.js} +1226 -1114
  7. package/dist/{replay-SqliteDBStorage-eRBPh4E8.js → replay-SqliteDBStorage-BrNleq7S.js} +1 -1
  8. package/dist/{replay-SqliteDBStorage-CSz7NYH4.js → replay-SqliteDBStorage-CafBNNLB.js} +1 -1
  9. package/dist/{replay-agent-loop-CEZz1kj-.js → replay-agent-loop-CV0s4022.js} +48 -48
  10. package/dist/{replay-agent-loop-C60p47KY.js → replay-agent-loop-CzV79Gr1.js} +1 -1
  11. package/dist/{replay-ai-chat-mappers-BAHU6JIc.js → replay-ai-chat-mappers-BNsR30dS.js} +1 -1
  12. package/dist/{replay-ai-chat-mappers-Dqg-QVZy.js → replay-ai-chat-mappers-BWeZN6p_.js} +1 -1
  13. package/dist/{replay-create-model-C2NQtDcL.js → replay-create-model-CEDEaJC8.js} +3 -3
  14. package/dist/{replay-create-model-CUL-l-eX.js → replay-create-model-CmRk68RD.js} +2 -2
  15. package/dist/{replay-db-C4jAfGtc.js → replay-db-BfSnfWcb.js} +8 -8
  16. package/dist/{replay-db-Dw-X2WGx.js → replay-db-CM8OLcFK.js} +21 -21
  17. package/dist/{replay-external-resolver-DAkLV0nr.js → replay-external-resolver-G86hjAvS.js} +2 -2
  18. package/dist/{replay-external-resolver-DN_PWq_2.js → replay-external-resolver-bdSEZsNk.js} +1 -1
  19. package/dist/{replay-index-BmX1FPBL.js → replay-index-BmotNqNI.js} +1170 -1148
  20. package/dist/replay-index-Bsag-eKM.js +1 -0
  21. package/dist/replay-index-C6SJPGDO.js +23 -0
  22. package/dist/replay-index-CUs62_1f.js +1 -0
  23. package/dist/{replay-index-rRWvC2pp.js → replay-index-C_eJVbPZ.js} +1 -1
  24. package/dist/{replay-index-O_Pq5an3.js → replay-index-Cd9LaUVx.js} +23380 -22731
  25. package/dist/{replay-index-m00jnWFr.js → replay-index-D58Mg6_y.js} +1 -1
  26. package/dist/{replay-index-DR1uVBvc.js → replay-index-DYtNY0OY.js} +42 -41
  27. package/dist/replay-lint-CxwKILeF.js +184 -0
  28. package/dist/{replay-lint-CcVVykW7.js → replay-lint-YfaLafO6.js} +8246 -8047
  29. package/dist/{replay-lint-graphql-DlD7bblx.js → replay-lint-graphql-BRrk1UK5.js} +1 -1
  30. package/dist/{replay-lint-graphql-5cGt2KR_.js → replay-lint-graphql-GtbZklco.js} +1 -1
  31. package/dist/replay-resolve-Bza6lozO.js +47 -0
  32. package/dist/{replay-resolve-Ca3DUbGq.js → replay-resolve-Rb3XjiUd.js} +919 -908
  33. package/dist/{replay-respect-run-eSRzH2dk.js → replay-respect-run-BB0VXCz-.js} +1605 -1555
  34. package/dist/replay-respect-run-Pkoy4Q3P.js +78 -0
  35. package/dist/{replay-tauri-path-C-oxFOHe.js → replay-tauri-path-B8tT4cGY.js} +2 -2
  36. package/dist/{replay-tauri-path-CKcvIl_h.js → replay-tauri-path-yOFqWleH.js} +1 -1
  37. package/dist/{replay-useAiChatQueries-CVTxcu2Z.js → replay-useAiChatQueries-1fqZwVTj.js} +71 -48
  38. package/dist/{replay-useAiChatQueries-vdKvbmp2.js → replay-useAiChatQueries-B7ZcWDmG.js} +1111 -990
  39. package/dist/{replay-validate-key-VkgZoK1f.js → replay-validate-key-C8-nF61w.js} +1 -1
  40. package/dist/{replay-validate-key-CwIopif3.js → replay-validate-key-qJOuAQJK.js} +2 -2
  41. package/dist/replay.cjs +1 -1
  42. package/dist/replay.d.ts +35 -5
  43. package/dist/replay.js +10 -10
  44. package/package.json +4 -4
  45. package/dist/replay-AiChatProvider-BGXsZqW2.js +0 -6
  46. package/dist/replay-AiPanel-qVp_s4gD.js +0 -849
  47. package/dist/replay-index-DSKZHOXq.js +0 -1
  48. package/dist/replay-index-DT5gdiBA.js +0 -21
  49. package/dist/replay-index-qZlgEmbq.js +0 -1
  50. package/dist/replay-lint-ON47l7Vu.js +0 -184
  51. package/dist/replay-resolve-BTzo-fSv.js +0 -47
  52. package/dist/replay-respect-run-BtC2agF9.js +0 -78
@@ -1,91 +1,13 @@
1
1
  import { jsx as i, jsxs as h, Fragment as Ne } from "react/jsx-runtime";
2
- import { useState as K, useEffect as H, useCallback as R, useMemo as S, Fragment as mt, useRef as F, useLayoutEffect as Fe, createContext as yt, useContext as xt } from "react";
3
- import s, { css as ue, keyframes as wt } from "styled-components";
4
- import { Tooltip as Y, AI_SEARCH_MAX_MESSAGE_LENGTH as bt, Button as V, SubtractIcon as Ct, AddIcon as kt, CheckmarkFilledIcon as Tt, CloseFilledIcon as At, CheckboxIcon as St, capitalize as Q, ChevronDownIcon as It, ChevronRightIcon as Lt, SettingsCogIcon as Pt, Dropdown as Et, DropdownMenu as Ot, DropdownMenuItem as je, CheckmarkIcon as Rt, ClaudeIcon as $t, GeminiIcon as Dt, ChatGptIcon as Mt, Typography as ne, TrashCanIcon as zt, AiStarsGradientIcon as _t, NewChatIcon as Vt, RecentlyViewedIcon as Bt, CloseIcon as Ht, ArrowLeftIcon as Nt } from "@redocly/theme";
5
- import { F as ye, G as Ue, T as Ft, H as xe, m as We, i as jt, j as Ut, J as Wt, K as fe, L as pe, N, O as ve, P as Yt, Q as Gt, U as Ye, V as Kt, W as qt, R as he, C as ce, X as Ge, o as Ke, Y as me, Z as W, _ as Zt } from "./replay-index-O_Pq5an3.js";
6
- import { k as Jt, l as Xt, n as Qt, T as en, p as tn, q as nn, t as qe, C as k, v as rn, x as Ze, L as on, y as q, z as an, B as sn, D as cn, E as ln, F as j } from "./replay-useAiChatQueries-vdKvbmp2.js";
7
- import { M as $ } from "./replay-db-Dw-X2WGx.js";
2
+ import { useCallback as D, useMemo as A, useState as G, Fragment as mt, useRef as N, useEffect as H, useLayoutEffect as Fe, createContext as yt, useContext as xt } from "react";
3
+ import c, { css as X, keyframes as bt } from "styled-components";
4
+ import { G as je, T as te, H as Ce, J as wt, b as Ct, m as We, i as kt, j as Tt, K as It, L as ge, N as ve, O as M, P as be, Q as At, U as St, V as Ue, W as Lt, X as Pt, R as me, E as pe, Y as ke, Z as Ye, p as Ge, _ as we, $ as W, a0 as Et } from "./replay-index-Cd9LaUVx.js";
5
+ import { l as Rt, n as Ot, p as $t, q as Dt, T as zt, t as Mt, v as _t, x as qe, C as k, y as Vt, z as Ke, L as Bt, B as Q, D as Ht, E as Nt, F as Ft, G as jt, H as F } from "./replay-useAiChatQueries-B7ZcWDmG.js";
6
+ import { AI_SEARCH_MAX_MESSAGE_LENGTH as Wt, Button as B, SubtractIcon as Ut, AddIcon as Yt, CheckmarkFilledIcon as Gt, CloseFilledIcon as qt, CheckboxIcon as Kt, capitalize as re, ChevronDownIcon as Zt, ChevronRightIcon as Jt, SettingsCogIcon as Xt, Dropdown as Qt, DropdownMenu as en, DropdownMenuItem as Ze, CheckmarkIcon as tn, ClaudeIcon as nn, GeminiIcon as on, ChatGptIcon as rn, Tooltip as U, Typography as se, TrashCanIcon as an, AiStarsGradientIcon as sn, NewChatIcon as cn, RecentlyViewedIcon as ln, CloseIcon as dn, ArrowLeftIcon as un } from "@redocly/theme";
7
+ import { M as z } from "./replay-db-CM8OLcFK.js";
8
8
  import "@tanstack/react-query";
9
- import { Link as dn } from "react-router-dom";
10
- const ee = s.div`
11
- width: var(--search-ai-thinking-dot-size);
12
- height: var(--search-ai-thinking-dot-size);
13
- border-radius: 50%;
14
- background: var(--search-ai-thinking-dot-color);
15
- animation: bounce 1.4s infinite ease-in-out;
16
-
17
- &:nth-child(1) {
18
- animation-delay: -0.32s;
19
- }
20
-
21
- &:nth-child(2) {
22
- animation-delay: -0.16s;
23
- }
24
-
25
- &:nth-child(3) {
26
- animation-delay: 0s;
27
- }
28
-
29
- @keyframes bounce {
30
- 0%,
31
- 80%,
32
- 100% {
33
- opacity: 0.2;
34
- transform: scale(0.8);
35
- }
36
- 40% {
37
- opacity: 1;
38
- transform: scale(1);
39
- }
40
- }
41
- `, Je = 280;
42
- function we() {
43
- const [e, t] = K(
44
- () => ye().getIndexingActivityState().inProgress
45
- );
46
- return H(() => ye().subscribe("indexing-activity", (r) => {
47
- t(r.inProgress);
48
- }), []), /* @__PURE__ */ i(un, { $open: e, children: /* @__PURE__ */ i(fn, { children: /* @__PURE__ */ i(pn, { $open: e, "aria-hidden": !e, children: /* @__PURE__ */ i(
49
- Y,
50
- {
51
- tip: "We're building a search index of your project. Until it's ready, the assistant may need more context in each reply to stay accurate, which can use more tokens.",
52
- placement: "top",
53
- width: "240px",
54
- arrowPosition: "left",
55
- children: /* @__PURE__ */ h(hn, { role: "status", "aria-live": "polite", "aria-label": "Indexing in progress...", children: [
56
- /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i(ee, {}) }),
57
- /* @__PURE__ */ i(gn, { children: "Indexing in progress..." })
58
- ] })
59
- }
60
- ) }) }) });
61
- }
62
- const un = s.div`
63
- display: grid;
64
- grid-template-rows: ${({ $open: e }) => e ? "1fr" : "0fr"};
65
- transition: grid-template-rows ${Je}ms ease-out;
66
- `, fn = s.div`
67
- min-height: 0;
68
- overflow: hidden;
69
- `, pn = s.div`
70
- opacity: ${({ $open: e }) => e ? 1 : 0};
71
- transition: opacity ${Je}ms ease-out;
72
- pointer-events: ${({ $open: e }) => e ? "auto" : "none"};
73
- padding: var(--spacing-xs);
74
- padding-top: var(--spacing-xxs);
75
- `, hn = s.div`
76
- width: 100%;
77
- display: flex;
78
- align-items: center;
79
- gap: var(--spacing-xxs);
80
- background: var(--layer-color);
81
- padding: var(--spacing-xs) var(--spacing-sm);
82
- border-radius: var(--border-radius);
83
- font-size: var(--font-size-sm);
84
- line-height: var(--line-height-sm);
85
- `, gn = s.div`
86
- flex: 1;
87
- min-width: 0;
88
- `, vn = (e) => /* @__PURE__ */ i(
9
+ import { Link as fn } from "react-router-dom";
10
+ const pn = (e) => /* @__PURE__ */ i(
89
11
  "svg",
90
12
  {
91
13
  width: "16",
@@ -102,79 +24,79 @@ const un = s.div`
102
24
  }
103
25
  )
104
26
  }
105
- ), mn = s(vn).attrs({
27
+ ), hn = c(pn).attrs({
106
28
  "data-component-name": "icons/SendIcon/SendIcon"
107
29
  })`
108
30
  path {
109
- fill: ${({ color: e }) => Ue(e)};
31
+ fill: ${({ color: e }) => je(e)};
110
32
  }
111
33
 
112
34
  height: ${({ size: e }) => e || "16px"};
113
35
  width: ${({ size: e }) => e || "16px"};
114
- `, yn = (e) => /* @__PURE__ */ i("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 14 14", fill: "none", ...e, children: /* @__PURE__ */ i("path", { d: "M10.5 3.5V10.5H3.5V3.5H10.5ZM10.5 2.625H3.5C3.26794 2.625 3.04538 2.71719 2.88128 2.88128C2.71719 3.04538 2.625 3.26794 2.625 3.5V10.5C2.625 10.7321 2.71719 10.9546 2.88128 11.1187C3.04538 11.2828 3.26794 11.375 3.5 11.375H10.5C10.7321 11.375 10.9546 11.2828 11.1187 11.1187C11.2828 10.9546 11.375 10.7321 11.375 10.5V3.5C11.375 3.26794 11.2828 3.04538 11.1187 2.88128C10.9546 2.71719 10.7321 2.625 10.5 2.625Z" }) }), xn = s(yn).attrs({
36
+ `, gn = (e) => /* @__PURE__ */ i("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 14 14", fill: "none", ...e, children: /* @__PURE__ */ i("path", { d: "M10.5 3.5V10.5H3.5V3.5H10.5ZM10.5 2.625H3.5C3.26794 2.625 3.04538 2.71719 2.88128 2.88128C2.71719 3.04538 2.625 3.26794 2.625 3.5V10.5C2.625 10.7321 2.71719 10.9546 2.88128 11.1187C3.04538 11.2828 3.26794 11.375 3.5 11.375H10.5C10.7321 11.375 10.9546 11.2828 11.1187 11.1187C11.2828 10.9546 11.375 10.7321 11.375 10.5V3.5C11.375 3.26794 11.2828 3.04538 11.1187 2.88128C10.9546 2.71719 10.7321 2.625 10.5 2.625Z" }) }), vn = c(gn).attrs({
115
37
  "data-component-name": "icons/StopIcon/StopIcon"
116
38
  })`
117
39
  path {
118
- fill: ${({ color: e }) => Ue(e)};
40
+ fill: ${({ color: e }) => je(e)};
119
41
  }
120
42
 
121
43
  height: ${({ size: e }) => e || "16px"};
122
44
  width: ${({ size: e }) => e || "16px"};
123
45
  `;
124
- function wn({
46
+ function mn({
125
47
  placeholder: e = "Ask anything...",
126
48
  className: t,
127
49
  disabled: n,
128
- isStreaming: r = !1,
129
- onStop: o,
50
+ isStreaming: o = !1,
51
+ onStop: r,
130
52
  modelSelector: a,
131
- value: c,
53
+ value: s,
132
54
  onValueChange: d,
133
55
  onSubmit: l,
134
56
  textareaRef: u
135
57
  }) {
136
- const f = c.trim(), p = !n && f.length > 0 && !r, g = !n && f.length > 0, y = (b) => {
137
- d(b.target.value);
58
+ const f = s.trim(), p = !n && f.length > 0 && !o, g = !n && f.length > 0, m = (w) => {
59
+ d(w.target.value);
138
60
  }, v = () => {
139
- !f || n || r || l();
61
+ !f || n || o || l();
140
62
  }, x = () => {
141
- !r || !o || o();
63
+ !o || !r || r();
142
64
  };
143
- return /* @__PURE__ */ h(bn, { className: t, $isActive: g, children: [
65
+ return /* @__PURE__ */ h(yn, { className: t, $isActive: g, children: [
144
66
  /* @__PURE__ */ i(
145
- Cn,
67
+ xn,
146
68
  {
147
69
  ref: u,
148
70
  rows: 1,
149
- maxLength: bt,
71
+ maxLength: Wt,
150
72
  placeholder: e,
151
- value: c,
73
+ value: s,
152
74
  disabled: n,
153
75
  spellCheck: !1,
154
- onChange: y,
155
- onKeyDown: (b) => {
156
- b.key === "Enter" && !b.shiftKey && !b.nativeEvent.isComposing && (b.preventDefault(), r && o ? x() : v());
76
+ onChange: m,
77
+ onKeyDown: (w) => {
78
+ w.key === "Enter" && !w.shiftKey && !w.nativeEvent.isComposing && (w.preventDefault(), o && r ? x() : v());
157
79
  }
158
80
  }
159
81
  ),
160
- /* @__PURE__ */ h(kn, { children: [
82
+ /* @__PURE__ */ h(bn, { children: [
161
83
  a,
162
- r && o ? /* @__PURE__ */ i(
163
- An,
84
+ o && r ? /* @__PURE__ */ i(
85
+ Cn,
164
86
  {
165
87
  type: "button",
166
88
  size: "small",
167
89
  "aria-label": "Stop generating",
168
- icon: /* @__PURE__ */ i(xn, { color: "var(--icon-color-on-color)" }),
90
+ icon: /* @__PURE__ */ i(vn, { color: "var(--icon-color-on-color)" }),
169
91
  onClick: x
170
92
  }
171
93
  ) : /* @__PURE__ */ i(
172
- Tn,
94
+ wn,
173
95
  {
174
96
  type: "button",
175
97
  size: "small",
176
98
  "aria-label": "Send message",
177
- icon: /* @__PURE__ */ i(mn, { color: "var(--icon-color-on-color)" }),
99
+ icon: /* @__PURE__ */ i(hn, { color: "var(--icon-color-on-color)" }),
178
100
  onClick: v,
179
101
  disabled: !p
180
102
  }
@@ -182,7 +104,7 @@ function wn({
182
104
  ] })
183
105
  ] });
184
106
  }
185
- const bn = s.div`
107
+ const yn = c.div`
186
108
  display: flex;
187
109
  flex-direction: column;
188
110
  gap: var(--spacing-xs);
@@ -201,13 +123,13 @@ const bn = s.div`
201
123
  var(--replay-ai-gradient-soft) border-box;
202
124
  }
203
125
 
204
- ${({ $isActive: e }) => e && ue`
126
+ ${({ $isActive: e }) => e && X`
205
127
  border-color: transparent;
206
128
  background:
207
129
  linear-gradient(var(--layer-color), var(--layer-color)) padding-box,
208
130
  var(--replay-ai-gradient-soft) border-box;
209
131
  `}
210
- `, Cn = s.textarea`
132
+ `, xn = c.textarea`
211
133
  max-height: 150px;
212
134
  min-height: var(--search-ai-conversation-input-min-height);
213
135
 
@@ -227,12 +149,12 @@ const bn = s.div`
227
149
  color: var(--text-color-helper);
228
150
  text-indent: 2px;
229
151
  }
230
- `, kn = s.div`
152
+ `, bn = c.div`
231
153
  display: flex;
232
154
  justify-content: space-between;
233
155
  align-items: center;
234
156
  gap: var(--spacing-xs);
235
- `, Tn = s(V)`
157
+ `, wn = c(B)`
236
158
  box-sizing: border-box;
237
159
  background: var(--search-ai-gradient);
238
160
 
@@ -242,26 +164,26 @@ const bn = s.div`
242
164
  width: 24px;
243
165
  height: 24px;
244
166
  }
245
- `, An = s(V)`
167
+ `, Cn = c(B)`
246
168
  box-sizing: border-box;
247
169
  background: var(--color-warm-grey-9);
248
170
  border-radius: var(--border-radius-xxl);
249
- `, Sn = /* @__PURE__ */ new Set(["collection", "workflow", "step", "operation", "workflow-run"]);
250
- function Xe(e) {
171
+ `, kn = /* @__PURE__ */ new Set(["collection", "workflow", "step", "operation", "workflow-run"]);
172
+ function Je(e) {
251
173
  return `replay://step?${new URLSearchParams({
252
174
  collectionId: e.collectionId.trim(),
253
175
  workflowId: e.workflowId.trim(),
254
176
  stepId: e.stepId.trim()
255
177
  }).toString()}`;
256
178
  }
257
- function M(e, t) {
179
+ function O(e, t) {
258
180
  const n = e.get(t);
259
181
  if (n == null)
260
182
  return null;
261
- const r = n.trim();
262
- return r.length > 0 ? r : null;
183
+ const o = n.trim();
184
+ return o.length > 0 ? o : null;
263
185
  }
264
- function In(e) {
186
+ function Tn(e) {
265
187
  let t;
266
188
  try {
267
189
  t = new URL(e);
@@ -271,47 +193,57 @@ function In(e) {
271
193
  if (t.protocol !== "replay:")
272
194
  return null;
273
195
  const n = t.hostname.toLowerCase();
274
- if (!Sn.has(n))
196
+ if (!kn.has(n))
275
197
  return null;
276
- const r = t.searchParams;
198
+ const o = t.searchParams;
277
199
  switch (n) {
278
200
  case "collection": {
279
- const o = M(r, "collectionId");
280
- return o ? { kind: "collection", collectionId: o } : null;
201
+ const r = O(o, "collectionId");
202
+ return r ? { kind: "collection", collectionId: r } : null;
281
203
  }
282
204
  case "workflow": {
283
- const o = M(r, "collectionId"), a = M(r, "workflowId");
284
- return !o || !a ? null : { kind: "workflow", collectionId: o, workflowId: a };
205
+ const r = O(o, "collectionId"), a = O(o, "workflowId");
206
+ return !r || !a ? null : { kind: "workflow", collectionId: r, workflowId: a };
285
207
  }
286
208
  case "step": {
287
- const o = M(r, "collectionId"), a = M(r, "workflowId"), c = M(r, "stepId");
288
- return !o || !a || !c ? null : { kind: "step", collectionId: o, workflowId: a, stepId: c };
209
+ const r = O(o, "collectionId"), a = O(o, "workflowId"), s = O(o, "stepId");
210
+ return !r || !a || !s ? null : { kind: "step", collectionId: r, workflowId: a, stepId: s };
289
211
  }
290
212
  case "operation": {
291
- const o = M(r, "operationId");
292
- return o ? { kind: "operation", operationId: o } : null;
213
+ const r = O(o, "operationId");
214
+ return r ? { kind: "operation", operationId: r } : null;
293
215
  }
294
216
  case "workflow-run": {
295
- const o = M(r, "collectionId"), a = M(r, "workflowId");
296
- return !o || !a ? null : { kind: "workflow-run", collectionId: o, workflowId: a };
217
+ const r = O(o, "collectionId"), a = O(o, "workflowId");
218
+ if (!r || !a) return null;
219
+ const s = O(o, "historyId"), d = s === "null" || s === "undefined" ? null : s;
220
+ return {
221
+ kind: "workflow-run",
222
+ collectionId: r,
223
+ workflowId: a,
224
+ ...d ? { historyId: d } : {}
225
+ };
297
226
  }
298
227
  default:
299
228
  return null;
300
229
  }
301
230
  }
302
- function Ln(e, t, n) {
231
+ function In(e, t, n) {
232
+ return e.tabsState.tabs.get({ noproxy: !0 }).findIndex(({ data: o }) => wt(o, Ct.WorkflowRun) && o.collectionId === t && o.workflowId === n);
233
+ }
234
+ function An(e, t, n, o = {}) {
303
235
  switch (n.kind) {
304
236
  case "collection":
305
237
  t.openCollectionTab({
306
238
  collectionId: n.collectionId,
307
- activeTabName: xe.COLLECTION_SETTINGS
239
+ activeTabName: Ce.COLLECTION_SETTINGS
308
240
  });
309
241
  break;
310
242
  case "workflow":
311
243
  t.openWorkflowTab({
312
244
  collectionId: n.collectionId,
313
245
  workflowId: n.workflowId,
314
- activeTabName: xe.WORKFLOW_SETTINGS
246
+ activeTabName: Ce.WORKFLOW_SETTINGS
315
247
  });
316
248
  break;
317
249
  case "step":
@@ -319,17 +251,32 @@ function Ln(e, t, n) {
319
251
  collectionId: n.collectionId,
320
252
  workflowId: n.workflowId,
321
253
  stepId: n.stepId,
322
- state: Ft.Normal
254
+ state: te.Normal
323
255
  });
324
256
  break;
325
- case "workflow-run":
257
+ case "workflow-run": {
258
+ const r = o.workflowRunHistoryIds?.[Dt(n.collectionId, n.workflowId)] ?? [], a = n.historyId && r.includes(n.historyId) ? n.historyId : r.at(-1) ?? n.historyId;
259
+ if (a) {
260
+ t.openWorkflowRunTabFromHistory(a, { state: te.Normal });
261
+ break;
262
+ }
263
+ const s = In(
264
+ e,
265
+ n.collectionId,
266
+ n.workflowId
267
+ );
268
+ if (s !== -1) {
269
+ e.tabsState.tabs.get({ noproxy: !0 })[s].state === te.Preview && t.changeTabState(s, te.Normal), t.handleTabChange(s);
270
+ break;
271
+ }
326
272
  t.openWorkflowRunTab({
327
273
  collectionId: n.collectionId,
328
274
  workflowId: n.workflowId
329
275
  });
330
276
  break;
277
+ }
331
278
  case "operation": {
332
- const r = Jt(e, n.operationId);
279
+ const r = Rt(e, n.operationId);
333
280
  if (!r.ok) {
334
281
  console.warn("[executeReplayChatLink] Operation not resolved", {
335
282
  operationId: n.operationId,
@@ -337,148 +284,158 @@ function Ln(e, t, n) {
337
284
  });
338
285
  return;
339
286
  }
340
- Xt(
287
+ Ot(
341
288
  e,
342
- Qt(r.value),
289
+ $t(r.value),
343
290
  t
344
291
  );
345
292
  break;
346
293
  }
347
294
  }
348
295
  }
349
- function Pn(e, t, n) {
350
- const r = In(n);
351
- r && Ln(e, t, r);
296
+ function Sn(e, t, n, o = {}) {
297
+ const r = Tn(n);
298
+ r && An(e, t, r, o);
352
299
  }
353
- function Qe() {
354
- const e = We(), { getApiOperation: t } = jt(), {
355
- handleTabChange: n,
300
+ function Xe({
301
+ workflowRunHistoryIds: e
302
+ } = {}) {
303
+ const t = We(), { getApiOperation: n } = kt(), {
304
+ handleTabChange: o,
356
305
  addNewTab: r,
357
- openCollectionTab: o,
358
- openWorkflowTab: a,
359
- openStepTabFromCollection: c,
360
- openWorkflowRunTab: d
361
- } = Ut();
362
- return R(
363
- (l) => {
364
- const u = l.target;
365
- if (!(u instanceof Element))
306
+ openCollectionTab: a,
307
+ openWorkflowTab: s,
308
+ openStepTabFromCollection: d,
309
+ openWorkflowRunTab: l,
310
+ openWorkflowRunTabFromHistory: u,
311
+ changeTabState: f
312
+ } = Tt();
313
+ return D(
314
+ (p) => {
315
+ const g = p.target;
316
+ if (!(g instanceof Element))
366
317
  return;
367
- const f = u.closest("a[href]");
368
- if (!(f instanceof HTMLAnchorElement))
318
+ const m = g.closest("a[href]");
319
+ if (!(m instanceof HTMLAnchorElement))
369
320
  return;
370
- const p = f.getAttribute("href");
371
- p?.startsWith("replay:") && (l.preventDefault(), l.stopPropagation(), Pn(
372
- e,
321
+ const v = m.getAttribute("href");
322
+ v?.startsWith("replay:") && (p.preventDefault(), p.stopPropagation(), Sn(
323
+ t,
373
324
  {
374
- getApiOperation: t,
375
- handleTabChange: n,
325
+ getApiOperation: n,
326
+ handleTabChange: o,
376
327
  addNewTab: r,
377
- openCollectionTab: o,
378
- openWorkflowTab: a,
379
- openStepTabFromCollection: c,
380
- openWorkflowRunTab: d
328
+ openCollectionTab: a,
329
+ openWorkflowTab: s,
330
+ openStepTabFromCollection: d,
331
+ openWorkflowRunTab: l,
332
+ openWorkflowRunTabFromHistory: u,
333
+ changeTabState: f
381
334
  },
382
- p
335
+ v,
336
+ { workflowRunHistoryIds: e }
383
337
  ));
384
338
  },
385
339
  [
386
340
  e,
387
341
  t,
388
342
  n,
389
- r,
390
343
  o,
344
+ r,
391
345
  a,
392
- c,
393
- d
346
+ s,
347
+ d,
348
+ l,
349
+ u,
350
+ f
394
351
  ]
395
352
  );
396
353
  }
397
- class En {
398
- diff(t, n, r = {}) {
399
- let o;
400
- typeof r == "function" ? (o = r, r = {}) : "callback" in r && (o = r.callback);
401
- const a = this.castInput(t, r), c = this.castInput(n, r), d = this.removeEmpty(this.tokenize(a, r)), l = this.removeEmpty(this.tokenize(c, r));
402
- return this.diffWithOptionsObj(d, l, r, o);
354
+ class Ln {
355
+ diff(t, n, o = {}) {
356
+ let r;
357
+ typeof o == "function" ? (r = o, o = {}) : "callback" in o && (r = o.callback);
358
+ const a = this.castInput(t, o), s = this.castInput(n, o), d = this.removeEmpty(this.tokenize(a, o)), l = this.removeEmpty(this.tokenize(s, o));
359
+ return this.diffWithOptionsObj(d, l, o, r);
403
360
  }
404
- diffWithOptionsObj(t, n, r, o) {
361
+ diffWithOptionsObj(t, n, o, r) {
405
362
  var a;
406
- const c = (m) => {
407
- if (m = this.postProcess(m, r), o) {
363
+ const s = (y) => {
364
+ if (y = this.postProcess(y, o), r) {
408
365
  setTimeout(function() {
409
- o(m);
366
+ r(y);
410
367
  }, 0);
411
368
  return;
412
369
  } else
413
- return m;
370
+ return y;
414
371
  }, d = n.length, l = t.length;
415
372
  let u = 1, f = d + l;
416
- r.maxEditLength != null && (f = Math.min(f, r.maxEditLength));
417
- const p = (a = r.timeout) !== null && a !== void 0 ? a : 1 / 0, g = Date.now() + p, y = [{ oldPos: -1, lastComponent: void 0 }];
418
- let v = this.extractCommon(y[0], n, t, 0, r);
419
- if (y[0].oldPos + 1 >= l && v + 1 >= d)
420
- return c(this.buildValues(y[0].lastComponent, n, t));
421
- let x = -1 / 0, w = 1 / 0;
422
- const b = () => {
423
- for (let m = Math.max(x, -u); m <= Math.min(w, u); m += 2) {
424
- let I;
425
- const z = y[m - 1], P = y[m + 1];
426
- z && (y[m - 1] = void 0);
427
- let D = !1;
428
- if (P) {
429
- const J = P.oldPos - m;
430
- D = P && 0 <= J && J < d;
373
+ o.maxEditLength != null && (f = Math.min(f, o.maxEditLength));
374
+ const p = (a = o.timeout) !== null && a !== void 0 ? a : 1 / 0, g = Date.now() + p, m = [{ oldPos: -1, lastComponent: void 0 }];
375
+ let v = this.extractCommon(m[0], n, t, 0, o);
376
+ if (m[0].oldPos + 1 >= l && v + 1 >= d)
377
+ return s(this.buildValues(m[0].lastComponent, n, t));
378
+ let x = -1 / 0, b = 1 / 0;
379
+ const w = () => {
380
+ for (let y = Math.max(x, -u); y <= Math.min(b, u); y += 2) {
381
+ let S;
382
+ const E = m[y - 1], R = m[y + 1];
383
+ E && (m[y - 1] = void 0);
384
+ let q = !1;
385
+ if (R) {
386
+ const ee = R.oldPos - y;
387
+ q = R && 0 <= ee && ee < d;
431
388
  }
432
- const Z = z && z.oldPos + 1 < l;
433
- if (!D && !Z) {
434
- y[m] = void 0;
389
+ const _ = E && E.oldPos + 1 < l;
390
+ if (!q && !_) {
391
+ m[y] = void 0;
435
392
  continue;
436
393
  }
437
- if (!Z || D && z.oldPos < P.oldPos ? I = this.addToPath(P, !0, !1, 0, r) : I = this.addToPath(z, !1, !0, 1, r), v = this.extractCommon(I, n, t, m, r), I.oldPos + 1 >= l && v + 1 >= d)
438
- return c(this.buildValues(I.lastComponent, n, t)) || !0;
439
- y[m] = I, I.oldPos + 1 >= l && (w = Math.min(w, m - 1)), v + 1 >= d && (x = Math.max(x, m + 1));
394
+ if (!_ || q && E.oldPos < R.oldPos ? S = this.addToPath(R, !0, !1, 0, o) : S = this.addToPath(E, !1, !0, 1, o), v = this.extractCommon(S, n, t, y, o), S.oldPos + 1 >= l && v + 1 >= d)
395
+ return s(this.buildValues(S.lastComponent, n, t)) || !0;
396
+ m[y] = S, S.oldPos + 1 >= l && (b = Math.min(b, y - 1)), v + 1 >= d && (x = Math.max(x, y + 1));
440
397
  }
441
398
  u++;
442
399
  };
443
- if (o)
444
- (function m() {
400
+ if (r)
401
+ (function y() {
445
402
  setTimeout(function() {
446
403
  if (u > f || Date.now() > g)
447
- return o(void 0);
448
- b() || m();
404
+ return r(void 0);
405
+ w() || y();
449
406
  }, 0);
450
407
  })();
451
408
  else
452
409
  for (; u <= f && Date.now() <= g; ) {
453
- const m = b();
454
- if (m)
455
- return m;
410
+ const y = w();
411
+ if (y)
412
+ return y;
456
413
  }
457
414
  }
458
- addToPath(t, n, r, o, a) {
459
- const c = t.lastComponent;
460
- return c && !a.oneChangePerToken && c.added === n && c.removed === r ? {
461
- oldPos: t.oldPos + o,
462
- lastComponent: { count: c.count + 1, added: n, removed: r, previousComponent: c.previousComponent }
415
+ addToPath(t, n, o, r, a) {
416
+ const s = t.lastComponent;
417
+ return s && !a.oneChangePerToken && s.added === n && s.removed === o ? {
418
+ oldPos: t.oldPos + r,
419
+ lastComponent: { count: s.count + 1, added: n, removed: o, previousComponent: s.previousComponent }
463
420
  } : {
464
- oldPos: t.oldPos + o,
465
- lastComponent: { count: 1, added: n, removed: r, previousComponent: c }
421
+ oldPos: t.oldPos + r,
422
+ lastComponent: { count: 1, added: n, removed: o, previousComponent: s }
466
423
  };
467
424
  }
468
- extractCommon(t, n, r, o, a) {
469
- const c = n.length, d = r.length;
470
- let l = t.oldPos, u = l - o, f = 0;
471
- for (; u + 1 < c && l + 1 < d && this.equals(r[l + 1], n[u + 1], a); )
425
+ extractCommon(t, n, o, r, a) {
426
+ const s = n.length, d = o.length;
427
+ let l = t.oldPos, u = l - r, f = 0;
428
+ for (; u + 1 < s && l + 1 < d && this.equals(o[l + 1], n[u + 1], a); )
472
429
  u++, l++, f++, a.oneChangePerToken && (t.lastComponent = { count: 1, previousComponent: t.lastComponent, added: !1, removed: !1 });
473
430
  return f && !a.oneChangePerToken && (t.lastComponent = { count: f, previousComponent: t.lastComponent, added: !1, removed: !1 }), t.oldPos = l, u;
474
431
  }
475
- equals(t, n, r) {
476
- return r.comparator ? r.comparator(t, n) : t === n || !!r.ignoreCase && t.toLowerCase() === n.toLowerCase();
432
+ equals(t, n, o) {
433
+ return o.comparator ? o.comparator(t, n) : t === n || !!o.ignoreCase && t.toLowerCase() === n.toLowerCase();
477
434
  }
478
435
  removeEmpty(t) {
479
436
  const n = [];
480
- for (let r = 0; r < t.length; r++)
481
- t[r] && n.push(t[r]);
437
+ for (let o = 0; o < t.length; o++)
438
+ t[o] && n.push(t[o]);
482
439
  return n;
483
440
  }
484
441
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -498,23 +455,23 @@ class En {
498
455
  get useLongestToken() {
499
456
  return !1;
500
457
  }
501
- buildValues(t, n, r) {
502
- const o = [];
458
+ buildValues(t, n, o) {
459
+ const r = [];
503
460
  let a;
504
461
  for (; t; )
505
- o.push(t), a = t.previousComponent, delete t.previousComponent, t = a;
506
- o.reverse();
507
- const c = o.length;
462
+ r.push(t), a = t.previousComponent, delete t.previousComponent, t = a;
463
+ r.reverse();
464
+ const s = r.length;
508
465
  let d = 0, l = 0, u = 0;
509
- for (; d < c; d++) {
510
- const f = o[d];
466
+ for (; d < s; d++) {
467
+ const f = r[d];
511
468
  if (f.removed)
512
- f.value = this.join(r.slice(u, u + f.count)), u += f.count;
469
+ f.value = this.join(o.slice(u, u + f.count)), u += f.count;
513
470
  else {
514
471
  if (!f.added && this.useLongestToken) {
515
472
  let p = n.slice(l, l + f.count);
516
- p = p.map(function(g, y) {
517
- const v = r[u + y];
473
+ p = p.map(function(g, m) {
474
+ const v = o[u + m];
518
475
  return v.length > g.length ? v : g;
519
476
  }), f.value = this.join(p);
520
477
  } else
@@ -522,114 +479,114 @@ class En {
522
479
  l += f.count, f.added || (u += f.count);
523
480
  }
524
481
  }
525
- return o;
482
+ return r;
526
483
  }
527
484
  }
528
- class On extends En {
485
+ class Pn extends Ln {
529
486
  constructor() {
530
- super(...arguments), this.tokenize = Dn;
487
+ super(...arguments), this.tokenize = On;
531
488
  }
532
- equals(t, n, r) {
533
- return r.ignoreWhitespace ? ((!r.newlineIsToken || !t.includes(`
534
- `)) && (t = t.trim()), (!r.newlineIsToken || !n.includes(`
535
- `)) && (n = n.trim())) : r.ignoreNewlineAtEof && !r.newlineIsToken && (t.endsWith(`
489
+ equals(t, n, o) {
490
+ return o.ignoreWhitespace ? ((!o.newlineIsToken || !t.includes(`
491
+ `)) && (t = t.trim()), (!o.newlineIsToken || !n.includes(`
492
+ `)) && (n = n.trim())) : o.ignoreNewlineAtEof && !o.newlineIsToken && (t.endsWith(`
536
493
  `) && (t = t.slice(0, -1)), n.endsWith(`
537
- `) && (n = n.slice(0, -1))), super.equals(t, n, r);
494
+ `) && (n = n.slice(0, -1))), super.equals(t, n, o);
538
495
  }
539
496
  }
540
- const Rn = new On();
541
- function $n(e, t, n) {
542
- return Rn.diff(e, t, n);
497
+ const En = new Pn();
498
+ function Rn(e, t, n) {
499
+ return En.diff(e, t, n);
543
500
  }
544
- function Dn(e, t) {
501
+ function On(e, t) {
545
502
  t.stripTrailingCr && (e = e.replace(/\r\n/g, `
546
503
  `));
547
- const n = [], r = e.split(/(\n|\r\n)/);
548
- r[r.length - 1] || r.pop();
549
- for (let o = 0; o < r.length; o++) {
550
- const a = r[o];
551
- o % 2 && !t.newlineIsToken ? n[n.length - 1] += a : n.push(a);
504
+ const n = [], o = e.split(/(\n|\r\n)/);
505
+ o[o.length - 1] || o.pop();
506
+ for (let r = 0; r < o.length; r++) {
507
+ const a = o[r];
508
+ r % 2 && !t.newlineIsToken ? n[n.length - 1] += a : n.push(a);
552
509
  }
553
510
  return n;
554
511
  }
555
- const Mn = 500;
556
- function zn(e, t) {
557
- const n = _n(e, t);
512
+ const $n = 500;
513
+ function Dn(e, t) {
514
+ const n = zn(e, t);
558
515
  if (n.length === 0) return [];
559
- const r = [];
560
- let o = 0;
561
- for (; o < n.length; ) {
562
- let a = o;
563
- const c = n[o].type === "context";
564
- for (; a < n.length && n[a].type === "context" === c; ) a++;
565
- const d = n.slice(o, a);
566
- r.push({
567
- start: o,
516
+ const o = [];
517
+ let r = 0;
518
+ for (; r < n.length; ) {
519
+ let a = r;
520
+ const s = n[r].type === "context";
521
+ for (; a < n.length && n[a].type === "context" === s; ) a++;
522
+ const d = n.slice(r, a);
523
+ o.push({
524
+ start: r,
568
525
  end: a,
569
526
  rows: d,
570
527
  hasAdditions: d.some((l) => l.type === "add"),
571
528
  hasRemovals: d.some((l) => l.type === "remove")
572
- }), o = a;
529
+ }), r = a;
573
530
  }
574
- return r;
531
+ return o;
575
532
  }
576
- function _n(e, t) {
533
+ function zn(e, t) {
577
534
  if (e === void 0)
578
- return t === void 0 ? [] : U(t, "add");
579
- if (t === void 0) return U(e, "remove");
580
- if (e === t) return U(t, "context");
581
- const n = Vn(e, t);
535
+ return t === void 0 ? [] : j(t, "add");
536
+ if (t === void 0) return j(e, "remove");
537
+ if (e === t) return j(t, "context");
538
+ const n = Mn(e, t);
582
539
  return n ? n.flatMap(
583
- (r) => U(r.value, r.added ? "add" : r.removed ? "remove" : "context")
584
- ) : [...U(e, "remove"), ...U(t, "add")];
540
+ (o) => j(o.value, o.added ? "add" : o.removed ? "remove" : "context")
541
+ ) : [...j(e, "remove"), ...j(t, "add")];
585
542
  }
586
- function Vn(e, t) {
543
+ function Mn(e, t) {
587
544
  try {
588
- return $n(e, t, { timeout: Mn });
545
+ return Rn(e, t, { timeout: $n });
589
546
  } catch {
590
547
  return;
591
548
  }
592
549
  }
593
- function U(e, t) {
550
+ function j(e, t) {
594
551
  const n = e.split(`
595
552
  `);
596
- return n.length > 1 && n[n.length - 1] === "" && n.pop(), n.map((r) => ({ type: t, text: r }));
553
+ return n.length > 1 && n[n.length - 1] === "" && n.pop(), n.map((o) => ({ type: t, text: o }));
597
554
  }
598
- const be = 1, Ce = (e) => e && e.hasAdditions !== e.hasRemovals, ke = (e) => e && (e.hasAdditions || e.hasRemovals);
599
- function Bn(e, t, n) {
555
+ const Te = 1, Ie = (e) => e && e.hasAdditions !== e.hasRemovals, Ae = (e) => e && (e.hasAdditions || e.hasRemovals);
556
+ function _n(e, t, n) {
600
557
  if (e.hasAdditions || e.hasRemovals)
601
- return X(e.rows);
602
- const r = n[t - 1], o = n[t + 1], a = Ce(r) ? be : 0, c = Ce(o) ? be : 0;
603
- if (a + c >= e.rows.length) return X(e.rows);
604
- const d = e.rows.slice(0, a), l = c > 0 ? e.rows.slice(-c) : [], u = [];
605
- return u.push(...X(d)), ke(r) && ke(o) && u.push({ kind: "separator" }), u.push(...X(l)), u;
558
+ return ne(e.rows);
559
+ const o = n[t - 1], r = n[t + 1], a = Ie(o) ? Te : 0, s = Ie(r) ? Te : 0;
560
+ if (a + s >= e.rows.length) return ne(e.rows);
561
+ const d = e.rows.slice(0, a), l = s > 0 ? e.rows.slice(-s) : [], u = [];
562
+ return u.push(...ne(d)), Ae(o) && Ae(r) && u.push({ kind: "separator" }), u.push(...ne(l)), u;
606
563
  }
607
- function X(e) {
564
+ function ne(e) {
608
565
  return e.map((t) => ({
609
566
  kind: "row",
610
567
  row: t
611
568
  }));
612
569
  }
613
- const Hn = 200;
614
- function Te({ oldValue: e, newValue: t }) {
615
- const n = S(() => zn(e, t), [e, t]), r = S(() => n.flatMap(Bn), [n]);
616
- return S(() => n.some((a) => a.hasAdditions || a.hasRemovals), [n]) ? /* @__PURE__ */ i(Fn, { $maxHeight: Hn, children: r.map((a, c) => {
570
+ const Vn = 200;
571
+ function Se({ oldValue: e, newValue: t }) {
572
+ const n = A(() => Dn(e, t), [e, t]), o = A(() => n.flatMap(_n), [n]);
573
+ return A(() => n.some((a) => a.hasAdditions || a.hasRemovals), [n]) ? /* @__PURE__ */ i(Hn, { $maxHeight: Vn, children: o.map((a, s) => {
617
574
  if (a.kind === "separator")
618
- return /* @__PURE__ */ i(Gn, { children: /* @__PURE__ */ i(Ae, { children: "···" }) }, c);
619
- const { row: d } = a, l = Nn(d.type);
575
+ return /* @__PURE__ */ i(Un, { children: /* @__PURE__ */ i(Le, { children: "···" }) }, s);
576
+ const { row: d } = a, l = Bn(d.type);
620
577
  return /* @__PURE__ */ h(l, { children: [
621
- /* @__PURE__ */ h(Yn, { children: [
622
- d.type === "remove" && /* @__PURE__ */ i(Ct, { size: "12px" }),
623
- d.type === "add" && /* @__PURE__ */ i(kt, { size: "12px" })
578
+ /* @__PURE__ */ h(Wn, { children: [
579
+ d.type === "remove" && /* @__PURE__ */ i(Ut, { size: "12px" }),
580
+ d.type === "add" && /* @__PURE__ */ i(Yt, { size: "12px" })
624
581
  ] }),
625
- /* @__PURE__ */ i(Ae, { children: d.text === "" ? " " : d.text })
626
- ] }, c);
582
+ /* @__PURE__ */ i(Le, { children: d.text === "" ? " " : d.text })
583
+ ] }, s);
627
584
  }) }) : null;
628
585
  }
629
- function Nn(e) {
630
- return e === "remove" ? jn : e === "add" ? Un : Wn;
586
+ function Bn(e) {
587
+ return e === "remove" ? Nn : e === "add" ? Fn : jn;
631
588
  }
632
- const Fn = s.div`
589
+ const Hn = c.div`
633
590
  display: flex;
634
591
  flex-direction: column;
635
592
  width: 100%;
@@ -640,29 +597,29 @@ const Fn = s.div`
640
597
  &::-webkit-scrollbar-track {
641
598
  margin: var(--spacing-xxs) 0;
642
599
  }
643
- `, ae = s.div`
600
+ `, ue = c.div`
644
601
  display: flex;
645
602
  font-size: var(--font-size-sm);
646
603
  line-height: var(--line-height-sm);
647
604
  font-weight: var(--font-weight-regular);
648
605
  padding-right: var(--spacing-xxs);
649
- `, jn = s(ae)`
606
+ `, Nn = c(ue)`
650
607
  background: var(--admonition-danger-bg-color);
651
608
  color: var(--color-raspberry-7);
652
- `, Un = s(ae)`
609
+ `, Fn = c(ue)`
653
610
  background: var(--admonition-success-bg-color);
654
611
  color: var(--color-green-7);
655
- `, Wn = s(ae)`
612
+ `, jn = c(ue)`
656
613
  background: transparent;
657
614
  color: var(--text-color-secondary);
658
- `, Yn = s.span`
615
+ `, Wn = c.span`
659
616
  display: flex;
660
617
  align-items: center;
661
618
  justify-content: center;
662
619
  min-width: 16px;
663
620
  height: 20px;
664
621
  flex-shrink: 0;
665
- `, Ae = s.span`
622
+ `, Le = c.span`
666
623
  width: 100%;
667
624
  min-width: 0;
668
625
  line-height: var(--line-height-sm);
@@ -670,137 +627,144 @@ const Fn = s.div`
670
627
  font-weight: var(--font-weight-regular);
671
628
  white-space: pre-wrap;
672
629
  word-break: break-all;
673
- `, Gn = s(ae)`
630
+ `, Un = c(ue)`
674
631
  user-select: none;
675
- `, Kn = (e) => typeof e != "object" || e === null ? !1 : "kind" in e && e.kind === "batch" ? "changes" in e ? Array.isArray(e.changes) && e.changes.every(Se) : !1 : Se(e);
676
- function Se(e) {
632
+ `, Yn = (e) => typeof e != "object" || e === null ? !1 : "kind" in e && e.kind === "batch" ? "changes" in e ? Array.isArray(e.changes) && e.changes.every(Pe) : !1 : Pe(e);
633
+ function Pe(e) {
677
634
  return typeof e != "object" || e === null || !("id" in e) || !("target" in e) || !("included" in e) || !("kind" in e) ? !1 : e.kind === "single";
678
635
  }
679
- const qn = {
636
+ const Gn = {
680
637
  approveLabel: "Approve",
681
638
  denyLabel: "Deny"
682
639
  };
683
- function Zn(e, t) {
640
+ function qn(e, t) {
684
641
  const n = T(t, "action");
685
642
  if (n) {
686
- const o = en[n];
687
- if (o) return o;
643
+ const r = zt[n];
644
+ if (r) return r;
688
645
  }
689
- const r = tn[e];
690
- return r || qn;
646
+ const o = Mt[e];
647
+ return o || Gn;
691
648
  }
692
649
  function T(e, t) {
693
650
  if (!e || typeof e != "object") return null;
694
651
  const n = e.payload;
695
652
  if (!n || typeof n != "object") return null;
696
- const r = n[t];
697
- return typeof r != "string" ? null : r.trim() || null;
653
+ const o = n[t];
654
+ return typeof o != "string" ? null : o.trim() || null;
698
655
  }
699
- function Ie(e, t) {
656
+ function oe(e, t) {
700
657
  if (!(typeof t > "u"))
701
658
  return e ? `${e}: ${t}` : t;
702
659
  }
703
- function Jn(e) {
660
+ function Kn(e) {
704
661
  return e ? "changes" in e ? Array.isArray(e.changes) ? e.changes.map((t) => !t || typeof t != "object" || !("approved" in t) ? !1 : t.approved === !0) : [] : [] : [];
705
662
  }
706
- function Xn(e, t) {
663
+ function Zn(e, t) {
707
664
  if (!e || typeof e != "object") return;
708
- const n = re(e, fe), r = re(n, pe);
709
- if (!(t in r)) return;
710
- const o = r[t];
711
- if (Array.isArray(o) && o.length !== 0 && o.every(Kn))
712
- return o;
665
+ const n = ce(e, ge), o = ce(n, ve);
666
+ if (!(t in o)) return;
667
+ const r = o[t];
668
+ if (Array.isArray(r) && r.length !== 0 && r.every(Yn))
669
+ return r;
713
670
  }
714
- function et(e, t) {
715
- return nn(e) && qe(e) && e.toolCallId === t;
671
+ function Qe(e, t) {
672
+ return _t(e) && qe(e) && e.toolCallId === t;
716
673
  }
717
- function Qn(e, t, n) {
718
- const r = e.parts.map((l) => et(l, t) ? { ...l, input: er(l.input, n) } : l), o = e.metadata && typeof e.metadata == "object" ? e.metadata : {}, a = re(o, fe), d = { ...re(a, pe), [t]: Wt(n) };
674
+ function Jn(e, t, n) {
675
+ const o = e.parts.map((l) => Qe(l, t) ? { ...l, input: Xn(l.input, n) } : l), r = e.metadata && typeof e.metadata == "object" ? e.metadata : {}, a = ce(r, ge), d = { ...ce(a, ve), [t]: It(n) };
719
676
  return {
720
677
  ...e,
721
- parts: r,
678
+ parts: o,
722
679
  metadata: {
723
- ...o,
724
- [fe]: {
680
+ ...r,
681
+ [ge]: {
725
682
  ...a,
726
- [pe]: d
683
+ [ve]: d
727
684
  }
728
685
  }
729
686
  };
730
687
  }
731
- function re(e, t) {
688
+ function ce(e, t) {
732
689
  const n = e[t];
733
690
  return typeof n == "object" && n !== null ? n : {};
734
691
  }
735
- function er(e, t) {
692
+ function Xn(e, t) {
736
693
  if (!e || !("changes" in e) || !Array.isArray(e.changes)) return e;
737
- const { changes: n, ...r } = e;
694
+ const { changes: n, ...o } = e;
738
695
  return {
739
- ...r,
740
- changes: n.map((o, a) => ({
741
- ...o,
696
+ ...o,
697
+ changes: n.map((r, a) => ({
698
+ ...r,
742
699
  approved: t[a]?.included ?? !1
743
700
  }))
744
701
  };
745
702
  }
746
- function tr({
703
+ function Qn({
747
704
  preview: e,
748
705
  isIncluded: t,
749
706
  onToggle: n,
750
- readOnly: r
707
+ readOnly: o
751
708
  }) {
752
- if (e.kind === "batch")
753
- return /* @__PURE__ */ i(
754
- Le,
755
- {
756
- isIncluded: t,
757
- onToggle: n,
758
- readOnly: r,
759
- primaryLabel: e.target.type,
760
- children: /* @__PURE__ */ i(fr, { children: e.changes.map((d) => /* @__PURE__ */ i(
761
- Te,
762
- {
763
- oldValue: Ie(d.target.key, d.oldValue),
764
- newValue: Ie(d.target.key, d.newValue)
765
- },
766
- d.id
767
- )) })
768
- }
769
- );
770
- const { target: o, oldValue: a, newValue: c } = e;
709
+ const { primaryLabel: r, categoryLabel: a, diffLineKey: s } = eo(e.target);
771
710
  return /* @__PURE__ */ i(
772
- Le,
711
+ to,
773
712
  {
774
713
  isIncluded: t,
775
714
  onToggle: n,
776
- readOnly: r,
777
- primaryLabel: o.key ?? o.type,
778
- categoryLabel: o.key ? o.type : void 0,
779
- children: /* @__PURE__ */ i(Te, { oldValue: a, newValue: c })
715
+ readOnly: o,
716
+ primaryLabel: r,
717
+ categoryLabel: a,
718
+ children: e.kind === "batch" ? /* @__PURE__ */ i(po, { children: e.changes.map((d) => /* @__PURE__ */ i(
719
+ Se,
720
+ {
721
+ oldValue: oe(d.target.key, d.oldValue),
722
+ newValue: oe(d.target.key, d.newValue)
723
+ },
724
+ d.id
725
+ )) }) : /* @__PURE__ */ i(
726
+ Se,
727
+ {
728
+ oldValue: oe(s, e.oldValue),
729
+ newValue: oe(s, e.newValue)
730
+ }
731
+ )
780
732
  }
781
733
  );
782
734
  }
783
- function Le({
735
+ function eo(e) {
736
+ const t = e.schemeId ?? e.type;
737
+ return e.stepId || e.schemeId ? {
738
+ primaryLabel: e.stepId ?? t,
739
+ categoryLabel: e.stepId ? t : void 0,
740
+ diffLineKey: e.key
741
+ } : {
742
+ primaryLabel: e.key ?? e.type,
743
+ categoryLabel: e.key ? e.type : void 0,
744
+ diffLineKey: void 0
745
+ };
746
+ }
747
+ function to({
784
748
  isIncluded: e,
785
749
  onToggle: t,
786
750
  readOnly: n,
787
- primaryLabel: r,
788
- categoryLabel: o,
751
+ primaryLabel: o,
752
+ categoryLabel: r,
789
753
  children: a
790
754
  }) {
791
- return /* @__PURE__ */ h(nr, { $dimmed: n && !e, children: [
792
- /* @__PURE__ */ h(rr, { children: [
793
- n ? /* @__PURE__ */ i(lr, { children: e ? /* @__PURE__ */ i(dr, { size: "16px" }) : /* @__PURE__ */ i(ur, { size: "16px" }) }) : /* @__PURE__ */ h(sr, { children: [
794
- /* @__PURE__ */ i(ar, { checked: e }),
795
- /* @__PURE__ */ i(cr, { type: "checkbox", checked: e, onChange: t })
755
+ return /* @__PURE__ */ h(no, { $dimmed: n && !e, children: [
756
+ /* @__PURE__ */ h(oo, { children: [
757
+ n ? /* @__PURE__ */ i(lo, { children: e ? /* @__PURE__ */ i(uo, { size: "16px" }) : /* @__PURE__ */ i(fo, { size: "16px" }) }) : /* @__PURE__ */ h(so, { children: [
758
+ /* @__PURE__ */ i(ao, { checked: e }),
759
+ /* @__PURE__ */ i(co, { type: "checkbox", checked: e, onChange: t })
796
760
  ] }),
797
- /* @__PURE__ */ i(or, { children: r }),
798
- o ? /* @__PURE__ */ i(ir, { children: o }) : null
761
+ /* @__PURE__ */ i(ro, { children: o }),
762
+ r ? /* @__PURE__ */ i(io, { children: r }) : null
799
763
  ] }),
800
764
  a
801
765
  ] });
802
766
  }
803
- const nr = s.div`
767
+ const no = c.div`
804
768
  display: flex;
805
769
  flex-direction: column;
806
770
  gap: var(--spacing-xs);
@@ -812,12 +776,12 @@ const nr = s.div`
812
776
  &:last-child {
813
777
  border-bottom: none;
814
778
  }
815
- `, rr = s.div`
779
+ `, oo = c.div`
816
780
  display: flex;
817
781
  align-items: center;
818
782
  gap: var(--spacing-xs);
819
783
  min-width: 0;
820
- `, or = s.span`
784
+ `, ro = c.span`
821
785
  flex: 1;
822
786
  min-width: 0;
823
787
  color: var(--text-color-primary);
@@ -827,24 +791,24 @@ const nr = s.div`
827
791
  overflow: hidden;
828
792
  text-overflow: ellipsis;
829
793
  white-space: nowrap;
830
- `, ir = s.span`
794
+ `, io = c.span`
831
795
  flex-shrink: 0;
832
796
  font-family: var(--code-block-font-family, var(--font-family-monospace, monospace));
833
797
  font-size: var(--font-size-sm);
834
798
  font-weight: var(--font-weight-regular);
835
799
  line-height: var(--line-height-sm);
836
800
  color: var(--text-color-secondary);
837
- `, ar = s(St).attrs({ "aria-hidden": !0 })`
801
+ `, ao = c(Kt).attrs({ "aria-hidden": !0 })`
838
802
  --checkbox-border-color: var(--color-blueberry-6);
839
803
  --checkbox-box-color: var(--color-blueberry-6);
840
804
  --checkbox-box-color-active: var(--color-blueberry-6);
841
- `, sr = s.span`
805
+ `, so = c.span`
842
806
  position: relative;
843
807
  display: inline-flex;
844
808
  flex-shrink: 0;
845
809
  width: 16px;
846
810
  height: 16px;
847
- `, cr = s.input`
811
+ `, co = c.input`
848
812
  position: absolute;
849
813
  inset: 0;
850
814
  width: 16px;
@@ -852,142 +816,151 @@ const nr = s.div`
852
816
  margin: 0;
853
817
  opacity: 0;
854
818
  cursor: pointer;
855
- `, lr = s.span`
819
+ `, lo = c.span`
856
820
  display: inline-flex;
857
821
  flex-shrink: 0;
858
822
  width: 16px;
859
823
  height: 16px;
860
824
  align-items: center;
861
825
  justify-content: center;
862
- `, dr = s(Tt)`
826
+ `, uo = c(Gt)`
863
827
  color: var(--color-success-base);
864
- `, ur = s(At)`
828
+ `, fo = c(qt)`
865
829
  color: var(--text-color-description);
866
- `, fr = s.div`
830
+ `, po = c.div`
867
831
  display: flex;
868
832
  flex-direction: column;
869
833
  gap: var(--spacing-xxs);
870
834
  min-width: 0;
871
835
  `;
872
- function tt({
836
+ function et({
873
837
  previews: e,
874
838
  handleToggle: t,
875
839
  readOnly: n
876
840
  }) {
877
- return e.length === 0 ? null : /* @__PURE__ */ i(pr, { children: e.map((r, o) => /* @__PURE__ */ i(
878
- tr,
841
+ return e.length === 0 ? null : /* @__PURE__ */ i(ho, { children: e.map((o, r) => /* @__PURE__ */ i(
842
+ Qn,
879
843
  {
880
- preview: r,
881
- isIncluded: r.included,
882
- onToggle: t ? () => t(o) : void 0,
844
+ preview: o,
845
+ isIncluded: o.included,
846
+ onToggle: t ? () => t(r) : void 0,
883
847
  readOnly: n
884
848
  },
885
- r.id
849
+ o.id
886
850
  )) });
887
851
  }
888
- const pr = s.div`
852
+ const ho = c.div`
889
853
  display: flex;
890
854
  flex-direction: column;
891
- `, hr = {
892
- update_step: mr,
893
- update_security: yr,
894
- run_request: br,
895
- web_search: Cr,
896
- manage_environment: xr,
897
- manage_collection: wr
855
+ `, go = {
856
+ update_step: yo,
857
+ update_security: xo,
858
+ run_request: ko,
859
+ web_search: To,
860
+ manage_environment: wo,
861
+ manage_collection: Co
898
862
  };
899
- function gr(e, t) {
900
- const n = hr[e];
901
- return n ? n(t) : vr(e);
863
+ function vo(e, t) {
864
+ const n = go[e];
865
+ return n ? n(t) : mo(e);
902
866
  }
903
- function vr(e) {
867
+ function mo(e) {
904
868
  return [{ kind: "text", text: e.split("_").map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join(" ") }];
905
869
  }
906
- function mr(e) {
907
- return nt(e, "Update step");
870
+ function yo(e) {
871
+ return tt(e, "Update step");
908
872
  }
909
- function yr(e) {
910
- return nt(e, "Update security");
873
+ function xo(e) {
874
+ const t = bo(e);
875
+ if (t.size > 1) return I("Update security");
876
+ const [n] = t;
877
+ return tt(e, "Update security", n);
911
878
  }
912
- function nt(e, t) {
913
- const { collectionId: n, workflowId: r, stepId: o } = kr(e);
914
- return !n || !r || !o ? A(t) : rt(
879
+ function bo(e) {
880
+ const t = e && "changes" in e ? e.changes : void 0;
881
+ if (!Array.isArray(t)) return /* @__PURE__ */ new Set();
882
+ const n = Z(e, "stepId"), o = t.map((r) => Z(r, "stepId") ?? n);
883
+ return new Set(o.filter((r) => !!r));
884
+ }
885
+ function tt(e, t, n) {
886
+ const { collectionId: o, workflowId: r, stepId: a } = Io(e), s = n ?? a;
887
+ return !o || !r || !s ? I(t) : nt(
915
888
  `${t} `,
916
- Xe({ collectionId: n, workflowId: r, stepId: o }),
917
- o
889
+ Je({ collectionId: o, workflowId: r, stepId: s }),
890
+ s
918
891
  );
919
892
  }
920
- function A(e) {
893
+ function I(e) {
921
894
  return [{ kind: "text", text: e }];
922
895
  }
923
- function E(e, t) {
896
+ function P(e, t) {
924
897
  return t ? `${e} "${t}"` : e;
925
898
  }
926
- function rt(e, t, n) {
899
+ function nt(e, t, n) {
927
900
  return [
928
901
  { kind: "text", text: e },
929
902
  { kind: "link", href: t, label: n }
930
903
  ];
931
904
  }
932
- function xr(e) {
933
- const t = T(e, "action"), n = T(e, "environment"), r = n ? ` in environment "${n}"` : "";
905
+ function wo(e) {
906
+ const t = T(e, "action"), n = T(e, "environment"), o = n ? ` in environment "${n}"` : "";
934
907
  switch (t) {
935
908
  case "add_environment":
936
- return A(E("Add environment", n));
909
+ return I(P("Add environment", n));
937
910
  case "set_active_environment":
938
- return A(
911
+ return I(
939
912
  n ? `Switch active environment to ${n}` : "Switch active environment"
940
913
  );
941
914
  case "upsert_input":
942
- return A(E("Set input", T(e, "name")) + r);
915
+ return I(P("Set input", T(e, "name")) + o);
943
916
  case "remove_input":
944
- return A(
945
- E("Remove input", T(e, "inputName")) + r
917
+ return I(
918
+ P("Remove input", T(e, "inputName")) + o
946
919
  );
947
920
  case "upsert_server":
948
- return A(E("Set server", T(e, "apiId")) + r);
921
+ return I(P("Set server", T(e, "apiId")) + o);
949
922
  case "remove_server":
950
- return A(
951
- E("Remove server", T(e, "apiId")) + r
923
+ return I(
924
+ P("Remove server", T(e, "apiId")) + o
952
925
  );
953
926
  default:
954
- return A("Manage environment");
927
+ return I("Manage environment");
955
928
  }
956
929
  }
957
- function wr(e) {
930
+ function Co(e) {
958
931
  switch (T(e, "action")) {
959
932
  case "create_collection":
960
- return A(E("Create collection", T(e, "title")));
933
+ return I(P("Create collection", T(e, "title")));
961
934
  case "delete_collection":
962
- return A(
963
- E("Delete collection", T(e, "collectionId"))
935
+ return I(
936
+ P("Delete collection", T(e, "collectionId"))
964
937
  );
965
938
  case "create_workflow":
966
- return A(E("Create workflow", T(e, "name")));
939
+ return I(P("Create workflow", T(e, "name")));
967
940
  case "delete_workflow":
968
- return A(E("Delete workflow", T(e, "workflowId")));
941
+ return I(P("Delete workflow", T(e, "workflowId")));
969
942
  case "create_step":
970
- return A(E("Create step", T(e, "stepName")));
943
+ return I(P("Create step", T(e, "stepName")));
971
944
  case "delete_step": {
972
- const n = T(e, "collectionId"), r = T(e, "workflowId"), o = T(e, "stepId");
973
- return !n || !r || !o ? A("Delete step") : rt(
945
+ const n = T(e, "collectionId"), o = T(e, "workflowId"), r = T(e, "stepId");
946
+ return !n || !o || !r ? I("Delete step") : nt(
974
947
  "Delete step ",
975
- Xe({ collectionId: n, workflowId: r, stepId: o }),
976
- o
948
+ Je({ collectionId: n, workflowId: o, stepId: r }),
949
+ r
977
950
  );
978
951
  }
979
952
  case "save_tab_to_collection":
980
- return A(
981
- E("Save tab as step", T(e, "newStepName"))
953
+ return I(
954
+ P("Save tab as step", T(e, "newStepName"))
982
955
  );
983
956
  default:
984
- return A("Manage collection");
957
+ return I("Manage collection");
985
958
  }
986
959
  }
987
- function br() {
960
+ function ko() {
988
961
  return [{ kind: "text", text: "Run current request" }];
989
962
  }
990
- function Cr(e) {
963
+ function To(e) {
991
964
  return [
992
965
  {
993
966
  kind: "text",
@@ -1000,25 +973,25 @@ function Cr(e) {
1000
973
  }
1001
974
  ];
1002
975
  }
1003
- function kr(e) {
976
+ function Io(e) {
1004
977
  return {
1005
- collectionId: le(e, "collectionId"),
1006
- workflowId: le(e, "workflowId"),
1007
- stepId: le(e, "stepId")
978
+ collectionId: Z(e, "collectionId"),
979
+ workflowId: Z(e, "workflowId"),
980
+ stepId: Z(e, "stepId")
1008
981
  };
1009
982
  }
1010
- function le(e, t) {
1011
- if (!e || !(t in e)) return null;
983
+ function Z(e, t) {
984
+ if (typeof e != "object" || e === null || !(t in e)) return null;
1012
985
  const n = e[t];
1013
986
  return typeof n == "string" && n.trim() || null;
1014
987
  }
1015
988
  function ot({ toolName: e, input: t }) {
1016
- const n = gr(e, t), r = Qe();
1017
- return /* @__PURE__ */ i(Tr, { onClick: r, children: /* @__PURE__ */ i(Ar, { children: n.map(
1018
- (o, a) => o.kind === "text" ? /* @__PURE__ */ i("span", { children: o.text }, a) : /* @__PURE__ */ i(Sr, { href: o.href, children: o.label }, a)
989
+ const n = vo(e, t), o = Xe();
990
+ return /* @__PURE__ */ i(Ao, { onClick: o, children: /* @__PURE__ */ i(So, { children: n.map(
991
+ (r, a) => r.kind === "text" ? /* @__PURE__ */ i("span", { children: r.text }, a) : /* @__PURE__ */ i(Lo, { href: r.href, children: r.label }, a)
1019
992
  ) }) });
1020
993
  }
1021
- const Tr = s.div`
994
+ const Ao = c.div`
1022
995
  display: flex;
1023
996
  flex-direction: column;
1024
997
  gap: 0;
@@ -1028,13 +1001,13 @@ const Tr = s.div`
1028
1001
  &:not(:last-child) {
1029
1002
  border-bottom: 1px solid var(--border-color-secondary);
1030
1003
  }
1031
- `, Ar = s.span`
1004
+ `, So = c.span`
1032
1005
  font-family: var(--font-family-base);
1033
1006
  font-size: var(--font-size-sm);
1034
1007
  font-weight: var(--font-weight-regular);
1035
1008
  line-height: var(--line-height-sm);
1036
1009
  color: var(--text-color-primary);
1037
- `, Sr = s.a`
1010
+ `, Lo = c.a`
1038
1011
  color: var(--link-color-primary);
1039
1012
  cursor: pointer;
1040
1013
  text-decoration: none;
@@ -1043,258 +1016,288 @@ const Tr = s.div`
1043
1016
  color: var(--link-color-primary, var(--text-color-link));
1044
1017
  }
1045
1018
  `;
1019
+ function rt(e, t, n) {
1020
+ const o = { type: e };
1021
+ return t !== void 0 && (o.key = t), n && (o.stepId = n), o;
1022
+ }
1046
1023
  function C({
1047
1024
  id: e,
1048
1025
  targetType: t,
1049
1026
  targetKey: n,
1027
+ targetStepId: o,
1050
1028
  oldValue: r,
1051
- newValue: o
1029
+ newValue: a
1052
1030
  }) {
1053
1031
  return {
1054
1032
  kind: "single",
1055
1033
  id: e,
1056
- target: n === void 0 ? { type: t } : { type: t, key: n },
1034
+ target: rt(t, n, o),
1057
1035
  oldValue: r,
1058
- newValue: o,
1036
+ newValue: a,
1059
1037
  included: !0
1060
1038
  };
1061
1039
  }
1062
- function _(e, t) {
1063
- return C({ id: e, targetType: t, oldValue: void 0, newValue: void 0 });
1040
+ function V(e, t, n) {
1041
+ return C({ id: e, targetType: t, targetStepId: n, oldValue: void 0, newValue: void 0 });
1064
1042
  }
1065
- function G({
1043
+ function Y({
1066
1044
  data: e,
1067
1045
  baseId: t,
1068
1046
  targetType: n,
1069
- batchTargetKey: r,
1070
- getOldValue: o,
1071
- getNewValue: a = (d, l) => String(l ?? ""),
1072
- resolveTargetKey: c = (d) => d
1047
+ batchTargetKey: o,
1048
+ targetStepId: r,
1049
+ getOldValue: a,
1050
+ getNewValue: s = (l, u) => String(u ?? ""),
1051
+ resolveTargetKey: d = (l) => l
1073
1052
  }) {
1074
- const d = Object.entries(e).filter(([, f]) => f !== void 0);
1075
- if (d.length === 0)
1076
- return _(t, n);
1077
- if (d.length >= 2) {
1078
- const f = d.map(
1079
- ([g, y]) => C({
1053
+ const l = Object.entries(e).filter(([, p]) => p !== void 0);
1054
+ if (l.length === 0)
1055
+ return V(t, n, r);
1056
+ if (l.length >= 2) {
1057
+ const p = l.map(
1058
+ ([g, m]) => C({
1080
1059
  id: `${t}:${g}`,
1081
1060
  targetType: n,
1082
- targetKey: c(g),
1083
- oldValue: o(g),
1084
- newValue: a(g, y)
1061
+ targetKey: d(g),
1062
+ oldValue: a(g),
1063
+ newValue: s(g, m)
1085
1064
  })
1086
1065
  );
1087
- return { kind: "batch", id: t, target: r !== void 0 ? { type: n, key: r } : { type: n }, changes: f, included: !0 };
1066
+ return {
1067
+ kind: "batch",
1068
+ id: t,
1069
+ target: rt(n, o, r),
1070
+ changes: p,
1071
+ included: !0
1072
+ };
1088
1073
  }
1089
- const [l, u] = d[0];
1074
+ const [u, f] = l[0];
1090
1075
  return C({
1091
1076
  id: t,
1092
1077
  targetType: n,
1093
- targetKey: c(l),
1094
- oldValue: o(l),
1095
- newValue: a(l, u)
1078
+ targetKey: d(u),
1079
+ targetStepId: r,
1080
+ oldValue: a(u),
1081
+ newValue: s(u, f)
1096
1082
  });
1097
1083
  }
1098
- function Ir({
1084
+ function Po({
1099
1085
  store: e,
1100
1086
  input: t
1101
1087
  }) {
1102
- if (!Lr(t)) return [];
1103
- const n = /* @__PURE__ */ new Map(), r = (o) => {
1104
- const a = n.get(o);
1088
+ if (!Eo(t)) return [];
1089
+ const n = /* @__PURE__ */ new Map(), o = (r) => {
1090
+ const a = n.get(r);
1105
1091
  if (a) return a;
1106
- const c = Ze(e, t.collectionId, t.workflowId, o), d = c.ok ? c.value : null, l = d ? Array.from(d.security.get({ noproxy: !0 })) : [];
1107
- return n.set(o, l), l;
1092
+ const s = Ke(e, t.collectionId, t.workflowId, r), d = s.ok ? s.value : null, l = d ? Array.from(d.security.get({ noproxy: !0 })) : [];
1093
+ return n.set(r, l), l;
1108
1094
  };
1109
- return t.changes.map((o, a) => {
1110
- const c = o.stepId?.trim(), d = c || t.stepId;
1111
- return Pr(r(d), o, a, c);
1095
+ return t.changes.map((r, a) => {
1096
+ const s = r.stepId?.trim(), d = s || t.stepId;
1097
+ return Ro(o(d), r, a, s);
1112
1098
  });
1113
1099
  }
1114
- function Lr(e) {
1100
+ function Eo(e) {
1115
1101
  if (typeof e != "object" || e === null) return !1;
1116
1102
  const t = e;
1117
1103
  return typeof t.collectionId == "string" && typeof t.workflowId == "string" && typeof t.stepId == "string" && Array.isArray(t.changes) && t.changes.length > 0;
1118
1104
  }
1119
- function B(e, t) {
1120
- return e ? t ? `${e}: ${t}` : e : t;
1121
- }
1122
- function Pr(e, t, n, r) {
1123
- const o = `security[${n}]`;
1105
+ function Ro(e, t, n, o) {
1106
+ const r = `security[${n}]`;
1124
1107
  switch (t.action) {
1125
1108
  case k.ADD: {
1126
- const { type: a, schemeId: c, data: d } = t;
1127
- return !d || Object.keys(d).length === 0 ? C({
1128
- id: o,
1129
- targetType: a,
1130
- targetKey: B(r, c),
1131
- oldValue: void 0,
1132
- newValue: a
1133
- }) : G({
1134
- data: d,
1135
- baseId: o,
1136
- targetType: a,
1137
- batchTargetKey: B(r, c),
1138
- getOldValue: () => {
1139
- },
1140
- resolveTargetKey: (l) => B(r, l)
1141
- });
1109
+ const { type: a, schemeId: s, data: d } = t;
1110
+ return !d || Object.keys(d).length === 0 ? K(
1111
+ C({
1112
+ id: r,
1113
+ targetType: a,
1114
+ targetStepId: o,
1115
+ oldValue: void 0,
1116
+ newValue: a
1117
+ }),
1118
+ s
1119
+ ) : K(
1120
+ Y({
1121
+ data: d,
1122
+ baseId: r,
1123
+ targetType: a,
1124
+ targetStepId: o,
1125
+ getOldValue: () => {
1126
+ }
1127
+ }),
1128
+ s
1129
+ );
1142
1130
  }
1143
1131
  case k.UPDATE: {
1144
- const { type: a, schemeId: c, data: d } = t, l = t.index !== void 0 ? e[t.index] : void 0;
1145
- return !d || Object.keys(d).length === 0 ? C({
1146
- id: o,
1147
- targetType: a,
1148
- targetKey: B(r, c),
1149
- oldValue: Ee(l),
1150
- newValue: a
1151
- }) : G({
1152
- data: d,
1153
- baseId: o,
1154
- targetType: a,
1155
- batchTargetKey: B(r, c),
1156
- getOldValue: (u) => l ? Er(l, u) : void 0,
1157
- resolveTargetKey: (u) => B(r, u)
1158
- });
1132
+ const { type: a, data: s } = t, d = t.index !== void 0 ? e[t.index] : void 0, l = t.schemeId || ye(d);
1133
+ return !s || Object.keys(s).length === 0 ? K(
1134
+ C({
1135
+ id: r,
1136
+ targetType: a,
1137
+ targetStepId: o,
1138
+ oldValue: Re(d),
1139
+ newValue: a
1140
+ }),
1141
+ l
1142
+ ) : K(
1143
+ Y({
1144
+ data: s,
1145
+ baseId: r,
1146
+ targetType: a,
1147
+ targetStepId: o,
1148
+ getOldValue: (u) => d ? Oo(d, u) : void 0
1149
+ }),
1150
+ l
1151
+ );
1159
1152
  }
1160
1153
  case k.REMOVE: {
1161
- const a = rn(e, t), c = a.ok ? a.entry : void 0;
1162
- return C({
1163
- id: o,
1164
- targetType: c?.securityType ?? "Security",
1165
- targetKey: B(r, at(c)),
1166
- oldValue: Ee(c),
1167
- newValue: void 0
1168
- });
1154
+ const a = Vt(e, t), s = a.ok ? a.entry : void 0;
1155
+ return K(
1156
+ C({
1157
+ id: r,
1158
+ targetType: s?.securityType ?? "Security",
1159
+ targetStepId: o,
1160
+ oldValue: Re(s),
1161
+ newValue: void 0
1162
+ }),
1163
+ ye(s)
1164
+ );
1169
1165
  }
1170
1166
  }
1171
1167
  }
1172
- function Er(e, t) {
1168
+ function K(e, t) {
1169
+ return t ? { ...e, target: { ...e.target, schemeId: t } } : e;
1170
+ }
1171
+ function Oo(e, t) {
1173
1172
  switch (e.securityType) {
1174
- case N.NoAuth:
1173
+ case M.NoAuth:
1175
1174
  return;
1176
- case N.OAuth2:
1177
- return Pe(e[N.OAuth2], t);
1178
- case N.OpenIDConnect: {
1179
- const n = e[N.OpenIDConnect];
1180
- return t === "openIdConnectUrl" ? n.openIdConnectUrl || void 0 : t === "userInfoUrl" ? n.userInfoUrl || void 0 : Pe(n, t);
1175
+ case M.OAuth2:
1176
+ return Ee(e[M.OAuth2], t);
1177
+ case M.OpenIDConnect: {
1178
+ const n = e[M.OpenIDConnect];
1179
+ return t === "openIdConnectUrl" ? n.openIdConnectUrl || void 0 : t === "userInfoUrl" ? n.userInfoUrl || void 0 : Ee(n, t);
1180
+ }
1181
+ case M.APIKey: {
1182
+ const n = e[M.APIKey];
1183
+ return t === "location" ? ie(n, t)?.toLowerCase() : ie(n, t);
1181
1184
  }
1182
1185
  default: {
1183
1186
  const n = e[e.securityType];
1184
- return it(n, t);
1187
+ return ie(n, t);
1185
1188
  }
1186
1189
  }
1187
1190
  }
1188
- function Pe(e, t) {
1191
+ function Ee(e, t) {
1189
1192
  if (t === "grantType") return e.grantType || void 0;
1190
1193
  if (!e.grantType) return;
1191
1194
  const n = e[e.grantType];
1192
- return it(n, t);
1195
+ return ie(n, t);
1193
1196
  }
1194
- function it(e, t) {
1197
+ function ie(e, t) {
1195
1198
  const n = e[t];
1196
1199
  return n !== void 0 && n !== "" ? String(n) : void 0;
1197
1200
  }
1198
- function Ee(e) {
1199
- if (!e || e.securityType === N.NoAuth) return;
1200
- const t = at(e);
1201
+ function Re(e) {
1202
+ if (!e || e.securityType === M.NoAuth) return;
1203
+ const t = ye(e);
1201
1204
  return t ? `${e.securityType} (${t})` : e.securityType;
1202
1205
  }
1203
- function at(e) {
1204
- return !e || e.securityType === N.NoAuth ? void 0 : e[e.securityType]?.schemeName || void 0;
1206
+ function ye(e) {
1207
+ return !e || e.securityType === M.NoAuth ? void 0 : e[e.securityType]?.schemeName || void 0;
1205
1208
  }
1206
- function Or({
1209
+ function $o({
1207
1210
  store: e,
1208
1211
  input: t
1209
1212
  }) {
1210
- if (!Rr(t)) return [];
1211
- const n = Ze(e, t.collectionId, t.workflowId, t.stepId), r = n.ok ? n.value : null;
1212
- return t.changes.map((o, a) => $r(r, o, a));
1213
+ if (!Do(t)) return [];
1214
+ const n = Ke(e, t.collectionId, t.workflowId, t.stepId), o = n.ok ? n.value : null;
1215
+ return t.changes.map((r, a) => zo(o, r, a));
1213
1216
  }
1214
- function Rr(e) {
1217
+ function Do(e) {
1215
1218
  return typeof e != "object" || e === null ? !1 : "collectionId" in e && "workflowId" in e && "stepId" in e && "changes" in e && Array.isArray(e.changes) && e.changes.length > 0 && typeof e.collectionId == "string" && typeof e.workflowId == "string" && typeof e.stepId == "string";
1216
1219
  }
1217
- function $r(e, t, n) {
1218
- const r = t.id ?? `${t.field}[${n}]`;
1220
+ function zo(e, t, n) {
1221
+ const o = t.id ?? `${t.field}[${n}]`;
1219
1222
  switch (t.field) {
1220
1223
  case "method":
1221
1224
  case "url":
1222
1225
  case "description":
1223
- return Dr(e, t, r);
1226
+ return Mo(e, t, o);
1224
1227
  case "parameters":
1225
- return Mr(e, t, r);
1228
+ return _o(e, t, o);
1226
1229
  case "outputs":
1227
- return zr(e, t, r);
1230
+ return Vo(e, t, o);
1228
1231
  case "body":
1229
- return _r(e, t, r);
1232
+ return Bo(e, t, o);
1230
1233
  case "successCriteria":
1231
- return Vr(e, t, r);
1234
+ return Ho(e, t, o);
1232
1235
  }
1233
1236
  }
1234
- function Dr(e, t, n) {
1235
- const r = Q(t.field);
1237
+ function Mo(e, t, n) {
1238
+ const o = re(t.field);
1236
1239
  switch (t.action) {
1237
1240
  case k.ADD:
1238
1241
  return C({
1239
1242
  id: n,
1240
- targetType: r,
1243
+ targetType: o,
1241
1244
  oldValue: void 0,
1242
1245
  newValue: t.data
1243
1246
  });
1244
1247
  case k.UPDATE:
1245
1248
  return C({
1246
1249
  id: n,
1247
- targetType: r,
1250
+ targetType: o,
1248
1251
  oldValue: Oe(e, t.field),
1249
1252
  newValue: t.data
1250
1253
  });
1251
1254
  case k.REMOVE:
1252
1255
  return C({
1253
1256
  id: n,
1254
- targetType: r,
1257
+ targetType: o,
1255
1258
  oldValue: Oe(e, t.field),
1256
1259
  newValue: void 0
1257
1260
  });
1258
1261
  }
1259
1262
  }
1260
- function Mr(e, t, n) {
1263
+ function _o(e, t, n) {
1261
1264
  switch (t.action) {
1262
1265
  case k.ADD: {
1263
- if (!t.data) return _(n, "parameter");
1264
- const { in: r, name: o, value: a } = t.data;
1266
+ if (!t.data) return V(n, "parameter");
1267
+ const { in: o, name: r, value: a } = t.data;
1265
1268
  return C({
1266
1269
  id: n,
1267
- targetType: Q(r),
1268
- targetKey: o,
1270
+ targetType: re(o),
1271
+ targetKey: r,
1269
1272
  oldValue: void 0,
1270
1273
  newValue: a
1271
1274
  });
1272
1275
  }
1273
1276
  case k.UPDATE: {
1274
- if (!t.id && !t.data?.name) return _(n, "parameter");
1275
- const r = Re(e, t), o = t.data?.in ?? r?.in ?? "parameter";
1277
+ if (!t.id && !t.data?.name) return V(n, "parameter");
1278
+ const o = $e(e, t), r = t.data?.in ?? o?.in ?? "parameter";
1276
1279
  return C({
1277
1280
  id: n,
1278
- targetType: Q(o),
1279
- targetKey: t.data?.name ?? r?.key,
1280
- oldValue: r ? r.value ?? "" : void 0,
1281
+ targetType: re(r),
1282
+ targetKey: t.data?.name ?? o?.key,
1283
+ oldValue: o ? o.value ?? "" : void 0,
1281
1284
  newValue: t.data?.value
1282
1285
  });
1283
1286
  }
1284
1287
  case k.REMOVE: {
1285
- if (!t.id && !t.data?.name) return _(n, "parameter");
1286
- const r = Re(e, t), o = t.data?.in ?? r?.in ?? "parameter";
1288
+ if (!t.id && !t.data?.name) return V(n, "parameter");
1289
+ const o = $e(e, t), r = t.data?.in ?? o?.in ?? "parameter";
1287
1290
  return C({
1288
1291
  id: n,
1289
- targetType: Q(o),
1290
- targetKey: r?.key ?? t.data?.name,
1291
- oldValue: r ? r.value ?? "" : void 0,
1292
+ targetType: re(r),
1293
+ targetKey: o?.key ?? t.data?.name,
1294
+ oldValue: o ? o.value ?? "" : void 0,
1292
1295
  newValue: void 0
1293
1296
  });
1294
1297
  }
1295
1298
  }
1296
1299
  }
1297
- function zr(e, t, n) {
1300
+ function Vo(e, t, n) {
1298
1301
  switch (t.action) {
1299
1302
  case k.ADD:
1300
1303
  return t.data ? C({
@@ -1317,108 +1320,108 @@ function zr(e, t, n) {
1317
1320
  oldValue: void 0,
1318
1321
  newValue: void 0
1319
1322
  });
1320
- const r = t.id && e ? De(e, t.id) : void 0;
1323
+ const o = t.id && e ? ze(e, t.id) : void 0;
1321
1324
  return C({
1322
1325
  id: n,
1323
1326
  targetType: "Output",
1324
1327
  targetKey: t.data.name,
1325
- oldValue: r?.value,
1328
+ oldValue: o?.value,
1326
1329
  newValue: t.data.expression
1327
1330
  });
1328
1331
  }
1329
1332
  case k.REMOVE: {
1330
- if (!t.id && !t.data?.name) return _(n, "Output");
1331
- let r = t.id && e ? De(e, t.id) : void 0;
1332
- return !r && e && t.data?.name && (r = Nr(e, t.data.name)), C({
1333
+ if (!t.id && !t.data?.name) return V(n, "Output");
1334
+ let o = t.id && e ? ze(e, t.id) : void 0;
1335
+ return !o && e && t.data?.name && (o = jo(e, t.data.name)), C({
1333
1336
  id: n,
1334
1337
  targetType: "Output",
1335
- targetKey: r?.key ?? t.data?.name,
1336
- oldValue: r?.value,
1338
+ targetKey: o?.key ?? t.data?.name,
1339
+ oldValue: o?.value,
1337
1340
  newValue: void 0
1338
1341
  });
1339
1342
  }
1340
1343
  }
1341
1344
  }
1342
- function _r(e, t, n) {
1343
- const { data: r } = t;
1345
+ function Bo(e, t, n) {
1346
+ const { data: o } = t;
1344
1347
  switch (t.action) {
1345
1348
  case k.ADD:
1346
- return G({
1347
- data: r,
1349
+ return Y({
1350
+ data: o,
1348
1351
  baseId: n,
1349
1352
  targetType: "Body",
1350
1353
  getOldValue: () => {
1351
1354
  },
1352
- getNewValue: (o) => o === "content" ? de(r.content, r.contentType) : ie(r[o]),
1353
- resolveTargetKey: (o) => o === "content" ? void 0 : o
1355
+ getNewValue: (r) => r === "content" ? he(o.content, o.contentType) : de(o[r]),
1356
+ resolveTargetKey: (r) => r === "content" ? void 0 : r
1354
1357
  });
1355
1358
  case k.UPDATE: {
1356
- const o = e?.requestBody.type.get(), a = r.contentType ?? o;
1357
- return G({
1358
- data: r,
1359
+ const r = e?.requestBody.type.get(), a = o.contentType ?? r;
1360
+ return Y({
1361
+ data: o,
1359
1362
  baseId: n,
1360
1363
  targetType: "Body",
1361
- getOldValue: (c) => {
1364
+ getOldValue: (s) => {
1362
1365
  if (e) {
1363
- if (c === "content")
1364
- return de(e.requestBody.content.get(), o) || void 0;
1365
- if (c === "contentType") return o;
1366
+ if (s === "content")
1367
+ return he(e.requestBody.content.get(), r) || void 0;
1368
+ if (s === "contentType") return r;
1366
1369
  }
1367
1370
  },
1368
- getNewValue: (c) => c === "content" ? de(r.content, a) : ie(r[c]),
1369
- resolveTargetKey: (c) => c === "content" ? void 0 : c
1371
+ getNewValue: (s) => s === "content" ? he(o.content, a) : de(o[s]),
1372
+ resolveTargetKey: (s) => s === "content" ? void 0 : s
1370
1373
  });
1371
1374
  }
1372
1375
  case k.REMOVE: {
1373
- const o = e ? ve({
1376
+ const r = e ? be({
1374
1377
  contentType: e.requestBody.type.get(),
1375
1378
  content: e.requestBody.content.get()
1376
1379
  }) : void 0;
1377
1380
  return C({
1378
1381
  id: n,
1379
1382
  targetType: "Body",
1380
- oldValue: o,
1383
+ oldValue: r,
1381
1384
  newValue: void 0
1382
1385
  });
1383
1386
  }
1384
1387
  }
1385
1388
  }
1386
- function Vr(e, t, n) {
1389
+ function Ho(e, t, n) {
1387
1390
  switch (t.action) {
1388
1391
  case k.ADD:
1389
- return t.data ? G({
1392
+ return t.data ? Y({
1390
1393
  data: t.data,
1391
1394
  baseId: n,
1392
1395
  targetType: "successCriteria",
1393
1396
  getOldValue: () => {
1394
1397
  },
1395
- getNewValue: (r) => ie(t.data[r])
1396
- }) : _(n, "successCriteria");
1398
+ getNewValue: (o) => de(t.data[o])
1399
+ }) : V(n, "successCriteria");
1397
1400
  case k.UPDATE: {
1398
- if (!t.data) return _(n, "successCriteria");
1399
- const r = typeof t.id == "string" && e ? $e(e, t.id) : void 0;
1400
- return G({
1401
+ if (!t.data) return V(n, "successCriteria");
1402
+ const o = typeof t.id == "string" && e ? De(e, t.id) : void 0;
1403
+ return Y({
1401
1404
  data: t.data,
1402
1405
  baseId: n,
1403
1406
  targetType: "successCriteria",
1404
- getOldValue: (o) => {
1405
- if (r) {
1406
- if (o === "condition") return r.condition;
1407
- if (o === "context") return r.context ?? void 0;
1408
- if (o === "type") return r.type;
1407
+ getOldValue: (r) => {
1408
+ if (o) {
1409
+ if (r === "condition") return o.condition;
1410
+ if (r === "context") return o.context ?? void 0;
1411
+ if (r === "type") return o.type;
1409
1412
  }
1410
1413
  },
1411
- getNewValue: (o) => ie(t.data[o])
1414
+ getNewValue: (r) => de(t.data[r])
1412
1415
  });
1413
1416
  }
1414
1417
  case k.REMOVE: {
1415
- if (typeof t.id != "string") return _(n, "successCriteria");
1416
- const r = e ? $e(e, t.id) : void 0;
1418
+ if (typeof t.id != "string") return V(n, "successCriteria");
1419
+ const o = e ? De(e, t.id) : void 0;
1417
1420
  return C({
1418
1421
  id: n,
1419
1422
  targetType: "successCriteria",
1420
- targetKey: r?.condition,
1421
- oldValue: r ? ve(r) : void 0,
1423
+ targetKey: o?.condition,
1424
+ oldValue: o ? be(o) : void 0,
1422
1425
  newValue: void 0
1423
1426
  });
1424
1427
  }
@@ -1435,140 +1438,140 @@ function Oe(e, t) {
1435
1438
  return e.description.get();
1436
1439
  }
1437
1440
  }
1438
- function Re(e, t) {
1439
- let n = t.id && e ? Br(e, t.id) : null;
1440
- return !n && e && t.data?.name && (n = Hr(e, t.data.name)), n;
1441
+ function $e(e, t) {
1442
+ let n = t.id && e ? No(e, t.id) : null;
1443
+ return !n && e && t.data?.name && (n = Fo(e, t.data.name)), n;
1441
1444
  }
1442
- function st(e, t) {
1445
+ function it(e, t) {
1443
1446
  for (const n of ["path", "query", "header", "cookie"]) {
1444
- const r = e.parameters[on[n]].get().find((o) => Yt(o) && t(o));
1445
- if (r) return r;
1447
+ const o = e.parameters[Bt[n]].get().find((r) => At(r) && t(r));
1448
+ if (o) return o;
1446
1449
  }
1447
1450
  return null;
1448
1451
  }
1449
- function Br(e, t) {
1450
- return st(e, (n) => n.id === t);
1452
+ function No(e, t) {
1453
+ return it(e, (n) => n.id === t);
1451
1454
  }
1452
- function Hr(e, t) {
1453
- return st(e, (n) => n.key === t);
1455
+ function Fo(e, t) {
1456
+ return it(e, (n) => n.key === t);
1454
1457
  }
1455
- function $e(e, t) {
1458
+ function De(e, t) {
1456
1459
  return e.successCriteria.get().find((n) => n.condition === t);
1457
1460
  }
1458
- function ct(e, t) {
1461
+ function at(e, t) {
1459
1462
  for (const n of e.outputs.get())
1460
1463
  if (t(n))
1461
1464
  return {
1462
- key: oe(n.key),
1463
- value: oe(n.value)
1465
+ key: le(n.key),
1466
+ value: le(n.value)
1464
1467
  };
1465
1468
  }
1466
- function De(e, t) {
1467
- return ct(e, (n) => oe(n.id) === t);
1469
+ function ze(e, t) {
1470
+ return at(e, (n) => le(n.id) === t);
1468
1471
  }
1469
- function Nr(e, t) {
1470
- return ct(e, (n) => oe(n.key) === t);
1472
+ function jo(e, t) {
1473
+ return at(e, (n) => le(n.key) === t);
1471
1474
  }
1472
- function oe(e) {
1475
+ function le(e) {
1473
1476
  return typeof e == "string" ? e : e.get();
1474
1477
  }
1475
- function ie(e) {
1476
- return e == null ? "" : typeof e == "string" ? e : ve(e);
1478
+ function de(e) {
1479
+ return e == null ? "" : typeof e == "string" ? e : be(e);
1477
1480
  }
1478
- function de(e, t) {
1479
- if (!e || t !== Gt.JSON) return e;
1481
+ function he(e, t) {
1482
+ if (!e || t !== St.JSON) return e;
1480
1483
  try {
1481
1484
  return JSON.stringify(JSON.parse(e), null, 2);
1482
1485
  } catch {
1483
1486
  return e;
1484
1487
  }
1485
1488
  }
1486
- const Fr = {
1487
- update_security: Ir,
1488
- update_step: Or
1489
+ const Wo = {
1490
+ update_security: Po,
1491
+ update_step: $o
1489
1492
  };
1490
- function lt(e, t) {
1491
- const n = We(), r = S(() => {
1492
- const l = e ? Fr[e] : void 0;
1493
+ function st(e, t) {
1494
+ const n = We(), o = A(() => {
1495
+ const l = e ? Wo[e] : void 0;
1493
1496
  if (!l) return [];
1494
1497
  try {
1495
1498
  return l({ store: n, input: t });
1496
1499
  } catch (u) {
1497
1500
  return console.error("Unable to build change previews", u), [];
1498
1501
  }
1499
- }, [e, n, t]), [o, a] = K(
1500
- () => Object.fromEntries(r.map((l) => [l.id, l.included]))
1501
- ), c = S(
1502
- () => r.map((l) => ({ ...l, included: o[l.id] ?? l.included })),
1503
- [r, o]
1504
- ), d = R(
1502
+ }, [e, n, t]), [r, a] = G(
1503
+ () => Object.fromEntries(o.map((l) => [l.id, l.included]))
1504
+ ), s = A(
1505
+ () => o.map((l) => ({ ...l, included: r[l.id] ?? l.included })),
1506
+ [o, r]
1507
+ ), d = D(
1505
1508
  (l) => {
1506
1509
  a(typeof l == "function" ? (u) => {
1507
- const f = r.map((p) => ({
1510
+ const f = o.map((p) => ({
1508
1511
  ...p,
1509
1512
  included: u[p.id] ?? p.included
1510
1513
  }));
1511
1514
  return Object.fromEntries(l(f).map((p) => [p.id, p.included]));
1512
1515
  } : Object.fromEntries(l.map((u) => [u.id, u.included])));
1513
1516
  },
1514
- [r]
1517
+ [o]
1515
1518
  );
1516
- return { previews: c, setPreviews: d };
1519
+ return { previews: s, setPreviews: d };
1517
1520
  }
1518
- function jr({
1521
+ function Uo({
1519
1522
  toolCallId: e,
1520
1523
  toolName: t,
1521
1524
  input: n,
1522
- onApprove: r,
1523
- onDeny: o
1525
+ onApprove: o,
1526
+ onDeny: r
1524
1527
  }) {
1525
- const { updateMessages: a } = q(), { previews: c, setPreviews: d } = lt(t, n), { includedCount: l, totalCount: u } = S(
1528
+ const { updateMessages: a } = Q(), { previews: s, setPreviews: d } = st(t, n), { includedCount: l, totalCount: u } = A(
1526
1529
  () => ({
1527
- includedCount: c.filter((v) => v.included).length,
1528
- totalCount: c.length
1530
+ includedCount: s.filter((v) => v.included).length,
1531
+ totalCount: s.length
1529
1532
  }),
1530
- [c]
1531
- ), { approveLabel: f, denyLabel: p } = S(
1532
- () => Zn(t, n),
1533
+ [s]
1534
+ ), { approveLabel: f, denyLabel: p } = A(
1535
+ () => qn(t, n),
1533
1536
  [t, n]
1534
- ), g = R(() => {
1537
+ ), g = D(() => {
1535
1538
  a((v) => {
1536
1539
  const x = [];
1537
- for (let w = 0; w < v.length; w++) {
1538
- const b = v[w], { parts: m } = b, I = b.role === "assistant", z = m.some(
1539
- (P) => et(P, e)
1540
+ for (let b = 0; b < v.length; b++) {
1541
+ const w = v[b], { parts: y } = w, S = w.role === "assistant", E = y.some(
1542
+ (R) => Qe(R, e)
1540
1543
  );
1541
- if (I && z) {
1542
- const P = Qn(b, e, c);
1543
- x.push({ index: w, message: P });
1544
+ if (S && E) {
1545
+ const R = Jn(w, e, s);
1546
+ x.push({ index: b, message: R });
1544
1547
  }
1545
1548
  }
1546
1549
  return x;
1547
- }), r();
1548
- }, [c, r, a, e]), y = R(
1550
+ }), o();
1551
+ }, [s, o, a, e]), m = D(
1549
1552
  (v) => {
1550
1553
  d(
1551
1554
  (x) => x.map(
1552
- (w, b) => b === v ? { ...w, included: !w.included } : w
1555
+ (b, w) => w === v ? { ...b, included: !b.included } : b
1553
1556
  )
1554
1557
  );
1555
1558
  },
1556
1559
  [d]
1557
1560
  );
1558
- return /* @__PURE__ */ h(Ur, { children: [
1561
+ return /* @__PURE__ */ h(Yo, { children: [
1559
1562
  /* @__PURE__ */ i(ot, { toolName: t, input: n }),
1560
- c.length ? /* @__PURE__ */ i(Wr, { children: /* @__PURE__ */ i(tt, { previews: c, handleToggle: y }) }) : null,
1561
- c.length ? /* @__PURE__ */ i(Ye, {}) : null,
1562
- /* @__PURE__ */ h(Yr, { children: [
1563
- u > 1 ? /* @__PURE__ */ h(Gr, { children: [
1563
+ s.length ? /* @__PURE__ */ i(Go, { children: /* @__PURE__ */ i(et, { previews: s, handleToggle: m }) }) : null,
1564
+ s.length ? /* @__PURE__ */ i(Ue, {}) : null,
1565
+ /* @__PURE__ */ h(qo, { children: [
1566
+ u > 1 ? /* @__PURE__ */ h(Ko, { children: [
1564
1567
  l,
1565
1568
  " of ",
1566
1569
  u,
1567
1570
  " selected"
1568
1571
  ] }) : null,
1569
- /* @__PURE__ */ i(Kr, { size: "small", variant: "secondary", onClick: o, children: p }),
1572
+ /* @__PURE__ */ i(Zo, { size: "small", variant: "secondary", onClick: r, children: p }),
1570
1573
  /* @__PURE__ */ i(
1571
- qr,
1574
+ Jo,
1572
1575
  {
1573
1576
  size: "small",
1574
1577
  variant: "primary",
@@ -1580,7 +1583,7 @@ function jr({
1580
1583
  ] })
1581
1584
  ] });
1582
1585
  }
1583
- const Ur = s.div`
1586
+ const Yo = c.div`
1584
1587
  display: flex;
1585
1588
  color: var(--text-color-primary);
1586
1589
  flex-direction: column;
@@ -1591,27 +1594,27 @@ const Ur = s.div`
1591
1594
  border: 1px solid var(--border-color-secondary);
1592
1595
  background: var(--layer-color);
1593
1596
  line-height: var(--line-height-sm);
1594
- `, Wr = s.div`
1597
+ `, Go = c.div`
1595
1598
  display: flex;
1596
1599
  flex-direction: column;
1597
1600
  gap: var(--spacing-xs);
1598
1601
  min-width: 0;
1599
- `, Yr = s.div`
1602
+ `, qo = c.div`
1600
1603
  display: flex;
1601
1604
  flex-wrap: wrap;
1602
1605
  justify-content: flex-end;
1603
1606
  align-items: center;
1604
1607
  padding: 0 var(--spacing-sm) var(--spacing-xs) var(--spacing-sm);
1605
1608
  gap: var(--spacing-xxs);
1606
- `, Gr = s.span`
1609
+ `, Ko = c.span`
1607
1610
  flex: 1;
1608
1611
  font-size: var(--font-size-sm);
1609
1612
  font-weight: var(--font-weight-regular);
1610
1613
  line-height: var(--line-height-sm);
1611
1614
  color: var(--text-color-secondary);
1612
- `, Kr = s(V)`
1615
+ `, Zo = c(B)`
1613
1616
  background: none;
1614
- `, qr = s(V)`
1617
+ `, Jo = c(B)`
1615
1618
  border: 1px solid var(--button-bg-color);
1616
1619
  padding-top: 0;
1617
1620
  padding-bottom: 0;
@@ -1619,66 +1622,66 @@ const Ur = s.div`
1619
1622
  border: 1px solid var(--button-border-color-disabled);
1620
1623
  }
1621
1624
  `;
1622
- function Zr({
1625
+ function Xo({
1623
1626
  approvalId: e,
1624
1627
  toolCallId: t,
1625
1628
  toolName: n,
1626
- input: r
1629
+ input: o
1627
1630
  }) {
1628
- const { addToolApprovalResponse: o } = q(), a = R(() => {
1629
- o({ id: e, approved: !0 });
1630
- }, [e, o]), c = R(() => {
1631
- o({ id: e, approved: !1 });
1632
- }, [e, o]);
1631
+ const { addToolApprovalResponse: r } = Q(), a = D(() => {
1632
+ r({ id: e, approved: !0 });
1633
+ }, [e, r]), s = D(() => {
1634
+ r({ id: e, approved: !1 });
1635
+ }, [e, r]);
1633
1636
  return /* @__PURE__ */ i(
1634
- jr,
1637
+ Uo,
1635
1638
  {
1636
1639
  onApprove: a,
1637
- onDeny: c,
1640
+ onDeny: s,
1638
1641
  toolCallId: t,
1639
1642
  toolName: n,
1640
- input: r
1643
+ input: o
1641
1644
  }
1642
1645
  );
1643
1646
  }
1644
- function Jr({
1647
+ function Qo({
1645
1648
  toolName: e,
1646
1649
  toolCallId: t,
1647
1650
  input: n,
1648
- isDenied: r,
1649
- messageMetadata: o,
1651
+ isDenied: o,
1652
+ messageMetadata: r,
1650
1653
  onUndo: a
1651
1654
  }) {
1652
- const c = S(
1653
- () => Xn(o, t),
1654
- [o, t]
1655
- ), { previews: d } = lt(
1656
- c ? void 0 : e,
1655
+ const s = A(
1656
+ () => Zn(r, t),
1657
+ [r, t]
1658
+ ), { previews: d } = st(
1659
+ s ? void 0 : e,
1657
1660
  n
1658
- ), l = S(() => {
1659
- const g = c ?? d;
1660
- if (r)
1661
+ ), l = A(() => {
1662
+ const g = s ?? d;
1663
+ if (o)
1661
1664
  return g.map((v) => ({ ...v, included: !1 }));
1662
- const y = Jn(n);
1665
+ const m = Kn(n);
1663
1666
  return g.map((v, x) => ({
1664
1667
  ...v,
1665
- included: y[x] ?? v.included
1668
+ included: m[x] ?? v.included
1666
1669
  }));
1667
- }, [c, d, n, r]);
1670
+ }, [s, d, n, o]);
1668
1671
  if (l.length === 0)
1669
1672
  return null;
1670
1673
  const u = l.filter((g) => g.included).length, p = u === 0 ? "Nothing applied" : `${u} ${u === 1 ? "change" : "changes"} applied`;
1671
- return /* @__PURE__ */ h(Xr, { children: [
1674
+ return /* @__PURE__ */ h(er, { children: [
1672
1675
  /* @__PURE__ */ i(ot, { toolName: e, input: n }),
1673
- /* @__PURE__ */ i(Qr, { children: /* @__PURE__ */ i(tt, { previews: l, readOnly: !0 }) }),
1674
- /* @__PURE__ */ i(Ye, {}),
1675
- /* @__PURE__ */ h(eo, { children: [
1676
- /* @__PURE__ */ i(to, { children: p }),
1677
- a ? /* @__PURE__ */ i(no, { size: "small", variant: "outlined", onClick: a, children: "Undo" }) : null
1676
+ /* @__PURE__ */ i(tr, { children: /* @__PURE__ */ i(et, { previews: l, readOnly: !0 }) }),
1677
+ /* @__PURE__ */ i(Ue, {}),
1678
+ /* @__PURE__ */ h(nr, { children: [
1679
+ /* @__PURE__ */ i(or, { children: p }),
1680
+ a ? /* @__PURE__ */ i(rr, { size: "small", variant: "outlined", onClick: a, children: "Undo" }) : null
1678
1681
  ] })
1679
1682
  ] });
1680
1683
  }
1681
- const Xr = s.div`
1684
+ const er = c.div`
1682
1685
  display: flex;
1683
1686
  color: var(--text-color-primary);
1684
1687
  flex-direction: column;
@@ -1688,77 +1691,77 @@ const Xr = s.div`
1688
1691
  border: 1px solid var(--border-color-secondary);
1689
1692
  background: var(--layer-color);
1690
1693
  line-height: var(--line-height-sm);
1691
- `, Qr = s.div`
1694
+ `, tr = c.div`
1692
1695
  display: flex;
1693
1696
  flex-direction: column;
1694
1697
  min-width: 0;
1695
- `, eo = s.div`
1698
+ `, nr = c.div`
1696
1699
  display: flex;
1697
1700
  justify-content: space-between;
1698
1701
  align-items: center;
1699
1702
  padding: var(--spacing-xs) var(--spacing-sm);
1700
1703
  gap: var(--spacing-xs);
1701
- `, to = s.span`
1704
+ `, or = c.span`
1702
1705
  font-size: var(--font-size-sm);
1703
1706
  font-weight: var(--font-weight-regular);
1704
1707
  line-height: var(--line-height-sm);
1705
1708
  color: var(--text-color-secondary);
1706
- `, no = s(V)`
1709
+ `, rr = c(B)`
1707
1710
  padding-top: 0;
1708
1711
  padding-bottom: 0;
1709
1712
  `;
1710
- function ro({ items: e, isLast: t }) {
1711
- const [n, r] = K(t), o = R(() => {
1712
- r((c) => !c);
1713
- }, []), a = S(() => e.filter((c) => c.kind === "action"), [e]);
1714
- return /* @__PURE__ */ h(io, { children: [
1715
- /* @__PURE__ */ h(ao, { type: "button", onClick: o, "aria-expanded": n, children: [
1716
- /* @__PURE__ */ i(so, { children: n ? /* @__PURE__ */ i(It, { size: "12px", color: "var(--icon-color-additional)" }) : /* @__PURE__ */ i(Lt, { size: "12px", color: "var(--icon-color-additional)" }) }),
1717
- /* @__PURE__ */ h(co, { children: [
1713
+ function ir({ items: e, isLast: t }) {
1714
+ const [n, o] = G(t), r = D(() => {
1715
+ o((s) => !s);
1716
+ }, []), a = A(() => e.filter((s) => s.kind === "action"), [e]);
1717
+ return /* @__PURE__ */ h(sr, { children: [
1718
+ /* @__PURE__ */ h(cr, { type: "button", onClick: r, "aria-expanded": n, children: [
1719
+ /* @__PURE__ */ i(lr, { children: n ? /* @__PURE__ */ i(Zt, { size: "12px", color: "var(--icon-color-additional)" }) : /* @__PURE__ */ i(Jt, { size: "12px", color: "var(--icon-color-additional)" }) }),
1720
+ /* @__PURE__ */ h(dr, { children: [
1718
1721
  a.length,
1719
1722
  " ",
1720
1723
  a.length === 1 ? "action" : "actions"
1721
1724
  ] })
1722
1725
  ] }),
1723
- n && /* @__PURE__ */ i(lo, { children: a.map((c, d) => /* @__PURE__ */ i(oo, { text: c.text }, d)) })
1726
+ n && /* @__PURE__ */ i(ur, { children: a.map((s, d) => /* @__PURE__ */ i(ar, { text: s.text }, d)) })
1724
1727
  ] });
1725
1728
  }
1726
- function oo({ text: e }) {
1727
- return /* @__PURE__ */ h(uo, { children: [
1728
- /* @__PURE__ */ h(fo, { children: [
1729
- /* @__PURE__ */ i(po, { "aria-hidden": !0 }),
1730
- /* @__PURE__ */ i(ho, { children: /* @__PURE__ */ i(go, { "aria-hidden": !0 }) }),
1731
- /* @__PURE__ */ i(dt, { "aria-hidden": !0 })
1729
+ function ar({ text: e }) {
1730
+ return /* @__PURE__ */ h(fr, { children: [
1731
+ /* @__PURE__ */ h(pr, { children: [
1732
+ /* @__PURE__ */ i(hr, { "aria-hidden": !0 }),
1733
+ /* @__PURE__ */ i(gr, { children: /* @__PURE__ */ i(vr, { "aria-hidden": !0 }) }),
1734
+ /* @__PURE__ */ i(ct, { "aria-hidden": !0 })
1732
1735
  ] }),
1733
- /* @__PURE__ */ i(vo, { children: e })
1736
+ /* @__PURE__ */ i(mr, { children: e })
1734
1737
  ] });
1735
1738
  }
1736
- const io = s.div`
1739
+ const sr = c.div`
1737
1740
  display: flex;
1738
1741
  flex-direction: column;
1739
1742
  width: 100%;
1740
1743
  min-width: 0;
1741
- `, ao = s.button`
1744
+ `, cr = c.button`
1742
1745
  display: flex;
1743
1746
  align-items: center;
1744
1747
  cursor: pointer;
1745
1748
  user-select: none;
1746
1749
  width: fit-content;
1747
1750
  padding: 0;
1748
- `, so = s.span`
1751
+ `, lr = c.span`
1749
1752
  display: flex;
1750
1753
  align-items: center;
1751
1754
  flex-shrink: 0;
1752
- `, co = s.span`
1755
+ `, dr = c.span`
1753
1756
  font-size: var(--font-size-sm);
1754
1757
  font-weight: var(--font-weight-regular);
1755
1758
  line-height: var(--line-height-sm);
1756
1759
  color: var(--text-color-description);
1757
- `, lo = s.div`
1760
+ `, ur = c.div`
1758
1761
  display: flex;
1759
1762
  flex-direction: column;
1760
1763
  gap: 0;
1761
- `, dt = s.span`
1764
+ `, ct = c.span`
1762
1765
  display: block;
1763
1766
  width: 1px;
1764
1767
  flex-shrink: 0;
@@ -1766,7 +1769,7 @@ const io = s.div`
1766
1769
  background: var(--border-color-secondary);
1767
1770
  flex: 1 1 auto;
1768
1771
  min-height: 8px;
1769
- `, uo = s.div`
1772
+ `, fr = c.div`
1770
1773
  display: flex;
1771
1774
  flex-direction: row;
1772
1775
  align-items: stretch;
@@ -1774,11 +1777,11 @@ const io = s.div`
1774
1777
  min-width: 0;
1775
1778
 
1776
1779
  &:last-child {
1777
- ${dt} {
1780
+ ${ct} {
1778
1781
  display: none;
1779
1782
  }
1780
1783
  }
1781
- `, fo = s.div`
1784
+ `, pr = c.div`
1782
1785
  display: flex;
1783
1786
  flex-direction: column;
1784
1787
  align-items: center;
@@ -1787,14 +1790,14 @@ const io = s.div`
1787
1790
  flex: 0 0 auto;
1788
1791
  align-self: stretch;
1789
1792
  min-height: 0;
1790
- `, po = s.span`
1793
+ `, hr = c.span`
1791
1794
  display: block;
1792
1795
  width: 1px;
1793
1796
  height: 4px;
1794
1797
  flex: 0 0 auto;
1795
1798
  flex-shrink: 0;
1796
1799
  background: var(--border-color-secondary);
1797
- `, ho = s.div`
1800
+ `, gr = c.div`
1798
1801
  width: 12px;
1799
1802
  height: 12px;
1800
1803
  flex: 0 0 auto;
@@ -1802,7 +1805,7 @@ const io = s.div`
1802
1805
  display: flex;
1803
1806
  align-items: center;
1804
1807
  justify-content: center;
1805
- `, go = s.span`
1808
+ `, vr = c.span`
1806
1809
  width: 4px;
1807
1810
  height: 4px;
1808
1811
  flex-shrink: 0;
@@ -1810,7 +1813,7 @@ const io = s.div`
1810
1813
  box-sizing: border-box;
1811
1814
  border: 1px solid var(--border-color-secondary);
1812
1815
  background: transparent;
1813
- `, vo = s.span`
1816
+ `, mr = c.span`
1814
1817
  flex: 1;
1815
1818
  min-width: 0;
1816
1819
  align-self: flex-start;
@@ -1819,49 +1822,59 @@ const io = s.div`
1819
1822
  line-height: var(--line-height-sm);
1820
1823
  color: var(--text-color-helper);
1821
1824
  `;
1822
- function mo({
1825
+ function yr({
1823
1826
  items: e,
1824
1827
  messageMetadata: t
1825
1828
  }) {
1826
- return /* @__PURE__ */ i(xo, { children: e.map((n, r) => {
1829
+ return /* @__PURE__ */ i(br, { children: e.map((n, o) => {
1827
1830
  if (n.kind === "reasoning-block") {
1828
- const c = r === e.length - 1;
1829
- return /* @__PURE__ */ i(ro, { items: n.items, isLast: c }, n.key);
1831
+ const s = o === e.length - 1;
1832
+ return /* @__PURE__ */ i(ir, { items: n.items, isLast: s }, n.key);
1830
1833
  }
1831
1834
  if (n.kind === "text")
1832
- return /* @__PURE__ */ i(yo, { rawMarkdown: n.text }, n.key);
1833
- const { part: o } = n, a = an(o.type);
1834
- return a && qe(o) ? /* @__PURE__ */ i(
1835
- Zr,
1835
+ return /* @__PURE__ */ i(
1836
+ xr,
1837
+ {
1838
+ rawMarkdown: n.text,
1839
+ workflowRunHistoryIds: n.workflowRunHistoryIds
1840
+ },
1841
+ n.key
1842
+ );
1843
+ const { part: r } = n, a = Ht(r.type);
1844
+ return a && qe(r) ? /* @__PURE__ */ i(
1845
+ Xo,
1836
1846
  {
1837
- approvalId: o.approval.id,
1838
- toolCallId: o.toolCallId,
1847
+ approvalId: r.approval.id,
1848
+ toolCallId: r.toolCallId,
1839
1849
  toolName: a,
1840
- input: o.input
1850
+ input: r.input
1841
1851
  },
1842
1852
  n.key
1843
- ) : a && sn(o) ? /* @__PURE__ */ i(
1844
- Jr,
1853
+ ) : a && Nt(r) ? /* @__PURE__ */ i(
1854
+ Qo,
1845
1855
  {
1846
1856
  toolName: a,
1847
- toolCallId: o.toolCallId,
1848
- input: o.input,
1849
- isDenied: o.state === "output-denied",
1857
+ toolCallId: r.toolCallId,
1858
+ input: r.input,
1859
+ isDenied: r.state === "output-denied",
1850
1860
  messageMetadata: t
1851
1861
  },
1852
1862
  n.key
1853
1863
  ) : null;
1854
1864
  }) });
1855
1865
  }
1856
- function yo({ rawMarkdown: e }) {
1857
- const t = Qe();
1858
- return /* @__PURE__ */ i(wo, { onClick: t, children: /* @__PURE__ */ i(Kt, { rawMarkdown: e, parser: qt }) });
1866
+ function xr({
1867
+ rawMarkdown: e,
1868
+ workflowRunHistoryIds: t
1869
+ }) {
1870
+ const n = Xe({ workflowRunHistoryIds: t });
1871
+ return /* @__PURE__ */ i(wr, { onClick: n, children: /* @__PURE__ */ i(Lt, { rawMarkdown: e, parser: Pt }) });
1859
1872
  }
1860
- const xo = s.div`
1873
+ const br = c.div`
1861
1874
  display: flex;
1862
1875
  flex-direction: column;
1863
1876
  gap: var(--spacing-xs);
1864
- `, wo = s.div`
1877
+ `, wr = c.div`
1865
1878
  white-space: normal;
1866
1879
 
1867
1880
  max-width: 100%;
@@ -1874,139 +1887,170 @@ const xo = s.div`
1874
1887
  p:last-child {
1875
1888
  margin-bottom: 0;
1876
1889
  }
1877
- `, ut = s.div`
1890
+ `, lt = c.div`
1878
1891
  font-family: var(--font-family-base);
1879
1892
  font-size: var(--font-size-sm);
1880
1893
  line-height: var(--line-height-sm);
1881
1894
  color: var(--text-color-primary);
1895
+ `, J = c.div`
1896
+ width: var(--search-ai-thinking-dot-size);
1897
+ height: var(--search-ai-thinking-dot-size);
1898
+ border-radius: 50%;
1899
+ background: var(--search-ai-thinking-dot-color);
1900
+ animation: bounce 1.4s infinite ease-in-out;
1901
+
1902
+ &:nth-child(1) {
1903
+ animation-delay: -0.32s;
1904
+ }
1905
+
1906
+ &:nth-child(2) {
1907
+ animation-delay: -0.16s;
1908
+ }
1909
+
1910
+ &:nth-child(3) {
1911
+ animation-delay: 0s;
1912
+ }
1913
+
1914
+ @keyframes bounce {
1915
+ 0%,
1916
+ 80%,
1917
+ 100% {
1918
+ opacity: 0.2;
1919
+ transform: scale(0.8);
1920
+ }
1921
+ 40% {
1922
+ opacity: 1;
1923
+ transform: scale(1);
1924
+ }
1925
+ }
1882
1926
  `;
1883
- function bo() {
1884
- return /* @__PURE__ */ h(Co, { children: [
1885
- /* @__PURE__ */ i(ee, {}),
1886
- /* @__PURE__ */ i(ee, {}),
1887
- /* @__PURE__ */ i(ee, {})
1927
+ function Cr() {
1928
+ return /* @__PURE__ */ h(kr, { children: [
1929
+ /* @__PURE__ */ i(J, {}),
1930
+ /* @__PURE__ */ i(J, {}),
1931
+ /* @__PURE__ */ i(J, {})
1888
1932
  ] });
1889
1933
  }
1890
- const Co = s.div`
1934
+ const kr = c.div`
1891
1935
  display: flex;
1892
1936
  align-items: center;
1893
1937
  justify-content: space-between;
1894
1938
  width: 24px;
1895
1939
  height: 24px;
1896
1940
  `;
1897
- function ko() {
1898
- return /* @__PURE__ */ h(To, { children: [
1899
- /* @__PURE__ */ i(bo, {}),
1900
- /* @__PURE__ */ i(Ao, { children: "Thinking" })
1941
+ function Tr() {
1942
+ return /* @__PURE__ */ h(Ir, { children: [
1943
+ /* @__PURE__ */ i(Cr, {}),
1944
+ /* @__PURE__ */ i(Ar, { children: "Thinking" })
1901
1945
  ] });
1902
1946
  }
1903
- const To = s.div`
1947
+ const Ir = c.div`
1904
1948
  display: flex;
1905
1949
  align-items: center;
1906
1950
  gap: var(--spacing-xxs);
1907
- `, Ao = s.span`
1951
+ `, Ar = c.span`
1908
1952
  font-family: var(--font-family-base);
1909
1953
  font-size: var(--font-size-sm);
1910
1954
  line-height: var(--line-height-sm);
1911
1955
  color: var(--text-color-helper);
1912
1956
  `;
1913
- function So({ items: e }) {
1914
- return /* @__PURE__ */ i(mt, { children: e.map((t) => t.kind !== "text" ? null : /* @__PURE__ */ i(ut, { children: t.text }, t.key)) });
1957
+ function Sr({ items: e }) {
1958
+ return /* @__PURE__ */ i(mt, { children: e.map((t) => t.kind !== "text" ? null : /* @__PURE__ */ i(lt, { children: t.text }, t.key)) });
1915
1959
  }
1916
- const Io = "Something went wrong. Please try again.";
1917
- function Lo(e) {
1960
+ const Lr = "Something went wrong. Please try again.";
1961
+ function Pr(e) {
1918
1962
  const t = e?.message?.trim();
1919
- return t || Io;
1963
+ return t || Lr;
1920
1964
  }
1921
- function Po({ message: e, isLastMessage: t }) {
1922
- const { chatStatus: n, chatError: r } = q(), { role: o, parts: a } = e, c = o === $.ASSISTANT, d = S(() => cn(a), [a]), l = d.length > 0, u = n === "error" && t && c && !l;
1923
- return !l && !u ? null : /* @__PURE__ */ i(ft, { $role: o, children: /* @__PURE__ */ i(
1924
- Oo,
1965
+ function Er({ message: e, isLastMessage: t }) {
1966
+ const { chatStatus: n, chatError: o } = Q(), { role: r, parts: a } = e, s = r === z.ASSISTANT, d = A(() => Ft(a), [a]), l = d.length > 0, u = n === "error" && t && s && !l;
1967
+ return !l && !u ? null : /* @__PURE__ */ i(dt, { $role: r, children: /* @__PURE__ */ i(
1968
+ Or,
1925
1969
  {
1926
1970
  isFailedEmptyAssistant: u,
1927
- chatError: r,
1928
- isAssistant: c,
1971
+ chatError: o,
1972
+ isAssistant: s,
1929
1973
  contentItems: d,
1930
1974
  messageMetadata: e.metadata
1931
1975
  }
1932
1976
  ) });
1933
1977
  }
1934
- function Eo() {
1935
- return /* @__PURE__ */ i(ft, { $role: $.ASSISTANT, children: /* @__PURE__ */ i(ge, { children: /* @__PURE__ */ i(ko, {}) }) });
1978
+ function Rr() {
1979
+ return /* @__PURE__ */ i(dt, { $role: z.ASSISTANT, children: /* @__PURE__ */ i(xe, { children: /* @__PURE__ */ i(Tr, {}) }) });
1936
1980
  }
1937
- function Oo({
1981
+ function Or({
1938
1982
  isFailedEmptyAssistant: e,
1939
1983
  chatError: t,
1940
1984
  isAssistant: n,
1941
- contentItems: r,
1942
- messageMetadata: o
1985
+ contentItems: o,
1986
+ messageMetadata: r
1943
1987
  }) {
1944
- return e ? /* @__PURE__ */ i(ge, { children: /* @__PURE__ */ i(ut, { children: Lo(t) }) }) : /* @__PURE__ */ i(ge, { children: n ? /* @__PURE__ */ i(mo, { items: r, messageMetadata: o }) : /* @__PURE__ */ i(So, { items: r }) });
1988
+ return e ? /* @__PURE__ */ i(xe, { children: /* @__PURE__ */ i(lt, { children: Pr(t) }) }) : /* @__PURE__ */ i(xe, { children: n ? /* @__PURE__ */ i(yr, { items: o, messageMetadata: r }) : /* @__PURE__ */ i(Sr, { items: o }) });
1945
1989
  }
1946
- const ft = s.div`
1990
+ const dt = c.div`
1947
1991
  display: flex;
1948
1992
  flex-direction: column;
1949
1993
  padding: var(--spacing-xs) var(--spacing-sm);
1950
1994
  gap: var(--spacing-xxs);
1951
1995
  min-width: 0;
1952
- width: ${({ $role: e }) => e === $.ASSISTANT ? "100%" : "fit-content"};
1953
- border-radius: ${({ $role: e }) => e === $.USER ? "6px 0px 6px 6px" : "0px 6px 6px 6px"};
1954
- background: ${({ $role: e }) => e === $.USER ? "var(--replay-ai-user-message-gradient)" : "transparent"};
1996
+ width: ${({ $role: e }) => e === z.ASSISTANT ? "100%" : "fit-content"};
1997
+ border-radius: ${({ $role: e }) => e === z.USER ? "6px 0px 6px 6px" : "0px 6px 6px 6px"};
1998
+ background: ${({ $role: e }) => e === z.USER ? "var(--replay-ai-user-message-gradient)" : "transparent"};
1955
1999
  border: none;
1956
2000
  color: var(--text-color-primary);
1957
2001
  box-sizing: border-box;
1958
2002
  word-wrap: break-word;
1959
2003
  white-space: pre-wrap;
1960
2004
  max-width: 100%;
1961
- `, ge = s.div`
2005
+ `, xe = c.div`
1962
2006
  display: flex;
1963
2007
  flex-direction: column;
1964
2008
  gap: var(--spacing-xxs);
1965
2009
  min-width: 0;
1966
2010
  width: 100%;
1967
2011
  `;
1968
- function Ro() {
1969
- const { messages: e, isStreaming: t } = q(), n = e.at(-1), r = S(() => {
1970
- const o = n?.role === $.ASSISTANT, a = n?.parts.at(-1)?.type === "text";
1971
- return t && !(o && a);
2012
+ function $r() {
2013
+ const { messages: e, isStreaming: t } = Q(), n = e.at(-1), o = A(() => {
2014
+ const r = n?.role === z.ASSISTANT, a = n?.parts.at(-1)?.type === "text";
2015
+ return t && !(r && a);
1972
2016
  }, [t, n?.parts, n?.role]);
1973
- return /* @__PURE__ */ h($o, { children: [
1974
- e.map((o, a) => /* @__PURE__ */ i(Me, { $role: o.role, children: /* @__PURE__ */ i(ze, { $role: o.role, children: /* @__PURE__ */ i(Po, { message: o, isLastMessage: a === e.length - 1 }) }) }, o.id)),
1975
- r && /* @__PURE__ */ i(Me, { $role: $.ASSISTANT, children: /* @__PURE__ */ i(ze, { $role: $.ASSISTANT, children: /* @__PURE__ */ i(Eo, {}) }) })
2017
+ return /* @__PURE__ */ h(Dr, { children: [
2018
+ e.map((r, a) => /* @__PURE__ */ i(Me, { $role: r.role, children: /* @__PURE__ */ i(_e, { $role: r.role, children: /* @__PURE__ */ i(Er, { message: r, isLastMessage: a === e.length - 1 }) }) }, r.id)),
2019
+ o && /* @__PURE__ */ i(Me, { $role: z.ASSISTANT, children: /* @__PURE__ */ i(_e, { $role: z.ASSISTANT, children: /* @__PURE__ */ i(Rr, {}) }) })
1976
2020
  ] });
1977
2021
  }
1978
- const $o = s.div`
2022
+ const Dr = c.div`
1979
2023
  display: flex;
1980
2024
  flex-direction: column;
1981
2025
  gap: var(--spacing-xs);
1982
2026
  width: 100%;
1983
- `, Me = s.div`
2027
+ `, Me = c.div`
1984
2028
  display: flex;
1985
2029
  width: 100%;
1986
- justify-content: ${({ $role: e }) => e === $.USER ? "flex-end" : "flex-start"};
1987
- `, ze = s.div`
2030
+ justify-content: ${({ $role: e }) => e === z.USER ? "flex-end" : "flex-start"};
2031
+ `, _e = c.div`
1988
2032
  display: flex;
1989
2033
  flex-direction: column;
1990
- align-items: ${({ $role: e }) => e === $.USER ? "flex-end" : "stretch"};
2034
+ align-items: ${({ $role: e }) => e === z.USER ? "flex-end" : "stretch"};
1991
2035
  gap: var(--spacing-xs);
1992
2036
  min-width: 0;
1993
2037
  width: 100%;
1994
2038
  max-width: 100%;
1995
2039
  `;
1996
- function Do(e) {
1997
- const t = F(void 0);
2040
+ function zr(e) {
2041
+ const t = N(void 0);
1998
2042
  return H(() => {
1999
2043
  t.current = e;
2000
2044
  }), t.current;
2001
2045
  }
2002
- const pt = s.div`
2046
+ const ut = c.div`
2003
2047
  display: flex;
2004
2048
  flex-direction: column;
2005
2049
  flex: 1;
2006
2050
  width: 100%;
2007
2051
  overflow: auto;
2008
2052
  padding: var(--spacing-xs);
2009
- `, Mo = (e) => /* @__PURE__ */ h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 14 14", fill: "none", ...e, children: [
2053
+ `, Mr = (e) => /* @__PURE__ */ h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 14 14", fill: "none", ...e, children: [
2010
2054
  /* @__PURE__ */ i(
2011
2055
  "path",
2012
2056
  {
@@ -2038,98 +2082,98 @@ const pt = s.div`
2038
2082
  ]
2039
2083
  }
2040
2084
  ) })
2041
- ] }), zo = s(Mo)`
2085
+ ] }), _r = c(Mr)`
2042
2086
  height: ${({ size: e }) => e || "14px"};
2043
2087
  width: ${({ size: e }) => e || "14px"};
2044
2088
  `;
2045
- function _o(e) {
2089
+ function Vr(e) {
2046
2090
  const t = "var(--font-size-base)";
2047
2091
  switch (e) {
2048
- case he:
2049
- return /* @__PURE__ */ i(zo, { size: t });
2050
- case ce.OPENAI:
2051
- return /* @__PURE__ */ i(Mt, { size: t, color: "var(--text-color-primary)" });
2052
- case ce.GEMINI:
2053
- return /* @__PURE__ */ i(Dt, { size: t });
2054
- case ce.ANTHROPIC:
2055
- return /* @__PURE__ */ i($t, { size: t, color: "var(--replay-claude-icon-color)" });
2092
+ case me:
2093
+ return /* @__PURE__ */ i(_r, { size: t });
2094
+ case pe.OPENAI:
2095
+ return /* @__PURE__ */ i(rn, { size: t, color: "var(--text-color-primary)" });
2096
+ case pe.GEMINI:
2097
+ return /* @__PURE__ */ i(on, { size: t });
2098
+ case pe.ANTHROPIC:
2099
+ return /* @__PURE__ */ i(nn, { size: t, color: "var(--replay-claude-icon-color)" });
2056
2100
  }
2057
2101
  }
2058
- function Vo({
2102
+ function Br({
2059
2103
  models: e,
2060
2104
  selectedModelId: t,
2061
2105
  placement: n,
2062
- onModelSelect: r,
2063
- onSettingsOpen: o
2106
+ onModelSelect: o,
2107
+ onSettingsOpen: r
2064
2108
  }) {
2065
- const a = e.find((p) => p.id === t), c = a?.label ?? "Replay AI", d = a?.id, l = e.filter((p) => p.provider === he), u = e.filter((p) => p.provider !== he), f = l.length > 0 && u.length > 0;
2066
- return /* @__PURE__ */ i(Fo, { children: /* @__PURE__ */ i(
2067
- jo,
2109
+ const a = e.find((p) => p.id === t), s = a?.label ?? "Replay AI", d = a?.id, l = e.filter((p) => p.provider === me), u = e.filter((p) => p.provider !== me), f = l.length > 0 && u.length > 0;
2110
+ return /* @__PURE__ */ i(jr, { children: /* @__PURE__ */ i(
2111
+ Wr,
2068
2112
  {
2069
- trigger: /* @__PURE__ */ i(Bo, { label: c }),
2113
+ trigger: /* @__PURE__ */ i(Hr, { label: s }),
2070
2114
  placement: n,
2071
2115
  alignment: "start",
2072
2116
  withArrow: !0,
2073
- children: /* @__PURE__ */ h(Uo, { children: [
2074
- /* @__PURE__ */ h(Go, { children: [
2117
+ children: /* @__PURE__ */ h(Ur, { children: [
2118
+ /* @__PURE__ */ h(qr, { children: [
2075
2119
  l.map((p) => /* @__PURE__ */ i(
2076
- _e,
2120
+ Ve,
2077
2121
  {
2078
2122
  model: p,
2079
2123
  activeModelId: d,
2080
- onModelSelect: r
2124
+ onModelSelect: o
2081
2125
  },
2082
2126
  p.id
2083
2127
  )),
2084
- f && /* @__PURE__ */ i(Ve, { "aria-hidden": !0 }),
2128
+ f && /* @__PURE__ */ i(Be, { "aria-hidden": !0 }),
2085
2129
  u.length > 0 && /* @__PURE__ */ i(Ne, { children: u.map((p) => /* @__PURE__ */ i(
2086
- _e,
2130
+ Ve,
2087
2131
  {
2088
2132
  model: p,
2089
2133
  activeModelId: d,
2090
- onModelSelect: r
2134
+ onModelSelect: o
2091
2135
  },
2092
2136
  p.id
2093
2137
  )) })
2094
2138
  ] }),
2095
- o && e.length > 0 && /* @__PURE__ */ i(Ve, { "aria-hidden": !0 }),
2096
- o && /* @__PURE__ */ i(
2097
- Ko,
2139
+ r && e.length > 0 && /* @__PURE__ */ i(Be, { "aria-hidden": !0 }),
2140
+ r && /* @__PURE__ */ i(
2141
+ Kr,
2098
2142
  {
2099
- prefix: /* @__PURE__ */ i(Pt, { size: "var(--font-size-base)", color: "var(--text-color-secondary)" }),
2143
+ prefix: /* @__PURE__ */ i(Xt, { size: "var(--font-size-base)", color: "var(--text-color-secondary)" }),
2100
2144
  content: "Manage models",
2101
- onAction: () => o("ai-providers")
2145
+ onAction: () => r("ai-providers")
2102
2146
  }
2103
2147
  )
2104
2148
  ] })
2105
2149
  }
2106
2150
  ) });
2107
2151
  }
2108
- function Bo({
2152
+ function Hr({
2109
2153
  label: e,
2110
2154
  icon: t,
2111
2155
  onClick: n,
2112
- onKeyDown: r
2156
+ onKeyDown: o
2113
2157
  }) {
2114
- return /* @__PURE__ */ h(Ho, { onClick: n, onKeyDown: r, children: [
2115
- /* @__PURE__ */ i(No, { children: e }),
2158
+ return /* @__PURE__ */ h(Nr, { onClick: n, onKeyDown: o, children: [
2159
+ /* @__PURE__ */ i(Fr, { children: e }),
2116
2160
  t
2117
2161
  ] });
2118
2162
  }
2119
- function _e({ model: e, activeModelId: t, onModelSelect: n }) {
2120
- const r = e.id === t;
2163
+ function Ve({ model: e, activeModelId: t, onModelSelect: n }) {
2164
+ const o = e.id === t;
2121
2165
  return /* @__PURE__ */ i(
2122
- je,
2166
+ Ze,
2123
2167
  {
2124
- prefix: _o(e.provider),
2125
- suffix: r ? /* @__PURE__ */ i(Yo, { size: "var(--font-size-base)", color: "var(--text-color-primary)" }) : void 0,
2168
+ prefix: Vr(e.provider),
2169
+ suffix: o ? /* @__PURE__ */ i(Gr, { size: "var(--font-size-base)", color: "var(--text-color-primary)" }) : void 0,
2126
2170
  onAction: () => n(e.id),
2127
- active: r,
2128
- children: /* @__PURE__ */ i(Wo, { children: e.label })
2171
+ active: o,
2172
+ children: /* @__PURE__ */ i(Yr, { children: e.label })
2129
2173
  }
2130
2174
  );
2131
2175
  }
2132
- const Ho = s.div`
2176
+ const Nr = c.div`
2133
2177
  display: flex;
2134
2178
  align-items: center;
2135
2179
  min-width: 0;
@@ -2144,7 +2188,7 @@ const Ho = s.div`
2144
2188
  &:hover {
2145
2189
  background: var(--layer-color-active);
2146
2190
  }
2147
- `, No = s.span`
2191
+ `, Fr = c.span`
2148
2192
  overflow: hidden;
2149
2193
  text-overflow: ellipsis;
2150
2194
  font-family: var(--font-family-base);
@@ -2153,13 +2197,13 @@ const Ho = s.div`
2153
2197
  line-height: var(--line-height-base);
2154
2198
  color: var(--text-color-primary);
2155
2199
  white-space: nowrap;
2156
- `, Fo = s.div`
2200
+ `, jr = c.div`
2157
2201
  --dropdown-menu-padding-top: 0;
2158
2202
 
2159
2203
  min-width: 0;
2160
2204
  flex: 1;
2161
2205
  position: relative;
2162
- `, jo = s(Et)`
2206
+ `, Wr = c(Qt)`
2163
2207
  width: 100%;
2164
2208
  min-width: 0;
2165
2209
  flex: 1;
@@ -2168,7 +2212,7 @@ const Ho = s.div`
2168
2212
  width: 100%;
2169
2213
  max-width: 200px;
2170
2214
  }
2171
- `, Uo = s(Ot)`
2215
+ `, Ur = c(en)`
2172
2216
  --dropdown-menu-item-gap: calc(var(--spacing-unit) / 2);
2173
2217
  --dropdown-menu-item-padding-vertical: var(--spacing-xxs);
2174
2218
  --dropdown-menu-item-padding-horizontal: var(--spacing-xs);
@@ -2177,111 +2221,171 @@ const Ho = s.div`
2177
2221
  margin: 5px 0;
2178
2222
  border-radius: var(--border-radius-lg);
2179
2223
  background: var(--bg-color);
2180
- `, Wo = s.span`
2224
+ `, Yr = c.span`
2181
2225
  flex: 1;
2182
2226
  min-width: 0;
2183
2227
  overflow: hidden;
2184
2228
  text-overflow: ellipsis;
2185
2229
  white-space: nowrap;
2186
- `, Yo = s(Rt)`
2230
+ `, Gr = c(tn)`
2187
2231
  margin-left: var(--spacing-xxs);
2188
- `, Ve = s.li`
2232
+ `, Be = c.li`
2189
2233
  flex-shrink: 0;
2190
2234
  list-style: none;
2191
2235
  width: 100%;
2192
2236
  height: 1px;
2193
2237
  margin: 0;
2194
2238
  background: var(--border-color-secondary);
2195
- `, Go = s.li`
2239
+ `, qr = c.li`
2196
2240
  display: flex;
2197
2241
  flex-direction: column;
2198
2242
  gap: var(--dropdown-menu-item-gap);
2199
2243
  list-style: none;
2200
2244
  min-height: 0;
2201
2245
  overflow-y: auto;
2202
- `, Ko = s(je)`
2246
+ `, Kr = c(Ze)`
2203
2247
  flex-shrink: 0;
2248
+ `, Zr = 280;
2249
+ function ft({ pinToBottom: e = !1 }) {
2250
+ const [t, n] = G(
2251
+ () => ke().getIndexingActivityState().inProgress
2252
+ );
2253
+ return H(() => ke().subscribe("indexing-activity", (r) => {
2254
+ n(r.inProgress);
2255
+ }), []), /* @__PURE__ */ i(Jr, { $open: t, $pinToBottom: e, "aria-hidden": !t, children: /* @__PURE__ */ i(
2256
+ U,
2257
+ {
2258
+ tip: "We're building a search index of your project. Until it's ready, the assistant may need more context in each reply to stay accurate, which can use more tokens.",
2259
+ placement: "top",
2260
+ width: "240px",
2261
+ arrowPosition: "left",
2262
+ children: /* @__PURE__ */ h(Xr, { role: "status", "aria-live": "polite", "aria-label": "Indexing in progress...", children: [
2263
+ /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i(J, {}) }),
2264
+ /* @__PURE__ */ i(Qr, { children: "Indexing in progress..." })
2265
+ ] })
2266
+ }
2267
+ ) });
2268
+ }
2269
+ const Jr = c.div`
2270
+ width: 100%;
2271
+ display: block;
2272
+
2273
+ ${({ $pinToBottom: e }) => e ? X`
2274
+ order: 1;
2275
+ margin-top: auto;
2276
+ ` : X`
2277
+ position: absolute;
2278
+ left: 0;
2279
+ right: 0;
2280
+ bottom: 100%;
2281
+ z-index: 1;
2282
+ margin-bottom: 4px;
2283
+ `}
2284
+
2285
+ opacity: ${({ $open: e }) => e ? 1 : 0};
2286
+ transition: opacity ${Zr}ms ease-out;
2287
+ pointer-events: ${({ $open: e }) => e ? "auto" : "none"};
2288
+
2289
+ ${J} {
2290
+ animation-play-state: ${({ $open: e }) => e ? "running" : "paused"};
2291
+ }
2292
+ `, Xr = c.div`
2293
+ width: 100%;
2294
+ display: flex;
2295
+ align-items: center;
2296
+ gap: var(--spacing-xxs);
2297
+ background: var(--layer-color);
2298
+ padding: 2px var(--spacing-sm);
2299
+ border-radius: 4px;
2300
+ font-size: var(--font-size-sm);
2301
+ line-height: 12px;
2302
+ `, Qr = c.div`
2303
+ flex: 1;
2304
+ min-width: 0;
2204
2305
  `;
2205
- function qo() {
2306
+ function ei() {
2206
2307
  const {
2207
2308
  chatId: e,
2208
2309
  isLoading: t,
2209
2310
  pendingComposerPreset: n,
2210
- clearPendingComposerPreset: r,
2211
- availableModels: o,
2311
+ clearPendingComposerPreset: o,
2312
+ availableModels: r,
2212
2313
  selectedModelId: a,
2213
- selectModel: c,
2314
+ selectModel: s,
2214
2315
  onSettingsOpen: d
2215
- } = Ge(), { messages: l, isStreaming: u, sendMessage: f, stopGeneration: p } = q(), { isOpen: g } = Ke(), [y, v] = K(""), x = F(null), w = F(null), b = F(!0), m = l.length > 0, I = Do(l.length), P = I !== void 0 && I > 0 && !m, D = R((L = "smooth") => {
2216
- w.current && w.current.scrollTo({
2217
- top: w.current.scrollHeight,
2316
+ } = Ye(), { messages: l, isStreaming: u, sendMessage: f, stopGeneration: p } = Q(), { isOpen: g } = Ge(), [m, v] = G(""), x = N(null), b = N(null), w = N(!0), y = l.length > 0, S = t || y, E = zr(l.length), q = E !== void 0 && E > 0 && !y, _ = D((L = "smooth") => {
2317
+ b.current && b.current.scrollTo({
2318
+ top: b.current.scrollHeight,
2218
2319
  behavior: L
2219
2320
  });
2220
- }, []), Z = R(() => {
2221
- const L = w.current;
2321
+ }, []), ee = D(() => {
2322
+ const L = b.current;
2222
2323
  if (!L) return;
2223
- L.scrollHeight - L.scrollTop - L.clientHeight < 50 && (b.current = !0);
2324
+ L.scrollHeight - L.scrollTop - L.clientHeight < 50 && (w.current = !0);
2224
2325
  }, []);
2225
2326
  H(() => {
2226
- const L = w.current;
2327
+ const L = b.current;
2227
2328
  if (!L) return;
2228
- const se = (vt) => {
2229
- vt.deltaY < 0 && (b.current = !1);
2329
+ const fe = (vt) => {
2330
+ vt.deltaY < 0 && (w.current = !1);
2230
2331
  };
2231
- return L.addEventListener("wheel", se, { passive: !0 }), () => L.removeEventListener("wheel", se);
2332
+ return L.addEventListener("wheel", fe, { passive: !0 }), () => L.removeEventListener("wheel", fe);
2232
2333
  }, []);
2233
- const J = R(async () => {
2234
- y && (v(""), b.current = !0, await f(y), x.current && requestAnimationFrame(() => x.current?.focus()));
2235
- }, [f, y]);
2334
+ const gt = D(async () => {
2335
+ m && (v(""), w.current = !0, await f(m), x.current && requestAnimationFrame(() => x.current?.focus()));
2336
+ }, [f, m]);
2236
2337
  return H(() => {
2237
- g && (x.current && x.current.focus(), b.current = !0, D());
2238
- }, [g, l.length, D]), H(() => {
2239
- u && b.current && D();
2338
+ g && (x.current && x.current.focus(), w.current = !0, _());
2339
+ }, [g, l.length, _]), H(() => {
2340
+ u && w.current && _();
2240
2341
  }), H(
2241
2342
  function() {
2242
- g && x.current && (x.current.focus(), D("instant"));
2343
+ g && x.current && (x.current.focus(), _("instant"));
2243
2344
  },
2244
- [e, g, D]
2345
+ [e, g, _]
2245
2346
  ), H(
2246
2347
  function() {
2247
- !g || n === null || (v(n), r());
2348
+ !g || n === null || (v(n), o());
2248
2349
  },
2249
- [g, n, r]
2250
- ), /* @__PURE__ */ h(pt, { children: [
2350
+ [g, n, o]
2351
+ ), /* @__PURE__ */ h(ut, { children: [
2251
2352
  /* @__PURE__ */ i(
2252
- Zo,
2353
+ ti,
2253
2354
  {
2254
- ref: w,
2255
- $isExpanded: t || m,
2256
- $isAnimated: u || P,
2257
- onScroll: Z,
2258
- children: t ? /* @__PURE__ */ i(Jo, { children: /* @__PURE__ */ i(me, { size: "20px" }) }) : /* @__PURE__ */ i(Ro, {})
2355
+ ref: b,
2356
+ $isExpanded: S,
2357
+ $isAnimated: u || q,
2358
+ onScroll: ee,
2359
+ children: t ? /* @__PURE__ */ i(oi, { children: /* @__PURE__ */ i(we, { size: "20px" }) }) : /* @__PURE__ */ i($r, {})
2259
2360
  }
2260
2361
  ),
2261
- /* @__PURE__ */ i(
2262
- wn,
2263
- {
2264
- value: y,
2265
- onValueChange: v,
2266
- onSubmit: J,
2267
- isStreaming: u,
2268
- onStop: p,
2269
- textareaRef: x,
2270
- modelSelector: /* @__PURE__ */ i(
2271
- Vo,
2272
- {
2273
- models: o,
2274
- selectedModelId: a,
2275
- placement: m ? "top" : "bottom",
2276
- onModelSelect: c,
2277
- onSettingsOpen: d
2278
- }
2279
- )
2280
- }
2281
- )
2362
+ /* @__PURE__ */ h(ni, { $isExpanded: !S, children: [
2363
+ /* @__PURE__ */ i(ft, { pinToBottom: !S }),
2364
+ /* @__PURE__ */ i(
2365
+ mn,
2366
+ {
2367
+ value: m,
2368
+ onValueChange: v,
2369
+ onSubmit: gt,
2370
+ isStreaming: u,
2371
+ onStop: p,
2372
+ textareaRef: x,
2373
+ modelSelector: /* @__PURE__ */ i(
2374
+ Br,
2375
+ {
2376
+ models: r,
2377
+ selectedModelId: a,
2378
+ placement: y ? "top" : "bottom",
2379
+ onModelSelect: s,
2380
+ onSettingsOpen: d
2381
+ }
2382
+ )
2383
+ }
2384
+ )
2385
+ ] })
2282
2386
  ] });
2283
2387
  }
2284
- const Zo = s.div`
2388
+ const ti = c.div`
2285
2389
  flex: ${({ $isExpanded: e }) => e ? 1 : 0};
2286
2390
  width: 100%;
2287
2391
  overflow: auto;
@@ -2289,44 +2393,50 @@ const Zo = s.div`
2289
2393
  transition-property: flex;
2290
2394
  transition-duration: ${(e) => e.$isAnimated ? "var(--replay-transition-duration)" : "0s"};
2291
2395
  transition-timing-function: var(--replay-transition-timing-function);
2292
- `, Jo = s.div`
2396
+ `, ni = c.div`
2397
+ position: relative;
2398
+ display: flex;
2399
+ flex-direction: column;
2400
+ width: 100%;
2401
+ flex: ${({ $isExpanded: e }) => e ? 1 : 0};
2402
+ `, oi = c.div`
2293
2403
  display: flex;
2294
2404
  justify-content: center;
2295
2405
  height: 100%;
2296
2406
  padding-top: var(--spacing-lg);
2297
- `, O = {
2407
+ `, $ = {
2298
2408
  TODAY: "today",
2299
2409
  YESTERDAY: "yesterday",
2300
2410
  LAST_WEEK: "last_week",
2301
2411
  LAST_MONTH: "last_month",
2302
2412
  OLDER: "older"
2303
- }, Xo = {
2304
- [O.TODAY]: "Today",
2305
- [O.YESTERDAY]: "Yesterday",
2306
- [O.LAST_WEEK]: "Last 7 days",
2307
- [O.LAST_MONTH]: "Last 30 days",
2308
- [O.OLDER]: "Older"
2413
+ }, ri = {
2414
+ [$.TODAY]: "Today",
2415
+ [$.YESTERDAY]: "Yesterday",
2416
+ [$.LAST_WEEK]: "Last 7 days",
2417
+ [$.LAST_MONTH]: "Last 30 days",
2418
+ [$.OLDER]: "Older"
2309
2419
  };
2310
- function Qo(e, t = Date.now()) {
2311
- const n = W(e).startOf("day"), r = W(t).startOf("day"), o = W(t).subtract(1, "day").startOf("day"), a = W(t).subtract(7, "day").startOf("day"), c = W(t).subtract(30, "day").startOf("day");
2312
- return n.isSame(r, "day") ? O.TODAY : n.isSame(o, "day") ? O.YESTERDAY : !n.isBefore(a, "day") && n.isBefore(o, "day") ? O.LAST_WEEK : !n.isBefore(c, "day") && n.isBefore(a, "day") ? O.LAST_MONTH : O.OLDER;
2420
+ function ii(e, t = Date.now()) {
2421
+ const n = W(e).startOf("day"), o = W(t).startOf("day"), r = W(t).subtract(1, "day").startOf("day"), a = W(t).subtract(7, "day").startOf("day"), s = W(t).subtract(30, "day").startOf("day");
2422
+ return n.isSame(o, "day") ? $.TODAY : n.isSame(r, "day") ? $.YESTERDAY : !n.isBefore(a, "day") && n.isBefore(r, "day") ? $.LAST_WEEK : !n.isBefore(s, "day") && n.isBefore(a, "day") ? $.LAST_MONTH : $.OLDER;
2313
2423
  }
2314
- function ei(e) {
2424
+ function ai(e) {
2315
2425
  const t = [];
2316
2426
  for (const n of e) {
2317
- const r = Qo(n.updatedAt), o = t[t.length - 1];
2318
- !o || o.bucket !== r ? t.push({ bucket: r, chats: [n] }) : o.chats.push(n);
2427
+ const o = ii(n.updatedAt), r = t[t.length - 1];
2428
+ !r || r.bucket !== o ? t.push({ bucket: o, chats: [n] }) : r.chats.push(n);
2319
2429
  }
2320
2430
  return t;
2321
2431
  }
2322
- function ti(e) {
2432
+ function si(e) {
2323
2433
  const {
2324
2434
  scrollRef: t,
2325
2435
  sentinelRef: n,
2326
- hasNextPage: r,
2327
- isFetchingNextPage: o,
2436
+ hasNextPage: o,
2437
+ isFetchingNextPage: r,
2328
2438
  fetchNextPage: a,
2329
- observerResetKey: c
2439
+ observerResetKey: s
2330
2440
  } = e;
2331
2441
  Fe(() => {
2332
2442
  const d = t.current, l = n.current;
@@ -2334,52 +2444,52 @@ function ti(e) {
2334
2444
  const u = new IntersectionObserver(
2335
2445
  (f) => {
2336
2446
  const p = f[0];
2337
- p && p.isIntersecting && r && (o || a());
2447
+ p && p.isIntersecting && o && (r || a());
2338
2448
  },
2339
2449
  { root: d, rootMargin: "80px" }
2340
2450
  );
2341
2451
  return u.observe(l), () => {
2342
2452
  u.disconnect();
2343
2453
  };
2344
- }, [c, a, r, o, t, n]);
2454
+ }, [s, a, o, r, t, n]);
2345
2455
  }
2346
- const ht = s(pt)`
2456
+ const pt = c(ut)`
2347
2457
  gap: var(--spacing-xxs);
2348
2458
  user-select: none;
2349
- `, ni = s.div`
2459
+ `, ci = c.div`
2350
2460
  display: flex;
2351
2461
  flex-direction: column;
2352
2462
  gap: var(--spacing-xs);
2353
- `, ri = s.div`
2463
+ `, li = c.div`
2354
2464
  display: flex;
2355
2465
  flex-direction: column;
2356
2466
  gap: var(--spacing-xxs);
2357
- `, oi = s(ht)`
2467
+ `, di = c(pt)`
2358
2468
  display: flex;
2359
2469
  flex-grow: 1;
2360
2470
  align-items: center;
2361
2471
  flex-direction: column;
2362
2472
  padding: var(--spacing-md);
2363
- `, ii = s.div`
2473
+ `, ui = c.div`
2364
2474
  display: flex;
2365
2475
  flex-grow: 1;
2366
2476
  align-items: center;
2367
2477
  justify-content: center;
2368
- `, ai = s.div`
2478
+ `, fi = c.div`
2369
2479
  display: flex;
2370
2480
  flex-direction: column;
2371
2481
  align-items: center;
2372
2482
  max-width: 75%;
2373
2483
  gap: var(--spacing-xxs);
2374
- `, si = s.div`
2484
+ `, pi = c.div`
2375
2485
  display: flex;
2376
2486
  justify-content: center;
2377
2487
  padding: var(--spacing-xs);
2378
- `, ci = s(ne)`
2488
+ `, hi = c(se)`
2379
2489
  padding-left: var(--spacing-xs);
2380
2490
  font-size: var(--font-size-sm);
2381
2491
  color: var(--color-warm-grey-7);
2382
- `, li = s.div`
2492
+ `, gi = c.div`
2383
2493
  display: flex;
2384
2494
  flex-grow: 1;
2385
2495
 
@@ -2387,7 +2497,7 @@ const ht = s(pt)`
2387
2497
  flex-grow: 1;
2388
2498
  min-width: 0;
2389
2499
  }
2390
- `, di = s.div`
2500
+ `, vi = c.div`
2391
2501
  display: flex;
2392
2502
  align-items: center;
2393
2503
  justify-content: space-between;
@@ -2398,7 +2508,7 @@ const ht = s(pt)`
2398
2508
  gap: calc(var(--spacing-xxs) * 2.5);
2399
2509
  cursor: pointer;
2400
2510
 
2401
- ${V} {
2511
+ ${B} {
2402
2512
  display: none;
2403
2513
  }
2404
2514
 
@@ -2406,73 +2516,73 @@ const ht = s(pt)`
2406
2516
  &:hover {
2407
2517
  background-color: var(--color-hover-base);
2408
2518
 
2409
- ${V} {
2519
+ ${B} {
2410
2520
  display: inline-flex;
2411
2521
  }
2412
2522
  }
2413
- `, ui = s(ne)`
2523
+ `, mi = c(se)`
2414
2524
  overflow: hidden;
2415
2525
  white-space: nowrap;
2416
2526
  text-overflow: ellipsis;
2417
- `, fi = s.div`
2527
+ `, yi = c.div`
2418
2528
  height: 1px;
2419
2529
  flex-shrink: 0;
2420
2530
  `;
2421
- function pi(e) {
2422
- const { chat: t, onSelect: n, onRemove: r } = e;
2423
- return /* @__PURE__ */ i(li, { children: /* @__PURE__ */ i(Y, { tip: W(t.updatedAt).format("MMM DD, YYYY, hh:mm:ss A"), className: "expanded", children: /* @__PURE__ */ h(di, { role: "button", onClick: () => n?.(t.id), children: [
2424
- /* @__PURE__ */ i(ui, { children: t.title ?? "New chat" }),
2531
+ function xi(e) {
2532
+ const { chat: t, onSelect: n, onRemove: o } = e;
2533
+ return /* @__PURE__ */ i(gi, { children: /* @__PURE__ */ i(U, { tip: W(t.updatedAt).format("MMM DD, YYYY, hh:mm:ss A"), className: "expanded", children: /* @__PURE__ */ h(vi, { role: "button", onClick: () => n?.(t.id), children: [
2534
+ /* @__PURE__ */ i(mi, { children: t.title ?? "New chat" }),
2425
2535
  /* @__PURE__ */ i(
2426
- V,
2536
+ B,
2427
2537
  {
2428
2538
  variant: "ghost",
2429
2539
  size: "small",
2430
2540
  tone: "danger",
2431
- icon: /* @__PURE__ */ i(zt, {}),
2432
- onClick: (o) => {
2433
- o.stopPropagation(), r?.(t.id);
2541
+ icon: /* @__PURE__ */ i(an, {}),
2542
+ onClick: (r) => {
2543
+ r.stopPropagation(), o?.(t.id);
2434
2544
  }
2435
2545
  }
2436
2546
  )
2437
2547
  ] }) }) });
2438
2548
  }
2439
- function hi(e) {
2440
- const { group: t, onChatSelect: n, onChatRemove: r } = e;
2441
- return /* @__PURE__ */ h(ri, { children: [
2442
- /* @__PURE__ */ i(ci, { children: Xo[t.bucket] }),
2443
- t.chats.map((o) => /* @__PURE__ */ i(
2444
- pi,
2549
+ function bi(e) {
2550
+ const { group: t, onChatSelect: n, onChatRemove: o } = e;
2551
+ return /* @__PURE__ */ h(li, { children: [
2552
+ /* @__PURE__ */ i(hi, { children: ri[t.bucket] }),
2553
+ t.chats.map((r) => /* @__PURE__ */ i(
2554
+ xi,
2445
2555
  {
2446
- chat: o,
2556
+ chat: r,
2447
2557
  onSelect: n,
2448
- onRemove: r
2558
+ onRemove: o
2449
2559
  },
2450
- o.id
2560
+ r.id
2451
2561
  ))
2452
2562
  ] });
2453
2563
  }
2454
- function gi() {
2455
- return /* @__PURE__ */ i(ii, { children: /* @__PURE__ */ h(ai, { children: [
2456
- /* @__PURE__ */ i(ne, { textAlign: "center", fontWeight: "var(--font-weight-semibold)", children: "No chat history" }),
2457
- /* @__PURE__ */ i(ne, { textAlign: "center", children: "Ask questions or let the assistant take action for you." })
2564
+ function wi() {
2565
+ return /* @__PURE__ */ i(ui, { children: /* @__PURE__ */ h(fi, { children: [
2566
+ /* @__PURE__ */ i(se, { textAlign: "center", fontWeight: "var(--font-weight-semibold)", children: "No chat history" }),
2567
+ /* @__PURE__ */ i(se, { textAlign: "center", children: "Ask questions or let the assistant take action for you." })
2458
2568
  ] }) });
2459
2569
  }
2460
- function vi() {
2461
- return /* @__PURE__ */ i(oi, { children: /* @__PURE__ */ i(me, {}) });
2570
+ function Ci() {
2571
+ return /* @__PURE__ */ i(di, { children: /* @__PURE__ */ i(we, {}) });
2462
2572
  }
2463
- const mi = 50;
2464
- function yi(e) {
2465
- const { onChatSelect: t, onChatRemove: n } = e, r = F(null), o = F(null), { data: a, isPending: c, hasNextPage: d, isFetchingNextPage: l, fetchNextPage: u } = ln(mi), f = S(() => (a?.pages ?? []).flatMap((g) => g.items), [a?.pages]), p = S(() => ei(f), [f]);
2466
- return ti({
2467
- scrollRef: r,
2468
- sentinelRef: o,
2573
+ const ki = 50;
2574
+ function Ti(e) {
2575
+ const { onChatSelect: t, onChatRemove: n } = e, o = N(null), r = N(null), { data: a, isPending: s, hasNextPage: d, isFetchingNextPage: l, fetchNextPage: u } = jt(ki), f = A(() => (a?.pages ?? []).flatMap((g) => g.items), [a?.pages]), p = A(() => ai(f), [f]);
2576
+ return si({
2577
+ scrollRef: o,
2578
+ sentinelRef: r,
2469
2579
  hasNextPage: d,
2470
2580
  isFetchingNextPage: l,
2471
2581
  fetchNextPage: u,
2472
2582
  observerResetKey: a?.pages.length
2473
- }), c && !a ? /* @__PURE__ */ i(vi, {}) : f.length === 0 ? /* @__PURE__ */ i(gi, {}) : /* @__PURE__ */ h(ht, { ref: r, children: [
2474
- /* @__PURE__ */ i(ni, { children: p.map((g) => /* @__PURE__ */ i(
2475
- hi,
2583
+ }), s && !a ? /* @__PURE__ */ i(Ci, {}) : f.length === 0 ? /* @__PURE__ */ i(wi, {}) : /* @__PURE__ */ h(pt, { ref: o, children: [
2584
+ /* @__PURE__ */ i(ci, { children: p.map((g) => /* @__PURE__ */ i(
2585
+ bi,
2476
2586
  {
2477
2587
  group: g,
2478
2588
  onChatSelect: t,
@@ -2480,21 +2590,21 @@ function yi(e) {
2480
2590
  },
2481
2591
  `${g.bucket}-${g.chats[0]?.id ?? ""}`
2482
2592
  )) }),
2483
- d && /* @__PURE__ */ i(fi, { ref: o, "aria-hidden": !0 }),
2484
- l && /* @__PURE__ */ i(si, { children: /* @__PURE__ */ i(me, {}) })
2593
+ d && /* @__PURE__ */ i(yi, { ref: r, "aria-hidden": !0 }),
2594
+ l && /* @__PURE__ */ i(pi, { children: /* @__PURE__ */ i(we, {}) })
2485
2595
  ] });
2486
2596
  }
2487
- const xi = yt(null);
2488
- function wi(e) {
2489
- const t = xt(xi);
2597
+ const Ii = yt(null);
2598
+ function Ai(e) {
2599
+ const t = xt(Ii);
2490
2600
  if (t?.components) {
2491
- const { LinkComponent: c } = t.components;
2492
- return /* @__PURE__ */ i(c, { ...e });
2601
+ const { LinkComponent: s } = t.components;
2602
+ return /* @__PURE__ */ i(s, { ...e });
2493
2603
  }
2494
- const { external: n, languageInsensitive: r, innerRef: o, ...a } = e;
2495
- return /* @__PURE__ */ i(dn, { ref: o, ...a });
2604
+ const { external: n, languageInsensitive: o, innerRef: r, ...a } = e;
2605
+ return /* @__PURE__ */ i(fn, { ref: r, ...a });
2496
2606
  }
2497
- const bi = () => wt`
2607
+ const Si = () => bt`
2498
2608
  0% {
2499
2609
  color: var(--button-content-color);
2500
2610
  background-color: var(--button-bg-color-active);
@@ -2508,30 +2618,30 @@ const bi = () => wt`
2508
2618
  color: var(--button-content-color);
2509
2619
  background-color: var(--button-bg-color-active);
2510
2620
  }
2511
- `, Ci = s(wi)`
2621
+ `, Li = c(Ai)`
2512
2622
  text-decoration: none;
2513
2623
  &:focus-visible {
2514
2624
  outline: 1px solid var(--button-border-color-focused);
2515
2625
  }
2516
2626
  border-radius: var(--button-border-radius);
2517
2627
  `;
2518
- function ki({
2628
+ function Pi({
2519
2629
  variant: e = "secondary",
2520
2630
  tone: t = "default",
2521
2631
  size: n = "medium",
2522
- extraClass: r = "",
2523
- className: o = ""
2632
+ extraClass: o = "",
2633
+ className: r = ""
2524
2634
  }) {
2525
2635
  return [
2526
2636
  "button",
2527
- r,
2637
+ o,
2528
2638
  `button-tone-${t}`,
2529
2639
  `button-variant-${e}`,
2530
2640
  `button-size-${n}`,
2531
- o
2532
- ].filter((c) => c).join(" ").trim();
2641
+ r
2642
+ ].filter((s) => s).join(" ").trim();
2533
2643
  }
2534
- const Ti = s.button`
2644
+ const Ei = c.button`
2535
2645
  width: ${({ $fullWidth: e }) => e ? "100%" : "auto"};
2536
2646
 
2537
2647
  display: inline-flex;
@@ -2602,90 +2712,90 @@ const Ti = s.button`
2602
2712
  border-width: var(--button-border-width-disabled);
2603
2713
  }
2604
2714
 
2605
- ${({ $variant: e, $size: t }) => (e === "link" || e === "ghost") && t === "small" && ue`
2715
+ ${({ $variant: e, $size: t }) => (e === "link" || e === "ghost") && t === "small" && X`
2606
2716
  --button-font-size: var(--font-size-sm);
2607
2717
  --button-line-height: var(--line-height-sm);
2608
2718
  --button-icon-padding: var(--button-icon-padding-small) !important;
2609
2719
  `}
2610
2720
 
2611
- ${({ $blinking: e }) => e && ue`
2721
+ ${({ $blinking: e }) => e && X`
2612
2722
  pointer-events: none;
2613
- animation: ${bi()} 1.2s infinite;
2723
+ animation: ${Si()} 1.2s infinite;
2614
2724
  `}
2615
- `, Ai = (e) => {
2725
+ `, Ri = (e) => {
2616
2726
  const {
2617
2727
  languageInsensitive: t,
2618
2728
  fullWidth: n,
2619
- blinking: r,
2620
- iconPosition: o,
2729
+ blinking: o,
2730
+ iconPosition: r,
2621
2731
  icon: a,
2622
- children: c,
2732
+ children: s,
2623
2733
  variant: d,
2624
2734
  tone: l,
2625
2735
  size: u,
2626
2736
  extraClass: f,
2627
2737
  to: p,
2628
2738
  external: g,
2629
- className: y,
2739
+ className: m,
2630
2740
  ...v
2631
- } = e, x = "tabIndex" in e ? e.tabIndex : e.to ? -1 : void 0, w = /* @__PURE__ */ h(
2632
- Ti,
2741
+ } = e, x = "tabIndex" in e ? e.tabIndex : e.to ? -1 : void 0, b = /* @__PURE__ */ h(
2742
+ Ei,
2633
2743
  {
2634
2744
  "data-component-name": "Button/Button",
2635
2745
  ...v,
2636
- className: ki({ variant: d, tone: l, size: u, extraClass: f, className: y }),
2746
+ className: Pi({ variant: d, tone: l, size: u, extraClass: f, className: m }),
2637
2747
  $fullWidth: n,
2638
- $blinking: r,
2639
- $iconPosition: o,
2748
+ $blinking: o,
2749
+ $iconPosition: r,
2640
2750
  $icon: a,
2641
- $iconOnly: !c && a != null,
2751
+ $iconOnly: !s && a != null,
2642
2752
  $variant: d,
2643
2753
  $size: u,
2644
2754
  tabIndex: x,
2645
2755
  children: [
2646
- a && o !== "right" && a,
2647
- c,
2648
- a && o === "right" && a
2756
+ a && r !== "right" && a,
2757
+ s,
2758
+ a && r === "right" && a
2649
2759
  ]
2650
2760
  }
2651
2761
  );
2652
2762
  return p ? /* @__PURE__ */ i(
2653
- Ci,
2763
+ Li,
2654
2764
  {
2655
2765
  to: p,
2656
2766
  external: g,
2657
2767
  languageInsensitive: t,
2658
2768
  onClick: e.onClick,
2659
- children: w
2769
+ children: b
2660
2770
  }
2661
- ) : w;
2662
- }, te = s(Ai)``;
2663
- function Si() {
2664
- const e = F(null), [t, n] = K(!1);
2771
+ ) : b;
2772
+ }, ae = c(Ri)``;
2773
+ function Oi() {
2774
+ const e = N(null), [t, n] = G(!1);
2665
2775
  return Fe(() => {
2666
2776
  if (!e.current) return;
2667
- const r = e.current;
2668
- function o() {
2669
- n(r.scrollWidth > r.clientWidth);
2777
+ const o = e.current;
2778
+ function r() {
2779
+ n(o.scrollWidth > o.clientWidth);
2670
2780
  }
2671
- o();
2672
- const a = new ResizeObserver(o);
2673
- return a.observe(r), () => a.disconnect();
2781
+ r();
2782
+ const a = new ResizeObserver(r);
2783
+ return a.observe(o), () => a.disconnect();
2674
2784
  }, []), {
2675
2785
  ref: e,
2676
2786
  value: t
2677
2787
  };
2678
2788
  }
2679
- function Ii(e) {
2680
- const { ref: t, value: n } = Si();
2681
- return /* @__PURE__ */ i(Li, { children: /* @__PURE__ */ i(Y, { tip: e.value, className: "no-overflow", disabled: !n, children: /* @__PURE__ */ i(Pi, { ref: t, children: e.value }) }) });
2789
+ function $i(e) {
2790
+ const { ref: t, value: n } = Oi();
2791
+ return /* @__PURE__ */ i(Di, { children: /* @__PURE__ */ i(U, { tip: e.value, className: "no-overflow", disabled: !n, children: /* @__PURE__ */ i(zi, { ref: t, children: e.value }) }) });
2682
2792
  }
2683
- const Li = s.div`
2793
+ const Di = c.div`
2684
2794
  overflow: hidden;
2685
2795
  .tooltip-no-overflow {
2686
2796
  overflow: hidden;
2687
2797
  }
2688
- `, Pi = s.div`
2798
+ `, zi = c.div`
2689
2799
  color: var(--text-color-primary);
2690
2800
  font-size: var(--font-size-base);
2691
2801
  line-height: var(--line-height-base);
@@ -2694,14 +2804,14 @@ const Li = s.div`
2694
2804
  text-overflow: ellipsis;
2695
2805
  user-select: none;
2696
2806
  `;
2697
- function gt(e) {
2807
+ function ht(e) {
2698
2808
  const { children: t, buttons: n } = e;
2699
- return /* @__PURE__ */ h(Ei, { children: [
2700
- /* @__PURE__ */ i(Oi, { children: t }),
2701
- n && /* @__PURE__ */ i(Ri, { children: n })
2809
+ return /* @__PURE__ */ h(Mi, { children: [
2810
+ /* @__PURE__ */ i(_i, { children: t }),
2811
+ n && /* @__PURE__ */ i(Vi, { children: n })
2702
2812
  ] });
2703
2813
  }
2704
- const Ei = s.div`
2814
+ const Mi = c.div`
2705
2815
  display: flex;
2706
2816
  flex-direction: row;
2707
2817
  align-items: center;
@@ -2709,62 +2819,62 @@ const Ei = s.div`
2709
2819
  gap: var(--spacing-xs);
2710
2820
  width: 100%;
2711
2821
  flex-shrink: 0;
2712
- `, Oi = s.div`
2822
+ `, _i = c.div`
2713
2823
  display: flex;
2714
2824
  align-items: center;
2715
2825
  gap: var(--spacing-xs);
2716
2826
  min-width: 0;
2717
2827
  flex: 1;
2718
- `, Ri = s.div`
2828
+ `, Vi = c.div`
2719
2829
  display: flex;
2720
2830
  align-items: center;
2721
2831
  gap: 2px;
2722
2832
  `;
2723
- function $i(e) {
2724
- const { title: t, onCreateNewChat: n, onViewHistory: r, onClose: o } = e;
2725
- return /* @__PURE__ */ h(gt, { buttons: /* @__PURE__ */ h(Ne, { children: [
2726
- /* @__PURE__ */ i(Y, { tip: "New chat", children: /* @__PURE__ */ i(
2727
- te,
2833
+ function Bi(e) {
2834
+ const { title: t, onCreateNewChat: n, onViewHistory: o, onClose: r } = e;
2835
+ return /* @__PURE__ */ h(ht, { buttons: /* @__PURE__ */ h(Ne, { children: [
2836
+ /* @__PURE__ */ i(U, { tip: "New chat", children: /* @__PURE__ */ i(
2837
+ ae,
2728
2838
  {
2729
2839
  size: "small",
2730
2840
  variant: "text",
2731
2841
  "aria-label": "Create new chat",
2732
2842
  onClick: n,
2733
- icon: /* @__PURE__ */ i(Vt, {})
2843
+ icon: /* @__PURE__ */ i(cn, {})
2734
2844
  }
2735
2845
  ) }),
2736
- /* @__PURE__ */ i(Y, { tip: "Chat history", children: /* @__PURE__ */ i(
2737
- te,
2846
+ /* @__PURE__ */ i(U, { tip: "Chat history", children: /* @__PURE__ */ i(
2847
+ ae,
2738
2848
  {
2739
2849
  size: "small",
2740
2850
  variant: "text",
2741
2851
  "aria-label": "View chat history",
2742
- onClick: r,
2743
- icon: /* @__PURE__ */ i(Bt, {})
2852
+ onClick: o,
2853
+ icon: /* @__PURE__ */ i(ln, {})
2744
2854
  }
2745
2855
  ) }),
2746
- /* @__PURE__ */ i(Mi, { children: /* @__PURE__ */ i(Zt, {}) }),
2747
- /* @__PURE__ */ i(Y, { tip: "Close", arrowPosition: "left", children: /* @__PURE__ */ i(
2748
- te,
2856
+ /* @__PURE__ */ i(Ni, { children: /* @__PURE__ */ i(Et, {}) }),
2857
+ /* @__PURE__ */ i(U, { tip: "Close", arrowPosition: "left", children: /* @__PURE__ */ i(
2858
+ ae,
2749
2859
  {
2750
2860
  variant: "text",
2751
2861
  size: "small",
2752
2862
  "aria-label": "Close panel",
2753
- icon: /* @__PURE__ */ i(Ht, {}),
2754
- onClick: o
2863
+ icon: /* @__PURE__ */ i(dn, {}),
2864
+ onClick: r
2755
2865
  }
2756
2866
  ) })
2757
2867
  ] }), children: [
2758
- /* @__PURE__ */ i(Di, { children: /* @__PURE__ */ i(_t, { size: "14px" }) }),
2759
- /* @__PURE__ */ i(Ii, { value: t })
2868
+ /* @__PURE__ */ i(Hi, { children: /* @__PURE__ */ i(sn, { size: "14px" }) }),
2869
+ /* @__PURE__ */ i($i, { value: t })
2760
2870
  ] });
2761
2871
  }
2762
- const Di = s.div`
2872
+ const Hi = c.div`
2763
2873
  display: flex;
2764
- `, Mi = s.div`
2874
+ `, Ni = c.div`
2765
2875
  display: flex;
2766
2876
  height: 14px;
2767
- `, zi = /* @__PURE__ */ new Set([
2877
+ `, Fi = /* @__PURE__ */ new Set([
2768
2878
  "color",
2769
2879
  "fontFamily",
2770
2880
  "fontSize",
@@ -2775,8 +2885,8 @@ const Di = s.div`
2775
2885
  "marginBottom",
2776
2886
  "marginTop",
2777
2887
  "textAlign"
2778
- ]), _i = s.span.withConfig({
2779
- shouldForwardProp: (e) => !zi.has(e)
2888
+ ]), ji = c.span.withConfig({
2889
+ shouldForwardProp: (e) => !Fi.has(e)
2780
2890
  }).attrs({
2781
2891
  "data-component-name": "Typography/Typography"
2782
2892
  })`
@@ -2791,63 +2901,62 @@ const Di = s.div`
2791
2901
  margin-top: ${({ marginTop: e }) => e};
2792
2902
  text-align: ${({ textAlign: e }) => e};
2793
2903
  `;
2794
- function Vi(e) {
2904
+ function Wi(e) {
2795
2905
  const { onReturnFromHistory: t } = e;
2796
- return /* @__PURE__ */ h(gt, { children: [
2906
+ return /* @__PURE__ */ h(ht, { children: [
2797
2907
  /* @__PURE__ */ i(
2798
- te,
2908
+ ae,
2799
2909
  {
2800
2910
  size: "small",
2801
2911
  variant: "text",
2802
2912
  "aria-label": "Return to chat",
2803
2913
  onClick: t,
2804
- icon: /* @__PURE__ */ i(Nt, {})
2914
+ icon: /* @__PURE__ */ i(un, {})
2805
2915
  }
2806
2916
  ),
2807
- /* @__PURE__ */ i(Bi, { children: /* @__PURE__ */ i(_i, { children: "Chat history" }) })
2917
+ /* @__PURE__ */ i(Ui, { children: /* @__PURE__ */ i(ji, { children: "Chat history" }) })
2808
2918
  ] });
2809
2919
  }
2810
- const Bi = s.div`
2920
+ const Ui = c.div`
2811
2921
  user-select: none;
2812
2922
  `;
2813
- function Xi() {
2814
- const [e, t] = K(j.CHAT), n = Ke(), r = Ge(), o = () => {
2815
- t(j.HISTORY);
2923
+ function aa() {
2924
+ const [e, t] = G(F.CHAT), n = Ge(), o = Ye(), r = () => {
2925
+ t(F.HISTORY);
2816
2926
  }, a = () => {
2817
- t(j.CHAT);
2818
- }, c = async (d) => {
2819
- r.selectChat(d), t(j.CHAT);
2927
+ t(F.CHAT);
2928
+ }, s = async (d) => {
2929
+ o.selectChat(d), t(F.CHAT);
2820
2930
  };
2821
- return /* @__PURE__ */ h(Hi, { children: [
2822
- /* @__PURE__ */ h(Be, { isActive: e === j.CHAT, children: [
2931
+ return /* @__PURE__ */ h(Yi, { children: [
2932
+ /* @__PURE__ */ h(He, { isActive: e === F.CHAT, children: [
2823
2933
  /* @__PURE__ */ i(
2824
- $i,
2934
+ Bi,
2825
2935
  {
2826
- title: r.title,
2827
- onCreateNewChat: r.createNewChat,
2828
- onViewHistory: o,
2936
+ title: o.title,
2937
+ onCreateNewChat: o.createNewChat,
2938
+ onViewHistory: r,
2829
2939
  onClose: n.closePanel
2830
2940
  }
2831
2941
  ),
2832
- /* @__PURE__ */ i(qo, {}),
2833
- /* @__PURE__ */ i(He, { children: /* @__PURE__ */ i(we, {}) })
2942
+ /* @__PURE__ */ i(ei, {})
2834
2943
  ] }),
2835
- /* @__PURE__ */ h(Be, { isActive: e === j.HISTORY, isSliding: !0, children: [
2836
- /* @__PURE__ */ i(Vi, { onReturnFromHistory: a }),
2837
- /* @__PURE__ */ i(yi, { onChatSelect: c, onChatRemove: r.removeChat }),
2838
- /* @__PURE__ */ i(He, { children: /* @__PURE__ */ i(we, {}) })
2944
+ /* @__PURE__ */ h(He, { isActive: e === F.HISTORY, isSliding: !0, children: [
2945
+ /* @__PURE__ */ i(Wi, { onReturnFromHistory: a }),
2946
+ /* @__PURE__ */ i(Ti, { onChatSelect: s, onChatRemove: o.removeChat }),
2947
+ /* @__PURE__ */ i(qi, { children: /* @__PURE__ */ i(ft, { pinToBottom: !0 }) })
2839
2948
  ] })
2840
2949
  ] });
2841
2950
  }
2842
- function Be(e) {
2843
- const { children: t, isActive: n, isSliding: r = !1 } = e, o = /* @__PURE__ */ i(Ni, { inert: !n, children: t });
2844
- return r ? /* @__PURE__ */ i(Fi, { $isExpanded: n, children: o }) : o;
2951
+ function He(e) {
2952
+ const { children: t, isActive: n, isSliding: o = !1 } = e, r = /* @__PURE__ */ i(Gi, { inert: !n, children: t });
2953
+ return o ? /* @__PURE__ */ i(Ki, { $isExpanded: n, children: r }) : r;
2845
2954
  }
2846
- const Hi = s.div`
2955
+ const Yi = c.div`
2847
2956
  position: relative;
2848
2957
  height: 100%;
2849
2958
  overflow: clip;
2850
- `, Ni = s.div`
2959
+ `, Gi = c.div`
2851
2960
  display: flex;
2852
2961
  height: 100%;
2853
2962
  flex-direction: column;
@@ -2855,7 +2964,12 @@ const Hi = s.div`
2855
2964
  border-radius: var(--border-radius-md);
2856
2965
  background: var(--bg-color);
2857
2966
  margin-left: var(--spacing-xxs);
2858
- `, Fi = s.div`
2967
+ `, qi = c.div`
2968
+ display: flex;
2969
+ flex-direction: column;
2970
+ width: 100%;
2971
+ padding: 0 var(--spacing-xs) var(--spacing-xs);
2972
+ `, Ki = c.div`
2859
2973
  position: absolute;
2860
2974
  inset: 0;
2861
2975
  transform: translateX(${(e) => e.$isExpanded ? "0%" : "100%"});
@@ -2865,9 +2979,7 @@ const Hi = s.div`
2865
2979
  @media (prefers-reduced-motion: reduce) {
2866
2980
  transition-duration: 0ms;
2867
2981
  }
2868
- `, He = s.div`
2869
- width: 100%;
2870
2982
  `;
2871
2983
  export {
2872
- Xi as AiPanel
2984
+ aa as AiPanel
2873
2985
  };