react-semaphor 0.1.601 → 0.1.602

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 (75) hide show
  1. package/dist/analytics-protocol/index.js +9 -9
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/brand-studio/index.js +7 -7
  4. package/dist/briefings/index.js +4 -4
  5. package/dist/chunks/{assistant-chat-BE0XXzZP.js → assistant-chat-BWF3GYip.js} +12 -12
  6. package/dist/chunks/{bookmark-impact-DXDAN5AY.js → bookmark-impact-BF3iRx5a.js} +3 -3
  7. package/dist/chunks/{bookmark-state-BMyB3Tb6.js → bookmark-state-CBSTdW6q.js} +4 -4
  8. package/dist/chunks/{card-filter-builder-CE0-YVN5.js → card-filter-builder-B8XHwMY6.js} +394 -394
  9. package/dist/chunks/{comparison-window-caption-Dxj2CHOa.js → comparison-window-caption-W83qB4V5.js} +4 -4
  10. package/dist/chunks/{dashboard-mJKPFRbb.js → dashboard-DG5EIYYB.js} +1 -1
  11. package/dist/chunks/{dashboard-briefing-launcher-CntwKyiZ.js → dashboard-briefing-launcher-CBSrhyWZ.js} +727 -718
  12. package/dist/chunks/{dashboard-controls-XO089DMg.js → dashboard-controls-D6ECO4N1.js} +15 -15
  13. package/dist/chunks/{dashboard-json-CQRiydUv.js → dashboard-json-DrJftBSL.js} +4 -4
  14. package/dist/chunks/{dates-B-Urp5OD.js → dates-Bz-qM5px.js} +10 -10
  15. package/dist/chunks/{edit-dashboard-visual-f-Dm-BLR.js → edit-dashboard-visual-BDYAJIbb.js} +1565 -1544
  16. package/dist/chunks/{filter-line-CKNMyNTQ.js → filter-line-BXT6y303.js} +6 -6
  17. package/dist/chunks/{filter-reach-copy-B8GGyVuR.js → filter-reach-copy-BukhZmzm.js} +1661 -1950
  18. package/dist/chunks/{filter-value-text-CRtKecI5.js → filter-value-text-D3-bf3_b.js} +4 -4
  19. package/dist/chunks/{index-DoPApnxg.js → index-BW0yozjs.js} +5 -5
  20. package/dist/chunks/{layout-grid-CiSCZdIr.js → layout-grid-Ds0diMeY.js} +1 -1
  21. package/dist/chunks/{matrix-analytical-definition-myf3D3Qx.js → matrix-analytical-definition-CgQgVeeI.js} +4 -4
  22. package/dist/chunks/{matrix-member-presentation-g0c_NpDW.js → matrix-member-presentation-DSBIIudt.js} +1 -1
  23. package/dist/chunks/{matrix-operation-contract-C1SuOHLZ.js → matrix-operation-contract--DkNCOzd.js} +517 -514
  24. package/dist/chunks/{metric-comparison-Cm0G893W.js → metric-comparison-zMylnIkc.js} +1 -1
  25. package/dist/chunks/{paintbrush-DQIwqlck.js → paintbrush-CX8pao1j.js} +1 -1
  26. package/dist/chunks/{palette-Cun747Rg.js → palette-CuA0HlzF.js} +1 -1
  27. package/dist/chunks/{pivot-result-contract-expectations-C1Dyx8du.js → pivot-result-contract-expectations-C8KL7hPx.js} +8 -8
  28. package/dist/chunks/{pivot-result-identity-CBS-ssEp.js → pivot-result-identity-C1AOH1PS.js} +1 -1
  29. package/dist/chunks/{raw-temporal-value-DN_l-Tss.js → raw-temporal-value-E416F-0L.js} +1 -1
  30. package/dist/chunks/{report-preferences-dialog-SDZEcG2x.js → report-preferences-dialog-CbuVNDGi.js} +13 -13
  31. package/dist/chunks/{report-runtime-context-BbedQdtc.js → report-runtime-context-E7USjN7E.js} +1 -1
  32. package/dist/chunks/{resolve-dashboard-input-context-DRBS0eRa.js → resolve-dashboard-input-context-CULCE_hM.js} +8417 -7052
  33. package/dist/chunks/{save-Dj5bjm7P.js → save-BKHlDONy.js} +1 -1
  34. package/dist/chunks/{saved-dashboard-context-DWVlJcsa.js → saved-dashboard-context-C1WlOx5z.js} +32 -32
  35. package/dist/chunks/{selection-filter-compiler-DmAr7yqC.js → selection-filter-compiler-ifT8JCXS.js} +1 -1
  36. package/dist/chunks/{semaphor-ready-indicator-OFOoAY-A.js → semaphor-ready-indicator-CBIRcDWs.js} +33414 -31523
  37. package/dist/chunks/{shelf-drop-preview-context-2swWypXu.js → shelf-drop-preview-context-xR69SMA8.js} +53 -53
  38. package/dist/chunks/{stored-dashboard-NtOuEX6a.js → stored-dashboard-BuM8vnWf.js} +739 -717
  39. package/dist/chunks/{style-sheet-parts-Qv4UcLAo.js → style-sheet-parts-Bt9ZNre8.js} +2 -2
  40. package/dist/chunks/{table-export-sheet-Do7ZB0_F.js → table-export-sheet-DVljtHkG.js} +1 -1
  41. package/dist/chunks/{token-types-Dy_aXO-U.js → token-types-D_xKgyVS.js} +1 -1
  42. package/dist/chunks/{upload-Bq-puSVy.js → upload-Dll_M7XQ.js} +1 -1
  43. package/dist/chunks/{validators-C7DFk3QK.js → validators-ClWHpYql.js} +2 -2
  44. package/dist/chunks/{variable-draft-Cy03qnEi.js → variable-draft-CDGGl53R.js} +27 -28
  45. package/dist/dashboard/index.js +2 -2
  46. package/dist/dashboard-authoring/index.js +3086 -2578
  47. package/dist/format-utils/index.js +14 -14
  48. package/dist/index.js +71 -73
  49. package/dist/report-runtime-context/index.js +1 -1
  50. package/dist/style.css +1 -1
  51. package/dist/surfboard/index.js +2 -2
  52. package/dist/types/components/dashboard/dashboard-web-component.d.ts +7 -0
  53. package/dist/types/index.js +5 -5
  54. package/dist/types/lib/dashboard-inputs/dashboard-input-target-context.d.ts +1 -1
  55. package/dist/types/lib/query-context/assemble-card-query.d.ts +6 -1
  56. package/dist/types/lib/stores/dashboard-store.d.ts +30 -0
  57. package/dist/types/shared/analytics-protocol/aggregate-expression.d.ts +15 -0
  58. package/dist/types/shared/dashboard-authoring/calculations/calculated-column.d.ts +52 -0
  59. package/dist/types/shared/dashboard-authoring/calculations/definition.d.ts +129 -0
  60. package/dist/types/shared/dashboard-authoring/calculations/resolve-dashboard-field-copies.d.ts +46 -0
  61. package/dist/types/shared/dashboard-authoring/calculations/tokens.d.ts +36 -0
  62. package/dist/types/shared/dashboard-authoring/changes/calculation-change.d.ts +399 -0
  63. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +144 -2
  64. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +21 -2
  65. package/dist/types/shared/dashboard-authoring/changes/domain-change.d.ts +143 -266
  66. package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +2 -0
  67. package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +46 -0
  68. package/dist/types/shared/dashboard-authoring/index.d.ts +7 -1
  69. package/dist/types/shared/dashboard-authoring/operations/calculated-field-operations.d.ts +133 -0
  70. package/dist/types/shared/dashboard-authoring/operations/card-operations.d.ts +71 -0
  71. package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +18 -5
  72. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +21 -0
  73. package/dist/types/shared/usage-events/details.d.ts +2 -2
  74. package/dist/types/shared/usage-events/envelope.d.ts +2 -2
  75. package/package.json +1 -1
@@ -1,27 +1,27 @@
1
- import { jsx as t, jsxs as s, Fragment as U } from "react/jsx-runtime";
2
- import la, { useState as E, useEffect as Ee, useCallback as ie, useMemo as Y, useLayoutEffect as Ut, useRef as et, useContext as Va } from "react";
3
- import { dO as it, bG as Le, bH as Ve, bJ as Pe, dP as Pa, b8 as $e, b5 as ot, dQ as Ba, dR as lt, dS as Ct, an as dt, ak as ve, u as N, dT as _a, dU as Oa, bF as z, dV as za, am as oe, b3 as Ra, cU as Ma, dW as Ua, dX as $a, bU as da, bS as be, dc as ca, bZ as tt, w as ja, q as qa, dY as Wa, df as wt, dg as St, dh as kt, di as Dt, dj as At, dk as Ft, dl as Et, dm as ua, bP as It, dZ as Qa, du as Ha, d4 as pt, d1 as je, d2 as qe, dH as ha, d3 as We, cR as re, dd as Ka, d8 as at, d_ as Ga, cP as Ya, d$ as ma, bu as ct, bI as Tt, bK as ut, e0 as pa, bE as Xa, e1 as Ja, bv as Za, o as en, bX as tn, e2 as an, W as nn, P as fa, bp as rn, X as sn, G as on, e3 as ln, e4 as dn, e5 as cn, e6 as ga, e7 as un, e8 as hn, e9 as Ce, ea as mn, R as ba, eb as pn, ec as fn, b0 as gn, ed as bn, ee as ge, ef as xn, aa as Lt, eg as vn, eh as ft, ei as yn, ej as $t, ek as Nn, el as Cn, em as wn, en as xa, c7 as Sn, eo as kn, ep as Dn, eq as An, dB as Vt, bQ as va, er as Fn, es as jt, et as En, eu as In, ev as Tn, ew as Ln, b7 as Vn, bz as Pn, cT as ya, ex as Bn, ey as _n, ez as Xe, eA as On, eB as zn, eC as Rn, A as Mn, aR as Un, aS as $n, ax as jn, aw as qn, av as Wn, au as Qn, ar as Hn, ap as Kn, eD as Gn, eE as Yn, eF as Xn, eG as Jn, eH as Zn, aP as er } from "./semaphor-ready-indicator-OFOoAY-A.js";
4
- import { c as Ae, B as L, X as Qe, s as Me, x as xe, L as de, q as Pt, j as Bt, p as tr, F as _t, e as Ie, a8 as Na, h as Te, f as nt, i as Ca, g as Nt, y as we, z as Se, A as ke, D as De, E as fe, a9 as ar } from "./style-sheet-parts-Qv4UcLAo.js";
5
- import { L as Ue } from "./layout-grid-CiSCZdIr.js";
1
+ import { jsx as t, jsxs as s, Fragment as $ } from "react/jsx-runtime";
2
+ import la, { useState as E, useEffect as Ee, useCallback as ie, useMemo as Y, useLayoutEffect as $t, useRef as et, useContext as Va } from "react";
3
+ import { dO as it, bG as Le, bH as Ve, bJ as Pe, dP as Pa, b8 as $e, b5 as ot, dQ as Ba, dR as lt, dS as wt, an as dt, ak as ve, u as C, dT as _a, dU as Oa, bF as z, dV as za, am as oe, b3 as Ra, cU as Ma, dW as Ua, dX as $a, bU as da, bS as be, dc as ca, bZ as tt, w as ja, q as qa, dY as Wa, df as St, dg as kt, dh as Dt, di as At, dj as Ft, dk as Et, dl as It, dm as ua, bP as Tt, dZ as Qa, du as Ha, d4 as pt, d1 as je, d2 as qe, dH as ha, d3 as We, cR as re, dd as Ka, d8 as at, d_ as Ga, cP as Ya, d$ as ma, bu as ct, bI as Lt, bK as ut, e0 as pa, bE as Xa, e1 as Ja, bv as Za, o as en, bX as tn, e2 as an, W as nn, P as fa, bp as rn, X as sn, G as on, e3 as ln, e4 as dn, e5 as cn, e6 as ga, e7 as un, e8 as hn, e9 as Ne, ea as mn, R as ba, eb as pn, ec as fn, b0 as gn, ed as bn, ee as ge, ef as xn, aa as Vt, eg as vn, eh as ft, ei as yn, ej as jt, ek as Cn, el as Nn, em as wn, en as xa, c7 as Sn, eo as kn, ep as Dn, eq as An, dB as Pt, bQ as va, er as Fn, es as qt, et as En, eu as In, ev as Tn, ew as Ln, b7 as Vn, bz as Pn, cT as ya, ex as Bn, ey as _n, ez as Xe, eA as On, eB as zn, eC as Rn, A as Mn, aR as Un, aS as $n, ax as jn, aw as qn, av as Wn, au as Qn, ar as Hn, ap as Kn, eD as Gn, eE as Yn, eF as Xn, eG as Jn, eH as Zn, aP as er } from "./semaphor-ready-indicator-CBIRcDWs.js";
4
+ import { c as Ae, B as L, X as Qe, s as Me, x as xe, L as de, q as Bt, j as _t, p as tr, F as Ot, e as Ie, a8 as Ca, h as Te, f as nt, i as Na, g as Nt, y as we, z as Se, A as ke, D as De, E as fe, a9 as ar } from "./style-sheet-parts-Bt9ZNre8.js";
5
+ import { L as Ue } from "./layout-grid-Ds0diMeY.js";
6
6
  import { c as J } from "./pickers-DkqmtnTL.js";
7
- import { T as nr } from "./validators-C7DFk3QK.js";
8
- import "./matrix-operation-contract-C1SuOHLZ.js";
7
+ import { T as nr } from "./validators-ClWHpYql.js";
8
+ import "./matrix-operation-contract--DkNCOzd.js";
9
9
  import "./analytics-base-schemas-DevrgqQb.js";
10
10
  import "../value-format-preferences/index.js";
11
11
  import { s as Je } from "./normalize-dashboard-for-dirty-check-XKgH3GFX.js";
12
- import { bY as qt, bu as Wt, fy as Qt, h8 as rr, h9 as rt, h7 as Ht, ha as sr, v as He, hb as ir, w as or, hc as lr, hd as dr, he as cr, d1 as ur, hf as hr, q as mr, gt as pr, hg as fr, hh as gr, a as Ot, aX as br, a5 as xr, cG as vr, hi as yr, hj as Nr, cS as Cr, hk as wr, hl as Kt, hm as Sr } from "./resolve-dashboard-input-context-DRBS0eRa.js";
13
- import { S as wa } from "./save-Dj5bjm7P.js";
14
- import { V as kr, L as Dr, u as Sa, C as ka, F as Ar, a as Fr, A as Er, b as Ir } from "./card-filter-builder-CE0-YVN5.js";
12
+ import { c9 as Wt, bI as Qt, fT as Ht, i2 as rr, i3 as rt, i1 as gt, i4 as sr, z as He, i5 as ir, A as or, i6 as lr, i7 as dr, i8 as cr, de as ur, i9 as hr, w as mr, hn as pr, ia as fr, ib as gr, e as zt, b6 as br, a9 as xr, cT as vr, ic as yr, id as Cr, d3 as Nr, ie as wr, ig as Kt, ih as Sr } from "./resolve-dashboard-input-context-CULCE_hM.js";
13
+ import { S as wa } from "./save-BKHlDONy.js";
14
+ import { V as kr, L as Dr, u as Sa, C as ka, F as Ar, a as Fr, A as Er, b as Ir } from "./card-filter-builder-B8XHwMY6.js";
15
15
  import { createPortal as Tr } from "react-dom";
16
- import { b4 as Gt, aC as Lr } from "./pivot-result-contract-expectations-C1Dyx8du.js";
17
- import { aD as Vr, ar as Pr, F as Br, ac as st, T as _r } from "./bookmark-state-BMyB3Tb6.js";
16
+ import { b4 as Gt, aC as Lr } from "./pivot-result-contract-expectations-C8KL7hPx.js";
17
+ import { aD as Vr, ar as Pr, F as Br, ac as st, T as _r } from "./bookmark-state-CBSTdW6q.js";
18
18
  import "zod";
19
19
  import "./schema-C9NPiIru.js";
20
20
  import "./index-CV_Kzou0.js";
21
21
  import "./context-BJoEFgNl.js";
22
- import { v as Or, S as zr } from "./filter-reach-copy-B8GGyVuR.js";
23
- import { a as Yt, d as Xt, c as Rr, i as Mr, b as Ur, e as $r, v as Jt, f as Zt, g as jr } from "./variable-draft-Cy03qnEi.js";
24
- import { g as pe, d as qr, a as Wr } from "./index-DoPApnxg.js";
22
+ import { v as Or, J as zr } from "./filter-reach-copy-BukhZmzm.js";
23
+ import { a as Yt, d as Xt, c as Rr, i as Mr, b as Ur, e as $r, v as Jt, f as Zt, g as jr } from "./variable-draft-CDGGl53R.js";
24
+ import { g as pe, d as qr, a as Wr } from "./index-BW0yozjs.js";
25
25
  /**
26
26
  * @license lucide-react v0.453.0 - ISC
27
27
  *
@@ -218,7 +218,7 @@ function Jr({
218
218
  size: "xs",
219
219
  onClick: c,
220
220
  disabled: !o.trim() || n,
221
- children: n ? /* @__PURE__ */ s(U, { children: [
221
+ children: n ? /* @__PURE__ */ s($, { children: [
222
222
  /* @__PURE__ */ t(de, { className: "h-3.5 w-3.5 animate-spin" }),
223
223
  "Creating..."
224
224
  ] }) : "Create library visual"
@@ -356,7 +356,7 @@ function as() {
356
356
  }
357
357
  ), a = Zr(e);
358
358
  return { getUpdatedFrame: ie(() => {
359
- var C;
359
+ var w;
360
360
  Ra();
361
361
  const {
362
362
  frame: n,
@@ -366,7 +366,7 @@ function as() {
366
366
  selectedDatabaseName: h,
367
367
  selectedTableName: d,
368
368
  selectedConnectionId: c
369
- } = oe.getState(), u = i.sql, p = (C = a == null ? void 0 : a.getState()) == null ? void 0 : C.settings, m = qt(i, {
369
+ } = oe.getState(), u = i.sql, p = (w = a == null ? void 0 : a.getState()) == null ? void 0 : w.settings, m = Wt(i, {
370
370
  isDevMode: o,
371
371
  cardSql: u,
372
372
  selectedSchemaName: l,
@@ -374,16 +374,16 @@ function as() {
374
374
  selectedTableName: d,
375
375
  selectedConnectionId: c,
376
376
  remoteChartSettings: p,
377
- stripConfig: Wt
378
- }), f = n.cards.map((k) => {
379
- if (k.id === i.id) return Qt({ before: i, after: m });
380
- const V = rr(k) ? qt(k, { isDevMode: !0, cardSql: k.sql, stripConfig: Wt }) : k;
381
- return Qt({ before: k, after: V });
382
- }), g = f.flatMap((k) => k.dropped);
377
+ stripConfig: Qt
378
+ }), f = n.cards.map((S) => {
379
+ if (S.id === i.id) return Ht({ before: i, after: m });
380
+ const V = rr(S) ? Wt(S, { isDevMode: !0, cardSql: S.sql, stripConfig: Qt }) : S;
381
+ return Ht({ before: S, after: V });
382
+ }), g = f.flatMap((S) => S.dropped);
383
383
  g.length && z.info("Some conditional formatting rules were removed", {
384
- description: `Their column isn't in the saved visual: ${g.map((k) => k.name || "an unnamed rule").join(", ")}.`
384
+ description: `Their column isn't in the saved visual: ${g.map((S) => S.name || "an unnamed rule").join(", ")}.`
385
385
  });
386
- const y = f.map((k) => k.card);
386
+ const y = f.map((S) => S.card);
387
387
  return {
388
388
  ...n,
389
389
  cards: y,
@@ -392,7 +392,7 @@ function as() {
392
392
  }, [a]) };
393
393
  }
394
394
  function Be() {
395
- const { authToken: e, tokenProps: a } = $e(), r = ot(), n = Ba(), i = lt(), { selectVisual: o } = Ct(), {
395
+ const { authToken: e, tokenProps: a } = $e(), r = ot(), n = Ba(), i = lt(), { selectVisual: o } = wt(), {
396
396
  setFrame: l,
397
397
  loadCard: h,
398
398
  setIsDevMode: d,
@@ -403,27 +403,27 @@ function Be() {
403
403
  setSelectedConnectionId: f,
404
404
  setSelectedDatabaseName: g,
405
405
  setSelectedSchemaName: y,
406
- setSelectedTableName: C,
407
- setSelectedDatamodelId: k,
406
+ setSelectedTableName: w,
407
+ setSelectedDatamodelId: S,
408
408
  setInlineFilterValuesMap: V,
409
- setApplyFilters: P,
409
+ setApplyFilters: B,
410
410
  clearEditorContext: D
411
411
  } = dt(), {
412
- setIsDashboardEditing: O,
413
- setIsVisualEditing: b,
414
- clearSelectedFrameId: S
415
- } = ve(), v = N((_) => _.selectedSheetId), T = N((_) => _.selectedFrameId), F = N((_) => _.dashboard), K = N(
416
- (_) => _.inlineFilterValuesMap
417
- ), B = _a((i == null ? void 0 : i.id) || "", {
412
+ setIsDashboardEditing: P,
413
+ setIsVisualEditing: k,
414
+ clearSelectedFrameId: v
415
+ } = ve(), b = C((O) => O.selectedSheetId), _ = C((O) => O.selectedFrameId), A = C((O) => O.dashboard), G = C(
416
+ (O) => O.inlineFilterValuesMap
417
+ ), T = _a((i == null ? void 0 : i.id) || "", {
418
418
  enabled: !!(i != null && i.id) && !!(e != null && e.accessToken)
419
- }), Q = ie(
420
- async (_) => {
419
+ }), M = ie(
420
+ async (O) => {
421
421
  try {
422
- o(_), S(), D();
422
+ o(O), v(), D();
423
423
  const { data: te, fromCache: Z } = await aa(
424
424
  a.apiServiceUrl,
425
425
  (e == null ? void 0 : e.accessToken) || "",
426
- _.id,
426
+ O.id,
427
427
  r,
428
428
  "Opening library visual..."
429
429
  );
@@ -438,16 +438,16 @@ function Be() {
438
438
  setSelectedConnectionId: f,
439
439
  setSelectedDatabaseName: g,
440
440
  setSelectedSchemaName: y,
441
- setSelectedTableName: C,
442
- setSelectedDatamodelId: k,
441
+ setSelectedTableName: w,
442
+ setSelectedDatamodelId: S,
443
443
  setInlineFilterValuesMap: V,
444
- setApplyFilters: P,
445
- setIsDashboardEditing: O,
446
- setIsVisualEditing: b,
447
- dashboard: F,
448
- selectedSheetId: v,
449
- selectedFrameId: T,
450
- inlineFilterValuesMap: K
444
+ setApplyFilters: B,
445
+ setIsDashboardEditing: P,
446
+ setIsVisualEditing: k,
447
+ dashboard: A,
448
+ selectedSheetId: b,
449
+ selectedFrameId: _,
450
+ inlineFilterValuesMap: G
451
451
  }))
452
452
  throw new Error("Failed to setup editor with visual data");
453
453
  return { success: !0, fromCache: Z };
@@ -462,8 +462,8 @@ function Be() {
462
462
  o,
463
463
  l,
464
464
  h,
465
- O,
466
- b,
465
+ P,
466
+ k,
467
467
  d,
468
468
  c,
469
469
  u,
@@ -472,45 +472,45 @@ function Be() {
472
472
  f,
473
473
  g,
474
474
  y,
475
- C,
476
- k,
475
+ w,
476
+ S,
477
477
  V,
478
- P,
478
+ B,
479
479
  D,
480
- S,
481
- F,
482
480
  v,
483
- T,
484
- K
481
+ A,
482
+ b,
483
+ _,
484
+ G
485
485
  ]
486
486
  ), X = ie(
487
- async (_) => {
487
+ async (O) => {
488
488
  var Z;
489
- const te = (G) => (z.error(G), { success: !1, error: G });
489
+ const te = (K) => (z.error(K), { success: !1, error: K });
490
490
  try {
491
- if (o(_), !v)
491
+ if (o(O), !b)
492
492
  return te("No sheet selected. Please select a sheet first.");
493
- const { data: G, fromCache: I } = await aa(
493
+ const { data: K, fromCache: I } = await aa(
494
494
  a.apiServiceUrl,
495
495
  (e == null ? void 0 : e.accessToken) || "",
496
- _.id,
496
+ O.id,
497
497
  r,
498
498
  "Adding visual to dashboard..."
499
- ), ae = (G == null ? void 0 : G.frameObject) ?? ((Z = G == null ? void 0 : G.visual) == null ? void 0 : Z.frameObject);
499
+ ), ae = (K == null ? void 0 : K.frameObject) ?? ((Z = K == null ? void 0 : K.visual) == null ? void 0 : Z.frameObject);
500
500
  if (!ae)
501
501
  return te("Visual has no frame data");
502
- const j = Da(ae);
503
- if (!(j != null && j.cards) || j.cards.length === 0)
502
+ const q = Da(ae);
503
+ if (!(q != null && q.cards) || q.cards.length === 0)
504
504
  return te("Visual frame is malformed");
505
505
  const R = {
506
- ...Oa(j),
507
- visualId: _.id
506
+ ...Oa(q),
507
+ visualId: O.id
508
508
  // Link this frame to the library visual
509
509
  };
510
- return await n(v, R), O(!0), { success: !0, fromCache: I };
511
- } catch (G) {
512
- return console.error("Error adding visual:", G), te(
513
- G instanceof Error ? G.message : "Failed to add visual to dashboard"
510
+ return await n(b, R), P(!0), { success: !0, fromCache: I };
511
+ } catch (K) {
512
+ return console.error("Error adding visual:", K), te(
513
+ K instanceof Error ? K.message : "Failed to add visual to dashboard"
514
514
  );
515
515
  }
516
516
  },
@@ -519,20 +519,20 @@ function Be() {
519
519
  a.apiServiceUrl,
520
520
  r,
521
521
  o,
522
- v,
523
- O,
522
+ b,
523
+ P,
524
524
  n
525
525
  ]
526
526
  );
527
527
  return {
528
- visual: B.data,
529
- isLoading: B.isLoading,
530
- isError: B.isError,
531
- error: B.error,
532
- handleEditLibraryVisual: Q,
528
+ visual: T.data,
529
+ isLoading: T.isLoading,
530
+ isError: T.isError,
531
+ error: T.error,
532
+ handleEditLibraryVisual: M,
533
533
  handleAddLibraryVisual: X,
534
534
  getUpdatedFrame: as().getUpdatedFrame,
535
- refetch: B.refetch
535
+ refetch: T.refetch
536
536
  };
537
537
  }
538
538
  function Aa(e) {
@@ -547,16 +547,16 @@ function Fa(e, a) {
547
547
  const r = (n = e.ownership.createdBy) == null ? void 0 : n.type;
548
548
  return r === "tenant" || r === "organization" && a;
549
549
  }
550
- function zt(e, a) {
550
+ function Rt(e, a) {
551
551
  var r, n;
552
552
  return Fa(e, a) ? ((r = e.ownership.createdBy) == null ? void 0 : r.name) || ((n = e.createdByTenantUserRel) == null ? void 0 : n.name) || e.lastModifiedBy || "Unknown" : "Organization";
553
553
  }
554
554
  function ns(e, a) {
555
- return zt(e, a).split(/\s+/).filter(Boolean).slice(0, 2).map((n) => n.charAt(0).toUpperCase()).join("") || "?";
555
+ return Rt(e, a).split(/\s+/).filter(Boolean).slice(0, 2).map((n) => n.charAt(0).toUpperCase()).join("") || "?";
556
556
  }
557
557
  function rs(e) {
558
558
  const a = (e || "").toLowerCase();
559
- return a.includes("table") ? Pt : a.includes("pie") || a.includes("donut") ? Qa : a.includes("line") ? Ha : a.includes("bar") ? tr : Ue;
559
+ return a.includes("table") ? Bt : a.includes("pie") || a.includes("donut") ? Qa : a.includes("line") ? Ha : a.includes("bar") ? tr : Ue;
560
560
  }
561
561
  function ss({ visual: e }) {
562
562
  const a = e.ownership.status === "public" ? "Public" : e.ownership.status === "shared" || e.ownership.sharedCount > 0 ? "Shared" : "Private";
@@ -570,82 +570,82 @@ function qi({
570
570
  null
571
571
  ), [p, m] = E(
572
572
  null
573
- ), [f, g] = E(!1), [y, C] = E(null), [k, V] = E(null), P = () => {
574
- l(/* @__PURE__ */ new Set()), u(null), m(null), g(!1), C(null);
573
+ ), [f, g] = E(!1), [y, w] = E(null), [S, V] = E(null), B = () => {
574
+ l(/* @__PURE__ */ new Set()), u(null), m(null), g(!1), w(null);
575
575
  }, D = () => {
576
- a(!1), P();
577
- }, { selectVisual: O } = Ct(), { handleAddLibraryVisual: b, handleEditLibraryVisual: S } = Be(), { isConsoleMode: v } = Ma(), {
578
- resources: T,
579
- isLoading: F,
580
- isError: K,
581
- createResource: B,
582
- updateResource: Q,
576
+ a(!1), B();
577
+ }, { selectVisual: P } = wt(), { handleAddLibraryVisual: k, handleEditLibraryVisual: v } = Be(), { isConsoleMode: b } = Ma(), {
578
+ resources: _,
579
+ isLoading: A,
580
+ isError: G,
581
+ createResource: T,
582
+ updateResource: M,
583
583
  deleteResourceAsync: X,
584
- duplicateResource: _,
584
+ duplicateResource: O,
585
585
  isCreating: te,
586
586
  isDeleting: Z
587
587
  } = Ua(
588
588
  void 0,
589
- (w) => {
590
- d(!1), w && (O(w), S(w), D());
589
+ (N) => {
590
+ d(!1), N && (P(N), v(N), D());
591
591
  }
592
592
  ), {
593
- startUpdating: G,
593
+ startUpdating: K,
594
594
  stopUpdating: I,
595
595
  isUpdating: ae
596
- } = $a(), j = T, R = Y(() => {
597
- const w = n.trim().toLowerCase();
598
- return w ? j.filter(
599
- (q) => {
600
- var ee, me, Ne;
601
- return ((ee = q.title) == null ? void 0 : ee.toLowerCase().includes(w)) || ((me = q.description) == null ? void 0 : me.toLowerCase().includes(w)) || ((Ne = q.kind) == null ? void 0 : Ne.toLowerCase().includes(w));
596
+ } = $a(), q = _, R = Y(() => {
597
+ const N = n.trim().toLowerCase();
598
+ return N ? q.filter(
599
+ (W) => {
600
+ var ee, me, Ce;
601
+ return ((ee = W.title) == null ? void 0 : ee.toLowerCase().includes(N)) || ((me = W.description) == null ? void 0 : me.toLowerCase().includes(N)) || ((Ce = W.kind) == null ? void 0 : Ce.toLowerCase().includes(N));
602
602
  }
603
- ) : j;
604
- }, [n, j]), ne = Y(
605
- () => j.filter(
606
- (w) => o.has(w.id)
603
+ ) : q;
604
+ }, [n, q]), ne = Y(
605
+ () => q.filter(
606
+ (N) => o.has(N.id)
607
607
  ),
608
- [o, j]
608
+ [o, q]
609
609
  ), ue = ne.filter(
610
- (w) => w.permissions.canDelete
610
+ (N) => N.permissions.canDelete
611
611
  ), he = ne.filter(
612
- (w) => w.permissions.canShare
612
+ (N) => N.permissions.canShare
613
613
  ), ye = R.length > 0 && R.every(
614
- (w) => o.has(w.id)
614
+ (N) => o.has(N.id)
615
615
  ), x = R.some(
616
- (w) => o.has(w.id)
617
- ), M = (w) => {
618
- const q = new Set(o);
619
- w(q), l(q);
620
- }, $ = (w) => {
621
- M((q) => {
622
- q.has(w) ? q.delete(w) : q.add(w);
616
+ (N) => o.has(N.id)
617
+ ), U = (N) => {
618
+ const W = new Set(o);
619
+ N(W), l(W);
620
+ }, j = (N) => {
621
+ U((W) => {
622
+ W.has(N) ? W.delete(N) : W.add(N);
623
623
  });
624
624
  }, H = () => {
625
- l((w) => {
626
- const q = new Set(w);
625
+ l((N) => {
626
+ const W = new Set(N);
627
627
  return ye ? R.forEach(
628
- (ee) => q.delete(ee.id)
628
+ (ee) => W.delete(ee.id)
629
629
  ) : R.forEach(
630
- (ee) => q.add(ee.id)
631
- ), q;
630
+ (ee) => W.add(ee.id)
631
+ ), W;
632
632
  });
633
- }, le = async (w) => {
634
- (await b(w)).success && D();
633
+ }, le = async (N) => {
634
+ (await k(N)).success && D();
635
635
  }, _e = async () => {
636
- const w = ne;
637
- if (w.length === 0) return;
638
- let q = !1;
639
- for (const ee of w)
640
- if (!(await b(ee)).success) {
641
- q = !0;
636
+ const N = ne;
637
+ if (N.length === 0) return;
638
+ let W = !1;
639
+ for (const ee of N)
640
+ if (!(await k(ee)).success) {
641
+ W = !0;
642
642
  break;
643
643
  }
644
- q || D();
645
- }, ht = (w) => {
646
- S(w), D();
647
- }, Fe = (w) => {
648
- V(w), _(w, {
644
+ W || D();
645
+ }, ht = (N) => {
646
+ v(N), D();
647
+ }, Fe = (N) => {
648
+ V(N), O(N, {
649
649
  onSettled: () => V(null)
650
650
  });
651
651
  }, Ke = () => {
@@ -653,18 +653,18 @@ function qi({
653
653
  z.error("Select a visual you can delete");
654
654
  return;
655
655
  }
656
- C(null), g(!0);
656
+ w(null), g(!0);
657
657
  }, mt = async () => {
658
- const w = y ? [y] : ue;
658
+ const N = y ? [y] : ue;
659
659
  try {
660
- for (const q of w)
661
- await X(q.id);
662
- l((q) => {
663
- const ee = new Set(q);
664
- return w.forEach(
660
+ for (const W of N)
661
+ await X(W.id);
662
+ l((W) => {
663
+ const ee = new Set(W);
664
+ return N.forEach(
665
665
  (me) => ee.delete(me.id)
666
666
  ), ee;
667
- }), g(!1), C(null);
667
+ }), g(!1), w(null);
668
668
  } catch {
669
669
  }
670
670
  }, Oe = () => {
@@ -672,41 +672,41 @@ function qi({
672
672
  z.error("Select one visual to share");
673
673
  return;
674
674
  }
675
- const [w] = ne;
676
- if (!w.permissions.canShare) {
675
+ const [N] = ne;
676
+ if (!N.permissions.canShare) {
677
677
  z.error("You do not have permission to share this visual");
678
678
  return;
679
679
  }
680
- u(w);
680
+ u(N);
681
681
  }, ze = ({
682
- title: w,
683
- description: q
682
+ title: N,
683
+ description: W
684
684
  }) => {
685
685
  if (!p) return;
686
686
  const ee = {};
687
- if (w !== p.title && (ee.title = w), (p.description || "") !== q && (ee.description = q), Object.keys(ee).length === 0) {
687
+ if (N !== p.title && (ee.title = N), (p.description || "") !== W && (ee.description = W), Object.keys(ee).length === 0) {
688
688
  m(null);
689
689
  return;
690
690
  }
691
- const me = Object.keys(ee), Ne = me.length === 1 ? me[0] : void 0;
692
- G(p.id, Ne), Q(
691
+ const me = Object.keys(ee), Ce = me.length === 1 ? me[0] : void 0;
692
+ K(p.id, Ce), M(
693
693
  {
694
694
  resourceId: p.id,
695
695
  data: ee
696
696
  },
697
697
  {
698
698
  onSuccess: () => {
699
- I(p.id, Ne), m(null);
699
+ I(p.id, Ce), m(null);
700
700
  },
701
701
  onError: () => {
702
- I(p.id, Ne);
702
+ I(p.id, Ce);
703
703
  }
704
704
  }
705
705
  );
706
- }, ce = (w) => {
707
- a(w), w || P();
706
+ }, ce = (N) => {
707
+ a(N), N || B();
708
708
  }, Re = y ? 1 : ue.length;
709
- return /* @__PURE__ */ s(U, { children: [
709
+ return /* @__PURE__ */ s($, { children: [
710
710
  /* @__PURE__ */ t(Le, { open: e, onOpenChange: ce, children: /* @__PURE__ */ s(
711
711
  Ve,
712
712
  {
@@ -716,7 +716,7 @@ function qi({
716
716
  children: [
717
717
  /* @__PURE__ */ s("div", { className: "flex h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3", children: [
718
718
  /* @__PURE__ */ s("div", { className: "flex min-w-0 items-center gap-2", children: [
719
- /* @__PURE__ */ t(Pt, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
719
+ /* @__PURE__ */ t(Bt, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
720
720
  /* @__PURE__ */ s("div", { className: "flex min-w-0 items-baseline gap-2", children: [
721
721
  /* @__PURE__ */ t(Pe, { className: "truncate text-[13px] font-medium leading-none tracking-normal", children: "Visuals library" }),
722
722
  /* @__PURE__ */ t("span", { className: "shrink-0 text-[10px] font-medium uppercase leading-none tracking-[0.08em] text-muted-foreground", children: "Add to dashboard" })
@@ -742,7 +742,7 @@ function qi({
742
742
  {
743
743
  autoFocus: !0,
744
744
  value: n,
745
- onChange: (w) => i(w.target.value),
745
+ onChange: (N) => i(N.target.value),
746
746
  placeholder: "Search visuals...",
747
747
  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",
748
748
  "aria-label": "Search visuals"
@@ -763,7 +763,7 @@ function qi({
763
763
  }
764
764
  )
765
765
  ] }),
766
- /* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: F ? /* @__PURE__ */ t("div", { className: "p-3", children: /* @__PURE__ */ t(Xr, {}) }) : K ? /* @__PURE__ */ t("div", { className: "flex flex-col items-center gap-2 px-4 py-12 text-center", children: /* @__PURE__ */ t("p", { className: "text-[13px] text-destructive", children: "Failed to load visuals" }) }) : R.length === 0 ? /* @__PURE__ */ s("div", { className: "flex flex-col items-center gap-2 px-4 py-12 text-center", children: [
766
+ /* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: A ? /* @__PURE__ */ t("div", { className: "p-3", children: /* @__PURE__ */ t(Xr, {}) }) : G ? /* @__PURE__ */ t("div", { className: "flex flex-col items-center gap-2 px-4 py-12 text-center", children: /* @__PURE__ */ t("p", { className: "text-[13px] text-destructive", children: "Failed to load visuals" }) }) : R.length === 0 ? /* @__PURE__ */ s("div", { className: "flex flex-col items-center gap-2 px-4 py-12 text-center", children: [
767
767
  /* @__PURE__ */ t(Ue, { className: "h-5 w-5 text-muted-foreground/60" }),
768
768
  /* @__PURE__ */ t("p", { className: "text-[13px] font-medium", children: n ? "No visuals found" : "No visuals yet" }),
769
769
  /* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: n ? "Try a different search." : "Create a saved visual to add it here." })
@@ -775,22 +775,22 @@ function qi({
775
775
  allFilteredSelected: ye,
776
776
  someFilteredSelected: x,
777
777
  onSelectAll: H,
778
- onToggleSelection: $,
778
+ onToggleSelection: j,
779
779
  onAddVisual: le,
780
780
  onOpenVisual: ht,
781
781
  onEditDetails: m,
782
782
  onShareVisual: u,
783
- onDeleteVisual: (w) => {
784
- C(w), g(!0);
783
+ onDeleteVisual: (N) => {
784
+ w(N), g(!0);
785
785
  },
786
786
  onDuplicateVisual: Fe,
787
- duplicatingId: k,
787
+ duplicatingId: S,
788
788
  isDeleting: Z,
789
- isConsoleMode: v
789
+ isConsoleMode: b
790
790
  }
791
791
  ) }),
792
792
  /* @__PURE__ */ s("div", { className: "flex shrink-0 items-center justify-between gap-2 border-t border-border/60 px-3 py-2", children: [
793
- /* @__PURE__ */ t("div", { className: "flex min-w-0 items-center gap-1.5", children: o.size > 0 && /* @__PURE__ */ s(U, { children: [
793
+ /* @__PURE__ */ t("div", { className: "flex min-w-0 items-center gap-1.5", children: o.size > 0 && /* @__PURE__ */ s($, { children: [
794
794
  /* @__PURE__ */ s("span", { className: "text-[12px] text-muted-foreground", children: [
795
795
  /* @__PURE__ */ t("span", { className: "font-medium tabular-nums text-foreground", children: o.size }),
796
796
  " ",
@@ -851,7 +851,7 @@ function qi({
851
851
  onClick: _e,
852
852
  disabled: o.size === 0,
853
853
  children: [
854
- /* @__PURE__ */ t(Bt, { className: "h-3.5 w-3.5" }),
854
+ /* @__PURE__ */ t(_t, { className: "h-3.5 w-3.5" }),
855
855
  o.size === 0 ? "Add to dashboard" : `Add ${o.size} visual${o.size === 1 ? "" : "s"}`
856
856
  ]
857
857
  }
@@ -866,7 +866,7 @@ function qi({
866
866
  {
867
867
  open: h,
868
868
  onOpenChange: d,
869
- onSubmit: B,
869
+ onSubmit: T,
870
870
  isCreating: te
871
871
  }
872
872
  ),
@@ -891,30 +891,30 @@ function qi({
891
891
  }
892
892
  ),
893
893
  /* @__PURE__ */ t(
894
- wt,
894
+ St,
895
895
  {
896
896
  open: f,
897
- onOpenChange: (w) => {
898
- !w && Z || (g(w), w || C(null));
897
+ onOpenChange: (N) => {
898
+ !N && Z || (g(N), N || w(null));
899
899
  },
900
- children: /* @__PURE__ */ s(St, { children: [
901
- /* @__PURE__ */ s(kt, { children: [
902
- /* @__PURE__ */ s(Dt, { children: [
900
+ children: /* @__PURE__ */ s(kt, { children: [
901
+ /* @__PURE__ */ s(Dt, { children: [
902
+ /* @__PURE__ */ s(At, { children: [
903
903
  "Delete ",
904
904
  Re,
905
905
  " visual",
906
906
  Re === 1 ? "" : "s",
907
907
  "?"
908
908
  ] }),
909
- /* @__PURE__ */ t(At, { children: "This cannot be undone. Visuals already added to dashboards may need to be removed from those dashboards separately." })
909
+ /* @__PURE__ */ t(Ft, { children: "This cannot be undone. Visuals already added to dashboards may need to be removed from those dashboards separately." })
910
910
  ] }),
911
- /* @__PURE__ */ s(Ft, { children: [
912
- /* @__PURE__ */ t(Et, { disabled: Z, children: "Cancel" }),
911
+ /* @__PURE__ */ s(Et, { children: [
912
+ /* @__PURE__ */ t(It, { disabled: Z, children: "Cancel" }),
913
913
  /* @__PURE__ */ s(
914
914
  ua,
915
915
  {
916
- onClick: (w) => {
917
- w.preventDefault(), mt();
916
+ onClick: (N) => {
917
+ N.preventDefault(), mt();
918
918
  },
919
919
  disabled: Z || Re === 0,
920
920
  children: [
@@ -949,7 +949,7 @@ function is({
949
949
  return /* @__PURE__ */ s("div", { className: "min-w-[48rem]", children: [
950
950
  /* @__PURE__ */ s("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: [
951
951
  /* @__PURE__ */ t(
952
- It,
952
+ Tt,
953
953
  {
954
954
  checked: r ? !0 : n ? "indeterminate" : !1,
955
955
  onCheckedChange: i,
@@ -1010,7 +1010,7 @@ function os({
1010
1010
  ),
1011
1011
  children: [
1012
1012
  /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
1013
- It,
1013
+ Tt,
1014
1014
  {
1015
1015
  checked: a,
1016
1016
  onCheckedChange: () => r(e.id),
@@ -1049,7 +1049,7 @@ function os({
1049
1049
  ),
1050
1050
  /* @__PURE__ */ s("div", { className: "flex min-w-0 items-center gap-2", children: [
1051
1051
  /* @__PURE__ */ t("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: ns(e, p) }),
1052
- /* @__PURE__ */ t("span", { className: "truncate text-muted-foreground", children: zt(e, p) })
1052
+ /* @__PURE__ */ t("span", { className: "truncate text-muted-foreground", children: Rt(e, p) })
1053
1053
  ] }),
1054
1054
  /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: Aa(e.updatedAt) }),
1055
1055
  /* @__PURE__ */ t(ss, { visual: e }),
@@ -1140,7 +1140,7 @@ function ls({
1140
1140
  /* @__PURE__ */ t(ca, { className: "h-3.5 w-3.5" }),
1141
1141
  "Share"
1142
1142
  ] }),
1143
- e.permissions.canDelete && /* @__PURE__ */ s(U, { children: [
1143
+ e.permissions.canDelete && /* @__PURE__ */ s($, { children: [
1144
1144
  /* @__PURE__ */ t(at, {}),
1145
1145
  /* @__PURE__ */ s(
1146
1146
  re,
@@ -1159,7 +1159,7 @@ function ls({
1159
1159
  /* @__PURE__ */ s("div", { className: "space-y-1 px-2 py-1.5 text-[11px] text-muted-foreground", children: [
1160
1160
  Fa(e, d) && /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5", children: [
1161
1161
  /* @__PURE__ */ t(Ga, { className: "h-3 w-3" }),
1162
- /* @__PURE__ */ t("span", { className: "truncate", children: zt(e, d) })
1162
+ /* @__PURE__ */ t("span", { className: "truncate", children: Rt(e, d) })
1163
1163
  ] }),
1164
1164
  /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5", children: [
1165
1165
  /* @__PURE__ */ t(Ya, { className: "h-3 w-3" }),
@@ -1175,16 +1175,16 @@ function ls({
1175
1175
  );
1176
1176
  }
1177
1177
  function Wi(e, a, r = !1) {
1178
- const n = N((u) => u.dashboard), i = N(
1178
+ const n = C((u) => u.dashboard), i = C(
1179
1179
  (u) => u.isDashboardEditing
1180
- ), o = N((u) => u.isVisualEditing), l = N(
1180
+ ), o = C((u) => u.isVisualEditing), l = C(
1181
1181
  (u) => u.onDashboardLifecycleEvent
1182
1182
  ), h = ie(() => {
1183
- const { dashboard: u, isVisualEditing: p } = N.getState();
1183
+ const { dashboard: u, isVisualEditing: p } = C.getState();
1184
1184
  return a || !e || !u || u.id !== e.id ? !1 : p ? !0 : Je(u) !== Je(e);
1185
1185
  }, [e, a]);
1186
- Ut(() => (N.setState({ checkUnsavedDashboardChanges: h }), () => {
1187
- N.getState().checkUnsavedDashboardChanges === h && N.setState({ checkUnsavedDashboardChanges: null });
1186
+ $t(() => (C.setState({ checkUnsavedDashboardChanges: h }), () => {
1187
+ C.getState().checkUnsavedDashboardChanges === h && C.setState({ checkUnsavedDashboardChanges: null });
1188
1188
  }), [h]);
1189
1189
  const d = Y(() => !r || a || !n || i && (!e || n.id !== e.id) ? null : {
1190
1190
  dashboardId: n.id,
@@ -1197,7 +1197,7 @@ function Wi(e, a, r = !1) {
1197
1197
  e,
1198
1198
  n
1199
1199
  ]), c = et(null);
1200
- return Ut(() => {
1200
+ return $t(() => {
1201
1201
  if (!l || !d) {
1202
1202
  c.current = null;
1203
1203
  return;
@@ -1214,21 +1214,21 @@ function Wi(e, a, r = !1) {
1214
1214
  }));
1215
1215
  }, [d, l]), h;
1216
1216
  }
1217
- function Rt(e) {
1217
+ function Mt(e) {
1218
1218
  var a;
1219
1219
  for (const r of e.cards)
1220
1220
  if (r.type === "matrixTable" && !nr.safeParse((a = r.config) == null ? void 0 : a.matrix).success)
1221
1221
  return z.error("Matrix requires at least one row field, one metric, and valid settings."), !1;
1222
1222
  return !0;
1223
1223
  }
1224
- function gt({
1224
+ function bt({
1225
1225
  className: e,
1226
1226
  variant: a = "outline"
1227
1227
  }) {
1228
1228
  const r = oe((o) => o.onSave), { getUpdatedFrame: n } = Be();
1229
1229
  function i() {
1230
1230
  const o = n();
1231
- Rt(o) && (r == null || r(o));
1231
+ Mt(o) && (r == null || r(o));
1232
1232
  }
1233
1233
  return /* @__PURE__ */ s(
1234
1234
  L,
@@ -1238,7 +1238,7 @@ function gt({
1238
1238
  size: "xs",
1239
1239
  variant: a,
1240
1240
  children: [
1241
- /* @__PURE__ */ t(Bt, { className: "h-3.5 w-3.5" }),
1241
+ /* @__PURE__ */ t(_t, { className: "h-3.5 w-3.5" }),
1242
1242
  "Done"
1243
1243
  ]
1244
1244
  }
@@ -1254,7 +1254,7 @@ function ds({
1254
1254
  {
1255
1255
  onClick: () => {
1256
1256
  const p = l();
1257
- if (!Rt(p))
1257
+ if (!Mt(p))
1258
1258
  return;
1259
1259
  const m = (d == null ? void 0 : d.visualId) || (h == null ? void 0 : h.id);
1260
1260
  if (!m) {
@@ -1284,10 +1284,10 @@ function ds({
1284
1284
  className: e,
1285
1285
  size: "xs",
1286
1286
  variant: a,
1287
- children: n ? /* @__PURE__ */ s(U, { children: [
1287
+ children: n ? /* @__PURE__ */ s($, { children: [
1288
1288
  /* @__PURE__ */ t(de, { className: "h-3.5 w-3.5 animate-spin" }),
1289
1289
  "Saving"
1290
- ] }) : /* @__PURE__ */ s(U, { children: [
1290
+ ] }) : /* @__PURE__ */ s($, { children: [
1291
1291
  /* @__PURE__ */ t(wa, { className: "h-3.5 w-3.5" }),
1292
1292
  "Save to Library"
1293
1293
  ] })
@@ -1297,7 +1297,7 @@ function ds({
1297
1297
  function cs({
1298
1298
  className: e
1299
1299
  }) {
1300
- const a = ot(), [r, n] = E(!1), i = lt(), o = oe((g) => g.frame), l = N((g) => g.selectedSheetId), h = N((g) => g.dashboard), { updateFrame: d, setIsVisualEditing: c } = ve(), { getUpdatedFrame: u } = Be(), p = ma(), m = ct();
1300
+ const a = ot(), [r, n] = E(!1), i = lt(), o = oe((g) => g.frame), l = C((g) => g.selectedSheetId), h = C((g) => g.dashboard), { updateFrame: d, setIsVisualEditing: c } = ve(), { getUpdatedFrame: u } = Be(), p = ma(), m = ct();
1301
1301
  return /* @__PURE__ */ t(
1302
1302
  L,
1303
1303
  {
@@ -1314,23 +1314,23 @@ function cs({
1314
1314
  n(!0);
1315
1315
  try {
1316
1316
  const y = u();
1317
- if (!Rt(y)) {
1317
+ if (!Mt(y)) {
1318
1318
  n(!1);
1319
1319
  return;
1320
1320
  }
1321
- const C = {
1321
+ const w = {
1322
1322
  ...y,
1323
1323
  visualId: g
1324
1324
  // Keep the link to library visual
1325
- }, k = rt(h, C.id), V = await m(C, {
1326
- previousFrame: k
1325
+ }, S = rt(h, w.id), V = await m(w, {
1326
+ previousFrame: S
1327
1327
  });
1328
1328
  await p.mutateAsync({
1329
1329
  visualId: g,
1330
1330
  data: {
1331
1331
  frameObject: y
1332
1332
  }
1333
- }), d(l, C, {
1333
+ }), d(l, w, {
1334
1334
  semanticExecutionPayload: V
1335
1335
  }), a.invalidateQueries({ queryKey: ["visuals"] }), a.invalidateQueries({ queryKey: ["visual", g] }), z.success("Saved to library and applied locally"), setTimeout(() => {
1336
1336
  c(!1);
@@ -1347,17 +1347,17 @@ function cs({
1347
1347
  size: "xs",
1348
1348
  variant: "default",
1349
1349
  disabled: r,
1350
- children: r ? /* @__PURE__ */ s(U, { children: [
1350
+ children: r ? /* @__PURE__ */ s($, { children: [
1351
1351
  /* @__PURE__ */ t(de, { className: "h-3.5 w-3.5 animate-spin" }),
1352
1352
  "Saving..."
1353
- ] }) : /* @__PURE__ */ s(U, { children: [
1353
+ ] }) : /* @__PURE__ */ s($, { children: [
1354
1354
  /* @__PURE__ */ t(wa, { className: "h-3.5 w-3.5" }),
1355
1355
  "Save & Apply"
1356
1356
  ] })
1357
1357
  }
1358
1358
  );
1359
1359
  }
1360
- function bt({ className: e }) {
1360
+ function xt({ className: e }) {
1361
1361
  const { setTempQueryData: a, setSqlGen: r } = dt(), n = ot(), i = oe((h) => h.tempQueryData), o = oe((h) => h.onClose);
1362
1362
  function l() {
1363
1363
  if (i) {
@@ -1424,7 +1424,7 @@ function us({
1424
1424
  });
1425
1425
  };
1426
1426
  return /* @__PURE__ */ t(Le, { open: e, onOpenChange: a, children: /* @__PURE__ */ s(Ve, { className: "sm:max-w-[500px]", children: [
1427
- /* @__PURE__ */ s(Tt, { children: [
1427
+ /* @__PURE__ */ s(Lt, { children: [
1428
1428
  /* @__PURE__ */ s(Pe, { className: "flex items-center gap-2", children: [
1429
1429
  /* @__PURE__ */ t("span", { children: "Save Visual As" }),
1430
1430
  m.badgeType !== "local" && /* @__PURE__ */ t(
@@ -1485,27 +1485,28 @@ function us({
1485
1485
  ] }) });
1486
1486
  }
1487
1487
  function hs() {
1488
- const [e, a] = E(!1), [r, n] = E(!1), [i, o] = E(null), [l, h] = E(null), d = oe((b) => b.frame), c = oe((b) => b.card), u = lt(), p = N((b) => b.selectedSheetId), m = N((b) => b.dashboard), { getUpdatedFrame: f } = Be(), { selectVisual: g } = Ct(), { addFrame: y, setIsVisualEditing: C } = ve(), k = ct(), V = !!(d != null && d.visualId), P = (() => {
1489
- var b, S;
1490
- return ((b = d == null ? void 0 : d.cards) == null ? void 0 : b.length) === 1 && ((S = d.cards[0]) != null && S.title) ? d.cards[0].title : u != null && u.title ? u.title : (c == null ? void 0 : c.title) || "Untitled Visual";
1491
- })(), D = Ja((b) => {
1492
- b != null && b.id && (g(b), r && i && l && p && (async () => {
1488
+ const [e, a] = E(!1), [r, n] = E(!1), [i, o] = E(null), [l, h] = E(null), d = oe((v) => v.frame), c = oe((v) => v.card), u = lt(), p = C((v) => v.selectedSheetId), m = C((v) => v.dashboard), { getUpdatedFrame: f } = Be(), { selectVisual: g } = wt(), { addFrame: y, checkAddFrame: w, setIsVisualEditing: S } = ve(), V = ct(), B = !!(d != null && d.visualId), D = (() => {
1489
+ var v, b;
1490
+ return ((v = d == null ? void 0 : d.cards) == null ? void 0 : v.length) === 1 && ((b = d.cards[0]) != null && b.title) ? d.cards[0].title : u != null && u.title ? u.title : (c == null ? void 0 : c.title) || "Untitled Visual";
1491
+ })(), P = Ja((v) => {
1492
+ v != null && v.id && (g(v), r && i && l && p && (async () => {
1493
1493
  try {
1494
- const S = {
1494
+ const b = {
1495
1495
  ...i,
1496
- id: Ht(),
1497
- visualId: b.id
1496
+ id: gt(),
1497
+ visualId: v.id
1498
1498
  // Link to the newly created library visual
1499
1499
  };
1500
- y(p, S, {
1501
- semanticExecutionPayload: l
1502
- }), n(!1), o(null), h(null), C(!1);
1503
- } catch (S) {
1500
+ y(p, b, {
1501
+ semanticExecutionPayload: l,
1502
+ withEditorFieldChanges: !0
1503
+ }), n(!1), o(null), h(null), S(!1);
1504
+ } catch (b) {
1504
1505
  console.error(
1505
1506
  "Failed to promote semantic metadata for saved visual:",
1506
- S
1507
+ b
1507
1508
  ), z.error(
1508
- S instanceof Error ? S.message : "Failed to prepare semantic metadata for the saved visual"
1509
+ b instanceof Error ? b.message : "Failed to prepare semantic metadata for the saved visual"
1509
1510
  );
1510
1511
  }
1511
1512
  })(), a(!1));
@@ -1513,131 +1514,139 @@ function hs() {
1513
1514
  return {
1514
1515
  saveAsDialogOpen: e,
1515
1516
  setSaveAsDialogOpen: a,
1516
- handleSaveAs: async (b) => {
1517
+ handleSaveAs: async (v) => {
1517
1518
  if (!p) {
1518
1519
  z.error("No sheet selected");
1519
1520
  return;
1520
1521
  }
1521
- const S = f(), T = S.cards.length === 1 ? {
1522
- ...S,
1523
- cards: S.cards.map((F) => ({
1524
- ...F,
1525
- title: b.name
1522
+ const b = f(), A = b.cards.length === 1 ? {
1523
+ ...b,
1524
+ cards: b.cards.map((G) => ({
1525
+ ...G,
1526
+ title: v.name
1526
1527
  // Use visual name as card title
1527
1528
  }))
1528
- } : S;
1529
- if (b.saveToLibrary) {
1530
- let F = null;
1531
- if (b.saveToCurrentDashboard)
1529
+ } : b;
1530
+ if (v.saveToLibrary) {
1531
+ let G = null;
1532
+ if (v.saveToCurrentDashboard)
1532
1533
  try {
1533
- F = await k(T, {
1534
- previousFrame: rt(m, T.id)
1534
+ G = await V(A, {
1535
+ previousFrame: rt(m, A.id)
1535
1536
  });
1536
- } catch (B) {
1537
+ } catch (M) {
1537
1538
  console.error(
1538
1539
  "Failed to prepare semantic metadata before saving visual:",
1539
- B
1540
+ M
1540
1541
  ), z.error(
1541
- B instanceof Error ? B.message : "Failed to prepare semantic metadata for the saved visual"
1542
+ M instanceof Error ? M.message : "Failed to prepare semantic metadata for the saved visual"
1542
1543
  );
1543
1544
  return;
1544
1545
  }
1545
- n(b.saveToCurrentDashboard), o(T), h(F);
1546
- const K = {
1547
- title: b.name,
1548
- description: b.description,
1549
- frameObject: T,
1546
+ if (v.saveToCurrentDashboard) {
1547
+ const M = w(p, { ...A, id: gt() }, { withEditorFieldChanges: !0 });
1548
+ if (!M.ok) {
1549
+ z.error(M.reason);
1550
+ return;
1551
+ }
1552
+ }
1553
+ n(v.saveToCurrentDashboard), o(A), h(G);
1554
+ const T = {
1555
+ title: v.name,
1556
+ description: v.description,
1557
+ frameObject: A,
1550
1558
  // Card title synced for single-card frames
1551
1559
  isPrivate: !1
1552
1560
  };
1553
- D.mutate(K);
1554
- } else if (b.saveToCurrentDashboard) {
1555
- const F = {
1556
- ...T,
1561
+ P.mutate(T);
1562
+ } else if (v.saveToCurrentDashboard) {
1563
+ const G = {
1564
+ ...A,
1557
1565
  // Card title already synced
1558
- id: Ht(),
1566
+ id: gt(),
1559
1567
  visualId: void 0
1560
1568
  // Explicitly no visualId for local visuals
1561
1569
  };
1562
1570
  try {
1563
- const K = await k(T, {
1564
- previousFrame: rt(m, T.id)
1571
+ const T = await V(A, {
1572
+ previousFrame: rt(m, A.id)
1565
1573
  });
1566
- y(p, F, {
1567
- semanticExecutionPayload: K
1568
- }), z.success("Visual saved to dashboard"), a(!1), C(!1);
1569
- } catch (K) {
1570
- console.error("Failed to save visual to dashboard:", K), z.error(
1571
- K instanceof Error ? K.message : "Failed to prepare semantic metadata for the visual"
1574
+ y(p, G, {
1575
+ semanticExecutionPayload: T,
1576
+ withEditorFieldChanges: !0
1577
+ }), z.success("Visual saved to dashboard"), a(!1), S(!1);
1578
+ } catch (T) {
1579
+ console.error("Failed to save visual to dashboard:", T), z.error(
1580
+ T instanceof Error ? T.message : "Failed to prepare semantic metadata for the visual"
1572
1581
  );
1573
1582
  }
1574
1583
  }
1575
1584
  },
1576
- isLibraryVisual: V,
1577
- currentVisualName: P,
1578
- isSaving: D.isPending
1585
+ isLibraryVisual: B,
1586
+ currentVisualName: D,
1587
+ isSaving: P.isPending
1579
1588
  };
1580
1589
  }
1581
1590
  function Qi(e = {}) {
1582
- const { isInspectionMode: a } = Za(), r = oe((B) => B.frame), n = oe((B) => B.editorContext), i = en((B) => B.selectedVisual), o = N((B) => B.selectedFrameId), l = N((B) => B.selectedSheetId), h = N((B) => B.dashboard), { setIsVisualEditing: d, updateFrame: c } = ve(), [u, p] = E(!1), [m, f] = E("both"), g = ct(), y = (n == null ? void 0 : n.type) === "documentSection", C = !!(r != null && r.visualId || i != null && i.id), k = !!(r != null && r.visualId && o), V = C && !k, {
1583
- saveAsDialogOpen: P,
1591
+ const { isInspectionMode: a } = Za(), r = oe((T) => T.frame), n = oe((T) => T.editorContext), i = en((T) => T.selectedVisual), o = C((T) => T.selectedFrameId), l = C((T) => T.selectedSheetId), h = C((T) => T.dashboard), { setIsVisualEditing: d, updateFrame: c } = ve(), [u, p] = E(!1), [m, f] = E("both"), g = ct(), y = (n == null ? void 0 : n.type) === "documentSection", w = !!(r != null && r.visualId || i != null && i.id), S = !!(r != null && r.visualId && o), V = w && !S, {
1592
+ saveAsDialogOpen: B,
1584
1593
  setSaveAsDialogOpen: D,
1585
- handleSaveAs: O,
1586
- isLibraryVisual: b,
1587
- currentVisualName: S,
1588
- isSaving: v
1589
- } = hs(), { getUpdatedFrame: T } = Be();
1594
+ handleSaveAs: P,
1595
+ isLibraryVisual: k,
1596
+ currentVisualName: v,
1597
+ isSaving: b
1598
+ } = hs(), { getUpdatedFrame: _ } = Be();
1590
1599
  if (a)
1591
- return /* @__PURE__ */ s(U, { children: [
1600
+ return /* @__PURE__ */ s($, { children: [
1592
1601
  /* @__PURE__ */ t(
1593
- gt,
1602
+ bt,
1594
1603
  {
1595
1604
  className: "rounded-control",
1596
1605
  variant: "default"
1597
1606
  }
1598
1607
  ),
1599
- /* @__PURE__ */ t(bt, {})
1608
+ /* @__PURE__ */ t(xt, {})
1600
1609
  ] });
1601
1610
  if (y)
1602
- return /* @__PURE__ */ s(U, { children: [
1603
- /* @__PURE__ */ t(gt, { className: "rounded-control", variant: "default" }),
1604
- /* @__PURE__ */ t(bt, {})
1611
+ return /* @__PURE__ */ s($, { children: [
1612
+ /* @__PURE__ */ t(bt, { className: "rounded-control", variant: "default" }),
1613
+ /* @__PURE__ */ t(xt, {})
1605
1614
  ] });
1606
- const F = async () => {
1615
+ const A = async () => {
1607
1616
  if (!l) {
1608
1617
  z.error("No sheet selected");
1609
1618
  return;
1610
1619
  }
1611
1620
  if (u) return;
1612
1621
  p(!0);
1613
- const Q = {
1614
- ...T(),
1622
+ const M = {
1623
+ ..._(),
1615
1624
  visualId: void 0
1616
- }, X = rt(h, Q.id);
1625
+ }, X = rt(h, M.id);
1617
1626
  try {
1618
- const _ = await g(Q, {
1627
+ const O = await g(M, {
1619
1628
  previousFrame: X
1620
1629
  });
1621
- c(l, Q, {
1622
- semanticExecutionPayload: _
1630
+ c(l, M, {
1631
+ semanticExecutionPayload: O
1623
1632
  });
1624
- } catch (_) {
1625
- console.error("Failed to apply local semantic metadata:", _), p(!1), z.error(
1626
- _ instanceof Error ? _.message : "Failed to prepare semantic metadata for this visual"
1633
+ } catch (O) {
1634
+ console.error("Failed to apply local semantic metadata:", O), p(!1), z.error(
1635
+ O instanceof Error ? O.message : "Failed to prepare semantic metadata for this visual"
1627
1636
  );
1628
1637
  return;
1629
1638
  }
1630
1639
  setTimeout(() => {
1631
1640
  p(!1), z.success("Changes applied. Visual is now local to this dashboard"), d(!1);
1632
1641
  }, 300);
1633
- }, K = (B) => {
1634
- f(B), D(!0);
1642
+ }, G = (T) => {
1643
+ f(T), D(!0);
1635
1644
  };
1636
- return /* @__PURE__ */ s(U, { children: [
1645
+ return /* @__PURE__ */ s($, { children: [
1637
1646
  /* @__PURE__ */ s("div", { className: "inline-flex items-center overflow-hidden rounded-control", children: [
1638
- !C && /* @__PURE__ */ t(gt, { className: "!rounded-none", variant: "default" }),
1639
- C && V && /* @__PURE__ */ t(ds, { className: "!rounded-none", variant: "default" }),
1640
- C && k && /* @__PURE__ */ t(cs, { className: "!rounded-none" }),
1647
+ !w && /* @__PURE__ */ t(bt, { className: "!rounded-none", variant: "default" }),
1648
+ w && V && /* @__PURE__ */ t(ds, { className: "!rounded-none", variant: "default" }),
1649
+ w && S && /* @__PURE__ */ t(cs, { className: "!rounded-none" }),
1641
1650
  /* @__PURE__ */ s(je, { modal: !1, children: [
1642
1651
  /* @__PURE__ */ t(qe, { asChild: !0, children: /* @__PURE__ */ t(
1643
1652
  L,
@@ -1646,8 +1655,8 @@ function Qi(e = {}) {
1646
1655
  size: "xs",
1647
1656
  className: "w-7 !rounded-none border-l border-primary-foreground/20 px-0",
1648
1657
  "aria-label": "Open visual save options",
1649
- disabled: v || u,
1650
- children: /* @__PURE__ */ t(_t, { className: "h-3.5 w-3.5" })
1658
+ disabled: b || u,
1659
+ children: /* @__PURE__ */ t(Ot, { className: "h-3.5 w-3.5" })
1651
1660
  }
1652
1661
  ) }),
1653
1662
  /* @__PURE__ */ s(
@@ -1656,14 +1665,14 @@ function Qi(e = {}) {
1656
1665
  align: "end",
1657
1666
  className: "min-w-[220px] rounded-control border border-border/60 p-1 shadow-sm",
1658
1667
  children: [
1659
- k && /* @__PURE__ */ s(U, { children: [
1668
+ S && /* @__PURE__ */ s($, { children: [
1660
1669
  /* @__PURE__ */ s(
1661
1670
  re,
1662
1671
  {
1663
- onClick: F,
1672
+ onClick: A,
1664
1673
  disabled: u,
1665
1674
  children: [
1666
- /* @__PURE__ */ t(Bt, { className: "h-3.5 w-3.5" }),
1675
+ /* @__PURE__ */ t(_t, { className: "h-3.5 w-3.5" }),
1667
1676
  u ? "Applying..." : "Apply Locally"
1668
1677
  ]
1669
1678
  }
@@ -1673,8 +1682,8 @@ function Qi(e = {}) {
1673
1682
  /* @__PURE__ */ s(
1674
1683
  re,
1675
1684
  {
1676
- onClick: () => K("local"),
1677
- disabled: v,
1685
+ onClick: () => G("local"),
1686
+ disabled: b,
1678
1687
  children: [
1679
1688
  /* @__PURE__ */ t(be, { className: "h-3.5 w-3.5" }),
1680
1689
  "Add to Dashboard (Local)"
@@ -1684,8 +1693,8 @@ function Qi(e = {}) {
1684
1693
  /* @__PURE__ */ s(
1685
1694
  re,
1686
1695
  {
1687
- onClick: () => K("library"),
1688
- disabled: v,
1696
+ onClick: () => G("library"),
1697
+ disabled: b,
1689
1698
  children: [
1690
1699
  /* @__PURE__ */ t(Dr, { className: "h-3.5 w-3.5" }),
1691
1700
  "Save as Library Visual"
@@ -1695,8 +1704,8 @@ function Qi(e = {}) {
1695
1704
  /* @__PURE__ */ s(
1696
1705
  re,
1697
1706
  {
1698
- onClick: () => K("both"),
1699
- disabled: v,
1707
+ onClick: () => G("both"),
1708
+ disabled: b,
1700
1709
  children: [
1701
1710
  /* @__PURE__ */ t(tn, { className: "h-3.5 w-3.5" }),
1702
1711
  "Save Copy as Linked Visual"
@@ -1708,25 +1717,25 @@ function Qi(e = {}) {
1708
1717
  )
1709
1718
  ] })
1710
1719
  ] }),
1711
- /* @__PURE__ */ t(bt, {}),
1720
+ /* @__PURE__ */ t(xt, {}),
1712
1721
  /* @__PURE__ */ t(
1713
1722
  us,
1714
1723
  {
1715
- open: P,
1716
- onOpenChange: (B) => {
1717
- v || D(B);
1724
+ open: B,
1725
+ onOpenChange: (T) => {
1726
+ b || D(T);
1718
1727
  },
1719
- isLibraryVisual: b,
1720
- currentVisualName: S,
1721
- isSaving: v,
1728
+ isLibraryVisual: k,
1729
+ currentVisualName: v,
1730
+ isSaving: b,
1722
1731
  destinationMode: m,
1723
- onConfirm: O
1732
+ onConfirm: P
1724
1733
  }
1725
1734
  )
1726
1735
  ] });
1727
1736
  }
1728
1737
  function Hi({ className: e }) {
1729
- const a = oe((u) => u.isDevMode), r = oe((u) => u.card.type), n = N((u) => u.isVisualEditing), { setIsDevMode: i } = dt(), { config: o } = Va(an).tokenProps, l = (o == null ? void 0 : o.showAdvancedMode) !== !1;
1738
+ const a = oe((u) => u.isDevMode), r = oe((u) => u.card.type), n = C((u) => u.isVisualEditing), { setIsDevMode: i } = dt(), { config: o } = Va(an).tokenProps, l = (o == null ? void 0 : o.showAdvancedMode) !== !1;
1730
1739
  if (!n || !l || !sr(r))
1731
1740
  return null;
1732
1741
  const h = a ? Kr : Hr, d = a ? "Visual editor" : "SQL editor", c = a ? "Switch to visual editor" : "Switch to SQL editor";
@@ -1749,11 +1758,11 @@ function Hi({ className: e }) {
1749
1758
  );
1750
1759
  }
1751
1760
  function Ki() {
1752
- const e = nn() === "sm", a = N((d) => d.isDashboardEditing), r = N((d) => d.isVisualEditing), n = N((d) => {
1761
+ const e = nn() === "sm", a = C((d) => d.isDashboardEditing), r = C((d) => d.isVisualEditing), n = C((d) => {
1753
1762
  var u;
1754
1763
  const c = ((u = d.dashboard) == null ? void 0 : u.sheets) ?? [];
1755
1764
  return c.find((p) => p.id === d.selectedSheetId) ?? c[0];
1756
- }), i = N((d) => d.actions.arrangeSheet), o = N((d) => d.actions.undoArrange);
1765
+ }), i = C((d) => d.actions.arrangeSheet), o = C((d) => d.actions.undoArrange);
1757
1766
  if (!a || r || !n || He(n)) return null;
1758
1767
  const l = !(n.frames ?? []).length, h = (d) => {
1759
1768
  const c = i(n.id, { keepOrder: d });
@@ -1800,7 +1809,7 @@ function Ki() {
1800
1809
  disabled: l,
1801
1810
  className: "h-full w-7 rounded-none border-0 border-l border-border/60 px-0 shadow-none hover:bg-accent",
1802
1811
  "aria-label": "Open arrange options",
1803
- children: /* @__PURE__ */ t(_t, { className: "h-3.5 w-3.5" })
1812
+ children: /* @__PURE__ */ t(Ot, { className: "h-3.5 w-3.5" })
1804
1813
  }
1805
1814
  ) }),
1806
1815
  /* @__PURE__ */ t(We, { align: "end", className: "z-[60] w-48 rounded-[6px] border-border/60 p-1 shadow-sm", children: /* @__PURE__ */ s(re, { onClick: () => h(!0), children: [
@@ -1811,11 +1820,11 @@ function Ki() {
1811
1820
  ] });
1812
1821
  }
1813
1822
  function Gi() {
1814
- const e = N((i) => i.screenSizesOpen), a = N((i) => {
1823
+ const e = C((i) => i.screenSizesOpen), a = C((i) => {
1815
1824
  var h, d;
1816
1825
  const o = ((h = i.dashboard) == null ? void 0 : h.sheets) ?? [], l = o.find((c) => c.id === i.selectedSheetId) ?? o[0];
1817
1826
  return !!l && !He(l) && !!((d = l.frames) != null && d.length);
1818
- }), r = N((i) => i.actions.setScreenSizesOpen), n = fa(
1827
+ }), r = C((i) => i.actions.setScreenSizesOpen), n = fa(
1819
1828
  "screen-sizes",
1820
1829
  "lg",
1821
1830
  a ? {
@@ -1842,7 +1851,7 @@ function Gi() {
1842
1851
  );
1843
1852
  }
1844
1853
  function Yi({ dashboardId: e }) {
1845
- const { openDashboardId: a, access: r, printMode: n, serverIsFavorite: i, fetchedAt: o } = N(
1854
+ const { openDashboardId: a, access: r, printMode: n, serverIsFavorite: i, fetchedAt: o } = C(
1846
1855
  rn((d) => {
1847
1856
  var c;
1848
1857
  return {
@@ -1889,14 +1898,14 @@ function Ji({
1889
1898
  discardLabel: d = "Discard changes",
1890
1899
  saveLabel: c = "Save"
1891
1900
  }) {
1892
- return /* @__PURE__ */ t(wt, { open: e, onOpenChange: (p) => {
1901
+ return /* @__PURE__ */ t(St, { open: e, onOpenChange: (p) => {
1893
1902
  !p && i || a(p);
1894
- }, children: /* @__PURE__ */ s(St, { children: [
1895
- /* @__PURE__ */ s(kt, { children: [
1896
- /* @__PURE__ */ t(Dt, { children: o }),
1897
- /* @__PURE__ */ t(At, { children: l })
1903
+ }, children: /* @__PURE__ */ s(kt, { children: [
1904
+ /* @__PURE__ */ s(Dt, { children: [
1905
+ /* @__PURE__ */ t(At, { children: o }),
1906
+ /* @__PURE__ */ t(Ft, { children: l })
1898
1907
  ] }),
1899
- /* @__PURE__ */ s(Ft, { children: [
1908
+ /* @__PURE__ */ s(Et, { children: [
1900
1909
  /* @__PURE__ */ t(
1901
1910
  L,
1902
1911
  {
@@ -1909,12 +1918,12 @@ function Ji({
1909
1918
  children: d
1910
1919
  }
1911
1920
  ),
1912
- r ? /* @__PURE__ */ t(Et, { disabled: i, children: h }) : (
1921
+ r ? /* @__PURE__ */ t(It, { disabled: i, children: h }) : (
1913
1922
  // Without Save, staying is the safe action: primary, and still
1914
1923
  // the dialog's Cancel so it takes the first focus, not Discard.
1915
1924
  /* @__PURE__ */ t(cn, { asChild: !0, children: /* @__PURE__ */ t(L, { type: "button", size: "xs", children: h }) })
1916
1925
  ),
1917
- r && /* @__PURE__ */ t(L, { type: "button", size: "xs", onClick: r, disabled: i, children: i ? /* @__PURE__ */ s(U, { children: [
1926
+ r && /* @__PURE__ */ t(L, { type: "button", size: "xs", onClick: r, disabled: i, children: i ? /* @__PURE__ */ s($, { children: [
1918
1927
  /* @__PURE__ */ t(de, { className: "mr-2 h-3.5 w-3.5 animate-spin" }),
1919
1928
  "Saving..."
1920
1929
  ] }) : c })
@@ -1923,7 +1932,7 @@ function Ji({
1923
1932
  }
1924
1933
  async function Zi(e) {
1925
1934
  var o, l;
1926
- const a = (l = (o = N.getState()) == null ? void 0 : o.authToken) == null ? void 0 : l.accessToken;
1935
+ const a = (l = (o = C.getState()) == null ? void 0 : o.authToken) == null ? void 0 : l.accessToken;
1927
1936
  if (!a)
1928
1937
  return;
1929
1938
  const r = `${e}/v1/invalidate-token`, n = await fetch(r, {
@@ -1950,14 +1959,14 @@ function ms(e) {
1950
1959
  a.totalRows !== null ? `${a.totalRows.toLocaleString("en-US")} rows` : null,
1951
1960
  a.fileSize ? gn(a.fileSize) : null
1952
1961
  ].filter((n) => !!n),
1953
- failure: ((r = a.failure) == null ? void 0 : r.kind) === "export" ? a.failure.message : a.status === "failed" ? Ce.failedFallback : null,
1962
+ failure: ((r = a.failure) == null ? void 0 : r.kind) === "export" ? a.failure.message : a.status === "failed" ? Ne.failedFallback : null,
1954
1963
  note: null
1955
1964
  } : {
1956
1965
  title: a.title,
1957
1966
  status: a.status,
1958
1967
  startedAt: a.startedAt,
1959
1968
  finishedAt: a.finishedAt,
1960
- running: { text: a.stageLabel ?? Ce.inProgress },
1969
+ running: { text: a.stageLabel ?? Ne.inProgress },
1961
1970
  finishedDetail: [],
1962
1971
  failure: null,
1963
1972
  note: a.omittedAttachmentCount > 0 ? ge.attachmentsLeftOut(a.omittedAttachmentCount) : null
@@ -2013,7 +2022,7 @@ function Ea({
2013
2022
  working: i,
2014
2023
  problem: o
2015
2024
  }) {
2016
- const l = e.status === "ready" ? "bg-emerald-500" : e.status === "failed" ? "bg-destructive" : e.status === "cancelled" ? "bg-muted-foreground/40" : "animate-pulse bg-muted-foreground/60", h = e.status === "ready" ? Ce.ready : e.status === "failed" ? Ce.failed : e.status === "cancelled" ? Ce.cancelled : Ce.inProgress, d = Date.parse(e.startedAt), c = Gt(Date.parse(e.finishedAt ?? e.startedAt), a, { addSuffix: !0 }), u = e.status === "running" && r && a - d >= mn, p = /* @__PURE__ */ t("span", { className: "text-muted-foreground/50", children: "·" });
2025
+ const l = e.status === "ready" ? "bg-emerald-500" : e.status === "failed" ? "bg-destructive" : e.status === "cancelled" ? "bg-muted-foreground/40" : "animate-pulse bg-muted-foreground/60", h = e.status === "ready" ? Ne.ready : e.status === "failed" ? Ne.failed : e.status === "cancelled" ? Ne.cancelled : Ne.inProgress, d = Date.parse(e.startedAt), c = Gt(Date.parse(e.finishedAt ?? e.startedAt), a, { addSuffix: !0 }), u = e.status === "running" && r && a - d >= mn, p = /* @__PURE__ */ t("span", { className: "text-muted-foreground/50", children: "·" });
2017
2026
  return /* @__PURE__ */ s("div", { className: "group flex items-start gap-2.5 px-3 py-2 transition-colors hover:bg-muted/40 focus-within:bg-muted/40", children: [
2018
2027
  /* @__PURE__ */ t("span", { className: "flex h-5 shrink-0 items-center", "aria-hidden": "true", children: /* @__PURE__ */ t("span", { className: `h-1.5 w-1.5 rounded-full ${l}` }) }),
2019
2028
  /* @__PURE__ */ t("span", { className: "sr-only", children: h }),
@@ -2033,7 +2042,7 @@ function Ea({
2033
2042
  ] }),
2034
2043
  e.status === "running" && e.running && /* @__PURE__ */ s("div", { className: "text-[12px] leading-4 text-muted-foreground", children: [
2035
2044
  /* @__PURE__ */ t("span", { className: "tabular-nums", children: e.running.text }),
2036
- e.running.detail && /* @__PURE__ */ s(U, { children: [
2045
+ e.running.detail && /* @__PURE__ */ s($, { children: [
2037
2046
  " ",
2038
2047
  p,
2039
2048
  " ",
@@ -2042,9 +2051,9 @@ function Ea({
2042
2051
  " ",
2043
2052
  p,
2044
2053
  " ",
2045
- /* @__PURE__ */ t("span", { children: Ce.started(Gt(d, a)) }),
2054
+ /* @__PURE__ */ t("span", { children: Ne.started(Gt(d, a)) }),
2046
2055
  e.running.percent !== void 0 && /* @__PURE__ */ t(pn, { value: e.running.percent, className: "mt-1.5 h-1" }),
2047
- u && /* @__PURE__ */ t("div", { className: "mt-1", children: Ce.longRunning })
2056
+ u && /* @__PURE__ */ t("div", { className: "mt-1", children: Ne.longRunning })
2048
2057
  ] }),
2049
2058
  e.status !== "running" && /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5 text-[12px] leading-4 text-muted-foreground", children: [
2050
2059
  e.status === "ready" && e.finishedDetail.length > 0 ? (
@@ -2056,7 +2065,7 @@ function Ea({
2056
2065
  ] }, f)),
2057
2066
  p
2058
2067
  ] })
2059
- ) : e.status !== "ready" ? /* @__PURE__ */ s(U, { children: [
2068
+ ) : e.status !== "ready" ? /* @__PURE__ */ s($, { children: [
2060
2069
  /* @__PURE__ */ t("span", { children: h }),
2061
2070
  p
2062
2071
  ] }) : null,
@@ -2069,7 +2078,7 @@ function Ea({
2069
2078
  ] });
2070
2079
  }
2071
2080
  function eo({ variant: e }) {
2072
- const { snapshot: a, markSeen: r } = Lt(), n = a.runningCount > 0 ? a.runningCount > 9 ? "9+" : String(a.runningCount) : a.hasUnseenFinished ? "" : null, i = fa("activity", "md", {
2081
+ const { snapshot: a, markSeen: r } = Vt(), n = a.runningCount > 0 ? a.runningCount > 9 ? "9+" : String(a.runningCount) : a.hasUnseenFinished ? "" : null, i = fa("activity", "md", {
2073
2082
  label: ge.title,
2074
2083
  icon: /* @__PURE__ */ t(ea, { className: "h-3.5 w-3.5" }),
2075
2084
  hint: n || (n === "" ? "New" : void 0),
@@ -2085,7 +2094,7 @@ function eo({ variant: e }) {
2085
2094
  },
2086
2095
  children: [
2087
2096
  i.anchorSlot && Tr(
2088
- /* @__PURE__ */ t(Na, { asChild: !0, children: /* @__PURE__ */ t("span", { className: "absolute right-0 top-0 h-7 w-px" }) }),
2097
+ /* @__PURE__ */ t(Ca, { asChild: !0, children: /* @__PURE__ */ t("span", { className: "absolute right-0 top-0 h-7 w-px" }) }),
2089
2098
  i.anchorSlot
2090
2099
  ),
2091
2100
  /* @__PURE__ */ t(
@@ -2127,7 +2136,7 @@ function eo({ variant: e }) {
2127
2136
  ] });
2128
2137
  }
2129
2138
  function ra() {
2130
- const e = Lt(), a = vn(), { rows: r, browserRows: n, activeTruncated: i } = e.snapshot, o = r.some((c) => ft(c.item.status)), l = [
2139
+ const e = Vt(), a = vn(), { rows: r, browserRows: n, activeTruncated: i } = e.snapshot, o = r.some((c) => ft(c.item.status)), l = [
2131
2140
  ...r.filter((c) => !ft(c.item.status)).map((c) => ({ startedAt: c.item.startedAt, row: c })),
2132
2141
  ...n.map((c) => ({ startedAt: c.startedAt, work: c }))
2133
2142
  ].sort((c, u) => u.startedAt.localeCompare(c.startedAt)), h = r.filter((c) => ft(c.item.status)), d = r.length + n.length;
@@ -2166,8 +2175,8 @@ function ra() {
2166
2175
  ] }),
2167
2176
  i && /* @__PURE__ */ t("p", { className: "border-b border-border px-3 py-2 text-[12px] leading-4 text-muted-foreground", children: ge.truncated }),
2168
2177
  /* @__PURE__ */ t("div", { className: "max-h-[320px] overflow-y-auto", children: /* @__PURE__ */ s("div", { className: "divide-y divide-border/70", children: [
2169
- l.map((c) => "work" in c ? /* @__PURE__ */ t(ps, { work: c.work, now: a }, c.work.id) : /* @__PURE__ */ t(na, { row: c.row, now: a, api: e }, $t(c.row))),
2170
- h.map((c) => /* @__PURE__ */ t(na, { row: c, now: a, api: e }, $t(c)))
2178
+ l.map((c) => "work" in c ? /* @__PURE__ */ t(ps, { work: c.work, now: a }, c.work.id) : /* @__PURE__ */ t(na, { row: c.row, now: a, api: e }, jt(c.row))),
2179
+ h.map((c) => /* @__PURE__ */ t(na, { row: c, now: a, api: e }, jt(c)))
2171
2180
  ] }) })
2172
2181
  ] });
2173
2182
  }
@@ -2205,44 +2214,44 @@ function gs({
2205
2214
  // create and make consumers use `forceClose()` from a dedicated
2206
2215
  // button.
2207
2216
  dismissMode: n ? "passive" : "explicit-only"
2208
- }), m = N((v) => v.dashboard), { setDashboardControlsModel: f } = ve(), { participants: g } = Nn(Vr(m)), y = Array.from(
2217
+ }), m = C((b) => b.dashboard), { setDashboardControlsModel: f } = ve(), { participants: g } = Cn(Vr(m)), y = Array.from(
2209
2218
  new Map(
2210
2219
  g.flatMap(
2211
- (v) => v.fieldChoices.map((T) => {
2212
- var F;
2220
+ (b) => b.fieldChoices.map((_) => {
2221
+ var A;
2213
2222
  return [
2214
- T.value,
2223
+ _.value,
2215
2224
  {
2216
- option: T,
2217
- target: (F = v.fieldTargetMap) == null ? void 0 : F[T.value]
2225
+ option: _,
2226
+ target: (A = b.fieldTargetMap) == null ? void 0 : A[_.value]
2218
2227
  }
2219
2228
  ];
2220
2229
  })
2221
2230
  )
2222
2231
  ).values()
2223
- ), C = Array.from(
2232
+ ), w = Array.from(
2224
2233
  new Map(
2225
2234
  g.flatMap(
2226
- (v) => v.metricChoices.map((T) => {
2227
- var F;
2235
+ (b) => b.metricChoices.map((_) => {
2236
+ var A;
2228
2237
  return [
2229
- T.value,
2238
+ _.value,
2230
2239
  {
2231
- option: T,
2232
- target: (F = v.metricTargetMap) == null ? void 0 : F[T.value]
2240
+ option: _,
2241
+ target: (A = b.metricTargetMap) == null ? void 0 : A[_.value]
2233
2242
  }
2234
2243
  ];
2235
2244
  })
2236
2245
  )
2237
2246
  ).values()
2238
- ), k = ir({
2247
+ ), S = ir({
2239
2248
  ...m || {},
2240
2249
  controls: []
2241
- }), V = Cn(m), P = (v, T, F) => {
2250
+ }), V = Nn(m), B = (b, _, A) => {
2242
2251
  f(
2243
- v,
2244
- T,
2245
- fs(F)
2252
+ b,
2253
+ _,
2254
+ fs(A)
2246
2255
  );
2247
2256
  }, D = ie(() => {
2248
2257
  if (o) {
@@ -2250,34 +2259,34 @@ function gs({
2250
2259
  return;
2251
2260
  }
2252
2261
  p(!1);
2253
- }, [o, l, p]), O = /* @__PURE__ */ t(
2262
+ }, [o, l, p]), P = /* @__PURE__ */ t(
2254
2263
  ka,
2255
2264
  {
2256
2265
  scope: "dashboard",
2257
2266
  controls: m.controls || [],
2258
- reservedControlIds: k,
2267
+ reservedControlIds: S,
2259
2268
  defaultValues: m.defaultControlValues || {},
2260
2269
  usageByControlId: wn(m),
2261
2270
  availableFieldChoices: y,
2262
- availableMetricChoices: C,
2271
+ availableMetricChoices: w,
2263
2272
  structuralParticipants: g,
2264
2273
  structuralParticipantIdsByControlId: V,
2265
2274
  initialCreateFlow: i === "create",
2266
2275
  onCreateFlowActiveChange: p,
2267
2276
  onCreateFlowComplete: D,
2268
- onChange: P,
2277
+ onChange: B,
2269
2278
  emptyMessage: "No dashboard controls yet."
2270
2279
  }
2271
- ), b = d ? "Add dashboard control" : "Dashboard Controls", S = /* @__PURE__ */ s(U, { children: [
2280
+ ), k = d ? "Add dashboard control" : "Dashboard Controls", v = /* @__PURE__ */ s($, { children: [
2272
2281
  /* @__PURE__ */ s("div", { className: "space-y-1", children: [
2273
2282
  /* @__PURE__ */ t("h4", { className: "text-sm font-medium", children: "Dashboard Controls" }),
2274
2283
  /* @__PURE__ */ t("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." })
2275
2284
  ] }),
2276
- O
2285
+ P
2277
2286
  ] });
2278
2287
  return n ? /* @__PURE__ */ s(Ie, { open: u, onOpenChange: h, children: [
2279
2288
  /* @__PURE__ */ t(nt, { asChild: !0, children: r || /* @__PURE__ */ s(L, { variant: "outline", className: "h-7 px-2", size: "sm", children: [
2280
- /* @__PURE__ */ t(Ca, { className: "mr-2 h-4 w-4" }),
2289
+ /* @__PURE__ */ t(Na, { className: "mr-2 h-4 w-4" }),
2281
2290
  "Controls"
2282
2291
  ] }) }),
2283
2292
  /* @__PURE__ */ t(
@@ -2287,7 +2296,7 @@ function gs({
2287
2296
  align: "end",
2288
2297
  onEscapeKeyDown: c,
2289
2298
  onPointerDownOutside: c,
2290
- children: S
2299
+ children: v
2291
2300
  }
2292
2301
  )
2293
2302
  ] }) : /* @__PURE__ */ t(Le, { open: u, onOpenChange: h, children: /* @__PURE__ */ s(
@@ -2298,11 +2307,11 @@ function gs({
2298
2307
  onPointerDownOutside: c,
2299
2308
  children: [
2300
2309
  /* @__PURE__ */ s(
2301
- Tt,
2310
+ Lt,
2302
2311
  {
2303
2312
  className: d ? "space-y-0" : void 0,
2304
2313
  children: [
2305
- /* @__PURE__ */ t(Pe, { className: "text-[15px]", children: b }),
2314
+ /* @__PURE__ */ t(Pe, { className: "text-[15px]", children: k }),
2306
2315
  /* @__PURE__ */ t(
2307
2316
  ut,
2308
2317
  {
@@ -2313,7 +2322,7 @@ function gs({
2313
2322
  ]
2314
2323
  }
2315
2324
  ),
2316
- /* @__PURE__ */ t("div", { className: "min-h-0 overflow-y-auto pr-1", children: O })
2325
+ /* @__PURE__ */ t("div", { className: "min-h-0 overflow-y-auto pr-1", children: P })
2317
2326
  ]
2318
2327
  }
2319
2328
  ) });
@@ -2331,7 +2340,7 @@ function xs({
2331
2340
  onOpenChange: a,
2332
2341
  initialMode: r = "manage"
2333
2342
  }) {
2334
- var S;
2343
+ var v;
2335
2344
  const n = r === "create", {
2336
2345
  forceClose: i,
2337
2346
  handleOpenChange: o,
@@ -2344,26 +2353,26 @@ function xs({
2344
2353
  onOpenChange: a,
2345
2354
  initialCreateFlowActive: r === "create",
2346
2355
  dismissMode: "explicit-only"
2347
- }), u = N((v) => v.dashboard), p = N((v) => v.selectedSheetId), { setDashboardInputs: m } = ve(), f = (S = u.sheets) == null ? void 0 : S.find(
2348
- (v) => v.id === p
2356
+ }), u = C((b) => b.dashboard), p = C((b) => b.selectedSheetId), { setDashboardInputs: m } = ve(), f = (v = u.sheets) == null ? void 0 : v.find(
2357
+ (b) => b.id === p
2349
2358
  ), g = (f == null ? void 0 : f.kind) === "document" && !!f.document, y = Y(
2350
2359
  () => g && (f != null && f.document) ? or(u, f.id) : [],
2351
2360
  [u, g, f == null ? void 0 : f.document, f == null ? void 0 : f.id]
2352
- ), C = Y(
2361
+ ), w = Y(
2353
2362
  () => y.filter(
2354
- (v) => v.kind === "control"
2363
+ (b) => b.kind === "control"
2355
2364
  ),
2356
2365
  [y]
2357
- ), k = Y(
2358
- () => C.map((v) => v.control),
2359
- [C]
2366
+ ), S = Y(
2367
+ () => w.map((b) => b.control),
2368
+ [w]
2360
2369
  ), V = Y(
2361
- () => ys(k),
2362
- [k]
2363
- ), P = Y(
2370
+ () => ys(S),
2371
+ [S]
2372
+ ), B = Y(
2364
2373
  () => [
2365
2374
  ...vs(u),
2366
- ...(u.variables ?? []).map((v) => v.name)
2375
+ ...(u.variables ?? []).map((b) => b.name)
2367
2376
  ],
2368
2377
  [u]
2369
2378
  ), D = ie(() => {
@@ -2372,16 +2381,16 @@ function xs({
2372
2381
  return;
2373
2382
  }
2374
2383
  c(!1);
2375
- }, [n, i, c]), O = ie(
2376
- (v, T, F) => {
2384
+ }, [n, i, c]), P = ie(
2385
+ (b, _, A) => {
2377
2386
  !g || !(f != null && f.document) || m(
2378
- Cs({
2387
+ Ns({
2379
2388
  dashboard: u,
2380
2389
  documentSheetId: f.id,
2381
2390
  currentDocumentInputs: y,
2382
- nextControls: v,
2383
- nextDefaultValues: T,
2384
- change: F
2391
+ nextControls: b,
2392
+ nextDefaultValues: _,
2393
+ change: A
2385
2394
  })
2386
2395
  );
2387
2396
  },
@@ -2400,7 +2409,7 @@ function xs({
2400
2409
  onEscapeKeyDown: h,
2401
2410
  onPointerDownOutside: h,
2402
2411
  children: [
2403
- /* @__PURE__ */ s(Tt, { className: l ? "space-y-0" : void 0, children: [
2412
+ /* @__PURE__ */ s(Lt, { className: l ? "space-y-0" : void 0, children: [
2404
2413
  /* @__PURE__ */ t(Pe, { className: "text-[15px]", children: l ? "Add document control" : "Document Controls" }),
2405
2414
  /* @__PURE__ */ t(
2406
2415
  ut,
@@ -2414,8 +2423,8 @@ function xs({
2414
2423
  ka,
2415
2424
  {
2416
2425
  scope: "dashboard",
2417
- controls: k,
2418
- reservedControlIds: P,
2426
+ controls: S,
2427
+ reservedControlIds: B,
2419
2428
  defaultValues: V,
2420
2429
  usageByControlId: {},
2421
2430
  availableFieldChoices: [],
@@ -2426,7 +2435,7 @@ function xs({
2426
2435
  initialCreateFlow: r === "create",
2427
2436
  onCreateFlowActiveChange: c,
2428
2437
  onCreateFlowComplete: D,
2429
- onChange: O,
2438
+ onChange: P,
2430
2439
  emptyMessage: "No document controls yet."
2431
2440
  }
2432
2441
  ) })
@@ -2443,13 +2452,13 @@ function ys(e) {
2443
2452
  r.defaultValue !== void 0 && (a[r.id] = r.defaultValue);
2444
2453
  return a;
2445
2454
  }
2446
- function Ns(e, a) {
2455
+ function Cs(e, a) {
2447
2456
  return a ? Object.prototype.hasOwnProperty.call(a, e.id) ? {
2448
2457
  ...e,
2449
2458
  defaultValue: a[e.id]
2450
2459
  } : e.defaultValue === void 0 ? e : { ...e, defaultValue: void 0 } : e.defaultValue === void 0 ? e : { ...e, defaultValue: void 0 };
2451
2460
  }
2452
- function Cs({
2461
+ function Ns({
2453
2462
  dashboard: e,
2454
2463
  documentSheetId: a,
2455
2464
  currentDocumentInputs: r,
@@ -2460,7 +2469,7 @@ function Cs({
2460
2469
  const l = new Map(
2461
2470
  n.map((f) => [
2462
2471
  f.id,
2463
- Ns(f, i)
2472
+ Cs(f, i)
2464
2473
  ])
2465
2474
  ), h = (o == null ? void 0 : o.type) === "rename" ? { oldId: o.oldId, newId: o.newId } : null, d = /* @__PURE__ */ new Set(), c = [];
2466
2475
  for (const f of r) {
@@ -2476,13 +2485,13 @@ function Cs({
2476
2485
  e,
2477
2486
  { name: g.id },
2478
2487
  { exclude: { source: "input", inputId: f.id }, alsoTaken: c }
2479
- ), C = g.id === y ? g : { ...g, id: y };
2488
+ ), w = g.id === y ? g : { ...g, id: y };
2480
2489
  c.push({
2481
2490
  ...f,
2482
- label: C.label,
2491
+ label: w.label,
2483
2492
  variableName: y,
2484
- requiredAtExecution: C.requiredAtExecution,
2485
- control: C
2493
+ requiredAtExecution: w.requiredAtExecution,
2494
+ control: w
2486
2495
  });
2487
2496
  }
2488
2497
  for (const f of l.values())
@@ -2567,7 +2576,7 @@ function ws({
2567
2576
  h
2568
2577
  ),
2569
2578
  "aria-label": "Filter and control actions",
2570
- children: /* @__PURE__ */ t(_t, { className: "h-3.5 w-3.5" })
2579
+ children: /* @__PURE__ */ t(Ot, { className: "h-3.5 w-3.5" })
2571
2580
  }
2572
2581
  ) }),
2573
2582
  /* @__PURE__ */ t(
@@ -2590,7 +2599,7 @@ function ws({
2590
2599
  }
2591
2600
  function Ss() {
2592
2601
  Fr();
2593
- const e = N((d) => d.selectedSheetId), a = N((d) => d.selectedFrameId), r = N((d) => d.dashboard), n = N((d) => d.actions.getSelectedFrame), { setSelectedFrameId: i } = ve(), { setCard: o } = dt(), l = oe((d) => d.card.dataSource);
2602
+ const e = C((d) => d.selectedSheetId), a = C((d) => d.selectedFrameId), r = C((d) => d.dashboard), n = C((d) => d.actions.getSelectedFrame), { setSelectedFrameId: i } = ve(), { setCard: o } = dt(), l = oe((d) => d.card.dataSource);
2594
2603
  return Ee(() => {
2595
2604
  var c, u;
2596
2605
  let d = n();
@@ -2607,9 +2616,9 @@ function Ss() {
2607
2616
  };
2608
2617
  }
2609
2618
  function ks() {
2610
- const e = N((d) => d.dashboard), a = N(
2619
+ const e = C((d) => d.dashboard), a = C(
2611
2620
  (d) => d.semanticExecutionPayload
2612
- ), r = N(
2621
+ ), r = C(
2613
2622
  (d) => d.actions.addFilterInput
2614
2623
  ), { hasEntities: n } = Ss(), { isLoading: i } = Sn(), o = Y(
2615
2624
  () => cr(e, a),
@@ -2649,13 +2658,13 @@ function Ds({
2649
2658
  onManageControls: r,
2650
2659
  onDismiss: n
2651
2660
  }) {
2652
- const i = N(
2661
+ const i = C(
2653
2662
  (h) => h.dashboard.filterLayout
2654
2663
  ), { setFilterLayout: o } = ve(), l = (i == null ? void 0 : i.toolbarWrap) ?? !1;
2655
2664
  return /* @__PURE__ */ s("div", { className: "w-[300px]", children: [
2656
2665
  /* @__PURE__ */ s("div", { className: "p-1", children: [
2657
2666
  /* @__PURE__ */ t(
2658
- xt,
2667
+ vt,
2659
2668
  {
2660
2669
  icon: xa,
2661
2670
  label: "Add filter",
@@ -2665,9 +2674,9 @@ function Ds({
2665
2674
  }
2666
2675
  ),
2667
2676
  /* @__PURE__ */ t(
2668
- xt,
2677
+ vt,
2669
2678
  {
2670
- icon: Ca,
2679
+ icon: Na,
2671
2680
  label: "Add control",
2672
2681
  onClick: () => {
2673
2682
  a(), n();
@@ -2675,9 +2684,9 @@ function Ds({
2675
2684
  }
2676
2685
  ),
2677
2686
  /* @__PURE__ */ t(
2678
- xt,
2687
+ vt,
2679
2688
  {
2680
- icon: Vt,
2689
+ icon: Pt,
2681
2690
  label: "Manage controls",
2682
2691
  onClick: () => {
2683
2692
  r(), n();
@@ -2700,7 +2709,7 @@ function Ds({
2700
2709
  ] })
2701
2710
  ] });
2702
2711
  }
2703
- function xt({
2712
+ function vt({
2704
2713
  icon: e,
2705
2714
  label: a,
2706
2715
  onClick: r
@@ -2725,7 +2734,7 @@ function As({
2725
2734
  onCheckedChange: n
2726
2735
  }) {
2727
2736
  return /* @__PURE__ */ s("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: [
2728
- /* @__PURE__ */ t(It, { id: e, checked: r, onCheckedChange: n }),
2737
+ /* @__PURE__ */ t(Tt, { id: e, checked: r, onCheckedChange: n }),
2729
2738
  /* @__PURE__ */ t(
2730
2739
  Me,
2731
2740
  {
@@ -2744,23 +2753,23 @@ function to({
2744
2753
  pickerContentClassName: i,
2745
2754
  settingsContentClassName: o
2746
2755
  }) {
2747
- var O;
2748
- const [l, h] = E(null), d = N((b) => b.dashboard), c = N((b) => b.selectedSheetId), u = N((b) => b.showFilters), p = N((b) => b.actions), { setDocumentPanelTarget: m, setShowFilters: f } = p, g = (O = d.sheets) == null ? void 0 : O.find(
2749
- (b) => b.id === c
2750
- ), y = He(g), C = ie((b) => {
2756
+ var P;
2757
+ const [l, h] = E(null), d = C((k) => k.dashboard), c = C((k) => k.selectedSheetId), u = C((k) => k.showFilters), p = C((k) => k.actions), { setDocumentPanelTarget: m, setShowFilters: f } = p, g = (P = d.sheets) == null ? void 0 : P.find(
2758
+ (k) => k.id === c
2759
+ ), y = He(g), w = ie((k) => {
2751
2760
  window.setTimeout(() => {
2752
- h(b);
2761
+ h(k);
2753
2762
  }, 0);
2754
- }, []), k = ie(
2755
- (b) => {
2763
+ }, []), S = ie(
2764
+ (k) => {
2756
2765
  if (y && c) {
2757
- b && m(c, {
2766
+ k && m(c, {
2758
2767
  kind: "document",
2759
2768
  group: "inputs"
2760
2769
  });
2761
2770
  return;
2762
2771
  }
2763
- f(b);
2772
+ f(k);
2764
2773
  },
2765
2774
  [
2766
2775
  y,
@@ -2769,26 +2778,26 @@ function to({
2769
2778
  f
2770
2779
  ]
2771
2780
  ), V = ie(() => {
2772
- k(!0);
2773
- }, [k]), P = ie(() => {
2774
- C("create");
2775
- }, [C]), D = ie(() => {
2776
- C("manage");
2777
- }, [C]);
2778
- return /* @__PURE__ */ s(U, { children: [
2781
+ S(!0);
2782
+ }, [S]), B = ie(() => {
2783
+ w("create");
2784
+ }, [w]), D = ie(() => {
2785
+ w("manage");
2786
+ }, [w]);
2787
+ return /* @__PURE__ */ s($, { children: [
2779
2788
  /* @__PURE__ */ t(
2780
2789
  ws,
2781
2790
  {
2782
2791
  showFilters: y ? !1 : u,
2783
- onShowFiltersChange: k,
2792
+ onShowFiltersChange: S,
2784
2793
  pickerContent: /* @__PURE__ */ t(ks, {}),
2785
- settingsContent: (b) => /* @__PURE__ */ t(
2794
+ settingsContent: (k) => /* @__PURE__ */ t(
2786
2795
  Ds,
2787
2796
  {
2788
2797
  onAddFilter: V,
2789
- onAddControl: P,
2798
+ onAddControl: B,
2790
2799
  onManageControls: D,
2791
- onDismiss: b
2800
+ onDismiss: k
2792
2801
  }
2793
2802
  ),
2794
2803
  size: e,
@@ -2803,8 +2812,8 @@ function to({
2803
2812
  xs,
2804
2813
  {
2805
2814
  open: !0,
2806
- onOpenChange: (b) => {
2807
- b || h(null);
2815
+ onOpenChange: (k) => {
2816
+ k || h(null);
2808
2817
  },
2809
2818
  initialMode: l
2810
2819
  }
@@ -2812,8 +2821,8 @@ function to({
2812
2821
  gs,
2813
2822
  {
2814
2823
  open: !0,
2815
- onOpenChange: (b) => {
2816
- b || h(null);
2824
+ onOpenChange: (k) => {
2825
+ k || h(null);
2817
2826
  },
2818
2827
  showTrigger: !1,
2819
2828
  initialMode: l
@@ -2858,7 +2867,7 @@ function Is({
2858
2867
  " New variable"
2859
2868
  ] }) : null
2860
2869
  ] }),
2861
- h.length ? /* @__PURE__ */ s(U, { children: [
2870
+ h.length ? /* @__PURE__ */ s($, { children: [
2862
2871
  /* @__PURE__ */ t("div", { className: "px-3 py-2", children: /* @__PURE__ */ s("div", { className: "flex h-7 items-center gap-1.5 rounded-control border border-border px-2 text-[12px] text-muted-foreground", children: [
2863
2872
  /* @__PURE__ */ t(da, { className: "h-3.5 w-3.5 shrink-0", "aria-hidden": !0 }),
2864
2873
  /* @__PURE__ */ t(
@@ -2916,19 +2925,19 @@ function ia({
2916
2925
  );
2917
2926
  }
2918
2927
  function ao() {
2919
- const e = N((r) => {
2928
+ const e = C((r) => {
2920
2929
  var n;
2921
2930
  return ((n = r.dashboard.variables) == null ? void 0 : n.length) ?? 0;
2922
- }), a = N((r) => r.actions.setVariablesListOpen);
2931
+ }), a = C((r) => r.actions.setVariablesListOpen);
2923
2932
  return { label: "Data variables", count: e, open: () => a(!0) };
2924
2933
  }
2925
2934
  function no() {
2926
2935
  var d;
2927
- const e = N((c) => c.variablesListOpen), a = N((c) => c.actions.setVariablesListOpen), r = N((c) => c.dashboard), n = N((c) => c.selectedSheetId), i = N((c) => c.actions.openVariableEditor), o = it("interactive"), l = (d = r.sheets) == null ? void 0 : d.find((c) => c.id === n), h = (c) => {
2936
+ const e = C((c) => c.variablesListOpen), a = C((c) => c.actions.setVariablesListOpen), r = C((c) => c.dashboard), n = C((c) => c.selectedSheetId), i = C((c) => c.actions.openVariableEditor), o = it("interactive"), l = (d = r.sheets) == null ? void 0 : d.find((c) => c.id === n), h = (c) => {
2928
2937
  a(!1), i(c);
2929
2938
  };
2930
2939
  return /* @__PURE__ */ s(Ie, { open: e, onOpenChange: a, children: [
2931
- /* @__PURE__ */ t(Na, { asChild: !0, children: /* @__PURE__ */ t("span", { "aria-hidden": !0, className: "pointer-events-none inline-block h-7 w-0 self-center" }) }),
2940
+ /* @__PURE__ */ t(Ca, { asChild: !0, children: /* @__PURE__ */ t("span", { "aria-hidden": !0, className: "pointer-events-none inline-block h-7 w-0 self-center" }) }),
2932
2941
  /* @__PURE__ */ t(
2933
2942
  Te,
2934
2943
  {
@@ -2963,7 +2972,7 @@ function Ts(e, a) {
2963
2972
  ).size > 1;
2964
2973
  }
2965
2974
  const Ls = [];
2966
- function vt(e) {
2975
+ function yt(e) {
2967
2976
  return Object.fromEntries(
2968
2977
  Object.entries(e).filter(([, a]) => a != null)
2969
2978
  );
@@ -2985,7 +2994,7 @@ function Ps(e, a) {
2985
2994
  ).columns;
2986
2995
  }
2987
2996
  function Bs(e) {
2988
- const { tokenProps: a } = $e(), r = N((m) => m.authToken), { connections: n } = va(), i = e == null ? void 0 : e.connectionId, o = n.find((m) => m.id === i), l = Y(
2997
+ const { tokenProps: a } = $e(), r = C((m) => m.authToken), { connections: n } = va(), i = e == null ? void 0 : e.connectionId, o = n.find((m) => m.id === i), l = Y(
2989
2998
  () => ((e == null ? void 0 : e.selectedEntities) ?? []).filter(Vs),
2990
2999
  [e == null ? void 0 : e.selectedEntities]
2991
3000
  ), h = (m) => {
@@ -3003,12 +3012,12 @@ function Bs(e) {
3003
3012
  var g, y;
3004
3013
  const f = Ps(
3005
3014
  l,
3006
- m.map((C) => C.data)
3015
+ m.map((w) => w.data)
3007
3016
  );
3008
3017
  return {
3009
3018
  fields: f.length ? f : Ls,
3010
- isLoading: m.some((C) => C.isLoading),
3011
- error: (y = (g = m.find((C) => C.error)) == null ? void 0 : g.error) == null ? void 0 : y.message
3019
+ isLoading: m.some((w) => w.isLoading),
3020
+ error: (y = (g = m.find((w) => w.error)) == null ? void 0 : g.error) == null ? void 0 : y.message
3012
3021
  };
3013
3022
  },
3014
3023
  [l]
@@ -3018,20 +3027,20 @@ function Bs(e) {
3018
3027
  queryFn: () => pr(
3019
3028
  `${a.apiServiceUrl}/v1/columns`,
3020
3029
  (r == null ? void 0 : r.accessToken) || "",
3021
- m.type === "model" ? vt({
3030
+ m.type === "model" ? yt({
3022
3031
  connection_id: i,
3023
3032
  datamodel_id: m.id,
3024
3033
  database_name: "",
3025
3034
  schema_name: "",
3026
3035
  table_name: ""
3027
- }) : m.type === "dataset" ? vt({
3036
+ }) : m.type === "dataset" ? yt({
3028
3037
  connection_id: m.connectionId ?? i,
3029
3038
  domain_id: m.domainId,
3030
3039
  dataset_name: m.name,
3031
3040
  database_name: m.database,
3032
3041
  schema_name: m.schema,
3033
3042
  table_name: m.table
3034
- }) : vt({
3043
+ }) : yt({
3035
3044
  connection_id: i,
3036
3045
  datamodel_id: "",
3037
3046
  database_name: m.database,
@@ -3054,7 +3063,7 @@ function _s(e) {
3054
3063
  function Os(e) {
3055
3064
  return e.mode === "period" ? br(e.spec) : void 0;
3056
3065
  }
3057
- const Mt = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", zs = {
3066
+ const Ut = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", zs = {
3058
3067
  connectionId: "",
3059
3068
  connectionType: "",
3060
3069
  mode: "semanticDomain",
@@ -3069,14 +3078,14 @@ function se({
3069
3078
  }) {
3070
3079
  return /* @__PURE__ */ s("div", { className: i, children: [
3071
3080
  /* @__PURE__ */ s("div", { className: "mb-1 flex min-h-5 items-center justify-between gap-2", children: [
3072
- /* @__PURE__ */ t("p", { className: Mt, children: e }),
3081
+ /* @__PURE__ */ t("p", { className: Ut, children: e }),
3073
3082
  r
3074
3083
  ] }),
3075
3084
  n,
3076
3085
  a ? /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] leading-4 text-muted-foreground", children: a }) : null
3077
3086
  ] });
3078
3087
  }
3079
- function yt({
3088
+ function Ct({
3080
3089
  muted: e,
3081
3090
  onClick: a,
3082
3091
  children: r,
@@ -3103,7 +3112,7 @@ function Rs(e) {
3103
3112
  return a.label || a.name;
3104
3113
  }
3105
3114
  function Ms(e) {
3106
- const a = Ot(e);
3115
+ const a = zt(e);
3107
3116
  return a === "date" ? "date" : a === "string" ? "text" : a === "number" ? "number" : a === "boolean" ? "yes/no" : a;
3108
3117
  }
3109
3118
  const oa = "__new_calculated_field__";
@@ -3113,28 +3122,28 @@ function Us({
3113
3122
  handle: r,
3114
3123
  onCalculatedFieldOpenChange: n
3115
3124
  }) {
3116
- var _, te, Z, G, I, ae, j, R, ne, ue, he, ye;
3117
- const { tokenProps: i } = $e(), o = ((_ = i.config) == null ? void 0 : _.showAdvancedMode) !== !1, l = ((te = i.config) == null ? void 0 : te.showDirectSource) !== !1, { connections: h } = va(), [d, c] = E(!1), [u, p] = E(!1), [m, f] = E(!1), g = (x) => {
3125
+ var O, te, Z, K, I, ae, q, R, ne, ue, he, ye;
3126
+ const { tokenProps: i } = $e(), o = ((O = i.config) == null ? void 0 : O.showAdvancedMode) !== !1, l = ((te = i.config) == null ? void 0 : te.showDirectSource) !== !1, { connections: h } = va(), [d, c] = E(!1), [u, p] = E(!1), [m, f] = E(!1), g = (x) => {
3118
3127
  p(x), n == null || n(x);
3119
- }, { fields: y, isLoading: C, error: k } = Bs(e.mode === "data" ? e.dataSource : void 0), V = [...e.calculatedFields ?? [], ...y], P = (x) => x && (V.find((M) => M.id === x.id) ?? V.find((M) => $s(M, x))), D = [
3128
+ }, { fields: y, isLoading: w, error: S } = Bs(e.mode === "data" ? e.dataSource : void 0), V = [...e.calculatedFields ?? [], ...y], B = (x) => x && (V.find((U) => U.id === x.id) ?? V.find((U) => $s(U, x))), D = [
3120
3129
  ...V,
3121
3130
  ...[e.field, e.sortField].filter(
3122
- (x) => !!x && !P(x) && !V.some((M) => M.id === x.id)
3131
+ (x) => !!x && !B(x) && !V.some((U) => U.id === x.id)
3123
3132
  )
3124
- ], O = ((Z = P(e.field)) == null ? void 0 : Z.id) ?? ((G = e.field) == null ? void 0 : G.id) ?? "", b = ((I = P(e.sortField ?? e.field)) == null ? void 0 : I.id) ?? ((ae = e.sortField ?? e.field) == null ? void 0 : ae.id) ?? "", S = (x) => a({ ...e, ...x }), v = Rs(e.dataSource), T = ((j = e.dataSource) == null ? void 0 : j.mode) === "database" ? Pt : jt, F = "mt-1 inline-flex items-center gap-1 text-[11px] font-medium text-muted-foreground underline-offset-2 hover:text-foreground hover:underline", K = {
3133
+ ], P = ((Z = B(e.field)) == null ? void 0 : Z.id) ?? ((K = e.field) == null ? void 0 : K.id) ?? "", k = ((I = B(e.sortField ?? e.field)) == null ? void 0 : I.id) ?? ((ae = e.sortField ?? e.field) == null ? void 0 : ae.id) ?? "", v = (x) => a({ ...e, ...x }), b = Rs(e.dataSource), _ = ((q = e.dataSource) == null ? void 0 : q.mode) === "database" ? Bt : qt, A = "mt-1 inline-flex items-center gap-1 text-[11px] font-medium text-muted-foreground underline-offset-2 hover:text-foreground hover:underline", G = {
3125
3134
  connectionId: ((R = e.dataSource) == null ? void 0 : R.connectionId) || e.connectionId,
3126
3135
  dataSource: e.dataSource,
3127
3136
  config: e.conditions ? { filters: e.conditions } : {},
3128
3137
  cardType: "text"
3129
- }, B = Yt(e.field), Q = (ne = B.find((x) => x.value === e.get)) == null ? void 0 : ne.hint, X = (x) => {
3138
+ }, T = Yt(e.field), M = (ne = T.find((x) => x.value === e.get)) == null ? void 0 : ne.hint, X = (x) => {
3130
3139
  if (x === oa) {
3131
3140
  g(!0);
3132
3141
  return;
3133
3142
  }
3134
- const M = D.find((H) => H.id === x);
3135
- if (!M) return;
3136
- const $ = Yt(M).some((H) => H.value === e.get) && e.field !== void 0;
3137
- S({ field: M, get: $ ? e.get : Xt(M) });
3143
+ const U = D.find((H) => H.id === x);
3144
+ if (!U) return;
3145
+ const j = Yt(U).some((H) => H.value === e.get) && e.field !== void 0;
3146
+ v({ field: U, get: j ? e.get : Xt(U) });
3138
3147
  };
3139
3148
  return u ? /* @__PURE__ */ t(
3140
3149
  En,
@@ -3144,50 +3153,50 @@ function Us({
3144
3153
  onOpenChange: g,
3145
3154
  availableFields: D,
3146
3155
  cardId: e.id,
3147
- source: K,
3156
+ source: G,
3148
3157
  onSave: (x) => {
3149
- const M = { ...x, fieldScope: x.fieldScope ?? "card" };
3150
- S({
3151
- calculatedFields: [...(e.calculatedFields ?? []).filter(($) => $.id !== M.id), M],
3152
- field: M,
3153
- get: Xt(M)
3158
+ const U = { ...x, fieldScope: x.fieldScope ?? "card" };
3159
+ v({
3160
+ calculatedFields: [...(e.calculatedFields ?? []).filter((j) => j.id !== U.id), U],
3161
+ field: U,
3162
+ get: Xt(U)
3154
3163
  }), g(!1);
3155
3164
  }
3156
3165
  }
3157
- ) : /* @__PURE__ */ s(U, { children: [
3166
+ ) : /* @__PURE__ */ s($, { children: [
3158
3167
  /* @__PURE__ */ t(
3159
3168
  se,
3160
3169
  {
3161
3170
  label: "Name",
3162
- aside: /* @__PURE__ */ t(qs, { value: e.name, placeholder: r, editing: m, onEditing: f, onChange: (x) => S({ name: x }) }),
3171
+ aside: /* @__PURE__ */ t(qs, { value: e.name, placeholder: r, editing: m, onEditing: f, onChange: (x) => v({ name: x }) }),
3163
3172
  hint: m ? "The key: what you type after {{, and what links and agents use. Letters, digits and underscores." : void 0,
3164
3173
  children: /* @__PURE__ */ t(
3165
3174
  xe,
3166
3175
  {
3167
3176
  size: "xs",
3168
3177
  value: e.label ?? "",
3169
- onChange: (x) => S({ label: x.target.value }),
3178
+ onChange: (x) => v({ label: x.target.value }),
3170
3179
  placeholder: ((ue = e.field) == null ? void 0 : ue.label) || "Latest order date",
3171
3180
  "aria-label": "Variable name"
3172
3181
  }
3173
3182
  )
3174
3183
  }
3175
3184
  ),
3176
- e.mode === "sql" ? /* @__PURE__ */ s(U, { children: [
3185
+ e.mode === "sql" ? /* @__PURE__ */ s($, { children: [
3177
3186
  /* @__PURE__ */ s(se, { label: "Connection", children: [
3178
3187
  /* @__PURE__ */ s(
3179
3188
  we,
3180
3189
  {
3181
3190
  value: e.connectionId ?? "",
3182
- onValueChange: (x) => S({ connectionId: x }),
3191
+ onValueChange: (x) => v({ connectionId: x }),
3183
3192
  children: [
3184
3193
  /* @__PURE__ */ t(Se, { size: "xs", "aria-label": "Connection", children: /* @__PURE__ */ t(ke, { placeholder: "Choose a connection" }) }),
3185
3194
  /* @__PURE__ */ t(De, { children: h.map((x) => /* @__PURE__ */ t(fe, { value: x.id, children: x.name }, x.id)) })
3186
3195
  ]
3187
3196
  }
3188
3197
  ),
3189
- /* @__PURE__ */ s("button", { type: "button", onClick: () => S({ mode: "data" }), className: F, children: [
3190
- /* @__PURE__ */ t(jt, { className: "h-3 w-3", "aria-hidden": !0 }),
3198
+ /* @__PURE__ */ s("button", { type: "button", onClick: () => v({ mode: "data" }), className: A, children: [
3199
+ /* @__PURE__ */ t(qt, { className: "h-3 w-3", "aria-hidden": !0 }),
3191
3200
  " Use a dataset or table instead"
3192
3201
  ] })
3193
3202
  ] }),
@@ -3195,13 +3204,13 @@ function Us({
3195
3204
  se,
3196
3205
  {
3197
3206
  label: "SQL",
3198
- hint: /* @__PURE__ */ t(U, { children: "One row. Each column is a part; the first shows by default. Filters reach it where the SQL names them, as a SQL card's do." }),
3207
+ hint: /* @__PURE__ */ t($, { children: "One row. Each column is a part; the first shows by default. Filters reach it where the SQL names them, as a SQL card's do." }),
3199
3208
  children: /* @__PURE__ */ t(
3200
3209
  pa,
3201
3210
  {
3202
3211
  size: "xs",
3203
3212
  value: e.sql,
3204
- onChange: (x) => S({ sql: x.target.value }),
3213
+ onChange: (x) => v({ sql: x.target.value }),
3205
3214
  placeholder: "select max(order_date) as latest_order_date from orders",
3206
3215
  className: "min-h-[96px] font-mono",
3207
3216
  "aria-label": "SQL"
@@ -3213,7 +3222,7 @@ function Us({
3213
3222
  we,
3214
3223
  {
3215
3224
  value: e.get === "first" ? "first" : "only",
3216
- onValueChange: (x) => S({ get: x }),
3225
+ onValueChange: (x) => v({ get: x }),
3217
3226
  children: [
3218
3227
  /* @__PURE__ */ t(Se, { size: "xs", "aria-label": "Get", children: /* @__PURE__ */ t(ke, {}) }),
3219
3228
  /* @__PURE__ */ s(De, { children: [
@@ -3223,17 +3232,17 @@ function Us({
3223
3232
  ]
3224
3233
  }
3225
3234
  ) })
3226
- ] }) : /* @__PURE__ */ s(U, { children: [
3235
+ ] }) : /* @__PURE__ */ s($, { children: [
3227
3236
  /* @__PURE__ */ s(se, { label: "Source", children: [
3228
- /* @__PURE__ */ t(yt, { muted: !v, onClick: () => c(!0), ariaLabel: "Source", children: v ? /* @__PURE__ */ s(U, { children: [
3229
- /* @__PURE__ */ t(T, { className: "h-3.5 w-3.5 text-muted-foreground", "aria-hidden": !0 }),
3237
+ /* @__PURE__ */ t(Ct, { muted: !b, onClick: () => c(!0), ariaLabel: "Source", children: b ? /* @__PURE__ */ s($, { children: [
3238
+ /* @__PURE__ */ t(_, { className: "h-3.5 w-3.5 text-muted-foreground", "aria-hidden": !0 }),
3230
3239
  " ",
3231
- v
3240
+ b
3232
3241
  ] }) : l ? "Choose a dataset or table" : "Choose a dataset" }),
3233
3242
  o ? /* @__PURE__ */ s("button", { type: "button", onClick: () => {
3234
3243
  var x;
3235
- return S({ mode: "sql", connectionId: ((x = e.dataSource) == null ? void 0 : x.connectionId) || e.connectionId });
3236
- }, className: F, children: [
3244
+ return v({ mode: "sql", connectionId: ((x = e.dataSource) == null ? void 0 : x.connectionId) || e.connectionId });
3245
+ }, className: A, children: [
3237
3246
  /* @__PURE__ */ t(Yr, { className: "h-3 w-3", "aria-hidden": !0 }),
3238
3247
  " Write SQL instead"
3239
3248
  ] }) : null
@@ -3246,17 +3255,17 @@ function Us({
3246
3255
  dataSource: e.dataSource ?? zs,
3247
3256
  incomingSelectedEntities: ((he = e.dataSource) == null ? void 0 : he.selectedEntities) ?? [],
3248
3257
  onDataSourceChange: (x) => {
3249
- var $;
3250
- const M = JSON.stringify(x.selectedEntities) === JSON.stringify(($ = e.dataSource) == null ? void 0 : $.selectedEntities);
3251
- S(
3252
- M ? { dataSource: x } : { dataSource: x, field: void 0, sortField: void 0, conditions: null, calculatedFields: void 0 }
3258
+ var j;
3259
+ const U = JSON.stringify(x.selectedEntities) === JSON.stringify((j = e.dataSource) == null ? void 0 : j.selectedEntities);
3260
+ v(
3261
+ U ? { dataSource: x } : { dataSource: x, field: void 0, sortField: void 0, conditions: null, calculatedFields: void 0 }
3253
3262
  );
3254
3263
  }
3255
3264
  }
3256
3265
  ),
3257
3266
  /* @__PURE__ */ s("div", { className: "grid grid-cols-2 gap-3", children: [
3258
- /* @__PURE__ */ t(se, { label: "Field", children: v ? /* @__PURE__ */ s(we, { value: O, onValueChange: X, disabled: C && !D.length, children: [
3259
- /* @__PURE__ */ t(Se, { size: "xs", "aria-label": "Field", children: /* @__PURE__ */ t(ke, { placeholder: C ? "Loading fields…" : k ? "Fields unavailable" : "Choose a field" }) }),
3267
+ /* @__PURE__ */ t(se, { label: "Field", children: b ? /* @__PURE__ */ s(we, { value: P, onValueChange: X, disabled: w && !D.length, children: [
3268
+ /* @__PURE__ */ t(Se, { size: "xs", "aria-label": "Field", children: /* @__PURE__ */ t(ke, { placeholder: w ? "Loading fields…" : S ? "Fields unavailable" : "Choose a field" }) }),
3260
3269
  /* @__PURE__ */ s(De, { children: [
3261
3270
  D.map((x) => /* @__PURE__ */ t(fe, { value: x.id, children: /* @__PURE__ */ s("span", { className: "flex items-center gap-2", children: [
3262
3271
  /* @__PURE__ */ t("span", { children: x.label || x.name }),
@@ -3268,21 +3277,21 @@ function Us({
3268
3277
  " New calculated field…"
3269
3278
  ] }) })
3270
3279
  ] })
3271
- ] }) : /* @__PURE__ */ t(yt, { muted: !0, children: "Choose a source first" }) }),
3280
+ ] }) : /* @__PURE__ */ t(Ct, { muted: !0, children: "Choose a source first" }) }),
3272
3281
  /* @__PURE__ */ t(se, { label: "Get", children: /* @__PURE__ */ s(
3273
3282
  we,
3274
3283
  {
3275
3284
  value: e.get,
3276
- onValueChange: (x) => S({ get: x }),
3285
+ onValueChange: (x) => v({ get: x }),
3277
3286
  disabled: !e.field,
3278
3287
  children: [
3279
3288
  /* @__PURE__ */ t(Se, { size: "xs", "aria-label": "Get", children: /* @__PURE__ */ t(ke, {}) }),
3280
- /* @__PURE__ */ t(De, { children: B.map((x) => /* @__PURE__ */ t(fe, { value: x.value, children: x.label }, x.value)) })
3289
+ /* @__PURE__ */ t(De, { children: T.map((x) => /* @__PURE__ */ t(fe, { value: x.value, children: x.label }, x.value)) })
3281
3290
  ]
3282
3291
  }
3283
3292
  ) }),
3284
- e.field && Q ? /* @__PURE__ */ t("p", { className: "col-span-2 -mt-1.5 text-[11px] leading-4 text-muted-foreground", children: Q }) : null,
3285
- k ? /* @__PURE__ */ t("p", { className: "col-span-2 -mt-1.5 text-[11px] leading-4 text-destructive", children: k }) : null,
3293
+ e.field && M ? /* @__PURE__ */ t("p", { className: "col-span-2 -mt-1.5 text-[11px] leading-4 text-muted-foreground", children: M }) : null,
3294
+ S ? /* @__PURE__ */ t("p", { className: "col-span-2 -mt-1.5 text-[11px] leading-4 text-destructive", children: S }) : null,
3286
3295
  Rr(e) ? /* @__PURE__ */ t(
3287
3296
  se,
3288
3297
  {
@@ -3293,7 +3302,7 @@ function Us({
3293
3302
  {
3294
3303
  controlLabel: "Variable",
3295
3304
  selection: _s(e),
3296
- onChange: (x) => S({ comparison: Os(x) })
3305
+ onChange: (x) => v({ comparison: Os(x) })
3297
3306
  }
3298
3307
  )
3299
3308
  }
@@ -3302,24 +3311,24 @@ function Us({
3302
3311
  /* @__PURE__ */ t(se, { label: "Order by", children: /* @__PURE__ */ s(
3303
3312
  we,
3304
3313
  {
3305
- value: `${b}|${e.sortDirection}`,
3314
+ value: `${k}|${e.sortDirection}`,
3306
3315
  onValueChange: (x) => {
3307
- const M = x.lastIndexOf("|"), $ = x.slice(0, M), H = x.slice(M + 1);
3308
- S({ sortField: D.find((le) => le.id === $), sortDirection: H });
3316
+ const U = x.lastIndexOf("|"), j = x.slice(0, U), H = x.slice(U + 1);
3317
+ v({ sortField: D.find((le) => le.id === j), sortDirection: H });
3309
3318
  },
3310
3319
  children: [
3311
3320
  /* @__PURE__ */ t(Se, { size: "xs", "aria-label": "Order by", children: /* @__PURE__ */ t(ke, {}) }),
3312
3321
  /* @__PURE__ */ t(De, { children: D.flatMap(
3313
- (x) => ["asc", "desc"].map((M) => /* @__PURE__ */ s(fe, { value: `${x.id}|${M}`, children: [
3322
+ (x) => ["asc", "desc"].map((U) => /* @__PURE__ */ s(fe, { value: `${x.id}|${U}`, children: [
3314
3323
  x.label || x.name,
3315
3324
  ", ",
3316
- js(x, M)
3317
- ] }, `${x.id}|${M}`))
3325
+ js(x, U)
3326
+ ] }, `${x.id}|${U}`))
3318
3327
  ) })
3319
3328
  ]
3320
3329
  }
3321
3330
  ) }),
3322
- e.get === "list" ? /* @__PURE__ */ s(U, { children: [
3331
+ e.get === "list" ? /* @__PURE__ */ s($, { children: [
3323
3332
  /* @__PURE__ */ t(se, { label: "Show up to", children: /* @__PURE__ */ t(
3324
3333
  xe,
3325
3334
  {
@@ -3330,8 +3339,8 @@ function Us({
3330
3339
  value: e.listLimit ?? "",
3331
3340
  placeholder: "10",
3332
3341
  onChange: (x) => {
3333
- const M = Number.parseInt(x.target.value, 10);
3334
- S({ listLimit: Number.isFinite(M) && M > 0 ? Math.min(M, st) : void 0 });
3342
+ const U = Number.parseInt(x.target.value, 10);
3343
+ v({ listLimit: Number.isFinite(U) && U > 0 ? Math.min(U, st) : void 0 });
3335
3344
  },
3336
3345
  "aria-label": "Show up to"
3337
3346
  }
@@ -3342,7 +3351,7 @@ function Us({
3342
3351
  size: "xs",
3343
3352
  value: e.listSeparator ?? ", ",
3344
3353
  maxLength: gr,
3345
- onChange: (x) => S({ listSeparator: x.target.value }),
3354
+ onChange: (x) => v({ listSeparator: x.target.value }),
3346
3355
  className: "font-mono",
3347
3356
  "aria-label": "Separator"
3348
3357
  }
@@ -3350,7 +3359,7 @@ function Us({
3350
3359
  ] }) : null
3351
3360
  ] }) : null
3352
3361
  ] }),
3353
- /* @__PURE__ */ t(se, { label: "Filters", children: v ? (
3362
+ /* @__PURE__ */ t(se, { label: "Filters", children: b ? (
3354
3363
  // In place, not a dialog over the dialog: each edit is the draft's, and
3355
3364
  // Cancel or Done here keeps or drops it. A new source starts a new list.
3356
3365
  /* @__PURE__ */ t(
@@ -3358,12 +3367,12 @@ function Us({
3358
3367
  {
3359
3368
  filters: e.conditions ?? null,
3360
3369
  availableFields: D,
3361
- source: K,
3362
- onChange: (x) => S({ conditions: x })
3370
+ source: G,
3371
+ onChange: (x) => v({ conditions: x })
3363
3372
  },
3364
3373
  JSON.stringify(((ye = e.dataSource) == null ? void 0 : ye.selectedEntities) ?? null)
3365
3374
  )
3366
- ) : /* @__PURE__ */ t(yt, { muted: !0, children: "Choose a source first" }) })
3375
+ ) : /* @__PURE__ */ t(Ct, { muted: !0, children: "Choose a source first" }) })
3367
3376
  ] })
3368
3377
  ] });
3369
3378
  }
@@ -3371,7 +3380,7 @@ function $s(e, a) {
3371
3380
  return e.name === a.name && (e.qualifiedEntityName ?? e.entityName ?? "") === (a.qualifiedEntityName ?? a.entityName ?? "");
3372
3381
  }
3373
3382
  function js(e, a) {
3374
- const r = Ot(e.dataType);
3383
+ const r = zt(e.dataType);
3375
3384
  return r === "date" ? a === "asc" ? "earliest first" : "latest first" : r === "number" ? a === "asc" ? "lowest first" : "highest first" : a === "asc" ? "A to Z" : "Z to A";
3376
3385
  }
3377
3386
  function qs({
@@ -3406,7 +3415,7 @@ function qs({
3406
3415
  className: "inline-flex h-5 items-center gap-1 rounded-[4px] px-1 font-mono text-[11px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",
3407
3416
  children: [
3408
3417
  `{{${e.trim() || a}}}`,
3409
- /* @__PURE__ */ t(Vt, { className: "h-3 w-3", "aria-hidden": !0 })
3418
+ /* @__PURE__ */ t(Pt, { className: "h-3 w-3", "aria-hidden": !0 })
3410
3419
  ]
3411
3420
  }
3412
3421
  );
@@ -3425,42 +3434,42 @@ function Hs({
3425
3434
  onClose: a,
3426
3435
  onHoldEscape: r
3427
3436
  }) {
3428
- var Z, G;
3429
- const n = N((I) => I.dashboard), i = N((I) => I.selectedSheetId), o = N((I) => I.actions.saveVariableChange), [l, h] = E(
3437
+ var Z, K;
3438
+ const n = C((I) => I.dashboard), i = C((I) => I.selectedSheetId), o = C((I) => I.actions.saveVariableChange), [l, h] = E(
3430
3439
  () => e ? Ur(e) : $r()
3431
3440
  ), [d, c] = E("data"), [u, p] = E(!1), m = (I) => {
3432
3441
  p(I), r == null || r(I);
3433
- }, [f, g] = E([]), [y, C] = E(null), k = !e, V = Qs(l), P = Y(
3442
+ }, [f, g] = E([]), [y, w] = E(null), S = !e, V = Qs(l), B = Y(
3434
3443
  () => Jt({ ...JSON.parse(V), name: "" }, n),
3435
3444
  [V, n]
3436
- ), { name: D, label: O, presentation: b, emptyText: S } = l, v = Y(
3445
+ ), { name: D, label: P, presentation: k, emptyText: v } = l, b = Y(
3437
3446
  () => ({
3438
- ...P,
3439
- name: Zt(n, { id: P.id, name: D, field: l.field, mode: l.mode, label: O }),
3440
- ...O != null && O.trim() ? { label: O.trim() } : {},
3441
- ...b ? { presentation: b } : {},
3442
- ...S != null && S.trim() ? { emptyText: S } : {}
3447
+ ...B,
3448
+ name: Zt(n, { id: B.id, name: D, field: l.field, mode: l.mode, label: P }),
3449
+ ...P != null && P.trim() ? { label: P.trim() } : {},
3450
+ ...k ? { presentation: k } : {},
3451
+ ...v != null && v.trim() ? { emptyText: v } : {}
3443
3452
  }),
3444
3453
  // The field and mode are inside the query key already.
3445
- [P, n, D, O, b, S, l.field, l.mode]
3446
- ), T = Y(
3454
+ [B, n, D, P, k, v, l.field, l.mode]
3455
+ ), _ = Y(
3447
3456
  () => ({
3448
3457
  ...n,
3449
- variables: [...(n.variables ?? []).filter((I) => I.id !== v.id), v]
3458
+ variables: [...(n.variables ?? []).filter((I) => I.id !== b.id), b]
3450
3459
  }),
3451
- [n, v]
3452
- ), F = jr(l), K = ct(), B = N((I) => I.actions.mergeSemanticExecutionPayload), [Q, X] = E(!1), _ = async () => {
3460
+ [n, b]
3461
+ ), A = jr(l), G = ct(), T = C((I) => I.actions.mergeSemanticExecutionPayload), [M, X] = E(!1), O = async () => {
3453
3462
  const I = Jt(l, n);
3454
3463
  X(!0);
3455
3464
  let ae;
3456
3465
  try {
3457
- const R = Cr(n, e ? { kind: "update", id: e.id, patch: I } : { kind: "add", variable: I });
3466
+ const R = Nr(n, e ? { kind: "update", id: e.id, patch: I } : { kind: "add", variable: I });
3458
3467
  if (!R.ok) {
3459
3468
  X(!1), g(R.issues);
3460
3469
  return;
3461
3470
  }
3462
3471
  const [ne] = R.queryFrames;
3463
- ae = ne ? await K(ne, e ? { previousFrame: wr(n, e) } : void 0) : { domainsById: {} };
3472
+ ae = ne ? await G(ne, e ? { previousFrame: wr(n, e) } : void 0) : { domainsById: {} };
3464
3473
  } catch (R) {
3465
3474
  X(!1), g([
3466
3475
  {
@@ -3471,21 +3480,21 @@ function Hs({
3471
3480
  ]);
3472
3481
  return;
3473
3482
  }
3474
- const j = o(
3475
- k ? { kind: "add", variable: I } : { kind: "update", id: I.id, patch: Ks(I) }
3483
+ const q = o(
3484
+ S ? { kind: "add", variable: I } : { kind: "update", id: I.id, patch: Ks(I) }
3476
3485
  );
3477
- if (X(!1), !j.ok) {
3478
- g(j.issues);
3486
+ if (X(!1), !q.ok) {
3487
+ g(q.issues);
3479
3488
  return;
3480
3489
  }
3481
- B(ae), a();
3490
+ T(ae), a();
3482
3491
  }, te = (I) => {
3483
3492
  if (!e) return;
3484
3493
  const ae = o({ kind: "remove", id: e.id, confirmed: I });
3485
3494
  if (!ae.ok) {
3486
- const j = ae.issues.find((R) => R.code === "inUse");
3487
- if (j && !I) {
3488
- C(j);
3495
+ const q = ae.issues.find((R) => R.code === "inUse");
3496
+ if (q && !I) {
3497
+ w(q);
3489
3498
  return;
3490
3499
  }
3491
3500
  g(ae.issues);
@@ -3504,8 +3513,8 @@ function Hs({
3504
3513
  /* @__PURE__ */ t(Nt, { className: "mt-1 h-3.5 w-3.5 shrink-0 text-muted-foreground", "aria-hidden": !0 }),
3505
3514
  /* @__PURE__ */ s("div", { className: "min-w-0", children: [
3506
3515
  /* @__PURE__ */ s("p", { className: "flex items-center gap-2", children: [
3507
- /* @__PURE__ */ t("span", { className: "truncate text-[13px] font-medium text-foreground", children: k ? "New variable" : e.label || e.name }),
3508
- /* @__PURE__ */ t("span", { className: Mt, children: "Variable from data" })
3516
+ /* @__PURE__ */ t("span", { className: "truncate text-[13px] font-medium text-foreground", children: S ? "New variable" : e.label || e.name }),
3517
+ /* @__PURE__ */ t("span", { className: Ut, children: "Variable from data" })
3509
3518
  ] }),
3510
3519
  /* @__PURE__ */ t("p", { className: "mt-0.5 truncate text-[10px] leading-3 text-muted-foreground/70", children: "Available on every tab and Document of this dashboard" })
3511
3520
  ] })
@@ -3548,17 +3557,17 @@ function Hs({
3548
3557
  onCalculatedFieldOpenChange: m
3549
3558
  }
3550
3559
  ) : null,
3551
- d === "filters" ? /* @__PURE__ */ t(Gs, { draft: l, draftDashboard: T }) : null,
3560
+ d === "filters" ? /* @__PURE__ */ t(Gs, { draft: l, draftDashboard: _ }) : null,
3552
3561
  d === "display" ? /* @__PURE__ */ t(Js, { draft: l, onChange: h }) : null
3553
3562
  ] }),
3554
- u ? null : /* @__PURE__ */ s(U, { children: [
3563
+ u ? null : /* @__PURE__ */ s($, { children: [
3555
3564
  /* @__PURE__ */ t(
3556
3565
  Zs,
3557
3566
  {
3558
3567
  draft: l,
3559
- draftVariable: v,
3560
- draftDashboard: T,
3561
- blocker: F,
3568
+ draftVariable: b,
3569
+ draftDashboard: _,
3570
+ blocker: A,
3562
3571
  selectedSheetId: i ?? void 0
3563
3572
  }
3564
3573
  ),
@@ -3573,16 +3582,16 @@ function Hs({
3573
3582
  " Used in ",
3574
3583
  ((Z = y.places) == null ? void 0 : Z.length) ?? 0,
3575
3584
  " ",
3576
- ((G = y.places) == null ? void 0 : G.length) === 1 ? "place" : "places",
3585
+ ((K = y.places) == null ? void 0 : K.length) === 1 ? "place" : "places",
3577
3586
  ". Its chips then read as missing."
3578
3587
  ] }),
3579
3588
  /* @__PURE__ */ s("div", { className: "mt-1.5 flex gap-1.5", children: [
3580
- /* @__PURE__ */ t(L, { variant: "outline", size: "xs", className: "h-6 px-2 text-[11px]", onClick: () => C(null), children: "Keep it" }),
3589
+ /* @__PURE__ */ t(L, { variant: "outline", size: "xs", className: "h-6 px-2 text-[11px]", onClick: () => w(null), children: "Keep it" }),
3581
3590
  /* @__PURE__ */ t(L, { size: "xs", className: "h-6 px-2 text-[11px]", onClick: () => te(!0), children: "Remove anyway" })
3582
3591
  ] })
3583
3592
  ] }) : null,
3584
3593
  /* @__PURE__ */ s("div", { className: "flex shrink-0 items-center justify-between gap-2 border-t border-border/60 px-4 py-2.5", children: [
3585
- k ? /* @__PURE__ */ t("span", {}) : /* @__PURE__ */ t(
3594
+ S ? /* @__PURE__ */ t("span", {}) : /* @__PURE__ */ t(
3586
3595
  L,
3587
3596
  {
3588
3597
  variant: "outline",
@@ -3594,7 +3603,7 @@ function Hs({
3594
3603
  ),
3595
3604
  /* @__PURE__ */ s("span", { className: "flex items-center gap-1.5", children: [
3596
3605
  /* @__PURE__ */ t(L, { variant: "outline", size: "xs", onClick: a, children: "Cancel" }),
3597
- /* @__PURE__ */ t(L, { size: "xs", disabled: !!F || Q, title: F, onClick: () => void _(), children: k ? "Create" : "Done" })
3606
+ /* @__PURE__ */ t(L, { size: "xs", disabled: !!A || M, title: A, onClick: () => void O(), children: S ? "Create" : "Done" })
3598
3607
  ] })
3599
3608
  ] })
3600
3609
  ] })
@@ -3652,8 +3661,8 @@ const Xs = [
3652
3661
  ];
3653
3662
  function Js({ draft: e, onChange: a }) {
3654
3663
  var h, d;
3655
- const r = e.mode === "sql" ? "unknown" : Ot((h = e.field) == null ? void 0 : h.dataType), n = (d = e.presentation) == null ? void 0 : d.temporal, i = n ? n.mode === "style" ? n.dateStyle : n.mode === "pattern" ? "pattern" : "auto" : "auto", o = (n == null ? void 0 : n.mode) === "pattern" ? Lr(n.pattern) : null, l = (c) => a({ ...e, presentation: c && Object.keys(c).length ? c : void 0 });
3656
- return /* @__PURE__ */ s(U, { children: [
3664
+ const r = e.mode === "sql" ? "unknown" : zt((h = e.field) == null ? void 0 : h.dataType), n = (d = e.presentation) == null ? void 0 : d.temporal, i = n ? n.mode === "style" ? n.dateStyle : n.mode === "pattern" ? "pattern" : "auto" : "auto", o = (n == null ? void 0 : n.mode) === "pattern" ? Lr(n.pattern) : null, l = (c) => a({ ...e, presentation: c && Object.keys(c).length ? c : void 0 });
3665
+ return /* @__PURE__ */ s($, { children: [
3657
3666
  r === "date" || r === "unknown" ? /* @__PURE__ */ s(se, { label: "Dates read as", hint: "A chip can change this for itself.", children: [
3658
3667
  /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
3659
3668
  /* @__PURE__ */ s(
@@ -3712,52 +3721,52 @@ function Zs({
3712
3721
  blocker: n,
3713
3722
  selectedSheetId: i
3714
3723
  }) {
3715
- var S;
3716
- const o = r.sheets ?? [], l = Y(() => Ts(r, a.id), [r, a.id]), [h, d] = E(void 0), c = (l ? h : void 0) ?? i ?? ((S = o[0]) == null ? void 0 : S.id), u = o.find((v) => v.id === c), p = N((v) => c ? v.documentSectionRuntimeBySheetId[c] : void 0), m = !!(u && He(u)), f = Y(
3724
+ var v;
3725
+ const o = r.sheets ?? [], l = Y(() => Ts(r, a.id), [r, a.id]), [h, d] = E(void 0), c = (l ? h : void 0) ?? i ?? ((v = o[0]) == null ? void 0 : v.id), u = o.find((b) => b.id === c), p = C((b) => c ? b.documentSectionRuntimeBySheetId[c] : void 0), m = !!(u && He(u)), f = Y(
3717
3726
  () => c ? m ? p ? { kind: "document", sheetId: c, runtime: p } : void 0 : { kind: "sheet", sheetId: c } : void 0,
3718
3727
  [m, p, c]
3719
- ), g = Y(() => n || !f ? [] : [a], [n, a, f]), C = Ln({
3728
+ ), g = Y(() => n || !f ? [] : [a], [n, a, f]), w = Ln({
3720
3729
  dashboard: r,
3721
3730
  place: f ?? { kind: "sheet", sheetId: c ?? "" },
3722
3731
  purpose: "preview",
3723
3732
  variables: g
3724
- }).byId.get(a.id), k = Vn(), V = Pn(), P = Y(
3725
- () => Nr({ preferences: k, calendar: V }),
3726
- [V, k]
3733
+ }).byId.get(a.id), S = Vn(), V = Pn(), B = Y(
3734
+ () => Cr({ preferences: S, calendar: V }),
3735
+ [V, S]
3727
3736
  );
3728
- let D, O = "", b = null;
3737
+ let D, P = "", k = null;
3729
3738
  if (n)
3730
3739
  D = /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: e.mode === "sql" ? "Write the SQL to see a value." : "Choose a source and a field to see a value." });
3731
3740
  else if (!f)
3732
3741
  D = /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: "Open this Document to preview here." });
3733
- else if (!C || C.status === "loading")
3742
+ else if (!w || w.status === "loading")
3734
3743
  D = /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: "Loading…" });
3735
3744
  else {
3736
- const v = ei(a, C, P);
3737
- if (D = v.body, O = v.meta, v.unavailable) {
3738
- const T = (u == null ? void 0 : u.title) || "this tab";
3739
- b = /* @__PURE__ */ s("p", { className: "mt-1.5 flex gap-1.5 text-[11px] leading-4 text-amber-700 dark:text-amber-400", children: [
3745
+ const b = ei(a, w, B);
3746
+ if (D = b.body, P = b.meta, b.unavailable) {
3747
+ const _ = (u == null ? void 0 : u.title) || "this tab";
3748
+ k = /* @__PURE__ */ s("p", { className: "mt-1.5 flex gap-1.5 text-[11px] leading-4 text-amber-700 dark:text-amber-400", children: [
3740
3749
  /* @__PURE__ */ t(ya, { className: "mt-px h-3 w-3 shrink-0", "aria-hidden": !0 }),
3741
3750
  /* @__PURE__ */ s("span", { children: [
3742
3751
  "No change on ",
3743
- T,
3752
+ _,
3744
3753
  ". ",
3745
- Bn(v.unavailable, "variable")
3754
+ Bn(b.unavailable, "variable")
3746
3755
  ] })
3747
3756
  ] });
3748
3757
  }
3749
3758
  }
3750
3759
  return /* @__PURE__ */ s("div", { className: "shrink-0 border-t border-border/60 bg-muted/30 px-4 py-2.5", "data-testid": "variable-preview", children: [
3751
3760
  /* @__PURE__ */ s("div", { className: "flex items-center gap-3", children: [
3752
- /* @__PURE__ */ t("span", { className: Mt, children: l ? "Preview on" : "Preview" }),
3761
+ /* @__PURE__ */ t("span", { className: Ut, children: l ? "Preview on" : "Preview" }),
3753
3762
  l ? /* @__PURE__ */ s(we, { value: c ?? "", onValueChange: d, disabled: !!n, children: [
3754
3763
  /* @__PURE__ */ t(Se, { size: "xs", className: "h-6 w-auto gap-1.5 px-2 text-[12px]", "aria-label": "Preview place", children: /* @__PURE__ */ t(ke, {}) }),
3755
- /* @__PURE__ */ t(De, { children: o.map((v) => /* @__PURE__ */ t(fe, { value: v.id, children: v.title || v.id }, v.id)) })
3764
+ /* @__PURE__ */ t(De, { children: o.map((b) => /* @__PURE__ */ t(fe, { value: b.id, children: b.title || b.id }, b.id)) })
3756
3765
  ] }) : null,
3757
3766
  /* @__PURE__ */ t("div", { className: "min-w-0 flex-1 truncate text-right text-[13px]", children: D })
3758
3767
  ] }),
3759
- O ? /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] leading-4 text-muted-foreground", children: O }) : null,
3760
- b
3768
+ P ? /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] leading-4 text-muted-foreground", children: P }) : null,
3769
+ k
3761
3770
  ] });
3762
3771
  }
3763
3772
  function ei(e, a, r) {
@@ -3770,7 +3779,7 @@ function ei(e, a, r) {
3770
3779
  case "answered": {
3771
3780
  const u = _r(e, Object.keys(a.parts))[0], p = u ? a.parts[u] : void 0, m = p && Kt(p, e.presentation, r) || "(empty)", f = `${o(a.matched)}${c}`.replace(/^ · /, ""), g = Sr(e, a, r);
3772
3781
  return g && typeof g == "object" && "unavailable" in g ? { body: n(m), meta: f, unavailable: g.unavailable } : g === "noPrevious" ? { body: n(m), meta: `${f} · Nothing in the period before to compare with.`.replace(/^ · /, "") } : g ? {
3773
- body: /* @__PURE__ */ s(U, { children: [
3782
+ body: /* @__PURE__ */ s($, { children: [
3774
3783
  n(g.value),
3775
3784
  /* @__PURE__ */ s("span", { className: "text-muted-foreground", children: [
3776
3785
  " · was ",
@@ -3806,7 +3815,7 @@ function ei(e, a, r) {
3806
3815
  }
3807
3816
  }
3808
3817
  function ro() {
3809
- const e = N((l) => l.variableEditor), a = N((l) => l.dashboard.variables), r = N((l) => l.actions.closeVariableEditor), n = et(!1), i = (e == null ? void 0 : e.kind) === "edit" ? a == null ? void 0 : a.find((l) => l.id === e.variableId) : void 0;
3818
+ const e = C((l) => l.variableEditor), a = C((l) => l.dashboard.variables), r = C((l) => l.actions.closeVariableEditor), n = et(!1), i = (e == null ? void 0 : e.kind) === "edit" ? a == null ? void 0 : a.find((l) => l.id === e.variableId) : void 0;
3810
3819
  return !(e && (e.kind === "new" || i)) ? null : /* @__PURE__ */ s(Le, { modal: !1, open: !0, onOpenChange: (l) => !l && r(), children: [
3811
3820
  /* @__PURE__ */ t("div", { className: "pointer-events-none fixed inset-0 z-40 bg-zinc-950/40 backdrop-blur-sm" }),
3812
3821
  /* @__PURE__ */ s(
@@ -3946,22 +3955,22 @@ function di({
3946
3955
  onTogglePause: f,
3947
3956
  onDelete: g,
3948
3957
  selectingId: y,
3949
- busyId: C,
3950
- manageBriefingsHref: k,
3958
+ busyId: w,
3959
+ manageBriefingsHref: S,
3951
3960
  contentKind: V,
3952
- hideHeader: P = !1
3961
+ hideHeader: B = !1
3953
3962
  }) {
3954
- const D = e.length, O = e.filter((F) => F.status === "ACTIVE").length, b = V === "reports" ? D === 1 ? "report" : "reports" : V === "briefings" ? D === 1 ? "briefing" : "briefings" : D === 1 ? "item" : "items", S = e.find((F) => F.hasActiveRun) ?? null, v = V ?? "reports & briefings", T = r === "dashboard" ? a : `Project ${v}`;
3963
+ const D = e.length, P = e.filter((A) => A.status === "ACTIVE").length, k = V === "reports" ? D === 1 ? "report" : "reports" : V === "briefings" ? D === 1 ? "briefing" : "briefings" : D === 1 ? "item" : "items", v = e.find((A) => A.hasActiveRun) ?? null, b = V ?? "reports & briefings", _ = r === "dashboard" ? a : `Project ${b}`;
3955
3964
  return /* @__PURE__ */ s(
3956
3965
  "section",
3957
3966
  {
3958
- "aria-label": `Dashboard ${v.replace("&", "and")}`,
3967
+ "aria-label": `Dashboard ${b.replace("&", "and")}`,
3959
3968
  className: "flex h-full min-h-0 flex-col bg-background text-foreground",
3960
3969
  children: [
3961
- P ? null : /* @__PURE__ */ s("header", { className: "flex items-start justify-between gap-3 border-b border-border px-4 py-3", children: [
3970
+ B ? null : /* @__PURE__ */ s("header", { className: "flex items-start justify-between gap-3 border-b border-border px-4 py-3", children: [
3962
3971
  /* @__PURE__ */ s("div", { className: "min-w-0", children: [
3963
- /* @__PURE__ */ t("div", { className: ai, children: v }),
3964
- /* @__PURE__ */ t("h2", { className: "mt-0.5 truncate text-[14px] font-semibold leading-5", children: T })
3972
+ /* @__PURE__ */ t("div", { className: ai, children: b }),
3973
+ /* @__PURE__ */ t("h2", { className: "mt-0.5 truncate text-[14px] font-semibold leading-5", children: _ })
3965
3974
  ] }),
3966
3975
  /* @__PURE__ */ t(
3967
3976
  "button",
@@ -3969,7 +3978,7 @@ function di({
3969
3978
  type: "button",
3970
3979
  onClick: l,
3971
3980
  className: "rounded-control p-1 text-muted-foreground hover:bg-muted hover:text-foreground",
3972
- "aria-label": `Close ${v.replace("&", "and")} panel`,
3981
+ "aria-label": `Close ${b.replace("&", "and")} panel`,
3973
3982
  children: /* @__PURE__ */ t(Qe, { className: "h-3.5 w-3.5" })
3974
3983
  }
3975
3984
  )
@@ -3985,21 +3994,21 @@ function di({
3985
3994
  ),
3986
3995
  /* @__PURE__ */ t("div", { className: "flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground", children: i && D === 0 ? /* @__PURE__ */ s("span", { children: [
3987
3996
  "Loading ",
3988
- v,
3997
+ b,
3989
3998
  "…"
3990
3999
  ] }) : D === 0 ? /* @__PURE__ */ s("span", { children: [
3991
4000
  "No ",
3992
- v,
4001
+ b,
3993
4002
  " yet"
3994
- ] }) : /* @__PURE__ */ s(U, { children: [
4003
+ ] }) : /* @__PURE__ */ s($, { children: [
3995
4004
  /* @__PURE__ */ s("span", { className: "font-medium text-foreground/80", children: [
3996
4005
  D,
3997
4006
  " ",
3998
- b
4007
+ k
3999
4008
  ] }),
4000
4009
  /* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
4001
4010
  /* @__PURE__ */ s("span", { children: [
4002
- O,
4011
+ P,
4003
4012
  " active"
4004
4013
  ] })
4005
4014
  ] }) })
@@ -4050,11 +4059,11 @@ function di({
4050
4059
  ) : null : null
4051
4060
  ] })
4052
4061
  ] }),
4053
- S ? /* @__PURE__ */ s("div", { className: "flex items-center gap-2 border-b border-border bg-muted/60 px-4 py-2 text-[12px]", children: [
4062
+ v ? /* @__PURE__ */ s("div", { className: "flex items-center gap-2 border-b border-border bg-muted/60 px-4 py-2 text-[12px]", children: [
4054
4063
  /* @__PURE__ */ t(de, { className: "h-3 w-3 shrink-0 animate-spin text-muted-foreground" }),
4055
- /* @__PURE__ */ t("span", { className: "font-medium text-foreground", children: S.name }),
4064
+ /* @__PURE__ */ t("span", { className: "font-medium text-foreground", children: v.name }),
4056
4065
  /* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
4057
- /* @__PURE__ */ t("span", { className: "truncate text-muted-foreground", children: Ta(S) })
4066
+ /* @__PURE__ */ t("span", { className: "truncate text-muted-foreground", children: Ta(v) })
4058
4067
  ] }) : null,
4059
4068
  /* @__PURE__ */ s("div", { className: "flex-1 overflow-y-auto", children: [
4060
4069
  n ? /* @__PURE__ */ t("div", { className: "m-4 rounded-card border border-destructive/30 bg-destructive/10 px-3 py-2 text-[12px] text-destructive", children: n }) : null,
@@ -4068,24 +4077,24 @@ function di({
4068
4077
  contentKind: V
4069
4078
  }
4070
4079
  ) : null,
4071
- e.map((F) => /* @__PURE__ */ t(
4080
+ e.map((A) => /* @__PURE__ */ t(
4072
4081
  hi,
4073
4082
  {
4074
- briefing: F,
4075
- isOpening: y === F.id,
4076
- isBusy: C === F.id,
4077
- onOpen: () => h(F.id),
4078
- onRunNow: () => m(F),
4079
- onTogglePause: () => f(F),
4080
- onDelete: () => g(F)
4083
+ briefing: A,
4084
+ isOpening: y === A.id,
4085
+ isBusy: w === A.id,
4086
+ onOpen: () => h(A.id),
4087
+ onRunNow: () => m(A),
4088
+ onTogglePause: () => f(A),
4089
+ onDelete: () => g(A)
4081
4090
  },
4082
- F.id
4091
+ A.id
4083
4092
  ))
4084
4093
  ] }),
4085
- k ? /* @__PURE__ */ t("div", { className: "border-t border-border px-4 py-2.5", children: /* @__PURE__ */ s(
4094
+ S ? /* @__PURE__ */ t("div", { className: "border-t border-border px-4 py-2.5", children: /* @__PURE__ */ s(
4086
4095
  "a",
4087
4096
  {
4088
- href: k,
4097
+ href: S,
4089
4098
  className: J(Ia, "h-6 px-1 text-[11px]"),
4090
4099
  children: [
4091
4100
  "Manage all reports & briefings",
@@ -4355,7 +4364,7 @@ function hi({
4355
4364
  /* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
4356
4365
  /* @__PURE__ */ t(_n, { className: "h-3 w-3" }),
4357
4366
  /* @__PURE__ */ t("span", { className: "truncate", children: si(e) }),
4358
- e.lastRunAt ? /* @__PURE__ */ s(U, { children: [
4367
+ e.lastRunAt ? /* @__PURE__ */ s($, { children: [
4359
4368
  /* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
4360
4369
  /* @__PURE__ */ s("span", { children: [
4361
4370
  "Last run ",
@@ -4391,7 +4400,7 @@ function hi({
4391
4400
  ) }),
4392
4401
  /* @__PURE__ */ s(We, { align: "end", className: "w-44", children: [
4393
4402
  /* @__PURE__ */ s(re, { onClick: n, children: [
4394
- /* @__PURE__ */ t(Vt, { className: "h-3.5 w-3.5" }),
4403
+ /* @__PURE__ */ t(Pt, { className: "h-3.5 w-3.5" }),
4395
4404
  "Edit ",
4396
4405
  m.noun
4397
4406
  ] }),
@@ -4413,10 +4422,10 @@ function hi({
4413
4422
  onClick: (g) => {
4414
4423
  g.preventDefault(), o();
4415
4424
  },
4416
- children: h ? /* @__PURE__ */ s(U, { children: [
4425
+ children: h ? /* @__PURE__ */ s($, { children: [
4417
4426
  /* @__PURE__ */ t(zn, { className: "h-3.5 w-3.5" }),
4418
4427
  "Resume"
4419
- ] }) : /* @__PURE__ */ s(U, { children: [
4428
+ ] }) : /* @__PURE__ */ s($, { children: [
4420
4429
  /* @__PURE__ */ t(Rn, { className: "h-3.5 w-3.5" }),
4421
4430
  "Pause"
4422
4431
  ] })
@@ -4494,46 +4503,46 @@ function xi({
4494
4503
  openRun: p,
4495
4504
  client: m
4496
4505
  }) {
4497
- const { authToken: f, tokenProps: g } = $e(), y = $n(), C = !u || y.canCreate && (u === "scheduled_report" || y.analyticalBriefingsEnabled), [k, V] = E(!1), P = h ?? k, D = (A) => {
4498
- h === void 0 && V(A), d == null || d(A);
4499
- }, [O, b] = E(
4506
+ const { authToken: f, tokenProps: g } = $e(), y = $n(), w = !u || y.canCreate && (u === "scheduled_report" || y.analyticalBriefingsEnabled), [S, V] = E(!1), B = h ?? S, D = (F) => {
4507
+ h === void 0 && V(F), d == null || d(F);
4508
+ }, [P, k] = E(
4500
4509
  u ? "author" : "list"
4501
- ), [S, v] = E(
4510
+ ), [v, b] = E(
4502
4511
  u ?? "analytical_briefing"
4503
- ), [T, F] = E("dashboard"), [K, B] = E(
4512
+ ), [_, A] = E("dashboard"), [G, T] = E(
4504
4513
  []
4505
- ), [Q, X] = E(null), _ = u && !C && !Q ? "list" : O, [te, Z] = E(!1), [G, I] = E(null), [ae, j] = E(null), [R, ne] = E(
4514
+ ), [M, X] = E(null), O = u && !w && !M ? "list" : P, [te, Z] = E(!1), [K, I] = E(null), [ae, q] = E(null), [R, ne] = E(
4506
4515
  null
4507
- ), [ue, he] = E(null), ye = et(null), x = et(P);
4516
+ ), [ue, he] = E(null), ye = et(null), x = et(B);
4508
4517
  Ee(() => {
4509
- const A = P && !x.current;
4510
- x.current = P, !(!A || !u) && (X(null), F("dashboard"), v(u), b("author"), he(null));
4511
- }, [P, u]);
4512
- const M = Lt(), $ = r ?? (g == null ? void 0 : g.apiServiceUrl), H = n ?? (f == null ? void 0 : f.accessToken), le = Y(() => ({ ...bi, ...m }), [m]), [_e, ht] = E(null);
4518
+ const F = B && !x.current;
4519
+ x.current = B, !(!F || !u) && (X(null), A("dashboard"), b(u), k("author"), he(null));
4520
+ }, [B, u]);
4521
+ const U = Vt(), j = r ?? (g == null ? void 0 : g.apiServiceUrl), H = n ?? (f == null ? void 0 : f.accessToken), le = Y(() => ({ ...bi, ...m }), [m]), [_e, ht] = E(null);
4513
4522
  Ee(() => {
4514
- if (!p || !$ || !H) return;
4515
- let A = !0;
4516
- return le.getBriefing($, H, p.briefingId).then(({ briefing: W }) => {
4517
- A && (X(W), ht(p), b("author"));
4518
- }, (W) => {
4519
- A && z.error(W instanceof Error ? W.message : "Could not open the run.");
4523
+ if (!p || !j || !H) return;
4524
+ let F = !0;
4525
+ return le.getBriefing(j, H, p.briefingId).then(({ briefing: Q }) => {
4526
+ F && (X(Q), ht(p), k("author"));
4527
+ }, (Q) => {
4528
+ F && z.error(Q instanceof Error ? Q.message : "Could not open the run.");
4520
4529
  }), () => {
4521
- A = !1;
4530
+ F = !1;
4522
4531
  };
4523
- }, [p, $, H, le]);
4532
+ }, [p, j, H, le]);
4524
4533
  const Fe = mi(a), Ke = Y(() => {
4525
- const A = fi(
4526
- K,
4527
- T,
4534
+ const F = fi(
4535
+ G,
4536
+ _,
4528
4537
  e
4529
4538
  );
4530
4539
  if (!u)
4531
- return A;
4532
- const W = u === "scheduled_report" ? "report" : "briefing";
4533
- return A.filter(
4534
- (Ge) => pe(Ge).noun === W
4540
+ return F;
4541
+ const Q = u === "scheduled_report" ? "report" : "briefing";
4542
+ return F.filter(
4543
+ (Ge) => pe(Ge).noun === Q
4535
4544
  );
4536
- }, [e, K, T, u]), mt = Y(() => T === "dashboard" ? {
4545
+ }, [e, G, _, u]), mt = Y(() => _ === "dashboard" ? {
4537
4546
  source: { type: "dashboard", dashboardId: e },
4538
4547
  label: Fe,
4539
4548
  detail: pi(Fe)
@@ -4541,119 +4550,119 @@ function xi({
4541
4550
  source: { type: "project" },
4542
4551
  label: "This project",
4543
4552
  detail: "Use any data in this project."
4544
- }, [e, Fe, T]), Oe = !!($ && H), ze = Wr({
4553
+ }, [e, Fe, _]), Oe = !!(j && H), ze = Wr({
4545
4554
  canCreate: y.canCreate,
4546
4555
  analyticalBriefingsEnabled: y.analyticalBriefingsEnabled,
4547
- scheduledReportAvailable: T === "dashboard"
4556
+ scheduledReportAvailable: _ === "dashboard"
4548
4557
  }), ce = ie(async () => {
4549
- if (!(!$ || !H)) {
4558
+ if (!(!j || !H)) {
4550
4559
  Z(!0), he(null);
4551
4560
  try {
4552
- B(
4561
+ T(
4553
4562
  await gi({
4554
4563
  apiClient: le,
4555
- apiServiceUrl: $,
4564
+ apiServiceUrl: j,
4556
4565
  token: H
4557
4566
  })
4558
4567
  );
4559
- } catch (A) {
4568
+ } catch (F) {
4560
4569
  he(
4561
- A instanceof Error ? A.message : "Could not load briefings."
4570
+ F instanceof Error ? F.message : "Could not load briefings."
4562
4571
  );
4563
4572
  } finally {
4564
4573
  Z(!1);
4565
4574
  }
4566
4575
  }
4567
- }, [le, $, H]);
4576
+ }, [le, j, H]);
4568
4577
  Ee(() => {
4569
- !P || _ !== "list" || !Oe || ce();
4570
- }, [Oe, _, ce, P]);
4578
+ !B || O !== "list" || !Oe || ce();
4579
+ }, [Oe, O, ce, B]);
4571
4580
  const Re = () => {
4572
- X(null), F("dashboard"), b("list"), D(!0);
4573
- }, w = (A) => {
4574
- X(null), v(A), b("author");
4575
- }, q = async (A) => {
4576
- if (!(!$ || !H)) {
4577
- I(A), he(null);
4581
+ X(null), A("dashboard"), k("list"), D(!0);
4582
+ }, N = (F) => {
4583
+ X(null), b(F), k("author");
4584
+ }, W = async (F) => {
4585
+ if (!(!j || !H)) {
4586
+ I(F), he(null);
4578
4587
  try {
4579
- const W = await le.getBriefing(
4580
- $,
4588
+ const Q = await le.getBriefing(
4589
+ j,
4581
4590
  H,
4582
- A
4591
+ F
4583
4592
  );
4584
- X(W.briefing), b("author");
4585
- } catch (W) {
4593
+ X(Q.briefing), k("author");
4594
+ } catch (Q) {
4586
4595
  he(
4587
- W instanceof Error ? W.message : "Could not open briefing."
4596
+ Q instanceof Error ? Q.message : "Could not open briefing."
4588
4597
  );
4589
4598
  } finally {
4590
4599
  I(null);
4591
4600
  }
4592
4601
  }
4593
- }, ee = async (A) => {
4594
- if (!(!$ || !H)) {
4595
- j(A.id);
4602
+ }, ee = async (F) => {
4603
+ if (!(!j || !H)) {
4604
+ q(F.id);
4596
4605
  try {
4597
- const W = await le.runBriefingNow(
4598
- $,
4606
+ const Q = await le.runBriefingNow(
4607
+ j,
4599
4608
  H,
4600
- A.id,
4609
+ F.id,
4601
4610
  { requestId: vi() }
4602
4611
  );
4603
- M.track({ kind: "briefing", id: W.run.id, title: A.name, briefingId: A.id }), ce();
4604
- } catch (W) {
4612
+ U.track({ kind: "briefing", id: Q.run.id, title: F.name, briefingId: F.id }), ce();
4613
+ } catch (Q) {
4605
4614
  z.error(
4606
- W instanceof Error ? W.message : "Could not start the run."
4615
+ Q instanceof Error ? Q.message : "Could not start the run."
4607
4616
  );
4608
4617
  } finally {
4609
- j(null);
4618
+ q(null);
4610
4619
  }
4611
4620
  }
4612
- }, me = async (A) => {
4613
- if (!$ || !H) return;
4614
- const { noun: W } = pe(A), Ge = W === "report" ? "Report" : "Briefing";
4615
- j(A.id);
4621
+ }, me = async (F) => {
4622
+ if (!j || !H) return;
4623
+ const { noun: Q } = pe(F), Ge = Q === "report" ? "Report" : "Briefing";
4624
+ q(F.id);
4616
4625
  try {
4617
- const Ye = A.status === "PAUSED" ? await le.resumeBriefing(
4618
- $,
4626
+ const Ye = F.status === "PAUSED" ? await le.resumeBriefing(
4627
+ j,
4619
4628
  H,
4620
- A.id
4629
+ F.id
4621
4630
  ) : await le.pauseBriefing(
4622
- $,
4631
+ j,
4623
4632
  H,
4624
- A.id
4633
+ F.id
4625
4634
  );
4626
4635
  z.success(
4627
4636
  Ye.briefing.status === "PAUSED" ? `${Ge} paused` : `${Ge} resumed`
4628
4637
  ), ce();
4629
4638
  } catch (Ye) {
4630
4639
  z.error(
4631
- Ye instanceof Error ? Ye.message : `Could not update the ${W} status.`
4640
+ Ye instanceof Error ? Ye.message : `Could not update the ${Q} status.`
4632
4641
  );
4633
4642
  } finally {
4634
- j(null);
4643
+ q(null);
4635
4644
  }
4636
- }, Ne = async () => {
4637
- if (!R || !$ || !H) return;
4638
- const A = R;
4639
- j(A.id);
4645
+ }, Ce = async () => {
4646
+ if (!R || !j || !H) return;
4647
+ const F = R;
4648
+ q(F.id);
4640
4649
  try {
4641
4650
  await le.deleteBriefing(
4642
- $,
4651
+ j,
4643
4652
  H,
4644
- A.id
4653
+ F.id
4645
4654
  );
4646
- const { noun: W } = pe(A);
4647
- z.success(`${W === "report" ? "Report" : "Briefing"} deleted`), ne(null), ce();
4648
- } catch (W) {
4655
+ const { noun: Q } = pe(F);
4656
+ z.success(`${Q === "report" ? "Report" : "Briefing"} deleted`), ne(null), ce();
4657
+ } catch (Q) {
4649
4658
  z.error(
4650
- W instanceof Error ? W.message : "Could not delete the briefing."
4659
+ Q instanceof Error ? Q.message : "Could not delete the briefing."
4651
4660
  );
4652
4661
  } finally {
4653
- j(null);
4662
+ q(null);
4654
4663
  }
4655
4664
  }, La = Ke.length;
4656
- return y.surfaceVisible ? /* @__PURE__ */ s(Gn, { open: P, onOpenChange: D, children: [
4665
+ return y.surfaceVisible ? /* @__PURE__ */ s(Gn, { open: B, onOpenChange: D, children: [
4657
4666
  c ? null : /* @__PURE__ */ t(
4658
4667
  ti,
4659
4668
  {
@@ -4670,9 +4679,9 @@ function xi({
4670
4679
  side: "right",
4671
4680
  hideClose: !0,
4672
4681
  className: "flex h-full w-full flex-col overflow-hidden p-0 outline-none sm:max-w-[560px]",
4673
- onOpenAutoFocus: (A) => {
4674
- var W;
4675
- A.preventDefault(), (W = ye.current) == null || W.focus({ preventScroll: !0 });
4682
+ onOpenAutoFocus: (F) => {
4683
+ var Q;
4684
+ F.preventDefault(), (Q = ye.current) == null || Q.focus({ preventScroll: !0 });
4676
4685
  },
4677
4686
  children: [
4678
4687
  /* @__PURE__ */ s(Xn, { className: "sr-only", children: [
@@ -4692,17 +4701,17 @@ function xi({
4692
4701
  {
4693
4702
  type: "button",
4694
4703
  role: "tab",
4695
- "aria-selected": _ === "author",
4696
- disabled: !C,
4704
+ "aria-selected": O === "author",
4705
+ disabled: !w,
4697
4706
  className: J(
4698
4707
  "-mb-px border-b-2 px-0.5 pb-2 text-[12px] transition-colors",
4699
- _ === "author" ? "border-foreground font-medium text-foreground" : "border-transparent text-muted-foreground hover:text-foreground",
4700
- !C && "cursor-not-allowed opacity-50"
4708
+ O === "author" ? "border-foreground font-medium text-foreground" : "border-transparent text-muted-foreground hover:text-foreground",
4709
+ !w && "cursor-not-allowed opacity-50"
4701
4710
  ),
4702
4711
  onClick: () => {
4703
- C && (X(null), v(u), F("dashboard"), b("author"));
4712
+ w && (X(null), b(u), A("dashboard"), k("author"));
4704
4713
  },
4705
- children: Q ? `Edit ${pe(Q).noun}` : u === "scheduled_report" ? "Schedule report" : "Create briefing"
4714
+ children: M ? `Edit ${pe(M).noun}` : u === "scheduled_report" ? "Schedule report" : "Create briefing"
4706
4715
  }
4707
4716
  ),
4708
4717
  /* @__PURE__ */ t(
@@ -4710,12 +4719,12 @@ function xi({
4710
4719
  {
4711
4720
  type: "button",
4712
4721
  role: "tab",
4713
- "aria-selected": _ === "list",
4722
+ "aria-selected": O === "list",
4714
4723
  className: J(
4715
4724
  "-mb-px border-b-2 px-0.5 pb-2 text-[12px] transition-colors",
4716
- _ === "list" ? "border-foreground font-medium text-foreground" : "border-transparent text-muted-foreground hover:text-foreground"
4725
+ O === "list" ? "border-foreground font-medium text-foreground" : "border-transparent text-muted-foreground hover:text-foreground"
4717
4726
  ),
4718
- onClick: () => b("list"),
4727
+ onClick: () => k("list"),
4719
4728
  children: u === "scheduled_report" ? "Manage reports" : "Manage briefings"
4720
4729
  }
4721
4730
  )
@@ -4733,20 +4742,20 @@ function xi({
4733
4742
  }
4734
4743
  )
4735
4744
  ] }) : null,
4736
- _ === "list" ? /* @__PURE__ */ t(
4745
+ O === "list" ? /* @__PURE__ */ t(
4737
4746
  di,
4738
4747
  {
4739
4748
  briefings: Ke,
4740
4749
  dashboardLabel: Fe,
4741
- sourceView: T,
4750
+ sourceView: _,
4742
4751
  error: ue,
4743
4752
  loading: te,
4744
- onSourceViewChange: F,
4753
+ onSourceViewChange: A,
4745
4754
  onClose: () => D(!1),
4746
- onEdit: (A) => {
4747
- q(A);
4755
+ onEdit: (F) => {
4756
+ W(F);
4748
4757
  },
4749
- onNew: w,
4758
+ onNew: N,
4750
4759
  canCreate: !u && ze.length > 0,
4751
4760
  canCreateScheduledReport: ze.includes(
4752
4761
  "scheduled_report"
@@ -4754,14 +4763,14 @@ function xi({
4754
4763
  analyticalBriefingsEnabled: ze.includes(
4755
4764
  "analytical_briefing"
4756
4765
  ),
4757
- onRunNow: (A) => {
4758
- ee(A);
4766
+ onRunNow: (F) => {
4767
+ ee(F);
4759
4768
  },
4760
- onTogglePause: (A) => {
4761
- me(A);
4769
+ onTogglePause: (F) => {
4770
+ me(F);
4762
4771
  },
4763
- onDelete: (A) => ne(A),
4764
- selectingId: G,
4772
+ onDelete: (F) => ne(F),
4773
+ selectingId: K,
4765
4774
  busyId: ae,
4766
4775
  manageBriefingsHref: l,
4767
4776
  contentKind: u === "scheduled_report" ? "reports" : u === "analytical_briefing" ? "briefings" : void 0,
@@ -4770,25 +4779,25 @@ function xi({
4770
4779
  ) : /* @__PURE__ */ t(
4771
4780
  er,
4772
4781
  {
4773
- apiServiceUrl: $,
4782
+ apiServiceUrl: j,
4774
4783
  token: H,
4775
- briefing: Q,
4776
- initialRunId: _e && (Q == null ? void 0 : Q.id) === _e.briefingId ? _e.runId : void 0,
4777
- intent: S,
4778
- sourceContext: Q ? void 0 : mt,
4779
- title: Q ? `Edit ${pe(Q).noun}` : S === "scheduled_report" ? "Schedule report" : "Create analytical briefing",
4784
+ briefing: M,
4785
+ initialRunId: _e && (M == null ? void 0 : M.id) === _e.briefingId ? _e.runId : void 0,
4786
+ intent: v,
4787
+ sourceContext: M ? void 0 : mt,
4788
+ title: M ? `Edit ${pe(M).noun}` : v === "scheduled_report" ? "Schedule report" : "Create analytical briefing",
4780
4789
  hideHeader: !!u,
4781
4790
  className: "h-full min-h-0 max-w-none border-0 shadow-none",
4782
- onBack: u ? void 0 : () => b("list"),
4791
+ onBack: u ? void 0 : () => k("list"),
4783
4792
  onCancel: () => D(!1),
4784
4793
  onDeleted: () => {
4785
- const A = Q ? pe(Q).noun : "briefing";
4786
- z.success(`${A === "report" ? "Report" : "Briefing"} deleted`), X(null), b("list"), ce();
4794
+ const F = M ? pe(M).noun : "briefing";
4795
+ z.success(`${F === "report" ? "Report" : "Briefing"} deleted`), X(null), k("list"), ce();
4787
4796
  },
4788
4797
  onRunStarted: () => {
4789
4798
  },
4790
- onSaved: (A) => {
4791
- X(A), ce();
4799
+ onSaved: (F) => {
4800
+ X(F), ce();
4792
4801
  },
4793
4802
  onMinimizeRun: () => {
4794
4803
  D(!1);
@@ -4799,33 +4808,33 @@ function xi({
4799
4808
  }
4800
4809
  ),
4801
4810
  /* @__PURE__ */ t(
4802
- wt,
4811
+ St,
4803
4812
  {
4804
4813
  open: !!R,
4805
- onOpenChange: (A) => {
4806
- A || ne(null);
4814
+ onOpenChange: (F) => {
4815
+ F || ne(null);
4807
4816
  },
4808
- children: /* @__PURE__ */ s(St, { children: [
4809
- /* @__PURE__ */ s(kt, { children: [
4810
- /* @__PURE__ */ s(Dt, { children: [
4817
+ children: /* @__PURE__ */ s(kt, { children: [
4818
+ /* @__PURE__ */ s(Dt, { children: [
4819
+ /* @__PURE__ */ s(At, { children: [
4811
4820
  "Delete",
4812
4821
  " ",
4813
4822
  R ? pe(R).noun : "briefing",
4814
4823
  "?"
4815
4824
  ] }),
4816
- /* @__PURE__ */ s(At, { children: [
4825
+ /* @__PURE__ */ s(Ft, { children: [
4817
4826
  "This permanently deletes ",
4818
4827
  /* @__PURE__ */ t("strong", { children: R == null ? void 0 : R.name }),
4819
4828
  ". Recipients will stop receiving it."
4820
4829
  ] })
4821
4830
  ] }),
4822
- /* @__PURE__ */ s(Ft, { children: [
4823
- /* @__PURE__ */ t(Et, { children: "Cancel" }),
4831
+ /* @__PURE__ */ s(Et, { children: [
4832
+ /* @__PURE__ */ t(It, { children: "Cancel" }),
4824
4833
  /* @__PURE__ */ s(
4825
4834
  ua,
4826
4835
  {
4827
4836
  className: "bg-destructive/90 hover:bg-destructive",
4828
- onClick: Ne,
4837
+ onClick: Ce,
4829
4838
  children: [
4830
4839
  "Delete",
4831
4840
  " ",