react-semaphor 0.1.582 → 0.1.584

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