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

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