react-semaphor 0.1.322 → 0.1.324

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 (26) hide show
  1. package/dist/chunks/{calendar-preferences-dialog-t0OOALVd.js → calendar-preferences-dialog-B9Hz3pTH.js} +1 -1
  2. package/dist/chunks/{calendar-preferences-dialog-CZqePF6B.js → calendar-preferences-dialog-CLXaVo3h.js} +1 -1
  3. package/dist/chunks/{dashboard-briefing-launcher-d1_fm91W.js → dashboard-briefing-launcher-COLpvReF.js} +1 -1
  4. package/dist/chunks/{dashboard-briefing-launcher-BYbnbZ9e.js → dashboard-briefing-launcher-CUEn7cr6.js} +3 -3
  5. package/dist/chunks/{dashboard-controls-BuChCKDm.js → dashboard-controls-CLShFyUq.js} +858 -846
  6. package/dist/chunks/dashboard-controls-DH8gdpOc.js +52 -0
  7. package/dist/chunks/{dashboard-json-DgoYjD0O.js → dashboard-json-Db0DpTMw.js} +1 -1
  8. package/dist/chunks/{dashboard-json-M5-VFCtZ.js → dashboard-json-eGBWfSN1.js} +1 -1
  9. package/dist/chunks/{edit-dashboard-visual-BH8DP1qq.js → edit-dashboard-visual-Cc3xpTNQ.js} +1 -1
  10. package/dist/chunks/{edit-dashboard-visual-DP31ytwJ.js → edit-dashboard-visual-DmMKWtln.js} +3 -3
  11. package/dist/chunks/{index-CodH6sqg.js → index-CMS4bp9G.js} +1 -1
  12. package/dist/chunks/{index-ChmS5nsv.js → index-PTx7430W.js} +4 -4
  13. package/dist/chunks/{resource-management-panel-gt__S0Pb.js → resource-management-panel-C1mbF-2a.js} +2 -2
  14. package/dist/chunks/{resource-management-panel-D3vO68dH.js → resource-management-panel-DR7Ku6sa.js} +1 -1
  15. package/dist/chunks/{use-create-flow-overlay-state-OA3iI54p.js → use-create-flow-overlay-state-B65gg2oB.js} +2 -2
  16. package/dist/chunks/{use-create-flow-overlay-state-BZaSpL-c.js → use-create-flow-overlay-state-CmxTpqeg.js} +1 -1
  17. package/dist/chunks/{use-visual-utils-CMucAqbS.js → use-visual-utils-51Nsy8cj.js} +1 -1
  18. package/dist/chunks/{use-visual-utils-CsXS-Zeh.js → use-visual-utils-Diuguy3D.js} +1 -1
  19. package/dist/dashboard/index.cjs +1 -1
  20. package/dist/dashboard/index.js +1 -1
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.js +5 -5
  23. package/dist/surfboard/index.cjs +1 -1
  24. package/dist/surfboard/index.js +2 -2
  25. package/package.json +1 -1
  26. package/dist/chunks/dashboard-controls-B3HHMRPC.js +0 -52
@@ -1,16 +1,16 @@
1
- import { jsx as t, jsxs as i, Fragment as U } from "react/jsx-runtime";
2
- import { c as K, u as N, B as O, az as it, E as qt, L as Hr, a1 as jr, a as Z, aA as qr, aB as Vr, aC as tt, aD as me, aE as dt, aF as Vt, f as Te, X as Kt, aG as Qt, aH as Kr, G as Ot, Y as Qr, Z as Wr, _ as Jr, a0 as Yr, j as Xr, aI as Zr } from "./switch-Deo2Ltmj.js";
3
- import { bf as ea, u as B, b as Wt, bg as ta, aH as ee, c as Jt, d as ra, e as rt, f as at, n as aa, bh as ue, aU as Re, bi as na, bj as Ut, bk as Yt, bl as Xt, bm as sa, b8 as ct, bn as oa, bo as ia, bp as da, bq as ca, br as la, bs as ua, ad as pe, bt as fe, o as C, bu as ma, bv as Zt, ay as lt, bd as pa, bw as fa, bx as ha, by as er, aT as tr, aW as rr, ax as ga, aL as ba, bz as xa, bA as va, y as ya, x as Oe, J as wa, z as Je, bB as Na, bC as Sa, bD as Da, Z as Ca, bE as ka, I as Ye, bF as Ea, bG as La, bH as Ia, bI as Ma, aM as Aa, aN as Pa, aO as _a, aP as Oa, aQ as G, bJ as Ua, aR as Rt, bK as Ra, bL as Ta, bM as Fa, H as $a, bN as Ga, a$ as Ba, b0 as za, b1 as Ha, b2 as ja, b3 as qa, b4 as Va, b5 as Ka, b6 as Tt, v as nt } from "./index-ChmS5nsv.js";
4
- import * as L from "react";
5
- import ar, { useState as w, useMemo as V, useEffect as Fe, useRef as Ft, useLayoutEffect as Qa, useCallback as Wa } from "react";
1
+ import { jsx as t, jsxs as i, Fragment as R } from "react/jsx-runtime";
2
+ import { c as K, u as N, B as _, az as dt, E as Vt, L as Hr, a1 as jr, a as te, aA as qr, aB as Vr, aC as rt, aD as me, aE as ct, aF as Kt, f as $e, X as Qt, aG as Wt, aH as Kr, G as Rt, Y as Qr, Z as Wr, _ as Jr, a0 as Yr, j as Xr, aI as Zr } from "./switch-Deo2Ltmj.js";
3
+ import { bf as ea, u as G, b as Jt, bg as ta, aH as re, c as Yt, d as ra, e as at, f as nt, n as aa, bh as ue, aU as Fe, bi as na, bj as Ut, bk as Xt, bl as Zt, bm as sa, b8 as lt, bn as oa, bo as ia, bp as da, bq as ca, br as la, bs as ua, ad as pe, bt as fe, o as k, bu as ma, bv as er, ay as ut, bd as pa, bw as fa, bx as ha, by as tr, aT as rr, aW as ar, ax as ga, aL as ba, bz as xa, bA as va, y as ya, x as Ue, J as wa, z as Ye, bB as Na, bC as Sa, bD as Da, Z as Ca, bE as ka, I as Xe, bF as Ea, bG as La, bH as Ia, bI as Aa, aM as Ma, aN as Pa, aO as Oa, aP as _a, aQ as $, bJ as Ra, aR as Tt, bK as Ua, bL as Ta, bM as Fa, H as $a, bN as Ga, a$ as Ba, b0 as za, b1 as Ha, b2 as ja, b3 as qa, b4 as Va, b5 as Ka, b6 as Ft, v as st } from "./index-PTx7430W.js";
4
+ import * as I from "react";
5
+ import nr, { useState as w, useMemo as V, useEffect as Ge, useRef as $t, useLayoutEffect as Qa, useCallback as Wa } from "react";
6
6
  import "./index-CJdxSyQq.js";
7
7
  import { createPortal as Ja } from "react-dom";
8
- import { L as Ya, b as Xa, u as Za, A as en, V as tn, K as rn, e as an, M as nn, N as sn, U as on } from "./dashboard-briefing-launcher-BYbnbZ9e.js";
9
- import { d as nr } from "./index-DFOb_6HB.js";
10
- import { C as dn } from "./calendar-preferences-dialog-t0OOALVd.js";
8
+ import { L as Ya, b as Xa, u as Za, A as en, V as tn, K as rn, e as an, M as nn, N as sn, U as on } from "./dashboard-briefing-launcher-CUEn7cr6.js";
9
+ import { d as sr } from "./index-DFOb_6HB.js";
10
+ import { C as dn } from "./calendar-preferences-dialog-B9Hz3pTH.js";
11
11
  import { u as cn } from "./use-debounced-dirty-check-BwAbnX_5.js";
12
- import { s as Xe } from "./normalize-dashboard-for-dirty-check-5KpZN8xr.js";
13
- import { S as $t } from "./save-DxkSzUTZ.js";
12
+ import { s as Ze } from "./normalize-dashboard-for-dirty-check-5KpZN8xr.js";
13
+ import { S as Gt } from "./save-DxkSzUTZ.js";
14
14
  import { P as ln } from "./palette-D96DOM7E.js";
15
15
  import { B as un } from "./braces-ZjRH2Kl7.js";
16
16
  /**
@@ -103,7 +103,7 @@ const xn = K("UserPlus", [
103
103
  ["line", { x1: "19", x2: "19", y1: "8", y2: "14", key: "1bvyxn" }],
104
104
  ["line", { x1: "22", x2: "16", y1: "11", y2: "11", key: "1shjgl" }]
105
105
  ]);
106
- var st = { exports: {} }, Ze = {};
106
+ var ot = { exports: {} }, et = {};
107
107
  /**
108
108
  * @license React
109
109
  * use-sync-external-store-shim.production.js
@@ -113,22 +113,22 @@ var st = { exports: {} }, Ze = {};
113
113
  * This source code is licensed under the MIT license found in the
114
114
  * LICENSE file in the root directory of this source tree.
115
115
  */
116
- var Gt;
116
+ var Bt;
117
117
  function vn() {
118
- if (Gt) return Ze;
119
- Gt = 1;
120
- var e = ar;
121
- function a(c, g) {
122
- return c === g && (c !== 0 || 1 / c === 1 / g) || c !== c && g !== g;
118
+ if (Bt) return et;
119
+ Bt = 1;
120
+ var e = nr;
121
+ function n(c, f) {
122
+ return c === f && (c !== 0 || 1 / c === 1 / f) || c !== c && f !== f;
123
123
  }
124
- var r = typeof Object.is == "function" ? Object.is : a, n = e.useState, s = e.useEffect, u = e.useLayoutEffect, f = e.useDebugValue;
125
- function l(c, g) {
126
- var p = g(), h = n({ inst: { value: p, getSnapshot: g } }), o = h[0].inst, y = h[1];
124
+ var a = typeof Object.is == "function" ? Object.is : n, r = e.useState, s = e.useEffect, u = e.useLayoutEffect, h = e.useDebugValue;
125
+ function l(c, f) {
126
+ var m = f(), g = r({ inst: { value: m, getSnapshot: f } }), o = g[0].inst, y = g[1];
127
127
  return u(
128
128
  function() {
129
- o.value = p, o.getSnapshot = g, b(o) && y({ inst: o });
129
+ o.value = m, o.getSnapshot = f, b(o) && y({ inst: o });
130
130
  },
131
- [c, p, g]
131
+ [c, m, f]
132
132
  ), s(
133
133
  function() {
134
134
  return b(o) && y({ inst: o }), c(function() {
@@ -136,25 +136,25 @@ function vn() {
136
136
  });
137
137
  },
138
138
  [c]
139
- ), f(p), p;
139
+ ), h(m), m;
140
140
  }
141
141
  function b(c) {
142
- var g = c.getSnapshot;
142
+ var f = c.getSnapshot;
143
143
  c = c.value;
144
144
  try {
145
- var p = g();
146
- return !r(c, p);
145
+ var m = f();
146
+ return !a(c, m);
147
147
  } catch {
148
148
  return !0;
149
149
  }
150
150
  }
151
- function x(c, g) {
152
- return g();
151
+ function x(c, f) {
152
+ return f();
153
153
  }
154
- var m = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? x : l;
155
- return Ze.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : m, Ze;
154
+ var p = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? x : l;
155
+ return et.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : p, et;
156
156
  }
157
- var et = {};
157
+ var tt = {};
158
158
  /**
159
159
  * @license React
160
160
  * use-sync-external-store-shim.development.js
@@ -164,146 +164,146 @@ var et = {};
164
164
  * This source code is licensed under the MIT license found in the
165
165
  * LICENSE file in the root directory of this source tree.
166
166
  */
167
- var Bt;
167
+ var zt;
168
168
  function yn() {
169
- return Bt || (Bt = 1, process.env.NODE_ENV !== "production" && function() {
170
- function e(p, h) {
171
- return p === h && (p !== 0 || 1 / p === 1 / h) || p !== p && h !== h;
169
+ return zt || (zt = 1, process.env.NODE_ENV !== "production" && function() {
170
+ function e(m, g) {
171
+ return m === g && (m !== 0 || 1 / m === 1 / g) || m !== m && g !== g;
172
172
  }
173
- function a(p, h) {
174
- m || s.startTransition === void 0 || (m = !0, console.error(
173
+ function n(m, g) {
174
+ p || s.startTransition === void 0 || (p = !0, console.error(
175
175
  "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."
176
176
  ));
177
- var o = h();
177
+ var o = g();
178
178
  if (!c) {
179
- var y = h();
179
+ var y = g();
180
180
  u(o, y) || (console.error(
181
181
  "The result of getSnapshot should be cached to avoid an infinite loop"
182
182
  ), c = !0);
183
183
  }
184
- y = f({
185
- inst: { value: o, getSnapshot: h }
184
+ y = h({
185
+ inst: { value: o, getSnapshot: g }
186
186
  });
187
- var S = y[0].inst, D = y[1];
187
+ var S = y[0].inst, C = y[1];
188
188
  return b(
189
189
  function() {
190
- S.value = o, S.getSnapshot = h, r(S) && D({ inst: S });
190
+ S.value = o, S.getSnapshot = g, a(S) && C({ inst: S });
191
191
  },
192
- [p, o, h]
192
+ [m, o, g]
193
193
  ), l(
194
194
  function() {
195
- return r(S) && D({ inst: S }), p(function() {
196
- r(S) && D({ inst: S });
195
+ return a(S) && C({ inst: S }), m(function() {
196
+ a(S) && C({ inst: S });
197
197
  });
198
198
  },
199
- [p]
199
+ [m]
200
200
  ), x(o), o;
201
201
  }
202
- function r(p) {
203
- var h = p.getSnapshot;
204
- p = p.value;
202
+ function a(m) {
203
+ var g = m.getSnapshot;
204
+ m = m.value;
205
205
  try {
206
- var o = h();
207
- return !u(p, o);
206
+ var o = g();
207
+ return !u(m, o);
208
208
  } catch {
209
209
  return !0;
210
210
  }
211
211
  }
212
- function n(p, h) {
213
- return h();
212
+ function r(m, g) {
213
+ return g();
214
214
  }
215
215
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
216
- var s = ar, u = typeof Object.is == "function" ? Object.is : e, f = s.useState, l = s.useEffect, b = s.useLayoutEffect, x = s.useDebugValue, m = !1, c = !1, g = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? n : a;
217
- et.useSyncExternalStore = s.useSyncExternalStore !== void 0 ? s.useSyncExternalStore : g, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
218
- }()), et;
216
+ var s = nr, u = typeof Object.is == "function" ? Object.is : e, h = s.useState, l = s.useEffect, b = s.useLayoutEffect, x = s.useDebugValue, p = !1, c = !1, f = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? r : n;
217
+ tt.useSyncExternalStore = s.useSyncExternalStore !== void 0 ? s.useSyncExternalStore : f, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
218
+ }()), tt;
219
219
  }
220
- process.env.NODE_ENV === "production" ? st.exports = vn() : st.exports = yn();
221
- var wn = st.exports;
222
- const Ue = ["light", "dark", "system"];
220
+ process.env.NODE_ENV === "production" ? ot.exports = vn() : ot.exports = yn();
221
+ var wn = ot.exports;
222
+ const Te = ["light", "dark", "system"];
223
223
  function Nn() {
224
- const { theme: e, setTheme: a } = ea(), r = N(
225
- (f) => f.actions.setDashboardTheme
224
+ const { theme: e, setTheme: n } = ea(), a = N(
225
+ (h) => h.actions.setDashboardTheme
226
226
  );
227
- function n() {
228
- const f = Ue.includes(e) ? e : "system", l = Ue[(Ue.indexOf(f) + 1) % Ue.length];
229
- a(l), r(l);
227
+ function r() {
228
+ const h = Te.includes(e) ? e : "system", l = Te[(Te.indexOf(h) + 1) % Te.length];
229
+ n(l), a(l);
230
230
  }
231
231
  const s = e === "light" ? bn : e === "dark" ? hn : fn, u = e === "light" ? "Theme: light (click for dark)" : e === "dark" ? "Theme: dark (click for system)" : "Theme: system (click for light)";
232
232
  return /* @__PURE__ */ t(
233
- O,
233
+ _,
234
234
  {
235
235
  type: "button",
236
236
  variant: "ghost",
237
237
  size: "xs",
238
238
  className: "h-7 w-7 p-0 text-muted-foreground hover:text-foreground",
239
- onClick: n,
239
+ onClick: r,
240
240
  "aria-label": u,
241
241
  title: u,
242
242
  children: /* @__PURE__ */ t(s, { className: "h-3.5 w-3.5", strokeWidth: 1.5 })
243
243
  }
244
244
  );
245
245
  }
246
- async function Sn(e, a, r, n, s) {
246
+ async function Sn(e, n, a, r, s) {
247
247
  if (!s)
248
248
  return null;
249
- const u = JSON.stringify(r), f = `${e}/v1/lens`;
250
- return await it(f, s, {
251
- name: a,
249
+ const u = JSON.stringify(a), h = `${e}/v1/lens`;
250
+ return await dt(h, s, {
251
+ name: n,
252
252
  template: u,
253
- filterValues: n,
253
+ filterValues: r,
254
254
  operation: "create"
255
255
  });
256
256
  }
257
- async function ot(e, a, r) {
258
- if (!r)
257
+ async function it(e, n, a) {
258
+ if (!a)
259
259
  return null;
260
- const { id: n, template: s, filterValues: u, isDefault: f, shared: l } = a, b = `${e}/v1/lens`;
261
- return await it(b, r, {
262
- lensId: n,
260
+ const { id: r, template: s, filterValues: u, isDefault: h, shared: l } = n, b = `${e}/v1/lens`;
261
+ return await dt(b, a, {
262
+ lensId: r,
263
263
  template: s,
264
264
  filterValues: u,
265
- isDefault: f,
265
+ isDefault: h,
266
266
  shared: l,
267
267
  operation: "update"
268
268
  });
269
269
  }
270
- async function Dn(e, a, r) {
271
- if (!r)
270
+ async function Dn(e, n, a) {
271
+ if (!a)
272
272
  return null;
273
- const n = `${e}/v1/lens`;
274
- return await it(n, r, {
273
+ const r = `${e}/v1/lens`;
274
+ return await dt(r, a, {
275
275
  operation: "delete",
276
- lensId: a
276
+ lensId: n
277
277
  });
278
278
  }
279
279
  const Cn = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";
280
280
  function kn({
281
281
  open: e,
282
- onOpenChange: a
282
+ onOpenChange: n
283
283
  } = {}) {
284
- const [r, n] = w(""), [s, u] = w(!1), f = N((k) => k.lenses), { setLenses: l, setSelectedLensId: b } = qt(), [x, m] = w(!1), [c, g] = w(!1), p = e !== void 0, h = p ? e : c, o = (k) => {
285
- p || g(k), a == null || a(k);
286
- }, y = N((k) => k.dashboard), S = N((k) => k.filterValues), { authToken: D, tokenProps: I } = B();
284
+ const [a, r] = w(""), [s, u] = w(!1), h = N((D) => D.lenses), { setLenses: l, setSelectedLensId: b } = Vt(), [x, p] = w(!1), [c, f] = w(!1), m = e !== void 0, g = m ? e : c, o = (D) => {
285
+ m || f(D), n == null || n(D);
286
+ }, y = N((D) => D.dashboard), S = N((D) => D.filterValues), { authToken: C, tokenProps: L } = G();
287
287
  async function E() {
288
- m(!0);
289
- const k = await Sn(
290
- I.apiServiceUrl,
291
- r,
288
+ p(!0);
289
+ const D = await Sn(
290
+ L.apiServiceUrl,
291
+ a,
292
292
  y,
293
293
  S,
294
- D == null ? void 0 : D.accessToken
294
+ C == null ? void 0 : C.accessToken
295
295
  );
296
- k && (l([...f || [], k]), b(k.id), o(!1)), m(!1);
296
+ D && (l([...h || [], D]), b(D.id), o(!1)), p(!1);
297
297
  }
298
- return /* @__PURE__ */ i(Wt, { open: h, onOpenChange: o, children: [
299
- p ? null : /* @__PURE__ */ t(ta, { asChild: !0, children: /* @__PURE__ */ i(O, { variant: "secondary", size: "xs", children: [
300
- /* @__PURE__ */ t(ee, { className: "h-3.5 w-3.5" }),
298
+ return /* @__PURE__ */ i(Jt, { open: g, onOpenChange: o, children: [
299
+ m ? null : /* @__PURE__ */ t(ta, { asChild: !0, children: /* @__PURE__ */ i(_, { variant: "secondary", size: "xs", children: [
300
+ /* @__PURE__ */ t(re, { className: "h-3.5 w-3.5" }),
301
301
  "Lens"
302
302
  ] }) }),
303
- /* @__PURE__ */ i(Jt, { className: "rounded-control border-border/60 sm:max-w-[420px] sm:rounded-control", children: [
303
+ /* @__PURE__ */ i(Yt, { className: "rounded-control border-border/60 sm:max-w-[420px] sm:rounded-control", children: [
304
304
  /* @__PURE__ */ i(ra, { children: [
305
- /* @__PURE__ */ t(rt, { className: "text-[15px]", children: "Create lens" }),
306
- /* @__PURE__ */ t(at, { className: "text-[13px] leading-5", children: "Lenses are private by default and are only visible to you." })
305
+ /* @__PURE__ */ t(at, { className: "text-[15px]", children: "Create lens" }),
306
+ /* @__PURE__ */ t(nt, { className: "text-[13px] leading-5", children: "Lenses are private by default and are only visible to you." })
307
307
  ] }),
308
308
  /* @__PURE__ */ i("div", { className: "space-y-1.5 py-1", children: [
309
309
  /* @__PURE__ */ t(Hr, { htmlFor: "lens-name", className: Cn, children: "Name" }),
@@ -312,22 +312,22 @@ function kn({
312
312
  {
313
313
  id: "lens-name",
314
314
  size: "xs",
315
- value: r,
315
+ value: a,
316
316
  placeholder: "Monthly review, West region, …",
317
- onChange: (k) => n(k.target.value)
317
+ onChange: (D) => r(D.target.value)
318
318
  }
319
319
  ),
320
320
  s && /* @__PURE__ */ t("p", { className: "text-[12px] text-destructive", children: "A lens with this name already exists. Pick a different one." })
321
321
  ] }),
322
322
  /* @__PURE__ */ i(aa, { children: [
323
- /* @__PURE__ */ t(O, { variant: "outline", size: "xs", onClick: () => o(!1), children: "Cancel" }),
323
+ /* @__PURE__ */ t(_, { variant: "outline", size: "xs", onClick: () => o(!1), children: "Cancel" }),
324
324
  /* @__PURE__ */ t(
325
- O,
325
+ _,
326
326
  {
327
327
  size: "xs",
328
328
  type: "submit",
329
329
  onClick: E,
330
- disabled: x || !r.trim(),
330
+ disabled: x || !a.trim(),
331
331
  children: x ? "Creating…" : "Create"
332
332
  }
333
333
  )
@@ -336,80 +336,80 @@ function kn({
336
336
  ] });
337
337
  }
338
338
  function En({ includeLabel: e = !1 } = {}) {
339
- const a = N((m) => m.lenses), r = N((m) => m.selectedLensId), { setLenses: n, setSelectedLensId: s } = qt(), { authToken: u, tokenProps: f } = B();
340
- async function l(m) {
341
- s(m);
339
+ const n = N((p) => p.lenses), a = N((p) => p.selectedLensId), { setLenses: r, setSelectedLensId: s } = Vt(), { authToken: u, tokenProps: h } = G();
340
+ async function l(p) {
341
+ s(p);
342
342
  }
343
- async function b(m) {
344
- if (await Dn(f.apiServiceUrl, m, u == null ? void 0 : u.accessToken)) {
345
- const g = a == null ? void 0 : a.filter((p) => p.id !== m);
346
- n(g || []), s("original");
343
+ async function b(p) {
344
+ if (await Dn(h.apiServiceUrl, p, u == null ? void 0 : u.accessToken)) {
345
+ const f = n == null ? void 0 : n.filter((m) => m.id !== p);
346
+ r(f || []), s("original");
347
347
  }
348
348
  }
349
- async function x(m) {
350
- const c = a == null ? void 0 : a.map((h) => h.id === m.id ? {
351
- ...h,
352
- isDefault: !m.isDefault
349
+ async function x(p) {
350
+ const c = n == null ? void 0 : n.map((g) => g.id === p.id ? {
351
+ ...g,
352
+ isDefault: !p.isDefault
353
353
  } : {
354
- ...h,
354
+ ...g,
355
355
  isDefault: !1
356
356
  });
357
- n(c || []);
358
- const g = {
359
- ...m,
360
- isDefault: !m.isDefault
357
+ r(c || []);
358
+ const f = {
359
+ ...p,
360
+ isDefault: !p.isDefault
361
361
  };
362
- await ot(f.apiServiceUrl, g, u == null ? void 0 : u.accessToken);
363
- const p = a == null ? void 0 : a.find((h) => h.isDefault);
364
- if (p && p.id !== m.id) {
365
- const h = {
366
- ...p,
362
+ await it(h.apiServiceUrl, f, u == null ? void 0 : u.accessToken);
363
+ const m = n == null ? void 0 : n.find((g) => g.isDefault);
364
+ if (m && m.id !== p.id) {
365
+ const g = {
366
+ ...m,
367
367
  isDefault: !1
368
368
  };
369
- await ot(f.apiServiceUrl, h, u == null ? void 0 : u.accessToken);
369
+ await it(h.apiServiceUrl, g, u == null ? void 0 : u.accessToken);
370
370
  }
371
371
  }
372
- return /* @__PURE__ */ i(U, { children: [
373
- e ? /* @__PURE__ */ i(U, { children: [
372
+ return /* @__PURE__ */ i(R, { children: [
373
+ e ? /* @__PURE__ */ i(R, { children: [
374
374
  /* @__PURE__ */ t(ue, { className: "px-3", children: "Lenses" }),
375
- /* @__PURE__ */ t(Re, {})
375
+ /* @__PURE__ */ t(Fe, {})
376
376
  ] }) : null,
377
377
  /* @__PURE__ */ i(
378
378
  na,
379
379
  {
380
- value: r,
380
+ value: a,
381
381
  onValueChange: l,
382
382
  children: [
383
383
  /* @__PURE__ */ t(Ut, { value: "original", children: "Original" }),
384
- a == null ? void 0 : a.map((m) => /* @__PURE__ */ i(
384
+ n == null ? void 0 : n.map((p) => /* @__PURE__ */ i(
385
385
  Ut,
386
386
  {
387
387
  className: "group flex justify-between gap-2",
388
- value: m.id,
388
+ value: p.id,
389
389
  children: [
390
- /* @__PURE__ */ t("p", { children: m.name }),
390
+ /* @__PURE__ */ t("p", { children: p.name }),
391
391
  /* @__PURE__ */ i("span", { className: "flex items-center gap-3", children: [
392
392
  /* @__PURE__ */ t(
393
- Yt,
393
+ Xt,
394
394
  {
395
395
  onClick: (c) => {
396
- c.preventDefault(), x(m);
396
+ c.preventDefault(), x(p);
397
397
  },
398
- className: Z(
398
+ className: te(
399
399
  "size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",
400
400
  {
401
- invisible: !m.isDefault,
402
- "text-green-500": m.isDefault
401
+ invisible: !p.isDefault,
402
+ "text-green-500": p.isDefault
403
403
  }
404
404
  ),
405
405
  strokeWidth: 1.5
406
406
  }
407
407
  ),
408
408
  /* @__PURE__ */ t(
409
- Xt,
409
+ Zt,
410
410
  {
411
411
  onClick: (c) => {
412
- c.preventDefault(), b(m.id);
412
+ c.preventDefault(), b(p.id);
413
413
  },
414
414
  className: "invisible size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",
415
415
  strokeWidth: 1.5
@@ -418,7 +418,7 @@ function En({ includeLabel: e = !1 } = {}) {
418
418
  ] })
419
419
  ]
420
420
  },
421
- m.id
421
+ p.id
422
422
  ))
423
423
  ]
424
424
  }
@@ -426,82 +426,82 @@ function En({ includeLabel: e = !1 } = {}) {
426
426
  ] });
427
427
  }
428
428
  function Ln() {
429
- const { displayPreferences: e, shouldShowElement: a } = sa(), { currentUser: r, userContext: n } = ct(), s = V(
430
- () => oa(r),
431
- [r]
432
- ), u = V(() => (l) => s && s[l] !== void 0 && s[l] === !1 ? !1 : a(l), [s, a, e]), f = V(
429
+ const { displayPreferences: e, shouldShowElement: n } = sa(), { currentUser: a, userContext: r } = lt(), s = V(
430
+ () => oa(a),
431
+ [a]
432
+ ), u = V(() => (l) => s && s[l] !== void 0 && s[l] === !1 ? !1 : n(l), [s, n, e]), h = V(
433
433
  () => {
434
- var l, b, x, m, c;
434
+ var l, b, x, p, c;
435
435
  return {
436
- canEdit: ((l = n == null ? void 0 : n.permissions) == null ? void 0 : l.canEdit) ?? ua(r),
437
- canUseFilters: ((b = n == null ? void 0 : n.permissions) == null ? void 0 : b.canEdit) ?? la(r),
438
- canManageDashboards: ((x = n == null ? void 0 : n.permissions) == null ? void 0 : x.canCreateDashboard) ?? ca(r),
439
- canCreateDashboards: ((m = n == null ? void 0 : n.permissions) == null ? void 0 : m.canCreateDashboard) ?? da(r),
440
- canAccessVisuals: ((c = n == null ? void 0 : n.permissions) == null ? void 0 : c.canEdit) ?? ia(r)
436
+ canEdit: ((l = r == null ? void 0 : r.permissions) == null ? void 0 : l.canEdit) ?? ua(a),
437
+ canUseFilters: ((b = r == null ? void 0 : r.permissions) == null ? void 0 : b.canEdit) ?? la(a),
438
+ canManageDashboards: ((x = r == null ? void 0 : r.permissions) == null ? void 0 : x.canCreateDashboard) ?? ca(a),
439
+ canCreateDashboards: ((p = r == null ? void 0 : r.permissions) == null ? void 0 : p.canCreateDashboard) ?? da(a),
440
+ canAccessVisuals: ((c = r == null ? void 0 : r.permissions) == null ? void 0 : c.canEdit) ?? ia(a)
441
441
  };
442
442
  },
443
- [r, n]
443
+ [a, r]
444
444
  );
445
445
  return {
446
446
  displayPreferences: e,
447
447
  shouldShowElement: u,
448
- permissions: f,
449
- currentUser: r
448
+ permissions: h,
449
+ currentUser: a
450
450
  };
451
451
  }
452
- function In(e, a = []) {
453
- let r = [];
454
- function n(u, f) {
455
- const l = L.createContext(f);
452
+ function In(e, n = []) {
453
+ let a = [];
454
+ function r(u, h) {
455
+ const l = I.createContext(h);
456
456
  l.displayName = u + "Context";
457
- const b = r.length;
458
- r = [...r, f];
457
+ const b = a.length;
458
+ a = [...a, h];
459
459
  const x = (c) => {
460
460
  var S;
461
- const { scope: g, children: p, ...h } = c, o = ((S = g == null ? void 0 : g[e]) == null ? void 0 : S[b]) || l, y = L.useMemo(() => h, Object.values(h));
462
- return /* @__PURE__ */ t(o.Provider, { value: y, children: p });
461
+ const { scope: f, children: m, ...g } = c, o = ((S = f == null ? void 0 : f[e]) == null ? void 0 : S[b]) || l, y = I.useMemo(() => g, Object.values(g));
462
+ return /* @__PURE__ */ t(o.Provider, { value: y, children: m });
463
463
  };
464
464
  x.displayName = u + "Provider";
465
- function m(c, g) {
465
+ function p(c, f) {
466
466
  var o;
467
- const p = ((o = g == null ? void 0 : g[e]) == null ? void 0 : o[b]) || l, h = L.useContext(p);
468
- if (h) return h;
469
- if (f !== void 0) return f;
467
+ const m = ((o = f == null ? void 0 : f[e]) == null ? void 0 : o[b]) || l, g = I.useContext(m);
468
+ if (g) return g;
469
+ if (h !== void 0) return h;
470
470
  throw new Error(`\`${c}\` must be used within \`${u}\``);
471
471
  }
472
- return [x, m];
472
+ return [x, p];
473
473
  }
474
474
  const s = () => {
475
- const u = r.map((f) => L.createContext(f));
475
+ const u = a.map((h) => I.createContext(h));
476
476
  return function(l) {
477
477
  const b = (l == null ? void 0 : l[e]) || u;
478
- return L.useMemo(
478
+ return I.useMemo(
479
479
  () => ({ [`__scope${e}`]: { ...l, [e]: b } }),
480
480
  [l, b]
481
481
  );
482
482
  };
483
483
  };
484
- return s.scopeName = e, [n, Mn(s, ...a)];
484
+ return s.scopeName = e, [r, An(s, ...n)];
485
485
  }
486
- function Mn(...e) {
487
- const a = e[0];
488
- if (e.length === 1) return a;
489
- const r = () => {
490
- const n = e.map((s) => ({
486
+ function An(...e) {
487
+ const n = e[0];
488
+ if (e.length === 1) return n;
489
+ const a = () => {
490
+ const r = e.map((s) => ({
491
491
  useScope: s(),
492
492
  scopeName: s.scopeName
493
493
  }));
494
494
  return function(u) {
495
- const f = n.reduce((l, { useScope: b, scopeName: x }) => {
495
+ const h = r.reduce((l, { useScope: b, scopeName: x }) => {
496
496
  const c = b(u)[`__scope${x}`];
497
497
  return { ...l, ...c };
498
498
  }, {});
499
- return L.useMemo(() => ({ [`__scope${a.scopeName}`]: f }), [f]);
499
+ return I.useMemo(() => ({ [`__scope${n.scopeName}`]: h }), [h]);
500
500
  };
501
501
  };
502
- return r.scopeName = a.scopeName, r;
502
+ return a.scopeName = n.scopeName, a;
503
503
  }
504
- var An = [
504
+ var Mn = [
505
505
  "a",
506
506
  "button",
507
507
  "div",
@@ -519,222 +519,224 @@ var An = [
519
519
  "span",
520
520
  "svg",
521
521
  "ul"
522
- ], ut = An.reduce((e, a) => {
523
- const r = qr(`Primitive.${a}`), n = L.forwardRef((s, u) => {
524
- const { asChild: f, ...l } = s, b = f ? r : a;
522
+ ], mt = Mn.reduce((e, n) => {
523
+ const a = qr(`Primitive.${n}`), r = I.forwardRef((s, u) => {
524
+ const { asChild: h, ...l } = s, b = h ? a : n;
525
525
  return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ t(b, { ...l, ref: u });
526
526
  });
527
- return n.displayName = `Primitive.${a}`, { ...e, [a]: n };
527
+ return r.displayName = `Primitive.${n}`, { ...e, [n]: r };
528
528
  }, {});
529
529
  function Pn() {
530
530
  return wn.useSyncExternalStore(
531
- _n,
531
+ On,
532
532
  () => !0,
533
533
  () => !1
534
534
  );
535
535
  }
536
- function _n() {
536
+ function On() {
537
537
  return () => {
538
538
  };
539
539
  }
540
- var mt = "Avatar", [On] = In(mt), [Un, sr] = On(mt), or = L.forwardRef(
541
- (e, a) => {
542
- const { __scopeAvatar: r, ...n } = e, [s, u] = L.useState("idle");
540
+ var pt = "Avatar", [_n] = In(pt), [Rn, or] = _n(pt), ir = I.forwardRef(
541
+ (e, n) => {
542
+ const { __scopeAvatar: a, ...r } = e, [s, u] = I.useState("idle");
543
543
  return /* @__PURE__ */ t(
544
- Un,
544
+ Rn,
545
545
  {
546
- scope: r,
546
+ scope: a,
547
547
  imageLoadingStatus: s,
548
548
  onImageLoadingStatusChange: u,
549
- children: /* @__PURE__ */ t(ut.span, { ...n, ref: a })
549
+ children: /* @__PURE__ */ t(mt.span, { ...r, ref: n })
550
550
  }
551
551
  );
552
552
  }
553
553
  );
554
- or.displayName = mt;
555
- var ir = "AvatarImage", dr = L.forwardRef(
556
- (e, a) => {
557
- const { __scopeAvatar: r, src: n, onLoadingStatusChange: s = () => {
558
- }, ...u } = e, f = sr(ir, r), l = Rn(n, u), b = Vr((x) => {
559
- s(x), f.onImageLoadingStatusChange(x);
554
+ ir.displayName = pt;
555
+ var dr = "AvatarImage", cr = I.forwardRef(
556
+ (e, n) => {
557
+ const { __scopeAvatar: a, src: r, onLoadingStatusChange: s = () => {
558
+ }, ...u } = e, h = or(dr, a), l = Un(r, u), b = Vr((x) => {
559
+ s(x), h.onImageLoadingStatusChange(x);
560
560
  });
561
- return tt(() => {
561
+ return rt(() => {
562
562
  l !== "idle" && b(l);
563
- }, [l, b]), l === "loaded" ? /* @__PURE__ */ t(ut.img, { ...u, ref: a, src: n }) : null;
563
+ }, [l, b]), l === "loaded" ? /* @__PURE__ */ t(mt.img, { ...u, ref: n, src: r }) : null;
564
564
  }
565
565
  );
566
- dr.displayName = ir;
567
- var cr = "AvatarFallback", lr = L.forwardRef(
568
- (e, a) => {
569
- const { __scopeAvatar: r, delayMs: n, ...s } = e, u = sr(cr, r), [f, l] = L.useState(n === void 0);
570
- return L.useEffect(() => {
571
- if (n !== void 0) {
572
- const b = window.setTimeout(() => l(!0), n);
566
+ cr.displayName = dr;
567
+ var lr = "AvatarFallback", ur = I.forwardRef(
568
+ (e, n) => {
569
+ const { __scopeAvatar: a, delayMs: r, ...s } = e, u = or(lr, a), [h, l] = I.useState(r === void 0);
570
+ return I.useEffect(() => {
571
+ if (r !== void 0) {
572
+ const b = window.setTimeout(() => l(!0), r);
573
573
  return () => window.clearTimeout(b);
574
574
  }
575
- }, [n]), f && u.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ t(ut.span, { ...s, ref: a }) : null;
575
+ }, [r]), h && u.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ t(mt.span, { ...s, ref: n }) : null;
576
576
  }
577
577
  );
578
- lr.displayName = cr;
579
- function zt(e, a) {
580
- return e ? a ? (e.src !== a && (e.src = a), e.complete && e.naturalWidth > 0 ? "loaded" : "loading") : "error" : "idle";
578
+ ur.displayName = lr;
579
+ function Ht(e, n) {
580
+ return e ? n ? (e.src !== n && (e.src = n), e.complete && e.naturalWidth > 0 ? "loaded" : "loading") : "error" : "idle";
581
581
  }
582
- function Rn(e, { referrerPolicy: a, crossOrigin: r }) {
583
- const n = Pn(), s = L.useRef(null), u = n ? (s.current || (s.current = new window.Image()), s.current) : null, [f, l] = L.useState(
584
- () => zt(u, e)
582
+ function Un(e, { referrerPolicy: n, crossOrigin: a }) {
583
+ const r = Pn(), s = I.useRef(null), u = r ? (s.current || (s.current = new window.Image()), s.current) : null, [h, l] = I.useState(
584
+ () => Ht(u, e)
585
585
  );
586
- return tt(() => {
587
- l(zt(u, e));
588
- }, [u, e]), tt(() => {
586
+ return rt(() => {
587
+ l(Ht(u, e));
588
+ }, [u, e]), rt(() => {
589
589
  const b = (c) => () => {
590
590
  l(c);
591
591
  };
592
592
  if (!u) return;
593
- const x = b("loaded"), m = b("error");
594
- return u.addEventListener("load", x), u.addEventListener("error", m), a && (u.referrerPolicy = a), typeof r == "string" && (u.crossOrigin = r), () => {
595
- u.removeEventListener("load", x), u.removeEventListener("error", m);
593
+ const x = b("loaded"), p = b("error");
594
+ return u.addEventListener("load", x), u.addEventListener("error", p), n && (u.referrerPolicy = n), typeof a == "string" && (u.crossOrigin = a), () => {
595
+ u.removeEventListener("load", x), u.removeEventListener("error", p);
596
596
  };
597
- }, [u, r, a]), f;
597
+ }, [u, a, n]), h;
598
598
  }
599
- var ur = or, mr = dr, pr = lr;
600
- const fr = L.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
601
- ur,
599
+ var mr = ir, pr = cr, fr = ur;
600
+ const hr = I.forwardRef(({ className: e, ...n }, a) => /* @__PURE__ */ t(
601
+ mr,
602
602
  {
603
- ref: r,
604
- className: Z(
603
+ ref: a,
604
+ className: te(
605
605
  "relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
606
606
  e
607
607
  ),
608
- ...a
608
+ ...n
609
609
  }
610
610
  ));
611
- fr.displayName = ur.displayName;
612
- const Tn = L.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
613
- mr,
611
+ hr.displayName = mr.displayName;
612
+ const Tn = I.forwardRef(({ className: e, ...n }, a) => /* @__PURE__ */ t(
613
+ pr,
614
614
  {
615
- ref: r,
616
- className: Z("aspect-square h-full w-full", e),
617
- ...a
615
+ ref: a,
616
+ className: te("aspect-square h-full w-full", e),
617
+ ...n
618
618
  }
619
619
  ));
620
- Tn.displayName = mr.displayName;
621
- const hr = L.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
622
- pr,
620
+ Tn.displayName = pr.displayName;
621
+ const gr = I.forwardRef(({ className: e, ...n }, a) => /* @__PURE__ */ t(
622
+ fr,
623
623
  {
624
- ref: r,
625
- className: Z(
624
+ ref: a,
625
+ className: te(
626
626
  "flex h-full w-full items-center justify-center rounded-full bg-muted",
627
627
  e
628
628
  ),
629
- ...a
629
+ ...n
630
630
  }
631
631
  ));
632
- hr.displayName = pr.displayName;
633
- const Fn = async (e, a, r) => {
634
- const n = `${e}/management/v1/groups`;
635
- return await Vt(n, a, r);
636
- }, $n = async (e, a, r, n) => {
637
- const s = `${e}/management/v1/groups/${r}`;
638
- return dt(s, a, "PATCH", n);
639
- }, Gn = async (e, a, r) => {
640
- const n = `${e}/management/v1/groups/${r}`;
641
- await dt(n, a, "DELETE");
642
- }, Bn = async (e, a, r, n) => {
643
- const s = `${e}/management/v1/groups/${r}/members`;
644
- return await Vt(s, a, n);
645
- }, zn = async (e, a, r, n) => {
646
- const s = `${e}/management/v1/groups/${r}/members`;
647
- await dt(s, a, "DELETE", n);
632
+ gr.displayName = fr.displayName;
633
+ const Fn = async (e, n, a) => {
634
+ const r = `${e}/management/v1/groups`;
635
+ return await Kt(r, n, a);
636
+ }, $n = async (e, n, a, r) => {
637
+ const s = `${e}/management/v1/groups/${a}`;
638
+ return ct(s, n, "PATCH", r);
639
+ }, Gn = async (e, n, a) => {
640
+ const r = `${e}/management/v1/groups/${a}`;
641
+ await ct(r, n, "DELETE");
642
+ }, Bn = async (e, n, a, r) => {
643
+ const s = `${e}/management/v1/groups/${a}/members`;
644
+ return await Kt(s, n, r);
645
+ }, zn = async (e, n, a, r) => {
646
+ const s = `${e}/management/v1/groups/${a}/members`;
647
+ await ct(s, n, "DELETE", r);
648
648
  };
649
649
  function Hn() {
650
- const { authToken: e, tokenProps: a } = B(), r = pe();
650
+ const { authToken: e, tokenProps: n } = G(), a = pe();
651
651
  return fe({
652
- mutationFn: (n) => Fn(a.apiServiceUrl, (e == null ? void 0 : e.accessToken) || "", n),
652
+ mutationFn: (r) => Fn(n.apiServiceUrl, (e == null ? void 0 : e.accessToken) || "", r),
653
653
  onSuccess: () => {
654
- r.invalidateQueries({ queryKey: ["groups"] }), C.success("Group created successfully");
654
+ a.invalidateQueries({ queryKey: ["groups"] }), k.success("Group created successfully");
655
655
  },
656
- onError: (n) => {
657
- console.error("Failed to create group:", n), C.error("Failed to create group", {
658
- description: me(n, "Failed to create group")
656
+ onError: (r) => {
657
+ console.error("Failed to create group:", r), k.error("Failed to create group", {
658
+ description: me(r, "Failed to create group")
659
659
  });
660
660
  }
661
661
  });
662
662
  }
663
663
  function jn() {
664
- const { authToken: e, tokenProps: a } = B(), r = pe();
664
+ const { authToken: e, tokenProps: n } = G(), a = pe();
665
665
  return fe({
666
666
  mutationFn: ({
667
- groupId: n,
667
+ groupId: r,
668
668
  data: s
669
- }) => $n(a.apiServiceUrl, (e == null ? void 0 : e.accessToken) || "", n, s),
670
- onSuccess: (n, s) => {
671
- r.invalidateQueries({ queryKey: ["group", s.groupId] }), r.invalidateQueries({ queryKey: ["groups"] }), C.success("Group updated successfully");
669
+ }) => $n(n.apiServiceUrl, (e == null ? void 0 : e.accessToken) || "", r, s),
670
+ onSuccess: (r, s) => {
671
+ a.invalidateQueries({ queryKey: ["group", s.groupId] }), a.invalidateQueries({ queryKey: ["groups"] }), k.success("Group updated successfully");
672
672
  },
673
- onError: (n) => {
674
- console.error("Failed to update group:", n), C.error("Failed to update group", {
675
- description: me(n, "Failed to update group")
673
+ onError: (r) => {
674
+ console.error("Failed to update group:", r), k.error("Failed to update group", {
675
+ description: me(r, "Failed to update group")
676
676
  });
677
677
  }
678
678
  });
679
679
  }
680
680
  function qn() {
681
- const { authToken: e, tokenProps: a } = B(), r = pe();
681
+ const { authToken: e, tokenProps: n } = G(), a = pe();
682
682
  return fe({
683
- mutationFn: (n) => Gn(a.apiServiceUrl, (e == null ? void 0 : e.accessToken) || "", n),
684
- onSuccess: (n, s) => {
685
- r.invalidateQueries({ queryKey: ["groups"] }), r.removeQueries({ queryKey: ["group", s] }), C.success("Group deleted successfully");
683
+ mutationFn: (r) => Gn(n.apiServiceUrl, (e == null ? void 0 : e.accessToken) || "", r),
684
+ onSuccess: (r, s) => {
685
+ a.invalidateQueries({ queryKey: ["groups"] }), a.removeQueries({ queryKey: ["group", s] }), k.success("Group deleted successfully");
686
686
  },
687
- onError: (n) => {
688
- console.error("Failed to delete group:", n), C.error("Failed to delete group", {
689
- description: me(n, "Failed to delete group")
687
+ onError: (r) => {
688
+ console.error("Failed to delete group:", r), k.error("Failed to delete group", {
689
+ description: me(r, "Failed to delete group")
690
690
  });
691
691
  }
692
692
  });
693
693
  }
694
694
  function Vn() {
695
- const { authToken: e, tokenProps: a } = B(), r = pe();
695
+ const { authToken: e, tokenProps: n } = G(), a = pe();
696
696
  return fe({
697
697
  mutationFn: ({
698
- groupId: n,
698
+ groupId: r,
699
699
  data: s
700
- }) => Bn(a.apiServiceUrl, (e == null ? void 0 : e.accessToken) || "", n, s),
701
- onSuccess: (n, s) => {
702
- r.invalidateQueries({ queryKey: ["group", s.groupId] }), r.invalidateQueries({
700
+ }) => Bn(n.apiServiceUrl, (e == null ? void 0 : e.accessToken) || "", r, s),
701
+ onSuccess: (r, s) => {
702
+ a.invalidateQueries({ queryKey: ["group", s.groupId] }), a.invalidateQueries({
703
703
  queryKey: ["group-members", s.groupId]
704
- }), r.invalidateQueries({ queryKey: ["groups"] }), C.success("Members added successfully");
704
+ }), a.invalidateQueries({ queryKey: ["groups"] }), k.success("Members added successfully");
705
705
  },
706
- onError: (n) => {
707
- console.error("Failed to add group members:", n), C.error("Failed to add members", {
708
- description: me(n, "Failed to add members")
706
+ onError: (r) => {
707
+ console.error("Failed to add group members:", r), k.error("Failed to add members", {
708
+ description: me(r, "Failed to add members")
709
709
  });
710
710
  }
711
711
  });
712
712
  }
713
713
  function Kn() {
714
- const { authToken: e, tokenProps: a } = B(), r = pe();
714
+ const { authToken: e, tokenProps: n } = G(), a = pe();
715
715
  return fe({
716
716
  mutationFn: ({
717
- groupId: n,
717
+ groupId: r,
718
718
  data: s
719
- }) => zn(a.apiServiceUrl, (e == null ? void 0 : e.accessToken) || "", n, s),
720
- onSuccess: (n, s) => {
721
- r.invalidateQueries({ queryKey: ["group", s.groupId] }), r.invalidateQueries({
719
+ }) => zn(n.apiServiceUrl, (e == null ? void 0 : e.accessToken) || "", r, s),
720
+ onSuccess: (r, s) => {
721
+ a.invalidateQueries({ queryKey: ["group", s.groupId] }), a.invalidateQueries({
722
722
  queryKey: ["group-members", s.groupId]
723
- }), r.invalidateQueries({ queryKey: ["groups"] }), C.success("Members removed successfully");
723
+ }), a.invalidateQueries({ queryKey: ["groups"] }), k.success("Members removed successfully");
724
724
  },
725
- onError: (n) => {
726
- console.error("Failed to remove group members:", n), C.error("Failed to remove members", {
727
- description: me(n, "Failed to remove members")
725
+ onError: (r) => {
726
+ console.error("Failed to remove group members:", r), k.error("Failed to remove members", {
727
+ description: me(r, "Failed to remove members")
728
728
  });
729
729
  }
730
730
  });
731
731
  }
732
- function Qn({
732
+ const Qn = [];
733
+ function Wn({
733
734
  open: e,
734
- onOpenChange: a
735
+ onOpenChange: n
735
736
  }) {
736
- const { tokenProps: r } = B(), { currentUser: n } = ct(), s = (n == null ? void 0 : n.type) === "tenant", u = r == null ? void 0 : r.tenantId, {
737
- groups: f,
737
+ var C, L, E;
738
+ const { tokenProps: a } = G(), { currentUser: r } = lt(), s = (r == null ? void 0 : r.type) === "tenant", u = a == null ? void 0 : a.tenantId, {
739
+ groups: h,
738
740
  isLoading: l,
739
741
  error: b,
740
742
  refetch: x
@@ -742,76 +744,78 @@ function Qn({
742
744
  type: s ? "TENANT_GROUP" : "all",
743
745
  tenantId: s ? u : void 0,
744
746
  includeMembers: !1
745
- }), m = b ? gr(b, "Unable to load groups.") : null, [c, g] = w({ kind: "list" }), [p, h] = w(null), o = qn();
746
- Fe(() => {
747
- e || (g({ kind: "list" }), h(null));
747
+ }), p = b ? br(b, "Unable to load groups.") : null, [c, f] = w({ kind: "list" }), [m, g] = w(null), o = qn();
748
+ Ge(() => {
749
+ e || (f({ kind: "list" }), g(null));
748
750
  }, [e]);
749
- const y = c.kind === "members" && f.find((D) => D.id === c.groupId) || null, S = async () => {
750
- if (p)
751
+ const y = c.kind === "members" && h.find((D) => D.id === c.groupId) || null, S = async () => {
752
+ if (m)
751
753
  try {
752
- await o.mutateAsync(p.id), h(null), g({ kind: "list" }), x();
754
+ await o.mutateAsync(m.id), g(null), f({ kind: "list" }), x();
753
755
  } catch {
754
756
  }
755
757
  };
756
- return /* @__PURE__ */ t(Wt, { open: e, onOpenChange: a, children: /* @__PURE__ */ i(Jt, { className: "flex max-h-[640px] w-[720px] max-w-[92vw] flex-col gap-0 overflow-hidden p-0", children: [
758
+ return /* @__PURE__ */ t(Jt, { open: e, onOpenChange: n, children: /* @__PURE__ */ i(Yt, { className: "flex max-h-[640px] w-[720px] max-w-[92vw] flex-col gap-0 overflow-hidden p-0", children: [
757
759
  c.kind === "list" ? /* @__PURE__ */ i("div", { className: "shrink-0 border-b border-border px-5 pt-4 pb-3.5", children: [
758
- /* @__PURE__ */ t(rt, { className: "text-[15px] font-semibold tracking-tight", children: "Group management" }),
759
- /* @__PURE__ */ t(at, { className: "mt-1 text-[12px] leading-[1.5] text-muted-foreground", children: "Organize people into groups for shared access." })
760
+ /* @__PURE__ */ t(at, { className: "text-[15px] font-semibold tracking-tight", children: "Group management" }),
761
+ /* @__PURE__ */ t(nt, { className: "mt-1 text-[12px] leading-[1.5] text-muted-foreground", children: "Organize people into groups for shared access." })
760
762
  ] }) : c.kind === "create" ? /* @__PURE__ */ i("div", { className: "flex h-10 shrink-0 items-center gap-1.5 border-b border-border px-5", children: [
761
763
  /* @__PURE__ */ t(
762
764
  "button",
763
765
  {
764
766
  type: "button",
765
- onClick: () => g({ kind: "list" }),
767
+ onClick: () => f({ kind: "list" }),
766
768
  "aria-label": "Back",
767
769
  className: "-ml-1 flex h-6 w-6 items-center justify-center rounded-[3px] text-muted-foreground hover:bg-accent hover:text-foreground",
768
- children: /* @__PURE__ */ t(Zt, { className: "h-3.5 w-3.5" })
770
+ children: /* @__PURE__ */ t(er, { className: "h-3.5 w-3.5" })
769
771
  }
770
772
  ),
771
- /* @__PURE__ */ t(rt, { className: "truncate text-[13px] font-medium", children: "New group" }),
772
- /* @__PURE__ */ t(at, { className: "sr-only", children: "Create a new group to organize members." })
773
+ /* @__PURE__ */ t(at, { className: "truncate text-[13px] font-medium", children: "New group" }),
774
+ /* @__PURE__ */ t(nt, { className: "sr-only", children: "Create a new group to organize members." })
773
775
  ] }) : null,
774
776
  c.kind === "list" && /* @__PURE__ */ t(
775
- Wn,
777
+ Jn,
776
778
  {
777
- groups: f,
779
+ groups: h,
778
780
  isLoading: l,
779
- errorMessage: m,
781
+ errorMessage: p,
780
782
  onRetry: () => x(),
781
- currentUserId: n == null ? void 0 : n.id,
782
- onOpenGroup: (D) => g({ kind: "members", groupId: D }),
783
- onCreate: () => g({ kind: "create" }),
784
- onDeleteRequest: (D) => h(D)
783
+ currentUserId: r == null ? void 0 : r.id,
784
+ onOpenGroup: (D) => f({ kind: "members", groupId: D }),
785
+ onCreate: () => f({ kind: "create" }),
786
+ onDeleteRequest: (D) => g(D)
785
787
  }
786
788
  ),
787
789
  c.kind === "members" && y && /* @__PURE__ */ t(
788
- Xn,
790
+ Zn,
789
791
  {
790
792
  group: y,
791
793
  isTenantViewer: s,
792
- isOwner: y.createdBy === (n == null ? void 0 : n.id),
793
- onBack: () => g({ kind: "list" }),
794
+ canEdit: ((C = y.permissions) == null ? void 0 : C.canEdit) ?? y.createdBy === (r == null ? void 0 : r.id),
795
+ canDelete: ((L = y.permissions) == null ? void 0 : L.canDelete) ?? y.createdBy === (r == null ? void 0 : r.id),
796
+ canManageMembers: ((E = y.permissions) == null ? void 0 : E.canManageMembers) ?? y.createdBy === (r == null ? void 0 : r.id),
797
+ onBack: () => f({ kind: "list" }),
794
798
  onMembersChanged: x,
795
799
  onUpdated: x,
796
- onRequestDelete: () => h(y)
800
+ onRequestDelete: () => g(y)
797
801
  },
798
802
  y.id
799
803
  ),
800
804
  c.kind === "create" && /* @__PURE__ */ t(
801
- Zn,
805
+ es,
802
806
  {
803
807
  isTenantUser: s,
804
808
  tenantId: u,
805
- onCancel: () => g({ kind: "list" }),
809
+ onCancel: () => f({ kind: "list" }),
806
810
  onCreated: (D) => {
807
- x(), g({ kind: "members", groupId: D });
811
+ x(), f({ kind: "members", groupId: D });
808
812
  }
809
813
  }
810
814
  ),
811
- p && /* @__PURE__ */ i("div", { className: "flex shrink-0 items-center justify-between gap-3 border-t border-border bg-muted/40 px-5 py-2.5", children: [
815
+ m && /* @__PURE__ */ i("div", { className: "flex shrink-0 items-center justify-between gap-3 border-t border-border bg-muted/40 px-5 py-2.5", children: [
812
816
  /* @__PURE__ */ i("div", { className: "min-w-0 text-[12px] text-foreground", children: [
813
817
  "Delete ",
814
- /* @__PURE__ */ t("span", { className: "font-medium", children: p.name }),
818
+ /* @__PURE__ */ t("span", { className: "font-medium", children: m.name }),
815
819
  "?",
816
820
  /* @__PURE__ */ t("span", { className: "ml-2 text-muted-foreground", children: "Members lose any access granted via this group." })
817
821
  ] }),
@@ -820,7 +824,7 @@ function Qn({
820
824
  "button",
821
825
  {
822
826
  type: "button",
823
- onClick: () => h(null),
827
+ onClick: () => g(null),
824
828
  disabled: o.isPending,
825
829
  className: "h-7 rounded-[5px] px-2.5 text-[12px] font-medium text-foreground/80 hover:bg-background",
826
830
  children: "Cancel"
@@ -834,7 +838,7 @@ function Qn({
834
838
  disabled: o.isPending,
835
839
  className: "inline-flex h-7 items-center gap-1.5 rounded-[5px] bg-rose-600 px-2.5 text-[12px] font-medium text-white hover:bg-rose-700 disabled:opacity-60",
836
840
  children: [
837
- o.isPending ? /* @__PURE__ */ t(Te, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ t(lt, { className: "h-3 w-3" }),
841
+ o.isPending ? /* @__PURE__ */ t($e, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ t(ut, { className: "h-3 w-3" }),
838
842
  "Delete group"
839
843
  ]
840
844
  }
@@ -843,17 +847,17 @@ function Qn({
843
847
  ] })
844
848
  ] }) });
845
849
  }
846
- function Wn({
850
+ function Jn({
847
851
  groups: e,
848
- isLoading: a,
849
- errorMessage: r,
850
- onRetry: n,
852
+ isLoading: n,
853
+ errorMessage: a,
854
+ onRetry: r,
851
855
  currentUserId: s,
852
856
  onOpenGroup: u,
853
- onCreate: f,
857
+ onCreate: h,
854
858
  onDeleteRequest: l
855
859
  }) {
856
- const [b, x] = w(""), m = V(
860
+ const [b, x] = w(""), p = V(
857
861
  () => e.filter(
858
862
  (c) => !b.trim() || c.name.toLowerCase().includes(b.toLowerCase()) || (c.description || "").toLowerCase().includes(b.toLowerCase())
859
863
  ),
@@ -878,7 +882,7 @@ function Wn({
878
882
  type: "button",
879
883
  onClick: () => x(""),
880
884
  className: "flex h-4 w-4 items-center justify-center rounded-[3px] text-muted-foreground hover:bg-accent hover:text-foreground",
881
- children: /* @__PURE__ */ t(Kt, { className: "h-2.5 w-2.5" })
885
+ children: /* @__PURE__ */ t(Qt, { className: "h-2.5 w-2.5" })
882
886
  }
883
887
  )
884
888
  ] }),
@@ -886,56 +890,59 @@ function Wn({
886
890
  "button",
887
891
  {
888
892
  type: "button",
889
- onClick: f,
893
+ onClick: h,
890
894
  className: "inline-flex h-7 items-center gap-1.5 rounded-[5px] bg-foreground px-2.5 text-[12px] font-medium text-background hover:opacity-90",
891
895
  children: [
892
- /* @__PURE__ */ t(ee, { className: "h-3 w-3" }),
896
+ /* @__PURE__ */ t(re, { className: "h-3 w-3" }),
893
897
  "New group"
894
898
  ]
895
899
  }
896
900
  )
897
901
  ] }),
898
- /* @__PURE__ */ t("div", { className: "flex-1 overflow-y-auto", children: a ? /* @__PURE__ */ t("div", { className: "space-y-px p-3", children: [1, 2, 3].map((c) => /* @__PURE__ */ t(
902
+ /* @__PURE__ */ t("div", { className: "flex-1 overflow-y-auto", children: n ? /* @__PURE__ */ t("div", { className: "space-y-px p-3", children: [1, 2, 3].map((c) => /* @__PURE__ */ t(
899
903
  "div",
900
904
  {
901
905
  className: "h-12 animate-pulse rounded-[4px] bg-muted/60"
902
906
  },
903
907
  c
904
- )) }) : r ? /* @__PURE__ */ t(
905
- br,
908
+ )) }) : a ? /* @__PURE__ */ t(
909
+ xr,
906
910
  {
907
911
  title: "Can't load groups",
908
- message: r,
909
- onRetry: n
912
+ message: a,
913
+ onRetry: r
910
914
  }
911
- ) : m.length === 0 && e.length === 0 ? /* @__PURE__ */ t(Yn, { onCreate: f }) : m.length === 0 ? /* @__PURE__ */ i("div", { className: "flex h-full flex-col items-center justify-center gap-1 py-10 text-center", children: [
915
+ ) : p.length === 0 && e.length === 0 ? /* @__PURE__ */ t(Xn, { onCreate: h }) : p.length === 0 ? /* @__PURE__ */ i("div", { className: "flex h-full flex-col items-center justify-center gap-1 py-10 text-center", children: [
912
916
  /* @__PURE__ */ i("div", { className: "text-[12px] text-foreground", children: [
913
917
  'No groups match "',
914
918
  b,
915
919
  '"'
916
920
  ] }),
917
921
  /* @__PURE__ */ t("div", { className: "text-[11px] text-muted-foreground", children: "Try a different search." })
918
- ] }) : m.map((c) => /* @__PURE__ */ t(
919
- Jn,
920
- {
921
- group: c,
922
- isOwner: c.createdBy === s,
923
- onClick: () => u(c.id),
924
- onDelete: () => l(c)
925
- },
926
- c.id
927
- )) })
922
+ ] }) : p.map((c) => {
923
+ var f;
924
+ return /* @__PURE__ */ t(
925
+ Yn,
926
+ {
927
+ group: c,
928
+ canDelete: ((f = c.permissions) == null ? void 0 : f.canDelete) ?? c.createdBy === s,
929
+ onClick: () => u(c.id),
930
+ onDelete: () => l(c)
931
+ },
932
+ c.id
933
+ );
934
+ }) })
928
935
  ] });
929
936
  }
930
- function Jn({
937
+ function Yn({
931
938
  group: e,
932
- isOwner: a,
933
- onClick: r,
934
- onDelete: n
939
+ canDelete: n,
940
+ onClick: a,
941
+ onDelete: r
935
942
  }) {
936
943
  let s = "";
937
944
  try {
938
- s = nr(new Date(e.createdAt), "MMM d, yyyy");
945
+ s = sr(new Date(e.createdAt), "MMM d, yyyy");
939
946
  } catch {
940
947
  s = "";
941
948
  }
@@ -943,7 +950,7 @@ function Jn({
943
950
  "button",
944
951
  {
945
952
  type: "button",
946
- onClick: r,
953
+ onClick: a,
947
954
  className: "group flex w-full items-center gap-3 border-b border-border/60 px-5 py-2.5 text-left hover:bg-accent/40",
948
955
  children: [
949
956
  /* @__PURE__ */ t("div", { className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-[4px] border border-border bg-background text-muted-foreground", children: /* @__PURE__ */ t(Ya, { className: "h-3.5 w-3.5" }) }),
@@ -951,39 +958,39 @@ function Jn({
951
958
  /* @__PURE__ */ t("div", { className: "truncate text-[13px] font-medium text-foreground", children: e.name }),
952
959
  /* @__PURE__ */ i("div", { className: "mt-0.5 flex items-center gap-2 text-[11px] text-muted-foreground", children: [
953
960
  /* @__PURE__ */ i("span", { className: "inline-flex items-center gap-1", children: [
954
- /* @__PURE__ */ t(er, { className: "h-2.5 w-2.5" }),
961
+ /* @__PURE__ */ t(tr, { className: "h-2.5 w-2.5" }),
955
962
  e.memberCount,
956
963
  " member",
957
964
  e.memberCount === 1 ? "" : "s"
958
965
  ] }),
959
- s && /* @__PURE__ */ i(U, { children: [
966
+ s && /* @__PURE__ */ i(R, { children: [
960
967
  /* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
961
968
  /* @__PURE__ */ i("span", { className: "inline-flex items-center gap-1", children: [
962
- /* @__PURE__ */ t(rr, { className: "h-2.5 w-2.5" }),
969
+ /* @__PURE__ */ t(ar, { className: "h-2.5 w-2.5" }),
963
970
  s
964
971
  ] })
965
972
  ] }),
966
- e.description && /* @__PURE__ */ i(U, { children: [
973
+ e.description && /* @__PURE__ */ i(R, { children: [
967
974
  /* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
968
975
  /* @__PURE__ */ t("span", { className: "truncate text-muted-foreground", children: e.description })
969
976
  ] })
970
977
  ] })
971
978
  ] }),
972
979
  /* @__PURE__ */ i("div", { className: "flex items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100", children: [
973
- a && /* @__PURE__ */ t(
980
+ n && /* @__PURE__ */ t(
974
981
  "span",
975
982
  {
976
983
  role: "button",
977
984
  tabIndex: 0,
978
985
  onClick: (u) => {
979
- u.stopPropagation(), n();
986
+ u.stopPropagation(), r();
980
987
  },
981
988
  onKeyDown: (u) => {
982
- (u.key === "Enter" || u.key === " ") && (u.preventDefault(), u.stopPropagation(), n());
989
+ (u.key === "Enter" || u.key === " ") && (u.preventDefault(), u.stopPropagation(), r());
983
990
  },
984
991
  "aria-label": `Delete ${e.name}`,
985
992
  className: "flex h-6 w-6 items-center justify-center rounded-[3px] text-muted-foreground hover:bg-accent hover:text-foreground",
986
- children: /* @__PURE__ */ t(lt, { className: "h-3 w-3" })
993
+ children: /* @__PURE__ */ t(ut, { className: "h-3 w-3" })
987
994
  }
988
995
  ),
989
996
  /* @__PURE__ */ t(ga, { className: "h-3.5 w-3.5 text-muted-foreground" })
@@ -992,9 +999,9 @@ function Jn({
992
999
  }
993
1000
  );
994
1001
  }
995
- function Yn({ onCreate: e }) {
1002
+ function Xn({ onCreate: e }) {
996
1003
  return /* @__PURE__ */ i("div", { className: "flex h-full flex-col items-center justify-center gap-2 py-12 text-center", children: [
997
- /* @__PURE__ */ t("div", { className: "flex h-9 w-9 items-center justify-center rounded-full border border-border bg-muted/40 text-muted-foreground", children: /* @__PURE__ */ t(tr, { className: "h-4 w-4" }) }),
1004
+ /* @__PURE__ */ t("div", { className: "flex h-9 w-9 items-center justify-center rounded-full border border-border bg-muted/40 text-muted-foreground", children: /* @__PURE__ */ t(rr, { className: "h-4 w-4" }) }),
998
1005
  /* @__PURE__ */ t("div", { className: "text-[13px] font-medium text-foreground", children: "No groups yet" }),
999
1006
  /* @__PURE__ */ t("div", { className: "max-w-[320px] text-[11.5px] leading-[1.55] text-muted-foreground", children: "Groups let you grant shared access to dashboards. Create one and add members." }),
1000
1007
  /* @__PURE__ */ i(
@@ -1004,86 +1011,91 @@ function Yn({ onCreate: e }) {
1004
1011
  onClick: e,
1005
1012
  className: "mt-1 inline-flex h-7 items-center gap-1.5 rounded-[5px] bg-foreground px-2.5 text-[12px] font-medium text-background hover:opacity-90",
1006
1013
  children: [
1007
- /* @__PURE__ */ t(ee, { className: "h-3 w-3" }),
1014
+ /* @__PURE__ */ t(re, { className: "h-3 w-3" }),
1008
1015
  "New group"
1009
1016
  ]
1010
1017
  }
1011
1018
  )
1012
1019
  ] });
1013
1020
  }
1014
- function Xn({
1021
+ function Zn({
1015
1022
  group: e,
1016
- isTenantViewer: a,
1017
- isOwner: r,
1018
- onBack: n,
1019
- onMembersChanged: s,
1020
- onUpdated: u,
1021
- onRequestDelete: f
1023
+ isTenantViewer: n,
1024
+ canEdit: a,
1025
+ canDelete: r,
1026
+ canManageMembers: s,
1027
+ onBack: u,
1028
+ onMembersChanged: h,
1029
+ onUpdated: l,
1030
+ onRequestDelete: b
1022
1031
  }) {
1023
1032
  const {
1024
- data: l,
1025
- isLoading: b,
1026
- error: x,
1027
- refetch: m
1028
- } = fa(e.id), c = (l == null ? void 0 : l.members) || [], g = x ? gr(x, "Unable to load members for this group.") : null, p = e.type === "TENANT_GROUP" ? "tenant" : "organization", { users: h } = ha({
1029
- type: p,
1033
+ data: x,
1034
+ isLoading: p,
1035
+ error: c,
1036
+ refetch: f
1037
+ } = fa(e.id), m = (x == null ? void 0 : x.members) ?? Qn, g = c ? br(c, "Unable to load members for this group.") : null, o = e.type === "TENANT_GROUP" ? "tenant" : "organization", { users: y } = ha({
1038
+ type: o,
1030
1039
  tenantId: e.tenantId || void 0,
1031
1040
  active: !0,
1032
1041
  limit: 200
1033
- }), o = V(
1034
- () => new Set(c.map((v) => v.userId)),
1035
- [c]
1036
- ), y = Vn(), S = Kn(), D = jn(), [I, E] = w(!1), [k, te] = w(e.name), [re, Q] = w(!1), [W, J] = w(e.description || ""), [Y, he] = w(""), [ge, be] = w(!1), xe = V(() => {
1037
- const v = Y.trim().toLowerCase();
1038
- return h.filter((R) => !o.has(R.id)).filter(
1039
- (R) => !v || (R.name || "").toLowerCase().includes(v) || (R.email || "").toLowerCase().includes(v)
1042
+ }), S = V(
1043
+ () => new Set(m.map((v) => v.userId)),
1044
+ [m]
1045
+ ), C = Vn(), L = Kn(), E = jn(), [D, ae] = w(!1), [Q, ne] = w(e.name), [he, W] = w(!1), [J, Y] = w(e.description || ""), [X, ge] = w(""), [be, xe] = w(!1), ve = V(() => {
1046
+ const v = X.trim().toLowerCase();
1047
+ return y.filter((U) => !S.has(U.id)).filter(
1048
+ (U) => !v || (U.name || "").toLowerCase().includes(v) || (U.email || "").toLowerCase().includes(v)
1040
1049
  ).slice(0, 50);
1041
- }, [h, o, Y]), ve = async () => {
1042
- const v = k.trim();
1043
- if (E(!1), v.length >= 3 && v !== e.name)
1050
+ }, [y, S, X]), ye = async () => {
1051
+ const v = Q.trim();
1052
+ if (ae(!1), v.length >= 3 && v !== e.name)
1044
1053
  try {
1045
- await D.mutateAsync({
1054
+ await E.mutateAsync({
1046
1055
  groupId: e.id,
1047
1056
  data: { name: v }
1048
- }), u();
1057
+ }), l();
1049
1058
  } catch {
1050
1059
  }
1051
- }, ae = async () => {
1052
- const v = W.trim();
1053
- if (Q(!1), v !== (e.description || ""))
1060
+ }, B = async () => {
1061
+ const v = J.trim();
1062
+ if (W(!1), v !== (e.description || ""))
1054
1063
  try {
1055
- await D.mutateAsync({
1064
+ await E.mutateAsync({
1056
1065
  groupId: e.id,
1057
1066
  data: { description: v }
1058
- }), u();
1067
+ }), l();
1068
+ } catch {
1069
+ }
1070
+ }, Z = async (v) => {
1071
+ if (s) {
1072
+ ge(""), xe(!1);
1073
+ try {
1074
+ await C.mutateAsync({
1075
+ groupId: e.id,
1076
+ data: {
1077
+ userIds: [v.id],
1078
+ userType: o === "tenant" ? "tenant" : "org"
1079
+ }
1080
+ }), f(), h();
1059
1081
  } catch {
1060
1082
  }
1061
- }, $e = async (v) => {
1062
- he(""), be(!1);
1063
- try {
1064
- await y.mutateAsync({
1065
- groupId: e.id,
1066
- data: {
1067
- userIds: [v.id],
1068
- userType: p === "tenant" ? "tenant" : "org"
1069
- }
1070
- }), m(), s();
1071
- } catch {
1072
- }
1073
- }, X = async (v) => {
1074
- try {
1075
- await S.mutateAsync({
1076
- groupId: e.id,
1077
- data: { userIds: [v] }
1078
- }), m(), s();
1079
- } catch {
1080
1083
  }
1084
+ }, ee = async (v) => {
1085
+ if (s)
1086
+ try {
1087
+ await L.mutateAsync({
1088
+ groupId: e.id,
1089
+ data: { userIds: [v] }
1090
+ }), f(), h();
1091
+ } catch {
1092
+ }
1081
1093
  };
1082
- let T = "";
1094
+ let z = "";
1083
1095
  try {
1084
- T = nr(new Date(e.createdAt), "MMM d, yyyy");
1096
+ z = sr(new Date(e.createdAt), "MMM d, yyyy");
1085
1097
  } catch {
1086
- T = "";
1098
+ z = "";
1087
1099
  }
1088
1100
  return /* @__PURE__ */ i("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
1089
1101
  /* @__PURE__ */ i("div", { className: "flex h-10 shrink-0 items-center gap-1.5 border-b border-border px-5", children: [
@@ -1091,21 +1103,21 @@ function Xn({
1091
1103
  "button",
1092
1104
  {
1093
1105
  type: "button",
1094
- onClick: n,
1106
+ onClick: u,
1095
1107
  "aria-label": "Back",
1096
1108
  className: "-ml-1 flex h-6 w-6 items-center justify-center rounded-[3px] text-muted-foreground hover:bg-accent hover:text-foreground",
1097
- children: /* @__PURE__ */ t(Zt, { className: "h-3.5 w-3.5" })
1109
+ children: /* @__PURE__ */ t(er, { className: "h-3.5 w-3.5" })
1098
1110
  }
1099
1111
  ),
1100
- I ? /* @__PURE__ */ t(
1112
+ D ? /* @__PURE__ */ t(
1101
1113
  "input",
1102
1114
  {
1103
1115
  autoFocus: !0,
1104
- value: k,
1105
- onChange: (v) => te(v.target.value),
1106
- onBlur: ve,
1116
+ value: Q,
1117
+ onChange: (v) => ne(v.target.value),
1118
+ onBlur: ye,
1107
1119
  onKeyDown: (v) => {
1108
- v.key === "Enter" && ve(), v.key === "Escape" && (te(e.name), E(!1));
1120
+ v.key === "Enter" && ye(), v.key === "Escape" && (ne(e.name), ae(!1));
1109
1121
  },
1110
1122
  className: "h-6 min-w-0 flex-1 rounded-[3px] border border-border bg-background px-1.5 text-[13px] font-medium text-foreground focus:border-foreground/40 focus:outline-none"
1111
1123
  }
@@ -1114,32 +1126,32 @@ function Xn({
1114
1126
  {
1115
1127
  type: "button",
1116
1128
  onClick: () => {
1117
- r && (te(e.name), E(!0));
1129
+ a && (ne(e.name), ae(!0));
1118
1130
  },
1119
- title: r ? "Click to rename" : e.name,
1120
- disabled: !r,
1131
+ title: a ? "Click to rename" : e.name,
1132
+ disabled: !a,
1121
1133
  className: "truncate rounded-[3px] px-1 text-[13px] font-medium text-foreground enabled:hover:bg-accent disabled:cursor-default",
1122
1134
  children: e.name
1123
1135
  }
1124
1136
  ),
1125
1137
  /* @__PURE__ */ i("span", { className: "ml-1 inline-flex shrink-0 items-center gap-1 text-[10.5px] text-muted-foreground", children: [
1126
- /* @__PURE__ */ t(er, { className: "h-2.5 w-2.5" }),
1127
- c.length,
1138
+ /* @__PURE__ */ t(tr, { className: "h-2.5 w-2.5" }),
1139
+ m.length,
1128
1140
  " member",
1129
- c.length === 1 ? "" : "s"
1141
+ m.length === 1 ? "" : "s"
1130
1142
  ] })
1131
1143
  ] }),
1132
- /* @__PURE__ */ t("div", { className: "shrink-0 border-b border-border px-5 py-2.5", children: re ? /* @__PURE__ */ i("div", { children: [
1144
+ /* @__PURE__ */ t("div", { className: "shrink-0 border-b border-border px-5 py-2.5", children: he ? /* @__PURE__ */ i("div", { children: [
1133
1145
  /* @__PURE__ */ t(
1134
1146
  "textarea",
1135
1147
  {
1136
1148
  autoFocus: !0,
1137
1149
  rows: 2,
1138
- value: W,
1139
- onChange: (v) => J(v.target.value),
1150
+ value: J,
1151
+ onChange: (v) => Y(v.target.value),
1140
1152
  maxLength: 200,
1141
1153
  onKeyDown: (v) => {
1142
- v.key === "Escape" && (J(e.description || ""), Q(!1)), v.key === "Enter" && (v.metaKey || v.ctrlKey) && ae();
1154
+ v.key === "Escape" && (Y(e.description || ""), W(!1)), v.key === "Enter" && (v.metaKey || v.ctrlKey) && B();
1143
1155
  },
1144
1156
  placeholder: "What is this group for?",
1145
1157
  className: "block w-full resize-none rounded-[5px] border border-border bg-background px-2 py-1.5 text-[12px] text-foreground placeholder:text-muted-foreground focus:border-foreground/40 focus:outline-none"
@@ -1147,7 +1159,7 @@ function Xn({
1147
1159
  ),
1148
1160
  /* @__PURE__ */ i("div", { className: "mt-1.5 flex items-center justify-between", children: [
1149
1161
  /* @__PURE__ */ i("span", { className: "text-[10.5px] text-muted-foreground", children: [
1150
- W.length,
1162
+ J.length,
1151
1163
  "/200 · Esc to cancel · ⌘↩ to save"
1152
1164
  ] }),
1153
1165
  /* @__PURE__ */ i("div", { className: "flex items-center gap-1.5", children: [
@@ -1156,7 +1168,7 @@ function Xn({
1156
1168
  {
1157
1169
  type: "button",
1158
1170
  onClick: () => {
1159
- J(e.description || ""), Q(!1);
1171
+ Y(e.description || ""), W(!1);
1160
1172
  },
1161
1173
  className: "h-6 rounded-[5px] px-2 text-[11px] font-medium text-foreground/80 hover:bg-accent",
1162
1174
  children: "Cancel"
@@ -1166,7 +1178,7 @@ function Xn({
1166
1178
  "button",
1167
1179
  {
1168
1180
  type: "button",
1169
- onClick: ae,
1181
+ onClick: B,
1170
1182
  className: "inline-flex h-6 items-center rounded-[5px] bg-foreground px-2 text-[11px] font-medium text-background hover:opacity-90",
1171
1183
  children: "Save"
1172
1184
  }
@@ -1178,71 +1190,71 @@ function Xn({
1178
1190
  {
1179
1191
  type: "button",
1180
1192
  onClick: () => {
1181
- r && (J(e.description || ""), Q(!0));
1193
+ a && (Y(e.description || ""), W(!0));
1182
1194
  },
1183
- disabled: !r,
1184
- title: r ? "Click to edit description" : void 0,
1195
+ disabled: !a,
1196
+ title: a ? "Click to edit description" : void 0,
1185
1197
  className: "block w-full rounded-[3px] px-1 py-0.5 text-left enabled:hover:bg-accent/40 disabled:cursor-default",
1186
1198
  children: [
1187
- e.description ? /* @__PURE__ */ t("p", { className: "text-[12px] leading-[1.55] text-foreground/90", children: e.description }) : /* @__PURE__ */ t("p", { className: "text-[12px] leading-[1.55] text-muted-foreground", children: r ? "Add a description…" : "No description" }),
1199
+ e.description ? /* @__PURE__ */ t("p", { className: "text-[12px] leading-[1.55] text-foreground/90", children: e.description }) : /* @__PURE__ */ t("p", { className: "text-[12px] leading-[1.55] text-muted-foreground", children: a ? "Add a description…" : "No description" }),
1188
1200
  /* @__PURE__ */ i("p", { className: "mt-1 text-[10.5px] text-muted-foreground", children: [
1189
- T ? `Created ${T}` : "Recently created",
1190
- r ? " · You own this group" : ""
1201
+ z ? `Created ${z}` : "Recently created",
1202
+ a ? " · You can edit this group" : ""
1191
1203
  ] })
1192
1204
  ]
1193
1205
  }
1194
1206
  ) }),
1195
- /* @__PURE__ */ t(
1196
- es,
1207
+ s && /* @__PURE__ */ t(
1208
+ ts,
1197
1209
  {
1198
- query: Y,
1199
- setQuery: he,
1200
- open: ge,
1201
- setOpen: be,
1202
- candidates: xe,
1203
- showKindChip: !a,
1204
- onAdd: $e,
1205
- busy: y.isPending
1210
+ query: X,
1211
+ setQuery: ge,
1212
+ open: be,
1213
+ setOpen: xe,
1214
+ candidates: ve,
1215
+ showKindChip: !n,
1216
+ onAdd: Z,
1217
+ busy: C.isPending
1206
1218
  }
1207
1219
  ),
1208
- /* @__PURE__ */ t("div", { className: "flex-1 overflow-y-auto", children: b ? /* @__PURE__ */ t("div", { className: "space-y-px p-3", children: [1, 2, 3].map((v) => /* @__PURE__ */ t(
1220
+ /* @__PURE__ */ t("div", { className: "flex-1 overflow-y-auto", children: p ? /* @__PURE__ */ t("div", { className: "space-y-px p-3", children: [1, 2, 3].map((v) => /* @__PURE__ */ t(
1209
1221
  "div",
1210
1222
  {
1211
1223
  className: "h-10 animate-pulse rounded-[4px] bg-muted/60"
1212
1224
  },
1213
1225
  v
1214
1226
  )) }) : g ? /* @__PURE__ */ t(
1215
- br,
1227
+ xr,
1216
1228
  {
1217
1229
  title: "Can't load members",
1218
1230
  message: g,
1219
- onRetry: () => m()
1231
+ onRetry: () => f()
1220
1232
  }
1221
- ) : c.length === 0 ? /* @__PURE__ */ i("div", { className: "flex h-full flex-col items-center justify-center gap-1 py-10 text-center", children: [
1233
+ ) : m.length === 0 ? /* @__PURE__ */ i("div", { className: "flex h-full flex-col items-center justify-center gap-1 py-10 text-center", children: [
1222
1234
  /* @__PURE__ */ t("div", { className: "text-[12px] text-foreground", children: "No members yet" }),
1223
- /* @__PURE__ */ t("div", { className: "text-[11px] text-muted-foreground", children: "Search above to add people to this group." })
1224
- ] }) : c.map((v) => {
1225
- var R, z, ne, H, ye, we;
1235
+ /* @__PURE__ */ t("div", { className: "text-[11px] text-muted-foreground", children: s ? "Search above to add people to this group." : "This group does not have any members." })
1236
+ ] }) : m.map((v) => {
1237
+ var U, H, we, Ne, Se, A;
1226
1238
  return /* @__PURE__ */ i(
1227
1239
  "div",
1228
1240
  {
1229
1241
  className: "group flex items-center gap-2 border-b border-border/60 px-5 py-2",
1230
1242
  children: [
1231
- /* @__PURE__ */ t(xr, { name: ((R = v.user) == null ? void 0 : R.name) || ((z = v.user) == null ? void 0 : z.email) || "?" }),
1243
+ /* @__PURE__ */ t(vr, { name: ((U = v.user) == null ? void 0 : U.name) || ((H = v.user) == null ? void 0 : H.email) || "?" }),
1232
1244
  /* @__PURE__ */ i("div", { className: "min-w-0 flex-1", children: [
1233
- /* @__PURE__ */ t("div", { className: "truncate text-[12.5px] font-medium text-foreground", children: ((ne = v.user) == null ? void 0 : ne.name) || ((H = v.user) == null ? void 0 : H.email) || "Unknown" }),
1234
- ((ye = v.user) == null ? void 0 : ye.email) && v.user.name && /* @__PURE__ */ t("div", { className: "truncate text-[10.5px] text-muted-foreground", children: v.user.email })
1245
+ /* @__PURE__ */ t("div", { className: "truncate text-[12.5px] font-medium text-foreground", children: ((we = v.user) == null ? void 0 : we.name) || ((Ne = v.user) == null ? void 0 : Ne.email) || "Unknown" }),
1246
+ ((Se = v.user) == null ? void 0 : Se.email) && v.user.name && /* @__PURE__ */ t("div", { className: "truncate text-[10.5px] text-muted-foreground", children: v.user.email })
1235
1247
  ] }),
1236
- !a && /* @__PURE__ */ t("span", { className: "text-[10px] uppercase tracking-[0.06em] text-muted-foreground", children: v.userType }),
1248
+ !n && /* @__PURE__ */ t("span", { className: "text-[10px] uppercase tracking-[0.06em] text-muted-foreground", children: v.userType }),
1237
1249
  /* @__PURE__ */ t(
1238
1250
  "button",
1239
1251
  {
1240
1252
  type: "button",
1241
- onClick: () => X(v.userId),
1242
- disabled: S.isPending,
1243
- "aria-label": `Remove ${((we = v.user) == null ? void 0 : we.name) || "member"}`,
1253
+ onClick: () => ee(v.userId),
1254
+ disabled: !s || L.isPending,
1255
+ "aria-label": `Remove ${((A = v.user) == null ? void 0 : A.name) || "member"}`,
1244
1256
  className: "flex h-6 w-6 items-center justify-center rounded-[3px] text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-foreground group-hover:opacity-100 disabled:opacity-30",
1245
- children: /* @__PURE__ */ t(Kt, { className: "h-3 w-3" })
1257
+ children: /* @__PURE__ */ t(Qt, { className: "h-3 w-3" })
1246
1258
  }
1247
1259
  )
1248
1260
  ]
@@ -1254,47 +1266,47 @@ function Xn({
1254
1266
  "button",
1255
1267
  {
1256
1268
  type: "button",
1257
- onClick: f,
1269
+ onClick: b,
1258
1270
  className: "inline-flex h-7 items-center gap-1.5 rounded-[5px] border border-rose-200 bg-background px-2.5 text-[12px] font-medium text-rose-600 hover:bg-rose-50 dark:border-rose-900/60 dark:text-rose-400 dark:hover:bg-rose-950/30",
1259
1271
  children: [
1260
- /* @__PURE__ */ t(lt, { className: "h-3 w-3" }),
1272
+ /* @__PURE__ */ t(ut, { className: "h-3 w-3" }),
1261
1273
  "Delete group"
1262
1274
  ]
1263
1275
  }
1264
1276
  ) })
1265
1277
  ] });
1266
1278
  }
1267
- function Zn({
1279
+ function es({
1268
1280
  isTenantUser: e,
1269
- tenantId: a,
1270
- onCancel: r,
1271
- onCreated: n
1281
+ tenantId: n,
1282
+ onCancel: a,
1283
+ onCreated: r
1272
1284
  }) {
1273
- const [s, u] = w(""), [f, l] = w(""), [b, x] = w(null), m = Hn(), c = s.trim().length >= 3 && s.trim().length <= 50, g = async () => {
1285
+ const [s, u] = w(""), [h, l] = w(""), [b, x] = w(null), p = Hn(), c = s.trim().length >= 3 && s.trim().length <= 50, f = async () => {
1274
1286
  if (!c) return;
1275
1287
  x(null);
1276
- const p = {
1288
+ const m = {
1277
1289
  name: s.trim(),
1278
- description: f.trim() || void 0,
1290
+ description: h.trim() || void 0,
1279
1291
  type: e ? "TENANT_GROUP" : "ORG_GROUP",
1280
- ...e && a ? { tenantId: a } : {}
1292
+ ...e && n ? { tenantId: n } : {}
1281
1293
  };
1282
1294
  try {
1283
- const h = await m.mutateAsync(p), o = h == null ? void 0 : h.id;
1284
- o ? n(o) : r();
1285
- } catch (h) {
1286
- x(h instanceof Error ? h.message : "Failed to create group");
1295
+ const g = await p.mutateAsync(m), o = g == null ? void 0 : g.id;
1296
+ o ? r(o) : a();
1297
+ } catch (g) {
1298
+ x(g instanceof Error ? g.message : "Failed to create group");
1287
1299
  }
1288
1300
  };
1289
1301
  return /* @__PURE__ */ i("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
1290
1302
  /* @__PURE__ */ i("div", { className: "flex-1 overflow-y-auto px-5 py-4", children: [
1291
- /* @__PURE__ */ t(Ht, { children: "Name" }),
1303
+ /* @__PURE__ */ t(jt, { children: "Name" }),
1292
1304
  /* @__PURE__ */ t(
1293
1305
  "input",
1294
1306
  {
1295
1307
  autoFocus: !0,
1296
1308
  value: s,
1297
- onChange: (p) => u(p.target.value),
1309
+ onChange: (m) => u(m.target.value),
1298
1310
  placeholder: "Marketing leads, North America sales, …",
1299
1311
  maxLength: 50,
1300
1312
  className: "mt-1 block h-7 w-full rounded-[5px] border border-border bg-background px-2 text-[12px] text-foreground placeholder:text-muted-foreground focus:border-foreground/40 focus:outline-none"
@@ -1302,20 +1314,20 @@ function Zn({
1302
1314
  ),
1303
1315
  /* @__PURE__ */ t("div", { className: "mt-1 text-[10.5px] text-muted-foreground", children: "3–50 characters." }),
1304
1316
  /* @__PURE__ */ i("div", { className: "mt-4", children: [
1305
- /* @__PURE__ */ t(Ht, { children: "Description (optional)" }),
1317
+ /* @__PURE__ */ t(jt, { children: "Description (optional)" }),
1306
1318
  /* @__PURE__ */ t(
1307
1319
  "textarea",
1308
1320
  {
1309
1321
  rows: 2,
1310
- value: f,
1311
- onChange: (p) => l(p.target.value),
1322
+ value: h,
1323
+ onChange: (m) => l(m.target.value),
1312
1324
  maxLength: 200,
1313
1325
  placeholder: "What is this group for?",
1314
1326
  className: "mt-1 block w-full resize-none rounded-[5px] border border-border bg-background px-2 py-1.5 text-[12px] text-foreground placeholder:text-muted-foreground focus:border-foreground/40 focus:outline-none"
1315
1327
  }
1316
1328
  ),
1317
1329
  /* @__PURE__ */ i("div", { className: "mt-1 flex justify-end text-[10.5px] text-muted-foreground", children: [
1318
- f.length,
1330
+ h.length,
1319
1331
  "/200"
1320
1332
  ] })
1321
1333
  ] }),
@@ -1326,8 +1338,8 @@ function Zn({
1326
1338
  "button",
1327
1339
  {
1328
1340
  type: "button",
1329
- onClick: r,
1330
- disabled: m.isPending,
1341
+ onClick: a,
1342
+ disabled: p.isPending,
1331
1343
  className: "h-7 rounded-[5px] px-2.5 text-[12px] font-medium text-foreground/80 hover:bg-accent",
1332
1344
  children: "Cancel"
1333
1345
  }
@@ -1336,14 +1348,14 @@ function Zn({
1336
1348
  "button",
1337
1349
  {
1338
1350
  type: "button",
1339
- onClick: g,
1340
- disabled: !c || m.isPending,
1351
+ onClick: f,
1352
+ disabled: !c || p.isPending,
1341
1353
  className: "inline-flex h-7 items-center gap-1.5 rounded-[5px] bg-foreground px-2.5 text-[12px] font-medium text-background hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-60",
1342
- children: m.isPending ? /* @__PURE__ */ i(U, { children: [
1343
- /* @__PURE__ */ t(Te, { className: "h-3 w-3 animate-spin" }),
1354
+ children: p.isPending ? /* @__PURE__ */ i(R, { children: [
1355
+ /* @__PURE__ */ t($e, { className: "h-3 w-3 animate-spin" }),
1344
1356
  "Creating…"
1345
- ] }) : /* @__PURE__ */ i(U, { children: [
1346
- /* @__PURE__ */ t(ee, { className: "h-3 w-3" }),
1357
+ ] }) : /* @__PURE__ */ i(R, { children: [
1358
+ /* @__PURE__ */ t(re, { className: "h-3 w-3" }),
1347
1359
  "Create group"
1348
1360
  ] })
1349
1361
  }
@@ -1351,46 +1363,46 @@ function Zn({
1351
1363
  ] })
1352
1364
  ] });
1353
1365
  }
1354
- function es({
1366
+ function ts({
1355
1367
  query: e,
1356
- setQuery: a,
1357
- open: r,
1358
- setOpen: n,
1368
+ setQuery: n,
1369
+ open: a,
1370
+ setOpen: r,
1359
1371
  candidates: s,
1360
1372
  showKindChip: u,
1361
- onAdd: f,
1373
+ onAdd: h,
1362
1374
  busy: l
1363
1375
  }) {
1364
- const b = Ft(null), x = Ft(null), [m, c] = w(null);
1376
+ const b = $t(null), x = $t(null), [p, c] = w(null);
1365
1377
  Qa(() => {
1366
- if (!r) {
1378
+ if (!a) {
1367
1379
  c(null);
1368
1380
  return;
1369
1381
  }
1370
- const p = () => {
1371
- const h = b.current;
1372
- if (!h) return;
1373
- const o = h.getBoundingClientRect(), y = 240, D = window.innerHeight - o.bottom < y + 16 && o.top > y;
1382
+ const m = () => {
1383
+ const g = b.current;
1384
+ if (!g) return;
1385
+ const o = g.getBoundingClientRect(), y = 240, C = window.innerHeight - o.bottom < y + 16 && o.top > y;
1374
1386
  c({
1375
1387
  left: o.left,
1376
- top: D ? o.top - 6 : o.bottom + 6,
1388
+ top: C ? o.top - 6 : o.bottom + 6,
1377
1389
  width: o.width,
1378
- above: D
1390
+ above: C
1379
1391
  });
1380
1392
  };
1381
- return p(), window.addEventListener("resize", p), window.addEventListener("scroll", p, !0), () => {
1382
- window.removeEventListener("resize", p), window.removeEventListener("scroll", p, !0);
1393
+ return m(), window.addEventListener("resize", m), window.addEventListener("scroll", m, !0), () => {
1394
+ window.removeEventListener("resize", m), window.removeEventListener("scroll", m, !0);
1383
1395
  };
1384
- }, [r, s.length]), Fe(() => {
1385
- if (!r) return;
1386
- const p = (h) => {
1396
+ }, [a, s.length]), Ge(() => {
1397
+ if (!a) return;
1398
+ const m = (g) => {
1387
1399
  var y, S;
1388
- const o = h.target;
1389
- (y = b.current) != null && y.contains(o) || (S = x.current) != null && S.contains(o) || n(!1);
1400
+ const o = g.target;
1401
+ (y = b.current) != null && y.contains(o) || (S = x.current) != null && S.contains(o) || r(!1);
1390
1402
  };
1391
- return document.addEventListener("mousedown", p), () => document.removeEventListener("mousedown", p);
1392
- }, [r, n]);
1393
- const g = r && s.length > 0 && m;
1403
+ return document.addEventListener("mousedown", m), () => document.removeEventListener("mousedown", m);
1404
+ }, [a, r]);
1405
+ const f = a && s.length > 0 && p;
1394
1406
  return /* @__PURE__ */ i("div", { className: "shrink-0 border-b border-border px-5 py-2.5", children: [
1395
1407
  /* @__PURE__ */ i(
1396
1408
  "div",
@@ -1403,10 +1415,10 @@ function es({
1403
1415
  "input",
1404
1416
  {
1405
1417
  value: e,
1406
- onChange: (p) => {
1407
- a(p.target.value), n(!0);
1418
+ onChange: (m) => {
1419
+ n(m.target.value), r(!0);
1408
1420
  },
1409
- onFocus: () => n(!0),
1421
+ onFocus: () => r(!0),
1410
1422
  placeholder: "Add a member by name or email…",
1411
1423
  disabled: l,
1412
1424
  className: "h-7 flex-1 bg-transparent text-[12px] text-foreground placeholder:text-muted-foreground focus:outline-none disabled:cursor-not-allowed"
@@ -1415,35 +1427,35 @@ function es({
1415
1427
  ]
1416
1428
  }
1417
1429
  ),
1418
- g && typeof document < "u" && Ja(
1430
+ f && typeof document < "u" && Ja(
1419
1431
  /* @__PURE__ */ t(
1420
1432
  "div",
1421
1433
  {
1422
1434
  ref: x,
1423
1435
  style: {
1424
1436
  position: "fixed",
1425
- left: m.left,
1426
- top: m.top,
1427
- width: m.width,
1428
- transform: m.above ? "translateY(-100%)" : void 0
1437
+ left: p.left,
1438
+ top: p.top,
1439
+ width: p.width,
1440
+ transform: p.above ? "translateY(-100%)" : void 0
1429
1441
  },
1430
1442
  className: "z-[60] max-h-[240px] overflow-y-auto rounded-[5px] border border-border bg-background shadow-[0_8px_24px_-12px_rgba(0,0,0,0.18)]",
1431
- children: s.map((p) => /* @__PURE__ */ i(
1443
+ children: s.map((m) => /* @__PURE__ */ i(
1432
1444
  "button",
1433
1445
  {
1434
1446
  type: "button",
1435
- onClick: () => f(p),
1447
+ onClick: () => h(m),
1436
1448
  className: "flex w-full items-center gap-2 border-b border-border/60 px-2.5 py-2 text-left last:border-b-0 hover:bg-accent",
1437
1449
  children: [
1438
- /* @__PURE__ */ t(xr, { name: p.name || p.email || "?" }),
1450
+ /* @__PURE__ */ t(vr, { name: m.name || m.email || "?" }),
1439
1451
  /* @__PURE__ */ i("div", { className: "min-w-0 flex-1", children: [
1440
- /* @__PURE__ */ t("div", { className: "truncate text-[12px] font-medium text-foreground", children: p.name || p.email || "Unknown" }),
1441
- p.email && p.name && /* @__PURE__ */ t("div", { className: "truncate text-[10.5px] text-muted-foreground", children: p.email })
1452
+ /* @__PURE__ */ t("div", { className: "truncate text-[12px] font-medium text-foreground", children: m.name || m.email || "Unknown" }),
1453
+ m.email && m.name && /* @__PURE__ */ t("div", { className: "truncate text-[10.5px] text-muted-foreground", children: m.email })
1442
1454
  ] }),
1443
- u && p.type && /* @__PURE__ */ t("span", { className: "text-[10px] uppercase tracking-[0.06em] text-muted-foreground", children: p.type === "tenant" ? "tenant" : "org" })
1455
+ u && m.type && /* @__PURE__ */ t("span", { className: "text-[10px] uppercase tracking-[0.06em] text-muted-foreground", children: m.type === "tenant" ? "tenant" : "org" })
1444
1456
  ]
1445
1457
  },
1446
- p.id
1458
+ m.id
1447
1459
  ))
1448
1460
  }
1449
1461
  ),
@@ -1451,87 +1463,87 @@ function es({
1451
1463
  )
1452
1464
  ] });
1453
1465
  }
1454
- function gr(e, a) {
1455
- if (!e) return a;
1466
+ function br(e, n) {
1467
+ if (!e) return n;
1456
1468
  if (e instanceof Error) {
1457
- const r = e.message || "", n = r.match(/\{[\s\S]*"error"\s*:\s*"([^"]+)"[\s\S]*\}/);
1458
- return n ? n[1] : r || a;
1469
+ const a = e.message || "", r = a.match(/\{[\s\S]*"error"\s*:\s*"([^"]+)"[\s\S]*\}/);
1470
+ return r ? r[1] : a || n;
1459
1471
  }
1460
- return typeof e == "string" ? e : a;
1472
+ return typeof e == "string" ? e : n;
1461
1473
  }
1462
- function br({
1474
+ function xr({
1463
1475
  title: e,
1464
- message: a,
1465
- onRetry: r
1476
+ message: n,
1477
+ onRetry: a
1466
1478
  }) {
1467
1479
  return /* @__PURE__ */ i("div", { className: "flex h-full flex-col items-center justify-center gap-2 px-6 py-10 text-center", children: [
1468
1480
  /* @__PURE__ */ t("div", { className: "text-[12.5px] font-medium text-foreground", children: e }),
1469
- /* @__PURE__ */ t("div", { className: "max-w-[360px] text-[11.5px] leading-[1.55] text-muted-foreground", children: a }),
1470
- r && /* @__PURE__ */ t(
1481
+ /* @__PURE__ */ t("div", { className: "max-w-[360px] text-[11.5px] leading-[1.55] text-muted-foreground", children: n }),
1482
+ a && /* @__PURE__ */ t(
1471
1483
  "button",
1472
1484
  {
1473
1485
  type: "button",
1474
- onClick: r,
1486
+ onClick: a,
1475
1487
  className: "mt-1 inline-flex h-7 items-center rounded-[5px] border border-border bg-background px-2.5 text-[11.5px] font-medium text-foreground hover:bg-accent",
1476
1488
  children: "Try again"
1477
1489
  }
1478
1490
  )
1479
1491
  ] });
1480
1492
  }
1481
- function Ht({ children: e }) {
1493
+ function jt({ children: e }) {
1482
1494
  return /* @__PURE__ */ t("label", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: e });
1483
1495
  }
1484
- function xr({ name: e }) {
1485
- const a = e.split(" ").map((r) => r[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
1486
- return /* @__PURE__ */ t(fr, { className: "h-6 w-6 shrink-0", children: /* @__PURE__ */ t(hr, { className: "text-[9px] font-semibold", children: a || "?" }) });
1496
+ function vr({ name: e }) {
1497
+ const n = e.split(" ").map((a) => a[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
1498
+ return /* @__PURE__ */ t(hr, { className: "h-6 w-6 shrink-0", children: /* @__PURE__ */ t(gr, { className: "text-[9px] font-semibold", children: n || "?" }) });
1487
1499
  }
1488
- function ce(e, a, r) {
1489
- var u, f;
1490
- const n = (e.controls || []).find(
1491
- (l) => l.id === r
1500
+ function ce(e, n, a) {
1501
+ var u, h;
1502
+ const r = (e.controls || []).find(
1503
+ (l) => l.id === a
1492
1504
  );
1493
- if (n)
1494
- return n.label;
1495
- const s = (f = (u = Qt(e, a)) == null ? void 0 : u.controls) == null ? void 0 : f.find(
1496
- (l) => l.id === r
1505
+ if (r)
1506
+ return r.label;
1507
+ const s = (h = (u = Wt(e, n)) == null ? void 0 : u.controls) == null ? void 0 : h.find(
1508
+ (l) => l.id === a
1497
1509
  );
1498
- return (s == null ? void 0 : s.label) || r;
1510
+ return (s == null ? void 0 : s.label) || a;
1499
1511
  }
1500
- function le(e, a) {
1501
- var r;
1502
- return ((r = Qt(e, a)) == null ? void 0 : r.title) || a;
1512
+ function le(e, n) {
1513
+ var a;
1514
+ return ((a = Wt(e, n)) == null ? void 0 : a.title) || n;
1503
1515
  }
1504
- function ts(e) {
1505
- const { errors: a, dashboard: r } = e;
1506
- if (!r)
1507
- return a;
1508
- const n = /* @__PURE__ */ new Map();
1509
- for (const s of a) {
1516
+ function rs(e) {
1517
+ const { errors: n, dashboard: a } = e;
1518
+ if (!a)
1519
+ return n;
1520
+ const r = /* @__PURE__ */ new Map();
1521
+ for (const s of n) {
1510
1522
  const u = s.match(
1511
1523
  /^Card '(.+)' binding for control '(.+)' maps to missing metric '(.+)'\.$/
1512
1524
  );
1513
1525
  if (u) {
1514
- const [, m, c] = u, g = `${m}:${c}:missing-metric`;
1515
- n.has(g) || n.set(
1516
- g,
1517
- `"${le(r, m)}" has an outdated "${ce(
1518
- r,
1519
- m,
1526
+ const [, p, c] = u, f = `${p}:${c}:missing-metric`;
1527
+ r.has(f) || r.set(
1528
+ f,
1529
+ `"${le(a, p)}" has an outdated "${ce(
1530
+ a,
1531
+ p,
1520
1532
  c
1521
1533
  )}" mapping. Some choices still point to metrics that are no longer available on this card. Open the card controls and choose replacements.`
1522
1534
  );
1523
1535
  continue;
1524
1536
  }
1525
- const f = s.match(
1537
+ const h = s.match(
1526
1538
  /^Card '(.+)' binding for control '(.+)' maps to missing group-by field '(.+)'\.$/
1527
1539
  );
1528
- if (f) {
1529
- const [, m, c] = f, g = `${m}:${c}:missing-group-by`;
1530
- n.has(g) || n.set(
1531
- g,
1532
- `"${le(r, m)}" has an outdated "${ce(
1533
- r,
1534
- m,
1540
+ if (h) {
1541
+ const [, p, c] = h, f = `${p}:${c}:missing-group-by`;
1542
+ r.has(f) || r.set(
1543
+ f,
1544
+ `"${le(a, p)}" has an outdated "${ce(
1545
+ a,
1546
+ p,
1535
1547
  c
1536
1548
  )}" mapping. Some choices still point to fields that are no longer available on this card. Open the card controls and choose replacements.`
1537
1549
  );
@@ -1541,12 +1553,12 @@ function ts(e) {
1541
1553
  /^Card '(.+)' binding for control '(.+)' maps to an invalid metric target\.$/
1542
1554
  );
1543
1555
  if (l) {
1544
- const [, m, c] = l, g = `${m}:${c}:invalid-metric`;
1545
- n.has(g) || n.set(
1546
- g,
1547
- `"${le(r, m)}" has an invalid "${ce(
1548
- r,
1549
- m,
1556
+ const [, p, c] = l, f = `${p}:${c}:invalid-metric`;
1557
+ r.has(f) || r.set(
1558
+ f,
1559
+ `"${le(a, p)}" has an invalid "${ce(
1560
+ a,
1561
+ p,
1550
1562
  c
1551
1563
  )}" metric mapping. Open the card controls and choose a valid metric for each option.`
1552
1564
  );
@@ -1556,12 +1568,12 @@ function ts(e) {
1556
1568
  /^Card '(.+)' binding for control '(.+)' maps to an invalid group-by target\.$/
1557
1569
  );
1558
1570
  if (b) {
1559
- const [, m, c] = b, g = `${m}:${c}:invalid-group-by`;
1560
- n.has(g) || n.set(
1561
- g,
1562
- `"${le(r, m)}" has an invalid "${ce(
1563
- r,
1564
- m,
1571
+ const [, p, c] = b, f = `${p}:${c}:invalid-group-by`;
1572
+ r.has(f) || r.set(
1573
+ f,
1574
+ `"${le(a, p)}" has an invalid "${ce(
1575
+ a,
1576
+ p,
1565
1577
  c
1566
1578
  )}" field mapping. Open the card controls and choose a valid field for each option.`
1567
1579
  );
@@ -1571,65 +1583,65 @@ function ts(e) {
1571
1583
  /^Card '(.+)' binding for control '(.+)' requires at least one temporal group-by field\.$/
1572
1584
  );
1573
1585
  if (x) {
1574
- const [, m, c] = x, g = `${m}:${c}:missing-temporal-group-by`;
1575
- n.has(g) || n.set(
1576
- g,
1577
- `"${le(r, m)}" can no longer use "${ce(
1578
- r,
1579
- m,
1586
+ const [, p, c] = x, f = `${p}:${c}:missing-temporal-group-by`;
1587
+ r.has(f) || r.set(
1588
+ f,
1589
+ `"${le(a, p)}" can no longer use "${ce(
1590
+ a,
1591
+ p,
1580
1592
  c
1581
1593
  )}" for time grain because the card does not currently group by a date field.`
1582
1594
  );
1583
1595
  continue;
1584
1596
  }
1585
- n.set(s, s);
1597
+ r.set(s, s);
1586
1598
  }
1587
- return Array.from(n.values());
1599
+ return Array.from(r.values());
1588
1600
  }
1589
- function rs(e, a) {
1590
- return typeof e == "boolean" ? e : typeof a == "boolean" ? a : !0;
1601
+ function as(e, n) {
1602
+ return typeof e == "boolean" ? e : typeof n == "boolean" ? n : !0;
1591
1603
  }
1592
- function jt(e, a) {
1604
+ function qt(e, n) {
1593
1605
  return {
1594
- dashboard: nt(e),
1595
- semanticExecutionPayload: nt(a)
1606
+ dashboard: st(e),
1607
+ semanticExecutionPayload: st(n)
1596
1608
  };
1597
1609
  }
1598
- function xs() {
1599
- var kt, Et, Lt, It, Mt, At, Pt;
1610
+ function vs() {
1611
+ var Et, Lt, It, At, Mt, Pt, Ot;
1600
1612
  Xa(), Za();
1601
1613
  const {
1602
1614
  authToken: e,
1603
- tokenProps: a,
1604
- id: r,
1605
- showBriefings: n
1606
- } = B(), { isLocalDev: s } = ba(), { openBrandStudioPreview: u } = xa(), { permissions: f } = Ln(), l = va(), { isLoading: b } = ya(), x = N((d) => d.theme), m = N((d) => d.isDownloadingPdf), c = N(
1615
+ tokenProps: n,
1616
+ id: a,
1617
+ showBriefings: r
1618
+ } = G(), { isLocalDev: s } = ba(), { openBrandStudioPreview: u } = xa(), { permissions: h } = Ln(), l = va(), { isLoading: b } = ya(), x = N((d) => d.theme), p = N((d) => d.isDownloadingPdf), c = N(
1607
1619
  (d) => d.dashboardAssistantDraftScopeKey
1608
- ), g = N((d) => d.lenses), p = N((d) => d.selectedLensId), h = g == null ? void 0 : g.find((d) => d.id === p), o = N((d) => d.dashboard), y = N((d) => d.selectedSheetId), S = (kt = o == null ? void 0 : o.sheets) == null ? void 0 : kt.find(
1620
+ ), f = N((d) => d.lenses), m = N((d) => d.selectedLensId), g = f == null ? void 0 : f.find((d) => d.id === m), o = N((d) => d.dashboard), y = N((d) => d.selectedSheetId), S = (Et = o == null ? void 0 : o.sheets) == null ? void 0 : Et.find(
1609
1621
  (d) => d.id === y
1610
- ), D = Kr(S), I = D ? (Et = S == null ? void 0 : S.document) == null ? void 0 : Et.page : void 0, E = N(
1622
+ ), C = Kr(S), L = C ? (Lt = S == null ? void 0 : S.document) == null ? void 0 : Lt.page : void 0, E = N(
1611
1623
  (d) => d.isDashboardEditing
1612
- ), { setDashboardTitle: k } = N((d) => d.actions), [te, re] = w(!1), [Q, W] = w(!1), [J, Y] = w(!1), [he, ge] = w(!1), [be, xe] = w(!1), [ve, ae] = w(!1), [$e, X] = w(!1), [T, v] = w(null), [R, z] = w([]), [ne, H] = w(!1), ye = N((d) => d.isDashboardPanelOpen), we = N(
1624
+ ), { setDashboardTitle: D } = N((d) => d.actions), [ae, Q] = w(!1), [ne, he] = w(!1), [W, J] = w(!1), [Y, X] = w(!1), [ge, be] = w(!1), [xe, ve] = w(!1), [ye, B] = w(!1), [Z, ee] = w(null), [z, v] = w([]), [U, H] = w(!1), we = N((d) => d.isDashboardPanelOpen), Ne = N(
1613
1625
  (d) => d.actions.setIsDashboardPanelOpen
1614
- ), vr = N((d) => d.filterValues), A = N((d) => d.isVisualEditing);
1615
- Ot((d) => d.card);
1616
- const se = Oe(
1626
+ ), Se = N((d) => d.filterValues), A = N((d) => d.isVisualEditing);
1627
+ Rt((d) => d.card);
1628
+ const se = Ue(
1617
1629
  (d) => d.selectedDashboard
1618
- ), Ne = Oe(
1630
+ ), De = Ue(
1619
1631
  (d) => d.initialDashboard
1620
1632
  );
1621
- Oe((d) => d.selectedVisual), N((d) => d.selectedFrameId), Ot((d) => d.frame);
1622
- const Se = se ? (It = se == null ? void 0 : se.permissions) == null ? void 0 : It.canEdit : (Lt = Ne == null ? void 0 : Ne.permissions) == null ? void 0 : Lt.canEdit, pt = N(
1633
+ Ue((d) => d.selectedVisual), N((d) => d.selectedFrameId), Rt((d) => d.frame);
1634
+ const Ce = se ? (At = se == null ? void 0 : se.permissions) == null ? void 0 : At.canEdit : (It = De == null ? void 0 : De.permissions) == null ? void 0 : It.canEdit, ft = N(
1623
1635
  (d) => d.showDashboardJSON
1624
- ), Ge = N((d) => d.onSaveFunction), {
1625
- setIsDashboardEditing: ft,
1626
- setShowDashboardJSON: ht
1627
- } = N((d) => d.actions), { setInitialDashboard: gt, clearSelectedDashboard: Be } = Oe(
1636
+ ), Be = N((d) => d.onSaveFunction), {
1637
+ setIsDashboardEditing: ht,
1638
+ setShowDashboardJSON: gt
1639
+ } = N((d) => d.actions), { setInitialDashboard: bt, clearSelectedDashboard: ze } = Ue(
1628
1640
  (d) => d.actions
1629
- ), { resources: De } = wa(Je.DASHBOARD), { data: ze } = Na(), yr = ((Mt = ze == null ? void 0 : ze.preference) == null ? void 0 : Mt.defaultDashboardId) || null, { mutate: wr, isPending: Nr } = Sa(), { currentUser: Sr } = ct(), Dr = Da(Sr), F = se || Ne, bt = F ? {
1630
- id: F.id,
1631
- title: (o == null ? void 0 : o.title) || F.title || "Dashboard"
1632
- } : null, { handleAddNewFrame: Cr } = Ca(), [He, je] = w(!1), [kr, oe] = w(!1), [qe, Ce] = w("close"), ie = ka(Je.DASHBOARD), [_, ke] = w(null), Er = async (d, M) => {
1641
+ ), { resources: ke } = wa(Ye.DASHBOARD), { data: He } = Na(), yr = ((Mt = He == null ? void 0 : He.preference) == null ? void 0 : Mt.defaultDashboardId) || null, { mutate: wr, isPending: Nr } = Sa(), { currentUser: Sr } = lt(), Dr = Da(Sr), T = se || De, xt = T ? {
1642
+ id: T.id,
1643
+ title: (o == null ? void 0 : o.title) || T.title || "Dashboard"
1644
+ } : null, { handleAddNewFrame: Cr } = Ca(), [je, qe] = w(!1), [kr, oe] = w(!1), [Ve, Ee] = w("close"), ie = ka(Ye.DASHBOARD), [O, Le] = w(null), Er = async (d, M) => {
1633
1645
  if (!(o != null && o.id)) {
1634
1646
  console.log("No dashboard ID found");
1635
1647
  return;
@@ -1645,106 +1657,106 @@ function xs() {
1645
1657
  },
1646
1658
  {
1647
1659
  onSuccess: () => {
1648
- console.log("Dashboard title updated successfully"), C.success("Dashboard title updated");
1660
+ console.log("Dashboard title updated successfully"), k.success("Dashboard title updated");
1649
1661
  },
1650
- onError: ($) => {
1651
- console.error("Failed to update dashboard title:", $), C.error("Failed to update dashboard title"), k(M);
1662
+ onError: (F) => {
1663
+ console.error("Failed to update dashboard title:", F), k.error("Failed to update dashboard title"), D(M);
1652
1664
  }
1653
1665
  }
1654
1666
  );
1655
1667
  };
1656
- Fe(() => {
1657
- if (De && De.length > 0) {
1668
+ Ge(() => {
1669
+ if (ke && ke.length > 0) {
1658
1670
  const d = o == null ? void 0 : o.id;
1659
1671
  if (d) {
1660
- const M = De.find(
1661
- ($) => $.id === d
1672
+ const M = ke.find(
1673
+ (F) => F.id === d
1662
1674
  );
1663
- M && gt(M);
1675
+ M && bt(M);
1664
1676
  }
1665
1677
  }
1666
- }, [De, o == null ? void 0 : o.id, gt]);
1667
- const de = a.orgUserId || a.tenantId, Ve = V(
1668
- () => as({
1678
+ }, [ke, o == null ? void 0 : o.id, bt]);
1679
+ const de = n.orgUserId || n.tenantId, Ke = V(
1680
+ () => ns({
1669
1681
  accessToken: e == null ? void 0 : e.accessToken,
1670
- dashboardId: (o == null ? void 0 : o.id) || r || a.dashboard_id,
1671
- selectedSheetId: D ? y : void 0,
1672
- pageSize: I == null ? void 0 : I.size,
1673
- orientation: I == null ? void 0 : I.orientation,
1682
+ dashboardId: (o == null ? void 0 : o.id) || a || n.dashboard_id,
1683
+ selectedSheetId: C ? y : void 0,
1684
+ pageSize: L == null ? void 0 : L.size,
1685
+ orientation: L == null ? void 0 : L.orientation,
1674
1686
  theme: x
1675
1687
  }),
1676
1688
  [
1677
1689
  e == null ? void 0 : e.accessToken,
1678
- r,
1690
+ a,
1679
1691
  o == null ? void 0 : o.id,
1680
- D,
1681
- I == null ? void 0 : I.orientation,
1682
- I == null ? void 0 : I.size,
1692
+ C,
1693
+ L == null ? void 0 : L.orientation,
1694
+ L == null ? void 0 : L.size,
1683
1695
  y,
1684
1696
  x,
1685
- a.dashboard_id
1697
+ n.dashboard_id
1686
1698
  ]
1687
- ), xt = E && !A && de && Se, { setDashboard: vt } = N((d) => d.actions), yt = N(
1699
+ ), vt = E && !A && de && Ce, { setDashboard: yt } = N((d) => d.actions), wt = N(
1688
1700
  (d) => d.semanticExecutionPayload
1689
1701
  ), Lr = () => {
1690
- ft(!0);
1691
- }, Ke = () => {
1692
- ft(!1), ht(!1), ke(null);
1702
+ ht(!0);
1703
+ }, Qe = () => {
1704
+ ht(!1), gt(!1), Le(null);
1693
1705
  };
1694
- Fe(() => {
1706
+ Ge(() => {
1695
1707
  if (!E) {
1696
- _ && ke(null);
1708
+ O && Le(null);
1697
1709
  return;
1698
1710
  }
1699
- _ || !o || b || ke(
1700
- jt(
1711
+ O || !o || b || Le(
1712
+ qt(
1701
1713
  o,
1702
- yt
1714
+ wt
1703
1715
  )
1704
1716
  );
1705
1717
  }, [
1706
1718
  o,
1707
- _,
1719
+ O,
1708
1720
  E,
1709
1721
  b,
1710
- yt
1722
+ wt
1711
1723
  ]);
1712
- const Ee = (_ == null ? void 0 : _.dashboard) ?? null, { isDirty: wt, isDirtyPending: Ir, resetDirty: Le } = cn(
1724
+ const Ie = (O == null ? void 0 : O.dashboard) ?? null, { isDirty: Nt, isDirtyPending: Ir, resetDirty: Ae } = cn(
1713
1725
  o,
1714
- Ee,
1726
+ Ie,
1715
1727
  300,
1716
1728
  1e3,
1717
- Xe
1718
- ), Nt = Wa(() => Ee ? Xe(o) !== Xe(Ee) : !1, [o, Ee]), St = wt || Ir, Ie = He || ie.isPending, Mr = () => {
1719
- Nt() ? (Ce("close"), oe(!0)) : (Ke(), Le());
1720
- }, Ar = async () => {
1721
- await Qe({
1729
+ Ze
1730
+ ), St = Wa(() => Ie ? Ze(o) !== Ze(Ie) : !1, [o, Ie]), Dt = Nt || Ir, Me = je || ie.isPending, Ar = () => {
1731
+ St() ? (Ee("close"), oe(!0)) : (Qe(), Ae());
1732
+ }, Mr = async () => {
1733
+ await We({
1722
1734
  closeAfterSave: !0,
1723
- navigateHomeAfterSave: qe === "home"
1735
+ navigateHomeAfterSave: Ve === "home"
1724
1736
  });
1725
1737
  }, Pr = () => {
1726
- _ && vt(_.dashboard, {
1727
- semanticExecutionPayload: _.semanticExecutionPayload
1728
- }), Ke(), qe === "home" && Be(), Ce("close"), oe(!1), Le();
1729
- }, _r = () => {
1730
- _ && (vt(_.dashboard, {
1731
- semanticExecutionPayload: _.semanticExecutionPayload
1732
- }), Le());
1738
+ O && yt(O.dashboard, {
1739
+ semanticExecutionPayload: O.semanticExecutionPayload
1740
+ }), Qe(), Ve === "home" && ze(), Ee("close"), oe(!1), Ae();
1733
1741
  }, Or = () => {
1734
- if (E && Nt()) {
1735
- Ce("home"), oe(!0);
1742
+ O && (yt(O.dashboard, {
1743
+ semanticExecutionPayload: O.semanticExecutionPayload
1744
+ }), Ae());
1745
+ }, _r = () => {
1746
+ if (E && St()) {
1747
+ Ee("home"), oe(!0);
1736
1748
  return;
1737
1749
  }
1738
- Be();
1750
+ ze();
1739
1751
  };
1740
- async function Qe(d) {
1752
+ async function We(d) {
1741
1753
  const M = N.getState().dashboard;
1742
1754
  if (!M)
1743
1755
  return;
1744
- const $ = (d == null ? void 0 : d.closeAfterSave) ?? ne, Gr = (d == null ? void 0 : d.navigateHomeAfterSave) ?? !1;
1745
- H($), $ && oe(!1);
1746
- const Br = nt(M);
1747
- X(!0), v(null), z([]), je(!0);
1756
+ const F = (d == null ? void 0 : d.closeAfterSave) ?? U, Gr = (d == null ? void 0 : d.navigateHomeAfterSave) ?? !1;
1757
+ H(F), F && oe(!1);
1758
+ const Br = st(M);
1759
+ B(!0), ee(null), v([]), qe(!0);
1748
1760
  const zr = {
1749
1761
  template: M
1750
1762
  };
@@ -1755,69 +1767,69 @@ function xs() {
1755
1767
  },
1756
1768
  {
1757
1769
  onSuccess: (P) => {
1758
- var Ae, Pe, _t;
1759
- const q = (P == null ? void 0 : P.id) || ((Ae = P == null ? void 0 : P.dashboard) == null ? void 0 : Ae.id) || ((Pe = P == null ? void 0 : P.resource) == null ? void 0 : Pe.id) || ((_t = P == null ? void 0 : P.template) == null ? void 0 : _t.id) || null;
1770
+ var Oe, _e, _t;
1771
+ const q = (P == null ? void 0 : P.id) || ((Oe = P == null ? void 0 : P.dashboard) == null ? void 0 : Oe.id) || ((_e = P == null ? void 0 : P.resource) == null ? void 0 : _e.id) || ((_t = P == null ? void 0 : P.template) == null ? void 0 : _t.id) || null;
1760
1772
  if (!M.id && q) {
1761
- const We = Zr.getState(), _e = We.pendingDashboardDraftMigration;
1762
- (_e == null ? void 0 : _e.scopeKey) === c ? We.actions.setPendingDashboardDraftMigrationExpectedDashboardId(
1773
+ const Je = Zr.getState(), Re = Je.pendingDashboardDraftMigration;
1774
+ (Re == null ? void 0 : Re.scopeKey) === c ? Je.actions.setPendingDashboardDraftMigrationExpectedDashboardId(
1763
1775
  q
1764
- ) : _e && We.actions.clearPendingDashboardDraftMigration();
1776
+ ) : Re && Je.actions.clearPendingDashboardDraftMigration();
1765
1777
  }
1766
- je(!1), C.success("Dashboard saved!"), ke(
1767
- jt(
1778
+ qe(!1), k.success("Dashboard saved!"), Le(
1779
+ qt(
1768
1780
  Br,
1769
1781
  N.getState().semanticExecutionPayload
1770
1782
  )
1771
- ), X(!1), H(!1), $ && (Ke(), Le(), Gr && Be()), Ce("close");
1783
+ ), B(!1), H(!1), F && (Qe(), Ae(), Gr && ze()), Ee("close");
1772
1784
  },
1773
1785
  onError: (P) => {
1774
- je(!1), v("Failed to save dashboard. Please try again.");
1775
- const q = P.details, Ae = Array.isArray(
1786
+ qe(!1), ee("Failed to save dashboard. Please try again.");
1787
+ const q = P.details, Oe = Array.isArray(
1776
1788
  q == null ? void 0 : q.errors
1777
1789
  ) ? (q.errors || []).filter(
1778
- (Pe) => typeof Pe == "string"
1790
+ (_e) => typeof _e == "string"
1779
1791
  ) : [];
1780
- z(
1781
- ts({
1782
- errors: Ae,
1792
+ v(
1793
+ rs({
1794
+ errors: Oe,
1783
1795
  dashboard: M || void 0
1784
1796
  })
1785
- ), C.error("Failed to save dashboard");
1797
+ ), k.error("Failed to save dashboard");
1786
1798
  }
1787
1799
  }
1788
1800
  );
1789
1801
  }
1790
- async function Ur() {
1791
- if (re(!0), !p || !h) return;
1802
+ async function Rr() {
1803
+ if (Q(!0), !m || !g) return;
1792
1804
  const d = N.getState().dashboard;
1793
1805
  if (!d) {
1794
- re(!1);
1806
+ Q(!1);
1795
1807
  return;
1796
1808
  }
1797
- const M = JSON.stringify(d), $ = {
1798
- ...h,
1809
+ const M = JSON.stringify(d), F = {
1810
+ ...g,
1799
1811
  template: M,
1800
- filterValues: vr
1812
+ filterValues: Se
1801
1813
  };
1802
- await ot(
1803
- a.apiServiceUrl,
1804
- $,
1814
+ await it(
1815
+ n.apiServiceUrl,
1816
+ F,
1805
1817
  e == null ? void 0 : e.accessToken
1806
- ), C.success("Lens saved"), Ge == null || Ge(d), re(!1);
1818
+ ), k.success("Lens saved"), Be == null || Be(d), Q(!1);
1807
1819
  }
1808
- const Dt = (h == null ? void 0 : h.name) || o.title;
1820
+ const Ct = (g == null ? void 0 : g.name) || o.title;
1809
1821
  ie.isPending && console.log("Title during update:", {
1810
- title: Dt,
1822
+ title: Ct,
1811
1823
  dashboardStateTitle: o.title,
1812
1824
  dashboardId: o == null ? void 0 : o.id,
1813
- currentLensName: h == null ? void 0 : h.name
1825
+ currentLensName: g == null ? void 0 : g.name
1814
1826
  });
1815
- const Ct = a.orgUserId || a.tenantId && a.endUserId && a.endUserEmail, Rr = !!Ct && !!(e != null && e.accessToken) && !!(a != null && a.apiServiceUrl), Tr = l, j = (o == null ? void 0 : o.id) || null, Fr = rs(
1816
- (At = a.config) == null ? void 0 : At.showBriefings,
1817
- n
1818
- ), Me = !!j && yr === j, $r = () => {
1827
+ const kt = n.orgUserId || n.tenantId && n.endUserId && n.endUserEmail, Ur = !!kt && !!(e != null && e.accessToken) && !!(n != null && n.apiServiceUrl), Tr = l, j = (o == null ? void 0 : o.id) || null, Fr = as(
1828
+ (Pt = n.config) == null ? void 0 : Pt.showBriefings,
1829
+ r
1830
+ ), Pe = !!j && yr === j, $r = () => {
1819
1831
  j && wr({
1820
- dashboardId: Me ? null : j
1832
+ dashboardId: Pe ? null : j
1821
1833
  });
1822
1834
  };
1823
1835
  return /* @__PURE__ */ i(
@@ -1827,14 +1839,14 @@ function xs() {
1827
1839
  role: "dashboard-controls",
1828
1840
  children: [
1829
1841
  /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
1830
- Ct && /* @__PURE__ */ i(U, { children: [
1842
+ kt && /* @__PURE__ */ i(R, { children: [
1831
1843
  /* @__PURE__ */ t(
1832
- Ye,
1844
+ Xe,
1833
1845
  {
1834
1846
  "aria-label": "Manage Dashboards",
1835
1847
  tooltip: "Manage Dashboards",
1836
1848
  onClick: () => {
1837
- we(!ye);
1849
+ Ne(!we);
1838
1850
  },
1839
1851
  className: "h-7 w-7 px-0",
1840
1852
  buttonProps: { size: "xs" },
@@ -1842,14 +1854,14 @@ function xs() {
1842
1854
  }
1843
1855
  ),
1844
1856
  Tr && !A && /* @__PURE__ */ t(
1845
- Ye,
1857
+ Xe,
1846
1858
  {
1847
1859
  "aria-label": "Dashboard Hub",
1848
1860
  tooltip: "Dashboard Hub",
1849
- onClick: Or,
1861
+ onClick: _r,
1850
1862
  className: "h-7 w-7 px-0",
1851
1863
  buttonProps: { size: "xs" },
1852
- children: /* @__PURE__ */ t(Yt, { className: "h-3.5 w-3.5" })
1864
+ children: /* @__PURE__ */ t(Xt, { className: "h-3.5 w-3.5" })
1853
1865
  }
1854
1866
  )
1855
1867
  ] }),
@@ -1861,63 +1873,63 @@ function xs() {
1861
1873
  role: "status",
1862
1874
  children: /* @__PURE__ */ t("span", { className: "sr-only", children: "Loading dashboard title" })
1863
1875
  }
1864
- ) : /* @__PURE__ */ i(U, { children: [
1876
+ ) : /* @__PURE__ */ i(R, { children: [
1865
1877
  /* @__PURE__ */ t(
1866
1878
  Ea,
1867
1879
  {
1868
- value: Dt || "Untitled Dashboard",
1880
+ value: Ct || "Untitled Dashboard",
1869
1881
  onSave: (d) => {
1870
1882
  console.log("EditableText onSave called:", {
1871
1883
  newTitle: d,
1872
- canEditDashboard: Se,
1884
+ canEditDashboard: Ce,
1873
1885
  dashboardId: o == null ? void 0 : o.id
1874
1886
  });
1875
1887
  const M = (o == null ? void 0 : o.title) || "";
1876
- k(d), Er(d, M);
1888
+ D(d), Er(d, M);
1877
1889
  },
1878
- isEditable: Se && !h,
1890
+ isEditable: Ce && !g,
1879
1891
  displayClassName: "text-[13px] font-medium",
1880
1892
  inputClassName: "text-[13px] font-medium",
1881
1893
  placeholder: "Dashboard Title",
1882
1894
  isPending: ie.isPending
1883
1895
  }
1884
1896
  ),
1885
- Rr && j && /* @__PURE__ */ t(Qr, { children: /* @__PURE__ */ i(Wr, { children: [
1897
+ Ur && j && /* @__PURE__ */ t(Qr, { children: /* @__PURE__ */ i(Wr, { children: [
1886
1898
  /* @__PURE__ */ t(Jr, { asChild: !0, children: /* @__PURE__ */ t(
1887
- O,
1899
+ _,
1888
1900
  {
1889
1901
  variant: "ghost",
1890
1902
  size: "xs",
1891
1903
  onClick: $r,
1892
- disabled: Nr || !(e != null && e.accessToken) || !(a != null && a.apiServiceUrl),
1904
+ disabled: Nr || !(e != null && e.accessToken) || !(n != null && n.apiServiceUrl),
1893
1905
  className: "w-7 px-0",
1894
- "aria-label": Me ? "Remove as default dashboard" : "Make this a default dashboard",
1906
+ "aria-label": Pe ? "Remove as default dashboard" : "Make this a default dashboard",
1895
1907
  children: /* @__PURE__ */ t(
1896
1908
  La,
1897
1909
  {
1898
- className: Z(
1910
+ className: te(
1899
1911
  "h-3.5 w-3.5 transition-colors",
1900
- Me ? "fill-foreground text-foreground" : "text-muted-foreground hover:text-foreground"
1912
+ Pe ? "fill-foreground text-foreground" : "text-muted-foreground hover:text-foreground"
1901
1913
  )
1902
1914
  }
1903
1915
  )
1904
1916
  }
1905
1917
  ) }),
1906
- /* @__PURE__ */ t(Yr, { children: /* @__PURE__ */ t("p", { children: Me ? "Remove as default dashboard" : "Make this a default dashboard" }) })
1918
+ /* @__PURE__ */ t(Yr, { children: /* @__PURE__ */ t("p", { children: Pe ? "Remove as default dashboard" : "Make this a default dashboard" }) })
1907
1919
  ] }) })
1908
1920
  ] }))
1909
1921
  ] }),
1910
1922
  /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
1911
- A && /* @__PURE__ */ i(U, { children: [
1923
+ A && /* @__PURE__ */ i(R, { children: [
1912
1924
  /* @__PURE__ */ t(en, {}),
1913
1925
  /* @__PURE__ */ t(tn, {})
1914
1926
  ] }),
1915
- !A && l && ((Pt = F == null ? void 0 : F.permissions) == null ? void 0 : Pt.canShare) && /* @__PURE__ */ i(
1916
- O,
1927
+ !A && l && ((Ot = T == null ? void 0 : T.permissions) == null ? void 0 : Ot.canShare) && /* @__PURE__ */ i(
1928
+ _,
1917
1929
  {
1918
1930
  variant: "outline",
1919
1931
  size: "xs",
1920
- onClick: () => W(!0),
1932
+ onClick: () => he(!0),
1921
1933
  children: [
1922
1934
  /* @__PURE__ */ t(Ia, { className: "h-3.5 w-3.5" }),
1923
1935
  "Share"
@@ -1928,75 +1940,75 @@ function xs() {
1928
1940
  rn,
1929
1941
  {
1930
1942
  dashboardId: j,
1931
- dashboardTitle: (o == null ? void 0 : o.title) || (F == null ? void 0 : F.title)
1943
+ dashboardTitle: (o == null ? void 0 : o.title) || (T == null ? void 0 : T.title)
1932
1944
  }
1933
1945
  ),
1934
- !A && E && f.canUseFilters && l && /* @__PURE__ */ t(an, {}),
1935
- E && !A && de && h && s && l && /* @__PURE__ */ i(
1936
- O,
1946
+ !A && E && h.canUseFilters && l && /* @__PURE__ */ t(an, {}),
1947
+ E && !A && de && g && s && l && /* @__PURE__ */ i(
1948
+ _,
1937
1949
  {
1938
1950
  variant: "secondary",
1939
1951
  size: "xs",
1940
- disabled: te,
1941
- onClick: Ur,
1952
+ disabled: ae,
1953
+ onClick: Rr,
1942
1954
  children: [
1943
- /* @__PURE__ */ t($t, { className: "h-3.5 w-3.5" }),
1955
+ /* @__PURE__ */ t(Gt, { className: "h-3.5 w-3.5" }),
1944
1956
  "Save Lens"
1945
1957
  ]
1946
1958
  }
1947
1959
  ),
1948
- E && !A && l && !D && /* @__PURE__ */ i(
1949
- O,
1960
+ E && !A && l && !C && /* @__PURE__ */ i(
1961
+ _,
1950
1962
  {
1951
1963
  variant: "outline",
1952
1964
  size: "xs",
1953
1965
  disabled: !E,
1954
1966
  onClick: () => Cr(),
1955
1967
  children: [
1956
- /* @__PURE__ */ t(ee, { className: "h-3.5 w-3.5" }),
1968
+ /* @__PURE__ */ t(re, { className: "h-3.5 w-3.5" }),
1957
1969
  "Visual"
1958
1970
  ]
1959
1971
  }
1960
1972
  ),
1961
- !A && !E && Se && l && /* @__PURE__ */ i(O, { size: "xs", onClick: Lr, children: [
1962
- /* @__PURE__ */ t(Ma, { className: "h-3.5 w-3.5" }),
1973
+ !A && !E && Ce && l && /* @__PURE__ */ i(_, { size: "xs", onClick: Lr, children: [
1974
+ /* @__PURE__ */ t(Aa, { className: "h-3.5 w-3.5" }),
1963
1975
  "Edit"
1964
1976
  ] }),
1965
- xt && l && wt && /* @__PURE__ */ i(
1966
- O,
1977
+ vt && l && Nt && /* @__PURE__ */ i(
1978
+ _,
1967
1979
  {
1968
1980
  variant: "outline",
1969
1981
  size: "xs",
1970
- onClick: _r,
1971
- disabled: Ie,
1982
+ onClick: Or,
1983
+ disabled: Me,
1972
1984
  children: [
1973
1985
  /* @__PURE__ */ t(nn, { className: "h-3.5 w-3.5" }),
1974
1986
  "Undo"
1975
1987
  ]
1976
1988
  }
1977
1989
  ),
1978
- xt && l && /* @__PURE__ */ i(
1979
- O,
1990
+ vt && l && /* @__PURE__ */ i(
1991
+ _,
1980
1992
  {
1981
1993
  size: "xs",
1982
- className: Z(!St && "opacity-60"),
1983
- disabled: Ie || !St,
1984
- onClick: () => Qe(),
1994
+ className: te(!Dt && "opacity-60"),
1995
+ disabled: Me || !Dt,
1996
+ onClick: () => We(),
1985
1997
  children: [
1986
- Ie ? /* @__PURE__ */ t(Te, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ t($t, { className: "h-3.5 w-3.5" }),
1987
- Ie ? "Saving..." : "Save"
1998
+ Me ? /* @__PURE__ */ t($e, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ t(Gt, { className: "h-3.5 w-3.5" }),
1999
+ Me ? "Saving..." : "Save"
1988
2000
  ]
1989
2001
  }
1990
2002
  ),
1991
- E && !A && l && /* @__PURE__ */ i(O, { variant: "outline", size: "xs", onClick: Mr, children: [
1992
- /* @__PURE__ */ t(Xt, { className: "h-3.5 w-3.5" }),
2003
+ E && !A && l && /* @__PURE__ */ i(_, { variant: "outline", size: "xs", onClick: Ar, children: [
2004
+ /* @__PURE__ */ t(Zt, { className: "h-3.5 w-3.5" }),
1993
2005
  "Close"
1994
2006
  ] }),
1995
2007
  !A && l && /* @__PURE__ */ t("div", { className: "ml-2", children: /* @__PURE__ */ t(sn, {}) }),
1996
2008
  !A && s && /* @__PURE__ */ t(Nn, {}),
1997
- !A && l && /* @__PURE__ */ i(Aa, { children: [
2009
+ !A && l && /* @__PURE__ */ i(Ma, { children: [
1998
2010
  /* @__PURE__ */ t(Pa, { asChild: !0, children: /* @__PURE__ */ t(
1999
- Ye,
2011
+ Xe,
2000
2012
  {
2001
2013
  tooltip: "More Options",
2002
2014
  className: "w-7 px-0 text-muted-foreground hover:text-foreground",
@@ -2005,122 +2017,122 @@ function xs() {
2005
2017
  variant: "ghost",
2006
2018
  "aria-label": "More dashboard options"
2007
2019
  },
2008
- children: /* @__PURE__ */ t(_a, { className: "h-3.5 w-3.5" })
2020
+ children: /* @__PURE__ */ t(Oa, { className: "h-3.5 w-3.5" })
2009
2021
  }
2010
2022
  ) }),
2011
2023
  /* @__PURE__ */ i(
2012
- Oa,
2024
+ _a,
2013
2025
  {
2014
2026
  align: "end",
2015
2027
  className: "w-56 rounded-control border border-border/60 p-1 shadow-sm",
2016
2028
  children: [
2017
2029
  /* @__PURE__ */ t(ue, { children: "Reports" }),
2018
2030
  /* @__PURE__ */ i(
2019
- G,
2031
+ $,
2020
2032
  {
2021
- disabled: m,
2022
- onSelect: () => ae(!0),
2033
+ disabled: p,
2034
+ onSelect: () => ve(!0),
2023
2035
  children: [
2024
- /* @__PURE__ */ t(Ua, { className: "h-3.5 w-3.5" }),
2036
+ /* @__PURE__ */ t(Ra, { className: "h-3.5 w-3.5" }),
2025
2037
  "Export"
2026
2038
  ]
2027
2039
  }
2028
2040
  ),
2029
- /* @__PURE__ */ t(Re, {}),
2030
- Dr && /* @__PURE__ */ i(U, { children: [
2041
+ /* @__PURE__ */ t(Fe, {}),
2042
+ Dr && /* @__PURE__ */ i(R, { children: [
2031
2043
  /* @__PURE__ */ t(ue, { children: "Access" }),
2032
2044
  /* @__PURE__ */ i(
2033
- G,
2045
+ $,
2034
2046
  {
2035
- onClick: () => Y(!0),
2047
+ onClick: () => J(!0),
2036
2048
  children: [
2037
- /* @__PURE__ */ t(tr, { className: "h-3.5 w-3.5" }),
2049
+ /* @__PURE__ */ t(rr, { className: "h-3.5 w-3.5" }),
2038
2050
  "Manage Groups"
2039
2051
  ]
2040
2052
  }
2041
2053
  ),
2042
- /* @__PURE__ */ t(Re, {})
2054
+ /* @__PURE__ */ t(Fe, {})
2043
2055
  ] }),
2044
2056
  /* @__PURE__ */ t(ue, { children: "Preferences" }),
2045
- /* @__PURE__ */ i(G, { onClick: () => ge(!0), children: [
2046
- /* @__PURE__ */ t(rr, { className: "h-3.5 w-3.5" }),
2057
+ /* @__PURE__ */ i($, { onClick: () => X(!0), children: [
2058
+ /* @__PURE__ */ t(ar, { className: "h-3.5 w-3.5" }),
2047
2059
  "Calendar Preferences"
2048
2060
  ] }),
2049
- s && l && /* @__PURE__ */ i(U, { children: [
2050
- /* @__PURE__ */ t(Re, {}),
2061
+ s && l && /* @__PURE__ */ i(R, { children: [
2062
+ /* @__PURE__ */ t(Fe, {}),
2051
2063
  /* @__PURE__ */ t(ue, { children: "Developer" }),
2052
2064
  /* @__PURE__ */ i(
2053
- G,
2065
+ $,
2054
2066
  {
2055
2067
  onSelect: () => {
2056
2068
  var d;
2057
2069
  e != null && e.accessToken && ((d = navigator == null ? void 0 : navigator.clipboard) != null && d.writeText ? navigator.clipboard.writeText(e.accessToken).then(
2058
- () => C.success("Token copied to clipboard")
2059
- ).catch(() => C.error("Unable to copy token")) : C.error("Clipboard not available"));
2070
+ () => k.success("Token copied to clipboard")
2071
+ ).catch(() => k.error("Unable to copy token")) : k.error("Clipboard not available"));
2060
2072
  },
2061
2073
  children: [
2062
- /* @__PURE__ */ t(Rt, { className: "h-3.5 w-3.5" }),
2074
+ /* @__PURE__ */ t(Tt, { className: "h-3.5 w-3.5" }),
2063
2075
  "Copy token"
2064
2076
  ]
2065
2077
  }
2066
2078
  ),
2067
- D && /* @__PURE__ */ i(
2068
- G,
2079
+ C && /* @__PURE__ */ i(
2080
+ $,
2069
2081
  {
2070
- disabled: !Ve,
2082
+ disabled: !Ke,
2071
2083
  onSelect: () => {
2072
2084
  var d;
2073
- if (!Ve) {
2074
- C.error(
2085
+ if (!Ke) {
2086
+ k.error(
2075
2087
  "Open a document sheet with a token to copy the local PDF URL"
2076
2088
  );
2077
2089
  return;
2078
2090
  }
2079
- (d = navigator == null ? void 0 : navigator.clipboard) != null && d.writeText ? navigator.clipboard.writeText(Ve).then(
2080
- () => C.success(
2091
+ (d = navigator == null ? void 0 : navigator.clipboard) != null && d.writeText ? navigator.clipboard.writeText(Ke).then(
2092
+ () => k.success(
2081
2093
  "Local document PDF URL copied to clipboard"
2082
2094
  )
2083
2095
  ).catch(
2084
- () => C.error(
2096
+ () => k.error(
2085
2097
  "Unable to copy local document PDF URL"
2086
2098
  )
2087
- ) : C.error("Clipboard not available");
2099
+ ) : k.error("Clipboard not available");
2088
2100
  },
2089
2101
  children: [
2090
- /* @__PURE__ */ t(Rt, { className: "h-3.5 w-3.5" }),
2102
+ /* @__PURE__ */ t(Tt, { className: "h-3.5 w-3.5" }),
2091
2103
  "Copy local document PDF URL"
2092
2104
  ]
2093
2105
  }
2094
2106
  ),
2095
2107
  /* @__PURE__ */ i(
2096
- G,
2108
+ $,
2097
2109
  {
2098
- onSelect: () => Xr(a.apiServiceUrl),
2110
+ onSelect: () => Xr(n.apiServiceUrl),
2099
2111
  children: [
2100
2112
  /* @__PURE__ */ t(gn, { className: "h-3.5 w-3.5" }),
2101
2113
  "Invalidate token"
2102
2114
  ]
2103
2115
  }
2104
2116
  ),
2105
- /* @__PURE__ */ i(G, { onSelect: u, children: [
2117
+ /* @__PURE__ */ i($, { onSelect: u, children: [
2106
2118
  /* @__PURE__ */ t(ln, { className: "h-3.5 w-3.5" }),
2107
2119
  "Brand Studio"
2108
2120
  ] }),
2109
2121
  E && /* @__PURE__ */ i(
2110
- G,
2122
+ $,
2111
2123
  {
2112
- onSelect: () => ht(!pt),
2124
+ onSelect: () => gt(!ft),
2113
2125
  children: [
2114
2126
  /* @__PURE__ */ t(un, { className: "h-3.5 w-3.5" }),
2115
- pt ? "Hide dashboard JSON" : "Show dashboard JSON"
2127
+ ft ? "Hide dashboard JSON" : "Show dashboard JSON"
2116
2128
  ]
2117
2129
  }
2118
2130
  ),
2119
- de && E && /* @__PURE__ */ i(G, { onSelect: () => xe(!0), children: [
2120
- /* @__PURE__ */ t(ee, { className: "h-3.5 w-3.5" }),
2131
+ de && E && /* @__PURE__ */ i($, { onSelect: () => be(!0), children: [
2132
+ /* @__PURE__ */ t(re, { className: "h-3.5 w-3.5" }),
2121
2133
  "Add lens"
2122
2134
  ] }),
2123
- de && /* @__PURE__ */ i(Ra, { children: [
2135
+ de && /* @__PURE__ */ i(Ua, { children: [
2124
2136
  /* @__PURE__ */ i(Ta, { children: [
2125
2137
  /* @__PURE__ */ t(mn, { className: "h-3.5 w-3.5" }),
2126
2138
  "Lenses"
@@ -2132,76 +2144,76 @@ function xs() {
2132
2144
  }
2133
2145
  )
2134
2146
  ] }),
2135
- Q && bt && /* @__PURE__ */ t(
2147
+ ne && xt && /* @__PURE__ */ t(
2136
2148
  $a,
2137
2149
  {
2138
- resource: bt,
2139
- resourceType: Je.DASHBOARD,
2140
- onClose: () => W(!1)
2150
+ resource: xt,
2151
+ resourceType: Ye.DASHBOARD,
2152
+ onClose: () => he(!1)
2141
2153
  }
2142
2154
  ),
2143
2155
  /* @__PURE__ */ t(
2144
- Qn,
2156
+ Wn,
2145
2157
  {
2146
- open: J,
2147
- onOpenChange: Y
2158
+ open: W,
2159
+ onOpenChange: J
2148
2160
  }
2149
2161
  ),
2150
2162
  /* @__PURE__ */ t(
2151
2163
  dn,
2152
2164
  {
2153
- open: he,
2154
- onOpenChange: ge
2165
+ open: Y,
2166
+ onOpenChange: X
2155
2167
  }
2156
2168
  ),
2157
- s && de && l && /* @__PURE__ */ t(kn, { open: be, onOpenChange: xe }),
2169
+ s && de && l && /* @__PURE__ */ t(kn, { open: ge, onOpenChange: be }),
2158
2170
  l && /* @__PURE__ */ t(
2159
2171
  Ga,
2160
2172
  {
2161
- open: ve,
2162
- onOpenChange: ae
2173
+ open: xe,
2174
+ onOpenChange: ve
2163
2175
  }
2164
2176
  ),
2165
2177
  /* @__PURE__ */ t(
2166
2178
  Ba,
2167
2179
  {
2168
- open: $e,
2180
+ open: ye,
2169
2181
  onOpenChange: (d) => {
2170
- !d && He && !T || (X(d), d || (v(null), z([]), H(!1)));
2182
+ !d && je && !Z || (B(d), d || (ee(null), v([]), H(!1)));
2171
2183
  },
2172
2184
  children: /* @__PURE__ */ i(za, { className: "max-w-sm", children: [
2173
2185
  /* @__PURE__ */ i(Ha, { children: [
2174
- /* @__PURE__ */ t(ja, { children: T ? "Save failed" : "Saving dashboard" }),
2175
- /* @__PURE__ */ t(qa, { className: "pt-2", children: T ? "We could not save the dashboard. Please try again." : "Please wait while we save your changes." }),
2176
- R.length > 0 && /* @__PURE__ */ i("div", { className: "space-y-1 rounded-md border border-destructive/20 bg-destructive/5 p-3 text-left", children: [
2186
+ /* @__PURE__ */ t(ja, { children: Z ? "Save failed" : "Saving dashboard" }),
2187
+ /* @__PURE__ */ t(qa, { className: "pt-2", children: Z ? "We could not save the dashboard. Please try again." : "Please wait while we save your changes." }),
2188
+ z.length > 0 && /* @__PURE__ */ i("div", { className: "space-y-1 rounded-md border border-destructive/20 bg-destructive/5 p-3 text-left", children: [
2177
2189
  /* @__PURE__ */ t("div", { className: "text-sm font-medium text-destructive", children: "What needs attention" }),
2178
- /* @__PURE__ */ t("ul", { className: "list-disc space-y-1 pl-4 text-xs text-muted-foreground", children: R.slice(0, 5).map((d) => /* @__PURE__ */ t("li", { children: d }, d)) })
2190
+ /* @__PURE__ */ t("ul", { className: "list-disc space-y-1 pl-4 text-xs text-muted-foreground", children: z.slice(0, 5).map((d) => /* @__PURE__ */ t("li", { children: d }, d)) })
2179
2191
  ] })
2180
2192
  ] }),
2181
- /* @__PURE__ */ t(Va, { className: "flex-col gap-2 sm:flex-row sm:justify-end", children: T ? /* @__PURE__ */ i(U, { children: [
2193
+ /* @__PURE__ */ t(Va, { className: "flex-col gap-2 sm:flex-row sm:justify-end", children: Z ? /* @__PURE__ */ i(R, { children: [
2182
2194
  /* @__PURE__ */ t(
2183
2195
  Ka,
2184
2196
  {
2185
2197
  onClick: () => {
2186
- X(!1), v(null), z([]), H(!1);
2198
+ B(!1), ee(null), v([]), H(!1);
2187
2199
  },
2188
2200
  className: "m-0",
2189
2201
  children: "Close"
2190
2202
  }
2191
2203
  ),
2192
2204
  /* @__PURE__ */ t(
2193
- Tt,
2205
+ Ft,
2194
2206
  {
2195
- onClick: () => Qe({
2196
- closeAfterSave: ne,
2197
- navigateHomeAfterSave: qe === "home"
2207
+ onClick: () => We({
2208
+ closeAfterSave: U,
2209
+ navigateHomeAfterSave: Ve === "home"
2198
2210
  }),
2199
2211
  className: "m-0",
2200
2212
  children: "Retry"
2201
2213
  }
2202
2214
  )
2203
- ] }) : /* @__PURE__ */ i(Tt, { disabled: !0, className: "m-0 cursor-default", children: [
2204
- /* @__PURE__ */ t(Te, { className: "mr-2 h-4 w-4 animate-spin" }),
2215
+ ] }) : /* @__PURE__ */ i(Ft, { disabled: !0, className: "m-0 cursor-default", children: [
2216
+ /* @__PURE__ */ t($e, { className: "mr-2 h-4 w-4 animate-spin" }),
2205
2217
  "Saving..."
2206
2218
  ] }) })
2207
2219
  ] })
@@ -2214,9 +2226,9 @@ function xs() {
2214
2226
  onOpenChange: (d) => {
2215
2227
  oe(d);
2216
2228
  },
2217
- onSave: Ar,
2229
+ onSave: Mr,
2218
2230
  onDiscard: Pr,
2219
- isSaving: He,
2231
+ isSaving: je,
2220
2232
  saveLabel: "Save",
2221
2233
  discardLabel: "Discard"
2222
2234
  }
@@ -2226,21 +2238,21 @@ function xs() {
2226
2238
  }
2227
2239
  );
2228
2240
  }
2229
- function as({
2241
+ function ns({
2230
2242
  accessToken: e,
2231
- dashboardId: a,
2232
- selectedSheetId: r,
2233
- pageSize: n,
2243
+ dashboardId: n,
2244
+ selectedSheetId: a,
2245
+ pageSize: r,
2234
2246
  orientation: s,
2235
2247
  theme: u
2236
2248
  }) {
2237
- if (!e || !r)
2249
+ if (!e || !a)
2238
2250
  return null;
2239
- const f = new URL("http://localhost:5173/print-document");
2240
- f.searchParams.set("token", e), a && f.searchParams.set("dashboardId", a), f.searchParams.set("selectedSheetId", r), u && f.searchParams.set("theme", u);
2251
+ const h = new URL("http://localhost:5173/print-document");
2252
+ h.searchParams.set("token", e), n && h.searchParams.set("dashboardId", n), h.searchParams.set("selectedSheetId", a), u && h.searchParams.set("theme", u);
2241
2253
  const l = new URL("http://127.0.0.1:3002/");
2242
- return l.searchParams.set("pdfMode", "document"), l.searchParams.set("pageSize", n || "letter"), l.searchParams.set("orientation", s || "portrait"), l.searchParams.set("url", f.toString()), l.toString();
2254
+ return l.searchParams.set("pdfMode", "document"), l.searchParams.set("pageSize", r || "letter"), l.searchParams.set("orientation", s || "portrait"), l.searchParams.set("url", h.toString()), l.toString();
2243
2255
  }
2244
2256
  export {
2245
- xs as default
2257
+ vs as default
2246
2258
  };