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