react-semaphor 0.1.315 → 0.1.316

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 (46) hide show
  1. package/dist/brand-studio/index.js +65 -65
  2. package/dist/briefings/index.cjs +1 -0
  3. package/dist/briefings/index.js +848 -0
  4. package/dist/chunks/{braces-CWi8x9ww.js → braces-CDPz6CF2.js} +1 -1
  5. package/dist/chunks/{calendar-preferences-dialog-B3JYKgek.js → calendar-preferences-dialog-9NlFzHX8.js} +3 -3
  6. package/dist/chunks/{calendar-preferences-dialog-aODuCeYE.js → calendar-preferences-dialog-BDdxi7Xm.js} +1 -1
  7. package/dist/chunks/{chevrons-up-down-B2viXO2I.js → chevrons-up-down-BsdQRmJL.js} +1 -1
  8. package/dist/chunks/dashboard-briefing-launcher-5fM_KJoT.js +7321 -0
  9. package/dist/chunks/dashboard-briefing-launcher-CVxLt10p.js +96 -0
  10. package/dist/chunks/dashboard-controls-9YV-D1tD.js +2009 -0
  11. package/dist/chunks/dashboard-controls-UR_m0wD1.js +57 -0
  12. package/dist/chunks/{dashboard-json-zKDTezgS.js → dashboard-json-CKPID8Am.js} +2 -2
  13. package/dist/chunks/{dashboard-json-Duea3KSa.js → dashboard-json-ws4tortP.js} +1 -1
  14. package/dist/chunks/edit-dashboard-visual-CmxnZI8I.js +178 -0
  15. package/dist/chunks/{edit-dashboard-visual-MZCJaPiq.js → edit-dashboard-visual-ifKJLMTS.js} +807 -822
  16. package/dist/chunks/index-Xdag_85e.js +1298 -0
  17. package/dist/chunks/{index-CjRLHvSp.js → index-gcA9Rs35.js} +41203 -46487
  18. package/dist/chunks/{palette-CIuwlEiG.js → palette-BlxLchHy.js} +1 -1
  19. package/dist/chunks/{resource-management-panel-CM3Zsk9H.js → resource-management-panel-BduJanWW.js} +1 -1
  20. package/dist/chunks/{resource-management-panel-S0LXyguo.js → resource-management-panel-paSAzVj2.js} +81 -81
  21. package/dist/chunks/{save-_ALpoMy6.js → save-DVRQBMeb.js} +1 -1
  22. package/dist/chunks/{switch-B6fh8nb-.js → switch-sauemjyY.js} +199 -199
  23. package/dist/chunks/{use-create-flow-overlay-state-Cp7PYD-t.js → use-create-flow-overlay-state-DKV6tIc5.js} +254 -225
  24. package/dist/chunks/use-create-flow-overlay-state-DWnzVVlP.js +26 -0
  25. package/dist/chunks/{use-visual-utils-DDd0pAJ_.js → use-visual-utils-C8PDxg2w.js} +1 -1
  26. package/dist/chunks/{use-visual-utils-D9DsvP1v.js → use-visual-utils-Cs0-baCK.js} +48 -48
  27. package/dist/dashboard/index.cjs +1 -1
  28. package/dist/dashboard/index.js +1 -1
  29. package/dist/index.cjs +1 -1
  30. package/dist/index.js +232 -485
  31. package/dist/style.css +1 -1
  32. package/dist/surfboard/index.cjs +1 -1
  33. package/dist/surfboard/index.js +2 -2
  34. package/dist/types/briefings.d.ts +240 -0
  35. package/dist/types/dashboard.d.ts +1 -0
  36. package/dist/types/main.d.ts +619 -1017
  37. package/dist/types/surfboard.d.ts +1 -0
  38. package/dist/types/types.d.ts +411 -261
  39. package/package.json +7 -2
  40. package/dist/chunks/dashboard-controls-CSunAZVx.js +0 -57
  41. package/dist/chunks/dashboard-controls-jvJF-AJC.js +0 -2021
  42. package/dist/chunks/dashboard-filter-controls-launcher-B0i9xSZZ.js +0 -11
  43. package/dist/chunks/dashboard-filter-controls-launcher-DG6yRPmx.js +0 -1540
  44. package/dist/chunks/edit-dashboard-visual-QjRIAadP.js +0 -183
  45. package/dist/chunks/index-B7C8qBWC.js +0 -1330
  46. package/dist/chunks/use-create-flow-overlay-state-CqTBDwBF.js +0 -16
@@ -0,0 +1,2009 @@
1
+ import { jsx as e, jsxs as o, Fragment as O } from "react/jsx-runtime";
2
+ import { c as B, u as S, B as k, az as la, E as Za, L as Xe, a1 as ie, a as Y, aA as Pe, aB as es, aC as as, $ as Zs, f as X, aD as et, aE as at, aF as Ze, T as ss, J as ts, K as ke, N as Ie, M as ea, aG as rs, aH as st, G as qa, Y as tt, Z as rt, _ as nt, a0 as ot, j as it, aI as ct } from "./switch-sauemjyY.js";
3
+ import { be as lt, u as j, b as da, bf as dt, al as aa, c as ua, d as ma, e as ha, f as ns, n as ut, bg as oe, au as Ae, bh as mt, bi as Ba, bj as os, bk as is, bl as ht, aL as pa, bm as pt, bn as ft, bo as gt, bp as bt, bq as vt, br as yt, ac as Oe, bs as Te, o as M, bt as xt, bu as St, bv as Nt, aP as sa, bw as ta, at as fa, av as cs, b2 as ls, bx as wt, aC as ds, aD as us, aE as ms, aF as hs, aG as ps, aH as fs, aI as gs, aJ as ra, ak as Dt, by as Ct, bz as Et, y as Lt, x as Le, J as Mt, z as Ke, bA as At, bB as kt, bC as It, Y as Pt, bD as Ot, I as Qe, bE as Tt, bF as _t, bG as Ut, bH as Rt, am as Gt, an as Ft, ao as $t, ap as zt, aq as z, bI as Ht, ax as qt, ar as ja, bJ as Bt, bK as jt, bL as Vt, H as Kt, bM as Qt, v as na } from "./index-gcA9Rs35.js";
4
+ import * as I from "react";
5
+ import bs, { useState as x, useMemo as q, useEffect as Va, useCallback as Jt } from "react";
6
+ import "./index-CJdxSyQq.js";
7
+ import "react-dom";
8
+ import { b as Wt, u as Yt, A as Xt, V as Zt, J as er, e as ar, N as sr, U as tr } from "./dashboard-briefing-launcher-5fM_KJoT.js";
9
+ import { d as rr } from "./index-DFOb_6HB.js";
10
+ import { C as nr } from "./calendar-preferences-dialog-9NlFzHX8.js";
11
+ import { u as or } from "./use-debounced-dirty-check-BwAbnX_5.js";
12
+ import { s as Je } from "./normalize-dashboard-for-dirty-check-5KpZN8xr.js";
13
+ import { S as Ka } from "./save-DVRQBMeb.js";
14
+ import { P as ir } from "./palette-BlxLchHy.js";
15
+ import { B as cr } from "./braces-CDPz6CF2.js";
16
+ /**
17
+ * @license lucide-react v0.453.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */
22
+ const lr = B("Glasses", [
23
+ ["circle", { cx: "6", cy: "15", r: "4", key: "vux9w4" }],
24
+ ["circle", { cx: "18", cy: "15", r: "4", key: "18o8ve" }],
25
+ ["path", { d: "M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2", key: "1ag4bs" }],
26
+ ["path", { d: "M2.5 13 5 7c.7-1.3 1.4-2 3-2", key: "1hm1gs" }],
27
+ ["path", { d: "M21.5 13 19 7c-.7-1.3-1.5-2-3-2", key: "1r31ai" }]
28
+ ]);
29
+ /**
30
+ * @license lucide-react v0.453.0 - ISC
31
+ *
32
+ * This source code is licensed under the ISC license.
33
+ * See the LICENSE file in the root directory of this source tree.
34
+ */
35
+ const dr = B("Menu", [
36
+ ["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }],
37
+ ["line", { x1: "4", x2: "20", y1: "6", y2: "6", key: "1owob3" }],
38
+ ["line", { x1: "4", x2: "20", y1: "18", y2: "18", key: "yk5zj1" }]
39
+ ]);
40
+ /**
41
+ * @license lucide-react v0.453.0 - ISC
42
+ *
43
+ * This source code is licensed under the ISC license.
44
+ * See the LICENSE file in the root directory of this source tree.
45
+ */
46
+ const ur = B("Monitor", [
47
+ ["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2", key: "48i651" }],
48
+ ["line", { x1: "8", x2: "16", y1: "21", y2: "21", key: "1svkeh" }],
49
+ ["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
50
+ ]);
51
+ /**
52
+ * @license lucide-react v0.453.0 - ISC
53
+ *
54
+ * This source code is licensed under the ISC license.
55
+ * See the LICENSE file in the root directory of this source tree.
56
+ */
57
+ const mr = B("Moon", [
58
+ ["path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z", key: "a7tn18" }]
59
+ ]);
60
+ /**
61
+ * @license lucide-react v0.453.0 - ISC
62
+ *
63
+ * This source code is licensed under the ISC license.
64
+ * See the LICENSE file in the root directory of this source tree.
65
+ */
66
+ const hr = B("ShieldX", [
67
+ [
68
+ "path",
69
+ {
70
+ d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
71
+ key: "oel41y"
72
+ }
73
+ ],
74
+ ["path", { d: "m14.5 9.5-5 5", key: "17q4r4" }],
75
+ ["path", { d: "m9.5 9.5 5 5", key: "18nt4w" }]
76
+ ]);
77
+ /**
78
+ * @license lucide-react v0.453.0 - ISC
79
+ *
80
+ * This source code is licensed under the ISC license.
81
+ * See the LICENSE file in the root directory of this source tree.
82
+ */
83
+ const pr = B("Sun", [
84
+ ["circle", { cx: "12", cy: "12", r: "4", key: "4exip2" }],
85
+ ["path", { d: "M12 2v2", key: "tus03m" }],
86
+ ["path", { d: "M12 20v2", key: "1lh1kg" }],
87
+ ["path", { d: "m4.93 4.93 1.41 1.41", key: "149t6j" }],
88
+ ["path", { d: "m17.66 17.66 1.41 1.41", key: "ptbguv" }],
89
+ ["path", { d: "M2 12h2", key: "1t8f8n" }],
90
+ ["path", { d: "M20 12h2", key: "1q8mjw" }],
91
+ ["path", { d: "m6.34 17.66-1.41 1.41", key: "1m8zz5" }],
92
+ ["path", { d: "m19.07 4.93-1.41 1.41", key: "1shlcs" }]
93
+ ]);
94
+ /**
95
+ * @license lucide-react v0.453.0 - ISC
96
+ *
97
+ * This source code is licensed under the ISC license.
98
+ * See the LICENSE file in the root directory of this source tree.
99
+ */
100
+ const fr = B("Undo2", [
101
+ ["path", { d: "M9 14 4 9l5-5", key: "102s5s" }],
102
+ ["path", { d: "M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11", key: "f3b9sd" }]
103
+ ]);
104
+ /**
105
+ * @license lucide-react v0.453.0 - ISC
106
+ *
107
+ * This source code is licensed under the ISC license.
108
+ * See the LICENSE file in the root directory of this source tree.
109
+ */
110
+ const oa = B("UserPlus", [
111
+ ["path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2", key: "1yyitq" }],
112
+ ["circle", { cx: "9", cy: "7", r: "4", key: "nufk8" }],
113
+ ["line", { x1: "19", x2: "19", y1: "8", y2: "14", key: "1bvyxn" }],
114
+ ["line", { x1: "22", x2: "16", y1: "11", y2: "11", key: "1shjgl" }]
115
+ ]);
116
+ var ia = { exports: {} }, We = {};
117
+ /**
118
+ * @license React
119
+ * use-sync-external-store-shim.production.js
120
+ *
121
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
122
+ *
123
+ * This source code is licensed under the MIT license found in the
124
+ * LICENSE file in the root directory of this source tree.
125
+ */
126
+ var Qa;
127
+ function gr() {
128
+ if (Qa) return We;
129
+ Qa = 1;
130
+ var a = bs;
131
+ function t(p, h) {
132
+ return p === h && (p !== 0 || 1 / p === 1 / h) || p !== p && h !== h;
133
+ }
134
+ var r = typeof Object.is == "function" ? Object.is : t, s = a.useState, n = a.useEffect, l = a.useLayoutEffect, m = a.useDebugValue;
135
+ function i(p, h) {
136
+ var g = h(), b = s({ inst: { value: g, getSnapshot: h } }), d = b[0].inst, w = b[1];
137
+ return l(
138
+ function() {
139
+ d.value = g, d.getSnapshot = h, f(d) && w({ inst: d });
140
+ },
141
+ [p, g, h]
142
+ ), n(
143
+ function() {
144
+ return f(d) && w({ inst: d }), p(function() {
145
+ f(d) && w({ inst: d });
146
+ });
147
+ },
148
+ [p]
149
+ ), m(g), g;
150
+ }
151
+ function f(p) {
152
+ var h = p.getSnapshot;
153
+ p = p.value;
154
+ try {
155
+ var g = h();
156
+ return !r(p, g);
157
+ } catch {
158
+ return !0;
159
+ }
160
+ }
161
+ function y(p, h) {
162
+ return h();
163
+ }
164
+ var u = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? y : i;
165
+ return We.useSyncExternalStore = a.useSyncExternalStore !== void 0 ? a.useSyncExternalStore : u, We;
166
+ }
167
+ var Ye = {};
168
+ /**
169
+ * @license React
170
+ * use-sync-external-store-shim.development.js
171
+ *
172
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
173
+ *
174
+ * This source code is licensed under the MIT license found in the
175
+ * LICENSE file in the root directory of this source tree.
176
+ */
177
+ var Ja;
178
+ function br() {
179
+ return Ja || (Ja = 1, process.env.NODE_ENV !== "production" && function() {
180
+ function a(g, b) {
181
+ return g === b && (g !== 0 || 1 / g === 1 / b) || g !== g && b !== b;
182
+ }
183
+ function t(g, b) {
184
+ u || n.startTransition === void 0 || (u = !0, console.error(
185
+ "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
186
+ ));
187
+ var d = b();
188
+ if (!p) {
189
+ var w = b();
190
+ l(d, w) || (console.error(
191
+ "The result of getSnapshot should be cached to avoid an infinite loop"
192
+ ), p = !0);
193
+ }
194
+ w = m({
195
+ inst: { value: d, getSnapshot: b }
196
+ });
197
+ var D = w[0].inst, A = w[1];
198
+ return f(
199
+ function() {
200
+ D.value = d, D.getSnapshot = b, r(D) && A({ inst: D });
201
+ },
202
+ [g, d, b]
203
+ ), i(
204
+ function() {
205
+ return r(D) && A({ inst: D }), g(function() {
206
+ r(D) && A({ inst: D });
207
+ });
208
+ },
209
+ [g]
210
+ ), y(d), d;
211
+ }
212
+ function r(g) {
213
+ var b = g.getSnapshot;
214
+ g = g.value;
215
+ try {
216
+ var d = b();
217
+ return !l(g, d);
218
+ } catch {
219
+ return !0;
220
+ }
221
+ }
222
+ function s(g, b) {
223
+ return b();
224
+ }
225
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
226
+ var n = bs, l = typeof Object.is == "function" ? Object.is : a, m = n.useState, i = n.useEffect, f = n.useLayoutEffect, y = n.useDebugValue, u = !1, p = !1, h = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? s : t;
227
+ Ye.useSyncExternalStore = n.useSyncExternalStore !== void 0 ? n.useSyncExternalStore : h, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
228
+ }()), Ye;
229
+ }
230
+ process.env.NODE_ENV === "production" ? ia.exports = gr() : ia.exports = br();
231
+ var vr = ia.exports;
232
+ const Me = ["light", "dark", "system"];
233
+ function yr() {
234
+ const { theme: a, setTheme: t } = lt(), r = S(
235
+ (m) => m.actions.setDashboardTheme
236
+ );
237
+ function s() {
238
+ const m = Me.includes(a) ? a : "system", i = Me[(Me.indexOf(m) + 1) % Me.length];
239
+ t(i), r(i);
240
+ }
241
+ const n = a === "light" ? pr : a === "dark" ? mr : ur, l = a === "light" ? "Theme: light (click for dark)" : a === "dark" ? "Theme: dark (click for system)" : "Theme: system (click for light)";
242
+ return /* @__PURE__ */ e(
243
+ k,
244
+ {
245
+ type: "button",
246
+ variant: "ghost",
247
+ size: "xs",
248
+ className: "h-7 w-7 p-0 text-muted-foreground hover:text-foreground",
249
+ onClick: s,
250
+ "aria-label": l,
251
+ title: l,
252
+ children: /* @__PURE__ */ e(n, { className: "h-3.5 w-3.5", strokeWidth: 1.5 })
253
+ }
254
+ );
255
+ }
256
+ async function xr(a, t, r, s, n) {
257
+ if (!n)
258
+ return null;
259
+ const l = JSON.stringify(r), m = `${a}/v1/lens`;
260
+ return await la(m, n, {
261
+ name: t,
262
+ template: l,
263
+ filterValues: s,
264
+ operation: "create"
265
+ });
266
+ }
267
+ async function ca(a, t, r) {
268
+ if (!r)
269
+ return null;
270
+ const { id: s, template: n, filterValues: l, isDefault: m, shared: i } = t, f = `${a}/v1/lens`;
271
+ return await la(f, r, {
272
+ lensId: s,
273
+ template: n,
274
+ filterValues: l,
275
+ isDefault: m,
276
+ shared: i,
277
+ operation: "update"
278
+ });
279
+ }
280
+ async function Sr(a, t, r) {
281
+ if (!r)
282
+ return null;
283
+ const s = `${a}/v1/lens`;
284
+ return await la(s, r, {
285
+ operation: "delete",
286
+ lensId: t
287
+ });
288
+ }
289
+ const Nr = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";
290
+ function wr({
291
+ open: a,
292
+ onOpenChange: t
293
+ } = {}) {
294
+ const [r, s] = x(""), [n, l] = x(!1), m = S((E) => E.lenses), { setLenses: i, setSelectedLensId: f } = Za(), [y, u] = x(!1), [p, h] = x(!1), g = a !== void 0, b = g ? a : p, d = (E) => {
295
+ g || h(E), t == null || t(E);
296
+ }, w = S((E) => E.dashboard), D = S((E) => E.filterValues), { authToken: A, tokenProps: C } = j();
297
+ async function N() {
298
+ u(!0);
299
+ const E = await xr(
300
+ C.apiServiceUrl,
301
+ r,
302
+ w,
303
+ D,
304
+ A == null ? void 0 : A.accessToken
305
+ );
306
+ E && (i([...m || [], E]), f(E.id), d(!1)), u(!1);
307
+ }
308
+ return /* @__PURE__ */ o(da, { open: b, onOpenChange: d, children: [
309
+ g ? null : /* @__PURE__ */ e(dt, { asChild: !0, children: /* @__PURE__ */ o(k, { variant: "secondary", size: "xs", children: [
310
+ /* @__PURE__ */ e(aa, { className: "h-3.5 w-3.5" }),
311
+ "Lens"
312
+ ] }) }),
313
+ /* @__PURE__ */ o(ua, { className: "rounded-control border-border/60 sm:max-w-[420px] sm:rounded-control", children: [
314
+ /* @__PURE__ */ o(ma, { children: [
315
+ /* @__PURE__ */ e(ha, { className: "text-[15px]", children: "Create lens" }),
316
+ /* @__PURE__ */ e(ns, { className: "text-[13px] leading-5", children: "Lenses are private by default and are only visible to you." })
317
+ ] }),
318
+ /* @__PURE__ */ o("div", { className: "space-y-1.5 py-1", children: [
319
+ /* @__PURE__ */ e(Xe, { htmlFor: "lens-name", className: Nr, children: "Name" }),
320
+ /* @__PURE__ */ e(
321
+ ie,
322
+ {
323
+ id: "lens-name",
324
+ size: "xs",
325
+ value: r,
326
+ placeholder: "Monthly review, West region, …",
327
+ onChange: (E) => s(E.target.value)
328
+ }
329
+ ),
330
+ n && /* @__PURE__ */ e("p", { className: "text-[12px] text-destructive", children: "A lens with this name already exists. Pick a different one." })
331
+ ] }),
332
+ /* @__PURE__ */ o(ut, { children: [
333
+ /* @__PURE__ */ e(k, { variant: "outline", size: "xs", onClick: () => d(!1), children: "Cancel" }),
334
+ /* @__PURE__ */ e(
335
+ k,
336
+ {
337
+ size: "xs",
338
+ type: "submit",
339
+ onClick: N,
340
+ disabled: y || !r.trim(),
341
+ children: y ? "Creating…" : "Create"
342
+ }
343
+ )
344
+ ] })
345
+ ] })
346
+ ] });
347
+ }
348
+ function Dr({ includeLabel: a = !1 } = {}) {
349
+ const t = S((u) => u.lenses), r = S((u) => u.selectedLensId), { setLenses: s, setSelectedLensId: n } = Za(), { authToken: l, tokenProps: m } = j();
350
+ async function i(u) {
351
+ n(u);
352
+ }
353
+ async function f(u) {
354
+ if (await Sr(m.apiServiceUrl, u, l == null ? void 0 : l.accessToken)) {
355
+ const h = t == null ? void 0 : t.filter((g) => g.id !== u);
356
+ s(h || []), n("original");
357
+ }
358
+ }
359
+ async function y(u) {
360
+ const p = t == null ? void 0 : t.map((b) => b.id === u.id ? {
361
+ ...b,
362
+ isDefault: !u.isDefault
363
+ } : {
364
+ ...b,
365
+ isDefault: !1
366
+ });
367
+ s(p || []);
368
+ const h = {
369
+ ...u,
370
+ isDefault: !u.isDefault
371
+ };
372
+ await ca(m.apiServiceUrl, h, l == null ? void 0 : l.accessToken);
373
+ const g = t == null ? void 0 : t.find((b) => b.isDefault);
374
+ if (g && g.id !== u.id) {
375
+ const b = {
376
+ ...g,
377
+ isDefault: !1
378
+ };
379
+ await ca(m.apiServiceUrl, b, l == null ? void 0 : l.accessToken);
380
+ }
381
+ }
382
+ return /* @__PURE__ */ o(O, { children: [
383
+ a ? /* @__PURE__ */ o(O, { children: [
384
+ /* @__PURE__ */ e(oe, { className: "px-3", children: "Lenses" }),
385
+ /* @__PURE__ */ e(Ae, {})
386
+ ] }) : null,
387
+ /* @__PURE__ */ o(
388
+ mt,
389
+ {
390
+ value: r,
391
+ onValueChange: i,
392
+ children: [
393
+ /* @__PURE__ */ e(Ba, { value: "original", children: "Original" }),
394
+ t == null ? void 0 : t.map((u) => /* @__PURE__ */ o(
395
+ Ba,
396
+ {
397
+ className: "group flex justify-between gap-2",
398
+ value: u.id,
399
+ children: [
400
+ /* @__PURE__ */ e("p", { children: u.name }),
401
+ /* @__PURE__ */ o("span", { className: "flex items-center gap-3", children: [
402
+ /* @__PURE__ */ e(
403
+ os,
404
+ {
405
+ onClick: (p) => {
406
+ p.preventDefault(), y(u);
407
+ },
408
+ className: Y(
409
+ "size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",
410
+ {
411
+ invisible: !u.isDefault,
412
+ "text-green-500": u.isDefault
413
+ }
414
+ ),
415
+ strokeWidth: 1.5
416
+ }
417
+ ),
418
+ /* @__PURE__ */ e(
419
+ is,
420
+ {
421
+ onClick: (p) => {
422
+ p.preventDefault(), f(u.id);
423
+ },
424
+ className: "invisible size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",
425
+ strokeWidth: 1.5
426
+ }
427
+ )
428
+ ] })
429
+ ]
430
+ },
431
+ u.id
432
+ ))
433
+ ]
434
+ }
435
+ )
436
+ ] });
437
+ }
438
+ function Cr() {
439
+ const { displayPreferences: a, shouldShowElement: t } = ht(), { currentUser: r, userContext: s } = pa(), n = q(
440
+ () => pt(r),
441
+ [r]
442
+ ), l = q(() => (i) => n && n[i] !== void 0 && n[i] === !1 ? !1 : t(i), [n, t, a]), m = q(
443
+ () => {
444
+ var i, f, y, u, p;
445
+ return {
446
+ canEdit: ((i = s == null ? void 0 : s.permissions) == null ? void 0 : i.canEdit) ?? yt(r),
447
+ canUseFilters: ((f = s == null ? void 0 : s.permissions) == null ? void 0 : f.canEdit) ?? vt(r),
448
+ canManageDashboards: ((y = s == null ? void 0 : s.permissions) == null ? void 0 : y.canCreateDashboard) ?? bt(r),
449
+ canCreateDashboards: ((u = s == null ? void 0 : s.permissions) == null ? void 0 : u.canCreateDashboard) ?? gt(r),
450
+ canAccessVisuals: ((p = s == null ? void 0 : s.permissions) == null ? void 0 : p.canEdit) ?? ft(r)
451
+ };
452
+ },
453
+ [r, s]
454
+ );
455
+ return {
456
+ displayPreferences: a,
457
+ shouldShowElement: l,
458
+ permissions: m,
459
+ currentUser: r
460
+ };
461
+ }
462
+ const Er = async (a, t, r) => {
463
+ const s = `${a}/management/v1/groups`;
464
+ return await as(s, t, r);
465
+ }, Lr = async (a, t, r) => {
466
+ const s = `${a}/management/v1/groups/${r}`;
467
+ await es(s, t, "DELETE");
468
+ }, Mr = async (a, t, r, s) => {
469
+ const n = `${a}/management/v1/groups/${r}/members`;
470
+ return await as(n, t, s);
471
+ }, Ar = async (a, t, r, s) => {
472
+ const n = `${a}/management/v1/groups/${r}/members`;
473
+ await es(n, t, "DELETE", s);
474
+ };
475
+ function kr() {
476
+ const { authToken: a, tokenProps: t } = j(), r = Oe();
477
+ return Te({
478
+ mutationFn: (s) => Er(t.apiServiceUrl, (a == null ? void 0 : a.accessToken) || "", s),
479
+ onSuccess: () => {
480
+ r.invalidateQueries({ queryKey: ["groups"] }), M.success("Group created successfully");
481
+ },
482
+ onError: (s) => {
483
+ console.error("Failed to create group:", s), M.error("Failed to create group", {
484
+ description: Pe(s, "Failed to create group")
485
+ });
486
+ }
487
+ });
488
+ }
489
+ function Ir() {
490
+ const { authToken: a, tokenProps: t } = j(), r = Oe();
491
+ return Te({
492
+ mutationFn: (s) => Lr(t.apiServiceUrl, (a == null ? void 0 : a.accessToken) || "", s),
493
+ onSuccess: (s, n) => {
494
+ r.invalidateQueries({ queryKey: ["groups"] }), r.removeQueries({ queryKey: ["group", n] }), M.success("Group deleted successfully");
495
+ },
496
+ onError: (s) => {
497
+ console.error("Failed to delete group:", s), M.error("Failed to delete group", {
498
+ description: Pe(s, "Failed to delete group")
499
+ });
500
+ }
501
+ });
502
+ }
503
+ function Pr() {
504
+ const { authToken: a, tokenProps: t } = j(), r = Oe();
505
+ return Te({
506
+ mutationFn: ({
507
+ groupId: s,
508
+ data: n
509
+ }) => Mr(t.apiServiceUrl, (a == null ? void 0 : a.accessToken) || "", s, n),
510
+ onSuccess: (s, n) => {
511
+ r.invalidateQueries({ queryKey: ["group", n.groupId] }), r.invalidateQueries({
512
+ queryKey: ["group-members", n.groupId]
513
+ }), r.invalidateQueries({ queryKey: ["groups"] }), M.success("Members added successfully");
514
+ },
515
+ onError: (s) => {
516
+ console.error("Failed to add group members:", s), M.error("Failed to add members", {
517
+ description: Pe(s, "Failed to add members")
518
+ });
519
+ }
520
+ });
521
+ }
522
+ function Or() {
523
+ const { authToken: a, tokenProps: t } = j(), r = Oe();
524
+ return Te({
525
+ mutationFn: ({
526
+ groupId: s,
527
+ data: n
528
+ }) => Ar(t.apiServiceUrl, (a == null ? void 0 : a.accessToken) || "", s, n),
529
+ onSuccess: (s, n) => {
530
+ r.invalidateQueries({ queryKey: ["group", n.groupId] }), r.invalidateQueries({
531
+ queryKey: ["group-members", n.groupId]
532
+ }), r.invalidateQueries({ queryKey: ["groups"] }), M.success("Members removed successfully");
533
+ },
534
+ onError: (s) => {
535
+ console.error("Failed to remove group members:", s), M.error("Failed to remove members", {
536
+ description: Pe(s, "Failed to remove members")
537
+ });
538
+ }
539
+ });
540
+ }
541
+ const Wa = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";
542
+ function Tr({
543
+ onSuccess: a,
544
+ tenantId: t,
545
+ isTenantUser: r
546
+ }) {
547
+ const [s, n] = x(""), [l, m] = x(""), [i, f] = x({}), y = kr(), u = () => {
548
+ const h = {};
549
+ return s.trim() ? s.length < 3 ? h.name = "Group name must be at least 3 characters" : s.length > 50 && (h.name = "Group name must be less than 50 characters") : h.name = "Group name is required", l && l.length > 200 && (h.description = "Description must be less than 200 characters"), f(h), Object.keys(h).length === 0;
550
+ };
551
+ return /* @__PURE__ */ o("form", { onSubmit: async (h) => {
552
+ if (h.preventDefault(), !u()) return;
553
+ const g = {
554
+ name: s.trim(),
555
+ description: l.trim() || void 0,
556
+ type: r ? "TENANT_GROUP" : "ORG_GROUP",
557
+ ...r && t ? { tenantId: t } : {}
558
+ };
559
+ try {
560
+ await y.mutateAsync(g), n(""), m(""), f({}), a();
561
+ } catch (b) {
562
+ console.error("Failed to create group:", b);
563
+ }
564
+ }, className: "space-y-4", children: [
565
+ /* @__PURE__ */ o("div", { className: "space-y-1.5", children: [
566
+ /* @__PURE__ */ o(Xe, { htmlFor: "group-name", className: Wa, children: [
567
+ "Group name ",
568
+ /* @__PURE__ */ e("span", { className: "text-destructive", children: "*" })
569
+ ] }),
570
+ /* @__PURE__ */ e(
571
+ ie,
572
+ {
573
+ id: "group-name",
574
+ size: "xs",
575
+ placeholder: "e.g., Marketing Team, Engineering Squad",
576
+ value: s,
577
+ onChange: (h) => {
578
+ n(h.target.value), i.name && f((g) => ({ ...g, name: "" }));
579
+ },
580
+ className: i.name ? "border-destructive" : "",
581
+ disabled: y.isPending
582
+ }
583
+ ),
584
+ i.name && /* @__PURE__ */ e("p", { className: "text-[12px] text-destructive", children: i.name })
585
+ ] }),
586
+ /* @__PURE__ */ o("div", { className: "space-y-1.5", children: [
587
+ /* @__PURE__ */ e(Xe, { htmlFor: "group-description", className: Wa, children: "Description (optional)" }),
588
+ /* @__PURE__ */ e(
589
+ xt,
590
+ {
591
+ id: "group-description",
592
+ placeholder: "Describe the purpose of this group…",
593
+ value: l,
594
+ onChange: (h) => {
595
+ m(h.target.value), i.description && f((g) => ({ ...g, description: "" }));
596
+ },
597
+ className: `text-[13px] ${i.description ? "border-destructive" : ""}`,
598
+ disabled: y.isPending,
599
+ rows: 3
600
+ }
601
+ ),
602
+ i.description ? /* @__PURE__ */ e("p", { className: "text-[12px] text-destructive", children: i.description }) : /* @__PURE__ */ o("p", { className: "text-[11px] text-muted-foreground", children: [
603
+ l.length,
604
+ "/200"
605
+ ] })
606
+ ] }),
607
+ /* @__PURE__ */ o("div", { className: "flex gap-2 text-[12px] text-muted-foreground", children: [
608
+ /* @__PURE__ */ e(Zs, { className: "h-3.5 w-3.5 shrink-0 mt-0.5" }),
609
+ /* @__PURE__ */ e("p", { children: "This group will be accessible to users in your workspace. You can add members after creating it." })
610
+ ] }),
611
+ /* @__PURE__ */ o("div", { className: "flex justify-end gap-1.5 pt-1", children: [
612
+ /* @__PURE__ */ e(
613
+ k,
614
+ {
615
+ type: "button",
616
+ variant: "outline",
617
+ size: "xs",
618
+ onClick: () => {
619
+ n(""), m(""), f({});
620
+ },
621
+ disabled: y.isPending,
622
+ children: "Clear"
623
+ }
624
+ ),
625
+ /* @__PURE__ */ e(
626
+ k,
627
+ {
628
+ type: "submit",
629
+ size: "xs",
630
+ disabled: y.isPending || !s.trim(),
631
+ children: y.isPending ? /* @__PURE__ */ o(O, { children: [
632
+ /* @__PURE__ */ e(X, { className: "h-3.5 w-3.5 animate-spin" }),
633
+ "Creating…"
634
+ ] }) : "Create group"
635
+ }
636
+ )
637
+ ] })
638
+ ] });
639
+ }
640
+ function _r(a, t = []) {
641
+ let r = [];
642
+ function s(l, m) {
643
+ const i = I.createContext(m);
644
+ i.displayName = l + "Context";
645
+ const f = r.length;
646
+ r = [...r, m];
647
+ const y = (p) => {
648
+ var D;
649
+ const { scope: h, children: g, ...b } = p, d = ((D = h == null ? void 0 : h[a]) == null ? void 0 : D[f]) || i, w = I.useMemo(() => b, Object.values(b));
650
+ return /* @__PURE__ */ e(d.Provider, { value: w, children: g });
651
+ };
652
+ y.displayName = l + "Provider";
653
+ function u(p, h) {
654
+ var d;
655
+ const g = ((d = h == null ? void 0 : h[a]) == null ? void 0 : d[f]) || i, b = I.useContext(g);
656
+ if (b) return b;
657
+ if (m !== void 0) return m;
658
+ throw new Error(`\`${p}\` must be used within \`${l}\``);
659
+ }
660
+ return [y, u];
661
+ }
662
+ const n = () => {
663
+ const l = r.map((m) => I.createContext(m));
664
+ return function(i) {
665
+ const f = (i == null ? void 0 : i[a]) || l;
666
+ return I.useMemo(
667
+ () => ({ [`__scope${a}`]: { ...i, [a]: f } }),
668
+ [i, f]
669
+ );
670
+ };
671
+ };
672
+ return n.scopeName = a, [s, Ur(n, ...t)];
673
+ }
674
+ function Ur(...a) {
675
+ const t = a[0];
676
+ if (a.length === 1) return t;
677
+ const r = () => {
678
+ const s = a.map((n) => ({
679
+ useScope: n(),
680
+ scopeName: n.scopeName
681
+ }));
682
+ return function(l) {
683
+ const m = s.reduce((i, { useScope: f, scopeName: y }) => {
684
+ const p = f(l)[`__scope${y}`];
685
+ return { ...i, ...p };
686
+ }, {});
687
+ return I.useMemo(() => ({ [`__scope${t.scopeName}`]: m }), [m]);
688
+ };
689
+ };
690
+ return r.scopeName = t.scopeName, r;
691
+ }
692
+ var Rr = [
693
+ "a",
694
+ "button",
695
+ "div",
696
+ "form",
697
+ "h2",
698
+ "h3",
699
+ "img",
700
+ "input",
701
+ "label",
702
+ "li",
703
+ "nav",
704
+ "ol",
705
+ "p",
706
+ "select",
707
+ "span",
708
+ "svg",
709
+ "ul"
710
+ ], ga = Rr.reduce((a, t) => {
711
+ const r = et(`Primitive.${t}`), s = I.forwardRef((n, l) => {
712
+ const { asChild: m, ...i } = n, f = m ? r : t;
713
+ return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ e(f, { ...i, ref: l });
714
+ });
715
+ return s.displayName = `Primitive.${t}`, { ...a, [t]: s };
716
+ }, {});
717
+ function Gr() {
718
+ return vr.useSyncExternalStore(
719
+ Fr,
720
+ () => !0,
721
+ () => !1
722
+ );
723
+ }
724
+ function Fr() {
725
+ return () => {
726
+ };
727
+ }
728
+ var ba = "Avatar", [$r] = _r(ba), [zr, vs] = $r(ba), ys = I.forwardRef(
729
+ (a, t) => {
730
+ const { __scopeAvatar: r, ...s } = a, [n, l] = I.useState("idle");
731
+ return /* @__PURE__ */ e(
732
+ zr,
733
+ {
734
+ scope: r,
735
+ imageLoadingStatus: n,
736
+ onImageLoadingStatusChange: l,
737
+ children: /* @__PURE__ */ e(ga.span, { ...s, ref: t })
738
+ }
739
+ );
740
+ }
741
+ );
742
+ ys.displayName = ba;
743
+ var xs = "AvatarImage", Ss = I.forwardRef(
744
+ (a, t) => {
745
+ const { __scopeAvatar: r, src: s, onLoadingStatusChange: n = () => {
746
+ }, ...l } = a, m = vs(xs, r), i = Hr(s, l), f = at((y) => {
747
+ n(y), m.onImageLoadingStatusChange(y);
748
+ });
749
+ return Ze(() => {
750
+ i !== "idle" && f(i);
751
+ }, [i, f]), i === "loaded" ? /* @__PURE__ */ e(ga.img, { ...l, ref: t, src: s }) : null;
752
+ }
753
+ );
754
+ Ss.displayName = xs;
755
+ var Ns = "AvatarFallback", ws = I.forwardRef(
756
+ (a, t) => {
757
+ const { __scopeAvatar: r, delayMs: s, ...n } = a, l = vs(Ns, r), [m, i] = I.useState(s === void 0);
758
+ return I.useEffect(() => {
759
+ if (s !== void 0) {
760
+ const f = window.setTimeout(() => i(!0), s);
761
+ return () => window.clearTimeout(f);
762
+ }
763
+ }, [s]), m && l.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ e(ga.span, { ...n, ref: t }) : null;
764
+ }
765
+ );
766
+ ws.displayName = Ns;
767
+ function Ya(a, t) {
768
+ return a ? t ? (a.src !== t && (a.src = t), a.complete && a.naturalWidth > 0 ? "loaded" : "loading") : "error" : "idle";
769
+ }
770
+ function Hr(a, { referrerPolicy: t, crossOrigin: r }) {
771
+ const s = Gr(), n = I.useRef(null), l = s ? (n.current || (n.current = new window.Image()), n.current) : null, [m, i] = I.useState(
772
+ () => Ya(l, a)
773
+ );
774
+ return Ze(() => {
775
+ i(Ya(l, a));
776
+ }, [l, a]), Ze(() => {
777
+ const f = (p) => () => {
778
+ i(p);
779
+ };
780
+ if (!l) return;
781
+ const y = f("loaded"), u = f("error");
782
+ return l.addEventListener("load", y), l.addEventListener("error", u), t && (l.referrerPolicy = t), typeof r == "string" && (l.crossOrigin = r), () => {
783
+ l.removeEventListener("load", y), l.removeEventListener("error", u);
784
+ };
785
+ }, [l, r, t]), m;
786
+ }
787
+ var Ds = ys, Cs = Ss, Es = ws;
788
+ const va = I.forwardRef(({ className: a, ...t }, r) => /* @__PURE__ */ e(
789
+ Ds,
790
+ {
791
+ ref: r,
792
+ className: Y(
793
+ "relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
794
+ a
795
+ ),
796
+ ...t
797
+ }
798
+ ));
799
+ va.displayName = Ds.displayName;
800
+ const qr = I.forwardRef(({ className: a, ...t }, r) => /* @__PURE__ */ e(
801
+ Cs,
802
+ {
803
+ ref: r,
804
+ className: Y("aspect-square h-full w-full", a),
805
+ ...t
806
+ }
807
+ ));
808
+ qr.displayName = Cs.displayName;
809
+ const ya = I.forwardRef(({ className: a, ...t }, r) => /* @__PURE__ */ e(
810
+ Es,
811
+ {
812
+ ref: r,
813
+ className: Y(
814
+ "flex h-full w-full items-center justify-center rounded-full bg-muted",
815
+ a
816
+ ),
817
+ ...t
818
+ }
819
+ ));
820
+ ya.displayName = Es.displayName;
821
+ function Br({
822
+ open: a,
823
+ onOpenChange: t,
824
+ group: r,
825
+ onUpdate: s
826
+ }) {
827
+ const [n, l] = x("members"), [m, i] = x(""), [f, y] = x([]), [u, p] = x([]), { data: h, isLoading: g, refetch: b } = St(r.id), d = r.type === "TENANT_GROUP" ? "tenant" : "organization", { users: w, isLoading: D } = Nt({
828
+ type: d,
829
+ tenantId: r.tenantId || void 0,
830
+ active: !0,
831
+ limit: 100
832
+ }), A = Pr(), C = Or(), N = (h == null ? void 0 : h.members) || [], E = q(() => new Set(N.map((v) => v.userId)), [N]), V = q(() => w.filter((v) => !E.has(v.id)), [w, E]), H = q(() => {
833
+ if (!m) return V;
834
+ const v = m.toLowerCase();
835
+ return V.filter(
836
+ (T) => {
837
+ var R, Q;
838
+ return ((R = T.name) == null ? void 0 : R.toLowerCase().includes(v)) || ((Q = T.email) == null ? void 0 : Q.toLowerCase().includes(v));
839
+ }
840
+ );
841
+ }, [V, m]), L = q(() => {
842
+ if (!m) return N;
843
+ const v = m.toLowerCase();
844
+ return N.filter(
845
+ (T) => {
846
+ var R, Q, Z, le;
847
+ return ((Q = (R = T.user) == null ? void 0 : R.name) == null ? void 0 : Q.toLowerCase().includes(v)) || ((le = (Z = T.user) == null ? void 0 : Z.email) == null ? void 0 : le.toLowerCase().includes(v));
848
+ }
849
+ );
850
+ }, [N, m]), K = async () => {
851
+ if (f.length !== 0)
852
+ try {
853
+ await A.mutateAsync({
854
+ groupId: r.id,
855
+ data: {
856
+ userIds: f,
857
+ userType: d === "tenant" ? "tenant" : "org"
858
+ }
859
+ }), y([]), l("members"), b(), s == null || s();
860
+ } catch (v) {
861
+ console.error("Failed to add members:", v);
862
+ }
863
+ }, _e = async () => {
864
+ if (u.length !== 0)
865
+ try {
866
+ await C.mutateAsync({
867
+ groupId: r.id,
868
+ data: {
869
+ userIds: u
870
+ }
871
+ }), p([]), b(), s == null || s();
872
+ } catch (v) {
873
+ console.error("Failed to remove members:", v);
874
+ }
875
+ }, ce = (v) => {
876
+ y(
877
+ (T) => T.includes(v) ? T.filter((R) => R !== v) : [...T, v]
878
+ );
879
+ }, Ue = (v) => {
880
+ p(
881
+ (T) => T.includes(v) ? T.filter((R) => R !== v) : [...T, v]
882
+ );
883
+ };
884
+ return /* @__PURE__ */ e(O, { children: /* @__PURE__ */ e(da, { open: a, onOpenChange: t, children: /* @__PURE__ */ o(ua, { className: "max-w-3xl max-h-[80vh]", "aria-describedby": "group-members-description", children: [
885
+ /* @__PURE__ */ o(ma, { children: [
886
+ /* @__PURE__ */ e(ha, { children: r.name }),
887
+ /* @__PURE__ */ e("div", { className: "flex items-center gap-2 mt-1", children: /* @__PURE__ */ o("p", { className: "text-sm text-muted-foreground", children: [
888
+ N.length,
889
+ " ",
890
+ N.length === 1 ? "member" : "members"
891
+ ] }) }),
892
+ /* @__PURE__ */ o("p", { id: "group-members-description", className: "sr-only", children: [
893
+ "Add or remove members from the ",
894
+ r.name,
895
+ " group"
896
+ ] })
897
+ ] }),
898
+ /* @__PURE__ */ o(ss, { value: n, onValueChange: (v) => {
899
+ l(v), i(""), p([]);
900
+ }, className: "mt-4", children: [
901
+ /* @__PURE__ */ o(ts, { className: "grid w-full grid-cols-2", children: [
902
+ /* @__PURE__ */ e(ke, { value: "members", children: "Current Members" }),
903
+ /* @__PURE__ */ e(ke, { value: "add", children: "Add Members" })
904
+ ] }),
905
+ /* @__PURE__ */ o(Ie, { value: "members", className: "mt-4 space-y-4", children: [
906
+ /* @__PURE__ */ o("div", { className: "relative", children: [
907
+ /* @__PURE__ */ e(sa, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
908
+ /* @__PURE__ */ e(
909
+ ie,
910
+ {
911
+ placeholder: "Search members...",
912
+ value: m,
913
+ onChange: (v) => i(v.target.value),
914
+ className: "pl-10"
915
+ }
916
+ )
917
+ ] }),
918
+ /* @__PURE__ */ e(ea, { className: u.length > 0 ? "h-[300px]" : "h-[350px]", children: g ? /* @__PURE__ */ e("div", { className: "space-y-2", children: [1, 2, 3].map((v) => /* @__PURE__ */ e(ta, { className: "h-16 w-full" }, v)) }) : L.length === 0 ? /* @__PURE__ */ o("div", { className: "flex flex-col items-center justify-center py-12 text-muted-foreground", children: [
919
+ /* @__PURE__ */ e(fa, { className: "h-12 w-12 mb-3 opacity-50" }),
920
+ /* @__PURE__ */ e("p", { className: "text-sm font-medium", children: m ? "No members found" : "No members yet" }),
921
+ /* @__PURE__ */ e("p", { className: "text-xs mt-1", children: m ? "Try a different search" : 'Switch to the "Add Members" tab to add people to this group' })
922
+ ] }) : /* @__PURE__ */ e("div", { className: "space-y-2", children: L.map((v) => /* @__PURE__ */ e(
923
+ jr,
924
+ {
925
+ member: v,
926
+ selected: u.includes(v.userId),
927
+ onToggle: () => Ue(v.userId)
928
+ },
929
+ v.id
930
+ )) }) }),
931
+ u.length > 0 && /* @__PURE__ */ o("div", { className: "flex items-center justify-between pt-4 border-t", children: [
932
+ /* @__PURE__ */ o("span", { className: "text-sm text-muted-foreground", children: [
933
+ u.length,
934
+ " member",
935
+ u.length !== 1 ? "s" : "",
936
+ " selected"
937
+ ] }),
938
+ /* @__PURE__ */ e(
939
+ k,
940
+ {
941
+ variant: "destructive",
942
+ size: "sm",
943
+ onClick: _e,
944
+ disabled: C.isPending,
945
+ children: C.isPending ? /* @__PURE__ */ o(O, { children: [
946
+ /* @__PURE__ */ e(X, { className: "mr-2 h-4 w-4 animate-spin" }),
947
+ "Removing..."
948
+ ] }) : /* @__PURE__ */ o(O, { children: [
949
+ /* @__PURE__ */ e(cs, { className: "mr-2 h-4 w-4" }),
950
+ "Remove Selected"
951
+ ] })
952
+ }
953
+ )
954
+ ] })
955
+ ] }),
956
+ /* @__PURE__ */ o(Ie, { value: "add", className: "mt-4 space-y-4", children: [
957
+ /* @__PURE__ */ o("div", { className: "relative", children: [
958
+ /* @__PURE__ */ e(sa, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
959
+ /* @__PURE__ */ e(
960
+ ie,
961
+ {
962
+ placeholder: "Search users to add...",
963
+ value: m,
964
+ onChange: (v) => i(v.target.value),
965
+ className: "pl-10"
966
+ }
967
+ )
968
+ ] }),
969
+ /* @__PURE__ */ e(ea, { className: "h-[300px]", children: D ? /* @__PURE__ */ e("div", { className: "space-y-2", children: [1, 2, 3].map((v) => /* @__PURE__ */ e(ta, { className: "h-16 w-full" }, v)) }) : H.length === 0 ? /* @__PURE__ */ o("div", { className: "flex flex-col items-center justify-center py-12 text-muted-foreground", children: [
970
+ /* @__PURE__ */ e(oa, { className: "h-12 w-12 mb-3 opacity-50" }),
971
+ /* @__PURE__ */ e("p", { className: "text-sm font-medium", children: "No available users" }),
972
+ /* @__PURE__ */ e("p", { className: "text-xs mt-1", children: m ? "Try a different search" : "All eligible users are already members" })
973
+ ] }) : /* @__PURE__ */ e("div", { className: "space-y-2", children: H.map((v) => /* @__PURE__ */ e(
974
+ Vr,
975
+ {
976
+ user: v,
977
+ selected: f.includes(v.id),
978
+ onToggle: () => ce(v.id)
979
+ },
980
+ v.id
981
+ )) }) }),
982
+ f.length > 0 && /* @__PURE__ */ o("div", { className: "flex items-center justify-between pt-4 border-t", children: [
983
+ /* @__PURE__ */ o("span", { className: "text-sm text-muted-foreground", children: [
984
+ f.length,
985
+ " user",
986
+ f.length !== 1 ? "s" : "",
987
+ " selected"
988
+ ] }),
989
+ /* @__PURE__ */ e(
990
+ k,
991
+ {
992
+ onClick: K,
993
+ disabled: A.isPending,
994
+ children: A.isPending ? /* @__PURE__ */ o(O, { children: [
995
+ /* @__PURE__ */ e(X, { className: "mr-2 h-4 w-4 animate-spin" }),
996
+ "Adding..."
997
+ ] }) : /* @__PURE__ */ o(O, { children: [
998
+ /* @__PURE__ */ e(oa, { className: "mr-2 h-4 w-4" }),
999
+ "Add Members"
1000
+ ] })
1001
+ }
1002
+ )
1003
+ ] })
1004
+ ] })
1005
+ ] })
1006
+ ] }) }) });
1007
+ }
1008
+ function jr({
1009
+ member: a,
1010
+ selected: t,
1011
+ onToggle: r
1012
+ }) {
1013
+ var n, l, m, i;
1014
+ const s = ((l = (n = a.user) == null ? void 0 : n.name) == null ? void 0 : l.split(" ").map((f) => f[0]).join("").toUpperCase()) || "?";
1015
+ return /* @__PURE__ */ o(
1016
+ "div",
1017
+ {
1018
+ className: "flex items-center gap-3 p-3 rounded-lg border bg-card hover:bg-muted/50 cursor-pointer",
1019
+ onClick: r,
1020
+ children: [
1021
+ /* @__PURE__ */ e(ls, { checked: t }),
1022
+ /* @__PURE__ */ e(va, { className: "h-8 w-8", children: /* @__PURE__ */ e(ya, { className: "text-xs", children: s }) }),
1023
+ /* @__PURE__ */ o("div", { className: "flex-1", children: [
1024
+ /* @__PURE__ */ e("p", { className: "text-sm font-medium", children: ((m = a.user) == null ? void 0 : m.name) || "Unknown User" }),
1025
+ /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: (i = a.user) == null ? void 0 : i.email })
1026
+ ] })
1027
+ ]
1028
+ }
1029
+ );
1030
+ }
1031
+ function Vr({
1032
+ user: a,
1033
+ selected: t,
1034
+ onToggle: r
1035
+ }) {
1036
+ var n;
1037
+ const s = ((n = a.name) == null ? void 0 : n.split(" ").map((l) => l[0]).join("").toUpperCase()) || "?";
1038
+ return /* @__PURE__ */ o(
1039
+ "div",
1040
+ {
1041
+ className: "flex items-center gap-3 p-3 rounded-lg border bg-card hover:bg-muted/50 cursor-pointer",
1042
+ onClick: r,
1043
+ children: [
1044
+ /* @__PURE__ */ e(ls, { checked: t }),
1045
+ /* @__PURE__ */ e(va, { className: "h-8 w-8", children: /* @__PURE__ */ e(ya, { className: "text-xs", children: s }) }),
1046
+ /* @__PURE__ */ o("div", { className: "flex-1", children: [
1047
+ /* @__PURE__ */ e("p", { className: "text-sm font-medium", children: a.name }),
1048
+ /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: a.email })
1049
+ ] })
1050
+ ]
1051
+ }
1052
+ );
1053
+ }
1054
+ function Kr({
1055
+ open: a,
1056
+ onOpenChange: t
1057
+ }) {
1058
+ const [r, s] = x("groups"), [n, l] = x(""), [m, i] = x(null), [f, y] = x(!1), [u, p] = x(null), { tokenProps: h } = j(), { currentUser: g } = pa(), b = Ir(), d = (g == null ? void 0 : g.type) === "tenant", w = h == null ? void 0 : h.tenantId, { groups: D, isLoading: A, refetch: C } = wt({
1059
+ type: d ? "TENANT_GROUP" : "all",
1060
+ tenantId: d ? w : void 0,
1061
+ includeMembers: !1
1062
+ }), N = D.filter(
1063
+ (L) => {
1064
+ var K;
1065
+ return L.name.toLowerCase().includes(n.toLowerCase()) || ((K = L.description) == null ? void 0 : K.toLowerCase().includes(n.toLowerCase()));
1066
+ }
1067
+ ), E = async () => {
1068
+ if (u)
1069
+ try {
1070
+ await b.mutateAsync(u.id), p(null), C();
1071
+ } catch (L) {
1072
+ console.error("Failed to delete group:", L);
1073
+ }
1074
+ }, V = (L) => {
1075
+ i(L), y(!0);
1076
+ }, H = () => {
1077
+ s("groups"), C();
1078
+ };
1079
+ return /* @__PURE__ */ o(O, { children: [
1080
+ /* @__PURE__ */ e(da, { open: a, onOpenChange: t, children: /* @__PURE__ */ o(ua, { className: "max-h-[80vh] max-w-3xl rounded-[6px] border-border/60 sm:rounded-[6px]", children: [
1081
+ /* @__PURE__ */ o(ma, { children: [
1082
+ /* @__PURE__ */ e(ha, { className: "text-[15px]", children: "Group management" }),
1083
+ /* @__PURE__ */ e(ns, { className: "text-[13px] leading-5", children: "Manage groups, create new ones, and control membership." })
1084
+ ] }),
1085
+ /* @__PURE__ */ o(
1086
+ ss,
1087
+ {
1088
+ value: r,
1089
+ onValueChange: s,
1090
+ className: "mt-2",
1091
+ children: [
1092
+ /* @__PURE__ */ o(ts, { className: "h-8 w-full justify-start gap-1 bg-transparent p-0 border-b border-border/60 rounded-none", children: [
1093
+ /* @__PURE__ */ e(
1094
+ ke,
1095
+ {
1096
+ value: "groups",
1097
+ className: "h-8 rounded-none border-b-2 border-transparent bg-transparent px-3 text-[13px] data-[state=active]:border-foreground data-[state=active]:bg-transparent data-[state=active]:shadow-none",
1098
+ children: "Groups"
1099
+ }
1100
+ ),
1101
+ /* @__PURE__ */ e(
1102
+ ke,
1103
+ {
1104
+ value: "create",
1105
+ className: "h-8 rounded-none border-b-2 border-transparent bg-transparent px-3 text-[13px] data-[state=active]:border-foreground data-[state=active]:bg-transparent data-[state=active]:shadow-none",
1106
+ children: "Create group"
1107
+ }
1108
+ )
1109
+ ] }),
1110
+ /* @__PURE__ */ e(Ie, { value: "groups", className: "mt-4", children: /* @__PURE__ */ o("div", { className: "space-y-3", children: [
1111
+ /* @__PURE__ */ o("div", { className: "relative", children: [
1112
+ /* @__PURE__ */ e(sa, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
1113
+ /* @__PURE__ */ e(
1114
+ ie,
1115
+ {
1116
+ size: "xs",
1117
+ placeholder: "Search groups…",
1118
+ value: n,
1119
+ onChange: (L) => l(L.target.value),
1120
+ className: "pl-7"
1121
+ }
1122
+ )
1123
+ ] }),
1124
+ /* @__PURE__ */ e(ea, { className: "h-[400px]", children: A ? /* @__PURE__ */ e("div", { className: "space-y-2", children: [1, 2, 3].map((L) => /* @__PURE__ */ e(
1125
+ ta,
1126
+ {
1127
+ className: "h-16 w-full rounded-[6px]"
1128
+ },
1129
+ L
1130
+ )) }) : N.length === 0 ? /* @__PURE__ */ o("div", { className: "flex flex-col items-center justify-center py-12 text-muted-foreground", children: [
1131
+ /* @__PURE__ */ e("p", { className: "text-[13px]", children: "No groups found." }),
1132
+ /* @__PURE__ */ e("p", { className: "mt-1 text-[12px]", children: n ? "Try a different search." : "Create your first group to get started." })
1133
+ ] }) : /* @__PURE__ */ e("div", { className: "space-y-2 pr-2", children: N.map((L) => /* @__PURE__ */ e(
1134
+ Qr,
1135
+ {
1136
+ group: L,
1137
+ onManageMembers: () => V(L),
1138
+ onDelete: () => p(L),
1139
+ currentUserId: g == null ? void 0 : g.id
1140
+ },
1141
+ L.id
1142
+ )) }) })
1143
+ ] }) }),
1144
+ /* @__PURE__ */ e(Ie, { value: "create", className: "mt-4", children: /* @__PURE__ */ e(
1145
+ Tr,
1146
+ {
1147
+ onSuccess: H,
1148
+ tenantId: w,
1149
+ isTenantUser: d
1150
+ }
1151
+ ) })
1152
+ ]
1153
+ }
1154
+ )
1155
+ ] }) }),
1156
+ m && /* @__PURE__ */ e(
1157
+ Br,
1158
+ {
1159
+ open: f,
1160
+ onOpenChange: y,
1161
+ group: m,
1162
+ onUpdate: () => C()
1163
+ }
1164
+ ),
1165
+ /* @__PURE__ */ e(
1166
+ ds,
1167
+ {
1168
+ open: !!u,
1169
+ onOpenChange: () => p(null),
1170
+ children: /* @__PURE__ */ o(us, { children: [
1171
+ /* @__PURE__ */ o(ms, { children: [
1172
+ /* @__PURE__ */ e(hs, { children: "Delete group" }),
1173
+ /* @__PURE__ */ o(ps, { children: [
1174
+ 'Delete "',
1175
+ u == null ? void 0 : u.name,
1176
+ `"? This removes all members and can't be undone.`
1177
+ ] })
1178
+ ] }),
1179
+ /* @__PURE__ */ o(fs, { children: [
1180
+ /* @__PURE__ */ e(gs, { children: "Cancel" }),
1181
+ /* @__PURE__ */ e(
1182
+ ra,
1183
+ {
1184
+ onClick: E,
1185
+ disabled: b.isPending,
1186
+ className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
1187
+ children: b.isPending ? /* @__PURE__ */ o(O, { children: [
1188
+ /* @__PURE__ */ e(X, { className: "h-3.5 w-3.5 animate-spin" }),
1189
+ "Deleting…"
1190
+ ] }) : "Delete group"
1191
+ }
1192
+ )
1193
+ ] })
1194
+ ] })
1195
+ }
1196
+ )
1197
+ ] });
1198
+ }
1199
+ function Qr({
1200
+ group: a,
1201
+ onManageMembers: t,
1202
+ onDelete: r,
1203
+ currentUserId: s
1204
+ }) {
1205
+ const n = a.createdBy === s;
1206
+ return /* @__PURE__ */ e("div", { className: "rounded-[6px] border border-border/60 bg-card px-3 py-2.5 transition-colors hover:bg-muted/30", children: /* @__PURE__ */ o("div", { className: "flex items-start justify-between gap-2", children: [
1207
+ /* @__PURE__ */ o("div", { className: "min-w-0 flex-1 space-y-1", children: [
1208
+ /* @__PURE__ */ e("h4", { className: "text-[13px] font-medium text-foreground", children: a.name }),
1209
+ a.description && /* @__PURE__ */ e("p", { className: "text-[12px] text-muted-foreground", children: a.description }),
1210
+ /* @__PURE__ */ o("div", { className: "flex flex-wrap items-center gap-3 text-[11px] text-muted-foreground", children: [
1211
+ /* @__PURE__ */ o("span", { className: "inline-flex items-center gap-1", children: [
1212
+ /* @__PURE__ */ e(fa, { className: "h-3 w-3" }),
1213
+ a.memberCount,
1214
+ " ",
1215
+ a.memberCount === 1 ? "member" : "members"
1216
+ ] }),
1217
+ /* @__PURE__ */ o("span", { children: [
1218
+ "Created ",
1219
+ rr(new Date(a.createdAt), "MMM d, yyyy")
1220
+ ] })
1221
+ ] })
1222
+ ] }),
1223
+ /* @__PURE__ */ o("div", { className: "flex shrink-0 items-center gap-0.5", children: [
1224
+ /* @__PURE__ */ e(
1225
+ k,
1226
+ {
1227
+ variant: "ghost",
1228
+ size: "xs",
1229
+ className: "h-7 w-7 p-0 text-muted-foreground hover:text-foreground",
1230
+ onClick: t,
1231
+ title: "Manage members",
1232
+ "aria-label": "Manage members",
1233
+ children: /* @__PURE__ */ e(oa, { className: "h-3.5 w-3.5" })
1234
+ }
1235
+ ),
1236
+ n && /* @__PURE__ */ e(
1237
+ k,
1238
+ {
1239
+ variant: "ghost",
1240
+ size: "xs",
1241
+ className: "h-7 w-7 p-0 text-muted-foreground hover:bg-destructive/10 hover:text-destructive",
1242
+ onClick: r,
1243
+ title: "Delete group",
1244
+ "aria-label": "Delete group",
1245
+ children: /* @__PURE__ */ e(cs, { className: "h-3.5 w-3.5" })
1246
+ }
1247
+ )
1248
+ ] })
1249
+ ] }) });
1250
+ }
1251
+ function re(a, t, r) {
1252
+ var l, m;
1253
+ const s = (a.controls || []).find(
1254
+ (i) => i.id === r
1255
+ );
1256
+ if (s)
1257
+ return s.label;
1258
+ const n = (m = (l = rs(a, t)) == null ? void 0 : l.controls) == null ? void 0 : m.find(
1259
+ (i) => i.id === r
1260
+ );
1261
+ return (n == null ? void 0 : n.label) || r;
1262
+ }
1263
+ function ne(a, t) {
1264
+ var r;
1265
+ return ((r = rs(a, t)) == null ? void 0 : r.title) || t;
1266
+ }
1267
+ function Jr(a) {
1268
+ const { errors: t, dashboard: r } = a;
1269
+ if (!r)
1270
+ return t;
1271
+ const s = /* @__PURE__ */ new Map();
1272
+ for (const n of t) {
1273
+ const l = n.match(
1274
+ /^Card '(.+)' binding for control '(.+)' maps to missing metric '(.+)'\.$/
1275
+ );
1276
+ if (l) {
1277
+ const [, u, p] = l, h = `${u}:${p}:missing-metric`;
1278
+ s.has(h) || s.set(
1279
+ h,
1280
+ `"${ne(r, u)}" has an outdated "${re(
1281
+ r,
1282
+ u,
1283
+ p
1284
+ )}" mapping. Some choices still point to metrics that are no longer available on this card. Open the card controls and choose replacements.`
1285
+ );
1286
+ continue;
1287
+ }
1288
+ const m = n.match(
1289
+ /^Card '(.+)' binding for control '(.+)' maps to missing group-by field '(.+)'\.$/
1290
+ );
1291
+ if (m) {
1292
+ const [, u, p] = m, h = `${u}:${p}:missing-group-by`;
1293
+ s.has(h) || s.set(
1294
+ h,
1295
+ `"${ne(r, u)}" has an outdated "${re(
1296
+ r,
1297
+ u,
1298
+ p
1299
+ )}" mapping. Some choices still point to fields that are no longer available on this card. Open the card controls and choose replacements.`
1300
+ );
1301
+ continue;
1302
+ }
1303
+ const i = n.match(
1304
+ /^Card '(.+)' binding for control '(.+)' maps to an invalid metric target\.$/
1305
+ );
1306
+ if (i) {
1307
+ const [, u, p] = i, h = `${u}:${p}:invalid-metric`;
1308
+ s.has(h) || s.set(
1309
+ h,
1310
+ `"${ne(r, u)}" has an invalid "${re(
1311
+ r,
1312
+ u,
1313
+ p
1314
+ )}" metric mapping. Open the card controls and choose a valid metric for each option.`
1315
+ );
1316
+ continue;
1317
+ }
1318
+ const f = n.match(
1319
+ /^Card '(.+)' binding for control '(.+)' maps to an invalid group-by target\.$/
1320
+ );
1321
+ if (f) {
1322
+ const [, u, p] = f, h = `${u}:${p}:invalid-group-by`;
1323
+ s.has(h) || s.set(
1324
+ h,
1325
+ `"${ne(r, u)}" has an invalid "${re(
1326
+ r,
1327
+ u,
1328
+ p
1329
+ )}" field mapping. Open the card controls and choose a valid field for each option.`
1330
+ );
1331
+ continue;
1332
+ }
1333
+ const y = n.match(
1334
+ /^Card '(.+)' binding for control '(.+)' requires at least one temporal group-by field\.$/
1335
+ );
1336
+ if (y) {
1337
+ const [, u, p] = y, h = `${u}:${p}:missing-temporal-group-by`;
1338
+ s.has(h) || s.set(
1339
+ h,
1340
+ `"${ne(r, u)}" can no longer use "${re(
1341
+ r,
1342
+ u,
1343
+ p
1344
+ )}" for time grain because the card does not currently group by a date field.`
1345
+ );
1346
+ continue;
1347
+ }
1348
+ s.set(n, n);
1349
+ }
1350
+ return Array.from(s.values());
1351
+ }
1352
+ function Wr(a, t) {
1353
+ return typeof a == "boolean" ? a : typeof t == "boolean" ? t : !0;
1354
+ }
1355
+ function Xa(a, t) {
1356
+ return {
1357
+ dashboard: na(a),
1358
+ semanticExecutionPayload: na(t)
1359
+ };
1360
+ }
1361
+ function hn() {
1362
+ var _a, Ua, Ra, Ga, Fa, $a, za;
1363
+ Wt(), Yt();
1364
+ const {
1365
+ authToken: a,
1366
+ tokenProps: t,
1367
+ id: r,
1368
+ showBriefings: s
1369
+ } = j(), { isLocalDev: n } = Dt(), { openBrandStudioPreview: l } = Ct(), { permissions: m } = Cr(), i = Et(), { isLoading: f } = Lt(), y = S((c) => c.theme), u = S((c) => c.isDownloadingPdf), p = S(
1370
+ (c) => c.dashboardAssistantDraftScopeKey
1371
+ ), h = S((c) => c.lenses), g = S((c) => c.selectedLensId), b = h == null ? void 0 : h.find((c) => c.id === g), d = S((c) => c.dashboard), w = S((c) => c.selectedSheetId), D = (_a = d == null ? void 0 : d.sheets) == null ? void 0 : _a.find(
1372
+ (c) => c.id === w
1373
+ ), A = st(D), C = A ? (Ua = D == null ? void 0 : D.document) == null ? void 0 : Ua.page : void 0, N = S(
1374
+ (c) => c.isDashboardEditing
1375
+ ), { setDashboardTitle: E } = S((c) => c.actions), [V, H] = x(!1), [L, K] = x(!1), [_e, ce] = x(!1), [Ue, v] = x(!1), [T, R] = x(!1), [Q, Z] = x(!1), [le, de] = x(!1), [ue, me] = x(null), [xa, he] = x([]), [Sa, pe] = x(!1), Ls = S((c) => c.isDashboardPanelOpen), Ms = S(
1376
+ (c) => c.actions.setIsDashboardPanelOpen
1377
+ ), As = S((c) => c.filterValues), _ = S((c) => c.isVisualEditing);
1378
+ qa((c) => c.card);
1379
+ const ee = Le(
1380
+ (c) => c.selectedDashboard
1381
+ ), fe = Le(
1382
+ (c) => c.initialDashboard
1383
+ );
1384
+ Le((c) => c.selectedVisual), S((c) => c.selectedFrameId), qa((c) => c.frame);
1385
+ const ge = ee ? (Ga = ee == null ? void 0 : ee.permissions) == null ? void 0 : Ga.canEdit : (Ra = fe == null ? void 0 : fe.permissions) == null ? void 0 : Ra.canEdit, Na = S(
1386
+ (c) => c.showDashboardJSON
1387
+ ), Re = S((c) => c.onSaveFunction), {
1388
+ setIsDashboardEditing: wa,
1389
+ setShowDashboardJSON: Da
1390
+ } = S((c) => c.actions), { setInitialDashboard: Ca, clearSelectedDashboard: Ge } = Le(
1391
+ (c) => c.actions
1392
+ ), { resources: be } = Mt(Ke.DASHBOARD), { data: Fe } = At(), ks = ((Fa = Fe == null ? void 0 : Fe.preference) == null ? void 0 : Fa.defaultDashboardId) || null, { mutate: Is, isPending: Ps } = kt(), { currentUser: Os } = pa(), Ts = It(Os), F = ee || fe, Ea = F ? {
1393
+ id: F.id,
1394
+ title: (d == null ? void 0 : d.title) || F.title || "Dashboard"
1395
+ } : null, { handleAddNewFrame: _s } = Pt(), [$e, ze] = x(!1), [Us, ae] = x(!1), [He, ve] = x("close"), se = Ot(Ke.DASHBOARD), [G, ye] = x(null), Rs = async (c, P) => {
1396
+ if (!(d != null && d.id)) {
1397
+ console.log("No dashboard ID found");
1398
+ return;
1399
+ }
1400
+ console.log("Updating dashboard title:", {
1401
+ dashboardId: d.id,
1402
+ newTitle: c,
1403
+ previousTitle: P
1404
+ }), se.mutate(
1405
+ {
1406
+ resourceId: d.id,
1407
+ data: { title: c }
1408
+ },
1409
+ {
1410
+ onSuccess: () => {
1411
+ console.log("Dashboard title updated successfully"), M.success("Dashboard title updated");
1412
+ },
1413
+ onError: ($) => {
1414
+ console.error("Failed to update dashboard title:", $), M.error("Failed to update dashboard title"), E(P);
1415
+ }
1416
+ }
1417
+ );
1418
+ };
1419
+ Va(() => {
1420
+ if (be && be.length > 0) {
1421
+ const c = d == null ? void 0 : d.id;
1422
+ if (c) {
1423
+ const P = be.find(
1424
+ ($) => $.id === c
1425
+ );
1426
+ P && Ca(P);
1427
+ }
1428
+ }
1429
+ }, [be, d == null ? void 0 : d.id, Ca]);
1430
+ const te = t.orgUserId || t.tenantId, qe = q(
1431
+ () => Yr({
1432
+ accessToken: a == null ? void 0 : a.accessToken,
1433
+ dashboardId: (d == null ? void 0 : d.id) || r || t.dashboard_id,
1434
+ selectedSheetId: A ? w : void 0,
1435
+ pageSize: C == null ? void 0 : C.size,
1436
+ orientation: C == null ? void 0 : C.orientation,
1437
+ theme: y
1438
+ }),
1439
+ [
1440
+ a == null ? void 0 : a.accessToken,
1441
+ r,
1442
+ d == null ? void 0 : d.id,
1443
+ A,
1444
+ C == null ? void 0 : C.orientation,
1445
+ C == null ? void 0 : C.size,
1446
+ w,
1447
+ y,
1448
+ t.dashboard_id
1449
+ ]
1450
+ ), La = N && !_ && te && ge, { setDashboard: Ma } = S((c) => c.actions), Aa = S(
1451
+ (c) => c.semanticExecutionPayload
1452
+ ), Gs = () => {
1453
+ wa(!0);
1454
+ }, Be = () => {
1455
+ wa(!1), Da(!1), ye(null);
1456
+ };
1457
+ Va(() => {
1458
+ if (!N) {
1459
+ G && ye(null);
1460
+ return;
1461
+ }
1462
+ G || !d || f || ye(
1463
+ Xa(
1464
+ d,
1465
+ Aa
1466
+ )
1467
+ );
1468
+ }, [
1469
+ d,
1470
+ G,
1471
+ N,
1472
+ f,
1473
+ Aa
1474
+ ]);
1475
+ const xe = (G == null ? void 0 : G.dashboard) ?? null, { isDirty: ka, isDirtyPending: Fs, resetDirty: Se } = or(
1476
+ d,
1477
+ xe,
1478
+ 300,
1479
+ 1e3,
1480
+ Je
1481
+ ), Ia = Jt(() => xe ? Je(d) !== Je(xe) : !1, [d, xe]), Pa = ka || Fs, Ne = $e || se.isPending, $s = () => {
1482
+ Ia() ? (ve("close"), ae(!0)) : (Be(), Se());
1483
+ }, zs = async () => {
1484
+ await je({
1485
+ closeAfterSave: !0,
1486
+ navigateHomeAfterSave: He === "home"
1487
+ });
1488
+ }, Hs = () => {
1489
+ G && Ma(G.dashboard, {
1490
+ semanticExecutionPayload: G.semanticExecutionPayload
1491
+ }), Be(), He === "home" && Ge(), ve("close"), ae(!1), Se();
1492
+ }, qs = () => {
1493
+ G && (Ma(G.dashboard, {
1494
+ semanticExecutionPayload: G.semanticExecutionPayload
1495
+ }), Se());
1496
+ }, Bs = () => {
1497
+ if (N && Ia()) {
1498
+ ve("home"), ae(!0);
1499
+ return;
1500
+ }
1501
+ Ge();
1502
+ };
1503
+ async function je(c) {
1504
+ const P = S.getState().dashboard;
1505
+ if (!P)
1506
+ return;
1507
+ const $ = (c == null ? void 0 : c.closeAfterSave) ?? Sa, Ws = (c == null ? void 0 : c.navigateHomeAfterSave) ?? !1;
1508
+ pe($), $ && ae(!1);
1509
+ const Ys = na(P);
1510
+ de(!0), me(null), he([]), ze(!0);
1511
+ const Xs = {
1512
+ template: P
1513
+ };
1514
+ se.mutate(
1515
+ {
1516
+ resourceId: P.id,
1517
+ data: Xs
1518
+ },
1519
+ {
1520
+ onSuccess: (U) => {
1521
+ var De, Ce, Ha;
1522
+ const W = (U == null ? void 0 : U.id) || ((De = U == null ? void 0 : U.dashboard) == null ? void 0 : De.id) || ((Ce = U == null ? void 0 : U.resource) == null ? void 0 : Ce.id) || ((Ha = U == null ? void 0 : U.template) == null ? void 0 : Ha.id) || null;
1523
+ if (!P.id && W) {
1524
+ const Ve = ct.getState(), Ee = Ve.pendingDashboardDraftMigration;
1525
+ (Ee == null ? void 0 : Ee.scopeKey) === p ? Ve.actions.setPendingDashboardDraftMigrationExpectedDashboardId(
1526
+ W
1527
+ ) : Ee && Ve.actions.clearPendingDashboardDraftMigration();
1528
+ }
1529
+ ze(!1), M.success("Dashboard saved!"), ye(
1530
+ Xa(
1531
+ Ys,
1532
+ S.getState().semanticExecutionPayload
1533
+ )
1534
+ ), de(!1), pe(!1), $ && (Be(), Se(), Ws && Ge()), ve("close");
1535
+ },
1536
+ onError: (U) => {
1537
+ ze(!1), me("Failed to save dashboard. Please try again.");
1538
+ const W = U.details, De = Array.isArray(
1539
+ W == null ? void 0 : W.errors
1540
+ ) ? (W.errors || []).filter(
1541
+ (Ce) => typeof Ce == "string"
1542
+ ) : [];
1543
+ he(
1544
+ Jr({
1545
+ errors: De,
1546
+ dashboard: P || void 0
1547
+ })
1548
+ ), M.error("Failed to save dashboard");
1549
+ }
1550
+ }
1551
+ );
1552
+ }
1553
+ async function js() {
1554
+ if (H(!0), !g || !b) return;
1555
+ const c = S.getState().dashboard;
1556
+ if (!c) {
1557
+ H(!1);
1558
+ return;
1559
+ }
1560
+ const P = JSON.stringify(c), $ = {
1561
+ ...b,
1562
+ template: P,
1563
+ filterValues: As
1564
+ };
1565
+ await ca(
1566
+ t.apiServiceUrl,
1567
+ $,
1568
+ a == null ? void 0 : a.accessToken
1569
+ ), M.success("Lens saved"), Re == null || Re(c), H(!1);
1570
+ }
1571
+ const Oa = (b == null ? void 0 : b.name) || d.title;
1572
+ se.isPending && console.log("Title during update:", {
1573
+ title: Oa,
1574
+ dashboardStateTitle: d.title,
1575
+ dashboardId: d == null ? void 0 : d.id,
1576
+ currentLensName: b == null ? void 0 : b.name
1577
+ });
1578
+ const Ta = t.orgUserId || t.tenantId && t.endUserId && t.endUserEmail, Vs = !!Ta && !!(a != null && a.accessToken) && !!(t != null && t.apiServiceUrl), Ks = i, J = (d == null ? void 0 : d.id) || null, Qs = Wr(
1579
+ ($a = t.config) == null ? void 0 : $a.showBriefings,
1580
+ s
1581
+ ), we = !!J && ks === J, Js = () => {
1582
+ J && Is({
1583
+ dashboardId: we ? null : J
1584
+ });
1585
+ };
1586
+ return /* @__PURE__ */ o(
1587
+ "div",
1588
+ {
1589
+ className: "flex h-11 shrink-0 items-center justify-between gap-2 overflow-x-auto border-b px-4 py-2",
1590
+ role: "dashboard-controls",
1591
+ children: [
1592
+ /* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
1593
+ Ta && /* @__PURE__ */ o(O, { children: [
1594
+ /* @__PURE__ */ e(
1595
+ Qe,
1596
+ {
1597
+ "aria-label": "Manage Dashboards",
1598
+ tooltip: "Manage Dashboards",
1599
+ onClick: () => {
1600
+ Ms(!Ls);
1601
+ },
1602
+ className: "h-7 w-7 px-0",
1603
+ buttonProps: { size: "xs" },
1604
+ children: /* @__PURE__ */ e(dr, { className: "h-3.5 w-3.5" })
1605
+ }
1606
+ ),
1607
+ Ks && !_ && /* @__PURE__ */ e(
1608
+ Qe,
1609
+ {
1610
+ "aria-label": "Dashboard Hub",
1611
+ tooltip: "Dashboard Hub",
1612
+ onClick: Bs,
1613
+ className: "h-7 w-7 px-0",
1614
+ buttonProps: { size: "xs" },
1615
+ children: /* @__PURE__ */ e(os, { className: "h-3.5 w-3.5" })
1616
+ }
1617
+ )
1618
+ ] }),
1619
+ !_ && i && (f ? /* @__PURE__ */ e(
1620
+ "div",
1621
+ {
1622
+ className: "h-4 w-28 animate-pulse rounded-md bg-muted/70",
1623
+ "aria-label": "Loading dashboard title",
1624
+ role: "status",
1625
+ children: /* @__PURE__ */ e("span", { className: "sr-only", children: "Loading dashboard title" })
1626
+ }
1627
+ ) : /* @__PURE__ */ o(O, { children: [
1628
+ /* @__PURE__ */ e(
1629
+ Tt,
1630
+ {
1631
+ value: Oa || "Untitled Dashboard",
1632
+ onSave: (c) => {
1633
+ console.log("EditableText onSave called:", {
1634
+ newTitle: c,
1635
+ canEditDashboard: ge,
1636
+ dashboardId: d == null ? void 0 : d.id
1637
+ });
1638
+ const P = (d == null ? void 0 : d.title) || "";
1639
+ E(c), Rs(c, P);
1640
+ },
1641
+ isEditable: ge && !b,
1642
+ displayClassName: "text-[13px] font-medium",
1643
+ inputClassName: "text-[13px] font-medium",
1644
+ placeholder: "Dashboard Title",
1645
+ isPending: se.isPending
1646
+ }
1647
+ ),
1648
+ Vs && J && /* @__PURE__ */ e(tt, { children: /* @__PURE__ */ o(rt, { children: [
1649
+ /* @__PURE__ */ e(nt, { asChild: !0, children: /* @__PURE__ */ e(
1650
+ k,
1651
+ {
1652
+ variant: "ghost",
1653
+ size: "xs",
1654
+ onClick: Js,
1655
+ disabled: Ps || !(a != null && a.accessToken) || !(t != null && t.apiServiceUrl),
1656
+ className: "w-7 px-0",
1657
+ "aria-label": we ? "Remove as default dashboard" : "Make this a default dashboard",
1658
+ children: /* @__PURE__ */ e(
1659
+ _t,
1660
+ {
1661
+ className: Y(
1662
+ "h-3.5 w-3.5 transition-colors",
1663
+ we ? "fill-foreground text-foreground" : "text-muted-foreground hover:text-foreground"
1664
+ )
1665
+ }
1666
+ )
1667
+ }
1668
+ ) }),
1669
+ /* @__PURE__ */ e(ot, { children: /* @__PURE__ */ e("p", { children: we ? "Remove as default dashboard" : "Make this a default dashboard" }) })
1670
+ ] }) })
1671
+ ] }))
1672
+ ] }),
1673
+ /* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
1674
+ _ && /* @__PURE__ */ o(O, { children: [
1675
+ /* @__PURE__ */ e(Xt, {}),
1676
+ /* @__PURE__ */ e(Zt, {})
1677
+ ] }),
1678
+ !_ && i && ((za = F == null ? void 0 : F.permissions) == null ? void 0 : za.canShare) && /* @__PURE__ */ o(
1679
+ k,
1680
+ {
1681
+ variant: "outline",
1682
+ size: "xs",
1683
+ onClick: () => K(!0),
1684
+ children: [
1685
+ /* @__PURE__ */ e(Ut, { className: "h-3.5 w-3.5" }),
1686
+ "Share"
1687
+ ]
1688
+ }
1689
+ ),
1690
+ !_ && !N && i && J && Qs && /* @__PURE__ */ e(
1691
+ er,
1692
+ {
1693
+ dashboardId: J,
1694
+ dashboardTitle: (d == null ? void 0 : d.title) || (F == null ? void 0 : F.title)
1695
+ }
1696
+ ),
1697
+ !_ && N && m.canUseFilters && i && /* @__PURE__ */ e(ar, {}),
1698
+ N && !_ && te && b && n && i && /* @__PURE__ */ o(
1699
+ k,
1700
+ {
1701
+ variant: "secondary",
1702
+ size: "xs",
1703
+ disabled: V,
1704
+ onClick: js,
1705
+ children: [
1706
+ /* @__PURE__ */ e(Ka, { className: "h-3.5 w-3.5" }),
1707
+ "Save Lens"
1708
+ ]
1709
+ }
1710
+ ),
1711
+ N && !_ && i && !A && /* @__PURE__ */ o(
1712
+ k,
1713
+ {
1714
+ variant: "outline",
1715
+ size: "xs",
1716
+ disabled: !N,
1717
+ onClick: () => _s(),
1718
+ children: [
1719
+ /* @__PURE__ */ e(aa, { className: "h-3.5 w-3.5" }),
1720
+ "Visual"
1721
+ ]
1722
+ }
1723
+ ),
1724
+ !_ && !N && ge && i && /* @__PURE__ */ o(k, { size: "xs", onClick: Gs, children: [
1725
+ /* @__PURE__ */ e(Rt, { className: "h-3.5 w-3.5" }),
1726
+ "Edit"
1727
+ ] }),
1728
+ La && i && ka && /* @__PURE__ */ o(
1729
+ k,
1730
+ {
1731
+ variant: "outline",
1732
+ size: "xs",
1733
+ onClick: qs,
1734
+ disabled: Ne,
1735
+ children: [
1736
+ /* @__PURE__ */ e(fr, { className: "h-3.5 w-3.5" }),
1737
+ "Undo"
1738
+ ]
1739
+ }
1740
+ ),
1741
+ La && i && /* @__PURE__ */ o(
1742
+ k,
1743
+ {
1744
+ size: "xs",
1745
+ className: Y(!Pa && "opacity-60"),
1746
+ disabled: Ne || !Pa,
1747
+ onClick: () => je(),
1748
+ children: [
1749
+ Ne ? /* @__PURE__ */ e(X, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(Ka, { className: "h-3.5 w-3.5" }),
1750
+ Ne ? "Saving..." : "Save"
1751
+ ]
1752
+ }
1753
+ ),
1754
+ N && !_ && i && /* @__PURE__ */ o(k, { variant: "outline", size: "xs", onClick: $s, children: [
1755
+ /* @__PURE__ */ e(is, { className: "h-3.5 w-3.5" }),
1756
+ "Close"
1757
+ ] }),
1758
+ !_ && i && /* @__PURE__ */ e("div", { className: "ml-2", children: /* @__PURE__ */ e(sr, {}) }),
1759
+ !_ && n && /* @__PURE__ */ e(yr, {}),
1760
+ !_ && i && /* @__PURE__ */ o(Gt, { children: [
1761
+ /* @__PURE__ */ e(Ft, { asChild: !0, children: /* @__PURE__ */ e(
1762
+ Qe,
1763
+ {
1764
+ tooltip: "More Options",
1765
+ className: "w-7 px-0 text-muted-foreground hover:text-foreground",
1766
+ buttonProps: {
1767
+ size: "xs",
1768
+ variant: "ghost",
1769
+ "aria-label": "More dashboard options"
1770
+ },
1771
+ children: /* @__PURE__ */ e($t, { className: "h-3.5 w-3.5" })
1772
+ }
1773
+ ) }),
1774
+ /* @__PURE__ */ o(
1775
+ zt,
1776
+ {
1777
+ align: "end",
1778
+ className: "w-56 rounded-control border border-border/60 p-1 shadow-sm",
1779
+ children: [
1780
+ /* @__PURE__ */ e(oe, { children: "Reports" }),
1781
+ /* @__PURE__ */ o(
1782
+ z,
1783
+ {
1784
+ disabled: u,
1785
+ onSelect: () => Z(!0),
1786
+ children: [
1787
+ /* @__PURE__ */ e(Ht, { className: "h-3.5 w-3.5" }),
1788
+ "Export"
1789
+ ]
1790
+ }
1791
+ ),
1792
+ /* @__PURE__ */ e(Ae, {}),
1793
+ Ts && /* @__PURE__ */ o(O, { children: [
1794
+ /* @__PURE__ */ e(oe, { children: "Access" }),
1795
+ /* @__PURE__ */ o(
1796
+ z,
1797
+ {
1798
+ onClick: () => ce(!0),
1799
+ children: [
1800
+ /* @__PURE__ */ e(fa, { className: "h-3.5 w-3.5" }),
1801
+ "Manage Groups"
1802
+ ]
1803
+ }
1804
+ ),
1805
+ /* @__PURE__ */ e(Ae, {})
1806
+ ] }),
1807
+ /* @__PURE__ */ e(oe, { children: "Preferences" }),
1808
+ /* @__PURE__ */ o(z, { onClick: () => v(!0), children: [
1809
+ /* @__PURE__ */ e(qt, { className: "h-3.5 w-3.5" }),
1810
+ "Calendar Preferences"
1811
+ ] }),
1812
+ n && i && /* @__PURE__ */ o(O, { children: [
1813
+ /* @__PURE__ */ e(Ae, {}),
1814
+ /* @__PURE__ */ e(oe, { children: "Developer" }),
1815
+ /* @__PURE__ */ o(
1816
+ z,
1817
+ {
1818
+ onSelect: () => {
1819
+ var c;
1820
+ a != null && a.accessToken && ((c = navigator == null ? void 0 : navigator.clipboard) != null && c.writeText ? navigator.clipboard.writeText(a.accessToken).then(
1821
+ () => M.success("Token copied to clipboard")
1822
+ ).catch(() => M.error("Unable to copy token")) : M.error("Clipboard not available"));
1823
+ },
1824
+ children: [
1825
+ /* @__PURE__ */ e(ja, { className: "h-3.5 w-3.5" }),
1826
+ "Copy token"
1827
+ ]
1828
+ }
1829
+ ),
1830
+ A && /* @__PURE__ */ o(
1831
+ z,
1832
+ {
1833
+ disabled: !qe,
1834
+ onSelect: () => {
1835
+ var c;
1836
+ if (!qe) {
1837
+ M.error(
1838
+ "Open a document sheet with a token to copy the local PDF URL"
1839
+ );
1840
+ return;
1841
+ }
1842
+ (c = navigator == null ? void 0 : navigator.clipboard) != null && c.writeText ? navigator.clipboard.writeText(qe).then(
1843
+ () => M.success(
1844
+ "Local document PDF URL copied to clipboard"
1845
+ )
1846
+ ).catch(
1847
+ () => M.error(
1848
+ "Unable to copy local document PDF URL"
1849
+ )
1850
+ ) : M.error("Clipboard not available");
1851
+ },
1852
+ children: [
1853
+ /* @__PURE__ */ e(ja, { className: "h-3.5 w-3.5" }),
1854
+ "Copy local document PDF URL"
1855
+ ]
1856
+ }
1857
+ ),
1858
+ /* @__PURE__ */ o(
1859
+ z,
1860
+ {
1861
+ onSelect: () => it(t.apiServiceUrl),
1862
+ children: [
1863
+ /* @__PURE__ */ e(hr, { className: "h-3.5 w-3.5" }),
1864
+ "Invalidate token"
1865
+ ]
1866
+ }
1867
+ ),
1868
+ /* @__PURE__ */ o(z, { onSelect: l, children: [
1869
+ /* @__PURE__ */ e(ir, { className: "h-3.5 w-3.5" }),
1870
+ "Brand Studio"
1871
+ ] }),
1872
+ N && /* @__PURE__ */ o(
1873
+ z,
1874
+ {
1875
+ onSelect: () => Da(!Na),
1876
+ children: [
1877
+ /* @__PURE__ */ e(cr, { className: "h-3.5 w-3.5" }),
1878
+ Na ? "Hide dashboard JSON" : "Show dashboard JSON"
1879
+ ]
1880
+ }
1881
+ ),
1882
+ te && N && /* @__PURE__ */ o(z, { onSelect: () => R(!0), children: [
1883
+ /* @__PURE__ */ e(aa, { className: "h-3.5 w-3.5" }),
1884
+ "Add lens"
1885
+ ] }),
1886
+ te && /* @__PURE__ */ o(Bt, { children: [
1887
+ /* @__PURE__ */ o(jt, { children: [
1888
+ /* @__PURE__ */ e(lr, { className: "h-3.5 w-3.5" }),
1889
+ "Lenses"
1890
+ ] }),
1891
+ /* @__PURE__ */ e(Vt, { className: "w-60", children: /* @__PURE__ */ e(Dr, {}) })
1892
+ ] })
1893
+ ] })
1894
+ ]
1895
+ }
1896
+ )
1897
+ ] }),
1898
+ L && Ea && /* @__PURE__ */ e(
1899
+ Kt,
1900
+ {
1901
+ resource: Ea,
1902
+ resourceType: Ke.DASHBOARD,
1903
+ onClose: () => K(!1)
1904
+ }
1905
+ ),
1906
+ /* @__PURE__ */ e(
1907
+ Kr,
1908
+ {
1909
+ open: _e,
1910
+ onOpenChange: ce
1911
+ }
1912
+ ),
1913
+ /* @__PURE__ */ e(
1914
+ nr,
1915
+ {
1916
+ open: Ue,
1917
+ onOpenChange: v
1918
+ }
1919
+ ),
1920
+ n && te && i && /* @__PURE__ */ e(wr, { open: T, onOpenChange: R }),
1921
+ i && /* @__PURE__ */ e(
1922
+ Qt,
1923
+ {
1924
+ open: Q,
1925
+ onOpenChange: Z
1926
+ }
1927
+ ),
1928
+ /* @__PURE__ */ e(
1929
+ ds,
1930
+ {
1931
+ open: le,
1932
+ onOpenChange: (c) => {
1933
+ !c && $e && !ue || (de(c), c || (me(null), he([]), pe(!1)));
1934
+ },
1935
+ children: /* @__PURE__ */ o(us, { className: "max-w-sm", children: [
1936
+ /* @__PURE__ */ o(ms, { children: [
1937
+ /* @__PURE__ */ e(hs, { children: ue ? "Save failed" : "Saving dashboard" }),
1938
+ /* @__PURE__ */ e(ps, { className: "pt-2", children: ue ? "We could not save the dashboard. Please try again." : "Please wait while we save your changes." }),
1939
+ xa.length > 0 && /* @__PURE__ */ o("div", { className: "space-y-1 rounded-md border border-destructive/20 bg-destructive/5 p-3 text-left", children: [
1940
+ /* @__PURE__ */ e("div", { className: "text-sm font-medium text-destructive", children: "What needs attention" }),
1941
+ /* @__PURE__ */ e("ul", { className: "list-disc space-y-1 pl-4 text-xs text-muted-foreground", children: xa.slice(0, 5).map((c) => /* @__PURE__ */ e("li", { children: c }, c)) })
1942
+ ] })
1943
+ ] }),
1944
+ /* @__PURE__ */ e(fs, { className: "flex-col gap-2 sm:flex-row sm:justify-end", children: ue ? /* @__PURE__ */ o(O, { children: [
1945
+ /* @__PURE__ */ e(
1946
+ gs,
1947
+ {
1948
+ onClick: () => {
1949
+ de(!1), me(null), he([]), pe(!1);
1950
+ },
1951
+ className: "m-0",
1952
+ children: "Close"
1953
+ }
1954
+ ),
1955
+ /* @__PURE__ */ e(
1956
+ ra,
1957
+ {
1958
+ onClick: () => je({
1959
+ closeAfterSave: Sa,
1960
+ navigateHomeAfterSave: He === "home"
1961
+ }),
1962
+ className: "m-0",
1963
+ children: "Retry"
1964
+ }
1965
+ )
1966
+ ] }) : /* @__PURE__ */ o(ra, { disabled: !0, className: "m-0 cursor-default", children: [
1967
+ /* @__PURE__ */ e(X, { className: "mr-2 h-4 w-4 animate-spin" }),
1968
+ "Saving..."
1969
+ ] }) })
1970
+ ] })
1971
+ }
1972
+ ),
1973
+ /* @__PURE__ */ e(
1974
+ tr,
1975
+ {
1976
+ open: Us,
1977
+ onOpenChange: (c) => {
1978
+ ae(c);
1979
+ },
1980
+ onSave: zs,
1981
+ onDiscard: Hs,
1982
+ isSaving: $e,
1983
+ saveLabel: "Save",
1984
+ discardLabel: "Discard"
1985
+ }
1986
+ )
1987
+ ] })
1988
+ ]
1989
+ }
1990
+ );
1991
+ }
1992
+ function Yr({
1993
+ accessToken: a,
1994
+ dashboardId: t,
1995
+ selectedSheetId: r,
1996
+ pageSize: s,
1997
+ orientation: n,
1998
+ theme: l
1999
+ }) {
2000
+ if (!a || !r)
2001
+ return null;
2002
+ const m = new URL("http://localhost:5173/print-document");
2003
+ m.searchParams.set("token", a), t && m.searchParams.set("dashboardId", t), m.searchParams.set("selectedSheetId", r), l && m.searchParams.set("theme", l);
2004
+ const i = new URL("http://127.0.0.1:3002/");
2005
+ return i.searchParams.set("pdfMode", "document"), i.searchParams.set("pageSize", s || "letter"), i.searchParams.set("orientation", n || "portrait"), i.searchParams.set("url", m.toString()), i.toString();
2006
+ }
2007
+ export {
2008
+ hn as default
2009
+ };