@omniviewdev/runtime 0.6.0 → 0.7.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.
package/dist/index.js CHANGED
@@ -1,17 +1,17 @@
1
- var ft = Object.defineProperty;
2
- var pt = (t, e, n) => e in t ? ft(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var P = (t, e, n) => pt(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { jsx as x, jsxs as Z } from "react/jsx-runtime";
5
- import _, { useContext as Y, createContext as ie, useState as j, useRef as k, useCallback as U, useSyncExternalStore as gt, useEffect as W, useMemo as yt } from "react";
6
- import { Link as ht, useNavigate as mt, useLocation as Et, createMemoryRouter as St, RouterProvider as _t } from "react-router-dom";
1
+ var pt = Object.defineProperty;
2
+ var gt = (t, e, n) => e in t ? pt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var x = (t, e, n) => gt(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import { jsx as A, jsxs as H } from "react/jsx-runtime";
5
+ import C, { useContext as J, createContext as ae, useState as j, useRef as M, useCallback as U, useSyncExternalStore as ht, useEffect as W, useMemo as yt } from "react";
6
+ import { Link as mt, useNavigate as Et, useLocation as St, createMemoryRouter as _t, RouterProvider as Ct } from "react-router-dom";
7
7
  import "./index-D2mKAO8s.js";
8
- import { P as Ct, G as wt, V as bt, S as vt, a as xe, U as Rt, R as It, b as Ot, c as Le, d as At, L as Ft, e as Tt, f as Dt, g as Nt, h as Pt, i as xt, j as Lt, C as Ut, k as qt, l as Mt, m as kt, n as $t, Q as Wt, o as Gt, p as Ie, q as jt, r as Ue, F as Qt, s as Kt, t as qe, D as Me, u as Bt, v as Ht, w as zt, x as ke, y as Vt, z as Yt, A as $e, B as Jt, E as Xt, H as Zt, I as en, J as tn, K as nn, M as Oe, N as rn, O as sn, T as on, W as an, X as cn } from "./graphservice-BKFw5MxQ.js";
9
- import { P as un, W as ln, S as dn, C as fn, L as pn, F as gn, a as yn, U as We, D as Ge, G as hn, b as je, c as Qe, A as Ke } from "./models-D-vu7j83.js";
10
- import { O as T, a as Be } from "./events-Bcx6NsMp.js";
11
- import { useQueryClient as K, useMutation as N, useQuery as D, keepPreviousData as He, useQueries as mn } from "@tanstack/react-query";
12
- import { useToast as En } from "@omniviewdev/base-ui";
13
- import { w as Sn } from "./legacyEnum-DORXlU_y.js";
14
- const Ee = _.createContext(void 0), F = {
8
+ import { P as wt, G as vt, V as bt, S as Rt, a as Le, U as It, R as Ot, b as At, c as Ue, d as Tt, L as Ft, e as Dt, f as Nt, g as Pt, h as xt, i as Lt, j as Ut, C as kt, k as qt, l as Mt, m as $t, n as Wt, Q as Gt, o as jt, p as Oe, q as Qt, r as ke, F as Kt, s as Ht, t as qe, D as Me, u as Bt, v as zt, w as Vt, x as $e, y as Yt, z as Jt, A as We, B as Xt, E as Zt, H as en, I as tn, J as nn, K as rn, M as Ae, N as sn, O as on, T as an, W as cn, X as un } from "./graphservice-CUg1PUsC.js";
9
+ import { P as ln, W as dn, S as fn, C as pn, L as gn, F as hn, a as yn, U as Ge, D as je, G as mn, b as Qe, c as Ke, A as He } from "./models-4EtitZnM.js";
10
+ import { O as D, a as Be } from "./events-Bcx6NsMp.js";
11
+ import { useQueryClient as K, useMutation as P, useQuery as N, keepPreviousData as ze, useQueries as En } from "@tanstack/react-query";
12
+ import { useToast as Sn, Button as ee } from "@omniviewdev/base-ui";
13
+ import { w as _n } from "./legacyEnum-DORXlU_y.js";
14
+ const Se = C.createContext(void 0), F = {
15
15
  // Plugin
16
16
  PLUGIN_NOT_FOUND: "omniview:plugin/not-found",
17
17
  PLUGIN_NOT_LOADED: "omniview:plugin/not-loaded",
@@ -46,7 +46,7 @@ const Ee = _.createContext(void 0), F = {
46
46
  INTERNAL: "omniview:internal",
47
47
  VALIDATION: "omniview:validation",
48
48
  NOT_IMPLEMENTED: "omniview:not-implemented"
49
- }, Ae = {
49
+ }, Te = {
50
50
  INVALID_REQUEST: [F.VALIDATION, 400, "correctRequest"],
51
51
  UNSUPPORTED: [F.NOT_IMPLEMENTED, 501, "refreshContract"],
52
52
  FORBIDDEN: [F.RESOURCE_FORBIDDEN, 403, "none"],
@@ -66,43 +66,43 @@ const Ee = _.createContext(void 0), F = {
66
66
  PROVIDER_ERROR: [F.RESOURCE_PROVIDER_ERROR, 502, "none"],
67
67
  INTERNAL: [F.INTERNAL, 500, "none"]
68
68
  };
69
- function le(t) {
69
+ function de(t) {
70
70
  return typeof t == "object" && t !== null ? t : void 0;
71
71
  }
72
72
  function $(t, e) {
73
73
  return typeof t == "string" && t.length > 0 && t.length <= e;
74
74
  }
75
- function de() {
75
+ function fe() {
76
76
  return { type: F.CANCELLED, code: "CANCELLED", title: "Cancelled", status: 499, detail: "The operation was cancelled.", recovery: "none" };
77
77
  }
78
- function re(t, e) {
78
+ function se(t, e) {
79
79
  if (e > 4) return;
80
- if (t === "cancelled") return de();
80
+ if (t === "cancelled") return fe();
81
81
  if (typeof t == "string") {
82
82
  const r = t.trim();
83
83
  if (!r.startsWith("{")) return;
84
84
  try {
85
- return re(JSON.parse(r), e + 1);
85
+ return se(JSON.parse(r), e + 1);
86
86
  } catch {
87
87
  return;
88
88
  }
89
89
  }
90
- const n = le(t);
90
+ const n = de(t);
91
91
  if (n) {
92
- if (n.name === "AbortError" || n.name === "CancelError") return de();
92
+ if (n.name === "AbortError" || n.name === "CancelError") return fe();
93
93
  if ($(n.type, 256) && $(n.title, 256) && typeof n.status == "number" && Number.isInteger(n.status) && n.status >= 100 && n.status <= 599 && typeof n.detail == "string" && n.detail.length <= 4096) {
94
94
  const r = { type: n.type, title: n.title, status: n.status, detail: n.detail };
95
95
  $(n.code, 64) && (r.code = n.code), $(n.requestId, 256) && (r.requestId = n.requestId), $(n.instance, 512) && (r.instance = n.instance), Array.isArray(n.suggestions) && (r.suggestions = n.suggestions.filter((i) => $(i, 512)).slice(0, 8)), Array.isArray(n.actions) && (r.actions = n.actions.filter((i) => {
96
- const o = le(i);
96
+ const o = de(i);
97
97
  return !!o && ["navigate", "retry", "open-url", "copy"].includes(String(o.type)) && $(o.label, 256) && (o.target === void 0 || $(o.target, 4096));
98
98
  }).slice(0, 8)), ["correctRequest", "refreshContract", "restartQuery", "reconnect", "none"].includes(String(n.recovery)) && (r.recovery = n.recovery);
99
- const s = le(n.location);
99
+ const s = de(n.location);
100
100
  return (s == null ? void 0 : s.unit) === "utf8-byte" && typeof s.start == "number" && typeof s.end == "number" && Number.isSafeInteger(s.start) && Number.isSafeInteger(s.end) && s.start >= 0 && s.end >= s.start && (r.location = { start: s.start, end: s.end, unit: "utf8-byte" }), r;
101
101
  }
102
102
  if (typeof n.code == "string" && typeof n.title == "string" && typeof n.message == "string") {
103
103
  let r = n.code;
104
- if (r === "PERMISSION_DENIED" && (r = "FORBIDDEN"), ["INVALID_INPUT", "FILTER_UNKNOWN_FIELD", "FILTER_INVALID_OPERATOR"].includes(r) && (r = "INVALID_REQUEST"), Object.prototype.hasOwnProperty.call(Ae, r) || (r = "INTERNAL"), r === "CANCELLED") return de();
105
- const [s, i, o] = Ae[r], a = r === "FORBIDDEN" || r === "UNAUTHORIZED" || r === "INTERNAL" || r === "PROVIDER_ERROR";
104
+ if (r === "PERMISSION_DENIED" && (r = "FORBIDDEN"), ["INVALID_INPUT", "FILTER_UNKNOWN_FIELD", "FILTER_INVALID_OPERATOR"].includes(r) && (r = "INVALID_REQUEST"), Object.prototype.hasOwnProperty.call(Te, r) || (r = "INTERNAL"), r === "CANCELLED") return fe();
105
+ const [s, i, o] = Te[r], a = r === "FORBIDDEN" || r === "UNAUTHORIZED" || r === "INTERNAL" || r === "PROVIDER_ERROR";
106
106
  return {
107
107
  type: s,
108
108
  status: i,
@@ -113,21 +113,21 @@ function re(t, e) {
113
113
  ...!a && Array.isArray(n.suggestions) ? { suggestions: n.suggestions.filter((c) => $(c, 512)).slice(0, 8) } : {}
114
114
  };
115
115
  }
116
- return re(n.message, e + 1) ?? re(n.cause, e + 1);
116
+ return se(n.message, e + 1) ?? se(n.cause, e + 1);
117
117
  }
118
118
  }
119
119
  function Q(t) {
120
- return re(t, 0) ?? {
120
+ return se(t, 0) ?? {
121
121
  type: F.INTERNAL,
122
122
  title: t == null ? "Unknown error" : "Error",
123
123
  status: 500,
124
124
  detail: t == null ? "An unknown error occurred." : "The operation could not be completed."
125
125
  };
126
126
  }
127
- function se(t) {
127
+ function oe(t) {
128
128
  return Q(t).type === F.CANCELLED;
129
129
  }
130
- function _n(t) {
130
+ function Cn(t) {
131
131
  switch (t.type) {
132
132
  case "navigate":
133
133
  return {
@@ -164,7 +164,7 @@ function _n(t) {
164
164
  };
165
165
  }
166
166
  }
167
- function ze(t, e) {
167
+ function Ve(t, e) {
168
168
  var s, i;
169
169
  const n = [
170
170
  t.detail,
@@ -175,73 +175,73 @@ function ze(t, e) {
175
175
  message: e || (t.title !== "Error" ? t.title : "Operation failed"),
176
176
  status: "error",
177
177
  details: n,
178
- actions: (i = t.actions) == null ? void 0 : i.map(_n)
178
+ actions: (i = t.actions) == null ? void 0 : i.map(Cn)
179
179
  };
180
180
  }
181
181
  function B(t, e, n) {
182
- if (se(e)) return;
182
+ if (oe(e)) return;
183
183
  const r = Q(e);
184
- t(ze(r, n));
184
+ t(Ve(r, n));
185
185
  }
186
- function q(t, e) {
186
+ function k(t, e) {
187
187
  return (n) => {
188
- if (se(n)) return;
188
+ if (oe(n)) return;
189
189
  const r = Q(n);
190
- t(ze(r, r.title !== "Error" ? r.title : e));
190
+ t(Ve(r, r.title !== "Error" ? r.title : e));
191
191
  };
192
192
  }
193
- function Zr(t) {
194
- const { children: e, pluginId: n } = t, [r, s] = _.useState({}), [i, o] = _.useState(new un()), [a, c] = _.useState(!1), [l, u] = _.useState(null), d = _.useRef(0), f = _.useRef(0);
193
+ function es(t) {
194
+ const { children: e, pluginId: n } = t, [r, s] = C.useState({}), [i, o] = C.useState(new ln()), [a, c] = C.useState(!1), [l, u] = C.useState(null), d = C.useRef(0), g = C.useRef(0);
195
195
  console.debug("[PluginContextProvider] render", { pluginId: n, metaLoaded: a, metaError: !!l });
196
- const p = _.useCallback(() => {
196
+ const h = C.useCallback(() => {
197
197
  if (n === void 0 || n === "")
198
198
  return;
199
- const E = ++d.current;
200
- console.debug(`[PluginContextProvider] fetching settings for "${n}"`), Ct(n).then((g) => {
201
- E === d.current && (console.debug(`[PluginContextProvider] settings loaded for "${n}"`, Object.keys(g)), s(g));
202
- }).catch((g) => {
203
- if (E !== d.current) return;
204
- const y = Q(g);
205
- console.error(`[PluginContextProvider] error fetching settings for "${n}":`, y.detail);
199
+ const y = ++d.current;
200
+ console.debug(`[PluginContextProvider] fetching settings for "${n}"`), wt(n).then((f) => {
201
+ y === d.current && (console.debug(`[PluginContextProvider] settings loaded for "${n}"`, Object.keys(f)), s(f));
202
+ }).catch((f) => {
203
+ if (y !== d.current) return;
204
+ const p = Q(f);
205
+ console.error(`[PluginContextProvider] error fetching settings for "${n}":`, p.detail);
206
206
  });
207
- }, [n]), h = _.useCallback(() => {
207
+ }, [n]), E = C.useCallback(() => {
208
208
  if (n === void 0 || n === "") {
209
209
  console.debug("[PluginContextProvider] skipping meta fetch — empty pluginId");
210
210
  return;
211
211
  }
212
- const E = ++f.current;
213
- console.debug(`[PluginContextProvider] fetching meta for "${n}"`), u(null), wt(n).then((g) => {
214
- E === f.current && (console.debug(`[PluginContextProvider] meta loaded for "${n}"`, { name: g == null ? void 0 : g.name, version: g == null ? void 0 : g.version }), o(g), c(!0));
215
- }).catch((g) => {
216
- if (E !== f.current) return;
217
- const y = Q(g);
218
- console.error(`[PluginContextProvider] error fetching meta for "${n}":`, y.detail), u(y.detail), c(!1);
212
+ const y = ++g.current;
213
+ console.debug(`[PluginContextProvider] fetching meta for "${n}"`), u(null), vt(n).then((f) => {
214
+ y === g.current && (console.debug(`[PluginContextProvider] meta loaded for "${n}"`, { name: f == null ? void 0 : f.name, version: f == null ? void 0 : f.version }), o(f), c(!0));
215
+ }).catch((f) => {
216
+ if (y !== g.current) return;
217
+ const p = Q(f);
218
+ console.error(`[PluginContextProvider] error fetching meta for "${n}":`, p.detail), u(p.detail), c(!1);
219
219
  });
220
220
  }, [n]);
221
- return _.useEffect(() => {
221
+ return C.useEffect(() => {
222
222
  if (a) return;
223
- const E = () => {
224
- p(), h();
225
- }, g = [
226
- T("plugin/init_complete", E),
227
- T("plugin/dev_install_complete", (y) => {
223
+ const y = () => {
224
+ h(), E();
225
+ }, f = [
226
+ D("plugin/init_complete", y),
227
+ D("plugin/dev_install_complete", (p) => {
228
228
  var w;
229
- ((w = y.data) == null ? void 0 : w.id) === n && E();
229
+ ((w = p.data) == null ? void 0 : w.id) === n && y();
230
230
  }),
231
- T("plugin/inventory_changed", E)
231
+ D("plugin/inventory_changed", y)
232
232
  ];
233
233
  return () => {
234
- for (const y of g) y();
234
+ for (const p of f) p();
235
235
  };
236
- }, [n, a, p, h]), _.useEffect(() => (console.debug(`[PluginContextProvider] useEffect — pluginId changed to "${n}"`), c(!1), u(null), s({}), p(), h(), () => {
237
- ++d.current, ++f.current;
238
- }), [n, p, h]), l ? /* @__PURE__ */ x("div", { style: {
236
+ }, [n, a, h, E]), C.useEffect(() => (console.debug(`[PluginContextProvider] useEffect — pluginId changed to "${n}"`), c(!1), u(null), s({}), h(), E(), () => {
237
+ ++d.current, ++g.current;
238
+ }), [n, h, E]), l ? /* @__PURE__ */ A("div", { style: {
239
239
  display: "flex",
240
240
  flex: 1,
241
241
  alignItems: "center",
242
242
  justifyContent: "center",
243
243
  padding: 24
244
- }, children: /* @__PURE__ */ Z("div", { style: {
244
+ }, children: /* @__PURE__ */ H("div", { style: {
245
245
  maxWidth: 480,
246
246
  width: "100%",
247
247
  border: "1px solid #7F1D1D",
@@ -250,19 +250,19 @@ function Zr(t) {
250
250
  padding: 20,
251
251
  fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
252
252
  }, children: [
253
- /* @__PURE__ */ Z("div", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 12 }, children: [
254
- /* @__PURE__ */ Z("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "#EF4444", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
255
- /* @__PURE__ */ x("circle", { cx: "12", cy: "12", r: "10" }),
256
- /* @__PURE__ */ x("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
257
- /* @__PURE__ */ x("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
253
+ /* @__PURE__ */ H("div", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 12 }, children: [
254
+ /* @__PURE__ */ H("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "#EF4444", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
255
+ /* @__PURE__ */ A("circle", { cx: "12", cy: "12", r: "10" }),
256
+ /* @__PURE__ */ A("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
257
+ /* @__PURE__ */ A("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
258
258
  ] }),
259
- /* @__PURE__ */ x("span", { style: { fontSize: 14, fontWeight: 600, color: "#FECACA" }, children: "Plugin failed to load" })
259
+ /* @__PURE__ */ A("span", { style: { fontSize: 14, fontWeight: 600, color: "#FECACA" }, children: "Plugin failed to load" })
260
260
  ] }),
261
- /* @__PURE__ */ x("p", { style: { fontSize: 13, color: "#A1A1AA", margin: "0 0 16px" }, children: l }),
262
- /* @__PURE__ */ x(
261
+ /* @__PURE__ */ A("p", { style: { fontSize: 13, color: "#A1A1AA", margin: "0 0 16px" }, children: l }),
262
+ /* @__PURE__ */ A(
263
263
  "button",
264
264
  {
265
- onClick: () => h(),
265
+ onClick: () => E(),
266
266
  style: {
267
267
  background: "transparent",
268
268
  color: "#F87171",
@@ -276,13 +276,13 @@ function Zr(t) {
276
276
  children: "Retry"
277
277
  }
278
278
  )
279
- ] }) }) : a ? /* @__PURE__ */ x(Ee.Provider, { value: { pluginId: n, settings: r, meta: i }, children: e }) : /* @__PURE__ */ Z("div", { style: {
279
+ ] }) }) : a ? /* @__PURE__ */ A(Se.Provider, { value: { pluginId: n, settings: r, meta: i }, children: e }) : /* @__PURE__ */ H("div", { style: {
280
280
  display: "flex",
281
281
  flex: 1,
282
282
  alignItems: "center",
283
283
  justifyContent: "center"
284
284
  }, children: [
285
- /* @__PURE__ */ x("div", { style: {
285
+ /* @__PURE__ */ A("div", { style: {
286
286
  width: 24,
287
287
  height: 24,
288
288
  border: "2px solid #3F3F46",
@@ -290,20 +290,20 @@ function Zr(t) {
290
290
  borderRadius: "50%",
291
291
  animation: "plugin-spin 0.8s linear infinite"
292
292
  } }),
293
- /* @__PURE__ */ x("style", { children: "@keyframes plugin-spin { to { transform: rotate(360deg); } }" })
293
+ /* @__PURE__ */ A("style", { children: "@keyframes plugin-spin { to { transform: rotate(360deg); } }" })
294
294
  ] });
295
295
  }
296
- function Se() {
297
- const t = Y(Ee);
296
+ function _e() {
297
+ const t = J(Se);
298
298
  if (!t)
299
299
  throw new Error("usePluginContext must be used within a PluginContextProvider");
300
300
  return t;
301
301
  }
302
- function es() {
303
- return Se().settings;
302
+ function ts() {
303
+ return _e().settings;
304
304
  }
305
- const Ve = ie(void 0), ts = ({ children: t }) => {
306
- const [e, n] = j({}), r = k(0), s = U(() => {
305
+ const Ye = ae(void 0), ns = ({ children: t }) => {
306
+ const [e, n] = j({}), r = M(0), s = U(() => {
307
307
  const o = r.current + 1;
308
308
  r.current = o, bt().then((a) => {
309
309
  o === r.current && n(a);
@@ -311,8 +311,8 @@ const Ve = ie(void 0), ts = ({ children: t }) => {
311
311
  o === r.current && console.error("Error fetching settings:", a);
312
312
  });
313
313
  }, []);
314
- _.useEffect(() => {
315
- const o = T("settings/changed", () => s());
314
+ C.useEffect(() => {
315
+ const o = D("settings/changed", () => s());
316
316
  return s(), () => {
317
317
  r.current += 1, o();
318
318
  };
@@ -320,8 +320,8 @@ const Ve = ie(void 0), ts = ({ children: t }) => {
320
320
  const i = U(() => {
321
321
  s();
322
322
  }, [s]);
323
- return /* @__PURE__ */ x(Ve.Provider, { value: { settings: e, reload: i }, children: t });
324
- }, Cn = {
323
+ return /* @__PURE__ */ A(Ye.Provider, { value: { settings: e, reload: i }, children: t });
324
+ }, wn = {
325
325
  height: 32,
326
326
  focused: 0,
327
327
  tabs: [],
@@ -345,30 +345,30 @@ const Ve = ie(void 0), ts = ({ children: t }) => {
345
345
  },
346
346
  fullscreenDrawer: () => {
347
347
  }
348
- }, wn = _.createContext(Cn), bn = ie(void 0), vn = _.createContext(void 0), Ye = _.createContext(void 0), Rn = 3e4, ns = ({ children: t }) => {
349
- const [e, n] = _.useState([]), r = _.useCallback((a) => {
348
+ }, vn = C.createContext(wn), bn = ae(void 0), Rn = C.createContext(void 0), Je = C.createContext(void 0), In = 3e4, rs = ({ children: t }) => {
349
+ const [e, n] = C.useState([]), r = C.useCallback((a) => {
350
350
  n((c) => [a, ...c]);
351
- }, []), s = _.useCallback((a, c) => {
351
+ }, []), s = C.useCallback((a, c) => {
352
352
  n(
353
353
  (l) => l.map((u) => u.id === a ? { ...u, ...c } : u)
354
354
  );
355
- }, []), i = _.useCallback((a) => {
355
+ }, []), i = C.useCallback((a) => {
356
356
  n((c) => c.filter((l) => l.id !== a));
357
357
  }, []);
358
- _.useEffect(() => {
358
+ C.useEffect(() => {
359
359
  const a = [];
360
360
  for (const c of e)
361
361
  if (c.status !== "running") {
362
- const l = Date.now() - (c.completedAt ?? c.startedAt), u = Math.max(0, Rn - l);
362
+ const l = Date.now() - (c.completedAt ?? c.startedAt), u = Math.max(0, In - l);
363
363
  a.push(setTimeout(() => i(c.id), u));
364
364
  }
365
365
  return () => a.forEach(clearTimeout);
366
366
  }, [e, i]);
367
- const o = _.useMemo(
367
+ const o = C.useMemo(
368
368
  () => ({ operations: e, addOperation: r, updateOperation: s, removeOperation: i }),
369
369
  [e, r, s, i]
370
370
  );
371
- return /* @__PURE__ */ x(Ye.Provider, { value: o, children: t });
371
+ return /* @__PURE__ */ A(Je.Provider, { value: o, children: t });
372
372
  };
373
373
  var ye = function(t, e) {
374
374
  return ye = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
@@ -377,7 +377,7 @@ var ye = function(t, e) {
377
377
  for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (n[s] = r[s]);
378
378
  }, ye(t, e);
379
379
  };
380
- function In(t, e) {
380
+ function On(t, e) {
381
381
  if (typeof e != "function" && e !== null)
382
382
  throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
383
383
  ye(t, e);
@@ -386,39 +386,39 @@ function In(t, e) {
386
386
  }
387
387
  t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
388
388
  }
389
- var fe = "Invariant Violation", Fe = Object.setPrototypeOf, On = Fe === void 0 ? function(t, e) {
389
+ var pe = "Invariant Violation", Fe = Object.setPrototypeOf, An = Fe === void 0 ? function(t, e) {
390
390
  return t.__proto__ = e, t;
391
- } : Fe, An = (
391
+ } : Fe, Tn = (
392
392
  /** @class */
393
393
  function(t) {
394
- In(e, t);
394
+ On(e, t);
395
395
  function e(n) {
396
- n === void 0 && (n = fe);
397
- var r = t.call(this, typeof n == "number" ? fe + ": " + n + " (see https://github.com/apollographql/invariant-packages)" : n) || this;
398
- return r.framesToPop = 1, r.name = fe, On(r, e.prototype), r;
396
+ n === void 0 && (n = pe);
397
+ var r = t.call(this, typeof n == "number" ? pe + ": " + n + " (see https://github.com/apollographql/invariant-packages)" : n) || this;
398
+ return r.framesToPop = 1, r.name = pe, An(r, e.prototype), r;
399
399
  }
400
400
  return e;
401
401
  }(Error)
402
402
  );
403
- function he(t, e) {
403
+ function me(t, e) {
404
404
  if (!t)
405
- throw new An(e);
405
+ throw new Tn(e);
406
406
  }
407
- var Je = ["debug", "log", "warn", "error", "silent"], Fn = Je.indexOf("log");
408
- function ee(t) {
407
+ var Xe = ["debug", "log", "warn", "error", "silent"], Fn = Xe.indexOf("log");
408
+ function te(t) {
409
409
  return function() {
410
- if (Je.indexOf(t) >= Fn) {
410
+ if (Xe.indexOf(t) >= Fn) {
411
411
  var e = console[t] || console.log;
412
412
  return e.apply(console, arguments);
413
413
  }
414
414
  };
415
415
  }
416
416
  (function(t) {
417
- t.debug = ee("debug"), t.log = ee("log"), t.warn = ee("warn"), t.error = ee("error");
418
- })(he || (he = {}));
419
- const Xe = ie(void 0), Tn = () => Y(Xe);
420
- function rs(t) {
421
- const e = Tn(), n = _.useRef(null), r = e == null ? void 0 : e.getExtensionPoint(t), s = U(
417
+ t.debug = te("debug"), t.log = te("log"), t.warn = te("warn"), t.error = te("error");
418
+ })(me || (me = {}));
419
+ const Ze = ae(void 0), Dn = () => J(Ze);
420
+ function ss(t) {
421
+ const e = Dn(), n = C.useRef(null), r = e == null ? void 0 : e.getExtensionPoint(t), s = U(
422
422
  (o) => {
423
423
  const a = [];
424
424
  return e && a.push(e.subscribe(o)), r && a.push(r.subscribe(o)), () => {
@@ -441,30 +441,30 @@ function rs(t) {
441
441
  const c = {};
442
442
  return n.current = { store: o, version: o.version, sentinel: c }, c;
443
443
  }, [e, t]);
444
- return gt(s, i), e == null ? void 0 : e.getExtensionPoint(t);
444
+ return ht(s, i), e == null ? void 0 : e.getExtensionPoint(t);
445
445
  }
446
- const ss = ({ registry: t, children: e }) => {
447
- const n = _.useRef(t);
448
- return he(
446
+ const os = ({ registry: t, children: e }) => {
447
+ const n = C.useRef(t);
448
+ return me(
449
449
  n.current === t,
450
450
  "You can't change the extension registry after it has been rendered"
451
- ), /* @__PURE__ */ x(Xe.Provider, { value: n.current, children: e });
452
- }, pe = (t) => {
451
+ ), /* @__PURE__ */ A(Ze.Provider, { value: n.current, children: e });
452
+ }, ge = (t) => {
453
453
  if (!t || typeof t != "string")
454
454
  throw new TypeError(`extensionName is required to be a string and can't be: "${t}" (${typeof t})`);
455
455
  return t.trim();
456
456
  };
457
- class Dn {
457
+ class Nn {
458
458
  constructor(e) {
459
- P(this, "id");
460
- P(this, "mode");
461
- P(this, "_pluginId");
462
- P(this, "_version", 0);
463
- P(this, "_contributions", /* @__PURE__ */ new Map());
464
- P(this, "_lookupCache", /* @__PURE__ */ new Map());
465
- P(this, "_matcher");
466
- P(this, "_select");
467
- P(this, "_listeners", /* @__PURE__ */ new Set());
459
+ x(this, "id");
460
+ x(this, "mode");
461
+ x(this, "_pluginId");
462
+ x(this, "_version", 0);
463
+ x(this, "_contributions", /* @__PURE__ */ new Map());
464
+ x(this, "_lookupCache", /* @__PURE__ */ new Map());
465
+ x(this, "_matcher");
466
+ x(this, "_select");
467
+ x(this, "_listeners", /* @__PURE__ */ new Set());
468
468
  this.id = e.id, this.mode = e.mode ?? "multiple", this._pluginId = e.pluginId, this._matcher = e.matcher, this._select = e.select;
469
469
  }
470
470
  get pluginId() {
@@ -574,11 +574,11 @@ class Dn {
574
574
  e();
575
575
  }
576
576
  }
577
- class os {
577
+ class is {
578
578
  constructor(e) {
579
- P(this, "_stores", /* @__PURE__ */ new Map());
580
- P(this, "_storeUnsubs", /* @__PURE__ */ new Map());
581
- P(this, "_listeners", /* @__PURE__ */ new Set());
579
+ x(this, "_stores", /* @__PURE__ */ new Map());
580
+ x(this, "_storeUnsubs", /* @__PURE__ */ new Map());
581
+ x(this, "_listeners", /* @__PURE__ */ new Set());
582
582
  if (e != null && e.initialStores)
583
583
  for (const n of e.initialStores)
584
584
  this.addExtensionPoint(n);
@@ -588,28 +588,28 @@ class os {
588
588
  * Throws if the extension point ID already exists.
589
589
  */
590
590
  addExtensionPoint(e) {
591
- const n = pe(e.id);
591
+ const n = ge(e.id);
592
592
  if (this._stores.has(n)) {
593
593
  const s = this._stores.get(n);
594
594
  throw new Error(
595
595
  `Extension point "${n}" already exists (owned by "${s.pluginId ?? "unknown"}")`
596
596
  );
597
597
  }
598
- const r = new Dn({ ...e, id: n });
598
+ const r = new Nn({ ...e, id: n });
599
599
  this._stores.set(n, r), this._storeUnsubs.set(n, r.subscribe(() => this._notify())), this._notify();
600
600
  }
601
601
  /**
602
602
  * Get an extension point store by ID.
603
603
  */
604
604
  getExtensionPoint(e) {
605
- const n = pe(e);
605
+ const n = ge(e);
606
606
  return this._stores.get(n);
607
607
  }
608
608
  /**
609
609
  * Check if an extension point exists.
610
610
  */
611
611
  hasExtensionPoint(e) {
612
- const n = pe(e);
612
+ const n = ge(e);
613
613
  return this._stores.has(n);
614
614
  }
615
615
  /**
@@ -650,90 +650,151 @@ class os {
650
650
  e();
651
651
  }
652
652
  }
653
- const Ze = ie(void 0), Nn = {
653
+ const et = ae(void 0), Pn = {
654
654
  default: "info",
655
655
  info: "info",
656
656
  success: "success",
657
657
  warning: "warning",
658
658
  error: "danger"
659
- }, is = ({ children: t }) => {
660
- const { toast: e } = En(), [n, r] = _.useState([]), s = (o) => {
661
- r((a) => [...a, o]);
662
- }, i = (o, a, c) => {
663
- const l = typeof o == "object";
664
- let u = "", d = "info", f, p = 5e3, h;
665
- if (l) {
666
- if (u = o.message, o.showOnce) {
667
- if (n.includes(u))
659
+ }, as = ({ children: t }) => {
660
+ const { toast: e } = Sn(), [n, r] = C.useState([]), [s, i] = C.useState([]), [o, a] = C.useState(!1), [c, l] = C.useState(), [u, d] = C.useState(""), g = C.useRef(Date.now()), h = (y) => {
661
+ r((f) => [...f, y]);
662
+ }, E = (y, f, p) => {
663
+ const w = typeof y == "object";
664
+ let m = "", v = "info", b, S = 5e3, _;
665
+ if (w) {
666
+ if (m = y.message, y.showOnce) {
667
+ if (n.includes(m))
668
668
  return;
669
- s(u);
669
+ h(m);
670
670
  }
671
- d = o.status, f = o.details, p = o.autoHideDuration ?? 5e3, h = o.actions;
671
+ v = y.status, b = y.details, S = y.autoHideDuration ?? 5e3, _ = y.actions;
672
672
  } else
673
- u = o, d = a, f = c;
674
- e(f ?? u, {
675
- severity: Nn[d] ?? "info",
676
- title: f ? u : void 0,
677
- duration: p,
678
- action: h == null ? void 0 : h[0]
673
+ m = y, v = f, b = p;
674
+ let R;
675
+ if (v === "error") {
676
+ const O = {
677
+ id: ++g.current,
678
+ message: m,
679
+ details: b,
680
+ created: (/* @__PURE__ */ new Date()).toISOString(),
681
+ actions: _
682
+ };
683
+ i((q) => [...q, O].slice(-20)), R = { label: "Details", onClick: () => {
684
+ l(O.id), a(!0);
685
+ } };
686
+ }
687
+ e(v === "error" ? m : b ?? m, {
688
+ severity: Pn[v] ?? "info",
689
+ title: v !== "error" && b ? m : void 0,
690
+ duration: S,
691
+ action: R ?? (_ == null ? void 0 : _[0])
679
692
  });
680
693
  };
681
- return /* @__PURE__ */ x(Ze.Provider, { value: { showSnackbar: i }, children: t });
694
+ return /* @__PURE__ */ H(et.Provider, { value: { showSnackbar: E, openNotifications: () => a(!0), notificationCount: s.length }, children: [
695
+ t,
696
+ o && /* @__PURE__ */ H("aside", { "aria-label": "Notifications", style: {
697
+ position: "fixed",
698
+ right: 16,
699
+ bottom: 64,
700
+ zIndex: 1400,
701
+ width: "min(600px, calc(100vw - 32px))",
702
+ maxHeight: "70vh",
703
+ overflow: "auto",
704
+ padding: 16,
705
+ background: "var(--ov-color-bg-surface, #202020)",
706
+ color: "var(--ov-color-fg-default, #eee)",
707
+ border: "1px solid currentColor",
708
+ borderRadius: 8
709
+ }, children: [
710
+ /* @__PURE__ */ A("h2", { children: "Notifications" }),
711
+ /* @__PURE__ */ A(ee, { size: "sm", variant: "ghost", onClick: () => a(!1), children: "Close" }),
712
+ /* @__PURE__ */ A(ee, { size: "sm", variant: "ghost", onClick: () => {
713
+ i([]), l(void 0), d("");
714
+ }, children: "Clear history" }),
715
+ s.length === 0 && /* @__PURE__ */ A("p", { children: "No recent errors." }),
716
+ s.slice().reverse().map((y) => {
717
+ var f;
718
+ return /* @__PURE__ */ H("details", { open: c === y.id, onToggle: (p) => {
719
+ p.currentTarget.open && l(y.id);
720
+ }, children: [
721
+ /* @__PURE__ */ H("summary", { children: [
722
+ y.message,
723
+ " — ",
724
+ /* @__PURE__ */ A("time", { dateTime: y.created, children: new Date(y.created).toLocaleString() })
725
+ ] }),
726
+ /* @__PURE__ */ A("pre", { style: { whiteSpace: "pre-wrap", overflowWrap: "anywhere", userSelect: "text" }, children: y.details || y.message }),
727
+ /* @__PURE__ */ A(ee, { size: "sm", variant: "ghost", onClick: async () => {
728
+ d("");
729
+ try {
730
+ await navigator.clipboard.writeText(`${y.message}
731
+ ${y.created}
732
+ ${y.details ?? ""}`);
733
+ } catch {
734
+ d("Copy failed. Select the diagnostic text and copy it manually.");
735
+ }
736
+ }, children: "Copy details" }),
737
+ (f = y.actions) == null ? void 0 : f.map((p, w) => /* @__PURE__ */ A(ee, { size: "sm", variant: "ghost", onClick: p.onClick, children: p.label }, `${p.label}-${w}`))
738
+ ] }, y.id);
739
+ }),
740
+ u && /* @__PURE__ */ A("p", { role: "status", children: u })
741
+ ] })
742
+ ] });
682
743
  }, G = () => {
683
- const t = Y(Ze);
744
+ const t = J(et);
684
745
  if (t === void 0)
685
746
  throw new Error("useCustomSnackbar must be used within a CustomSnackbarProvider");
686
747
  return t;
687
748
  };
688
- function A(t) {
689
- const e = Y(Ee), n = (e == null ? void 0 : e.pluginId) ?? t;
749
+ function T(t) {
750
+ const e = J(Se), n = (e == null ? void 0 : e.pluginId) ?? t;
690
751
  if (!n)
691
752
  throw new Error(
692
753
  "pluginID must be provided either via PluginContext or as an explicit parameter"
693
754
  );
694
755
  return n;
695
756
  }
696
- const as = ({ pluginID: t, connectionID: e }) => {
697
- const n = A(t), r = K(), { showSnackbar: s } = G(), i = [n, "connection", "detail", e], { mutateAsync: o } = N({
698
- mutationFn: async () => vt(n, e),
757
+ const cs = ({ pluginID: t, connectionID: e }) => {
758
+ const n = T(t), r = K(), { showSnackbar: s } = G(), i = [n, "connection", "detail", e], { mutateAsync: o } = P({
759
+ mutationFn: async () => Rt(n, e),
699
760
  onSuccess(d) {
700
761
  r.setQueryData(i, d), r.invalidateQueries({
701
762
  queryKey: ["EDITOR_SCHEMAS", n, e]
702
763
  });
703
764
  },
704
- onError: q(s, "Failed to start connection")
705
- }), { mutateAsync: a } = N({
706
- mutationFn: async () => xe(n, e),
765
+ onError: k(s, "Failed to start connection")
766
+ }), { mutateAsync: a } = P({
767
+ mutationFn: async () => Le(n, e),
707
768
  onSuccess(d) {
708
769
  r.setQueryData(i, d);
709
770
  },
710
- onError: q(s, "Failed to stop connection")
711
- }), { mutateAsync: c } = N({
712
- mutationFn: async (d) => Rt(n, d),
713
- onSuccess(d, { name: f }) {
714
- s({ message: `Connection ${f} successfully updated`, status: "success" }), r.setQueryData(i, d), r.setQueriesData(
771
+ onError: k(s, "Failed to stop connection")
772
+ }), { mutateAsync: c } = P({
773
+ mutationFn: async (d) => It(n, d),
774
+ onSuccess(d, { name: g }) {
775
+ s({ message: `Connection ${g} successfully updated`, status: "success" }), r.setQueryData(i, d), r.setQueriesData(
715
776
  { queryKey: [n, "connection", "list"] },
716
- (p) => p == null ? void 0 : p.map((h) => h.id === e ? d : h)
777
+ (h) => h == null ? void 0 : h.map((E) => E.id === e ? d : E)
717
778
  );
718
779
  },
719
- onError: q(s, "Failed to update connection")
720
- }), { mutateAsync: l } = N({
721
- mutationFn: async () => It(n, e),
780
+ onError: k(s, "Failed to update connection")
781
+ }), { mutateAsync: l } = P({
782
+ mutationFn: async () => Ot(n, e),
722
783
  onSuccess() {
723
784
  s({ message: "Connection successfully removed", status: "success" }), r.setQueryData(i, void 0), r.setQueriesData(
724
785
  { queryKey: [n, "connection", "list"] },
725
- (d) => d == null ? void 0 : d.filter((f) => f.id !== e)
786
+ (d) => d == null ? void 0 : d.filter((g) => g.id !== e)
726
787
  );
727
788
  },
728
- onError: q(s, "Failed to remove connection")
789
+ onError: k(s, "Failed to remove connection")
729
790
  });
730
791
  return {
731
792
  /**
732
793
  * Get the connection
733
794
  */
734
- connection: D({
795
+ connection: N({
735
796
  queryKey: i,
736
- queryFn: async () => Ot(n, e)
797
+ queryFn: async () => At(n, e)
737
798
  }),
738
799
  /**
739
800
  * Start the connection
@@ -752,52 +813,52 @@ const as = ({ pluginID: t, connectionID: e }) => {
752
813
  */
753
814
  deleteConnection: l
754
815
  };
755
- }, Pn = (t) => [t, "connection", "list"], cs = ({ plugin: t }) => {
756
- const e = A(t), n = K(), { showSnackbar: r } = G(), s = Pn(e), { mutateAsync: i } = N({
757
- mutationFn: async (l) => Le(e, l.id),
758
- onError: q(r, "Failed to start connection watch")
759
- }), { mutateAsync: o } = N({
760
- mutationFn: async (l) => At(e, l.id),
761
- onError: q(r, "Failed to stop connection watch")
762
- }), a = _.useCallback((l) => {
816
+ }, xn = (t) => [t, "connection", "list"], us = ({ plugin: t }) => {
817
+ const e = T(t), n = K(), { showSnackbar: r } = G(), s = xn(e), { mutateAsync: i } = P({
818
+ mutationFn: async (l) => Ue(e, l.id),
819
+ onError: k(r, "Failed to start connection watch")
820
+ }), { mutateAsync: o } = P({
821
+ mutationFn: async (l) => Tt(e, l.id),
822
+ onError: k(r, "Failed to stop connection watch")
823
+ }), a = C.useCallback((l) => {
763
824
  const u = l.data;
764
825
  console.log("got update to connections", u), n.setQueryData(s, u);
765
826
  }, [n, s]);
766
- return _.useEffect(() => {
767
- const l = T(`${e}/connection/sync`, a);
827
+ return C.useEffect(() => {
828
+ const l = D(`${e}/connection/sync`, a);
768
829
  return () => {
769
830
  l();
770
831
  };
771
832
  }, [e, a]), {
772
- connections: D({
833
+ connections: N({
773
834
  queryKey: s,
774
835
  queryFn: async () => {
775
836
  try {
776
837
  return await Ft(e);
777
838
  } catch (l) {
778
- console.log(l), q(r, "Failed to load connections")(l);
839
+ console.log(l), k(r, "Failed to load connections")(l);
779
840
  }
780
841
  return [];
781
842
  },
782
843
  staleTime: 3e4,
783
- placeholderData: He
844
+ placeholderData: ze
784
845
  }),
785
846
  startWatch: i,
786
847
  stopWatch: o
787
848
  };
788
- }, us = ({ pluginID: t, connectionID: e }) => {
789
- const n = A(t);
849
+ }, ls = ({ pluginID: t, connectionID: e }) => {
850
+ const n = T(t);
790
851
  return {
791
852
  /**
792
853
  * Get the connection
793
854
  */
794
- namespaces: D({
855
+ namespaces: N({
795
856
  queryKey: [n, "connection", "namespaces", e],
796
- queryFn: async () => Tt(n, e)
857
+ queryFn: async () => Dt(n, e)
797
858
  })
798
859
  };
799
- }, I = Sn(ln, "WatchState");
800
- function me(t) {
860
+ }, I = _n(dn, "WatchState");
861
+ function Ee(t) {
801
862
  const e = Object.values(t.states), n = e.length;
802
863
  let r = 0, s = 0, i = 0, o = 0;
803
864
  for (const u of e)
@@ -818,21 +879,21 @@ function me(t) {
818
879
  progress: l
819
880
  };
820
881
  }
821
- function oe(t) {
882
+ function ie(t) {
822
883
  return t.watchedTotal > 0 && t.doneCount >= t.watchedTotal;
823
884
  }
824
- function et(t) {
825
- return t.some((e) => !oe(e));
826
- }
827
885
  function tt(t) {
886
+ return t.some((e) => !ie(e));
887
+ }
888
+ function nt(t) {
828
889
  const e = t.reduce((r, s) => r + s.watchedTotal, 0);
829
890
  return e === 0 ? 0 : t.reduce((r, s) => r + s.doneCount, 0) / e;
830
891
  }
831
- function _e(t) {
892
+ function Ce(t) {
832
893
  return `${t.pluginId}/${t.connection}`;
833
894
  }
834
- function nt(t, e) {
835
- const n = _e(e);
895
+ function rt(t, e) {
896
+ const n = Ce(e);
836
897
  t.has(n) || t.set(n, {
837
898
  states: {},
838
899
  pluginID: e.pluginId,
@@ -841,155 +902,155 @@ function nt(t, e) {
841
902
  const r = t.get(n);
842
903
  return r.states[e.resourceKey] = e.state, r;
843
904
  }
844
- function ls() {
845
- const [t, e] = j(/* @__PURE__ */ new Set()), [n, r] = j({}), [s, i] = j(/* @__PURE__ */ new Map()), o = k(/* @__PURE__ */ new Map()), [a, c] = j(/* @__PURE__ */ new Map());
905
+ function ds() {
906
+ const [t, e] = j(/* @__PURE__ */ new Set()), [n, r] = j({}), [s, i] = j(/* @__PURE__ */ new Map()), o = M(/* @__PURE__ */ new Map()), [a, c] = j(/* @__PURE__ */ new Map());
846
907
  W(() => {
847
- const m = T("plugin/crash_recovery_failed", (R) => {
848
- const S = R.data, C = S == null ? void 0 : S.pluginID;
849
- C && c((v) => {
850
- const O = new Map(v);
851
- return O.set(C, S.error ?? "Crash recovery failed"), O;
908
+ const m = D("plugin/crash_recovery_failed", (b) => {
909
+ const S = b.data, _ = S == null ? void 0 : S.pluginID;
910
+ _ && c((R) => {
911
+ const O = new Map(R);
912
+ return O.set(_, S.error ?? "Crash recovery failed"), O;
852
913
  });
853
- }), b = T("plugin/recovered", (R) => {
854
- const S = R.data, C = S == null ? void 0 : S.pluginID;
855
- C && c((v) => {
856
- if (!v.has(C)) return v;
857
- const O = new Map(v);
858
- return O.delete(C), O;
914
+ }), v = D("plugin/recovered", (b) => {
915
+ const S = b.data, _ = S == null ? void 0 : S.pluginID;
916
+ _ && c((R) => {
917
+ if (!R.has(_)) return R;
918
+ const O = new Map(R);
919
+ return O.delete(_), O;
859
920
  });
860
921
  });
861
922
  return () => {
862
- m(), b();
923
+ m(), v();
863
924
  };
864
925
  }, []), W(() => {
865
- Dt().then((m) => {
926
+ Nt().then((m) => {
866
927
  if (!m) return;
867
- const b = {}, R = /* @__PURE__ */ new Set(), S = /* @__PURE__ */ new Map();
868
- for (const [C, v] of Object.entries(m))
869
- if (v) {
870
- b[C] = v.map((O) => O.connection);
871
- for (const O of v) {
928
+ const v = {}, b = /* @__PURE__ */ new Set(), S = /* @__PURE__ */ new Map();
929
+ for (const [_, R] of Object.entries(m))
930
+ if (R) {
931
+ v[_] = R.map((O) => O.connection);
932
+ for (const O of R) {
872
933
  if (!O.started) continue;
873
- const M = `${C}/${O.connection.id}`;
874
- R.add(M);
934
+ const q = `${_}/${O.connection.id}`;
935
+ b.add(q);
875
936
  const L = {
876
- pluginID: C,
937
+ pluginID: _,
877
938
  connectionID: O.connection.id,
878
939
  states: {}
879
940
  };
880
941
  if (O.resources)
881
- for (const [ue, dt] of Object.entries(O.resources))
882
- L.states[ue] = dt;
883
- o.current.set(M, L), S.set(M, me(L));
942
+ for (const [le, ft] of Object.entries(O.resources))
943
+ L.states[le] = ft;
944
+ o.current.set(q, L), S.set(q, Ee(L));
884
945
  }
885
946
  }
886
- r(b), e(R), i(S);
947
+ r(v), e(b), i(S);
887
948
  }).catch(() => {
888
949
  });
889
- }, []), W(() => T("connection/status", (b) => {
890
- const R = b.data, S = `${R.pluginID}/${R.connectionID}`;
891
- R.status === "DISCONNECTED" ? (e((C) => {
892
- const v = new Set(C);
893
- return v.delete(S), v;
894
- }), i((C) => {
895
- const v = new Map(C);
896
- return v.delete(S), v;
897
- }), o.current.delete(S)) : e((C) => {
898
- const v = new Set(C);
899
- return v.add(S), v;
900
- }), Pt().then((C) => {
901
- if (!C) return;
902
- const v = {};
903
- for (const [O, M] of Object.entries(C))
904
- M != null && (v[O] = M);
905
- r(v);
950
+ }, []), W(() => D("connection/status", (v) => {
951
+ const b = v.data, S = `${b.pluginID}/${b.connectionID}`;
952
+ b.status === "DISCONNECTED" ? (e((_) => {
953
+ const R = new Set(_);
954
+ return R.delete(S), R;
955
+ }), i((_) => {
956
+ const R = new Map(_);
957
+ return R.delete(S), R;
958
+ }), o.current.delete(S)) : e((_) => {
959
+ const R = new Set(_);
960
+ return R.add(S), R;
961
+ }), xt().then((_) => {
962
+ if (!_) return;
963
+ const R = {};
964
+ for (const [O, q] of Object.entries(_))
965
+ q != null && (R[O] = q);
966
+ r(R);
906
967
  }).catch(() => {
907
968
  });
908
969
  }), []);
909
970
  const l = U((m) => {
910
- const b = m.data, R = _e(b);
911
- e((v) => {
912
- if (v.has(R)) return v;
913
- const O = new Set(v);
914
- return O.add(R), O;
971
+ const v = m.data, b = Ce(v);
972
+ e((R) => {
973
+ if (R.has(b)) return R;
974
+ const O = new Set(R);
975
+ return O.add(b), O;
915
976
  });
916
- const S = nt(o.current, b), C = me(S);
917
- i((v) => {
918
- const O = new Map(v);
919
- return O.set(R, C), O;
977
+ const S = rt(o.current, v), _ = Ee(S);
978
+ i((R) => {
979
+ const O = new Map(R);
980
+ return O.set(b, _), O;
920
981
  });
921
982
  }, []);
922
- W(() => T("watch/STATE", l), [l]);
923
- const u = U(async (m, b) => {
924
- await xe(m, b);
925
- }, []), d = U(async (m, b) => {
926
- await Le(m, b);
927
- }, []), f = U(async (m) => {
928
- const b = a.get(m);
929
- c((R) => {
930
- if (!R.has(m)) return R;
931
- const S = new Map(R);
983
+ W(() => D("watch/STATE", l), [l]);
984
+ const u = U(async (m, v) => {
985
+ await Le(m, v);
986
+ }, []), d = U(async (m, v) => {
987
+ await Ue(m, v);
988
+ }, []), g = U(async (m) => {
989
+ const v = a.get(m);
990
+ c((b) => {
991
+ if (!b.has(m)) return b;
992
+ const S = new Map(b);
932
993
  return S.delete(m), S;
933
994
  });
934
995
  try {
935
- await Nt(m);
936
- } catch (R) {
996
+ await Pt(m);
997
+ } catch (b) {
937
998
  throw c((S) => {
938
- const C = new Map(S);
939
- return C.set(m, b ?? "Reload failed"), C;
940
- }), R;
999
+ const _ = new Map(S);
1000
+ return _.set(m, v ?? "Reload failed"), _;
1001
+ }), b;
941
1002
  }
942
- }, [a]), p = [];
1003
+ }, [a]), h = [];
943
1004
  for (const m of t) {
944
- const [b, R] = m.split("/", 2), C = (n[b] ?? []).find((ue) => ue.id === R), v = s.get(m), O = v != null && !oe(v), M = v != null && v.errorCount > 0, L = a.get(b);
945
- p.push({
946
- pluginID: b,
947
- connectionID: R,
948
- name: (C == null ? void 0 : C.name) ?? R,
949
- avatar: (C == null ? void 0 : C.avatar) ?? "",
1005
+ const [v, b] = m.split("/", 2), _ = (n[v] ?? []).find((le) => le.id === b), R = s.get(m), O = R != null && !ie(R), q = R != null && R.errorCount > 0, L = a.get(v);
1006
+ h.push({
1007
+ pluginID: v,
1008
+ connectionID: b,
1009
+ name: (_ == null ? void 0 : _.name) ?? b,
1010
+ avatar: (_ == null ? void 0 : _.avatar) ?? "",
950
1011
  isStarted: !0,
951
- sync: v,
1012
+ sync: R,
952
1013
  isSyncing: O,
953
- hasErrors: M || L != null,
1014
+ hasErrors: q || L != null,
954
1015
  pluginFailed: L != null,
955
1016
  pluginError: L
956
1017
  });
957
1018
  }
958
- const h = /* @__PURE__ */ new Map();
959
- for (const m of p) {
960
- const b = h.get(m.pluginID) ?? [];
961
- b.push(m), h.set(m.pluginID, b);
1019
+ const E = /* @__PURE__ */ new Map();
1020
+ for (const m of h) {
1021
+ const v = E.get(m.pluginID) ?? [];
1022
+ v.push(m), E.set(m.pluginID, v);
962
1023
  }
963
- const E = Array.from(s.values()), g = p.filter((m) => m.isSyncing), y = p.filter((m) => m.hasErrors), w = p.filter((m) => m.pluginFailed);
1024
+ const y = Array.from(s.values()), f = h.filter((m) => m.isSyncing), p = h.filter((m) => m.hasErrors), w = h.filter((m) => m.pluginFailed);
964
1025
  return {
965
- entries: p,
966
- grouped: h,
967
- connectedCount: p.length,
968
- syncingCount: g.length,
969
- errorCount: y.length,
1026
+ entries: h,
1027
+ grouped: E,
1028
+ connectedCount: h.length,
1029
+ syncingCount: f.length,
1030
+ errorCount: p.length,
970
1031
  failedCount: w.length,
971
- hasSyncing: et(E),
972
- aggregateProgress: tt(E),
1032
+ hasSyncing: tt(y),
1033
+ aggregateProgress: nt(y),
973
1034
  disconnect: u,
974
1035
  retryWatch: d,
975
- retryPlugin: f
1036
+ retryPlugin: g
976
1037
  };
977
1038
  }
978
- function xn(t, e) {
1039
+ function Ln(t, e) {
979
1040
  return e === null ? t === null : Array.isArray(e) ? Array.isArray(t) : typeof e == "object" ? typeof t == "object" && t !== null && !Array.isArray(t) : typeof t == typeof e;
980
1041
  }
981
- function ds(t, e, n) {
982
- const r = A(t), s = K(), i = [r, "data", e], o = D({
1042
+ function fs(t, e, n) {
1043
+ const r = T(t), s = K(), i = [r, "data", e], o = N({
983
1044
  queryKey: i,
984
1045
  queryFn: async () => {
985
- const c = await xt(r, e);
986
- return c == null ? n : xn(c, n) ? c : (console.warn(
1046
+ const c = await Lt(r, e);
1047
+ return c == null ? n : Ln(c, n) ? c : (console.warn(
987
1048
  `[usePluginData] stored value for "${e}" has unexpected type (expected ${Array.isArray(n) ? "array" : typeof n}, got ${Array.isArray(c) ? "array" : typeof c}). Using default.`
988
1049
  ), n);
989
1050
  }
990
- }), a = N({
1051
+ }), a = P({
991
1052
  mutationFn: async (c) => {
992
- await Lt(r, e, c);
1053
+ await Ut(r, e, c);
993
1054
  },
994
1055
  onMutate: async (c) => {
995
1056
  await s.cancelQueries({ queryKey: i });
@@ -1011,19 +1072,19 @@ function ds(t, e, n) {
1011
1072
  isLoading: o.isLoading
1012
1073
  };
1013
1074
  }
1014
- const fs = () => {
1015
- const t = Y(bn);
1075
+ const ps = () => {
1076
+ const t = J(bn);
1016
1077
  if (!t) throw new Error("useRightDrawer must be used within a RightDrawerProvider");
1017
1078
  return t;
1018
- }, rt = () => {
1019
- const t = Y(wn);
1079
+ }, st = () => {
1080
+ const t = J(vn);
1020
1081
  if (t === void 0)
1021
1082
  throw new Error("useBottomDrawer must be used within a BottomDrawerProvider");
1022
1083
  return t;
1023
- }, ps = ({ pluginID: t }) => {
1024
- const e = A(t), { showSnackbar: n } = G(), { createTab: r, updateTab: s } = rt();
1084
+ }, gs = ({ pluginID: t }) => {
1085
+ const e = T(t), { showSnackbar: n } = G(), { createTab: r, updateTab: s } = st();
1025
1086
  return {
1026
- createSession: N({
1087
+ createSession: P({
1027
1088
  mutationFn: async ({ connectionID: o, icon: a, label: c, opts: l }) => {
1028
1089
  const u = `pending-${crypto.randomUUID()}`;
1029
1090
  r({
@@ -1038,36 +1099,36 @@ const fs = () => {
1038
1099
  opts: { ...l }
1039
1100
  }
1040
1101
  });
1041
- const d = dn.createFrom({
1102
+ const d = fn.createFrom({
1042
1103
  command: ["/bin/bash"],
1043
1104
  tty: !0,
1044
1105
  ...l
1045
1106
  });
1046
1107
  try {
1047
- const f = await Ut(e, o, d);
1048
- if (!f) throw new Error("Failed to create session: null response");
1108
+ const g = await kt(e, o, d);
1109
+ if (!g) throw new Error("Failed to create session: null response");
1049
1110
  s(
1050
1111
  { id: u },
1051
1112
  {
1052
- id: f.id,
1053
- title: c ?? `Session ${f.id.substring(0, 8)}`,
1113
+ id: g.id,
1114
+ title: c ?? `Session ${g.id.substring(0, 8)}`,
1054
1115
  properties: { status: "connected", pluginID: e, connectionID: o, opts: { ...l } }
1055
1116
  }
1056
1117
  );
1057
- } catch (f) {
1058
- const p = Q(f);
1118
+ } catch (g) {
1119
+ const h = Q(g);
1059
1120
  s(
1060
1121
  { id: u },
1061
1122
  {
1062
- properties: { status: "error", error: p.detail, pluginID: e, connectionID: o, opts: { ...l } }
1123
+ properties: { status: "error", error: h.detail, pluginID: e, connectionID: o, opts: { ...l } }
1063
1124
  }
1064
- ), B(n, f, "Failed to start session");
1125
+ ), B(n, g, "Failed to start session");
1065
1126
  }
1066
1127
  }
1067
1128
  }).mutateAsync
1068
1129
  };
1069
- }, gs = ({ pluginID: t }) => {
1070
- const e = A(t), { showSnackbar: n } = G(), { createTab: r } = rt(), s = N({
1130
+ }, hs = ({ pluginID: t }) => {
1131
+ const e = T(t), { showSnackbar: n } = G(), { createTab: r } = st(), s = P({
1071
1132
  mutationFn: async ({
1072
1133
  connectionID: o,
1073
1134
  resourceKey: a,
@@ -1075,57 +1136,57 @@ const fs = () => {
1075
1136
  resourceData: l,
1076
1137
  icon: u,
1077
1138
  label: d,
1078
- target: f,
1079
- follow: p = !0,
1080
- tailLines: h = 1e3,
1081
- params: E
1139
+ target: g,
1140
+ follow: h = !0,
1141
+ tailLines: E = 1e3,
1142
+ params: y
1082
1143
  }) => {
1083
- const g = fn.createFrom({
1144
+ const f = pn.createFrom({
1084
1145
  resource_key: a,
1085
1146
  resource_id: c,
1086
1147
  resource_data: l,
1087
- options: pn.createFrom({
1088
- target: f ?? "",
1089
- follow: p,
1148
+ options: gn.createFrom({
1149
+ target: g ?? "",
1150
+ follow: h,
1090
1151
  include_previous: !1,
1091
1152
  include_timestamps: !0,
1092
- tail_lines: h,
1153
+ tail_lines: E,
1093
1154
  since_seconds: 0,
1094
1155
  limit_bytes: 0,
1095
1156
  include_source_events: !0,
1096
- params: E ?? {}
1157
+ params: y ?? {}
1097
1158
  })
1098
- }), y = await qt(e, o, g);
1099
- if (!y) throw new Error("Failed to create log session: null response");
1159
+ }), p = await qt(e, o, f);
1160
+ if (!p) throw new Error("Failed to create log session: null response");
1100
1161
  return r({
1101
- id: y.id,
1102
- title: d ?? `Logs ${y.id.substring(0, 8)}`,
1162
+ id: p.id,
1163
+ title: d ?? `Logs ${p.id.substring(0, 8)}`,
1103
1164
  variant: "logs",
1104
1165
  icon: u ?? "LuLogs"
1105
- }), y;
1166
+ }), p;
1106
1167
  },
1107
- onError: q(n, "Failed to start log session")
1108
- }), i = N({
1168
+ onError: k(n, "Failed to start log session")
1169
+ }), i = P({
1109
1170
  mutationFn: async (o) => {
1110
1171
  await Mt(o);
1111
1172
  },
1112
- onError: q(n, "Failed to close log session")
1173
+ onError: k(n, "Failed to close log session")
1113
1174
  });
1114
1175
  return {
1115
1176
  createLogSession: s.mutateAsync,
1116
1177
  closeLogSession: i.mutateAsync
1117
1178
  };
1118
- }, ys = () => D({
1179
+ }, ys = () => N({
1119
1180
  queryKey: ["metric", "providers"],
1120
- queryFn: kt,
1181
+ queryFn: $t,
1121
1182
  staleTime: 3e4
1122
- }), Ln = (t) => D({
1183
+ }), Un = (t) => N({
1123
1184
  queryKey: ["metric", "providers", t],
1124
- queryFn: () => $t(t),
1185
+ queryFn: () => Wt(t),
1125
1186
  enabled: !!t,
1126
1187
  staleTime: 3e4
1127
- }), hs = (t) => {
1128
- var g, y;
1188
+ }), ms = (t) => {
1189
+ var f, p;
1129
1190
  const {
1130
1191
  connectionID: e,
1131
1192
  resourceKey: n,
@@ -1140,11 +1201,11 @@ const fs = () => {
1140
1201
  enabled: u = !0
1141
1202
  } = t, {
1142
1203
  data: d,
1143
- isLoading: f
1144
- } = Ln(n), p = d ?? [], h = c ? Math.max(
1204
+ isLoading: g
1205
+ } = Un(n), h = d ?? [], E = c ? Math.max(
1145
1206
  Math.floor((c.end.getTime() - c.start.getTime()) / 250),
1146
1207
  15e3
1147
- ) * 1e6 : 0, E = D({
1208
+ ) * 1e6 : 0, y = N({
1148
1209
  queryKey: [
1149
1210
  "metric",
1150
1211
  "query",
@@ -1154,11 +1215,11 @@ const fs = () => {
1154
1215
  s,
1155
1216
  o,
1156
1217
  a,
1157
- (g = c == null ? void 0 : c.start) == null ? void 0 : g.getTime(),
1158
- (y = c == null ? void 0 : c.end) == null ? void 0 : y.getTime()
1218
+ (f = c == null ? void 0 : c.start) == null ? void 0 : f.getTime(),
1219
+ (p = c == null ? void 0 : c.end) == null ? void 0 : p.getTime()
1159
1220
  ],
1160
1221
  queryFn: async () => {
1161
- const w = await Wt(
1222
+ const w = await Gt(
1162
1223
  e,
1163
1224
  n,
1164
1225
  r,
@@ -1168,27 +1229,27 @@ const fs = () => {
1168
1229
  a,
1169
1230
  ((c == null ? void 0 : c.start) ?? /* @__PURE__ */ new Date(0)).toISOString(),
1170
1231
  ((c == null ? void 0 : c.end) ?? /* @__PURE__ */ new Date(0)).toISOString(),
1171
- h
1232
+ E
1172
1233
  ), m = {};
1173
- for (const [b, R] of Object.entries(w))
1174
- R != null && (m[b] = R);
1234
+ for (const [v, b] of Object.entries(w))
1235
+ b != null && (m[v] = b);
1175
1236
  return m;
1176
1237
  },
1177
- enabled: u && !!e && !!n && (n.startsWith("cluster::") || !!r) && p.length > 0,
1238
+ enabled: u && !!e && !!n && (n.startsWith("cluster::") || !!r) && h.length > 0,
1178
1239
  refetchInterval: l > 0 ? l : void 0,
1179
1240
  staleTime: 5e3,
1180
1241
  // Keep previous data visible while fetching new data (e.g. on time range change)
1181
1242
  // to prevent the chart from blinking empty.
1182
- placeholderData: He
1243
+ placeholderData: ze
1183
1244
  });
1184
1245
  return {
1185
- data: E.data ?? void 0,
1186
- providers: p,
1187
- isLoading: f || E.isLoading,
1188
- error: E.error,
1189
- refetch: E.refetch
1246
+ data: y.data ?? void 0,
1247
+ providers: h,
1248
+ isLoading: g || y.isLoading,
1249
+ error: y.error,
1250
+ refetch: y.refetch
1190
1251
  };
1191
- }, ms = (t) => {
1252
+ }, Es = (t) => {
1192
1253
  const {
1193
1254
  pluginID: e,
1194
1255
  connectionID: n,
@@ -1199,10 +1260,10 @@ const fs = () => {
1199
1260
  metricIDs: a = [],
1200
1261
  interval: c = 1e4,
1201
1262
  enabled: l = !0
1202
- } = t, u = A(e), [d, f] = j(null), [p, h] = j(null), [E, g] = j(!1), [y, w] = j(null), m = k(null), b = U(async () => {
1263
+ } = t, u = T(e), [d, g] = j(null), [h, E] = j(null), [y, f] = j(!1), [p, w] = j(null), m = M(null), v = U(async () => {
1203
1264
  if (!(!l || !u || !n || !r || !s))
1204
1265
  try {
1205
- const S = await Gt(u, n, {
1266
+ const S = await jt(u, n, {
1206
1267
  resource_key: r,
1207
1268
  resource_id: s,
1208
1269
  resource_namespace: i,
@@ -1211,74 +1272,74 @@ const fs = () => {
1211
1272
  interval: c * 1e6
1212
1273
  // ms to nanoseconds for Go time.Duration
1213
1274
  });
1214
- h(S), g(!0), w(null);
1215
- const C = T(`core/metrics/data/${S}`, (O) => {
1216
- const M = O.data;
1275
+ E(S), f(!0), w(null);
1276
+ const _ = D(`core/metrics/data/${S}`, (O) => {
1277
+ const q = O.data;
1217
1278
  try {
1218
- const L = JSON.parse(M);
1219
- L.results && f(L.results);
1279
+ const L = JSON.parse(q);
1280
+ L.results && g(L.results);
1220
1281
  } catch (L) {
1221
1282
  console.error("Failed to parse metric stream data:", L);
1222
1283
  }
1223
- }), v = T(`core/metrics/error/${S}`, (O) => {
1224
- const M = O.data;
1284
+ }), R = D(`core/metrics/error/${S}`, (O) => {
1285
+ const q = O.data;
1225
1286
  try {
1226
- const L = JSON.parse(M);
1287
+ const L = JSON.parse(q);
1227
1288
  w(L.error || "Unknown error");
1228
1289
  } catch {
1229
1290
  w("Failed to parse metric stream error");
1230
1291
  }
1231
1292
  });
1232
1293
  m.current = () => {
1233
- C(), v();
1294
+ _(), R();
1234
1295
  };
1235
1296
  } catch (S) {
1236
1297
  w(S instanceof Error ? S.message : String(S));
1237
1298
  }
1238
- }, [u, n, r, s, i, a, c, l]), R = U(async () => {
1239
- if (p)
1299
+ }, [u, n, r, s, i, a, c, l]), b = U(async () => {
1300
+ if (h)
1240
1301
  try {
1241
- await Ie(p);
1302
+ await Oe(h);
1242
1303
  } catch (S) {
1243
1304
  console.error("Failed to unsubscribe:", S);
1244
1305
  }
1245
- m.current && (m.current(), m.current = null), h(null), g(!1);
1246
- }, [p]);
1306
+ m.current && (m.current(), m.current = null), E(null), f(!1);
1307
+ }, [h]);
1247
1308
  return W(() => () => {
1248
- p && Ie(p).catch(console.error), m.current && m.current();
1249
- }, [p]), {
1309
+ h && Oe(h).catch(console.error), m.current && m.current();
1310
+ }, [h]), {
1250
1311
  data: d,
1251
- subscriptionID: p,
1252
- isStreaming: E,
1253
- error: y,
1254
- start: b,
1255
- stop: R
1312
+ subscriptionID: h,
1313
+ isStreaming: y,
1314
+ error: p,
1315
+ start: v,
1316
+ stop: b
1256
1317
  };
1257
- }, V = ["networker", "portforward", "all-sessions"];
1258
- function Es() {
1259
- const { showSnackbar: t } = G(), e = K(), n = D({
1260
- queryKey: [...V],
1261
- queryFn: async () => jt().catch((i) => {
1318
+ }, Y = ["networker", "portforward", "all-sessions"];
1319
+ function Ss() {
1320
+ const { showSnackbar: t } = G(), e = K(), n = N({
1321
+ queryKey: [...Y],
1322
+ queryFn: async () => Qt().catch((i) => {
1262
1323
  if (Q(i).detail.includes("not found")) return [];
1263
1324
  throw i;
1264
1325
  }),
1265
1326
  retry: !1
1266
1327
  });
1267
1328
  W(() => {
1268
- const i = T("core/networker/portforward/created", () => {
1269
- e.invalidateQueries({ queryKey: [...V] });
1270
- }), o = T("core/networker/portforward/closed", () => {
1271
- e.invalidateQueries({ queryKey: [...V] });
1329
+ const i = D("core/networker/portforward/created", () => {
1330
+ e.invalidateQueries({ queryKey: [...Y] });
1331
+ }), o = D("core/networker/portforward/closed", () => {
1332
+ e.invalidateQueries({ queryKey: [...Y] });
1272
1333
  });
1273
1334
  return () => {
1274
1335
  i(), o();
1275
1336
  };
1276
1337
  }, [e]);
1277
- const r = n.data ?? [], s = N({
1278
- mutationFn: async (i) => Ue(i),
1279
- onError: q(t, "Failed to close port forwarding session"),
1338
+ const r = n.data ?? [], s = P({
1339
+ mutationFn: async (i) => ke(i),
1340
+ onError: k(t, "Failed to close port forwarding session"),
1280
1341
  onSuccess: async () => {
1281
- await e.invalidateQueries({ queryKey: [...V] });
1342
+ await e.invalidateQueries({ queryKey: [...Y] });
1282
1343
  }
1283
1344
  });
1284
1345
  return {
@@ -1288,10 +1349,10 @@ function Es() {
1288
1349
  openInBrowser: (i) => Be(`http://localhost:${i}`)
1289
1350
  };
1290
1351
  }
1291
- function Ss({ pluginID: t, connectionID: e, resourceID: n }) {
1292
- const r = A(t), s = ["networker", "portforward", "sessions", r, e, n], { showSnackbar: i } = G(), o = K(), a = D({
1352
+ function _s({ pluginID: t, connectionID: e, resourceID: n }) {
1353
+ const r = T(t), s = ["networker", "portforward", "sessions", r, e, n], { showSnackbar: i } = G(), o = K(), a = N({
1293
1354
  queryKey: s,
1294
- queryFn: async () => Qt(r, e, gn.createFrom({
1355
+ queryFn: async () => Kt(r, e, hn.createFrom({
1295
1356
  resource_id: n,
1296
1357
  connection_id: e
1297
1358
  })).catch((u) => {
@@ -1299,7 +1360,7 @@ function Ss({ pluginID: t, connectionID: e, resourceID: n }) {
1299
1360
  return d.detail.includes("not found") ? [] : (i({ message: "Failed to fetch port forward sessions", status: "error", details: d.detail }), []);
1300
1361
  }),
1301
1362
  retry: !1
1302
- }), c = N({
1363
+ }), c = P({
1303
1364
  mutationFn: async ({ opts: u }) => {
1304
1365
  const d = yn.createFrom({
1305
1366
  local_port: u.localPort || 0,
@@ -1315,24 +1376,24 @@ function Ss({ pluginID: t, connectionID: e, resourceID: n }) {
1315
1376
  },
1316
1377
  labels: u.labels ?? {},
1317
1378
  params: u.parameters ?? {}
1318
- }), f = await Kt(r, e, d);
1319
- if (!f) throw new Error("Failed to start port forwarding: null response");
1320
- return u.openInBrowser && Be(`http://localhost:${f.local_port}`), f;
1379
+ }), g = await Ht(r, e, d);
1380
+ if (!g) throw new Error("Failed to start port forwarding: null response");
1381
+ return u.openInBrowser && Be(`http://localhost:${g.local_port}`), g;
1321
1382
  },
1322
- onError: q(i, "Failed to start port forwarding session"),
1383
+ onError: k(i, "Failed to start port forwarding session"),
1323
1384
  onSuccess: async () => {
1324
1385
  await Promise.all([
1325
1386
  o.invalidateQueries({ queryKey: s }),
1326
- o.invalidateQueries({ queryKey: [...V] })
1387
+ o.invalidateQueries({ queryKey: [...Y] })
1327
1388
  ]);
1328
1389
  }
1329
- }), l = N({
1330
- mutationFn: async ({ opts: u }) => Ue(u.sessionID),
1331
- onError: q(i, "Failed to close port forwarding session"),
1390
+ }), l = P({
1391
+ mutationFn: async ({ opts: u }) => ke(u.sessionID),
1392
+ onError: k(i, "Failed to close port forwarding session"),
1332
1393
  onSuccess: async () => {
1333
1394
  await Promise.all([
1334
1395
  o.invalidateQueries({ queryKey: s }),
1335
- o.invalidateQueries({ queryKey: [...V] })
1396
+ o.invalidateQueries({ queryKey: [...Y] })
1336
1397
  ]);
1337
1398
  }
1338
1399
  });
@@ -1342,46 +1403,46 @@ function Ss({ pluginID: t, connectionID: e, resourceID: n }) {
1342
1403
  close: l.mutateAsync
1343
1404
  };
1344
1405
  }
1345
- const _s = () => {
1346
- const t = _.useContext(vn);
1406
+ const Cs = () => {
1407
+ const t = C.useContext(Rn);
1347
1408
  if (!t) throw new Error("useConfirmationModal must be used within a ConfirmationModalProvider");
1348
1409
  return t;
1349
- }, Cs = ({
1410
+ }, ws = ({
1350
1411
  pluginID: t,
1351
1412
  connectionID: e,
1352
1413
  resourceKey: n,
1353
1414
  resourceID: r,
1354
1415
  namespace: s = ""
1355
1416
  }) => {
1356
- const i = A(t), o = K(), { showSnackbar: a } = G(), c = ["RESOURCE", i, e, n, r, s], { mutateAsync: l } = N({
1357
- mutationFn: async (f) => qe(i, e, n, We.createFrom({
1358
- input: f.input,
1417
+ const i = T(t), o = K(), { showSnackbar: a } = G(), c = ["RESOURCE", i, e, n, r, s], { mutateAsync: l } = P({
1418
+ mutationFn: async (g) => qe(i, e, n, Ge.createFrom({
1419
+ input: g.input,
1359
1420
  id: r,
1360
1421
  namespace: s
1361
1422
  })),
1362
1423
  onSuccess: async () => {
1363
1424
  a(`Resource ${r} updated`, "success"), await o.invalidateQueries({ queryKey: c });
1364
1425
  },
1365
- onError: q(a, `Failed to update resource ${r}`)
1366
- }), { mutateAsync: u } = N({
1367
- mutationFn: async (f = {}) => Me(i, e, n, Ge.createFrom({
1426
+ onError: k(a, `Failed to update resource ${r}`)
1427
+ }), { mutateAsync: u } = P({
1428
+ mutationFn: async (g = {}) => Me(i, e, n, je.createFrom({
1368
1429
  id: r,
1369
1430
  namespace: s,
1370
- gracePeriodSeconds: f.gracePeriodSeconds
1431
+ gracePeriodSeconds: g.gracePeriodSeconds
1371
1432
  })),
1372
1433
  onSuccess: async () => {
1373
1434
  a(`Resource ${r} deleted`, "success"), await o.invalidateQueries({ queryKey: c });
1374
1435
  },
1375
- onError: q(a, `Failed to delete resource ${r}`)
1436
+ onError: k(a, `Failed to delete resource ${r}`)
1376
1437
  });
1377
1438
  return {
1378
1439
  /**
1379
1440
  * Fetch result for the resource. The client will automatically cache the result, and update the cache
1380
1441
  * when the resource is updated or deleted via the returned update and remove mutation functions.
1381
1442
  */
1382
- resource: D({
1443
+ resource: N({
1383
1444
  queryKey: c,
1384
- queryFn: async () => Bt(i, e, n, hn.createFrom({
1445
+ queryFn: async () => Bt(i, e, n, mn.createFrom({
1385
1446
  id: r,
1386
1447
  namespace: s
1387
1448
  })),
@@ -1402,40 +1463,40 @@ const _s = () => {
1402
1463
  */
1403
1464
  remove: u
1404
1465
  };
1405
- }, ws = (t) => {
1466
+ }, vs = (t) => {
1406
1467
  const e = ["component", t.plugin, t.resource, t.area];
1407
1468
  return {
1408
1469
  /**
1409
1470
  * Fetch result for the resource. The client will automatically cache the result, and update the cache
1410
1471
  * when the resource is updated or deleted via the returned update and remove mutation functions.
1411
1472
  */
1412
- component: D({
1473
+ component: N({
1413
1474
  queryKey: e,
1414
- queryFn: async () => Ht(t)
1475
+ queryFn: async () => zt(t)
1415
1476
  })
1416
1477
  };
1417
1478
  }, bs = ({ pluginID: t, connectionID: e }) => {
1418
- const n = A(t);
1479
+ const n = T(t);
1419
1480
  return {
1420
1481
  /**
1421
1482
  * The resource groups for the given plugin and connection.
1422
1483
  */
1423
- groups: D({
1484
+ groups: N({
1424
1485
  queryKey: [n, "resource_groups", "list"],
1425
- queryFn: async () => zt(n, e),
1486
+ queryFn: async () => Vt(n, e),
1426
1487
  retry: !1
1427
1488
  })
1428
1489
  };
1429
- }, vs = ({
1490
+ }, Rs = ({
1430
1491
  pluginID: t,
1431
1492
  connectionID: e,
1432
1493
  searches: n
1433
1494
  }) => {
1434
- const r = A(t), s = (o) => [r, e, o.key, o.namespaces, "list"];
1435
- return mn({
1495
+ const r = T(t), s = (o) => [r, e, o.key, o.namespaces, "list"];
1496
+ return En({
1436
1497
  queries: n.map((o) => ({
1437
1498
  queryKey: s(o),
1438
- queryFn: async () => ke(r, e, o.key, je.createFrom({
1499
+ queryFn: async () => $e(r, e, o.key, Qe.createFrom({
1439
1500
  order: [{ field: "name", descending: !1 }],
1440
1501
  pagination: { page: 1, pageSize: 200 },
1441
1502
  namespaces: o.namespaces
@@ -1443,40 +1504,40 @@ const _s = () => {
1443
1504
  retry: !1
1444
1505
  }))
1445
1506
  });
1446
- }, Rs = ({ pluginID: t, resourceKey: e }) => {
1447
- const n = A(t);
1507
+ }, Is = ({ pluginID: t, resourceKey: e }) => {
1508
+ const n = T(t);
1448
1509
  return {
1449
1510
  /**
1450
1511
  * The current settings from the provider.
1451
1512
  */
1452
- resourceType: D({
1513
+ resourceType: N({
1453
1514
  queryKey: [n, "resources", e],
1454
- queryFn: async () => Vt(n, e),
1515
+ queryFn: async () => Yt(n, e),
1455
1516
  retry: !1
1456
1517
  })
1457
1518
  };
1458
- }, Is = ({ pluginID: t, connectionID: e }) => {
1459
- const n = A(t);
1519
+ }, Os = ({ pluginID: t, connectionID: e }) => {
1520
+ const n = T(t);
1460
1521
  return {
1461
1522
  /**
1462
1523
  * The resource types for the given plugin and connection.
1463
1524
  */
1464
- types: D({
1525
+ types: N({
1465
1526
  queryKey: [n, "resources", "list", e],
1466
- queryFn: async () => Yt(n, e),
1527
+ queryFn: async () => Jt(n, e),
1467
1528
  retry: !1
1468
1529
  })
1469
1530
  };
1470
1531
  };
1471
- var te = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
1472
- function Un(t) {
1532
+ var ne = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
1533
+ function kn(t) {
1473
1534
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
1474
1535
  }
1475
- var qn = "Expected a function", st = "__lodash_hash_undefined__", Mn = "[object Function]", kn = "[object GeneratorFunction]", $n = "[object Symbol]", Wn = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Gn = /^\w*$/, jn = /^\./, Qn = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, Kn = /[\\^$.*+?()[\]{}|]/g, Bn = /\\(\\)?/g, Hn = /^\[object .+?Constructor\]$/, zn = typeof te == "object" && te && te.Object === Object && te, Vn = typeof self == "object" && self && self.Object === Object && self, Ce = zn || Vn || Function("return this")();
1476
- function Yn(t, e) {
1536
+ var qn = "Expected a function", ot = "__lodash_hash_undefined__", Mn = "[object Function]", $n = "[object GeneratorFunction]", Wn = "[object Symbol]", Gn = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, jn = /^\w*$/, Qn = /^\./, Kn = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, Hn = /[\\^$.*+?()[\]{}|]/g, Bn = /\\(\\)?/g, zn = /^\[object .+?Constructor\]$/, Vn = typeof ne == "object" && ne && ne.Object === Object && ne, Yn = typeof self == "object" && self && self.Object === Object && self, we = Vn || Yn || Function("return this")();
1537
+ function Jn(t, e) {
1477
1538
  return t == null ? void 0 : t[e];
1478
1539
  }
1479
- function Jn(t) {
1540
+ function Xn(t) {
1480
1541
  var e = !1;
1481
1542
  if (t != null && typeof t.toString != "function")
1482
1543
  try {
@@ -1485,177 +1546,177 @@ function Jn(t) {
1485
1546
  }
1486
1547
  return e;
1487
1548
  }
1488
- var Xn = Array.prototype, Zn = Function.prototype, ot = Object.prototype, ge = Ce["__core-js_shared__"], Te = function() {
1489
- var t = /[^.]+$/.exec(ge && ge.keys && ge.keys.IE_PROTO || "");
1549
+ var Zn = Array.prototype, er = Function.prototype, it = Object.prototype, he = we["__core-js_shared__"], De = function() {
1550
+ var t = /[^.]+$/.exec(he && he.keys && he.keys.IE_PROTO || "");
1490
1551
  return t ? "Symbol(src)_1." + t : "";
1491
- }(), it = Zn.toString, we = ot.hasOwnProperty, at = ot.toString, er = RegExp(
1492
- "^" + it.call(we).replace(Kn, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
1493
- ), De = Ce.Symbol, tr = Xn.splice, nr = ct(Ce, "Map"), X = ct(Object, "create"), Ne = De ? De.prototype : void 0, Pe = Ne ? Ne.toString : void 0;
1494
- function H(t) {
1552
+ }(), at = er.toString, ve = it.hasOwnProperty, ct = it.toString, tr = RegExp(
1553
+ "^" + at.call(ve).replace(Hn, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
1554
+ ), Ne = we.Symbol, nr = Zn.splice, rr = ut(we, "Map"), Z = ut(Object, "create"), Pe = Ne ? Ne.prototype : void 0, xe = Pe ? Pe.toString : void 0;
1555
+ function z(t) {
1495
1556
  var e = -1, n = t ? t.length : 0;
1496
1557
  for (this.clear(); ++e < n; ) {
1497
1558
  var r = t[e];
1498
1559
  this.set(r[0], r[1]);
1499
1560
  }
1500
1561
  }
1501
- function rr() {
1502
- this.__data__ = X ? X(null) : {};
1562
+ function sr() {
1563
+ this.__data__ = Z ? Z(null) : {};
1503
1564
  }
1504
- function sr(t) {
1565
+ function or(t) {
1505
1566
  return this.has(t) && delete this.__data__[t];
1506
1567
  }
1507
- function or(t) {
1568
+ function ir(t) {
1508
1569
  var e = this.__data__;
1509
- if (X) {
1570
+ if (Z) {
1510
1571
  var n = e[t];
1511
- return n === st ? void 0 : n;
1572
+ return n === ot ? void 0 : n;
1512
1573
  }
1513
- return we.call(e, t) ? e[t] : void 0;
1574
+ return ve.call(e, t) ? e[t] : void 0;
1514
1575
  }
1515
- function ir(t) {
1576
+ function ar(t) {
1516
1577
  var e = this.__data__;
1517
- return X ? e[t] !== void 0 : we.call(e, t);
1578
+ return Z ? e[t] !== void 0 : ve.call(e, t);
1518
1579
  }
1519
- function ar(t, e) {
1580
+ function cr(t, e) {
1520
1581
  var n = this.__data__;
1521
- return n[t] = X && e === void 0 ? st : e, this;
1522
- }
1523
- H.prototype.clear = rr;
1524
- H.prototype.delete = sr;
1525
- H.prototype.get = or;
1526
- H.prototype.has = ir;
1527
- H.prototype.set = ar;
1528
- function J(t) {
1582
+ return n[t] = Z && e === void 0 ? ot : e, this;
1583
+ }
1584
+ z.prototype.clear = sr;
1585
+ z.prototype.delete = or;
1586
+ z.prototype.get = ir;
1587
+ z.prototype.has = ar;
1588
+ z.prototype.set = cr;
1589
+ function X(t) {
1529
1590
  var e = -1, n = t ? t.length : 0;
1530
1591
  for (this.clear(); ++e < n; ) {
1531
1592
  var r = t[e];
1532
1593
  this.set(r[0], r[1]);
1533
1594
  }
1534
1595
  }
1535
- function cr() {
1596
+ function ur() {
1536
1597
  this.__data__ = [];
1537
1598
  }
1538
- function ur(t) {
1539
- var e = this.__data__, n = ae(e, t);
1599
+ function lr(t) {
1600
+ var e = this.__data__, n = ce(e, t);
1540
1601
  if (n < 0)
1541
1602
  return !1;
1542
1603
  var r = e.length - 1;
1543
- return n == r ? e.pop() : tr.call(e, n, 1), !0;
1604
+ return n == r ? e.pop() : nr.call(e, n, 1), !0;
1544
1605
  }
1545
- function lr(t) {
1546
- var e = this.__data__, n = ae(e, t);
1606
+ function dr(t) {
1607
+ var e = this.__data__, n = ce(e, t);
1547
1608
  return n < 0 ? void 0 : e[n][1];
1548
1609
  }
1549
- function dr(t) {
1550
- return ae(this.__data__, t) > -1;
1610
+ function fr(t) {
1611
+ return ce(this.__data__, t) > -1;
1551
1612
  }
1552
- function fr(t, e) {
1553
- var n = this.__data__, r = ae(n, t);
1613
+ function pr(t, e) {
1614
+ var n = this.__data__, r = ce(n, t);
1554
1615
  return r < 0 ? n.push([t, e]) : n[r][1] = e, this;
1555
1616
  }
1556
- J.prototype.clear = cr;
1557
- J.prototype.delete = ur;
1558
- J.prototype.get = lr;
1559
- J.prototype.has = dr;
1560
- J.prototype.set = fr;
1561
- function z(t) {
1617
+ X.prototype.clear = ur;
1618
+ X.prototype.delete = lr;
1619
+ X.prototype.get = dr;
1620
+ X.prototype.has = fr;
1621
+ X.prototype.set = pr;
1622
+ function V(t) {
1562
1623
  var e = -1, n = t ? t.length : 0;
1563
1624
  for (this.clear(); ++e < n; ) {
1564
1625
  var r = t[e];
1565
1626
  this.set(r[0], r[1]);
1566
1627
  }
1567
1628
  }
1568
- function pr() {
1629
+ function gr() {
1569
1630
  this.__data__ = {
1570
- hash: new H(),
1571
- map: new (nr || J)(),
1572
- string: new H()
1631
+ hash: new z(),
1632
+ map: new (rr || X)(),
1633
+ string: new z()
1573
1634
  };
1574
1635
  }
1575
- function gr(t) {
1576
- return ce(this, t).delete(t);
1636
+ function hr(t) {
1637
+ return ue(this, t).delete(t);
1577
1638
  }
1578
1639
  function yr(t) {
1579
- return ce(this, t).get(t);
1640
+ return ue(this, t).get(t);
1580
1641
  }
1581
- function hr(t) {
1582
- return ce(this, t).has(t);
1642
+ function mr(t) {
1643
+ return ue(this, t).has(t);
1583
1644
  }
1584
- function mr(t, e) {
1585
- return ce(this, t).set(t, e), this;
1645
+ function Er(t, e) {
1646
+ return ue(this, t).set(t, e), this;
1586
1647
  }
1587
- z.prototype.clear = pr;
1588
- z.prototype.delete = gr;
1589
- z.prototype.get = yr;
1590
- z.prototype.has = hr;
1591
- z.prototype.set = mr;
1592
- function ae(t, e) {
1648
+ V.prototype.clear = gr;
1649
+ V.prototype.delete = hr;
1650
+ V.prototype.get = yr;
1651
+ V.prototype.has = mr;
1652
+ V.prototype.set = Er;
1653
+ function ce(t, e) {
1593
1654
  for (var n = t.length; n--; )
1594
- if (Ar(t[n][0], e))
1655
+ if (Tr(t[n][0], e))
1595
1656
  return n;
1596
1657
  return -1;
1597
1658
  }
1598
- function Er(t, e) {
1599
- e = wr(e, t) ? [e] : Cr(e);
1659
+ function Sr(t, e) {
1660
+ e = vr(e, t) ? [e] : wr(e);
1600
1661
  for (var n = 0, r = e.length; t != null && n < r; )
1601
- t = t[Ir(e[n++])];
1662
+ t = t[Or(e[n++])];
1602
1663
  return n && n == r ? t : void 0;
1603
1664
  }
1604
- function Sr(t) {
1605
- if (!lt(t) || vr(t))
1665
+ function _r(t) {
1666
+ if (!dt(t) || Rr(t))
1606
1667
  return !1;
1607
- var e = Fr(t) || Jn(t) ? er : Hn;
1608
- return e.test(Or(t));
1668
+ var e = Fr(t) || Xn(t) ? tr : zn;
1669
+ return e.test(Ar(t));
1609
1670
  }
1610
- function _r(t) {
1671
+ function Cr(t) {
1611
1672
  if (typeof t == "string")
1612
1673
  return t;
1613
- if (ve(t))
1614
- return Pe ? Pe.call(t) : "";
1674
+ if (Re(t))
1675
+ return xe ? xe.call(t) : "";
1615
1676
  var e = t + "";
1616
1677
  return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
1617
1678
  }
1618
- function Cr(t) {
1619
- return ut(t) ? t : Rr(t);
1679
+ function wr(t) {
1680
+ return lt(t) ? t : Ir(t);
1620
1681
  }
1621
- function ce(t, e) {
1682
+ function ue(t, e) {
1622
1683
  var n = t.__data__;
1623
1684
  return br(e) ? n[typeof e == "string" ? "string" : "hash"] : n.map;
1624
1685
  }
1625
- function ct(t, e) {
1626
- var n = Yn(t, e);
1627
- return Sr(n) ? n : void 0;
1686
+ function ut(t, e) {
1687
+ var n = Jn(t, e);
1688
+ return _r(n) ? n : void 0;
1628
1689
  }
1629
- function wr(t, e) {
1630
- if (ut(t))
1690
+ function vr(t, e) {
1691
+ if (lt(t))
1631
1692
  return !1;
1632
1693
  var n = typeof t;
1633
- return n == "number" || n == "symbol" || n == "boolean" || t == null || ve(t) ? !0 : Gn.test(t) || !Wn.test(t) || e != null && t in Object(e);
1694
+ return n == "number" || n == "symbol" || n == "boolean" || t == null || Re(t) ? !0 : jn.test(t) || !Gn.test(t) || e != null && t in Object(e);
1634
1695
  }
1635
1696
  function br(t) {
1636
1697
  var e = typeof t;
1637
1698
  return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
1638
1699
  }
1639
- function vr(t) {
1640
- return !!Te && Te in t;
1700
+ function Rr(t) {
1701
+ return !!De && De in t;
1641
1702
  }
1642
- var Rr = be(function(t) {
1643
- t = Dr(t);
1703
+ var Ir = be(function(t) {
1704
+ t = Nr(t);
1644
1705
  var e = [];
1645
- return jn.test(t) && e.push(""), t.replace(Qn, function(n, r, s, i) {
1706
+ return Qn.test(t) && e.push(""), t.replace(Kn, function(n, r, s, i) {
1646
1707
  e.push(s ? i.replace(Bn, "$1") : r || n);
1647
1708
  }), e;
1648
1709
  });
1649
- function Ir(t) {
1650
- if (typeof t == "string" || ve(t))
1710
+ function Or(t) {
1711
+ if (typeof t == "string" || Re(t))
1651
1712
  return t;
1652
1713
  var e = t + "";
1653
1714
  return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
1654
1715
  }
1655
- function Or(t) {
1716
+ function Ar(t) {
1656
1717
  if (t != null) {
1657
1718
  try {
1658
- return it.call(t);
1719
+ return at.call(t);
1659
1720
  } catch {
1660
1721
  }
1661
1722
  try {
@@ -1675,52 +1736,52 @@ function be(t, e) {
1675
1736
  var o = t.apply(this, r);
1676
1737
  return n.cache = i.set(s, o), o;
1677
1738
  };
1678
- return n.cache = new (be.Cache || z)(), n;
1739
+ return n.cache = new (be.Cache || V)(), n;
1679
1740
  }
1680
- be.Cache = z;
1681
- function Ar(t, e) {
1741
+ be.Cache = V;
1742
+ function Tr(t, e) {
1682
1743
  return t === e || t !== t && e !== e;
1683
1744
  }
1684
- var ut = Array.isArray;
1745
+ var lt = Array.isArray;
1685
1746
  function Fr(t) {
1686
- var e = lt(t) ? at.call(t) : "";
1687
- return e == Mn || e == kn;
1747
+ var e = dt(t) ? ct.call(t) : "";
1748
+ return e == Mn || e == $n;
1688
1749
  }
1689
- function lt(t) {
1750
+ function dt(t) {
1690
1751
  var e = typeof t;
1691
1752
  return !!t && (e == "object" || e == "function");
1692
1753
  }
1693
- function Tr(t) {
1754
+ function Dr(t) {
1694
1755
  return !!t && typeof t == "object";
1695
1756
  }
1696
- function ve(t) {
1697
- return typeof t == "symbol" || Tr(t) && at.call(t) == $n;
1757
+ function Re(t) {
1758
+ return typeof t == "symbol" || Dr(t) && ct.call(t) == Wn;
1698
1759
  }
1699
- function Dr(t) {
1700
- return t == null ? "" : _r(t);
1760
+ function Nr(t) {
1761
+ return t == null ? "" : Cr(t);
1701
1762
  }
1702
- function Nr(t, e, n) {
1703
- var r = t == null ? void 0 : Er(t, e);
1763
+ function Pr(t, e, n) {
1764
+ var r = t == null ? void 0 : Sr(t, e);
1704
1765
  return r === void 0 ? n : r;
1705
1766
  }
1706
- var Pr = Nr;
1707
- const ne = /* @__PURE__ */ Un(Pr);
1708
- function xr(t, e, n) {
1767
+ var xr = Pr;
1768
+ const re = /* @__PURE__ */ kn(xr);
1769
+ function Lr(t, e, n) {
1709
1770
  const r = t ?? { result: [], success: !0, totalCount: 0 }, s = [...r.result ?? []];
1710
1771
  for (const i of e) {
1711
- const o = ne(i.payload.data, n);
1772
+ const o = re(i.payload.data, n);
1712
1773
  switch (i.type) {
1713
1774
  case "ADD": {
1714
- s.findIndex((c) => ne(c, n) === o) === -1 && s.push(i.payload.data);
1775
+ s.findIndex((c) => re(c, n) === o) === -1 && s.push(i.payload.data);
1715
1776
  break;
1716
1777
  }
1717
1778
  case "UPDATE": {
1718
- const a = s.findIndex((c) => ne(c, n) === o);
1779
+ const a = s.findIndex((c) => re(c, n) === o);
1719
1780
  a !== -1 && (s[a] = i.payload.data);
1720
1781
  break;
1721
1782
  }
1722
1783
  case "DELETE": {
1723
- const a = s.findIndex((c) => ne(c, n) === o);
1784
+ const a = s.findIndex((c) => re(c, n) === o);
1724
1785
  a !== -1 && s.splice(a, 1);
1725
1786
  break;
1726
1787
  }
@@ -1728,103 +1789,103 @@ function xr(t, e, n) {
1728
1789
  }
1729
1790
  return { ...r, result: s };
1730
1791
  }
1731
- function Lr(t, e, n, r, s, i) {
1732
- const o = (i == null ? void 0 : i.syncWindowMs) ?? 500, a = k([]), c = k(null), l = k(null), u = k(s);
1792
+ function Ur(t, e, n, r, s, i) {
1793
+ const o = (i == null ? void 0 : i.syncWindowMs) ?? 500, a = M([]), c = M(null), l = M(null), u = M(s);
1733
1794
  u.current = s;
1734
1795
  const d = U(() => {
1735
- const p = a.current;
1736
- if (a.current = [], c.current !== null && (clearTimeout(c.current), c.current = null), l.current !== null && (cancelAnimationFrame(l.current), l.current = null), !(p.length === 0 || !r)) {
1796
+ const h = a.current;
1797
+ if (a.current = [], c.current !== null && (clearTimeout(c.current), c.current = null), l.current !== null && (cancelAnimationFrame(l.current), l.current = null), !(h.length === 0 || !r)) {
1737
1798
  t.setQueryData(
1738
1799
  e,
1739
- (h) => xr(h, p, r)
1800
+ (E) => Lr(E, h, r)
1740
1801
  );
1741
- for (const h of p)
1742
- (h.type === "ADD" || h.type === "UPDATE") && t.setQueryData(
1743
- n(h.payload.id, h.payload.namespace),
1744
- { result: h.payload.data }
1802
+ for (const E of h)
1803
+ (E.type === "ADD" || E.type === "UPDATE") && t.setQueryData(
1804
+ n(E.payload.id, E.payload.namespace),
1805
+ { result: E.payload.data }
1745
1806
  );
1746
1807
  }
1747
- }, [t, e, n, r]), f = U(
1748
- (p) => {
1749
- a.current.push(p), !(c.current !== null || l.current !== null) && (c.current = setTimeout(d, o), u.current !== 1 && (l.current = requestAnimationFrame(d)));
1808
+ }, [t, e, n, r]), g = U(
1809
+ (h) => {
1810
+ a.current.push(h), !(c.current !== null || l.current !== null) && (c.current = setTimeout(d, o), u.current !== 1 && (l.current = requestAnimationFrame(d)));
1750
1811
  },
1751
1812
  [d, o]
1752
1813
  );
1753
1814
  return W(() => () => {
1754
1815
  c.current !== null && (clearTimeout(c.current), c.current = null), l.current !== null && (cancelAnimationFrame(l.current), l.current = null);
1755
- }, []), f;
1816
+ }, []), g;
1756
1817
  }
1757
- const Os = ({
1818
+ const As = ({
1758
1819
  pluginID: t,
1759
1820
  connectionID: e,
1760
1821
  resourceKey: n,
1761
1822
  idAccessor: r,
1762
1823
  namespaces: s
1763
1824
  }) => {
1764
- const i = A(t), o = K(), { showSnackbar: a } = G(), c = _.useMemo(() => s ?? [], [s]), l = _.useMemo(
1825
+ const i = T(t), o = K(), { showSnackbar: a } = G(), c = C.useMemo(() => s ?? [], [s]), l = C.useMemo(
1765
1826
  () => [i, e, n, c, "list"],
1766
1827
  [i, e, n, c]
1767
- ), u = _.useCallback(
1768
- (g, y) => [i, e, n, y, g],
1828
+ ), u = C.useCallback(
1829
+ (f, p) => [i, e, n, p, f],
1769
1830
  [i, e, n]
1770
- ), { mutateAsync: d } = N({
1771
- mutationFn: async (g) => $e(i, e, n, Qe.createFrom({
1772
- input: g.input,
1773
- namespace: g.namespace ?? (c.length === 1 ? c[0] : "")
1831
+ ), { mutateAsync: d } = P({
1832
+ mutationFn: async (f) => We(i, e, n, Ke.createFrom({
1833
+ input: f.input,
1834
+ namespace: f.namespace ?? (c.length === 1 ? c[0] : "")
1774
1835
  })),
1775
- onSuccess: async (g) => {
1776
- var b;
1777
- const y = g == null ? void 0 : g.result;
1836
+ onSuccess: async (f) => {
1837
+ var v;
1838
+ const p = f == null ? void 0 : f.result;
1778
1839
  let w = "";
1779
- (b = y == null ? void 0 : y.metadata) != null && b.name ? w = y.metadata.name : y != null && y.id ? w = y.id : y != null && y.name ? w = y.name : y != null && y.ID ? w = y.ID : y != null && y.Name && (w = y.Name);
1840
+ (v = p == null ? void 0 : p.metadata) != null && v.name ? w = p.metadata.name : p != null && p.id ? w = p.id : p != null && p.name ? w = p.name : p != null && p.ID ? w = p.ID : p != null && p.Name && (w = p.Name);
1780
1841
  const m = w ? `Resource ${w} created` : "Resource created";
1781
1842
  a(m, "success"), await o.invalidateQueries({ queryKey: l });
1782
1843
  },
1783
- onError: q(a, "Failed to create resource")
1784
- }), f = D({
1844
+ onError: k(a, "Failed to create resource")
1845
+ }), g = N({
1785
1846
  queryKey: l,
1786
- queryFn: async () => ke(i, e, n, je.createFrom({
1847
+ queryFn: async () => $e(i, e, n, Qe.createFrom({
1787
1848
  order: [{ field: "name", descending: !1 }],
1788
1849
  pagination: { page: 1, pageSize: 200 },
1789
1850
  namespaces: c
1790
1851
  })),
1791
- placeholderData: (g, y) => g,
1852
+ placeholderData: (f, p) => f,
1792
1853
  retry: !1
1793
- }), [p, h] = _.useState(
1854
+ }), [h, E] = C.useState(
1794
1855
  I.WatchStateIdle
1795
1856
  );
1796
- _.useEffect(() => T(
1857
+ C.useEffect(() => D(
1797
1858
  `${i}/${e}/watch/STATE`,
1798
- (y) => {
1799
- const w = y.data;
1800
- w.resourceKey === n && h(w.state);
1859
+ (p) => {
1860
+ const w = p.data;
1861
+ w.resourceKey === n && E(w.state);
1801
1862
  }
1802
1863
  ), [i, e, n]);
1803
- const E = Lr(o, l, u, r, p);
1804
- return _.useEffect(() => {
1864
+ const y = Ur(o, l, u, r, h);
1865
+ return C.useEffect(() => {
1805
1866
  if (!r)
1806
1867
  return;
1807
- Jt(i, e, n);
1808
- const g = T(
1868
+ Xt(i, e, n);
1869
+ const f = D(
1809
1870
  `${i}/${e}/${n}/ADD`,
1810
- (m) => E({ type: "ADD", payload: m.data })
1811
- ), y = T(
1871
+ (m) => y({ type: "ADD", payload: m.data })
1872
+ ), p = D(
1812
1873
  `${i}/${e}/${n}/UPDATE`,
1813
- (m) => E({ type: "UPDATE", payload: m.data })
1814
- ), w = T(
1874
+ (m) => y({ type: "UPDATE", payload: m.data })
1875
+ ), w = D(
1815
1876
  `${i}/${e}/${n}/DELETE`,
1816
- (m) => E({ type: "DELETE", payload: m.data })
1877
+ (m) => y({ type: "DELETE", payload: m.data })
1817
1878
  );
1818
1879
  return () => {
1819
- g(), y(), w(), Xt(i, e, n);
1880
+ f(), p(), w(), Zt(i, e, n);
1820
1881
  };
1821
- }, [i, e, n, E]), {
1882
+ }, [i, e, n, y]), {
1822
1883
  /**
1823
1884
  * Fetch result for the resource. The client will automatically cache the result, and update the cache
1824
1885
  * when the resources are updated or deleted via the returned create and remove mutation functions, or
1825
1886
  * the per-resource hook mutation functions.
1826
1887
  */
1827
- resources: f,
1888
+ resources: g,
1828
1889
  /**
1829
1890
  * Create a new resource. A set of optional parameters can be passed to customize the create behavior,
1830
1891
  * which if specified, will add additional default behavior set via the hook options.
@@ -1833,21 +1894,21 @@ const Os = ({
1833
1894
  */
1834
1895
  create: d,
1835
1896
  /** Current watch state for this resource type */
1836
- watchState: p,
1897
+ watchState: h,
1837
1898
  /** Whether the watch is currently syncing */
1838
- isSyncing: p === I.WatchStateSyncing,
1899
+ isSyncing: h === I.WatchStateSyncing,
1839
1900
  /** Whether the watch has fully synced */
1840
- isSynced: p === I.WatchStateSynced,
1901
+ isSynced: h === I.WatchStateSynced,
1841
1902
  /** Whether the watch encountered an error */
1842
- watchError: p === I.WatchStateError
1903
+ watchError: h === I.WatchStateError
1843
1904
  };
1844
- }, As = ({ pluginID: t }) => {
1845
- const e = A(t), { showSnackbar: n } = G(), r = N({
1846
- mutationFn: async ({ opts: o, input: a }) => $e(
1905
+ }, Ts = ({ pluginID: t }) => {
1906
+ const e = T(t), { showSnackbar: n } = G(), r = P({
1907
+ mutationFn: async ({ opts: o, input: a }) => We(
1847
1908
  e,
1848
1909
  o.connectionID,
1849
1910
  o.resourceKey,
1850
- Qe.createFrom({
1911
+ Ke.createFrom({
1851
1912
  input: a.input,
1852
1913
  namespace: a.namespace ?? o.namespace ?? ""
1853
1914
  })
@@ -1858,12 +1919,12 @@ const Os = ({
1858
1919
  onError(o, { opts: a }) {
1859
1920
  B(n, o, `Failed to create resource ${a.resourceID}`);
1860
1921
  }
1861
- }), s = N({
1922
+ }), s = P({
1862
1923
  mutationFn: async ({ opts: o, input: a }) => qe(
1863
1924
  e,
1864
1925
  o.connectionID,
1865
1926
  o.resourceKey,
1866
- We.createFrom({
1927
+ Ge.createFrom({
1867
1928
  input: a.input,
1868
1929
  id: o.resourceID,
1869
1930
  namespace: o.namespace ?? ""
@@ -1875,12 +1936,12 @@ const Os = ({
1875
1936
  onError(o, { opts: a }) {
1876
1937
  B(n, o, `Failed to update resource ${a.resourceID}`);
1877
1938
  }
1878
- }), i = N({
1939
+ }), i = P({
1879
1940
  mutationFn: async ({ opts: o, input: a }) => Me(
1880
1941
  e,
1881
1942
  o.connectionID,
1882
1943
  o.resourceKey,
1883
- Ge.createFrom({
1944
+ je.createFrom({
1884
1945
  id: o.resourceID,
1885
1946
  namespace: o.namespace ?? "",
1886
1947
  gracePeriodSeconds: a.gracePeriodSeconds
@@ -1904,9 +1965,9 @@ const Os = ({
1904
1965
  resourceKey: n,
1905
1966
  enabled: r = !0
1906
1967
  }) => {
1907
- const s = A(t), i = D({
1968
+ const s = T(t), i = N({
1908
1969
  queryKey: ["RESOURCE_ACTIONS", s, e, n],
1909
- queryFn: () => Zt(s, e, n),
1970
+ queryFn: () => en(s, e, n),
1910
1971
  enabled: r && !!s && !!e && !!n,
1911
1972
  staleTime: 5 * 60 * 1e3
1912
1973
  // actions don't change often
@@ -1916,18 +1977,18 @@ const Os = ({
1916
1977
  isLoading: i.isLoading,
1917
1978
  error: i.error
1918
1979
  };
1919
- }, Ts = ({
1980
+ }, Ds = ({
1920
1981
  pluginID: t,
1921
1982
  connectionID: e,
1922
1983
  resourceKey: n
1923
1984
  }) => {
1924
- const r = A(t), s = K(), { showSnackbar: i } = G(), o = N({
1925
- mutationFn: async ({ actionID: a, id: c = "", namespace: l = "", params: u = {} }) => en(
1985
+ const r = T(t), s = K(), { showSnackbar: i } = G(), o = P({
1986
+ mutationFn: async ({ actionID: a, id: c = "", namespace: l = "", params: u = {} }) => tn(
1926
1987
  r,
1927
1988
  e,
1928
1989
  n,
1929
1990
  a,
1930
- Ke.createFrom({ id: c, namespace: l, params: u })
1991
+ He.createFrom({ id: c, namespace: l, params: u })
1931
1992
  ),
1932
1993
  onSuccess: (a) => {
1933
1994
  a != null && a.message && i(a.message, "success"), s.invalidateQueries({
@@ -1943,14 +2004,14 @@ const Os = ({
1943
2004
  isExecuting: o.isPending,
1944
2005
  error: o.error
1945
2006
  };
1946
- }, Ds = ({
2007
+ }, Ns = ({
1947
2008
  pluginID: t,
1948
2009
  connectionID: e,
1949
2010
  enabled: n = !0
1950
2011
  }) => {
1951
- const r = A(t), s = D({
2012
+ const r = T(t), s = N({
1952
2013
  queryKey: ["EDITOR_SCHEMAS", r, e],
1953
- queryFn: () => tn(r, e),
2014
+ queryFn: () => nn(r, e),
1954
2015
  enabled: n && !!r && !!e,
1955
2016
  staleTime: 10 * 60 * 1e3,
1956
2017
  // schemas are fairly stable per connection
@@ -1962,83 +2023,83 @@ const Os = ({
1962
2023
  error: s.error,
1963
2024
  refetch: s.refetch
1964
2025
  };
1965
- }, Ns = ({
2026
+ }, Ps = ({
1966
2027
  pluginID: t,
1967
2028
  connectionID: e,
1968
2029
  enabled: n = !0
1969
2030
  }) => {
1970
- const r = A(t), s = K(), i = [r, e, "watch-state"], o = k([]), a = k(!1), c = U((f) => {
1971
- s.setQueryData(i, (p) => {
1972
- if (!p) return p;
1973
- const h = { ...p.resources, [f.resourceKey]: f.state }, E = { ...p.resourceCounts, [f.resourceKey]: f.resourceCount };
1974
- let g = 0, y = 0;
1975
- for (const w of Object.values(h))
1976
- w === I.WatchStateSynced && g++, (w === I.WatchStateError || w === I.WatchStateFailed) && y++;
1977
- return { ...p, resources: h, resourceCounts: E, totalResources: Object.keys(h).length, syncedCount: g, errorCount: y };
2031
+ const r = T(t), s = K(), i = [r, e, "watch-state"], o = M([]), a = M(!1), c = U((g) => {
2032
+ s.setQueryData(i, (h) => {
2033
+ if (!h) return h;
2034
+ const E = { ...h.resources, [g.resourceKey]: g.state }, y = { ...h.resourceCounts, [g.resourceKey]: g.resourceCount };
2035
+ let f = 0, p = 0;
2036
+ for (const w of Object.values(E))
2037
+ w === I.WatchStateSynced && f++, (w === I.WatchStateError || w === I.WatchStateFailed) && p++;
2038
+ return { ...h, resources: E, resourceCounts: y, totalResources: Object.keys(E).length, syncedCount: f, errorCount: p };
1978
2039
  });
1979
- }, [s, r, e]), l = D({
2040
+ }, [s, r, e]), l = N({
1980
2041
  queryKey: i,
1981
2042
  queryFn: async () => {
1982
- const f = await nn(r, e);
1983
- if (!f) throw new Error("Failed to get watch state: null response");
1984
- const p = {};
1985
- let h = 0, E = 0;
1986
- for (const [y, w] of Object.entries(f.resources ?? {}))
1987
- w != null && (p[y] = w, w === I.WatchStateSynced && h++, w === I.WatchStateError && E++);
1988
- const g = {};
1989
- for (const [y, w] of Object.entries(f.resourceCounts ?? {}))
1990
- w != null && (g[y] = w);
2043
+ const g = await rn(r, e);
2044
+ if (!g) throw new Error("Failed to get watch state: null response");
2045
+ const h = {};
2046
+ let E = 0, y = 0;
2047
+ for (const [p, w] of Object.entries(g.resources ?? {}))
2048
+ w != null && (h[p] = w, w === I.WatchStateSynced && E++, w === I.WatchStateError && y++);
2049
+ const f = {};
2050
+ for (const [p, w] of Object.entries(g.resourceCounts ?? {}))
2051
+ w != null && (f[p] = w);
1991
2052
  return {
1992
- connection: f.connectionId,
1993
- resources: p,
1994
- resourceCounts: g,
1995
- totalResources: Object.keys(p).length,
1996
- syncedCount: h,
1997
- errorCount: E
2053
+ connection: g.connectionId,
2054
+ resources: h,
2055
+ resourceCounts: f,
2056
+ totalResources: Object.keys(h).length,
2057
+ syncedCount: E,
2058
+ errorCount: y
1998
2059
  };
1999
2060
  },
2000
2061
  enabled: n && !!r && !!e,
2001
- refetchInterval: (f) => {
2002
- const p = f.state.data;
2003
- if (!p || p.totalResources === 0) return 3e3;
2004
- let h = 0;
2005
- for (const E of Object.values(p.resources))
2006
- (E === I.WatchStateSynced || E === I.WatchStateError || E === I.WatchStateStopped || E === I.WatchStateFailed || E === I.WatchStateForbidden || E === I.WatchStateSkipped) && h++;
2007
- return h >= p.totalResources ? !1 : 3e3;
2062
+ refetchInterval: (g) => {
2063
+ const h = g.state.data;
2064
+ if (!h || h.totalResources === 0) return 3e3;
2065
+ let E = 0;
2066
+ for (const y of Object.values(h.resources))
2067
+ (y === I.WatchStateSynced || y === I.WatchStateError || y === I.WatchStateStopped || y === I.WatchStateFailed || y === I.WatchStateForbidden || y === I.WatchStateSkipped) && E++;
2068
+ return E >= h.totalResources ? !1 : 3e3;
2008
2069
  }
2009
2070
  });
2010
2071
  W(() => {
2011
2072
  if (!l.data || a.current) return;
2012
2073
  a.current = !0;
2013
- const f = o.current;
2074
+ const g = o.current;
2014
2075
  o.current = [];
2015
- for (const p of f)
2016
- c(p);
2076
+ for (const h of g)
2077
+ c(h);
2017
2078
  }, [l.data, c]), W(() => {
2018
2079
  if (!n || !r || !e)
2019
2080
  return;
2020
2081
  a.current = !1, o.current = [];
2021
- const f = T(
2082
+ const g = D(
2022
2083
  `${r}/${e}/watch/STATE`,
2023
- (p) => {
2024
- const h = p.data;
2025
- a.current ? c(h) : o.current.push(h);
2084
+ (h) => {
2085
+ const E = h.data;
2086
+ a.current ? c(E) : o.current.push(E);
2026
2087
  }
2027
2088
  );
2028
2089
  return () => {
2029
- f(), a.current = !1, o.current = [];
2090
+ g(), a.current = !1, o.current = [];
2030
2091
  };
2031
2092
  }, [r, e, n, c]);
2032
2093
  const u = l.data;
2033
2094
  let d = 0;
2034
2095
  if (u != null && u.resources)
2035
- for (const f of Object.values(u.resources))
2036
- (f === I.WatchStateSynced || f === I.WatchStateError || f === I.WatchStateStopped || f === I.WatchStateFailed || f === I.WatchStateForbidden || f === I.WatchStateSkipped) && d++;
2096
+ for (const g of Object.values(u.resources))
2097
+ (g === I.WatchStateSynced || g === I.WatchStateError || g === I.WatchStateStopped || g === I.WatchStateFailed || g === I.WatchStateForbidden || g === I.WatchStateSkipped) && d++;
2037
2098
  return {
2038
2099
  /** Full summary query result */
2039
2100
  summary: l,
2040
2101
  /** Get the state of a specific resource type's watch */
2041
- getResourceState: (f) => u == null ? void 0 : u.resources[f],
2102
+ getResourceState: (g) => u == null ? void 0 : u.resources[g],
2042
2103
  /** Whether all registered watches have reached a terminal state */
2043
2104
  isFullySynced: u ? u.totalResources > 0 && d === u.totalResources : !1,
2044
2105
  /** Sync progress as a 0-1 fraction (terminal states / total) */
@@ -2046,31 +2107,31 @@ const Os = ({
2046
2107
  /** Number of watches that encountered errors */
2047
2108
  errorCount: (u == null ? void 0 : u.errorCount) ?? 0
2048
2109
  };
2049
- }, Ps = () => {
2050
- const [t, e] = j(/* @__PURE__ */ new Map()), n = k(/* @__PURE__ */ new Map()), r = k(/* @__PURE__ */ new Map()), s = U((l) => {
2051
- const u = l.data, d = _e(u), f = nt(n.current, u), p = me(f);
2052
- if (e((h) => {
2053
- const E = new Map(h);
2054
- return E.set(d, p), E;
2055
- }), r.current.has(d) && (clearTimeout(r.current.get(d)), r.current.delete(d)), oe(p)) {
2056
- const h = setTimeout(() => {
2057
- e((E) => {
2058
- const g = new Map(E);
2059
- return g.delete(d), g;
2110
+ }, xs = () => {
2111
+ const [t, e] = j(/* @__PURE__ */ new Map()), n = M(/* @__PURE__ */ new Map()), r = M(/* @__PURE__ */ new Map()), s = U((l) => {
2112
+ const u = l.data, d = Ce(u), g = rt(n.current, u), h = Ee(g);
2113
+ if (e((E) => {
2114
+ const y = new Map(E);
2115
+ return y.set(d, h), y;
2116
+ }), r.current.has(d) && (clearTimeout(r.current.get(d)), r.current.delete(d)), ie(h)) {
2117
+ const E = setTimeout(() => {
2118
+ e((y) => {
2119
+ const f = new Map(y);
2120
+ return f.delete(d), f;
2060
2121
  }), n.current.delete(d), r.current.delete(d);
2061
2122
  }, 5e3);
2062
- r.current.set(d, h);
2123
+ r.current.set(d, E);
2063
2124
  }
2064
2125
  }, []);
2065
2126
  W(() => {
2066
- const l = T("watch/STATE", s);
2127
+ const l = D("watch/STATE", s);
2067
2128
  return () => {
2068
2129
  l();
2069
2130
  for (const u of r.current.values())
2070
2131
  clearTimeout(u);
2071
2132
  };
2072
2133
  }, [s]);
2073
- const i = Array.from(t.values()), o = et(i), a = i.find((l) => !oe(l)) ?? i[0] ?? null, c = tt(i);
2134
+ const i = Array.from(t.values()), o = tt(i), a = i.find((l) => !ie(l)) ?? i[0] ?? null, c = nt(i);
2074
2135
  return {
2075
2136
  /** All tracked syncs */
2076
2137
  syncs: i,
@@ -2081,57 +2142,57 @@ const Os = ({
2081
2142
  /** Aggregate progress across all connections (0-1) */
2082
2143
  aggregateProgress: c
2083
2144
  };
2084
- }, Ur = () => {
2085
- const t = _.useContext(Ye);
2145
+ }, kr = () => {
2146
+ const t = C.useContext(Je);
2086
2147
  if (!t) throw new Error("useOperations must be used within an OperationsProvider");
2087
2148
  return t;
2088
- }, xs = ({ pluginID: t, connectionID: e, resourceKey: n }) => {
2089
- const r = A(t), { showSnackbar: s } = G(), { addOperation: i, updateOperation: o } = Ur(), a = _.useRef(/* @__PURE__ */ new Set()), c = _.useCallback((d, f = !1) => {
2090
- var p, h, E;
2091
- d.disposed || (d.disposed = !0, (p = d.unsubscribe) == null || p.call(d), (h = d.open) == null || h.cancel(), (E = d.attach) == null || E.cancel(), d.handle && (Oe(d.handle).catch(() => {
2092
- }), f && o(d.handle, { status: "cancelled", message: "Cancelled", completedAt: Date.now() })), a.current.delete(d));
2149
+ }, Ls = ({ pluginID: t, connectionID: e, resourceKey: n }) => {
2150
+ const r = T(t), { showSnackbar: s } = G(), { addOperation: i, updateOperation: o } = kr(), a = C.useRef(/* @__PURE__ */ new Set()), c = C.useCallback((d, g = !1) => {
2151
+ var h, E, y;
2152
+ d.disposed || (d.disposed = !0, (h = d.unsubscribe) == null || h.call(d), (E = d.open) == null || E.cancel(), (y = d.attach) == null || y.cancel(), d.handle && (Ae(d.handle).catch(() => {
2153
+ }), g && o(d.handle, { status: "cancelled", message: "Cancelled", completedAt: Date.now() })), a.current.delete(d));
2093
2154
  }, [o]);
2094
- _.useEffect(() => () => {
2155
+ C.useEffect(() => () => {
2095
2156
  for (const d of a.current) c(d, !0);
2096
2157
  }, [r, e, n, c]);
2097
- const l = _.useCallback(async ({ actionID: d, id: f, namespace: p, label: h, params: E = {} }) => {
2098
- const g = { disposed: !1, terminal: !1, sequence: 0 };
2099
- a.current.add(g);
2158
+ const l = C.useCallback(async ({ actionID: d, id: g, namespace: h, label: E, params: y = {} }) => {
2159
+ const f = { disposed: !1, terminal: !1, sequence: 0 };
2160
+ a.current.add(f);
2100
2161
  try {
2101
- g.open = rn(r, e, n, d, Ke.createFrom({ id: f, namespace: p, params: E }));
2102
- const y = await g.open;
2103
- if (g.open = void 0, g.disposed)
2104
- return Oe(y).catch(() => {
2105
- }), y;
2106
- g.handle = y, i({ id: y, label: h, resourceKey: n, resourceName: f, namespace: p, connectionID: e, status: "running", startedAt: Date.now() });
2107
- const w = (b) => {
2108
- if (g.disposed || !Number.isSafeInteger(b.sequence) || b.sequence <= g.sequence) return;
2109
- g.sequence = b.sequence;
2110
- const R = b.event, S = R.data ?? {};
2111
- if (R.type === "error") {
2112
- g.terminal = !0;
2113
- const C = Q(R.error);
2114
- o(y, { status: se(C) ? "cancelled" : "error", message: C.title, completedAt: Date.now() }), B(s, C, h), c(g);
2115
- } else if (R.type === "complete") {
2116
- g.terminal = !0;
2117
- const C = typeof S.message == "string" ? S.message : `${h} completed`;
2118
- o(y, { status: "completed", message: C, completedAt: Date.now() }), s(C, "success"), c(g);
2162
+ f.open = sn(r, e, n, d, He.createFrom({ id: g, namespace: h, params: y }));
2163
+ const p = await f.open;
2164
+ if (f.open = void 0, f.disposed)
2165
+ return Ae(p).catch(() => {
2166
+ }), p;
2167
+ f.handle = p, i({ id: p, label: E, resourceKey: n, resourceName: g, namespace: h, connectionID: e, status: "running", startedAt: Date.now() });
2168
+ const w = (v) => {
2169
+ if (f.disposed || !Number.isSafeInteger(v.sequence) || v.sequence <= f.sequence) return;
2170
+ f.sequence = v.sequence;
2171
+ const b = v.event, S = b.data ?? {};
2172
+ if (b.type === "error") {
2173
+ f.terminal = !0;
2174
+ const _ = Q(b.error);
2175
+ o(p, { status: oe(_) ? "cancelled" : "error", message: _.title, completedAt: Date.now() }), B(s, _, E), c(f);
2176
+ } else if (b.type === "complete") {
2177
+ f.terminal = !0;
2178
+ const _ = typeof S.message == "string" ? S.message : `${E} completed`;
2179
+ o(p, { status: "completed", message: _, completedAt: Date.now() }), s(_, "success"), c(f);
2119
2180
  } else
2120
- o(y, {
2181
+ o(p, {
2121
2182
  message: typeof S.message == "string" ? S.message : void 0,
2122
2183
  progress: typeof S.ready == "number" && typeof S.desired == "number" ? { ready: S.ready, desired: S.desired } : void 0
2123
2184
  });
2124
2185
  };
2125
- g.unsubscribe = T(`action/stream/${y}`, (b) => w(b.data)), g.attach = sn(y);
2126
- const m = await g.attach;
2127
- return g.attach = void 0, w(m), y;
2128
- } catch (y) {
2129
- if (g.terminal && g.handle) return g.handle;
2130
- throw g.disposed || (g.handle && o(g.handle, { status: se(y) ? "cancelled" : "error", message: Q(y).title, completedAt: Date.now() }), B(s, y, `Failed to start "${d}"`)), c(g), y;
2186
+ f.unsubscribe = D(`action/stream/${p}`, (v) => w(v.data)), f.attach = on(p);
2187
+ const m = await f.attach;
2188
+ return f.attach = void 0, w(m), p;
2189
+ } catch (p) {
2190
+ if (f.terminal && f.handle) return f.handle;
2191
+ throw f.disposed || (f.handle && o(f.handle, { status: oe(p) ? "cancelled" : "error", message: Q(p).title, completedAt: Date.now() }), B(s, p, `Failed to start "${d}"`)), c(f), p;
2131
2192
  }
2132
- }, [r, e, n, i, o, s, c]), u = _.useCallback((d) => {
2133
- for (const f of a.current) if (f.handle === d) {
2134
- c(f, !0);
2193
+ }, [r, e, n, i, o, s, c]), u = C.useCallback((d) => {
2194
+ for (const g of a.current) if (g.handle === d) {
2195
+ c(g, !0);
2135
2196
  return;
2136
2197
  }
2137
2198
  }, [c]);
@@ -2140,14 +2201,14 @@ const Os = ({
2140
2201
  function qr(t, e) {
2141
2202
  return `${t}/${e}/graph/CHANGED`;
2142
2203
  }
2143
- function Re(t, e, n, r) {
2144
- const s = K(), i = k(n);
2204
+ function Ie(t, e, n, r) {
2205
+ const s = K(), i = M(n);
2145
2206
  i.current = n;
2146
2207
  const o = JSON.stringify(n);
2147
2208
  W(() => {
2148
2209
  if (!r || !t || !e)
2149
2210
  return;
2150
- const a = T(qr(t, e), () => {
2211
+ const a = D(qr(t, e), () => {
2151
2212
  s.invalidateQueries({ queryKey: i.current, exact: !0 });
2152
2213
  });
2153
2214
  return () => {
@@ -2164,19 +2225,19 @@ const Mr = {
2164
2225
  member_of: { outgoing: "Member of", incoming: "Members" },
2165
2226
  selects: { outgoing: "Selects", incoming: "Selected by" }
2166
2227
  };
2167
- function Ls(t, e) {
2228
+ function Us(t, e) {
2168
2229
  const n = Mr[t];
2169
2230
  if (n)
2170
2231
  return n[e];
2171
2232
  const r = t.replace(/_/g, " ");
2172
2233
  return e === "outgoing" ? r : `${r} (incoming)`;
2173
2234
  }
2174
- function kr(t, e) {
2235
+ function $r(t, e) {
2175
2236
  return t.pluginId === e.pluginId && t.connectionId === e.connectionId && t.resourceKey === e.resourceKey && t.id === e.id && (t.namespace ?? "") === (e.namespace ?? "");
2176
2237
  }
2177
- function $r(t, e) {
2238
+ function Wr(t, e) {
2178
2239
  return e.map((n) => {
2179
- const r = kr(n.source, t);
2240
+ const r = $r(n.source, t);
2180
2241
  return {
2181
2242
  resource: r ? n.target : n.source,
2182
2243
  type: n.type,
@@ -2185,7 +2246,7 @@ function $r(t, e) {
2185
2246
  };
2186
2247
  });
2187
2248
  }
2188
- const Us = ({
2249
+ const ks = ({
2189
2250
  pluginID: t,
2190
2251
  connectionID: e,
2191
2252
  resourceKey: n,
@@ -2196,29 +2257,29 @@ const Us = ({
2196
2257
  enabled: a = !0,
2197
2258
  refetchInterval: c = !1
2198
2259
  }) => {
2199
- const l = A(t), u = ["RESOURCE_RELATED", l, e, n, s, r, i, o ?? null], d = a && !!l && !!e && !!n && !!r;
2200
- Re(l, e, u, d);
2201
- const f = D({
2260
+ const l = T(t), u = ["RESOURCE_RELATED", l, e, n, s, r, i, o ?? null], d = a && !!l && !!e && !!n && !!r;
2261
+ Ie(l, e, u, d);
2262
+ const g = N({
2202
2263
  queryKey: u,
2203
- queryFn: async () => on(l, e, n, s, r, i, o ?? null),
2264
+ queryFn: async () => an(l, e, n, s, r, i, o ?? null),
2204
2265
  enabled: d,
2205
2266
  refetchInterval: c
2206
- }), p = {
2267
+ }), h = {
2207
2268
  pluginId: l,
2208
2269
  connectionId: e,
2209
2270
  resourceKey: n,
2210
2271
  id: r,
2211
2272
  namespace: s
2212
- }, h = f.data ?? [];
2273
+ }, E = g.data ?? [];
2213
2274
  return {
2214
2275
  /** One entry per edge, from the viewed resource's side. */
2215
- related: $r(p, h),
2276
+ related: Wr(h, E),
2216
2277
  /** The raw graph edges. */
2217
- edges: h,
2218
- isLoading: f.isLoading,
2219
- isFetching: f.isFetching,
2220
- error: f.error,
2221
- refetch: f.refetch
2278
+ edges: E,
2279
+ isLoading: g.isLoading,
2280
+ isFetching: g.isFetching,
2281
+ error: g.error,
2282
+ refetch: g.refetch
2222
2283
  };
2223
2284
  }, qs = ({
2224
2285
  pluginID: t,
@@ -2230,11 +2291,11 @@ const Us = ({
2230
2291
  enabled: o = !0,
2231
2292
  refetchInterval: a = !1
2232
2293
  }) => {
2233
- const c = A(t), l = ["RESOURCE_DEPENDENCY_TREE", c, e, n, s, r, i], u = o && !!c && !!e && !!n && !!r;
2234
- Re(c, e, l, u);
2235
- const d = D({
2294
+ const c = T(t), l = ["RESOURCE_DEPENDENCY_TREE", c, e, n, s, r, i], u = o && !!c && !!e && !!n && !!r;
2295
+ Ie(c, e, l, u);
2296
+ const d = N({
2236
2297
  queryKey: l,
2237
- queryFn: async () => an(c, e, n, s, r, i),
2298
+ queryFn: async () => cn(c, e, n, s, r, i),
2238
2299
  enabled: u,
2239
2300
  refetchInterval: a
2240
2301
  });
@@ -2255,11 +2316,11 @@ const Us = ({
2255
2316
  downDepth: o = 3,
2256
2317
  enabled: a = !0
2257
2318
  }) => {
2258
- const c = A(t), l = ["RESOURCE_GRAPH", c, e, n, s, r, i, o], u = a && !!c && !!e && !!n && !!r;
2259
- Re(c, e, l, u);
2260
- const d = D({
2319
+ const c = T(t), l = ["RESOURCE_GRAPH", c, e, n, s, r, i, o], u = a && !!c && !!e && !!n && !!r;
2320
+ Ie(c, e, l, u);
2321
+ const d = N({
2261
2322
  queryKey: l,
2262
- queryFn: async () => cn(c, e, n, s, r, i, o),
2323
+ queryFn: async () => un(c, e, n, s, r, i, o),
2263
2324
  enabled: u
2264
2325
  });
2265
2326
  return {
@@ -2269,19 +2330,19 @@ const Us = ({
2269
2330
  error: d.error,
2270
2331
  refetch: d.refetch
2271
2332
  };
2272
- }, ks = () => {
2273
- const t = _.useContext(Ve);
2333
+ }, $s = () => {
2334
+ const t = C.useContext(Ye);
2274
2335
  if (!t)
2275
2336
  throw new Error("useSettings must be used within a SettingsProvider");
2276
2337
  return t;
2277
- }, $s = ({ to: t, withinContext: e, ...n }) => {
2278
- const { pluginId: r } = Se();
2338
+ }, Ws = ({ to: t, withinContext: e, ...n }) => {
2339
+ const { pluginId: r } = _e();
2279
2340
  r || console.error("Link used outside of a plugin context");
2280
2341
  const s = `/_plugin/${r}${t.startsWith("/") ? "" : "/"}${t}`;
2281
- return _.useMemo(() => /* @__PURE__ */ x(ht, { style: { textDecoration: "none", color: "inherit" }, ...n, to: s }), [n, s]);
2342
+ return C.useMemo(() => /* @__PURE__ */ A(mt, { style: { textDecoration: "none", color: "inherit" }, ...n, to: s }), [n, s]);
2282
2343
  };
2283
- function Ws() {
2284
- const t = mt(), e = Et(), { pluginId: n } = Se();
2344
+ function Gs() {
2345
+ const t = Et(), e = St(), { pluginId: n } = _e();
2285
2346
  n || console.error("usePluginRouter used outside of a plugin context");
2286
2347
  const r = `/_plugin/${n}`, s = e.pathname.startsWith(r) ? e.pathname.slice(r.length) || "/" : e.pathname, i = U((o, a) => {
2287
2348
  const { ...c } = a ?? {};
@@ -2293,15 +2354,15 @@ function Ws() {
2293
2354
  pluginPath: s
2294
2355
  }), [e, i, s]);
2295
2356
  }
2296
- class Gs {
2297
- }
2298
2357
  class js {
2358
+ }
2359
+ class Qs {
2299
2360
  constructor() {
2300
- P(this, "_extensions");
2361
+ x(this, "_extensions");
2301
2362
  /**
2302
2363
  * The root component to render for the application window.
2303
2364
  */
2304
- P(this, "root");
2365
+ x(this, "root");
2305
2366
  /**
2306
2367
  * Various pages to render under the root component. These can be navigated to using
2307
2368
  * the built-in navigation system both programatically and through Links.
@@ -2331,8 +2392,8 @@ class js {
2331
2392
  * ```
2332
2393
  *
2333
2394
  */
2334
- P(this, "pages");
2335
- P(this, "_routes");
2395
+ x(this, "pages");
2396
+ x(this, "_routes");
2336
2397
  }
2337
2398
  get extensions() {
2338
2399
  return this._extensions || [];
@@ -2354,9 +2415,9 @@ class js {
2354
2415
  */
2355
2416
  get Window() {
2356
2417
  if (!this._routes && this.root)
2357
- return /* @__PURE__ */ x(this.root, {});
2358
- const e = St(this._routes || []);
2359
- return /* @__PURE__ */ x(_t, { router: e });
2418
+ return /* @__PURE__ */ A(this.root, {});
2419
+ const e = _t(this._routes || []);
2420
+ return /* @__PURE__ */ A(Ct, { router: e });
2360
2421
  }
2361
2422
  /**
2362
2423
  * Register extension points for other plugins to extend the functionality
@@ -2388,91 +2449,91 @@ class js {
2388
2449
  return this._routes = e, this;
2389
2450
  }
2390
2451
  }
2391
- var Wr = /* @__PURE__ */ ((t) => (t.MISSING_MANIFEST = "MISSING_MANIFEST", t.MISSING_PLUGIN = "MISSING_PLUGIN", t.MISSING_ENTRYPOINT = "MISSING_ENTRYPOINT", t))(Wr || {});
2392
- const Qs = (t) => {
2452
+ var Gr = /* @__PURE__ */ ((t) => (t.MISSING_MANIFEST = "MISSING_MANIFEST", t.MISSING_PLUGIN = "MISSING_PLUGIN", t.MISSING_ENTRYPOINT = "MISSING_ENTRYPOINT", t))(Gr || {});
2453
+ const Ks = (t) => {
2393
2454
  const e = t.split("::");
2394
2455
  return e.length === 1 ? { group: "core", version: "", kind: e[0] } : {
2395
2456
  group: e[0] || "core",
2396
2457
  version: e[1] || "",
2397
2458
  kind: e[2] || e[0]
2398
2459
  };
2399
- }, Ks = (t) => !t || t === "core" ? "Core" : t.charAt(0).toUpperCase() + t.slice(1);
2460
+ }, Hs = (t) => !t || t === "core" ? "Core" : t.charAt(0).toUpperCase() + t.slice(1);
2400
2461
  export {
2401
- V as ALL_SESSIONS_KEY,
2402
- wn as BottomDrawerContext,
2403
- vn as ConfirmationModalContext,
2462
+ Y as ALL_SESSIONS_KEY,
2463
+ vn as BottomDrawerContext,
2464
+ Rn as ConfirmationModalContext,
2404
2465
  F as ErrorTypes,
2405
- os as ExtensionPointRegistry,
2406
- Dn as ExtensionPointStore,
2407
- ss as ExtensionProvider,
2408
- $s as Link,
2409
- Ye as OperationsContext,
2410
- ns as OperationsProvider,
2411
- Ee as PluginContext,
2412
- Zr as PluginContextProvider,
2413
- Wr as PluginErrorCode,
2414
- js as PluginWindow,
2415
- Gs as PluginWindowRootProps,
2466
+ is as ExtensionPointRegistry,
2467
+ Nn as ExtensionPointStore,
2468
+ os as ExtensionProvider,
2469
+ Ws as Link,
2470
+ Je as OperationsContext,
2471
+ rs as OperationsProvider,
2472
+ Se as PluginContext,
2473
+ es as PluginContextProvider,
2474
+ Gr as PluginErrorCode,
2475
+ Qs as PluginWindow,
2476
+ js as PluginWindowRootProps,
2416
2477
  bn as RightDrawerContext,
2417
- Ve as SettingsContext,
2418
- ts as SettingsProvider,
2419
- is as SnackbarProvider,
2478
+ Ye as SettingsContext,
2479
+ ns as SettingsProvider,
2480
+ as as SnackbarProvider,
2420
2481
  I as WatchState,
2421
- _n as actionToSnackbar,
2422
- xr as applyBatch,
2423
- Pn as connectionListQueryKey,
2424
- q as createErrorHandler,
2425
- Cn as defaultState,
2426
- Ks as formatGroup,
2482
+ Cn as actionToSnackbar,
2483
+ Lr as applyBatch,
2484
+ xn as connectionListQueryKey,
2485
+ k as createErrorHandler,
2486
+ wn as defaultState,
2487
+ Hs as formatGroup,
2427
2488
  qr as graphChangedEvent,
2428
- se as isCancelledError,
2489
+ oe as isCancelledError,
2429
2490
  Q as parseAppError,
2430
- Qs as parseResourceKey,
2431
- Ls as relationshipLabel,
2491
+ Ks as parseResourceKey,
2492
+ Us as relationshipLabel,
2432
2493
  B as showAppError,
2433
- $r as toRelatedResources,
2434
- Ps as useActiveSyncs,
2435
- rt as useBottomDrawer,
2436
- _s as useConfirmationModal,
2437
- as as useConnection,
2438
- us as useConnectionNamespaces,
2439
- ls as useConnectionStatus,
2440
- cs as useConnections,
2494
+ Wr as toRelatedResources,
2495
+ xs as useActiveSyncs,
2496
+ st as useBottomDrawer,
2497
+ Cs as useConfirmationModal,
2498
+ cs as useConnection,
2499
+ ls as useConnectionNamespaces,
2500
+ ds as useConnectionStatus,
2501
+ us as useConnections,
2441
2502
  qs as useDependencyTree,
2442
- Ds as useEditorSchemas,
2443
- Lr as useEventBatcher,
2444
- ps as useExec,
2445
- Ts as useExecuteAction,
2446
- rs as useExtensionPoint,
2447
- Tn as useExtensionRegistry,
2448
- gs as useLogs,
2503
+ Ns as useEditorSchemas,
2504
+ Ur as useEventBatcher,
2505
+ gs as useExec,
2506
+ Ds as useExecuteAction,
2507
+ ss as useExtensionPoint,
2508
+ Dn as useExtensionRegistry,
2509
+ hs as useLogs,
2449
2510
  ys as useMetricProviders,
2450
- Ln as useMetricProvidersForResource,
2451
- ms as useMetricStream,
2452
- Ur as useOperations,
2453
- Se as usePluginContext,
2454
- ds as usePluginData,
2455
- Ws as usePluginRouter,
2456
- es as usePluginSettings,
2457
- Es as usePortForwardSessions,
2458
- Re as useRefetchOnGraphChange,
2459
- Us as useRelatedResources,
2460
- A as useResolvedPluginId,
2461
- Cs as useResource,
2511
+ Un as useMetricProvidersForResource,
2512
+ Es as useMetricStream,
2513
+ kr as useOperations,
2514
+ _e as usePluginContext,
2515
+ fs as usePluginData,
2516
+ Gs as usePluginRouter,
2517
+ ts as usePluginSettings,
2518
+ Ss as usePortForwardSessions,
2519
+ Ie as useRefetchOnGraphChange,
2520
+ ks as useRelatedResources,
2521
+ T as useResolvedPluginId,
2522
+ ws as useResource,
2462
2523
  Fs as useResourceActions,
2463
- ws as useResourceAreaComponent,
2524
+ vs as useResourceAreaComponent,
2464
2525
  Ms as useResourceGraph,
2465
2526
  bs as useResourceGroups,
2466
- hs as useResourceMetrics,
2467
- As as useResourceMutations,
2468
- Ss as useResourcePortForwarder,
2469
- vs as useResourceSearch,
2470
- Rs as useResourceType,
2471
- Is as useResourceTypes,
2472
- Os as useResources,
2473
- fs as useRightDrawer,
2474
- ks as useSettings,
2527
+ ms as useResourceMetrics,
2528
+ Ts as useResourceMutations,
2529
+ _s as useResourcePortForwarder,
2530
+ Rs as useResourceSearch,
2531
+ Is as useResourceType,
2532
+ Os as useResourceTypes,
2533
+ As as useResources,
2534
+ ps as useRightDrawer,
2535
+ $s as useSettings,
2475
2536
  G as useSnackbar,
2476
- xs as useStreamAction,
2477
- Ns as useWatchState
2537
+ Ls as useStreamAction,
2538
+ Ps as useWatchState
2478
2539
  };