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