react-semaphor 0.1.209 → 0.1.211

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/chunks/{dashboard-controls-BNTI4r0_.js → dashboard-controls-7KpXzAWL.js} +662 -607
  2. package/dist/chunks/dashboard-controls-CnDq9Uh_.js +42 -0
  3. package/dist/chunks/{dashboard-json-BjOqpGbW.js → dashboard-json-dqey5VK0.js} +1 -1
  4. package/dist/chunks/{dashboard-json-kIoBtmBF.js → dashboard-json-stWvjp2O.js} +1 -1
  5. package/dist/chunks/{dashboard-summary-settings-dialog-CO1SwHHD.js → dashboard-summary-settings-dialog-DPEe6XBC.js} +1 -1
  6. package/dist/chunks/{dashboard-summary-settings-dialog-BoX18wiA.js → dashboard-summary-settings-dialog-DuxhidK1.js} +1 -1
  7. package/dist/chunks/{edit-dashboard-visual-DG4VLoJF.js → edit-dashboard-visual-CQAk_UsI.js} +3416 -3531
  8. package/dist/chunks/edit-dashboard-visual-D_XPr8f8.js +164 -0
  9. package/dist/chunks/editor-action-buttons-CH7W6KdH.js +21 -0
  10. package/dist/chunks/editor-action-buttons-D34_GSZu.js +404 -0
  11. package/dist/chunks/{index-D0TdW88i.js → index-BDS2sWhv.js} +26669 -26443
  12. package/dist/chunks/index-BfiIPyeS.js +1109 -0
  13. package/dist/chunks/normalize-dashboard-for-dirty-check-D9x96J2F.js +1 -0
  14. package/dist/chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js +119 -0
  15. package/dist/chunks/notification-bell-Cu3qDd9V.js +837 -0
  16. package/dist/chunks/notification-bell-hijGST9g.js +6 -0
  17. package/dist/chunks/{resource-management-panel-DS_WEv1x.js → resource-management-panel-BvHqslqC.js} +346 -335
  18. package/dist/chunks/resource-management-panel-gK3a6OEj.js +6 -0
  19. package/dist/chunks/{use-role-aware-display-preferences-D8j5_cnK.js → use-role-aware-display-preferences-BlR29aKQ.js} +1 -1
  20. package/dist/chunks/{use-role-aware-display-preferences-DfihB5pN.js → use-role-aware-display-preferences-a5FH9Y0k.js} +1 -1
  21. package/dist/chunks/{use-visual-utils-CzcVz3zB.js → use-visual-utils-B11AA2fd.js} +1 -1
  22. package/dist/chunks/{use-visual-utils-BfLXO_vi.js → use-visual-utils-ptPsQ3nC.js} +23 -23
  23. package/dist/dashboard/index.cjs +1 -1
  24. package/dist/dashboard/index.js +1 -1
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.js +253 -214
  27. package/dist/shared/index.cjs +1 -0
  28. package/dist/shared/index.js +6 -0
  29. package/dist/style.css +1 -1
  30. package/dist/surfboard/index.cjs +1 -1
  31. package/dist/surfboard/index.js +2 -2
  32. package/dist/types/main.d.ts +88 -1
  33. package/dist/types/shared.d.ts +1762 -0
  34. package/package.json +6 -1
  35. package/dist/chunks/dashboard-controls-Dcpx9_an.js +0 -42
  36. package/dist/chunks/edit-dashboard-visual-B9HuGExj.js +0 -179
  37. package/dist/chunks/editor-action-buttons-CDTIx_Jc.js +0 -11
  38. package/dist/chunks/editor-action-buttons-CszdZ4Fw.js +0 -345
  39. package/dist/chunks/index-DSA80lEg.js +0 -1104
  40. package/dist/chunks/notification-bell-D2V1-ARa.js +0 -11
  41. package/dist/chunks/notification-bell-DFiRaeJQ.js +0 -862
  42. package/dist/chunks/resource-management-panel-BhiWNPcw.js +0 -6
@@ -1,20 +1,21 @@
1
- import { jsxs as a, jsx as e, Fragment as M } from "react/jsx-runtime";
2
- import { bP as se, cR as ia, u as x, b_ as _e, b$ as Ge, B as C, c1 as Re, c2 as Z, cS as Pe, bs as ds, l as j, m as Ue, cT as la, c3 as Fe, n as je, o as qe, p as Ve, q as us, L as Ce, Q as ee, G as ca, a2 as F, cU as da, c7 as ua, cV as ma, cW as rs, cX as ms, c as ae, cY as hs, bJ as me, cZ as he, I as L, c_ as ps, cC as ha, c$ as pa, H as V, c6 as z, d0 as ze, d1 as fa, d2 as ga, d3 as Le, d4 as va, d5 as ba, d6 as fs, d7 as gs, d8 as de, d9 as ue, cu as Ee, cd as Ae, da as Me, c8 as vs, db as ke, cD as bs, e as ys, dc as ya, cg as Ns, ch as Ss, ci as ws, cj as xs, ck as Ds, cl as Cs, cm as Ls, cn as Oe, bZ as Na, dd as Sa, bu as wa, bA as ns, bE as le, de as xa, bF as Da, ag as we, df as Ca, dg as La, dh as Ea, di as Aa, dj as Ma, dk as ka, cw as Oa, cx as Ia, cy as Ta, dl as _a, cz as Ga, c4 as Ra, aO as Pa, dm as Ua, dn as Fa, dp as ja, dq as qa, dr as Va, c0 as za, ca as $a, ds as Ha, ai as Ba, am as Ka } from "./index-D0TdW88i.js";
1
+ import { jsxs as a, jsx as e, Fragment as k } from "react/jsx-runtime";
2
+ import { bS as oe, cS as Na, u as w, c8 as ze, c9 as $e, B as L, cb as Be, cc as q, cT as Ke, Z as ws, l as P, m as Qe, cU as Sa, c7 as We, n as Je, o as Ze, p as Xe, q as xs, L as Ue, Q as re, G as wa, ac as j, cV as xa, cg as Da, cW as Ca, cX as gs, cY as Ds, c as Z, cZ as Cs, U as be, c_ as ye, I as E, c$ as Ls, cH as La, d0 as Ea, H, cf as V, d1 as Ye, d2 as Aa, d3 as ka, d4 as Ge, d5 as Ma, d6 as Oa, d7 as Es, d8 as As, d9 as ge, da as ve, cD as Re, cm as Pe, db as Fe, ch as ks, dc as je, dd as Ms, e as Os, de as Ia, cp as Is, cq as Ts, cr as _s, cs as Us, ct as Gs, cu as Rs, cv as Ps, cw as qe, c6 as Ta, df as _a, bG as Ua, a1 as vs, bO as pe, dg as Ga, bP as Ra, as as Oe, dh as Pa, di as Fa, dj as ja, bj as qa, dk as Ha, dl as Va, bZ as za, b_ as $a, b$ as Ba, dm as Ka, c1 as Qa, cd as Wa, a_ as Ja, dn as Za, dp as Xa, dq as Ya, dr as et, ds as st, dt as at, ca as tt, ae as nt, cj as rt, du as ot, au as it, af as lt, ay as ct } from "./index-BDS2sWhv.js";
3
3
  import * as _ from "react";
4
- import Es, { useState as S, useMemo as ce, useEffect as Qa } from "react";
4
+ import Fs, { useState as S, useMemo as fe, useEffect as dt, useCallback as ut } from "react";
5
5
  import "react-dom";
6
- import { b as Wa, u as Ja, c as Xa, A as Ya, V as Za, S as et, N as st, U as at } from "./notification-bell-DFiRaeJQ.js";
7
- import { u as tt } from "./use-role-aware-display-preferences-DfihB5pN.js";
8
- import { d as rt } from "./date-formatter-Y8Za1ib3.js";
9
- import { C as nt, D as ot } from "./dashboard-summary-settings-dialog-CO1SwHHD.js";
10
- import { S as os } from "./editor-action-buttons-CszdZ4Fw.js";
6
+ import { b as mt, u as ht, c as pt, A as ft, V as gt, N as vt, U as bt } from "./notification-bell-Cu3qDd9V.js";
7
+ import { u as yt } from "./use-role-aware-display-preferences-a5FH9Y0k.js";
8
+ import { d as Nt } from "./date-formatter-Y8Za1ib3.js";
9
+ import { C as St, D as wt } from "./dashboard-summary-settings-dialog-DPEe6XBC.js";
10
+ import { u as xt, s as Ie } from "./normalize-dashboard-for-dirty-check-XKgH3GFX.js";
11
+ import { S as bs } from "./editor-action-buttons-D34_GSZu.js";
11
12
  /**
12
13
  * @license lucide-react v0.453.0 - ISC
13
14
  *
14
15
  * This source code is licensed under the ISC license.
15
16
  * See the LICENSE file in the root directory of this source tree.
16
17
  */
17
- const it = se("Glasses", [
18
+ const Dt = oe("Glasses", [
18
19
  ["circle", { cx: "6", cy: "15", r: "4", key: "vux9w4" }],
19
20
  ["circle", { cx: "18", cy: "15", r: "4", key: "18o8ve" }],
20
21
  ["path", { d: "M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2", key: "1ag4bs" }],
@@ -27,7 +28,7 @@ const it = se("Glasses", [
27
28
  * This source code is licensed under the ISC license.
28
29
  * See the LICENSE file in the root directory of this source tree.
29
30
  */
30
- const lt = se("Menu", [
31
+ const Ct = oe("Menu", [
31
32
  ["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }],
32
33
  ["line", { x1: "4", x2: "20", y1: "6", y2: "6", key: "1owob3" }],
33
34
  ["line", { x1: "4", x2: "20", y1: "18", y2: "18", key: "yk5zj1" }]
@@ -38,7 +39,7 @@ const lt = se("Menu", [
38
39
  * This source code is licensed under the ISC license.
39
40
  * See the LICENSE file in the root directory of this source tree.
40
41
  */
41
- const ct = se("Moon", [
42
+ const Lt = oe("Moon", [
42
43
  ["path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z", key: "a7tn18" }]
43
44
  ]);
44
45
  /**
@@ -47,7 +48,7 @@ const ct = se("Moon", [
47
48
  * This source code is licensed under the ISC license.
48
49
  * See the LICENSE file in the root directory of this source tree.
49
50
  */
50
- const dt = se("ShieldX", [
51
+ const Et = oe("ShieldX", [
51
52
  [
52
53
  "path",
53
54
  {
@@ -64,7 +65,7 @@ const dt = se("ShieldX", [
64
65
  * This source code is licensed under the ISC license.
65
66
  * See the LICENSE file in the root directory of this source tree.
66
67
  */
67
- const ut = se("Sun", [
68
+ const At = oe("Sun", [
68
69
  ["circle", { cx: "12", cy: "12", r: "4", key: "4exip2" }],
69
70
  ["path", { d: "M12 2v2", key: "tus03m" }],
70
71
  ["path", { d: "M12 20v2", key: "1lh1kg" }],
@@ -75,7 +76,7 @@ const ut = se("Sun", [
75
76
  ["path", { d: "m6.34 17.66-1.41 1.41", key: "1m8zz5" }],
76
77
  ["path", { d: "m19.07 4.93-1.41 1.41", key: "1shlcs" }]
77
78
  ]);
78
- var Ie = { exports: {} }, xe = {};
79
+ var He = { exports: {} }, Te = {};
79
80
  /**
80
81
  * @license React
81
82
  * use-sync-external-store-shim.production.js
@@ -85,18 +86,18 @@ var Ie = { exports: {} }, xe = {};
85
86
  * This source code is licensed under the MIT license found in the
86
87
  * LICENSE file in the root directory of this source tree.
87
88
  */
88
- var is;
89
- function mt() {
90
- if (is) return xe;
91
- is = 1;
92
- var s = Es;
93
- function n(d, m) {
89
+ var ys;
90
+ function kt() {
91
+ if (ys) return Te;
92
+ ys = 1;
93
+ var s = Fs;
94
+ function o(d, m) {
94
95
  return d === m && (d !== 0 || 1 / d === 1 / m) || d !== d && m !== m;
95
96
  }
96
- var t = typeof Object.is == "function" ? Object.is : n, r = s.useState, l = s.useEffect, i = s.useLayoutEffect, u = s.useDebugValue;
97
+ var t = typeof Object.is == "function" ? Object.is : o, n = s.useState, l = s.useEffect, c = s.useLayoutEffect, u = s.useDebugValue;
97
98
  function p(d, m) {
98
- var h = m(), b = r({ inst: { value: h, getSnapshot: m } }), y = b[0].inst, N = b[1];
99
- return i(
99
+ var h = m(), b = n({ inst: { value: h, getSnapshot: m } }), y = b[0].inst, N = b[1];
100
+ return c(
100
101
  function() {
101
102
  y.value = h, y.getSnapshot = m, g(y) && N({ inst: y });
102
103
  },
@@ -123,10 +124,10 @@ function mt() {
123
124
  function v(d, m) {
124
125
  return m();
125
126
  }
126
- var c = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? v : p;
127
- return xe.useSyncExternalStore = s.useSyncExternalStore !== void 0 ? s.useSyncExternalStore : c, xe;
127
+ var i = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? v : p;
128
+ return Te.useSyncExternalStore = s.useSyncExternalStore !== void 0 ? s.useSyncExternalStore : i, Te;
128
129
  }
129
- var De = {};
130
+ var _e = {};
130
131
  /**
131
132
  * @license React
132
133
  * use-sync-external-store-shim.development.js
@@ -136,20 +137,20 @@ var De = {};
136
137
  * This source code is licensed under the MIT license found in the
137
138
  * LICENSE file in the root directory of this source tree.
138
139
  */
139
- var ls;
140
- function ht() {
141
- return ls || (ls = 1, process.env.NODE_ENV !== "production" && function() {
140
+ var Ns;
141
+ function Mt() {
142
+ return Ns || (Ns = 1, process.env.NODE_ENV !== "production" && function() {
142
143
  function s(h, b) {
143
144
  return h === b && (h !== 0 || 1 / h === 1 / b) || h !== h && b !== b;
144
145
  }
145
- function n(h, b) {
146
- c || l.startTransition === void 0 || (c = !0, console.error(
146
+ function o(h, b) {
147
+ i || l.startTransition === void 0 || (i = !0, console.error(
147
148
  "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
148
149
  ));
149
150
  var y = b();
150
151
  if (!d) {
151
152
  var N = b();
152
- i(y, N) || (console.error(
153
+ c(y, N) || (console.error(
153
154
  "The result of getSnapshot should be cached to avoid an infinite loop"
154
155
  ), d = !0);
155
156
  }
@@ -176,36 +177,36 @@ function ht() {
176
177
  h = h.value;
177
178
  try {
178
179
  var y = b();
179
- return !i(h, y);
180
+ return !c(h, y);
180
181
  } catch {
181
182
  return !0;
182
183
  }
183
184
  }
184
- function r(h, b) {
185
+ function n(h, b) {
185
186
  return b();
186
187
  }
187
188
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
188
- var l = Es, i = typeof Object.is == "function" ? Object.is : s, u = l.useState, p = l.useEffect, g = l.useLayoutEffect, v = l.useDebugValue, c = !1, d = !1, m = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? r : n;
189
- De.useSyncExternalStore = l.useSyncExternalStore !== void 0 ? l.useSyncExternalStore : m, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
190
- }()), De;
189
+ var l = Fs, c = typeof Object.is == "function" ? Object.is : s, u = l.useState, p = l.useEffect, g = l.useLayoutEffect, v = l.useDebugValue, i = !1, d = !1, m = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? n : o;
190
+ _e.useSyncExternalStore = l.useSyncExternalStore !== void 0 ? l.useSyncExternalStore : m, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
191
+ }()), _e;
191
192
  }
192
- process.env.NODE_ENV === "production" ? Ie.exports = mt() : Ie.exports = ht();
193
- var pt = Ie.exports;
194
- function ft() {
195
- const { setTheme: s } = ia(), n = x(
193
+ process.env.NODE_ENV === "production" ? He.exports = kt() : He.exports = Mt();
194
+ var Ot = He.exports;
195
+ function It() {
196
+ const { setTheme: s } = Na(), o = w(
196
197
  (t) => t.actions.setDashboardTheme
197
198
  );
198
- return /* @__PURE__ */ a(_e, { children: [
199
- /* @__PURE__ */ e(Ge, { asChild: !0, children: /* @__PURE__ */ a(C, { className: "h-7 p-2", variant: "ghost", size: "sm", children: [
199
+ return /* @__PURE__ */ a(ze, { children: [
200
+ /* @__PURE__ */ e($e, { asChild: !0, children: /* @__PURE__ */ a(L, { className: "h-7 p-2", variant: "ghost", size: "sm", children: [
200
201
  /* @__PURE__ */ e(
201
- ut,
202
+ At,
202
203
  {
203
204
  strokeWidth: 1.5,
204
205
  className: "h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"
205
206
  }
206
207
  ),
207
208
  /* @__PURE__ */ e(
208
- ct,
209
+ Lt,
209
210
  {
210
211
  strokeWidth: 1.5,
211
212
  className: "absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"
@@ -213,30 +214,30 @@ function ft() {
213
214
  ),
214
215
  /* @__PURE__ */ e("span", { className: "sr-only", children: "Toggle theme" })
215
216
  ] }) }),
216
- /* @__PURE__ */ a(Re, { align: "end", children: [
217
+ /* @__PURE__ */ a(Be, { align: "end", children: [
217
218
  /* @__PURE__ */ e(
218
- Z,
219
+ q,
219
220
  {
220
221
  onClick: () => {
221
- s("light"), n("light");
222
+ s("light"), o("light");
222
223
  },
223
224
  children: "Light"
224
225
  }
225
226
  ),
226
227
  /* @__PURE__ */ e(
227
- Z,
228
+ q,
228
229
  {
229
230
  onClick: () => {
230
- s("dark"), n("dark");
231
+ s("dark"), o("dark");
231
232
  },
232
233
  children: "Dark"
233
234
  }
234
235
  ),
235
236
  /* @__PURE__ */ e(
236
- Z,
237
+ q,
237
238
  {
238
239
  onClick: () => {
239
- s("system"), n("system");
240
+ s("system"), o("system");
240
241
  },
241
242
  children: "System"
242
243
  }
@@ -244,78 +245,78 @@ function ft() {
244
245
  ] })
245
246
  ] });
246
247
  }
247
- async function gt(s, n, t, r, l) {
248
+ async function Tt(s, o, t, n, l) {
248
249
  if (!l)
249
250
  return null;
250
- const i = JSON.stringify(t), u = `${s}/v1/lens`;
251
- return await Pe(u, l, {
252
- name: n,
253
- template: i,
254
- filterValues: r,
251
+ const c = JSON.stringify(t), u = `${s}/v1/lens`;
252
+ return await Ke(u, l, {
253
+ name: o,
254
+ template: c,
255
+ filterValues: n,
255
256
  operation: "create"
256
257
  });
257
258
  }
258
- async function Te(s, n, t) {
259
+ async function Ve(s, o, t) {
259
260
  if (!t)
260
261
  return null;
261
- const { id: r, template: l, filterValues: i, isDefault: u, shared: p } = n, g = `${s}/v1/lens`;
262
- return await Pe(g, t, {
263
- lensId: r,
262
+ const { id: n, template: l, filterValues: c, isDefault: u, shared: p } = o, g = `${s}/v1/lens`;
263
+ return await Ke(g, t, {
264
+ lensId: n,
264
265
  template: l,
265
- filterValues: i,
266
+ filterValues: c,
266
267
  isDefault: u,
267
268
  shared: p,
268
269
  operation: "update"
269
270
  });
270
271
  }
271
- async function vt(s, n, t) {
272
+ async function _t(s, o, t) {
272
273
  if (!t)
273
274
  return null;
274
- const r = `${s}/v1/lens`;
275
- return await Pe(r, t, {
275
+ const n = `${s}/v1/lens`;
276
+ return await Ke(n, t, {
276
277
  operation: "delete",
277
- lensId: n
278
+ lensId: o
278
279
  });
279
280
  }
280
- function bt() {
281
- const [s, n] = S(""), [t, r] = S(!1), l = x((N) => N.lenses), { setLenses: i, setSelectedLensId: u } = ds(), [p, g] = S(!1), [v, c] = S(!1), d = x((N) => N.dashboard), m = x((N) => N.filterValues), { authToken: h, tokenProps: b } = j();
281
+ function Ut() {
282
+ const [s, o] = S(""), [t, n] = S(!1), l = w((N) => N.lenses), { setLenses: c, setSelectedLensId: u } = ws(), [p, g] = S(!1), [v, i] = S(!1), d = w((N) => N.dashboard), m = w((N) => N.filterValues), { authToken: h, tokenProps: b } = P();
282
283
  async function y() {
283
284
  g(!0);
284
- const N = await gt(
285
+ const N = await Tt(
285
286
  b.apiServiceUrl,
286
287
  s,
287
288
  d,
288
289
  m,
289
290
  h == null ? void 0 : h.accessToken
290
291
  );
291
- N && (i([...l || [], N]), u(N.id), c(!1)), g(!1);
292
+ N && (c([...l || [], N]), u(N.id), i(!1)), g(!1);
292
293
  }
293
- return /* @__PURE__ */ a(Ue, { open: v, onOpenChange: c, children: [
294
- /* @__PURE__ */ e(la, { asChild: !0, children: /* @__PURE__ */ a(
295
- C,
294
+ return /* @__PURE__ */ a(Qe, { open: v, onOpenChange: i, children: [
295
+ /* @__PURE__ */ e(Sa, { asChild: !0, children: /* @__PURE__ */ a(
296
+ L,
296
297
  {
297
298
  variant: "secondary",
298
299
  className: "h-7 p-2",
299
300
  size: "sm",
300
301
  children: [
301
- /* @__PURE__ */ e(Fe, { className: "mr-2 h-4 w-4" }),
302
+ /* @__PURE__ */ e(We, { className: "mr-2 h-4 w-4" }),
302
303
  "Lens"
303
304
  ]
304
305
  }
305
306
  ) }),
306
- /* @__PURE__ */ a(je, { className: "sm:max-w-[425px]", children: [
307
- /* @__PURE__ */ a(qe, { children: [
308
- /* @__PURE__ */ e(Ve, { children: "Create Lens" }),
309
- /* @__PURE__ */ e(us, { children: "Lenses are private by default and are only visible to you." })
307
+ /* @__PURE__ */ a(Je, { className: "sm:max-w-[425px]", children: [
308
+ /* @__PURE__ */ a(Ze, { children: [
309
+ /* @__PURE__ */ e(Xe, { children: "Create Lens" }),
310
+ /* @__PURE__ */ e(xs, { children: "Lenses are private by default and are only visible to you." })
310
311
  ] }),
311
312
  /* @__PURE__ */ e("div", { className: "grid gap-4 py-4", children: /* @__PURE__ */ a("div", { className: "grid grid-cols-8 items-center gap-4", children: [
312
- /* @__PURE__ */ e(Ce, { className: "text-right", children: "Name" }),
313
+ /* @__PURE__ */ e(Ue, { className: "text-right", children: "Name" }),
313
314
  /* @__PURE__ */ e(
314
- ee,
315
+ re,
315
316
  {
316
317
  value: s,
317
318
  onChange: (N) => {
318
- n(N.target.value);
319
+ o(N.target.value);
319
320
  },
320
321
  id: "name",
321
322
  className: "col-span-7 focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"
@@ -323,8 +324,8 @@ function bt() {
323
324
  )
324
325
  ] }) }),
325
326
  t && /* @__PURE__ */ e("p", { className: "text-sm", children: "The lens name already exists. Use a differnet name." }),
326
- /* @__PURE__ */ e(ca, { children: /* @__PURE__ */ e(
327
- C,
327
+ /* @__PURE__ */ e(wa, { children: /* @__PURE__ */ e(
328
+ L,
328
329
  {
329
330
  size: "sm",
330
331
  variant: "outline",
@@ -337,18 +338,18 @@ function bt() {
337
338
  ] })
338
339
  ] });
339
340
  }
340
- function yt() {
341
- const [s, n] = S(!1), t = x((d) => d.lenses), r = x((d) => d.selectedLensId), { setLenses: l, setSelectedLensId: i } = ds(), { authToken: u, tokenProps: p } = j();
341
+ function Gt() {
342
+ const [s, o] = S(!1), t = w((d) => d.lenses), n = w((d) => d.selectedLensId), { setLenses: l, setSelectedLensId: c } = ws(), { authToken: u, tokenProps: p } = P();
342
343
  async function g(d) {
343
- i(d);
344
+ c(d);
344
345
  }
345
346
  async function v(d) {
346
- if (await vt(p.apiServiceUrl, d, u == null ? void 0 : u.accessToken)) {
347
+ if (await _t(p.apiServiceUrl, d, u == null ? void 0 : u.accessToken)) {
347
348
  const h = t == null ? void 0 : t.filter((b) => b.id !== d);
348
- l(h || []), i("original");
349
+ l(h || []), c("original");
349
350
  }
350
351
  }
351
- async function c(d) {
352
+ async function i(d) {
352
353
  const m = t == null ? void 0 : t.map((y) => y.id === d.id ? {
353
354
  ...y,
354
355
  isDefault: !d.isDefault
@@ -361,30 +362,30 @@ function yt() {
361
362
  ...d,
362
363
  isDefault: !d.isDefault
363
364
  };
364
- await Te(p.apiServiceUrl, h, u == null ? void 0 : u.accessToken);
365
+ await Ve(p.apiServiceUrl, h, u == null ? void 0 : u.accessToken);
365
366
  const b = t == null ? void 0 : t.find((y) => y.isDefault);
366
367
  if (b && b.id !== d.id) {
367
368
  const y = {
368
369
  ...b,
369
370
  isDefault: !1
370
371
  };
371
- await Te(p.apiServiceUrl, y, u == null ? void 0 : u.accessToken);
372
+ await Ve(p.apiServiceUrl, y, u == null ? void 0 : u.accessToken);
372
373
  }
373
374
  }
374
- return /* @__PURE__ */ a(_e, { open: s, onOpenChange: n, children: [
375
- /* @__PURE__ */ e(Ge, { asChild: !0, children: /* @__PURE__ */ e(F, { tooltip: "Lenses", className: "h-7 p-2", children: /* @__PURE__ */ e(it, { className: "h-4 w-4" }) }) }),
376
- /* @__PURE__ */ a(Re, { align: "end", className: "w-60", children: [
377
- /* @__PURE__ */ e(da, { className: "px-3", children: "Lenses" }),
378
- /* @__PURE__ */ e(ua, {}),
375
+ return /* @__PURE__ */ a(ze, { open: s, onOpenChange: o, children: [
376
+ /* @__PURE__ */ e($e, { asChild: !0, children: /* @__PURE__ */ e(j, { tooltip: "Lenses", className: "h-7 p-2", children: /* @__PURE__ */ e(Dt, { className: "h-4 w-4" }) }) }),
377
+ /* @__PURE__ */ a(Be, { align: "end", className: "w-60", children: [
378
+ /* @__PURE__ */ e(xa, { className: "px-3", children: "Lenses" }),
379
+ /* @__PURE__ */ e(Da, {}),
379
380
  /* @__PURE__ */ a(
380
- ma,
381
+ Ca,
381
382
  {
382
- value: r,
383
+ value: n,
383
384
  onValueChange: g,
384
385
  children: [
385
- /* @__PURE__ */ e(rs, { value: "original", children: "Original" }),
386
+ /* @__PURE__ */ e(gs, { value: "original", children: "Original" }),
386
387
  t == null ? void 0 : t.map((d) => /* @__PURE__ */ a(
387
- rs,
388
+ gs,
388
389
  {
389
390
  className: "group flex justify-between gap-2",
390
391
  value: d.id,
@@ -392,12 +393,12 @@ function yt() {
392
393
  /* @__PURE__ */ e("p", { children: d.name }),
393
394
  /* @__PURE__ */ a("span", { className: "flex items-center gap-3", children: [
394
395
  /* @__PURE__ */ e(
395
- ms,
396
+ Ds,
396
397
  {
397
398
  onClick: (m) => {
398
- m.preventDefault(), c(d);
399
+ m.preventDefault(), i(d);
399
400
  },
400
- className: ae(
401
+ className: Z(
401
402
  "size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",
402
403
  {
403
404
  invisible: !d.isDefault,
@@ -408,7 +409,7 @@ function yt() {
408
409
  }
409
410
  ),
410
411
  /* @__PURE__ */ e(
411
- hs,
412
+ Cs,
412
413
  {
413
414
  onClick: (m) => {
414
415
  m.preventDefault(), v(d.id);
@@ -428,119 +429,119 @@ function yt() {
428
429
  ] })
429
430
  ] });
430
431
  }
431
- const Nt = async (s, n, t) => {
432
- const r = `${s}/management/v1/groups`;
433
- return await ps(r, n, t);
434
- }, St = async (s, n, t) => {
435
- const r = `${s}/management/v1/groups/${t}`, l = await fetch(r, {
432
+ const Rt = async (s, o, t) => {
433
+ const n = `${s}/management/v1/groups`;
434
+ return await Ls(n, o, t);
435
+ }, Pt = async (s, o, t) => {
436
+ const n = `${s}/management/v1/groups/${t}`, l = await fetch(n, {
436
437
  method: "DELETE",
437
438
  headers: {
438
- Authorization: `Bearer ${n}`
439
+ Authorization: `Bearer ${o}`
439
440
  }
440
441
  });
441
442
  if (!l.ok) {
442
- const i = await l.text();
443
- throw new Error(i || "Failed to delete group");
443
+ const c = await l.text();
444
+ throw new Error(c || "Failed to delete group");
444
445
  }
445
- }, wt = async (s, n, t, r) => {
446
+ }, Ft = async (s, o, t, n) => {
446
447
  const l = `${s}/management/v1/groups/${t}/members`;
447
- return await ps(l, n, r);
448
- }, xt = async (s, n, t, r) => {
449
- const l = `${s}/management/v1/groups/${t}/members`, i = await fetch(l, {
448
+ return await Ls(l, o, n);
449
+ }, jt = async (s, o, t, n) => {
450
+ const l = `${s}/management/v1/groups/${t}/members`, c = await fetch(l, {
450
451
  method: "DELETE",
451
452
  headers: {
452
453
  "Content-Type": "application/json",
453
- Authorization: `Bearer ${n}`
454
+ Authorization: `Bearer ${o}`
454
455
  },
455
- body: JSON.stringify(r)
456
+ body: JSON.stringify(n)
456
457
  });
457
- if (!i.ok) {
458
- const u = await i.text();
458
+ if (!c.ok) {
459
+ const u = await c.text();
459
460
  throw new Error(u || "Failed to remove group members");
460
461
  }
461
462
  };
462
- function Dt() {
463
- const { authToken: s, tokenProps: n } = j(), t = me();
464
- return he({
465
- mutationFn: (r) => Nt(n.apiServiceUrl, (s == null ? void 0 : s.accessToken) || "", r),
463
+ function qt() {
464
+ const { authToken: s, tokenProps: o } = P(), t = be();
465
+ return ye({
466
+ mutationFn: (n) => Rt(o.apiServiceUrl, (s == null ? void 0 : s.accessToken) || "", n),
466
467
  onSuccess: () => {
467
- t.invalidateQueries({ queryKey: ["groups"] }), L.success("Group created successfully");
468
+ t.invalidateQueries({ queryKey: ["groups"] }), E.success("Group created successfully");
468
469
  },
469
- onError: (r) => {
470
- console.error("Failed to create group:", r), L.error("Failed to create group", {
471
- description: r.message
470
+ onError: (n) => {
471
+ console.error("Failed to create group:", n), E.error("Failed to create group", {
472
+ description: n.message
472
473
  });
473
474
  }
474
475
  });
475
476
  }
476
- function Ct() {
477
- const { authToken: s, tokenProps: n } = j(), t = me();
478
- return he({
479
- mutationFn: (r) => St(n.apiServiceUrl, (s == null ? void 0 : s.accessToken) || "", r),
480
- onSuccess: (r, l) => {
481
- t.invalidateQueries({ queryKey: ["groups"] }), t.removeQueries({ queryKey: ["group", l] }), L.success("Group deleted successfully");
477
+ function Ht() {
478
+ const { authToken: s, tokenProps: o } = P(), t = be();
479
+ return ye({
480
+ mutationFn: (n) => Pt(o.apiServiceUrl, (s == null ? void 0 : s.accessToken) || "", n),
481
+ onSuccess: (n, l) => {
482
+ t.invalidateQueries({ queryKey: ["groups"] }), t.removeQueries({ queryKey: ["group", l] }), E.success("Group deleted successfully");
482
483
  },
483
- onError: (r) => {
484
- console.error("Failed to delete group:", r), L.error("Failed to delete group", {
485
- description: r.message
484
+ onError: (n) => {
485
+ console.error("Failed to delete group:", n), E.error("Failed to delete group", {
486
+ description: n.message
486
487
  });
487
488
  }
488
489
  });
489
490
  }
490
- function Lt() {
491
- const { authToken: s, tokenProps: n } = j(), t = me();
492
- return he({
491
+ function Vt() {
492
+ const { authToken: s, tokenProps: o } = P(), t = be();
493
+ return ye({
493
494
  mutationFn: ({
494
- groupId: r,
495
+ groupId: n,
495
496
  data: l
496
- }) => wt(n.apiServiceUrl, (s == null ? void 0 : s.accessToken) || "", r, l),
497
- onSuccess: (r, l) => {
497
+ }) => Ft(o.apiServiceUrl, (s == null ? void 0 : s.accessToken) || "", n, l),
498
+ onSuccess: (n, l) => {
498
499
  t.invalidateQueries({ queryKey: ["group", l.groupId] }), t.invalidateQueries({
499
500
  queryKey: ["group-members", l.groupId]
500
- }), t.invalidateQueries({ queryKey: ["groups"] }), L.success("Members added successfully");
501
+ }), t.invalidateQueries({ queryKey: ["groups"] }), E.success("Members added successfully");
501
502
  },
502
- onError: (r) => {
503
- console.error("Failed to add group members:", r), L.error("Failed to add members", {
504
- description: r.message
503
+ onError: (n) => {
504
+ console.error("Failed to add group members:", n), E.error("Failed to add members", {
505
+ description: n.message
505
506
  });
506
507
  }
507
508
  });
508
509
  }
509
- function Et() {
510
- const { authToken: s, tokenProps: n } = j(), t = me();
511
- return he({
510
+ function zt() {
511
+ const { authToken: s, tokenProps: o } = P(), t = be();
512
+ return ye({
512
513
  mutationFn: ({
513
- groupId: r,
514
+ groupId: n,
514
515
  data: l
515
- }) => xt(n.apiServiceUrl, (s == null ? void 0 : s.accessToken) || "", r, l),
516
- onSuccess: (r, l) => {
516
+ }) => jt(o.apiServiceUrl, (s == null ? void 0 : s.accessToken) || "", n, l),
517
+ onSuccess: (n, l) => {
517
518
  t.invalidateQueries({ queryKey: ["group", l.groupId] }), t.invalidateQueries({
518
519
  queryKey: ["group-members", l.groupId]
519
- }), t.invalidateQueries({ queryKey: ["groups"] }), L.success("Members removed successfully");
520
+ }), t.invalidateQueries({ queryKey: ["groups"] }), E.success("Members removed successfully");
520
521
  },
521
- onError: (r) => {
522
- console.error("Failed to remove group members:", r), L.error("Failed to remove members", {
523
- description: r.message
522
+ onError: (n) => {
523
+ console.error("Failed to remove group members:", n), E.error("Failed to remove members", {
524
+ description: n.message
524
525
  });
525
526
  }
526
527
  });
527
528
  }
528
- function At({
529
+ function $t({
529
530
  onSuccess: s,
530
- tenantId: n,
531
+ tenantId: o,
531
532
  isTenantUser: t
532
533
  }) {
533
- const [r, l] = S(""), [i, u] = S(""), [p, g] = S({}), v = Dt(), c = () => {
534
+ const [n, l] = S(""), [c, u] = S(""), [p, g] = S({}), v = qt(), i = () => {
534
535
  const m = {};
535
- return r.trim() ? r.length < 3 ? m.name = "Group name must be at least 3 characters" : r.length > 50 && (m.name = "Group name must be less than 50 characters") : m.name = "Group name is required", i && i.length > 200 && (m.description = "Description must be less than 200 characters"), g(m), Object.keys(m).length === 0;
536
+ return n.trim() ? n.length < 3 ? m.name = "Group name must be at least 3 characters" : n.length > 50 && (m.name = "Group name must be less than 50 characters") : m.name = "Group name is required", c && c.length > 200 && (m.description = "Description must be less than 200 characters"), g(m), Object.keys(m).length === 0;
536
537
  };
537
538
  return /* @__PURE__ */ a("form", { onSubmit: async (m) => {
538
- if (m.preventDefault(), !c()) return;
539
+ if (m.preventDefault(), !i()) return;
539
540
  const h = {
540
- name: r.trim(),
541
- description: i.trim() || void 0,
541
+ name: n.trim(),
542
+ description: c.trim() || void 0,
542
543
  type: t ? "TENANT_GROUP" : "ORG_GROUP",
543
- ...t && n ? { tenantId: n } : {}
544
+ ...t && o ? { tenantId: o } : {}
544
545
  };
545
546
  try {
546
547
  await v.mutateAsync(h), l(""), u(""), g({}), s();
@@ -550,16 +551,16 @@ function At({
550
551
  }, className: "space-y-6", children: [
551
552
  /* @__PURE__ */ a("div", { className: "space-y-4", children: [
552
553
  /* @__PURE__ */ a("div", { className: "space-y-2", children: [
553
- /* @__PURE__ */ a(Ce, { htmlFor: "group-name", children: [
554
+ /* @__PURE__ */ a(Ue, { htmlFor: "group-name", children: [
554
555
  "Group Name ",
555
556
  /* @__PURE__ */ e("span", { className: "text-destructive", children: "*" })
556
557
  ] }),
557
558
  /* @__PURE__ */ e(
558
- ee,
559
+ re,
559
560
  {
560
561
  id: "group-name",
561
562
  placeholder: "e.g., Marketing Team, Engineering Squad",
562
- value: r,
563
+ value: n,
563
564
  onChange: (m) => {
564
565
  l(m.target.value), p.name && g((h) => ({ ...h, name: "" }));
565
566
  },
@@ -570,16 +571,16 @@ function At({
570
571
  p.name && /* @__PURE__ */ e("p", { className: "text-sm text-destructive", children: p.name })
571
572
  ] }),
572
573
  /* @__PURE__ */ a("div", { className: "space-y-2", children: [
573
- /* @__PURE__ */ a(Ce, { htmlFor: "group-description", children: [
574
+ /* @__PURE__ */ a(Ue, { htmlFor: "group-description", children: [
574
575
  "Description",
575
576
  /* @__PURE__ */ e("span", { className: "ml-2 text-xs text-muted-foreground", children: "(optional)" })
576
577
  ] }),
577
578
  /* @__PURE__ */ e(
578
- ha,
579
+ La,
579
580
  {
580
581
  id: "group-description",
581
582
  placeholder: "Describe the purpose of this group...",
582
- value: i,
583
+ value: c,
583
584
  onChange: (m) => {
584
585
  u(m.target.value), p.description && g((h) => ({ ...h, description: "" }));
585
586
  },
@@ -590,18 +591,18 @@ function At({
590
591
  ),
591
592
  p.description && /* @__PURE__ */ e("p", { className: "text-sm text-destructive", children: p.description }),
592
593
  /* @__PURE__ */ a("p", { className: "text-xs text-muted-foreground", children: [
593
- i.length,
594
+ c.length,
594
595
  "/200 characters"
595
596
  ] })
596
597
  ] }),
597
598
  /* @__PURE__ */ e("div", { className: "rounded-lg border bg-muted/50 p-4", children: /* @__PURE__ */ a("div", { className: "flex gap-3", children: [
598
- /* @__PURE__ */ e(pa, { className: "h-4 w-4 mt-0.5 text-muted-foreground" }),
599
+ /* @__PURE__ */ e(Ea, { className: "h-4 w-4 mt-0.5 text-muted-foreground" }),
599
600
  /* @__PURE__ */ e("div", { className: "text-sm text-muted-foreground", children: "This group will be accessible to users in your workspace. You can add members after creating the group." })
600
601
  ] }) })
601
602
  ] }),
602
603
  /* @__PURE__ */ a("div", { className: "flex justify-end gap-3", children: [
603
604
  /* @__PURE__ */ e(
604
- C,
605
+ L,
605
606
  {
606
607
  type: "button",
607
608
  variant: "outline",
@@ -613,15 +614,15 @@ function At({
613
614
  }
614
615
  ),
615
616
  /* @__PURE__ */ e(
616
- C,
617
+ L,
617
618
  {
618
619
  type: "submit",
619
- disabled: v.isPending || !r.trim(),
620
- children: v.isPending ? /* @__PURE__ */ a(M, { children: [
621
- /* @__PURE__ */ e(V, { className: "mr-2 h-4 w-4 animate-spin" }),
620
+ disabled: v.isPending || !n.trim(),
621
+ children: v.isPending ? /* @__PURE__ */ a(k, { children: [
622
+ /* @__PURE__ */ e(H, { className: "mr-2 h-4 w-4 animate-spin" }),
622
623
  "Creating..."
623
- ] }) : /* @__PURE__ */ a(M, { children: [
624
- /* @__PURE__ */ e(z, { className: "mr-2 h-4 w-4" }),
624
+ ] }) : /* @__PURE__ */ a(k, { children: [
625
+ /* @__PURE__ */ e(V, { className: "mr-2 h-4 w-4" }),
625
626
  "Create Group"
626
627
  ] })
627
628
  }
@@ -629,140 +630,140 @@ function At({
629
630
  ] })
630
631
  ] });
631
632
  }
632
- function Mt() {
633
- return pt.useSyncExternalStore(
634
- kt,
633
+ function Bt() {
634
+ return Ot.useSyncExternalStore(
635
+ Kt,
635
636
  () => !0,
636
637
  () => !1
637
638
  );
638
639
  }
639
- function kt() {
640
+ function Kt() {
640
641
  return () => {
641
642
  };
642
643
  }
643
- var $e = "Avatar", [Ot] = fa($e), [It, As] = Ot($e), Ms = _.forwardRef(
644
- (s, n) => {
645
- const { __scopeAvatar: t, ...r } = s, [l, i] = _.useState("idle");
644
+ var es = "Avatar", [Qt] = Aa(es), [Wt, js] = Qt(es), qs = _.forwardRef(
645
+ (s, o) => {
646
+ const { __scopeAvatar: t, ...n } = s, [l, c] = _.useState("idle");
646
647
  return /* @__PURE__ */ e(
647
- It,
648
+ Wt,
648
649
  {
649
650
  scope: t,
650
651
  imageLoadingStatus: l,
651
- onImageLoadingStatusChange: i,
652
- children: /* @__PURE__ */ e(ze.span, { ...r, ref: n })
652
+ onImageLoadingStatusChange: c,
653
+ children: /* @__PURE__ */ e(Ye.span, { ...n, ref: o })
653
654
  }
654
655
  );
655
656
  }
656
657
  );
657
- Ms.displayName = $e;
658
- var ks = "AvatarImage", Os = _.forwardRef(
659
- (s, n) => {
660
- const { __scopeAvatar: t, src: r, onLoadingStatusChange: l = () => {
661
- }, ...i } = s, u = As(ks, t), p = Tt(r, i), g = ga((v) => {
658
+ qs.displayName = es;
659
+ var Hs = "AvatarImage", Vs = _.forwardRef(
660
+ (s, o) => {
661
+ const { __scopeAvatar: t, src: n, onLoadingStatusChange: l = () => {
662
+ }, ...c } = s, u = js(Hs, t), p = Jt(n, c), g = ka((v) => {
662
663
  l(v), u.onImageLoadingStatusChange(v);
663
664
  });
664
- return Le(() => {
665
+ return Ge(() => {
665
666
  p !== "idle" && g(p);
666
- }, [p, g]), p === "loaded" ? /* @__PURE__ */ e(ze.img, { ...i, ref: n, src: r }) : null;
667
+ }, [p, g]), p === "loaded" ? /* @__PURE__ */ e(Ye.img, { ...c, ref: o, src: n }) : null;
667
668
  }
668
669
  );
669
- Os.displayName = ks;
670
- var Is = "AvatarFallback", Ts = _.forwardRef(
671
- (s, n) => {
672
- const { __scopeAvatar: t, delayMs: r, ...l } = s, i = As(Is, t), [u, p] = _.useState(r === void 0);
670
+ Vs.displayName = Hs;
671
+ var zs = "AvatarFallback", $s = _.forwardRef(
672
+ (s, o) => {
673
+ const { __scopeAvatar: t, delayMs: n, ...l } = s, c = js(zs, t), [u, p] = _.useState(n === void 0);
673
674
  return _.useEffect(() => {
674
- if (r !== void 0) {
675
- const g = window.setTimeout(() => p(!0), r);
675
+ if (n !== void 0) {
676
+ const g = window.setTimeout(() => p(!0), n);
676
677
  return () => window.clearTimeout(g);
677
678
  }
678
- }, [r]), u && i.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ e(ze.span, { ...l, ref: n }) : null;
679
+ }, [n]), u && c.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ e(Ye.span, { ...l, ref: o }) : null;
679
680
  }
680
681
  );
681
- Ts.displayName = Is;
682
- function cs(s, n) {
683
- return s ? n ? (s.src !== n && (s.src = n), s.complete && s.naturalWidth > 0 ? "loaded" : "loading") : "error" : "idle";
682
+ $s.displayName = zs;
683
+ function Ss(s, o) {
684
+ return s ? o ? (s.src !== o && (s.src = o), s.complete && s.naturalWidth > 0 ? "loaded" : "loading") : "error" : "idle";
684
685
  }
685
- function Tt(s, { referrerPolicy: n, crossOrigin: t }) {
686
- const r = Mt(), l = _.useRef(null), i = r ? (l.current || (l.current = new window.Image()), l.current) : null, [u, p] = _.useState(
687
- () => cs(i, s)
686
+ function Jt(s, { referrerPolicy: o, crossOrigin: t }) {
687
+ const n = Bt(), l = _.useRef(null), c = n ? (l.current || (l.current = new window.Image()), l.current) : null, [u, p] = _.useState(
688
+ () => Ss(c, s)
688
689
  );
689
- return Le(() => {
690
- p(cs(i, s));
691
- }, [i, s]), Le(() => {
690
+ return Ge(() => {
691
+ p(Ss(c, s));
692
+ }, [c, s]), Ge(() => {
692
693
  const g = (d) => () => {
693
694
  p(d);
694
695
  };
695
- if (!i) return;
696
- const v = g("loaded"), c = g("error");
697
- return i.addEventListener("load", v), i.addEventListener("error", c), n && (i.referrerPolicy = n), typeof t == "string" && (i.crossOrigin = t), () => {
698
- i.removeEventListener("load", v), i.removeEventListener("error", c);
696
+ if (!c) return;
697
+ const v = g("loaded"), i = g("error");
698
+ return c.addEventListener("load", v), c.addEventListener("error", i), o && (c.referrerPolicy = o), typeof t == "string" && (c.crossOrigin = t), () => {
699
+ c.removeEventListener("load", v), c.removeEventListener("error", i);
699
700
  };
700
- }, [i, t, n]), u;
701
+ }, [c, t, o]), u;
701
702
  }
702
- var _s = Ms, Gs = Os, Rs = Ts;
703
- const He = _.forwardRef(({ className: s, ...n }, t) => /* @__PURE__ */ e(
704
- _s,
703
+ var Bs = qs, Ks = Vs, Qs = $s;
704
+ const ss = _.forwardRef(({ className: s, ...o }, t) => /* @__PURE__ */ e(
705
+ Bs,
705
706
  {
706
707
  ref: t,
707
- className: ae(
708
+ className: Z(
708
709
  "relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
709
710
  s
710
711
  ),
711
- ...n
712
+ ...o
712
713
  }
713
714
  ));
714
- He.displayName = _s.displayName;
715
- const _t = _.forwardRef(({ className: s, ...n }, t) => /* @__PURE__ */ e(
716
- Gs,
715
+ ss.displayName = Bs.displayName;
716
+ const Zt = _.forwardRef(({ className: s, ...o }, t) => /* @__PURE__ */ e(
717
+ Ks,
717
718
  {
718
719
  ref: t,
719
- className: ae("aspect-square h-full w-full", s),
720
- ...n
720
+ className: Z("aspect-square h-full w-full", s),
721
+ ...o
721
722
  }
722
723
  ));
723
- _t.displayName = Gs.displayName;
724
- const Be = _.forwardRef(({ className: s, ...n }, t) => /* @__PURE__ */ e(
725
- Rs,
724
+ Zt.displayName = Ks.displayName;
725
+ const as = _.forwardRef(({ className: s, ...o }, t) => /* @__PURE__ */ e(
726
+ Qs,
726
727
  {
727
728
  ref: t,
728
- className: ae(
729
+ className: Z(
729
730
  "flex h-full w-full items-center justify-center rounded-full bg-muted",
730
731
  s
731
732
  ),
732
- ...n
733
+ ...o
733
734
  }
734
735
  ));
735
- Be.displayName = Rs.displayName;
736
- function Gt({
736
+ as.displayName = Qs.displayName;
737
+ function Xt({
737
738
  open: s,
738
- onOpenChange: n,
739
+ onOpenChange: o,
739
740
  group: t,
740
- onUpdate: r
741
+ onUpdate: n
741
742
  }) {
742
- const [l, i] = S("members"), [u, p] = S(""), [g, v] = S([]), [c, d] = S([]), { data: m, isLoading: h, refetch: b } = va(t.id), y = t.type === "TENANT_GROUP" ? "tenant" : "organization", { users: N, isLoading: A } = ba({
743
+ const [l, c] = S("members"), [u, p] = S(""), [g, v] = S([]), [i, d] = S([]), { data: m, isLoading: h, refetch: b } = Ma(t.id), y = t.type === "TENANT_GROUP" ? "tenant" : "organization", { users: N, isLoading: A } = Oa({
743
744
  type: y,
744
745
  tenantId: t.tenantId || void 0,
745
746
  active: !0,
746
747
  limit: 100
747
- }), I = Lt(), G = Et(), k = (m == null ? void 0 : m.members) || [], $ = ce(() => new Set(k.map((f) => f.userId)), [k]), P = ce(() => N.filter((f) => !$.has(f.id)), [N, $]), H = ce(() => {
748
- if (!u) return P;
748
+ }), I = Vt(), U = zt(), M = (m == null ? void 0 : m.members) || [], z = fe(() => new Set(M.map((f) => f.userId)), [M]), R = fe(() => N.filter((f) => !z.has(f.id)), [N, z]), $ = fe(() => {
749
+ if (!u) return R;
749
750
  const f = u.toLowerCase();
750
- return P.filter(
751
- (E) => {
752
- var T, w;
753
- return ((T = E.name) == null ? void 0 : T.toLowerCase().includes(f)) || ((w = E.email) == null ? void 0 : w.toLowerCase().includes(f));
751
+ return R.filter(
752
+ (C) => {
753
+ var T, F;
754
+ return ((T = C.name) == null ? void 0 : T.toLowerCase().includes(f)) || ((F = C.email) == null ? void 0 : F.toLowerCase().includes(f));
754
755
  }
755
756
  );
756
- }, [P, u]), D = ce(() => {
757
- if (!u) return k;
757
+ }, [R, u]), x = fe(() => {
758
+ if (!u) return M;
758
759
  const f = u.toLowerCase();
759
- return k.filter(
760
- (E) => {
761
- var T, w, U, q;
762
- return ((w = (T = E.user) == null ? void 0 : T.name) == null ? void 0 : w.toLowerCase().includes(f)) || ((q = (U = E.user) == null ? void 0 : U.email) == null ? void 0 : q.toLowerCase().includes(f));
760
+ return M.filter(
761
+ (C) => {
762
+ var T, F, ie, D;
763
+ return ((F = (T = C.user) == null ? void 0 : T.name) == null ? void 0 : F.toLowerCase().includes(f)) || ((D = (ie = C.user) == null ? void 0 : ie.email) == null ? void 0 : D.toLowerCase().includes(f));
763
764
  }
764
765
  );
765
- }, [k, u]), R = async () => {
766
+ }, [M, u]), B = async () => {
766
767
  if (g.length !== 0)
767
768
  try {
768
769
  await I.mutateAsync({
@@ -771,38 +772,38 @@ function Gt({
771
772
  userIds: g,
772
773
  userType: y === "tenant" ? "tenant" : "org"
773
774
  }
774
- }), v([]), i("members"), b(), r == null || r();
775
+ }), v([]), c("members"), b(), n == null || n();
775
776
  } catch (f) {
776
777
  console.error("Failed to add members:", f);
777
778
  }
778
- }, B = async () => {
779
- if (c.length !== 0)
779
+ }, K = async () => {
780
+ if (i.length !== 0)
780
781
  try {
781
- await G.mutateAsync({
782
+ await U.mutateAsync({
782
783
  groupId: t.id,
783
784
  data: {
784
- userIds: c
785
+ userIds: i
785
786
  }
786
- }), d([]), b(), r == null || r();
787
+ }), d([]), b(), n == null || n();
787
788
  } catch (f) {
788
789
  console.error("Failed to remove members:", f);
789
790
  }
790
- }, pe = (f) => {
791
+ }, Q = (f) => {
791
792
  v(
792
- (E) => E.includes(f) ? E.filter((T) => T !== f) : [...E, f]
793
+ (C) => C.includes(f) ? C.filter((T) => T !== f) : [...C, f]
793
794
  );
794
- }, K = (f) => {
795
+ }, W = (f) => {
795
796
  d(
796
- (E) => E.includes(f) ? E.filter((T) => T !== f) : [...E, f]
797
+ (C) => C.includes(f) ? C.filter((T) => T !== f) : [...C, f]
797
798
  );
798
799
  };
799
- return /* @__PURE__ */ e(M, { children: /* @__PURE__ */ e(Ue, { open: s, onOpenChange: n, children: /* @__PURE__ */ a(je, { className: "max-w-3xl max-h-[80vh]", "aria-describedby": "group-members-description", children: [
800
- /* @__PURE__ */ a(qe, { children: [
801
- /* @__PURE__ */ e(Ve, { children: t.name }),
800
+ return /* @__PURE__ */ e(k, { children: /* @__PURE__ */ e(Qe, { open: s, onOpenChange: o, children: /* @__PURE__ */ a(Je, { className: "max-w-3xl max-h-[80vh]", "aria-describedby": "group-members-description", children: [
801
+ /* @__PURE__ */ a(Ze, { children: [
802
+ /* @__PURE__ */ e(Xe, { children: t.name }),
802
803
  /* @__PURE__ */ e("div", { className: "flex items-center gap-2 mt-1", children: /* @__PURE__ */ a("p", { className: "text-sm text-muted-foreground", children: [
803
- k.length,
804
+ M.length,
804
805
  " ",
805
- k.length === 1 ? "member" : "members"
806
+ M.length === 1 ? "member" : "members"
806
807
  ] }) }),
807
808
  /* @__PURE__ */ a("p", { id: "group-members-description", className: "sr-only", children: [
808
809
  "Add or remove members from the ",
@@ -810,18 +811,18 @@ function Gt({
810
811
  " group"
811
812
  ] })
812
813
  ] }),
813
- /* @__PURE__ */ a(fs, { value: l, onValueChange: (f) => {
814
- i(f), p(""), d([]);
814
+ /* @__PURE__ */ a(Es, { value: l, onValueChange: (f) => {
815
+ c(f), p(""), d([]);
815
816
  }, className: "mt-4", children: [
816
- /* @__PURE__ */ a(gs, { className: "grid w-full grid-cols-2", children: [
817
- /* @__PURE__ */ e(de, { value: "members", children: "Current Members" }),
818
- /* @__PURE__ */ e(de, { value: "add", children: "Add Members" })
817
+ /* @__PURE__ */ a(As, { className: "grid w-full grid-cols-2", children: [
818
+ /* @__PURE__ */ e(ge, { value: "members", children: "Current Members" }),
819
+ /* @__PURE__ */ e(ge, { value: "add", children: "Add Members" })
819
820
  ] }),
820
- /* @__PURE__ */ a(ue, { value: "members", className: "mt-4 space-y-4", children: [
821
+ /* @__PURE__ */ a(ve, { value: "members", className: "mt-4 space-y-4", children: [
821
822
  /* @__PURE__ */ a("div", { className: "relative", children: [
822
- /* @__PURE__ */ e(Ee, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
823
+ /* @__PURE__ */ e(Re, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
823
824
  /* @__PURE__ */ e(
824
- ee,
825
+ re,
825
826
  {
826
827
  placeholder: "Search members...",
827
828
  value: u,
@@ -830,49 +831,49 @@ function Gt({
830
831
  }
831
832
  )
832
833
  ] }),
833
- /* @__PURE__ */ e(Ae, { className: c.length > 0 ? "h-[300px]" : "h-[350px]", children: h ? /* @__PURE__ */ e("div", { className: "space-y-2", children: [1, 2, 3].map((f) => /* @__PURE__ */ e(Me, { className: "h-16 w-full" }, f)) }) : D.length === 0 ? /* @__PURE__ */ a("div", { className: "flex flex-col items-center justify-center py-12 text-muted-foreground", children: [
834
- /* @__PURE__ */ e(z, { className: "h-12 w-12 mb-3 opacity-50" }),
834
+ /* @__PURE__ */ e(Pe, { className: i.length > 0 ? "h-[300px]" : "h-[350px]", children: h ? /* @__PURE__ */ e("div", { className: "space-y-2", children: [1, 2, 3].map((f) => /* @__PURE__ */ e(Fe, { className: "h-16 w-full" }, f)) }) : x.length === 0 ? /* @__PURE__ */ a("div", { className: "flex flex-col items-center justify-center py-12 text-muted-foreground", children: [
835
+ /* @__PURE__ */ e(V, { className: "h-12 w-12 mb-3 opacity-50" }),
835
836
  /* @__PURE__ */ e("p", { className: "text-sm font-medium", children: u ? "No members found" : "No members yet" }),
836
837
  /* @__PURE__ */ e("p", { className: "text-xs mt-1", children: u ? "Try a different search" : 'Switch to the "Add Members" tab to add people to this group' })
837
- ] }) : /* @__PURE__ */ e("div", { className: "space-y-2", children: D.map((f) => /* @__PURE__ */ e(
838
- Rt,
838
+ ] }) : /* @__PURE__ */ e("div", { className: "space-y-2", children: x.map((f) => /* @__PURE__ */ e(
839
+ Yt,
839
840
  {
840
841
  member: f,
841
- selected: c.includes(f.userId),
842
- onToggle: () => K(f.userId)
842
+ selected: i.includes(f.userId),
843
+ onToggle: () => W(f.userId)
843
844
  },
844
845
  f.id
845
846
  )) }) }),
846
- c.length > 0 && /* @__PURE__ */ a("div", { className: "flex items-center justify-between pt-4 border-t", children: [
847
+ i.length > 0 && /* @__PURE__ */ a("div", { className: "flex items-center justify-between pt-4 border-t", children: [
847
848
  /* @__PURE__ */ a("span", { className: "text-sm text-muted-foreground", children: [
848
- c.length,
849
+ i.length,
849
850
  " member",
850
- c.length !== 1 ? "s" : "",
851
+ i.length !== 1 ? "s" : "",
851
852
  " selected"
852
853
  ] }),
853
854
  /* @__PURE__ */ e(
854
- C,
855
+ L,
855
856
  {
856
857
  variant: "destructive",
857
858
  size: "sm",
858
- onClick: B,
859
- disabled: G.isPending,
860
- children: G.isPending ? /* @__PURE__ */ a(M, { children: [
861
- /* @__PURE__ */ e(V, { className: "mr-2 h-4 w-4 animate-spin" }),
859
+ onClick: K,
860
+ disabled: U.isPending,
861
+ children: U.isPending ? /* @__PURE__ */ a(k, { children: [
862
+ /* @__PURE__ */ e(H, { className: "mr-2 h-4 w-4 animate-spin" }),
862
863
  "Removing..."
863
- ] }) : /* @__PURE__ */ a(M, { children: [
864
- /* @__PURE__ */ e(vs, { className: "mr-2 h-4 w-4" }),
864
+ ] }) : /* @__PURE__ */ a(k, { children: [
865
+ /* @__PURE__ */ e(ks, { className: "mr-2 h-4 w-4" }),
865
866
  "Remove Selected"
866
867
  ] })
867
868
  }
868
869
  )
869
870
  ] })
870
871
  ] }),
871
- /* @__PURE__ */ a(ue, { value: "add", className: "mt-4 space-y-4", children: [
872
+ /* @__PURE__ */ a(ve, { value: "add", className: "mt-4 space-y-4", children: [
872
873
  /* @__PURE__ */ a("div", { className: "relative", children: [
873
- /* @__PURE__ */ e(Ee, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
874
+ /* @__PURE__ */ e(Re, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
874
875
  /* @__PURE__ */ e(
875
- ee,
876
+ re,
876
877
  {
877
878
  placeholder: "Search users to add...",
878
879
  value: u,
@@ -881,16 +882,16 @@ function Gt({
881
882
  }
882
883
  )
883
884
  ] }),
884
- /* @__PURE__ */ e(Ae, { className: "h-[300px]", children: A ? /* @__PURE__ */ e("div", { className: "space-y-2", children: [1, 2, 3].map((f) => /* @__PURE__ */ e(Me, { className: "h-16 w-full" }, f)) }) : H.length === 0 ? /* @__PURE__ */ a("div", { className: "flex flex-col items-center justify-center py-12 text-muted-foreground", children: [
885
- /* @__PURE__ */ e(ke, { className: "h-12 w-12 mb-3 opacity-50" }),
885
+ /* @__PURE__ */ e(Pe, { className: "h-[300px]", children: A ? /* @__PURE__ */ e("div", { className: "space-y-2", children: [1, 2, 3].map((f) => /* @__PURE__ */ e(Fe, { className: "h-16 w-full" }, f)) }) : $.length === 0 ? /* @__PURE__ */ a("div", { className: "flex flex-col items-center justify-center py-12 text-muted-foreground", children: [
886
+ /* @__PURE__ */ e(je, { className: "h-12 w-12 mb-3 opacity-50" }),
886
887
  /* @__PURE__ */ e("p", { className: "text-sm font-medium", children: "No available users" }),
887
888
  /* @__PURE__ */ e("p", { className: "text-xs mt-1", children: u ? "Try a different search" : "All eligible users are already members" })
888
- ] }) : /* @__PURE__ */ e("div", { className: "space-y-2", children: H.map((f) => /* @__PURE__ */ e(
889
- Pt,
889
+ ] }) : /* @__PURE__ */ e("div", { className: "space-y-2", children: $.map((f) => /* @__PURE__ */ e(
890
+ en,
890
891
  {
891
892
  user: f,
892
893
  selected: g.includes(f.id),
893
- onToggle: () => pe(f.id)
894
+ onToggle: () => Q(f.id)
894
895
  },
895
896
  f.id
896
897
  )) }) }),
@@ -902,15 +903,15 @@ function Gt({
902
903
  " selected"
903
904
  ] }),
904
905
  /* @__PURE__ */ e(
905
- C,
906
+ L,
906
907
  {
907
- onClick: R,
908
+ onClick: B,
908
909
  disabled: I.isPending,
909
- children: I.isPending ? /* @__PURE__ */ a(M, { children: [
910
- /* @__PURE__ */ e(V, { className: "mr-2 h-4 w-4 animate-spin" }),
910
+ children: I.isPending ? /* @__PURE__ */ a(k, { children: [
911
+ /* @__PURE__ */ e(H, { className: "mr-2 h-4 w-4 animate-spin" }),
911
912
  "Adding..."
912
- ] }) : /* @__PURE__ */ a(M, { children: [
913
- /* @__PURE__ */ e(ke, { className: "mr-2 h-4 w-4" }),
913
+ ] }) : /* @__PURE__ */ a(k, { children: [
914
+ /* @__PURE__ */ e(je, { className: "mr-2 h-4 w-4" }),
914
915
  "Add Members"
915
916
  ] })
916
917
  }
@@ -920,21 +921,21 @@ function Gt({
920
921
  ] })
921
922
  ] }) }) });
922
923
  }
923
- function Rt({
924
+ function Yt({
924
925
  member: s,
925
- selected: n,
926
+ selected: o,
926
927
  onToggle: t
927
928
  }) {
928
- var l, i, u, p;
929
- const r = ((i = (l = s.user) == null ? void 0 : l.name) == null ? void 0 : i.split(" ").map((g) => g[0]).join("").toUpperCase()) || "?";
929
+ var l, c, u, p;
930
+ const n = ((c = (l = s.user) == null ? void 0 : l.name) == null ? void 0 : c.split(" ").map((g) => g[0]).join("").toUpperCase()) || "?";
930
931
  return /* @__PURE__ */ a(
931
932
  "div",
932
933
  {
933
934
  className: "flex items-center gap-3 p-3 rounded-lg border bg-card hover:bg-muted/50 cursor-pointer",
934
935
  onClick: t,
935
936
  children: [
936
- /* @__PURE__ */ e(bs, { checked: n }),
937
- /* @__PURE__ */ e(He, { className: "h-8 w-8", children: /* @__PURE__ */ e(Be, { className: "text-xs", children: r }) }),
937
+ /* @__PURE__ */ e(Ms, { checked: o }),
938
+ /* @__PURE__ */ e(ss, { className: "h-8 w-8", children: /* @__PURE__ */ e(as, { className: "text-xs", children: n }) }),
938
939
  /* @__PURE__ */ a("div", { className: "flex-1", children: [
939
940
  /* @__PURE__ */ e("p", { className: "text-sm font-medium", children: ((u = s.user) == null ? void 0 : u.name) || "Unknown User" }),
940
941
  /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: (p = s.user) == null ? void 0 : p.email })
@@ -943,21 +944,21 @@ function Rt({
943
944
  }
944
945
  );
945
946
  }
946
- function Pt({
947
+ function en({
947
948
  user: s,
948
- selected: n,
949
+ selected: o,
949
950
  onToggle: t
950
951
  }) {
951
952
  var l;
952
- const r = ((l = s.name) == null ? void 0 : l.split(" ").map((i) => i[0]).join("").toUpperCase()) || "?";
953
+ const n = ((l = s.name) == null ? void 0 : l.split(" ").map((c) => c[0]).join("").toUpperCase()) || "?";
953
954
  return /* @__PURE__ */ a(
954
955
  "div",
955
956
  {
956
957
  className: "flex items-center gap-3 p-3 rounded-lg border bg-card hover:bg-muted/50 cursor-pointer",
957
958
  onClick: t,
958
959
  children: [
959
- /* @__PURE__ */ e(bs, { checked: n }),
960
- /* @__PURE__ */ e(He, { className: "h-8 w-8", children: /* @__PURE__ */ e(Be, { className: "text-xs", children: r }) }),
960
+ /* @__PURE__ */ e(Ms, { checked: o }),
961
+ /* @__PURE__ */ e(ss, { className: "h-8 w-8", children: /* @__PURE__ */ e(as, { className: "text-xs", children: n }) }),
961
962
  /* @__PURE__ */ a("div", { className: "flex-1", children: [
962
963
  /* @__PURE__ */ e("p", { className: "text-sm font-medium", children: s.name }),
963
964
  /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: s.email })
@@ -966,83 +967,83 @@ function Pt({
966
967
  }
967
968
  );
968
969
  }
969
- function Ut({
970
+ function sn({
970
971
  open: s,
971
- onOpenChange: n
972
+ onOpenChange: o
972
973
  }) {
973
- const [t, r] = S("groups"), [l, i] = S(""), [u, p] = S(null), [g, v] = S(!1), [c, d] = S(null), { tokenProps: m } = j(), { currentUser: h } = ys(), b = Ct(), y = (h == null ? void 0 : h.type) === "tenant", N = m == null ? void 0 : m.tenantId, { groups: A, isLoading: I, refetch: G } = ya({
974
+ const [t, n] = S("groups"), [l, c] = S(""), [u, p] = S(null), [g, v] = S(!1), [i, d] = S(null), { tokenProps: m } = P(), { currentUser: h } = Os(), b = Ht(), y = (h == null ? void 0 : h.type) === "tenant", N = m == null ? void 0 : m.tenantId, { groups: A, isLoading: I, refetch: U } = Ia({
974
975
  type: y ? "TENANT_GROUP" : "all",
975
976
  tenantId: y ? N : void 0,
976
977
  includeMembers: !1
977
- }), k = A.filter(
978
- (D) => {
979
- var R;
980
- return D.name.toLowerCase().includes(l.toLowerCase()) || ((R = D.description) == null ? void 0 : R.toLowerCase().includes(l.toLowerCase()));
978
+ }), M = A.filter(
979
+ (x) => {
980
+ var B;
981
+ return x.name.toLowerCase().includes(l.toLowerCase()) || ((B = x.description) == null ? void 0 : B.toLowerCase().includes(l.toLowerCase()));
981
982
  }
982
- ), $ = async () => {
983
- if (c)
983
+ ), z = async () => {
984
+ if (i)
984
985
  try {
985
- await b.mutateAsync(c.id), d(null), G();
986
- } catch (D) {
987
- console.error("Failed to delete group:", D);
986
+ await b.mutateAsync(i.id), d(null), U();
987
+ } catch (x) {
988
+ console.error("Failed to delete group:", x);
988
989
  }
989
- }, P = (D) => {
990
- p(D), v(!0);
991
- }, H = () => {
992
- r("groups"), G();
990
+ }, R = (x) => {
991
+ p(x), v(!0);
992
+ }, $ = () => {
993
+ n("groups"), U();
993
994
  };
994
- return /* @__PURE__ */ a(M, { children: [
995
- /* @__PURE__ */ e(Ue, { open: s, onOpenChange: n, children: /* @__PURE__ */ a(je, { className: "max-w-4xl max-h-[80vh]", children: [
996
- /* @__PURE__ */ a(qe, { children: [
997
- /* @__PURE__ */ a(Ve, { className: "flex items-center gap-2", children: [
998
- /* @__PURE__ */ e(z, { className: "h-5 w-5" }),
995
+ return /* @__PURE__ */ a(k, { children: [
996
+ /* @__PURE__ */ e(Qe, { open: s, onOpenChange: o, children: /* @__PURE__ */ a(Je, { className: "max-w-4xl max-h-[80vh]", children: [
997
+ /* @__PURE__ */ a(Ze, { children: [
998
+ /* @__PURE__ */ a(Xe, { className: "flex items-center gap-2", children: [
999
+ /* @__PURE__ */ e(V, { className: "h-5 w-5" }),
999
1000
  "Group Management"
1000
1001
  ] }),
1001
- /* @__PURE__ */ e(us, { children: "Manage your groups, create new groups, and control group membership" })
1002
+ /* @__PURE__ */ e(xs, { children: "Manage your groups, create new groups, and control group membership" })
1002
1003
  ] }),
1003
- /* @__PURE__ */ a(fs, { value: t, onValueChange: r, className: "mt-4", children: [
1004
- /* @__PURE__ */ a(gs, { className: "grid w-full grid-cols-2", children: [
1005
- /* @__PURE__ */ a(de, { value: "groups", className: "flex items-center gap-2", children: [
1006
- /* @__PURE__ */ e(z, { className: "h-4 w-4" }),
1004
+ /* @__PURE__ */ a(Es, { value: t, onValueChange: n, className: "mt-4", children: [
1005
+ /* @__PURE__ */ a(As, { className: "grid w-full grid-cols-2", children: [
1006
+ /* @__PURE__ */ a(ge, { value: "groups", className: "flex items-center gap-2", children: [
1007
+ /* @__PURE__ */ e(V, { className: "h-4 w-4" }),
1007
1008
  "Groups"
1008
1009
  ] }),
1009
- /* @__PURE__ */ a(de, { value: "create", className: "flex items-center gap-2", children: [
1010
- /* @__PURE__ */ e(Fe, { className: "h-4 w-4" }),
1010
+ /* @__PURE__ */ a(ge, { value: "create", className: "flex items-center gap-2", children: [
1011
+ /* @__PURE__ */ e(We, { className: "h-4 w-4" }),
1011
1012
  "Create Group"
1012
1013
  ] })
1013
1014
  ] }),
1014
- /* @__PURE__ */ e(ue, { value: "groups", className: "mt-4", children: /* @__PURE__ */ a("div", { className: "space-y-4", children: [
1015
+ /* @__PURE__ */ e(ve, { value: "groups", className: "mt-4", children: /* @__PURE__ */ a("div", { className: "space-y-4", children: [
1015
1016
  /* @__PURE__ */ a("div", { className: "relative", children: [
1016
- /* @__PURE__ */ e(Ee, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
1017
+ /* @__PURE__ */ e(Re, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
1017
1018
  /* @__PURE__ */ e(
1018
- ee,
1019
+ re,
1019
1020
  {
1020
1021
  placeholder: "Search groups...",
1021
1022
  value: l,
1022
- onChange: (D) => i(D.target.value),
1023
+ onChange: (x) => c(x.target.value),
1023
1024
  className: "pl-10"
1024
1025
  }
1025
1026
  )
1026
1027
  ] }),
1027
- /* @__PURE__ */ e(Ae, { className: "h-[400px]", children: I ? /* @__PURE__ */ e("div", { className: "space-y-3", children: [1, 2, 3].map((D) => /* @__PURE__ */ e(Me, { className: "h-24 w-full" }, D)) }) : k.length === 0 ? /* @__PURE__ */ a("div", { className: "flex flex-col items-center justify-center py-12 text-muted-foreground", children: [
1028
- /* @__PURE__ */ e(z, { className: "h-12 w-12 mb-3 opacity-50" }),
1028
+ /* @__PURE__ */ e(Pe, { className: "h-[400px]", children: I ? /* @__PURE__ */ e("div", { className: "space-y-3", children: [1, 2, 3].map((x) => /* @__PURE__ */ e(Fe, { className: "h-24 w-full" }, x)) }) : M.length === 0 ? /* @__PURE__ */ a("div", { className: "flex flex-col items-center justify-center py-12 text-muted-foreground", children: [
1029
+ /* @__PURE__ */ e(V, { className: "h-12 w-12 mb-3 opacity-50" }),
1029
1030
  /* @__PURE__ */ e("p", { className: "text-sm font-medium", children: "No groups found" }),
1030
1031
  /* @__PURE__ */ e("p", { className: "text-xs mt-1", children: l ? "Try a different search" : "Create your first group to get started" })
1031
- ] }) : /* @__PURE__ */ e("div", { className: "space-y-3", children: k.map((D) => /* @__PURE__ */ e(
1032
- Ft,
1032
+ ] }) : /* @__PURE__ */ e("div", { className: "space-y-3", children: M.map((x) => /* @__PURE__ */ e(
1033
+ an,
1033
1034
  {
1034
- group: D,
1035
- onManageMembers: () => P(D),
1036
- onDelete: () => d(D),
1035
+ group: x,
1036
+ onManageMembers: () => R(x),
1037
+ onDelete: () => d(x),
1037
1038
  currentUserId: h == null ? void 0 : h.id
1038
1039
  },
1039
- D.id
1040
+ x.id
1040
1041
  )) }) })
1041
1042
  ] }) }),
1042
- /* @__PURE__ */ e(ue, { value: "create", className: "mt-4", children: /* @__PURE__ */ e(
1043
- At,
1043
+ /* @__PURE__ */ e(ve, { value: "create", className: "mt-4", children: /* @__PURE__ */ e(
1044
+ $t,
1044
1045
  {
1045
- onSuccess: H,
1046
+ onSuccess: $,
1046
1047
  tenantId: N,
1047
1048
  isTenantUser: y
1048
1049
  }
@@ -1050,38 +1051,38 @@ function Ut({
1050
1051
  ] })
1051
1052
  ] }) }),
1052
1053
  u && /* @__PURE__ */ e(
1053
- Gt,
1054
+ Xt,
1054
1055
  {
1055
1056
  open: g,
1056
1057
  onOpenChange: v,
1057
1058
  group: u,
1058
- onUpdate: () => G()
1059
+ onUpdate: () => U()
1059
1060
  }
1060
1061
  ),
1061
1062
  /* @__PURE__ */ e(
1062
- Ns,
1063
+ Is,
1063
1064
  {
1064
- open: !!c,
1065
+ open: !!i,
1065
1066
  onOpenChange: () => d(null),
1066
- children: /* @__PURE__ */ a(Ss, { children: [
1067
- /* @__PURE__ */ a(ws, { children: [
1068
- /* @__PURE__ */ e(xs, { children: "Delete Group" }),
1069
- /* @__PURE__ */ a(Ds, { children: [
1067
+ children: /* @__PURE__ */ a(Ts, { children: [
1068
+ /* @__PURE__ */ a(_s, { children: [
1069
+ /* @__PURE__ */ e(Us, { children: "Delete Group" }),
1070
+ /* @__PURE__ */ a(Gs, { children: [
1070
1071
  'Are you sure you want to delete "',
1071
- c == null ? void 0 : c.name,
1072
+ i == null ? void 0 : i.name,
1072
1073
  '"? This action cannot be undone and will remove all members from the group.'
1073
1074
  ] })
1074
1075
  ] }),
1075
- /* @__PURE__ */ a(Cs, { children: [
1076
- /* @__PURE__ */ e(Ls, { children: "Cancel" }),
1076
+ /* @__PURE__ */ a(Rs, { children: [
1077
+ /* @__PURE__ */ e(Ps, { children: "Cancel" }),
1077
1078
  /* @__PURE__ */ e(
1078
- Oe,
1079
+ qe,
1079
1080
  {
1080
- onClick: $,
1081
+ onClick: z,
1081
1082
  disabled: b.isPending,
1082
1083
  className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
1083
- children: b.isPending ? /* @__PURE__ */ a(M, { children: [
1084
- /* @__PURE__ */ e(V, { className: "mr-2 h-4 w-4 animate-spin" }),
1084
+ children: b.isPending ? /* @__PURE__ */ a(k, { children: [
1085
+ /* @__PURE__ */ e(H, { className: "mr-2 h-4 w-4 animate-spin" }),
1085
1086
  "Deleting..."
1086
1087
  ] }) : "Delete Group"
1087
1088
  }
@@ -1092,13 +1093,13 @@ function Ut({
1092
1093
  )
1093
1094
  ] });
1094
1095
  }
1095
- function Ft({
1096
+ function an({
1096
1097
  group: s,
1097
- onManageMembers: n,
1098
+ onManageMembers: o,
1098
1099
  onDelete: t,
1099
- currentUserId: r
1100
+ currentUserId: n
1100
1101
  }) {
1101
- const l = s.createdBy === r;
1102
+ const l = s.createdBy === n;
1102
1103
  return /* @__PURE__ */ e("div", { className: "rounded-lg border bg-card p-4 transition-colors hover:bg-muted/50", children: /* @__PURE__ */ a("div", { className: "flex items-start justify-between gap-3", children: [
1103
1104
  /* @__PURE__ */ a("div", { className: "flex-1 space-y-2", children: [
1104
1105
  /* @__PURE__ */ a("div", { children: [
@@ -1107,177 +1108,194 @@ function Ft({
1107
1108
  ] }),
1108
1109
  /* @__PURE__ */ a("div", { className: "flex flex-wrap items-center gap-3 text-xs text-muted-foreground", children: [
1109
1110
  /* @__PURE__ */ a("span", { className: "flex items-center gap-1", children: [
1110
- /* @__PURE__ */ e(z, { className: "h-3 w-3" }),
1111
+ /* @__PURE__ */ e(V, { className: "h-3 w-3" }),
1111
1112
  s.memberCount,
1112
1113
  " ",
1113
1114
  s.memberCount === 1 ? "member" : "members"
1114
1115
  ] }),
1115
1116
  /* @__PURE__ */ a("span", { children: [
1116
1117
  "Created ",
1117
- rt(new Date(s.createdAt), "MMM d, yyyy")
1118
+ Nt(new Date(s.createdAt), "MMM d, yyyy")
1118
1119
  ] })
1119
1120
  ] })
1120
1121
  ] }),
1121
1122
  /* @__PURE__ */ a("div", { className: "flex items-center gap-1", children: [
1122
1123
  /* @__PURE__ */ e(
1123
- C,
1124
+ L,
1124
1125
  {
1125
1126
  variant: "ghost",
1126
1127
  size: "sm",
1127
- onClick: n,
1128
+ onClick: o,
1128
1129
  title: "Manage members",
1129
- children: /* @__PURE__ */ e(ke, { className: "h-4 w-4" })
1130
+ children: /* @__PURE__ */ e(je, { className: "h-4 w-4" })
1130
1131
  }
1131
1132
  ),
1132
1133
  l && /* @__PURE__ */ e(
1133
- C,
1134
+ L,
1134
1135
  {
1135
1136
  variant: "ghost",
1136
1137
  size: "sm",
1137
1138
  onClick: t,
1138
1139
  title: "Delete group",
1139
1140
  className: "text-destructive hover:text-destructive",
1140
- children: /* @__PURE__ */ e(vs, { className: "h-4 w-4" })
1141
+ children: /* @__PURE__ */ e(ks, { className: "h-4 w-4" })
1141
1142
  }
1142
1143
  )
1143
1144
  ] })
1144
1145
  ] }) });
1145
1146
  }
1146
- function Wt() {
1147
- var es, ss, as, ts;
1148
- Wa(), Ja();
1147
+ function pn() {
1148
+ var ms, hs, ps, fs;
1149
+ mt(), ht();
1149
1150
  const {
1150
1151
  authToken: s,
1151
- tokenProps: n,
1152
+ tokenProps: o,
1152
1153
  id: t
1153
- } = j(), { isLocalDev: r } = Na(), { permissions: l } = tt(), i = Sa(), { isLoading: u } = wa();
1154
- x((o) => o.theme);
1155
- const p = x((o) => o.lenses), g = x((o) => o.selectedLensId), v = p == null ? void 0 : p.find((o) => o.id === g), c = x((o) => o.dashboard);
1156
- x((o) => o.selectedSheetId);
1157
- const d = x(
1158
- (o) => o.isDashboardEditing
1159
- ), { setDashboardTitle: m } = x((o) => o.actions), [h, b] = S(!1), [y, N] = S(!1), [A, I] = S(!1), [G, k] = S(!1), [$, P] = S(!1), [H, D] = S(!1), [R, B] = S(null), [pe, K] = S(!1), f = x((o) => o.isDashboardPanelOpen), E = x(
1160
- (o) => o.actions.setIsDashboardPanelOpen
1161
- ), T = x((o) => o.filterValues), w = x((o) => o.isVisualEditing);
1162
- ns((o) => o.card);
1163
- const U = le(
1164
- (o) => o.selectedDashboard
1165
- ), q = le(
1166
- (o) => o.initialDashboard
1154
+ } = P(), { isLocalDev: n } = Ta(), { permissions: l } = yt(), c = _a(), { isLoading: u } = Ua();
1155
+ w((r) => r.theme);
1156
+ const p = w((r) => r.lenses), g = w((r) => r.selectedLensId), v = p == null ? void 0 : p.find((r) => r.id === g), i = w((r) => r.dashboard);
1157
+ w((r) => r.selectedSheetId);
1158
+ const d = w(
1159
+ (r) => r.isDashboardEditing
1160
+ ), { setDashboardTitle: m } = w((r) => r.actions), [h, b] = S(!1), [y, N] = S(!1), [A, I] = S(!1), [U, M] = S(!1), [z, R] = S(!1), [$, x] = S(!1), [B, K] = S(!1), [Q, W] = S(null), [f, C] = S(!1), T = w((r) => r.isDashboardPanelOpen), F = w(
1161
+ (r) => r.actions.setIsDashboardPanelOpen
1162
+ ), ie = w((r) => r.filterValues), D = w((r) => r.isVisualEditing);
1163
+ vs((r) => r.card);
1164
+ const X = pe(
1165
+ (r) => r.selectedDashboard
1166
+ ), le = pe(
1167
+ (r) => r.initialDashboard
1167
1168
  );
1168
- le((o) => o.selectedVisual), x((o) => o.selectedFrameId), ns((o) => o.frame);
1169
- const te = U ? (ss = U == null ? void 0 : U.permissions) == null ? void 0 : ss.canEdit : (es = q == null ? void 0 : q.permissions) == null ? void 0 : es.canEdit, Ps = x((o) => o.showFilters), Us = xa((o) => o.setPanelOpen), Fs = x(
1170
- (o) => o.showDashboardJSON
1171
- ), fe = x((o) => o.onSaveFunction), js = x(
1172
- (o) => o.actions.setShowFilters
1173
- ), { setIsDashboardEditing: Ke, setShowDashboardJSON: Qe } = x(
1174
- (o) => o.actions
1175
- ), { setInitialDashboard: We, clearSelectedDashboard: qs } = le(
1176
- (o) => o.actions
1177
- ), { resources: re } = Da(we.DASHBOARD), { data: ge } = Ca(), Vs = ((as = ge == null ? void 0 : ge.preference) == null ? void 0 : as.defaultDashboardId) || null, { mutate: zs, isPending: $s } = La(), { currentUser: Hs } = ys(), Bs = Ea(Hs), Q = U || q, Je = Q ? {
1178
- id: Q.id,
1179
- title: (c == null ? void 0 : c.title) || Q.title || "Dashboard"
1180
- } : null, { handleAddNewFrame: Ks } = Aa(), [W, ve] = S(!1), [Qs, ne] = S(!1), oe = Ma(we.DASHBOARD), [J, be] = S(
1169
+ pe((r) => r.selectedVisual), w((r) => r.selectedFrameId), vs((r) => r.frame);
1170
+ const ce = X ? (hs = X == null ? void 0 : X.permissions) == null ? void 0 : hs.canEdit : (ms = le == null ? void 0 : le.permissions) == null ? void 0 : ms.canEdit, Ws = w((r) => r.showFilters), Js = Ga((r) => r.setPanelOpen), Zs = w(
1171
+ (r) => r.showDashboardJSON
1172
+ ), Ne = w((r) => r.onSaveFunction), Xs = w(
1173
+ (r) => r.actions.setShowFilters
1174
+ ), { setIsDashboardEditing: ts, setShowDashboardJSON: ns } = w(
1175
+ (r) => r.actions
1176
+ ), { setInitialDashboard: rs, clearSelectedDashboard: Se } = pe(
1177
+ (r) => r.actions
1178
+ ), { resources: de } = Ra(Oe.DASHBOARD), { data: we } = Pa(), Ys = ((ps = we == null ? void 0 : we.preference) == null ? void 0 : ps.defaultDashboardId) || null, { mutate: ea, isPending: sa } = Fa(), { currentUser: aa } = Os(), ta = ja(aa), J = X || le, os = J ? {
1179
+ id: J.id,
1180
+ title: (i == null ? void 0 : i.title) || J.title || "Dashboard"
1181
+ } : null, { handleAddNewFrame: na } = qa(), [xe, De] = S(!1), [ra, Y] = S(!1), [ee, ue] = S("close"), se = Ha(Oe.DASHBOARD), [G, Ce] = S(
1181
1182
  null
1182
- ), Ws = async (o, O) => {
1183
- if (!(c != null && c.id)) {
1183
+ ), oa = async (r, O) => {
1184
+ if (!(i != null && i.id)) {
1184
1185
  console.log("No dashboard ID found");
1185
1186
  return;
1186
1187
  }
1187
1188
  console.log("Updating dashboard title:", {
1188
- dashboardId: c.id,
1189
- newTitle: o,
1189
+ dashboardId: i.id,
1190
+ newTitle: r,
1190
1191
  previousTitle: O
1191
- }), oe.mutate(
1192
+ }), se.mutate(
1192
1193
  {
1193
- resourceId: c.id,
1194
- data: { title: o }
1194
+ resourceId: i.id,
1195
+ data: { title: r }
1195
1196
  },
1196
1197
  {
1197
1198
  onSuccess: () => {
1198
- console.log("Dashboard title updated successfully"), L.success("Dashboard title updated");
1199
+ console.log("Dashboard title updated successfully"), E.success("Dashboard title updated");
1199
1200
  },
1200
- onError: (Y) => {
1201
- console.error("Failed to update dashboard title:", Y), L.error("Failed to update dashboard title"), m(O);
1201
+ onError: (ne) => {
1202
+ console.error("Failed to update dashboard title:", ne), E.error("Failed to update dashboard title"), m(O);
1202
1203
  }
1203
1204
  }
1204
1205
  );
1205
1206
  };
1206
- Qa(() => {
1207
- if (re && re.length > 0) {
1208
- const o = c == null ? void 0 : c.id;
1209
- if (o) {
1210
- const O = re.find(
1211
- (Y) => Y.id === o
1207
+ dt(() => {
1208
+ if (de && de.length > 0) {
1209
+ const r = i == null ? void 0 : i.id;
1210
+ if (r) {
1211
+ const O = de.find(
1212
+ (ne) => ne.id === r
1212
1213
  );
1213
- O && We(O);
1214
+ O && rs(O);
1214
1215
  }
1215
1216
  }
1216
- }, [re, c == null ? void 0 : c.id, We]);
1217
- const ie = n.orgUserId || n.tenantId, Js = d && !w && ie && te, { setDashboard: Xe } = x((o) => o.actions), Xs = () => {
1218
- Ke(!0);
1219
- }, ye = () => {
1220
- Ke(!1), Qe(!1), be(null);
1217
+ }, [de, i == null ? void 0 : i.id, rs]);
1218
+ const me = o.orgUserId || o.tenantId, is = d && !D && me && ce, { setDashboard: Le } = w((r) => r.actions), ia = () => {
1219
+ ts(!0);
1220
+ }, Ee = () => {
1221
+ ts(!1), ns(!1), Ce(null);
1221
1222
  };
1222
- Xa(
1223
+ pt(
1223
1224
  d,
1224
- c,
1225
- J,
1226
- (o) => be(o)
1225
+ i,
1226
+ G,
1227
+ (r) => Ce(r)
1227
1228
  );
1228
- const Ys = () => J ? JSON.stringify(c) !== JSON.stringify(J) : !1, Zs = () => {
1229
- Ys() ? ne(!0) : ye();
1230
- }, ea = async () => {
1231
- await Ne({ closeAfterSave: !0 });
1232
- }, sa = () => {
1233
- J && Xe(J), ye(), ne(!1);
1229
+ const { isDirty: ls, isDirtyPending: la, resetDirty: he } = xt(
1230
+ i,
1231
+ G,
1232
+ 300,
1233
+ 1e3,
1234
+ Ie
1235
+ ), cs = ut(() => G ? Ie(i) !== Ie(G) : !1, [i, G]), Ae = ls || la, ae = xe || se.isPending, ca = () => {
1236
+ cs() ? (ue("close"), Y(!0)) : (Ee(), he());
1237
+ }, da = async () => {
1238
+ await ke({
1239
+ closeAfterSave: !0,
1240
+ navigateHomeAfterSave: ee === "home"
1241
+ });
1242
+ }, ua = () => {
1243
+ G && Le(G), Ee(), ee === "home" && Se(), ue("close"), Y(!1), he();
1244
+ }, ma = () => {
1245
+ G && (Le(G), he());
1246
+ }, ha = () => {
1247
+ if (d && cs()) {
1248
+ ue("home"), Y(!0);
1249
+ return;
1250
+ }
1251
+ Se();
1234
1252
  };
1235
- async function Ne(o) {
1236
- const O = (o == null ? void 0 : o.closeAfterSave) ?? pe;
1237
- K(O), O && ne(!1);
1238
- const Y = Ka(c);
1239
- D(!0), B(null), ve(!0);
1240
- const oa = {
1241
- template: c
1253
+ async function ke(r) {
1254
+ const O = (r == null ? void 0 : r.closeAfterSave) ?? f, ne = (r == null ? void 0 : r.navigateHomeAfterSave) ?? !1;
1255
+ C(O), O && Y(!1);
1256
+ const ba = ct(i);
1257
+ K(!0), W(null), De(!0);
1258
+ const ya = {
1259
+ template: i
1242
1260
  };
1243
- oe.mutate(
1261
+ se.mutate(
1244
1262
  {
1245
- resourceId: c.id,
1246
- data: oa
1263
+ resourceId: i.id,
1264
+ data: ya
1247
1265
  },
1248
1266
  {
1249
1267
  onSuccess: () => {
1250
- ve(!1), L.success("Dashboard saved!"), be(Y), D(!1), K(!1), O && ye();
1268
+ De(!1), E.success("Dashboard saved!"), Ce(ba), K(!1), C(!1), O && (Ee(), he(), ne && Se()), ue("close");
1251
1269
  },
1252
1270
  onError: () => {
1253
- ve(!1), B("Failed to save dashboard. Please try again."), L.error("Failed to save dashboard");
1271
+ De(!1), W("Failed to save dashboard. Please try again."), E.error("Failed to save dashboard");
1254
1272
  }
1255
1273
  }
1256
1274
  );
1257
1275
  }
1258
- async function aa() {
1276
+ async function pa() {
1259
1277
  if (b(!0), !g || !v) return;
1260
- const o = JSON.stringify(c), O = {
1278
+ const r = JSON.stringify(i), O = {
1261
1279
  ...v,
1262
- template: o,
1263
- filterValues: T
1280
+ template: r,
1281
+ filterValues: ie
1264
1282
  };
1265
- await Te(
1266
- n.apiServiceUrl,
1283
+ await Ve(
1284
+ o.apiServiceUrl,
1267
1285
  O,
1268
1286
  s == null ? void 0 : s.accessToken
1269
- ), L.success("Lens saved"), fe == null || fe(c), b(!1);
1287
+ ), E.success("Lens saved"), Ne == null || Ne(i), b(!1);
1270
1288
  }
1271
- const Ye = (v == null ? void 0 : v.name) || c.title;
1272
- oe.isPending && console.log("Title during update:", {
1273
- title: Ye,
1274
- dashboardStateTitle: c.title,
1275
- dashboardId: c == null ? void 0 : c.id,
1289
+ const ds = (v == null ? void 0 : v.name) || i.title;
1290
+ se.isPending && console.log("Title during update:", {
1291
+ title: ds,
1292
+ dashboardStateTitle: i.title,
1293
+ dashboardId: i == null ? void 0 : i.id,
1276
1294
  currentLensName: v == null ? void 0 : v.name
1277
1295
  });
1278
- const Ze = n.orgUserId || n.tenantId && n.endUserId && n.endUserEmail, ta = !!Ze && !!(s != null && s.accessToken) && !!(n != null && n.apiServiceUrl), ra = i, X = (c == null ? void 0 : c.id) || null, Se = !!X && Vs === X, na = () => {
1279
- X && zs({
1280
- dashboardId: Se ? null : X
1296
+ const us = o.orgUserId || o.tenantId && o.endUserId && o.endUserEmail, fa = !!us && !!(s != null && s.accessToken) && !!(o != null && o.apiServiceUrl), ga = c, te = (i == null ? void 0 : i.id) || null, Me = !!te && Ys === te, va = () => {
1297
+ te && ea({
1298
+ dashboardId: Me ? null : te
1281
1299
  });
1282
1300
  };
1283
1301
  return /* @__PURE__ */ a(
@@ -1287,304 +1305,337 @@ function Wt() {
1287
1305
  role: "dashboard-controls",
1288
1306
  children: [
1289
1307
  /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
1290
- Ze && /* @__PURE__ */ a(M, { children: [
1308
+ us && /* @__PURE__ */ a(k, { children: [
1291
1309
  /* @__PURE__ */ e(
1292
- F,
1310
+ j,
1293
1311
  {
1294
1312
  "aria-label": "Manage Dashboards",
1295
1313
  tooltip: "Manage Dashboards",
1296
1314
  onClick: () => {
1297
- E(!f);
1315
+ F(!T);
1298
1316
  },
1299
1317
  className: "h-7 p-2",
1300
- children: /* @__PURE__ */ e(lt, { className: "h-4 w-4" })
1318
+ children: /* @__PURE__ */ e(Ct, { className: "h-4 w-4" })
1301
1319
  }
1302
1320
  ),
1303
- ra && !w && /* @__PURE__ */ e(
1304
- F,
1321
+ ga && !D && /* @__PURE__ */ e(
1322
+ j,
1305
1323
  {
1306
1324
  "aria-label": "Dashboard Hub",
1307
1325
  tooltip: "Dashboard Hub",
1308
- onClick: () => qs(),
1326
+ onClick: ha,
1309
1327
  className: "h-7 p-2",
1310
- children: /* @__PURE__ */ e(ms, { className: "h-4 w-4" })
1328
+ children: /* @__PURE__ */ e(Ds, { className: "h-4 w-4" })
1311
1329
  }
1312
1330
  )
1313
1331
  ] }),
1314
- !w && i && (u ? /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
1315
- /* @__PURE__ */ e(V, { className: "h-3 w-3 animate-spin text-muted-foreground" }),
1332
+ !D && c && (u ? /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
1333
+ /* @__PURE__ */ e(H, { className: "h-3 w-3 animate-spin text-muted-foreground" }),
1316
1334
  /* @__PURE__ */ e("span", { className: "text-sm text-muted-foreground", children: "Loading..." })
1317
- ] }) : /* @__PURE__ */ a(M, { children: [
1335
+ ] }) : /* @__PURE__ */ a(k, { children: [
1318
1336
  /* @__PURE__ */ e(
1319
- ka,
1337
+ Va,
1320
1338
  {
1321
- value: Ye || "Untitled Dashboard",
1322
- onSave: (o) => {
1339
+ value: ds || "Untitled Dashboard",
1340
+ onSave: (r) => {
1323
1341
  console.log("EditableText onSave called:", {
1324
- newTitle: o,
1325
- canEditDashboard: te,
1326
- dashboardId: c == null ? void 0 : c.id
1342
+ newTitle: r,
1343
+ canEditDashboard: ce,
1344
+ dashboardId: i == null ? void 0 : i.id
1327
1345
  });
1328
- const O = (c == null ? void 0 : c.title) || "";
1329
- m(o), Ws(o, O);
1346
+ const O = (i == null ? void 0 : i.title) || "";
1347
+ m(r), oa(r, O);
1330
1348
  },
1331
- isEditable: te && !v,
1349
+ isEditable: ce && !v,
1332
1350
  displayClassName: "text-sm font-medium",
1333
1351
  inputClassName: "text-sm font-medium",
1334
1352
  placeholder: "Dashboard Title",
1335
- isPending: oe.isPending
1353
+ isPending: se.isPending
1336
1354
  }
1337
1355
  ),
1338
- ta && X && /* @__PURE__ */ e(Oa, { children: /* @__PURE__ */ a(Ia, { children: [
1339
- /* @__PURE__ */ e(Ta, { asChild: !0, children: /* @__PURE__ */ e(
1340
- C,
1356
+ fa && te && /* @__PURE__ */ e(za, { children: /* @__PURE__ */ a($a, { children: [
1357
+ /* @__PURE__ */ e(Ba, { asChild: !0, children: /* @__PURE__ */ e(
1358
+ L,
1341
1359
  {
1342
1360
  variant: "ghost",
1343
1361
  size: "icon",
1344
- onClick: na,
1345
- disabled: $s || !(s != null && s.accessToken) || !(n != null && n.apiServiceUrl),
1362
+ onClick: va,
1363
+ disabled: sa || !(s != null && s.accessToken) || !(o != null && o.apiServiceUrl),
1346
1364
  className: "h-7 w-7",
1347
1365
  children: /* @__PURE__ */ e(
1348
- _a,
1366
+ Ka,
1349
1367
  {
1350
- className: ae(
1368
+ className: Z(
1351
1369
  "h-4 w-4 transition-colors",
1352
- Se ? "fill-yellow-400 text-yellow-400" : "text-muted-foreground hover:text-yellow-400"
1370
+ Me ? "fill-yellow-400 text-yellow-400" : "text-muted-foreground hover:text-yellow-400"
1353
1371
  )
1354
1372
  }
1355
1373
  )
1356
1374
  }
1357
1375
  ) }),
1358
- /* @__PURE__ */ e(Ga, { children: /* @__PURE__ */ e("p", { children: Se ? "Remove as default dashboard" : "Make this a default dashboard" }) })
1376
+ /* @__PURE__ */ e(Qa, { children: /* @__PURE__ */ e("p", { children: Me ? "Remove as default dashboard" : "Make this a default dashboard" }) })
1359
1377
  ] }) })
1360
1378
  ] }))
1361
1379
  ] }),
1362
1380
  /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
1363
- w && /* @__PURE__ */ a(M, { children: [
1364
- /* @__PURE__ */ e(Ya, { className: "mr-2" }),
1365
- /* @__PURE__ */ e(Za, { className: "h-7" })
1381
+ D && /* @__PURE__ */ a(k, { children: [
1382
+ /* @__PURE__ */ e(ft, { className: "mr-2" }),
1383
+ /* @__PURE__ */ e(gt, { className: "h-7" })
1366
1384
  ] }),
1367
- r && !w && /* @__PURE__ */ a(M, { children: [
1385
+ n && !D && /* @__PURE__ */ a(k, { children: [
1368
1386
  /* @__PURE__ */ e(
1369
- F,
1387
+ j,
1370
1388
  {
1371
1389
  tooltip: "Copy Token",
1372
1390
  onClick: () => {
1373
- var o;
1374
- s != null && s.accessToken && ((o = navigator == null ? void 0 : navigator.clipboard) != null && o.writeText ? navigator.clipboard.writeText(s.accessToken).then(() => L.success("Token copied to clipboard")).catch(() => L.error("Unable to copy token")) : L.error("Clipboard not available"));
1391
+ var r;
1392
+ s != null && s.accessToken && ((r = navigator == null ? void 0 : navigator.clipboard) != null && r.writeText ? navigator.clipboard.writeText(s.accessToken).then(() => E.success("Token copied to clipboard")).catch(() => E.error("Unable to copy token")) : E.error("Clipboard not available"));
1375
1393
  },
1376
1394
  className: "h-7 p-2",
1377
- children: /* @__PURE__ */ e(Ra, { className: "h-4 w-4" })
1395
+ children: /* @__PURE__ */ e(Wa, { className: "h-4 w-4" })
1378
1396
  }
1379
1397
  ),
1380
1398
  /* @__PURE__ */ e(
1381
- F,
1399
+ j,
1382
1400
  {
1383
1401
  tooltip: "Invalidate Token",
1384
- onClick: () => Pa(n.apiServiceUrl),
1402
+ onClick: () => Ja(o.apiServiceUrl),
1385
1403
  className: "h-7 p-2",
1386
- children: /* @__PURE__ */ e(dt, { className: "h-4 w-4" })
1404
+ children: /* @__PURE__ */ e(Et, { className: "h-4 w-4" })
1387
1405
  }
1388
1406
  )
1389
1407
  ] }),
1390
- !w && i && /* @__PURE__ */ e(Ua, {}),
1391
- !w && i && /* @__PURE__ */ e(et, {}),
1392
- !w && i && /* @__PURE__ */ e(st, {}),
1393
- !w && i && Bs && /* @__PURE__ */ e(
1394
- F,
1395
- {
1396
- tooltip: "Manage Groups",
1397
- onClick: () => I(!0),
1398
- className: "h-7 p-2",
1399
- children: /* @__PURE__ */ e(z, { className: "h-4 w-4" })
1400
- }
1401
- ),
1402
- !w && i && ((ts = Q == null ? void 0 : Q.permissions) == null ? void 0 : ts.canShare) && /* @__PURE__ */ e(
1403
- F,
1408
+ !D && c && /* @__PURE__ */ e(Za, {}),
1409
+ !D && c && /* @__PURE__ */ e(vt, {}),
1410
+ !D && c && ((fs = J == null ? void 0 : J.permissions) == null ? void 0 : fs.canShare) && /* @__PURE__ */ e(
1411
+ j,
1404
1412
  {
1405
1413
  tooltip: "Share Dashboard",
1406
1414
  onClick: () => N(!0),
1407
1415
  className: "h-7 p-2",
1408
- children: /* @__PURE__ */ e(Fa, { className: "h-4 w-4" })
1416
+ children: /* @__PURE__ */ e(Xa, { className: "h-4 w-4" })
1409
1417
  }
1410
1418
  ),
1411
- !Ps && !w && d && l.canUseFilters && i && /* @__PURE__ */ e(
1412
- C,
1419
+ !Ws && !D && d && l.canUseFilters && c && /* @__PURE__ */ e(
1420
+ L,
1413
1421
  {
1414
1422
  className: "h-7 p-2",
1415
1423
  variant: "outline",
1416
1424
  onClick: () => {
1417
- Us("dashboard", !1), js(!0);
1425
+ Js("dashboard", !1), Xs(!0);
1418
1426
  },
1419
1427
  size: "sm",
1420
- children: /* @__PURE__ */ e(ja, { className: "h-4 w-4" })
1428
+ children: /* @__PURE__ */ e(Ya, { className: "h-4 w-4" })
1421
1429
  }
1422
1430
  ),
1423
- d && !w && ie && r && i && /* @__PURE__ */ e(bt, {}),
1424
- !w && ie && r && i && /* @__PURE__ */ e(yt, {}),
1425
- d && !w && ie && v && r && i && /* @__PURE__ */ a(
1426
- C,
1431
+ d && !D && me && n && c && /* @__PURE__ */ e(Ut, {}),
1432
+ !D && me && n && c && /* @__PURE__ */ e(Gt, {}),
1433
+ d && !D && me && v && n && c && /* @__PURE__ */ a(
1434
+ L,
1427
1435
  {
1428
1436
  className: "h-7 p-2",
1429
1437
  variant: "secondary",
1430
1438
  disabled: h,
1431
- onClick: aa,
1439
+ onClick: pa,
1432
1440
  size: "sm",
1433
1441
  children: [
1434
- /* @__PURE__ */ e(os, { className: "mr-2 h-4 w-4" }),
1442
+ /* @__PURE__ */ e(bs, { className: "mr-2 h-4 w-4" }),
1435
1443
  "Save Lens"
1436
1444
  ]
1437
1445
  }
1438
1446
  ),
1439
- d && !w && i && /* @__PURE__ */ a(
1440
- C,
1447
+ d && !D && c && /* @__PURE__ */ a(
1448
+ L,
1441
1449
  {
1442
1450
  variant: "outline",
1443
1451
  className: "h-7 p-2",
1444
1452
  size: "sm",
1445
1453
  disabled: !d,
1446
- onClick: () => Ks(),
1454
+ onClick: () => na(),
1447
1455
  children: [
1448
- /* @__PURE__ */ e(Fe, { className: "mr-2 h-4 w-4" }),
1456
+ /* @__PURE__ */ e(We, { className: "mr-2 h-4 w-4" }),
1449
1457
  "Visual"
1450
1458
  ]
1451
1459
  }
1452
1460
  ),
1453
- !w && !d && te && i && /* @__PURE__ */ a(
1454
- C,
1461
+ !D && !d && ce && c && /* @__PURE__ */ a(
1462
+ L,
1455
1463
  {
1456
1464
  variant: "outline",
1457
1465
  className: "h-7 p-2",
1458
- onClick: Xs,
1466
+ onClick: ia,
1459
1467
  size: "sm",
1460
1468
  children: [
1461
- /* @__PURE__ */ e(qa, { className: "mr-2 h-4 w-4" }),
1469
+ /* @__PURE__ */ e(et, { className: "mr-2 h-4 w-4" }),
1462
1470
  "Edit"
1463
1471
  ]
1464
1472
  }
1465
1473
  ),
1466
- Js && i && /* @__PURE__ */ a(
1467
- C,
1474
+ is && c && ls && /* @__PURE__ */ a(
1475
+ L,
1468
1476
  {
1477
+ variant: "outline",
1469
1478
  className: "h-7 p-2",
1470
- disabled: W,
1471
- onClick: () => Ne(),
1479
+ onClick: ma,
1472
1480
  size: "sm",
1481
+ disabled: ae,
1473
1482
  children: [
1474
- W ? /* @__PURE__ */ e(V, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ e(os, { className: "mr-2 h-4 w-4" }),
1475
- W ? "Saving..." : "Save"
1483
+ /* @__PURE__ */ e(st, { className: "mr-2 h-4 w-4" }),
1484
+ "Undo"
1476
1485
  ]
1477
1486
  }
1478
1487
  ),
1479
- !w && d && r && i && /* @__PURE__ */ e("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ e(
1480
- C,
1488
+ is && c && /* @__PURE__ */ a("div", { className: "relative inline-flex", children: [
1489
+ /* @__PURE__ */ a(
1490
+ L,
1491
+ {
1492
+ className: Z("h-7 p-2", !Ae && "opacity-60"),
1493
+ disabled: ae || !Ae,
1494
+ onClick: () => ke(),
1495
+ size: "sm",
1496
+ children: [
1497
+ ae ? /* @__PURE__ */ e(H, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ e(bs, { className: "mr-2 h-4 w-4" }),
1498
+ ae ? "Saving..." : "Save"
1499
+ ]
1500
+ }
1501
+ ),
1502
+ Ae && !ae && /* @__PURE__ */ e(
1503
+ "span",
1504
+ {
1505
+ "aria-hidden": "true",
1506
+ className: "pointer-events-none absolute -right-1 -top-1 h-2.5 w-2.5 rounded-full bg-orange-500 ring-2 ring-background"
1507
+ }
1508
+ )
1509
+ ] }),
1510
+ !D && d && n && c && /* @__PURE__ */ e("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ e(
1511
+ L,
1481
1512
  {
1482
1513
  className: "h-7 p-2",
1483
- onClick: () => Qe(!Fs),
1514
+ onClick: () => ns(!Zs),
1484
1515
  size: "sm",
1485
1516
  variant: "ghost",
1486
- children: /* @__PURE__ */ e(Va, { className: "h-4 w-4" })
1517
+ children: /* @__PURE__ */ e(at, { className: "h-4 w-4" })
1487
1518
  }
1488
1519
  ) }),
1489
- !w && r && /* @__PURE__ */ e(ft, {}),
1490
- d && !w && i && /* @__PURE__ */ a(
1491
- C,
1520
+ !D && n && /* @__PURE__ */ e(It, {}),
1521
+ d && !D && c && /* @__PURE__ */ a(
1522
+ L,
1492
1523
  {
1493
1524
  variant: "outline",
1494
1525
  className: "h-7 p-2",
1495
- onClick: Zs,
1526
+ onClick: ca,
1496
1527
  children: [
1497
- /* @__PURE__ */ e(hs, { className: "mr-2 h-4 w-4" }),
1528
+ /* @__PURE__ */ e(Cs, { className: "mr-2 h-4 w-4" }),
1498
1529
  "Close"
1499
1530
  ]
1500
1531
  }
1501
1532
  ),
1502
- !w && i && /* @__PURE__ */ a(_e, { children: [
1503
- /* @__PURE__ */ e(Ge, { asChild: !0, children: /* @__PURE__ */ e(F, { tooltip: "More Options", className: "h-7 p-2", children: /* @__PURE__ */ e(za, { className: "h-4 w-4" }) }) }),
1504
- /* @__PURE__ */ a(Re, { align: "end", children: [
1505
- /* @__PURE__ */ a(Z, { onClick: () => k(!0), children: [
1506
- /* @__PURE__ */ e($a, { className: "mr-2 h-4 w-4" }),
1533
+ !D && c && /* @__PURE__ */ a(ze, { children: [
1534
+ /* @__PURE__ */ e($e, { asChild: !0, children: /* @__PURE__ */ e(j, { tooltip: "More Options", className: "h-7 p-2", children: /* @__PURE__ */ e(tt, { className: "h-4 w-4" }) }) }),
1535
+ /* @__PURE__ */ a(Be, { align: "end", children: [
1536
+ /* @__PURE__ */ a(q, { onClick: () => M(!0), children: [
1537
+ /* @__PURE__ */ e(nt, { className: "mr-2 h-4 w-4" }),
1538
+ "Schedule Dashboard"
1539
+ ] }),
1540
+ ta && /* @__PURE__ */ a(q, { onClick: () => I(!0), children: [
1541
+ /* @__PURE__ */ e(V, { className: "mr-2 h-4 w-4" }),
1542
+ "Manage Groups"
1543
+ ] }),
1544
+ /* @__PURE__ */ a(q, { onClick: () => R(!0), children: [
1545
+ /* @__PURE__ */ e(rt, { className: "mr-2 h-4 w-4" }),
1507
1546
  "Calendar Preferences"
1508
1547
  ] }),
1509
- /* @__PURE__ */ a(Z, { onClick: () => P(!0), children: [
1510
- /* @__PURE__ */ e(Ha, { className: "mr-2 h-4 w-4" }),
1548
+ /* @__PURE__ */ a(q, { onClick: () => x(!0), children: [
1549
+ /* @__PURE__ */ e(ot, { className: "mr-2 h-4 w-4" }),
1511
1550
  "Summary Settings"
1512
1551
  ] })
1513
1552
  ] })
1514
1553
  ] }),
1515
- y && Je && /* @__PURE__ */ e(
1516
- Ba,
1554
+ y && os && /* @__PURE__ */ e(
1555
+ it,
1517
1556
  {
1518
- resource: Je,
1519
- resourceType: we.DASHBOARD,
1557
+ resource: os,
1558
+ resourceType: Oe.DASHBOARD,
1520
1559
  onClose: () => N(!1)
1521
1560
  }
1522
1561
  ),
1523
1562
  /* @__PURE__ */ e(
1524
- Ut,
1563
+ sn,
1525
1564
  {
1526
1565
  open: A,
1527
1566
  onOpenChange: I
1528
1567
  }
1529
1568
  ),
1569
+ (i == null ? void 0 : i.id) && /* @__PURE__ */ e(
1570
+ lt,
1571
+ {
1572
+ open: U,
1573
+ onOpenChange: M,
1574
+ dashboardId: i.id,
1575
+ dashboardName: i == null ? void 0 : i.title
1576
+ }
1577
+ ),
1530
1578
  /* @__PURE__ */ e(
1531
- nt,
1579
+ St,
1532
1580
  {
1533
- open: G,
1534
- onOpenChange: k
1581
+ open: z,
1582
+ onOpenChange: R
1535
1583
  }
1536
1584
  ),
1537
1585
  /* @__PURE__ */ e(
1538
- ot,
1586
+ wt,
1539
1587
  {
1540
1588
  open: $,
1541
- onOpenChange: P,
1542
- dashboard: c,
1589
+ onOpenChange: x,
1590
+ dashboard: i,
1543
1591
  disabled: !d,
1544
- onApply: (o) => Xe({
1545
- ...c,
1546
- summary: o
1592
+ onApply: (r) => Le({
1593
+ ...i,
1594
+ summary: r
1547
1595
  })
1548
1596
  }
1549
1597
  ),
1550
1598
  /* @__PURE__ */ e(
1551
- Ns,
1599
+ Is,
1552
1600
  {
1553
- open: H,
1554
- onOpenChange: (o) => {
1555
- !o && W && !R || (D(o), o || (B(null), K(!1)));
1601
+ open: B,
1602
+ onOpenChange: (r) => {
1603
+ !r && xe && !Q || (K(r), r || (W(null), C(!1)));
1556
1604
  },
1557
- children: /* @__PURE__ */ a(Ss, { className: "max-w-sm", children: [
1558
- /* @__PURE__ */ a(ws, { children: [
1559
- /* @__PURE__ */ e(xs, { children: R ? "Save failed" : "Saving dashboard" }),
1560
- /* @__PURE__ */ e(Ds, { className: "pt-2", children: R ? "We could not save the dashboard. Please try again." : "Please wait while we save your changes." })
1605
+ children: /* @__PURE__ */ a(Ts, { className: "max-w-sm", children: [
1606
+ /* @__PURE__ */ a(_s, { children: [
1607
+ /* @__PURE__ */ e(Us, { children: Q ? "Save failed" : "Saving dashboard" }),
1608
+ /* @__PURE__ */ e(Gs, { className: "pt-2", children: Q ? "We could not save the dashboard. Please try again." : "Please wait while we save your changes." })
1561
1609
  ] }),
1562
- /* @__PURE__ */ e(Cs, { className: "flex-col gap-2 sm:flex-row sm:justify-end", children: R ? /* @__PURE__ */ a(M, { children: [
1610
+ /* @__PURE__ */ e(Rs, { className: "flex-col gap-2 sm:flex-row sm:justify-end", children: Q ? /* @__PURE__ */ a(k, { children: [
1563
1611
  /* @__PURE__ */ e(
1564
- Ls,
1612
+ Ps,
1565
1613
  {
1566
1614
  onClick: () => {
1567
- D(!1), B(null), K(!1);
1615
+ K(!1), W(null), C(!1);
1568
1616
  },
1569
1617
  className: "m-0",
1570
1618
  children: "Close"
1571
1619
  }
1572
1620
  ),
1573
1621
  /* @__PURE__ */ e(
1574
- Oe,
1622
+ qe,
1575
1623
  {
1576
- onClick: () => Ne(),
1624
+ onClick: () => ke({
1625
+ closeAfterSave: f,
1626
+ navigateHomeAfterSave: ee === "home"
1627
+ }),
1577
1628
  className: "m-0",
1578
1629
  children: "Retry"
1579
1630
  }
1580
1631
  )
1581
1632
  ] }) : /* @__PURE__ */ a(
1582
- Oe,
1633
+ qe,
1583
1634
  {
1584
1635
  disabled: !0,
1585
1636
  className: "m-0 cursor-default",
1586
1637
  children: [
1587
- /* @__PURE__ */ e(V, { className: "mr-2 h-4 w-4 animate-spin" }),
1638
+ /* @__PURE__ */ e(H, { className: "mr-2 h-4 w-4 animate-spin" }),
1588
1639
  "Saving..."
1589
1640
  ]
1590
1641
  }
@@ -1593,13 +1644,17 @@ function Wt() {
1593
1644
  }
1594
1645
  ),
1595
1646
  /* @__PURE__ */ e(
1596
- at,
1647
+ bt,
1597
1648
  {
1598
- open: Qs,
1599
- onOpenChange: ne,
1600
- onSave: ea,
1601
- onDiscard: sa,
1602
- isSaving: W
1649
+ open: ra,
1650
+ onOpenChange: (r) => {
1651
+ Y(r);
1652
+ },
1653
+ onSave: da,
1654
+ onDiscard: ua,
1655
+ isSaving: xe,
1656
+ saveLabel: ee === "home" ? "Save & Return to Hub" : "Save & Close",
1657
+ discardLabel: ee === "home" ? "Discard & Return to Hub" : "Discard"
1603
1658
  }
1604
1659
  )
1605
1660
  ] })
@@ -1608,5 +1663,5 @@ function Wt() {
1608
1663
  );
1609
1664
  }
1610
1665
  export {
1611
- Wt as default
1666
+ pn as default
1612
1667
  };