@wso2/am-core-ui 0.0.18 → 0.0.20

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