@omniviewdev/runtime 0.1.11 → 0.2.0

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 (42) hide show
  1. package/dist/Client-BRYjLBXY.cjs +1 -0
  2. package/dist/{Client-DRRyPmcf.js → Client-RGYOEzh2.js} +312 -275
  3. package/dist/api.cjs +1 -1
  4. package/dist/api.d.ts +1 -0
  5. package/dist/api.js +95 -51
  6. package/dist/context/drawer/types.d.ts +1 -1
  7. package/dist/errors/types.d.ts +2 -0
  8. package/dist/hooks/connection/useConnectionStatus.d.ts +3 -3
  9. package/dist/hooks/connection/useConnections.d.ts +2 -2
  10. package/dist/hooks/resource/index.d.ts +2 -1
  11. package/dist/hooks/resource/useActiveSyncs.d.ts +2 -2
  12. package/dist/hooks/resource/useEditorSchemas.d.ts +2 -2
  13. package/dist/hooks/resource/useEventBatcher.d.ts +55 -0
  14. package/dist/hooks/resource/useResource.d.ts +9 -21
  15. package/dist/hooks/resource/useResourceActions.d.ts +3 -3
  16. package/dist/hooks/resource/useResourceGroups.d.ts +1 -1
  17. package/dist/hooks/resource/useResourceMutations.d.ts +14 -7
  18. package/dist/hooks/resource/useResourceSearch.d.ts +1 -1
  19. package/dist/hooks/resource/useResourceType.d.ts +1 -1
  20. package/dist/hooks/resource/useResourceTypes.d.ts +1 -1
  21. package/dist/hooks/resource/useResources.d.ts +14 -22
  22. package/dist/hooks/resource/useWatchState.d.ts +28 -0
  23. package/dist/index.cjs +2 -2
  24. package/dist/index.d.ts +1 -0
  25. package/dist/index.js +1406 -1295
  26. package/dist/models.cjs +1 -1
  27. package/dist/models.js +1343 -972
  28. package/dist/types/index.d.ts +1 -1
  29. package/dist/types/watch.d.ts +29 -0
  30. package/dist/utils/activeSyncAggregator.d.ts +13 -8
  31. package/dist/utils/resourceKey.d.ts +12 -0
  32. package/dist/wailsjs/go/devserver/DevServerManager.d.ts +2 -0
  33. package/dist/wailsjs/go/models.d.ts +400 -214
  34. package/dist/wailsjs/go/plugin/pluginManager.d.ts +3 -1
  35. package/dist/wailsjs/go/pluginlog/Manager.d.ts +18 -0
  36. package/dist/wailsjs/go/resource/Client.d.ts +39 -23
  37. package/package.json +1 -1
  38. package/dist/Client-BtQwAB3N.cjs +0 -1
  39. package/dist/errors/parseAppError.test.d.ts +0 -1
  40. package/dist/hooks/resource/useInformerState.d.ts +0 -24
  41. package/dist/types/informer.d.ts +0 -49
  42. package/dist/utils/activeSyncAggregator.test.d.ts +0 -1
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
1
- var zt = Object.defineProperty;
2
- var Wt = (e, t, r) => t in e ? zt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var M = (e, t, r) => Wt(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { jsx as F, jsxs as ae } from "react/jsx-runtime";
5
- import _, { useContext as te, createContext as me, useState as q, useRef as de, useEffect as Q, useCallback as V, useMemo as Ht } from "react";
6
- import { Link as Bt, useNavigate as Yt, useLocation as Jt, createMemoryRouter as Vt, RouterProvider as Xt } from "react-router-dom";
7
- import { P as Zt, G as er, V as tr, S as rr, h as lt, U as nr, R as sr, i as or, j as dt, k as ir, L as ar, l as cr, m as Ye, n as ur, o as lr, q as dr, r as fr, s as pr, Q as yr, t as hr, u as Je, v as mr, w as ft, F as gr, x as _r, y as pt, D as yt, z as wr, A as Sr, B as Cr, E as ht, H as Er, I as br, J as mt, K as vr, M as Pr, N as Dr, O as Fr, T as xr, W as Ir, X as Or } from "./Client-DRRyPmcf.js";
8
- import { config as Ar, exec as Tr, logs as Ve, networker as Xe, types as T } from "./models.js";
9
- import { useQueryClient as G, useMutation as v, useQuery as D, keepPreviousData as gt, useQueries as Nr } from "@tanstack/react-query";
10
- import { useNotificationStack as Rr } from "@omniviewdev/ui/feedback";
11
- import { EventsOn as A, BrowserOpenURL as _t, EventsOff as be } from "./runtime.js";
12
- const $e = _.createContext(void 0), xe = {
1
+ var jt = Object.defineProperty;
2
+ var Gt = (e, t, n) => t in e ? jt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var k = (e, t, n) => Gt(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { jsx as R, jsxs as ce } from "react/jsx-runtime";
5
+ import S, { useContext as ne, createContext as he, useState as q, useRef as $, useEffect as j, useCallback as U, useMemo as Kt } from "react";
6
+ import { Link as zt, useNavigate as Qt, useLocation as Wt, createMemoryRouter as Bt, RouterProvider as Ht } from "react-router-dom";
7
+ import { P as Yt, G as Jt, V as Vt, S as Xt, h as it, U as Zt, R as en, i as tn, j as at, k as nn, L as rn, l as sn, m as on, n as an, o as cn, q as un, r as ln, s as dn, t as fn, Q as pn, u as yn, v as We, w as hn, x as ct, F as gn, y as mn, z as ut, D as lt, A as _n, B as En, E as Sn, H as dt, I as wn, J as Cn, K as ft, M as bn, N as vn, O as Dn, T as Pn, W as Rn, X as In, Y as Fn } from "./Client-RGYOEzh2.js";
8
+ import { config as On, resource as A, exec as xn, logs as Be, networker as He } from "./models.js";
9
+ import { useQueryClient as G, useMutation as v, useQuery as P, keepPreviousData as pt, useQueries as An } from "@tanstack/react-query";
10
+ import { useNotificationStack as Tn } from "@omniviewdev/ui/feedback";
11
+ import { EventsOn as x, BrowserOpenURL as yt, EventsOff as be } from "./runtime.js";
12
+ const Le = S.createContext(void 0), M = {
13
13
  // Plugin
14
14
  PLUGIN_NOT_FOUND: "omniview:plugin/not-found",
15
15
  PLUGIN_NOT_LOADED: "omniview:plugin/not-loaded",
@@ -29,6 +29,8 @@ const $e = _.createContext(void 0), xe = {
29
29
  // Connection
30
30
  CONNECTION_NOT_FOUND: "omniview:connection/not-found",
31
31
  CONNECTION_FAILED: "omniview:connection/failed",
32
+ RESOURCE_CONNECTION_ERROR: "omniview:resource/connection-error",
33
+ RESOURCE_CERTIFICATE_ERROR: "omniview:resource/certificate-error",
32
34
  // Session
33
35
  SESSION_NOT_FOUND: "omniview:session/not-found",
34
36
  SESSION_FAILED: "omniview:session/failed",
@@ -38,10 +40,31 @@ const $e = _.createContext(void 0), xe = {
38
40
  VALIDATION: "omniview:validation",
39
41
  NOT_IMPLEMENTED: "omniview:not-implemented"
40
42
  };
41
- function U(e) {
43
+ function Nn(e) {
44
+ switch (e) {
45
+ case "NOT_FOUND":
46
+ return { typeUri: M.RESOURCE_NOT_FOUND, status: 404 };
47
+ case "FORBIDDEN":
48
+ return { typeUri: M.RESOURCE_FORBIDDEN, status: 403 };
49
+ case "UNAUTHORIZED":
50
+ return { typeUri: M.RESOURCE_UNAUTHORIZED, status: 401 };
51
+ case "CONFLICT":
52
+ case "ALREADY_EXISTS":
53
+ return { typeUri: M.RESOURCE_CONFLICT, status: 409 };
54
+ case "TIMEOUT":
55
+ return { typeUri: M.RESOURCE_TIMEOUT, status: 408 };
56
+ case "CONNECTION_ERROR":
57
+ return { typeUri: M.RESOURCE_CONNECTION_ERROR, status: 503 };
58
+ case "CERTIFICATE_ERROR":
59
+ return { typeUri: M.RESOURCE_CERTIFICATE_ERROR, status: 502 };
60
+ default:
61
+ return { typeUri: M.INTERNAL, status: 500 };
62
+ }
63
+ }
64
+ function K(e) {
42
65
  if (e == null)
43
66
  return {
44
- type: xe.INTERNAL,
67
+ type: M.INTERNAL,
45
68
  title: "Unknown error",
46
69
  status: 500,
47
70
  detail: "An unknown error occurred."
@@ -49,22 +72,32 @@ function U(e) {
49
72
  let t;
50
73
  if (typeof e == "string" ? t = e : e instanceof Error ? t = e.message : t = String(e), t.startsWith("{"))
51
74
  try {
52
- const r = JSON.parse(t);
53
- if (typeof r.type == "string" && typeof r.title == "string" && typeof r.status == "number" && typeof r.detail == "string")
54
- return r;
75
+ const n = JSON.parse(t);
76
+ if (typeof n.type == "string" && typeof n.title == "string" && typeof n.status == "number" && typeof n.detail == "string")
77
+ return n;
78
+ if (typeof n.code == "string" && typeof n.title == "string" && typeof n.message == "string") {
79
+ const { typeUri: r, status: s } = Nn(n.code);
80
+ return {
81
+ type: r,
82
+ title: n.title,
83
+ status: s,
84
+ detail: n.message,
85
+ suggestions: Array.isArray(n.suggestions) ? n.suggestions : void 0
86
+ };
87
+ }
55
88
  } catch {
56
89
  }
57
90
  return {
58
- type: xe.INTERNAL,
91
+ type: M.INTERNAL,
59
92
  title: "Error",
60
93
  status: 500,
61
94
  detail: t
62
95
  };
63
96
  }
64
- function wt(e) {
65
- return e == null ? !1 : (typeof e == "string" ? e : e instanceof Error ? e.message : String(e)) === "cancelled" ? !0 : U(e).type === xe.CANCELLED;
97
+ function ht(e) {
98
+ return e == null ? !1 : (typeof e == "string" ? e : e instanceof Error ? e.message : String(e)) === "cancelled" ? !0 : K(e).type === M.CANCELLED;
66
99
  }
67
- function kr(e) {
100
+ function kn(e) {
68
101
  switch (e.type) {
69
102
  case "navigate":
70
103
  return {
@@ -101,63 +134,63 @@ function kr(e) {
101
134
  };
102
135
  }
103
136
  }
104
- function St(e, t) {
105
- var s, i;
106
- const r = [
137
+ function gt(e, t) {
138
+ var s, o;
139
+ const n = [
107
140
  e.detail,
108
- ...((s = e.suggestions) == null ? void 0 : s.map((o) => `• ${o}`)) ?? []
141
+ ...((s = e.suggestions) == null ? void 0 : s.map((i) => `• ${i}`)) ?? []
109
142
  ].join(`
110
143
  `);
111
144
  return {
112
145
  message: t || (e.title !== "Error" ? e.title : "Operation failed"),
113
146
  status: "error",
114
- details: r,
115
- actions: (i = e.actions) == null ? void 0 : i.map(kr)
147
+ details: n,
148
+ actions: (o = e.actions) == null ? void 0 : o.map(kn)
116
149
  };
117
150
  }
118
- function X(e, t, r) {
119
- if (wt(t)) return;
120
- const n = U(t);
121
- e(St(n, r));
151
+ function Z(e, t, n) {
152
+ if (ht(t)) return;
153
+ const r = K(t);
154
+ e(gt(r, n));
122
155
  }
123
156
  function I(e, t) {
124
- return (r) => {
125
- if (wt(r)) return;
126
- const n = U(r);
127
- e(St(n, n.title !== "Error" ? n.title : t));
157
+ return (n) => {
158
+ if (ht(n)) return;
159
+ const r = K(n);
160
+ e(gt(r, r.title !== "Error" ? r.title : t));
128
161
  };
129
162
  }
130
- function ws(e) {
131
- const { children: t, pluginId: r } = e, [n, s] = _.useState({}), [i, o] = _.useState(new Ar.PluginMeta()), [a, c] = _.useState(!1), [l, u] = _.useState(null);
132
- console.debug("[PluginContextProvider] render", { pluginId: r, metaLoaded: a, metaError: !!l });
133
- const y = () => {
134
- r === void 0 || r === "" || (console.debug(`[PluginContextProvider] fetching settings for "${r}"`), Zt(r).then((f) => {
135
- console.debug(`[PluginContextProvider] settings loaded for "${r}"`, Object.keys(f)), s(f);
136
- }).catch((f) => {
137
- const m = U(f);
138
- console.error(`[PluginContextProvider] error fetching settings for "${r}":`, m.detail);
163
+ function Es(e) {
164
+ const { children: t, pluginId: n } = e, [r, s] = S.useState({}), [o, i] = S.useState(new On.PluginMeta()), [a, u] = S.useState(!1), [l, c] = S.useState(null);
165
+ console.debug("[PluginContextProvider] render", { pluginId: n, metaLoaded: a, metaError: !!l });
166
+ const g = () => {
167
+ n === void 0 || n === "" || (console.debug(`[PluginContextProvider] fetching settings for "${n}"`), Yt(n).then((d) => {
168
+ console.debug(`[PluginContextProvider] settings loaded for "${n}"`, Object.keys(d)), s(d);
169
+ }).catch((d) => {
170
+ const h = K(d);
171
+ console.error(`[PluginContextProvider] error fetching settings for "${n}":`, h.detail);
139
172
  }));
140
- }, h = () => {
141
- if (r === void 0 || r === "") {
173
+ }, f = () => {
174
+ if (n === void 0 || n === "") {
142
175
  console.debug("[PluginContextProvider] skipping meta fetch — empty pluginId");
143
176
  return;
144
177
  }
145
- console.debug(`[PluginContextProvider] fetching meta for "${r}"`), u(null), er(r).then((f) => {
146
- console.debug(`[PluginContextProvider] meta loaded for "${r}"`, { name: f == null ? void 0 : f.name, version: f == null ? void 0 : f.version }), o(f), c(!0);
147
- }).catch((f) => {
148
- const m = U(f);
149
- console.error(`[PluginContextProvider] error fetching meta for "${r}":`, m.detail), u(m.detail), c(!1);
178
+ console.debug(`[PluginContextProvider] fetching meta for "${n}"`), c(null), Jt(n).then((d) => {
179
+ console.debug(`[PluginContextProvider] meta loaded for "${n}"`, { name: d == null ? void 0 : d.name, version: d == null ? void 0 : d.version }), i(d), u(!0);
180
+ }).catch((d) => {
181
+ const h = K(d);
182
+ console.error(`[PluginContextProvider] error fetching meta for "${n}":`, h.detail), c(h.detail), u(!1);
150
183
  });
151
184
  };
152
- return _.useEffect(() => {
153
- console.debug(`[PluginContextProvider] useEffect — pluginId changed to "${r}"`), y(), h();
154
- }, [r]), l ? /* @__PURE__ */ F("div", { style: {
185
+ return S.useEffect(() => {
186
+ console.debug(`[PluginContextProvider] useEffect — pluginId changed to "${n}"`), g(), f();
187
+ }, [n]), l ? /* @__PURE__ */ R("div", { style: {
155
188
  display: "flex",
156
189
  flex: 1,
157
190
  alignItems: "center",
158
191
  justifyContent: "center",
159
192
  padding: 24
160
- }, children: /* @__PURE__ */ ae("div", { style: {
193
+ }, children: /* @__PURE__ */ ce("div", { style: {
161
194
  maxWidth: 480,
162
195
  width: "100%",
163
196
  border: "1px solid #7F1D1D",
@@ -166,19 +199,19 @@ function ws(e) {
166
199
  padding: 20,
167
200
  fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
168
201
  }, children: [
169
- /* @__PURE__ */ ae("div", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 12 }, children: [
170
- /* @__PURE__ */ ae("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "#EF4444", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
171
- /* @__PURE__ */ F("circle", { cx: "12", cy: "12", r: "10" }),
172
- /* @__PURE__ */ F("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
173
- /* @__PURE__ */ F("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
202
+ /* @__PURE__ */ ce("div", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 12 }, children: [
203
+ /* @__PURE__ */ ce("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "#EF4444", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
204
+ /* @__PURE__ */ R("circle", { cx: "12", cy: "12", r: "10" }),
205
+ /* @__PURE__ */ R("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
206
+ /* @__PURE__ */ R("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
174
207
  ] }),
175
- /* @__PURE__ */ F("span", { style: { fontSize: 14, fontWeight: 600, color: "#FECACA" }, children: "Plugin failed to load" })
208
+ /* @__PURE__ */ R("span", { style: { fontSize: 14, fontWeight: 600, color: "#FECACA" }, children: "Plugin failed to load" })
176
209
  ] }),
177
- /* @__PURE__ */ F("p", { style: { fontSize: 13, color: "#A1A1AA", margin: "0 0 16px" }, children: l }),
178
- /* @__PURE__ */ F(
210
+ /* @__PURE__ */ R("p", { style: { fontSize: 13, color: "#A1A1AA", margin: "0 0 16px" }, children: l }),
211
+ /* @__PURE__ */ R(
179
212
  "button",
180
213
  {
181
- onClick: () => h(),
214
+ onClick: () => f(),
182
215
  style: {
183
216
  background: "transparent",
184
217
  color: "#F87171",
@@ -192,13 +225,13 @@ function ws(e) {
192
225
  children: "Retry"
193
226
  }
194
227
  )
195
- ] }) }) : a ? /* @__PURE__ */ F($e.Provider, { value: { pluginId: r, settings: n, meta: i }, children: t }) : /* @__PURE__ */ ae("div", { style: {
228
+ ] }) }) : a ? /* @__PURE__ */ R(Le.Provider, { value: { pluginId: n, settings: r, meta: o }, children: t }) : /* @__PURE__ */ ce("div", { style: {
196
229
  display: "flex",
197
230
  flex: 1,
198
231
  alignItems: "center",
199
232
  justifyContent: "center"
200
233
  }, children: [
201
- /* @__PURE__ */ F("div", { style: {
234
+ /* @__PURE__ */ R("div", { style: {
202
235
  width: 24,
203
236
  height: 24,
204
237
  border: "2px solid #3F3F46",
@@ -206,34 +239,34 @@ function ws(e) {
206
239
  borderRadius: "50%",
207
240
  animation: "plugin-spin 0.8s linear infinite"
208
241
  } }),
209
- /* @__PURE__ */ F("style", { children: "@keyframes plugin-spin { to { transform: rotate(360deg); } }" })
242
+ /* @__PURE__ */ R("style", { children: "@keyframes plugin-spin { to { transform: rotate(360deg); } }" })
210
243
  ] });
211
244
  }
212
- function Le() {
213
- const e = te($e);
245
+ function $e() {
246
+ const e = ne(Le);
214
247
  if (!e)
215
248
  throw new Error("usePluginContext must be used within a PluginContextProvider");
216
249
  return e;
217
250
  }
218
251
  function Ss() {
219
- return Le().settings;
220
- }
221
- const Ct = me(void 0), Cs = ({ children: e }) => {
222
- const [t, r] = q({}), n = () => {
223
- tr().then((i) => {
224
- console.log("Fetched settings:", i), r(i);
225
- }).catch((i) => {
226
- console.error("Error fetching settings:", i);
252
+ return $e().settings;
253
+ }
254
+ const mt = he(void 0), ws = ({ children: e }) => {
255
+ const [t, n] = q({}), r = () => {
256
+ Vt().then((o) => {
257
+ console.log("Fetched settings:", o), n(o);
258
+ }).catch((o) => {
259
+ console.error("Error fetching settings:", o);
227
260
  });
228
261
  };
229
- _.useEffect(() => {
230
- n();
262
+ S.useEffect(() => {
263
+ r();
231
264
  }, []);
232
265
  const s = () => {
233
- n();
266
+ r();
234
267
  };
235
- return /* @__PURE__ */ F(Ct.Provider, { value: { settings: t, reload: s }, children: e });
236
- }, Mr = {
268
+ return /* @__PURE__ */ R(mt.Provider, { value: { settings: t, reload: s }, children: e });
269
+ }, Mn = {
237
270
  height: 32,
238
271
  focused: 0,
239
272
  tabs: [],
@@ -257,105 +290,105 @@ const Ct = me(void 0), Cs = ({ children: e }) => {
257
290
  },
258
291
  fullscreenDrawer: () => {
259
292
  }
260
- }, $r = _.createContext(Mr), Lr = me(void 0), qr = _.createContext(void 0), Et = _.createContext(void 0), Gr = 3e4, Es = ({ children: e }) => {
261
- const [t, r] = _.useState([]), n = _.useCallback((a) => {
262
- r((c) => [a, ...c]);
263
- }, []), s = _.useCallback((a, c) => {
264
- r(
265
- (l) => l.map((u) => u.id === a ? { ...u, ...c } : u)
293
+ }, Ln = S.createContext(Mn), $n = he(void 0), Un = S.createContext(void 0), _t = S.createContext(void 0), qn = 3e4, Cs = ({ children: e }) => {
294
+ const [t, n] = S.useState([]), r = S.useCallback((a) => {
295
+ n((u) => [a, ...u]);
296
+ }, []), s = S.useCallback((a, u) => {
297
+ n(
298
+ (l) => l.map((c) => c.id === a ? { ...c, ...u } : c)
266
299
  );
267
- }, []), i = _.useCallback((a) => {
268
- r((c) => c.filter((l) => l.id !== a));
300
+ }, []), o = S.useCallback((a) => {
301
+ n((u) => u.filter((l) => l.id !== a));
269
302
  }, []);
270
- _.useEffect(() => {
303
+ S.useEffect(() => {
271
304
  const a = [];
272
- for (const c of t)
273
- if (c.status === "completed" || c.status === "error") {
274
- const l = Date.now() - (c.completedAt ?? c.startedAt), u = Math.max(0, Gr - l);
275
- a.push(setTimeout(() => i(c.id), u));
305
+ for (const u of t)
306
+ if (u.status === "completed" || u.status === "error") {
307
+ const l = Date.now() - (u.completedAt ?? u.startedAt), c = Math.max(0, qn - l);
308
+ a.push(setTimeout(() => o(u.id), c));
276
309
  }
277
310
  return () => a.forEach(clearTimeout);
278
- }, [t, i]);
279
- const o = _.useMemo(
280
- () => ({ operations: t, addOperation: n, updateOperation: s, removeOperation: i }),
281
- [t, n, s, i]
311
+ }, [t, o]);
312
+ const i = S.useMemo(
313
+ () => ({ operations: t, addOperation: r, updateOperation: s, removeOperation: o }),
314
+ [t, r, s, o]
282
315
  );
283
- return /* @__PURE__ */ F(Et.Provider, { value: o, children: e });
316
+ return /* @__PURE__ */ R(_t.Provider, { value: i, children: e });
284
317
  };
285
318
  var Ie = function(e, t) {
286
- return Ie = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, n) {
287
- r.__proto__ = n;
288
- } || function(r, n) {
289
- for (var s in n) Object.prototype.hasOwnProperty.call(n, s) && (r[s] = n[s]);
319
+ return Ie = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
320
+ n.__proto__ = r;
321
+ } || function(n, r) {
322
+ for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (n[s] = r[s]);
290
323
  }, Ie(e, t);
291
324
  };
292
- function Ur(e, t) {
325
+ function jn(e, t) {
293
326
  if (typeof t != "function" && t !== null)
294
327
  throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
295
328
  Ie(e, t);
296
- function r() {
329
+ function n() {
297
330
  this.constructor = e;
298
331
  }
299
- e.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r());
332
+ e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
300
333
  }
301
- var ve = "Invariant Violation", Ze = Object.setPrototypeOf, Kr = Ze === void 0 ? function(e, t) {
334
+ var ve = "Invariant Violation", Ye = Object.setPrototypeOf, Gn = Ye === void 0 ? function(e, t) {
302
335
  return e.__proto__ = t, e;
303
- } : Ze, Qr = (
336
+ } : Ye, Kn = (
304
337
  /** @class */
305
338
  function(e) {
306
- Ur(t, e);
307
- function t(r) {
308
- r === void 0 && (r = ve);
309
- var n = e.call(this, typeof r == "number" ? ve + ": " + r + " (see https://github.com/apollographql/invariant-packages)" : r) || this;
310
- return n.framesToPop = 1, n.name = ve, Kr(n, t.prototype), n;
339
+ jn(t, e);
340
+ function t(n) {
341
+ n === void 0 && (n = ve);
342
+ var r = e.call(this, typeof n == "number" ? ve + ": " + n + " (see https://github.com/apollographql/invariant-packages)" : n) || this;
343
+ return r.framesToPop = 1, r.name = ve, Gn(r, t.prototype), r;
311
344
  }
312
345
  return t;
313
346
  }(Error)
314
347
  );
315
- function Oe(e, t) {
348
+ function Fe(e, t) {
316
349
  if (!e)
317
- throw new Qr(t);
350
+ throw new Kn(t);
318
351
  }
319
- var bt = ["debug", "log", "warn", "error", "silent"], jr = bt.indexOf("log");
320
- function ce(e) {
352
+ var Et = ["debug", "log", "warn", "error", "silent"], zn = Et.indexOf("log");
353
+ function ue(e) {
321
354
  return function() {
322
- if (bt.indexOf(e) >= jr) {
355
+ if (Et.indexOf(e) >= zn) {
323
356
  var t = console[e] || console.log;
324
357
  return t.apply(console, arguments);
325
358
  }
326
359
  };
327
360
  }
328
361
  (function(e) {
329
- e.debug = ce("debug"), e.log = ce("log"), e.warn = ce("warn"), e.error = ce("error");
330
- })(Oe || (Oe = {}));
331
- const vt = me(void 0), Pt = () => te(vt), bs = (e) => {
332
- const t = Pt();
362
+ e.debug = ue("debug"), e.log = ue("log"), e.warn = ue("warn"), e.error = ue("error");
363
+ })(Fe || (Fe = {}));
364
+ const St = he(void 0), wt = () => ne(St), bs = (e) => {
365
+ const t = wt();
333
366
  return t == null ? void 0 : t.getExtensionPoint(e);
334
367
  }, vs = (e) => {
335
- const t = Pt(), r = t == null ? void 0 : t.getExtensionPoint(e);
336
- return r ? r.provide({ getCacheKey: () => e }) : [];
337
- }, Ps = ({ registry: e, children: t }) => {
338
- const r = _.useRef(e);
339
- return _.useEffect(() => {
340
- Oe(
341
- r.current === e,
368
+ const t = wt(), n = t == null ? void 0 : t.getExtensionPoint(e);
369
+ return n ? n.provide({ getCacheKey: () => e }) : [];
370
+ }, Ds = ({ registry: e, children: t }) => {
371
+ const n = S.useRef(e);
372
+ return S.useEffect(() => {
373
+ Fe(
374
+ n.current === e,
342
375
  "You can't change the extension registry after it has been rendered"
343
376
  );
344
- }, [e]), /* @__PURE__ */ F(vt.Provider, { value: r.current, children: _.Children.only(t) });
345
- }, et = (e) => {
377
+ }, [e]), /* @__PURE__ */ R(St.Provider, { value: n.current, children: S.Children.only(t) });
378
+ }, Je = (e) => {
346
379
  if (!e || typeof e != "string")
347
380
  throw new TypeError(`extensionName is required to be a string and can't be: "${e}" (${typeof e})`);
348
381
  return e.trim();
349
382
  };
350
- class zr {
383
+ class Qn {
351
384
  constructor(t) {
352
- M(this, "_settings");
353
- M(this, "_extensions", /* @__PURE__ */ new Map());
354
- M(this, "_lookupCache", /* @__PURE__ */ new Map());
355
- M(this, "_matchCache", /* @__PURE__ */ new Map());
356
- M(this, "_matcher");
357
- const { matcher: r, ...n } = t;
358
- this._settings = n, this._matcher = t.matcher;
385
+ k(this, "_settings");
386
+ k(this, "_extensions", /* @__PURE__ */ new Map());
387
+ k(this, "_lookupCache", /* @__PURE__ */ new Map());
388
+ k(this, "_matchCache", /* @__PURE__ */ new Map());
389
+ k(this, "_matcher");
390
+ const { matcher: n, ...r } = t;
391
+ this._settings = r, this._matcher = t.matcher;
359
392
  }
360
393
  settings() {
361
394
  return this._settings;
@@ -377,15 +410,15 @@ class zr {
377
410
  register(t) {
378
411
  if (this._extensions.get(t.id))
379
412
  throw new Error(`Resource sidebar view with id ${t.id} already exists`);
380
- const r = {
413
+ const n = {
381
414
  ...t,
382
415
  registeredAt: /* @__PURE__ */ new Date(),
383
416
  updatedAt: /* @__PURE__ */ new Date(),
384
417
  enabled: !0
385
418
  };
386
- this._extensions.set(t.id, r);
387
- const n = Array.from(this._matchCache.keys());
388
- for (const s of n)
419
+ this._extensions.set(t.id, n);
420
+ const r = Array.from(this._matchCache.keys());
421
+ for (const s of r)
389
422
  s.startsWith(t.plugin) && this._matchCache.delete(s);
390
423
  }
391
424
  /**
@@ -410,8 +443,8 @@ class zr {
410
443
  * }
411
444
  */
412
445
  get(t) {
413
- var r;
414
- return (r = this._extensions.get(t)) == null ? void 0 : r.component;
446
+ var n;
447
+ return (n = this._extensions.get(t)) == null ? void 0 : n.component;
415
448
  }
416
449
  /**
417
450
  * Lists all registered components in the registry. Useful for debugging or generating summaries of available components.
@@ -433,16 +466,16 @@ class zr {
433
466
  calculateMatches(t) {
434
467
  if (!this._matcher)
435
468
  return Array.from(this._extensions.values());
436
- const r = [];
437
- for (const n of this._extensions.values()) {
438
- const s = this.generateMatchCacheKey(n), i = this._matchCache.has(s);
439
- if (i && this._matchCache.get(s)) {
440
- r.push(n);
469
+ const n = [];
470
+ for (const r of this._extensions.values()) {
471
+ const s = this.generateMatchCacheKey(r), o = this._matchCache.has(s);
472
+ if (o && this._matchCache.get(s)) {
473
+ n.push(r);
441
474
  continue;
442
475
  }
443
- this._matcher(t, n) ? (this._matchCache.set(s, !0), r.push(n)) : i || this._matchCache.set(s, !1);
476
+ this._matcher(t, r) ? (this._matchCache.set(s, !0), n.push(r)) : o || this._matchCache.set(s, !1);
444
477
  }
445
- return r;
478
+ return n;
446
479
  }
447
480
  /**
448
481
  * Preload the registry caches with the given expected context to avoid on-first-request calculation.
@@ -454,8 +487,8 @@ class zr {
454
487
  * @param context The context expected to be called preload the registry with on provide.
455
488
  */
456
489
  preload(t) {
457
- const r = this.calculateMatches(t), n = t.getCacheKey();
458
- this._lookupCache.set(n, r.map((s) => s.id));
490
+ const n = this.calculateMatches(t), r = t.getCacheKey();
491
+ this._lookupCache.set(r, n.map((s) => s.id));
459
492
  }
460
493
  /**
461
494
  * Provide the components that match the given context.
@@ -464,36 +497,36 @@ class zr {
464
497
  if (this._settings.disabled)
465
498
  return [];
466
499
  if (this._settings.mode === "single") {
467
- const i = this._extensions.get(this._settings.selected);
468
- return i ? [i.component] : [];
500
+ const o = this._extensions.get(this._settings.selected);
501
+ return o ? [o.component] : [];
469
502
  }
470
- const r = t.getCacheKey();
471
- let n = this._lookupCache.get(r);
472
- if (n) {
473
- let i = n.map((o) => this._extensions.get(o)).filter((o) => !!o).map((o) => o.component);
474
- return this._settings.order && (i = this.reorderComponents(i, n, this._settings.order)), i;
503
+ const n = t.getCacheKey();
504
+ let r = this._lookupCache.get(n);
505
+ if (r) {
506
+ let o = r.map((i) => this._extensions.get(i)).filter((i) => !!i).map((i) => i.component);
507
+ return this._settings.order && (o = this.reorderComponents(o, r, this._settings.order)), o;
475
508
  }
476
- n = this.calculateMatches(t).map((i) => i.id), this._lookupCache.set(r, n);
477
- let s = n.map((i) => this._extensions.get(i)).filter((i) => !!i).map((i) => i.component);
478
- return this._settings.order && (s = this.reorderComponents(s, n, this._settings.order)), s;
509
+ r = this.calculateMatches(t).map((o) => o.id), this._lookupCache.set(n, r);
510
+ let s = r.map((o) => this._extensions.get(o)).filter((o) => !!o).map((o) => o.component);
511
+ return this._settings.order && (s = this.reorderComponents(s, r, this._settings.order)), s;
479
512
  }
480
- reorderComponents(t, r, n) {
481
- const s = new Map(r.map((i, o) => [i, t[o]]));
482
- return n.map((i) => s.get(i)).filter((i) => !!i);
513
+ reorderComponents(t, n, r) {
514
+ const s = new Map(n.map((o, i) => [o, t[i]]));
515
+ return r.map((o) => s.get(o)).filter((o) => !!o);
483
516
  }
484
517
  /**
485
518
  * Reorder the components in the registry based on the given order.
486
519
  */
487
520
  reorder(t) {
488
- const r = t.map((o) => this._extensions.get(o)).filter((o) => !!o), n = Array.from(this._extensions.values()).filter((o) => !t.includes(o.id)), s = [...r, ...n];
489
- this._extensions.clear(), s.forEach((o) => this._extensions.set(o.id, o));
490
- const i = Array.from(this._lookupCache.keys());
491
- for (const o of i) {
492
- const a = this._lookupCache.get(o);
521
+ const n = t.map((i) => this._extensions.get(i)).filter((i) => !!i), r = Array.from(this._extensions.values()).filter((i) => !t.includes(i.id)), s = [...n, ...r];
522
+ this._extensions.clear(), s.forEach((i) => this._extensions.set(i.id, i));
523
+ const o = Array.from(this._lookupCache.keys());
524
+ for (const i of o) {
525
+ const a = this._lookupCache.get(i);
493
526
  if (!a)
494
527
  continue;
495
- const c = a.filter((l) => t.includes(l));
496
- this._lookupCache.set(o, c);
528
+ const u = a.filter((l) => t.includes(l));
529
+ this._lookupCache.set(i, u);
497
530
  }
498
531
  }
499
532
  clearLookupCache() {
@@ -506,11 +539,11 @@ class zr {
506
539
  this.clearLookupCache(), this.clearMatchCache();
507
540
  }
508
541
  }
509
- class Ds {
542
+ class Ps {
510
543
  constructor({ initialStores: t }) {
511
- M(this, "store", {});
512
- t.forEach((r) => {
513
- this.addExtensionPoint(r);
544
+ k(this, "store", {});
545
+ t.forEach((n) => {
546
+ this.addExtensionPoint(n);
514
547
  });
515
548
  }
516
549
  /**
@@ -519,18 +552,18 @@ class Ds {
519
552
  * @param opts The settings for the extension point
520
553
  */
521
554
  addExtensionPoint(t) {
522
- let r = et(t.id);
523
- if (console.log("validated", r), console.log("store", this.store), this.store[r]) {
524
- console.warn(`Extension point ${r} already exists. Not adding again.`);
555
+ let n = Je(t.id);
556
+ if (console.log("validated", n), console.log("store", this.store), this.store[n]) {
557
+ console.warn(`Extension point ${n} already exists. Not adding again.`);
525
558
  return;
526
559
  }
527
- this.store[r] = new zr(t);
560
+ this.store[n] = new Qn(t);
528
561
  }
529
562
  /**
530
563
  * Get an extension point from the registry.
531
564
  */
532
565
  getExtensionPoint(t) {
533
- return t = et(t), this.store[t];
566
+ return t = Je(t), this.store[t];
534
567
  }
535
568
  /**
536
569
  * List all extension points in the registry.
@@ -560,96 +593,96 @@ class Ds {
560
593
  return Object.values(this.store).map((t) => t.settings());
561
594
  }
562
595
  }
563
- const Dt = me(void 0), Wr = {
596
+ const Ct = he(void 0), Wn = {
564
597
  default: "info",
565
598
  info: "info",
566
599
  success: "success",
567
600
  warning: "warning",
568
601
  error: "error"
569
- }, Fs = ({ children: e }) => {
570
- const { push: t } = Rr(), [r, n] = _.useState([]), s = (o) => {
571
- n((a) => [...a, o]);
572
- }, i = (o, a, c) => {
573
- const l = typeof o == "object";
574
- let u = "", y = "info", h, f = 5e3, m;
602
+ }, Rs = ({ children: e }) => {
603
+ const { push: t } = Tn(), [n, r] = S.useState([]), s = (i) => {
604
+ r((a) => [...a, i]);
605
+ }, o = (i, a, u) => {
606
+ const l = typeof i == "object";
607
+ let c = "", g = "info", f, d = 5e3, h;
575
608
  if (l) {
576
- if (u = o.message, o.showOnce) {
577
- if (r.includes(u))
609
+ if (c = i.message, i.showOnce) {
610
+ if (n.includes(c))
578
611
  return;
579
- s(u);
612
+ s(c);
580
613
  }
581
- y = o.status, h = o.details, f = o.autoHideDuration ?? 5e3, m = o.actions;
614
+ g = i.status, f = i.details, d = i.autoHideDuration ?? 5e3, h = i.actions;
582
615
  } else
583
- u = o, y = a, h = c;
616
+ c = i, g = a, f = u;
584
617
  t({
585
- severity: Wr[y] ?? "info",
586
- title: u,
587
- message: h,
588
- timeout: f,
589
- actions: m
618
+ severity: Wn[g] ?? "info",
619
+ title: c,
620
+ message: f,
621
+ timeout: d,
622
+ actions: h
590
623
  });
591
624
  };
592
- return /* @__PURE__ */ F(Dt.Provider, { value: { showSnackbar: i }, children: e });
593
- }, $ = () => {
594
- const e = te(Dt);
625
+ return /* @__PURE__ */ R(Ct.Provider, { value: { showSnackbar: o }, children: e });
626
+ }, L = () => {
627
+ const e = ne(Ct);
595
628
  if (e === void 0)
596
629
  throw new Error("useCustomSnackbar must be used within a CustomSnackbarProvider");
597
630
  return e;
598
631
  };
599
- function P(e) {
600
- const t = te($e), r = (t == null ? void 0 : t.pluginId) ?? e;
601
- if (!r)
632
+ function D(e) {
633
+ const t = ne(Le), n = (t == null ? void 0 : t.pluginId) ?? e;
634
+ if (!n)
602
635
  throw new Error(
603
636
  "pluginID must be provided either via PluginContext or as an explicit parameter"
604
637
  );
605
- return r;
606
- }
607
- const xs = ({ pluginID: e, connectionID: t }) => {
608
- const r = P(e), n = G(), { showSnackbar: s } = $(), i = [r, "connection", "detail", t], { mutateAsync: o } = v({
609
- mutationFn: async () => rr(r, t),
610
- onSuccess(y) {
611
- n.setQueryData(i, y), n.invalidateQueries({
612
- queryKey: ["EDITOR_SCHEMAS", r, t]
638
+ return n;
639
+ }
640
+ const Is = ({ pluginID: e, connectionID: t }) => {
641
+ const n = D(e), r = G(), { showSnackbar: s } = L(), o = [n, "connection", "detail", t], { mutateAsync: i } = v({
642
+ mutationFn: async () => Xt(n, t),
643
+ onSuccess(g) {
644
+ r.setQueryData(o, g), r.invalidateQueries({
645
+ queryKey: ["EDITOR_SCHEMAS", n, t]
613
646
  });
614
647
  },
615
648
  onError: I(s, "Failed to start connection")
616
649
  }), { mutateAsync: a } = v({
617
- mutationFn: async () => lt(r, t),
618
- onSuccess(y) {
619
- n.setQueryData(i, y);
650
+ mutationFn: async () => it(n, t),
651
+ onSuccess(g) {
652
+ r.setQueryData(o, g);
620
653
  },
621
654
  onError: I(s, "Failed to stop connection")
622
- }), { mutateAsync: c } = v({
623
- mutationFn: async (y) => nr(r, y),
624
- onSuccess(y, { name: h }) {
625
- s({ message: `Connection ${h} successfully updated`, status: "success" }), n.setQueryData(i, u), n.setQueriesData(
626
- { queryKey: [r, "connection", "list"] },
627
- (f) => f == null ? void 0 : f.map((m) => m.id === t ? y : m)
655
+ }), { mutateAsync: u } = v({
656
+ mutationFn: async (g) => Zt(n, g),
657
+ onSuccess(g, { name: f }) {
658
+ s({ message: `Connection ${f} successfully updated`, status: "success" }), r.setQueryData(o, c), r.setQueriesData(
659
+ { queryKey: [n, "connection", "list"] },
660
+ (d) => d == null ? void 0 : d.map((h) => h.id === t ? g : h)
628
661
  );
629
662
  },
630
663
  onError: I(s, "Failed to update connection")
631
664
  }), { mutateAsync: l } = v({
632
- mutationFn: async () => sr(r, t),
665
+ mutationFn: async () => en(n, t),
633
666
  onSuccess() {
634
- s({ message: "Connection successfully removed", status: "success" }), n.setQueryData(i, void 0), n.setQueriesData(
635
- { queryKey: [r, "connection", "list"] },
636
- (y) => y == null ? void 0 : y.filter((h) => h.id !== t)
667
+ s({ message: "Connection successfully removed", status: "success" }), r.setQueryData(o, void 0), r.setQueriesData(
668
+ { queryKey: [n, "connection", "list"] },
669
+ (g) => g == null ? void 0 : g.filter((f) => f.id !== t)
637
670
  );
638
671
  },
639
672
  onError: I(s, "Failed to remove connection")
640
- }), u = D({
641
- queryKey: i,
642
- queryFn: async () => or(r, t)
673
+ }), c = P({
674
+ queryKey: o,
675
+ queryFn: async () => tn(n, t)
643
676
  });
644
677
  return {
645
678
  /**
646
679
  * Get the connection
647
680
  */
648
- connection: u,
681
+ connection: c,
649
682
  /**
650
683
  * Start the connection
651
684
  */
652
- startConnection: o,
685
+ startConnection: i,
653
686
  /**
654
687
  * Stop the connection
655
688
  */
@@ -657,577 +690,591 @@ const xs = ({ pluginID: e, connectionID: t }) => {
657
690
  /**
658
691
  * Update the connection.
659
692
  */
660
- updateConnection: c,
693
+ updateConnection: u,
661
694
  /**
662
695
  * Delete the connection
663
696
  */
664
697
  deleteConnection: l
665
698
  };
666
- }, Hr = (e) => [e, "connection", "list"], Is = ({ plugin: e }) => {
667
- const t = P(e), r = G(), { showSnackbar: n } = $(), s = Hr(t), { mutateAsync: i } = v({
668
- mutationFn: async (l) => dt(t, l.id),
669
- onError: I(n, "Failed to start connection informer")
670
- }), { mutateAsync: o } = v({
671
- mutationFn: async (l) => ir(t, l.id),
672
- onError: I(n, "Failed to stop connection informer")
673
- }), a = _.useCallback((l) => {
674
- console.log("got update to connections", l), r.setQueryData(s, l);
699
+ }, Bn = (e) => [e, "connection", "list"], Fs = ({ plugin: e }) => {
700
+ const t = D(e), n = G(), { showSnackbar: r } = L(), s = Bn(t), { mutateAsync: o } = v({
701
+ mutationFn: async (l) => at(t, l.id),
702
+ onError: I(r, "Failed to start connection watch")
703
+ }), { mutateAsync: i } = v({
704
+ mutationFn: async (l) => nn(t, l.id),
705
+ onError: I(r, "Failed to stop connection watch")
706
+ }), a = S.useCallback((l) => {
707
+ console.log("got update to connections", l), n.setQueryData(s, l);
675
708
  }, []);
676
- return _.useEffect(() => {
677
- const l = A(`${t}/connection/sync`, a);
709
+ return S.useEffect(() => {
710
+ const l = x(`${t}/connection/sync`, a);
678
711
  return () => {
679
712
  l();
680
713
  };
681
714
  }, []), {
682
- connections: D({
715
+ connections: P({
683
716
  queryKey: s,
684
717
  queryFn: async () => {
685
718
  try {
686
- return await ar(t);
719
+ return await rn(t);
687
720
  } catch (l) {
688
- console.log(l), I(n, "Failed to load connections")(l);
721
+ console.log(l), I(r, "Failed to load connections")(l);
689
722
  }
690
723
  return [];
691
724
  },
692
725
  staleTime: 3e4,
693
- placeholderData: gt
726
+ placeholderData: pt
694
727
  }),
695
- startInformer: i,
696
- stopInformer: o
728
+ startWatch: o,
729
+ stopWatch: i
697
730
  };
698
731
  }, Os = ({ pluginID: e, connectionID: t }) => {
699
- const r = P(e);
732
+ const n = D(e);
700
733
  return {
701
734
  /**
702
735
  * Get the connection
703
736
  */
704
- namespaces: D({
705
- queryKey: [r, "connection", "namespaces", t],
706
- queryFn: async () => cr(r, t)
737
+ namespaces: P({
738
+ queryKey: [n, "connection", "namespaces", t],
739
+ queryFn: async () => sn(n, t)
707
740
  })
708
741
  };
709
- };
710
- var Br = /* @__PURE__ */ ((e) => (e[e.OnConnect = 0] = "OnConnect", e[e.OnFirstQuery = 1] = "OnFirstQuery", e[e.Never = 2] = "Never", e))(Br || {}), x = /* @__PURE__ */ ((e) => (e[e.Pending = 0] = "Pending", e[e.Syncing = 1] = "Syncing", e[e.Synced = 2] = "Synced", e[e.Error = 3] = "Error", e[e.Cancelled = 4] = "Cancelled", e))(x || {});
711
- function Ft(e) {
712
- const t = Object.values(e.states), r = t.length;
713
- let n = 0, s = 0;
714
- for (const a of t)
715
- a === x.Synced && n++, a === x.Error && s++;
716
- const i = t.filter(
717
- (a) => a === x.Synced || a === x.Error || a === x.Cancelled
718
- ).length, o = r > 0 ? i / r : 0;
742
+ }, w = A.WatchState, xs = A.SyncPolicy;
743
+ function Oe(e) {
744
+ const t = Object.values(e.states), n = t.length;
745
+ let r = 0, s = 0, o = 0, i = 0;
746
+ for (const c of t)
747
+ c === w.SYNCED && r++, (c === w.ERROR || c === w.FAILED) && s++, c === w.FORBIDDEN && o++, c === w.SKIPPED && i++;
748
+ const a = n - i, u = t.filter(
749
+ (c) => c === w.SYNCED || c === w.ERROR || c === w.STOPPED || c === w.FAILED || c === w.FORBIDDEN
750
+ ).length, l = a > 0 ? u / a : 0;
719
751
  return {
720
752
  pluginID: e.pluginID,
721
753
  connectionID: e.connectionID,
722
- totalResources: r,
723
- syncedCount: n,
754
+ totalResources: n,
755
+ watchedTotal: a,
756
+ syncedCount: r,
724
757
  errorCount: s,
725
- doneCount: i,
726
- progress: o
758
+ forbiddenCount: o,
759
+ skippedCount: i,
760
+ doneCount: u,
761
+ progress: l
727
762
  };
728
763
  }
729
- function fe(e) {
730
- return e.totalResources > 0 && e.doneCount >= e.totalResources;
764
+ function de(e) {
765
+ return e.watchedTotal > 0 && e.doneCount >= e.watchedTotal;
731
766
  }
732
- function xt(e) {
733
- return e.some((t) => !fe(t));
767
+ function bt(e) {
768
+ return e.some((t) => !de(t));
734
769
  }
735
- function It(e) {
736
- const t = e.reduce((n, s) => n + s.totalResources, 0);
737
- return t === 0 ? 0 : e.reduce((n, s) => n + s.doneCount, 0) / t;
770
+ function vt(e) {
771
+ const t = e.reduce((r, s) => r + s.watchedTotal, 0);
772
+ return t === 0 ? 0 : e.reduce((r, s) => r + s.doneCount, 0) / t;
738
773
  }
739
- function qe(e) {
774
+ function Ue(e) {
740
775
  return `${e.pluginId}/${e.connection}`;
741
776
  }
742
- function Ot(e, t) {
743
- const r = qe(t);
744
- e.has(r) || e.set(r, {
777
+ function Dt(e, t) {
778
+ const n = Ue(t);
779
+ e.has(n) || e.set(n, {
745
780
  states: {},
746
781
  pluginID: t.pluginId,
747
782
  connectionID: t.connection
748
783
  });
749
- const n = e.get(r);
750
- return n.states[t.resourceKey] = t.state, n;
784
+ const r = e.get(n);
785
+ return r.states[t.resourceKey] = t.state, r;
751
786
  }
752
787
  function As() {
753
- const [e, t] = q(/* @__PURE__ */ new Set()), [r, n] = q({}), [s, i] = q(/* @__PURE__ */ new Map()), o = de(/* @__PURE__ */ new Map());
754
- Q(() => {
755
- Ye().then((p) => {
756
- p && n(p);
788
+ const [e, t] = q(/* @__PURE__ */ new Set()), [n, r] = q({}), [s, o] = q(/* @__PURE__ */ new Map()), i = $(/* @__PURE__ */ new Map());
789
+ j(() => {
790
+ on().then((y) => {
791
+ if (!y) return;
792
+ const m = {}, p = /* @__PURE__ */ new Set(), E = /* @__PURE__ */ new Map();
793
+ for (const [_, C] of Object.entries(y)) {
794
+ m[_] = C.map((F) => F.connection);
795
+ for (const F of C) {
796
+ if (!F.started) continue;
797
+ const b = `${_}/${F.connection.id}`;
798
+ p.add(b);
799
+ const z = {
800
+ pluginID: _,
801
+ connectionID: F.connection.id,
802
+ states: {}
803
+ };
804
+ if (F.resources)
805
+ for (const [Ce, se] of Object.entries(F.resources))
806
+ z.states[Ce] = se;
807
+ i.current.set(b, z), E.set(b, Oe(z));
808
+ }
809
+ }
810
+ r(m), t(p), o(E);
757
811
  }).catch(() => {
758
812
  });
759
- }, []), Q(() => A("connection/status", (S) => {
760
- const w = `${S.pluginID}/${S.connectionID}`;
761
- S.status === "DISCONNECTED" ? (t((b) => {
762
- const d = new Set(b);
763
- return d.delete(w), d;
764
- }), i((b) => {
765
- const d = new Map(b);
766
- return d.delete(w), d;
767
- }), o.current.delete(w)) : t((b) => {
768
- const d = new Set(b);
769
- return d.add(w), d;
770
- }), Ye().then((b) => {
771
- b && n(b);
813
+ }, []), j(() => x("connection/status", (m) => {
814
+ const p = `${m.pluginID}/${m.connectionID}`;
815
+ m.status === "DISCONNECTED" ? (t((E) => {
816
+ const _ = new Set(E);
817
+ return _.delete(p), _;
818
+ }), o((E) => {
819
+ const _ = new Map(E);
820
+ return _.delete(p), _;
821
+ }), i.current.delete(p)) : t((E) => {
822
+ const _ = new Set(E);
823
+ return _.add(p), _;
824
+ }), an().then((E) => {
825
+ E && r(E);
772
826
  }).catch(() => {
773
827
  });
774
828
  }), []);
775
- const a = V((p) => {
776
- const S = qe(p);
777
- t((d) => {
778
- if (d.has(S)) return d;
779
- const g = new Set(d);
780
- return g.add(S), g;
829
+ const a = U((y) => {
830
+ const m = Ue(y);
831
+ t((_) => {
832
+ if (_.has(m)) return _;
833
+ const C = new Set(_);
834
+ return C.add(m), C;
781
835
  });
782
- const w = Ot(o.current, p), b = Ft(w);
783
- i((d) => {
784
- const g = new Map(d);
785
- return g.set(S, b), g;
836
+ const p = Dt(i.current, y), E = Oe(p);
837
+ o((_) => {
838
+ const C = new Map(_);
839
+ return C.set(m, E), C;
786
840
  });
787
841
  }, []);
788
- Q(() => A("informer/STATE", a), [a]);
789
- const c = V(async (p, S) => {
790
- await lt(p, S);
791
- }, []), l = V(async (p, S) => {
792
- await dt(p, S);
793
- }, []), u = [];
794
- for (const p of e) {
795
- const [S, w] = p.split("/", 2), d = (r[S] ?? []).find((k) => k.id === w), g = s.get(p), E = g != null && !fe(g), C = g != null && g.errorCount > 0;
796
- u.push({
797
- pluginID: S,
798
- connectionID: w,
799
- name: (d == null ? void 0 : d.name) ?? w,
800
- avatar: (d == null ? void 0 : d.avatar) ?? "",
842
+ j(() => x("watch/STATE", a), [a]);
843
+ const u = U(async (y, m) => {
844
+ await it(y, m);
845
+ }, []), l = U(async (y, m) => {
846
+ await at(y, m);
847
+ }, []), c = [];
848
+ for (const y of e) {
849
+ const [m, p] = y.split("/", 2), _ = (n[m] ?? []).find((z) => z.id === p), C = s.get(y), F = C != null && !de(C), b = C != null && C.errorCount > 0;
850
+ c.push({
851
+ pluginID: m,
852
+ connectionID: p,
853
+ name: (_ == null ? void 0 : _.name) ?? p,
854
+ avatar: (_ == null ? void 0 : _.avatar) ?? "",
801
855
  isStarted: !0,
802
- sync: g,
803
- isSyncing: E,
804
- hasErrors: C
856
+ sync: C,
857
+ isSyncing: F,
858
+ hasErrors: b
805
859
  });
806
860
  }
807
- const y = /* @__PURE__ */ new Map();
808
- for (const p of u) {
809
- const S = y.get(p.pluginID) ?? [];
810
- S.push(p), y.set(p.pluginID, S);
861
+ const g = /* @__PURE__ */ new Map();
862
+ for (const y of c) {
863
+ const m = g.get(y.pluginID) ?? [];
864
+ m.push(y), g.set(y.pluginID, m);
811
865
  }
812
- const h = Array.from(s.values()), f = u.filter((p) => p.isSyncing), m = u.filter((p) => p.hasErrors);
866
+ const f = Array.from(s.values()), d = c.filter((y) => y.isSyncing), h = c.filter((y) => y.hasErrors);
813
867
  return {
814
- entries: u,
815
- grouped: y,
816
- connectedCount: u.length,
817
- syncingCount: f.length,
818
- errorCount: m.length,
819
- hasSyncing: xt(h),
820
- aggregateProgress: It(h),
821
- disconnect: c,
822
- retryInformer: l
868
+ entries: c,
869
+ grouped: g,
870
+ connectedCount: c.length,
871
+ syncingCount: d.length,
872
+ errorCount: h.length,
873
+ hasSyncing: bt(f),
874
+ aggregateProgress: vt(f),
875
+ disconnect: u,
876
+ retryWatch: l
823
877
  };
824
878
  }
825
- function Yr(e, t) {
879
+ function Hn(e, t) {
826
880
  return window.go.data.Client.Get(e, t);
827
881
  }
828
- function Jr(e, t, r) {
829
- return window.go.data.Client.Set(e, t, r);
882
+ function Yn(e, t, n) {
883
+ return window.go.data.Client.Set(e, t, n);
830
884
  }
831
- function Ts(e, t, r) {
832
- const n = P(e), s = G(), i = [n, "data", t], o = D({
833
- queryKey: i,
885
+ function Ts(e, t, n) {
886
+ const r = D(e), s = G(), o = [r, "data", t], i = P({
887
+ queryKey: o,
834
888
  queryFn: async () => {
835
- const c = await Yr(n, t);
836
- return c ?? r;
889
+ const u = await Hn(r, t);
890
+ return u ?? n;
837
891
  }
838
892
  }), a = v({
839
- mutationFn: async (c) => {
840
- await Jr(n, t, c);
893
+ mutationFn: async (u) => {
894
+ await Yn(r, t, u);
841
895
  },
842
- onMutate: async (c) => {
843
- await s.cancelQueries({ queryKey: i });
844
- const l = s.getQueryData(i);
845
- return s.setQueryData(i, c), { previous: l };
896
+ onMutate: async (u) => {
897
+ await s.cancelQueries({ queryKey: o });
898
+ const l = s.getQueryData(o);
899
+ return s.setQueryData(o, u), { previous: l };
846
900
  },
847
- onError: (c, l, u) => {
848
- (u == null ? void 0 : u.previous) !== void 0 && s.setQueryData(i, u.previous);
901
+ onError: (u, l, c) => {
902
+ (c == null ? void 0 : c.previous) !== void 0 && s.setQueryData(o, c.previous);
849
903
  },
850
904
  onSettled: () => {
851
- s.invalidateQueries({ queryKey: i });
905
+ s.invalidateQueries({ queryKey: o });
852
906
  }
853
907
  });
854
908
  return {
855
- data: o.data ?? r,
856
- update: async (c) => {
857
- await a.mutateAsync(c);
909
+ data: i.data ?? n,
910
+ update: async (u) => {
911
+ await a.mutateAsync(u);
858
912
  },
859
- isLoading: o.isLoading
913
+ isLoading: i.isLoading
860
914
  };
861
915
  }
862
916
  const Ns = () => {
863
- const e = te(Lr);
917
+ const e = ne($n);
864
918
  if (!e) throw new Error("useRightDrawer must be used within a RightDrawerProvider");
865
919
  return e;
866
- }, At = () => {
867
- const e = te($r);
920
+ }, Pt = () => {
921
+ const e = ne(Ln);
868
922
  if (e === void 0)
869
923
  throw new Error("useBottomDrawer must be used within a BottomDrawerProvider");
870
924
  return e;
871
- }, Rs = ({ pluginID: e }) => {
872
- const t = P(e), { showSnackbar: r } = $(), { createTab: n, updateTab: s } = At();
925
+ }, ks = ({ pluginID: e }) => {
926
+ const t = D(e), { showSnackbar: n } = L(), { createTab: r, updateTab: s } = Pt();
873
927
  return {
874
928
  createSession: v({
875
- mutationFn: async ({ connectionID: o, icon: a, label: c, opts: l }) => {
876
- const u = `pending-${crypto.randomUUID()}`;
877
- n({
878
- id: u,
879
- title: c ?? "Connecting...",
929
+ mutationFn: async ({ connectionID: i, icon: a, label: u, opts: l }) => {
930
+ const c = `pending-${crypto.randomUUID()}`;
931
+ r({
932
+ id: c,
933
+ title: u ?? "Connecting...",
880
934
  variant: "terminal",
881
935
  icon: a ?? "LuSquareTerminal",
882
936
  properties: {
883
937
  status: "connecting",
884
938
  pluginID: t,
885
- connectionID: o,
939
+ connectionID: i,
886
940
  opts: { ...l }
887
941
  }
888
942
  });
889
- const y = Tr.SessionOptions.createFrom({
943
+ const g = xn.SessionOptions.createFrom({
890
944
  command: ["/bin/bash"],
891
945
  tty: !0,
892
946
  ...l
893
947
  });
894
948
  try {
895
- const h = await ur(t, o, y);
949
+ const f = await cn(t, i, g);
896
950
  s(
897
- { id: u },
951
+ { id: c },
898
952
  {
899
- id: h.id,
900
- title: c ?? `Session ${h.id.substring(0, 8)}`,
901
- properties: { status: "connected", pluginID: t, connectionID: o, opts: { ...l } }
953
+ id: f.id,
954
+ title: u ?? `Session ${f.id.substring(0, 8)}`,
955
+ properties: { status: "connected", pluginID: t, connectionID: i, opts: { ...l } }
902
956
  }
903
957
  );
904
- } catch (h) {
905
- const f = U(h);
958
+ } catch (f) {
959
+ const d = K(f);
906
960
  s(
907
- { id: u },
961
+ { id: c },
908
962
  {
909
- properties: { status: "error", error: f.detail, pluginID: t, connectionID: o, opts: { ...l } }
963
+ properties: { status: "error", error: d.detail, pluginID: t, connectionID: i, opts: { ...l } }
910
964
  }
911
- ), X(r, h, "Failed to start session");
965
+ ), Z(n, f, "Failed to start session");
912
966
  }
913
967
  }
914
968
  }).mutateAsync
915
969
  };
916
- }, ks = ({ pluginID: e }) => {
917
- const t = P(e), { showSnackbar: r } = $(), { createTab: n } = At(), s = v({
970
+ }, Ms = ({ pluginID: e }) => {
971
+ const t = D(e), { showSnackbar: n } = L(), { createTab: r } = Pt(), s = v({
918
972
  mutationFn: async ({
919
- connectionID: o,
973
+ connectionID: i,
920
974
  resourceKey: a,
921
- resourceID: c,
975
+ resourceID: u,
922
976
  resourceData: l,
923
- icon: u,
924
- label: y,
925
- target: h,
926
- follow: f = !0,
927
- tailLines: m = 1e3,
928
- params: p
977
+ icon: c,
978
+ label: g,
979
+ target: f,
980
+ follow: d = !0,
981
+ tailLines: h = 1e3,
982
+ params: y
929
983
  }) => {
930
- const S = Ve.CreateSessionOptions.createFrom({
984
+ const m = Be.CreateSessionOptions.createFrom({
931
985
  resource_key: a,
932
- resource_id: c,
986
+ resource_id: u,
933
987
  resource_data: l,
934
- options: Ve.LogSessionOptions.createFrom({
935
- target: h ?? "",
936
- follow: f,
988
+ options: Be.LogSessionOptions.createFrom({
989
+ target: f ?? "",
990
+ follow: d,
937
991
  include_previous: !1,
938
992
  include_timestamps: !0,
939
- tail_lines: m,
993
+ tail_lines: h,
940
994
  since_seconds: 0,
941
995
  limit_bytes: 0,
942
996
  include_source_events: !0,
943
- params: p ?? {}
997
+ params: y ?? {}
944
998
  })
945
- }), w = await lr(t, o, S);
946
- return n({
947
- id: w.id,
948
- title: y ?? `Logs ${w.id.substring(0, 8)}`,
999
+ }), p = await un(t, i, m);
1000
+ return r({
1001
+ id: p.id,
1002
+ title: g ?? `Logs ${p.id.substring(0, 8)}`,
949
1003
  variant: "logs",
950
- icon: u ?? "LuLogs"
951
- }), w;
1004
+ icon: c ?? "LuLogs"
1005
+ }), p;
952
1006
  },
953
- onError: I(r, "Failed to start log session")
954
- }), i = v({
955
- mutationFn: async (o) => {
956
- await dr(o);
1007
+ onError: I(n, "Failed to start log session")
1008
+ }), o = v({
1009
+ mutationFn: async (i) => {
1010
+ await ln(i);
957
1011
  },
958
- onError: I(r, "Failed to close log session")
1012
+ onError: I(n, "Failed to close log session")
959
1013
  });
960
1014
  return {
961
1015
  createLogSession: s.mutateAsync,
962
- closeLogSession: i.mutateAsync
1016
+ closeLogSession: o.mutateAsync
963
1017
  };
964
- }, Ms = () => D({
1018
+ }, Ls = () => P({
965
1019
  queryKey: ["metric", "providers"],
966
- queryFn: fr,
1020
+ queryFn: dn,
967
1021
  staleTime: 3e4
968
- }), Vr = (e) => D({
1022
+ }), Jn = (e) => P({
969
1023
  queryKey: ["metric", "providers", e],
970
- queryFn: () => pr(e),
1024
+ queryFn: () => fn(e),
971
1025
  enabled: !!e,
972
1026
  staleTime: 3e4
973
1027
  }), $s = (e) => {
974
- var S, w;
1028
+ var m, p;
975
1029
  const {
976
1030
  connectionID: t,
977
- resourceKey: r,
978
- resourceID: n,
1031
+ resourceKey: n,
1032
+ resourceID: r,
979
1033
  resourceNamespace: s = "",
980
- resourceData: i = {},
981
- metricIDs: o = [],
1034
+ resourceData: o = {},
1035
+ metricIDs: i = [],
982
1036
  shape: a = 0,
983
1037
  // CURRENT
984
- timeRange: c,
1038
+ timeRange: u,
985
1039
  refreshInterval: l = 0,
986
- enabled: u = !0
1040
+ enabled: c = !0
987
1041
  } = e, {
988
- data: y,
989
- isLoading: h
990
- } = Vr(r), f = y ?? [], m = c ? Math.max(
991
- Math.floor((c.end.getTime() - c.start.getTime()) / 250),
1042
+ data: g,
1043
+ isLoading: f
1044
+ } = Jn(n), d = g ?? [], h = u ? Math.max(
1045
+ Math.floor((u.end.getTime() - u.start.getTime()) / 250),
992
1046
  15e3
993
- ) * 1e6 : 0, p = D({
1047
+ ) * 1e6 : 0, y = P({
994
1048
  queryKey: [
995
1049
  "metric",
996
1050
  "query",
997
1051
  t,
998
- r,
999
1052
  n,
1053
+ r,
1000
1054
  s,
1001
- o,
1055
+ i,
1002
1056
  a,
1003
- (S = c == null ? void 0 : c.start) == null ? void 0 : S.getTime(),
1004
- (w = c == null ? void 0 : c.end) == null ? void 0 : w.getTime()
1057
+ (m = u == null ? void 0 : u.start) == null ? void 0 : m.getTime(),
1058
+ (p = u == null ? void 0 : u.end) == null ? void 0 : p.getTime()
1005
1059
  ],
1006
- queryFn: () => yr(
1060
+ queryFn: () => pn(
1007
1061
  t,
1008
- r,
1009
1062
  n,
1063
+ r,
1010
1064
  s,
1011
- i,
1012
1065
  o,
1066
+ i,
1013
1067
  a,
1014
- (c == null ? void 0 : c.start) ?? /* @__PURE__ */ new Date(0),
1015
- (c == null ? void 0 : c.end) ?? /* @__PURE__ */ new Date(0),
1016
- m
1068
+ (u == null ? void 0 : u.start) ?? /* @__PURE__ */ new Date(0),
1069
+ (u == null ? void 0 : u.end) ?? /* @__PURE__ */ new Date(0),
1070
+ h
1017
1071
  ),
1018
- enabled: u && !!t && !!r && (r.startsWith("cluster::") || !!n) && f.length > 0,
1072
+ enabled: c && !!t && !!n && (n.startsWith("cluster::") || !!r) && d.length > 0,
1019
1073
  refetchInterval: l > 0 ? l : void 0,
1020
1074
  staleTime: 5e3,
1021
1075
  // Keep previous data visible while fetching new data (e.g. on time range change)
1022
1076
  // to prevent the chart from blinking empty.
1023
- placeholderData: gt
1077
+ placeholderData: pt
1024
1078
  });
1025
1079
  return {
1026
- data: p.data ?? void 0,
1027
- providers: f,
1028
- isLoading: h || p.isLoading,
1029
- error: p.error,
1030
- refetch: p.refetch
1080
+ data: y.data ?? void 0,
1081
+ providers: d,
1082
+ isLoading: f || y.isLoading,
1083
+ error: y.error,
1084
+ refetch: y.refetch
1031
1085
  };
1032
- }, Ls = (e) => {
1086
+ }, Us = (e) => {
1033
1087
  const {
1034
1088
  pluginID: t,
1035
- connectionID: r,
1036
- resourceKey: n,
1089
+ connectionID: n,
1090
+ resourceKey: r,
1037
1091
  resourceID: s,
1038
- resourceNamespace: i = "",
1039
- resourceData: o = {},
1092
+ resourceNamespace: o = "",
1093
+ resourceData: i = {},
1040
1094
  metricIDs: a = [],
1041
- interval: c = 1e4,
1095
+ interval: u = 1e4,
1042
1096
  enabled: l = !0
1043
- } = e, u = P(t), [y, h] = q(null), [f, m] = q(null), [p, S] = q(!1), [w, b] = q(null), d = de(null), g = V(async () => {
1044
- if (!(!l || !u || !r || !n || !s))
1097
+ } = e, c = D(t), [g, f] = q(null), [d, h] = q(null), [y, m] = q(!1), [p, E] = q(null), _ = $(null), C = U(async () => {
1098
+ if (!(!l || !c || !n || !r || !s))
1045
1099
  try {
1046
- const C = await hr(u, r, {
1047
- resource_key: n,
1100
+ const b = await yn(c, n, {
1101
+ resource_key: r,
1048
1102
  resource_id: s,
1049
- resource_namespace: i,
1050
- resource_data: o,
1103
+ resource_namespace: o,
1104
+ resource_data: i,
1051
1105
  metric_ids: a,
1052
- interval: c * 1e6
1106
+ interval: u * 1e6
1053
1107
  // ms to nanoseconds for Go time.Duration
1054
1108
  });
1055
- m(C), S(!0), b(null);
1056
- const k = A(`core/metrics/data/${C}`, (B) => {
1109
+ h(b), m(!0), E(null);
1110
+ const z = x(`core/metrics/data/${b}`, (se) => {
1057
1111
  try {
1058
- const L = JSON.parse(B);
1059
- L.results && h(L.results);
1060
- } catch (L) {
1061
- console.error("Failed to parse metric stream data:", L);
1112
+ const Q = JSON.parse(se);
1113
+ Q.results && f(Q.results);
1114
+ } catch (Q) {
1115
+ console.error("Failed to parse metric stream data:", Q);
1062
1116
  }
1063
- }), ie = A(`core/metrics/error/${C}`, (B) => {
1117
+ }), Ce = x(`core/metrics/error/${b}`, (se) => {
1064
1118
  try {
1065
- const L = JSON.parse(B);
1066
- b(L.error || "Unknown error");
1119
+ const Q = JSON.parse(se);
1120
+ E(Q.error || "Unknown error");
1067
1121
  } catch {
1068
- b("Failed to parse metric stream error");
1122
+ E("Failed to parse metric stream error");
1069
1123
  }
1070
1124
  });
1071
- d.current = () => {
1072
- k(), ie();
1125
+ _.current = () => {
1126
+ z(), Ce();
1073
1127
  };
1074
- } catch (C) {
1075
- b(C instanceof Error ? C.message : String(C));
1128
+ } catch (b) {
1129
+ E(b instanceof Error ? b.message : String(b));
1076
1130
  }
1077
- }, [u, r, n, s, i, a, c, l]), E = V(async () => {
1078
- if (f)
1131
+ }, [c, n, r, s, o, a, u, l]), F = U(async () => {
1132
+ if (d)
1079
1133
  try {
1080
- await Je(f);
1081
- } catch (C) {
1082
- console.error("Failed to unsubscribe:", C);
1134
+ await We(d);
1135
+ } catch (b) {
1136
+ console.error("Failed to unsubscribe:", b);
1083
1137
  }
1084
- d.current && (d.current(), d.current = null), m(null), S(!1);
1085
- }, [f]);
1086
- return Q(() => () => {
1087
- f && Je(f).catch(console.error), d.current && d.current();
1088
- }, [f]), {
1089
- data: y,
1090
- subscriptionID: f,
1091
- isStreaming: p,
1092
- error: w,
1093
- start: g,
1094
- stop: E
1138
+ _.current && (_.current(), _.current = null), h(null), m(!1);
1139
+ }, [d]);
1140
+ return j(() => () => {
1141
+ d && We(d).catch(console.error), _.current && _.current();
1142
+ }, [d]), {
1143
+ data: g,
1144
+ subscriptionID: d,
1145
+ isStreaming: y,
1146
+ error: p,
1147
+ start: C,
1148
+ stop: F
1095
1149
  };
1096
- }, J = ["networker", "portforward", "all-sessions"];
1150
+ }, X = ["networker", "portforward", "all-sessions"];
1097
1151
  function qs() {
1098
- const { showSnackbar: e } = $(), t = G(), r = D({
1099
- queryKey: [...J],
1100
- queryFn: async () => mr().catch((i) => {
1101
- if (U(i).detail.includes("not found")) return [];
1102
- throw i;
1152
+ const { showSnackbar: e } = L(), t = G(), n = P({
1153
+ queryKey: [...X],
1154
+ queryFn: async () => hn().catch((o) => {
1155
+ if (K(o).detail.includes("not found")) return [];
1156
+ throw o;
1103
1157
  }),
1104
1158
  retry: !1
1105
1159
  });
1106
- Q(() => {
1107
- const i = A("core/networker/portforward/created", () => {
1108
- t.invalidateQueries({ queryKey: [...J] });
1109
- }), o = A("core/networker/portforward/closed", () => {
1110
- t.invalidateQueries({ queryKey: [...J] });
1160
+ j(() => {
1161
+ const o = x("core/networker/portforward/created", () => {
1162
+ t.invalidateQueries({ queryKey: [...X] });
1163
+ }), i = x("core/networker/portforward/closed", () => {
1164
+ t.invalidateQueries({ queryKey: [...X] });
1111
1165
  });
1112
1166
  return () => {
1113
- i(), o();
1167
+ o(), i();
1114
1168
  };
1115
1169
  }, [t]);
1116
- const n = r.data ?? [], s = v({
1117
- mutationFn: async (i) => ft(i),
1170
+ const r = n.data ?? [], s = v({
1171
+ mutationFn: async (o) => ct(o),
1118
1172
  onError: I(e, "Failed to close port forwarding session"),
1119
1173
  onSuccess: async () => {
1120
- await t.invalidateQueries({ queryKey: [...J] });
1174
+ await t.invalidateQueries({ queryKey: [...X] });
1121
1175
  }
1122
1176
  });
1123
1177
  return {
1124
- sessions: r,
1125
- activeSessions: n,
1178
+ sessions: n,
1179
+ activeSessions: r,
1126
1180
  closeSession: s.mutateAsync,
1127
- openInBrowser: (i) => _t(`http://localhost:${i}`)
1181
+ openInBrowser: (o) => yt(`http://localhost:${o}`)
1128
1182
  };
1129
1183
  }
1130
- function Gs({ pluginID: e, connectionID: t, resourceID: r }) {
1131
- const n = P(e), s = ["networker", "portforward", "sessions", n, t, r], { showSnackbar: i } = $(), o = G(), a = D({
1184
+ function js({ pluginID: e, connectionID: t, resourceID: n }) {
1185
+ const r = D(e), s = ["networker", "portforward", "sessions", r, t, n], { showSnackbar: o } = L(), i = G(), a = P({
1132
1186
  queryKey: s,
1133
- queryFn: async () => gr(n, t, Xe.FindPortForwardSessionRequest.createFrom({
1134
- resource_id: r,
1187
+ queryFn: async () => gn(r, t, He.FindPortForwardSessionRequest.createFrom({
1188
+ resource_id: n,
1135
1189
  connection_id: t
1136
- })).catch((u) => {
1137
- const y = U(u);
1138
- return y.detail.includes("not found") ? [] : (i({ message: "Failed to fetch port forward sessions", status: "error", details: y.detail }), []);
1190
+ })).catch((c) => {
1191
+ const g = K(c);
1192
+ return g.detail.includes("not found") ? [] : (o({ message: "Failed to fetch port forward sessions", status: "error", details: g.detail }), []);
1139
1193
  }),
1140
1194
  retry: !1
1141
- }), c = v({
1142
- mutationFn: async ({ opts: u }) => {
1143
- const y = Xe.PortForwardSessionOptions.createFrom({
1144
- local_port: u.localPort || 0,
1145
- remote_port: u.remotePort,
1146
- protocol: u.protocol || "TCP",
1195
+ }), u = v({
1196
+ mutationFn: async ({ opts: c }) => {
1197
+ const g = He.PortForwardSessionOptions.createFrom({
1198
+ local_port: c.localPort || 0,
1199
+ remote_port: c.remotePort,
1200
+ protocol: c.protocol || "TCP",
1147
1201
  connection_type: "RESOURCE",
1148
1202
  connection: {
1149
- resource_data: u.resource,
1203
+ resource_data: c.resource,
1150
1204
  connection_id: t,
1151
- plugin_id: n,
1152
- resource_id: u.resourceId,
1153
- resource_key: u.resourceKey
1205
+ plugin_id: r,
1206
+ resource_id: c.resourceId,
1207
+ resource_key: c.resourceKey
1154
1208
  },
1155
- labels: u.labels ?? {},
1156
- params: u.parameters ?? {}
1157
- }), h = await _r(n, t, y);
1158
- return u.openInBrowser && _t(`http://localhost:${h.local_port}`), h;
1209
+ labels: c.labels ?? {},
1210
+ params: c.parameters ?? {}
1211
+ }), f = await mn(r, t, g);
1212
+ return c.openInBrowser && yt(`http://localhost:${f.local_port}`), f;
1159
1213
  },
1160
- onError: I(i, "Failed to start port forwarding session"),
1214
+ onError: I(o, "Failed to start port forwarding session"),
1161
1215
  onSuccess: async () => {
1162
1216
  await Promise.all([
1163
- o.invalidateQueries({ queryKey: s }),
1164
- o.invalidateQueries({ queryKey: [...J] })
1217
+ i.invalidateQueries({ queryKey: s }),
1218
+ i.invalidateQueries({ queryKey: [...X] })
1165
1219
  ]);
1166
1220
  }
1167
1221
  }), l = v({
1168
- mutationFn: async ({ opts: u }) => ft(u.sessionID),
1169
- onError: I(i, "Failed to close port forwarding session"),
1222
+ mutationFn: async ({ opts: c }) => ct(c.sessionID),
1223
+ onError: I(o, "Failed to close port forwarding session"),
1170
1224
  onSuccess: async () => {
1171
1225
  await Promise.all([
1172
- o.invalidateQueries({ queryKey: s }),
1173
- o.invalidateQueries({ queryKey: [...J] })
1226
+ i.invalidateQueries({ queryKey: s }),
1227
+ i.invalidateQueries({ queryKey: [...X] })
1174
1228
  ]);
1175
1229
  }
1176
1230
  });
1177
1231
  return {
1178
1232
  sessions: a,
1179
- forward: c.mutateAsync,
1233
+ forward: u.mutateAsync,
1180
1234
  close: l.mutateAsync
1181
1235
  };
1182
1236
  }
1183
- const Us = () => {
1184
- const e = _.useContext(qr);
1237
+ const Gs = () => {
1238
+ const e = S.useContext(Un);
1185
1239
  if (!e) throw new Error("useConfirmationModal must be used within a ConfirmationModalProvider");
1186
1240
  return e;
1187
1241
  }, Ks = ({
1188
1242
  pluginID: e,
1189
1243
  connectionID: t,
1190
- resourceKey: r,
1191
- resourceID: n,
1192
- namespace: s = "",
1193
- getParams: i = {},
1194
- updateParams: o = {},
1195
- deleteParams: a = {}
1244
+ resourceKey: n,
1245
+ resourceID: r,
1246
+ namespace: s = ""
1196
1247
  }) => {
1197
- const c = P(e), l = G(), { showSnackbar: u } = $(), y = ["RESOURCE", c, t, r, n, s], { mutateAsync: h } = v({
1198
- mutationFn: async (p) => pt(c, t, r, T.UpdateInput.createFrom({
1199
- params: { ...o, ...p.params },
1200
- input: { ...o, ...p.input },
1201
- id: n,
1248
+ const o = D(e), i = G(), { showSnackbar: a } = L(), u = ["RESOURCE", o, t, n, r, s], { mutateAsync: l } = v({
1249
+ mutationFn: async (f) => ut(o, t, n, A.UpdateInput.createFrom({
1250
+ input: f.input,
1251
+ id: r,
1202
1252
  namespace: s
1203
1253
  })),
1204
1254
  onSuccess: async () => {
1205
- u(`Resource ${n} updated`, "success"), await l.invalidateQueries({ queryKey: y });
1255
+ a(`Resource ${r} updated`, "success"), await i.invalidateQueries({ queryKey: u });
1206
1256
  },
1207
- onError: I(u, `Failed to update resource ${n}`)
1208
- }), { mutateAsync: f } = v({
1209
- mutationFn: async (p) => yt(c, t, r, T.DeleteInput.createFrom({
1210
- params: { ...a, ...p.params },
1211
- input: { ...a, ...p.input },
1212
- id: n,
1213
- ...p,
1214
- namespace: s
1257
+ onError: I(a, `Failed to update resource ${r}`)
1258
+ }), { mutateAsync: c } = v({
1259
+ mutationFn: async (f = {}) => lt(o, t, n, A.DeleteInput.createFrom({
1260
+ id: r,
1261
+ namespace: s,
1262
+ gracePeriodSeconds: f.gracePeriodSeconds
1215
1263
  })),
1216
1264
  onSuccess: async () => {
1217
- u(`Resource ${n} deleted`, "success"), await l.invalidateQueries({ queryKey: y });
1265
+ a(`Resource ${r} deleted`, "success"), await i.invalidateQueries({ queryKey: u });
1218
1266
  },
1219
- onError: I(u, `Failed to delete resource ${n}`)
1267
+ onError: I(a, `Failed to delete resource ${r}`)
1220
1268
  });
1221
1269
  return {
1222
1270
  /**
1223
1271
  * Fetch result for the resource. The client will automatically cache the result, and update the cache
1224
1272
  * when the resource is updated or deleted via the returned update and remove mutation functions.
1225
1273
  */
1226
- resource: D({
1227
- queryKey: y,
1228
- queryFn: async () => wr(c, t, r, T.GetInput.createFrom({
1229
- params: i,
1230
- id: n,
1274
+ resource: P({
1275
+ queryKey: u,
1276
+ queryFn: async () => _n(o, t, n, A.GetInput.createFrom({
1277
+ id: r,
1231
1278
  namespace: s
1232
1279
  })),
1233
1280
  retry: !1
@@ -1238,89 +1285,82 @@ const Us = () => {
1238
1285
  *
1239
1286
  * @params opts Optional parameters to pass to the resource update
1240
1287
  */
1241
- update: h,
1288
+ update: l,
1242
1289
  /**
1243
1290
  * Delete an existing resource. A set of optional parameters can be passed to customize the delete behavior,
1244
1291
  * which if specified, will add additional default behavior set via the hook options.
1245
1292
  *
1246
1293
  * @params {object} opts Optional parameters to pass to the resource delete
1247
1294
  */
1248
- remove: f
1295
+ remove: c
1249
1296
  };
1250
- }, Qs = (e) => {
1297
+ }, zs = (e) => {
1251
1298
  const t = ["component", e.plugin, e.resource, e.area];
1252
1299
  return {
1253
1300
  /**
1254
1301
  * Fetch result for the resource. The client will automatically cache the result, and update the cache
1255
1302
  * when the resource is updated or deleted via the returned update and remove mutation functions.
1256
1303
  */
1257
- component: D({
1304
+ component: P({
1258
1305
  queryKey: t,
1259
- queryFn: async () => Sr(e)
1306
+ queryFn: async () => En(e)
1260
1307
  })
1261
1308
  };
1262
- }, js = ({ pluginID: e, connectionID: t }) => {
1263
- const r = P(e);
1309
+ }, Qs = ({ pluginID: e, connectionID: t }) => {
1310
+ const n = D(e);
1264
1311
  return {
1265
1312
  /**
1266
1313
  * The current settings from the provider.
1267
1314
  */
1268
- groups: D({
1269
- queryKey: [r, "resource_groups", "list"],
1270
- queryFn: async () => Cr(r, t),
1315
+ groups: P({
1316
+ queryKey: [n, "resource_groups", "list"],
1317
+ queryFn: async () => Sn(n, t),
1271
1318
  retry: !1
1272
1319
  })
1273
1320
  };
1274
- }, zs = ({
1321
+ }, Ws = ({
1275
1322
  pluginID: e,
1276
1323
  connectionID: t,
1277
- searches: r
1324
+ searches: n
1278
1325
  }) => {
1279
- const n = P(e), s = (o) => [n, t, o.key, o.namespaces, "list"];
1280
- return Nr({
1281
- queries: r.map((o) => ({
1282
- queryKey: s(o),
1283
- queryFn: async () => ht(n, t, o.key, T.ListInput.createFrom({
1284
- params: {},
1285
- order: {
1286
- by: "name",
1287
- direction: !0
1288
- },
1289
- pagination: {
1290
- page: 1,
1291
- pageSize: 200
1292
- },
1293
- namespaces: o.namespaces
1294
- })).then((a) => (console.log(a.result), a.result && o.postFilter ? Object.values(a.result).filter(o.postFilter) : Object.values(a.result || {}))),
1326
+ const r = D(e), s = (i) => [r, t, i.key, i.namespaces, "list"];
1327
+ return An({
1328
+ queries: n.map((i) => ({
1329
+ queryKey: s(i),
1330
+ queryFn: async () => dt(r, t, i.key, A.ListInput.createFrom({
1331
+ order: [{ field: "name", descending: !1 }],
1332
+ pagination: { page: 1, pageSize: 200 },
1333
+ namespaces: i.namespaces
1334
+ })).then((a) => (console.log(a.result), a.result && i.postFilter ? Object.values(a.result).filter(i.postFilter) : Object.values(a.result || {}))),
1295
1335
  retry: !1
1296
1336
  }))
1297
1337
  });
1298
- }, Ws = ({ pluginID: e, resourceKey: t }) => {
1299
- const r = P(e);
1338
+ }, Bs = ({ pluginID: e, resourceKey: t }) => {
1339
+ const n = D(e);
1300
1340
  return {
1301
1341
  /**
1302
1342
  * The current settings from the provider.
1303
1343
  */
1304
- resourceType: D({
1305
- queryKey: [r, "resources", t],
1306
- queryFn: async () => Er(r, t),
1344
+ resourceType: P({
1345
+ queryKey: [n, "resources", t],
1346
+ queryFn: async () => wn(n, t),
1307
1347
  retry: !1
1308
1348
  })
1309
1349
  };
1310
1350
  }, Hs = ({ pluginID: e, connectionID: t }) => {
1311
- const r = P(e);
1351
+ const n = D(e);
1312
1352
  return {
1313
1353
  /**
1314
1354
  * The current settings from the provider.
1315
1355
  */
1316
- types: D({
1317
- queryKey: [r, "resources", "list"],
1318
- queryFn: async () => br(r, t),
1356
+ types: P({
1357
+ queryKey: [n, "resources", "list"],
1358
+ queryFn: async () => Cn(n, t),
1319
1359
  retry: !1
1320
1360
  })
1321
1361
  };
1322
1362
  };
1323
- var Tt = Symbol.for("immer-nothing"), tt = Symbol.for("immer-draftable"), N = Symbol.for("immer-state"), Xr = process.env.NODE_ENV !== "production" ? [
1363
+ var Rt = Symbol.for("immer-nothing"), Ve = Symbol.for("immer-draftable"), T = Symbol.for("immer-state"), Vn = process.env.NODE_ENV !== "production" ? [
1324
1364
  // All error codes, starting by 0:
1325
1365
  function(e) {
1326
1366
  return `The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`;
@@ -1353,109 +1393,109 @@ var Tt = Symbol.for("immer-nothing"), tt = Symbol.for("immer-draftable"), N = Sy
1353
1393
  ] : [];
1354
1394
  function O(e, ...t) {
1355
1395
  if (process.env.NODE_ENV !== "production") {
1356
- const r = Xr[e], n = typeof r == "function" ? r.apply(null, t) : r;
1357
- throw new Error(`[Immer] ${n}`);
1396
+ const n = Vn[e], r = typeof n == "function" ? n.apply(null, t) : n;
1397
+ throw new Error(`[Immer] ${r}`);
1358
1398
  }
1359
1399
  throw new Error(
1360
1400
  `[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`
1361
1401
  );
1362
1402
  }
1363
- var Z = Object.getPrototypeOf;
1364
- function ee(e) {
1365
- return !!e && !!e[N];
1403
+ var ee = Object.getPrototypeOf;
1404
+ function te(e) {
1405
+ return !!e && !!e[T];
1366
1406
  }
1367
- function j(e) {
1407
+ function B(e) {
1368
1408
  var t;
1369
- return e ? Nt(e) || Array.isArray(e) || !!e[tt] || !!((t = e.constructor) != null && t[tt]) || _e(e) || we(e) : !1;
1409
+ return e ? It(e) || Array.isArray(e) || !!e[Ve] || !!((t = e.constructor) != null && t[Ve]) || me(e) || _e(e) : !1;
1370
1410
  }
1371
- var Zr = Object.prototype.constructor.toString();
1372
- function Nt(e) {
1411
+ var Xn = Object.prototype.constructor.toString();
1412
+ function It(e) {
1373
1413
  if (!e || typeof e != "object")
1374
1414
  return !1;
1375
- const t = Z(e);
1415
+ const t = ee(e);
1376
1416
  if (t === null)
1377
1417
  return !0;
1378
- const r = Object.hasOwnProperty.call(t, "constructor") && t.constructor;
1379
- return r === Object ? !0 : typeof r == "function" && Function.toString.call(r) === Zr;
1418
+ const n = Object.hasOwnProperty.call(t, "constructor") && t.constructor;
1419
+ return n === Object ? !0 : typeof n == "function" && Function.toString.call(n) === Xn;
1380
1420
  }
1381
- function pe(e, t) {
1382
- ge(e) === 0 ? Reflect.ownKeys(e).forEach((r) => {
1383
- t(r, e[r], e);
1384
- }) : e.forEach((r, n) => t(n, r, e));
1421
+ function fe(e, t) {
1422
+ ge(e) === 0 ? Reflect.ownKeys(e).forEach((n) => {
1423
+ t(n, e[n], e);
1424
+ }) : e.forEach((n, r) => t(r, n, e));
1385
1425
  }
1386
1426
  function ge(e) {
1387
- const t = e[N];
1388
- return t ? t.type_ : Array.isArray(e) ? 1 : _e(e) ? 2 : we(e) ? 3 : 0;
1427
+ const t = e[T];
1428
+ return t ? t.type_ : Array.isArray(e) ? 1 : me(e) ? 2 : _e(e) ? 3 : 0;
1389
1429
  }
1390
- function Ae(e, t) {
1430
+ function xe(e, t) {
1391
1431
  return ge(e) === 2 ? e.has(t) : Object.prototype.hasOwnProperty.call(e, t);
1392
1432
  }
1393
- function Rt(e, t, r) {
1394
- const n = ge(e);
1395
- n === 2 ? e.set(t, r) : n === 3 ? e.add(r) : e[t] = r;
1433
+ function Ft(e, t, n) {
1434
+ const r = ge(e);
1435
+ r === 2 ? e.set(t, n) : r === 3 ? e.add(n) : e[t] = n;
1396
1436
  }
1397
- function en(e, t) {
1437
+ function Zn(e, t) {
1398
1438
  return e === t ? e !== 0 || 1 / e === 1 / t : e !== e && t !== t;
1399
1439
  }
1400
- function _e(e) {
1440
+ function me(e) {
1401
1441
  return e instanceof Map;
1402
1442
  }
1403
- function we(e) {
1443
+ function _e(e) {
1404
1444
  return e instanceof Set;
1405
1445
  }
1406
- function K(e) {
1446
+ function W(e) {
1407
1447
  return e.copy_ || e.base_;
1408
1448
  }
1409
- function Te(e, t) {
1410
- if (_e(e))
1449
+ function Ae(e, t) {
1450
+ if (me(e))
1411
1451
  return new Map(e);
1412
- if (we(e))
1452
+ if (_e(e))
1413
1453
  return new Set(e);
1414
1454
  if (Array.isArray(e))
1415
1455
  return Array.prototype.slice.call(e);
1416
- const r = Nt(e);
1417
- if (t === !0 || t === "class_only" && !r) {
1418
- const n = Object.getOwnPropertyDescriptors(e);
1419
- delete n[N];
1420
- let s = Reflect.ownKeys(n);
1421
- for (let i = 0; i < s.length; i++) {
1422
- const o = s[i], a = n[o];
1423
- a.writable === !1 && (a.writable = !0, a.configurable = !0), (a.get || a.set) && (n[o] = {
1456
+ const n = It(e);
1457
+ if (t === !0 || t === "class_only" && !n) {
1458
+ const r = Object.getOwnPropertyDescriptors(e);
1459
+ delete r[T];
1460
+ let s = Reflect.ownKeys(r);
1461
+ for (let o = 0; o < s.length; o++) {
1462
+ const i = s[o], a = r[i];
1463
+ a.writable === !1 && (a.writable = !0, a.configurable = !0), (a.get || a.set) && (r[i] = {
1424
1464
  configurable: !0,
1425
1465
  writable: !0,
1426
1466
  // could live with !!desc.set as well here...
1427
1467
  enumerable: a.enumerable,
1428
- value: e[o]
1468
+ value: e[i]
1429
1469
  });
1430
1470
  }
1431
- return Object.create(Z(e), n);
1471
+ return Object.create(ee(e), r);
1432
1472
  } else {
1433
- const n = Z(e);
1434
- if (n !== null && r)
1473
+ const r = ee(e);
1474
+ if (r !== null && n)
1435
1475
  return { ...e };
1436
- const s = Object.create(n);
1476
+ const s = Object.create(r);
1437
1477
  return Object.assign(s, e);
1438
1478
  }
1439
1479
  }
1440
- function Ge(e, t = !1) {
1441
- return Se(e) || ee(e) || !j(e) || (ge(e) > 1 && (e.set = e.add = e.clear = e.delete = tn), Object.freeze(e), t && Object.entries(e).forEach(([r, n]) => Ge(n, !0))), e;
1480
+ function qe(e, t = !1) {
1481
+ return Ee(e) || te(e) || !B(e) || (ge(e) > 1 && (e.set = e.add = e.clear = e.delete = er), Object.freeze(e), t && Object.entries(e).forEach(([n, r]) => qe(r, !0))), e;
1442
1482
  }
1443
- function tn() {
1483
+ function er() {
1444
1484
  O(2);
1445
1485
  }
1446
- function Se(e) {
1486
+ function Ee(e) {
1447
1487
  return Object.isFrozen(e);
1448
1488
  }
1449
- var rn = {};
1450
- function z(e) {
1451
- const t = rn[e];
1489
+ var tr = {};
1490
+ function H(e) {
1491
+ const t = tr[e];
1452
1492
  return t || O(0, e), t;
1453
1493
  }
1454
- var ne;
1455
- function kt() {
1456
- return ne;
1494
+ var oe;
1495
+ function Ot() {
1496
+ return oe;
1457
1497
  }
1458
- function nn(e, t) {
1498
+ function nr(e, t) {
1459
1499
  return {
1460
1500
  drafts_: [],
1461
1501
  parent_: e,
@@ -1466,84 +1506,84 @@ function nn(e, t) {
1466
1506
  unfinalizedDrafts_: 0
1467
1507
  };
1468
1508
  }
1469
- function rt(e, t) {
1470
- t && (z("Patches"), e.patches_ = [], e.inversePatches_ = [], e.patchListener_ = t);
1509
+ function Xe(e, t) {
1510
+ t && (H("Patches"), e.patches_ = [], e.inversePatches_ = [], e.patchListener_ = t);
1471
1511
  }
1472
- function Ne(e) {
1473
- Re(e), e.drafts_.forEach(sn), e.drafts_ = null;
1512
+ function Te(e) {
1513
+ Ne(e), e.drafts_.forEach(rr), e.drafts_ = null;
1474
1514
  }
1475
- function Re(e) {
1476
- e === ne && (ne = e.parent_);
1515
+ function Ne(e) {
1516
+ e === oe && (oe = e.parent_);
1477
1517
  }
1478
- function nt(e) {
1479
- return ne = nn(ne, e);
1518
+ function Ze(e) {
1519
+ return oe = nr(oe, e);
1480
1520
  }
1481
- function sn(e) {
1482
- const t = e[N];
1521
+ function rr(e) {
1522
+ const t = e[T];
1483
1523
  t.type_ === 0 || t.type_ === 1 ? t.revoke_() : t.revoked_ = !0;
1484
1524
  }
1485
- function st(e, t) {
1525
+ function et(e, t) {
1486
1526
  t.unfinalizedDrafts_ = t.drafts_.length;
1487
- const r = t.drafts_[0];
1488
- return e !== void 0 && e !== r ? (r[N].modified_ && (Ne(t), O(4)), j(e) && (e = ye(t, e), t.parent_ || he(t, e)), t.patches_ && z("Patches").generateReplacementPatches_(
1489
- r[N].base_,
1527
+ const n = t.drafts_[0];
1528
+ return e !== void 0 && e !== n ? (n[T].modified_ && (Te(t), O(4)), B(e) && (e = pe(t, e), t.parent_ || ye(t, e)), t.patches_ && H("Patches").generateReplacementPatches_(
1529
+ n[T].base_,
1490
1530
  e,
1491
1531
  t.patches_,
1492
1532
  t.inversePatches_
1493
- )) : e = ye(t, r, []), Ne(t), t.patches_ && t.patchListener_(t.patches_, t.inversePatches_), e !== Tt ? e : void 0;
1533
+ )) : e = pe(t, n, []), Te(t), t.patches_ && t.patchListener_(t.patches_, t.inversePatches_), e !== Rt ? e : void 0;
1494
1534
  }
1495
- function ye(e, t, r) {
1496
- if (Se(t))
1535
+ function pe(e, t, n) {
1536
+ if (Ee(t))
1497
1537
  return t;
1498
- const n = t[N];
1499
- if (!n)
1500
- return pe(
1538
+ const r = t[T];
1539
+ if (!r)
1540
+ return fe(
1501
1541
  t,
1502
- (s, i) => ot(e, n, t, s, i, r)
1542
+ (s, o) => tt(e, r, t, s, o, n)
1503
1543
  ), t;
1504
- if (n.scope_ !== e)
1544
+ if (r.scope_ !== e)
1505
1545
  return t;
1506
- if (!n.modified_)
1507
- return he(e, n.base_, !0), n.base_;
1508
- if (!n.finalized_) {
1509
- n.finalized_ = !0, n.scope_.unfinalizedDrafts_--;
1510
- const s = n.copy_;
1511
- let i = s, o = !1;
1512
- n.type_ === 3 && (i = new Set(s), s.clear(), o = !0), pe(
1513
- i,
1514
- (a, c) => ot(e, n, s, a, c, r, o)
1515
- ), he(e, s, !1), r && e.patches_ && z("Patches").generatePatches_(
1516
- n,
1546
+ if (!r.modified_)
1547
+ return ye(e, r.base_, !0), r.base_;
1548
+ if (!r.finalized_) {
1549
+ r.finalized_ = !0, r.scope_.unfinalizedDrafts_--;
1550
+ const s = r.copy_;
1551
+ let o = s, i = !1;
1552
+ r.type_ === 3 && (o = new Set(s), s.clear(), i = !0), fe(
1553
+ o,
1554
+ (a, u) => tt(e, r, s, a, u, n, i)
1555
+ ), ye(e, s, !1), n && e.patches_ && H("Patches").generatePatches_(
1517
1556
  r,
1557
+ n,
1518
1558
  e.patches_,
1519
1559
  e.inversePatches_
1520
1560
  );
1521
1561
  }
1522
- return n.copy_;
1562
+ return r.copy_;
1523
1563
  }
1524
- function ot(e, t, r, n, s, i, o) {
1525
- if (process.env.NODE_ENV !== "production" && s === r && O(5), ee(s)) {
1526
- const a = i && t && t.type_ !== 3 && // Set objects are atomic since they have no keys.
1527
- !Ae(t.assigned_, n) ? i.concat(n) : void 0, c = ye(e, s, a);
1528
- if (Rt(r, n, c), ee(c))
1564
+ function tt(e, t, n, r, s, o, i) {
1565
+ if (process.env.NODE_ENV !== "production" && s === n && O(5), te(s)) {
1566
+ const a = o && t && t.type_ !== 3 && // Set objects are atomic since they have no keys.
1567
+ !xe(t.assigned_, r) ? o.concat(r) : void 0, u = pe(e, s, a);
1568
+ if (Ft(n, r, u), te(u))
1529
1569
  e.canAutoFreeze_ = !1;
1530
1570
  else
1531
1571
  return;
1532
- } else o && r.add(s);
1533
- if (j(s) && !Se(s)) {
1572
+ } else i && n.add(s);
1573
+ if (B(s) && !Ee(s)) {
1534
1574
  if (!e.immer_.autoFreeze_ && e.unfinalizedDrafts_ < 1)
1535
1575
  return;
1536
- ye(e, s), (!t || !t.scope_.parent_) && typeof n != "symbol" && Object.prototype.propertyIsEnumerable.call(r, n) && he(e, s);
1576
+ pe(e, s), (!t || !t.scope_.parent_) && typeof r != "symbol" && Object.prototype.propertyIsEnumerable.call(n, r) && ye(e, s);
1537
1577
  }
1538
1578
  }
1539
- function he(e, t, r = !1) {
1540
- !e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ && Ge(t, r);
1579
+ function ye(e, t, n = !1) {
1580
+ !e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ && qe(t, n);
1541
1581
  }
1542
- function on(e, t) {
1543
- const r = Array.isArray(e), n = {
1544
- type_: r ? 1 : 0,
1582
+ function sr(e, t) {
1583
+ const n = Array.isArray(e), r = {
1584
+ type_: n ? 1 : 0,
1545
1585
  // Track which produce call this is associated with.
1546
- scope_: t ? t.scope_ : kt(),
1586
+ scope_: t ? t.scope_ : Ot(),
1547
1587
  // True for both shallow and deep changes.
1548
1588
  modified_: !1,
1549
1589
  // Used during finalization.
@@ -1563,160 +1603,160 @@ function on(e, t) {
1563
1603
  revoke_: null,
1564
1604
  isManual_: !1
1565
1605
  };
1566
- let s = n, i = Ue;
1567
- r && (s = [n], i = se);
1568
- const { revoke: o, proxy: a } = Proxy.revocable(s, i);
1569
- return n.draft_ = a, n.revoke_ = o, a;
1606
+ let s = r, o = je;
1607
+ n && (s = [r], o = ie);
1608
+ const { revoke: i, proxy: a } = Proxy.revocable(s, o);
1609
+ return r.draft_ = a, r.revoke_ = i, a;
1570
1610
  }
1571
- var Ue = {
1611
+ var je = {
1572
1612
  get(e, t) {
1573
- if (t === N)
1613
+ if (t === T)
1574
1614
  return e;
1575
- const r = K(e);
1576
- if (!Ae(r, t))
1577
- return an(e, r, t);
1578
- const n = r[t];
1579
- return e.finalized_ || !j(n) ? n : n === Pe(e.base_, t) ? (De(e), e.copy_[t] = Me(n, e)) : n;
1615
+ const n = W(e);
1616
+ if (!xe(n, t))
1617
+ return or(e, n, t);
1618
+ const r = n[t];
1619
+ return e.finalized_ || !B(r) ? r : r === De(e.base_, t) ? (Pe(e), e.copy_[t] = Me(r, e)) : r;
1580
1620
  },
1581
1621
  has(e, t) {
1582
- return t in K(e);
1622
+ return t in W(e);
1583
1623
  },
1584
1624
  ownKeys(e) {
1585
- return Reflect.ownKeys(K(e));
1625
+ return Reflect.ownKeys(W(e));
1586
1626
  },
1587
- set(e, t, r) {
1588
- const n = Mt(K(e), t);
1589
- if (n != null && n.set)
1590
- return n.set.call(e.draft_, r), !0;
1627
+ set(e, t, n) {
1628
+ const r = xt(W(e), t);
1629
+ if (r != null && r.set)
1630
+ return r.set.call(e.draft_, n), !0;
1591
1631
  if (!e.modified_) {
1592
- const s = Pe(K(e), t), i = s == null ? void 0 : s[N];
1593
- if (i && i.base_ === r)
1594
- return e.copy_[t] = r, e.assigned_[t] = !1, !0;
1595
- if (en(r, s) && (r !== void 0 || Ae(e.base_, t)))
1632
+ const s = De(W(e), t), o = s == null ? void 0 : s[T];
1633
+ if (o && o.base_ === n)
1634
+ return e.copy_[t] = n, e.assigned_[t] = !1, !0;
1635
+ if (Zn(n, s) && (n !== void 0 || xe(e.base_, t)))
1596
1636
  return !0;
1597
- De(e), ke(e);
1637
+ Pe(e), ke(e);
1598
1638
  }
1599
- return e.copy_[t] === r && // special case: handle new props with value 'undefined'
1600
- (r !== void 0 || t in e.copy_) || // special case: NaN
1601
- Number.isNaN(r) && Number.isNaN(e.copy_[t]) || (e.copy_[t] = r, e.assigned_[t] = !0), !0;
1639
+ return e.copy_[t] === n && // special case: handle new props with value 'undefined'
1640
+ (n !== void 0 || t in e.copy_) || // special case: NaN
1641
+ Number.isNaN(n) && Number.isNaN(e.copy_[t]) || (e.copy_[t] = n, e.assigned_[t] = !0), !0;
1602
1642
  },
1603
1643
  deleteProperty(e, t) {
1604
- return Pe(e.base_, t) !== void 0 || t in e.base_ ? (e.assigned_[t] = !1, De(e), ke(e)) : delete e.assigned_[t], e.copy_ && delete e.copy_[t], !0;
1644
+ return De(e.base_, t) !== void 0 || t in e.base_ ? (e.assigned_[t] = !1, Pe(e), ke(e)) : delete e.assigned_[t], e.copy_ && delete e.copy_[t], !0;
1605
1645
  },
1606
1646
  // Note: We never coerce `desc.value` into an Immer draft, because we can't make
1607
1647
  // the same guarantee in ES5 mode.
1608
1648
  getOwnPropertyDescriptor(e, t) {
1609
- const r = K(e), n = Reflect.getOwnPropertyDescriptor(r, t);
1610
- return n && {
1649
+ const n = W(e), r = Reflect.getOwnPropertyDescriptor(n, t);
1650
+ return r && {
1611
1651
  writable: !0,
1612
1652
  configurable: e.type_ !== 1 || t !== "length",
1613
- enumerable: n.enumerable,
1614
- value: r[t]
1653
+ enumerable: r.enumerable,
1654
+ value: n[t]
1615
1655
  };
1616
1656
  },
1617
1657
  defineProperty() {
1618
1658
  O(11);
1619
1659
  },
1620
1660
  getPrototypeOf(e) {
1621
- return Z(e.base_);
1661
+ return ee(e.base_);
1622
1662
  },
1623
1663
  setPrototypeOf() {
1624
1664
  O(12);
1625
1665
  }
1626
- }, se = {};
1627
- pe(Ue, (e, t) => {
1628
- se[e] = function() {
1666
+ }, ie = {};
1667
+ fe(je, (e, t) => {
1668
+ ie[e] = function() {
1629
1669
  return arguments[0] = arguments[0][0], t.apply(this, arguments);
1630
1670
  };
1631
1671
  });
1632
- se.deleteProperty = function(e, t) {
1633
- return process.env.NODE_ENV !== "production" && isNaN(parseInt(t)) && O(13), se.set.call(this, e, t, void 0);
1672
+ ie.deleteProperty = function(e, t) {
1673
+ return process.env.NODE_ENV !== "production" && isNaN(parseInt(t)) && O(13), ie.set.call(this, e, t, void 0);
1634
1674
  };
1635
- se.set = function(e, t, r) {
1636
- return process.env.NODE_ENV !== "production" && t !== "length" && isNaN(parseInt(t)) && O(14), Ue.set.call(this, e[0], t, r, e[0]);
1675
+ ie.set = function(e, t, n) {
1676
+ return process.env.NODE_ENV !== "production" && t !== "length" && isNaN(parseInt(t)) && O(14), je.set.call(this, e[0], t, n, e[0]);
1637
1677
  };
1638
- function Pe(e, t) {
1639
- const r = e[N];
1640
- return (r ? K(r) : e)[t];
1678
+ function De(e, t) {
1679
+ const n = e[T];
1680
+ return (n ? W(n) : e)[t];
1641
1681
  }
1642
- function an(e, t, r) {
1682
+ function or(e, t, n) {
1643
1683
  var s;
1644
- const n = Mt(t, r);
1645
- return n ? "value" in n ? n.value : (
1684
+ const r = xt(t, n);
1685
+ return r ? "value" in r ? r.value : (
1646
1686
  // This is a very special case, if the prop is a getter defined by the
1647
1687
  // prototype, we should invoke it with the draft as context!
1648
- (s = n.get) == null ? void 0 : s.call(e.draft_)
1688
+ (s = r.get) == null ? void 0 : s.call(e.draft_)
1649
1689
  ) : void 0;
1650
1690
  }
1651
- function Mt(e, t) {
1691
+ function xt(e, t) {
1652
1692
  if (!(t in e))
1653
1693
  return;
1654
- let r = Z(e);
1655
- for (; r; ) {
1656
- const n = Object.getOwnPropertyDescriptor(r, t);
1657
- if (n)
1658
- return n;
1659
- r = Z(r);
1694
+ let n = ee(e);
1695
+ for (; n; ) {
1696
+ const r = Object.getOwnPropertyDescriptor(n, t);
1697
+ if (r)
1698
+ return r;
1699
+ n = ee(n);
1660
1700
  }
1661
1701
  }
1662
1702
  function ke(e) {
1663
1703
  e.modified_ || (e.modified_ = !0, e.parent_ && ke(e.parent_));
1664
1704
  }
1665
- function De(e) {
1666
- e.copy_ || (e.copy_ = Te(
1705
+ function Pe(e) {
1706
+ e.copy_ || (e.copy_ = Ae(
1667
1707
  e.base_,
1668
1708
  e.scope_.immer_.useStrictShallowCopy_
1669
1709
  ));
1670
1710
  }
1671
- var cn = class {
1711
+ var ir = class {
1672
1712
  constructor(e) {
1673
- this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.produce = (t, r, n) => {
1674
- if (typeof t == "function" && typeof r != "function") {
1675
- const i = r;
1676
- r = t;
1677
- const o = this;
1678
- return function(c = i, ...l) {
1679
- return o.produce(c, (u) => r.call(this, u, ...l));
1713
+ this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.produce = (t, n, r) => {
1714
+ if (typeof t == "function" && typeof n != "function") {
1715
+ const o = n;
1716
+ n = t;
1717
+ const i = this;
1718
+ return function(u = o, ...l) {
1719
+ return i.produce(u, (c) => n.call(this, c, ...l));
1680
1720
  };
1681
1721
  }
1682
- typeof r != "function" && O(6), n !== void 0 && typeof n != "function" && O(7);
1722
+ typeof n != "function" && O(6), r !== void 0 && typeof r != "function" && O(7);
1683
1723
  let s;
1684
- if (j(t)) {
1685
- const i = nt(this), o = Me(t, void 0);
1724
+ if (B(t)) {
1725
+ const o = Ze(this), i = Me(t, void 0);
1686
1726
  let a = !0;
1687
1727
  try {
1688
- s = r(o), a = !1;
1728
+ s = n(i), a = !1;
1689
1729
  } finally {
1690
- a ? Ne(i) : Re(i);
1730
+ a ? Te(o) : Ne(o);
1691
1731
  }
1692
- return rt(i, n), st(s, i);
1732
+ return Xe(o, r), et(s, o);
1693
1733
  } else if (!t || typeof t != "object") {
1694
- if (s = r(t), s === void 0 && (s = t), s === Tt && (s = void 0), this.autoFreeze_ && Ge(s, !0), n) {
1695
- const i = [], o = [];
1696
- z("Patches").generateReplacementPatches_(t, s, i, o), n(i, o);
1734
+ if (s = n(t), s === void 0 && (s = t), s === Rt && (s = void 0), this.autoFreeze_ && qe(s, !0), r) {
1735
+ const o = [], i = [];
1736
+ H("Patches").generateReplacementPatches_(t, s, o, i), r(o, i);
1697
1737
  }
1698
1738
  return s;
1699
1739
  } else
1700
1740
  O(1, t);
1701
- }, this.produceWithPatches = (t, r) => {
1741
+ }, this.produceWithPatches = (t, n) => {
1702
1742
  if (typeof t == "function")
1703
- return (o, ...a) => this.produceWithPatches(o, (c) => t(c, ...a));
1704
- let n, s;
1705
- return [this.produce(t, r, (o, a) => {
1706
- n = o, s = a;
1707
- }), n, s];
1743
+ return (i, ...a) => this.produceWithPatches(i, (u) => t(u, ...a));
1744
+ let r, s;
1745
+ return [this.produce(t, n, (i, a) => {
1746
+ r = i, s = a;
1747
+ }), r, s];
1708
1748
  }, typeof (e == null ? void 0 : e.autoFreeze) == "boolean" && this.setAutoFreeze(e.autoFreeze), typeof (e == null ? void 0 : e.useStrictShallowCopy) == "boolean" && this.setUseStrictShallowCopy(e.useStrictShallowCopy);
1709
1749
  }
1710
1750
  createDraft(e) {
1711
- j(e) || O(8), ee(e) && (e = un(e));
1712
- const t = nt(this), r = Me(e, void 0);
1713
- return r[N].isManual_ = !0, Re(t), r;
1751
+ B(e) || O(8), te(e) && (e = ar(e));
1752
+ const t = Ze(this), n = Me(e, void 0);
1753
+ return n[T].isManual_ = !0, Ne(t), n;
1714
1754
  }
1715
1755
  finishDraft(e, t) {
1716
- const r = e && e[N];
1717
- (!r || !r.isManual_) && O(9);
1718
- const { scope_: n } = r;
1719
- return rt(n, t), st(void 0, n);
1756
+ const n = e && e[T];
1757
+ (!n || !n.isManual_) && O(9);
1758
+ const { scope_: r } = n;
1759
+ return Xe(r, t), et(void 0, r);
1720
1760
  }
1721
1761
  /**
1722
1762
  * Pass true to automatically freeze all copies created by Immer.
@@ -1735,62 +1775,62 @@ var cn = class {
1735
1775
  this.useStrictShallowCopy_ = e;
1736
1776
  }
1737
1777
  applyPatches(e, t) {
1738
- let r;
1739
- for (r = t.length - 1; r >= 0; r--) {
1740
- const s = t[r];
1778
+ let n;
1779
+ for (n = t.length - 1; n >= 0; n--) {
1780
+ const s = t[n];
1741
1781
  if (s.path.length === 0 && s.op === "replace") {
1742
1782
  e = s.value;
1743
1783
  break;
1744
1784
  }
1745
1785
  }
1746
- r > -1 && (t = t.slice(r + 1));
1747
- const n = z("Patches").applyPatches_;
1748
- return ee(e) ? n(e, t) : this.produce(
1786
+ n > -1 && (t = t.slice(n + 1));
1787
+ const r = H("Patches").applyPatches_;
1788
+ return te(e) ? r(e, t) : this.produce(
1749
1789
  e,
1750
- (s) => n(s, t)
1790
+ (s) => r(s, t)
1751
1791
  );
1752
1792
  }
1753
1793
  };
1754
1794
  function Me(e, t) {
1755
- const r = _e(e) ? z("MapSet").proxyMap_(e, t) : we(e) ? z("MapSet").proxySet_(e, t) : on(e, t);
1756
- return (t ? t.scope_ : kt()).drafts_.push(r), r;
1795
+ const n = me(e) ? H("MapSet").proxyMap_(e, t) : _e(e) ? H("MapSet").proxySet_(e, t) : sr(e, t);
1796
+ return (t ? t.scope_ : Ot()).drafts_.push(n), n;
1757
1797
  }
1758
- function un(e) {
1759
- return ee(e) || O(10, e), $t(e);
1798
+ function ar(e) {
1799
+ return te(e) || O(10, e), At(e);
1760
1800
  }
1761
- function $t(e) {
1762
- if (!j(e) || Se(e))
1801
+ function At(e) {
1802
+ if (!B(e) || Ee(e))
1763
1803
  return e;
1764
- const t = e[N];
1765
- let r;
1804
+ const t = e[T];
1805
+ let n;
1766
1806
  if (t) {
1767
1807
  if (!t.modified_)
1768
1808
  return t.base_;
1769
- t.finalized_ = !0, r = Te(e, t.scope_.immer_.useStrictShallowCopy_);
1809
+ t.finalized_ = !0, n = Ae(e, t.scope_.immer_.useStrictShallowCopy_);
1770
1810
  } else
1771
- r = Te(e, !0);
1772
- return pe(r, (n, s) => {
1773
- Rt(r, n, $t(s));
1774
- }), t && (t.finalized_ = !1), r;
1775
- }
1776
- var R = new cn(), le = R.produce;
1777
- R.produceWithPatches.bind(
1778
- R
1811
+ n = Ae(e, !0);
1812
+ return fe(n, (r, s) => {
1813
+ Ft(n, r, At(s));
1814
+ }), t && (t.finalized_ = !1), n;
1815
+ }
1816
+ var N = new ir(), Tt = N.produce;
1817
+ N.produceWithPatches.bind(
1818
+ N
1779
1819
  );
1780
- R.setAutoFreeze.bind(R);
1781
- R.setUseStrictShallowCopy.bind(R);
1782
- R.applyPatches.bind(R);
1783
- R.createDraft.bind(R);
1784
- R.finishDraft.bind(R);
1785
- var ue = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
1786
- function ln(e) {
1820
+ N.setAutoFreeze.bind(N);
1821
+ N.setUseStrictShallowCopy.bind(N);
1822
+ N.applyPatches.bind(N);
1823
+ N.createDraft.bind(N);
1824
+ N.finishDraft.bind(N);
1825
+ var le = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
1826
+ function cr(e) {
1787
1827
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
1788
1828
  }
1789
- var dn = "Expected a function", Lt = "__lodash_hash_undefined__", fn = "[object Function]", pn = "[object GeneratorFunction]", yn = "[object Symbol]", hn = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, mn = /^\w*$/, gn = /^\./, _n = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, wn = /[\\^$.*+?()[\]{}|]/g, Sn = /\\(\\)?/g, Cn = /^\[object .+?Constructor\]$/, En = typeof ue == "object" && ue && ue.Object === Object && ue, bn = typeof self == "object" && self && self.Object === Object && self, Ke = En || bn || Function("return this")();
1790
- function vn(e, t) {
1829
+ var ur = "Expected a function", Nt = "__lodash_hash_undefined__", lr = "[object Function]", dr = "[object GeneratorFunction]", fr = "[object Symbol]", pr = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, yr = /^\w*$/, hr = /^\./, gr = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, mr = /[\\^$.*+?()[\]{}|]/g, _r = /\\(\\)?/g, Er = /^\[object .+?Constructor\]$/, Sr = typeof le == "object" && le && le.Object === Object && le, wr = typeof self == "object" && self && self.Object === Object && self, Ge = Sr || wr || Function("return this")();
1830
+ function Cr(e, t) {
1791
1831
  return e == null ? void 0 : e[t];
1792
1832
  }
1793
- function Pn(e) {
1833
+ function br(e) {
1794
1834
  var t = !1;
1795
1835
  if (e != null && typeof e.toString != "function")
1796
1836
  try {
@@ -1799,177 +1839,177 @@ function Pn(e) {
1799
1839
  }
1800
1840
  return t;
1801
1841
  }
1802
- var Dn = Array.prototype, Fn = Function.prototype, qt = Object.prototype, Fe = Ke["__core-js_shared__"], it = function() {
1803
- var e = /[^.]+$/.exec(Fe && Fe.keys && Fe.keys.IE_PROTO || "");
1842
+ var vr = Array.prototype, Dr = Function.prototype, kt = Object.prototype, Re = Ge["__core-js_shared__"], nt = function() {
1843
+ var e = /[^.]+$/.exec(Re && Re.keys && Re.keys.IE_PROTO || "");
1804
1844
  return e ? "Symbol(src)_1." + e : "";
1805
- }(), Gt = Fn.toString, Qe = qt.hasOwnProperty, Ut = qt.toString, xn = RegExp(
1806
- "^" + Gt.call(Qe).replace(wn, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
1807
- ), at = Ke.Symbol, In = Dn.splice, On = Kt(Ke, "Map"), oe = Kt(Object, "create"), ct = at ? at.prototype : void 0, ut = ct ? ct.toString : void 0;
1808
- function W(e) {
1809
- var t = -1, r = e ? e.length : 0;
1810
- for (this.clear(); ++t < r; ) {
1811
- var n = e[t];
1812
- this.set(n[0], n[1]);
1845
+ }(), Mt = Dr.toString, Ke = kt.hasOwnProperty, Lt = kt.toString, Pr = RegExp(
1846
+ "^" + Mt.call(Ke).replace(mr, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
1847
+ ), rt = Ge.Symbol, Rr = vr.splice, Ir = $t(Ge, "Map"), ae = $t(Object, "create"), st = rt ? rt.prototype : void 0, ot = st ? st.toString : void 0;
1848
+ function Y(e) {
1849
+ var t = -1, n = e ? e.length : 0;
1850
+ for (this.clear(); ++t < n; ) {
1851
+ var r = e[t];
1852
+ this.set(r[0], r[1]);
1813
1853
  }
1814
1854
  }
1815
- function An() {
1816
- this.__data__ = oe ? oe(null) : {};
1855
+ function Fr() {
1856
+ this.__data__ = ae ? ae(null) : {};
1817
1857
  }
1818
- function Tn(e) {
1858
+ function Or(e) {
1819
1859
  return this.has(e) && delete this.__data__[e];
1820
1860
  }
1821
- function Nn(e) {
1861
+ function xr(e) {
1822
1862
  var t = this.__data__;
1823
- if (oe) {
1824
- var r = t[e];
1825
- return r === Lt ? void 0 : r;
1863
+ if (ae) {
1864
+ var n = t[e];
1865
+ return n === Nt ? void 0 : n;
1826
1866
  }
1827
- return Qe.call(t, e) ? t[e] : void 0;
1867
+ return Ke.call(t, e) ? t[e] : void 0;
1828
1868
  }
1829
- function Rn(e) {
1869
+ function Ar(e) {
1830
1870
  var t = this.__data__;
1831
- return oe ? t[e] !== void 0 : Qe.call(t, e);
1871
+ return ae ? t[e] !== void 0 : Ke.call(t, e);
1832
1872
  }
1833
- function kn(e, t) {
1834
- var r = this.__data__;
1835
- return r[e] = oe && t === void 0 ? Lt : t, this;
1873
+ function Tr(e, t) {
1874
+ var n = this.__data__;
1875
+ return n[e] = ae && t === void 0 ? Nt : t, this;
1836
1876
  }
1837
- W.prototype.clear = An;
1838
- W.prototype.delete = Tn;
1839
- W.prototype.get = Nn;
1840
- W.prototype.has = Rn;
1841
- W.prototype.set = kn;
1877
+ Y.prototype.clear = Fr;
1878
+ Y.prototype.delete = Or;
1879
+ Y.prototype.get = xr;
1880
+ Y.prototype.has = Ar;
1881
+ Y.prototype.set = Tr;
1842
1882
  function re(e) {
1843
- var t = -1, r = e ? e.length : 0;
1844
- for (this.clear(); ++t < r; ) {
1845
- var n = e[t];
1846
- this.set(n[0], n[1]);
1883
+ var t = -1, n = e ? e.length : 0;
1884
+ for (this.clear(); ++t < n; ) {
1885
+ var r = e[t];
1886
+ this.set(r[0], r[1]);
1847
1887
  }
1848
1888
  }
1849
- function Mn() {
1889
+ function Nr() {
1850
1890
  this.__data__ = [];
1851
1891
  }
1852
- function $n(e) {
1853
- var t = this.__data__, r = Ce(t, e);
1854
- if (r < 0)
1892
+ function kr(e) {
1893
+ var t = this.__data__, n = Se(t, e);
1894
+ if (n < 0)
1855
1895
  return !1;
1856
- var n = t.length - 1;
1857
- return r == n ? t.pop() : In.call(t, r, 1), !0;
1858
- }
1859
- function Ln(e) {
1860
- var t = this.__data__, r = Ce(t, e);
1861
- return r < 0 ? void 0 : t[r][1];
1862
- }
1863
- function qn(e) {
1864
- return Ce(this.__data__, e) > -1;
1865
- }
1866
- function Gn(e, t) {
1867
- var r = this.__data__, n = Ce(r, e);
1868
- return n < 0 ? r.push([e, t]) : r[n][1] = t, this;
1869
- }
1870
- re.prototype.clear = Mn;
1871
- re.prototype.delete = $n;
1872
- re.prototype.get = Ln;
1873
- re.prototype.has = qn;
1874
- re.prototype.set = Gn;
1875
- function H(e) {
1876
- var t = -1, r = e ? e.length : 0;
1877
- for (this.clear(); ++t < r; ) {
1878
- var n = e[t];
1879
- this.set(n[0], n[1]);
1896
+ var r = t.length - 1;
1897
+ return n == r ? t.pop() : Rr.call(t, n, 1), !0;
1898
+ }
1899
+ function Mr(e) {
1900
+ var t = this.__data__, n = Se(t, e);
1901
+ return n < 0 ? void 0 : t[n][1];
1902
+ }
1903
+ function Lr(e) {
1904
+ return Se(this.__data__, e) > -1;
1905
+ }
1906
+ function $r(e, t) {
1907
+ var n = this.__data__, r = Se(n, e);
1908
+ return r < 0 ? n.push([e, t]) : n[r][1] = t, this;
1909
+ }
1910
+ re.prototype.clear = Nr;
1911
+ re.prototype.delete = kr;
1912
+ re.prototype.get = Mr;
1913
+ re.prototype.has = Lr;
1914
+ re.prototype.set = $r;
1915
+ function J(e) {
1916
+ var t = -1, n = e ? e.length : 0;
1917
+ for (this.clear(); ++t < n; ) {
1918
+ var r = e[t];
1919
+ this.set(r[0], r[1]);
1880
1920
  }
1881
1921
  }
1882
- function Un() {
1922
+ function Ur() {
1883
1923
  this.__data__ = {
1884
- hash: new W(),
1885
- map: new (On || re)(),
1886
- string: new W()
1924
+ hash: new Y(),
1925
+ map: new (Ir || re)(),
1926
+ string: new Y()
1887
1927
  };
1888
1928
  }
1889
- function Kn(e) {
1890
- return Ee(this, e).delete(e);
1929
+ function qr(e) {
1930
+ return we(this, e).delete(e);
1891
1931
  }
1892
- function Qn(e) {
1893
- return Ee(this, e).get(e);
1932
+ function jr(e) {
1933
+ return we(this, e).get(e);
1894
1934
  }
1895
- function jn(e) {
1896
- return Ee(this, e).has(e);
1935
+ function Gr(e) {
1936
+ return we(this, e).has(e);
1897
1937
  }
1898
- function zn(e, t) {
1899
- return Ee(this, e).set(e, t), this;
1938
+ function Kr(e, t) {
1939
+ return we(this, e).set(e, t), this;
1900
1940
  }
1901
- H.prototype.clear = Un;
1902
- H.prototype.delete = Kn;
1903
- H.prototype.get = Qn;
1904
- H.prototype.has = jn;
1905
- H.prototype.set = zn;
1906
- function Ce(e, t) {
1907
- for (var r = e.length; r--; )
1908
- if (rs(e[r][0], t))
1909
- return r;
1941
+ J.prototype.clear = Ur;
1942
+ J.prototype.delete = qr;
1943
+ J.prototype.get = jr;
1944
+ J.prototype.has = Gr;
1945
+ J.prototype.set = Kr;
1946
+ function Se(e, t) {
1947
+ for (var n = e.length; n--; )
1948
+ if (es(e[n][0], t))
1949
+ return n;
1910
1950
  return -1;
1911
1951
  }
1912
- function Wn(e, t) {
1913
- t = Jn(t, e) ? [t] : Yn(t);
1914
- for (var r = 0, n = t.length; e != null && r < n; )
1915
- e = e[es(t[r++])];
1916
- return r && r == n ? e : void 0;
1952
+ function zr(e, t) {
1953
+ t = Hr(t, e) ? [t] : Br(t);
1954
+ for (var n = 0, r = t.length; e != null && n < r; )
1955
+ e = e[Xr(t[n++])];
1956
+ return n && n == r ? e : void 0;
1917
1957
  }
1918
- function Hn(e) {
1919
- if (!jt(e) || Xn(e))
1958
+ function Qr(e) {
1959
+ if (!qt(e) || Jr(e))
1920
1960
  return !1;
1921
- var t = ns(e) || Pn(e) ? xn : Cn;
1922
- return t.test(ts(e));
1961
+ var t = ts(e) || br(e) ? Pr : Er;
1962
+ return t.test(Zr(e));
1923
1963
  }
1924
- function Bn(e) {
1964
+ function Wr(e) {
1925
1965
  if (typeof e == "string")
1926
1966
  return e;
1927
- if (ze(e))
1928
- return ut ? ut.call(e) : "";
1967
+ if (Qe(e))
1968
+ return ot ? ot.call(e) : "";
1929
1969
  var t = e + "";
1930
1970
  return t == "0" && 1 / e == -1 / 0 ? "-0" : t;
1931
1971
  }
1932
- function Yn(e) {
1933
- return Qt(e) ? e : Zn(e);
1972
+ function Br(e) {
1973
+ return Ut(e) ? e : Vr(e);
1934
1974
  }
1935
- function Ee(e, t) {
1936
- var r = e.__data__;
1937
- return Vn(t) ? r[typeof t == "string" ? "string" : "hash"] : r.map;
1975
+ function we(e, t) {
1976
+ var n = e.__data__;
1977
+ return Yr(t) ? n[typeof t == "string" ? "string" : "hash"] : n.map;
1938
1978
  }
1939
- function Kt(e, t) {
1940
- var r = vn(e, t);
1941
- return Hn(r) ? r : void 0;
1979
+ function $t(e, t) {
1980
+ var n = Cr(e, t);
1981
+ return Qr(n) ? n : void 0;
1942
1982
  }
1943
- function Jn(e, t) {
1944
- if (Qt(e))
1983
+ function Hr(e, t) {
1984
+ if (Ut(e))
1945
1985
  return !1;
1946
- var r = typeof e;
1947
- return r == "number" || r == "symbol" || r == "boolean" || e == null || ze(e) ? !0 : mn.test(e) || !hn.test(e) || t != null && e in Object(t);
1986
+ var n = typeof e;
1987
+ return n == "number" || n == "symbol" || n == "boolean" || e == null || Qe(e) ? !0 : yr.test(e) || !pr.test(e) || t != null && e in Object(t);
1948
1988
  }
1949
- function Vn(e) {
1989
+ function Yr(e) {
1950
1990
  var t = typeof e;
1951
1991
  return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? e !== "__proto__" : e === null;
1952
1992
  }
1953
- function Xn(e) {
1954
- return !!it && it in e;
1993
+ function Jr(e) {
1994
+ return !!nt && nt in e;
1955
1995
  }
1956
- var Zn = je(function(e) {
1957
- e = os(e);
1996
+ var Vr = ze(function(e) {
1997
+ e = rs(e);
1958
1998
  var t = [];
1959
- return gn.test(e) && t.push(""), e.replace(_n, function(r, n, s, i) {
1960
- t.push(s ? i.replace(Sn, "$1") : n || r);
1999
+ return hr.test(e) && t.push(""), e.replace(gr, function(n, r, s, o) {
2000
+ t.push(s ? o.replace(_r, "$1") : r || n);
1961
2001
  }), t;
1962
2002
  });
1963
- function es(e) {
1964
- if (typeof e == "string" || ze(e))
2003
+ function Xr(e) {
2004
+ if (typeof e == "string" || Qe(e))
1965
2005
  return e;
1966
2006
  var t = e + "";
1967
2007
  return t == "0" && 1 / e == -1 / 0 ? "-0" : t;
1968
2008
  }
1969
- function ts(e) {
2009
+ function Zr(e) {
1970
2010
  if (e != null) {
1971
2011
  try {
1972
- return Gt.call(e);
2012
+ return Mt.call(e);
1973
2013
  } catch {
1974
2014
  }
1975
2015
  try {
@@ -1979,140 +2019,163 @@ function ts(e) {
1979
2019
  }
1980
2020
  return "";
1981
2021
  }
1982
- function je(e, t) {
2022
+ function ze(e, t) {
1983
2023
  if (typeof e != "function" || t && typeof t != "function")
1984
- throw new TypeError(dn);
1985
- var r = function() {
1986
- var n = arguments, s = t ? t.apply(this, n) : n[0], i = r.cache;
1987
- if (i.has(s))
1988
- return i.get(s);
1989
- var o = e.apply(this, n);
1990
- return r.cache = i.set(s, o), o;
2024
+ throw new TypeError(ur);
2025
+ var n = function() {
2026
+ var r = arguments, s = t ? t.apply(this, r) : r[0], o = n.cache;
2027
+ if (o.has(s))
2028
+ return o.get(s);
2029
+ var i = e.apply(this, r);
2030
+ return n.cache = o.set(s, i), i;
1991
2031
  };
1992
- return r.cache = new (je.Cache || H)(), r;
2032
+ return n.cache = new (ze.Cache || J)(), n;
1993
2033
  }
1994
- je.Cache = H;
1995
- function rs(e, t) {
2034
+ ze.Cache = J;
2035
+ function es(e, t) {
1996
2036
  return e === t || e !== e && t !== t;
1997
2037
  }
1998
- var Qt = Array.isArray;
1999
- function ns(e) {
2000
- var t = jt(e) ? Ut.call(e) : "";
2001
- return t == fn || t == pn;
2038
+ var Ut = Array.isArray;
2039
+ function ts(e) {
2040
+ var t = qt(e) ? Lt.call(e) : "";
2041
+ return t == lr || t == dr;
2002
2042
  }
2003
- function jt(e) {
2043
+ function qt(e) {
2004
2044
  var t = typeof e;
2005
2045
  return !!e && (t == "object" || t == "function");
2006
2046
  }
2007
- function ss(e) {
2047
+ function ns(e) {
2008
2048
  return !!e && typeof e == "object";
2009
2049
  }
2010
- function ze(e) {
2011
- return typeof e == "symbol" || ss(e) && Ut.call(e) == yn;
2012
- }
2013
- function os(e) {
2014
- return e == null ? "" : Bn(e);
2050
+ function Qe(e) {
2051
+ return typeof e == "symbol" || ns(e) && Lt.call(e) == fr;
2052
+ }
2053
+ function rs(e) {
2054
+ return e == null ? "" : Wr(e);
2055
+ }
2056
+ function ss(e, t, n) {
2057
+ var r = e == null ? void 0 : zr(e, t);
2058
+ return r === void 0 ? n : r;
2059
+ }
2060
+ var os = ss;
2061
+ const V = /* @__PURE__ */ cr(os);
2062
+ function is(e, t, n) {
2063
+ return Tt(e ?? { result: [], success: !0, totalCount: 0 }, (s) => {
2064
+ for (const o of t)
2065
+ switch (o.type) {
2066
+ case "ADD": {
2067
+ s.result.findIndex(
2068
+ (a) => V(o.payload.data, n) === V(a, n)
2069
+ ) === -1 && s.result.push(o.payload.data);
2070
+ break;
2071
+ }
2072
+ case "UPDATE": {
2073
+ const i = s.result.findIndex(
2074
+ (a) => V(o.payload.data, n) === V(a, n)
2075
+ );
2076
+ i !== -1 && (s.result[i] = o.payload.data);
2077
+ break;
2078
+ }
2079
+ case "DELETE": {
2080
+ const i = s.result.findIndex(
2081
+ (a) => V(o.payload.data, n) === V(a, n)
2082
+ );
2083
+ i !== -1 && s.result.splice(i, 1);
2084
+ break;
2085
+ }
2086
+ }
2087
+ });
2015
2088
  }
2016
- function is(e, t, r) {
2017
- var n = e == null ? void 0 : Wn(e, t);
2018
- return n === void 0 ? r : n;
2089
+ function as(e, t, n, r, s, o) {
2090
+ const i = (o == null ? void 0 : o.syncWindowMs) ?? 500, a = $([]), u = $(null), l = $(null), c = $(s);
2091
+ c.current = s;
2092
+ const g = U(() => {
2093
+ const d = a.current;
2094
+ if (a.current = [], u.current = null, l.current = null, !(d.length === 0 || !r)) {
2095
+ e.setQueryData(
2096
+ t,
2097
+ (h) => is(h, d, r)
2098
+ );
2099
+ for (const h of d)
2100
+ (h.type === "ADD" || h.type === "UPDATE") && e.setQueryData(
2101
+ n(h.payload.id, h.payload.namespace),
2102
+ { result: h.payload.data }
2103
+ );
2104
+ }
2105
+ }, [e, t, n, r]), f = U(
2106
+ (d) => {
2107
+ a.current.push(d), !(u.current !== null || l.current !== null) && (c.current === 1 ? u.current = setTimeout(g, i) : l.current = requestAnimationFrame(g));
2108
+ },
2109
+ [g, i]
2110
+ );
2111
+ return j(() => () => {
2112
+ u.current !== null && (clearTimeout(u.current), u.current = null), l.current !== null && (cancelAnimationFrame(l.current), l.current = null);
2113
+ }, []), f;
2019
2114
  }
2020
- var as = is;
2021
- const Y = /* @__PURE__ */ ln(as), Bs = ({
2115
+ const Ys = ({
2022
2116
  pluginID: e,
2023
2117
  connectionID: t,
2024
- resourceKey: r,
2025
- idAccessor: n,
2026
- namespaces: s = [],
2027
- listParams: i = {},
2028
- createParams: o = {}
2118
+ resourceKey: n,
2119
+ idAccessor: r,
2120
+ namespaces: s
2029
2121
  }) => {
2030
- const a = P(e), c = G(), { showSnackbar: l } = $(), u = [a, t, r, s, "list"], y = (d, g) => [a, t, r, g, d], { mutateAsync: h } = v({
2031
- mutationFn: async (d) => mt(a, t, r, T.CreateInput.createFrom({
2032
- params: d.params || o,
2033
- input: d.input,
2034
- namespaces: s
2122
+ const o = D(e), i = G(), { showSnackbar: a } = L(), u = S.useMemo(() => s ?? [], [s]), l = S.useMemo(
2123
+ () => [o, t, n, u, "list"],
2124
+ [o, t, n, u]
2125
+ ), c = S.useCallback(
2126
+ (m, p) => [o, t, n, p, m],
2127
+ [o, t, n]
2128
+ ), { mutateAsync: g } = v({
2129
+ mutationFn: async (m) => ft(o, t, n, A.CreateInput.createFrom({
2130
+ input: m.input,
2131
+ namespace: m.namespace ?? (u.length === 1 ? u[0] : "")
2035
2132
  })),
2036
- onSuccess: async (d) => {
2037
- var C, k, ie, B, L, We, He, Be;
2038
- let g = "";
2039
- (C = d.result.metadata) != null && C.name ? g = d.result.metadata.name : (k = d.result) != null && k.id ? g = (ie = d.result) == null ? void 0 : ie.id : (B = d.result) != null && B.name ? g = (L = d.result) == null ? void 0 : L.name : (We = d.result) != null && We.ID ? g = (He = d.result) == null ? void 0 : He.ID : (Be = d.result) != null && Be.Name && (g = d.result.Name);
2040
- const E = g ? `Resource ${g} created` : "Resource created";
2041
- l(E, "success"), await c.invalidateQueries({ queryKey: u });
2133
+ onSuccess: async (m) => {
2134
+ var C;
2135
+ const p = m.result;
2136
+ let E = "";
2137
+ (C = p == null ? void 0 : p.metadata) != null && C.name ? E = p.metadata.name : p != null && p.id ? E = p.id : p != null && p.name ? E = p.name : p != null && p.ID ? E = p.ID : p != null && p.Name && (E = p.Name);
2138
+ const _ = E ? `Resource ${E} created` : "Resource created";
2139
+ a(_, "success"), await i.invalidateQueries({ queryKey: l });
2042
2140
  },
2043
- onError: I(l, "Failed to create resource")
2044
- }), f = D({
2045
- queryKey: u,
2046
- queryFn: async () => ht(a, t, r, T.ListInput.createFrom({
2047
- params: i,
2048
- order: {
2049
- by: "name",
2050
- direction: !0
2051
- },
2052
- pagination: {
2053
- page: 1,
2054
- pageSize: 200
2055
- },
2056
- namespaces: s
2141
+ onError: I(a, "Failed to create resource")
2142
+ }), f = P({
2143
+ queryKey: l,
2144
+ queryFn: async () => dt(o, t, n, A.ListInput.createFrom({
2145
+ order: [{ field: "name", descending: !1 }],
2146
+ pagination: { page: 1, pageSize: 200 },
2147
+ namespaces: u
2057
2148
  })),
2058
- placeholderData: (d, g) => d,
2149
+ placeholderData: (m, p) => m,
2059
2150
  retry: !1
2060
- }), m = _.useCallback((d) => {
2061
- n && (c.setQueryData(u, (g) => le(g, (E) => {
2062
- if (E || (E = T.ListResult.createFrom({
2063
- result: [],
2064
- success: !0,
2065
- pagination: {}
2066
- })), E.result.findIndex((k) => Y(d.data, n) === Y(k, n)) === -1) {
2067
- E.result.push(d.data);
2068
- return;
2069
- }
2070
- })), c.setQueryData(y(d.id, d.namespace), { result: d.data }));
2071
- }, []), p = _.useCallback((d) => {
2072
- n && (c.setQueryData(u, (g) => le(g, (E) => {
2073
- E || (E = T.ListResult.createFrom({
2074
- result: [],
2075
- success: !0,
2076
- pagination: {}
2077
- }));
2078
- const C = E.result.findIndex((k) => Y(d.newData, n) === Y(k, n));
2079
- if (C !== -1) {
2080
- E.result[C] = d.newData;
2081
- return;
2082
- }
2083
- })), c.setQueryData(y(d.id, d.namespace), { result: d.newData }));
2084
- }, []), S = _.useCallback((d) => {
2085
- n && c.setQueryData(u, (g) => le(g, (E) => {
2086
- if (!E)
2087
- return;
2088
- const C = E.result.findIndex((k) => Y(d.data, n) === Y(k, n));
2089
- if (C !== -1) {
2090
- E.result.splice(C, 1);
2091
- return;
2092
- }
2093
- }));
2094
- }, []);
2095
- _.useEffect(() => {
2096
- if (!n)
2151
+ }), [d, h] = S.useState(
2152
+ w.IDLE
2153
+ );
2154
+ S.useEffect(() => x(
2155
+ `${o}/${t}/watch/STATE`,
2156
+ (p) => {
2157
+ p.resourceKey === n && h(p.state);
2158
+ }
2159
+ ), [o, t, n]);
2160
+ const y = as(i, l, c, r, d);
2161
+ return S.useEffect(() => {
2162
+ if (!r)
2097
2163
  return;
2098
- let d = !1;
2099
- vr(a, t, r).then(() => {
2100
- d || c.invalidateQueries({ queryKey: u });
2101
- });
2102
- const g = A(`${a}/${t}/${r}/ADD`, m), E = A(`${a}/${t}/${r}/UPDATE`, p), C = A(`${a}/${t}/${r}/DELETE`, S);
2164
+ bn(o, t, n);
2165
+ const m = x(
2166
+ `${o}/${t}/${n}/ADD`,
2167
+ (_) => y({ type: "ADD", payload: _ })
2168
+ ), p = x(
2169
+ `${o}/${t}/${n}/UPDATE`,
2170
+ (_) => y({ type: "UPDATE", payload: _ })
2171
+ ), E = x(
2172
+ `${o}/${t}/${n}/DELETE`,
2173
+ (_) => y({ type: "DELETE", payload: _ })
2174
+ );
2103
2175
  return () => {
2104
- d = !0, g(), E(), C(), Pr(a, t, r);
2176
+ m(), p(), E(), vn(o, t, n);
2105
2177
  };
2106
- }, [a, t, r]);
2107
- const [w, b] = _.useState(
2108
- x.Pending
2109
- );
2110
- return _.useEffect(() => A(
2111
- `${a}/${t}/informer/STATE`,
2112
- (g) => {
2113
- g.resourceKey === r && b(g.state);
2114
- }
2115
- ), [a, t, r]), {
2178
+ }, [o, t, n, y]), {
2116
2179
  /**
2117
2180
  * Fetch result for the resource. The client will automatically cache the result, and update the cache
2118
2181
  * when the resources are updated or deleted via the returned create and remove mutation functions, or
@@ -2125,132 +2188,127 @@ const Y = /* @__PURE__ */ ln(as), Bs = ({
2125
2188
  *
2126
2189
  * @params opts Optional parameters to pass to the resource create operation
2127
2190
  */
2128
- create: h,
2129
- /** Current informer state for this resource type */
2130
- informerState: w,
2131
- /** Whether the informer is currently syncing */
2132
- isSyncing: w === x.Syncing,
2133
- /** Whether the informer has fully synced */
2134
- isSynced: w === x.Synced,
2135
- /** Whether the informer encountered an error */
2136
- informerError: w === x.Error
2191
+ create: g,
2192
+ /** Current watch state for this resource type */
2193
+ watchState: d,
2194
+ /** Whether the watch is currently syncing */
2195
+ isSyncing: d === w.SYNCING,
2196
+ /** Whether the watch has fully synced */
2197
+ isSynced: d === w.SYNCED,
2198
+ /** Whether the watch encountered an error */
2199
+ watchError: d === w.ERROR
2137
2200
  };
2138
- }, Ys = ({ pluginID: e }) => {
2139
- const t = P(e), { showSnackbar: r } = $(), n = v({
2140
- mutationFn: async ({ opts: o, input: a }) => mt(
2201
+ }, Js = ({ pluginID: e }) => {
2202
+ const t = D(e), { showSnackbar: n } = L(), r = v({
2203
+ mutationFn: async ({ opts: i, input: a }) => ft(
2141
2204
  t,
2142
- o.connectionID,
2143
- o.resourceKey,
2144
- T.CreateInput.createFrom({
2145
- params: { ...o.params, ...a.params },
2146
- input: { ...o.params, ...a.input },
2147
- id: o.resourceID,
2148
- namespace: o.namespace
2205
+ i.connectionID,
2206
+ i.resourceKey,
2207
+ A.CreateInput.createFrom({
2208
+ input: a.input,
2209
+ namespace: a.namespace ?? i.namespace ?? ""
2149
2210
  })
2150
2211
  ),
2151
- onSuccess: (o, { opts: a }) => {
2152
- r(`Resource ${a.resourceID} created`, "success");
2212
+ onSuccess: (i, { opts: a }) => {
2213
+ n(`Resource ${a.resourceID} created`, "success");
2153
2214
  },
2154
- onError(o, { opts: a }) {
2155
- X(r, o, `Failed to create resource ${a.resourceID}`);
2215
+ onError(i, { opts: a }) {
2216
+ Z(n, i, `Failed to create resource ${a.resourceID}`);
2156
2217
  }
2157
2218
  }), s = v({
2158
- mutationFn: async ({ opts: o, input: a }) => pt(
2219
+ mutationFn: async ({ opts: i, input: a }) => ut(
2159
2220
  t,
2160
- o.connectionID,
2161
- o.resourceKey,
2162
- T.UpdateInput.createFrom({
2163
- params: { ...o.params, ...a.params },
2164
- input: { ...o.params, ...a.input },
2165
- id: o.resourceID,
2166
- namespace: o.namespace
2221
+ i.connectionID,
2222
+ i.resourceKey,
2223
+ A.UpdateInput.createFrom({
2224
+ input: a.input,
2225
+ id: i.resourceID,
2226
+ namespace: i.namespace ?? ""
2167
2227
  })
2168
2228
  ),
2169
- onSuccess: (o, { opts: a }) => {
2170
- r(`Resource ${a.resourceID} updated`, "success");
2229
+ onSuccess: (i, { opts: a }) => {
2230
+ n(`Resource ${a.resourceID} updated`, "success");
2171
2231
  },
2172
- onError(o, { opts: a }) {
2173
- X(r, o, `Failed to update resource ${a.resourceID}`);
2232
+ onError(i, { opts: a }) {
2233
+ Z(n, i, `Failed to update resource ${a.resourceID}`);
2174
2234
  }
2175
- }), i = v({
2176
- mutationFn: async ({ opts: o, input: a }) => yt(
2235
+ }), o = v({
2236
+ mutationFn: async ({ opts: i, input: a }) => lt(
2177
2237
  t,
2178
- o.connectionID,
2179
- o.resourceKey,
2180
- T.DeleteInput.createFrom({
2181
- ...a,
2182
- params: { ...o.params, ...a.params },
2183
- input: { ...o.params, ...a.input },
2184
- id: o.resourceID,
2185
- namespace: o.namespace
2238
+ i.connectionID,
2239
+ i.resourceKey,
2240
+ A.DeleteInput.createFrom({
2241
+ id: i.resourceID,
2242
+ namespace: i.namespace ?? "",
2243
+ gracePeriodSeconds: a.gracePeriodSeconds
2186
2244
  })
2187
2245
  ),
2188
- onSuccess: (o, { opts: a }) => {
2189
- r(`Resource ${a.resourceID} deleted`, "success");
2246
+ onSuccess: (i, { opts: a }) => {
2247
+ n(`Resource ${a.resourceID} deleted`, "success");
2190
2248
  },
2191
- onError(o, { opts: a }) {
2192
- X(r, o, `Failed to delete resource ${a.resourceID}`);
2249
+ onError(i, { opts: a }) {
2250
+ Z(n, i, `Failed to delete resource ${a.resourceID}`);
2193
2251
  }
2194
2252
  });
2195
2253
  return {
2196
- create: n.mutateAsync,
2254
+ create: r.mutateAsync,
2197
2255
  update: s.mutateAsync,
2198
- remove: i.mutateAsync
2256
+ remove: o.mutateAsync
2199
2257
  };
2200
- }, Js = ({
2258
+ }, Vs = ({
2201
2259
  pluginID: e,
2202
2260
  connectionID: t,
2203
- resourceKey: r,
2204
- enabled: n = !0
2261
+ resourceKey: n,
2262
+ enabled: r = !0
2205
2263
  }) => {
2206
- const s = P(e), i = D({
2207
- queryKey: ["RESOURCE_ACTIONS", s, t, r],
2208
- queryFn: () => Dr(s, t, r),
2209
- enabled: n && !!s && !!t && !!r,
2264
+ const s = D(e), o = P({
2265
+ queryKey: ["RESOURCE_ACTIONS", s, t, n],
2266
+ queryFn: () => Dn(s, t, n),
2267
+ enabled: r && !!s && !!t && !!n,
2210
2268
  staleTime: 5 * 60 * 1e3
2211
2269
  // actions don't change often
2212
2270
  });
2213
2271
  return {
2214
- actions: i.data ?? [],
2215
- isLoading: i.isLoading,
2216
- error: i.error
2272
+ actions: o.data ?? [],
2273
+ isLoading: o.isLoading,
2274
+ error: o.error
2217
2275
  };
2218
- }, Vs = ({
2276
+ }, Xs = ({
2219
2277
  pluginID: e,
2220
2278
  connectionID: t,
2221
- resourceKey: r
2279
+ resourceKey: n
2222
2280
  }) => {
2223
- const n = P(e), s = G(), { showSnackbar: i } = $(), o = v({
2224
- mutationFn: async ({ actionID: a, id: c = "", namespace: l = "", params: u = {} }) => Fr(
2225
- n,
2226
- t,
2281
+ const r = D(e), s = G(), { showSnackbar: o } = L(), i = v({
2282
+ mutationFn: async ({ actionID: a, id: u = "", namespace: l = "", params: c = {} }) => Pn(
2227
2283
  r,
2284
+ t,
2285
+ n,
2228
2286
  a,
2229
- T.ActionInput.createFrom({ id: c, namespace: l, params: u })
2287
+ A.ActionInput.createFrom({ id: u, namespace: l, params: c })
2230
2288
  ),
2231
2289
  onSuccess: (a) => {
2232
- a.message && i(a.message, "success"), s.invalidateQueries({
2233
- queryKey: ["RESOURCES", n, t, r]
2290
+ a.message && o(a.message, "success"), s.invalidateQueries({
2291
+ queryKey: ["RESOURCES", r, t, n]
2234
2292
  });
2235
2293
  },
2236
- onError: (a, c) => {
2237
- X(i, a, `Failed to execute action "${c.actionID}"`);
2294
+ onError: (a, u) => {
2295
+ Z(o, a, `Failed to execute action "${u.actionID}"`);
2238
2296
  }
2239
2297
  });
2240
2298
  return {
2241
- executeAction: o.mutateAsync,
2242
- isExecuting: o.isPending,
2243
- error: o.error
2299
+ executeAction: i.mutateAsync,
2300
+ isExecuting: i.isPending,
2301
+ error: i.error
2244
2302
  };
2245
- }, Xs = ({
2303
+ }, Zs = ({
2246
2304
  pluginID: e,
2247
2305
  connectionID: t,
2248
- enabled: r = !0
2306
+ enabled: n = !0
2249
2307
  }) => {
2250
- const n = P(e), s = D({
2251
- queryKey: ["EDITOR_SCHEMAS", n, t],
2252
- queryFn: () => xr(n, t),
2253
- enabled: r && !!n && !!t,
2308
+ const r = D(e), s = P({
2309
+ queryKey: ["EDITOR_SCHEMAS", r, t],
2310
+ queryFn: () => Rn(r, t),
2311
+ enabled: n && !!r && !!t,
2254
2312
  staleTime: 10 * 60 * 1e3,
2255
2313
  // schemas are fairly stable per connection
2256
2314
  retry: 1
@@ -2261,181 +2319,222 @@ const Y = /* @__PURE__ */ ln(as), Bs = ({
2261
2319
  error: s.error,
2262
2320
  refetch: s.refetch
2263
2321
  };
2264
- }, Zs = ({
2322
+ }, eo = ({
2265
2323
  pluginID: e,
2266
2324
  connectionID: t,
2267
- enabled: r = !0
2325
+ enabled: n = !0
2268
2326
  }) => {
2269
- const n = P(e), s = G(), i = [n, t, "informer-state"], o = D({
2270
- queryKey: i,
2271
- queryFn: () => Ir(n, t),
2272
- enabled: r && !!n && !!t
2273
- });
2274
- Q(() => !r || !n || !t ? void 0 : A(
2275
- `${n}/${t}/informer/STATE`,
2276
- (u) => {
2277
- s.setQueryData(i, (y) => y && le(y, (h) => {
2278
- h.resources[u.resourceKey] = u.state, h.resourceCounts[u.resourceKey] = u.resourceCount;
2279
- let f = 0, m = 0;
2280
- for (const p of Object.values(h.resources))
2281
- p === x.Synced && f++, p === x.Error && m++;
2282
- h.syncedCount = f, h.errorCount = m;
2283
- }));
2327
+ const r = D(e), s = G(), o = [r, t, "watch-state"], i = $([]), a = $(!1), u = U((f) => {
2328
+ s.setQueryData(o, (d) => d && Tt(d, (h) => {
2329
+ h.resources[f.resourceKey] = f.state, h.resourceCounts[f.resourceKey] = f.resourceCount;
2330
+ let y = 0, m = 0;
2331
+ for (const p of Object.values(h.resources))
2332
+ p === w.SYNCED && y++, (p === w.ERROR || p === w.FAILED) && m++;
2333
+ h.syncedCount = y, h.errorCount = m;
2334
+ }));
2335
+ }, [s, r, t]), l = P({
2336
+ queryKey: o,
2337
+ queryFn: async () => {
2338
+ const f = await In(r, t), d = {};
2339
+ let h = 0, y = 0;
2340
+ for (const [p, E] of Object.entries(f.resources ?? {}))
2341
+ d[p] = E, E === w.SYNCED && h++, E === w.ERROR && y++;
2342
+ const m = {};
2343
+ for (const [p, E] of Object.entries(f.resourceCounts ?? {}))
2344
+ m[p] = E;
2345
+ return {
2346
+ connection: f.connectionId,
2347
+ resources: d,
2348
+ resourceCounts: m,
2349
+ totalResources: Object.keys(d).length,
2350
+ syncedCount: h,
2351
+ errorCount: y
2352
+ };
2353
+ },
2354
+ enabled: n && !!r && !!t,
2355
+ refetchInterval: (f) => {
2356
+ const d = f.state.data;
2357
+ if (!d || d.totalResources === 0) return 3e3;
2358
+ let h = 0;
2359
+ for (const y of Object.values(d.resources))
2360
+ (y === w.SYNCED || y === w.ERROR || y === w.STOPPED || y === w.FAILED || y === w.FORBIDDEN || y === w.SKIPPED) && h++;
2361
+ return h >= d.totalResources ? !1 : 3e3;
2284
2362
  }
2285
- ), [n, t, r]);
2286
- const a = o.data;
2287
- let c = 0;
2288
- if (a != null && a.resources)
2289
- for (const l of Object.values(a.resources))
2290
- (l === x.Synced || l === x.Error || l === x.Cancelled) && c++;
2363
+ });
2364
+ j(() => {
2365
+ if (!l.data || a.current) return;
2366
+ a.current = !0;
2367
+ const f = i.current;
2368
+ i.current = [];
2369
+ for (const d of f)
2370
+ u(d);
2371
+ }, [l.data, u]), j(() => {
2372
+ if (!n || !r || !t)
2373
+ return;
2374
+ a.current = !1, i.current = [];
2375
+ const f = x(
2376
+ `${r}/${t}/watch/STATE`,
2377
+ (d) => {
2378
+ a.current ? u(d) : i.current.push(d);
2379
+ }
2380
+ );
2381
+ return () => {
2382
+ f(), a.current = !1, i.current = [];
2383
+ };
2384
+ }, [r, t, n, u]);
2385
+ const c = l.data;
2386
+ let g = 0;
2387
+ if (c != null && c.resources)
2388
+ for (const f of Object.values(c.resources))
2389
+ (f === w.SYNCED || f === w.ERROR || f === w.STOPPED || f === w.FAILED || f === w.FORBIDDEN || f === w.SKIPPED) && g++;
2291
2390
  return {
2292
2391
  /** Full summary query result */
2293
- summary: o,
2294
- /** Get the state of a specific resource type's informer */
2295
- getResourceState: (l) => a == null ? void 0 : a.resources[l],
2296
- /** Whether all registered informers have reached a terminal state */
2297
- isFullySynced: a ? a.totalResources > 0 && c === a.totalResources : !1,
2392
+ summary: l,
2393
+ /** Get the state of a specific resource type's watch */
2394
+ getResourceState: (f) => c == null ? void 0 : c.resources[f],
2395
+ /** Whether all registered watches have reached a terminal state */
2396
+ isFullySynced: c ? c.totalResources > 0 && g === c.totalResources : !1,
2298
2397
  /** Sync progress as a 0-1 fraction (terminal states / total) */
2299
- syncProgress: a && a.totalResources > 0 ? c / a.totalResources : 0,
2300
- /** Number of informers that encountered errors */
2301
- errorCount: (a == null ? void 0 : a.errorCount) ?? 0
2398
+ syncProgress: c && c.totalResources > 0 ? g / c.totalResources : 0,
2399
+ /** Number of watches that encountered errors */
2400
+ errorCount: (c == null ? void 0 : c.errorCount) ?? 0
2302
2401
  };
2303
- }, eo = () => {
2304
- const [e, t] = q(/* @__PURE__ */ new Map()), r = de(/* @__PURE__ */ new Map()), n = de(/* @__PURE__ */ new Map()), s = V((l) => {
2305
- const u = qe(l), y = Ot(r.current, l), h = Ft(y);
2306
- if (t((f) => {
2307
- const m = new Map(f);
2308
- return m.set(u, h), m;
2309
- }), n.current.has(u) && (clearTimeout(n.current.get(u)), n.current.delete(u)), fe(h)) {
2310
- const f = setTimeout(() => {
2311
- t((m) => {
2312
- const p = new Map(m);
2313
- return p.delete(u), p;
2314
- }), r.current.delete(u), n.current.delete(u);
2402
+ }, to = () => {
2403
+ const [e, t] = q(/* @__PURE__ */ new Map()), n = $(/* @__PURE__ */ new Map()), r = $(/* @__PURE__ */ new Map()), s = U((l) => {
2404
+ const c = Ue(l), g = Dt(n.current, l), f = Oe(g);
2405
+ if (t((d) => {
2406
+ const h = new Map(d);
2407
+ return h.set(c, f), h;
2408
+ }), r.current.has(c) && (clearTimeout(r.current.get(c)), r.current.delete(c)), de(f)) {
2409
+ const d = setTimeout(() => {
2410
+ t((h) => {
2411
+ const y = new Map(h);
2412
+ return y.delete(c), y;
2413
+ }), n.current.delete(c), r.current.delete(c);
2315
2414
  }, 5e3);
2316
- n.current.set(u, f);
2415
+ r.current.set(c, d);
2317
2416
  }
2318
2417
  }, []);
2319
- Q(() => {
2320
- const l = A("informer/STATE", s);
2418
+ j(() => {
2419
+ const l = x("watch/STATE", s);
2321
2420
  return () => {
2322
2421
  l();
2323
- for (const u of n.current.values())
2324
- clearTimeout(u);
2422
+ for (const c of r.current.values())
2423
+ clearTimeout(c);
2325
2424
  };
2326
2425
  }, [s]);
2327
- const i = Array.from(e.values()), o = xt(i), a = i.find((l) => !fe(l)) ?? i[0] ?? null, c = It(i);
2426
+ const o = Array.from(e.values()), i = bt(o), a = o.find((l) => !de(l)) ?? o[0] ?? null, u = vt(o);
2328
2427
  return {
2329
2428
  /** All tracked syncs */
2330
- syncs: i,
2429
+ syncs: o,
2331
2430
  /** Whether any connection is actively syncing */
2332
- hasSyncing: o,
2431
+ hasSyncing: i,
2333
2432
  /** The primary (first incomplete) sync or most recent */
2334
2433
  primarySync: a,
2335
2434
  /** Aggregate progress across all connections (0-1) */
2336
- aggregateProgress: c
2435
+ aggregateProgress: u
2337
2436
  };
2338
2437
  }, cs = () => {
2339
- const e = _.useContext(Et);
2438
+ const e = S.useContext(_t);
2340
2439
  if (!e) throw new Error("useOperations must be used within an OperationsProvider");
2341
2440
  return e;
2342
- }, to = ({
2441
+ }, no = ({
2343
2442
  pluginID: e,
2344
2443
  connectionID: t,
2345
- resourceKey: r
2444
+ resourceKey: n
2346
2445
  }) => {
2347
- const n = P(e), { showSnackbar: s } = $(), { addOperation: i, updateOperation: o } = cs(), a = _.useRef([]);
2348
- return _.useEffect(() => () => {
2446
+ const r = D(e), { showSnackbar: s } = L(), { addOperation: o, updateOperation: i } = cs(), a = S.useRef([]);
2447
+ return S.useEffect(() => () => {
2349
2448
  a.current.forEach((l) => l());
2350
- }, []), { startStreamAction: _.useCallback(
2351
- async ({ actionID: l, id: u, namespace: y, label: h, params: f = {} }) => {
2449
+ }, []), { startStreamAction: S.useCallback(
2450
+ async ({ actionID: l, id: c, namespace: g, label: f, params: d = {} }) => {
2352
2451
  try {
2353
- const m = await Or(
2354
- n,
2355
- t,
2452
+ const h = await Fn(
2356
2453
  r,
2454
+ t,
2455
+ n,
2357
2456
  l,
2358
- T.ActionInput.createFrom({ id: u, namespace: y, params: f })
2457
+ A.ActionInput.createFrom({ id: c, namespace: g, params: d })
2359
2458
  );
2360
- i({
2361
- id: m,
2362
- label: h,
2363
- resourceKey: r,
2364
- resourceName: u,
2365
- namespace: y,
2459
+ o({
2460
+ id: h,
2461
+ label: f,
2462
+ resourceKey: n,
2463
+ resourceName: c,
2464
+ namespace: g,
2366
2465
  connectionID: t,
2367
2466
  status: "running",
2368
2467
  startedAt: Date.now()
2369
2468
  });
2370
- const p = `action/stream/${m}`, S = A(p, (w) => {
2371
- var b, d, g, E;
2372
- switch (w.type) {
2469
+ const y = `action/stream/${h}`, m = x(y, (p) => {
2470
+ var E, _, C, F;
2471
+ switch (p.type) {
2373
2472
  case "progress": {
2374
- const C = w.data ?? {};
2375
- o(m, {
2376
- message: C.message,
2377
- progress: C.ready !== void 0 && C.desired !== void 0 ? { ready: C.ready, desired: C.desired } : void 0
2473
+ const b = p.data ?? {};
2474
+ i(h, {
2475
+ message: b.message,
2476
+ progress: b.ready !== void 0 && b.desired !== void 0 ? { ready: b.ready, desired: b.desired } : void 0
2378
2477
  });
2379
2478
  break;
2380
2479
  }
2381
2480
  case "complete":
2382
- o(m, {
2481
+ i(h, {
2383
2482
  status: "completed",
2384
- message: ((b = w.data) == null ? void 0 : b.message) ?? "Completed",
2483
+ message: ((E = p.data) == null ? void 0 : E.message) ?? "Completed",
2385
2484
  completedAt: Date.now()
2386
- }), s(((d = w.data) == null ? void 0 : d.message) ?? h + " completed", "success"), be(p);
2485
+ }), s(((_ = p.data) == null ? void 0 : _.message) ?? f + " completed", "success"), be(y);
2387
2486
  break;
2388
2487
  case "error":
2389
- o(m, {
2488
+ i(h, {
2390
2489
  status: "error",
2391
- message: ((g = w.data) == null ? void 0 : g.message) ?? "Failed",
2490
+ message: ((C = p.data) == null ? void 0 : C.message) ?? "Failed",
2392
2491
  completedAt: Date.now()
2393
- }), s(((E = w.data) == null ? void 0 : E.message) ?? h + " failed", "error"), be(p);
2492
+ }), s(((F = p.data) == null ? void 0 : F.message) ?? f + " failed", "error"), be(y);
2394
2493
  break;
2395
2494
  }
2396
2495
  });
2397
2496
  return a.current.push(() => {
2398
- S(), be(p);
2399
- }), m;
2400
- } catch (m) {
2401
- throw X(s, m, `Failed to start "${l}"`), m;
2497
+ m(), be(y);
2498
+ }), h;
2499
+ } catch (h) {
2500
+ throw Z(s, h, `Failed to start "${l}"`), h;
2402
2501
  }
2403
2502
  },
2404
- [n, t, r, i, o, s]
2503
+ [r, t, n, o, i, s]
2405
2504
  ) };
2406
2505
  }, ro = () => {
2407
- const e = _.useContext(Ct);
2506
+ const e = S.useContext(mt);
2408
2507
  if (!e)
2409
2508
  throw new Error("useSettings must be used within a SettingsProvider");
2410
2509
  return e;
2411
- }, no = ({ to: e, withinContext: t, ...r }) => {
2412
- const { meta: n } = Le();
2413
- n.id || console.error("Link used outside of a plugin context");
2414
- const s = `/_plugin/${n.id}${e.startsWith("/") ? "" : "/"}${e}`;
2415
- return _.useMemo(() => /* @__PURE__ */ F(Bt, { style: { textDecoration: "none", color: "inherit" }, ...r, to: s }), [r, s]);
2510
+ }, so = ({ to: e, withinContext: t, ...n }) => {
2511
+ const { pluginId: r } = $e();
2512
+ r || console.error("Link used outside of a plugin context");
2513
+ const s = `/_plugin/${r}${e.startsWith("/") ? "" : "/"}${e}`;
2514
+ return S.useMemo(() => /* @__PURE__ */ R(zt, { style: { textDecoration: "none", color: "inherit" }, ...n, to: s }), [n, s]);
2416
2515
  };
2417
- function so() {
2418
- const e = Yt(), t = Jt(), { meta: r } = Le();
2419
- r.id || console.error("usePluginRouter used outside of a plugin context");
2420
- const n = `/_plugin/${r.id}`, s = t.pathname.startsWith(n) ? t.pathname.slice(n.length) || "/" : t.pathname, i = (o, a) => {
2421
- const { ...c } = a ?? {};
2422
- o.startsWith("/") ? e(`${n}${o}`, c) : e(o, c);
2423
- };
2424
- return Ht(() => ({
2516
+ function oo() {
2517
+ const e = Qt(), t = Wt(), { pluginId: n } = $e();
2518
+ n || console.error("usePluginRouter used outside of a plugin context");
2519
+ const r = `/_plugin/${n}`, s = t.pathname.startsWith(r) ? t.pathname.slice(r.length) || "/" : t.pathname, o = U((i, a) => {
2520
+ const { ...u } = a ?? {};
2521
+ i.startsWith("/") ? e(`${r}${i}`, u) : e(i, u);
2522
+ }, [e, r]);
2523
+ return Kt(() => ({
2425
2524
  location: t,
2426
- navigate: i,
2525
+ navigate: o,
2427
2526
  pluginPath: s
2428
- }), [t.pathname]);
2429
- }
2430
- class oo {
2527
+ }), [t, o, s]);
2431
2528
  }
2432
2529
  class io {
2530
+ }
2531
+ class ao {
2433
2532
  constructor() {
2434
- M(this, "_extensions");
2533
+ k(this, "_extensions");
2435
2534
  /**
2436
2535
  * The root component to render for the application window.
2437
2536
  */
2438
- M(this, "root");
2537
+ k(this, "root");
2439
2538
  /**
2440
2539
  * Various pages to render under the root component. These can be navigated to using
2441
2540
  * the built-in navigation system both programatically and through Links.
@@ -2465,8 +2564,8 @@ class io {
2465
2564
  * ```
2466
2565
  *
2467
2566
  */
2468
- M(this, "pages");
2469
- M(this, "_routes");
2567
+ k(this, "pages");
2568
+ k(this, "_routes");
2470
2569
  }
2471
2570
  get extensions() {
2472
2571
  return this._extensions || [];
@@ -2488,9 +2587,9 @@ class io {
2488
2587
  */
2489
2588
  get Window() {
2490
2589
  if (!this._routes && this.root)
2491
- return /* @__PURE__ */ F(this.root, {});
2492
- const t = Vt(this._routes || []);
2493
- return /* @__PURE__ */ F(Xt, { router: t });
2590
+ return /* @__PURE__ */ R(this.root, {});
2591
+ const t = Bt(this._routes || []);
2592
+ return /* @__PURE__ */ R(Ht, { router: t });
2494
2593
  }
2495
2594
  /**
2496
2595
  * Register extension points for other plugins to extend the functionality
@@ -2513,83 +2612,95 @@ class io {
2513
2612
  /**
2514
2613
  * Adds a page to the plugin window. This page will be displayed under:
2515
2614
  */
2516
- withPage(t, r) {
2615
+ withPage(t, n) {
2517
2616
  return this.pages || (this.pages = {}), this.pages[t] ? (console.warn(
2518
2617
  "Cannot register page with the same name. Please use a different name."
2519
- ), this) : (this.pages[t] = r, this);
2618
+ ), this) : (this.pages[t] = n, this);
2520
2619
  }
2521
2620
  withRoutes(t) {
2522
2621
  return this._routes = t, this;
2523
2622
  }
2524
2623
  }
2525
2624
  var us = /* @__PURE__ */ ((e) => (e.MISSING_MANIFEST = "MISSING_MANIFEST", e.MISSING_PLUGIN = "MISSING_PLUGIN", e.MISSING_ENTRYPOINT = "MISSING_ENTRYPOINT", e))(us || {});
2625
+ const co = (e) => {
2626
+ const t = e.split("::");
2627
+ return t.length === 1 ? { group: "core", version: "", kind: t[0] } : {
2628
+ group: t[0] || "core",
2629
+ version: t[1] || "",
2630
+ kind: t[2] || t[0]
2631
+ };
2632
+ }, uo = (e) => !e || e === "core" ? "Core" : e.charAt(0).toUpperCase() + e.slice(1);
2526
2633
  export {
2527
- J as ALL_SESSIONS_KEY,
2528
- $r as BottomDrawerContext,
2529
- qr as ConfirmationModalContext,
2530
- xe as ErrorTypes,
2531
- Ds as ExtensionPointRegistry,
2532
- zr as ExtensionPointStore,
2533
- Ps as ExtensionProvider,
2534
- x as InformerResourceState,
2535
- Br as InformerSyncPolicy,
2536
- no as Link,
2537
- Et as OperationsContext,
2538
- Es as OperationsProvider,
2539
- $e as PluginContext,
2540
- ws as PluginContextProvider,
2634
+ X as ALL_SESSIONS_KEY,
2635
+ Ln as BottomDrawerContext,
2636
+ Un as ConfirmationModalContext,
2637
+ M as ErrorTypes,
2638
+ Ps as ExtensionPointRegistry,
2639
+ Qn as ExtensionPointStore,
2640
+ Ds as ExtensionProvider,
2641
+ so as Link,
2642
+ _t as OperationsContext,
2643
+ Cs as OperationsProvider,
2644
+ Le as PluginContext,
2645
+ Es as PluginContextProvider,
2541
2646
  us as PluginErrorCode,
2542
- io as PluginWindow,
2543
- oo as PluginWindowRootProps,
2544
- Lr as RightDrawerContext,
2545
- Ct as SettingsContext,
2546
- Cs as SettingsProvider,
2547
- Fs as SnackbarProvider,
2548
- kr as actionToSnackbar,
2549
- Hr as connectionListQueryKey,
2647
+ ao as PluginWindow,
2648
+ io as PluginWindowRootProps,
2649
+ $n as RightDrawerContext,
2650
+ mt as SettingsContext,
2651
+ ws as SettingsProvider,
2652
+ Rs as SnackbarProvider,
2653
+ xs as SyncPolicy,
2654
+ w as WatchState,
2655
+ kn as actionToSnackbar,
2656
+ is as applyBatch,
2657
+ Bn as connectionListQueryKey,
2550
2658
  I as createErrorHandler,
2551
- Mr as defaultState,
2552
- wt as isCancelledError,
2553
- U as parseAppError,
2554
- X as showAppError,
2555
- eo as useActiveSyncs,
2556
- At as useBottomDrawer,
2557
- Us as useConfirmationModal,
2558
- xs as useConnection,
2659
+ Mn as defaultState,
2660
+ uo as formatGroup,
2661
+ ht as isCancelledError,
2662
+ K as parseAppError,
2663
+ co as parseResourceKey,
2664
+ Z as showAppError,
2665
+ to as useActiveSyncs,
2666
+ Pt as useBottomDrawer,
2667
+ Gs as useConfirmationModal,
2668
+ Is as useConnection,
2559
2669
  Os as useConnectionNamespaces,
2560
2670
  As as useConnectionStatus,
2561
- Is as useConnections,
2562
- Xs as useEditorSchemas,
2563
- Rs as useExec,
2564
- Vs as useExecuteAction,
2671
+ Fs as useConnections,
2672
+ Zs as useEditorSchemas,
2673
+ as as useEventBatcher,
2674
+ ks as useExec,
2675
+ Xs as useExecuteAction,
2565
2676
  bs as useExtensionPoint,
2566
2677
  vs as useExtensionPointComponents,
2567
- Pt as useExtensionRegistry,
2568
- Zs as useInformerState,
2569
- ks as useLogs,
2570
- Ms as useMetricProviders,
2571
- Vr as useMetricProvidersForResource,
2572
- Ls as useMetricStream,
2678
+ wt as useExtensionRegistry,
2679
+ Ms as useLogs,
2680
+ Ls as useMetricProviders,
2681
+ Jn as useMetricProvidersForResource,
2682
+ Us as useMetricStream,
2573
2683
  cs as useOperations,
2574
- Le as usePluginContext,
2684
+ $e as usePluginContext,
2575
2685
  Ts as usePluginData,
2576
- so as usePluginRouter,
2686
+ oo as usePluginRouter,
2577
2687
  Ss as usePluginSettings,
2578
2688
  qs as usePortForwardSessions,
2579
- P as useResolvedPluginId,
2689
+ D as useResolvedPluginId,
2580
2690
  Ks as useResource,
2581
- Js as useResourceActions,
2582
- Qs as useResourceAreaComponent,
2583
- js as useResourceGroups,
2691
+ Vs as useResourceActions,
2692
+ zs as useResourceAreaComponent,
2693
+ Qs as useResourceGroups,
2584
2694
  $s as useResourceMetrics,
2585
- Ys as useResourceMutations,
2586
- Gs as useResourcePortForwarder,
2587
- zs as useResourceSearch,
2588
- Ws as useResourceType,
2695
+ Js as useResourceMutations,
2696
+ js as useResourcePortForwarder,
2697
+ Ws as useResourceSearch,
2698
+ Bs as useResourceType,
2589
2699
  Hs as useResourceTypes,
2590
- Bs as useResources,
2700
+ Ys as useResources,
2591
2701
  Ns as useRightDrawer,
2592
2702
  ro as useSettings,
2593
- $ as useSnackbar,
2594
- to as useStreamAction
2703
+ L as useSnackbar,
2704
+ no as useStreamAction,
2705
+ eo as useWatchState
2595
2706
  };