react-semaphor 0.1.546 → 0.1.547

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 (57) hide show
  1. package/dist/analytics-protocol/index.js +70 -67
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/briefings/index.js +1 -1
  4. package/dist/chunks/applied-constraints-DU-wndZ7.js +47 -0
  5. package/dist/chunks/{assistant-chat-BPXhulAx.js → assistant-chat-CK84cPAB.js} +106 -106
  6. package/dist/chunks/{bookmark-state-C4vetoa0.js → bookmark-state-Cu-a5ie_.js} +2 -8
  7. package/dist/chunks/{custom-visual-inputs-CkJW9pBS.js → custom-visual-inputs-ChL54gGm.js} +1 -1
  8. package/dist/chunks/{dashboard-C3CoKbGY.js → dashboard-DCk26-6i.js} +1 -1
  9. package/dist/chunks/{dashboard-briefing-launcher-Be4h-7My.js → dashboard-briefing-launcher-CQ1eYsGy.js} +528 -528
  10. package/dist/chunks/{dashboard-controls-bxPrlSyp.js → dashboard-controls-BMeZjF7r.js} +45 -45
  11. package/dist/chunks/{dashboard-json-BrjxIiRt.js → dashboard-json-BZqCoanC.js} +1 -1
  12. package/dist/chunks/{document-dashboard-inputs-CRVHpIHp.js → document-dashboard-inputs-tYd7ao0o.js} +94 -94
  13. package/dist/chunks/{edit-dashboard-visual-DYYYDjY6.js → edit-dashboard-visual-Bv3MHM_G.js} +281 -281
  14. package/dist/chunks/{column-catalog-BYnochWQ.js → filter-reach-copy-CGWsL_ez.js} +978 -861
  15. package/dist/chunks/{global-date-filter-utils-9d6m9-FE.js → global-date-filter-utils-BhAu8zIM.js} +4070 -3792
  16. package/dist/chunks/{index-DkQkMKa1.js → index-DmrLP5Ro.js} +30 -30
  17. package/dist/chunks/{raw-temporal-presentation-CBzrDOjM.js → raw-temporal-presentation-DypB7sMX.js} +1 -1
  18. package/dist/chunks/{report-preferences-dialog-4QEZWe5U.js → report-preferences-dialog-DoVyriYC.js} +59 -59
  19. package/dist/chunks/{resolve-dashboard-input-context-UpK_LBpL.js → resolve-dashboard-input-context-D0JDUa4h.js} +1511 -1612
  20. package/dist/chunks/{saved-dashboard-context-D_I3Lxk0.js → saved-dashboard-context-BfAH5j4L.js} +5 -5
  21. package/dist/chunks/{semaphor-ready-indicator-4zpRHE-X.js → semaphor-ready-indicator-CRm17oIP.js} +37137 -36459
  22. package/dist/chunks/{shelf-drop-preview-context-Cfw7TRAx.js → shelf-drop-preview-context-vy6P9THz.js} +80 -80
  23. package/dist/chunks/{table-settings-CunhoDUi.js → table-settings-WysCBj62.js} +133 -124
  24. package/dist/chunks/{use-create-flow-overlay-state-DZBZiiD-.js → use-create-flow-overlay-state-Csx_Xjsh.js} +2 -2
  25. package/dist/dashboard/index.js +2 -2
  26. package/dist/dashboard-authoring/index.js +1419 -1340
  27. package/dist/index.js +14 -14
  28. package/dist/surfboard/index.js +2 -2
  29. package/dist/types/components/surfboard/filter/types.d.ts +7 -0
  30. package/dist/types/components/surfboard/screen-size-preview-button.d.ts +7 -4
  31. package/dist/types/components/visual/matrix-table/matrix-card-view.d.ts +3 -0
  32. package/dist/types/index.js +2 -2
  33. package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-authoring.d.ts +346 -21
  34. package/dist/types/lib/dashboard-inputs/dashboard-filter-value-identity.d.ts +65 -0
  35. package/dist/types/lib/dashboard-inputs/resolve-selection-input.d.ts +3 -3
  36. package/dist/types/lib/hooks/use-dashboard-card.d.ts +2 -0
  37. package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +1 -1
  38. package/dist/types/lib/matrix-table/matrix-runtime-types.d.ts +9 -1
  39. package/dist/types/lib/matrix-table/matrix-runtime.d.ts +5 -1
  40. package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +83 -13
  41. package/dist/types/lib/stores/dashboard-store.d.ts +12 -0
  42. package/dist/types/shared/analytics-protocol/applied-constraints.d.ts +57 -1
  43. package/dist/types/shared/assistant-protocol/context.d.ts +8 -8
  44. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +2 -0
  45. package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +7 -0
  46. package/dist/types/shared/dashboard-authoring/click-to-filter-settings.d.ts +3 -3
  47. package/dist/types/shared/dashboard-authoring/dashboard-filter-automatic-target.d.ts +4 -4
  48. package/dist/types/shared/dashboard-authoring/dashboard-filter-mapping-contract.d.ts +3 -1
  49. package/dist/types/shared/dashboard-authoring/dashboard-filter-mapping-types.d.ts +27 -1
  50. package/dist/types/shared/dashboard-authoring/dashboard-filter-value-compatibility.d.ts +12 -3
  51. package/dist/types/shared/dashboard-authoring/filter-reach-copy.d.ts +18 -0
  52. package/dist/types/shared/dashboard-authoring/filter-reach-preview.d.ts +97 -0
  53. package/dist/types/shared/dashboard-authoring/index.d.ts +5 -1
  54. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +7 -0
  55. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +26 -4
  56. package/dist/types/shared/dashboard-authoring/semantic-auto-join-card.d.ts +22 -0
  57. package/package.json +1 -1
@@ -1,74 +1,74 @@
1
- var Rt = Object.defineProperty;
2
- var Et = (e, t, a) => t in e ? Rt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
3
- var Te = (e, t, a) => Et(e, typeof t != "symbol" ? t + "" : t, a);
4
- import { D as at, r as gt, b as Ot, c as Nt, a as st, d as qt } from "../chunks/column-catalog-BYnochWQ.js";
5
- import { N as bi, f as Ii, j as yi, l as _i, k as Ci, u as Si, q as vi, e as xi, i as wi, s as Di, t as Ti, m as ki, n as $i, p as Fi, g as Ai, o as Ri, h as Ei } from "../chunks/column-catalog-BYnochWQ.js";
6
- import { M as Pt, N as Mt, O as ke, P as Lt, Q as Bt, R as Vt, S as Gt, T as Ut, U as jt, V as zt, W as Qt, X as de, Y as Kt, Z as Wt, _ as ve, $ as Ht, a0 as Yt, a1 as Me, a2 as bt, a3 as oe, a4 as ne, a5 as Re, a6 as Xt, a7 as Le, a8 as Jt, a9 as Zt, aa as ea, ab as it, ac as ta, ad as aa, ae as It, af as ie, ag as nt, ah as sa, ai as ia, aj as Ee, ak as na, al as ot, am as oa, an as rt, ao as ra, ap as ce, aq as da, ar as dt, b as la, as as ca, at as ua, au as fa, av as ha, aw as lt, ax as pa, ay as ma, az as ga, aA as ba, aB as Ia, aC as ya, aD as _a, aE as Ca, aF as Sa, aG as $e, aH as va } from "../chunks/global-date-filter-utils-9d6m9-FE.js";
7
- import { cs as Ni, aR as qi, c3 as Pi, c4 as Mi, cj as Li, ci as Bi, cc as Vi, ck as Gi, cl as Ui, bJ as ji, bK as zi, bL as Qi, bG as Ki, bH as Wi, bI as Hi, bC as Yi, bD as Xi, bF as Ji, bE as Zi, bM as en, cF as tn, c5 as an, b2 as sn, b1 as nn, bZ as on, cu as rn, bc as dn, cy as ln, cg as cn, ch as un, aO as fn, cx as hn, bf as pn, cv as mn, bt as gn, cb as bn, bN as In, bu as yn, cH as _n, aJ as Cn, cz as Sn, cf as vn, aK as xn, bY as wn, bX as Dn, b6 as Tn, aZ as kn, cD as $n, bo as Fn, d as An, a as Rn, bg as En, aL as On, cr as Nn, a_ as qn, a$ as Pn, b0 as Mn, bb as Ln, bd as Bn, c0 as Vn, g as Gn, bB as Un, bk as jn, bA as zn, bx as Qn, c1 as Kn, aT as Wn, aU as Hn, cB as Yn, bh as Xn, b3 as Jn, cd as Zn, b8 as eo, cp as to, bm as ao, bT as so, aP as io, bV as no, bW as oo, cE as ro, br as lo, bj as co, bl as uo, b7 as fo, bn as ho, cm as po, cA as mo, aM as go, ct as bo, bq as Io, b4 as yo, bw as _o, cn as Co, b_ as So, b$ as vo, aS as xo, cG as wo, c2 as Do, c9 as To, bz as ko, aW as $o, co as Fo, cC as Ao, cq as Ro, bs as Eo, b5 as Oo, bP as No, aY as qo, c6 as Po, c7 as Mo, aX as Lo, bR as Bo, bS as Vo, bQ as Go, aV as Uo, by as jo, c8 as zo, bp as Qo, ce as Ko, aI as Wo, bv as Ho, bU as Yo, aQ as Xo, cw as Jo, be as Zo, bi as er, aN as tr, bO as ar, ba as sr, b9 as ir, ca as nr } from "../chunks/global-date-filter-utils-9d6m9-FE.js";
8
- import { x as xa, ao as Be, ap as wa, a3 as yt, ab as Da, a6 as Ta, ad as _t, aD as ka, aB as Ct, aC as $a } from "../chunks/validators-C-aOQlTB.js";
1
+ var Ot = Object.defineProperty;
2
+ var Nt = (e, t, a) => t in e ? Ot(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
3
+ var ke = (e, t, a) => Nt(e, typeof t != "symbol" ? t + "" : t, a);
4
+ import { D as it, r as It, b as qt, c as Pt, a as nt, d as Mt } from "../chunks/filter-reach-copy-CGWsL_ez.js";
5
+ import { N as yi, R as _i, f as Ci, j as Si, l as vi, k as wi, u as xi, q as Di, e as Ti, i as ki, y as $i, z as Fi, s as Ai, v as Ri, t as Ei, m as Oi, n as Ni, p as qi, g as Pi, o as Mi, h as Li, x as Bi, w as Vi } from "../chunks/filter-reach-copy-CGWsL_ez.js";
6
+ import { M as Lt, N as Bt, O as $e, P as Vt, Q as Gt, R as Ut, S as jt, T as zt, U as Qt, V as Kt, W as Ht, X as Wt, Y as de, Z as Yt, _ as Xt, $ as fe, a0 as Jt, a1 as Zt, a2 as Me, a3 as yt, a4 as oe, a5 as ne, a6 as Ee, a7 as ea, a8 as Le, a9 as ta, aa, ab as sa, ac as ot, ad as ia, ae as na, af as _t, ag as ie, ah as rt, ai as oa, aj as ra, ak as Oe, al as da, am as dt, an as la, ao as lt, ap as ca, aq as ce, ar as ua, as as ct, b as ha, at as fa, au as pa, av as ma, aw as ga, ax as ut, ay as ba, az as Ia, aA as ya, aB as _a, aC as Ca, aD as Sa, aE as va, aF as wa, aG as xa, aH as Fe, aI as Da } from "../chunks/global-date-filter-utils-BhAu8zIM.js";
7
+ import { cx as Ui, aT as ji, c8 as zi, c9 as Qi, co as Ki, cn as Hi, ch as Wi, cp as Yi, cq as Xi, bO as Ji, bP as Zi, bQ as en, bL as tn, bM as an, bN as sn, bH as nn, bI as on, bK as rn, bJ as dn, bR as ln, cK as cn, ca as un, b7 as hn, b6 as fn, c2 as pn, cz as mn, bh as gn, cD as bn, cl as In, cm as yn, aQ as _n, cC as Cn, bk as Sn, cA as vn, by as wn, cg as xn, bS as Dn, bz as Tn, cM as kn, aL as $n, cE as Fn, ck as An, aM as Rn, c1 as En, c0 as On, bb as Nn, a$ as qn, b3 as Pn, cI as Mn, bt as Ln, d as Bn, a as Vn, bl as Gn, aN as Un, cw as jn, cO as zn, b0 as Qn, b1 as Kn, b2 as Hn, bg as Wn, bi as Yn, c5 as Xn, g as Jn, bG as Zn, bp as eo, bF as to, bC as ao, c6 as so, aV as io, aW as no, cG as oo, bm as ro, b8 as lo, ci as co, bd as uo, cu as ho, br as fo, bY as po, cN as mo, aR as go, b_ as bo, b$ as Io, cJ as yo, bw as _o, bo as Co, bq as So, bc as vo, bs as wo, cr as xo, cF as Do, aO as To, cy as ko, bv as $o, b9 as Fo, bB as Ao, cs as Ro, c3 as Eo, c4 as Oo, aU as No, cL as qo, c7 as Po, ce as Mo, bE as Lo, aY as Bo, ct as Vo, cH as Go, aJ as Uo, cv as jo, bx as zo, ba as Qo, bU as Ko, a_ as Ho, b4 as Wo, b5 as Yo, cb as Xo, cc as Jo, aZ as Zo, bW as er, bX as tr, bV as ar, aX as sr, bD as ir, cd as nr, bu as or, cj as rr, aK as dr, bA as lr, bZ as cr, aS as ur, cB as hr, bj as fr, bn as pr, aP as mr, bT as gr, bf as br, be as Ir, cf as yr } from "../chunks/global-date-filter-utils-BhAu8zIM.js";
8
+ import { x as Ta, ao as Be, ap as ka, a3 as Ct, ab as $a, a6 as Fa, ad as St, aD as Aa, aB as vt, aC as Ra } from "../chunks/validators-C-aOQlTB.js";
9
9
  import "../chunks/matrix-operation-contract-D6vYkZK4.js";
10
10
  import "../chunks/analytics-base-schemas-BKs3flFS.js";
11
11
  import "zod";
12
- import { a as Fa, r as Aa } from "../chunks/index-CtoK1Lgu.js";
13
- import { n as Ra } from "../chunks/operators-B3zZoskU.js";
14
- import { a as rr, b as dr, r as lr } from "../chunks/raw-temporal-presentation-CBzrDOjM.js";
15
- import { w as re } from "../chunks/table-settings-CunhoDUi.js";
16
- import { D as ur, x as fr, y as hr, F as pr, B as mr, z as gr, G as br, A as Ir, v as yr } from "../chunks/table-settings-CunhoDUi.js";
17
- import { v as Ea, w as Oe, x as Oa } from "../chunks/resolve-dashboard-input-context-UpK_LBpL.js";
18
- import { M as Cr, S as Sr, N as vr, b as xr, Q as wr, L as Dr, A as Tr, T as kr, U as $r, P as Fr, F as Ar, G as Rr, J as Er, K as Or, I as Nr, y as qr, z as Pr, p as Mr, R as Lr, H as Br, B as Vr, C as Gr, D as Ur, O as jr, E as zr } from "../chunks/resolve-dashboard-input-context-UpK_LBpL.js";
19
- import { G as Kr, F as Wr, D as Hr, E as Yr, H as Xr, I as Jr } from "../chunks/pivot-result-lifecycle-pwq3b7LC.js";
20
- import { e as Na, w as qa } from "../chunks/metric-comparison-zpGw4lD6.js";
21
- import { p as Pa } from "../chunks/report-runtime-context-hWiTCzFV.js";
22
- import { m as ed, a as td, r as ad } from "../chunks/matrix-card-LiMEipvq.js";
23
- import { n as ct, t as Ma } from "../chunks/matrix-analytical-definition-B9vW-osb.js";
12
+ import { a as Ea, r as Oa } from "../chunks/index-CtoK1Lgu.js";
13
+ import { n as Na } from "../chunks/operators-B3zZoskU.js";
14
+ import { a as Cr, b as Sr, r as vr } from "../chunks/raw-temporal-presentation-DypB7sMX.js";
15
+ import { w as re } from "../chunks/table-settings-WysCBj62.js";
16
+ import { D as xr, x as Dr, y as Tr, F as kr, B as $r, z as Fr, G as Ar, A as Rr, v as Er } from "../chunks/table-settings-WysCBj62.js";
17
+ import { v as ve, w as qa } from "../chunks/resolve-dashboard-input-context-D0JDUa4h.js";
18
+ import { J as Nr, P as qr, K as Pr, b as Mr, N as Lr, I as Br, z as Vr, Q as Gr, R as Ur, M as jr, C as zr, D as Qr, G as Kr, H as Hr, F as Wr, x as Yr, y as Xr, p as Jr, O as Zr, E as ed, A as td, L as ad, B as sd } from "../chunks/resolve-dashboard-input-context-D0JDUa4h.js";
19
+ import { G as nd, F as od, D as rd, E as dd, H as ld, I as cd } from "../chunks/pivot-result-lifecycle-pwq3b7LC.js";
20
+ import { e as Pa, w as Ma } from "../chunks/metric-comparison-zpGw4lD6.js";
21
+ import { p as La } from "../chunks/report-runtime-context-hWiTCzFV.js";
22
+ import { m as hd, a as fd, r as pd } from "../chunks/matrix-card-LiMEipvq.js";
23
+ import { n as ht, t as Ba } from "../chunks/matrix-analytical-definition-B9vW-osb.js";
24
24
  import "../chunks/index-CuHybtft.js";
25
25
  import "../value-format-preferences/index.js";
26
26
  import "../chunks/_commonjsHelpers-DimLPMtv.js";
27
- function H(e) {
27
+ function Y(e) {
28
28
  return e && typeof e == "object" ? e : null;
29
29
  }
30
30
  function Z(e) {
31
31
  return typeof e == "string" ? e : null;
32
32
  }
33
- function La(e) {
33
+ function Va(e) {
34
34
  var t, a, s;
35
- return !!(e && typeof e == "object") && (((t = H(e)) == null ? void 0 : t.kind) === "semantic" || ((a = H(e)) == null ? void 0 : a.kind) === "physical" || ((s = H(e)) == null ? void 0 : s.kind) === "sql");
35
+ return !!(e && typeof e == "object") && (((t = Y(e)) == null ? void 0 : t.kind) === "semantic" || ((a = Y(e)) == null ? void 0 : a.kind) === "physical" || ((s = Y(e)) == null ? void 0 : s.kind) === "sql");
36
36
  }
37
- function pe(e) {
38
- return La(e) ? e.kind === "semantic" ? !!(e.domainId && e.datasetName) : e.kind === "physical" ? !!(e.connectionId && e.tableName) : !1 : !1;
37
+ function me(e) {
38
+ return Va(e) ? e.kind === "semantic" ? !!(e.domainId && e.datasetName) : e.kind === "physical" ? !!(e.connectionId && e.tableName) : !1 : !1;
39
39
  }
40
- function si(e) {
41
- return xa(e);
40
+ function ni(e) {
41
+ return Ta(e);
42
42
  }
43
- function St(e, t) {
43
+ function wt(e, t) {
44
44
  return Be(e, t);
45
45
  }
46
- function Ba(e, t) {
47
- return wa(e, t);
46
+ function Ga(e, t) {
47
+ return ka(e, t);
48
48
  }
49
- function xe(e) {
49
+ function we(e) {
50
50
  const t = [];
51
51
  for (const a of e) {
52
52
  const s = t.findIndex(
53
- (d) => St(d, a)
53
+ (r) => wt(r, a)
54
54
  );
55
- s === -1 ? t.push(a) : t[s] = Ba(
55
+ s === -1 ? t.push(a) : t[s] = Ga(
56
56
  t[s],
57
57
  a
58
58
  );
59
59
  }
60
60
  return t;
61
61
  }
62
- function ii(e) {
63
- return xe(e)[0];
62
+ function oi(e) {
63
+ return we(e)[0];
64
64
  }
65
65
  function Ne(e, t) {
66
66
  return e.kind !== "semantic" || e.connectionId || (t == null ? void 0 : t.kind) !== "semantic" || !Be(e, t) || !t.connectionId ? e : { ...e, connectionId: t.connectionId };
67
67
  }
68
68
  function qe(e) {
69
- return pe(e) ? e : void 0;
69
+ return me(e) ? e : void 0;
70
70
  }
71
- function ut(e, t) {
71
+ function ft(e, t) {
72
72
  if (!(e.kind !== "semantic" || e.connectionId))
73
73
  return t.find(
74
74
  (a) => (a == null ? void 0 : a.kind) === "semantic" && Be(e, a) && !!a.connectionId
@@ -78,72 +78,72 @@ function J(e, t) {
78
78
  const a = qe(e == null ? void 0 : e.source);
79
79
  return a ? Ne(a, t) : void 0;
80
80
  }
81
- function Va({
81
+ function Ua({
82
82
  explicitSource: e,
83
83
  field: t,
84
84
  defaultSource: a,
85
85
  fallbackSources: s
86
86
  }) {
87
- const d = [a, ...s || []], i = qe(e), n = i ? Ne(
88
- i,
89
- ut(i, d)
87
+ const r = [a, ...s || []], n = qe(e), i = n ? Ne(
88
+ n,
89
+ ft(n, r)
90
90
  ) : void 0;
91
- if (n)
92
- return n;
91
+ if (i)
92
+ return i;
93
93
  if (e !== void 0)
94
94
  return;
95
- const o = J(t, a), p = o ? Ne(
96
- o,
97
- ut(o, d)
95
+ const d = J(t, a), u = d ? Ne(
96
+ d,
97
+ ft(d, r)
98
98
  ) : void 0;
99
- if (p)
100
- return p;
99
+ if (u)
100
+ return u;
101
101
  if ((t == null ? void 0 : t.source) === void 0)
102
102
  return qe(a);
103
103
  }
104
- function ni(e, t) {
104
+ function ri(e, t) {
105
105
  if (!(e != null && e.name) || !(t != null && t.name) || e.name !== t.name)
106
106
  return !1;
107
107
  const a = J(e), s = J(t);
108
- return !a || !s ? !0 : St(a, s);
108
+ return !a || !s ? !0 : wt(a, s);
109
109
  }
110
110
  function se(e) {
111
111
  var t;
112
- return Z((t = H(e)) == null ? void 0 : t.kind);
112
+ return Z((t = Y(e)) == null ? void 0 : t.kind);
113
113
  }
114
- function vt(e) {
114
+ function xt(e) {
115
115
  var t, a;
116
- return se(e) !== "semantic" ? null : ((a = Z((t = H(e)) == null ? void 0 : t.domainId)) == null ? void 0 : a.trim()) || null;
117
- }
118
- function Ga(e) {
119
- var t;
120
- return se(e) !== "semantic" ? null : Z((t = H(e)) == null ? void 0 : t.datasetName);
121
- }
122
- function Ua(e) {
123
- var t;
124
- return se(e) !== "semantic" ? null : Z((t = H(e)) == null ? void 0 : t.datasetId);
116
+ return se(e) !== "semantic" ? null : ((a = Z((t = Y(e)) == null ? void 0 : t.domainId)) == null ? void 0 : a.trim()) || null;
125
117
  }
126
118
  function ja(e) {
127
119
  var t;
128
- return se(e) !== "physical" ? null : Z((t = H(e)) == null ? void 0 : t.connectionId);
120
+ return se(e) !== "semantic" ? null : Z((t = Y(e)) == null ? void 0 : t.datasetName);
129
121
  }
130
122
  function za(e) {
131
123
  var t;
132
- return se(e) !== "physical" ? null : Z((t = H(e)) == null ? void 0 : t.tableName);
124
+ return se(e) !== "semantic" ? null : Z((t = Y(e)) == null ? void 0 : t.datasetId);
133
125
  }
134
126
  function Qa(e) {
135
127
  var t;
136
- return se(e) !== "physical" ? "" : Z((t = H(e)) == null ? void 0 : t.databaseName) || "";
128
+ return se(e) !== "physical" ? null : Z((t = Y(e)) == null ? void 0 : t.connectionId);
137
129
  }
138
130
  function Ka(e) {
139
131
  var t;
140
- return se(e) !== "physical" ? "" : Z((t = H(e)) == null ? void 0 : t.schemaName) || "";
132
+ return se(e) !== "physical" ? null : Z((t = Y(e)) == null ? void 0 : t.tableName);
133
+ }
134
+ function Ha(e) {
135
+ var t;
136
+ return se(e) !== "physical" ? "" : Z((t = Y(e)) == null ? void 0 : t.databaseName) || "";
141
137
  }
142
138
  function Wa(e) {
139
+ var t;
140
+ return se(e) !== "physical" ? "" : Z((t = Y(e)) == null ? void 0 : t.schemaName) || "";
141
+ }
142
+ function Ya(e) {
143
143
  if (e.analyticsIntent && typeof e.analyticsIntent == "object" && "source" in e.analyticsIntent)
144
144
  return e.analyticsIntent.source;
145
145
  }
146
- function Ha({
146
+ function Xa({
147
147
  datasets: e,
148
148
  requireAtLeastOne: t
149
149
  }) {
@@ -151,24 +151,24 @@ function Ha({
151
151
  return { ok: !1, issue: "invalid_dataset_count" };
152
152
  if (e.length <= 1)
153
153
  return { ok: !0 };
154
- const a = e.map(vt), s = new Set(a.filter(Boolean));
155
- return a.some((d) => !d) || s.size !== 1 ? { ok: !1, issue: "invalid_multi_dataset_scope" } : { ok: !0 };
154
+ const a = e.map(xt), s = new Set(a.filter(Boolean));
155
+ return a.some((r) => !r) || s.size !== 1 ? { ok: !1, issue: "invalid_multi_dataset_scope" } : { ok: !0 };
156
156
  }
157
157
  function Ve(e, t) {
158
158
  if (!t)
159
159
  return !1;
160
160
  if (t.kind === "semantic") {
161
- const a = Ua(e);
162
- return vt(e) === t.domainId ? a && t.datasetId ? a === t.datasetId : Ga(e) === t.datasetName : !1;
161
+ const a = za(e);
162
+ return xt(e) === t.domainId ? a && t.datasetId ? a === t.datasetId : ja(e) === t.datasetName : !1;
163
163
  }
164
- return t.kind === "physical" ? ja(e) === t.connectionId && za(e) === t.tableName && Qa(e) === (t.databaseName || "") && Ka(e) === (t.schemaName || "") : !1;
164
+ return t.kind === "physical" ? Qa(e) === t.connectionId && Ka(e) === t.tableName && Ha(e) === (t.databaseName || "") && Wa(e) === (t.schemaName || "") : !1;
165
165
  }
166
- function oi(e, t) {
166
+ function di(e, t) {
167
167
  return e.find(
168
168
  (a) => Ve(a, t)
169
169
  );
170
170
  }
171
- function P(e, t, a) {
171
+ function M(e, t, a) {
172
172
  return a ? { code: e, message: t, cardId: a } : { code: e, message: t };
173
173
  }
174
174
  function ye(e) {
@@ -180,19 +180,19 @@ function ye(e) {
180
180
  }
181
181
  return null;
182
182
  }
183
- function Ya({
183
+ function Ja({
184
184
  card: e,
185
185
  datasets: t,
186
186
  errors: a
187
187
  }) {
188
188
  if (e.type === "text")
189
189
  return;
190
- const s = Wa(e);
190
+ const s = Ya(e);
191
191
  if (!s) {
192
192
  if (t.length <= 1)
193
193
  return;
194
194
  a.push(
195
- P(
195
+ M(
196
196
  "missing_card_analytics_source",
197
197
  "Multi-dataset dashboard cards must include analytics intent with a source so the materializer can choose the correct dataset.",
198
198
  e.id
@@ -200,8 +200,8 @@ function Ya({
200
200
  );
201
201
  return;
202
202
  }
203
- t.some((d) => Ve(d, s)) || a.push(
204
- P(
203
+ t.some((r) => Ve(r, s)) || a.push(
204
+ M(
205
205
  "invalid_card_analytics_source",
206
206
  "Dashboard cards with an explicit analytics source must use one of the selected datasets.",
207
207
  e.id
@@ -211,35 +211,35 @@ function Ya({
211
211
  function _e(e) {
212
212
  return e.map((t) => t == null ? void 0 : t.source).filter((t) => !!t);
213
213
  }
214
- function Fe(e) {
214
+ function Ae(e) {
215
215
  return Array.isArray(e) ? e.filter(
216
216
  (t) => !!(t && typeof t == "object")
217
217
  ) : [];
218
218
  }
219
- function ft(e) {
219
+ function pt(e) {
220
220
  return Array.isArray(e) ? e.filter(
221
221
  (t) => !!(t && typeof t == "object")
222
222
  ) : [];
223
223
  }
224
- function Xa(e) {
224
+ function Za(e) {
225
225
  var a, s;
226
226
  if (!e)
227
227
  return [];
228
228
  const t = [e.source];
229
229
  return e.kind === "metric" ? t.push(
230
230
  ..._e([
231
- ...Fe(e.measures),
231
+ ...Ae(e.measures),
232
232
  e.primaryMeasure,
233
233
  e.dateField,
234
- ...Fe(e.dimensions),
235
- ...ft(e.filters).map((d) => d.field)
234
+ ...Ae(e.dimensions),
235
+ ...pt(e.filters).map((r) => r.field)
236
236
  ])
237
237
  ) : e.kind === "records" ? t.push(
238
238
  ..._e([
239
- ...Fe(e.fields),
239
+ ...Ae(e.fields),
240
240
  e.dateField,
241
241
  (a = e.orderBy) == null ? void 0 : a.field,
242
- ...ft(e.filters).map((d) => d.field)
242
+ ...pt(e.filters).map((r) => r.field)
243
243
  ])
244
244
  ) : e.kind === "inputOptions" ? (((s = e.population) == null ? void 0 : s.kind) === "related_population" && t.push(e.population.baseSource), t.push(
245
245
  ..._e([
@@ -250,18 +250,18 @@ function Xa(e) {
250
250
  ])
251
251
  )) : e.kind === "sql" && t.push(..._e(e.fields || [])), t;
252
252
  }
253
- function Ja({
253
+ function es({
254
254
  card: e,
255
255
  datasets: t,
256
256
  errors: a
257
257
  }) {
258
258
  if (e.type !== "text") {
259
- for (const s of Xa(e.analyticsIntent))
259
+ for (const s of Za(e.analyticsIntent))
260
260
  if (s && !t.some(
261
- (d) => Ve(d, s)
261
+ (r) => Ve(r, s)
262
262
  )) {
263
263
  a.push(
264
- P(
264
+ M(
265
265
  "invalid_card_query_source",
266
266
  "Dashboard card query field references must use one of the selected datasets.",
267
267
  e.id
@@ -271,36 +271,36 @@ function Ja({
271
271
  }
272
272
  }
273
273
  }
274
- function Za({
274
+ function ts({
275
275
  card: e,
276
276
  errors: t
277
277
  }) {
278
278
  if (e.type === "text" || !e.analyticsIntent)
279
279
  return;
280
- const a = yt(e.analyticsIntent);
280
+ const a = Ct(e.analyticsIntent);
281
281
  if (!a.ok)
282
282
  for (const s of a.errors)
283
283
  t.push(
284
- P(
284
+ M(
285
285
  s.code,
286
286
  s.path ? `${s.path}: ${s.message}` : s.message,
287
287
  e.id
288
288
  )
289
289
  );
290
290
  }
291
- function es({
291
+ function as({
292
292
  datasets: e,
293
293
  errors: t,
294
294
  requireAtLeastOne: a
295
295
  }) {
296
- const s = Ha({
296
+ const s = Xa({
297
297
  datasets: e,
298
298
  requireAtLeastOne: a
299
299
  });
300
300
  if (!s.ok) {
301
301
  if (s.issue === "invalid_dataset_count") {
302
302
  t.push(
303
- P(
303
+ M(
304
304
  "invalid_dataset_count",
305
305
  "Dashboard authoring requires at least one selected dataset."
306
306
  )
@@ -308,57 +308,57 @@ function es({
308
308
  return;
309
309
  }
310
310
  t.push(
311
- P(
311
+ M(
312
312
  "invalid_multi_dataset_scope",
313
313
  "Multi-dataset dashboard authoring is limited to semantic datasets from one domain."
314
314
  )
315
315
  );
316
316
  }
317
317
  }
318
- function ts({
318
+ function ss({
319
319
  input: e,
320
320
  errors: t
321
321
  }) {
322
322
  var a;
323
323
  (a = e.filter.sql) != null && a.trim() && t.push(
324
- P(
324
+ M(
325
325
  "generated_filter_sql_out_of_scope",
326
326
  `Generated dashboard filter "${e.label}" must use grounded filter configuration; custom SQL is outside the dashboard-authoring contract.`
327
327
  )
328
328
  );
329
329
  }
330
- function as({
330
+ function is({
331
331
  card: e,
332
332
  errors: t
333
333
  }) {
334
334
  "interactionConfig" in e && t.push(
335
- P(
335
+ M(
336
336
  "legacy_card_interactions_unsupported",
337
337
  "Dashboard authoring accepts click-to-filter settings only through card.clickToFilter.",
338
338
  e.id
339
339
  )
340
- ), e.clickToFilter !== void 0 && !Pt.safeParse(e.clickToFilter).success && t.push(
341
- P(
340
+ ), e.clickToFilter !== void 0 && !Lt.safeParse(e.clickToFilter).success && t.push(
341
+ M(
342
342
  "invalid_click_to_filter",
343
343
  "Dashboard card clickToFilter settings do not match the canonical schema.",
344
344
  e.id
345
345
  )
346
- ), e.respondsToSelections !== void 0 && !Mt.safeParse(e.respondsToSelections).success && t.push(
347
- P(
346
+ ), e.respondsToSelections !== void 0 && !Bt.safeParse(e.respondsToSelections).success && t.push(
347
+ M(
348
348
  "invalid_responds_to_selections",
349
349
  "Dashboard card respondsToSelections must be a boolean.",
350
350
  e.id
351
351
  )
352
352
  );
353
353
  }
354
- function ss(e) {
355
- var m, f;
354
+ function ns(e) {
355
+ var A, c;
356
356
  const t = [];
357
357
  if (!e || typeof e != "object")
358
358
  return {
359
359
  ok: !1,
360
360
  errors: [
361
- P(
361
+ M(
362
362
  "invalid_plan",
363
363
  "Dashboard plan must be a structured object."
364
364
  )
@@ -366,102 +366,102 @@ function ss(e) {
366
366
  warnings: []
367
367
  };
368
368
  const a = e, s = [...a.warnings || []];
369
- a.version !== 1 && t.push(P("invalid_version", "Dashboard plan version must be 1.")), (m = a.title) != null && m.trim() || t.push(P("missing_title", "Dashboard plan needs a title."));
370
- const d = Array.isArray(a.datasets) ? a.datasets : [], i = Array.isArray(a.sheets) ? a.sheets : [];
371
- es({ datasets: d, errors: t, requireAtLeastOne: !0 }), i.length !== 1 && t.push(
372
- P(
369
+ a.version !== 1 && t.push(M("invalid_version", "Dashboard plan version must be 1.")), (A = a.title) != null && A.trim() || t.push(M("missing_title", "Dashboard plan needs a title."));
370
+ const r = Array.isArray(a.datasets) ? a.datasets : [], n = Array.isArray(a.sheets) ? a.sheets : [];
371
+ as({ datasets: r, errors: t, requireAtLeastOne: !0 }), n.length !== 1 && t.push(
372
+ M(
373
373
  "invalid_sheet_count",
374
374
  "MVP dashboard authoring creates exactly one dashboard sheet."
375
375
  )
376
376
  );
377
- const n = i[0];
378
- n && n.kind !== "dashboard" && t.push(
379
- P("invalid_sheet_kind", 'Generated sheet must use kind "dashboard".')
377
+ const i = n[0];
378
+ i && i.kind !== "dashboard" && t.push(
379
+ M("invalid_sheet_kind", 'Generated sheet must use kind "dashboard".')
380
380
  );
381
- const o = (n == null ? void 0 : n.cards) || [];
382
- o.length > at && t.push(
383
- P(
381
+ const d = (i == null ? void 0 : i.cards) || [];
382
+ d.length > it && t.push(
383
+ M(
384
384
  "too_many_cards",
385
- `Generated dashboards can contain at most ${at} cards.`
385
+ `Generated dashboards can contain at most ${it} cards.`
386
386
  )
387
387
  );
388
- const p = ye(o.map((b) => b.id));
389
- p && t.push(
390
- P("duplicate_card_id", `Duplicate generated card id: ${p}.`)
388
+ const u = ye(d.map((m) => m.id));
389
+ u && t.push(
390
+ M("duplicate_card_id", `Duplicate generated card id: ${u}.`)
391
391
  );
392
- const y = ye(o.map((b) => b.frameId));
393
- y && t.push(
394
- P(
392
+ const b = ye(d.map((m) => m.frameId));
393
+ b && t.push(
394
+ M(
395
395
  "duplicate_frame_id",
396
- `Duplicate generated frame id: ${y}.`
396
+ `Duplicate generated frame id: ${b}.`
397
397
  )
398
398
  );
399
- for (const b of o)
400
- (f = b.title) != null && f.trim() || t.push(P("missing_card_title", "Card title is required.", b.id)), b.type === "custom" && t.push(
401
- P(
399
+ for (const m of d)
400
+ (c = m.title) != null && c.trim() || t.push(M("missing_card_title", "Card title is required.", m.id)), m.type === "custom" && t.push(
401
+ M(
402
402
  "custom_visual_out_of_scope",
403
403
  "Whole-dashboard authoring supports built-in visual types only.",
404
- b.id
404
+ m.id
405
405
  )
406
- ), b.type !== "text" && !b.analyticsIntent && s.push(
407
- P(
406
+ ), m.type !== "text" && !m.analyticsIntent && s.push(
407
+ M(
408
408
  "missing_analytics_intent",
409
409
  "Non-text card has no analytics intent and may be skipped by the app layer.",
410
- b.id
410
+ m.id
411
411
  )
412
- ), Ya({ card: b, datasets: d, errors: t }), Za({ card: b, errors: t }), Ja({ card: b, datasets: d, errors: t }), as({ card: b, errors: t });
413
- const _ = Array.isArray(a.filterInputs) ? a.filterInputs : [], g = _.map((b) => b.id), C = ye(g);
414
- C && t.push(
415
- P(
412
+ ), Ja({ card: m, datasets: r, errors: t }), ts({ card: m, errors: t }), es({ card: m, datasets: r, errors: t }), is({ card: m, errors: t });
413
+ const y = Array.isArray(a.filterInputs) ? a.filterInputs : [], C = y.map((m) => m.id), p = ye(C);
414
+ p && t.push(
415
+ M(
416
416
  "duplicate_input_id",
417
- `Duplicate dashboard input id: ${C}.`
417
+ `Duplicate dashboard input id: ${p}.`
418
418
  )
419
419
  );
420
- const w = _.map((b) => b.variableName).filter(Boolean) || [], c = ye(w);
421
- c && t.push(
422
- P(
420
+ const $ = y.map((m) => m.variableName).filter(Boolean) || [], _ = ye($);
421
+ _ && t.push(
422
+ M(
423
423
  "duplicate_input_variable",
424
- `Duplicate dashboard input variable name: ${c}.`
424
+ `Duplicate dashboard input variable name: ${_}.`
425
425
  )
426
426
  );
427
- for (const b of _)
428
- ts({ input: b, errors: t });
429
- const R = Array.isArray(a.calculatedFields) ? a.calculatedFields : [];
430
- for (const b of R)
431
- b.scope === "domain" && b.reuseOnly !== !0 && t.push(
432
- P(
427
+ for (const m of y)
428
+ ss({ input: m, errors: t });
429
+ const g = Array.isArray(a.calculatedFields) ? a.calculatedFields : [];
430
+ for (const m of g)
431
+ m.scope === "domain" && m.reuseOnly !== !0 && t.push(
432
+ M(
433
433
  "domain_calculated_field_create_out_of_scope",
434
- `Creating domain calculated field "${b.name}" is outside MVP.`
434
+ `Creating domain calculated field "${m.name}" is outside MVP.`
435
435
  )
436
436
  );
437
437
  return { ok: t.length === 0, errors: t, warnings: s };
438
438
  }
439
- function is(e) {
440
- const t = Da(e);
439
+ function os(e) {
440
+ const t = $a(e);
441
441
  return t === "datetime" ? "date" : t === "unknown" ? "string" : t;
442
442
  }
443
- function ns(e) {
443
+ function rs(e) {
444
444
  return !!(e && typeof e == "object" && !Array.isArray(e));
445
445
  }
446
- function os(e) {
447
- return ns(e) && typeof e.filterId == "string" && typeof e.operation == "string" && Array.isArray(e.values);
446
+ function ds(e) {
447
+ return rs(e) && typeof e.filterId == "string" && typeof e.operation == "string" && Array.isArray(e.values);
448
448
  }
449
- function rs(e) {
449
+ function ls(e) {
450
450
  return e.filter(
451
451
  (t) => typeof t == "string" || typeof t == "number"
452
452
  );
453
453
  }
454
- function ds(e) {
454
+ function cs(e) {
455
455
  return e.filter(
456
456
  (t) => t instanceof Date || typeof t == "string"
457
457
  );
458
458
  }
459
- function xt(e, t) {
459
+ function Dt(e, t) {
460
460
  if (t === void 0)
461
461
  return;
462
- const a = is(e.dataType), s = e.operation || "in";
463
- if (os(t))
464
- return ke({
462
+ const a = os(e.dataType), s = e.operation || "in";
463
+ if (ds(t))
464
+ return $e({
465
465
  definition: e,
466
466
  sourceValue: t,
467
467
  value: {
@@ -475,7 +475,7 @@ function xt(e, t) {
475
475
  }
476
476
  });
477
477
  if (s === "is null" || s === "is not null")
478
- return ke({
478
+ return $e({
479
479
  definition: e,
480
480
  value: {
481
481
  filterId: e.id,
@@ -488,29 +488,29 @@ function xt(e, t) {
488
488
  semanticContext: e.semanticContext
489
489
  }
490
490
  });
491
- const d = Array.isArray(t) ? t : [t], i = a === "date" ? ds(d) : rs(d);
492
- if (i.length !== 0 && !((s === "between" || s === "not between") && i.length < 2))
493
- return ke({
491
+ const r = Array.isArray(t) ? t : [t], n = a === "date" ? cs(r) : ls(r);
492
+ if (n.length !== 0 && !((s === "between" || s === "not between") && n.length < 2))
493
+ return $e({
494
494
  definition: e,
495
495
  value: {
496
496
  filterId: e.id,
497
497
  name: e.column,
498
498
  operation: s,
499
499
  valueType: a,
500
- values: i,
500
+ values: n,
501
501
  dataType: e.dataType,
502
502
  fieldMeta: e.fieldMeta,
503
503
  semanticContext: e.semanticContext
504
504
  }
505
505
  });
506
506
  }
507
- function wt(e, t, a) {
507
+ function Tt(e, t, a) {
508
508
  return a ? { code: e, message: t, cardId: a } : { code: e, message: t };
509
509
  }
510
- function ls(e, t, a) {
510
+ function us(e, t, a) {
511
511
  const s = (t || []).filter(
512
- (d) => d.scope === "card" && d.targetCardId === a
513
- ).map((d) => d.field).filter(Boolean);
512
+ (r) => r.scope === "card" && r.targetCardId === a
513
+ ).map((r) => r.field).filter(Boolean);
514
514
  return s.length === 0 ? e : {
515
515
  ...e,
516
516
  calculatedFields: [
@@ -519,11 +519,11 @@ function ls(e, t, a) {
519
519
  ]
520
520
  };
521
521
  }
522
- function cs(e, t, a) {
522
+ function hs(e, t, a) {
523
523
  return t.clickToFilter === void 0 && t.respondsToSelections === void 0 ? e : {
524
524
  ...e,
525
525
  ...t.clickToFilter ? {
526
- clickToFilter: Lt(
526
+ clickToFilter: Vt(
527
527
  t.clickToFilter,
528
528
  { cardIds: Object.fromEntries(a) }
529
529
  )
@@ -531,52 +531,52 @@ function cs(e, t, a) {
531
531
  ...t.respondsToSelections !== void 0 ? { respondsToSelections: t.respondsToSelections } : {}
532
532
  };
533
533
  }
534
- function us(e, t) {
534
+ function fs(e, t) {
535
535
  if (!e) return e;
536
- const a = Vt(e, {
536
+ const a = Ut(e, {
537
537
  renamedCardIds: t,
538
538
  keepOnlyRenamedCardIds: !0
539
539
  });
540
- return Gt(a) ? null : a;
540
+ return jt(a) ? null : a;
541
541
  }
542
- function fs(e, t) {
542
+ function ps(e, t) {
543
543
  const a = {}, s = [];
544
544
  return {
545
545
  inputs: (e.filterInputs || []).flatMap(
546
- (i, n) => {
547
- const o = us(i.scope, t);
548
- if (o === null)
546
+ (n, i) => {
547
+ const d = fs(n.scope, t);
548
+ if (d === null)
549
549
  return s.push(
550
- wt(
550
+ Tt(
551
551
  "filter_input_scope_empty",
552
- `Filter input "${i.label}" was skipped because all scoped cards or tabs were skipped during query validation.`
552
+ `Filter input "${n.label}" was skipped because all scoped cards or tabs were skipped during query validation.`
553
553
  )
554
554
  ), [];
555
- const p = xt(
556
- i.filter,
557
- i.defaultValue
555
+ const u = Dt(
556
+ n.filter,
557
+ n.defaultValue
558
558
  );
559
- return p && (a.shared ?? (a.shared = {}), a.shared[i.id] = {
559
+ return u && (a.shared ?? (a.shared = {}), a.shared[n.id] = {
560
560
  status: "set",
561
561
  value: {
562
562
  kind: "filter",
563
- filterValue: p
563
+ filterValue: u
564
564
  }
565
565
  }), [
566
566
  {
567
- id: i.id,
567
+ id: n.id,
568
568
  kind: "filter",
569
- label: i.label,
570
- variableName: i.variableName,
571
- scope: o || { kind: "allSheets", sheetKinds: ["dashboard"] },
569
+ label: n.label,
570
+ variableName: n.variableName,
571
+ scope: d || { kind: "allSheets", sheetKinds: ["dashboard"] },
572
572
  runtimeScope: "shared",
573
573
  presentation: {
574
574
  placement: "toolbar",
575
- order: n
575
+ order: i
576
576
  },
577
577
  exports: ["label", "value", "start", "end", "range"],
578
578
  // Reach is the scope (S-1): a filter definition stores none.
579
- filter: Bt(i.filter)
579
+ filter: Gt(n.filter)
580
580
  }
581
581
  ];
582
582
  }
@@ -585,57 +585,57 @@ function fs(e, t) {
585
585
  defaultInputValues: a.shared && Object.keys(a.shared).length > 0 ? a : void 0
586
586
  };
587
587
  }
588
- function ri(e) {
589
- var R, m;
590
- const t = ss(e.plan);
588
+ function li(e) {
589
+ var g, A;
590
+ const t = ns(e.plan);
591
591
  if (!t.ok)
592
592
  throw new Error(
593
- t.errors.map((f) => f.message).join(`
593
+ t.errors.map((c) => c.message).join(`
594
594
  `) || "Dashboard plan is invalid."
595
595
  );
596
- const a = e.plan.sheets[0], s = [...t.warnings], d = [], i = new Map(
597
- e.cardArtifacts.map((f) => [f.planCardId, f])
598
- ), n = new Map(
599
- e.cardArtifacts.map((f) => [
600
- f.planCardId,
601
- f.card.id
596
+ const a = e.plan.sheets[0], s = [...t.warnings], r = [], n = new Map(
597
+ e.cardArtifacts.map((c) => [c.planCardId, c])
598
+ ), i = new Map(
599
+ e.cardArtifacts.map((c) => [
600
+ c.planCardId,
601
+ c.card.id
602
602
  ])
603
- ), o = [];
604
- for (const f of a.cards) {
605
- const b = i.get(f.id);
606
- if (!b) {
607
- const D = wt(
603
+ ), d = [];
604
+ for (const c of a.cards) {
605
+ const m = n.get(c.id);
606
+ if (!m) {
607
+ const k = Tt(
608
608
  "missing_card_artifact",
609
- `Card "${f.title}" was skipped because no generated artifact was supplied.`,
610
- f.id
609
+ `Card "${c.title}" was skipped because no generated artifact was supplied.`,
610
+ c.id
611
611
  );
612
- d.push(D);
612
+ r.push(k);
613
613
  continue;
614
614
  }
615
- s.push(...b.warnings || []);
616
- const A = cs(
617
- ls(
618
- b.card,
615
+ s.push(...m.warnings || []);
616
+ const F = hs(
617
+ us(
618
+ m.card,
619
619
  e.plan.calculatedFields,
620
- f.id
620
+ c.id
621
621
  ),
622
- f,
623
- n
622
+ c,
623
+ i
624
624
  );
625
- o.push({
626
- id: f.frameId,
627
- cards: [A],
628
- activeCardId: A.id
625
+ d.push({
626
+ id: c.frameId,
627
+ cards: [F],
628
+ activeCardId: F.id
629
629
  });
630
630
  }
631
- if (o.length === 0)
631
+ if (d.length === 0)
632
632
  throw new Error("Dashboard plan did not produce any persistable cards.");
633
- const { inputs: p, defaultInputValues: y, warnings: _ } = fs(e.plan, n);
634
- s.push(..._);
635
- const g = new Map(a.cards.map((f) => [f.frameId, f.priority])), C = o.map((f, b) => ({ frame: f, index: b })).sort(
636
- (f, b) => (g.get(f.frame.id) ?? 0) - (g.get(b.frame.id) ?? 0) || f.index - b.index
637
- ).map(({ frame: f }) => f), w = Fa({ id: a.id, frames: C, layouts: void 0 }, { kind: "arrange" });
638
- if (!w.ok) throw new Error(w.failure.message);
633
+ const { inputs: u, defaultInputValues: b, warnings: y } = ps(e.plan, i);
634
+ s.push(...y);
635
+ const C = new Map(a.cards.map((c) => [c.frameId, c.priority])), p = d.map((c, m) => ({ frame: c, index: m })).sort(
636
+ (c, m) => (C.get(c.frame.id) ?? 0) - (C.get(m.frame.id) ?? 0) || c.index - m.index
637
+ ).map(({ frame: c }) => c), $ = Ea({ id: a.id, frames: p, layouts: void 0 }, { kind: "arrange" });
638
+ if (!$.ok) throw new Error($.failure.message);
639
639
  return { dashboard: {
640
640
  id: e.dashboardId,
641
641
  title: e.plan.title,
@@ -649,24 +649,24 @@ function ri(e) {
649
649
  kind: "dashboard",
650
650
  title: a.title,
651
651
  description: a.description,
652
- frames: w.frames,
653
- layouts: w.layouts,
654
- customizedBreakpoints: w.customizedBreakpoints,
655
- calculatedFields: (R = e.plan.calculatedFields) == null ? void 0 : R.filter((f) => f.scope === "sheet" && f.field).map((f) => f.field)
652
+ frames: $.frames,
653
+ layouts: $.layouts,
654
+ customizedBreakpoints: $.customizedBreakpoints,
655
+ calculatedFields: (g = e.plan.calculatedFields) == null ? void 0 : g.filter((c) => c.scope === "sheet" && c.field).map((c) => c.field)
656
656
  }
657
657
  ],
658
- calculatedFields: (m = e.plan.calculatedFields) == null ? void 0 : m.filter((f) => f.scope === "dashboard" && f.field).map((f) => f.field),
659
- inputs: p,
660
- ...y ? { defaultInputValues: y } : {}
661
- }, warnings: s, skippedOperations: d };
658
+ calculatedFields: (A = e.plan.calculatedFields) == null ? void 0 : A.filter((c) => c.scope === "dashboard" && c.field).map((c) => c.field),
659
+ inputs: u,
660
+ ...b ? { defaultInputValues: b } : {}
661
+ }, warnings: s, skippedOperations: r };
662
662
  }
663
- function K(e, t, a) {
663
+ function H(e, t, a) {
664
664
  return a ? { code: e, message: t, cardId: a } : { code: e, message: t };
665
665
  }
666
- function fe(e, t) {
666
+ function he(e, t) {
667
667
  return e.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || t;
668
668
  }
669
- function Dt(e, t) {
669
+ function kt(e, t) {
670
670
  if (!t.has(e))
671
671
  return t.add(e), e;
672
672
  let a = 2, s = `${e}-${a}`;
@@ -674,22 +674,22 @@ function Dt(e, t) {
674
674
  a += 1, s = `${e}-${a}`;
675
675
  return t.add(s), s;
676
676
  }
677
- function me(e) {
677
+ function ge(e) {
678
678
  return !!(e && typeof e == "object");
679
679
  }
680
- function Tt(e) {
680
+ function $t(e) {
681
681
  return Array.isArray(e.inputs) ? e.inputs.filter(
682
- (t) => me(t) && typeof t.id == "string"
682
+ (t) => ge(t) && typeof t.id == "string"
683
683
  ) : [];
684
684
  }
685
685
  function Ge(e) {
686
686
  return Array.isArray(e.sections) ? e.sections.filter(
687
- (t) => me(t)
687
+ (t) => ge(t)
688
688
  ) : [];
689
689
  }
690
690
  function Ue(e) {
691
691
  return Array.isArray(e.views) ? e.views.filter(
692
- (t) => me(t)
692
+ (t) => ge(t)
693
693
  ) : [];
694
694
  }
695
695
  function te(e) {
@@ -702,98 +702,98 @@ function te(e) {
702
702
  }
703
703
  return t;
704
704
  }
705
- function hs(e) {
706
- var s, d, i;
705
+ function ms(e) {
706
+ var s, r, n;
707
707
  if (!e)
708
708
  return [];
709
709
  const t = [];
710
- if (pe(e.source) && t.push(e.source), e.kind === "metric") {
710
+ if (me(e.source) && t.push(e.source), e.kind === "metric") {
711
711
  t.push(...te(e.measures));
712
- const n = J(e.dateField);
713
- n && t.push(n), t.push(...te(e.dimensions)), t.push(
712
+ const i = J(e.dateField);
713
+ i && t.push(i), t.push(...te(e.dimensions)), t.push(
714
714
  ...te(
715
- (s = e.filters) == null ? void 0 : s.map((o) => o.field)
715
+ (s = e.filters) == null ? void 0 : s.map((d) => d.field)
716
716
  )
717
717
  );
718
718
  } else if (e.kind === "records") {
719
- const n = J(e.dateField);
720
- n && t.push(n), t.push(...te(e.fields)), t.push(
719
+ const i = J(e.dateField);
720
+ i && t.push(i), t.push(...te(e.fields)), t.push(
721
721
  ...te(
722
- (d = e.filters) == null ? void 0 : d.map((o) => o.field)
722
+ (r = e.filters) == null ? void 0 : r.map((d) => d.field)
723
723
  )
724
724
  );
725
- } else e.kind === "inputOptions" ? (((i = e.population) == null ? void 0 : i.kind) === "related_population" && pe(e.population.baseSource) && t.push(e.population.baseSource), t.push(
725
+ } else e.kind === "inputOptions" ? (((n = e.population) == null ? void 0 : n.kind) === "related_population" && me(e.population.baseSource) && t.push(e.population.baseSource), t.push(
726
726
  ...te([
727
727
  e.labelField,
728
728
  e.valueField,
729
729
  e.searchField,
730
730
  ...e.disambiguationFields || []
731
- ].filter((n) => !!n))
731
+ ].filter((i) => !!i))
732
732
  )) : e.kind === "sql" && t.push(...te(e.fields));
733
733
  const a = "inputs" in e && Array.isArray(e.inputs) ? e.inputs : [];
734
- for (const n of a) {
735
- const o = J(n.field);
736
- o && t.push(o);
734
+ for (const i of a) {
735
+ const d = J(i.field);
736
+ d && t.push(d);
737
737
  }
738
738
  return t;
739
739
  }
740
- function ps(e) {
740
+ function gs(e) {
741
741
  const t = [];
742
- for (const a of Tt(e)) {
742
+ for (const a of $t(e)) {
743
743
  const s = J(a.field);
744
744
  s && t.push(s);
745
745
  }
746
746
  for (const a of Ge(e))
747
747
  for (const s of Ue(a))
748
- t.push(...hs(s.analytics));
748
+ t.push(...ms(s.analytics));
749
749
  return t;
750
750
  }
751
- function ms(e) {
751
+ function bs(e) {
752
752
  var a;
753
753
  const t = [];
754
754
  for (const s of Ge(e))
755
- for (const d of Ue(s))
756
- pe((a = d.analytics) == null ? void 0 : a.source) && t.push(d.analytics.source);
755
+ for (const r of Ue(s))
756
+ me((a = r.analytics) == null ? void 0 : a.source) && t.push(r.analytics.source);
757
757
  return t;
758
758
  }
759
- function gs(e, t) {
760
- const a = xe(e).filter(pe);
759
+ function Is(e, t) {
760
+ const a = we(e).filter(me);
761
761
  if (a.length === 0)
762
762
  return t.push(
763
- K(
763
+ H(
764
764
  "missing_materializable_dataset",
765
765
  "No semantic or physical source could be converted into the current dashboard authoring dataset reference."
766
766
  )
767
767
  ), [];
768
- const s = a.every((i) => i.kind === "semantic"), d = Array.from(
768
+ const s = a.every((n) => n.kind === "semantic"), r = Array.from(
769
769
  new Set(
770
- a.filter((i) => i.kind === "semantic").map((i) => i.domainId)
770
+ a.filter((n) => n.kind === "semantic").map((n) => n.domainId)
771
771
  )
772
772
  );
773
- return a.length > 1 && (!s || d.length !== 1) ? (t.push(
774
- K(
773
+ return a.length > 1 && (!s || r.length !== 1) ? (t.push(
774
+ H(
775
775
  "multiple_datasets_out_of_scope",
776
776
  "The dashboard authoring compiler supports multiple datasets only within one semantic domain; using the first source and deferring the rest."
777
777
  )
778
778
  ), [a[0]]) : a;
779
779
  }
780
- function bs(e, t) {
781
- const a = Ge(e), s = Tt(e), d = xe(ps(e)), i = xe(
782
- ms(e)
780
+ function ys(e, t) {
781
+ const a = Ge(e), s = $t(e), r = we(gs(e)), n = we(
782
+ bs(e)
783
783
  );
784
784
  return {
785
785
  sections: a,
786
786
  inputs: s,
787
- sources: d,
788
- primarySources: i,
789
- defaultSource: i.length === 1 ? i[0] : void 0,
790
- datasets: gs(d, t)
787
+ sources: r,
788
+ primarySources: n,
789
+ defaultSource: n.length === 1 ? n[0] : void 0,
790
+ datasets: Is(r, t)
791
791
  };
792
792
  }
793
- function Is(e) {
794
- return e && yt(e).ok ? e : void 0;
793
+ function _s(e) {
794
+ return e && Ct(e).ok ? e : void 0;
795
795
  }
796
- function ys(e) {
796
+ function Cs(e) {
797
797
  var t;
798
798
  switch ((t = e.presentation) == null ? void 0 : t.kind) {
799
799
  case "kpi":
@@ -812,12 +812,12 @@ function ys(e) {
812
812
  return null;
813
813
  }
814
814
  }
815
- function _s(e) {
815
+ function Ss(e) {
816
816
  var t, a, s;
817
817
  return ((t = e.presentation) == null ? void 0 : t.kind) === "kpi" ? "kpi" : ((a = e.presentation) == null ? void 0 : a.kind) === "table" ? "table" : ((s = e.presentation) == null ? void 0 : s.kind) === "text" ? "text" : "chart";
818
818
  }
819
- function Cs(e) {
820
- const t = Ra(e);
819
+ function vs(e) {
820
+ const t = Na(e);
821
821
  switch (t) {
822
822
  case "not_in":
823
823
  return "not in";
@@ -831,77 +831,77 @@ function Cs(e) {
831
831
  return t || "in";
832
832
  }
833
833
  }
834
- function Ss(e) {
835
- return me(e.field) ? e.field.dataType === "datetime" ? "date" : e.field.dataType || "string" : "string";
834
+ function ws(e) {
835
+ return ge(e.field) ? e.field.dataType === "datetime" ? "date" : e.field.dataType || "string" : "string";
836
836
  }
837
- function vs(e) {
837
+ function xs(e) {
838
838
  if (!(!e || e.kind !== "physical"))
839
839
  return [e.databaseName, e.schemaName, e.tableName].filter(Boolean).join(".");
840
840
  }
841
- function xs(e, t, a, s, d, i) {
841
+ function Ds(e, t, a, s, r, n) {
842
842
  if (e.kind !== "filter")
843
- return i.push(
844
- K(
843
+ return n.push(
844
+ H(
845
845
  "control_inputs_deferred",
846
846
  `Control input "${e.label}" is represented in the protocol but not yet materialized by the dashboard authoring adapter.`
847
847
  )
848
848
  ), null;
849
- if (!me(e.field) || typeof e.field.name != "string")
850
- return i.push(
851
- K(
849
+ if (!ge(e.field) || typeof e.field.name != "string")
850
+ return n.push(
851
+ H(
852
852
  "filter_requires_field",
853
853
  `Filter "${e.label || e.id}" needs a field before the dashboard compiler can materialize it.`
854
854
  )
855
855
  ), null;
856
- const n = Va({
856
+ const i = Ua({
857
857
  explicitSource: void 0,
858
858
  field: e.field,
859
859
  defaultSource: t,
860
860
  fallbackSources: a
861
- }), o = (n == null ? void 0 : n.kind) === "semantic" || (n == null ? void 0 : n.kind) === "physical" ? n.connectionId : void 0;
862
- if (!o)
863
- return i.push(
864
- K(
861
+ }), d = (i == null ? void 0 : i.kind) === "semantic" || (i == null ? void 0 : i.kind) === "physical" ? i.connectionId : void 0;
862
+ if (!d)
863
+ return n.push(
864
+ H(
865
865
  "filter_requires_connection_id",
866
866
  `Filter "${e.label}" needs a source connectionId before the dashboard compiler can materialize it.`
867
867
  )
868
868
  ), null;
869
- const _ = {
870
- id: `filter-${Dt(
871
- fe(e.id, e.field.name),
872
- d
869
+ const y = {
870
+ id: `filter-${kt(
871
+ he(e.id, e.field.name),
872
+ r
873
873
  )}`,
874
874
  variableName: e.id,
875
- connectionId: o,
875
+ connectionId: d,
876
876
  title: e.label,
877
877
  column: e.field.name,
878
- dataType: Ss(e),
879
- qualifiedTableName: vs(n),
878
+ dataType: ws(e),
879
+ qualifiedTableName: xs(i),
880
880
  sql: "",
881
- operation: Cs(e.operator),
881
+ operation: vs(e.operator),
882
882
  type: e.multi === !1 ? "single" : "multiple",
883
883
  location: "dashboard",
884
- fieldMeta: (n == null ? void 0 : n.kind) === "semantic" ? {
884
+ fieldMeta: (i == null ? void 0 : i.kind) === "semantic" ? {
885
885
  name: e.field.name,
886
886
  qualifiedFieldName: e.field.name,
887
887
  dataType: e.field.dataType,
888
888
  role: e.field.role === "measure" ? "metric" : "groupby"
889
889
  } : void 0,
890
- semanticContext: (n == null ? void 0 : n.kind) === "semantic" ? {
891
- semanticDomainId: n.domainId,
892
- connectionId: n.connectionId
893
- } : (n == null ? void 0 : n.kind) === "physical" ? {
894
- connectionId: n.connectionId,
895
- connectionType: n.connectionType,
890
+ semanticContext: (i == null ? void 0 : i.kind) === "semantic" ? {
891
+ semanticDomainId: i.domainId,
892
+ connectionId: i.connectionId
893
+ } : (i == null ? void 0 : i.kind) === "physical" ? {
894
+ connectionId: i.connectionId,
895
+ connectionType: i.connectionType,
896
896
  selectedEntities: [
897
897
  {
898
898
  type: "table",
899
- connectionId: n.connectionId,
900
- connectionType: n.connectionType,
901
- dialect: n.dialect,
902
- database: n.databaseName,
903
- schema: n.schemaName,
904
- name: n.tableName
899
+ connectionId: i.connectionId,
900
+ connectionType: i.connectionType,
901
+ dialect: i.dialect,
902
+ database: i.databaseName,
903
+ schema: i.schemaName,
904
+ name: i.tableName
905
905
  }
906
906
  ]
907
907
  } : void 0
@@ -911,37 +911,37 @@ function xs(e, t, a, s, d, i) {
911
911
  label: e.label,
912
912
  variableName: e.id,
913
913
  scope: s,
914
- filter: _,
915
- defaultValue: xt(
916
- _,
914
+ filter: y,
915
+ defaultValue: Dt(
916
+ y,
917
917
  e.defaultValue
918
918
  )
919
919
  };
920
920
  }
921
- function Ae(e) {
921
+ function Re(e) {
922
922
  const t = [], a = [];
923
923
  for (const s of e.viewIds) {
924
- const d = e.viewIdToCardId.get(s);
925
- d ? t.push(d) : a.push(s);
924
+ const r = e.viewIdToCardId.get(s);
925
+ r ? t.push(r) : a.push(s);
926
926
  }
927
927
  return a.length > 0 && e.warnings.push(
928
- K(
928
+ H(
929
929
  "input_scope_view_not_found",
930
930
  `Filter "${e.inputLabel}" referenced unknown view ids: ${a.join(", ")}.`
931
931
  )
932
932
  ), Array.from(new Set(t));
933
933
  }
934
- function ws(e) {
935
- var s, d;
934
+ function Ts(e) {
935
+ var s, r;
936
936
  if (!e.protocolScope) {
937
- const i = Array.from(new Set(e.boundCardIds));
938
- return i.length > 0 && i.length < e.allCardIds.length ? { kind: "cards", cardIds: i } : void 0;
937
+ const n = Array.from(new Set(e.boundCardIds));
938
+ return n.length > 0 && n.length < e.allCardIds.length ? { kind: "cards", cardIds: n } : void 0;
939
939
  }
940
940
  if (e.protocolScope.level === "dashboard") {
941
941
  if (!((s = e.protocolScope.excludeViewIds) != null && s.length))
942
942
  return;
943
- const i = new Set(
944
- Ae({
943
+ const n = new Set(
944
+ Re({
945
945
  inputLabel: e.inputLabel,
946
946
  viewIds: e.protocolScope.excludeViewIds,
947
947
  viewIdToCardId: e.viewIdToCardId,
@@ -950,35 +950,35 @@ function ws(e) {
950
950
  );
951
951
  return {
952
952
  kind: "cards",
953
- cardIds: e.allCardIds.filter((n) => !i.has(n))
953
+ cardIds: e.allCardIds.filter((i) => !n.has(i))
954
954
  };
955
955
  }
956
956
  if (e.protocolScope.level === "view") {
957
- const i = Ae({
957
+ const n = Re({
958
958
  inputLabel: e.inputLabel,
959
959
  viewIds: e.protocolScope.viewIds,
960
960
  viewIdToCardId: e.viewIdToCardId,
961
961
  warnings: e.warnings
962
962
  });
963
- return i.length === 0 ? (e.warnings.push(
964
- K(
963
+ return n.length === 0 ? (e.warnings.push(
964
+ H(
965
965
  "input_scope_has_no_materialized_cards",
966
966
  `Filter "${e.inputLabel}" was deferred because its view scope does not match any materialized cards.`
967
967
  )
968
- ), null) : { kind: "cards", cardIds: i };
968
+ ), null) : { kind: "cards", cardIds: n };
969
969
  }
970
970
  const t = e.sectionIdToCardIds.get(e.protocolScope.sectionId) || [];
971
971
  if (t.length === 0)
972
972
  return e.warnings.push(
973
- K(
973
+ H(
974
974
  "input_scope_section_not_found",
975
975
  `Filter "${e.inputLabel}" was deferred because section "${e.protocolScope.sectionId}" does not match any materialized cards.`
976
976
  )
977
977
  ), null;
978
- if (!((d = e.protocolScope.excludeViewIds) != null && d.length))
978
+ if (!((r = e.protocolScope.excludeViewIds) != null && r.length))
979
979
  return { kind: "cards", cardIds: t };
980
980
  const a = new Set(
981
- Ae({
981
+ Re({
982
982
  inputLabel: e.inputLabel,
983
983
  viewIds: e.protocolScope.excludeViewIds,
984
984
  viewIdToCardId: e.viewIdToCardId,
@@ -987,107 +987,107 @@ function ws(e) {
987
987
  );
988
988
  return {
989
989
  kind: "cards",
990
- cardIds: t.filter((i) => !a.has(i))
990
+ cardIds: t.filter((n) => !a.has(n))
991
991
  };
992
992
  }
993
- function di(e) {
994
- var w, c, R;
995
- const t = [], a = Ta(e);
996
- for (const m of a.warnings)
997
- t.push(K(m.code, m.message));
998
- for (const m of a.errors)
999
- t.push(K(m.code, m.message));
1000
- const s = bs(e, t), d = [], i = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Set(), y = /* @__PURE__ */ new Set();
1001
- let _ = 0;
1002
- for (const [m, f] of s.sections.entries()) {
1003
- const b = typeof f.title == "string" ? f.title : `Section ${m + 1}`, A = f.id || fe(b, `section-${m + 1}`);
1004
- n.set(A, []);
1005
- for (const [D, $] of Ue(f).entries()) {
1006
- const U = ys($), F = fe(
1007
- $.id || `${b}-${$.title || `View ${D + 1}`}`,
1008
- `card-${m + 1}-${D + 1}`
993
+ function ci(e) {
994
+ var $, _, g;
995
+ const t = [], a = Fa(e);
996
+ for (const A of a.warnings)
997
+ t.push(H(A.code, A.message));
998
+ for (const A of a.errors)
999
+ t.push(H(A.code, A.message));
1000
+ const s = ys(e, t), r = [], n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Set(), b = /* @__PURE__ */ new Set();
1001
+ let y = 0;
1002
+ for (const [A, c] of s.sections.entries()) {
1003
+ const m = typeof c.title == "string" ? c.title : `Section ${A + 1}`, F = c.id || he(m, `section-${A + 1}`);
1004
+ i.set(F, []);
1005
+ for (const [k, D] of Ue(c).entries()) {
1006
+ const N = Cs(D), R = he(
1007
+ D.id || `${m}-${D.title || `View ${k + 1}`}`,
1008
+ `card-${A + 1}-${k + 1}`
1009
1009
  );
1010
- if (!U) {
1010
+ if (!N) {
1011
1011
  t.push(
1012
- K(
1012
+ H(
1013
1013
  "unsupported_presentation",
1014
- `Dashboard presentation "${((w = $.presentation) == null ? void 0 : w.kind) || "unknown"}" is not supported by the dashboard authoring adapter.`,
1015
- `card-${F}`
1014
+ `Dashboard presentation "${(($ = D.presentation) == null ? void 0 : $.kind) || "unknown"}" is not supported by the dashboard authoring adapter.`,
1015
+ `card-${R}`
1016
1016
  )
1017
1017
  );
1018
1018
  continue;
1019
1019
  }
1020
- if (((c = $.analytics) == null ? void 0 : c.kind) === "sql") {
1020
+ if (((_ = D.analytics) == null ? void 0 : _.kind) === "sql") {
1021
1021
  t.push(
1022
- K(
1022
+ H(
1023
1023
  "sql_intent_deferred",
1024
1024
  "SQL analytics intent is valid protocol, but the current dashboard authoring adapter only materializes semantic and physical config-card intents.",
1025
- `card-${F}`
1025
+ `card-${R}`
1026
1026
  )
1027
1027
  );
1028
1028
  continue;
1029
1029
  }
1030
- const N = Dt(F, p), O = `card-${N}`;
1031
- $.id && i.set($.id, O), (R = n.get(A)) == null || R.push(O);
1032
- const B = $.analytics && "inputs" in $.analytics ? $.analytics.inputs : void 0;
1033
- for (const j of B || []) {
1034
- const M = o.get(j.inputId) || [];
1035
- M.push(O), o.set(j.inputId, M);
1030
+ const O = kt(R, u), E = `card-${O}`;
1031
+ D.id && n.set(D.id, E), (g = i.get(F)) == null || g.push(E);
1032
+ const V = D.analytics && "inputs" in D.analytics ? D.analytics.inputs : void 0;
1033
+ for (const K of V || []) {
1034
+ const L = d.get(K.inputId) || [];
1035
+ L.push(E), d.set(K.inputId, L);
1036
1036
  }
1037
- d.push({
1038
- id: O,
1039
- frameId: `frame-${N}`,
1040
- title: $.title,
1041
- description: $.description,
1042
- type: U,
1043
- role: _s($),
1044
- priority: _,
1045
- section: b,
1046
- analyticsIntent: Is($.analytics),
1047
- text: $.text
1048
- }), _ += 1;
1037
+ r.push({
1038
+ id: E,
1039
+ frameId: `frame-${O}`,
1040
+ title: D.title,
1041
+ description: D.description,
1042
+ type: N,
1043
+ role: Ss(D),
1044
+ priority: y,
1045
+ section: m,
1046
+ analyticsIntent: _s(D.analytics),
1047
+ text: D.text
1048
+ }), y += 1;
1049
1049
  }
1050
1050
  }
1051
- const g = s.inputs.map((m) => {
1052
- const f = ws({
1053
- protocolScope: m.scope,
1054
- inputLabel: m.label,
1055
- allCardIds: d.map((b) => b.id),
1056
- boundCardIds: o.get(m.id) || [],
1057
- viewIdToCardId: i,
1058
- sectionIdToCardIds: n,
1051
+ const C = s.inputs.map((A) => {
1052
+ const c = Ts({
1053
+ protocolScope: A.scope,
1054
+ inputLabel: A.label,
1055
+ allCardIds: r.map((m) => m.id),
1056
+ boundCardIds: d.get(A.id) || [],
1057
+ viewIdToCardId: n,
1058
+ sectionIdToCardIds: i,
1059
1059
  warnings: t
1060
1060
  });
1061
- return f === null ? null : xs(
1062
- m,
1061
+ return c === null ? null : Ds(
1062
+ A,
1063
1063
  s.defaultSource,
1064
1064
  s.sources,
1065
- f,
1066
- y,
1065
+ c,
1066
+ b,
1067
1067
  t
1068
1068
  );
1069
- }).filter((m) => !!m);
1069
+ }).filter((A) => !!A);
1070
1070
  return { plan: {
1071
1071
  version: 1,
1072
- id: `plan-${fe(e.title, "dashboard")}`,
1072
+ id: `plan-${he(e.title, "dashboard")}`,
1073
1073
  title: e.title,
1074
1074
  description: e.description,
1075
1075
  datasets: s.datasets,
1076
1076
  sheets: [
1077
1077
  {
1078
- id: `sheet-${fe(e.title, "dashboard")}`,
1078
+ id: `sheet-${he(e.title, "dashboard")}`,
1079
1079
  title: e.title,
1080
1080
  description: e.description,
1081
1081
  kind: "dashboard",
1082
- cards: d
1082
+ cards: r
1083
1083
  }
1084
1084
  ],
1085
- filterInputs: g.length ? g : void 0,
1085
+ filterInputs: C.length ? C : void 0,
1086
1086
  warnings: t.length ? t : void 0,
1087
- unresolvedRequests: a.ok ? void 0 : a.errors.map((m) => m.message)
1087
+ unresolvedRequests: a.ok ? void 0 : a.errors.map((A) => A.message)
1088
1088
  }, warnings: t };
1089
1089
  }
1090
- const li = [
1090
+ const ui = [
1091
1091
  "cardType",
1092
1092
  "sql",
1093
1093
  "python",
@@ -1102,7 +1102,7 @@ const li = [
1102
1102
  "resolvedPrimaryDateField",
1103
1103
  "globalDateComparison",
1104
1104
  "calendarContext"
1105
- ], ci = [
1105
+ ], hi = [
1106
1106
  "cardId",
1107
1107
  "cardTitle",
1108
1108
  "cache_config",
@@ -1110,11 +1110,11 @@ const li = [
1110
1110
  "tableConfig"
1111
1111
  ];
1112
1112
  class W extends Error {
1113
- constructor(a, s, d) {
1113
+ constructor(a, s, r) {
1114
1114
  super(a);
1115
- Te(this, "field");
1116
- Te(this, "details");
1117
- Object.setPrototypeOf(this, W.prototype), this.name = "CardQueryRequestError", this.field = s, this.details = d;
1115
+ ke(this, "field");
1116
+ ke(this, "details");
1117
+ Object.setPrototypeOf(this, W.prototype), this.name = "CardQueryRequestError", this.field = s, this.details = r;
1118
1118
  }
1119
1119
  }
1120
1120
  function je(e) {
@@ -1126,229 +1126,249 @@ function ae(e) {
1126
1126
  function Ce(e) {
1127
1127
  return typeof e == "string" ? e : "";
1128
1128
  }
1129
- function Ds(e, t = {}) {
1130
- const a = ae(e), s = je(t), d = {};
1129
+ function ks(e, t = {}) {
1130
+ const a = ae(e), s = je(t), r = {};
1131
1131
  if (a.calendarContext !== void 0) {
1132
- const n = Pa(a.calendarContext);
1133
- if (!n.ok)
1132
+ const i = La(a.calendarContext);
1133
+ if (!i.ok)
1134
1134
  throw new W(
1135
- `${s}calendarContext: ${n.issues.map((o) => o.message).join("; ")}`,
1135
+ `${s}calendarContext: ${i.issues.map((d) => d.message).join("; ")}`,
1136
1136
  "calendarContext",
1137
- n.issues
1137
+ i.issues
1138
1138
  );
1139
- d.calendarContext = n.value;
1139
+ r.calendarContext = i.value;
1140
1140
  }
1141
- const i = Ut(a.resolvedPrimaryDateField);
1142
- if (!i.ok)
1141
+ const n = zt(a.resolvedPrimaryDateField);
1142
+ if (!n.ok)
1143
1143
  throw new W(
1144
- `${s}${jt(i.issues)}`,
1144
+ `${s}${Qt(n.issues)}`,
1145
1145
  "resolvedPrimaryDateField",
1146
- i.issues
1146
+ n.issues
1147
1147
  );
1148
- if (a.resolvedPrimaryDateField && (d.resolvedPrimaryDateField = a.resolvedPrimaryDateField), a.globalDateComparison !== void 0) {
1149
- const n = Na(a.globalDateComparison);
1150
- if (!n.ok)
1148
+ if (a.resolvedPrimaryDateField && (r.resolvedPrimaryDateField = a.resolvedPrimaryDateField), a.globalDateComparison !== void 0) {
1149
+ const i = Pa(a.globalDateComparison);
1150
+ if (!i.ok)
1151
1151
  throw new W(
1152
- `${s}Invalid globalDateComparison: ${n.errors.map((o) => `${o.path}: ${o.message}`).join("; ")}`,
1152
+ `${s}Invalid globalDateComparison: ${i.errors.map((d) => `${d.path}: ${d.message}`).join("; ")}`,
1153
1153
  "globalDateComparison",
1154
- n.errors
1154
+ i.errors
1155
1155
  );
1156
- d.globalDateComparison = qa(
1156
+ r.globalDateComparison = Ma(
1157
1157
  a.globalDateComparison
1158
1158
  );
1159
1159
  }
1160
- return d;
1160
+ return r;
1161
1161
  }
1162
- function ui(e, t = {}) {
1163
- const a = ae(e), s = je(t), d = {};
1162
+ function fi(e, t = {}) {
1163
+ const a = ae(e), s = je(t), r = {};
1164
1164
  if (a.pagination !== void 0) {
1165
- const i = ae(a.pagination), n = i.page, o = i.pageSize;
1166
- if (!Number.isInteger(n) || n < 1 || !Number.isInteger(o) || o < 1)
1165
+ const n = ae(a.pagination), i = n.page, d = n.pageSize;
1166
+ if (!Number.isInteger(i) || i < 1 || !Number.isInteger(d) || d < 1)
1167
1167
  throw new W(
1168
1168
  `${s}pagination must name a page and a page size of at least 1`,
1169
1169
  "pagination"
1170
1170
  );
1171
- d.pagination = { page: n, pageSize: o };
1171
+ r.pagination = { page: i, pageSize: d };
1172
1172
  }
1173
1173
  if (a.tableTotalsRequest !== void 0) {
1174
1174
  if (!a.tableTotalsRequest || typeof a.tableTotalsRequest != "object" || Array.isArray(a.tableTotalsRequest))
1175
1175
  throw new W(`${s}tableTotalsRequest must be an object`, "tableTotalsRequest");
1176
- d.tableTotalsRequest = a.tableTotalsRequest;
1176
+ r.tableTotalsRequest = a.tableTotalsRequest;
1177
1177
  }
1178
1178
  if (a.sourceRowProbe !== void 0) {
1179
- const i = ae(a.sourceRowProbe).limit;
1180
- if (!Number.isInteger(i) || i < 1)
1179
+ const n = ae(a.sourceRowProbe).limit;
1180
+ if (!Number.isInteger(n) || n < 1)
1181
1181
  throw new W(
1182
1182
  `${s}sourceRowProbe must name a limit of at least 1`,
1183
1183
  "sourceRowProbe"
1184
1184
  );
1185
- if (d.pagination)
1185
+ if (r.pagination)
1186
1186
  throw new W(
1187
1187
  `${s}sourceRowProbe cannot be combined with pagination`,
1188
1188
  "sourceRowProbe"
1189
1189
  );
1190
- d.sourceRowProbe = { limit: i };
1190
+ r.sourceRowProbe = { limit: n };
1191
1191
  }
1192
- return d;
1193
- }
1194
- function fi(e, t = {}) {
1195
- const a = ae(e), s = je(t), d = (R) => new W(`${s}${R} is required`, R), i = Ce(a.connection_id).trim();
1196
- if (!i) throw d("connection_id");
1197
- const n = Ce(a.cardType).trim();
1198
- if (!n) throw d("cardType");
1199
- const o = a.resultOwner;
1200
- if (o !== "config" && o !== "freeform" && o !== "none")
1201
- throw d("resultOwner");
1202
- const p = ae(a.cardConfig), y = Ce(a.sql), _ = Ce(a.python), g = !!t.configOptional || Object.keys(p).length > 0;
1203
- if (o === "config" && !g) throw d("cardConfig");
1204
- if (o === "freeform" && !y.trim()) throw d("sql");
1205
- const C = zt({
1206
- hasExecutableConfig: g,
1207
- sql: y,
1208
- normalizedPython: _
1192
+ return r;
1193
+ }
1194
+ function pi(e, t = {}) {
1195
+ const a = ae(e), s = je(t), r = (g) => new W(`${s}${g} is required`, g), n = Ce(a.connection_id).trim();
1196
+ if (!n) throw r("connection_id");
1197
+ const i = Ce(a.cardType).trim();
1198
+ if (!i) throw r("cardType");
1199
+ const d = a.resultOwner;
1200
+ if (d !== "config" && d !== "freeform" && d !== "none")
1201
+ throw r("resultOwner");
1202
+ const u = ae(a.cardConfig), b = Ce(a.sql), y = Ce(a.python), C = !!t.configOptional || Object.keys(u).length > 0;
1203
+ if (d === "config" && !C) throw r("cardConfig");
1204
+ if (d === "freeform" && !b.trim()) throw r("sql");
1205
+ const p = Kt({
1206
+ hasExecutableConfig: C,
1207
+ sql: b,
1208
+ normalizedPython: y
1209
1209
  });
1210
- if (o !== C)
1210
+ if (d !== p)
1211
1211
  throw new W(
1212
- `${s}resultOwner must match the normalized execution owner "${C}"`,
1212
+ `${s}resultOwner must match the normalized execution owner "${p}"`,
1213
1213
  "resultOwner"
1214
1214
  );
1215
- if (o === "none") throw d("cardConfig");
1216
- const w = ae(a.cardDataSource);
1217
- if (Object.keys(w).length === 0) throw d("cardDataSource");
1218
- const c = Qt({
1215
+ if (d === "none") throw r("cardConfig");
1216
+ const $ = ae(a.cardDataSource);
1217
+ if (Object.keys($).length === 0) throw r("cardDataSource");
1218
+ const _ = Ht({
1219
1219
  controlValues: a.controlValues,
1220
1220
  controlDefinitions: a.controlDefinitions,
1221
1221
  cardControlDefinitions: a.cardControlDefinitions,
1222
1222
  controlBindings: a.controlBindings
1223
1223
  });
1224
1224
  return {
1225
- connection_id: i,
1226
- cardType: n,
1227
- sql: y,
1228
- python: _,
1229
- resultOwner: o,
1230
- cardConfig: p,
1231
- cardDataSource: w,
1225
+ connection_id: n,
1226
+ cardType: i,
1227
+ sql: b,
1228
+ python: y,
1229
+ resultOwner: d,
1230
+ cardConfig: u,
1231
+ cardDataSource: $,
1232
1232
  active_filters: Array.isArray(a.active_filters) ? a.active_filters : [],
1233
- controlValues: c.controlValues,
1234
- controlDefinitions: c.controlDefinitions,
1235
- cardControlDefinitions: c.cardControlDefinitions,
1236
- controlBindings: c.controlBindings,
1237
- ...Ds(a, t)
1233
+ controlValues: _.controlValues,
1234
+ controlDefinitions: _.controlDefinitions,
1235
+ cardControlDefinitions: _.cardControlDefinitions,
1236
+ controlBindings: _.controlBindings,
1237
+ ...ks(a, t)
1238
1238
  };
1239
1239
  }
1240
- const Ts = {
1240
+ const $s = {
1241
1241
  global_date: "The date filter for the whole report can't be changed through the MCP. Change it in the editor; removing or excluding it works.",
1242
1242
  not_semantic: "This filter reads a database table, not a dataset, so it can't be changed through the MCP. Change it in the editor; removing or excluding it works.",
1243
1243
  scope_not_expressible: "This filter applies to chosen cards rather than whole sheets, so it can't be changed through the MCP. Change it in the editor; removing or excluding it works."
1244
1244
  };
1245
- function ks(e, t) {
1246
- var n;
1247
- const a = de(e), s = Kt(t.scope), d = new Set(re(e).map((o) => o.cardId)), i = {
1245
+ function Fs(e, t, a = {}) {
1246
+ var d;
1247
+ const s = de(e), r = Yt(t.scope), n = new Set(re(e).map((u) => u.cardId)), i = {
1248
1248
  reaches: [],
1249
1249
  excluded: [
1250
1250
  .../* @__PURE__ */ new Set([
1251
- ...(((n = t.application) == null ? void 0 : n.cards) ?? []).filter((o) => o.kind === "excluded").map((o) => o.cardId),
1252
- ...s.filter((o) => d.has(o))
1251
+ ...(((d = t.application) == null ? void 0 : d.cards) ?? []).filter((u) => u.kind === "excluded").map((u) => u.cardId),
1252
+ ...r.filter((u) => n.has(u))
1253
1253
  ])
1254
1254
  ],
1255
1255
  notReached: []
1256
1256
  };
1257
1257
  if (t.filter.kind === "global-date") {
1258
- const o = new Set(i.excluded);
1259
- return i.reaches = Wt(e, t.filter).filter(({ card: p }) => !o.has(p.id) && ve(p)).map(({ card: p }) => p.id), i;
1258
+ const u = new Set(i.excluded);
1259
+ return i.reaches = Xt(e, t.filter).filter(({ card: b }) => !u.has(b.id) && fe(b)).map(({ card: b }) => b.id), i;
1260
1260
  }
1261
- for (const o of a.reachedCards({ inputId: t.id })) {
1262
- const p = Oe(t, o.card);
1263
- if (p === "bound" || p === "automatic" || p === "sql") i.reaches.push(o.cardId);
1264
- else if (p === "blocked" || p === "ambiguous")
1265
- (i.blocked ?? (i.blocked = [])).push({ cardId: o.cardId, title: o.card.title ?? "", reason: p });
1266
- else if (p !== "excluded") {
1267
- const y = ve(o.card);
1268
- if (!y) continue;
1269
- i.notReached.push({
1270
- cardId: o.cardId,
1271
- title: o.card.title ?? "",
1272
- ...(y == null ? void 0 : y.kind) === "semantic" ? { datasetName: y.datasetName } : {}
1273
- });
1261
+ for (const u of s.reachedCards({ inputId: t.id })) {
1262
+ const b = ve(t, u.card, a), y = b.reach, C = () => {
1263
+ const p = fe(u.card);
1264
+ return {
1265
+ cardId: u.cardId,
1266
+ title: u.card.title ?? "",
1267
+ ...(p == null ? void 0 : p.kind) === "semantic" ? { datasetName: p.datasetName } : {}
1268
+ };
1269
+ };
1270
+ switch (y) {
1271
+ case "bound":
1272
+ case "automatic":
1273
+ case "sql":
1274
+ case "relationshipApplied":
1275
+ i.reaches.push(u.cardId);
1276
+ break;
1277
+ case "blocked":
1278
+ case "ambiguous":
1279
+ (i.blocked ?? (i.blocked = [])).push({ cardId: u.cardId, title: u.card.title ?? "", reason: y });
1280
+ break;
1281
+ case "relationship":
1282
+ (i.relationshipPending ?? (i.relationshipPending = [])).push(C());
1283
+ break;
1284
+ case "excluded":
1285
+ break;
1286
+ case "notApplicable":
1287
+ fe(u.card) && i.notReached.push({ ...C(), ...b.reason ? { reason: b.reason } : {} });
1288
+ break;
1289
+ default: {
1290
+ const p = y;
1291
+ throw new Error(`Unhandled filter reach ${String(p)}`);
1292
+ }
1274
1293
  }
1275
1294
  }
1276
1295
  return i;
1277
1296
  }
1278
- function $s(e, t) {
1279
- var d;
1297
+ function As(e, t) {
1298
+ var r;
1280
1299
  const a = t.scope;
1281
1300
  if (a.kind === "allSheets") {
1282
- if ((d = a.sheetKinds) != null && d.length && !a.sheetKinds.includes("dashboard")) return;
1283
- const i = Ht(a);
1301
+ if ((r = a.sheetKinds) != null && r.length && !a.sheetKinds.includes("dashboard")) return;
1302
+ const n = Jt(a);
1284
1303
  return {
1285
1304
  sheetIds: "all",
1286
- ...i.length ? { exceptSheetIds: [...i] } : {},
1287
- ...Yt(a) ? { includesDocumentSheets: !0 } : {}
1305
+ ...n.length ? { exceptSheetIds: [...n] } : {},
1306
+ ...Zt(a) ? { includesDocumentSheets: !0 } : {}
1288
1307
  };
1289
1308
  }
1290
1309
  if (a.kind !== "sheets") return;
1291
- const s = [...Me(e).values()].filter((i) => bt(t, i));
1310
+ const s = [...Me(e).values()].filter((n) => yt(t, n));
1292
1311
  return {
1293
- sheetIds: s.filter((i) => i.sheetKind === "dashboard").map((i) => i.sheetId),
1312
+ sheetIds: s.filter((n) => n.sheetKind === "dashboard").map((n) => n.sheetId),
1294
1313
  // Document sheets it names stay through a change of sheets (`withUnstatedScopeParts`).
1295
- ...s.some((i) => i.sheetKind === "document") ? { includesDocumentSheets: !0 } : {}
1314
+ ...s.some((n) => n.sheetKind === "document") ? { includesDocumentSheets: !0 } : {}
1296
1315
  };
1297
1316
  }
1298
- function kt(e, t) {
1317
+ function Ft(e, t) {
1299
1318
  return e ?? { tz: "UTC", weekStart: 1, anchor: { iso: t ?? "1970-01-01T00:00:00.000Z" } };
1300
1319
  }
1301
- function $t(e, t, a) {
1302
- var c, R, m;
1303
- const { input: s } = t, d = ks(e, s), i = (f, b) => ({
1304
- filterId: s.id,
1305
- label: s.label,
1320
+ function At(e, t, a, s) {
1321
+ var g, A, c;
1322
+ const { input: r } = t, n = Fs(e, r, s), i = (m, F) => ({
1323
+ filterId: r.id,
1324
+ label: r.label,
1306
1325
  editable: !1,
1307
- kind: b,
1308
- notEditable: { reason: f, message: Ts[f] },
1309
- reaches: d.reaches,
1310
- excluded: d.excluded,
1311
- ...d.blocked ? { blocked: d.blocked } : {}
1326
+ kind: F,
1327
+ notEditable: { reason: m, message: $s[m] },
1328
+ reaches: n.reaches,
1329
+ excluded: n.excluded,
1330
+ ...n.blocked ? { blocked: n.blocked } : {},
1331
+ ...n.relationshipPending ? { relationshipPending: n.relationshipPending } : {}
1312
1332
  });
1313
- if (s.filter.kind === "global-date") return i("global_date", "global_date");
1314
- const n = Ea(s.filter).filter((f) => f.kind === "semantic");
1315
- if (n.length !== 1 || n[0].kind !== "semantic") return i("not_semantic", "field");
1316
- const o = $s(e, s);
1317
- if (!o || t.origin !== "embeddedInput") return i("scope_not_expressible", "field");
1318
- const p = ((c = s.filter.fieldMeta) == null ? void 0 : c.name) ?? ((R = s.filter.column) == null ? void 0 : R.split(".").pop()) ?? "", y = gt({
1333
+ if (r.filter.kind === "global-date") return i("global_date", "global_date");
1334
+ const d = Wt(r.filter).filter((m) => m.kind === "semantic");
1335
+ if (d.length !== 1 || d[0].kind !== "semantic") return i("not_semantic", "field");
1336
+ const u = As(e, r);
1337
+ if (!u || t.origin !== "embeddedInput") return i("scope_not_expressible", "field");
1338
+ const b = ((g = r.filter.fieldMeta) == null ? void 0 : g.name) ?? ((A = r.filter.column) == null ? void 0 : A.split(".").pop()) ?? "", y = It({
1319
1339
  dashboard: e,
1320
- target: { kind: "dashboardInput", input: s, scope: {} },
1321
- calendar: kt(a, void 0)
1322
- }).value, _ = _t(s.filter.dataType), g = _ || (m = y == null ? void 0 : y.values) == null ? void 0 : m.filter((f) => ["string", "number", "boolean"].includes(typeof f)), C = y && "relativeMeta" in y ? y.relativeMeta : void 0, w = _ && C ? ka(C) : null;
1340
+ target: { kind: "dashboardInput", input: r, scope: {} },
1341
+ calendar: Ft(a, void 0)
1342
+ }).value, C = St(r.filter.dataType), p = C || (c = y == null ? void 0 : y.values) == null ? void 0 : c.filter((m) => ["string", "number", "boolean"].includes(typeof m)), $ = y && "relativeMeta" in y ? y.relativeMeta : void 0, _ = C && $ ? Aa($) : null;
1323
1343
  return {
1324
- filterId: s.id,
1325
- label: s.label,
1344
+ filterId: r.id,
1345
+ label: r.label,
1326
1346
  editable: !0,
1327
- domainId: n[0].domainId,
1328
- datasetName: n[0].datasetName,
1329
- field: p,
1330
- selection: s.filter.type === "single" ? "single" : "multiple",
1331
- ...g != null && g.length ? { defaultValues: g } : {},
1332
- ...w ? { defaultPeriod: w } : {},
1333
- ..._ ? { datePicker: s.filter.dateSelectionMode === "day" ? "day" : s.filter.dateSelectionMode === "months" ? "month" : "range" } : {},
1334
- ...o,
1335
- ...d
1347
+ domainId: d[0].domainId,
1348
+ datasetName: d[0].datasetName,
1349
+ field: b,
1350
+ selection: r.filter.type === "single" ? "single" : "multiple",
1351
+ ...p != null && p.length ? { defaultValues: p } : {},
1352
+ ..._ ? { defaultPeriod: _ } : {},
1353
+ ...C ? { datePicker: r.filter.dateSelectionMode === "day" ? "day" : r.filter.dateSelectionMode === "months" ? "month" : "range" } : {},
1354
+ ...u,
1355
+ ...n
1336
1356
  };
1337
1357
  }
1338
- function Ft(e, t) {
1339
- return de(e).inputs.map((a) => $t(e, a, t));
1340
- }
1341
- function he(e, t, a) {
1342
- const s = de(e).findFilterInput({ inputId: t });
1343
- return s ? $t(e, s, a) : void 0;
1344
- }
1345
- function Fs(e, t, a, s, d) {
1346
- var f, b, A, D, $, U;
1347
- const i = oe(e, { sql: !0 });
1348
- if (!i.editable) return [i.message];
1349
- const n = i.query, o = t;
1350
- if ("sql" in t) return o.sql === n.sql && o.connectionId === n.connectionId ? [] : ["the SQL"];
1351
- const p = (s == null ? void 0 : s.source.kind) === "semantic" ? oe({
1358
+ function Rt(e, t, a) {
1359
+ return de(e).inputs.map((s) => At(e, s, t, a));
1360
+ }
1361
+ function pe(e, t, a, s) {
1362
+ const r = de(e).findFilterInput({ inputId: t });
1363
+ return r ? At(e, r, a, s) : void 0;
1364
+ }
1365
+ function Rs(e, t, a, s, r) {
1366
+ var c, m, F, k, D, N;
1367
+ const n = oe(e, { sql: !0 });
1368
+ if (!n.editable) return [n.message];
1369
+ const i = n.query, d = t;
1370
+ if ("sql" in t) return d.sql === i.sql && d.connectionId === i.connectionId ? [] : ["the SQL"];
1371
+ const u = (s == null ? void 0 : s.source.kind) === "semantic" ? oe({
1352
1372
  id: e.id,
1353
1373
  title: e.title,
1354
1374
  type: s.type,
@@ -1356,472 +1376,472 @@ function Fs(e, t, a, s, d) {
1356
1376
  connectionId: s.source.connectionId,
1357
1377
  config: s.config
1358
1378
  }, { sql: !0 }) : void 0;
1359
- if (p && !p.editable) return ["the compiled query"];
1360
- const y = p != null && p.editable ? p.query : void 0, _ = String(o.datasetName ?? ""), g = [], C = (F) => ne(F, _), w = (F, N, O) => {
1361
- const B = N ?? [], j = O ?? [];
1362
- (B.length !== j.length || B.some((M, E) => C(M) !== C(j[E]))) && g.push(F);
1379
+ if (u && !u.editable) return ["the compiled query"];
1380
+ const b = u != null && u.editable ? u.query : void 0, y = String(d.datasetName ?? ""), C = [], p = (R) => ne(R, y), $ = (R, O, E) => {
1381
+ const V = O ?? [], K = E ?? [];
1382
+ (V.length !== K.length || V.some((L, q) => p(L) !== p(K[q]))) && C.push(R);
1363
1383
  };
1364
- for (const F of ["domainId", "datasetName"]) o[F] !== n[F] && g.push(F);
1365
- if (w("measures", o.measures, n.measures), w("columns", o.columns, n.columns), a || i.matrix) {
1366
- const F = (O) => new Set(((O == null ? void 0 : O.columns) ?? []).map(C)), N = (O, B) => (O ?? []).filter((j) => !F(B).has(C(j)));
1367
- w("dimensions", N(o.dimensions, a), N(n.dimensions, i.matrix)), w("matrix.columns", a == null ? void 0 : a.columns, (f = i.matrix) == null ? void 0 : f.columns);
1384
+ for (const R of ["domainId", "datasetName"]) d[R] !== i[R] && C.push(R);
1385
+ if ($("measures", d.measures, i.measures), $("columns", d.columns, i.columns), a || n.matrix) {
1386
+ const R = (E) => new Set(((E == null ? void 0 : E.columns) ?? []).map(p)), O = (E, V) => (E ?? []).filter((K) => !R(V).has(p(K)));
1387
+ $("dimensions", O(d.dimensions, a), O(i.dimensions, n.matrix)), $("matrix.columns", a == null ? void 0 : a.columns, (c = n.matrix) == null ? void 0 : c.columns);
1368
1388
  } else
1369
- w("dimensions", o.dimensions, n.dimensions);
1370
- const c = o.timeWindow !== void 0 && !o.timeGrain, R = c && n.timeWindow === void 0 ? void 0 : c && o.dateField === void 0 ? y == null ? void 0 : y.dateField : o.dateField;
1371
- R !== void 0 && (n.dateField === void 0 || C(R) !== C(n.dateField)) && g.push("dateField"), o.timeGrain !== void 0 && o.timeGrain !== n.timeGrain && g.push("timeGrain");
1372
- const m = (b = e.config) != null && b.matrix ? e.config.matrix.spec.measures.map((F) => F.kind === "aggregate" ? { aggregate: F.aggregate } : {}) : ((A = e.config) == null ? void 0 : A.metricColumns) ?? [];
1373
- (o.measures ?? []).forEach((F, N) => {
1374
- const O = F && typeof F == "object" ? F.aggregate : void 0;
1375
- O && ct(m[N] ?? {}) !== O && g.push(`the aggregate of measures[${N}]`);
1389
+ $("dimensions", d.dimensions, i.dimensions);
1390
+ const _ = d.timeWindow !== void 0 && !d.timeGrain, g = _ && i.timeWindow === void 0 ? void 0 : _ && d.dateField === void 0 ? b == null ? void 0 : b.dateField : d.dateField;
1391
+ g !== void 0 && (i.dateField === void 0 || p(g) !== p(i.dateField)) && C.push("dateField"), d.timeGrain !== void 0 && d.timeGrain !== i.timeGrain && C.push("timeGrain");
1392
+ const A = (m = e.config) != null && m.matrix ? e.config.matrix.spec.measures.map((R) => R.kind === "aggregate" ? { aggregate: R.aggregate } : {}) : ((F = e.config) == null ? void 0 : F.metricColumns) ?? [];
1393
+ (d.measures ?? []).forEach((R, O) => {
1394
+ const E = R && typeof R == "object" ? R.aggregate : void 0;
1395
+ E && ht(A[O] ?? {}) !== E && C.push(`the aggregate of measures[${O}]`);
1376
1396
  });
1377
- for (const { key: F, label: N } of Re(t))
1378
- Xt(e, F) !== N && g.push(`the label "${N}"`);
1379
- if (!d || d.aspects.includes("filters")) {
1380
- const F = o.filters ?? [];
1381
- let N = n.filters ?? [];
1382
- const O = o.timeWindow, B = n.timeWindow, j = (M, E) => {
1383
- const Y = (ge) => JSON.stringify((ge ?? []).map(String));
1384
- return C(M.field) === C(E.field) && M.operator === E.operator && (M.scope ?? "row") === (E.scope ?? "row") && (typeof M.field == "object" ? M.field.aggregate : void 0) === (typeof E.field == "object" ? E.field.aggregate : void 0) && (M.values === void 0 || Y(M.values) === Y(E.values));
1397
+ for (const { key: R, label: O } of Ee(t))
1398
+ ea(e, R) !== O && C.push(`the label "${O}"`);
1399
+ if (!r || r.aspects.includes("filters")) {
1400
+ const R = d.filters ?? [];
1401
+ let O = i.filters ?? [];
1402
+ const E = d.timeWindow, V = i.timeWindow, K = (L, q) => {
1403
+ const j = (De) => JSON.stringify((De ?? []).map(String));
1404
+ return p(L.field) === p(q.field) && L.operator === q.operator && (L.scope ?? "row") === (q.scope ?? "row") && (typeof L.field == "object" ? L.field.aggregate : void 0) === (typeof q.field == "object" ? q.field.aggregate : void 0) && (L.values === void 0 || j(L.values) === j(q.values));
1385
1405
  };
1386
- if (O && !B) {
1387
- const M = ((y == null ? void 0 : y.filters) ?? []).filter(
1388
- (E) => !(y != null && y.timeWindow) && !F.some((Y) => j(Y, E))
1406
+ if (E && !V) {
1407
+ const L = ((b == null ? void 0 : b.filters) ?? []).filter(
1408
+ (q) => !(b != null && b.timeWindow) && !R.some((j) => K(j, q))
1389
1409
  );
1390
- (!M.length || M.some((E) => !N.some((Y) => j(E, Y)))) && g.push("timeWindow"), N = N.filter((E) => !M.some((Y) => j(Y, E)));
1391
- } else O ? Object.keys(O).filter((E) => !(E === "kind" && O.kind === "relative" && (B == null ? void 0 : B.kind) === void 0)).some((E) => !Le(O[E], B == null ? void 0 : B[E])) && g.push("timeWindow") : B && g.push("timeWindow");
1392
- (F.length !== N.length || F.some((M, E) => !j(M, N[E]))) && g.push("filters");
1410
+ (!L.length || L.some((q) => !O.some((j) => K(q, j)))) && C.push("timeWindow"), O = O.filter((q) => !L.some((j) => K(j, q)));
1411
+ } else E ? Object.keys(E).filter((q) => !(q === "kind" && E.kind === "relative" && (V == null ? void 0 : V.kind) === void 0)).some((q) => !Le(E[q], V == null ? void 0 : V[q])) && C.push("timeWindow") : V && C.push("timeWindow");
1412
+ (R.length !== O.length || R.some((L, q) => !K(L, O[q]))) && C.push("filters");
1393
1413
  }
1394
- if (o.orderBy !== void 0) {
1395
- const F = o.orderBy, N = ($ = (D = e.config) == null ? void 0 : D.sortByColumns) == null ? void 0 : $[0], O = N && Jt(e.config ?? {}, N), B = F.field && typeof F.field == "object" ? F.field.aggregate : void 0;
1396
- (!N || !O || N.direction !== F.direction || C(F.field) !== Zt(O.name, ea(O)) || B !== void 0 && ct(O) !== B) && g.push("orderBy");
1414
+ if (d.orderBy !== void 0) {
1415
+ const R = d.orderBy, O = (D = (k = e.config) == null ? void 0 : k.sortByColumns) == null ? void 0 : D[0], E = O && ta(e.config ?? {}, O), V = R.field && typeof R.field == "object" ? R.field.aggregate : void 0;
1416
+ (!O || !E || O.direction !== R.direction || p(R.field) !== aa(E.name, sa(E)) || V !== void 0 && ht(E) !== V) && C.push("orderBy");
1397
1417
  }
1398
- return o.limit !== void 0 && ((U = e.config) == null ? void 0 : U.rowLimit) !== o.limit && g.push("limit"), g;
1418
+ return d.limit !== void 0 && ((N = e.config) == null ? void 0 : N.rowLimit) !== d.limit && C.push("limit"), C;
1399
1419
  }
1400
1420
  class ue extends Error {
1401
1421
  }
1402
- const Pe = (e) => (e ?? "").trim().toLowerCase(), we = da, ht = { measures: fa, records: ua, sql: ca }, Se = {
1422
+ const Pe = (e) => (e ?? "").trim().toLowerCase(), xe = ua, mt = { measures: ma, records: pa, sql: fa }, Se = {
1403
1423
  measures: "a measures query (measures, with optional dimensions)",
1404
1424
  records: "a records query (columns)",
1405
1425
  sql: "a SQL query"
1406
1426
  };
1407
- function At(e, t) {
1427
+ function Et(e, t) {
1408
1428
  return t.path.reduce((a, s) => typeof s == "number" ? `${a}[${s}]` : `${a}.${s}`, e);
1409
1429
  }
1410
- async function hi(e, t, a) {
1411
- var ge, Qe, Ke, We, He, Ye, Xe, Je;
1412
- const s = [], d = [], i = [], n = [], o = /* @__PURE__ */ new Set(), p = [], y = /* @__PURE__ */ new Map(), _ = { calendar: a.calendar };
1413
- let g = e, C = 0;
1414
- if (t.length > it)
1430
+ async function mi(e, t, a) {
1431
+ var Qe, Ke, He, We, Ye, Xe, Je, Ze, et;
1432
+ const s = [], r = [], n = [], i = [], d = /* @__PURE__ */ new Set(), u = [], b = /* @__PURE__ */ new Map(), y = { calendar: a.calendar }, C = a.relationshipReach ? { relationshipReach: a.relationshipReach } : {};
1433
+ let p = e, $ = 0;
1434
+ if (t.length > ot)
1415
1435
  return {
1416
1436
  ok: !1,
1417
1437
  problems: [
1418
1438
  {
1419
1439
  code: "too_many_changes",
1420
- message: `A proposal takes at most ${it} changes; this one has ${t.length}.`,
1440
+ message: `A proposal takes at most ${ot} changes; this one has ${t.length}.`,
1421
1441
  path: "changes",
1422
1442
  fix: "Split the changes into several proposals."
1423
1443
  }
1424
1444
  ]
1425
1445
  };
1426
- const w = [];
1427
- if (t.forEach((h, r) => {
1428
- const l = ta.safeParse(h);
1446
+ const _ = [];
1447
+ if (t.forEach((f, o) => {
1448
+ const l = ia.safeParse(f);
1429
1449
  if (l.success) {
1430
- w.push(l.data);
1450
+ _.push(l.data);
1431
1451
  return;
1432
1452
  }
1433
- for (const u of l.error.issues)
1453
+ for (const h of l.error.issues)
1434
1454
  s.push({
1435
1455
  code: "invalid_change",
1436
- message: u.message,
1437
- path: At(`changes[${r}]`, u),
1456
+ message: h.message,
1457
+ path: Et(`changes[${o}]`, h),
1438
1458
  fix: "Send the change in the shape the tool schema gives."
1439
1459
  });
1440
1460
  }), s.length) return { ok: !1, problems: s };
1441
- const c = (h) => {
1442
- throw s.push(h), new ue();
1443
- }, R = (h) => {
1444
- a.capabilities.sql || c({
1461
+ const g = (f) => {
1462
+ throw s.push(f), new ue();
1463
+ }, A = (f) => {
1464
+ a.capabilities.sql || g({
1445
1465
  code: "capability_required",
1446
1466
  message: "This change creates, reads or changes a SQL card, which needs SQL access.",
1447
- path: h,
1467
+ path: f,
1448
1468
  fix: "Use a measures or records query, or ask an administrator for SQL access."
1449
- }), o.add("sql");
1450
- }, m = (h, r) => {
1451
- const l = st(g, [h], _);
1452
- l.ok ? (g = l.dashboard, i.push(h)) : c({ code: "invalid_change", message: l.failedAt.message, path: r, ...l.failedAt.fix ? { fix: l.failedAt.fix } : {} });
1453
- }, f = (h, r) => {
1454
- if (h.startsWith("$")) {
1455
- const l = y.get(h);
1456
- return (!l || l.kind !== "card") && c({
1469
+ }), d.add("sql");
1470
+ }, c = (f, o) => {
1471
+ const l = nt(p, [f], y);
1472
+ l.ok ? (p = l.dashboard, n.push(f)) : g({ code: "invalid_change", message: l.failedAt.message, path: o, ...l.failedAt.fix ? { fix: l.failedAt.fix } : {} });
1473
+ }, m = (f, o) => {
1474
+ if (f.startsWith("$")) {
1475
+ const l = b.get(f);
1476
+ return (!l || l.kind !== "card") && g({
1457
1477
  code: "handle_unknown",
1458
- message: `${h} isn't a card handle defined earlier in this list.`,
1459
- path: r,
1478
+ message: `${f} isn't a card handle defined earlier in this list.`,
1479
+ path: o,
1460
1480
  fix: "Define the handle with an earlier card.add, or use the card id from the outline."
1461
1481
  }), l.id;
1462
1482
  }
1463
- return re(g).some((l) => l.cardId === h) || c({
1483
+ return re(p).some((l) => l.cardId === f) || g({
1464
1484
  code: "card_not_found",
1465
- message: `There's no card ${h} on this dashboard.`,
1466
- path: r,
1485
+ message: `There's no card ${f} on this dashboard.`,
1486
+ path: o,
1467
1487
  fix: "Read the outline again and use its card ids."
1468
- }), h;
1469
- }, b = (h, r) => {
1470
- if (h.startsWith("$")) {
1471
- const u = y.get(h);
1472
- return (!u || u.kind !== "filter") && c({
1488
+ }), f;
1489
+ }, F = (f, o) => {
1490
+ if (f.startsWith("$")) {
1491
+ const h = b.get(f);
1492
+ return (!h || h.kind !== "filter") && g({
1473
1493
  code: "handle_unknown",
1474
- message: `${h} isn't a filter handle defined earlier in this list.`,
1475
- path: r,
1494
+ message: `${f} isn't a filter handle defined earlier in this list.`,
1495
+ path: o,
1476
1496
  fix: "Define the handle with an earlier filter.add, or use the filter id from the outline."
1477
- }), u.id;
1497
+ }), h.id;
1478
1498
  }
1479
- return (Array.isArray(g.inputs) ? g.inputs : []).some((u) => u.id === h && u.kind === "filter") || c({
1499
+ return (Array.isArray(p.inputs) ? p.inputs : []).some((h) => h.id === f && h.kind === "filter") || g({
1480
1500
  code: "filter_not_found",
1481
- message: `There's no filter ${h} on this dashboard.`,
1482
- path: r,
1501
+ message: `There's no filter ${f} on this dashboard.`,
1502
+ path: o,
1483
1503
  fix: "Read the outline again and use its filter ids."
1484
- }), h;
1485
- }, A = () => (g.sheets ?? []).filter((h) => !dt(h)), D = () => A().map((h) => ({ sheetId: h.id, title: h.title ?? "" })), $ = (h, r) => {
1486
- const l = (g.sheets ?? []).find((u) => u.id === h);
1487
- return l || c({ code: "sheet_not_found", message: `There's no sheet ${h} on this dashboard.`, path: r, fix: "Read the outline again and use its sheet ids.", details: { sheets: D() } }), dt(l) && c({ code: "sheet_not_a_grid", message: `"${l.title}" is a Document sheet.`, path: r, fix: "Add the card to a grid sheet; Document sheets are changed in the editor.", details: { sheets: D() } }), l;
1488
- }, U = (h, r, l, u) => {
1489
- var k;
1490
- for (const x of ha(r, l)) c({ ...x, path: `${u}.${x.path}` });
1491
- const I = ce[h], T = we(r), S = r.dateField;
1492
- if (S && typeof S != "string" && S.label && !r.timeGrain && c({
1504
+ }), f;
1505
+ }, k = () => (p.sheets ?? []).filter((f) => !ct(f)), D = () => k().map((f) => ({ sheetId: f.id, title: f.title ?? "" })), N = (f, o) => {
1506
+ const l = (p.sheets ?? []).find((h) => h.id === f);
1507
+ return l || g({ code: "sheet_not_found", message: `There's no sheet ${f} on this dashboard.`, path: o, fix: "Read the outline again and use its sheet ids.", details: { sheets: D() } }), ct(l) && g({ code: "sheet_not_a_grid", message: `"${l.title}" is a Document sheet.`, path: o, fix: "Add the card to a grid sheet; Document sheets are changed in the editor.", details: { sheets: D() } }), l;
1508
+ }, R = (f, o, l, h) => {
1509
+ var T;
1510
+ for (const w of ga(o, l)) g({ ...w, path: `${h}.${w.path}` });
1511
+ const I = ce[f], v = xe(o), S = o.dateField;
1512
+ if (S && typeof S != "string" && S.label && !o.timeGrain && g({
1493
1513
  code: "invalid_change",
1494
1514
  message: "A label names a column, and the date field is a column only when the card groups by it.",
1495
- path: `${u}.query.dateField.label`,
1515
+ path: `${h}.query.dateField.label`,
1496
1516
  fix: "Send timeGrain to group by the date, or leave the label out."
1497
- }), !I.forms.includes(T)) {
1498
- const x = Object.keys(ce).filter((v) => ce[v].forms.includes(T));
1499
- c({
1517
+ }), !I.forms.includes(v)) {
1518
+ const w = Object.keys(ce).filter((x) => ce[x].forms.includes(v));
1519
+ g({
1500
1520
  code: "type_not_supported",
1501
- message: `A ${h.replace(/_/g, " ")} card takes ${I.forms.map((v) => Se[v]).join(" or ")}, not ${Se[T]}.`,
1502
- path: `${u}.query`,
1503
- fix: `Send ${I.forms.map((v) => Se[v]).join(" or ")}, or use a type this query fits: ${x.join(", ")}.`
1521
+ message: `A ${f.replace(/_/g, " ")} card takes ${I.forms.map((x) => Se[x]).join(" or ")}, not ${Se[v]}.`,
1522
+ path: `${h}.query`,
1523
+ fix: `Send ${I.forms.map((x) => Se[x]).join(" or ")}, or use a type this query fits: ${w.join(", ")}.`
1504
1524
  });
1505
1525
  }
1506
- if (T === "measures") {
1507
- const x = r, v = x.measures.length;
1508
- I.measures && (v < I.measures.min || I.measures.max !== void 0 && v > I.measures.max) && c({
1526
+ if (v === "measures") {
1527
+ const w = o, x = w.measures.length;
1528
+ I.measures && (x < I.measures.min || I.measures.max !== void 0 && x > I.measures.max) && g({
1509
1529
  code: "type_not_supported",
1510
- message: `A ${h.replace(/_/g, " ")} card shows exactly ${I.measures.max} measure.`,
1511
- path: `${u}.query.measures`,
1530
+ message: `A ${f.replace(/_/g, " ")} card shows exactly ${I.measures.max} measure.`,
1531
+ path: `${h}.query.measures`,
1512
1532
  fix: "Send one measure, or use a table or chart for several."
1513
- }), !I.dimensions && ((k = x.dimensions) != null && k.length) && c({
1533
+ }), !I.dimensions && ((T = w.dimensions) != null && T.length) && g({
1514
1534
  code: "type_not_supported",
1515
- message: `A ${h.replace(/_/g, " ")} card shows one number, so it has no dimensions.`,
1516
- path: `${u}.query.dimensions`,
1535
+ message: `A ${f.replace(/_/g, " ")} card shows one number, so it has no dimensions.`,
1536
+ path: `${h}.query.dimensions`,
1517
1537
  fix: "Remove the dimensions, or use a table or chart."
1518
- }), h === "matrix" && (x.orderBy || x.limit) && c({
1538
+ }), f === "matrix" && (w.orderBy || w.limit) && g({
1519
1539
  code: "type_not_supported",
1520
1540
  message: "A Matrix's sorting and top N are set in the editor.",
1521
- path: `${u}.query`,
1541
+ path: `${h}.query`,
1522
1542
  fix: "Leave out orderBy and limit for a Matrix."
1523
1543
  });
1524
1544
  }
1525
- if (I.matrixColumns && !l && c({
1545
+ if (I.matrixColumns && !l && g({
1526
1546
  code: "type_not_supported",
1527
1547
  message: "A Matrix needs matrix.columns: the query fields that run across the top.",
1528
- path: `${u}.matrix`,
1548
+ path: `${h}.matrix`,
1529
1549
  fix: "Send matrix: { columns: [...] } naming dimensions or the date field of the query (an empty list puts nothing across the top)."
1530
- }), !I.matrixColumns && l && c({ code: "type_not_supported", message: "matrix.columns is only for Matrix cards.", path: `${u}.matrix`, fix: 'Leave out matrix, or use type "matrix".' }), l && T === "measures") {
1531
- const x = r, v = x.datasetName, V = [...x.dimensions ?? [], ...x.timeGrain && x.dateField ? [x.dateField] : []];
1532
- V.length && l.columns.length >= V.length && V.every((q) => l.columns.some((L) => ne(L, v) === ne(q, v))) && c({
1550
+ }), !I.matrixColumns && l && g({ code: "type_not_supported", message: "matrix.columns is only for Matrix cards.", path: `${h}.matrix`, fix: 'Leave out matrix, or use type "matrix".' }), l && v === "measures") {
1551
+ const w = o, x = w.datasetName, G = [...w.dimensions ?? [], ...w.timeGrain && w.dateField ? [w.dateField] : []];
1552
+ G.length && l.columns.length >= G.length && G.every((P) => l.columns.some((B) => ne(B, x) === ne(P, x))) && g({
1533
1553
  code: "type_not_supported",
1534
1554
  message: "A Matrix needs at least one field down the side.",
1535
- path: `${u}.matrix.columns`,
1555
+ path: `${h}.matrix.columns`,
1536
1556
  fix: "Leave one dimension or the date field out of matrix.columns."
1537
1557
  });
1538
- const Q = new Set([...x.dimensions ?? [], ...x.dateField ? [x.dateField] : []].map((q) => ne(q, v)));
1539
- l.columns.forEach((q, L) => {
1540
- Q.has(ne(q, v)) || c({
1558
+ const Q = new Set([...w.dimensions ?? [], ...w.dateField ? [w.dateField] : []].map((P) => ne(P, x)));
1559
+ l.columns.forEach((P, B) => {
1560
+ Q.has(ne(P, x)) || g({
1541
1561
  code: "type_not_supported",
1542
- message: `"${lt(q)}" isn't one of the query's dimensions or its date field.`,
1543
- path: `${u}.matrix.columns[${L}]`,
1562
+ message: `"${ut(P)}" isn't one of the query's dimensions or its date field.`,
1563
+ path: `${h}.matrix.columns[${B}]`,
1544
1564
  fix: "Name dimensions or the date field of the query in matrix.columns."
1545
1565
  });
1546
1566
  });
1547
1567
  }
1548
- }, F = (h, r) => c({
1549
- code: h.code === "query_not_kept" ? "card_not_editable" : "invalid_change",
1550
- message: h.message,
1551
- path: `${r}.query`,
1552
- fix: h.code === "query_not_kept" ? "Tell the user to make this change in the editor." : "Read the outline again and propose again.",
1553
- details: { reason: "not_expressible", ..."parts" in h ? { parts: h.parts } : {} }
1554
- }), N = (h, r, l, u, I, T, S) => {
1555
- const k = Fs(h, r, l, T, S);
1556
- k.length && c({
1568
+ }, O = (f, o) => g({
1569
+ code: f.code === "query_not_kept" ? "card_not_editable" : "invalid_change",
1570
+ message: f.message,
1571
+ path: `${o}.query`,
1572
+ fix: f.code === "query_not_kept" ? "Tell the user to make this change in the editor." : "Read the outline again and propose again.",
1573
+ details: { reason: "not_expressible", ..."parts" in f ? { parts: f.parts } : {} }
1574
+ }), E = (f, o, l, h, I, v, S) => {
1575
+ const T = Rs(f, o, l, v, S);
1576
+ T.length && g({
1557
1577
  code: "card_not_editable",
1558
1578
  message: `As changed, "${I}" wouldn't run the query asked for, so make this change in the editor.`,
1559
- path: `${u}.query`,
1579
+ path: `${h}.query`,
1560
1580
  fix: "Tell the user to make this change in the editor.",
1561
- details: { reason: "not_expressible", detail: `doesn't hold: ${k.join(", ")}` }
1581
+ details: { reason: "not_expressible", detail: `doesn't hold: ${T.join(", ")}` }
1562
1582
  });
1563
- }, O = async (h, r, l, u) => {
1564
- const I = nt(h);
1565
- if ("sql" in r)
1566
- return R(`${u}.query`), { type: I, source: { kind: "sql", connectionId: r.connectionId, sql: r.sql } };
1567
- const T = I === "matrixTable" || I === "detailTable" ? "table" : I, S = await a.compileCardQuery({ query: r, chartType: T });
1583
+ }, V = async (f, o, l, h) => {
1584
+ const I = rt(f);
1585
+ if ("sql" in o)
1586
+ return A(`${h}.query`), { type: I, source: { kind: "sql", connectionId: o.connectionId, sql: o.sql } };
1587
+ const v = I === "matrixTable" || I === "detailTable" ? "table" : I, S = await a.compileCardQuery({ query: o, chartType: v });
1568
1588
  if (!S.ok)
1569
- throw s.push(...S.problems.map((v) => ({ ...v, path: v.path ? `${u}.query.${v.path}` : `${u}.query` }))), new ue();
1570
- d.push(...S.warnings.map((v) => ({ ...v, path: v.path ?? `${u}.query` })));
1571
- let k = { ...S.part, type: I };
1572
- const x = k.config ?? {};
1589
+ throw s.push(...S.problems.map((x) => ({ ...x, path: x.path ? `${h}.query.${x.path}` : `${h}.query` }))), new ue();
1590
+ r.push(...S.warnings.map((x) => ({ ...x, path: x.path ?? `${h}.query` })));
1591
+ let T = { ...S.part, type: I };
1592
+ const w = T.config ?? {};
1573
1593
  if (I === "detailTable") {
1574
- const v = pa(ma("table", "detailTable", x)) ?? {};
1575
- k = { ...k, config: Rs(v) };
1594
+ const x = ba(Ia("table", "detailTable", w)) ?? {};
1595
+ T = { ...T, config: Os(x) };
1576
1596
  }
1577
- return I === "matrixTable" && (k = await B(k, x, r, l, u)), Es(k, Re(r));
1578
- }, B = async (h, r, l, u, I) => {
1597
+ return I === "matrixTable" && (T = await K(T, w, o, l, h)), Ns(T, Ee(o));
1598
+ }, K = async (f, o, l, h, I) => {
1579
1599
  var Q;
1580
- const T = await a.loadCardSource({ domainId: l.domainId, datasetName: l.datasetName });
1581
- if (T || c({ code: "field_not_found", message: `The dataset "${l.datasetName}" isn't available.`, path: `${I}.query.datasetName`, fix: "Find datasets with semaphor_list_datasets." }), h.source.kind !== "semantic") throw new ue();
1582
- const S = { id: "scratch", title: "", type: "table", dataSource: h.source.dataSource, config: r }, k = Ia(S, "matrixTable", { catalog: T.fields, createId: a.newId }), x = k.status === "changed" ? (Q = k.card.config) == null ? void 0 : Q.matrix : void 0;
1583
- (k.status !== "changed" || k.leftOut.length || !x) && c({
1600
+ const v = await a.loadCardSource({ domainId: l.domainId, datasetName: l.datasetName });
1601
+ if (v || g({ code: "field_not_found", message: `The dataset "${l.datasetName}" isn't available.`, path: `${I}.query.datasetName`, fix: "Find datasets with semaphor_list_datasets." }), f.source.kind !== "semantic") throw new ue();
1602
+ const S = { id: "scratch", title: "", type: "table", dataSource: f.source.dataSource, config: o }, T = Ca(S, "matrixTable", { catalog: v.fields, createId: a.newId }), w = T.status === "changed" ? (Q = T.card.config) == null ? void 0 : Q.matrix : void 0;
1603
+ (T.status !== "changed" || T.leftOut.length || !w) && g({
1584
1604
  code: "type_not_supported",
1585
- message: k.status === "changed" && k.leftOut.length ? `These fields can't run in a Matrix: ${k.leftOut.join(", ")}.` : "This query can't be shown as a Matrix.",
1605
+ message: T.status === "changed" && T.leftOut.length ? `These fields can't run in a Matrix: ${T.leftOut.join(", ")}.` : "This query can't be shown as a Matrix.",
1586
1606
  path: `${I}.query`,
1587
1607
  fix: "Use plain dataset fields for a Matrix, or use a table."
1588
1608
  });
1589
- let v = x;
1590
- const V = l.datasetName;
1591
- for (const [q, L] of u.columns.entries()) {
1592
- const G = [...v.spec.rows, ...v.spec.columns].find(
1593
- (z) => ya(z.field) === ne(L, V)
1609
+ let x = w;
1610
+ const G = l.datasetName;
1611
+ for (const [P, B] of h.columns.entries()) {
1612
+ const U = [...x.spec.rows, ...x.spec.columns].find(
1613
+ (z) => Sa(z.field) === ne(B, G)
1594
1614
  );
1595
- G || c({ code: "type_not_supported", message: `"${lt(L)}" isn't a level of this Matrix.`, path: `${I}.matrix.columns[${q}]`, fix: "Name dimensions or the date field of the query in matrix.columns." }), v = _a(v, Ca(v.spec, G.id, "columns")).config;
1615
+ U || g({ code: "type_not_supported", message: `"${ut(B)}" isn't a level of this Matrix.`, path: `${I}.matrix.columns[${P}]`, fix: "Name dimensions or the date field of the query in matrix.columns." }), x = va(x, wa(x.spec, U.id, "columns")).config;
1596
1616
  }
1597
- return { ...h, config: { matrix: v } };
1598
- }, j = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map();
1599
- for (const [h, r] of w.entries()) {
1600
- const l = `changes[${h}]`;
1617
+ return { ...f, config: { matrix: x } };
1618
+ }, L = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map();
1619
+ for (const [f, o] of _.entries()) {
1620
+ const l = `changes[${f}]`;
1601
1621
  try {
1602
- switch (r.op) {
1622
+ switch (o.op) {
1603
1623
  case "card.add": {
1604
- const u = r.position && typeof r.position == "object" ? (() => {
1605
- const L = f(r.position.after, `${l}.position.after`), G = re(g).find(
1606
- (z) => z.cardId === L && z.kind === "frameCard"
1624
+ const h = o.position && typeof o.position == "object" ? (() => {
1625
+ const B = m(o.position.after, `${l}.position.after`), U = re(p).find(
1626
+ (z) => z.cardId === B && z.kind === "frameCard"
1607
1627
  );
1608
- return !G || G.kind !== "frameCard" ? c({
1628
+ return !U || U.kind !== "frameCard" ? g({
1609
1629
  code: "card_not_found",
1610
- message: `${r.position.after} isn't a card on a grid sheet.`,
1630
+ message: `${o.position.after} isn't a card on a grid sheet.`,
1611
1631
  path: `${l}.position.after`,
1612
1632
  fix: "Use a cardId from semaphor_get_dashboard_details on the same sheet, or a handle from this proposal."
1613
- }) : (r.sheetId && r.sheetId !== G.sheetId && c({
1633
+ }) : (o.sheetId && o.sheetId !== U.sheetId && g({
1614
1634
  code: "invalid_change",
1615
- message: `position.after names a card on another sheet than ${r.sheetId}.`,
1635
+ message: `position.after names a card on another sheet than ${o.sheetId}.`,
1616
1636
  path: `${l}.position.after`,
1617
1637
  fix: "Leave out sheetId, or name the card's sheet."
1618
- }), { sheetId: G.sheetId, frameId: G.frameId });
1619
- })() : void 0, I = u ? $(u.sheetId, `${l}.position.after`) : r.sheetId ? $(r.sheetId, `${l}.sheetId`) : (() => {
1620
- const L = A();
1621
- return L.length !== 1 && c({
1622
- code: L.length ? "sheet_required" : "sheet_not_a_grid",
1623
- message: L.length ? "This dashboard has several grid sheets; say which one gets the card." : "This dashboard has no grid sheet to add a card to.",
1638
+ }), { sheetId: U.sheetId, frameId: U.frameId });
1639
+ })() : void 0, I = h ? N(h.sheetId, `${l}.position.after`) : o.sheetId ? N(o.sheetId, `${l}.sheetId`) : (() => {
1640
+ const B = k();
1641
+ return B.length !== 1 && g({
1642
+ code: B.length ? "sheet_required" : "sheet_not_a_grid",
1643
+ message: B.length ? "This dashboard has several grid sheets; say which one gets the card." : "This dashboard has no grid sheet to add a card to.",
1624
1644
  path: `${l}.sheetId`,
1625
- fix: L.length ? "Send sheetId: one of details.sheets." : "Add a grid sheet in the editor first.",
1645
+ fix: B.length ? "Send sheetId: one of details.sheets." : "Add a grid sheet in the editor first.",
1626
1646
  details: { sheets: D() }
1627
- }), L[0];
1647
+ }), B[0];
1628
1648
  })();
1629
- U(r.type, r.query, r.matrix, l);
1630
- const T = await O(r.type, r.query, r.matrix, l), S = {
1631
- ...Nt({ id: a.newId(), title: r.title, ...r.description ? { description: r.description } : {} }),
1632
- type: T.type
1633
- }, k = rt(S, T);
1634
- k.ok || c({ code: "invalid_change", message: k.message, path: l });
1635
- const x = k.ok ? k.card : S;
1636
- N(x, r.query, r.matrix, l, r.title, T);
1637
- const v = { id: a.newId(), cards: [x], activeCardId: x.id }, V = u ? { after: u.frameId } : typeof r.position == "string" ? r.position : void 0, Q = V || r.width ? { ...V ? { position: V } : {}, ...r.width ? { width: r.width } : {} } : void 0;
1638
- m({ op: "card.add", sheetId: I.id, frame: v, ...Q ? { placement: Q } : {}, changeIndex: h }, l);
1639
- const q = r.handle ?? `$card_${++C}`;
1640
- y.has(q) && c({ code: "invalid_change", message: `The handle ${q} is defined twice.`, path: `${l}.handle`, fix: "Give each new card or filter its own handle." }), y.set(q, { kind: "card", id: x.id, title: r.title }), n.push({ ref: q, kind: "card", id: x.id, title: r.title, changeIndex: h }), p.push(x.id);
1649
+ R(o.type, o.query, o.matrix, l);
1650
+ const v = await V(o.type, o.query, o.matrix, l), S = {
1651
+ ...Pt({ id: a.newId(), title: o.title, ...o.description ? { description: o.description } : {} }),
1652
+ type: v.type
1653
+ }, T = lt(S, v);
1654
+ T.ok || g({ code: "invalid_change", message: T.message, path: l });
1655
+ const w = T.ok ? T.card : S;
1656
+ E(w, o.query, o.matrix, l, o.title, v);
1657
+ const x = { id: a.newId(), cards: [w], activeCardId: w.id }, G = h ? { after: h.frameId } : typeof o.position == "string" ? o.position : void 0, Q = G || o.width ? { ...G ? { position: G } : {}, ...o.width ? { width: o.width } : {} } : void 0;
1658
+ c({ op: "card.add", sheetId: I.id, frame: x, ...Q ? { placement: Q } : {}, changeIndex: f }, l);
1659
+ const P = o.handle ?? `$card_${++$}`;
1660
+ b.has(P) && g({ code: "invalid_change", message: `The handle ${P} is defined twice.`, path: `${l}.handle`, fix: "Give each new card or filter its own handle." }), b.set(P, { kind: "card", id: w.id, title: o.title }), i.push({ ref: P, kind: "card", id: w.id, title: o.title, changeIndex: f }), u.push(w.id);
1641
1661
  break;
1642
1662
  }
1643
1663
  case "card.update": {
1644
- const u = f(r.cardId, `${l}.cardId`), I = ie(g, u);
1645
- I || c({ code: "card_not_editable", message: "Cards in Document sections are changed in the editor.", path: `${l}.cardId`, fix: "Tell the user to change it in the editor.", details: { reason: "document_section" } });
1646
- const T = I.card, S = oe(T, { sql: !0 });
1647
- ((ge = S.source) == null ? void 0 : ge.kind) === "sql" && R(`${l}.cardId`), S.editable || c({
1664
+ const h = m(o.cardId, `${l}.cardId`), I = ie(p, h);
1665
+ I || g({ code: "card_not_editable", message: "Cards in Document sections are changed in the editor.", path: `${l}.cardId`, fix: "Tell the user to change it in the editor.", details: { reason: "document_section" } });
1666
+ const v = I.card, S = oe(v, { sql: !0 });
1667
+ ((Qe = S.source) == null ? void 0 : Qe.kind) === "sql" && A(`${l}.cardId`), S.editable || g({
1648
1668
  code: "card_not_editable",
1649
1669
  message: S.message,
1650
1670
  path: `${l}.cardId`,
1651
1671
  fix: S.reason === "needs_sql_access" ? "Ask for SQL access." : "Tell the user to change it in the editor.",
1652
1672
  details: { reason: S.reason, ...S.detail ? { detail: S.detail } : {} }
1653
- }), I.frame.visualId && d.push({
1673
+ }), I.frame.visualId && r.push({
1654
1674
  code: "detaches_linked_visual",
1655
- message: `"${T.title}" will stop following its library visual and become local to this dashboard.`,
1675
+ message: `"${v.title}" will stop following its library visual and become local to this dashboard.`,
1656
1676
  path: l,
1657
- details: { cardIds: [u] }
1677
+ details: { cardIds: [h] }
1658
1678
  });
1659
- let k = !1;
1660
- const x = r.type ? nt(r.type) : void 0;
1661
- if (x && x !== T.type) {
1662
- const v = S.editable ? S.source : void 0, V = sa(T, x), Q = V && v && v.kind === "semantic" ? (Qe = await a.loadCardSource({ domainId: v.domainId, datasetName: v.datasetName })) == null ? void 0 : Qe.fields : void 0, q = [], L = ia(T, x, {
1679
+ let T = !1;
1680
+ const w = o.type ? rt(o.type) : void 0;
1681
+ if (w && w !== v.type) {
1682
+ const x = S.editable ? S.source : void 0, G = oa(v, w), Q = G && x && x.kind === "semantic" ? (Ke = await a.loadCardSource({ domainId: x.domainId, datasetName: x.datasetName })) == null ? void 0 : Ke.fields : void 0, P = [], B = ra(v, w, {
1663
1683
  ...Q ? { catalog: Q } : {},
1664
- ...V && !Q ? { catalogLoading: !0 } : {},
1684
+ ...G && !Q ? { catalogLoading: !0 } : {},
1665
1685
  createId: () => {
1666
- const G = a.newId();
1667
- return q.push(G), G;
1686
+ const U = a.newId();
1687
+ return P.push(U), U;
1668
1688
  }
1669
1689
  });
1670
- if (L.status === "refused" && c({ code: "type_not_supported", message: "The card's dataset fields couldn't be loaded for a change to or from a Matrix.", path: `${l}.type`, fix: "Send a complete query with the type change." }), L.status === "changed") {
1671
- const G = [...L.leftOut, ...L.droppedPreferences];
1672
- G.length && d.push({
1690
+ if (B.status === "refused" && g({ code: "type_not_supported", message: "The card's dataset fields couldn't be loaded for a change to or from a Matrix.", path: `${l}.type`, fix: "Send a complete query with the type change." }), B.status === "changed") {
1691
+ const U = [...B.leftOut, ...B.droppedPreferences];
1692
+ U.length && r.push({
1673
1693
  code: "type_change_drops",
1674
- message: `Changing "${T.title}" to ${r.type.replace(/_/g, " ")} leaves out ${G.join(", ")}.`,
1694
+ message: `Changing "${v.title}" to ${o.type.replace(/_/g, " ")} leaves out ${U.join(", ")}.`,
1675
1695
  path: `${l}.type`,
1676
- details: { dropped: G }
1677
- }), m(
1678
- { op: "card.update", cardId: u, update: { kind: "retype", type: x, ...Q ? { catalog: Q } : {}, newIds: q }, changeIndex: h },
1696
+ details: { dropped: U }
1697
+ }), c(
1698
+ { op: "card.update", cardId: h, update: { kind: "retype", type: w, ...Q ? { catalog: Q } : {}, newIds: P }, changeIndex: f },
1679
1699
  `${l}.type`
1680
- ), k = !0;
1700
+ ), T = !0;
1681
1701
  }
1682
1702
  }
1683
- if (r.query || r.matrix) {
1684
- const v = ie(g, u).card, V = oe(v, { sql: !0 }), Q = V.editable ? V.query : void 0, q = qs(Q, r.query ?? {}, `${l}.query`, c), L = Ee(v.type), G = r.matrix ?? (V.editable ? V.matrix : void 0);
1685
- U(L, q, G, l);
1686
- const z = V.editable ? na(V.query, q, V.matrix, G) : void 0, Ze = !z || z.aspects.length > 0, le = z && !("sql" in q) ? Re(q).filter((X) => !ot(z, X.key.role)) : [], et = oa(v, z, le.map((X) => X.key.role));
1687
- et && F(et, l);
1688
- let De = q;
1689
- if (z && !("sql" in q) && q.orderBy && !z.aspects.includes("order") && ["metric", "group_by", "detail"].some((X) => ot(z, X))) {
1690
- const { orderBy: X, ...be } = q;
1691
- De = be;
1703
+ if (o.query || o.matrix) {
1704
+ const x = ie(p, h).card, G = oe(x, { sql: !0 }), Q = G.editable ? G.query : void 0, P = Ms(Q, o.query ?? {}, `${l}.query`, g), B = Oe(x.type), U = o.matrix ?? (G.editable ? G.matrix : void 0);
1705
+ R(B, P, U, l);
1706
+ const z = G.editable ? da(G.query, P, G.matrix, U) : void 0, tt = !z || z.aspects.length > 0, le = z && !("sql" in P) ? Ee(P).filter((X) => !dt(z, X.key.role)) : [], at = la(x, z, le.map((X) => X.key.role));
1707
+ at && O(at, l);
1708
+ let Te = P;
1709
+ if (z && !("sql" in P) && P.orderBy && !z.aspects.includes("order") && ["metric", "group_by", "detail"].some((X) => dt(z, X))) {
1710
+ const { orderBy: X, ...be } = P;
1711
+ Te = be;
1692
1712
  }
1693
- let tt;
1694
- if (Ze) {
1695
- const X = await O(L, De, G, l);
1696
- tt = X;
1697
- const be = z ? { ...X, change: z } : X, ee = rt(v, be);
1698
- if (ee.ok || F(ee, l), ee.ok && ee.droppedBindings.length && d.push({
1713
+ let st;
1714
+ if (tt) {
1715
+ const X = await V(B, Te, U, l);
1716
+ st = X;
1717
+ const be = z ? { ...X, change: z } : X, ee = lt(x, be);
1718
+ if (ee.ok || O(ee, l), ee.ok && ee.droppedBindings.length && r.push({
1699
1719
  code: "control_binding_dropped",
1700
- message: `"${v.title}" loses the controls bound to the levels or measures this change removes; they stop changing this card.`,
1720
+ message: `"${x.title}" loses the controls bound to the levels or measures this change removes; they stop changing this card.`,
1701
1721
  path: `${l}.query`,
1702
1722
  fix: "Keep those fields in the query, or tell the user the controls no longer apply to this card.",
1703
1723
  details: { controlIds: ee.droppedBindings }
1704
1724
  }), ee.ok)
1705
1725
  for (const Ie of ee.keptLabels)
1706
- d.push({
1726
+ r.push({
1707
1727
  code: "label_kept_after_change",
1708
- message: `"${v.title}" keeps the label "${Ie.label}" on ${Ie.field}, whose aggregate or time grain changed.`,
1728
+ message: `"${x.title}" keeps the label "${Ie.label}" on ${Ie.field}, whose aggregate or time grain changed.`,
1709
1729
  path: `${l}.query`,
1710
1730
  fix: "State a new label on the field ref if the old one no longer fits.",
1711
1731
  details: { columns: [{ label: Ie.label, field: Ie.field }] }
1712
1732
  });
1713
- m({ op: "card.update", cardId: u, update: { kind: "requery", query: be }, changeIndex: h }, `${l}.query`), k = !0;
1733
+ c({ op: "card.update", cardId: h, update: { kind: "requery", query: be }, changeIndex: f }, `${l}.query`), T = !0;
1714
1734
  }
1715
- le.length && ra(ie(g, u).card, le).changed.length && m({ op: "card.update", cardId: u, update: { kind: "relabel", labels: le }, changeIndex: h }, `${l}.query`), (Ze || le.length) && N(ie(g, u).card, De, G, l, v.title ?? "", tt, z);
1735
+ le.length && ca(ie(p, h).card, le).changed.length && c({ op: "card.update", cardId: h, update: { kind: "relabel", labels: le }, changeIndex: f }, `${l}.query`), (tt || le.length) && E(ie(p, h).card, Te, U, l, x.title ?? "", st, z);
1716
1736
  }
1717
- (r.title !== void 0 || r.description !== void 0) && m(
1737
+ (o.title !== void 0 || o.description !== void 0) && c(
1718
1738
  {
1719
1739
  op: "card.update",
1720
- cardId: u,
1740
+ cardId: h,
1721
1741
  update: {
1722
1742
  kind: "rename",
1723
- ...r.title !== void 0 ? { title: r.title } : {},
1724
- ...r.description !== void 0 ? { description: r.description } : {}
1743
+ ...o.title !== void 0 ? { title: o.title } : {},
1744
+ ...o.description !== void 0 ? { description: o.description } : {}
1725
1745
  },
1726
- changeIndex: h
1746
+ changeIndex: f
1727
1747
  },
1728
1748
  l
1729
- ), k && !p.includes(u) && p.push(u), n.push({ ref: r.cardId, kind: "card", id: u, title: T.title ?? "", changeIndex: h });
1749
+ ), T && !u.includes(h) && u.push(h), i.push({ ref: o.cardId, kind: "card", id: h, title: v.title ?? "", changeIndex: f });
1730
1750
  break;
1731
1751
  }
1732
1752
  case "card.remove": {
1733
- const u = f(r.cardId, `${l}.cardId`), I = ie(g, u);
1734
- I || c({ code: "card_not_editable", message: "Cards in Document sections are removed in the editor.", path: `${l}.cardId`, fix: "Tell the user to remove it in the editor.", details: { reason: "document_section" } }), I.frame.cards.some((S) => {
1735
- var k, x;
1736
- return ((k = S.customCardPreferences) == null ? void 0 : k.visualType) === "multiple" || !!((x = S.customCardPreferences) != null && x.dataInputCardIds);
1737
- }) && I.frame.cards.length > 1 && c({ code: "card_not_editable", message: "This card is an input of a custom visual; remove it in the editor.", path: `${l}.cardId`, fix: "Tell the user to remove it in the editor.", details: { reason: "custom" } }), I.frame.visualId && I.frame.cards.length > 1 && d.push({
1753
+ const h = m(o.cardId, `${l}.cardId`), I = ie(p, h);
1754
+ I || g({ code: "card_not_editable", message: "Cards in Document sections are removed in the editor.", path: `${l}.cardId`, fix: "Tell the user to remove it in the editor.", details: { reason: "document_section" } }), I.frame.cards.some((S) => {
1755
+ var T, w;
1756
+ return ((T = S.customCardPreferences) == null ? void 0 : T.visualType) === "multiple" || !!((w = S.customCardPreferences) != null && w.dataInputCardIds);
1757
+ }) && I.frame.cards.length > 1 && g({ code: "card_not_editable", message: "This card is an input of a custom visual; remove it in the editor.", path: `${l}.cardId`, fix: "Tell the user to remove it in the editor.", details: { reason: "custom" } }), I.frame.visualId && I.frame.cards.length > 1 && r.push({
1738
1758
  code: "detaches_linked_visual",
1739
1759
  message: `Removing "${I.card.title}" makes the rest of its tile local to this dashboard; it stops following its library visual.`,
1740
1760
  path: l,
1741
- details: { cardIds: I.frame.cards.filter((S) => S.id !== u).map((S) => S.id) }
1742
- }), m({ op: "card.remove", cardId: u, changeIndex: h }, l), n.push({ ref: r.cardId, kind: "card", id: u, title: I.card.title ?? "", changeIndex: h });
1761
+ details: { cardIds: I.frame.cards.filter((S) => S.id !== h).map((S) => S.id) }
1762
+ }), c({ op: "card.remove", cardId: h, changeIndex: f }, l), i.push({ ref: o.cardId, kind: "card", id: h, title: I.card.title ?? "", changeIndex: f });
1743
1763
  break;
1744
1764
  }
1745
1765
  case "filter.add": {
1746
- const u = await a.loadCardSource({ domainId: r.domainId, datasetName: r.datasetName });
1747
- u || c({ code: "field_not_found", message: `The dataset "${r.datasetName}" isn't available in this domain.`, path: `${l}.datasetName`, fix: "Find datasets with semaphor_list_datasets." });
1748
- const I = It(u.fields, r.field, r.datasetName);
1749
- I || c({
1766
+ const h = await a.loadCardSource({ domainId: o.domainId, datasetName: o.datasetName });
1767
+ h || g({ code: "field_not_found", message: `The dataset "${o.datasetName}" isn't available in this domain.`, path: `${l}.datasetName`, fix: "Find datasets with semaphor_list_datasets." });
1768
+ const I = _t(h.fields, o.field, o.datasetName);
1769
+ I || g({
1750
1770
  code: "field_not_found",
1751
- message: `"${r.field}" isn't a field of ${r.datasetName}.`,
1771
+ message: `"${o.field}" isn't a field of ${o.datasetName}.`,
1752
1772
  path: `${l}.field`,
1753
1773
  fix: "Use one of details.available, or read semaphor_get_dataset_schema.",
1754
- details: { available: u.fields.slice(0, 20).map((v) => v.name) }
1774
+ details: { available: h.fields.slice(0, 20).map((x) => x.name) }
1755
1775
  });
1756
- const T = pt(r.sheetIds, l, $), S = Ot({
1776
+ const v = gt(o.sheetIds, l, N), S = qt({
1757
1777
  field: I,
1758
- dataSource: u.dataSource,
1759
- connectionId: u.connectionId,
1760
- connectionType: u.connectionType,
1761
- scope: T,
1762
- existingInputs: Array.isArray(g.inputs) ? g.inputs : [],
1778
+ dataSource: h.dataSource,
1779
+ connectionId: h.connectionId,
1780
+ connectionType: h.connectionType,
1781
+ scope: v,
1782
+ existingInputs: Array.isArray(p.inputs) ? p.inputs : [],
1763
1783
  createId: a.newId,
1764
- label: r.label
1765
- }), k = { ...S.filter };
1766
- k.dateSelectionMode || (k.type = r.selection ?? "multiple"), r.defaultValues && (k.defaultValues = r.defaultValues), r.defaultPeriod && (k.defaultDateFilter = mt(r.defaultPeriod, I, `${l}.defaultPeriod`, c)), m({ op: "filter.add", input: { ...S, filter: k }, changeIndex: h }, l), j.set(S.id, { sheetIds: r.sheetIds ?? "all", changeIndex: h }), (r.defaultValues !== void 0 || r.defaultPeriod !== void 0) && M.set(S.id, { values: r.defaultValues, period: r.defaultPeriod, changeIndex: h });
1767
- const x = r.handle;
1768
- x && (y.has(x) && c({ code: "invalid_change", message: `The handle ${x} is defined twice.`, path: `${l}.handle`, fix: "Give each new card or filter its own handle." }), y.set(x, { kind: "filter", id: S.id, title: r.label })), n.push({ ref: x ?? S.id, kind: "filter", id: S.id, title: r.label, changeIndex: h });
1784
+ label: o.label
1785
+ }), T = { ...S.filter };
1786
+ T.dateSelectionMode || (T.type = o.selection ?? "multiple"), o.defaultValues && (T.defaultValues = o.defaultValues), o.defaultPeriod && (T.defaultDateFilter = bt(o.defaultPeriod, I, `${l}.defaultPeriod`, g)), c({ op: "filter.add", input: { ...S, filter: T }, changeIndex: f }, l), L.set(S.id, { sheetIds: o.sheetIds ?? "all", changeIndex: f }), (o.defaultValues !== void 0 || o.defaultPeriod !== void 0) && q.set(S.id, { values: o.defaultValues, period: o.defaultPeriod, changeIndex: f });
1787
+ const w = o.handle;
1788
+ w && (b.has(w) && g({ code: "invalid_change", message: `The handle ${w} is defined twice.`, path: `${l}.handle`, fix: "Give each new card or filter its own handle." }), b.set(w, { kind: "filter", id: S.id, title: o.label })), i.push({ ref: w ?? S.id, kind: "filter", id: S.id, title: o.label, changeIndex: f });
1769
1789
  break;
1770
1790
  }
1771
1791
  case "filter.update": {
1772
- const u = b(r.filterId, `${l}.filterId`), I = he(g, u);
1773
- I != null && I.editable || c({
1792
+ const h = F(o.filterId, `${l}.filterId`), I = pe(p, h, void 0, C);
1793
+ I != null && I.editable || g({
1774
1794
  code: "filter_not_editable",
1775
1795
  message: I && !I.editable ? I.notEditable.message : "This filter can't be changed through the MCP.",
1776
1796
  path: `${l}.filterId`,
1777
1797
  fix: "Tell the user to change it in the editor; removing or excluding it works."
1778
1798
  });
1779
- const T = (g.inputs ?? []).find((v) => v.id === u);
1780
- if ((T == null ? void 0 : T.kind) !== "filter" || !T.filter) throw new ue();
1781
- const S = { ...T.filter };
1782
- let k = !1;
1783
- r.selection && (S.type = r.selection), r.defaultValues !== void 0 && (k = !0, r.defaultValues === null ? delete S.defaultValues : S.defaultValues = r.defaultValues), r.defaultPeriod !== void 0 && (k = !0, r.defaultPeriod === null ? delete S.defaultDateFilter : S.defaultDateFilter = mt(
1784
- r.defaultPeriod,
1799
+ const v = (p.inputs ?? []).find((x) => x.id === h);
1800
+ if ((v == null ? void 0 : v.kind) !== "filter" || !v.filter) throw new ue();
1801
+ const S = { ...v.filter };
1802
+ let T = !1;
1803
+ o.selection && (S.type = o.selection), o.defaultValues !== void 0 && (T = !0, o.defaultValues === null ? delete S.defaultValues : S.defaultValues = o.defaultValues), o.defaultPeriod !== void 0 && (T = !0, o.defaultPeriod === null ? delete S.defaultDateFilter : S.defaultDateFilter = bt(
1804
+ o.defaultPeriod,
1785
1805
  { dataType: S.dataType },
1786
1806
  `${l}.defaultPeriod`,
1787
- c
1807
+ g
1788
1808
  ));
1789
- const x = {
1790
- ...r.label !== void 0 ? { label: r.label } : {},
1791
- ...r.selection !== void 0 || k ? { definition: S } : {},
1809
+ const w = {
1810
+ ...o.label !== void 0 ? { label: o.label } : {},
1811
+ ...o.selection !== void 0 || T ? { definition: S } : {},
1792
1812
  // A change of sheets states the sheets; what else the scope says (the cards it leaves out,
1793
1813
  // whether it covers Document sheets) stays.
1794
- ...r.sheetIds !== void 0 ? { scope: aa(
1795
- T.scope,
1796
- pt(r.sheetIds ?? void 0, l, $),
1797
- new Set([...Me(g).values()].filter((v) => v.sheetKind === "document").map((v) => v.sheetId))
1814
+ ...o.sheetIds !== void 0 ? { scope: na(
1815
+ v.scope,
1816
+ gt(o.sheetIds ?? void 0, l, N),
1817
+ new Set([...Me(p).values()].filter((x) => x.sheetKind === "document").map((x) => x.sheetId))
1798
1818
  ) } : {},
1799
- ...k ? { values: { defaultChanged: !0, target: {} } } : {}
1819
+ ...T ? { values: { defaultChanged: !0, target: {} } } : {}
1800
1820
  };
1801
- m({ op: "filter.update", filterId: u, settings: x, changeIndex: h }, l), r.sheetIds !== void 0 && j.set(u, { sheetIds: r.sheetIds ?? "all", changeIndex: h }), k && M.set(u, { values: r.defaultValues, period: r.defaultPeriod, changeIndex: h }), n.push({ ref: r.filterId, kind: "filter", id: u, title: T.label, changeIndex: h });
1821
+ c({ op: "filter.update", filterId: h, settings: w, changeIndex: f }, l), o.sheetIds !== void 0 && L.set(h, { sheetIds: o.sheetIds ?? "all", changeIndex: f }), T && q.set(h, { values: o.defaultValues, period: o.defaultPeriod, changeIndex: f }), i.push({ ref: o.filterId, kind: "filter", id: h, title: v.label, changeIndex: f });
1802
1822
  break;
1803
1823
  }
1804
1824
  case "filter.remove": {
1805
- const u = b(r.filterId, `${l}.filterId`), I = ((Ke = (g.inputs ?? []).find((T) => T.id === u)) == null ? void 0 : Ke.label) ?? "";
1806
- m({ op: "filter.remove", filterId: u, changeIndex: h }, l), n.push({ ref: r.filterId, kind: "filter", id: u, title: I, changeIndex: h });
1825
+ const h = F(o.filterId, `${l}.filterId`), I = ((He = (p.inputs ?? []).find((v) => v.id === h)) == null ? void 0 : He.label) ?? "";
1826
+ c({ op: "filter.remove", filterId: h, changeIndex: f }, l), i.push({ ref: o.filterId, kind: "filter", id: h, title: I, changeIndex: f });
1807
1827
  break;
1808
1828
  }
1809
1829
  case "filter.bind": {
1810
- const u = b(r.filterId, `${l}.filterId`), I = he(g, u);
1811
- I != null && I.editable || c({
1830
+ const h = F(o.filterId, `${l}.filterId`), I = pe(p, h, void 0, C);
1831
+ I != null && I.editable || g({
1812
1832
  code: "filter_not_editable",
1813
1833
  message: I && !I.editable ? I.notEditable.message : "This filter can't be changed through the MCP.",
1814
1834
  path: `${l}.filterId`,
1815
1835
  fix: "Tell the user to change it in the editor; removing or excluding it works."
1816
1836
  });
1817
- const T = f(r.cardId, `${l}.cardId`), S = re(g).find((x) => x.cardId === T).card, k = await Ps(S, r.field, a, `${l}.field`, c);
1818
- m({ op: "filter.bind", filterId: u, cardId: T, binding: { kind: "bound", cardId: T, bindingId: a.newId(), target: k }, changeIndex: h }, l), n.push({ ref: r.filterId, kind: "filter", id: u, title: I.label, changeIndex: h });
1837
+ const v = m(o.cardId, `${l}.cardId`), S = re(p).find((w) => w.cardId === v).card, T = await Ls(S, o.field, a, `${l}.field`, g);
1838
+ c({ op: "filter.bind", filterId: h, cardId: v, binding: { kind: "bound", cardId: v, bindingId: a.newId(), target: T }, changeIndex: f }, l), i.push({ ref: o.filterId, kind: "filter", id: h, title: I.label, changeIndex: f });
1819
1839
  break;
1820
1840
  }
1821
1841
  case "layout.arrange": {
1822
- const u = r.sheetId ? $(r.sheetId, `${l}.sheetId`) : (() => {
1823
- const I = A();
1824
- return I.length !== 1 && c({
1842
+ const h = o.sheetId ? N(o.sheetId, `${l}.sheetId`) : (() => {
1843
+ const I = k();
1844
+ return I.length !== 1 && g({
1825
1845
  code: I.length ? "sheet_required" : "sheet_not_a_grid",
1826
1846
  message: I.length ? "This dashboard has several grid sheets; say which one to arrange." : "This dashboard has no grid sheet to arrange.",
1827
1847
  path: `${l}.sheetId`,
@@ -1829,101 +1849,121 @@ async function hi(e, t, a) {
1829
1849
  details: { sheets: D() }
1830
1850
  }), I[0];
1831
1851
  })();
1832
- m({ op: "layout.arrange", sheetId: u.id, ...r.keepOrder ? { keepOrder: !0 } : {}, changeIndex: h }, l);
1852
+ c({ op: "layout.arrange", sheetId: h.id, ...o.keepOrder ? { keepOrder: !0 } : {}, changeIndex: f }, l);
1833
1853
  break;
1834
1854
  }
1835
1855
  case "filter.exclude": {
1836
- const u = b(r.filterId, `${l}.filterId`), I = f(r.cardId, `${l}.cardId`), T = ((We = (g.inputs ?? []).find((S) => S.id === u)) == null ? void 0 : We.label) ?? "";
1837
- m({ op: "filter.exclude", filterId: u, cardId: I, changeIndex: h }, l), n.push({ ref: r.filterId, kind: "filter", id: u, title: T, changeIndex: h });
1856
+ const h = F(o.filterId, `${l}.filterId`), I = m(o.cardId, `${l}.cardId`), v = ((We = (p.inputs ?? []).find((S) => S.id === h)) == null ? void 0 : We.label) ?? "";
1857
+ c({ op: "filter.exclude", filterId: h, cardId: I, changeIndex: f }, l), i.push({ ref: o.filterId, kind: "filter", id: h, title: v, changeIndex: f });
1838
1858
  break;
1839
1859
  }
1840
1860
  }
1841
- } catch (u) {
1842
- if (!(u instanceof ue)) throw u;
1861
+ } catch (h) {
1862
+ if (!(h instanceof ue)) throw h;
1843
1863
  }
1844
1864
  }
1845
1865
  if (s.length) return { ok: !1, problems: s };
1846
- const E = st(e, i, _);
1847
- if (!E.ok)
1866
+ const j = nt(e, n, y);
1867
+ if (!j.ok)
1848
1868
  return {
1849
1869
  ok: !1,
1850
1870
  problems: [
1851
1871
  {
1852
1872
  code: "invalid_change",
1853
- message: E.failedAt.message,
1854
- path: `changes[${((He = i[E.failedAt.index]) == null ? void 0 : He.changeIndex) ?? 0}]`,
1873
+ message: j.failedAt.message,
1874
+ path: `changes[${((Ye = n[j.failedAt.index]) == null ? void 0 : Ye.changeIndex) ?? 0}]`,
1855
1875
  fix: "Read the outline again and propose again."
1856
1876
  }
1857
1877
  ]
1858
1878
  };
1859
- for (const h of p) {
1860
- const r = ie(E.dashboard, h);
1861
- if (!r) continue;
1862
- const l = ((Ye = i.find((S) => ze(S) === h)) == null ? void 0 : Ye.changeIndex) ?? 0, u = oe(r.card, { sql: !0 }), I = Ee(r.card.type);
1863
- u.editable && ("sql" in u.query ? !!u.query.sql : "measures" in u.query ? u.query.measures.length > 0 : u.query.columns.length > 0) && ((Xe = ce[I]) == null ? void 0 : Xe.forms.includes(we(u.query))) || s.push({
1879
+ for (const f of u) {
1880
+ const o = ie(j.dashboard, f);
1881
+ if (!o) continue;
1882
+ const l = ((Xe = n.find((S) => ze(S) === f)) == null ? void 0 : Xe.changeIndex) ?? 0, h = oe(o.card, { sql: !0 }), I = Oe(o.card.type);
1883
+ h.editable && ("sql" in h.query ? !!h.query.sql : "measures" in h.query ? h.query.measures.length > 0 : h.query.columns.length > 0) && ((Je = ce[I]) == null ? void 0 : Je.forms.includes(xe(h.query))) || s.push({
1864
1884
  code: "type_not_supported",
1865
- message: `As changed, "${r.card.title}" would have no query a ${I.replace(/_/g, " ")} can run.`,
1885
+ message: `As changed, "${o.card.title}" would have no query a ${I.replace(/_/g, " ")} can run.`,
1866
1886
  path: `changes[${l}]`,
1867
- fix: `Send a complete query with the type change: ${((Je = ce[I]) == null ? void 0 : Je.forms.map((S) => Se[S]).join(" or ")) ?? "a measures query"}.`
1887
+ fix: `Send a complete query with the type change: ${((Ze = ce[I]) == null ? void 0 : Ze.forms.map((S) => Se[S]).join(" or ")) ?? "a measures query"}.`
1868
1888
  });
1869
1889
  }
1870
- if (s.push(...Os(e, E.dashboard, i, j)), s.push(...Ns(E.dashboard, M, a.calendar)), s.length) return { ok: !1, problems: s };
1871
- for (const h of i) {
1872
- if (h.op !== "filter.add" && !(h.op === "filter.update" && h.settings.scope)) continue;
1873
- const r = h.op === "filter.add" ? h.input.id : h.filterId, l = he(E.dashboard, r);
1874
- if (!(l != null && l.editable) || !l.notReached.length) continue;
1875
- const u = [];
1876
- for (const I of l.notReached) {
1877
- const T = I.datasetName ? await a.findRelationshipFields({
1878
- domainId: l.domainId,
1879
- fromDataset: l.datasetName,
1880
- field: l.field,
1881
- toDataset: I.datasetName
1882
- }) : [];
1883
- u.push({ ...I, suggestedFields: T });
1890
+ if (s.push(...qs(e, j.dashboard, n, L, C)), s.push(...Ps(j.dashboard, q, a.calendar)), s.length) return { ok: !1, problems: s };
1891
+ for (const f of n) {
1892
+ if (f.op !== "filter.add" && !(f.op === "filter.update" && f.settings.scope)) continue;
1893
+ const o = f.op === "filter.add" ? f.input.id : f.filterId, l = pe(j.dashboard, o, void 0, C);
1894
+ if (!(l != null && l.editable)) continue;
1895
+ const h = async (v) => {
1896
+ const S = [];
1897
+ for (const T of v) {
1898
+ const w = T.datasetName ? await a.findRelationshipFields({
1899
+ domainId: l.domainId,
1900
+ fromDataset: l.datasetName,
1901
+ field: l.field,
1902
+ toDataset: T.datasetName
1903
+ }) : [];
1904
+ S.push({ ...T, suggestedFields: w });
1905
+ }
1906
+ return S;
1907
+ }, I = (v) => v.map((S) => `"${S.title}"`).join(", ");
1908
+ if (l.notReached.length) {
1909
+ const v = await h(l.notReached);
1910
+ r.push({
1911
+ code: "filter_not_reaching_cards",
1912
+ message: `"${l.label}" doesn't reach ${v.length} card${v.length === 1 ? "" : "s"} on its sheets: ${I(v)}.`,
1913
+ path: `changes[${f.changeIndex ?? 0}]`,
1914
+ fix: "Add filter.bind with one of the suggested fields to reach a card, or leave it unfiltered.",
1915
+ details: { cards: v }
1916
+ });
1917
+ }
1918
+ if ((et = l.relationshipPending) != null && et.length) {
1919
+ const v = await h(l.relationshipPending);
1920
+ r.push({
1921
+ code: "filter_reach_through_relationships",
1922
+ message: `"${l.label}" may reach ${v.length} card${v.length === 1 ? "" : "s"} on its sheets through the domain's relationships: ${I(v)}. Whether it applies is decided when each card runs.`,
1923
+ path: `changes[${f.changeIndex ?? 0}]`,
1924
+ fix: "Add filter.bind with one of the suggested fields to make it certain, or leave it to the relationships.",
1925
+ details: { cards: v }
1926
+ });
1884
1927
  }
1885
- d.push({
1886
- code: "filter_not_reaching_cards",
1887
- message: `"${l.label}" doesn't reach ${u.length} card${u.length === 1 ? "" : "s"} on its sheets: ${u.map((I) => `"${I.title}"`).join(", ")}.`,
1888
- path: `changes[${h.changeIndex ?? 0}]`,
1889
- fix: "Add filter.bind with one of the suggested fields to reach a card, or leave it unfiltered.",
1890
- details: { cards: u }
1891
- });
1892
1928
  }
1893
- const Y = As(E.dashboard, i, E.descriptions);
1929
+ const De = Es(j.dashboard, n, j.descriptions, C);
1894
1930
  return {
1895
1931
  ok: !0,
1896
- operations: i,
1897
- context: _,
1898
- dashboard: E.dashboard,
1899
- refs: n,
1900
- descriptions: Y,
1901
- changedCardIds: p,
1902
- requires: [...o],
1903
- warnings: d
1932
+ operations: n,
1933
+ context: y,
1934
+ dashboard: j.dashboard,
1935
+ refs: i,
1936
+ descriptions: De,
1937
+ changedCardIds: u,
1938
+ requires: [...d],
1939
+ warnings: r
1904
1940
  };
1905
1941
  }
1906
- function As(e, t, a) {
1907
- const s = t.filter((o) => o.op === "card.add");
1908
- if (!s.length) return [...a];
1909
- const d = Ft(e);
1910
- if (!d.length) return [...a];
1911
- const i = (o) => ga(o.map((p) => `"${p}"`)), n = /* @__PURE__ */ new Map();
1912
- for (const o of s) {
1913
- const p = ze(o);
1914
- if (!p || o.changeIndex === void 0) continue;
1915
- const y = d.filter((C) => C.reaches.includes(p)).map((C) => C.label), _ = d.filter((C) => {
1916
- var w;
1917
- return "notReached" in C && ((w = C.notReached) == null ? void 0 : w.some((c) => c.cardId === p));
1918
- }).map((C) => C.label), g = [
1942
+ function Es(e, t, a, s) {
1943
+ const r = t.filter((u) => u.op === "card.add");
1944
+ if (!r.length) return [...a];
1945
+ const n = Rt(e, void 0, s);
1946
+ if (!n.length) return [...a];
1947
+ const i = (u) => ya(u.map((b) => `"${b}"`)), d = /* @__PURE__ */ new Map();
1948
+ for (const u of r) {
1949
+ const b = ze(u);
1950
+ if (!b || u.changeIndex === void 0) continue;
1951
+ const y = n.filter((_) => _.reaches.includes(b)).map((_) => _.label), C = n.filter((_) => {
1952
+ var g;
1953
+ return "notReached" in _ && ((g = _.notReached) == null ? void 0 : g.some((A) => A.cardId === b));
1954
+ }).map((_) => _.label), p = n.filter((_) => {
1955
+ var g;
1956
+ return (g = _.relationshipPending) == null ? void 0 : g.some((A) => A.cardId === b);
1957
+ }).map((_) => _.label), $ = [
1919
1958
  ...y.length ? [`The dashboard's ${i(y)} filter${y.length === 1 ? " applies" : "s apply"} to it.`] : [],
1920
- ..._.length ? [`${i(_)} ${_.length === 1 ? "doesn't" : "don't"} reach it.`] : []
1959
+ ...C.length ? [`${i(C)} ${C.length === 1 ? "doesn't" : "don't"} reach it.`] : [],
1960
+ ...p.length ? [`${i(p)} may reach it through the domain's relationships.`] : []
1921
1961
  ];
1922
- g.length && n.set(o.changeIndex, g.join(" "));
1962
+ $.length && d.set(u.changeIndex, $.join(" "));
1923
1963
  }
1924
- return a.map((o) => {
1925
- const p = o.changeIndex === void 0 ? void 0 : n.get(o.changeIndex);
1926
- return p ? { ...o, sentence: `${o.sentence} ${p}` } : o;
1964
+ return a.map((u) => {
1965
+ const b = u.changeIndex === void 0 ? void 0 : d.get(u.changeIndex);
1966
+ return b ? { ...u, sentence: `${u.sentence} ${b}` } : u;
1927
1967
  });
1928
1968
  }
1929
1969
  function ze(e) {
@@ -1931,577 +1971,616 @@ function ze(e) {
1931
1971
  if (e.op === "card.update" || e.op === "card.remove") return e.cardId;
1932
1972
  if (e.op === "card.add") return (t = e.frame.cards[0]) == null ? void 0 : t.id;
1933
1973
  }
1934
- function Rs(e) {
1974
+ function Os(e) {
1935
1975
  return Object.fromEntries(
1936
- ba.flatMap((t) => e[t] === void 0 ? [] : [[t, e[t]]])
1976
+ _a.flatMap((t) => e[t] === void 0 ? [] : [[t, e[t]]])
1937
1977
  );
1938
1978
  }
1939
- function Es(e, t) {
1979
+ function Ns(e, t) {
1940
1980
  if (!t.length || !e.config) return e;
1941
1981
  const a = { ...e.config }, s = [];
1942
1982
  if (a.matrix) {
1943
- const i = a.matrix, n = Sa(i), o = [...i.spec.rows, ...i.spec.columns], p = { ...i.presentation.levelLabels }, y = { ...i.presentation.measureLabels };
1944
- for (const { key: _, label: g } of t) {
1945
- if (_.role === "metric") {
1946
- const C = n.measures.findIndex((w) => $e(w, _));
1947
- if (C < 0) continue;
1948
- y[i.spec.measures[C].id] = g;
1983
+ const n = a.matrix, i = xa(n), d = [...n.spec.rows, ...n.spec.columns], u = { ...n.presentation.levelLabels }, b = { ...n.presentation.measureLabels };
1984
+ for (const { key: y, label: C } of t) {
1985
+ if (y.role === "metric") {
1986
+ const p = i.measures.findIndex(($) => Fe($, y));
1987
+ if (p < 0) continue;
1988
+ b[n.spec.measures[p].id] = C;
1949
1989
  } else {
1950
- const C = n.levels.findIndex((w) => $e(w, _));
1951
- if (C < 0) continue;
1952
- p[o[C].id] = g;
1990
+ const p = i.levels.findIndex(($) => Fe($, y));
1991
+ if (p < 0) continue;
1992
+ u[d[p].id] = C;
1953
1993
  }
1954
- s.push(_);
1994
+ s.push(y);
1955
1995
  }
1956
- return a.matrix = { ...i, presentation: { ...i.presentation, levelLabels: p, measureLabels: y } }, { ...e, config: a, statedLabels: s };
1996
+ return a.matrix = { ...n, presentation: { ...n.presentation, levelLabels: u, measureLabels: b } }, { ...e, config: a, statedLabels: s };
1957
1997
  }
1958
- const d = { metric: "metricColumns", group_by: "groupByColumns", detail: "detailColumns" };
1959
- for (const { key: i, label: n } of t) {
1960
- const o = [...a[d[i.role]] ?? []], p = va(i.role, o).findIndex((y) => $e(y, i));
1961
- p < 0 || (o[p] = Ma(o[p], n), a[d[i.role]] = o, s.push(i));
1998
+ const r = { metric: "metricColumns", group_by: "groupByColumns", detail: "detailColumns" };
1999
+ for (const { key: n, label: i } of t) {
2000
+ const d = [...a[r[n.role]] ?? []], u = Da(n.role, d).findIndex((b) => Fe(b, n));
2001
+ u < 0 || (d[u] = Ba(d[u], i), a[r[n.role]] = d, s.push(n));
1962
2002
  }
1963
2003
  return { ...e, config: a, statedLabels: s };
1964
2004
  }
1965
- function Os(e, t, a, s) {
1966
- var R;
1967
- const d = [], i = new Map(re(t).map((m) => [m.cardId, m])), n = Me(t), o = de(t), p = (m) => {
1968
- var f, b;
1969
- return ((b = (f = t.sheets) == null ? void 0 : f.find((A) => A.id === m)) == null ? void 0 : b.title) ?? m;
1970
- }, y = (m, f) => {
1971
- var b;
1972
- return ((b = [...a].reverse().find((A) => ze(A) === f || "filterId" in A && A.filterId === m)) == null ? void 0 : b.changeIndex) ?? 0;
1973
- }, _ = (m, f) => {
1974
- const b = o.findFilterInput({ inputId: m }).input, A = i.get(f), D = `"${A.card.title ?? ""}"`, $ = `"${b.label}"`;
1975
- if (A.kind === "documentSectionCard")
2005
+ function qs(e, t, a, s, r) {
2006
+ var A;
2007
+ const n = [], i = new Map(re(t).map((c) => [c.cardId, c])), d = Me(t), u = de(t), b = (c) => {
2008
+ var m, F;
2009
+ return ((F = (m = t.sheets) == null ? void 0 : m.find((k) => k.id === c)) == null ? void 0 : F.title) ?? c;
2010
+ }, y = (c, m) => {
2011
+ var F;
2012
+ return ((F = [...a].reverse().find((k) => ze(k) === m || "filterId" in k && k.filterId === c)) == null ? void 0 : F.changeIndex) ?? 0;
2013
+ }, C = (c, m) => {
2014
+ const F = u.findFilterInput({ inputId: c }).input, k = i.get(m), D = `"${k.card.title ?? ""}"`, N = `"${F.label}"`;
2015
+ if (k.kind === "documentSectionCard")
1976
2016
  return {
1977
2017
  reason: "document_section",
1978
2018
  message: `${D} is in a Document section, which takes only the filters its Document sheet shows.`,
1979
2019
  fix: "Tell the user to change where the filter shows in the editor."
1980
2020
  };
1981
- const U = n.get(A.sheetId);
1982
- if (U && !bt(b, U))
2021
+ const R = d.get(k.sheetId);
2022
+ if (R && !yt(F, R))
1983
2023
  return {
1984
2024
  reason: "outside_sheets",
1985
- message: `${$} isn't shown on "${p(A.sheetId)}", so it can't filter ${D}.`,
2025
+ message: `${N} isn't shown on "${b(k.sheetId)}", so it can't filter ${D}.`,
1986
2026
  fix: "Show it on that sheet first with filter.update sheetIds (null for every sheet), in the same proposal."
1987
2027
  };
1988
- switch (Oa(b, A.card).status) {
2028
+ const O = qa(F, k.card);
2029
+ switch (O.status) {
1989
2030
  case "incompatible":
1990
- return { reason: "incompatible_field", message: `${D} can't take ${$}'s values on that field: their types differ.`, fix: "Bind a field of the same type (filter.bind)." };
2031
+ return { reason: "incompatible_field", message: `${D} can't take ${N}'s values on that field: their types differ.`, fix: "Bind a field of the same type (filter.bind)." };
1991
2032
  case "stale":
1992
2033
  return {
1993
2034
  reason: "field_not_on_card",
1994
- message: `${D} doesn't have the field ${$} is bound to.`,
2035
+ message: `${D} doesn't have the field ${N} is bound to.`,
1995
2036
  fix: "Bind a field the card has (filter.bind), or exclude the card (filter.exclude), in the same proposal."
1996
2037
  };
1997
2038
  case "ambiguous":
1998
2039
  return {
1999
2040
  reason: "ambiguous_field",
2000
- message: `${D} has more than one field ${$} could filter.`,
2041
+ message: `${D} has more than one field ${N} could filter.`,
2001
2042
  fix: "Bind the field it should use (filter.bind), or exclude the card (filter.exclude), in the same proposal."
2002
2043
  };
2003
- default:
2004
- return { reason: "filter_settings_override", message: `${$} still wouldn't filter ${D}: its settings leave that card out.`, fix: "Tell the user to change the filter's settings in the editor." };
2044
+ case "relationship": {
2045
+ const E = ve(F, k.card, r);
2046
+ return E.reach === "blocked" ? {
2047
+ reason: "relationship_route_changed",
2048
+ message: `The relationships ${D} used for ${N} changed in the domain.`,
2049
+ fix: "Tell the user to choose the relationship again in the filter's Cards tab."
2050
+ } : E.reason === "relationship_ambiguous" ? {
2051
+ reason: "relationship_ambiguous",
2052
+ message: `${N} connects to ${D} through more than one path.`,
2053
+ fix: "Tell the user to choose a path in the filter's Cards tab, or bind a field the card has (filter.bind)."
2054
+ } : {
2055
+ reason: "relationship_pending",
2056
+ message: `${N} may reach ${D} through the domain's relationships; whether it applies is decided when the card runs.`,
2057
+ fix: "Bind a field the card has (filter.bind) to make it certain, or leave it to the relationships."
2058
+ };
2059
+ }
2060
+ case "excluded":
2061
+ case "bound":
2062
+ case "unsupportedTarget":
2063
+ case "sql":
2064
+ case "automatic":
2065
+ case "passthrough":
2066
+ case "notApplicable":
2067
+ return { reason: "filter_settings_override", message: `${N} still wouldn't filter ${D}: its settings leave that card out.`, fix: "Tell the user to change the filter's settings in the editor." };
2068
+ default: {
2069
+ const E = O;
2070
+ throw new Error(`Unhandled filter card target ${String(E.status)}`);
2071
+ }
2005
2072
  }
2006
- }, g = /* @__PURE__ */ new Set(), C = /* @__PURE__ */ new Map();
2007
- for (const m of a)
2008
- (m.op === "filter.bind" || m.op === "filter.exclude") && C.set(`${m.filterId}|${m.cardId}`, m);
2009
- for (const m of C.values()) {
2010
- const f = he(t, m.filterId), b = i.get(m.cardId);
2011
- if (!f || !b) continue;
2012
- const A = f.reaches.includes(m.cardId);
2013
- if (m.op === "filter.bind" ? A : !A) continue;
2014
- g.add(`${m.filterId}|${m.cardId}`);
2015
- const D = m.op === "filter.bind" ? _(m.filterId, m.cardId) : { reason: "filter_settings_override", message: `"${f.label}" would still filter "${b.card.title ?? ""}".`, fix: "Tell the user to change the filter's settings in the editor." };
2016
- d.push({
2073
+ }, p = /* @__PURE__ */ new Set(), $ = /* @__PURE__ */ new Map();
2074
+ for (const c of a)
2075
+ (c.op === "filter.bind" || c.op === "filter.exclude") && $.set(`${c.filterId}|${c.cardId}`, c);
2076
+ for (const c of $.values()) {
2077
+ const m = pe(t, c.filterId, void 0, r), F = i.get(c.cardId);
2078
+ if (!m || !F) continue;
2079
+ const k = m.reaches.includes(c.cardId);
2080
+ if (c.op === "filter.bind" ? k : !k) continue;
2081
+ p.add(`${c.filterId}|${c.cardId}`);
2082
+ const D = c.op === "filter.bind" ? C(c.filterId, c.cardId) : { reason: "filter_settings_override", message: `"${m.label}" would still filter "${F.card.title ?? ""}".`, fix: "Tell the user to change the filter's settings in the editor." };
2083
+ n.push({
2017
2084
  code: "filter_not_editable",
2018
2085
  message: D.message,
2019
- path: `changes[${m.changeIndex ?? 0}]`,
2086
+ path: `changes[${c.changeIndex ?? 0}]`,
2020
2087
  fix: D.fix,
2021
- details: { reason: D.reason, cardId: m.cardId }
2088
+ details: { reason: D.reason, cardId: c.cardId }
2022
2089
  });
2023
2090
  }
2024
- for (const [m, f] of s) {
2025
- const b = he(t, m);
2026
- if (!b) continue;
2027
- const A = b.editable && ((R = b.exceptSheetIds) == null ? void 0 : R.some((U) => {
2028
- var F;
2029
- return ((F = n.get(U)) == null ? void 0 : F.sheetKind) === "dashboard";
2030
- })), D = b.editable && !A ? b.sheetIds : void 0, $ = f.sheetIds === "all" ? "all" : [...f.sheetIds].sort();
2031
- Le(D === "all" || !D ? D : [...D].sort(), $) || d.push({
2091
+ for (const [c, m] of s) {
2092
+ const F = pe(t, c, void 0, r);
2093
+ if (!F) continue;
2094
+ const k = F.editable && ((A = F.exceptSheetIds) == null ? void 0 : A.some((R) => {
2095
+ var O;
2096
+ return ((O = d.get(R)) == null ? void 0 : O.sheetKind) === "dashboard";
2097
+ })), D = F.editable && !k ? F.sheetIds : void 0, N = m.sheetIds === "all" ? "all" : [...m.sheetIds].sort();
2098
+ Le(D === "all" || !D ? D : [...D].sort(), N) || n.push({
2032
2099
  code: "filter_not_editable",
2033
- message: `"${b.label}" wouldn't show on the sheets asked for. Change where it shows in the editor.`,
2034
- path: `changes[${f.changeIndex}].sheetIds`,
2100
+ message: `"${F.label}" wouldn't show on the sheets asked for. Change where it shows in the editor.`,
2101
+ path: `changes[${m.changeIndex}].sheetIds`,
2035
2102
  fix: "Tell the user to change the filter's sheets in the editor.",
2036
2103
  details: { reason: "filter_settings_override", ...D ? { sheetIds: D } : {} }
2037
2104
  });
2038
2105
  }
2039
- const w = de(e), c = (m) => m === "blocked" || m === "ambiguous";
2040
- for (const m of o.inputs) {
2041
- const f = m.input.id;
2042
- for (const b of o.reachedCards({ inputId: f })) {
2043
- if (g.has(`${f}|${b.cardId}`) || !c(Oe(m.input, b.card))) continue;
2044
- const A = w.findFilterInput({ inputId: f }), D = A && w.reachedCards({ inputId: f }).find((U) => U.cardId === b.cardId);
2045
- if (A && D && c(Oe(A.input, D.card))) continue;
2046
- const $ = _(f, b.cardId);
2047
- d.push({
2106
+ const _ = de(e), g = (c) => c === "blocked" || c === "ambiguous";
2107
+ for (const c of u.inputs) {
2108
+ const m = c.input.id;
2109
+ for (const F of u.reachedCards({ inputId: m })) {
2110
+ if (p.has(`${m}|${F.cardId}`) || !g(ve(c.input, F.card, r).reach)) continue;
2111
+ const k = _.findFilterInput({ inputId: m }), D = k && _.reachedCards({ inputId: m }).find((R) => R.cardId === F.cardId);
2112
+ if (k && D && g(ve(k.input, D.card, r).reach)) continue;
2113
+ const N = C(m, F.cardId);
2114
+ n.push({
2048
2115
  code: "invalid_change",
2049
- message: `${$.message} The card would stop showing data while "${m.input.label}" has a value.`,
2050
- path: `changes[${y(f, b.cardId)}]`,
2051
- fix: $.fix,
2052
- details: { reason: $.reason, filterId: f, cardId: b.cardId }
2116
+ message: `${N.message} The card would stop showing data while "${c.input.label}" has a value.`,
2117
+ path: `changes[${y(m, F.cardId)}]`,
2118
+ fix: N.fix,
2119
+ details: { reason: N.reason, filterId: m, cardId: F.cardId }
2053
2120
  });
2054
2121
  }
2055
2122
  }
2056
- return d;
2057
- }
2058
- function Ns(e, t, a) {
2059
- const s = [], d = de(e);
2060
- for (const [i, n] of t) {
2061
- const o = d.findFilterInput({ inputId: i });
2062
- if (!o) continue;
2063
- const p = gt({ dashboard: e, target: { kind: "dashboardInput", input: o.input, scope: {} }, calendar: a }).value, y = o.input.filter.dateSelectionMode, _ = y === "day" ? "its date picker takes one day" : void 0, g = (C, w) => s.push({
2123
+ return n;
2124
+ }
2125
+ function Ps(e, t, a) {
2126
+ const s = [], r = de(e);
2127
+ for (const [n, i] of t) {
2128
+ const d = r.findFilterInput({ inputId: n });
2129
+ if (!d) continue;
2130
+ const u = It({ dashboard: e, target: { kind: "dashboardInput", input: d.input, scope: {} }, calendar: a }).value, b = d.input.filter.dateSelectionMode, y = b === "day" ? "its date picker takes one day" : void 0, C = (p, $) => s.push({
2064
2131
  code: "filter_not_editable",
2065
- message: C,
2066
- path: `changes[${n.changeIndex}]`,
2067
- fix: w,
2068
- details: { reason: "default_not_applied", ...y ? { datePicker: y } : {} }
2132
+ message: p,
2133
+ path: `changes[${i.changeIndex}]`,
2134
+ fix: $,
2135
+ details: { reason: "default_not_applied", ...b ? { datePicker: b } : {} }
2069
2136
  });
2070
- if (n.period) {
2071
- const C = Ct(n.period), w = p && "relativeMeta" in p ? p.relativeMeta : void 0;
2072
- (!w || !Le(w, C)) && g(
2073
- `"${o.input.label}" wouldn't load with that default${_ ? `: ${_}` : ""}.`,
2074
- _ ? "Ask for a default the picker can take, or tell the user to make it a date range in the editor." : "Tell the user to change the filter's default in the editor."
2137
+ if (i.period) {
2138
+ const p = vt(i.period), $ = u && "relativeMeta" in u ? u.relativeMeta : void 0;
2139
+ (!$ || !Le($, p)) && C(
2140
+ `"${d.input.label}" wouldn't load with that default${y ? `: ${y}` : ""}.`,
2141
+ y ? "Ask for a default the picker can take, or tell the user to make it a date range in the editor." : "Tell the user to change the filter's default in the editor."
2075
2142
  );
2076
- } else if (n.values) {
2077
- const C = (w) => JSON.stringify((w ?? []).map(String).sort());
2078
- (!p || C(p.values) !== C(n.values)) && g(`"${o.input.label}" wouldn't load with those values.`, "Tell the user to change the filter's default in the editor.");
2143
+ } else if (i.values) {
2144
+ const p = ($) => JSON.stringify(($ ?? []).map(String).sort());
2145
+ (!u || p(u.values) !== p(i.values)) && C(`"${d.input.label}" wouldn't load with those values.`, "Tell the user to change the filter's default in the editor.");
2079
2146
  } else
2080
- (_t(o.input.filter.dataType) ? n.period === null : n.values === null) && p && g(`"${o.input.label}" would still load with a default.`, "Tell the user to change the filter's default in the editor.");
2147
+ (St(d.input.filter.dataType) ? i.period === null : i.values === null) && u && C(`"${d.input.label}" would still load with a default.`, "Tell the user to change the filter's default in the editor.");
2081
2148
  }
2082
2149
  return s;
2083
2150
  }
2084
- function qs(e, t, a, s) {
2085
- const d = Object.fromEntries(Object.entries(t).filter(([, _]) => _ != null)), i = we(d), n = we(e), o = (_) => ht[_].safeParse(d);
2086
- if (!e || i && i !== n) {
2087
- const _ = i ?? n, g = _ ? o(_) : void 0;
2088
- return g != null && g.success ? g.data : s({
2151
+ function Ms(e, t, a, s) {
2152
+ const r = Object.fromEntries(Object.entries(t).filter(([, y]) => y != null)), n = xe(r), i = xe(e), d = (y) => mt[y].safeParse(r);
2153
+ if (!e || n && n !== i) {
2154
+ const y = n ?? i, C = y ? d(y) : void 0;
2155
+ return C != null && C.success ? C.data : s({
2089
2156
  code: e ? "query_form_mismatch" : "type_not_supported",
2090
2157
  message: e ? "This patch changes the query's form (measures, records or SQL) without a complete query." : "This card's current query can't be patched; send a complete query.",
2091
2158
  path: a,
2092
2159
  fix: "Send a complete query of the new form: domainId, datasetName and measures (or columns), or connectionId and sql."
2093
2160
  });
2094
2161
  }
2095
- const p = { ...e };
2096
- for (const [_, g] of Object.entries(t))
2097
- g !== void 0 && (g === null ? delete p[_] : p[_] = g);
2098
- const y = ht[n].safeParse(p);
2099
- if (!y.success) {
2100
- const _ = y.error.issues[0];
2162
+ const u = { ...e };
2163
+ for (const [y, C] of Object.entries(t))
2164
+ C !== void 0 && (C === null ? delete u[y] : u[y] = C);
2165
+ const b = mt[i].safeParse(u);
2166
+ if (!b.success) {
2167
+ const y = b.error.issues[0];
2101
2168
  return s({
2102
- code: (_ == null ? void 0 : _.code) === "unrecognized_keys" ? "query_form_mismatch" : "invalid_change",
2103
- message: (_ == null ? void 0 : _.message) ?? "The merged query is not valid.",
2104
- path: _ ? At(a, _) : a,
2169
+ code: (y == null ? void 0 : y.code) === "unrecognized_keys" ? "query_form_mismatch" : "invalid_change",
2170
+ message: (y == null ? void 0 : y.message) ?? "The merged query is not valid.",
2171
+ path: y ? Et(a, y) : a,
2105
2172
  fix: "Patch only keys of the card's query form, or send a complete query of a new form."
2106
2173
  });
2107
2174
  }
2108
- return y.data;
2109
- }
2110
- function pt(e, t, a) {
2111
- return e ? (e.forEach((s, d) => a(s, `${t}.sheetIds[${d}]`)), { kind: "sheets", sheetIds: [...e] }) : { kind: "allSheets", sheetKinds: ["dashboard"] };
2112
- }
2113
- function mt(e, t, a, s) {
2114
- ["date", "datetime", "timestamp"].some((n) => Pe(t.dataType).includes(n)) || s({ code: "invalid_change", message: "defaultPeriod is for date filters.", path: a, fix: "Use defaultValues for this field." });
2115
- const i = Ct(e);
2116
- if (!i) {
2117
- const n = "anchor" in e && e.anchor === "latest_available";
2118
- if (!n && $a(e)) {
2119
- const o = e.unit;
2175
+ return b.data;
2176
+ }
2177
+ function gt(e, t, a) {
2178
+ return e ? (e.forEach((s, r) => a(s, `${t}.sheetIds[${r}]`)), { kind: "sheets", sheetIds: [...e] }) : { kind: "allSheets", sheetKinds: ["dashboard"] };
2179
+ }
2180
+ function bt(e, t, a, s) {
2181
+ ["date", "datetime", "timestamp"].some((i) => Pe(t.dataType).includes(i)) || s({ code: "invalid_change", message: "defaultPeriod is for date filters.", path: a, fix: "Use defaultValues for this field." });
2182
+ const n = vt(e);
2183
+ if (!n) {
2184
+ const i = "anchor" in e && e.anchor === "latest_available";
2185
+ if (!i && Ra(e)) {
2186
+ const d = e.unit;
2120
2187
  return s({
2121
2188
  code: "invalid_change",
2122
- message: `A filter's default can't count a partial ${o} back from now; its presets are whole days with today, complete ${o}s, or a calendar ${o}.`,
2189
+ message: `A filter's default can't count a partial ${d} back from now; its presets are whole days with today, complete ${d}s, or a calendar ${d}.`,
2123
2190
  path: a,
2124
- fix: `Use completeness "complete_periods", days ({ unit: "day", value: N }), or { kind: "calendar", unit: "${o}", period: "this", toDate: true }; ask the user which they mean.`
2191
+ fix: `Use completeness "complete_periods", days ({ unit: "day", value: N }), or { kind: "calendar", unit: "${d}", period: "this", toDate: true }; ask the user which they mean.`
2125
2192
  });
2126
2193
  }
2127
2194
  return s({
2128
2195
  code: "invalid_change",
2129
- message: n ? "A filter's default runs to now, not to the latest available data." : "This period can't be a filter's default.",
2196
+ message: i ? "A filter's default runs to now, not to the latest available data." : "This period can't be a filter's default.",
2130
2197
  path: a,
2131
- fix: n ? "Leave out anchor (a filter default runs to now)." : 'Use days ({ unit: "day", value: N }), complete periods, or a calendar window ({ kind: "calendar", unit, period }).'
2198
+ fix: i ? "Leave out anchor (a filter default runs to now)." : 'Use days ({ unit: "day", value: N }), complete periods, or a calendar window ({ kind: "calendar", unit, period }).'
2132
2199
  });
2133
2200
  }
2134
- return i;
2201
+ return n;
2135
2202
  }
2136
- async function Ps(e, t, a, s, d) {
2137
- const i = la(e), n = i.kind === "config" ? i.executableSources : i.kind === "sql" ? i.pinnedCatalogSources.map((c) => c.source) : [], o = ve(e), p = typeof t == "string" ? (o == null ? void 0 : o.kind) === "semantic" ? o.datasetName : void 0 : t.datasetName, y = n.find((c) => c.kind === "semantic" && Pe(c.datasetName) === Pe(p));
2138
- if (!y || y.kind !== "semantic")
2139
- return d({
2203
+ async function Ls(e, t, a, s, r) {
2204
+ const n = ha(e), i = n.kind === "config" ? n.executableSources : n.kind === "sql" ? n.pinnedCatalogSources.map((_) => _.source) : [], d = fe(e), u = typeof t == "string" ? (d == null ? void 0 : d.kind) === "semantic" ? d.datasetName : void 0 : t.datasetName, b = i.find((_) => _.kind === "semantic" && Pe(_.datasetName) === Pe(u));
2205
+ if (!b || b.kind !== "semantic")
2206
+ return r({
2140
2207
  code: "field_not_found",
2141
- message: `"${e.title}" doesn't read ${p ? `the dataset ${p}` : "a dataset"}.`,
2208
+ message: `"${e.title}" doesn't read ${u ? `the dataset ${u}` : "a dataset"}.`,
2142
2209
  path: s,
2143
2210
  fix: "Name a field of the card's own dataset, or { name, datasetName } for a dataset its query joins."
2144
2211
  });
2145
- const _ = await a.loadCardSource({ domainId: y.domainId, datasetName: y.datasetName }), g = typeof t == "string" ? t : t.name, C = _ ? It(_.fields, g, y.datasetName) : void 0, w = C ? qt(y, { column_name: C.name, data_type: C.dataType, ...C.sourceField ? { sourceField: C.sourceField } : {} }) : void 0;
2146
- return w || d({
2212
+ const y = await a.loadCardSource({ domainId: b.domainId, datasetName: b.datasetName }), C = typeof t == "string" ? t : t.name, p = y ? _t(y.fields, C, b.datasetName) : void 0, $ = p ? Mt(b, { column_name: p.name, data_type: p.dataType, ...p.sourceField ? { sourceField: p.sourceField } : {} }) : void 0;
2213
+ return $ || r({
2147
2214
  code: "field_not_found",
2148
- message: `"${g}" isn't a field of ${y.datasetName}.`,
2215
+ message: `"${C}" isn't a field of ${b.datasetName}.`,
2149
2216
  path: s,
2150
2217
  fix: "Use one of details.available, or read semaphor_get_dataset_schema.",
2151
- details: { available: ((_ == null ? void 0 : _.fields) ?? []).slice(0, 20).map((c) => c.name) }
2218
+ details: { available: ((y == null ? void 0 : y.fields) ?? []).slice(0, 20).map((_) => _.name) }
2152
2219
  });
2153
2220
  }
2154
- const Ms = 50;
2155
- function pi(e, t) {
2156
- var C, w;
2157
- const a = (C = t.sheetIds) != null && C.length ? new Set(t.sheetIds) : void 0, s = (w = t.cardIds) != null && w.length ? new Set(t.cardIds) : void 0, d = (e.sheets ?? []).filter((c) => !a || a.has(c.id)), i = re(e).filter(
2158
- (c) => (!a || a.has(c.sheetId)) && (!s || s.has(c.cardId))
2159
- ), n = i.length > (t.maxQueryCards ?? Ms), o = new Map(
2160
- (e.sheets ?? []).flatMap((c) => (c.frames ?? []).map((R) => [R.id, R]))
2161
- ), p = /* @__PURE__ */ new Map(), y = (c) => {
2162
- (c == null ? void 0 : c.kind) === "semantic" && p.set(`${c.domainId}|${c.datasetName}`, { domainId: c.domainId, datasetName: c.datasetName });
2163
- }, _ = d.map((c) => ({
2164
- sheetId: c.id,
2165
- title: c.title ?? "",
2166
- kind: c.kind === "document" ? "document" : "dashboard",
2167
- ...c.kind === "document" ? {} : { layout: Ls(c) },
2168
- cards: i.filter((R) => R.sheetId === c.id).map((R) => {
2169
- var $;
2170
- const m = R.card, f = R.kind === "frameCard" ? ($ = o.get(R.frameId)) == null ? void 0 : $.visualId : void 0, b = f ? { linkedVisualId: f } : {}, A = { cardId: R.cardId, title: m.title ?? "" };
2171
- if (R.kind !== "frameCard") {
2172
- const U = ve(m);
2173
- return y(U), {
2174
- ...A,
2175
- type: Ee(m.type),
2176
- ...U ? { source: U } : {},
2221
+ const Bs = 50;
2222
+ function gi(e, t) {
2223
+ var p, $;
2224
+ const a = (p = t.sheetIds) != null && p.length ? new Set(t.sheetIds) : void 0, s = ($ = t.cardIds) != null && $.length ? new Set(t.cardIds) : void 0, r = (e.sheets ?? []).filter((_) => !a || a.has(_.id)), n = re(e).filter(
2225
+ (_) => (!a || a.has(_.sheetId)) && (!s || s.has(_.cardId))
2226
+ ), i = n.length > (t.maxQueryCards ?? Bs), d = new Map(
2227
+ (e.sheets ?? []).flatMap((_) => (_.frames ?? []).map((g) => [g.id, g]))
2228
+ ), u = /* @__PURE__ */ new Map(), b = (_) => {
2229
+ (_ == null ? void 0 : _.kind) === "semantic" && u.set(`${_.domainId}|${_.datasetName}`, { domainId: _.domainId, datasetName: _.datasetName });
2230
+ }, y = r.map((_) => ({
2231
+ sheetId: _.id,
2232
+ title: _.title ?? "",
2233
+ kind: _.kind === "document" ? "document" : "dashboard",
2234
+ ..._.kind === "document" ? {} : { layout: Vs(_) },
2235
+ cards: n.filter((g) => g.sheetId === _.id).map((g) => {
2236
+ var D;
2237
+ const A = g.card, c = g.kind === "frameCard" ? (D = d.get(g.frameId)) == null ? void 0 : D.visualId : void 0, m = c ? { linkedVisualId: c } : {}, F = { cardId: g.cardId, title: A.title ?? "" };
2238
+ if (g.kind !== "frameCard") {
2239
+ const N = fe(A);
2240
+ return b(N), {
2241
+ ...F,
2242
+ type: Oe(A.type),
2243
+ ...N ? { source: N } : {},
2177
2244
  editable: !1,
2178
- notEditable: R.kind === "documentSectionCard" ? { reason: "document_section", message: "Cards in Document sections can't be changed through the MCP yet. Change them in the editor." } : {
2245
+ notEditable: g.kind === "documentSectionCard" ? { reason: "document_section", message: "Cards in Document sections can't be changed through the MCP yet. Change them in the editor." } : {
2179
2246
  reason: "not_expressible",
2180
2247
  message: "This card isn't in a tile, so it can't be changed through the MCP. Change it in the editor.",
2181
2248
  detail: "a card outside a tile"
2182
2249
  }
2183
2250
  };
2184
2251
  }
2185
- const D = oe(m, { sql: t.sql });
2186
- return y(D.source), D.editable ? {
2187
- ...A,
2188
- type: D.type,
2189
- source: D.source,
2190
- ...b,
2252
+ const k = oe(A, { sql: t.sql });
2253
+ return b(k.source), k.editable ? {
2254
+ ...F,
2255
+ type: k.type,
2256
+ source: k.source,
2257
+ ...m,
2191
2258
  editable: !0,
2192
- ...n ? {} : { query: D.query, ...D.matrix ? { matrix: D.matrix } : {} }
2259
+ ...i ? {} : { query: k.query, ...k.matrix ? { matrix: k.matrix } : {} }
2193
2260
  } : {
2194
- ...A,
2195
- type: D.type,
2196
- ...D.source ? { source: D.source } : {},
2197
- ...b,
2261
+ ...F,
2262
+ type: k.type,
2263
+ ...k.source ? { source: k.source } : {},
2264
+ ...m,
2198
2265
  editable: !1,
2199
- notEditable: { reason: D.reason, message: D.message, ...D.detail ? { detail: D.detail } : {} }
2266
+ notEditable: { reason: k.reason, message: k.message, ...k.detail ? { detail: k.detail } : {} }
2200
2267
  };
2201
2268
  })
2202
- })), g = Ft(e, kt(t.calendar, t.updatedAt));
2203
- for (const c of g)
2204
- c.editable && p.set(`${c.domainId}|${c.datasetName}`, { domainId: c.domainId, datasetName: c.datasetName });
2269
+ })), C = Rt(e, Ft(t.calendar, t.updatedAt), {
2270
+ ...t.relationshipReach ? { relationshipReach: t.relationshipReach } : {}
2271
+ });
2272
+ for (const _ of C)
2273
+ _.editable && u.set(`${_.domainId}|${_.datasetName}`, { domainId: _.domainId, datasetName: _.datasetName });
2205
2274
  return {
2206
2275
  dashboardId: t.dashboardId,
2207
2276
  title: e.title ?? "",
2208
2277
  updatedAt: t.updatedAt,
2209
2278
  access: t.access,
2210
- datasets: [...p.values()],
2211
- sheets: _,
2212
- filters: g,
2213
- ...n ? { truncated: !0 } : {}
2279
+ datasets: [...u.values()],
2280
+ sheets: y,
2281
+ filters: C,
2282
+ ...i ? { truncated: !0 } : {}
2214
2283
  };
2215
2284
  }
2216
- function Ls(e) {
2285
+ function Vs(e) {
2217
2286
  const t = new Map((e.frames ?? []).map((a) => [a.id, a]));
2218
- return Aa(e).rows.map((a) => ({
2287
+ return Oa(e).rows.map((a) => ({
2219
2288
  tiles: a.tiles.map((s) => {
2220
- var o, p;
2221
- const d = ((o = t.get(s.frameId)) == null ? void 0 : o.cards) ?? [], i = (p = t.get(s.frameId)) == null ? void 0 : p.activeCardId, n = d.map((y) => y.id);
2222
- return { cardIds: i && n.includes(i) ? [i, ...n.filter((y) => y !== i)] : n, width: s.width };
2289
+ var d, u;
2290
+ const r = ((d = t.get(s.frameId)) == null ? void 0 : d.cards) ?? [], n = (u = t.get(s.frameId)) == null ? void 0 : u.activeCardId, i = r.map((b) => b.id);
2291
+ return { cardIds: n && i.includes(n) ? [n, ...i.filter((b) => b !== n)] : i, width: s.width };
2223
2292
  })
2224
2293
  }));
2225
2294
  }
2226
2295
  export {
2227
- Ni as AGGREGATES,
2228
- qi as AUTOMATIC_TEMPORAL_BUCKET_FORMAT,
2229
- Pi as CALCULATED_FIELDS_GROUP_ID,
2230
- Mi as CALCULATED_FIELDS_GROUP_NAME,
2231
- Li as CARD_CONFIG_KEY_CLASSES,
2232
- Bi as CARD_KEY_CLASSES,
2233
- ba as CARD_QUERY_CONFIG_KEYS,
2234
- ci as CARD_QUERY_REQUEST_DESCRIPTIVE_FIELDS,
2235
- li as CARD_QUERY_REQUEST_EXECUTED_FIELDS,
2236
- Vi as CARD_TYPES,
2296
+ Ui as AGGREGATES,
2297
+ ji as AUTOMATIC_TEMPORAL_BUCKET_FORMAT,
2298
+ zi as CALCULATED_FIELDS_GROUP_ID,
2299
+ Qi as CALCULATED_FIELDS_GROUP_NAME,
2300
+ Ki as CARD_CONFIG_KEY_CLASSES,
2301
+ Hi as CARD_KEY_CLASSES,
2302
+ _a as CARD_QUERY_CONFIG_KEYS,
2303
+ hi as CARD_QUERY_REQUEST_DESCRIPTIVE_FIELDS,
2304
+ ui as CARD_QUERY_REQUEST_EXECUTED_FIELDS,
2305
+ Wi as CARD_TYPES,
2237
2306
  ce as CARD_TYPE_RULES,
2238
- Gi as COLUMN_KEY_CLASSES,
2239
- Ui as COLUMN_PRESENTATION_KEYS,
2240
- ji as CONTROL_BINDING_MAPPING_MISSING_ERROR_CODE,
2241
- zi as CONTROL_BINDING_TARGET_INVALID_ERROR_CODE,
2242
- Qi as CONTROL_BINDING_VALUE_INVALID_ERROR_CODE,
2243
- Ki as CONTROL_CONTEXT_UNSUPPORTED_ERROR_CODE,
2244
- Wi as CONTROL_DEFINITION_DUPLICATE_ERROR_CODE,
2245
- Hi as CONTROL_DEFINITION_INVALID_ERROR_CODE,
2246
- Yi as CONTROL_PLACEHOLDER_QUOTED_ERROR_CODE,
2247
- Xi as CONTROL_REFERENCE_MISSING_ERROR_CODE,
2248
- Ji as CONTROL_VALUE_INVALID_ERROR_CODE,
2249
- Zi as CONTROL_VALUE_MISSING_ERROR_CODE,
2307
+ Yi as COLUMN_KEY_CLASSES,
2308
+ Xi as COLUMN_PRESENTATION_KEYS,
2309
+ Ji as CONTROL_BINDING_MAPPING_MISSING_ERROR_CODE,
2310
+ Zi as CONTROL_BINDING_TARGET_INVALID_ERROR_CODE,
2311
+ en as CONTROL_BINDING_VALUE_INVALID_ERROR_CODE,
2312
+ tn as CONTROL_CONTEXT_UNSUPPORTED_ERROR_CODE,
2313
+ an as CONTROL_DEFINITION_DUPLICATE_ERROR_CODE,
2314
+ sn as CONTROL_DEFINITION_INVALID_ERROR_CODE,
2315
+ nn as CONTROL_PLACEHOLDER_QUOTED_ERROR_CODE,
2316
+ on as CONTROL_REFERENCE_MISSING_ERROR_CODE,
2317
+ rn as CONTROL_VALUE_INVALID_ERROR_CODE,
2318
+ dn as CONTROL_VALUE_MISSING_ERROR_CODE,
2250
2319
  W as CardQueryRequestError,
2251
- en as ControlResolutionError,
2252
- at as DASHBOARD_AUTHORING_MAX_GENERATED_CARDS,
2253
- tn as DASHBOARD_CHANGE_OPS,
2254
- an as DASHBOARD_DEFAULT_OPTION_DEPENDENCIES,
2255
- ur as DASHBOARD_FILTER_OPERATIONS,
2256
- sn as DASHBOARD_INPUT_RUNTIME_SCOPE_KINDS,
2257
- fr as DOCUMENT_KPI_SECTION_MAX_CARDS,
2258
- hr as DOCUMENT_KPI_SECTION_MAX_TILES,
2259
- nn as DashboardFilterMappingContractError,
2260
- on as ExecutionControlContractError,
2261
- rn as FILTER_OPERATORS,
2262
- dn as FilterModelError,
2263
- it as MAX_PROPOSED_CHANGES,
2264
- ln as MAX_QUERY_LIMIT,
2265
- bi as NEW_CARD_TYPE,
2266
- cn as QUERY_ASPECTS,
2267
- un as QUERY_CONFIG_KEY_ASPECTS,
2268
- fn as SEMAPHOR_CARTESIAN_CHART_TYPES,
2269
- hn as TIME_GRAINS,
2270
- pn as TOOLBAR_FILTER_REACH_FIELDS,
2271
- mn as analyticsFilterSchema,
2272
- Cr as applyCardReferenceRemapping,
2273
- st as applyDashboardOperations,
2274
- Sr as applyFilterApplicability,
2275
- Ii as applyFilterSettingsChange,
2276
- vr as applyGroupByOverride,
2277
- gn as applyLinkedClickToFilterOverrides,
2278
- bn as applyOptionDependencyOverride,
2279
- yi as buildCardExportFormatOptions,
2280
- xr as buildCardExportQueryContext,
2281
- _i as buildCardExportRequest,
2282
- Ci as buildCardExportRequestFromOptions,
2283
- Si as buildColumnCatalog,
2284
- In as buildControlDefinitionIndex,
2285
- la as buildDashboardCardSourceIndex,
2286
- vi as buildEntityColumnGroup,
2287
- xi as buildFilterInputFromDefinition,
2288
- Ot as buildFilterInputFromField,
2289
- yn as buildLinkedClickToFilterOverrides,
2290
- _n as buildProposeChangeInputSchema,
2291
- Cn as buildSavedEditorCard,
2292
- wi as buildTableExportFormatOptions,
2293
- Sn as cardQueryPatchSchema,
2294
- vn as cardTypeSentenceName,
2295
- Ia as changeCardType,
2296
- xn as changeMatrixEditor,
2297
- Pt as clickToFilterSettingsSchema,
2298
- wr as collectJoinPlanIdentifiers,
2299
- ea as columnDataset,
2300
- ya as columnFieldKey,
2301
- va as columnKeys,
2302
- ri as compileDashboardFromPlan,
2303
- Dr as composeCardReferenceRemapping,
2304
- wn as controlBindingExecutionSchema,
2305
- Dn as controlDefinitionExecutionSchema,
2306
- oa as controlRefusal,
2307
- Tn as createDashboardFilterBindingId,
2308
- Kr as createMatrixAuthoringDraft,
2309
- Wr as createMatrixConfig,
2310
- Nt as createNewCard,
2320
+ ln as ControlResolutionError,
2321
+ it as DASHBOARD_AUTHORING_MAX_GENERATED_CARDS,
2322
+ cn as DASHBOARD_CHANGE_OPS,
2323
+ un as DASHBOARD_DEFAULT_OPTION_DEPENDENCIES,
2324
+ xr as DASHBOARD_FILTER_OPERATIONS,
2325
+ hn as DASHBOARD_INPUT_RUNTIME_SCOPE_KINDS,
2326
+ Dr as DOCUMENT_KPI_SECTION_MAX_CARDS,
2327
+ Tr as DOCUMENT_KPI_SECTION_MAX_TILES,
2328
+ fn as DashboardFilterMappingContractError,
2329
+ pn as ExecutionControlContractError,
2330
+ mn as FILTER_OPERATORS,
2331
+ gn as FilterModelError,
2332
+ ot as MAX_PROPOSED_CHANGES,
2333
+ bn as MAX_QUERY_LIMIT,
2334
+ yi as NEW_CARD_TYPE,
2335
+ In as QUERY_ASPECTS,
2336
+ yn as QUERY_CONFIG_KEY_ASPECTS,
2337
+ _i as RELATIONSHIP_ROUTE_CHANGED_MESSAGE,
2338
+ _n as SEMAPHOR_CARTESIAN_CHART_TYPES,
2339
+ Cn as TIME_GRAINS,
2340
+ Sn as TOOLBAR_FILTER_REACH_FIELDS,
2341
+ vn as analyticsFilterSchema,
2342
+ Nr as applyCardReferenceRemapping,
2343
+ nt as applyDashboardOperations,
2344
+ qr as applyFilterApplicability,
2345
+ Ci as applyFilterSettingsChange,
2346
+ Pr as applyGroupByOverride,
2347
+ wn as applyLinkedClickToFilterOverrides,
2348
+ xn as applyOptionDependencyOverride,
2349
+ Si as buildCardExportFormatOptions,
2350
+ Mr as buildCardExportQueryContext,
2351
+ vi as buildCardExportRequest,
2352
+ wi as buildCardExportRequestFromOptions,
2353
+ xi as buildColumnCatalog,
2354
+ Dn as buildControlDefinitionIndex,
2355
+ ha as buildDashboardCardSourceIndex,
2356
+ Di as buildEntityColumnGroup,
2357
+ Ti as buildFilterInputFromDefinition,
2358
+ qt as buildFilterInputFromField,
2359
+ Tn as buildLinkedClickToFilterOverrides,
2360
+ kn as buildProposeChangeInputSchema,
2361
+ $n as buildSavedEditorCard,
2362
+ ki as buildTableExportFormatOptions,
2363
+ Fn as cardQueryPatchSchema,
2364
+ An as cardTypeSentenceName,
2365
+ Ca as changeCardType,
2366
+ Rn as changeMatrixEditor,
2367
+ Lt as clickToFilterSettingsSchema,
2368
+ Lr as collectJoinPlanIdentifiers,
2369
+ sa as columnDataset,
2370
+ Sa as columnFieldKey,
2371
+ Da as columnKeys,
2372
+ li as compileDashboardFromPlan,
2373
+ Br as composeCardReferenceRemapping,
2374
+ En as controlBindingExecutionSchema,
2375
+ On as controlDefinitionExecutionSchema,
2376
+ la as controlRefusal,
2377
+ Nn as createDashboardFilterBindingId,
2378
+ nd as createMatrixAuthoringDraft,
2379
+ od as createMatrixConfig,
2380
+ Pt as createNewCard,
2311
2381
  Ve as dashboardAuthoringDatasetMatchesSource,
2312
- ni as dashboardAuthoringFieldsReferToSameTarget,
2382
+ ri as dashboardAuthoringFieldsReferToSameTarget,
2313
2383
  J as dashboardAuthoringSourceFromField,
2314
- si as dashboardAuthoringSourceKey,
2315
- St as dashboardAuthoringSourcesReferToSameDataset,
2316
- kn as dashboardCardFilterSourceInventoryContains,
2317
- ta as dashboardChangeSchema,
2318
- Tr as dashboardFilterTargetMatchesLogicalValue,
2319
- pr as dashboardFilterValueTypeForDataType,
2320
- $n as dashboardGenerateSchema,
2321
- Yt as dashboardInputScopeIncludesDocumentSheets,
2322
- di as dashboardPlanFromSemaphorDashboardIntent,
2323
- Fn as defaultClickToFilterSettings,
2324
- Oe as describeDashboardFilterCardReach,
2325
- na as describeQueryChange,
2326
- An as doesDashboardInputApplyToTarget,
2327
- Rn as doesDashboardInputSurviveCarriedContext,
2328
- En as doesToolbarFilterReachTab,
2329
- Di as domainCalculatedFields,
2330
- On as dropMatrixEditorField,
2331
- Zt as fieldIdentityKey,
2332
- Nn as fieldRefSchema,
2333
- kr as filterApplicabilityContextForCard,
2334
- $r as filterValueReachForCard,
2335
- It as findCatalogField,
2336
- oi as findDashboardAuthoringDatasetForSource,
2337
- qn as findDashboardCardExecutableSource,
2338
- Pn as findDashboardCardPinnedCatalogSource,
2339
- Mn as findDashboardSqlPinnedCatalogSource,
2340
- Jt as findSortedColumn,
2341
- Ti as flattenEntityColumns,
2342
- Ln as foldPrototypeDocumentInputs,
2343
- Bn as formatFilterModelIssues,
2344
- jt as formatResolvedPrimaryDateFieldIssues,
2345
- Fr as formatSkippedFilterWarnings,
2346
- ki as getCalculatedFieldAggregateOverrides,
2347
- Vn as getCalculatedFieldNamespace,
2348
- $i as getCalculatedFieldParameters,
2349
- Fi as getCalculatedFieldShelfOverrides,
2350
- Gn as getCardDefinition,
2351
- Un as getColumnCatalogFieldId,
2352
- Wa as getDashboardAuthoringCardSource,
2353
- Ai as getDashboardFilterSubscriptionHint,
2354
- jn as getDashboardGlobalDateFilter,
2355
- mr as getDocumentKpiSectionShapeIssues,
2356
- gr as getDocumentSectionCards,
2357
- Ri as getDomainCalculatedSelectionOverrides,
2358
- zn as getFieldAggregationOptions,
2359
- Qn as getMatrixBindingTargets,
2360
- Hr as getMatrixLevelLabel,
2361
- Yr as getMatrixMeasureLabel,
2362
- Kn as getStableDomainCalculatedFieldId,
2363
- Wn as getTemporalBucketAuthoringOptions,
2364
- Hn as getTemporalBucketAuthoringSelection,
2365
- Yn as handleSchema,
2366
- Ei as hasDashboardFilterSubscription,
2367
- Xn as hasToolbarFilterReachField,
2368
- Ar as hostFilterValueFor,
2369
- Rr as hostFilterValuesToSlots,
2370
- Er as isAdHocFilterValueOnTab,
2371
- Jn as isAllowedDashboardInputScopeCombination,
2372
- Zn as isCardType,
2373
- br as isDashboardFilterOperationCompatible,
2374
- bt as isDashboardInputOnTab,
2375
- eo as isDashboardInputOwnedBySheet,
2376
- Gt as isDashboardInputScopeEmpty,
2377
- to as isGroupedDate,
2378
- ao as isHiddenFilterInput,
2379
- pe as isMaterializableDashboardAuthoringSource,
2380
- so as isPresentationCurrencyBinding,
2381
- io as isSemaphorCartesianChartType,
2382
- La as isSemaphorSourceRef,
2383
- no as isStructuralControlBinding,
2384
- oo as isValidControlOptionPresentation,
2385
- Xt as labelAt,
2386
- ro as layoutArrangeSchema,
2387
- lo as linkedClickToFilterOverridesSchema,
2388
- Or as listAdHocFilterValuesOnTab,
2384
+ ni as dashboardAuthoringSourceKey,
2385
+ wt as dashboardAuthoringSourcesReferToSameDataset,
2386
+ qn as dashboardCardFilterSourceInventoryContains,
2387
+ ia as dashboardChangeSchema,
2388
+ Pn as dashboardFilterTargetMatchesLogicalValue,
2389
+ kr as dashboardFilterValueTypeForDataType,
2390
+ Mn as dashboardGenerateSchema,
2391
+ Zt as dashboardInputScopeIncludesDocumentSheets,
2392
+ ci as dashboardPlanFromSemaphorDashboardIntent,
2393
+ Ln as defaultClickToFilterSettings,
2394
+ Vr as describeDashboardFilterCardReach,
2395
+ ve as describeDashboardFilterCardReachDetail,
2396
+ da as describeQueryChange,
2397
+ $i as describeRelationshipRoute,
2398
+ Fi as describeRelationshipSkip,
2399
+ Bn as doesDashboardInputApplyToTarget,
2400
+ Vn as doesDashboardInputSurviveCarriedContext,
2401
+ Gn as doesToolbarFilterReachTab,
2402
+ Ai as domainCalculatedFields,
2403
+ Un as dropMatrixEditorField,
2404
+ aa as fieldIdentityKey,
2405
+ jn as fieldRefSchema,
2406
+ Gr as filterApplicabilityContextForCard,
2407
+ Ri as filterReachPreviewAnswers,
2408
+ Ur as filterValueReachForCard,
2409
+ zn as filterValueSemanticDataset,
2410
+ _t as findCatalogField,
2411
+ di as findDashboardAuthoringDatasetForSource,
2412
+ Qn as findDashboardCardExecutableSource,
2413
+ Kn as findDashboardCardPinnedCatalogSource,
2414
+ Hn as findDashboardSqlPinnedCatalogSource,
2415
+ ta as findSortedColumn,
2416
+ Ei as flattenEntityColumns,
2417
+ Wn as foldPrototypeDocumentInputs,
2418
+ Yn as formatFilterModelIssues,
2419
+ Qt as formatResolvedPrimaryDateFieldIssues,
2420
+ jr as formatSkippedFilterWarnings,
2421
+ Oi as getCalculatedFieldAggregateOverrides,
2422
+ Xn as getCalculatedFieldNamespace,
2423
+ Ni as getCalculatedFieldParameters,
2424
+ qi as getCalculatedFieldShelfOverrides,
2425
+ Jn as getCardDefinition,
2426
+ Zn as getColumnCatalogFieldId,
2427
+ Ya as getDashboardAuthoringCardSource,
2428
+ Pi as getDashboardFilterSubscriptionHint,
2429
+ eo as getDashboardGlobalDateFilter,
2430
+ $r as getDocumentKpiSectionShapeIssues,
2431
+ Fr as getDocumentSectionCards,
2432
+ Mi as getDomainCalculatedSelectionOverrides,
2433
+ to as getFieldAggregationOptions,
2434
+ ao as getMatrixBindingTargets,
2435
+ rd as getMatrixLevelLabel,
2436
+ dd as getMatrixMeasureLabel,
2437
+ so as getStableDomainCalculatedFieldId,
2438
+ io as getTemporalBucketAuthoringOptions,
2439
+ no as getTemporalBucketAuthoringSelection,
2440
+ oo as handleSchema,
2441
+ Li as hasDashboardFilterSubscription,
2442
+ ro as hasToolbarFilterReachField,
2443
+ zr as hostFilterValueFor,
2444
+ Qr as hostFilterValuesToSlots,
2445
+ Kr as isAdHocFilterValueOnTab,
2446
+ lo as isAllowedDashboardInputScopeCombination,
2447
+ co as isCardType,
2448
+ Ar as isDashboardFilterOperationCompatible,
2449
+ yt as isDashboardInputOnTab,
2450
+ uo as isDashboardInputOwnedBySheet,
2451
+ jt as isDashboardInputScopeEmpty,
2452
+ ho as isGroupedDate,
2453
+ fo as isHiddenFilterInput,
2454
+ me as isMaterializableDashboardAuthoringSource,
2455
+ po as isPresentationCurrencyBinding,
2456
+ mo as isSemanticAutoJoinCard,
2457
+ go as isSemaphorCartesianChartType,
2458
+ Va as isSemaphorSourceRef,
2459
+ bo as isStructuralControlBinding,
2460
+ Io as isValidControlOptionPresentation,
2461
+ ea as labelAt,
2462
+ yo as layoutArrangeSchema,
2463
+ _o as linkedClickToFilterOverridesSchema,
2464
+ Hr as listAdHocFilterValuesOnTab,
2389
2465
  re as listDashboardCardLocations,
2390
- co as listDashboardFilterDefinitions,
2391
- uo as listDashboardFilterInputsOnTab,
2392
- fo as listDashboardInputReachKeys,
2393
- Kt as listDashboardInputScopeExceptedCardIds,
2394
- Ht as listDashboardInputScopeExceptedSheetIds,
2466
+ Co as listDashboardFilterDefinitions,
2467
+ So as listDashboardFilterInputsOnTab,
2468
+ vo as listDashboardInputReachKeys,
2469
+ Yt as listDashboardInputScopeExceptedCardIds,
2470
+ Jt as listDashboardInputScopeExceptedSheetIds,
2395
2471
  Me as listDashboardTabTargets,
2396
- Nr as listFilterInputValueTargets,
2397
- ho as listStoredFilterDefinitions,
2398
- Ir as mapDocumentSectionCards,
2399
- po as matchColumns,
2400
- qr as matrixCatalogSources,
2401
- Sa as matrixColumnKeys,
2402
- mo as matrixColumnsSchema,
2403
- ed as matrixDefinitionFields,
2404
- td as matrixDefinitionSources,
2405
- go as matrixEditorCatalogFromFields,
2406
- Pr as matrixExecutionSources,
2407
- bo as measureRefSchema,
2408
- xe as mergeDashboardAuthoringSources,
2409
- Xr as mergeMatrixSorts,
2410
- fa as metricCardQuerySchema,
2411
- Ca as moveMatrixLevel,
2412
- Io as normalizeClickToFilterSettings,
2413
- yo as normalizeDashboardInputs,
2414
- _o as normalizeLegacyLinkedTargetOverrides,
2415
- Co as occurrenceKeys,
2416
- kt as outlineCalendar,
2417
- pi as outlineDashboard,
2418
- he as outlineFilter,
2419
- Ft as outlineFilters,
2420
- fi as parseCardQueryRequest,
2421
- Ds as parseCardQueryRequestContext,
2422
- ui as parseCardQueryRequestExtras,
2423
- So as parseExecutionControlBindingsShallow,
2424
- Qt as parseExecutionControlContext,
2425
- vo as parseExecutionControlContract,
2426
- ra as planCardLabels,
2427
- rt as planCardRequery,
2428
- Ba as preferDashboardAuthoringSourceMetadata,
2429
- ii as preferredDashboardAuthoringSource,
2430
- Mr as prepareLoadedDashboard,
2431
- xo as previewTemporalBucketAuthoringFormat,
2432
- wo as proposedChangeSchema,
2433
- Lr as pruneUnrelatedCalculatedFilters,
2434
- da as queryForm,
2472
+ Wr as listFilterInputValueTargets,
2473
+ wo as listStoredFilterDefinitions,
2474
+ Rr as mapDocumentSectionCards,
2475
+ xo as matchColumns,
2476
+ Yr as matrixCatalogSources,
2477
+ xa as matrixColumnKeys,
2478
+ Do as matrixColumnsSchema,
2479
+ hd as matrixDefinitionFields,
2480
+ fd as matrixDefinitionSources,
2481
+ To as matrixEditorCatalogFromFields,
2482
+ Xr as matrixExecutionSources,
2483
+ ko as measureRefSchema,
2484
+ we as mergeDashboardAuthoringSources,
2485
+ ld as mergeMatrixSorts,
2486
+ ma as metricCardQuerySchema,
2487
+ wa as moveMatrixLevel,
2488
+ $o as normalizeClickToFilterSettings,
2489
+ Fo as normalizeDashboardInputs,
2490
+ Ao as normalizeLegacyLinkedTargetOverrides,
2491
+ Ro as occurrenceKeys,
2492
+ Ft as outlineCalendar,
2493
+ gi as outlineDashboard,
2494
+ pe as outlineFilter,
2495
+ Rt as outlineFilters,
2496
+ pi as parseCardQueryRequest,
2497
+ ks as parseCardQueryRequestContext,
2498
+ fi as parseCardQueryRequestExtras,
2499
+ Eo as parseExecutionControlBindingsShallow,
2500
+ Ht as parseExecutionControlContext,
2501
+ Oo as parseExecutionControlContract,
2502
+ ca as planCardLabels,
2503
+ lt as planCardRequery,
2504
+ Bi as pluralDatasetLabel,
2505
+ Ga as preferDashboardAuthoringSourceMetadata,
2506
+ oi as preferredDashboardAuthoringSource,
2507
+ Jr as prepareLoadedDashboard,
2508
+ No as previewTemporalBucketAuthoringFormat,
2509
+ qo as proposedChangeSchema,
2510
+ Zr as pruneUnrelatedCalculatedFilters,
2511
+ ua as queryForm,
2435
2512
  oe as readCardQuery,
2436
- ve as readCardSource,
2513
+ fe as readCardSource,
2437
2514
  de as readDashboardFilterModel,
2438
- Do as readExactDomainCalculatedFieldReference,
2439
- Br as readFilterValueList,
2440
- ad as readMatrixCardConfig,
2441
- To as rebindDashboardOptionDependencyInputId,
2442
- ot as rebuildsRole,
2443
- ko as reconcileMatrixSpecStructure,
2444
- $o as reconcileTemporalBucketAuthoringFormat,
2445
- ua as recordsCardQuerySchema,
2446
- Fo as refDataset,
2515
+ Po as readExactDomainCalculatedFieldReference,
2516
+ Vi as readFilterReachResponse,
2517
+ ed as readFilterValueList,
2518
+ pd as readMatrixCardConfig,
2519
+ Mo as rebindDashboardOptionDependencyInputId,
2520
+ dt as rebuildsRole,
2521
+ Lo as reconcileMatrixSpecStructure,
2522
+ Bo as reconcileTemporalBucketAuthoringFormat,
2523
+ pa as recordsCardQuerySchema,
2524
+ Vo as refDataset,
2447
2525
  ne as refKey,
2448
- lt as refName,
2449
- Ao as relationshipAddSchema,
2450
- Ro as relativeToTimeWindow,
2451
- Lt as remapClickToFilterReferences,
2452
- Eo as remapLinkedClickToFilterOverrides,
2453
- Oo as requireNormalizedDashboardInputs,
2454
- No as resolveBindingControlValue,
2455
- rr as resolveCanonicalDetailResultRawKey,
2456
- dr as resolveCanonicalResultOutputKey,
2457
- lr as resolveCanonicalResultRawKey,
2458
- Va as resolveDashboardAuthoringSource,
2459
- hi as resolveDashboardChanges,
2460
- qo as resolveDashboardEntitySource,
2461
- Vr as resolveDashboardFilterAutomaticTarget,
2462
- Gr as resolveDashboardFilterInheritedTarget,
2463
- Po as resolveDashboardOptionDependencies,
2464
- Mo as resolveDashboardOptionPopulation,
2465
- Ur as resolveDashboardSqlFilterTarget,
2466
- Lo as resolveFieldSelectedSource,
2467
- Bo as resolveGroupByFieldTarget,
2468
- jr as resolveMatrixControlBindings,
2469
- Jr as resolveMatrixDefinition,
2470
- Vo as resolveMetricFieldTarget,
2471
- Go as resolveScalarMappedValue,
2472
- Uo as resolveTemporalBucketAuthoringFormat,
2473
- zt as resolveTemporalResultOwner,
2474
- Mt as respondsToSelectionsSchema,
2475
- jo as retainMatrixConditionalFormatting,
2476
- Vt as rewriteDashboardInputScopeIds,
2477
- $e as sameColumnKey,
2526
+ ut as refName,
2527
+ Go as relationshipAddSchema,
2528
+ Uo as relationshipRouteTarget,
2529
+ jo as relativeToTimeWindow,
2530
+ Vt as remapClickToFilterReferences,
2531
+ zo as remapLinkedClickToFilterOverrides,
2532
+ Qo as requireNormalizedDashboardInputs,
2533
+ Ko as resolveBindingControlValue,
2534
+ Cr as resolveCanonicalDetailResultRawKey,
2535
+ Sr as resolveCanonicalResultOutputKey,
2536
+ vr as resolveCanonicalResultRawKey,
2537
+ Ua as resolveDashboardAuthoringSource,
2538
+ mi as resolveDashboardChanges,
2539
+ Ho as resolveDashboardEntitySource,
2540
+ Wo as resolveDashboardFilterAutomaticTarget,
2541
+ Yo as resolveDashboardFilterInheritedTarget,
2542
+ Xo as resolveDashboardOptionDependencies,
2543
+ Jo as resolveDashboardOptionPopulation,
2544
+ td as resolveDashboardSqlFilterTarget,
2545
+ Zo as resolveFieldSelectedSource,
2546
+ er as resolveGroupByFieldTarget,
2547
+ ad as resolveMatrixControlBindings,
2548
+ cd as resolveMatrixDefinition,
2549
+ tr as resolveMetricFieldTarget,
2550
+ ar as resolveScalarMappedValue,
2551
+ sr as resolveTemporalBucketAuthoringFormat,
2552
+ Kt as resolveTemporalResultOwner,
2553
+ Bt as respondsToSelectionsSchema,
2554
+ ir as retainMatrixConditionalFormatting,
2555
+ Ut as rewriteDashboardInputScopeIds,
2556
+ Fe as sameColumnKey,
2478
2557
  Le as sameValue,
2479
- zo as selectDashboardOptionDependencyInputIds,
2480
- Qo as selectionFieldFromExplorerField,
2481
- Ko as settableCardType,
2482
- Wo as sharedCardPreferences,
2483
- ca as sqlCardQuerySchema,
2484
- Re as statedLabelsOf,
2485
- Ho as stripInstanceTargetsForLibrarySave,
2486
- Yo as structuralControlOverride,
2487
- $t as summarizeFilter,
2488
- Xo as supportsCanonicalDashboardTemporalResult,
2489
- Jo as timeWindowSchema,
2490
- nt as toChartType,
2491
- Ee as toPublicCardType,
2492
- Zo as toolbarFilterInputFields,
2493
- er as toolbarFilterScope,
2494
- tr as transformComparisonDocument,
2495
- _a as updateMatrixConfig,
2496
- zr as upgradeToStoredDashboard,
2497
- ar as validateControlValue,
2498
- Ha as validateDashboardAuthoringDatasetScope,
2499
- yr as validateDashboardFilterValues,
2500
- ss as validateDashboardPlan,
2501
- Ut as validateResolvedPrimaryDateFieldShape,
2502
- sr as withCardExcludedFromScope,
2503
- ir as withCardIncludedInScope,
2504
- nr as withDashboardOptionDependencyOverride,
2505
- aa as withUnstatedScopeParts,
2506
- Bt as withoutToolbarFilterReachFields
2558
+ nr as selectDashboardOptionDependencyInputIds,
2559
+ or as selectionFieldFromExplorerField,
2560
+ rr as settableCardType,
2561
+ dr as sharedCardPreferences,
2562
+ fa as sqlCardQuerySchema,
2563
+ Ee as statedLabelsOf,
2564
+ lr as stripInstanceTargetsForLibrarySave,
2565
+ cr as structuralControlOverride,
2566
+ At as summarizeFilter,
2567
+ ur as supportsCanonicalDashboardTemporalResult,
2568
+ hr as timeWindowSchema,
2569
+ rt as toChartType,
2570
+ Oe as toPublicCardType,
2571
+ fr as toolbarFilterInputFields,
2572
+ pr as toolbarFilterScope,
2573
+ mr as transformComparisonDocument,
2574
+ va as updateMatrixConfig,
2575
+ sd as upgradeToStoredDashboard,
2576
+ gr as validateControlValue,
2577
+ Xa as validateDashboardAuthoringDatasetScope,
2578
+ Er as validateDashboardFilterValues,
2579
+ ns as validateDashboardPlan,
2580
+ zt as validateResolvedPrimaryDateFieldShape,
2581
+ br as withCardExcludedFromScope,
2582
+ Ir as withCardIncludedInScope,
2583
+ yr as withDashboardOptionDependencyOverride,
2584
+ na as withUnstatedScopeParts,
2585
+ Gt as withoutToolbarFilterReachFields
2507
2586
  };