@wso2/am-core-ui 0.0.17 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/APIKeysManager-C0phJriD.js +241 -0
  2. package/dist/CatalogKindListing-DtFI2YMG.js +118 -0
  3. package/dist/CodeBlock-mB_Loq7I.js +21736 -0
  4. package/dist/EnvironmentCard-09h1XRxx.js +310 -0
  5. package/dist/EnvironmentSelector-B7Bl93s2.js +48 -0
  6. package/dist/MCPLogo-D9IJzzl7.js +30 -0
  7. package/dist/PolicyListSection-o4k9e8XO.js +2475 -0
  8. package/dist/ResourceListShell-Cx6mdeqv.js +463 -0
  9. package/dist/SwaggerSpecViewer-BvkhoKsi.js +106 -0
  10. package/dist/clipboard-YAzStmkw.js +23 -0
  11. package/dist/debounce-BV83M53b.js +208 -0
  12. package/dist/format-BEZZRyE2.js +29 -0
  13. package/dist/formatDistanceToNow-TErllcH8.js +100 -0
  14. package/dist/gatewayScripts-D8O45W8u.js +72 -0
  15. package/dist/highlight-BsUzxSR3.js +454 -0
  16. package/dist/index-B52h3RHg.js +1290 -0
  17. package/dist/index-BP5drcF2.js +1265 -0
  18. package/dist/index-BZ4vxviI.js +7981 -0
  19. package/dist/index-B_Z0MwXk.js +25012 -0
  20. package/dist/index-BfjzUWDa.js +1397 -0
  21. package/dist/{index-CDm_burV.js → index-BnV-PkwM.js} +22 -20
  22. package/dist/index-CGDYgUCH.js +711 -0
  23. package/dist/index-COt7nJIf.js +2286 -0
  24. package/dist/index-CWZjOy1h.js +2247 -0
  25. package/dist/index-CezvogTQ.js +116 -0
  26. package/dist/index-CgCWbWzN.js +2342 -0
  27. package/dist/index-CjCkcuuI.js +322 -0
  28. package/dist/index-CjXvuf9m.js +1354 -0
  29. package/dist/index-DD4qF7gq.js +2340 -0
  30. package/dist/index-DeQ-9KTC.js +737 -0
  31. package/dist/index-Df6OBy4E.js +3041 -0
  32. package/dist/index-KRsV2L4V.js +1564 -0
  33. package/dist/index-PUuASE1F.js +2507 -0
  34. package/dist/index-PWsNvJB-.js +546 -0
  35. package/dist/index-UqDmyMSA.js +119 -0
  36. package/dist/index-_0Pj_ZtW.js +459 -0
  37. package/dist/{index-DJABKRWO.js → index-sr-mWz4T.js} +31 -30
  38. package/dist/index.d.ts +496 -200
  39. package/dist/index.js +462 -439
  40. package/dist/llmProviderPayload-CzihkdNa.js +332 -0
  41. package/dist/schemas-DFScWdSL.js +2969 -0
  42. package/package.json +1 -1
  43. package/dist/index-B0d-vovv.js +0 -236
  44. package/dist/index-CCmLfbLS.js +0 -80707
  45. package/dist/index-qanXZe0s.js +0 -3037
@@ -0,0 +1,1354 @@
1
+ import { Plus as re, AlertTriangle as fe, GitBranch as We, Search as Ge, Edit as ye, Trash as pe, ArrowRight as He, PlusCircle as un, Server as Ue, EyeOff as Ve, Eye as je, Copy as ve, DoorClosedLocked as gn, KeyRound as Ee, ServerCrash as fn } from "@wso2/oxygen-ui-icons-react";
2
+ import { jsxs as i, jsx as e, Fragment as te } from "react/jsx-runtime";
3
+ import { c as ae } from "react/compiler-runtime";
4
+ import { useState as D, useMemo as F, useEffect as U, useCallback as _ } from "react";
5
+ import { useParams as oe, useSearchParams as yn, Route as ie, Routes as qe, Navigate as Ke, useNavigate as Xe, generatePath as he } from "react-router-dom";
6
+ import { y as Ye, z as Ce, G as vn, c5 as Cn, I as Je, r as be, c6 as bn, n as le, D as se, m as ce, c7 as Pn, P as we, H as Qe, g as me, c8 as wn, bv as Ze, c9 as xn, q as Se, ar as Nn, ca as En, p as Sn, cb as Tn, cc as Te } from "./index-B_Z0MwXk.js";
7
+ import "@tanstack/react-query";
8
+ import { Stack as b, Box as L, SearchBar as en, Button as B, ListingTable as h, Alert as $, Skeleton as R, Avatar as ue, Typography as k, Tooltip as M, IconButton as W, TablePagination as nn, Chip as ne, Form as O, Menu as kn, MenuItem as Pe, FormControl as V, FormLabel as j, TextField as X, Collapse as Dn, FormControlLabel as tn, Checkbox as rn, Select as zn, Grid as K, Card as an, CardContent as on } from "@wso2/oxygen-ui";
9
+ import { f as xe } from "./formatDistanceToNow-TErllcH8.js";
10
+ import { o as Ne, c as Rn, s as H, b as ln } from "./schemas-DFScWdSL.js";
11
+ import { a as In, g as ge, G as An } from "./gatewayScripts-D8O45W8u.js";
12
+ import { g as _n } from "./format-BEZZRyE2.js";
13
+ import { c as Fn } from "./clipboard-YAzStmkw.js";
14
+ function sn(n) {
15
+ if (n.length === 0)
16
+ return {
17
+ valid: !1,
18
+ error: "Pipeline has no promotion paths defined"
19
+ };
20
+ const t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
21
+ for (const u of n) {
22
+ const c = u.targetEnvironmentRefs.map((m) => m.name).filter(Boolean);
23
+ c.length !== 0 && (t.set(u.sourceEnvironmentRef, c), c.forEach((m) => r.add(m)));
24
+ }
25
+ if (t.size === 0)
26
+ return {
27
+ valid: !0,
28
+ chain: n.map((u) => u.sourceEnvironmentRef).filter(Boolean)
29
+ };
30
+ const o = new Set(t.keys()), a = [...o].filter((u) => !r.has(u));
31
+ if (a.length === 0)
32
+ return {
33
+ valid: !1,
34
+ error: "Promotion paths contain a cycle — no starting environment found"
35
+ };
36
+ if (a.length > 1)
37
+ return {
38
+ valid: !1,
39
+ error: `Promotion paths are disconnected — ${a.length} separate starting environments (${a.join(", ")})`
40
+ };
41
+ const s = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set();
42
+ function p(u) {
43
+ s.add(u), l.add(u);
44
+ for (const c of t.get(u) ?? [])
45
+ if (s.has(c)) {
46
+ if (l.has(c))
47
+ return !0;
48
+ } else if (p(c)) return !0;
49
+ return l.delete(u), !1;
50
+ }
51
+ if (p(a[0]))
52
+ return {
53
+ valid: !1,
54
+ error: "Promotion paths contain a cycle"
55
+ };
56
+ const y = [...o].filter((u) => !s.has(u));
57
+ if (y.length > 0)
58
+ return {
59
+ valid: !1,
60
+ error: `Promotion paths are disconnected — environments not reachable from root: ${y.join(", ")}`
61
+ };
62
+ const f = [];
63
+ let v = a[0];
64
+ for (; v; )
65
+ f.push(v), v = (t.get(v) ?? [])[0];
66
+ return {
67
+ valid: !0,
68
+ chain: f
69
+ };
70
+ }
71
+ function Ln({
72
+ pipeline: n,
73
+ envMap: t
74
+ }) {
75
+ const r = F(() => sn(n.promotionPaths), [n.promotionPaths]);
76
+ if (!r.valid)
77
+ return /* @__PURE__ */ e(M, { title: r.error, children: /* @__PURE__ */ i(b, { direction: "row", spacing: 0.5, alignItems: "center", sx: {
78
+ cursor: "default"
79
+ }, children: [
80
+ /* @__PURE__ */ e(fe, { size: 14, color: "var(--oxygen-palette-warning-main)" }),
81
+ /* @__PURE__ */ e(k, { variant: "body2", color: "warning.main", children: "Invalid paths" })
82
+ ] }) });
83
+ const o = r.chain ?? [];
84
+ return /* @__PURE__ */ e(b, { direction: "row", spacing: 0.5, alignItems: "center", flexWrap: "wrap", children: o.map((a, s) => {
85
+ const l = t.get(a);
86
+ return /* @__PURE__ */ i(b, { direction: "row", spacing: 0.5, alignItems: "center", children: [
87
+ /* @__PURE__ */ e(ne, { label: /* @__PURE__ */ i(k, { component: "span", children: [
88
+ /* @__PURE__ */ e(k, { variant: "body2", component: "span", children: l?.displayName ?? a }),
89
+ l?.isProduction && /* @__PURE__ */ e(k, { component: "span", variant: "caption", children: " (Production)" })
90
+ ] }), variant: "outlined" }),
91
+ s < o.length - 1 && /* @__PURE__ */ e(He, { size: 12 })
92
+ ] }, a);
93
+ }) });
94
+ }
95
+ function Mn({
96
+ onEditPipeline: n,
97
+ onCreatePipeline: t
98
+ }) {
99
+ const {
100
+ orgId: r
101
+ } = oe(), [o, a] = D(""), [s, l] = D(0), [p, y] = D(5), [f, v] = D(null), {
102
+ data: u,
103
+ isLoading: c,
104
+ error: m
105
+ } = Ye({
106
+ orgName: r
107
+ }), {
108
+ data: P
109
+ } = Ce({
110
+ orgName: r
111
+ }), {
112
+ addConfirmation: w
113
+ } = vn(), {
114
+ mutate: x
115
+ } = Cn(), S = F(() => {
116
+ const g = /* @__PURE__ */ new Map();
117
+ return (P ?? []).forEach((d) => {
118
+ g.set(d.name, {
119
+ displayName: d.displayName,
120
+ isProduction: d.isProduction
121
+ });
122
+ }), g;
123
+ }, [P]), N = F(() => u?.deploymentPipelines ?? [], [u?.deploymentPipelines]), E = F(() => {
124
+ const g = o.toLowerCase();
125
+ return g ? N.filter((d) => d.name.toLowerCase().includes(g) || d.displayName.toLowerCase().includes(g)) : N;
126
+ }, [N, o]);
127
+ U(() => {
128
+ s !== 0 && s * p >= E.length && l(0);
129
+ }, [E.length, s, p]);
130
+ const T = /* @__PURE__ */ i(b, { direction: "row", spacing: 1, alignItems: "center", children: [
131
+ /* @__PURE__ */ e(L, { flexGrow: 1, children: /* @__PURE__ */ e(en, { value: o, onChange: (g) => {
132
+ a(g.target.value), l(0);
133
+ }, placeholder: "Search pipelines...", size: "small", fullWidth: !0, disabled: c }) }),
134
+ t && N.length > 0 && /* @__PURE__ */ e(B, { variant: "contained", startIcon: /* @__PURE__ */ e(re, { size: 16 }), onClick: t, children: "Create Pipeline" })
135
+ ] });
136
+ if (m)
137
+ return /* @__PURE__ */ i(b, { spacing: 1, children: [
138
+ T,
139
+ /* @__PURE__ */ e(h.Container, { children: /* @__PURE__ */ i($, { severity: "error", icon: /* @__PURE__ */ e(fe, { size: 18 }), sx: {
140
+ alignSelf: "stretch"
141
+ }, children: [
142
+ "Failed to load pipelines.",
143
+ " ",
144
+ m instanceof Error ? m.message : "Please try again."
145
+ ] }) })
146
+ ] });
147
+ if (c)
148
+ return /* @__PURE__ */ i(te, { children: [
149
+ T,
150
+ /* @__PURE__ */ e(h.Container, { disablePaper: !0, children: /* @__PURE__ */ e(b, { spacing: 1, mt: 1, children: Array.from({
151
+ length: p
152
+ }).map((g, d) => /* @__PURE__ */ i(b, { direction: "row", alignItems: "center", spacing: 2, sx: {
153
+ px: 2,
154
+ py: 1.5,
155
+ borderRadius: 1,
156
+ border: "1px solid",
157
+ borderColor: "divider",
158
+ bgcolor: "background.paper"
159
+ }, children: [
160
+ /* @__PURE__ */ i(b, { direction: "row", alignItems: "center", spacing: 1.5, sx: {
161
+ width: 280,
162
+ flexShrink: 0
163
+ }, children: [
164
+ /* @__PURE__ */ e(R, { variant: "circular", width: 36, height: 36 }),
165
+ /* @__PURE__ */ e(R, { variant: "text", width: 140, height: 20 })
166
+ ] }),
167
+ /* @__PURE__ */ i(b, { direction: "row", spacing: 0.5, sx: {
168
+ flex: 1
169
+ }, children: [
170
+ /* @__PURE__ */ e(R, { variant: "rounded", width: 72, height: 24 }),
171
+ /* @__PURE__ */ e(R, { variant: "rounded", width: 72, height: 24 })
172
+ ] }),
173
+ /* @__PURE__ */ e(R, { variant: "rounded", width: 100, height: 24, sx: {
174
+ flexShrink: 0,
175
+ ml: "auto"
176
+ } })
177
+ ] }, d)) }) })
178
+ ] });
179
+ if (N.length === 0)
180
+ return /* @__PURE__ */ i(b, { spacing: 1, children: [
181
+ T,
182
+ /* @__PURE__ */ e(h.Container, { children: /* @__PURE__ */ e(h.EmptyState, { illustration: /* @__PURE__ */ e(We, { size: 64 }), title: "No deployment pipelines yet", description: "Deployment pipelines define the promotion path for your agents across environments.", action: t && /* @__PURE__ */ e(B, { variant: "contained", startIcon: /* @__PURE__ */ e(re, { size: 16 }), onClick: t, children: "Create Pipeline" }) }) })
183
+ ] });
184
+ if (E.length === 0)
185
+ return /* @__PURE__ */ i(b, { spacing: 1, children: [
186
+ T,
187
+ /* @__PURE__ */ e(h.Container, { children: /* @__PURE__ */ e(h.EmptyState, { illustration: /* @__PURE__ */ e(Ge, { size: 64 }), title: "No pipelines match your search", description: "Try a different keyword or clear the search filter." }) })
188
+ ] });
189
+ const C = E.slice(s * p, s * p + p);
190
+ return /* @__PURE__ */ i(te, { children: [
191
+ T,
192
+ /* @__PURE__ */ e(b, { pt: 4, children: /* @__PURE__ */ i(h.Container, { disablePaper: !0, children: [
193
+ /* @__PURE__ */ i(h, { variant: "card", children: [
194
+ /* @__PURE__ */ e(h.Head, { children: /* @__PURE__ */ i(h.Row, { children: [
195
+ /* @__PURE__ */ e(h.Cell, { width: "280px", children: "Pipeline" }),
196
+ /* @__PURE__ */ e(h.Cell, { children: "Promotion Chain" }),
197
+ /* @__PURE__ */ e(h.Cell, { align: "right", width: "160px", children: "Created" })
198
+ ] }) }),
199
+ /* @__PURE__ */ e(h.Body, { children: C.map((g) => /* @__PURE__ */ i(h.Row, { variant: "card", hover: !0, onMouseEnter: () => v(g.name), onMouseLeave: () => v(null), onFocus: () => v(g.name), onBlur: () => v(null), children: [
200
+ /* @__PURE__ */ e(h.Cell, { children: /* @__PURE__ */ i(b, { direction: "row", alignItems: "center", spacing: 2, children: [
201
+ /* @__PURE__ */ e(ue, { sx: {
202
+ bgcolor: "primary.main",
203
+ color: "primary.contrastText",
204
+ fontSize: 16,
205
+ height: 36,
206
+ width: 36,
207
+ flexShrink: 0
208
+ }, children: g.displayName?.charAt(0)?.toUpperCase() ?? "P" }),
209
+ /* @__PURE__ */ e(k, { variant: "body2", fontWeight: 500, noWrap: !0, children: g.displayName })
210
+ ] }) }),
211
+ /* @__PURE__ */ e(h.Cell, { children: /* @__PURE__ */ e(Ln, { pipeline: g, envMap: S }) }),
212
+ /* @__PURE__ */ e(h.Cell, { align: "right", onClick: (d) => d.stopPropagation(), children: /* @__PURE__ */ e(b, { direction: "row", justifyContent: "flex-end", alignItems: "center", spacing: 1, children: f === g.name ? /* @__PURE__ */ e(Je, { children: /* @__PURE__ */ i(b, { direction: "row", spacing: 0.5, children: [
213
+ /* @__PURE__ */ e(M, { title: "Edit pipeline", children: /* @__PURE__ */ e(W, { size: "small", onClick: () => n?.(g), children: /* @__PURE__ */ e(ye, { size: 16 }) }) }),
214
+ /* @__PURE__ */ e(M, { title: "Delete pipeline", children: /* @__PURE__ */ e(W, { size: "small", color: "error", onClick: () => w({
215
+ title: "Delete Deployment Pipeline",
216
+ description: `Are you sure you want to delete "${g.displayName}"? This action cannot be undone.`,
217
+ confirmButtonText: "Delete",
218
+ confirmButtonColor: "error",
219
+ confirmButtonIcon: /* @__PURE__ */ e(pe, { size: 16 }),
220
+ onConfirm: () => x({
221
+ orgName: r,
222
+ pipelineName: g.name
223
+ })
224
+ }), children: /* @__PURE__ */ e(pe, { size: 16 }) }) })
225
+ ] }) }) : /* @__PURE__ */ e(k, { variant: "caption", color: "text.secondary", children: xe(new Date(g.createdAt), {
226
+ addSuffix: !0
227
+ }) }) }) })
228
+ ] }, g.name)) })
229
+ ] }),
230
+ E.length > 5 && /* @__PURE__ */ e(nn, { component: "div", count: E.length, page: s, rowsPerPage: p, onPageChange: (g, d) => l(d), onRowsPerPageChange: (g) => {
231
+ y(parseInt(g.target.value, 10)), l(0);
232
+ }, rowsPerPageOptions: [5, 10, 25] })
233
+ ] }) })
234
+ ] });
235
+ }
236
+ const cn = Ne({
237
+ displayName: H().min(1, "Display name is required").max(128, "Display name must be 128 characters or less"),
238
+ description: H().optional(),
239
+ chain: Rn(H().min(1, "Select an environment")).min(1, "Select at least one environment")
240
+ }), ke = cn, De = cn;
241
+ function dn(n) {
242
+ return n.length === 1 && n[0] ? [{
243
+ sourceEnvironmentRef: n[0],
244
+ targetEnvironmentRefs: []
245
+ }] : n.slice(0, -1).map((t, r) => ({
246
+ sourceEnvironmentRef: t,
247
+ targetEnvironmentRefs: [{
248
+ name: n[r + 1]
249
+ }]
250
+ }));
251
+ }
252
+ function Bn(n, t, r) {
253
+ return n.filter((o) => r === "add" ? !t.includes(o.name) : !t.some((a, s) => s !== r && a === o.name));
254
+ }
255
+ function hn({
256
+ chain: n,
257
+ envOptions: t,
258
+ onChange: r,
259
+ disabled: o
260
+ }) {
261
+ const [a, s] = D(null), l = _((c, m) => {
262
+ s({
263
+ el: c.currentTarget,
264
+ index: m
265
+ });
266
+ }, []), p = _((c) => {
267
+ if (a !== null) {
268
+ if (a.index === "add")
269
+ r([...n, c]);
270
+ else {
271
+ const m = [...n];
272
+ m[a.index] = c, r(m);
273
+ }
274
+ s(null);
275
+ }
276
+ }, [a, n, r]), y = _((c) => {
277
+ r(n.filter((m, P) => P !== c));
278
+ }, [n, r]), f = F(() => a ? Bn(t, n, a.index) : [], [a, t, n]);
279
+ U(() => {
280
+ n.length === 0 && t.length > 0 && r([t[0].name]);
281
+ }, [t, n.length, r]);
282
+ const v = n.length > 1, u = n.length < t.length;
283
+ return /* @__PURE__ */ i(O.Section, { children: [
284
+ /* @__PURE__ */ e(O.Header, { children: "Promotion Chain" }),
285
+ /* @__PURE__ */ e(L, { sx: {
286
+ overflowX: "auto",
287
+ pb: 1,
288
+ mt: 1.5
289
+ }, children: /* @__PURE__ */ i(b, { direction: "row", alignItems: "center", sx: {
290
+ minWidth: "max-content"
291
+ }, spacing: 0.5, children: [
292
+ n.map((c, m) => {
293
+ const P = t.find((w) => w.name === c);
294
+ return /* @__PURE__ */ i(b, { direction: "row", alignItems: "center", spacing: 0.5, children: [
295
+ /* @__PURE__ */ e(ne, { label: /* @__PURE__ */ i(k, { children: [
296
+ /* @__PURE__ */ e(k, { variant: "body2", component: "span", children: P?.displayName ?? c }),
297
+ /* @__PURE__ */ e(k, { component: "span", variant: "caption", children: P?.isProduction ? " (Production)" : "" })
298
+ ] }), variant: "outlined", onClick: (w) => l(w, m), onDelete: v ? () => y(m) : void 0, disabled: o }),
299
+ m < n.length - 1 && /* @__PURE__ */ e(He, { size: 14 })
300
+ ] }, m);
301
+ }),
302
+ u && /* @__PURE__ */ e(M, { title: "Add environment", children: /* @__PURE__ */ e(W, { size: "medium", onClick: (c) => l(c, "add"), disabled: o, children: /* @__PURE__ */ e(un, { size: 18 }) }) })
303
+ ] }) }),
304
+ /* @__PURE__ */ e(kn, { anchorEl: a?.el, open: !!a, onClose: () => s(null), children: f.length === 0 ? /* @__PURE__ */ e(Pe, { disabled: !0, children: "No environments available" }) : f.map((c) => /* @__PURE__ */ i(Pe, { onClick: () => p(c.name), children: [
305
+ c.displayName ?? c.name,
306
+ " ",
307
+ c.isProduction ? "(Production)" : ""
308
+ ] }, c.name)) })
309
+ ] });
310
+ }
311
+ function ze(n) {
312
+ if (n.promotionPaths.length === 0) return [""];
313
+ const t = sn(n.promotionPaths);
314
+ if (t.valid && t.chain && t.chain.length >= 1)
315
+ return t.chain;
316
+ const r = n.promotionPaths.map((a) => a.sourceEnvironmentRef), o = n.promotionPaths[n.promotionPaths.length - 1]?.targetEnvironmentRefs[0]?.name ?? "";
317
+ return [...r, o];
318
+ }
319
+ function On({
320
+ open: n,
321
+ onClose: t,
322
+ pipeline: r,
323
+ orgId: o
324
+ }) {
325
+ const [a, s] = D(() => ({
326
+ displayName: r.displayName,
327
+ description: r.description ?? "",
328
+ chain: ze(r)
329
+ })), [l, p] = D(null), {
330
+ errors: y,
331
+ validateForm: f,
332
+ setFieldError: v,
333
+ validateField: u
334
+ } = be(De), {
335
+ mutateAsync: c,
336
+ isPending: m,
337
+ error: P,
338
+ reset: w
339
+ } = bn(), {
340
+ data: x
341
+ } = Ce({
342
+ orgName: o
343
+ }), S = F(() => x ?? [], [x]);
344
+ U(() => {
345
+ n && (s({
346
+ displayName: r.displayName,
347
+ description: r.description ?? "",
348
+ chain: ze(r)
349
+ }), p(null), w());
350
+ }, [n, r, w]);
351
+ const N = _((g, d) => {
352
+ s((z) => {
353
+ const I = {
354
+ ...z,
355
+ [g]: d
356
+ };
357
+ return v(g, u(g, I[g], I)), I;
358
+ });
359
+ }, [v, u]), E = _(async (g) => {
360
+ g.preventDefault(), p(null);
361
+ const d = De.safeParse(a);
362
+ if (!d.success) {
363
+ f(a);
364
+ return;
365
+ }
366
+ try {
367
+ await c({
368
+ params: {
369
+ orgName: o,
370
+ pipelineName: r.name
371
+ },
372
+ body: {
373
+ displayName: d.data.displayName.trim(),
374
+ description: d.data.description?.trim(),
375
+ promotionPaths: dn(d.data.chain)
376
+ }
377
+ }), t();
378
+ } catch {
379
+ }
380
+ }, [a, f, c, o, r.name, t]), T = F(() => l || (P ? P?.message ?? "Failed to update pipeline" : null), [l, P]), C = a.chain.every((g) => g !== "");
381
+ return /* @__PURE__ */ i(le, { open: n, onClose: t, children: [
382
+ /* @__PURE__ */ e(se, { icon: /* @__PURE__ */ e(ye, { size: 24 }), title: "Edit Deployment Pipeline", onClose: t }),
383
+ /* @__PURE__ */ e(ce, { children: /* @__PURE__ */ e("form", { onSubmit: E, children: /* @__PURE__ */ i(b, { spacing: 3, children: [
384
+ T && /* @__PURE__ */ e($, { severity: "error", children: /* @__PURE__ */ e(k, { variant: "body2", children: T }) }),
385
+ /* @__PURE__ */ i(O.Section, { children: [
386
+ /* @__PURE__ */ e(O.Header, { children: "Pipeline Details" }),
387
+ /* @__PURE__ */ i(O.Stack, { spacing: 2, children: [
388
+ /* @__PURE__ */ i(V, { fullWidth: !0, error: !!y.displayName, children: [
389
+ /* @__PURE__ */ e(j, { required: !0, children: "Display Name" }),
390
+ /* @__PURE__ */ e(X, { fullWidth: !0, size: "small", value: a.displayName, onChange: (g) => N("displayName", g.target.value), placeholder: "e.g., Production Pipeline", error: !!y.displayName, helperText: y.displayName, disabled: m })
391
+ ] }),
392
+ /* @__PURE__ */ i(V, { fullWidth: !0, children: [
393
+ /* @__PURE__ */ e(j, { children: "Description" }),
394
+ /* @__PURE__ */ e(X, { fullWidth: !0, size: "small", multiline: !0, rows: 2, value: a.description ?? "", onChange: (g) => N("description", g.target.value), placeholder: "Optional description", disabled: m })
395
+ ] })
396
+ ] })
397
+ ] }),
398
+ /* @__PURE__ */ e(hn, { chain: a.chain, envOptions: S, onChange: (g) => s((d) => ({
399
+ ...d,
400
+ chain: g
401
+ })), disabled: m }),
402
+ /* @__PURE__ */ i(L, { display: "flex", justifyContent: "flex-end", gap: 1, mt: 2, children: [
403
+ /* @__PURE__ */ e(B, { variant: "outlined", color: "inherit", onClick: t, disabled: m, children: "Cancel" }),
404
+ /* @__PURE__ */ e(B, { type: "submit", variant: "contained", color: "primary", disabled: m || !C, children: m ? "Saving..." : "Save" })
405
+ ] })
406
+ ] }) }) })
407
+ ] });
408
+ }
409
+ const Re = {
410
+ displayName: "",
411
+ description: "",
412
+ chain: []
413
+ };
414
+ function $n({
415
+ open: n,
416
+ onClose: t,
417
+ orgId: r
418
+ }) {
419
+ const [o, a] = D(Re), {
420
+ errors: s,
421
+ validateForm: l,
422
+ setFieldError: p,
423
+ validateField: y
424
+ } = be(ke), {
425
+ mutateAsync: f,
426
+ isPending: v,
427
+ error: u,
428
+ reset: c
429
+ } = Pn(), {
430
+ data: m
431
+ } = Ce({
432
+ orgName: r
433
+ }), P = F(() => m ?? [], [m]);
434
+ U(() => {
435
+ n && (a(Re), c());
436
+ }, [n, c]);
437
+ const w = _((N, E) => {
438
+ a((T) => {
439
+ const C = {
440
+ ...T,
441
+ [N]: E
442
+ };
443
+ return p(N, y(N, E, C)), C;
444
+ });
445
+ }, [p, y]), x = _(async (N) => {
446
+ N.preventDefault();
447
+ const E = ke.safeParse(o);
448
+ if (!E.success) {
449
+ l(o);
450
+ return;
451
+ }
452
+ try {
453
+ await f({
454
+ params: {
455
+ orgName: r
456
+ },
457
+ body: {
458
+ displayName: E.data.displayName.trim(),
459
+ description: E.data.description?.trim(),
460
+ promotionPaths: dn(E.data.chain)
461
+ }
462
+ }), t();
463
+ } catch {
464
+ }
465
+ }, [o, l, f, r, t]), S = F(() => u ? u?.message ?? "Failed to create pipeline" : null, [u]);
466
+ return /* @__PURE__ */ i(le, { open: n, onClose: t, children: [
467
+ /* @__PURE__ */ e(se, { icon: /* @__PURE__ */ e(We, { size: 24 }), title: "Create Deployment Pipeline", onClose: t }),
468
+ /* @__PURE__ */ e(ce, { children: /* @__PURE__ */ e("form", { onSubmit: x, children: /* @__PURE__ */ i(b, { spacing: 3, children: [
469
+ S && /* @__PURE__ */ e($, { severity: "error", children: /* @__PURE__ */ e(k, { variant: "body2", children: S }) }),
470
+ /* @__PURE__ */ i(O.Section, { children: [
471
+ /* @__PURE__ */ e(O.Header, { children: "Pipeline Details" }),
472
+ /* @__PURE__ */ i(O.Stack, { spacing: 2, children: [
473
+ /* @__PURE__ */ i(V, { fullWidth: !0, error: !!s.displayName, children: [
474
+ /* @__PURE__ */ e(j, { required: !0, children: "Display Name" }),
475
+ /* @__PURE__ */ e(X, { fullWidth: !0, size: "small", value: o.displayName, onChange: (N) => w("displayName", N.target.value), placeholder: "e.g., Production Pipeline", error: !!s.displayName, helperText: s.displayName, disabled: v })
476
+ ] }),
477
+ /* @__PURE__ */ i(V, { fullWidth: !0, children: [
478
+ /* @__PURE__ */ e(j, { children: "Description" }),
479
+ /* @__PURE__ */ e(X, { fullWidth: !0, size: "small", multiline: !0, rows: 2, value: o.description ?? "", onChange: (N) => w("description", N.target.value), placeholder: "Optional description", disabled: v })
480
+ ] })
481
+ ] })
482
+ ] }),
483
+ /* @__PURE__ */ e(hn, { chain: o.chain, envOptions: P, onChange: (N) => a((E) => ({
484
+ ...E,
485
+ chain: N
486
+ })), disabled: v }),
487
+ /* @__PURE__ */ i(L, { display: "flex", justifyContent: "flex-end", gap: 1, mt: 2, children: [
488
+ /* @__PURE__ */ e(B, { variant: "outlined", color: "inherit", onClick: t, disabled: v, children: "Cancel" }),
489
+ /* @__PURE__ */ e(B, { type: "submit", variant: "contained", color: "primary", disabled: v || o.chain.length === 0, children: v ? "Creating..." : "Create" })
490
+ ] })
491
+ ] }) }) })
492
+ ] });
493
+ }
494
+ function Ie() {
495
+ const n = ae(20), {
496
+ orgId: t
497
+ } = oe(), [r, o] = yn(), [a, s] = D(null), [l, p] = D(!1);
498
+ let y;
499
+ n[0] !== t ? (y = {
500
+ orgName: t
501
+ }, n[0] = t, n[1] = y) : y = n[1];
502
+ const {
503
+ data: f
504
+ } = Ye(y);
505
+ let v, u;
506
+ n[2] !== f || n[3] !== r || n[4] !== o ? (v = () => {
507
+ const N = r.get("edit");
508
+ if (!N || !f?.deploymentPipelines)
509
+ return;
510
+ const E = f.deploymentPipelines.find((T) => T.name === N);
511
+ if (E) {
512
+ s(E);
513
+ const T = new URLSearchParams(r);
514
+ T.delete("edit"), o(T, {
515
+ replace: !0
516
+ });
517
+ }
518
+ }, u = [r, f, o], n[2] = f, n[3] = r, n[4] = o, n[5] = v, n[6] = u) : (v = n[5], u = n[6]), U(v, u);
519
+ let c;
520
+ n[7] === Symbol.for("react.memo_cache_sentinel") ? (c = /* @__PURE__ */ e(ie, { index: !0, element: /* @__PURE__ */ e(we, { title: "Deployment Pipelines", disableIcon: !0, children: /* @__PURE__ */ e(Mn, { onEditPipeline: s, onCreatePipeline: () => p(!0) }) }) }), n[7] = c) : c = n[7];
521
+ const m = `/org/${t}/deployment-pipelines`;
522
+ let P;
523
+ n[8] !== m ? (P = /* @__PURE__ */ i(qe, { children: [
524
+ c,
525
+ /* @__PURE__ */ e(ie, { path: "*", element: /* @__PURE__ */ e(Ke, { to: m, replace: !0 }) })
526
+ ] }), n[8] = m, n[9] = P) : P = n[9];
527
+ let w;
528
+ n[10] !== l || n[11] !== t ? (w = t && /* @__PURE__ */ e($n, { open: l, onClose: () => p(!1), orgId: t }), n[10] = l, n[11] = t, n[12] = w) : w = n[12];
529
+ let x;
530
+ n[13] !== t || n[14] !== a ? (x = a && t && /* @__PURE__ */ e(On, { open: a !== null, onClose: () => s(null), pipeline: a, orgId: t }), n[13] = t, n[14] = a, n[15] = x) : x = n[15];
531
+ let S;
532
+ return n[16] !== P || n[17] !== w || n[18] !== x ? (S = /* @__PURE__ */ i(te, { children: [
533
+ P,
534
+ w,
535
+ x
536
+ ] }), n[16] = P, n[17] = w, n[18] = x, n[19] = S) : S = n[19], S;
537
+ }
538
+ function Wn({
539
+ onEditEnvironment: n,
540
+ onCreateEnvironment: t,
541
+ onDeleteEnvironment: r
542
+ }) {
543
+ const {
544
+ orgId: o
545
+ } = oe(), a = Xe(), [s, l] = D(""), [p, y] = D(0), [f, v] = D(5), [u, c] = D(null), m = (C) => o ? he(me.children.org.children.environments.children.view.path, {
546
+ orgId: o,
547
+ envName: C
548
+ }) : "#", {
549
+ data: P,
550
+ isLoading: w,
551
+ error: x
552
+ } = Ce({
553
+ orgName: o
554
+ }), S = F(() => {
555
+ const C = P ?? [], g = s.trim().toLowerCase();
556
+ return g ? C.filter((d) => d.name.toLowerCase().includes(g) || (d.displayName ?? "").toLowerCase().includes(g)) : C;
557
+ }, [P, s]), N = P ?? [];
558
+ U(() => {
559
+ p !== 0 && p * f >= S.length && y(0);
560
+ }, [S.length, p, f]);
561
+ const E = /* @__PURE__ */ i(b, { direction: "row", spacing: 1, alignItems: "center", children: [
562
+ /* @__PURE__ */ e(L, { flexGrow: 1, children: /* @__PURE__ */ e(en, { value: s, onChange: (C) => l(C.target.value), placeholder: "Search environments...", size: "small", fullWidth: !0, disabled: w }) }),
563
+ t && N.length > 0 && /* @__PURE__ */ e(B, { variant: "contained", startIcon: /* @__PURE__ */ e(re, { size: 16 }), onClick: t, children: "Create Environment" })
564
+ ] });
565
+ if (x)
566
+ return /* @__PURE__ */ i(b, { spacing: 1, children: [
567
+ E,
568
+ /* @__PURE__ */ e(h.Container, { children: /* @__PURE__ */ i($, { severity: "error", icon: /* @__PURE__ */ e(fe, { size: 18 }), sx: {
569
+ alignSelf: "stretch"
570
+ }, children: [
571
+ "Failed to load environments.",
572
+ " ",
573
+ Qe(x) || "Please try again."
574
+ ] }) })
575
+ ] });
576
+ if (w)
577
+ return /* @__PURE__ */ i(te, { children: [
578
+ E,
579
+ /* @__PURE__ */ e(h.Container, { disablePaper: !0, children: /* @__PURE__ */ e(b, { spacing: 1, mt: 1, children: Array.from({
580
+ length: f
581
+ }).map((C, g) => /* @__PURE__ */ i(b, { direction: "row", alignItems: "center", spacing: 2, sx: {
582
+ px: 2,
583
+ py: 1.5,
584
+ borderRadius: 1,
585
+ border: "1px solid",
586
+ borderColor: "divider",
587
+ bgcolor: "background.paper"
588
+ }, children: [
589
+ /* @__PURE__ */ i(b, { direction: "row", alignItems: "center", spacing: 1.5, sx: {
590
+ flexShrink: 0
591
+ }, children: [
592
+ /* @__PURE__ */ e(R, { variant: "circular", width: 36, height: 36 }),
593
+ /* @__PURE__ */ e(R, { variant: "text", width: 140, height: 20 })
594
+ ] }),
595
+ /* @__PURE__ */ e(R, { variant: "text", width: 120, height: 20, sx: {
596
+ flexShrink: 0
597
+ } }),
598
+ /* @__PURE__ */ e(R, { variant: "rounded", width: 80, height: 24, sx: {
599
+ flexShrink: 0
600
+ } }),
601
+ /* @__PURE__ */ e(R, { variant: "rounded", width: 100, height: 24, sx: {
602
+ flexShrink: 0,
603
+ ml: "auto"
604
+ } })
605
+ ] }, g)) }) })
606
+ ] });
607
+ if (N.length === 0)
608
+ return /* @__PURE__ */ i(b, { spacing: 1, children: [
609
+ E,
610
+ /* @__PURE__ */ e(h.Container, { children: /* @__PURE__ */ e(h.EmptyState, { illustration: /* @__PURE__ */ e(Ue, { size: 64 }), title: "No environments yet", description: "Create an environment to define where your agents are deployed.", action: t && /* @__PURE__ */ e(B, { variant: "contained", startIcon: /* @__PURE__ */ e(re, { size: 16 }), onClick: t, children: "Create Environment" }) }) })
611
+ ] });
612
+ if (S.length === 0)
613
+ return /* @__PURE__ */ i(b, { spacing: 1, children: [
614
+ E,
615
+ /* @__PURE__ */ e(h.Container, { children: /* @__PURE__ */ e(h.EmptyState, { illustration: /* @__PURE__ */ e(Ge, { size: 64 }), title: "No environments match your search", description: "Try a different keyword or clear the search filter." }) })
616
+ ] });
617
+ const T = S.slice(p * f, p * f + f);
618
+ return /* @__PURE__ */ i(te, { children: [
619
+ E,
620
+ /* @__PURE__ */ e(b, { pt: 4, children: /* @__PURE__ */ i(h.Container, { disablePaper: !0, children: [
621
+ /* @__PURE__ */ i(h, { variant: "card", children: [
622
+ /* @__PURE__ */ e(h.Head, { children: /* @__PURE__ */ i(h.Row, { children: [
623
+ /* @__PURE__ */ e(h.Cell, { children: "Environment" }),
624
+ /* @__PURE__ */ e(h.Cell, { children: "Data Plane" }),
625
+ /* @__PURE__ */ e(h.Cell, { align: "center", width: "160px", children: "Type" }),
626
+ /* @__PURE__ */ e(h.Cell, { align: "right", width: "160px", children: "Created" })
627
+ ] }) }),
628
+ /* @__PURE__ */ e(h.Body, { children: T.map((C) => /* @__PURE__ */ i(h.Row, { variant: "card", hover: !0, clickable: !0, onClick: () => a(m(C.name)), onMouseEnter: () => c(C.name), onMouseLeave: () => c(null), onFocus: () => c(C.name), onBlur: () => c(null), children: [
629
+ /* @__PURE__ */ e(h.Cell, { children: /* @__PURE__ */ i(b, { direction: "row", alignItems: "center", spacing: 2, children: [
630
+ /* @__PURE__ */ e(ue, { sx: {
631
+ bgcolor: "primary.main",
632
+ color: "primary.contrastText",
633
+ fontSize: 16,
634
+ height: 36,
635
+ width: 36,
636
+ flexShrink: 0
637
+ }, children: (C.displayName ?? C.name)?.charAt(0)?.toUpperCase() ?? "E" }),
638
+ /* @__PURE__ */ e(k, { variant: "body2", fontWeight: 500, noWrap: !0, children: C.displayName ?? C.name })
639
+ ] }) }),
640
+ /* @__PURE__ */ e(h.Cell, { children: /* @__PURE__ */ e(k, { variant: "body2", color: "text.secondary", children: C.dataplaneRef || "—" }) }),
641
+ /* @__PURE__ */ e(h.Cell, { align: "center", children: /* @__PURE__ */ e(ne, { label: C.isProduction ? "Production" : "Non-production", size: "small", variant: "outlined", color: C.isProduction ? "primary" : "default" }) }),
642
+ /* @__PURE__ */ e(h.Cell, { align: "right", sx: {
643
+ cursor: "default"
644
+ }, onClick: (g) => g.stopPropagation(), children: /* @__PURE__ */ e(b, { direction: "row", justifyContent: "flex-end", alignItems: "center", spacing: 1, children: u === C.name ? /* @__PURE__ */ e(Je, { children: /* @__PURE__ */ i(b, { direction: "row", spacing: 0.5, children: [
645
+ /* @__PURE__ */ e(M, { title: "Edit environment", children: /* @__PURE__ */ e(W, { size: "small", onClick: () => n?.(C), children: /* @__PURE__ */ e(ye, { size: 16 }) }) }),
646
+ C.name !== "default" && r && /* @__PURE__ */ e(M, { title: "Delete environment", children: /* @__PURE__ */ e(W, { size: "small", color: "error", onClick: () => r(C), children: /* @__PURE__ */ e(pe, { size: 16 }) }) })
647
+ ] }) }) : /* @__PURE__ */ e(k, { variant: "caption", color: "text.secondary", children: xe(new Date(C.createdAt), {
648
+ addSuffix: !0
649
+ }) }) }) })
650
+ ] }, C.name)) })
651
+ ] }),
652
+ S.length > 5 && /* @__PURE__ */ e(nn, { component: "div", count: S.length, page: p, rowsPerPage: f, onPageChange: (C, g) => y(g), onRowsPerPageChange: (C) => {
653
+ v(parseInt(C.target.value, 10)), y(0);
654
+ }, rowsPerPageOptions: [5, 10, 25] })
655
+ ] }) })
656
+ ] });
657
+ }
658
+ const Ae = Ne({
659
+ displayName: H().min(1, "Display name is required").max(128, "Display name must be 128 characters or less"),
660
+ description: H().nullable().optional(),
661
+ isProduction: ln().optional()
662
+ }), Gn = Ne({
663
+ name: H().min(1, "Name is required").max(64, "Name must be 64 characters or less").regex(/^[a-z0-9-]+$/, "Name must be lowercase alphanumeric with hyphens only"),
664
+ displayName: H().min(1, "Display name is required").max(128, "Display name must be 128 characters or less"),
665
+ description: H().optional(),
666
+ dataplaneRef: H().min(1, "Data plane is required"),
667
+ dnsPrefix: H().min(1, "DNS prefix is required").max(100),
668
+ isProduction: ln().optional()
669
+ });
670
+ function Hn({
671
+ open: n,
672
+ onClose: t,
673
+ environment: r,
674
+ orgId: o
675
+ }) {
676
+ const [a, s] = D({
677
+ displayName: r.displayName ?? "",
678
+ description: "",
679
+ isProduction: r.isProduction
680
+ }), {
681
+ errors: l,
682
+ validateForm: p,
683
+ setFieldError: y,
684
+ validateField: f
685
+ } = be(Ae), [v, u] = D({}), {
686
+ mutateAsync: c,
687
+ isPending: m,
688
+ error: P,
689
+ reset: w
690
+ } = wn();
691
+ U(() => {
692
+ n && (s({
693
+ displayName: r.displayName ?? "",
694
+ description: "",
695
+ isProduction: r.isProduction
696
+ }), u({}), w());
697
+ }, [n, r, w]);
698
+ const x = _((T, C) => {
699
+ s((g) => {
700
+ const d = {
701
+ ...g,
702
+ [T]: C
703
+ }, z = f(T, d[T], d);
704
+ return y(T, z), d;
705
+ });
706
+ }, [y, f]), S = _(async (T) => {
707
+ T.preventDefault();
708
+ const C = Ae.safeParse(a);
709
+ if (!C.success) {
710
+ const g = {};
711
+ C.error.issues.forEach((d) => {
712
+ d.path[0] && (g[d.path[0]] = d.message);
713
+ }), u(g), p(a);
714
+ return;
715
+ }
716
+ u({});
717
+ try {
718
+ await c({
719
+ params: {
720
+ orgName: o,
721
+ envName: r.name
722
+ },
723
+ body: {
724
+ displayName: C.data.displayName.trim(),
725
+ description: C.data.description ?? void 0,
726
+ isProduction: C.data.isProduction
727
+ }
728
+ }), t();
729
+ } catch {
730
+ }
731
+ }, [a, p, c, r, t, o]), N = F(() => P ? P?.message ?? "Failed to update environment" : null, [P]), E = Object.values(v).filter(Boolean);
732
+ return /* @__PURE__ */ i(le, { open: n, onClose: t, children: [
733
+ /* @__PURE__ */ e(se, { icon: /* @__PURE__ */ e(ye, { size: 24 }), title: "Edit Environment", onClose: t }),
734
+ /* @__PURE__ */ e(ce, { children: /* @__PURE__ */ e("form", { onSubmit: S, children: /* @__PURE__ */ i(b, { spacing: 3, children: [
735
+ N && /* @__PURE__ */ e($, { severity: "error", children: /* @__PURE__ */ e(k, { variant: "body2", children: N }) }),
736
+ /* @__PURE__ */ e(Dn, { in: E.length > 0, timeout: "auto", unmountOnExit: !0, children: /* @__PURE__ */ e($, { severity: "error", sx: {
737
+ mb: 2
738
+ }, children: E.map((T, C) => /* @__PURE__ */ e(L, { children: T }, C)) }) }),
739
+ /* @__PURE__ */ i(O.Section, { children: [
740
+ /* @__PURE__ */ e(O.Header, { children: "Environment Details" }),
741
+ /* @__PURE__ */ i(O.Stack, { spacing: 2, children: [
742
+ /* @__PURE__ */ i(V, { fullWidth: !0, error: !!l.displayName, children: [
743
+ /* @__PURE__ */ e(j, { required: !0, children: "Display Name" }),
744
+ /* @__PURE__ */ e(X, { fullWidth: !0, size: "small", value: a.displayName, onChange: (T) => x("displayName", T.target.value), placeholder: "e.g., Production Environment", error: !!l.displayName, helperText: l.displayName, disabled: m })
745
+ ] }),
746
+ /* @__PURE__ */ i(V, { fullWidth: !0, children: [
747
+ /* @__PURE__ */ e(j, { children: "Description" }),
748
+ /* @__PURE__ */ e(X, { fullWidth: !0, size: "small", multiline: !0, rows: 2, value: a.description ?? "", onChange: (T) => x("description", T.target.value), placeholder: "Optional description", disabled: m })
749
+ ] }),
750
+ /* @__PURE__ */ e(tn, { control: /* @__PURE__ */ e(rn, { checked: a.isProduction ?? !1, onChange: (T) => x("isProduction", T.target.checked), disabled: m }), label: "Production environment" })
751
+ ] })
752
+ ] }),
753
+ /* @__PURE__ */ i(L, { display: "flex", justifyContent: "flex-end", gap: 1, mt: 2, children: [
754
+ /* @__PURE__ */ e(B, { variant: "outlined", color: "inherit", onClick: t, disabled: m, children: "Cancel" }),
755
+ /* @__PURE__ */ e(B, { type: "submit", variant: "contained", color: "primary", disabled: m, children: m ? "Saving..." : "Save" })
756
+ ] })
757
+ ] }) }) })
758
+ ] });
759
+ }
760
+ const Un = "•••••••••••••••", _e = {
761
+ name: "",
762
+ displayName: "",
763
+ description: "",
764
+ dataplaneRef: "",
765
+ dnsPrefix: "",
766
+ isProduction: !1
767
+ };
768
+ function Fe(n) {
769
+ return n.toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "").replace(/-+/g, "-").replace(/^-|-$/g, "");
770
+ }
771
+ function Le(n, t, r, o) {
772
+ const a = Se.agentManagerInternalBaseUrl?.trim(), s = Se.agentManagerInternalCpHost?.trim(), l = In();
773
+ return [`curl -fsSL ${ge("add-environment.sh")} \\`, ` | ENV_NAME=${n || "<env-name>"} \\`, ` DISPLAY_NAME="${t || "<display-name>"}" \\`, ` AGENT_MANAGER_TOKEN=${o} \\`, ` CHART_VERSION=${l || "<chart-version>"} \\`, ...r ? [" IS_PRODUCTION=true \\"] : [], ...a ? [` AGENT_MANAGER_INTERNAL_BASE_URL=${a} \\`] : [], ...s ? [` AGENT_MANAGER_INTERNAL_CP=${s} \\`] : [], ` THUNDER_SCRIPT_URL=${ge("add-environment-thunder.sh")} \\`, " bash"].join(`
774
+ `);
775
+ }
776
+ function Vn({
777
+ open: n,
778
+ onClose: t,
779
+ orgId: r
780
+ }) {
781
+ const [o, a] = D(_e), [s, l] = D(!1), [p, y] = D(null), [f, v] = D(!1), {
782
+ errors: u,
783
+ validateField: c,
784
+ setFieldError: m
785
+ } = be(Gn), {
786
+ getToken: P
787
+ } = Ze(), {
788
+ data: w
789
+ } = xn({
790
+ orgName: r
791
+ }), x = w ?? [];
792
+ U(() => {
793
+ n && (a(_e), l(!1), y(null), v(!1));
794
+ }, [n]), U(() => {
795
+ !o.dataplaneRef && x.length > 0 && a((d) => ({
796
+ ...d,
797
+ dataplaneRef: x[0].name
798
+ }));
799
+ }, [x, o.dataplaneRef]);
800
+ const S = _((d, z) => {
801
+ a((I) => {
802
+ const q = {
803
+ ...I,
804
+ [d]: z
805
+ };
806
+ return m(d, c(d, q[d], q)), q;
807
+ });
808
+ }, [c, m]), N = _((d) => {
809
+ a((z) => {
810
+ const I = Fe(d), Y = z.name === "" || z.name === Fe(z.displayName) ? I : z.name, G = {
811
+ ...z,
812
+ displayName: d,
813
+ name: Y,
814
+ dnsPrefix: Y
815
+ };
816
+ return m("displayName", c("displayName", d, G)), m("name", c("name", Y, G)), G;
817
+ });
818
+ }, [c, m]), E = _((d) => {
819
+ a((z) => {
820
+ const I = {
821
+ ...z,
822
+ name: d,
823
+ dnsPrefix: d
824
+ };
825
+ return m("name", c("name", d, I)), I;
826
+ });
827
+ }, [c, m]), T = _(async () => {
828
+ if (s)
829
+ l(!1), y(null);
830
+ else
831
+ try {
832
+ const d = await P();
833
+ y(d), l(!0);
834
+ } catch {
835
+ }
836
+ }, [s, P]), C = _(async () => {
837
+ try {
838
+ const d = p ?? await P(), z = Le(o.name, o.displayName, o.isProduction ?? !1, d);
839
+ await navigator.clipboard.writeText(z), v(!0), setTimeout(() => v(!1), 2e3);
840
+ } catch {
841
+ }
842
+ }, [p, P, o.name, o.displayName, o.isProduction]), g = F(() => Le(o.name, o.displayName, o.isProduction ?? !1, s && p ? p : Un), [o.name, o.displayName, o.isProduction, s, p]);
843
+ return /* @__PURE__ */ i(le, { open: n, onClose: t, children: [
844
+ /* @__PURE__ */ e(se, { icon: /* @__PURE__ */ e(re, { size: 24 }), title: "Create Environment", onClose: t }),
845
+ /* @__PURE__ */ e(ce, { children: /* @__PURE__ */ i(b, { spacing: 3, children: [
846
+ /* @__PURE__ */ i(k, { variant: "body2", color: "text.secondary", children: [
847
+ "Environments are provisioned by a script that creates the environment in Agent Manager, installs its API Platform Gateway, and stands up its dedicated identity (Thunder) instance via Helm. Fill in the details below, then copy and run the command in a terminal with ",
848
+ /* @__PURE__ */ e("code", { children: "kubectl" }),
849
+ " and ",
850
+ /* @__PURE__ */ e("code", { children: "helm" }),
851
+ " configured against your cluster."
852
+ ] }),
853
+ /* @__PURE__ */ i(b, { spacing: 2, children: [
854
+ x.length > 1 && /* @__PURE__ */ i(V, { fullWidth: !0, error: !!u.dataplaneRef, children: [
855
+ /* @__PURE__ */ e(j, { required: !0, children: "Data Plane" }),
856
+ /* @__PURE__ */ e(zn, { size: "small", value: o.dataplaneRef, onChange: (d) => S("dataplaneRef", d.target.value), error: !!u.dataplaneRef, children: x.map((d) => /* @__PURE__ */ e(Pe, { value: d.name, children: d.displayName || d.name }, d.name)) }),
857
+ u.dataplaneRef && /* @__PURE__ */ e(k, { variant: "caption", color: "error", children: u.dataplaneRef })
858
+ ] }),
859
+ /* @__PURE__ */ i(V, { fullWidth: !0, error: !!u.displayName, children: [
860
+ /* @__PURE__ */ e(j, { required: !0, children: "Display Name" }),
861
+ /* @__PURE__ */ e(X, { size: "small", fullWidth: !0, value: o.displayName, onChange: (d) => N(d.target.value), placeholder: "e.g., Production", error: !!u.displayName, helperText: u.displayName })
862
+ ] }),
863
+ /* @__PURE__ */ i(V, { fullWidth: !0, error: !!u.name, children: [
864
+ /* @__PURE__ */ e(j, { children: "Name" }),
865
+ /* @__PURE__ */ e(X, { size: "small", fullWidth: !0, value: o.name, onChange: (d) => E(d.target.value), placeholder: "e.g., production", error: !!u.name, helperText: u.name ?? "The resource name used by the API. Generated automatically and guaranteed unique." })
866
+ ] }),
867
+ /* @__PURE__ */ e(tn, { control: /* @__PURE__ */ e(rn, { checked: o.isProduction ?? !1, onChange: (d) => S("isProduction", d.target.checked) }), label: "Production environment" })
868
+ ] }),
869
+ /* @__PURE__ */ i(b, { spacing: 1, children: [
870
+ /* @__PURE__ */ e(k, { variant: "body2", children: "Run from the root of your repo clone:" }),
871
+ /* @__PURE__ */ i(L, { sx: {
872
+ position: "relative",
873
+ bgcolor: "grey.900",
874
+ borderRadius: 1,
875
+ p: 2,
876
+ pr: 8,
877
+ fontFamily: "monospace",
878
+ fontSize: "0.8125rem",
879
+ color: "grey.100",
880
+ whiteSpace: "pre",
881
+ overflowX: "auto"
882
+ }, children: [
883
+ /* @__PURE__ */ i(L, { sx: {
884
+ position: "absolute",
885
+ top: 6,
886
+ right: 6,
887
+ display: "flex",
888
+ gap: 0.5
889
+ }, children: [
890
+ /* @__PURE__ */ e(M, { title: s ? "Hide token" : "Show token", children: /* @__PURE__ */ e(W, { size: "small", onClick: T, sx: {
891
+ color: "grey.400"
892
+ }, children: s ? /* @__PURE__ */ e(Ve, { size: 16 }) : /* @__PURE__ */ e(je, { size: 16 }) }) }),
893
+ /* @__PURE__ */ e(M, { title: f ? "Copied!" : "Copy", children: /* @__PURE__ */ e(W, { size: "small", onClick: C, sx: {
894
+ color: f ? "success.light" : "grey.400"
895
+ }, children: /* @__PURE__ */ e(ve, { size: 16 }) }) })
896
+ ] }),
897
+ g
898
+ ] }),
899
+ /* @__PURE__ */ e(k, { variant: "caption", color: "text.secondary", children: "Your access token will be substituted when you copy." })
900
+ ] }),
901
+ /* @__PURE__ */ e($, { severity: "info", children: "Once the script completes, the new environment will appear in the list. The script is idempotent — safe to re-run." }),
902
+ /* @__PURE__ */ e(L, { display: "flex", justifyContent: "flex-end", children: /* @__PURE__ */ e(B, { variant: "outlined", color: "inherit", onClick: t, children: "Close" }) })
903
+ ] }) })
904
+ ] });
905
+ }
906
+ const jn = "•••••••••••••••";
907
+ function Me(n, t) {
908
+ return [`curl -fsSL ${ge("remove-environment.sh")} \\`, ` | ENV_NAME=${n || "<env-name>"} \\`, ` AGENT_MANAGER_TOKEN=${t} \\`, ` THUNDER_SCRIPT_URL=${ge("remove-environment-thunder.sh")} \\`, " bash"].join(`
909
+ `);
910
+ }
911
+ function qn({
912
+ open: n,
913
+ onClose: t,
914
+ environment: r
915
+ }) {
916
+ const [o, a] = D(!1), [s, l] = D(null), [p, y] = D(!1), {
917
+ getToken: f
918
+ } = Ze();
919
+ U(() => {
920
+ n && (a(!1), l(null), y(!1));
921
+ }, [n]);
922
+ const v = _(async () => {
923
+ if (o)
924
+ a(!1), l(null);
925
+ else
926
+ try {
927
+ const m = await f();
928
+ l(m), a(!0);
929
+ } catch {
930
+ }
931
+ }, [o, f]), u = _(async () => {
932
+ try {
933
+ const m = s ?? await f(), P = Me(r.name, m);
934
+ await navigator.clipboard.writeText(P), y(!0), setTimeout(() => y(!1), 2e3);
935
+ } catch {
936
+ }
937
+ }, [s, f, r.name]), c = F(() => Me(r.name, o && s ? s : jn), [r.name, o, s]);
938
+ return /* @__PURE__ */ i(le, { open: n, onClose: t, children: [
939
+ /* @__PURE__ */ e(se, { icon: /* @__PURE__ */ e(pe, { size: 24 }), title: "Delete Environment", onClose: t }),
940
+ /* @__PURE__ */ e(ce, { children: /* @__PURE__ */ i(b, { spacing: 3, children: [
941
+ /* @__PURE__ */ i(k, { variant: "body2", color: "text.secondary", children: [
942
+ "Environments are removed by a script that deprovisions the environment's dedicated identity (Thunder) instance, uninstalls its API Platform Gateway via Helm, and then deletes the environment in Agent Manager. Copy and run the command below in a terminal with ",
943
+ /* @__PURE__ */ e("code", { children: "kubectl" }),
944
+ " and ",
945
+ /* @__PURE__ */ e("code", { children: "helm" }),
946
+ " configured against your cluster."
947
+ ] }),
948
+ /* @__PURE__ */ i($, { severity: "warning", children: [
949
+ "This permanently deletes ",
950
+ /* @__PURE__ */ e("strong", { children: r.displayName ?? r.name }),
951
+ " ",
952
+ "and uninstalls its gateway. Agents deployed to this environment will no longer be reachable. This action cannot be undone."
953
+ ] }),
954
+ /* @__PURE__ */ i(b, { spacing: 1, children: [
955
+ /* @__PURE__ */ e(k, { variant: "body2", children: "Run from the root of your repo clone:" }),
956
+ /* @__PURE__ */ i(L, { sx: {
957
+ position: "relative",
958
+ bgcolor: "grey.900",
959
+ borderRadius: 1,
960
+ p: 2,
961
+ pr: 8,
962
+ fontFamily: "monospace",
963
+ fontSize: "0.8125rem",
964
+ color: "grey.100",
965
+ whiteSpace: "pre",
966
+ overflowX: "auto"
967
+ }, children: [
968
+ /* @__PURE__ */ i(L, { sx: {
969
+ position: "absolute",
970
+ top: 6,
971
+ right: 6,
972
+ display: "flex",
973
+ gap: 0.5
974
+ }, children: [
975
+ /* @__PURE__ */ e(M, { title: o ? "Hide token" : "Show token", children: /* @__PURE__ */ e(W, { size: "small", onClick: v, sx: {
976
+ color: "grey.400"
977
+ }, children: o ? /* @__PURE__ */ e(Ve, { size: 16 }) : /* @__PURE__ */ e(je, { size: 16 }) }) }),
978
+ /* @__PURE__ */ e(M, { title: p ? "Copied!" : "Copy", children: /* @__PURE__ */ e(W, { size: "small", onClick: u, sx: {
979
+ color: p ? "success.light" : "grey.400"
980
+ }, children: /* @__PURE__ */ e(ve, { size: 16 }) }) })
981
+ ] }),
982
+ c
983
+ ] }),
984
+ /* @__PURE__ */ e(k, { variant: "caption", color: "text.secondary", children: "Your access token will be substituted when you copy." })
985
+ ] }),
986
+ /* @__PURE__ */ e($, { severity: "info", children: "Once the script completes, the environment will disappear from the list. The script is idempotent — safe to re-run." }),
987
+ /* @__PURE__ */ e(L, { display: "flex", justifyContent: "flex-end", children: /* @__PURE__ */ e(B, { variant: "outlined", color: "inherit", onClick: t, children: "Close" }) })
988
+ ] }) })
989
+ ] });
990
+ }
991
+ const Be = {
992
+ fontFamily: "monospace",
993
+ color: "text.secondary",
994
+ overflow: "hidden",
995
+ textOverflow: "ellipsis",
996
+ whiteSpace: "nowrap",
997
+ display: "block"
998
+ }, Kn = {
999
+ ACTIVE: "success",
1000
+ INACTIVE: "default",
1001
+ PROVISIONING: "warning",
1002
+ ERROR: "error"
1003
+ }, Xn = {
1004
+ width: 28,
1005
+ height: 28,
1006
+ fontSize: 12,
1007
+ bgcolor: "primary.main",
1008
+ color: "primary.contrastText"
1009
+ };
1010
+ function Yn(n) {
1011
+ const t = ae(11), {
1012
+ label: r,
1013
+ value: o
1014
+ } = n;
1015
+ let a;
1016
+ t[0] === Symbol.for("react.memo_cache_sentinel") ? (a = {
1017
+ height: "100%"
1018
+ }, t[0] = a) : a = t[0];
1019
+ let s;
1020
+ t[1] === Symbol.for("react.memo_cache_sentinel") ? (s = {
1021
+ p: 2,
1022
+ "&:last-child": {
1023
+ pb: 2
1024
+ }
1025
+ }, t[1] = s) : s = t[1];
1026
+ let l;
1027
+ t[2] === Symbol.for("react.memo_cache_sentinel") ? (l = {
1028
+ fontWeight: 500
1029
+ }, t[2] = l) : l = t[2];
1030
+ let p;
1031
+ t[3] !== r ? (p = /* @__PURE__ */ e(k, { variant: "caption", color: "text.secondary", sx: l, children: r }), t[3] = r, t[4] = p) : p = t[4];
1032
+ let y;
1033
+ t[5] === Symbol.for("react.memo_cache_sentinel") ? (y = {
1034
+ fontFamily: "monospace",
1035
+ wordBreak: "break-all"
1036
+ }, t[5] = y) : y = t[5];
1037
+ let f;
1038
+ t[6] !== o ? (f = /* @__PURE__ */ e(k, { variant: "body2", sx: y, children: o }), t[6] = o, t[7] = f) : f = t[7];
1039
+ let v;
1040
+ return t[8] !== p || t[9] !== f ? (v = /* @__PURE__ */ e(an, { variant: "outlined", sx: a, children: /* @__PURE__ */ e(on, { sx: s, children: /* @__PURE__ */ i(b, { spacing: 0.5, children: [
1041
+ p,
1042
+ f
1043
+ ] }) }) }), t[8] = p, t[9] = f, t[10] = v) : v = t[10], v;
1044
+ }
1045
+ function Oe(n) {
1046
+ const t = ae(19), {
1047
+ label: r,
1048
+ scheme: o,
1049
+ endpoint: a,
1050
+ onCopy: s
1051
+ } = n, l = a.host ? `${o}://${a.host}${a.port ? `:${a.port}` : ""}` : void 0, p = l ?? "Not configured";
1052
+ let y;
1053
+ t[0] === Symbol.for("react.memo_cache_sentinel") ? (y = {
1054
+ height: "100%"
1055
+ }, t[0] = y) : y = t[0];
1056
+ let f;
1057
+ t[1] === Symbol.for("react.memo_cache_sentinel") ? (f = {
1058
+ p: 2,
1059
+ "&:last-child": {
1060
+ pb: 2
1061
+ }
1062
+ }, t[1] = f) : f = t[1];
1063
+ let v;
1064
+ t[2] === Symbol.for("react.memo_cache_sentinel") ? (v = {
1065
+ fontWeight: 500
1066
+ }, t[2] = v) : v = t[2];
1067
+ let u;
1068
+ t[3] !== r ? (u = /* @__PURE__ */ e(k, { variant: "caption", color: "text.secondary", sx: v, children: r }), t[3] = r, t[4] = u) : u = t[4];
1069
+ const c = l ? "text.primary" : "text.secondary";
1070
+ let m;
1071
+ t[5] === Symbol.for("react.memo_cache_sentinel") ? (m = {
1072
+ fontFamily: "monospace",
1073
+ wordBreak: "break-all",
1074
+ flex: 1,
1075
+ fontSize: "0.8rem"
1076
+ }, t[5] = m) : m = t[5];
1077
+ let P;
1078
+ t[6] !== p || t[7] !== c ? (P = /* @__PURE__ */ e(k, { variant: "body2", color: c, sx: m, children: p }), t[6] = p, t[7] = c, t[8] = P) : P = t[8];
1079
+ let w;
1080
+ t[9] !== r || t[10] !== s || t[11] !== l ? (w = l && /* @__PURE__ */ e(M, { title: `Copy ${r}`, children: /* @__PURE__ */ e(W, { size: "small", "aria-label": `Copy ${r}`, onClick: () => s(l, `${r} copied to clipboard`), sx: {
1081
+ flexShrink: 0
1082
+ }, children: /* @__PURE__ */ e(ve, { size: 14 }) }) }), t[9] = r, t[10] = s, t[11] = l, t[12] = w) : w = t[12];
1083
+ let x;
1084
+ t[13] !== P || t[14] !== w ? (x = /* @__PURE__ */ i(b, { direction: "row", alignItems: "center", spacing: 1, children: [
1085
+ P,
1086
+ w
1087
+ ] }), t[13] = P, t[14] = w, t[15] = x) : x = t[15];
1088
+ let S;
1089
+ return t[16] !== u || t[17] !== x ? (S = /* @__PURE__ */ e(an, { variant: "outlined", sx: y, children: /* @__PURE__ */ e(on, { sx: f, children: /* @__PURE__ */ i(b, { spacing: 0.5, children: [
1090
+ u,
1091
+ x
1092
+ ] }) }) }), t[16] = u, t[17] = x, t[18] = S) : S = t[18], S;
1093
+ }
1094
+ function Jn() {
1095
+ const n = ae(51), {
1096
+ orgId: t,
1097
+ envName: r
1098
+ } = oe(), o = Xe(), {
1099
+ pushSnackBar: a
1100
+ } = Nn();
1101
+ let s;
1102
+ n[0] !== r || n[1] !== t ? (s = {
1103
+ orgName: t,
1104
+ envName: r
1105
+ }, n[0] = r, n[1] = t, n[2] = s) : s = n[2];
1106
+ const {
1107
+ data: l,
1108
+ isLoading: p,
1109
+ error: y
1110
+ } = En(s);
1111
+ let f;
1112
+ n[3] !== t ? (f = {
1113
+ orgName: t
1114
+ }, n[3] = t, n[4] = f) : f = n[4];
1115
+ let v;
1116
+ n[5] !== r ? (v = {
1117
+ environment: r
1118
+ }, n[5] = r, n[6] = v) : v = n[6];
1119
+ const {
1120
+ data: u,
1121
+ isLoading: c
1122
+ } = Sn(f, v);
1123
+ let m;
1124
+ n[7] !== t ? (m = t ? he(me.children.org.children.environments.path, {
1125
+ orgId: t
1126
+ }) : "#", n[7] = t, n[8] = m) : m = n[8];
1127
+ const P = m;
1128
+ let w;
1129
+ n[9] !== u?.gateways ? (w = u?.gateways ?? [], n[9] = u?.gateways, n[10] = w) : w = n[10];
1130
+ const x = w;
1131
+ let S;
1132
+ n[11] !== t ? (S = {
1133
+ orgName: t
1134
+ }, n[11] = t, n[12] = S) : S = n[12];
1135
+ const {
1136
+ data: N,
1137
+ isLoading: E
1138
+ } = Tn(S);
1139
+ let T;
1140
+ n[13] !== r || n[14] !== N?.thunderInstances ? (T = N?.thunderInstances.find((A) => A.envName === r), n[13] = r, n[14] = N?.thunderInstances, n[15] = T) : T = n[15];
1141
+ const C = T;
1142
+ let g;
1143
+ n[16] !== a ? (g = (A, mn) => {
1144
+ Fn(A).then((pn) => {
1145
+ a(pn ? {
1146
+ message: mn,
1147
+ type: "success"
1148
+ } : {
1149
+ message: "Failed to copy to clipboard",
1150
+ type: "error"
1151
+ });
1152
+ });
1153
+ }, n[16] = a, n[17] = g) : g = n[17];
1154
+ const d = g, z = l?.gateway?.ingress?.external?.http, I = l?.gateway?.ingress?.external?.https, q = l?.displayName ?? l?.name ?? r ?? "", Y = l?.createdAt ? `Created ${xe(new Date(l.createdAt), {
1155
+ addSuffix: !0
1156
+ })}` : void 0;
1157
+ let G;
1158
+ n[18] !== l ? (G = l ? /* @__PURE__ */ i(b, { direction: "row", alignItems: "center", spacing: 1, children: [
1159
+ /* @__PURE__ */ e(ne, { label: l.isProduction ? "Production" : "Non-production", size: "small", variant: "outlined", color: l.isProduction ? "primary" : "default" }),
1160
+ /* @__PURE__ */ e(M, { title: "Data plane reference for this environment", children: /* @__PURE__ */ e(ne, { label: l.dataplaneRef || "—", size: "small", variant: "outlined" }) })
1161
+ ] }) : void 0, n[18] = l, n[19] = G) : G = n[19];
1162
+ let J;
1163
+ n[20] !== y ? (J = y ? /* @__PURE__ */ e($, { severity: "error", icon: /* @__PURE__ */ e(fe, { size: 18 }), sx: {
1164
+ mb: 2
1165
+ }, children: Qe(y) || "Failed to load environment. Please try again." }) : null, n[20] = y, n[21] = J) : J = n[21];
1166
+ let Q;
1167
+ n[22] !== l || n[23] !== y || n[24] !== r || n[25] !== p ? (Q = !p && !l && !y ? /* @__PURE__ */ i($, { severity: "error", sx: {
1168
+ mb: 2
1169
+ }, children: [
1170
+ "Environment “",
1171
+ r,
1172
+ "” not found."
1173
+ ] }) : null, n[22] = l, n[23] = y, n[24] = r, n[25] = p, n[26] = Q) : Q = n[26];
1174
+ let Z;
1175
+ n[27] !== p ? (Z = p && /* @__PURE__ */ i(b, { spacing: 3, children: [
1176
+ /* @__PURE__ */ i(b, { spacing: 1.5, children: [
1177
+ /* @__PURE__ */ e(R, { variant: "text", width: 120, height: 16 }),
1178
+ /* @__PURE__ */ i(K, { container: !0, spacing: 2, children: [
1179
+ /* @__PURE__ */ e(K, { size: {
1180
+ xs: 12,
1181
+ sm: 6,
1182
+ md: 4
1183
+ }, children: /* @__PURE__ */ e(R, { variant: "rounded", height: 72 }) }),
1184
+ /* @__PURE__ */ e(K, { size: {
1185
+ xs: 12,
1186
+ sm: 6,
1187
+ md: 4
1188
+ }, children: /* @__PURE__ */ e(R, { variant: "rounded", height: 72 }) }),
1189
+ /* @__PURE__ */ e(K, { size: {
1190
+ xs: 12,
1191
+ sm: 6,
1192
+ md: 4
1193
+ }, children: /* @__PURE__ */ e(R, { variant: "rounded", height: 72 }) })
1194
+ ] })
1195
+ ] }),
1196
+ /* @__PURE__ */ i(b, { spacing: 1.5, children: [
1197
+ /* @__PURE__ */ e(R, { variant: "text", width: 90, height: 16 }),
1198
+ /* @__PURE__ */ i(b, { spacing: 1, children: [
1199
+ /* @__PURE__ */ e(R, { variant: "rounded", height: 56 }),
1200
+ /* @__PURE__ */ e(R, { variant: "rounded", height: 56 })
1201
+ ] })
1202
+ ] }),
1203
+ /* @__PURE__ */ i(b, { spacing: 1.5, children: [
1204
+ /* @__PURE__ */ e(R, { variant: "text", width: 140, height: 16 }),
1205
+ /* @__PURE__ */ e(R, { variant: "rounded", height: 56 })
1206
+ ] })
1207
+ ] }), n[27] = p, n[28] = Z) : Z = n[28];
1208
+ let ee;
1209
+ n[29] !== l || n[30] !== y || n[31] !== x || n[32] !== d || n[33] !== z || n[34] !== I || n[35] !== c || n[36] !== E || n[37] !== o || n[38] !== t || n[39] !== C ? (ee = l && !y && /* @__PURE__ */ i(b, { spacing: 3, children: [
1210
+ /* @__PURE__ */ e(b, { spacing: 1.5, children: l.dnsPrefix || z || I ? /* @__PURE__ */ i(K, { container: !0, spacing: 2, children: [
1211
+ l.dnsPrefix && /* @__PURE__ */ e(K, { size: {
1212
+ xs: 12,
1213
+ sm: 6,
1214
+ md: 4
1215
+ }, children: /* @__PURE__ */ e(Yn, { label: "DNS Prefix", value: l.dnsPrefix }) }),
1216
+ z && /* @__PURE__ */ e(K, { size: {
1217
+ xs: 12,
1218
+ sm: 6,
1219
+ md: 4
1220
+ }, children: /* @__PURE__ */ e(Oe, { label: "HTTP Endpoint", scheme: "http", endpoint: z, onCopy: d }) }),
1221
+ I && /* @__PURE__ */ e(K, { size: {
1222
+ xs: 12,
1223
+ sm: 6,
1224
+ md: 4
1225
+ }, children: /* @__PURE__ */ e(Oe, { label: "HTTPS Endpoint", scheme: "https", endpoint: I, onCopy: d }) })
1226
+ ] }) : /* @__PURE__ */ e(k, { variant: "body2", color: "text.secondary", children: "No external ingress configured for this environment." }) }),
1227
+ /* @__PURE__ */ i(b, { spacing: 1.5, children: [
1228
+ /* @__PURE__ */ e(k, { variant: "overline", color: "text.secondary", children: "Gateways" }),
1229
+ c ? /* @__PURE__ */ e(b, { spacing: 1, children: Array.from({
1230
+ length: 3
1231
+ }).map(Qn) }) : x.length === 0 ? /* @__PURE__ */ e(h.Container, { children: /* @__PURE__ */ e(h.EmptyState, { illustration: /* @__PURE__ */ e(gn, { size: 56 }), title: "No gateways in this environment", description: "Assign a gateway to this environment to see it here." }) }) : /* @__PURE__ */ e(h.Container, { children: /* @__PURE__ */ i(h, { variant: "table", children: [
1232
+ /* @__PURE__ */ e(h.Head, { children: /* @__PURE__ */ i(h.Row, { children: [
1233
+ /* @__PURE__ */ e(h.Cell, { children: "Gateway" }),
1234
+ /* @__PURE__ */ e(h.Cell, { children: "Type" }),
1235
+ /* @__PURE__ */ e(h.Cell, { children: "Virtual Host" }),
1236
+ /* @__PURE__ */ e(h.Cell, { align: "center", children: "Status" })
1237
+ ] }) }),
1238
+ /* @__PURE__ */ e(h.Body, { children: x.map((A) => /* @__PURE__ */ i(h.Row, { variant: "table", hover: !0, clickable: !0, onClick: () => o(he(me.children.org.children.gateways.children.view.path, {
1239
+ orgId: t ?? "",
1240
+ gatewayId: A.uuid
1241
+ })), children: [
1242
+ /* @__PURE__ */ e(h.Cell, { children: /* @__PURE__ */ e(h.CellIcon, { icon: /* @__PURE__ */ e(ue, { sx: Xn, children: _n(A.displayName ?? A.name, {
1243
+ fallback: "G",
1244
+ maxChars: 1
1245
+ }) }), primary: A.displayName ?? A.name }) }),
1246
+ /* @__PURE__ */ e(h.Cell, { children: /* @__PURE__ */ e(An, { type: A.gatewayType }) }),
1247
+ /* @__PURE__ */ e(h.Cell, { children: /* @__PURE__ */ e(k, { variant: "body2", sx: {
1248
+ fontFamily: "monospace"
1249
+ }, children: A.vhost }) }),
1250
+ /* @__PURE__ */ e(h.Cell, { align: "center", children: /* @__PURE__ */ e(ne, { label: A.status, size: "small", color: Kn[A.status], variant: "outlined" }) })
1251
+ ] }, A.uuid)) })
1252
+ ] }) })
1253
+ ] }),
1254
+ /* @__PURE__ */ i(b, { spacing: 1.5, children: [
1255
+ /* @__PURE__ */ e(k, { variant: "overline", color: "text.secondary", children: "Identity Providers" }),
1256
+ E ? /* @__PURE__ */ e(b, { spacing: 1, children: /* @__PURE__ */ e(R, { variant: "rounded", height: 56 }) }) : C ? /* @__PURE__ */ e(h.Container, { children: /* @__PURE__ */ i(h, { variant: "table", children: [
1257
+ /* @__PURE__ */ e(h.Head, { children: /* @__PURE__ */ i(h.Row, { children: [
1258
+ /* @__PURE__ */ e(h.Cell, { width: "240px", children: "Identity Provider" }),
1259
+ /* @__PURE__ */ e(h.Cell, { children: "Issuer" }),
1260
+ /* @__PURE__ */ e(h.Cell, { children: "Token Endpoint" })
1261
+ ] }) }),
1262
+ /* @__PURE__ */ e(h.Body, { children: /* @__PURE__ */ i(h.Row, { variant: "table", hover: !0, clickable: !0, onClick: () => o(he(me.children.org.children.thunderInstances.children.view.path, {
1263
+ orgId: t ?? "",
1264
+ envName: C.envName
1265
+ })), children: [
1266
+ /* @__PURE__ */ e(h.Cell, { children: /* @__PURE__ */ e(h.CellIcon, { icon: /* @__PURE__ */ e(ue, { sx: {
1267
+ width: 28,
1268
+ height: 28,
1269
+ bgcolor: "primary.main",
1270
+ color: "primary.contrastText"
1271
+ }, children: /* @__PURE__ */ e(Ee, { size: 16 }) }), primary: "Thunder", secondary: "System identity provider" }) }),
1272
+ /* @__PURE__ */ e(h.Cell, { children: /* @__PURE__ */ e(k, { variant: "caption", sx: {
1273
+ ...Be,
1274
+ maxWidth: 280
1275
+ }, children: C.issuerUrl }) }),
1276
+ /* @__PURE__ */ e(h.Cell, { children: /* @__PURE__ */ i(b, { direction: "row", alignItems: "center", spacing: 1, children: [
1277
+ /* @__PURE__ */ e(k, { variant: "caption", sx: {
1278
+ ...Be,
1279
+ maxWidth: 320
1280
+ }, children: C.tokenUrl }),
1281
+ /* @__PURE__ */ e(M, { title: "Copy token endpoint", children: /* @__PURE__ */ e(W, { size: "small", onClick: (A) => {
1282
+ A.stopPropagation(), d(C.tokenUrl, "Token endpoint copied to clipboard");
1283
+ }, children: /* @__PURE__ */ e(ve, { size: 14 }) }) })
1284
+ ] }) })
1285
+ ] }) })
1286
+ ] }) }) : /* @__PURE__ */ e(h.Container, { children: /* @__PURE__ */ e(h.EmptyState, { illustration: /* @__PURE__ */ e(Ee, { size: 56 }), title: "No identity providers in this environment", description: "Each environment automatically gets a Thunder identity provider." }) })
1287
+ ] })
1288
+ ] }), n[29] = l, n[30] = y, n[31] = x, n[32] = d, n[33] = z, n[34] = I, n[35] = c, n[36] = E, n[37] = o, n[38] = t, n[39] = C, n[40] = ee) : ee = n[40];
1289
+ let de;
1290
+ return n[41] !== P || n[42] !== q || n[43] !== p || n[44] !== J || n[45] !== Q || n[46] !== Z || n[47] !== ee || n[48] !== Y || n[49] !== G ? (de = /* @__PURE__ */ i(we, { title: q, backHref: P, backLabel: "Back to Environments", description: Y, isLoading: p, disableIcon: !0, titleTail: G, children: [
1291
+ J,
1292
+ Q,
1293
+ Z,
1294
+ ee
1295
+ ] }), n[41] = P, n[42] = q, n[43] = p, n[44] = J, n[45] = Q, n[46] = Z, n[47] = ee, n[48] = Y, n[49] = G, n[50] = de) : de = n[50], de;
1296
+ }
1297
+ function Qn(n, t) {
1298
+ return /* @__PURE__ */ e(R, { variant: "rounded", height: 56 }, t);
1299
+ }
1300
+ const Zn = "environment-create-drawer", et = "environment-delete-drawer";
1301
+ function $e() {
1302
+ const n = ae(20), {
1303
+ orgId: t
1304
+ } = oe(), [r, o] = D(null), [a, s] = D(null), [l, p] = D(!1), y = Te(Zn)[0], f = Te(et)[0], v = y?.component ?? Vn, u = f?.component ?? qn;
1305
+ let c;
1306
+ n[0] === Symbol.for("react.memo_cache_sentinel") ? (c = /* @__PURE__ */ e(ie, { index: !0, element: /* @__PURE__ */ e(we, { title: "Environments", disableIcon: !0, children: /* @__PURE__ */ e(Wn, { onEditEnvironment: o, onCreateEnvironment: () => p(!0), onDeleteEnvironment: s }) }) }), n[0] = c) : c = n[0];
1307
+ let m;
1308
+ n[1] === Symbol.for("react.memo_cache_sentinel") ? (m = /* @__PURE__ */ e(ie, { path: ":envName", element: /* @__PURE__ */ e(Jn, {}) }), n[1] = m) : m = n[1];
1309
+ const P = `/org/${t}/environments`;
1310
+ let w;
1311
+ n[2] !== P ? (w = /* @__PURE__ */ i(qe, { children: [
1312
+ c,
1313
+ m,
1314
+ /* @__PURE__ */ e(ie, { path: "*", element: /* @__PURE__ */ e(Ke, { to: P, replace: !0 }) })
1315
+ ] }), n[2] = P, n[3] = w) : w = n[3];
1316
+ let x;
1317
+ n[4] !== v || n[5] !== l || n[6] !== t ? (x = l && t && /* @__PURE__ */ e(v, { open: l, onClose: () => p(!1), orgId: t }), n[4] = v, n[5] = l, n[6] = t, n[7] = x) : x = n[7];
1318
+ let S;
1319
+ n[8] !== r || n[9] !== t ? (S = r && t && /* @__PURE__ */ e(Hn, { open: !0, onClose: () => o(null), environment: r, orgId: t }), n[8] = r, n[9] = t, n[10] = S) : S = n[10];
1320
+ let N;
1321
+ n[11] !== u || n[12] !== a || n[13] !== t ? (N = a && t && /* @__PURE__ */ e(u, { open: !0, onClose: () => s(null), environment: a, orgId: t }), n[11] = u, n[12] = a, n[13] = t, n[14] = N) : N = n[14];
1322
+ let E;
1323
+ return n[15] !== w || n[16] !== x || n[17] !== S || n[18] !== N ? (E = /* @__PURE__ */ i(te, { children: [
1324
+ w,
1325
+ x,
1326
+ S,
1327
+ N
1328
+ ] }), n[15] = w, n[16] = x, n[17] = S, n[18] = N, n[19] = E) : E = n[19], E;
1329
+ }
1330
+ const ut = {
1331
+ title: "Deployment Pipelines",
1332
+ description: "A page component for Deployment Pipeline and Environment management",
1333
+ icon: fn,
1334
+ path: "/deployment-pipelines",
1335
+ component: Ie,
1336
+ levels: {
1337
+ organization: Ie
1338
+ }
1339
+ }, gt = {
1340
+ title: "Environments",
1341
+ description: "A page component for Environment management",
1342
+ icon: Ue,
1343
+ path: "/environments",
1344
+ component: $e,
1345
+ levels: {
1346
+ organization: $e
1347
+ }
1348
+ };
1349
+ export {
1350
+ Ie as DeploymentPipelinesOrganization,
1351
+ $e as EnvironmentsOrganization,
1352
+ gt as environmentsMetaData,
1353
+ ut as metaData
1354
+ };