react-semaphor 0.1.435 → 0.1.436

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