@wso2/am-core-ui 0.0.18 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/APIKeysManager-C0phJriD.js +241 -0
  2. package/dist/CatalogKindListing-DtFI2YMG.js +118 -0
  3. package/dist/CodeBlock-mB_Loq7I.js +21736 -0
  4. package/dist/EnvironmentCard-09h1XRxx.js +310 -0
  5. package/dist/EnvironmentSelector-B7Bl93s2.js +48 -0
  6. package/dist/MCPLogo-D9IJzzl7.js +30 -0
  7. package/dist/PolicyListSection-o4k9e8XO.js +2475 -0
  8. package/dist/ResourceListShell-Cx6mdeqv.js +463 -0
  9. package/dist/SwaggerSpecViewer-BvkhoKsi.js +106 -0
  10. package/dist/clipboard-YAzStmkw.js +23 -0
  11. package/dist/debounce-BV83M53b.js +208 -0
  12. package/dist/format-BEZZRyE2.js +29 -0
  13. package/dist/formatDistanceToNow-TErllcH8.js +100 -0
  14. package/dist/gatewayScripts-D8O45W8u.js +72 -0
  15. package/dist/highlight-BsUzxSR3.js +454 -0
  16. package/dist/index-B52h3RHg.js +1290 -0
  17. package/dist/index-BP5drcF2.js +1265 -0
  18. package/dist/index-BZ4vxviI.js +7981 -0
  19. package/dist/index-B_Z0MwXk.js +25012 -0
  20. package/dist/index-BfjzUWDa.js +1397 -0
  21. package/dist/{index-DYV1jEai.js → index-BnV-PkwM.js} +22 -20
  22. package/dist/index-CGDYgUCH.js +711 -0
  23. package/dist/index-COt7nJIf.js +2286 -0
  24. package/dist/index-CWZjOy1h.js +2247 -0
  25. package/dist/index-CezvogTQ.js +116 -0
  26. package/dist/index-CgCWbWzN.js +2342 -0
  27. package/dist/index-CjCkcuuI.js +322 -0
  28. package/dist/index-CjXvuf9m.js +1354 -0
  29. package/dist/index-DD4qF7gq.js +2340 -0
  30. package/dist/index-DeQ-9KTC.js +737 -0
  31. package/dist/index-Df6OBy4E.js +3041 -0
  32. package/dist/index-KRsV2L4V.js +1564 -0
  33. package/dist/index-PUuASE1F.js +2507 -0
  34. package/dist/index-PWsNvJB-.js +546 -0
  35. package/dist/index-UqDmyMSA.js +119 -0
  36. package/dist/index-_0Pj_ZtW.js +459 -0
  37. package/dist/{index-CnXsN5I3.js → index-sr-mWz4T.js} +31 -30
  38. package/dist/index.d.ts +496 -200
  39. package/dist/index.js +462 -439
  40. package/dist/llmProviderPayload-CzihkdNa.js +332 -0
  41. package/dist/schemas-DFScWdSL.js +2969 -0
  42. package/package.json +1 -1
  43. package/dist/index-B47EJCom.js +0 -236
  44. package/dist/index-Bl1Y7Sro.js +0 -3037
  45. package/dist/index-DlS9Lybj.js +0 -80691
@@ -0,0 +1,2342 @@
1
+ import { jsx as t, jsxs as s, Fragment as gt } from "react/jsx-runtime";
2
+ import { c as $e } from "react/compiler-runtime";
3
+ import { useState as se, useEffect as Ae, useMemo as Je, useCallback as Se, createElement as lt, useRef as ot, Fragment as Tn } from "react";
4
+ import { useTheme as sn, alpha as ut, Typography as V, Box as K, Tooltip as pt, Stack as F, Button as ne, Card as Ee, CardContent as Te, CircularProgress as tt, Form as O, ListItem as cn, ListItemButton as dn, ListItemText as mn, List as un, Divider as We, FormControl as Ue, RadioGroup as Ln, FormControlLabel as je, Radio as _t, Collapse as nt, FormLabel as Ge, TextField as Pe, Alert as xt, Autocomplete as st, Chip as Qe, FormHelperText as Gt, Switch as yt, Accordion as Vn, AccordionSummary as Mn, AccordionDetails as On, Checkbox as Kt, Select as jt, MenuItem as Be, IconButton as Dt, Menu as Un, Skeleton as qn } from "@wso2/oxygen-ui";
5
+ import { useParams as $t, useSearchParams as hn, Link as Ye, generatePath as Ze } from "react-router-dom";
6
+ import { an as Yt, ao as Fn, ap as pn, aq as fn, ar as Ht, as as Et, at as gn, au as jn, av as yn, aw as vn, D as it, m as rt, n as at, ax as bn, h as kt, i as At, j as Bn, u as Wn, N as wt, ay as $n, az as Sn, r as Hn, aA as Gn, aB as Cn, z as Rn, aC as Nn, aD as Kn, c as xn, aE as Yn, aF as Zn, d as Xn, T as Qn, aG as Jn, t as zt, g as Xe, x as ei, y as ti, P as ni } from "./index-B_Z0MwXk.js";
7
+ import "@tanstack/react-query";
8
+ import { SlidersVertical as ht, Plus as Pt, GitCommit as kn, Clock as vt, Package as ii, Check as Bt, Tag as wn, Edit as Zt, Rocket as ft, Shield as ri, ChevronDown as ai, Settings as li, ArrowUpFromLine as Pn, ExternalLink as Xt, Globe as oi, Key as Qt, Workflow as Jt, Info as En, MoreHorizontal as si, PauseCircle as ci, PlayCircle as di, FlaskConical as mi, ScrollText as ui, LineChart as hi, SquareStack as pi, Cpu as fi, MemoryStick as gi } from "@wso2/oxygen-ui-icons-react";
9
+ import { o as yi, n as Tt, b as vi, s as Rt } from "./schemas-DFScWdSL.js";
10
+ import { D as ze, a as bi } from "./EnvironmentCard-09h1XRxx.js";
11
+ import { f as Si } from "./formatDistanceToNow-TErllcH8.js";
12
+ function An(n, e) {
13
+ const i = () => Fn(e?.in, NaN), l = xi(n);
14
+ let c;
15
+ if (l.date) {
16
+ const m = ki(l.date, 2);
17
+ c = wi(m.restDateString, m.year);
18
+ }
19
+ if (!c || isNaN(+c)) return i();
20
+ const a = +c;
21
+ let o = 0, y;
22
+ if (l.time && (o = Pi(l.time), isNaN(o)))
23
+ return i();
24
+ if (l.timezone) {
25
+ if (y = Ei(l.timezone), isNaN(y)) return i();
26
+ } else {
27
+ const m = new Date(a + o), g = Yt(0, e?.in);
28
+ return g.setFullYear(
29
+ m.getUTCFullYear(),
30
+ m.getUTCMonth(),
31
+ m.getUTCDate()
32
+ ), g.setHours(
33
+ m.getUTCHours(),
34
+ m.getUTCMinutes(),
35
+ m.getUTCSeconds(),
36
+ m.getUTCMilliseconds()
37
+ ), g;
38
+ }
39
+ return Yt(a + o + y, e?.in);
40
+ }
41
+ const Nt = {
42
+ dateTimeDelimiter: /[T ]/,
43
+ timeZoneDelimiter: /[Z ]/i,
44
+ timezone: /([Z+-].*)$/
45
+ }, Ci = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/, Ri = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/, Ni = /^([+-])(\d{2})(?::?(\d{2}))?$/;
46
+ function xi(n) {
47
+ const e = {}, i = n.split(Nt.dateTimeDelimiter);
48
+ let r;
49
+ if (i.length > 2)
50
+ return e;
51
+ if (/:/.test(i[0]) ? r = i[0] : (e.date = i[0], r = i[1], Nt.timeZoneDelimiter.test(e.date) && (e.date = n.split(Nt.timeZoneDelimiter)[0], r = n.substr(
52
+ e.date.length,
53
+ n.length
54
+ ))), r) {
55
+ const l = Nt.timezone.exec(r);
56
+ l ? (e.time = r.replace(l[1], ""), e.timezone = l[1]) : e.time = r;
57
+ }
58
+ return e;
59
+ }
60
+ function ki(n, e) {
61
+ const i = new RegExp(
62
+ "^(?:(\\d{4}|[+-]\\d{" + (4 + e) + "})|(\\d{2}|[+-]\\d{" + (2 + e) + "})$)"
63
+ ), r = n.match(i);
64
+ if (!r) return { year: NaN, restDateString: "" };
65
+ const l = r[1] ? parseInt(r[1]) : null, c = r[2] ? parseInt(r[2]) : null;
66
+ return {
67
+ year: c === null ? l : c * 100,
68
+ restDateString: n.slice((r[1] || r[2]).length)
69
+ };
70
+ }
71
+ function wi(n, e) {
72
+ if (e === null) return /* @__PURE__ */ new Date(NaN);
73
+ const i = n.match(Ci);
74
+ if (!i) return /* @__PURE__ */ new Date(NaN);
75
+ const r = !!i[4], l = ct(i[1]), c = ct(i[2]) - 1, a = ct(i[3]), o = ct(i[4]), y = ct(i[5]) - 1;
76
+ if (r)
77
+ return zi(e, o, y) ? Ai(e, o, y) : /* @__PURE__ */ new Date(NaN);
78
+ {
79
+ const m = /* @__PURE__ */ new Date(0);
80
+ return !_i(e, c, a) || !Di(e, l) ? /* @__PURE__ */ new Date(NaN) : (m.setUTCFullYear(e, c, Math.max(l, a)), m);
81
+ }
82
+ }
83
+ function ct(n) {
84
+ return n ? parseInt(n) : 1;
85
+ }
86
+ function Pi(n) {
87
+ const e = n.match(Ri);
88
+ if (!e) return NaN;
89
+ const i = Lt(e[1]), r = Lt(e[2]), l = Lt(e[3]);
90
+ return Ti(i, r, l) ? i * pn + r * fn + l * 1e3 : NaN;
91
+ }
92
+ function Lt(n) {
93
+ return n && parseFloat(n.replace(",", ".")) || 0;
94
+ }
95
+ function Ei(n) {
96
+ if (n === "Z") return 0;
97
+ const e = n.match(Ni);
98
+ if (!e) return 0;
99
+ const i = e[1] === "+" ? -1 : 1, r = parseInt(e[2]), l = e[3] && parseInt(e[3]) || 0;
100
+ return Li(r, l) ? i * (r * pn + l * fn) : NaN;
101
+ }
102
+ function Ai(n, e, i) {
103
+ const r = /* @__PURE__ */ new Date(0);
104
+ r.setUTCFullYear(n, 0, 4);
105
+ const l = r.getUTCDay() || 7, c = (e - 1) * 7 + i + 1 - l;
106
+ return r.setUTCDate(r.getUTCDate() + c), r;
107
+ }
108
+ const Ii = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
109
+ function In(n) {
110
+ return n % 400 === 0 || n % 4 === 0 && n % 100 !== 0;
111
+ }
112
+ function _i(n, e, i) {
113
+ return e >= 0 && e <= 11 && i >= 1 && i <= (Ii[e] || (In(n) ? 29 : 28));
114
+ }
115
+ function Di(n, e) {
116
+ return e >= 1 && e <= (In(n) ? 366 : 365);
117
+ }
118
+ function zi(n, e, i) {
119
+ return e >= 1 && e <= 53 && i >= 0 && i <= 6;
120
+ }
121
+ function Ti(n, e, i) {
122
+ return n === 24 ? e === 0 && i === 0 : i >= 0 && i < 60 && e >= 0 && e < 60 && n >= 0 && n < 25;
123
+ }
124
+ function Li(n, e) {
125
+ return e >= 0 && e <= 59;
126
+ }
127
+ function en(n, e) {
128
+ return e === void 0 || e <= 0 ? void 0 : `${Math.round(n / e * 100)}%`;
129
+ }
130
+ function tn(n, e) {
131
+ if (e === void 0 || e <= 0) return;
132
+ const i = n / e * 100;
133
+ return i > 90 ? "error" : i > 70 ? "warning" : "success";
134
+ }
135
+ function Vi(n, e) {
136
+ if (!e || e === "default")
137
+ return {
138
+ bgcolor: n.vars?.palette?.background?.default ?? n.palette?.background?.default,
139
+ color: "text.secondary"
140
+ };
141
+ const r = {
142
+ success: n.palette.success,
143
+ warning: n.palette.warning,
144
+ error: n.palette.error
145
+ }[e];
146
+ return {
147
+ bgcolor: ut(r.main, 0.2)
148
+ };
149
+ }
150
+ function Vt(n) {
151
+ const e = $e(28), {
152
+ icon: i,
153
+ label: r,
154
+ primaryValue: l,
155
+ secondaryValue: c,
156
+ secondaryTooltip: a,
157
+ secondaryVariant: o
158
+ } = n, y = sn();
159
+ let m;
160
+ e[0] !== o || e[1] !== y ? (m = Vi(y, o), e[0] = o, e[1] = y, e[2] = m) : m = e[2];
161
+ const g = m, u = c ?? "—";
162
+ let P;
163
+ e[3] !== u ? (P = /* @__PURE__ */ t(V, { variant: "caption", fontWeight: 600, children: u }), e[3] = u, e[4] = P) : P = e[4];
164
+ let E;
165
+ e[5] !== g || e[6] !== P ? (E = /* @__PURE__ */ t(K, { component: "span", borderRadius: 0.5, px: 0.75, sx: g, children: P }), e[5] = g, e[6] = P, e[7] = E) : E = e[7];
166
+ const R = E, T = y.vars?.palette?.background?.default, v = `1px solid ${y.vars?.palette?.divider}`;
167
+ let p;
168
+ e[8] !== i ? (p = /* @__PURE__ */ t(K, { display: "flex", alignItems: "center", justifyContent: "center", children: i }), e[8] = i, e[9] = p) : p = e[9];
169
+ let L;
170
+ e[10] !== r || e[11] !== p ? (L = /* @__PURE__ */ t(pt, { title: r, children: p }), e[10] = r, e[11] = p, e[12] = L) : L = e[12];
171
+ let _;
172
+ e[13] !== l ? (_ = /* @__PURE__ */ t(V, { variant: "caption", children: l }), e[13] = l, e[14] = _) : _ = e[14];
173
+ let A;
174
+ e[15] !== R || e[16] !== a ? (A = a ? /* @__PURE__ */ t(pt, { title: a, children: R }) : R, e[15] = R, e[16] = a, e[17] = A) : A = e[17];
175
+ let w;
176
+ e[18] !== A || e[19] !== _ ? (w = /* @__PURE__ */ s(F, { direction: "row", gap: 0.75, alignItems: "center", children: [
177
+ _,
178
+ A
179
+ ] }), e[18] = A, e[19] = _, e[20] = w) : w = e[20];
180
+ let f;
181
+ e[21] !== w || e[22] !== L ? (f = /* @__PURE__ */ s(F, { direction: "row", gap: 2, alignItems: "center", justifyContent: "space-between", children: [
182
+ L,
183
+ w
184
+ ] }), e[21] = w, e[22] = L, e[23] = f) : f = e[23];
185
+ let I;
186
+ return e[24] !== f || e[25] !== T || e[26] !== v ? (I = /* @__PURE__ */ t(K, { bgcolor: T, border: v, borderRadius: 0.5, p: 0.5, flexGrow: 1, children: f }), e[24] = f, e[25] = T, e[26] = v, e[27] = I) : I = e[27], I;
187
+ }
188
+ function Wt(n) {
189
+ const e = $e(77), {
190
+ open: i,
191
+ onClose: r,
192
+ imageId: l,
193
+ orgName: c,
194
+ projName: a,
195
+ agentName: o,
196
+ environment: y,
197
+ title: m,
198
+ mode: g
199
+ } = n, {
200
+ pushSnackBar: u
201
+ } = Ht();
202
+ let P;
203
+ e[0] !== o || e[1] !== c || e[2] !== a ? (P = {
204
+ orgName: c,
205
+ projName: a,
206
+ agentName: o
207
+ }, e[0] = o, e[1] = c, e[2] = a, e[3] = P) : P = e[3];
208
+ let E;
209
+ e[4] !== y ? (E = {
210
+ environment: y
211
+ }, e[4] = y, e[5] = E) : E = e[5];
212
+ const {
213
+ data: R
214
+ } = Et(P, E);
215
+ let T;
216
+ e[6] === Symbol.for("react.memo_cache_sentinel") ? (T = [], e[6] = T) : T = e[6];
217
+ const [v, p] = se(T);
218
+ let L;
219
+ e[7] === Symbol.for("react.memo_cache_sentinel") ? (L = [], e[7] = L) : L = e[7];
220
+ const [_, A] = se(L);
221
+ let w;
222
+ e[8] !== R?.configurations || e[9] !== i ? (w = () => {
223
+ if (!i)
224
+ return;
225
+ const $ = R?.configurations;
226
+ p($?.env?.map(ji) ?? []), A($?.files ?? []);
227
+ }, e[8] = R?.configurations, e[9] = i, e[10] = w) : w = e[10];
228
+ let f;
229
+ e[11] !== R || e[12] !== i ? (f = [i, R], e[11] = R, e[12] = i, e[13] = f) : f = e[13], Ae(w, f);
230
+ const {
231
+ mutate: I,
232
+ isPending: G
233
+ } = gn(), {
234
+ mutate: j,
235
+ isPending: W
236
+ } = jn(), S = G || W;
237
+ let M;
238
+ e[14] !== o || e[15] !== I || e[16] !== v || e[17] !== y || e[18] !== _ || e[19] !== l || e[20] !== g || e[21] !== r || e[22] !== c || e[23] !== a || e[24] !== u || e[25] !== j ? (M = () => {
239
+ const $ = v.filter(Fi).map(qi), B = _.filter(Ui), Y = (me) => {
240
+ const Ne = me?.body;
241
+ u({
242
+ message: Ne?.message ?? "Failed to apply configuration",
243
+ type: "error"
244
+ });
245
+ };
246
+ if (g === "update") {
247
+ j({
248
+ params: {
249
+ orgName: c,
250
+ projName: a,
251
+ agentName: o
252
+ },
253
+ body: {
254
+ environmentName: y,
255
+ env: $,
256
+ files: B
257
+ }
258
+ }, {
259
+ onSuccess: () => r(),
260
+ onError: Y
261
+ });
262
+ return;
263
+ }
264
+ if (!l) {
265
+ u({
266
+ message: "imageId is required for the initial deploy",
267
+ type: "error"
268
+ });
269
+ return;
270
+ }
271
+ I({
272
+ params: {
273
+ orgName: c,
274
+ projName: a,
275
+ agentName: o
276
+ },
277
+ body: {
278
+ imageId: l,
279
+ ...$.length && {
280
+ env: $
281
+ },
282
+ ...B.length && {
283
+ files: B
284
+ }
285
+ }
286
+ }, {
287
+ onSuccess: () => r(),
288
+ onError: Y
289
+ });
290
+ }, e[14] = o, e[15] = I, e[16] = v, e[17] = y, e[18] = _, e[19] = l, e[20] = g, e[21] = r, e[22] = c, e[23] = a, e[24] = u, e[25] = j, e[26] = M) : M = e[26];
291
+ const z = M;
292
+ let k;
293
+ e[27] === Symbol.for("react.memo_cache_sentinel") ? (k = () => {
294
+ p(Oi);
295
+ }, e[27] = k) : k = e[27];
296
+ const ie = k;
297
+ let X;
298
+ e[28] === Symbol.for("react.memo_cache_sentinel") ? (X = ($, B, Y) => {
299
+ p((me) => me.map((Ne, we) => we === $ ? {
300
+ ...Ne,
301
+ [B]: Y
302
+ } : Ne));
303
+ }, e[28] = X) : X = e[28];
304
+ const ae = X;
305
+ let ee;
306
+ e[29] === Symbol.for("react.memo_cache_sentinel") ? (ee = ($) => {
307
+ p((B) => B.filter((Y, me) => me !== $));
308
+ }, e[29] = ee) : ee = e[29];
309
+ const Q = ee;
310
+ let d;
311
+ e[30] === Symbol.for("react.memo_cache_sentinel") ? (d = () => {
312
+ A(Mi);
313
+ }, e[30] = d) : d = e[30];
314
+ const C = d;
315
+ let D;
316
+ e[31] === Symbol.for("react.memo_cache_sentinel") ? (D = ($, B, Y) => {
317
+ A((me) => me.map((Ne, we) => we === $ ? {
318
+ ...Ne,
319
+ [B]: Y
320
+ } : Ne));
321
+ }, e[31] = D) : D = e[31];
322
+ const N = D;
323
+ let H;
324
+ e[32] === Symbol.for("react.memo_cache_sentinel") ? (H = ($) => {
325
+ A((B) => B.filter((Y, me) => me !== $));
326
+ }, e[32] = H) : H = e[32];
327
+ const h = H;
328
+ let x;
329
+ e[33] === Symbol.for("react.memo_cache_sentinel") ? (x = /* @__PURE__ */ t(ht, { size: 24 }), e[33] = x) : x = e[33];
330
+ let q;
331
+ e[34] !== r || e[35] !== m ? (q = /* @__PURE__ */ t(it, { icon: x, title: m, onClose: r }), e[34] = r, e[35] = m, e[36] = q) : q = e[36];
332
+ let Z;
333
+ e[37] === Symbol.for("react.memo_cache_sentinel") ? (Z = /* @__PURE__ */ t(V, { variant: "h6", children: "Environment Variables" }), e[37] = Z) : Z = e[37];
334
+ let ue;
335
+ e[38] === Symbol.for("react.memo_cache_sentinel") ? (ue = /* @__PURE__ */ t(Pt, { size: 14 }), e[38] = ue) : ue = e[38];
336
+ let le;
337
+ e[39] !== S ? (le = /* @__PURE__ */ s(F, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [
338
+ Z,
339
+ /* @__PURE__ */ t(ne, { size: "small", variant: "outlined", startIcon: ue, onClick: ie, disabled: S, children: "Add" })
340
+ ] }), e[39] = S, e[40] = le) : le = e[40];
341
+ let ge;
342
+ e[41] !== v ? (ge = v.length === 0 ? /* @__PURE__ */ t(V, { variant: "body2", color: "text.secondary", children: "No environment variables. Click Add to define them." }) : /* @__PURE__ */ t(F, { spacing: 1, children: v.map(($, B) => /* @__PURE__ */ t(yn, { index: B, keyValue: $.key, valueValue: $.value, isSensitive: $.isSensitive ?? !1, isExistingSecret: !!($.secretRef && $.isSensitive), onKeyChange: (Y) => ae(B, "key", Y), onValueChange: (Y) => ae(B, "value", Y), onSensitiveChange: (Y) => ae(B, "isSensitive", Y), onRemove: () => Q(B) }, B)) }), e[41] = v, e[42] = ge) : ge = e[42];
343
+ let he;
344
+ e[43] !== le || e[44] !== ge ? (he = /* @__PURE__ */ t(Ee, { variant: "outlined", children: /* @__PURE__ */ t(Te, { children: /* @__PURE__ */ s(F, { spacing: 1.5, children: [
345
+ le,
346
+ ge
347
+ ] }) }) }), e[43] = le, e[44] = ge, e[45] = he) : he = e[45];
348
+ let ve;
349
+ e[46] === Symbol.for("react.memo_cache_sentinel") ? (ve = /* @__PURE__ */ t(V, { variant: "h6", children: "File Mounts" }), e[46] = ve) : ve = e[46];
350
+ let xe;
351
+ e[47] === Symbol.for("react.memo_cache_sentinel") ? (xe = /* @__PURE__ */ t(Pt, { size: 14 }), e[47] = xe) : xe = e[47];
352
+ let pe;
353
+ e[48] !== S ? (pe = /* @__PURE__ */ s(F, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [
354
+ ve,
355
+ /* @__PURE__ */ t(ne, { size: "small", variant: "outlined", startIcon: xe, onClick: C, disabled: S, children: "Add" })
356
+ ] }), e[48] = S, e[49] = pe) : pe = e[49];
357
+ let Ce;
358
+ e[50] !== _ ? (Ce = _.length === 0 ? /* @__PURE__ */ t(V, { variant: "body2", color: "text.secondary", children: "No file mounts. Click Add to define them." }) : /* @__PURE__ */ t(F, { spacing: 1, children: _.map(($, B) => /* @__PURE__ */ t(vn, { index: B, keyValue: $.key, mountPathValue: $.mountPath, contentValue: $.value, onKeyChange: (Y) => N(B, "key", Y), onMountPathChange: (Y) => N(B, "mountPath", Y), onContentChange: (Y) => N(B, "value", Y), onRemove: () => h(B) }, B)) }), e[50] = _, e[51] = Ce) : Ce = e[51];
359
+ let be;
360
+ e[52] !== pe || e[53] !== Ce ? (be = /* @__PURE__ */ t(Ee, { variant: "outlined", children: /* @__PURE__ */ t(Te, { children: /* @__PURE__ */ s(F, { spacing: 1.5, children: [
361
+ pe,
362
+ Ce
363
+ ] }) }) }), e[52] = pe, e[53] = Ce, e[54] = be) : be = e[54];
364
+ let fe;
365
+ e[55] !== S || e[56] !== r ? (fe = /* @__PURE__ */ t(ne, { variant: "outlined", onClick: r, disabled: S, children: "Cancel" }), e[55] = S, e[56] = r, e[57] = fe) : fe = e[57];
366
+ let ce;
367
+ e[58] !== S ? (ce = S ? /* @__PURE__ */ t(tt, { size: 16 }) : void 0, e[58] = S, e[59] = ce) : ce = e[59];
368
+ const J = S ? "Applying..." : g === "deploy" ? "Apply & Deploy" : "Apply";
369
+ let re;
370
+ e[60] !== z || e[61] !== S || e[62] !== ce || e[63] !== J ? (re = /* @__PURE__ */ t(ne, { variant: "contained", color: "primary", onClick: z, disabled: S, startIcon: ce, children: J }), e[60] = z, e[61] = S, e[62] = ce, e[63] = J, e[64] = re) : re = e[64];
371
+ let de;
372
+ e[65] !== fe || e[66] !== re ? (de = /* @__PURE__ */ s(K, { display: "flex", justifyContent: "flex-end", gap: 1, children: [
373
+ fe,
374
+ re
375
+ ] }), e[65] = fe, e[66] = re, e[67] = de) : de = e[67];
376
+ let ye;
377
+ e[68] !== he || e[69] !== be || e[70] !== de ? (ye = /* @__PURE__ */ t(rt, { children: /* @__PURE__ */ s(F, { spacing: 3, children: [
378
+ he,
379
+ be,
380
+ de
381
+ ] }) }), e[68] = he, e[69] = be, e[70] = de, e[71] = ye) : ye = e[71];
382
+ let Re;
383
+ return e[72] !== r || e[73] !== i || e[74] !== q || e[75] !== ye ? (Re = /* @__PURE__ */ s(at, { open: i, onClose: r, children: [
384
+ q,
385
+ ye
386
+ ] }), e[72] = r, e[73] = i, e[74] = q, e[75] = ye, e[76] = Re) : Re = e[76], Re;
387
+ }
388
+ function Mi(n) {
389
+ return [...n, {
390
+ key: "",
391
+ mountPath: "",
392
+ value: ""
393
+ }];
394
+ }
395
+ function Oi(n) {
396
+ return [...n, {
397
+ key: "",
398
+ value: "",
399
+ isSensitive: !1
400
+ }];
401
+ }
402
+ function Ui(n) {
403
+ return n.key && n.mountPath;
404
+ }
405
+ function qi(n) {
406
+ const {
407
+ key: e,
408
+ value: i,
409
+ isSensitive: r,
410
+ secretRef: l
411
+ } = n;
412
+ return r && l && !i ? {
413
+ key: e,
414
+ isSensitive: r,
415
+ secretRef: l
416
+ } : {
417
+ key: e,
418
+ value: i,
419
+ isSensitive: r
420
+ };
421
+ }
422
+ function Fi(n) {
423
+ return n.key;
424
+ }
425
+ function ji(n) {
426
+ return {
427
+ key: n.key,
428
+ value: n.value ?? "",
429
+ isSensitive: n.isSensitive,
430
+ secretRef: n.secretRef
431
+ };
432
+ }
433
+ const Bi = (n) => {
434
+ const e = An(n);
435
+ return bn(e) ? kt(e, "dd MMM yyyy HH:mm:ss") : "—";
436
+ };
437
+ function Wi(n) {
438
+ const e = $e(37), {
439
+ open: i,
440
+ onClose: r,
441
+ builds: l,
442
+ selectedBuild: c,
443
+ onSelectBuild: a
444
+ } = n, [o, y] = se(c);
445
+ let m, g;
446
+ e[0] !== i || e[1] !== c ? (m = () => {
447
+ i && y(c);
448
+ }, g = [i, c], e[0] = i, e[1] = c, e[2] = m, e[3] = g) : (m = e[2], g = e[3]), Ae(m, g);
449
+ let u;
450
+ e[4] !== a || e[5] !== o ? (u = () => {
451
+ o && a(o);
452
+ }, e[4] = a, e[5] = o, e[6] = u) : u = e[6];
453
+ const P = u;
454
+ let E;
455
+ e[7] === Symbol.for("react.memo_cache_sentinel") ? (E = (k) => {
456
+ y(k);
457
+ }, e[7] = E) : E = e[7];
458
+ const R = E;
459
+ let T;
460
+ e[8] === Symbol.for("react.memo_cache_sentinel") ? (T = /* @__PURE__ */ t(ii, { size: 24 }), e[8] = T) : T = e[8];
461
+ let v;
462
+ e[9] !== r ? (v = /* @__PURE__ */ t(it, { icon: T, title: "Select Build", onClose: r }), e[9] = r, e[10] = v) : v = e[10];
463
+ let p, L;
464
+ e[11] === Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ t(O.Header, { children: "Available Builds" }), L = /* @__PURE__ */ t(V, { variant: "body2", color: "text.secondary", children: "Choose a build to deploy. Only completed builds are available." }), e[11] = p, e[12] = L) : (p = e[11], L = e[12]);
465
+ let _;
466
+ e[13] === Symbol.for("react.memo_cache_sentinel") ? (_ = {
467
+ mt: 1
468
+ }, e[13] = _) : _ = e[13];
469
+ let A;
470
+ e[14] === Symbol.for("react.memo_cache_sentinel") ? (A = {
471
+ gap: 1,
472
+ display: "flex",
473
+ flexDirection: "column"
474
+ }, e[14] = A) : A = e[14];
475
+ let w;
476
+ e[15] !== l || e[16] !== o ? (w = l.length === 0 ? /* @__PURE__ */ t(K, { display: "flex", justifyContent: "center", alignItems: "center", sx: {
477
+ minHeight: Hi
478
+ }, children: /* @__PURE__ */ t(V, { variant: "body2", color: "text.secondary", children: "No builds available" }) }) : l.map((k) => {
479
+ const ie = o === k.buildName;
480
+ return /* @__PURE__ */ t(cn, { sx: $i, disablePadding: !0, children: /* @__PURE__ */ t(dn, { onClick: () => R(k.buildName), selected: ie, children: /* @__PURE__ */ t(mn, { primary: k.buildName, secondary: /* @__PURE__ */ s(K, { display: "flex", gap: 2, children: [
481
+ /* @__PURE__ */ s(K, { display: "flex", alignItems: "center", gap: 0.5, children: [
482
+ /* @__PURE__ */ t(kn, { size: 16 }),
483
+ /* @__PURE__ */ t(V, { variant: "caption", children: k.commitId?.substring(0, 12) || "N/A" })
484
+ ] }),
485
+ /* @__PURE__ */ s(K, { display: "flex", alignItems: "center", gap: 0.5, children: [
486
+ /* @__PURE__ */ t(vt, { size: 12 }),
487
+ /* @__PURE__ */ t(V, { variant: "caption", children: Bi(k.startedAt) })
488
+ ] })
489
+ ] }) }) }) }, k.buildName);
490
+ }), e[15] = l, e[16] = o, e[17] = w) : w = e[17];
491
+ let f;
492
+ e[18] !== w ? (f = /* @__PURE__ */ s(O.Section, { children: [
493
+ p,
494
+ L,
495
+ /* @__PURE__ */ t(O.Stack, { spacing: 1, sx: _, children: /* @__PURE__ */ t(un, { disablePadding: !0, sx: A, children: w }) })
496
+ ] }), e[18] = w, e[19] = f) : f = e[19];
497
+ let I;
498
+ e[20] !== r ? (I = /* @__PURE__ */ t(ne, { variant: "outlined", color: "primary", onClick: r, children: "Cancel" }), e[20] = r, e[21] = I) : I = e[21];
499
+ const G = !o;
500
+ let j;
501
+ e[22] === Symbol.for("react.memo_cache_sentinel") ? (j = /* @__PURE__ */ t(Bt, { size: 16 }), e[22] = j) : j = e[22];
502
+ let W;
503
+ e[23] !== P || e[24] !== G ? (W = /* @__PURE__ */ t(ne, { variant: "contained", color: "primary", onClick: P, disabled: G, startIcon: j, children: "Select" }), e[23] = P, e[24] = G, e[25] = W) : W = e[25];
504
+ let S;
505
+ e[26] !== I || e[27] !== W ? (S = /* @__PURE__ */ s(K, { display: "flex", gap: 1, justifyContent: "flex-end", width: "100%", children: [
506
+ I,
507
+ W
508
+ ] }), e[26] = I, e[27] = W, e[28] = S) : S = e[28];
509
+ let M;
510
+ e[29] !== f || e[30] !== S ? (M = /* @__PURE__ */ t(rt, { children: /* @__PURE__ */ s(O.Stack, { spacing: 3, children: [
511
+ f,
512
+ S
513
+ ] }) }), e[29] = f, e[30] = S, e[31] = M) : M = e[31];
514
+ let z;
515
+ return e[32] !== r || e[33] !== i || e[34] !== M || e[35] !== v ? (z = /* @__PURE__ */ s(at, { open: i, onClose: r, children: [
516
+ v,
517
+ M
518
+ ] }), e[32] = r, e[33] = i, e[34] = M, e[35] = v, e[36] = z) : z = e[36], z;
519
+ }
520
+ function $i(n) {
521
+ return {
522
+ border: `1px solid ${n.palette.divider}`,
523
+ borderRadius: 1
524
+ };
525
+ }
526
+ function Hi(n) {
527
+ return n.spacing(25);
528
+ }
529
+ const Gi = (n) => {
530
+ const e = An(n);
531
+ return bn(e) ? kt(e, "dd MMM yyyy HH:mm:ss") : "—";
532
+ };
533
+ function Ki(n) {
534
+ const e = $e(36), {
535
+ open: i,
536
+ onClose: r,
537
+ versions: l,
538
+ selectedVersion: c,
539
+ onSelectVersion: a
540
+ } = n, [o, y] = se(c);
541
+ let m, g;
542
+ e[0] !== i || e[1] !== c ? (m = () => {
543
+ i && y(c);
544
+ }, g = [i, c], e[0] = i, e[1] = c, e[2] = m, e[3] = g) : (m = e[2], g = e[3]), Ae(m, g);
545
+ let u;
546
+ e[4] !== a || e[5] !== o ? (u = () => {
547
+ o && a(o);
548
+ }, e[4] = a, e[5] = o, e[6] = u) : u = e[6];
549
+ const P = u;
550
+ let E;
551
+ e[7] === Symbol.for("react.memo_cache_sentinel") ? (E = /* @__PURE__ */ t(wn, { size: 24 }), e[7] = E) : E = e[7];
552
+ let R;
553
+ e[8] !== r ? (R = /* @__PURE__ */ t(it, { icon: E, title: "Select Kind Version", onClose: r }), e[8] = r, e[9] = R) : R = e[9];
554
+ let T, v;
555
+ e[10] === Symbol.for("react.memo_cache_sentinel") ? (T = /* @__PURE__ */ t(O.Header, { children: "Available Versions" }), v = /* @__PURE__ */ t(V, { variant: "body2", color: "text.secondary", children: "Choose a kind version to deploy. The latest version is shown first." }), e[10] = T, e[11] = v) : (T = e[10], v = e[11]);
556
+ let p;
557
+ e[12] === Symbol.for("react.memo_cache_sentinel") ? (p = {
558
+ mt: 1
559
+ }, e[12] = p) : p = e[12];
560
+ let L;
561
+ e[13] === Symbol.for("react.memo_cache_sentinel") ? (L = {
562
+ gap: 1,
563
+ display: "flex",
564
+ flexDirection: "column"
565
+ }, e[13] = L) : L = e[13];
566
+ let _;
567
+ e[14] !== o || e[15] !== l ? (_ = l.length === 0 ? /* @__PURE__ */ t(K, { display: "flex", justifyContent: "center", alignItems: "center", sx: {
568
+ minHeight: Zi
569
+ }, children: /* @__PURE__ */ t(V, { variant: "body2", color: "text.secondary", children: "No versions available" }) }) : l.map((M) => {
570
+ const z = o === M.version;
571
+ return /* @__PURE__ */ t(cn, { sx: Yi, disablePadding: !0, children: /* @__PURE__ */ s(dn, { onClick: () => y(M.version), selected: z, children: [
572
+ /* @__PURE__ */ t(mn, { primary: M.version, secondary: /* @__PURE__ */ t(K, { display: "flex", gap: 2, children: /* @__PURE__ */ s(K, { display: "flex", alignItems: "center", gap: 0.5, children: [
573
+ /* @__PURE__ */ t(vt, { size: 12 }),
574
+ /* @__PURE__ */ t(V, { variant: "caption", children: Gi(M.createdAt) })
575
+ ] }) }) }),
576
+ z && /* @__PURE__ */ t(Bt, { size: 16 })
577
+ ] }) }, M.version);
578
+ }), e[14] = o, e[15] = l, e[16] = _) : _ = e[16];
579
+ let A;
580
+ e[17] !== _ ? (A = /* @__PURE__ */ s(O.Section, { children: [
581
+ T,
582
+ v,
583
+ /* @__PURE__ */ t(O.Stack, { spacing: 1, sx: p, children: /* @__PURE__ */ t(un, { disablePadding: !0, sx: L, children: _ }) })
584
+ ] }), e[17] = _, e[18] = A) : A = e[18];
585
+ let w;
586
+ e[19] !== r ? (w = /* @__PURE__ */ t(ne, { variant: "outlined", color: "primary", onClick: r, children: "Cancel" }), e[19] = r, e[20] = w) : w = e[20];
587
+ const f = !o;
588
+ let I;
589
+ e[21] === Symbol.for("react.memo_cache_sentinel") ? (I = /* @__PURE__ */ t(Bt, { size: 16 }), e[21] = I) : I = e[21];
590
+ let G;
591
+ e[22] !== P || e[23] !== f ? (G = /* @__PURE__ */ t(ne, { variant: "contained", color: "primary", onClick: P, disabled: f, startIcon: I, children: "Select" }), e[22] = P, e[23] = f, e[24] = G) : G = e[24];
592
+ let j;
593
+ e[25] !== w || e[26] !== G ? (j = /* @__PURE__ */ s(K, { display: "flex", gap: 1, justifyContent: "flex-end", width: "100%", children: [
594
+ w,
595
+ G
596
+ ] }), e[25] = w, e[26] = G, e[27] = j) : j = e[27];
597
+ let W;
598
+ e[28] !== A || e[29] !== j ? (W = /* @__PURE__ */ t(rt, { children: /* @__PURE__ */ s(O.Stack, { spacing: 3, children: [
599
+ A,
600
+ j
601
+ ] }) }), e[28] = A, e[29] = j, e[30] = W) : W = e[30];
602
+ let S;
603
+ return e[31] !== r || e[32] !== i || e[33] !== W || e[34] !== R ? (S = /* @__PURE__ */ s(at, { open: i, onClose: r, children: [
604
+ R,
605
+ W
606
+ ] }), e[31] = r, e[32] = i, e[33] = W, e[34] = R, e[35] = S) : S = e[35], S;
607
+ }
608
+ function Yi(n) {
609
+ return {
610
+ border: `1px solid ${n.palette.divider}`,
611
+ borderRadius: 1
612
+ };
613
+ }
614
+ function Zi(n) {
615
+ return n.spacing(25);
616
+ }
617
+ function Xi(n) {
618
+ const e = $e(147), {
619
+ initialEnvironment: i
620
+ } = n, {
621
+ orgId: r,
622
+ projectId: l,
623
+ agentId: c
624
+ } = $t(), [a, o] = hn();
625
+ let y;
626
+ e[0] !== c || e[1] !== r || e[2] !== l ? (y = {
627
+ orgName: r,
628
+ projName: l,
629
+ agentName: c
630
+ }, e[0] = c, e[1] = r, e[2] = l, e[3] = y) : y = e[3];
631
+ const {
632
+ data: m,
633
+ isLoading: g
634
+ } = At(y), u = !!m?.kindName;
635
+ let P;
636
+ e[4] !== c || e[5] !== r || e[6] !== l ? (P = {
637
+ orgName: r,
638
+ projName: l,
639
+ agentName: c
640
+ }, e[4] = c, e[5] = r, e[6] = l, e[7] = P) : P = e[7];
641
+ const {
642
+ data: E,
643
+ isLoading: R
644
+ } = Bn(P);
645
+ let T;
646
+ e[8] !== E?.builds ? (T = E?.builds.sort(er).filter(Ji), e[8] = E?.builds, e[9] = T) : T = e[9];
647
+ const v = T;
648
+ let p;
649
+ e[10] !== a ? (p = a.get("selectedBuild"), e[10] = a, e[11] = p) : p = e[11];
650
+ const L = p, _ = a.get("buildSelector") === "open";
651
+ let A, w;
652
+ e[12] !== u || e[13] !== v || e[14] !== a || e[15] !== L || e[16] !== o ? (A = () => {
653
+ if (!u && !L && v && v.length > 0) {
654
+ const J = new URLSearchParams(a);
655
+ J.set("selectedBuild", v[0].buildName), o(J, {
656
+ replace: !0
657
+ });
658
+ }
659
+ }, w = [u, L, v, a, o], e[12] = u, e[13] = v, e[14] = a, e[15] = L, e[16] = o, e[17] = A, e[18] = w) : (A = e[17], w = e[18]), Ae(A, w);
660
+ const f = L || (v && v.length > 0 ? v[0].buildName : ""), I = v?.find((J) => J.buildName === f), G = m?.kindName ?? "";
661
+ let j;
662
+ e[19] !== r || e[20] !== G ? (j = {
663
+ orgName: r,
664
+ kindName: G
665
+ }, e[19] = r, e[20] = G, e[21] = j) : j = e[21];
666
+ const {
667
+ data: W,
668
+ isLoading: S
669
+ } = Wn(j);
670
+ let M;
671
+ e[22] !== W?.versions ? (M = [...W?.versions ?? []].sort(Qi), e[22] = W?.versions, e[23] = M) : M = e[23];
672
+ const z = M;
673
+ let k;
674
+ e[24] !== a ? (k = a.get("selectedVersion"), e[24] = a, e[25] = k) : k = e[25];
675
+ const ie = k, X = a.get("versionSelector") === "open";
676
+ let ae;
677
+ e[26] !== u || e[27] !== a || e[28] !== ie || e[29] !== o || e[30] !== z[0] || e[31] !== z.length ? (ae = () => {
678
+ if (u && !ie && z.length > 0) {
679
+ const J = new URLSearchParams(a);
680
+ J.set("selectedVersion", z[0].version), o(J, {
681
+ replace: !0
682
+ });
683
+ }
684
+ }, e[26] = u, e[27] = a, e[28] = ie, e[29] = o, e[30] = z[0], e[31] = z.length, e[32] = ae) : ae = e[32];
685
+ let ee;
686
+ e[33] !== u || e[34] !== a || e[35] !== ie || e[36] !== o || e[37] !== z ? (ee = [u, ie, z, a, o], e[33] = u, e[34] = a, e[35] = ie, e[36] = o, e[37] = z, e[38] = ee) : ee = e[38], Ae(ae, ee);
687
+ const Q = ie || (z.length > 0 ? z[0].version : "");
688
+ let d, C, D, N, H, h, x;
689
+ if (e[39] !== c || e[40] !== i?.displayName || e[41] !== i?.name || e[42] !== g || e[43] !== R || e[44] !== u || e[45] !== S || e[46] !== X || e[47] !== r || e[48] !== l || e[49] !== a || e[50] !== Q || e[51] !== o || e[52] !== z) {
690
+ x = Symbol.for("react.early_return_sentinel");
691
+ e: {
692
+ let J;
693
+ e[60] !== Q ? (J = (U) => U.version === Q, e[60] = Q, e[61] = J) : J = e[61];
694
+ const re = z.find(J);
695
+ h = a.get("deployPanel") === "open";
696
+ let de;
697
+ e[62] !== a || e[63] !== o ? (de = () => {
698
+ const U = new URLSearchParams(a);
699
+ U.set("deployPanel", "open"), o(U);
700
+ }, e[62] = a, e[63] = o, e[64] = de) : de = e[64], H = de;
701
+ let ye;
702
+ e[65] !== a || e[66] !== o ? (ye = () => {
703
+ const U = new URLSearchParams(a);
704
+ U.delete("deployPanel"), o(U);
705
+ }, e[65] = a, e[66] = o, e[67] = ye) : ye = e[67], D = ye;
706
+ let Re;
707
+ e[68] !== a || e[69] !== o ? (Re = (U) => {
708
+ const oe = new URLSearchParams(a);
709
+ oe.set("selectedBuild", U), oe.delete("buildSelector"), o(oe);
710
+ }, e[68] = a, e[69] = o, e[70] = Re) : Re = e[70], d = Re;
711
+ let $;
712
+ e[71] !== a || e[72] !== o ? ($ = () => {
713
+ const U = new URLSearchParams(a);
714
+ U.set("buildSelector", "open"), o(U);
715
+ }, e[71] = a, e[72] = o, e[73] = $) : $ = e[73], N = $;
716
+ let B;
717
+ e[74] !== a || e[75] !== o ? (B = () => {
718
+ const U = new URLSearchParams(a);
719
+ U.delete("buildSelector"), o(U);
720
+ }, e[74] = a, e[75] = o, e[76] = B) : B = e[76], C = B;
721
+ let Y;
722
+ e[77] !== a || e[78] !== o ? (Y = (U) => {
723
+ const oe = new URLSearchParams(a);
724
+ oe.set("selectedVersion", U), oe.delete("versionSelector"), o(oe);
725
+ }, e[77] = a, e[78] = o, e[79] = Y) : Y = e[79];
726
+ const me = Y;
727
+ let Ne;
728
+ e[80] !== a || e[81] !== o ? (Ne = () => {
729
+ const U = new URLSearchParams(a);
730
+ U.set("versionSelector", "open"), o(U);
731
+ }, e[80] = a, e[81] = o, e[82] = Ne) : Ne = e[82];
732
+ const we = Ne;
733
+ let b;
734
+ e[83] !== a || e[84] !== o ? (b = () => {
735
+ const U = new URLSearchParams(a);
736
+ U.delete("versionSelector"), o(U);
737
+ }, e[83] = a, e[84] = o, e[85] = b) : b = e[85];
738
+ const ke = b;
739
+ if (g || !u && R || u && S) {
740
+ let U;
741
+ e[86] === Symbol.for("react.memo_cache_sentinel") ? (U = {
742
+ height: "fit-content",
743
+ width: 350,
744
+ minWidth: 350
745
+ }, e[86] = U) : U = e[86];
746
+ let oe;
747
+ e[87] === Symbol.for("react.memo_cache_sentinel") ? (oe = /* @__PURE__ */ t(Ee, { variant: "outlined", sx: U, children: /* @__PURE__ */ t(Te, { children: /* @__PURE__ */ t(K, { p: 8, display: "flex", justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ t(tt, {}) }) }) }), e[87] = oe) : oe = e[87], x = oe;
748
+ break e;
749
+ }
750
+ if (u) {
751
+ if (z.length === 0) {
752
+ let St;
753
+ e[88] === Symbol.for("react.memo_cache_sentinel") ? (St = {
754
+ height: "fit-content",
755
+ width: 350,
756
+ minWidth: 350
757
+ }, e[88] = St) : St = e[88];
758
+ let Ct;
759
+ e[89] === Symbol.for("react.memo_cache_sentinel") ? (Ct = /* @__PURE__ */ t(Ee, { variant: "outlined", sx: St, children: /* @__PURE__ */ t(Te, { children: /* @__PURE__ */ t(F, { gap: 2, alignItems: "center", children: /* @__PURE__ */ t(wt, { message: "No versions available", subtitle: "Publish a version for this Agent Kind first.", icon: /* @__PURE__ */ t(wn, { size: 32 }), disableBackground: !0 }) }) }) }), e[89] = Ct) : Ct = e[89], x = Ct;
760
+ break e;
761
+ }
762
+ let U;
763
+ e[90] === Symbol.for("react.memo_cache_sentinel") ? (U = {
764
+ height: "fit-content",
765
+ width: 350,
766
+ minWidth: 350
767
+ }, e[90] = U) : U = e[90];
768
+ let oe, Ie, _e;
769
+ e[91] === Symbol.for("react.memo_cache_sentinel") ? (oe = /* @__PURE__ */ t(V, { variant: "h5", children: "Setup" }), Ie = /* @__PURE__ */ t(We, {}), _e = /* @__PURE__ */ t(V, { variant: "body2", color: "text.secondary", children: "Select Kind Version" }), e[91] = oe, e[92] = Ie, e[93] = _e) : (oe = e[91], Ie = e[92], _e = e[93]);
770
+ let De;
771
+ e[94] === Symbol.for("react.memo_cache_sentinel") ? (De = {
772
+ borderRadius: 0.5,
773
+ justifyContent: "space-between",
774
+ textTransform: "none"
775
+ }, e[94] = De) : De = e[94];
776
+ const Le = /* @__PURE__ */ s(F, { gap: 0.5, alignItems: "flex-start", children: [
777
+ /* @__PURE__ */ t(V, { variant: "body1", children: re?.version || "Select a version" }),
778
+ re && /* @__PURE__ */ t(K, { display: "flex", gap: 1, sx: {
779
+ opacity: 0.7
780
+ }, children: /* @__PURE__ */ s(K, { display: "flex", alignItems: "center", gap: 0.5, children: [
781
+ /* @__PURE__ */ t(vt, { size: 12 }),
782
+ /* @__PURE__ */ t(V, { variant: "caption", children: kt(new Date(re.createdAt), "dd MMM yyyy") })
783
+ ] }) })
784
+ ] });
785
+ let Oe;
786
+ e[95] === Symbol.for("react.memo_cache_sentinel") ? (Oe = /* @__PURE__ */ t(Zt, { size: 16 }), e[95] = Oe) : Oe = e[95];
787
+ let te;
788
+ e[96] !== we || e[97] !== Le ? (te = /* @__PURE__ */ s(ne, { variant: "outlined", fullWidth: !0, onClick: we, sx: De, children: [
789
+ Le,
790
+ Oe
791
+ ] }), e[96] = we, e[97] = Le, e[98] = te) : te = e[98];
792
+ let Ve;
793
+ e[99] === Symbol.for("react.memo_cache_sentinel") ? (Ve = /* @__PURE__ */ t(We, {}), e[99] = Ve) : Ve = e[99];
794
+ const Ke = !re;
795
+ let qe;
796
+ e[100] === Symbol.for("react.memo_cache_sentinel") ? (qe = /* @__PURE__ */ t(ft, { size: 16 }), e[100] = qe) : qe = e[100];
797
+ let Fe;
798
+ e[101] !== H || e[102] !== Ke ? (Fe = /* @__PURE__ */ t(ne, { variant: "contained", color: "primary", fullWidth: !0, onClick: H, disabled: Ke, startIcon: qe, children: "Configure & Deploy" }), e[101] = H, e[102] = Ke, e[103] = Fe) : Fe = e[103];
799
+ let He;
800
+ e[104] !== te || e[105] !== Fe ? (He = /* @__PURE__ */ t(Ee, { variant: "outlined", sx: U, children: /* @__PURE__ */ t(Te, { children: /* @__PURE__ */ s(F, { direction: "column", gap: 2, children: [
801
+ oe,
802
+ Ie,
803
+ _e,
804
+ te,
805
+ Ve,
806
+ Fe
807
+ ] }) }) }), e[104] = te, e[105] = Fe, e[106] = He) : He = e[106];
808
+ let et;
809
+ e[107] !== ke || e[108] !== me || e[109] !== X || e[110] !== Q || e[111] !== z ? (et = /* @__PURE__ */ t(Ki, { open: X, onClose: ke, versions: z, selectedVersion: Q, onSelectVersion: me }), e[107] = ke, e[108] = me, e[109] = X, e[110] = Q, e[111] = z, e[112] = et) : et = e[112];
810
+ const It = re && /* @__PURE__ */ t(Wt, { open: h, onClose: D, mode: "deploy", imageId: re.imageId, orgName: r || "", projName: l || "", agentName: c || "", environment: i?.name || "development", title: `Configure and Deploy to ${i?.displayName ?? i?.name ?? "Environment"} Environment` });
811
+ let bt;
812
+ e[113] !== He || e[114] !== et || e[115] !== It ? (bt = /* @__PURE__ */ s(gt, { children: [
813
+ He,
814
+ et,
815
+ It
816
+ ] }), e[113] = He, e[114] = et, e[115] = It, e[116] = bt) : bt = e[116], x = bt;
817
+ break e;
818
+ }
819
+ }
820
+ e[39] = c, e[40] = i?.displayName, e[41] = i?.name, e[42] = g, e[43] = R, e[44] = u, e[45] = S, e[46] = X, e[47] = r, e[48] = l, e[49] = a, e[50] = Q, e[51] = o, e[52] = z, e[53] = d, e[54] = C, e[55] = D, e[56] = N, e[57] = H, e[58] = h, e[59] = x;
821
+ } else
822
+ d = e[53], C = e[54], D = e[55], N = e[56], H = e[57], h = e[58], x = e[59];
823
+ if (x !== Symbol.for("react.early_return_sentinel"))
824
+ return x;
825
+ if (!v || v.length === 0) {
826
+ let J;
827
+ e[117] === Symbol.for("react.memo_cache_sentinel") ? (J = {
828
+ height: "fit-content",
829
+ width: 350,
830
+ minWidth: 350
831
+ }, e[117] = J) : J = e[117];
832
+ let re;
833
+ return e[118] === Symbol.for("react.memo_cache_sentinel") ? (re = /* @__PURE__ */ t(Ee, { variant: "outlined", sx: J, children: /* @__PURE__ */ t(Te, { children: /* @__PURE__ */ t(F, { gap: 2, alignItems: "center", children: /* @__PURE__ */ t(wt, { message: "No builds available", subtitle: "build your agent first to deploy it to an environment.", icon: /* @__PURE__ */ t(ft, { size: 32 }), disableBackground: !0 }) }) }) }), e[118] = re) : re = e[118], re;
834
+ }
835
+ let q;
836
+ e[119] === Symbol.for("react.memo_cache_sentinel") ? (q = {
837
+ height: "fit-content",
838
+ width: 350,
839
+ minWidth: 350
840
+ }, e[119] = q) : q = e[119];
841
+ let Z, ue, le;
842
+ e[120] === Symbol.for("react.memo_cache_sentinel") ? (Z = /* @__PURE__ */ t(V, { variant: "h5", children: "Setup" }), ue = /* @__PURE__ */ t(We, {}), le = /* @__PURE__ */ t(V, { variant: "body2", color: "text.secondary", children: "Select Build" }), e[120] = Z, e[121] = ue, e[122] = le) : (Z = e[120], ue = e[121], le = e[122]);
843
+ let ge;
844
+ e[123] === Symbol.for("react.memo_cache_sentinel") ? (ge = {
845
+ borderRadius: 0.5,
846
+ justifyContent: "space-between",
847
+ textTransform: "none"
848
+ }, e[123] = ge) : ge = e[123];
849
+ let he;
850
+ e[124] === Symbol.for("react.memo_cache_sentinel") ? (he = /* @__PURE__ */ t(Zt, { size: 16 }), e[124] = he) : he = e[124];
851
+ let ve;
852
+ e[125] === Symbol.for("react.memo_cache_sentinel") ? (ve = /* @__PURE__ */ t(We, {}), e[125] = ve) : ve = e[125];
853
+ const xe = !I || I.status !== "Completed" && I.status !== "Succeeded";
854
+ let pe;
855
+ e[126] === Symbol.for("react.memo_cache_sentinel") ? (pe = /* @__PURE__ */ t(ft, { size: 16 }), e[126] = pe) : pe = e[126];
856
+ let Ce;
857
+ e[127] !== H || e[128] !== xe ? (Ce = /* @__PURE__ */ t(ne, { variant: "contained", color: "primary", fullWidth: !0, onClick: H, disabled: xe, startIcon: pe, children: "Configure & Deploy" }), e[127] = H, e[128] = xe, e[129] = Ce) : Ce = e[129];
858
+ let be;
859
+ e[130] !== v ? (be = v || [], e[130] = v, e[131] = be) : be = e[131];
860
+ let fe;
861
+ e[132] !== d || e[133] !== C || e[134] !== _ || e[135] !== f || e[136] !== be ? (fe = /* @__PURE__ */ t(Wi, { open: _, onClose: C, builds: be, selectedBuild: f, onSelectBuild: d }), e[132] = d, e[133] = C, e[134] = _, e[135] = f, e[136] = be, e[137] = fe) : fe = e[137];
862
+ let ce;
863
+ return e[138] !== c || e[139] !== I || e[140] !== D || e[141] !== i?.displayName || e[142] !== i?.name || e[143] !== h || e[144] !== r || e[145] !== l ? (ce = I?.imageId && /* @__PURE__ */ t(Wt, { open: h, onClose: D, mode: "deploy", imageId: I.imageId, orgName: r || "", projName: l || "", agentName: c || "", environment: i?.name || "development", title: `Configure and Deploy to ${i?.displayName ?? i?.name ?? "Environment"} Environment` }), e[138] = c, e[139] = I, e[140] = D, e[141] = i?.displayName, e[142] = i?.name, e[143] = h, e[144] = r, e[145] = l, e[146] = ce) : ce = e[146], /* @__PURE__ */ s(gt, { children: [
864
+ /* @__PURE__ */ t(Ee, { variant: "outlined", sx: q, children: /* @__PURE__ */ t(Te, { children: /* @__PURE__ */ s(F, { direction: "column", gap: 2, children: [
865
+ Z,
866
+ ue,
867
+ le,
868
+ /* @__PURE__ */ s(ne, { variant: "outlined", fullWidth: !0, onClick: N, sx: ge, children: [
869
+ /* @__PURE__ */ s(F, { gap: 0.5, alignItems: "flex-start", children: [
870
+ /* @__PURE__ */ t(V, { variant: "body1", children: I?.buildName || "Select a build" }),
871
+ I && /* @__PURE__ */ s(K, { display: "flex", gap: 1, sx: {
872
+ opacity: 0.7
873
+ }, children: [
874
+ /* @__PURE__ */ s(K, { display: "flex", alignItems: "center", gap: 0.5, children: [
875
+ /* @__PURE__ */ t(kn, { size: 16 }),
876
+ /* @__PURE__ */ t(V, { variant: "caption", children: I.buildParameters?.commitId?.substring(0, 8) || "N/A" })
877
+ ] }),
878
+ /* @__PURE__ */ s(K, { display: "flex", alignItems: "center", gap: 0.5, children: [
879
+ /* @__PURE__ */ t(vt, { size: 12 }),
880
+ /* @__PURE__ */ t(V, { variant: "caption", children: kt(new Date(I.startedAt), "dd MMM yyyy") })
881
+ ] })
882
+ ] })
883
+ ] }),
884
+ he
885
+ ] }),
886
+ ve,
887
+ Ce
888
+ ] }) }) }),
889
+ fe,
890
+ ce
891
+ ] });
892
+ }
893
+ function Qi(n, e) {
894
+ return new Date(e.createdAt).getTime() - new Date(n.createdAt).getTime();
895
+ }
896
+ function Ji(n) {
897
+ return n.status === "Completed" || n.status === "Succeeded";
898
+ }
899
+ function er(n, e) {
900
+ return new Date(e.startedAt).getTime() - new Date(n.startedAt).getTime();
901
+ }
902
+ function tr({
903
+ open: n,
904
+ onClose: e,
905
+ orgName: i,
906
+ projName: r,
907
+ agentName: l,
908
+ environment: c
909
+ }) {
910
+ const {
911
+ pushSnackBar: a
912
+ } = Ht(), {
913
+ data: o
914
+ } = At({
915
+ orgName: i,
916
+ projName: r,
917
+ agentName: l
918
+ });
919
+ Et({
920
+ orgName: i,
921
+ projName: r,
922
+ agentName: l
923
+ }, {
924
+ environment: c
925
+ });
926
+ const y = o?.agentType?.type === "agent-api", {
927
+ data: m
928
+ } = $n({
929
+ orgName: i,
930
+ environmentId: n && y ? c : void 0
931
+ }), g = Je(() => (m?.list ?? []).map((h) => h.name), [m]), u = g.length > 0, [P, E] = se("apikey"), [R, T] = se([]), [v, p] = se([]), [L, _] = se("Authorization"), [A, w] = se("Bearer"), [f, I] = se(!0), [G, j] = se(!1), [W, S] = se(!0), [M, z] = se(["*"]), [k, ie] = se(["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"]), [X, ae] = se(["authorization", "Content-Type", "Origin", "X-API-Key"]), [ee, Q] = se(!1);
932
+ Ae(() => {
933
+ if (!n) return;
934
+ const h = o?.configurations?.corsConfig;
935
+ if (!h) {
936
+ j(!1), S(!0), z(["*"]), ie(["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"]), ae(["authorization", "Content-Type", "Origin", "X-API-Key"]), Q(!1);
937
+ return;
938
+ }
939
+ if (h.enabled !== void 0 && j(h.enabled), h.allowOrigin !== void 0) {
940
+ const x = h.allowOrigin.length === 1 && h.allowOrigin[0] === "*";
941
+ S(x), z(h.allowOrigin);
942
+ }
943
+ h.allowMethods !== void 0 && ie(h.allowMethods), h.allowHeaders !== void 0 && ae(h.allowHeaders), h.allowCredentials !== void 0 && Q(h.allowCredentials);
944
+ }, [n, o?.configurations?.corsConfig]), Ae(() => {
945
+ if (!n) return;
946
+ const h = o?.configurations;
947
+ h?.enableOAuthSecurity ? E("oauth") : h?.enableApiKeySecurity ? E("apikey") : h?.enableApiKeySecurity === !1 ? E("none") : E("apikey");
948
+ const x = h?.oauthConfig;
949
+ T(x?.issuers ?? []), p(x?.audiences ?? []), _(x?.headerName || "Authorization"), w(x?.authHeaderPrefix || "Bearer"), I(x?.forwardToken ?? !0);
950
+ }, [n, o?.configurations?.enableApiKeySecurity, o?.configurations?.enableOAuthSecurity, o?.configurations?.oauthConfig]);
951
+ const d = W || M.includes("*"), C = y && P === "oauth" && R.length === 0, {
952
+ mutate: D,
953
+ isPending: N
954
+ } = Sn(), H = Se(() => {
955
+ D({
956
+ params: {
957
+ orgName: i,
958
+ projName: r,
959
+ agentName: l
960
+ },
961
+ body: {
962
+ environmentName: c,
963
+ ...y && {
964
+ enableApiKeySecurity: P === "apikey",
965
+ enableOAuthSecurity: P === "oauth"
966
+ },
967
+ ...y && P === "oauth" && {
968
+ oauthConfig: {
969
+ issuers: R,
970
+ audiences: v,
971
+ headerName: L.trim() || "Authorization",
972
+ authHeaderPrefix: A.trim() || "Bearer",
973
+ forwardToken: f
974
+ }
975
+ },
976
+ ...o?.configurations?.enableAutoInstrumentation !== void 0 && {
977
+ enableAutoInstrumentation: o.configurations.enableAutoInstrumentation
978
+ },
979
+ ...y && {
980
+ corsConfig: {
981
+ enabled: G,
982
+ allowOrigin: d ? ["*"] : M,
983
+ allowMethods: k,
984
+ allowHeaders: X,
985
+ allowCredentials: d ? !1 : ee
986
+ }
987
+ }
988
+ }
989
+ }, {
990
+ onSuccess: () => e(),
991
+ onError: (h) => {
992
+ const x = h?.body;
993
+ a({
994
+ message: x?.message ?? "Failed to apply security configuration",
995
+ type: "error"
996
+ });
997
+ }
998
+ });
999
+ }, [c, i, r, l, o?.configurations?.enableAutoInstrumentation, P, R, v, L, A, f, G, M, k, X, ee, d, y, D, e, a]);
1000
+ return /* @__PURE__ */ s(at, { open: n, onClose: e, children: [
1001
+ /* @__PURE__ */ t(it, { icon: /* @__PURE__ */ t(ri, { size: 24 }), title: "Update Configurations", onClose: e }),
1002
+ /* @__PURE__ */ t(rt, { children: /* @__PURE__ */ s(O.Stack, { spacing: 3, children: [
1003
+ y && /* @__PURE__ */ s(O.Section, { children: [
1004
+ /* @__PURE__ */ t(O.Header, { children: "Endpoint Authentication" }),
1005
+ /* @__PURE__ */ t(O.Subheader, { children: "Choose how callers authenticate against this agent endpoint." }),
1006
+ /* @__PURE__ */ s(O.Stack, { spacing: 1, children: [
1007
+ /* @__PURE__ */ t(Ue, { children: /* @__PURE__ */ s(Ln, { value: P, onChange: (h, x) => {
1008
+ const q = x;
1009
+ E(q), q === "oauth" && R.length === 0 && u && T(g);
1010
+ }, children: [
1011
+ /* @__PURE__ */ t(je, { value: "none", control: /* @__PURE__ */ t(_t, { disabled: N }), label: "No authentication" }),
1012
+ /* @__PURE__ */ t(je, { value: "apikey", control: /* @__PURE__ */ t(_t, { disabled: N }), label: "API key" }),
1013
+ /* @__PURE__ */ t(je, { value: "oauth", control: /* @__PURE__ */ t(_t, { disabled: N || !u }), label: u ? "OAuth" : "OAuth — configure an identity provider first" })
1014
+ ] }) }),
1015
+ /* @__PURE__ */ t(nt, { in: P === "apikey", children: /* @__PURE__ */ s(Ue, { fullWidth: !0, sx: {
1016
+ mt: 1
1017
+ }, children: [
1018
+ /* @__PURE__ */ t(Ge, { children: "Header" }),
1019
+ /* @__PURE__ */ t(Pe, { value: "X-API-Key", size: "small", fullWidth: !0, disabled: !0 })
1020
+ ] }) }),
1021
+ /* @__PURE__ */ t(nt, { in: P === "oauth", children: /* @__PURE__ */ s(O.Stack, { spacing: 2, sx: {
1022
+ mt: 1
1023
+ }, children: [
1024
+ !u && /* @__PURE__ */ t(xt, { severity: "warning", children: /* @__PURE__ */ t(V, { variant: "caption", children: "No identity providers for this environment. Add one under Security → Identity Providers first." }) }),
1025
+ /* @__PURE__ */ s(Ue, { fullWidth: !0, error: C, children: [
1026
+ /* @__PURE__ */ t(Ge, { required: !0, children: "Identity Providers" }),
1027
+ /* @__PURE__ */ t(st, { multiple: !0, options: g, value: R, onChange: (h, x) => T(x), disabled: N || !u, renderTags: (h, x) => h.map((q, Z) => /* @__PURE__ */ lt(Qe, { label: q, size: "small", ...x({
1028
+ index: Z
1029
+ }), key: q })), renderInput: (h) => /* @__PURE__ */ t(Pe, { ...h, size: "small", error: C, placeholder: R.length === 0 ? "Select identity providers" : "" }) }),
1030
+ C && /* @__PURE__ */ t(Gt, { children: "Select at least one identity provider." })
1031
+ ] }),
1032
+ /* @__PURE__ */ s(Ue, { fullWidth: !0, children: [
1033
+ /* @__PURE__ */ t(Ge, { children: "Audiences" }),
1034
+ /* @__PURE__ */ t(st, { multiple: !0, freeSolo: !0, options: [], value: v, onChange: (h, x) => p(x), disabled: N, renderTags: (h, x) => h.map((q, Z) => /* @__PURE__ */ lt(Qe, { label: q, size: "small", ...x({
1035
+ index: Z
1036
+ }), key: q })), renderInput: (h) => /* @__PURE__ */ t(Pe, { ...h, size: "small", placeholder: v.length === 0 ? "Add accepted audience (aud) values" : "" }) }),
1037
+ /* @__PURE__ */ t(Gt, { children: "Accepted token audiences (aud claim). Leave empty to disable audience validation." })
1038
+ ] }),
1039
+ /* @__PURE__ */ s(K, { display: "flex", gap: 2, children: [
1040
+ /* @__PURE__ */ s(Ue, { fullWidth: !0, children: [
1041
+ /* @__PURE__ */ t(Ge, { children: "Header name" }),
1042
+ /* @__PURE__ */ t(Pe, { size: "small", fullWidth: !0, value: L, disabled: N, onChange: (h) => _(h.target.value), placeholder: "Authorization" })
1043
+ ] }),
1044
+ /* @__PURE__ */ s(Ue, { fullWidth: !0, children: [
1045
+ /* @__PURE__ */ t(Ge, { children: "Auth header prefix" }),
1046
+ /* @__PURE__ */ t(Pe, { size: "small", fullWidth: !0, value: A, disabled: N, onChange: (h) => w(h.target.value), placeholder: "Bearer" })
1047
+ ] })
1048
+ ] }),
1049
+ /* @__PURE__ */ t(je, { control: /* @__PURE__ */ t(yt, { checked: f, onChange: (h, x) => I(x), disabled: N }), label: "Forward token to upstream" }),
1050
+ /* @__PURE__ */ t(V, { variant: "caption", color: "text.secondary", sx: {
1051
+ mt: -1
1052
+ }, children: "Forward the token header to the upstream service after validation. Disable to strip it before proxying." })
1053
+ ] }) })
1054
+ ] })
1055
+ ] }),
1056
+ y && /* @__PURE__ */ s(O.Section, { children: [
1057
+ /* @__PURE__ */ t(O.Header, { children: "CORS Configuration" }),
1058
+ /* @__PURE__ */ t(O.Subheader, { children: "Control which origins, methods, and headers may access this endpoint." }),
1059
+ /* @__PURE__ */ s(O.Stack, { spacing: 1, children: [
1060
+ /* @__PURE__ */ t(je, { control: /* @__PURE__ */ t(yt, { checked: G, onChange: (h, x) => j(x), disabled: N }), label: "Enable CORS" }),
1061
+ /* @__PURE__ */ t(nt, { in: G, children: /* @__PURE__ */ s(Vn, { disableGutters: !0, elevation: 0, sx: {
1062
+ mt: 1,
1063
+ border: "1px solid",
1064
+ borderColor: "divider",
1065
+ borderRadius: 1,
1066
+ "&:before": {
1067
+ display: "none"
1068
+ }
1069
+ }, children: [
1070
+ /* @__PURE__ */ t(Mn, { expandIcon: /* @__PURE__ */ t(ai, { size: 16 }), children: /* @__PURE__ */ t(V, { variant: "body2", children: "Advanced" }) }),
1071
+ /* @__PURE__ */ t(On, { children: /* @__PURE__ */ s(O.Stack, { spacing: 2, children: [
1072
+ /* @__PURE__ */ s(K, { display: "flex", gap: 2, alignItems: "center", children: [
1073
+ /* @__PURE__ */ t(je, { control: /* @__PURE__ */ t(Kt, { checked: W, onChange: (h, x) => {
1074
+ S(x), x ? (Q(!1), z(["*"])) : z((q) => q.filter((Z) => Z !== "*"));
1075
+ }, disabled: N }), label: "Allow all origins" }),
1076
+ /* @__PURE__ */ t(je, { control: /* @__PURE__ */ t(Kt, { checked: ee, onChange: (h, x) => Q(x), disabled: N || d }), label: "Allow credentials" })
1077
+ ] }),
1078
+ !W && /* @__PURE__ */ s(Ue, { fullWidth: !0, children: [
1079
+ /* @__PURE__ */ t(Ge, { children: "Allowed origins" }),
1080
+ /* @__PURE__ */ t(st, { multiple: !0, freeSolo: !0, options: [], value: M, onChange: (h, x) => z(x), renderTags: (h, x) => h.map((q, Z) => /* @__PURE__ */ lt(Qe, { label: q, size: "small", ...x({
1081
+ index: Z
1082
+ }), key: q })), renderInput: (h) => /* @__PURE__ */ t(Pe, { ...h, size: "small", placeholder: "Add origin and press Enter" }) })
1083
+ ] }),
1084
+ /* @__PURE__ */ s(Ue, { fullWidth: !0, children: [
1085
+ /* @__PURE__ */ t(Ge, { children: "Allowed methods" }),
1086
+ /* @__PURE__ */ t(st, { multiple: !0, freeSolo: !0, options: [], value: k, onChange: (h, x) => ie(x), renderTags: (h, x) => h.map((q, Z) => /* @__PURE__ */ lt(Qe, { label: q, size: "small", ...x({
1087
+ index: Z
1088
+ }), key: q })), renderInput: (h) => /* @__PURE__ */ t(Pe, { ...h, size: "small", placeholder: "Add method and press Enter" }) })
1089
+ ] }),
1090
+ /* @__PURE__ */ s(Ue, { fullWidth: !0, children: [
1091
+ /* @__PURE__ */ t(Ge, { children: "Allowed headers" }),
1092
+ /* @__PURE__ */ t(st, { multiple: !0, freeSolo: !0, options: [], value: X, onChange: (h, x) => ae(x), renderTags: (h, x) => h.map((q, Z) => /* @__PURE__ */ lt(Qe, { label: q, size: "small", ...x({
1093
+ index: Z
1094
+ }), key: q })), renderInput: (h) => /* @__PURE__ */ t(Pe, { ...h, size: "small", placeholder: "Add header and press Enter" }) })
1095
+ ] })
1096
+ ] }) })
1097
+ ] }) })
1098
+ ] })
1099
+ ] }),
1100
+ /* @__PURE__ */ s(K, { display: "flex", justifyContent: "flex-end", gap: 1, mt: 2, children: [
1101
+ /* @__PURE__ */ t(ne, { variant: "outlined", onClick: e, disabled: N, children: "Cancel" }),
1102
+ /* @__PURE__ */ t(ne, { variant: "contained", color: "primary", onClick: H, disabled: N || C, startIcon: N ? /* @__PURE__ */ t(tt, { size: 16 }) : void 0, children: N ? "Applying..." : "Apply" })
1103
+ ] })
1104
+ ] }) })
1105
+ ] });
1106
+ }
1107
+ function nr(n) {
1108
+ if (!n)
1109
+ return "";
1110
+ const e = n.trim();
1111
+ if (!e)
1112
+ return "";
1113
+ const r = (e.split("/").pop() ?? "").split(":")[0] ?? "";
1114
+ if (!r)
1115
+ return "";
1116
+ const l = "-image";
1117
+ return r.endsWith(l) ? r.slice(0, -l.length) : r;
1118
+ }
1119
+ function _n(n) {
1120
+ const e = n?.trim();
1121
+ if (!e) return;
1122
+ const i = e.split(".");
1123
+ if (i.length < 2) return;
1124
+ const [r, l] = i;
1125
+ if (!(!r || !l))
1126
+ return `${r}.${l}`;
1127
+ }
1128
+ function Dn(n, e) {
1129
+ return !n || !e ? [] : n.instrumentation.versions.filter((i) => i.pythonVersions.includes(e));
1130
+ }
1131
+ function zn(n, e, i) {
1132
+ const r = (l) => !!l && n.some((c) => c.version === l);
1133
+ return r(e) ? e : r(i) ? i : n[0]?.version ?? "";
1134
+ }
1135
+ const nn = /^[0-9]+(\.[0-9]+)?m?$/i, rn = /^[0-9]+(\.[0-9]+)?(Ki|Mi|Gi|Ti|Pi|Ei)$/i;
1136
+ function dt(n) {
1137
+ if (!n?.trim()) return NaN;
1138
+ const e = n.trim(), i = e.match(/^([0-9]+(?:\.[0-9]+)?)m?$/i);
1139
+ if (!i) return NaN;
1140
+ const r = parseFloat(i[1]);
1141
+ return e.toLowerCase().endsWith("m") ? r : r * 1e3;
1142
+ }
1143
+ const ir = {
1144
+ ki: 1024,
1145
+ mi: 1024 ** 2,
1146
+ gi: 1024 ** 3,
1147
+ ti: 1024 ** 4,
1148
+ pi: 1024 ** 5,
1149
+ ei: 1024 ** 6
1150
+ };
1151
+ function mt(n) {
1152
+ if (!n?.trim()) return NaN;
1153
+ const i = n.trim().match(/^([0-9]+(?:\.[0-9]+)?)\s*(Ki|Mi|Gi|Ti|Pi|Ei)$/i);
1154
+ if (!i) return NaN;
1155
+ const r = parseFloat(i[1]), l = i[2].toLowerCase();
1156
+ return r * (ir[l] ?? 1);
1157
+ }
1158
+ const Mt = yi({
1159
+ replicas: Tt().int("Replicas must be a whole number").min(0, "Replicas must be at least 0").max(10, "Replicas must be at most 10"),
1160
+ cpuRequest: Rt().trim().min(1, "CPU request is required").regex(nn, "Use format like 100m, 0.5, or 1.5").refine((n) => dt(n) > 0, "CPU request must be greater than zero"),
1161
+ memoryRequest: Rt().trim().min(1, "Memory request is required").regex(rn, "Use format like 256Mi, 512Mi, or 1Gi").refine((n) => mt(n) > 0, "Memory request must be greater than zero"),
1162
+ cpuLimit: Rt().trim().optional().refine((n) => !n || nn.test(n), "Use format like 500m or 2"),
1163
+ memoryLimit: Rt().trim().optional().refine((n) => !n || rn.test(n), "Use format like 512Mi or 2Gi"),
1164
+ autoScalingEnabled: vi(),
1165
+ minReplicas: Tt().int().min(1).optional(),
1166
+ maxReplicas: Tt().int().min(1).optional()
1167
+ }).refine((n) => n.autoScalingEnabled ? n.minReplicas !== void 0 && n.maxReplicas !== void 0 && n.minReplicas <= n.maxReplicas : !0, {
1168
+ message: "Min replicas must be ≤ max replicas",
1169
+ path: ["maxReplicas"]
1170
+ }).refine((n) => {
1171
+ if (!n.cpuRequest?.trim() || !n.cpuLimit?.trim()) return !0;
1172
+ const e = dt(n.cpuRequest), i = dt(n.cpuLimit);
1173
+ return !Number.isNaN(e) && !Number.isNaN(i) && i >= e;
1174
+ }, {
1175
+ message: "CPU request must be ≤ CPU limit",
1176
+ path: ["cpuRequest"]
1177
+ }).refine((n) => {
1178
+ if (!n.memoryRequest?.trim() || !n.memoryLimit?.trim()) return !0;
1179
+ const e = mt(n.memoryRequest), i = mt(n.memoryLimit);
1180
+ return !Number.isNaN(e) && !Number.isNaN(i) && i >= e;
1181
+ }, {
1182
+ message: "Memory request must be ≤ memory limit",
1183
+ path: ["memoryRequest"]
1184
+ }).refine((n) => {
1185
+ if (!n.cpuLimit?.trim()) return !0;
1186
+ const e = dt(n.cpuRequest), i = dt(n.cpuLimit);
1187
+ return !Number.isNaN(e) && !Number.isNaN(i) && i >= e;
1188
+ }, {
1189
+ message: "CPU limit must be ≥ CPU request",
1190
+ path: ["cpuLimit"]
1191
+ }).refine((n) => {
1192
+ if (!n.memoryLimit?.trim()) return !0;
1193
+ const e = mt(n.memoryRequest), i = mt(n.memoryLimit);
1194
+ return !Number.isNaN(e) && !Number.isNaN(i) && i >= e;
1195
+ }, {
1196
+ message: "Memory limit must be ≥ memory request",
1197
+ path: ["memoryLimit"]
1198
+ }), an = {
1199
+ replicas: 1,
1200
+ cpuRequest: "100m",
1201
+ memoryRequest: "256Mi",
1202
+ cpuLimit: "500m",
1203
+ memoryLimit: "512Mi",
1204
+ autoScalingEnabled: !1,
1205
+ minReplicas: 1,
1206
+ maxReplicas: 3
1207
+ };
1208
+ function rr(n) {
1209
+ return {
1210
+ replicas: n.replicas ?? 1,
1211
+ cpuRequest: n.resources?.requests?.cpu ?? "500m",
1212
+ memoryRequest: n.resources?.requests?.memory ?? "512Mi",
1213
+ cpuLimit: n.resources?.limits?.cpu ?? "",
1214
+ memoryLimit: n.resources?.limits?.memory ?? "",
1215
+ autoScalingEnabled: n.autoScaling?.enabled ?? !1,
1216
+ minReplicas: n.autoScaling?.minReplicas ?? 1,
1217
+ maxReplicas: n.autoScaling?.maxReplicas ?? 3
1218
+ };
1219
+ }
1220
+ function ar(n) {
1221
+ return {
1222
+ replicas: n.replicas,
1223
+ resources: {
1224
+ requests: {
1225
+ cpu: n.cpuRequest,
1226
+ memory: n.memoryRequest
1227
+ },
1228
+ limits: n.cpuLimit || n.memoryLimit ? {
1229
+ ...n.cpuLimit && {
1230
+ cpu: n.cpuLimit
1231
+ },
1232
+ ...n.memoryLimit && {
1233
+ memory: n.memoryLimit
1234
+ }
1235
+ } : void 0
1236
+ },
1237
+ autoScaling: {
1238
+ enabled: n.autoScalingEnabled,
1239
+ ...n.autoScalingEnabled && {
1240
+ minReplicas: n.minReplicas ?? 1,
1241
+ maxReplicas: n.maxReplicas ?? 3
1242
+ }
1243
+ }
1244
+ };
1245
+ }
1246
+ function lr(n) {
1247
+ const e = $e(129), {
1248
+ open: i,
1249
+ onClose: r,
1250
+ resourceConfigs: l,
1251
+ orgName: c,
1252
+ projName: a,
1253
+ agentName: o,
1254
+ environment: y
1255
+ } = n, [m, g] = se(an), {
1256
+ errors: u,
1257
+ validateField: P,
1258
+ validateForm: E,
1259
+ clearErrors: R,
1260
+ setFieldError: T
1261
+ } = Hn(Mt), {
1262
+ mutate: v,
1263
+ isPending: p
1264
+ } = Gn(), {
1265
+ pushSnackBar: L
1266
+ } = Ht();
1267
+ let _, A;
1268
+ e[0] !== R || e[1] !== i || e[2] !== l ? (_ = () => {
1269
+ i && (g(l ? rr(l) : an), R());
1270
+ }, A = [i, l, R], e[0] = R, e[1] = i, e[2] = l, e[3] = _, e[4] = A) : (_ = e[3], A = e[4]), Ae(_, A);
1271
+ let w;
1272
+ e[5] !== T || e[6] !== P ? (w = (te, Ve) => {
1273
+ g((Ke) => {
1274
+ const qe = {
1275
+ ...Ke,
1276
+ [te]: Ve
1277
+ }, Fe = P(te, Ve, qe);
1278
+ return T(te, Fe), qe;
1279
+ });
1280
+ }, e[5] = T, e[6] = P, e[7] = w) : w = e[7];
1281
+ const f = w;
1282
+ let I;
1283
+ e[8] !== o || e[9] !== R || e[10] !== y || e[11] !== m || e[12] !== r || e[13] !== c || e[14] !== a || e[15] !== L || e[16] !== v || e[17] !== E ? (I = (te) => {
1284
+ te.preventDefault();
1285
+ const Ve = Mt.safeParse(m);
1286
+ if (!Ve.success) {
1287
+ E(m);
1288
+ return;
1289
+ }
1290
+ const Ke = ar(Ve.data);
1291
+ v({
1292
+ params: {
1293
+ orgName: c,
1294
+ projName: a,
1295
+ agentName: o
1296
+ },
1297
+ body: Ke,
1298
+ query: y ? {
1299
+ environment: y
1300
+ } : void 0
1301
+ }, {
1302
+ onSuccess: () => {
1303
+ R(), r();
1304
+ },
1305
+ onError: (qe) => {
1306
+ const He = qe?.body?.message ?? "Failed to update resource configurations";
1307
+ L({
1308
+ message: He,
1309
+ type: "error"
1310
+ });
1311
+ }
1312
+ });
1313
+ }, e[8] = o, e[9] = R, e[10] = y, e[11] = m, e[12] = r, e[13] = c, e[14] = a, e[15] = L, e[16] = v, e[17] = E, e[18] = I) : I = e[18];
1314
+ const G = I, j = Mt.safeParse(m).success;
1315
+ let W;
1316
+ e[19] === Symbol.for("react.memo_cache_sentinel") ? (W = /* @__PURE__ */ t(li, { size: 24 }), e[19] = W) : W = e[19];
1317
+ let S;
1318
+ e[20] !== r ? (S = /* @__PURE__ */ t(it, { icon: W, title: "Edit Resource Configurations", onClose: r }), e[20] = r, e[21] = S) : S = e[21];
1319
+ let M;
1320
+ e[22] === Symbol.for("react.memo_cache_sentinel") ? (M = /* @__PURE__ */ t(O.Header, { children: "Replicas" }), e[22] = M) : M = e[22];
1321
+ const z = p || m.autoScalingEnabled;
1322
+ let k;
1323
+ e[23] !== f ? (k = (te) => f("replicas", parseInt(te.target.value, 10) || 0), e[23] = f, e[24] = k) : k = e[24];
1324
+ const ie = !!u.replicas;
1325
+ let X;
1326
+ e[25] === Symbol.for("react.memo_cache_sentinel") ? (X = {
1327
+ input: {
1328
+ inputProps: {
1329
+ min: 0,
1330
+ max: 10
1331
+ }
1332
+ }
1333
+ }, e[25] = X) : X = e[25];
1334
+ let ae;
1335
+ e[26] !== u.replicas || e[27] !== m.replicas || e[28] !== ie || e[29] !== z || e[30] !== k ? (ae = /* @__PURE__ */ t(O.ElementWrapper, { label: "Replicas", name: "replicas", children: /* @__PURE__ */ t(Pe, { id: "replicas", type: "number", size: "small", fullWidth: !0, disabled: z, value: m.replicas, onChange: k, error: ie, helperText: u.replicas, slotProps: X }) }), e[26] = u.replicas, e[27] = m.replicas, e[28] = ie, e[29] = z, e[30] = k, e[31] = ae) : ae = e[31];
1336
+ let ee;
1337
+ e[32] !== f ? (ee = (te, Ve) => f("autoScalingEnabled", Ve), e[32] = f, e[33] = ee) : ee = e[33];
1338
+ let Q;
1339
+ e[34] !== m.autoScalingEnabled || e[35] !== p || e[36] !== ee ? (Q = /* @__PURE__ */ t(je, { control: /* @__PURE__ */ t(yt, { checked: m.autoScalingEnabled, onChange: ee, disabled: p }), label: "Enable autoscaling" }), e[34] = m.autoScalingEnabled, e[35] = p, e[36] = ee, e[37] = Q) : Q = e[37];
1340
+ let d;
1341
+ e[38] === Symbol.for("react.memo_cache_sentinel") ? (d = {
1342
+ mt: 1
1343
+ }, e[38] = d) : d = e[38];
1344
+ const C = m.minReplicas ?? 1;
1345
+ let D;
1346
+ e[39] !== f ? (D = (te) => f("minReplicas", parseInt(te.target.value, 10) || 1), e[39] = f, e[40] = D) : D = e[40];
1347
+ const N = !!u.minReplicas;
1348
+ let H;
1349
+ e[41] === Symbol.for("react.memo_cache_sentinel") ? (H = {
1350
+ input: {
1351
+ inputProps: {
1352
+ min: 1
1353
+ }
1354
+ }
1355
+ }, e[41] = H) : H = e[41];
1356
+ let h;
1357
+ e[42] !== u.minReplicas || e[43] !== p || e[44] !== C || e[45] !== D || e[46] !== N ? (h = /* @__PURE__ */ t(O.ElementWrapper, { label: "Min replicas", name: "minReplicas", children: /* @__PURE__ */ t(Pe, { id: "minReplicas", type: "number", size: "small", fullWidth: !0, disabled: p, value: C, onChange: D, error: N, helperText: u.minReplicas, slotProps: H }) }), e[42] = u.minReplicas, e[43] = p, e[44] = C, e[45] = D, e[46] = N, e[47] = h) : h = e[47];
1358
+ const x = m.maxReplicas ?? 3;
1359
+ let q;
1360
+ e[48] !== f ? (q = (te) => f("maxReplicas", parseInt(te.target.value, 10) || 3), e[48] = f, e[49] = q) : q = e[49];
1361
+ const Z = !!u.maxReplicas;
1362
+ let ue;
1363
+ e[50] === Symbol.for("react.memo_cache_sentinel") ? (ue = {
1364
+ input: {
1365
+ inputProps: {
1366
+ min: 1
1367
+ }
1368
+ }
1369
+ }, e[50] = ue) : ue = e[50];
1370
+ let le;
1371
+ e[51] !== u.maxReplicas || e[52] !== p || e[53] !== x || e[54] !== q || e[55] !== Z ? (le = /* @__PURE__ */ t(O.ElementWrapper, { label: "Max replicas", name: "maxReplicas", children: /* @__PURE__ */ t(Pe, { id: "maxReplicas", type: "number", size: "small", fullWidth: !0, disabled: p, value: x, onChange: q, error: Z, helperText: u.maxReplicas, slotProps: ue }) }), e[51] = u.maxReplicas, e[52] = p, e[53] = x, e[54] = q, e[55] = Z, e[56] = le) : le = e[56];
1372
+ let ge;
1373
+ e[57] !== h || e[58] !== le ? (ge = /* @__PURE__ */ s(O.Stack, { spacing: 2, sx: d, children: [
1374
+ h,
1375
+ le
1376
+ ] }), e[57] = h, e[58] = le, e[59] = ge) : ge = e[59];
1377
+ let he;
1378
+ e[60] !== m.autoScalingEnabled || e[61] !== ge ? (he = /* @__PURE__ */ t(nt, { in: m.autoScalingEnabled, children: ge }), e[60] = m.autoScalingEnabled, e[61] = ge, e[62] = he) : he = e[62];
1379
+ let ve;
1380
+ e[63] !== ae || e[64] !== Q || e[65] !== he ? (ve = /* @__PURE__ */ s(O.Section, { children: [
1381
+ M,
1382
+ /* @__PURE__ */ s(O.Stack, { spacing: 2, children: [
1383
+ ae,
1384
+ Q,
1385
+ he
1386
+ ] })
1387
+ ] }), e[63] = ae, e[64] = Q, e[65] = he, e[66] = ve) : ve = e[66];
1388
+ let xe;
1389
+ e[67] === Symbol.for("react.memo_cache_sentinel") ? (xe = /* @__PURE__ */ t(O.Header, { children: "Resource Requests" }), e[67] = xe) : xe = e[67];
1390
+ let pe;
1391
+ e[68] !== f ? (pe = (te) => f("cpuRequest", te.target.value), e[68] = f, e[69] = pe) : pe = e[69];
1392
+ const Ce = !!u.cpuRequest, be = u.cpuRequest || "e.g., 100m, 0.5, 1.5";
1393
+ let fe;
1394
+ e[70] !== m.cpuRequest || e[71] !== p || e[72] !== pe || e[73] !== Ce || e[74] !== be ? (fe = /* @__PURE__ */ t(O.ElementWrapper, { label: "CPU request", name: "cpuRequest", children: /* @__PURE__ */ t(Pe, { id: "cpuRequest", placeholder: "e.g., 500m, 0.5, 1", size: "small", fullWidth: !0, disabled: p, value: m.cpuRequest, onChange: pe, error: Ce, helperText: be }) }), e[70] = m.cpuRequest, e[71] = p, e[72] = pe, e[73] = Ce, e[74] = be, e[75] = fe) : fe = e[75];
1395
+ let ce;
1396
+ e[76] !== f ? (ce = (te) => f("memoryRequest", te.target.value), e[76] = f, e[77] = ce) : ce = e[77];
1397
+ const J = !!u.memoryRequest, re = u.memoryRequest || "e.g., 256Mi, 512Mi, 1Gi";
1398
+ let de;
1399
+ e[78] !== m.memoryRequest || e[79] !== p || e[80] !== ce || e[81] !== J || e[82] !== re ? (de = /* @__PURE__ */ t(O.ElementWrapper, { label: "Memory request", name: "memoryRequest", children: /* @__PURE__ */ t(Pe, { id: "memoryRequest", placeholder: "e.g., 512Mi, 1Gi", size: "small", fullWidth: !0, disabled: p, value: m.memoryRequest, onChange: ce, error: J, helperText: re }) }), e[78] = m.memoryRequest, e[79] = p, e[80] = ce, e[81] = J, e[82] = re, e[83] = de) : de = e[83];
1400
+ let ye;
1401
+ e[84] !== fe || e[85] !== de ? (ye = /* @__PURE__ */ s(O.Section, { children: [
1402
+ xe,
1403
+ /* @__PURE__ */ s(O.Stack, { spacing: 2, children: [
1404
+ fe,
1405
+ de
1406
+ ] })
1407
+ ] }), e[84] = fe, e[85] = de, e[86] = ye) : ye = e[86];
1408
+ let Re;
1409
+ e[87] === Symbol.for("react.memo_cache_sentinel") ? (Re = /* @__PURE__ */ t(O.Header, { children: "Resource Limits (optional)" }), e[87] = Re) : Re = e[87];
1410
+ let $;
1411
+ e[88] !== f ? ($ = (te) => f("cpuLimit", te.target.value), e[88] = f, e[89] = $) : $ = e[89];
1412
+ const B = !!u.cpuLimit;
1413
+ let Y;
1414
+ e[90] !== u.cpuLimit || e[91] !== m.cpuLimit || e[92] !== p || e[93] !== $ || e[94] !== B ? (Y = /* @__PURE__ */ t(O.ElementWrapper, { label: "CPU limit", name: "cpuLimit", children: /* @__PURE__ */ t(Pe, { id: "cpuLimit", placeholder: "e.g., 1, 2", size: "small", fullWidth: !0, disabled: p, value: m.cpuLimit, onChange: $, error: B, helperText: u.cpuLimit }) }), e[90] = u.cpuLimit, e[91] = m.cpuLimit, e[92] = p, e[93] = $, e[94] = B, e[95] = Y) : Y = e[95];
1415
+ let me;
1416
+ e[96] !== f ? (me = (te) => f("memoryLimit", te.target.value), e[96] = f, e[97] = me) : me = e[97];
1417
+ const Ne = !!u.memoryLimit;
1418
+ let we;
1419
+ e[98] !== u.memoryLimit || e[99] !== m.memoryLimit || e[100] !== p || e[101] !== me || e[102] !== Ne ? (we = /* @__PURE__ */ t(O.ElementWrapper, { label: "Memory limit", name: "memoryLimit", children: /* @__PURE__ */ t(Pe, { id: "memoryLimit", placeholder: "e.g., 1Gi, 2Gi", size: "small", fullWidth: !0, disabled: p, value: m.memoryLimit, onChange: me, error: Ne, helperText: u.memoryLimit }) }), e[98] = u.memoryLimit, e[99] = m.memoryLimit, e[100] = p, e[101] = me, e[102] = Ne, e[103] = we) : we = e[103];
1420
+ let b;
1421
+ e[104] !== Y || e[105] !== we ? (b = /* @__PURE__ */ s(O.Section, { children: [
1422
+ Re,
1423
+ /* @__PURE__ */ s(O.Stack, { spacing: 2, children: [
1424
+ Y,
1425
+ we
1426
+ ] })
1427
+ ] }), e[104] = Y, e[105] = we, e[106] = b) : b = e[106];
1428
+ let ke;
1429
+ e[107] !== p || e[108] !== r ? (ke = /* @__PURE__ */ t(ne, { variant: "outlined", onClick: r, disabled: p, children: "Cancel" }), e[107] = p, e[108] = r, e[109] = ke) : ke = e[109];
1430
+ const U = !j || p, oe = p ? "Saving..." : "Save";
1431
+ let Ie;
1432
+ e[110] !== U || e[111] !== oe ? (Ie = /* @__PURE__ */ t(ne, { type: "submit", variant: "contained", color: "primary", disabled: U, children: oe }), e[110] = U, e[111] = oe, e[112] = Ie) : Ie = e[112];
1433
+ let _e;
1434
+ e[113] !== ke || e[114] !== Ie ? (_e = /* @__PURE__ */ s(K, { display: "flex", justifyContent: "flex-end", gap: 1, mt: 2, children: [
1435
+ ke,
1436
+ Ie
1437
+ ] }), e[113] = ke, e[114] = Ie, e[115] = _e) : _e = e[115];
1438
+ let De;
1439
+ e[116] !== ve || e[117] !== ye || e[118] !== b || e[119] !== _e ? (De = /* @__PURE__ */ s(O.Stack, { spacing: 3, children: [
1440
+ ve,
1441
+ ye,
1442
+ b,
1443
+ _e
1444
+ ] }), e[116] = ve, e[117] = ye, e[118] = b, e[119] = _e, e[120] = De) : De = e[120];
1445
+ let Le;
1446
+ e[121] !== G || e[122] !== De ? (Le = /* @__PURE__ */ t(rt, { children: /* @__PURE__ */ t("form", { onSubmit: G, children: De }) }), e[121] = G, e[122] = De, e[123] = Le) : Le = e[123];
1447
+ let Oe;
1448
+ return e[124] !== r || e[125] !== i || e[126] !== Le || e[127] !== S ? (Oe = /* @__PURE__ */ s(at, { open: i, onClose: r, children: [
1449
+ S,
1450
+ Le
1451
+ ] }), e[124] = r, e[125] = i, e[126] = Le, e[127] = S, e[128] = Oe) : Oe = e[128], Oe;
1452
+ }
1453
+ const ln = {
1454
+ targetEnvironment: "",
1455
+ useConfigFromSourceEnv: !1,
1456
+ env: [],
1457
+ files: [],
1458
+ instrumentationVersion: "",
1459
+ instrumentationVersionDirty: !1
1460
+ };
1461
+ function or({
1462
+ open: n,
1463
+ onClose: e,
1464
+ sourceEnvironment: i,
1465
+ orgId: r,
1466
+ projectId: l,
1467
+ agentId: c
1468
+ }) {
1469
+ const [a, o] = se(ln), {
1470
+ data: y
1471
+ } = Cn({
1472
+ orgName: r,
1473
+ projName: l
1474
+ }), {
1475
+ data: m
1476
+ } = Rn({
1477
+ orgName: r
1478
+ }), {
1479
+ data: g
1480
+ } = At({
1481
+ orgName: r,
1482
+ projName: l,
1483
+ agentName: c
1484
+ }), u = g?.build?.type === "buildpack" && "buildpack" in (g.build ?? {}) && g.build.buildpack?.language === "python", P = _n(g?.build?.buildpack?.languageVersion), {
1485
+ data: E
1486
+ } = Nn({
1487
+ orgName: r
1488
+ }), R = Je(() => Dn(E, P), [E, P]), T = Se((d) => m?.find((C) => C.name === d)?.displayName ?? d, [m]), {
1489
+ mutateAsync: v,
1490
+ isPending: p,
1491
+ error: L,
1492
+ reset: _
1493
+ } = Kn(), A = Je(() => y ? y.promotionPaths.find((C) => C.sourceEnvironmentRef === i.name)?.targetEnvironmentRefs ?? [] : [], [y, i.name]), {
1494
+ data: w,
1495
+ isSuccess: f
1496
+ } = Et({
1497
+ orgName: r,
1498
+ projName: l,
1499
+ agentName: c
1500
+ }, {
1501
+ environment: a.targetEnvironment
1502
+ }), {
1503
+ data: I
1504
+ } = xn({
1505
+ orgName: r,
1506
+ projName: l,
1507
+ agentName: c
1508
+ }), G = Je(() => {
1509
+ const d = I?.[a.targetEnvironment]?.status;
1510
+ return !!d && d !== "not-deployed";
1511
+ }, [I, a.targetEnvironment]), [j, W] = se(null);
1512
+ Ae(() => {
1513
+ if (!n) {
1514
+ W(null), o(ln), _();
1515
+ return;
1516
+ }
1517
+ o((d) => d.targetEnvironment ? d : {
1518
+ ...d,
1519
+ targetEnvironment: A[0]?.name ?? ""
1520
+ });
1521
+ }, [n, A, _]), Ae(() => {
1522
+ if (!n) return;
1523
+ const d = a.targetEnvironment;
1524
+ if (!d || j === d || !f) return;
1525
+ const C = w?.configurations, D = (C?.env ?? []).filter((N) => !N.isSystem).map((N) => ({
1526
+ key: N.key,
1527
+ value: N.value ?? "",
1528
+ isSensitive: N.isSensitive,
1529
+ secretRef: N.secretRef
1530
+ }));
1531
+ o((N) => ({
1532
+ ...N,
1533
+ env: D,
1534
+ files: C?.files ?? []
1535
+ })), W(d);
1536
+ }, [n, a.targetEnvironment, f, w, j]), Ae(() => {
1537
+ !n || !E || !g || o((d) => {
1538
+ if (R.some((N) => N.version === d.instrumentationVersion)) return d;
1539
+ const D = zn(R, g?.configurations?.instrumentationVersion, E.instrumentation.defaultVersion);
1540
+ return {
1541
+ ...d,
1542
+ instrumentationVersion: D
1543
+ };
1544
+ });
1545
+ }, [n, E, g, R]);
1546
+ const S = Se((d) => {
1547
+ o((C) => ({
1548
+ ...C,
1549
+ useConfigFromSourceEnv: d
1550
+ }));
1551
+ }, []), M = Se((d, C, D) => {
1552
+ o((N) => ({
1553
+ ...N,
1554
+ env: N.env.map((H, h) => h === d ? {
1555
+ ...H,
1556
+ [C]: D
1557
+ } : H)
1558
+ }));
1559
+ }, []), z = Se(() => {
1560
+ o((d) => ({
1561
+ ...d,
1562
+ env: [...d.env, {
1563
+ key: "",
1564
+ value: "",
1565
+ isSensitive: !1
1566
+ }]
1567
+ }));
1568
+ }, []), k = Se((d) => {
1569
+ o((C) => ({
1570
+ ...C,
1571
+ env: C.env.filter((D, N) => N !== d)
1572
+ }));
1573
+ }, []), ie = Se(() => {
1574
+ o((d) => ({
1575
+ ...d,
1576
+ files: [...d.files, {
1577
+ key: "",
1578
+ mountPath: "",
1579
+ value: ""
1580
+ }]
1581
+ }));
1582
+ }, []), X = Se((d, C, D) => {
1583
+ o((N) => ({
1584
+ ...N,
1585
+ files: N.files.map((H, h) => h === d ? {
1586
+ ...H,
1587
+ [C]: D
1588
+ } : H)
1589
+ }));
1590
+ }, []), ae = Se((d) => {
1591
+ o((C) => ({
1592
+ ...C,
1593
+ files: C.files.filter((D, N) => N !== d)
1594
+ }));
1595
+ }, []), ee = Se(async (d) => {
1596
+ if (d.preventDefault(), !!a.targetEnvironment)
1597
+ try {
1598
+ await v({
1599
+ params: {
1600
+ orgName: r,
1601
+ projName: l,
1602
+ agentName: c
1603
+ },
1604
+ body: {
1605
+ sourceEnvironment: i.name,
1606
+ targetEnvironment: a.targetEnvironment,
1607
+ useConfigFromSourceEnv: a.useConfigFromSourceEnv,
1608
+ ...a.useConfigFromSourceEnv ? {} : {
1609
+ env: a.env.filter((C) => C.key).map(({
1610
+ key: C,
1611
+ value: D,
1612
+ isSensitive: N,
1613
+ secretRef: H
1614
+ }) => (
1615
+ // Preserve the secret reference for secrets the user did not edit.
1616
+ N && H && !D ? {
1617
+ key: C,
1618
+ isSensitive: N,
1619
+ secretRef: H
1620
+ } : {
1621
+ key: C,
1622
+ value: D,
1623
+ isSensitive: N
1624
+ }
1625
+ )),
1626
+ files: a.files,
1627
+ // Only send the version when the user explicitly picked a
1628
+ // compatible one; otherwise omit it so the backend inherits
1629
+ // the source env's pin rather than overwriting the target with
1630
+ // a display-only seed.
1631
+ ...u && a.instrumentationVersionDirty && a.instrumentationVersion && R.some((C) => C.version === a.instrumentationVersion) ? {
1632
+ instrumentationVersion: a.instrumentationVersion
1633
+ } : {}
1634
+ }
1635
+ }
1636
+ }), e();
1637
+ } catch {
1638
+ }
1639
+ }, [a, u, R, v, r, l, c, i.name, e]), Q = Je(() => L ? L?.message ?? "Failed to promote agent" : null, [L]);
1640
+ return /* @__PURE__ */ s(at, { open: n, onClose: e, children: [
1641
+ /* @__PURE__ */ t(it, { icon: /* @__PURE__ */ t(Pn, { size: 24 }), title: `Promote from ${i.displayName ?? i.name} Environment`, onClose: e }),
1642
+ /* @__PURE__ */ t(rt, { children: /* @__PURE__ */ t("form", { onSubmit: ee, children: /* @__PURE__ */ s(F, { spacing: 3, children: [
1643
+ Q && /* @__PURE__ */ t(xt, { severity: "error", children: /* @__PURE__ */ t(V, { variant: "body2", children: Q }) }),
1644
+ A.length > 1 && /* @__PURE__ */ s(gt, { children: [
1645
+ /* @__PURE__ */ s(O.Section, { children: [
1646
+ /* @__PURE__ */ t(O.Header, { children: "Target Environment" }),
1647
+ /* @__PURE__ */ t(O.Stack, { spacing: 2, children: /* @__PURE__ */ t(Ue, { fullWidth: !0, required: !0, children: /* @__PURE__ */ s(jt, { size: "small", value: a.targetEnvironment, onChange: (d) => o((C) => ({
1648
+ ...C,
1649
+ targetEnvironment: d.target.value
1650
+ })), displayEmpty: !0, disabled: p, children: [
1651
+ /* @__PURE__ */ t(Be, { value: "", disabled: !0, children: /* @__PURE__ */ t("em", { children: "Select target environment" }) }),
1652
+ A.map((d) => /* @__PURE__ */ t(Be, { value: d.name, children: T(d.name) }, d.name))
1653
+ ] }) }) })
1654
+ ] }),
1655
+ /* @__PURE__ */ t(We, {})
1656
+ ] }),
1657
+ /* @__PURE__ */ s(O.Section, { children: [
1658
+ /* @__PURE__ */ t(O.Header, { children: "Configuration" }),
1659
+ /* @__PURE__ */ s(O.Stack, { spacing: 2, children: [
1660
+ /* @__PURE__ */ t(je, { control: /* @__PURE__ */ t(yt, { checked: a.useConfigFromSourceEnv, onChange: (d) => S(d.target.checked), disabled: p }), label: /* @__PURE__ */ s(F, { children: [
1661
+ /* @__PURE__ */ t(V, { variant: "body2", children: "Use config from source environment" }),
1662
+ /* @__PURE__ */ s(V, { variant: "caption", color: "text.secondary", children: [
1663
+ "Inherit environment variables and file mounts from",
1664
+ " ",
1665
+ i.displayName ?? i.name
1666
+ ] })
1667
+ ] }) }),
1668
+ /* @__PURE__ */ t(nt, { in: !a.useConfigFromSourceEnv, timeout: "auto", unmountOnExit: !0, children: /* @__PURE__ */ s(F, { spacing: 2, children: [
1669
+ /* @__PURE__ */ t(xt, { severity: "info", children: /* @__PURE__ */ t(V, { variant: "body2", children: G ? `These values are the current configuration of ${T(a.targetEnvironment)}. Editing them here will update that environment on promote.` : `These values are inherited from the agent's base configuration. Review and adjust them for ${T(a.targetEnvironment)} before promoting.` }) }),
1670
+ /* @__PURE__ */ t(Ee, { variant: "outlined", children: /* @__PURE__ */ t(Te, { children: /* @__PURE__ */ s(F, { spacing: 1.5, children: [
1671
+ /* @__PURE__ */ s(F, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [
1672
+ /* @__PURE__ */ t(V, { variant: "h6", children: "Environment Variables" }),
1673
+ /* @__PURE__ */ t(ne, { size: "small", variant: "outlined", startIcon: /* @__PURE__ */ t(Pt, { size: 14 }), onClick: z, disabled: p, children: "Add" })
1674
+ ] }),
1675
+ a.env.length === 0 ? /* @__PURE__ */ t(V, { variant: "body2", color: "text.secondary", children: "No environment variables. Click Add to define them." }) : /* @__PURE__ */ t(F, { spacing: 1, children: a.env.map((d, C) => /* @__PURE__ */ t(yn, { index: C, keyValue: d.key, valueValue: d.value, isSensitive: d.isSensitive ?? !1, isExistingSecret: !!(d.secretRef && d.isSensitive), onKeyChange: (D) => M(C, "key", D), onValueChange: (D) => M(C, "value", D), onSensitiveChange: (D) => M(C, "isSensitive", D), onRemove: () => k(C) }, C)) })
1676
+ ] }) }) }),
1677
+ /* @__PURE__ */ t(Ee, { variant: "outlined", children: /* @__PURE__ */ t(Te, { children: /* @__PURE__ */ s(F, { spacing: 1.5, children: [
1678
+ /* @__PURE__ */ s(F, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [
1679
+ /* @__PURE__ */ t(V, { variant: "h6", children: "File Mounts" }),
1680
+ /* @__PURE__ */ t(ne, { size: "small", variant: "outlined", startIcon: /* @__PURE__ */ t(Pt, { size: 14 }), onClick: ie, disabled: p, children: "Add" })
1681
+ ] }),
1682
+ a.files.length === 0 ? /* @__PURE__ */ t(V, { variant: "body2", color: "text.secondary", children: "No file mounts. Click Add to define them." }) : /* @__PURE__ */ t(F, { spacing: 1, children: a.files.map((d, C) => /* @__PURE__ */ t(vn, { index: C, keyValue: d.key, mountPathValue: d.mountPath, contentValue: d.value, onKeyChange: (D) => X(C, "key", D), onMountPathChange: (D) => X(C, "mountPath", D), onContentChange: (D) => X(C, "value", D), onRemove: () => ae(C) }, C)) })
1683
+ ] }) }) }),
1684
+ u && /* @__PURE__ */ t(Ee, { variant: "outlined", children: /* @__PURE__ */ t(Te, { children: /* @__PURE__ */ s(F, { spacing: 1.5, children: [
1685
+ /* @__PURE__ */ t(V, { variant: "h6", children: "AMP Instrumentation Version" }),
1686
+ /* @__PURE__ */ s(V, { variant: "body2", color: "text.secondary", children: [
1687
+ "Pins the init-container image and the bundled OpenLLMetry SDK version for",
1688
+ " ",
1689
+ T(a.targetEnvironment),
1690
+ "."
1691
+ ] }),
1692
+ R.length === 0 && E ? /* @__PURE__ */ t(xt, { severity: "info", children: /* @__PURE__ */ s(V, { variant: "body2", children: [
1693
+ "No AMP-provided instrumentation is available for Python ",
1694
+ P ?? "the selected version",
1695
+ ". You can still promote and instrument manually."
1696
+ ] }) }) : /* @__PURE__ */ t(Ue, { sx: {
1697
+ minWidth: 240
1698
+ }, children: /* @__PURE__ */ t(jt, { size: "small", value: R.some((d) => d.version === a.instrumentationVersion) ? a.instrumentationVersion : "", disabled: p || !E, onChange: (d) => o((C) => ({
1699
+ ...C,
1700
+ instrumentationVersion: d.target.value,
1701
+ instrumentationVersionDirty: !0
1702
+ })), children: R.map((d) => /* @__PURE__ */ t(Be, { value: d.version, children: d.traceloopSdk ? `${d.version} (OpenLLMetry v${d.traceloopSdk})` : d.version }, d.version)) }) })
1703
+ ] }) }) })
1704
+ ] }) })
1705
+ ] })
1706
+ ] }),
1707
+ /* @__PURE__ */ s(K, { display: "flex", justifyContent: "flex-end", gap: 1, mt: 2, children: [
1708
+ /* @__PURE__ */ t(ne, { variant: "outlined", color: "inherit", onClick: e, disabled: p, children: "Cancel" }),
1709
+ /* @__PURE__ */ t(ne, { type: "submit", variant: "contained", color: "primary", disabled: p || !a.targetEnvironment, children: p ? "Promoting..." : "Promote" })
1710
+ ] })
1711
+ ] }) }) })
1712
+ ] });
1713
+ }
1714
+ function sr(n) {
1715
+ const e = $e(16), {
1716
+ status: i
1717
+ } = n, r = sn();
1718
+ let l;
1719
+ e: {
1720
+ if (i === ze.ACTIVE) {
1721
+ let g;
1722
+ e[0] !== r.palette.success.light ? (g = ut(r.palette.success.light, 0.1), e[0] = r.palette.success.light, e[1] = g) : g = e[1], l = g;
1723
+ break e;
1724
+ }
1725
+ if (i === ze.INACTIVE) {
1726
+ l = r.vars?.palette?.Skeleton.bg;
1727
+ break e;
1728
+ }
1729
+ if (i === ze.DEPLOYING) {
1730
+ let g;
1731
+ e[2] !== r.palette.warning.light ? (g = ut(r.palette.warning.light, 0.1), e[2] = r.palette.warning.light, e[3] = g) : g = e[3], l = g;
1732
+ break e;
1733
+ }
1734
+ if (i === ze.ERROR) {
1735
+ let g;
1736
+ e[4] !== r.palette.error.light ? (g = ut(r.palette.error.light, 0.1), e[4] = r.palette.error.light, e[5] = g) : g = e[5], l = g;
1737
+ break e;
1738
+ }
1739
+ if (i === ze.SUSPENDED) {
1740
+ l = r.vars?.palette?.Skeleton?.bg;
1741
+ break e;
1742
+ }
1743
+ if (i === ze.FAILED) {
1744
+ let g;
1745
+ e[6] !== r.palette.error.light ? (g = ut(r.palette.error.light, 0.1), e[6] = r.palette.error.light, e[7] = g) : g = e[7], l = g;
1746
+ break e;
1747
+ }
1748
+ l = r.vars?.palette?.Skeleton?.bg;
1749
+ }
1750
+ const c = l;
1751
+ let a;
1752
+ e[8] !== c ? (a = {
1753
+ backgroundColor: c,
1754
+ padding: 1,
1755
+ borderRadius: 0.5
1756
+ }, e[8] = c, e[9] = a) : a = e[9];
1757
+ let o;
1758
+ e[10] === Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ t(V, { variant: "body2", children: "Deployment Status:" }), e[10] = o) : o = e[10];
1759
+ let y;
1760
+ e[11] !== i ? (y = /* @__PURE__ */ t(bi, { status: i }), e[11] = i, e[12] = y) : y = e[12];
1761
+ let m;
1762
+ return e[13] !== a || e[14] !== y ? (m = /* @__PURE__ */ s(K, { display: "flex", gap: 1, flexGrow: 1, alignItems: "center", justifyContent: "space-between", sx: a, children: [
1763
+ o,
1764
+ y
1765
+ ] }), e[13] = a, e[14] = y, e[15] = m) : m = e[15], m;
1766
+ }
1767
+ function cr(n) {
1768
+ const e = $e(34), {
1769
+ resourceConfigs: i,
1770
+ isLoading: r,
1771
+ metrics: l
1772
+ } = n, c = l?.cpuUsage?.length ? l.cpuUsage[l.cpuUsage.length - 1]?.value : void 0, a = l?.memory?.length ? l.memory[l.memory.length - 1]?.value : void 0, o = l?.cpuRequests?.length ? l.cpuRequests[l.cpuRequests.length - 1]?.value : void 0, y = l?.memoryRequests?.length ? l.memoryRequests[l.memoryRequests.length - 1]?.value : void 0, m = i?.resources?.requests?.cpu ?? "—", g = i?.resources?.requests?.memory ?? "—";
1773
+ let u;
1774
+ e[0] !== c || e[1] !== o ? (u = c !== void 0 && o !== void 0 && o > 0 ? en(c, o) : void 0, e[0] = c, e[1] = o, e[2] = u) : u = e[2];
1775
+ const P = u;
1776
+ let E;
1777
+ e[3] !== a || e[4] !== y ? (E = a !== void 0 && y !== void 0 && y > 0 ? en(a, y) : void 0, e[3] = a, e[4] = y, e[5] = E) : E = e[5];
1778
+ const R = E;
1779
+ let T;
1780
+ e[6] !== c || e[7] !== o ? (T = c !== void 0 && o !== void 0 && o > 0 ? tn(c, o) : void 0, e[6] = c, e[7] = o, e[8] = T) : T = e[8];
1781
+ const v = T;
1782
+ let p;
1783
+ e[9] !== a || e[10] !== y ? (p = a !== void 0 && y !== void 0 && y > 0 ? tn(a, y) : void 0, e[9] = a, e[10] = y, e[11] = p) : p = e[11];
1784
+ const L = p;
1785
+ if (r) {
1786
+ let k;
1787
+ return e[12] === Symbol.for("react.memo_cache_sentinel") ? (k = /* @__PURE__ */ t(F, { direction: "row", gap: 1, justifyContent: "center", alignItems: "center", width: "100%", children: /* @__PURE__ */ t(qn, { variant: "rounded", width: "100%", height: 32 }) }), e[12] = k) : k = e[12], k;
1788
+ }
1789
+ if (!i) {
1790
+ let k;
1791
+ return e[13] === Symbol.for("react.memo_cache_sentinel") ? (k = /* @__PURE__ */ t(wt, { message: "No Resource Configs found", icon: /* @__PURE__ */ t(En, { size: 16 }), disableBackground: !0 }), e[13] = k) : k = e[13], k;
1792
+ }
1793
+ let _;
1794
+ e[14] === Symbol.for("react.memo_cache_sentinel") ? (_ = /* @__PURE__ */ t(pi, { size: 16 }), e[14] = _) : _ = e[14];
1795
+ const A = i.autoScaling?.enabled ? "AUTO" : i.replicas ?? "--", w = i.autoScaling?.enabled ? `Autoscaling is enabled, replicas can be ${i.autoScaling?.minReplicas} to ${i.autoScaling?.maxReplicas}` : "Autoscaling is disabled, replicas are fixed";
1796
+ let f;
1797
+ e[15] !== A || e[16] !== w ? (f = /* @__PURE__ */ t(Vt, { icon: _, label: "Replicas", primaryValue: "", secondaryValue: A, secondaryTooltip: w, secondaryVariant: "success" }), e[15] = A, e[16] = w, e[17] = f) : f = e[17];
1798
+ let I;
1799
+ e[18] === Symbol.for("react.memo_cache_sentinel") ? (I = /* @__PURE__ */ t(fi, { size: 16 }), e[18] = I) : I = e[18];
1800
+ const G = P ? "Current usage as % of requested." : void 0;
1801
+ let j;
1802
+ e[19] !== P || e[20] !== m || e[21] !== v || e[22] !== G ? (j = /* @__PURE__ */ t(Vt, { icon: I, label: "CPU", primaryValue: m, secondaryValue: P, secondaryTooltip: G, secondaryVariant: v }), e[19] = P, e[20] = m, e[21] = v, e[22] = G, e[23] = j) : j = e[23];
1803
+ let W;
1804
+ e[24] === Symbol.for("react.memo_cache_sentinel") ? (W = /* @__PURE__ */ t(gi, { size: 16 }), e[24] = W) : W = e[24];
1805
+ const S = R ? "Current usage as % of requested." : void 0;
1806
+ let M;
1807
+ e[25] !== R || e[26] !== g || e[27] !== L || e[28] !== S ? (M = /* @__PURE__ */ t(Vt, { icon: W, label: "Memory", primaryValue: g, secondaryValue: R, secondaryTooltip: S, secondaryVariant: L }), e[25] = R, e[26] = g, e[27] = L, e[28] = S, e[29] = M) : M = e[29];
1808
+ let z;
1809
+ return e[30] !== j || e[31] !== M || e[32] !== f ? (z = /* @__PURE__ */ s(F, { direction: "row", spacing: 1, width: "100%", children: [
1810
+ f,
1811
+ j,
1812
+ M
1813
+ ] }), e[30] = j, e[31] = M, e[32] = f, e[33] = z) : z = e[33], z;
1814
+ }
1815
+ const Me = "envId", Ot = "openResConfig", Ut = "openPromote", qt = "openConfigure", Ft = "openCors";
1816
+ function dr(n) {
1817
+ const {
1818
+ currentEnvironment: e
1819
+ } = n, {
1820
+ orgId: i,
1821
+ agentId: r,
1822
+ projectId: l
1823
+ } = $t(), [c, a] = hn(), o = c.get(Ot) === "open" && c.get(Me) === e.name, y = c.get(Ut) === "open" && c.get(Me) === e.name, m = Se(() => {
1824
+ const b = new URLSearchParams(c);
1825
+ b.set(Me, e.name), b.set(Ot, "open"), a(b);
1826
+ }, [e.name, c, a]), g = Se(() => {
1827
+ const b = new URLSearchParams(c);
1828
+ b.delete(Ot), b.delete(Me), a(b);
1829
+ }, [c, a]), u = Se(() => {
1830
+ const b = new URLSearchParams(c);
1831
+ b.set(Me, e.name), b.set(Ut, "open"), a(b);
1832
+ }, [e.name, c, a]), P = Se(() => {
1833
+ const b = new URLSearchParams(c);
1834
+ b.delete(Ut), b.delete(Me), a(b);
1835
+ }, [c, a]), E = c.get(qt) === "open" && c.get(Me) === e.name, R = Se(() => {
1836
+ const b = new URLSearchParams(c);
1837
+ b.set(Me, e.name), b.set(qt, "open"), a(b);
1838
+ }, [e.name, c, a]), T = Se(() => {
1839
+ const b = new URLSearchParams(c);
1840
+ b.delete(qt), b.delete(Me), a(b);
1841
+ }, [c, a]), v = c.get(Ft) === "open" && c.get(Me) === e.name, p = Se(() => {
1842
+ const b = new URLSearchParams(c);
1843
+ b.set(Me, e.name), b.set(Ft, "open"), a(b);
1844
+ }, [e.name, c, a]), L = Se(() => {
1845
+ const b = new URLSearchParams(c);
1846
+ b.delete(Ft), b.delete(Me), a(b);
1847
+ }, [c, a]), {
1848
+ data: _,
1849
+ isLoading: A
1850
+ } = xn({
1851
+ orgName: i,
1852
+ projName: l,
1853
+ agentName: r
1854
+ }), {
1855
+ data: w
1856
+ } = Cn({
1857
+ orgName: i,
1858
+ projName: l
1859
+ }), f = Je(() => w ? w.promotionPaths.some((b) => b.sourceEnvironmentRef === e.name && (b.targetEnvironmentRefs?.length ?? 0) > 0) : !1, [w, e.name]), {
1860
+ mutate: I,
1861
+ isPending: G
1862
+ } = Yn(), {
1863
+ data: j,
1864
+ isLoading: W
1865
+ } = Zn({
1866
+ orgName: i,
1867
+ projName: l,
1868
+ agentName: r
1869
+ }, {
1870
+ environment: e.name
1871
+ }), S = _?.[e.name], M = S?.status === ze.ACTIVE, {
1872
+ data: z
1873
+ } = Xn({
1874
+ orgName: i,
1875
+ projName: l,
1876
+ agentName: r
1877
+ }, {
1878
+ environmentName: e.name
1879
+ }, {
1880
+ enabled: !!i && !!l && !!r && !!e.name && M,
1881
+ enableAutoRefresh: !0,
1882
+ timeRange: Qn.TEN_MINUTES
1883
+ }), {
1884
+ data: k
1885
+ } = At({
1886
+ orgName: i,
1887
+ projName: l,
1888
+ agentName: r
1889
+ }), ie = k?.agentType?.type === "agent-api", X = k?.build?.type === "buildpack" && "buildpack" in (k.build ?? {}) && k.build.buildpack?.language === "python", ae = _n(k?.build?.buildpack?.languageVersion), [ee, Q] = se(!1), [d, C] = se(!1), [D, N] = se(null), [H, h] = se(""), [x, q] = se(!1), {
1890
+ data: Z
1891
+ } = Nn({
1892
+ orgName: i ?? ""
1893
+ }), ue = Je(() => Dn(Z, ae), [Z, ae]);
1894
+ Ae(() => {
1895
+ k?.configurations?.enableAutoInstrumentation !== void 0 && Q(k.configurations.enableAutoInstrumentation);
1896
+ }, [k?.configurations?.enableAutoInstrumentation]), Ae(() => {
1897
+ h(""), q(!1);
1898
+ }, [r, e.name]), Ae(() => {
1899
+ if (!Z || !k || ue.some((U) => U.version === H)) return;
1900
+ const ke = zn(ue, k?.configurations?.instrumentationVersion, Z.instrumentation.defaultVersion);
1901
+ h(ke);
1902
+ }, [Z, k, ue, H]);
1903
+ const le = k?.configurations?.enableOAuthSecurity ? "oauth" : k?.configurations?.enableApiKeySecurity ? "apikey" : "none", ge = le === "oauth" ? "OAuth" : le === "apikey" ? "API key" : "None";
1904
+ Et({
1905
+ orgName: i,
1906
+ projName: l,
1907
+ agentName: r
1908
+ }, {
1909
+ environment: e.name
1910
+ });
1911
+ const {
1912
+ mutate: he
1913
+ } = gn(), {
1914
+ mutate: ve
1915
+ } = Sn(), xe = ue.some((b) => b.version === H), pe = ot({
1916
+ tracing: ee,
1917
+ instrumentationVersion: H,
1918
+ versionDirty: x,
1919
+ versionInCompatibleSet: xe
1920
+ });
1921
+ pe.current = {
1922
+ tracing: ee,
1923
+ instrumentationVersion: H,
1924
+ versionDirty: x,
1925
+ versionInCompatibleSet: xe
1926
+ };
1927
+ const Ce = ot({
1928
+ orgId: i,
1929
+ projectId: l,
1930
+ agentId: r,
1931
+ currentEnvironment: e,
1932
+ isApiAgent: ie,
1933
+ isPythonBuildpack: X
1934
+ });
1935
+ Ce.current = {
1936
+ orgId: i,
1937
+ projectId: l,
1938
+ agentId: r,
1939
+ currentEnvironment: e,
1940
+ isApiAgent: ie,
1941
+ isPythonBuildpack: X
1942
+ };
1943
+ const be = ot(he);
1944
+ be.current = he;
1945
+ const fe = ot(ve);
1946
+ fe.current = ve;
1947
+ const ce = ot(void 0);
1948
+ Ae(() => () => {
1949
+ ce.current && clearTimeout(ce.current);
1950
+ }, []);
1951
+ const J = Se(() => {
1952
+ clearTimeout(ce.current), ce.current = setTimeout(() => {
1953
+ const {
1954
+ orgId: b,
1955
+ projectId: ke,
1956
+ agentId: U,
1957
+ currentEnvironment: oe,
1958
+ isPythonBuildpack: Ie
1959
+ } = Ce.current;
1960
+ if (!b || !ke || !U || !oe?.name) return;
1961
+ const {
1962
+ tracing: _e,
1963
+ instrumentationVersion: De,
1964
+ versionDirty: Le,
1965
+ versionInCompatibleSet: Oe
1966
+ } = pe.current;
1967
+ C(!0), fe.current({
1968
+ params: {
1969
+ orgName: b,
1970
+ projName: ke,
1971
+ agentName: U
1972
+ },
1973
+ body: {
1974
+ environmentName: oe.name,
1975
+ ...Ie && {
1976
+ enableAutoInstrumentation: _e
1977
+ },
1978
+ ...Ie && _e && Le && Oe && De ? {
1979
+ instrumentationVersion: De
1980
+ } : {}
1981
+ }
1982
+ }, {
1983
+ onSuccess: () => C(!1),
1984
+ onError: () => C(!1)
1985
+ });
1986
+ }, 800);
1987
+ }, []), re = k?.configurations?.corsConfig?.enabled ?? !1, de = k?.configurations?.corsConfig?.allowOrigin ?? [], ye = re ? de.includes("*") ? "All origins" : `${de.length} origin${de.length !== 1 ? "s" : ""}` : "Disabled", Re = k?.kindName, {
1988
+ data: $
1989
+ } = Jn({
1990
+ orgName: i ?? "",
1991
+ kindName: Re ?? ""
1992
+ }), B = $?.find((b) => b.imageId === S?.imageId), Y = nr(S?.imageId), me = S?.lastDeployed ? Si(new Date(S.lastDeployed), {
1993
+ addSuffix: !0
1994
+ }) : "Unknown", Ne = () => {
1995
+ !e?.name || !i || !l || !r || I({
1996
+ params: {
1997
+ orgName: i,
1998
+ projName: l,
1999
+ agentName: r
2000
+ },
2001
+ body: {
2002
+ environment: e.name,
2003
+ state: "Undeploy"
2004
+ }
2005
+ });
2006
+ }, we = () => {
2007
+ !e?.name || !i || !l || !r || I({
2008
+ params: {
2009
+ orgName: i,
2010
+ projName: l,
2011
+ agentName: r
2012
+ },
2013
+ body: {
2014
+ environment: e.name,
2015
+ state: "Active"
2016
+ }
2017
+ });
2018
+ };
2019
+ return A ? /* @__PURE__ */ t(Ee, { variant: "outlined", sx: {
2020
+ height: "fit-content",
2021
+ width: 350,
2022
+ minWidth: 350
2023
+ }, children: /* @__PURE__ */ t(Te, { children: /* @__PURE__ */ t(K, { p: 8, display: "flex", justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ t(tt, {}) }) }) }) : !S || S.status === "not-deployed" ? /* @__PURE__ */ t(Ee, { variant: "outlined", sx: {
2024
+ height: "fit-content",
2025
+ width: 350,
2026
+ minWidth: 350
2027
+ }, children: /* @__PURE__ */ t(Te, { children: /* @__PURE__ */ t(F, { gap: 2, alignItems: "center", children: /* @__PURE__ */ t(wt, { message: "No Deployment found", subtitle: `Build your agent first to deploy it to ${e.displayName} environment.`, icon: /* @__PURE__ */ t(ft, { size: 32 }), disableBackground: !0 }) }) }) }) : /* @__PURE__ */ t(Ee, { variant: "outlined", sx: {
2028
+ height: "fit-content",
2029
+ width: 400,
2030
+ minWidth: 400
2031
+ }, children: /* @__PURE__ */ t(Te, { children: /* @__PURE__ */ s(F, { gap: 2, children: [
2032
+ /* @__PURE__ */ s(V, { variant: "h5", children: [
2033
+ e?.displayName,
2034
+ " Environment"
2035
+ ] }),
2036
+ /* @__PURE__ */ t(We, {}),
2037
+ /* @__PURE__ */ s(F, { direction: "row", gap: 1, alignItems: "center", children: [
2038
+ /* @__PURE__ */ t(V, { variant: "body2", children: "Last Deployed" }),
2039
+ /* @__PURE__ */ t(vt, { size: 16 }),
2040
+ /* @__PURE__ */ t(V, { variant: "body2", children: me })
2041
+ ] }),
2042
+ /* @__PURE__ */ t(F, { direction: "row", gap: 1, alignItems: "center", children: /* @__PURE__ */ t(sr, { status: S?.status }) }),
2043
+ S?.imageId && (Re ? /* @__PURE__ */ t(zt, { label: "Kind Version", labelAction: /* @__PURE__ */ t(Dt, { component: Ye, to: Ze(Xe.children.org.children.catalog.children.kindDetails.path, {
2044
+ orgId: i,
2045
+ kindId: Re
2046
+ }) + (B ? `?version=${B.version}` : ""), children: /* @__PURE__ */ t(Xt, { size: 16 }) }), value: B ? `v${B.version}` : "", slotProps: {
2047
+ input: {
2048
+ readOnly: !0
2049
+ }
2050
+ } }) : /* @__PURE__ */ t(zt, { label: "Build Image", labelAction: /* @__PURE__ */ t(Dt, { component: Ye, to: Ze(Xe.children.org.children.projects.children.agents.children.build.path, {
2051
+ orgId: i,
2052
+ projectId: l,
2053
+ agentId: r
2054
+ }) + "?panel=logs&selectedBuild=" + Y, children: /* @__PURE__ */ t(Xt, { size: 16 }) }), value: S?.imageId, copyable: !0, copyTooltipText: "Copy Build Image", slotProps: {
2055
+ input: {
2056
+ readOnly: !0
2057
+ }
2058
+ } })),
2059
+ S?.endpoints.map((b) => /* @__PURE__ */ t(zt, { label: "URL", value: b.url, copyable: !0, copyTooltipText: "Copy URL", slotProps: {
2060
+ input: {
2061
+ readOnly: !0
2062
+ }
2063
+ } }, b.url)),
2064
+ /* @__PURE__ */ t(nt, { in: [ze.ACTIVE, ze.ERROR, ze.FAILED].includes(S?.status), children: /* @__PURE__ */ s(F, { gap: 2, children: [
2065
+ /* @__PURE__ */ t(Ee, { variant: "outlined", sx: {
2066
+ padding: 1.4,
2067
+ pt: 0.5
2068
+ }, children: /* @__PURE__ */ s(F, { gap: 1, children: [
2069
+ /* @__PURE__ */ s(F, { direction: "row", gap: 1, alignItems: "center", justifyContent: "space-between", children: [
2070
+ /* @__PURE__ */ t(V, { variant: "h6", children: "Resource Usage" }),
2071
+ /* @__PURE__ */ t(ne, { variant: "text", size: "small", color: "inherit", sx: {
2072
+ padding: 0.5
2073
+ }, startIcon: /* @__PURE__ */ t(ht, { size: 16 }), onClick: m, children: "Configure" })
2074
+ ] }),
2075
+ /* @__PURE__ */ t(F, { direction: "row", gap: 1, alignItems: "center", children: /* @__PURE__ */ t(cr, { resourceConfigs: j, isLoading: W, metrics: z }) })
2076
+ ] }) }),
2077
+ /* @__PURE__ */ t(Ee, { variant: "outlined", sx: {
2078
+ padding: 1.4
2079
+ }, children: /* @__PURE__ */ s(F, { gap: 1.5, children: [
2080
+ /* @__PURE__ */ s(F, { direction: "row", gap: 1, alignItems: "center", justifyContent: "space-between", children: [
2081
+ /* @__PURE__ */ t(V, { variant: "h6", children: "Security & Observability" }),
2082
+ d && /* @__PURE__ */ t(tt, { size: 14 })
2083
+ ] }),
2084
+ ie && /* @__PURE__ */ s(K, { display: "flex", alignItems: "center", justifyContent: "space-between", children: [
2085
+ /* @__PURE__ */ s(K, { display: "flex", alignItems: "center", gap: 1, children: [
2086
+ /* @__PURE__ */ t(oi, { size: 14, style: {
2087
+ opacity: 0.6
2088
+ } }),
2089
+ /* @__PURE__ */ t(V, { variant: "body2", children: "CORS" }),
2090
+ /* @__PURE__ */ t(pt, { title: ye, children: /* @__PURE__ */ t(Qe, { size: "small", label: re ? "On" : "Off", color: re ? "success" : "default", variant: "outlined", sx: {
2091
+ height: 18,
2092
+ fontSize: "0.65rem",
2093
+ cursor: "default"
2094
+ } }) })
2095
+ ] }),
2096
+ /* @__PURE__ */ t(ne, { variant: "text", size: "small", color: "inherit", sx: {
2097
+ minWidth: 0,
2098
+ px: 0.5
2099
+ }, startIcon: /* @__PURE__ */ t(ht, { size: 16 }), onClick: p, children: "Configure" })
2100
+ ] }),
2101
+ ie && /* @__PURE__ */ s(K, { display: "flex", alignItems: "center", justifyContent: "space-between", children: [
2102
+ /* @__PURE__ */ s(K, { display: "flex", alignItems: "center", gap: 1, children: [
2103
+ /* @__PURE__ */ t(Qt, { size: 14, style: {
2104
+ opacity: 0.6
2105
+ } }),
2106
+ /* @__PURE__ */ t(V, { variant: "body2", children: "Authentication" }),
2107
+ /* @__PURE__ */ t(pt, { title: le === "oauth" ? "Callers send an Authorization: Bearer <token> header validated by the gateway" : le === "apikey" ? "Requests must include the header: x-api-key: <your-key>" : "Endpoint is publicly accessible without authentication", children: /* @__PURE__ */ t(Qe, { size: "small", label: ge, color: le === "none" ? "default" : "success", variant: "outlined", sx: {
2108
+ height: 18,
2109
+ fontSize: "0.65rem",
2110
+ cursor: "default"
2111
+ } }) })
2112
+ ] }),
2113
+ /* @__PURE__ */ t(ne, { variant: "text", size: "small", color: "inherit", sx: {
2114
+ minWidth: 0,
2115
+ px: 0.5
2116
+ }, startIcon: /* @__PURE__ */ t(ht, { size: 16 }), onClick: p, children: "Configure" })
2117
+ ] }),
2118
+ X && /* @__PURE__ */ s(K, { display: "flex", alignItems: "center", justifyContent: "space-between", children: [
2119
+ /* @__PURE__ */ s(K, { display: "flex", alignItems: "center", gap: 1, children: [
2120
+ /* @__PURE__ */ t(Jt, { size: 14, style: {
2121
+ opacity: 0.6
2122
+ } }),
2123
+ /* @__PURE__ */ t(V, { variant: "body2", children: "Auto-Instrumentation" })
2124
+ ] }),
2125
+ /* @__PURE__ */ t(yt, { size: "small", checked: ee, disabled: d, onChange: (b, ke) => {
2126
+ Q(ke), J();
2127
+ } })
2128
+ ] }),
2129
+ X && ee && /* @__PURE__ */ s(K, { display: "flex", alignItems: "center", justifyContent: "space-between", children: [
2130
+ /* @__PURE__ */ s(K, { display: "flex", alignItems: "center", gap: 1, children: [
2131
+ /* @__PURE__ */ t(En, { size: 14, style: {
2132
+ opacity: 0.6
2133
+ } }),
2134
+ /* @__PURE__ */ t(V, { variant: "body2", children: "Instrumentation Version" })
2135
+ ] }),
2136
+ ue.length === 0 && Z ? /* @__PURE__ */ s(V, { variant: "caption", color: "text.secondary", children: [
2137
+ "None available for Python ",
2138
+ ae ?? "runtime"
2139
+ ] }) : /* @__PURE__ */ t(jt, { size: "small", value: xe ? H : "", disabled: d || !Z, onChange: (b) => {
2140
+ h(b.target.value), q(!0), J();
2141
+ }, sx: {
2142
+ minWidth: 200
2143
+ }, children: ue.map((b) => /* @__PURE__ */ t(Be, { value: b.version, children: b.traceloopSdk ? `${b.version} (OpenLLMetry v${b.traceloopSdk})` : b.version }, b.version)) })
2144
+ ] })
2145
+ ] }) })
2146
+ ] }) }),
2147
+ r && /* @__PURE__ */ t(lr, { open: o, onClose: g, resourceConfigs: j, orgName: i ?? "default", projName: l ?? "default", agentName: r, environment: e.name }),
2148
+ r && /* @__PURE__ */ t(Wt, { open: E, onClose: T, mode: "update", orgName: i ?? "", projName: l ?? "", agentName: r, environment: e.name, title: `Update ${e.displayName ?? e.name} Environment Configuration` }),
2149
+ r && /* @__PURE__ */ t(tr, { open: v, onClose: L, orgName: i ?? "", projName: l ?? "", agentName: r, environment: e.name }),
2150
+ r && i && l && /* @__PURE__ */ t(or, { open: y, onClose: P, sourceEnvironment: e, orgId: i, projectId: l, agentId: r }),
2151
+ k?.provisioning?.type === "internal" && /* @__PURE__ */ s(gt, { children: [
2152
+ /* @__PURE__ */ t(We, {}),
2153
+ /* @__PURE__ */ s(F, { direction: "row", justifyContent: "space-between", spacing: 1, alignItems: "center", children: [
2154
+ /* @__PURE__ */ t(pt, { title: "More actions", children: /* @__PURE__ */ t(Dt, { size: "small", onClick: (b) => N(b.currentTarget), children: /* @__PURE__ */ t(si, { size: 18 }) }) }),
2155
+ /* @__PURE__ */ s(F, { direction: "row", justifyContent: "right", spacing: 1, alignItems: "center", children: [
2156
+ /* @__PURE__ */ t(ne, { variant: "text", size: "small", startIcon: /* @__PURE__ */ t(ht, { size: 16 }), onClick: R, disabled: S?.status === ze.DEPLOYING, children: "Configure" }),
2157
+ /* @__PURE__ */ t(We, { orientation: "vertical", flexItem: !0 }),
2158
+ S?.status !== ze.SUSPENDED && /* @__PURE__ */ t(ne, { startIcon: /* @__PURE__ */ t(ci, { size: 16 }), variant: "text", size: "small", onClick: Ne, disabled: G || S?.status !== ze.ACTIVE, children: "Suspend" }),
2159
+ S?.status === ze.SUSPENDED && /* @__PURE__ */ t(ne, { startIcon: G ? /* @__PURE__ */ t(tt, { size: 14 }) : /* @__PURE__ */ t(di, { size: 16 }), variant: "text", color: "success", size: "small", onClick: we, disabled: G, children: "Re-deploy" }),
2160
+ f && /* @__PURE__ */ s(gt, { children: [
2161
+ /* @__PURE__ */ t(We, { orientation: "vertical", flexItem: !0 }),
2162
+ /* @__PURE__ */ t(ne, { variant: "contained", size: "small", startIcon: /* @__PURE__ */ t(Pn, { size: 16 }), onClick: u, disabled: !M, children: "Promote" })
2163
+ ] })
2164
+ ] }),
2165
+ /* @__PURE__ */ s(Un, { anchorEl: D, open: !!D, onClose: () => N(null), anchorOrigin: {
2166
+ vertical: "top",
2167
+ horizontal: "right"
2168
+ }, transformOrigin: {
2169
+ vertical: "bottom",
2170
+ horizontal: "right"
2171
+ }, children: [
2172
+ /* @__PURE__ */ s(Be, { component: Ye, to: Ze(Xe.children.org.children.projects.children.agents.children.environment.children.tryOut.path, {
2173
+ orgId: i,
2174
+ projectId: l,
2175
+ agentId: r,
2176
+ envId: e?.name
2177
+ }), onClick: () => N(null), children: [
2178
+ /* @__PURE__ */ t(mi, { size: 16, style: {
2179
+ marginRight: 8
2180
+ } }),
2181
+ "Test Agent"
2182
+ ] }),
2183
+ /* @__PURE__ */ s(Be, { component: Ye, to: Ze(Xe.children.org.children.projects.children.agents.children.environment.children.observability.children.traces.path, {
2184
+ orgId: i,
2185
+ projectId: l,
2186
+ agentId: r,
2187
+ envId: e?.name
2188
+ }), onClick: () => N(null), children: [
2189
+ /* @__PURE__ */ t(Jt, { size: 16, style: {
2190
+ marginRight: 8
2191
+ } }),
2192
+ "View Traces"
2193
+ ] }),
2194
+ /* @__PURE__ */ s(Be, { component: Ye, to: Ze(Xe.children.org.children.projects.children.agents.children.environment.children.observability.children.logs.path, {
2195
+ orgId: i,
2196
+ projectId: l,
2197
+ agentId: r,
2198
+ envId: e?.name
2199
+ }), onClick: () => N(null), children: [
2200
+ /* @__PURE__ */ t(ui, { size: 16, style: {
2201
+ marginRight: 8
2202
+ } }),
2203
+ "View Logs"
2204
+ ] }),
2205
+ /* @__PURE__ */ s(Be, { component: Ye, to: Ze(Xe.children.org.children.projects.children.agents.children.environment.children.observability.children.metrics.path, {
2206
+ orgId: i,
2207
+ projectId: l,
2208
+ agentId: r,
2209
+ envId: e?.name
2210
+ }), onClick: () => N(null), children: [
2211
+ /* @__PURE__ */ t(hi, { size: 16, style: {
2212
+ marginRight: 8
2213
+ } }),
2214
+ "View Metrics"
2215
+ ] }),
2216
+ /* @__PURE__ */ s(Be, { component: Ye, to: Ze(Xe.children.org.children.projects.children.agents.children.environment.children.security.path, {
2217
+ orgId: i,
2218
+ projectId: l,
2219
+ agentId: r,
2220
+ envId: e?.name
2221
+ }), onClick: () => N(null), children: [
2222
+ /* @__PURE__ */ t(Qt, { size: 16, style: {
2223
+ marginRight: 8
2224
+ } }),
2225
+ "Manage Credentials"
2226
+ ] })
2227
+ ] })
2228
+ ] })
2229
+ ] })
2230
+ ] }) }) });
2231
+ }
2232
+ const on = () => {
2233
+ const n = $e(23), {
2234
+ orgId: e,
2235
+ projectId: i
2236
+ } = $t();
2237
+ let r;
2238
+ n[0] !== e ? (r = {
2239
+ orgName: e
2240
+ }, n[0] = e, n[1] = r) : r = n[1];
2241
+ const {
2242
+ data: l
2243
+ } = Rn(r);
2244
+ let c;
2245
+ n[2] !== e || n[3] !== i ? (c = {
2246
+ orgName: e,
2247
+ projName: i
2248
+ }, n[2] = e, n[3] = i, n[4] = c) : c = n[4];
2249
+ const {
2250
+ data: a
2251
+ } = ei(c);
2252
+ let o;
2253
+ n[5] !== e ? (o = {
2254
+ orgName: e
2255
+ }, n[5] = e, n[6] = o) : o = n[6];
2256
+ const {
2257
+ data: y
2258
+ } = ti(o);
2259
+ a?.deploymentPipeline;
2260
+ let m;
2261
+ e: {
2262
+ if (!l) {
2263
+ let v;
2264
+ n[7] === Symbol.for("react.memo_cache_sentinel") ? (v = [], n[7] = v) : v = n[7], m = v;
2265
+ break e;
2266
+ }
2267
+ let R;
2268
+ if (n[8] !== l || n[9] !== y?.deploymentPipelines || n[10] !== a?.deploymentPipeline) {
2269
+ const v = y?.deploymentPipelines?.find((f) => f.name === a?.deploymentPipeline)?.promotionPaths ?? [];
2270
+ if (!v.length) {
2271
+ m = l;
2272
+ break e;
2273
+ }
2274
+ const p = new Set(v.flatMap(ur)), L = new Map(v.map(pr)), _ = [...new Set(v.map(fr))].filter((f) => !p.has(f));
2275
+ R = [];
2276
+ const A = /* @__PURE__ */ new Set();
2277
+ let w = _[0];
2278
+ for (; w && !A.has(w); )
2279
+ R.push(w), A.add(w), w = (L.get(w) ?? [])[0];
2280
+ p.forEach((f) => {
2281
+ A.has(f) || R.push(f);
2282
+ }), n[8] = l, n[9] = y?.deploymentPipelines, n[10] = a?.deploymentPipeline, n[11] = R, n[12] = m;
2283
+ } else
2284
+ R = n[11], m = n[12];
2285
+ let T;
2286
+ n[13] !== R || n[14] !== l ? (T = R.map((v) => l.find((p) => p.name === v)).filter(Boolean), n[13] = R, n[14] = l, n[15] = T) : T = n[15], m = T;
2287
+ }
2288
+ const g = m;
2289
+ let u;
2290
+ n[16] !== g[0] ? (u = /* @__PURE__ */ t(Xi, { initialEnvironment: g[0] }), n[16] = g[0], n[17] = u) : u = n[17];
2291
+ let P;
2292
+ n[18] !== g ? (P = g.map(yr), n[18] = g, n[19] = P) : P = n[19];
2293
+ let E;
2294
+ return n[20] !== u || n[21] !== P ? (E = /* @__PURE__ */ t(ni, { title: "Deploy", disableIcon: !0, children: /* @__PURE__ */ s(F, { direction: "row", pb: 4, width: "100%", overflow: "auto", children: [
2295
+ u,
2296
+ P
2297
+ ] }) }), n[20] = u, n[21] = P, n[22] = E) : E = n[22], E;
2298
+ };
2299
+ function mr(n) {
2300
+ return n.name;
2301
+ }
2302
+ function ur(n) {
2303
+ return n.targetEnvironmentRefs.map(mr);
2304
+ }
2305
+ function hr(n) {
2306
+ return n.name;
2307
+ }
2308
+ function pr(n) {
2309
+ return [n.sourceEnvironmentRef, n.targetEnvironmentRefs.map(hr)];
2310
+ }
2311
+ function fr(n) {
2312
+ return n.sourceEnvironmentRef;
2313
+ }
2314
+ function gr(n) {
2315
+ return {
2316
+ width: n.spacing(4),
2317
+ height: n.spacing(0.5),
2318
+ minWidth: n.spacing(4),
2319
+ mt: n.spacing(14),
2320
+ bgcolor: "divider"
2321
+ };
2322
+ }
2323
+ function yr(n) {
2324
+ return /* @__PURE__ */ s(Tn, { children: [
2325
+ /* @__PURE__ */ t(K, { sx: gr }),
2326
+ /* @__PURE__ */ t(dr, { currentEnvironment: n })
2327
+ ] }, n.name);
2328
+ }
2329
+ const Ar = {
2330
+ title: "Deploy",
2331
+ description: "A page component for Deploy",
2332
+ icon: ft,
2333
+ path: "/deploy",
2334
+ component: on,
2335
+ levels: {
2336
+ component: on
2337
+ }
2338
+ };
2339
+ export {
2340
+ on as DeployComponent,
2341
+ Ar as metaData
2342
+ };