@wso2/am-core-ui 0.0.18 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/APIKeysManager-C0phJriD.js +241 -0
  2. package/dist/CatalogKindListing-DtFI2YMG.js +118 -0
  3. package/dist/CodeBlock-mB_Loq7I.js +21736 -0
  4. package/dist/EnvironmentCard-09h1XRxx.js +310 -0
  5. package/dist/EnvironmentSelector-B7Bl93s2.js +48 -0
  6. package/dist/MCPLogo-D9IJzzl7.js +30 -0
  7. package/dist/PolicyListSection-o4k9e8XO.js +2475 -0
  8. package/dist/ResourceListShell-Cx6mdeqv.js +463 -0
  9. package/dist/SwaggerSpecViewer-BvkhoKsi.js +106 -0
  10. package/dist/clipboard-YAzStmkw.js +23 -0
  11. package/dist/debounce-BV83M53b.js +208 -0
  12. package/dist/format-BEZZRyE2.js +29 -0
  13. package/dist/formatDistanceToNow-TErllcH8.js +100 -0
  14. package/dist/gatewayScripts-D8O45W8u.js +72 -0
  15. package/dist/highlight-BsUzxSR3.js +454 -0
  16. package/dist/index-B52h3RHg.js +1290 -0
  17. package/dist/index-BP5drcF2.js +1265 -0
  18. package/dist/index-BZ4vxviI.js +7981 -0
  19. package/dist/index-B_Z0MwXk.js +25012 -0
  20. package/dist/index-BfjzUWDa.js +1397 -0
  21. package/dist/{index-DYV1jEai.js → index-BnV-PkwM.js} +22 -20
  22. package/dist/index-CGDYgUCH.js +711 -0
  23. package/dist/index-COt7nJIf.js +2286 -0
  24. package/dist/index-CWZjOy1h.js +2247 -0
  25. package/dist/index-CezvogTQ.js +116 -0
  26. package/dist/index-CgCWbWzN.js +2342 -0
  27. package/dist/index-CjCkcuuI.js +322 -0
  28. package/dist/index-CjXvuf9m.js +1354 -0
  29. package/dist/index-DD4qF7gq.js +2340 -0
  30. package/dist/index-DeQ-9KTC.js +737 -0
  31. package/dist/index-Df6OBy4E.js +3041 -0
  32. package/dist/index-KRsV2L4V.js +1564 -0
  33. package/dist/index-PUuASE1F.js +2507 -0
  34. package/dist/index-PWsNvJB-.js +546 -0
  35. package/dist/index-UqDmyMSA.js +119 -0
  36. package/dist/index-_0Pj_ZtW.js +459 -0
  37. package/dist/{index-CnXsN5I3.js → index-sr-mWz4T.js} +31 -30
  38. package/dist/index.d.ts +496 -200
  39. package/dist/index.js +462 -439
  40. package/dist/llmProviderPayload-CzihkdNa.js +332 -0
  41. package/dist/schemas-DFScWdSL.js +2969 -0
  42. package/package.json +1 -1
  43. package/dist/index-B47EJCom.js +0 -236
  44. package/dist/index-Bl1Y7Sro.js +0 -3037
  45. package/dist/index-DlS9Lybj.js +0 -80691
@@ -0,0 +1,1397 @@
1
+ import { Plus as Le, AlertTriangle as Ve, DoorClosedLocked as Xe, Search as wt, Edit as Ze, Trash as Pe, Check as bt, KeyRound as De, EyeOff as xt, Eye as Ct, Copy as et, RefreshCw as St, Server as tt, Cloud as nt, Computer as kt } from "@wso2/oxygen-ui-icons-react";
2
+ import { jsxs as a, jsx as t, Fragment as de } from "react/jsx-runtime";
3
+ import { c as ve } from "react/compiler-runtime";
4
+ import { useState as L, useMemo as he, Fragment as Nt, useRef as Rt, useEffect as Ie, useCallback as le } from "react";
5
+ import { useNavigate as at, useParams as Ae, Link as He, generatePath as ge, useSearchParams as Me, Route as Ee, Routes as It, Navigate as Tt } from "react-router-dom";
6
+ import { G as it, p as rt, z as Oe, bt as At, g as fe, r as ot, bu as Et, P as Be, bv as zt, bw as Pt, q as Gt, bx as _t, by as Lt, n as lt, D as st, m as ct, bz as Dt, bA as Ut, bB as Wt, bC as $t, bD as Ft, H as Vt, bE as Mt } from "./index-B_Z0MwXk.js";
7
+ import { Stack as k, Box as P, SearchBar as Ot, Button as te, ListingTable as N, Alert as ne, Skeleton as U, Typography as l, Avatar as dt, Chip as Re, Tooltip as Te, IconButton as ke, useTheme as Bt, Form as oe, TextField as me, Select as Ue, MenuItem as We, Collapse as mt, FormControl as ye, FormLabel as pe, FormControlLabel as Ht, Checkbox as qt, Card as ce, CardContent as Ge, Tab as Se, Tabs as ht, Grid as we, Snackbar as jt } from "@wso2/oxygen-ui";
8
+ import "@tanstack/react-query";
9
+ import { f as Kt, g as Jt } from "./format-BEZZRyE2.js";
10
+ import { G as ut, g as Qt, a as Yt, b as $e, c as Fe, d as yt, e as pt } from "./gatewayScripts-D8O45W8u.js";
11
+ import { o as gt, c as Xt, s as Ne, b as ft } from "./schemas-DFScWdSL.js";
12
+ import { u as vt } from "./clipboard-YAzStmkw.js";
13
+ import { f as Zt } from "./formatDistanceToNow-TErllcH8.js";
14
+ const en = {
15
+ width: 28,
16
+ height: 28,
17
+ fontSize: 12,
18
+ bgcolor: "primary.main",
19
+ color: "primary.contrastText"
20
+ }, tn = (n, e) => [n.name ?? "", n.displayName ?? "", n.vhost ?? ""].join(" ").toLowerCase().includes(e);
21
+ function nn({
22
+ onEditGateway: n
23
+ }) {
24
+ const e = at(), {
25
+ orgId: r
26
+ } = Ae(), [m, c] = L(""), {
27
+ addConfirmation: s
28
+ } = it(), {
29
+ data: d,
30
+ isLoading: R,
31
+ error: f,
32
+ refetch: x
33
+ } = rt({
34
+ orgName: r
35
+ }), {
36
+ data: v,
37
+ isLoading: o,
38
+ error: b
39
+ } = Oe({
40
+ orgName: r
41
+ }), y = R || o, i = f || b, {
42
+ mutateAsync: g
43
+ } = At(), S = he(() => d?.gateways ?? [], [d]), h = he(() => {
44
+ const w = m.trim().toLowerCase();
45
+ return w ? S.filter((u) => tn(u, w)) : S;
46
+ }, [S, m]), G = he(() => {
47
+ const w = (v ?? []).map((p) => ({
48
+ key: p.name,
49
+ title: p.displayName || p.name,
50
+ gateways: h.filter((I) => I.environments?.some((T) => T.name === p.name))
51
+ })).filter((p) => p.gateways.length > 0), u = h.filter((p) => !p.environments?.length);
52
+ return u.length && w.push({
53
+ key: "__unassigned__",
54
+ title: "Unassigned",
55
+ gateways: u
56
+ }), w;
57
+ }, [v, h]), A = /* @__PURE__ */ a(k, { direction: "row", spacing: 1, alignItems: "center", children: [
58
+ /* @__PURE__ */ t(P, { flexGrow: 1, children: /* @__PURE__ */ t(Ot, { placeholder: "Search Gateways...", size: "small", fullWidth: !0, value: m, onChange: (w) => c(w.target.value), disabled: y }) }),
59
+ S.length > 0 && /* @__PURE__ */ t(te, { component: He, to: ge(fe.children.org.children.gateways.children.add.path, {
60
+ orgId: r
61
+ }), variant: "contained", color: "primary", startIcon: /* @__PURE__ */ t(Le, { size: 16 }), children: "Add Gateway" })
62
+ ] }), E = (w) => {
63
+ const u = w.displayName || w.name, p = w.status === "ACTIVE", I = Kt(w.updatedAt);
64
+ return /* @__PURE__ */ a(N.Row, { variant: "card", hover: !0, clickable: !0, onClick: () => e(ge(fe.children.org.children.gateways.children.view.path, {
65
+ orgId: r ?? "",
66
+ gatewayId: w.uuid
67
+ })), children: [
68
+ /* @__PURE__ */ t(N.Cell, { children: /* @__PURE__ */ t(N.CellIcon, { icon: /* @__PURE__ */ t(dt, { sx: en, children: Jt(u, {
69
+ fallback: "G",
70
+ maxChars: 1
71
+ }) }), primary: u }) }),
72
+ /* @__PURE__ */ t(N.Cell, { align: "left", children: /* @__PURE__ */ t(ut, { type: w.gatewayType }) }),
73
+ /* @__PURE__ */ t(N.Cell, { align: "center", children: /* @__PURE__ */ t(Re, { label: p ? "Active" : "Inactive", size: "small", variant: "outlined", color: p ? "success" : "default" }) }),
74
+ /* @__PURE__ */ t(N.Cell, { align: "right", children: /* @__PURE__ */ t(l, { variant: "caption", color: "text.secondary", children: I }) }),
75
+ /* @__PURE__ */ t(N.Cell, { align: "center", children: /* @__PURE__ */ a(N.RowActions, { visibility: "hover", children: [
76
+ /* @__PURE__ */ t(Te, { title: "Edit", children: /* @__PURE__ */ t(ke, { size: "small", onClick: (T) => {
77
+ T.stopPropagation(), n?.(w);
78
+ }, children: /* @__PURE__ */ t(Ze, { size: 16 }) }) }),
79
+ /* @__PURE__ */ t(Te, { title: "Delete", children: /* @__PURE__ */ t(ke, { color: "error", size: "small", onClick: (T) => {
80
+ T.stopPropagation(), s({
81
+ title: "Delete Gateway",
82
+ description: `Are you sure you want to delete ${u}?`,
83
+ confirmButtonText: "Delete",
84
+ confirmButtonColor: "error",
85
+ confirmButtonIcon: /* @__PURE__ */ t(Pe, { size: 16 }),
86
+ onConfirm: async () => {
87
+ await g({
88
+ orgName: r ?? "",
89
+ gatewayId: w.uuid
90
+ }), x();
91
+ }
92
+ });
93
+ }, children: /* @__PURE__ */ t(Pe, { size: 16 }) }) })
94
+ ] }) })
95
+ ] }, w.uuid);
96
+ };
97
+ return /* @__PURE__ */ a(k, { spacing: 1, children: [
98
+ A,
99
+ (() => {
100
+ if (i) {
101
+ const w = f ? "gateways" : "environments";
102
+ return /* @__PURE__ */ t(N.Container, { children: /* @__PURE__ */ a(ne, { severity: "error", icon: /* @__PURE__ */ t(Ve, { size: 18 }), sx: {
103
+ alignSelf: "stretch"
104
+ }, children: [
105
+ "Failed to load ",
106
+ w,
107
+ ".",
108
+ " ",
109
+ i instanceof Error ? i.message : "Please try again."
110
+ ] }) });
111
+ }
112
+ return y ? /* @__PURE__ */ t(N.Container, { disablePaper: !0, children: /* @__PURE__ */ t(k, { spacing: 1, mt: 1, children: Array.from({
113
+ length: 5
114
+ }).map((w, u) => /* @__PURE__ */ a(k, { direction: "row", alignItems: "center", spacing: 2, sx: {
115
+ px: 2,
116
+ py: 1.5,
117
+ borderRadius: 1,
118
+ border: "1px solid",
119
+ borderColor: "divider",
120
+ bgcolor: "background.paper"
121
+ }, children: [
122
+ /* @__PURE__ */ a(k, { direction: "row", alignItems: "center", spacing: 1.5, sx: {
123
+ width: 300,
124
+ flexShrink: 0
125
+ }, children: [
126
+ /* @__PURE__ */ t(U, { variant: "circular", width: 36, height: 36 }),
127
+ /* @__PURE__ */ t(U, { variant: "text", width: 140, height: 20 })
128
+ ] }),
129
+ /* @__PURE__ */ t(U, { variant: "rounded", width: 72, height: 24, sx: {
130
+ flexShrink: 0
131
+ } }),
132
+ /* @__PURE__ */ t(U, { variant: "text", sx: {
133
+ flex: 1
134
+ }, height: 18 }),
135
+ /* @__PURE__ */ t(U, { variant: "rounded", width: 100, height: 24, sx: {
136
+ flexShrink: 0,
137
+ ml: "auto"
138
+ } })
139
+ ] }, u)) }) }) : S.length === 0 ? /* @__PURE__ */ t(N.Container, { children: /* @__PURE__ */ t(N.EmptyState, { illustration: /* @__PURE__ */ t(Xe, { size: 64 }), title: "No available gateway", description: "Add a gateway to manage and monitor your gateway deployments.", action: /* @__PURE__ */ t(te, { component: He, to: ge(fe.children.org.children.gateways.children.add.path, {
140
+ orgId: r
141
+ }), variant: "contained", startIcon: /* @__PURE__ */ t(Le, { size: 16 }), children: "Add Gateway" }) }) }) : h.length === 0 ? /* @__PURE__ */ t(N.Container, { children: /* @__PURE__ */ t(N.EmptyState, { illustration: /* @__PURE__ */ t(wt, { size: 64 }), title: "No Gateways found.", description: "Try a different keyword or clear the search filter." }) }) : /* @__PURE__ */ t(k, { pt: 3, children: /* @__PURE__ */ t(N.Container, { disablePaper: !0, children: /* @__PURE__ */ a(N, { variant: "card", children: [
142
+ /* @__PURE__ */ t(N.Head, { children: /* @__PURE__ */ a(N.Row, { children: [
143
+ /* @__PURE__ */ t(N.Cell, { children: "Name" }),
144
+ /* @__PURE__ */ t(N.Cell, { align: "left", width: "120px", children: "Type" }),
145
+ /* @__PURE__ */ t(N.Cell, { align: "center", width: "120px", children: "Status" }),
146
+ /* @__PURE__ */ t(N.Cell, { align: "right", width: "140px", children: "Last Updated" }),
147
+ /* @__PURE__ */ t(N.Cell, { align: "center", width: "96px" })
148
+ ] }) }),
149
+ /* @__PURE__ */ t(N.Body, { children: G.map((w) => /* @__PURE__ */ a(Nt, { children: [
150
+ /* @__PURE__ */ t(N.Row, { children: /* @__PURE__ */ t(N.Cell, { colSpan: 5, sx: {
151
+ "&&": {
152
+ border: 0,
153
+ p: 0
154
+ }
155
+ }, children: /* @__PURE__ */ t(l, { variant: "overline", color: "text.secondary", children: w.title }) }) }),
156
+ w.gateways.map(E)
157
+ ] }, w.key)) })
158
+ ] }) }) });
159
+ })()
160
+ ] });
161
+ }
162
+ const an = (n) => {
163
+ if (!n || typeof n != "string") return !1;
164
+ const e = n.trim();
165
+ if (!e) return !1;
166
+ if (e.startsWith("*."))
167
+ try {
168
+ return new URL(`https://${e.slice(2)}`), !0;
169
+ } catch {
170
+ return !1;
171
+ }
172
+ try {
173
+ return new URL(e.includes("://") ? e : `https://${e}`), !0;
174
+ } catch {
175
+ return !1;
176
+ }
177
+ }, rn = /^[a-z0-9-]+$/, qe = gt({
178
+ displayName: Ne().trim().min(3, "Display name is required, minimum 3 characters").max(128, "Display name must be at most 128 characters"),
179
+ name: Ne().trim().min(1, "Name is required").max(64, "Name must be at most 64 characters").regex(rn, "Name must be lowercase alphanumeric with hyphens only (e.g. ai-gateway-prod)"),
180
+ vhost: Ne().trim().min(3, "Virtual host is required, minimum 3 characters").max(253, "Virtual host must be at most 253 characters").refine(an, {
181
+ message: "Enter a valid URL or hostname (e.g., api.example.com)"
182
+ }),
183
+ isCritical: ft(),
184
+ environmentIds: Xt(Ne()).min(1, "Select an environment").max(1, "A gateway can be assigned to only one environment")
185
+ }), je = gt({
186
+ displayName: Ne().trim().min(3, "Display name is required").max(128, "Display name must be at most 128 characters"),
187
+ isCritical: ft()
188
+ }), on = "env";
189
+ function ln(n) {
190
+ return n.toLowerCase().trim().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "").replace(/^-+|-+$/g, "");
191
+ }
192
+ const sn = ({
193
+ formData: n,
194
+ setFormData: e,
195
+ errors: r,
196
+ setFieldError: m,
197
+ validateField: c
198
+ }) => {
199
+ const {
200
+ orgId: s
201
+ } = Ae(), [d] = Me(), R = Bt(), {
202
+ data: f = []
203
+ } = Oe({
204
+ orgName: s
205
+ }), x = d.get(on), v = f.find((i) => i.name === x), o = Rt(!1);
206
+ Ie(() => {
207
+ if (f.length > 0 && !o.current) {
208
+ o.current = !0;
209
+ const i = v?.id ?? f[0].id;
210
+ i && e((g) => ({
211
+ ...g,
212
+ environmentIds: [i]
213
+ }));
214
+ }
215
+ }, [f, v, e]);
216
+ const b = le((i, g) => {
217
+ const S = {
218
+ ...n,
219
+ [i]: g
220
+ };
221
+ e(S);
222
+ const h = c(i, g, S);
223
+ m(i, h);
224
+ }, [n, e, c, m]);
225
+ Ie(() => {
226
+ if (n.displayName) {
227
+ const i = ln(n.displayName);
228
+ if (i !== n.name) {
229
+ e((S) => ({
230
+ ...S,
231
+ name: i
232
+ }));
233
+ const g = c("name", i, {
234
+ ...n,
235
+ name: i
236
+ });
237
+ m("name", g);
238
+ }
239
+ }
240
+ }, [n.displayName, m]);
241
+ const y = n.name && /^[a-z0-9-]+$/.test(n.name) && n.name.length <= 64;
242
+ return /* @__PURE__ */ t(oe.Stack, { spacing: 3, children: /* @__PURE__ */ a(oe.Section, { children: [
243
+ /* @__PURE__ */ t(oe.Subheader, { children: "Gateway Details" }),
244
+ /* @__PURE__ */ a(oe.Stack, { spacing: 2, children: [
245
+ /* @__PURE__ */ t(oe.ElementWrapper, { label: "Name", name: "displayName", children: /* @__PURE__ */ t(me, { id: "displayName", placeholder: "e.g., Production Gateway", value: n.displayName, onChange: (i) => b("displayName", i.target.value), error: !!r.displayName || !!r.name, helperText: r.displayName || r.name, fullWidth: !0, slotProps: {
246
+ input: {
247
+ endAdornment: n.displayName && y ? /* @__PURE__ */ t(bt, { size: 20, color: R.vars?.palette.success.main }) : null
248
+ }
249
+ } }) }),
250
+ /* @__PURE__ */ t(oe.ElementWrapper, { label: "Virtual Host", name: "vhost", children: /* @__PURE__ */ t(me, { id: "vhost", placeholder: "e.g., api.production.example.com", value: n.vhost, onChange: (i) => b("vhost", i.target.value), error: !!r.vhost, helperText: r.vhost || "FQDN or IP for the gateway", fullWidth: !0 }) }),
251
+ f.length > 1 && !v?.id && /* @__PURE__ */ t(oe.ElementWrapper, { label: "Environment", name: "environmentIds", children: /* @__PURE__ */ t(Ue, { value: n.environmentIds?.[0] ?? "", onChange: (i) => {
252
+ const g = i.target.value;
253
+ b("environmentIds", g ? [g] : []);
254
+ }, fullWidth: !0, displayEmpty: !0, children: f.filter((i) => i.id).map((i) => /* @__PURE__ */ t(We, { value: i.id, children: i.displayName || i.name }, i.id)) }) })
255
+ ] })
256
+ ] }) });
257
+ }, cn = (n) => {
258
+ const e = ve(18), {
259
+ lastSubmittedValidationErrors: r,
260
+ isPending: m,
261
+ onCancel: c,
262
+ onSubmit: s
263
+ } = n;
264
+ let d;
265
+ e[0] !== r ? (d = Object.values(r), e[0] = r, e[1] = d) : d = e[1];
266
+ const R = d, f = R.length > 0;
267
+ let x;
268
+ e[2] !== R ? (x = /* @__PURE__ */ t(ne, { severity: "error", children: R.map(dn) }), e[2] = R, e[3] = x) : x = e[3];
269
+ let v;
270
+ e[4] !== f || e[5] !== x ? (v = /* @__PURE__ */ t(mt, { in: f, timeout: "auto", unmountOnExit: !0, children: x }), e[4] = f, e[5] = x, e[6] = v) : v = e[6];
271
+ let o;
272
+ e[7] !== c ? (o = /* @__PURE__ */ t(te, { variant: "outlined", color: "primary", size: "medium", onClick: c, children: "Cancel" }), e[7] = c, e[8] = o) : o = e[8];
273
+ let b;
274
+ e[9] !== m || e[10] !== s ? (b = /* @__PURE__ */ t(te, { variant: "contained", color: "primary", size: "medium", onClick: s, disabled: m, children: "Create Gateway" }), e[9] = m, e[10] = s, e[11] = b) : b = e[11];
275
+ let y;
276
+ e[12] !== o || e[13] !== b ? (y = /* @__PURE__ */ a(P, { display: "flex", flexDirection: "row", gap: 1, alignItems: "center", children: [
277
+ o,
278
+ b
279
+ ] }), e[12] = o, e[13] = b, e[14] = y) : y = e[14];
280
+ let i;
281
+ return e[15] !== v || e[16] !== y ? (i = /* @__PURE__ */ a(P, { display: "flex", flexDirection: "column", gap: 3, children: [
282
+ v,
283
+ y
284
+ ] }), e[15] = v, e[16] = y, e[17] = i) : i = e[17], i;
285
+ };
286
+ function dn(n, e) {
287
+ return /* @__PURE__ */ t(P, { children: n }, e);
288
+ }
289
+ function mn(n) {
290
+ return n.toLowerCase().trim().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "").replace(/^-+|-+$/g, "");
291
+ }
292
+ const hn = () => {
293
+ const n = ve(32), {
294
+ orgId: e
295
+ } = Ae(), r = at();
296
+ let m;
297
+ n[0] === Symbol.for("react.memo_cache_sentinel") ? (m = {
298
+ name: "",
299
+ displayName: "",
300
+ vhost: "",
301
+ isCritical: !1,
302
+ environmentIds: []
303
+ }, n[0] = m) : m = n[0];
304
+ const [c, s] = L(m), {
305
+ errors: d,
306
+ validateForm: R,
307
+ setFieldError: f,
308
+ validateField: x
309
+ } = ot(qe), {
310
+ mutate: v,
311
+ isPending: o,
312
+ error: b
313
+ } = Et();
314
+ let y;
315
+ n[1] !== e ? (y = e ? ge(fe.children.org.children.gateways.path, {
316
+ orgId: e
317
+ }) : "#", n[1] = e, n[2] = y) : y = n[2];
318
+ const i = y;
319
+ let g;
320
+ n[3] !== i || n[4] !== r ? (g = () => {
321
+ r(i);
322
+ }, n[3] = i, n[4] = r, n[5] = g) : g = n[5];
323
+ const S = g;
324
+ let h;
325
+ n[6] === Symbol.for("react.memo_cache_sentinel") ? (h = {}, n[6] = h) : h = n[6];
326
+ const [G, A] = L(h);
327
+ let E;
328
+ n[7] !== v || n[8] !== c || n[9] !== r || n[10] !== e || n[11] !== R ? (E = () => {
329
+ const $ = {
330
+ ...c,
331
+ name: c.name || mn(c.displayName)
332
+ }, M = qe.safeParse($);
333
+ if (!M.success) {
334
+ const W = {};
335
+ M.error.issues.forEach((F) => {
336
+ F.path[0] && (W[F.path[0]] = F.message);
337
+ }), A(W), R($);
338
+ return;
339
+ }
340
+ A({});
341
+ const ae = {
342
+ name: $.name.trim(),
343
+ displayName: c.displayName.trim(),
344
+ gatewayType: "AI",
345
+ vhost: c.vhost.trim(),
346
+ isCritical: c.isCritical,
347
+ environmentIds: c.environmentIds
348
+ };
349
+ v({
350
+ params: {
351
+ orgName: e ?? ""
352
+ },
353
+ body: ae
354
+ }, {
355
+ onSuccess: (W) => {
356
+ const F = ge(fe.children.org.children.gateways.children.view.path, {
357
+ orgId: e ?? "",
358
+ gatewayId: W.uuid
359
+ });
360
+ r(F);
361
+ },
362
+ onError: un
363
+ });
364
+ }, n[7] = v, n[8] = c, n[9] = r, n[10] = e, n[11] = R, n[12] = E) : E = n[12];
365
+ const _ = E, w = f, u = x;
366
+ let p;
367
+ n[13] !== d || n[14] !== c || n[15] !== w || n[16] !== u ? (p = /* @__PURE__ */ t(sn, { formData: c, setFormData: s, errors: d, setFieldError: w, validateField: u }), n[13] = d, n[14] = c, n[15] = w, n[16] = u, n[17] = p) : p = n[17];
368
+ let I;
369
+ n[18] !== b ? (I = !!b && /* @__PURE__ */ t(ne, { severity: "error", sx: {
370
+ mt: 2
371
+ }, children: b instanceof Error ? b.message : "Failed to create gateway" }), n[18] = b, n[19] = I) : I = n[19];
372
+ let T;
373
+ n[20] !== S || n[21] !== _ || n[22] !== o || n[23] !== G ? (T = /* @__PURE__ */ t(cn, { lastSubmittedValidationErrors: G, isPending: o, onCancel: S, onSubmit: _ }), n[20] = S, n[21] = _, n[22] = o, n[23] = G, n[24] = T) : T = n[24];
374
+ let z;
375
+ n[25] !== p || n[26] !== I || n[27] !== T ? (z = /* @__PURE__ */ a(oe.Stack, { spacing: 2, children: [
376
+ p,
377
+ I,
378
+ T
379
+ ] }), n[25] = p, n[26] = I, n[27] = T, n[28] = z) : z = n[28];
380
+ let D;
381
+ return n[29] !== i || n[30] !== z ? (D = /* @__PURE__ */ t(Be, { title: "Add Gateway", backHref: i, backLabel: "Back to Gateways", disableIcon: !0, children: z }), n[29] = i, n[30] = z, n[31] = D) : D = n[31], D;
382
+ };
383
+ function un(n) {
384
+ console.error("Failed to create gateway:", n);
385
+ }
386
+ const yn = "manage-identity-provider.sh", pn = "•••••••••••••••";
387
+ function Ke(n) {
388
+ const e = n.mode === "delete" ? [" ACTION=delete \\"] : [` IDP_ISSUER=${n.issuer || "<issuer>"} \\`, ` IDP_JWKS_URI=${n.jwksUri || "<jwks-uri>"} \\`, ...n.skipTlsVerify ? [" IDP_SKIP_TLS_VERIFY=true \\"] : []];
389
+ return [`curl -fsSL ${Qt(yn)} \\`, ` | ORG_NAME=${n.orgId || "<org>"} \\`, ` ENV_NAME=${n.envName || "<env-name>"} \\`, ` GATEWAY_ID=${n.gatewayId || "<gateway-id>"} \\`, ` AGENT_MANAGER_TOKEN=${n.token} \\`, ` CHART_VERSION=${Yt()} \\`, ` IDP_NAME=${n.name || "<identity-provider-name>"} \\`, ...e, " bash"].join(`
390
+ `);
391
+ }
392
+ function gn({
393
+ open: n,
394
+ onClose: e,
395
+ orgId: r,
396
+ mode: m,
397
+ provider: c,
398
+ lockedGateway: s
399
+ }) {
400
+ const d = m === "delete", R = !!s, {
401
+ getToken: f
402
+ } = zt(), [x, v] = L(""), [o, b] = L(""), [y, i] = L(""), [g, S] = L(""), [h, G] = L(""), [A, E] = L(!1), [_, w] = L(""), [u, p] = L(null), I = Pt({
403
+ orgName: r
404
+ }), [T, z] = L(!1), [D, $] = L(null), [M, ae] = L(!1), W = Gt.featureFlags?.enableIdentityProviderManagedMode === !0, F = _t(), K = Lt(), H = F.isPending || K.isPending, J = d ? !!o && !!y : !!o && !!y.trim() && !!g.trim() && !!h.trim(), O = le(async () => {
405
+ try {
406
+ d ? await K.mutateAsync({
407
+ orgName: r,
408
+ gatewayId: o,
409
+ name: y
410
+ }) : await F.mutateAsync({
411
+ params: {
412
+ orgName: r,
413
+ gatewayId: o,
414
+ name: y.trim()
415
+ },
416
+ body: {
417
+ issuer: g.trim(),
418
+ jwksUri: h.trim(),
419
+ skipTlsVerify: A
420
+ }
421
+ }), e();
422
+ } catch {
423
+ }
424
+ }, [d, K, F, r, o, y, g, h, A, e]), {
425
+ data: Q
426
+ } = Oe({
427
+ orgName: r
428
+ }), {
429
+ data: Y
430
+ } = rt({
431
+ orgName: r
432
+ }, x ? {
433
+ environment: x
434
+ } : void 0), V = he(() => Y?.gateways ?? [], [Y]), X = he(() => s ? s.environments : Q ?? [], [s, Q]);
435
+ Ie(() => {
436
+ n && (z(!1), $(null), ae(!1), w(""), p(null), d && c ? (v(c.environmentName ?? ""), b(c.gatewayId ?? ""), i(c.name), S(c.issuer ?? ""), G(c.jwksUri ?? ""), E(c.skipTlsVerify ?? !1)) : (v(s && s.environments.length === 1 ? s.environments[0].name : ""), b(s?.uuid ?? ""), i(""), S(""), G(""), E(!1)));
437
+ }, [n, d, c, s]), Ie(() => {
438
+ d || s || b("");
439
+ }, [x, d, s]);
440
+ const ie = le(async () => {
441
+ if (T) {
442
+ z(!1), $(null);
443
+ return;
444
+ }
445
+ try {
446
+ const C = await f();
447
+ $(C), z(!0);
448
+ } catch {
449
+ }
450
+ }, [T, f]), B = le(async () => {
451
+ const C = _.trim();
452
+ if (C) {
453
+ p(null);
454
+ try {
455
+ const ee = await I.mutateAsync({
456
+ url: C
457
+ });
458
+ S(ee.issuer), G(ee.jwksUri);
459
+ } catch {
460
+ p("Could not discover OIDC configuration from that URL. Check the URL or enter the issuer and JWKS URI manually.");
461
+ }
462
+ }
463
+ }, [_, I]), q = le((C) => ({
464
+ orgId: r,
465
+ envName: x,
466
+ gatewayId: o,
467
+ name: y,
468
+ issuer: g,
469
+ jwksUri: h,
470
+ skipTlsVerify: A,
471
+ mode: m,
472
+ token: C
473
+ }), [r, x, o, y, g, h, A, m]), ue = le(async () => {
474
+ try {
475
+ const C = D ?? await f();
476
+ await navigator.clipboard.writeText(Ke(q(C))), ae(!0), setTimeout(() => ae(!1), 2e3);
477
+ } catch {
478
+ }
479
+ }, [D, f, q]), se = he(() => Ke(q(T && D ? D : pn)), [q, T, D]), re = /* @__PURE__ */ a(ye, { fullWidth: !0, disabled: d, children: [
480
+ /* @__PURE__ */ t(pe, { required: !0, children: "Environment" }),
481
+ /* @__PURE__ */ t(Ue, { size: "small", value: x, displayEmpty: !0, onChange: (C) => v(C.target.value), renderValue: (C) => {
482
+ if (!C) return "Select an environment";
483
+ const ee = X.find((_e) => _e.name === C);
484
+ return ee?.displayName || ee?.name || C;
485
+ }, children: X.map((C) => /* @__PURE__ */ t(We, { value: C.name, children: C.displayName || C.name }, C.name)) })
486
+ ] }), Z = /* @__PURE__ */ a(ye, { fullWidth: !0, disabled: d || !R && !x, children: [
487
+ /* @__PURE__ */ t(pe, { required: !0, children: "Gateway" }),
488
+ R ? /* @__PURE__ */ t(me, { size: "small", fullWidth: !0, value: s?.name ?? "", slotProps: {
489
+ input: {
490
+ readOnly: !0
491
+ }
492
+ }, disabled: !0 }) : /* @__PURE__ */ t(Ue, { size: "small", value: o, displayEmpty: !0, onChange: (C) => b(C.target.value), renderValue: (C) => {
493
+ if (!C) return "Select a gateway";
494
+ const ee = V.find((_e) => _e.uuid === C);
495
+ return ee?.displayName || ee?.name || C;
496
+ }, children: V.map((C) => /* @__PURE__ */ t(We, { value: C.uuid, children: C.displayName || C.name }, C.uuid)) })
497
+ ] });
498
+ return /* @__PURE__ */ a(lt, { open: n, onClose: e, children: [
499
+ /* @__PURE__ */ t(st, { icon: d ? /* @__PURE__ */ t(Pe, { size: 24 }) : /* @__PURE__ */ t(De, { size: 24 }), title: d ? "Remove Identity Provider" : "Add Identity Provider", onClose: e }),
500
+ /* @__PURE__ */ t(ct, { children: /* @__PURE__ */ a(k, { spacing: 3, children: [
501
+ /* @__PURE__ */ t(l, { variant: "body2", color: "text.secondary", children: W ? /* @__PURE__ */ t(de, { children: "Identity providers are owned by the gateway. Agent Manager patches the gateway configuration and applies the change for you." }) : /* @__PURE__ */ a(de, { children: [
502
+ "Identity providers are owned by the gateway. This command patches the gateway configuration and syncs Agent Manager. Run it in a terminal with",
503
+ " ",
504
+ /* @__PURE__ */ t("code", { children: "kubectl" }),
505
+ ", ",
506
+ /* @__PURE__ */ t("code", { children: "helm" }),
507
+ ", and ",
508
+ /* @__PURE__ */ t("code", { children: "jq" }),
509
+ " configured against your cluster — for the quickstart, run it inside the dev container shell."
510
+ ] }) }),
511
+ /* @__PURE__ */ a(k, { spacing: 2, children: [
512
+ R ? /* @__PURE__ */ a(de, { children: [
513
+ Z,
514
+ re
515
+ ] }) : /* @__PURE__ */ a(de, { children: [
516
+ re,
517
+ Z
518
+ ] }),
519
+ /* @__PURE__ */ a(ye, { fullWidth: !0, disabled: d, children: [
520
+ /* @__PURE__ */ t(pe, { required: !0, children: "Name" }),
521
+ /* @__PURE__ */ t(me, { size: "small", fullWidth: !0, value: y, onChange: (C) => i(C.target.value), placeholder: "e.g., AcmeIdP", disabled: d })
522
+ ] }),
523
+ !d && /* @__PURE__ */ a(de, { children: [
524
+ /* @__PURE__ */ a(ye, { fullWidth: !0, children: [
525
+ /* @__PURE__ */ t(pe, { children: "Discover from URL (optional)" }),
526
+ /* @__PURE__ */ a(k, { direction: "row", spacing: 1, children: [
527
+ /* @__PURE__ */ t(me, { size: "small", fullWidth: !0, value: _, onChange: (C) => w(C.target.value), placeholder: "https://idp.example.com (or .well-known URL)" }),
528
+ /* @__PURE__ */ t(te, { variant: "outlined", onClick: B, disabled: !_.trim() || I.isPending, children: I.isPending ? "Fetching…" : "Fetch" })
529
+ ] }),
530
+ /* @__PURE__ */ t(l, { variant: "caption", color: "text.secondary", children: "Auto-fills the issuer and JWKS URI from the provider's OpenID configuration." })
531
+ ] }),
532
+ u && /* @__PURE__ */ t(ne, { severity: "warning", children: u }),
533
+ /* @__PURE__ */ a(ye, { fullWidth: !0, children: [
534
+ /* @__PURE__ */ t(pe, { required: !0, children: "Issuer" }),
535
+ /* @__PURE__ */ t(me, { size: "small", fullWidth: !0, value: g, onChange: (C) => S(C.target.value), placeholder: "https://idp.example.com" })
536
+ ] }),
537
+ /* @__PURE__ */ a(ye, { fullWidth: !0, children: [
538
+ /* @__PURE__ */ t(pe, { required: !0, children: "JWKS URI" }),
539
+ /* @__PURE__ */ t(me, { size: "small", fullWidth: !0, value: h, onChange: (C) => G(C.target.value), placeholder: "https://idp.example.com/oauth2/jwks" })
540
+ ] }),
541
+ /* @__PURE__ */ t(Ht, { control: /* @__PURE__ */ t(qt, { checked: A, onChange: (C) => E(C.target.checked) }), label: "Skip TLS verification when fetching JWKS (trusted internal only)" })
542
+ ] })
543
+ ] }),
544
+ !W && /* @__PURE__ */ a(k, { spacing: 1, children: [
545
+ /* @__PURE__ */ t(l, { variant: "body2", children: "Run this command:" }),
546
+ /* @__PURE__ */ a(P, { sx: {
547
+ position: "relative",
548
+ bgcolor: "grey.900",
549
+ borderRadius: 1,
550
+ p: 2,
551
+ pr: 8,
552
+ fontFamily: "monospace",
553
+ fontSize: "0.8125rem",
554
+ color: "grey.100",
555
+ whiteSpace: "pre",
556
+ overflowX: "auto"
557
+ }, children: [
558
+ /* @__PURE__ */ a(P, { sx: {
559
+ position: "absolute",
560
+ top: 6,
561
+ right: 6,
562
+ display: "flex",
563
+ gap: 0.5
564
+ }, children: [
565
+ /* @__PURE__ */ t(Te, { title: T ? "Hide token" : "Show token", children: /* @__PURE__ */ t(ke, { size: "small", onClick: ie, sx: {
566
+ color: "grey.400"
567
+ }, children: T ? /* @__PURE__ */ t(xt, { size: 16 }) : /* @__PURE__ */ t(Ct, { size: 16 }) }) }),
568
+ /* @__PURE__ */ t(Te, { title: M ? "Copied!" : "Copy", children: /* @__PURE__ */ t(ke, { size: "small", onClick: ue, sx: {
569
+ color: M ? "success.light" : "grey.400"
570
+ }, children: /* @__PURE__ */ t(et, { size: 16 }) }) })
571
+ ] }),
572
+ se
573
+ ] }),
574
+ /* @__PURE__ */ t(l, { variant: "caption", color: "text.secondary", children: "Your access token will be substituted when you copy." })
575
+ ] }),
576
+ !W && /* @__PURE__ */ t(ne, { severity: "info", children: "Once the script completes, the list reflects the change. The script is idempotent — safe to re-run." }),
577
+ /* @__PURE__ */ a(P, { display: "flex", justifyContent: "flex-end", gap: 1, children: [
578
+ /* @__PURE__ */ t(te, { variant: "outlined", color: "inherit", onClick: e, children: W ? "Cancel" : "Close" }),
579
+ W && /* @__PURE__ */ t(te, { variant: "contained", color: d ? "error" : "primary", onClick: O, disabled: !J || H, children: H ? d ? "Removing…" : "Saving…" : d ? "Remove" : "Add" })
580
+ ] })
581
+ ] }) })
582
+ ] });
583
+ }
584
+ function fn({
585
+ orgId: n,
586
+ gatewayId: e,
587
+ gatewayName: r,
588
+ environments: m
589
+ }) {
590
+ const [c, s] = L(null), [d, R] = L("upsert"), [f, x] = L(null), [v, o] = L(!1), {
591
+ data: b,
592
+ isLoading: y,
593
+ error: i
594
+ } = Dt({
595
+ orgName: n
596
+ }), g = he(() => (b?.list ?? []).filter((u) => u.gatewayId === e), [b, e]), S = () => {
597
+ R("upsert"), x(null), o(!0);
598
+ }, h = (u) => {
599
+ R("delete"), x(u), o(!0);
600
+ }, G = (u) => `${u.environmentName ?? ""}:${u.name}`, A = he(() => ({
601
+ uuid: e,
602
+ name: r,
603
+ environments: m
604
+ }), [e, r, m]), E = /* @__PURE__ */ t(te, { variant: "contained", color: "primary", size: "small", startIcon: /* @__PURE__ */ t(Le, { size: 16 }), onClick: S, children: "Add Identity Provider" }), _ = /* @__PURE__ */ t(gn, { open: v, onClose: () => o(!1), orgId: n, mode: d, provider: f, lockedGateway: A }), w = () => i ? /* @__PURE__ */ t(ne, { severity: "error", icon: /* @__PURE__ */ t(Ve, { size: 18 }), children: i instanceof Error ? i.message : "Failed to load identity providers. Please try again." }) : y ? /* @__PURE__ */ t(k, { spacing: 1, children: Array.from({
605
+ length: 2
606
+ }).map((u, p) => /* @__PURE__ */ a(k, { direction: "row", alignItems: "center", spacing: 2, sx: {
607
+ px: 2,
608
+ py: 1.5,
609
+ borderRadius: 1,
610
+ border: "1px solid",
611
+ borderColor: "divider"
612
+ }, children: [
613
+ /* @__PURE__ */ t(U, { variant: "circular", width: 28, height: 28, sx: {
614
+ flexShrink: 0
615
+ } }),
616
+ /* @__PURE__ */ t(U, { variant: "text", width: 160, height: 20 }),
617
+ /* @__PURE__ */ t(U, { variant: "rounded", width: 72, height: 24, sx: {
618
+ flexShrink: 0
619
+ } }),
620
+ /* @__PURE__ */ t(U, { variant: "text", sx: {
621
+ flex: 1
622
+ }, height: 18 })
623
+ ] }, p)) }) : g.length ? /* @__PURE__ */ a(N, { variant: "card", children: [
624
+ /* @__PURE__ */ t(N.Head, { children: /* @__PURE__ */ a(N.Row, { children: [
625
+ /* @__PURE__ */ t(N.Cell, { width: "220px", children: "Name" }),
626
+ /* @__PURE__ */ t(N.Cell, { width: "110px", children: "Type" }),
627
+ /* @__PURE__ */ t(N.Cell, { children: "Issuer" }),
628
+ /* @__PURE__ */ t(N.Cell, { width: "160px", align: "right", children: "Environment" })
629
+ ] }) }),
630
+ /* @__PURE__ */ t(N.Body, { children: g.map((u) => {
631
+ const p = G(u), I = u.type === "system";
632
+ return /* @__PURE__ */ a(N.Row, { variant: "card", hover: !0, onMouseEnter: () => s(p), onMouseLeave: () => s(null), onFocus: () => s(p), onBlur: () => s(null), children: [
633
+ /* @__PURE__ */ t(N.Cell, { children: /* @__PURE__ */ t(N.CellIcon, { icon: /* @__PURE__ */ t(dt, { sx: {
634
+ width: 28,
635
+ height: 28,
636
+ bgcolor: I ? "action.selected" : "primary.main",
637
+ color: I ? "text.secondary" : "primary.contrastText"
638
+ }, children: /* @__PURE__ */ t(De, { size: 16 }) }), primary: u.name }) }),
639
+ /* @__PURE__ */ t(N.Cell, { children: /* @__PURE__ */ t(Re, { label: I ? "System" : "Custom", size: "small", color: I ? "default" : "primary", variant: "outlined" }) }),
640
+ /* @__PURE__ */ t(N.Cell, { children: /* @__PURE__ */ t(l, { variant: "caption", color: "text.secondary", sx: {
641
+ wordBreak: "break-all"
642
+ }, children: u.issuer || "—" }) }),
643
+ /* @__PURE__ */ t(N.Cell, { align: "right", children: /* @__PURE__ */ t(k, { direction: "row", alignItems: "center", spacing: 1, justifyContent: "flex-end", sx: {
644
+ minHeight: 32
645
+ }, children: c === p && !I ? /* @__PURE__ */ t(Te, { title: "Remove identity provider", children: /* @__PURE__ */ t(ke, { color: "error", size: "small", onClick: () => h(u), children: /* @__PURE__ */ t(Pe, { size: 16 }) }) }) : /* @__PURE__ */ t(l, { variant: "caption", color: "text.secondary", noWrap: !0, title: u.environmentName || void 0, children: u.environmentName || "—" }) }) })
646
+ ] }, p);
647
+ }) })
648
+ ] }) : /* @__PURE__ */ t(N.Container, { children: /* @__PURE__ */ t(N.EmptyState, { illustration: /* @__PURE__ */ t(De, { size: 48 }), title: "No identity providers configured", description: "Add an identity provider (token issuer) so agents on this gateway can authenticate callers with OAuth.", action: E }) });
649
+ return /* @__PURE__ */ a(ce, { variant: "outlined", children: [
650
+ /* @__PURE__ */ t(Ge, { sx: {
651
+ p: 3
652
+ }, children: /* @__PURE__ */ a(k, { spacing: 2, children: [
653
+ /* @__PURE__ */ a(k, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [
654
+ /* @__PURE__ */ a(k, { spacing: 0.5, children: [
655
+ /* @__PURE__ */ t(l, { variant: "h6", children: "Identity Providers" }),
656
+ /* @__PURE__ */ t(l, { variant: "body2", color: "text.secondary", children: "Token issuers configured on this gateway. Secure agent endpoints with OAuth." })
657
+ ] }),
658
+ !y && !i && g.length > 0 ? E : null
659
+ ] }),
660
+ w()
661
+ ] }) }),
662
+ _
663
+ ] });
664
+ }
665
+ const vn = {
666
+ "& .MuiInputBase-input": {
667
+ fontFamily: "monospace",
668
+ fontSize: "0.875rem"
669
+ }
670
+ };
671
+ function j(n) {
672
+ const e = ve(9), {
673
+ value: r,
674
+ multiline: m,
675
+ minRows: c,
676
+ onCopy: s,
677
+ copyLabel: d
678
+ } = n, R = c === void 0 ? 1 : c, f = `Copy ${d}`;
679
+ let x;
680
+ e[0] === Symbol.for("react.memo_cache_sentinel") ? (x = /* @__PURE__ */ t(et, { size: 16 }), e[0] = x) : x = e[0];
681
+ let v;
682
+ e[1] !== s || e[2] !== f ? (v = {
683
+ input: {
684
+ readOnly: !0,
685
+ endAdornment: /* @__PURE__ */ t(ke, { size: "small", onClick: s, "aria-label": f, children: x })
686
+ }
687
+ }, e[1] = s, e[2] = f, e[3] = v) : v = e[3];
688
+ let o;
689
+ return e[4] !== R || e[5] !== m || e[6] !== v || e[7] !== r ? (o = /* @__PURE__ */ t(me, { fullWidth: !0, multiline: m, minRows: R, value: r, slotProps: v, sx: vn }), e[4] = R, e[5] = m, e[6] = v, e[7] = r, e[8] = o) : o = e[8], o;
690
+ }
691
+ const Je = "reconfig-tab", wn = [0, 1];
692
+ function bn(n) {
693
+ const e = ve(59), {
694
+ registrationToken: r,
695
+ hasJustRegeneratedToken: m,
696
+ onReconfigure: c,
697
+ isReconfiguring: s,
698
+ onCopy: d
699
+ } = n, [R, f] = Me();
700
+ let x;
701
+ e[0] !== R ? (x = R.get(Je), e[0] = R, e[1] = x) : x = e[1];
702
+ const v = x, o = v != null ? parseInt(v, 10) : 0;
703
+ let b;
704
+ e[2] !== o ? (b = wn.includes(o) ? o : 0, e[2] = o, e[3] = b) : b = e[3];
705
+ const y = b;
706
+ let i;
707
+ e[4] !== f ? (i = (ue, se) => {
708
+ f((re) => {
709
+ const Z = new URLSearchParams(re);
710
+ return Z.set(Je, String(se)), Z;
711
+ }, {
712
+ replace: !0
713
+ });
714
+ }, e[4] = f, e[5] = i) : i = e[5];
715
+ const g = i, S = vt(d);
716
+ if (!r) {
717
+ let ue;
718
+ e[6] === Symbol.for("react.memo_cache_sentinel") ? (ue = {
719
+ p: 3
720
+ }, e[6] = ue) : ue = e[6];
721
+ let se;
722
+ e[7] === Symbol.for("react.memo_cache_sentinel") ? (se = /* @__PURE__ */ t(k, { direction: "row", alignItems: "center", spacing: 1, sx: {
723
+ mb: 2
724
+ }, children: /* @__PURE__ */ t(l, { variant: "h6", children: "Reconfigure Gateway" }) }), e[7] = se) : se = e[7];
725
+ let re;
726
+ e[8] === Symbol.for("react.memo_cache_sentinel") ? (re = /* @__PURE__ */ t(l, { variant: "body2", children: "Generate a new registration token to reconnect or update your gateway configuration. This will revoke the existing token." }), e[8] = re) : re = e[8];
727
+ let Z;
728
+ e[9] === Symbol.for("react.memo_cache_sentinel") ? (Z = /* @__PURE__ */ t(St, { size: 16 }), e[9] = Z) : Z = e[9];
729
+ const C = s ? "Generating..." : "Reconfigure";
730
+ let ee;
731
+ return e[10] !== s || e[11] !== c || e[12] !== C ? (ee = /* @__PURE__ */ t(ce, { variant: "outlined", children: /* @__PURE__ */ a(Ge, { sx: ue, children: [
732
+ se,
733
+ /* @__PURE__ */ a(k, { spacing: 1.5, children: [
734
+ re,
735
+ /* @__PURE__ */ t(P, { children: /* @__PURE__ */ t(te, { variant: "outlined", startIcon: Z, onClick: c, disabled: s, color: "error", children: C }) })
736
+ ] })
737
+ ] }) }), e[10] = s, e[11] = c, e[12] = C, e[13] = ee) : ee = e[13], ee;
738
+ }
739
+ let h;
740
+ e[14] !== r ? (h = $e(r), e[14] = r, e[15] = h) : h = e[15];
741
+ const G = h;
742
+ let A;
743
+ e[16] !== r ? (A = Fe(r, "upgrade"), e[16] = r, e[17] = A) : A = e[17];
744
+ const E = A;
745
+ let _;
746
+ e[18] !== m ? (_ = m && /* @__PURE__ */ t(ne, { severity: "success", children: "New token generated. Update your gateway configuration using the command below, then restart the gateway." }), e[18] = m, e[19] = _) : _ = e[19];
747
+ let w;
748
+ e[20] === Symbol.for("react.memo_cache_sentinel") ? (w = /* @__PURE__ */ a(l, { variant: "body2", color: "text.secondary", children: [
749
+ "Run this command to update ",
750
+ yt(),
751
+ " with the new token."
752
+ ] }), e[20] = w) : w = e[20];
753
+ let u;
754
+ e[21] !== S || e[22] !== G ? (u = () => S(G, "Configure command"), e[21] = S, e[22] = G, e[23] = u) : u = e[23];
755
+ let p;
756
+ e[24] !== u || e[25] !== G ? (p = /* @__PURE__ */ t(j, { value: G, multiline: !0, minRows: 4, onCopy: u, copyLabel: "Configure command" }), e[24] = u, e[25] = G, e[26] = p) : p = e[26];
757
+ let I;
758
+ e[27] !== _ || e[28] !== p ? (I = /* @__PURE__ */ a(k, { spacing: 2, children: [
759
+ _,
760
+ w,
761
+ p
762
+ ] }), e[27] = _, e[28] = p, e[29] = I) : I = e[29];
763
+ const T = I;
764
+ let z;
765
+ e[30] !== m ? (z = m && /* @__PURE__ */ t(ne, { severity: "success", children: "New token generated. Run the helm upgrade command below to reconfigure your gateway." }), e[30] = m, e[31] = z) : z = e[31];
766
+ let D;
767
+ e[32] !== S || e[33] !== E ? (D = () => S(E, "Helm upgrade command"), e[32] = S, e[33] = E, e[34] = D) : D = e[34];
768
+ let $;
769
+ e[35] !== E || e[36] !== D ? ($ = /* @__PURE__ */ t(j, { value: E, multiline: !0, minRows: 4, onCopy: D, copyLabel: "Helm upgrade command" }), e[35] = E, e[36] = D, e[37] = $) : $ = e[37];
770
+ let M;
771
+ e[38] !== z || e[39] !== $ ? (M = /* @__PURE__ */ a(k, { spacing: 2, children: [
772
+ z,
773
+ $
774
+ ] }), e[38] = z, e[39] = $, e[40] = M) : M = e[40];
775
+ const ae = M;
776
+ let W;
777
+ e[41] === Symbol.for("react.memo_cache_sentinel") ? (W = {
778
+ p: 3
779
+ }, e[41] = W) : W = e[41];
780
+ let F;
781
+ e[42] === Symbol.for("react.memo_cache_sentinel") ? (F = /* @__PURE__ */ t(k, { direction: "row", alignItems: "center", spacing: 1, sx: {
782
+ mb: 2
783
+ }, children: /* @__PURE__ */ t(l, { variant: "h6", children: "Reconfigure Gateway" }) }), e[42] = F) : F = e[42];
784
+ let K;
785
+ e[43] === Symbol.for("react.memo_cache_sentinel") ? (K = {
786
+ borderBottom: 1,
787
+ borderColor: "divider",
788
+ mb: 2
789
+ }, e[43] = K) : K = e[43];
790
+ let H;
791
+ e[44] === Symbol.for("react.memo_cache_sentinel") ? (H = /* @__PURE__ */ t(Se, { label: "VM / Docker", icon: /* @__PURE__ */ t(tt, { size: 18 }), iconPosition: "start" }), e[44] = H) : H = e[44];
792
+ let J;
793
+ e[45] === Symbol.for("react.memo_cache_sentinel") ? (J = /* @__PURE__ */ t(Se, { label: "Kubernetes", icon: /* @__PURE__ */ t(nt, { size: 18 }), iconPosition: "start" }), e[45] = J) : J = e[45];
794
+ let O;
795
+ e[46] !== g || e[47] !== y ? (O = /* @__PURE__ */ t(P, { sx: K, children: /* @__PURE__ */ a(ht, { value: y, onChange: g, children: [
796
+ H,
797
+ J
798
+ ] }) }), e[46] = g, e[47] = y, e[48] = O) : O = e[48];
799
+ const Q = y !== 0, Y = y === 0 ? T : null;
800
+ let V;
801
+ e[49] !== Q || e[50] !== Y ? (V = /* @__PURE__ */ t(P, { hidden: Q, children: Y }), e[49] = Q, e[50] = Y, e[51] = V) : V = e[51];
802
+ const X = y !== 1, ie = y === 1 ? ae : null;
803
+ let B;
804
+ e[52] !== X || e[53] !== ie ? (B = /* @__PURE__ */ t(P, { hidden: X, children: ie }), e[52] = X, e[53] = ie, e[54] = B) : B = e[54];
805
+ let q;
806
+ return e[55] !== O || e[56] !== V || e[57] !== B ? (q = /* @__PURE__ */ t(ce, { variant: "outlined", children: /* @__PURE__ */ a(Ge, { sx: W, children: [
807
+ F,
808
+ O,
809
+ V,
810
+ B
811
+ ] }) }), e[55] = O, e[56] = V, e[57] = B, e[58] = q) : q = e[58], q;
812
+ }
813
+ const be = () => {
814
+ const n = pt();
815
+ return `curl -sLO https://github.com/wso2/api-platform/releases/download/ai-gateway/v${n}/wso2apip-ai-gateway-${n}.zip && \\
816
+ unzip wso2apip-ai-gateway-${n}.zip`;
817
+ }, xe = () => `cd wso2apip-ai-gateway-${pt()}`, Ce = () => "docker compose --env-file configs/keys.env up";
818
+ function ze(n) {
819
+ const e = ve(4), {
820
+ value: r,
821
+ index: m,
822
+ children: c
823
+ } = n, s = r !== m;
824
+ let d;
825
+ e[0] === Symbol.for("react.memo_cache_sentinel") ? (d = {
826
+ pt: 2
827
+ }, e[0] = d) : d = e[0];
828
+ const R = r === m ? c : null;
829
+ let f;
830
+ return e[1] !== s || e[2] !== R ? (f = /* @__PURE__ */ t(P, { role: "tabpanel", hidden: s, sx: d, children: R }), e[1] = s, e[2] = R, e[3] = f) : f = e[3], f;
831
+ }
832
+ const Qe = "tab", xn = [0, 1, 2, 3];
833
+ function Cn(n) {
834
+ const e = ve(65), {
835
+ isConfigured: r,
836
+ registrationToken: m,
837
+ hasJustRegeneratedToken: c,
838
+ onRegenerateToken: s,
839
+ isRegeneratingToken: d,
840
+ onCopy: R
841
+ } = n, [f, x] = Me();
842
+ let v;
843
+ e[0] !== f ? (v = f.get(Qe), e[0] = f, e[1] = v) : v = e[1];
844
+ const o = v, b = o != null ? parseInt(o, 10) : 0;
845
+ let y;
846
+ e[2] !== b ? (y = xn.includes(b) ? b : 0, e[2] = b, e[3] = y) : y = e[3];
847
+ const i = y;
848
+ let g;
849
+ e[4] !== x ? (g = (ue, se) => {
850
+ x((re) => {
851
+ const Z = new URLSearchParams(re);
852
+ return Z.set(Qe, String(se)), Z;
853
+ }, {
854
+ replace: !0
855
+ });
856
+ }, e[4] = x, e[5] = g) : g = e[5];
857
+ const S = g, h = vt(R);
858
+ let G;
859
+ e[6] !== h || e[7] !== c || e[8] !== r || e[9] !== d || e[10] !== s || e[11] !== m ? (G = () => m ? /* @__PURE__ */ a(de, { children: [
860
+ c && /* @__PURE__ */ t(ne, { severity: "success", sx: {
861
+ mb: 2
862
+ }, children: "Successfully generated new configurations. Use the updated command below to reconfigure your gateway." }),
863
+ /* @__PURE__ */ a(l, { variant: "body2", color: "text.secondary", sx: {
864
+ mb: 2
865
+ }, children: [
866
+ "Run this command to create ",
867
+ yt(),
868
+ " with the required environment variables:"
869
+ ] }),
870
+ /* @__PURE__ */ t(j, { value: $e(m), multiline: !0, minRows: 4, onCopy: () => h($e(m), "Configure command"), copyLabel: "Configure command" })
871
+ ] }) : /* @__PURE__ */ a(de, { children: [
872
+ /* @__PURE__ */ t(l, { variant: "body2", color: "text.secondary", sx: {
873
+ mb: 2
874
+ }, children: r ? "Regenerate a registration token to configure your gateway." : "Generate a registration token to configure your gateway for the first time." }),
875
+ /* @__PURE__ */ t(te, { variant: "outlined", color: "primary", onClick: s, disabled: d, children: r ? "Reconfigure" : "Configure" })
876
+ ] }), e[6] = h, e[7] = c, e[8] = r, e[9] = d, e[10] = s, e[11] = m, e[12] = G) : G = e[12];
877
+ const A = G;
878
+ let E;
879
+ e[13] !== h || e[14] !== A ? (E = () => /* @__PURE__ */ a(k, { spacing: 3, children: [
880
+ /* @__PURE__ */ a(P, { children: [
881
+ /* @__PURE__ */ t(l, { variant: "h6", sx: {
882
+ mb: 2
883
+ }, children: "Prerequisites" }),
884
+ /* @__PURE__ */ a(k, { component: "ul", spacing: 0.5, sx: {
885
+ pl: 3
886
+ }, children: [
887
+ /* @__PURE__ */ t(l, { component: "li", variant: "body2", color: "text.secondary", children: "cURL installed" }),
888
+ /* @__PURE__ */ t(l, { component: "li", variant: "body2", color: "text.secondary", children: "unzip installed" }),
889
+ /* @__PURE__ */ t(l, { component: "li", variant: "body2", color: "text.secondary", children: "Docker installed and running" })
890
+ ] })
891
+ ] }),
892
+ /* @__PURE__ */ a(P, { children: [
893
+ /* @__PURE__ */ t(l, { variant: "h6", sx: {
894
+ mb: 1
895
+ }, color: "warning.main", children: "Step 1: Download the Gateway" }),
896
+ /* @__PURE__ */ t(l, { variant: "body2", color: "text.secondary", sx: {
897
+ mb: 2
898
+ }, children: "Run this command in your terminal to download the gateway:" }),
899
+ /* @__PURE__ */ t(j, { value: be(), multiline: !0, minRows: 2, onCopy: () => h(be(), "Download command"), copyLabel: "Download command" })
900
+ ] }),
901
+ /* @__PURE__ */ a(P, { children: [
902
+ /* @__PURE__ */ t(l, { variant: "h6", sx: {
903
+ mb: 1
904
+ }, color: "warning.main", children: "Step 2: Configure the Gateway" }),
905
+ A()
906
+ ] }),
907
+ /* @__PURE__ */ a(P, { children: [
908
+ /* @__PURE__ */ t(l, { variant: "h6", sx: {
909
+ mb: 1
910
+ }, color: "warning.main", children: "Step 3: Start the Gateway" }),
911
+ /* @__PURE__ */ t(l, { variant: "body2", color: "text.secondary", sx: {
912
+ mb: 1.5
913
+ }, children: "1. Navigate to the gateway folder." }),
914
+ /* @__PURE__ */ t(j, { value: xe(), onCopy: () => h(xe(), "Navigate command"), copyLabel: "Navigate command" }),
915
+ /* @__PURE__ */ t(l, { variant: "body2", color: "text.secondary", sx: {
916
+ my: 2
917
+ }, children: "2. Run this command to start the gateway using the configs/keys.env file created in Step 2:" }),
918
+ /* @__PURE__ */ t(j, { value: Ce(), onCopy: () => h(Ce(), "Start command"), copyLabel: "Start command" })
919
+ ] })
920
+ ] }), e[13] = h, e[14] = A, e[15] = E) : E = e[15];
921
+ const _ = E;
922
+ let w;
923
+ e[16] !== h || e[17] !== A ? (w = () => /* @__PURE__ */ a(k, { spacing: 3, children: [
924
+ /* @__PURE__ */ a(P, { children: [
925
+ /* @__PURE__ */ t(l, { variant: "h6", sx: {
926
+ mb: 2
927
+ }, children: "Prerequisites" }),
928
+ /* @__PURE__ */ a(k, { component: "ul", spacing: 0.5, sx: {
929
+ pl: 3
930
+ }, children: [
931
+ /* @__PURE__ */ t(l, { component: "li", variant: "body2", color: "text.secondary", children: "cURL installed" }),
932
+ /* @__PURE__ */ t(l, { component: "li", variant: "body2", color: "text.secondary", children: "unzip installed" })
933
+ ] }),
934
+ /* @__PURE__ */ t(l, { variant: "body2", color: "text.secondary", sx: {
935
+ mt: 1.5,
936
+ mb: 1
937
+ }, children: "A Docker-compatible container runtime such as:" }),
938
+ /* @__PURE__ */ a(k, { component: "ul", spacing: 0.5, sx: {
939
+ pl: 3
940
+ }, children: [
941
+ /* @__PURE__ */ t(l, { component: "li", variant: "body2", color: "text.secondary", children: "Docker Desktop (Windows / macOS)" }),
942
+ /* @__PURE__ */ t(l, { component: "li", variant: "body2", color: "text.secondary", children: "Rancher Desktop (Windows / macOS)" }),
943
+ /* @__PURE__ */ t(l, { component: "li", variant: "body2", color: "text.secondary", children: "Colima (macOS)" }),
944
+ /* @__PURE__ */ t(l, { component: "li", variant: "body2", color: "text.secondary", children: "Docker Engine + Compose plugin (Linux)" })
945
+ ] }),
946
+ /* @__PURE__ */ t(l, { variant: "body2", color: "text.secondary", sx: {
947
+ mt: 1.5,
948
+ mb: 1.5
949
+ }, children: "Ensure docker and docker compose commands are available." }),
950
+ /* @__PURE__ */ t(j, { value: "docker --version\\ndocker compose version", multiline: !0, minRows: 2, onCopy: () => h(`docker --version
951
+ docker compose version`, "Prerequisites command"), copyLabel: "Prerequisites command" })
952
+ ] }),
953
+ /* @__PURE__ */ a(P, { children: [
954
+ /* @__PURE__ */ t(l, { variant: "h6", sx: {
955
+ mb: 1
956
+ }, color: "warning.main", children: "Step 1: Download the Gateway" }),
957
+ /* @__PURE__ */ t(l, { variant: "body2", color: "text.secondary", sx: {
958
+ mb: 2
959
+ }, children: "Run this command in your terminal to download the gateway:" }),
960
+ /* @__PURE__ */ t(j, { value: be(), multiline: !0, minRows: 2, onCopy: () => h(be(), "Download command"), copyLabel: "Download command" })
961
+ ] }),
962
+ /* @__PURE__ */ a(P, { children: [
963
+ /* @__PURE__ */ t(l, { variant: "h6", sx: {
964
+ mb: 1
965
+ }, color: "warning.main", children: "Step 2: Configure the Gateway" }),
966
+ A()
967
+ ] }),
968
+ /* @__PURE__ */ a(P, { children: [
969
+ /* @__PURE__ */ t(l, { variant: "h6", sx: {
970
+ mb: 1
971
+ }, color: "warning.main", children: "Step 3: Start the Gateway" }),
972
+ /* @__PURE__ */ t(l, { variant: "body2", color: "text.secondary", sx: {
973
+ mb: 1.5
974
+ }, children: "1. Navigate to the gateway folder." }),
975
+ /* @__PURE__ */ t(j, { value: xe(), onCopy: () => h(xe(), "Navigate command"), copyLabel: "Navigate command" }),
976
+ /* @__PURE__ */ t(l, { variant: "body2", color: "text.secondary", sx: {
977
+ my: 2
978
+ }, children: "2. Run this command to start the gateway using the configs/keys.env file created in Step 2:" }),
979
+ /* @__PURE__ */ t(j, { value: Ce(), onCopy: () => h(Ce(), "Start command"), copyLabel: "Start command" })
980
+ ] })
981
+ ] }), e[16] = h, e[17] = A, e[18] = w) : w = e[18];
982
+ const u = w;
983
+ let p;
984
+ e[19] !== h || e[20] !== A ? (p = () => /* @__PURE__ */ a(k, { spacing: 3, children: [
985
+ /* @__PURE__ */ a(P, { children: [
986
+ /* @__PURE__ */ t(l, { variant: "h6", sx: {
987
+ mb: 2
988
+ }, children: "Prerequisites" }),
989
+ /* @__PURE__ */ a(k, { component: "ul", spacing: 0.5, sx: {
990
+ pl: 3
991
+ }, children: [
992
+ /* @__PURE__ */ t(l, { component: "li", variant: "body2", color: "text.secondary", children: "cURL installed" }),
993
+ /* @__PURE__ */ t(l, { component: "li", variant: "body2", color: "text.secondary", children: "unzip installed" })
994
+ ] })
995
+ ] }),
996
+ /* @__PURE__ */ a(P, { children: [
997
+ /* @__PURE__ */ t(l, { variant: "h6", sx: {
998
+ mb: 1
999
+ }, color: "warning.main", children: "Step 1: Download the Gateway" }),
1000
+ /* @__PURE__ */ t(l, { variant: "body2", color: "text.secondary", sx: {
1001
+ mb: 2
1002
+ }, children: "Run this command in your terminal to download the gateway:" }),
1003
+ /* @__PURE__ */ t(j, { value: be(), multiline: !0, minRows: 2, onCopy: () => h(be(), "Download command"), copyLabel: "Download command" })
1004
+ ] }),
1005
+ /* @__PURE__ */ a(P, { children: [
1006
+ /* @__PURE__ */ t(l, { variant: "h6", sx: {
1007
+ mb: 1
1008
+ }, color: "warning.main", children: "Step 2: Configure the Gateway" }),
1009
+ A()
1010
+ ] }),
1011
+ /* @__PURE__ */ a(P, { children: [
1012
+ /* @__PURE__ */ t(l, { variant: "h6", sx: {
1013
+ mb: 1
1014
+ }, color: "warning.main", children: "Step 3: Start the Gateway" }),
1015
+ /* @__PURE__ */ t(l, { variant: "body2", color: "text.secondary", sx: {
1016
+ mb: 1.5
1017
+ }, children: "1. Navigate to the gateway folder." }),
1018
+ /* @__PURE__ */ t(j, { value: xe(), onCopy: () => h(xe(), "Navigate command"), copyLabel: "Navigate command" }),
1019
+ /* @__PURE__ */ t(l, { variant: "body2", color: "text.secondary", sx: {
1020
+ my: 2
1021
+ }, children: "2. Run this command to start the gateway using the configs/keys.env file created in Step 2:" }),
1022
+ /* @__PURE__ */ t(j, { value: Ce(), onCopy: () => h(Ce(), "Start command"), copyLabel: "Start command" })
1023
+ ] })
1024
+ ] }), e[19] = h, e[20] = A, e[21] = p) : p = e[21];
1025
+ const I = p;
1026
+ let T;
1027
+ e[22] !== h || e[23] !== c || e[24] !== r || e[25] !== d || e[26] !== s || e[27] !== m ? (T = () => /* @__PURE__ */ a(k, { spacing: 3, children: [
1028
+ /* @__PURE__ */ a(P, { children: [
1029
+ /* @__PURE__ */ t(l, { variant: "h6", sx: {
1030
+ mb: 1
1031
+ }, children: "Prerequisites" }),
1032
+ /* @__PURE__ */ a(k, { component: "ul", spacing: 0.5, sx: {
1033
+ pl: 3
1034
+ }, children: [
1035
+ /* @__PURE__ */ t(l, { component: "li", variant: "body2", color: "text.secondary", children: "cURL installed" }),
1036
+ /* @__PURE__ */ t(l, { component: "li", variant: "body2", color: "text.secondary", children: "unzip installed" }),
1037
+ /* @__PURE__ */ t(l, { component: "li", variant: "body2", color: "text.secondary", children: "Kubernetes 1.32+" }),
1038
+ /* @__PURE__ */ t(l, { component: "li", variant: "body2", color: "text.secondary", children: "Helm 3.18+" })
1039
+ ] })
1040
+ ] }),
1041
+ /* @__PURE__ */ t(P, { children: m ? c && /* @__PURE__ */ t(ne, { severity: "success", sx: {
1042
+ mb: 2
1043
+ }, children: "Successfully generated new configurations. Use the updated command below to install the gateway chart." }) : /* @__PURE__ */ a(de, { children: [
1044
+ /* @__PURE__ */ t(l, { variant: "body2", color: "text.secondary", sx: {
1045
+ mb: 2
1046
+ }, children: r ? "Regenerate a registration token to configure your gateway." : "Generate a registration token to configure your gateway for the first time." }),
1047
+ /* @__PURE__ */ t(te, { variant: "outlined", color: "primary", onClick: s, disabled: d, children: r ? "Reconfigure" : "Configure" })
1048
+ ] }) }),
1049
+ /* @__PURE__ */ a(P, { children: [
1050
+ /* @__PURE__ */ t(l, { variant: "h6", color: "warning.main", children: "Installing the Chart" }),
1051
+ /* @__PURE__ */ t(l, { variant: "body2", color: "text.secondary", sx: {
1052
+ mb: 2
1053
+ }, children: "Run this command to install the gateway chart with control plane configurations:" }),
1054
+ /* @__PURE__ */ t(j, { value: Fe(m), multiline: !0, minRows: 2, onCopy: () => h(Fe(m), "Helm install command"), copyLabel: "Helm install command" })
1055
+ ] })
1056
+ ] }), e[22] = h, e[23] = c, e[24] = r, e[25] = d, e[26] = s, e[27] = m, e[28] = T) : T = e[28];
1057
+ const z = T;
1058
+ let D;
1059
+ e[29] === Symbol.for("react.memo_cache_sentinel") ? (D = {
1060
+ p: 3
1061
+ }, e[29] = D) : D = e[29];
1062
+ let $;
1063
+ e[30] === Symbol.for("react.memo_cache_sentinel") ? ($ = /* @__PURE__ */ t(l, { variant: "h5", sx: {
1064
+ mb: 3
1065
+ }, children: "Get Started" }), e[30] = $) : $ = e[30];
1066
+ let M;
1067
+ e[31] === Symbol.for("react.memo_cache_sentinel") ? (M = {
1068
+ borderBottom: 1,
1069
+ borderColor: "divider",
1070
+ mb: 2
1071
+ }, e[31] = M) : M = e[31];
1072
+ let ae;
1073
+ e[32] === Symbol.for("react.memo_cache_sentinel") ? (ae = /* @__PURE__ */ t(Se, { label: "Quick Start" }), e[32] = ae) : ae = e[32];
1074
+ let W;
1075
+ e[33] === Symbol.for("react.memo_cache_sentinel") ? (W = /* @__PURE__ */ t(Se, { label: "Virtual Machine", icon: /* @__PURE__ */ t(kt, { size: 20 }), iconPosition: "start" }), e[33] = W) : W = e[33];
1076
+ let F;
1077
+ e[34] === Symbol.for("react.memo_cache_sentinel") ? (F = /* @__PURE__ */ t(Se, { label: "Docker", icon: /* @__PURE__ */ t(tt, { size: 20 }), iconPosition: "start" }), e[34] = F) : F = e[34];
1078
+ let K;
1079
+ e[35] === Symbol.for("react.memo_cache_sentinel") ? (K = /* @__PURE__ */ t(Se, { label: "Kubernetes", icon: /* @__PURE__ */ t(nt, { size: 20 }), iconPosition: "start" }), e[35] = K) : K = e[35];
1080
+ let H;
1081
+ e[36] !== S || e[37] !== i ? (H = /* @__PURE__ */ t(P, { sx: M, children: /* @__PURE__ */ a(ht, { value: i, onChange: S, children: [
1082
+ ae,
1083
+ W,
1084
+ F,
1085
+ K
1086
+ ] }) }), e[36] = S, e[37] = i, e[38] = H) : H = e[38];
1087
+ let J;
1088
+ e[39] !== _ ? (J = _(), e[39] = _, e[40] = J) : J = e[40];
1089
+ let O;
1090
+ e[41] !== J || e[42] !== i ? (O = /* @__PURE__ */ t(ze, { value: i, index: 0, children: J }), e[41] = J, e[42] = i, e[43] = O) : O = e[43];
1091
+ let Q;
1092
+ e[44] !== u ? (Q = u(), e[44] = u, e[45] = Q) : Q = e[45];
1093
+ let Y;
1094
+ e[46] !== Q || e[47] !== i ? (Y = /* @__PURE__ */ t(ze, { value: i, index: 1, children: Q }), e[46] = Q, e[47] = i, e[48] = Y) : Y = e[48];
1095
+ let V;
1096
+ e[49] !== I ? (V = I(), e[49] = I, e[50] = V) : V = e[50];
1097
+ let X;
1098
+ e[51] !== V || e[52] !== i ? (X = /* @__PURE__ */ t(ze, { value: i, index: 2, children: V }), e[51] = V, e[52] = i, e[53] = X) : X = e[53];
1099
+ let ie;
1100
+ e[54] !== z ? (ie = z(), e[54] = z, e[55] = ie) : ie = e[55];
1101
+ let B;
1102
+ e[56] !== ie || e[57] !== i ? (B = /* @__PURE__ */ t(ze, { value: i, index: 3, children: ie }), e[56] = ie, e[57] = i, e[58] = B) : B = e[58];
1103
+ let q;
1104
+ return e[59] !== H || e[60] !== O || e[61] !== Y || e[62] !== X || e[63] !== B ? (q = /* @__PURE__ */ t(ce, { variant: "outlined", children: /* @__PURE__ */ a(Ge, { sx: D, children: [
1105
+ $,
1106
+ H,
1107
+ O,
1108
+ Y,
1109
+ X,
1110
+ B
1111
+ ] }) }), e[59] = H, e[60] = O, e[61] = Y, e[62] = X, e[63] = B, e[64] = q) : q = e[64], q;
1112
+ }
1113
+ const Sn = () => {
1114
+ const {
1115
+ gatewayId: n,
1116
+ orgId: e
1117
+ } = Ae(), {
1118
+ addConfirmation: r
1119
+ } = it(), [m, c] = L(null), [s, d] = L(!1), [R, f] = L(!1), [x, v] = L(""), {
1120
+ data: o,
1121
+ isLoading: b,
1122
+ error: y
1123
+ } = Ut({
1124
+ orgName: e,
1125
+ gatewayId: n
1126
+ }), i = {
1127
+ orgName: e ?? "",
1128
+ gatewayId: n ?? ""
1129
+ }, {
1130
+ data: g
1131
+ } = Wt(i), {
1132
+ mutateAsync: S,
1133
+ isPending: h
1134
+ } = $t(), {
1135
+ mutateAsync: G
1136
+ } = Ft(), A = le((I, T) => {
1137
+ v(`${T} copied to clipboard`), f(!0);
1138
+ }, []), E = (g?.count ?? 0) > 0, _ = le(async () => {
1139
+ if (!(!e || !n))
1140
+ try {
1141
+ const I = g?.list ?? [];
1142
+ await Promise.all(I.filter((z) => z.status === "active").map((z) => G({
1143
+ orgName: e,
1144
+ gatewayId: n,
1145
+ tokenId: z.id
1146
+ }).catch(() => {
1147
+ })));
1148
+ const T = await S({
1149
+ orgName: e,
1150
+ gatewayId: n
1151
+ });
1152
+ c(T.token), d(!0);
1153
+ } catch {
1154
+ }
1155
+ }, [e, n, g?.list, G, S]), w = le(() => {
1156
+ E ? r({
1157
+ title: "Reconfigure gateway",
1158
+ description: "Regenerating the registration token will revoke the existing token for this gateway and disconnect the gateway from the control plane. Do you want to continue?",
1159
+ onConfirm: _,
1160
+ confirmButtonColor: "error",
1161
+ confirmButtonText: "Reconfigure"
1162
+ }) : _();
1163
+ }, [r, E, _]), u = o?.displayName ?? o?.name ?? n ?? "", p = o?.status === "ACTIVE" || o?.isActive;
1164
+ return /* @__PURE__ */ a(de, { children: [
1165
+ /* @__PURE__ */ a(Be, { title: u, backHref: ge(fe.children.org.children.gateways.path, {
1166
+ orgId: e ?? ""
1167
+ }), backLabel: "Back to Gateways", description: o?.createdAt ? `Created ${Zt(new Date(o.createdAt), {
1168
+ addSuffix: !0
1169
+ })}` : void 0, isLoading: b, disableIcon: !0, titleTail: o ? /* @__PURE__ */ a(k, { direction: "row", spacing: 1, alignItems: "center", sx: {
1170
+ ml: 1
1171
+ }, children: [
1172
+ /* @__PURE__ */ t(Re, { label: p ? "Active" : "Inactive", size: "small", variant: "outlined", color: p ? "success" : "default" }),
1173
+ o?.isCritical && /* @__PURE__ */ t(Re, { label: "Critical", size: "small", variant: "outlined", color: "error" }),
1174
+ o?.gatewayType && /* @__PURE__ */ t(ut, { type: o.gatewayType })
1175
+ ] }) : void 0, children: [
1176
+ b && /* @__PURE__ */ a(k, { spacing: 3, children: [
1177
+ /* @__PURE__ */ t(ce, { variant: "outlined", sx: {
1178
+ p: 3
1179
+ }, children: /* @__PURE__ */ a(k, { spacing: 2, children: [
1180
+ /* @__PURE__ */ t(U, { variant: "text", width: 140, height: 28 }),
1181
+ /* @__PURE__ */ t(U, { variant: "rounded", height: 48 }),
1182
+ /* @__PURE__ */ t(U, { variant: "rounded", height: 160 })
1183
+ ] }) }),
1184
+ /* @__PURE__ */ a(we, { container: !0, spacing: 2, children: [
1185
+ /* @__PURE__ */ t(we, { size: {
1186
+ xs: 12,
1187
+ sm: 6
1188
+ }, children: /* @__PURE__ */ t(ce, { variant: "outlined", sx: {
1189
+ p: 2,
1190
+ height: "100%"
1191
+ }, children: /* @__PURE__ */ a(k, { spacing: 0.5, children: [
1192
+ /* @__PURE__ */ t(U, { variant: "text", width: "30%", height: 14 }),
1193
+ /* @__PURE__ */ t(U, { variant: "text", width: "80%", height: 20 })
1194
+ ] }) }) }),
1195
+ /* @__PURE__ */ t(we, { size: {
1196
+ xs: 12,
1197
+ sm: 6
1198
+ }, children: /* @__PURE__ */ t(ce, { variant: "outlined", sx: {
1199
+ p: 2,
1200
+ height: "100%"
1201
+ }, children: /* @__PURE__ */ a(k, { spacing: 0.5, children: [
1202
+ /* @__PURE__ */ t(U, { variant: "text", width: "35%", height: 14 }),
1203
+ /* @__PURE__ */ a(k, { direction: "row", spacing: 0.5, children: [
1204
+ /* @__PURE__ */ t(U, { variant: "rounded", width: 80, height: 24 }),
1205
+ /* @__PURE__ */ t(U, { variant: "rounded", width: 80, height: 24 })
1206
+ ] })
1207
+ ] }) }) })
1208
+ ] }),
1209
+ /* @__PURE__ */ t(ce, { variant: "outlined", sx: {
1210
+ p: 3
1211
+ }, children: /* @__PURE__ */ a(k, { spacing: 2, children: [
1212
+ /* @__PURE__ */ t(U, { variant: "text", width: 160, height: 24 }),
1213
+ /* @__PURE__ */ t(U, { variant: "text", width: "60%", height: 18 }),
1214
+ /* @__PURE__ */ a(k, { spacing: 1, children: [
1215
+ /* @__PURE__ */ t(U, { variant: "rounded", height: 44 }),
1216
+ /* @__PURE__ */ t(U, { variant: "rounded", height: 44 })
1217
+ ] })
1218
+ ] }) })
1219
+ ] }),
1220
+ y ? /* @__PURE__ */ a(ne, { severity: "error", icon: /* @__PURE__ */ t(Ve, { size: 18 }), sx: {
1221
+ mb: 2
1222
+ }, children: [
1223
+ "Failed to load gateway. ",
1224
+ Vt(y) || "Please try again."
1225
+ ] }) : null,
1226
+ o && !y && /* @__PURE__ */ a(k, { spacing: 3, children: [
1227
+ !p && /* @__PURE__ */ t(Cn, { isConfigured: E, registrationToken: m, hasJustRegeneratedToken: s, onRegenerateToken: w, isRegeneratingToken: h, onCopy: A }),
1228
+ /* @__PURE__ */ a(we, { container: !0, spacing: 2, children: [
1229
+ /* @__PURE__ */ t(we, { size: {
1230
+ xs: 12,
1231
+ sm: 6
1232
+ }, children: /* @__PURE__ */ t(ce, { variant: "outlined", sx: {
1233
+ p: 2,
1234
+ height: "100%"
1235
+ }, children: /* @__PURE__ */ a(k, { spacing: 0.5, children: [
1236
+ /* @__PURE__ */ t(l, { variant: "caption", color: "text.secondary", sx: {
1237
+ fontWeight: 500
1238
+ }, children: "Virtual Host" }),
1239
+ /* @__PURE__ */ t(l, { variant: "body2", sx: {
1240
+ fontFamily: "monospace",
1241
+ wordBreak: "break-all"
1242
+ }, children: o.vhost })
1243
+ ] }) }) }),
1244
+ /* @__PURE__ */ t(we, { size: {
1245
+ xs: 12,
1246
+ sm: 6
1247
+ }, children: /* @__PURE__ */ t(ce, { variant: "outlined", sx: {
1248
+ p: 2,
1249
+ height: "100%"
1250
+ }, children: /* @__PURE__ */ a(k, { spacing: 0.5, children: [
1251
+ /* @__PURE__ */ t(l, { variant: "caption", color: "text.secondary", sx: {
1252
+ fontWeight: 500
1253
+ }, children: "Environments" }),
1254
+ o.environments && o.environments.length > 0 ? /* @__PURE__ */ t(k, { direction: "row", spacing: 0.5, flexWrap: "wrap", useFlexGap: !0, children: o.environments.map((I) => /* @__PURE__ */ t(Re, { label: I.displayName || I.name, size: "small", variant: "outlined" }, I.id)) }) : /* @__PURE__ */ t(l, { variant: "body2", color: "text.secondary", children: "—" })
1255
+ ] }) }) })
1256
+ ] }),
1257
+ /* @__PURE__ */ t(fn, { orgId: e ?? "", gatewayId: o.uuid, gatewayName: o.displayName || o.name, environments: o.environments ?? [] }),
1258
+ p && /* @__PURE__ */ t(bn, { registrationToken: m, hasJustRegeneratedToken: s, onReconfigure: w, isReconfiguring: h, onCopy: A })
1259
+ ] })
1260
+ ] }),
1261
+ /* @__PURE__ */ t(jt, { open: R, autoHideDuration: 3e3, onClose: () => f(!1), message: x })
1262
+ ] });
1263
+ };
1264
+ function kn({
1265
+ open: n,
1266
+ onClose: e,
1267
+ gateway: r,
1268
+ orgId: m,
1269
+ onSuccess: c
1270
+ }) {
1271
+ const [s, d] = L({
1272
+ displayName: r.displayName,
1273
+ isCritical: r.isCritical
1274
+ }), {
1275
+ errors: R,
1276
+ validateForm: f,
1277
+ setFieldError: x,
1278
+ validateField: v
1279
+ } = ot(je), [o, b] = L({}), {
1280
+ mutateAsync: y,
1281
+ isPending: i,
1282
+ error: g,
1283
+ reset: S
1284
+ } = Mt(), h = i;
1285
+ Ie(() => {
1286
+ n && (d({
1287
+ displayName: r.displayName,
1288
+ isCritical: r.isCritical
1289
+ }), S());
1290
+ }, [r, n, S]);
1291
+ const G = le((u, p) => {
1292
+ d((I) => {
1293
+ const T = {
1294
+ ...I,
1295
+ [u]: p
1296
+ }, z = v(u, T[u], T);
1297
+ return x(u, z), T;
1298
+ });
1299
+ }, [x, v]), A = le(async (u) => {
1300
+ u.preventDefault();
1301
+ const p = je.safeParse(s);
1302
+ if (!p.success) {
1303
+ const T = {};
1304
+ p.error.issues.forEach((z) => {
1305
+ z.path[0] && (T[z.path[0]] = z.message);
1306
+ }), b(T), f(s);
1307
+ return;
1308
+ }
1309
+ b({});
1310
+ const I = {
1311
+ displayName: s.displayName.trim(),
1312
+ isCritical: s.isCritical
1313
+ };
1314
+ try {
1315
+ await y({
1316
+ params: {
1317
+ orgName: m,
1318
+ gatewayId: r.uuid
1319
+ },
1320
+ body: I
1321
+ }), e(), c?.();
1322
+ } catch {
1323
+ }
1324
+ }, [s, f, y, m, r.uuid, e, c]), E = he(() => g ? g?.message ?? "Failed to update gateway" : null, [g]), _ = Object.values(o).filter(Boolean), w = _.length > 0;
1325
+ return /* @__PURE__ */ a(lt, { open: n, onClose: e, children: [
1326
+ /* @__PURE__ */ t(st, { icon: /* @__PURE__ */ t(Ze, { size: 24 }), title: "Edit Gateway", onClose: e }),
1327
+ /* @__PURE__ */ t(ct, { children: /* @__PURE__ */ t("form", { onSubmit: A, children: /* @__PURE__ */ a(k, { spacing: 3, children: [
1328
+ E && /* @__PURE__ */ t(ne, { severity: "error", children: /* @__PURE__ */ t(l, { variant: "body2", children: E }) }),
1329
+ /* @__PURE__ */ t(mt, { in: w, timeout: "auto", unmountOnExit: !0, children: /* @__PURE__ */ t(ne, { severity: "error", sx: {
1330
+ mb: 2
1331
+ }, children: _.map((u, p) => /* @__PURE__ */ t(P, { children: u }, p)) }) }),
1332
+ /* @__PURE__ */ a(oe.Section, { children: [
1333
+ /* @__PURE__ */ t(oe.Header, { children: "Gateway Details" }),
1334
+ /* @__PURE__ */ t(oe.Stack, { spacing: 2, children: /* @__PURE__ */ a(ye, { fullWidth: !0, error: !!R.displayName, children: [
1335
+ /* @__PURE__ */ t(pe, { required: !0, children: "Display Name" }),
1336
+ /* @__PURE__ */ t(me, { fullWidth: !0, size: "small", value: s.displayName, onChange: (u) => G("displayName", u.target.value), placeholder: "e.g., Production Gateway", error: !!R.displayName, helperText: R.displayName, disabled: h })
1337
+ ] }) })
1338
+ ] }),
1339
+ /* @__PURE__ */ a(P, { display: "flex", justifyContent: "flex-end", gap: 1, mt: 2, children: [
1340
+ /* @__PURE__ */ t(te, { variant: "outlined", color: "inherit", onClick: e, disabled: h, children: "Cancel" }),
1341
+ /* @__PURE__ */ t(te, { type: "submit", variant: "contained", color: "primary", disabled: h, children: h ? "Saving..." : "Save" })
1342
+ ] })
1343
+ ] }) }) })
1344
+ ] });
1345
+ }
1346
+ const Ye = () => {
1347
+ const n = ve(16), {
1348
+ orgId: e
1349
+ } = Ae(), [r, m] = L(!1), [c, s] = L(null);
1350
+ let d;
1351
+ n[0] === Symbol.for("react.memo_cache_sentinel") ? (d = (h) => {
1352
+ s(h), m(!0);
1353
+ }, n[0] = d) : d = n[0];
1354
+ const R = d;
1355
+ let f;
1356
+ n[1] === Symbol.for("react.memo_cache_sentinel") ? (f = () => {
1357
+ m(!1), s(null);
1358
+ }, n[1] = f) : f = n[1];
1359
+ const x = f;
1360
+ let v;
1361
+ n[2] === Symbol.for("react.memo_cache_sentinel") ? (v = /* @__PURE__ */ t(Ee, { index: !0, element: /* @__PURE__ */ t(Be, { title: "Gateways", disableIcon: !0, children: /* @__PURE__ */ t(nn, { onEditGateway: R }) }) }), n[2] = v) : v = n[2];
1362
+ let o;
1363
+ n[3] === Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ t(Ee, { path: "add", element: /* @__PURE__ */ t(hn, {}) }), n[3] = o) : o = n[3];
1364
+ let b;
1365
+ n[4] === Symbol.for("react.memo_cache_sentinel") ? (b = /* @__PURE__ */ t(Ee, { path: "view/:gatewayId", element: /* @__PURE__ */ t(Sn, {}) }), n[4] = b) : b = n[4];
1366
+ let y;
1367
+ n[5] !== e ? (y = ge(fe.children.org.children.gateways.path, {
1368
+ orgId: e
1369
+ }), n[5] = e, n[6] = y) : y = n[6];
1370
+ let i;
1371
+ n[7] !== y ? (i = /* @__PURE__ */ a(It, { children: [
1372
+ v,
1373
+ o,
1374
+ b,
1375
+ /* @__PURE__ */ t(Ee, { path: "*", element: /* @__PURE__ */ t(Tt, { to: y }) })
1376
+ ] }), n[7] = y, n[8] = i) : i = n[8];
1377
+ let g;
1378
+ n[9] !== r || n[10] !== c || n[11] !== e ? (g = c && /* @__PURE__ */ t(kn, { open: r, onClose: x, gateway: c, orgId: e ?? "", onSuccess: x }), n[9] = r, n[10] = c, n[11] = e, n[12] = g) : g = n[12];
1379
+ let S;
1380
+ return n[13] !== i || n[14] !== g ? (S = /* @__PURE__ */ a(de, { children: [
1381
+ i,
1382
+ g
1383
+ ] }), n[13] = i, n[14] = g, n[15] = S) : S = n[15], S;
1384
+ }, Wn = {
1385
+ title: "Gateways",
1386
+ description: "A page component for Gateway management",
1387
+ icon: Xe,
1388
+ path: "/gateways",
1389
+ component: Ye,
1390
+ levels: {
1391
+ organization: Ye
1392
+ }
1393
+ };
1394
+ export {
1395
+ Ye as GatewaysOrganization,
1396
+ Wn as metaData
1397
+ };