react-semaphor 0.1.558 → 0.1.560

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 (139) hide show
  1. package/dist/analytics-protocol/index.js +368 -358
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/assistant-protocol/index.js +5 -5
  4. package/dist/brand-studio/index.js +9 -9
  5. package/dist/briefings/index.js +5 -5
  6. package/dist/chunks/analytics-base-schemas-CHLxsPfX.js +630 -0
  7. package/dist/chunks/{assistant-chat-BCWoP6Rf.js → assistant-chat-Bu2fFm_I.js} +206 -207
  8. package/dist/chunks/{bookmark-state-PjQpxbG7.js → bookmark-state-BFY9oNmr.js} +3 -3
  9. package/dist/chunks/{braces-D5Ucy7q1.js → braces-Da41xfUd.js} +1 -1
  10. package/dist/chunks/{comparison-window-caption-Dc7BaCMz.js → comparison-window-caption-4FNkMrzE.js} +213 -213
  11. package/dist/chunks/{context-DVy4HOU0.js → context-BgPDzLHZ.js} +1 -1
  12. package/dist/chunks/{custom-visual-inputs-B-DLRGrV.js → custom-visual-inputs-Dz-enUNR.js} +1 -1
  13. package/dist/chunks/{dashboard-wK6Bai4V.js → dashboard-_MeBuy67.js} +1 -1
  14. package/dist/chunks/{dashboard-briefing-launcher-Coqghdn6.js → dashboard-briefing-launcher-CEi4Pr_v.js} +1152 -1166
  15. package/dist/chunks/{dashboard-controls-BYWSM2RM.js → dashboard-controls-Bi7fyG-4.js} +98 -98
  16. package/dist/chunks/{dashboard-json-pPTB5gj0.js → dashboard-json-B1mU_OMa.js} +5 -5
  17. package/dist/chunks/{document-dashboard-inputs-PY_7Xm55.js → document-dashboard-inputs-CkWfDB8c.js} +64 -64
  18. package/dist/chunks/{edit-dashboard-visual-BODxuUeq.js → edit-dashboard-visual-0CJN31Y3.js} +8274 -8514
  19. package/dist/chunks/filter-reach-copy-BF4w4kI2.js +3738 -0
  20. package/dist/chunks/{filter-value-text-CUBpotVN.js → filter-value-text-CRC-K_l_.js} +3 -3
  21. package/dist/chunks/{global-date-filter-utils-BsFqnnbA.js → global-date-filter-utils-D8365uPH.js} +4088 -3416
  22. package/dist/chunks/{index-DP_wQl0v.js → index-DtHidOPV.js} +579 -604
  23. package/dist/chunks/{layout-grid-CkoXmv0L.js → layout-grid-BvsH4RY2.js} +1 -1
  24. package/dist/chunks/{list-filter-B4i25kuc.js → list-filter-Dg0otx5E.js} +1 -1
  25. package/dist/chunks/{matrix-analytical-definition-4GTUDheD.js → matrix-analytical-definition-CM18W8w6.js} +41 -41
  26. package/dist/chunks/{matrix-card-fS_4O7zA.js → matrix-card-HPskLaPy.js} +3 -3
  27. package/dist/chunks/{matrix-member-presentation-Dj7HaAHC.js → matrix-member-presentation-Bbrfrke4.js} +1 -1
  28. package/dist/chunks/{matrix-operation-contract-CpgLZ7E5.js → matrix-operation-contract-WPv4R-H_.js} +130 -130
  29. package/dist/chunks/{metric-comparison-C8LY7GG5.js → metric-comparison-ljMKYZKa.js} +2 -2
  30. package/dist/chunks/{model-change-CJEj3ZD6.js → model-change-Ccn1zaxl.js} +1 -1
  31. package/dist/chunks/{palette-stlpjVk4.js → palette-Bsh376zO.js} +1 -1
  32. package/dist/chunks/{pivot-result-contract-expectations-DMk-mKhG.js → pivot-result-contract-expectations-Bl5suy4-.js} +602 -696
  33. package/dist/chunks/{pivot-result-identity-CrQ54Xbj.js → pivot-result-identity-vS9TSh4f.js} +1 -1
  34. package/dist/chunks/{raw-temporal-presentation-BI2z2LlB.js → raw-temporal-presentation-BHm7s-hz.js} +230 -274
  35. package/dist/chunks/{report-preferences-dialog-Dc-YyVwf.js → report-preferences-dialog-BV8L0SeS.js} +55 -55
  36. package/dist/chunks/{report-runtime-context-CohdtiMg.js → report-runtime-context-BZQh9ywy.js} +2 -2
  37. package/dist/chunks/{resolve-dashboard-input-context-BZYI1hB0.js → resolve-dashboard-input-context-CAMiWvyR.js} +2021 -2239
  38. package/dist/chunks/{save-C1dgxgAu.js → save-B5EAsgQF.js} +1 -1
  39. package/dist/chunks/{saved-dashboard-context-CIBoMq46.js → saved-dashboard-context-n2Wn11cV.js} +57 -57
  40. package/dist/chunks/{selection-reducer-_d6aKJnj.js → selection-reducer-D0YnaAD9.js} +1 -1
  41. package/dist/chunks/{semaphor-ready-indicator-ERTLU7B4.js → semaphor-ready-indicator-XLBLOJ2V.js} +38446 -39176
  42. package/dist/chunks/{shelf-drop-preview-context-fEnx6iL_.js → shelf-drop-preview-context-DHMa54a-.js} +570 -570
  43. package/dist/chunks/source-entity-resolution-dUG5VWRm.js +607 -0
  44. package/dist/chunks/{switch-BqUan2mN.js → switch-ByxH4M7t.js} +3 -3
  45. package/dist/chunks/{table-export-sheet-CTCTA_bd.js → table-export-sheet-C_GdeTYU.js} +1 -1
  46. package/dist/chunks/{table-settings-DF1gdVQR.js → table-settings-Imz0FgWi.js} +8 -8
  47. package/dist/chunks/{temporal-input-presentation-DoSniQj1.js → temporal-input-presentation-uvNK_tM0.js} +1109 -820
  48. package/dist/chunks/{token-types-DFyLflLY.js → token-types-CQtXUVMy.js} +1 -1
  49. package/dist/chunks/{upload-DcoyjkRV.js → upload-wbR-NVzq.js} +1 -1
  50. package/dist/chunks/{use-create-flow-overlay-state-xhb9YFg-.js → use-create-flow-overlay-state-CEBaLOKC.js} +6 -6
  51. package/dist/chunks/validators-CXTneCA4.js +3453 -0
  52. package/dist/chunks/{zoned-wall-clock-E35Frf9v.js → zoned-wall-clock-B1n_WjW3.js} +1 -1
  53. package/dist/dashboard/index.js +2 -2
  54. package/dist/dashboard-authoring/index.js +2207 -1496
  55. package/dist/data-app-sdk/index.js +20 -20
  56. package/dist/data-app-sdk-adapters/index.js +3 -3
  57. package/dist/data-app-sdk-validation/index.js +6 -6
  58. package/dist/format-utils/index.js +181 -176
  59. package/dist/index.js +22 -22
  60. package/dist/report-runtime-context/index.js +2 -2
  61. package/dist/style.css +1 -1
  62. package/dist/surfboard/index.js +2 -2
  63. package/dist/types/components/editor/editor-aside/utils.d.ts +1 -1
  64. package/dist/types/components/visual/data-table/types/data-table.d.ts +5 -20
  65. package/dist/types/index.js +6 -6
  66. package/dist/types/lib/formatters/canonical-format-adapter.d.ts +2 -29
  67. package/dist/types/lib/formatters/raw-temporal-presentation.d.ts +0 -2
  68. package/dist/types/lib/formatters/table-column-settings.d.ts +47 -0
  69. package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +10 -188
  70. package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +1 -1
  71. package/dist/types/lib/matrix-table/matrix-delivery.d.ts +16 -372
  72. package/dist/types/lib/stores/dashboard-store.d.ts +0 -1
  73. package/dist/types/lib/stores/editor-store.d.ts +39 -9
  74. package/dist/types/lib/stores/table-actions.d.ts +9 -3
  75. package/dist/types/lib/table-formatting/index.d.ts +0 -2
  76. package/dist/types/lib/table-formatting/table-conditional-formatting-range-source.d.ts +3 -2
  77. package/dist/types/lib/table-formatting/table-conditional-formatting-range.d.ts +3 -2
  78. package/dist/types/lib/table-formatting/table-formatting-normalize.d.ts +1 -2
  79. package/dist/types/lib/table-formatting/table-formatting-render-model.d.ts +9 -0
  80. package/dist/types/lib/table-formatting/table-formatting-types.d.ts +5 -95
  81. package/dist/types/lib/table-formatting/table-presentation-fields.d.ts +35 -0
  82. package/dist/types/lib/types/common-types.d.ts +40 -47
  83. package/dist/types/lib/types/explorer-types.d.ts +13 -44
  84. package/dist/types/lib/utils/card-config-utils.d.ts +9 -1
  85. package/dist/types/lib/utils/card-definition.d.ts +9 -187
  86. package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +159 -513
  87. package/dist/types/shared/analytics-protocol/contracts.d.ts +32 -9
  88. package/dist/types/shared/analytics-protocol/execution-input-schemas.d.ts +108 -980
  89. package/dist/types/shared/analytics-protocol/field-validation.d.ts +1 -0
  90. package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +281 -4624
  91. package/dist/types/shared/analytics-protocol/matrix-operation-contract.d.ts +20 -20
  92. package/dist/types/shared/analytics-protocol/matrix-operation-request.d.ts +18 -18
  93. package/dist/types/shared/analytics-protocol/matrix-path-contract.d.ts +40 -40
  94. package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +3 -203
  95. package/dist/types/shared/analytics-protocol/scalar-value.d.ts +8 -8
  96. package/dist/types/shared/analytics-protocol/source-capabilities.d.ts +21 -0
  97. package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +8 -0
  98. package/dist/types/shared/assistant-protocol/context.d.ts +69 -69
  99. package/dist/types/shared/dashboard-authoring/canonical-result-keys.d.ts +13 -0
  100. package/dist/types/shared/dashboard-authoring/card-export-request.d.ts +4 -1
  101. package/dist/types/shared/dashboard-authoring/card-formats/sql-date-pattern.d.ts +10 -0
  102. package/dist/types/shared/dashboard-authoring/card-formats/upgrade-card-formats.d.ts +57 -0
  103. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +24 -24
  104. package/dist/types/shared/dashboard-authoring/conditional-formatting/editable.d.ts +14 -0
  105. package/dist/types/shared/dashboard-authoring/conditional-formatting/evaluate.d.ts +16 -0
  106. package/dist/types/shared/dashboard-authoring/conditional-formatting/index.d.ts +9 -0
  107. package/dist/types/shared/dashboard-authoring/conditional-formatting/kpi.d.ts +14 -0
  108. package/dist/types/shared/dashboard-authoring/conditional-formatting/resolve-card-column-ref.d.ts +17 -0
  109. package/dist/types/shared/dashboard-authoring/conditional-formatting/retain.d.ts +14 -0
  110. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +4499 -0
  111. package/dist/types/shared/dashboard-authoring/conditional-formatting/store.d.ts +12 -0
  112. package/dist/types/shared/dashboard-authoring/conditional-formatting/types.d.ts +151 -0
  113. package/dist/types/shared/dashboard-authoring/conditional-formatting/upgrade.d.ts +35 -0
  114. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +62 -62
  115. package/dist/types/shared/dashboard-authoring/dashboard-card-source-index.d.ts +2 -0
  116. package/dist/types/shared/dashboard-authoring/index.d.ts +5 -0
  117. package/dist/types/shared/dashboard-authoring/legacy-table-routing.d.ts +4 -2
  118. package/dist/types/shared/dashboard-authoring/matrix-authoring.d.ts +4 -5
  119. package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +24 -736
  120. package/dist/types/shared/dashboard-authoring/retired-presentation-fields.d.ts +31 -0
  121. package/dist/types/shared/dashboard-authoring/upgrade-card-presentation.d.ts +14 -0
  122. package/dist/types/shared/format-utils/formatters/matrix-formatter.d.ts +5 -1
  123. package/dist/types/shared/format-utils/formatters/number-formatter.d.ts +16 -0
  124. package/dist/types/shared/format-utils/index.d.ts +2 -0
  125. package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +10 -366
  126. package/dist/types/shared/format-utils/raw-temporal.d.ts +15 -1
  127. package/dist/types/shared/format-utils/resolve-column-format.d.ts +43 -0
  128. package/dist/types/shared/format-utils/retired-format-adapters.d.ts +68 -0
  129. package/dist/types/shared/format-utils/semantic-format.d.ts +5 -1
  130. package/dist/types/shared/format-utils/stored-value-format.d.ts +16 -0
  131. package/dist/types/shared/format-utils/types/format-types.d.ts +10 -12
  132. package/package.json +1 -1
  133. package/dist/chunks/analytics-base-schemas-BUFUoO6G.js +0 -472
  134. package/dist/chunks/editor-draft-sync-BN5qYHPF.js +0 -15
  135. package/dist/chunks/filter-reach-copy-BvJH9JO-.js +0 -3411
  136. package/dist/chunks/source-entity-resolution-DXW1HpKf.js +0 -816
  137. package/dist/chunks/validators-hmfNNQz8.js +0 -3595
  138. package/dist/types/lib/table-formatting/table-conditional-formatting-evaluator.d.ts +0 -9
  139. package/dist/types/lib/table-formatting/table-formatting-validation.d.ts +0 -12
@@ -1,149 +1,151 @@
1
- var Ot = Object.defineProperty;
2
- var Nt = (e, t, a) => t in e ? Ot(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
3
- var ke = (e, t, a) => Nt(e, typeof t != "symbol" ? t + "" : t, a);
4
- import { D as it, r as It, b as qt, c as Pt, a as nt, d as Mt } from "../chunks/filter-reach-copy-BvJH9JO-.js";
5
- import { N as yi, R as _i, f as Ci, j as Si, l as vi, k as wi, u as xi, q as Ti, e as Di, i as ki, y as $i, z as Fi, s as Ai, v as Ri, t as Ei, m as Oi, n as Ni, p as qi, g as Pi, o as Mi, h as Li, x as Bi, w as Vi } from "../chunks/filter-reach-copy-BvJH9JO-.js";
6
- import { M as Lt, N as Bt, O as $e, P as Vt, Q as Gt, R as Ut, S as jt, T as zt, U as Qt, V as Kt, W as Wt, X as Ht, Y as de, Z as Yt, _ as Xt, $ as fe, a0 as Jt, a1 as Zt, a2 as Me, a3 as yt, a4 as oe, a5 as ne, a6 as Ee, a7 as ea, a8 as Le, a9 as ta, aa, ab as sa, ac as ot, ad as ia, ae as na, af as _t, ag as ie, ah as rt, ai as oa, aj as ra, ak as Oe, al as da, am as dt, an as la, ao as lt, ap as ca, aq as ce, ar as ua, as as ct, b as ha, at as fa, au as pa, av as ma, aw as ga, ax as ut, ay as ba, az as Ia, aA as ya, aB as _a, aC as Ca, aD as Sa, aE as va, aF as wa, aG as xa, aH as Fe, aI as Ta } from "../chunks/global-date-filter-utils-BsFqnnbA.js";
7
- import { cy as Ui, aT as ji, c9 as zi, ca as Qi, cp as Ki, co as Wi, ci as Hi, cq as Yi, cr as Xi, bP as Ji, bQ as Zi, bR as en, bM as tn, bN as an, bO as sn, bI as nn, bJ as on, bL as rn, bK as dn, bS as ln, cL as cn, cb as un, b9 as hn, b8 as fn, c3 as pn, cA as mn, bj as gn, b3 as bn, cE as In, cm as yn, cn as _n, aQ as Cn, cD as Sn, bm as vn, cB as wn, bz as xn, ch as Tn, bT as Dn, bA as kn, cN as $n, aL as Fn, cF as An, cl as Rn, aM as En, c2 as On, c1 as Nn, bd as qn, a$ as Pn, b5 as Mn, cJ as Ln, bu as Bn, d as Vn, a as Gn, bn as Un, aN as jn, cx as zn, cP as Qn, b0 as Kn, b1 as Wn, b2 as Hn, bi as Yn, bk as Xn, c6 as Jn, g as Zn, bH as eo, br as to, bG as ao, bD as so, c7 as io, aV as no, aW as oo, cH as ro, bo as lo, ba as co, cj as uo, bf as ho, cv as fo, b4 as po, bZ as mo, cO as go, aR as bo, b$ as Io, c0 as yo, cK as _o, bx as Co, bq as So, bs as vo, be as wo, bt as xo, cs as To, cG as Do, aO as ko, cz as $o, bw as Fo, bb as Ao, bC as Ro, ct as Eo, c4 as Oo, c5 as No, aU as qo, cM as Po, c8 as Mo, cf as Lo, bF as Bo, aY as Vo, cu as Go, cI as Uo, aJ as jo, cw as zo, by as Qo, bc as Ko, bV as Wo, a_ as Ho, b6 as Yo, b7 as Xo, cc as Jo, cd as Zo, aZ as er, bX as tr, bY as ar, bW as sr, aX as ir, bE as nr, ce as or, bv as rr, ck as dr, aK as lr, bB as cr, b_ as ur, aS as hr, cC as fr, bl as pr, bp as mr, aP as gr, bU as br, bh as Ir, bg as yr, cg as _r } from "../chunks/global-date-filter-utils-BsFqnnbA.js";
8
- import { x as Da, ao as Be, ap as ka, a3 as Ct, ab as $a, a6 as Fa, ad as St, aD as Aa, aB as vt, aC as Ra } from "../chunks/validators-hmfNNQz8.js";
9
- import "../chunks/matrix-operation-contract-CpgLZ7E5.js";
10
- import "../chunks/analytics-base-schemas-BUFUoO6G.js";
1
+ var ia = Object.defineProperty;
2
+ var da = (e, t, a) => t in e ? ia(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
3
+ var Be = (e, t, a) => da(e, typeof t != "symbol" ? t + "" : t, a);
4
+ import { D as vt, r as Bt, b as ca, c as la, a as St, d as ua } from "../chunks/filter-reach-copy-BF4w4kI2.js";
5
+ import { N as er, R as tr, f as ar, j as or, l as nr, k as sr, u as rr, q as ir, e as dr, i as cr, x as lr, z as ur, K as fr, L as mr, s as hr, y as pr, H as gr, t as br, E as yr, m as Ir, n as _r, p as Cr, g as vr, o as Sr, h as $r, F as wr, B as Fr, A as xr, J as Tr, I as kr, v as Dr, w as Ar, G as Rr, C as Or } from "../chunks/filter-reach-copy-BF4w4kI2.js";
6
+ import { Q as fa, R as ma, S as Ve, T as ha, U as pa, V as ga, W as ba, X as ya, Y as Ia, Z as _a, _ as Ca, $ as va, a0 as he, a1 as Sa, a2 as $a, a3 as ve, a4 as wa, a5 as Fa, a6 as Ze, a7 as Vt, a8 as me, a9 as fe, aa as ze, ab as xa, ac as et, ad as Ta, ae as ka, af as Da, ag as $t, ah as Aa, ai as Ra, aj as jt, ak as ue, al as wt, am as Oa, an as Ea, ao as Qe, ap as Na, aq as Ft, ar as Pa, as as xt, at as qa, au as ye, av as Ma, aw as Tt, c as La, ax as Ba, ay as Va, az as ja, aA as Ka, aB as kt, aC as Ua, aD as Ga, aE as za, aF as Qa, aG as Ha, aH as Ya, aI as Wa, aJ as Ja, aK as Xa, aL as je, aM as Za, aN as eo, aO as to, aP as ao, aQ as oo, aR as no, aS as so, aT as ro, aU as io, aV as co } from "../chunks/global-date-filter-utils-D8365uPH.js";
7
+ import { cM as Nr, b4 as Pr, cn as qr, co as Mr, cD as Lr, cC as Br, cw as Vr, cE as jr, cF as Kr, c1 as Ur, c2 as Gr, c3 as zr, b_ as Qr, b$ as Hr, c0 as Yr, bW as Wr, bX as Jr, bZ as Xr, bY as Zr, c4 as ei, cZ as ti, cp as ai, bn as oi, bm as ni, ch as si, cO as ri, bx as ii, bh as di, cS as ci, cA as li, cB as ui, b1 as fi, cR as mi, bA as hi, d4 as pi, cP as gi, bN as bi, cv as yi, c5 as Ii, bO as _i, c$ as Ci, aY as vi, d2 as Si, cT as $i, cz as wi, aZ as Fi, d5 as xi, d3 as Ti, cg as ki, cf as Di, br as Ai, bd as Ri, bj as Oi, cX as Ei, bI as Ni, d as Pi, b as qi, bB as Mi, a_ as Li, cL as Bi, da as Vi, be as ji, bf as Ki, bg as Ui, bw as Gi, by as zi, ck as Qi, g as Hi, bV as Yi, bF as Wi, bU as Ji, bR as Xi, cl as Zi, b6 as ed, b7 as td, cV as ad, bC as od, bo as nd, cx as sd, bt as rd, cJ as id, bi as dd, cb as cd, d9 as ld, b2 as ud, cd as fd, ce as md, cY as hd, bL as pd, bE as gd, bG as bd, bs as yd, bH as Id, cG as _d, cU as Cd, a$ as vd, cN as Sd, bK as $d, bp as wd, bQ as Fd, cH as xd, ci as Td, cj as kd, b5 as Dd, c_ as Ad, d6 as Rd, cm as Od, ct as Ed, bT as Nd, b9 as Pd, cI as qd, cW as Md, aW as Ld, cK as Bd, bM as Vd, bq as jd, c7 as Kd, bc as Ud, bk as Gd, bl as zd, cq as Qd, cr as Hd, bb as Yd, c9 as Wd, ca as Jd, c8 as Xd, b8 as Zd, d8 as ec, bS as tc, cs as ac, bJ as oc, cy as nc, aX as sc, ba as rc, bP as ic, cc as dc, b3 as cc, cQ as lc, bz as uc, bD as fc, b0 as mc, c6 as hc, d7 as pc, d1 as gc, bv as bc, bu as yc, cu as Ic, d0 as _c } from "../chunks/global-date-filter-utils-D8365uPH.js";
8
+ import { H as lo, aC as tt, aD as uo, ab as Kt, aj as Ut, ae as fo, al as Gt, aR as mo, aP as zt, aQ as ho } from "../chunks/validators-CXTneCA4.js";
9
+ import "../chunks/matrix-operation-contract-WPv4R-H_.js";
10
+ import { x as at, k as po, u as go, q as bo, p as yo, m as Io, t as pe, e as _o } from "../chunks/analytics-base-schemas-CHLxsPfX.js";
11
11
  import "zod";
12
- import { a as Ea, r as Oa } from "../chunks/index-CJW5BdWT.js";
13
- import { n as Na } from "../chunks/operators-B3zZoskU.js";
14
- import { a as Sr, b as vr, r as wr } from "../chunks/raw-temporal-presentation-BI2z2LlB.js";
15
- import { w as re } from "../chunks/table-settings-DF1gdVQR.js";
16
- import { D as Tr, x as Dr, y as kr, G as $r, F as Fr, z as Ar, H as Rr, B as Er, A as Or, v as Nr } from "../chunks/table-settings-DF1gdVQR.js";
17
- import { v as ve, w as qa } from "../chunks/resolve-dashboard-input-context-BZYI1hB0.js";
18
- import { L as Pr, P as Mr, V as Lr, Q as Br, b as Vr, T as Gr, O as Ur, z as jr, W as zr, X as Qr, S as Kr, H as Wr, I as Hr, M as Yr, A as Xr, B as Jr, N as Zr, K as ed, x as td, y as ad, p as sd, U as id, J as nd, F as od, R as rd, C as dd, E as ld, D as cd, G as ud } from "../chunks/resolve-dashboard-input-context-BZYI1hB0.js";
19
- import { ag as fd, af as pd, ad as md, ae as gd, ah as bd, ai as Id } from "../chunks/temporal-input-presentation-DoSniQj1.js";
20
- import { e as Pa, w as Ma } from "../chunks/metric-comparison-C8LY7GG5.js";
21
- import { p as La } from "../chunks/report-runtime-context-CohdtiMg.js";
22
- import { i as _d, a as Cd, m as Sd, b as vd, r as wd } from "../chunks/matrix-card-fS_4O7zA.js";
23
- import { n as ht, t as Ba } from "../chunks/matrix-analytical-definition-4GTUDheD.js";
12
+ import { a as Co, r as vo } from "../chunks/index-CJW5BdWT.js";
13
+ import { n as So } from "../chunks/operators-B3zZoskU.js";
14
+ import { r as $o } from "../chunks/raw-temporal-presentation-BHm7s-hz.js";
15
+ import { d as vc, e as Sc, c as $c } from "../chunks/raw-temporal-presentation-BHm7s-hz.js";
16
+ import { w as ie } from "../chunks/table-settings-Imz0FgWi.js";
17
+ import { D as Fc, y as xc, z as Tc, G as kc, F as Dc, x as Ac, H as Rc, B as Oc, A as Ec, v as Nc } from "../chunks/table-settings-Imz0FgWi.js";
18
+ import { v as Oe, w as wo, x as Fo } from "../chunks/resolve-dashboard-input-context-CAMiWvyR.js";
19
+ import { L as qc, Q as Mc, W as Lc, R as Bc, b as Vc, U as jc, P as Kc, A as Uc, X as Gc, Y as zc, T as Qc, I as Hc, J as Yc, N as Wc, B as Jc, C as Xc, O as Zc, M as el, y as tl, z as al, p as ol, V as nl, K as sl, G as rl, S as il, D as dl, F as cl, E as ll, H as ul } from "../chunks/resolve-dashboard-input-context-CAMiWvyR.js";
20
+ import { aj as xo } from "../chunks/temporal-input-presentation-uvNK_tM0.js";
21
+ import { am as ml, al as hl, ah as pl, ak as gl, an as bl, af as yl } from "../chunks/temporal-input-presentation-uvNK_tM0.js";
22
+ import { e as To, w as ko, r as Do } from "../chunks/metric-comparison-ljMKYZKa.js";
23
+ import { p as Ao } from "../chunks/report-runtime-context-BZQh9ywy.js";
24
+ import { i as _l, a as Cl, m as vl, b as Sl, r as $l } from "../chunks/matrix-card-HPskLaPy.js";
25
+ import { n as Dt, t as Ro } from "../chunks/matrix-analytical-definition-CM18W8w6.js";
24
26
  import "../chunks/index-CuHybtft.js";
25
27
  import "../value-format-preferences/index.js";
26
28
  import "../chunks/_commonjsHelpers-DimLPMtv.js";
27
- function Y(e) {
29
+ function ee(e) {
28
30
  return e && typeof e == "object" ? e : null;
29
31
  }
30
- function Z(e) {
32
+ function ne(e) {
31
33
  return typeof e == "string" ? e : null;
32
34
  }
33
- function Va(e) {
34
- var t, a, s;
35
- return !!(e && typeof e == "object") && (((t = Y(e)) == null ? void 0 : t.kind) === "semantic" || ((a = Y(e)) == null ? void 0 : a.kind) === "physical" || ((s = Y(e)) == null ? void 0 : s.kind) === "sql");
35
+ function Oo(e) {
36
+ var t, a, o;
37
+ return !!(e && typeof e == "object") && (((t = ee(e)) == null ? void 0 : t.kind) === "semantic" || ((a = ee(e)) == null ? void 0 : a.kind) === "physical" || ((o = ee(e)) == null ? void 0 : o.kind) === "sql");
36
38
  }
37
- function me(e) {
38
- return Va(e) ? e.kind === "semantic" ? !!(e.domainId && e.datasetName) : e.kind === "physical" ? !!(e.connectionId && e.tableName) : !1 : !1;
39
+ function $e(e) {
40
+ return Oo(e) ? e.kind === "semantic" ? !!(e.domainId && e.datasetName) : e.kind === "physical" ? !!(e.connectionId && e.tableName) : !1 : !1;
39
41
  }
40
- function ni(e) {
41
- return Da(e);
42
+ function qs(e) {
43
+ return lo(e);
42
44
  }
43
- function wt(e, t) {
44
- return Be(e, t);
45
+ function Qt(e, t) {
46
+ return tt(e, t);
45
47
  }
46
- function Ga(e, t) {
47
- return ka(e, t);
48
+ function Eo(e, t) {
49
+ return uo(e, t);
48
50
  }
49
- function we(e) {
51
+ function Ee(e) {
50
52
  const t = [];
51
53
  for (const a of e) {
52
- const s = t.findIndex(
53
- (r) => wt(r, a)
54
+ const o = t.findIndex(
55
+ (n) => Qt(n, a)
54
56
  );
55
- s === -1 ? t.push(a) : t[s] = Ga(
56
- t[s],
57
+ o === -1 ? t.push(a) : t[o] = Eo(
58
+ t[o],
57
59
  a
58
60
  );
59
61
  }
60
62
  return t;
61
63
  }
62
- function oi(e) {
63
- return we(e)[0];
64
+ function Ms(e) {
65
+ return Ee(e)[0];
64
66
  }
65
- function Ne(e, t) {
66
- return e.kind !== "semantic" || e.connectionId || (t == null ? void 0 : t.kind) !== "semantic" || !Be(e, t) || !t.connectionId ? e : { ...e, connectionId: t.connectionId };
67
+ function He(e, t) {
68
+ return e.kind !== "semantic" || e.connectionId || (t == null ? void 0 : t.kind) !== "semantic" || !tt(e, t) || !t.connectionId ? e : { ...e, connectionId: t.connectionId };
67
69
  }
68
- function qe(e) {
69
- return me(e) ? e : void 0;
70
+ function Ye(e) {
71
+ return $e(e) ? e : void 0;
70
72
  }
71
- function ft(e, t) {
73
+ function At(e, t) {
72
74
  if (!(e.kind !== "semantic" || e.connectionId))
73
75
  return t.find(
74
- (a) => (a == null ? void 0 : a.kind) === "semantic" && Be(e, a) && !!a.connectionId
76
+ (a) => (a == null ? void 0 : a.kind) === "semantic" && tt(e, a) && !!a.connectionId
75
77
  );
76
78
  }
77
- function J(e, t) {
78
- const a = qe(e == null ? void 0 : e.source);
79
- return a ? Ne(a, t) : void 0;
79
+ function oe(e, t) {
80
+ const a = Ye(e == null ? void 0 : e.source);
81
+ return a ? He(a, t) : void 0;
80
82
  }
81
- function Ua({
83
+ function No({
82
84
  explicitSource: e,
83
85
  field: t,
84
86
  defaultSource: a,
85
- fallbackSources: s
87
+ fallbackSources: o
86
88
  }) {
87
- const r = [a, ...s || []], n = qe(e), i = n ? Ne(
88
- n,
89
- ft(n, r)
89
+ const n = [a, ...o || []], r = Ye(e), s = r ? He(
90
+ r,
91
+ At(r, n)
90
92
  ) : void 0;
91
- if (i)
92
- return i;
93
+ if (s)
94
+ return s;
93
95
  if (e !== void 0)
94
96
  return;
95
- const d = J(t, a), u = d ? Ne(
96
- d,
97
- ft(d, r)
97
+ const i = oe(t, a), d = i ? He(
98
+ i,
99
+ At(i, n)
98
100
  ) : void 0;
99
- if (u)
100
- return u;
101
+ if (d)
102
+ return d;
101
103
  if ((t == null ? void 0 : t.source) === void 0)
102
- return qe(a);
104
+ return Ye(a);
103
105
  }
104
- function ri(e, t) {
106
+ function Ls(e, t) {
105
107
  if (!(e != null && e.name) || !(t != null && t.name) || e.name !== t.name)
106
108
  return !1;
107
- const a = J(e), s = J(t);
108
- return !a || !s ? !0 : wt(a, s);
109
+ const a = oe(e), o = oe(t);
110
+ return !a || !o ? !0 : Qt(a, o);
109
111
  }
110
- function se(e) {
112
+ function ce(e) {
111
113
  var t;
112
- return Z((t = Y(e)) == null ? void 0 : t.kind);
114
+ return ne((t = ee(e)) == null ? void 0 : t.kind);
113
115
  }
114
- function xt(e) {
116
+ function Ht(e) {
115
117
  var t, a;
116
- return se(e) !== "semantic" ? null : ((a = Z((t = Y(e)) == null ? void 0 : t.domainId)) == null ? void 0 : a.trim()) || null;
118
+ return ce(e) !== "semantic" ? null : ((a = ne((t = ee(e)) == null ? void 0 : t.domainId)) == null ? void 0 : a.trim()) || null;
117
119
  }
118
- function ja(e) {
120
+ function Po(e) {
119
121
  var t;
120
- return se(e) !== "semantic" ? null : Z((t = Y(e)) == null ? void 0 : t.datasetName);
122
+ return ce(e) !== "semantic" ? null : ne((t = ee(e)) == null ? void 0 : t.datasetName);
121
123
  }
122
- function za(e) {
124
+ function qo(e) {
123
125
  var t;
124
- return se(e) !== "semantic" ? null : Z((t = Y(e)) == null ? void 0 : t.datasetId);
126
+ return ce(e) !== "semantic" ? null : ne((t = ee(e)) == null ? void 0 : t.datasetId);
125
127
  }
126
- function Qa(e) {
128
+ function Mo(e) {
127
129
  var t;
128
- return se(e) !== "physical" ? null : Z((t = Y(e)) == null ? void 0 : t.connectionId);
130
+ return ce(e) !== "physical" ? null : ne((t = ee(e)) == null ? void 0 : t.connectionId);
129
131
  }
130
- function Ka(e) {
132
+ function Lo(e) {
131
133
  var t;
132
- return se(e) !== "physical" ? null : Z((t = Y(e)) == null ? void 0 : t.tableName);
134
+ return ce(e) !== "physical" ? null : ne((t = ee(e)) == null ? void 0 : t.tableName);
133
135
  }
134
- function Wa(e) {
136
+ function Bo(e) {
135
137
  var t;
136
- return se(e) !== "physical" ? "" : Z((t = Y(e)) == null ? void 0 : t.databaseName) || "";
138
+ return ce(e) !== "physical" ? "" : ne((t = ee(e)) == null ? void 0 : t.databaseName) || "";
137
139
  }
138
- function Ha(e) {
140
+ function Vo(e) {
139
141
  var t;
140
- return se(e) !== "physical" ? "" : Z((t = Y(e)) == null ? void 0 : t.schemaName) || "";
142
+ return ce(e) !== "physical" ? "" : ne((t = ee(e)) == null ? void 0 : t.schemaName) || "";
141
143
  }
142
- function Ya(e) {
144
+ function jo(e) {
143
145
  if (e.analyticsIntent && typeof e.analyticsIntent == "object" && "source" in e.analyticsIntent)
144
146
  return e.analyticsIntent.source;
145
147
  }
146
- function Xa({
148
+ function Ko({
147
149
  datasets: e,
148
150
  requireAtLeastOne: t
149
151
  }) {
@@ -151,27 +153,27 @@ function Xa({
151
153
  return { ok: !1, issue: "invalid_dataset_count" };
152
154
  if (e.length <= 1)
153
155
  return { ok: !0 };
154
- const a = e.map(xt), s = new Set(a.filter(Boolean));
155
- return a.some((r) => !r) || s.size !== 1 ? { ok: !1, issue: "invalid_multi_dataset_scope" } : { ok: !0 };
156
+ const a = e.map(Ht), o = new Set(a.filter(Boolean));
157
+ return a.some((n) => !n) || o.size !== 1 ? { ok: !1, issue: "invalid_multi_dataset_scope" } : { ok: !0 };
156
158
  }
157
- function Ve(e, t) {
159
+ function ot(e, t) {
158
160
  if (!t)
159
161
  return !1;
160
162
  if (t.kind === "semantic") {
161
- const a = za(e);
162
- return xt(e) === t.domainId ? a && t.datasetId ? a === t.datasetId : ja(e) === t.datasetName : !1;
163
+ const a = qo(e);
164
+ return Ht(e) === t.domainId ? a && t.datasetId ? a === t.datasetId : Po(e) === t.datasetName : !1;
163
165
  }
164
- return t.kind === "physical" ? Qa(e) === t.connectionId && Ka(e) === t.tableName && Wa(e) === (t.databaseName || "") && Ha(e) === (t.schemaName || "") : !1;
166
+ return t.kind === "physical" ? Mo(e) === t.connectionId && Lo(e) === t.tableName && Bo(e) === (t.databaseName || "") && Vo(e) === (t.schemaName || "") : !1;
165
167
  }
166
- function di(e, t) {
168
+ function Bs(e, t) {
167
169
  return e.find(
168
- (a) => Ve(a, t)
170
+ (a) => ot(a, t)
169
171
  );
170
172
  }
171
173
  function M(e, t, a) {
172
174
  return a ? { code: e, message: t, cardId: a } : { code: e, message: t };
173
175
  }
174
- function ye(e) {
176
+ function Te(e) {
175
177
  const t = /* @__PURE__ */ new Set();
176
178
  for (const a of e) {
177
179
  if (t.has(a))
@@ -180,15 +182,15 @@ function ye(e) {
180
182
  }
181
183
  return null;
182
184
  }
183
- function Ja({
185
+ function Uo({
184
186
  card: e,
185
187
  datasets: t,
186
188
  errors: a
187
189
  }) {
188
190
  if (e.type === "text")
189
191
  return;
190
- const s = Ya(e);
191
- if (!s) {
192
+ const o = jo(e);
193
+ if (!o) {
192
194
  if (t.length <= 1)
193
195
  return;
194
196
  a.push(
@@ -200,7 +202,7 @@ function Ja({
200
202
  );
201
203
  return;
202
204
  }
203
- t.some((r) => Ve(r, s)) || a.push(
205
+ t.some((n) => ot(n, o)) || a.push(
204
206
  M(
205
207
  "invalid_card_analytics_source",
206
208
  "Dashboard cards with an explicit analytics source must use one of the selected datasets.",
@@ -208,57 +210,57 @@ function Ja({
208
210
  )
209
211
  );
210
212
  }
211
- function _e(e) {
213
+ function ke(e) {
212
214
  return e.map((t) => t == null ? void 0 : t.source).filter((t) => !!t);
213
215
  }
214
- function Ae(e) {
216
+ function Ke(e) {
215
217
  return Array.isArray(e) ? e.filter(
216
218
  (t) => !!(t && typeof t == "object")
217
219
  ) : [];
218
220
  }
219
- function pt(e) {
221
+ function Rt(e) {
220
222
  return Array.isArray(e) ? e.filter(
221
223
  (t) => !!(t && typeof t == "object")
222
224
  ) : [];
223
225
  }
224
- function Za(e) {
225
- var a, s;
226
+ function Go(e) {
227
+ var a, o;
226
228
  if (!e)
227
229
  return [];
228
230
  const t = [e.source];
229
231
  return e.kind === "metric" ? t.push(
230
- ..._e([
231
- ...Ae(e.measures),
232
+ ...ke([
233
+ ...Ke(e.measures),
232
234
  e.primaryMeasure,
233
235
  e.dateField,
234
- ...Ae(e.dimensions),
235
- ...pt(e.filters).map((r) => r.field)
236
+ ...Ke(e.dimensions),
237
+ ...Rt(e.filters).map((n) => n.field)
236
238
  ])
237
239
  ) : e.kind === "records" ? t.push(
238
- ..._e([
239
- ...Ae(e.fields),
240
+ ...ke([
241
+ ...Ke(e.fields),
240
242
  e.dateField,
241
243
  (a = e.orderBy) == null ? void 0 : a.field,
242
- ...pt(e.filters).map((r) => r.field)
244
+ ...Rt(e.filters).map((n) => n.field)
243
245
  ])
244
- ) : e.kind === "inputOptions" ? (((s = e.population) == null ? void 0 : s.kind) === "related_population" && t.push(e.population.baseSource), t.push(
245
- ..._e([
246
+ ) : e.kind === "inputOptions" ? (((o = e.population) == null ? void 0 : o.kind) === "related_population" && t.push(e.population.baseSource), t.push(
247
+ ...ke([
246
248
  e.labelField,
247
249
  e.valueField,
248
250
  e.searchField,
249
251
  ...e.disambiguationFields || []
250
252
  ])
251
- )) : e.kind === "sql" && t.push(..._e(e.fields || [])), t;
253
+ )) : e.kind === "sql" && t.push(...ke(e.fields || [])), t;
252
254
  }
253
- function es({
255
+ function zo({
254
256
  card: e,
255
257
  datasets: t,
256
258
  errors: a
257
259
  }) {
258
260
  if (e.type !== "text") {
259
- for (const s of Za(e.analyticsIntent))
260
- if (s && !t.some(
261
- (r) => Ve(r, s)
261
+ for (const o of Go(e.analyticsIntent))
262
+ if (o && !t.some(
263
+ (n) => ot(n, o)
262
264
  )) {
263
265
  a.push(
264
266
  M(
@@ -271,34 +273,34 @@ function es({
271
273
  }
272
274
  }
273
275
  }
274
- function ts({
276
+ function Qo({
275
277
  card: e,
276
278
  errors: t
277
279
  }) {
278
280
  if (e.type === "text" || !e.analyticsIntent)
279
281
  return;
280
- const a = Ct(e.analyticsIntent);
282
+ const a = Kt(e.analyticsIntent);
281
283
  if (!a.ok)
282
- for (const s of a.errors)
284
+ for (const o of a.errors)
283
285
  t.push(
284
286
  M(
285
- s.code,
286
- s.path ? `${s.path}: ${s.message}` : s.message,
287
+ o.code,
288
+ o.path ? `${o.path}: ${o.message}` : o.message,
287
289
  e.id
288
290
  )
289
291
  );
290
292
  }
291
- function as({
293
+ function Ho({
292
294
  datasets: e,
293
295
  errors: t,
294
296
  requireAtLeastOne: a
295
297
  }) {
296
- const s = Xa({
298
+ const o = Ko({
297
299
  datasets: e,
298
300
  requireAtLeastOne: a
299
301
  });
300
- if (!s.ok) {
301
- if (s.issue === "invalid_dataset_count") {
302
+ if (!o.ok) {
303
+ if (o.issue === "invalid_dataset_count") {
302
304
  t.push(
303
305
  M(
304
306
  "invalid_dataset_count",
@@ -315,7 +317,7 @@ function as({
315
317
  );
316
318
  }
317
319
  }
318
- function ss({
320
+ function Yo({
319
321
  input: e,
320
322
  errors: t
321
323
  }) {
@@ -327,7 +329,7 @@ function ss({
327
329
  )
328
330
  );
329
331
  }
330
- function is({
332
+ function Wo({
331
333
  card: e,
332
334
  errors: t
333
335
  }) {
@@ -337,13 +339,13 @@ function is({
337
339
  "Dashboard authoring accepts click-to-filter settings only through card.clickToFilter.",
338
340
  e.id
339
341
  )
340
- ), e.clickToFilter !== void 0 && !Lt.safeParse(e.clickToFilter).success && t.push(
342
+ ), e.clickToFilter !== void 0 && !fa.safeParse(e.clickToFilter).success && t.push(
341
343
  M(
342
344
  "invalid_click_to_filter",
343
345
  "Dashboard card clickToFilter settings do not match the canonical schema.",
344
346
  e.id
345
347
  )
346
- ), e.respondsToSelections !== void 0 && !Bt.safeParse(e.respondsToSelections).success && t.push(
348
+ ), e.respondsToSelections !== void 0 && !ma.safeParse(e.respondsToSelections).success && t.push(
347
349
  M(
348
350
  "invalid_responds_to_selections",
349
351
  "Dashboard card respondsToSelections must be a boolean.",
@@ -351,8 +353,8 @@ function is({
351
353
  )
352
354
  );
353
355
  }
354
- function ns(e) {
355
- var A, c;
356
+ function Jo(e) {
357
+ var S, u;
356
358
  const t = [];
357
359
  if (!e || typeof e != "object")
358
360
  return {
@@ -365,103 +367,103 @@ function ns(e) {
365
367
  ],
366
368
  warnings: []
367
369
  };
368
- const a = e, s = [...a.warnings || []];
369
- a.version !== 1 && t.push(M("invalid_version", "Dashboard plan version must be 1.")), (A = a.title) != null && A.trim() || t.push(M("missing_title", "Dashboard plan needs a title."));
370
- const r = Array.isArray(a.datasets) ? a.datasets : [], n = Array.isArray(a.sheets) ? a.sheets : [];
371
- as({ datasets: r, errors: t, requireAtLeastOne: !0 }), n.length !== 1 && t.push(
370
+ const a = e, o = [...a.warnings || []];
371
+ a.version !== 1 && t.push(M("invalid_version", "Dashboard plan version must be 1.")), (S = a.title) != null && S.trim() || t.push(M("missing_title", "Dashboard plan needs a title."));
372
+ const n = Array.isArray(a.datasets) ? a.datasets : [], r = Array.isArray(a.sheets) ? a.sheets : [];
373
+ Ho({ datasets: n, errors: t, requireAtLeastOne: !0 }), r.length !== 1 && t.push(
372
374
  M(
373
375
  "invalid_sheet_count",
374
376
  "MVP dashboard authoring creates exactly one dashboard sheet."
375
377
  )
376
378
  );
377
- const i = n[0];
378
- i && i.kind !== "dashboard" && t.push(
379
+ const s = r[0];
380
+ s && s.kind !== "dashboard" && t.push(
379
381
  M("invalid_sheet_kind", 'Generated sheet must use kind "dashboard".')
380
382
  );
381
- const d = (i == null ? void 0 : i.cards) || [];
382
- d.length > it && t.push(
383
+ const i = (s == null ? void 0 : s.cards) || [];
384
+ i.length > vt && t.push(
383
385
  M(
384
386
  "too_many_cards",
385
- `Generated dashboards can contain at most ${it} cards.`
387
+ `Generated dashboards can contain at most ${vt} cards.`
386
388
  )
387
389
  );
388
- const u = ye(d.map((m) => m.id));
389
- u && t.push(
390
- M("duplicate_card_id", `Duplicate generated card id: ${u}.`)
390
+ const d = Te(i.map((g) => g.id));
391
+ d && t.push(
392
+ M("duplicate_card_id", `Duplicate generated card id: ${d}.`)
391
393
  );
392
- const b = ye(d.map((m) => m.frameId));
393
- b && t.push(
394
+ const c = Te(i.map((g) => g.frameId));
395
+ c && t.push(
394
396
  M(
395
397
  "duplicate_frame_id",
396
- `Duplicate generated frame id: ${b}.`
398
+ `Duplicate generated frame id: ${c}.`
397
399
  )
398
400
  );
399
- for (const m of d)
400
- (c = m.title) != null && c.trim() || t.push(M("missing_card_title", "Card title is required.", m.id)), m.type === "custom" && t.push(
401
+ for (const g of i)
402
+ (u = g.title) != null && u.trim() || t.push(M("missing_card_title", "Card title is required.", g.id)), g.type === "custom" && t.push(
401
403
  M(
402
404
  "custom_visual_out_of_scope",
403
405
  "Whole-dashboard authoring supports built-in visual types only.",
404
- m.id
406
+ g.id
405
407
  )
406
- ), m.type !== "text" && !m.analyticsIntent && s.push(
408
+ ), g.type !== "text" && !g.analyticsIntent && o.push(
407
409
  M(
408
410
  "missing_analytics_intent",
409
411
  "Non-text card has no analytics intent and may be skipped by the app layer.",
410
- m.id
412
+ g.id
411
413
  )
412
- ), Ja({ card: m, datasets: r, errors: t }), ts({ card: m, errors: t }), es({ card: m, datasets: r, errors: t }), is({ card: m, errors: t });
413
- const y = Array.isArray(a.filterInputs) ? a.filterInputs : [], C = y.map((m) => m.id), p = ye(C);
414
- p && t.push(
414
+ ), Uo({ card: g, datasets: n, errors: t }), Qo({ card: g, errors: t }), zo({ card: g, datasets: n, errors: t }), Wo({ card: g, errors: t });
415
+ const p = Array.isArray(a.filterInputs) ? a.filterInputs : [], _ = p.map((g) => g.id), b = Te(_);
416
+ b && t.push(
415
417
  M(
416
418
  "duplicate_input_id",
417
- `Duplicate dashboard input id: ${p}.`
419
+ `Duplicate dashboard input id: ${b}.`
418
420
  )
419
421
  );
420
- const $ = y.map((m) => m.variableName).filter(Boolean) || [], _ = ye($);
421
- _ && t.push(
422
+ const v = p.map((g) => g.variableName).filter(Boolean) || [], m = Te(v);
423
+ m && t.push(
422
424
  M(
423
425
  "duplicate_input_variable",
424
- `Duplicate dashboard input variable name: ${_}.`
426
+ `Duplicate dashboard input variable name: ${m}.`
425
427
  )
426
428
  );
427
- for (const m of y)
428
- ss({ input: m, errors: t });
429
- const g = Array.isArray(a.calculatedFields) ? a.calculatedFields : [];
430
- for (const m of g)
431
- m.scope === "domain" && m.reuseOnly !== !0 && t.push(
429
+ for (const g of p)
430
+ Yo({ input: g, errors: t });
431
+ const f = Array.isArray(a.calculatedFields) ? a.calculatedFields : [];
432
+ for (const g of f)
433
+ g.scope === "domain" && g.reuseOnly !== !0 && t.push(
432
434
  M(
433
435
  "domain_calculated_field_create_out_of_scope",
434
- `Creating domain calculated field "${m.name}" is outside MVP.`
436
+ `Creating domain calculated field "${g.name}" is outside MVP.`
435
437
  )
436
438
  );
437
- return { ok: t.length === 0, errors: t, warnings: s };
439
+ return { ok: t.length === 0, errors: t, warnings: o };
438
440
  }
439
- function os(e) {
440
- const t = $a(e);
441
+ function Xo(e) {
442
+ const t = Ut(e);
441
443
  return t === "datetime" ? "date" : t === "unknown" ? "string" : t;
442
444
  }
443
- function rs(e) {
445
+ function Zo(e) {
444
446
  return !!(e && typeof e == "object" && !Array.isArray(e));
445
447
  }
446
- function ds(e) {
447
- return rs(e) && typeof e.filterId == "string" && typeof e.operation == "string" && Array.isArray(e.values);
448
+ function en(e) {
449
+ return Zo(e) && typeof e.filterId == "string" && typeof e.operation == "string" && Array.isArray(e.values);
448
450
  }
449
- function ls(e) {
451
+ function tn(e) {
450
452
  return e.filter(
451
453
  (t) => typeof t == "string" || typeof t == "number"
452
454
  );
453
455
  }
454
- function cs(e) {
456
+ function an(e) {
455
457
  return e.filter(
456
458
  (t) => t instanceof Date || typeof t == "string"
457
459
  );
458
460
  }
459
- function Tt(e, t) {
461
+ function Yt(e, t) {
460
462
  if (t === void 0)
461
463
  return;
462
- const a = os(e.dataType), s = e.operation || "in";
463
- if (ds(t))
464
- return $e({
464
+ const a = Xo(e.dataType), o = e.operation || "in";
465
+ if (en(t))
466
+ return Ve({
465
467
  definition: e,
466
468
  sourceValue: t,
467
469
  value: {
@@ -474,13 +476,13 @@ function Tt(e, t) {
474
476
  semanticContext: e.semanticContext
475
477
  }
476
478
  });
477
- if (s === "is null" || s === "is not null")
478
- return $e({
479
+ if (o === "is null" || o === "is not null")
480
+ return Ve({
479
481
  definition: e,
480
482
  value: {
481
483
  filterId: e.id,
482
484
  name: e.column,
483
- operation: s,
485
+ operation: o,
484
486
  valueType: a,
485
487
  values: [],
486
488
  dataType: e.dataType,
@@ -488,42 +490,42 @@ function Tt(e, t) {
488
490
  semanticContext: e.semanticContext
489
491
  }
490
492
  });
491
- const r = Array.isArray(t) ? t : [t], n = a === "date" ? cs(r) : ls(r);
492
- if (n.length !== 0 && !((s === "between" || s === "not between") && n.length < 2))
493
- return $e({
493
+ const n = Array.isArray(t) ? t : [t], r = a === "date" ? an(n) : tn(n);
494
+ if (r.length !== 0 && !((o === "between" || o === "not between") && r.length < 2))
495
+ return Ve({
494
496
  definition: e,
495
497
  value: {
496
498
  filterId: e.id,
497
499
  name: e.column,
498
- operation: s,
500
+ operation: o,
499
501
  valueType: a,
500
- values: n,
502
+ values: r,
501
503
  dataType: e.dataType,
502
504
  fieldMeta: e.fieldMeta,
503
505
  semanticContext: e.semanticContext
504
506
  }
505
507
  });
506
508
  }
507
- function Dt(e, t, a) {
509
+ function Wt(e, t, a) {
508
510
  return a ? { code: e, message: t, cardId: a } : { code: e, message: t };
509
511
  }
510
- function us(e, t, a) {
511
- const s = (t || []).filter(
512
- (r) => r.scope === "card" && r.targetCardId === a
513
- ).map((r) => r.field).filter(Boolean);
514
- return s.length === 0 ? e : {
512
+ function on(e, t, a) {
513
+ const o = (t || []).filter(
514
+ (n) => n.scope === "card" && n.targetCardId === a
515
+ ).map((n) => n.field).filter(Boolean);
516
+ return o.length === 0 ? e : {
515
517
  ...e,
516
518
  calculatedFields: [
517
519
  ...e.calculatedFields || [],
518
- ...s
520
+ ...o
519
521
  ]
520
522
  };
521
523
  }
522
- function hs(e, t, a) {
524
+ function nn(e, t, a) {
523
525
  return t.clickToFilter === void 0 && t.respondsToSelections === void 0 ? e : {
524
526
  ...e,
525
527
  ...t.clickToFilter ? {
526
- clickToFilter: Vt(
528
+ clickToFilter: ha(
527
529
  t.clickToFilter,
528
530
  { cardIds: Object.fromEntries(a) }
529
531
  )
@@ -531,111 +533,111 @@ function hs(e, t, a) {
531
533
  ...t.respondsToSelections !== void 0 ? { respondsToSelections: t.respondsToSelections } : {}
532
534
  };
533
535
  }
534
- function fs(e, t) {
536
+ function sn(e, t) {
535
537
  if (!e) return e;
536
- const a = Ut(e, {
538
+ const a = ga(e, {
537
539
  renamedCardIds: t,
538
540
  keepOnlyRenamedCardIds: !0
539
541
  });
540
- return jt(a) ? null : a;
542
+ return ba(a) ? null : a;
541
543
  }
542
- function ps(e, t) {
543
- const a = {}, s = [];
544
+ function rn(e, t) {
545
+ const a = {}, o = [];
544
546
  return {
545
547
  inputs: (e.filterInputs || []).flatMap(
546
- (n, i) => {
547
- const d = fs(n.scope, t);
548
- if (d === null)
549
- return s.push(
550
- Dt(
548
+ (r, s) => {
549
+ const i = sn(r.scope, t);
550
+ if (i === null)
551
+ return o.push(
552
+ Wt(
551
553
  "filter_input_scope_empty",
552
- `Filter input "${n.label}" was skipped because all scoped cards or tabs were skipped during query validation.`
554
+ `Filter input "${r.label}" was skipped because all scoped cards or tabs were skipped during query validation.`
553
555
  )
554
556
  ), [];
555
- const u = Tt(
556
- n.filter,
557
- n.defaultValue
557
+ const d = Yt(
558
+ r.filter,
559
+ r.defaultValue
558
560
  );
559
- return u && (a.shared ?? (a.shared = {}), a.shared[n.id] = {
561
+ return d && (a.shared ?? (a.shared = {}), a.shared[r.id] = {
560
562
  status: "set",
561
563
  value: {
562
564
  kind: "filter",
563
- filterValue: u
565
+ filterValue: d
564
566
  }
565
567
  }), [
566
568
  {
567
- id: n.id,
569
+ id: r.id,
568
570
  kind: "filter",
569
- label: n.label,
570
- variableName: n.variableName,
571
- scope: d || { kind: "allSheets", sheetKinds: ["dashboard"] },
571
+ label: r.label,
572
+ variableName: r.variableName,
573
+ scope: i || { kind: "allSheets", sheetKinds: ["dashboard"] },
572
574
  runtimeScope: "shared",
573
575
  presentation: {
574
576
  placement: "toolbar",
575
- order: i
577
+ order: s
576
578
  },
577
579
  exports: ["label", "value", "start", "end", "range"],
578
580
  // Reach is the scope (S-1): a filter definition stores none.
579
- filter: Gt(n.filter)
581
+ filter: pa(r.filter)
580
582
  }
581
583
  ];
582
584
  }
583
585
  ),
584
- warnings: s,
586
+ warnings: o,
585
587
  defaultInputValues: a.shared && Object.keys(a.shared).length > 0 ? a : void 0
586
588
  };
587
589
  }
588
- function li(e) {
589
- var g, A;
590
- const t = ns(e.plan);
590
+ function Vs(e) {
591
+ var f, S;
592
+ const t = Jo(e.plan);
591
593
  if (!t.ok)
592
594
  throw new Error(
593
- t.errors.map((c) => c.message).join(`
595
+ t.errors.map((u) => u.message).join(`
594
596
  `) || "Dashboard plan is invalid."
595
597
  );
596
- const a = e.plan.sheets[0], s = [...t.warnings], r = [], n = new Map(
597
- e.cardArtifacts.map((c) => [c.planCardId, c])
598
- ), i = new Map(
599
- e.cardArtifacts.map((c) => [
600
- c.planCardId,
601
- c.card.id
598
+ const a = e.plan.sheets[0], o = [...t.warnings], n = [], r = new Map(
599
+ e.cardArtifacts.map((u) => [u.planCardId, u])
600
+ ), s = new Map(
601
+ e.cardArtifacts.map((u) => [
602
+ u.planCardId,
603
+ u.card.id
602
604
  ])
603
- ), d = [];
604
- for (const c of a.cards) {
605
- const m = n.get(c.id);
606
- if (!m) {
607
- const k = Dt(
605
+ ), i = [];
606
+ for (const u of a.cards) {
607
+ const g = r.get(u.id);
608
+ if (!g) {
609
+ const $ = Wt(
608
610
  "missing_card_artifact",
609
- `Card "${c.title}" was skipped because no generated artifact was supplied.`,
610
- c.id
611
+ `Card "${u.title}" was skipped because no generated artifact was supplied.`,
612
+ u.id
611
613
  );
612
- r.push(k);
614
+ n.push($);
613
615
  continue;
614
616
  }
615
- s.push(...m.warnings || []);
616
- const F = hs(
617
- us(
618
- m.card,
617
+ o.push(...g.warnings || []);
618
+ const F = nn(
619
+ on(
620
+ g.card,
619
621
  e.plan.calculatedFields,
620
- c.id
622
+ u.id
621
623
  ),
622
- c,
623
- i
624
+ u,
625
+ s
624
626
  );
625
- d.push({
626
- id: c.frameId,
627
+ i.push({
628
+ id: u.frameId,
627
629
  cards: [F],
628
630
  activeCardId: F.id
629
631
  });
630
632
  }
631
- if (d.length === 0)
633
+ if (i.length === 0)
632
634
  throw new Error("Dashboard plan did not produce any persistable cards.");
633
- const { inputs: u, defaultInputValues: b, warnings: y } = ps(e.plan, i);
634
- s.push(...y);
635
- const C = new Map(a.cards.map((c) => [c.frameId, c.priority])), p = d.map((c, m) => ({ frame: c, index: m })).sort(
636
- (c, m) => (C.get(c.frame.id) ?? 0) - (C.get(m.frame.id) ?? 0) || c.index - m.index
637
- ).map(({ frame: c }) => c), $ = Ea({ id: a.id, frames: p, layouts: void 0 }, { kind: "arrange" });
638
- if (!$.ok) throw new Error($.failure.message);
635
+ const { inputs: d, defaultInputValues: c, warnings: p } = rn(e.plan, s);
636
+ o.push(...p);
637
+ const _ = new Map(a.cards.map((u) => [u.frameId, u.priority])), b = i.map((u, g) => ({ frame: u, index: g })).sort(
638
+ (u, g) => (_.get(u.frame.id) ?? 0) - (_.get(g.frame.id) ?? 0) || u.index - g.index
639
+ ).map(({ frame: u }) => u), v = Co({ id: a.id, frames: b, layouts: void 0 }, { kind: "arrange" });
640
+ if (!v.ok) throw new Error(v.failure.message);
639
641
  return { dashboard: {
640
642
  id: e.dashboardId,
641
643
  title: e.plan.title,
@@ -649,151 +651,151 @@ function li(e) {
649
651
  kind: "dashboard",
650
652
  title: a.title,
651
653
  description: a.description,
652
- frames: $.frames,
653
- layouts: $.layouts,
654
- customizedBreakpoints: $.customizedBreakpoints,
655
- calculatedFields: (g = e.plan.calculatedFields) == null ? void 0 : g.filter((c) => c.scope === "sheet" && c.field).map((c) => c.field)
654
+ frames: v.frames,
655
+ layouts: v.layouts,
656
+ customizedBreakpoints: v.customizedBreakpoints,
657
+ calculatedFields: (f = e.plan.calculatedFields) == null ? void 0 : f.filter((u) => u.scope === "sheet" && u.field).map((u) => u.field)
656
658
  }
657
659
  ],
658
- calculatedFields: (A = e.plan.calculatedFields) == null ? void 0 : A.filter((c) => c.scope === "dashboard" && c.field).map((c) => c.field),
659
- inputs: u,
660
- ...b ? { defaultInputValues: b } : {}
661
- }, warnings: s, skippedOperations: r };
660
+ calculatedFields: (S = e.plan.calculatedFields) == null ? void 0 : S.filter((u) => u.scope === "dashboard" && u.field).map((u) => u.field),
661
+ inputs: d,
662
+ ...c ? { defaultInputValues: c } : {}
663
+ }, warnings: o, skippedOperations: n };
662
664
  }
663
- function W(e, t, a) {
665
+ function X(e, t, a) {
664
666
  return a ? { code: e, message: t, cardId: a } : { code: e, message: t };
665
667
  }
666
- function he(e, t) {
668
+ function _e(e, t) {
667
669
  return e.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || t;
668
670
  }
669
- function kt(e, t) {
671
+ function Jt(e, t) {
670
672
  if (!t.has(e))
671
673
  return t.add(e), e;
672
- let a = 2, s = `${e}-${a}`;
673
- for (; t.has(s); )
674
- a += 1, s = `${e}-${a}`;
675
- return t.add(s), s;
674
+ let a = 2, o = `${e}-${a}`;
675
+ for (; t.has(o); )
676
+ a += 1, o = `${e}-${a}`;
677
+ return t.add(o), o;
676
678
  }
677
- function ge(e) {
679
+ function we(e) {
678
680
  return !!(e && typeof e == "object");
679
681
  }
680
- function $t(e) {
682
+ function Xt(e) {
681
683
  return Array.isArray(e.inputs) ? e.inputs.filter(
682
- (t) => ge(t) && typeof t.id == "string"
684
+ (t) => we(t) && typeof t.id == "string"
683
685
  ) : [];
684
686
  }
685
- function Ge(e) {
687
+ function nt(e) {
686
688
  return Array.isArray(e.sections) ? e.sections.filter(
687
- (t) => ge(t)
689
+ (t) => we(t)
688
690
  ) : [];
689
691
  }
690
- function Ue(e) {
692
+ function st(e) {
691
693
  return Array.isArray(e.views) ? e.views.filter(
692
- (t) => ge(t)
694
+ (t) => we(t)
693
695
  ) : [];
694
696
  }
695
- function te(e) {
697
+ function re(e) {
696
698
  if (!Array.isArray(e))
697
699
  return [];
698
700
  const t = [];
699
701
  for (const a of e) {
700
- const s = J(a);
701
- s && t.push(s);
702
+ const o = oe(a);
703
+ o && t.push(o);
702
704
  }
703
705
  return t;
704
706
  }
705
- function ms(e) {
706
- var s, r, n;
707
+ function dn(e) {
708
+ var o, n, r;
707
709
  if (!e)
708
710
  return [];
709
711
  const t = [];
710
- if (me(e.source) && t.push(e.source), e.kind === "metric") {
711
- t.push(...te(e.measures));
712
- const i = J(e.dateField);
713
- i && t.push(i), t.push(...te(e.dimensions)), t.push(
714
- ...te(
715
- (s = e.filters) == null ? void 0 : s.map((d) => d.field)
712
+ if ($e(e.source) && t.push(e.source), e.kind === "metric") {
713
+ t.push(...re(e.measures));
714
+ const s = oe(e.dateField);
715
+ s && t.push(s), t.push(...re(e.dimensions)), t.push(
716
+ ...re(
717
+ (o = e.filters) == null ? void 0 : o.map((i) => i.field)
716
718
  )
717
719
  );
718
720
  } else if (e.kind === "records") {
719
- const i = J(e.dateField);
720
- i && t.push(i), t.push(...te(e.fields)), t.push(
721
- ...te(
722
- (r = e.filters) == null ? void 0 : r.map((d) => d.field)
721
+ const s = oe(e.dateField);
722
+ s && t.push(s), t.push(...re(e.fields)), t.push(
723
+ ...re(
724
+ (n = e.filters) == null ? void 0 : n.map((i) => i.field)
723
725
  )
724
726
  );
725
- } else e.kind === "inputOptions" ? (((n = e.population) == null ? void 0 : n.kind) === "related_population" && me(e.population.baseSource) && t.push(e.population.baseSource), t.push(
726
- ...te([
727
+ } else e.kind === "inputOptions" ? (((r = e.population) == null ? void 0 : r.kind) === "related_population" && $e(e.population.baseSource) && t.push(e.population.baseSource), t.push(
728
+ ...re([
727
729
  e.labelField,
728
730
  e.valueField,
729
731
  e.searchField,
730
732
  ...e.disambiguationFields || []
731
- ].filter((i) => !!i))
732
- )) : e.kind === "sql" && t.push(...te(e.fields));
733
+ ].filter((s) => !!s))
734
+ )) : e.kind === "sql" && t.push(...re(e.fields));
733
735
  const a = "inputs" in e && Array.isArray(e.inputs) ? e.inputs : [];
734
- for (const i of a) {
735
- const d = J(i.field);
736
- d && t.push(d);
736
+ for (const s of a) {
737
+ const i = oe(s.field);
738
+ i && t.push(i);
737
739
  }
738
740
  return t;
739
741
  }
740
- function gs(e) {
742
+ function cn(e) {
741
743
  const t = [];
742
- for (const a of $t(e)) {
743
- const s = J(a.field);
744
- s && t.push(s);
744
+ for (const a of Xt(e)) {
745
+ const o = oe(a.field);
746
+ o && t.push(o);
745
747
  }
746
- for (const a of Ge(e))
747
- for (const s of Ue(a))
748
- t.push(...ms(s.analytics));
748
+ for (const a of nt(e))
749
+ for (const o of st(a))
750
+ t.push(...dn(o.analytics));
749
751
  return t;
750
752
  }
751
- function bs(e) {
753
+ function ln(e) {
752
754
  var a;
753
755
  const t = [];
754
- for (const s of Ge(e))
755
- for (const r of Ue(s))
756
- me((a = r.analytics) == null ? void 0 : a.source) && t.push(r.analytics.source);
756
+ for (const o of nt(e))
757
+ for (const n of st(o))
758
+ $e((a = n.analytics) == null ? void 0 : a.source) && t.push(n.analytics.source);
757
759
  return t;
758
760
  }
759
- function Is(e, t) {
760
- const a = we(e).filter(me);
761
+ function un(e, t) {
762
+ const a = Ee(e).filter($e);
761
763
  if (a.length === 0)
762
764
  return t.push(
763
- W(
765
+ X(
764
766
  "missing_materializable_dataset",
765
767
  "No semantic or physical source could be converted into the current dashboard authoring dataset reference."
766
768
  )
767
769
  ), [];
768
- const s = a.every((n) => n.kind === "semantic"), r = Array.from(
770
+ const o = a.every((r) => r.kind === "semantic"), n = Array.from(
769
771
  new Set(
770
- a.filter((n) => n.kind === "semantic").map((n) => n.domainId)
772
+ a.filter((r) => r.kind === "semantic").map((r) => r.domainId)
771
773
  )
772
774
  );
773
- return a.length > 1 && (!s || r.length !== 1) ? (t.push(
774
- W(
775
+ return a.length > 1 && (!o || n.length !== 1) ? (t.push(
776
+ X(
775
777
  "multiple_datasets_out_of_scope",
776
778
  "The dashboard authoring compiler supports multiple datasets only within one semantic domain; using the first source and deferring the rest."
777
779
  )
778
780
  ), [a[0]]) : a;
779
781
  }
780
- function ys(e, t) {
781
- const a = Ge(e), s = $t(e), r = we(gs(e)), n = we(
782
- bs(e)
782
+ function fn(e, t) {
783
+ const a = nt(e), o = Xt(e), n = Ee(cn(e)), r = Ee(
784
+ ln(e)
783
785
  );
784
786
  return {
785
787
  sections: a,
786
- inputs: s,
787
- sources: r,
788
- primarySources: n,
789
- defaultSource: n.length === 1 ? n[0] : void 0,
790
- datasets: Is(r, t)
788
+ inputs: o,
789
+ sources: n,
790
+ primarySources: r,
791
+ defaultSource: r.length === 1 ? r[0] : void 0,
792
+ datasets: un(n, t)
791
793
  };
792
794
  }
793
- function _s(e) {
794
- return e && Ct(e).ok ? e : void 0;
795
+ function mn(e) {
796
+ return e && Kt(e).ok ? e : void 0;
795
797
  }
796
- function Cs(e) {
798
+ function hn(e) {
797
799
  var t;
798
800
  switch ((t = e.presentation) == null ? void 0 : t.kind) {
799
801
  case "kpi":
@@ -812,12 +814,12 @@ function Cs(e) {
812
814
  return null;
813
815
  }
814
816
  }
815
- function Ss(e) {
816
- var t, a, s;
817
- return ((t = e.presentation) == null ? void 0 : t.kind) === "kpi" ? "kpi" : ((a = e.presentation) == null ? void 0 : a.kind) === "table" ? "table" : ((s = e.presentation) == null ? void 0 : s.kind) === "text" ? "text" : "chart";
817
+ function pn(e) {
818
+ var t, a, o;
819
+ return ((t = e.presentation) == null ? void 0 : t.kind) === "kpi" ? "kpi" : ((a = e.presentation) == null ? void 0 : a.kind) === "table" ? "table" : ((o = e.presentation) == null ? void 0 : o.kind) === "text" ? "text" : "chart";
818
820
  }
819
- function vs(e) {
820
- const t = Na(e);
821
+ function gn(e) {
822
+ const t = So(e);
821
823
  switch (t) {
822
824
  case "not_in":
823
825
  return "not in";
@@ -831,77 +833,77 @@ function vs(e) {
831
833
  return t || "in";
832
834
  }
833
835
  }
834
- function ws(e) {
835
- return ge(e.field) ? e.field.dataType === "datetime" ? "date" : e.field.dataType || "string" : "string";
836
+ function bn(e) {
837
+ return we(e.field) ? e.field.dataType === "datetime" ? "date" : e.field.dataType || "string" : "string";
836
838
  }
837
- function xs(e) {
839
+ function yn(e) {
838
840
  if (!(!e || e.kind !== "physical"))
839
841
  return [e.databaseName, e.schemaName, e.tableName].filter(Boolean).join(".");
840
842
  }
841
- function Ts(e, t, a, s, r, n) {
843
+ function In(e, t, a, o, n, r) {
842
844
  if (e.kind !== "filter")
843
- return n.push(
844
- W(
845
+ return r.push(
846
+ X(
845
847
  "control_inputs_deferred",
846
848
  `Control input "${e.label}" is represented in the protocol but not yet materialized by the dashboard authoring adapter.`
847
849
  )
848
850
  ), null;
849
- if (!ge(e.field) || typeof e.field.name != "string")
850
- return n.push(
851
- W(
851
+ if (!we(e.field) || typeof e.field.name != "string")
852
+ return r.push(
853
+ X(
852
854
  "filter_requires_field",
853
855
  `Filter "${e.label || e.id}" needs a field before the dashboard compiler can materialize it.`
854
856
  )
855
857
  ), null;
856
- const i = Ua({
858
+ const s = No({
857
859
  explicitSource: void 0,
858
860
  field: e.field,
859
861
  defaultSource: t,
860
862
  fallbackSources: a
861
- }), d = (i == null ? void 0 : i.kind) === "semantic" || (i == null ? void 0 : i.kind) === "physical" ? i.connectionId : void 0;
862
- if (!d)
863
- return n.push(
864
- W(
863
+ }), i = (s == null ? void 0 : s.kind) === "semantic" || (s == null ? void 0 : s.kind) === "physical" ? s.connectionId : void 0;
864
+ if (!i)
865
+ return r.push(
866
+ X(
865
867
  "filter_requires_connection_id",
866
868
  `Filter "${e.label}" needs a source connectionId before the dashboard compiler can materialize it.`
867
869
  )
868
870
  ), null;
869
- const y = {
870
- id: `filter-${kt(
871
- he(e.id, e.field.name),
872
- r
871
+ const p = {
872
+ id: `filter-${Jt(
873
+ _e(e.id, e.field.name),
874
+ n
873
875
  )}`,
874
876
  variableName: e.id,
875
- connectionId: d,
877
+ connectionId: i,
876
878
  title: e.label,
877
879
  column: e.field.name,
878
- dataType: ws(e),
879
- qualifiedTableName: xs(i),
880
+ dataType: bn(e),
881
+ qualifiedTableName: yn(s),
880
882
  sql: "",
881
- operation: vs(e.operator),
883
+ operation: gn(e.operator),
882
884
  type: e.multi === !1 ? "single" : "multiple",
883
885
  location: "dashboard",
884
- fieldMeta: (i == null ? void 0 : i.kind) === "semantic" ? {
886
+ fieldMeta: (s == null ? void 0 : s.kind) === "semantic" ? {
885
887
  name: e.field.name,
886
888
  qualifiedFieldName: e.field.name,
887
889
  dataType: e.field.dataType,
888
890
  role: e.field.role === "measure" ? "metric" : "groupby"
889
891
  } : void 0,
890
- semanticContext: (i == null ? void 0 : i.kind) === "semantic" ? {
891
- semanticDomainId: i.domainId,
892
- connectionId: i.connectionId
893
- } : (i == null ? void 0 : i.kind) === "physical" ? {
894
- connectionId: i.connectionId,
895
- connectionType: i.connectionType,
892
+ semanticContext: (s == null ? void 0 : s.kind) === "semantic" ? {
893
+ semanticDomainId: s.domainId,
894
+ connectionId: s.connectionId
895
+ } : (s == null ? void 0 : s.kind) === "physical" ? {
896
+ connectionId: s.connectionId,
897
+ connectionType: s.connectionType,
896
898
  selectedEntities: [
897
899
  {
898
900
  type: "table",
899
- connectionId: i.connectionId,
900
- connectionType: i.connectionType,
901
- dialect: i.dialect,
902
- database: i.databaseName,
903
- schema: i.schemaName,
904
- name: i.tableName
901
+ connectionId: s.connectionId,
902
+ connectionType: s.connectionType,
903
+ dialect: s.dialect,
904
+ database: s.databaseName,
905
+ schema: s.schemaName,
906
+ name: s.tableName
905
907
  }
906
908
  ]
907
909
  } : void 0
@@ -910,38 +912,38 @@ function Ts(e, t, a, s, r, n) {
910
912
  id: e.id,
911
913
  label: e.label,
912
914
  variableName: e.id,
913
- scope: s,
914
- filter: y,
915
- defaultValue: Tt(
916
- y,
915
+ scope: o,
916
+ filter: p,
917
+ defaultValue: Yt(
918
+ p,
917
919
  e.defaultValue
918
920
  )
919
921
  };
920
922
  }
921
- function Re(e) {
923
+ function Ue(e) {
922
924
  const t = [], a = [];
923
- for (const s of e.viewIds) {
924
- const r = e.viewIdToCardId.get(s);
925
- r ? t.push(r) : a.push(s);
925
+ for (const o of e.viewIds) {
926
+ const n = e.viewIdToCardId.get(o);
927
+ n ? t.push(n) : a.push(o);
926
928
  }
927
929
  return a.length > 0 && e.warnings.push(
928
- W(
930
+ X(
929
931
  "input_scope_view_not_found",
930
932
  `Filter "${e.inputLabel}" referenced unknown view ids: ${a.join(", ")}.`
931
933
  )
932
934
  ), Array.from(new Set(t));
933
935
  }
934
- function Ds(e) {
935
- var s, r;
936
+ function _n(e) {
937
+ var o, n;
936
938
  if (!e.protocolScope) {
937
- const n = Array.from(new Set(e.boundCardIds));
938
- return n.length > 0 && n.length < e.allCardIds.length ? { kind: "cards", cardIds: n } : void 0;
939
+ const r = Array.from(new Set(e.boundCardIds));
940
+ return r.length > 0 && r.length < e.allCardIds.length ? { kind: "cards", cardIds: r } : void 0;
939
941
  }
940
942
  if (e.protocolScope.level === "dashboard") {
941
- if (!((s = e.protocolScope.excludeViewIds) != null && s.length))
943
+ if (!((o = e.protocolScope.excludeViewIds) != null && o.length))
942
944
  return;
943
- const n = new Set(
944
- Re({
945
+ const r = new Set(
946
+ Ue({
945
947
  inputLabel: e.inputLabel,
946
948
  viewIds: e.protocolScope.excludeViewIds,
947
949
  viewIdToCardId: e.viewIdToCardId,
@@ -950,35 +952,35 @@ function Ds(e) {
950
952
  );
951
953
  return {
952
954
  kind: "cards",
953
- cardIds: e.allCardIds.filter((i) => !n.has(i))
955
+ cardIds: e.allCardIds.filter((s) => !r.has(s))
954
956
  };
955
957
  }
956
958
  if (e.protocolScope.level === "view") {
957
- const n = Re({
959
+ const r = Ue({
958
960
  inputLabel: e.inputLabel,
959
961
  viewIds: e.protocolScope.viewIds,
960
962
  viewIdToCardId: e.viewIdToCardId,
961
963
  warnings: e.warnings
962
964
  });
963
- return n.length === 0 ? (e.warnings.push(
964
- W(
965
+ return r.length === 0 ? (e.warnings.push(
966
+ X(
965
967
  "input_scope_has_no_materialized_cards",
966
968
  `Filter "${e.inputLabel}" was deferred because its view scope does not match any materialized cards.`
967
969
  )
968
- ), null) : { kind: "cards", cardIds: n };
970
+ ), null) : { kind: "cards", cardIds: r };
969
971
  }
970
972
  const t = e.sectionIdToCardIds.get(e.protocolScope.sectionId) || [];
971
973
  if (t.length === 0)
972
974
  return e.warnings.push(
973
- W(
975
+ X(
974
976
  "input_scope_section_not_found",
975
977
  `Filter "${e.inputLabel}" was deferred because section "${e.protocolScope.sectionId}" does not match any materialized cards.`
976
978
  )
977
979
  ), null;
978
- if (!((r = e.protocolScope.excludeViewIds) != null && r.length))
980
+ if (!((n = e.protocolScope.excludeViewIds) != null && n.length))
979
981
  return { kind: "cards", cardIds: t };
980
982
  const a = new Set(
981
- Re({
983
+ Ue({
982
984
  inputLabel: e.inputLabel,
983
985
  viewIds: e.protocolScope.excludeViewIds,
984
986
  viewIdToCardId: e.viewIdToCardId,
@@ -987,107 +989,107 @@ function Ds(e) {
987
989
  );
988
990
  return {
989
991
  kind: "cards",
990
- cardIds: t.filter((n) => !a.has(n))
992
+ cardIds: t.filter((r) => !a.has(r))
991
993
  };
992
994
  }
993
- function ci(e) {
994
- var $, _, g;
995
- const t = [], a = Fa(e);
996
- for (const A of a.warnings)
997
- t.push(W(A.code, A.message));
998
- for (const A of a.errors)
999
- t.push(W(A.code, A.message));
1000
- const s = ys(e, t), r = [], n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Set(), b = /* @__PURE__ */ new Set();
1001
- let y = 0;
1002
- for (const [A, c] of s.sections.entries()) {
1003
- const m = typeof c.title == "string" ? c.title : `Section ${A + 1}`, F = c.id || he(m, `section-${A + 1}`);
1004
- i.set(F, []);
1005
- for (const [k, T] of Ue(c).entries()) {
1006
- const N = Cs(T), R = he(
1007
- T.id || `${m}-${T.title || `View ${k + 1}`}`,
1008
- `card-${A + 1}-${k + 1}`
995
+ function js(e) {
996
+ var v, m, f;
997
+ const t = [], a = fo(e);
998
+ for (const S of a.warnings)
999
+ t.push(X(S.code, S.message));
1000
+ for (const S of a.errors)
1001
+ t.push(X(S.code, S.message));
1002
+ const o = fn(e, t), n = [], r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set();
1003
+ let p = 0;
1004
+ for (const [S, u] of o.sections.entries()) {
1005
+ const g = typeof u.title == "string" ? u.title : `Section ${S + 1}`, F = u.id || _e(g, `section-${S + 1}`);
1006
+ s.set(F, []);
1007
+ for (const [$, x] of st(u).entries()) {
1008
+ const N = hn(x), k = _e(
1009
+ x.id || `${g}-${x.title || `View ${$ + 1}`}`,
1010
+ `card-${S + 1}-${$ + 1}`
1009
1011
  );
1010
1012
  if (!N) {
1011
1013
  t.push(
1012
- W(
1014
+ X(
1013
1015
  "unsupported_presentation",
1014
- `Dashboard presentation "${(($ = T.presentation) == null ? void 0 : $.kind) || "unknown"}" is not supported by the dashboard authoring adapter.`,
1015
- `card-${R}`
1016
+ `Dashboard presentation "${((v = x.presentation) == null ? void 0 : v.kind) || "unknown"}" is not supported by the dashboard authoring adapter.`,
1017
+ `card-${k}`
1016
1018
  )
1017
1019
  );
1018
1020
  continue;
1019
1021
  }
1020
- if (((_ = T.analytics) == null ? void 0 : _.kind) === "sql") {
1022
+ if (((m = x.analytics) == null ? void 0 : m.kind) === "sql") {
1021
1023
  t.push(
1022
- W(
1024
+ X(
1023
1025
  "sql_intent_deferred",
1024
1026
  "SQL analytics intent is valid protocol, but the current dashboard authoring adapter only materializes semantic and physical config-card intents.",
1025
- `card-${R}`
1027
+ `card-${k}`
1026
1028
  )
1027
1029
  );
1028
1030
  continue;
1029
1031
  }
1030
- const O = kt(R, u), E = `card-${O}`;
1031
- T.id && n.set(T.id, E), (g = i.get(F)) == null || g.push(E);
1032
- const V = T.analytics && "inputs" in T.analytics ? T.analytics.inputs : void 0;
1033
- for (const K of V || []) {
1034
- const L = d.get(K.inputId) || [];
1035
- L.push(E), d.set(K.inputId, L);
1032
+ const O = Jt(k, d), E = `card-${O}`;
1033
+ x.id && r.set(x.id, E), (f = s.get(F)) == null || f.push(E);
1034
+ const V = x.analytics && "inputs" in x.analytics ? x.analytics.inputs : void 0;
1035
+ for (const W of V || []) {
1036
+ const L = i.get(W.inputId) || [];
1037
+ L.push(E), i.set(W.inputId, L);
1036
1038
  }
1037
- r.push({
1039
+ n.push({
1038
1040
  id: E,
1039
1041
  frameId: `frame-${O}`,
1040
- title: T.title,
1041
- description: T.description,
1042
+ title: x.title,
1043
+ description: x.description,
1042
1044
  type: N,
1043
- role: Ss(T),
1044
- priority: y,
1045
- section: m,
1046
- analyticsIntent: _s(T.analytics),
1047
- text: T.text
1048
- }), y += 1;
1045
+ role: pn(x),
1046
+ priority: p,
1047
+ section: g,
1048
+ analyticsIntent: mn(x.analytics),
1049
+ text: x.text
1050
+ }), p += 1;
1049
1051
  }
1050
1052
  }
1051
- const C = s.inputs.map((A) => {
1052
- const c = Ds({
1053
- protocolScope: A.scope,
1054
- inputLabel: A.label,
1055
- allCardIds: r.map((m) => m.id),
1056
- boundCardIds: d.get(A.id) || [],
1057
- viewIdToCardId: n,
1058
- sectionIdToCardIds: i,
1053
+ const _ = o.inputs.map((S) => {
1054
+ const u = _n({
1055
+ protocolScope: S.scope,
1056
+ inputLabel: S.label,
1057
+ allCardIds: n.map((g) => g.id),
1058
+ boundCardIds: i.get(S.id) || [],
1059
+ viewIdToCardId: r,
1060
+ sectionIdToCardIds: s,
1059
1061
  warnings: t
1060
1062
  });
1061
- return c === null ? null : Ts(
1062
- A,
1063
- s.defaultSource,
1064
- s.sources,
1063
+ return u === null ? null : In(
1064
+ S,
1065
+ o.defaultSource,
1066
+ o.sources,
1067
+ u,
1065
1068
  c,
1066
- b,
1067
1069
  t
1068
1070
  );
1069
- }).filter((A) => !!A);
1071
+ }).filter((S) => !!S);
1070
1072
  return { plan: {
1071
1073
  version: 1,
1072
- id: `plan-${he(e.title, "dashboard")}`,
1074
+ id: `plan-${_e(e.title, "dashboard")}`,
1073
1075
  title: e.title,
1074
1076
  description: e.description,
1075
- datasets: s.datasets,
1077
+ datasets: o.datasets,
1076
1078
  sheets: [
1077
1079
  {
1078
- id: `sheet-${he(e.title, "dashboard")}`,
1080
+ id: `sheet-${_e(e.title, "dashboard")}`,
1079
1081
  title: e.title,
1080
1082
  description: e.description,
1081
1083
  kind: "dashboard",
1082
- cards: r
1084
+ cards: n
1083
1085
  }
1084
1086
  ],
1085
- filterInputs: C.length ? C : void 0,
1087
+ filterInputs: _.length ? _ : void 0,
1086
1088
  warnings: t.length ? t : void 0,
1087
- unresolvedRequests: a.ok ? void 0 : a.errors.map((A) => A.message)
1089
+ unresolvedRequests: a.ok ? void 0 : a.errors.map((S) => S.message)
1088
1090
  }, warnings: t };
1089
1091
  }
1090
- const ui = [
1092
+ const Ks = [
1091
1093
  "cardType",
1092
1094
  "sql",
1093
1095
  "python",
@@ -1102,958 +1104,958 @@ const ui = [
1102
1104
  "resolvedPrimaryDateField",
1103
1105
  "globalDateComparison",
1104
1106
  "calendarContext"
1105
- ], hi = [
1107
+ ], Us = [
1106
1108
  "cardId",
1107
1109
  "cardTitle",
1108
1110
  "cache_config",
1109
1111
  "queryConfig",
1110
1112
  "tableConfig"
1111
1113
  ];
1112
- class H extends Error {
1113
- constructor(a, s, r) {
1114
+ class Z extends Error {
1115
+ constructor(a, o, n) {
1114
1116
  super(a);
1115
- ke(this, "field");
1116
- ke(this, "details");
1117
- Object.setPrototypeOf(this, H.prototype), this.name = "CardQueryRequestError", this.field = s, this.details = r;
1117
+ Be(this, "field");
1118
+ Be(this, "details");
1119
+ Object.setPrototypeOf(this, Z.prototype), this.name = "CardQueryRequestError", this.field = o, this.details = n;
1118
1120
  }
1119
1121
  }
1120
- function je(e) {
1122
+ function rt(e) {
1121
1123
  return e.label ? `${e.label}.` : "";
1122
1124
  }
1123
- function ae(e) {
1125
+ function de(e) {
1124
1126
  return !e || typeof e != "object" || Array.isArray(e) ? {} : { ...e };
1125
1127
  }
1126
- function Ce(e) {
1128
+ function De(e) {
1127
1129
  return typeof e == "string" ? e : "";
1128
1130
  }
1129
- function ks(e, t = {}) {
1130
- const a = ae(e), s = je(t), r = {};
1131
+ function Cn(e, t = {}) {
1132
+ const a = de(e), o = rt(t), n = {};
1131
1133
  if (a.calendarContext !== void 0) {
1132
- const i = La(a.calendarContext);
1133
- if (!i.ok)
1134
- throw new H(
1135
- `${s}calendarContext: ${i.issues.map((d) => d.message).join("; ")}`,
1134
+ const s = Ao(a.calendarContext);
1135
+ if (!s.ok)
1136
+ throw new Z(
1137
+ `${o}calendarContext: ${s.issues.map((i) => i.message).join("; ")}`,
1136
1138
  "calendarContext",
1137
- i.issues
1139
+ s.issues
1138
1140
  );
1139
- r.calendarContext = i.value;
1141
+ n.calendarContext = s.value;
1140
1142
  }
1141
- const n = zt(a.resolvedPrimaryDateField);
1142
- if (!n.ok)
1143
- throw new H(
1144
- `${s}${Qt(n.issues)}`,
1143
+ const r = ya(a.resolvedPrimaryDateField);
1144
+ if (!r.ok)
1145
+ throw new Z(
1146
+ `${o}${Ia(r.issues)}`,
1145
1147
  "resolvedPrimaryDateField",
1146
- n.issues
1148
+ r.issues
1147
1149
  );
1148
- if (a.resolvedPrimaryDateField && (r.resolvedPrimaryDateField = a.resolvedPrimaryDateField), a.globalDateComparison !== void 0) {
1149
- const i = Pa(a.globalDateComparison);
1150
- if (!i.ok)
1151
- throw new H(
1152
- `${s}Invalid globalDateComparison: ${i.errors.map((d) => `${d.path}: ${d.message}`).join("; ")}`,
1150
+ if (a.resolvedPrimaryDateField && (n.resolvedPrimaryDateField = a.resolvedPrimaryDateField), a.globalDateComparison !== void 0) {
1151
+ const s = To(a.globalDateComparison);
1152
+ if (!s.ok)
1153
+ throw new Z(
1154
+ `${o}Invalid globalDateComparison: ${s.errors.map((i) => `${i.path}: ${i.message}`).join("; ")}`,
1153
1155
  "globalDateComparison",
1154
- i.errors
1156
+ s.errors
1155
1157
  );
1156
- r.globalDateComparison = Ma(
1158
+ n.globalDateComparison = ko(
1157
1159
  a.globalDateComparison
1158
1160
  );
1159
1161
  }
1160
- return r;
1162
+ return n;
1161
1163
  }
1162
- function fi(e, t = {}) {
1163
- const a = ae(e), s = je(t), r = {};
1164
+ function Gs(e, t = {}) {
1165
+ const a = de(e), o = rt(t), n = {};
1164
1166
  if (a.pagination !== void 0) {
1165
- const n = ae(a.pagination), i = n.page, d = n.pageSize;
1166
- if (!Number.isInteger(i) || i < 1 || !Number.isInteger(d) || d < 1)
1167
- throw new H(
1168
- `${s}pagination must name a page and a page size of at least 1`,
1167
+ const r = de(a.pagination), s = r.page, i = r.pageSize;
1168
+ if (!Number.isInteger(s) || s < 1 || !Number.isInteger(i) || i < 1)
1169
+ throw new Z(
1170
+ `${o}pagination must name a page and a page size of at least 1`,
1169
1171
  "pagination"
1170
1172
  );
1171
- r.pagination = { page: i, pageSize: d };
1173
+ n.pagination = { page: s, pageSize: i };
1172
1174
  }
1173
1175
  if (a.tableTotalsRequest !== void 0) {
1174
1176
  if (!a.tableTotalsRequest || typeof a.tableTotalsRequest != "object" || Array.isArray(a.tableTotalsRequest))
1175
- throw new H(`${s}tableTotalsRequest must be an object`, "tableTotalsRequest");
1176
- r.tableTotalsRequest = a.tableTotalsRequest;
1177
+ throw new Z(`${o}tableTotalsRequest must be an object`, "tableTotalsRequest");
1178
+ n.tableTotalsRequest = a.tableTotalsRequest;
1177
1179
  }
1178
1180
  if (a.sourceRowProbe !== void 0) {
1179
- const n = ae(a.sourceRowProbe).limit;
1180
- if (!Number.isInteger(n) || n < 1)
1181
- throw new H(
1182
- `${s}sourceRowProbe must name a limit of at least 1`,
1181
+ const r = de(a.sourceRowProbe).limit;
1182
+ if (!Number.isInteger(r) || r < 1)
1183
+ throw new Z(
1184
+ `${o}sourceRowProbe must name a limit of at least 1`,
1183
1185
  "sourceRowProbe"
1184
1186
  );
1185
- if (r.pagination)
1186
- throw new H(
1187
- `${s}sourceRowProbe cannot be combined with pagination`,
1187
+ if (n.pagination)
1188
+ throw new Z(
1189
+ `${o}sourceRowProbe cannot be combined with pagination`,
1188
1190
  "sourceRowProbe"
1189
1191
  );
1190
- r.sourceRowProbe = { limit: n };
1192
+ n.sourceRowProbe = { limit: r };
1191
1193
  }
1192
- return r;
1194
+ return n;
1193
1195
  }
1194
- function pi(e, t = {}) {
1195
- const a = ae(e), s = je(t), r = (g) => new H(`${s}${g} is required`, g), n = Ce(a.connection_id).trim();
1196
- if (!n) throw r("connection_id");
1197
- const i = Ce(a.cardType).trim();
1198
- if (!i) throw r("cardType");
1199
- const d = a.resultOwner;
1200
- if (d !== "config" && d !== "freeform" && d !== "none")
1201
- throw r("resultOwner");
1202
- const u = ae(a.cardConfig), b = Ce(a.sql), y = Ce(a.python), C = !!t.configOptional || Object.keys(u).length > 0;
1203
- if (d === "config" && !C) throw r("cardConfig");
1204
- if (d === "freeform" && !b.trim()) throw r("sql");
1205
- const p = Kt({
1206
- hasExecutableConfig: C,
1207
- sql: b,
1208
- normalizedPython: y
1196
+ function zs(e, t = {}) {
1197
+ const a = de(e), o = rt(t), n = (f) => new Z(`${o}${f} is required`, f), r = De(a.connection_id).trim();
1198
+ if (!r) throw n("connection_id");
1199
+ const s = De(a.cardType).trim();
1200
+ if (!s) throw n("cardType");
1201
+ const i = a.resultOwner;
1202
+ if (i !== "config" && i !== "freeform" && i !== "none")
1203
+ throw n("resultOwner");
1204
+ const d = de(a.cardConfig), c = De(a.sql), p = De(a.python), _ = !!t.configOptional || Object.keys(d).length > 0;
1205
+ if (i === "config" && !_) throw n("cardConfig");
1206
+ if (i === "freeform" && !c.trim()) throw n("sql");
1207
+ const b = _a({
1208
+ hasExecutableConfig: _,
1209
+ sql: c,
1210
+ normalizedPython: p
1209
1211
  });
1210
- if (d !== p)
1211
- throw new H(
1212
- `${s}resultOwner must match the normalized execution owner "${p}"`,
1212
+ if (i !== b)
1213
+ throw new Z(
1214
+ `${o}resultOwner must match the normalized execution owner "${b}"`,
1213
1215
  "resultOwner"
1214
1216
  );
1215
- if (d === "none") throw r("cardConfig");
1216
- const $ = ae(a.cardDataSource);
1217
- if (Object.keys($).length === 0) throw r("cardDataSource");
1218
- const _ = Wt({
1217
+ if (i === "none") throw n("cardConfig");
1218
+ const v = de(a.cardDataSource);
1219
+ if (Object.keys(v).length === 0) throw n("cardDataSource");
1220
+ const m = Ca({
1219
1221
  controlValues: a.controlValues,
1220
1222
  controlDefinitions: a.controlDefinitions,
1221
1223
  cardControlDefinitions: a.cardControlDefinitions,
1222
1224
  controlBindings: a.controlBindings
1223
1225
  });
1224
1226
  return {
1225
- connection_id: n,
1226
- cardType: i,
1227
- sql: b,
1228
- python: y,
1229
- resultOwner: d,
1230
- cardConfig: u,
1231
- cardDataSource: $,
1227
+ connection_id: r,
1228
+ cardType: s,
1229
+ sql: c,
1230
+ python: p,
1231
+ resultOwner: i,
1232
+ cardConfig: d,
1233
+ cardDataSource: v,
1232
1234
  active_filters: Array.isArray(a.active_filters) ? a.active_filters : [],
1233
- controlValues: _.controlValues,
1234
- controlDefinitions: _.controlDefinitions,
1235
- cardControlDefinitions: _.cardControlDefinitions,
1236
- controlBindings: _.controlBindings,
1237
- ...ks(a, t)
1235
+ controlValues: m.controlValues,
1236
+ controlDefinitions: m.controlDefinitions,
1237
+ cardControlDefinitions: m.cardControlDefinitions,
1238
+ controlBindings: m.controlBindings,
1239
+ ...Cn(a, t)
1238
1240
  };
1239
1241
  }
1240
- const $s = {
1242
+ const vn = {
1241
1243
  global_date: "The date filter for the whole report can't be changed through the MCP. Change it in the editor; removing or excluding it works.",
1242
1244
  not_semantic: "This filter reads a database table, not a dataset, so it can't be changed through the MCP. Change it in the editor; removing or excluding it works.",
1243
1245
  scope_not_expressible: "This filter applies to chosen cards rather than whole sheets, so it can't be changed through the MCP. Change it in the editor; removing or excluding it works."
1244
1246
  };
1245
- function Fs(e, t, a = {}) {
1246
- var d;
1247
- const s = de(e), r = Yt(t.scope), n = new Set(re(e).map((u) => u.cardId)), i = {
1247
+ function Sn(e, t, a = {}) {
1248
+ var i;
1249
+ const o = he(e), n = Sa(t.scope), r = new Set(ie(e).map((d) => d.cardId)), s = {
1248
1250
  reaches: [],
1249
1251
  excluded: [
1250
1252
  .../* @__PURE__ */ new Set([
1251
- ...(((d = t.application) == null ? void 0 : d.cards) ?? []).filter((u) => u.kind === "excluded").map((u) => u.cardId),
1252
- ...r.filter((u) => n.has(u))
1253
+ ...(((i = t.application) == null ? void 0 : i.cards) ?? []).filter((d) => d.kind === "excluded").map((d) => d.cardId),
1254
+ ...n.filter((d) => r.has(d))
1253
1255
  ])
1254
1256
  ],
1255
1257
  notReached: []
1256
1258
  };
1257
1259
  if (t.filter.kind === "global-date") {
1258
- const u = new Set(i.excluded);
1259
- return i.reaches = Xt(e, t.filter).filter(({ card: b }) => !u.has(b.id) && fe(b)).map(({ card: b }) => b.id), i;
1260
+ const d = new Set(s.excluded);
1261
+ return s.reaches = $a(e, t.filter).filter(({ card: c }) => !d.has(c.id) && ve(c)).map(({ card: c }) => c.id), s;
1260
1262
  }
1261
- for (const u of s.reachedCards({ inputId: t.id })) {
1262
- const b = ve(t, u.card, a), y = b.reach, C = () => {
1263
- const p = fe(u.card);
1263
+ for (const d of o.reachedCards({ inputId: t.id })) {
1264
+ const c = Oe(t, d.card, a), p = c.reach, _ = () => {
1265
+ const b = ve(d.card);
1264
1266
  return {
1265
- cardId: u.cardId,
1266
- title: u.card.title ?? "",
1267
- ...(p == null ? void 0 : p.kind) === "semantic" ? { datasetName: p.datasetName } : {}
1267
+ cardId: d.cardId,
1268
+ title: d.card.title ?? "",
1269
+ ...(b == null ? void 0 : b.kind) === "semantic" ? { datasetName: b.datasetName } : {}
1268
1270
  };
1269
1271
  };
1270
- switch (y) {
1272
+ switch (p) {
1271
1273
  case "bound":
1272
1274
  case "automatic":
1273
1275
  case "sql":
1274
1276
  case "relationshipApplied":
1275
- i.reaches.push(u.cardId);
1277
+ s.reaches.push(d.cardId);
1276
1278
  break;
1277
1279
  case "blocked":
1278
1280
  case "ambiguous":
1279
- (i.blocked ?? (i.blocked = [])).push({ cardId: u.cardId, title: u.card.title ?? "", reason: y });
1281
+ (s.blocked ?? (s.blocked = [])).push({ cardId: d.cardId, title: d.card.title ?? "", reason: p });
1280
1282
  break;
1281
1283
  case "relationship":
1282
- (i.relationshipPending ?? (i.relationshipPending = [])).push(C());
1284
+ (s.relationshipPending ?? (s.relationshipPending = [])).push(_());
1283
1285
  break;
1284
1286
  case "excluded":
1285
1287
  break;
1286
1288
  case "notApplicable":
1287
- fe(u.card) && i.notReached.push({ ...C(), ...b.reason ? { reason: b.reason } : {} });
1289
+ ve(d.card) && s.notReached.push({ ..._(), ...c.reason ? { reason: c.reason } : {} });
1288
1290
  break;
1289
1291
  default: {
1290
- const p = y;
1291
- throw new Error(`Unhandled filter reach ${String(p)}`);
1292
+ const b = p;
1293
+ throw new Error(`Unhandled filter reach ${String(b)}`);
1292
1294
  }
1293
1295
  }
1294
1296
  }
1295
- return i;
1297
+ return s;
1296
1298
  }
1297
- function As(e, t) {
1298
- var r;
1299
+ function $n(e, t) {
1300
+ var n;
1299
1301
  const a = t.scope;
1300
1302
  if (a.kind === "allSheets") {
1301
- if ((r = a.sheetKinds) != null && r.length && !a.sheetKinds.includes("dashboard")) return;
1302
- const n = Jt(a);
1303
+ if ((n = a.sheetKinds) != null && n.length && !a.sheetKinds.includes("dashboard")) return;
1304
+ const r = wa(a);
1303
1305
  return {
1304
1306
  sheetIds: "all",
1305
- ...n.length ? { exceptSheetIds: [...n] } : {},
1306
- ...Zt(a) ? { includesDocumentSheets: !0 } : {}
1307
+ ...r.length ? { exceptSheetIds: [...r] } : {},
1308
+ ...Fa(a) ? { includesDocumentSheets: !0 } : {}
1307
1309
  };
1308
1310
  }
1309
1311
  if (a.kind !== "sheets") return;
1310
- const s = [...Me(e).values()].filter((n) => yt(t, n));
1312
+ const o = [...Ze(e).values()].filter((r) => Vt(t, r));
1311
1313
  return {
1312
- sheetIds: s.filter((n) => n.sheetKind === "dashboard").map((n) => n.sheetId),
1314
+ sheetIds: o.filter((r) => r.sheetKind === "dashboard").map((r) => r.sheetId),
1313
1315
  // Document sheets it names stay through a change of sheets (`withUnstatedScopeParts`).
1314
- ...s.some((n) => n.sheetKind === "document") ? { includesDocumentSheets: !0 } : {}
1316
+ ...o.some((r) => r.sheetKind === "document") ? { includesDocumentSheets: !0 } : {}
1315
1317
  };
1316
1318
  }
1317
- function Ft(e, t) {
1319
+ function Zt(e, t) {
1318
1320
  return e ?? { tz: "UTC", weekStart: 1, anchor: { iso: t ?? "1970-01-01T00:00:00.000Z" } };
1319
1321
  }
1320
- function At(e, t, a, s) {
1321
- var g, A, c;
1322
- const { input: r } = t, n = Fs(e, r, s), i = (m, F) => ({
1323
- filterId: r.id,
1324
- label: r.label,
1322
+ function ea(e, t, a, o) {
1323
+ var f, S, u;
1324
+ const { input: n } = t, r = Sn(e, n, o), s = (g, F) => ({
1325
+ filterId: n.id,
1326
+ label: n.label,
1325
1327
  editable: !1,
1326
1328
  kind: F,
1327
- notEditable: { reason: m, message: $s[m] },
1328
- reaches: n.reaches,
1329
- excluded: n.excluded,
1330
- ...n.blocked ? { blocked: n.blocked } : {},
1331
- ...n.relationshipPending ? { relationshipPending: n.relationshipPending } : {}
1329
+ notEditable: { reason: g, message: vn[g] },
1330
+ reaches: r.reaches,
1331
+ excluded: r.excluded,
1332
+ ...r.blocked ? { blocked: r.blocked } : {},
1333
+ ...r.relationshipPending ? { relationshipPending: r.relationshipPending } : {}
1332
1334
  });
1333
- if (r.filter.kind === "global-date") return i("global_date", "global_date");
1334
- const d = Ht(r.filter).filter((m) => m.kind === "semantic");
1335
- if (d.length !== 1 || d[0].kind !== "semantic") return i("not_semantic", "field");
1336
- const u = As(e, r);
1337
- if (!u || t.origin !== "embeddedInput") return i("scope_not_expressible", "field");
1338
- const b = ((g = r.filter.fieldMeta) == null ? void 0 : g.name) ?? ((A = r.filter.column) == null ? void 0 : A.split(".").pop()) ?? "", y = It({
1335
+ if (n.filter.kind === "global-date") return s("global_date", "global_date");
1336
+ const i = va(n.filter).filter((g) => g.kind === "semantic");
1337
+ if (i.length !== 1 || i[0].kind !== "semantic") return s("not_semantic", "field");
1338
+ const d = $n(e, n);
1339
+ if (!d || t.origin !== "embeddedInput") return s("scope_not_expressible", "field");
1340
+ const c = ((f = n.filter.fieldMeta) == null ? void 0 : f.name) ?? ((S = n.filter.column) == null ? void 0 : S.split(".").pop()) ?? "", p = Bt({
1339
1341
  dashboard: e,
1340
- target: { kind: "dashboardInput", input: r, scope: {} },
1341
- calendar: Ft(a, void 0)
1342
- }).value, C = St(r.filter.dataType), p = C || (c = y == null ? void 0 : y.values) == null ? void 0 : c.filter((m) => ["string", "number", "boolean"].includes(typeof m)), $ = y && "relativeMeta" in y ? y.relativeMeta : void 0, _ = C && $ ? Aa($) : null;
1342
+ target: { kind: "dashboardInput", input: n, scope: {} },
1343
+ calendar: Zt(a, void 0)
1344
+ }).value, _ = Gt(n.filter.dataType), b = _ || (u = p == null ? void 0 : p.values) == null ? void 0 : u.filter((g) => ["string", "number", "boolean"].includes(typeof g)), v = p && "relativeMeta" in p ? p.relativeMeta : void 0, m = _ && v ? mo(v) : null;
1343
1345
  return {
1344
- filterId: r.id,
1345
- label: r.label,
1346
+ filterId: n.id,
1347
+ label: n.label,
1346
1348
  editable: !0,
1347
- domainId: d[0].domainId,
1348
- datasetName: d[0].datasetName,
1349
- field: b,
1350
- selection: r.filter.type === "single" ? "single" : "multiple",
1351
- ...p != null && p.length ? { defaultValues: p } : {},
1352
- ..._ ? { defaultPeriod: _ } : {},
1353
- ...C ? { datePicker: r.filter.dateSelectionMode === "day" ? "day" : r.filter.dateSelectionMode === "months" ? "month" : "range" } : {},
1354
- ...u,
1355
- ...n
1349
+ domainId: i[0].domainId,
1350
+ datasetName: i[0].datasetName,
1351
+ field: c,
1352
+ selection: n.filter.type === "single" ? "single" : "multiple",
1353
+ ...b != null && b.length ? { defaultValues: b } : {},
1354
+ ...m ? { defaultPeriod: m } : {},
1355
+ ..._ ? { datePicker: n.filter.dateSelectionMode === "day" ? "day" : n.filter.dateSelectionMode === "months" ? "month" : "range" } : {},
1356
+ ...d,
1357
+ ...r
1356
1358
  };
1357
1359
  }
1358
- function Rt(e, t, a) {
1359
- return de(e).inputs.map((s) => At(e, s, t, a));
1360
+ function ta(e, t, a) {
1361
+ return he(e).inputs.map((o) => ea(e, o, t, a));
1360
1362
  }
1361
- function pe(e, t, a, s) {
1362
- const r = de(e).findFilterInput({ inputId: t });
1363
- return r ? At(e, r, a, s) : void 0;
1363
+ function Se(e, t, a, o) {
1364
+ const n = he(e).findFilterInput({ inputId: t });
1365
+ return n ? ea(e, n, a, o) : void 0;
1364
1366
  }
1365
- function Rs(e, t, a, s, r) {
1366
- var c, m, F, k, T, N;
1367
- const n = oe(e, { sql: !0 });
1368
- if (!n.editable) return [n.message];
1369
- const i = n.query, d = t;
1370
- if ("sql" in t) return d.sql === i.sql && d.connectionId === i.connectionId ? [] : ["the SQL"];
1371
- const u = (s == null ? void 0 : s.source.kind) === "semantic" ? oe({
1367
+ function wn(e, t, a, o, n) {
1368
+ var u, g, F, $, x, N;
1369
+ const r = me(e, { sql: !0 });
1370
+ if (!r.editable) return [r.message];
1371
+ const s = r.query, i = t;
1372
+ if ("sql" in t) return i.sql === s.sql && i.connectionId === s.connectionId ? [] : ["the SQL"];
1373
+ const d = (o == null ? void 0 : o.source.kind) === "semantic" ? me({
1372
1374
  id: e.id,
1373
1375
  title: e.title,
1374
- type: s.type,
1375
- dataSource: s.source.dataSource,
1376
- connectionId: s.source.connectionId,
1377
- config: s.config
1376
+ type: o.type,
1377
+ dataSource: o.source.dataSource,
1378
+ connectionId: o.source.connectionId,
1379
+ config: o.config
1378
1380
  }, { sql: !0 }) : void 0;
1379
- if (u && !u.editable) return ["the compiled query"];
1380
- const b = u != null && u.editable ? u.query : void 0, y = String(d.datasetName ?? ""), C = [], p = (R) => ne(R, y), $ = (R, O, E) => {
1381
- const V = O ?? [], K = E ?? [];
1382
- (V.length !== K.length || V.some((L, q) => p(L) !== p(K[q]))) && C.push(R);
1381
+ if (d && !d.editable) return ["the compiled query"];
1382
+ const c = d != null && d.editable ? d.query : void 0, p = String(i.datasetName ?? ""), _ = [], b = (k) => fe(k, p), v = (k, O, E) => {
1383
+ const V = O ?? [], W = E ?? [];
1384
+ (V.length !== W.length || V.some((L, P) => b(L) !== b(W[P]))) && _.push(k);
1383
1385
  };
1384
- for (const R of ["domainId", "datasetName"]) d[R] !== i[R] && C.push(R);
1385
- if ($("measures", d.measures, i.measures), $("columns", d.columns, i.columns), a || n.matrix) {
1386
- const R = (E) => new Set(((E == null ? void 0 : E.columns) ?? []).map(p)), O = (E, V) => (E ?? []).filter((K) => !R(V).has(p(K)));
1387
- $("dimensions", O(d.dimensions, a), O(i.dimensions, n.matrix)), $("matrix.columns", a == null ? void 0 : a.columns, (c = n.matrix) == null ? void 0 : c.columns);
1386
+ for (const k of ["domainId", "datasetName"]) i[k] !== s[k] && _.push(k);
1387
+ if (v("measures", i.measures, s.measures), v("columns", i.columns, s.columns), a || r.matrix) {
1388
+ const k = (E) => new Set(((E == null ? void 0 : E.columns) ?? []).map(b)), O = (E, V) => (E ?? []).filter((W) => !k(V).has(b(W)));
1389
+ v("dimensions", O(i.dimensions, a), O(s.dimensions, r.matrix)), v("matrix.columns", a == null ? void 0 : a.columns, (u = r.matrix) == null ? void 0 : u.columns);
1388
1390
  } else
1389
- $("dimensions", d.dimensions, i.dimensions);
1390
- const _ = d.timeWindow !== void 0 && !d.timeGrain, g = _ && i.timeWindow === void 0 ? void 0 : _ && d.dateField === void 0 ? b == null ? void 0 : b.dateField : d.dateField;
1391
- g !== void 0 && (i.dateField === void 0 || p(g) !== p(i.dateField)) && C.push("dateField"), d.timeGrain !== void 0 && d.timeGrain !== i.timeGrain && C.push("timeGrain");
1392
- const A = (m = e.config) != null && m.matrix ? e.config.matrix.spec.measures.map((R) => R.kind === "aggregate" ? { aggregate: R.aggregate } : {}) : ((F = e.config) == null ? void 0 : F.metricColumns) ?? [];
1393
- (d.measures ?? []).forEach((R, O) => {
1394
- const E = R && typeof R == "object" ? R.aggregate : void 0;
1395
- E && ht(A[O] ?? {}) !== E && C.push(`the aggregate of measures[${O}]`);
1391
+ v("dimensions", i.dimensions, s.dimensions);
1392
+ const m = i.timeWindow !== void 0 && !i.timeGrain, f = m && s.timeWindow === void 0 ? void 0 : m && i.dateField === void 0 ? c == null ? void 0 : c.dateField : i.dateField;
1393
+ f !== void 0 && (s.dateField === void 0 || b(f) !== b(s.dateField)) && _.push("dateField"), i.timeGrain !== void 0 && i.timeGrain !== s.timeGrain && _.push("timeGrain");
1394
+ const S = (g = e.config) != null && g.matrix ? e.config.matrix.spec.measures.map((k) => k.kind === "aggregate" ? { aggregate: k.aggregate } : {}) : ((F = e.config) == null ? void 0 : F.metricColumns) ?? [];
1395
+ (i.measures ?? []).forEach((k, O) => {
1396
+ const E = k && typeof k == "object" ? k.aggregate : void 0;
1397
+ E && Dt(S[O] ?? {}) !== E && _.push(`the aggregate of measures[${O}]`);
1396
1398
  });
1397
- for (const { key: R, label: O } of Ee(t))
1398
- ea(e, R) !== O && C.push(`the label "${O}"`);
1399
- if (!r || r.aspects.includes("filters")) {
1400
- const R = d.filters ?? [];
1401
- let O = i.filters ?? [];
1402
- const E = d.timeWindow, V = i.timeWindow, K = (L, q) => {
1403
- const j = (Te) => JSON.stringify((Te ?? []).map(String));
1404
- return p(L.field) === p(q.field) && L.operator === q.operator && (L.scope ?? "row") === (q.scope ?? "row") && (typeof L.field == "object" ? L.field.aggregate : void 0) === (typeof q.field == "object" ? q.field.aggregate : void 0) && (L.values === void 0 || j(L.values) === j(q.values));
1399
+ for (const { key: k, label: O } of ze(t))
1400
+ xa(e, k) !== O && _.push(`the label "${O}"`);
1401
+ if (!n || n.aspects.includes("filters")) {
1402
+ const k = i.filters ?? [];
1403
+ let O = s.filters ?? [];
1404
+ const E = i.timeWindow, V = s.timeWindow, W = (L, P) => {
1405
+ const U = (Me) => JSON.stringify((Me ?? []).map(String));
1406
+ return b(L.field) === b(P.field) && L.operator === P.operator && (L.scope ?? "row") === (P.scope ?? "row") && (typeof L.field == "object" ? L.field.aggregate : void 0) === (typeof P.field == "object" ? P.field.aggregate : void 0) && (L.values === void 0 || U(L.values) === U(P.values));
1405
1407
  };
1406
1408
  if (E && !V) {
1407
- const L = ((b == null ? void 0 : b.filters) ?? []).filter(
1408
- (q) => !(b != null && b.timeWindow) && !R.some((j) => K(j, q))
1409
+ const L = ((c == null ? void 0 : c.filters) ?? []).filter(
1410
+ (P) => !(c != null && c.timeWindow) && !k.some((U) => W(U, P))
1409
1411
  );
1410
- (!L.length || L.some((q) => !O.some((j) => K(q, j)))) && C.push("timeWindow"), O = O.filter((q) => !L.some((j) => K(j, q)));
1411
- } else E ? Object.keys(E).filter((q) => !(q === "kind" && E.kind === "relative" && (V == null ? void 0 : V.kind) === void 0)).some((q) => !Le(E[q], V == null ? void 0 : V[q])) && C.push("timeWindow") : V && C.push("timeWindow");
1412
- (R.length !== O.length || R.some((L, q) => !K(L, O[q]))) && C.push("filters");
1412
+ (!L.length || L.some((P) => !O.some((U) => W(P, U)))) && _.push("timeWindow"), O = O.filter((P) => !L.some((U) => W(U, P)));
1413
+ } else E ? Object.keys(E).filter((P) => !(P === "kind" && E.kind === "relative" && (V == null ? void 0 : V.kind) === void 0)).some((P) => !et(E[P], V == null ? void 0 : V[P])) && _.push("timeWindow") : V && _.push("timeWindow");
1414
+ (k.length !== O.length || k.some((L, P) => !W(L, O[P]))) && _.push("filters");
1413
1415
  }
1414
- if (d.orderBy !== void 0) {
1415
- const R = d.orderBy, O = (T = (k = e.config) == null ? void 0 : k.sortByColumns) == null ? void 0 : T[0], E = O && ta(e.config ?? {}, O), V = R.field && typeof R.field == "object" ? R.field.aggregate : void 0;
1416
- (!O || !E || O.direction !== R.direction || p(R.field) !== aa(E.name, sa(E)) || V !== void 0 && ht(E) !== V) && C.push("orderBy");
1416
+ if (i.orderBy !== void 0) {
1417
+ const k = i.orderBy, O = (x = ($ = e.config) == null ? void 0 : $.sortByColumns) == null ? void 0 : x[0], E = O && Ta(e.config ?? {}, O), V = k.field && typeof k.field == "object" ? k.field.aggregate : void 0;
1418
+ (!O || !E || O.direction !== k.direction || b(k.field) !== ka(E.name, Da(E)) || V !== void 0 && Dt(E) !== V) && _.push("orderBy");
1417
1419
  }
1418
- return d.limit !== void 0 && ((N = e.config) == null ? void 0 : N.rowLimit) !== d.limit && C.push("limit"), C;
1420
+ return i.limit !== void 0 && ((N = e.config) == null ? void 0 : N.rowLimit) !== i.limit && _.push("limit"), _;
1419
1421
  }
1420
- class ue extends Error {
1422
+ class Ie extends Error {
1421
1423
  }
1422
- const Pe = (e) => (e ?? "").trim().toLowerCase(), xe = ua, mt = { measures: ma, records: pa, sql: fa }, Se = {
1424
+ const We = (e) => (e ?? "").trim().toLowerCase(), Ne = Ma, Ot = { measures: ja, records: Va, sql: Ba }, Ae = {
1423
1425
  measures: "a measures query (measures, with optional dimensions)",
1424
1426
  records: "a records query (columns)",
1425
1427
  sql: "a SQL query"
1426
1428
  };
1427
- function Et(e, t) {
1428
- return t.path.reduce((a, s) => typeof s == "number" ? `${a}[${s}]` : `${a}.${s}`, e);
1429
- }
1430
- async function mi(e, t, a) {
1431
- var Qe, Ke, We, He, Ye, Xe, Je, Ze, et;
1432
- const s = [], r = [], n = [], i = [], d = /* @__PURE__ */ new Set(), u = [], b = /* @__PURE__ */ new Map(), y = { calendar: a.calendar }, C = a.relationshipReach ? { relationshipReach: a.relationshipReach } : {};
1433
- let p = e, $ = 0;
1434
- if (t.length > ot)
1429
+ function aa(e, t) {
1430
+ return t.path.reduce((a, o) => typeof o == "number" ? `${a}[${o}]` : `${a}.${o}`, e);
1431
+ }
1432
+ async function Qs(e, t, a) {
1433
+ var lt, ut, ft, mt, ht, pt, gt, bt, yt;
1434
+ const o = [], n = [], r = [], s = [], i = /* @__PURE__ */ new Set(), d = [], c = /* @__PURE__ */ new Map(), p = { calendar: a.calendar }, _ = a.relationshipReach ? { relationshipReach: a.relationshipReach } : {};
1435
+ let b = e, v = 0;
1436
+ if (t.length > $t)
1435
1437
  return {
1436
1438
  ok: !1,
1437
1439
  problems: [
1438
1440
  {
1439
1441
  code: "too_many_changes",
1440
- message: `A proposal takes at most ${ot} changes; this one has ${t.length}.`,
1442
+ message: `A proposal takes at most ${$t} changes; this one has ${t.length}.`,
1441
1443
  path: "changes",
1442
1444
  fix: "Split the changes into several proposals."
1443
1445
  }
1444
1446
  ]
1445
1447
  };
1446
- const _ = [];
1447
- if (t.forEach((f, o) => {
1448
- const l = ia.safeParse(f);
1449
- if (l.success) {
1450
- _.push(l.data);
1448
+ const m = [];
1449
+ if (t.forEach((I, l) => {
1450
+ const h = Aa.safeParse(I);
1451
+ if (h.success) {
1452
+ m.push(h.data);
1451
1453
  return;
1452
1454
  }
1453
- for (const h of l.error.issues)
1454
- s.push({
1455
+ for (const y of h.error.issues)
1456
+ o.push({
1455
1457
  code: "invalid_change",
1456
- message: h.message,
1457
- path: Et(`changes[${o}]`, h),
1458
+ message: y.message,
1459
+ path: aa(`changes[${l}]`, y),
1458
1460
  fix: "Send the change in the shape the tool schema gives."
1459
1461
  });
1460
- }), s.length) return { ok: !1, problems: s };
1461
- const g = (f) => {
1462
- throw s.push(f), new ue();
1463
- }, A = (f) => {
1464
- a.capabilities.sql || g({
1462
+ }), o.length) return { ok: !1, problems: o };
1463
+ const f = (I) => {
1464
+ throw o.push(I), new Ie();
1465
+ }, S = (I) => {
1466
+ a.capabilities.sql || f({
1465
1467
  code: "capability_required",
1466
1468
  message: "This change creates, reads or changes a SQL card, which needs SQL access.",
1467
- path: f,
1469
+ path: I,
1468
1470
  fix: "Use a measures or records query, or ask an administrator for SQL access."
1469
- }), d.add("sql");
1470
- }, c = (f, o) => {
1471
- const l = nt(p, [f], y);
1472
- l.ok ? (p = l.dashboard, n.push(f)) : g({ code: "invalid_change", message: l.failedAt.message, path: o, ...l.failedAt.fix ? { fix: l.failedAt.fix } : {} });
1473
- }, m = (f, o) => {
1474
- if (f.startsWith("$")) {
1475
- const l = b.get(f);
1476
- return (!l || l.kind !== "card") && g({
1471
+ }), i.add("sql");
1472
+ }, u = (I, l) => {
1473
+ const h = St(b, [I], p);
1474
+ h.ok ? (b = h.dashboard, r.push(I)) : f({ code: "invalid_change", message: h.failedAt.message, path: l, ...h.failedAt.fix ? { fix: h.failedAt.fix } : {} });
1475
+ }, g = (I, l) => {
1476
+ if (I.startsWith("$")) {
1477
+ const h = c.get(I);
1478
+ return (!h || h.kind !== "card") && f({
1477
1479
  code: "handle_unknown",
1478
- message: `${f} isn't a card handle defined earlier in this list.`,
1479
- path: o,
1480
+ message: `${I} isn't a card handle defined earlier in this list.`,
1481
+ path: l,
1480
1482
  fix: "Define the handle with an earlier card.add, or use the card id from the outline."
1481
- }), l.id;
1483
+ }), h.id;
1482
1484
  }
1483
- return re(p).some((l) => l.cardId === f) || g({
1485
+ return ie(b).some((h) => h.cardId === I) || f({
1484
1486
  code: "card_not_found",
1485
- message: `There's no card ${f} on this dashboard.`,
1486
- path: o,
1487
+ message: `There's no card ${I} on this dashboard.`,
1488
+ path: l,
1487
1489
  fix: "Read the outline again and use its card ids."
1488
- }), f;
1489
- }, F = (f, o) => {
1490
- if (f.startsWith("$")) {
1491
- const h = b.get(f);
1492
- return (!h || h.kind !== "filter") && g({
1490
+ }), I;
1491
+ }, F = (I, l) => {
1492
+ if (I.startsWith("$")) {
1493
+ const y = c.get(I);
1494
+ return (!y || y.kind !== "filter") && f({
1493
1495
  code: "handle_unknown",
1494
- message: `${f} isn't a filter handle defined earlier in this list.`,
1495
- path: o,
1496
+ message: `${I} isn't a filter handle defined earlier in this list.`,
1497
+ path: l,
1496
1498
  fix: "Define the handle with an earlier filter.add, or use the filter id from the outline."
1497
- }), h.id;
1499
+ }), y.id;
1498
1500
  }
1499
- return (Array.isArray(p.inputs) ? p.inputs : []).some((h) => h.id === f && h.kind === "filter") || g({
1501
+ return (Array.isArray(b.inputs) ? b.inputs : []).some((y) => y.id === I && y.kind === "filter") || f({
1500
1502
  code: "filter_not_found",
1501
- message: `There's no filter ${f} on this dashboard.`,
1502
- path: o,
1503
+ message: `There's no filter ${I} on this dashboard.`,
1504
+ path: l,
1503
1505
  fix: "Read the outline again and use its filter ids."
1504
- }), f;
1505
- }, k = () => (p.sheets ?? []).filter((f) => !ct(f)), T = () => k().map((f) => ({ sheetId: f.id, title: f.title ?? "" })), N = (f, o) => {
1506
- const l = (p.sheets ?? []).find((h) => h.id === f);
1507
- return l || g({ code: "sheet_not_found", message: `There's no sheet ${f} on this dashboard.`, path: o, fix: "Read the outline again and use its sheet ids.", details: { sheets: T() } }), ct(l) && g({ code: "sheet_not_a_grid", message: `"${l.title}" is a Document sheet.`, path: o, fix: "Add the card to a grid sheet; Document sheets are changed in the editor.", details: { sheets: T() } }), l;
1508
- }, R = (f, o, l, h) => {
1509
- var D;
1510
- for (const w of ga(o, l)) g({ ...w, path: `${h}.${w.path}` });
1511
- const I = ce[f], v = xe(o), S = o.dateField;
1512
- if (S && typeof S != "string" && S.label && !o.timeGrain && g({
1506
+ }), I;
1507
+ }, $ = () => (b.sheets ?? []).filter((I) => !Tt(I)), x = () => $().map((I) => ({ sheetId: I.id, title: I.title ?? "" })), N = (I, l) => {
1508
+ const h = (b.sheets ?? []).find((y) => y.id === I);
1509
+ return h || f({ code: "sheet_not_found", message: `There's no sheet ${I} on this dashboard.`, path: l, fix: "Read the outline again and use its sheet ids.", details: { sheets: x() } }), Tt(h) && f({ code: "sheet_not_a_grid", message: `"${h.title}" is a Document sheet.`, path: l, fix: "Add the card to a grid sheet; Document sheets are changed in the editor.", details: { sheets: x() } }), h;
1510
+ }, k = (I, l, h, y) => {
1511
+ var R;
1512
+ for (const D of Ka(l, h)) f({ ...D, path: `${y}.${D.path}` });
1513
+ const C = ye[I], T = Ne(l), w = l.dateField;
1514
+ if (w && typeof w != "string" && w.label && !l.timeGrain && f({
1513
1515
  code: "invalid_change",
1514
1516
  message: "A label names a column, and the date field is a column only when the card groups by it.",
1515
- path: `${h}.query.dateField.label`,
1517
+ path: `${y}.query.dateField.label`,
1516
1518
  fix: "Send timeGrain to group by the date, or leave the label out."
1517
- }), !I.forms.includes(v)) {
1518
- const w = Object.keys(ce).filter((x) => ce[x].forms.includes(v));
1519
- g({
1519
+ }), !C.forms.includes(T)) {
1520
+ const D = Object.keys(ye).filter((A) => ye[A].forms.includes(T));
1521
+ f({
1520
1522
  code: "type_not_supported",
1521
- message: `A ${f.replace(/_/g, " ")} card takes ${I.forms.map((x) => Se[x]).join(" or ")}, not ${Se[v]}.`,
1522
- path: `${h}.query`,
1523
- fix: `Send ${I.forms.map((x) => Se[x]).join(" or ")}, or use a type this query fits: ${w.join(", ")}.`
1523
+ message: `A ${I.replace(/_/g, " ")} card takes ${C.forms.map((A) => Ae[A]).join(" or ")}, not ${Ae[T]}.`,
1524
+ path: `${y}.query`,
1525
+ fix: `Send ${C.forms.map((A) => Ae[A]).join(" or ")}, or use a type this query fits: ${D.join(", ")}.`
1524
1526
  });
1525
1527
  }
1526
- if (v === "measures") {
1527
- const w = o, x = w.measures.length;
1528
- I.measures && (x < I.measures.min || I.measures.max !== void 0 && x > I.measures.max) && g({
1528
+ if (T === "measures") {
1529
+ const D = l, A = D.measures.length;
1530
+ C.measures && (A < C.measures.min || C.measures.max !== void 0 && A > C.measures.max) && f({
1529
1531
  code: "type_not_supported",
1530
- message: `A ${f.replace(/_/g, " ")} card shows exactly ${I.measures.max} measure.`,
1531
- path: `${h}.query.measures`,
1532
+ message: `A ${I.replace(/_/g, " ")} card shows exactly ${C.measures.max} measure.`,
1533
+ path: `${y}.query.measures`,
1532
1534
  fix: "Send one measure, or use a table or chart for several."
1533
- }), !I.dimensions && ((D = w.dimensions) != null && D.length) && g({
1535
+ }), !C.dimensions && ((R = D.dimensions) != null && R.length) && f({
1534
1536
  code: "type_not_supported",
1535
- message: `A ${f.replace(/_/g, " ")} card shows one number, so it has no dimensions.`,
1536
- path: `${h}.query.dimensions`,
1537
+ message: `A ${I.replace(/_/g, " ")} card shows one number, so it has no dimensions.`,
1538
+ path: `${y}.query.dimensions`,
1537
1539
  fix: "Remove the dimensions, or use a table or chart."
1538
- }), f === "matrix" && (w.orderBy || w.limit) && g({
1540
+ }), I === "matrix" && (D.orderBy || D.limit) && f({
1539
1541
  code: "type_not_supported",
1540
1542
  message: "A Matrix's sorting and top N are set in the editor.",
1541
- path: `${h}.query`,
1543
+ path: `${y}.query`,
1542
1544
  fix: "Leave out orderBy and limit for a Matrix."
1543
1545
  });
1544
1546
  }
1545
- if (I.matrixColumns && !l && g({
1547
+ if (C.matrixColumns && !h && f({
1546
1548
  code: "type_not_supported",
1547
1549
  message: "A Matrix needs matrix.columns: the query fields that run across the top.",
1548
- path: `${h}.matrix`,
1550
+ path: `${y}.matrix`,
1549
1551
  fix: "Send matrix: { columns: [...] } naming dimensions or the date field of the query (an empty list puts nothing across the top)."
1550
- }), !I.matrixColumns && l && g({ code: "type_not_supported", message: "matrix.columns is only for Matrix cards.", path: `${h}.matrix`, fix: 'Leave out matrix, or use type "matrix".' }), l && v === "measures") {
1551
- const w = o, x = w.datasetName, G = [...w.dimensions ?? [], ...w.timeGrain && w.dateField ? [w.dateField] : []];
1552
- G.length && l.columns.length >= G.length && G.every((P) => l.columns.some((B) => ne(B, x) === ne(P, x))) && g({
1552
+ }), !C.matrixColumns && h && f({ code: "type_not_supported", message: "matrix.columns is only for Matrix cards.", path: `${y}.matrix`, fix: 'Leave out matrix, or use type "matrix".' }), h && T === "measures") {
1553
+ const D = l, A = D.datasetName, j = [...D.dimensions ?? [], ...D.timeGrain && D.dateField ? [D.dateField] : []];
1554
+ j.length && h.columns.length >= j.length && j.every((q) => h.columns.some((B) => fe(B, A) === fe(q, A))) && f({
1553
1555
  code: "type_not_supported",
1554
1556
  message: "A Matrix needs at least one field down the side.",
1555
- path: `${h}.matrix.columns`,
1557
+ path: `${y}.matrix.columns`,
1556
1558
  fix: "Leave one dimension or the date field out of matrix.columns."
1557
1559
  });
1558
- const Q = new Set([...w.dimensions ?? [], ...w.dateField ? [w.dateField] : []].map((P) => ne(P, x)));
1559
- l.columns.forEach((P, B) => {
1560
- Q.has(ne(P, x)) || g({
1560
+ const Y = new Set([...D.dimensions ?? [], ...D.dateField ? [D.dateField] : []].map((q) => fe(q, A)));
1561
+ h.columns.forEach((q, B) => {
1562
+ Y.has(fe(q, A)) || f({
1561
1563
  code: "type_not_supported",
1562
- message: `"${ut(P)}" isn't one of the query's dimensions or its date field.`,
1563
- path: `${h}.matrix.columns[${B}]`,
1564
+ message: `"${kt(q)}" isn't one of the query's dimensions or its date field.`,
1565
+ path: `${y}.matrix.columns[${B}]`,
1564
1566
  fix: "Name dimensions or the date field of the query in matrix.columns."
1565
1567
  });
1566
1568
  });
1567
1569
  }
1568
- }, O = (f, o) => g({
1569
- code: f.code === "query_not_kept" ? "card_not_editable" : "invalid_change",
1570
- message: f.message,
1571
- path: `${o}.query`,
1572
- fix: f.code === "query_not_kept" ? "Tell the user to make this change in the editor." : "Read the outline again and propose again.",
1573
- details: { reason: "not_expressible", ..."parts" in f ? { parts: f.parts } : {} }
1574
- }), E = (f, o, l, h, I, v, S) => {
1575
- const D = Rs(f, o, l, v, S);
1576
- D.length && g({
1570
+ }, O = (I, l) => f({
1571
+ code: I.code === "query_not_kept" ? "card_not_editable" : "invalid_change",
1572
+ message: I.message,
1573
+ path: `${l}.query`,
1574
+ fix: I.code === "query_not_kept" ? "Tell the user to make this change in the editor." : "Read the outline again and propose again.",
1575
+ details: { reason: "not_expressible", ..."parts" in I ? { parts: I.parts } : {} }
1576
+ }), E = (I, l, h, y, C, T, w) => {
1577
+ const R = wn(I, l, h, T, w);
1578
+ R.length && f({
1577
1579
  code: "card_not_editable",
1578
- message: `As changed, "${I}" wouldn't run the query asked for, so make this change in the editor.`,
1579
- path: `${h}.query`,
1580
+ message: `As changed, "${C}" wouldn't run the query asked for, so make this change in the editor.`,
1581
+ path: `${y}.query`,
1580
1582
  fix: "Tell the user to make this change in the editor.",
1581
- details: { reason: "not_expressible", detail: `doesn't hold: ${D.join(", ")}` }
1583
+ details: { reason: "not_expressible", detail: `doesn't hold: ${R.join(", ")}` }
1582
1584
  });
1583
- }, V = async (f, o, l, h) => {
1584
- const I = rt(f);
1585
- if ("sql" in o)
1586
- return A(`${h}.query`), { type: I, source: { kind: "sql", connectionId: o.connectionId, sql: o.sql } };
1587
- const v = I === "matrixTable" || I === "detailTable" ? "table" : I, S = await a.compileCardQuery({ query: o, chartType: v });
1588
- if (!S.ok)
1589
- throw s.push(...S.problems.map((x) => ({ ...x, path: x.path ? `${h}.query.${x.path}` : `${h}.query` }))), new ue();
1590
- r.push(...S.warnings.map((x) => ({ ...x, path: x.path ?? `${h}.query` })));
1591
- let D = { ...S.part, type: I };
1592
- const w = D.config ?? {};
1593
- if (I === "detailTable") {
1594
- const x = ba(Ia("table", "detailTable", w)) ?? {};
1595
- D = { ...D, config: Os(x) };
1585
+ }, V = async (I, l, h, y) => {
1586
+ const C = wt(I);
1587
+ if ("sql" in l)
1588
+ return S(`${y}.query`), { type: C, source: { kind: "sql", connectionId: l.connectionId, sql: l.sql } };
1589
+ const T = C === "matrixTable" || C === "detailTable" ? "table" : C, w = await a.compileCardQuery({ query: l, chartType: T });
1590
+ if (!w.ok)
1591
+ throw o.push(...w.problems.map((A) => ({ ...A, path: A.path ? `${y}.query.${A.path}` : `${y}.query` }))), new Ie();
1592
+ n.push(...w.warnings.map((A) => ({ ...A, path: A.path ?? `${y}.query` })));
1593
+ let R = { ...w.part, type: C };
1594
+ const D = R.config ?? {};
1595
+ if (C === "detailTable") {
1596
+ const A = Ua(Ga("table", "detailTable", D)) ?? {};
1597
+ R = { ...R, config: xn(A) };
1596
1598
  }
1597
- return I === "matrixTable" && (D = await K(D, w, o, l, h)), Ns(D, Ee(o));
1598
- }, K = async (f, o, l, h, I) => {
1599
- var Q;
1600
- const v = await a.loadCardSource({ domainId: l.domainId, datasetName: l.datasetName });
1601
- if (v || g({ code: "field_not_found", message: `The dataset "${l.datasetName}" isn't available.`, path: `${I}.query.datasetName`, fix: "Find datasets with semaphor_list_datasets." }), f.source.kind !== "semantic") throw new ue();
1602
- const S = { id: "scratch", title: "", type: "table", dataSource: f.source.dataSource, config: o }, D = Ca(S, "matrixTable", { catalog: v.fields, createId: a.newId }), w = D.status === "changed" ? (Q = D.card.config) == null ? void 0 : Q.matrix : void 0;
1603
- (D.status !== "changed" || D.leftOut.length || !w) && g({
1599
+ return C === "matrixTable" && (R = await W(R, D, l, h, y)), Tn(R, ze(l));
1600
+ }, W = async (I, l, h, y, C) => {
1601
+ var Y;
1602
+ const T = await a.loadCardSource({ domainId: h.domainId, datasetName: h.datasetName });
1603
+ if (T || f({ code: "field_not_found", message: `The dataset "${h.datasetName}" isn't available.`, path: `${C}.query.datasetName`, fix: "Find datasets with semaphor_list_datasets." }), I.source.kind !== "semantic") throw new Ie();
1604
+ const w = { id: "scratch", title: "", type: "table", dataSource: I.source.dataSource, config: l }, R = Ha(w, "matrixTable", { catalog: T.fields, createId: a.newId }), D = R.status === "changed" ? (Y = R.card.config) == null ? void 0 : Y.matrix : void 0;
1605
+ (R.status !== "changed" || R.leftOut.length || !D) && f({
1604
1606
  code: "type_not_supported",
1605
- message: D.status === "changed" && D.leftOut.length ? `These fields can't run in a Matrix: ${D.leftOut.join(", ")}.` : "This query can't be shown as a Matrix.",
1606
- path: `${I}.query`,
1607
+ message: R.status === "changed" && R.leftOut.length ? `These fields can't run in a Matrix: ${R.leftOut.join(", ")}.` : "This query can't be shown as a Matrix.",
1608
+ path: `${C}.query`,
1607
1609
  fix: "Use plain dataset fields for a Matrix, or use a table."
1608
1610
  });
1609
- let x = w;
1610
- const G = l.datasetName;
1611
- for (const [P, B] of h.columns.entries()) {
1612
- const U = [...x.spec.rows, ...x.spec.columns].find(
1613
- (z) => Sa(z.field) === ne(B, G)
1611
+ let A = D;
1612
+ const j = h.datasetName;
1613
+ for (const [q, B] of y.columns.entries()) {
1614
+ const K = [...A.spec.rows, ...A.spec.columns].find(
1615
+ (z) => Ya(z.field) === fe(B, j)
1614
1616
  );
1615
- U || g({ code: "type_not_supported", message: `"${ut(B)}" isn't a level of this Matrix.`, path: `${I}.matrix.columns[${P}]`, fix: "Name dimensions or the date field of the query in matrix.columns." }), x = va(x, wa(x.spec, U.id, "columns")).config;
1617
+ K || f({ code: "type_not_supported", message: `"${kt(B)}" isn't a level of this Matrix.`, path: `${C}.matrix.columns[${q}]`, fix: "Name dimensions or the date field of the query in matrix.columns." }), A = Wa(A, Ja(A.spec, K.id, "columns")).config;
1616
1618
  }
1617
- return { ...f, config: { matrix: x } };
1618
- }, L = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map();
1619
- for (const [f, o] of _.entries()) {
1620
- const l = `changes[${f}]`;
1619
+ return { ...I, config: { matrix: A } };
1620
+ }, L = /* @__PURE__ */ new Map(), P = /* @__PURE__ */ new Map();
1621
+ for (const [I, l] of m.entries()) {
1622
+ const h = `changes[${I}]`;
1621
1623
  try {
1622
- switch (o.op) {
1624
+ switch (l.op) {
1623
1625
  case "card.add": {
1624
- const h = o.position && typeof o.position == "object" ? (() => {
1625
- const B = m(o.position.after, `${l}.position.after`), U = re(p).find(
1626
+ const y = l.position && typeof l.position == "object" ? (() => {
1627
+ const B = g(l.position.after, `${h}.position.after`), K = ie(b).find(
1626
1628
  (z) => z.cardId === B && z.kind === "frameCard"
1627
1629
  );
1628
- return !U || U.kind !== "frameCard" ? g({
1630
+ return !K || K.kind !== "frameCard" ? f({
1629
1631
  code: "card_not_found",
1630
- message: `${o.position.after} isn't a card on a grid sheet.`,
1631
- path: `${l}.position.after`,
1632
+ message: `${l.position.after} isn't a card on a grid sheet.`,
1633
+ path: `${h}.position.after`,
1632
1634
  fix: "Use a cardId from semaphor_get_dashboard_details on the same sheet, or a handle from this proposal."
1633
- }) : (o.sheetId && o.sheetId !== U.sheetId && g({
1635
+ }) : (l.sheetId && l.sheetId !== K.sheetId && f({
1634
1636
  code: "invalid_change",
1635
- message: `position.after names a card on another sheet than ${o.sheetId}.`,
1636
- path: `${l}.position.after`,
1637
+ message: `position.after names a card on another sheet than ${l.sheetId}.`,
1638
+ path: `${h}.position.after`,
1637
1639
  fix: "Leave out sheetId, or name the card's sheet."
1638
- }), { sheetId: U.sheetId, frameId: U.frameId });
1639
- })() : void 0, I = h ? N(h.sheetId, `${l}.position.after`) : o.sheetId ? N(o.sheetId, `${l}.sheetId`) : (() => {
1640
- const B = k();
1641
- return B.length !== 1 && g({
1640
+ }), { sheetId: K.sheetId, frameId: K.frameId });
1641
+ })() : void 0, C = y ? N(y.sheetId, `${h}.position.after`) : l.sheetId ? N(l.sheetId, `${h}.sheetId`) : (() => {
1642
+ const B = $();
1643
+ return B.length !== 1 && f({
1642
1644
  code: B.length ? "sheet_required" : "sheet_not_a_grid",
1643
1645
  message: B.length ? "This dashboard has several grid sheets; say which one gets the card." : "This dashboard has no grid sheet to add a card to.",
1644
- path: `${l}.sheetId`,
1646
+ path: `${h}.sheetId`,
1645
1647
  fix: B.length ? "Send sheetId: one of details.sheets." : "Add a grid sheet in the editor first.",
1646
- details: { sheets: T() }
1648
+ details: { sheets: x() }
1647
1649
  }), B[0];
1648
1650
  })();
1649
- R(o.type, o.query, o.matrix, l);
1650
- const v = await V(o.type, o.query, o.matrix, l), S = {
1651
- ...Pt({ id: a.newId(), title: o.title, ...o.description ? { description: o.description } : {} }),
1652
- type: v.type
1653
- }, D = lt(S, v);
1654
- D.ok || g({ code: "invalid_change", message: D.message, path: l });
1655
- const w = D.ok ? D.card : S;
1656
- E(w, o.query, o.matrix, l, o.title, v);
1657
- const x = { id: a.newId(), cards: [w], activeCardId: w.id }, G = h ? { after: h.frameId } : typeof o.position == "string" ? o.position : void 0, Q = G || o.width ? { ...G ? { position: G } : {}, ...o.width ? { width: o.width } : {} } : void 0;
1658
- c({ op: "card.add", sheetId: I.id, frame: x, ...Q ? { placement: Q } : {}, changeIndex: f }, l);
1659
- const P = o.handle ?? `$card_${++$}`;
1660
- b.has(P) && g({ code: "invalid_change", message: `The handle ${P} is defined twice.`, path: `${l}.handle`, fix: "Give each new card or filter its own handle." }), b.set(P, { kind: "card", id: w.id, title: o.title }), i.push({ ref: P, kind: "card", id: w.id, title: o.title, changeIndex: f }), u.push(w.id);
1651
+ k(l.type, l.query, l.matrix, h);
1652
+ const T = await V(l.type, l.query, l.matrix, h), w = {
1653
+ ...la({ id: a.newId(), title: l.title, ...l.description ? { description: l.description } : {} }),
1654
+ type: T.type
1655
+ }, R = xt(w, T);
1656
+ R.ok || f({ code: "invalid_change", message: R.message, path: h });
1657
+ const D = R.ok ? R.card : w;
1658
+ E(D, l.query, l.matrix, h, l.title, T);
1659
+ const A = { id: a.newId(), cards: [D], activeCardId: D.id }, j = y ? { after: y.frameId } : typeof l.position == "string" ? l.position : void 0, Y = j || l.width ? { ...j ? { position: j } : {}, ...l.width ? { width: l.width } : {} } : void 0;
1660
+ u({ op: "card.add", sheetId: C.id, frame: A, ...Y ? { placement: Y } : {}, changeIndex: I }, h);
1661
+ const q = l.handle ?? `$card_${++v}`;
1662
+ c.has(q) && f({ code: "invalid_change", message: `The handle ${q} is defined twice.`, path: `${h}.handle`, fix: "Give each new card or filter its own handle." }), c.set(q, { kind: "card", id: D.id, title: l.title }), s.push({ ref: q, kind: "card", id: D.id, title: l.title, changeIndex: I }), d.push(D.id);
1661
1663
  break;
1662
1664
  }
1663
1665
  case "card.update": {
1664
- const h = m(o.cardId, `${l}.cardId`), I = ie(p, h);
1665
- I || g({ code: "card_not_editable", message: "Cards in Document sections are changed in the editor.", path: `${l}.cardId`, fix: "Tell the user to change it in the editor.", details: { reason: "document_section" } });
1666
- const v = I.card, S = oe(v, { sql: !0 });
1667
- ((Qe = S.source) == null ? void 0 : Qe.kind) === "sql" && A(`${l}.cardId`), S.editable || g({
1666
+ const y = g(l.cardId, `${h}.cardId`), C = ue(b, y);
1667
+ C || f({ code: "card_not_editable", message: "Cards in Document sections are changed in the editor.", path: `${h}.cardId`, fix: "Tell the user to change it in the editor.", details: { reason: "document_section" } });
1668
+ const T = C.card, w = me(T, { sql: !0 });
1669
+ ((lt = w.source) == null ? void 0 : lt.kind) === "sql" && S(`${h}.cardId`), w.editable || f({
1668
1670
  code: "card_not_editable",
1669
- message: S.message,
1670
- path: `${l}.cardId`,
1671
- fix: S.reason === "needs_sql_access" ? "Ask for SQL access." : "Tell the user to change it in the editor.",
1672
- details: { reason: S.reason, ...S.detail ? { detail: S.detail } : {} }
1673
- }), I.frame.visualId && r.push({
1671
+ message: w.message,
1672
+ path: `${h}.cardId`,
1673
+ fix: w.reason === "needs_sql_access" ? "Ask for SQL access." : "Tell the user to change it in the editor.",
1674
+ details: { reason: w.reason, ...w.detail ? { detail: w.detail } : {} }
1675
+ }), C.frame.visualId && n.push({
1674
1676
  code: "detaches_linked_visual",
1675
- message: `"${v.title}" will stop following its library visual and become local to this dashboard.`,
1676
- path: l,
1677
- details: { cardIds: [h] }
1677
+ message: `"${T.title}" will stop following its library visual and become local to this dashboard.`,
1678
+ path: h,
1679
+ details: { cardIds: [y] }
1678
1680
  });
1679
- let D = !1;
1680
- const w = o.type ? rt(o.type) : void 0;
1681
- if (w && w !== v.type) {
1682
- const x = S.editable ? S.source : void 0, G = oa(v, w), Q = G && x && x.kind === "semantic" ? (Ke = await a.loadCardSource({ domainId: x.domainId, datasetName: x.datasetName })) == null ? void 0 : Ke.fields : void 0, P = [], B = ra(v, w, {
1683
- ...Q ? { catalog: Q } : {},
1684
- ...G && !Q ? { catalogLoading: !0 } : {},
1681
+ let R = !1;
1682
+ const D = l.type ? wt(l.type) : void 0;
1683
+ if (D && D !== T.type) {
1684
+ const A = w.editable ? w.source : void 0, j = Oa(T, D), Y = j && A && A.kind === "semantic" ? (ut = await a.loadCardSource({ domainId: A.domainId, datasetName: A.datasetName })) == null ? void 0 : ut.fields : void 0, q = [], B = Ea(T, D, {
1685
+ ...Y ? { catalog: Y } : {},
1686
+ ...j && !Y ? { catalogLoading: !0 } : {},
1685
1687
  createId: () => {
1686
- const U = a.newId();
1687
- return P.push(U), U;
1688
+ const K = a.newId();
1689
+ return q.push(K), K;
1688
1690
  }
1689
1691
  });
1690
- if (B.status === "refused" && g({ code: "type_not_supported", message: "The card's dataset fields couldn't be loaded for a change to or from a Matrix.", path: `${l}.type`, fix: "Send a complete query with the type change." }), B.status === "changed") {
1691
- const U = [...B.leftOut, ...B.droppedPreferences];
1692
- U.length && r.push({
1692
+ if (B.status === "refused" && f({ code: "type_not_supported", message: "The card's dataset fields couldn't be loaded for a change to or from a Matrix.", path: `${h}.type`, fix: "Send a complete query with the type change." }), B.status === "changed") {
1693
+ const K = [...B.leftOut, ...B.droppedPreferences];
1694
+ K.length && n.push({
1693
1695
  code: "type_change_drops",
1694
- message: `Changing "${v.title}" to ${o.type.replace(/_/g, " ")} leaves out ${U.join(", ")}.`,
1695
- path: `${l}.type`,
1696
- details: { dropped: U }
1697
- }), c(
1698
- { op: "card.update", cardId: h, update: { kind: "retype", type: w, ...Q ? { catalog: Q } : {}, newIds: P }, changeIndex: f },
1699
- `${l}.type`
1700
- ), D = !0;
1696
+ message: `Changing "${T.title}" to ${l.type.replace(/_/g, " ")} leaves out ${K.join(", ")}.`,
1697
+ path: `${h}.type`,
1698
+ details: { dropped: K }
1699
+ }), u(
1700
+ { op: "card.update", cardId: y, update: { kind: "retype", type: D, ...Y ? { catalog: Y } : {}, newIds: q }, changeIndex: I },
1701
+ `${h}.type`
1702
+ ), R = !0;
1701
1703
  }
1702
1704
  }
1703
- if (o.query || o.matrix) {
1704
- const x = ie(p, h).card, G = oe(x, { sql: !0 }), Q = G.editable ? G.query : void 0, P = Ms(Q, o.query ?? {}, `${l}.query`, g), B = Oe(x.type), U = o.matrix ?? (G.editable ? G.matrix : void 0);
1705
- R(B, P, U, l);
1706
- const z = G.editable ? da(G.query, P, G.matrix, U) : void 0, tt = !z || z.aspects.length > 0, le = z && !("sql" in P) ? Ee(P).filter((X) => !dt(z, X.key.role)) : [], at = la(x, z, le.map((X) => X.key.role));
1707
- at && O(at, l);
1708
- let De = P;
1709
- if (z && !("sql" in P) && P.orderBy && !z.aspects.includes("order") && ["metric", "group_by", "detail"].some((X) => dt(z, X))) {
1710
- const { orderBy: X, ...be } = P;
1711
- De = be;
1705
+ if (l.query || l.matrix) {
1706
+ const A = ue(b, y).card, j = me(A, { sql: !0 }), Y = j.editable ? j.query : void 0, q = An(Y, l.query ?? {}, `${h}.query`, f), B = Qe(A.type), K = l.matrix ?? (j.editable ? j.matrix : void 0);
1707
+ k(B, q, K, h);
1708
+ const z = j.editable ? Na(j.query, q, j.matrix, K) : void 0, It = !z || z.aspects.length > 0, be = z && !("sql" in q) ? ze(q).filter((te) => !Ft(z, te.key.role)) : [], _t = Pa(A, z, be.map((te) => te.key.role));
1709
+ _t && O(_t, h);
1710
+ let Le = q;
1711
+ if (z && !("sql" in q) && q.orderBy && !z.aspects.includes("order") && ["metric", "group_by", "detail"].some((te) => Ft(z, te))) {
1712
+ const { orderBy: te, ...Fe } = q;
1713
+ Le = Fe;
1712
1714
  }
1713
- let st;
1714
- if (tt) {
1715
- const X = await V(B, De, U, l);
1716
- st = X;
1717
- const be = z ? { ...X, change: z } : X, ee = lt(x, be);
1718
- if (ee.ok || O(ee, l), ee.ok && ee.droppedBindings.length && r.push({
1715
+ let Ct;
1716
+ if (It) {
1717
+ const te = await V(B, Le, K, h);
1718
+ Ct = te;
1719
+ const Fe = z ? { ...te, change: z } : te, se = xt(A, Fe);
1720
+ if (se.ok || O(se, h), se.ok && se.droppedBindings.length && n.push({
1719
1721
  code: "control_binding_dropped",
1720
- message: `"${x.title}" loses the controls bound to the levels or measures this change removes; they stop changing this card.`,
1721
- path: `${l}.query`,
1722
+ message: `"${A.title}" loses the controls bound to the levels or measures this change removes; they stop changing this card.`,
1723
+ path: `${h}.query`,
1722
1724
  fix: "Keep those fields in the query, or tell the user the controls no longer apply to this card.",
1723
- details: { controlIds: ee.droppedBindings }
1724
- }), ee.ok)
1725
- for (const Ie of ee.keptLabels)
1726
- r.push({
1725
+ details: { controlIds: se.droppedBindings }
1726
+ }), se.ok)
1727
+ for (const xe of se.keptLabels)
1728
+ n.push({
1727
1729
  code: "label_kept_after_change",
1728
- message: `"${x.title}" keeps the label "${Ie.label}" on ${Ie.field}, whose aggregate or time grain changed.`,
1729
- path: `${l}.query`,
1730
+ message: `"${A.title}" keeps the label "${xe.label}" on ${xe.field}, whose aggregate or time grain changed.`,
1731
+ path: `${h}.query`,
1730
1732
  fix: "State a new label on the field ref if the old one no longer fits.",
1731
- details: { columns: [{ label: Ie.label, field: Ie.field }] }
1733
+ details: { columns: [{ label: xe.label, field: xe.field }] }
1732
1734
  });
1733
- c({ op: "card.update", cardId: h, update: { kind: "requery", query: be }, changeIndex: f }, `${l}.query`), D = !0;
1735
+ u({ op: "card.update", cardId: y, update: { kind: "requery", query: Fe }, changeIndex: I }, `${h}.query`), R = !0;
1734
1736
  }
1735
- le.length && ca(ie(p, h).card, le).changed.length && c({ op: "card.update", cardId: h, update: { kind: "relabel", labels: le }, changeIndex: f }, `${l}.query`), (tt || le.length) && E(ie(p, h).card, De, U, l, x.title ?? "", st, z);
1737
+ be.length && qa(ue(b, y).card, be).changed.length && u({ op: "card.update", cardId: y, update: { kind: "relabel", labels: be }, changeIndex: I }, `${h}.query`), (It || be.length) && E(ue(b, y).card, Le, K, h, A.title ?? "", Ct, z);
1736
1738
  }
1737
- (o.title !== void 0 || o.description !== void 0) && c(
1739
+ (l.title !== void 0 || l.description !== void 0) && u(
1738
1740
  {
1739
1741
  op: "card.update",
1740
- cardId: h,
1742
+ cardId: y,
1741
1743
  update: {
1742
1744
  kind: "rename",
1743
- ...o.title !== void 0 ? { title: o.title } : {},
1744
- ...o.description !== void 0 ? { description: o.description } : {}
1745
+ ...l.title !== void 0 ? { title: l.title } : {},
1746
+ ...l.description !== void 0 ? { description: l.description } : {}
1745
1747
  },
1746
- changeIndex: f
1748
+ changeIndex: I
1747
1749
  },
1748
- l
1749
- ), D && !u.includes(h) && u.push(h), i.push({ ref: o.cardId, kind: "card", id: h, title: v.title ?? "", changeIndex: f });
1750
+ h
1751
+ ), R && !d.includes(y) && d.push(y), s.push({ ref: l.cardId, kind: "card", id: y, title: T.title ?? "", changeIndex: I });
1750
1752
  break;
1751
1753
  }
1752
1754
  case "card.remove": {
1753
- const h = m(o.cardId, `${l}.cardId`), I = ie(p, h);
1754
- I || g({ code: "card_not_editable", message: "Cards in Document sections are removed in the editor.", path: `${l}.cardId`, fix: "Tell the user to remove it in the editor.", details: { reason: "document_section" } }), I.frame.cards.some((S) => {
1755
- var D, w;
1756
- return ((D = S.customCardPreferences) == null ? void 0 : D.visualType) === "multiple" || !!((w = S.customCardPreferences) != null && w.dataInputCardIds);
1757
- }) && I.frame.cards.length > 1 && g({ code: "card_not_editable", message: "This card is an input of a custom visual; remove it in the editor.", path: `${l}.cardId`, fix: "Tell the user to remove it in the editor.", details: { reason: "custom" } }), I.frame.visualId && I.frame.cards.length > 1 && r.push({
1755
+ const y = g(l.cardId, `${h}.cardId`), C = ue(b, y);
1756
+ C || f({ code: "card_not_editable", message: "Cards in Document sections are removed in the editor.", path: `${h}.cardId`, fix: "Tell the user to remove it in the editor.", details: { reason: "document_section" } }), C.frame.cards.some((w) => {
1757
+ var R, D;
1758
+ return ((R = w.customCardPreferences) == null ? void 0 : R.visualType) === "multiple" || !!((D = w.customCardPreferences) != null && D.dataInputCardIds);
1759
+ }) && C.frame.cards.length > 1 && f({ code: "card_not_editable", message: "This card is an input of a custom visual; remove it in the editor.", path: `${h}.cardId`, fix: "Tell the user to remove it in the editor.", details: { reason: "custom" } }), C.frame.visualId && C.frame.cards.length > 1 && n.push({
1758
1760
  code: "detaches_linked_visual",
1759
- message: `Removing "${I.card.title}" makes the rest of its tile local to this dashboard; it stops following its library visual.`,
1760
- path: l,
1761
- details: { cardIds: I.frame.cards.filter((S) => S.id !== h).map((S) => S.id) }
1762
- }), c({ op: "card.remove", cardId: h, changeIndex: f }, l), i.push({ ref: o.cardId, kind: "card", id: h, title: I.card.title ?? "", changeIndex: f });
1761
+ message: `Removing "${C.card.title}" makes the rest of its tile local to this dashboard; it stops following its library visual.`,
1762
+ path: h,
1763
+ details: { cardIds: C.frame.cards.filter((w) => w.id !== y).map((w) => w.id) }
1764
+ }), u({ op: "card.remove", cardId: y, changeIndex: I }, h), s.push({ ref: l.cardId, kind: "card", id: y, title: C.card.title ?? "", changeIndex: I });
1763
1765
  break;
1764
1766
  }
1765
1767
  case "filter.add": {
1766
- const h = await a.loadCardSource({ domainId: o.domainId, datasetName: o.datasetName });
1767
- h || g({ code: "field_not_found", message: `The dataset "${o.datasetName}" isn't available in this domain.`, path: `${l}.datasetName`, fix: "Find datasets with semaphor_list_datasets." });
1768
- const I = _t(h.fields, o.field, o.datasetName);
1769
- I || g({
1768
+ const y = await a.loadCardSource({ domainId: l.domainId, datasetName: l.datasetName });
1769
+ y || f({ code: "field_not_found", message: `The dataset "${l.datasetName}" isn't available in this domain.`, path: `${h}.datasetName`, fix: "Find datasets with semaphor_list_datasets." });
1770
+ const C = jt(y.fields, l.field, l.datasetName);
1771
+ C || f({
1770
1772
  code: "field_not_found",
1771
- message: `"${o.field}" isn't a field of ${o.datasetName}.`,
1772
- path: `${l}.field`,
1773
+ message: `"${l.field}" isn't a field of ${l.datasetName}.`,
1774
+ path: `${h}.field`,
1773
1775
  fix: "Use one of details.available, or read semaphor_get_dataset_schema.",
1774
- details: { available: h.fields.slice(0, 20).map((x) => x.name) }
1776
+ details: { available: y.fields.slice(0, 20).map((A) => A.name) }
1775
1777
  });
1776
- const v = gt(o.sheetIds, l, N), S = qt({
1777
- field: I,
1778
- dataSource: h.dataSource,
1779
- connectionId: h.connectionId,
1780
- connectionType: h.connectionType,
1781
- scope: v,
1782
- existingInputs: Array.isArray(p.inputs) ? p.inputs : [],
1778
+ const T = Et(l.sheetIds, h, N), w = ca({
1779
+ field: C,
1780
+ dataSource: y.dataSource,
1781
+ connectionId: y.connectionId,
1782
+ connectionType: y.connectionType,
1783
+ scope: T,
1784
+ existingInputs: Array.isArray(b.inputs) ? b.inputs : [],
1783
1785
  createId: a.newId,
1784
- label: o.label
1785
- }), D = { ...S.filter };
1786
- D.dateSelectionMode || (D.type = o.selection ?? "multiple"), o.defaultValues && (D.defaultValues = o.defaultValues), o.defaultPeriod && (D.defaultDateFilter = bt(o.defaultPeriod, I, `${l}.defaultPeriod`, g)), c({ op: "filter.add", input: { ...S, filter: D }, changeIndex: f }, l), L.set(S.id, { sheetIds: o.sheetIds ?? "all", changeIndex: f }), (o.defaultValues !== void 0 || o.defaultPeriod !== void 0) && q.set(S.id, { values: o.defaultValues, period: o.defaultPeriod, changeIndex: f });
1787
- const w = o.handle;
1788
- w && (b.has(w) && g({ code: "invalid_change", message: `The handle ${w} is defined twice.`, path: `${l}.handle`, fix: "Give each new card or filter its own handle." }), b.set(w, { kind: "filter", id: S.id, title: o.label })), i.push({ ref: w ?? S.id, kind: "filter", id: S.id, title: o.label, changeIndex: f });
1786
+ label: l.label
1787
+ }), R = { ...w.filter };
1788
+ R.dateSelectionMode || (R.type = l.selection ?? "multiple"), l.defaultValues && (R.defaultValues = l.defaultValues), l.defaultPeriod && (R.defaultDateFilter = Nt(l.defaultPeriod, C, `${h}.defaultPeriod`, f)), u({ op: "filter.add", input: { ...w, filter: R }, changeIndex: I }, h), L.set(w.id, { sheetIds: l.sheetIds ?? "all", changeIndex: I }), (l.defaultValues !== void 0 || l.defaultPeriod !== void 0) && P.set(w.id, { values: l.defaultValues, period: l.defaultPeriod, changeIndex: I });
1789
+ const D = l.handle;
1790
+ D && (c.has(D) && f({ code: "invalid_change", message: `The handle ${D} is defined twice.`, path: `${h}.handle`, fix: "Give each new card or filter its own handle." }), c.set(D, { kind: "filter", id: w.id, title: l.label })), s.push({ ref: D ?? w.id, kind: "filter", id: w.id, title: l.label, changeIndex: I });
1789
1791
  break;
1790
1792
  }
1791
1793
  case "filter.update": {
1792
- const h = F(o.filterId, `${l}.filterId`), I = pe(p, h, void 0, C);
1793
- I != null && I.editable || g({
1794
+ const y = F(l.filterId, `${h}.filterId`), C = Se(b, y, void 0, _);
1795
+ C != null && C.editable || f({
1794
1796
  code: "filter_not_editable",
1795
- message: I && !I.editable ? I.notEditable.message : "This filter can't be changed through the MCP.",
1796
- path: `${l}.filterId`,
1797
+ message: C && !C.editable ? C.notEditable.message : "This filter can't be changed through the MCP.",
1798
+ path: `${h}.filterId`,
1797
1799
  fix: "Tell the user to change it in the editor; removing or excluding it works."
1798
1800
  });
1799
- const v = (p.inputs ?? []).find((x) => x.id === h);
1800
- if ((v == null ? void 0 : v.kind) !== "filter" || !v.filter) throw new ue();
1801
- const S = { ...v.filter };
1802
- let D = !1;
1803
- o.selection && (S.type = o.selection), o.defaultValues !== void 0 && (D = !0, o.defaultValues === null ? delete S.defaultValues : S.defaultValues = o.defaultValues), o.defaultPeriod !== void 0 && (D = !0, o.defaultPeriod === null ? delete S.defaultDateFilter : S.defaultDateFilter = bt(
1804
- o.defaultPeriod,
1805
- { dataType: S.dataType },
1806
- `${l}.defaultPeriod`,
1807
- g
1801
+ const T = (b.inputs ?? []).find((A) => A.id === y);
1802
+ if ((T == null ? void 0 : T.kind) !== "filter" || !T.filter) throw new Ie();
1803
+ const w = { ...T.filter };
1804
+ let R = !1;
1805
+ l.selection && (w.type = l.selection), l.defaultValues !== void 0 && (R = !0, l.defaultValues === null ? delete w.defaultValues : w.defaultValues = l.defaultValues), l.defaultPeriod !== void 0 && (R = !0, l.defaultPeriod === null ? delete w.defaultDateFilter : w.defaultDateFilter = Nt(
1806
+ l.defaultPeriod,
1807
+ { dataType: w.dataType },
1808
+ `${h}.defaultPeriod`,
1809
+ f
1808
1810
  ));
1809
- const w = {
1810
- ...o.label !== void 0 ? { label: o.label } : {},
1811
- ...o.selection !== void 0 || D ? { definition: S } : {},
1811
+ const D = {
1812
+ ...l.label !== void 0 ? { label: l.label } : {},
1813
+ ...l.selection !== void 0 || R ? { definition: w } : {},
1812
1814
  // A change of sheets states the sheets; what else the scope says (the cards it leaves out,
1813
1815
  // whether it covers Document sheets) stays.
1814
- ...o.sheetIds !== void 0 ? { scope: na(
1815
- v.scope,
1816
- gt(o.sheetIds ?? void 0, l, N),
1817
- new Set([...Me(p).values()].filter((x) => x.sheetKind === "document").map((x) => x.sheetId))
1816
+ ...l.sheetIds !== void 0 ? { scope: Ra(
1817
+ T.scope,
1818
+ Et(l.sheetIds ?? void 0, h, N),
1819
+ new Set([...Ze(b).values()].filter((A) => A.sheetKind === "document").map((A) => A.sheetId))
1818
1820
  ) } : {},
1819
- ...D ? { values: { defaultChanged: !0, target: {} } } : {}
1821
+ ...R ? { values: { defaultChanged: !0, target: {} } } : {}
1820
1822
  };
1821
- c({ op: "filter.update", filterId: h, settings: w, changeIndex: f }, l), o.sheetIds !== void 0 && L.set(h, { sheetIds: o.sheetIds ?? "all", changeIndex: f }), D && q.set(h, { values: o.defaultValues, period: o.defaultPeriod, changeIndex: f }), i.push({ ref: o.filterId, kind: "filter", id: h, title: v.label, changeIndex: f });
1823
+ u({ op: "filter.update", filterId: y, settings: D, changeIndex: I }, h), l.sheetIds !== void 0 && L.set(y, { sheetIds: l.sheetIds ?? "all", changeIndex: I }), R && P.set(y, { values: l.defaultValues, period: l.defaultPeriod, changeIndex: I }), s.push({ ref: l.filterId, kind: "filter", id: y, title: T.label, changeIndex: I });
1822
1824
  break;
1823
1825
  }
1824
1826
  case "filter.remove": {
1825
- const h = F(o.filterId, `${l}.filterId`), I = ((We = (p.inputs ?? []).find((v) => v.id === h)) == null ? void 0 : We.label) ?? "";
1826
- c({ op: "filter.remove", filterId: h, changeIndex: f }, l), i.push({ ref: o.filterId, kind: "filter", id: h, title: I, changeIndex: f });
1827
+ const y = F(l.filterId, `${h}.filterId`), C = ((ft = (b.inputs ?? []).find((T) => T.id === y)) == null ? void 0 : ft.label) ?? "";
1828
+ u({ op: "filter.remove", filterId: y, changeIndex: I }, h), s.push({ ref: l.filterId, kind: "filter", id: y, title: C, changeIndex: I });
1827
1829
  break;
1828
1830
  }
1829
1831
  case "filter.bind": {
1830
- const h = F(o.filterId, `${l}.filterId`), I = pe(p, h, void 0, C);
1831
- I != null && I.editable || g({
1832
+ const y = F(l.filterId, `${h}.filterId`), C = Se(b, y, void 0, _);
1833
+ C != null && C.editable || f({
1832
1834
  code: "filter_not_editable",
1833
- message: I && !I.editable ? I.notEditable.message : "This filter can't be changed through the MCP.",
1834
- path: `${l}.filterId`,
1835
+ message: C && !C.editable ? C.notEditable.message : "This filter can't be changed through the MCP.",
1836
+ path: `${h}.filterId`,
1835
1837
  fix: "Tell the user to change it in the editor; removing or excluding it works."
1836
1838
  });
1837
- const v = m(o.cardId, `${l}.cardId`), S = re(p).find((w) => w.cardId === v).card, D = await Ls(S, o.field, a, `${l}.field`, g);
1838
- c({ op: "filter.bind", filterId: h, cardId: v, binding: { kind: "bound", cardId: v, bindingId: a.newId(), target: D }, changeIndex: f }, l), i.push({ ref: o.filterId, kind: "filter", id: h, title: I.label, changeIndex: f });
1839
+ const T = g(l.cardId, `${h}.cardId`), w = ie(b).find((D) => D.cardId === T).card, R = await Rn(w, l.field, a, `${h}.field`, f);
1840
+ u({ op: "filter.bind", filterId: y, cardId: T, binding: { kind: "bound", cardId: T, bindingId: a.newId(), target: R }, changeIndex: I }, h), s.push({ ref: l.filterId, kind: "filter", id: y, title: C.label, changeIndex: I });
1839
1841
  break;
1840
1842
  }
1841
1843
  case "layout.arrange": {
1842
- const h = o.sheetId ? N(o.sheetId, `${l}.sheetId`) : (() => {
1843
- const I = k();
1844
- return I.length !== 1 && g({
1845
- code: I.length ? "sheet_required" : "sheet_not_a_grid",
1846
- message: I.length ? "This dashboard has several grid sheets; say which one to arrange." : "This dashboard has no grid sheet to arrange.",
1847
- path: `${l}.sheetId`,
1848
- fix: I.length ? "Send sheetId: one of details.sheets." : "Add a grid sheet in the editor first.",
1849
- details: { sheets: T() }
1850
- }), I[0];
1844
+ const y = l.sheetId ? N(l.sheetId, `${h}.sheetId`) : (() => {
1845
+ const C = $();
1846
+ return C.length !== 1 && f({
1847
+ code: C.length ? "sheet_required" : "sheet_not_a_grid",
1848
+ message: C.length ? "This dashboard has several grid sheets; say which one to arrange." : "This dashboard has no grid sheet to arrange.",
1849
+ path: `${h}.sheetId`,
1850
+ fix: C.length ? "Send sheetId: one of details.sheets." : "Add a grid sheet in the editor first.",
1851
+ details: { sheets: x() }
1852
+ }), C[0];
1851
1853
  })();
1852
- c({ op: "layout.arrange", sheetId: h.id, ...o.keepOrder ? { keepOrder: !0 } : {}, changeIndex: f }, l);
1854
+ u({ op: "layout.arrange", sheetId: y.id, ...l.keepOrder ? { keepOrder: !0 } : {}, changeIndex: I }, h);
1853
1855
  break;
1854
1856
  }
1855
1857
  case "filter.exclude": {
1856
- const h = F(o.filterId, `${l}.filterId`), I = m(o.cardId, `${l}.cardId`), v = ((He = (p.inputs ?? []).find((S) => S.id === h)) == null ? void 0 : He.label) ?? "";
1857
- c({ op: "filter.exclude", filterId: h, cardId: I, changeIndex: f }, l), i.push({ ref: o.filterId, kind: "filter", id: h, title: v, changeIndex: f });
1858
+ const y = F(l.filterId, `${h}.filterId`), C = g(l.cardId, `${h}.cardId`), T = ((mt = (b.inputs ?? []).find((w) => w.id === y)) == null ? void 0 : mt.label) ?? "";
1859
+ u({ op: "filter.exclude", filterId: y, cardId: C, changeIndex: I }, h), s.push({ ref: l.filterId, kind: "filter", id: y, title: T, changeIndex: I });
1858
1860
  break;
1859
1861
  }
1860
1862
  }
1861
- } catch (h) {
1862
- if (!(h instanceof ue)) throw h;
1863
+ } catch (y) {
1864
+ if (!(y instanceof Ie)) throw y;
1863
1865
  }
1864
1866
  }
1865
- if (s.length) return { ok: !1, problems: s };
1866
- const j = nt(e, n, y);
1867
- if (!j.ok)
1867
+ if (o.length) return { ok: !1, problems: o };
1868
+ const U = St(e, r, p);
1869
+ if (!U.ok)
1868
1870
  return {
1869
1871
  ok: !1,
1870
1872
  problems: [
1871
1873
  {
1872
1874
  code: "invalid_change",
1873
- message: j.failedAt.message,
1874
- path: `changes[${((Ye = n[j.failedAt.index]) == null ? void 0 : Ye.changeIndex) ?? 0}]`,
1875
+ message: U.failedAt.message,
1876
+ path: `changes[${((ht = r[U.failedAt.index]) == null ? void 0 : ht.changeIndex) ?? 0}]`,
1875
1877
  fix: "Read the outline again and propose again."
1876
1878
  }
1877
1879
  ]
1878
1880
  };
1879
- for (const f of u) {
1880
- const o = ie(j.dashboard, f);
1881
- if (!o) continue;
1882
- const l = ((Xe = n.find((S) => ze(S) === f)) == null ? void 0 : Xe.changeIndex) ?? 0, h = oe(o.card, { sql: !0 }), I = Oe(o.card.type);
1883
- h.editable && ("sql" in h.query ? !!h.query.sql : "measures" in h.query ? h.query.measures.length > 0 : h.query.columns.length > 0) && ((Je = ce[I]) == null ? void 0 : Je.forms.includes(xe(h.query))) || s.push({
1881
+ for (const I of d) {
1882
+ const l = ue(U.dashboard, I);
1883
+ if (!l) continue;
1884
+ const h = ((pt = r.find((w) => it(w) === I)) == null ? void 0 : pt.changeIndex) ?? 0, y = me(l.card, { sql: !0 }), C = Qe(l.card.type);
1885
+ y.editable && ("sql" in y.query ? !!y.query.sql : "measures" in y.query ? y.query.measures.length > 0 : y.query.columns.length > 0) && ((gt = ye[C]) == null ? void 0 : gt.forms.includes(Ne(y.query))) || o.push({
1884
1886
  code: "type_not_supported",
1885
- message: `As changed, "${o.card.title}" would have no query a ${I.replace(/_/g, " ")} can run.`,
1886
- path: `changes[${l}]`,
1887
- fix: `Send a complete query with the type change: ${((Ze = ce[I]) == null ? void 0 : Ze.forms.map((S) => Se[S]).join(" or ")) ?? "a measures query"}.`
1887
+ message: `As changed, "${l.card.title}" would have no query a ${C.replace(/_/g, " ")} can run.`,
1888
+ path: `changes[${h}]`,
1889
+ fix: `Send a complete query with the type change: ${((bt = ye[C]) == null ? void 0 : bt.forms.map((w) => Ae[w]).join(" or ")) ?? "a measures query"}.`
1888
1890
  });
1889
1891
  }
1890
- if (s.push(...qs(e, j.dashboard, n, L, C)), s.push(...Ps(j.dashboard, q, a.calendar)), s.length) return { ok: !1, problems: s };
1891
- for (const f of n) {
1892
- if (f.op !== "filter.add" && !(f.op === "filter.update" && f.settings.scope)) continue;
1893
- const o = f.op === "filter.add" ? f.input.id : f.filterId, l = pe(j.dashboard, o, void 0, C);
1894
- if (!(l != null && l.editable)) continue;
1895
- const h = async (v) => {
1896
- const S = [];
1897
- for (const D of v) {
1898
- const w = D.datasetName ? await a.findRelationshipFields({
1899
- domainId: l.domainId,
1900
- fromDataset: l.datasetName,
1901
- field: l.field,
1902
- toDataset: D.datasetName
1892
+ if (o.push(...kn(e, U.dashboard, r, L, _)), o.push(...Dn(U.dashboard, P, a.calendar)), o.length) return { ok: !1, problems: o };
1893
+ for (const I of r) {
1894
+ if (I.op !== "filter.add" && !(I.op === "filter.update" && I.settings.scope)) continue;
1895
+ const l = I.op === "filter.add" ? I.input.id : I.filterId, h = Se(U.dashboard, l, void 0, _);
1896
+ if (!(h != null && h.editable)) continue;
1897
+ const y = async (T) => {
1898
+ const w = [];
1899
+ for (const R of T) {
1900
+ const D = R.datasetName ? await a.findRelationshipFields({
1901
+ domainId: h.domainId,
1902
+ fromDataset: h.datasetName,
1903
+ field: h.field,
1904
+ toDataset: R.datasetName
1903
1905
  }) : [];
1904
- S.push({ ...D, suggestedFields: w });
1906
+ w.push({ ...R, suggestedFields: D });
1905
1907
  }
1906
- return S;
1907
- }, I = (v) => v.map((S) => `"${S.title}"`).join(", ");
1908
- if (l.notReached.length) {
1909
- const v = await h(l.notReached);
1910
- r.push({
1908
+ return w;
1909
+ }, C = (T) => T.map((w) => `"${w.title}"`).join(", ");
1910
+ if (h.notReached.length) {
1911
+ const T = await y(h.notReached);
1912
+ n.push({
1911
1913
  code: "filter_not_reaching_cards",
1912
- message: `"${l.label}" doesn't reach ${v.length} card${v.length === 1 ? "" : "s"} on its sheets: ${I(v)}.`,
1913
- path: `changes[${f.changeIndex ?? 0}]`,
1914
+ message: `"${h.label}" doesn't reach ${T.length} card${T.length === 1 ? "" : "s"} on its sheets: ${C(T)}.`,
1915
+ path: `changes[${I.changeIndex ?? 0}]`,
1914
1916
  fix: "Add filter.bind with one of the suggested fields to reach a card, or leave it unfiltered.",
1915
- details: { cards: v }
1917
+ details: { cards: T }
1916
1918
  });
1917
1919
  }
1918
- if ((et = l.relationshipPending) != null && et.length) {
1919
- const v = await h(l.relationshipPending);
1920
- r.push({
1920
+ if ((yt = h.relationshipPending) != null && yt.length) {
1921
+ const T = await y(h.relationshipPending);
1922
+ n.push({
1921
1923
  code: "filter_reach_through_relationships",
1922
- message: `"${l.label}" may reach ${v.length} card${v.length === 1 ? "" : "s"} on its sheets through the domain's relationships: ${I(v)}. Whether it applies is decided when each card runs.`,
1923
- path: `changes[${f.changeIndex ?? 0}]`,
1924
+ message: `"${h.label}" may reach ${T.length} card${T.length === 1 ? "" : "s"} on its sheets through the domain's relationships: ${C(T)}. Whether it applies is decided when each card runs.`,
1925
+ path: `changes[${I.changeIndex ?? 0}]`,
1924
1926
  fix: "Add filter.bind with one of the suggested fields to make it certain, or leave it to the relationships.",
1925
- details: { cards: v }
1927
+ details: { cards: T }
1926
1928
  });
1927
1929
  }
1928
1930
  }
1929
- const Te = Es(j.dashboard, n, j.descriptions, C);
1931
+ const Me = Fn(U.dashboard, r, U.descriptions, _);
1930
1932
  return {
1931
1933
  ok: !0,
1932
- operations: n,
1933
- context: y,
1934
- dashboard: j.dashboard,
1935
- refs: i,
1936
- descriptions: Te,
1937
- changedCardIds: u,
1938
- requires: [...d],
1939
- warnings: r
1934
+ operations: r,
1935
+ context: p,
1936
+ dashboard: U.dashboard,
1937
+ refs: s,
1938
+ descriptions: Me,
1939
+ changedCardIds: d,
1940
+ requires: [...i],
1941
+ warnings: n
1940
1942
  };
1941
1943
  }
1942
- function Es(e, t, a, s) {
1943
- const r = t.filter((u) => u.op === "card.add");
1944
- if (!r.length) return [...a];
1945
- const n = Rt(e, void 0, s);
1944
+ function Fn(e, t, a, o) {
1945
+ const n = t.filter((d) => d.op === "card.add");
1946
1946
  if (!n.length) return [...a];
1947
- const i = (u) => ya(u.map((b) => `"${b}"`)), d = /* @__PURE__ */ new Map();
1948
- for (const u of r) {
1949
- const b = ze(u);
1950
- if (!b || u.changeIndex === void 0) continue;
1951
- const y = n.filter((_) => _.reaches.includes(b)).map((_) => _.label), C = n.filter((_) => {
1952
- var g;
1953
- return "notReached" in _ && ((g = _.notReached) == null ? void 0 : g.some((A) => A.cardId === b));
1954
- }).map((_) => _.label), p = n.filter((_) => {
1955
- var g;
1956
- return (g = _.relationshipPending) == null ? void 0 : g.some((A) => A.cardId === b);
1957
- }).map((_) => _.label), $ = [
1958
- ...y.length ? [`The dashboard's ${i(y)} filter${y.length === 1 ? " applies" : "s apply"} to it.`] : [],
1959
- ...C.length ? [`${i(C)} ${C.length === 1 ? "doesn't" : "don't"} reach it.`] : [],
1960
- ...p.length ? [`${i(p)} may reach it through the domain's relationships.`] : []
1947
+ const r = ta(e, void 0, o);
1948
+ if (!r.length) return [...a];
1949
+ const s = (d) => za(d.map((c) => `"${c}"`)), i = /* @__PURE__ */ new Map();
1950
+ for (const d of n) {
1951
+ const c = it(d);
1952
+ if (!c || d.changeIndex === void 0) continue;
1953
+ const p = r.filter((m) => m.reaches.includes(c)).map((m) => m.label), _ = r.filter((m) => {
1954
+ var f;
1955
+ return "notReached" in m && ((f = m.notReached) == null ? void 0 : f.some((S) => S.cardId === c));
1956
+ }).map((m) => m.label), b = r.filter((m) => {
1957
+ var f;
1958
+ return (f = m.relationshipPending) == null ? void 0 : f.some((S) => S.cardId === c);
1959
+ }).map((m) => m.label), v = [
1960
+ ...p.length ? [`The dashboard's ${s(p)} filter${p.length === 1 ? " applies" : "s apply"} to it.`] : [],
1961
+ ..._.length ? [`${s(_)} ${_.length === 1 ? "doesn't" : "don't"} reach it.`] : [],
1962
+ ...b.length ? [`${s(b)} may reach it through the domain's relationships.`] : []
1961
1963
  ];
1962
- $.length && d.set(u.changeIndex, $.join(" "));
1964
+ v.length && i.set(d.changeIndex, v.join(" "));
1963
1965
  }
1964
- return a.map((u) => {
1965
- const b = u.changeIndex === void 0 ? void 0 : d.get(u.changeIndex);
1966
- return b ? { ...u, sentence: `${u.sentence} ${b}` } : u;
1966
+ return a.map((d) => {
1967
+ const c = d.changeIndex === void 0 ? void 0 : i.get(d.changeIndex);
1968
+ return c ? { ...d, sentence: `${d.sentence} ${c}` } : d;
1967
1969
  });
1968
1970
  }
1969
- function ze(e) {
1971
+ function it(e) {
1970
1972
  var t;
1971
1973
  if (e.op === "card.update" || e.op === "card.remove") return e.cardId;
1972
1974
  if (e.op === "card.add") return (t = e.frame.cards[0]) == null ? void 0 : t.id;
1973
1975
  }
1974
- function Os(e) {
1976
+ function xn(e) {
1975
1977
  return Object.fromEntries(
1976
- _a.flatMap((t) => e[t] === void 0 ? [] : [[t, e[t]]])
1978
+ Qa.flatMap((t) => e[t] === void 0 ? [] : [[t, e[t]]])
1977
1979
  );
1978
1980
  }
1979
- function Ns(e, t) {
1981
+ function Tn(e, t) {
1980
1982
  if (!t.length || !e.config) return e;
1981
- const a = { ...e.config }, s = [];
1983
+ const a = { ...e.config }, o = [];
1982
1984
  if (a.matrix) {
1983
- const n = a.matrix, i = xa(n), d = [...n.spec.rows, ...n.spec.columns], u = { ...n.presentation.levelLabels }, b = { ...n.presentation.measureLabels };
1984
- for (const { key: y, label: C } of t) {
1985
- if (y.role === "metric") {
1986
- const p = i.measures.findIndex(($) => Fe($, y));
1987
- if (p < 0) continue;
1988
- b[n.spec.measures[p].id] = C;
1985
+ const r = a.matrix, s = Xa(r), i = [...r.spec.rows, ...r.spec.columns], d = { ...r.presentation.levelLabels }, c = { ...r.presentation.measureLabels };
1986
+ for (const { key: p, label: _ } of t) {
1987
+ if (p.role === "metric") {
1988
+ const b = s.measures.findIndex((v) => je(v, p));
1989
+ if (b < 0) continue;
1990
+ c[r.spec.measures[b].id] = _;
1989
1991
  } else {
1990
- const p = i.levels.findIndex(($) => Fe($, y));
1991
- if (p < 0) continue;
1992
- u[d[p].id] = C;
1992
+ const b = s.levels.findIndex((v) => je(v, p));
1993
+ if (b < 0) continue;
1994
+ d[i[b].id] = _;
1993
1995
  }
1994
- s.push(y);
1996
+ o.push(p);
1995
1997
  }
1996
- return a.matrix = { ...n, presentation: { ...n.presentation, levelLabels: u, measureLabels: b } }, { ...e, config: a, statedLabels: s };
1998
+ return a.matrix = { ...r, presentation: { ...r.presentation, levelLabels: d, measureLabels: c } }, { ...e, config: a, statedLabels: o };
1997
1999
  }
1998
- const r = { metric: "metricColumns", group_by: "groupByColumns", detail: "detailColumns" };
1999
- for (const { key: n, label: i } of t) {
2000
- const d = [...a[r[n.role]] ?? []], u = Ta(n.role, d).findIndex((b) => Fe(b, n));
2001
- u < 0 || (d[u] = Ba(d[u], i), a[r[n.role]] = d, s.push(n));
2000
+ const n = { metric: "metricColumns", group_by: "groupByColumns", detail: "detailColumns" };
2001
+ for (const { key: r, label: s } of t) {
2002
+ const i = [...a[n[r.role]] ?? []], d = Za(r.role, i).findIndex((c) => je(c, r));
2003
+ d < 0 || (i[d] = Ro(i[d], s), a[n[r.role]] = i, o.push(r));
2002
2004
  }
2003
- return { ...e, config: a, statedLabels: s };
2004
- }
2005
- function qs(e, t, a, s, r) {
2006
- var A;
2007
- const n = [], i = new Map(re(t).map((c) => [c.cardId, c])), d = Me(t), u = de(t), b = (c) => {
2008
- var m, F;
2009
- return ((F = (m = t.sheets) == null ? void 0 : m.find((k) => k.id === c)) == null ? void 0 : F.title) ?? c;
2010
- }, y = (c, m) => {
2005
+ return { ...e, config: a, statedLabels: o };
2006
+ }
2007
+ function kn(e, t, a, o, n) {
2008
+ var S;
2009
+ const r = [], s = new Map(ie(t).map((u) => [u.cardId, u])), i = Ze(t), d = he(t), c = (u) => {
2010
+ var g, F;
2011
+ return ((F = (g = t.sheets) == null ? void 0 : g.find(($) => $.id === u)) == null ? void 0 : F.title) ?? u;
2012
+ }, p = (u, g) => {
2011
2013
  var F;
2012
- return ((F = [...a].reverse().find((k) => ze(k) === m || "filterId" in k && k.filterId === c)) == null ? void 0 : F.changeIndex) ?? 0;
2013
- }, C = (c, m) => {
2014
- const F = u.findFilterInput({ inputId: c }).input, k = i.get(m), T = `"${k.card.title ?? ""}"`, N = `"${F.label}"`;
2015
- if (k.kind === "documentSectionCard")
2014
+ return ((F = [...a].reverse().find(($) => it($) === g || "filterId" in $ && $.filterId === u)) == null ? void 0 : F.changeIndex) ?? 0;
2015
+ }, _ = (u, g) => {
2016
+ const F = d.findFilterInput({ inputId: u }).input, $ = s.get(g), x = `"${$.card.title ?? ""}"`, N = `"${F.label}"`;
2017
+ if ($.kind === "documentSectionCard")
2016
2018
  return {
2017
2019
  reason: "document_section",
2018
- message: `${T} is in a Document section, which takes only the filters its Document sheet shows.`,
2020
+ message: `${x} is in a Document section, which takes only the filters its Document sheet shows.`,
2019
2021
  fix: "Tell the user to change where the filter shows in the editor."
2020
2022
  };
2021
- const R = d.get(k.sheetId);
2022
- if (R && !yt(F, R))
2023
+ const k = i.get($.sheetId);
2024
+ if (k && !Vt(F, k))
2023
2025
  return {
2024
2026
  reason: "outside_sheets",
2025
- message: `${N} isn't shown on "${b(k.sheetId)}", so it can't filter ${T}.`,
2027
+ message: `${N} isn't shown on "${c($.sheetId)}", so it can't filter ${x}.`,
2026
2028
  fix: "Show it on that sheet first with filter.update sheetIds (null for every sheet), in the same proposal."
2027
2029
  };
2028
- const O = qa(F, k.card);
2030
+ const O = wo(F, $.card);
2029
2031
  switch (O.status) {
2030
2032
  case "incompatible":
2031
- return { reason: "incompatible_field", message: `${T} can't take ${N}'s values on that field: their types differ.`, fix: "Bind a field of the same type (filter.bind)." };
2033
+ return { reason: "incompatible_field", message: `${x} can't take ${N}'s values on that field: their types differ.`, fix: "Bind a field of the same type (filter.bind)." };
2032
2034
  case "stale":
2033
2035
  return {
2034
2036
  reason: "field_not_on_card",
2035
- message: `${T} doesn't have the field ${N} is bound to.`,
2037
+ message: `${x} doesn't have the field ${N} is bound to.`,
2036
2038
  fix: "Bind a field the card has (filter.bind), or exclude the card (filter.exclude), in the same proposal."
2037
2039
  };
2038
2040
  case "ambiguous":
2039
2041
  return {
2040
2042
  reason: "ambiguous_field",
2041
- message: `${T} has more than one field ${N} could filter.`,
2043
+ message: `${x} has more than one field ${N} could filter.`,
2042
2044
  fix: "Bind the field it should use (filter.bind), or exclude the card (filter.exclude), in the same proposal."
2043
2045
  };
2044
2046
  case "relationship": {
2045
- const E = ve(F, k.card, r);
2047
+ const E = Oe(F, $.card, n);
2046
2048
  return E.reach === "blocked" ? {
2047
2049
  reason: "relationship_route_changed",
2048
- message: `The relationships ${T} used for ${N} changed in the domain.`,
2050
+ message: `The relationships ${x} used for ${N} changed in the domain.`,
2049
2051
  fix: "Tell the user to choose the relationship again in the filter's Cards tab."
2050
2052
  } : E.reason === "relationship_ambiguous" ? {
2051
2053
  reason: "relationship_ambiguous",
2052
- message: `${N} connects to ${T} through more than one path.`,
2054
+ message: `${N} connects to ${x} through more than one path.`,
2053
2055
  fix: "Tell the user to choose a path in the filter's Cards tab, or bind a field the card has (filter.bind)."
2054
2056
  } : {
2055
2057
  reason: "relationship_pending",
2056
- message: `${N} may reach ${T} through the domain's relationships; whether it applies is decided when the card runs.`,
2058
+ message: `${N} may reach ${x} through the domain's relationships; whether it applies is decided when the card runs.`,
2057
2059
  fix: "Bind a field the card has (filter.bind) to make it certain, or leave it to the relationships."
2058
2060
  };
2059
2061
  }
@@ -2064,533 +2066,1242 @@ function qs(e, t, a, s, r) {
2064
2066
  case "automatic":
2065
2067
  case "passthrough":
2066
2068
  case "notApplicable":
2067
- return { reason: "filter_settings_override", message: `${N} still wouldn't filter ${T}: its settings leave that card out.`, fix: "Tell the user to change the filter's settings in the editor." };
2069
+ return { reason: "filter_settings_override", message: `${N} still wouldn't filter ${x}: its settings leave that card out.`, fix: "Tell the user to change the filter's settings in the editor." };
2068
2070
  default: {
2069
2071
  const E = O;
2070
2072
  throw new Error(`Unhandled filter card target ${String(E.status)}`);
2071
2073
  }
2072
2074
  }
2073
- }, p = /* @__PURE__ */ new Set(), $ = /* @__PURE__ */ new Map();
2074
- for (const c of a)
2075
- (c.op === "filter.bind" || c.op === "filter.exclude") && $.set(`${c.filterId}|${c.cardId}`, c);
2076
- for (const c of $.values()) {
2077
- const m = pe(t, c.filterId, void 0, r), F = i.get(c.cardId);
2078
- if (!m || !F) continue;
2079
- const k = m.reaches.includes(c.cardId);
2080
- if (c.op === "filter.bind" ? k : !k) continue;
2081
- p.add(`${c.filterId}|${c.cardId}`);
2082
- const T = c.op === "filter.bind" ? C(c.filterId, c.cardId) : { reason: "filter_settings_override", message: `"${m.label}" would still filter "${F.card.title ?? ""}".`, fix: "Tell the user to change the filter's settings in the editor." };
2083
- n.push({
2075
+ }, b = /* @__PURE__ */ new Set(), v = /* @__PURE__ */ new Map();
2076
+ for (const u of a)
2077
+ (u.op === "filter.bind" || u.op === "filter.exclude") && v.set(`${u.filterId}|${u.cardId}`, u);
2078
+ for (const u of v.values()) {
2079
+ const g = Se(t, u.filterId, void 0, n), F = s.get(u.cardId);
2080
+ if (!g || !F) continue;
2081
+ const $ = g.reaches.includes(u.cardId);
2082
+ if (u.op === "filter.bind" ? $ : !$) continue;
2083
+ b.add(`${u.filterId}|${u.cardId}`);
2084
+ const x = u.op === "filter.bind" ? _(u.filterId, u.cardId) : { reason: "filter_settings_override", message: `"${g.label}" would still filter "${F.card.title ?? ""}".`, fix: "Tell the user to change the filter's settings in the editor." };
2085
+ r.push({
2084
2086
  code: "filter_not_editable",
2085
- message: T.message,
2086
- path: `changes[${c.changeIndex ?? 0}]`,
2087
- fix: T.fix,
2088
- details: { reason: T.reason, cardId: c.cardId }
2087
+ message: x.message,
2088
+ path: `changes[${u.changeIndex ?? 0}]`,
2089
+ fix: x.fix,
2090
+ details: { reason: x.reason, cardId: u.cardId }
2089
2091
  });
2090
2092
  }
2091
- for (const [c, m] of s) {
2092
- const F = pe(t, c, void 0, r);
2093
+ for (const [u, g] of o) {
2094
+ const F = Se(t, u, void 0, n);
2093
2095
  if (!F) continue;
2094
- const k = F.editable && ((A = F.exceptSheetIds) == null ? void 0 : A.some((R) => {
2096
+ const $ = F.editable && ((S = F.exceptSheetIds) == null ? void 0 : S.some((k) => {
2095
2097
  var O;
2096
- return ((O = d.get(R)) == null ? void 0 : O.sheetKind) === "dashboard";
2097
- })), T = F.editable && !k ? F.sheetIds : void 0, N = m.sheetIds === "all" ? "all" : [...m.sheetIds].sort();
2098
- Le(T === "all" || !T ? T : [...T].sort(), N) || n.push({
2098
+ return ((O = i.get(k)) == null ? void 0 : O.sheetKind) === "dashboard";
2099
+ })), x = F.editable && !$ ? F.sheetIds : void 0, N = g.sheetIds === "all" ? "all" : [...g.sheetIds].sort();
2100
+ et(x === "all" || !x ? x : [...x].sort(), N) || r.push({
2099
2101
  code: "filter_not_editable",
2100
2102
  message: `"${F.label}" wouldn't show on the sheets asked for. Change where it shows in the editor.`,
2101
- path: `changes[${m.changeIndex}].sheetIds`,
2103
+ path: `changes[${g.changeIndex}].sheetIds`,
2102
2104
  fix: "Tell the user to change the filter's sheets in the editor.",
2103
- details: { reason: "filter_settings_override", ...T ? { sheetIds: T } : {} }
2105
+ details: { reason: "filter_settings_override", ...x ? { sheetIds: x } : {} }
2104
2106
  });
2105
2107
  }
2106
- const _ = de(e), g = (c) => c === "blocked" || c === "ambiguous";
2107
- for (const c of u.inputs) {
2108
- const m = c.input.id;
2109
- for (const F of u.reachedCards({ inputId: m })) {
2110
- if (p.has(`${m}|${F.cardId}`) || !g(ve(c.input, F.card, r).reach)) continue;
2111
- const k = _.findFilterInput({ inputId: m }), T = k && _.reachedCards({ inputId: m }).find((R) => R.cardId === F.cardId);
2112
- if (k && T && g(ve(k.input, T.card, r).reach)) continue;
2113
- const N = C(m, F.cardId);
2114
- n.push({
2108
+ const m = he(e), f = (u) => u === "blocked" || u === "ambiguous";
2109
+ for (const u of d.inputs) {
2110
+ const g = u.input.id;
2111
+ for (const F of d.reachedCards({ inputId: g })) {
2112
+ if (b.has(`${g}|${F.cardId}`) || !f(Oe(u.input, F.card, n).reach)) continue;
2113
+ const $ = m.findFilterInput({ inputId: g }), x = $ && m.reachedCards({ inputId: g }).find((k) => k.cardId === F.cardId);
2114
+ if ($ && x && f(Oe($.input, x.card, n).reach)) continue;
2115
+ const N = _(g, F.cardId);
2116
+ r.push({
2115
2117
  code: "invalid_change",
2116
- message: `${N.message} The card would stop showing data while "${c.input.label}" has a value.`,
2117
- path: `changes[${y(m, F.cardId)}]`,
2118
+ message: `${N.message} The card would stop showing data while "${u.input.label}" has a value.`,
2119
+ path: `changes[${p(g, F.cardId)}]`,
2118
2120
  fix: N.fix,
2119
- details: { reason: N.reason, filterId: m, cardId: F.cardId }
2121
+ details: { reason: N.reason, filterId: g, cardId: F.cardId }
2120
2122
  });
2121
2123
  }
2122
2124
  }
2123
- return n;
2125
+ return r;
2124
2126
  }
2125
- function Ps(e, t, a) {
2126
- const s = [], r = de(e);
2127
- for (const [n, i] of t) {
2128
- const d = r.findFilterInput({ inputId: n });
2129
- if (!d) continue;
2130
- const u = It({ dashboard: e, target: { kind: "dashboardInput", input: d.input, scope: {} }, calendar: a }).value, b = d.input.filter.dateSelectionMode, y = b === "day" ? "its date picker takes one day" : void 0, C = (p, $) => s.push({
2127
+ function Dn(e, t, a) {
2128
+ const o = [], n = he(e);
2129
+ for (const [r, s] of t) {
2130
+ const i = n.findFilterInput({ inputId: r });
2131
+ if (!i) continue;
2132
+ const d = Bt({ dashboard: e, target: { kind: "dashboardInput", input: i.input, scope: {} }, calendar: a }).value, c = i.input.filter.dateSelectionMode, p = c === "day" ? "its date picker takes one day" : void 0, _ = (b, v) => o.push({
2131
2133
  code: "filter_not_editable",
2132
- message: p,
2133
- path: `changes[${i.changeIndex}]`,
2134
- fix: $,
2135
- details: { reason: "default_not_applied", ...b ? { datePicker: b } : {} }
2134
+ message: b,
2135
+ path: `changes[${s.changeIndex}]`,
2136
+ fix: v,
2137
+ details: { reason: "default_not_applied", ...c ? { datePicker: c } : {} }
2136
2138
  });
2137
- if (i.period) {
2138
- const p = vt(i.period), $ = u && "relativeMeta" in u ? u.relativeMeta : void 0;
2139
- (!$ || !Le($, p)) && C(
2140
- `"${d.input.label}" wouldn't load with that default${y ? `: ${y}` : ""}.`,
2141
- y ? "Ask for a default the picker can take, or tell the user to make it a date range in the editor." : "Tell the user to change the filter's default in the editor."
2139
+ if (s.period) {
2140
+ const b = zt(s.period), v = d && "relativeMeta" in d ? d.relativeMeta : void 0;
2141
+ (!v || !et(v, b)) && _(
2142
+ `"${i.input.label}" wouldn't load with that default${p ? `: ${p}` : ""}.`,
2143
+ p ? "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."
2142
2144
  );
2143
- } else if (i.values) {
2144
- const p = ($) => JSON.stringify(($ ?? []).map(String).sort());
2145
- (!u || p(u.values) !== p(i.values)) && C(`"${d.input.label}" wouldn't load with those values.`, "Tell the user to change the filter's default in the editor.");
2145
+ } else if (s.values) {
2146
+ const b = (v) => JSON.stringify((v ?? []).map(String).sort());
2147
+ (!d || b(d.values) !== b(s.values)) && _(`"${i.input.label}" wouldn't load with those values.`, "Tell the user to change the filter's default in the editor.");
2146
2148
  } else
2147
- (St(d.input.filter.dataType) ? i.period === null : i.values === null) && u && C(`"${d.input.label}" would still load with a default.`, "Tell the user to change the filter's default in the editor.");
2149
+ (Gt(i.input.filter.dataType) ? s.period === null : s.values === null) && d && _(`"${i.input.label}" would still load with a default.`, "Tell the user to change the filter's default in the editor.");
2148
2150
  }
2149
- return s;
2151
+ return o;
2150
2152
  }
2151
- function Ms(e, t, a, s) {
2152
- const r = Object.fromEntries(Object.entries(t).filter(([, y]) => y != null)), n = xe(r), i = xe(e), d = (y) => mt[y].safeParse(r);
2153
- if (!e || n && n !== i) {
2154
- const y = n ?? i, C = y ? d(y) : void 0;
2155
- return C != null && C.success ? C.data : s({
2153
+ function An(e, t, a, o) {
2154
+ const n = Object.fromEntries(Object.entries(t).filter(([, p]) => p != null)), r = Ne(n), s = Ne(e), i = (p) => Ot[p].safeParse(n);
2155
+ if (!e || r && r !== s) {
2156
+ const p = r ?? s, _ = p ? i(p) : void 0;
2157
+ return _ != null && _.success ? _.data : o({
2156
2158
  code: e ? "query_form_mismatch" : "type_not_supported",
2157
2159
  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.",
2158
2160
  path: a,
2159
2161
  fix: "Send a complete query of the new form: domainId, datasetName and measures (or columns), or connectionId and sql."
2160
2162
  });
2161
2163
  }
2162
- const u = { ...e };
2163
- for (const [y, C] of Object.entries(t))
2164
- C !== void 0 && (C === null ? delete u[y] : u[y] = C);
2165
- const b = mt[i].safeParse(u);
2166
- if (!b.success) {
2167
- const y = b.error.issues[0];
2168
- return s({
2169
- code: (y == null ? void 0 : y.code) === "unrecognized_keys" ? "query_form_mismatch" : "invalid_change",
2170
- message: (y == null ? void 0 : y.message) ?? "The merged query is not valid.",
2171
- path: y ? Et(a, y) : a,
2164
+ const d = { ...e };
2165
+ for (const [p, _] of Object.entries(t))
2166
+ _ !== void 0 && (_ === null ? delete d[p] : d[p] = _);
2167
+ const c = Ot[s].safeParse(d);
2168
+ if (!c.success) {
2169
+ const p = c.error.issues[0];
2170
+ return o({
2171
+ code: (p == null ? void 0 : p.code) === "unrecognized_keys" ? "query_form_mismatch" : "invalid_change",
2172
+ message: (p == null ? void 0 : p.message) ?? "The merged query is not valid.",
2173
+ path: p ? aa(a, p) : a,
2172
2174
  fix: "Patch only keys of the card's query form, or send a complete query of a new form."
2173
2175
  });
2174
2176
  }
2175
- return b.data;
2176
- }
2177
- function gt(e, t, a) {
2178
- return e ? (e.forEach((s, r) => a(s, `${t}.sheetIds[${r}]`)), { kind: "sheets", sheetIds: [...e] }) : { kind: "allSheets", sheetKinds: ["dashboard"] };
2179
- }
2180
- function bt(e, t, a, s) {
2181
- ["date", "datetime", "timestamp"].some((i) => Pe(t.dataType).includes(i)) || s({ code: "invalid_change", message: "defaultPeriod is for date filters.", path: a, fix: "Use defaultValues for this field." });
2182
- const n = vt(e);
2183
- if (!n) {
2184
- const i = "anchor" in e && e.anchor === "latest_available";
2185
- if (!i && Ra(e)) {
2186
- const d = e.unit;
2187
- return s({
2177
+ return c.data;
2178
+ }
2179
+ function Et(e, t, a) {
2180
+ return e ? (e.forEach((o, n) => a(o, `${t}.sheetIds[${n}]`)), { kind: "sheets", sheetIds: [...e] }) : { kind: "allSheets", sheetKinds: ["dashboard"] };
2181
+ }
2182
+ function Nt(e, t, a, o) {
2183
+ ["date", "datetime", "timestamp"].some((s) => We(t.dataType).includes(s)) || o({ code: "invalid_change", message: "defaultPeriod is for date filters.", path: a, fix: "Use defaultValues for this field." });
2184
+ const r = zt(e);
2185
+ if (!r) {
2186
+ const s = "anchor" in e && e.anchor === "latest_available";
2187
+ if (!s && ho(e)) {
2188
+ const i = e.unit;
2189
+ return o({
2188
2190
  code: "invalid_change",
2189
- message: `A filter's default can't count a partial ${d} back from now; its presets are whole days with today, complete ${d}s, or a calendar ${d}.`,
2191
+ message: `A filter's default can't count a partial ${i} back from now; its presets are whole days with today, complete ${i}s, or a calendar ${i}.`,
2190
2192
  path: a,
2191
- fix: `Use completeness "complete_periods", days ({ unit: "day", value: N }), or { kind: "calendar", unit: "${d}", period: "this", toDate: true }; ask the user which they mean.`
2193
+ fix: `Use completeness "complete_periods", days ({ unit: "day", value: N }), or { kind: "calendar", unit: "${i}", period: "this", toDate: true }; ask the user which they mean.`
2192
2194
  });
2193
2195
  }
2194
- return s({
2196
+ return o({
2195
2197
  code: "invalid_change",
2196
- message: i ? "A filter's default runs to now, not to the latest available data." : "This period can't be a filter's default.",
2198
+ message: s ? "A filter's default runs to now, not to the latest available data." : "This period can't be a filter's default.",
2197
2199
  path: a,
2198
- fix: i ? "Leave out anchor (a filter default runs to now)." : 'Use days ({ unit: "day", value: N }), complete periods, or a calendar window ({ kind: "calendar", unit, period }).'
2200
+ fix: s ? "Leave out anchor (a filter default runs to now)." : 'Use days ({ unit: "day", value: N }), complete periods, or a calendar window ({ kind: "calendar", unit, period }).'
2199
2201
  });
2200
2202
  }
2201
- return n;
2203
+ return r;
2202
2204
  }
2203
- async function Ls(e, t, a, s, r) {
2204
- const n = ha(e), i = n.kind === "config" ? n.executableSources : n.kind === "sql" ? n.pinnedCatalogSources.map((_) => _.source) : [], d = fe(e), u = typeof t == "string" ? (d == null ? void 0 : d.kind) === "semantic" ? d.datasetName : void 0 : t.datasetName, b = i.find((_) => _.kind === "semantic" && Pe(_.datasetName) === Pe(u));
2205
- if (!b || b.kind !== "semantic")
2206
- return r({
2205
+ async function Rn(e, t, a, o, n) {
2206
+ const r = La(e), s = r.kind === "config" ? r.executableSources : r.kind === "sql" ? r.pinnedCatalogSources.map((m) => m.source) : [], i = ve(e), d = typeof t == "string" ? (i == null ? void 0 : i.kind) === "semantic" ? i.datasetName : void 0 : t.datasetName, c = s.find((m) => m.kind === "semantic" && We(m.datasetName) === We(d));
2207
+ if (!c || c.kind !== "semantic")
2208
+ return n({
2207
2209
  code: "field_not_found",
2208
- message: `"${e.title}" doesn't read ${u ? `the dataset ${u}` : "a dataset"}.`,
2209
- path: s,
2210
+ message: `"${e.title}" doesn't read ${d ? `the dataset ${d}` : "a dataset"}.`,
2211
+ path: o,
2210
2212
  fix: "Name a field of the card's own dataset, or { name, datasetName } for a dataset its query joins."
2211
2213
  });
2212
- const y = await a.loadCardSource({ domainId: b.domainId, datasetName: b.datasetName }), C = typeof t == "string" ? t : t.name, p = y ? _t(y.fields, C, b.datasetName) : void 0, $ = p ? Mt(b, { column_name: p.name, data_type: p.dataType, ...p.sourceField ? { sourceField: p.sourceField } : {} }) : void 0;
2213
- return $ || r({
2214
+ const p = await a.loadCardSource({ domainId: c.domainId, datasetName: c.datasetName }), _ = typeof t == "string" ? t : t.name, b = p ? jt(p.fields, _, c.datasetName) : void 0, v = b ? ua(c, { column_name: b.name, data_type: b.dataType, ...b.sourceField ? { sourceField: b.sourceField } : {} }) : void 0;
2215
+ return v || n({
2214
2216
  code: "field_not_found",
2215
- message: `"${C}" isn't a field of ${b.datasetName}.`,
2216
- path: s,
2217
+ message: `"${_}" isn't a field of ${c.datasetName}.`,
2218
+ path: o,
2217
2219
  fix: "Use one of details.available, or read semaphor_get_dataset_schema.",
2218
- details: { available: ((y == null ? void 0 : y.fields) ?? []).slice(0, 20).map((_) => _.name) }
2220
+ details: { available: ((p == null ? void 0 : p.fields) ?? []).slice(0, 20).map((m) => m.name) }
2219
2221
  });
2220
2222
  }
2221
- const Bs = 50;
2222
- function gi(e, t) {
2223
- var p, $;
2224
- const a = (p = t.sheetIds) != null && p.length ? new Set(t.sheetIds) : void 0, s = ($ = t.cardIds) != null && $.length ? new Set(t.cardIds) : void 0, r = (e.sheets ?? []).filter((_) => !a || a.has(_.id)), n = re(e).filter(
2225
- (_) => (!a || a.has(_.sheetId)) && (!s || s.has(_.cardId))
2226
- ), i = n.length > (t.maxQueryCards ?? Bs), d = new Map(
2227
- (e.sheets ?? []).flatMap((_) => (_.frames ?? []).map((g) => [g.id, g]))
2228
- ), u = /* @__PURE__ */ new Map(), b = (_) => {
2229
- (_ == null ? void 0 : _.kind) === "semantic" && u.set(`${_.domainId}|${_.datasetName}`, { domainId: _.domainId, datasetName: _.datasetName });
2230
- }, y = r.map((_) => ({
2231
- sheetId: _.id,
2232
- title: _.title ?? "",
2233
- kind: _.kind === "document" ? "document" : "dashboard",
2234
- ..._.kind === "document" ? {} : { layout: Vs(_) },
2235
- cards: n.filter((g) => g.sheetId === _.id).map((g) => {
2236
- var T;
2237
- const A = g.card, c = g.kind === "frameCard" ? (T = d.get(g.frameId)) == null ? void 0 : T.visualId : void 0, m = c ? { linkedVisualId: c } : {}, F = { cardId: g.cardId, title: A.title ?? "" };
2238
- if (g.kind !== "frameCard") {
2239
- const N = fe(A);
2240
- return b(N), {
2223
+ const On = 50;
2224
+ function Hs(e, t) {
2225
+ var b, v;
2226
+ const a = (b = t.sheetIds) != null && b.length ? new Set(t.sheetIds) : void 0, o = (v = t.cardIds) != null && v.length ? new Set(t.cardIds) : void 0, n = (e.sheets ?? []).filter((m) => !a || a.has(m.id)), r = ie(e).filter(
2227
+ (m) => (!a || a.has(m.sheetId)) && (!o || o.has(m.cardId))
2228
+ ), s = r.length > (t.maxQueryCards ?? On), i = new Map(
2229
+ (e.sheets ?? []).flatMap((m) => (m.frames ?? []).map((f) => [f.id, f]))
2230
+ ), d = /* @__PURE__ */ new Map(), c = (m) => {
2231
+ (m == null ? void 0 : m.kind) === "semantic" && d.set(`${m.domainId}|${m.datasetName}`, { domainId: m.domainId, datasetName: m.datasetName });
2232
+ }, p = n.map((m) => ({
2233
+ sheetId: m.id,
2234
+ title: m.title ?? "",
2235
+ kind: m.kind === "document" ? "document" : "dashboard",
2236
+ ...m.kind === "document" ? {} : { layout: En(m) },
2237
+ cards: r.filter((f) => f.sheetId === m.id).map((f) => {
2238
+ var x;
2239
+ const S = f.card, u = f.kind === "frameCard" ? (x = i.get(f.frameId)) == null ? void 0 : x.visualId : void 0, g = u ? { linkedVisualId: u } : {}, F = { cardId: f.cardId, title: S.title ?? "" };
2240
+ if (f.kind !== "frameCard") {
2241
+ const N = ve(S);
2242
+ return c(N), {
2241
2243
  ...F,
2242
- type: Oe(A.type),
2244
+ type: Qe(S.type),
2243
2245
  ...N ? { source: N } : {},
2244
2246
  editable: !1,
2245
- notEditable: g.kind === "documentSectionCard" ? { reason: "document_section", message: "Cards in Document sections can't be changed through the MCP yet. Change them in the editor." } : {
2247
+ notEditable: f.kind === "documentSectionCard" ? { reason: "document_section", message: "Cards in Document sections can't be changed through the MCP yet. Change them in the editor." } : {
2246
2248
  reason: "not_expressible",
2247
2249
  message: "This card isn't in a tile, so it can't be changed through the MCP. Change it in the editor.",
2248
2250
  detail: "a card outside a tile"
2249
2251
  }
2250
2252
  };
2251
2253
  }
2252
- const k = oe(A, { sql: t.sql });
2253
- return b(k.source), k.editable ? {
2254
+ const $ = me(S, { sql: t.sql });
2255
+ return c($.source), $.editable ? {
2254
2256
  ...F,
2255
- type: k.type,
2256
- source: k.source,
2257
- ...m,
2257
+ type: $.type,
2258
+ source: $.source,
2259
+ ...g,
2258
2260
  editable: !0,
2259
- ...i ? {} : { query: k.query, ...k.matrix ? { matrix: k.matrix } : {} }
2261
+ ...s ? {} : { query: $.query, ...$.matrix ? { matrix: $.matrix } : {} }
2260
2262
  } : {
2261
2263
  ...F,
2262
- type: k.type,
2263
- ...k.source ? { source: k.source } : {},
2264
- ...m,
2264
+ type: $.type,
2265
+ ...$.source ? { source: $.source } : {},
2266
+ ...g,
2265
2267
  editable: !1,
2266
- notEditable: { reason: k.reason, message: k.message, ...k.detail ? { detail: k.detail } : {} }
2268
+ notEditable: { reason: $.reason, message: $.message, ...$.detail ? { detail: $.detail } : {} }
2267
2269
  };
2268
2270
  })
2269
- })), C = Rt(e, Ft(t.calendar, t.updatedAt), {
2271
+ })), _ = ta(e, Zt(t.calendar, t.updatedAt), {
2270
2272
  ...t.relationshipReach ? { relationshipReach: t.relationshipReach } : {}
2271
2273
  });
2272
- for (const _ of C)
2273
- _.editable && u.set(`${_.domainId}|${_.datasetName}`, { domainId: _.domainId, datasetName: _.datasetName });
2274
+ for (const m of _)
2275
+ m.editable && d.set(`${m.domainId}|${m.datasetName}`, { domainId: m.domainId, datasetName: m.datasetName });
2274
2276
  return {
2275
2277
  dashboardId: t.dashboardId,
2276
2278
  title: e.title ?? "",
2277
2279
  updatedAt: t.updatedAt,
2278
2280
  access: t.access,
2279
- datasets: [...u.values()],
2280
- sheets: y,
2281
- filters: C,
2282
- ...i ? { truncated: !0 } : {}
2281
+ datasets: [...d.values()],
2282
+ sheets: p,
2283
+ filters: _,
2284
+ ...s ? { truncated: !0 } : {}
2283
2285
  };
2284
2286
  }
2285
- function Vs(e) {
2287
+ function En(e) {
2286
2288
  const t = new Map((e.frames ?? []).map((a) => [a.id, a]));
2287
- return Oa(e).rows.map((a) => ({
2288
- tiles: a.tiles.map((s) => {
2289
- var d, u;
2290
- const r = ((d = t.get(s.frameId)) == null ? void 0 : d.cards) ?? [], n = (u = t.get(s.frameId)) == null ? void 0 : u.activeCardId, i = r.map((b) => b.id);
2291
- return { cardIds: n && i.includes(n) ? [n, ...i.filter((b) => b !== n)] : i, width: s.width };
2289
+ return vo(e).rows.map((a) => ({
2290
+ tiles: a.tiles.map((o) => {
2291
+ var i, d;
2292
+ const n = ((i = t.get(o.frameId)) == null ? void 0 : i.cards) ?? [], r = (d = t.get(o.frameId)) == null ? void 0 : d.activeCardId, s = n.map((c) => c.id);
2293
+ return { cardIds: r && s.includes(r) ? [r, ...s.filter((c) => c !== r)] : s, width: o.width };
2292
2294
  })
2293
2295
  }));
2294
2296
  }
2297
+ function Q(e) {
2298
+ return typeof e == "object" && e !== null && !Array.isArray(e);
2299
+ }
2300
+ function ae(e, t) {
2301
+ return Q(e) && Object.prototype.hasOwnProperty.call(e, t) && e[t] !== void 0;
2302
+ }
2303
+ const J = ae, Nn = ["metricColumns", "groupByColumns", "detailColumns", "pivotByColumns", "sortByColumns"], Pn = ["xAxisConfig", "yAxisConfig", "secondaryYAxisConfig", "tooltipConfig", "dataLabelsConfig"], qn = '`format` on the matching column in `config.metricColumns`, `groupByColumns` or `detailColumns`; for a SQL or Python card, `preferences.sqlColumns["<column>"].format`', Re = "`preferences.conditionalFormatting`, with columns named by card column id";
2304
+ function Mn(e) {
2305
+ switch (e.type) {
2306
+ case "number":
2307
+ case "currency":
2308
+ case "percent":
2309
+ case "scientific":
2310
+ return Io;
2311
+ case "date":
2312
+ return yo;
2313
+ case "duration":
2314
+ return bo;
2315
+ case "string":
2316
+ return go;
2317
+ case "temporal_bucket":
2318
+ return po;
2319
+ default:
2320
+ return at;
2321
+ }
2322
+ }
2323
+ function Ce(e, t, a) {
2324
+ if (a === void 0) return;
2325
+ const o = Q(a) ? Mn(a).safeParse(a) : at.safeParse(a);
2326
+ if (!o.success)
2327
+ for (const n of o.error.issues) {
2328
+ const r = n.code === "unrecognized_keys" ? n.keys : [n.path.length ? String(n.path[n.path.length - 1]) : "type"];
2329
+ for (const s of r)
2330
+ e.push({
2331
+ path: [t, ...n.path.map(String), ...n.code === "unrecognized_keys" ? [s] : []].join("."),
2332
+ field: s,
2333
+ replacement: s === "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})`
2334
+ });
2335
+ }
2336
+ }
2337
+ function Ge(e, t, a) {
2338
+ if (Q(a)) {
2339
+ for (const o of ["dateFormat", "customFormat"])
2340
+ J(a, o) && e.push({ path: `${t}.${o}`, field: o, replacement: "`format` on this column (a temporal bucket or date format)" });
2341
+ Ce(e, `${t}.format`, a.format);
2342
+ }
2343
+ }
2344
+ function oa(e, t) {
2345
+ const a = [], o = e.config;
2346
+ for (const m of Nn) {
2347
+ const f = o == null ? void 0 : o[m];
2348
+ Array.isArray(f) && f.forEach((S, u) => Ge(a, `${t}.config.${m}[${u}]`, S));
2349
+ }
2350
+ const n = Q(o == null ? void 0 : o.matrix) ? o.matrix : void 0, r = Q(n == null ? void 0 : n.presentation) ? n.presentation : void 0;
2351
+ for (const m of ["measureFormats", "levelFormats"]) {
2352
+ const f = r == null ? void 0 : r[m];
2353
+ if (Q(f)) for (const [S, u] of Object.entries(f)) Ce(a, `${t}.config.matrix.presentation.${m}.${S}`, u);
2354
+ }
2355
+ J(r, "conditionalFormatting") && a.push({ path: `${t}.config.matrix.presentation.conditionalFormatting`, field: "conditionalFormatting", replacement: Re });
2356
+ const s = e.interactionConfig, i = s == null ? void 0 : s.drillHierarchies;
2357
+ Array.isArray(i) && i.forEach((m, f) => {
2358
+ Q(m) && (Ge(a, `${t}.interactionConfig.drillHierarchies[${f}].baseField`, m.baseField), Array.isArray(m.steps) && m.steps.forEach((S, u) => {
2359
+ Q(S) && Ge(a, `${t}.interactionConfig.drillHierarchies[${f}].steps[${u}].field`, S.field);
2360
+ }));
2361
+ });
2362
+ const d = e.preferences;
2363
+ if (!d) return a;
2364
+ const c = `${t}.preferences`;
2365
+ if (J(d, "formatNumber")) {
2366
+ const m = d.formatNumber, f = Q(m) && Object.keys(m).every((S) => S === "colorRanges");
2367
+ a.push(
2368
+ f ? { path: `${c}.formatNumber.colorRanges`, field: "colorRanges", replacement: `${Re} (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`" }
2369
+ );
2370
+ }
2371
+ J(d, "numberAxisFormat") && a.push({ path: `${c}.numberAxisFormat`, field: "numberAxisFormat", replacement: "`valueFormat` on `preferences.yAxisConfig` (or the axis it formats)" }), J(d, "columnSettings") && a.push({ path: `${c}.columnSettings`, field: "columnSettings", replacement: "`preferences.tablePrefs.columnSettingsMap`, keyed by column" });
2372
+ const p = d.kpiVisualOptions;
2373
+ J(p, "formatOptions") && a.push({ path: `${c}.kpiVisualOptions.formatOptions`, field: "formatOptions", replacement: "`format` on each measure in `config.metricColumns`; for a SQL KPI, `preferences.sqlKpiValue.format`" }), J(p, "queryComparisonPolarity") && a.push({ path: `${c}.kpiVisualOptions.queryComparisonPolarity`, field: "queryComparisonPolarity", replacement: "`preferences.sqlKpiValue.comparisonPolarity`" });
2374
+ const _ = d.tablePrefs;
2375
+ J(_, "conditionalFormatting") && a.push({ path: `${c}.tablePrefs.conditionalFormatting`, field: "conditionalFormatting", replacement: Re });
2376
+ const b = _ == null ? void 0 : _.columnSettingsMap;
2377
+ if (Q(b))
2378
+ for (const [m, f] of Object.entries(b)) {
2379
+ if (!Q(f)) continue;
2380
+ const S = `${c}.tablePrefs.columnSettingsMap.${m}`;
2381
+ for (const u of ["numberFormat", "dateFormat", "inheritMetricFormat"])
2382
+ J(f, u) && a.push({ path: `${S}.${u}`, field: u, replacement: u === "inheritMetricFormat" ? "nothing: a column follows its `format`" : qn });
2383
+ J(f, "colorRanges") && a.push({ path: `${S}.colorRanges`, field: "colorRanges", replacement: Re });
2384
+ }
2385
+ for (const m of Pn) {
2386
+ const f = d[m];
2387
+ if (Q(f)) {
2388
+ for (const S of ["formatMode", "mode", "formatOptions"])
2389
+ J(f, S) && a.push({ path: `${c}.${m}.${S}`, field: S, replacement: `\`preferences.${m}.valueFormat\` (absent means the column's format)` });
2390
+ m === "dataLabelsConfig" && J(f, "format") && a.push({ path: `${c}.${m}.format`, field: "format", replacement: "`preferences.dataLabelsConfig.valueFormat`" }), Ce(a, `${c}.${m}.valueFormat`, f.valueFormat);
2391
+ }
2392
+ }
2393
+ const v = d.sqlColumns;
2394
+ if (Q(v))
2395
+ for (const [m, f] of Object.entries(v))
2396
+ Q(f) && Ce(a, `${c}.sqlColumns.${m}.format`, f.format);
2397
+ return Q(d.sqlKpiValue) && Ce(a, `${c}.sqlKpiValue.format`, d.sqlKpiValue.format), a;
2398
+ }
2399
+ function Ln(e) {
2400
+ const t = `sheets[id=${e.sheetId}]`;
2401
+ switch (e.kind) {
2402
+ case "sheetCard":
2403
+ return `${t}.cards[id=${e.cardId}]`;
2404
+ case "frameCard":
2405
+ return `${t}.frames[id=${e.frameId}].cards[id=${e.cardId}]`;
2406
+ case "documentSectionCard":
2407
+ return `${t}.document.sections[id=${e.sectionId}].cards[id=${e.cardId}]`;
2408
+ }
2409
+ }
2410
+ function na(e) {
2411
+ if (!Q(e)) return [];
2412
+ if (Array.isArray(e.sheets))
2413
+ return ie(e).map((a) => ({
2414
+ card: a.card,
2415
+ at: Ln(a)
2416
+ }));
2417
+ const t = e;
2418
+ return Array.isArray(t.cards) ? t.cards.map((a) => ({ card: a, at: `cards[id=${a.id}]` })) : [];
2419
+ }
2420
+ function Ys(e) {
2421
+ return na(e).flatMap(({ card: t, at: a }) => oa(t, a));
2422
+ }
2423
+ function Bn(e, t) {
2424
+ var r;
2425
+ const a = (r = e.preferences) == null ? void 0 : r.conditionalFormatting;
2426
+ if (a === void 0) return [];
2427
+ const o = `${t}.preferences.conditionalFormatting`, n = eo.safeParse(a);
2428
+ return n.success ? to(e).map((s) => ({
2429
+ code: "invalid_conditional_formatting",
2430
+ path: `${o}.rules[id=${s.ruleId}].${s.path}`,
2431
+ message: s.message
2432
+ })) : n.error.issues.map((s) => ({
2433
+ code: "invalid_conditional_formatting",
2434
+ path: [o, ...s.path.map((i) => typeof i == "number" ? `[${i}]` : i)].join(".").replace(/\.\[/g, "["),
2435
+ message: s.message
2436
+ }));
2437
+ }
2438
+ function Ws(e) {
2439
+ return na(e).flatMap(({ card: t, at: a }) => [
2440
+ ...oa(t, a).map((o) => ({
2441
+ code: "retired_presentation_field",
2442
+ path: o.path,
2443
+ message: `\`${o.field}\` is retired: use ${o.replacement}.`
2444
+ })),
2445
+ ...Bn(t, a)
2446
+ ]);
2447
+ }
2448
+ const dt = [
2449
+ "metricColumns",
2450
+ "groupByColumns",
2451
+ "detailColumns",
2452
+ "pivotByColumns",
2453
+ "sortByColumns"
2454
+ ], Vn = [
2455
+ "xAxisConfig",
2456
+ "yAxisConfig",
2457
+ "secondaryYAxisConfig",
2458
+ "tooltipConfig",
2459
+ "dataLabelsConfig"
2460
+ ];
2461
+ function G(e) {
2462
+ return typeof e == "object" && e !== null && !Array.isArray(e);
2463
+ }
2464
+ function sa(e, t) {
2465
+ return JSON.stringify(e) === JSON.stringify(t);
2466
+ }
2467
+ function le(e, t) {
2468
+ const a = (o) => G(o) ? Object.fromEntries(
2469
+ Object.keys(o).sort().map((n) => [n, a(o[n])])
2470
+ ) : o;
2471
+ return sa(a(e), a(t));
2472
+ }
2473
+ function Pe(e) {
2474
+ const t = Ut(e);
2475
+ return t === "date" || t === "datetime";
2476
+ }
2477
+ function ra(e) {
2478
+ var t, a;
2479
+ return !!((t = e.sql) != null && t.trim() || (a = e.python) != null && a.trim());
2480
+ }
2481
+ function jn(e) {
2482
+ var t;
2483
+ return e.type === "kpi" && !!((t = e.sql) != null && t.trim());
2484
+ }
2485
+ function Je(e) {
2486
+ return e.type === "table" || e.type === "detailTable";
2487
+ }
2488
+ function H(e, t) {
2489
+ var o;
2490
+ const a = (o = e.config) == null ? void 0 : o[t];
2491
+ return Array.isArray(a) ? a : [];
2492
+ }
2493
+ function Kn(e, t) {
2494
+ for (const a of dt) {
2495
+ const o = H(e, a).indexOf(t);
2496
+ if (o >= 0) return `config.${a}[${o}]`;
2497
+ }
2498
+ }
2499
+ function ge(e, t) {
2500
+ let a = !1;
2501
+ for (const o of t)
2502
+ Object.prototype.hasOwnProperty.call(e, o) && (delete e[o], a = !0);
2503
+ return a;
2504
+ }
2505
+ function qe(e, t, a, o) {
2506
+ t.format = a, t.formatOrigin = "override", e.changes.push({
2507
+ path: o,
2508
+ action: "moved",
2509
+ to: `${Kn(e.card, t) ?? "config"}.format`
2510
+ });
2511
+ }
2512
+ function ct(e) {
2513
+ if (!G(e)) return;
2514
+ if (e.type === "temporal_bucket") return pe(e);
2515
+ const t = pe(e);
2516
+ return (t == null ? void 0 : t.type) === "currency" && t.currency === void 0 && xo(e) ? { ...t, currency: "USD" } : t;
2517
+ }
2518
+ function Xe(e, t, a) {
2519
+ if (!(!ae(t, "dateFormat") && !ae(t, "customFormat"))) {
2520
+ if (Pe(t.dataType) && t.format == null && t.dateFormat != null) {
2521
+ const o = io({
2522
+ fieldId: t.id,
2523
+ dataType: t.dataType,
2524
+ granularity: t.granularity,
2525
+ dateFormat: t.dateFormat,
2526
+ customFormat: t.customFormat
2527
+ });
2528
+ o.ok && (t.format = o.format, t.formatOrigin = "override", e.changes.push({
2529
+ path: `${a}.dateFormat`,
2530
+ action: "moved",
2531
+ to: `${a}.format`
2532
+ }));
2533
+ }
2534
+ ge(t, ["dateFormat", "customFormat"]) && e.changes.push({ path: `${a}.dateFormat`, action: "removed" });
2535
+ }
2536
+ }
2537
+ function Un(e, t, a) {
2538
+ if (!ae(t, "dateFormat") && !ae(t, "customFormat")) return;
2539
+ const o = t.dateFormat === "custom" ? t.customFormat : t.dateFormat;
2540
+ e.card.type === "detailTable" && Pe(t.dataType) && !t.format && typeof o == "string" && o.trim() ? (t.format = { type: "date", pattern: o }, t.formatOrigin = "override", e.changes.push({
2541
+ path: `${a}.dateFormat`,
2542
+ action: "moved",
2543
+ to: `${a}.format`
2544
+ })) : e.card.type === "detailTable" && Pe(t.dataType) && t.format && typeof o == "string" && o.trim() && !le(t.format, { type: "date", pattern: o }) && e.unconverted.push({
2545
+ path: `${a}.dateFormat`,
2546
+ reason: "detail_date_beside_format",
2547
+ detail: "A detail date pattern on a column that has a format of its own."
2548
+ }), ge(t, ["dateFormat", "customFormat"]) && e.changes.push({ path: `${a}.dateFormat`, action: "removed" });
2549
+ }
2550
+ function Gn(e, t, a, o) {
2551
+ if (t.format !== void 0) {
2552
+ const n = ct(t.format);
2553
+ n ? le(n, t.format) || (t.format = n, e.changes.push({ path: `${o}.format`, action: "cleaned" })) : (delete t.format, e.changes.push({ path: `${o}.format`, action: "removed" }));
2554
+ }
2555
+ a === "groupByColumns" || a === "pivotByColumns" ? Xe(e, t, o) : a === "detailColumns" ? Un(e, t, o) : ge(t, ["dateFormat", "customFormat"]) && e.changes.push({ path: `${o}.dateFormat`, action: "removed" });
2556
+ }
2557
+ function zn(e, t) {
2558
+ for (const a of dt)
2559
+ H(e.card, a).forEach((o, n) => {
2560
+ var s;
2561
+ if (!o.format || o.formatOrigin) return;
2562
+ const r = (s = t.modelFormatFor) == null ? void 0 : s.call(t, o);
2563
+ o.formatOrigin = r && le(pe(r), o.format) ? "semantic" : "override", e.changes.push({
2564
+ path: `config.${a}[${n}].formatOrigin`,
2565
+ action: "marked"
2566
+ });
2567
+ });
2568
+ }
2569
+ function Qn(e) {
2570
+ var a;
2571
+ const t = (a = e.card.interactionConfig) == null ? void 0 : a.drillHierarchies;
2572
+ Array.isArray(t) && t.forEach((o, n) => {
2573
+ if (!G(o)) return;
2574
+ const r = `interactionConfig.drillHierarchies[${n}]`;
2575
+ G(o.baseField) && Xe(e, o.baseField, `${r}.baseField`), Array.isArray(o.steps) && o.steps.forEach((s, i) => {
2576
+ if (G(s) && G(s.field)) {
2577
+ const d = s.field, c = `${r}.steps[${i}].field`;
2578
+ if (d.format !== void 0) {
2579
+ const p = ct(d.format);
2580
+ p && !le(p, d.format) && (d.format = p, e.changes.push({ path: `${c}.format`, action: "cleaned" }));
2581
+ }
2582
+ Xe(e, d, c);
2583
+ }
2584
+ });
2585
+ });
2586
+ }
2587
+ const Hn = [
2588
+ "numberFormat",
2589
+ "dateFormat",
2590
+ "inheritMetricFormat",
2591
+ "colorRanges"
2592
+ ];
2593
+ function Yn(e, t) {
2594
+ const a = (n) => n == null ? void 0 : n.trim().toLowerCase(), o = a(t);
2595
+ return [
2596
+ e.id,
2597
+ e.alias,
2598
+ e.name,
2599
+ e.qualifiedFieldName,
2600
+ e.label,
2601
+ e.role === "metric" ? Do(e) : void 0
2602
+ ].some((n) => n !== void 0 && a(n) === o);
2603
+ }
2604
+ function Pt(e, t) {
2605
+ const a = co(e, { columnId: t });
2606
+ if (a) return a;
2607
+ const o = [
2608
+ ...H(e, "detailColumns"),
2609
+ ...H(e, "metricColumns"),
2610
+ ...H(e, "groupByColumns")
2611
+ ].filter((n) => Yn(n, t));
2612
+ return o.length === 1 ? o[0] : void 0;
2613
+ }
2614
+ function Wn(e) {
2615
+ return e.type === "number" && G(e.numberFormat) && e.inheritMetricFormat !== !0;
2616
+ }
2617
+ function Jn(e, t) {
2618
+ var a;
2619
+ return Pe(t.dataType) ? H(e, "detailColumns").includes(t) ? e.type === "detailTable" : _o(t.granularity) || ((a = t.format) == null ? void 0 : a.type) === "temporal_bucket" || t.semanticTemporalPresentation != null : !1;
2620
+ }
2621
+ function qt(e, t, a, o) {
2622
+ var s;
2623
+ const n = (s = e.card).preferences ?? (s.preferences = {}), r = n.sqlColumns ?? (n.sqlColumns = {});
2624
+ r[t] = { ...r[t], format: a }, e.changes.push({ path: o, action: "moved", to: `preferences.sqlColumns[${JSON.stringify(t)}].format` });
2625
+ }
2626
+ function Xn(e) {
2627
+ const [t, ...a] = e;
2628
+ if (!t) return;
2629
+ const o = Object.fromEntries(
2630
+ Object.entries(t).filter(([n, r]) => a.every((s) => sa(s[n], r)))
2631
+ );
2632
+ return at.safeParse(o).success ? o : void 0;
2633
+ }
2634
+ function Zn(e, t) {
2635
+ const a = e.card, o = $o({
2636
+ groupByColumns: H(a, "groupByColumns"),
2637
+ metricColumns: H(a, "metricColumns"),
2638
+ pivotByColumns: H(a, "pivotByColumns"),
2639
+ detailColumns: a.type === "detailTable" ? H(a, "detailColumns") : []
2640
+ });
2641
+ for (const [n, r] of t) {
2642
+ const s = r.find((d) => d.key === o.get(n)), i = s ?? r[0];
2643
+ if (qe(e, n, i.format, i.from), !s)
2644
+ for (const d of r)
2645
+ d !== i && !le(d.format, i.format) && e.unconverted.push({
2646
+ path: d.from,
2647
+ reason: "ambiguous_column_setting",
2648
+ detail: `"${d.key}" and "${i.key}" both name ${n.id}.`
2649
+ });
2650
+ }
2651
+ }
2652
+ function es(e, t) {
2653
+ var r;
2654
+ if (!t.length) return;
2655
+ const a = H(e.card, "metricColumns"), o = a.length === 1 ? a[0] : void 0, n = o && !o.format ? Xn(t.map((s) => s.format)) : void 0;
2656
+ o && n && qe(e, o, n, t[0].from);
2657
+ for (const s of t)
2658
+ if (!(o != null && o.format && le(s.format, o.format))) {
2659
+ if (!a.length) {
2660
+ e.unconverted.push({
2661
+ path: s.from,
2662
+ reason: "generated_count_pivot_format",
2663
+ detail: `"${s.key}" is one pivot value's column on a table with no measure; it formats the row count the query adds.`
2664
+ });
2665
+ continue;
2666
+ }
2667
+ e.unconverted.push(
2668
+ ((r = o == null ? void 0 : o.format) == null ? void 0 : r.type) === s.format.type ? {
2669
+ path: s.from,
2670
+ reason: "pivot_value_format_difference",
2671
+ detail: `"${s.key}" is one pivot value's column; its format differs from its measure's, which every pivot value now shows.`
2672
+ } : {
2673
+ path: s.from,
2674
+ reason: "per_pivot_value_format",
2675
+ detail: `"${s.key}" is one pivot value's column; a card column holds one format for every pivot value.`
2676
+ }
2677
+ );
2678
+ }
2679
+ }
2680
+ function ts(e) {
2681
+ var d;
2682
+ const t = (d = e.card.preferences) == null ? void 0 : d.tablePrefs, a = t == null ? void 0 : t.columnSettingsMap;
2683
+ if (!G(a)) return;
2684
+ const o = e.card, n = ra(o), r = H(o, "pivotByColumns").length > 0, s = /* @__PURE__ */ new Map(), i = [];
2685
+ for (const [c, p] of Object.entries(a)) {
2686
+ if (!G(p)) continue;
2687
+ const _ = p, b = `preferences.tablePrefs.columnSettingsMap[${JSON.stringify(c)}]`;
2688
+ if (Wn(_)) {
2689
+ const v = ao(_.numberFormat);
2690
+ if (v && n)
2691
+ qt(e, c, v, `${b}.numberFormat`);
2692
+ else if (v && Je(o)) {
2693
+ const m = Pt(o, c), f = { key: c, format: v, from: `${b}.numberFormat` };
2694
+ m ? s.set(m, [...s.get(m) ?? [], f]) : r ? i.push(f) : e.unconverted.push({
2695
+ path: f.from,
2696
+ reason: "unmatched_column_setting",
2697
+ detail: `"${c}" names no card column.`
2698
+ });
2699
+ } else v && o.type !== "matrixTable" && o.type !== "kpi" && H(o, "metricColumns").some(
2700
+ (f) => f.comparison != null
2701
+ ) && e.unconverted.push({
2702
+ path: `${b}.numberFormat`,
2703
+ reason: "chart_comparison_column_setting",
2704
+ detail: `"${c}" formats this chart's comparison tooltip only.`
2705
+ });
2706
+ }
2707
+ if (G(_.dateFormat)) {
2708
+ const v = _.type === "date";
2709
+ if (v && n)
2710
+ qt(e, c, oo(_.dateFormat), `${b}.dateFormat`);
2711
+ else if (v && Je(o)) {
2712
+ const m = Pt(o, c);
2713
+ (!m || !Jn(o, m)) && e.unconverted.push({
2714
+ path: `${b}.dateFormat`,
2715
+ reason: "config_column_date_setting",
2716
+ detail: `"${c}"'s download formats its dates with this setting.`
2717
+ });
2718
+ }
2719
+ }
2720
+ for (const v of Hn)
2721
+ Object.prototype.hasOwnProperty.call(_, v) && (delete _[v], e.changes.push({ path: `${b}.${v}`, action: "removed" }));
2722
+ }
2723
+ Zn(e, s), es(e, i);
2724
+ }
2725
+ function as(e) {
2726
+ return Object.keys(e).some(
2727
+ (t) => t !== "enabled" && t !== "colorRanges" && e[t] !== void 0
2728
+ );
2729
+ }
2730
+ function os(e) {
2731
+ return (e == null ? void 0 : e.enabled) === !1 || (e == null ? void 0 : e.enabled) === "false";
2732
+ }
2733
+ function ns(e) {
2734
+ const t = e.card, a = t.preferences;
2735
+ if (!a) return;
2736
+ const o = a.kpiVisualOptions, n = G(o == null ? void 0 : o.formatOptions) ? o.formatOptions : void 0, r = a, s = G(r.formatNumber) ? r.formatNumber : void 0, i = n ? pe(no(n)) : void 0, d = s && as(s) ? pe(so(s)) : void 0;
2737
+ if (t.type === "kpi") {
2738
+ if (os(s) && e.unconverted.push({
2739
+ path: "preferences.formatNumber.enabled",
2740
+ reason: "raw_display",
2741
+ detail: "Formatting is switched off on this KPI."
2742
+ }), jn(t)) {
2743
+ const c = i ?? d, p = o == null ? void 0 : o.queryComparisonPolarity;
2744
+ (c || p) && (a.sqlKpiValue = {
2745
+ ...a.sqlKpiValue,
2746
+ ...c ? { format: c } : {},
2747
+ ...p ? { comparisonPolarity: p } : {}
2748
+ }, e.changes.push({
2749
+ path: i ? "preferences.kpiVisualOptions.formatOptions" : "preferences.formatNumber",
2750
+ action: "moved",
2751
+ to: "preferences.sqlKpiValue"
2752
+ }));
2753
+ } else
2754
+ H(t, "metricColumns").forEach((p) => {
2755
+ i ? qe(e, p, i, "preferences.kpiVisualOptions.formatOptions") : d && !p.format && qe(e, p, d, "preferences.formatNumber");
2756
+ });
2757
+ ss(e, s);
2758
+ } else if (d) {
2759
+ const c = H(t, "metricColumns");
2760
+ ra(t) ? e.unconverted.push({
2761
+ path: "preferences.formatNumber",
2762
+ reason: "sql_card_wide_format",
2763
+ detail: "A card-wide number format on a SQL or Python card."
2764
+ }) : !Je(t) && t.type !== "matrixTable" && c.some((p) => !p.format) && e.unconverted.push({
2765
+ path: "preferences.formatNumber",
2766
+ reason: "chart_card_wide_format",
2767
+ detail: "A card-wide number format on a chart measure without a format of its own."
2768
+ });
2769
+ }
2770
+ if (!s && ae(r, "formatNumber") && (delete r.formatNumber, e.changes.push({ path: "preferences.formatNumber", action: "removed" })), s) {
2771
+ const c = s.colorRanges;
2772
+ Array.isArray(c) && c.length > 0 ? r.formatNumber = { colorRanges: c } : delete r.formatNumber, e.changes.push({ path: "preferences.formatNumber", action: "removed" });
2773
+ }
2774
+ o && ge(o, ["formatOptions", "queryComparisonPolarity"]) && (e.changes.push({ path: "preferences.kpiVisualOptions.formatOptions", action: "removed" }), Object.keys(o).length === 0 && delete a.kpiVisualOptions);
2775
+ for (const c of ["numberAxisFormat", "columnSettings"])
2776
+ ge(a, [c]) && e.changes.push({ path: `preferences.${c}`, action: "removed" });
2777
+ }
2778
+ function ss(e, t) {
2779
+ var r;
2780
+ const a = t == null ? void 0 : t.decimalPlaces, o = e.card.preferences;
2781
+ if (typeof a != "number" || ((r = o.comparisonPresentation) == null ? void 0 : r.precision) !== void 0) return;
2782
+ const n = Fo(a);
2783
+ n !== void 0 && (o.comparisonPresentation = {
2784
+ ...o.comparisonPresentation,
2785
+ precision: n
2786
+ }, e.changes.push({
2787
+ path: "preferences.formatNumber.decimalPlaces",
2788
+ action: "moved",
2789
+ to: "preferences.comparisonPresentation.precision"
2790
+ }));
2791
+ }
2792
+ const rs = /* @__PURE__ */ new Set(["number", "currency", "percent", "scientific", "date", "duration"]);
2793
+ function is(e) {
2794
+ const t = e.card.preferences;
2795
+ if (t)
2796
+ for (const a of Vn) {
2797
+ const o = t[a];
2798
+ if (!G(o)) continue;
2799
+ const n = `preferences.${a}`, r = G(o.formatOptions) ? o.formatOptions : void 0, s = a === "dataLabelsConfig" && typeof o.format == "string" ? o.format : void 0, i = o.formatMode === "override" || o.formatMode === "inherit" ? o.formatMode : o.mode === "override" || o.mode === "inherit" ? o.mode : void 0, d = i ?? (s === "none" ? "raw" : s && s !== "auto" || r ? "override" : "inherit");
2800
+ if (d === "raw" || i === void 0 && s === "none")
2801
+ e.unconverted.push({ path: `${n}.format`, reason: "raw_display", detail: "Data labels show raw values." });
2802
+ else if (d === "override") {
2803
+ const c = r && r.type ? r : s && rs.has(s) ? { ...r, type: s } : r, p = c ? pe(ro(c, { preserveOmittedProperties: !0 })) : void 0;
2804
+ p && (o.valueFormat = p, e.changes.push({ path: `${n}.formatOptions`, action: "moved", to: `${n}.valueFormat` }));
2805
+ }
2806
+ ge(o, ["formatMode", "mode", "formatOptions", ...a === "dataLabelsConfig" ? ["format"] : []]) && e.changes.push({ path: `${n}.formatMode`, action: "removed" });
2807
+ }
2808
+ }
2809
+ function ds(e) {
2810
+ var o;
2811
+ const t = (o = e.card.config) == null ? void 0 : o.matrix, a = G(t) && G(t.presentation) ? t.presentation : void 0;
2812
+ if (a)
2813
+ for (const n of ["measureFormats", "levelFormats"]) {
2814
+ const r = a[n];
2815
+ if (G(r))
2816
+ for (const [s, i] of Object.entries(r)) {
2817
+ const d = ct(i);
2818
+ d && !le(d, i) && (r[s] = d, e.changes.push({ path: `config.matrix.presentation.${n}[${JSON.stringify(s)}]`, action: "cleaned" }));
2819
+ }
2820
+ }
2821
+ }
2822
+ function cs(e, t = {}) {
2823
+ const a = { card: structuredClone(e), changes: [], unconverted: [] };
2824
+ for (const o of dt)
2825
+ H(a.card, o).forEach((n, r) => {
2826
+ G(n) && Gn(a, n, o, `config.${o}[${r}]`);
2827
+ });
2828
+ return Qn(a), ts(a), ns(a), is(a), ds(a), zn(a, t), a.changes.length === 0 && a.unconverted.length === 0 ? { card: e, changes: [], unconverted: [] } : a;
2829
+ }
2830
+ const ls = "__semaphor_unassigned_trigger__", us = "__NULL__";
2831
+ function fs(e) {
2832
+ var t, a;
2833
+ return !!((t = e.sql) != null && t.trim() || (a = e.python) != null && a.trim());
2834
+ }
2835
+ function ms(e) {
2836
+ const t = e.config;
2837
+ return t ? e.type === "detailTable" ? t.detailColumns ?? [] : [...t.detailColumns ?? [], ...t.metricColumns ?? [], ...t.groupByColumns ?? []] : [];
2838
+ }
2839
+ function Mt(e) {
2840
+ return [e.id, e.alias, e.name, e.qualifiedFieldName, e.label];
2841
+ }
2842
+ function hs(e, t) {
2843
+ var c, p;
2844
+ const a = ((c = e.config) == null ? void 0 : c.metricColumns) ?? [], o = ((p = e.config) == null ? void 0 : p.pivotByColumns) ?? [];
2845
+ if (a.length !== 1 || o.length !== 1) return { reason: "pivot_key_form" };
2846
+ const n = a[0], r = o[0], s = n.aliasTemplate ?? "", i = s.includes(`{{${r.name}}}`) || s.includes(`{{${r.entityName}.${r.name}}}`), d = !!(n.valueAliases && Object.keys(n.valueAliases).length);
2847
+ return i || d || /["'`\t\n\r]/.test(t) || t.startsWith("col_") ? { reason: "pivot_key_form" } : {
2848
+ ref: {
2849
+ kind: "pivot",
2850
+ metricId: n.id,
2851
+ members: [{ fieldId: r.id, value: t === us ? null : t }]
2852
+ }
2853
+ };
2854
+ }
2855
+ function ps(e, t) {
2856
+ var s, i;
2857
+ if (t === ls) return { reason: "unassigned_trigger" };
2858
+ if (fs(e)) return { ref: { kind: "result", key: t } };
2859
+ const a = ms(e), o = a.filter((d) => Mt(d).includes(t)), n = o.length ? o : a.filter((d) => Mt(d).some((c) => (c == null ? void 0 : c.trim().toLowerCase()) === t.trim().toLowerCase())), r = [...new Set(n.map((d) => d.id))];
2860
+ return r.length === 1 ? { ref: { kind: "field", fieldId: r[0] } } : r.length > 1 ? { reason: "ambiguous_column" } : (i = (s = e.config) == null ? void 0 : s.pivotByColumns) != null && i.length ? hs(e, t) : { reason: "no_matching_column" };
2861
+ }
2862
+ function Lt(e, t, a, o, n) {
2863
+ const r = (k, O, E) => {
2864
+ o.push({ ruleId: e.id, name: e.name, enabled: e.enabled !== !1, path: `${a}.${k}`, reference: O, reason: E });
2865
+ }, s = e.condition.columnId ?? "", i = t(s);
2866
+ if (!("ref" in i)) return r("condition.columnId", s, i.reason);
2867
+ const d = e.target.level, c = d === "row" ? e.target.applyToColumnIds : e.target.columnIds;
2868
+ if (d === "cell" && !(c != null && c.length) && e.enabled !== !1)
2869
+ return r("target.columnIds", "", "every_column");
2870
+ const p = [];
2871
+ for (const [k, O] of (c ?? []).entries()) {
2872
+ const E = t(O);
2873
+ if (!("ref" in E))
2874
+ return r(`target.${d === "row" ? "applyToColumnIds" : "columnIds"}[${k}]`, O, E.reason);
2875
+ p.push(E.ref);
2876
+ }
2877
+ const {
2878
+ columnIds: _,
2879
+ applyToColumnIds: b,
2880
+ conditionColumnId: v,
2881
+ matrix: m,
2882
+ rowRoles: f,
2883
+ depth: S,
2884
+ includeTotals: u,
2885
+ includeSubtotals: g,
2886
+ ...F
2887
+ } = e.target, { columnId: $, ...x } = e.condition, N = {
2888
+ ...F,
2889
+ ...p.length ? { columns: p } : {},
2890
+ // The Matrix scope means something only on a Matrix card.
2891
+ ...n ? {
2892
+ ...m !== void 0 ? { matrix: m } : {},
2893
+ ...f !== void 0 ? { rowRoles: f } : {},
2894
+ ...S !== void 0 ? { depth: S } : {},
2895
+ ...u !== void 0 ? { includeTotals: u } : {},
2896
+ ...g !== void 0 ? { includeSubtotals: g } : {}
2897
+ } : {}
2898
+ };
2899
+ return {
2900
+ ...e,
2901
+ condition: { ...x, column: i.ref },
2902
+ target: N
2903
+ };
2904
+ }
2905
+ function gs(e, t) {
2906
+ var n, r, s;
2907
+ const a = (n = e.sql) != null && n.trim() ? { kind: "sqlKpiValue" } : (s = (r = e.config) == null ? void 0 : r.metricColumns) != null && s[0] ? { kind: "field", fieldId: e.config.metricColumns[0].id } : void 0;
2908
+ if (!a) return [];
2909
+ const o = (i) => i === null ? 0 : typeof i == "number" || typeof i == "string" || typeof i == "boolean" ? Number(i) : NaN;
2910
+ return t.flatMap((i, d) => {
2911
+ if (!i || typeof i != "object") return [];
2912
+ const { start: c, end: p, color: _ } = i, b = o(c), v = o(p);
2913
+ if (Number.isNaN(b) || Number.isNaN(v) || b > v || b === 1 / 0 || v === -1 / 0) return [];
2914
+ const m = b === -1 / 0 ? void 0 : b, f = v === 1 / 0 ? void 0 : v, S = m !== void 0 && f !== void 0 ? { kind: "between", column: a, min: m, max: f, inclusive: !0 } : m !== void 0 ? { kind: "comparison", column: a, operator: "gte", value: m } : f !== void 0 ? { kind: "comparison", column: a, operator: "lte", value: f } : { kind: "blank", column: a, isBlank: !1 }, u = typeof _ == "string" ? _ : "";
2915
+ return [{ id: `kpi-color-range-${d + 1}`, condition: S, target: { level: "cell" }, style: { textColor: u } }];
2916
+ }).reverse();
2917
+ }
2918
+ function bs(e) {
2919
+ var p, _, b, v, m, f, S;
2920
+ const t = structuredClone(e), a = [], o = [], n = [], r = (u) => {
2921
+ a.some((g) => g.from.startsWith(u)) || a.push({ ruleId: "", action: "removed", from: u });
2922
+ }, s = (p = t.preferences) == null ? void 0 : p.tablePrefs;
2923
+ if (s && ae(s, "conditionalFormatting")) {
2924
+ const u = s.conditionalFormatting, g = "preferences.tablePrefs.conditionalFormatting", F = t.type === "table" || t.type === "detailTable";
2925
+ ((u == null ? void 0 : u.rules) ?? []).forEach(($, x) => {
2926
+ var k;
2927
+ if (!F || ((k = $.target) == null ? void 0 : k.matrix) !== void 0) {
2928
+ a.push({ ruleId: $.id, action: "removed", from: `${g}.rules[${x}]` });
2929
+ return;
2930
+ }
2931
+ const N = Lt($, (O) => ps(t, O), `${g}.rules[${x}]`, o, !1);
2932
+ N && (n.push(N), a.push({ ruleId: $.id, action: "moved", from: `${g}.rules[${x}]` }));
2933
+ }), delete s.conditionalFormatting, o.some(($) => $.path.startsWith(g)) || r(g);
2934
+ }
2935
+ const i = (b = (_ = t.config) == null ? void 0 : _.matrix) == null ? void 0 : b.presentation;
2936
+ if (i && ae(i, "conditionalFormatting")) {
2937
+ const u = i.conditionalFormatting, g = "config.matrix.presentation.conditionalFormatting", F = new Set((m = (v = t.config) == null ? void 0 : v.matrix) == null ? void 0 : m.spec.measures.map(($) => $.id));
2938
+ ((u == null ? void 0 : u.rules) ?? []).forEach(($, x) => {
2939
+ const N = Lt(
2940
+ $,
2941
+ (k) => F.has(k) ? { ref: { kind: "matrixMeasure", measureId: k } } : { reason: "no_matching_column" },
2942
+ `${g}.rules[${x}]`,
2943
+ o,
2944
+ !0
2945
+ );
2946
+ N && (n.push(N), a.push({ ruleId: $.id, action: "moved", from: `${g}.rules[${x}]` }));
2947
+ }), delete i.conditionalFormatting, o.some(($) => $.path.startsWith(g)) || r(g);
2948
+ }
2949
+ const d = t.preferences, c = d == null ? void 0 : d.formatNumber;
2950
+ if (c && ae(c, "colorRanges")) {
2951
+ const u = Array.isArray(c.colorRanges) ? c.colorRanges : [];
2952
+ if (t.type === "kpi") {
2953
+ const g = gs(t, u);
2954
+ n.push(...g), g.forEach((F) => a.push({ ruleId: F.id, action: "moved", from: "preferences.formatNumber.colorRanges" }));
2955
+ }
2956
+ delete c.colorRanges, Object.keys(c).length === 0 && delete d.formatNumber, a.some((g) => g.from === "preferences.formatNumber.colorRanges") || a.push({ ruleId: "", action: "removed", from: "preferences.formatNumber.colorRanges" });
2957
+ }
2958
+ if (!a.length && !o.length) return { card: e, changes: [], unresolved: [] };
2959
+ if (n.length) {
2960
+ const u = ((S = (f = t.preferences) == null ? void 0 : f.conditionalFormatting) == null ? void 0 : S.rules) ?? [], g = new Set(u.map((F) => F.id));
2961
+ t.preferences = {
2962
+ ...t.preferences,
2963
+ conditionalFormatting: {
2964
+ version: 1,
2965
+ rules: [...u, ...n.filter((F) => !g.has(F.id))]
2966
+ }
2967
+ };
2968
+ }
2969
+ return { card: t, changes: a, unresolved: o };
2970
+ }
2971
+ function Js(e, t = {}) {
2972
+ const { only: a, ...o } = t, n = a === "rules" ? void 0 : cs(e, o), r = a === "formats" ? void 0 : bs((n == null ? void 0 : n.card) ?? e);
2973
+ return { card: (r == null ? void 0 : r.card) ?? (n == null ? void 0 : n.card) ?? e, formats: n, rules: r };
2974
+ }
2295
2975
  export {
2296
- Ui as AGGREGATES,
2297
- ji as AUTOMATIC_TEMPORAL_BUCKET_FORMAT,
2298
- zi as CALCULATED_FIELDS_GROUP_ID,
2299
- Qi as CALCULATED_FIELDS_GROUP_NAME,
2300
- Ki as CARD_CONFIG_KEY_CLASSES,
2301
- Wi as CARD_KEY_CLASSES,
2302
- _a as CARD_QUERY_CONFIG_KEYS,
2303
- hi as CARD_QUERY_REQUEST_DESCRIPTIVE_FIELDS,
2304
- ui as CARD_QUERY_REQUEST_EXECUTED_FIELDS,
2305
- Hi as CARD_TYPES,
2306
- ce as CARD_TYPE_RULES,
2307
- Yi as COLUMN_KEY_CLASSES,
2308
- Xi as COLUMN_PRESENTATION_KEYS,
2309
- Ji as CONTROL_BINDING_MAPPING_MISSING_ERROR_CODE,
2310
- Zi as CONTROL_BINDING_TARGET_INVALID_ERROR_CODE,
2311
- en as CONTROL_BINDING_VALUE_INVALID_ERROR_CODE,
2312
- tn as CONTROL_CONTEXT_UNSUPPORTED_ERROR_CODE,
2313
- an as CONTROL_DEFINITION_DUPLICATE_ERROR_CODE,
2314
- sn as CONTROL_DEFINITION_INVALID_ERROR_CODE,
2315
- nn as CONTROL_PLACEHOLDER_QUOTED_ERROR_CODE,
2316
- on as CONTROL_REFERENCE_MISSING_ERROR_CODE,
2317
- rn as CONTROL_VALUE_INVALID_ERROR_CODE,
2318
- dn as CONTROL_VALUE_MISSING_ERROR_CODE,
2319
- H as CardQueryRequestError,
2320
- ln as ControlResolutionError,
2321
- it as DASHBOARD_AUTHORING_MAX_GENERATED_CARDS,
2322
- cn as DASHBOARD_CHANGE_OPS,
2323
- un as DASHBOARD_DEFAULT_OPTION_DEPENDENCIES,
2324
- Tr as DASHBOARD_FILTER_OPERATIONS,
2325
- hn as DASHBOARD_INPUT_RUNTIME_SCOPE_KINDS,
2326
- Dr as DOCUMENT_KPI_SECTION_MAX_CARDS,
2327
- kr as DOCUMENT_KPI_SECTION_MAX_TILES,
2328
- fn as DashboardFilterMappingContractError,
2329
- pn as ExecutionControlContractError,
2330
- mn as FILTER_OPERATORS,
2331
- gn as FilterModelError,
2332
- bn as LEGACY_TABLE_CARD_TYPES,
2333
- Pr as LEGACY_TABLE_ROUTING_ID_NAMESPACE,
2334
- ot as MAX_PROPOSED_CHANGES,
2335
- In as MAX_QUERY_LIMIT,
2336
- yi as NEW_CARD_TYPE,
2337
- yn as QUERY_ASPECTS,
2338
- _n as QUERY_CONFIG_KEY_ASPECTS,
2339
- _i as RELATIONSHIP_ROUTE_CHANGED_MESSAGE,
2340
- Cn as SEMAPHOR_CARTESIAN_CHART_TYPES,
2341
- Sn as TIME_GRAINS,
2342
- vn as TOOLBAR_FILTER_REACH_FIELDS,
2343
- wn as analyticsFilterSchema,
2344
- Mr as applyCardReferenceRemapping,
2345
- nt as applyDashboardOperations,
2346
- Lr as applyFilterApplicability,
2347
- Ci as applyFilterSettingsChange,
2348
- Br as applyGroupByOverride,
2349
- xn as applyLinkedClickToFilterOverrides,
2350
- Tn as applyOptionDependencyOverride,
2351
- Si as buildCardExportFormatOptions,
2352
- Vr as buildCardExportQueryContext,
2353
- vi as buildCardExportRequest,
2354
- wi as buildCardExportRequestFromOptions,
2355
- xi as buildColumnCatalog,
2356
- Dn as buildControlDefinitionIndex,
2357
- ha as buildDashboardCardSourceIndex,
2358
- Ti as buildEntityColumnGroup,
2359
- Di as buildFilterInputFromDefinition,
2360
- qt as buildFilterInputFromField,
2361
- kn as buildLinkedClickToFilterOverrides,
2362
- $n as buildProposeChangeInputSchema,
2363
- Fn as buildSavedEditorCard,
2364
- ki as buildTableExportFormatOptions,
2365
- An as cardQueryPatchSchema,
2366
- Rn as cardTypeSentenceName,
2367
- Ca as changeCardType,
2368
- En as changeMatrixEditor,
2369
- Lt as clickToFilterSettingsSchema,
2370
- Gr as collectJoinPlanIdentifiers,
2371
- sa as columnDataset,
2372
- Sa as columnFieldKey,
2373
- Ta as columnKeys,
2374
- li as compileDashboardFromPlan,
2375
- Ur as composeCardReferenceRemapping,
2376
- On as controlBindingExecutionSchema,
2377
- Nn as controlDefinitionExecutionSchema,
2378
- la as controlRefusal,
2379
- qn as createDashboardFilterBindingId,
2380
- fd as createMatrixAuthoringDraft,
2381
- pd as createMatrixConfig,
2382
- Pt as createNewCard,
2383
- Ve as dashboardAuthoringDatasetMatchesSource,
2384
- ri as dashboardAuthoringFieldsReferToSameTarget,
2385
- J as dashboardAuthoringSourceFromField,
2386
- ni as dashboardAuthoringSourceKey,
2387
- wt as dashboardAuthoringSourcesReferToSameDataset,
2388
- Pn as dashboardCardFilterSourceInventoryContains,
2389
- ia as dashboardChangeSchema,
2390
- Mn as dashboardFilterTargetMatchesLogicalValue,
2391
- $r as dashboardFilterValueTypeForDataType,
2392
- Ln as dashboardGenerateSchema,
2393
- Zt as dashboardInputScopeIncludesDocumentSheets,
2394
- ci as dashboardPlanFromSemaphorDashboardIntent,
2395
- Bn as defaultClickToFilterSettings,
2396
- jr as describeDashboardFilterCardReach,
2397
- ve as describeDashboardFilterCardReachDetail,
2398
- da as describeQueryChange,
2399
- $i as describeRelationshipRoute,
2400
- Fi as describeRelationshipSkip,
2401
- Vn as doesDashboardInputApplyToTarget,
2402
- Gn as doesDashboardInputSurviveCarriedContext,
2403
- Un as doesToolbarFilterReachTab,
2404
- Ai as domainCalculatedFields,
2405
- jn as dropMatrixEditorField,
2406
- aa as fieldIdentityKey,
2407
- zn as fieldRefSchema,
2408
- zr as filterApplicabilityContextForCard,
2409
- Ri as filterReachPreviewAnswers,
2410
- Qr as filterValueReachForCard,
2411
- Qn as filterValueSemanticDataset,
2412
- _t as findCatalogField,
2413
- di as findDashboardAuthoringDatasetForSource,
2414
- Kn as findDashboardCardExecutableSource,
2415
- Wn as findDashboardCardPinnedCatalogSource,
2416
- Hn as findDashboardSqlPinnedCatalogSource,
2417
- ta as findSortedColumn,
2418
- Ei as flattenEntityColumns,
2419
- Yn as foldPrototypeDocumentInputs,
2420
- Xn as formatFilterModelIssues,
2421
- Qt as formatResolvedPrimaryDateFieldIssues,
2422
- Kr as formatSkippedFilterWarnings,
2423
- Oi as getCalculatedFieldAggregateOverrides,
2424
- Jn as getCalculatedFieldNamespace,
2425
- Ni as getCalculatedFieldParameters,
2426
- qi as getCalculatedFieldShelfOverrides,
2427
- Zn as getCardDefinition,
2428
- eo as getColumnCatalogFieldId,
2429
- Ya as getDashboardAuthoringCardSource,
2430
- Pi as getDashboardFilterSubscriptionHint,
2431
- to as getDashboardGlobalDateFilter,
2432
- Fr as getDocumentKpiSectionShapeIssues,
2433
- Ar as getDocumentSectionCards,
2434
- Mi as getDomainCalculatedSelectionOverrides,
2435
- ao as getFieldAggregationOptions,
2436
- so as getMatrixBindingTargets,
2437
- md as getMatrixLevelLabel,
2438
- gd as getMatrixMeasureLabel,
2439
- io as getStableDomainCalculatedFieldId,
2440
- no as getTemporalBucketAuthoringOptions,
2441
- oo as getTemporalBucketAuthoringSelection,
2442
- ro as handleSchema,
2443
- Li as hasDashboardFilterSubscription,
2444
- lo as hasToolbarFilterReachField,
2445
- Wr as hostFilterValueFor,
2446
- Hr as hostFilterValuesToSlots,
2447
- _d as inspectMatrixCardConfig,
2448
- Yr as isAdHocFilterValueOnTab,
2449
- co as isAllowedDashboardInputScopeCombination,
2450
- uo as isCardType,
2451
- Rr as isDashboardFilterOperationCompatible,
2452
- yt as isDashboardInputOnTab,
2453
- ho as isDashboardInputOwnedBySheet,
2454
- jt as isDashboardInputScopeEmpty,
2455
- fo as isGroupedDate,
2456
- po as isLegacyTableCard,
2457
- me as isMaterializableDashboardAuthoringSource,
2458
- mo as isPresentationCurrencyBinding,
2459
- go as isSemanticAutoJoinCard,
2460
- bo as isSemaphorCartesianChartType,
2461
- Va as isSemaphorSourceRef,
2462
- Io as isStructuralControlBinding,
2463
- yo as isValidControlOptionPresentation,
2464
- ea as labelAt,
2465
- _o as layoutArrangeSchema,
2466
- Xr as legacyTableRoutingIds,
2467
- Jr as legacyTableRoutingTarget,
2468
- Co as linkedClickToFilterOverridesSchema,
2469
- Zr as listAdHocFilterValuesOnTab,
2470
- re as listDashboardCardLocations,
2471
- So as listDashboardFilterDefinitions,
2472
- vo as listDashboardFilterInputsOnTab,
2473
- wo as listDashboardInputReachKeys,
2474
- Yt as listDashboardInputScopeExceptedCardIds,
2475
- Jt as listDashboardInputScopeExceptedSheetIds,
2476
- Me as listDashboardTabTargets,
2477
- ed as listFilterInputValueTargets,
2478
- xo as listStoredFilterDefinitions,
2479
- Er as mapDashboardCards,
2480
- Or as mapDocumentSectionCards,
2481
- To as matchColumns,
2482
- td as matrixCatalogSources,
2483
- xa as matrixColumnKeys,
2484
- Do as matrixColumnsSchema,
2485
- Cd as matrixDefinitionFieldRefs,
2486
- Sd as matrixDefinitionFields,
2487
- vd as matrixDefinitionSources,
2488
- ko as matrixEditorCatalogFromFields,
2489
- ad as matrixExecutionSources,
2490
- $o as measureRefSchema,
2491
- we as mergeDashboardAuthoringSources,
2492
- bd as mergeMatrixSorts,
2493
- ma as metricCardQuerySchema,
2494
- wa as moveMatrixLevel,
2495
- Fo as normalizeClickToFilterSettings,
2496
- Ao as normalizeDashboardInputs,
2497
- Ro as normalizeLegacyLinkedTargetOverrides,
2498
- Eo as occurrenceKeys,
2499
- Ft as outlineCalendar,
2500
- gi as outlineDashboard,
2501
- pe as outlineFilter,
2502
- Rt as outlineFilters,
2503
- pi as parseCardQueryRequest,
2504
- ks as parseCardQueryRequestContext,
2505
- fi as parseCardQueryRequestExtras,
2506
- Oo as parseExecutionControlBindingsShallow,
2507
- Wt as parseExecutionControlContext,
2508
- No as parseExecutionControlContract,
2509
- ca as planCardLabels,
2510
- lt as planCardRequery,
2511
- Bi as pluralDatasetLabel,
2512
- Ga as preferDashboardAuthoringSourceMetadata,
2513
- oi as preferredDashboardAuthoringSource,
2514
- sd as prepareLoadedDashboard,
2515
- qo as previewTemporalBucketAuthoringFormat,
2516
- Po as proposedChangeSchema,
2517
- id as pruneUnrelatedCalculatedFilters,
2518
- ua as queryForm,
2519
- oe as readCardQuery,
2520
- fe as readCardSource,
2521
- de as readDashboardFilterModel,
2522
- Mo as readExactDomainCalculatedFieldReference,
2523
- Vi as readFilterReachResponse,
2524
- nd as readFilterValueList,
2525
- wd as readMatrixCardConfig,
2526
- Lo as rebindDashboardOptionDependencyInputId,
2527
- dt as rebuildsRole,
2528
- Bo as reconcileMatrixSpecStructure,
2529
- Vo as reconcileTemporalBucketAuthoringFormat,
2530
- pa as recordsCardQuerySchema,
2531
- Go as refDataset,
2532
- ne as refKey,
2533
- ut as refName,
2534
- Uo as relationshipAddSchema,
2535
- jo as relationshipRouteTarget,
2536
- zo as relativeToTimeWindow,
2537
- Vt as remapClickToFilterReferences,
2538
- Qo as remapLinkedClickToFilterOverrides,
2539
- Ko as requireNormalizedDashboardInputs,
2540
- Wo as resolveBindingControlValue,
2541
- Sr as resolveCanonicalDetailResultRawKey,
2542
- vr as resolveCanonicalResultOutputKey,
2543
- wr as resolveCanonicalResultRawKey,
2544
- Ua as resolveDashboardAuthoringSource,
2545
- mi as resolveDashboardChanges,
2546
- Ho as resolveDashboardEntitySource,
2547
- Yo as resolveDashboardFilterAutomaticTarget,
2548
- Xo as resolveDashboardFilterInheritedTarget,
2549
- Jo as resolveDashboardOptionDependencies,
2550
- Zo as resolveDashboardOptionPopulation,
2551
- od as resolveDashboardSqlFilterTarget,
2552
- er as resolveFieldSelectedSource,
2553
- tr as resolveGroupByFieldTarget,
2554
- rd as resolveMatrixControlBindings,
2555
- Id as resolveMatrixDefinition,
2556
- ar as resolveMetricFieldTarget,
2557
- sr as resolveScalarMappedValue,
2558
- ir as resolveTemporalBucketAuthoringFormat,
2559
- Kt as resolveTemporalResultOwner,
2560
- Bt as respondsToSelectionsSchema,
2561
- nr as retainMatrixConditionalFormatting,
2562
- Ut as rewriteDashboardInputScopeIds,
2563
- dd as routeLegacyTableCard,
2564
- ld as routeLegacyTableCards,
2565
- cd as routeLegacyTableFrame,
2566
- Fe as sameColumnKey,
2567
- Le as sameValue,
2568
- or as selectDashboardOptionDependencyInputIds,
2569
- rr as selectionFieldFromExplorerField,
2570
- dr as settableCardType,
2571
- lr as sharedCardPreferences,
2572
- fa as sqlCardQuerySchema,
2573
- Ee as statedLabelsOf,
2574
- cr as stripInstanceTargetsForLibrarySave,
2575
- ur as structuralControlOverride,
2576
- At as summarizeFilter,
2577
- hr as supportsCanonicalDashboardTemporalResult,
2578
- fr as timeWindowSchema,
2579
- rt as toChartType,
2580
- Oe as toPublicCardType,
2581
- pr as toolbarFilterInputFields,
2582
- mr as toolbarFilterScope,
2583
- gr as transformComparisonDocument,
2584
- va as updateMatrixConfig,
2585
- ud as upgradeToStoredDashboard,
2586
- br as validateControlValue,
2587
- Xa as validateDashboardAuthoringDatasetScope,
2588
- Nr as validateDashboardFilterValues,
2589
- ns as validateDashboardPlan,
2590
- zt as validateResolvedPrimaryDateFieldShape,
2591
- Ir as withCardExcludedFromScope,
2592
- yr as withCardIncludedInScope,
2593
- _r as withDashboardOptionDependencyOverride,
2594
- na as withUnstatedScopeParts,
2595
- Gt as withoutToolbarFilterReachFields
2976
+ Nr as AGGREGATES,
2977
+ Pr as AUTOMATIC_TEMPORAL_BUCKET_FORMAT,
2978
+ qr as CALCULATED_FIELDS_GROUP_ID,
2979
+ Mr as CALCULATED_FIELDS_GROUP_NAME,
2980
+ Lr as CARD_CONFIG_KEY_CLASSES,
2981
+ Br as CARD_KEY_CLASSES,
2982
+ Qa as CARD_QUERY_CONFIG_KEYS,
2983
+ Us as CARD_QUERY_REQUEST_DESCRIPTIVE_FIELDS,
2984
+ Ks as CARD_QUERY_REQUEST_EXECUTED_FIELDS,
2985
+ Vr as CARD_TYPES,
2986
+ ye as CARD_TYPE_RULES,
2987
+ jr as COLUMN_KEY_CLASSES,
2988
+ Kr as COLUMN_PRESENTATION_KEYS,
2989
+ Ur as CONTROL_BINDING_MAPPING_MISSING_ERROR_CODE,
2990
+ Gr as CONTROL_BINDING_TARGET_INVALID_ERROR_CODE,
2991
+ zr as CONTROL_BINDING_VALUE_INVALID_ERROR_CODE,
2992
+ Qr as CONTROL_CONTEXT_UNSUPPORTED_ERROR_CODE,
2993
+ Hr as CONTROL_DEFINITION_DUPLICATE_ERROR_CODE,
2994
+ Yr as CONTROL_DEFINITION_INVALID_ERROR_CODE,
2995
+ Wr as CONTROL_PLACEHOLDER_QUOTED_ERROR_CODE,
2996
+ Jr as CONTROL_REFERENCE_MISSING_ERROR_CODE,
2997
+ Xr as CONTROL_VALUE_INVALID_ERROR_CODE,
2998
+ Zr as CONTROL_VALUE_MISSING_ERROR_CODE,
2999
+ Z as CardQueryRequestError,
3000
+ ei as ControlResolutionError,
3001
+ vt as DASHBOARD_AUTHORING_MAX_GENERATED_CARDS,
3002
+ ti as DASHBOARD_CHANGE_OPS,
3003
+ ai as DASHBOARD_DEFAULT_OPTION_DEPENDENCIES,
3004
+ Fc as DASHBOARD_FILTER_OPERATIONS,
3005
+ oi as DASHBOARD_INPUT_RUNTIME_SCOPE_KINDS,
3006
+ xc as DOCUMENT_KPI_SECTION_MAX_CARDS,
3007
+ Tc as DOCUMENT_KPI_SECTION_MAX_TILES,
3008
+ ni as DashboardFilterMappingContractError,
3009
+ si as ExecutionControlContractError,
3010
+ ri as FILTER_OPERATORS,
3011
+ ii as FilterModelError,
3012
+ di as LEGACY_TABLE_CARD_TYPES,
3013
+ qc as LEGACY_TABLE_ROUTING_ID_NAMESPACE,
3014
+ $t as MAX_PROPOSED_CHANGES,
3015
+ ci as MAX_QUERY_LIMIT,
3016
+ er as NEW_CARD_TYPE,
3017
+ li as QUERY_ASPECTS,
3018
+ ui as QUERY_CONFIG_KEY_ASPECTS,
3019
+ tr as RELATIONSHIP_ROUTE_CHANGED_MESSAGE,
3020
+ fi as SEMAPHOR_CARTESIAN_CHART_TYPES,
3021
+ mi as TIME_GRAINS,
3022
+ hi as TOOLBAR_FILTER_REACH_FIELDS,
3023
+ pi as acceptedColumnRefKinds,
3024
+ gi as analyticsFilterSchema,
3025
+ Mc as applyCardReferenceRemapping,
3026
+ St as applyDashboardOperations,
3027
+ Lc as applyFilterApplicability,
3028
+ ar as applyFilterSettingsChange,
3029
+ Bc as applyGroupByOverride,
3030
+ bi as applyLinkedClickToFilterOverrides,
3031
+ yi as applyOptionDependencyOverride,
3032
+ or as buildCardExportFormatOptions,
3033
+ Vc as buildCardExportQueryContext,
3034
+ nr as buildCardExportRequest,
3035
+ sr as buildCardExportRequestFromOptions,
3036
+ rr as buildColumnCatalog,
3037
+ Ii as buildControlDefinitionIndex,
3038
+ La as buildDashboardCardSourceIndex,
3039
+ ir as buildEntityColumnGroup,
3040
+ dr as buildFilterInputFromDefinition,
3041
+ ca as buildFilterInputFromField,
3042
+ _i as buildLinkedClickToFilterOverrides,
3043
+ Ci as buildProposeChangeInputSchema,
3044
+ vi as buildSavedEditorCard,
3045
+ cr as buildTableExportFormatOptions,
3046
+ lr as cardColumnRefForKey,
3047
+ Si as cardColumnRefSchema,
3048
+ eo as cardConditionalFormattingSchema,
3049
+ $i as cardQueryPatchSchema,
3050
+ wi as cardTypeSentenceName,
3051
+ Ha as changeCardType,
3052
+ Fi as changeMatrixEditor,
3053
+ to as checkConditionalRuleColumns,
3054
+ Ws as checkPresentationStores,
3055
+ fa as clickToFilterSettingsSchema,
3056
+ jc as collectJoinPlanIdentifiers,
3057
+ Da as columnDataset,
3058
+ Ya as columnFieldKey,
3059
+ Za as columnKeys,
3060
+ xi as columnRefIssue,
3061
+ ur as columnRefKey,
3062
+ Vs as compileDashboardFromPlan,
3063
+ Kc as composeCardReferenceRemapping,
3064
+ Ti as conditionalRuleSchema,
3065
+ ki as controlBindingExecutionSchema,
3066
+ Di as controlDefinitionExecutionSchema,
3067
+ Pa as controlRefusal,
3068
+ Ai as createDashboardFilterBindingId,
3069
+ ml as createMatrixAuthoringDraft,
3070
+ hl as createMatrixConfig,
3071
+ la as createNewCard,
3072
+ ot as dashboardAuthoringDatasetMatchesSource,
3073
+ Ls as dashboardAuthoringFieldsReferToSameTarget,
3074
+ oe as dashboardAuthoringSourceFromField,
3075
+ qs as dashboardAuthoringSourceKey,
3076
+ Qt as dashboardAuthoringSourcesReferToSameDataset,
3077
+ Ri as dashboardCardFilterSourceInventoryContains,
3078
+ Aa as dashboardChangeSchema,
3079
+ Oi as dashboardFilterTargetMatchesLogicalValue,
3080
+ kc as dashboardFilterValueTypeForDataType,
3081
+ Ei as dashboardGenerateSchema,
3082
+ Fa as dashboardInputScopeIncludesDocumentSheets,
3083
+ js as dashboardPlanFromSemaphorDashboardIntent,
3084
+ Ni as defaultClickToFilterSettings,
3085
+ Uc as describeDashboardFilterCardReach,
3086
+ Oe as describeDashboardFilterCardReachDetail,
3087
+ Na as describeQueryChange,
3088
+ fr as describeRelationshipRoute,
3089
+ mr as describeRelationshipSkip,
3090
+ Pi as doesDashboardInputApplyToTarget,
3091
+ qi as doesDashboardInputSurviveCarriedContext,
3092
+ Mi as doesToolbarFilterReachTab,
3093
+ hr as domainCalculatedFields,
3094
+ Li as dropMatrixEditorField,
3095
+ pr as evaluateConditionalRules,
3096
+ ka as fieldIdentityKey,
3097
+ Bi as fieldRefSchema,
3098
+ Gc as filterApplicabilityContextForCard,
3099
+ gr as filterReachPreviewAnswers,
3100
+ zc as filterValueReachForCard,
3101
+ Vi as filterValueSemanticDataset,
3102
+ jt as findCatalogField,
3103
+ Bs as findDashboardAuthoringDatasetForSource,
3104
+ ji as findDashboardCardExecutableSource,
3105
+ Ki as findDashboardCardPinnedCatalogSource,
3106
+ Ui as findDashboardSqlPinnedCatalogSource,
3107
+ oa as findRetiredCardPresentationFields,
3108
+ Ys as findRetiredPresentationFields,
3109
+ Ta as findSortedColumn,
3110
+ br as flattenEntityColumns,
3111
+ Gi as foldPrototypeDocumentInputs,
3112
+ zi as formatFilterModelIssues,
3113
+ Ia as formatResolvedPrimaryDateFieldIssues,
3114
+ Qc as formatSkippedFilterWarnings,
3115
+ yr as fromEditableRules,
3116
+ Ir as getCalculatedFieldAggregateOverrides,
3117
+ Qi as getCalculatedFieldNamespace,
3118
+ _r as getCalculatedFieldParameters,
3119
+ Cr as getCalculatedFieldShelfOverrides,
3120
+ Hi as getCardDefinition,
3121
+ Yi as getColumnCatalogFieldId,
3122
+ jo as getDashboardAuthoringCardSource,
3123
+ vr as getDashboardFilterSubscriptionHint,
3124
+ Wi as getDashboardGlobalDateFilter,
3125
+ Dc as getDocumentKpiSectionShapeIssues,
3126
+ Ac as getDocumentSectionCards,
3127
+ Sr as getDomainCalculatedSelectionOverrides,
3128
+ Ji as getFieldAggregationOptions,
3129
+ Xi as getMatrixBindingTargets,
3130
+ pl as getMatrixLevelLabel,
3131
+ gl as getMatrixMeasureLabel,
3132
+ Zi as getStableDomainCalculatedFieldId,
3133
+ ed as getTemporalBucketAuthoringOptions,
3134
+ td as getTemporalBucketAuthoringSelection,
3135
+ ad as handleSchema,
3136
+ $r as hasDashboardFilterSubscription,
3137
+ ae as hasStoredKey,
3138
+ od as hasToolbarFilterReachField,
3139
+ Hc as hostFilterValueFor,
3140
+ Yc as hostFilterValuesToSlots,
3141
+ _l as inspectMatrixCardConfig,
3142
+ Wc as isAdHocFilterValueOnTab,
3143
+ nd as isAllowedDashboardInputScopeCombination,
3144
+ sd as isCardType,
3145
+ Rc as isDashboardFilterOperationCompatible,
3146
+ Vt as isDashboardInputOnTab,
3147
+ rd as isDashboardInputOwnedBySheet,
3148
+ ba as isDashboardInputScopeEmpty,
3149
+ id as isGroupedDate,
3150
+ dd as isLegacyTableCard,
3151
+ $e as isMaterializableDashboardAuthoringSource,
3152
+ cd as isPresentationCurrencyBinding,
3153
+ ld as isSemanticAutoJoinCard,
3154
+ ud as isSemaphorCartesianChartType,
3155
+ Oo as isSemaphorSourceRef,
3156
+ fd as isStructuralControlBinding,
3157
+ md as isValidControlOptionPresentation,
3158
+ wr as kpiValueColumn,
3159
+ xa as labelAt,
3160
+ hd as layoutArrangeSchema,
3161
+ Jc as legacyTableRoutingIds,
3162
+ Xc as legacyTableRoutingTarget,
3163
+ pd as linkedClickToFilterOverridesSchema,
3164
+ Zc as listAdHocFilterValuesOnTab,
3165
+ ie as listDashboardCardLocations,
3166
+ gd as listDashboardFilterDefinitions,
3167
+ bd as listDashboardFilterInputsOnTab,
3168
+ yd as listDashboardInputReachKeys,
3169
+ Sa as listDashboardInputScopeExceptedCardIds,
3170
+ wa as listDashboardInputScopeExceptedSheetIds,
3171
+ Ze as listDashboardTabTargets,
3172
+ el as listFilterInputValueTargets,
3173
+ Id as listStoredFilterDefinitions,
3174
+ Oc as mapDashboardCards,
3175
+ Ec as mapDocumentSectionCards,
3176
+ Fr as mapRuleColumns,
3177
+ _d as matchColumns,
3178
+ tl as matrixCatalogSources,
3179
+ Xa as matrixColumnKeys,
3180
+ Cd as matrixColumnsSchema,
3181
+ Cl as matrixDefinitionFieldRefs,
3182
+ vl as matrixDefinitionFields,
3183
+ Sl as matrixDefinitionSources,
3184
+ vd as matrixEditorCatalogFromFields,
3185
+ al as matrixExecutionSources,
3186
+ Sd as measureRefSchema,
3187
+ Ee as mergeDashboardAuthoringSources,
3188
+ bl as mergeMatrixSorts,
3189
+ ja as metricCardQuerySchema,
3190
+ Ja as moveMatrixLevel,
3191
+ $d as normalizeClickToFilterSettings,
3192
+ wd as normalizeDashboardInputs,
3193
+ Fd as normalizeLegacyLinkedTargetOverrides,
3194
+ xd as occurrenceKeys,
3195
+ Zt as outlineCalendar,
3196
+ Hs as outlineDashboard,
3197
+ Se as outlineFilter,
3198
+ ta as outlineFilters,
3199
+ zs as parseCardQueryRequest,
3200
+ Cn as parseCardQueryRequestContext,
3201
+ Gs as parseCardQueryRequestExtras,
3202
+ xr as parseColumnRefKey,
3203
+ Td as parseExecutionControlBindingsShallow,
3204
+ Ca as parseExecutionControlContext,
3205
+ kd as parseExecutionControlContract,
3206
+ qa as planCardLabels,
3207
+ xt as planCardRequery,
3208
+ Tr as pluralDatasetLabel,
3209
+ Eo as preferDashboardAuthoringSourceMetadata,
3210
+ Ms as preferredDashboardAuthoringSource,
3211
+ ol as prepareLoadedDashboard,
3212
+ Dd as previewTemporalBucketAuthoringFormat,
3213
+ Ad as proposedChangeSchema,
3214
+ nl as pruneUnrelatedCalculatedFilters,
3215
+ Ma as queryForm,
3216
+ Rd as readCardConditionalRules,
3217
+ me as readCardQuery,
3218
+ ve as readCardSource,
3219
+ he as readDashboardFilterModel,
3220
+ Od as readExactDomainCalculatedFieldReference,
3221
+ kr as readFilterReachResponse,
3222
+ sl as readFilterValueList,
3223
+ $l as readMatrixCardConfig,
3224
+ Ed as rebindDashboardOptionDependencyInputId,
3225
+ Ft as rebuildsRole,
3226
+ Nd as reconcileMatrixSpecStructure,
3227
+ Pd as reconcileTemporalBucketAuthoringFormat,
3228
+ Va as recordsCardQuerySchema,
3229
+ qd as refDataset,
3230
+ fe as refKey,
3231
+ kt as refName,
3232
+ Md as relationshipAddSchema,
3233
+ Ld as relationshipRouteTarget,
3234
+ Bd as relativeToTimeWindow,
3235
+ ha as remapClickToFilterReferences,
3236
+ Vd as remapLinkedClickToFilterOverrides,
3237
+ jd as requireNormalizedDashboardInputs,
3238
+ Kd as resolveBindingControlValue,
3239
+ vc as resolveCanonicalDetailResultRawKey,
3240
+ Sc as resolveCanonicalResultOutputKey,
3241
+ $o as resolveCanonicalResultOutputKeys,
3242
+ $c as resolveCanonicalResultRawKey,
3243
+ Dr as resolveCardColumnRef,
3244
+ Ar as resolveConditionalRules,
3245
+ No as resolveDashboardAuthoringSource,
3246
+ Qs as resolveDashboardChanges,
3247
+ Ud as resolveDashboardEntitySource,
3248
+ Gd as resolveDashboardFilterAutomaticTarget,
3249
+ zd as resolveDashboardFilterInheritedTarget,
3250
+ Qd as resolveDashboardOptionDependencies,
3251
+ Hd as resolveDashboardOptionPopulation,
3252
+ rl as resolveDashboardSqlFilterTarget,
3253
+ Yd as resolveFieldSelectedSource,
3254
+ Wd as resolveGroupByFieldTarget,
3255
+ Rr as resolveKpiValueStyle,
3256
+ il as resolveMatrixControlBindings,
3257
+ yl as resolveMatrixDefinition,
3258
+ Jd as resolveMetricFieldTarget,
3259
+ Xd as resolveScalarMappedValue,
3260
+ Zd as resolveTemporalBucketAuthoringFormat,
3261
+ _a as resolveTemporalResultOwner,
3262
+ ma as respondsToSelectionsSchema,
3263
+ ec as retainConditionalRules,
3264
+ tc as retainedMatrixPath,
3265
+ ga as rewriteDashboardInputScopeIds,
3266
+ dl as routeLegacyTableCard,
3267
+ cl as routeLegacyTableCards,
3268
+ ll as routeLegacyTableFrame,
3269
+ je as sameColumnKey,
3270
+ et as sameValue,
3271
+ ac as selectDashboardOptionDependencyInputIds,
3272
+ oc as selectionFieldFromExplorerField,
3273
+ nc as settableCardType,
3274
+ sc as sharedCardPreferences,
3275
+ rc as sharedTableDialect,
3276
+ Ba as sqlCardQuerySchema,
3277
+ ze as statedLabelsOf,
3278
+ ic as stripInstanceTargetsForLibrarySave,
3279
+ dc as structuralControlOverride,
3280
+ ea as summarizeFilter,
3281
+ cc as supportsCanonicalDashboardTemporalResult,
3282
+ lc as timeWindowSchema,
3283
+ wt as toChartType,
3284
+ Or as toEditableRules,
3285
+ Qe as toPublicCardType,
3286
+ uc as toolbarFilterInputFields,
3287
+ fc as toolbarFilterScope,
3288
+ mc as transformComparisonDocument,
3289
+ Wa as updateMatrixConfig,
3290
+ cs as upgradeCardFormats,
3291
+ Js as upgradeCardPresentation,
3292
+ bs as upgradeConditionalFormatting,
3293
+ ul as upgradeToStoredDashboard,
3294
+ hc as validateControlValue,
3295
+ Ko as validateDashboardAuthoringDatasetScope,
3296
+ Nc as validateDashboardFilterValues,
3297
+ Jo as validateDashboardPlan,
3298
+ ya as validateResolvedPrimaryDateFieldShape,
3299
+ pc as withCardConditionalRules,
3300
+ gc as withCardConfigSqlDatePatterns,
3301
+ bc as withCardExcludedFromScope,
3302
+ yc as withCardIncludedInScope,
3303
+ Ic as withDashboardOptionDependencyOverride,
3304
+ _c as withSqlDatePattern,
3305
+ Ra as withUnstatedScopeParts,
3306
+ pa as withoutToolbarFilterReachFields
2596
3307
  };