@omniviewdev/runtime 0.3.0 → 0.4.0

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