react-semaphor 0.1.572 → 0.1.573

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 (40) hide show
  1. package/dist/assistant-context/index.js +1 -1
  2. package/dist/assistant-protocol/index.js +62 -59
  3. package/dist/briefings/index.js +1 -1
  4. package/dist/chunks/{model-change-T1cRkh3m.js → add-to-dashboard-B6Ah8Lub.js} +121 -84
  5. package/dist/chunks/{assistant-chat-DF1-q82n.js → assistant-chat-D95DtCj7.js} +2411 -2313
  6. package/dist/chunks/{bookmark-impact-fdj8fY9i.js → bookmark-impact-DUWw3wlA.js} +1 -1
  7. package/dist/chunks/{card-filter-builder-BFT21WI-.js → card-filter-builder-B3bEPylu.js} +54 -54
  8. package/dist/chunks/{dashboard-jUhZ7T4f.js → dashboard-DdALjmc3.js} +1 -1
  9. package/dist/chunks/{dashboard-briefing-launcher-DDXzTYuA.js → dashboard-briefing-launcher-D2vevpyl.js} +82 -82
  10. package/dist/chunks/{dashboard-controls-BwKQEoGp.js → dashboard-controls-DxrsGK9A.js} +7 -7
  11. package/dist/chunks/{dashboard-json-B3fR1_Oc.js → dashboard-json-rwds0HjB.js} +1 -1
  12. package/dist/chunks/{dates-DKkSDWHe.js → dates-DlYMDaF2.js} +4 -4
  13. package/dist/chunks/{edit-dashboard-visual-DGZABdS-.js → edit-dashboard-visual-BCDz5HOb.js} +1354 -1317
  14. package/dist/chunks/{filter-reach-copy-CWHV7GSb.js → filter-reach-copy-BTAXnbwQ.js} +2 -2
  15. package/dist/chunks/{index-CeeY4wjE.js → index-8BxDk8EP.js} +1 -1
  16. package/dist/chunks/{report-preferences-dialog-R3EGbxfu.js → report-preferences-dialog-D9nBczmk.js} +7 -7
  17. package/dist/chunks/{resolve-dashboard-input-context-CBQF3obr.js → resolve-dashboard-input-context-DBFuNhZo.js} +3961 -3923
  18. package/dist/chunks/{saved-dashboard-context-_-7LKeK1.js → saved-dashboard-context-AChHk4tw.js} +2 -2
  19. package/dist/chunks/{semaphor-ready-indicator-CEbA4CFb.js → semaphor-ready-indicator-BdOAS4Uw.js} +23554 -23073
  20. package/dist/chunks/{shelf-drop-preview-context-UqUUVSJq.js → shelf-drop-preview-context-B1goDUYE.js} +2 -2
  21. package/dist/chunks/{stored-dashboard-Bk3iCXtp.js → stored-dashboard-rpLzf4mk.js} +112 -112
  22. package/dist/chunks/{variable-draft-ggS3X7FG.js → variable-draft-DPSMDwqt.js} +2 -2
  23. package/dist/dashboard/index.js +1 -1
  24. package/dist/dashboard-authoring/index.js +1381 -1368
  25. package/dist/index.js +11 -11
  26. package/dist/style.css +1 -1
  27. package/dist/surfboard/index.js +1 -1
  28. package/dist/types/components/dashboard/summary-card.d.ts +5 -0
  29. package/dist/types/lib/formatters/kpi-number-formatter.d.ts +12 -0
  30. package/dist/types/lib/types/explorer-types.d.ts +6 -0
  31. package/dist/types/shared/assistant-protocol/model-change.d.ts +52 -1
  32. package/dist/types/shared/assistant-protocol/parts.d.ts +49 -2
  33. package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +5 -0
  34. package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
  35. package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +2 -0
  36. package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +2 -0
  37. package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +1 -0
  38. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +4 -0
  39. package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +38 -0
  40. package/package.json +1 -1
@@ -1,36 +1,36 @@
1
1
  var _s = Object.defineProperty;
2
2
  var Cs = (e, a, t) => a in e ? _s(e, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[a] = t;
3
3
  var lt = (e, a, t) => Cs(e, typeof a != "symbol" ? a + "" : a, t);
4
- import { _ as $s, $ as ws, a0 as xs, a1 as Ss, a2 as ks, a3 as qa, a4 as $e, a5 as Ts, a6 as he, a7 as Ee, a8 as la, a9 as ot, aa as Na, ab as Q, ac as G, ad as qe, ae as Fs, af as Rs, ag as At, ah as As, ai as Ds, aj as Os, ak as Es, al as Pa, am as qs, an as Ns, ao as Ps, ap as Ls, aq as Ms, ar as Bs, as as Vs, at as ca, au as La, av as ua, aw as Ce, ax as be, ay as Ne, az as js, aA as Ks, aB as Ws, o as Xe, aC as Us, aD as Gs, aE as _t, aF as Ze, aG as Qs, aH as Hs, aI as Ma, aJ as Dt, aK as Ct, aL as zs, aM as Ys, aN as Js, aO as ie, aP as Ba, aQ as Va, aR as ct, aS as Xs, aT as Zs, aU as fa, aV as $t, aW as eo, aX as ma, aY as to, aZ as ha, a_ as pa, a$ as et, b0 as ga, b1 as Ae, b2 as ao, b3 as He, m as so, b4 as ja, b5 as oo, b6 as no, b7 as io, b8 as Ka, a as ro, b9 as lo, ba as co, bb as uo, bc as fo, bd as mo, be as ho, bf as po, bg as go, bh as bo, bi as yo, bj as vo, bk as ba, bl as Io, bm as _o, bn as Co, bo as $o, bp as wo, bq as xo, br as So, bs as ko, bt as To, bu as Fo, bv as Ro, bw as Ao } from "../chunks/resolve-dashboard-input-context-CBQF3obr.js";
5
- import { dA as Mr, bO as Br, dc as Vr, dd as jr, ds as Kr, dr as Wr, dl as Ur, eo as Gr, dt as Qr, du as Hr, cS as zr, cT as Yr, cU as Jr, cP as Xr, cQ as Zr, cR as ed, cL as td, cM as ad, cO as sd, cN as od, cV as nd, dR as id, de as rd, ca as dd, dU as ld, c9 as cd, d6 as ud, dC as fd, cj as md, eq as hd, c0 as pd, dF as gd, dV as bd, eJ as yd, eN as vd, dp as Id, dq as _d, cg as Cd, bK as $d, eE as wd, dE as xd, cm as Sd, dL as kd, cf as Td, eU as Fd, eV as Rd, ed as Ad, dD as Dd, ew as Od, eZ as Ed, cD as qd, eO as Nd, dk as Pd, ch as Ld, e1 as Md, e2 as Bd, cW as Vd, cE as jd, dT as Kd, bE as Wd, eb as Ud, dH as Gd, ex as Qd, bF as Hd, bN as zd, dY as Yd, cy as Jd, eX as Xd, ee as Zd, dK as el, ec as tl, d5 as al, d4 as sl, ce as ol, dS as nl, bY as il, c2 as rl, dQ as dl, cv as ll, bC as cl, eP as ul, cn as fl, e7 as ml, bG as hl, ef as pl, eF as gl, dy as bl, dz as yl, e_ as vl, e$ as Il, f1 as _l, bZ as Cl, b_ as $l, b$ as wl, ci as xl, ck as Sl, eW as kl, el as Tl, d9 as Fl, f as Rl, cK as Al, c7 as Dl, cs as Ol, b as El, cH as ql, da as Nl, bQ as Pl, bR as Ll, dJ as Ml, c6 as Bl, d_ as Vl, co as jl, bx as Kl, cb as Wl, dm as Ul, bU as Gl, dx as Ql, c1 as Hl, d0 as zl, f0 as Yl, bL as Jl, d2 as Xl, d$ as Zl, d3 as ec, e3 as tc, es as ac, dN as sc, cA as oc, cr as nc, ct as ic, l as rc, cu as dc, ej as lc, dv as cc, dI as uc, by as fc, bz as mc, bA as hc, bH as pc, eL as gc, eG as bc, dB as yc, eH as vc, cx as Ic, cc as _c, cG as Cc, dw as $c, ei as wc, d7 as xc, d8 as Sc, bP as kc, eY as Tc, dG as Fc, eg as Rc, db as Ac, ev as Dc, J as Oc, eK as Ec, c5 as qc, eQ as Nc, eR as Pc, di as Lc, cJ as Mc, bT as Bc, dM as Vc, bB as jc, cB as Kc, cC as Wc, cd as Uc, cY as Gc, bX as Qc, c3 as Hc, c4 as zc, df as Yc, dg as Jc, c8 as Xc, bI as Zc, bW as eu, c_ as tu, er as au, en as su, eS as ou, c$ as nu, cZ as iu, bS as ru, ep as du, cz as lu, em as cu, cI as uu, e0 as fu, dh as mu, cw as hu, dn as pu, bD as gu, bV as bu, dO as yu, eu as vu, dZ as Iu, cF as _u, d1 as Cu, bM as $u, dP as wu, dX as xu, dW as Su, ek as ku, et as Tu, cl as Fu, cq as Ru, bJ as Au, eM as Du, eI as Ou, eT as Eu, cX as qu, eh as Nu, ea as Pu, dj as Lu, e9 as Mu, ez as Bu, e6 as Vu, e8 as ju, cp as Ku, e4 as Wu, e5 as Uu, ey as Gu, eA as Qu, eB as Hu, eC as zu, eD as Yu } from "../chunks/resolve-dashboard-input-context-CBQF3obr.js";
6
- import { K as Do, L as Wa, G as Ua, M as Oo, N as Eo, O as Ot, P as Ga, Q as Qa, A as we, R as qo, S as No, H as Po, T as Lo } from "../chunks/bookmark-state-BEl_G9vr.js";
7
- import { ae as Xu, ay as Zu, Y as ef, Z as tf, a8 as af, ac as sf, a9 as of, aa as nf, ab as rf, af as df, aw as lf, aq as cf, D as uf, au as ff, F as mf, a1 as hf, I as pf, ax as gf, a4 as bf, a5 as yf, as as vf, ad as If, a2 as _f, ao as Cf, at as $f, av as wf, ap as xf, ar as Sf, a0 as kf, _ as Tf, ah as Ff, am as Rf, W as Af, X as Df, U as Of, a3 as Ef, an as qf, az as Nf, ai as Pf, ag as Lf, aj as Mf, ak as Bf, al as Vf, a7 as jf, a6 as Kf, $ as Wf } from "../chunks/bookmark-state-BEl_G9vr.js";
8
- import { L as Gf, G as Qf, H as Hf, g as zf, F as Yf, q as Jf, A as Xf, D as Zf, u as em, v as tm, E as am, C as sm, s as om, t as nm, p as im, B as rm, I as dm, w as lm, y as cm, x as um, z as fm } from "../chunks/stored-dashboard-Bk3iCXtp.js";
9
- import { r as Mo, a4 as ya, aC as Bo } from "../chunks/temporal-input-presentation-CqbJjIuu.js";
10
- import { aF as hm, aE as pm, az as gm, aD as bm, aG as ym, at as vm } from "../chunks/temporal-input-presentation-CqbJjIuu.js";
11
- import { f as Vo, w as jo, D as va, r as Ko } from "../chunks/metric-comparison-n9NsIa-2.js";
12
- import { p as Wo } from "../chunks/report-runtime-context-BhPzLTbS.js";
13
- import { r as Ha, D as Ia, f as Uo, h as za, i as Go, j as Qo, k as Ho, e as wt, l as zo, v as Yo } from "../chunks/filter-reach-copy-CWHV7GSb.js";
14
- import { N as _m, R as Cm, n as $m, q as wm, u as xm, t as Sm, F as km, B as Tm, m as Fm, p as Rm, I as Am, O as Dm, P as Om, C as Em, K as qm, E as Nm, w as Pm, x as Lm, z as Mm, o as Bm, y as Vm, Q as jm, M as Km, L as Wm, G as Um, H as Gm, s as Qm, J as Hm, A as zm } from "../chunks/filter-reach-copy-CWHV7GSb.js";
15
- import { a7 as Ya, r as Ja, aN as Jo, a_ as Pe, aL as Xo, aQ as Zo, aK as en, aE as tn, aM as an, a5 as sn } from "../chunks/validators-B8fpdinG.js";
4
+ import { _ as $s, $ as ws, a0 as xs, a1 as Ss, a2 as ks, a3 as qa, a4 as $e, a5 as Ts, a6 as he, a7 as Ee, a8 as la, a9 as ot, aa as Na, ab as Q, ac as G, ad as qe, ae as Rs, af as Fs, ag as At, ah as As, ai as Ds, aj as Os, ak as Es, al as qs, am as Pa, an as Ns, ao as Ps, ap as Ls, aq as Ms, ar as Bs, as as Vs, at as js, au as ca, av as La, aw as ua, ax as Ce, ay as be, az as Ne, aA as Ks, aB as Ws, aC as Us, o as Xe, aD as Gs, aE as Qs, aF as _t, aG as Ze, aH as Hs, aI as zs, aJ as Ma, aK as Dt, aL as Ct, aM as Ys, aN as Js, aO as Xs, aP as ie, aQ as Ba, aR as Va, aS as ct, aT as Zs, aU as eo, aV as fa, aW as $t, aX as to, aY as ma, aZ as ao, a_ as ha, a$ as pa, b0 as et, b1 as ga, b2 as Ae, b3 as so, b4 as He, m as oo, b5 as ja, b6 as no, b7 as io, b8 as ro, b9 as Ka, a as lo, ba as co, bb as uo, bc as fo, bd as mo, be as ho, bf as po, bg as go, bh as bo, bi as yo, bj as vo, bk as Io, bl as ba, bm as _o, bn as Co, bo as $o, bp as wo, bq as xo, br as So, bs as ko, bt as To, bu as Ro, bv as Fo, bw as Ao, bx as Do } from "../chunks/resolve-dashboard-input-context-DBFuNhZo.js";
5
+ import { dB as Br, bP as Vr, dd as jr, de as Kr, dt as Wr, ds as Ur, dm as Gr, eq as Qr, du as Hr, dv as zr, cT as Yr, cU as Jr, cV as Xr, cQ as Zr, cR as ed, cS as td, cM as ad, cN as sd, cP as od, cO as nd, cW as id, dS as rd, df as dd, cb as ld, dW as cd, ca as ud, d7 as fd, dD as md, ck as hd, es as pd, eu as gd, c1 as bd, dV as yd, dG as vd, dX as Id, eN as _d, eR as Cd, dq as $d, dr as wd, ch as xd, bL as Sd, eI as kd, dF as Td, cn as Rd, dM as Fd, cg as Ad, eY as Dd, eZ as Od, ef as Ed, dE as qd, eA as Nd, f1 as Pd, cE as Ld, eS as Md, dl as Bd, ci as Vd, e3 as jd, e4 as Kd, cX as Wd, cF as Ud, dU as Gd, bF as Qd, ed as Hd, dI as zd, eB as Yd, bG as Jd, bO as Xd, d_ as Zd, cz as el, e$ as tl, eg as al, dL as sl, ee as ol, d6 as nl, d5 as il, cf as rl, dT as dl, bZ as ll, c3 as cl, dR as ul, cw as fl, bD as ml, eT as hl, co as pl, e9 as gl, bH as bl, eh as yl, eJ as vl, dz as Il, dA as _l, f2 as Cl, f3 as $l, f5 as wl, b_ as xl, b$ as Sl, c0 as kl, cj as Tl, cl as Rl, e_ as Fl, en as Al, da as Dl, f as Ol, cL as El, c8 as ql, ct as Nl, b as Pl, cI as Ll, db as Ml, bR as Bl, bS as Vl, dK as jl, c7 as Kl, e0 as Wl, cp as Ul, by as Gl, cc as Ql, dn as Hl, bV as zl, dy as Yl, c2 as Jl, d1 as Xl, f4 as Zl, bM as ec, d3 as tc, e1 as ac, d4 as sc, e5 as oc, ew as nc, ev as ic, dO as rc, cB as dc, cs as lc, cu as cc, l as uc, cv as fc, el as mc, dw as hc, dJ as pc, bz as gc, bA as bc, bB as yc, bI as vc, eP as Ic, eK as _c, dC as Cc, eL as $c, cy as wc, cd as xc, cH as Sc, dx as kc, ek as Tc, d8 as Rc, d9 as Fc, bQ as Ac, f0 as Dc, dH as Oc, ei as Ec, dc as qc, ez as Nc, J as Pc, eO as Lc, c6 as Mc, eU as Bc, eV as Vc, dj as jc, cK as Kc, bU as Wc, dN as Uc, bC as Gc, cC as Qc, cD as Hc, ce as zc, cZ as Yc, bY as Jc, c4 as Xc, c5 as Zc, dg as eu, dh as tu, c9 as au, bJ as su, bX as ou, c$ as nu, et as iu, ep as ru, eW as du, d0 as lu, c_ as cu, bT as uu, er as fu, cA as mu, eo as hu, cJ as pu, e2 as gu, di as bu, cx as yu, dp as vu, bE as Iu, bW as _u, dP as Cu, ey as $u, d$ as wu, cG as xu, d2 as Su, bN as ku, dQ as Tu, dZ as Ru, dY as Fu, em as Au, ex as Du, cm as Ou, cr as Eu, bK as qu, eQ as Nu, eM as Pu, eX as Lu, cY as Mu, ej as Bu, ec as Vu, dk as ju, eb as Ku, eD as Wu, e8 as Uu, ea as Gu, cq as Qu, e6 as Hu, e7 as zu, eC as Yu, eE as Ju, eF as Xu, eG as Zu, eH as ef } from "../chunks/resolve-dashboard-input-context-DBFuNhZo.js";
6
+ import { K as Oo, L as Wa, G as Ua, M as Eo, N as qo, O as Ot, P as Ga, Q as Qa, A as we, R as No, S as Po, H as Lo, T as Mo } from "../chunks/bookmark-state-BEl_G9vr.js";
7
+ import { ae as af, ay as sf, Y as of, Z as nf, a8 as rf, ac as df, a9 as lf, aa as cf, ab as uf, af as ff, aw as mf, aq as hf, D as pf, au as gf, F as bf, a1 as yf, I as vf, ax as If, a4 as _f, a5 as Cf, as as $f, ad as wf, a2 as xf, ao as Sf, at as kf, av as Tf, ap as Rf, ar as Ff, a0 as Af, _ as Df, ah as Of, am as Ef, W as qf, X as Nf, U as Pf, a3 as Lf, an as Mf, az as Bf, ai as Vf, ag as jf, aj as Kf, ak as Wf, al as Uf, a7 as Gf, a6 as Qf, $ as Hf } from "../chunks/bookmark-state-BEl_G9vr.js";
8
+ import { L as Yf, G as Jf, H as Xf, g as Zf, F as em, q as tm, A as am, D as sm, u as om, v as nm, E as im, C as rm, s as dm, t as lm, p as cm, B as um, I as fm, w as mm, y as hm, x as pm, z as gm } from "../chunks/stored-dashboard-rpLzf4mk.js";
9
+ import { r as Bo, a4 as ya, aC as Vo } from "../chunks/temporal-input-presentation-CqbJjIuu.js";
10
+ import { aF as ym, aE as vm, az as Im, aD as _m, aG as Cm, at as $m } from "../chunks/temporal-input-presentation-CqbJjIuu.js";
11
+ import { f as jo, w as Ko, D as va, r as Wo } from "../chunks/metric-comparison-n9NsIa-2.js";
12
+ import { p as Uo } from "../chunks/report-runtime-context-BhPzLTbS.js";
13
+ import { r as Ha, D as Ia, f as Go, h as za, i as Qo, j as Ho, k as zo, e as wt, l as Yo, v as Jo } from "../chunks/filter-reach-copy-BTAXnbwQ.js";
14
+ import { N as xm, R as Sm, n as km, q as Tm, u as Rm, t as Fm, F as Am, B as Dm, m as Om, p as Em, I as qm, O as Nm, P as Pm, C as Lm, K as Mm, E as Bm, w as Vm, x as jm, z as Km, o as Wm, y as Um, Q as Gm, M as Qm, L as Hm, G as zm, H as Ym, s as Jm, J as Xm, A as Zm } from "../chunks/filter-reach-copy-BTAXnbwQ.js";
15
+ import { a7 as Ya, r as Ja, aN as Xo, a_ as Pe, aL as Zo, aQ as en, aK as tn, aE as an, aM as sn, a5 as on } from "../chunks/validators-B8fpdinG.js";
16
16
  import "../chunks/schema-C9NPiIru.js";
17
- import { i as Xa, C as je, D as on, e as nn, b as rn } from "../chunks/edit-9df1zOWe.js";
17
+ import { i as Xa, C as je, D as nn, e as rn, b as dn } from "../chunks/edit-9df1zOWe.js";
18
18
  import "../chunks/matrix-operation-contract-DCVinw1o.js";
19
- import { A as Me, B as ze, z as dn, f as ln, y as Et, t as xe, e as cn } from "../chunks/analytics-base-schemas-BaIQrEzX.js";
20
- import { y as _a, C as un } from "../chunks/matrix-analytical-definition-dkS8szLM.js";
19
+ import { A as Me, B as ze, z as ln, f as cn, y as Et, t as xe, e as un } from "../chunks/analytics-base-schemas-BaIQrEzX.js";
20
+ import { y as _a, C as fn } from "../chunks/matrix-analytical-definition-dkS8szLM.js";
21
21
  import "zod";
22
22
  import "../value-format-preferences/index.js";
23
- import { C as Jm, a as Xm, S as Zm } from "../chunks/pickers-DkqmtnTL.js";
24
- import { r as fn } from "../chunks/index-CV_Kzou0.js";
23
+ import { C as th, a as ah, S as sh } from "../chunks/pickers-DkqmtnTL.js";
24
+ import { r as mn } from "../chunks/index-CV_Kzou0.js";
25
25
  import "../chunks/context-R31TSL5V.js";
26
- import { v as Ye, a as mn, i as Ca, o as ut, d as hn, b as pn, c as gn } from "../chunks/variable-draft-ggS3X7FG.js";
27
- import { S as th, f as ah, g as sh, e as oh, n as nh } from "../chunks/variable-draft-ggS3X7FG.js";
28
- import { r as rh, a as dh } from "../chunks/dates-DKkSDWHe.js";
29
- import { b as ch, d as uh } from "../chunks/bookmark-impact-fdj8fY9i.js";
30
- import { r as ye, b as bn, s as yn, a as vn } from "../chunks/resolver-DG_tfEpt.js";
31
- import { n as In, r as _n } from "../chunks/index-BVKzKl5d.js";
32
- import { e as mh } from "../chunks/brand-BoUV0iHF.js";
33
- const xr = [
26
+ import { v as Ye, a as hn, i as Ca, o as ut, d as pn, b as gn, c as bn } from "../chunks/variable-draft-DPSMDwqt.js";
27
+ import { S as nh, f as ih, g as rh, e as dh, n as lh } from "../chunks/variable-draft-DPSMDwqt.js";
28
+ import { r as uh, a as fh } from "../chunks/dates-DlYMDaF2.js";
29
+ import { b as hh, d as ph } from "../chunks/bookmark-impact-DUWw3wlA.js";
30
+ import { r as ye, b as yn, s as vn, a as In } from "../chunks/resolver-DG_tfEpt.js";
31
+ import { n as _n, r as Cn } from "../chunks/index-BVKzKl5d.js";
32
+ import { e as bh } from "../chunks/brand-BoUV0iHF.js";
33
+ const Sr = [
34
34
  "cardType",
35
35
  "sql",
36
36
  "python",
@@ -46,7 +46,7 @@ const xr = [
46
46
  "globalDateComparison",
47
47
  "calendarContext",
48
48
  "sqlRowLimit"
49
- ], Sr = [
49
+ ], kr = [
50
50
  "cardId",
51
51
  "cardTitle",
52
52
  "cache_config",
@@ -70,10 +70,10 @@ function ve(e) {
70
70
  function Ke(e) {
71
71
  return typeof e == "string" ? e : "";
72
72
  }
73
- function Cn(e, a = {}) {
73
+ function $n(e, a = {}) {
74
74
  const t = ve(e), s = qt(a), n = {};
75
75
  if (t.calendarContext !== void 0) {
76
- const i = Wo(t.calendarContext);
76
+ const i = Uo(t.calendarContext);
77
77
  if (!i.ok)
78
78
  throw new ce(
79
79
  `${s}calendarContext: ${i.issues.map((d) => d.message).join("; ")}`,
@@ -90,20 +90,20 @@ function Cn(e, a = {}) {
90
90
  o.issues
91
91
  );
92
92
  if (t.resolvedPrimaryDateField && (n.resolvedPrimaryDateField = t.resolvedPrimaryDateField), t.globalDateComparison !== void 0) {
93
- const i = Vo(t.globalDateComparison);
93
+ const i = jo(t.globalDateComparison);
94
94
  if (!i.ok)
95
95
  throw new ce(
96
96
  `${s}Invalid globalDateComparison: ${i.errors.map((d) => `${d.path}: ${d.message}`).join("; ")}`,
97
97
  "globalDateComparison",
98
98
  i.errors
99
99
  );
100
- n.globalDateComparison = jo(
100
+ n.globalDateComparison = Ko(
101
101
  t.globalDateComparison
102
102
  );
103
103
  }
104
104
  return n;
105
105
  }
106
- function kr(e, a = {}) {
106
+ function Tr(e, a = {}) {
107
107
  const t = ve(e), s = qt(a), n = {};
108
108
  if (t.pagination !== void 0) {
109
109
  const o = ve(t.pagination), i = o.page, d = o.pageSize;
@@ -135,7 +135,7 @@ function kr(e, a = {}) {
135
135
  }
136
136
  return n;
137
137
  }
138
- function Tr(e, a = {}) {
138
+ function Rr(e, a = {}) {
139
139
  const t = ve(e), s = qt(a), n = (x) => new ce(`${s}${x} is required`, x), o = Ke(t.connection_id).trim();
140
140
  if (!o) throw n("connection_id");
141
141
  const i = Ke(t.cardType).trim();
@@ -146,19 +146,19 @@ function Tr(e, a = {}) {
146
146
  const l = ve(t.cardConfig), c = Ke(t.sql), h = Ke(t.python), p = !!a.configOptional || Object.keys(l).length > 0;
147
147
  if (d === "config" && !p) throw n("cardConfig");
148
148
  if (d === "freeform" && !c.trim()) throw n("sql");
149
- const y = xs({
149
+ const v = xs({
150
150
  hasExecutableConfig: p,
151
151
  sql: c,
152
152
  normalizedPython: h
153
153
  });
154
- if (d !== y)
154
+ if (d !== v)
155
155
  throw new ce(
156
- `${s}resultOwner must match the normalized execution owner "${y}"`,
156
+ `${s}resultOwner must match the normalized execution owner "${v}"`,
157
157
  "resultOwner"
158
158
  );
159
159
  if (d === "none") throw n("cardConfig");
160
- const v = ve(t.cardDataSource);
161
- if (Object.keys(v).length === 0) throw n("cardDataSource");
160
+ const I = ve(t.cardDataSource);
161
+ if (Object.keys(I).length === 0) throw n("cardDataSource");
162
162
  const w = Ss({
163
163
  controlValues: t.controlValues,
164
164
  controlDefinitions: t.controlDefinitions,
@@ -172,17 +172,17 @@ function Tr(e, a = {}) {
172
172
  python: h,
173
173
  resultOwner: d,
174
174
  cardConfig: l,
175
- cardDataSource: v,
175
+ cardDataSource: I,
176
176
  active_filters: Array.isArray(t.active_filters) ? t.active_filters : [],
177
177
  controlValues: w.controlValues,
178
178
  controlDefinitions: w.controlDefinitions,
179
179
  cardControlDefinitions: w.cardControlDefinitions,
180
180
  controlBindings: w.controlBindings,
181
- ...Cn(t, a),
181
+ ...$n(t, a),
182
182
  ...typeof t.sqlRowLimit == "number" && Number.isInteger(t.sqlRowLimit) && t.sqlRowLimit > 0 ? { sqlRowLimit: t.sqlRowLimit } : {}
183
183
  };
184
184
  }
185
- const ft = ["#14b8a6", "#5eead4", "#374151", "#6b7280", "#d1d5db"], $n = ["spacing", "canvasPadding", "canvas", "cardCorners", "chartColors"], Za = ["light", "dark"];
185
+ const ft = ["#14b8a6", "#5eead4", "#374151", "#6b7280", "#d1d5db"], wn = ["spacing", "canvasPadding", "canvas", "cardCorners", "chartColors"], Za = ["light", "dark"];
186
186
  function Fr(e) {
187
187
  const a = [], t = ht(e.globalStyle) ? e.globalStyle : {}, s = ht(t.default) ? t.default : {}, n = ht(t.dark) ? t.dark : {}, o = (p) => ye(n, p) ?? ye(s, p), i = {}, d = o(["gridLayout", "margin"]);
188
188
  Array.isArray(d) && typeof d[1] == "number" && (i.spacing = De("spacing", d[1], a), i.canvasPadding = De("canvasPadding", d[1], a));
@@ -193,34 +193,34 @@ function Fr(e) {
193
193
  const h = o(["chart", "options", "borderRadius"]);
194
194
  typeof h == "number" && (i.barCorners = De("barCorners", h, a));
195
195
  for (const p of Za) {
196
- const y = p === "light" ? ye(s, ["canvasTheme"]) : o(["canvasTheme"]), v = Sn(y, a);
197
- v !== void 0 && (i.canvas = { ...i.canvas, [p]: v });
198
- const w = xn(s, n, p);
196
+ const v = p === "light" ? ye(s, ["canvasTheme"]) : o(["canvasTheme"]), I = kn(v, a);
197
+ I !== void 0 && (i.canvas = { ...i.canvas, [p]: I });
198
+ const w = Sn(s, n, p);
199
199
  if (w) {
200
- const x = w.filter(Xa).map((q) => q.toLowerCase());
200
+ const x = w.filter(Xa).map((E) => E.toLowerCase());
201
201
  x.length < w.length && a.push({ field: "chartColors", kind: "dropped_colour", detail: `${p}: ${w.length - x.length} colours that aren't hex` }), x.length >= je.min && (i.chartColors = { ...i.chartColors, [p]: x.slice(0, je.max) }), x.length > je.max && a.push({ field: "chartColors", kind: "clamped", detail: `${p}: kept the first ${je.max} colours` });
202
202
  }
203
203
  }
204
- return { style: wn(i, e.organizationAppearance, a), notes: a };
204
+ return { style: xn(i, e.organizationAppearance, a), notes: a };
205
205
  }
206
- function wn(e, a, t) {
207
- const s = bn({ organizationAppearance: a ? In(a).spec : null }), n = { ...e };
206
+ function xn(e, a, t) {
207
+ const s = yn({ organizationAppearance: a ? _n(a).spec : null }), n = { ...e };
208
208
  for (const o of Object.keys(e)) {
209
- const i = vn[o], d = o === "canvas" || o === "chartColors";
209
+ const i = In[o], d = o === "canvas" || o === "chartColors";
210
210
  for (const l of Za) {
211
- const c = yn(n, o, l);
211
+ const c = vn(n, o, l);
212
212
  if (c === void 0) continue;
213
- const h = $n.includes(o) && ye(_n(a, l), i) !== void 0, p = JSON.stringify(ye(s.schemes[l], i)) === JSON.stringify(c);
213
+ const h = wn.includes(o) && ye(Cn(a, l), i) !== void 0, p = JSON.stringify(ye(s.schemes[l], i)) === JSON.stringify(c);
214
214
  if (!(!h && !p))
215
215
  if ((d || l === "light") && t.push({ field: o, kind: h ? "brand_wins" : "equal_to_inherited", detail: d ? l : `${JSON.stringify(c)}` }), d) {
216
- const y = { ...n[o] };
217
- delete y[l], Object.keys(y).length > 0 ? n[o] = y : delete n[o];
216
+ const v = { ...n[o] };
217
+ delete v[l], Object.keys(v).length > 0 ? n[o] = v : delete n[o];
218
218
  } else l === "light" && delete n[o];
219
219
  }
220
220
  }
221
221
  return Object.keys(n).length > 0 ? n : void 0;
222
222
  }
223
- function xn(e, a, t) {
223
+ function Sn(e, a, t) {
224
224
  const s = ye(e, ["chart", "dataset", "backgroundColor"]), n = ye(a, ["chart", "dataset", "backgroundColor"]), o = mt(ft, s);
225
225
  if (t === "light") return Array.isArray(s) ? o : void 0;
226
226
  const i = mt(o, mt(ft, n));
@@ -232,7 +232,7 @@ function mt(e, a) {
232
232
  const t = Math.max(e.length, a.length);
233
233
  return Array.from({ length: t }, (s, n) => a[n] !== void 0 ? String(a[n]) : e[n]);
234
234
  }
235
- function Sn(e, a) {
235
+ function kn(e, a) {
236
236
  if (!(e == null || e === "")) {
237
237
  if (e === "muted") return "muted";
238
238
  if (e === "clear") return "background";
@@ -241,7 +241,7 @@ function Sn(e, a) {
241
241
  }
242
242
  }
243
243
  function De(e, a, t) {
244
- const { min: s, max: n } = on[e], o = Math.min(n, Math.max(s, Math.round(a)));
244
+ const { min: s, max: n } = nn[e], o = Math.min(n, Math.max(s, Math.round(a)));
245
245
  return o !== a && t.push({ field: e, kind: "clamped", detail: `${a} → ${o}` }), o;
246
246
  }
247
247
  function ht(e) {
@@ -258,21 +258,21 @@ const pt = {
258
258
  chartColors: (e, a) => a.chartColors = e,
259
259
  barCorners: (e, a) => a.barCorners = e
260
260
  };
261
- function kn(e) {
261
+ function Tn(e) {
262
262
  var t;
263
263
  const a = {};
264
264
  for (const [s, n] of Object.entries(e ?? {}))
265
265
  n !== void 0 && ((t = pt[s]) == null || t.call(pt, n, a));
266
266
  return a;
267
267
  }
268
- const Tn = {
268
+ const Rn = {
269
269
  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.",
270
270
  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.",
271
271
  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."
272
272
  };
273
273
  function Fn(e, a, t = {}) {
274
274
  var d;
275
- const s = $e(e), n = Do(a.scope), o = new Set(Wa(e).map((l) => l.id)), i = {
275
+ const s = $e(e), n = Oo(a.scope), o = new Set(Wa(e).map((l) => l.id)), i = {
276
276
  reaches: [],
277
277
  excluded: [
278
278
  .../* @__PURE__ */ new Set([
@@ -292,11 +292,11 @@ function Fn(e, a, t = {}) {
292
292
  }
293
293
  for (const l of s.reachedCards({ inputId: a.id })) {
294
294
  const c = Ee(a, l.card, t), h = c.reach, p = () => {
295
- const y = he(l.card);
295
+ const v = he(l.card);
296
296
  return {
297
297
  cardId: l.cardId,
298
298
  title: l.card.title ?? "",
299
- ...(y == null ? void 0 : y.kind) === "semantic" ? { datasetName: y.datasetName } : {}
299
+ ...(v == null ? void 0 : v.kind) === "semantic" ? { datasetName: v.datasetName } : {}
300
300
  };
301
301
  };
302
302
  switch (h) {
@@ -322,15 +322,15 @@ function Fn(e, a, t = {}) {
322
322
  he(l.card) && i.notReached.push({ ...p(), ...c.reason ? { reason: c.reason } : {} });
323
323
  break;
324
324
  default: {
325
- const y = h;
326
- throw new Error(`Unhandled filter reach ${String(y)}`);
325
+ const v = h;
326
+ throw new Error(`Unhandled filter reach ${String(v)}`);
327
327
  }
328
328
  }
329
329
  }
330
330
  for (const l of s.reachedVariables({ inputId: a.id })) {
331
331
  const c = Ua(e, l.variableId);
332
332
  if ((c == null ? void 0 : c.kind) !== "variable") continue;
333
- const h = Ee(a, c.card, t), p = he(c.card), y = { cardId: c.id, title: c.variable.name, ...(p == null ? void 0 : p.kind) === "semantic" ? { datasetName: p.datasetName } : {} };
333
+ const h = Ee(a, c.card, t), p = he(c.card), v = { cardId: c.id, title: c.variable.name, ...(p == null ? void 0 : p.kind) === "semantic" ? { datasetName: p.datasetName } : {} };
334
334
  switch (h.reach) {
335
335
  case "bound":
336
336
  case "automatic":
@@ -343,7 +343,7 @@ function Fn(e, a, t = {}) {
343
343
  (i.blocked ?? (i.blocked = [])).push({ cardId: c.id, title: c.variable.name, reason: h.reach });
344
344
  break;
345
345
  case "relationship":
346
- (i.relationshipPending ?? (i.relationshipPending = [])).push(y);
346
+ (i.relationshipPending ?? (i.relationshipPending = [])).push(v);
347
347
  break;
348
348
  case "sqlTemplate":
349
349
  (i.sqlPending ?? (i.sqlPending = [])).push({ cardId: c.id, title: c.variable.name });
@@ -351,22 +351,22 @@ function Fn(e, a, t = {}) {
351
351
  case "excluded":
352
352
  break;
353
353
  case "notApplicable":
354
- i.notReached.push({ ...y, ...h.reason ? { reason: h.reason } : {} });
354
+ i.notReached.push({ ...v, ...h.reason ? { reason: h.reason } : {} });
355
355
  break;
356
356
  }
357
357
  }
358
358
  return i;
359
359
  }
360
- function Rn(e, a) {
360
+ function An(e, a) {
361
361
  var n;
362
362
  const t = a.scope;
363
363
  if (t.kind === "allSheets") {
364
364
  if ((n = t.sheetKinds) != null && n.length && !t.sheetKinds.includes("dashboard")) return;
365
- const o = Oo(t);
365
+ const o = Eo(t);
366
366
  return {
367
367
  sheetIds: "all",
368
368
  ...o.length ? { exceptSheetIds: [...o] } : {},
369
- ...Eo(t) ? { includesDocumentSheets: !0 } : {}
369
+ ...qo(t) ? { includesDocumentSheets: !0 } : {}
370
370
  };
371
371
  }
372
372
  if (t.kind !== "sheets") return;
@@ -381,13 +381,13 @@ function es(e, a) {
381
381
  return e ?? { tz: "UTC", weekStart: 1, anchor: { iso: a ?? "1970-01-01T00:00:00.000Z" } };
382
382
  }
383
383
  function ts(e, a, t, s) {
384
- var q, _, k;
385
- const { input: n } = a, o = Fn(e, n, s), i = (b, O) => ({
384
+ var E, _, S;
385
+ const { input: n } = a, o = Fn(e, n, s), i = (y, D) => ({
386
386
  filterId: n.id,
387
387
  label: n.label,
388
388
  editable: !1,
389
- kind: O,
390
- notEditable: { reason: b, message: Tn[b] },
389
+ kind: D,
390
+ notEditable: { reason: y, message: Rn[y] },
391
391
  reaches: o.reaches,
392
392
  excluded: o.excluded,
393
393
  ...o.blocked ? { blocked: o.blocked } : {},
@@ -395,15 +395,15 @@ function ts(e, a, t, s) {
395
395
  ...o.sqlPending ? { sqlPending: o.sqlPending } : {}
396
396
  });
397
397
  if (n.filter.kind === "global-date") return i("global_date", "global_date");
398
- const d = ks(n.filter).filter((b) => b.kind === "semantic");
398
+ const d = ks(n.filter).filter((y) => y.kind === "semantic");
399
399
  if (d.length !== 1 || d[0].kind !== "semantic") return i("not_semantic", "field");
400
- const l = Rn(e, n);
400
+ const l = An(e, n);
401
401
  if (!l || a.origin !== "embeddedInput") return i("scope_not_expressible", "field");
402
- const c = ((q = n.filter.fieldMeta) == null ? void 0 : q.name) ?? ((_ = n.filter.column) == null ? void 0 : _.split(".").pop()) ?? "", h = Ha({
402
+ const c = ((E = n.filter.fieldMeta) == null ? void 0 : E.name) ?? ((_ = n.filter.column) == null ? void 0 : _.split(".").pop()) ?? "", h = Ha({
403
403
  dashboard: e,
404
404
  target: { kind: "dashboardInput", input: n, scope: {} },
405
405
  calendar: es(t, void 0)
406
- }).value, p = Ya(n.filter.dataType), y = p || (k = h == null ? void 0 : h.values) == null ? void 0 : k.filter((b) => ["string", "number", "boolean"].includes(typeof b)), v = Ja(h && "relativeMeta" in h ? h.relativeMeta : void 0), w = p ? v : void 0, x = w ? Jo(
406
+ }).value, p = Ya(n.filter.dataType), v = p || (S = h == null ? void 0 : h.values) == null ? void 0 : S.filter((y) => ["string", "number", "boolean"].includes(typeof y)), I = Ja(h && "relativeMeta" in h ? h.relativeMeta : void 0), w = p ? I : void 0, x = w ? Xo(
407
407
  w,
408
408
  { use: "filterDefault", columnHasTime: qa(n.filter) === "datetime" },
409
409
  "defaultPeriod"
@@ -416,7 +416,7 @@ function ts(e, a, t, s) {
416
416
  datasetName: d[0].datasetName,
417
417
  field: c,
418
418
  selection: n.filter.type === "single" ? "single" : "multiple",
419
- ...y != null && y.length ? { defaultValues: y } : {},
419
+ ...v != null && v.length ? { defaultValues: v } : {},
420
420
  ...w ? { defaultPeriod: w } : {},
421
421
  ...x ? { defaultPeriodReadOnly: x } : {},
422
422
  ...p ? { datePicker: n.filter.dateSelectionMode === "day" ? "day" : n.filter.dateSelectionMode === "months" ? "month" : "range" } : {},
@@ -455,7 +455,7 @@ function ns(e) {
455
455
  field: s
456
456
  }));
457
457
  }
458
- function An(e) {
458
+ function Dn(e) {
459
459
  const a = os(e), t = /* @__PURE__ */ new Map();
460
460
  for (const { field: s } of ns(e)) {
461
461
  const n = ss(s, a);
@@ -463,14 +463,14 @@ function An(e) {
463
463
  }
464
464
  return [...t.values()];
465
465
  }
466
- function Dn(e, a, t) {
466
+ function On(e, a, t) {
467
467
  if (!t) return;
468
468
  const s = la(a), n = ns(e).find((d) => la(d.ref) === s);
469
469
  if (!n) return;
470
470
  const o = ss(n.field, os(e)), i = o ? t[Nt(o)] : void 0;
471
471
  return i ? ot(i, n.field.name, o.datasetName) : void 0;
472
472
  }
473
- const xt = ["orientation", "stack", "donut", "totals", "dataLabels", "legend", "axes", "comparisonDisplay", "inheritComparison"], On = {
473
+ const xt = ["orientation", "stack", "donut", "totals", "dataLabels", "legend", "axes", "comparisonDisplay", "inheritComparison", "band"], En = {
474
474
  orientation: "orientation",
475
475
  stack: "stacking",
476
476
  donut: "donut hole",
@@ -479,72 +479,80 @@ const xt = ["orientation", "stack", "donut", "totals", "dataLabels", "legend", "
479
479
  legend: "legend",
480
480
  axes: "axes",
481
481
  comparisonDisplay: "comparison display",
482
- inheritComparison: "dashboard comparison"
483
- }, En = { x: "xAxisConfig", y: "yAxisConfig" }, gt = { x: "horizontal", y: "vertical" };
484
- function qn(e) {
485
- const a = `${e.sql ? "SQL " : ""}${Os(e.type)}`;
482
+ inheritComparison: "dashboard comparison",
483
+ band: "band under its value"
484
+ }, qn = { x: "xAxisConfig", y: "yAxisConfig" }, gt = { x: "horizontal", y: "vertical" };
485
+ function Nn(e) {
486
+ const a = `${e.sql ? "SQL " : ""}${Es(e.type)}`;
486
487
  return `${/^[aeiou]/i.test(a) ? "an" : "a"} ${a}`;
487
488
  }
488
- function Nn(e, a, t) {
489
+ function Pn(e, a, t) {
489
490
  const s = Object.fromEntries(Object.entries(a).filter(([n, o]) => o !== void 0 && !t.includes(n)));
490
491
  return Object.keys(s).length ? { op: "card.update", cardId: e.cardRef, ...s } : void 0;
491
492
  }
492
- function Pn(e, a, t, s, n) {
493
- var v, w, x, q, _, k, b, O, $;
494
- const o = xt.filter((F) => t[F] !== void 0);
493
+ function Ln(e, a, t, s, n) {
494
+ var I, w, x, E, _, S, y, D, $, N;
495
+ const o = xt.filter((g) => t[g] !== void 0);
495
496
  if (!o.length) return {};
496
- const i = xt.filter((F) => a.settings.has(F)), d = o.filter((F) => !a.settings.has(F));
497
- for (const F of d)
497
+ const i = xt.filter((g) => a.settings.has(g)), d = o.filter((g) => !a.settings.has(g));
498
+ for (const g of d)
498
499
  n.push(
499
500
  Q("setting_not_for_card", {
500
- message: `${G(e.title)} is ${qn(a)}, which has no ${On[F]}.`,
501
- path: `${s.path}.${F}`,
502
- fix: i.length ? `Leave out ${F}; this card takes ${i.join(", ")}.` : `Leave out ${F}.`,
501
+ message: `${G(e.title)} is ${Nn(a)}, which has no ${En[g]}.`,
502
+ path: `${s.path}.${g}`,
503
+ fix: i.length ? `Leave out ${g}; this card takes ${i.join(", ")}.` : `Leave out ${g}.`,
503
504
  allowed: i,
504
- suggestedChange: Nn(s, t, d)
505
+ suggestedChange: Pn(s, t, d)
505
506
  })
506
507
  );
507
508
  if (d.length) return {};
508
- const l = {}, c = ((v = qe(e)) == null ? void 0 : v.properties) ?? {}, h = {
509
+ const l = {}, c = ((I = qe(e)) == null ? void 0 : I.properties) ?? {}, h = {
509
510
  ...c,
510
511
  ...t.orientation !== void 0 ? { orientation: t.orientation } : {},
511
512
  ...t.stack !== void 0 ? { stack: t.stack } : {},
512
513
  ...t.donut !== void 0 ? { donut: t.donut } : {}
513
514
  };
514
- ["orientation", "stack", "donut"].some((F) => h[F] !== c[F]) && (l.variant = Fs(a.type, h));
515
- const p = l.variant ? Rs(e, l.variant) : e, y = At(p);
516
- if (t.totals && t.totals.row !== (((w = y.totals) == null ? void 0 : w.row) ?? !1) && (l.totals = { row: t.totals.row }), t.dataLabels) {
517
- const F = {};
518
- t.dataLabels.show !== As(p) && (F.show = t.dataLabels.show);
519
- const I = t.dataLabels.format;
520
- if (I === null && ((x = y.dataLabels) != null && x.format) && (F.format = null), I) {
521
- const S = Ln(e, a, I, `${s.path}.dataLabels.format`, n);
522
- S && !Pe(S, (q = y.dataLabels) == null ? void 0 : q.format) && (F.format = S);
515
+ ["orientation", "stack", "donut"].some((g) => h[g] !== c[g]) && (l.variant = Rs(a.type, h));
516
+ const p = l.variant ? Fs(e, l.variant) : e, v = At(p);
517
+ if (t.totals && t.totals.row !== (((w = v.totals) == null ? void 0 : w.row) ?? !1) && (l.totals = { row: t.totals.row }), t.dataLabels) {
518
+ const g = {};
519
+ t.dataLabels.show !== As(p) && (g.show = t.dataLabels.show);
520
+ const k = t.dataLabels.format;
521
+ if (k === null && ((x = v.dataLabels) != null && x.format) && (g.format = null), k) {
522
+ const T = Mn(e, a, k, `${s.path}.dataLabels.format`, n);
523
+ T && !Pe(T, (E = v.dataLabels) == null ? void 0 : E.format) && (g.format = T);
523
524
  }
524
- Object.keys(F).length && (l.dataLabels = F);
525
+ Object.keys(g).length && (l.dataLabels = g);
525
526
  }
526
527
  if (t.legend) {
527
- const F = {};
528
- t.legend.show !== ((_ = y.legend) == null ? void 0 : _.show) && (F.show = t.legend.show), t.legend.position !== void 0 && t.legend.position !== ((k = y.legend) == null ? void 0 : k.position) && (F.position = t.legend.position), Object.keys(F).length && (l.legend = F);
528
+ const g = {};
529
+ t.legend.show !== ((_ = v.legend) == null ? void 0 : _.show) && (g.show = t.legend.show), t.legend.position !== void 0 && t.legend.position !== ((S = v.legend) == null ? void 0 : S.position) && (g.position = t.legend.position), Object.keys(g).length && (l.legend = g);
529
530
  }
530
531
  if (t.axes) {
531
- const F = Ds(p.type, p.preferences), I = {};
532
- for (const S of ["x", "y"]) {
533
- const A = t.axes[S];
534
- if (!A) continue;
535
- const L = Mn(e, S, A, ((b = y.axes) == null ? void 0 : b[S]) ?? {}, S === F, `${s.path}.axes.${S}`, n);
536
- L && (I[En[S]] = L);
532
+ const g = Ds(p.type, p.preferences), k = {};
533
+ for (const T of ["x", "y"]) {
534
+ const L = t.axes[T];
535
+ if (!L) continue;
536
+ const V = Bn(e, T, L, ((y = v.axes) == null ? void 0 : y[T]) ?? {}, T === g, `${s.path}.axes.${T}`, n);
537
+ V && (k[qn[T]] = V);
537
538
  }
538
- Object.keys(I).length && (l.axes = I);
539
+ Object.keys(k).length && (l.axes = k);
539
540
  }
540
541
  if (t.comparisonDisplay) {
541
- const F = (O = e.preferences) == null ? void 0 : O.comparisonPresentation, I = {}, { show: S, mode: A, precision: L } = t.comparisonDisplay;
542
- S !== void 0 && S !== ((F == null ? void 0 : F.showComparison) ?? !0) && (I.show = S), A !== void 0 && A !== ((F == null ? void 0 : F.displayMode) ?? "difference") && (I.mode = A), L !== void 0 && L !== ((F == null ? void 0 : F.precision) ?? null) && (I.precision = L), Object.keys(I).length && (l.comparisonDisplay = I);
543
- }
544
- return t.inheritComparison !== void 0 && t.inheritComparison !== ((($ = e.preferences) == null ? void 0 : $.inheritGlobalComparison) !== !1) && (l.inheritComparison = t.inheritComparison), l;
542
+ const g = (D = e.preferences) == null ? void 0 : D.comparisonPresentation, k = {}, { show: T, mode: L, precision: V } = t.comparisonDisplay;
543
+ T !== void 0 && T !== ((g == null ? void 0 : g.showComparison) ?? !0) && (k.show = T), L !== void 0 && L !== ((g == null ? void 0 : g.displayMode) ?? "difference") && (k.mode = L), V !== void 0 && V !== ((g == null ? void 0 : g.precision) ?? null) && (k.precision = V), Object.keys(k).length && (l.comparisonDisplay = k);
544
+ }
545
+ return t.inheritComparison !== void 0 && t.inheritComparison !== ((($ = e.preferences) == null ? void 0 : $.inheritGlobalComparison) !== !1) && (l.inheritComparison = t.inheritComparison), t.band !== void 0 && (t.band === "trend" && !Os(e.config) ? n.push(
546
+ Q("value_invalid", {
547
+ message: `${G(e.title)} has no Trend By date, so it has no trend to show.`,
548
+ path: `${s.path}.band`,
549
+ fix: "Add a Trend By date to show a trend: a dateField with a timeGrain in its query.",
550
+ allowed: ["automatic", "none"]
551
+ })
552
+ ) : t.band !== (((N = e.config) == null ? void 0 : N.kpiBand) ?? "automatic") && (l.band = t.band === "automatic" ? null : t.band)), l;
545
553
  }
546
- function Ln(e, a, t, s, n) {
547
- const o = String(t.type), i = Es("cartesian", "number"), d = Me(o), l = d == null ? void 0 : d.safeParse(t);
554
+ function Mn(e, a, t, s, n) {
555
+ const o = String(t.type), i = qs("cartesian", "number"), d = Me(o), l = d == null ? void 0 : d.safeParse(t);
548
556
  if (!i.includes(o) || !(l != null && l.success)) {
549
557
  const h = l && !l.success ? l.error.issues[0] : void 0;
550
558
  n.push(
@@ -564,7 +572,7 @@ function Ln(e, a, t, s, n) {
564
572
  }
565
573
  return l.data;
566
574
  }
567
- function Mn(e, a, t, s, n, o, i) {
575
+ function Bn(e, a, t, s, n, o, i) {
568
576
  const d = {};
569
577
  t.title !== void 0 && (t.title !== null && !t.title.trim() ? i.push(Q("value_invalid", { message: "An axis title can't be empty.", path: `${o}.title`, fix: "Send a title, or null for none." })) : (t.title ?? void 0) !== s.title && (d.title = t.title));
570
578
  const l = ["min", "max"].filter((c) => t[c] !== void 0 && t[c] !== null);
@@ -581,13 +589,13 @@ function Mn(e, a, t, s, n, o, i) {
581
589
  }
582
590
  if (n) {
583
591
  for (const p of ["min", "max"]) {
584
- const y = t[p];
585
- if (y !== void 0) {
586
- if (y !== null && !Number.isFinite(y)) {
592
+ const v = t[p];
593
+ if (v !== void 0) {
594
+ if (v !== null && !Number.isFinite(v)) {
587
595
  i.push(Q("value_invalid", { message: `An axis ${p} must be a number.`, path: `${o}.${p}` }));
588
596
  return;
589
597
  }
590
- (y ?? void 0) !== s[p] && (d[p] = y);
598
+ (v ?? void 0) !== s[p] && (d[p] = v);
591
599
  }
592
600
  }
593
601
  const c = t.min !== void 0 ? t.min : s.min, h = t.max !== void 0 ? t.max : s.max;
@@ -620,14 +628,14 @@ function St(e, a, t, s) {
620
628
  const { [s]: n, ...o } = t;
621
629
  return Object.keys(o).length ? { op: "card.update", cardId: e.cardRef, columns: { [a]: o } } : void 0;
622
630
  }
623
- function Bn(e, a, t) {
631
+ function Vn(e, a, t) {
624
632
  const { hidden: s, width: n, ...o } = t;
625
633
  return Object.keys(o).length ? { op: "card.update", cardId: e.cardRef, columns: { [a]: o } } : void 0;
626
634
  }
627
635
  function We(e, a, t) {
628
636
  return { op: "card.update", cardId: e.cardRef, columns: { [a]: { format: t } } };
629
637
  }
630
- function Vn(e, a, t, s, n, o, i) {
638
+ function jn(e, a, t, s, n, o, i) {
631
639
  var c;
632
640
  const d = n.label;
633
641
  if (d === void 0 || d === t.label) return;
@@ -644,7 +652,7 @@ function Vn(e, a, t, s, n, o, i) {
644
652
  return;
645
653
  }
646
654
  if (d === null) {
647
- const h = ((c = Dn(e, t.ref, o.catalogs)) == null ? void 0 : c.label) || t.field || t.label;
655
+ const h = ((c = On(e, t.ref, o.catalogs)) == null ? void 0 : c.label) || t.field || t.label;
648
656
  return t.labelInherited && t.label === h ? void 0 : { key: t.labelKey, label: h, origin: "semantic" };
649
657
  }
650
658
  if (!d.trim()) {
@@ -653,70 +661,70 @@ function Vn(e, a, t, s, n, o, i) {
653
661
  }
654
662
  return { key: t.labelKey, label: d };
655
663
  }
656
- function jn(e, a, t, s, n, o, i) {
657
- var I, S;
664
+ function Kn(e, a, t, s, n, o, i) {
665
+ var g, k;
658
666
  const d = `${Se(o.path, s)}.format`;
659
667
  if (!a.settings.has("columns.format")) {
660
668
  i.push(Q("setting_not_for_card", { message: `${G(e.title)} takes no column formats.`, path: d }));
661
669
  return;
662
670
  }
663
- const l = t.ref, c = ((I = o.modelFormats) == null ? void 0 : I.status) === "read" ? o.modelFormats.formats : void 0, h = l.kind === "matrixLevel" ? c == null ? void 0 : c[l.levelId] : l.kind === "matrixMeasure" ? c == null ? void 0 : c[l.measureId] : void 0, p = Mo({
671
+ const l = t.ref, c = ((g = o.modelFormats) == null ? void 0 : g.status) === "read" ? o.modelFormats.formats : void 0, h = l.kind === "matrixLevel" ? c == null ? void 0 : c[l.levelId] : l.kind === "matrixMeasure" ? c == null ? void 0 : c[l.measureId] : void 0, p = Bo({
664
672
  card: e,
665
673
  column: l,
666
674
  ...c ? { modelFormats: c } : {},
667
675
  ...h ? { catalogFormat: h } : {}
668
- }), y = p.source === "override" ? p.format : void 0;
669
- if (n === null) return y ? null : void 0;
670
- if (y && Pe(n, y)) return;
671
- const v = Bs(e, a, t, o.sqlResultColumns), w = v.value, x = Vs(v);
676
+ }), v = p.source === "override" ? p.format : void 0;
677
+ if (n === null) return v ? null : void 0;
678
+ if (v && Pe(n, v)) return;
679
+ const I = Vs(e, a, t, o.sqlResultColumns), w = I.value, x = js(I);
672
680
  if (x.length === 0) {
673
681
  i.push($a(e, s, d, t, w));
674
682
  return;
675
683
  }
676
- const q = !("type" in n) || n.type === void 0;
677
- if (q && !p.format) {
678
- const A = x[0];
684
+ const E = !("type" in n) || n.type === void 0;
685
+ if (E && !p.format) {
686
+ const T = x[0];
679
687
  i.push(
680
688
  Q("format_invalid", {
681
689
  // Unavailable is not "none": say which, so the agent knows the column may have a model format (ledger P2-20).
682
- message: ((S = o.modelFormats) == null ? void 0 : S.status) === "unavailable" ? `${s} on ${G(e.title)} may follow its model's format, which couldn't be read; state the whole format with its type.` : `${s} on ${G(e.title)} has no format to change; state the whole format with its type.`,
690
+ message: ((k = o.modelFormats) == null ? void 0 : k.status) === "unavailable" ? `${s} on ${G(e.title)} may follow its model's format, which couldn't be read; state the whole format with its type.` : `${s} on ${G(e.title)} has no format to change; state the whole format with its type.`,
683
691
  path: d,
684
692
  fix: "Add `type` to the format.",
685
- allowed: ze(A),
686
- suggestedChange: We(o, s, { type: A, ...n })
693
+ allowed: ze(T),
694
+ suggestedChange: We(o, s, { type: T, ...n })
687
695
  })
688
696
  );
689
697
  return;
690
698
  }
691
- const _ = q ? { ...p.format, ...n } : n, k = String(_.type);
692
- if (!x.includes(k)) {
699
+ const _ = E ? { ...p.format, ...n } : n, S = String(_.type);
700
+ if (!x.includes(S)) {
693
701
  i.push(
694
- k === "string" ? $a(e, s, `${d}.type`, t, "text") : Q("format_invalid", {
695
- message: w === "result" ? `${s} on ${G(e.title)} comes straight from the query, so it can't take a ${k.replace("_", " ")} format.` : `${s} on ${G(e.title)} is ${is(t)}, so it can't take a ${k.replace("_", " ")} format.`,
702
+ S === "string" ? $a(e, s, `${d}.type`, t, "text") : Q("format_invalid", {
703
+ message: w === "result" ? `${s} on ${G(e.title)} comes straight from the query, so it can't take a ${S.replace("_", " ")} format.` : `${s} on ${G(e.title)} is ${is(t)}, so it can't take a ${S.replace("_", " ")} format.`,
696
704
  path: `${d}.type`,
697
705
  allowed: [...x]
698
706
  })
699
707
  );
700
708
  return;
701
709
  }
702
- const b = Me(k), O = b == null ? void 0 : b.safeParse(_);
703
- if (!b || !(O != null && O.success)) {
704
- const A = O && !O.success ? O.error.issues[0] : void 0;
710
+ const y = Me(S), D = y == null ? void 0 : y.safeParse(_);
711
+ if (!y || !(D != null && D.success)) {
712
+ const T = D && !D.success ? D.error.issues[0] : void 0;
705
713
  i.push(
706
714
  Q("format_invalid", {
707
- message: b ? (A == null ? void 0 : A.code) === "unrecognized_keys" ? `A ${k} format has no ${A.keys.join(", ")}.` : `That format for ${s} isn't valid: ${(A == null ? void 0 : A.message) ?? "invalid"}.` : `${JSON.stringify(k)} isn't a format type.`,
715
+ message: y ? (T == null ? void 0 : T.code) === "unrecognized_keys" ? `A ${S} format has no ${T.keys.join(", ")}.` : `That format for ${s} isn't valid: ${(T == null ? void 0 : T.message) ?? "invalid"}.` : `${JSON.stringify(S)} isn't a format type.`,
708
716
  path: d,
709
- fix: Gn(k),
710
- allowed: b ? ze(k) : [...dn],
717
+ fix: Qn(S),
718
+ allowed: y ? ze(S) : [...ln],
711
719
  ...p.format ? { suggestedChange: We(o, s, p.format) } : {}
712
720
  })
713
721
  );
714
722
  return;
715
723
  }
716
- const $ = O.data;
724
+ const $ = D.data;
717
725
  if ($.type === "temporal_bucket" && t.granularity && !ya($, t.granularity).ok) {
718
- const L = ln.filter(
719
- (j) => ya({ presentation: { mode: "preset", preset: j } }, t.granularity).ok
726
+ const L = cn.filter(
727
+ (V) => ya({ presentation: { mode: "preset", preset: V } }, t.granularity).ok
720
728
  );
721
729
  i.push(
722
730
  Q("date_finer_than_grain", {
@@ -729,14 +737,14 @@ function jn(e, a, t, s, n, o, i) {
729
737
  return;
730
738
  }
731
739
  if ($.type === "date") {
732
- const A = n, L = p.format ?? {}, j = Object.keys(A).filter((K) => !ca.includes(K) && !Pe(A[K], L[K]));
733
- if (j.length) {
734
- const K = Object.fromEntries(Object.entries($).filter(([B]) => !j.includes(B)));
740
+ const T = n, L = p.format ?? {}, V = Object.keys(T).filter((K) => !ca.includes(K) && !Pe(T[K], L[K]));
741
+ if (V.length) {
742
+ const K = Object.fromEntries(Object.entries($).filter(([B]) => !V.includes(B)));
735
743
  i.push(
736
744
  Q("format_invalid", {
737
- message: `A date format set here takes a pattern or a preset; it doesn't set ${j.join(", ")}.`,
745
+ message: `A date format set here takes a pattern or a preset; it doesn't set ${V.join(", ")}.`,
738
746
  path: d,
739
- fix: `Leave out ${j.join(", ")}.`,
747
+ fix: `Leave out ${V.join(", ")}.`,
740
748
  allowed: ca.filter((B) => B !== "type"),
741
749
  suggestedChange: We(o, s, K)
742
750
  })
@@ -744,22 +752,22 @@ function jn(e, a, t, s, n, o, i) {
744
752
  return;
745
753
  }
746
754
  }
747
- const F = Pa(v, $);
748
- if (!F.ok) {
755
+ const N = Pa(I, $);
756
+ if (!N.ok) {
749
757
  i.push(
750
758
  Q("format_invalid", {
751
- message: `${G(e.title)} can't draw that format on ${s}: ${F.reason}.`,
759
+ message: `${G(e.title)} can't draw that format on ${s}: ${N.reason}.`,
752
760
  path: d,
753
761
  fix: "Change the format to one the column can show.",
754
- allowed: ze(k)
762
+ allowed: ze(S)
755
763
  })
756
764
  );
757
765
  return;
758
766
  }
759
- return y && Pe(y, $) ? void 0 : $;
767
+ return v && Pe(v, $) ? void 0 : $;
760
768
  }
761
- function Kn(e, a, t, s, n, o, i) {
762
- var x, q;
769
+ function Wn(e, a, t, s, n, o, i) {
770
+ var x, E;
763
771
  const d = n.polarity;
764
772
  if (d === void 0) return;
765
773
  const l = `${Se(o.path, s)}.polarity`, c = t.ref;
@@ -774,8 +782,8 @@ function Kn(e, a, t, s, n, o, i) {
774
782
  );
775
783
  return;
776
784
  }
777
- const p = c.kind === "field" ? (q = (x = e.config) == null ? void 0 : x.metricColumns) == null ? void 0 : q.find((_) => _.id === c.fieldId) : void 0, y = c.kind === "sqlKpiValue" ? La(e) : void 0, v = c.kind === "sqlKpiValue" ? (y == null ? void 0 : y.source) === "sql" && y.polarity !== va ? y.polarity : void 0 : p == null ? void 0 : p.comparisonPolarity, w = p == null ? void 0 : p.semanticComparisonPolarity;
778
- if (d === null) return v ? null : void 0;
785
+ const p = c.kind === "field" ? (E = (x = e.config) == null ? void 0 : x.metricColumns) == null ? void 0 : E.find((_) => _.id === c.fieldId) : void 0, v = c.kind === "sqlKpiValue" ? La(e) : void 0, I = c.kind === "sqlKpiValue" ? (v == null ? void 0 : v.source) === "sql" && v.polarity !== va ? v.polarity : void 0 : p == null ? void 0 : p.comparisonPolarity, w = p == null ? void 0 : p.semanticComparisonPolarity;
786
+ if (d === null) return I ? null : void 0;
779
787
  if (w && d !== w) {
780
788
  i.push(
781
789
  Q("polarity_set_by_model", {
@@ -788,84 +796,84 @@ function Kn(e, a, t, s, n, o, i) {
788
796
  );
789
797
  return;
790
798
  }
791
- return d === (w ?? v ?? va) ? void 0 : d;
799
+ return d === (w ?? I ?? va) ? void 0 : d;
792
800
  }
793
- function Wn(e, a, t, s, n, o, i, d) {
794
- var h, p, y;
801
+ function Un(e, a, t, s, n, o, i, d) {
802
+ var h, p, v;
795
803
  if (n.hidden === void 0 && n.width === void 0) return {};
796
804
  const l = Se(i.path, s);
797
805
  if (!a.settings.has("columns.hidden") || t.resultKey === void 0) {
798
- const v = a.pivoted && t.role === "measure";
806
+ const I = a.pivoted && t.role === "measure";
799
807
  return d.push(
800
808
  Q("setting_not_for_card", {
801
- message: v ? `${s} on ${G(e.title)} has a column for each pivot value; hide or size them in the editor.` : `${G(e.title)} has no hidden columns or column widths; those are for tables.`,
809
+ message: I ? `${s} on ${G(e.title)} has a column for each pivot value; hide or size them in the editor.` : `${G(e.title)} has no hidden columns or column widths; those are for tables.`,
802
810
  path: `${l}.${n.hidden !== void 0 ? "hidden" : "width"}`,
803
- allowed: v ? ["label", "format"] : ["label", "format"].filter((w) => a.settings.has(`columns.${w}`)),
804
- suggestedChange: Bn(i, s, n)
811
+ allowed: I ? ["label", "format"] : ["label", "format"].filter((w) => a.settings.has(`columns.${w}`)),
812
+ suggestedChange: Vn(i, s, n)
805
813
  })
806
814
  ), {};
807
815
  }
808
816
  const c = {};
809
817
  if (n.hidden !== void 0 && n.hidden !== ((o == null ? void 0 : o.hidden) === !0) && (c.hidden = n.hidden), n.width !== void 0 && n.width !== ((o == null ? void 0 : o.width) ?? null)) {
810
- const { minSize: v, maxSize: w } = Ms((y = (p = (h = e.preferences) == null ? void 0 : h.tablePrefs) == null ? void 0 : p.columnSettingsMap) == null ? void 0 : y[t.resultKey]);
811
- n.width !== null && (!Number.isFinite(n.width) || n.width < v || n.width > w) ? d.push(
818
+ const { minSize: I, maxSize: w } = Bs((v = (p = (h = e.preferences) == null ? void 0 : h.tablePrefs) == null ? void 0 : p.columnSettingsMap) == null ? void 0 : v[t.resultKey]);
819
+ n.width !== null && (!Number.isFinite(n.width) || n.width < I || n.width > w) ? d.push(
812
820
  Q("value_invalid", {
813
- message: `${s} on ${G(e.title)} can be ${v} to ${w} pixels wide.`,
821
+ message: `${s} on ${G(e.title)} can be ${I} to ${w} pixels wide.`,
814
822
  path: `${l}.width`,
815
- fix: `Send a width from ${v} to ${w} pixels, or null for automatic.`
823
+ fix: `Send a width from ${I} to ${w} pixels, or null for automatic.`
816
824
  })
817
825
  ) : c.width = n.width;
818
826
  }
819
827
  return c;
820
828
  }
821
- function Un(e, a, t) {
822
- var q, _, k, b;
823
- const { columns: s = {}, ...n } = a.settings ?? {}, o = [], i = xt.some((O) => n[O] !== void 0), d = !!((_ = (q = a.highlights) == null ? void 0 : q.add) != null && _.length || (b = (k = a.highlights) == null ? void 0 : k.remove) != null && b.length);
829
+ function Gn(e, a, t) {
830
+ var E, _, S, y;
831
+ const { columns: s = {}, ...n } = a.settings ?? {}, o = [], i = xt.some((D) => n[D] !== void 0), d = !!((_ = (E = a.highlights) == null ? void 0 : E.add) != null && _.length || (y = (S = a.highlights) == null ? void 0 : S.remove) != null && y.length);
824
832
  if (!Object.keys(s).length && !i && !d) return { ok: !0, labels: [], settings: null, warnings: [] };
825
- const l = qs(e);
833
+ const l = Ns(e);
826
834
  if (!l)
827
835
  return {
828
836
  ok: !1,
829
837
  problems: [Q("setting_not_for_card", { message: `${G(e.title)} takes no card settings through this tool.`, path: t.path })]
830
838
  };
831
- const c = Pn(e, l, n, t, o), h = Ns(e, l, t.sqlResultColumns), p = d ? Ps(e, l, h, a.highlights, t, o) : void 0, y = At(e), v = [], w = [];
832
- for (const [O, $] of Object.entries(s)) {
833
- const F = Ls(h, O, { path: Se(t.path, O), cardTitle: G(e.title) });
834
- if (!F.ok) {
835
- o.push(F.problem);
839
+ const c = Ln(e, l, n, t, o), h = Ps(e, l, t.sqlResultColumns), p = d ? Ls(e, l, h, a.highlights, t, o) : void 0, v = At(e), I = [], w = [];
840
+ for (const [D, $] of Object.entries(s)) {
841
+ const N = Ms(h, D, { path: Se(t.path, D), cardTitle: G(e.title) });
842
+ if (!N.ok) {
843
+ o.push(N.problem);
836
844
  continue;
837
845
  }
838
- const I = F.column;
839
- if (I.sqlName === "inferred") {
846
+ const g = N.column;
847
+ if (g.sqlName === "inferred") {
840
848
  o.push(
841
849
  Q("columns_unavailable", {
842
- message: `${G(e.title)}'s columns weren't read from its query, so ${O} can't be checked.`,
843
- path: Se(t.path, O),
850
+ message: `${G(e.title)}'s columns weren't read from its query, so ${D} can't be checked.`,
851
+ path: Se(t.path, D),
844
852
  fix: "Check that the card runs and returns rows, then propose again."
845
853
  })
846
854
  );
847
855
  continue;
848
856
  }
849
- const S = Vn(e, l, I, O, $, t, o);
850
- S && v.push(S);
851
- const A = Wn(e, l, I, O, $, y.columns[I.name], t, o), L = $.format !== void 0 ? jn(e, l, I, O, $.format, t, o) : void 0, j = Kn(e, l, I, O, $, t, o), K = {
852
- column: I.ref,
853
- ...A,
857
+ const k = jn(e, l, g, D, $, t, o);
858
+ k && I.push(k);
859
+ const T = Un(e, l, g, D, $, v.columns[g.name], t, o), L = $.format !== void 0 ? Kn(e, l, g, D, $.format, t, o) : void 0, V = Wn(e, l, g, D, $, t, o), K = {
860
+ column: g.ref,
861
+ ...T,
854
862
  ...L !== void 0 ? { format: L } : {},
855
- ...j !== void 0 ? { polarity: j } : {}
863
+ ...V !== void 0 ? { polarity: V } : {}
856
864
  };
857
865
  Object.keys(K).length > 1 && w.push(K);
858
866
  }
859
867
  if (o.length) return { ok: !1, problems: o };
860
868
  const x = { ...c, ...w.length ? { columns: w } : {}, ...p ? { highlights: p } : {} };
861
- return { ok: !0, labels: v, settings: Object.keys(x).length ? x : null, warnings: [] };
869
+ return { ok: !0, labels: I, settings: Object.keys(x).length ? x : null, warnings: [] };
862
870
  }
863
- function Gn(e) {
871
+ function Qn(e) {
864
872
  const a = Me(e), t = a && a === Me("number") ? ua.number : e === "temporal_bucket" || e === "date" ? ua[e] : void 0;
865
873
  return t ? `Send a stored format: ${t}.` : "Send the format in the stored shape the outline shows.";
866
874
  }
867
- function Qn(e, a, t, s, n) {
868
- var _, k, b, O, $, F;
875
+ function Hn(e, a, t, s, n) {
876
+ var _, S, y, D, $, N;
869
877
  const o = Ce(e, { sql: !0, calculations: !1 });
870
878
  if (!o.editable) return [o.message];
871
879
  const i = o.query, d = a;
@@ -879,45 +887,45 @@ function Qn(e, a, t, s, n) {
879
887
  config: s.config
880
888
  }, { sql: !0, calculations: !1 }) : void 0;
881
889
  if (l && !l.editable) return ["the compiled query"];
882
- const c = l != null && l.editable ? l.query : void 0, h = String(d.datasetName ?? ""), p = [], y = (I) => be(I, h), v = (I, S, A) => {
883
- const L = S ?? [], j = A ?? [];
884
- (L.length !== j.length || L.some((K, B) => y(K) !== y(j[B]))) && p.push(I);
890
+ const c = l != null && l.editable ? l.query : void 0, h = String(d.datasetName ?? ""), p = [], v = (g) => be(g, h), I = (g, k, T) => {
891
+ const L = k ?? [], V = T ?? [];
892
+ (L.length !== V.length || L.some((K, B) => v(K) !== v(V[B]))) && p.push(g);
885
893
  };
886
- for (const I of ["domainId", "datasetName"]) d[I] !== i[I] && p.push(I);
887
- if (v("measures", d.measures, i.measures), v("columns", d.columns, i.columns), t || o.matrix) {
888
- const I = (A) => new Set(((A == null ? void 0 : A.columns) ?? []).map(y)), S = (A, L) => (A ?? []).filter((j) => !I(L).has(y(j)));
889
- v("dimensions", S(d.dimensions, t), S(i.dimensions, o.matrix)), v("matrix.columns", t == null ? void 0 : t.columns, (_ = o.matrix) == null ? void 0 : _.columns);
894
+ for (const g of ["domainId", "datasetName"]) d[g] !== i[g] && p.push(g);
895
+ if (I("measures", d.measures, i.measures), I("columns", d.columns, i.columns), t || o.matrix) {
896
+ const g = (T) => new Set(((T == null ? void 0 : T.columns) ?? []).map(v)), k = (T, L) => (T ?? []).filter((V) => !g(L).has(v(V)));
897
+ I("dimensions", k(d.dimensions, t), k(i.dimensions, o.matrix)), I("matrix.columns", t == null ? void 0 : t.columns, (_ = o.matrix) == null ? void 0 : _.columns);
890
898
  } else
891
- v("dimensions", d.dimensions, i.dimensions);
899
+ I("dimensions", d.dimensions, i.dimensions);
892
900
  const w = d.timeWindow !== void 0 && !d.timeGrain, x = w && i.timeWindow === void 0 ? void 0 : w && d.dateField === void 0 ? c == null ? void 0 : c.dateField : d.dateField;
893
- x !== void 0 && (i.dateField === void 0 || y(x) !== y(i.dateField)) && p.push("dateField"), d.timeGrain !== void 0 && d.timeGrain !== i.timeGrain && p.push("timeGrain");
894
- const q = (k = e.config) != null && k.matrix ? e.config.matrix.spec.measures.map((I) => I.kind === "aggregate" ? { aggregate: I.aggregate } : {}) : ((b = e.config) == null ? void 0 : b.metricColumns) ?? [];
895
- (d.measures ?? []).forEach((I, S) => {
896
- const A = I && typeof I == "object" ? I.aggregate : void 0;
897
- A && _a(q[S] ?? {}) !== A && p.push(`the aggregate of measures[${S}]`);
901
+ x !== void 0 && (i.dateField === void 0 || v(x) !== v(i.dateField)) && p.push("dateField"), d.timeGrain !== void 0 && d.timeGrain !== i.timeGrain && p.push("timeGrain");
902
+ const E = (S = e.config) != null && S.matrix ? e.config.matrix.spec.measures.map((g) => g.kind === "aggregate" ? { aggregate: g.aggregate } : {}) : ((y = e.config) == null ? void 0 : y.metricColumns) ?? [];
903
+ (d.measures ?? []).forEach((g, k) => {
904
+ const T = g && typeof g == "object" ? g.aggregate : void 0;
905
+ T && _a(E[k] ?? {}) !== T && p.push(`the aggregate of measures[${k}]`);
898
906
  });
899
- for (const { key: I, label: S } of Ne(a))
900
- js(e, I) !== S && p.push(`the label "${S}"`);
907
+ for (const { key: g, label: k } of Ne(a))
908
+ Ks(e, g) !== k && p.push(`the label "${k}"`);
901
909
  if (!n || n.aspects.includes("filters")) {
902
- const I = d.filters ?? [];
903
- let S = i.filters ?? [];
904
- const A = d.timeWindow, L = i.timeWindow, j = (K, B) => {
910
+ const g = d.filters ?? [];
911
+ let k = i.filters ?? [];
912
+ const T = d.timeWindow, L = i.timeWindow, V = (K, B) => {
905
913
  const se = (oe) => JSON.stringify((oe ?? []).map(String));
906
- return y(K.field) === y(B.field) && K.operator === B.operator && (K.scope ?? "row") === (B.scope ?? "row") && (typeof K.field == "object" ? K.field.aggregate : void 0) === (typeof B.field == "object" ? B.field.aggregate : void 0) && (K.values === void 0 || se(K.values) === se(B.values));
914
+ return v(K.field) === v(B.field) && K.operator === B.operator && (K.scope ?? "row") === (B.scope ?? "row") && (typeof K.field == "object" ? K.field.aggregate : void 0) === (typeof B.field == "object" ? B.field.aggregate : void 0) && (K.values === void 0 || se(K.values) === se(B.values));
907
915
  };
908
- if (A && !L) {
916
+ if (T && !L) {
909
917
  const K = ((c == null ? void 0 : c.filters) ?? []).filter(
910
- (B) => !(c != null && c.timeWindow) && !I.some((se) => j(se, B))
918
+ (B) => !(c != null && c.timeWindow) && !g.some((se) => V(se, B))
911
919
  );
912
- (!K.length || K.some((B) => !S.some((se) => j(B, se)))) && p.push("timeWindow"), S = S.filter((B) => !K.some((se) => j(se, B)));
913
- } else A ? Xo(d.timeWindow, i.timeWindow) || p.push("timeWindow") : L && p.push("timeWindow");
914
- (I.length !== S.length || I.some((K, B) => !j(K, S[B]))) && p.push("filters");
920
+ (!K.length || K.some((B) => !k.some((se) => V(B, se)))) && p.push("timeWindow"), k = k.filter((B) => !K.some((se) => V(se, B)));
921
+ } else T ? Zo(d.timeWindow, i.timeWindow) || p.push("timeWindow") : L && p.push("timeWindow");
922
+ (g.length !== k.length || g.some((K, B) => !V(K, k[B]))) && p.push("filters");
915
923
  }
916
924
  if (d.orderBy !== void 0) {
917
- const I = d.orderBy, S = ($ = (O = e.config) == null ? void 0 : O.sortByColumns) == null ? void 0 : $[0], A = S && Ks(e.config ?? {}, S), L = I.field && typeof I.field == "object" ? I.field.aggregate : void 0;
918
- (!S || !A || S.direction !== I.direction || y(I.field) !== Ws(A.name, Na(A)) || L !== void 0 && _a(A) !== L) && p.push("orderBy");
925
+ const g = d.orderBy, k = ($ = (D = e.config) == null ? void 0 : D.sortByColumns) == null ? void 0 : $[0], T = k && Ws(e.config ?? {}, k), L = g.field && typeof g.field == "object" ? g.field.aggregate : void 0;
926
+ (!k || !T || k.direction !== g.direction || v(g.field) !== Us(T.name, Na(T)) || L !== void 0 && _a(T) !== L) && p.push("orderBy");
919
927
  }
920
- return d.limit !== void 0 && ((F = e.config) == null ? void 0 : F.rowLimit) !== d.limit && p.push("limit"), p;
928
+ return d.limit !== void 0 && ((N = e.config) == null ? void 0 : N.rowLimit) !== d.limit && p.push("limit"), p;
921
929
  }
922
930
  function kt(e) {
923
931
  const a = Wa({ variables: [e] })[0];
@@ -932,7 +940,7 @@ function Je(e, a) {
932
940
  const t = e.variables ?? [];
933
941
  return t.find((s) => s.name === a) ?? t.find((s) => s.id === a);
934
942
  }
935
- function Hn(e, a, t, s) {
943
+ function zn(e, a, t, s) {
936
944
  var i;
937
945
  const n = Je(e, a);
938
946
  n || s.problem(ls(e, a, t));
@@ -965,7 +973,7 @@ function cs(e, a) {
965
973
  }));
966
974
  }
967
975
  async function wa(e, a, t) {
968
- var b, O;
976
+ var y, D;
969
977
  const { problem: s, need: n, services: o } = t, { path: i, query: d } = e, l = ds(e.get), c = {
970
978
  id: e.id,
971
979
  name: e.name,
@@ -981,7 +989,7 @@ async function wa(e, a, t) {
981
989
  message: "A SQL variable takes the only row or the first row of its result.",
982
990
  path: `${i}.get`,
983
991
  fix: 'Send get: "only" or "first", or write the aggregate or the list in the SQL itself.'
984
- }), k(Ye({ ...c, mode: "sql", connectionId: d.connectionId, sql: d.sql, get: l.kind }, a));
992
+ }), S(Ye({ ...c, mode: "sql", connectionId: d.connectionId, sql: d.sql, get: l.kind }, a));
985
993
  const h = await o.loadCardSource({ domainId: d.domainId, datasetName: d.datasetName });
986
994
  h != null && h.dataSource || s({
987
995
  code: "variable_source_unreachable",
@@ -991,63 +999,63 @@ async function wa(e, a, t) {
991
999
  });
992
1000
  const p = h.fields;
993
1001
  for (const $ of Ma({ ...d, measures: d.measures ?? [] })) s({ ...$, path: `${i}.${$.path}` });
994
- const y = ($, F) => {
995
- const I = Ct($), S = zs($, d.datasetName);
996
- S.toLowerCase() !== d.datasetName.toLowerCase() && s({
1002
+ const v = ($, N) => {
1003
+ const g = Ct($), k = Ys($, d.datasetName);
1004
+ k.toLowerCase() !== d.datasetName.toLowerCase() && s({
997
1005
  code: "field_not_found",
998
- message: `A variable reads one dataset: "${I}" names ${S}, not ${d.datasetName}.`,
999
- path: F,
1000
- fix: `Name a field of ${d.datasetName}, or set datasetName to ${S} and read its field.`
1006
+ message: `A variable reads one dataset: "${g}" names ${k}, not ${d.datasetName}.`,
1007
+ path: N,
1008
+ fix: `Name a field of ${d.datasetName}, or set datasetName to ${k} and read its field.`
1001
1009
  });
1002
- const A = ot(p, I, d.datasetName);
1003
- return A || s({
1010
+ const T = ot(p, g, d.datasetName);
1011
+ return T || s({
1004
1012
  code: "field_not_found",
1005
- message: `"${I}" isn't a field of ${d.datasetName}.`,
1006
- path: F,
1013
+ message: `"${g}" isn't a field of ${d.datasetName}.`,
1014
+ path: N,
1007
1015
  fix: "Use one of details.available, or read semaphor_get_dataset_schema.",
1008
1016
  details: { available: p.slice(0, 20).map((L) => L.name) }
1009
- }), A;
1010
- }, v = d.measures ?? [], w = d.dimensions ?? [], x = {
1017
+ }), T;
1018
+ }, I = d.measures ?? [], w = d.dimensions ?? [], x = {
1011
1019
  ...c,
1012
1020
  mode: "data",
1013
1021
  dataSource: h.dataSource,
1014
1022
  connectionId: h.connectionId,
1015
1023
  get: "only",
1016
- ...(b = d.filters) != null && b.length ? { conditions: await Yn(d, o, i, t.refuseAll) } : {}
1024
+ ...(y = d.filters) != null && y.length ? { conditions: await Jn(d, o, i, t.refuseAll) } : {}
1017
1025
  };
1018
1026
  if (l.kind === "aggregate") {
1019
- (v.length !== 1 || w.length) && s({
1027
+ (I.length !== 1 || w.length) && s({
1020
1028
  code: "invalid_change",
1021
1029
  message: "An aggregate reads one measure and no dimension.",
1022
1030
  path: `${i}.query`,
1023
1031
  fix: `Send measures: [{ name, aggregate }] alone; for one field's value use get: "only", "first" or "list" with dimensions: [field].`
1024
1032
  }), d.orderBy && s({ code: "invalid_change", message: "An aggregate is one value, so it has no order.", path: `${i}.query.orderBy`, fix: "Leave out orderBy." });
1025
- const $ = y(v[0], `${i}.query.measures[0]`), F = typeof v[0] == "string" ? void 0 : v[0].aggregate, I = mn($).filter((L) => Ca(L.value)), S = F ?? (ut($) ? "calculation" : hn($));
1026
- if (!Ca(S) || !I.some((L) => L.value === S)) {
1027
- const L = I.map((j) => j.value);
1033
+ const $ = v(I[0], `${i}.query.measures[0]`), N = typeof I[0] == "string" ? void 0 : I[0].aggregate, g = hn($).filter((L) => Ca(L.value)), k = N ?? (ut($) ? "calculation" : pn($));
1034
+ if (!Ca(k) || !g.some((L) => L.value === k)) {
1035
+ const L = g.map((V) => V.value);
1028
1036
  s({
1029
1037
  code: "invalid_change",
1030
- message: F ? `${F} isn't an aggregate ${$.label || $.name} takes.` : `${$.label || $.name} needs its aggregate.`,
1038
+ message: N ? `${N} isn't an aggregate ${$.label || $.name} takes.` : `${$.label || $.name} needs its aggregate.`,
1031
1039
  path: `${i}.query.measures[0]`,
1032
1040
  fix: ut($) ? `${$.label || $.name} aggregates itself: send it without an aggregate.` : `Send { name: "${$.name}", aggregate } with one of: ${L.join(", ")}.`,
1033
1041
  allowed: L
1034
1042
  });
1035
1043
  }
1036
- const A = zn(v[0], { ...x, field: $, get: S }, `${i}.query.measures[0].comparison`, s);
1037
- return k(Ye({ ...x, field: $, get: S, ...A ? { comparison: A } : {} }, a));
1044
+ const T = Yn(I[0], { ...x, field: $, get: k }, `${i}.query.measures[0].comparison`, s);
1045
+ return S(Ye({ ...x, field: $, get: k, ...T ? { comparison: T } : {} }, a));
1038
1046
  }
1039
- (w.length !== 1 || v.length) && s({
1047
+ (w.length !== 1 || I.length) && s({
1040
1048
  code: "invalid_change",
1041
1049
  message: `The ${l.kind === "only" ? "only value" : l.kind === "first" ? "first value" : "list"} reads one dimension; a measure's one value is get: "aggregate".`,
1042
1050
  path: `${i}.query`,
1043
1051
  fix: "Send dimensions: [field] and no measures; order the first value or the list with orderBy."
1044
1052
  });
1045
- const q = y(w[0], `${i}.query.dimensions[0]`);
1046
- ut(q) && s({
1053
+ const E = v(w[0], `${i}.query.dimensions[0]`);
1054
+ ut(E) && s({
1047
1055
  code: "invalid_change",
1048
- message: `${q.label || q.name} is an aggregate calculation, so it has one value, not rows.`,
1056
+ message: `${E.label || E.name} is an aggregate calculation, so it has one value, not rows.`,
1049
1057
  path: `${i}.query.dimensions[0]`,
1050
- fix: `Send get: "aggregate" with measures: ["${q.name}"].`
1058
+ fix: `Send get: "aggregate" with measures: ["${E.name}"].`
1051
1059
  }), l.kind === "only" && d.orderBy && s({ code: "invalid_change", message: "The only value has no order: it shows when exactly one row matches.", path: `${i}.query.orderBy`, fix: 'Leave out orderBy, or send get: "first" to take the first by this order.' });
1052
1060
  let _;
1053
1061
  if (d.orderBy && l.kind !== "only") {
@@ -1057,28 +1065,28 @@ async function wa(e, a, t) {
1057
1065
  message: "The order names a field, not an aggregate: the first value is ordered by the latest (desc) or earliest (asc) of that field per value.",
1058
1066
  path: `${i}.query.orderBy.field`,
1059
1067
  fix: 'Send orderBy: { field: "<field>", direction }.'
1060
- }), _ = y($, `${i}.query.orderBy.field`);
1068
+ }), _ = v($, `${i}.query.orderBy.field`);
1061
1069
  }
1062
- return k(
1070
+ return S(
1063
1071
  Ye(
1064
1072
  {
1065
1073
  ...x,
1066
- field: q,
1074
+ field: E,
1067
1075
  get: l.kind,
1068
1076
  ..._ ? { sortField: _ } : {},
1069
- sortDirection: ((O = d.orderBy) == null ? void 0 : O.direction) ?? "asc",
1077
+ sortDirection: ((D = d.orderBy) == null ? void 0 : D.direction) ?? "asc",
1070
1078
  ...l.kind === "list" && l.limit ? { listLimit: l.limit } : {},
1071
1079
  ...l.kind === "list" && l.separator !== void 0 ? { listSeparator: l.separator } : {}
1072
1080
  },
1073
1081
  a
1074
1082
  )
1075
1083
  );
1076
- function k($) {
1077
- const F = { ...$, name: e.name }, I = Dt(F, a);
1078
- return I.length && t.refuseAll(cs(I, i)), F;
1084
+ function S($) {
1085
+ const N = { ...$, name: e.name }, g = Dt(N, a);
1086
+ return g.length && t.refuseAll(cs(g, i)), N;
1079
1087
  }
1080
1088
  }
1081
- function zn(e, a, t, s) {
1089
+ function Yn(e, a, t, s) {
1082
1090
  var o, i;
1083
1091
  const n = typeof e == "string" ? void 0 : e.comparison;
1084
1092
  if (!(!n || n.kind === "inherit" || n.kind === "off"))
@@ -1087,14 +1095,14 @@ function zn(e, a, t, s) {
1087
1095
  message: "A variable compares with an earlier period, not a target.",
1088
1096
  path: t,
1089
1097
  fix: "Send comparison: { kind: 'previous_period' } or { kind: 'previous_year' }; put a target in the words, or on a KPI card."
1090
- }), gn(a) || s({
1098
+ }), bn(a) || s({
1091
1099
  code: "invalid_change",
1092
1100
  message: `${((o = a.field) == null ? void 0 : o.label) || ((i = a.field) == null ? void 0 : i.name)} with ${String(a.get)} isn't a number, so it has no comparison.`,
1093
1101
  path: t,
1094
1102
  fix: "Compare a count, or a numeric field's total, average, lowest or highest; leave comparison out here."
1095
- }), Ys(n);
1103
+ }), Js(n);
1096
1104
  }
1097
- async function Yn(e, a, t, s) {
1105
+ async function Jn(e, a, t, s) {
1098
1106
  var o;
1099
1107
  const n = await a.compileCardQuery({
1100
1108
  query: { domainId: e.domainId, datasetName: e.datasetName, measures: ["__count"], filters: e.filters },
@@ -1102,8 +1110,8 @@ async function Yn(e, a, t, s) {
1102
1110
  });
1103
1111
  return n.ok ? ((o = n.part.config) == null ? void 0 : o.filters) ?? null : s(n.problems.map((i) => ({ ...i, path: i.path ? `${t}.query.${i.path}` : `${t}.query.filters` })));
1104
1112
  }
1105
- function Jn(e, a, t, s, n) {
1106
- const o = ds(a), i = pn(e);
1113
+ function Xn(e, a, t, s, n) {
1114
+ const o = ds(a), i = gn(e);
1107
1115
  o.kind === "aggregate" && e.get.kind !== "aggregate" && s.problem({ code: "invalid_change", message: `${e.name} reads a field's rows; an aggregate needs its measure.`, path: `${n}.get`, fix: 'Send query with measures: [{ name, aggregate }] and get: "aggregate".' }), o.kind !== "aggregate" && e.get.kind === "aggregate" && s.problem({ code: "invalid_change", message: `${e.name} is an aggregate; a value, the first or a list reads a dimension.`, path: `${n}.get`, fix: "Send query with dimensions: [field] and the get." }), i.mode === "sql" && o.kind !== "only" && o.kind !== "first" && s.problem({ code: "invalid_change", message: "A SQL variable takes the only row or the first row of its result.", path: `${n}.get`, fix: 'Send get: "only" or "first", or write the list in the SQL itself.' });
1108
1116
  const d = Ye(
1109
1117
  {
@@ -1116,7 +1124,7 @@ function Jn(e, a, t, s, n) {
1116
1124
  );
1117
1125
  return { query: d.query, get: d.get };
1118
1126
  }
1119
- function Xn(e, a) {
1127
+ function Zn(e, a) {
1120
1128
  const t = Qa(e).filter(({ ref: i }) => i.source === "data" && i.variableId === a), s = (i) => {
1121
1129
  var d;
1122
1130
  return `"${((d = (e.sheets ?? []).find((l) => l.id === i)) == null ? void 0 : d.title) ?? i}"`;
@@ -1132,7 +1140,7 @@ function Xn(e, a) {
1132
1140
  )
1133
1141
  ].join(", "), places: t };
1134
1142
  }
1135
- function Zn(e, a, t, s, n) {
1143
+ function ei(e, a, t, s, n) {
1136
1144
  const { problem: o } = n;
1137
1145
  (!Xe(t) || !t.document) && o({
1138
1146
  code: "invalid_change",
@@ -1143,47 +1151,47 @@ function Zn(e, a, t, s, n) {
1143
1151
  const i = t.document, d = e.target;
1144
1152
  let l, c;
1145
1153
  if ("sectionId" in d) {
1146
- const x = i.sections.find((q) => q.id === d.sectionId);
1154
+ const x = i.sections.find((E) => E.id === d.sectionId);
1147
1155
  x || o({ code: "invalid_change", message: `No section ${d.sectionId} on "${t.title}".`, path: `${s}.target.sectionId`, fix: "Use a section id from the outline's textSections." }), x.type !== "text" && o({ code: "invalid_change", message: `Section ${d.sectionId} is a ${x.type} section, not text.`, path: `${s}.target.sectionId`, fix: "Name one of the outline's textSections." }), l = x.content, c = x.style;
1148
1156
  } else {
1149
- const { region: x, role: q } = d;
1150
- Ia[x].includes(q) || o({
1157
+ const { region: x, role: E } = d;
1158
+ Ia[x].includes(E) || o({
1151
1159
  code: "invalid_change",
1152
- message: `The ${x} has ${x === "header" ? "a title and a metadata line" : "a note and a page info line"}, not a ${q} line.`,
1160
+ message: `The ${x} has ${x === "header" ? "a title and a metadata line" : "a note and a page info line"}, not a ${E} line.`,
1153
1161
  path: `${s}.target.role`,
1154
- fix: `Send role: ${Ia[x].map((k) => `"${k}"`).join(" or ")}.`
1155
- }), e.style !== void 0 && !Us(q) && o({
1162
+ fix: `Send role: ${Ia[x].map((S) => `"${S}"`).join(" or ")}.`
1163
+ }), e.style !== void 0 && !Gs(E) && o({
1156
1164
  code: "invalid_change",
1157
- message: `The footer's ${q === "pageInfo" ? "page info" : q} line has no size or alignment; only the header's title and metadata lines and text sections do.`,
1165
+ message: `The footer's ${E === "pageInfo" ? "page info" : E} line has no size or alignment; only the header's title and metadata lines and text sections do.`,
1158
1166
  path: `${s}.style`,
1159
1167
  fix: "Leave style out for a footer line."
1160
1168
  });
1161
- const _ = i[x] ? Uo(i[x].blocks, q) : void 0;
1169
+ const _ = i[x] ? Go(i[x].blocks, E) : void 0;
1162
1170
  l = (_ == null ? void 0 : _.content) ?? [], c = _ == null ? void 0 : _.style;
1163
1171
  }
1164
- const h = e.style !== void 0 ? Gs(e.style) : void 0, p = !h || Object.entries(h).every(([x, q]) => (c == null ? void 0 : c[x]) === q);
1165
- let y;
1172
+ const h = e.style !== void 0 ? Qs(e.style) : void 0, p = !h || Object.entries(h).every(([x, E]) => (c == null ? void 0 : c[x]) === E);
1173
+ let v;
1166
1174
  if (e.text !== void 0) {
1167
- const x = { kind: "document", sheetId: t.id }, q = { catalog: _t({ dashboard: a, place: x }), inputs: a.inputs, variables: a.variables }, _ = JSON.stringify(Ze(l, q));
1168
- if (JSON.stringify(Qs(e.text)) !== _) {
1169
- const k = Hs(e.text, l, { dashboard: a, place: x, path: `${s}.text`, links: !0 });
1170
- k.ok || n.refuseAll(k.problems);
1171
- const b = k.content;
1172
- JSON.stringify(Ze(b, q)) !== _ && (y = b);
1175
+ const x = { kind: "document", sheetId: t.id }, E = { catalog: _t({ dashboard: a, place: x }), inputs: a.inputs, variables: a.variables }, _ = JSON.stringify(Ze(l, E));
1176
+ if (JSON.stringify(Hs(e.text)) !== _) {
1177
+ const S = zs(e.text, l, { dashboard: a, place: x, path: `${s}.text`, links: !0 });
1178
+ S.ok || n.refuseAll(S.problems);
1179
+ const y = S.content;
1180
+ JSON.stringify(Ze(y, E)) !== _ && (v = y);
1173
1181
  }
1174
1182
  }
1175
- const v = {
1176
- ...y !== void 0 ? { content: y } : {},
1183
+ const I = {
1184
+ ...v !== void 0 ? { content: v } : {},
1177
1185
  ...h !== void 0 && !p ? { style: h } : {}
1178
1186
  };
1179
- return { edit: "sectionId" in d ? { type: "updateText", sectionId: d.sectionId, ...v } : { type: "updateRegionText", region: d.region, role: d.role, ...v }, unchanged: y === void 0 && p };
1187
+ return { edit: "sectionId" in d ? { type: "updateText", sectionId: d.sectionId, ...I } : { type: "updateRegionText", region: d.region, role: d.role, ...I }, unchanged: v === void 0 && p };
1180
1188
  }
1181
1189
  class me extends Error {
1182
1190
  }
1183
1191
  const xa = "A text card takes title, description and text.", bt = (e) => e.cards.some((a) => {
1184
1192
  var t, s;
1185
1193
  return ((t = a.customCardPreferences) == null ? void 0 : t.visualType) === "multiple" || !!((s = a.customCardPreferences) != null && s.dataInputCardIds);
1186
- }), Tt = (e) => (e ?? "").trim().toLowerCase(), tt = ao, Sa = { measures: io, records: no, sql: oo }, Ue = {
1194
+ }), Tt = (e) => (e ?? "").trim().toLowerCase(), tt = so, Sa = { measures: ro, records: io, sql: no }, Ue = {
1187
1195
  measures: "a measures query (measures, with optional dimensions)",
1188
1196
  records: "a records query (columns)",
1189
1197
  sql: "a SQL query"
@@ -1191,14 +1199,14 @@ const xa = "A text card takes title, description and text.", bt = (e) => e.cards
1191
1199
  function us(e, a) {
1192
1200
  return a.path.reduce((t, s) => typeof s == "number" ? `${t}[${s}]` : `${t}.${s}`, e);
1193
1201
  }
1194
- const ei = { max: vo, what: "A proposal", fix: "Split the changes into several proposals." };
1195
- async function Rr(e, a, t) {
1196
- return fs(e, a, t, { limit: ei });
1202
+ const ti = { max: Io, what: "A proposal", fix: "Split the changes into several proposals." };
1203
+ async function Ar(e, a, t) {
1204
+ return fs(e, a, t, { limit: ti });
1197
1205
  }
1198
1206
  async function fs(e, a, t, s) {
1199
1207
  var Gt, Qt, Ht, zt, Yt, Jt, Xt, Zt, ea, ta, aa, sa, oa, na, ia, ra;
1200
- const n = [], o = [], i = [], d = [], l = /* @__PURE__ */ new Set(), c = [], h = /* @__PURE__ */ new Map(), p = { calendar: t.calendar }, y = t.relationshipReach ? { relationshipReach: t.relationshipReach } : {};
1201
- let v = e, w, x = 0, q = 0;
1208
+ const n = [], o = [], i = [], d = [], l = /* @__PURE__ */ new Set(), c = [], h = /* @__PURE__ */ new Map(), p = { calendar: t.calendar }, v = t.relationshipReach ? { relationshipReach: t.relationshipReach } : {};
1209
+ let I = e, w, x = 0, E = 0;
1202
1210
  const { limit: _ } = s;
1203
1211
  if (a.length > _.max)
1204
1212
  return {
@@ -1212,64 +1220,64 @@ async function fs(e, a, t, s) {
1212
1220
  }
1213
1221
  ]
1214
1222
  };
1215
- const k = [];
1223
+ const S = [];
1216
1224
  if (a.forEach((m, r) => {
1217
- const u = Js.safeParse(m);
1225
+ const u = Xs.safeParse(m);
1218
1226
  if (u.success) {
1219
- k.push(u.data);
1227
+ S.push(u.data);
1220
1228
  return;
1221
1229
  }
1222
1230
  for (const f of u.error.issues) {
1223
- const g = Zo(f.message);
1231
+ const b = en(f.message);
1224
1232
  n.push({
1225
1233
  code: "invalid_change",
1226
- message: (g == null ? void 0 : g.message) ?? f.message,
1234
+ message: (b == null ? void 0 : b.message) ?? f.message,
1227
1235
  path: us(`changes[${r}]`, f),
1228
- fix: (g == null ? void 0 : g.fix) ?? "Send the change in the shape the tool schema gives."
1236
+ fix: (b == null ? void 0 : b.fix) ?? "Send the change in the shape the tool schema gives."
1229
1237
  });
1230
1238
  }
1231
1239
  }), n.length) return { ok: !1, problems: n };
1232
- const b = (m) => {
1240
+ const y = (m) => {
1233
1241
  throw n.push(m), new me();
1234
- }, O = (m) => {
1235
- t.capabilities.sql || b({
1242
+ }, D = (m) => {
1243
+ t.capabilities.sql || y({
1236
1244
  code: "capability_required",
1237
1245
  message: "This change creates, reads or changes a SQL card or variable, which needs SQL access.",
1238
1246
  path: m,
1239
1247
  fix: "Use a measures or records query (a semantic dataset for a variable), or ask an administrator for SQL access."
1240
1248
  }), l.add("sql");
1241
1249
  }, $ = (m, r) => {
1242
- const u = wt(v, [m], p);
1243
- u.ok ? (v = u.dashboard, i.push(m)) : b({ code: "invalid_change", message: u.failedAt.message, path: r, ...u.failedAt.fix ? { fix: u.failedAt.fix } : {} });
1244
- }, F = async (m) => {
1245
- var X, Y, V, ne, fe;
1246
- const { cardId: r, index: u, path: f } = m, { settings: g = {}, highlights: C } = m.request, E = g.columns && Object.keys(g.columns).length ? g.columns : void 0, R = Object.entries(g).some(([H, de]) => H !== "columns" && de !== void 0), D = !!((X = C == null ? void 0 : C.add) != null && X.length);
1247
- if (!E && !R && !D && !((Y = C == null ? void 0 : C.remove) != null && Y.length)) return null;
1248
- const T = ie(v, r).card, P = Object.values(E ?? {}).some((H) => H.label === null), N = Object.values(E ?? {}).some((H) => H.format !== void 0 && H.format !== null), M = {};
1249
- if (P && !((V = T.sql) != null && V.trim()))
1250
- for (const H of An(T)) {
1250
+ const u = wt(I, [m], p);
1251
+ u.ok ? (I = u.dashboard, i.push(m)) : y({ code: "invalid_change", message: u.failedAt.message, path: r, ...u.failedAt.fix ? { fix: u.failedAt.fix } : {} });
1252
+ }, N = async (m) => {
1253
+ var X, Y, j, ne, fe;
1254
+ const { cardId: r, index: u, path: f } = m, { settings: b = {}, highlights: C } = m.request, O = b.columns && Object.keys(b.columns).length ? b.columns : void 0, F = Object.entries(b).some(([H, de]) => H !== "columns" && de !== void 0), A = !!((X = C == null ? void 0 : C.add) != null && X.length);
1255
+ if (!O && !F && !A && !((Y = C == null ? void 0 : C.remove) != null && Y.length)) return null;
1256
+ const R = ie(I, r).card, P = Object.values(O ?? {}).some((H) => H.label === null), q = Object.values(O ?? {}).some((H) => H.format !== void 0 && H.format !== null), M = {};
1257
+ if (P && !((j = R.sql) != null && j.trim()))
1258
+ for (const H of Dn(R)) {
1251
1259
  const de = await t.loadCardSource(H);
1252
1260
  de && (M[Nt(H)] = de.fields);
1253
1261
  }
1254
1262
  let U;
1255
- if (N && !((ne = T.sql) != null && ne.trim())) {
1256
- const H = t.readModelFormats ? await t.readModelFormats({ card: T }) : null;
1263
+ if (q && !((ne = R.sql) != null && ne.trim())) {
1264
+ const H = t.readModelFormats ? await t.readModelFormats({ card: R }) : null;
1257
1265
  U = H ? { status: "read", formats: H } : { status: "unavailable" };
1258
1266
  }
1259
1267
  let z;
1260
- if ((E || D) && ((fe = T.sql) != null && fe.trim()) && T.type !== "kpi") {
1261
- const H = t.readSqlResultColumns ? await t.readSqlResultColumns({ cardId: r, dashboard: v }) : null;
1262
- H || b({
1268
+ if ((O || A) && ((fe = R.sql) != null && fe.trim()) && R.type !== "kpi") {
1269
+ const H = t.readSqlResultColumns ? await t.readSqlResultColumns({ cardId: r, dashboard: I }) : null;
1270
+ H || y({
1263
1271
  code: "columns_unavailable",
1264
- message: E ? `"${T.title || "Untitled"}" couldn't be run to read its columns, so their names can't be checked.` : `"${T.title || "Untitled"}" couldn't be run to read its columns, so the highlight's column can't be checked.`,
1265
- path: E ? `${f}.columns` : `${f}.column`,
1272
+ message: O ? `"${R.title || "Untitled"}" couldn't be run to read its columns, so their names can't be checked.` : `"${R.title || "Untitled"}" couldn't be run to read its columns, so the highlight's column can't be checked.`,
1273
+ path: O ? `${f}.columns` : `${f}.column`,
1266
1274
  fix: "Check that the card runs and returns rows, then propose again."
1267
1275
  }), z = H;
1268
1276
  }
1269
- const W = Un(
1270
- T,
1277
+ const W = Gn(
1278
+ R,
1271
1279
  {
1272
- settings: { ...g, ...E ? { columns: E } : { columns: void 0 } },
1280
+ settings: { ...b, ...O ? { columns: O } : { columns: void 0 } },
1273
1281
  ...C ? { highlights: C } : {}
1274
1282
  },
1275
1283
  {
@@ -1284,21 +1292,21 @@ async function fs(e, a, t, s) {
1284
1292
  if (!W.ok)
1285
1293
  throw n.push(...W.problems), new me();
1286
1294
  for (const H of W.labels) {
1287
- const de = m.queryLabels.find((Re) => He(Re.key, H.key) && Re.label !== H.label);
1288
- de && b({
1295
+ const de = m.queryLabels.find((Fe) => He(Fe.key, H.key) && Fe.label !== H.label);
1296
+ de && y({
1289
1297
  code: "value_invalid",
1290
- message: `Two labels are stated for one column of "${T.title || "Untitled"}": "${de.label}" in the query and "${H.label}" in columns.`,
1298
+ message: `Two labels are stated for one column of "${R.title || "Untitled"}": "${de.label}" in the query and "${H.label}" in columns.`,
1291
1299
  path: `${f}.columns`,
1292
1300
  fix: "State the label once."
1293
1301
  });
1294
1302
  }
1295
- return o.push(...W.warnings), W.labels.length && pa(T, W.labels).changed.length && $({ op: "card.update", cardId: r, update: { kind: "relabel", labels: W.labels }, changeIndex: u }, `${f}.columns`), W.settings && $({ op: "card.update", cardId: r, update: { kind: "settings", settings: W.settings }, changeIndex: u }, E ? `${f}.columns` : f), W.settings;
1296
- }, I = (m, r) => {
1297
- var g;
1298
- const u = ie(v, m);
1299
- u || b({ code: "card_not_editable", message: "Cards in Document sections are changed in the editor.", path: `${r}.cardId`, fix: "Tell the user to change it in the editor.", details: { reason: "document_section" } });
1303
+ return o.push(...W.warnings), W.labels.length && pa(R, W.labels).changed.length && $({ op: "card.update", cardId: r, update: { kind: "relabel", labels: W.labels }, changeIndex: u }, `${f}.columns`), W.settings && $({ op: "card.update", cardId: r, update: { kind: "settings", settings: W.settings }, changeIndex: u }, O ? `${f}.columns` : f), W.settings;
1304
+ }, g = (m, r) => {
1305
+ var b;
1306
+ const u = ie(I, m);
1307
+ u || y({ code: "card_not_editable", message: "Cards in Document sections are changed in the editor.", path: `${r}.cardId`, fix: "Tell the user to change it in the editor.", details: { reason: "document_section" } });
1300
1308
  const f = Ce(u.card, { sql: !0 });
1301
- return ((g = f.source) == null ? void 0 : g.kind) === "sql" && O(`${r}.cardId`), f.editable || b({
1309
+ return ((b = f.source) == null ? void 0 : b.kind) === "sql" && D(`${r}.cardId`), f.editable || y({
1302
1310
  code: "card_not_editable",
1303
1311
  message: f.message,
1304
1312
  path: `${r}.cardId`,
@@ -1310,26 +1318,26 @@ async function fs(e, a, t, s) {
1310
1318
  path: r,
1311
1319
  details: { cardIds: [m] }
1312
1320
  }), { card: u.card, read: f };
1313
- }, S = /* @__PURE__ */ new Map(), A = (m, r, u) => {
1314
- var g;
1315
- const f = Ka("metric", ((g = m.config) == null ? void 0 : g.metricColumns) ?? []);
1316
- return r.map(({ index: C, calculations: E }) => ({
1317
- ...E,
1321
+ }, k = /* @__PURE__ */ new Map(), T = (m, r, u) => {
1322
+ var b;
1323
+ const f = Ka("metric", ((b = m.config) == null ? void 0 : b.metricColumns) ?? []);
1324
+ return r.map(({ index: C, calculations: O }) => ({
1325
+ ...O,
1318
1326
  measure: f[C] ?? { role: "metric", field: "", ordinal: C },
1319
1327
  path: `${u}.query.measures[${C}]`
1320
1328
  }));
1321
1329
  }, L = async (m) => {
1322
- const r = ie(v, m.cardId).card, u = A(r, m.stated, m.path), f = u.some((E) => {
1323
- var R, D;
1324
- return ((R = E.comparison) == null ? void 0 : R.kind) === "previous_period" || ((D = E.comparison) == null ? void 0 : D.kind) === "previous_year";
1325
- }), g = f && t.readComparisonDates ? await t.readComparisonDates({ card: r, dashboard: v }) : ka(r), C = fa({ card: r, stated: u, context: { path: m.path, cardRef: m.cardRef, dates: g } });
1330
+ const r = ie(I, m.cardId).card, u = T(r, m.stated, m.path), f = u.some((O) => {
1331
+ var F, A;
1332
+ return ((F = O.comparison) == null ? void 0 : F.kind) === "previous_period" || ((A = O.comparison) == null ? void 0 : A.kind) === "previous_year";
1333
+ }), b = f && t.readComparisonDates ? await t.readComparisonDates({ card: r, dashboard: I }) : ka(r), C = fa({ card: r, stated: u, context: { path: m.path, cardRef: m.cardRef, dates: b } });
1326
1334
  if (!C.ok)
1327
1335
  throw n.push(...C.problems), new me();
1328
- return o.push(...C.warnings), f && S.set(m.cardId, m.path), C.update ? ($(
1336
+ return o.push(...C.warnings), f && k.set(m.cardId, m.path), C.update ? ($(
1329
1337
  { op: "card.update", cardId: m.cardId, update: { kind: "calculations", calculations: C.update }, changeIndex: m.index },
1330
1338
  `${m.path}.query`
1331
1339
  ), !0) : !1;
1332
- }, j = (m) => ({
1340
+ }, V = (m) => ({
1333
1341
  columns: m.columns,
1334
1342
  orientation: m.orientation,
1335
1343
  stack: m.stack,
@@ -1339,62 +1347,63 @@ async function fs(e, a, t, s) {
1339
1347
  legend: m.legend,
1340
1348
  axes: m.axes,
1341
1349
  comparisonDisplay: m.comparisonDisplay,
1342
- inheritComparison: m.inheritComparison
1343
- }), K = (m) => Object.entries(j(m)).filter(([, r]) => r !== void 0).map(([r]) => r), B = (m) => (n.push(...m.slice(0, -1)), b(m[m.length - 1])), se = (m, r, u, f) => {
1344
- const { card: g } = r, C = [...m.type ? ["type"] : [], ...m.query ? ["query"] : [], ...m.matrix ? ["matrix"] : [], ...K(m)];
1345
- C.length && b({
1350
+ inheritComparison: m.inheritComparison,
1351
+ band: m.band
1352
+ }), K = (m) => Object.entries(V(m)).filter(([, r]) => r !== void 0).map(([r]) => r), B = (m) => (n.push(...m.slice(0, -1)), y(m[m.length - 1])), se = (m, r, u, f) => {
1353
+ const { card: b } = r, C = [...m.type ? ["type"] : [], ...m.query ? ["query"] : [], ...m.matrix ? ["matrix"] : [], ...K(m)];
1354
+ C.length && y({
1346
1355
  code: "invalid_change",
1347
- message: `"${g.title}" is a text card, so it takes no ${et(C)}.`,
1356
+ message: `"${b.title}" is a text card, so it takes no ${et(C)}.`,
1348
1357
  path: f,
1349
1358
  fix: "Change a card to or from text in the editor, or add a new card and remove this one."
1350
1359
  });
1351
- const E = ja(g, { inputs: v.inputs, variables: v.variables });
1352
- E.editable || b({ code: "card_not_editable", message: E.message, path: `${f}.cardId`, fix: "Tell the user to change it in the editor.", details: { reason: "text" } });
1353
- const R = E.editable && (E.form === "legacy_html" || E.form === "legacy_runs");
1354
- R && m.description !== void 0 && m.text === void 0 && b({
1360
+ const O = ja(b, { inputs: I.inputs, variables: I.variables });
1361
+ O.editable || y({ code: "card_not_editable", message: O.message, path: `${f}.cardId`, fix: "Tell the user to change it in the editor.", details: { reason: "text" } });
1362
+ const F = O.editable && (O.form === "legacy_html" || O.form === "legacy_runs");
1363
+ F && m.description !== void 0 && m.text === void 0 && y({
1355
1364
  code: "invalid_change",
1356
- message: `"${g.title}" keeps its words in its description, so a description change would replace them.`,
1365
+ message: `"${b.title}" keeps its words in its description, so a description change would replace them.`,
1357
1366
  path: `${f}.description`,
1358
1367
  fix: "Send the words in text with it: they are stored as rich text, and the description becomes the subtitle."
1359
- }), d.push({ ref: m.cardId, kind: "card", id: g.id, title: m.title ?? g.title ?? "", changeIndex: u });
1360
- let D = !1, T = !1;
1368
+ }), d.push({ ref: m.cardId, kind: "card", id: b.id, title: m.title ?? b.title ?? "", changeIndex: u });
1369
+ let A = !1, R = !1;
1361
1370
  if (m.text !== void 0) {
1362
1371
  const M = ga({
1363
1372
  text: m.text,
1364
- card: g,
1373
+ card: b,
1365
1374
  // Any variable the catalog offers where the card sits (DV-D13).
1366
- context: { dashboard: v, place: { kind: "sheet", sheetId: r.sheet.id, cardId: g.id } },
1375
+ context: { dashboard: I, place: { kind: "sheet", sheetId: r.sheet.id, cardId: b.id } },
1367
1376
  path: `${f}.text`,
1368
- storeAsRichText: R && m.description !== void 0
1377
+ storeAsRichText: F && m.description !== void 0
1369
1378
  });
1370
- M.ok || B(M.problems), M.ok && !M.unchanged && ($({ op: "card.update", cardId: g.id, update: { kind: "text", richContent: M.richContent, clearsLegacy: M.clearsLegacy }, changeIndex: u }, f), D = !0, T = M.clearsLegacy);
1379
+ M.ok || B(M.problems), M.ok && !M.unchanged && ($({ op: "card.update", cardId: b.id, update: { kind: "text", richContent: M.richContent, clearsLegacy: M.clearsLegacy }, changeIndex: u }, f), A = !0, R = M.clearsLegacy);
1371
1380
  }
1372
- const P = m.title !== void 0 && m.title !== g.title, N = m.description !== void 0 && (R ? T : (m.description ?? void 0) !== (g.description ?? void 0));
1373
- (P || N) && ($(
1381
+ const P = m.title !== void 0 && m.title !== b.title, q = m.description !== void 0 && (F ? R : (m.description ?? void 0) !== (b.description ?? void 0));
1382
+ (P || q) && ($(
1374
1383
  {
1375
1384
  op: "card.update",
1376
- cardId: g.id,
1377
- update: { kind: "rename", ...P ? { title: m.title } : {}, ...N ? { description: m.description } : {} },
1385
+ cardId: b.id,
1386
+ update: { kind: "rename", ...P ? { title: m.title } : {}, ...q ? { description: m.description } : {} },
1378
1387
  changeIndex: u
1379
1388
  },
1380
1389
  f
1381
- ), D = !0), D && r.frame.visualId && o.push({
1390
+ ), A = !0), A && r.frame.visualId && o.push({
1382
1391
  code: "detaches_linked_visual",
1383
- message: `"${g.title}" will stop following its library visual and become local to this dashboard.`,
1392
+ message: `"${b.title}" will stop following its library visual and become local to this dashboard.`,
1384
1393
  path: f,
1385
- details: { cardIds: [g.id] }
1394
+ details: { cardIds: [b.id] }
1386
1395
  });
1387
1396
  }, oe = (m, r) => {
1388
1397
  if (m.startsWith("$")) {
1389
1398
  const u = h.get(m);
1390
- return (!u || u.kind !== "card") && b({
1399
+ return (!u || u.kind !== "card") && y({
1391
1400
  code: "handle_unknown",
1392
1401
  message: `${m} isn't a card handle defined earlier in this list.`,
1393
1402
  path: r,
1394
1403
  fix: "Define the handle with an earlier card.add, or use the card id from the outline."
1395
1404
  }), u.id;
1396
1405
  }
1397
- return we(v).some((u) => u.cardId === m) || b({
1406
+ return we(I).some((u) => u.cardId === m) || y({
1398
1407
  code: "card_not_found",
1399
1408
  message: `There's no card ${m} on this dashboard.`,
1400
1409
  path: r,
@@ -1403,88 +1412,88 @@ async function fs(e, a, t, s) {
1403
1412
  }, te = (m, r) => {
1404
1413
  if (m.startsWith("$")) {
1405
1414
  const f = h.get(m);
1406
- return (!f || f.kind !== "filter") && b({
1415
+ return (!f || f.kind !== "filter") && y({
1407
1416
  code: "handle_unknown",
1408
1417
  message: `${m} isn't a filter handle defined earlier in this list.`,
1409
1418
  path: r,
1410
1419
  fix: "Define the handle with an earlier filter.add, or use the filter id from the outline."
1411
1420
  }), f.id;
1412
1421
  }
1413
- return (Array.isArray(v.inputs) ? v.inputs : []).some((f) => f.id === m && f.kind === "filter") || b({
1422
+ return (Array.isArray(I.inputs) ? I.inputs : []).some((f) => f.id === m && f.kind === "filter") || y({
1414
1423
  code: "filter_not_found",
1415
1424
  message: `There's no filter ${m} on this dashboard.`,
1416
1425
  path: r,
1417
1426
  fix: "Read the outline again and use its filter ids."
1418
1427
  }), m;
1419
1428
  }, Bt = (m, r) => {
1420
- const u = m.startsWith("$") ? void 0 : Je(v, m);
1429
+ const u = m.startsWith("$") ? void 0 : Je(I, m);
1421
1430
  return u ? u.id : oe(m, r);
1422
- }, Te = { services: t, problem: b, refuseAll: B, need: O }, nt = () => (v.sheets ?? []).filter((m) => !Xe(m)), Be = () => nt().map((m) => ({ sheetId: m.id, title: m.title ?? "" })), it = (m, r, u) => {
1431
+ }, Te = { services: t, problem: y, refuseAll: B, need: D }, nt = () => (I.sheets ?? []).filter((m) => !Xe(m)), Be = () => nt().map((m) => ({ sheetId: m.id, title: m.title ?? "" })), it = (m, r, u) => {
1423
1432
  let f = m;
1424
1433
  if (m.startsWith("$")) {
1425
1434
  const C = h.get(m);
1426
- (!C || C.kind !== "sheet") && b({
1435
+ (!C || C.kind !== "sheet") && y({
1427
1436
  code: "handle_unknown",
1428
1437
  message: `${m} isn't a sheet handle defined earlier in this list.`,
1429
1438
  path: r,
1430
1439
  fix: "Define the handle with an earlier sheet.add, or use the sheet id from the outline."
1431
1440
  }), f = C.id;
1432
1441
  }
1433
- const g = (v.sheets ?? []).find((C) => C.id === f);
1434
- return g || b({ code: "sheet_not_found", message: `There's no sheet ${f} on this dashboard.`, path: r, fix: "Read the outline again and use its sheet ids.", details: { sheets: Be() } }), u.grid && Xe(g) && b({ code: "sheet_not_a_grid", message: `"${g.title}" is a Document sheet.`, path: r, fix: "Add the card to a grid sheet; Document sheets are changed in the editor.", details: { sheets: Be() } }), g;
1435
- }, Fe = (m, r) => it(m, r, { grid: !0 }), Vt = (m, r) => m.map((u, f) => Fe(u, `${r}.sheetIds[${f}]`).id), jt = (m, r, u, f) => {
1436
- var R;
1437
- for (const D of Ma(r, u)) b({ ...D, path: `${f}.${D.path}` });
1438
- const g = Ae[m], C = tt(r), E = r.dateField;
1439
- if (E && typeof E != "string" && E.label && !r.timeGrain && b({
1442
+ const b = (I.sheets ?? []).find((C) => C.id === f);
1443
+ return b || y({ code: "sheet_not_found", message: `There's no sheet ${f} on this dashboard.`, path: r, fix: "Read the outline again and use its sheet ids.", details: { sheets: Be() } }), u.grid && Xe(b) && y({ code: "sheet_not_a_grid", message: `"${b.title}" is a Document sheet.`, path: r, fix: "Add the card to a grid sheet; Document sheets are changed in the editor.", details: { sheets: Be() } }), b;
1444
+ }, Re = (m, r) => it(m, r, { grid: !0 }), Vt = (m, r) => m.map((u, f) => Re(u, `${r}.sheetIds[${f}]`).id), jt = (m, r, u, f) => {
1445
+ var F;
1446
+ for (const A of Ma(r, u)) y({ ...A, path: `${f}.${A.path}` });
1447
+ const b = Ae[m], C = tt(r), O = r.dateField;
1448
+ if (O && typeof O != "string" && O.label && !r.timeGrain && y({
1440
1449
  code: "invalid_change",
1441
1450
  message: "A label names a column, and the date field is a column only when the card groups by it.",
1442
1451
  path: `${f}.query.dateField.label`,
1443
1452
  fix: "Send timeGrain to group by the date, or leave the label out."
1444
- }), !g.forms.includes(C)) {
1445
- const D = Object.keys(Ae).filter((T) => Ae[T].forms.includes(C));
1446
- b({
1453
+ }), !b.forms.includes(C)) {
1454
+ const A = Object.keys(Ae).filter((R) => Ae[R].forms.includes(C));
1455
+ y({
1447
1456
  code: "type_not_supported",
1448
- message: `A ${m.replace(/_/g, " ")} card takes ${g.forms.map((T) => Ue[T]).join(" or ")}, not ${Ue[C]}.`,
1457
+ message: `A ${m.replace(/_/g, " ")} card takes ${b.forms.map((R) => Ue[R]).join(" or ")}, not ${Ue[C]}.`,
1449
1458
  path: `${f}.query`,
1450
- fix: `Send ${g.forms.map((T) => Ue[T]).join(" or ")}, or use a type this query fits: ${D.join(", ")}.`
1459
+ fix: `Send ${b.forms.map((R) => Ue[R]).join(" or ")}, or use a type this query fits: ${A.join(", ")}.`
1451
1460
  });
1452
1461
  }
1453
1462
  if (C === "measures") {
1454
- const D = r, T = D.measures.length;
1455
- g.measures && (T < g.measures.min || g.measures.max !== void 0 && T > g.measures.max) && b({
1463
+ const A = r, R = A.measures.length;
1464
+ b.measures && (R < b.measures.min || b.measures.max !== void 0 && R > b.measures.max) && y({
1456
1465
  code: "type_not_supported",
1457
- message: `A ${m.replace(/_/g, " ")} card shows exactly ${g.measures.max} measure.`,
1466
+ message: `A ${m.replace(/_/g, " ")} card shows exactly ${b.measures.max} measure.`,
1458
1467
  path: `${f}.query.measures`,
1459
1468
  fix: "Send one measure, or use a table or chart for several."
1460
- }), !g.dimensions && ((R = D.dimensions) != null && R.length) && b({
1469
+ }), !b.dimensions && ((F = A.dimensions) != null && F.length) && y({
1461
1470
  code: "type_not_supported",
1462
1471
  message: `A ${m.replace(/_/g, " ")} card shows one number, so it has no dimensions.`,
1463
1472
  path: `${f}.query.dimensions`,
1464
1473
  fix: "Remove the dimensions, or use a table or chart."
1465
- }), m === "matrix" && (D.orderBy || D.limit) && b({
1474
+ }), m === "matrix" && (A.orderBy || A.limit) && y({
1466
1475
  code: "type_not_supported",
1467
1476
  message: "A Matrix's sorting and top N are set in the editor.",
1468
1477
  path: `${f}.query`,
1469
1478
  fix: "Leave out orderBy and limit for a Matrix."
1470
1479
  });
1471
1480
  }
1472
- if (g.matrixColumns && !u && b({
1481
+ if (b.matrixColumns && !u && y({
1473
1482
  code: "type_not_supported",
1474
1483
  message: "A Matrix needs matrix.columns: the query fields that run across the top.",
1475
1484
  path: `${f}.matrix`,
1476
1485
  fix: "Send matrix: { columns: [...] } naming dimensions or the date field of the query (an empty list puts nothing across the top)."
1477
- }), !g.matrixColumns && u && b({ code: "type_not_supported", message: "matrix.columns is only for Matrix cards.", path: `${f}.matrix`, fix: 'Leave out matrix, or use type "matrix".' }), u && C === "measures") {
1478
- const D = r, T = D.datasetName, P = [...D.dimensions ?? [], ...D.timeGrain && D.dateField ? [D.dateField] : []];
1479
- P.length && u.columns.length >= P.length && P.every((M) => u.columns.some((U) => be(U, T) === be(M, T))) && b({
1486
+ }), !b.matrixColumns && u && y({ code: "type_not_supported", message: "matrix.columns is only for Matrix cards.", path: `${f}.matrix`, fix: 'Leave out matrix, or use type "matrix".' }), u && C === "measures") {
1487
+ const A = r, R = A.datasetName, P = [...A.dimensions ?? [], ...A.timeGrain && A.dateField ? [A.dateField] : []];
1488
+ P.length && u.columns.length >= P.length && P.every((M) => u.columns.some((U) => be(U, R) === be(M, R))) && y({
1480
1489
  code: "type_not_supported",
1481
1490
  message: "A Matrix needs at least one field down the side.",
1482
1491
  path: `${f}.matrix.columns`,
1483
1492
  fix: "Leave one dimension or the date field out of matrix.columns."
1484
1493
  });
1485
- const N = new Set([...D.dimensions ?? [], ...D.dateField ? [D.dateField] : []].map((M) => be(M, T)));
1494
+ const q = new Set([...A.dimensions ?? [], ...A.dateField ? [A.dateField] : []].map((M) => be(M, R)));
1486
1495
  u.columns.forEach((M, U) => {
1487
- N.has(be(M, T)) || b({
1496
+ q.has(be(M, R)) || y({
1488
1497
  code: "type_not_supported",
1489
1498
  message: `"${Ct(M)}" isn't one of the query's dimensions or its date field.`,
1490
1499
  path: `${f}.matrix.columns[${U}]`,
@@ -1492,158 +1501,158 @@ async function fs(e, a, t, s) {
1492
1501
  });
1493
1502
  });
1494
1503
  }
1495
- }, Kt = (m, r) => b({
1504
+ }, Kt = (m, r) => y({
1496
1505
  code: m.code === "query_not_kept" ? "card_not_editable" : "invalid_change",
1497
1506
  message: m.message,
1498
1507
  path: `${r}.query`,
1499
1508
  fix: m.code === "query_not_kept" ? "Tell the user to make this change in the editor." : "Read the outline again and propose again.",
1500
1509
  details: { reason: "not_expressible", ..."parts" in m ? { parts: m.parts } : {} }
1501
- }), Wt = (m, r, u, f, g, C, E) => {
1502
- const R = Qn(m, r, u, C, E);
1503
- if (!R.length) return;
1504
- const D = r;
1505
- if (R.length === 1 && R[0] === "dateField" && D.dateField && !D.timeGrain && !D.timeWindow) {
1506
- b({
1510
+ }), Wt = (m, r, u, f, b, C, O) => {
1511
+ const F = Hn(m, r, u, C, O);
1512
+ if (!F.length) return;
1513
+ const A = r;
1514
+ if (F.length === 1 && F[0] === "dateField" && A.dateField && !A.timeGrain && !A.timeWindow) {
1515
+ y({
1507
1516
  code: "value_invalid",
1508
- message: `A dateField on its own doesn't change "${g}": it needs timeGrain to group by the date (a KPI's Trend By) or a timeWindow to filter by it.`,
1517
+ message: `A dateField on its own doesn't change "${b}": it needs timeGrain to group by the date (a KPI's Trend By) or a timeWindow to filter by it.`,
1509
1518
  path: `${f}.query.dateField`,
1510
1519
  fix: 'Add timeGrain (for example "month") or a timeWindow, or leave out dateField.'
1511
1520
  });
1512
1521
  return;
1513
1522
  }
1514
- const T = R.join(", ");
1515
- b({
1523
+ const R = F.join(", ");
1524
+ y({
1516
1525
  code: "card_not_editable",
1517
- message: E ? `As changed, "${g}" wouldn't hold ${T} as asked, so make this change in the editor.` : `"${g}" can't be built holding ${T} as asked.`,
1526
+ message: O ? `As changed, "${b}" wouldn't hold ${R} as asked, so make this change in the editor.` : `"${b}" can't be built holding ${R} as asked.`,
1518
1527
  path: `${f}.query`,
1519
- fix: E ? "Tell the user to make this change in the editor." : `Leave out ${T}; the rest of the card can be added.`,
1520
- details: { reason: "not_expressible", detail: `doesn't hold: ${T}` }
1528
+ fix: O ? "Tell the user to make this change in the editor." : `Leave out ${R}; the rest of the card can be added.`,
1529
+ details: { reason: "not_expressible", detail: `doesn't hold: ${R}` }
1521
1530
  });
1522
- }, Ut = async (m, r, u, f, g = !1) => {
1531
+ }, Ut = async (m, r, u, f, b = !1) => {
1523
1532
  const C = ct(m);
1524
1533
  if ("sql" in r)
1525
- return O(`${f}.query`), { type: C, source: { kind: "sql", connectionId: r.connectionId, sql: r.sql } };
1526
- const E = C === "matrixTable" || C === "detailTable" ? "table" : C, R = await t.compileCardQuery({ query: r, chartType: E });
1527
- if (!R.ok)
1528
- throw n.push(...R.problems.map((N) => ({ ...N, path: N.path ? `${f}.query.${N.path}` : `${f}.query` }))), new me();
1529
- o.push(...R.warnings.map((N) => ({ ...N, path: N.path ?? `${f}.query` })));
1530
- const D = !g && "timeWindow" in r && r.timeWindow ? li(R.part.config) : void 0;
1531
- D && "timeWindow" in r && r.timeWindow && hs(r.timeWindow, { use: "cardFilter", columnHasTime: lo(D) }, `${f}.query.timeWindow`, b);
1532
- let T = { ...R.part, type: C };
1533
- const P = T.config ?? {};
1534
+ return D(`${f}.query`), { type: C, source: { kind: "sql", connectionId: r.connectionId, sql: r.sql } };
1535
+ const O = C === "matrixTable" || C === "detailTable" ? "table" : C, F = await t.compileCardQuery({ query: r, chartType: O });
1536
+ if (!F.ok)
1537
+ throw n.push(...F.problems.map((q) => ({ ...q, path: q.path ? `${f}.query.${q.path}` : `${f}.query` }))), new me();
1538
+ o.push(...F.warnings.map((q) => ({ ...q, path: q.path ?? `${f}.query` })));
1539
+ const A = !b && "timeWindow" in r && r.timeWindow ? ci(F.part.config) : void 0;
1540
+ A && "timeWindow" in r && r.timeWindow && hs(r.timeWindow, { use: "cardFilter", columnHasTime: co(A) }, `${f}.query.timeWindow`, y);
1541
+ let R = { ...F.part, type: C };
1542
+ const P = R.config ?? {};
1534
1543
  if (C === "detailTable") {
1535
- const N = co(uo("table", "detailTable", P)) ?? {};
1536
- T = { ...T, config: ai(N) };
1544
+ const q = uo(fo("table", "detailTable", P)) ?? {};
1545
+ R = { ...R, config: si(q) };
1537
1546
  }
1538
- return C === "matrixTable" && (T = await vs(T, P, r, u, f)), si(T, Ne(r));
1539
- }, vs = async (m, r, u, f, g) => {
1540
- var N;
1547
+ return C === "matrixTable" && (R = await vs(R, P, r, u, f)), oi(R, Ne(r));
1548
+ }, vs = async (m, r, u, f, b) => {
1549
+ var q;
1541
1550
  const C = await t.loadCardSource({ domainId: u.domainId, datasetName: u.datasetName });
1542
- if (C || b({ code: "field_not_found", message: `The dataset "${u.datasetName}" isn't available.`, path: `${g}.query.datasetName`, fix: "Find datasets with semaphor_list_datasets." }), m.source.kind !== "semantic") throw new me();
1543
- const E = { id: "scratch", title: "", type: "table", dataSource: m.source.dataSource, config: r }, R = mo(E, "matrixTable", { catalog: C.fields, createId: t.newId }), D = R.status === "changed" ? (N = R.card.config) == null ? void 0 : N.matrix : void 0;
1544
- (R.status !== "changed" || R.leftOut.length || !D) && b({
1551
+ if (C || y({ code: "field_not_found", message: `The dataset "${u.datasetName}" isn't available.`, path: `${b}.query.datasetName`, fix: "Find datasets with semaphor_list_datasets." }), m.source.kind !== "semantic") throw new me();
1552
+ const O = { id: "scratch", title: "", type: "table", dataSource: m.source.dataSource, config: r }, F = ho(O, "matrixTable", { catalog: C.fields, createId: t.newId }), A = F.status === "changed" ? (q = F.card.config) == null ? void 0 : q.matrix : void 0;
1553
+ (F.status !== "changed" || F.leftOut.length || !A) && y({
1545
1554
  code: "type_not_supported",
1546
- message: R.status === "changed" && R.leftOut.length ? `These fields can't run in a Matrix: ${R.leftOut.join(", ")}.` : "This query can't be shown as a Matrix.",
1547
- path: `${g}.query`,
1555
+ message: F.status === "changed" && F.leftOut.length ? `These fields can't run in a Matrix: ${F.leftOut.join(", ")}.` : "This query can't be shown as a Matrix.",
1556
+ path: `${b}.query`,
1548
1557
  fix: "Use plain dataset fields for a Matrix, or use a table."
1549
1558
  });
1550
- let T = D;
1559
+ let R = A;
1551
1560
  const P = u.datasetName;
1552
1561
  for (const [M, U] of f.columns.entries()) {
1553
- const z = [...T.spec.rows, ...T.spec.columns].find(
1554
- (W) => ho(W.field) === be(U, P)
1562
+ const z = [...R.spec.rows, ...R.spec.columns].find(
1563
+ (W) => po(W.field) === be(U, P)
1555
1564
  );
1556
- z || b({ code: "type_not_supported", message: `"${Ct(U)}" isn't a level of this Matrix.`, path: `${g}.matrix.columns[${M}]`, fix: "Name dimensions or the date field of the query in matrix.columns." }), T = po(T, go(T.spec, z.id, "columns")).config;
1565
+ z || y({ code: "type_not_supported", message: `"${Ct(U)}" isn't a level of this Matrix.`, path: `${b}.matrix.columns[${M}]`, fix: "Name dimensions or the date field of the query in matrix.columns." }), R = go(R, bo(R.spec, z.id, "columns")).config;
1557
1566
  }
1558
- return { ...m, config: { matrix: T } };
1567
+ return { ...m, config: { matrix: R } };
1559
1568
  }, rt = /* @__PURE__ */ new Map(), dt = /* @__PURE__ */ new Map();
1560
- for (const [m, r] of k.entries()) {
1569
+ for (const [m, r] of S.entries()) {
1561
1570
  const u = `changes[${m}]`;
1562
1571
  try {
1563
1572
  switch (r.op) {
1564
1573
  case "card.add": {
1565
1574
  const f = r.position && typeof r.position == "object" ? (() => {
1566
- const Y = oe(r.position.after, `${u}.position.after`), V = we(v).find(
1575
+ const Y = oe(r.position.after, `${u}.position.after`), j = we(I).find(
1567
1576
  (ne) => ne.cardId === Y && ne.kind === "frameCard"
1568
1577
  );
1569
- return !V || V.kind !== "frameCard" ? b({
1578
+ return !j || j.kind !== "frameCard" ? y({
1570
1579
  code: "card_not_found",
1571
1580
  message: `${r.position.after} isn't a card on a grid sheet.`,
1572
1581
  path: `${u}.position.after`,
1573
1582
  fix: "Use a cardId from semaphor_get_dashboard_details on the same sheet, or a handle from this proposal."
1574
- }) : (r.sheetId && Fe(r.sheetId, `${u}.sheetId`).id !== V.sheetId && b({
1583
+ }) : (r.sheetId && Re(r.sheetId, `${u}.sheetId`).id !== j.sheetId && y({
1575
1584
  code: "invalid_change",
1576
1585
  message: `position.after names a card on another sheet than ${r.sheetId}.`,
1577
1586
  path: `${u}.position.after`,
1578
1587
  fix: "Leave out sheetId, or name the card's sheet."
1579
- }), { sheetId: V.sheetId, frameId: V.frameId });
1580
- })() : void 0, g = f ? Fe(f.sheetId, `${u}.position.after`) : r.sheetId ? Fe(r.sheetId, `${u}.sheetId`) : (() => {
1588
+ }), { sheetId: j.sheetId, frameId: j.frameId });
1589
+ })() : void 0, b = f ? Re(f.sheetId, `${u}.position.after`) : r.sheetId ? Re(r.sheetId, `${u}.sheetId`) : (() => {
1581
1590
  const Y = nt();
1582
- return Y.length !== 1 && b({
1591
+ return Y.length !== 1 && y({
1583
1592
  code: Y.length ? "sheet_required" : "sheet_not_a_grid",
1584
1593
  message: Y.length ? "This dashboard has several grid sheets; say which one gets the card." : "This dashboard has no grid sheet to add a card to.",
1585
1594
  path: `${u}.sheetId`,
1586
1595
  fix: Y.length ? "Send sheetId: one of details.sheets." : "Add a sheet with sheet.add earlier in this list.",
1587
1596
  details: { sheets: Be() }
1588
1597
  }), Y[0];
1589
- })(), C = f ? { after: f.frameId } : typeof r.position == "string" ? r.position : void 0, E = C || r.width ? { ...C ? { position: C } : {}, ...r.width ? { width: r.width } : {} } : void 0, R = (Y) => {
1590
- const V = r.handle ?? `$card_${++x}`;
1591
- return h.has(V) && b({ code: "invalid_change", message: `The handle ${V} is defined twice.`, path: `${u}.handle`, fix: "Give each new card, filter or sheet its own handle." }), h.set(V, { kind: "card", id: Y.id, title: r.title }), d.push({ ref: V, kind: "card", id: Y.id, title: r.title, changeIndex: m }), V;
1598
+ })(), C = f ? { after: f.frameId } : typeof r.position == "string" ? r.position : void 0, O = C || r.width ? { ...C ? { position: C } : {}, ...r.width ? { width: r.width } : {} } : void 0, F = (Y) => {
1599
+ const j = r.handle ?? `$card_${++x}`;
1600
+ return h.has(j) && y({ code: "invalid_change", message: `The handle ${j} is defined twice.`, path: `${u}.handle`, fix: "Give each new card, filter or sheet its own handle." }), h.set(j, { kind: "card", id: Y.id, title: r.title }), d.push({ ref: j, kind: "card", id: Y.id, title: r.title, changeIndex: m }), j;
1592
1601
  };
1593
1602
  if (r.type === "text") {
1594
1603
  const Y = [...r.query ? ["query"] : [], ...r.matrix ? ["matrix"] : [], ...K(r)];
1595
- Y.length && b({ code: "invalid_change", message: `A text card takes no ${et(Y)}.`, path: u, fix: xa }), r.text === void 0 && b({ code: "invalid_change", message: "A text card needs its words in text.", path: `${u}.text`, fix: xa });
1596
- const V = ga({ text: r.text, context: { dashboard: v, place: { kind: "sheet", sheetId: g.id } }, path: `${u}.text` });
1597
- V.ok || B(V.problems);
1598
- const ne = Qo({
1604
+ Y.length && y({ code: "invalid_change", message: `A text card takes no ${et(Y)}.`, path: u, fix: xa }), r.text === void 0 && y({ code: "invalid_change", message: "A text card needs its words in text.", path: `${u}.text`, fix: xa });
1605
+ const j = ga({ text: r.text, context: { dashboard: I, place: { kind: "sheet", sheetId: b.id } }, path: `${u}.text` });
1606
+ j.ok || B(j.problems);
1607
+ const ne = Ho({
1599
1608
  id: t.newId(),
1600
1609
  title: r.title,
1601
1610
  ...r.description ? { description: r.description } : {},
1602
- richContent: V.ok && !V.unchanged ? V.richContent : { version: 1, blocks: [{ type: "paragraph", children: [] }] }
1611
+ richContent: j.ok && !j.unchanged ? j.richContent : { version: 1, blocks: [{ type: "paragraph", children: [] }] }
1603
1612
  });
1604
- $({ op: "card.add", sheetId: g.id, frame: { id: t.newId(), cards: [ne], activeCardId: ne.id }, ...E ? { placement: E } : {}, changeIndex: m }, u), R(ne);
1613
+ $({ op: "card.add", sheetId: b.id, frame: { id: t.newId(), cards: [ne], activeCardId: ne.id }, ...O ? { placement: O } : {}, changeIndex: m }, u), F(ne);
1605
1614
  break;
1606
1615
  }
1607
- (r.text !== void 0 || !r.query) && b({
1616
+ (r.text !== void 0 || !r.query) && y({
1608
1617
  code: "invalid_change",
1609
1618
  message: r.text !== void 0 ? `A ${r.type} card takes a query, not text.` : `A ${r.type} card needs a query.`,
1610
1619
  path: r.text !== void 0 ? `${u}.text` : `${u}.query`,
1611
1620
  fix: "Send query; text is for type text."
1612
1621
  });
1613
- const D = yt(r.query), T = D.query, P = r.type;
1614
- jt(P, T, r.matrix, u);
1615
- const N = await Ut(P, T, r.matrix, u), M = {
1616
- ...Ho({ id: t.newId(), title: r.title, ...r.description ? { description: r.description } : {} }),
1617
- type: N.type
1618
- }, U = ha(M, N);
1619
- U.ok || b({ code: "invalid_change", message: U.message, path: u });
1622
+ const A = yt(r.query), R = A.query, P = r.type;
1623
+ jt(P, R, r.matrix, u);
1624
+ const q = await Ut(P, R, r.matrix, u), M = {
1625
+ ...zo({ id: t.newId(), title: r.title, ...r.description ? { description: r.description } : {} }),
1626
+ type: q.type
1627
+ }, U = ha(M, q);
1628
+ U.ok || y({ code: "invalid_change", message: U.message, path: u });
1620
1629
  const z = U.ok ? U.card : M;
1621
- Wt(z, T, r.matrix, u, r.title, N);
1630
+ Wt(z, R, r.matrix, u, r.title, q);
1622
1631
  const W = { id: t.newId(), cards: [z], activeCardId: z.id };
1623
- $({ op: "card.add", sheetId: g.id, frame: W, ...E ? { placement: E } : {}, changeIndex: m }, u);
1624
- const X = R(z);
1625
- c.push(z.id), await L({ cardId: z.id, cardRef: X, stated: D.calculations, index: m, path: u }), await F({
1632
+ $({ op: "card.add", sheetId: b.id, frame: W, ...O ? { placement: O } : {}, changeIndex: m }, u);
1633
+ const X = F(z);
1634
+ c.push(z.id), await L({ cardId: z.id, cardRef: X, stated: A.calculations, index: m, path: u }), await N({
1626
1635
  cardId: z.id,
1627
1636
  cardRef: X,
1628
- request: { settings: j(r) },
1629
- queryLabels: "sql" in T ? [] : Ne(T),
1637
+ request: { settings: V(r) },
1638
+ queryLabels: "sql" in R ? [] : Ne(R),
1630
1639
  index: m,
1631
1640
  path: u
1632
1641
  });
1633
1642
  break;
1634
1643
  }
1635
1644
  case "card.update": {
1636
- const f = oe(r.cardId, `${u}.cardId`), g = ie(v, f);
1637
- if ((g == null ? void 0 : g.card.type) === "text") {
1638
- se(r, g, m, u);
1645
+ const f = oe(r.cardId, `${u}.cardId`), b = ie(I, f);
1646
+ if ((b == null ? void 0 : b.card.type) === "text") {
1647
+ se(r, b, m, u);
1639
1648
  break;
1640
1649
  }
1641
- r.text !== void 0 && b({ code: "invalid_change", message: `"${(g == null ? void 0 : g.card.title) ?? f}" isn't a text card, so it takes no text.`, path: `${u}.text`, fix: "Change its query; text is for text cards." });
1642
- const { card: C, read: E } = I(f, u);
1643
- let R = !1, D = [];
1644
- const T = r.type && r.type !== ((Gt = qe(C)) == null ? void 0 : Gt.type) ? ct(r.type) : void 0;
1645
- if (T && T !== C.type) {
1646
- const N = E.editable ? E.source : void 0, M = Xs(C, T), U = M && N && N.kind === "semantic" ? (Qt = await t.loadCardSource({ domainId: N.domainId, datasetName: N.datasetName })) == null ? void 0 : Qt.fields : void 0, z = [], W = Zs(C, T, {
1650
+ r.text !== void 0 && y({ code: "invalid_change", message: `"${(b == null ? void 0 : b.card.title) ?? f}" isn't a text card, so it takes no text.`, path: `${u}.text`, fix: "Change its query; text is for text cards." });
1651
+ const { card: C, read: O } = g(f, u);
1652
+ let F = !1, A = [];
1653
+ const R = r.type && r.type !== ((Gt = qe(C)) == null ? void 0 : Gt.type) ? ct(r.type) : void 0;
1654
+ if (R && R !== C.type) {
1655
+ const q = O.editable ? O.source : void 0, M = Zs(C, R), U = M && q && q.kind === "semantic" ? (Qt = await t.loadCardSource({ domainId: q.domainId, datasetName: q.datasetName })) == null ? void 0 : Qt.fields : void 0, z = [], W = eo(C, R, {
1647
1656
  ...U ? { catalog: U } : {},
1648
1657
  ...M && !U ? { catalogLoading: !0 } : {},
1649
1658
  createId: () => {
@@ -1651,7 +1660,7 @@ async function fs(e, a, t, s) {
1651
1660
  return z.push(X), X;
1652
1661
  }
1653
1662
  });
1654
- if (W.status === "refused" && b({ code: "type_not_supported", message: "The card's dataset fields couldn't be loaded for a change to or from a Matrix.", path: `${u}.type`, fix: "Send a complete query with the type change." }), W.status === "changed") {
1663
+ if (W.status === "refused" && y({ code: "type_not_supported", message: "The card's dataset fields couldn't be loaded for a change to or from a Matrix.", path: `${u}.type`, fix: "Send a complete query with the type change." }), W.status === "changed") {
1655
1664
  const X = [...W.leftOut, ...W.droppedPreferences];
1656
1665
  X.length && o.push({
1657
1666
  code: "type_change_drops",
@@ -1659,39 +1668,39 @@ async function fs(e, a, t, s) {
1659
1668
  path: `${u}.type`,
1660
1669
  details: { dropped: X }
1661
1670
  }), $(
1662
- { op: "card.update", cardId: f, update: { kind: "retype", type: T, ...U ? { catalog: U } : {}, newIds: z }, changeIndex: m },
1671
+ { op: "card.update", cardId: f, update: { kind: "retype", type: R, ...U ? { catalog: U } : {}, newIds: z }, changeIndex: m },
1663
1672
  `${u}.type`
1664
- ), R = !0;
1673
+ ), F = !0;
1665
1674
  }
1666
1675
  }
1667
1676
  const P = r.query ? yt(r.query) : void 0;
1668
1677
  if (r.query || r.matrix) {
1669
- const N = ie(v, f).card, M = Ce(N, { sql: !0, calculations: !1 }), U = M.editable ? yt(M.query).query : void 0, z = U, W = ri(z, (P == null ? void 0 : P.query) ?? {}, `${u}.query`, (le) => {
1678
+ const q = ie(I, f).card, M = Ce(q, { sql: !0, calculations: !1 }), U = M.editable ? yt(M.query).query : void 0, z = U, W = di(z, (P == null ? void 0 : P.query) ?? {}, `${u}.query`, (le) => {
1670
1679
  if (le.code === "query_form_mismatch" && (P != null && P.calculations.length)) {
1671
- const pe = A(N, P.calculations, u), _e = fa({ card: N, stated: pe, context: { path: u, cardRef: r.cardId, dates: ka(N) } });
1680
+ const pe = T(q, P.calculations, u), _e = fa({ card: q, stated: pe, context: { path: u, cardRef: r.cardId, dates: ka(q) } });
1672
1681
  if (!_e.ok)
1673
1682
  throw n.push(..._e.problems), new me();
1674
1683
  }
1675
- return b(le);
1684
+ return y(le);
1676
1685
  });
1677
- D = ii((P == null ? void 0 : P.query) ?? {}, W);
1678
- const X = ((Ht = qe(N)) == null ? void 0 : Ht.type) ?? $t(N.type), Y = r.matrix ?? (M.editable ? M.matrix : void 0);
1686
+ A = ri((P == null ? void 0 : P.query) ?? {}, W);
1687
+ const X = ((Ht = qe(q)) == null ? void 0 : Ht.type) ?? $t(q.type), Y = r.matrix ?? (M.editable ? M.matrix : void 0);
1679
1688
  jt(X, W, Y, u);
1680
- const V = M.editable && U ? eo(U, W, M.matrix, Y) : void 0, ne = !V || V.aspects.length > 0, fe = V && !("sql" in W) ? Ne(W).filter((le) => !ma(V, le.key.role)) : [], H = to(N, V, fe.map((le) => le.key.role));
1689
+ const j = M.editable && U ? to(U, W, M.matrix, Y) : void 0, ne = !j || j.aspects.length > 0, fe = j && !("sql" in W) ? Ne(W).filter((le) => !ma(j, le.key.role)) : [], H = ao(q, j, fe.map((le) => le.key.role));
1681
1690
  H && Kt(H, u);
1682
1691
  let de = W;
1683
- if (V && !("sql" in W) && W.orderBy && !V.aspects.includes("order") && ["metric", "group_by", "detail"].some((le) => ma(V, le))) {
1692
+ if (j && !("sql" in W) && W.orderBy && !j.aspects.includes("order") && ["metric", "group_by", "detail"].some((le) => ma(j, le))) {
1684
1693
  const { orderBy: le, ...pe } = W;
1685
1694
  de = pe;
1686
1695
  }
1687
- let Re;
1696
+ let Fe;
1688
1697
  if (ne) {
1689
- const le = !!(z && ms(z, (P == null ? void 0 : P.query) ?? {}) && (V != null && V.keptWindow)), pe = await Ut(X, de, Y, u, le), _e = pe.type === ct(X) ? { ...pe, type: N.type } : pe;
1690
- Re = _e;
1691
- const da = V ? { ..._e, change: V } : _e, ge = ha(N, da);
1698
+ const le = !!(z && ms(z, (P == null ? void 0 : P.query) ?? {}) && (j != null && j.keptWindow)), pe = await Ut(X, de, Y, u, le), _e = pe.type === ct(X) ? { ...pe, type: q.type } : pe;
1699
+ Fe = _e;
1700
+ const da = j ? { ..._e, change: j } : _e, ge = ha(q, da);
1692
1701
  if (ge.ok || Kt(ge, u), ge.ok && ge.droppedBindings.length && o.push({
1693
1702
  code: "control_binding_dropped",
1694
- message: `"${N.title}" loses the controls bound to the levels or measures this change removes; they stop changing this card.`,
1703
+ message: `"${q.title}" loses the controls bound to the levels or measures this change removes; they stop changing this card.`,
1695
1704
  path: `${u}.query`,
1696
1705
  fix: "Keep those fields in the query, or tell the user the controls no longer apply to this card.",
1697
1706
  details: { controlIds: ge.droppedBindings }
@@ -1699,16 +1708,16 @@ async function fs(e, a, t, s) {
1699
1708
  for (const Ve of ge.keptLabels)
1700
1709
  o.push({
1701
1710
  code: "label_kept_after_change",
1702
- message: `"${N.title}" keeps the label "${Ve.label}" on ${Ve.field}, whose aggregate or time grain changed.`,
1711
+ message: `"${q.title}" keeps the label "${Ve.label}" on ${Ve.field}, whose aggregate or time grain changed.`,
1703
1712
  path: `${u}.query`,
1704
1713
  fix: "State a new label on the field ref if the old one no longer fits.",
1705
1714
  details: { columns: [{ label: Ve.label, field: Ve.field }] }
1706
1715
  });
1707
- $({ op: "card.update", cardId: f, update: { kind: "requery", query: da }, changeIndex: m }, `${u}.query`), R = !0;
1716
+ $({ op: "card.update", cardId: f, update: { kind: "requery", query: da }, changeIndex: m }, `${u}.query`), F = !0;
1708
1717
  }
1709
- fe.length && pa(ie(v, f).card, fe).changed.length && $({ op: "card.update", cardId: f, update: { kind: "relabel", labels: fe }, changeIndex: m }, `${u}.query`), (ne || fe.length) && Wt(ie(v, f).card, de, Y, u, N.title ?? "", Re, V);
1718
+ fe.length && pa(ie(I, f).card, fe).changed.length && $({ op: "card.update", cardId: f, update: { kind: "relabel", labels: fe }, changeIndex: m }, `${u}.query`), (ne || fe.length) && Wt(ie(I, f).card, de, Y, u, q.title ?? "", Fe, j);
1710
1719
  }
1711
- (r.query || T) && await L({ cardId: f, cardRef: r.cardId, stated: (P == null ? void 0 : P.calculations) ?? [], index: m, path: u }) && (R = !0), (r.title !== void 0 || r.description !== void 0) && $(
1720
+ (r.query || R) && await L({ cardId: f, cardRef: r.cardId, stated: (P == null ? void 0 : P.calculations) ?? [], index: m, path: u }) && (F = !0), (r.title !== void 0 || r.description !== void 0) && $(
1712
1721
  {
1713
1722
  op: "card.update",
1714
1723
  cardId: f,
@@ -1720,173 +1729,173 @@ async function fs(e, a, t, s) {
1720
1729
  changeIndex: m
1721
1730
  },
1722
1731
  u
1723
- ), await F({
1732
+ ), await N({
1724
1733
  cardId: f,
1725
1734
  cardRef: r.cardId,
1726
- request: { settings: j(r) },
1727
- queryLabels: D,
1735
+ request: { settings: V(r) },
1736
+ queryLabels: A,
1728
1737
  index: m,
1729
1738
  path: u
1730
- }), R && !c.includes(f) && c.push(f), d.push({ ref: r.cardId, kind: "card", id: f, title: C.title ?? "", changeIndex: m });
1739
+ }), F && !c.includes(f) && c.push(f), d.push({ ref: r.cardId, kind: "card", id: f, title: C.title ?? "", changeIndex: m });
1731
1740
  break;
1732
1741
  }
1733
1742
  case "card.remove": {
1734
- const f = oe(r.cardId, `${u}.cardId`), g = ie(v, f);
1735
- g || b({ code: "card_not_editable", message: "Cards in Document sections are removed in the editor.", path: `${u}.cardId`, fix: "Tell the user to remove it in the editor.", details: { reason: "document_section" } }), bt(g.frame) && g.frame.cards.length > 1 && b({ code: "card_not_editable", message: "This card is an input of a custom visual; remove it in the editor.", path: `${u}.cardId`, fix: "Tell the user to remove it in the editor.", details: { reason: "custom" } }), g.frame.visualId && g.frame.cards.length > 1 && o.push({
1743
+ const f = oe(r.cardId, `${u}.cardId`), b = ie(I, f);
1744
+ b || y({ code: "card_not_editable", message: "Cards in Document sections are removed in the editor.", path: `${u}.cardId`, fix: "Tell the user to remove it in the editor.", details: { reason: "document_section" } }), bt(b.frame) && b.frame.cards.length > 1 && y({ code: "card_not_editable", message: "This card is an input of a custom visual; remove it in the editor.", path: `${u}.cardId`, fix: "Tell the user to remove it in the editor.", details: { reason: "custom" } }), b.frame.visualId && b.frame.cards.length > 1 && o.push({
1736
1745
  code: "detaches_linked_visual",
1737
- message: `Removing "${g.card.title}" makes the rest of its tile local to this dashboard; it stops following its library visual.`,
1746
+ message: `Removing "${b.card.title}" makes the rest of its tile local to this dashboard; it stops following its library visual.`,
1738
1747
  path: u,
1739
- details: { cardIds: g.frame.cards.filter((C) => C.id !== f).map((C) => C.id) }
1740
- }), $({ op: "card.remove", cardId: f, changeIndex: m }, u), d.push({ ref: r.cardId, kind: "card", id: f, title: g.card.title ?? "", changeIndex: m });
1748
+ details: { cardIds: b.frame.cards.filter((C) => C.id !== f).map((C) => C.id) }
1749
+ }), $({ op: "card.remove", cardId: f, changeIndex: m }, u), d.push({ ref: r.cardId, kind: "card", id: f, title: b.card.title ?? "", changeIndex: m });
1741
1750
  break;
1742
1751
  }
1743
1752
  case "filter.add": {
1744
1753
  const f = await t.loadCardSource({ domainId: r.domainId, datasetName: r.datasetName });
1745
- f || b({ code: "field_not_found", message: `The dataset "${r.datasetName}" isn't available in this domain.`, path: `${u}.datasetName`, fix: "Find datasets with semaphor_list_datasets." });
1746
- const g = ot(f.fields, r.field, r.datasetName);
1747
- g || b({
1754
+ f || y({ code: "field_not_found", message: `The dataset "${r.datasetName}" isn't available in this domain.`, path: `${u}.datasetName`, fix: "Find datasets with semaphor_list_datasets." });
1755
+ const b = ot(f.fields, r.field, r.datasetName);
1756
+ b || y({
1748
1757
  code: "field_not_found",
1749
1758
  message: `"${r.field}" isn't a field of ${r.datasetName}.`,
1750
1759
  path: `${u}.field`,
1751
1760
  fix: "Use one of details.available, or read semaphor_get_dataset_schema.",
1752
1761
  details: { available: f.fields.slice(0, 20).map((P) => P.name) }
1753
1762
  });
1754
- const C = r.sheetIds ? Vt(r.sheetIds, u) : void 0, E = Ta(C), R = Go({
1755
- field: g,
1763
+ const C = r.sheetIds ? Vt(r.sheetIds, u) : void 0, O = Ta(C), F = Qo({
1764
+ field: b,
1756
1765
  dataSource: f.dataSource,
1757
1766
  connectionId: f.connectionId,
1758
1767
  connectionType: f.connectionType,
1759
- scope: E,
1760
- dashboard: v,
1768
+ scope: O,
1769
+ dashboard: I,
1761
1770
  createId: t.newId,
1762
1771
  label: r.label
1763
- }), D = { ...R.filter };
1764
- D.dateSelectionMode || (D.type = r.selection ?? "multiple"), r.defaultValues && (D.defaultValues = r.defaultValues), r.defaultPeriod && (D.defaultDateFilter = Fa(r.defaultPeriod, g, `${u}.defaultPeriod`, b)), $({ op: "filter.add", input: { ...R, filter: D }, changeIndex: m }, u), rt.set(R.id, { sheetIds: C ?? "all", changeIndex: m }), (r.defaultValues !== void 0 || r.defaultPeriod !== void 0) && dt.set(R.id, { values: r.defaultValues, period: r.defaultPeriod, changeIndex: m });
1765
- const T = r.handle;
1766
- T && (h.has(T) && b({ code: "invalid_change", message: `The handle ${T} is defined twice.`, path: `${u}.handle`, fix: "Give each new card, filter or sheet its own handle." }), h.set(T, { kind: "filter", id: R.id, title: r.label })), d.push({ ref: T ?? R.id, kind: "filter", id: R.id, title: r.label, changeIndex: m });
1772
+ }), A = { ...F.filter };
1773
+ A.dateSelectionMode || (A.type = r.selection ?? "multiple"), r.defaultValues && (A.defaultValues = r.defaultValues), r.defaultPeriod && (A.defaultDateFilter = Ra(r.defaultPeriod, b, `${u}.defaultPeriod`, y)), $({ op: "filter.add", input: { ...F, filter: A }, changeIndex: m }, u), rt.set(F.id, { sheetIds: C ?? "all", changeIndex: m }), (r.defaultValues !== void 0 || r.defaultPeriod !== void 0) && dt.set(F.id, { values: r.defaultValues, period: r.defaultPeriod, changeIndex: m });
1774
+ const R = r.handle;
1775
+ R && (h.has(R) && y({ code: "invalid_change", message: `The handle ${R} is defined twice.`, path: `${u}.handle`, fix: "Give each new card, filter or sheet its own handle." }), h.set(R, { kind: "filter", id: F.id, title: r.label })), d.push({ ref: R ?? F.id, kind: "filter", id: F.id, title: r.label, changeIndex: m });
1767
1776
  break;
1768
1777
  }
1769
1778
  case "filter.update": {
1770
- const f = te(r.filterId, `${u}.filterId`), g = Le(v, f, void 0, y);
1771
- g != null && g.editable || b({
1779
+ const f = te(r.filterId, `${u}.filterId`), b = Le(I, f, void 0, v);
1780
+ b != null && b.editable || y({
1772
1781
  code: "filter_not_editable",
1773
- message: g && !g.editable ? g.notEditable.message : "This filter can't be changed through the MCP.",
1782
+ message: b && !b.editable ? b.notEditable.message : "This filter can't be changed through the MCP.",
1774
1783
  path: `${u}.filterId`,
1775
1784
  fix: "Tell the user to change it in the editor; removing or excluding it works."
1776
1785
  });
1777
- const C = (v.inputs ?? []).find((P) => P.id === f);
1786
+ const C = (I.inputs ?? []).find((P) => P.id === f);
1778
1787
  if ((C == null ? void 0 : C.kind) !== "filter" || !C.filter) throw new me();
1779
- const E = { ...C.filter };
1780
- let R = !1;
1781
- r.selection && (E.type = r.selection), r.defaultValues !== void 0 && (R = !0, r.defaultValues === null ? delete E.defaultValues : E.defaultValues = r.defaultValues), r.defaultPeriod !== void 0 && (R = !0, r.defaultPeriod === null ? delete E.defaultDateFilter : E.defaultDateFilter = Fa(
1788
+ const O = { ...C.filter };
1789
+ let F = !1;
1790
+ r.selection && (O.type = r.selection), r.defaultValues !== void 0 && (F = !0, r.defaultValues === null ? delete O.defaultValues : O.defaultValues = r.defaultValues), r.defaultPeriod !== void 0 && (F = !0, r.defaultPeriod === null ? delete O.defaultDateFilter : O.defaultDateFilter = Ra(
1782
1791
  r.defaultPeriod,
1783
- { dataType: E.dataType },
1792
+ { dataType: O.dataType },
1784
1793
  `${u}.defaultPeriod`,
1785
- b
1794
+ y
1786
1795
  ));
1787
- const D = r.sheetIds === void 0 ? void 0 : r.sheetIds ? Vt(r.sheetIds, u) : "all", T = {
1796
+ const A = r.sheetIds === void 0 ? void 0 : r.sheetIds ? Vt(r.sheetIds, u) : "all", R = {
1788
1797
  ...r.label !== void 0 ? { label: r.label } : {},
1789
- ...r.selection !== void 0 || R ? { definition: E } : {},
1798
+ ...r.selection !== void 0 || F ? { definition: O } : {},
1790
1799
  // A change of sheets states the sheets; what else the scope says (the cards it leaves out,
1791
1800
  // whether it covers Document sheets) stays.
1792
- ...D ? { scope: qo(
1801
+ ...A ? { scope: No(
1793
1802
  C.scope,
1794
- Ta(D === "all" ? void 0 : D),
1795
- new Set([...Ot(v).values()].filter((P) => P.sheetKind === "document").map((P) => P.sheetId))
1803
+ Ta(A === "all" ? void 0 : A),
1804
+ new Set([...Ot(I).values()].filter((P) => P.sheetKind === "document").map((P) => P.sheetId))
1796
1805
  ) } : {},
1797
- ...R ? { values: { defaultChanged: !0, target: {} } } : {}
1806
+ ...F ? { values: { defaultChanged: !0, target: {} } } : {}
1798
1807
  };
1799
- $({ op: "filter.update", filterId: f, settings: T, changeIndex: m }, u), D && rt.set(f, { sheetIds: D, changeIndex: m }), R && dt.set(f, { values: r.defaultValues, period: r.defaultPeriod, changeIndex: m }), d.push({ ref: r.filterId, kind: "filter", id: f, title: C.label, changeIndex: m });
1808
+ $({ op: "filter.update", filterId: f, settings: R, changeIndex: m }, u), A && rt.set(f, { sheetIds: A, changeIndex: m }), F && dt.set(f, { values: r.defaultValues, period: r.defaultPeriod, changeIndex: m }), d.push({ ref: r.filterId, kind: "filter", id: f, title: C.label, changeIndex: m });
1800
1809
  break;
1801
1810
  }
1802
1811
  case "filter.remove": {
1803
- const f = te(r.filterId, `${u}.filterId`), g = ((zt = (v.inputs ?? []).find((C) => C.id === f)) == null ? void 0 : zt.label) ?? "";
1804
- $({ op: "filter.remove", filterId: f, changeIndex: m }, u), d.push({ ref: r.filterId, kind: "filter", id: f, title: g, changeIndex: m });
1812
+ const f = te(r.filterId, `${u}.filterId`), b = ((zt = (I.inputs ?? []).find((C) => C.id === f)) == null ? void 0 : zt.label) ?? "";
1813
+ $({ op: "filter.remove", filterId: f, changeIndex: m }, u), d.push({ ref: r.filterId, kind: "filter", id: f, title: b, changeIndex: m });
1805
1814
  break;
1806
1815
  }
1807
1816
  case "filter.bind": {
1808
- const f = te(r.filterId, `${u}.filterId`), g = Le(v, f, void 0, y);
1809
- g != null && g.editable || b({
1817
+ const f = te(r.filterId, `${u}.filterId`), b = Le(I, f, void 0, v);
1818
+ b != null && b.editable || y({
1810
1819
  code: "filter_not_editable",
1811
- message: g && !g.editable ? g.notEditable.message : "This filter can't be changed through the MCP.",
1820
+ message: b && !b.editable ? b.notEditable.message : "This filter can't be changed through the MCP.",
1812
1821
  path: `${u}.filterId`,
1813
1822
  fix: "Tell the user to change it in the editor; removing or excluding it works."
1814
1823
  });
1815
- const C = Bt(r.cardId, `${u}.cardId`), E = Ua(v, C).card, R = await ci(E, r.field, t, `${u}.field`, b);
1816
- $({ op: "filter.bind", filterId: f, cardId: C, binding: { kind: "bound", cardId: C, bindingId: t.newId(), target: R }, changeIndex: m }, u), d.push({ ref: r.filterId, kind: "filter", id: f, title: g.label, changeIndex: m });
1824
+ const C = Bt(r.cardId, `${u}.cardId`), O = Ua(I, C).card, F = await ui(O, r.field, t, `${u}.field`, y);
1825
+ $({ op: "filter.bind", filterId: f, cardId: C, binding: { kind: "bound", cardId: C, bindingId: t.newId(), target: F }, changeIndex: m }, u), d.push({ ref: r.filterId, kind: "filter", id: f, title: b.label, changeIndex: m });
1817
1826
  break;
1818
1827
  }
1819
1828
  case "layout.arrange": {
1820
- const f = r.sheetId ? Fe(r.sheetId, `${u}.sheetId`) : (() => {
1821
- const g = nt();
1822
- return g.length !== 1 && b({
1823
- code: g.length ? "sheet_required" : "sheet_not_a_grid",
1824
- message: g.length ? "This dashboard has several grid sheets; say which one to arrange." : "This dashboard has no grid sheet to arrange.",
1829
+ const f = r.sheetId ? Re(r.sheetId, `${u}.sheetId`) : (() => {
1830
+ const b = nt();
1831
+ return b.length !== 1 && y({
1832
+ code: b.length ? "sheet_required" : "sheet_not_a_grid",
1833
+ message: b.length ? "This dashboard has several grid sheets; say which one to arrange." : "This dashboard has no grid sheet to arrange.",
1825
1834
  path: `${u}.sheetId`,
1826
- fix: g.length ? "Send sheetId: one of details.sheets." : "Add a sheet with sheet.add earlier in this list.",
1835
+ fix: b.length ? "Send sheetId: one of details.sheets." : "Add a sheet with sheet.add earlier in this list.",
1827
1836
  details: { sheets: Be() }
1828
- }), g[0];
1837
+ }), b[0];
1829
1838
  })();
1830
1839
  $({ op: "layout.arrange", sheetId: f.id, ...r.keepOrder ? { keepOrder: !0 } : {}, changeIndex: m }, u);
1831
1840
  break;
1832
1841
  }
1833
1842
  case "layout.tabs": {
1834
- const f = r.cardIds.map((N, M) => oe(N, `${u}.cardIds[${M}]`)), g = (N, M, U = `${u}.cardIds`) => b({ code: "layout_invalid", message: N, path: U, fix: M });
1835
- new Set(f).size !== f.length && g("Each card is named once in tabs.", "Name two or more different cards, each once.");
1836
- const C = f.map((N, M) => ie(v, N) ?? g("A Document section's card can't be a tab.", "Name cards on a grid sheet.", `${u}.cardIds[${M}]`)), E = C[0].sheet;
1837
- C.some((N) => N.sheet.id !== E.id) && g("Tabs are cards on one sheet.", "Name cards on one sheet; a card moves to another sheet in the editor."), C.some((N) => bt(N.frame) && N.frame.cards.length > 1) && g("A custom visual's inputs stay in its spot.", "Name cards that aren't a custom visual's inputs, or arrange them in the editor.");
1838
- const R = C[0].frame, D = C[0].card;
1839
- d.push({ ref: r.cardIds[0], kind: "card", id: D.id, title: D.title ?? "", changeIndex: m });
1840
- const T = Ba(R);
1841
- if (f.every((N, M) => T[M] === N)) break;
1842
- const P = [...new Map(C.map((N) => [N.frame.id, N.frame])).values()].filter((N) => N.visualId);
1843
+ const f = r.cardIds.map((q, M) => oe(q, `${u}.cardIds[${M}]`)), b = (q, M, U = `${u}.cardIds`) => y({ code: "layout_invalid", message: q, path: U, fix: M });
1844
+ new Set(f).size !== f.length && b("Each card is named once in tabs.", "Name two or more different cards, each once.");
1845
+ const C = f.map((q, M) => ie(I, q) ?? b("A Document section's card can't be a tab.", "Name cards on a grid sheet.", `${u}.cardIds[${M}]`)), O = C[0].sheet;
1846
+ C.some((q) => q.sheet.id !== O.id) && b("Tabs are cards on one sheet.", "Name cards on one sheet; a card moves to another sheet in the editor."), C.some((q) => bt(q.frame) && q.frame.cards.length > 1) && b("A custom visual's inputs stay in its spot.", "Name cards that aren't a custom visual's inputs, or arrange them in the editor.");
1847
+ const F = C[0].frame, A = C[0].card;
1848
+ d.push({ ref: r.cardIds[0], kind: "card", id: A.id, title: A.title ?? "", changeIndex: m });
1849
+ const R = Ba(F);
1850
+ if (f.every((q, M) => R[M] === q)) break;
1851
+ const P = [...new Map(C.map((q) => [q.frame.id, q.frame])).values()].filter((q) => q.visualId);
1843
1852
  P.length && o.push({
1844
1853
  code: "detaches_linked_visual",
1845
1854
  message: "Moving these cards makes the tiles they leave or join local to this dashboard; they stop following their library visuals.",
1846
1855
  path: u,
1847
- details: { cardIds: P.flatMap((N) => N.cards.map((M) => M.id)) }
1848
- }), D.type === "kpi" && C.slice(1).some((N) => N.card.type === "text") && o.push({
1856
+ details: { cardIds: P.flatMap((q) => q.cards.map((M) => M.id)) }
1857
+ }), A.type === "kpi" && C.slice(1).some((q) => q.card.type === "text") && o.push({
1849
1858
  code: "tabs_show_as_kpi_info",
1850
- message: `A text card in ${Va(D.title)}'s spot shows as the KPI's info, not as a tab.`,
1859
+ message: `A text card in ${Va(A.title)}'s spot shows as the KPI's info, not as a tab.`,
1851
1860
  path: u,
1852
1861
  fix: "Put another card first if the text should be a tab of its own."
1853
- }), $({ op: "layout.tabs", sheetId: E.id, cardIds: f, changeIndex: m }, u);
1862
+ }), $({ op: "layout.tabs", sheetId: O.id, cardIds: f, changeIndex: m }, u);
1854
1863
  break;
1855
1864
  }
1856
1865
  case "layout.untab": {
1857
- const f = oe(r.cardId, `${u}.cardId`), g = ie(v, f);
1858
- if (g || b({ code: "layout_invalid", message: "A Document section's card has no spot of its own.", path: `${u}.cardId`, fix: "Name a card on a grid sheet." }), bt(g.frame) && g.frame.cards.length > 1 && b({ code: "layout_invalid", message: "A custom visual's inputs stay in its spot.", path: `${u}.cardId`, fix: "Arrange a custom visual in the editor." }), d.push({ ref: r.cardId, kind: "card", id: f, title: g.card.title ?? "", changeIndex: m }), g.frame.cards.length < 2) break;
1859
- g.frame.visualId && o.push({
1866
+ const f = oe(r.cardId, `${u}.cardId`), b = ie(I, f);
1867
+ if (b || y({ code: "layout_invalid", message: "A Document section's card has no spot of its own.", path: `${u}.cardId`, fix: "Name a card on a grid sheet." }), bt(b.frame) && b.frame.cards.length > 1 && y({ code: "layout_invalid", message: "A custom visual's inputs stay in its spot.", path: `${u}.cardId`, fix: "Arrange a custom visual in the editor." }), d.push({ ref: r.cardId, kind: "card", id: f, title: b.card.title ?? "", changeIndex: m }), b.frame.cards.length < 2) break;
1868
+ b.frame.visualId && o.push({
1860
1869
  code: "detaches_linked_visual",
1861
- message: `Taking "${g.card.title}" out of its tabs makes them local to this dashboard; they stop following their library visual.`,
1870
+ message: `Taking "${b.card.title}" out of its tabs makes them local to this dashboard; they stop following their library visual.`,
1862
1871
  path: u,
1863
- details: { cardIds: g.frame.cards.map((C) => C.id) }
1872
+ details: { cardIds: b.frame.cards.map((C) => C.id) }
1864
1873
  }), $({ op: "layout.untab", cardId: f, newFrameId: t.newId(), changeIndex: m }, u);
1865
1874
  break;
1866
1875
  }
1867
1876
  case "filter.exclude": {
1868
- const f = te(r.filterId, `${u}.filterId`), g = Bt(r.cardId, `${u}.cardId`), C = ((Yt = (v.inputs ?? []).find((E) => E.id === f)) == null ? void 0 : Yt.label) ?? "";
1869
- $({ op: "filter.exclude", filterId: f, cardId: g, changeIndex: m }, u), d.push({ ref: r.filterId, kind: "filter", id: f, title: C, changeIndex: m });
1877
+ const f = te(r.filterId, `${u}.filterId`), b = Bt(r.cardId, `${u}.cardId`), C = ((Yt = (I.inputs ?? []).find((O) => O.id === f)) == null ? void 0 : Yt.label) ?? "";
1878
+ $({ op: "filter.exclude", filterId: f, cardId: b, changeIndex: m }, u), d.push({ ref: r.filterId, kind: "filter", id: f, title: C, changeIndex: m });
1870
1879
  break;
1871
1880
  }
1872
1881
  case "highlight.add":
1873
1882
  case "highlight.remove": {
1874
- const f = oe(r.cardId, `${u}.cardId`), { card: g } = I(f, u), { op: C, cardId: E, ...R } = r, D = await F({
1883
+ const f = oe(r.cardId, `${u}.cardId`), { card: b } = g(f, u), { op: C, cardId: O, ...F } = r, A = await N({
1875
1884
  cardId: f,
1876
1885
  cardRef: r.cardId,
1877
- request: { highlights: r.op === "highlight.add" ? { add: [R] } : { remove: [r.ruleId] } },
1886
+ request: { highlights: r.op === "highlight.add" ? { add: [F] } : { remove: [r.ruleId] } },
1878
1887
  queryLabels: [],
1879
1888
  index: m,
1880
1889
  path: u
1881
- }), T = (Xt = (Jt = D == null ? void 0 : D.highlights) == null ? void 0 : Jt.add) == null ? void 0 : Xt[0];
1882
- d.push({ ref: r.cardId, kind: "card", id: f, title: g.title ?? "", changeIndex: m, ...T ? { ruleId: T.id } : {} });
1890
+ }), R = (Xt = (Jt = A == null ? void 0 : A.highlights) == null ? void 0 : Jt.add) == null ? void 0 : Xt[0];
1891
+ d.push({ ref: r.cardId, kind: "card", id: f, title: b.title ?? "", changeIndex: m, ...R ? { ruleId: R.id } : {} });
1883
1892
  break;
1884
1893
  }
1885
1894
  case "sheet.add": {
1886
1895
  const f = t.newId();
1887
1896
  $({ op: "sheet.add", sheet: { id: f, title: r.title }, changeIndex: m }, u);
1888
- const g = r.handle ?? `$sheet_${++q}`;
1889
- h.has(g) && b({ code: "invalid_change", message: `The handle ${g} is defined twice.`, path: `${u}.handle`, fix: "Give each new card, filter or sheet its own handle." }), h.set(g, { kind: "sheet", id: f, title: r.title }), d.push({ ref: g, kind: "sheet", id: f, title: r.title, changeIndex: m });
1897
+ const b = r.handle ?? `$sheet_${++E}`;
1898
+ h.has(b) && y({ code: "invalid_change", message: `The handle ${b} is defined twice.`, path: `${u}.handle`, fix: "Give each new card, filter or sheet its own handle." }), h.set(b, { kind: "sheet", id: f, title: r.title }), d.push({ ref: b, kind: "sheet", id: f, title: r.title, changeIndex: m });
1890
1899
  break;
1891
1900
  }
1892
1901
  case "sheet.update": {
@@ -1895,12 +1904,12 @@ async function fs(e, a, t, s) {
1895
1904
  break;
1896
1905
  }
1897
1906
  case "dashboard.update": {
1898
- const f = r.title !== void 0 && r.title !== v.title ? r.title : void 0, g = r.description === null ? v.description ? null : void 0 : r.description !== v.description ? r.description : void 0;
1899
- (f !== void 0 || g !== void 0) && $(
1907
+ const f = r.title !== void 0 && r.title !== I.title ? r.title : void 0, b = r.description === null ? I.description ? null : void 0 : r.description !== I.description ? r.description : void 0;
1908
+ (f !== void 0 || b !== void 0) && $(
1900
1909
  {
1901
1910
  op: "dashboard.update",
1902
1911
  ...f !== void 0 ? { title: f } : {},
1903
- ...g !== void 0 ? { description: g } : {},
1912
+ ...b !== void 0 ? { description: b } : {},
1904
1913
  changeIndex: m
1905
1914
  },
1906
1915
  u
@@ -1908,19 +1917,19 @@ async function fs(e, a, t, s) {
1908
1917
  break;
1909
1918
  }
1910
1919
  case "dashboard.style": {
1911
- const { op: f, ...g } = r;
1920
+ const { op: f, ...b } = r;
1912
1921
  w ?? (w = t.readOrganizationAppearance ? t.readOrganizationAppearance() : Promise.resolve(null));
1913
- const { style: C, organizationAppearance: E } = za(v, await w), R = nn({ style: C, edit: g, layers: { organizationAppearance: E } });
1914
- if (R.ok)
1915
- R.sentences.length && $({ op: "dashboard.style", style: R.style, sentences: R.sentences, changeIndex: m }, u);
1922
+ const { style: C, organizationAppearance: O } = za(I, await w), F = rn({ style: C, edit: b, layers: { organizationAppearance: O } });
1923
+ if (F.ok)
1924
+ F.sentences.length && $({ op: "dashboard.style", style: F.style, sentences: F.sentences, changeIndex: m }, u);
1916
1925
  else {
1917
- const { refusal: D } = R;
1918
- b({ code: D.code, message: D.message, path: D.field === "edit" ? u : `${u}.${D.field}`, fix: D.fix });
1926
+ const { refusal: A } = F;
1927
+ y({ code: A.code, message: A.message, path: A.field === "edit" ? u : `${u}.${A.field}`, fix: A.fix });
1919
1928
  }
1920
1929
  break;
1921
1930
  }
1922
1931
  case "variable.add": {
1923
- Je(v, r.name) && b({ code: "variable_name_taken", message: `A variable named ${r.name} is already on this dashboard.`, path: `${u}.name`, fix: "Choose another name, or change it with variable.update." });
1932
+ Je(I, r.name) && y({ code: "variable_name_taken", message: `A variable named ${r.name} is already on this dashboard.`, path: `${u}.name`, fix: "Choose another name, or change it with variable.update." });
1924
1933
  const f = await wa(
1925
1934
  {
1926
1935
  id: t.newId(),
@@ -1932,24 +1941,24 @@ async function fs(e, a, t, s) {
1932
1941
  ...r.emptyText ? { emptyText: r.emptyText } : {},
1933
1942
  path: u
1934
1943
  },
1935
- v,
1944
+ I,
1936
1945
  Te
1937
1946
  );
1938
1947
  $({ op: "variable.add", variable: f, changeIndex: m }, u), d.push({ ref: r.name, kind: "variable", id: f.id, title: f.name, changeIndex: m });
1939
1948
  break;
1940
1949
  }
1941
1950
  case "variable.update": {
1942
- const f = Hn(v, r.name, `${u}.name`, Te), g = r.rename ?? f.name, C = {
1951
+ const f = zn(I, r.name, `${u}.name`, Te), b = r.rename ?? f.name, C = {
1943
1952
  ...r.rename !== void 0 ? { name: r.rename } : {},
1944
1953
  ...r.label !== void 0 ? { label: r.label } : {},
1945
1954
  ...r.presentation !== void 0 ? { presentation: r.presentation } : {},
1946
1955
  ...r.emptyText !== void 0 ? { emptyText: r.emptyText } : {}
1947
- }, E = { ...v, variables: (v.variables ?? []).filter((T) => T.id !== f.id) };
1956
+ }, O = { ...I, variables: (I.variables ?? []).filter((R) => R.id !== f.id) };
1948
1957
  if (r.query) {
1949
- const T = await wa(
1958
+ const R = await wa(
1950
1959
  {
1951
1960
  id: f.id,
1952
- name: g,
1961
+ name: b,
1953
1962
  label: r.label === null ? void 0 : r.label ?? f.label,
1954
1963
  query: r.query,
1955
1964
  get: r.get ?? f.get,
@@ -1957,36 +1966,36 @@ async function fs(e, a, t, s) {
1957
1966
  emptyText: r.emptyText === null ? void 0 : r.emptyText ?? f.emptyText,
1958
1967
  path: u
1959
1968
  },
1960
- E,
1969
+ O,
1961
1970
  Te
1962
1971
  );
1963
- C.query = T.query, C.get = T.get;
1972
+ C.query = R.query, C.get = R.get;
1964
1973
  } else if (r.get !== void 0) {
1965
- const T = Jn(f, r.get, E, Te, u);
1966
- C.query = T.query, C.get = T.get;
1974
+ const R = Xn(f, r.get, O, Te, u);
1975
+ C.query = R.query, C.get = R.get;
1967
1976
  }
1968
- Object.keys(C).length || b({ code: "invalid_change", message: `variable.update on ${f.name} changes nothing.`, path: u, fix: "Send rename, label, query, get, presentation or emptyText." });
1969
- const R = { ...f, ...Object.fromEntries(Object.entries(C).map(([T, P]) => [T, P ?? void 0])), id: f.id }, D = Dt(R, { ...E, variables: [...E.variables, R] });
1970
- D.length && B(cs(D, u)), $({ op: "variable.update", variableId: f.id, patch: C, changeIndex: m }, u), d.push({ ref: r.name, kind: "variable", id: f.id, title: g, changeIndex: m });
1977
+ Object.keys(C).length || y({ code: "invalid_change", message: `variable.update on ${f.name} changes nothing.`, path: u, fix: "Send rename, label, query, get, presentation or emptyText." });
1978
+ const F = { ...f, ...Object.fromEntries(Object.entries(C).map(([R, P]) => [R, P ?? void 0])), id: f.id }, A = Dt(F, { ...O, variables: [...O.variables, F] });
1979
+ A.length && B(cs(A, u)), $({ op: "variable.update", variableId: f.id, patch: C, changeIndex: m }, u), d.push({ ref: r.name, kind: "variable", id: f.id, title: b, changeIndex: m });
1971
1980
  break;
1972
1981
  }
1973
1982
  case "variable.remove": {
1974
- const f = Je(v, r.name);
1975
- f || b(ls(v, r.name, `${u}.name`));
1976
- const g = f, C = Xn(v, g.id);
1977
- C.places.length && b({
1983
+ const f = Je(I, r.name);
1984
+ f || y(ls(I, r.name, `${u}.name`));
1985
+ const b = f, C = Zn(I, b.id);
1986
+ C.places.length && y({
1978
1987
  code: "variable_in_use",
1979
- message: `${g.name} is shown in ${C.words}.`,
1988
+ message: `${b.name} is shown in ${C.words}.`,
1980
1989
  path: `${u}.name`,
1981
1990
  fix: "Remove its chips first (card.update with text, or document.text.update), or ask the user whether the chips should read as missing.",
1982
1991
  details: { places: C.places }
1983
- }), $({ op: "variable.remove", variableId: g.id, changeIndex: m }, u), d.push({ ref: r.name, kind: "variable", id: g.id, title: g.name, changeIndex: m });
1992
+ }), $({ op: "variable.remove", variableId: b.id, changeIndex: m }, u), d.push({ ref: r.name, kind: "variable", id: b.id, title: b.name, changeIndex: m });
1984
1993
  break;
1985
1994
  }
1986
1995
  case "document.text.update": {
1987
- const f = it(r.sheetId, `${u}.sheetId`, { grid: !1 }), { edit: g, unchanged: C } = Zn(r, v, f, u, Te);
1996
+ const f = it(r.sheetId, `${u}.sheetId`, { grid: !1 }), { edit: b, unchanged: C } = ei(r, I, f, u, Te);
1988
1997
  if (d.push({ ref: r.sheetId, kind: "sheet", id: f.id, title: f.title ?? "", changeIndex: m }), C) break;
1989
- $({ op: "document.text", sheetId: f.id, edit: g, changeIndex: m }, u);
1998
+ $({ op: "document.text", sheetId: f.id, edit: b, changeIndex: m }, u);
1990
1999
  break;
1991
2000
  }
1992
2001
  default: {
@@ -2015,67 +2024,67 @@ async function fs(e, a, t, s) {
2015
2024
  for (const m of c) {
2016
2025
  const r = ie(ae.dashboard, m);
2017
2026
  if (!r) continue;
2018
- const u = ((ea = i.find((E) => Pt(E) === m)) == null ? void 0 : ea.changeIndex) ?? 0, f = Ce(r.card, { sql: !0 }), g = ((ta = qe(r.card)) == null ? void 0 : ta.type) ?? $t(r.card.type);
2019
- f.editable && ("sql" in f.query ? !!f.query.sql : "measures" in f.query ? f.query.measures.length > 0 : f.query.columns.length > 0) && ((aa = Ae[g]) == null ? void 0 : aa.forms.includes(tt(f.query))) || n.push({
2027
+ const u = ((ea = i.find((O) => Pt(O) === m)) == null ? void 0 : ea.changeIndex) ?? 0, f = Ce(r.card, { sql: !0 }), b = ((ta = qe(r.card)) == null ? void 0 : ta.type) ?? $t(r.card.type);
2028
+ f.editable && ("sql" in f.query ? !!f.query.sql : "measures" in f.query ? f.query.measures.length > 0 : f.query.columns.length > 0) && ((aa = Ae[b]) == null ? void 0 : aa.forms.includes(tt(f.query))) || n.push({
2020
2029
  code: "type_not_supported",
2021
- message: `As changed, "${r.card.title}" would have no query a ${g.replace(/_/g, " ")} can run.`,
2030
+ message: `As changed, "${r.card.title}" would have no query a ${b.replace(/_/g, " ")} can run.`,
2022
2031
  path: `changes[${u}]`,
2023
- fix: `Send a complete query with the type change: ${((sa = Ae[g]) == null ? void 0 : sa.forms.map((E) => Ue[E]).join(" or ")) ?? "a measures query"}.`
2032
+ fix: `Send a complete query with the type change: ${((sa = Ae[b]) == null ? void 0 : sa.forms.map((O) => Ue[O]).join(" or ")) ?? "a measures query"}.`
2024
2033
  });
2025
2034
  }
2026
- if (n.push(...oi(e, ae.dashboard, i, rt, y)), n.push(...ni(ae.dashboard, dt, t.calendar)), n.length) return { ok: !1, problems: n };
2035
+ if (n.push(...ni(e, ae.dashboard, i, rt, v)), n.push(...ii(ae.dashboard, dt, t.calendar)), n.length) return { ok: !1, problems: n };
2027
2036
  for (const m of i) {
2028
2037
  if (m.op !== "filter.add" && !(m.op === "filter.update" && m.settings.scope)) continue;
2029
- const r = m.op === "filter.add" ? m.input.id : m.filterId, u = Le(ae.dashboard, r, void 0, y);
2038
+ const r = m.op === "filter.add" ? m.input.id : m.filterId, u = Le(ae.dashboard, r, void 0, v);
2030
2039
  if (!(u != null && u.editable)) continue;
2031
- const f = async (R) => {
2032
- const D = [];
2033
- for (const T of R) {
2034
- const P = T.datasetName ? await t.findRelationshipFields({
2040
+ const f = async (F) => {
2041
+ const A = [];
2042
+ for (const R of F) {
2043
+ const P = R.datasetName ? await t.findRelationshipFields({
2035
2044
  domainId: u.domainId,
2036
2045
  fromDataset: u.datasetName,
2037
2046
  field: u.field,
2038
- toDataset: T.datasetName
2047
+ toDataset: R.datasetName
2039
2048
  }) : [];
2040
- D.push({ ...T, suggestedFields: P });
2049
+ A.push({ ...R, suggestedFields: P });
2041
2050
  }
2042
- return D;
2043
- }, g = (R) => R.map((D) => `"${D.title}"`).join(", "), C = u.notReached.filter((R) => R.reason === "sql_no_filter_reference"), E = u.notReached.filter((R) => R.reason !== "sql_no_filter_reference");
2051
+ return A;
2052
+ }, b = (F) => F.map((A) => `"${A.title}"`).join(", "), C = u.notReached.filter((F) => F.reason === "sql_no_filter_reference"), O = u.notReached.filter((F) => F.reason !== "sql_no_filter_reference");
2044
2053
  if (C.length && o.push({
2045
2054
  code: "filter_not_reaching_cards",
2046
- message: `"${u.label}" doesn't reach ${C.length} SQL card${C.length === 1 ? "" : "s"} whose SQL doesn't use dashboard filters: ${g(C)}.`,
2055
+ message: `"${u.label}" doesn't reach ${C.length} SQL card${C.length === 1 ? "" : "s"} whose SQL doesn't use dashboard filters: ${b(C)}.`,
2047
2056
  path: `changes[${m.changeIndex ?? 0}]`,
2048
2057
  fix: "To filter a SQL card, add {{ filters | where }} to its SQL (or {{ filters | and }} after an existing WHERE) with card.update, or leave it unfiltered.",
2049
2058
  details: { cards: C }
2050
- }), E.length) {
2051
- const R = await f(E);
2059
+ }), O.length) {
2060
+ const F = await f(O);
2052
2061
  o.push({
2053
2062
  code: "filter_not_reaching_cards",
2054
- message: `"${u.label}" doesn't reach ${R.length} card${R.length === 1 ? "" : "s"} on its sheets: ${g(R)}.`,
2063
+ message: `"${u.label}" doesn't reach ${F.length} card${F.length === 1 ? "" : "s"} on its sheets: ${b(F)}.`,
2055
2064
  path: `changes[${m.changeIndex ?? 0}]`,
2056
2065
  fix: "Add filter.bind with one of the suggested fields to reach a card, or leave it unfiltered.",
2057
- details: { cards: R }
2066
+ details: { cards: F }
2058
2067
  });
2059
2068
  }
2060
2069
  if ((oa = u.sqlPending) != null && oa.length && o.push({
2061
2070
  code: "filter_reach_through_sql",
2062
- message: `"${u.label}" may reach ${u.sqlPending.length} SQL card${u.sqlPending.length === 1 ? "" : "s"} as ${u.sqlPending.length === 1 ? "its" : "their"} SQL decides: ${g(u.sqlPending)}.`,
2071
+ message: `"${u.label}" may reach ${u.sqlPending.length} SQL card${u.sqlPending.length === 1 ? "" : "s"} as ${u.sqlPending.length === 1 ? "its" : "their"} SQL decides: ${b(u.sqlPending)}.`,
2063
2072
  path: `changes[${m.changeIndex ?? 0}]`,
2064
2073
  fix: "Read the card's SQL to tell the user whether it uses this filter.",
2065
2074
  details: { cards: u.sqlPending }
2066
2075
  }), (na = u.relationshipPending) != null && na.length) {
2067
- const R = await f(u.relationshipPending);
2076
+ const F = await f(u.relationshipPending);
2068
2077
  o.push({
2069
2078
  code: "filter_reach_through_relationships",
2070
- message: `"${u.label}" may reach ${R.length} card${R.length === 1 ? "" : "s"} on its sheets through the domain's relationships: ${g(R)}. Whether it applies is decided when each card runs.`,
2079
+ message: `"${u.label}" may reach ${F.length} card${F.length === 1 ? "" : "s"} on its sheets through the domain's relationships: ${b(F)}. Whether it applies is decided when each card runs.`,
2071
2080
  path: `changes[${m.changeIndex ?? 0}]`,
2072
2081
  fix: "Add filter.bind with one of the suggested fields to make it certain, or leave it to the relationships.",
2073
- details: { cards: R }
2082
+ details: { cards: F }
2074
2083
  });
2075
2084
  }
2076
2085
  }
2077
2086
  if (t.readComparisonDates)
2078
- for (const [m, r] of S) {
2087
+ for (const [m, r] of k) {
2079
2088
  const u = (ia = ie(ae.dashboard, m)) == null ? void 0 : ia.card;
2080
2089
  if (!u) continue;
2081
2090
  const f = await t.readComparisonDates({ card: u, dashboard: ae.dashboard });
@@ -2086,7 +2095,7 @@ async function fs(e, a, t, s) {
2086
2095
  fix: "Add a timeWindow on that date, or a dashboard date filter that reaches the card."
2087
2096
  });
2088
2097
  }
2089
- const Is = ti(ae.dashboard, i, ae.descriptions, y);
2098
+ const Is = ai(ae.dashboard, i, ae.descriptions, v);
2090
2099
  return {
2091
2100
  ok: !0,
2092
2101
  operations: i,
@@ -2100,7 +2109,7 @@ async function fs(e, a, t, s) {
2100
2109
  warnings: o
2101
2110
  };
2102
2111
  }
2103
- function ti(e, a, t, s) {
2112
+ function ai(e, a, t, s) {
2104
2113
  const n = a.filter((l) => l.op === "card.add");
2105
2114
  if (!n.length) return [...t];
2106
2115
  const o = as(e, void 0, s);
@@ -2110,24 +2119,24 @@ function ti(e, a, t, s) {
2110
2119
  const c = Pt(l);
2111
2120
  if (!c || l.changeIndex === void 0) continue;
2112
2121
  const h = o.filter((_) => _.reaches.includes(c)).map((_) => _.label), p = (_) => o.filter(
2113
- (k) => {
2114
- var b;
2115
- return "notReached" in k && ((b = k.notReached) == null ? void 0 : b.some((O) => O.cardId === c && O.reason === "sql_no_filter_reference" === _));
2122
+ (S) => {
2123
+ var y;
2124
+ return "notReached" in S && ((y = S.notReached) == null ? void 0 : y.some((D) => D.cardId === c && D.reason === "sql_no_filter_reference" === _));
2116
2125
  }
2117
- ).map((k) => k.label), y = p(!1), v = p(!0), w = o.filter((_) => {
2118
- var k;
2119
- return (k = _.relationshipPending) == null ? void 0 : k.some((b) => b.cardId === c);
2126
+ ).map((S) => S.label), v = p(!1), I = p(!0), w = o.filter((_) => {
2127
+ var S;
2128
+ return (S = _.relationshipPending) == null ? void 0 : S.some((y) => y.cardId === c);
2120
2129
  }).map((_) => _.label), x = o.filter((_) => {
2121
- var k;
2122
- return (k = _.sqlPending) == null ? void 0 : k.some((b) => b.cardId === c);
2123
- }).map((_) => _.label), q = [
2130
+ var S;
2131
+ return (S = _.sqlPending) == null ? void 0 : S.some((y) => y.cardId === c);
2132
+ }).map((_) => _.label), E = [
2124
2133
  ...h.length ? [`The dashboard's ${i(h)} filter${h.length === 1 ? " applies" : "s apply"} to it.`] : [],
2125
- ...y.length ? [`${i(y)} ${y.length === 1 ? "doesn't" : "don't"} reach it.`] : [],
2126
- ...v.length ? [`${i(v)} ${v.length === 1 ? "doesn't" : "don't"} reach it: its SQL doesn't use dashboard filters.`] : [],
2134
+ ...v.length ? [`${i(v)} ${v.length === 1 ? "doesn't" : "don't"} reach it.`] : [],
2135
+ ...I.length ? [`${i(I)} ${I.length === 1 ? "doesn't" : "don't"} reach it: its SQL doesn't use dashboard filters.`] : [],
2127
2136
  ...w.length ? [`${i(w)} may reach it through the domain's relationships.`] : [],
2128
2137
  ...x.length ? [`${i(x)} may apply through its SQL.`] : []
2129
2138
  ];
2130
- q.length && d.set(l.changeIndex, q.join(" "));
2139
+ E.length && d.set(l.changeIndex, E.join(" "));
2131
2140
  }
2132
2141
  return t.map((l) => {
2133
2142
  const c = l.changeIndex === void 0 ? void 0 : d.get(l.changeIndex);
@@ -2139,25 +2148,25 @@ function Pt(e) {
2139
2148
  if (e.op === "card.update" || e.op === "card.remove") return e.cardId;
2140
2149
  if (e.op === "card.add") return (a = e.frame.cards[0]) == null ? void 0 : a.id;
2141
2150
  }
2142
- function ai(e) {
2151
+ function si(e) {
2143
2152
  return Object.fromEntries(
2144
- fo.flatMap((a) => e[a] === void 0 ? [] : [[a, e[a]]])
2153
+ mo.flatMap((a) => e[a] === void 0 ? [] : [[a, e[a]]])
2145
2154
  );
2146
2155
  }
2147
- function si(e, a) {
2156
+ function oi(e, a) {
2148
2157
  if (!a.length || !e.config) return e;
2149
2158
  const t = { ...e.config }, s = [];
2150
2159
  if (t.matrix) {
2151
- const o = t.matrix, i = bo(o), d = [...o.spec.rows, ...o.spec.columns], l = { ...o.presentation.levelLabels }, c = { ...o.presentation.measureLabels };
2160
+ const o = t.matrix, i = yo(o), d = [...o.spec.rows, ...o.spec.columns], l = { ...o.presentation.levelLabels }, c = { ...o.presentation.measureLabels };
2152
2161
  for (const { key: h, label: p } of a) {
2153
2162
  if (h.role === "metric") {
2154
- const y = i.measures.findIndex((v) => He(v, h));
2155
- if (y < 0) continue;
2156
- c[o.spec.measures[y].id] = p;
2163
+ const v = i.measures.findIndex((I) => He(I, h));
2164
+ if (v < 0) continue;
2165
+ c[o.spec.measures[v].id] = p;
2157
2166
  } else {
2158
- const y = i.levels.findIndex((v) => He(v, h));
2159
- if (y < 0) continue;
2160
- l[d[y].id] = p;
2167
+ const v = i.levels.findIndex((I) => He(I, h));
2168
+ if (v < 0) continue;
2169
+ l[d[v].id] = p;
2161
2170
  }
2162
2171
  s.push(h);
2163
2172
  }
@@ -2166,62 +2175,62 @@ function si(e, a) {
2166
2175
  const n = { metric: "metricColumns", group_by: "groupByColumns", detail: "detailColumns" };
2167
2176
  for (const { key: o, label: i } of a) {
2168
2177
  const d = [...t[n[o.role]] ?? []], l = Ka(o.role, d).findIndex((c) => He(c, o));
2169
- l < 0 || (d[l] = un(d[l], i), t[n[o.role]] = d, s.push(o));
2178
+ l < 0 || (d[l] = fn(d[l], i), t[n[o.role]] = d, s.push(o));
2170
2179
  }
2171
2180
  return { ...e, config: t, statedLabels: s };
2172
2181
  }
2173
- function oi(e, a, t, s, n) {
2174
- var q;
2182
+ function ni(e, a, t, s, n) {
2183
+ var E;
2175
2184
  const o = [], i = new Map(we(a).map((_) => [_.cardId, _])), d = Ot(a), l = $e(a), c = (_) => {
2176
- var k, b;
2177
- return ((b = (k = a.sheets) == null ? void 0 : k.find((O) => O.id === _)) == null ? void 0 : b.title) ?? _;
2178
- }, h = (_, k) => {
2179
- var b;
2180
- return ((b = [...t].reverse().find((O) => Pt(O) === k || "filterId" in O && O.filterId === _)) == null ? void 0 : b.changeIndex) ?? 0;
2181
- }, p = (_, k) => {
2182
- const b = l.findFilterInput({ inputId: _ }).input, O = i.get(k), $ = `"${O.card.title ?? ""}"`, F = `"${b.label}"`;
2183
- if (O.kind === "documentSectionCard")
2185
+ var S, y;
2186
+ return ((y = (S = a.sheets) == null ? void 0 : S.find((D) => D.id === _)) == null ? void 0 : y.title) ?? _;
2187
+ }, h = (_, S) => {
2188
+ var y;
2189
+ return ((y = [...t].reverse().find((D) => Pt(D) === S || "filterId" in D && D.filterId === _)) == null ? void 0 : y.changeIndex) ?? 0;
2190
+ }, p = (_, S) => {
2191
+ const y = l.findFilterInput({ inputId: _ }).input, D = i.get(S), $ = `"${D.card.title ?? ""}"`, N = `"${y.label}"`;
2192
+ if (D.kind === "documentSectionCard")
2184
2193
  return {
2185
2194
  reason: "document_section",
2186
2195
  message: `${$} is in a Document section, which takes only the filters its Document sheet shows.`,
2187
2196
  fix: "Tell the user to change where the filter shows in the editor."
2188
2197
  };
2189
- const I = d.get(O.sheetId);
2190
- if (I && !Ga(b, I))
2198
+ const g = d.get(D.sheetId);
2199
+ if (g && !Ga(y, g))
2191
2200
  return {
2192
2201
  reason: "outside_sheets",
2193
- message: `${F} isn't shown on "${c(O.sheetId)}", so it can't filter ${$}.`,
2202
+ message: `${N} isn't shown on "${c(D.sheetId)}", so it can't filter ${$}.`,
2194
2203
  fix: "Show it on that sheet first with filter.update sheetIds (null for every sheet), in the same proposal."
2195
2204
  };
2196
- const S = yo(b, O.card);
2197
- switch (S.status) {
2205
+ const k = vo(y, D.card);
2206
+ switch (k.status) {
2198
2207
  case "incompatible":
2199
- return { reason: "incompatible_field", message: `${$} can't take ${F}'s values on that field: their types differ.`, fix: "Bind a field of the same type (filter.bind)." };
2208
+ return { reason: "incompatible_field", message: `${$} can't take ${N}'s values on that field: their types differ.`, fix: "Bind a field of the same type (filter.bind)." };
2200
2209
  case "stale":
2201
2210
  return {
2202
2211
  reason: "field_not_on_card",
2203
- message: `${$} doesn't have the field ${F} is bound to.`,
2212
+ message: `${$} doesn't have the field ${N} is bound to.`,
2204
2213
  fix: "Bind a field the card has (filter.bind), or exclude the card (filter.exclude), in the same proposal."
2205
2214
  };
2206
2215
  case "ambiguous":
2207
2216
  return {
2208
2217
  reason: "ambiguous_field",
2209
- message: `${$} has more than one field ${F} could filter.`,
2218
+ message: `${$} has more than one field ${N} could filter.`,
2210
2219
  fix: "Bind the field it should use (filter.bind), or exclude the card (filter.exclude), in the same proposal."
2211
2220
  };
2212
2221
  case "relationship": {
2213
- const A = Ee(b, O.card, n);
2214
- return A.reach === "blocked" ? {
2222
+ const T = Ee(y, D.card, n);
2223
+ return T.reach === "blocked" ? {
2215
2224
  reason: "relationship_route_changed",
2216
- message: `The relationships ${$} used for ${F} changed in the domain.`,
2225
+ message: `The relationships ${$} used for ${N} changed in the domain.`,
2217
2226
  fix: "Tell the user to choose the relationship again in the filter's Cards tab."
2218
- } : A.reason === "relationship_ambiguous" ? {
2227
+ } : T.reason === "relationship_ambiguous" ? {
2219
2228
  reason: "relationship_ambiguous",
2220
- message: `${F} connects to ${$} through more than one path.`,
2229
+ message: `${N} connects to ${$} through more than one path.`,
2221
2230
  fix: "Tell the user to choose a path in the filter's Cards tab, or bind a field the card has (filter.bind)."
2222
2231
  } : {
2223
2232
  reason: "relationship_pending",
2224
- message: `${F} may reach ${$} through the domain's relationships; whether it applies is decided when the card runs.`,
2233
+ message: `${N} may reach ${$} through the domain's relationships; whether it applies is decided when the card runs.`,
2225
2234
  fix: "Bind a field the card has (filter.bind) to make it certain, or leave it to the relationships."
2226
2235
  };
2227
2236
  }
@@ -2232,22 +2241,22 @@ function oi(e, a, t, s, n) {
2232
2241
  case "automatic":
2233
2242
  case "passthrough":
2234
2243
  case "notApplicable":
2235
- return { reason: "filter_settings_override", message: `${F} still wouldn't filter ${$}: its settings leave that card out.`, fix: "Tell the user to change the filter's settings in the editor." };
2244
+ return { reason: "filter_settings_override", message: `${N} still wouldn't filter ${$}: its settings leave that card out.`, fix: "Tell the user to change the filter's settings in the editor." };
2236
2245
  default: {
2237
- const A = S;
2238
- throw new Error(`Unhandled filter card target ${String(A.status)}`);
2246
+ const T = k;
2247
+ throw new Error(`Unhandled filter card target ${String(T.status)}`);
2239
2248
  }
2240
2249
  }
2241
- }, y = /* @__PURE__ */ new Set(), v = /* @__PURE__ */ new Map();
2250
+ }, v = /* @__PURE__ */ new Set(), I = /* @__PURE__ */ new Map();
2242
2251
  for (const _ of t)
2243
- (_.op === "filter.bind" || _.op === "filter.exclude") && v.set(`${_.filterId}|${_.cardId}`, _);
2244
- for (const _ of v.values()) {
2245
- const k = Le(a, _.filterId, void 0, n), b = i.get(_.cardId);
2246
- if (!k || !b) continue;
2247
- const O = k.reaches.includes(_.cardId);
2248
- if (_.op === "filter.bind" ? O : !O) continue;
2249
- y.add(`${_.filterId}|${_.cardId}`);
2250
- const $ = _.op === "filter.bind" ? p(_.filterId, _.cardId) : { reason: "filter_settings_override", message: `"${k.label}" would still filter "${b.card.title ?? ""}".`, fix: "Tell the user to change the filter's settings in the editor." };
2252
+ (_.op === "filter.bind" || _.op === "filter.exclude") && I.set(`${_.filterId}|${_.cardId}`, _);
2253
+ for (const _ of I.values()) {
2254
+ const S = Le(a, _.filterId, void 0, n), y = i.get(_.cardId);
2255
+ if (!S || !y) continue;
2256
+ const D = S.reaches.includes(_.cardId);
2257
+ if (_.op === "filter.bind" ? D : !D) continue;
2258
+ v.add(`${_.filterId}|${_.cardId}`);
2259
+ const $ = _.op === "filter.bind" ? p(_.filterId, _.cardId) : { reason: "filter_settings_override", message: `"${S.label}" would still filter "${y.card.title ?? ""}".`, fix: "Tell the user to change the filter's settings in the editor." };
2251
2260
  o.push({
2252
2261
  code: "filter_not_editable",
2253
2262
  message: $.message,
@@ -2256,61 +2265,61 @@ function oi(e, a, t, s, n) {
2256
2265
  details: { reason: $.reason, cardId: _.cardId }
2257
2266
  });
2258
2267
  }
2259
- for (const [_, k] of s) {
2260
- const b = Le(a, _, void 0, n);
2261
- if (!b) continue;
2262
- const O = b.editable && ((q = b.exceptSheetIds) == null ? void 0 : q.some((I) => {
2263
- var S;
2264
- return ((S = d.get(I)) == null ? void 0 : S.sheetKind) === "dashboard";
2265
- })), $ = b.editable && !O ? b.sheetIds : void 0, F = k.sheetIds === "all" ? "all" : [...k.sheetIds].sort();
2266
- Pe($ === "all" || !$ ? $ : [...$].sort(), F) || o.push({
2268
+ for (const [_, S] of s) {
2269
+ const y = Le(a, _, void 0, n);
2270
+ if (!y) continue;
2271
+ const D = y.editable && ((E = y.exceptSheetIds) == null ? void 0 : E.some((g) => {
2272
+ var k;
2273
+ return ((k = d.get(g)) == null ? void 0 : k.sheetKind) === "dashboard";
2274
+ })), $ = y.editable && !D ? y.sheetIds : void 0, N = S.sheetIds === "all" ? "all" : [...S.sheetIds].sort();
2275
+ Pe($ === "all" || !$ ? $ : [...$].sort(), N) || o.push({
2267
2276
  code: "filter_not_editable",
2268
- message: `"${b.label}" wouldn't show on the sheets asked for. Change where it shows in the editor.`,
2269
- path: `changes[${k.changeIndex}].sheetIds`,
2277
+ message: `"${y.label}" wouldn't show on the sheets asked for. Change where it shows in the editor.`,
2278
+ path: `changes[${S.changeIndex}].sheetIds`,
2270
2279
  fix: "Tell the user to change the filter's sheets in the editor.",
2271
2280
  details: { reason: "filter_settings_override", ...$ ? { sheetIds: $ } : {} }
2272
2281
  });
2273
2282
  }
2274
2283
  const w = $e(e), x = (_) => _ === "blocked" || _ === "ambiguous";
2275
2284
  for (const _ of l.inputs) {
2276
- const k = _.input.id;
2277
- for (const b of l.reachedCards({ inputId: k })) {
2278
- if (y.has(`${k}|${b.cardId}`) || !x(Ee(_.input, b.card, n).reach)) continue;
2279
- const O = w.findFilterInput({ inputId: k }), $ = O && w.reachedCards({ inputId: k }).find((I) => I.cardId === b.cardId);
2280
- if (O && $ && x(Ee(O.input, $.card, n).reach)) continue;
2281
- const F = p(k, b.cardId);
2285
+ const S = _.input.id;
2286
+ for (const y of l.reachedCards({ inputId: S })) {
2287
+ if (v.has(`${S}|${y.cardId}`) || !x(Ee(_.input, y.card, n).reach)) continue;
2288
+ const D = w.findFilterInput({ inputId: S }), $ = D && w.reachedCards({ inputId: S }).find((g) => g.cardId === y.cardId);
2289
+ if (D && $ && x(Ee(D.input, $.card, n).reach)) continue;
2290
+ const N = p(S, y.cardId);
2282
2291
  o.push({
2283
2292
  code: "invalid_change",
2284
- message: `${F.message} The card would stop showing data while "${_.input.label}" has a value.`,
2285
- path: `changes[${h(k, b.cardId)}]`,
2286
- fix: F.fix,
2287
- details: { reason: F.reason, filterId: k, cardId: b.cardId }
2293
+ message: `${N.message} The card would stop showing data while "${_.input.label}" has a value.`,
2294
+ path: `changes[${h(S, y.cardId)}]`,
2295
+ fix: N.fix,
2296
+ details: { reason: N.reason, filterId: S, cardId: y.cardId }
2288
2297
  });
2289
2298
  }
2290
2299
  }
2291
2300
  return o;
2292
2301
  }
2293
- function ni(e, a, t) {
2302
+ function ii(e, a, t) {
2294
2303
  const s = [], n = $e(e);
2295
2304
  for (const [o, i] of a) {
2296
2305
  const d = n.findFilterInput({ inputId: o });
2297
2306
  if (!d) continue;
2298
- const l = Ha({ dashboard: e, target: { kind: "dashboardInput", input: d.input, scope: {} }, calendar: t }).value, c = d.input.filter.dateSelectionMode, h = c === "day" ? "its date picker takes one day" : void 0, p = (y, v) => s.push({
2307
+ const l = Ha({ dashboard: e, target: { kind: "dashboardInput", input: d.input, scope: {} }, calendar: t }).value, c = d.input.filter.dateSelectionMode, h = c === "day" ? "its date picker takes one day" : void 0, p = (v, I) => s.push({
2299
2308
  code: "filter_not_editable",
2300
- message: y,
2309
+ message: v,
2301
2310
  path: `changes[${i.changeIndex}]`,
2302
- fix: v,
2311
+ fix: I,
2303
2312
  details: { reason: "default_not_applied", ...c ? { datePicker: c } : {} }
2304
2313
  });
2305
2314
  if (i.period) {
2306
- const y = Ja(l && "relativeMeta" in l ? l.relativeMeta : void 0);
2307
- (!y || en(i.period) || !tn(y, i.period)) && p(
2315
+ const v = Ja(l && "relativeMeta" in l ? l.relativeMeta : void 0);
2316
+ (!v || tn(i.period) || !an(v, i.period)) && p(
2308
2317
  `"${d.input.label}" wouldn't load with that default${h ? `: ${h}` : ""}.`,
2309
2318
  h ? "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."
2310
2319
  );
2311
2320
  } else if (i.values) {
2312
- const y = (v) => JSON.stringify((v ?? []).map(String).sort());
2313
- (!l || y(l.values) !== y(i.values)) && p(`"${d.input.label}" wouldn't load with those values.`, "Tell the user to change the filter's default in the editor.");
2321
+ const v = (I) => JSON.stringify((I ?? []).map(String).sort());
2322
+ (!l || v(l.values) !== v(i.values)) && p(`"${d.input.label}" wouldn't load with those values.`, "Tell the user to change the filter's default in the editor.");
2314
2323
  } else
2315
2324
  (Ya(d.input.filter.dataType) ? i.period === null : i.values === null) && l && p(`"${d.input.label}" would still load with a default.`, "Tell the user to change the filter's default in the editor.");
2316
2325
  }
@@ -2328,10 +2337,10 @@ function yt(e) {
2328
2337
  }
2329
2338
  function ka(e) {
2330
2339
  var t, s;
2331
- const a = (s = (t = e.config) == null ? void 0 : t.groupByColumns) == null ? void 0 : s.find((n) => ro(n.dataType || "") === "date");
2340
+ const a = (s = (t = e.config) == null ? void 0 : t.groupByColumns) == null ? void 0 : s.find((n) => lo(n.dataType || "") === "date");
2332
2341
  return { comparisonDate: a ? { name: a.name, label: a.label || a.name } : null, dateWindow: "unknown" };
2333
2342
  }
2334
- function ii(e, a) {
2343
+ function ri(e, a) {
2335
2344
  if ("sql" in a) return [];
2336
2345
  const t = e, s = (...o) => new Set(o.flatMap((i) => Array.isArray(i) ? i : i ? [i] : []).map((i) => be(i, a.datasetName))), n = {
2337
2346
  metric: s(t.measures),
@@ -2340,11 +2349,11 @@ function ii(e, a) {
2340
2349
  };
2341
2350
  return Ne(a).filter((o) => n[o.key.role].has(o.key.field));
2342
2351
  }
2343
- function ri(e, a, t, s) {
2352
+ function di(e, a, t, s) {
2344
2353
  const n = Object.fromEntries(Object.entries(a).filter(([, p]) => p != null)), o = tt(n), i = tt(e), d = (p) => Sa[p].safeParse(n);
2345
2354
  if (!e || o && o !== i) {
2346
- const p = o ?? i, y = p ? d(p) : void 0;
2347
- return y != null && y.success ? y.data : s({
2355
+ const p = o ?? i, v = p ? d(p) : void 0;
2356
+ return v != null && v.success ? v.data : s({
2348
2357
  code: e ? "query_form_mismatch" : "type_not_supported",
2349
2358
  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.",
2350
2359
  path: t,
@@ -2352,8 +2361,8 @@ function ri(e, a, t, s) {
2352
2361
  });
2353
2362
  }
2354
2363
  const l = { ...e };
2355
- for (const [p, y] of Object.entries(a))
2356
- y !== void 0 && (y === null ? delete l[p] : l[p] = y);
2364
+ for (const [p, v] of Object.entries(a))
2365
+ v !== void 0 && (v === null ? delete l[p] : l[p] = v);
2357
2366
  const c = ms(e, a);
2358
2367
  c && delete l.timeWindow;
2359
2368
  const h = Sa[i].safeParse(l);
@@ -2375,11 +2384,11 @@ function ms(e, a) {
2375
2384
  function Ta(e) {
2376
2385
  return e ? { kind: "sheets", sheetIds: e } : { kind: "allSheets", sheetKinds: ["dashboard"] };
2377
2386
  }
2378
- function Fa(e, a, t, s) {
2379
- return ["date", "datetime", "timestamp"].some((i) => Tt(a.dataType).includes(i)) || s({ code: "invalid_change", message: "defaultPeriod is for date filters.", path: t, fix: "Use defaultValues for this field." }), hs(e, { use: "filterDefault", columnHasTime: di(a) }, t, s);
2387
+ function Ra(e, a, t, s) {
2388
+ return ["date", "datetime", "timestamp"].some((i) => Tt(a.dataType).includes(i)) || s({ code: "invalid_change", message: "defaultPeriod is for date filters.", path: t, fix: "Use defaultValues for this field." }), hs(e, { use: "filterDefault", columnHasTime: li(a) }, t, s);
2380
2389
  }
2381
2390
  function hs(e, a, t, s) {
2382
- const n = an(e, a);
2391
+ const n = sn(e, a);
2383
2392
  return n.ok ? n.window : s({
2384
2393
  code: "invalid_change",
2385
2394
  message: n.refusal.message,
@@ -2387,15 +2396,15 @@ function hs(e, a, t, s) {
2387
2396
  path: n.refusal.path ? `${t}.${n.refusal.path}` : t
2388
2397
  });
2389
2398
  }
2390
- function di(e) {
2399
+ function li(e) {
2391
2400
  return qa({ dataType: e.dataType }) === "datetime";
2392
2401
  }
2393
- function li(e) {
2402
+ function ci(e) {
2394
2403
  var a, t, s;
2395
2404
  return (s = (t = (a = e == null ? void 0 : e.filters) == null ? void 0 : a.conditions) == null ? void 0 : t.find((n) => n.relativeMeta)) == null ? void 0 : s.field;
2396
2405
  }
2397
- async function ci(e, a, t, s, n) {
2398
- const o = so(e), i = o.kind === "config" ? o.executableSources : o.kind === "sql" ? o.pinnedCatalogSources.map((w) => w.source) : [], d = he(e), l = typeof a == "string" ? (d == null ? void 0 : d.kind) === "semantic" ? d.datasetName : void 0 : a.datasetName, c = i.find((w) => w.kind === "semantic" && Tt(w.datasetName) === Tt(l));
2406
+ async function ui(e, a, t, s, n) {
2407
+ const o = oo(e), i = o.kind === "config" ? o.executableSources : o.kind === "sql" ? o.pinnedCatalogSources.map((w) => w.source) : [], d = he(e), l = typeof a == "string" ? (d == null ? void 0 : d.kind) === "semantic" ? d.datasetName : void 0 : a.datasetName, c = i.find((w) => w.kind === "semantic" && Tt(w.datasetName) === Tt(l));
2399
2408
  if (!c || c.kind !== "semantic")
2400
2409
  return n({
2401
2410
  code: "field_not_found",
@@ -2403,8 +2412,8 @@ async function ci(e, a, t, s, n) {
2403
2412
  path: s,
2404
2413
  fix: "Name a field of the card's own dataset, or { name, datasetName } for a dataset its query joins."
2405
2414
  });
2406
- const h = await t.loadCardSource({ domainId: c.domainId, datasetName: c.datasetName }), p = typeof a == "string" ? a : a.name, y = h ? ot(h.fields, p, c.datasetName) : void 0, v = y ? zo(c, { column_name: y.name, data_type: y.dataType, ...y.sourceField ? { sourceField: y.sourceField } : {} }) : void 0;
2407
- return v || n({
2415
+ const h = await t.loadCardSource({ domainId: c.domainId, datasetName: c.datasetName }), p = typeof a == "string" ? a : a.name, v = h ? ot(h.fields, p, c.datasetName) : void 0, I = v ? Yo(c, { column_name: v.name, data_type: v.dataType, ...v.sourceField ? { sourceField: v.sourceField } : {} }) : void 0;
2416
+ return I || n({
2408
2417
  code: "field_not_found",
2409
2418
  message: `"${p}" isn't a field of ${c.datasetName}.`,
2410
2419
  path: s,
@@ -2412,12 +2421,12 @@ async function ci(e, a, t, s, n) {
2412
2421
  details: { available: ((h == null ? void 0 : h.fields) ?? []).slice(0, 20).map((w) => w.name) }
2413
2422
  });
2414
2423
  }
2415
- const ui = {
2424
+ const fi = {
2416
2425
  max: ba,
2417
2426
  what: "A proposal that creates a dashboard",
2418
2427
  fix: `Create with the first ${ba}, then change the new dashboard in a second proposal.`
2419
2428
  };
2420
- async function Ar(e, a) {
2429
+ async function Dr(e, a) {
2421
2430
  const t = (d) => d && typeof d == "object" ? d.op : void 0, s = e.changes.flatMap(
2422
2431
  (d, l) => t(d) === "dashboard.update" ? [
2423
2432
  {
@@ -2429,12 +2438,12 @@ async function Ar(e, a) {
2429
2438
  ] : []
2430
2439
  );
2431
2440
  if (s.length) return { ok: !1, problems: s };
2432
- const n = mi(e, a), o = await fs(n, e.changes, a, { limit: ui });
2441
+ const n = hi(e, a), o = await fs(n, e.changes, a, { limit: fi });
2433
2442
  if (!o.ok) return o;
2434
- const i = fi(o, e.changes);
2435
- return { ...i, seed: n, sentence: hi(i.dashboard) };
2443
+ const i = mi(o, e.changes);
2444
+ return { ...i, seed: n, sentence: pi(i.dashboard) };
2436
2445
  }
2437
- function fi(e, a) {
2446
+ function mi(e, a) {
2438
2447
  if (a.some((o) => {
2439
2448
  if (!o || typeof o != "object") return !1;
2440
2449
  const { op: i } = o;
@@ -2451,7 +2460,7 @@ function fi(e, a) {
2451
2460
  descriptions: [...e.descriptions, ...n.descriptions]
2452
2461
  };
2453
2462
  }
2454
- function mi(e, a) {
2463
+ function hi(e, a) {
2455
2464
  const t = e.changes.some((s) => s && typeof s == "object" && s.op === "sheet.add");
2456
2465
  return {
2457
2466
  id: e.dashboardId,
@@ -2463,71 +2472,71 @@ function mi(e, a) {
2463
2472
  };
2464
2473
  }
2465
2474
  const vt = (e, a) => `${e} ${a}${e === 1 ? "" : "s"}`;
2466
- function hi(e) {
2475
+ function pi(e) {
2467
2476
  const a = e.sheets ?? [], t = a.reduce((o, i) => o + (i.frames ?? []).reduce((d, l) => {
2468
2477
  var c;
2469
2478
  return d + (((c = l.cards) == null ? void 0 : c.length) ?? 0);
2470
2479
  }, 0), 0), s = (e.inputs ?? []).filter((o) => o.kind === "filter").length, n = [vt(a.length, "sheet"), vt(t, "card"), ...s ? [vt(s, "filter")] : []];
2471
2480
  return `Creates a private dashboard ${Va(e.title)} with ${et(n)}.`;
2472
2481
  }
2473
- const pi = 50;
2474
- function Dr(e, a) {
2475
- var $, F;
2476
- const t = ($ = a.sheetIds) != null && $.length ? new Set(a.sheetIds) : void 0, s = (F = a.cardIds) != null && F.length ? new Set(a.cardIds) : void 0, n = (e.sheets ?? []).filter((I) => !t || t.has(I.id)), o = we(e).filter(
2477
- (I) => (!t || t.has(I.sheetId)) && (!s || s.has(I.cardId))
2478
- ), i = o.length > (a.maxQueryCards ?? pi), d = new Map(
2479
- (e.sheets ?? []).flatMap((I) => (I.frames ?? []).map((S) => [S.id, S]))
2480
- ), l = /* @__PURE__ */ new Map(), c = (I) => {
2481
- (I == null ? void 0 : I.kind) === "semantic" && l.set(`${I.domainId}|${I.datasetName}`, { domainId: I.domainId, datasetName: I.datasetName });
2482
+ const gi = 50;
2483
+ function Or(e, a) {
2484
+ var $, N;
2485
+ const t = ($ = a.sheetIds) != null && $.length ? new Set(a.sheetIds) : void 0, s = (N = a.cardIds) != null && N.length ? new Set(a.cardIds) : void 0, n = (e.sheets ?? []).filter((g) => !t || t.has(g.id)), o = we(e).filter(
2486
+ (g) => (!t || t.has(g.sheetId)) && (!s || s.has(g.cardId))
2487
+ ), i = o.length > (a.maxQueryCards ?? gi), d = new Map(
2488
+ (e.sheets ?? []).flatMap((g) => (g.frames ?? []).map((k) => [k.id, k]))
2489
+ ), l = /* @__PURE__ */ new Map(), c = (g) => {
2490
+ (g == null ? void 0 : g.kind) === "semantic" && l.set(`${g.domainId}|${g.datasetName}`, { domainId: g.domainId, datasetName: g.datasetName });
2482
2491
  }, h = new Map(
2483
- (e.sheets ?? []).map((I) => [I.id, _t({ dashboard: e, place: { kind: I.kind === "document" ? "document" : "sheet", sheetId: I.id } })])
2484
- ), p = (I) => ({ catalog: I, inputs: e.inputs, variables: e.variables }), y = (I) => p(h.get(I)), v = /* @__PURE__ */ new Map(), w = (I, S) => {
2485
- if (I.kind === "document") return y(I.id);
2486
- const A = _t({ dashboard: e, place: { kind: "sheet", sheetId: I.id, cardId: S } });
2487
- return v.set(`${I.id}:${S}`, A), p(A);
2488
- }, x = n.map((I) => ({
2489
- sheetId: I.id,
2490
- title: I.title ?? "",
2491
- kind: I.kind === "document" ? "document" : "dashboard",
2492
- ...I.kind === "document" ? bi(I, y(I.id)) : { layout: Ii(I) },
2493
- cards: o.filter((S) => S.sheetId === I.id).map((S) => {
2492
+ (e.sheets ?? []).map((g) => [g.id, _t({ dashboard: e, place: { kind: g.kind === "document" ? "document" : "sheet", sheetId: g.id } })])
2493
+ ), p = (g) => ({ catalog: g, inputs: e.inputs, variables: e.variables }), v = (g) => p(h.get(g)), I = /* @__PURE__ */ new Map(), w = (g, k) => {
2494
+ if (g.kind === "document") return v(g.id);
2495
+ const T = _t({ dashboard: e, place: { kind: "sheet", sheetId: g.id, cardId: k } });
2496
+ return I.set(`${g.id}:${k}`, T), p(T);
2497
+ }, x = n.map((g) => ({
2498
+ sheetId: g.id,
2499
+ title: g.title ?? "",
2500
+ kind: g.kind === "document" ? "document" : "dashboard",
2501
+ ...g.kind === "document" ? yi(g, v(g.id)) : { layout: _i(g) },
2502
+ cards: o.filter((k) => k.sheetId === g.id).map((k) => {
2494
2503
  var oe;
2495
- const A = S.card, L = S.kind === "frameCard" ? (oe = d.get(S.frameId)) == null ? void 0 : oe.visualId : void 0, j = L ? { linkedVisualId: L } : {}, K = { cardId: S.cardId, title: A.title ?? "" };
2496
- if (S.kind !== "frameCard") {
2497
- const te = he(A);
2504
+ const T = k.card, L = k.kind === "frameCard" ? (oe = d.get(k.frameId)) == null ? void 0 : oe.visualId : void 0, V = L ? { linkedVisualId: L } : {}, K = { cardId: k.cardId, title: T.title ?? "" };
2505
+ if (k.kind !== "frameCard") {
2506
+ const te = he(T);
2498
2507
  return c(te), {
2499
2508
  ...K,
2500
- ...Ge(A),
2509
+ ...Ge(T),
2501
2510
  ...te ? { source: te } : {},
2502
2511
  editable: !1,
2503
- notEditable: S.kind === "documentSectionCard" ? { reason: "document_section", message: "Cards in Document sections can't be changed through the MCP yet. Change them in the editor." } : {
2512
+ notEditable: k.kind === "documentSectionCard" ? { reason: "document_section", message: "Cards in Document sections can't be changed through the MCP yet. Change them in the editor." } : {
2504
2513
  reason: "not_expressible",
2505
2514
  message: "This card isn't in a tile, so it can't be changed through the MCP. Change it in the editor.",
2506
2515
  detail: "a card outside a tile"
2507
2516
  }
2508
2517
  };
2509
2518
  }
2510
- if (A.type === "text") {
2511
- const te = ja(A, w(I, A.id));
2512
- return te.editable ? { ...K, type: "text", ...j, editable: !0, text: te.text, ...te.editorOnly.length ? { editorOnly: te.editorOnly } : {} } : { ...K, ...Ge(A), ...j, editable: !1, notEditable: { reason: "text", message: te.message } };
2519
+ if (T.type === "text") {
2520
+ const te = ja(T, w(g, T.id));
2521
+ return te.editable ? { ...K, type: "text", ...V, editable: !0, text: te.text, ...te.editorOnly.length ? { editorOnly: te.editorOnly } : {} } : { ...K, ...Ge(T), ...V, editable: !1, notEditable: { reason: "text", message: te.message } };
2513
2522
  }
2514
- const B = Ce(A, { sql: a.sql });
2523
+ const B = Ce(T, { sql: a.sql });
2515
2524
  if (c(B.source), !B.editable)
2516
2525
  return {
2517
2526
  ...K,
2518
- ...Ge(A),
2527
+ ...Ge(T),
2519
2528
  ...B.source ? { source: B.source } : {},
2520
- ...j,
2529
+ ...V,
2521
2530
  editable: !1,
2522
2531
  notEditable: { reason: B.reason, message: B.message, ...B.detail ? { detail: B.detail } : {} }
2523
2532
  };
2524
- const se = i ? void 0 : At(A);
2533
+ const se = i ? void 0 : At(T);
2525
2534
  return {
2526
2535
  ...K,
2527
- ...Ge(A),
2536
+ ...Ge(T),
2528
2537
  type: B.type,
2529
2538
  source: B.source,
2530
- ...j,
2539
+ ...V,
2531
2540
  editable: !0,
2532
2541
  ...i ? {} : {
2533
2542
  query: B.query,
@@ -2537,30 +2546,30 @@ function Dr(e, a) {
2537
2546
  ...se
2538
2547
  };
2539
2548
  })
2540
- })), q = as(e, es(a.calendar, a.updatedAt), {
2549
+ })), E = as(e, es(a.calendar, a.updatedAt), {
2541
2550
  ...a.relationshipReach ? { relationshipReach: a.relationshipReach } : {}
2542
2551
  });
2543
- for (const I of q)
2544
- I.editable && l.set(`${I.domainId}|${I.datasetName}`, { domainId: I.domainId, datasetName: I.datasetName });
2545
- const _ = yi(e, a, new Map([...h, ...v]));
2546
- for (const I of e.variables ?? []) {
2547
- const S = kt(I);
2548
- (S == null ? void 0 : S.kind) === "semantic" && l.set(`${S.domainId}|${S.datasetName}`, { domainId: S.domainId, datasetName: S.datasetName });
2549
- }
2550
- const k = (e.variables ?? []).filter((I) => {
2551
- var S;
2552
- return ((S = kt(I)) == null ? void 0 : S.kind) === "physical";
2553
- }).map((I) => I.name), b = (e.sheets ?? []).some(
2554
- (I) => {
2555
- var S;
2556
- return (S = I.document) == null ? void 0 : S.sections.some((A) => {
2557
- var L, j;
2558
- return A.type === "text" && (((L = A.style) == null ? void 0 : L.fontWeight) || ((j = A.style) == null ? void 0 : j.color));
2552
+ for (const g of E)
2553
+ g.editable && l.set(`${g.domainId}|${g.datasetName}`, { domainId: g.domainId, datasetName: g.datasetName });
2554
+ const _ = vi(e, a, new Map([...h, ...I]));
2555
+ for (const g of e.variables ?? []) {
2556
+ const k = kt(g);
2557
+ (k == null ? void 0 : k.kind) === "semantic" && l.set(`${k.domainId}|${k.datasetName}`, { domainId: k.domainId, datasetName: k.datasetName });
2558
+ }
2559
+ const S = (e.variables ?? []).filter((g) => {
2560
+ var k;
2561
+ return ((k = kt(g)) == null ? void 0 : k.kind) === "physical";
2562
+ }).map((g) => g.name), y = (e.sheets ?? []).some(
2563
+ (g) => {
2564
+ var k;
2565
+ return (k = g.document) == null ? void 0 : k.sections.some((T) => {
2566
+ var L, V;
2567
+ return T.type === "text" && (((L = T.style) == null ? void 0 : L.fontWeight) || ((V = T.style) == null ? void 0 : V.color));
2559
2568
  });
2560
2569
  }
2561
- ), O = [
2562
- ...k.length ? [`a variable on a table or view source (${k.join(", ")}): changed in the editor`] : [],
2563
- ...b ? ["a Document text section's weight or color: changed in the editor"] : [],
2570
+ ), D = [
2571
+ ...S.length ? [`a variable on a table or view source (${S.join(", ")}): changed in the editor`] : [],
2572
+ ...y ? ["a Document text section's weight or color: changed in the editor"] : [],
2564
2573
  // No change creates a calculated field (DV-D13, ledger AR-27): the parity backlog names it.
2565
2574
  "creating a calculated field: use one the domain has, or a SQL variable"
2566
2575
  ];
@@ -2573,39 +2582,39 @@ function Dr(e, a) {
2573
2582
  access: a.access,
2574
2583
  datasets: [...l.values()],
2575
2584
  sheets: x,
2576
- filters: q,
2585
+ filters: E,
2577
2586
  variables: _,
2578
- style: gi(e, a),
2579
- editorOnly: O,
2587
+ style: bi(e, a),
2588
+ editorOnly: D,
2580
2589
  ...i ? { truncated: !0 } : {}
2581
2590
  };
2582
2591
  }
2583
- function gi(e, a) {
2592
+ function bi(e, a) {
2584
2593
  const { style: t, organizationAppearance: s } = za(e, a.organizationAppearance);
2585
- return { set: kn(t), shows: rn({ organizationAppearance: s, dashboardStyle: t }, "light").shows };
2594
+ return { set: Tn(t), shows: dn({ organizationAppearance: s, dashboardStyle: t }, "light").shows };
2586
2595
  }
2587
- function Ra(e, a) {
2588
- const t = _o(a);
2596
+ function Fa(e, a) {
2597
+ const t = Co(a);
2589
2598
  return t ? { ...e, style: t } : e;
2590
2599
  }
2591
- function bi(e, a) {
2600
+ function yi(e, a) {
2592
2601
  const t = e.document;
2593
2602
  if (!t) return {};
2594
2603
  const s = (n) => {
2595
2604
  var o;
2596
2605
  return (((o = t[n]) == null ? void 0 : o.blocks) ?? []).flatMap(
2597
- (i) => i.type === "text" && i.role ? [Ra({ role: i.role, text: Ze(i.content, { ...a, documentInputs: t.inputs }) }, i.style)] : []
2606
+ (i) => i.type === "text" && i.role ? [Fa({ role: i.role, text: Ze(i.content, { ...a, documentInputs: t.inputs }) }, i.style)] : []
2598
2607
  );
2599
2608
  };
2600
2609
  return {
2601
2610
  header: s("header"),
2602
2611
  footer: s("footer"),
2603
2612
  textSections: t.sections.flatMap(
2604
- (n) => n.type === "text" ? [Ra({ sectionId: n.id, text: Ze(n.content, { ...a, documentInputs: t.inputs }) }, n.style)] : []
2613
+ (n) => n.type === "text" ? [Fa({ sectionId: n.id, text: Ze(n.content, { ...a, documentInputs: t.inputs }) }, n.style)] : []
2605
2614
  )
2606
2615
  };
2607
2616
  }
2608
- function yi(e, a, t) {
2617
+ function vi(e, a, t) {
2609
2618
  const s = Qa(e), n = (c) => s.filter(({ ref: h }) => c(h)).map(({ place: h, where: p }) => ({
2610
2619
  sheetId: h.sheetId,
2611
2620
  where: p.kind,
@@ -2626,19 +2635,19 @@ function yi(e, a, t) {
2626
2635
  })), d = [...o.values()].filter((c) => c.kind === "report").map((c) => ({
2627
2636
  name: c.name,
2628
2637
  kind: "report",
2629
- words: vi[c.reportKey],
2638
+ words: Ii[c.reportKey],
2630
2639
  parts: [],
2631
2640
  usedIn: n((h) => h.source === "documentMeta" && h.key === c.reportKey),
2632
2641
  editable: !1
2633
2642
  })), l = (e.variables ?? []).map((c) => {
2634
- const h = rs(c, { sql: a.sql }), p = Dt(c, e)[0], y = Io(c.presentation);
2643
+ const h = rs(c, { sql: a.sql }), p = Dt(c, e)[0], v = _o(c.presentation);
2635
2644
  return {
2636
2645
  name: c.name,
2637
2646
  kind: "data",
2638
- words: Yo(c),
2639
- parts: No(c),
2640
- ...y ? { presentation: y } : {},
2641
- usedIn: n((v) => v.source === "data" && v.variableId === c.id),
2647
+ words: Jo(c),
2648
+ parts: Po(c),
2649
+ ...v ? { presentation: v } : {},
2650
+ usedIn: n((I) => I.source === "data" && I.variableId === c.id),
2642
2651
  editable: h.editable,
2643
2652
  ...h.editable ? {} : { notEditable: { reason: h.reason, message: h.message } },
2644
2653
  ...p ? { broken: `${p.message} ${p.fix}` } : {}
@@ -2646,7 +2655,7 @@ function yi(e, a, t) {
2646
2655
  });
2647
2656
  return [...i, ...d, ...l];
2648
2657
  }
2649
- const vi = {
2658
+ const Ii = {
2650
2659
  generatedAt: "When the report was generated",
2651
2660
  pageNumber: "The page number (Documents)",
2652
2661
  pageCount: "The page count (Documents)"
@@ -2655,9 +2664,9 @@ function Ge(e) {
2655
2664
  const a = qe(e);
2656
2665
  return a ? { type: a.type, ...a.properties } : { type: $t(e.type) };
2657
2666
  }
2658
- function Ii(e) {
2667
+ function _i(e) {
2659
2668
  const a = new Map((e.frames ?? []).map((t) => [t.id, t]));
2660
- return fn(e).rows.map((t) => ({
2669
+ return mn(e).rows.map((t) => ({
2661
2670
  tiles: t.tiles.map((s) => {
2662
2671
  const n = a.get(s.frameId);
2663
2672
  return { cardIds: n ? Ba(n) : [], width: s.width };
@@ -2670,13 +2679,13 @@ function Z(e) {
2670
2679
  function ue(e, a) {
2671
2680
  return Z(e) && Object.prototype.hasOwnProperty.call(e, a) && e[a] !== void 0;
2672
2681
  }
2673
- const re = ue, _i = ["metricColumns", "groupByColumns", "detailColumns", "pivotByColumns", "sortByColumns"], Ci = ["xAxisConfig", "yAxisConfig", "secondaryYAxisConfig", "tooltipConfig", "dataLabelsConfig"], $i = '`format` on the matching column in `config.metricColumns`, `groupByColumns` or `detailColumns`; for a SQL or Python card, `preferences.sqlColumns["<column>"].format`', Qe = "`preferences.conditionalFormatting`, with columns named by card column id";
2674
- function wi(e) {
2682
+ const re = ue, Ci = ["metricColumns", "groupByColumns", "detailColumns", "pivotByColumns", "sortByColumns"], $i = ["xAxisConfig", "yAxisConfig", "secondaryYAxisConfig", "tooltipConfig", "dataLabelsConfig"], wi = '`format` on the matching column in `config.metricColumns`, `groupByColumns` or `detailColumns`; for a SQL or Python card, `preferences.sqlColumns["<column>"].format`', Qe = "`preferences.conditionalFormatting`, with columns named by card column id";
2683
+ function xi(e) {
2675
2684
  return Me(String(e.type)) ?? Et;
2676
2685
  }
2677
2686
  function Oe(e, a, t) {
2678
2687
  if (t === void 0) return;
2679
- const s = Z(t) ? wi(t).safeParse(t) : Et.safeParse(t);
2688
+ const s = Z(t) ? xi(t).safeParse(t) : Et.safeParse(t);
2680
2689
  if (!s.success)
2681
2690
  for (const n of s.error.issues) {
2682
2691
  const o = n.code === "unrecognized_keys" ? n.keys : [n.path.length ? String(n.path[n.path.length - 1]) : "type"];
@@ -2697,27 +2706,27 @@ function It(e, a, t) {
2697
2706
  }
2698
2707
  function ps(e, a) {
2699
2708
  const t = [], s = e.config;
2700
- for (const w of _i) {
2709
+ for (const w of Ci) {
2701
2710
  const x = s == null ? void 0 : s[w];
2702
- Array.isArray(x) && x.forEach((q, _) => It(t, `${a}.config.${w}[${_}]`, q));
2711
+ Array.isArray(x) && x.forEach((E, _) => It(t, `${a}.config.${w}[${_}]`, E));
2703
2712
  }
2704
2713
  const n = Z(s == null ? void 0 : s.matrix) ? s.matrix : void 0, o = Z(n == null ? void 0 : n.presentation) ? n.presentation : void 0;
2705
2714
  for (const w of ["measureFormats", "levelFormats"]) {
2706
2715
  const x = o == null ? void 0 : o[w];
2707
- if (Z(x)) for (const [q, _] of Object.entries(x)) Oe(t, `${a}.config.matrix.presentation.${w}.${q}`, _);
2716
+ if (Z(x)) for (const [E, _] of Object.entries(x)) Oe(t, `${a}.config.matrix.presentation.${w}.${E}`, _);
2708
2717
  }
2709
2718
  re(o, "conditionalFormatting") && t.push({ path: `${a}.config.matrix.presentation.conditionalFormatting`, field: "conditionalFormatting", replacement: Qe });
2710
2719
  const i = e.interactionConfig, d = i == null ? void 0 : i.drillHierarchies;
2711
2720
  Array.isArray(d) && d.forEach((w, x) => {
2712
- Z(w) && (It(t, `${a}.interactionConfig.drillHierarchies[${x}].baseField`, w.baseField), Array.isArray(w.steps) && w.steps.forEach((q, _) => {
2713
- Z(q) && It(t, `${a}.interactionConfig.drillHierarchies[${x}].steps[${_}].field`, q.field);
2721
+ Z(w) && (It(t, `${a}.interactionConfig.drillHierarchies[${x}].baseField`, w.baseField), Array.isArray(w.steps) && w.steps.forEach((E, _) => {
2722
+ Z(E) && It(t, `${a}.interactionConfig.drillHierarchies[${x}].steps[${_}].field`, E.field);
2714
2723
  }));
2715
2724
  });
2716
2725
  const l = e.preferences;
2717
2726
  if (!l) return t;
2718
2727
  const c = `${a}.preferences`;
2719
2728
  if (re(l, "formatNumber")) {
2720
- const w = l.formatNumber, x = Z(w) && Object.keys(w).every((q) => q === "colorRanges");
2729
+ const w = l.formatNumber, x = Z(w) && Object.keys(w).every((E) => E === "colorRanges");
2721
2730
  t.push(
2722
2731
  x ? { path: `${c}.formatNumber.colorRanges`, field: "colorRanges", replacement: `${Qe} (a rule on the KPI's value)` } : { path: `${c}.formatNumber`, field: "formatNumber", replacement: "`format` on each measure in `config.metricColumns`; for a SQL KPI, `preferences.sqlKpiValue.format`" }
2723
2732
  );
@@ -2727,30 +2736,30 @@ function ps(e, a) {
2727
2736
  re(h, "formatOptions") && t.push({ path: `${c}.kpiVisualOptions.formatOptions`, field: "formatOptions", replacement: "`format` on each measure in `config.metricColumns`; for a SQL KPI, `preferences.sqlKpiValue.format`" }), re(h, "queryComparisonPolarity") && t.push({ path: `${c}.kpiVisualOptions.queryComparisonPolarity`, field: "queryComparisonPolarity", replacement: "`preferences.sqlKpiValue.comparisonPolarity`" });
2728
2737
  const p = l.tablePrefs;
2729
2738
  re(p, "conditionalFormatting") && t.push({ path: `${c}.tablePrefs.conditionalFormatting`, field: "conditionalFormatting", replacement: Qe });
2730
- const y = p == null ? void 0 : p.columnSettingsMap;
2731
- if (Z(y))
2732
- for (const [w, x] of Object.entries(y)) {
2739
+ const v = p == null ? void 0 : p.columnSettingsMap;
2740
+ if (Z(v))
2741
+ for (const [w, x] of Object.entries(v)) {
2733
2742
  if (!Z(x)) continue;
2734
- const q = `${c}.tablePrefs.columnSettingsMap.${w}`;
2743
+ const E = `${c}.tablePrefs.columnSettingsMap.${w}`;
2735
2744
  for (const _ of ["numberFormat", "dateFormat", "inheritMetricFormat"])
2736
- re(x, _) && t.push({ path: `${q}.${_}`, field: _, replacement: _ === "inheritMetricFormat" ? "nothing: a column follows its `format`" : $i });
2737
- re(x, "colorRanges") && t.push({ path: `${q}.colorRanges`, field: "colorRanges", replacement: Qe });
2745
+ re(x, _) && t.push({ path: `${E}.${_}`, field: _, replacement: _ === "inheritMetricFormat" ? "nothing: a column follows its `format`" : wi });
2746
+ re(x, "colorRanges") && t.push({ path: `${E}.colorRanges`, field: "colorRanges", replacement: Qe });
2738
2747
  }
2739
- for (const w of Ci) {
2748
+ for (const w of $i) {
2740
2749
  const x = l[w];
2741
2750
  if (Z(x)) {
2742
- for (const q of ["formatMode", "mode", "formatOptions"])
2743
- re(x, q) && t.push({ path: `${c}.${w}.${q}`, field: q, replacement: `\`preferences.${w}.valueFormat\` (absent means the column's format)` });
2751
+ for (const E of ["formatMode", "mode", "formatOptions"])
2752
+ re(x, E) && t.push({ path: `${c}.${w}.${E}`, field: E, replacement: `\`preferences.${w}.valueFormat\` (absent means the column's format)` });
2744
2753
  w === "dataLabelsConfig" && re(x, "format") && t.push({ path: `${c}.${w}.format`, field: "format", replacement: "`preferences.dataLabelsConfig.valueFormat`" }), Oe(t, `${c}.${w}.valueFormat`, x.valueFormat);
2745
2754
  }
2746
2755
  }
2747
- const v = l.sqlColumns;
2748
- if (Z(v))
2749
- for (const [w, x] of Object.entries(v))
2756
+ const I = l.sqlColumns;
2757
+ if (Z(I))
2758
+ for (const [w, x] of Object.entries(I))
2750
2759
  Z(x) && Oe(t, `${c}.sqlColumns.${w}.format`, x.format);
2751
2760
  return Z(l.sqlKpiValue) && Oe(t, `${c}.sqlKpiValue.format`, l.sqlKpiValue.format), t;
2752
2761
  }
2753
- function xi(e) {
2762
+ function Si(e) {
2754
2763
  const a = `sheets[id=${e.sheetId}]`;
2755
2764
  switch (e.kind) {
2756
2765
  case "sheetCard":
@@ -2766,20 +2775,20 @@ function gs(e) {
2766
2775
  if (Array.isArray(e.sheets))
2767
2776
  return we(e).map((t) => ({
2768
2777
  card: t.card,
2769
- at: xi(t)
2778
+ at: Si(t)
2770
2779
  }));
2771
2780
  const a = e;
2772
2781
  return Array.isArray(a.cards) ? a.cards.map((t) => ({ card: t, at: `cards[id=${t.id}]` })) : [];
2773
2782
  }
2774
- function Or(e) {
2783
+ function Er(e) {
2775
2784
  return gs(e).flatMap(({ card: a, at: t }) => ps(a, t));
2776
2785
  }
2777
- function Si(e, a) {
2786
+ function ki(e, a) {
2778
2787
  var o;
2779
2788
  const t = (o = e.preferences) == null ? void 0 : o.conditionalFormatting;
2780
2789
  if (t === void 0) return [];
2781
- const s = `${a}.preferences.conditionalFormatting`, n = Co.safeParse(t);
2782
- return n.success ? $o(e).map((i) => ({
2790
+ const s = `${a}.preferences.conditionalFormatting`, n = $o.safeParse(t);
2791
+ return n.success ? wo(e).map((i) => ({
2783
2792
  code: "invalid_conditional_formatting",
2784
2793
  path: `${s}.rules[id=${i.ruleId}].${i.path}`,
2785
2794
  message: i.message
@@ -2789,14 +2798,14 @@ function Si(e, a) {
2789
2798
  message: i.message
2790
2799
  }));
2791
2800
  }
2792
- function Er(e) {
2801
+ function qr(e) {
2793
2802
  return gs(e).flatMap(({ card: a, at: t }) => [
2794
2803
  ...ps(a, t).map((s) => ({
2795
2804
  code: "retired_presentation_field",
2796
2805
  path: s.path,
2797
2806
  message: `\`${s.field}\` is retired: use ${s.replacement}.`
2798
2807
  })),
2799
- ...Si(a, t)
2808
+ ...ki(a, t)
2800
2809
  ]);
2801
2810
  }
2802
2811
  const Lt = [
@@ -2805,7 +2814,7 @@ const Lt = [
2805
2814
  "detailColumns",
2806
2815
  "pivotByColumns",
2807
2816
  "sortByColumns"
2808
- ], ki = [
2817
+ ], Ti = [
2809
2818
  "xAxisConfig",
2810
2819
  "yAxisConfig",
2811
2820
  "secondaryYAxisConfig",
@@ -2825,17 +2834,17 @@ function Ie(e, a) {
2825
2834
  return bs(t(e), t(a));
2826
2835
  }
2827
2836
  function at(e) {
2828
- const a = sn(e);
2837
+ const a = on(e);
2829
2838
  return a === "date" || a === "datetime";
2830
2839
  }
2831
2840
  function ys(e) {
2832
2841
  var a, t;
2833
2842
  return !!((a = e.sql) != null && a.trim() || (t = e.python) != null && t.trim());
2834
2843
  }
2835
- function Ti(e) {
2836
- return e.type === "kpi" && Ao(e);
2844
+ function Ri(e) {
2845
+ return e.type === "kpi" && Do(e);
2837
2846
  }
2838
- function Ft(e) {
2847
+ function Rt(e) {
2839
2848
  return e.type === "table" || e.type === "detailTable";
2840
2849
  }
2841
2850
  function ee(e, a) {
@@ -2866,9 +2875,9 @@ function Mt(e) {
2866
2875
  if (!J(e)) return;
2867
2876
  if (e.type === "temporal_bucket") return xe(e);
2868
2877
  const a = xe(e);
2869
- return (a == null ? void 0 : a.type) === "currency" && a.currency === void 0 && Bo(e) ? { ...a, currency: "USD" } : a;
2878
+ return (a == null ? void 0 : a.type) === "currency" && a.currency === void 0 && Vo(e) ? { ...a, currency: "USD" } : a;
2870
2879
  }
2871
- function Rt(e, a, t) {
2880
+ function Ft(e, a, t) {
2872
2881
  if (!(!ue(a, "dateFormat") && !ue(a, "customFormat"))) {
2873
2882
  if (at(a.dataType) && a.format == null && a.dateFormat != null) {
2874
2883
  const s = Fo({
@@ -2887,7 +2896,7 @@ function Rt(e, a, t) {
2887
2896
  ke(a, ["dateFormat", "customFormat"]) && e.changes.push({ path: `${t}.dateFormat`, action: "removed" });
2888
2897
  }
2889
2898
  }
2890
- function Ri(e, a, t) {
2899
+ function Ai(e, a, t) {
2891
2900
  if (!ue(a, "dateFormat") && !ue(a, "customFormat")) return;
2892
2901
  const s = a.dateFormat === "custom" ? a.customFormat : a.dateFormat;
2893
2902
  e.card.type === "detailTable" && at(a.dataType) && !a.format && typeof s == "string" && s.trim() ? (a.format = { type: "date", pattern: s }, a.formatOrigin = "override", e.changes.push({
@@ -2900,14 +2909,14 @@ function Ri(e, a, t) {
2900
2909
  detail: "A detail date pattern on a column that has a format of its own."
2901
2910
  }), ke(a, ["dateFormat", "customFormat"]) && e.changes.push({ path: `${t}.dateFormat`, action: "removed" });
2902
2911
  }
2903
- function Ai(e, a, t, s) {
2912
+ function Di(e, a, t, s) {
2904
2913
  if (a.format !== void 0) {
2905
2914
  const n = Mt(a.format);
2906
2915
  n ? Ie(n, a.format) || (a.format = n, e.changes.push({ path: `${s}.format`, action: "cleaned" })) : (delete a.format, e.changes.push({ path: `${s}.format`, action: "removed" }));
2907
2916
  }
2908
- t === "groupByColumns" || t === "pivotByColumns" ? Rt(e, a, s) : t === "detailColumns" ? Ri(e, a, s) : ke(a, ["dateFormat", "customFormat"]) && e.changes.push({ path: `${s}.dateFormat`, action: "removed" });
2917
+ t === "groupByColumns" || t === "pivotByColumns" ? Ft(e, a, s) : t === "detailColumns" ? Ai(e, a, s) : ke(a, ["dateFormat", "customFormat"]) && e.changes.push({ path: `${s}.dateFormat`, action: "removed" });
2909
2918
  }
2910
- function Di(e, a) {
2919
+ function Oi(e, a) {
2911
2920
  for (const t of Lt)
2912
2921
  ee(e.card, t).forEach((s, n) => {
2913
2922
  var i;
@@ -2919,31 +2928,31 @@ function Di(e, a) {
2919
2928
  });
2920
2929
  });
2921
2930
  }
2922
- function Oi(e) {
2931
+ function Ei(e) {
2923
2932
  var t;
2924
2933
  const a = (t = e.card.interactionConfig) == null ? void 0 : t.drillHierarchies;
2925
2934
  Array.isArray(a) && a.forEach((s, n) => {
2926
2935
  if (!J(s)) return;
2927
2936
  const o = `interactionConfig.drillHierarchies[${n}]`;
2928
- J(s.baseField) && Rt(e, s.baseField, `${o}.baseField`), Array.isArray(s.steps) && s.steps.forEach((i, d) => {
2937
+ J(s.baseField) && Ft(e, s.baseField, `${o}.baseField`), Array.isArray(s.steps) && s.steps.forEach((i, d) => {
2929
2938
  if (J(i) && J(i.field)) {
2930
2939
  const l = i.field, c = `${o}.steps[${d}].field`;
2931
2940
  if (l.format !== void 0) {
2932
2941
  const h = Mt(l.format);
2933
2942
  h && !Ie(h, l.format) && (l.format = h, e.changes.push({ path: `${c}.format`, action: "cleaned" }));
2934
2943
  }
2935
- Rt(e, l, c);
2944
+ Ft(e, l, c);
2936
2945
  }
2937
2946
  });
2938
2947
  });
2939
2948
  }
2940
- const Ei = [
2949
+ const qi = [
2941
2950
  "numberFormat",
2942
2951
  "dateFormat",
2943
2952
  "inheritMetricFormat",
2944
2953
  "colorRanges"
2945
2954
  ];
2946
- function qi(e, a) {
2955
+ function Ni(e, a) {
2947
2956
  const t = (n) => n == null ? void 0 : n.trim().toLowerCase(), s = t(a);
2948
2957
  return [
2949
2958
  e.id,
@@ -2951,32 +2960,32 @@ function qi(e, a) {
2951
2960
  e.name,
2952
2961
  e.qualifiedFieldName,
2953
2962
  e.label,
2954
- e.role === "metric" ? Ko(e) : void 0
2963
+ e.role === "metric" ? Wo(e) : void 0
2955
2964
  ].some((n) => n !== void 0 && t(n) === s);
2956
2965
  }
2957
2966
  function Aa(e, a) {
2958
- const t = Ro(e, { columnId: a });
2967
+ const t = Ao(e, { columnId: a });
2959
2968
  if (t) return t;
2960
2969
  const s = [
2961
2970
  ...ee(e, "detailColumns"),
2962
2971
  ...ee(e, "metricColumns"),
2963
2972
  ...ee(e, "groupByColumns")
2964
- ].filter((n) => qi(n, a));
2973
+ ].filter((n) => Ni(n, a));
2965
2974
  return s.length === 1 ? s[0] : void 0;
2966
2975
  }
2967
- function Ni(e) {
2976
+ function Pi(e) {
2968
2977
  return e.type === "number" && J(e.numberFormat) && e.inheritMetricFormat !== !0;
2969
2978
  }
2970
- function Pi(e, a) {
2979
+ function Li(e, a) {
2971
2980
  var t;
2972
- return at(a.dataType) ? ee(e, "detailColumns").includes(a) ? e.type === "detailTable" : cn(a.granularity) || ((t = a.format) == null ? void 0 : t.type) === "temporal_bucket" || a.semanticTemporalPresentation != null : !1;
2981
+ return at(a.dataType) ? ee(e, "detailColumns").includes(a) ? e.type === "detailTable" : un(a.granularity) || ((t = a.format) == null ? void 0 : t.type) === "temporal_bucket" || a.semanticTemporalPresentation != null : !1;
2973
2982
  }
2974
2983
  function Da(e, a, t, s) {
2975
2984
  var i;
2976
2985
  const n = (i = e.card).preferences ?? (i.preferences = {}), o = n.sqlColumns ?? (n.sqlColumns = {});
2977
2986
  o[a] = { ...o[a], format: t }, e.changes.push({ path: s, action: "moved", to: `preferences.sqlColumns[${JSON.stringify(a)}].format` });
2978
2987
  }
2979
- function Li(e) {
2988
+ function Mi(e) {
2980
2989
  const [a, ...t] = e;
2981
2990
  if (!a) return;
2982
2991
  const s = Object.fromEntries(
@@ -2984,8 +2993,8 @@ function Li(e) {
2984
2993
  );
2985
2994
  return Et.safeParse(s).success ? s : void 0;
2986
2995
  }
2987
- function Mi(e, a) {
2988
- const t = e.card, s = Po({
2996
+ function Bi(e, a) {
2997
+ const t = e.card, s = Lo({
2989
2998
  groupByColumns: ee(t, "groupByColumns"),
2990
2999
  metricColumns: ee(t, "metricColumns"),
2991
3000
  pivotByColumns: ee(t, "pivotByColumns"),
@@ -3002,10 +3011,10 @@ function Mi(e, a) {
3002
3011
  });
3003
3012
  }
3004
3013
  }
3005
- function Bi(e, a) {
3014
+ function Vi(e, a) {
3006
3015
  var o;
3007
3016
  if (!a.length) return;
3008
- const t = ee(e.card, "metricColumns"), s = t.length === 1 ? t[0] : void 0, n = s && !s.format ? Li(a.map((i) => i.format)) : void 0;
3017
+ const t = ee(e.card, "metricColumns"), s = t.length === 1 ? t[0] : void 0, n = s && !s.format ? Mi(a.map((i) => i.format)) : void 0;
3009
3018
  s && n && st(e, s, n, a[0].from);
3010
3019
  for (const i of a)
3011
3020
  if (!(s != null && s.format && Ie(i.format, s.format))) {
@@ -3030,69 +3039,69 @@ function Bi(e, a) {
3030
3039
  );
3031
3040
  }
3032
3041
  }
3033
- function Vi(e) {
3042
+ function ji(e) {
3034
3043
  var l;
3035
3044
  const a = (l = e.card.preferences) == null ? void 0 : l.tablePrefs, t = a == null ? void 0 : a.columnSettingsMap;
3036
3045
  if (!J(t)) return;
3037
3046
  const s = e.card, n = ys(s), o = ee(s, "pivotByColumns").length > 0, i = /* @__PURE__ */ new Map(), d = [];
3038
3047
  for (const [c, h] of Object.entries(t)) {
3039
3048
  if (!J(h)) continue;
3040
- const p = h, y = `preferences.tablePrefs.columnSettingsMap[${JSON.stringify(c)}]`;
3041
- if (Ni(p)) {
3042
- const v = wo(p.numberFormat);
3043
- if (v && n)
3044
- Da(e, c, v, `${y}.numberFormat`);
3045
- else if (v && Ft(s)) {
3046
- const w = Aa(s, c), x = { key: c, format: v, from: `${y}.numberFormat` };
3049
+ const p = h, v = `preferences.tablePrefs.columnSettingsMap[${JSON.stringify(c)}]`;
3050
+ if (Pi(p)) {
3051
+ const I = xo(p.numberFormat);
3052
+ if (I && n)
3053
+ Da(e, c, I, `${v}.numberFormat`);
3054
+ else if (I && Rt(s)) {
3055
+ const w = Aa(s, c), x = { key: c, format: I, from: `${v}.numberFormat` };
3047
3056
  w ? i.set(w, [...i.get(w) ?? [], x]) : o ? d.push(x) : e.unconverted.push({
3048
3057
  path: x.from,
3049
3058
  reason: "unmatched_column_setting",
3050
3059
  detail: `"${c}" names no card column.`
3051
3060
  });
3052
- } else v && s.type !== "matrixTable" && s.type !== "kpi" && ee(s, "metricColumns").some(
3061
+ } else I && s.type !== "matrixTable" && s.type !== "kpi" && ee(s, "metricColumns").some(
3053
3062
  (x) => x.comparison != null
3054
3063
  ) && e.unconverted.push({
3055
- path: `${y}.numberFormat`,
3064
+ path: `${v}.numberFormat`,
3056
3065
  reason: "chart_comparison_column_setting",
3057
3066
  detail: `"${c}" formats this chart's comparison tooltip only.`
3058
3067
  });
3059
3068
  }
3060
3069
  if (J(p.dateFormat)) {
3061
- const v = p.type === "date";
3062
- if (v && n)
3063
- Da(e, c, xo(p.dateFormat), `${y}.dateFormat`);
3064
- else if (v && Ft(s)) {
3070
+ const I = p.type === "date";
3071
+ if (I && n)
3072
+ Da(e, c, So(p.dateFormat), `${v}.dateFormat`);
3073
+ else if (I && Rt(s)) {
3065
3074
  const w = Aa(s, c);
3066
- (!w || !Pi(s, w)) && e.unconverted.push({
3067
- path: `${y}.dateFormat`,
3075
+ (!w || !Li(s, w)) && e.unconverted.push({
3076
+ path: `${v}.dateFormat`,
3068
3077
  reason: "config_column_date_setting",
3069
3078
  detail: `"${c}"'s download formats its dates with this setting.`
3070
3079
  });
3071
3080
  }
3072
3081
  }
3073
- for (const v of Ei)
3074
- Object.prototype.hasOwnProperty.call(p, v) && (delete p[v], e.changes.push({ path: `${y}.${v}`, action: "removed" }));
3082
+ for (const I of qi)
3083
+ Object.prototype.hasOwnProperty.call(p, I) && (delete p[I], e.changes.push({ path: `${v}.${I}`, action: "removed" }));
3075
3084
  }
3076
- Mi(e, i), Bi(e, d);
3085
+ Bi(e, i), Vi(e, d);
3077
3086
  }
3078
- function ji(e) {
3087
+ function Ki(e) {
3079
3088
  return Object.keys(e).some(
3080
3089
  (a) => a !== "enabled" && a !== "colorRanges" && e[a] !== void 0
3081
3090
  );
3082
3091
  }
3083
- function Ki(e) {
3092
+ function Wi(e) {
3084
3093
  return (e == null ? void 0 : e.enabled) === !1 || (e == null ? void 0 : e.enabled) === "false";
3085
3094
  }
3086
- function Wi(e) {
3095
+ function Ui(e) {
3087
3096
  const a = e.card, t = a.preferences;
3088
3097
  if (!t) return;
3089
- const s = t.kpiVisualOptions, n = J(s == null ? void 0 : s.formatOptions) ? s.formatOptions : void 0, o = t, i = J(o.formatNumber) ? o.formatNumber : void 0, d = n ? xe(So(n)) : void 0, l = i && ji(i) ? xe(ko(i)) : void 0;
3098
+ const s = t.kpiVisualOptions, n = J(s == null ? void 0 : s.formatOptions) ? s.formatOptions : void 0, o = t, i = J(o.formatNumber) ? o.formatNumber : void 0, d = n ? xe(ko(n)) : void 0, l = i && Ki(i) ? xe(To(i)) : void 0;
3090
3099
  if (a.type === "kpi") {
3091
- if (Ki(i) && e.unconverted.push({
3100
+ if (Wi(i) && e.unconverted.push({
3092
3101
  path: "preferences.formatNumber.enabled",
3093
3102
  reason: "raw_display",
3094
3103
  detail: "Formatting is switched off on this KPI."
3095
- }), Ti(a)) {
3104
+ }), Ri(a)) {
3096
3105
  const c = d ?? l, h = s == null ? void 0 : s.queryComparisonPolarity;
3097
3106
  (c || h) && (t.sqlKpiValue = {
3098
3107
  ...t.sqlKpiValue,
@@ -3107,14 +3116,14 @@ function Wi(e) {
3107
3116
  ee(a, "metricColumns").forEach((h) => {
3108
3117
  d ? st(e, h, d, "preferences.kpiVisualOptions.formatOptions") : l && !h.format && st(e, h, l, "preferences.formatNumber");
3109
3118
  });
3110
- Ui(e, i);
3119
+ Gi(e, i);
3111
3120
  } else if (l) {
3112
3121
  const c = ee(a, "metricColumns");
3113
3122
  ys(a) ? e.unconverted.push({
3114
3123
  path: "preferences.formatNumber",
3115
3124
  reason: "sql_card_wide_format",
3116
3125
  detail: "A card-wide number format on a SQL or Python card."
3117
- }) : !Ft(a) && a.type !== "matrixTable" && c.some((h) => !h.format) && e.unconverted.push({
3126
+ }) : !Rt(a) && a.type !== "matrixTable" && c.some((h) => !h.format) && e.unconverted.push({
3118
3127
  path: "preferences.formatNumber",
3119
3128
  reason: "chart_card_wide_format",
3120
3129
  detail: "A card-wide number format on a chart measure without a format of its own."
@@ -3128,11 +3137,11 @@ function Wi(e) {
3128
3137
  for (const c of ["numberAxisFormat", "columnSettings"])
3129
3138
  ke(t, [c]) && e.changes.push({ path: `preferences.${c}`, action: "removed" });
3130
3139
  }
3131
- function Ui(e, a) {
3140
+ function Gi(e, a) {
3132
3141
  var o;
3133
3142
  const t = a == null ? void 0 : a.decimalPlaces, s = e.card.preferences;
3134
3143
  if (typeof t != "number" || ((o = s.comparisonPresentation) == null ? void 0 : o.precision) !== void 0) return;
3135
- const n = Lo(t);
3144
+ const n = Mo(t);
3136
3145
  n !== void 0 && (s.comparisonPresentation = {
3137
3146
  ...s.comparisonPresentation,
3138
3147
  precision: n
@@ -3142,24 +3151,24 @@ function Ui(e, a) {
3142
3151
  to: "preferences.comparisonPresentation.precision"
3143
3152
  }));
3144
3153
  }
3145
- const Gi = /* @__PURE__ */ new Set(["number", "currency", "percent", "scientific", "date", "duration"]);
3146
- function Qi(e) {
3154
+ const Qi = /* @__PURE__ */ new Set(["number", "currency", "percent", "scientific", "date", "duration"]);
3155
+ function Hi(e) {
3147
3156
  const a = e.card.preferences;
3148
3157
  if (a)
3149
- for (const t of ki) {
3158
+ for (const t of Ti) {
3150
3159
  const s = a[t];
3151
3160
  if (!J(s)) continue;
3152
3161
  const n = `preferences.${t}`, o = J(s.formatOptions) ? s.formatOptions : void 0, i = t === "dataLabelsConfig" && typeof s.format == "string" ? s.format : void 0, d = s.formatMode === "override" || s.formatMode === "inherit" ? s.formatMode : s.mode === "override" || s.mode === "inherit" ? s.mode : void 0, l = d ?? (i === "none" ? "raw" : i && i !== "auto" || o ? "override" : "inherit");
3153
3162
  if (l === "raw" || d === void 0 && i === "none")
3154
3163
  e.unconverted.push({ path: `${n}.format`, reason: "raw_display", detail: "Data labels show raw values." });
3155
3164
  else if (l === "override") {
3156
- const c = o && o.type ? o : i && Gi.has(i) ? { ...o, type: i } : o, h = c ? xe(To(c, { preserveOmittedProperties: !0 })) : void 0;
3165
+ const c = o && o.type ? o : i && Qi.has(i) ? { ...o, type: i } : o, h = c ? xe(Ro(c, { preserveOmittedProperties: !0 })) : void 0;
3157
3166
  h && (s.valueFormat = h, e.changes.push({ path: `${n}.formatOptions`, action: "moved", to: `${n}.valueFormat` }));
3158
3167
  }
3159
3168
  ke(s, ["formatMode", "mode", "formatOptions", ...t === "dataLabelsConfig" ? ["format"] : []]) && e.changes.push({ path: `${n}.formatMode`, action: "removed" });
3160
3169
  }
3161
3170
  }
3162
- function Hi(e) {
3171
+ function zi(e) {
3163
3172
  var s;
3164
3173
  const a = (s = e.card.config) == null ? void 0 : s.matrix, t = J(a) && J(a.presentation) ? a.presentation : void 0;
3165
3174
  if (t)
@@ -3172,27 +3181,27 @@ function Hi(e) {
3172
3181
  }
3173
3182
  }
3174
3183
  }
3175
- function zi(e, a = {}) {
3184
+ function Yi(e, a = {}) {
3176
3185
  const t = { card: structuredClone(e), changes: [], unconverted: [] };
3177
3186
  for (const s of Lt)
3178
3187
  ee(t.card, s).forEach((n, o) => {
3179
- J(n) && Ai(t, n, s, `config.${s}[${o}]`);
3188
+ J(n) && Di(t, n, s, `config.${s}[${o}]`);
3180
3189
  });
3181
- return Oi(t), Vi(t), Wi(t), Qi(t), Hi(t), Di(t, a), t.changes.length === 0 && t.unconverted.length === 0 ? { card: e, changes: [], unconverted: [] } : t;
3190
+ return Ei(t), ji(t), Ui(t), Hi(t), zi(t), Oi(t, a), t.changes.length === 0 && t.unconverted.length === 0 ? { card: e, changes: [], unconverted: [] } : t;
3182
3191
  }
3183
- const Yi = "__semaphor_unassigned_trigger__", Ji = "__NULL__";
3184
- function Xi(e) {
3192
+ const Ji = "__semaphor_unassigned_trigger__", Xi = "__NULL__";
3193
+ function Zi(e) {
3185
3194
  var a, t;
3186
3195
  return !!((a = e.sql) != null && a.trim() || (t = e.python) != null && t.trim());
3187
3196
  }
3188
- function Zi(e) {
3197
+ function er(e) {
3189
3198
  const a = e.config;
3190
3199
  return a ? e.type === "detailTable" ? a.detailColumns ?? [] : [...a.detailColumns ?? [], ...a.metricColumns ?? [], ...a.groupByColumns ?? []] : [];
3191
3200
  }
3192
3201
  function Oa(e) {
3193
3202
  return [e.id, e.alias, e.name, e.qualifiedFieldName, e.label];
3194
3203
  }
3195
- function er(e, a) {
3204
+ function tr(e, a) {
3196
3205
  var c, h;
3197
3206
  const t = ((c = e.config) == null ? void 0 : c.metricColumns) ?? [], s = ((h = e.config) == null ? void 0 : h.pivotByColumns) ?? [];
3198
3207
  if (t.length !== 1 || s.length !== 1) return { reason: "pivot_key_form" };
@@ -3201,61 +3210,61 @@ function er(e, a) {
3201
3210
  ref: {
3202
3211
  kind: "pivot",
3203
3212
  metricId: n.id,
3204
- members: [{ fieldId: o.id, value: a === Ji ? null : a }]
3213
+ members: [{ fieldId: o.id, value: a === Xi ? null : a }]
3205
3214
  }
3206
3215
  };
3207
3216
  }
3208
- function tr(e, a) {
3217
+ function ar(e, a) {
3209
3218
  var i, d;
3210
- if (a === Yi) return { reason: "unassigned_trigger" };
3211
- if (Xi(e)) return { ref: { kind: "result", key: a } };
3212
- const t = Zi(e), s = t.filter((l) => Oa(l).includes(a)), n = s.length ? s : t.filter((l) => Oa(l).some((c) => (c == null ? void 0 : c.trim().toLowerCase()) === a.trim().toLowerCase())), o = [...new Set(n.map((l) => l.id))];
3213
- return o.length === 1 ? { ref: { kind: "field", fieldId: o[0] } } : o.length > 1 ? { reason: "ambiguous_column" } : (d = (i = e.config) == null ? void 0 : i.pivotByColumns) != null && d.length ? er(e, a) : { reason: "no_matching_column" };
3219
+ if (a === Ji) return { reason: "unassigned_trigger" };
3220
+ if (Zi(e)) return { ref: { kind: "result", key: a } };
3221
+ const t = er(e), s = t.filter((l) => Oa(l).includes(a)), n = s.length ? s : t.filter((l) => Oa(l).some((c) => (c == null ? void 0 : c.trim().toLowerCase()) === a.trim().toLowerCase())), o = [...new Set(n.map((l) => l.id))];
3222
+ return o.length === 1 ? { ref: { kind: "field", fieldId: o[0] } } : o.length > 1 ? { reason: "ambiguous_column" } : (d = (i = e.config) == null ? void 0 : i.pivotByColumns) != null && d.length ? tr(e, a) : { reason: "no_matching_column" };
3214
3223
  }
3215
3224
  function Ea(e, a, t, s, n) {
3216
- const o = (I, S, A) => {
3217
- s.push({ ruleId: e.id, name: e.name, enabled: e.enabled !== !1, path: `${t}.${I}`, reference: S, reason: A });
3225
+ const o = (g, k, T) => {
3226
+ s.push({ ruleId: e.id, name: e.name, enabled: e.enabled !== !1, path: `${t}.${g}`, reference: k, reason: T });
3218
3227
  }, i = e.condition.columnId ?? "", d = a(i);
3219
3228
  if (!("ref" in d)) return o("condition.columnId", i, d.reason);
3220
3229
  const l = e.target.level, c = l === "row" ? e.target.applyToColumnIds : e.target.columnIds;
3221
3230
  if (l === "cell" && !(c != null && c.length) && e.enabled !== !1)
3222
3231
  return o("target.columnIds", "", "every_column");
3223
3232
  const h = [];
3224
- for (const [I, S] of (c ?? []).entries()) {
3225
- const A = a(S);
3226
- if (!("ref" in A))
3227
- return o(`target.${l === "row" ? "applyToColumnIds" : "columnIds"}[${I}]`, S, A.reason);
3228
- h.push(A.ref);
3233
+ for (const [g, k] of (c ?? []).entries()) {
3234
+ const T = a(k);
3235
+ if (!("ref" in T))
3236
+ return o(`target.${l === "row" ? "applyToColumnIds" : "columnIds"}[${g}]`, k, T.reason);
3237
+ h.push(T.ref);
3229
3238
  }
3230
3239
  const {
3231
3240
  columnIds: p,
3232
- applyToColumnIds: y,
3233
- conditionColumnId: v,
3241
+ applyToColumnIds: v,
3242
+ conditionColumnId: I,
3234
3243
  matrix: w,
3235
3244
  rowRoles: x,
3236
- depth: q,
3245
+ depth: E,
3237
3246
  includeTotals: _,
3238
- includeSubtotals: k,
3239
- ...b
3240
- } = e.target, { columnId: O, ...$ } = e.condition, F = {
3241
- ...b,
3247
+ includeSubtotals: S,
3248
+ ...y
3249
+ } = e.target, { columnId: D, ...$ } = e.condition, N = {
3250
+ ...y,
3242
3251
  ...h.length ? { columns: h } : {},
3243
3252
  // The Matrix scope means something only on a Matrix card.
3244
3253
  ...n ? {
3245
3254
  ...w !== void 0 ? { matrix: w } : {},
3246
3255
  ...x !== void 0 ? { rowRoles: x } : {},
3247
- ...q !== void 0 ? { depth: q } : {},
3256
+ ...E !== void 0 ? { depth: E } : {},
3248
3257
  ..._ !== void 0 ? { includeTotals: _ } : {},
3249
- ...k !== void 0 ? { includeSubtotals: k } : {}
3258
+ ...S !== void 0 ? { includeSubtotals: S } : {}
3250
3259
  } : {}
3251
3260
  };
3252
3261
  return {
3253
3262
  ...e,
3254
3263
  condition: { ...$, column: d.ref },
3255
- target: F
3264
+ target: N
3256
3265
  };
3257
3266
  }
3258
- function ar(e, a) {
3267
+ function sr(e, a) {
3259
3268
  var n;
3260
3269
  const t = (n = La(e)) == null ? void 0 : n.value;
3261
3270
  if (!t) return [];
@@ -3264,540 +3273,544 @@ function ar(e, a) {
3264
3273
  if (!o || typeof o != "object") return [];
3265
3274
  const { start: d, end: l, color: c } = o, h = s(d), p = s(l);
3266
3275
  if (Number.isNaN(h) || Number.isNaN(p) || h > p || h === 1 / 0 || p === -1 / 0) return [];
3267
- const y = h === -1 / 0 ? void 0 : h, v = p === 1 / 0 ? void 0 : p, w = y !== void 0 && v !== void 0 ? { kind: "between", column: t, min: y, max: v, inclusive: !0 } : y !== void 0 ? { kind: "comparison", column: t, operator: "gte", value: y } : v !== void 0 ? { kind: "comparison", column: t, operator: "lte", value: v } : { kind: "blank", column: t, isBlank: !1 }, x = typeof c == "string" ? c : "";
3276
+ const v = h === -1 / 0 ? void 0 : h, I = p === 1 / 0 ? void 0 : p, w = v !== void 0 && I !== void 0 ? { kind: "between", column: t, min: v, max: I, inclusive: !0 } : v !== void 0 ? { kind: "comparison", column: t, operator: "gte", value: v } : I !== void 0 ? { kind: "comparison", column: t, operator: "lte", value: I } : { kind: "blank", column: t, isBlank: !1 }, x = typeof c == "string" ? c : "";
3268
3277
  return [{ id: `kpi-color-range-${i + 1}`, condition: w, target: { level: "cell" }, style: { textColor: x } }];
3269
3278
  }).reverse();
3270
3279
  }
3271
- function sr(e) {
3272
- var h, p, y, v, w, x, q;
3280
+ function or(e) {
3281
+ var h, p, v, I, w, x, E;
3273
3282
  const a = structuredClone(e), t = [], s = [], n = [], o = (_) => {
3274
- t.some((k) => k.from.startsWith(_)) || t.push({ ruleId: "", action: "removed", from: _ });
3283
+ t.some((S) => S.from.startsWith(_)) || t.push({ ruleId: "", action: "removed", from: _ });
3275
3284
  }, i = (h = a.preferences) == null ? void 0 : h.tablePrefs;
3276
3285
  if (i && ue(i, "conditionalFormatting")) {
3277
- const _ = i.conditionalFormatting, k = "preferences.tablePrefs.conditionalFormatting", b = a.type === "table" || a.type === "detailTable";
3278
- ((_ == null ? void 0 : _.rules) ?? []).forEach((O, $) => {
3279
- var I;
3280
- if (!b || ((I = O.target) == null ? void 0 : I.matrix) !== void 0) {
3281
- t.push({ ruleId: O.id, action: "removed", from: `${k}.rules[${$}]` });
3286
+ const _ = i.conditionalFormatting, S = "preferences.tablePrefs.conditionalFormatting", y = a.type === "table" || a.type === "detailTable";
3287
+ ((_ == null ? void 0 : _.rules) ?? []).forEach((D, $) => {
3288
+ var g;
3289
+ if (!y || ((g = D.target) == null ? void 0 : g.matrix) !== void 0) {
3290
+ t.push({ ruleId: D.id, action: "removed", from: `${S}.rules[${$}]` });
3282
3291
  return;
3283
3292
  }
3284
- const F = Ea(O, (S) => tr(a, S), `${k}.rules[${$}]`, s, !1);
3285
- F && (n.push(F), t.push({ ruleId: O.id, action: "moved", from: `${k}.rules[${$}]` }));
3286
- }), delete i.conditionalFormatting, s.some((O) => O.path.startsWith(k)) || o(k);
3293
+ const N = Ea(D, (k) => ar(a, k), `${S}.rules[${$}]`, s, !1);
3294
+ N && (n.push(N), t.push({ ruleId: D.id, action: "moved", from: `${S}.rules[${$}]` }));
3295
+ }), delete i.conditionalFormatting, s.some((D) => D.path.startsWith(S)) || o(S);
3287
3296
  }
3288
- const d = (y = (p = a.config) == null ? void 0 : p.matrix) == null ? void 0 : y.presentation;
3297
+ const d = (v = (p = a.config) == null ? void 0 : p.matrix) == null ? void 0 : v.presentation;
3289
3298
  if (d && ue(d, "conditionalFormatting")) {
3290
- const _ = d.conditionalFormatting, k = "config.matrix.presentation.conditionalFormatting", b = new Set((w = (v = a.config) == null ? void 0 : v.matrix) == null ? void 0 : w.spec.measures.map((O) => O.id));
3291
- ((_ == null ? void 0 : _.rules) ?? []).forEach((O, $) => {
3292
- const F = Ea(
3293
- O,
3294
- (I) => b.has(I) ? { ref: { kind: "matrixMeasure", measureId: I } } : { reason: "no_matching_column" },
3295
- `${k}.rules[${$}]`,
3299
+ const _ = d.conditionalFormatting, S = "config.matrix.presentation.conditionalFormatting", y = new Set((w = (I = a.config) == null ? void 0 : I.matrix) == null ? void 0 : w.spec.measures.map((D) => D.id));
3300
+ ((_ == null ? void 0 : _.rules) ?? []).forEach((D, $) => {
3301
+ const N = Ea(
3302
+ D,
3303
+ (g) => y.has(g) ? { ref: { kind: "matrixMeasure", measureId: g } } : { reason: "no_matching_column" },
3304
+ `${S}.rules[${$}]`,
3296
3305
  s,
3297
3306
  !0
3298
3307
  );
3299
- F && (n.push(F), t.push({ ruleId: O.id, action: "moved", from: `${k}.rules[${$}]` }));
3300
- }), delete d.conditionalFormatting, s.some((O) => O.path.startsWith(k)) || o(k);
3308
+ N && (n.push(N), t.push({ ruleId: D.id, action: "moved", from: `${S}.rules[${$}]` }));
3309
+ }), delete d.conditionalFormatting, s.some((D) => D.path.startsWith(S)) || o(S);
3301
3310
  }
3302
3311
  const l = a.preferences, c = l == null ? void 0 : l.formatNumber;
3303
3312
  if (c && ue(c, "colorRanges")) {
3304
3313
  const _ = Array.isArray(c.colorRanges) ? c.colorRanges : [];
3305
3314
  if (a.type === "kpi") {
3306
- const k = ar(a, _);
3307
- n.push(...k), k.forEach((b) => t.push({ ruleId: b.id, action: "moved", from: "preferences.formatNumber.colorRanges" }));
3315
+ const S = sr(a, _);
3316
+ n.push(...S), S.forEach((y) => t.push({ ruleId: y.id, action: "moved", from: "preferences.formatNumber.colorRanges" }));
3308
3317
  }
3309
- delete c.colorRanges, Object.keys(c).length === 0 && delete l.formatNumber, t.some((k) => k.from === "preferences.formatNumber.colorRanges") || t.push({ ruleId: "", action: "removed", from: "preferences.formatNumber.colorRanges" });
3318
+ delete c.colorRanges, Object.keys(c).length === 0 && delete l.formatNumber, t.some((S) => S.from === "preferences.formatNumber.colorRanges") || t.push({ ruleId: "", action: "removed", from: "preferences.formatNumber.colorRanges" });
3310
3319
  }
3311
3320
  if (!t.length && !s.length) return { card: e, changes: [], unresolved: [] };
3312
3321
  if (n.length) {
3313
- const _ = ((q = (x = a.preferences) == null ? void 0 : x.conditionalFormatting) == null ? void 0 : q.rules) ?? [], k = new Set(_.map((b) => b.id));
3322
+ const _ = ((E = (x = a.preferences) == null ? void 0 : x.conditionalFormatting) == null ? void 0 : E.rules) ?? [], S = new Set(_.map((y) => y.id));
3314
3323
  a.preferences = {
3315
3324
  ...a.preferences,
3316
3325
  conditionalFormatting: {
3317
3326
  version: 1,
3318
- rules: [..._, ...n.filter((b) => !k.has(b.id))]
3327
+ rules: [..._, ...n.filter((y) => !S.has(y.id))]
3319
3328
  }
3320
3329
  };
3321
3330
  }
3322
3331
  return { card: a, changes: t, unresolved: s };
3323
3332
  }
3324
- function qr(e, a = {}) {
3325
- const { only: t, ...s } = a, n = t === "rules" ? void 0 : zi(e, s), o = t === "formats" ? void 0 : sr((n == null ? void 0 : n.card) ?? e);
3333
+ function Nr(e, a = {}) {
3334
+ const { only: t, ...s } = a, n = t === "rules" ? void 0 : Yi(e, s), o = t === "formats" ? void 0 : or((n == null ? void 0 : n.card) ?? e);
3326
3335
  return { card: (o == null ? void 0 : o.card) ?? (n == null ? void 0 : n.card) ?? e, formats: n, rules: o };
3327
3336
  }
3328
- function or(e) {
3337
+ function nr(e) {
3329
3338
  if (e.op === "dashboard.update" || e.op === "dashboard.style" || e.op === "sheet.update") return !0;
3330
3339
  if (e.op !== "card.update") return !1;
3331
3340
  switch (e.update.kind) {
3332
3341
  case "relabel":
3333
3342
  return !0;
3334
3343
  case "settings":
3335
- return e.update.settings.totals === void 0 && e.update.settings.inheritComparison === void 0;
3344
+ return e.update.settings.totals === void 0 && e.update.settings.inheritComparison === void 0 && e.update.settings.band !== "trend";
3336
3345
  default:
3337
3346
  return !1;
3338
3347
  }
3339
3348
  }
3340
- function Nr(e) {
3341
- return e.impact.length || e.detaches ? "needed" : e.operations.length > 0 && e.operations.every(or) ? "not_needed" : "needed";
3349
+ function Pr(e) {
3350
+ return e.impact.length || e.detaches ? "needed" : e.operations.length > 0 && e.operations.every(nr) ? "not_needed" : "needed";
3342
3351
  }
3343
3352
  export {
3344
- Mr as AGGREGATES,
3345
- Br as AUTOMATIC_TEMPORAL_BUCKET_FORMAT,
3346
- Vr as CALCULATED_FIELDS_GROUP_ID,
3347
- jr as CALCULATED_FIELDS_GROUP_NAME,
3348
- Kr as CARD_CONFIG_KEY_CLASSES,
3349
- Wr as CARD_KEY_CLASSES,
3350
- fo as CARD_QUERY_CONFIG_KEYS,
3351
- Sr as CARD_QUERY_REQUEST_DESCRIPTIVE_FIELDS,
3352
- xr as CARD_QUERY_REQUEST_EXECUTED_FIELDS,
3353
- Jm as CARD_SURFACES,
3354
- Ur as CARD_TYPES,
3353
+ Br as AGGREGATES,
3354
+ Vr as AUTOMATIC_TEMPORAL_BUCKET_FORMAT,
3355
+ jr as CALCULATED_FIELDS_GROUP_ID,
3356
+ Kr as CALCULATED_FIELDS_GROUP_NAME,
3357
+ Wr as CARD_CONFIG_KEY_CLASSES,
3358
+ Ur as CARD_KEY_CLASSES,
3359
+ mo as CARD_QUERY_CONFIG_KEYS,
3360
+ kr as CARD_QUERY_REQUEST_DESCRIPTIVE_FIELDS,
3361
+ Sr as CARD_QUERY_REQUEST_EXECUTED_FIELDS,
3362
+ th as CARD_SURFACES,
3363
+ Gr as CARD_TYPES,
3355
3364
  Ae as CARD_TYPE_RULES,
3356
3365
  je as CHART_COLORS_BOUNDS,
3357
- Gr as CHIP_VALUE_COLUMN,
3358
- Qr as COLUMN_KEY_CLASSES,
3359
- Hr as COLUMN_PRESENTATION_KEYS,
3360
- Xu as COMPARISON_SIGN_WORDS,
3361
- zr as CONTROL_BINDING_MAPPING_MISSING_ERROR_CODE,
3362
- Yr as CONTROL_BINDING_TARGET_INVALID_ERROR_CODE,
3363
- Jr as CONTROL_BINDING_VALUE_INVALID_ERROR_CODE,
3364
- Xr as CONTROL_CONTEXT_UNSUPPORTED_ERROR_CODE,
3365
- Zr as CONTROL_DEFINITION_DUPLICATE_ERROR_CODE,
3366
- ed as CONTROL_DEFINITION_INVALID_ERROR_CODE,
3367
- td as CONTROL_PLACEHOLDER_QUOTED_ERROR_CODE,
3368
- ad as CONTROL_REFERENCE_MISSING_ERROR_CODE,
3369
- sd as CONTROL_VALUE_INVALID_ERROR_CODE,
3370
- od as CONTROL_VALUE_MISSING_ERROR_CODE,
3371
- Xm as CORNER_STEPS,
3366
+ Qr as CHIP_VALUE_COLUMN,
3367
+ Hr as COLUMN_KEY_CLASSES,
3368
+ zr as COLUMN_PRESENTATION_KEYS,
3369
+ af as COMPARISON_SIGN_WORDS,
3370
+ Yr as CONTROL_BINDING_MAPPING_MISSING_ERROR_CODE,
3371
+ Jr as CONTROL_BINDING_TARGET_INVALID_ERROR_CODE,
3372
+ Xr as CONTROL_BINDING_VALUE_INVALID_ERROR_CODE,
3373
+ Zr as CONTROL_CONTEXT_UNSUPPORTED_ERROR_CODE,
3374
+ ed as CONTROL_DEFINITION_DUPLICATE_ERROR_CODE,
3375
+ td as CONTROL_DEFINITION_INVALID_ERROR_CODE,
3376
+ ad as CONTROL_PLACEHOLDER_QUOTED_ERROR_CODE,
3377
+ sd as CONTROL_REFERENCE_MISSING_ERROR_CODE,
3378
+ od as CONTROL_VALUE_INVALID_ERROR_CODE,
3379
+ nd as CONTROL_VALUE_MISSING_ERROR_CODE,
3380
+ ah as CORNER_STEPS,
3372
3381
  ce as CardQueryRequestError,
3373
- nd as ControlResolutionError,
3374
- id as DASHBOARD_CHANGE_OPS,
3375
- rd as DASHBOARD_DEFAULT_OPTION_DEPENDENCIES,
3376
- Zu as DASHBOARD_FILTER_OPERATIONS,
3377
- dd as DASHBOARD_INPUT_RUNTIME_SCOPE_KINDS,
3378
- on as DASHBOARD_STYLE_NUMBER_BOUNDS,
3379
- ef as DOCUMENT_KPI_SECTION_MAX_CARDS,
3380
- tf as DOCUMENT_KPI_SECTION_MAX_TILES,
3381
- ld as DYNAMIC_TEXT_MESSAGE,
3382
- cd as DashboardFilterMappingContractError,
3383
- ud as ExecutionControlContractError,
3384
- fd as FILTER_OPERATORS,
3382
+ id as ControlResolutionError,
3383
+ rd as DASHBOARD_CHANGE_OPS,
3384
+ dd as DASHBOARD_DEFAULT_OPTION_DEPENDENCIES,
3385
+ sf as DASHBOARD_FILTER_OPERATIONS,
3386
+ ld as DASHBOARD_INPUT_RUNTIME_SCOPE_KINDS,
3387
+ nn as DASHBOARD_STYLE_NUMBER_BOUNDS,
3388
+ of as DOCUMENT_KPI_SECTION_MAX_CARDS,
3389
+ nf as DOCUMENT_KPI_SECTION_MAX_TILES,
3390
+ cd as DYNAMIC_TEXT_MESSAGE,
3391
+ ud as DashboardFilterMappingContractError,
3392
+ fd as ExecutionControlContractError,
3393
+ md as FILTER_OPERATORS,
3385
3394
  ua as FORMAT_WORDS,
3386
- md as FilterModelError,
3387
- hd as KPI_MEASURES_SHOWN,
3388
- pd as LEGACY_TABLE_CARD_TYPES,
3389
- Gf as LEGACY_TABLE_ROUTING_ID_NAMESPACE,
3395
+ hd as FilterModelError,
3396
+ pd as KPI_MEASURES_SHOWN,
3397
+ gd as KPI_TREND_PERIODS,
3398
+ bd as LEGACY_TABLE_CARD_TYPES,
3399
+ Yf as LEGACY_TABLE_ROUTING_ID_NAMESPACE,
3390
3400
  ba as MAX_CREATE_CHANGES,
3391
- vo as MAX_PROPOSED_CHANGES,
3392
- gd as MAX_QUERY_LIMIT,
3393
- bd as MAX_TEXT_WORDS,
3394
- yd as MEASURE_CALCULATION_SUMMARIES,
3395
- _m as NEW_CARD_TYPE,
3396
- vd as PUBLIC_TRANSFORM_KIND,
3397
- Id as QUERY_ASPECTS,
3398
- _d as QUERY_CONFIG_KEY_ASPECTS,
3399
- Cm as RELATIONSHIP_ROUTE_CHANGED_MESSAGE,
3400
- Cd as RESERVED_VARIABLE_NAMES,
3401
- $d as SEMAPHOR_CARTESIAN_CHART_TYPES,
3402
- wd as SETTINGS_BY_KIND,
3403
- th as SHELF_FIELD_KEYS,
3404
- Zm as SPACING_STEPS,
3405
- xd as TIME_GRAINS,
3406
- Sd as TOOLBAR_FILTER_REACH_FIELDS,
3407
- af as VARIABLE_CARD_TYPE,
3408
- sf as VARIABLE_COMPARISON_PARTS,
3409
- kd as VARIABLE_GETS,
3410
- of as VARIABLE_LIST_CAP,
3411
- nf as VARIABLE_LIST_SHOWN,
3412
- Td as VARIABLE_NAME_PATTERN,
3413
- rf as VARIABLE_VALUE_PART,
3414
- Fd as WINDOW_ERROR_CODES,
3415
- Rd as WINDOW_WARNING_CODES,
3416
- Ad as acceptedColumnRefKinds,
3417
- Dd as analyticsFilterSchema,
3418
- Qf as applyCardReferenceRemapping,
3419
- Od as applyCardSettings,
3401
+ yd as MAX_NEXT_STEP_CHARS,
3402
+ Io as MAX_PROPOSED_CHANGES,
3403
+ vd as MAX_QUERY_LIMIT,
3404
+ Id as MAX_TEXT_WORDS,
3405
+ _d as MEASURE_CALCULATION_SUMMARIES,
3406
+ xm as NEW_CARD_TYPE,
3407
+ Cd as PUBLIC_TRANSFORM_KIND,
3408
+ $d as QUERY_ASPECTS,
3409
+ wd as QUERY_CONFIG_KEY_ASPECTS,
3410
+ Sm as RELATIONSHIP_ROUTE_CHANGED_MESSAGE,
3411
+ xd as RESERVED_VARIABLE_NAMES,
3412
+ Sd as SEMAPHOR_CARTESIAN_CHART_TYPES,
3413
+ kd as SETTINGS_BY_KIND,
3414
+ nh as SHELF_FIELD_KEYS,
3415
+ sh as SPACING_STEPS,
3416
+ Td as TIME_GRAINS,
3417
+ Rd as TOOLBAR_FILTER_REACH_FIELDS,
3418
+ rf as VARIABLE_CARD_TYPE,
3419
+ df as VARIABLE_COMPARISON_PARTS,
3420
+ Fd as VARIABLE_GETS,
3421
+ lf as VARIABLE_LIST_CAP,
3422
+ cf as VARIABLE_LIST_SHOWN,
3423
+ Ad as VARIABLE_NAME_PATTERN,
3424
+ uf as VARIABLE_VALUE_PART,
3425
+ Dd as WINDOW_ERROR_CODES,
3426
+ Od as WINDOW_WARNING_CODES,
3427
+ Ed as acceptedColumnRefKinds,
3428
+ qd as analyticsFilterSchema,
3429
+ Jf as applyCardReferenceRemapping,
3430
+ Nd as applyCardSettings,
3420
3431
  wt as applyDashboardOperations,
3421
- Ed as applyFilterApplicability,
3422
- $m as applyFilterSettingsChange,
3423
- Hf as applyGroupByOverride,
3424
- qd as applyLinkedClickToFilterOverrides,
3425
- Nd as applyMeasureCalculations,
3426
- Pd as applyOptionDependencyOverride,
3427
- Ld as applyVariableChange,
3428
- Md as blockClause,
3429
- Bd as blockSentence,
3430
- ch as bookmarkImpactSentence,
3431
- wm as buildCardExportFormatOptions,
3432
- zf as buildCardExportQueryContext,
3433
- xm as buildCardExportRequest,
3434
- Sm as buildCardExportRequestFromOptions,
3435
- km as buildColumnCatalog,
3436
- Vd as buildControlDefinitionIndex,
3437
- so as buildDashboardCardSourceIndex,
3438
- Tm as buildEntityColumnGroup,
3439
- Fm as buildFilterInputFromDefinition,
3440
- Go as buildFilterInputFromField,
3441
- jd as buildLinkedClickToFilterOverrides,
3442
- Kd as buildProposeChangeInputSchema,
3443
- Wd as buildSavedEditorCard,
3444
- Rm as buildTableExportFormatOptions,
3445
- Am as cardColumnRefForKey,
3446
- Ud as cardColumnRefSchema,
3447
- Co as cardConditionalFormattingSchema,
3448
- Gd as cardQueryPatchSchema,
3449
- qs as cardSettingsKind,
3450
- Os as cardTypeSentenceName,
3451
- Qd as carryColumnSettings,
3452
- mo as changeCardType,
3453
- Hd as changeMatrixEditor,
3454
- $o as checkConditionalRuleColumns,
3432
+ Pd as applyFilterApplicability,
3433
+ km as applyFilterSettingsChange,
3434
+ Xf as applyGroupByOverride,
3435
+ Ld as applyLinkedClickToFilterOverrides,
3436
+ Md as applyMeasureCalculations,
3437
+ Bd as applyOptionDependencyOverride,
3438
+ Vd as applyVariableChange,
3439
+ jd as blockClause,
3440
+ Kd as blockSentence,
3441
+ hh as bookmarkImpactSentence,
3442
+ Tm as buildCardExportFormatOptions,
3443
+ Zf as buildCardExportQueryContext,
3444
+ Rm as buildCardExportRequest,
3445
+ Fm as buildCardExportRequestFromOptions,
3446
+ Am as buildColumnCatalog,
3447
+ Wd as buildControlDefinitionIndex,
3448
+ oo as buildDashboardCardSourceIndex,
3449
+ Dm as buildEntityColumnGroup,
3450
+ Om as buildFilterInputFromDefinition,
3451
+ Qo as buildFilterInputFromField,
3452
+ Ud as buildLinkedClickToFilterOverrides,
3453
+ Gd as buildProposeChangeInputSchema,
3454
+ Qd as buildSavedEditorCard,
3455
+ Em as buildTableExportFormatOptions,
3456
+ qm as cardColumnRefForKey,
3457
+ Hd as cardColumnRefSchema,
3458
+ $o as cardConditionalFormattingSchema,
3459
+ zd as cardQueryPatchSchema,
3460
+ Ns as cardSettingsKind,
3461
+ Es as cardTypeSentenceName,
3462
+ Yd as carryColumnSettings,
3463
+ ho as changeCardType,
3464
+ Jd as changeMatrixEditor,
3465
+ wo as checkConditionalRuleColumns,
3455
3466
  Dt as checkDataVariable,
3456
- zd as checkDetailDateFormat,
3457
- Er as checkPresentationStores,
3458
- Yd as chipOverVariable,
3459
- Jd as clickToFilterSettingsSchema,
3460
- Xd as collectJoinPlanIdentifiers,
3467
+ Xd as checkDetailDateFormat,
3468
+ qr as checkPresentationStores,
3469
+ Zd as chipOverVariable,
3470
+ el as clickToFilterSettingsSchema,
3471
+ tl as collectJoinPlanIdentifiers,
3461
3472
  Qa as collectVariableReferences,
3462
3473
  Na as columnDataset,
3463
- ho as columnFieldKey,
3474
+ po as columnFieldKey,
3464
3475
  Ka as columnKeys,
3465
- Zd as columnRefIssue,
3476
+ al as columnRefIssue,
3466
3477
  la as columnRefKey,
3467
- el as columnSettingsInputSchema,
3468
- df as comparisonPartPresentation,
3469
- Yf as composeCardReferenceRemapping,
3470
- tl as conditionalRuleSchema,
3471
- Nr as confirmClassFor,
3472
- al as controlBindingExecutionSchema,
3473
- sl as controlDefinitionExecutionSchema,
3474
- to as controlRefusal,
3478
+ sl as columnSettingsInputSchema,
3479
+ ff as comparisonPartPresentation,
3480
+ em as composeCardReferenceRemapping,
3481
+ ol as conditionalRuleSchema,
3482
+ Pr as confirmClassFor,
3483
+ nl as controlBindingExecutionSchema,
3484
+ il as controlDefinitionExecutionSchema,
3485
+ ao as controlRefusal,
3475
3486
  Fr as convertLegacyStyle,
3476
- ol as createDashboardFilterBindingId,
3477
- hm as createMatrixAuthoringDraft,
3478
- pm as createMatrixConfig,
3479
- Ho as createNewCard,
3480
- nl as createTargetSchema,
3481
- Qo as createTextCard,
3482
- il as dashboardCardFilterSourceInventoryContains,
3483
- Js as dashboardChangeSchema,
3484
- rl as dashboardFilterTargetMatchesLogicalValue,
3485
- lf as dashboardFilterValueTypeForDataType,
3486
- Eo as dashboardInputScopeIncludesDocumentSheets,
3487
- kn as dashboardStyleAsEdit,
3488
- dl as dashboardStyleChangeSchema,
3487
+ rl as createDashboardFilterBindingId,
3488
+ ym as createMatrixAuthoringDraft,
3489
+ vm as createMatrixConfig,
3490
+ zo as createNewCard,
3491
+ dl as createTargetSchema,
3492
+ Ho as createTextCard,
3493
+ ll as dashboardCardFilterSourceInventoryContains,
3494
+ Xs as dashboardChangeSchema,
3495
+ cl as dashboardFilterTargetMatchesLogicalValue,
3496
+ mf as dashboardFilterValueTypeForDataType,
3497
+ qo as dashboardInputScopeIncludesDocumentSheets,
3498
+ Tn as dashboardStyleAsEdit,
3499
+ ul as dashboardStyleChangeSchema,
3489
3500
  za as dashboardStyleLayers,
3490
- ll as defaultClickToFilterSettings,
3491
- hn as defaultVariableGet,
3492
- ah as defaultVariableName,
3493
- uh as describeBookmarkImpact,
3494
- cl as describeDashboardFilterCardReach,
3501
+ fl as defaultClickToFilterSettings,
3502
+ pn as defaultVariableGet,
3503
+ ih as defaultVariableName,
3504
+ ph as describeBookmarkImpact,
3505
+ ml as describeDashboardFilterCardReach,
3495
3506
  Ee as describeDashboardFilterCardReachDetail,
3496
- ul as describeMeasureCalculations,
3497
- eo as describeQueryChange,
3498
- Dm as describeRelationshipRoute,
3499
- Om as describeRelationshipSkip,
3500
- cf as documentInputTextUsage,
3501
- uf as doesDashboardInputApplyToTarget,
3502
- ff as doesDashboardInputReachFilterTarget,
3503
- mf as doesDashboardInputSurviveCarriedContext,
3504
- fl as doesToolbarFilterReachTab,
3505
- Em as domainCalculatedFields,
3506
- sh as draftBlocker,
3507
- pn as draftFromVariable,
3508
- ml as drawsDetailDatesInBrowser,
3509
- hl as dropMatrixEditorField,
3510
- mh as editBrandStyle,
3511
- nn as editDashboardStyle,
3512
- pl as evaluateConditionalRules,
3513
- gl as explicitComparisonSchema,
3514
- Ws as fieldIdentityKey,
3515
- bl as fieldRef,
3516
- yl as fieldRefSchema,
3517
- vl as filterApplicabilityContextForCard,
3518
- qm as filterReachPreviewAnswers,
3519
- Il as filterValueReachForCard,
3520
- _l as filterValueSemanticDataset,
3507
+ hl as describeMeasureCalculations,
3508
+ to as describeQueryChange,
3509
+ Nm as describeRelationshipRoute,
3510
+ Pm as describeRelationshipSkip,
3511
+ hf as documentInputTextUsage,
3512
+ pf as doesDashboardInputApplyToTarget,
3513
+ gf as doesDashboardInputReachFilterTarget,
3514
+ bf as doesDashboardInputSurviveCarriedContext,
3515
+ pl as doesToolbarFilterReachTab,
3516
+ Lm as domainCalculatedFields,
3517
+ rh as draftBlocker,
3518
+ gn as draftFromVariable,
3519
+ gl as drawsDetailDatesInBrowser,
3520
+ bl as dropMatrixEditorField,
3521
+ bh as editBrandStyle,
3522
+ rn as editDashboardStyle,
3523
+ yl as evaluateConditionalRules,
3524
+ vl as explicitComparisonSchema,
3525
+ Us as fieldIdentityKey,
3526
+ Il as fieldRef,
3527
+ _l as fieldRefSchema,
3528
+ Cl as filterApplicabilityContextForCard,
3529
+ Mm as filterReachPreviewAnswers,
3530
+ $l as filterValueReachForCard,
3531
+ wl as filterValueSemanticDataset,
3521
3532
  ot as findCatalogField,
3522
- Cl as findDashboardCardExecutableSource,
3523
- $l as findDashboardCardPinnedCatalogSource,
3533
+ xl as findDashboardCardExecutableSource,
3534
+ Sl as findDashboardCardPinnedCatalogSource,
3524
3535
  Ua as findDashboardFilterTarget,
3525
- wl as findDashboardSqlPinnedCatalogSource,
3536
+ kl as findDashboardSqlPinnedCatalogSource,
3526
3537
  ps as findRetiredCardPresentationFields,
3527
- Or as findRetiredPresentationFields,
3528
- Ks as findSortedColumn,
3529
- Nm as flattenEntityColumns,
3530
- xl as foldPrototypeDocumentInputs,
3531
- Sl as formatFilterModelIssues,
3538
+ Er as findRetiredPresentationFields,
3539
+ Ws as findSortedColumn,
3540
+ Bm as flattenEntityColumns,
3541
+ Tl as foldPrototypeDocumentInputs,
3542
+ Rl as formatFilterModelIssues,
3532
3543
  ws as formatResolvedPrimaryDateFieldIssues,
3533
- kl as formatSkippedFilterWarnings,
3534
- Tl as fromEditableRules,
3535
- Pm as getCalculatedFieldAggregateOverrides,
3536
- Fl as getCalculatedFieldNamespace,
3537
- Lm as getCalculatedFieldParameters,
3538
- Mm as getCalculatedFieldShelfOverrides,
3539
- Rl as getCardDefinition,
3540
- Bm as getClickContextFromTable,
3541
- Al as getColumnCatalogFieldId,
3542
- Dl as getDashboardFilterSubscriptionHint,
3543
- Ol as getDashboardGlobalDateFilter,
3544
- hf as getDocumentKpiSectionShapeIssues,
3545
- pf as getDocumentSectionCards,
3546
- Vm as getDomainCalculatedSelectionOverrides,
3547
- El as getFieldAggregationOptions,
3548
- ql as getMatrixBindingTargets,
3549
- gm as getMatrixLevelLabel,
3550
- bm as getMatrixMeasureLabel,
3551
- Nl as getStableDomainCalculatedFieldId,
3552
- Pl as getTemporalBucketAuthoringOptions,
3553
- Ll as getTemporalBucketAuthoringSelection,
3554
- Ml as handleSchema,
3555
- Bl as hasDashboardFilterSubscription,
3544
+ Fl as formatSkippedFilterWarnings,
3545
+ Al as fromEditableRules,
3546
+ Vm as getCalculatedFieldAggregateOverrides,
3547
+ Dl as getCalculatedFieldNamespace,
3548
+ jm as getCalculatedFieldParameters,
3549
+ Km as getCalculatedFieldShelfOverrides,
3550
+ Ol as getCardDefinition,
3551
+ Wm as getClickContextFromTable,
3552
+ El as getColumnCatalogFieldId,
3553
+ ql as getDashboardFilterSubscriptionHint,
3554
+ Nl as getDashboardGlobalDateFilter,
3555
+ yf as getDocumentKpiSectionShapeIssues,
3556
+ vf as getDocumentSectionCards,
3557
+ Um as getDomainCalculatedSelectionOverrides,
3558
+ Pl as getFieldAggregationOptions,
3559
+ Ll as getMatrixBindingTargets,
3560
+ Im as getMatrixLevelLabel,
3561
+ _m as getMatrixMeasureLabel,
3562
+ Ml as getStableDomainCalculatedFieldId,
3563
+ Bl as getTemporalBucketAuthoringOptions,
3564
+ Vl as getTemporalBucketAuthoringSelection,
3565
+ jl as handleSchema,
3566
+ Kl as hasDashboardFilterSubscription,
3556
3567
  ue as hasStoredKey,
3557
- Vl as hasTextCardRichWords,
3558
- jl as hasToolbarFilterReachField,
3559
- Jf as hostFilterValueFor,
3560
- Xf as hostFilterValuesToSlots,
3561
- Kl as inspectMatrixCardConfig,
3562
- Zf as isAdHocFilterValueOnTab,
3568
+ Wl as hasTextCardRichWords,
3569
+ Ul as hasToolbarFilterReachField,
3570
+ tm as hostFilterValueFor,
3571
+ am as hostFilterValuesToSlots,
3572
+ Gl as inspectMatrixCardConfig,
3573
+ sm as isAdHocFilterValueOnTab,
3563
3574
  Ca as isAggregateGet,
3564
- Wl as isAllowedDashboardInputScopeCombination,
3565
- Ul as isCardType,
3566
- gf as isDashboardFilterOperationCompatible,
3575
+ Ql as isAllowedDashboardInputScopeCombination,
3576
+ Hl as isCardType,
3577
+ If as isDashboardFilterOperationCompatible,
3567
3578
  Ga as isDashboardInputOnTab,
3568
- bf as isDashboardInputOwnedBySheet,
3569
- yf as isDashboardInputScopeEmpty,
3570
- vf as isDashboardTargetIdTaken,
3571
- Gl as isDatabaseEntityReference,
3572
- Ql as isGroupedDate,
3573
- Hl as isLegacyTableCard,
3574
- zl as isPresentationCurrencyBinding,
3575
- Yl as isSemanticAutoJoinCard,
3576
- Jl as isSemaphorCartesianChartType,
3577
- Ao as isSqlKpi,
3578
- Xl as isStructuralControlBinding,
3579
- Zl as isTextCardRichContent,
3580
- ec as isValidControlOptionPresentation,
3581
- If as isVariableComparisonPart,
3582
- tc as isWhenRun,
3583
- ac as kpiSegmentMetricId,
3584
- js as labelAt,
3585
- sc as layoutArrangeSchema,
3586
- em as legacyTableRoutingIds,
3587
- tm as legacyTableRoutingTarget,
3588
- oc as linkedClickToFilterOverridesSchema,
3589
- am as listAdHocFilterValuesOnTab,
3579
+ _f as isDashboardInputOwnedBySheet,
3580
+ Cf as isDashboardInputScopeEmpty,
3581
+ $f as isDashboardTargetIdTaken,
3582
+ zl as isDatabaseEntityReference,
3583
+ Yl as isGroupedDate,
3584
+ Jl as isLegacyTableCard,
3585
+ Xl as isPresentationCurrencyBinding,
3586
+ Zl as isSemanticAutoJoinCard,
3587
+ ec as isSemaphorCartesianChartType,
3588
+ Do as isSqlKpi,
3589
+ tc as isStructuralControlBinding,
3590
+ ac as isTextCardRichContent,
3591
+ sc as isValidControlOptionPresentation,
3592
+ wf as isVariableComparisonPart,
3593
+ oc as isWhenRun,
3594
+ nc as kpiSegmentMetricId,
3595
+ ic as kpiShowsTrend,
3596
+ Os as kpiTrendBy,
3597
+ Ks as labelAt,
3598
+ rc as layoutArrangeSchema,
3599
+ om as legacyTableRoutingIds,
3600
+ nm as legacyTableRoutingTarget,
3601
+ dc as linkedClickToFilterOverridesSchema,
3602
+ im as listAdHocFilterValuesOnTab,
3590
3603
  we as listDashboardCardLocations,
3591
- nc as listDashboardFilterDefinitions,
3592
- ic as listDashboardFilterInputsOnTab,
3604
+ lc as listDashboardFilterDefinitions,
3605
+ cc as listDashboardFilterInputsOnTab,
3593
3606
  Wa as listDashboardFilterTargets,
3594
- _f as listDashboardInputReachKeys,
3595
- Do as listDashboardInputScopeExceptedCardIds,
3596
- Oo as listDashboardInputScopeExceptedSheetIds,
3597
- rc as listDashboardInputsTolerantly,
3607
+ xf as listDashboardInputReachKeys,
3608
+ Oo as listDashboardInputScopeExceptedCardIds,
3609
+ Eo as listDashboardInputScopeExceptedSheetIds,
3610
+ uc as listDashboardInputsTolerantly,
3598
3611
  Ot as listDashboardTabTargets,
3599
- Cf as listDataVariablePlaces,
3600
- sm as listFilterInputValueTargets,
3601
- $f as listFilterTargetScopeTargets,
3602
- wf as listReachedVariableTargets,
3603
- xf as listReferencedDataVariableIds,
3604
- dc as listStoredFilterDefinitions,
3605
- Sf as listVariableScopeTargets,
3606
- kf as mapDashboardCards,
3607
- Tf as mapDocumentSectionCards,
3608
- lc as mapRuleColumns,
3609
- cc as matchColumns,
3610
- om as matrixCatalogSources,
3611
- bo as matrixColumnKeys,
3612
- uc as matrixColumnsSchema,
3613
- fc as matrixDefinitionFieldRefs,
3614
- mc as matrixDefinitionFields,
3615
- hc as matrixDefinitionSources,
3616
- pc as matrixEditorCatalogFromFields,
3617
- nm as matrixExecutionSources,
3618
- gc as measureCalculationOptions,
3619
- bc as measureComparisonSchema,
3620
- yc as measureRefSchema,
3621
- vc as measureTransformSchema,
3622
- ym as mergeMatrixSorts,
3623
- io as metricCardQuerySchema,
3624
- go as moveMatrixLevel,
3625
- oh as newVariableDraft,
3626
- nh as newVariableId,
3627
- Ic as normalizeClickToFilterSettings,
3628
- _c as normalizeDashboardInputs,
3629
- Cc as normalizeLegacyLinkedTargetOverrides,
3630
- $c as occurrenceKeys,
3612
+ Sf as listDataVariablePlaces,
3613
+ rm as listFilterInputValueTargets,
3614
+ kf as listFilterTargetScopeTargets,
3615
+ Tf as listReachedVariableTargets,
3616
+ Rf as listReferencedDataVariableIds,
3617
+ fc as listStoredFilterDefinitions,
3618
+ Ff as listVariableScopeTargets,
3619
+ Af as mapDashboardCards,
3620
+ Df as mapDocumentSectionCards,
3621
+ mc as mapRuleColumns,
3622
+ hc as matchColumns,
3623
+ dm as matrixCatalogSources,
3624
+ yo as matrixColumnKeys,
3625
+ pc as matrixColumnsSchema,
3626
+ gc as matrixDefinitionFieldRefs,
3627
+ bc as matrixDefinitionFields,
3628
+ yc as matrixDefinitionSources,
3629
+ vc as matrixEditorCatalogFromFields,
3630
+ lm as matrixExecutionSources,
3631
+ Ic as measureCalculationOptions,
3632
+ _c as measureComparisonSchema,
3633
+ Cc as measureRefSchema,
3634
+ $c as measureTransformSchema,
3635
+ Cm as mergeMatrixSorts,
3636
+ ro as metricCardQuerySchema,
3637
+ bo as moveMatrixLevel,
3638
+ dh as newVariableDraft,
3639
+ lh as newVariableId,
3640
+ wc as normalizeClickToFilterSettings,
3641
+ xc as normalizeDashboardInputs,
3642
+ Sc as normalizeLegacyLinkedTargetOverrides,
3643
+ kc as occurrenceKeys,
3631
3644
  es as outlineCalendar,
3632
- Dr as outlineDashboard,
3645
+ Or as outlineDashboard,
3633
3646
  Le as outlineFilter,
3634
3647
  as as outlineFilters,
3635
3648
  ut as ownsItsAggregate,
3636
- Tr as parseCardQueryRequest,
3637
- Cn as parseCardQueryRequestContext,
3638
- kr as parseCardQueryRequestExtras,
3639
- wc as parseColumnRefKey,
3640
- jm as parseDashboardStyle,
3641
- xc as parseExecutionControlBindingsShallow,
3649
+ Rr as parseCardQueryRequest,
3650
+ $n as parseCardQueryRequestContext,
3651
+ Tr as parseCardQueryRequestExtras,
3652
+ Tc as parseColumnRefKey,
3653
+ Gm as parseDashboardStyle,
3654
+ Rc as parseExecutionControlBindingsShallow,
3642
3655
  Ss as parseExecutionControlContext,
3643
- Sc as parseExecutionControlContract,
3656
+ Fc as parseExecutionControlContract,
3644
3657
  pa as planCardLabels,
3645
3658
  ha as planCardRequery,
3646
- Km as pluralDatasetLabel,
3647
- im as prepareLoadedDashboard,
3648
- kc as previewTemporalBucketAuthoringFormat,
3649
- Ff as projectDataVariableToCard,
3650
- Tc as pruneUnrelatedCalculatedFilters,
3651
- ao as queryForm,
3652
- Fc as queryMeasureSchema,
3653
- Rc as readCardConditionalRules,
3659
+ Qm as pluralDatasetLabel,
3660
+ cm as prepareLoadedDashboard,
3661
+ Ac as previewTemporalBucketAuthoringFormat,
3662
+ Of as projectDataVariableToCard,
3663
+ Dc as pruneUnrelatedCalculatedFilters,
3664
+ so as queryForm,
3665
+ Oc as queryMeasureSchema,
3666
+ Ec as readCardConditionalRules,
3654
3667
  Ce as readCardQuery,
3655
3668
  At as readCardSettings,
3656
3669
  he as readCardSource,
3657
3670
  qe as readCardTypeProperties,
3658
- rh as readComparisonDates,
3671
+ uh as readComparisonDates,
3659
3672
  $e as readDashboardFilterModel,
3660
- dh as readDefaultComparisonDates,
3661
- Ac as readExactDomainCalculatedFieldReference,
3662
- Wm as readFilterReachResponse,
3663
- rm as readFilterValueList,
3664
- Dc as readKpiFigure,
3665
- Oc as readMatrixCardConfig,
3666
- Ec as readMeasureCalculations,
3667
- qc as readSqlFilterUse,
3668
- Nc as readStoredTransform,
3673
+ fh as readDefaultComparisonDates,
3674
+ qc as readExactDomainCalculatedFieldReference,
3675
+ Hm as readFilterReachResponse,
3676
+ um as readFilterValueList,
3677
+ Nc as readKpiFigure,
3678
+ Pc as readMatrixCardConfig,
3679
+ Lc as readMeasureCalculations,
3680
+ Mc as readSqlFilterUse,
3681
+ Bc as readStoredTransform,
3669
3682
  ja as readTextCardWords,
3670
3683
  Ze as readTextWords,
3671
- Pc as readTransform,
3672
- Rf as readVariableAnswer,
3684
+ Vc as readTransform,
3685
+ Ef as readVariableAnswer,
3673
3686
  rs as readVariableEditability,
3674
3687
  kt as readVariableSource,
3675
- Io as readablePresentation,
3676
- Lc as rebindDashboardOptionDependencyInputId,
3688
+ _o as readablePresentation,
3689
+ jc as rebindDashboardOptionDependencyInputId,
3677
3690
  ma as rebuildsRole,
3678
- Mc as reconcileMatrixSpecStructure,
3679
- Bc as reconcileTemporalBucketAuthoringFormat,
3680
- no as recordsCardQuerySchema,
3681
- zs as refDataset,
3691
+ Kc as reconcileMatrixSpecStructure,
3692
+ Wc as reconcileTemporalBucketAuthoringFormat,
3693
+ io as recordsCardQuerySchema,
3694
+ Ys as refDataset,
3682
3695
  be as refKey,
3683
3696
  Ct as refName,
3684
- Vc as relationshipAddSchema,
3685
- jc as relationshipRouteTarget,
3686
- Kc as remapClickToFilterReferences,
3687
- Wc as remapLinkedClickToFilterOverrides,
3688
- Uc as requireNormalizedDashboardInputs,
3689
- Gc as resolveBindingControlValue,
3690
- Af as resolveCanonicalDetailResultRawKey,
3691
- Df as resolveCanonicalResultOutputKey,
3692
- Po as resolveCanonicalResultOutputKeys,
3693
- Of as resolveCanonicalResultRawKey,
3694
- Um as resolveCardColumnRef,
3695
- Un as resolveCardSettings,
3696
- Gm as resolveConditionalRules,
3697
- Rr as resolveDashboardChanges,
3698
- Ar as resolveDashboardCreate,
3699
- Qc as resolveDashboardEntitySource,
3700
- Hc as resolveDashboardFilterAutomaticTarget,
3701
- zc as resolveDashboardFilterInheritedTarget,
3702
- Yc as resolveDashboardOptionDependencies,
3703
- Jc as resolveDashboardOptionPopulation,
3704
- Xc as resolveDashboardSqlFilterTarget,
3705
- rn as resolveDashboardStyle,
3706
- Zc as resolveDetailTableRawTemporalPresentation,
3707
- eu as resolveFieldSelectedSource,
3708
- tu as resolveGroupByFieldTarget,
3709
- au as resolveKpiLayout,
3697
+ Uc as relationshipAddSchema,
3698
+ Gc as relationshipRouteTarget,
3699
+ Qc as remapClickToFilterReferences,
3700
+ Hc as remapLinkedClickToFilterOverrides,
3701
+ zc as requireNormalizedDashboardInputs,
3702
+ Yc as resolveBindingControlValue,
3703
+ qf as resolveCanonicalDetailResultRawKey,
3704
+ Nf as resolveCanonicalResultOutputKey,
3705
+ Lo as resolveCanonicalResultOutputKeys,
3706
+ Pf as resolveCanonicalResultRawKey,
3707
+ zm as resolveCardColumnRef,
3708
+ Gn as resolveCardSettings,
3709
+ Ym as resolveConditionalRules,
3710
+ Ar as resolveDashboardChanges,
3711
+ Dr as resolveDashboardCreate,
3712
+ Jc as resolveDashboardEntitySource,
3713
+ Xc as resolveDashboardFilterAutomaticTarget,
3714
+ Zc as resolveDashboardFilterInheritedTarget,
3715
+ eu as resolveDashboardOptionDependencies,
3716
+ tu as resolveDashboardOptionPopulation,
3717
+ au as resolveDashboardSqlFilterTarget,
3718
+ dn as resolveDashboardStyle,
3719
+ su as resolveDetailTableRawTemporalPresentation,
3720
+ ou as resolveFieldSelectedSource,
3721
+ nu as resolveGroupByFieldTarget,
3722
+ iu as resolveKpiLayout,
3710
3723
  La as resolveKpiShape,
3711
- su as resolveKpiValueStyle,
3712
- dm as resolveMatrixControlBindings,
3713
- vm as resolveMatrixDefinition,
3724
+ ru as resolveKpiValueStyle,
3725
+ fm as resolveMatrixControlBindings,
3726
+ $m as resolveMatrixDefinition,
3714
3727
  fa as resolveMeasureCalculations,
3715
- ou as resolveMeasureTransform,
3716
- nu as resolveMetricFieldTarget,
3717
- iu as resolveScalarMappedValue,
3718
- ru as resolveTemporalBucketAuthoringFormat,
3728
+ du as resolveMeasureTransform,
3729
+ lu as resolveMetricFieldTarget,
3730
+ cu as resolveScalarMappedValue,
3731
+ uu as resolveTemporalBucketAuthoringFormat,
3719
3732
  xs as resolveTemporalResultOwner,
3720
3733
  ga as resolveTextCardWords,
3721
- du as resolveValueStyle,
3722
- lu as respondsToSelectionsSchema,
3723
- cu as retainConditionalRules,
3724
- uu as retainedMatrixPath,
3725
- Ef as rewriteDashboardInputScopeIds,
3726
- lm as routeLegacyTableCard,
3727
- cm as routeLegacyTableCards,
3728
- um as routeLegacyTableFrame,
3734
+ fu as resolveValueStyle,
3735
+ mu as respondsToSelectionsSchema,
3736
+ hu as retainConditionalRules,
3737
+ pu as retainedMatrixPath,
3738
+ Lf as rewriteDashboardInputScopeIds,
3739
+ mm as routeLegacyTableCard,
3740
+ hm as routeLegacyTableCards,
3741
+ pm as routeLegacyTableFrame,
3729
3742
  He as sameColumnKey,
3730
- fu as sanitizeTextCardUrl,
3731
- mu as selectDashboardOptionDependencyInputIds,
3732
- hu as selectionFieldFromExplorerField,
3733
- Qm as selectionTupleFromClickContext,
3734
- Hm as setMeasureCalculations,
3735
- pu as settableCardType,
3736
- gu as sharedCardPreferences,
3737
- bu as sharedTableDialect,
3738
- yu as sheetChangeSchemas,
3739
- oo as sqlCardQuerySchema,
3740
- vu as sqlKpiResultKeys,
3743
+ gu as sanitizeTextCardUrl,
3744
+ bu as selectDashboardOptionDependencyInputIds,
3745
+ yu as selectionFieldFromExplorerField,
3746
+ Jm as selectionTupleFromClickContext,
3747
+ Xm as setMeasureCalculations,
3748
+ vu as settableCardType,
3749
+ Iu as sharedCardPreferences,
3750
+ _u as sharedTableDialect,
3751
+ Cu as sheetChangeSchemas,
3752
+ no as sqlCardQuerySchema,
3753
+ $u as sqlKpiResultKeys,
3741
3754
  Ne as statedLabelsOf,
3742
- Fs as storedCardTypeFor,
3743
- Iu as storedRunPresentation,
3744
- qf as storedTextRefs,
3745
- _u as stripInstanceTargetsForLibrarySave,
3746
- Cu as structuralControlOverride,
3755
+ Rs as storedCardTypeFor,
3756
+ wu as storedRunPresentation,
3757
+ Mf as storedTextRefs,
3758
+ xu as stripInstanceTargetsForLibrarySave,
3759
+ Su as structuralControlOverride,
3747
3760
  ts as summarizeFilter,
3748
- $u as supportsCanonicalDashboardTemporalResult,
3749
- wu as tabChangeSchemas,
3750
- xu as textCardExcerpt,
3751
- Su as textCardWordingClauses,
3761
+ ku as supportsCanonicalDashboardTemporalResult,
3762
+ Tu as tabChangeSchemas,
3763
+ Ru as textCardExcerpt,
3764
+ Fu as textCardWordingClauses,
3752
3765
  _t as textCatalogAt,
3753
3766
  ct as toChartType,
3754
- ku as toEditableRules,
3755
- Tu as toFiniteKpiNumber,
3767
+ Au as toEditableRules,
3768
+ Du as toFiniteKpiNumber,
3756
3769
  $t as toPublicCardType,
3757
- Ys as toStoredComparison,
3758
- Fu as toolbarFilterInputFields,
3759
- Ru as toolbarFilterScope,
3760
- Au as transformComparisonDocument,
3761
- Du as transformGroupings,
3762
- Ou as transformOrderSchema,
3763
- po as updateMatrixConfig,
3764
- zi as upgradeCardFormats,
3765
- qr as upgradeCardPresentation,
3766
- sr as upgradeConditionalFormatting,
3767
- fm as upgradeToStoredDashboard,
3768
- Eu as validateAndResolveWindowTransforms,
3769
- qu as validateControlValue,
3770
- Nf as validateDashboardFilterValues,
3770
+ Js as toStoredComparison,
3771
+ Ou as toolbarFilterInputFields,
3772
+ Eu as toolbarFilterScope,
3773
+ qu as transformComparisonDocument,
3774
+ Nu as transformGroupings,
3775
+ Pu as transformOrderSchema,
3776
+ go as updateMatrixConfig,
3777
+ Yi as upgradeCardFormats,
3778
+ Nr as upgradeCardPresentation,
3779
+ or as upgradeConditionalFormatting,
3780
+ gm as upgradeToStoredDashboard,
3781
+ Lu as validateAndResolveWindowTransforms,
3782
+ Mu as validateControlValue,
3783
+ Bf as validateDashboardFilterValues,
3771
3784
  $s as validateResolvedPrimaryDateFieldShape,
3772
- Pf as variableCardKeepsComparison,
3773
- Lf as variableComparison,
3785
+ Vf as variableCardKeepsComparison,
3786
+ jf as variableComparison,
3774
3787
  Ye as variableFromDraft,
3775
- mn as variableGetOptions,
3776
- Mf as variablePartCell,
3777
- Bf as variablePartType,
3778
- No as variableParts,
3779
- Vf as variableQueryResponseOf,
3780
- zm as variableSourceWords,
3781
- gn as variableTakesComparison,
3782
- Yo as variableWords,
3783
- Nu as withCardConditionalRules,
3784
- Pu as withCardConfigSqlDatePatterns,
3785
- jf as withCardExcludedFromScope,
3786
- Kf as withCardIncludedInScope,
3787
- Lu as withDashboardOptionDependencyOverride,
3788
- Mu as withDetailSqlDatePattern,
3789
- Wf as withDraftCard,
3790
- Bu as withFormatOverride,
3791
- Vu as withSqlDatePattern,
3792
- qo as withUnstatedScopeParts,
3793
- ju as withoutSqlDatePattern,
3794
- Ku as withoutToolbarFilterReachFields,
3795
- Wu as wordingBlocks,
3796
- Uu as wordingClauses,
3797
- Gu as writeColumnFormat,
3798
- Qu as writeColumnPolarity,
3799
- Hu as writeComparisonDisplay,
3800
- zu as writeComparisonPresentation,
3801
- Yu as writeInheritComparison,
3802
- Hs as writeTextWords
3788
+ hn as variableGetOptions,
3789
+ Kf as variablePartCell,
3790
+ Wf as variablePartType,
3791
+ Po as variableParts,
3792
+ Uf as variableQueryResponseOf,
3793
+ Zm as variableSourceWords,
3794
+ bn as variableTakesComparison,
3795
+ Jo as variableWords,
3796
+ Bu as withCardConditionalRules,
3797
+ Vu as withCardConfigSqlDatePatterns,
3798
+ Gf as withCardExcludedFromScope,
3799
+ Qf as withCardIncludedInScope,
3800
+ ju as withDashboardOptionDependencyOverride,
3801
+ Ku as withDetailSqlDatePattern,
3802
+ Hf as withDraftCard,
3803
+ Wu as withFormatOverride,
3804
+ Uu as withSqlDatePattern,
3805
+ No as withUnstatedScopeParts,
3806
+ Gu as withoutSqlDatePattern,
3807
+ Qu as withoutToolbarFilterReachFields,
3808
+ Hu as wordingBlocks,
3809
+ zu as wordingClauses,
3810
+ Yu as writeColumnFormat,
3811
+ Ju as writeColumnPolarity,
3812
+ Xu as writeComparisonDisplay,
3813
+ Zu as writeComparisonPresentation,
3814
+ ef as writeInheritComparison,
3815
+ zs as writeTextWords
3803
3816
  };