react-semaphor 0.1.461 → 0.1.463

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 (37) hide show
  1. package/dist/appearance-runtime/index.cjs +1 -0
  2. package/dist/appearance-runtime/index.js +5 -0
  3. package/dist/brand-studio/index.cjs +1 -1
  4. package/dist/brand-studio/index.js +1 -1
  5. package/dist/chunks/appearance-context-DVXt8qjW.js +126 -0
  6. package/dist/chunks/appearance-context-DhyjbQk1.cjs +1 -0
  7. package/dist/chunks/appearance-runtime-provider-BgNYdUYH.cjs +1 -0
  8. package/dist/chunks/appearance-runtime-provider-CjmE4gBY.js +81 -0
  9. package/dist/chunks/{dashboard-briefing-launcher-3owMxX5K.js → dashboard-briefing-launcher-Dcfh50rg.js} +1264 -1260
  10. package/dist/chunks/dashboard-briefing-launcher-Dyf9-SMG.cjs +26 -0
  11. package/dist/chunks/{dashboard-controls-B4GvjGr1.js → dashboard-controls-Cux9l7G3.js} +8 -6
  12. package/dist/chunks/{dashboard-controls-Bpm_xOXQ.cjs → dashboard-controls-Dk_4fD9Y.cjs} +1 -1
  13. package/dist/chunks/dashboard-json-6vY_UIQ9.cjs +1 -0
  14. package/dist/chunks/{dashboard-json-DzyxoBp-.js → dashboard-json-CLSh4K-P.js} +12 -10
  15. package/dist/chunks/{edit-dashboard-visual-1T278Nr_.cjs → edit-dashboard-visual-BNNbxMoA.cjs} +28 -28
  16. package/dist/chunks/{edit-dashboard-visual-nwSasO_j.js → edit-dashboard-visual-WYIa0u5O.js} +854 -852
  17. package/dist/chunks/{editor-action-buttons-CX1Pken3.cjs → editor-action-buttons-B1QYcu9f.cjs} +1 -1
  18. package/dist/chunks/{editor-action-buttons-Dqw0asfA.js → editor-action-buttons-DfKOZoQs.js} +2 -2
  19. package/dist/chunks/{index-B1qplNxl.cjs → index-BnsIn34X.cjs} +183 -183
  20. package/dist/chunks/{index-DazD5k0F.js → index-BxQ_lHnZ.js} +28144 -28185
  21. package/dist/chunks/{report-preferences-dialog-DKPyjiCt.cjs → report-preferences-dialog-Cd7yCULW.cjs} +1 -1
  22. package/dist/chunks/{report-preferences-dialog-Dv3vCCFt.js → report-preferences-dialog-jy8Ck1pK.js} +2 -2
  23. package/dist/chunks/{switch-DBZsEV0U.cjs → switch-CNqDn5b8.cjs} +26 -26
  24. package/dist/chunks/{switch-kPUJEC1A.js → switch-G_-UwdXX.js} +2721 -2842
  25. package/dist/dashboard/index.cjs +1 -1
  26. package/dist/dashboard/index.js +1 -1
  27. package/dist/data-app-builder/index.cjs +1 -1
  28. package/dist/data-app-builder/index.js +2 -2
  29. package/dist/index.cjs +1 -1
  30. package/dist/index.js +152 -150
  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/appearance-runtime.d.ts +151 -0
  35. package/package.json +8 -2
  36. package/dist/chunks/dashboard-briefing-launcher-xuGrw8H3.cjs +0 -26
  37. package/dist/chunks/dashboard-json-yLM01xK4.cjs +0 -1
@@ -1,17 +1,19 @@
1
1
  import { jsx as e, jsxs as r, Fragment as W } from "react/jsx-runtime";
2
- import jt, { useState as E, useEffect as J, useMemo as ee, useContext as Wt, useRef as he, useCallback as q } from "react";
3
- import { aH as Se, aI as De, aK as ke, bb as yt, bY as Ht, cm as Gt, cn as Kt, aZ as fe, ca as Ct, bl as Ve, s as qt, o as Xt, co as Zt, aP as Je, aS as et, aT as tt, aU as rt, aV as at, aW as nt, aX as st, aY as wt, bk as ot, aG as O, cp as Qt, cq as Yt, cr as Ke, cb as Oe, cc as ze, cs as Nt, cd as _e, bW as K, b1 as Jt, bB as Re, ct as er, bV as tr, aJ as it, aL as lt, cu as rr, aF as ar, ba as nr, bw as St, cv as sr, bZ as or, u as ir, aM as lr, b3 as cr, az as $e, O as ue, aw as ct, as as Dt, at as dt, P as kt, ar as dr, ay as ur, ch as hr, cw as mr, bu as pr, au as pt, R as fr, T as gr, cx as br, cy as xr, cz as vr, cA as yr, cB as Cr, cC as wr, cD as Nr, cE as At, cF as Sr, b4 as Dr, cG as kr, ce as Et, cH as Ar, cI as Er, cJ as Be, cK as Ir, cL as Fr, cM as Lr, an as Br, ap as Tr, a3 as Vr, a2 as Rr, a1 as Ur, a0 as Pr, Z as Mr, X as Or, cN as zr, cO as _r, cP as $r, cQ as jr, cR as Wr, al as Hr, cS as Gr, cT as Kr, a9 as qr, cU as Xr, cV as Zr, cW as Qr } from "./index-DazD5k0F.js";
4
- import { B, O as Ne, Z as Qe, L as te, M as It, d as Ft, c as X, K as Yr, D as ge, u as P, z as be, aw as Lt, av as Ye, E as Bt, P as Ue, a as Pe, b as Me, aH as Jr, aI as ea, S as Tt, aJ as ta, aK as ra, aL as aa, aM as na, aF as sa } from "./switch-kPUJEC1A.js";
5
- import { L as ut } from "./layout-grid-CiubineE.js";
6
- import { c as Ae, X as je, C as Vt } from "./x-CXDkqdur.js";
7
- import { u as ht, V as oa, E as qe, a as Xe, b as ia, c as la, L as ca, d as da, e as Rt, C as Ut, F as ua, f as ha } from "./editor-action-buttons-Dqw0asfA.js";
8
- import { v as ft } from "./saved-temporal-bucket-format-Dd2eixTH.js";
2
+ import Wt, { useState as E, useEffect as Q, useMemo as ee, useContext as Ht, useRef as he, useCallback as K } from "react";
3
+ import { cm as et, aH as De, aI as ke, aK as Ae, bb as wt, bY as Gt, cn as Kt, co as qt, aZ as fe, ca as Nt, bl as Pe, s as Xt, o as Zt, cp as Qt, aP as tt, aS as rt, aT as at, aU as nt, aV as st, aW as ot, aX as it, aY as St, bk as lt, aG as O, cq as Yt, cr as Jt, cs as qe, cb as $e, cc as je, ct as Dt, cd as We, bW as G, b1 as er, bB as Me, cu as tr, bV as rr, aJ as ct, aL as dt, cv as ar, aF as nr, ba as sr, bw as kt, cw as or, bZ as ir, u as lr, aM as cr, b3 as dr, az as He, O as ue, aw as ut, as as At, at as ht, P as Et, ar as ur, ay as hr, ch as mr, cx as pr, bu as fr, au as gt, R as gr, T as br, cy as xr, cz as vr, cA as yr, cB as Cr, cC as wr, cD as Nr, cE as It, cF as Sr, b4 as Dr, cG as kr, ce as Ft, cH as Ar, cI as Er, cJ as Re, cK as Ir, cL as Fr, cM as Lr, an as Br, ap as Tr, a3 as Vr, a2 as Rr, a1 as Ur, a0 as Pr, Z as Mr, X as Or, cN as _r, cO as zr, cP as $r, cQ as jr, cR as Wr, al as Hr, cS as Gr, cT as Kr, a9 as qr, cU as Xr, cV as Zr, cW as Qr } from "./index-BxQ_lHnZ.js";
4
+ import { B, O as Se, Z as Ye, L as te, M as Lt, d as Bt, c as q, K as Yr, D as ge, u as P, z as be, aw as Tt, av as Je, E as Vt, P as Oe, a as _e, b as ze, aH as Jr, aI as ea, S as Rt, aJ as ta, aK as ra, aL as aa, aM as na, aF as sa } from "./switch-G_-UwdXX.js";
5
+ import { L as mt } from "./layout-grid-CiubineE.js";
6
+ import { c as Ee, X as Ge, C as Ut } from "./x-CXDkqdur.js";
7
+ import { u as pt, V as oa, E as Xe, a as Ze, b as ia, c as la, L as ca, d as da, e as Pt, C as Mt, F as ua, f as ha } from "./editor-action-buttons-DfKOZoQs.js";
8
+ import { v as bt } from "./saved-temporal-bucket-format-Dd2eixTH.js";
9
9
  import "./validators-DVd8s3qY.js";
10
10
  import "./analyze-result-contract-DROq4vgY.js";
11
11
  import "../value-format-preferences/index.js";
12
12
  import { S as ma } from "./search-BHsQIWBV.js";
13
13
  import { M as pa } from "./mouse-pointer-2-BZvGk45-.js";
14
- import { u as gt } from "./pivot-header-presentation-DW0gKG8g.js";
14
+ import { u as xt } from "./pivot-header-presentation-DW0gKG8g.js";
15
+ import "./appearance-runtime-provider-CjmE4gBY.js";
16
+ import "./appearance-context-DVXt8qjW.js";
15
17
  import "./index-DSKR3nKn.js";
16
18
  import "./temporal-bucket-authoring-1fZuPAVb.js";
17
19
  import "./color-CJvdlFM_.js";
@@ -23,7 +25,7 @@ import { g as se, d as fa, a as ga } from "./index-De_7nrwb.js";
23
25
  * This source code is licensed under the ISC license.
24
26
  * See the LICENSE file in the root directory of this source tree.
25
27
  */
26
- const ba = Ae("ArrowUpRight", [
28
+ const ba = Ee("ArrowUpRight", [
27
29
  ["path", { d: "M7 7h10v10", key: "1tivn9" }],
28
30
  ["path", { d: "M7 17 17 7", key: "1vkiza" }]
29
31
  ]);
@@ -33,7 +35,7 @@ const ba = Ae("ArrowUpRight", [
33
35
  * This source code is licensed under the ISC license.
34
36
  * See the LICENSE file in the root directory of this source tree.
35
37
  */
36
- const xa = Ae("CalendarRange", [
38
+ const xa = Ee("CalendarRange", [
37
39
  ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
38
40
  ["path", { d: "M16 2v4", key: "4m81vk" }],
39
41
  ["path", { d: "M3 10h18", key: "8toen8" }],
@@ -49,7 +51,7 @@ const xa = Ae("CalendarRange", [
49
51
  * This source code is licensed under the ISC license.
50
52
  * See the LICENSE file in the root directory of this source tree.
51
53
  */
52
- const va = Ae("CircleX", [
54
+ const va = Ee("CircleX", [
53
55
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
54
56
  ["path", { d: "m15 9-6 6", key: "1uzhvr" }],
55
57
  ["path", { d: "m9 9 6 6", key: "z0biqf" }]
@@ -60,7 +62,7 @@ const va = Ae("CircleX", [
60
62
  * This source code is licensed under the ISC license.
61
63
  * See the LICENSE file in the root directory of this source tree.
62
64
  */
63
- const bt = Ae("FileDown", [
65
+ const vt = Ee("FileDown", [
64
66
  ["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
65
67
  ["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
66
68
  ["path", { d: "M12 18v-6", key: "17g6i2" }],
@@ -72,7 +74,7 @@ const bt = Ae("FileDown", [
72
74
  * This source code is licensed under the ISC license.
73
75
  * See the LICENSE file in the root directory of this source tree.
74
76
  */
75
- const ya = Ae("Newspaper", [
77
+ const ya = Ee("Newspaper", [
76
78
  [
77
79
  "path",
78
80
  {
@@ -103,29 +105,30 @@ function Ca() {
103
105
  function wa({
104
106
  open: t,
105
107
  onOpenChange: a,
106
- onSubmit: i,
107
- isCreating: s
108
+ onSubmit: o,
109
+ isCreating: n
108
110
  }) {
109
- const [n, c] = E(""), [u, m] = E("");
110
- J(() => {
111
- t || (c(""), m(""));
111
+ const i = et("interactive"), [s, d] = E(""), [p, l] = E("");
112
+ Q(() => {
113
+ t || (d(""), l(""));
112
114
  }, [t]);
113
- const l = () => {
114
- n.trim() && i({ title: n, description: u });
115
- }, d = (o) => {
116
- a(o);
115
+ const u = () => {
116
+ s.trim() && o({ title: s, description: p });
117
+ }, c = (m) => {
118
+ a(m);
117
119
  };
118
- return /* @__PURE__ */ e(Se, { open: t, onOpenChange: d, children: /* @__PURE__ */ r(
119
- De,
120
+ return /* @__PURE__ */ e(De, { open: t, onOpenChange: c, children: /* @__PURE__ */ r(
121
+ ke,
120
122
  {
121
123
  showCloseButton: !1,
122
- className: "flex max-w-lg grid-cols-none flex-col gap-0 overflow-hidden rounded-[6px] border-border/60 p-0 shadow-lg",
124
+ className: "flex max-w-lg grid-cols-none flex-col gap-0 overflow-hidden rounded-card border-border/60 p-0 shadow-lg sm:rounded-card",
125
+ style: i.dialogStyle,
123
126
  children: [
124
127
  /* @__PURE__ */ r("div", { className: "flex h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3", children: [
125
128
  /* @__PURE__ */ r("div", { className: "flex min-w-0 items-center gap-2", children: [
126
- /* @__PURE__ */ e(ut, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
129
+ /* @__PURE__ */ e(mt, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
127
130
  /* @__PURE__ */ r("div", { className: "flex min-w-0 items-baseline gap-2", children: [
128
- /* @__PURE__ */ e(ke, { className: "truncate text-[13px] font-medium leading-none tracking-normal", children: "New library visual" }),
131
+ /* @__PURE__ */ e(Ae, { className: "truncate text-[13px] font-medium leading-none tracking-normal", children: "New library visual" }),
129
132
  /* @__PURE__ */ e("span", { className: "shrink-0 text-[10px] font-medium uppercase leading-none tracking-[0.08em] text-muted-foreground", children: "Visual" })
130
133
  ] })
131
134
  ] }),
@@ -135,43 +138,43 @@ function wa({
135
138
  size: "xs",
136
139
  variant: "ghost",
137
140
  className: "w-7 px-0 text-muted-foreground hover:text-foreground",
138
- onClick: () => d(!1),
141
+ onClick: () => c(!1),
139
142
  "aria-label": "Close",
140
- disabled: s,
141
- children: /* @__PURE__ */ e(je, { className: "h-3.5 w-3.5" })
143
+ disabled: n,
144
+ children: /* @__PURE__ */ e(Ge, { className: "h-3.5 w-3.5" })
142
145
  }
143
146
  )
144
147
  ] }),
145
148
  /* @__PURE__ */ r("div", { className: "space-y-3 px-4 py-3", children: [
146
149
  /* @__PURE__ */ e("p", { className: "text-[12px] text-muted-foreground", children: "Create a saved visual that can be reused across dashboards." }),
147
150
  /* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
148
- /* @__PURE__ */ e(Ne, { htmlFor: "visual-title", className: "text-[12px]", children: "Name" }),
151
+ /* @__PURE__ */ e(Se, { htmlFor: "visual-title", className: "text-[12px]", children: "Name" }),
149
152
  /* @__PURE__ */ e(
150
- Qe,
153
+ Ye,
151
154
  {
152
155
  id: "visual-title",
153
156
  size: "sm",
154
157
  placeholder: "Untitled visual",
155
- value: n,
156
- onChange: (o) => c(o.target.value),
157
- disabled: s,
158
- onKeyDown: (o) => {
159
- o.key === "Enter" && !o.shiftKey && (o.preventDefault(), l());
158
+ value: s,
159
+ onChange: (m) => d(m.target.value),
160
+ disabled: n,
161
+ onKeyDown: (m) => {
162
+ m.key === "Enter" && !m.shiftKey && (m.preventDefault(), u());
160
163
  }
161
164
  }
162
165
  )
163
166
  ] }),
164
167
  /* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
165
- /* @__PURE__ */ e(Ne, { htmlFor: "visual-description", className: "text-[12px]", children: "Description" }),
168
+ /* @__PURE__ */ e(Se, { htmlFor: "visual-description", className: "text-[12px]", children: "Description" }),
166
169
  /* @__PURE__ */ e(
167
- Qe,
170
+ Ye,
168
171
  {
169
172
  id: "visual-description",
170
173
  size: "sm",
171
174
  placeholder: "Optional",
172
- value: u,
173
- onChange: (o) => m(o.target.value),
174
- disabled: s
175
+ value: p,
176
+ onChange: (m) => l(m.target.value),
177
+ disabled: n
175
178
  }
176
179
  )
177
180
  ] })
@@ -182,8 +185,8 @@ function wa({
182
185
  {
183
186
  size: "xs",
184
187
  variant: "outline",
185
- onClick: () => d(!1),
186
- disabled: s,
188
+ onClick: () => c(!1),
189
+ disabled: n,
187
190
  children: "Cancel"
188
191
  }
189
192
  ),
@@ -191,9 +194,9 @@ function wa({
191
194
  B,
192
195
  {
193
196
  size: "xs",
194
- onClick: l,
195
- disabled: !n.trim() || s,
196
- children: s ? /* @__PURE__ */ r(W, { children: [
197
+ onClick: u,
198
+ disabled: !s.trim() || n,
199
+ children: n ? /* @__PURE__ */ r(W, { children: [
197
200
  /* @__PURE__ */ e(te, { className: "h-3.5 w-3.5 animate-spin" }),
198
201
  "Creating..."
199
202
  ] }) : "Create library visual"
@@ -204,189 +207,190 @@ function wa({
204
207
  }
205
208
  ) });
206
209
  }
207
- function Pt(t) {
210
+ function Ot(t) {
208
211
  return t ? new Date(t).toLocaleDateString("en-US", {
209
212
  month: "short",
210
213
  day: "numeric",
211
214
  year: "numeric"
212
215
  }) : "Unknown";
213
216
  }
214
- function Mt(t, a) {
215
- var s;
216
- const i = (s = t.ownership.createdBy) == null ? void 0 : s.type;
217
- return i === "tenant" || i === "organization" && a;
217
+ function _t(t, a) {
218
+ var n;
219
+ const o = (n = t.ownership.createdBy) == null ? void 0 : n.type;
220
+ return o === "tenant" || o === "organization" && a;
218
221
  }
219
- function mt(t, a) {
220
- var i, s;
221
- return Mt(t, a) ? ((i = t.ownership.createdBy) == null ? void 0 : i.name) || ((s = t.createdByTenantUserRel) == null ? void 0 : s.name) || t.lastModifiedBy || "Unknown" : "Organization";
222
+ function ft(t, a) {
223
+ var o, n;
224
+ return _t(t, a) ? ((o = t.ownership.createdBy) == null ? void 0 : o.name) || ((n = t.createdByTenantUserRel) == null ? void 0 : n.name) || t.lastModifiedBy || "Unknown" : "Organization";
222
225
  }
223
226
  function Na(t, a) {
224
- return mt(t, a).split(/\s+/).filter(Boolean).slice(0, 2).map((s) => s.charAt(0).toUpperCase()).join("") || "?";
227
+ return ft(t, a).split(/\s+/).filter(Boolean).slice(0, 2).map((n) => n.charAt(0).toUpperCase()).join("") || "?";
225
228
  }
226
229
  function Sa(t) {
227
230
  const a = (t || "").toLowerCase();
228
- return a.includes("table") ? It : a.includes("pie") || a.includes("donut") ? Qt : a.includes("line") ? Yt : a.includes("bar") ? Yr : ut;
231
+ return a.includes("table") ? Lt : a.includes("pie") || a.includes("donut") ? Yt : a.includes("line") ? Jt : a.includes("bar") ? Yr : mt;
229
232
  }
230
233
  function Da({ visual: t }) {
231
234
  const a = t.ownership.status === "public" ? "Public" : t.ownership.status === "shared" || t.ownership.sharedCount > 0 ? "Shared" : "Private";
232
235
  return /* @__PURE__ */ e("span", { className: "inline-flex items-center rounded-[4px] border border-border/60 px-1.5 py-px text-[11px] text-muted-foreground", children: a });
233
236
  }
234
- function _n({
237
+ function jn({
235
238
  open: t,
236
239
  onOpenChange: a
237
240
  }) {
238
- const [i, s] = E(""), [n, c] = E(/* @__PURE__ */ new Set()), [u, m] = E(!1), [l, d] = E(
241
+ const o = et("interactive"), [n, i] = E(""), [s, d] = E(/* @__PURE__ */ new Set()), [p, l] = E(!1), [u, c] = E(
239
242
  null
240
- ), [o, f] = E(
243
+ ), [m, h] = E(
241
244
  null
242
- ), [h, p] = E(!1), [C, y] = E(null), [D, I] = E(null), N = () => {
243
- c(/* @__PURE__ */ new Set()), d(null), f(null), p(!1), y(null);
244
- }, g = () => {
245
- a(!1), N();
246
- }, { selectVisual: S } = yt(), { handleAddLibraryVisual: k, handleEditLibraryVisual: U } = ht(), { isConsoleMode: b } = Ht(), {
247
- resources: x,
248
- isLoading: T,
249
- isError: F,
250
- createResource: H,
251
- updateResource: A,
252
- deleteResourceAsync: V,
253
- duplicateResource: j,
254
- isCreating: xe,
255
- isDeleting: G
256
- } = Gt(
245
+ ), [f, x] = E(!1), [C, N] = E(null), [I, D] = E(null), b = () => {
246
+ d(/* @__PURE__ */ new Set()), c(null), h(null), x(!1), N(null);
247
+ }, S = () => {
248
+ a(!1), b();
249
+ }, { selectVisual: A } = wt(), { handleAddLibraryVisual: U, handleEditLibraryVisual: g } = pt(), { isConsoleMode: v } = Gt(), {
250
+ resources: T,
251
+ isLoading: F,
252
+ isError: H,
253
+ createResource: k,
254
+ updateResource: V,
255
+ deleteResourceAsync: $,
256
+ duplicateResource: xe,
257
+ isCreating: re,
258
+ isDeleting: oe
259
+ } = Kt(
257
260
  void 0,
258
- (v) => {
259
- m(!1), v && (S(v), U(v), g());
261
+ (y) => {
262
+ l(!1), y && (A(y), g(y), S());
260
263
  }
261
264
  ), {
262
- startUpdating: We,
263
- stopUpdating: ve,
264
- isUpdating: He
265
- } = Kt(), Q = x, z = ee(() => {
266
- const v = i.trim().toLowerCase();
267
- return v ? Q.filter(
265
+ startUpdating: Ie,
266
+ stopUpdating: Fe,
267
+ isUpdating: ie
268
+ } = qt(), j = T, Y = ee(() => {
269
+ const y = n.trim().toLowerCase();
270
+ return y ? j.filter(
268
271
  (L) => {
269
- var M, ae, oe;
270
- return ((M = L.title) == null ? void 0 : M.toLowerCase().includes(v)) || ((ae = L.description) == null ? void 0 : ae.toLowerCase().includes(v)) || ((oe = L.kind) == null ? void 0 : oe.toLowerCase().includes(v));
272
+ var M, ae, ce;
273
+ return ((M = L.title) == null ? void 0 : M.toLowerCase().includes(y)) || ((ae = L.description) == null ? void 0 : ae.toLowerCase().includes(y)) || ((ce = L.kind) == null ? void 0 : ce.toLowerCase().includes(y));
271
274
  }
272
- ) : Q;
273
- }, [i, Q]), re = ee(
274
- () => Q.filter(
275
- (v) => n.has(v.id)
275
+ ) : j;
276
+ }, [n, j]), le = ee(
277
+ () => j.filter(
278
+ (y) => s.has(y.id)
276
279
  ),
277
- [n, Q]
278
- ), ie = re.filter(
279
- (v) => v.permissions.canDelete
280
- ), le = re.filter(
281
- (v) => v.permissions.canShare
282
- ), ye = z.length > 0 && z.every(
283
- (v) => n.has(v.id)
284
- ), Ee = z.some(
285
- (v) => n.has(v.id)
286
- ), ce = (v) => {
287
- const L = new Set(n);
288
- v(L), c(L);
289
- }, me = (v) => {
290
- ce((L) => {
291
- L.has(v) ? L.delete(v) : L.add(v);
280
+ [s, j]
281
+ ), J = le.filter(
282
+ (y) => y.permissions.canDelete
283
+ ), Le = le.filter(
284
+ (y) => y.permissions.canShare
285
+ ), ve = Y.length > 0 && Y.every(
286
+ (y) => s.has(y.id)
287
+ ), de = Y.some(
288
+ (y) => s.has(y.id)
289
+ ), me = (y) => {
290
+ const L = new Set(s);
291
+ y(L), d(L);
292
+ }, Z = (y) => {
293
+ me((L) => {
294
+ L.has(y) ? L.delete(y) : L.add(y);
292
295
  });
293
- }, Y = () => {
294
- c((v) => {
295
- const L = new Set(v);
296
- return ye ? z.forEach(
296
+ }, ye = () => {
297
+ d((y) => {
298
+ const L = new Set(y);
299
+ return ve ? Y.forEach(
297
300
  (M) => L.delete(M.id)
298
- ) : z.forEach(
301
+ ) : Y.forEach(
299
302
  (M) => L.add(M.id)
300
303
  ), L;
301
304
  });
302
- }, Ce = async (v) => {
303
- (await k(v)).success && g();
304
- }, _ = async () => {
305
- const v = re;
306
- if (v.length === 0) return;
305
+ }, _ = async (y) => {
306
+ (await U(y)).success && S();
307
+ }, z = async () => {
308
+ const y = le;
309
+ if (y.length === 0) return;
307
310
  let L = !1;
308
- for (const M of v)
309
- if (!(await k(M)).success) {
311
+ for (const M of y)
312
+ if (!(await U(M)).success) {
310
313
  L = !0;
311
314
  break;
312
315
  }
313
- L || g();
314
- }, $ = (v) => {
315
- U(v), g();
316
- }, ne = (v) => {
317
- I(v), j(v, {
318
- onSettled: () => I(null)
316
+ L || S();
317
+ }, ne = (y) => {
318
+ g(y), S();
319
+ }, pe = (y) => {
320
+ D(y), xe(y, {
321
+ onSettled: () => D(null)
319
322
  });
320
- }, pe = () => {
321
- if (ie.length === 0) {
323
+ }, Be = () => {
324
+ if (J.length === 0) {
322
325
  O.error("Select a visual you can delete");
323
326
  return;
324
327
  }
325
- y(null), p(!0);
326
- }, Ie = async () => {
327
- const v = C ? [C] : ie;
328
+ N(null), x(!0);
329
+ }, Ke = async () => {
330
+ const y = C ? [C] : J;
328
331
  try {
329
- for (const L of v)
330
- await V(L.id);
331
- c((L) => {
332
+ for (const L of y)
333
+ await $(L.id);
334
+ d((L) => {
332
335
  const M = new Set(L);
333
- return v.forEach(
336
+ return y.forEach(
334
337
  (ae) => M.delete(ae.id)
335
338
  ), M;
336
- }), p(!1), y(null);
339
+ }), x(!1), N(null);
337
340
  } catch {
338
341
  }
339
- }, Ge = () => {
340
- if (re.length !== 1) {
342
+ }, Ce = () => {
343
+ if (le.length !== 1) {
341
344
  O.error("Select one visual to share");
342
345
  return;
343
346
  }
344
- const [v] = re;
345
- if (!v.permissions.canShare) {
347
+ const [y] = le;
348
+ if (!y.permissions.canShare) {
346
349
  O.error("You do not have permission to share this visual");
347
350
  return;
348
351
  }
349
- d(v);
352
+ c(y);
350
353
  }, we = ({
351
- title: v,
354
+ title: y,
352
355
  description: L
353
356
  }) => {
354
- if (!o) return;
357
+ if (!m) return;
355
358
  const M = {};
356
- if (v !== o.title && (M.title = v), (o.description || "") !== L && (M.description = L), Object.keys(M).length === 0) {
357
- f(null);
359
+ if (y !== m.title && (M.title = y), (m.description || "") !== L && (M.description = L), Object.keys(M).length === 0) {
360
+ h(null);
358
361
  return;
359
362
  }
360
- const ae = Object.keys(M), oe = ae.length === 1 ? ae[0] : void 0;
361
- We(o.id, oe), A(
363
+ const ae = Object.keys(M), ce = ae.length === 1 ? ae[0] : void 0;
364
+ Ie(m.id, ce), V(
362
365
  {
363
- resourceId: o.id,
366
+ resourceId: m.id,
364
367
  data: M
365
368
  },
366
369
  {
367
370
  onSuccess: () => {
368
- ve(o.id, oe), f(null);
371
+ Fe(m.id, ce), h(null);
369
372
  },
370
373
  onError: () => {
371
- ve(o.id, oe);
374
+ Fe(m.id, ce);
372
375
  }
373
376
  }
374
377
  );
375
- }, de = (v) => {
376
- a(v), v || N();
377
- }, Z = C ? 1 : ie.length;
378
+ }, X = (y) => {
379
+ a(y), y || b();
380
+ }, Ne = C ? 1 : J.length;
378
381
  return /* @__PURE__ */ r(W, { children: [
379
- /* @__PURE__ */ e(Se, { open: t, onOpenChange: de, children: /* @__PURE__ */ r(
380
- De,
382
+ /* @__PURE__ */ e(De, { open: t, onOpenChange: X, children: /* @__PURE__ */ r(
383
+ ke,
381
384
  {
382
385
  showCloseButton: !1,
383
- className: "flex max-h-[80vh] w-[min(72rem,calc(100vw-2rem))] max-w-none grid-cols-none flex-col gap-0 overflow-hidden rounded-[6px] border-border/60 p-0 shadow-lg",
386
+ className: "flex max-h-[80vh] w-[min(72rem,calc(100vw-2rem))] max-w-none grid-cols-none flex-col gap-0 overflow-hidden rounded-card border-border/60 p-0 shadow-lg sm:rounded-card",
387
+ style: o.dialogStyle,
384
388
  children: [
385
389
  /* @__PURE__ */ r("div", { className: "flex h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3", children: [
386
390
  /* @__PURE__ */ r("div", { className: "flex min-w-0 items-center gap-2", children: [
387
- /* @__PURE__ */ e(It, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
391
+ /* @__PURE__ */ e(Lt, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
388
392
  /* @__PURE__ */ r("div", { className: "flex min-w-0 items-baseline gap-2", children: [
389
- /* @__PURE__ */ e(ke, { className: "truncate text-[13px] font-medium leading-none tracking-normal", children: "Visuals library" }),
393
+ /* @__PURE__ */ e(Ae, { className: "truncate text-[13px] font-medium leading-none tracking-normal", children: "Visuals library" }),
390
394
  /* @__PURE__ */ e("span", { className: "shrink-0 text-[10px] font-medium uppercase leading-none tracking-[0.08em] text-muted-foreground", children: "Add to dashboard" })
391
395
  ] })
392
396
  ] }),
@@ -396,7 +400,7 @@ function _n({
396
400
  size: "xs",
397
401
  variant: "ghost",
398
402
  className: "w-7 px-0 text-muted-foreground hover:text-foreground",
399
- onClick: () => de(!1),
403
+ onClick: () => X(!1),
400
404
  "aria-label": "Close visuals library",
401
405
  children: "×"
402
406
  }
@@ -409,8 +413,8 @@ function _n({
409
413
  "input",
410
414
  {
411
415
  autoFocus: !0,
412
- value: i,
413
- onChange: (v) => s(v.target.value),
416
+ value: n,
417
+ onChange: (y) => i(y.target.value),
414
418
  placeholder: "Search visuals...",
415
419
  className: "h-7 w-full rounded-control border border-input bg-background pl-7 pr-2 text-[12px] text-foreground placeholder:text-muted-foreground focus:border-ring focus:outline-none",
416
420
  "aria-label": "Search visuals"
@@ -423,7 +427,7 @@ function _n({
423
427
  size: "xs",
424
428
  variant: "outline",
425
429
  className: "ml-auto",
426
- onClick: () => m(!0),
430
+ onClick: () => l(!0),
427
431
  children: [
428
432
  /* @__PURE__ */ e(fe, { className: "h-3.5 w-3.5" }),
429
433
  "New library visual"
@@ -431,36 +435,36 @@ function _n({
431
435
  }
432
436
  )
433
437
  ] }),
434
- /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-auto", children: T ? /* @__PURE__ */ e("div", { className: "p-3", children: /* @__PURE__ */ e(Ca, {}) }) : F ? /* @__PURE__ */ e("div", { className: "flex flex-col items-center gap-2 px-4 py-12 text-center", children: /* @__PURE__ */ e("p", { className: "text-[13px] text-destructive", children: "Failed to load visuals" }) }) : z.length === 0 ? /* @__PURE__ */ r("div", { className: "flex flex-col items-center gap-2 px-4 py-12 text-center", children: [
435
- /* @__PURE__ */ e(ut, { className: "h-5 w-5 text-muted-foreground/60" }),
436
- /* @__PURE__ */ e("p", { className: "text-[13px] font-medium", children: i ? "No visuals found" : "No visuals yet" }),
437
- /* @__PURE__ */ e("p", { className: "text-[12px] text-muted-foreground", children: i ? "Try a different search." : "Create a saved visual to add it here." })
438
+ /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-auto", children: F ? /* @__PURE__ */ e("div", { className: "p-3", children: /* @__PURE__ */ e(Ca, {}) }) : H ? /* @__PURE__ */ e("div", { className: "flex flex-col items-center gap-2 px-4 py-12 text-center", children: /* @__PURE__ */ e("p", { className: "text-[13px] text-destructive", children: "Failed to load visuals" }) }) : Y.length === 0 ? /* @__PURE__ */ r("div", { className: "flex flex-col items-center gap-2 px-4 py-12 text-center", children: [
439
+ /* @__PURE__ */ e(mt, { className: "h-5 w-5 text-muted-foreground/60" }),
440
+ /* @__PURE__ */ e("p", { className: "text-[13px] font-medium", children: n ? "No visuals found" : "No visuals yet" }),
441
+ /* @__PURE__ */ e("p", { className: "text-[12px] text-muted-foreground", children: n ? "Try a different search." : "Create a saved visual to add it here." })
438
442
  ] }) : /* @__PURE__ */ e(
439
443
  ka,
440
444
  {
441
- visuals: z,
442
- selectedIds: n,
443
- allFilteredSelected: ye,
444
- someFilteredSelected: Ee,
445
- onSelectAll: Y,
446
- onToggleSelection: me,
447
- onAddVisual: Ce,
448
- onOpenVisual: $,
449
- onEditDetails: f,
450
- onShareVisual: d,
451
- onDeleteVisual: (v) => {
452
- y(v), p(!0);
445
+ visuals: Y,
446
+ selectedIds: s,
447
+ allFilteredSelected: ve,
448
+ someFilteredSelected: de,
449
+ onSelectAll: ye,
450
+ onToggleSelection: Z,
451
+ onAddVisual: _,
452
+ onOpenVisual: ne,
453
+ onEditDetails: h,
454
+ onShareVisual: c,
455
+ onDeleteVisual: (y) => {
456
+ N(y), x(!0);
453
457
  },
454
- onDuplicateVisual: ne,
455
- duplicatingId: D,
456
- isDeleting: G,
457
- isConsoleMode: b
458
+ onDuplicateVisual: pe,
459
+ duplicatingId: I,
460
+ isDeleting: oe,
461
+ isConsoleMode: v
458
462
  }
459
463
  ) }),
460
464
  /* @__PURE__ */ r("div", { className: "flex shrink-0 items-center justify-between gap-2 border-t border-border/60 px-3 py-2", children: [
461
- /* @__PURE__ */ e("div", { className: "flex min-w-0 items-center gap-1.5", children: n.size > 0 && /* @__PURE__ */ r(W, { children: [
465
+ /* @__PURE__ */ e("div", { className: "flex min-w-0 items-center gap-1.5", children: s.size > 0 && /* @__PURE__ */ r(W, { children: [
462
466
  /* @__PURE__ */ r("span", { className: "text-[12px] text-muted-foreground", children: [
463
- /* @__PURE__ */ e("span", { className: "font-medium tabular-nums text-foreground", children: n.size }),
467
+ /* @__PURE__ */ e("span", { className: "font-medium tabular-nums text-foreground", children: s.size }),
464
468
  " ",
465
469
  "selected"
466
470
  ] }),
@@ -469,7 +473,7 @@ function _n({
469
473
  {
470
474
  size: "xs",
471
475
  variant: "ghost",
472
- onClick: () => c(/* @__PURE__ */ new Set()),
476
+ onClick: () => d(/* @__PURE__ */ new Set()),
473
477
  children: "Clear"
474
478
  }
475
479
  ),
@@ -478,10 +482,10 @@ function _n({
478
482
  {
479
483
  size: "xs",
480
484
  variant: "outline",
481
- onClick: Ge,
482
- disabled: re.length !== 1 || le.length !== 1,
485
+ onClick: Ce,
486
+ disabled: le.length !== 1 || Le.length !== 1,
483
487
  children: [
484
- /* @__PURE__ */ e(Ct, { className: "h-3.5 w-3.5" }),
488
+ /* @__PURE__ */ e(Nt, { className: "h-3.5 w-3.5" }),
485
489
  "Share"
486
490
  ]
487
491
  }
@@ -492,12 +496,12 @@ function _n({
492
496
  size: "xs",
493
497
  variant: "outline",
494
498
  className: "text-destructive hover:text-destructive",
495
- onClick: pe,
496
- disabled: ie.length === 0,
499
+ onClick: Be,
500
+ disabled: J.length === 0,
497
501
  children: [
498
- /* @__PURE__ */ e(Ve, { className: "h-3.5 w-3.5" }),
502
+ /* @__PURE__ */ e(Pe, { className: "h-3.5 w-3.5" }),
499
503
  "Delete ",
500
- ie.length || n.size
504
+ J.length || s.size
501
505
  ]
502
506
  }
503
507
  )
@@ -508,7 +512,7 @@ function _n({
508
512
  {
509
513
  size: "xs",
510
514
  variant: "outline",
511
- onClick: () => de(!1),
515
+ onClick: () => X(!1),
512
516
  children: "Close"
513
517
  }
514
518
  ),
@@ -516,11 +520,11 @@ function _n({
516
520
  B,
517
521
  {
518
522
  size: "xs",
519
- onClick: _,
520
- disabled: n.size === 0,
523
+ onClick: z,
524
+ disabled: s.size === 0,
521
525
  children: [
522
- /* @__PURE__ */ e(Ft, { className: "h-3.5 w-3.5" }),
523
- n.size === 0 ? "Add to dashboard" : `Add ${n.size} visual${n.size === 1 ? "" : "s"}`
526
+ /* @__PURE__ */ e(Bt, { className: "h-3.5 w-3.5" }),
527
+ s.size === 0 ? "Add to dashboard" : `Add ${s.size} visual${s.size === 1 ? "" : "s"}`
524
528
  ]
525
529
  }
526
530
  )
@@ -532,62 +536,62 @@ function _n({
532
536
  /* @__PURE__ */ e(
533
537
  wa,
534
538
  {
535
- open: u,
536
- onOpenChange: m,
537
- onSubmit: H,
538
- isCreating: xe
539
+ open: p,
540
+ onOpenChange: l,
541
+ onSubmit: k,
542
+ isCreating: re
539
543
  }
540
544
  ),
541
- l && /* @__PURE__ */ e(
542
- qt,
545
+ u && /* @__PURE__ */ e(
546
+ Xt,
543
547
  {
544
- resource: l,
545
- resourceType: Xt.VISUAL,
546
- onClose: () => d(null)
548
+ resource: u,
549
+ resourceType: Zt.VISUAL,
550
+ onClose: () => c(null)
547
551
  }
548
552
  ),
549
- o && /* @__PURE__ */ e(
550
- Zt,
553
+ m && /* @__PURE__ */ e(
554
+ Qt,
551
555
  {
552
- open: !!o,
556
+ open: !!m,
553
557
  resourceLabel: "Visual",
554
- initialTitle: o.title || "",
555
- initialDescription: o.description || "",
556
- onClose: () => f(null),
558
+ initialTitle: m.title || "",
559
+ initialDescription: m.description || "",
560
+ onClose: () => h(null),
557
561
  onSave: we,
558
- isSaving: He(o.id)
562
+ isSaving: ie(m.id)
559
563
  }
560
564
  ),
561
565
  /* @__PURE__ */ e(
562
- Je,
566
+ tt,
563
567
  {
564
- open: h,
565
- onOpenChange: (v) => {
566
- !v && G || (p(v), v || y(null));
568
+ open: f,
569
+ onOpenChange: (y) => {
570
+ !y && oe || (x(y), y || N(null));
567
571
  },
568
- children: /* @__PURE__ */ r(et, { children: [
569
- /* @__PURE__ */ r(tt, { children: [
570
- /* @__PURE__ */ r(rt, { children: [
572
+ children: /* @__PURE__ */ r(rt, { children: [
573
+ /* @__PURE__ */ r(at, { children: [
574
+ /* @__PURE__ */ r(nt, { children: [
571
575
  "Delete ",
572
- Z,
576
+ Ne,
573
577
  " visual",
574
- Z === 1 ? "" : "s",
578
+ Ne === 1 ? "" : "s",
575
579
  "?"
576
580
  ] }),
577
- /* @__PURE__ */ e(at, { children: "This cannot be undone. Visuals already added to dashboards may need to be removed from those dashboards separately." })
581
+ /* @__PURE__ */ e(st, { children: "This cannot be undone. Visuals already added to dashboards may need to be removed from those dashboards separately." })
578
582
  ] }),
579
- /* @__PURE__ */ r(nt, { children: [
580
- /* @__PURE__ */ e(st, { disabled: G, children: "Cancel" }),
583
+ /* @__PURE__ */ r(ot, { children: [
584
+ /* @__PURE__ */ e(it, { disabled: oe, children: "Cancel" }),
581
585
  /* @__PURE__ */ r(
582
- wt,
586
+ St,
583
587
  {
584
- onClick: (v) => {
585
- v.preventDefault(), Ie();
588
+ onClick: (y) => {
589
+ y.preventDefault(), Ke();
586
590
  },
587
- disabled: G || Z === 0,
591
+ disabled: oe || Ne === 0,
588
592
  children: [
589
- G ? /* @__PURE__ */ e(te, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(Ve, { className: "h-3.5 w-3.5" }),
590
- G ? "Deleting..." : "Delete"
593
+ oe ? /* @__PURE__ */ e(te, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(Pe, { className: "h-3.5 w-3.5" }),
594
+ oe ? "Deleting..." : "Delete"
591
595
  ]
592
596
  }
593
597
  )
@@ -600,27 +604,27 @@ function _n({
600
604
  function ka({
601
605
  visuals: t,
602
606
  selectedIds: a,
603
- allFilteredSelected: i,
604
- someFilteredSelected: s,
605
- onSelectAll: n,
606
- onToggleSelection: c,
607
- onAddVisual: u,
608
- onOpenVisual: m,
607
+ allFilteredSelected: o,
608
+ someFilteredSelected: n,
609
+ onSelectAll: i,
610
+ onToggleSelection: s,
611
+ onAddVisual: d,
612
+ onOpenVisual: p,
609
613
  onEditDetails: l,
610
- onShareVisual: d,
611
- onDeleteVisual: o,
612
- onDuplicateVisual: f,
614
+ onShareVisual: u,
615
+ onDeleteVisual: c,
616
+ onDuplicateVisual: m,
613
617
  duplicatingId: h,
614
- isDeleting: p,
615
- isConsoleMode: C
618
+ isDeleting: f,
619
+ isConsoleMode: x
616
620
  }) {
617
621
  return /* @__PURE__ */ r("div", { className: "min-w-[48rem]", children: [
618
622
  /* @__PURE__ */ r("div", { className: "grid h-9 grid-cols-[2.5rem_minmax(14rem,1.8fr)_minmax(10rem,1fr)_8rem_7rem_5rem_5.5rem] items-center border-b border-border/60 px-3 text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: [
619
623
  /* @__PURE__ */ e(
620
- ot,
624
+ lt,
621
625
  {
622
- checked: i ? !0 : s ? "indeterminate" : !1,
623
- onCheckedChange: n,
626
+ checked: o ? !0 : n ? "indeterminate" : !1,
627
+ onCheckedChange: i,
624
628
  "aria-label": "Select all visuals"
625
629
  }
626
630
  ),
@@ -631,57 +635,57 @@ function ka({
631
635
  /* @__PURE__ */ e("span", { className: "text-right", children: "Shared" }),
632
636
  /* @__PURE__ */ e("span", { className: "text-right", children: "Actions" })
633
637
  ] }),
634
- t.map((y) => /* @__PURE__ */ e(
638
+ t.map((C) => /* @__PURE__ */ e(
635
639
  Aa,
636
640
  {
637
- visual: y,
638
- selected: a.has(y.id),
639
- onToggleSelection: c,
640
- onAddVisual: u,
641
- onOpenVisual: m,
641
+ visual: C,
642
+ selected: a.has(C.id),
643
+ onToggleSelection: s,
644
+ onAddVisual: d,
645
+ onOpenVisual: p,
642
646
  onEditDetails: l,
643
- onShareVisual: d,
644
- onDeleteVisual: o,
645
- onDuplicateVisual: f,
647
+ onShareVisual: u,
648
+ onDeleteVisual: c,
649
+ onDuplicateVisual: m,
646
650
  duplicatingId: h,
647
- isDeleting: p,
648
- isConsoleMode: C
651
+ isDeleting: f,
652
+ isConsoleMode: x
649
653
  },
650
- y.id
654
+ C.id
651
655
  ))
652
656
  ] });
653
657
  }
654
658
  function Aa({
655
659
  visual: t,
656
660
  selected: a,
657
- onToggleSelection: i,
658
- onAddVisual: s,
659
- onOpenVisual: n,
660
- onEditDetails: c,
661
- onShareVisual: u,
662
- onDeleteVisual: m,
661
+ onToggleSelection: o,
662
+ onAddVisual: n,
663
+ onOpenVisual: i,
664
+ onEditDetails: s,
665
+ onShareVisual: d,
666
+ onDeleteVisual: p,
663
667
  onDuplicateVisual: l,
664
- duplicatingId: d,
665
- isDeleting: o,
666
- isConsoleMode: f
668
+ duplicatingId: u,
669
+ isDeleting: c,
670
+ isConsoleMode: m
667
671
  }) {
668
- var C;
669
- const h = Sa(t.kind), p = () => {
670
- s(t);
672
+ var x;
673
+ const h = Sa(t.kind), f = () => {
674
+ n(t);
671
675
  };
672
676
  return /* @__PURE__ */ r(
673
677
  "div",
674
678
  {
675
- className: X(
679
+ className: q(
676
680
  "group grid min-h-12 grid-cols-[2.5rem_minmax(14rem,1.8fr)_minmax(10rem,1fr)_8rem_7rem_5rem_5.5rem] items-center border-b border-border/50 px-3 text-[13px] hover:bg-muted/50",
677
681
  a && "bg-muted/70"
678
682
  ),
679
683
  children: [
680
684
  /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
681
- ot,
685
+ lt,
682
686
  {
683
687
  checked: a,
684
- onCheckedChange: () => i(t.id),
688
+ onCheckedChange: () => o(t.id),
685
689
  "aria-label": `Select ${t.title || "visual"}`
686
690
  }
687
691
  ) }),
@@ -690,7 +694,7 @@ function Aa({
690
694
  {
691
695
  type: "button",
692
696
  className: "flex min-w-0 items-center gap-2 rounded-[4px] text-left outline-none focus-visible:ring-1 focus-visible:ring-ring",
693
- onClick: p,
697
+ onClick: f,
694
698
  "aria-label": `Add ${t.title || "visual"} to dashboard`,
695
699
  children: [
696
700
  /* @__PURE__ */ e(h, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
@@ -703,7 +707,7 @@ function Aa({
703
707
  children: t.title || "Untitled Visual"
704
708
  }
705
709
  ),
706
- ((C = t.description) == null ? void 0 : C.trim()) && /* @__PURE__ */ e(
710
+ ((x = t.description) == null ? void 0 : x.trim()) && /* @__PURE__ */ e(
707
711
  "div",
708
712
  {
709
713
  className: "truncate text-[11px] text-muted-foreground",
@@ -716,24 +720,24 @@ function Aa({
716
720
  }
717
721
  ),
718
722
  /* @__PURE__ */ r("div", { className: "flex min-w-0 items-center gap-2", children: [
719
- /* @__PURE__ */ e("div", { className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-muted text-[9px] font-medium text-muted-foreground", children: Na(t, f) }),
720
- /* @__PURE__ */ e("span", { className: "truncate text-muted-foreground", children: mt(t, f) })
723
+ /* @__PURE__ */ e("div", { className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-muted text-[9px] font-medium text-muted-foreground", children: Na(t, m) }),
724
+ /* @__PURE__ */ e("span", { className: "truncate text-muted-foreground", children: ft(t, m) })
721
725
  ] }),
722
- /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: Pt(t.updatedAt) }),
726
+ /* @__PURE__ */ e("span", { className: "text-muted-foreground", children: Ot(t.updatedAt) }),
723
727
  /* @__PURE__ */ e(Da, { visual: t }),
724
728
  /* @__PURE__ */ e("span", { className: "text-right tabular-nums text-muted-foreground", children: t.ownership.sharedCount > 0 ? t.ownership.sharedCount : "—" }),
725
729
  /* @__PURE__ */ e(
726
730
  Ea,
727
731
  {
728
732
  visual: t,
729
- onOpenVisual: n,
730
- onEditDetails: c,
731
- onShareVisual: u,
732
- onDeleteVisual: m,
733
+ onOpenVisual: i,
734
+ onEditDetails: s,
735
+ onShareVisual: d,
736
+ onDeleteVisual: p,
733
737
  onDuplicateVisual: l,
734
- duplicatingId: d,
735
- isDeleting: o,
736
- isConsoleMode: f
738
+ duplicatingId: u,
739
+ isDeleting: c,
740
+ isConsoleMode: m
737
741
  }
738
742
  )
739
743
  ]
@@ -743,19 +747,19 @@ function Aa({
743
747
  function Ea({
744
748
  visual: t,
745
749
  onOpenVisual: a,
746
- onEditDetails: i,
747
- onShareVisual: s,
748
- onDeleteVisual: n,
749
- onDuplicateVisual: c,
750
- duplicatingId: u,
751
- isDeleting: m,
750
+ onEditDetails: o,
751
+ onShareVisual: n,
752
+ onDeleteVisual: i,
753
+ onDuplicateVisual: s,
754
+ duplicatingId: d,
755
+ isDeleting: p,
752
756
  isConsoleMode: l
753
757
  }) {
754
758
  return /* @__PURE__ */ r(
755
759
  "div",
756
760
  {
757
761
  className: "flex items-center justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",
758
- onClick: (d) => d.stopPropagation(),
762
+ onClick: (u) => u.stopPropagation(),
759
763
  children: [
760
764
  /* @__PURE__ */ e(
761
765
  B,
@@ -765,73 +769,73 @@ function Ea({
765
769
  className: "w-7 px-0",
766
770
  onClick: () => a(t),
767
771
  "aria-label": "Edit visual",
768
- children: /* @__PURE__ */ e(Ke, { className: "h-3.5 w-3.5" })
772
+ children: /* @__PURE__ */ e(qe, { className: "h-3.5 w-3.5" })
769
773
  }
770
774
  ),
771
- /* @__PURE__ */ r(Oe, { modal: !1, children: [
772
- /* @__PURE__ */ e(ze, { asChild: !0, children: /* @__PURE__ */ e(
775
+ /* @__PURE__ */ r($e, { modal: !1, children: [
776
+ /* @__PURE__ */ e(je, { asChild: !0, children: /* @__PURE__ */ e(
773
777
  B,
774
778
  {
775
779
  size: "xs",
776
780
  variant: "ghost",
777
781
  className: "w-7 px-0",
778
782
  "aria-label": "More actions",
779
- children: /* @__PURE__ */ e(Nt, { className: "h-3.5 w-3.5" })
783
+ children: /* @__PURE__ */ e(Dt, { className: "h-3.5 w-3.5" })
780
784
  }
781
785
  ) }),
782
786
  /* @__PURE__ */ r(
783
- _e,
787
+ We,
784
788
  {
785
789
  align: "end",
786
790
  className: "z-[60] w-44 rounded-[6px] border-border/60 p-1 shadow-sm",
787
791
  children: [
788
- /* @__PURE__ */ r(K, { onClick: () => a(t), children: [
789
- /* @__PURE__ */ e(Ke, { className: "h-3.5 w-3.5" }),
792
+ /* @__PURE__ */ r(G, { onClick: () => a(t), children: [
793
+ /* @__PURE__ */ e(qe, { className: "h-3.5 w-3.5" }),
790
794
  "Edit visual"
791
795
  ] }),
792
796
  /* @__PURE__ */ r(
793
- K,
797
+ G,
794
798
  {
795
- onClick: () => c(t.id),
796
- disabled: u === t.id,
799
+ onClick: () => s(t.id),
800
+ disabled: d === t.id,
797
801
  children: [
798
- u === t.id ? /* @__PURE__ */ e(te, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(Jt, { className: "h-3.5 w-3.5" }),
799
- u === t.id ? "Duplicating..." : "Duplicate"
802
+ d === t.id ? /* @__PURE__ */ e(te, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(er, { className: "h-3.5 w-3.5" }),
803
+ d === t.id ? "Duplicating..." : "Duplicate"
800
804
  ]
801
805
  }
802
806
  ),
803
- t.permissions.canEdit && /* @__PURE__ */ r(K, { onClick: () => i(t), children: [
804
- /* @__PURE__ */ e(Ke, { className: "h-3.5 w-3.5" }),
807
+ t.permissions.canEdit && /* @__PURE__ */ r(G, { onClick: () => o(t), children: [
808
+ /* @__PURE__ */ e(qe, { className: "h-3.5 w-3.5" }),
805
809
  "Edit details"
806
810
  ] }),
807
- t.permissions.canShare && /* @__PURE__ */ r(K, { onClick: () => s(t), children: [
808
- /* @__PURE__ */ e(Ct, { className: "h-3.5 w-3.5" }),
811
+ t.permissions.canShare && /* @__PURE__ */ r(G, { onClick: () => n(t), children: [
812
+ /* @__PURE__ */ e(Nt, { className: "h-3.5 w-3.5" }),
809
813
  "Share"
810
814
  ] }),
811
815
  t.permissions.canDelete && /* @__PURE__ */ r(W, { children: [
812
- /* @__PURE__ */ e(Re, {}),
816
+ /* @__PURE__ */ e(Me, {}),
813
817
  /* @__PURE__ */ r(
814
- K,
818
+ G,
815
819
  {
816
820
  className: "text-destructive focus:bg-destructive/10 focus:text-destructive",
817
- onClick: () => n(t),
818
- disabled: m,
821
+ onClick: () => i(t),
822
+ disabled: p,
819
823
  children: [
820
- /* @__PURE__ */ e(Ve, { className: "h-3.5 w-3.5" }),
821
- m ? "Deleting..." : "Delete"
824
+ /* @__PURE__ */ e(Pe, { className: "h-3.5 w-3.5" }),
825
+ p ? "Deleting..." : "Delete"
822
826
  ]
823
827
  }
824
828
  )
825
829
  ] }),
826
- /* @__PURE__ */ e(Re, {}),
830
+ /* @__PURE__ */ e(Me, {}),
827
831
  /* @__PURE__ */ r("div", { className: "space-y-1 px-2 py-1.5 text-[11px] text-muted-foreground", children: [
828
- Mt(t, l) && /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: [
829
- /* @__PURE__ */ e(er, { className: "h-3 w-3" }),
830
- /* @__PURE__ */ e("span", { className: "truncate", children: mt(t, l) })
832
+ _t(t, l) && /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: [
833
+ /* @__PURE__ */ e(tr, { className: "h-3 w-3" }),
834
+ /* @__PURE__ */ e("span", { className: "truncate", children: ft(t, l) })
831
835
  ] }),
832
836
  /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: [
833
- /* @__PURE__ */ e(tr, { className: "h-3 w-3" }),
834
- /* @__PURE__ */ e("span", { children: Pt(t.updatedAt) })
837
+ /* @__PURE__ */ e(rr, { className: "h-3 w-3" }),
838
+ /* @__PURE__ */ e("span", { children: Ot(t.updatedAt) })
835
839
  ] })
836
840
  ] })
837
841
  ]
@@ -845,27 +849,27 @@ function Ea({
845
849
  function Ia({
846
850
  open: t,
847
851
  onOpenChange: a,
848
- isLibraryVisual: i,
849
- currentVisualName: s,
850
- isSaving: n = !1,
851
- destinationMode: c = "both",
852
- onConfirm: u
852
+ isLibraryVisual: o,
853
+ currentVisualName: n,
854
+ isSaving: i = !1,
855
+ destinationMode: s = "both",
856
+ onConfirm: d
853
857
  }) {
854
- const [m, l] = E(
855
- i && s ? `Copy of ${s}` : s || ""
856
- ), [d, o] = E("");
857
- jt.useEffect(() => {
858
+ const [p, l] = E(
859
+ o && n ? `Copy of ${n}` : n || ""
860
+ ), [u, c] = E("");
861
+ Wt.useEffect(() => {
858
862
  t && (l(
859
- i && s ? `Copy of ${s}` : s || ""
860
- ), o(""));
861
- }, [t, i, s]);
862
- const f = !!m.trim(), h = c === "local" ? {
863
+ o && n ? `Copy of ${n}` : n || ""
864
+ ), c(""));
865
+ }, [t, o, n]);
866
+ const m = !!p.trim(), h = s === "local" ? {
863
867
  saveToLibrary: !1,
864
868
  saveToCurrentDashboard: !0,
865
869
  badgeType: "local",
866
870
  description: "Creates a local copy on the current dashboard.",
867
871
  actionLabel: "Add to Dashboard (Local)"
868
- } : c === "library" ? {
872
+ } : s === "library" ? {
869
873
  saveToLibrary: !0,
870
874
  saveToCurrentDashboard: !1,
871
875
  badgeType: "library",
@@ -877,17 +881,17 @@ function Ia({
877
881
  badgeType: "linked",
878
882
  description: "Creates a new library visual and adds a linked copy to this dashboard.",
879
883
  actionLabel: "Save Copy as Linked Visual"
880
- }, p = () => {
881
- !f || n || u({
882
- name: m.trim(),
883
- description: d.trim() || void 0,
884
+ }, f = () => {
885
+ !m || i || d({
886
+ name: p.trim(),
887
+ description: u.trim() || void 0,
884
888
  saveToLibrary: h.saveToLibrary,
885
889
  saveToCurrentDashboard: h.saveToCurrentDashboard
886
890
  });
887
891
  };
888
- return /* @__PURE__ */ e(Se, { open: t, onOpenChange: a, children: /* @__PURE__ */ r(De, { className: "sm:max-w-[500px]", children: [
889
- /* @__PURE__ */ r(it, { children: [
890
- /* @__PURE__ */ r(ke, { className: "flex items-center gap-2", children: [
892
+ return /* @__PURE__ */ e(De, { open: t, onOpenChange: a, children: /* @__PURE__ */ r(ke, { className: "sm:max-w-[500px]", children: [
893
+ /* @__PURE__ */ r(ct, { children: [
894
+ /* @__PURE__ */ r(Ae, { className: "flex items-center gap-2", children: [
891
895
  /* @__PURE__ */ e("span", { children: "Save Visual As" }),
892
896
  h.badgeType !== "local" && /* @__PURE__ */ e(
893
897
  oa,
@@ -898,77 +902,77 @@ function Ia({
898
902
  }
899
903
  )
900
904
  ] }),
901
- /* @__PURE__ */ e(lt, { children: h.description })
905
+ /* @__PURE__ */ e(dt, { children: h.description })
902
906
  ] }),
903
907
  /* @__PURE__ */ r("div", { className: "grid gap-4 py-4", children: [
904
908
  /* @__PURE__ */ r("div", { className: "grid gap-2", children: [
905
- /* @__PURE__ */ e(Ne, { htmlFor: "name", children: "Name" }),
909
+ /* @__PURE__ */ e(Se, { htmlFor: "name", children: "Name" }),
906
910
  /* @__PURE__ */ e(
907
- Qe,
911
+ Ye,
908
912
  {
909
913
  id: "name",
910
- value: m,
911
- onChange: (C) => l(C.target.value),
914
+ value: p,
915
+ onChange: (x) => l(x.target.value),
912
916
  placeholder: "Enter visual name",
913
- disabled: n
917
+ disabled: i
914
918
  }
915
919
  )
916
920
  ] }),
917
921
  /* @__PURE__ */ r("div", { className: "grid gap-2", children: [
918
- /* @__PURE__ */ e(Ne, { htmlFor: "description", children: "Description (optional)" }),
922
+ /* @__PURE__ */ e(Se, { htmlFor: "description", children: "Description (optional)" }),
919
923
  /* @__PURE__ */ e(
920
- rr,
924
+ ar,
921
925
  {
922
926
  id: "description",
923
- value: d,
924
- onChange: (C) => o(C.target.value),
927
+ value: u,
928
+ onChange: (x) => c(x.target.value),
925
929
  placeholder: "Enter visual description",
926
930
  rows: 3,
927
- disabled: n
931
+ disabled: i
928
932
  }
929
933
  )
930
934
  ] })
931
935
  ] }),
932
- /* @__PURE__ */ r(ar, { children: [
936
+ /* @__PURE__ */ r(nr, { children: [
933
937
  /* @__PURE__ */ e(
934
938
  B,
935
939
  {
936
940
  variant: "outline",
937
941
  onClick: () => a(!1),
938
- disabled: n,
942
+ disabled: i,
939
943
  children: "Cancel"
940
944
  }
941
945
  ),
942
- /* @__PURE__ */ r(B, { onClick: p, disabled: !f || n, children: [
943
- n && /* @__PURE__ */ e(te, { className: "mr-2 h-4 w-4 animate-spin" }),
946
+ /* @__PURE__ */ r(B, { onClick: f, disabled: !m || i, children: [
947
+ i && /* @__PURE__ */ e(te, { className: "mr-2 h-4 w-4 animate-spin" }),
944
948
  h.actionLabel
945
949
  ] })
946
950
  ] })
947
951
  ] }) });
948
952
  }
949
953
  function Fa() {
950
- const [t, a] = E(!1), [i, s] = E(!1), [n, c] = E(null), [u, m] = E(null), l = ge((b) => b.frame), d = ge((b) => b.card), o = nr(), f = P((b) => b.selectedSheetId), h = P((b) => b.dashboard), { getUpdatedFrame: p } = ht(), { selectVisual: C } = yt(), { addFrame: y, setSelectedFrameId: D, setIsVisualEditing: I } = be(), N = St(), g = !!(l != null && l.visualId), S = (() => {
951
- var b, x;
952
- return ((b = l == null ? void 0 : l.cards) == null ? void 0 : b.length) === 1 && ((x = l.cards[0]) != null && x.title) ? l.cards[0].title : o != null && o.title ? o.title : (d == null ? void 0 : d.title) || "Untitled Visual";
953
- })(), k = sr((b) => {
954
- b != null && b.id && (C(b), i && n && u && f && (async () => {
954
+ const [t, a] = E(!1), [o, n] = E(!1), [i, s] = E(null), [d, p] = E(null), l = ge((g) => g.frame), u = ge((g) => g.card), c = sr(), m = P((g) => g.selectedSheetId), h = P((g) => g.dashboard), { getUpdatedFrame: f } = pt(), { selectVisual: x } = wt(), { addFrame: C, setSelectedFrameId: N, setIsVisualEditing: I } = be(), D = kt(), b = !!(l != null && l.visualId), S = (() => {
955
+ var g, v;
956
+ return ((g = l == null ? void 0 : l.cards) == null ? void 0 : g.length) === 1 && ((v = l.cards[0]) != null && v.title) ? l.cards[0].title : c != null && c.title ? c.title : (u == null ? void 0 : u.title) || "Untitled Visual";
957
+ })(), A = or((g) => {
958
+ g != null && g.id && (x(g), o && i && d && m && (async () => {
955
959
  try {
956
- const x = {
957
- ...n,
958
- id: ft(),
959
- visualId: b.id
960
+ const v = {
961
+ ...i,
962
+ id: bt(),
963
+ visualId: g.id
960
964
  // Link to the newly created library visual
961
965
  };
962
- y(f, x, {
966
+ C(m, v, {
963
967
  position: "end",
964
- semanticExecutionPayload: u
965
- }), D(x.id), s(!1), c(null), m(null), I(!1);
966
- } catch (x) {
968
+ semanticExecutionPayload: d
969
+ }), N(v.id), n(!1), s(null), p(null), I(!1);
970
+ } catch (v) {
967
971
  console.error(
968
972
  "Failed to promote semantic metadata for saved visual:",
969
- x
973
+ v
970
974
  ), O.error(
971
- x instanceof Error ? x.message : "Failed to prepare semantic metadata for the saved visual"
975
+ v instanceof Error ? v.message : "Failed to prepare semantic metadata for the saved visual"
972
976
  );
973
977
  }
974
978
  })(), a(!1));
@@ -976,65 +980,65 @@ function Fa() {
976
980
  return {
977
981
  saveAsDialogOpen: t,
978
982
  setSaveAsDialogOpen: a,
979
- handleSaveAs: async (b) => {
980
- if (!f) {
983
+ handleSaveAs: async (g) => {
984
+ if (!m) {
981
985
  O.error("No sheet selected");
982
986
  return;
983
987
  }
984
- const x = p(), T = Lt(x);
988
+ const v = f(), T = Tt(v);
985
989
  if (T) {
986
990
  O.error(T);
987
991
  return;
988
992
  }
989
- const H = x.cards.length === 1 ? {
990
- ...x,
991
- cards: x.cards.map((A) => ({
992
- ...A,
993
- title: b.name
993
+ const H = v.cards.length === 1 ? {
994
+ ...v,
995
+ cards: v.cards.map((k) => ({
996
+ ...k,
997
+ title: g.name
994
998
  // Use visual name as card title
995
999
  }))
996
- } : x;
997
- if (b.saveToLibrary) {
998
- let A = null;
999
- if (b.saveToCurrentDashboard)
1000
+ } : v;
1001
+ if (g.saveToLibrary) {
1002
+ let k = null;
1003
+ if (g.saveToCurrentDashboard)
1000
1004
  try {
1001
- A = await N(H, {
1002
- previousFrame: Ye(h, H.id)
1005
+ k = await D(H, {
1006
+ previousFrame: Je(h, H.id)
1003
1007
  });
1004
- } catch (j) {
1008
+ } catch ($) {
1005
1009
  console.error(
1006
1010
  "Failed to prepare semantic metadata before saving visual:",
1007
- j
1011
+ $
1008
1012
  ), O.error(
1009
- j instanceof Error ? j.message : "Failed to prepare semantic metadata for the saved visual"
1013
+ $ instanceof Error ? $.message : "Failed to prepare semantic metadata for the saved visual"
1010
1014
  );
1011
1015
  return;
1012
1016
  }
1013
- s(b.saveToCurrentDashboard), c(H), m(A);
1017
+ n(g.saveToCurrentDashboard), s(H), p(k);
1014
1018
  const V = {
1015
- title: b.name,
1016
- description: b.description,
1019
+ title: g.name,
1020
+ description: g.description,
1017
1021
  frameObject: H,
1018
1022
  // Card title synced for single-card frames
1019
1023
  isPrivate: !1
1020
1024
  };
1021
- k.mutate(V);
1022
- } else if (b.saveToCurrentDashboard) {
1023
- const A = {
1025
+ A.mutate(V);
1026
+ } else if (g.saveToCurrentDashboard) {
1027
+ const k = {
1024
1028
  ...H,
1025
1029
  // Card title already synced
1026
- id: ft(),
1030
+ id: bt(),
1027
1031
  visualId: void 0
1028
1032
  // Explicitly no visualId for local visuals
1029
1033
  };
1030
1034
  try {
1031
- const V = await N(H, {
1032
- previousFrame: Ye(h, H.id)
1035
+ const V = await D(H, {
1036
+ previousFrame: Je(h, H.id)
1033
1037
  });
1034
- y(f, A, {
1038
+ C(m, k, {
1035
1039
  position: "end",
1036
1040
  semanticExecutionPayload: V
1037
- }), D(A.id), O.success("Visual saved to dashboard"), a(!1), I(!1);
1041
+ }), N(k.id), O.success("Visual saved to dashboard"), a(!1), I(!1);
1038
1042
  } catch (V) {
1039
1043
  console.error("Failed to save visual to dashboard:", V), O.error(
1040
1044
  V instanceof Error ? V.message : "Failed to prepare semantic metadata for the visual"
@@ -1042,113 +1046,113 @@ function Fa() {
1042
1046
  }
1043
1047
  }
1044
1048
  },
1045
- isLibraryVisual: g,
1049
+ isLibraryVisual: b,
1046
1050
  currentVisualName: S,
1047
- isSaving: k.isPending
1051
+ isSaving: A.isPending
1048
1052
  };
1049
1053
  }
1050
- function $n(t = {}) {
1051
- const { isInspectionMode: a } = or(), i = ge((A) => A.frame), s = ge((A) => A.editorContext), n = ir((A) => A.selectedVisual), c = P((A) => A.selectedFrameId), u = P((A) => A.selectedSheetId), m = P((A) => A.dashboard), { setIsVisualEditing: l, updateFrame: d } = be(), [o, f] = E(!1), [h, p] = E("both"), C = St(), y = (s == null ? void 0 : s.type) === "documentSection", D = !!(i != null && i.visualId || n != null && n.id), I = !!(i != null && i.visualId && c), N = D && !I, {
1052
- saveAsDialogOpen: g,
1054
+ function Wn(t = {}) {
1055
+ const { isInspectionMode: a } = ir(), o = ge((k) => k.frame), n = ge((k) => k.editorContext), i = lr((k) => k.selectedVisual), s = P((k) => k.selectedFrameId), d = P((k) => k.selectedSheetId), p = P((k) => k.dashboard), { setIsVisualEditing: l, updateFrame: u } = be(), [c, m] = E(!1), [h, f] = E("both"), x = kt(), C = (n == null ? void 0 : n.type) === "documentSection", N = !!(o != null && o.visualId || i != null && i.id), I = !!(o != null && o.visualId && s), D = N && !I, {
1056
+ saveAsDialogOpen: b,
1053
1057
  setSaveAsDialogOpen: S,
1054
- handleSaveAs: k,
1058
+ handleSaveAs: A,
1055
1059
  isLibraryVisual: U,
1056
- currentVisualName: b,
1057
- isSaving: x
1058
- } = Fa(), { getUpdatedFrame: T } = ht();
1060
+ currentVisualName: g,
1061
+ isSaving: v
1062
+ } = Fa(), { getUpdatedFrame: T } = pt();
1059
1063
  if (a)
1060
1064
  return /* @__PURE__ */ r(W, { children: [
1061
1065
  /* @__PURE__ */ e(
1062
- qe,
1066
+ Xe,
1063
1067
  {
1064
1068
  className: "rounded-control",
1065
1069
  variant: "default"
1066
1070
  }
1067
1071
  ),
1068
- /* @__PURE__ */ e(Xe, {})
1072
+ /* @__PURE__ */ e(Ze, {})
1069
1073
  ] });
1070
- if (y)
1074
+ if (C)
1071
1075
  return /* @__PURE__ */ r(W, { children: [
1072
- /* @__PURE__ */ e(qe, { className: "rounded-control", variant: "default" }),
1073
- /* @__PURE__ */ e(Xe, {})
1076
+ /* @__PURE__ */ e(Xe, { className: "rounded-control", variant: "default" }),
1077
+ /* @__PURE__ */ e(Ze, {})
1074
1078
  ] });
1075
1079
  const F = async () => {
1076
- if (!u) {
1080
+ if (!d) {
1077
1081
  O.error("No sheet selected");
1078
1082
  return;
1079
1083
  }
1080
- if (o) return;
1081
- f(!0);
1082
- const A = T(), V = Lt(A);
1084
+ if (c) return;
1085
+ m(!0);
1086
+ const k = T(), V = Tt(k);
1083
1087
  if (V) {
1084
- f(!1), O.error(V);
1088
+ m(!1), O.error(V);
1085
1089
  return;
1086
1090
  }
1087
- const j = {
1088
- ...A,
1091
+ const $ = {
1092
+ ...k,
1089
1093
  visualId: void 0
1090
- }, xe = Ye(m, j.id);
1094
+ }, xe = Je(p, $.id);
1091
1095
  try {
1092
- const G = await C(j, {
1096
+ const re = await x($, {
1093
1097
  previousFrame: xe
1094
1098
  });
1095
- d(u, j, {
1096
- semanticExecutionPayload: G
1099
+ u(d, $, {
1100
+ semanticExecutionPayload: re
1097
1101
  });
1098
- } catch (G) {
1099
- console.error("Failed to apply local semantic metadata:", G), f(!1), O.error(
1100
- G instanceof Error ? G.message : "Failed to prepare semantic metadata for this visual"
1102
+ } catch (re) {
1103
+ console.error("Failed to apply local semantic metadata:", re), m(!1), O.error(
1104
+ re instanceof Error ? re.message : "Failed to prepare semantic metadata for this visual"
1101
1105
  );
1102
1106
  return;
1103
1107
  }
1104
1108
  setTimeout(() => {
1105
- f(!1), O.success("Changes applied. Visual is now local to this dashboard"), l(!1);
1109
+ m(!1), O.success("Changes applied. Visual is now local to this dashboard"), l(!1);
1106
1110
  }, 300);
1107
- }, H = (A) => {
1108
- p(A), S(!0);
1111
+ }, H = (k) => {
1112
+ f(k), S(!0);
1109
1113
  };
1110
1114
  return /* @__PURE__ */ r(W, { children: [
1111
1115
  /* @__PURE__ */ r("div", { className: "inline-flex items-center overflow-hidden rounded-control", children: [
1112
- !D && /* @__PURE__ */ e(qe, { className: "!rounded-none", variant: "default" }),
1113
- D && N && /* @__PURE__ */ e(ia, { className: "!rounded-none", variant: "default" }),
1114
- D && I && /* @__PURE__ */ e(la, { className: "!rounded-none" }),
1115
- /* @__PURE__ */ r(Oe, { modal: !1, children: [
1116
- /* @__PURE__ */ e(ze, { asChild: !0, children: /* @__PURE__ */ e(
1116
+ !N && /* @__PURE__ */ e(Xe, { className: "!rounded-none", variant: "default" }),
1117
+ N && D && /* @__PURE__ */ e(ia, { className: "!rounded-none", variant: "default" }),
1118
+ N && I && /* @__PURE__ */ e(la, { className: "!rounded-none" }),
1119
+ /* @__PURE__ */ r($e, { modal: !1, children: [
1120
+ /* @__PURE__ */ e(je, { asChild: !0, children: /* @__PURE__ */ e(
1117
1121
  B,
1118
1122
  {
1119
1123
  variant: "default",
1120
1124
  size: "xs",
1121
1125
  className: "w-7 !rounded-none border-l border-primary-foreground/20 px-0",
1122
1126
  "aria-label": "Open visual save options",
1123
- disabled: x || o,
1124
- children: /* @__PURE__ */ e(Vt, { className: "h-3.5 w-3.5" })
1127
+ disabled: v || c,
1128
+ children: /* @__PURE__ */ e(Ut, { className: "h-3.5 w-3.5" })
1125
1129
  }
1126
1130
  ) }),
1127
1131
  /* @__PURE__ */ r(
1128
- _e,
1132
+ We,
1129
1133
  {
1130
1134
  align: "end",
1131
1135
  className: "min-w-[220px] rounded-control border border-border/60 p-1 shadow-sm",
1132
1136
  children: [
1133
1137
  I && /* @__PURE__ */ r(W, { children: [
1134
1138
  /* @__PURE__ */ r(
1135
- K,
1139
+ G,
1136
1140
  {
1137
1141
  onClick: F,
1138
- disabled: o,
1142
+ disabled: c,
1139
1143
  children: [
1140
- /* @__PURE__ */ e(Ft, { className: "h-3.5 w-3.5" }),
1141
- o ? "Applying..." : "Apply Locally"
1144
+ /* @__PURE__ */ e(Bt, { className: "h-3.5 w-3.5" }),
1145
+ c ? "Applying..." : "Apply Locally"
1142
1146
  ]
1143
1147
  }
1144
1148
  ),
1145
- /* @__PURE__ */ e(Re, {})
1149
+ /* @__PURE__ */ e(Me, {})
1146
1150
  ] }),
1147
1151
  /* @__PURE__ */ r(
1148
- K,
1152
+ G,
1149
1153
  {
1150
1154
  onClick: () => H("local"),
1151
- disabled: x,
1155
+ disabled: v,
1152
1156
  children: [
1153
1157
  /* @__PURE__ */ e(fe, { className: "h-3.5 w-3.5" }),
1154
1158
  "Add to Dashboard (Local)"
@@ -1156,10 +1160,10 @@ function $n(t = {}) {
1156
1160
  }
1157
1161
  ),
1158
1162
  /* @__PURE__ */ r(
1159
- K,
1163
+ G,
1160
1164
  {
1161
1165
  onClick: () => H("library"),
1162
- disabled: x,
1166
+ disabled: v,
1163
1167
  children: [
1164
1168
  /* @__PURE__ */ e(ca, { className: "h-3.5 w-3.5" }),
1165
1169
  "Save as Library Visual"
@@ -1167,10 +1171,10 @@ function $n(t = {}) {
1167
1171
  }
1168
1172
  ),
1169
1173
  /* @__PURE__ */ r(
1170
- K,
1174
+ G,
1171
1175
  {
1172
1176
  onClick: () => H("both"),
1173
- disabled: x,
1177
+ disabled: v,
1174
1178
  children: [
1175
1179
  /* @__PURE__ */ e(da, { className: "h-3.5 w-3.5" }),
1176
1180
  "Save Copy as Linked Visual"
@@ -1182,154 +1186,154 @@ function $n(t = {}) {
1182
1186
  )
1183
1187
  ] })
1184
1188
  ] }),
1185
- /* @__PURE__ */ e(Xe, {}),
1189
+ /* @__PURE__ */ e(Ze, {}),
1186
1190
  /* @__PURE__ */ e(
1187
1191
  Ia,
1188
1192
  {
1189
- open: g,
1190
- onOpenChange: (A) => {
1191
- x || S(A);
1193
+ open: b,
1194
+ onOpenChange: (k) => {
1195
+ v || S(k);
1192
1196
  },
1193
1197
  isLibraryVisual: U,
1194
- currentVisualName: b,
1195
- isSaving: x,
1198
+ currentVisualName: g,
1199
+ isSaving: v,
1196
1200
  destinationMode: h,
1197
- onConfirm: k
1201
+ onConfirm: A
1198
1202
  }
1199
1203
  )
1200
1204
  ] });
1201
1205
  }
1202
- function jn({ className: t }) {
1203
- const a = ge((d) => d.isDevMode), i = P((d) => d.isVisualEditing), { setIsDevMode: s } = Bt(), { config: n } = Wt(lr).tokenProps, c = (n == null ? void 0 : n.showAdvancedMode) !== !1;
1204
- if (!i || !c)
1206
+ function Hn({ className: t }) {
1207
+ const a = ge((u) => u.isDevMode), o = P((u) => u.isVisualEditing), { setIsDevMode: n } = Vt(), { config: i } = Ht(cr).tokenProps, s = (i == null ? void 0 : i.showAdvancedMode) !== !1;
1208
+ if (!o || !s)
1205
1209
  return null;
1206
- const u = a ? pa : cr, m = a ? "Visual editor" : "SQL editor", l = a ? "Switch to visual editor" : "Switch to SQL editor";
1210
+ const d = a ? pa : dr, p = a ? "Visual editor" : "SQL editor", l = a ? "Switch to visual editor" : "Switch to SQL editor";
1207
1211
  return /* @__PURE__ */ r(
1208
1212
  "button",
1209
1213
  {
1210
1214
  type: "button",
1211
1215
  "aria-label": l,
1212
1216
  title: l,
1213
- onClick: () => s(!a),
1214
- className: X(
1217
+ onClick: () => n(!a),
1218
+ className: q(
1215
1219
  "inline-flex h-7 items-center gap-1.5 rounded-control border border-input bg-background px-2 text-[12px] font-medium text-foreground transition-colors hover:bg-muted/40 focus-visible:border-ring focus-visible:outline-none",
1216
1220
  t
1217
1221
  ),
1218
1222
  children: [
1219
- /* @__PURE__ */ e(u, { className: "h-3 w-3 text-muted-foreground" }),
1220
- m
1223
+ /* @__PURE__ */ e(d, { className: "h-3 w-3 text-muted-foreground" }),
1224
+ p
1221
1225
  ]
1222
1226
  }
1223
1227
  );
1224
1228
  }
1225
- function Wn({
1229
+ function Gn({
1226
1230
  open: t,
1227
1231
  onOpenChange: a,
1228
- onSave: i,
1229
- onDiscard: s,
1230
- isSaving: n,
1231
- title: c = "Unsaved changes",
1232
- description: u = "You have unsaved changes to this dashboard. What would you like to do?",
1233
- cancelLabel: m = "Cancel",
1232
+ onSave: o,
1233
+ onDiscard: n,
1234
+ isSaving: i,
1235
+ title: s = "Unsaved changes",
1236
+ description: d = "You have unsaved changes to this dashboard. What would you like to do?",
1237
+ cancelLabel: p = "Cancel",
1234
1238
  discardLabel: l = "Discard",
1235
- saveLabel: d = "Save"
1239
+ saveLabel: u = "Save"
1236
1240
  }) {
1237
- return /* @__PURE__ */ e(Je, { open: t, onOpenChange: (f) => {
1238
- !f && n || a(f);
1239
- }, children: /* @__PURE__ */ r(et, { children: [
1240
- /* @__PURE__ */ r(tt, { children: [
1241
- /* @__PURE__ */ e(rt, { children: c }),
1242
- /* @__PURE__ */ e(at, { children: u })
1241
+ return /* @__PURE__ */ e(tt, { open: t, onOpenChange: (m) => {
1242
+ !m && i || a(m);
1243
+ }, children: /* @__PURE__ */ r(rt, { children: [
1244
+ /* @__PURE__ */ r(at, { children: [
1245
+ /* @__PURE__ */ e(nt, { children: s }),
1246
+ /* @__PURE__ */ e(st, { children: d })
1243
1247
  ] }),
1244
- /* @__PURE__ */ r(nt, { children: [
1248
+ /* @__PURE__ */ r(ot, { children: [
1245
1249
  /* @__PURE__ */ e(
1246
1250
  B,
1247
1251
  {
1248
1252
  type: "button",
1249
1253
  size: "xs",
1250
- onClick: s,
1251
- disabled: n,
1254
+ onClick: n,
1255
+ disabled: i,
1252
1256
  variant: "ghost",
1253
1257
  className: "mr-auto text-muted-foreground hover:bg-destructive/10 hover:text-destructive focus-visible:bg-destructive/10 focus-visible:text-destructive",
1254
1258
  children: l
1255
1259
  }
1256
1260
  ),
1257
- /* @__PURE__ */ e(st, { disabled: n, children: m }),
1258
- /* @__PURE__ */ e(B, { type: "button", size: "xs", onClick: i, disabled: n, children: n ? /* @__PURE__ */ r(W, { children: [
1261
+ /* @__PURE__ */ e(it, { disabled: i, children: p }),
1262
+ /* @__PURE__ */ e(B, { type: "button", size: "xs", onClick: o, disabled: i, children: i ? /* @__PURE__ */ r(W, { children: [
1259
1263
  /* @__PURE__ */ e(te, { className: "mr-2 h-3.5 w-3.5 animate-spin" }),
1260
1264
  "Saving..."
1261
- ] }) : d })
1265
+ ] }) : u })
1262
1266
  ] })
1263
1267
  ] }) });
1264
1268
  }
1265
- const La = 1e4, Ba = 15e3, Ta = 3e4, Va = 3e4, Ra = 12e4, xt = 2 * 60 * 60 * 1e3;
1269
+ const La = 1e4, Ba = 15e3, Ta = 3e4, Va = 3e4, Ra = 12e4, yt = 2 * 60 * 60 * 1e3;
1266
1270
  function Ua(t) {
1267
1271
  const a = Date.now() - t.getTime();
1268
1272
  return a < Va ? La : a < Ra ? Ba : Ta;
1269
1273
  }
1270
- function Hn() {
1271
- const { authToken: t, tokenProps: a } = $e(), i = ue((h) => h.activeExports), [s, n] = E(
1274
+ function Kn() {
1275
+ const { authToken: t, tokenProps: a } = He(), o = ue((h) => h.activeExports), [n, i] = E(
1272
1276
  typeof document < "u" ? !document.hidden : !0
1273
- ), c = he(null), u = he(!1), m = he(void 0), l = a == null ? void 0 : a.apiServiceUrl, d = t == null ? void 0 : t.accessToken, o = q(() => {
1277
+ ), s = he(null), d = he(!1), p = he(void 0), l = a == null ? void 0 : a.apiServiceUrl, u = t == null ? void 0 : t.accessToken, c = K(() => {
1274
1278
  const h = ue.getState().activeExports;
1275
1279
  return Array.from(h.values()).filter(
1276
- (p) => ct(p.status)
1280
+ (f) => ut(f.status)
1277
1281
  );
1278
1282
  }, []);
1279
- J(() => {
1283
+ Q(() => {
1280
1284
  if (typeof document > "u") return;
1281
1285
  const h = () => {
1282
- n(!document.hidden);
1286
+ i(!document.hidden);
1283
1287
  };
1284
1288
  return document.addEventListener("visibilitychange", h), () => {
1285
1289
  document.removeEventListener("visibilitychange", h);
1286
1290
  };
1287
1291
  }, []);
1288
- const f = q(async () => {
1289
- if (!l || !d) {
1290
- u.current = !1;
1292
+ const m = K(async () => {
1293
+ if (!l || !u) {
1294
+ d.current = !1;
1291
1295
  return;
1292
1296
  }
1293
- const h = o();
1297
+ const h = c();
1294
1298
  if (h.length === 0) {
1295
- u.current = !1;
1299
+ d.current = !1;
1296
1300
  return;
1297
1301
  }
1298
- const p = Date.now(), C = h.filter(
1299
- (g) => p - g.startedAt.getTime() > xt
1302
+ const f = Date.now(), x = h.filter(
1303
+ (b) => f - b.startedAt.getTime() > yt
1300
1304
  );
1301
- if (C.length > 0) {
1302
- const { updateExport: g } = ue.getState().actions;
1303
- for (const S of C)
1304
- g(S.id, {
1305
+ if (x.length > 0) {
1306
+ const { updateExport: b } = ue.getState().actions;
1307
+ for (const S of x)
1308
+ b(S.id, {
1305
1309
  status: "failed",
1306
1310
  error: "Export timed out. Please try again or contact support.",
1307
1311
  lastUpdatedAt: /* @__PURE__ */ new Date()
1308
1312
  });
1309
1313
  }
1310
- const y = h.filter(
1311
- (g) => p - g.startedAt.getTime() <= xt
1314
+ const C = h.filter(
1315
+ (b) => f - b.startedAt.getTime() <= yt
1312
1316
  );
1313
- if (y.length === 0) {
1314
- u.current = !1;
1317
+ if (C.length === 0) {
1318
+ d.current = !1;
1315
1319
  return;
1316
1320
  }
1317
- const D = await Promise.allSettled(
1318
- y.map(async (g) => {
1321
+ const N = await Promise.allSettled(
1322
+ C.map(async (b) => {
1319
1323
  try {
1320
- const S = await Dt(l, d, g.id);
1321
- let k;
1324
+ const S = await At(l, u, b.id);
1325
+ let A;
1322
1326
  if (S.status === "completed")
1323
1327
  try {
1324
- k = await dt(l, d, g.id);
1328
+ A = await ht(l, u, b.id);
1325
1329
  } catch (U) {
1326
1330
  console.error(
1327
- `[useExportPolling] Failed to get download URL for ${g.id}:`,
1331
+ `[useExportPolling] Failed to get download URL for ${b.id}:`,
1328
1332
  U
1329
1333
  );
1330
1334
  }
1331
1335
  return {
1332
- id: g.id,
1336
+ id: b.id,
1333
1337
  status: S.status,
1334
1338
  progress: S.progress,
1335
1339
  completedChunks: S.completedChunks,
@@ -1337,101 +1341,101 @@ function Hn() {
1337
1341
  lastUpdatedAt: /* @__PURE__ */ new Date(),
1338
1342
  fileSize: S.fileSize,
1339
1343
  error: S.error,
1340
- downloadUrl: k
1344
+ downloadUrl: A
1341
1345
  };
1342
1346
  } catch (S) {
1343
1347
  return console.error(
1344
- `[useExportPolling] Failed to poll export ${g.id}:`,
1348
+ `[useExportPolling] Failed to poll export ${b.id}:`,
1345
1349
  S
1346
1350
  ), null;
1347
1351
  }
1348
1352
  })
1349
1353
  ), { updateExport: I } = ue.getState().actions;
1350
- for (const g of D)
1351
- g.status === "fulfilled" && g.value && I(g.value.id, g.value);
1352
- const N = o();
1353
- if (N.length > 0 && !document.hidden) {
1354
- const g = N.reduce(
1355
- (k, U) => U.startedAt < k ? U.startedAt : k,
1356
- N[0].startedAt
1357
- ), S = Ua(g);
1358
- c.current && clearTimeout(c.current), c.current = setTimeout(() => {
1359
- var k;
1360
- (k = m.current) == null || k.call(m);
1354
+ for (const b of N)
1355
+ b.status === "fulfilled" && b.value && I(b.value.id, b.value);
1356
+ const D = c();
1357
+ if (D.length > 0 && !document.hidden) {
1358
+ const b = D.reduce(
1359
+ (A, U) => U.startedAt < A ? U.startedAt : A,
1360
+ D[0].startedAt
1361
+ ), S = Ua(b);
1362
+ s.current && clearTimeout(s.current), s.current = setTimeout(() => {
1363
+ var A;
1364
+ (A = p.current) == null || A.call(p);
1361
1365
  }, S);
1362
1366
  } else
1363
- u.current = !1;
1364
- }, [l, d, o]);
1365
- return J(() => {
1366
- m.current = f;
1367
- }, [f]), J(() => {
1368
- var p;
1369
- o().length > 0 && s && !u.current && (u.current = !0, (p = m.current) == null || p.call(m));
1370
- }, [i, s, o]), J(() => {
1371
- var p;
1372
- const h = o();
1373
- s && h.length > 0 && !u.current && (u.current = !0, (p = m.current) == null || p.call(m));
1374
- }, [s, o]), J(() => {
1375
- !s && c.current && (clearTimeout(c.current), c.current = null, u.current = !1);
1376
- }, [s]), J(() => () => {
1377
- c.current && (clearTimeout(c.current), c.current = null);
1367
+ d.current = !1;
1368
+ }, [l, u, c]);
1369
+ return Q(() => {
1370
+ p.current = m;
1371
+ }, [m]), Q(() => {
1372
+ var f;
1373
+ c().length > 0 && n && !d.current && (d.current = !0, (f = p.current) == null || f.call(p));
1374
+ }, [o, n, c]), Q(() => {
1375
+ var f;
1376
+ const h = c();
1377
+ n && h.length > 0 && !d.current && (d.current = !0, (f = p.current) == null || f.call(p));
1378
+ }, [n, c]), Q(() => {
1379
+ !n && s.current && (clearTimeout(s.current), s.current = null, d.current = !1);
1380
+ }, [n]), Q(() => () => {
1381
+ s.current && (clearTimeout(s.current), s.current = null);
1378
1382
  }, []), {
1379
- isPolling: u.current,
1380
- isTabVisible: s,
1381
- inProgressCount: o().length
1383
+ isPolling: d.current,
1384
+ isTabVisible: n,
1385
+ inProgressCount: c().length
1382
1386
  };
1383
1387
  }
1384
- function Gn() {
1385
- const { authToken: t, tokenProps: a } = $e(), i = ue((m) => m.activeExports), { addExport: s } = kt(), n = he(!1), c = a == null ? void 0 : a.apiServiceUrl, u = t == null ? void 0 : t.accessToken;
1386
- J(() => {
1387
- if (n.current || !c || !u) return;
1388
+ function qn() {
1389
+ const { authToken: t, tokenProps: a } = He(), o = ue((p) => p.activeExports), { addExport: n } = Et(), i = he(!1), s = a == null ? void 0 : a.apiServiceUrl, d = t == null ? void 0 : t.accessToken;
1390
+ Q(() => {
1391
+ if (i.current || !s || !d) return;
1388
1392
  (async () => {
1389
1393
  try {
1390
- const { exports: l } = await dr(c, u, {
1394
+ const { exports: l } = await ur(s, d, {
1391
1395
  status: ["pending", "processing", "chunking", "compacting", "completed", "failed"],
1392
1396
  limit: 20
1393
1397
  // Limit to recent exports
1394
1398
  });
1395
- for (const d of l) {
1396
- if (i.has(d.id)) continue;
1397
- const o = d.totalChunks ? Math.round(d.completedChunks / d.totalChunks * 100) : 0;
1398
- let f;
1399
- if (d.status === "completed")
1399
+ for (const u of l) {
1400
+ if (o.has(u.id)) continue;
1401
+ const c = u.totalChunks ? Math.round(u.completedChunks / u.totalChunks * 100) : 0;
1402
+ let m;
1403
+ if (u.status === "completed")
1400
1404
  try {
1401
- f = await dt(c, u, d.id);
1402
- } catch (p) {
1405
+ m = await ht(s, d, u.id);
1406
+ } catch (f) {
1403
1407
  console.error(
1404
- `[useExportRecovery] Failed to get download URL for ${d.id}:`,
1405
- p
1408
+ `[useExportRecovery] Failed to get download URL for ${u.id}:`,
1409
+ f
1406
1410
  );
1407
1411
  }
1408
1412
  const h = {
1409
- id: d.id,
1410
- status: d.status,
1411
- progress: o,
1412
- title: Pa(d),
1413
- totalRows: d.totalRows,
1414
- totalChunks: d.totalChunks,
1415
- completedChunks: d.completedChunks,
1416
- startedAt: new Date(d.createdAt),
1413
+ id: u.id,
1414
+ status: u.status,
1415
+ progress: c,
1416
+ title: Pa(u),
1417
+ totalRows: u.totalRows,
1418
+ totalChunks: u.totalChunks,
1419
+ completedChunks: u.completedChunks,
1420
+ startedAt: new Date(u.createdAt),
1417
1421
  lastUpdatedAt: /* @__PURE__ */ new Date(),
1418
- completedAt: d.completedAt ? new Date(d.completedAt) : void 0,
1419
- fileSize: d.fileSize,
1420
- error: d.error,
1421
- expiresAt: new Date(d.expiresAt),
1422
- downloadUrl: f
1422
+ completedAt: u.completedAt ? new Date(u.completedAt) : void 0,
1423
+ fileSize: u.fileSize,
1424
+ error: u.error,
1425
+ expiresAt: new Date(u.expiresAt),
1426
+ downloadUrl: m
1423
1427
  };
1424
- s(h);
1428
+ n(h);
1425
1429
  }
1426
- n.current = !0;
1430
+ i.current = !0;
1427
1431
  } catch (l) {
1428
- console.error("[useExportRecovery] Failed to recover exports:", l), n.current = !0;
1432
+ console.error("[useExportRecovery] Failed to recover exports:", l), i.current = !0;
1429
1433
  }
1430
1434
  })();
1431
- }, [c, u, s, i]);
1435
+ }, [s, d, n, o]);
1432
1436
  }
1433
1437
  function Pa(t) {
1434
- return t.title ? t.title : ct(
1438
+ return t.title ? t.title : ut(
1435
1439
  t.status
1436
1440
  ) ? "Export in progress..." : t.status === "completed" ? "Export completed" : t.status === "failed" ? "Export failed" : "Export";
1437
1441
  }
@@ -1439,20 +1443,20 @@ function Ma({
1439
1443
  export: t,
1440
1444
  onRemove: a
1441
1445
  }) {
1442
- const i = () => {
1446
+ const o = () => {
1443
1447
  t.downloadUrl && window.open(t.downloadUrl, "_blank");
1444
- }, s = (m) => {
1445
- m.stopPropagation(), a == null || a(t.id);
1446
- }, n = () => {
1448
+ }, n = (p) => {
1449
+ p.stopPropagation(), a == null || a(t.id);
1450
+ }, i = () => {
1447
1451
  switch (t.status) {
1448
1452
  case "completed":
1449
- return /* @__PURE__ */ e(pr, { className: "mt-0.5 h-5 w-5 shrink-0 text-green-600" });
1453
+ return /* @__PURE__ */ e(fr, { className: "mt-0.5 h-5 w-5 shrink-0 text-green-600" });
1450
1454
  case "failed":
1451
1455
  return /* @__PURE__ */ e(va, { className: "mt-0.5 h-5 w-5 shrink-0 text-destructive" });
1452
1456
  default:
1453
1457
  return /* @__PURE__ */ e(te, { className: "text-foreground-muted mt-0.5 h-5 w-5 shrink-0 animate-spin" });
1454
1458
  }
1455
- }, c = ct(t.status), u = (() => {
1459
+ }, s = ut(t.status), d = (() => {
1456
1460
  switch (t.status) {
1457
1461
  case "pending":
1458
1462
  return "Queued...";
@@ -1469,7 +1473,7 @@ function Ma({
1469
1473
  return /* @__PURE__ */ r("div", { className: "group p-4 transition-colors hover:bg-muted/50", children: [
1470
1474
  /* @__PURE__ */ r("div", { className: "mb-2 flex items-start justify-between gap-3", children: [
1471
1475
  /* @__PURE__ */ r("div", { className: "flex min-w-0 flex-1 items-start gap-3", children: [
1472
- n(),
1476
+ i(),
1473
1477
  /* @__PURE__ */ r("div", { className: "min-w-0 flex-1", children: [
1474
1478
  /* @__PURE__ */ e("h4", { className: "mb-1 truncate text-sm font-medium", children: t.title }),
1475
1479
  t.status === "completed" && /* @__PURE__ */ r("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
@@ -1479,10 +1483,10 @@ function Ma({
1479
1483
  ] }),
1480
1484
  t.fileSize && /* @__PURE__ */ r(W, { children: [
1481
1485
  /* @__PURE__ */ e("span", { children: "•" }),
1482
- /* @__PURE__ */ e("span", { children: ur(t.fileSize) })
1486
+ /* @__PURE__ */ e("span", { children: hr(t.fileSize) })
1483
1487
  ] })
1484
1488
  ] }),
1485
- c && /* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground", children: u }),
1489
+ s && /* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground", children: d }),
1486
1490
  t.status === "failed" && /* @__PURE__ */ e("div", { className: "line-clamp-2 text-xs text-destructive", children: t.error || "Export failed" })
1487
1491
  ] })
1488
1492
  ] }),
@@ -1492,136 +1496,136 @@ function Ma({
1492
1496
  variant: "ghost",
1493
1497
  size: "icon",
1494
1498
  className: "h-6 w-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100",
1495
- onClick: s,
1499
+ onClick: n,
1496
1500
  "aria-label": "Remove notification",
1497
- children: /* @__PURE__ */ e(je, { className: "h-4 w-4" })
1501
+ children: /* @__PURE__ */ e(Ge, { className: "h-4 w-4" })
1498
1502
  }
1499
1503
  )
1500
1504
  ] }),
1501
1505
  /* @__PURE__ */ r("div", { className: "ml-8", children: [
1502
1506
  t.status === "completed" && /* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
1503
- /* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: gt(t.startedAt, { addSuffix: !0 }) }),
1507
+ /* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: xt(t.startedAt, { addSuffix: !0 }) }),
1504
1508
  t.downloadUrl && /* @__PURE__ */ r(
1505
1509
  B,
1506
1510
  {
1507
1511
  size: "sm",
1508
1512
  variant: "outline",
1509
1513
  className: "h-8 bg-transparent",
1510
- onClick: i,
1514
+ onClick: o,
1511
1515
  children: [
1512
- /* @__PURE__ */ e(hr, { className: "mr-1.5 h-3.5 w-3.5" }),
1516
+ /* @__PURE__ */ e(mr, { className: "mr-1.5 h-3.5 w-3.5" }),
1513
1517
  "Download"
1514
1518
  ]
1515
1519
  }
1516
1520
  )
1517
1521
  ] }),
1518
- c && /* @__PURE__ */ r("div", { children: [
1519
- /* @__PURE__ */ e(mr, { value: t.progress, className: "h-1.5" }),
1522
+ s && /* @__PURE__ */ r("div", { children: [
1523
+ /* @__PURE__ */ e(pr, { value: t.progress, className: "h-1.5" }),
1520
1524
  /* @__PURE__ */ r("span", { className: "mt-1 block text-xs text-muted-foreground", children: [
1521
1525
  t.progress,
1522
1526
  "% complete"
1523
1527
  ] })
1524
1528
  ] }),
1525
- t.status === "failed" && /* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: gt(t.startedAt, { addSuffix: !0 }) })
1529
+ t.status === "failed" && /* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: xt(t.startedAt, { addSuffix: !0 }) })
1526
1530
  ] })
1527
1531
  ] });
1528
1532
  }
1529
1533
  function Oa() {
1530
- const { authToken: t, tokenProps: a } = $e(), i = ue((y) => y.activeExports), { clearCompleted: s, removeExport: n, updateExport: c } = kt(), [u, m] = E(!1), [l, d] = E(!1), o = Array.from(i.values()).sort(
1531
- (y, D) => D.startedAt.getTime() - y.startedAt.getTime()
1532
- ), f = o.some(
1533
- (y) => y.status === "completed" || y.status === "failed"
1534
- ), h = q(async () => {
1535
- const y = a == null ? void 0 : a.apiServiceUrl, D = t == null ? void 0 : t.accessToken;
1536
- if (!(!y || !D)) {
1537
- m(!0);
1534
+ const { authToken: t, tokenProps: a } = He(), o = ue((C) => C.activeExports), { clearCompleted: n, removeExport: i, updateExport: s } = Et(), [d, p] = E(!1), [l, u] = E(!1), c = Array.from(o.values()).sort(
1535
+ (C, N) => N.startedAt.getTime() - C.startedAt.getTime()
1536
+ ), m = c.some(
1537
+ (C) => C.status === "completed" || C.status === "failed"
1538
+ ), h = K(async () => {
1539
+ const C = a == null ? void 0 : a.apiServiceUrl, N = t == null ? void 0 : t.accessToken;
1540
+ if (!(!C || !N)) {
1541
+ p(!0);
1538
1542
  try {
1539
- const I = Array.from(i.values());
1543
+ const I = Array.from(o.values());
1540
1544
  await Promise.all(
1541
- I.map(async (N) => {
1545
+ I.map(async (D) => {
1542
1546
  try {
1543
- const g = await Dt(y, D, N.id);
1547
+ const b = await At(C, N, D.id);
1544
1548
  let S;
1545
- if (g.status === "completed")
1549
+ if (b.status === "completed")
1546
1550
  try {
1547
- S = await dt(
1548
- y,
1549
- D,
1550
- N.id
1551
+ S = await ht(
1552
+ C,
1553
+ N,
1554
+ D.id
1551
1555
  );
1552
- } catch (k) {
1553
- console.error(`Failed to get download URL for ${N.id}:`, k);
1556
+ } catch (A) {
1557
+ console.error(`Failed to get download URL for ${D.id}:`, A);
1554
1558
  }
1555
- c(N.id, {
1556
- status: g.status,
1557
- progress: g.progress,
1558
- completedChunks: g.completedChunks,
1559
- completedAt: g.completedAt ? new Date(g.completedAt) : void 0,
1559
+ s(D.id, {
1560
+ status: b.status,
1561
+ progress: b.progress,
1562
+ completedChunks: b.completedChunks,
1563
+ completedAt: b.completedAt ? new Date(b.completedAt) : void 0,
1560
1564
  lastUpdatedAt: /* @__PURE__ */ new Date(),
1561
- fileSize: g.fileSize,
1562
- error: g.error,
1565
+ fileSize: b.fileSize,
1566
+ error: b.error,
1563
1567
  downloadUrl: S
1564
1568
  });
1565
- } catch (g) {
1566
- console.error(`Failed to refresh export ${N.id}:`, g);
1569
+ } catch (b) {
1570
+ console.error(`Failed to refresh export ${D.id}:`, b);
1567
1571
  }
1568
1572
  })
1569
1573
  );
1570
1574
  } finally {
1571
- m(!1);
1575
+ p(!1);
1572
1576
  }
1573
1577
  }
1574
1578
  }, [
1575
- i,
1579
+ o,
1576
1580
  t == null ? void 0 : t.accessToken,
1577
1581
  a == null ? void 0 : a.apiServiceUrl,
1578
- c
1579
- ]), p = q(async () => {
1580
- const y = a == null ? void 0 : a.apiServiceUrl, D = t == null ? void 0 : t.accessToken;
1581
- if (!y || !D) {
1582
- s();
1582
+ s
1583
+ ]), f = K(async () => {
1584
+ const C = a == null ? void 0 : a.apiServiceUrl, N = t == null ? void 0 : t.accessToken;
1585
+ if (!C || !N) {
1586
+ n();
1583
1587
  return;
1584
1588
  }
1585
- d(!0);
1589
+ u(!0);
1586
1590
  try {
1587
- const I = o.filter(
1588
- (g) => g.status === "completed" || g.status === "failed"
1589
- ), N = await Promise.allSettled(
1590
- I.map(async (g) => (await pt(y, D, g.id), g.id))
1591
+ const I = c.filter(
1592
+ (b) => b.status === "completed" || b.status === "failed"
1593
+ ), D = await Promise.allSettled(
1594
+ I.map(async (b) => (await gt(C, N, b.id), b.id))
1591
1595
  );
1592
- for (const g of N)
1593
- g.status === "fulfilled" ? n(g.value) : console.error("Failed to delete export:", g.reason);
1596
+ for (const b of D)
1597
+ b.status === "fulfilled" ? i(b.value) : console.error("Failed to delete export:", b.reason);
1594
1598
  } finally {
1595
- d(!1);
1599
+ u(!1);
1596
1600
  }
1597
1601
  }, [
1598
- o,
1602
+ c,
1599
1603
  a == null ? void 0 : a.apiServiceUrl,
1600
1604
  t == null ? void 0 : t.accessToken,
1601
- s,
1602
- n
1603
- ]), C = q(
1604
- async (y) => {
1605
- const D = a == null ? void 0 : a.apiServiceUrl, I = t == null ? void 0 : t.accessToken;
1606
- if (D && I)
1605
+ n,
1606
+ i
1607
+ ]), x = K(
1608
+ async (C) => {
1609
+ const N = a == null ? void 0 : a.apiServiceUrl, I = t == null ? void 0 : t.accessToken;
1610
+ if (N && I)
1607
1611
  try {
1608
- await pt(D, I, y), n(y);
1612
+ await gt(N, I, C), i(C);
1609
1613
  return;
1610
- } catch (N) {
1611
- console.error(`Failed to cancel export ${y}:`, N);
1614
+ } catch (D) {
1615
+ console.error(`Failed to cancel export ${C}:`, D);
1612
1616
  }
1613
- n(y);
1617
+ i(C);
1614
1618
  },
1615
- [a == null ? void 0 : a.apiServiceUrl, t == null ? void 0 : t.accessToken, n]
1619
+ [a == null ? void 0 : a.apiServiceUrl, t == null ? void 0 : t.accessToken, i]
1616
1620
  );
1617
- return o.length === 0 ? /* @__PURE__ */ r("div", { className: "p-6 text-center", children: [
1618
- /* @__PURE__ */ e(bt, { className: "mx-auto mb-2 h-8 w-8 text-muted-foreground" }),
1621
+ return c.length === 0 ? /* @__PURE__ */ r("div", { className: "p-6 text-center", children: [
1622
+ /* @__PURE__ */ e(vt, { className: "mx-auto mb-2 h-8 w-8 text-muted-foreground" }),
1619
1623
  /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "No active exports" }),
1620
1624
  /* @__PURE__ */ e("p", { className: "mt-1 text-xs text-muted-foreground", children: "Large exports will appear here" })
1621
1625
  ] }) : /* @__PURE__ */ r("div", { className: "flex flex-col", children: [
1622
1626
  /* @__PURE__ */ r("div", { className: "flex items-center justify-between border-b px-4 py-3", children: [
1623
1627
  /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
1624
- /* @__PURE__ */ e(bt, { className: "h-5 w-5 text-muted-foreground" }),
1628
+ /* @__PURE__ */ e(vt, { className: "h-5 w-5 text-muted-foreground" }),
1625
1629
  /* @__PURE__ */ e("h4", { className: "font-semibold", children: "Exports" })
1626
1630
  ] }),
1627
1631
  /* @__PURE__ */ r("div", { className: "flex items-center gap-1", children: [
@@ -1632,47 +1636,47 @@ function Oa() {
1632
1636
  size: "sm",
1633
1637
  className: "h-7 w-7 p-0",
1634
1638
  onClick: h,
1635
- disabled: u,
1639
+ disabled: d,
1636
1640
  title: "Refresh status",
1637
1641
  children: /* @__PURE__ */ e(
1638
- fr,
1642
+ gr,
1639
1643
  {
1640
- className: `h-4 w-4 ${u ? "animate-spin" : ""}`
1644
+ className: `h-4 w-4 ${d ? "animate-spin" : ""}`
1641
1645
  }
1642
1646
  )
1643
1647
  }
1644
1648
  ),
1645
- f && /* @__PURE__ */ e(
1649
+ m && /* @__PURE__ */ e(
1646
1650
  B,
1647
1651
  {
1648
1652
  variant: "ghost",
1649
1653
  size: "sm",
1650
1654
  className: "h-7 px-2 text-sm",
1651
- onClick: p,
1655
+ onClick: f,
1652
1656
  disabled: l,
1653
1657
  children: l ? "Clearing..." : "Clear all"
1654
1658
  }
1655
1659
  )
1656
1660
  ] })
1657
1661
  ] }),
1658
- /* @__PURE__ */ e("div", { className: "max-h-[350px] overflow-y-auto", children: /* @__PURE__ */ e("div", { className: "divide-y", children: o.map((y) => /* @__PURE__ */ e(
1662
+ /* @__PURE__ */ e("div", { className: "max-h-[350px] overflow-y-auto", children: /* @__PURE__ */ e("div", { className: "divide-y", children: c.map((C) => /* @__PURE__ */ e(
1659
1663
  Ma,
1660
1664
  {
1661
- export: y,
1662
- onRemove: C
1665
+ export: C,
1666
+ onRemove: x
1663
1667
  },
1664
- y.id
1668
+ C.id
1665
1669
  )) }) })
1666
1670
  ] });
1667
1671
  }
1668
- function Kn({
1672
+ function Xn({
1669
1673
  variant: t
1670
1674
  }) {
1671
- const a = ue((l) => l.activeExports), i = gr(), s = a.size > 0, n = Array.from(a.values()).some(
1675
+ const a = ue((l) => l.activeExports), o = br(), n = a.size > 0, i = Array.from(a.values()).some(
1672
1676
  (l) => l.status === "completed" || l.status === "failed"
1673
- ), u = i > 0 ? i > 9 ? "9+" : String(i) : null;
1674
- return /* @__PURE__ */ r(Ue, { children: [
1675
- /* @__PURE__ */ e(Pe, { asChild: !0, children: /* @__PURE__ */ r(
1677
+ ), d = o > 0 ? o > 9 ? "9+" : String(o) : null;
1678
+ return /* @__PURE__ */ r(Oe, { children: [
1679
+ /* @__PURE__ */ e(_e, { asChild: !0, children: /* @__PURE__ */ r(
1676
1680
  B,
1677
1681
  {
1678
1682
  variant: t ?? "ghost",
@@ -1680,21 +1684,21 @@ function Kn({
1680
1684
  className: "relative w-7 px-0 text-muted-foreground hover:text-foreground",
1681
1685
  "aria-label": "Export notifications",
1682
1686
  children: [
1683
- /* @__PURE__ */ e(br, { className: "h-3.5 w-3.5" }),
1684
- s && /* @__PURE__ */ e(
1687
+ /* @__PURE__ */ e(xr, { className: "h-3.5 w-3.5" }),
1688
+ n && /* @__PURE__ */ e(
1685
1689
  "span",
1686
1690
  {
1687
- className: `absolute flex items-center justify-center rounded-full bg-primary text-primary-foreground ${u ? "-right-0.5 -top-0.5 h-3.5 min-w-3.5 px-0.5 text-[9px] font-semibold" : "right-1 top-1 h-1.5 w-1.5"}`,
1688
- children: u
1691
+ className: `absolute flex items-center justify-center rounded-full bg-primary text-primary-foreground ${d ? "-right-0.5 -top-0.5 h-3.5 min-w-3.5 px-0.5 text-[9px] font-semibold" : "right-1 top-1 h-1.5 w-1.5"}`,
1692
+ children: d
1689
1693
  }
1690
1694
  )
1691
1695
  ]
1692
1696
  }
1693
1697
  ) }),
1694
- /* @__PURE__ */ e(Me, { className: "w-80 p-0", align: "end", sideOffset: 8, children: /* @__PURE__ */ e(Oa, {}) })
1698
+ /* @__PURE__ */ e(ze, { className: "w-80 p-0", align: "end", sideOffset: 8, children: /* @__PURE__ */ e(Oa, {}) })
1695
1699
  ] });
1696
1700
  }
1697
- function za(t) {
1701
+ function _a(t) {
1698
1702
  if (t)
1699
1703
  return {
1700
1704
  renamed: t.type === "rename" ? { oldId: t.oldId, newId: t.newId } : void 0,
@@ -1703,56 +1707,56 @@ function za(t) {
1703
1707
  affectedBindingControlIds: t.type === "add" || t.type === "update" ? t.affectedBindingControlIds : void 0
1704
1708
  };
1705
1709
  }
1706
- function _a({
1710
+ function za({
1707
1711
  open: t,
1708
1712
  onOpenChange: a,
1709
- trigger: i,
1710
- showTrigger: s = !0,
1711
- initialMode: n = "manage"
1713
+ trigger: o,
1714
+ showTrigger: n = !0,
1715
+ initialMode: i = "manage"
1712
1716
  }) {
1713
- const c = n === "create", {
1714
- forceClose: u,
1715
- handleOpenChange: m,
1717
+ const s = i === "create", {
1718
+ forceClose: d,
1719
+ handleOpenChange: p,
1716
1720
  isCreateFlowActive: l,
1717
- preventPassiveDismissDuringCreate: d,
1718
- resolvedOpen: o,
1719
- setIsCreateFlowActive: f
1720
- } = Rt({
1721
+ preventPassiveDismissDuringCreate: u,
1722
+ resolvedOpen: c,
1723
+ setIsCreateFlowActive: m
1724
+ } = Pt({
1721
1725
  open: t,
1722
1726
  onOpenChange: a,
1723
- initialCreateFlowActive: n === "create",
1727
+ initialCreateFlowActive: i === "create",
1724
1728
  // Dialog mode renders a built-in X close button — allow explicit
1725
1729
  // closes through `handleOpenChange`. Popover mode has no X; its
1726
1730
  // only close-via-trigger path is a re-click that would silently
1727
1731
  // wipe the in-progress create flow, so block everything during
1728
1732
  // create and make consumers use `forceClose()` from a dedicated
1729
1733
  // button.
1730
- dismissMode: s ? "passive" : "explicit-only"
1731
- }), h = P((x) => x.dashboard), { setDashboardControlsModel: p } = be(), { participants: C } = xr(Jr(h)), y = Array.from(
1734
+ dismissMode: n ? "passive" : "explicit-only"
1735
+ }), h = P((v) => v.dashboard), { setDashboardControlsModel: f } = be(), { participants: x } = vr(Jr(h)), C = Array.from(
1732
1736
  new Map(
1733
- C.flatMap(
1734
- (x) => x.fieldChoices.map((T) => {
1737
+ x.flatMap(
1738
+ (v) => v.fieldChoices.map((T) => {
1735
1739
  var F;
1736
1740
  return [
1737
1741
  T.value,
1738
1742
  {
1739
1743
  option: T,
1740
- target: (F = x.fieldTargetMap) == null ? void 0 : F[T.value]
1744
+ target: (F = v.fieldTargetMap) == null ? void 0 : F[T.value]
1741
1745
  }
1742
1746
  ];
1743
1747
  })
1744
1748
  )
1745
1749
  ).values()
1746
- ), D = Array.from(
1750
+ ), N = Array.from(
1747
1751
  new Map(
1748
- C.flatMap(
1749
- (x) => x.metricChoices.map((T) => {
1752
+ x.flatMap(
1753
+ (v) => v.metricChoices.map((T) => {
1750
1754
  var F;
1751
1755
  return [
1752
1756
  T.value,
1753
1757
  {
1754
1758
  option: T,
1755
- target: (F = x.metricTargetMap) == null ? void 0 : F[T.value]
1759
+ target: (F = v.metricTargetMap) == null ? void 0 : F[T.value]
1756
1760
  }
1757
1761
  ];
1758
1762
  })
@@ -1761,73 +1765,73 @@ function _a({
1761
1765
  ), I = ea({
1762
1766
  ...h || {},
1763
1767
  controls: []
1764
- }), N = vr(h), g = (x, T, F) => {
1765
- p(
1766
- x,
1768
+ }), D = yr(h), b = (v, T, F) => {
1769
+ f(
1770
+ v,
1767
1771
  T,
1768
- za(F)
1772
+ _a(F)
1769
1773
  );
1770
- }, S = q(() => {
1771
- if (c) {
1772
- u();
1774
+ }, S = K(() => {
1775
+ if (s) {
1776
+ d();
1773
1777
  return;
1774
1778
  }
1775
- f(!1);
1776
- }, [c, u, f]), k = /* @__PURE__ */ e(
1777
- Ut,
1779
+ m(!1);
1780
+ }, [s, d, m]), A = /* @__PURE__ */ e(
1781
+ Mt,
1778
1782
  {
1779
1783
  scope: "dashboard",
1780
1784
  controls: h.controls || [],
1781
1785
  reservedControlIds: I,
1782
1786
  defaultValues: h.defaultControlValues || {},
1783
- usageByControlId: yr(h),
1784
- availableFieldChoices: y,
1785
- availableMetricChoices: D,
1786
- structuralParticipants: C,
1787
- structuralParticipantIdsByControlId: N,
1788
- initialCreateFlow: n === "create",
1789
- onCreateFlowActiveChange: f,
1787
+ usageByControlId: Cr(h),
1788
+ availableFieldChoices: C,
1789
+ availableMetricChoices: N,
1790
+ structuralParticipants: x,
1791
+ structuralParticipantIdsByControlId: D,
1792
+ initialCreateFlow: i === "create",
1793
+ onCreateFlowActiveChange: m,
1790
1794
  onCreateFlowComplete: S,
1791
- onChange: g,
1795
+ onChange: b,
1792
1796
  emptyMessage: "No dashboard controls yet."
1793
1797
  }
1794
- ), U = l ? "Add dashboard control" : "Dashboard Controls", b = /* @__PURE__ */ r(W, { children: [
1798
+ ), U = l ? "Add dashboard control" : "Dashboard Controls", g = /* @__PURE__ */ r(W, { children: [
1795
1799
  /* @__PURE__ */ r("div", { className: "space-y-1", children: [
1796
1800
  /* @__PURE__ */ e("h4", { className: "text-sm font-medium", children: "Dashboard Controls" }),
1797
1801
  /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: "Add shared controls viewers can use across the dashboard. Each card can decide how to respond to the same control." })
1798
1802
  ] }),
1799
- k
1803
+ A
1800
1804
  ] });
1801
- return s ? /* @__PURE__ */ r(Ue, { open: o, onOpenChange: m, children: [
1802
- /* @__PURE__ */ e(Pe, { asChild: !0, children: i || /* @__PURE__ */ r(B, { variant: "outline", className: "h-7 px-2", size: "sm", children: [
1803
- /* @__PURE__ */ e(Tt, { className: "mr-2 h-4 w-4" }),
1805
+ return n ? /* @__PURE__ */ r(Oe, { open: c, onOpenChange: p, children: [
1806
+ /* @__PURE__ */ e(_e, { asChild: !0, children: o || /* @__PURE__ */ r(B, { variant: "outline", className: "h-7 px-2", size: "sm", children: [
1807
+ /* @__PURE__ */ e(Rt, { className: "mr-2 h-4 w-4" }),
1804
1808
  "Controls"
1805
1809
  ] }) }),
1806
1810
  /* @__PURE__ */ e(
1807
- Me,
1811
+ ze,
1808
1812
  {
1809
1813
  className: "w-[620px] max-w-[95vw] space-y-4",
1810
1814
  align: "end",
1811
- onEscapeKeyDown: d,
1812
- onPointerDownOutside: d,
1813
- children: b
1815
+ onEscapeKeyDown: u,
1816
+ onPointerDownOutside: u,
1817
+ children: g
1814
1818
  }
1815
1819
  )
1816
- ] }) : /* @__PURE__ */ e(Se, { open: o, onOpenChange: m, children: /* @__PURE__ */ r(
1817
- De,
1820
+ ] }) : /* @__PURE__ */ e(De, { open: c, onOpenChange: p, children: /* @__PURE__ */ r(
1821
+ ke,
1818
1822
  {
1819
1823
  className: "flex max-h-[88vh] flex-col overflow-hidden sm:max-w-[600px]",
1820
- onEscapeKeyDown: d,
1821
- onPointerDownOutside: d,
1824
+ onEscapeKeyDown: u,
1825
+ onPointerDownOutside: u,
1822
1826
  children: [
1823
1827
  /* @__PURE__ */ r(
1824
- it,
1828
+ ct,
1825
1829
  {
1826
1830
  className: l ? "space-y-0" : void 0,
1827
1831
  children: [
1828
- /* @__PURE__ */ e(ke, { className: "text-[15px]", children: U }),
1832
+ /* @__PURE__ */ e(Ae, { className: "text-[15px]", children: U }),
1829
1833
  /* @__PURE__ */ e(
1830
- lt,
1834
+ dt,
1831
1835
  {
1832
1836
  className: l ? "sr-only" : "text-[13px]",
1833
1837
  children: l ? "Configure and add a shared dashboard control." : "Add shared controls viewers can use across the dashboard. Each card can decide how to respond to the same control."
@@ -1836,7 +1840,7 @@ function _a({
1836
1840
  ]
1837
1841
  }
1838
1842
  ),
1839
- /* @__PURE__ */ e("div", { className: "min-h-0 overflow-y-auto pr-1", children: k })
1843
+ /* @__PURE__ */ e("div", { className: "min-h-0 overflow-y-auto pr-1", children: A })
1840
1844
  ]
1841
1845
  }
1842
1846
  ) });
@@ -1852,101 +1856,101 @@ const $a = [
1852
1856
  function ja({
1853
1857
  open: t,
1854
1858
  onOpenChange: a,
1855
- initialMode: i = "manage"
1859
+ initialMode: o = "manage"
1856
1860
  }) {
1857
- var b;
1858
- const s = i === "create", {
1859
- forceClose: n,
1860
- handleOpenChange: c,
1861
- isCreateFlowActive: u,
1862
- preventPassiveDismissDuringCreate: m,
1861
+ var g;
1862
+ const n = o === "create", {
1863
+ forceClose: i,
1864
+ handleOpenChange: s,
1865
+ isCreateFlowActive: d,
1866
+ preventPassiveDismissDuringCreate: p,
1863
1867
  resolvedOpen: l,
1864
- setIsCreateFlowActive: d
1865
- } = Rt({
1868
+ setIsCreateFlowActive: u
1869
+ } = Pt({
1866
1870
  open: t,
1867
1871
  onOpenChange: a,
1868
- initialCreateFlowActive: i === "create",
1872
+ initialCreateFlowActive: o === "create",
1869
1873
  dismissMode: "explicit-only"
1870
- }), o = P((x) => x.dashboard), f = P((x) => x.selectedSheetId), { setDashboardInputs: h } = be(), p = (b = o.sheets) == null ? void 0 : b.find(
1871
- (x) => x.id === f
1872
- ), C = (p == null ? void 0 : p.kind) === "document" && !!p.document, y = ee(
1873
- () => C && (p != null && p.document) ? Cr(o, p.id) : [],
1874
- [o, C, p == null ? void 0 : p.document, p == null ? void 0 : p.id]
1875
- ), D = ee(
1876
- () => y.filter(
1877
- (x) => x.kind === "control"
1874
+ }), c = P((v) => v.dashboard), m = P((v) => v.selectedSheetId), { setDashboardInputs: h } = be(), f = (g = c.sheets) == null ? void 0 : g.find(
1875
+ (v) => v.id === m
1876
+ ), x = (f == null ? void 0 : f.kind) === "document" && !!f.document, C = ee(
1877
+ () => x && (f != null && f.document) ? wr(c, f.id) : [],
1878
+ [c, x, f == null ? void 0 : f.document, f == null ? void 0 : f.id]
1879
+ ), N = ee(
1880
+ () => C.filter(
1881
+ (v) => v.kind === "control"
1878
1882
  ),
1879
- [y]
1883
+ [C]
1880
1884
  ), I = ee(
1881
- () => D.map((x) => x.control),
1882
- [D]
1883
- ), N = ee(
1885
+ () => N.map((v) => v.control),
1886
+ [N]
1887
+ ), D = ee(
1884
1888
  () => Ha(I),
1885
1889
  [I]
1886
- ), g = ee(
1887
- () => Wa(o),
1888
- [o]
1889
- ), S = q(() => {
1890
- if (s) {
1891
- n();
1890
+ ), b = ee(
1891
+ () => Wa(c),
1892
+ [c]
1893
+ ), S = K(() => {
1894
+ if (n) {
1895
+ i();
1892
1896
  return;
1893
1897
  }
1894
- d(!1);
1895
- }, [s, n, d]), k = q(
1896
- (x, T, F) => {
1897
- !C || !(p != null && p.document) || h(
1898
+ u(!1);
1899
+ }, [n, i, u]), A = K(
1900
+ (v, T, F) => {
1901
+ !x || !(f != null && f.document) || h(
1898
1902
  Ka({
1899
- allInputs: o.inputs || [],
1900
- documentSheetId: p.id,
1901
- currentDocumentInputs: y,
1902
- nextControls: x,
1903
+ allInputs: c.inputs || [],
1904
+ documentSheetId: f.id,
1905
+ currentDocumentInputs: C,
1906
+ nextControls: v,
1903
1907
  nextDefaultValues: T,
1904
1908
  change: F
1905
1909
  })
1906
1910
  );
1907
1911
  },
1908
1912
  [
1909
- o.inputs,
1910
- y,
1913
+ c.inputs,
1911
1914
  C,
1912
- p,
1915
+ x,
1916
+ f,
1913
1917
  h
1914
1918
  ]
1915
1919
  );
1916
- return !C || !(p != null && p.document) ? null : /* @__PURE__ */ e(Se, { open: l, onOpenChange: c, children: /* @__PURE__ */ r(
1917
- De,
1920
+ return !x || !(f != null && f.document) ? null : /* @__PURE__ */ e(De, { open: l, onOpenChange: s, children: /* @__PURE__ */ r(
1921
+ ke,
1918
1922
  {
1919
1923
  className: "flex max-h-[88vh] flex-col overflow-hidden sm:max-w-[600px]",
1920
- onEscapeKeyDown: m,
1921
- onPointerDownOutside: m,
1924
+ onEscapeKeyDown: p,
1925
+ onPointerDownOutside: p,
1922
1926
  children: [
1923
- /* @__PURE__ */ r(it, { className: u ? "space-y-0" : void 0, children: [
1924
- /* @__PURE__ */ e(ke, { className: "text-[15px]", children: u ? "Add document control" : "Document Controls" }),
1927
+ /* @__PURE__ */ r(ct, { className: d ? "space-y-0" : void 0, children: [
1928
+ /* @__PURE__ */ e(Ae, { className: "text-[15px]", children: d ? "Add document control" : "Document Controls" }),
1925
1929
  /* @__PURE__ */ e(
1926
- lt,
1930
+ dt,
1927
1931
  {
1928
- className: u ? "sr-only" : "text-[13px]",
1929
- children: u ? "Configure and add a document-local control input." : "Add document-local control inputs. They are stored on this document sheet and are not dashboard controls."
1932
+ className: d ? "sr-only" : "text-[13px]",
1933
+ children: d ? "Configure and add a document-local control input." : "Add document-local control inputs. They are stored on this document sheet and are not dashboard controls."
1930
1934
  }
1931
1935
  )
1932
1936
  ] }),
1933
1937
  /* @__PURE__ */ e("div", { className: "min-h-0 overflow-y-auto pr-1", children: /* @__PURE__ */ e(
1934
- Ut,
1938
+ Mt,
1935
1939
  {
1936
1940
  scope: "dashboard",
1937
1941
  controls: I,
1938
- reservedControlIds: g,
1939
- defaultValues: N,
1942
+ reservedControlIds: b,
1943
+ defaultValues: D,
1940
1944
  usageByControlId: {},
1941
1945
  availableFieldChoices: [],
1942
1946
  availableMetricChoices: [],
1943
1947
  structuralParticipants: [],
1944
1948
  structuralParticipantIdsByControlId: {},
1945
1949
  allowedControlTypes: $a,
1946
- initialCreateFlow: i === "create",
1947
- onCreateFlowActiveChange: d,
1950
+ initialCreateFlow: o === "create",
1951
+ onCreateFlowActiveChange: u,
1948
1952
  onCreateFlowComplete: S,
1949
- onChange: k,
1953
+ onChange: A,
1950
1954
  emptyMessage: "No document controls yet."
1951
1955
  }
1952
1956
  ) })
@@ -1959,8 +1963,8 @@ function Wa(t) {
1959
1963
  }
1960
1964
  function Ha(t) {
1961
1965
  const a = {};
1962
- for (const i of t)
1963
- i.defaultValue !== void 0 && (a[i.id] = i.defaultValue);
1966
+ for (const o of t)
1967
+ o.defaultValue !== void 0 && (a[o.id] = o.defaultValue);
1964
1968
  return a;
1965
1969
  }
1966
1970
  function Ga(t, a) {
@@ -1972,135 +1976,135 @@ function Ga(t, a) {
1972
1976
  function Ka({
1973
1977
  allInputs: t,
1974
1978
  documentSheetId: a,
1975
- currentDocumentInputs: i,
1976
- nextControls: s,
1977
- nextDefaultValues: n,
1978
- change: c
1979
+ currentDocumentInputs: o,
1980
+ nextControls: n,
1981
+ nextDefaultValues: i,
1982
+ change: s
1979
1983
  }) {
1980
- const u = new Map(
1981
- s.map((h) => [
1984
+ const d = new Map(
1985
+ n.map((h) => [
1982
1986
  h.id,
1983
- Ga(h, n)
1987
+ Ga(h, i)
1984
1988
  ])
1985
- ), m = (c == null ? void 0 : c.type) === "rename" ? { oldId: c.oldId, newId: c.newId } : null, l = /* @__PURE__ */ new Set(), d = [];
1986
- for (const h of i) {
1989
+ ), p = (s == null ? void 0 : s.type) === "rename" ? { oldId: s.oldId, newId: s.newId } : null, l = /* @__PURE__ */ new Set(), u = [];
1990
+ for (const h of o) {
1987
1991
  if (h.kind !== "control") {
1988
- d.push(h);
1992
+ u.push(h);
1989
1993
  continue;
1990
1994
  }
1991
- const p = u.get(h.control.id) || ((m == null ? void 0 : m.oldId) === h.control.id ? u.get(m.newId) : void 0);
1992
- if (!p)
1995
+ const f = d.get(h.control.id) || ((p == null ? void 0 : p.oldId) === h.control.id ? d.get(p.newId) : void 0);
1996
+ if (!f)
1993
1997
  continue;
1994
- l.add(p.id);
1995
- const C = ta(
1996
- p.id,
1997
- [...t, ...d].filter(
1998
- (D) => D.id !== h.id
1998
+ l.add(f.id);
1999
+ const x = ta(
2000
+ f.id,
2001
+ [...t, ...u].filter(
2002
+ (N) => N.id !== h.id
1999
2003
  )
2000
- ), y = p.id === C ? p : { ...p, id: C };
2001
- d.push({
2004
+ ), C = f.id === x ? f : { ...f, id: x };
2005
+ u.push({
2002
2006
  ...h,
2003
- label: y.label,
2004
- variableName: C,
2005
- requiredAtExecution: y.requiredAtExecution,
2006
- control: y
2007
+ label: C.label,
2008
+ variableName: x,
2009
+ requiredAtExecution: C.requiredAtExecution,
2010
+ control: C
2007
2011
  });
2008
2012
  }
2009
- for (const h of u.values())
2010
- l.has(h.id) || d.push(
2011
- wr({
2013
+ for (const h of d.values())
2014
+ l.has(h.id) || u.push(
2015
+ Nr({
2012
2016
  control: h,
2013
- existingInputs: [...t, ...d],
2017
+ existingInputs: [...t, ...u],
2014
2018
  sheetId: a
2015
2019
  })
2016
2020
  );
2017
- const o = new Set(
2018
- i.map((h) => h.id)
2021
+ const c = new Set(
2022
+ o.map((h) => h.id)
2019
2023
  );
2020
2024
  return [...t.filter(
2021
- (h) => !o.has(h.id)
2022
- ), ...d];
2025
+ (h) => !c.has(h.id)
2026
+ ), ...u];
2023
2027
  }
2024
2028
  function qa({
2025
2029
  showFilters: t,
2026
2030
  onShowFiltersChange: a,
2027
- pickerContent: i,
2028
- settingsContent: s,
2029
- size: n = "default",
2030
- className: c,
2031
- primaryButtonClassName: u,
2032
- secondaryButtonClassName: m,
2031
+ pickerContent: o,
2032
+ settingsContent: n,
2033
+ size: i = "default",
2034
+ className: s,
2035
+ primaryButtonClassName: d,
2036
+ secondaryButtonClassName: p,
2033
2037
  pickerContentClassName: l,
2034
- settingsContentClassName: d
2038
+ settingsContentClassName: u
2035
2039
  }) {
2036
- const o = n === "toolbar", [f, h] = E(!1), p = Nr("interactive");
2040
+ const c = i === "toolbar", [m, h] = E(!1), f = et("interactive");
2037
2041
  return /* @__PURE__ */ r(
2038
2042
  "div",
2039
2043
  {
2040
- className: X(
2044
+ className: q(
2041
2045
  // Height lives on the shell so the outer border is part of the
2042
2046
  // h-7 box (matches regular `size="xs"` buttons). Inner triggers
2043
2047
  // stretch to fill via `h-full`.
2044
2048
  "relative inline-flex items-stretch overflow-hidden rounded-control border border-input bg-background",
2045
- o ? "h-8" : "h-7",
2046
- c
2049
+ c ? "h-8" : "h-7",
2050
+ s
2047
2051
  ),
2048
2052
  children: [
2049
- /* @__PURE__ */ r(Ue, { open: t, onOpenChange: a, children: [
2050
- /* @__PURE__ */ e(Pe, { asChild: !0, children: /* @__PURE__ */ r(
2053
+ /* @__PURE__ */ r(Oe, { open: t, onOpenChange: a, children: [
2054
+ /* @__PURE__ */ e(_e, { asChild: !0, children: /* @__PURE__ */ r(
2051
2055
  B,
2052
2056
  {
2053
2057
  variant: "ghost",
2054
2058
  size: "xs",
2055
- className: X(
2059
+ className: q(
2056
2060
  "h-full rounded-none border-0 bg-transparent pl-2.5 pr-2 shadow-none hover:bg-accent/50 data-[state=open]:bg-accent/60",
2057
- u
2061
+ d
2058
2062
  ),
2059
2063
  children: [
2060
- t ? /* @__PURE__ */ e(ua, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ e(At, { className: "h-3.5 w-3.5" }),
2064
+ t ? /* @__PURE__ */ e(ua, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ e(It, { className: "h-3.5 w-3.5" }),
2061
2065
  "Filter"
2062
2066
  ]
2063
2067
  }
2064
2068
  ) }),
2065
2069
  /* @__PURE__ */ e(
2066
- Me,
2070
+ ze,
2067
2071
  {
2068
2072
  align: "end",
2069
2073
  sideOffset: 6,
2070
- className: X(
2071
- "w-auto rounded-card border border-border/60 p-0 shadow-sm",
2074
+ className: q(
2075
+ "w-auto rounded-card border border-border/60 p-0 shadow-[0_10px_28px_rgba(0,0,0,0.14)] dark:shadow-[0_10px_28px_rgba(0,0,0,0.5)]",
2072
2076
  l
2073
2077
  ),
2074
- style: p.contentStyle,
2075
- children: i
2078
+ style: f.contentStyle,
2079
+ children: o
2076
2080
  }
2077
2081
  )
2078
2082
  ] }),
2079
- /* @__PURE__ */ r(Ue, { open: f, onOpenChange: h, children: [
2080
- /* @__PURE__ */ e(Pe, { asChild: !0, children: /* @__PURE__ */ e(
2083
+ /* @__PURE__ */ r(Oe, { open: m, onOpenChange: h, children: [
2084
+ /* @__PURE__ */ e(_e, { asChild: !0, children: /* @__PURE__ */ e(
2081
2085
  B,
2082
2086
  {
2083
2087
  variant: "ghost",
2084
2088
  size: "xs",
2085
- className: X(
2089
+ className: q(
2086
2090
  "h-full w-7 rounded-none border-0 border-l border-border/60 bg-transparent px-0 shadow-none hover:bg-accent/50 data-[state=open]:bg-accent/60",
2087
- m
2091
+ p
2088
2092
  ),
2089
2093
  "aria-label": "Filter and control actions",
2090
- children: /* @__PURE__ */ e(Vt, { className: "h-3.5 w-3.5" })
2094
+ children: /* @__PURE__ */ e(Ut, { className: "h-3.5 w-3.5" })
2091
2095
  }
2092
2096
  ) }),
2093
2097
  /* @__PURE__ */ e(
2094
- Me,
2098
+ ze,
2095
2099
  {
2096
2100
  align: "end",
2097
2101
  sideOffset: 6,
2098
- className: X(
2099
- "w-auto rounded-card border border-border/60 p-0 shadow-sm",
2100
- d
2102
+ className: q(
2103
+ "w-auto rounded-card border border-border/60 p-0 shadow-[0_10px_28px_rgba(0,0,0,0.14)] dark:shadow-[0_10px_28px_rgba(0,0,0,0.5)]",
2104
+ u
2101
2105
  ),
2102
- style: p.contentStyle,
2103
- children: s(() => h(!1))
2106
+ style: f.contentStyle,
2107
+ children: n(() => h(!1))
2104
2108
  }
2105
2109
  )
2106
2110
  ] })
@@ -2110,37 +2114,37 @@ function qa({
2110
2114
  }
2111
2115
  function Xa() {
2112
2116
  ha();
2113
- const t = P((l) => l.selectedSheetId), a = P((l) => l.selectedFrameId), i = P((l) => l.dashboard), s = P((l) => l.actions.getSelectedFrame), { setSelectedFrameId: n } = be(), { setCard: c } = Bt(), u = ge((l) => l.card.dataSource);
2114
- return J(() => {
2115
- var d, o;
2116
- let l = s();
2117
+ const t = P((l) => l.selectedSheetId), a = P((l) => l.selectedFrameId), o = P((l) => l.dashboard), n = P((l) => l.actions.getSelectedFrame), { setSelectedFrameId: i } = be(), { setCard: s } = Vt(), d = ge((l) => l.card.dataSource);
2118
+ return Q(() => {
2119
+ var u, c;
2120
+ let l = n();
2117
2121
  if (!l) {
2118
- const f = (d = i == null ? void 0 : i.sheets) == null ? void 0 : d.find((p) => p.id === t), h = (o = f == null ? void 0 : f.frames) == null ? void 0 : o[0];
2119
- h && (n(h.id), l = h);
2122
+ const m = (u = o == null ? void 0 : o.sheets) == null ? void 0 : u.find((f) => f.id === t), h = (c = m == null ? void 0 : m.frames) == null ? void 0 : c[0];
2123
+ h && (i(h.id), l = h);
2120
2124
  }
2121
2125
  if (l) {
2122
- const f = l.cards.find((h) => h.id === l.activeCardId);
2123
- f && c(f);
2126
+ const m = l.cards.find((h) => h.id === l.activeCardId);
2127
+ m && s(m);
2124
2128
  }
2125
- }, [s, t, a, i, n, c]), {
2126
- hasEntities: !!(u != null && u.selectedEntities && u.selectedEntities.length > 0)
2129
+ }, [n, t, a, o, i, s]), {
2130
+ hasEntities: !!(d != null && d.selectedEntities && d.selectedEntities.length > 0)
2127
2131
  };
2128
2132
  }
2129
2133
  function Za() {
2130
2134
  const t = P((l) => l.dashboard), a = P(
2131
2135
  (l) => l.semanticExecutionPayload
2132
- ), i = P((l) => l.actions.addFilter), { hasEntities: s } = Xa(), { isLoading: n } = Sr(), c = ee(
2136
+ ), o = P((l) => l.actions.addFilter), { hasEntities: n } = Xa(), { isLoading: i } = Sr(), s = ee(
2133
2137
  () => ra(t, a),
2134
2138
  [t, a]
2135
- ), m = !aa(t.filters) && c.hasEligibleCards && !n;
2139
+ ), p = !aa(t.filters) && s.hasEligibleCards && !i;
2136
2140
  return /* @__PURE__ */ r("div", { className: "flex h-[520px] w-[400px] flex-col", children: [
2137
- m && /* @__PURE__ */ e("div", { className: "border-b border-border/60 p-2", children: /* @__PURE__ */ r(
2141
+ p && /* @__PURE__ */ e("div", { className: "border-b border-border/60 p-2", children: /* @__PURE__ */ r(
2138
2142
  "button",
2139
2143
  {
2140
2144
  type: "button",
2141
- onClick: () => i(na()),
2142
- title: `Applies to ${c.eligibleCardCount} of ${c.totalCardCount} date-aware cards`,
2143
- className: "flex w-full items-start gap-2 rounded-[4px] px-2 py-1.5 text-left outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-border",
2145
+ onClick: () => o(na()),
2146
+ title: `Applies to ${s.eligibleCardCount} of ${s.totalCardCount} date-aware cards`,
2147
+ className: "flex w-full items-start gap-2 rounded-control px-2 py-1.5 text-left outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-border",
2144
2148
  children: [
2145
2149
  /* @__PURE__ */ e(xa, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
2146
2150
  /* @__PURE__ */ r("span", { className: "flex min-w-0 flex-col", children: [
@@ -2150,55 +2154,55 @@ function Za() {
2150
2154
  ]
2151
2155
  }
2152
2156
  ) }),
2153
- !s && /* @__PURE__ */ r("div", { className: "flex flex-1 flex-col items-center justify-center px-6 py-8 text-center", children: [
2157
+ !n && /* @__PURE__ */ r("div", { className: "flex flex-1 flex-col items-center justify-center px-6 py-8 text-center", children: [
2154
2158
  /* @__PURE__ */ e(Dr, { className: "mb-3 h-10 w-10 text-muted-foreground/50" }),
2155
2159
  /* @__PURE__ */ e("h3", { className: "mb-1 text-[13px] font-medium text-foreground", children: "No fields configured" }),
2156
2160
  /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "Configure a data source for this card to enable filtering." })
2157
2161
  ] }),
2158
- s && /* @__PURE__ */ e("div", { className: "flex flex-1 overflow-hidden", children: /* @__PURE__ */ e(kr, { context: "filter" }) })
2162
+ n && /* @__PURE__ */ e("div", { className: "flex flex-1 overflow-hidden", children: /* @__PURE__ */ e(kr, { context: "filter" }) })
2159
2163
  ] });
2160
2164
  }
2161
- const vt = !1;
2165
+ const Ct = !1;
2162
2166
  function Qa({
2163
2167
  onAddFilter: t,
2164
2168
  onAddControl: a,
2165
- onManageControls: i,
2166
- onDismiss: s
2169
+ onManageControls: o,
2170
+ onDismiss: n
2167
2171
  }) {
2168
- const n = P(
2169
- (m) => m.dashboard.filterLayout
2170
- ), { setFilterLayout: c } = be();
2171
- n != null && n.displayMode;
2172
- const u = (n == null ? void 0 : n.toolbarWrap) ?? !1;
2173
- return n == null || n.showDownloadButton, /* @__PURE__ */ r("div", { className: "w-[300px]", children: [
2172
+ const i = P(
2173
+ (p) => p.dashboard.filterLayout
2174
+ ), { setFilterLayout: s } = be();
2175
+ i != null && i.displayMode;
2176
+ const d = (i == null ? void 0 : i.toolbarWrap) ?? !1;
2177
+ return i == null || i.showDownloadButton, /* @__PURE__ */ r("div", { className: "w-[300px]", children: [
2174
2178
  /* @__PURE__ */ r("div", { className: "p-1", children: [
2175
2179
  /* @__PURE__ */ e(
2176
- Ze,
2180
+ Qe,
2177
2181
  {
2178
- icon: At,
2182
+ icon: It,
2179
2183
  label: "Add filter",
2180
2184
  onClick: () => {
2181
- t(), s();
2185
+ t(), n();
2182
2186
  }
2183
2187
  }
2184
2188
  ),
2185
2189
  /* @__PURE__ */ e(
2186
- Ze,
2190
+ Qe,
2187
2191
  {
2188
- icon: Tt,
2192
+ icon: Rt,
2189
2193
  label: "Add control",
2190
2194
  onClick: () => {
2191
- a(), s();
2195
+ a(), n();
2192
2196
  }
2193
2197
  }
2194
2198
  ),
2195
2199
  /* @__PURE__ */ e(
2196
- Ze,
2200
+ Qe,
2197
2201
  {
2198
- icon: Et,
2202
+ icon: Ft,
2199
2203
  label: "Manage controls",
2200
2204
  onClick: () => {
2201
- i(), s();
2205
+ o(), n();
2202
2206
  }
2203
2207
  }
2204
2208
  )
@@ -2206,31 +2210,31 @@ function Qa({
2206
2210
  /* @__PURE__ */ e("div", { className: "border-t border-border/60" }),
2207
2211
  /* @__PURE__ */ r("div", { className: "space-y-1 p-2", children: [
2208
2212
  /* @__PURE__ */ e("p", { className: "px-1 text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Display" }),
2209
- vt,
2213
+ Ct,
2210
2214
  /* @__PURE__ */ e(
2211
2215
  Ya,
2212
2216
  {
2213
2217
  id: "filter-display-wrap",
2214
2218
  label: "Wrap to multiple lines",
2215
- checked: u,
2216
- onCheckedChange: (m) => c({ toolbarWrap: m === !0 })
2219
+ checked: d,
2220
+ onCheckedChange: (p) => s({ toolbarWrap: p === !0 })
2217
2221
  }
2218
2222
  ),
2219
- vt
2223
+ Ct
2220
2224
  ] })
2221
2225
  ] });
2222
2226
  }
2223
- function Ze({
2227
+ function Qe({
2224
2228
  icon: t,
2225
2229
  label: a,
2226
- onClick: i
2230
+ onClick: o
2227
2231
  }) {
2228
2232
  return /* @__PURE__ */ r(
2229
2233
  "button",
2230
2234
  {
2231
2235
  type: "button",
2232
- onClick: i,
2233
- className: "flex w-full items-center gap-2 rounded-[4px] px-2 py-1.5 text-left text-[13px] text-foreground transition-colors hover:bg-muted/40",
2236
+ onClick: o,
2237
+ className: "flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left text-[13px] text-foreground outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40",
2234
2238
  children: [
2235
2239
  /* @__PURE__ */ e(t, { className: "h-3.5 w-3.5 text-muted-foreground" }),
2236
2240
  a
@@ -2241,13 +2245,13 @@ function Ze({
2241
2245
  function Ya({
2242
2246
  id: t,
2243
2247
  label: a,
2244
- checked: i,
2245
- onCheckedChange: s
2248
+ checked: o,
2249
+ onCheckedChange: n
2246
2250
  }) {
2247
- return /* @__PURE__ */ r("div", { className: "flex items-center gap-2 rounded-[4px] px-1 py-1 transition-colors hover:bg-muted/40", children: [
2248
- /* @__PURE__ */ e(ot, { id: t, checked: i, onCheckedChange: s }),
2251
+ return /* @__PURE__ */ r("div", { className: "flex items-center gap-2 rounded-control px-1 py-1 transition-colors hover:bg-muted/40 focus-within:bg-muted/40", children: [
2252
+ /* @__PURE__ */ e(lt, { id: t, checked: o, onCheckedChange: n }),
2249
2253
  /* @__PURE__ */ e(
2250
- Ne,
2254
+ Se,
2251
2255
  {
2252
2256
  htmlFor: t,
2253
2257
  className: "cursor-pointer text-[12px] font-normal leading-[1.3]",
@@ -2256,85 +2260,85 @@ function Ya({
2256
2260
  )
2257
2261
  ] });
2258
2262
  }
2259
- function qn({
2263
+ function Zn({
2260
2264
  size: t,
2261
2265
  className: a,
2262
- primaryButtonClassName: i,
2263
- secondaryButtonClassName: s,
2264
- pickerContentClassName: n,
2265
- settingsContentClassName: c
2266
+ primaryButtonClassName: o,
2267
+ secondaryButtonClassName: n,
2268
+ pickerContentClassName: i,
2269
+ settingsContentClassName: s
2266
2270
  }) {
2267
2271
  var U;
2268
- const [u, m] = E(null), l = P((b) => b.dashboard), d = P((b) => b.selectedSheetId), o = P((b) => b.showFilters), f = Ar((b) => b.setPanelOpen), h = P((b) => b.actions), { setDocumentInspectorTab: p, setShowFilters: C } = h, y = (U = l.sheets) == null ? void 0 : U.find(
2269
- (b) => b.id === d
2270
- ), D = sa(y), I = q((b) => {
2272
+ const [d, p] = E(null), l = P((g) => g.dashboard), u = P((g) => g.selectedSheetId), c = P((g) => g.showFilters), m = Ar((g) => g.setPanelOpen), h = P((g) => g.actions), { setDocumentInspectorTab: f, setShowFilters: x } = h, C = (U = l.sheets) == null ? void 0 : U.find(
2273
+ (g) => g.id === u
2274
+ ), N = sa(C), I = K((g) => {
2271
2275
  window.setTimeout(() => {
2272
- m(b);
2276
+ p(g);
2273
2277
  }, 0);
2274
- }, []), N = q(
2275
- (b) => {
2276
- if (D && d) {
2277
- b && p(d, "inputs");
2278
+ }, []), D = K(
2279
+ (g) => {
2280
+ if (N && u) {
2281
+ g && f(u, "inputs");
2278
2282
  return;
2279
2283
  }
2280
- b && f("dashboard", !1), C(b);
2284
+ g && m("dashboard", !1), x(g);
2281
2285
  },
2282
2286
  [
2283
- D,
2284
- d,
2285
- p,
2287
+ N,
2288
+ u,
2286
2289
  f,
2287
- C
2290
+ m,
2291
+ x
2288
2292
  ]
2289
- ), g = q(() => {
2290
- N(!0);
2291
- }, [N]), S = q(() => {
2293
+ ), b = K(() => {
2294
+ D(!0);
2295
+ }, [D]), S = K(() => {
2292
2296
  I("create");
2293
- }, [I]), k = q(() => {
2297
+ }, [I]), A = K(() => {
2294
2298
  I("manage");
2295
2299
  }, [I]);
2296
2300
  return /* @__PURE__ */ r(W, { children: [
2297
2301
  /* @__PURE__ */ e(
2298
2302
  qa,
2299
2303
  {
2300
- showFilters: D ? !1 : o,
2301
- onShowFiltersChange: N,
2304
+ showFilters: N ? !1 : c,
2305
+ onShowFiltersChange: D,
2302
2306
  pickerContent: /* @__PURE__ */ e(Za, {}),
2303
- settingsContent: (b) => /* @__PURE__ */ e(
2307
+ settingsContent: (g) => /* @__PURE__ */ e(
2304
2308
  Qa,
2305
2309
  {
2306
- onAddFilter: g,
2310
+ onAddFilter: b,
2307
2311
  onAddControl: S,
2308
- onManageControls: k,
2309
- onDismiss: b
2312
+ onManageControls: A,
2313
+ onDismiss: g
2310
2314
  }
2311
2315
  ),
2312
2316
  size: t,
2313
2317
  className: a,
2314
- primaryButtonClassName: i,
2315
- secondaryButtonClassName: s,
2316
- pickerContentClassName: n,
2317
- settingsContentClassName: c
2318
+ primaryButtonClassName: o,
2319
+ secondaryButtonClassName: n,
2320
+ pickerContentClassName: i,
2321
+ settingsContentClassName: s
2318
2322
  }
2319
2323
  ),
2320
- u ? D ? /* @__PURE__ */ e(
2324
+ d ? N ? /* @__PURE__ */ e(
2321
2325
  ja,
2322
2326
  {
2323
2327
  open: !0,
2324
- onOpenChange: (b) => {
2325
- b || m(null);
2328
+ onOpenChange: (g) => {
2329
+ g || p(null);
2326
2330
  },
2327
- initialMode: u
2331
+ initialMode: d
2328
2332
  }
2329
2333
  ) : /* @__PURE__ */ e(
2330
- _a,
2334
+ za,
2331
2335
  {
2332
2336
  open: !0,
2333
- onOpenChange: (b) => {
2334
- b || m(null);
2337
+ onOpenChange: (g) => {
2338
+ g || p(null);
2335
2339
  },
2336
2340
  showTrigger: !1,
2337
- initialMode: u
2341
+ initialMode: d
2338
2342
  }
2339
2343
  ) : null
2340
2344
  ] });
@@ -2342,10 +2346,10 @@ function qn({
2342
2346
  function Ja({
2343
2347
  disabled: t,
2344
2348
  briefingCount: a,
2345
- className: i,
2346
- onClick: s
2349
+ className: o,
2350
+ onClick: n
2347
2351
  }) {
2348
- const n = typeof a == "number" && a > 0;
2352
+ const i = typeof a == "number" && a > 0;
2349
2353
  return /* @__PURE__ */ r(
2350
2354
  B,
2351
2355
  {
@@ -2353,18 +2357,18 @@ function Ja({
2353
2357
  size: "xs",
2354
2358
  variant: "outline",
2355
2359
  disabled: t,
2356
- className: X("gap-1.5", i),
2357
- onClick: s,
2360
+ className: q("gap-1.5", o),
2361
+ onClick: n,
2358
2362
  "aria-label": "Reports & briefings",
2359
2363
  children: [
2360
2364
  /* @__PURE__ */ e(ya, { className: "h-3.5 w-3.5" }),
2361
2365
  "Reports & briefings",
2362
- n ? /* @__PURE__ */ e("span", { className: "ml-0.5 rounded-control bg-muted px-1 text-[10px] tabular-nums text-foreground/70", children: a }) : null
2366
+ i ? /* @__PURE__ */ e("span", { className: "ml-0.5 rounded-control bg-muted px-1 text-[10px] tabular-nums text-foreground/70", children: a }) : null
2363
2367
  ]
2364
2368
  }
2365
2369
  );
2366
2370
  }
2367
- const en = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", Ot = "inline-flex h-7 items-center gap-1.5 rounded-control px-2 text-[12px] text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50", Te = "inline-flex h-7 items-center gap-1.5 rounded-control bg-primary px-3 text-[12px] font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50";
2371
+ const en = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", zt = "inline-flex h-7 items-center gap-1.5 rounded-control px-2 text-[12px] text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50", Ue = "inline-flex h-7 items-center gap-1.5 rounded-control bg-primary px-3 text-[12px] font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50";
2368
2372
  function tn(t) {
2369
2373
  return t === "dashboard" ? "This dashboard" : "Project";
2370
2374
  }
@@ -2372,15 +2376,15 @@ function rn(t) {
2372
2376
  if (!t) return "Never";
2373
2377
  const a = new Date(t);
2374
2378
  if (Number.isNaN(a.getTime())) return "Unknown";
2375
- const i = Date.now() - a.getTime(), s = Math.round(i / 6e4);
2376
- if (s < 1) return "now";
2377
- if (s < 60) return `${s}m ago`;
2378
- const n = Math.round(s / 60);
2379
- if (n < 24) return `${n}h ago`;
2380
- const c = Math.round(n / 24);
2381
- if (c < 7) return `${c}d ago`;
2382
- const u = Math.round(c / 7);
2383
- return u < 5 ? `${u}w ago` : `${Math.round(c / 30)}mo ago`;
2379
+ const o = Date.now() - a.getTime(), n = Math.round(o / 6e4);
2380
+ if (n < 1) return "now";
2381
+ if (n < 60) return `${n}m ago`;
2382
+ const i = Math.round(n / 60);
2383
+ if (i < 24) return `${i}h ago`;
2384
+ const s = Math.round(i / 24);
2385
+ if (s < 7) return `${s}d ago`;
2386
+ const d = Math.round(s / 7);
2387
+ return d < 5 ? `${d}w ago` : `${Math.round(s / 30)}mo ago`;
2384
2388
  }
2385
2389
  function an(t) {
2386
2390
  return t.scheduleExpr ? fa(
@@ -2395,7 +2399,7 @@ function nn(t) {
2395
2399
  }
2396
2400
  return null;
2397
2401
  }
2398
- function zt(t) {
2402
+ function $t(t) {
2399
2403
  return t.hasActiveRun ? "Running" : t.lastRunStatus ? `Last run ${t.lastRunStatus.toString().toLowerCase()}` : "Idle";
2400
2404
  }
2401
2405
  function sn(t) {
@@ -2411,22 +2415,22 @@ function on({
2411
2415
  className: "flex shrink-0 items-center gap-1 rounded-control bg-muted p-0.5",
2412
2416
  role: "tablist",
2413
2417
  "aria-label": "Briefing source view",
2414
- children: ["dashboard", "project"].map((i) => {
2415
- const s = t === i;
2418
+ children: ["dashboard", "project"].map((o) => {
2419
+ const n = t === o;
2416
2420
  return /* @__PURE__ */ e(
2417
2421
  "button",
2418
2422
  {
2419
2423
  type: "button",
2420
2424
  role: "tab",
2421
- "aria-selected": s,
2422
- onClick: () => a(i),
2423
- className: X(
2425
+ "aria-selected": n,
2426
+ onClick: () => a(o),
2427
+ className: q(
2424
2428
  "h-6 rounded-[3px] px-2 text-[11px] transition-colors",
2425
- s ? "bg-background font-medium text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"
2429
+ n ? "bg-background font-medium text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"
2426
2430
  ),
2427
- children: tn(i)
2431
+ children: tn(o)
2428
2432
  },
2429
- i
2433
+ o
2430
2434
  );
2431
2435
  })
2432
2436
  }
@@ -2435,45 +2439,45 @@ function on({
2435
2439
  function ln({
2436
2440
  briefings: t,
2437
2441
  dashboardLabel: a,
2438
- sourceView: i,
2439
- error: s,
2440
- loading: n,
2441
- onSourceViewChange: c,
2442
- onClose: u,
2443
- onEdit: m,
2442
+ sourceView: o,
2443
+ error: n,
2444
+ loading: i,
2445
+ onSourceViewChange: s,
2446
+ onClose: d,
2447
+ onEdit: p,
2444
2448
  onNew: l,
2445
- canCreate: d,
2446
- canCreateScheduledReport: o,
2447
- analyticalBriefingsEnabled: f,
2449
+ canCreate: u,
2450
+ canCreateScheduledReport: c,
2451
+ analyticalBriefingsEnabled: m,
2448
2452
  onRunNow: h,
2449
- onTogglePause: p,
2450
- onDelete: C,
2451
- selectingId: y,
2452
- busyId: D,
2453
+ onTogglePause: f,
2454
+ onDelete: x,
2455
+ selectingId: C,
2456
+ busyId: N,
2453
2457
  manageBriefingsHref: I,
2454
- contentKind: N,
2455
- hideHeader: g = !1
2458
+ contentKind: D,
2459
+ hideHeader: b = !1
2456
2460
  }) {
2457
- const S = t.length, k = t.filter((F) => F.status === "ACTIVE").length, U = N === "reports" ? S === 1 ? "report" : "reports" : N === "briefings" ? S === 1 ? "briefing" : "briefings" : S === 1 ? "item" : "items", b = t.find((F) => F.hasActiveRun) ?? null, x = N ?? "reports & briefings", T = i === "dashboard" ? a : `Project ${x}`;
2461
+ const S = t.length, A = t.filter((F) => F.status === "ACTIVE").length, U = D === "reports" ? S === 1 ? "report" : "reports" : D === "briefings" ? S === 1 ? "briefing" : "briefings" : S === 1 ? "item" : "items", g = t.find((F) => F.hasActiveRun) ?? null, v = D ?? "reports & briefings", T = o === "dashboard" ? a : `Project ${v}`;
2458
2462
  return /* @__PURE__ */ r(
2459
2463
  "section",
2460
2464
  {
2461
- "aria-label": `Dashboard ${x.replace("&", "and")}`,
2465
+ "aria-label": `Dashboard ${v.replace("&", "and")}`,
2462
2466
  className: "flex h-full min-h-0 flex-col bg-background text-foreground",
2463
2467
  children: [
2464
- g ? null : /* @__PURE__ */ r("header", { className: "flex items-start justify-between gap-3 border-b border-border px-4 py-3", children: [
2468
+ b ? null : /* @__PURE__ */ r("header", { className: "flex items-start justify-between gap-3 border-b border-border px-4 py-3", children: [
2465
2469
  /* @__PURE__ */ r("div", { className: "min-w-0", children: [
2466
- /* @__PURE__ */ e("div", { className: en, children: x }),
2470
+ /* @__PURE__ */ e("div", { className: en, children: v }),
2467
2471
  /* @__PURE__ */ e("h2", { className: "mt-0.5 truncate text-[14px] font-semibold leading-5", children: T })
2468
2472
  ] }),
2469
2473
  /* @__PURE__ */ e(
2470
2474
  "button",
2471
2475
  {
2472
2476
  type: "button",
2473
- onClick: u,
2477
+ onClick: d,
2474
2478
  className: "rounded-control p-1 text-muted-foreground hover:bg-muted hover:text-foreground",
2475
- "aria-label": `Close ${x.replace("&", "and")} panel`,
2476
- children: /* @__PURE__ */ e(je, { className: "h-3.5 w-3.5" })
2479
+ "aria-label": `Close ${v.replace("&", "and")} panel`,
2480
+ children: /* @__PURE__ */ e(Ge, { className: "h-3.5 w-3.5" })
2477
2481
  }
2478
2482
  )
2479
2483
  ] }),
@@ -2482,17 +2486,17 @@ function ln({
2482
2486
  /* @__PURE__ */ e(
2483
2487
  on,
2484
2488
  {
2485
- activeView: i,
2486
- onChange: c
2489
+ activeView: o,
2490
+ onChange: s
2487
2491
  }
2488
2492
  ),
2489
- /* @__PURE__ */ e("div", { className: "flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground", children: n && S === 0 ? /* @__PURE__ */ r("span", { children: [
2493
+ /* @__PURE__ */ e("div", { className: "flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground", children: i && S === 0 ? /* @__PURE__ */ r("span", { children: [
2490
2494
  "Loading ",
2491
- x,
2495
+ v,
2492
2496
  "…"
2493
2497
  ] }) : S === 0 ? /* @__PURE__ */ r("span", { children: [
2494
2498
  "No ",
2495
- x,
2499
+ v,
2496
2500
  " yet"
2497
2501
  ] }) : /* @__PURE__ */ r(W, { children: [
2498
2502
  /* @__PURE__ */ r("span", { className: "font-medium text-foreground/80", children: [
@@ -2502,49 +2506,49 @@ function ln({
2502
2506
  ] }),
2503
2507
  /* @__PURE__ */ e("span", { className: "text-border", children: "·" }),
2504
2508
  /* @__PURE__ */ r("span", { children: [
2505
- k,
2509
+ A,
2506
2510
  " active"
2507
2511
  ] })
2508
2512
  ] }) })
2509
2513
  ] }),
2510
2514
  /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: [
2511
- n ? (
2515
+ i ? (
2512
2516
  // Auto-refresh on open; surface a quiet spinner near the count
2513
2517
  // when a manual reload is in flight, but don't show a separate
2514
2518
  // refresh button — close+reopen handles the rare "stale list"
2515
2519
  // case without crowding the toolbar.
2516
2520
  /* @__PURE__ */ e(te, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground" })
2517
2521
  ) : null,
2518
- S > 0 && d ? f && o ? /* @__PURE__ */ r(Oe, { children: [
2519
- /* @__PURE__ */ e(ze, { asChild: !0, children: /* @__PURE__ */ r("button", { className: Te, children: [
2522
+ S > 0 && u ? m && c ? /* @__PURE__ */ r($e, { children: [
2523
+ /* @__PURE__ */ e(je, { asChild: !0, children: /* @__PURE__ */ r("button", { className: Ue, children: [
2520
2524
  /* @__PURE__ */ e(fe, { className: "h-3 w-3" }),
2521
2525
  " New"
2522
2526
  ] }) }),
2523
- /* @__PURE__ */ r(_e, { align: "end", children: [
2524
- /* @__PURE__ */ e(K, { onClick: () => l("scheduled_report"), children: "Schedule a report" }),
2527
+ /* @__PURE__ */ r(We, { align: "end", children: [
2528
+ /* @__PURE__ */ e(G, { onClick: () => l("scheduled_report"), children: "Schedule a report" }),
2525
2529
  /* @__PURE__ */ e(
2526
- K,
2530
+ G,
2527
2531
  {
2528
2532
  onClick: () => l("analytical_briefing"),
2529
2533
  children: "Create analytical briefing"
2530
2534
  }
2531
2535
  )
2532
2536
  ] })
2533
- ] }) : o ? /* @__PURE__ */ r(
2537
+ ] }) : c ? /* @__PURE__ */ r(
2534
2538
  "button",
2535
2539
  {
2536
2540
  onClick: () => l("scheduled_report"),
2537
- className: Te,
2541
+ className: Ue,
2538
2542
  children: [
2539
2543
  /* @__PURE__ */ e(fe, { className: "h-3 w-3" }),
2540
2544
  " Schedule report"
2541
2545
  ]
2542
2546
  }
2543
- ) : f ? /* @__PURE__ */ r(
2547
+ ) : m ? /* @__PURE__ */ r(
2544
2548
  "button",
2545
2549
  {
2546
2550
  onClick: () => l("analytical_briefing"),
2547
- className: Te,
2551
+ className: Ue,
2548
2552
  children: [
2549
2553
  /* @__PURE__ */ e(fe, { className: "h-3 w-3" }),
2550
2554
  " New briefing"
@@ -2553,34 +2557,34 @@ function ln({
2553
2557
  ) : null : null
2554
2558
  ] })
2555
2559
  ] }),
2556
- b ? /* @__PURE__ */ r("div", { className: "flex items-center gap-2 border-b border-border bg-muted/60 px-4 py-2 text-[12px]", children: [
2560
+ g ? /* @__PURE__ */ r("div", { className: "flex items-center gap-2 border-b border-border bg-muted/60 px-4 py-2 text-[12px]", children: [
2557
2561
  /* @__PURE__ */ e(te, { className: "h-3 w-3 shrink-0 animate-spin text-muted-foreground" }),
2558
- /* @__PURE__ */ e("span", { className: "font-medium text-foreground", children: b.name }),
2562
+ /* @__PURE__ */ e("span", { className: "font-medium text-foreground", children: g.name }),
2559
2563
  /* @__PURE__ */ e("span", { className: "text-border", children: "·" }),
2560
- /* @__PURE__ */ e("span", { className: "truncate text-muted-foreground", children: zt(b) })
2564
+ /* @__PURE__ */ e("span", { className: "truncate text-muted-foreground", children: $t(g) })
2561
2565
  ] }) : null,
2562
2566
  /* @__PURE__ */ r("div", { className: "flex-1 overflow-y-auto", children: [
2563
- s ? /* @__PURE__ */ e("div", { className: "m-4 rounded-card border border-destructive/30 bg-destructive/10 px-3 py-2 text-[12px] text-destructive", children: s }) : null,
2564
- !n && t.length === 0 && !s ? /* @__PURE__ */ e(
2567
+ n ? /* @__PURE__ */ e("div", { className: "m-4 rounded-card border border-destructive/30 bg-destructive/10 px-3 py-2 text-[12px] text-destructive", children: n }) : null,
2568
+ !i && t.length === 0 && !n ? /* @__PURE__ */ e(
2565
2569
  cn,
2566
2570
  {
2567
2571
  onNew: l,
2568
- canCreate: d,
2569
- canCreateScheduledReport: o,
2570
- analyticalBriefingsEnabled: f,
2571
- contentKind: N
2572
+ canCreate: u,
2573
+ canCreateScheduledReport: c,
2574
+ analyticalBriefingsEnabled: m,
2575
+ contentKind: D
2572
2576
  }
2573
2577
  ) : null,
2574
2578
  t.map((F) => /* @__PURE__ */ e(
2575
2579
  un,
2576
2580
  {
2577
2581
  briefing: F,
2578
- isOpening: y === F.id,
2579
- isBusy: D === F.id,
2580
- onOpen: () => m(F.id),
2582
+ isOpening: C === F.id,
2583
+ isBusy: N === F.id,
2584
+ onOpen: () => p(F.id),
2581
2585
  onRunNow: () => h(F),
2582
- onTogglePause: () => p(F),
2583
- onDelete: () => C(F)
2586
+ onTogglePause: () => f(F),
2587
+ onDelete: () => x(F)
2584
2588
  },
2585
2589
  F.id
2586
2590
  ))
@@ -2589,7 +2593,7 @@ function ln({
2589
2593
  "a",
2590
2594
  {
2591
2595
  href: I,
2592
- className: X(Ot, "h-6 px-1 text-[11px]"),
2596
+ className: q(zt, "h-6 px-1 text-[11px]"),
2593
2597
  children: [
2594
2598
  "Manage all reports & briefings",
2595
2599
  /* @__PURE__ */ e(ba, { className: "h-3 w-3" })
@@ -2603,38 +2607,38 @@ function ln({
2603
2607
  function cn({
2604
2608
  onNew: t,
2605
2609
  canCreate: a,
2606
- canCreateScheduledReport: i,
2607
- analyticalBriefingsEnabled: s,
2608
- contentKind: n
2610
+ canCreateScheduledReport: o,
2611
+ analyticalBriefingsEnabled: n,
2612
+ contentKind: i
2609
2613
  }) {
2610
- const c = n === "reports" ? {
2614
+ const s = i === "reports" ? {
2611
2615
  title: "No reports yet",
2612
2616
  description: "Schedule an emailed dashboard or visual report to see it here."
2613
- } : n === "briefings" ? {
2617
+ } : i === "briefings" ? {
2614
2618
  title: "No briefings yet",
2615
2619
  description: "Create an analytical briefing to monitor this dashboard and brief your team."
2616
2620
  } : null;
2617
2621
  return /* @__PURE__ */ r("div", { className: "flex h-full flex-col items-center justify-center px-8 py-12 text-center", children: [
2618
2622
  /* @__PURE__ */ e(dn, { className: "mb-5 h-[88px] w-[112px] text-border" }),
2619
- /* @__PURE__ */ e("div", { className: "text-[13px] font-medium text-foreground", children: (c == null ? void 0 : c.title) ?? "Have an analyst brief your team" }),
2620
- /* @__PURE__ */ e("p", { className: "mt-1.5 max-w-[320px] text-[12px] leading-5 text-muted-foreground", children: (c == null ? void 0 : c.description) ?? "Describe what to watch. An analyst digs into this dashboard and the data behind it, then briefs your team on the cadence you choose." }),
2623
+ /* @__PURE__ */ e("div", { className: "text-[13px] font-medium text-foreground", children: (s == null ? void 0 : s.title) ?? "Have an analyst brief your team" }),
2624
+ /* @__PURE__ */ e("p", { className: "mt-1.5 max-w-[320px] text-[12px] leading-5 text-muted-foreground", children: (s == null ? void 0 : s.description) ?? "Describe what to watch. An analyst digs into this dashboard and the data behind it, then briefs your team on the cadence you choose." }),
2621
2625
  a ? /* @__PURE__ */ r("div", { className: "mt-4 flex flex-wrap justify-center gap-2", children: [
2622
- i ? /* @__PURE__ */ r(
2626
+ o ? /* @__PURE__ */ r(
2623
2627
  "button",
2624
2628
  {
2625
2629
  onClick: () => t("scheduled_report"),
2626
- className: Te,
2630
+ className: Ue,
2627
2631
  children: [
2628
2632
  /* @__PURE__ */ e(fe, { className: "h-3 w-3" }),
2629
2633
  " Schedule a report"
2630
2634
  ]
2631
2635
  }
2632
2636
  ) : null,
2633
- s ? /* @__PURE__ */ e(
2637
+ n ? /* @__PURE__ */ e(
2634
2638
  "button",
2635
2639
  {
2636
2640
  onClick: () => t("analytical_briefing"),
2637
- className: Ot,
2641
+ className: zt,
2638
2642
  children: "Create analytical briefing"
2639
2643
  }
2640
2644
  ) : null
@@ -2821,19 +2825,19 @@ function dn({ className: t }) {
2821
2825
  function un({
2822
2826
  briefing: t,
2823
2827
  isOpening: a,
2824
- isBusy: i,
2825
- onOpen: s,
2826
- onRunNow: n,
2827
- onTogglePause: c,
2828
- onDelete: u
2828
+ isBusy: o,
2829
+ onOpen: n,
2830
+ onRunNow: i,
2831
+ onTogglePause: s,
2832
+ onDelete: d
2829
2833
  }) {
2830
- const m = t.status === "PAUSED", l = t.hasActiveRun, d = nn(t), o = rn(t.lastRunAt), f = t.lastRunStatus, h = se(t), p = f === "SUCCESS" ? Be.success.dot : f === "FAILED" ? Be.danger.dot : f ? Be.warning.dot : Be.neutral.dot;
2834
+ const p = t.status === "PAUSED", l = t.hasActiveRun, u = nn(t), c = rn(t.lastRunAt), m = t.lastRunStatus, h = se(t), f = m === "SUCCESS" ? Re.success.dot : m === "FAILED" ? Re.danger.dot : m ? Re.warning.dot : Re.neutral.dot;
2831
2835
  return /* @__PURE__ */ r(
2832
2836
  "div",
2833
2837
  {
2834
- className: X(
2838
+ className: q(
2835
2839
  "group relative border-b border-border/60 px-4 py-3 transition-colors hover:bg-muted/60",
2836
- m && "opacity-70"
2840
+ p && "opacity-70"
2837
2841
  ),
2838
2842
  children: [
2839
2843
  /* @__PURE__ */ r(
@@ -2841,15 +2845,15 @@ function un({
2841
2845
  {
2842
2846
  role: "button",
2843
2847
  tabIndex: 0,
2844
- onClick: s,
2845
- onKeyDown: (C) => {
2846
- (C.key === "Enter" || C.key === " ") && (C.preventDefault(), s());
2848
+ onClick: n,
2849
+ onKeyDown: (x) => {
2850
+ (x.key === "Enter" || x.key === " ") && (x.preventDefault(), n());
2847
2851
  },
2848
2852
  className: "cursor-pointer pr-8",
2849
2853
  children: [
2850
2854
  /* @__PURE__ */ r("div", { className: "flex min-w-0 items-center gap-2", children: [
2851
2855
  /* @__PURE__ */ e("span", { className: "truncate text-[13px] font-medium text-foreground", children: t.name }),
2852
- m ? /* @__PURE__ */ e("span", { className: "shrink-0 text-[11px] text-muted-foreground", children: "· Paused" }) : null
2856
+ p ? /* @__PURE__ */ e("span", { className: "shrink-0 text-[11px] text-muted-foreground", children: "· Paused" }) : null
2853
2857
  ] }),
2854
2858
  /* @__PURE__ */ r("div", { className: "mt-1 flex flex-wrap items-center gap-x-1.5 text-[11px] text-muted-foreground", children: [
2855
2859
  /* @__PURE__ */ e("span", { children: h.typeLabel }),
@@ -2862,47 +2866,47 @@ function un({
2862
2866
  /* @__PURE__ */ e("span", { className: "text-border", children: "·" }),
2863
2867
  /* @__PURE__ */ r("span", { children: [
2864
2868
  "Last run ",
2865
- o
2869
+ c
2866
2870
  ] })
2867
2871
  ] }) : null
2868
2872
  ] }),
2869
- d || l ? /* @__PURE__ */ r("div", { className: "mt-1.5 flex items-center gap-1.5 text-[12px] leading-[1.5] text-foreground/80", children: [
2873
+ u || l ? /* @__PURE__ */ r("div", { className: "mt-1.5 flex items-center gap-1.5 text-[12px] leading-[1.5] text-foreground/80", children: [
2870
2874
  l ? /* @__PURE__ */ e(te, { className: "h-3 w-3 shrink-0 animate-spin text-muted-foreground/70" }) : /* @__PURE__ */ e(
2871
2875
  "span",
2872
2876
  {
2873
- className: X(
2877
+ className: q(
2874
2878
  "inline-block h-1.5 w-1.5 shrink-0 rounded-full",
2875
- p
2879
+ f
2876
2880
  )
2877
2881
  }
2878
2882
  ),
2879
- /* @__PURE__ */ e("span", { className: "truncate", children: l ? zt(t) : d })
2883
+ /* @__PURE__ */ e("span", { className: "truncate", children: l ? $t(t) : u })
2880
2884
  ] }) : null
2881
2885
  ]
2882
2886
  }
2883
2887
  ),
2884
- /* @__PURE__ */ e("div", { className: "absolute right-3 top-3", children: i ? /* @__PURE__ */ e(te, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground/70" }) : a ? /* @__PURE__ */ e(te, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground/70" }) : /* @__PURE__ */ r(Oe, { children: [
2885
- /* @__PURE__ */ e(ze, { asChild: !0, children: /* @__PURE__ */ e(
2888
+ /* @__PURE__ */ e("div", { className: "absolute right-3 top-3", children: o ? /* @__PURE__ */ e(te, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground/70" }) : a ? /* @__PURE__ */ e(te, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground/70" }) : /* @__PURE__ */ r($e, { children: [
2889
+ /* @__PURE__ */ e(je, { asChild: !0, children: /* @__PURE__ */ e(
2886
2890
  "button",
2887
2891
  {
2888
2892
  type: "button",
2889
- onClick: (C) => C.stopPropagation(),
2893
+ onClick: (x) => x.stopPropagation(),
2890
2894
  className: "inline-flex h-6 w-6 items-center justify-center rounded-control text-muted-foreground/70 opacity-60 hover:bg-muted hover:text-foreground/80 focus-visible:opacity-100 group-hover:opacity-100",
2891
2895
  "aria-label": `${h.noun === "report" ? "Report" : "Briefing"} actions`,
2892
- children: /* @__PURE__ */ e(Nt, { className: "h-3.5 w-3.5" })
2896
+ children: /* @__PURE__ */ e(Dt, { className: "h-3.5 w-3.5" })
2893
2897
  }
2894
2898
  ) }),
2895
- /* @__PURE__ */ r(_e, { align: "end", className: "w-44", children: [
2896
- /* @__PURE__ */ r(K, { onClick: s, children: [
2897
- /* @__PURE__ */ e(Et, { className: "h-3.5 w-3.5" }),
2899
+ /* @__PURE__ */ r(We, { align: "end", className: "w-44", children: [
2900
+ /* @__PURE__ */ r(G, { onClick: n, children: [
2901
+ /* @__PURE__ */ e(Ft, { className: "h-3.5 w-3.5" }),
2898
2902
  "Edit ",
2899
2903
  h.noun
2900
2904
  ] }),
2901
2905
  /* @__PURE__ */ r(
2902
- K,
2906
+ G,
2903
2907
  {
2904
- onClick: (C) => {
2905
- C.preventDefault(), n();
2908
+ onClick: (x) => {
2909
+ x.preventDefault(), i();
2906
2910
  },
2907
2911
  children: [
2908
2912
  /* @__PURE__ */ e(Ir, { className: "h-3.5 w-3.5" }),
@@ -2911,12 +2915,12 @@ function un({
2911
2915
  }
2912
2916
  ),
2913
2917
  t.scheduleExpr ? /* @__PURE__ */ e(
2914
- K,
2918
+ G,
2915
2919
  {
2916
- onClick: (C) => {
2917
- C.preventDefault(), c();
2920
+ onClick: (x) => {
2921
+ x.preventDefault(), s();
2918
2922
  },
2919
- children: m ? /* @__PURE__ */ r(W, { children: [
2923
+ children: p ? /* @__PURE__ */ r(W, { children: [
2920
2924
  /* @__PURE__ */ e(Fr, { className: "h-3.5 w-3.5" }),
2921
2925
  "Resume"
2922
2926
  ] }) : /* @__PURE__ */ r(W, { children: [
@@ -2925,16 +2929,16 @@ function un({
2925
2929
  ] })
2926
2930
  }
2927
2931
  ) : null,
2928
- /* @__PURE__ */ e(Re, {}),
2932
+ /* @__PURE__ */ e(Me, {}),
2929
2933
  /* @__PURE__ */ r(
2930
- K,
2934
+ G,
2931
2935
  {
2932
- onClick: (C) => {
2933
- C.preventDefault(), u();
2936
+ onClick: (x) => {
2937
+ x.preventDefault(), d();
2934
2938
  },
2935
2939
  className: "text-destructive focus:bg-destructive/10 focus:text-destructive",
2936
2940
  children: [
2937
- /* @__PURE__ */ e(Ve, { className: "h-3.5 w-3.5" }),
2941
+ /* @__PURE__ */ e(Pe, { className: "h-3.5 w-3.5" }),
2938
2942
  "Delete ",
2939
2943
  h.noun
2940
2944
  ]
@@ -2953,24 +2957,24 @@ function pn(t) {
2953
2957
  function fn(t) {
2954
2958
  return t === "This dashboard" ? "Watch this dashboard" : `Watch ${t}`;
2955
2959
  }
2956
- function gn(t, a, i) {
2960
+ function gn(t, a, o) {
2957
2961
  return a !== "dashboard" ? t : t.filter(
2958
- (s) => s.source.type === "dashboard" && s.source.dashboardId === i
2962
+ (n) => n.source.type === "dashboard" && n.source.dashboardId === o
2959
2963
  );
2960
2964
  }
2961
2965
  async function bn(t) {
2962
- const i = [];
2963
- let s = 1, n = 0, c = Number.POSITIVE_INFINITY;
2964
- for (; n < c; ) {
2965
- const u = await t.apiClient.listBriefings(
2966
+ const o = [];
2967
+ let n = 1, i = 0, s = Number.POSITIVE_INFINITY;
2968
+ for (; i < s; ) {
2969
+ const d = await t.apiClient.listBriefings(
2966
2970
  t.apiServiceUrl,
2967
2971
  t.token,
2968
- { scope: "organization", page: s, pageSize: 100 }
2972
+ { scope: "organization", page: n, pageSize: 100 }
2969
2973
  );
2970
- if (i.push(...u.briefings), n += u.briefings.length, c = u.total, u.briefings.length === 0 || n >= c) break;
2971
- s += 1;
2974
+ if (o.push(...d.briefings), i += d.briefings.length, s = d.total, d.briefings.length === 0 || i >= s) break;
2975
+ n += 1;
2972
2976
  }
2973
- return i;
2977
+ return o;
2974
2978
  }
2975
2979
  const xn = {
2976
2980
  listBriefings: Or,
@@ -2983,83 +2987,83 @@ const xn = {
2983
2987
  function vn({
2984
2988
  briefingId: t,
2985
2989
  initialRun: a,
2986
- apiServiceUrl: i,
2987
- token: s,
2988
- onTerminal: n,
2989
- onTimeout: c,
2990
- onExpand: u
2990
+ apiServiceUrl: o,
2991
+ token: n,
2992
+ onTerminal: i,
2993
+ onTimeout: s,
2994
+ onExpand: d
2991
2995
  }) {
2992
- const [m, l] = E(a), { startRun: d } = Kr({
2993
- apiServiceUrl: i,
2994
- token: s,
2996
+ const [p, l] = E(a), { startRun: u } = Kr({
2997
+ apiServiceUrl: o,
2998
+ token: n,
2995
2999
  intervalMs: hn,
2996
3000
  timeoutMs: mn,
2997
3001
  fetchRun: ({
2998
- apiServiceUrl: f,
3002
+ apiServiceUrl: m,
2999
3003
  token: h,
3000
- runId: p
3001
- }) => qr(f, h, t, p),
3002
- onRun: (f) => {
3003
- l(f);
3004
+ runId: f
3005
+ }) => qr(m, h, t, f),
3006
+ onRun: (m) => {
3007
+ l(m);
3004
3008
  },
3005
- onTerminalRun: (f) => {
3006
- n(f);
3009
+ onTerminalRun: (m) => {
3010
+ i(m);
3007
3011
  },
3008
3012
  onTimeout: () => {
3009
- c();
3013
+ s();
3010
3014
  }
3011
- }), o = he(!1);
3012
- return J(() => {
3013
- o.current || (o.current = !0, Xr(a.status) ? d(a) : Zr(a.status) && n(a));
3014
- }, [a, n, d]), /* @__PURE__ */ e(Qr, { run: m, onExpand: u });
3015
+ }), c = he(!1);
3016
+ return Q(() => {
3017
+ c.current || (c.current = !0, Xr(a.status) ? u(a) : Zr(a.status) && i(a));
3018
+ }, [a, i, u]), /* @__PURE__ */ e(Qr, { run: p, onExpand: d });
3015
3019
  }
3016
- function Xn(t) {
3020
+ function Qn(t) {
3017
3021
  return /* @__PURE__ */ e(Br, { children: /* @__PURE__ */ e(yn, { ...t }) });
3018
3022
  }
3019
3023
  function yn({
3020
3024
  dashboardId: t,
3021
3025
  dashboardTitle: a,
3022
- apiServiceUrl: i,
3023
- token: s,
3024
- disabled: n,
3025
- className: c,
3026
- manageBriefingsHref: u,
3027
- open: m,
3026
+ apiServiceUrl: o,
3027
+ token: n,
3028
+ disabled: i,
3029
+ className: s,
3030
+ manageBriefingsHref: d,
3031
+ open: p,
3028
3032
  onOpenChange: l,
3029
- hideTrigger: d = !1,
3030
- workflowIntent: o,
3031
- client: f
3033
+ hideTrigger: u = !1,
3034
+ workflowIntent: c,
3035
+ client: m
3032
3036
  }) {
3033
- const { authToken: h, tokenProps: p } = $e(), C = Tr(), y = !o || C.canCreate && (o === "scheduled_report" || C.analyticalBriefingsEnabled), [D, I] = E(!1), N = m ?? D, g = (w) => {
3034
- m === void 0 && I(w), l == null || l(w);
3035
- }, [S, k] = E(
3036
- o ? "author" : "list"
3037
- ), [U, b] = E(
3038
- o ?? "analytical_briefing"
3039
- ), [x, T] = E("dashboard"), [F, H] = E(
3037
+ const { authToken: h, tokenProps: f } = He(), x = Tr(), C = !c || x.canCreate && (c === "scheduled_report" || x.analyticalBriefingsEnabled), [N, I] = E(!1), D = p ?? N, b = (w) => {
3038
+ p === void 0 && I(w), l == null || l(w);
3039
+ }, [S, A] = E(
3040
+ c ? "author" : "list"
3041
+ ), [U, g] = E(
3042
+ c ?? "analytical_briefing"
3043
+ ), [v, T] = E("dashboard"), [F, H] = E(
3040
3044
  []
3041
- ), [A, V] = E(null), j = o && !y && !A ? "list" : S, [xe, G] = E(!1), [We, ve] = E(null), [He, Q] = E(null), [z, re] = E(
3045
+ ), [k, V] = E(null), $ = c && !C && !k ? "list" : S, [xe, re] = E(!1), [oe, Ie] = E(null), [Fe, ie] = E(null), [j, Y] = E(
3042
3046
  null
3043
- ), [ie, le] = E(null), ye = he(null), Ee = he(N);
3044
- J(() => {
3045
- const w = N && !Ee.current;
3046
- Ee.current = N, !(!w || !o) && (V(null), T("dashboard"), b(o), k("author"), le(null));
3047
- }, [N, o]);
3048
- const [ce, me] = E(
3047
+ ), [le, J] = E(null), Le = he(null), ve = he(D);
3048
+ Q(() => {
3049
+ const w = D && !ve.current;
3050
+ ve.current = D, !(!w || !c) && (V(null), T("dashboard"), g(c), A("author"), J(null));
3051
+ }, [D, c]);
3052
+ const [de, me] = E(
3049
3053
  null
3050
- ), [Y, Ce] = E(null), _ = i ?? (p == null ? void 0 : p.apiServiceUrl), $ = s ?? (h == null ? void 0 : h.accessToken), ne = ee(() => ({ ...xn, ...f }), [f]), pe = pn(a), Ie = ee(() => {
3054
+ ), [Z, ye] = E(null), _ = o ?? (f == null ? void 0 : f.apiServiceUrl), z = n ?? (h == null ? void 0 : h.accessToken), ne = ee(() => ({ ...xn, ...m }), [m]), pe = pn(a), Be = ee(() => {
3051
3055
  const w = gn(
3052
3056
  F,
3053
- x,
3057
+ v,
3054
3058
  t
3055
3059
  );
3056
- if (!o)
3060
+ if (!c)
3057
3061
  return w;
3058
- const R = o === "scheduled_report" ? "report" : "briefing";
3062
+ const R = c === "scheduled_report" ? "report" : "briefing";
3059
3063
  return w.filter(
3060
- (Fe) => se(Fe).noun === R
3064
+ (Te) => se(Te).noun === R
3061
3065
  );
3062
- }, [t, F, x, o]), Ge = ee(() => x === "dashboard" ? {
3066
+ }, [t, F, v, c]), Ke = ee(() => v === "dashboard" ? {
3063
3067
  source: { type: "dashboard", dashboardId: t },
3064
3068
  label: pe,
3065
3069
  detail: fn(pe)
@@ -3067,167 +3071,167 @@ function yn({
3067
3071
  source: { type: "project" },
3068
3072
  label: "This project",
3069
3073
  detail: "Use any data in this project."
3070
- }, [t, pe, x]), we = !!(_ && $), de = ga({
3071
- canCreate: C.canCreate,
3072
- analyticalBriefingsEnabled: C.analyticalBriefingsEnabled,
3073
- scheduledReportAvailable: x === "dashboard"
3074
- }), Z = q(async () => {
3075
- if (!(!_ || !$)) {
3076
- G(!0), le(null);
3074
+ }, [t, pe, v]), Ce = !!(_ && z), we = ga({
3075
+ canCreate: x.canCreate,
3076
+ analyticalBriefingsEnabled: x.analyticalBriefingsEnabled,
3077
+ scheduledReportAvailable: v === "dashboard"
3078
+ }), X = K(async () => {
3079
+ if (!(!_ || !z)) {
3080
+ re(!0), J(null);
3077
3081
  try {
3078
3082
  H(
3079
3083
  await bn({
3080
3084
  apiClient: ne,
3081
3085
  apiServiceUrl: _,
3082
- token: $
3086
+ token: z
3083
3087
  })
3084
3088
  );
3085
3089
  } catch (w) {
3086
- le(
3090
+ J(
3087
3091
  w instanceof Error ? w.message : "Could not load briefings."
3088
3092
  );
3089
3093
  } finally {
3090
- G(!1);
3094
+ re(!1);
3091
3095
  }
3092
3096
  }
3093
- }, [ne, _, $]);
3094
- J(() => {
3095
- !N || j !== "list" || !we || Z();
3096
- }, [we, j, Z, N]);
3097
- const v = () => {
3098
- V(null), T("dashboard"), k("list"), g(!0);
3099
- }, L = (w) => {
3100
- V(null), b(w), k("author");
3101
- }, M = async (w) => {
3102
- if (!(!_ || !$)) {
3103
- ve(w), le(null);
3097
+ }, [ne, _, z]);
3098
+ Q(() => {
3099
+ !D || $ !== "list" || !Ce || X();
3100
+ }, [Ce, $, X, D]);
3101
+ const Ne = () => {
3102
+ V(null), T("dashboard"), A("list"), b(!0);
3103
+ }, y = (w) => {
3104
+ V(null), g(w), A("author");
3105
+ }, L = async (w) => {
3106
+ if (!(!_ || !z)) {
3107
+ Ie(w), J(null);
3104
3108
  try {
3105
3109
  const R = await ne.getBriefing(
3106
3110
  _,
3107
- $,
3111
+ z,
3108
3112
  w
3109
3113
  );
3110
- V(R.briefing), k("author");
3114
+ V(R.briefing), A("author");
3111
3115
  } catch (R) {
3112
- le(
3116
+ J(
3113
3117
  R instanceof Error ? R.message : "Could not open briefing."
3114
3118
  );
3115
3119
  } finally {
3116
- ve(null);
3120
+ Ie(null);
3117
3121
  }
3118
3122
  }
3119
- }, ae = async (w) => {
3120
- if (!(!_ || !$)) {
3121
- Q(w.id);
3123
+ }, M = async (w) => {
3124
+ if (!(!_ || !z)) {
3125
+ ie(w.id);
3122
3126
  try {
3123
3127
  await ne.runBriefingNow(
3124
3128
  _,
3125
- $,
3129
+ z,
3126
3130
  w.id,
3127
3131
  { requestId: Cn() }
3128
- ), Z();
3132
+ ), X();
3129
3133
  } catch (R) {
3130
3134
  O.error(
3131
3135
  R instanceof Error ? R.message : "Could not start the run."
3132
3136
  );
3133
3137
  } finally {
3134
- Q(null);
3138
+ ie(null);
3135
3139
  }
3136
3140
  }
3137
- }, oe = async (w) => {
3138
- if (!_ || !$) return;
3139
- const { noun: R } = se(w), Fe = R === "report" ? "Report" : "Briefing";
3140
- Q(w.id);
3141
+ }, ae = async (w) => {
3142
+ if (!_ || !z) return;
3143
+ const { noun: R } = se(w), Te = R === "report" ? "Report" : "Briefing";
3144
+ ie(w.id);
3141
3145
  try {
3142
- const Le = w.status === "PAUSED" ? await ne.resumeBriefing(
3146
+ const Ve = w.status === "PAUSED" ? await ne.resumeBriefing(
3143
3147
  _,
3144
- $,
3148
+ z,
3145
3149
  w.id
3146
3150
  ) : await ne.pauseBriefing(
3147
3151
  _,
3148
- $,
3152
+ z,
3149
3153
  w.id
3150
3154
  );
3151
3155
  O.success(
3152
- Le.briefing.status === "PAUSED" ? `${Fe} paused` : `${Fe} resumed`
3153
- ), Z();
3154
- } catch (Le) {
3156
+ Ve.briefing.status === "PAUSED" ? `${Te} paused` : `${Te} resumed`
3157
+ ), X();
3158
+ } catch (Ve) {
3155
3159
  O.error(
3156
- Le instanceof Error ? Le.message : `Could not update the ${R} status.`
3160
+ Ve instanceof Error ? Ve.message : `Could not update the ${R} status.`
3157
3161
  );
3158
3162
  } finally {
3159
- Q(null);
3163
+ ie(null);
3160
3164
  }
3161
- }, _t = async () => {
3162
- if (!z || !_ || !$) return;
3163
- const w = z;
3164
- Q(w.id);
3165
+ }, ce = async () => {
3166
+ if (!j || !_ || !z) return;
3167
+ const w = j;
3168
+ ie(w.id);
3165
3169
  try {
3166
3170
  await ne.deleteBriefing(
3167
3171
  _,
3168
- $,
3172
+ z,
3169
3173
  w.id
3170
3174
  );
3171
3175
  const { noun: R } = se(w);
3172
- O.success(`${R === "report" ? "Report" : "Briefing"} deleted`), re(null), Z();
3176
+ O.success(`${R === "report" ? "Report" : "Briefing"} deleted`), Y(null), X();
3173
3177
  } catch (R) {
3174
3178
  O.error(
3175
3179
  R instanceof Error ? R.message : "Could not delete the briefing."
3176
3180
  );
3177
3181
  } finally {
3178
- Q(null);
3182
+ ie(null);
3179
3183
  }
3180
- }, $t = Ie.length;
3181
- return C.surfaceVisible ? /* @__PURE__ */ r(zr, { open: N, onOpenChange: g, children: [
3182
- d ? null : /* @__PURE__ */ e(
3184
+ }, jt = Be.length;
3185
+ return x.surfaceVisible ? /* @__PURE__ */ r(_r, { open: D, onOpenChange: b, children: [
3186
+ u ? null : /* @__PURE__ */ e(
3183
3187
  Ja,
3184
3188
  {
3185
- disabled: n || !we,
3186
- briefingCount: $t,
3187
- className: c,
3188
- onClick: v
3189
+ disabled: i || !Ce,
3190
+ briefingCount: jt,
3191
+ className: s,
3192
+ onClick: Ne
3189
3193
  }
3190
3194
  ),
3191
3195
  /* @__PURE__ */ r(
3192
- _r,
3196
+ zr,
3193
3197
  {
3194
- ref: ye,
3198
+ ref: Le,
3195
3199
  side: "right",
3196
3200
  hideClose: !0,
3197
3201
  className: "flex h-full w-full flex-col overflow-hidden p-0 outline-none sm:max-w-[560px]",
3198
3202
  onOpenAutoFocus: (w) => {
3199
3203
  var R;
3200
- w.preventDefault(), (R = ye.current) == null || R.focus({ preventScroll: !0 });
3204
+ w.preventDefault(), (R = Le.current) == null || R.focus({ preventScroll: !0 });
3201
3205
  },
3202
3206
  children: [
3203
3207
  /* @__PURE__ */ r($r, { className: "sr-only", children: [
3204
3208
  /* @__PURE__ */ e(jr, { children: "Reports & briefings" }),
3205
3209
  /* @__PURE__ */ e(Wr, { children: "Manage reports and briefings for this dashboard." })
3206
3210
  ] }),
3207
- o ? /* @__PURE__ */ r("div", { className: "flex shrink-0 items-start justify-between gap-3 border-b border-border pl-4 pr-3 pt-2", children: [
3211
+ c ? /* @__PURE__ */ r("div", { className: "flex shrink-0 items-start justify-between gap-3 border-b border-border pl-4 pr-3 pt-2", children: [
3208
3212
  /* @__PURE__ */ r(
3209
3213
  "div",
3210
3214
  {
3211
3215
  className: "flex items-center gap-5",
3212
3216
  role: "tablist",
3213
- "aria-label": o === "scheduled_report" ? "Email report workflow" : "Analytical briefing workflow",
3217
+ "aria-label": c === "scheduled_report" ? "Email report workflow" : "Analytical briefing workflow",
3214
3218
  children: [
3215
3219
  /* @__PURE__ */ e(
3216
3220
  "button",
3217
3221
  {
3218
3222
  type: "button",
3219
3223
  role: "tab",
3220
- "aria-selected": j === "author",
3221
- disabled: !y,
3222
- className: X(
3224
+ "aria-selected": $ === "author",
3225
+ disabled: !C,
3226
+ className: q(
3223
3227
  "-mb-px border-b-2 px-0.5 pb-2 text-[12px] transition-colors",
3224
- j === "author" ? "border-foreground font-medium text-foreground" : "border-transparent text-muted-foreground hover:text-foreground",
3225
- !y && "cursor-not-allowed opacity-50"
3228
+ $ === "author" ? "border-foreground font-medium text-foreground" : "border-transparent text-muted-foreground hover:text-foreground",
3229
+ !C && "cursor-not-allowed opacity-50"
3226
3230
  ),
3227
3231
  onClick: () => {
3228
- y && (V(null), b(o), T("dashboard"), k("author"));
3232
+ C && (V(null), g(c), T("dashboard"), A("author"));
3229
3233
  },
3230
- children: A ? `Edit ${se(A).noun}` : o === "scheduled_report" ? "Schedule report" : "Create briefing"
3234
+ children: k ? `Edit ${se(k).noun}` : c === "scheduled_report" ? "Schedule report" : "Create briefing"
3231
3235
  }
3232
3236
  ),
3233
3237
  /* @__PURE__ */ e(
@@ -3235,13 +3239,13 @@ function yn({
3235
3239
  {
3236
3240
  type: "button",
3237
3241
  role: "tab",
3238
- "aria-selected": j === "list",
3239
- className: X(
3242
+ "aria-selected": $ === "list",
3243
+ className: q(
3240
3244
  "-mb-px border-b-2 px-0.5 pb-2 text-[12px] transition-colors",
3241
- j === "list" ? "border-foreground font-medium text-foreground" : "border-transparent text-muted-foreground hover:text-foreground"
3245
+ $ === "list" ? "border-foreground font-medium text-foreground" : "border-transparent text-muted-foreground hover:text-foreground"
3242
3246
  ),
3243
- onClick: () => k("list"),
3244
- children: o === "scheduled_report" ? "Manage reports" : "Manage briefings"
3247
+ onClick: () => A("list"),
3248
+ children: c === "scheduled_report" ? "Manage reports" : "Manage briefings"
3245
3249
  }
3246
3250
  )
3247
3251
  ]
@@ -3251,147 +3255,147 @@ function yn({
3251
3255
  "button",
3252
3256
  {
3253
3257
  type: "button",
3254
- onClick: () => g(!1),
3258
+ onClick: () => b(!1),
3255
3259
  className: "rounded-control p-1 text-muted-foreground hover:bg-muted hover:text-foreground",
3256
- "aria-label": o === "scheduled_report" ? "Close email report workflow" : "Close analytical briefing workflow",
3257
- children: /* @__PURE__ */ e(je, { className: "h-3.5 w-3.5" })
3260
+ "aria-label": c === "scheduled_report" ? "Close email report workflow" : "Close analytical briefing workflow",
3261
+ children: /* @__PURE__ */ e(Ge, { className: "h-3.5 w-3.5" })
3258
3262
  }
3259
3263
  )
3260
3264
  ] }) : null,
3261
- j === "list" ? /* @__PURE__ */ e(
3265
+ $ === "list" ? /* @__PURE__ */ e(
3262
3266
  ln,
3263
3267
  {
3264
- briefings: Ie,
3268
+ briefings: Be,
3265
3269
  dashboardLabel: pe,
3266
- sourceView: x,
3267
- error: ie,
3270
+ sourceView: v,
3271
+ error: le,
3268
3272
  loading: xe,
3269
3273
  onSourceViewChange: T,
3270
- onClose: () => g(!1),
3274
+ onClose: () => b(!1),
3271
3275
  onEdit: (w) => {
3272
- M(w);
3276
+ L(w);
3273
3277
  },
3274
- onNew: L,
3275
- canCreate: !o && de.length > 0,
3276
- canCreateScheduledReport: de.includes(
3278
+ onNew: y,
3279
+ canCreate: !c && we.length > 0,
3280
+ canCreateScheduledReport: we.includes(
3277
3281
  "scheduled_report"
3278
3282
  ),
3279
- analyticalBriefingsEnabled: de.includes(
3283
+ analyticalBriefingsEnabled: we.includes(
3280
3284
  "analytical_briefing"
3281
3285
  ),
3282
3286
  onRunNow: (w) => {
3283
- ae(w);
3287
+ M(w);
3284
3288
  },
3285
3289
  onTogglePause: (w) => {
3286
- oe(w);
3290
+ ae(w);
3287
3291
  },
3288
- onDelete: (w) => re(w),
3289
- selectingId: We,
3290
- busyId: He,
3291
- manageBriefingsHref: u,
3292
- contentKind: o === "scheduled_report" ? "reports" : o === "analytical_briefing" ? "briefings" : void 0,
3293
- hideHeader: !!o
3292
+ onDelete: (w) => Y(w),
3293
+ selectingId: oe,
3294
+ busyId: Fe,
3295
+ manageBriefingsHref: d,
3296
+ contentKind: c === "scheduled_report" ? "reports" : c === "analytical_briefing" ? "briefings" : void 0,
3297
+ hideHeader: !!c
3294
3298
  }
3295
3299
  ) : /* @__PURE__ */ e(
3296
3300
  Hr,
3297
3301
  {
3298
3302
  apiServiceUrl: _,
3299
- token: $,
3300
- briefing: A,
3303
+ token: z,
3304
+ briefing: k,
3301
3305
  intent: U,
3302
- sourceContext: A ? void 0 : Ge,
3303
- title: A ? `Edit ${se(A).noun}` : U === "scheduled_report" ? "Schedule report" : "Create analytical briefing",
3304
- hideHeader: !!o,
3306
+ sourceContext: k ? void 0 : Ke,
3307
+ title: k ? `Edit ${se(k).noun}` : U === "scheduled_report" ? "Schedule report" : "Create analytical briefing",
3308
+ hideHeader: !!c,
3305
3309
  className: "h-full min-h-0 max-w-none border-0 shadow-none",
3306
- onBack: o ? void 0 : () => k("list"),
3307
- onCancel: () => g(!1),
3310
+ onBack: c ? void 0 : () => A("list"),
3311
+ onCancel: () => b(!1),
3308
3312
  onDeleted: () => {
3309
- const w = A ? se(A).noun : "briefing";
3310
- O.success(`${w === "report" ? "Report" : "Briefing"} deleted`), V(null), k("list"), Z();
3313
+ const w = k ? se(k).noun : "briefing";
3314
+ O.success(`${w === "report" ? "Report" : "Briefing"} deleted`), V(null), A("list"), X();
3311
3315
  },
3312
3316
  onRunStarted: () => {
3313
3317
  },
3314
3318
  onSaved: (w) => {
3315
- V(w), Z();
3319
+ V(w), X();
3316
3320
  },
3317
3321
  onMinimizeRun: ({ briefing: w, run: R }) => {
3318
- me({ briefing: w, run: R }), g(!1);
3322
+ me({ briefing: w, run: R }), b(!1);
3319
3323
  }
3320
3324
  }
3321
3325
  )
3322
3326
  ]
3323
3327
  }
3324
3328
  ),
3325
- ce && _ && $ ? /* @__PURE__ */ e(
3329
+ de && _ && z ? /* @__PURE__ */ e(
3326
3330
  vn,
3327
3331
  {
3328
- briefingId: ce.briefing.id,
3329
- initialRun: ce.run,
3332
+ briefingId: de.briefing.id,
3333
+ initialRun: de.run,
3330
3334
  apiServiceUrl: _,
3331
- token: $,
3335
+ token: z,
3332
3336
  onTerminal: (w) => {
3333
- Ce({
3334
- briefing: ce.briefing,
3337
+ ye({
3338
+ briefing: de.briefing,
3335
3339
  run: w
3336
- }), me(null), Z();
3340
+ }), me(null), X();
3337
3341
  },
3338
3342
  onTimeout: () => {
3339
- me(null), Z();
3343
+ me(null), X();
3340
3344
  },
3341
3345
  onExpand: () => {
3342
- V(ce.briefing), k("author"), me(null), g(!0);
3346
+ V(de.briefing), A("author"), me(null), b(!0);
3343
3347
  }
3344
3348
  }
3345
3349
  ) : null,
3346
- Y ? /* @__PURE__ */ e("div", { className: "fixed bottom-4 right-4 z-50 w-[360px]", children: /* @__PURE__ */ e(
3350
+ Z ? /* @__PURE__ */ e("div", { className: "fixed bottom-4 right-4 z-50 w-[360px]", children: /* @__PURE__ */ e(
3347
3351
  Gr,
3348
3352
  {
3349
- title: Y.run.status === "SUCCESS" ? `${Y.briefing.name} is ready` : `${Y.briefing.name} run failed`,
3350
- durationSeconds: Y.run.startedAt && Y.run.completedAt ? Math.max(
3353
+ title: Z.run.status === "SUCCESS" ? `${Z.briefing.name} is ready` : `${Z.briefing.name} run failed`,
3354
+ durationSeconds: Z.run.startedAt && Z.run.completedAt ? Math.max(
3351
3355
  0,
3352
3356
  Math.floor(
3353
- (new Date(Y.run.completedAt).getTime() - new Date(Y.run.startedAt).getTime()) / 1e3
3357
+ (new Date(Z.run.completedAt).getTime() - new Date(Z.run.startedAt).getTime()) / 1e3
3354
3358
  )
3355
3359
  ) : null,
3356
- status: Y.run.status === "SUCCESS" ? "success" : "failed",
3360
+ status: Z.run.status === "SUCCESS" ? "success" : "failed",
3357
3361
  onView: () => {
3358
- V(Y.briefing), k("author"), Ce(null), g(!0);
3362
+ V(Z.briefing), A("author"), ye(null), b(!0);
3359
3363
  },
3360
- onDismiss: () => Ce(null)
3364
+ onDismiss: () => ye(null)
3361
3365
  }
3362
3366
  ) }) : null,
3363
3367
  /* @__PURE__ */ e(
3364
- Je,
3368
+ tt,
3365
3369
  {
3366
- open: !!z,
3370
+ open: !!j,
3367
3371
  onOpenChange: (w) => {
3368
- w || re(null);
3372
+ w || Y(null);
3369
3373
  },
3370
- children: /* @__PURE__ */ r(et, { children: [
3371
- /* @__PURE__ */ r(tt, { children: [
3372
- /* @__PURE__ */ r(rt, { children: [
3374
+ children: /* @__PURE__ */ r(rt, { children: [
3375
+ /* @__PURE__ */ r(at, { children: [
3376
+ /* @__PURE__ */ r(nt, { children: [
3373
3377
  "Delete",
3374
3378
  " ",
3375
- z ? se(z).noun : "briefing",
3379
+ j ? se(j).noun : "briefing",
3376
3380
  "?"
3377
3381
  ] }),
3378
- /* @__PURE__ */ r(at, { children: [
3382
+ /* @__PURE__ */ r(st, { children: [
3379
3383
  "This permanently deletes ",
3380
- /* @__PURE__ */ e("strong", { children: z == null ? void 0 : z.name }),
3384
+ /* @__PURE__ */ e("strong", { children: j == null ? void 0 : j.name }),
3381
3385
  ". Recipients will stop receiving it."
3382
3386
  ] })
3383
3387
  ] }),
3384
- /* @__PURE__ */ r(nt, { children: [
3385
- /* @__PURE__ */ e(st, { children: "Cancel" }),
3388
+ /* @__PURE__ */ r(ot, { children: [
3389
+ /* @__PURE__ */ e(it, { children: "Cancel" }),
3386
3390
  /* @__PURE__ */ r(
3387
- wt,
3391
+ St,
3388
3392
  {
3389
3393
  className: "bg-destructive/90 hover:bg-destructive",
3390
- onClick: _t,
3394
+ onClick: ce,
3391
3395
  children: [
3392
3396
  "Delete",
3393
3397
  " ",
3394
- z ? se(z).noun : "briefing"
3398
+ j ? se(j).noun : "briefing"
3395
3399
  ]
3396
3400
  }
3397
3401
  )
@@ -3405,19 +3409,19 @@ function Cn() {
3405
3409
  return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `briefing-run-now-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
3406
3410
  }
3407
3411
  export {
3408
- jn as A,
3409
- _a as D,
3412
+ Hn as A,
3413
+ za as D,
3410
3414
  Oa as E,
3411
- Kn as N,
3412
- Wn as U,
3413
- _n as V,
3415
+ Xn as N,
3416
+ Gn as U,
3417
+ jn as V,
3414
3418
  Ja as W,
3415
- $n as a,
3419
+ Wn as a,
3416
3420
  Ma as b,
3417
- Gn as c,
3421
+ qn as c,
3418
3422
  ja as d,
3419
3423
  qa as e,
3420
- qn as f,
3421
- Xn as g,
3422
- Hn as u
3424
+ Zn as f,
3425
+ Qn as g,
3426
+ Kn as u
3423
3427
  };