@omniviewdev/runtime 0.6.0 → 0.7.1

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