react-semaphor 0.1.567 → 0.1.569

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 (128) hide show
  1. package/README.md +0 -7
  2. package/dist/analytics-protocol/index.js +434 -454
  3. package/dist/assistant-context/index.js +1 -1
  4. package/dist/brand-studio/index.js +10 -12
  5. package/dist/briefings/index.js +4 -4
  6. package/dist/chunks/{_commonjsHelpers-DimLPMtv.js → _commonjsHelpers-Bid1ZNYj.js} +271 -222
  7. package/dist/chunks/{assistant-chat-D-IuHHwh.js → assistant-chat-Dzf2Mbph.js} +107 -109
  8. package/dist/chunks/{bookmark-impact-B0estCHn.js → bookmark-impact-Czg6FGt5.js} +2 -2
  9. package/dist/chunks/{bookmark-state-Du3s13_V.js → bookmark-state-CflS88gq.js} +251 -250
  10. package/dist/chunks/{card-filter-builder-DbSmzvem.js → card-filter-builder-BS982X7x.js} +1001 -1000
  11. package/dist/chunks/{code-editor-DJNOsgJH.js → code-editor-BsxHzm9u.js} +43 -45
  12. package/dist/chunks/{comparison-window-caption-CMLb3mut.js → comparison-window-caption-lLTgzOkM.js} +252 -253
  13. package/dist/chunks/{dashboard-f8J9DHh5.js → dashboard-BiYSbxZv.js} +1 -1
  14. package/dist/chunks/{dashboard-briefing-launcher-DunvZYsU.js → dashboard-briefing-launcher-Bdj7luOr.js} +119 -120
  15. package/dist/chunks/{dashboard-controls-B09cN2Dz.js → dashboard-controls-TViDsnb8.js} +17 -19
  16. package/dist/chunks/dashboard-json-Dg9dQd9U.js +66 -0
  17. package/dist/chunks/{dates-BsJcyoC_.js → dates-BsPrWZIP.js} +8 -8
  18. package/dist/chunks/{edit-dashboard-visual-Cwzbpty8.js → edit-dashboard-visual-C6hoIeEJ.js} +20 -21
  19. package/dist/chunks/{filter-reach-copy-P-kDwUpY.js → filter-reach-copy-hcQ4os0u.js} +862 -852
  20. package/dist/chunks/filter-value-text-CVxEEDVl.js +146 -0
  21. package/dist/chunks/{index-BcXw0CpM.js → index-G4q89J6O.js} +74 -76
  22. package/dist/chunks/{layout-grid-0hIlqEtk.js → layout-grid-BIcoFfdS.js} +1 -1
  23. package/dist/chunks/{list-filter-DkgoCeBm.js → list-filter-C6tYkHyv.js} +1 -1
  24. package/dist/chunks/matrix-analytical-definition-dkS8szLM.js +1253 -0
  25. package/dist/chunks/matrix-member-presentation-DRa-9e6Q.js +169 -0
  26. package/dist/chunks/{matrix-operation-contract-Eb6elidS.js → matrix-operation-contract-DCVinw1o.js} +122 -122
  27. package/dist/chunks/{metric-comparison-ChXUFaZu.js → metric-comparison-n9NsIa-2.js} +175 -128
  28. package/dist/chunks/{palette-4vf2BEEg.js → palette-NjHOE_6B.js} +1 -1
  29. package/dist/chunks/pivot-result-contract-expectations-DkmueDTW.js +55 -0
  30. package/dist/chunks/{pivot-result-identity-BlbLrqaC.js → pivot-result-identity-B89X5xjb.js} +1 -1
  31. package/dist/chunks/raw-temporal-value-DdT0s47W.js +159 -0
  32. package/dist/chunks/{report-preferences-dialog-CbgmdWeZ.js → report-preferences-dialog-Xc8_GFju.js} +26 -28
  33. package/dist/chunks/{report-runtime-context-DnA_PiKo.js → report-runtime-context-BhPzLTbS.js} +1 -1
  34. package/dist/chunks/{resolve-dashboard-input-context-DPKSF3qj.js → resolve-dashboard-input-context-KqvcLcTM.js} +5956 -5880
  35. package/dist/chunks/{save-D6pHmSSP.js → save-C6VmEJTA.js} +1 -1
  36. package/dist/chunks/{saved-dashboard-context-CNudmm9U.js → saved-dashboard-context-BeXXyoD4.js} +6 -6
  37. package/dist/chunks/{semaphor-ready-indicator-CQd-PCCZ.js → semaphor-ready-indicator-BNkaANsG.js} +31011 -30850
  38. package/dist/chunks/{shelf-drop-preview-context-CWS3e20y.js → shelf-drop-preview-context-C_issPBA.js} +18 -20
  39. package/dist/chunks/{stored-dashboard-CrQFT27O.js → stored-dashboard-B6_StAty.js} +232 -234
  40. package/dist/chunks/{table-export-sheet--DUKWk6o.js → table-export-sheet-BWP2joD1.js} +1 -1
  41. package/dist/chunks/{temporal-input-presentation--2r9BLr0.js → temporal-input-presentation-scSWQXAB.js} +4 -4
  42. package/dist/chunks/{token-types-C8JymO8s.js → token-types-iKMplaBL.js} +1 -1
  43. package/dist/chunks/{upload-Cf3wXZT8.js → upload-BRW4Mwrd.js} +1 -1
  44. package/dist/chunks/validators-B8fpdinG.js +3651 -0
  45. package/dist/chunks/{variable-draft-BDxlD0dM.js → variable-draft-BQ3OMjvy.js} +4 -4
  46. package/dist/dashboard/index.js +2 -2
  47. package/dist/dashboard-authoring/index.js +1778 -1741
  48. package/dist/format-utils/index.js +230 -231
  49. package/dist/index.js +236 -237
  50. package/dist/report-runtime-context/index.js +1 -1
  51. package/dist/style.css +1 -1
  52. package/dist/surfboard/index.js +2 -2
  53. package/dist/types/components/surfboard/filter/types.d.ts +5 -4
  54. package/dist/types/components/ui-custom/date-range-presets.d.ts +1 -17
  55. package/dist/types/index.js +9 -9
  56. package/dist/types/lib/document/document-edits.d.ts +8 -3
  57. package/dist/types/lib/document/document-text-style.d.ts +54 -0
  58. package/dist/types/lib/hooks/use-date-filter.d.ts +3 -3
  59. package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +1 -1
  60. package/dist/types/lib/types/explorer-types.d.ts +2 -2
  61. package/dist/types/lib/types/index.d.ts +1 -1
  62. package/dist/types/lib/utils/card-definition.d.ts +7 -7
  63. package/dist/types/shared/analytics-protocol/agent-time-window.d.ts +84 -0
  64. package/dist/types/shared/analytics-protocol/applied-constraints.d.ts +2 -2
  65. package/dist/types/shared/analytics-protocol/contracts.d.ts +8 -17
  66. package/dist/types/shared/analytics-protocol/fixtures.d.ts +3 -2
  67. package/dist/types/shared/analytics-protocol/index.d.ts +2 -4
  68. package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +4 -4
  69. package/dist/types/shared/analytics-protocol/relative-date/describe.d.ts +18 -0
  70. package/dist/types/shared/analytics-protocol/relative-date/index.d.ts +7 -0
  71. package/dist/types/shared/analytics-protocol/relative-date/limits.d.ts +3 -0
  72. package/dist/types/shared/analytics-protocol/relative-date/presets.d.ts +11 -0
  73. package/dist/types/shared/analytics-protocol/relative-date/resolve.d.ts +49 -0
  74. package/dist/types/shared/analytics-protocol/relative-date/schemas.d.ts +76 -0
  75. package/dist/types/shared/analytics-protocol/relative-date/traits.d.ts +51 -0
  76. package/dist/types/shared/analytics-protocol/relative-date/window.d.ts +111 -0
  77. package/dist/types/shared/analytics-protocol/selection-contract.d.ts +1 -1
  78. package/dist/types/shared/assistant-protocol/context.d.ts +12 -12
  79. package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +0 -2
  80. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +176 -1756
  81. package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +8 -4
  82. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +74 -74
  83. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +20 -20
  84. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +8 -2
  85. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +10 -2
  86. package/dist/types/shared/format-utils/filter-detail.d.ts +2 -8
  87. package/dist/types/shared/format-utils/filter-line.d.ts +2 -2
  88. package/dist/types/shared/format-utils/matrix-continuation.d.ts +3 -3
  89. package/dist/types/shared/temporal/index.d.ts +0 -2
  90. package/dist/types/shared/temporal/temporal-parity-fixtures.d.ts +2 -2
  91. package/package.json +2 -24
  92. package/DATA_APP_SDK.md +0 -339
  93. package/dist/chunks/dashboard-json-BNNCaKEc.js +0 -68
  94. package/dist/chunks/filter-value-text-7zhmth1S.js +0 -163
  95. package/dist/chunks/index-CuHybtft.js +0 -51
  96. package/dist/chunks/matrix-analytical-definition-C9xB_T84.js +0 -717
  97. package/dist/chunks/matrix-card-BSUeSXpD.js +0 -42
  98. package/dist/chunks/matrix-member-presentation-DZNgQpUq.js +0 -105
  99. package/dist/chunks/operators-B3zZoskU.js +0 -66
  100. package/dist/chunks/pivot-result-contract-expectations-Ddh1rNz5.js +0 -56
  101. package/dist/chunks/raw-temporal-value-Bqz8wc7L.js +0 -242
  102. package/dist/chunks/selection-reducer-OaJ-N5uN.js +0 -46
  103. package/dist/chunks/source-entity-resolution-DF6GulDn.js +0 -607
  104. package/dist/chunks/validators-wtjw0aw6.js +0 -3332
  105. package/dist/data-app-sdk/index.js +0 -1412
  106. package/dist/data-app-sdk-adapters/index.js +0 -361
  107. package/dist/data-app-sdk-validation/index.js +0 -1031
  108. package/dist/types/data-app-sdk/adapters.d.ts +0 -35
  109. package/dist/types/data-app-sdk/builders.d.ts +0 -62
  110. package/dist/types/data-app-sdk/contracts.d.ts +0 -419
  111. package/dist/types/data-app-sdk/executor.d.ts +0 -5
  112. package/dist/types/data-app-sdk/field-catalog-validation.d.ts +0 -29
  113. package/dist/types/data-app-sdk/hooks.d.ts +0 -11
  114. package/dist/types/data-app-sdk/index.d.ts +0 -9
  115. package/dist/types/data-app-sdk/provider.d.ts +0 -8
  116. package/dist/types/data-app-sdk/relationship-aware-field-policy.d.ts +0 -21
  117. package/dist/types/data-app-sdk/selection.d.ts +0 -2
  118. package/dist/types/data-app-sdk/validation.d.ts +0 -58
  119. package/dist/types/data-app-sdk-adapters.d.ts +0 -2
  120. package/dist/types/data-app-sdk-validation.d.ts +0 -2
  121. package/dist/types/data-app-sdk.d.ts +0 -2
  122. package/dist/types/shared/analytics-protocol/relative-date-filter.d.ts +0 -68
  123. package/dist/types/shared/analytics-protocol/relative-date-label.d.ts +0 -20
  124. package/dist/types/shared/analytics-protocol/time-window-schema.d.ts +0 -314
  125. package/dist/types/shared/analytics-protocol/time-window.d.ts +0 -52
  126. package/dist/types/shared/temporal/relative-date.d.ts +0 -21
  127. package/dist/types/shared/temporal/time-window-periods.d.ts +0 -21
  128. package/src/data-app-sdk/README.md +0 -402
@@ -1,27 +1,25 @@
1
- import { J as fr, K as mr, M as pr, N as rn, O as gr, P as hr, Q as yr, R as br, S as vr, T as an, U as Ir, V as Cr, W as Fr, X as _e, Y as Sr, Z as xr, _ as wr, g as Tr, k as be, $ as Dr, a0 as kr } from "./stored-dashboard-CrQFT27O.js";
2
- import { fz as on, bo as ve, fA as Mr, fB as Or, fC as _r, fD as Pr, O as H, fE as sn, bq as Ar, fF as Nr, fG as Xe, ah as Qe, fH as Er, fI as $r, fJ as Rr, K as Je, fK as Kr, bz as Vr, P as Lr, fL as qr, L as Br, m as Ze, fM as et, fN as Ur, fO as F, o as xe, fP as J, fQ as T, fR as zr, fS as jr, fT as Tt, fU as Gr, fV as Dt, fW as Wr, aN as w, fX as cn, aY as we, fY as Hr, fZ as Yr, f_ as Xr, f$ as Qr, g0 as Jr, g1 as ln, cg as dn, g2 as un, g3 as fn, g4 as Ie, g5 as kt, a2 as Y, g6 as tt, g7 as Mt, g8 as nt, t as Ot, g9 as _t, c3 as rt, ga as Zr, gb as ei, gc as ti, gd as re, ge as ni, gf as ri, gg as ii, a5 as ai, bt as oi, c8 as it, gh as mn, gi as Le, J as si, aC as ci, dZ as li, gj as di, gk as ui, gl as fi, gm as mi, gn as pi, go as gi, gp as hi, gq as yi, gr as qe, gs as bi, fu as Pe, gt as vi, gu as Ii, gv as pn, a as gn, gw as Ci, gx as Fi, d1 as hn, gy as Pt, cB as Si, d4 as At, d3 as xi, e5 as wi, aR as Ti, eG as Di, gz as ki, gA as Mi, cn as Nt } from "./resolve-dashboard-input-context-DPKSF3qj.js";
3
- import { H as ce, f as Oi, e as _i, G as yn, aA as Pi, v as Ai, n as Ni, d as Ei } from "./validators-wtjw0aw6.js";
4
- import { N as $i, r as Ae } from "./matrix-operation-contract-Eb6elidS.js";
5
- import { r as Ri, C as Ki } from "./metric-comparison-ChXUFaZu.js";
6
- import { t as Et, e as $t } from "./analytics-base-schemas-BaIQrEzX.js";
1
+ import { J as pr, K as gr, M as hr, N as an, O as yr, P as br, Q as vr, R as Ir, S as Cr, T as on, U as Fr, V as Sr, W as xr, X as _e, Y as wr, Z as Tr, _ as Dr, g as kr, k as be, $ as Mr, a0 as Or } from "./stored-dashboard-B6_StAty.js";
2
+ import { fG as sn, bt as ve, fH as _r, fI as Pr, fJ as Ar, fK as Nr, P as H, fL as cn, bv as $r, fM as Er, fN as Xe, ai as Ye, fO as Rr, fP as Kr, fQ as Vr, L as Je, fR as Lr, bI as qr, Q as Br, fS as Ur, M as zr, m as Ze, fT as et, fU as jr, fV as F, o as xe, fW as J, fX as T, fY as Gr, fZ as Wr, f_ as Tt, f$ as Hr, g0 as Dt, g1 as Qr, aQ as w, g2 as ln, a$ as we, g3 as Xr, g4 as Yr, g5 as Jr, g6 as Zr, g7 as ei, g8 as dn, cp as un, g9 as fn, ga as mn, gb as Ie, gc as kt, a4 as Q, gd as tt, ge as Mt, gf as nt, t as Ot, gg as _t, cc as rt, gh as ti, gi as ni, gj as re, gk as ri, gl as ii, gm as ai, a7 as oi, bC as si, ch as it, aC as ci, gn as Pt, go as pn, gp as Le, K as li, aF as di, e4 as ui, gq as fi, gr as mi, gs as pi, gt as gi, gu as hi, gv as yi, gw as bi, gx as vi, gy as qe, gz as Ii, fB as Pe, gA as Ci, gB as Fi, gC as gn, a as hn, gD as Si, gE as xi, da as yn, gF as At, cK as wi, dd as Nt, dc as Ti, ec as Di, aU as ki, eN as Mi, gG as Oi, gH as _i, cw as $t } from "./resolve-dashboard-input-context-KqvcLcTM.js";
3
+ import { a5 as ce, s as Pi, d as Ai, r as bn, aE as Ni, a2 as vn, au as $i, n as Ei, c as Ri } from "./validators-B8fpdinG.js";
4
+ import { M as Ki, l as Ae } from "./matrix-operation-contract-DCVinw1o.js";
5
+ import { r as Vi, C as Li, a as qi } from "./metric-comparison-n9NsIa-2.js";
6
+ import { t as Et, e as Rt } from "./analytics-base-schemas-BaIQrEzX.js";
7
7
  import "zod";
8
- import { b as Q, i as N, aI as Vi, aJ as Li, m as qi, h as Bi, d as Be, e as Ui, Q as _, af as zi, am as ji, c as Gi, ah as Wi, W as Hi, w as Yi, a5 as Xi } from "./temporal-input-presentation--2r9BLr0.js";
8
+ import { b as Y, i as N, aI as Bi, aJ as Ui, m as zi, h as ji, d as Be, e as Gi, Q as _, af as Wi, am as Hi, c as Qi, ah as Xi, W as Yi, w as Ji, a5 as Zi } from "./temporal-input-presentation-scSWQXAB.js";
9
9
  import "../value-format-preferences/index.js";
10
- import { z as Qi, S as Ji, K as Zi, af as ea, a1 as Rt, N as bn, A as vn, aq as ta, O as In, D as na, a5 as ra, a6 as ia, G as Cn, X as aa, Y as Fn, I as at, Z as Sn, ar as oa } from "./bookmark-state-Du3s13_V.js";
11
- import { g as sa } from "./_commonjsHelpers-DimLPMtv.js";
12
- import "./index-CuHybtft.js";
10
+ import { z as ea, S as ta, K as na, af as ra, a1 as Kt, N as In, A as Cn, aq as ia, O as Fn, D as aa, a5 as oa, a6 as sa, G as Sn, X as ca, Y as xn, I as at, Z as wn, ar as la } from "./bookmark-state-CflS88gq.js";
11
+ import { g as da } from "./_commonjsHelpers-Bid1ZNYj.js";
13
12
  import "./index-RNaTnE3m.js";
14
13
  import "./context-R31TSL5V.js";
15
- import { a as ca } from "./source-entity-resolution-DF6GulDn.js";
16
- import { R as la, l as da } from "./matrix-analytical-definition-C9xB_T84.js";
17
- import { r as Ue } from "./pivot-result-identity-BlbLrqaC.js";
18
- import { r as xn } from "./applied-constraints-DU-wndZ7.js";
19
- function ua(e, t) {
14
+ import { r as ua, Z as fa, v as ma } from "./matrix-analytical-definition-dkS8szLM.js";
15
+ import { r as Ue } from "./pivot-result-identity-B89X5xjb.js";
16
+ import { r as Tn } from "./applied-constraints-DU-wndZ7.js";
17
+ function pa(e, t) {
20
18
  if (!(typeof e != "number" || typeof t != "number"))
21
19
  return e === t ? t : void 0;
22
20
  }
23
21
  function U(e, t) {
24
- const n = Q(e, t);
22
+ const n = Y(e, t);
25
23
  if (n) {
26
24
  if (n.type === "date")
27
25
  return {
@@ -53,7 +51,7 @@ function U(e, t) {
53
51
  type: n.type,
54
52
  locale: n.locale,
55
53
  currency: n.type === "currency" ? n.currency : void 0,
56
- decimalPlaces: t != null && t.preserveOmittedProperties ? void 0 : ua(
54
+ decimalPlaces: t != null && t.preserveOmittedProperties ? void 0 : pa(
57
55
  n.minimumFractionDigits,
58
56
  n.maximumFractionDigits
59
57
  ),
@@ -70,8 +68,8 @@ function U(e, t) {
70
68
  };
71
69
  }
72
70
  }
73
- function wn(e, t) {
74
- const n = Q(e, t);
71
+ function Dn(e, t) {
72
+ const n = Y(e, t);
75
73
  return (n == null ? void 0 : n.type) === "duration" ? {
76
74
  style: "duration",
77
75
  duration: {
@@ -87,7 +85,7 @@ function wn(e, t) {
87
85
  } : !n || !N(n) ? void 0 : {
88
86
  style: n.type === "currency" ? "currency" : n.type === "percent" ? "percent" : n.type === "scientific" ? "scientific" : "decimal",
89
87
  currency: n.type === "currency" && n.currency || (t != null && t.preserveOmittedProperties ? void 0 : "USD"),
90
- locale: n.locale || (t != null && t.preserveOmittedProperties ? void 0 : Vi),
88
+ locale: n.locale || (t != null && t.preserveOmittedProperties ? void 0 : Bi),
91
89
  minimumFractionDigits: n.minimumFractionDigits ?? (t != null && t.preserveOmittedProperties ? void 0 : 0),
92
90
  maximumFractionDigits: n.maximumFractionDigits ?? (t != null && t.preserveOmittedProperties ? void 0 : 2),
93
91
  useGrouping: typeof n.useGrouping == "boolean" ? n.useGrouping : !0,
@@ -100,60 +98,60 @@ function wn(e, t) {
100
98
  suffix: n.suffix
101
99
  };
102
100
  }
103
- const Kt = [10, 20, 50, 100, 500, 1e3], fa = 50;
104
- function ma(e) {
105
- return e && e > 0 ? e : fa;
101
+ const Vt = [10, 20, 50, 100, 500, 1e3], ga = 50;
102
+ function ha(e) {
103
+ return e && e > 0 ? e : ga;
106
104
  }
107
- function ac(e) {
108
- const t = ma(e), n = [...Kt];
109
- return Kt.includes(
105
+ function cc(e) {
106
+ const t = ha(e), n = [...Vt];
107
+ return Vt.includes(
110
108
  t
111
109
  ) || (n.push(t), n.sort((r, i) => r - i)), n;
112
110
  }
113
- function oc(e) {
111
+ function lc(e) {
114
112
  var t, n;
115
- return !!((e.type === "table" || e.type === "detailTable") && e.sql && !on(e.config) && !((n = (t = e.preferences) == null ? void 0 : t.tablePrefs) != null && n.forceClientPagination));
113
+ return !!((e.type === "table" || e.type === "detailTable") && e.sql && !sn(e.config) && !((n = (t = e.preferences) == null ? void 0 : t.tablePrefs) != null && n.forceClientPagination));
116
114
  }
117
- function pa(e, t) {
115
+ function ya(e, t) {
118
116
  var r, i, o, a;
119
117
  if (t === "table-print")
120
118
  return "disabled";
121
119
  if ((i = (r = e.preferences) == null ? void 0 : r.tablePrefs) != null && i.forceClientPagination)
122
120
  return "client";
123
- const n = on(e.config);
124
- return e.sql && !n ? (a = (o = e.preferences) == null ? void 0 : o.tablePrefs) != null && a.enableDevModePagination ? "server" : "client" : n && fr(e) ? "server" : "client";
121
+ const n = sn(e.config);
122
+ return e.sql && !n ? (a = (o = e.preferences) == null ? void 0 : o.tablePrefs) != null && a.enableDevModePagination ? "server" : "client" : n && pr(e) ? "server" : "client";
125
123
  }
126
- const Tn = Object.freeze({}), sc = {
124
+ const kn = Object.freeze({}), dc = {
127
125
  access: "session-only",
128
126
  printMode: !1,
129
127
  baseline: null,
130
128
  applied: null,
131
129
  appliedBookmark: null,
132
- tableSettings: Tn,
130
+ tableSettings: kn,
133
131
  notices: [],
134
132
  isFavorite: !1,
135
133
  fetchedAt: 0
136
134
  };
137
- function cc(e) {
135
+ function uc(e) {
138
136
  return !e.viewer.printMode && e.viewer.access !== "session-only" && !!e.viewer.baseline && !!e.viewerStateClient && !e.isDashboardEditing;
139
137
  }
140
- function ga(e) {
141
- return e.isDashboardEditing ? Tn : e.viewer.tableSettings;
138
+ function ba(e) {
139
+ return e.isDashboardEditing ? kn : e.viewer.tableSettings;
142
140
  }
143
- function ha(e, t) {
144
- return ga(e)[t];
141
+ function va(e, t) {
142
+ return ba(e)[t];
145
143
  }
146
- function lc(e, t, n) {
147
- if (!(n.isEditorPreview || e.isDashboardEditing) && Qi(e.dashboard, t))
148
- return { settings: ha(e, t) };
144
+ function fc(e, t, n) {
145
+ if (!(n.isEditorPreview || e.isDashboardEditing) && ea(e.dashboard, t))
146
+ return { settings: va(e, t) };
149
147
  }
150
- function ya(e) {
148
+ function Ia(e) {
151
149
  var t;
152
- return mr({
150
+ return gr({
153
151
  card: e.card,
154
- paginationMode: pa(e.card) === "server" ? "server" : "client",
152
+ paginationMode: ya(e.card) === "server" ? "server" : "client",
155
153
  result: {
156
- keys: e.keys ?? pr(e.records),
154
+ keys: e.keys ?? hr(e.records),
157
155
  rows: e.records,
158
156
  columns: e.resultColumns,
159
157
  columnKeyMap: e.columnKeyMap,
@@ -163,14 +161,14 @@ function ya(e) {
163
161
  projection: "export"
164
162
  });
165
163
  }
166
- function ba(e) {
164
+ function Ca(e) {
167
165
  if (e)
168
166
  return U(
169
- Q(e, { preserveOmittedProperties: !0 }),
167
+ Y(e, { preserveOmittedProperties: !0 }),
170
168
  { preserveOmittedProperties: !0 }
171
169
  );
172
170
  }
173
- function va(e) {
171
+ function Fa(e) {
174
172
  if (e.type === "percent") {
175
173
  const { multiplyBy: t, percentValueMode: n, ...r } = e, i = t === 100 ? "fraction" : t === 1 ? "whole" : t === void 0 ? n : void 0;
176
174
  if (i || t === void 0)
@@ -182,7 +180,7 @@ function va(e) {
182
180
  ve(e, { preserveOmittedProperties: !0 })
183
181
  );
184
182
  }
185
- const Te = ba, dc = va, Ia = () => ({
183
+ const Te = Ca, mc = Fa, Sa = () => ({
186
184
  urlTemplate: "{value}",
187
185
  // Default: use cell value as-is
188
186
  labelType: "value",
@@ -196,9 +194,9 @@ const Te = ba, dc = va, Ia = () => ({
196
194
  inheritMetricFormat: !0,
197
195
  textAlign: "left",
198
196
  // The table's one width rule (card appearance P2-21).
199
- width: _r,
200
- minWidth: Or,
201
- maxWidth: Mr,
197
+ width: Ar,
198
+ minWidth: Pr,
199
+ maxWidth: _r,
202
200
  textOverflow: "ellipsis",
203
201
  textWrap: "default",
204
202
  numberFormat: {
@@ -220,12 +218,12 @@ const Te = ba, dc = va, Ia = () => ({
220
218
  sourceTimezone: "auto"
221
219
  // Default to auto (use explicit timezone if present, otherwise assume UTC)
222
220
  },
223
- linkFormat: Ia()
221
+ linkFormat: Sa()
224
222
  });
225
- function uc(e, t, n, r) {
223
+ function pc(e, t, n, r) {
226
224
  return t && t !== "auto" ? t : n;
227
225
  }
228
- const fc = (e) => !e || e === "auto" ? "local time" : {
226
+ const gc = (e) => !e || e === "auto" ? "local time" : {
229
227
  "America/New_York": "Eastern Time",
230
228
  "America/Chicago": "Central Time",
231
229
  "America/Denver": "Mountain Time",
@@ -236,7 +234,7 @@ const fc = (e) => !e || e === "auto" ? "local time" : {
236
234
  "Asia/Shanghai": "China Time",
237
235
  UTC: "UTC"
238
236
  }[e] || e;
239
- function Dn(e, t) {
237
+ function Mn(e, t) {
240
238
  const n = typeof e.decimalPlaces == "number", r = typeof e.minimumFractionDigits == "number" ? e.minimumFractionDigits : n ? e.decimalPlaces : t.min, i = typeof e.maximumFractionDigits == "number" ? e.maximumFractionDigits : n ? e.decimalPlaces : t.max;
241
239
  return {
242
240
  minimumFractionDigits: r,
@@ -244,7 +242,7 @@ function Dn(e, t) {
244
242
  };
245
243
  }
246
244
  function Ce(e, t) {
247
- const n = Dn(e, t), r = typeof e.suffix == "string" && e.suffix.length > 0;
245
+ const n = Mn(e, t), r = typeof e.suffix == "string" && e.suffix.length > 0;
248
246
  return {
249
247
  style: "decimal",
250
248
  locale: e.locale,
@@ -262,30 +260,30 @@ function Ce(e, t) {
262
260
  };
263
261
  }
264
262
  function st(e, t = "auto", n = {}) {
265
- if (t === "auto" && (t = wa(e, n)), (t === "number" || t === "currency" || t === "percent" || t === "scientific") && n.signDisplay && n.signDisplay !== "auto" && Number.isFinite(Number(e))) {
266
- const i = typeof n.multiplyBy == "number" && Number.isFinite(n.multiplyBy) ? n.multiplyBy : 1, o = Number(e) * i, a = Li(o, n.signDisplay), s = st(a.value === o ? e : -Number(e), t, { ...n, signDisplay: void 0 });
263
+ if (t === "auto" && (t = ka(e, n)), (t === "number" || t === "currency" || t === "percent" || t === "scientific") && n.signDisplay && n.signDisplay !== "auto" && Number.isFinite(Number(e))) {
264
+ const i = typeof n.multiplyBy == "number" && Number.isFinite(n.multiplyBy) ? n.multiplyBy : 1, o = Number(e) * i, a = Ui(o, n.signDisplay), s = st(a.value === o ? e : -Number(e), t, { ...n, signDisplay: void 0 });
267
265
  if (!a.plus) return s;
268
266
  const c = n.prefix ?? "";
269
267
  return c && s.startsWith(c) ? `${c}+${s.slice(c.length)}` : `+${s}`;
270
268
  }
271
269
  switch (t) {
272
270
  case "number":
273
- return kn(e, n);
271
+ return On(e, n);
274
272
  case "currency":
275
- return Mn(e, n);
273
+ return _n(e, n);
276
274
  case "percent":
277
- return Ca(e, n);
275
+ return xa(e, n);
278
276
  case "date":
279
- return Fa(e, n);
277
+ return wa(e, n);
280
278
  case "scientific":
281
- return Sa(e, n);
279
+ return Ta(e, n);
282
280
  case "duration":
283
- return xa(e, n);
281
+ return Da(e, n);
284
282
  default:
285
283
  return String(e);
286
284
  }
287
285
  }
288
- function kn(e, t = {}) {
286
+ function On(e, t = {}) {
289
287
  return e < 0 && !!t.prefix && !t.negativeInParentheses ? `-${Be(
290
288
  Math.abs(e),
291
289
  Ce(t, {
@@ -300,8 +298,8 @@ function kn(e, t = {}) {
300
298
  })
301
299
  );
302
300
  }
303
- function Mn(e, t = {}) {
304
- return Ui(e, {
301
+ function _n(e, t = {}) {
302
+ return Gi(e, {
305
303
  ...Ce(t, {
306
304
  min: 2,
307
305
  max: 2
@@ -310,8 +308,8 @@ function Mn(e, t = {}) {
310
308
  currency: t.currency || "USD"
311
309
  });
312
310
  }
313
- function Ca(e, t = {}) {
314
- const n = Dn(t, { min: 1, max: 1 }), i = typeof t.multiplyBy == "number" && Number.isFinite(t.multiplyBy) ? t.multiplyBy : t.percentValueMode === "whole" ? 1 : 100, o = e * i;
311
+ function xa(e, t = {}) {
312
+ const n = Mn(t, { min: 1, max: 1 }), i = typeof t.multiplyBy == "number" && Number.isFinite(t.multiplyBy) ? t.multiplyBy : t.percentValueMode === "whole" ? 1 : 100, o = e * i;
315
313
  return Be(o, {
316
314
  locale: t.locale,
317
315
  minimumFractionDigits: n.minimumFractionDigits,
@@ -323,7 +321,7 @@ function Ca(e, t = {}) {
323
321
  useSuffix: !1
324
322
  });
325
323
  }
326
- function Fa(e, t = {}) {
324
+ function wa(e, t = {}) {
327
325
  const { locale: n = "en-US" } = t;
328
326
  try {
329
327
  const r = new Date(e);
@@ -334,14 +332,14 @@ function Fa(e, t = {}) {
334
332
  return String(e);
335
333
  }
336
334
  }
337
- function Sa(e, t = {}) {
338
- return Bi(
335
+ function Ta(e, t = {}) {
336
+ return ji(
339
337
  e,
340
338
  Ce(t, { min: 2, max: 2 })
341
339
  );
342
340
  }
343
- function xa(e, t = {}) {
344
- return qi(e, {
341
+ function Da(e, t = {}) {
342
+ return zi(e, {
345
343
  inputUnit: t.durationInputUnit,
346
344
  outputStyle: t.durationDisplayStyle,
347
345
  largestUnit: t.durationLargestUnit,
@@ -352,13 +350,13 @@ function xa(e, t = {}) {
352
350
  negativeInParentheses: t.negativeInParentheses
353
351
  });
354
352
  }
355
- function wa(e, t) {
353
+ function ka(e, t) {
356
354
  return t.currency ? "currency" : typeof e == "string" && !isNaN(Date.parse(e)) ? "date" : "number";
357
355
  }
358
- function mc(e, t = {}) {
356
+ function hc(e, t = {}) {
359
357
  return (n) => st(n, e, t);
360
358
  }
361
- function Ta({
359
+ function Ma({
362
360
  number: e,
363
361
  decimalPlaces: t = 0,
364
362
  useSuffix: n = !1,
@@ -367,7 +365,7 @@ function Ta({
367
365
  locale: o = "en-US"
368
366
  }) {
369
367
  if (i) {
370
- const a = Mn(e, {
368
+ const a = _n(e, {
371
369
  currency: i,
372
370
  decimalPlaces: t,
373
371
  locale: o,
@@ -375,14 +373,14 @@ function Ta({
375
373
  });
376
374
  return n && r ? `${a}${r}` : a;
377
375
  }
378
- return kn(e, {
376
+ return On(e, {
379
377
  decimalPlaces: t,
380
378
  useSuffix: n && !r,
381
379
  suffix: r,
382
380
  locale: o
383
381
  });
384
382
  }
385
- var Da = function e(t, n) {
383
+ var Oa = function e(t, n) {
386
384
  if (t === n) return !0;
387
385
  if (t && n && typeof t == "object" && typeof n == "object") {
388
386
  if (t.constructor !== n.constructor) return !1;
@@ -408,13 +406,13 @@ var Da = function e(t, n) {
408
406
  }
409
407
  return t !== t && n !== n;
410
408
  };
411
- const Fe = /* @__PURE__ */ sa(Da);
409
+ const Fe = /* @__PURE__ */ da(Oa);
412
410
  function ct(e, t) {
413
411
  var n;
414
412
  if (t.id)
415
413
  return (n = e.sql) != null && n.trim() ? { kind: "column", columnKey: t.id } : { kind: "metric", metricId: t.id };
416
414
  }
417
- function On(e) {
415
+ function Pn(e) {
418
416
  const t = e.context.preferences;
419
417
  if (!t)
420
418
  return e.authoredFormat;
@@ -425,11 +423,11 @@ function On(e) {
425
423
  n ? e.context.resolveBoundCurrency(n) : void 0
426
424
  );
427
425
  }
428
- function ka(e) {
429
- const t = H(e.card)[e.columnKey], n = (t == null ? void 0 : t.type) === "number" ? gr(
426
+ function _a(e) {
427
+ const t = H(e.card)[e.columnKey], n = (t == null ? void 0 : t.type) === "number" ? yr(
430
428
  { dataType: "number", format: void 0 },
431
429
  t
432
- ) : void 0, r = n == null ? void 0 : n.authoredFormat, i = N(r) ? On({
430
+ ) : void 0, r = n == null ? void 0 : n.authoredFormat, i = N(r) ? Pn({
433
431
  card: e.card,
434
432
  metric: {
435
433
  id: e.columnKey
@@ -447,9 +445,9 @@ function ka(e) {
447
445
  format: i
448
446
  };
449
447
  }
450
- function pc(e) {
448
+ function yc(e) {
451
449
  const t = new Set(
452
- Pr(e.records)
450
+ Nr(e.records)
453
451
  ), n = new Set(
454
452
  e.renderedMetricKeys || e.resultKeys
455
453
  ), r = H(e.card);
@@ -460,19 +458,19 @@ function pc(e) {
460
458
  }
461
459
  );
462
460
  }
463
- function gc(e) {
461
+ function bc(e) {
464
462
  var o, a;
465
463
  const { card: t, context: n } = e;
466
- if (!(n != null && n.preferences) || !sn(t.type))
464
+ if (!(n != null && n.preferences) || !cn(t.type))
467
465
  return t;
468
466
  const r = n.preferences, i = (o = t.sql) != null && o.trim() ? e.resultMetricKeys.map(
469
- (s) => ka({
467
+ (s) => _a({
470
468
  card: t,
471
469
  columnKey: s,
472
470
  context: n
473
471
  })
474
472
  ) : (((a = t.config) == null ? void 0 : a.metricColumns) || []).map((s) => {
475
- const c = rn(t, s), l = c.authoredFormat;
473
+ const c = an(t, s), l = c.authoredFormat;
476
474
  if (!N(l))
477
475
  return s;
478
476
  const d = ct(t, s), u = d ? n.resolveBoundCurrency(d) : void 0;
@@ -482,7 +480,7 @@ function gc(e) {
482
480
  l,
483
481
  r,
484
482
  u
485
- ) : On({
483
+ ) : Pn({
486
484
  card: t,
487
485
  metric: s,
488
486
  context: n,
@@ -501,7 +499,7 @@ function gc(e) {
501
499
  function De(e) {
502
500
  var c;
503
501
  const { card: t, context: n, formatOptions: r } = e, i = n == null ? void 0 : n.preferences;
504
- if (!t || !i || !sn(t.type))
502
+ if (!t || !i || !cn(t.type))
505
503
  return r;
506
504
  if (!r) {
507
505
  const l = e.metrics.filter(
@@ -571,30 +569,30 @@ function De(e) {
571
569
  function ze(e) {
572
570
  return e ? Object.entries(e).some(([t, n]) => n == null || n === "" ? !1 : t === "type" ? n !== "auto" : !0) : !1;
573
571
  }
574
- function _n(e) {
572
+ function An(e) {
575
573
  if (e)
576
574
  return e.alias || e.label || e.name;
577
575
  }
578
576
  function je(e, t) {
579
577
  var r;
580
578
  return (((r = e == null ? void 0 : e.config) == null ? void 0 : r.metricColumns) || []).find((i) => {
581
- const o = _n(i);
579
+ const o = An(i);
582
580
  return t.metricId && i.id === t.metricId || t.metricAlias && o === t.metricAlias || t.metricAlias && i.alias === t.metricAlias || t.columnId && o === t.columnId || t.columnId && i.alias === t.columnId || t.columnId && i.label === t.columnId || t.columnId && i.name === t.columnId;
583
581
  });
584
582
  }
585
583
  function le(e, t) {
586
584
  var r, i;
587
- const n = Ar(e, t);
588
- if (!(n && ((i = (r = e == null ? void 0 : e.config) == null ? void 0 : r.groupByColumns) != null && i.includes(n)) && !Nr(n)))
585
+ const n = $r(e, t);
586
+ if (!(n && ((i = (r = e == null ? void 0 : e.config) == null ? void 0 : r.groupByColumns) != null && i.includes(n)) && !Er(n)))
589
587
  return n;
590
588
  }
591
- function Ma(e) {
589
+ function Pa(e) {
592
590
  return !!e && !(e != null && e.format) && ce(e == null ? void 0 : e.dataType) === "number";
593
591
  }
594
- const Oa = {
592
+ const Aa = {
595
593
  style: "decimal"
596
594
  };
597
- function Pn(e) {
595
+ function Nn(e) {
598
596
  if (!e)
599
597
  return;
600
598
  const t = ot();
@@ -603,7 +601,7 @@ function Pn(e) {
603
601
  ...e,
604
602
  inheritMetricFormat: e.numberFormat ? e.inheritMetricFormat : e.inheritMetricFormat ?? t.inheritMetricFormat,
605
603
  numberFormat: {
606
- ...Oa,
604
+ ...Aa,
607
605
  ...e.numberFormat
608
606
  },
609
607
  dateFormat: {
@@ -616,18 +614,18 @@ function Pn(e) {
616
614
  }
617
615
  };
618
616
  }
619
- function hc(e) {
617
+ function vc(e) {
620
618
  return Object.fromEntries(
621
619
  Object.entries(e || {}).map(([t, n]) => [
622
620
  t,
623
- Pn(n)
621
+ Nn(n)
624
622
  ])
625
623
  );
626
624
  }
627
625
  function fe(e) {
628
626
  return !!(e && typeof e == "object" && !Array.isArray(e) && Object.getPrototypeOf(e) === Object.prototype);
629
627
  }
630
- function An(e, t, n) {
628
+ function $n(e, t, n) {
631
629
  if (!fe(n))
632
630
  return n;
633
631
  const r = fe(e) ? e : {}, i = fe(t) ? t : {}, o = {};
@@ -645,7 +643,7 @@ function An(e, t, n) {
645
643
  }
646
644
  if (!c && Fe(s, l))
647
645
  continue;
648
- const d = An(
646
+ const d = $n(
649
647
  r[a],
650
648
  l,
651
649
  s
@@ -654,8 +652,8 @@ function An(e, t, n) {
654
652
  }
655
653
  return o;
656
654
  }
657
- function yc(e) {
658
- let t = An(
655
+ function Ic(e) {
656
+ let t = $n(
659
657
  e.persisted,
660
658
  e.baseline,
661
659
  e.next
@@ -663,11 +661,11 @@ function yc(e) {
663
661
  if (e.enforceDeclaredSqlTemporalFormat && e.next.type === "date" && !e.next.dateFormat.useRelativeTime && e.next.dateFormat.useCustomFormat) {
664
662
  const n = e.next.dateFormat.customFormat;
665
663
  if (!(n != null && n.trim()))
666
- throw new zi(
664
+ throw new Wi(
667
665
  "invalid_raw_temporal_format",
668
666
  "Custom table date formatting requires a non-empty pattern."
669
667
  );
670
- ji({
668
+ Hi({
671
669
  dialect: "date_fns",
672
670
  pattern: n,
673
671
  valueKind: e.rawTemporalValueKind
@@ -693,7 +691,7 @@ function yc(e) {
693
691
  type: "date"
694
692
  } : t;
695
693
  }
696
- function _a(e, t) {
694
+ function Na(e, t) {
697
695
  const n = e || ot(), r = !t;
698
696
  return {
699
697
  ...n,
@@ -711,21 +709,21 @@ function Ne(e) {
711
709
  if (e)
712
710
  return e.trim().toLowerCase();
713
711
  }
714
- const Nn = /\s*(?:\((?:previous|last year|start|target|comparison)\)|δ)\s*$/i;
715
- function Pa(e) {
712
+ const En = /\s*(?:\((?:previous|last year|start|target|comparison)\)|δ)\s*$/i;
713
+ function $a(e) {
716
714
  const t = e == null ? void 0 : e.trim();
717
- return t ? t.replace(Nn, "").trim() || t : void 0;
715
+ return t ? t.replace(En, "").trim() || t : void 0;
718
716
  }
719
- function Aa(e) {
717
+ function Ea(e) {
720
718
  const t = e == null ? void 0 : e.trim();
721
- return t ? Nn.test(t) : !1;
719
+ return t ? En.test(t) : !1;
722
720
  }
723
- function Na(e, t) {
721
+ function Ra(e, t) {
724
722
  return t.metricAlias ? e.find(
725
- (n) => Ri(n) === t.metricAlias
723
+ (n) => Vi(n) === t.metricAlias
726
724
  ) : t.metricId ? e.find((n) => n.id === t.metricId) : void 0;
727
725
  }
728
- function Ea(e) {
726
+ function Ka(e) {
729
727
  var y;
730
728
  const {
731
729
  card: t,
@@ -736,12 +734,12 @@ function Ea(e) {
736
734
  metricKey: a
737
735
  } = e, s = ((y = t == null ? void 0 : t.config) == null ? void 0 : y.metricColumns) || [];
738
736
  if (r || n)
739
- return Na(s, {
737
+ return Ra(s, {
740
738
  metricAlias: r,
741
739
  metricId: n
742
740
  });
743
741
  const c = [a, o], l = c.some(
744
- (g) => Aa(g)
742
+ (g) => Ea(g)
745
743
  ), d = c.filter(
746
744
  (g) => !!g
747
745
  );
@@ -753,7 +751,7 @@ function Ea(e) {
753
751
  if (h)
754
752
  return h;
755
753
  }
756
- const u = d.map((g) => Ne(g)).filter((g) => !!g), f = d.map((g) => Pa(g)).filter((g) => !!g);
754
+ const u = d.map((g) => Ne(g)).filter((g) => !!g), f = d.map((g) => $a(g)).filter((g) => !!g);
757
755
  for (const g of f) {
758
756
  const h = je(t, {
759
757
  columnId: g,
@@ -776,38 +774,38 @@ function Ea(e) {
776
774
  g.alias,
777
775
  g.label,
778
776
  g.name,
779
- _n(g)
777
+ An(g)
780
778
  ].map((C) => Ne(C)).filter((C) => !!C);
781
779
  return p.some(
782
780
  (C) => h.includes(C)
783
781
  );
784
782
  });
785
783
  }
786
- function $a(e) {
787
- const t = Q(e == null ? void 0 : e.format);
784
+ function Va(e) {
785
+ const t = Y(e == null ? void 0 : e.format);
788
786
  return U(t);
789
787
  }
790
- function Vt(e, t) {
788
+ function Lt(e, t) {
791
789
  if (t)
792
790
  return je(e, {
793
791
  columnId: t,
794
792
  metricAlias: t
795
793
  });
796
794
  }
797
- function Lt(e) {
795
+ function qt(e) {
798
796
  const t = ve(e);
799
797
  if (t)
800
798
  return JSON.stringify(t);
801
799
  }
802
- function Ra(e, t) {
803
- const n = Lt(e), r = Lt(t);
800
+ function La(e, t) {
801
+ const n = qt(e), r = qt(t);
804
802
  return !!(n && r && n === r);
805
803
  }
806
- function Ka(e) {
804
+ function qa(e) {
807
805
  if (e.length === 0)
808
806
  return;
809
807
  const t = e.map(
810
- (a) => $a(a)
808
+ (a) => Va(a)
811
809
  );
812
810
  if (!t.every(
813
811
  (a) => ze(a)
@@ -815,7 +813,7 @@ function Ka(e) {
815
813
  return;
816
814
  const r = t, [i] = r;
817
815
  return r.every(
818
- (a) => Ra(i, a)
816
+ (a) => La(i, a)
819
817
  ) ? i : void 0;
820
818
  }
821
819
  function ke(e) {
@@ -824,7 +822,7 @@ function ke(e) {
824
822
  formatOptions: e.overrideFormatOptions || void 0,
825
823
  source: "override"
826
824
  };
827
- const t = Ka(
825
+ const t = qa(
828
826
  e.metrics || []
829
827
  );
830
828
  return ze(t) ? {
@@ -835,7 +833,7 @@ function ke(e) {
835
833
  source: "auto"
836
834
  };
837
835
  }
838
- function En(e) {
836
+ function Rn(e) {
839
837
  var c, l, d;
840
838
  const { card: t, chartType: n, axis: r, preferences: i } = e, o = ((c = t == null ? void 0 : t.config) == null ? void 0 : c.metricColumns) || [], a = (i == null ? void 0 : i.datasetOptions) || [];
841
839
  if (!o.length)
@@ -848,20 +846,20 @@ function En(e) {
848
846
  if (n === "bubble" || n === "scatter") {
849
847
  if (r === "y2")
850
848
  return [];
851
- const u = Vt(
849
+ const u = Lt(
852
850
  t,
853
851
  (l = i == null ? void 0 : i.bubbleScatterConfig) == null ? void 0 : l.xMetricKey
854
- ) || o[0], f = Vt(
852
+ ) || o[0], f = Lt(
855
853
  t,
856
854
  (d = i == null ? void 0 : i.bubbleScatterConfig) == null ? void 0 : d.yMetricKey
857
855
  ) || o[1] || o[0];
858
856
  return r === "x" ? u ? [u] : [] : f ? [f] : [];
859
857
  }
860
- const s = Qe(n, i);
858
+ const s = Ye(n, i);
861
859
  return n === "radar" ? r === "y" ? o : [] : r !== s ? [] : o;
862
860
  }
863
861
  function lt(e) {
864
- const { card: t, chartType: n, axis: r, preferences: i, axisConfig: o } = e, a = En({
862
+ const { card: t, chartType: n, axis: r, preferences: i, axisConfig: o } = e, a = Rn({
865
863
  card: t,
866
864
  chartType: n,
867
865
  axis: r,
@@ -880,7 +878,7 @@ function lt(e) {
880
878
  })
881
879
  };
882
880
  }
883
- function Va(e) {
881
+ function Ba(e) {
884
882
  const { preferences: t, metric: n } = e, r = t == null ? void 0 : t.tooltipConfig, i = ke({
885
883
  overrideFormatOptions: Te(r == null ? void 0 : r.valueFormat),
886
884
  metrics: n ? [n] : []
@@ -896,13 +894,13 @@ function Va(e) {
896
894
  };
897
895
  }
898
896
  function dt(e, t, n) {
899
- return t === Qe(n, e) ? Er(n, e) : t === "x" ? e == null ? void 0 : e.xAxisConfig : t === "y2" ? e == null ? void 0 : e.secondaryYAxisConfig : e == null ? void 0 : e.yAxisConfig;
897
+ return t === Ye(n, e) ? Rr(n, e) : t === "x" ? e == null ? void 0 : e.xAxisConfig : t === "y2" ? e == null ? void 0 : e.secondaryYAxisConfig : e == null ? void 0 : e.yAxisConfig;
900
898
  }
901
899
  function ut(e) {
902
900
  const { chartType: t, preferences: n } = e;
903
- return t === "bubble" || t === "scatter" ? "y" : Qe(t, n);
901
+ return t === "bubble" || t === "scatter" ? "y" : Ye(t, n);
904
902
  }
905
- function $n(e) {
903
+ function Kn(e) {
906
904
  switch (e) {
907
905
  case "pie":
908
906
  case "doughnut":
@@ -915,8 +913,8 @@ function $n(e) {
915
913
  return !0;
916
914
  }
917
915
  }
918
- function bc(e) {
919
- const { card: t, chartType: n, preferences: r, metric: i } = e, o = Va({
916
+ function Cc(e) {
917
+ const { card: t, chartType: n, preferences: r, metric: i } = e, o = Ba({
920
918
  card: t,
921
919
  preferences: r,
922
920
  metric: i,
@@ -934,11 +932,11 @@ function bc(e) {
934
932
  });
935
933
  return s.source === "override" ? s : o;
936
934
  }
937
- function vc(e) {
935
+ function Fc(e) {
938
936
  const { card: t, chartType: n, preferences: r, dataLabelsConfig: i } = e, o = n || (t == null ? void 0 : t.type), a = ut({
939
937
  chartType: o,
940
938
  preferences: r
941
- }), s = En({
939
+ }), s = Rn({
942
940
  card: t,
943
941
  chartType: o,
944
942
  axis: a,
@@ -955,7 +953,7 @@ function vc(e) {
955
953
  context: e.numericPresentation
956
954
  })
957
955
  };
958
- if (l.source === "override" || !$n(o))
956
+ if (l.source === "override" || !Kn(o))
959
957
  return l;
960
958
  const d = lt({
961
959
  card: t,
@@ -971,7 +969,7 @@ function vc(e) {
971
969
  });
972
970
  return d.source === "override" ? d : l;
973
971
  }
974
- function La(e) {
972
+ function Ua(e) {
975
973
  const { preferences: t, dataLabelsConfig: n, metric: r } = e, i = ke({
976
974
  overrideFormatOptions: Te(n == null ? void 0 : n.valueFormat),
977
975
  metrics: r ? [r] : []
@@ -986,16 +984,16 @@ function La(e) {
986
984
  })
987
985
  };
988
986
  }
989
- function Ic(e) {
987
+ function Sc(e) {
990
988
  var a, s;
991
- const t = Ea({
989
+ const t = Ka({
992
990
  card: e.card,
993
991
  metricId: e.metricId,
994
992
  metricAlias: e.metricAlias,
995
993
  datasetIndex: e.datasetIndex,
996
994
  datasetLabel: e.datasetLabel,
997
995
  metricKey: e.metricKey
998
- }), n = La({
996
+ }), n = Ua({
999
997
  card: e.card,
1000
998
  preferences: e.preferences,
1001
999
  dataLabelsConfig: e.dataLabelsConfig,
@@ -1005,7 +1003,7 @@ function Ic(e) {
1005
1003
  if (n.source === "override")
1006
1004
  return n;
1007
1005
  const r = (a = e.card) == null ? void 0 : a.type;
1008
- if (!$n(r))
1006
+ if (!Kn(r))
1009
1007
  return n;
1010
1008
  let i = ut({
1011
1009
  chartType: r,
@@ -1031,10 +1029,10 @@ function Ic(e) {
1031
1029
  });
1032
1030
  return o.source === "override" ? o : n;
1033
1031
  }
1034
- function Cc(e) {
1032
+ function xc(e) {
1035
1033
  return (e == null ? void 0 : e.rawValue) === !0;
1036
1034
  }
1037
- function qa(e) {
1035
+ function za(e) {
1038
1036
  const t = e == null ? void 0 : e.numberFormat;
1039
1037
  if (!t)
1040
1038
  return;
@@ -1059,8 +1057,8 @@ function qa(e) {
1059
1057
  suffix: t.suffix
1060
1058
  };
1061
1059
  }
1062
- function Ba(e, t, n = !1) {
1063
- const r = n ? { preserveOmittedProperties: !0 } : void 0, i = Q(e == null ? void 0 : e.format, r), o = wn(
1060
+ function ja(e, t, n = !1) {
1061
+ const r = n ? { preserveOmittedProperties: !0 } : void 0, i = Y(e == null ? void 0 : e.format, r), o = Dn(
1064
1062
  i,
1065
1063
  r
1066
1064
  );
@@ -1080,8 +1078,8 @@ function Ba(e, t, n = !1) {
1080
1078
  }
1081
1079
  };
1082
1080
  }
1083
- function Rn(e) {
1084
- var D;
1081
+ function Vn(e) {
1082
+ var k;
1085
1083
  const {
1086
1084
  card: t,
1087
1085
  columnId: n,
@@ -1096,9 +1094,9 @@ function Rn(e) {
1096
1094
  valueFormatPreferences: u,
1097
1095
  boundCurrency: f,
1098
1096
  preserveOmittedProperties: m
1099
- } = e, p = r ?? H(t)[n], y = !((D = t == null ? void 0 : t.sql) != null && D.trim()) || hr(p), g = y ? u : null, h = y ? f : void 0, C = i ?? Pn(p);
1097
+ } = e, p = r ?? H(t)[n], y = !((k = t == null ? void 0 : t.sql) != null && k.trim()) || br(p), g = y ? u : null, h = y ? f : void 0, C = i ?? Nn(p);
1100
1098
  if (C && C.inheritMetricFormat !== !0)
1101
- return qt(
1099
+ return Bt(
1102
1100
  C,
1103
1101
  g,
1104
1102
  h
@@ -1110,21 +1108,21 @@ function Rn(e) {
1110
1108
  columnKeyMap: d,
1111
1109
  fieldId: c,
1112
1110
  fieldRole: l
1113
- }), b = Ba(
1111
+ }), b = ja(
1114
1112
  v,
1115
1113
  C || o,
1116
1114
  m ?? !!u
1117
- ), S = !b && g && Ma(v) ? _a(
1115
+ ), S = !b && g && Pa(v) ? Na(
1118
1116
  C || o,
1119
1117
  h
1120
1118
  ) : void 0;
1121
- return qt(
1119
+ return Bt(
1122
1120
  b || S || C || o,
1123
1121
  g,
1124
1122
  h
1125
1123
  );
1126
1124
  }
1127
- function qt(e, t, n) {
1125
+ function Bt(e, t, n) {
1128
1126
  if (!e || e.type !== "number" || !t)
1129
1127
  return e;
1130
1128
  const r = e.numberFormat, i = r ? Xe(r, {
@@ -1136,7 +1134,7 @@ function qt(e, t, n) {
1136
1134
  i,
1137
1135
  t,
1138
1136
  n
1139
- ), a = wn(o, {
1137
+ ), a = Dn(o, {
1140
1138
  preserveOmittedProperties: !0
1141
1139
  });
1142
1140
  return a ? {
@@ -1150,16 +1148,16 @@ function qt(e, t, n) {
1150
1148
  function Se(e) {
1151
1149
  if (!e.valueFormatPreferences)
1152
1150
  return;
1153
- const t = Rn(e);
1151
+ const t = Vn(e);
1154
1152
  if (!t || t.type !== "number")
1155
1153
  return;
1156
1154
  const n = Xe(t.numberFormat, {
1157
1155
  preserveOmittedProperties: !0
1158
1156
  });
1159
- if (!(!n || !Gi(n)))
1157
+ if (!(!n || !Qi(n)))
1160
1158
  return n;
1161
1159
  }
1162
- function Ua(e) {
1160
+ function Ga(e) {
1163
1161
  var r, i;
1164
1162
  if (!e.presentation.preferences)
1165
1163
  return;
@@ -1180,7 +1178,7 @@ function Ua(e) {
1180
1178
  columnKeyMap: e.columnKeyMap,
1181
1179
  metricAlias: e.metricAlias ?? (t == null ? void 0 : t.alias),
1182
1180
  valueFormatPreferences: e.presentation.preferences
1183
- }), a = Ji(e.comparisonPrecision) ?? (N(o) ? o.maximumFractionDigits : void 0) ?? (e.comparisonValueKind === "percent_change" ? 1 : 2);
1181
+ }), a = ta(e.comparisonPrecision) ?? (N(o) ? o.maximumFractionDigits : void 0) ?? (e.comparisonValueKind === "percent_change" ? 1 : 2);
1184
1182
  return e.comparisonValueKind === "percent_change" ? {
1185
1183
  type: "percent",
1186
1184
  locale: e.presentation.preferences.locale,
@@ -1195,7 +1193,7 @@ function Ua(e) {
1195
1193
  suffix: "×"
1196
1194
  };
1197
1195
  }
1198
- const n = yr({
1196
+ const n = vr({
1199
1197
  card: e.card,
1200
1198
  columnKey: e.columnId,
1201
1199
  metricId: e.metricId ?? (t && !((i = (r = e.card.config) == null ? void 0 : r.groupByColumns) != null && i.includes(t)) ? t.id : void 0)
@@ -1213,10 +1211,10 @@ function Ua(e) {
1213
1211
  boundCurrency: n ? e.presentation.resolveBoundCurrency(n) : void 0
1214
1212
  });
1215
1213
  }
1216
- function za(e) {
1214
+ function Wa(e) {
1217
1215
  var s, c, l, d, u;
1218
1216
  if (e.card.type === "matrixTable" && e.target.kind === "matrix_measure") {
1219
- const f = e.target, m = br(e.card, e.matrixCatalog).find(
1217
+ const f = e.target, m = Ir(e.card, e.matrixCatalog).find(
1220
1218
  (y) => y.measureId === f.measureId
1221
1219
  ), p = m == null ? void 0 : m.canonical;
1222
1220
  return p && (p.type === "number" || p.type === "currency") ? _(
@@ -1233,7 +1231,7 @@ function za(e) {
1233
1231
  (y) => y.id === f
1234
1232
  )))
1235
1233
  return;
1236
- const m = vr(e.card, {
1234
+ const m = Cr(e.card, {
1237
1235
  ...f ? { column: { kind: "field", fieldId: f } } : {},
1238
1236
  resultColumnKey: e.target.kind === "column" ? e.target.columnKey : void 0
1239
1237
  }), p = m.authoredFormat;
@@ -1243,13 +1241,13 @@ function za(e) {
1243
1241
  e.boundCurrency
1244
1242
  ) : void 0;
1245
1243
  }
1246
- if (!((l = e.card.sql) != null && l.trim()) && !$r(e.card.type) && e.target.kind === "metric") {
1244
+ if (!((l = e.card.sql) != null && l.trim()) && !Kr(e.card.type) && e.target.kind === "metric") {
1247
1245
  const f = e.target.metricId, m = (u = (d = e.card.config) == null ? void 0 : d.metricColumns) == null ? void 0 : u.find(
1248
1246
  (g) => g.id === f
1249
1247
  );
1250
1248
  if (!m)
1251
1249
  return;
1252
- const p = rn(
1250
+ const p = an(
1253
1251
  e.card,
1254
1252
  m
1255
1253
  ), y = p.authoredFormat;
@@ -1280,11 +1278,11 @@ function za(e) {
1280
1278
  });
1281
1279
  return N(a) ? a : void 0;
1282
1280
  }
1283
- function Fc(e) {
1281
+ function wc(e) {
1284
1282
  var n, r;
1285
1283
  const t = e.persistedSettings ?? H(e.card)[e.columnId];
1286
1284
  if (!t && !e.resolvedSettings || (t == null ? void 0 : t.inheritMetricFormat) === !0 || ((n = e.resolvedSettings) == null ? void 0 : n.inheritMetricFormat) === !0) {
1287
- const i = Q(
1285
+ const i = Y(
1288
1286
  (r = le(e.card, {
1289
1287
  columnId: e.columnId,
1290
1288
  metricId: e.metricId,
@@ -1298,16 +1296,16 @@ function Fc(e) {
1298
1296
  preserveOmittedProperties: !0
1299
1297
  });
1300
1298
  }
1301
- return qa(
1302
- Rn({
1299
+ return za(
1300
+ Vn({
1303
1301
  ...e,
1304
1302
  persistedSettings: t
1305
1303
  })
1306
1304
  );
1307
1305
  }
1308
- function Sc(e) {
1306
+ function Tc(e) {
1309
1307
  const { value: t, formatOptions: n, preferences: r } = e;
1310
- return n != null && n.type && n.type !== "auto" ? st(t, n.type, n) : Ta({
1308
+ return n != null && n.type && n.type !== "auto" ? st(t, n.type, n) : Ma({
1311
1309
  number: t,
1312
1310
  decimalPlaces: 0,
1313
1311
  useSuffix: !1,
@@ -1316,8 +1314,8 @@ function Sc(e) {
1316
1314
  currency: ""
1317
1315
  });
1318
1316
  }
1319
- function ja(e) {
1320
- return Rr({
1317
+ function Ha(e) {
1318
+ return Vr({
1321
1319
  ...e,
1322
1320
  activation: Je({
1323
1321
  card: e.card,
@@ -1325,8 +1323,8 @@ function ja(e) {
1325
1323
  })
1326
1324
  });
1327
1325
  }
1328
- function xc(e) {
1329
- return Kr({
1326
+ function Dc(e) {
1327
+ return Lr({
1330
1328
  activation: Je({
1331
1329
  card: e.card,
1332
1330
  cardConfig: e.cardConfig
@@ -1335,8 +1333,8 @@ function xc(e) {
1335
1333
  expectedResultOwner: e.expectedResultOwner
1336
1334
  });
1337
1335
  }
1338
- function Ga(e) {
1339
- const t = an(e.card, e.effectiveCardConfig), n = ya({
1336
+ function Qa(e) {
1337
+ const t = on(e.card, e.effectiveCardConfig), n = Ia({
1340
1338
  card: t,
1341
1339
  records: e.rows,
1342
1340
  keys: e.rows.length === 0 ? e.resultKeys : void 0,
@@ -1359,34 +1357,34 @@ function Ga(e) {
1359
1357
  }
1360
1358
  };
1361
1359
  }
1362
- function Wa(e) {
1360
+ function Xa(e) {
1363
1361
  var n;
1364
1362
  const t = (n = e.preferences) == null ? void 0 : n.comparisonPresentation;
1365
1363
  return {
1366
- ...Ki,
1364
+ ...Li,
1367
1365
  ...t,
1368
1366
  ...t != null && t.conditionalLabels ? { conditionalLabels: { ...t.conditionalLabels } } : {},
1369
1367
  ...t != null && t.colors ? { colors: { ...t.colors } } : {}
1370
1368
  };
1371
1369
  }
1372
- function Ha(e) {
1373
- const t = an(e.card, e.effectiveCardConfig), { cardId: n, ...r } = e.requestPayloadBase, i = e.formatOptions.visibleColumns ?? [], o = [
1370
+ function Ya(e) {
1371
+ const t = on(e.card, e.effectiveCardConfig), { cardId: n, ...r } = e.requestPayloadBase, i = e.formatOptions.visibleColumns ?? [], o = [
1374
1372
  ...i,
1375
1373
  ...Object.keys(e.formatOptions.columnSettings ?? {})
1376
- ], a = Ir(
1374
+ ], a = Fr(
1377
1375
  e.card,
1378
1376
  i,
1379
1377
  e.effectiveCardConfig
1380
- ), s = Cr(
1378
+ ), s = Sr(
1381
1379
  e.card,
1382
1380
  e.effectiveCardConfig,
1383
1381
  a
1384
- ), c = Fr(
1382
+ ), c = xr(
1385
1383
  t,
1386
1384
  o
1387
1385
  ), l = new Set(
1388
1386
  c.eligibleTargets.map(_e)
1389
- ), d = (v) => l.has(_e(v)) ? xr({
1387
+ ), d = (v) => l.has(_e(v)) ? Tr({
1390
1388
  bindings: r.controlBindings,
1391
1389
  controls: [
1392
1390
  ...r.controlDefinitions ?? [],
@@ -1396,14 +1394,14 @@ function Ha(e) {
1396
1394
  target: v,
1397
1395
  knownTargets: c.knownTargets,
1398
1396
  eligibleTargets: c.eligibleTargets
1399
- }).currency : void 0, u = Sr({
1397
+ }).currency : void 0, u = wr({
1400
1398
  card: e.card,
1401
1399
  comparisonMetadata: e.comparisonMetadata,
1402
1400
  columnKeyMap: e.columnKeyMap
1403
1401
  }), f = Je({
1404
1402
  card: e.card,
1405
1403
  cardConfig: e.effectiveCardConfig
1406
- }), m = ja({
1404
+ }), m = Ha({
1407
1405
  card: e.card,
1408
1406
  cardConfig: e.effectiveCardConfig,
1409
1407
  columns: e.resultColumns,
@@ -1425,7 +1423,7 @@ function Ha(e) {
1425
1423
  throw new Error(
1426
1424
  "Canonical raw temporal export requires an authoritative columnKeyMap."
1427
1425
  );
1428
- const b = Vr({
1426
+ const b = qr({
1429
1427
  cardType: e.card.type,
1430
1428
  resultOwner: r.resultOwner,
1431
1429
  effectiveCardConfig: e.effectiveCardConfig,
@@ -1447,10 +1445,10 @@ function Ha(e) {
1447
1445
  H(e.card)
1448
1446
  )) {
1449
1447
  if (I.type !== "date") continue;
1450
- const b = Lr(I.dateFormat);
1448
+ const b = Br(I.dateFormat);
1451
1449
  b && g.set(
1452
1450
  v,
1453
- Wi({
1451
+ Xi({
1454
1452
  format: b,
1455
1453
  preferences: e.reportContext.valueFormat,
1456
1454
  calendar: e.reportContext.calendar
@@ -1460,38 +1458,38 @@ function Ha(e) {
1460
1458
  const h = [
1461
1459
  ...new Set(o)
1462
1460
  ].flatMap((v) => {
1463
- var G, $, ue;
1461
+ var G, E, ue;
1464
1462
  if (m.byColumnKey.has(v) || g.has(v))
1465
1463
  return [];
1466
1464
  const I = u.columnPresentationOwners.get(v), b = {
1467
- ...qr(t, v, {
1465
+ ...Ur(t, v, {
1468
1466
  columnKeyMap: e.columnKeyMap,
1469
1467
  resultColumns: e.resultColumns
1470
1468
  }),
1471
1469
  ...I ? { metricId: I.metricId, metricAlias: I.metricAlias } : {}
1472
- }, S = (G = t.sql) != null && G.trim() ? void 0 : le(t, b), P = S ? { kind: "metric", metricId: S.id } : { kind: "column", columnKey: v }, D = l.has(
1470
+ }, S = (G = t.sql) != null && G.trim() ? void 0 : le(t, b), P = S ? { kind: "metric", metricId: S.id } : { kind: "column", columnKey: v }, k = l.has(
1473
1471
  _e(P)
1474
- ), L = d(P), j = H(t)[v], E = {
1472
+ ), L = d(P), j = H(t)[v], $ = {
1475
1473
  dashboardId: e.dashboardId,
1476
1474
  cardId: t.id
1477
- }, ee = { kind: "column", columnKey: v }, k = S && (!j || j.inheritMetricFormat === !0) ? Q(S.format, {
1475
+ }, ee = { kind: "column", columnKey: v }, M = S && (!j || j.inheritMetricFormat === !0) ? Y(S.format, {
1478
1476
  preserveOmittedProperties: !0
1479
1477
  }) : void 0;
1480
- if ((k == null ? void 0 : k.type) === "date")
1478
+ if ((M == null ? void 0 : M.type) === "date")
1481
1479
  return [
1482
1480
  {
1483
- scope: E,
1481
+ scope: $,
1484
1482
  target: ee,
1485
1483
  format: {
1486
1484
  type: "date",
1487
- locale: k.locale ?? e.reportContext.valueFormat.locale,
1488
- ...k.pattern ? { pattern: k.pattern } : {},
1489
- ...k.timezone ? { timezone: k.timezone } : {},
1490
- ...k.sourceTimezone ? { sourceTimezone: k.sourceTimezone } : {}
1485
+ locale: M.locale ?? e.reportContext.valueFormat.locale,
1486
+ ...M.pattern ? { pattern: M.pattern } : {},
1487
+ ...M.timezone ? { timezone: M.timezone } : {},
1488
+ ...M.sourceTimezone ? { sourceTimezone: M.sourceTimezone } : {}
1491
1489
  }
1492
1490
  }
1493
1491
  ];
1494
- const q = (I ? Ua({
1492
+ const q = (I ? Ga({
1495
1493
  card: t,
1496
1494
  columnId: v,
1497
1495
  columnKeyMap: e.columnKeyMap,
@@ -1499,12 +1497,12 @@ function Ha(e) {
1499
1497
  metricId: I.metricId,
1500
1498
  metricAlias: I.metricAlias,
1501
1499
  comparisonValueKind: I.kind,
1502
- comparisonPrecision: (ue = ($ = t.preferences) == null ? void 0 : $.comparisonPresentation) == null ? void 0 : ue.precision,
1500
+ comparisonPrecision: (ue = (E = t.preferences) == null ? void 0 : E.comparisonPresentation) == null ? void 0 : ue.precision,
1503
1501
  presentation: {
1504
1502
  preferences: e.reportContext.valueFormat,
1505
1503
  resolveBoundCurrency: d
1506
1504
  }
1507
- }) : void 0) ?? (D ? za({
1505
+ }) : void 0) ?? (k ? Wa({
1508
1506
  card: t,
1509
1507
  target: P,
1510
1508
  resultColumnKeys: o,
@@ -1528,7 +1526,7 @@ function Ha(e) {
1528
1526
  e.reportContext.valueFormat
1529
1527
  );
1530
1528
  return [
1531
- B.type === "duration" ? { scope: E, target: ee, format: B } : { scope: E, target: ee, format: B }
1529
+ B.type === "duration" ? { scope: $, target: ee, format: B } : { scope: $, target: ee, format: B }
1532
1530
  ];
1533
1531
  });
1534
1532
  h.push(
@@ -1546,7 +1544,7 @@ function Ha(e) {
1546
1544
  cardId: e.card.id
1547
1545
  },
1548
1546
  target: { kind: "column", columnKey: v.columnKey },
1549
- format: Br(
1547
+ format: zr(
1550
1548
  I,
1551
1549
  {
1552
1550
  dateStyle: e.reportContext.valueFormat.dateStyle,
@@ -1563,7 +1561,7 @@ function Ha(e) {
1563
1561
  format: I
1564
1562
  }))
1565
1563
  );
1566
- const C = Hi({
1564
+ const C = Yi({
1567
1565
  reportContext: e.reportContext,
1568
1566
  resolvedFormats: h
1569
1567
  });
@@ -1571,17 +1569,17 @@ function Ha(e) {
1571
1569
  formatOptions: {
1572
1570
  ...e.formatOptions,
1573
1571
  ...a ? { tableTotalsLabelColumnKey: a } : {},
1574
- comparisonPresentation: Wa(e.card),
1572
+ comparisonPresentation: Xa(e.card),
1575
1573
  presentationExecutionSnapshot: C
1576
1574
  },
1577
1575
  ...s ? { tableTotalsRequest: s } : {}
1578
1576
  };
1579
1577
  }
1580
- function Ya(e) {
1581
- const t = Tr(
1578
+ function Ja(e) {
1579
+ const t = kr(
1582
1580
  e.card,
1583
1581
  e.requestPayloadBase
1584
- ), { cardId: n, ...r } = t.requestPayloadBase, i = Ha(e);
1582
+ ), { cardId: n, ...r } = t.requestPayloadBase, i = Ya(e);
1585
1583
  return {
1586
1584
  type: "card",
1587
1585
  dashboardId: e.dashboardId,
@@ -1595,14 +1593,14 @@ function Ya(e) {
1595
1593
  formatOptions: i.formatOptions
1596
1594
  };
1597
1595
  }
1598
- function wc(e) {
1596
+ function kc(e) {
1599
1597
  const { card: t, result: n } = e;
1600
1598
  if (t.type !== "table" && t.type !== "detailTable")
1601
1599
  return { status: "refused", reason: "not_a_table" };
1602
- const r = n.modelFormats ? Yi(e.effectiveCardConfig ?? t.config, n) : e.effectiveCardConfig;
1603
- if (wr({ card: t, comparisonMetadata: n.comparisonMetadata }))
1600
+ const r = n.modelFormats ? Ji(e.effectiveCardConfig ?? t.config, n) : e.effectiveCardConfig;
1601
+ if (Dr({ card: t, comparisonMetadata: n.comparisonMetadata }))
1604
1602
  return { status: "refused", reason: "comparison_metadata_missing" };
1605
- const i = Ga({
1603
+ const i = Qa({
1606
1604
  card: t,
1607
1605
  effectiveCardConfig: r,
1608
1606
  rows: e.rows,
@@ -1613,7 +1611,7 @@ function wc(e) {
1613
1611
  });
1614
1612
  return i ? {
1615
1613
  status: "ready",
1616
- request: Ya({
1614
+ request: Ja({
1617
1615
  card: t,
1618
1616
  dashboardId: e.dashboardId,
1619
1617
  title: e.title,
@@ -1629,9 +1627,9 @@ function wc(e) {
1629
1627
  })
1630
1628
  } : { status: "refused", reason: "columns_unresolved" };
1631
1629
  }
1632
- function Kn(e, t, n) {
1633
- if (Oi(
1634
- _i(t),
1630
+ function Ln(e, t, n) {
1631
+ if (Pi(
1632
+ Ai(t),
1635
1633
  e.aggregateOrigin
1636
1634
  ))
1637
1635
  return { aggregate: void 0, aggregateOrigin: void 0 };
@@ -1641,7 +1639,7 @@ function Kn(e, t, n) {
1641
1639
  aggregateOrigin: e.aggregate ? e.aggregateOrigin : r ? t.aggregateOrigin : void 0
1642
1640
  };
1643
1641
  }
1644
- function Xa(e, t, n) {
1642
+ function Za(e, t, n) {
1645
1643
  var r, i, o, a, s, c;
1646
1644
  if (n === "domain")
1647
1645
  return {
@@ -1654,7 +1652,7 @@ function Xa(e, t, n) {
1654
1652
  windowTransform: ((s = e.parameters) == null ? void 0 : s.windowTransform) ?? ((c = t.parameters) == null ? void 0 : c.windowTransform)
1655
1653
  };
1656
1654
  }
1657
- function Tc(e, t, n) {
1655
+ function Mc(e, t, n) {
1658
1656
  const r = e;
1659
1657
  return {
1660
1658
  id: e.id,
@@ -1663,22 +1661,22 @@ function Tc(e, t, n) {
1663
1661
  // range bounds). They do not identify or redefine the catalog calculation.
1664
1662
  ...n === "selection" && e.alias ? { alias: e.alias } : {},
1665
1663
  granularity: e.granularity ?? t.granularity,
1666
- ...Kn(e, t, n),
1664
+ ...Ln(e, t, n),
1667
1665
  ...e.role === "metric" ? {
1668
1666
  aliasTemplate: r.aliasTemplate,
1669
1667
  valueAliases: r.valueAliases,
1670
1668
  comparison: r.comparison,
1671
1669
  comparisonPolarity: r.comparisonPolarity,
1672
- parameters: Xa(
1670
+ parameters: Za(
1673
1671
  r,
1674
1672
  t,
1675
1673
  "domain"
1676
1674
  )
1677
1675
  } : {},
1678
- ...Qa(e)
1676
+ ...eo(e)
1679
1677
  };
1680
1678
  }
1681
- function Qa(e) {
1679
+ function eo(e) {
1682
1680
  const t = {
1683
1681
  ...e.labelOrigin === "override" ? { label: e.label, labelOrigin: e.labelOrigin } : {},
1684
1682
  ...e.formatOrigin === "override" ? { format: e.format, formatOrigin: e.formatOrigin } : {}
@@ -1698,17 +1696,17 @@ function Qa(e) {
1698
1696
  return t;
1699
1697
  }
1700
1698
  }
1701
- const Ja = "table";
1702
- function Dc({ preferences: e, ...t }) {
1699
+ const to = "table";
1700
+ function Oc({ preferences: e, ...t }) {
1703
1701
  return {
1704
1702
  ...t,
1705
- type: Ja,
1703
+ type: to,
1706
1704
  preferences: e ?? { onClickFilter: [{ columnIndex: 0, expression: "" }] },
1707
1705
  sql: "",
1708
1706
  data: []
1709
1707
  };
1710
1708
  }
1711
- function kc(e) {
1709
+ function _c(e) {
1712
1710
  return {
1713
1711
  id: e.id,
1714
1712
  title: e.title,
@@ -1718,7 +1716,7 @@ function kc(e) {
1718
1716
  data: []
1719
1717
  };
1720
1718
  }
1721
- const Za = {
1719
+ const no = {
1722
1720
  SUM: "total",
1723
1721
  AVG: "average",
1724
1722
  MIN: "lowest",
@@ -1734,12 +1732,12 @@ function me(e) {
1734
1732
  const t = e;
1735
1733
  return !e.aggregate || t.labelOrigin === "override" ? ne(e) : et(e.name);
1736
1734
  }
1737
- function Bt(e) {
1735
+ function Ut(e) {
1738
1736
  return e.length <= 1 ? e[0] ?? "" : `${e.slice(0, -1).join(", ")} and ${e[e.length - 1]}`;
1739
1737
  }
1740
- function eo(e) {
1738
+ function ro(e) {
1741
1739
  var i, o, a;
1742
- const t = Zi({ variables: [e] })[0];
1740
+ const t = na({ variables: [e] })[0];
1743
1741
  if (!t) return;
1744
1742
  const n = Ze(t.card), r = n.kind === "config" ? n.executableSources[0] : n.kind === "sql" ? (i = n.pinnedCatalogSources[0]) == null ? void 0 : i.source : void 0;
1745
1743
  if (!r) {
@@ -1749,55 +1747,55 @@ function eo(e) {
1749
1747
  if (r.kind === "semantic") return r.label || r.datasetName;
1750
1748
  if (r.kind === "physical") return r.label || r.tableName;
1751
1749
  }
1752
- function to(e) {
1750
+ function io(e) {
1753
1751
  var r;
1754
- const t = (r = e.query.config) == null ? void 0 : r.filters, n = t ? Vn(t) : 0;
1752
+ const t = (r = e.query.config) == null ? void 0 : r.filters, n = t ? qn(t) : 0;
1755
1753
  return n ? n === 1 ? " with one condition" : ` with ${n} conditions` : "";
1756
1754
  }
1757
- function Vn(e) {
1755
+ function qn(e) {
1758
1756
  var t;
1759
- return (((t = e.conditions) == null ? void 0 : t.length) ?? 0) + (e.groups ?? []).reduce((n, r) => n + Vn(r), 0);
1757
+ return (((t = e.conditions) == null ? void 0 : t.length) ?? 0) + (e.groups ?? []).reduce((n, r) => n + qn(r), 0);
1760
1758
  }
1761
- function Ut(e) {
1759
+ function zt(e) {
1762
1760
  if (!e) return "";
1763
1761
  const t = ce(e.dataType), n = t === "date" || t === "datetime" ? e.direction === "desc" ? "latest first" : "earliest first" : t === "number" ? e.direction === "desc" ? "highest first" : "lowest first" : e.direction === "desc" ? "Z to A" : "A to Z";
1764
1762
  return ` by ${e.aggregate ? me(e) : ne(e)}, ${n}`;
1765
1763
  }
1766
- function no(e) {
1764
+ function ao(e) {
1767
1765
  var s, c, l;
1768
- const t = eo(e), n = t ? ` in ${t}` : "", r = to(e);
1766
+ const t = ro(e), n = t ? ` in ${t}` : "", r = io(e);
1769
1767
  if ((s = e.query.sql) != null && s.trim()) {
1770
1768
  const d = e.get.kind === "first" ? "the first row" : "the only row";
1771
- return `${ro(d)} of a SQL query${t ? ` on ${t}` : ""}`;
1769
+ return `${oo(d)} of a SQL query${t ? ` on ${t}` : ""}`;
1772
1770
  }
1773
1771
  const i = e.query.config ?? {}, o = i.groupByColumns ?? [], a = i.metricColumns ?? [];
1774
1772
  switch (e.get.kind) {
1775
1773
  case "aggregate": {
1776
1774
  const d = a[0];
1777
- return d ? d.aggregate ? `The ${Za[String(d.aggregate).toUpperCase()] ?? String(d.aggregate).toLowerCase()} ${me(d)}${n}${r}${zt(e)}` : `The ${ne(d)}${n}${r}${zt(e)}` : "An aggregate, with no measure chosen yet";
1775
+ return d ? d.aggregate ? `The ${no[String(d.aggregate).toUpperCase()] ?? String(d.aggregate).toLowerCase()} ${me(d)}${n}${r}${jt(e)}` : `The ${ne(d)}${n}${r}${jt(e)}` : "An aggregate, with no measure chosen yet";
1778
1776
  }
1779
1777
  case "list": {
1780
1778
  const d = o[0];
1781
- return d ? `The ${ne(d)} values${n}${r}, as a list${Ut((c = i.sortByColumns) == null ? void 0 : c[0])}` : "A list, with no field chosen yet";
1779
+ return d ? `The ${ne(d)} values${n}${r}, as a list${zt((c = i.sortByColumns) == null ? void 0 : c[0])}` : "A list, with no field chosen yet";
1782
1780
  }
1783
1781
  case "first": {
1784
1782
  const d = [...o.map(ne), ...a.map(me)];
1785
- return d.length ? `The first ${Bt(d)}${n}${r}${Ut((l = i.sortByColumns) == null ? void 0 : l[0])}` : "The first row, with no field chosen yet";
1783
+ return d.length ? `The first ${Ut(d)}${n}${r}${zt((l = i.sortByColumns) == null ? void 0 : l[0])}` : "The first row, with no field chosen yet";
1786
1784
  }
1787
1785
  default: {
1788
1786
  const d = [...o.map(ne), ...a.map(me)];
1789
- return d.length ? `The ${Bt(d)}${n}${r}, the only value` : "The only value, with no field chosen yet";
1787
+ return d.length ? `The ${Ut(d)}${n}${r}, the only value` : "The only value, with no field chosen yet";
1790
1788
  }
1791
1789
  }
1792
1790
  }
1793
- function zt(e) {
1794
- const t = ea(e);
1795
- return t ? `, compared with ${Ur({ mode: "explicit", spec: t })}` : "";
1791
+ function jt(e) {
1792
+ const t = ra(e);
1793
+ return t ? `, compared with ${jr({ mode: "explicit", spec: t })}` : "";
1796
1794
  }
1797
- function ro(e) {
1795
+ function oo(e) {
1798
1796
  return e.charAt(0).toUpperCase() + e.slice(1);
1799
1797
  }
1800
- function io(e, t) {
1798
+ function so(e, t) {
1801
1799
  const n = e.sheets ?? [], r = n.findIndex((a) => a.id === t.sheetId), i = n[r];
1802
1800
  if (!i)
1803
1801
  throw new F("sheet_not_found", `No sheet ${t.sheetId} on this dashboard.`);
@@ -1813,11 +1811,11 @@ function io(e, t) {
1813
1811
  clauses: [T.arranged(i.title || "the dashboard", t.keepOrder === !0, !(i.frames ?? []).length)]
1814
1812
  };
1815
1813
  }
1816
- function ao(e) {
1814
+ function co(e) {
1817
1815
  return !!(e && Object.prototype.hasOwnProperty.call(e, "calculatedFields"));
1818
1816
  }
1819
1817
  function X(...e) {
1820
- return zr(e.flatMap((t) => t || []));
1818
+ return Gr(e.flatMap((t) => t || []));
1821
1819
  }
1822
1820
  function ie(e, t) {
1823
1821
  return {
@@ -1828,10 +1826,10 @@ function ie(e, t) {
1828
1826
  function ft(e) {
1829
1827
  return ((e == null ? void 0 : e.calculatedFields) || []).filter((t) => t.fieldScope === "sheet").map((t) => ie(t, "sheet"));
1830
1828
  }
1831
- function Ln(e) {
1829
+ function Bn(e) {
1832
1830
  return ((e == null ? void 0 : e.calculatedFields) || []).filter((t) => !t.fieldScope).map((t) => ie(t, "sheet"));
1833
1831
  }
1834
- function oo(e) {
1832
+ function lo(e) {
1835
1833
  return e ? [
1836
1834
  ...(e.calculatedFields || []).filter(
1837
1835
  (t) => t.fieldScope === "dashboard"
@@ -1839,21 +1837,21 @@ function oo(e) {
1839
1837
  ...(e.frames || []).flatMap((t) => t.calculatedFields || [])
1840
1838
  ].map((t) => ie(t, "dashboard")) : [];
1841
1839
  }
1842
- function so(e) {
1840
+ function uo(e) {
1843
1841
  if (e !== void 0)
1844
1842
  return X(
1845
1843
  e.map((t) => ie(t, "dashboard"))
1846
1844
  );
1847
1845
  }
1848
- function Mc(e) {
1846
+ function Pc(e) {
1849
1847
  var r;
1850
1848
  const t = [], n = (e.sheets || []).map((i) => {
1851
1849
  var o;
1852
- return t.push(...oo(i)), {
1850
+ return t.push(...lo(i)), {
1853
1851
  ...i,
1854
1852
  calculatedFields: X(
1855
1853
  ft(i),
1856
- Ln(i)
1854
+ Bn(i)
1857
1855
  ),
1858
1856
  frames: (o = i.frames) == null ? void 0 : o.map(
1859
1857
  (a) => a.calculatedFields === void 0 ? a : { ...a, calculatedFields: void 0 }
@@ -1862,7 +1860,7 @@ function Mc(e) {
1862
1860
  });
1863
1861
  return {
1864
1862
  ...e,
1865
- calculatedFields: so(
1863
+ calculatedFields: uo(
1866
1864
  X(
1867
1865
  (r = e.calculatedFields) == null ? void 0 : r.map(
1868
1866
  (i) => ie(i, "dashboard")
@@ -1873,7 +1871,7 @@ function Mc(e) {
1873
1871
  sheets: n
1874
1872
  };
1875
1873
  }
1876
- function jt(e, t) {
1874
+ function Gt(e, t) {
1877
1875
  var i;
1878
1876
  if (!((i = e == null ? void 0 : e.frames) != null && i.length))
1879
1877
  return [];
@@ -1885,30 +1883,30 @@ function jt(e, t) {
1885
1883
  ...r.map((o) => o.calculatedFields)
1886
1884
  );
1887
1885
  }
1888
- function co(e, t) {
1886
+ function fo(e, t) {
1889
1887
  return e ? ft(e) : [];
1890
1888
  }
1891
- function Oc(e, t) {
1889
+ function Ac(e, t) {
1892
1890
  if (!e)
1893
1891
  return [];
1894
- const n = ft(e), r = Ln(e), i = X(
1892
+ const n = ft(e), r = Bn(e), i = X(
1895
1893
  n,
1896
1894
  r
1897
1895
  );
1898
- return ao(e) ? i.length === 0 ? [] : r.length === 0 ? i : X(
1896
+ return co(e) ? i.length === 0 ? [] : r.length === 0 ? i : X(
1899
1897
  i,
1900
- jt(e, t)
1901
- ) : jt(e, t);
1898
+ Gt(e, t)
1899
+ ) : Gt(e, t);
1902
1900
  }
1903
- function lo(e) {
1901
+ function mo(e) {
1904
1902
  if (e !== void 0)
1905
1903
  return X(
1906
1904
  e.map((t) => ie(t, "sheet"))
1907
1905
  );
1908
1906
  }
1909
- function _c(e) {
1907
+ function Nc(e) {
1910
1908
  const { field: t, sheetFields: n = [], dashboardFields: r = [] } = e, i = (s) => s.find(
1911
- (c) => jr(c, t, {
1909
+ (c) => Wr(c, t, {
1912
1910
  allowComparableFallback: !0
1913
1911
  })
1914
1912
  );
@@ -1922,7 +1920,7 @@ function _c(e) {
1922
1920
  const a = i(r);
1923
1921
  return a ? { scope: "dashboard", matchedField: a } : { scope: "card" };
1924
1922
  }
1925
- function uo(e, t) {
1923
+ function po(e, t) {
1926
1924
  var C, v, I;
1927
1925
  const n = (e.sheets ?? []).findIndex((b) => b.id === t.sheetId), r = (C = e.sheets) == null ? void 0 : C[n];
1928
1926
  if (!(r != null && r.frames))
@@ -1935,25 +1933,25 @@ function uo(e, t) {
1935
1933
  return b.some((S) => S.id === i.id) ? b : [i, ...b];
1936
1934
  })() : [i], u = new Map(d.map((b) => [b.id, b])), f = J(r, { kind: "frame_updated", frame: i, resizeForNewKind: t.resizeLayouts });
1937
1935
  let m = /* @__PURE__ */ new Set();
1938
- const p = Gr.produce(e, (b) => {
1936
+ const p = Hr.produce(e, (b) => {
1939
1937
  const S = b.sheets[n];
1940
- f.layouts !== r.layouts && (S.layouts = Dt(f.layouts)), f.customizedBreakpoints !== r.customizedBreakpoints && (S.customizedBreakpoints = f.customizedBreakpoints), t.sheetCalculatedFields !== void 0 && (S.calculatedFields = lo(t.sheetCalculatedFields)), S.frames = S.frames.map((D) => {
1941
- const L = u.get(D.id);
1942
- return L ? Dt(c(L)) : D.calculatedFields === void 0 ? D : { ...D, calculatedFields: void 0 };
1938
+ f.layouts !== r.layouts && (S.layouts = Dt(f.layouts)), f.customizedBreakpoints !== r.customizedBreakpoints && (S.customizedBreakpoints = f.customizedBreakpoints), t.sheetCalculatedFields !== void 0 && (S.calculatedFields = mo(t.sheetCalculatedFields)), S.frames = S.frames.map((k) => {
1939
+ const L = u.get(k.id);
1940
+ return L ? Dt(c(L)) : k.calculatedFields === void 0 ? k : { ...k, calculatedFields: void 0 };
1943
1941
  });
1944
1942
  const P = Tt(S);
1945
- m = new Set([...s].filter((D) => !P.has(D))), Wr(b, m), t.dashboardCalculatedFields && (b.calculatedFields = t.dashboardCalculatedFields);
1943
+ m = new Set([...s].filter((k) => !P.has(k))), Qr(b, m), t.dashboardCalculatedFields && (b.calculatedFields = t.dashboardCalculatedFields);
1946
1944
  }), y = p.sheets[n].frames.find((b) => b.id === i.id), g = [
1947
1945
  ...m.size ? [{ kind: "cards_removed", cardIds: [...m] }] : [],
1948
1946
  { kind: "frame_committed", sheetId: t.sheetId, before: a, after: y }
1949
1947
  ], h = ((v = i.cards) == null ? void 0 : v.find((b) => b.id === i.activeCardId)) ?? ((I = i.cards) == null ? void 0 : I[0]);
1950
1948
  return { dashboard: p, runtimeEffects: g, clauses: [T.committed(h == null ? void 0 : h.title)] };
1951
1949
  }
1952
- function fo(e, t) {
1950
+ function go(e, t) {
1953
1951
  const n = { ...e }, r = [];
1954
1952
  return t.title !== void 0 && t.title !== e.title && (n.title = t.title, r.push(T.plain("dashboard", `renames the dashboard to ${w(t.title)}`))), t.description === null && e.description ? (delete n.description, r.push(T.plain("dashboard", "removes the dashboard's description"))) : typeof t.description == "string" && t.description !== e.description && (n.description = t.description, r.push(T.plain("dashboard", "changes the dashboard's description"))), { dashboard: n, clauses: r.length ? r : [T.plain("dashboard", "changes nothing on the dashboard")] };
1955
1953
  }
1956
- function mo(e, t, n) {
1954
+ function ho(e, t, n) {
1957
1955
  const r = e.sheets ?? [], i = r.findIndex((s) => s.id === t), o = r[i];
1958
1956
  if (!o) throw new F("sheet_not_found", `No sheet ${t} on this dashboard.`);
1959
1957
  if (xe(o))
@@ -1961,7 +1959,7 @@ function mo(e, t, n) {
1961
1959
  const a = n.map((s) => {
1962
1960
  const c = (o.frames ?? []).find((l) => l.cards.some((d) => d.id === s));
1963
1961
  if (!c)
1964
- throw new F("card_not_found", `No card ${s} on ${Hr(o)}.`, "Read the outline again and use its card ids.");
1962
+ throw new F("card_not_found", `No card ${s} on ${Xr(o)}.`, "Read the outline again and use its card ids.");
1965
1963
  return c.cards.find((l) => l.id === s);
1966
1964
  });
1967
1965
  return { sheets: r, sheetIndex: i, sheet: o, cards: a };
@@ -1971,28 +1969,28 @@ function Ge(e) {
1971
1969
  const { visualId: t, ...n } = e;
1972
1970
  return n;
1973
1971
  }
1974
- const qn = (e) => e.cards.find((t) => t.id === e.activeCardId) ?? e.cards[0], Ee = (e) => T.plain("detached", `makes ${e} local to this report; it no longer follows its library visual`);
1975
- function po(e, t) {
1972
+ const Un = (e) => e.cards.find((t) => t.id === e.activeCardId) ?? e.cards[0], $e = (e) => T.plain("detached", `makes ${e} local to this report; it no longer follows its library visual`);
1973
+ function yo(e, t) {
1976
1974
  var p;
1977
- const { sheets: n, sheetIndex: r, sheet: i, cards: o } = mo(e, t.sheetId, t.cardIds), a = pe(i, t.cardIds[0]).id;
1975
+ const { sheets: n, sheetIndex: r, sheet: i, cards: o } = ho(e, t.sheetId, t.cardIds), a = pe(i, t.cardIds[0]).id;
1978
1976
  let s = i;
1979
1977
  const c = [];
1980
1978
  for (const y of t.cardIds.slice(1)) {
1981
1979
  const g = pe(s, y);
1982
1980
  if (g.id === a) continue;
1983
- const h = cn(g, y);
1981
+ const h = ln(g, y);
1984
1982
  if (!h.cards.length) {
1985
- g.visualId && c.push(Ee(w(g.cards[0].title))), s = J(s, { kind: "frame_removed", frameId: g.id });
1983
+ g.visualId && c.push($e(w(g.cards[0].title))), s = J(s, { kind: "frame_removed", frameId: g.id });
1986
1984
  continue;
1987
1985
  }
1988
- g.visualId && c.push(Ee(`the tile of ${w((p = qn(h)) == null ? void 0 : p.title)}`)), s = J(s, { kind: "frame_updated", frame: g.visualId ? Ge(h) : h, resizeForNewKind: !0 });
1986
+ g.visualId && c.push($e(`the tile of ${w((p = Un(h)) == null ? void 0 : p.title)}`)), s = J(s, { kind: "frame_updated", frame: g.visualId ? Ge(h) : h, resizeForNewKind: !0 });
1989
1987
  }
1990
1988
  const l = pe(s, t.cardIds[0]), d = new Set(t.cardIds), u = {
1991
1989
  ...l,
1992
1990
  cards: [...o, ...l.cards.filter((y) => !d.has(y.id))],
1993
1991
  activeCardId: t.cardIds[0]
1994
1992
  };
1995
- l.visualId && c.push(Ee("the tabs")), s = J(s, { kind: "frame_updated", frame: l.visualId ? Ge(u) : u, resizeForNewKind: !0 });
1993
+ l.visualId && c.push($e("the tabs")), s = J(s, { kind: "frame_updated", frame: l.visualId ? Ge(u) : u, resizeForNewKind: !0 });
1996
1994
  const f = o.map((y) => w(y.title)), m = [...new Map(c.map((y) => [y.lead, y])).values()];
1997
1995
  return {
1998
1996
  dashboard: { ...e, sheets: n.map((y, g) => g === r ? s : y) },
@@ -2000,7 +1998,7 @@ function po(e, t) {
2000
1998
  detached: m.length > 0
2001
1999
  };
2002
2000
  }
2003
- function go(e, t) {
2001
+ function bo(e, t) {
2004
2002
  var d;
2005
2003
  const n = e.sheets ?? [], r = n.findIndex((u) => !xe(u) && (u.frames ?? []).some((f) => f.cards.some((m) => m.id === t.cardId)));
2006
2004
  if (r < 0)
@@ -2010,7 +2008,7 @@ function go(e, t) {
2010
2008
  const i = n[r], o = pe(i, t.cardId), a = o.cards.find((u) => u.id === t.cardId);
2011
2009
  if (o.cards.length < 2)
2012
2010
  throw new F("frame_not_found", `${w(a.title)} already has its own spot.`);
2013
- const s = cn(o, t.cardId);
2011
+ const s = ln(o, t.cardId);
2014
2012
  let c = J(i, {
2015
2013
  kind: "frame_updated",
2016
2014
  frame: o.visualId ? Ge(s) : s,
@@ -2025,13 +2023,13 @@ function go(e, t) {
2025
2023
  return {
2026
2024
  dashboard: { ...e, sheets: n.map((u, f) => f === r ? c : u) },
2027
2025
  clauses: [
2028
- T.plain("layout", `gives ${w(a.title)} its own spot beside ${w((d = qn(s)) == null ? void 0 : d.title)}`),
2026
+ T.plain("layout", `gives ${w(a.title)} its own spot beside ${w((d = Un(s)) == null ? void 0 : d.title)}`),
2029
2027
  ...l ? [T.plain("detached", "makes both spots local to this report; they no longer follow their library visual")] : []
2030
2028
  ],
2031
2029
  detached: l
2032
2030
  };
2033
2031
  }
2034
- function ho() {
2032
+ function vo() {
2035
2033
  return {
2036
2034
  version: 1,
2037
2035
  page: {
@@ -2052,7 +2050,7 @@ function ho() {
2052
2050
  sections: []
2053
2051
  };
2054
2052
  }
2055
- function yo() {
2053
+ function Io() {
2056
2054
  return {
2057
2055
  region: "header",
2058
2056
  enabled: !0,
@@ -2061,7 +2059,7 @@ function yo() {
2061
2059
  blocks: []
2062
2060
  };
2063
2061
  }
2064
- function bo() {
2062
+ function Co() {
2065
2063
  return {
2066
2064
  region: "footer",
2067
2065
  enabled: !0,
@@ -2070,51 +2068,51 @@ function bo() {
2070
2068
  blocks: []
2071
2069
  };
2072
2070
  }
2073
- function Bn(e) {
2071
+ function zn(e) {
2074
2072
  return [{ type: "text", value: e }];
2075
2073
  }
2076
- function Pc(e, t = []) {
2077
- return Xr(e, { by: "then" }).flatMap((n) => n.type === "link" ? n.children ?? [] : [n]).map((n) => n.type === "text" ? n.value : `{{${Qr(n.ref, Jr({ kind: "document", inputs: t }))}}}`).join("") || "";
2074
+ function $c(e, t = []) {
2075
+ return Jr(e, { by: "then" }).flatMap((n) => n.type === "link" ? n.children ?? [] : [n]).map((n) => n.type === "text" ? n.value : `{{${Zr(n.ref, ei({ kind: "document", inputs: t }))}}}`).join("") || "";
2078
2076
  }
2079
- function vo(e, t) {
2077
+ function Fo(e, t) {
2080
2078
  return e.find(
2081
2079
  (n) => n.type === "text" && n.role === t
2082
2080
  );
2083
2081
  }
2084
- function Ac(e, t) {
2082
+ function Ec(e, t) {
2085
2083
  return e.find(
2086
2084
  (n) => n.type === "image" && n.role === t
2087
2085
  );
2088
2086
  }
2089
- function Gt(e, t) {
2087
+ function Wt(e, t) {
2090
2088
  const n = {
2091
2089
  ...t,
2092
2090
  type: "text",
2093
- content: typeof t.content == "string" ? Bn(t.content) : t.content
2091
+ content: typeof t.content == "string" ? zn(t.content) : t.content
2094
2092
  };
2095
- return Un(e, n);
2093
+ return jn(e, n);
2096
2094
  }
2097
- function Nc(e, t) {
2098
- return Un(e, t);
2095
+ function Rc(e, t) {
2096
+ return jn(e, t);
2099
2097
  }
2100
- function Un(e, t) {
2098
+ function jn(e, t) {
2101
2099
  const n = e.findIndex((r) => r.id === t.id);
2102
2100
  return n === -1 ? [...e, t] : e.map(
2103
2101
  (r, i) => i === n ? t : r
2104
2102
  );
2105
2103
  }
2106
- function Io(e, t) {
2104
+ function So(e, t) {
2107
2105
  const n = e.sheets ?? [], { id: r, title: i, kind: o } = t.sheet;
2108
2106
  if (n.some((s) => s.id === r))
2109
2107
  throw new F("sheet_id_taken", `A sheet with id ${r} is already on this dashboard.`);
2110
- const a = o === "document" ? { id: r, title: i, kind: o, document: ho() } : { id: r, title: i };
2108
+ const a = o === "document" ? { id: r, title: i, kind: o, document: vo() } : { id: r, title: i };
2111
2109
  return {
2112
2110
  dashboard: { ...e, sheets: [...n, a] },
2113
2111
  created: [{ kind: "sheet", id: r, title: i, ...t.changeIndex !== void 0 ? { changeIndex: t.changeIndex } : {} }],
2114
2112
  clauses: [T.plain("sheet", `adds the sheet ${w(i)}`)]
2115
2113
  };
2116
2114
  }
2117
- function Co(e, t) {
2115
+ function xo(e, t) {
2118
2116
  const n = e.sheets ?? [], r = n.findIndex((o) => o.id === t.sheetId);
2119
2117
  if (r < 0)
2120
2118
  throw new F("sheet_not_found", `No sheet ${t.sheetId} on this dashboard.`);
@@ -2124,21 +2122,21 @@ function Co(e, t) {
2124
2122
  clauses: [T.plain("sheet", `renames the sheet ${w(i.title)} to ${w(t.title)}`)]
2125
2123
  };
2126
2124
  }
2127
- function Fo(e, t, n) {
2128
- var o;
2125
+ function wo(e, t, n) {
2126
+ var a;
2129
2127
  if (!e || !t || t.customFilterPreferences) return;
2130
- const r = t.defaultDateFilter;
2131
- return (t.dateSelectionMode === "day" ? Zr(r) : t.dateSelectionMode === "months" && (ei(r) || ti(r) && r.unit === "month" && (r.mode === "previous" || r.mode === "this" && !r.toDate && !r.boundary))) && ((o = re(t, n)) == null ? void 0 : o.valueType) === "date" ? !0 : void 0;
2128
+ const r = t.defaultDateFilter, i = bn(r);
2129
+ return (t.dateSelectionMode === "day" ? ti(r) : t.dateSelectionMode === "months" && (ni(r) || !!(i && qi(i).monthPickerDefault))) && ((a = re(t, n)) == null ? void 0 : a.valueType) === "date" ? !0 : void 0;
2132
2130
  }
2133
- function Ec(e) {
2134
- const t = e.createId ?? Ie, n = t(), r = ri({
2131
+ function Kc(e) {
2132
+ const t = e.createId ?? Ie, n = t(), r = ii({
2135
2133
  field: e.field,
2136
2134
  dataSource: e.dataSource,
2137
2135
  connectionId: e.connectionId,
2138
2136
  connectionType: e.connectionType,
2139
2137
  filterId: t()
2140
2138
  });
2141
- return So({
2139
+ return To({
2142
2140
  filter: e.label ? { ...r, title: e.label } : r,
2143
2141
  label: e.label || e.field.label || e.field.name,
2144
2142
  scope: e.scope,
@@ -2146,9 +2144,9 @@ function Ec(e) {
2146
2144
  createId: () => n
2147
2145
  });
2148
2146
  }
2149
- function So(e) {
2150
- const t = e.createId ?? Ie, n = e.label || e.filter.title || e.filter.column || e.filter.id, r = ln(e.dashboard, { label: n }), i = {
2151
- ...dn(e.filter),
2147
+ function To(e) {
2148
+ const t = e.createId ?? Ie, n = e.label || e.filter.title || e.filter.column || e.filter.id, r = dn(e.dashboard, { label: n }), i = {
2149
+ ...un(e.filter),
2152
2150
  variableName: r
2153
2151
  };
2154
2152
  return {
@@ -2159,14 +2157,14 @@ function So(e) {
2159
2157
  requiredAtExecution: !1,
2160
2158
  scope: e.scope,
2161
2159
  runtimeScope: "shared",
2162
- presentation: fn(i),
2160
+ presentation: mn(i),
2163
2161
  filter: i,
2164
- exports: un(i)
2162
+ exports: fn(i)
2165
2163
  };
2166
2164
  }
2167
- function xo(e, t, n, r = { calendar: null }) {
2165
+ function Do(e, t, n, r = { calendar: null }) {
2168
2166
  var ht, yt, bt, vt, It, Ct, Ft, St;
2169
- const o = Y(e).findFilterInput(t), a = (O, x) => ({
2167
+ const o = Q(e).findFilterInput(t), a = (O, x) => ({
2170
2168
  ok: !1,
2171
2169
  issues: [
2172
2170
  {
@@ -2198,14 +2196,14 @@ function xo(e, t, n, r = { calendar: null }) {
2198
2196
  if (n.mapping.draft.inputId !== s.id)
2199
2197
  return a("The card mapping was prepared for another filter.");
2200
2198
  }
2201
- const l = n.definition ? dn(n.definition) : c;
2202
- if (l.kind === "global-date" && n.scope && !wo(n.scope))
2199
+ const l = n.definition ? un(n.definition) : c;
2200
+ if (l.kind === "global-date" && n.scope && !ko(n.scope))
2203
2201
  return a("The Global Date filter applies to regular tabs only.");
2204
- const d = (yt = r.calendar) == null ? void 0 : yt.tz, u = n.definition !== void 0, f = n.forceSelection !== void 0 || u ? Fo(
2202
+ const d = (yt = r.calendar) == null ? void 0 : yt.tz, u = n.definition !== void 0, f = n.forceSelection !== void 0 || u ? wo(
2205
2203
  n.forceSelection ?? s.forceSelection,
2206
2204
  l,
2207
2205
  d
2208
- ) : s.forceSelection ? !0 : void 0, m = n.variableName !== void 0 ? ln(
2206
+ ) : s.forceSelection ? !0 : void 0, m = n.variableName !== void 0 ? dn(
2209
2207
  e,
2210
2208
  { name: n.variableName },
2211
2209
  { exclude: { source: "input", inputId: s.id } }
@@ -2213,24 +2211,24 @@ function xo(e, t, n, r = { calendar: null }) {
2213
2211
  var xt, wt;
2214
2212
  const x = { ...O };
2215
2213
  if (y !== void 0 && (x.label = y), n.variableName !== void 0 && (x.variableName = m), n.scope && (x.scope = n.scope), g || h) {
2216
- const Oe = fn(l);
2214
+ const Oe = mn(l);
2217
2215
  x.presentation = { ...O.presentation }, g && (x.presentation.placement = Oe.placement), h && (Oe.widthPx === void 0 ? delete x.presentation.widthPx : x.presentation.widthPx = Oe.widthPx);
2218
2216
  }
2219
- return (n.forceSelection !== void 0 || u) && (f ? x.forceSelection = f : delete x.forceSelection), n.requiredAtExecution !== void 0 && (n.requiredAtExecution ? x.requiredAtExecution = !0 : delete x.requiredAtExecution), $e(x, "optionSource", n.optionSource), $e(x, "optionDependencies", n.optionDependencies), $e(x, "optionPopulation", n.optionPopulation), ((xt = n.mapping) == null ? void 0 : xt.kind) === "save" && n.mapping.draft.acceptance.ok ? x.application = n.mapping.draft.acceptance.application : ((wt = n.mapping) == null ? void 0 : wt.kind) === "remove" && delete x.application, x;
2217
+ return (n.forceSelection !== void 0 || u) && (f ? x.forceSelection = f : delete x.forceSelection), n.requiredAtExecution !== void 0 && (n.requiredAtExecution ? x.requiredAtExecution = !0 : delete x.requiredAtExecution), Ee(x, "optionSource", n.optionSource), Ee(x, "optionDependencies", n.optionDependencies), Ee(x, "optionPopulation", n.optionPopulation), ((xt = n.mapping) == null ? void 0 : xt.kind) === "save" && n.mapping.draft.acceptance.ok ? x.application = n.mapping.draft.acceptance.application : ((wt = n.mapping) == null ? void 0 : wt.kind) === "remove" && delete x.application, x;
2220
2218
  }, v = n.label !== void 0 && n.label !== s.label && n.label !== l.title ? n.label : void 0, I = u || n.variableName !== void 0 || v !== void 0, b = (O) => ({
2221
2219
  ...O,
2222
2220
  ...n.variableName !== void 0 ? { variableName: m } : {},
2223
2221
  ...v !== void 0 ? { title: v } : {}
2224
- }), S = Array.isArray(e.inputs) ? [...e.inputs] : [], P = S.findIndex((O) => O.id === s.id), D = S[P];
2225
- if (P < 0 || (D == null ? void 0 : D.kind) !== "filter" || !D.filter)
2222
+ }), S = Array.isArray(e.inputs) ? [...e.inputs] : [], P = S.findIndex((O) => O.id === s.id), k = S[P];
2223
+ if (P < 0 || (k == null ? void 0 : k.kind) !== "filter" || !k.filter)
2226
2224
  return a("This filter can not be edited here.");
2227
2225
  const L = C(
2228
2226
  I ? {
2229
- ...D,
2227
+ ...k,
2230
2228
  filter: b(l)
2231
- } : D
2229
+ } : k
2232
2230
  );
2233
- u && (L.exports = un(l)), S[P] = L;
2231
+ u && (L.exports = fn(l)), S[P] = L;
2234
2232
  const j = rt({
2235
2233
  inputs: [L],
2236
2234
  dashboardFilters: []
@@ -2240,26 +2238,26 @@ function xo(e, t, n, r = { calendar: null }) {
2240
2238
  ((bt = j.issues[0]) == null ? void 0 : bt.message) ?? "These settings could not be saved.",
2241
2239
  j.issues[0]
2242
2240
  );
2243
- let E = { ...e, inputs: S };
2244
- const ee = Y(E), k = ee.findFilterInput({ filterId: l.id });
2245
- if (!k)
2241
+ let $ = { ...e, inputs: S };
2242
+ const ee = Q($), M = ee.findFilterInput({ filterId: l.id });
2243
+ if (!M)
2246
2244
  return a(
2247
2245
  ((vt = ee.issues[0]) == null ? void 0 : vt.message) ?? "These settings could not be saved."
2248
2246
  );
2249
- const q = n.variableName !== void 0 || n.scope !== void 0 ? To(E, k.input) : void 0;
2247
+ const q = n.variableName !== void 0 || n.scope !== void 0 ? Mo($, M.input) : void 0;
2250
2248
  if (q)
2251
2249
  return a(
2252
2250
  `Another filter on the same cards is already named "${q}". Choose another name.`
2253
2251
  );
2254
2252
  const B = [], G = {
2255
- id: k.input.id,
2256
- runtimeScope: k.input.runtimeScope
2253
+ id: M.input.id,
2254
+ runtimeScope: M.input.runtimeScope
2257
2255
  };
2258
- let $ = {
2259
- defaultInputValues: E.defaultInputValues,
2256
+ let E = {
2257
+ defaultInputValues: $.defaultInputValues,
2260
2258
  dashboardInputValues: {}
2261
2259
  };
2262
- const ue = ((It = n.values) == null ? void 0 : It.target) ?? {}, A = Mo(
2260
+ const ue = ((It = n.values) == null ? void 0 : It.target) ?? {}, A = Po(
2263
2261
  c,
2264
2262
  l,
2265
2263
  {
@@ -2274,12 +2272,12 @@ function xo(e, t, n, r = { calendar: null }) {
2274
2272
  r.calendar ?? void 0
2275
2273
  );
2276
2274
  if (A.defaultValueChanged || A.selectionIdentityChanged || A.defaultComparisonChanged) {
2277
- const O = zn({
2278
- state: { ...$, dashboardInputValues: {} },
2275
+ const O = Gn({
2276
+ state: { ...E, dashboardInputValues: {} },
2279
2277
  input: G,
2280
2278
  settings: A
2281
2279
  });
2282
- $ = { ...$, defaultInputValues: O.defaultInputValues }, A.selectionIdentityChanged && B.push({
2280
+ E = { ...E, defaultInputValues: O.defaultInputValues }, A.selectionIdentityChanged && B.push({
2283
2281
  kind: "clear",
2284
2282
  inputId: G.id,
2285
2283
  target: A.target
@@ -2294,15 +2292,15 @@ function xo(e, t, n, r = { calendar: null }) {
2294
2292
  target: A.target
2295
2293
  });
2296
2294
  }
2297
- if (n.scope && k.input.runtimeScope !== "shared") {
2298
- const O = Do(
2299
- E,
2295
+ if (n.scope && M.input.runtimeScope !== "shared") {
2296
+ const O = Oo(
2297
+ $,
2300
2298
  s,
2301
- k.input,
2302
- $.defaultInputValues
2299
+ M.input,
2300
+ E.defaultInputValues
2303
2301
  );
2304
- $ = {
2305
- ...$,
2302
+ E = {
2303
+ ...E,
2306
2304
  defaultInputValues: O.defaultInputValues
2307
2305
  }, B.push(
2308
2306
  ...O.dropped.map((x) => ({
@@ -2312,20 +2310,20 @@ function xo(e, t, n, r = { calendar: null }) {
2312
2310
  }))
2313
2311
  );
2314
2312
  }
2315
- return E = ko(E, $), {
2313
+ return $ = _o($, E), {
2316
2314
  ok: !0,
2317
- dashboard: E,
2318
- inputId: k.input.id,
2315
+ dashboard: $,
2316
+ inputId: M.input.id,
2319
2317
  valueEffects: B
2320
2318
  };
2321
2319
  }
2322
- function $c(e) {
2320
+ function Vc(e) {
2323
2321
  let t = kt({
2324
2322
  dashboard: e.before,
2325
2323
  runtimeValues: e.dashboardInputValues,
2326
2324
  calendar: e.calendar
2327
2325
  });
2328
- const n = Y(e.after), r = (i) => {
2326
+ const n = Q(e.after), r = (i) => {
2329
2327
  var o;
2330
2328
  return (o = n.findFilterInput({ inputId: i })) == null ? void 0 : o.input;
2331
2329
  };
@@ -2336,7 +2334,7 @@ function $c(e) {
2336
2334
  case "setDefaultComparison": {
2337
2335
  const o = r(i.inputId);
2338
2336
  if (!o) break;
2339
- t = zn({
2337
+ t = Gn({
2340
2338
  state: { dashboardInputValues: t },
2341
2339
  input: o,
2342
2340
  settings: {
@@ -2366,16 +2364,16 @@ function $c(e) {
2366
2364
  calendar: e.calendar
2367
2365
  });
2368
2366
  }
2369
- function wo(e) {
2367
+ function ko(e) {
2370
2368
  var t;
2371
2369
  return e.kind !== "documentSections" && (e.kind !== "allSheets" || ((t = e.sheetKinds) == null ? void 0 : t.length) === 1 && e.sheetKinds[0] === "dashboard");
2372
2370
  }
2373
- function $e(e, t, n) {
2371
+ function Ee(e, t, n) {
2374
2372
  n !== void 0 && (n === null ? delete e[t] : e[t] = n);
2375
2373
  }
2376
- function To(e, t) {
2374
+ function Mo(e, t) {
2377
2375
  const n = [
2378
- ...Y(e).inputs.map((i) => i.input),
2376
+ ...Q(e).inputs.map((i) => i.input),
2379
2377
  ...(Array.isArray(e.inputs) ? e.inputs : []).filter(
2380
2378
  (i) => i.kind === "control"
2381
2379
  )
@@ -2383,28 +2381,28 @@ function To(e, t) {
2383
2381
  (i) => i.id !== t.id && i.variableName === t.variableName
2384
2382
  );
2385
2383
  if (!n.length) return;
2386
- const r = Rt(e, t);
2384
+ const r = Kt(e, t);
2387
2385
  return n.some(
2388
- (i) => [...Rt(e, i)].some(
2386
+ (i) => [...Kt(e, i)].some(
2389
2387
  (o) => r.has(o)
2390
2388
  )
2391
2389
  ) ? t.variableName : void 0;
2392
2390
  }
2393
- function Do(e, t, n, r) {
2391
+ function Oo(e, t, n, r) {
2394
2392
  var d, u;
2395
- const i = [], o = bn(e), a = (f) => Wt(t, f, o), s = (f) => Wt(n, f, o), c = [];
2393
+ const i = [], o = In(e), a = (f) => Ht(t, f, o), s = (f) => Ht(n, f, o), c = [];
2396
2394
  if (n.runtimeScope === "perSheet")
2397
2395
  for (const f of o.values())
2398
2396
  c.push({ sheetId: f.sheetId, sheetKind: f.sheetKind });
2399
2397
  else if (n.runtimeScope === "perCard") {
2400
- for (const f of vn(e))
2398
+ for (const f of Cn(e))
2401
2399
  c.push({
2402
2400
  sheetId: f.sheetId,
2403
2401
  cardId: f.cardId,
2404
2402
  sheetKind: (d = o.get(f.sheetId)) == null ? void 0 : d.sheetKind
2405
2403
  });
2406
2404
  for (const f of e.variables ?? [])
2407
- c.push(...ta(e, f.id));
2405
+ c.push(...ia(e, f.id));
2408
2406
  } else if (n.runtimeScope === "perDocumentSection")
2409
2407
  for (const f of e.sheets ?? [])
2410
2408
  for (const m of ((u = f.document) == null ? void 0 : u.sections) ?? [])
@@ -2424,19 +2422,19 @@ function Do(e, t, n, r) {
2424
2422
  }
2425
2423
  return { defaultInputValues: l, dropped: i };
2426
2424
  }
2427
- function Wt(e, t, n) {
2425
+ function Ht(e, t, n) {
2428
2426
  if (e.runtimeScope === "perSheet" && t.sheetId && !t.cardId && !t.sectionId) {
2429
2427
  const r = n.get(t.sheetId);
2430
- return r ? In(e, r) : !1;
2428
+ return r ? Fn(e, r) : !1;
2431
2429
  }
2432
- return na(e, t);
2430
+ return aa(e, t);
2433
2431
  }
2434
- function ko(e, t) {
2432
+ function _o(e, t) {
2435
2433
  const n = { ...e };
2436
2434
  return t.defaultInputValues && Object.keys(t.defaultInputValues).length ? n.defaultInputValues = t.defaultInputValues : e.defaultInputValues !== void 0 && delete n.defaultInputValues, n;
2437
2435
  }
2438
- function Mo(e, t, n, r, i) {
2439
- const o = !!(n != null && n.defaultValueChanged || n != null && n.selectionIdentityChanged) || ni(e, t);
2436
+ function Po(e, t, n, r, i) {
2437
+ const o = !!(n != null && n.defaultValueChanged || n != null && n.selectionIdentityChanged) || ri(e, t);
2440
2438
  return {
2441
2439
  ...n,
2442
2440
  target: (n == null ? void 0 : n.target) ?? r,
@@ -2444,7 +2442,7 @@ function Mo(e, t, n, r, i) {
2444
2442
  defaultFilterValue: o ? re(t, i) : void 0
2445
2443
  };
2446
2444
  }
2447
- function zn(e) {
2445
+ function Gn(e) {
2448
2446
  const { settings: t } = e;
2449
2447
  if (!t) return e.state;
2450
2448
  const n = e.input;
@@ -2518,36 +2516,36 @@ function Me(e, t) {
2518
2516
  throw new F("filter_not_found", `No filter ${t} on this dashboard.`, "Read the outline again and use its filter ids.");
2519
2517
  return n;
2520
2518
  }
2521
- function jn(e, t) {
2522
- const n = Cn(e, t);
2519
+ function Wn(e, t) {
2520
+ const n = Sn(e, t);
2523
2521
  return (n == null ? void 0 : n.kind) === "variable" ? `the variable ${n.variable.name}` : w(n == null ? void 0 : n.card.title);
2524
2522
  }
2525
- function Gn(e, t) {
2526
- if (!Cn(e, t))
2523
+ function Hn(e, t) {
2524
+ if (!Sn(e, t))
2527
2525
  throw new F("card_not_found", `No card or variable ${t} on this dashboard.`, "Read the outline again and use its card ids and variable names.");
2528
2526
  }
2529
- function Oo(e, t, n) {
2530
- const r = Y(e), i = r.findFilterInput({ inputId: t });
2527
+ function Ao(e, t, n) {
2528
+ const r = Q(e), i = r.findFilterInput({ inputId: t });
2531
2529
  return i ? r.reachedCards({ inputId: t }).filter(
2532
2530
  (o) => ["bound", "automatic", "sql", "relationshipApplied"].includes(
2533
- ai(i.input, o.card, n).reach
2531
+ oi(i.input, o.card, n).reach
2534
2532
  )
2535
2533
  ).length : 0;
2536
2534
  }
2537
- function _o(e, t) {
2538
- return Wn(e, t, "relationship");
2535
+ function No(e, t) {
2536
+ return Qn(e, t, "relationship");
2539
2537
  }
2540
- function Po(e, t) {
2541
- return Wn(e, t, "sqlTemplate");
2538
+ function $o(e, t) {
2539
+ return Qn(e, t, "sqlTemplate");
2542
2540
  }
2543
- function Wn(e, t, n) {
2544
- const r = Y(e), i = r.findFilterInput({ inputId: t });
2545
- return i ? r.reachedCards({ inputId: t }).filter((o) => oi(i.input, o.card) === n).length : 0;
2541
+ function Qn(e, t, n) {
2542
+ const r = Q(e), i = r.findFilterInput({ inputId: t });
2543
+ return i ? r.reachedCards({ inputId: t }).filter((o) => si(i.input, o.card) === n).length : 0;
2546
2544
  }
2547
- function Hn(e, t) {
2545
+ function Xn(e, t) {
2548
2546
  if (t.scope.kind === "allSheets") return "every sheet";
2549
2547
  if (t.scope.kind !== "sheets") return "its cards";
2550
- const n = [...bn(e).values()].filter((r) => In(t, r));
2548
+ const n = [...In(e).values()].filter((r) => Fn(t, r));
2551
2549
  return we(n.map((r) => {
2552
2550
  var i, o;
2553
2551
  return ((o = (i = e.sheets) == null ? void 0 : i.find((a) => a.id === r.sheetId)) == null ? void 0 : o.title) ?? r.sheetId;
@@ -2557,7 +2555,7 @@ const Yn = (e) => {
2557
2555
  var t;
2558
2556
  return ((t = e.filter) == null ? void 0 : t.type) === "single" ? "single select" : "multi select";
2559
2557
  };
2560
- function Xn(e) {
2558
+ function Jn(e) {
2561
2559
  var t, n, r;
2562
2560
  if ((n = (t = e.filter) == null ? void 0 : t.defaultValues) != null && n.length) return `default ${e.filter.defaultValues.join(", ")}`;
2563
2561
  if ((r = e.filter) != null && r.defaultDateFilter) return "a default period";
@@ -2565,16 +2563,16 @@ function Xn(e) {
2565
2563
  function de(e) {
2566
2564
  return T.plain("filter", e);
2567
2565
  }
2568
- function Ao(e, t) {
2566
+ function Eo(e, t) {
2569
2567
  const { input: n } = t, r = Z(e);
2570
2568
  if (r.some((d) => d.id === n.id))
2571
2569
  throw new F("filter_id_taken", `A filter with id ${n.id} is already on this dashboard.`);
2572
- if (Y(e).findFilterInput({ filterId: n.filter.id }))
2570
+ if (Q(e).findFilterInput({ filterId: n.filter.id }))
2573
2571
  throw new F("filter_id_taken", `A filter definition with id ${n.filter.id} is already on this dashboard.`);
2574
- const i = { ...e, inputs: [...r, n] }, o = Oo(i, n.id), a = _o(i, n.id), s = Po(i, n.id), c = we([
2572
+ const i = { ...e, inputs: [...r, n] }, o = Ao(i, n.id), a = No(i, n.id), s = $o(i, n.id), c = we([
2575
2573
  ...a ? [`may filter ${a} more through the domain's relationships`] : [],
2576
2574
  ...s ? [`may filter ${s} more through ${s === 1 ? "its" : "their"} SQL`] : []
2577
- ]), l = [Yn(n), Xn(n)].filter(Boolean).join(", ");
2575
+ ]), l = [Yn(n), Jn(n)].filter(Boolean).join(", ");
2578
2576
  return {
2579
2577
  dashboard: i,
2580
2578
  created: [
@@ -2587,13 +2585,13 @@ function Ao(e, t) {
2587
2585
  ],
2588
2586
  clauses: [
2589
2587
  de(
2590
- `adds the filter ${w(n.label)} (${l}) to ${Hn(i, n)}; it filters ${o} card${o === 1 ? "" : "s"}${c ? ` and ${c}` : ""}`
2588
+ `adds the filter ${w(n.label)} (${l}) to ${Xn(i, n)}; it filters ${o} card${o === 1 ? "" : "s"}${c ? ` and ${c}` : ""}`
2591
2589
  )
2592
2590
  ]
2593
2591
  };
2594
2592
  }
2595
- function No(e, t, n) {
2596
- const r = xo(e, { inputId: t.filterId }, t.settings, {
2593
+ function Ro(e, t, n) {
2594
+ const r = Do(e, { inputId: t.filterId }, t.settings, {
2597
2595
  calendar: n.calendar
2598
2596
  });
2599
2597
  if (!r.ok) {
@@ -2609,37 +2607,35 @@ function No(e, t, n) {
2609
2607
  return {
2610
2608
  dashboard: r.dashboard,
2611
2609
  runtimeEffects: [{ kind: "filter_value", effects: r.valueEffects }],
2612
- clauses: [de(`changes the filter ${w((i == null ? void 0 : i.label) ?? o.label)}: ${Eo(r.dashboard, i, o)}`)]
2610
+ clauses: [de(`changes the filter ${w((i == null ? void 0 : i.label) ?? o.label)}: ${Ko(r.dashboard, i, o)}`)]
2613
2611
  };
2614
2612
  }
2615
- function Eo(e, t, n) {
2616
- var a, s, c, l, d, u;
2613
+ function Ko(e, t, n) {
2614
+ var o, a, s, c, l, d;
2617
2615
  if (!t) return "updates its settings";
2618
2616
  const r = [];
2619
- t.label !== n.label && r.push(`renames it ${w(n.label)}`), (((a = t.filter) == null ? void 0 : a.type) ?? "multiple") !== (((s = n.filter) == null ? void 0 : s.type) ?? "multiple") && r.push(`makes it ${Yn(n)}`);
2620
- const i = JSON.stringify([((c = t.filter) == null ? void 0 : c.defaultValues) ?? null, ((l = t.filter) == null ? void 0 : l.defaultDateFilter) ?? null]), o = JSON.stringify([((d = n.filter) == null ? void 0 : d.defaultValues) ?? null, ((u = n.filter) == null ? void 0 : u.defaultDateFilter) ?? null]);
2621
- if (i !== o) {
2622
- const f = Xn(n);
2623
- r.push(f ? `sets its ${f.replace(/^default /, "default to ").replace(/^a default period$/, "default period")}` : "removes its default");
2617
+ if (t.label !== n.label && r.push(`renames it ${w(n.label)}`), (((o = t.filter) == null ? void 0 : o.type) ?? "multiple") !== (((a = n.filter) == null ? void 0 : a.type) ?? "multiple") && r.push(`makes it ${Yn(n)}`), JSON.stringify(((s = t.filter) == null ? void 0 : s.defaultValues) ?? null) !== JSON.stringify(((c = n.filter) == null ? void 0 : c.defaultValues) ?? null) || !Ni((l = t.filter) == null ? void 0 : l.defaultDateFilter, (d = n.filter) == null ? void 0 : d.defaultDateFilter)) {
2618
+ const u = Jn(n);
2619
+ r.push(u ? `sets its ${u.replace(/^default /, "default to ").replace(/^a default period$/, "default period")}` : "removes its default");
2624
2620
  }
2625
- return JSON.stringify(t.scope) !== JSON.stringify(n.scope) && r.push(`applies it to ${Hn(e, n)}`), r.length ? we(r) : "keeps its settings";
2621
+ return JSON.stringify(t.scope) !== JSON.stringify(n.scope) && r.push(`applies it to ${Xn(e, n)}`), r.length ? we(r) : "keeps its settings";
2626
2622
  }
2627
- function $o(e, t) {
2623
+ function Vo(e, t) {
2628
2624
  const n = Me(e, t);
2629
2625
  return {
2630
2626
  dashboard: {
2631
2627
  ...e,
2632
2628
  inputs: Z(e).filter((i) => i.id !== t),
2633
- defaultInputValues: ii(e.defaultInputValues, t)
2629
+ defaultInputValues: ai(e.defaultInputValues, t)
2634
2630
  },
2635
2631
  runtimeEffects: [{ kind: "input_removed", inputId: t }],
2636
2632
  clauses: [de(`removes the filter ${w(n.label)}`)]
2637
2633
  };
2638
2634
  }
2639
- function Ro(e, t, n) {
2635
+ function Lo(e, t, n) {
2640
2636
  var a;
2641
- Gn(e, n);
2642
- const r = ia(t.scope, n);
2637
+ Hn(e, n);
2638
+ const r = sa(t.scope, n);
2643
2639
  if (!r)
2644
2640
  throw new F(
2645
2641
  "filter_invalid",
@@ -2654,10 +2650,10 @@ function Ro(e, t, n) {
2654
2650
  inputs: Z(e).map((s) => s.id === t.id ? i : s)
2655
2651
  };
2656
2652
  }
2657
- function Qn(e, t, n, r, i) {
2653
+ function Zn(e, t, n, r, i) {
2658
2654
  var d, u;
2659
2655
  const o = Me(e, t);
2660
- Gn(e, n);
2656
+ Hn(e, n);
2661
2657
  const a = [...((d = o.application) == null ? void 0 : d.cards) ?? []], s = a.findIndex((f) => f.cardId === n);
2662
2658
  s >= 0 ? a[s] = r : a.push(r);
2663
2659
  const c = {
@@ -2676,7 +2672,7 @@ function Qn(e, t, n, r, i) {
2676
2672
  inputs: Z(e).map((f) => f.id === t ? c : f)
2677
2673
  };
2678
2674
  }
2679
- function Ko(e) {
2675
+ function qo(e) {
2680
2676
  switch (e.kind) {
2681
2677
  case "field":
2682
2678
  return `by ${e.field.name}`;
@@ -2686,23 +2682,23 @@ function Ko(e) {
2686
2682
  return String(e.kind);
2687
2683
  }
2688
2684
  }
2689
- function Vo(e, t) {
2690
- const n = Me(e, t.filterId), r = { ...t.binding, kind: "bound", cardId: t.cardId }, i = ra(n.scope, t.cardId), o = i !== n.scope;
2685
+ function Bo(e, t) {
2686
+ const n = Me(e, t.filterId), r = { ...t.binding, kind: "bound", cardId: t.cardId }, i = oa(n.scope, t.cardId), o = i !== n.scope;
2691
2687
  return {
2692
- dashboard: Qn(e, t.filterId, t.cardId, r, o ? i : void 0),
2688
+ dashboard: Zn(e, t.filterId, t.cardId, r, o ? i : void 0),
2693
2689
  clauses: [
2694
2690
  de(
2695
- `makes ${w(n.label)} filter ${jn(e, t.cardId)} ${Ko(r.target)}${o ? ", which it used to leave out" : ""}`
2691
+ `makes ${w(n.label)} filter ${Wn(e, t.cardId)} ${qo(r.target)}${o ? ", which it used to leave out" : ""}`
2696
2692
  )
2697
2693
  ]
2698
2694
  };
2699
2695
  }
2700
- function Lo(e, t) {
2696
+ function Uo(e, t) {
2701
2697
  var i;
2702
2698
  const n = Me(e, t.filterId);
2703
2699
  return {
2704
- dashboard: ((i = n.filter) == null ? void 0 : i.kind) === "global-date" ? Ro(e, n, t.cardId) : Qn(e, t.filterId, t.cardId, { kind: "excluded", cardId: t.cardId }),
2705
- clauses: [de(`stops ${w(n.label)} from filtering ${jn(e, t.cardId)}`)]
2700
+ dashboard: ((i = n.filter) == null ? void 0 : i.kind) === "global-date" ? Lo(e, n, t.cardId) : Zn(e, t.filterId, t.cardId, { kind: "excluded", cardId: t.cardId }),
2701
+ clauses: [de(`stops ${w(n.label)} from filtering ${Wn(e, t.cardId)}`)]
2706
2702
  };
2707
2703
  }
2708
2704
  function mt(e, t) {
@@ -2720,12 +2716,12 @@ function We(e, t) {
2720
2716
  throw new F("variable_not_found", `No variable ${t} on this dashboard.`, "Read the outline again and use its variable names.");
2721
2717
  return n;
2722
2718
  }
2723
- function Jn(e) {
2719
+ function er(e) {
2724
2720
  var r;
2725
- const t = no(e), n = t.charAt(0).toLowerCase() + t.slice(1);
2721
+ const t = ao(e), n = t.charAt(0).toLowerCase() + t.slice(1);
2726
2722
  return e.get.kind === "only" && !((r = e.query.sql) != null && r.trim()) ? `${n}. When more than one matches it shows nothing` : n;
2727
2723
  }
2728
- function qo(e, t) {
2724
+ function zo(e, t) {
2729
2725
  const n = it(e, { kind: "add", variable: t.variable });
2730
2726
  n.ok || mt(n.issues, "This variable could not be added.");
2731
2727
  const { variable: r } = t;
@@ -2733,22 +2729,22 @@ function qo(e, t) {
2733
2729
  dashboard: n.dashboard,
2734
2730
  created: [{ kind: "variable", id: r.id, title: r.name, ...t.changeIndex !== void 0 ? { changeIndex: t.changeIndex } : {} }],
2735
2731
  queryFrames: n.queryFrames,
2736
- clauses: [T.plain("variable", `adds the variable ${r.name}: ${Jn(r)}`)]
2732
+ clauses: [T.plain("variable", `adds the variable ${r.name}: ${er(r)}`)]
2737
2733
  };
2738
2734
  }
2739
- function Bo(e, t) {
2735
+ function jo(e, t) {
2740
2736
  const n = We(e, t.variableId), r = Object.fromEntries(Object.entries(t.patch).map(([m, p]) => [m, p === null ? void 0 : p])), i = it(e, { kind: "update", id: t.variableId, patch: r });
2741
2737
  i.ok || mt(i.issues, "This variable could not be changed.");
2742
2738
  const o = We(i.dashboard, t.variableId), a = [];
2743
2739
  t.patch.name !== void 0 && t.patch.name !== n.name && a.push(T.plain("variable", `renames the variable ${n.name} to ${o.name}`));
2744
2740
  const { name: s, label: c, ...l } = n, { name: d, label: u, ...f } = o;
2745
- return JSON.stringify(l) !== JSON.stringify(f) ? a.push(T.plain("variable", `changes the variable ${o.name}: ${Jn(o)}`)) : n.label !== o.label && a.push(T.plain("variable", `labels the variable ${o.name} ${w(o.label ?? o.name)}`)), {
2741
+ return JSON.stringify(l) !== JSON.stringify(f) ? a.push(T.plain("variable", `changes the variable ${o.name}: ${er(o)}`)) : n.label !== o.label && a.push(T.plain("variable", `labels the variable ${o.name} ${w(o.label ?? o.name)}`)), {
2746
2742
  dashboard: i.dashboard,
2747
2743
  queryFrames: i.queryFrames,
2748
2744
  clauses: a.length ? a : [T.plain("variable", `changes nothing on the variable ${o.name}`)]
2749
2745
  };
2750
2746
  }
2751
- function Uo(e, t) {
2747
+ function Go(e, t) {
2752
2748
  const n = We(e, t.variableId), r = it(e, { kind: "remove", id: t.variableId, confirmed: !1 });
2753
2749
  r.ok || mt(r.issues, "This variable could not be removed.");
2754
2750
  const i = r.removedMappings ? ` and its ${r.removedMappings === 1 ? "filter mapping" : `${r.removedMappings} filter mappings`}` : "";
@@ -2757,33 +2753,33 @@ function Uo(e, t) {
2757
2753
  clauses: [T.plain("variable", `removes the variable ${n.name}${i}`)]
2758
2754
  };
2759
2755
  }
2760
- function Zn(e) {
2761
- return e.cards.length < aa;
2756
+ function tr(e) {
2757
+ return e.cards.length < ca;
2762
2758
  }
2763
- function zo(e) {
2764
- return e.kpi.layout === "tiles" && e.cards.length + 1 > Fn;
2759
+ function Wo(e) {
2760
+ return e.kpi.layout === "tiles" && e.cards.length + 1 > xn;
2765
2761
  }
2766
- function jo(e, t) {
2767
- return !Zn(e) || t.type !== "kpi" || e.cards.some(({ id: n }) => n === t.id) ? e : {
2762
+ function Ho(e, t) {
2763
+ return !tr(e) || t.type !== "kpi" || e.cards.some(({ id: n }) => n === t.id) ? e : {
2768
2764
  ...e,
2769
2765
  cards: [...e.cards, t],
2770
- kpi: zo(e) ? { ...e.kpi, layout: "lines" } : e.kpi
2766
+ kpi: Wo(e) ? { ...e.kpi, layout: "lines" } : e.kpi
2771
2767
  };
2772
2768
  }
2773
- function Go(e, t) {
2769
+ function Qo(e, t) {
2774
2770
  if (e.cards.length <= 1) return e;
2775
2771
  const n = e.cards.filter(({ id: r }) => r !== t);
2776
2772
  return n.length === e.cards.length ? e : { ...e, cards: n };
2777
2773
  }
2778
- function er(e) {
2779
- return e.cards.length <= Fn;
2774
+ function nr(e) {
2775
+ return e.cards.length <= xn;
2780
2776
  }
2781
- function Wo(e, t) {
2777
+ function Xo(e, t) {
2782
2778
  const n = { ...e.kpi, ...t };
2783
- return n.layout === "tiles" && !er(e) ? e : { ...e, kpi: n };
2779
+ return n.layout === "tiles" && !nr(e) ? e : { ...e, kpi: n };
2784
2780
  }
2785
- const Ho = ["table"], Yo = ["matrixTable"];
2786
- function Ht(e, t, n) {
2781
+ const Yo = ["table"], Jo = ["matrixTable"];
2782
+ function Qt(e, t, n) {
2787
2783
  return {
2788
2784
  id: e.section(),
2789
2785
  type: "table",
@@ -2814,7 +2810,7 @@ function Ht(e, t, n) {
2814
2810
  }
2815
2811
  };
2816
2812
  }
2817
- function tr(e) {
2813
+ function rr(e) {
2818
2814
  return { id: e, title: "KPI", type: "kpi" };
2819
2815
  }
2820
2816
  const V = {
@@ -2828,7 +2824,7 @@ const V = {
2828
2824
  create: (e) => ({
2829
2825
  id: e.section(),
2830
2826
  type: "text",
2831
- content: Bn("New text section")
2827
+ content: zn("New text section")
2832
2828
  })
2833
2829
  },
2834
2830
  table: {
@@ -2837,8 +2833,8 @@ const V = {
2837
2833
  description: "Rows and columns from one dataset.",
2838
2834
  group: "data",
2839
2835
  addable: !0,
2840
- cardTypes: Ho,
2841
- create: (e) => Ht(e, "table", "Table")
2836
+ cardTypes: Yo,
2837
+ create: (e) => Qt(e, "table", "Table")
2842
2838
  },
2843
2839
  matrix: {
2844
2840
  id: "matrix",
@@ -2846,8 +2842,8 @@ const V = {
2846
2842
  description: "Grouped rows with subtotals, and optional column levels.",
2847
2843
  group: "data",
2848
2844
  addable: !0,
2849
- cardTypes: Yo,
2850
- create: (e) => Ht(e, "matrixTable", "Matrix")
2845
+ cardTypes: Jo,
2846
+ create: (e) => Qt(e, "matrixTable", "Matrix")
2851
2847
  },
2852
2848
  kpi: {
2853
2849
  id: "kpi",
@@ -2859,7 +2855,7 @@ const V = {
2859
2855
  create: (e) => ({
2860
2856
  id: e.section(),
2861
2857
  type: "kpi",
2862
- cards: [tr(e.card())],
2858
+ cards: [rr(e.card())],
2863
2859
  kpi: { layout: "tiles" }
2864
2860
  })
2865
2861
  },
@@ -2896,7 +2892,7 @@ const V = {
2896
2892
  create: (e) => ({ id: e.section(), type: "page_break" })
2897
2893
  }
2898
2894
  };
2899
- function nr(e) {
2895
+ function ir(e) {
2900
2896
  var t;
2901
2897
  switch (e.type) {
2902
2898
  case "table":
@@ -2913,71 +2909,71 @@ function nr(e) {
2913
2909
  return V.page_break;
2914
2910
  }
2915
2911
  }
2916
- function Xo(e, t) {
2917
- return nr(e).cardTypes.includes(t);
2912
+ function Zo(e, t) {
2913
+ return ir(e).cardTypes.includes(t);
2918
2914
  }
2919
- function rr(e, t) {
2920
- if (Xo(e, t)) return null;
2921
- const n = nr(e);
2915
+ function ar(e, t) {
2916
+ if (Zo(e, t)) return null;
2917
+ const n = ir(e);
2922
2918
  return n.id === "table" ? "Table sections hold Table cards only" : n.id === "kpi" ? "KPI sections hold KPI cards only" : n.id === "matrix" ? "Matrix sections hold Matrix cards only" : `${n.label} sections do not accept this visual`;
2923
2919
  }
2924
- function Qo(e, t, n) {
2920
+ function es(e, t, n) {
2925
2921
  if (!at(e).some(({ id: i }) => i === t))
2926
2922
  throw new Error(
2927
2923
  `Document section '${e.id}' has no card '${t}'.`
2928
2924
  );
2929
- const r = rr(e, n.type);
2925
+ const r = ar(e, n.type);
2930
2926
  if (r)
2931
2927
  throw new Error(r);
2932
- return Sn(
2928
+ return wn(
2933
2929
  e,
2934
2930
  (i) => i.id === t ? n : i
2935
2931
  );
2936
2932
  }
2937
- const Jo = [
2933
+ const ts = [
2938
2934
  { id: "data", label: "Data" },
2939
2935
  { id: "content", label: "Content" },
2940
2936
  { id: "layout", label: "Layout" }
2941
2937
  ];
2942
- function Rc() {
2938
+ function Lc() {
2943
2939
  const e = Object.values(V).filter(
2944
2940
  (t) => t.addable
2945
2941
  );
2946
- return Jo.map((t) => ({
2942
+ return ts.map((t) => ({
2947
2943
  ...t,
2948
2944
  kinds: e.filter((n) => n.group === t.id)
2949
2945
  })).filter((t) => t.kinds.length > 0);
2950
2946
  }
2951
- const Zo = {
2947
+ const ns = {
2952
2948
  header: ["title", "metadata"],
2953
2949
  footer: ["note", "pageInfo"]
2954
2950
  };
2955
- class M extends Error {
2951
+ class D extends Error {
2956
2952
  constructor(t) {
2957
2953
  super(t), this.name = "DocumentEditError";
2958
2954
  }
2959
2955
  }
2960
- const Yt = 8, es = 240;
2961
- function Kc() {
2956
+ const Xt = 8, rs = 240;
2957
+ function qc() {
2962
2958
  return {
2963
2959
  section: () => `doc_section_${Ie()}`,
2964
2960
  card: () => `doc_card_${Ie()}`
2965
2961
  };
2966
2962
  }
2967
- function ts(e) {
2963
+ function is(e) {
2968
2964
  return Number.isFinite(e) ? Math.min(
2969
- es,
2970
- Math.max(Yt, Math.round(e))
2971
- ) : Yt;
2965
+ rs,
2966
+ Math.max(Xt, Math.round(e))
2967
+ ) : Xt;
2972
2968
  }
2973
- function Vc(e, t, n, r) {
2969
+ function Bc(e, t, n, r) {
2974
2970
  const i = e.findIndex(({ id: s }) => s === t), o = e.findIndex(({ id: s }) => s === n);
2975
2971
  if (i === -1 || o === -1) return i;
2976
2972
  const a = r === "after" ? o + 1 : o;
2977
2973
  return i < a ? a - 1 : a;
2978
2974
  }
2979
- const ns = /* @__PURE__ */ new Set(["table", "matrixTable", "kpi"]);
2980
- function rs(e, t = {}) {
2975
+ const as = /* @__PURE__ */ new Set(["table", "matrixTable", "kpi"]);
2976
+ function os(e, t = {}) {
2981
2977
  const n = new Set(
2982
2978
  (e.sheets || []).flatMap(
2983
2979
  (r) => (r.frames || []).flatMap(
@@ -2985,14 +2981,14 @@ function rs(e, t = {}) {
2985
2981
  )
2986
2982
  )
2987
2983
  );
2988
- return vn(e).filter(
2989
- (r) => ns.has(r.card.type) && !r.card.linkedSourceCardId && !(r.kind === "frameCard" && n.has(r.frameId)) && !(r.kind === "documentSectionCard" && r.sectionId === t.excludeSectionId) && !si(r.card)
2984
+ return Cn(e).filter(
2985
+ (r) => as.has(r.card.type) && !r.card.linkedSourceCardId && !(r.kind === "frameCard" && n.has(r.frameId)) && !(r.kind === "documentSectionCard" && r.sectionId === t.excludeSectionId) && !li(r.card)
2990
2986
  );
2991
2987
  }
2992
- function is(e) {
2988
+ function ss(e) {
2993
2989
  return e.type === "kpi" ? "kpi" : e.type === "matrixTable" ? "matrix" : "table";
2994
2990
  }
2995
- function as(e, t, n) {
2991
+ function cs(e, t, n) {
2996
2992
  const r = e.sections, i = (a) => ({
2997
2993
  ...e,
2998
2994
  sections: a
@@ -3001,7 +2997,7 @@ function as(e, t, n) {
3001
2997
  case "insert": {
3002
2998
  const a = V[t.kind];
3003
2999
  if (!a.addable)
3004
- throw new M(`${a.label} sections cannot be added.`);
3000
+ throw new D(`${a.label} sections cannot be added.`);
3005
3001
  const s = a.create(n.ids);
3006
3002
  return {
3007
3003
  document: i(Ke(r, s, t.index)),
@@ -3009,7 +3005,7 @@ function as(e, t, n) {
3009
3005
  };
3010
3006
  }
3011
3007
  case "copyCard": {
3012
- const a = Re(t.source, n), c = V[is(a.card)].create({
3008
+ const a = Re(t.source, n), c = V[ss(a.card)].create({
3013
3009
  section: n.ids.section,
3014
3010
  card: () => a.card.id
3015
3011
  }), l = c.type === "kpi" ? { ...c, title: void 0, cards: [a.card] } : c.type === "table" ? { ...c, title: a.card.title || c.title, card: a.card } : c;
@@ -3022,11 +3018,11 @@ function as(e, t, n) {
3022
3018
  case "replaceWithCopy": {
3023
3019
  const a = K(r, t.sectionId);
3024
3020
  if (a.type !== "table")
3025
- throw new M(
3021
+ throw new D(
3026
3022
  "Only a table section can be replaced with a copied card."
3027
3023
  );
3028
- const s = Re(t.source, n, t.sectionId), c = rr(a, s.card.type);
3029
- if (c) throw new M(c);
3024
+ const s = Re(t.source, n, t.sectionId), c = ar(a, s.card.type);
3025
+ if (c) throw new D(c);
3030
3026
  const l = {
3031
3027
  ...a,
3032
3028
  title: s.card.title || a.title,
@@ -3053,7 +3049,7 @@ function as(e, t, n) {
3053
3049
  case "duplicate": {
3054
3050
  const a = r.findIndex(({ id: c }) => c === t.sectionId);
3055
3051
  if (a === -1) throw ge(t.sectionId);
3056
- const s = os(r[a], n.ids);
3052
+ const s = ls(r[a], n.ids);
3057
3053
  return {
3058
3054
  document: i(Ke(r, s, a + 1)),
3059
3055
  target: o(s.id)
@@ -3088,35 +3084,37 @@ function as(e, t, n) {
3088
3084
  document: i(
3089
3085
  R(r, {
3090
3086
  ...a,
3091
- content: t.content,
3092
- ...t.style !== void 0 ? { style: t.style } : {}
3087
+ ...t.content !== void 0 ? { content: t.content } : {},
3088
+ ...t.style !== void 0 ? { style: Pt(a.style, t.style) } : {}
3093
3089
  })
3094
3090
  ),
3095
3091
  target: o(a.id)
3096
3092
  };
3097
3093
  }
3098
3094
  case "updateRegionText": {
3099
- if (!Zo[t.region].includes(t.role))
3100
- throw new M(
3095
+ if (!ns[t.region].includes(t.role))
3096
+ throw new D(
3101
3097
  `The ${t.region} has ${t.region === "header" ? "a title and a metadata line" : "a note and a page info line"}, not a ${t.role} line.`
3102
3098
  );
3103
- const a = e[t.region], s = a ? vo(a.blocks, t.role) : void 0, c = {
3099
+ if (t.style !== void 0 && !ci(t.role))
3100
+ throw new D(`The footer's ${t.role === "pageInfo" ? "page info" : t.role} line has no size or alignment; only the header's title and metadata lines do.`);
3101
+ const a = e[t.region], s = a ? Fo(a.blocks, t.role) : void 0, c = t.style !== void 0 ? Pt(s == null ? void 0 : s.style, t.style) : s == null ? void 0 : s.style, l = {
3104
3102
  id: (s == null ? void 0 : s.id) ?? `${t.region}_${t.role}`,
3105
3103
  role: t.role,
3106
3104
  area: (s == null ? void 0 : s.area) ?? t.role,
3107
- content: t.content,
3108
- ...t.style !== void 0 ? { style: t.style } : s != null && s.style ? { style: s.style } : {}
3105
+ content: t.content ?? (s == null ? void 0 : s.content) ?? [],
3106
+ ...c ? { style: c } : {}
3109
3107
  };
3110
3108
  if (t.region === "header") {
3111
- const d = (a == null ? void 0 : a.region) === "header" ? a : yo();
3109
+ const u = (a == null ? void 0 : a.region) === "header" ? a : Io();
3112
3110
  return {
3113
- document: { ...e, header: { ...d, enabled: !0, blocks: Gt(d.blocks, c) } },
3111
+ document: { ...e, header: { ...u, enabled: !0, blocks: Wt(u.blocks, l) } },
3114
3112
  target: { kind: "header" }
3115
3113
  };
3116
3114
  }
3117
- const l = (a == null ? void 0 : a.region) === "footer" ? a : bo();
3115
+ const d = (a == null ? void 0 : a.region) === "footer" ? a : Co();
3118
3116
  return {
3119
- document: { ...e, footer: { ...l, enabled: !0, blocks: Gt(l.blocks, c) } },
3117
+ document: { ...e, footer: { ...d, enabled: !0, blocks: Wt(d.blocks, l) } },
3120
3118
  target: { kind: "footer" }
3121
3119
  };
3122
3120
  }
@@ -3136,11 +3134,11 @@ function as(e, t, n) {
3136
3134
  case "updateKpiOptions": {
3137
3135
  const a = K(r, t.sectionId);
3138
3136
  if (a.type !== "kpi") throw W(t.type, a);
3139
- if (t.options.layout === "tiles" && !er(a))
3140
- throw new M("Tiles hold up to 6 KPIs.");
3137
+ if (t.options.layout === "tiles" && !nr(a))
3138
+ throw new D("Tiles hold up to 6 KPIs.");
3141
3139
  return {
3142
3140
  document: i(
3143
- R(r, Wo(a, t.options))
3141
+ R(r, Xo(a, t.options))
3144
3142
  ),
3145
3143
  target: o(a.id)
3146
3144
  };
@@ -3152,7 +3150,7 @@ function as(e, t, n) {
3152
3150
  document: i(
3153
3151
  R(r, {
3154
3152
  ...a,
3155
- heightPx: ts(t.heightPx)
3153
+ heightPx: is(t.heightPx)
3156
3154
  })
3157
3155
  ),
3158
3156
  target: o(a.id)
@@ -3160,12 +3158,12 @@ function as(e, t, n) {
3160
3158
  }
3161
3159
  case "replaceCard": {
3162
3160
  const a = K(r, t.sectionId);
3163
- t.card.id !== t.oldCardId && Xt(n, t.card.id);
3161
+ t.card.id !== t.oldCardId && Yt(n, t.card.id);
3164
3162
  let s;
3165
3163
  try {
3166
- s = Qo(a, t.oldCardId, t.card);
3164
+ s = es(a, t.oldCardId, t.card);
3167
3165
  } catch (c) {
3168
- throw new M(c.message);
3166
+ throw new D(c.message);
3169
3167
  }
3170
3168
  return (s.type === "table" || s.type === "chart") && (s = { ...s, title: t.card.title || s.title }), {
3171
3169
  document: i(R(r, s)),
@@ -3177,16 +3175,16 @@ function as(e, t, n) {
3177
3175
  case "addKpi": {
3178
3176
  const a = K(r, t.sectionId);
3179
3177
  if (a.type !== "kpi") throw W(t.type, a);
3180
- if (!Zn(a))
3181
- throw new M("A KPI section holds up to 8 KPIs.");
3178
+ if (!tr(a))
3179
+ throw new D("A KPI section holds up to 8 KPIs.");
3182
3180
  const s = t.source ? Re(t.source, n, a.id) : void 0;
3183
- t.card && !s && Xt(n, t.card.id);
3184
- const c = (s == null ? void 0 : s.card) ?? t.card ?? tr(n.ids.card());
3181
+ t.card && !s && Yt(n, t.card.id);
3182
+ const c = (s == null ? void 0 : s.card) ?? t.card ?? rr(n.ids.card());
3185
3183
  if (c.type !== "kpi")
3186
- throw new M("KPI sections hold KPI cards only");
3187
- const l = jo(a, c);
3184
+ throw new D("KPI sections hold KPI cards only");
3185
+ const l = Ho(a, c);
3188
3186
  if (l === a)
3189
- throw new M(`KPI section '${a.id}' already has card '${c.id}'.`);
3187
+ throw new D(`KPI section '${a.id}' already has card '${c.id}'.`);
3190
3188
  return {
3191
3189
  document: i(R(r, l)),
3192
3190
  target: o(a.id, c.id),
@@ -3197,10 +3195,10 @@ function as(e, t, n) {
3197
3195
  const a = K(r, t.sectionId);
3198
3196
  if (a.type !== "kpi") throw W(t.type, a);
3199
3197
  if (!a.cards.some(({ id: c }) => c === t.cardId))
3200
- throw new M(`KPI section '${a.id}' has no card '${t.cardId}'.`);
3201
- const s = Go(a, t.cardId);
3198
+ throw new D(`KPI section '${a.id}' has no card '${t.cardId}'.`);
3199
+ const s = Qo(a, t.cardId);
3202
3200
  if (s === a)
3203
- throw new M("A KPI section keeps at least one KPI.");
3201
+ throw new D("A KPI section keeps at least one KPI.");
3204
3202
  return {
3205
3203
  document: i(R(r, s)),
3206
3204
  target: o(a.id),
@@ -3212,7 +3210,7 @@ function as(e, t, n) {
3212
3210
  if (a.type !== "kpi") throw W(t.type, a);
3213
3211
  const s = a.cards.findIndex(({ id: d }) => d === t.cardId);
3214
3212
  if (s === -1)
3215
- throw new M(`KPI section '${a.id}' has no card '${t.cardId}'.`);
3213
+ throw new D(`KPI section '${a.id}' has no card '${t.cardId}'.`);
3216
3214
  const c = [...a.cards], [l] = c.splice(s, 1);
3217
3215
  return c.splice(He(t.toIndex, c.length), 0, l), {
3218
3216
  document: i(R(r, { ...a, cards: c })),
@@ -3220,19 +3218,19 @@ function as(e, t, n) {
3220
3218
  };
3221
3219
  }
3222
3220
  default:
3223
- return cs(t);
3221
+ return us(t);
3224
3222
  }
3225
3223
  }
3226
3224
  function Re(e, t, n) {
3227
- const r = rs(t.dashboard, {
3225
+ const r = os(t.dashboard, {
3228
3226
  excludeSectionId: n
3229
- }).find((p) => ss(p, e));
3227
+ }).find((p) => ds(p, e));
3230
3228
  if (!r)
3231
- throw new M(
3229
+ throw new D(
3232
3230
  `Card '${e.cardId}' cannot be copied into this document.`
3233
3231
  );
3234
3232
  const i = t.dashboard.sheets || [], o = i.find(({ id: p }) => p === e.sheetId), a = i.find(({ id: p }) => p === t.sheetId), s = t.ids.card(), c = be({ ...r.card, id: s });
3235
- mn(c, /* @__PURE__ */ new Map([[e.cardId, s]]));
3233
+ pn(c, /* @__PURE__ */ new Map([[e.cardId, s]]));
3236
3234
  const l = /* @__PURE__ */ new Set();
3237
3235
  if (oe(c, {
3238
3236
  oldCardId: e.cardId,
@@ -3242,7 +3240,7 @@ function Re(e, t, n) {
3242
3240
  onSheetField: (p) => l.add(p)
3243
3241
  }), e.sheetId === t.sheetId || l.size === 0)
3244
3242
  return { card: c };
3245
- const d = co(o), u = /* @__PURE__ */ new Map(), f = [...l];
3243
+ const d = fo(o), u = /* @__PURE__ */ new Map(), f = [...l];
3246
3244
  for (; f.length > 0; ) {
3247
3245
  const p = f.pop();
3248
3246
  if (u.has(p)) continue;
@@ -3279,13 +3277,13 @@ function oe(e, t) {
3279
3277
  const n = e;
3280
3278
  typeof n.entityId == "string" && (n.fieldScope === "card" && n.entityId === t.oldCardId ? n.entityId = t.newCardId : n.fieldScope === "sheet" && n.entityId === t.sourceSheetId && (typeof n.id == "string" && t.onSheetField(Le(n.id) ?? n.id), n.entityId = t.targetSheetId)), Object.values(n).forEach((r) => oe(r, t));
3281
3279
  }
3282
- function os(e, t) {
3280
+ function ls(e, t) {
3283
3281
  const n = { ...be(e), id: t.section() }, r = new Map(
3284
3282
  at(n).map((i) => [i.id, t.card()])
3285
3283
  );
3286
- return Sn(n, (i) => {
3284
+ return wn(n, (i) => {
3287
3285
  const o = r.get(i.id), a = be({ ...i, id: o });
3288
- return mn(a, r), oe(a, {
3286
+ return pn(a, r), oe(a, {
3289
3287
  oldCardId: i.id,
3290
3288
  newCardId: o,
3291
3289
  sourceSheetId: "",
@@ -3295,12 +3293,12 @@ function os(e, t) {
3295
3293
  }), a;
3296
3294
  });
3297
3295
  }
3298
- function ss(e, t) {
3296
+ function ds(e, t) {
3299
3297
  return e.kind !== t.kind || e.sheetId !== t.sheetId || e.cardId !== t.cardId ? !1 : e.kind === "frameCard" && t.kind === "frameCard" ? e.frameId === t.frameId : e.kind === "documentSectionCard" && t.kind === "documentSectionCard" ? e.sectionId === t.sectionId : !0;
3300
3298
  }
3301
- function Xt(e, t) {
3302
- if (oa(e.dashboard, t))
3303
- throw new M(
3299
+ function Yt(e, t) {
3300
+ if (la(e.dashboard, t))
3301
+ throw new D(
3304
3302
  `Card id '${t}' is already used by another card in this dashboard.`
3305
3303
  );
3306
3304
  }
@@ -3322,51 +3320,63 @@ function K(e, t) {
3322
3320
  return n;
3323
3321
  }
3324
3322
  function ge(e) {
3325
- return new M(`Document section '${e}' does not exist.`);
3323
+ return new D(`Document section '${e}' does not exist.`);
3326
3324
  }
3327
3325
  function W(e, t) {
3328
- return new M(
3326
+ return new D(
3329
3327
  `'${e}' does not apply to a ${t.type} section.`
3330
3328
  );
3331
3329
  }
3332
- function cs(e) {
3333
- throw new M(
3330
+ function us(e) {
3331
+ throw new D(
3334
3332
  `Unknown document edit '${e.type}'.`
3335
3333
  );
3336
3334
  }
3337
- const ls = {
3335
+ const fs = {
3338
3336
  section: () => {
3339
3337
  throw new F("document_invalid", "A text edit mints no section id.");
3340
3338
  },
3341
3339
  card: () => {
3342
3340
  throw new F("document_invalid", "A text edit mints no card id.");
3343
3341
  }
3344
- }, ds = { title: "title", metadata: "metadata", note: "note", pageInfo: "page info" };
3345
- function us(e, t) {
3342
+ }, ms = { title: "title", metadata: "metadata", note: "note", pageInfo: "page info" };
3343
+ function ps(e, t) {
3346
3344
  const n = e.sheets ?? [], r = n.findIndex((d) => d.id === t.sheetId), i = n[r];
3347
3345
  if (!i) throw new F("sheet_not_found", `No sheet ${t.sheetId} on this dashboard.`, "Read the outline again and use its sheet ids.");
3348
3346
  if (!xe(i) || !i.document)
3349
3347
  throw new F("document_invalid", `"${i.title ?? i.id}" is not a Document sheet.`, "Name a Document sheet; a grid sheet's words are its text cards.");
3350
3348
  let o;
3351
3349
  try {
3352
- o = as(i.document, t.edit, { dashboard: e, sheetId: i.id, ids: ls }).document;
3350
+ o = cs(i.document, t.edit, { dashboard: e, sheetId: i.id, ids: fs }).document;
3353
3351
  } catch (d) {
3354
- throw d instanceof M ? new F("document_invalid", d.message, "Read the outline again and use its section ids and line roles.") : d;
3352
+ throw d instanceof D ? new F("document_invalid", d.message, "Read the outline again and use its section ids and line roles.") : d;
3355
3353
  }
3356
- const a = { ...e, sheets: n.map((d, u) => u === r ? { ...d, document: o } : d) }, s = t.edit.type === "updateRegionText" ? `the ${ds[t.edit.role]} line of the ${w(i.title)} ${t.edit.region}` : `a text section of ${w(i.title)}`, c = ci(t.edit.content, { inputs: a.inputs, variables: a.variables }), l = li(c);
3357
- return {
3354
+ const a = { ...e, sheets: n.map((d, u) => u === r ? { ...d, document: o } : d) }, s = t.edit.type === "updateRegionText" ? `the ${ms[t.edit.role]} line of the ${w(i.title)} ${t.edit.region}` : `a text section of ${w(i.title)}`, c = [];
3355
+ if (t.edit.content !== void 0) {
3356
+ const d = di(t.edit.content, { inputs: a.inputs, variables: a.variables }), u = ui(d);
3357
+ c.push(`sets ${s} to ${w(fi(d))}${u ? `, ${u}` : ""}`);
3358
+ }
3359
+ const l = hs(t.edit.style);
3360
+ return l && c.push(c.length ? `makes it ${l}` : `makes ${s} ${l}`), {
3358
3361
  dashboard: a,
3359
- clauses: [T.plain("document", `sets ${s} to ${w(di(c))}${l ? `, ${l}` : ""}`)]
3362
+ clauses: [T.plain("document", c.join(" and "))]
3360
3363
  };
3361
3364
  }
3362
- function Lc(e, t, n) {
3365
+ const gs = { left: "left-aligned", center: "centered", right: "right-aligned" };
3366
+ function hs(e) {
3367
+ return [
3368
+ ...(e == null ? void 0 : e.fontSize) !== void 0 ? [`${e.fontSize}px`] : [],
3369
+ ...(e == null ? void 0 : e.align) !== void 0 ? [gs[e.align]] : []
3370
+ ].join(" and ");
3371
+ }
3372
+ function Uc(e, t, n) {
3363
3373
  let r = e;
3364
3374
  const i = [], o = [], a = [], s = [], c = [];
3365
3375
  let l = !1;
3366
3376
  for (const [u, f] of t.entries()) {
3367
3377
  let m;
3368
3378
  try {
3369
- m = ms(r, f, n);
3379
+ m = bs(r, f, n);
3370
3380
  } catch (p) {
3371
3381
  if (!(p instanceof F)) throw p;
3372
3382
  return {
@@ -3391,64 +3401,64 @@ function Lc(e, t, n) {
3391
3401
  dashboard: r,
3392
3402
  created: i,
3393
3403
  touched: o.filter((u) => !d.has(u)),
3394
- queryFrames: [...fs(r, i, o), ...s],
3395
- descriptions: ps(c),
3404
+ queryFrames: [...ys(r, i, o), ...s],
3405
+ descriptions: vs(c),
3396
3406
  runtimeEffects: a,
3397
3407
  detaches: l
3398
3408
  };
3399
3409
  }
3400
- function fs(e, t, n) {
3410
+ function ys(e, t, n) {
3401
3411
  const r = /* @__PURE__ */ new Set([...t.filter((i) => i.kind === "card").map((i) => i.id), ...n]);
3402
3412
  return (e.sheets ?? []).flatMap(
3403
3413
  (i) => (i.frames ?? []).filter((o) => (o.cards ?? []).some((a) => r.has(a.id)))
3404
3414
  );
3405
3415
  }
3406
- function ms(e, t, n) {
3416
+ function bs(e, t, n) {
3407
3417
  switch (t.op) {
3408
3418
  case "card.add":
3409
- return mi(e, t);
3419
+ return gi(e, t);
3410
3420
  case "card.remove":
3411
- return fi(e, t.cardId);
3421
+ return pi(e, t.cardId);
3412
3422
  case "card.update":
3413
- return te(ui(e, t.cardId, t.update), [t.cardId]);
3423
+ return te(mi(e, t.cardId, t.update), [t.cardId]);
3414
3424
  case "layout.arrange":
3415
- return io(e, t);
3425
+ return so(e, t);
3416
3426
  case "frame.commit":
3417
- return te(uo(e, t.commit), [t.commit.frame.activeCardId]);
3427
+ return te(po(e, t.commit), [t.commit.frame.activeCardId]);
3418
3428
  case "filter.add":
3419
- return Ao(e, t);
3429
+ return Eo(e, t);
3420
3430
  case "filter.update":
3421
- return No(e, t, n);
3431
+ return Ro(e, t, n);
3422
3432
  case "filter.remove":
3423
- return $o(e, t.filterId);
3433
+ return Vo(e, t.filterId);
3424
3434
  case "filter.bind":
3425
- return te(Vo(e, t), [t.cardId]);
3435
+ return te(Bo(e, t), [t.cardId]);
3426
3436
  case "filter.exclude":
3427
- return te(Lo(e, t), [t.cardId]);
3437
+ return te(Uo(e, t), [t.cardId]);
3428
3438
  case "dashboard.update":
3429
- return fo(e, t);
3439
+ return go(e, t);
3430
3440
  case "sheet.add":
3431
- return Io(e, t);
3441
+ return So(e, t);
3432
3442
  case "sheet.update":
3433
- return Co(e, t);
3443
+ return xo(e, t);
3434
3444
  case "layout.tabs":
3435
- return te(po(e, t), t.cardIds.slice(0, 1));
3445
+ return te(yo(e, t), t.cardIds.slice(0, 1));
3436
3446
  case "layout.untab":
3437
- return te(go(e, t), [t.cardId]);
3447
+ return te(bo(e, t), [t.cardId]);
3438
3448
  case "variable.add":
3439
- return qo(e, t);
3449
+ return zo(e, t);
3440
3450
  case "variable.update":
3441
- return Bo(e, t);
3451
+ return jo(e, t);
3442
3452
  case "variable.remove":
3443
- return Uo(e, t);
3453
+ return Go(e, t);
3444
3454
  case "document.text":
3445
- return us(e, t);
3455
+ return ps(e, t);
3446
3456
  }
3447
3457
  }
3448
3458
  function te(e, t) {
3449
3459
  return { ...e, touched: t.filter(Boolean) };
3450
3460
  }
3451
- function ps(e) {
3461
+ function vs(e) {
3452
3462
  const t = [];
3453
3463
  for (const n of e) {
3454
3464
  const r = n.changeIndex === void 0 ? void 0 : t.find((i) => i.changeIndex === n.changeIndex);
@@ -3465,14 +3475,14 @@ function ps(e) {
3465
3475
  }
3466
3476
  return t.map(({ clauses: n, ...r }) => ({
3467
3477
  ...r,
3468
- sentence: pi(gs(n))
3478
+ sentence: hi(Is(n))
3469
3479
  }));
3470
3480
  }
3471
- function gs(e) {
3481
+ function Is(e) {
3472
3482
  let t = !1;
3473
3483
  return e.filter((n) => n.kind !== "detached" ? !0 : t ? !1 : (t = !0, !0));
3474
3484
  }
3475
- function Qt(e) {
3485
+ function Jt(e) {
3476
3486
  return Object.fromEntries(
3477
3487
  Object.entries(e).filter(
3478
3488
  (t) => typeof t[1] == "string" && t[1].length > 0
@@ -3494,18 +3504,18 @@ function se(e) {
3494
3504
  e.tableName
3495
3505
  ].join(":");
3496
3506
  }
3497
- function hs(e, t) {
3507
+ function Cs(e, t) {
3498
3508
  if (e.kind === "semantic")
3499
3509
  return {
3500
3510
  status: "ready",
3501
- request: Qt({
3511
+ request: Jt({
3502
3512
  connection_id: e.connectionId,
3503
3513
  domain_id: e.domainId,
3504
- dataset_id: Pi(e),
3514
+ dataset_id: $i(e),
3505
3515
  dataset_name: e.datasetName
3506
3516
  })
3507
3517
  };
3508
- const n = ca({
3518
+ const n = ua({
3509
3519
  source: e,
3510
3520
  capabilities: t
3511
3521
  });
@@ -3517,7 +3527,7 @@ function hs(e, t) {
3517
3527
  message: `Source is missing required field-metadata coordinates: ${n.missing.join(", ")}.`
3518
3528
  } : {
3519
3529
  status: "ready",
3520
- request: Qt({
3530
+ request: Jt({
3521
3531
  connection_id: e.connectionId,
3522
3532
  datamodel_id: "",
3523
3533
  database_name: n.coordinates.databaseName,
@@ -3526,14 +3536,14 @@ function hs(e, t) {
3526
3536
  })
3527
3537
  };
3528
3538
  }
3529
- function qc(e, t = /* @__PURE__ */ new Map()) {
3539
+ function zc(e, t = /* @__PURE__ */ new Map()) {
3530
3540
  const n = /* @__PURE__ */ new Map();
3531
3541
  for (const { card: r } of e) {
3532
3542
  const i = Ze(r), o = i.kind === "config" ? i.executableSources : i.kind === "sql" ? i.pinnedCatalogSources.map((a) => a.source) : [];
3533
3543
  for (const a of o) {
3534
3544
  const s = se(a);
3535
3545
  if (!n.has(s)) {
3536
- const c = hs(
3546
+ const c = Cs(
3537
3547
  a,
3538
3548
  a.connectionId ? t.get(a.connectionId) : void 0
3539
3549
  );
@@ -3547,7 +3557,7 @@ function qc(e, t = /* @__PURE__ */ new Map()) {
3547
3557
  }
3548
3558
  return Array.from(n.values());
3549
3559
  }
3550
- function ys(e, t) {
3560
+ function Fs(e, t) {
3551
3561
  if (e.kind !== "semantic" || !e.connectionId) return;
3552
3562
  const n = (t.qualifiedEntityName || "").split(".").map((i) => i.trim()).filter(Boolean), r = n.at(-1);
3553
3563
  if (r)
@@ -3563,43 +3573,43 @@ function he(e, t) {
3563
3573
  let n = e.get(t);
3564
3574
  return n || (n = { fields: /* @__PURE__ */ new Map(), fieldConflicts: /* @__PURE__ */ new Set() }, e.set(t, n)), n;
3565
3575
  }
3566
- function ir(e, t) {
3576
+ function or(e, t) {
3567
3577
  e.sourceLabel === void 0 ? e.sourceLabel = t : e.sourceLabel !== t && (e.sourceLabelConflict = !0);
3568
3578
  }
3569
- function Ye(e, t, n) {
3579
+ function Qe(e, t, n) {
3570
3580
  for (const r of t) {
3571
3581
  const i = r == null ? void 0 : r.trim();
3572
3582
  if (!i) continue;
3573
- const o = yn(i), a = e.fields.get(o);
3583
+ const o = vn(i), a = e.fields.get(o);
3574
3584
  a === void 0 ? e.fields.set(o, n) : a !== n && e.fieldConflicts.add(o);
3575
3585
  }
3576
3586
  }
3577
- function ar(e, t) {
3578
- t.sourceLabel && ir(e, t.sourceLabel), t.sourceLabelConflict && (e.sourceLabelConflict = !0);
3587
+ function sr(e, t) {
3588
+ t.sourceLabel && or(e, t.sourceLabel), t.sourceLabelConflict && (e.sourceLabelConflict = !0);
3579
3589
  for (const [n, r] of t.fields)
3580
- Ye(e, [n], r);
3590
+ Qe(e, [n], r);
3581
3591
  for (const n of t.fieldConflicts ?? [])
3582
3592
  e.fieldConflicts.add(n);
3583
3593
  }
3584
- function or(e) {
3594
+ function cr(e) {
3585
3595
  return e.kind === "semantic" && (e.label || e.datasetName || "").trim() || void 0;
3586
3596
  }
3587
- function Bc(e, t) {
3597
+ function jc(e, t) {
3588
3598
  var r, i;
3589
3599
  const n = /* @__PURE__ */ new Map();
3590
3600
  for (const [o, a] of e) {
3591
3601
  if (a.status !== "ready") continue;
3592
- const s = t == null ? void 0 : t.get(o), c = s ? or(s) : void 0;
3602
+ const s = t == null ? void 0 : t.get(o), c = s ? cr(s) : void 0;
3593
3603
  for (const l of a.columns) {
3594
- const d = (r = l.column_name) == null ? void 0 : r.trim(), u = (i = l.label) == null ? void 0 : i.trim(), f = s ? ys(s, l) : void 0;
3595
- f && c && ir(
3604
+ const d = (r = l.column_name) == null ? void 0 : r.trim(), u = (i = l.label) == null ? void 0 : i.trim(), f = s ? Fs(s, l) : void 0;
3605
+ f && c && or(
3596
3606
  he(n, se(f)),
3597
3607
  c
3598
- ), !(!d || !u || u === d) && (Ye(
3608
+ ), !(!d || !u || u === d) && (Qe(
3599
3609
  he(n, o),
3600
3610
  [d, l.sourceField],
3601
3611
  u
3602
- ), f && Ye(
3612
+ ), f && Qe(
3603
3613
  he(n, se(f)),
3604
3614
  [l.sourceField, d],
3605
3615
  u
@@ -3608,20 +3618,20 @@ function Bc(e, t) {
3608
3618
  }
3609
3619
  return n;
3610
3620
  }
3611
- function Uc(...e) {
3621
+ function Gc(...e) {
3612
3622
  const t = /* @__PURE__ */ new Map();
3613
3623
  for (const n of e)
3614
3624
  for (const [r, i] of n ?? [])
3615
- ar(he(t, r), i);
3625
+ sr(he(t, r), i);
3616
3626
  return t;
3617
3627
  }
3618
3628
  function pt(e) {
3619
3629
  return [e.databaseName, e.schemaName, e.tableName].filter(Boolean).join(".");
3620
3630
  }
3621
- function bs(e) {
3631
+ function Ss(e) {
3622
3632
  return e.split(":").slice(2).filter(Boolean).join(".");
3623
3633
  }
3624
- function sr(e, t) {
3634
+ function lr(e, t) {
3625
3635
  const n = se(t), r = e.get(n);
3626
3636
  if (t.kind !== "physical") return r;
3627
3637
  const i = `physical:${t.connectionId}:`, o = pt(t), a = {
@@ -3630,32 +3640,32 @@ function sr(e, t) {
3630
3640
  };
3631
3641
  let s = !1;
3632
3642
  for (const [c, l] of e)
3633
- c.startsWith(i) && (c !== n && !la(o, bs(c)) || (ar(a, l), s = !0));
3643
+ c.startsWith(i) && (c !== n && !fa(o, Ss(c)) || (sr(a, l), s = !0));
3634
3644
  return s ? a : void 0;
3635
3645
  }
3636
- function vs(e, t) {
3646
+ function xs(e, t) {
3637
3647
  var i;
3638
3648
  if (!e) return;
3639
- const n = yn(t.name), r = sr(e, t.source);
3649
+ const n = vn(t.name), r = lr(e, t.source);
3640
3650
  return r && !((i = r.fieldConflicts) != null && i.has(n)) ? r.fields.get(n) : void 0;
3641
3651
  }
3642
- function Is(e, t) {
3652
+ function ws(e, t) {
3643
3653
  if (t.kind === "semantic")
3644
- return or(t) || t.datasetId || "Dataset";
3645
- const n = e ? sr(e, t) : void 0;
3654
+ return cr(t) || t.datasetId || "Dataset";
3655
+ const n = e ? lr(e, t) : void 0;
3646
3656
  return n != null && n.sourceLabel && !n.sourceLabelConflict ? n.sourceLabel : pt(t);
3647
3657
  }
3648
- function zc(e, t) {
3649
- const n = vs(e, t);
3658
+ function Wc(e, t) {
3659
+ const n = xs(e, t);
3650
3660
  return {
3651
3661
  name: t.name,
3652
3662
  ...n ? { label: n } : {},
3653
- entityName: Is(e, t.source),
3663
+ entityName: ws(e, t.source),
3654
3664
  ...t.source.kind === "physical" ? { qualifiedEntityName: pt(t.source) } : {},
3655
3665
  dataType: t.dataType
3656
3666
  };
3657
3667
  }
3658
- function Cs(e, t) {
3668
+ function Ts(e, t) {
3659
3669
  var i, o;
3660
3670
  const n = (i = t.column_name) == null ? void 0 : i.trim(), r = ce(t.data_type);
3661
3671
  if (!(!n || r === "unknown"))
@@ -3669,7 +3679,7 @@ function Cs(e, t) {
3669
3679
  }
3670
3680
  };
3671
3681
  }
3672
- function jc(e) {
3682
+ function Hc(e) {
3673
3683
  const t = {};
3674
3684
  for (const { card: n } of e.cards) {
3675
3685
  const r = Ze(n), i = r.kind === "config" ? r.executableSources : r.kind === "sql" ? r.pinnedCatalogSources.map((s) => s.source) : [];
@@ -3685,7 +3695,7 @@ function jc(e) {
3685
3695
  break;
3686
3696
  }
3687
3697
  for (const l of c.columns) {
3688
- const d = Cs(s, l);
3698
+ const d = Ts(s, l);
3689
3699
  d && o.push(d);
3690
3700
  }
3691
3701
  }
@@ -3693,20 +3703,20 @@ function jc(e) {
3693
3703
  }
3694
3704
  return t;
3695
3705
  }
3696
- function Gc(e) {
3697
- const { dashboard: t, target: n, calendar: r } = e, i = lr(n), o = cr(t, n, r);
3706
+ function Qc(e) {
3707
+ const { dashboard: t, target: n, calendar: r } = e, i = ur(n), o = dr(t, n, r);
3698
3708
  return {
3699
3709
  value: o,
3700
- mode: Dr(
3701
- kr(o == null ? void 0 : o.operation) ? o.operation : i.operation
3710
+ mode: Mr(
3711
+ Or(o == null ? void 0 : o.operation) ? o.operation : i.operation
3702
3712
  )
3703
3713
  };
3704
3714
  }
3705
- function cr(e, t, n) {
3715
+ function dr(e, t, n) {
3706
3716
  var r;
3707
3717
  switch (t.kind) {
3708
3718
  case "dashboardInput": {
3709
- const i = hi({
3719
+ const i = bi({
3710
3720
  dashboard: e,
3711
3721
  input: t.input,
3712
3722
  target: t.scope,
@@ -3718,7 +3728,7 @@ function cr(e, t, n) {
3718
3728
  const i = (r = e.defaultFilterValues) == null ? void 0 : r.find(
3719
3729
  (o) => o.filterId === t.filter.id
3720
3730
  );
3721
- return i ? gi({
3731
+ return i ? yi({
3722
3732
  filterDefinitions: [t.filter],
3723
3733
  filterValues: [i]
3724
3734
  })[0] : re(t.filter, n);
@@ -3727,16 +3737,16 @@ function cr(e, t, n) {
3727
3737
  return re(t.filter, n);
3728
3738
  }
3729
3739
  }
3730
- function lr(e) {
3740
+ function ur(e) {
3731
3741
  return e.kind === "dashboardInput" ? e.input.filter : e.filter;
3732
3742
  }
3733
- function Wc(e) {
3743
+ function Xc(e) {
3734
3744
  var o;
3735
3745
  const { dashboard: t, filter: n, input: r, scope: i } = e;
3736
- return r && (t.inputs || []).some((a) => a.id === r.id) ? { kind: "dashboardInput", input: r, scope: i } : ((o = Y(t).findFilterInput({ filterId: n.id })) == null ? void 0 : o.origin) === "toolbarFilter" ? { kind: "dashboardFilter", filter: n } : { kind: "definition", filter: n };
3746
+ return r && (t.inputs || []).some((a) => a.id === r.id) ? { kind: "dashboardInput", input: r, scope: i } : ((o = Q(t).findFilterInput({ filterId: n.id })) == null ? void 0 : o.origin) === "toolbarFilter" ? { kind: "dashboardFilter", filter: n } : { kind: "definition", filter: n };
3737
3747
  }
3738
- function Hc(e) {
3739
- const { dashboard: t, target: n, calendar: r } = e, i = lr(n), o = yi(i), a = Fs(t, n);
3748
+ function Yc(e) {
3749
+ const { dashboard: t, target: n, calendar: r } = e, i = ur(n), o = vi(i), a = Ds(t, n);
3740
3750
  if (!a) return o;
3741
3751
  if (a === "cleared")
3742
3752
  return {
@@ -3744,13 +3754,13 @@ function Hc(e) {
3744
3754
  defaultValues: void 0,
3745
3755
  defaultDateFilter: void 0
3746
3756
  };
3747
- const s = cr(t, n, r);
3748
- if (!s || Ss(s, re(i, r)))
3757
+ const s = dr(t, n, r);
3758
+ if (!s || ks(s, re(i, r)))
3749
3759
  return o;
3750
3760
  if (s.valueType === "date") {
3751
- const c = Ai(
3761
+ const c = bn(
3752
3762
  "relativeMeta" in s ? s.relativeMeta : void 0
3753
- ) ?? xs(i, s, r);
3763
+ ) ?? Ms(i, s, r);
3754
3764
  return c ? {
3755
3765
  operation: s.operation,
3756
3766
  defaultValues: i.defaultValues,
@@ -3763,7 +3773,7 @@ function Hc(e) {
3763
3773
  defaultDateFilter: i.defaultDateFilter
3764
3774
  };
3765
3775
  }
3766
- function Fs(e, t) {
3776
+ function Ds(e, t) {
3767
3777
  var n;
3768
3778
  if (t.kind === "dashboardInput") {
3769
3779
  const r = nt(
@@ -3778,19 +3788,19 @@ function Fs(e, t) {
3778
3788
  (r) => r.filterId === t.filter.id
3779
3789
  ) ? "set" : void 0;
3780
3790
  }
3781
- function Ss(e, t) {
3782
- return !!(t && e.operation === t.operation && qe(Jt(e), Jt(t)) && qe(
3791
+ function ks(e, t) {
3792
+ return !!(t && e.operation === t.operation && qe(Zt(e), Zt(t)) && qe(
3783
3793
  "relativeMeta" in e ? e.relativeMeta : void 0,
3784
3794
  "relativeMeta" in t ? t.relativeMeta : void 0
3785
3795
  ));
3786
3796
  }
3787
- function Jt(e) {
3797
+ function Zt(e) {
3788
3798
  return e.values.map(
3789
3799
  (t) => t instanceof Date ? t.getTime() : t
3790
3800
  );
3791
3801
  }
3792
- function xs(e, t, n) {
3793
- const r = bi(n == null ? void 0 : n.tz), i = Pe(t.values[0], r);
3802
+ function Ms(e, t, n) {
3803
+ const r = Ii(n == null ? void 0 : n.tz), i = Pe(t.values[0], r);
3794
3804
  if (!i) return;
3795
3805
  const [o, a, s] = new Intl.DateTimeFormat("en-CA", {
3796
3806
  timeZone: r,
@@ -3826,18 +3836,18 @@ function xs(e, t, n) {
3826
3836
  );
3827
3837
  });
3828
3838
  }
3829
- function Zt(e) {
3830
- return da(void 0, e ?? "");
3839
+ function en(e) {
3840
+ return ma(void 0, e ?? "");
3831
3841
  }
3832
- const ws = {
3842
+ const Os = {
3833
3843
  type: "temporal_bucket",
3834
3844
  presentation: { mode: "pattern", pattern: "YYYY-MM-DD" }
3835
3845
  };
3836
- function Ts(e) {
3846
+ function _s(e) {
3837
3847
  const t = ce(e.dataType);
3838
3848
  if (!["date", "datetime"].includes(t))
3839
3849
  return e;
3840
- const n = e.granularity !== void 0 || e.format !== void 0, r = vi({
3850
+ const n = e.granularity !== void 0 || e.format !== void 0, r = Ci({
3841
3851
  fieldId: e.id,
3842
3852
  dataType: e.dataType,
3843
3853
  granularity: e.granularity,
@@ -3846,20 +3856,20 @@ function Ts(e) {
3846
3856
  });
3847
3857
  if (!r.ok)
3848
3858
  return e;
3849
- const i = n ? r.selection.format : ws;
3859
+ const i = n ? r.selection.format : Os;
3850
3860
  return {
3851
3861
  ...e,
3852
3862
  granularity: r.granularity,
3853
3863
  format: i
3854
3864
  };
3855
3865
  }
3856
- function Yc(e, t) {
3866
+ function Jc(e, t) {
3857
3867
  var r, i;
3858
3868
  const n = ((i = (r = globalThis.crypto) == null ? void 0 : r.randomUUID) == null ? void 0 : i.call(r).slice(0, 8)) ?? Math.random().toString(36).slice(2, 10);
3859
3869
  return `${e}-${t.qualifiedEntityName}-${t.name}-${Date.now()}-${n}`;
3860
3870
  }
3861
- function Ds(e, t) {
3862
- const n = pn(e.replace(/_/g, " "));
3871
+ function Ps(e, t) {
3872
+ const n = gn(e.replace(/_/g, " "));
3863
3873
  switch (t) {
3864
3874
  case "SUM":
3865
3875
  return `Sum of ${n}`;
@@ -3877,15 +3887,15 @@ function Ds(e, t) {
3877
3887
  return n;
3878
3888
  }
3879
3889
  }
3880
- function Xc(e, t, n) {
3890
+ function Zc(e, t, n) {
3881
3891
  var i;
3882
- const r = gn(e.dataType);
3892
+ const r = hn(e.dataType);
3883
3893
  return n === "detailTable" ? "detailColumns" : n === "matrixTable" ? ((i = e.derivedField) == null ? void 0 : i.computeStage) === "aggregate" || ce(e.dataType) === "number" ? "metrics" : "groupBy" : n === "kpi" ? r === "date" ? "groupBy" : "metrics" : t.length === 0 || r === "number" ? "metrics" : r === "date" || r === "string" || r === "boolean" ? "groupBy" : "metrics";
3884
3894
  }
3885
- function Qc(e, t, n, r) {
3886
- const i = gn(e.dataType), o = i === "date";
3887
- e = Ni(e);
3888
- const a = Ei(e), s = a.representation !== "physical", c = a.computeStage, l = s ? e.fieldScope === "domain" ? e.calculatedFieldOrigin : e.calculatedFieldOrigin || {
3895
+ function el(e, t, n, r) {
3896
+ const i = hn(e.dataType), o = i === "date";
3897
+ e = Ei(e);
3898
+ const a = Ri(e), s = a.representation !== "physical", c = a.computeStage, l = s ? e.fieldScope === "domain" ? e.calculatedFieldOrigin : e.calculatedFieldOrigin || {
3889
3899
  id: e.id,
3890
3900
  role: e.role
3891
3901
  } : void 0;
@@ -3935,7 +3945,7 @@ function Qc(e, t, n, r) {
3935
3945
  const h = e, C = {
3936
3946
  ...m,
3937
3947
  role: "metric",
3938
- ...Kn(h, h, "selection"),
3948
+ ...Ln(h, h, "selection"),
3939
3949
  parameters: h.parameters,
3940
3950
  aliasTemplate: h.aliasTemplate,
3941
3951
  valueAliases: h.valueAliases,
@@ -3945,7 +3955,7 @@ function Qc(e, t, n, r) {
3945
3955
  semanticComparisonPolarity: h.semanticComparisonPolarity
3946
3956
  }, v = e.expression || "";
3947
3957
  if (!a.legacyManual && c !== "aggregate") {
3948
- const b = !C.aggregate && (c === "row" || $i(v).calls.length === 0), S = Zt(i);
3958
+ const b = !C.aggregate && (c === "row" || Ki(v).calls.length === 0), S = en(i);
3949
3959
  return {
3950
3960
  ...C,
3951
3961
  id: r,
@@ -3961,10 +3971,10 @@ function Qc(e, t, n, r) {
3961
3971
  role: "metric"
3962
3972
  };
3963
3973
  }
3964
- const p = e.aggregate || Zt(i), y = Ds(
3974
+ const p = e.aggregate || en(i), y = Ps(
3965
3975
  e.label,
3966
3976
  p
3967
- ), g = Ci(
3977
+ ), g = Si(
3968
3978
  { ...m, label: y },
3969
3979
  n,
3970
3980
  t
@@ -3980,7 +3990,7 @@ function Qc(e, t, n, r) {
3980
3990
  if (t === "groupBy") {
3981
3991
  if (u) {
3982
3992
  const p = e;
3983
- return Ts({
3993
+ return _s({
3984
3994
  ...m,
3985
3995
  label: e.label || e.name,
3986
3996
  role: "groupby",
@@ -3991,7 +4001,7 @@ function Qc(e, t, n, r) {
3991
4001
  ...m,
3992
4002
  role: "groupby",
3993
4003
  ...o && {
3994
- granularity: $t(e.granularity) ? e.granularity : "month",
4004
+ granularity: Rt(e.granularity) ? e.granularity : "month",
3995
4005
  // A new shelf placement does not author a presentation override.
3996
4006
  // Same-grain semantic presentation may therefore win; otherwise the
3997
4007
  // viewer's resolved automatic locale/style policy applies.
@@ -4005,13 +4015,13 @@ function Qc(e, t, n, r) {
4005
4015
  ...m,
4006
4016
  role: "pivotby",
4007
4017
  ...o && {
4008
- granularity: $t(e.granularity) ? e.granularity : "month",
4018
+ granularity: Rt(e.granularity) ? e.granularity : "month",
4009
4019
  format: void 0,
4010
4020
  formatOrigin: void 0
4011
4021
  }
4012
4022
  };
4013
4023
  if (t === "detailColumns") {
4014
- const p = Fi(m, "detail");
4024
+ const p = xi(m, "detail");
4015
4025
  if (d) {
4016
4026
  const y = e;
4017
4027
  return {
@@ -4040,14 +4050,14 @@ function Qc(e, t, n, r) {
4040
4050
  direction: "asc"
4041
4051
  } : null;
4042
4052
  }
4043
- function Jc(e) {
4044
- return Object.values(Ii(e)).some((t) => t.length > 0);
4053
+ function tl(e) {
4054
+ return Object.values(Fi(e)).some((t) => t.length > 0);
4045
4055
  }
4046
- function ks(e) {
4047
- const t = Q(e.format);
4056
+ function As(e) {
4057
+ const t = Y(e.format);
4048
4058
  if ((t == null ? void 0 : t.type) === "temporal_bucket") {
4049
4059
  if (!e.granularity) return {};
4050
- const n = Xi(
4060
+ const n = Zi(
4051
4061
  t,
4052
4062
  e.granularity
4053
4063
  );
@@ -4064,23 +4074,23 @@ function ks(e) {
4064
4074
  ...t ? { format: t } : {}
4065
4075
  };
4066
4076
  }
4067
- function Ms(e, t) {
4077
+ function Ns(e, t) {
4068
4078
  var i, o;
4069
4079
  const n = ((i = e.nativeDataType) == null ? void 0 : i.trim()) || ((o = e.native_data_type) == null ? void 0 : o.trim());
4070
4080
  return n || ((e.dataTypeProvenance || t) === "physical" ? e.data_type : void 0);
4071
4081
  }
4072
- function dr(e) {
4082
+ function fr(e) {
4073
4083
  const t = (e.label ?? "").trim();
4074
4084
  return t ? e.derivedLabel === void 0 ? !0 : t !== e.derivedLabel.trim() : !1;
4075
4085
  }
4076
4086
  function gt(e) {
4077
- return dr(e) ? e.label.trim() : e.name || (e.label ?? "").trim();
4087
+ return fr(e) ? e.label.trim() : e.name || (e.label ?? "").trim();
4078
4088
  }
4079
- function en(e) {
4089
+ function tn(e) {
4080
4090
  return gt(e).toLowerCase().trim();
4081
4091
  }
4082
- function Os(e, t) {
4083
- return en(e).localeCompare(en(t), void 0, {
4092
+ function $s(e, t) {
4093
+ return tn(e).localeCompare(tn(t), void 0, {
4084
4094
  numeric: !0,
4085
4095
  sensitivity: "base"
4086
4096
  });
@@ -4088,7 +4098,7 @@ function Os(e, t) {
4088
4098
  function ae(e) {
4089
4099
  return String(e ?? "").toLowerCase().replace(/[\s_\-.]+/g, "");
4090
4100
  }
4091
- function Zc(e, t) {
4101
+ function nl(e, t) {
4092
4102
  const n = ae(t);
4093
4103
  return n ? [
4094
4104
  gt(e),
@@ -4103,18 +4113,18 @@ function Zc(e, t) {
4103
4113
  (i) => !!i && ae(i).includes(n)
4104
4114
  ) : !0;
4105
4115
  }
4106
- function tn(e, t) {
4116
+ function nn(e, t) {
4107
4117
  const n = ae(t);
4108
4118
  if (!n) return 0;
4109
4119
  const r = ae(gt(e));
4110
4120
  return r.startsWith(n) ? 0 : r.includes(n) ? 1 : [e.label, e.name].filter(Boolean).map(ae).some((o) => o.includes(n)) ? 2 : 3;
4111
4121
  }
4112
- function el(e, t, n) {
4113
- return tn(e, n) - tn(t, n) || Os(e, t);
4122
+ function rl(e, t, n) {
4123
+ return nn(e, n) - nn(t, n) || $s(e, t);
4114
4124
  }
4115
- function _s(e, t) {
4125
+ function Es(e, t) {
4116
4126
  var o;
4117
- const n = e.type === "dataset" ? (o = t.find((a) => a.entityName)) == null ? void 0 : o.entityName : void 0, r = n || e.name, i = Pt(
4127
+ const n = e.type === "dataset" ? (o = t.find((a) => a.entityName)) == null ? void 0 : o.entityName : void 0, r = n || e.name, i = At(
4118
4128
  e.type === "dataset" && n ? { ...e, name: n } : e
4119
4129
  );
4120
4130
  return {
@@ -4126,12 +4136,12 @@ function _s(e, t) {
4126
4136
  qualifiedEntityName: i,
4127
4137
  columns: t.map((a) => {
4128
4138
  var m;
4129
- const s = e.type === "dataset" ? a.entityName || r : e.name, c = a.qualifiedEntityName || (e.type === "dataset" && s ? Pt({ ...e, name: s }) : i), l = Ms(
4139
+ const s = e.type === "dataset" ? a.entityName || r : e.name, c = a.qualifiedEntityName || (e.type === "dataset" && s ? At({ ...e, name: s }) : i), l = Ns(
4130
4140
  a,
4131
4141
  e.type === "dataset" ? "semantic" : "physical"
4132
4142
  ), d = (m = a.label) != null && m.trim() ? a.label : void 0, u = d ? void 0 : et(a.column_name);
4133
4143
  return {
4134
- id: Si(s, a.column_name),
4144
+ id: wi(s, a.column_name),
4135
4145
  name: a.column_name,
4136
4146
  qualifiedFieldName: a.qualifiedFieldName || a.column_name,
4137
4147
  dataType: a.data_type,
@@ -4155,23 +4165,23 @@ function _s(e, t) {
4155
4165
  aggregateOrigin: a.aggregateOrigin,
4156
4166
  labelOrigin: a.labelOrigin,
4157
4167
  formatOrigin: a.formatOrigin,
4158
- ...ks(a),
4168
+ ...As(a),
4159
4169
  aggregate: a.aggregate
4160
4170
  };
4161
4171
  })
4162
4172
  };
4163
4173
  }
4164
- function Ps(e) {
4174
+ function Rs(e) {
4165
4175
  return e.map((t) => ({
4166
4176
  ...t,
4167
- id: hn({ ...t }),
4177
+ id: yn({ ...t }),
4168
4178
  fieldScope: "domain"
4169
4179
  }));
4170
4180
  }
4171
- function As(e) {
4181
+ function Ks(e) {
4172
4182
  return e.flatMap(
4173
4183
  (t) => t.columns.map((n) => {
4174
- const r = dr(n) ? n.label : void 0, i = r ? void 0 : n.derivedLabel ?? pn(n.name), o = r ?? i ?? n.name;
4184
+ const r = fr(n) ? n.label : void 0, i = r ? void 0 : n.derivedLabel ?? gn(n.name), o = r ?? i ?? n.name;
4175
4185
  return {
4176
4186
  ...n,
4177
4187
  id: n.id || `${t.entityId}-${n.name}`,
@@ -4189,29 +4199,29 @@ function As(e) {
4189
4199
  })
4190
4200
  );
4191
4201
  }
4192
- function tl(e) {
4193
- const t = e.map((r) => _s(r.target, r.columns || [])).filter((r) => {
4202
+ function il(e) {
4203
+ const t = e.map((r) => Es(r.target, r.columns || [])).filter((r) => {
4194
4204
  var i;
4195
4205
  return ((i = r == null ? void 0 : r.columns) == null ? void 0 : i.length) > 0;
4196
- }), n = Ps(e.flatMap((r) => r.calculatedFields || []));
4206
+ }), n = Rs(e.flatMap((r) => r.calculatedFields || []));
4197
4207
  if (n.length > 0) {
4198
4208
  const r = /* @__PURE__ */ new Map();
4199
4209
  n.forEach((i) => {
4200
- const o = hn(i);
4210
+ const o = yn(i);
4201
4211
  r.has(o) || r.set(o, i);
4202
4212
  }), t.unshift({
4203
- entityId: xi,
4213
+ entityId: Ti,
4204
4214
  entityType: "dataset",
4205
- entityName: At,
4215
+ entityName: Nt,
4206
4216
  label: "Calculated Fields",
4207
4217
  description: "Domain-level calculated metrics and dimensions",
4208
- qualifiedEntityName: At,
4218
+ qualifiedEntityName: Nt,
4209
4219
  columns: Array.from(r.values())
4210
4220
  });
4211
4221
  }
4212
- return { columnGroups: t, columns: As(t) };
4222
+ return { columnGroups: t, columns: Ks(t) };
4213
4223
  }
4214
- function Ns(e, t) {
4224
+ function Vs(e, t) {
4215
4225
  var i;
4216
4226
  const n = (i = t.columnKeyMap) == null ? void 0 : i.byRole;
4217
4227
  if (!n) return;
@@ -4222,7 +4232,7 @@ function Ns(e, t) {
4222
4232
  if (r.length === 1)
4223
4233
  return r[0].outputKey ?? r[0].rawKey;
4224
4234
  }
4225
- function Es(e, t) {
4235
+ function Ls(e, t) {
4226
4236
  var r;
4227
4237
  const n = (r = t.resultColumns) == null ? void 0 : r.find((i) => {
4228
4238
  const o = i.pivotIdentity;
@@ -4232,13 +4242,13 @@ function Es(e, t) {
4232
4242
  });
4233
4243
  return n == null ? void 0 : n.key;
4234
4244
  }
4235
- function nn(e, t) {
4245
+ function rn(e, t) {
4236
4246
  var n;
4237
4247
  switch (e.kind) {
4238
4248
  case "field":
4239
- return Ns(e.fieldId, t);
4249
+ return Vs(e.fieldId, t);
4240
4250
  case "pivot":
4241
- return Es(e, t);
4251
+ return Ls(e, t);
4242
4252
  case "result":
4243
4253
  return !t.keys || t.keys.includes(e.key) ? e.key : void 0;
4244
4254
  case "sqlKpiValue":
@@ -4249,13 +4259,13 @@ function nn(e, t) {
4249
4259
  return;
4250
4260
  }
4251
4261
  }
4252
- function nl(e, t) {
4262
+ function al(e, t) {
4253
4263
  return e.flatMap((n) => {
4254
4264
  var s, c;
4255
- const r = nn(n.condition.column, t);
4265
+ const r = rn(n.condition.column, t);
4256
4266
  if (r === void 0) return [];
4257
4267
  const i = (s = n.target.columns) == null ? void 0 : s.flatMap((l) => {
4258
- const d = nn(l, t);
4268
+ const d = rn(l, t);
4259
4269
  return d === void 0 ? [] : [d];
4260
4270
  });
4261
4271
  if ((c = n.target.columns) != null && c.length && !(i != null && i.length)) return [];
@@ -4269,9 +4279,9 @@ function nl(e, t) {
4269
4279
  ];
4270
4280
  });
4271
4281
  }
4272
- function rl(e, t, n) {
4282
+ function ol(e, t, n) {
4273
4283
  var a, s, c, l, d;
4274
- const r = wi(e);
4284
+ const r = Di(e);
4275
4285
  if (r.includes("matrixMeasure"))
4276
4286
  return (s = (a = e.config) == null ? void 0 : a.matrix) != null && s.spec.measures.some((u) => u.id === t) ? { kind: "matrixMeasure", measureId: t } : void 0;
4277
4287
  if (r.includes("sqlKpiValue")) return { kind: "sqlKpiValue" };
@@ -4292,7 +4302,7 @@ function rl(e, t, n) {
4292
4302
  );
4293
4303
  return o.length === 1 ? { kind: "field", fieldId: o[0] } : void 0;
4294
4304
  }
4295
- function il(e, t) {
4305
+ function sl(e, t) {
4296
4306
  var i, o;
4297
4307
  const n = (i = t == null ? void 0 : t.find(
4298
4308
  (a) => a.filterId === e.id
@@ -4302,11 +4312,11 @@ function il(e, t) {
4302
4312
  ]);
4303
4313
  return n && r.has(n) ? n : e.column;
4304
4314
  }
4305
- function al(e, t, n) {
4306
- const r = Ti({ card: e, stated: t, context: n });
4307
- return r.ok ? { ok: !0, card: r.update ? Di(e, r.update).card : e, warnings: r.warnings } : r;
4315
+ function cl(e, t, n) {
4316
+ const r = ki({ card: e, stated: t, context: n });
4317
+ return r.ok ? { ok: !0, card: r.update ? Mi(e, r.update).card : e, warnings: r.warnings } : r;
4308
4318
  }
4309
- function ol({
4319
+ function ll({
4310
4320
  resolvedCardConfig: e,
4311
4321
  card: t,
4312
4322
  row: n,
@@ -4332,14 +4342,14 @@ function ol({
4332
4342
  value: String(v),
4333
4343
  // Convert to string for consistency
4334
4344
  ...I ? {
4335
- label: Mi({
4345
+ label: _i({
4336
4346
  value: String(v),
4337
4347
  presentation: I
4338
4348
  }),
4339
4349
  temporalBucket: I.metadata
4340
4350
  } : {},
4341
4351
  ...b ? {
4342
- label: ki({ value: String(v), presentation: b }).label,
4352
+ label: Oi({ value: String(v), presentation: b }).label,
4343
4353
  rawTemporal: { ...b.metadata, tz: b.format.calendarTimezone }
4344
4354
  } : {}
4345
4355
  });
@@ -4364,7 +4374,7 @@ function ol({
4364
4374
  metrics: y.length > 0 ? y : void 0
4365
4375
  };
4366
4376
  }
4367
- function sl({
4377
+ function dl({
4368
4378
  resolvedCardConfig: e,
4369
4379
  card: t,
4370
4380
  columnId: n,
@@ -4376,7 +4386,7 @@ function sl({
4376
4386
  return ((l == null ? void 0 : l.outputKey) || (l == null ? void 0 : l.rawKey) || c.label) === n;
4377
4387
  });
4378
4388
  }
4379
- const $s = {
4389
+ const qs = {
4380
4390
  noFields: "There is nothing to filter by here.",
4381
4391
  clickedColumnNotFilterable: "This column cannot filter other cards.",
4382
4392
  noChosenColumns: "This column is not set up to filter other cards.",
@@ -4384,9 +4394,9 @@ const $s = {
4384
4394
  unsupportedCondition: "This value cannot filter other cards."
4385
4395
  };
4386
4396
  function Ve(e) {
4387
- return { status: "unavailable", code: e, reason: $s[e] };
4397
+ return { status: "unavailable", code: e, reason: qs[e] };
4388
4398
  }
4389
- function cl(e) {
4399
+ function ul(e) {
4390
4400
  const t = e.conditions.filter(
4391
4401
  (s) => s.field.role !== "metric"
4392
4402
  );
@@ -4394,7 +4404,7 @@ function cl(e) {
4394
4404
  const n = (s) => {
4395
4405
  if (s.operator !== "=" && s.operator !== "isNull")
4396
4406
  return "unsupportedCondition";
4397
- const c = Nt(
4407
+ const c = $t(
4398
4408
  s.field,
4399
4409
  e.sourceIndex
4400
4410
  );
@@ -4416,7 +4426,7 @@ function cl(e) {
4416
4426
  i.push(c);
4417
4427
  }
4418
4428
  else {
4419
- const s = r.kind === "clickedCell" && e.clickedField ? Nt(e.clickedField, e.sourceIndex) : void 0, c = r.kind === "chosenColumns" ? r.clickedFieldKeys : s ? [Ae(s)] : [];
4429
+ const s = r.kind === "clickedCell" && e.clickedField ? $t(e.clickedField, e.sourceIndex) : void 0, c = r.kind === "chosenColumns" ? r.clickedFieldKeys : s ? [Ae(s)] : [];
4420
4430
  for (const l of t) {
4421
4431
  const d = n(l);
4422
4432
  typeof d != "string" && c.includes(Ae(d.field)) && i.push(d);
@@ -4432,11 +4442,11 @@ function cl(e) {
4432
4442
  return o.has(c) ? !1 : (o.add(c), !0);
4433
4443
  }) } };
4434
4444
  }
4435
- function ll(e, t) {
4445
+ function fl(e, t) {
4436
4446
  const n = e.answers.relationshipIds;
4437
4447
  return !n || !t ? !n && !t : n.length === t.length && n.every((r, i) => t[i] === r);
4438
4448
  }
4439
- const Rs = /* @__PURE__ */ new Set([
4449
+ const Bs = /* @__PURE__ */ new Set([
4440
4450
  "dataset_not_reachable",
4441
4451
  "field_not_resolvable",
4442
4452
  "missing_metadata",
@@ -4448,15 +4458,15 @@ const Rs = /* @__PURE__ */ new Set([
4448
4458
  function z(e) {
4449
4459
  return !!e && typeof e == "object" && !Array.isArray(e);
4450
4460
  }
4451
- function Ks(e) {
4461
+ function Us(e) {
4452
4462
  if (z(e))
4453
4463
  switch (e.status) {
4454
4464
  case "applied": {
4455
- const t = xn(e.route);
4465
+ const t = Tn(e.route);
4456
4466
  return t ? { status: "applied", route: t } : void 0;
4457
4467
  }
4458
4468
  case "skipped":
4459
- return typeof e.reason == "string" && Rs.has(e.reason) ? { status: "skipped", reason: e.reason } : void 0;
4469
+ return typeof e.reason == "string" && Bs.has(e.reason) ? { status: "skipped", reason: e.reason } : void 0;
4460
4470
  case "needsPath":
4461
4471
  return { status: "needsPath" };
4462
4472
  case "blocked":
@@ -4469,22 +4479,22 @@ function Ks(e) {
4469
4479
  return;
4470
4480
  }
4471
4481
  }
4472
- function ur(e) {
4482
+ function mr(e) {
4473
4483
  if (e !== void 0)
4474
4484
  return Array.isArray(e) && e.length > 0 && e.every((t) => typeof t == "string" && t.length > 0) ? e : null;
4475
4485
  }
4476
- function Vs(e) {
4486
+ function zs(e) {
4477
4487
  if (!z(e)) return;
4478
- const t = xn(e.route), n = e.target;
4479
- if (!(!t || !z(n) || n.kind !== "relationship" || !z(n.field) || typeof n.field.name != "string" || !z(n.field.source) || n.field.source.kind !== "semantic" || !ur(n.relationshipIds)))
4488
+ const t = Tn(e.route), n = e.target;
4489
+ if (!(!t || !z(n) || n.kind !== "relationship" || !z(n.field) || typeof n.field.name != "string" || !z(n.field.source) || n.field.source.kind !== "semantic" || !mr(n.relationshipIds)))
4480
4490
  return { route: t, target: n };
4481
4491
  }
4482
- function dl(e) {
4492
+ function ml(e) {
4483
4493
  if (!z(e) || !Array.isArray(e.previews)) return { previews: [] };
4484
4494
  const t = [];
4485
4495
  for (const r of e.previews) {
4486
4496
  if (!z(r) || typeof r.cardId != "string" || !r.cardId || !z(r.answers)) continue;
4487
- const i = ur(r.answers.relationshipIds), o = Ks(r.outcome), a = Array.isArray(r.paths) ? r.paths.map(Vs) : [];
4497
+ const i = mr(r.answers.relationshipIds), o = Us(r.outcome), a = Array.isArray(r.paths) ? r.paths.map(zs) : [];
4488
4498
  i === null || !o || !a.every(Boolean) || o.status === "needsPath" && a.length < 2 || t.push({
4489
4499
  cardId: r.cardId,
4490
4500
  answers: i ? { relationshipIds: i } : {},
@@ -4496,18 +4506,18 @@ function dl(e) {
4496
4506
  return { previews: t, ...n ? { manageRelationships: n } : {} };
4497
4507
  }
4498
4508
  const ye = (e) => (e == null ? void 0 : e.label) || (e == null ? void 0 : e.name) || "";
4499
- function Ls(e) {
4509
+ function js(e) {
4500
4510
  return !e || /s$/i.test(e) ? e : /[^aeiou]y$/i.test(e) ? `${e.slice(0, -1)}ies` : `${e}s`;
4501
4511
  }
4502
- function ul(e) {
4512
+ function pl(e) {
4503
4513
  if (e.direction === "to_many") {
4504
4514
  const n = ye(e.matchingDataset ?? e.datasets[e.datasets.length - 1]);
4505
- return `${e.base ? Ls(ye(e.base)) : "Rows"} with at least one matching ${n}`;
4515
+ return `${e.base ? js(ye(e.base)) : "Rows"} with at least one matching ${n}`;
4506
4516
  }
4507
4517
  return `through ${(e.datasets.length > 1 ? e.datasets.slice(0, -1) : e.datasets).map(ye).join(", ")}`;
4508
4518
  }
4509
- const fl = "The relationship this card used changed; choose it again";
4510
- function ml(e, t) {
4519
+ const gl = "The relationship this card used changed; choose it again";
4520
+ function hl(e, t) {
4511
4521
  switch (e) {
4512
4522
  case "relationship_missing":
4513
4523
  return t ? `Not related to ${ye(t)}` : "Not related to this card";
@@ -4525,143 +4535,143 @@ function ml(e, t) {
4525
4535
  }
4526
4536
  }
4527
4537
  export {
4528
- M as $,
4529
- _s as A,
4530
- Ps as B,
4531
- As as C,
4532
- Zo as D,
4533
- tl as E,
4534
- nn as F,
4535
- nl as G,
4536
- rl as H,
4537
- al as I,
4538
- ll as J,
4539
- dl as K,
4540
- Ls as L,
4541
- ul as M,
4542
- Ja as N,
4543
- ml as O,
4538
+ D as $,
4539
+ Es as A,
4540
+ Rs as B,
4541
+ Ks as C,
4542
+ ns as D,
4543
+ il as E,
4544
+ rn as F,
4545
+ al as G,
4546
+ ol as H,
4547
+ cl as I,
4548
+ fl as J,
4549
+ ml as K,
4550
+ js as L,
4551
+ pl as M,
4552
+ to as N,
4553
+ hl as O,
4544
4554
  gt as P,
4545
- za as Q,
4546
- fl as R,
4547
- ba as S,
4548
- va as T,
4555
+ Wa as Q,
4556
+ gl as R,
4557
+ Ca as S,
4558
+ Fa as T,
4549
4559
  Te as U,
4550
- dc as V,
4551
- _c as W,
4552
- sc as X,
4560
+ mc as V,
4561
+ Nc as W,
4562
+ dc as X,
4553
4563
  Fe as Y,
4554
- so as Z,
4555
- lo as _,
4556
- Yc as a,
4557
- Oc as a$,
4558
- as as a0,
4559
- ho as a1,
4560
- Mc as a2,
4561
- Kc as a3,
4562
- $c as a4,
4563
- ha as a5,
4564
- pa as a6,
4565
- ga as a7,
4566
- xc as a8,
4564
+ uo as Z,
4565
+ mo as _,
4566
+ Jc as a,
4567
+ Ac as a$,
4568
+ cs as a0,
4569
+ vo as a1,
4570
+ Pc as a2,
4571
+ qc as a3,
4572
+ Vc as a4,
4573
+ va as a5,
4574
+ ya as a6,
4575
+ ba as a7,
4576
+ Dc as a8,
4567
4577
  lt as a9,
4568
4578
  ot as aA,
4569
- uc as aB,
4570
- fc as aC,
4579
+ pc as aB,
4580
+ gc as aC,
4571
4581
  Se as aD,
4572
4582
  le as aE,
4573
- oc as aF,
4574
- sl as aG,
4575
- yc as aH,
4576
- Fo as aI,
4583
+ lc as aF,
4584
+ dl as aG,
4585
+ Ic as aH,
4586
+ wo as aI,
4577
4587
  V as aJ,
4578
- Pc as aK,
4579
- nr as aL,
4580
- Zc as aM,
4581
- dr as aN,
4582
- zc as aO,
4583
- Is as aP,
4588
+ $c as aK,
4589
+ ir as aL,
4590
+ nl as aM,
4591
+ fr as aN,
4592
+ Wc as aO,
4593
+ ws as aP,
4584
4594
  se as aQ,
4585
4595
  pt as aR,
4586
- qc as aS,
4587
- jc as aT,
4588
- Bc as aU,
4589
- hs as aV,
4590
- Ms as aW,
4591
- Hc as aX,
4592
- Wc as aY,
4593
- Uc as aZ,
4594
- vs as a_,
4595
- mc as aa,
4596
- vc as ab,
4597
- Cc as ac,
4598
- Ic as ad,
4596
+ zc as aS,
4597
+ Hc as aT,
4598
+ jc as aU,
4599
+ Cs as aV,
4600
+ Ns as aW,
4601
+ Yc as aX,
4602
+ Xc as aY,
4603
+ Gc as aZ,
4604
+ xs as a_,
4605
+ hc as aa,
4606
+ Fc as ab,
4607
+ xc as ac,
4608
+ Sc as ad,
4599
4609
  st as ae,
4600
- Ea as af,
4601
- bc as ag,
4602
- Fc as ah,
4603
- Ta as ai,
4604
- Va as aj,
4605
- La as ak,
4606
- Sc as al,
4610
+ Ka as af,
4611
+ Cc as ag,
4612
+ wc as ah,
4613
+ Ma as ai,
4614
+ Ba as aj,
4615
+ Ua as ak,
4616
+ Tc as al,
4607
4617
  U as am,
4608
4618
  je as an,
4609
- $a as ao,
4610
- pc as ap,
4611
- gc as aq,
4612
- Jc as ar,
4613
- hc as as,
4614
- Rn as at,
4615
- lc as au,
4616
- ja as av,
4617
- ma as aw,
4618
- ac as ax,
4619
- wn as ay,
4620
- Ia as az,
4621
- Ds as b,
4622
- ao as b0,
4623
- Na as b1,
4624
- el as b2,
4625
- tn as b3,
4626
- co as b4,
4627
- ks as b5,
4628
- Rc as b6,
4629
- rs as b7,
4630
- Xc as b8,
4631
- Ts as b9,
4619
+ Va as ao,
4620
+ yc as ap,
4621
+ bc as aq,
4622
+ tl as ar,
4623
+ vc as as,
4624
+ Vn as at,
4625
+ fc as au,
4626
+ Ha as av,
4627
+ ha as aw,
4628
+ cc as ax,
4629
+ Dn as ay,
4630
+ Sa as az,
4631
+ Ps as b,
4632
+ co as b0,
4633
+ Ra as b1,
4634
+ rl as b2,
4635
+ nn as b3,
4636
+ fo as b4,
4637
+ As as b5,
4638
+ Lc as b6,
4639
+ os as b7,
4640
+ Zc as b8,
4641
+ _s as b9,
4632
4642
  ae as ba,
4633
- Ac as bb,
4634
- yo as bc,
4635
- Nc as bd,
4636
- Gt as be,
4637
- bo as bf,
4638
- er as bg,
4639
- Zn as bh,
4640
- zo as bi,
4641
- Vc as bj,
4642
- cc as bk,
4643
- Zt as c,
4644
- il as d,
4645
- vo as e,
4646
- Ec as f,
4647
- Qc as g,
4648
- kc as h,
4649
- Dc as i,
4650
- Lc as j,
4651
- Cs as k,
4652
- So as l,
4653
- xo as m,
4654
- ol as n,
4655
- Ga as o,
4656
- Ha as p,
4657
- Ya as q,
4658
- Gc as r,
4659
- cl as s,
4660
- wc as t,
4661
- Kn as u,
4662
- no as v,
4663
- Xa as w,
4664
- Tc as x,
4665
- Qa as y,
4666
- eo as z
4643
+ Ec as bb,
4644
+ Io as bc,
4645
+ Rc as bd,
4646
+ Wt as be,
4647
+ Co as bf,
4648
+ nr as bg,
4649
+ tr as bh,
4650
+ Wo as bi,
4651
+ Bc as bj,
4652
+ uc as bk,
4653
+ en as c,
4654
+ sl as d,
4655
+ Fo as e,
4656
+ Kc as f,
4657
+ el as g,
4658
+ _c as h,
4659
+ Oc as i,
4660
+ Uc as j,
4661
+ Ts as k,
4662
+ To as l,
4663
+ Do as m,
4664
+ ll as n,
4665
+ Qa as o,
4666
+ Ya as p,
4667
+ Ja as q,
4668
+ Qc as r,
4669
+ ul as s,
4670
+ kc as t,
4671
+ Ln as u,
4672
+ ao as v,
4673
+ Za as w,
4674
+ Mc as x,
4675
+ eo as y,
4676
+ ro as z
4667
4677
  };