react-semaphor 0.1.546 → 0.1.548

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 (59) hide show
  1. package/dist/analytics-protocol/index.js +71 -68
  2. package/dist/assistant-context/index.js +1 -1
  3. package/dist/briefings/index.js +1 -1
  4. package/dist/chunks/applied-constraints-DU-wndZ7.js +47 -0
  5. package/dist/chunks/{assistant-chat-BPXhulAx.js → assistant-chat-DCcWsoGm.js} +106 -106
  6. package/dist/chunks/{bookmark-state-C4vetoa0.js → bookmark-state-Cu-a5ie_.js} +2 -8
  7. package/dist/chunks/{custom-visual-inputs-CkJW9pBS.js → custom-visual-inputs-BTRnwsfd.js} +1 -1
  8. package/dist/chunks/{dashboard-C3CoKbGY.js → dashboard-BZHL9a-z.js} +1 -1
  9. package/dist/chunks/{dashboard-briefing-launcher-Be4h-7My.js → dashboard-briefing-launcher-DML-cAzB.js} +528 -528
  10. package/dist/chunks/{dashboard-controls-bxPrlSyp.js → dashboard-controls-BGoBTPS7.js} +45 -45
  11. package/dist/chunks/{dashboard-json-BrjxIiRt.js → dashboard-json-iHPsdn3j.js} +1 -1
  12. package/dist/chunks/{document-dashboard-inputs-CRVHpIHp.js → document-dashboard-inputs-B2AqPfrq.js} +94 -94
  13. package/dist/chunks/{edit-dashboard-visual-DYYYDjY6.js → edit-dashboard-visual-CLEFFf2T.js} +281 -281
  14. package/dist/chunks/{column-catalog-BYnochWQ.js → filter-reach-copy-ByzGadUk.js} +978 -861
  15. package/dist/chunks/{global-date-filter-utils-9d6m9-FE.js → global-date-filter-utils-CeeFJ1CP.js} +4070 -3792
  16. package/dist/chunks/{index-DkQkMKa1.js → index-DeDHr3iz.js} +30 -30
  17. package/dist/chunks/{raw-temporal-presentation-CBzrDOjM.js → raw-temporal-presentation-CrUM2I_o.js} +1 -1
  18. package/dist/chunks/{report-preferences-dialog-4QEZWe5U.js → report-preferences-dialog-CM7kXmXp.js} +59 -59
  19. package/dist/chunks/{resolve-dashboard-input-context-UpK_LBpL.js → resolve-dashboard-input-context-BmWF9hSl.js} +1511 -1612
  20. package/dist/chunks/{saved-dashboard-context-D_I3Lxk0.js → saved-dashboard-context-qtfzl9Eb.js} +5 -5
  21. package/dist/chunks/{semaphor-ready-indicator-4zpRHE-X.js → semaphor-ready-indicator-Ol6VcaR7.js} +36548 -35855
  22. package/dist/chunks/{shelf-drop-preview-context-Cfw7TRAx.js → shelf-drop-preview-context-C2SEC3I9.js} +80 -80
  23. package/dist/chunks/{source-entity-resolution-BIGRvtbG.js → source-entity-resolution-D195CrYS.js} +221 -192
  24. package/dist/chunks/{table-settings-CunhoDUi.js → table-settings-WysCBj62.js} +133 -124
  25. package/dist/chunks/{use-create-flow-overlay-state-DZBZiiD-.js → use-create-flow-overlay-state-CbGIjaVD.js} +2 -2
  26. package/dist/dashboard/index.js +2 -2
  27. package/dist/dashboard-authoring/index.js +1419 -1340
  28. package/dist/data-app-sdk-validation/index.js +1 -1
  29. package/dist/index.js +14 -14
  30. package/dist/surfboard/index.js +2 -2
  31. package/dist/types/components/surfboard/filter/types.d.ts +7 -0
  32. package/dist/types/components/surfboard/screen-size-preview-button.d.ts +7 -4
  33. package/dist/types/components/visual/matrix-table/matrix-card-view.d.ts +3 -0
  34. package/dist/types/index.js +2 -2
  35. package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-authoring.d.ts +383 -22
  36. package/dist/types/lib/dashboard-inputs/dashboard-filter-value-identity.d.ts +65 -0
  37. package/dist/types/lib/dashboard-inputs/resolve-selection-input.d.ts +3 -3
  38. package/dist/types/lib/hooks/use-dashboard-card.d.ts +2 -0
  39. package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +1 -1
  40. package/dist/types/lib/matrix-table/matrix-runtime-types.d.ts +9 -1
  41. package/dist/types/lib/matrix-table/matrix-runtime.d.ts +5 -1
  42. package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +83 -13
  43. package/dist/types/lib/stores/dashboard-store.d.ts +12 -0
  44. package/dist/types/shared/analytics-protocol/applied-constraints.d.ts +57 -1
  45. package/dist/types/shared/assistant-protocol/context.d.ts +8 -8
  46. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +2 -0
  47. package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +7 -0
  48. package/dist/types/shared/dashboard-authoring/click-to-filter-settings.d.ts +3 -3
  49. package/dist/types/shared/dashboard-authoring/dashboard-filter-automatic-target.d.ts +4 -4
  50. package/dist/types/shared/dashboard-authoring/dashboard-filter-mapping-contract.d.ts +3 -1
  51. package/dist/types/shared/dashboard-authoring/dashboard-filter-mapping-types.d.ts +27 -1
  52. package/dist/types/shared/dashboard-authoring/dashboard-filter-value-compatibility.d.ts +12 -3
  53. package/dist/types/shared/dashboard-authoring/filter-reach-copy.d.ts +18 -0
  54. package/dist/types/shared/dashboard-authoring/filter-reach-preview.d.ts +97 -0
  55. package/dist/types/shared/dashboard-authoring/index.d.ts +5 -1
  56. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +7 -0
  57. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +26 -4
  58. package/dist/types/shared/dashboard-authoring/semantic-auto-join-card.d.ts +22 -0
  59. package/package.json +1 -1
@@ -1,28 +1,29 @@
1
- import { ai as ri, aj as ai, ak as oi, al as dt, am as si, an as k, ao as ft, ap as li, aq as ci, ar as De, as as ui, at as mt, au as di, av as fi, aw as mi, ax as pi, ay as yi, az as gi, aA as pt, aB as bi, aC as hi, aD as vi, aE as be, aF as Fi, aG as Ci, aH as Ii, b as xi, aI as Si, w as Mi, aJ as Di, aK as Ti } from "./resolve-dashboard-input-context-UpK_LBpL.js";
2
- import { ab as yt, f as wi, e as Pi, a8 as gt, am as Oi, v as Ai } from "./validators-C-aOQlTB.js";
1
+ import { af as li, ag as ci, ah as ui, ai as mt, aj as di, ak as K, al as pt, am as fi, an as mi, ao as we, ap as pi, aq as yt, ar as yi, as as hi, at as gi, au as bi, av as vi, aw as Fi, ax as ht, ay as Ci, az as Ii, aA as xi, aB as ve, aC as Si, aD as Mi, aE as Di, b as Ti, aF as wi, v as Pi, z as Oi, aG as Ai, aH as Ni } from "./resolve-dashboard-input-context-BmWF9hSl.js";
2
+ import { ab as gt, f as _i, e as Ei, a8 as bt, am as Ri, v as Vi } from "./validators-C-aOQlTB.js";
3
3
  import "./matrix-operation-contract-D6vYkZK4.js";
4
- import { r as Ni, C as Ei } from "./metric-comparison-zpGw4lD6.js";
4
+ import { r as ki, C as Bi } from "./metric-comparison-zpGw4lD6.js";
5
5
  import "./analytics-base-schemas-BKs3flFS.js";
6
6
  import "zod";
7
- import { q as Vi } from "./pivot-result-lifecycle-pwq3b7LC.js";
7
+ import { q as Ki } from "./pivot-result-lifecycle-pwq3b7LC.js";
8
8
  import { f as H } from "./matrix-formatter-DWEeC0_c.js";
9
- import { b as bt, m as _i, h as Ri, d as Ce, e as Bi, i as B, u as E, R as Ki, v as ki, r as Li, z as qi } from "./temporal-bucket-CQOSbv9-.js";
9
+ import { b as vt, m as Li, h as qi, d as xe, e as $i, i as k, u as _, R as zi, v as ji, r as Ui, z as Gi } from "./temporal-bucket-CQOSbv9-.js";
10
10
  import "../value-format-preferences/index.js";
11
- import { K as zi, w as fe } from "./table-settings-CunhoDUi.js";
12
- import { df as ht, dm as vt, dn as $i, dp as ji, cJ as Te, dq as Ui, cK as Ue, dr as N, ar as Hi, ds as Ft, dt as we, du as Gi, dv as Wi, dw as He, dx as Qi, dy as Ge, dz as Ji, dA as Yi, Q as Ct, dB as It, dC as xt, v as St, dD as We, X as q, dE as Pe, cU as Qe, cW as Oe, cR as Je, dF as Ye, di as Xi, b4 as Ae, dG as Zi, dH as en, dI as tn, cO as U, b7 as Xe, dJ as nn, a1 as Mt, a2 as Dt, d as rn, dK as L, b9 as an, dL as on, ba as sn, az as Tt, dM as ln, dN as cn, dO as un, dP as dn, b as wt, dh as fn, cN as mn, dQ as pn, c$ as Ie, dR as yn, dS as he, c1 as Pt, dT as Ze, dU as gn, bB as bn, c4 as et, c3 as hn, dV as vn } from "./global-date-filter-utils-9d6m9-FE.js";
13
- import { r as Fn } from "./pivot-result-identity-C-Q1j1Wb.js";
14
- import { g as Cn } from "./_commonjsHelpers-DimLPMtv.js";
15
- import { e as In, d as xn } from "./raw-temporal-presentation-CBzrDOjM.js";
11
+ import { K as Hi, w as pe } from "./table-settings-WysCBj62.js";
12
+ import { dm as Ft, du as Ct, dv as Wi, dw as Qi, cQ as Pe, dx as Yi, cR as He, dy as N, as as Ji, dz as It, dA as Oe, dB as Xi, dC as Zi, dD as We, dE as en, dF as Qe, dG as tn, dH as nn, Q as xt, dI as St, dJ as Mt, v as Dt, dK as Ye, Y as q, dL as Ae, c$ as Je, d1 as Ne, cY as Xe, dM as Ze, dq as rn, b9 as _e, dN as an, dO as on, dP as sn, cV as G, bc as et, dQ as ln, a2 as Tt, a3 as wt, d as cn, dR as $, be as un, dS as dn, bf as fn, aA as Pt, dT as mn, dU as pn, dV as yn, dW as hn, b as Ot, dp as gn, cU as bn, dX as vn, d6 as Se, dY as Fn, dZ as Fe, c6 as At, d_ as tt, d$ as Cn, bG as In, c9 as it, c8 as xn, e0 as Sn } from "./global-date-filter-utils-CeeFJ1CP.js";
13
+ import { r as Mn } from "./pivot-result-identity-C-Q1j1Wb.js";
14
+ import { g as Dn } from "./_commonjsHelpers-DimLPMtv.js";
15
+ import { e as Tn, d as wn } from "./raw-temporal-presentation-CrUM2I_o.js";
16
16
  import "./index-CtoK1Lgu.js";
17
17
  import "./index-CuHybtft.js";
18
- import { i as Sn } from "./source-entity-resolution-BIGRvtbG.js";
19
- import { R as Mn } from "./matrix-analytical-definition-B9vW-osb.js";
20
- const _a = 15, Dn = /\{\{-?\s*filters\s*\|\s*where\s*-?\}\}/i, Tn = /\{\{-?\s*filters\s*\|\s*and\s*-?\}\}/i, wn = /\bwhere\b/i;
21
- function Pn(e) {
22
- return e != null && e.trim() ? Dn.test(e) || Tn.test(e) : !1;
23
- }
24
- function Ra(e) {
25
- return !(e != null && e.trim()) || Pn(e) ? null : wn.test(e) ? {
18
+ import { i as Pn } from "./source-entity-resolution-D195CrYS.js";
19
+ import { R as On } from "./matrix-analytical-definition-B9vW-osb.js";
20
+ import { r as Nt } from "./applied-constraints-DU-wndZ7.js";
21
+ const Ha = 15, An = /\{\{-?\s*filters\s*\|\s*where\s*-?\}\}/i, Nn = /\{\{-?\s*filters\s*\|\s*and\s*-?\}\}/i, _n = /\bwhere\b/i;
22
+ function En(e) {
23
+ return e != null && e.trim() ? An.test(e) || Nn.test(e) : !1;
24
+ }
25
+ function Wa(e) {
26
+ return !(e != null && e.trim()) || En(e) ? null : _n.test(e) ? {
26
27
  helper: "{{ filters | and }}",
27
28
  description: "For queries with an existing WHERE clause."
28
29
  } : {
@@ -30,58 +31,58 @@ function Ra(e) {
30
31
  description: "For queries without a WHERE clause."
31
32
  };
32
33
  }
33
- const tt = [10, 20, 50, 100, 500, 1e3], On = 50;
34
- function An(e) {
35
- return e && e > 0 ? e : On;
34
+ const nt = [10, 20, 50, 100, 500, 1e3], Rn = 50;
35
+ function Vn(e) {
36
+ return e && e > 0 ? e : Rn;
36
37
  }
37
- function Ba(e) {
38
- const t = An(e), i = [...tt];
39
- return tt.includes(
38
+ function Qa(e) {
39
+ const t = Vn(e), i = [...nt];
40
+ return nt.includes(
40
41
  t
41
42
  ) || (i.push(t), i.sort((n, r) => n - r)), i;
42
43
  }
43
- function Ka(e) {
44
+ function Ya(e) {
44
45
  var t, i;
45
- return !!((e.type === "table" || e.type === "detailTable") && e.sql && !ht(e.config) && !((i = (t = e.preferences) == null ? void 0 : t.tablePrefs) != null && i.forceClientPagination));
46
+ return !!((e.type === "table" || e.type === "detailTable") && e.sql && !Ft(e.config) && !((i = (t = e.preferences) == null ? void 0 : t.tablePrefs) != null && i.forceClientPagination));
46
47
  }
47
- function Nn(e, t) {
48
+ function kn(e, t) {
48
49
  var n, r, a, o;
49
50
  if (t === "table-print")
50
51
  return "disabled";
51
52
  if ((r = (n = e.preferences) == null ? void 0 : n.tablePrefs) != null && r.forceClientPagination)
52
53
  return "client";
53
- const i = ht(e.config);
54
- return e.sql && !i ? (o = (a = e.preferences) == null ? void 0 : a.tablePrefs) != null && o.enableDevModePagination ? "server" : "client" : i && ri(e) ? "server" : "client";
54
+ const i = Ft(e.config);
55
+ return e.sql && !i ? (o = (a = e.preferences) == null ? void 0 : a.tablePrefs) != null && o.enableDevModePagination ? "server" : "client" : i && li(e) ? "server" : "client";
55
56
  }
56
- const Ot = Object.freeze({}), ka = {
57
+ const _t = Object.freeze({}), Ja = {
57
58
  access: "session-only",
58
59
  printMode: !1,
59
60
  baseline: null,
60
61
  applied: null,
61
62
  appliedBookmark: null,
62
- tableSettings: Ot,
63
+ tableSettings: _t,
63
64
  notices: []
64
65
  };
65
- function La(e) {
66
+ function Xa(e) {
66
67
  return !e.viewer.printMode && e.viewer.access !== "session-only" && !!e.viewer.baseline && !!e.viewerStateClient && !e.isDashboardEditing;
67
68
  }
68
- function En(e) {
69
- return e.isDashboardEditing ? Ot : e.viewer.tableSettings;
69
+ function Bn(e) {
70
+ return e.isDashboardEditing ? _t : e.viewer.tableSettings;
70
71
  }
71
- function Vn(e, t) {
72
- return En(e)[t];
72
+ function Kn(e, t) {
73
+ return Bn(e)[t];
73
74
  }
74
- function qa(e, t, i) {
75
- if (!(i.isEditorPreview || e.isDashboardEditing) && zi(e.dashboard, t))
76
- return { settings: Vn(e, t) };
75
+ function Za(e, t, i) {
76
+ if (!(i.isEditorPreview || e.isDashboardEditing) && Hi(e.dashboard, t))
77
+ return { settings: Kn(e, t) };
77
78
  }
78
- function _n(e) {
79
+ function Ln(e) {
79
80
  var t;
80
- return ai({
81
+ return ci({
81
82
  card: e.card,
82
- paginationMode: Nn(e.card) === "server" ? "server" : "client",
83
+ paginationMode: kn(e.card) === "server" ? "server" : "client",
83
84
  result: {
84
- keys: e.keys ?? oi(e.records),
85
+ keys: e.keys ?? ui(e.records),
85
86
  rows: e.records,
86
87
  columns: e.resultColumns,
87
88
  columnKeyMap: e.columnKeyMap,
@@ -91,11 +92,11 @@ function _n(e) {
91
92
  projection: "export"
92
93
  });
93
94
  }
94
- const za = (e) => {
95
+ const eo = (e) => {
95
96
  e = e.replace("#", "");
96
97
  const t = Number.parseInt(e.substr(0, 2), 16), i = Number.parseInt(e.substr(2, 2), 16), n = Number.parseInt(e.substr(4, 2), 16);
97
98
  return (0.299 * t + 0.587 * i + 0.114 * n) / 255 > 0.5 ? "#000000" : "#ffffff";
98
- }, Rn = () => ({
99
+ }, qn = () => ({
99
100
  urlTemplate: "{value}",
100
101
  // Default: use cell value as-is
101
102
  labelType: "value",
@@ -104,7 +105,7 @@ const za = (e) => {
104
105
  labelColumn: "",
105
106
  openInNewTab: !0
106
107
  // Default: open in new tab (current behavior)
107
- }), Ne = () => ({
108
+ }), Ee = () => ({
108
109
  type: "none",
109
110
  inheritMetricFormat: !0,
110
111
  textAlign: "left",
@@ -139,13 +140,13 @@ const za = (e) => {
139
140
  sourceTimezone: "auto"
140
141
  // Default to auto (use explicit timezone if present, otherwise assume UTC)
141
142
  },
142
- linkFormat: Rn(),
143
+ linkFormat: qn(),
143
144
  colorRanges: []
144
145
  });
145
- function $a(e, t, i, n) {
146
+ function to(e, t, i, n) {
146
147
  return t && t !== "auto" ? t : i;
147
148
  }
148
- const ja = (e) => !e || e === "auto" ? "local time" : {
149
+ const io = (e) => !e || e === "auto" ? "local time" : {
149
150
  "America/New_York": "Eastern Time",
150
151
  "America/Chicago": "Central Time",
151
152
  "America/Denver": "Mountain Time",
@@ -156,11 +157,11 @@ const ja = (e) => !e || e === "auto" ? "local time" : {
156
157
  "Asia/Shanghai": "China Time",
157
158
  UTC: "UTC"
158
159
  }[e] || e;
159
- function Bn(e) {
160
+ function $n(e) {
160
161
  const t = H(e == null ? void 0 : e.format);
161
- return !!(t && bt(t));
162
+ return !!(t && vt(t));
162
163
  }
163
- function xe(e, t) {
164
+ function Me(e, t) {
164
165
  var o, s;
165
166
  if (!(e != null && e.config) || e.type === "matrixTable" || (o = e.sql) != null && o.trim() || (s = e.python) != null && s.trim())
166
167
  return;
@@ -202,7 +203,7 @@ function xe(e, t) {
202
203
  return {
203
204
  ...f,
204
205
  bindings: [
205
- Fn(
206
+ Mn(
206
207
  t.columnKeyMap,
207
208
  f.field.id,
208
209
  f.role
@@ -240,11 +241,11 @@ function xe(e, t) {
240
241
  )
241
242
  );
242
243
  }
243
- function Kn(e, t, i) {
244
- return xe(e, {
244
+ function zn(e, t, i) {
245
+ return Me(e, {
245
246
  fieldId: t.id,
246
247
  fieldRole: "groupby"
247
- }) ?? xe(
248
+ }) ?? Me(
248
249
  e,
249
250
  i ? {
250
251
  columnIds: [t.alias, t.name, t.id].filter(
@@ -255,9 +256,9 @@ function Kn(e, t, i) {
255
256
  } : { fieldId: t.id, fieldRole: "groupby" }
256
257
  );
257
258
  }
258
- function Ua(e, t, i) {
259
+ function no(e, t, i) {
259
260
  return e.map((n) => {
260
- const r = Kn(
261
+ const r = zn(
261
262
  t,
262
263
  n,
263
264
  i
@@ -271,15 +272,15 @@ function Ua(e, t, i) {
271
272
  };
272
273
  });
273
274
  }
274
- function At(e, t) {
275
+ function Et(e, t) {
275
276
  const i = typeof e.decimalPlaces == "number", n = typeof e.minimumFractionDigits == "number" ? e.minimumFractionDigits : i ? e.decimalPlaces : t.min, r = typeof e.maximumFractionDigits == "number" ? e.maximumFractionDigits : i ? e.decimalPlaces : t.max;
276
277
  return {
277
278
  minimumFractionDigits: n,
278
279
  maximumFractionDigits: Math.max(n, r)
279
280
  };
280
281
  }
281
- function ce(e, t) {
282
- const i = At(e, t), n = typeof e.suffix == "string" && e.suffix.length > 0;
282
+ function de(e, t) {
283
+ const i = Et(e, t), n = typeof e.suffix == "string" && e.suffix.length > 0;
283
284
  return {
284
285
  style: "decimal",
285
286
  locale: e.locale,
@@ -296,42 +297,42 @@ function ce(e, t) {
296
297
  percentValueMode: e.percentValueMode
297
298
  };
298
299
  }
299
- function Nt(e, t = "auto", i = {}) {
300
- switch (t === "auto" && (t = $n(e, i)), t) {
300
+ function Rt(e, t = "auto", i = {}) {
301
+ switch (t === "auto" && (t = Wn(e, i)), t) {
301
302
  case "number":
302
- return Et(e, i);
303
- case "currency":
304
303
  return Vt(e, i);
304
+ case "currency":
305
+ return kt(e, i);
305
306
  case "percent":
306
- return kn(e, i);
307
+ return jn(e, i);
307
308
  case "date":
308
- return Ln(e, i);
309
+ return Un(e, i);
309
310
  case "scientific":
310
- return qn(e, i);
311
+ return Gn(e, i);
311
312
  case "duration":
312
- return zn(e, i);
313
+ return Hn(e, i);
313
314
  default:
314
315
  return String(e);
315
316
  }
316
317
  }
317
- function Et(e, t = {}) {
318
- return e < 0 && !!t.prefix && !t.negativeInParentheses ? `-${Ce(
318
+ function Vt(e, t = {}) {
319
+ return e < 0 && !!t.prefix && !t.negativeInParentheses ? `-${xe(
319
320
  Math.abs(e),
320
- ce(t, {
321
+ de(t, {
321
322
  min: 0,
322
323
  max: 0
323
324
  })
324
- )}` : Ce(
325
+ )}` : xe(
325
326
  e,
326
- ce(t, {
327
+ de(t, {
327
328
  min: 0,
328
329
  max: 0
329
330
  })
330
331
  );
331
332
  }
332
- function Vt(e, t = {}) {
333
- return Bi(e, {
334
- ...ce(t, {
333
+ function kt(e, t = {}) {
334
+ return $i(e, {
335
+ ...de(t, {
335
336
  min: 2,
336
337
  max: 2
337
338
  }),
@@ -339,9 +340,9 @@ function Vt(e, t = {}) {
339
340
  currency: t.currency || "USD"
340
341
  });
341
342
  }
342
- function kn(e, t = {}) {
343
- const i = At(t, { min: 1, max: 1 }), r = typeof t.multiplyBy == "number" && Number.isFinite(t.multiplyBy) ? t.multiplyBy : t.percentValueMode === "whole" ? 1 : 100, a = e * r;
344
- return Ce(a, {
343
+ function jn(e, t = {}) {
344
+ const i = Et(t, { min: 1, max: 1 }), r = typeof t.multiplyBy == "number" && Number.isFinite(t.multiplyBy) ? t.multiplyBy : t.percentValueMode === "whole" ? 1 : 100, a = e * r;
345
+ return xe(a, {
345
346
  locale: t.locale,
346
347
  minimumFractionDigits: i.minimumFractionDigits,
347
348
  maximumFractionDigits: i.maximumFractionDigits,
@@ -352,7 +353,7 @@ function kn(e, t = {}) {
352
353
  useSuffix: !1
353
354
  });
354
355
  }
355
- function Ln(e, t = {}) {
356
+ function Un(e, t = {}) {
356
357
  const { locale: i = "en-US" } = t;
357
358
  try {
358
359
  const n = new Date(e);
@@ -363,14 +364,14 @@ function Ln(e, t = {}) {
363
364
  return String(e);
364
365
  }
365
366
  }
366
- function qn(e, t = {}) {
367
- return Ri(
367
+ function Gn(e, t = {}) {
368
+ return qi(
368
369
  e,
369
- ce(t, { min: 2, max: 2 })
370
+ de(t, { min: 2, max: 2 })
370
371
  );
371
372
  }
372
- function zn(e, t = {}) {
373
- return _i(e, {
373
+ function Hn(e, t = {}) {
374
+ return Li(e, {
374
375
  inputUnit: t.durationInputUnit,
375
376
  outputStyle: t.durationDisplayStyle,
376
377
  largestUnit: t.durationLargestUnit,
@@ -381,13 +382,13 @@ function zn(e, t = {}) {
381
382
  negativeInParentheses: t.negativeInParentheses
382
383
  });
383
384
  }
384
- function $n(e, t) {
385
+ function Wn(e, t) {
385
386
  return t.currency ? "currency" : typeof e == "string" && !isNaN(Date.parse(e)) ? "date" : "number";
386
387
  }
387
- function Ha(e, t = {}) {
388
- return (i) => Nt(i, e, t);
388
+ function ro(e, t = {}) {
389
+ return (i) => Rt(i, e, t);
389
390
  }
390
- function jn({
391
+ function Qn({
391
392
  number: e,
392
393
  decimalPlaces: t = 0,
393
394
  useSuffix: i = !1,
@@ -396,7 +397,7 @@ function jn({
396
397
  locale: a = "en-US"
397
398
  }) {
398
399
  if (r) {
399
- const o = Vt(e, {
400
+ const o = kt(e, {
400
401
  currency: r,
401
402
  decimalPlaces: t,
402
403
  locale: a,
@@ -404,14 +405,14 @@ function jn({
404
405
  });
405
406
  return i && n ? `${o}${n}` : o;
406
407
  }
407
- return Et(e, {
408
+ return Vt(e, {
408
409
  decimalPlaces: t,
409
410
  useSuffix: i && !n,
410
411
  suffix: n,
411
412
  locale: a
412
413
  });
413
414
  }
414
- var Un = function e(t, i) {
415
+ var Yn = function e(t, i) {
415
416
  if (t === i) return !0;
416
417
  if (t && i && typeof t == "object" && typeof i == "object") {
417
418
  if (t.constructor !== i.constructor) return !1;
@@ -437,8 +438,8 @@ var Un = function e(t, i) {
437
438
  }
438
439
  return t !== t && i !== i;
439
440
  };
440
- const ue = /* @__PURE__ */ Cn(Un);
441
- function Hn(e) {
441
+ const fe = /* @__PURE__ */ Dn(Yn);
442
+ function Jn(e) {
442
443
  if (typeof e == "number")
443
444
  return Number.isFinite(e);
444
445
  if (typeof e != "string")
@@ -446,7 +447,7 @@ function Hn(e) {
446
447
  const t = e.trim().replace(/,/g, "");
447
448
  return t !== "" && Number.isFinite(Number(t));
448
449
  }
449
- function Gn(e) {
450
+ function Xn(e) {
450
451
  if (!(e != null && e.length))
451
452
  return [];
452
453
  const t = /* @__PURE__ */ new Set();
@@ -454,33 +455,33 @@ function Gn(e) {
454
455
  Object.keys(i).forEach((n) => t.add(n));
455
456
  }), [...t];
456
457
  }
457
- function Wn(e) {
458
- return Gn(e).filter(
459
- (i) => e == null ? void 0 : e.some((n) => Hn(n[i]))
458
+ function Zn(e) {
459
+ return Xn(e).filter(
460
+ (i) => e == null ? void 0 : e.some((n) => Jn(n[i]))
460
461
  );
461
462
  }
462
- function Ee(e, t) {
463
+ function Re(e, t) {
463
464
  var i;
464
465
  if (t.id)
465
466
  return (i = e.sql) != null && i.trim() ? { kind: "column", columnKey: t.id } : { kind: "metric", metricId: t.id };
466
467
  }
467
- function _t(e) {
468
+ function Bt(e) {
468
469
  const t = e.context.preferences;
469
470
  if (!t)
470
471
  return e.authoredFormat;
471
- const i = Ee(e.card, e.metric);
472
- return E(
472
+ const i = Re(e.card, e.metric);
473
+ return _(
473
474
  e.authoredFormat,
474
475
  t,
475
476
  i ? e.context.resolveBoundCurrency(i) : void 0
476
477
  );
477
478
  }
478
- function Qn(e) {
479
+ function er(e) {
479
480
  var a, o, s;
480
- const t = (s = (o = (a = e.card.preferences) == null ? void 0 : a.tablePrefs) == null ? void 0 : o.columnSettingsMap) == null ? void 0 : s[e.columnKey], i = (t == null ? void 0 : t.type) === "number" ? si(
481
+ const t = (s = (o = (a = e.card.preferences) == null ? void 0 : a.tablePrefs) == null ? void 0 : o.columnSettingsMap) == null ? void 0 : s[e.columnKey], i = (t == null ? void 0 : t.type) === "number" ? di(
481
482
  { dataType: "number", format: void 0 },
482
483
  t
483
- ) : void 0, n = i == null ? void 0 : i.authoredFormat, r = B(n) ? _t({
484
+ ) : void 0, n = i == null ? void 0 : i.authoredFormat, r = k(n) ? Bt({
484
485
  card: e.card,
485
486
  metric: {
486
487
  id: e.columnKey
@@ -498,10 +499,10 @@ function Qn(e) {
498
499
  format: r
499
500
  };
500
501
  }
501
- function Ga(e) {
502
+ function ao(e) {
502
503
  var r, a;
503
504
  const t = new Set(
504
- Wn(e.records)
505
+ Zn(e.records)
505
506
  ), i = new Set(
506
507
  e.renderedMetricKeys || e.resultKeys
507
508
  ), n = ((a = (r = e.card.preferences) == null ? void 0 : r.tablePrefs) == null ? void 0 : a.columnSettingsMap) || {};
@@ -512,29 +513,29 @@ function Ga(e) {
512
513
  }
513
514
  );
514
515
  }
515
- function Wa(e) {
516
+ function oo(e) {
516
517
  var a, o;
517
518
  const { card: t, context: i } = e;
518
- if (!(i != null && i.preferences) || !vt(t.type))
519
+ if (!(i != null && i.preferences) || !Ct(t.type))
519
520
  return t;
520
521
  const n = i.preferences, r = (a = t.sql) != null && a.trim() ? e.resultMetricKeys.map(
521
- (s) => Qn({
522
+ (s) => er({
522
523
  card: t,
523
524
  columnKey: s,
524
525
  context: i
525
526
  })
526
527
  ) : (((o = t.config) == null ? void 0 : o.metricColumns) || []).map((s) => {
527
- const l = dt(t, s), c = l.authoredFormat;
528
- if (!B(c))
528
+ const l = mt(t, s), c = l.authoredFormat;
529
+ if (!k(c))
529
530
  return s;
530
- const u = Ee(t, s), f = u ? i.resolveBoundCurrency(u) : void 0;
531
+ const u = Re(t, s), f = u ? i.resolveBoundCurrency(u) : void 0;
531
532
  return l.source === "inferred" && !f ? s : {
532
533
  ...s,
533
- format: l.source === "inferred" ? E(
534
+ format: l.source === "inferred" ? _(
534
535
  c,
535
536
  n,
536
537
  f
537
- ) : _t({
538
+ ) : Bt({
538
539
  card: t,
539
540
  metric: s,
540
541
  context: i,
@@ -550,19 +551,19 @@ function Wa(e) {
550
551
  }
551
552
  };
552
553
  }
553
- function me(e) {
554
+ function ye(e) {
554
555
  var l;
555
556
  const { card: t, context: i, formatOptions: n } = e, r = i == null ? void 0 : i.preferences;
556
- if (!t || !r || !vt(t.type))
557
+ if (!t || !r || !Ct(t.type))
557
558
  return n;
558
559
  if (!n) {
559
560
  const c = e.metrics.filter(
560
561
  (f) => !!f
561
562
  ), u = c.some(
562
- (f) => B(f.format)
563
+ (f) => k(f.format)
563
564
  );
564
- return c.length < 2 || !u ? n : k(
565
- E({ type: "number" }, r),
565
+ return c.length < 2 || !u ? n : K(
566
+ _({ type: "number" }, r),
566
567
  { preserveOmittedProperties: !0 }
567
568
  );
568
569
  }
@@ -570,27 +571,27 @@ function me(e) {
570
571
  const c = e.metrics.filter(
571
572
  (f) => !!f
572
573
  ), u = c.filter(
573
- (f) => B(f.format)
574
+ (f) => k(f.format)
574
575
  );
575
576
  if (u.length === 0)
576
577
  return n;
577
578
  if (u.length !== c.length)
578
- return k(
579
- E({ type: "number" }, r),
579
+ return K(
580
+ _({ type: "number" }, r),
580
581
  { preserveOmittedProperties: !0 }
581
582
  );
582
583
  }
583
- const a = ft(n, {
584
+ const a = pt(n, {
584
585
  preserveOmittedProperties: !0
585
586
  });
586
- if (!B(a))
587
+ if (!k(a))
587
588
  return n;
588
589
  const o = e.metrics.flatMap((c) => {
589
590
  if (!c)
590
591
  return [];
591
- const u = Ee(t, c);
592
+ const u = Re(t, c);
592
593
  return [
593
- E(
594
+ _(
594
595
  a,
595
596
  r,
596
597
  u ? i.resolveBoundCurrency(u) : void 0
@@ -598,13 +599,13 @@ function me(e) {
598
599
  ];
599
600
  });
600
601
  if (o.length === 0)
601
- return k(
602
- E(a, r),
602
+ return K(
603
+ _(a, r),
603
604
  { preserveOmittedProperties: !0 }
604
605
  );
605
606
  const [s] = o;
606
- if (o.some((c) => !ue(c, s))) {
607
- const c = E(
607
+ if (o.some((c) => !fe(c, s))) {
608
+ const c = _(
608
609
  {
609
610
  ...a,
610
611
  type: "number",
@@ -612,92 +613,92 @@ function me(e) {
612
613
  },
613
614
  r
614
615
  );
615
- return k(c, {
616
+ return K(c, {
616
617
  preserveOmittedProperties: !0
617
618
  });
618
619
  }
619
- return k(s, {
620
+ return K(s, {
620
621
  preserveOmittedProperties: !0
621
622
  });
622
623
  }
623
- const Jn = /* @__PURE__ */ new Set([
624
+ const tr = /* @__PURE__ */ new Set([
624
625
  "horizontalBar",
625
626
  "tornado",
626
627
  "pyramid",
627
628
  "range"
628
- ]), Yn = /* @__PURE__ */ new Set([
629
+ ]), ir = /* @__PURE__ */ new Set([
629
630
  "tornado",
630
631
  "pyramid",
631
632
  "range"
632
- ]), Xn = /* @__PURE__ */ new Set([
633
+ ]), nr = /* @__PURE__ */ new Set([
633
634
  "tornado",
634
635
  "pyramid",
635
636
  "range"
636
637
  ]);
637
- function Zn(e) {
638
+ function rr(e) {
638
639
  const { chartType: t, resultKeys: i, config: n } = e, r = 1 + (n != null && n.enableGrouping && (n.groupKey || i[1]) ? 1 : 0), a = i.slice(r), o = (n == null ? void 0 : n.xMetricKey) ?? a[0], s = (n == null ? void 0 : n.yMetricKey) ?? a[1] ?? a[0], l = t === "bubble" ? (n == null ? void 0 : n.radiusMetricKey) ?? a[2] ?? a[1] ?? a[0] : void 0, c = new Set(i);
639
640
  return [o, s, l].filter((u) => !!u).filter((u) => c.has(u));
640
641
  }
641
- function Qa(e) {
642
+ function so(e) {
642
643
  const { chartType: t, resultKeys: i, preferences: n } = e;
643
644
  return t === "scatter" || t === "bubble" ? [
644
645
  ...new Set(
645
- Zn({
646
+ rr({
646
647
  chartType: t,
647
648
  resultKeys: i,
648
649
  config: n == null ? void 0 : n.bubbleScatterConfig
649
650
  })
650
651
  )
651
- ] : Xn.has(t || "") ? i.slice(2) : i.length === 1 ? [i[0]] : i.slice(1);
652
+ ] : nr.has(t || "") ? i.slice(2) : i.length === 1 ? [i[0]] : i.slice(1);
652
653
  }
653
- function re(e, t) {
654
+ function ae(e, t) {
654
655
  var i;
655
- return ((i = t == null ? void 0 : t.chartOptions) == null ? void 0 : i.indexAxis) === "y" || Jn.has(e || "") ? "x" : "y";
656
+ return ((i = t == null ? void 0 : t.chartOptions) == null ? void 0 : i.indexAxis) === "y" || tr.has(e || "") ? "x" : "y";
656
657
  }
657
- function Ja(e, t) {
658
- return re(e, t) === "x";
658
+ function lo(e, t) {
659
+ return ae(e, t) === "x";
659
660
  }
660
- function er(e, t) {
661
- return re(e, t) === "y" ? t == null ? void 0 : t.yAxisConfig : (t == null ? void 0 : t.xAxisConfig) || (Yn.has(e || "") ? t == null ? void 0 : t.yAxisConfig : void 0);
661
+ function ar(e, t) {
662
+ return ae(e, t) === "y" ? t == null ? void 0 : t.yAxisConfig : (t == null ? void 0 : t.xAxisConfig) || (ir.has(e || "") ? t == null ? void 0 : t.yAxisConfig : void 0);
662
663
  }
663
- function te(e) {
664
+ function ie(e) {
664
665
  return e ? Object.entries(e).some(([t, i]) => i == null || i === "" ? !1 : t === "type" ? i !== "auto" : !0) : !1;
665
666
  }
666
- function Rt(e) {
667
+ function Kt(e) {
667
668
  if (e)
668
669
  return e.alias || e.label || e.name;
669
670
  }
670
- function Se(e, t) {
671
+ function De(e, t) {
671
672
  var n;
672
673
  return (((n = e == null ? void 0 : e.config) == null ? void 0 : n.metricColumns) || []).find((r) => {
673
- const a = Rt(r);
674
+ const a = Kt(r);
674
675
  return t.metricId && r.id === t.metricId || t.metricAlias && a === t.metricAlias || t.metricAlias && r.alias === t.metricAlias || t.columnId && a === t.columnId || t.columnId && r.alias === t.columnId || t.columnId && r.label === t.columnId || t.columnId && r.name === t.columnId;
675
676
  });
676
677
  }
677
- function ae(e, t) {
678
+ function oe(e, t) {
678
679
  var n, r;
679
- const i = xe(e, t);
680
- if (!(i && ((r = (n = e == null ? void 0 : e.config) == null ? void 0 : n.groupByColumns) != null && r.includes(i)) && !Bn(i)))
680
+ const i = Me(e, t);
681
+ if (!(i && ((r = (n = e == null ? void 0 : e.config) == null ? void 0 : n.groupByColumns) != null && r.includes(i)) && !$n(i)))
681
682
  return i;
682
683
  }
683
- function tr(e) {
684
- return !!e && !(e != null && e.format) && yt(e == null ? void 0 : e.dataType) === "number";
684
+ function or(e) {
685
+ return !!e && !(e != null && e.format) && gt(e == null ? void 0 : e.dataType) === "number";
685
686
  }
686
- const ir = {
687
+ const sr = {
687
688
  style: "decimal",
688
689
  showDataBar: !1,
689
690
  dataBarColor: "#3b82f6"
690
691
  };
691
- function Bt(e) {
692
+ function Lt(e) {
692
693
  if (!e)
693
694
  return;
694
- const t = Ne();
695
+ const t = Ee();
695
696
  return {
696
697
  ...t,
697
698
  ...e,
698
699
  inheritMetricFormat: e.numberFormat ? e.inheritMetricFormat : e.inheritMetricFormat ?? t.inheritMetricFormat,
699
700
  numberFormat: {
700
- ...ir,
701
+ ...sr,
701
702
  ...e.numberFormat
702
703
  },
703
704
  dateFormat: {
@@ -710,21 +711,21 @@ function Bt(e) {
710
711
  }
711
712
  };
712
713
  }
713
- function Ya(e) {
714
+ function co(e) {
714
715
  return Object.fromEntries(
715
716
  Object.entries(e || {}).map(([t, i]) => [
716
717
  t,
717
- Bt(i)
718
+ Lt(i)
718
719
  ])
719
720
  );
720
721
  }
721
- function se(e) {
722
+ function le(e) {
722
723
  return !!(e && typeof e == "object" && !Array.isArray(e) && Object.getPrototypeOf(e) === Object.prototype);
723
724
  }
724
- function Kt(e, t, i) {
725
- if (!se(i))
725
+ function qt(e, t, i) {
726
+ if (!le(i))
726
727
  return i;
727
- const n = se(e) ? e : {}, r = se(t) ? t : {}, a = {};
728
+ const n = le(e) ? e : {}, r = le(t) ? t : {}, a = {};
728
729
  for (const o of Object.keys(i)) {
729
730
  const s = i[o];
730
731
  if (s === void 0)
@@ -733,23 +734,23 @@ function Kt(e, t, i) {
733
734
  n,
734
735
  o
735
736
  ), c = r[o];
736
- if (l && ue(s, c)) {
737
+ if (l && fe(s, c)) {
737
738
  a[o] = n[o];
738
739
  continue;
739
740
  }
740
- if (!l && ue(s, c))
741
+ if (!l && fe(s, c))
741
742
  continue;
742
- const u = Kt(
743
+ const u = qt(
743
744
  n[o],
744
745
  c,
745
746
  s
746
747
  );
747
- se(u) && Object.keys(u).length === 0 && !l || (a[o] = u);
748
+ le(u) && Object.keys(u).length === 0 && !l || (a[o] = u);
748
749
  }
749
750
  return a;
750
751
  }
751
- function nr(e) {
752
- let t = Kt(
752
+ function lr(e) {
753
+ let t = qt(
753
754
  e.persisted,
754
755
  e.baseline,
755
756
  e.next
@@ -757,11 +758,11 @@ function nr(e) {
757
758
  if (e.enforceDeclaredSqlTemporalFormat && e.next.type === "date" && !e.next.dateFormat.useRelativeTime && e.next.dateFormat.useCustomFormat) {
758
759
  const i = e.next.dateFormat.customFormat;
759
760
  if (!(i != null && i.trim()))
760
- throw new Ki(
761
+ throw new zi(
761
762
  "invalid_raw_temporal_format",
762
763
  "Custom table date formatting requires a non-empty pattern."
763
764
  );
764
- ki({
765
+ ji({
765
766
  dialect: "date_fns",
766
767
  pattern: i,
767
768
  valueKind: e.rawTemporalValueKind
@@ -774,7 +775,7 @@ function nr(e) {
774
775
  }
775
776
  };
776
777
  }
777
- return e.next.type === "number" && !ue(e.next.numberFormat, e.baseline.numberFormat) && t.numberFormat ? {
778
+ return e.next.type === "number" && !fe(e.next.numberFormat, e.baseline.numberFormat) && t.numberFormat ? {
778
779
  ...t,
779
780
  type: "number",
780
781
  inheritMetricFormat: e.next.inheritMetricFormat ?? !1
@@ -787,10 +788,10 @@ function nr(e) {
787
788
  type: "date"
788
789
  } : t;
789
790
  }
790
- function Xa(e) {
791
- return e.reset ? rr(e.persisted, e.columnId) : {
791
+ function uo(e) {
792
+ return e.reset ? cr(e.persisted, e.columnId) : {
792
793
  ...e.persisted,
793
- [e.columnId]: nr({
794
+ [e.columnId]: lr({
794
795
  persisted: e.persisted[e.columnId],
795
796
  baseline: e.baseline,
796
797
  next: e.next,
@@ -800,14 +801,14 @@ function Xa(e) {
800
801
  })
801
802
  };
802
803
  }
803
- function rr(e, t) {
804
+ function cr(e, t) {
804
805
  if (!(t in e))
805
806
  return e;
806
807
  const i = { ...e };
807
808
  return delete i[t], i;
808
809
  }
809
- function ar(e, t) {
810
- const i = e || Ne(), n = !t;
810
+ function ur(e, t) {
811
+ const i = e || Ee(), n = !t;
811
812
  return {
812
813
  ...i,
813
814
  type: "number",
@@ -825,26 +826,26 @@ function ar(e, t) {
825
826
  }
826
827
  };
827
828
  }
828
- function ve(e) {
829
+ function Ce(e) {
829
830
  if (e)
830
831
  return e.trim().toLowerCase();
831
832
  }
832
- const kt = /\s*(?:\((?:previous|last year|start|target|comparison)\)|δ)\s*$/i;
833
- function or(e) {
833
+ const $t = /\s*(?:\((?:previous|last year|start|target|comparison)\)|δ)\s*$/i;
834
+ function dr(e) {
834
835
  const t = e == null ? void 0 : e.trim();
835
- return t ? t.replace(kt, "").trim() || t : void 0;
836
+ return t ? t.replace($t, "").trim() || t : void 0;
836
837
  }
837
- function sr(e) {
838
+ function fr(e) {
838
839
  const t = e == null ? void 0 : e.trim();
839
- return t ? kt.test(t) : !1;
840
+ return t ? $t.test(t) : !1;
840
841
  }
841
- function lr(e, t) {
842
+ function mr(e, t) {
842
843
  return t.metricAlias ? e.find(
843
- (i) => Ni(i) === t.metricAlias
844
+ (i) => ki(i) === t.metricAlias
844
845
  ) : t.metricId ? e.find((i) => i.id === t.metricId) : void 0;
845
846
  }
846
- function cr(e) {
847
- var h;
847
+ function pr(e) {
848
+ var b;
848
849
  const {
849
850
  card: t,
850
851
  metricId: i,
@@ -852,101 +853,101 @@ function cr(e) {
852
853
  datasetIndex: r,
853
854
  datasetLabel: a,
854
855
  metricKey: o
855
- } = e, s = ((h = t == null ? void 0 : t.config) == null ? void 0 : h.metricColumns) || [];
856
+ } = e, s = ((b = t == null ? void 0 : t.config) == null ? void 0 : b.metricColumns) || [];
856
857
  if (n || i)
857
- return lr(s, {
858
+ return mr(s, {
858
859
  metricAlias: n,
859
860
  metricId: i
860
861
  });
861
862
  const l = [o, a], c = l.some(
862
- (m) => sr(m)
863
+ (m) => fr(m)
863
864
  ), u = l.filter(
864
865
  (m) => !!m
865
866
  );
866
867
  for (const m of u) {
867
- const g = Se(t, {
868
+ const h = De(t, {
868
869
  columnId: m,
869
870
  metricAlias: m
870
871
  });
871
- if (g)
872
- return g;
872
+ if (h)
873
+ return h;
873
874
  }
874
- const f = u.map((m) => ve(m)).filter((m) => !!m), d = u.map((m) => or(m)).filter((m) => !!m);
875
+ const f = u.map((m) => Ce(m)).filter((m) => !!m), d = u.map((m) => dr(m)).filter((m) => !!m);
875
876
  for (const m of d) {
876
- const g = Se(t, {
877
+ const h = De(t, {
877
878
  columnId: m,
878
879
  metricAlias: m
879
880
  });
880
- if (g)
881
- return g;
881
+ if (h)
882
+ return h;
882
883
  }
883
884
  if (s.length === 1)
884
885
  return s[0];
885
886
  if (!c && typeof r == "number" && r >= 0 && r < s.length)
886
887
  return s[r];
887
- const y = d.map((m) => ve(m)).filter((m) => !!m), v = [
888
+ const y = d.map((m) => Ce(m)).filter((m) => !!m), v = [
888
889
  ...f,
889
890
  ...y
890
891
  ];
891
892
  if (v.length !== 0)
892
893
  return s.find((m) => {
893
- const g = [
894
+ const h = [
894
895
  m.alias,
895
896
  m.label,
896
897
  m.name,
897
- Rt(m)
898
- ].map((C) => ve(C)).filter((C) => !!C);
898
+ Kt(m)
899
+ ].map((C) => Ce(C)).filter((C) => !!C);
899
900
  return v.some(
900
- (C) => g.includes(C)
901
+ (C) => h.includes(C)
901
902
  );
902
903
  });
903
904
  }
904
- function ur(e) {
905
+ function yr(e) {
905
906
  const t = H(e == null ? void 0 : e.format);
906
- return k(t);
907
+ return K(t);
907
908
  }
908
- function it(e, t) {
909
+ function rt(e, t) {
909
910
  if (t)
910
- return Se(e, {
911
+ return De(e, {
911
912
  columnId: t,
912
913
  metricAlias: t
913
914
  });
914
915
  }
915
- function nt(e) {
916
- const t = ft(e);
916
+ function at(e) {
917
+ const t = pt(e);
917
918
  if (t)
918
919
  return JSON.stringify(t);
919
920
  }
920
- function dr(e, t) {
921
- const i = nt(e), n = nt(t);
921
+ function hr(e, t) {
922
+ const i = at(e), n = at(t);
922
923
  return !!(i && n && i === n);
923
924
  }
924
- function fr(e) {
925
+ function gr(e) {
925
926
  if (e.length === 0)
926
927
  return;
927
928
  const t = e.map(
928
- (o) => ur(o)
929
+ (o) => yr(o)
929
930
  );
930
931
  if (!t.every(
931
- (o) => te(o)
932
+ (o) => ie(o)
932
933
  ))
933
934
  return;
934
935
  const n = t, [r] = n;
935
936
  return n.every(
936
- (o) => dr(r, o)
937
+ (o) => hr(r, o)
937
938
  ) ? r : void 0;
938
939
  }
939
- function mr(e) {
940
+ function br(e) {
940
941
  const t = e.formatMode || e.legacyMode;
941
- return t === "override" ? "override" : t === "inherit" ? "inherit" : e.legacyMode && e.legacyMode !== "auto" && e.legacyMode !== "inherit" && e.legacyMode !== "override" || te(e.formatOptions) ? "override" : "inherit";
942
+ return t === "override" ? "override" : t === "inherit" ? "inherit" : e.legacyMode && e.legacyMode !== "auto" && e.legacyMode !== "inherit" && e.legacyMode !== "override" || ie(e.formatOptions) ? "override" : "inherit";
942
943
  }
943
- function pe(e) {
944
- const t = mr({
944
+ function he(e) {
945
+ const t = br({
945
946
  formatMode: e.formatMode,
946
947
  legacyMode: e.legacyMode,
947
948
  formatOptions: e.overrideFormatOptions
948
949
  });
949
- if (t === "override" && te(e.overrideFormatOptions))
950
+ if (t === "override" && ie(e.overrideFormatOptions))
950
951
  return {
951
952
  formatOptions: e.overrideFormatOptions || void 0,
952
953
  source: "override"
@@ -957,16 +958,16 @@ function pe(e) {
957
958
  source: "override",
958
959
  rawValue: !0
959
960
  };
960
- const i = fr(
961
+ const i = gr(
961
962
  e.metrics || []
962
963
  );
963
- if (te(i))
964
+ if (ie(i))
964
965
  return {
965
966
  formatOptions: i,
966
967
  source: "metric"
967
968
  };
968
- const n = Fr(e.preferences);
969
- return te(n) ? {
969
+ const n = Mr(e.preferences);
970
+ return ie(n) ? {
970
971
  formatOptions: n,
971
972
  source: "legacy"
972
973
  } : {
@@ -974,38 +975,38 @@ function pe(e) {
974
975
  source: "auto"
975
976
  };
976
977
  }
977
- function Lt(e) {
978
+ function zt(e) {
978
979
  var l, c, u;
979
980
  const { card: t, chartType: i, axis: n, preferences: r } = e, a = ((l = t == null ? void 0 : t.config) == null ? void 0 : l.metricColumns) || [], o = (r == null ? void 0 : r.datasetOptions) || [];
980
981
  if (!a.length)
981
982
  return [];
982
983
  if (i === "combo")
983
984
  return n === "x" ? [] : a.filter((f, d) => {
984
- const y = o.find((h) => h.idx === d);
985
+ const y = o.find((b) => b.idx === d);
985
986
  return ((y == null ? void 0 : y.yAxisId) === "y2" ? "y2" : "y") === n;
986
987
  });
987
988
  if (i === "bubble" || i === "scatter") {
988
989
  if (n === "y2")
989
990
  return [];
990
- const f = it(
991
+ const f = rt(
991
992
  t,
992
993
  (c = r == null ? void 0 : r.bubbleScatterConfig) == null ? void 0 : c.xMetricKey
993
- ) || a[0], d = it(
994
+ ) || a[0], d = rt(
994
995
  t,
995
996
  (u = r == null ? void 0 : r.bubbleScatterConfig) == null ? void 0 : u.yMetricKey
996
997
  ) || a[1] || a[0];
997
998
  return n === "x" ? f ? [f] : [] : d ? [d] : [];
998
999
  }
999
- const s = re(i, r);
1000
+ const s = ae(i, r);
1000
1001
  return i === "radar" ? n === "y" ? a : [] : n !== s ? [] : a;
1001
1002
  }
1002
1003
  function Ve(e) {
1003
- const { card: t, chartType: i, axis: n, preferences: r, axisConfig: a } = e, o = Lt({
1004
+ const { card: t, chartType: i, axis: n, preferences: r, axisConfig: a } = e, o = zt({
1004
1005
  card: t,
1005
1006
  chartType: i,
1006
1007
  axis: n,
1007
1008
  preferences: r
1008
- }), s = pe({
1009
+ }), s = he({
1009
1010
  formatMode: a == null ? void 0 : a.formatMode,
1010
1011
  overrideFormatOptions: a == null ? void 0 : a.formatOptions,
1011
1012
  metrics: o,
@@ -1013,7 +1014,7 @@ function Ve(e) {
1013
1014
  });
1014
1015
  return {
1015
1016
  ...s,
1016
- formatOptions: me({
1017
+ formatOptions: ye({
1017
1018
  card: t,
1018
1019
  metrics: o,
1019
1020
  formatOptions: s.formatOptions,
@@ -1021,7 +1022,7 @@ function Ve(e) {
1021
1022
  })
1022
1023
  };
1023
1024
  }
1024
- function qt(e, t) {
1025
+ function jt(e, t) {
1025
1026
  if (!e && (!t || t === "auto" || t === "none"))
1026
1027
  return;
1027
1028
  const i = {
@@ -1029,8 +1030,8 @@ function qt(e, t) {
1029
1030
  };
1030
1031
  return t && t !== "auto" && t !== "none" && !i.type && (i.type = t), i;
1031
1032
  }
1032
- function pr(e) {
1033
- const { preferences: t, metric: i } = e, n = t == null ? void 0 : t.tooltipConfig, r = pe({
1033
+ function vr(e) {
1034
+ const { preferences: t, metric: i } = e, n = t == null ? void 0 : t.tooltipConfig, r = he({
1034
1035
  formatMode: n == null ? void 0 : n.formatMode,
1035
1036
  legacyMode: n == null ? void 0 : n.mode,
1036
1037
  overrideFormatOptions: n == null ? void 0 : n.formatOptions,
@@ -1039,7 +1040,7 @@ function pr(e) {
1039
1040
  });
1040
1041
  return {
1041
1042
  ...r,
1042
- formatOptions: me({
1043
+ formatOptions: ye({
1043
1044
  card: e.card,
1044
1045
  metrics: e.metric ? [e.metric] : [],
1045
1046
  formatOptions: r.formatOptions,
@@ -1047,14 +1048,14 @@ function pr(e) {
1047
1048
  })
1048
1049
  };
1049
1050
  }
1050
- function _e(e, t, i) {
1051
- return t === re(i, e) ? er(i, e) : t === "x" ? e == null ? void 0 : e.xAxisConfig : t === "y2" ? e == null ? void 0 : e.secondaryYAxisConfig : e == null ? void 0 : e.yAxisConfig;
1051
+ function ke(e, t, i) {
1052
+ return t === ae(i, e) ? ar(i, e) : t === "x" ? e == null ? void 0 : e.xAxisConfig : t === "y2" ? e == null ? void 0 : e.secondaryYAxisConfig : e == null ? void 0 : e.yAxisConfig;
1052
1053
  }
1053
- function Re(e) {
1054
+ function Be(e) {
1054
1055
  const { chartType: t, preferences: i } = e;
1055
- return t === "bubble" || t === "scatter" ? "y" : re(t, i);
1056
+ return t === "bubble" || t === "scatter" ? "y" : ae(t, i);
1056
1057
  }
1057
- function zt(e) {
1058
+ function Ut(e) {
1058
1059
  switch (e) {
1059
1060
  case "pie":
1060
1061
  case "doughnut":
@@ -1067,8 +1068,8 @@ function zt(e) {
1067
1068
  return !0;
1068
1069
  }
1069
1070
  }
1070
- function Za(e) {
1071
- const { card: t, chartType: i, preferences: n, metric: r } = e, a = pr({
1071
+ function fo(e) {
1072
+ const { card: t, chartType: i, preferences: n, metric: r } = e, a = vr({
1072
1073
  card: t,
1073
1074
  preferences: n,
1074
1075
  metric: r,
@@ -1076,29 +1077,29 @@ function Za(e) {
1076
1077
  });
1077
1078
  if (a.source === "override")
1078
1079
  return a;
1079
- const o = e.axis || Re({ chartType: i, preferences: n }), s = Ve({
1080
+ const o = e.axis || Be({ chartType: i, preferences: n }), s = Ve({
1080
1081
  card: t,
1081
1082
  chartType: i,
1082
1083
  axis: o,
1083
1084
  preferences: n,
1084
- axisConfig: _e(n, o, i),
1085
+ axisConfig: ke(n, o, i),
1085
1086
  numericPresentation: e.numericPresentation
1086
1087
  });
1087
1088
  return s.source === "override" ? s : a;
1088
1089
  }
1089
- function eo(e) {
1090
- const { card: t, chartType: i, preferences: n, dataLabelsConfig: r } = e, a = i || (t == null ? void 0 : t.type), o = Re({
1090
+ function mo(e) {
1091
+ const { card: t, chartType: i, preferences: n, dataLabelsConfig: r } = e, a = i || (t == null ? void 0 : t.type), o = Be({
1091
1092
  chartType: a,
1092
1093
  preferences: n
1093
- }), s = Lt({
1094
+ }), s = zt({
1094
1095
  card: t,
1095
1096
  chartType: a,
1096
1097
  axis: o,
1097
1098
  preferences: n
1098
- }), l = pe({
1099
+ }), l = he({
1099
1100
  formatMode: r == null ? void 0 : r.formatMode,
1100
1101
  legacyMode: r == null ? void 0 : r.format,
1101
- overrideFormatOptions: qt(
1102
+ overrideFormatOptions: jt(
1102
1103
  r == null ? void 0 : r.formatOptions,
1103
1104
  r == null ? void 0 : r.format
1104
1105
  ),
@@ -1106,21 +1107,21 @@ function eo(e) {
1106
1107
  preferences: n
1107
1108
  }), c = {
1108
1109
  ...l,
1109
- formatOptions: me({
1110
+ formatOptions: ye({
1110
1111
  card: t,
1111
1112
  metrics: s,
1112
1113
  formatOptions: l.formatOptions,
1113
1114
  context: e.numericPresentation
1114
1115
  })
1115
1116
  };
1116
- if (c.source === "override" || !zt(a))
1117
+ if (c.source === "override" || !Ut(a))
1117
1118
  return c;
1118
1119
  const u = Ve({
1119
1120
  card: t,
1120
1121
  chartType: a,
1121
1122
  axis: o,
1122
1123
  preferences: n,
1123
- axisConfig: _e(
1124
+ axisConfig: ke(
1124
1125
  n,
1125
1126
  o,
1126
1127
  a
@@ -1129,11 +1130,11 @@ function eo(e) {
1129
1130
  });
1130
1131
  return u.source === "override" ? u : c;
1131
1132
  }
1132
- function yr(e) {
1133
- const { preferences: t, dataLabelsConfig: i, metric: n } = e, r = pe({
1133
+ function Fr(e) {
1134
+ const { preferences: t, dataLabelsConfig: i, metric: n } = e, r = he({
1134
1135
  formatMode: i == null ? void 0 : i.formatMode,
1135
1136
  legacyMode: i == null ? void 0 : i.format,
1136
- overrideFormatOptions: qt(
1137
+ overrideFormatOptions: jt(
1137
1138
  i == null ? void 0 : i.formatOptions,
1138
1139
  i == null ? void 0 : i.format
1139
1140
  ),
@@ -1142,7 +1143,7 @@ function yr(e) {
1142
1143
  });
1143
1144
  return {
1144
1145
  ...r,
1145
- formatOptions: me({
1146
+ formatOptions: ye({
1146
1147
  card: e.card,
1147
1148
  metrics: e.metric ? [e.metric] : [],
1148
1149
  formatOptions: r.formatOptions,
@@ -1150,16 +1151,16 @@ function yr(e) {
1150
1151
  })
1151
1152
  };
1152
1153
  }
1153
- function to(e) {
1154
+ function po(e) {
1154
1155
  var o, s;
1155
- const t = cr({
1156
+ const t = pr({
1156
1157
  card: e.card,
1157
1158
  metricId: e.metricId,
1158
1159
  metricAlias: e.metricAlias,
1159
1160
  datasetIndex: e.datasetIndex,
1160
1161
  datasetLabel: e.datasetLabel,
1161
1162
  metricKey: e.metricKey
1162
- }), i = yr({
1163
+ }), i = Fr({
1163
1164
  card: e.card,
1164
1165
  preferences: e.preferences,
1165
1166
  dataLabelsConfig: e.dataLabelsConfig,
@@ -1169,9 +1170,9 @@ function to(e) {
1169
1170
  if (i.source === "override")
1170
1171
  return i;
1171
1172
  const n = (o = e.card) == null ? void 0 : o.type;
1172
- if (!zt(n))
1173
+ if (!Ut(n))
1173
1174
  return i;
1174
- let r = Re({
1175
+ let r = Be({
1175
1176
  chartType: n,
1176
1177
  preferences: e.preferences
1177
1178
  });
@@ -1186,7 +1187,7 @@ function to(e) {
1186
1187
  chartType: n,
1187
1188
  axis: r,
1188
1189
  preferences: e.preferences,
1189
- axisConfig: _e(
1190
+ axisConfig: ke(
1190
1191
  e.preferences,
1191
1192
  r,
1192
1193
  n
@@ -1195,15 +1196,15 @@ function to(e) {
1195
1196
  });
1196
1197
  return a.source === "override" ? a : i;
1197
1198
  }
1198
- function io(e) {
1199
+ function yo(e) {
1199
1200
  return (e == null ? void 0 : e.rawValue) === !0;
1200
1201
  }
1201
- function gr(e) {
1202
+ function Cr(e) {
1202
1203
  const t = e == null ? void 0 : e.numberFormat;
1203
1204
  if (!t)
1204
1205
  return;
1205
1206
  if (t.style === "duration")
1206
- return k(De(t), {
1207
+ return K(we(t), {
1207
1208
  preserveOmittedProperties: !0
1208
1209
  });
1209
1210
  const i = t.style === "currency" ? "currency" : t.style === "percent" ? "percent" : t.style === "scientific" ? "scientific" : "number", n = t.minimumFractionDigits, r = t.maximumFractionDigits;
@@ -1223,14 +1224,14 @@ function gr(e) {
1223
1224
  suffix: t.suffix
1224
1225
  };
1225
1226
  }
1226
- function br(e, t, i = !1) {
1227
- const n = i ? { preserveOmittedProperties: !0 } : void 0, r = H(e == null ? void 0 : e.format, n), a = mt(
1227
+ function Ir(e, t, i = !1) {
1228
+ const n = i ? { preserveOmittedProperties: !0 } : void 0, r = H(e == null ? void 0 : e.format, n), a = yt(
1228
1229
  r,
1229
1230
  n
1230
1231
  );
1231
1232
  if (!a)
1232
1233
  return;
1233
- const o = t || Ne(), s = i ? {
1234
+ const o = t || Ee(), s = i ? {
1234
1235
  showDataBar: o.numberFormat.showDataBar,
1235
1236
  showHeatmap: o.numberFormat.showHeatmap,
1236
1237
  dataBarColor: o.numberFormat.dataBarColor,
@@ -1253,8 +1254,8 @@ function br(e, t, i = !1) {
1253
1254
  }
1254
1255
  };
1255
1256
  }
1256
- function $t(e) {
1257
- var b, I, _, O;
1257
+ function Gt(e) {
1258
+ var g, I, R, O;
1258
1259
  const {
1259
1260
  card: t,
1260
1261
  columnId: i,
@@ -1269,55 +1270,55 @@ function $t(e) {
1269
1270
  valueFormatPreferences: f,
1270
1271
  boundCurrency: d,
1271
1272
  preserveOmittedProperties: y
1272
- } = e, v = n ?? ((_ = (I = (b = t == null ? void 0 : t.preferences) == null ? void 0 : b.tablePrefs) == null ? void 0 : I.columnSettingsMap) == null ? void 0 : _[i]), h = !((O = t == null ? void 0 : t.sql) != null && O.trim()) || li(v), m = h ? f : null, g = h ? d : void 0, C = ci(
1273
+ } = e, v = n ?? ((R = (I = (g = t == null ? void 0 : t.preferences) == null ? void 0 : g.tablePrefs) == null ? void 0 : I.columnSettingsMap) == null ? void 0 : R[i]), b = !((O = t == null ? void 0 : t.sql) != null && O.trim()) || fi(v), m = b ? f : null, h = b ? d : void 0, C = mi(
1273
1274
  v == null ? void 0 : v.numberFormat
1274
- ), D = r ?? Bt(v);
1275
+ ), D = r ?? Lt(v);
1275
1276
  if (D && D.inheritMetricFormat !== !0)
1276
- return rt(
1277
+ return ot(
1277
1278
  D,
1278
1279
  m,
1279
- g,
1280
+ h,
1280
1281
  {
1281
1282
  preserveHistoricalPersistedPrecision: C
1282
1283
  }
1283
1284
  );
1284
- const w = ae(t, {
1285
+ const w = oe(t, {
1285
1286
  columnId: i,
1286
1287
  metricId: o,
1287
1288
  metricAlias: s,
1288
1289
  columnKeyMap: u,
1289
1290
  fieldId: l,
1290
1291
  fieldRole: c
1291
- }), S = br(
1292
+ }), S = Ir(
1292
1293
  w,
1293
1294
  D || a,
1294
1295
  y ?? !!f
1295
- ), V = !S && m && tr(w) ? ar(
1296
+ ), E = !S && m && or(w) ? ur(
1296
1297
  D || a,
1297
- g
1298
+ h
1298
1299
  ) : void 0;
1299
- return rt(
1300
- S || V || D || a,
1300
+ return ot(
1301
+ S || E || D || a,
1301
1302
  m,
1302
- g,
1303
+ h,
1303
1304
  {
1304
- preserveHistoricalPersistedPrecision: !!(D && C && !S && !V)
1305
+ preserveHistoricalPersistedPrecision: !!(D && C && !S && !E)
1305
1306
  }
1306
1307
  );
1307
1308
  }
1308
- function rt(e, t, i, n) {
1309
+ function ot(e, t, i, n) {
1309
1310
  if (!e || e.type !== "number" || !t)
1310
1311
  return e;
1311
- const r = e.numberFormat, a = r ? n != null && n.preserveHistoricalPersistedPrecision ? ui(r) : De(r, {
1312
+ const r = e.numberFormat, a = r ? n != null && n.preserveHistoricalPersistedPrecision ? pi(r) : we(r, {
1312
1313
  preserveOmittedProperties: !0
1313
1314
  }) : { type: "number" };
1314
- if (!a || !B(a))
1315
+ if (!a || !k(a))
1315
1316
  return e;
1316
- const o = E(
1317
+ const o = _(
1317
1318
  a,
1318
1319
  t,
1319
1320
  i
1320
- ), s = mt(o, {
1321
+ ), s = yt(o, {
1321
1322
  preserveOmittedProperties: !0
1322
1323
  });
1323
1324
  return s ? {
@@ -1333,30 +1334,30 @@ function rt(e, t, i, n) {
1333
1334
  }
1334
1335
  } : e;
1335
1336
  }
1336
- function de(e) {
1337
+ function me(e) {
1337
1338
  if (!e.valueFormatPreferences)
1338
1339
  return;
1339
- const t = $t(e);
1340
+ const t = Gt(e);
1340
1341
  if (!t || t.type !== "number")
1341
1342
  return;
1342
- const i = De(t.numberFormat, {
1343
+ const i = we(t.numberFormat, {
1343
1344
  preserveOmittedProperties: !0
1344
1345
  });
1345
- if (!(!i || !bt(i)))
1346
+ if (!(!i || !vt(i)))
1346
1347
  return i;
1347
1348
  }
1348
- function hr(e) {
1349
+ function xr(e) {
1349
1350
  var n, r;
1350
1351
  if (!e.presentation.preferences)
1351
1352
  return;
1352
- const t = ae(e.card, {
1353
+ const t = oe(e.card, {
1353
1354
  columnId: e.columnId,
1354
1355
  metricId: e.metricId,
1355
1356
  metricAlias: e.metricAlias,
1356
1357
  columnKeyMap: e.columnKeyMap
1357
1358
  });
1358
1359
  if (e.comparisonValueKind === "percent_change" || e.comparisonValueKind === "ratio") {
1359
- const a = de({
1360
+ const a = me({
1360
1361
  card: e.card,
1361
1362
  columnId: e.columnId,
1362
1363
  persistedSettings: e.persistedSettings,
@@ -1366,7 +1367,7 @@ function hr(e) {
1366
1367
  columnKeyMap: e.columnKeyMap,
1367
1368
  metricAlias: e.metricAlias ?? (t == null ? void 0 : t.alias),
1368
1369
  valueFormatPreferences: e.presentation.preferences
1369
- }), o = mi(e.comparisonPrecision) ?? (B(a) ? a.maximumFractionDigits : void 0) ?? (e.comparisonValueKind === "percent_change" ? 1 : 2);
1370
+ }), o = gi(e.comparisonPrecision) ?? (k(a) ? a.maximumFractionDigits : void 0) ?? (e.comparisonValueKind === "percent_change" ? 1 : 2);
1370
1371
  return e.comparisonValueKind === "percent_change" ? {
1371
1372
  type: "percent",
1372
1373
  locale: e.presentation.preferences.locale,
@@ -1381,12 +1382,12 @@ function hr(e) {
1381
1382
  suffix: "×"
1382
1383
  };
1383
1384
  }
1384
- const i = pi({
1385
+ const i = bi({
1385
1386
  card: e.card,
1386
1387
  columnKey: e.columnId,
1387
1388
  metricId: e.metricId ?? (t && !((r = (n = e.card.config) == null ? void 0 : n.groupByColumns) != null && r.includes(t)) ? t.id : void 0)
1388
1389
  });
1389
- return de({
1390
+ return me({
1390
1391
  card: e.card,
1391
1392
  columnId: e.columnId,
1392
1393
  persistedSettings: e.persistedSettings,
@@ -1399,13 +1400,13 @@ function hr(e) {
1399
1400
  boundCurrency: i ? e.presentation.resolveBoundCurrency(i) : void 0
1400
1401
  });
1401
1402
  }
1402
- function vr(e) {
1403
+ function Sr(e) {
1403
1404
  var s, l, c, u, f, d, y;
1404
1405
  if (e.card.type === "matrixTable" && e.target.kind === "matrix_measure") {
1405
- const v = e.target, h = yi(e.card, e.matrixCatalog).find(
1406
- (g) => g.measureId === v.measureId
1407
- ), m = h == null ? void 0 : h.canonical;
1408
- return m && (m.type === "number" || m.type === "currency") ? E(
1406
+ const v = e.target, b = vi(e.card, e.matrixCatalog).find(
1407
+ (h) => h.measureId === v.measureId
1408
+ ), m = b == null ? void 0 : b.canonical;
1409
+ return m && (m.type === "number" || m.type === "currency") ? _(
1409
1410
  m,
1410
1411
  e.valueFormatPreferences,
1411
1412
  e.boundCurrency
@@ -1414,33 +1415,33 @@ function vr(e) {
1414
1415
  if (e.target.kind === "matrix_measure")
1415
1416
  return;
1416
1417
  if (e.card.type === "kpi") {
1417
- const v = e.target.kind === "metric" ? e.target.metricId : void 0, h = v ? ((l = (s = e.card.config) == null ? void 0 : s.metricColumns) == null ? void 0 : l.findIndex(
1418
+ const v = e.target.kind === "metric" ? e.target.metricId : void 0, b = v ? ((l = (s = e.card.config) == null ? void 0 : s.metricColumns) == null ? void 0 : l.findIndex(
1418
1419
  (C) => C.id === v
1419
1420
  )) ?? -1 : 0;
1420
- if (h < 0)
1421
+ if (b < 0)
1421
1422
  return;
1422
- const m = gi(e.card, {
1423
- metricIndex: h,
1423
+ const m = Fi(e.card, {
1424
+ metricIndex: b,
1424
1425
  resultColumnKey: e.target.kind === "column" ? e.target.columnKey : void 0
1425
- }), g = m.authoredFormat;
1426
- return m.currencyBindable && g && B(g) ? E(
1427
- g,
1426
+ }), h = m.authoredFormat;
1427
+ return m.currencyBindable && h && k(h) ? _(
1428
+ h,
1428
1429
  e.valueFormatPreferences,
1429
1430
  e.boundCurrency
1430
1431
  ) : void 0;
1431
1432
  }
1432
- if (!((c = e.card.sql) != null && c.trim()) && !$i(e.card.type) && e.target.kind === "metric") {
1433
- const v = e.target.metricId, h = (f = (u = e.card.config) == null ? void 0 : u.metricColumns) == null ? void 0 : f.find(
1433
+ if (!((c = e.card.sql) != null && c.trim()) && !Wi(e.card.type) && e.target.kind === "metric") {
1434
+ const v = e.target.metricId, b = (f = (u = e.card.config) == null ? void 0 : u.metricColumns) == null ? void 0 : f.find(
1434
1435
  (C) => C.id === v
1435
1436
  );
1436
- if (!h)
1437
+ if (!b)
1437
1438
  return;
1438
- const m = dt(
1439
+ const m = mt(
1439
1440
  e.card,
1440
- h
1441
- ), g = m.authoredFormat;
1442
- return m.currencyBindable && g && B(g) ? E(
1443
- g,
1441
+ b
1442
+ ), h = m.authoredFormat;
1443
+ return m.currencyBindable && h && k(h) ? _(
1444
+ h,
1444
1445
  e.valueFormatPreferences,
1445
1446
  e.boundCurrency
1446
1447
  ) : void 0;
@@ -1451,12 +1452,12 @@ function vr(e) {
1451
1452
  e.target.metricId
1452
1453
  ], a = e.target.kind === "column" ? e.target.columnKey : r.find(
1453
1454
  (v) => {
1454
- var h;
1455
- return ((h = ae(e.card, {
1455
+ var b;
1456
+ return ((b = oe(e.card, {
1456
1457
  columnId: v
1457
- })) == null ? void 0 : h.id) === n;
1458
+ })) == null ? void 0 : b.id) === n;
1458
1459
  }
1459
- ) || n, o = de({
1460
+ ) || n, o = me({
1460
1461
  card: e.card,
1461
1462
  columnId: a,
1462
1463
  metricId: n,
@@ -1464,14 +1465,14 @@ function vr(e) {
1464
1465
  valueFormatPreferences: e.valueFormatPreferences,
1465
1466
  boundCurrency: e.boundCurrency
1466
1467
  });
1467
- return B(o) ? o : void 0;
1468
+ return k(o) ? o : void 0;
1468
1469
  }
1469
- function no(e) {
1470
+ function ho(e) {
1470
1471
  var i, n, r, a, o, s;
1471
1472
  const t = e.persistedSettings ?? ((a = (r = (n = (i = e.card) == null ? void 0 : i.preferences) == null ? void 0 : n.tablePrefs) == null ? void 0 : r.columnSettingsMap) == null ? void 0 : a[e.columnId]);
1472
1473
  if (!t && !e.resolvedSettings || (t == null ? void 0 : t.inheritMetricFormat) === !0 || ((o = e.resolvedSettings) == null ? void 0 : o.inheritMetricFormat) === !0) {
1473
1474
  const l = H(
1474
- (s = ae(e.card, {
1475
+ (s = oe(e.card, {
1475
1476
  columnId: e.columnId,
1476
1477
  metricId: e.metricId,
1477
1478
  metricAlias: e.metricAlias,
@@ -1480,23 +1481,23 @@ function no(e) {
1480
1481
  { preserveOmittedProperties: !0 }
1481
1482
  );
1482
1483
  if ((l == null ? void 0 : l.type) === "date" || (l == null ? void 0 : l.type) === "duration")
1483
- return k(l, {
1484
+ return K(l, {
1484
1485
  preserveOmittedProperties: !0
1485
1486
  });
1486
1487
  }
1487
- return gr(
1488
- $t({
1488
+ return Cr(
1489
+ Gt({
1489
1490
  ...e,
1490
1491
  persistedSettings: t
1491
1492
  })
1492
1493
  );
1493
1494
  }
1494
- function Fr(e) {
1495
- var v, h, m, g, C, D, w;
1496
- const t = (v = e == null ? void 0 : e.formatNumber) == null ? void 0 : v.enabled, i = typeof t == "string" ? t.trim().toLowerCase() !== "false" : t !== !1, n = di(e == null ? void 0 : e.numberAxisFormat) || (i ? fi(e == null ? void 0 : e.formatNumber) : void 0), r = k(n);
1495
+ function Mr(e) {
1496
+ var v, b, m, h, C, D, w;
1497
+ const t = (v = e == null ? void 0 : e.formatNumber) == null ? void 0 : v.enabled, i = typeof t == "string" ? t.trim().toLowerCase() !== "false" : t !== !1, n = yi(e == null ? void 0 : e.numberAxisFormat) || (i ? hi(e == null ? void 0 : e.formatNumber) : void 0), r = K(n);
1497
1498
  if (!r || !r.type || r.type === "auto")
1498
1499
  return r;
1499
- const a = (h = e == null ? void 0 : e.numberAxisFormat) == null ? void 0 : h.decimalPlaces, o = i ? (m = e == null ? void 0 : e.formatNumber) == null ? void 0 : m.decimalPlaces : void 0, s = typeof a == "number" ? a : typeof o == "number" ? o : void 0, l = (g = e == null ? void 0 : e.numberAxisFormat) == null ? void 0 : g.minimumFractionDigits, c = (C = e == null ? void 0 : e.numberAxisFormat) == null ? void 0 : C.maximumFractionDigits, u = i ? (D = e == null ? void 0 : e.formatNumber) == null ? void 0 : D.minimumFractionDigits : void 0, f = i ? (w = e == null ? void 0 : e.formatNumber) == null ? void 0 : w.maximumFractionDigits : void 0, d = typeof s == "number" ? s : typeof l == "number" ? l : typeof u == "number" ? u : 0, y = typeof s == "number" ? s : typeof c == "number" ? c : typeof f == "number" ? f : 0;
1500
+ const a = (b = e == null ? void 0 : e.numberAxisFormat) == null ? void 0 : b.decimalPlaces, o = i ? (m = e == null ? void 0 : e.formatNumber) == null ? void 0 : m.decimalPlaces : void 0, s = typeof a == "number" ? a : typeof o == "number" ? o : void 0, l = (h = e == null ? void 0 : e.numberAxisFormat) == null ? void 0 : h.minimumFractionDigits, c = (C = e == null ? void 0 : e.numberAxisFormat) == null ? void 0 : C.maximumFractionDigits, u = i ? (D = e == null ? void 0 : e.formatNumber) == null ? void 0 : D.minimumFractionDigits : void 0, f = i ? (w = e == null ? void 0 : e.formatNumber) == null ? void 0 : w.maximumFractionDigits : void 0, d = typeof s == "number" ? s : typeof l == "number" ? l : typeof u == "number" ? u : 0, y = typeof s == "number" ? s : typeof c == "number" ? c : typeof f == "number" ? f : 0;
1500
1501
  return {
1501
1502
  ...r,
1502
1503
  decimalPlaces: d === y ? y : r.decimalPlaces,
@@ -1507,10 +1508,10 @@ function Fr(e) {
1507
1508
  )
1508
1509
  };
1509
1510
  }
1510
- function ro(e) {
1511
+ function go(e) {
1511
1512
  var r, a, o, s, l;
1512
1513
  const { value: t, formatOptions: i, preferences: n } = e;
1513
- return i != null && i.type && i.type !== "auto" ? Nt(t, i.type, i) : jn({
1514
+ return i != null && i.type && i.type !== "auto" ? Rt(t, i.type, i) : Qn({
1514
1515
  number: t,
1515
1516
  decimalPlaces: ((r = n == null ? void 0 : n.numberAxisFormat) == null ? void 0 : r.decimalPlaces) ?? 0,
1516
1517
  useSuffix: !!((a = n == null ? void 0 : n.numberAxisFormat) != null && a.suffix),
@@ -1519,18 +1520,18 @@ function ro(e) {
1519
1520
  currency: ((l = n == null ? void 0 : n.numberAxisFormat) == null ? void 0 : l.currency) || ""
1520
1521
  });
1521
1522
  }
1522
- function Cr(e) {
1523
- return ji({
1523
+ function Dr(e) {
1524
+ return Qi({
1524
1525
  ...e,
1525
- activation: Te({
1526
+ activation: Pe({
1526
1527
  card: e.card,
1527
1528
  cardConfig: e.cardConfig
1528
1529
  })
1529
1530
  });
1530
1531
  }
1531
- function ao(e) {
1532
- return Ui({
1533
- activation: Te({
1532
+ function bo(e) {
1533
+ return Yi({
1534
+ activation: Pe({
1534
1535
  card: e.card,
1535
1536
  cardConfig: e.cardConfig
1536
1537
  }),
@@ -1538,9 +1539,9 @@ function ao(e) {
1538
1539
  expectedResultOwner: e.expectedResultOwner
1539
1540
  });
1540
1541
  }
1541
- function Ir(e) {
1542
+ function Tr(e) {
1542
1543
  var n, r;
1543
- const t = pt(e.card, e.effectiveCardConfig), i = _n({
1544
+ const t = ht(e.card, e.effectiveCardConfig), i = Ln({
1544
1545
  card: t,
1545
1546
  records: e.rows,
1546
1547
  keys: e.rows.length === 0 ? e.resultKeys : void 0,
@@ -1563,35 +1564,35 @@ function Ir(e) {
1563
1564
  }
1564
1565
  };
1565
1566
  }
1566
- function xr(e) {
1567
+ function wr(e) {
1567
1568
  var i;
1568
1569
  const t = (i = e.preferences) == null ? void 0 : i.comparisonPresentation;
1569
1570
  return {
1570
- ...Ei,
1571
+ ...Bi,
1571
1572
  ...t,
1572
1573
  ...t != null && t.conditionalLabels ? { conditionalLabels: { ...t.conditionalLabels } } : {},
1573
1574
  ...t != null && t.colors ? { colors: { ...t.colors } } : {}
1574
1575
  };
1575
1576
  }
1576
- function Sr(e) {
1577
- var D, w, F, S, V;
1578
- const t = pt(e.card, e.effectiveCardConfig), { cardId: i, ...n } = e.requestPayloadBase, r = e.formatOptions.visibleColumns ?? [], a = [
1577
+ function Pr(e) {
1578
+ var D, w, F, S, E;
1579
+ const t = ht(e.card, e.effectiveCardConfig), { cardId: i, ...n } = e.requestPayloadBase, r = e.formatOptions.visibleColumns ?? [], a = [
1579
1580
  ...r,
1580
1581
  ...Object.keys(e.formatOptions.columnSettings ?? {})
1581
- ], o = bi(
1582
+ ], o = Ci(
1582
1583
  e.card,
1583
1584
  r,
1584
1585
  e.effectiveCardConfig
1585
- ), s = hi(
1586
+ ), s = Ii(
1586
1587
  e.card,
1587
1588
  e.effectiveCardConfig,
1588
1589
  o
1589
- ), l = vi(
1590
+ ), l = xi(
1590
1591
  t,
1591
1592
  a
1592
1593
  ), c = new Set(
1593
- l.eligibleTargets.map(be)
1594
- ), u = (p) => c.has(be(p)) ? Ci({
1594
+ l.eligibleTargets.map(ve)
1595
+ ), u = (p) => c.has(ve(p)) ? Mi({
1595
1596
  bindings: n.controlBindings,
1596
1597
  controls: [
1597
1598
  ...n.controlDefinitions ?? [],
@@ -1601,11 +1602,11 @@ function Sr(e) {
1601
1602
  target: p,
1602
1603
  knownTargets: l.knownTargets,
1603
1604
  eligibleTargets: l.eligibleTargets
1604
- }).currency : void 0, f = Fi({
1605
+ }).currency : void 0, f = Si({
1605
1606
  card: e.card,
1606
1607
  comparisonMetadata: e.comparisonMetadata,
1607
1608
  columnKeyMap: ((D = e.canonicalPivotResult) == null ? void 0 : D.columnKeyMap) ?? e.columnKeyMap
1608
- }), d = Te({
1609
+ }), d = Pe({
1609
1610
  card: e.card,
1610
1611
  cardConfig: e.effectiveCardConfig
1611
1612
  });
@@ -1613,14 +1614,14 @@ function Sr(e) {
1613
1614
  throw new Error(
1614
1615
  "Canonical pivot export requires a parsed pivot result lifecycle."
1615
1616
  );
1616
- const y = Cr({
1617
+ const y = Dr({
1617
1618
  card: e.card,
1618
1619
  cardConfig: e.effectiveCardConfig,
1619
1620
  columns: ((w = e.canonicalPivotResult) == null ? void 0 : w.columns) ?? e.resultColumns,
1620
1621
  columnKeyMap: ((F = e.canonicalPivotResult) == null ? void 0 : F.columnKeyMap) ?? e.columnKeyMap,
1621
1622
  resultRowCount: e.totalRows,
1622
1623
  valueFormatPreferences: e.reportContext.valueFormat
1623
- }), v = (d == null ? void 0 : d.fields) ?? [], h = new Map(
1624
+ }), v = (d == null ? void 0 : d.fields) ?? [], b = new Map(
1624
1625
  v.map((p) => [
1625
1626
  `${p.role}:${p.id}`,
1626
1627
  p
@@ -1635,7 +1636,7 @@ function Sr(e) {
1635
1636
  throw new Error(
1636
1637
  "Canonical raw temporal export requires an authoritative columnKeyMap."
1637
1638
  );
1638
- const I = In({
1639
+ const I = Tn({
1639
1640
  cardType: e.card.type,
1640
1641
  resultOwner: n.resultOwner,
1641
1642
  effectiveCardConfig: e.effectiveCardConfig,
@@ -1649,48 +1650,48 @@ function Sr(e) {
1649
1650
  });
1650
1651
  if (I.kind === "invalid") throw I.error;
1651
1652
  if (I.kind === "loaded_empty" || I.kind === "loaded_valid")
1652
- for (const [_, O] of I.presentation.byColumnKey)
1653
- m.set(_, O.format);
1653
+ for (const [R, O] of I.presentation.byColumnKey)
1654
+ m.set(R, O.format);
1654
1655
  }
1655
1656
  } else if (n.resultOwner === "freeform" && n.sql.trim() && !n.python.trim())
1656
- for (const [p, b] of Object.entries(
1657
- ((V = (S = e.card.preferences) == null ? void 0 : S.tablePrefs) == null ? void 0 : V.columnSettingsMap) || {}
1657
+ for (const [p, g] of Object.entries(
1658
+ ((E = (S = e.card.preferences) == null ? void 0 : S.tablePrefs) == null ? void 0 : E.columnSettingsMap) || {}
1658
1659
  )) {
1659
- if (b.type !== "date") continue;
1660
- const I = xn(b.dateFormat);
1660
+ if (g.type !== "date") continue;
1661
+ const I = wn(g.dateFormat);
1661
1662
  I && m.set(
1662
1663
  p,
1663
- Li({
1664
+ Ui({
1664
1665
  format: I,
1665
1666
  preferences: e.reportContext.valueFormat,
1666
1667
  calendar: e.reportContext.calendar
1667
1668
  })
1668
1669
  );
1669
1670
  }
1670
- const g = [
1671
+ const h = [
1671
1672
  ...new Set(a)
1672
1673
  ].flatMap((p) => {
1673
- var P, J, Y, X, Z, ee;
1674
+ var P, J, X, Z, ee, te;
1674
1675
  if (y.byColumnKey.has(p) || m.has(p))
1675
1676
  return [];
1676
- const b = f.columnPresentationOwners.get(p), I = (P = t.sql) != null && P.trim() ? void 0 : ae(t, {
1677
+ const g = f.columnPresentationOwners.get(p), I = (P = t.sql) != null && P.trim() ? void 0 : oe(t, {
1677
1678
  columnId: p,
1678
1679
  columnKeyMap: e.columnKeyMap,
1679
- metricId: b == null ? void 0 : b.metricId,
1680
- metricAlias: b == null ? void 0 : b.metricAlias
1681
- }), _ = I ? { kind: "metric", metricId: I.id } : { kind: "column", columnKey: p }, O = c.has(
1682
- be(_)
1683
- ), W = u(_), R = (X = (Y = (J = t.preferences) == null ? void 0 : J.tablePrefs) == null ? void 0 : Y.columnSettingsMap) == null ? void 0 : X[p], j = {
1680
+ metricId: g == null ? void 0 : g.metricId,
1681
+ metricAlias: g == null ? void 0 : g.metricAlias
1682
+ }), R = I ? { kind: "metric", metricId: I.id } : { kind: "column", columnKey: p }, O = c.has(
1683
+ ve(R)
1684
+ ), Q = u(R), V = (Z = (X = (J = t.preferences) == null ? void 0 : J.tablePrefs) == null ? void 0 : X.columnSettingsMap) == null ? void 0 : Z[p], U = {
1684
1685
  dashboardId: e.dashboardId,
1685
1686
  cardId: t.id
1686
- }, K = { kind: "column", columnKey: p }, T = I && (!R || R.inheritMetricFormat === !0) ? H(I.format, {
1687
+ }, B = { kind: "column", columnKey: p }, T = I && (!V || V.inheritMetricFormat === !0) ? H(I.format, {
1687
1688
  preserveOmittedProperties: !0
1688
1689
  }) : void 0;
1689
1690
  if ((T == null ? void 0 : T.type) === "date")
1690
1691
  return [
1691
1692
  {
1692
- scope: j,
1693
- target: K,
1693
+ scope: U,
1694
+ target: B,
1694
1695
  format: {
1695
1696
  type: "date",
1696
1697
  locale: T.locale ?? e.reportContext.valueFormat.locale,
@@ -1700,37 +1701,37 @@ function Sr(e) {
1700
1701
  }
1701
1702
  }
1702
1703
  ];
1703
- const A = (b ? hr({
1704
+ const A = (g ? xr({
1704
1705
  card: t,
1705
1706
  columnId: p,
1706
1707
  columnKeyMap: e.columnKeyMap,
1707
- persistedSettings: R,
1708
- metricId: b.metricId,
1709
- metricAlias: b.metricAlias,
1710
- comparisonValueKind: b.kind,
1711
- comparisonPrecision: (ee = (Z = t.preferences) == null ? void 0 : Z.comparisonPresentation) == null ? void 0 : ee.precision,
1708
+ persistedSettings: V,
1709
+ metricId: g.metricId,
1710
+ metricAlias: g.metricAlias,
1711
+ comparisonValueKind: g.kind,
1712
+ comparisonPrecision: (te = (ee = t.preferences) == null ? void 0 : ee.comparisonPresentation) == null ? void 0 : te.precision,
1712
1713
  presentation: {
1713
1714
  preferences: e.reportContext.valueFormat,
1714
1715
  resolveBoundCurrency: u
1715
1716
  }
1716
- }) : void 0) ?? (O ? vr({
1717
+ }) : void 0) ?? (O ? Sr({
1717
1718
  card: t,
1718
- target: _,
1719
+ target: R,
1719
1720
  resultColumnKeys: a,
1720
1721
  valueFormatPreferences: e.reportContext.valueFormat,
1721
- boundCurrency: W
1722
- }) : void 0) ?? de({
1722
+ boundCurrency: Q
1723
+ }) : void 0) ?? me({
1723
1724
  card: t,
1724
1725
  columnId: p,
1725
1726
  columnKeyMap: e.columnKeyMap,
1726
- metricId: b == null ? void 0 : b.metricId,
1727
- persistedSettings: R,
1727
+ metricId: g == null ? void 0 : g.metricId,
1728
+ persistedSettings: V,
1728
1729
  valueFormatPreferences: e.reportContext.valueFormat
1729
- }), Q = (A == null ? void 0 : A.type) === "duration" ? A : A ? E(
1730
+ }), Y = (A == null ? void 0 : A.type) === "duration" ? A : A ? _(
1730
1731
  A,
1731
1732
  e.reportContext.valueFormat,
1732
- W
1733
- ) : E(
1733
+ Q
1734
+ ) : _(
1734
1735
  {
1735
1736
  type: "number",
1736
1737
  minimumFractionDigits: 0,
@@ -1739,15 +1740,15 @@ function Sr(e) {
1739
1740
  e.reportContext.valueFormat
1740
1741
  );
1741
1742
  return [
1742
- Q.type === "duration" ? { scope: j, target: K, format: Q } : { scope: j, target: K, format: Q }
1743
+ Y.type === "duration" ? { scope: U, target: B, format: Y } : { scope: U, target: B, format: Y }
1743
1744
  ];
1744
1745
  });
1745
- g.push(
1746
+ h.push(
1746
1747
  ...[...y.byColumnKey.values()].map((p) => {
1747
- const b = h.get(
1748
+ const g = b.get(
1748
1749
  `${p.role ?? "groupby"}:${p.fieldId}`
1749
1750
  );
1750
- if (!b)
1751
+ if (!g)
1751
1752
  throw new Error(
1752
1753
  `Unable to resolve temporal export field "${p.fieldId}".`
1753
1754
  );
@@ -1757,8 +1758,8 @@ function Sr(e) {
1757
1758
  cardId: e.card.id
1758
1759
  },
1759
1760
  target: { kind: "column", columnKey: p.columnKey },
1760
- format: Ue(
1761
- b,
1761
+ format: He(
1762
+ g,
1762
1763
  {
1763
1764
  dateStyle: e.reportContext.valueFormat.dateStyle,
1764
1765
  dateTime: { ...e.reportContext.valueFormat.dateTime }
@@ -1767,7 +1768,7 @@ function Sr(e) {
1767
1768
  )
1768
1769
  };
1769
1770
  })
1770
- ), g.push(
1771
+ ), h.push(
1771
1772
  ...((d == null ? void 0 : d.fields) || []).flatMap(
1772
1773
  (p) => p.role === "pivotby" ? [
1773
1774
  {
@@ -1780,7 +1781,7 @@ function Sr(e) {
1780
1781
  fieldId: p.id,
1781
1782
  role: p.role
1782
1783
  },
1783
- format: Ue(
1784
+ format: He(
1784
1785
  p,
1785
1786
  {
1786
1787
  dateStyle: e.reportContext.valueFormat.dateStyle,
@@ -1791,32 +1792,32 @@ function Sr(e) {
1791
1792
  }
1792
1793
  ] : []
1793
1794
  )
1794
- ), g.push(
1795
- ...[...m].map(([p, b]) => ({
1795
+ ), h.push(
1796
+ ...[...m].map(([p, g]) => ({
1796
1797
  scope: { dashboardId: e.dashboardId, cardId: e.card.id },
1797
1798
  target: { kind: "column", columnKey: p },
1798
- format: b
1799
+ format: g
1799
1800
  }))
1800
1801
  );
1801
- const C = Vi({
1802
+ const C = Ki({
1802
1803
  reportContext: e.reportContext,
1803
- resolvedFormats: g
1804
+ resolvedFormats: h
1804
1805
  });
1805
1806
  return {
1806
1807
  formatOptions: {
1807
1808
  ...e.formatOptions,
1808
1809
  ...o ? { tableTotalsLabelColumnKey: o } : {},
1809
- comparisonPresentation: xr(e.card),
1810
+ comparisonPresentation: wr(e.card),
1810
1811
  presentationExecutionSnapshot: C
1811
1812
  },
1812
1813
  ...s ? { tableTotalsRequest: s } : {}
1813
1814
  };
1814
1815
  }
1815
- function Mr(e) {
1816
- const t = xi(
1816
+ function Or(e) {
1817
+ const t = Ti(
1817
1818
  e.card,
1818
1819
  e.requestPayloadBase
1819
- ), { cardId: i, ...n } = t.requestPayloadBase, r = Sr(e);
1820
+ ), { cardId: i, ...n } = t.requestPayloadBase, r = Pr(e);
1820
1821
  return {
1821
1822
  type: "card",
1822
1823
  dashboardId: e.dashboardId,
@@ -1830,13 +1831,13 @@ function Mr(e) {
1830
1831
  formatOptions: r.formatOptions
1831
1832
  };
1832
1833
  }
1833
- function oo(e) {
1834
+ function vo(e) {
1834
1835
  const { card: t, result: i } = e;
1835
1836
  if (t.type !== "table" && t.type !== "detailTable")
1836
1837
  return { status: "refused", reason: "not_a_table" };
1837
- if (Ii({ card: t, comparisonMetadata: i.comparisonMetadata }))
1838
+ if (Di({ card: t, comparisonMetadata: i.comparisonMetadata }))
1838
1839
  return { status: "refused", reason: "comparison_metadata_missing" };
1839
- const n = Ir({
1840
+ const n = Tr({
1840
1841
  card: t,
1841
1842
  effectiveCardConfig: e.effectiveCardConfig,
1842
1843
  rows: e.rows,
@@ -1847,7 +1848,7 @@ function oo(e) {
1847
1848
  });
1848
1849
  return n ? {
1849
1850
  status: "ready",
1850
- request: Mr({
1851
+ request: Or({
1851
1852
  card: t,
1852
1853
  dashboardId: e.dashboardId,
1853
1854
  title: e.title,
@@ -1863,9 +1864,9 @@ function oo(e) {
1863
1864
  })
1864
1865
  } : { status: "refused", reason: "columns_unresolved" };
1865
1866
  }
1866
- function Dr(e, t, i) {
1867
- if (wi(
1868
- Pi(t),
1867
+ function Ar(e, t, i) {
1868
+ if (_i(
1869
+ Ei(t),
1869
1870
  e.aggregateOrigin
1870
1871
  ))
1871
1872
  return { aggregate: void 0, aggregateOrigin: void 0 };
@@ -1875,7 +1876,7 @@ function Dr(e, t, i) {
1875
1876
  aggregateOrigin: e.aggregate ? e.aggregateOrigin : n ? t.aggregateOrigin : void 0
1876
1877
  };
1877
1878
  }
1878
- function Tr(e, t, i) {
1879
+ function Nr(e, t, i) {
1879
1880
  var n, r, a, o, s, l;
1880
1881
  if (i === "domain")
1881
1882
  return {
@@ -1888,7 +1889,7 @@ function Tr(e, t, i) {
1888
1889
  windowTransform: ((s = e.parameters) == null ? void 0 : s.windowTransform) ?? ((l = t.parameters) == null ? void 0 : l.windowTransform)
1889
1890
  };
1890
1891
  }
1891
- function so(e, t, i) {
1892
+ function Fo(e, t, i) {
1892
1893
  const n = e;
1893
1894
  return {
1894
1895
  id: e.id,
@@ -1900,22 +1901,22 @@ function so(e, t, i) {
1900
1901
  dateFormat: e.dateFormat,
1901
1902
  customFormat: e.customFormat,
1902
1903
  semanticTemporalPresentation: t.semanticTemporalPresentation || e.semanticTemporalPresentation,
1903
- ...Dr(e, t, i),
1904
+ ...Ar(e, t, i),
1904
1905
  ...e.role === "metric" ? {
1905
1906
  aliasTemplate: n.aliasTemplate,
1906
1907
  valueAliases: n.valueAliases,
1907
1908
  comparison: n.comparison,
1908
1909
  comparisonPolarity: n.comparisonPolarity,
1909
- parameters: Tr(
1910
+ parameters: Nr(
1910
1911
  n,
1911
1912
  t,
1912
1913
  "domain"
1913
1914
  )
1914
1915
  } : {},
1915
- ...wr(e)
1916
+ ..._r(e)
1916
1917
  };
1917
1918
  }
1918
- function wr(e) {
1919
+ function _r(e) {
1919
1920
  const t = {
1920
1921
  ...e.labelOrigin === "override" ? { label: e.label, labelOrigin: e.labelOrigin } : {},
1921
1922
  ...e.formatOrigin === "override" ? { format: e.format, formatOrigin: e.formatOrigin } : {}
@@ -1941,73 +1942,73 @@ function wr(e) {
1941
1942
  return t;
1942
1943
  }
1943
1944
  }
1944
- const Pr = "table";
1945
- function lo({ preferences: e, ...t }) {
1945
+ const Er = "table";
1946
+ function Co({ preferences: e, ...t }) {
1946
1947
  return {
1947
1948
  ...t,
1948
- type: Pr,
1949
+ type: Er,
1949
1950
  preferences: e ?? { onClickFilter: [{ columnIndex: 0, expression: "" }] },
1950
1951
  sql: "",
1951
1952
  data: []
1952
1953
  };
1953
1954
  }
1954
- function Or(e, t) {
1955
+ function Rr(e, t) {
1955
1956
  const i = e.sheets ?? [], n = i.findIndex((o) => o.id === t.sheetId), r = i[n];
1956
1957
  if (!r)
1957
1958
  throw new N("sheet_not_found", `No sheet ${t.sheetId} on this dashboard.`);
1958
- if (Hi(r))
1959
+ if (Ji(r))
1959
1960
  throw new N(
1960
1961
  "sheet_not_a_grid",
1961
1962
  "This sheet is a document: it has no grid to arrange.",
1962
1963
  "Arrange a grid sheet; Document sheets are laid out in the editor."
1963
1964
  );
1964
- const a = Ft(r, { kind: "arrange", keepOrder: t.keepOrder === !0 });
1965
+ const a = It(r, { kind: "arrange", keepOrder: t.keepOrder === !0 });
1965
1966
  return {
1966
1967
  dashboard: { ...e, sheets: i.map((o, s) => s === n ? a : o) },
1967
- clauses: [we.arranged(r.title || "the dashboard", t.keepOrder === !0, !(r.frames ?? []).length)]
1968
+ clauses: [Oe.arranged(r.title || "the dashboard", t.keepOrder === !0, !(r.frames ?? []).length)]
1968
1969
  };
1969
1970
  }
1970
- function Ar(e) {
1971
+ function Vr(e) {
1971
1972
  return !!(e && Object.prototype.hasOwnProperty.call(e, "calculatedFields"));
1972
1973
  }
1973
1974
  function z(...e) {
1974
- return Gi(e.flatMap((t) => t || []));
1975
+ return Xi(e.flatMap((t) => t || []));
1975
1976
  }
1976
- function G(e, t) {
1977
+ function W(e, t) {
1977
1978
  return {
1978
1979
  ...e,
1979
1980
  fieldScope: t
1980
1981
  };
1981
1982
  }
1982
- function Be(e) {
1983
- return ((e == null ? void 0 : e.calculatedFields) || []).filter((t) => t.fieldScope === "sheet").map((t) => G(t, "sheet"));
1983
+ function Ke(e) {
1984
+ return ((e == null ? void 0 : e.calculatedFields) || []).filter((t) => t.fieldScope === "sheet").map((t) => W(t, "sheet"));
1984
1985
  }
1985
- function jt(e) {
1986
- return ((e == null ? void 0 : e.calculatedFields) || []).filter((t) => !t.fieldScope).map((t) => G(t, "sheet"));
1986
+ function Ht(e) {
1987
+ return ((e == null ? void 0 : e.calculatedFields) || []).filter((t) => !t.fieldScope).map((t) => W(t, "sheet"));
1987
1988
  }
1988
- function Nr(e) {
1989
+ function kr(e) {
1989
1990
  return e ? [
1990
1991
  ...(e.calculatedFields || []).filter(
1991
1992
  (t) => t.fieldScope === "dashboard"
1992
1993
  ),
1993
1994
  ...(e.frames || []).flatMap((t) => t.calculatedFields || [])
1994
- ].map((t) => G(t, "dashboard")) : [];
1995
+ ].map((t) => W(t, "dashboard")) : [];
1995
1996
  }
1996
- function Er(e) {
1997
+ function Br(e) {
1997
1998
  if (e !== void 0)
1998
1999
  return z(
1999
- e.map((t) => G(t, "dashboard"))
2000
+ e.map((t) => W(t, "dashboard"))
2000
2001
  );
2001
2002
  }
2002
- function co(e) {
2003
+ function Io(e) {
2003
2004
  var n;
2004
2005
  const t = [], i = (e.sheets || []).map((r) => {
2005
2006
  var a;
2006
- return t.push(...Nr(r)), {
2007
+ return t.push(...kr(r)), {
2007
2008
  ...r,
2008
2009
  calculatedFields: z(
2009
- Be(r),
2010
- jt(r)
2010
+ Ke(r),
2011
+ Ht(r)
2011
2012
  ),
2012
2013
  frames: (a = r.frames) == null ? void 0 : a.map(
2013
2014
  (o) => o.calculatedFields === void 0 ? o : { ...o, calculatedFields: void 0 }
@@ -2016,10 +2017,10 @@ function co(e) {
2016
2017
  });
2017
2018
  return {
2018
2019
  ...e,
2019
- calculatedFields: Er(
2020
+ calculatedFields: Br(
2020
2021
  z(
2021
2022
  (n = e.calculatedFields) == null ? void 0 : n.map(
2022
- (r) => G(r, "dashboard")
2023
+ (r) => W(r, "dashboard")
2023
2024
  ),
2024
2025
  t
2025
2026
  )
@@ -2027,7 +2028,7 @@ function co(e) {
2027
2028
  sheets: i
2028
2029
  };
2029
2030
  }
2030
- function at(e, t) {
2031
+ function st(e, t) {
2031
2032
  var r;
2032
2033
  if (!((r = e == null ? void 0 : e.frames) != null && r.length))
2033
2034
  return [];
@@ -2039,30 +2040,30 @@ function at(e, t) {
2039
2040
  ...n.map((a) => a.calculatedFields)
2040
2041
  );
2041
2042
  }
2042
- function uo(e, t) {
2043
- return e ? Be(e) : [];
2043
+ function xo(e, t) {
2044
+ return e ? Ke(e) : [];
2044
2045
  }
2045
- function fo(e, t) {
2046
+ function So(e, t) {
2046
2047
  if (!e)
2047
2048
  return [];
2048
- const i = Be(e), n = jt(e), r = z(
2049
+ const i = Ke(e), n = Ht(e), r = z(
2049
2050
  i,
2050
2051
  n
2051
2052
  );
2052
- return Ar(e) ? r.length === 0 ? [] : n.length === 0 ? r : z(
2053
+ return Vr(e) ? r.length === 0 ? [] : n.length === 0 ? r : z(
2053
2054
  r,
2054
- at(e, t)
2055
- ) : at(e, t);
2055
+ st(e, t)
2056
+ ) : st(e, t);
2056
2057
  }
2057
- function Vr(e) {
2058
+ function Kr(e) {
2058
2059
  if (e !== void 0)
2059
2060
  return z(
2060
- e.map((t) => G(t, "sheet"))
2061
+ e.map((t) => W(t, "sheet"))
2061
2062
  );
2062
2063
  }
2063
- function mo(e) {
2064
+ function Mo(e) {
2064
2065
  const { field: t, sheetFields: i = [], dashboardFields: n = [] } = e, r = (s) => s.find(
2065
- (l) => Wi(l, t, {
2066
+ (l) => Zi(l, t, {
2066
2067
  allowComparableFallback: !0
2067
2068
  })
2068
2069
  );
@@ -2076,7 +2077,7 @@ function mo(e) {
2076
2077
  const o = r(n);
2077
2078
  return o ? { scope: "dashboard", matchedField: o } : { scope: "card" };
2078
2079
  }
2079
- function _r(e, t) {
2080
+ function Lr(e, t) {
2080
2081
  var C, D, w;
2081
2082
  const i = (e.sheets ?? []).findIndex((F) => F.id === t.sheetId), n = (C = e.sheets) == null ? void 0 : C[i];
2082
2083
  if (!(n != null && n.frames))
@@ -2084,40 +2085,40 @@ function _r(e, t) {
2084
2085
  const { frame: r } = t, a = n.frames.findIndex((F) => F.id === r.id);
2085
2086
  if (a === -1)
2086
2087
  throw new N("frame_not_found", `No frame ${r.id} on sheet ${t.sheetId}.`);
2087
- const o = n.frames[a], s = He(n), l = (F) => F.calculatedFields === void 0 ? F : { ...F, calculatedFields: void 0 }, c = t.rewrittenFrames, u = c && c.length > 0 ? (() => {
2088
+ const o = n.frames[a], s = We(n), l = (F) => F.calculatedFields === void 0 ? F : { ...F, calculatedFields: void 0 }, c = t.rewrittenFrames, u = c && c.length > 0 ? (() => {
2088
2089
  const F = c.map((S) => S.id === r.id ? r : S);
2089
2090
  return F.some((S) => S.id === r.id) ? F : [r, ...F];
2090
- })() : [r], f = new Map(u.map((F) => [F.id, F])), d = Ft(n, { kind: "frame_updated", frame: r, resizeForNewKind: t.resizeLayouts });
2091
+ })() : [r], f = new Map(u.map((F) => [F.id, F])), d = It(n, { kind: "frame_updated", frame: r, resizeForNewKind: t.resizeLayouts });
2091
2092
  let y = /* @__PURE__ */ new Set();
2092
- const v = Qi.produce(e, (F) => {
2093
+ const v = en.produce(e, (F) => {
2093
2094
  const S = F.sheets[i];
2094
- d.layouts !== n.layouts && (S.layouts = Ge(d.layouts)), d.customizedBreakpoints !== n.customizedBreakpoints && (S.customizedBreakpoints = d.customizedBreakpoints), t.sheetCalculatedFields !== void 0 && (S.calculatedFields = Vr(t.sheetCalculatedFields)), S.frames = S.frames.map((p) => {
2095
- const b = f.get(p.id);
2096
- return b ? Ge(l(b)) : p.calculatedFields === void 0 ? p : { ...p, calculatedFields: void 0 };
2095
+ d.layouts !== n.layouts && (S.layouts = Qe(d.layouts)), d.customizedBreakpoints !== n.customizedBreakpoints && (S.customizedBreakpoints = d.customizedBreakpoints), t.sheetCalculatedFields !== void 0 && (S.calculatedFields = Kr(t.sheetCalculatedFields)), S.frames = S.frames.map((p) => {
2096
+ const g = f.get(p.id);
2097
+ return g ? Qe(l(g)) : p.calculatedFields === void 0 ? p : { ...p, calculatedFields: void 0 };
2097
2098
  });
2098
- const V = He(S);
2099
- y = new Set([...s].filter((p) => !V.has(p))), Ji(F, y), t.dashboardCalculatedFields && (F.calculatedFields = t.dashboardCalculatedFields);
2100
- }), h = v.sheets[i].frames.find((F) => F.id === r.id), m = [
2099
+ const E = We(S);
2100
+ y = new Set([...s].filter((p) => !E.has(p))), tn(F, y), t.dashboardCalculatedFields && (F.calculatedFields = t.dashboardCalculatedFields);
2101
+ }), b = v.sheets[i].frames.find((F) => F.id === r.id), m = [
2101
2102
  ...y.size ? [{ kind: "cards_removed", cardIds: [...y] }] : [],
2102
- { kind: "frame_committed", sheetId: t.sheetId, before: o, after: h }
2103
- ], g = ((D = r.cards) == null ? void 0 : D.find((F) => F.id === r.activeCardId)) ?? ((w = r.cards) == null ? void 0 : w[0]);
2104
- return { dashboard: v, runtimeEffects: m, clauses: [we.committed(g == null ? void 0 : g.title)] };
2103
+ { kind: "frame_committed", sheetId: t.sheetId, before: o, after: b }
2104
+ ], h = ((D = r.cards) == null ? void 0 : D.find((F) => F.id === r.activeCardId)) ?? ((w = r.cards) == null ? void 0 : w[0]);
2105
+ return { dashboard: v, runtimeEffects: m, clauses: [Oe.committed(h == null ? void 0 : h.title)] };
2105
2106
  }
2106
- function Rr(e, t, i) {
2107
+ function qr(e, t, i) {
2107
2108
  var a;
2108
2109
  if (!e || !t || t.customFilterPreferences) return;
2109
2110
  const n = t.defaultDateFilter;
2110
- return (t.dateSelectionMode === "day" ? Zi(n) : t.dateSelectionMode === "months" && (en(n) || tn(n) && n.unit === "month" && (n.mode === "previous" || n.mode === "this" && !n.toDate && !n.boundary))) && ((a = U(t, i)) == null ? void 0 : a.valueType) === "date" ? !0 : void 0;
2111
+ return (t.dateSelectionMode === "day" ? an(n) : t.dateSelectionMode === "months" && (on(n) || sn(n) && n.unit === "month" && (n.mode === "previous" || n.mode === "this" && !n.toDate && !n.boundary))) && ((a = G(t, i)) == null ? void 0 : a.valueType) === "date" ? !0 : void 0;
2111
2112
  }
2112
- function po(e) {
2113
- const t = e.createId ?? St, i = t(), n = Si({
2113
+ function Do(e) {
2114
+ const t = e.createId ?? Dt, i = t(), n = wi({
2114
2115
  field: e.field,
2115
2116
  dataSource: e.dataSource,
2116
2117
  connectionId: e.connectionId,
2117
2118
  connectionType: e.connectionType,
2118
2119
  filterId: t()
2119
2120
  });
2120
- return Br({
2121
+ return $r({
2121
2122
  filter: e.label ? { ...n, title: e.label } : n,
2122
2123
  label: e.label || e.field.label || e.field.name,
2123
2124
  scope: e.scope,
@@ -2125,11 +2126,11 @@ function po(e) {
2125
2126
  createId: () => i
2126
2127
  });
2127
2128
  }
2128
- function Br(e) {
2129
- const t = e.createId ?? St, i = e.label || e.filter.title || e.filter.column || e.filter.id, n = Yi(i, [
2129
+ function $r(e) {
2130
+ const t = e.createId ?? Dt, i = e.label || e.filter.title || e.filter.column || e.filter.id, n = nn(i, [
2130
2131
  ...e.existingInputs
2131
2132
  ]), r = {
2132
- ...Ct(e.filter),
2133
+ ...xt(e.filter),
2133
2134
  variableName: n
2134
2135
  };
2135
2136
  return {
@@ -2140,13 +2141,13 @@ function Br(e) {
2140
2141
  requiredAtExecution: !1,
2141
2142
  scope: e.scope,
2142
2143
  runtimeScope: "shared",
2143
- presentation: xt(r),
2144
+ presentation: Mt(r),
2144
2145
  filter: r,
2145
- exports: It(r)
2146
+ exports: St(r)
2146
2147
  };
2147
2148
  }
2148
- function Kr(e, t, i, n = { calendar: null }) {
2149
- var J, Y, X, Z, ee, Le, qe, ze;
2149
+ function zr(e, t, i, n = { calendar: null }) {
2150
+ var J, X, Z, ee, te, $e, ze, je;
2150
2151
  const r = q(e), a = r.findFilterInput(t), o = (M, x) => ({
2151
2152
  ok: !1,
2152
2153
  issues: [
@@ -2179,112 +2180,112 @@ function Kr(e, t, i, n = { calendar: null }) {
2179
2180
  if (i.mapping.draft.inputId !== s.id)
2180
2181
  return o("The card mapping was prepared for another filter.");
2181
2182
  }
2182
- const c = i.definition ? Ct(i.definition) : l;
2183
- if (c.kind === "global-date" && i.scope && !kr(i.scope))
2183
+ const c = i.definition ? xt(i.definition) : l;
2184
+ if (c.kind === "global-date" && i.scope && !jr(i.scope))
2184
2185
  return o("The Global Date filter applies to regular tabs only.");
2185
- const u = (Y = n.calendar) == null ? void 0 : Y.tz, f = i.definition !== void 0, d = i.forceSelection !== void 0 || f ? Rr(
2186
+ const u = (X = n.calendar) == null ? void 0 : X.tz, f = i.definition !== void 0, d = i.forceSelection !== void 0 || f ? qr(
2186
2187
  i.forceSelection ?? s.forceSelection,
2187
2188
  c,
2188
2189
  u
2189
- ) : s.forceSelection ? !0 : void 0, y = (Array.isArray(e.inputs) ? e.inputs : []).filter((M) => M.id !== s.id), v = i.variableName !== void 0 ? Xi(i.variableName, [
2190
+ ) : s.forceSelection ? !0 : void 0, y = (Array.isArray(e.inputs) ? e.inputs : []).filter((M) => M.id !== s.id), v = i.variableName !== void 0 ? rn(i.variableName, [
2190
2191
  ...y,
2191
2192
  ...r.inputs.filter((M) => M.input.id !== s.id).map((M) => M.input)
2192
- ]) : s.variableName, h = f && (l.title || l.column) !== (c.title || c.column), m = i.label ?? (h ? c.title || c.column || c.id : void 0), g = f && l.hide !== c.hide, C = f && l.toolbarWidth !== c.toolbarWidth, D = (M) => {
2193
- var $e, je;
2193
+ ]) : s.variableName, b = f && (l.title || l.column) !== (c.title || c.column), m = i.label ?? (b ? c.title || c.column || c.id : void 0), h = f && l.hide !== c.hide, C = f && l.toolbarWidth !== c.toolbarWidth, D = (M) => {
2194
+ var Ue, Ge;
2194
2195
  const x = { ...M };
2195
- if (m !== void 0 && (x.label = m), i.variableName !== void 0 && (x.variableName = v), i.scope && (x.scope = i.scope), g || C) {
2196
- const ge = xt(c);
2197
- x.presentation = { ...M.presentation }, g && (x.presentation.placement = ge.placement), C && (ge.widthPx === void 0 ? delete x.presentation.widthPx : x.presentation.widthPx = ge.widthPx);
2196
+ if (m !== void 0 && (x.label = m), i.variableName !== void 0 && (x.variableName = v), i.scope && (x.scope = i.scope), h || C) {
2197
+ const be = Mt(c);
2198
+ x.presentation = { ...M.presentation }, h && (x.presentation.placement = be.placement), C && (be.widthPx === void 0 ? delete x.presentation.widthPx : x.presentation.widthPx = be.widthPx);
2198
2199
  }
2199
- return (i.forceSelection !== void 0 || f) && (d ? x.forceSelection = d : delete x.forceSelection), i.requiredAtExecution !== void 0 && (i.requiredAtExecution ? x.requiredAtExecution = !0 : delete x.requiredAtExecution), Fe(x, "optionSource", i.optionSource), Fe(x, "optionDependencies", i.optionDependencies), Fe(x, "optionPopulation", i.optionPopulation), (($e = i.mapping) == null ? void 0 : $e.kind) === "save" && i.mapping.draft.acceptance.ok ? x.application = i.mapping.draft.acceptance.application : ((je = i.mapping) == null ? void 0 : je.kind) === "remove" && delete x.application, x;
2200
+ return (i.forceSelection !== void 0 || f) && (d ? x.forceSelection = d : delete x.forceSelection), i.requiredAtExecution !== void 0 && (i.requiredAtExecution ? x.requiredAtExecution = !0 : delete x.requiredAtExecution), Ie(x, "optionSource", i.optionSource), Ie(x, "optionDependencies", i.optionDependencies), Ie(x, "optionPopulation", i.optionPopulation), ((Ue = i.mapping) == null ? void 0 : Ue.kind) === "save" && i.mapping.draft.acceptance.ok ? x.application = i.mapping.draft.acceptance.application : ((Ge = i.mapping) == null ? void 0 : Ge.kind) === "remove" && delete x.application, x;
2200
2201
  }, w = i.label !== void 0 && i.label !== s.label && i.label !== c.title ? i.label : void 0, F = f || i.variableName !== void 0 || w !== void 0, S = (M) => ({
2201
2202
  ...M,
2202
2203
  ...i.variableName !== void 0 ? { variableName: v } : {},
2203
2204
  ...w !== void 0 ? { title: w } : {}
2204
- }), V = Array.isArray(e.inputs) ? [...e.inputs] : [], p = V.findIndex((M) => M.id === s.id), b = V[p];
2205
- if (p < 0 || (b == null ? void 0 : b.kind) !== "filter" || !b.filter)
2205
+ }), E = Array.isArray(e.inputs) ? [...e.inputs] : [], p = E.findIndex((M) => M.id === s.id), g = E[p];
2206
+ if (p < 0 || (g == null ? void 0 : g.kind) !== "filter" || !g.filter)
2206
2207
  return o("This filter can not be edited here.");
2207
2208
  const I = D(
2208
2209
  F ? {
2209
- ...b,
2210
+ ...g,
2210
2211
  filter: S(c)
2211
- } : b
2212
+ } : g
2212
2213
  );
2213
- f && (I.exports = It(c)), V[p] = I;
2214
- const _ = Ae({
2214
+ f && (I.exports = St(c)), E[p] = I;
2215
+ const R = _e({
2215
2216
  inputs: [I],
2216
2217
  dashboardFilters: []
2217
2218
  });
2218
- if (!_.ok)
2219
+ if (!R.ok)
2219
2220
  return o(
2220
- ((X = _.issues[0]) == null ? void 0 : X.message) ?? "These settings could not be saved.",
2221
- _.issues[0]
2221
+ ((Z = R.issues[0]) == null ? void 0 : Z.message) ?? "These settings could not be saved.",
2222
+ R.issues[0]
2222
2223
  );
2223
- let O = { ...e, inputs: V };
2224
- const W = q(O), R = W.findFilterInput({ filterId: c.id });
2225
- if (!R)
2224
+ let O = { ...e, inputs: E };
2225
+ const Q = q(O), V = Q.findFilterInput({ filterId: c.id });
2226
+ if (!V)
2226
2227
  return o(
2227
- ((Z = W.issues[0]) == null ? void 0 : Z.message) ?? "These settings could not be saved."
2228
+ ((ee = Q.issues[0]) == null ? void 0 : ee.message) ?? "These settings could not be saved."
2228
2229
  );
2229
- const j = i.variableName !== void 0 || i.scope !== void 0 ? Lr(O, R.input) : void 0;
2230
- if (j)
2230
+ const U = i.variableName !== void 0 || i.scope !== void 0 ? Ur(O, V.input) : void 0;
2231
+ if (U)
2231
2232
  return o(
2232
- `Another filter on the same cards is already named "${j}". Choose another name.`
2233
+ `Another filter on the same cards is already named "${U}". Choose another name.`
2233
2234
  );
2234
- const K = [], T = {
2235
- id: R.input.id,
2236
- runtimeScope: R.input.runtimeScope
2235
+ const B = [], T = {
2236
+ id: V.input.id,
2237
+ runtimeScope: V.input.runtimeScope
2237
2238
  };
2238
2239
  let A = {
2239
2240
  defaultInputValues: O.defaultInputValues,
2240
2241
  dashboardInputValues: {}
2241
2242
  };
2242
- const Q = ((ee = i.values) == null ? void 0 : ee.target) ?? {}, P = $r(
2243
+ const Y = ((te = i.values) == null ? void 0 : te.target) ?? {}, P = Wr(
2243
2244
  l,
2244
2245
  c,
2245
2246
  {
2246
- defaultValueChanged: (Le = i.values) == null ? void 0 : Le.defaultChanged,
2247
- selectionIdentityChanged: (qe = i.values) == null ? void 0 : qe.selectionIdentityChanged,
2248
- ...((ze = i.values) == null ? void 0 : ze.defaultComparisonSelection) !== void 0 ? {
2247
+ defaultValueChanged: ($e = i.values) == null ? void 0 : $e.defaultChanged,
2248
+ selectionIdentityChanged: (ze = i.values) == null ? void 0 : ze.selectionIdentityChanged,
2249
+ ...((je = i.values) == null ? void 0 : je.defaultComparisonSelection) !== void 0 ? {
2249
2250
  defaultComparisonChanged: !0,
2250
2251
  defaultComparisonSelection: i.values.defaultComparisonSelection ?? void 0
2251
2252
  } : {}
2252
2253
  },
2253
- Q,
2254
+ Y,
2254
2255
  n.calendar ?? void 0
2255
2256
  );
2256
2257
  if (P.defaultValueChanged || P.selectionIdentityChanged || P.defaultComparisonChanged) {
2257
- const M = Ut({
2258
+ const M = Wt({
2258
2259
  state: { ...A, dashboardInputValues: {} },
2259
2260
  input: T,
2260
2261
  settings: P
2261
2262
  });
2262
- A = { ...A, defaultInputValues: M.defaultInputValues }, P.selectionIdentityChanged && K.push({
2263
+ A = { ...A, defaultInputValues: M.defaultInputValues }, P.selectionIdentityChanged && B.push({
2263
2264
  kind: "clear",
2264
2265
  inputId: T.id,
2265
2266
  target: P.target
2266
- }), P.defaultValueChanged && K.push({
2267
+ }), P.defaultValueChanged && B.push({
2267
2268
  kind: "resetToDefault",
2268
2269
  inputId: T.id,
2269
2270
  target: P.target,
2270
2271
  ...P.defaultFilterValue ? { filterValue: P.defaultFilterValue } : {}
2271
- }), P.defaultComparisonChanged && K.push({
2272
+ }), P.defaultComparisonChanged && B.push({
2272
2273
  kind: "setDefaultComparison",
2273
2274
  inputId: T.id,
2274
2275
  target: P.target
2275
2276
  });
2276
2277
  }
2277
- if (i.scope && R.input.runtimeScope !== "shared") {
2278
- const M = qr(
2278
+ if (i.scope && V.input.runtimeScope !== "shared") {
2279
+ const M = Gr(
2279
2280
  O,
2280
2281
  s,
2281
- R.input,
2282
+ V.input,
2282
2283
  A.defaultInputValues
2283
2284
  );
2284
2285
  A = {
2285
2286
  ...A,
2286
2287
  defaultInputValues: M.defaultInputValues
2287
- }, K.push(
2288
+ }, B.push(
2288
2289
  ...M.dropped.map((x) => ({
2289
2290
  kind: "dropTargetSlot",
2290
2291
  inputId: T.id,
@@ -2292,15 +2293,15 @@ function Kr(e, t, i, n = { calendar: null }) {
2292
2293
  }))
2293
2294
  );
2294
2295
  }
2295
- return O = zr(O, A), {
2296
+ return O = Hr(O, A), {
2296
2297
  ok: !0,
2297
2298
  dashboard: O,
2298
- inputId: R.input.id,
2299
- valueEffects: K
2299
+ inputId: V.input.id,
2300
+ valueEffects: B
2300
2301
  };
2301
2302
  }
2302
- function yo(e) {
2303
- let t = We({
2303
+ function To(e) {
2304
+ let t = Ye({
2304
2305
  dashboard: e.before,
2305
2306
  runtimeValues: e.dashboardInputValues,
2306
2307
  calendar: e.calendar
@@ -2316,7 +2317,7 @@ function yo(e) {
2316
2317
  case "setDefaultComparison": {
2317
2318
  const a = n(r.inputId);
2318
2319
  if (!a) break;
2319
- t = Ut({
2320
+ t = Wt({
2320
2321
  state: { dashboardInputValues: t },
2321
2322
  input: a,
2322
2323
  settings: {
@@ -2332,7 +2333,7 @@ function yo(e) {
2332
2333
  case "dropTargetSlot": {
2333
2334
  const a = n(r.inputId);
2334
2335
  if (!a) break;
2335
- t = Pe(
2336
+ t = Ae(
2336
2337
  t,
2337
2338
  a,
2338
2339
  r.target
@@ -2340,20 +2341,20 @@ function yo(e) {
2340
2341
  break;
2341
2342
  }
2342
2343
  }
2343
- return We({
2344
+ return Ye({
2344
2345
  dashboard: e.after,
2345
2346
  runtimeValues: t,
2346
2347
  calendar: e.calendar
2347
2348
  });
2348
2349
  }
2349
- function kr(e) {
2350
+ function jr(e) {
2350
2351
  var t;
2351
2352
  return e.kind !== "documentSections" && (e.kind !== "allSheets" || ((t = e.sheetKinds) == null ? void 0 : t.length) === 1 && e.sheetKinds[0] === "dashboard");
2352
2353
  }
2353
- function Fe(e, t, i) {
2354
+ function Ie(e, t, i) {
2354
2355
  i !== void 0 && (i === null ? delete e[t] : e[t] = i);
2355
2356
  }
2356
- function Lr(e, t) {
2357
+ function Ur(e, t) {
2357
2358
  const i = [
2358
2359
  ...q(e).inputs.map((r) => r.input),
2359
2360
  ...(Array.isArray(e.inputs) ? e.inputs : []).filter(
@@ -2363,21 +2364,21 @@ function Lr(e, t) {
2363
2364
  (r) => r.id !== t.id && r.variableName === t.variableName
2364
2365
  );
2365
2366
  if (!i.length) return;
2366
- const n = Xe(e, t);
2367
+ const n = et(e, t);
2367
2368
  return i.some(
2368
- (r) => [...Xe(e, r)].some(
2369
+ (r) => [...et(e, r)].some(
2369
2370
  (a) => n.has(a)
2370
2371
  )
2371
2372
  ) ? t.variableName : void 0;
2372
2373
  }
2373
- function qr(e, t, i, n) {
2374
+ function Gr(e, t, i, n) {
2374
2375
  var u, f;
2375
- const r = [], a = Mt(e), o = (d) => ot(t, d, a), s = (d) => ot(i, d, a), l = [];
2376
+ const r = [], a = Tt(e), o = (d) => lt(t, d, a), s = (d) => lt(i, d, a), l = [];
2376
2377
  if (i.runtimeScope === "perSheet")
2377
2378
  for (const d of a.values())
2378
2379
  l.push({ sheetId: d.sheetId, sheetKind: d.sheetKind });
2379
2380
  else if (i.runtimeScope === "perCard")
2380
- for (const d of fe(e))
2381
+ for (const d of pe(e))
2381
2382
  l.push({
2382
2383
  sheetId: d.sheetId,
2383
2384
  cardId: d.cardId,
@@ -2394,56 +2395,56 @@ function qr(e, t, i, n) {
2394
2395
  let c = n;
2395
2396
  for (const d of l) {
2396
2397
  if (s(d)) continue;
2397
- const y = !!(c && Oe(c, i, d));
2398
- if (y && (c = Pe(c, i, d)), y || o(d)) {
2399
- const { sheetKind: v, ...h } = d;
2400
- r.push(h);
2398
+ const y = !!(c && Ne(c, i, d));
2399
+ if (y && (c = Ae(c, i, d)), y || o(d)) {
2400
+ const { sheetKind: v, ...b } = d;
2401
+ r.push(b);
2401
2402
  }
2402
2403
  }
2403
2404
  return { defaultInputValues: c, dropped: r };
2404
2405
  }
2405
- function ot(e, t, i) {
2406
+ function lt(e, t, i) {
2406
2407
  if (e.runtimeScope === "perSheet" && t.sheetId && !t.cardId && !t.sectionId) {
2407
2408
  const n = i.get(t.sheetId);
2408
- return n ? Dt(e, n) : !1;
2409
+ return n ? wt(e, n) : !1;
2409
2410
  }
2410
- return rn(e, t);
2411
+ return cn(e, t);
2411
2412
  }
2412
- function zr(e, t) {
2413
+ function Hr(e, t) {
2413
2414
  const i = { ...e };
2414
2415
  return t.defaultInputValues && Object.keys(t.defaultInputValues).length ? i.defaultInputValues = t.defaultInputValues : e.defaultInputValues !== void 0 && delete i.defaultInputValues, i;
2415
2416
  }
2416
- function $r(e, t, i, n, r) {
2417
- const a = !!(i != null && i.defaultValueChanged || i != null && i.selectionIdentityChanged) || nn(e, t);
2417
+ function Wr(e, t, i, n, r) {
2418
+ const a = !!(i != null && i.defaultValueChanged || i != null && i.selectionIdentityChanged) || ln(e, t);
2418
2419
  return {
2419
2420
  ...i,
2420
2421
  target: (i == null ? void 0 : i.target) ?? n,
2421
2422
  defaultValueChanged: a,
2422
- defaultFilterValue: a ? U(t, r) : void 0
2423
+ defaultFilterValue: a ? G(t, r) : void 0
2423
2424
  };
2424
2425
  }
2425
- function Ut(e) {
2426
+ function Wt(e) {
2426
2427
  const { settings: t } = e;
2427
2428
  if (!t) return e.state;
2428
2429
  const i = e.input;
2429
2430
  let n = e.state.dashboardInputValues, r = e.state.defaultInputValues;
2430
- if (t.selectionIdentityChanged && (n = Qe(
2431
+ if (t.selectionIdentityChanged && (n = Je(
2431
2432
  n,
2432
2433
  i,
2433
2434
  t.target,
2434
2435
  { status: "cleared" }
2435
2436
  )), t.defaultValueChanged) {
2436
- const a = Oe(
2437
+ const a = Ne(
2437
2438
  r,
2438
2439
  i,
2439
2440
  t.target
2440
2441
  );
2441
- let o = Pe(
2442
+ let o = Ae(
2442
2443
  r || {},
2443
2444
  i,
2444
2445
  t.target
2445
2446
  );
2446
- t.defaultFilterValue ? o = Je(
2447
+ t.defaultFilterValue ? o = Xe(
2447
2448
  o,
2448
2449
  i,
2449
2450
  t.target,
@@ -2455,12 +2456,12 @@ function Ut(e) {
2455
2456
  },
2456
2457
  ...a != null && a.comparisonSelection ? { comparisonSelection: a.comparisonSelection } : {}
2457
2458
  }
2458
- ) : a != null && a.comparisonSelection && (o = Je(
2459
+ ) : a != null && a.comparisonSelection && (o = Xe(
2459
2460
  o,
2460
2461
  i,
2461
2462
  t.target,
2462
2463
  { comparisonSelection: a.comparisonSelection }
2463
- )), r = Object.keys(o).length ? o : void 0, n = Qe(
2464
+ )), r = Object.keys(o).length ? o : void 0, n = Je(
2464
2465
  n,
2465
2466
  i,
2466
2467
  t.target,
@@ -2473,12 +2474,12 @@ function Ut(e) {
2473
2474
  } : { status: "cleared" }
2474
2475
  );
2475
2476
  }
2476
- return t.defaultComparisonChanged && (r = Ye(
2477
+ return t.defaultComparisonChanged && (r = Ze(
2477
2478
  r || {},
2478
2479
  i,
2479
2480
  t.target,
2480
2481
  t.defaultComparisonSelection
2481
- ), Object.keys(r).length || (r = void 0), n = Ye(
2482
+ ), Object.keys(r).length || (r = void 0), n = Ze(
2482
2483
  n,
2483
2484
  i,
2484
2485
  t.target,
@@ -2489,49 +2490,57 @@ function Ut(e) {
2489
2490
  defaultInputValues: r
2490
2491
  };
2491
2492
  }
2492
- const $ = (e) => Array.isArray(e.inputs) ? e.inputs : [];
2493
- function ye(e, t) {
2494
- const i = $(e).find((n) => n.id === t);
2493
+ const j = (e) => Array.isArray(e.inputs) ? e.inputs : [];
2494
+ function ge(e, t) {
2495
+ const i = j(e).find((n) => n.id === t);
2495
2496
  if (!i || i.kind !== "filter")
2496
2497
  throw new N("filter_not_found", `No filter ${t} on this dashboard.`, "Read the outline again and use its filter ids.");
2497
2498
  return i;
2498
2499
  }
2499
- function Ht(e, t) {
2500
+ function Qt(e, t) {
2500
2501
  var i;
2501
- return (i = fe(e).find((n) => n.cardId === t)) == null ? void 0 : i.card.title;
2502
+ return (i = pe(e).find((n) => n.cardId === t)) == null ? void 0 : i.card.title;
2503
+ }
2504
+ function Qr(e, t, i) {
2505
+ const n = q(e), r = n.findFilterInput({ inputId: t });
2506
+ return r ? n.reachedCards({ inputId: t }).filter(
2507
+ (a) => ["bound", "automatic", "sql", "relationshipApplied"].includes(
2508
+ Pi(r.input, a.card, i).reach
2509
+ )
2510
+ ).length : 0;
2502
2511
  }
2503
- function jr(e, t) {
2512
+ function Yr(e, t) {
2504
2513
  const i = q(e), n = i.findFilterInput({ inputId: t });
2505
- return n ? i.reachedCards({ inputId: t }).filter((r) => ["bound", "automatic", "sql"].includes(Mi(n.input, r.card))).length : 0;
2514
+ return n ? i.reachedCards({ inputId: t }).filter((r) => Oi(n.input, r.card) === "relationship").length : 0;
2506
2515
  }
2507
- function Gt(e, t) {
2516
+ function Yt(e, t) {
2508
2517
  if (t.scope.kind === "allSheets") return "every sheet";
2509
2518
  if (t.scope.kind !== "sheets") return "its cards";
2510
- const i = [...Mt(e).values()].filter((n) => Dt(t, n));
2511
- return Tt(i.map((n) => {
2519
+ const i = [...Tt(e).values()].filter((n) => wt(t, n));
2520
+ return Pt(i.map((n) => {
2512
2521
  var r, a;
2513
2522
  return ((a = (r = e.sheets) == null ? void 0 : r.find((o) => o.id === n.sheetId)) == null ? void 0 : a.title) ?? n.sheetId;
2514
2523
  }));
2515
2524
  }
2516
- const Wt = (e) => {
2525
+ const Jt = (e) => {
2517
2526
  var t;
2518
2527
  return ((t = e.filter) == null ? void 0 : t.type) === "single" ? "single select" : "multi select";
2519
2528
  };
2520
- function Qt(e) {
2529
+ function Xt(e) {
2521
2530
  var t, i, n;
2522
2531
  if ((i = (t = e.filter) == null ? void 0 : t.defaultValues) != null && i.length) return `default ${e.filter.defaultValues.join(", ")}`;
2523
2532
  if ((n = e.filter) != null && n.defaultDateFilter) return "a default period";
2524
2533
  }
2525
- function oe(e) {
2526
- return we.plain("filter", e);
2534
+ function se(e) {
2535
+ return Oe.plain("filter", e);
2527
2536
  }
2528
- function Ur(e, t) {
2529
- const { input: i } = t, n = $(e);
2530
- if (n.some((s) => s.id === i.id))
2537
+ function Jr(e, t) {
2538
+ const { input: i } = t, n = j(e);
2539
+ if (n.some((l) => l.id === i.id))
2531
2540
  throw new N("filter_id_taken", `A filter with id ${i.id} is already on this dashboard.`);
2532
2541
  if (q(e).findFilterInput({ filterId: i.filter.id }))
2533
2542
  throw new N("filter_id_taken", `A filter definition with id ${i.filter.id} is already on this dashboard.`);
2534
- const r = { ...e, inputs: [...n, i] }, a = jr(r, i.id), o = [Wt(i), Qt(i)].filter(Boolean).join(", ");
2543
+ const r = { ...e, inputs: [...n, i] }, a = Qr(r, i.id), o = Yr(r, i.id), s = [Jt(i), Xt(i)].filter(Boolean).join(", ");
2535
2544
  return {
2536
2545
  dashboard: r,
2537
2546
  created: [
@@ -2543,14 +2552,14 @@ function Ur(e, t) {
2543
2552
  }
2544
2553
  ],
2545
2554
  clauses: [
2546
- oe(
2547
- `adds the filter ${L(i.label)} (${o}) to ${Gt(r, i)}; it filters ${a} card${a === 1 ? "" : "s"}`
2555
+ se(
2556
+ `adds the filter ${$(i.label)} (${s}) to ${Yt(r, i)}; it filters ${a} card${a === 1 ? "" : "s"}${o ? ` and may filter ${o} more through the domain's relationships` : ""}`
2548
2557
  )
2549
2558
  ]
2550
2559
  };
2551
2560
  }
2552
- function Hr(e, t, i) {
2553
- const n = Kr(e, { inputId: t.filterId }, t.settings, {
2561
+ function Xr(e, t, i) {
2562
+ const n = zr(e, { inputId: t.filterId }, t.settings, {
2554
2563
  calendar: i.calendar
2555
2564
  });
2556
2565
  if (!n.ok) {
@@ -2562,60 +2571,60 @@ function Hr(e, t, i) {
2562
2571
  { issues: n.issues }
2563
2572
  );
2564
2573
  }
2565
- const r = $(e).find((o) => o.id === n.inputId), a = $(n.dashboard).find((o) => o.id === n.inputId);
2574
+ const r = j(e).find((o) => o.id === n.inputId), a = j(n.dashboard).find((o) => o.id === n.inputId);
2566
2575
  return {
2567
2576
  dashboard: n.dashboard,
2568
2577
  runtimeEffects: [{ kind: "filter_value", effects: n.valueEffects }],
2569
- clauses: [oe(`changes the filter ${L((r == null ? void 0 : r.label) ?? a.label)}: ${Gr(n.dashboard, r, a)}`)]
2578
+ clauses: [se(`changes the filter ${$((r == null ? void 0 : r.label) ?? a.label)}: ${Zr(n.dashboard, r, a)}`)]
2570
2579
  };
2571
2580
  }
2572
- function Gr(e, t, i) {
2581
+ function Zr(e, t, i) {
2573
2582
  var o, s, l, c, u, f;
2574
2583
  if (!t) return "updates its settings";
2575
2584
  const n = [];
2576
- t.label !== i.label && n.push(`renames it ${L(i.label)}`), (((o = t.filter) == null ? void 0 : o.type) ?? "multiple") !== (((s = i.filter) == null ? void 0 : s.type) ?? "multiple") && n.push(`makes it ${Wt(i)}`);
2585
+ t.label !== i.label && n.push(`renames it ${$(i.label)}`), (((o = t.filter) == null ? void 0 : o.type) ?? "multiple") !== (((s = i.filter) == null ? void 0 : s.type) ?? "multiple") && n.push(`makes it ${Jt(i)}`);
2577
2586
  const r = JSON.stringify([((l = t.filter) == null ? void 0 : l.defaultValues) ?? null, ((c = t.filter) == null ? void 0 : c.defaultDateFilter) ?? null]), a = JSON.stringify([((u = i.filter) == null ? void 0 : u.defaultValues) ?? null, ((f = i.filter) == null ? void 0 : f.defaultDateFilter) ?? null]);
2578
2587
  if (r !== a) {
2579
- const d = Qt(i);
2588
+ const d = Xt(i);
2580
2589
  n.push(d ? `sets its ${d.replace(/^default /, "default to ").replace(/^a default period$/, "default period")}` : "removes its default");
2581
2590
  }
2582
- return JSON.stringify(t.scope) !== JSON.stringify(i.scope) && n.push(`applies it to ${Gt(e, i)}`), n.length ? Tt(n) : "keeps its settings";
2591
+ return JSON.stringify(t.scope) !== JSON.stringify(i.scope) && n.push(`applies it to ${Yt(e, i)}`), n.length ? Pt(n) : "keeps its settings";
2583
2592
  }
2584
- function Wr(e, t) {
2585
- const i = ye(e, t);
2593
+ function ea(e, t) {
2594
+ const i = ge(e, t);
2586
2595
  return {
2587
2596
  dashboard: {
2588
2597
  ...e,
2589
- inputs: $(e).filter((r) => r.id !== t),
2590
- defaultInputValues: on(e.defaultInputValues, t)
2598
+ inputs: j(e).filter((r) => r.id !== t),
2599
+ defaultInputValues: dn(e.defaultInputValues, t)
2591
2600
  },
2592
2601
  runtimeEffects: [{ kind: "input_removed", inputId: t }],
2593
- clauses: [oe(`removes the filter ${L(i.label)}`)]
2602
+ clauses: [se(`removes the filter ${$(i.label)}`)]
2594
2603
  };
2595
2604
  }
2596
- function Qr(e, t, i) {
2605
+ function ta(e, t, i) {
2597
2606
  var o;
2598
- if (!fe(e).some((s) => s.cardId === i))
2607
+ if (!pe(e).some((s) => s.cardId === i))
2599
2608
  throw new N("card_not_found", `No card ${i} on this dashboard.`, "Read the outline again and use its card ids.");
2600
- const n = sn(t.scope, i);
2609
+ const n = fn(t.scope, i);
2601
2610
  if (!n)
2602
2611
  throw new N(
2603
2612
  "filter_invalid",
2604
2613
  "This filter applies to Document sections, so it can't leave out one card.",
2605
2614
  "Change it in the editor."
2606
2615
  );
2607
- const r = { ...t, scope: n }, a = Ae({ inputs: [r], dashboardFilters: [] });
2616
+ const r = { ...t, scope: n }, a = _e({ inputs: [r], dashboardFilters: [] });
2608
2617
  if (!a.ok)
2609
2618
  throw new N("filter_invalid", ((o = a.issues[0]) == null ? void 0 : o.message) ?? "This filter could not be saved.", "Change it in the editor.");
2610
2619
  return {
2611
2620
  ...e,
2612
- inputs: $(e).map((s) => s.id === t.id ? r : s)
2621
+ inputs: j(e).map((s) => s.id === t.id ? r : s)
2613
2622
  };
2614
2623
  }
2615
- function Jt(e, t, i, n, r) {
2624
+ function Zt(e, t, i, n, r) {
2616
2625
  var u, f;
2617
- const a = ye(e, t);
2618
- if (!fe(e).some((d) => d.cardId === i))
2626
+ const a = ge(e, t);
2627
+ if (!pe(e).some((d) => d.cardId === i))
2619
2628
  throw new N("card_not_found", `No card ${i} on this dashboard.`, "Read the outline again and use its card ids.");
2620
2629
  const o = [...((u = a.application) == null ? void 0 : u.cards) ?? []], s = o.findIndex((d) => d.cardId === i);
2621
2630
  s >= 0 ? o[s] = n : o.push(n);
@@ -2623,7 +2632,7 @@ function Jt(e, t, i, n, r) {
2623
2632
  ...a,
2624
2633
  ...r ? { scope: r } : {},
2625
2634
  application: { ...a.application ?? { kind: "cardMappings" }, cards: o }
2626
- }, c = Ae({ inputs: [l], dashboardFilters: [] });
2635
+ }, c = _e({ inputs: [l], dashboardFilters: [] });
2627
2636
  if (!c.ok)
2628
2637
  throw new N(
2629
2638
  "filter_invalid",
@@ -2632,35 +2641,45 @@ function Jt(e, t, i, n, r) {
2632
2641
  );
2633
2642
  return {
2634
2643
  ...e,
2635
- inputs: $(e).map((d) => d.id === t ? l : d)
2644
+ inputs: j(e).map((d) => d.id === t ? l : d)
2636
2645
  };
2637
2646
  }
2638
- function Jr(e, t) {
2639
- const i = ye(e, t.filterId), n = { ...t.binding, kind: "bound", cardId: t.cardId }, r = an(i.scope, t.cardId), a = r !== i.scope;
2647
+ function ia(e) {
2648
+ switch (e.kind) {
2649
+ case "field":
2650
+ return `by ${e.field.name}`;
2651
+ case "relationship":
2652
+ return "through a chosen relationship path";
2653
+ default:
2654
+ return String(e.kind);
2655
+ }
2656
+ }
2657
+ function na(e, t) {
2658
+ const i = ge(e, t.filterId), n = { ...t.binding, kind: "bound", cardId: t.cardId }, r = un(i.scope, t.cardId), a = r !== i.scope;
2640
2659
  return {
2641
- dashboard: Jt(e, t.filterId, t.cardId, n, a ? r : void 0),
2660
+ dashboard: Zt(e, t.filterId, t.cardId, n, a ? r : void 0),
2642
2661
  clauses: [
2643
- oe(
2644
- `makes ${L(i.label)} filter ${L(Ht(e, t.cardId))} by ${n.target.field.name}${a ? ", which it used to leave out" : ""}`
2662
+ se(
2663
+ `makes ${$(i.label)} filter ${$(Qt(e, t.cardId))} ${ia(n.target)}${a ? ", which it used to leave out" : ""}`
2645
2664
  )
2646
2665
  ]
2647
2666
  };
2648
2667
  }
2649
- function Yr(e, t) {
2668
+ function ra(e, t) {
2650
2669
  var r;
2651
- const i = ye(e, t.filterId);
2670
+ const i = ge(e, t.filterId);
2652
2671
  return {
2653
- dashboard: ((r = i.filter) == null ? void 0 : r.kind) === "global-date" ? Qr(e, i, t.cardId) : Jt(e, t.filterId, t.cardId, { kind: "excluded", cardId: t.cardId }),
2654
- clauses: [oe(`stops ${L(i.label)} from filtering ${L(Ht(e, t.cardId))}`)]
2672
+ dashboard: ((r = i.filter) == null ? void 0 : r.kind) === "global-date" ? ta(e, i, t.cardId) : Zt(e, t.filterId, t.cardId, { kind: "excluded", cardId: t.cardId }),
2673
+ clauses: [se(`stops ${$(i.label)} from filtering ${$(Qt(e, t.cardId))}`)]
2655
2674
  };
2656
2675
  }
2657
- function go(e, t, i) {
2676
+ function wo(e, t, i) {
2658
2677
  let n = e;
2659
2678
  const r = [], a = [], o = [];
2660
2679
  for (const [s, l] of t.entries()) {
2661
2680
  let c;
2662
2681
  try {
2663
- c = Xr(n, l, i);
2682
+ c = aa(n, l, i);
2664
2683
  } catch (u) {
2665
2684
  if (!(u instanceof N)) throw u;
2666
2685
  return {
@@ -2677,33 +2696,33 @@ function go(e, t, i) {
2677
2696
  }
2678
2697
  n = c.dashboard, r.push(...c.created ?? []), a.push(...c.runtimeEffects ?? []), o.push({ index: s, changeIndex: l.changeIndex, clauses: c.clauses });
2679
2698
  }
2680
- return { ok: !0, dashboard: n, created: r, descriptions: Zr(o), runtimeEffects: a };
2699
+ return { ok: !0, dashboard: n, created: r, descriptions: oa(o), runtimeEffects: a };
2681
2700
  }
2682
- function Xr(e, t, i) {
2701
+ function aa(e, t, i) {
2683
2702
  switch (t.op) {
2684
2703
  case "card.add":
2685
- return un(e, t);
2704
+ return yn(e, t);
2686
2705
  case "card.remove":
2687
- return cn(e, t.cardId);
2706
+ return pn(e, t.cardId);
2688
2707
  case "card.update":
2689
- return ln(e, t.cardId, t.update);
2708
+ return mn(e, t.cardId, t.update);
2690
2709
  case "layout.arrange":
2691
- return Or(e, t);
2710
+ return Rr(e, t);
2692
2711
  case "frame.commit":
2693
- return _r(e, t.commit);
2712
+ return Lr(e, t.commit);
2694
2713
  case "filter.add":
2695
- return Ur(e, t);
2714
+ return Jr(e, t);
2696
2715
  case "filter.update":
2697
- return Hr(e, t, i);
2716
+ return Xr(e, t, i);
2698
2717
  case "filter.remove":
2699
- return Wr(e, t.filterId);
2718
+ return ea(e, t.filterId);
2700
2719
  case "filter.bind":
2701
- return Jr(e, t);
2720
+ return na(e, t);
2702
2721
  case "filter.exclude":
2703
- return Yr(e, t);
2722
+ return ra(e, t);
2704
2723
  }
2705
2724
  }
2706
- function Zr(e) {
2725
+ function oa(e) {
2707
2726
  const t = [];
2708
2727
  for (const i of e) {
2709
2728
  const n = i.changeIndex === void 0 ? void 0 : t.find((r) => r.changeIndex === i.changeIndex);
@@ -2720,21 +2739,21 @@ function Zr(e) {
2720
2739
  }
2721
2740
  return t.map(({ clauses: i, ...n }) => ({
2722
2741
  ...n,
2723
- sentence: dn(ea(i))
2742
+ sentence: hn(sa(i))
2724
2743
  }));
2725
2744
  }
2726
- function ea(e) {
2745
+ function sa(e) {
2727
2746
  let t = !1;
2728
2747
  return e.filter((i) => i.kind !== "detached" ? !0 : t ? !1 : (t = !0, !0));
2729
2748
  }
2730
- function st(e) {
2749
+ function ct(e) {
2731
2750
  return Object.fromEntries(
2732
2751
  Object.entries(e).filter(
2733
2752
  (t) => typeof t[1] == "string" && t[1].length > 0
2734
2753
  )
2735
2754
  );
2736
2755
  }
2737
- function ne(e) {
2756
+ function re(e) {
2738
2757
  return e.kind === "semantic" ? [
2739
2758
  e.kind,
2740
2759
  e.domainId,
@@ -2749,18 +2768,18 @@ function ne(e) {
2749
2768
  e.tableName
2750
2769
  ].join(":");
2751
2770
  }
2752
- function ta(e, t) {
2771
+ function la(e, t) {
2753
2772
  if (e.kind === "semantic")
2754
2773
  return {
2755
2774
  status: "ready",
2756
- request: st({
2775
+ request: ct({
2757
2776
  connection_id: e.connectionId,
2758
2777
  domain_id: e.domainId,
2759
- dataset_id: Oi(e),
2778
+ dataset_id: Ri(e),
2760
2779
  dataset_name: e.datasetName
2761
2780
  })
2762
2781
  };
2763
- const i = Sn({
2782
+ const i = Pn({
2764
2783
  source: e,
2765
2784
  capabilities: t
2766
2785
  });
@@ -2772,7 +2791,7 @@ function ta(e, t) {
2772
2791
  message: `Source is missing required field-metadata coordinates: ${i.missing.join(", ")}.`
2773
2792
  } : {
2774
2793
  status: "ready",
2775
- request: st({
2794
+ request: ct({
2776
2795
  connection_id: e.connectionId,
2777
2796
  datamodel_id: "",
2778
2797
  database_name: i.coordinates.databaseName,
@@ -2781,14 +2800,14 @@ function ta(e, t) {
2781
2800
  })
2782
2801
  };
2783
2802
  }
2784
- function bo(e, t = /* @__PURE__ */ new Map()) {
2803
+ function Po(e, t = /* @__PURE__ */ new Map()) {
2785
2804
  const i = /* @__PURE__ */ new Map();
2786
2805
  for (const { card: n } of e) {
2787
- const r = wt(n), a = r.kind === "config" ? r.executableSources : r.kind === "sql" ? r.pinnedCatalogSources.map((o) => o.source) : [];
2806
+ const r = Ot(n), a = r.kind === "config" ? r.executableSources : r.kind === "sql" ? r.pinnedCatalogSources.map((o) => o.source) : [];
2788
2807
  for (const o of a) {
2789
- const s = ne(o);
2808
+ const s = re(o);
2790
2809
  if (!i.has(s)) {
2791
- const l = ta(
2810
+ const l = la(
2792
2811
  o,
2793
2812
  o.connectionId ? t.get(o.connectionId) : void 0
2794
2813
  );
@@ -2802,7 +2821,7 @@ function bo(e, t = /* @__PURE__ */ new Map()) {
2802
2821
  }
2803
2822
  return Array.from(i.values());
2804
2823
  }
2805
- function ia(e, t) {
2824
+ function ca(e, t) {
2806
2825
  if (e.kind !== "semantic" || !e.connectionId) return;
2807
2826
  const i = (t.qualifiedEntityName || "").split(".").map((r) => r.trim()).filter(Boolean), n = i.at(-1);
2808
2827
  if (n)
@@ -2814,48 +2833,48 @@ function ia(e, t) {
2814
2833
  ...i.length > 2 ? { databaseName: i.at(-3) } : {}
2815
2834
  };
2816
2835
  }
2817
- function le(e, t) {
2836
+ function ce(e, t) {
2818
2837
  let i = e.get(t);
2819
2838
  return i || (i = { fields: /* @__PURE__ */ new Map(), fieldConflicts: /* @__PURE__ */ new Set() }, e.set(t, i)), i;
2820
2839
  }
2821
- function Yt(e, t) {
2840
+ function ei(e, t) {
2822
2841
  e.sourceLabel === void 0 ? e.sourceLabel = t : e.sourceLabel !== t && (e.sourceLabelConflict = !0);
2823
2842
  }
2824
- function Me(e, t, i) {
2843
+ function Te(e, t, i) {
2825
2844
  for (const n of t) {
2826
2845
  const r = n == null ? void 0 : n.trim();
2827
2846
  if (!r) continue;
2828
- const a = gt(r), o = e.fields.get(a);
2847
+ const a = bt(r), o = e.fields.get(a);
2829
2848
  o === void 0 ? e.fields.set(a, i) : o !== i && e.fieldConflicts.add(a);
2830
2849
  }
2831
2850
  }
2832
- function Xt(e, t) {
2833
- t.sourceLabel && Yt(e, t.sourceLabel), t.sourceLabelConflict && (e.sourceLabelConflict = !0);
2851
+ function ti(e, t) {
2852
+ t.sourceLabel && ei(e, t.sourceLabel), t.sourceLabelConflict && (e.sourceLabelConflict = !0);
2834
2853
  for (const [i, n] of t.fields)
2835
- Me(e, [i], n);
2854
+ Te(e, [i], n);
2836
2855
  for (const i of t.fieldConflicts ?? [])
2837
2856
  e.fieldConflicts.add(i);
2838
2857
  }
2839
- function Zt(e) {
2858
+ function ii(e) {
2840
2859
  return e.kind === "semantic" && (e.label || e.datasetName || "").trim() || void 0;
2841
2860
  }
2842
- function ho(e, t) {
2861
+ function Oo(e, t) {
2843
2862
  var n, r;
2844
2863
  const i = /* @__PURE__ */ new Map();
2845
2864
  for (const [a, o] of e) {
2846
2865
  if (o.status !== "ready") continue;
2847
- const s = t == null ? void 0 : t.get(a), l = s ? Zt(s) : void 0;
2866
+ const s = t == null ? void 0 : t.get(a), l = s ? ii(s) : void 0;
2848
2867
  for (const c of o.columns) {
2849
- const u = (n = c.column_name) == null ? void 0 : n.trim(), f = (r = c.label) == null ? void 0 : r.trim(), d = s ? ia(s, c) : void 0;
2850
- d && l && Yt(
2851
- le(i, ne(d)),
2868
+ const u = (n = c.column_name) == null ? void 0 : n.trim(), f = (r = c.label) == null ? void 0 : r.trim(), d = s ? ca(s, c) : void 0;
2869
+ d && l && ei(
2870
+ ce(i, re(d)),
2852
2871
  l
2853
- ), !(!u || !f || f === u) && (Me(
2854
- le(i, a),
2872
+ ), !(!u || !f || f === u) && (Te(
2873
+ ce(i, a),
2855
2874
  [u, c.sourceField],
2856
2875
  f
2857
- ), d && Me(
2858
- le(i, ne(d)),
2876
+ ), d && Te(
2877
+ ce(i, re(d)),
2859
2878
  [c.sourceField, u],
2860
2879
  f
2861
2880
  ));
@@ -2863,56 +2882,56 @@ function ho(e, t) {
2863
2882
  }
2864
2883
  return i;
2865
2884
  }
2866
- function vo(...e) {
2885
+ function Ao(...e) {
2867
2886
  const t = /* @__PURE__ */ new Map();
2868
2887
  for (const i of e)
2869
2888
  for (const [n, r] of i ?? [])
2870
- Xt(le(t, n), r);
2889
+ ti(ce(t, n), r);
2871
2890
  return t;
2872
2891
  }
2873
- function Ke(e) {
2892
+ function Le(e) {
2874
2893
  return [e.databaseName, e.schemaName, e.tableName].filter(Boolean).join(".");
2875
2894
  }
2876
- function na(e) {
2895
+ function ua(e) {
2877
2896
  return e.split(":").slice(2).filter(Boolean).join(".");
2878
2897
  }
2879
- function ei(e, t) {
2880
- const i = ne(t), n = e.get(i);
2898
+ function ni(e, t) {
2899
+ const i = re(t), n = e.get(i);
2881
2900
  if (t.kind !== "physical") return n;
2882
- const r = `physical:${t.connectionId}:`, a = Ke(t), o = {
2901
+ const r = `physical:${t.connectionId}:`, a = Le(t), o = {
2883
2902
  fields: /* @__PURE__ */ new Map(),
2884
2903
  fieldConflicts: /* @__PURE__ */ new Set()
2885
2904
  };
2886
2905
  let s = !1;
2887
2906
  for (const [l, c] of e)
2888
- l.startsWith(r) && (l !== i && !Mn(a, na(l)) || (Xt(o, c), s = !0));
2907
+ l.startsWith(r) && (l !== i && !On(a, ua(l)) || (ti(o, c), s = !0));
2889
2908
  return s ? o : void 0;
2890
2909
  }
2891
- function ra(e, t) {
2910
+ function da(e, t) {
2892
2911
  var r;
2893
2912
  if (!e) return;
2894
- const i = gt(t.name), n = ei(e, t.source);
2913
+ const i = bt(t.name), n = ni(e, t.source);
2895
2914
  return n && !((r = n.fieldConflicts) != null && r.has(i)) ? n.fields.get(i) : void 0;
2896
2915
  }
2897
- function aa(e, t) {
2916
+ function fa(e, t) {
2898
2917
  if (t.kind === "semantic")
2899
- return Zt(t) || t.datasetId || "Dataset";
2900
- const i = e ? ei(e, t) : void 0;
2901
- return i != null && i.sourceLabel && !i.sourceLabelConflict ? i.sourceLabel : Ke(t);
2918
+ return ii(t) || t.datasetId || "Dataset";
2919
+ const i = e ? ni(e, t) : void 0;
2920
+ return i != null && i.sourceLabel && !i.sourceLabelConflict ? i.sourceLabel : Le(t);
2902
2921
  }
2903
- function Fo(e, t) {
2904
- const i = ra(e, t);
2922
+ function No(e, t) {
2923
+ const i = da(e, t);
2905
2924
  return {
2906
2925
  name: t.name,
2907
2926
  ...i ? { label: i } : {},
2908
- entityName: aa(e, t.source),
2909
- ...t.source.kind === "physical" ? { qualifiedEntityName: Ke(t.source) } : {},
2927
+ entityName: fa(e, t.source),
2928
+ ...t.source.kind === "physical" ? { qualifiedEntityName: Le(t.source) } : {},
2910
2929
  dataType: t.dataType
2911
2930
  };
2912
2931
  }
2913
- function oa(e, t) {
2932
+ function ma(e, t) {
2914
2933
  var r, a;
2915
- const i = (r = t.column_name) == null ? void 0 : r.trim(), n = yt(t.data_type);
2934
+ const i = (r = t.column_name) == null ? void 0 : r.trim(), n = gt(t.data_type);
2916
2935
  if (!(!i || n === "unknown"))
2917
2936
  return {
2918
2937
  kind: "field",
@@ -2924,23 +2943,23 @@ function oa(e, t) {
2924
2943
  }
2925
2944
  };
2926
2945
  }
2927
- function Co(e) {
2946
+ function _o(e) {
2928
2947
  const t = {};
2929
2948
  for (const { card: i } of e.cards) {
2930
- const n = wt(i), r = n.kind === "config" ? n.executableSources : n.kind === "sql" ? n.pinnedCatalogSources.map((s) => s.source) : [];
2949
+ const n = Ot(i), r = n.kind === "config" ? n.executableSources : n.kind === "sql" ? n.pinnedCatalogSources.map((s) => s.source) : [];
2931
2950
  if (!r.length) continue;
2932
2951
  const a = [];
2933
2952
  let o;
2934
2953
  for (const s of r) {
2935
2954
  const l = e.metadataBySourceKey.get(
2936
- ne(s)
2955
+ re(s)
2937
2956
  );
2938
2957
  if (!l || l.status === "unavailable") {
2939
2958
  o = (l == null ? void 0 : l.status) === "unavailable" ? l.message : "Field metadata is not available yet.";
2940
2959
  break;
2941
2960
  }
2942
2961
  for (const c of l.columns) {
2943
- const u = oa(s, c);
2962
+ const u = ma(s, c);
2944
2963
  u && a.push(u);
2945
2964
  }
2946
2965
  }
@@ -2948,20 +2967,20 @@ function Co(e) {
2948
2967
  }
2949
2968
  return t;
2950
2969
  }
2951
- function Io(e) {
2952
- const { dashboard: t, target: i, calendar: n } = e, r = ii(i), a = ti(t, i, n);
2970
+ function Eo(e) {
2971
+ const { dashboard: t, target: i, calendar: n } = e, r = ai(i), a = ri(t, i, n);
2953
2972
  return {
2954
2973
  value: a,
2955
- mode: Di(
2956
- Ti(a == null ? void 0 : a.operation) ? a.operation : r.operation
2974
+ mode: Ai(
2975
+ Ni(a == null ? void 0 : a.operation) ? a.operation : r.operation
2957
2976
  )
2958
2977
  };
2959
2978
  }
2960
- function ti(e, t, i) {
2979
+ function ri(e, t, i) {
2961
2980
  var n;
2962
2981
  switch (t.kind) {
2963
2982
  case "dashboardInput": {
2964
- const r = mn({
2983
+ const r = bn({
2965
2984
  dashboard: e,
2966
2985
  input: t.input,
2967
2986
  target: t.scope,
@@ -2973,25 +2992,25 @@ function ti(e, t, i) {
2973
2992
  const r = (n = e.defaultFilterValues) == null ? void 0 : n.find(
2974
2993
  (a) => a.filterId === t.filter.id
2975
2994
  );
2976
- return r ? fn({
2995
+ return r ? gn({
2977
2996
  filterDefinitions: [t.filter],
2978
2997
  filterValues: [r]
2979
- })[0] : U(t.filter, i);
2998
+ })[0] : G(t.filter, i);
2980
2999
  }
2981
3000
  case "definition":
2982
- return U(t.filter, i);
3001
+ return G(t.filter, i);
2983
3002
  }
2984
3003
  }
2985
- function ii(e) {
3004
+ function ai(e) {
2986
3005
  return e.kind === "dashboardInput" ? e.input.filter : e.filter;
2987
3006
  }
2988
- function xo(e) {
3007
+ function Ro(e) {
2989
3008
  var a;
2990
3009
  const { dashboard: t, filter: i, input: n, scope: r } = e;
2991
3010
  return n && (t.inputs || []).some((o) => o.id === n.id) ? { kind: "dashboardInput", input: n, scope: r } : ((a = q(t).findFilterInput({ filterId: i.id })) == null ? void 0 : a.origin) === "toolbarFilter" ? { kind: "dashboardFilter", filter: i } : { kind: "definition", filter: i };
2992
3011
  }
2993
- function So(e) {
2994
- const { dashboard: t, target: i, calendar: n } = e, r = ii(i), a = pn(r), o = sa(t, i);
3012
+ function Vo(e) {
3013
+ const { dashboard: t, target: i, calendar: n } = e, r = ai(i), a = vn(r), o = pa(t, i);
2995
3014
  if (!o) return a;
2996
3015
  if (o === "cleared")
2997
3016
  return {
@@ -2999,13 +3018,13 @@ function So(e) {
2999
3018
  defaultValues: void 0,
3000
3019
  defaultDateFilter: void 0
3001
3020
  };
3002
- const s = ti(t, i, n);
3003
- if (!s || la(s, U(r, n)))
3021
+ const s = ri(t, i, n);
3022
+ if (!s || ya(s, G(r, n)))
3004
3023
  return a;
3005
3024
  if (s.valueType === "date") {
3006
- const l = Ai(
3025
+ const l = Vi(
3007
3026
  "relativeMeta" in s ? s.relativeMeta : void 0
3008
- ) ?? ca(r, s, n);
3027
+ ) ?? ha(r, s, n);
3009
3028
  return l ? {
3010
3029
  operation: s.operation,
3011
3030
  defaultValues: r.defaultValues,
@@ -3018,10 +3037,10 @@ function So(e) {
3018
3037
  defaultDateFilter: r.defaultDateFilter
3019
3038
  };
3020
3039
  }
3021
- function sa(e, t) {
3040
+ function pa(e, t) {
3022
3041
  var i;
3023
3042
  if (t.kind === "dashboardInput") {
3024
- const n = Oe(
3043
+ const n = Ne(
3025
3044
  e.defaultInputValues,
3026
3045
  t.input,
3027
3046
  t.scope
@@ -3033,19 +3052,19 @@ function sa(e, t) {
3033
3052
  (n) => n.filterId === t.filter.id
3034
3053
  ) ? "set" : void 0;
3035
3054
  }
3036
- function la(e, t) {
3037
- return !!(t && e.operation === t.operation && Ie(lt(e), lt(t)) && Ie(
3055
+ function ya(e, t) {
3056
+ return !!(t && e.operation === t.operation && Se(ut(e), ut(t)) && Se(
3038
3057
  "relativeMeta" in e ? e.relativeMeta : void 0,
3039
3058
  "relativeMeta" in t ? t.relativeMeta : void 0
3040
3059
  ));
3041
3060
  }
3042
- function lt(e) {
3061
+ function ut(e) {
3043
3062
  return e.values.map(
3044
3063
  (t) => t instanceof Date ? t.getTime() : t
3045
3064
  );
3046
3065
  }
3047
- function ca(e, t, i) {
3048
- const n = yn(i == null ? void 0 : i.tz), r = he(t.values[0], n);
3066
+ function ha(e, t, i) {
3067
+ const n = Fn(i == null ? void 0 : i.tz), r = Fe(t.values[0], n);
3049
3068
  if (!r) return;
3050
3069
  const [a, o, s] = new Intl.DateTimeFormat("en-CA", {
3051
3070
  timeZone: n,
@@ -3062,30 +3081,30 @@ function ca(e, t, i) {
3062
3081
  ], c = t.values.map(
3063
3082
  (u) => {
3064
3083
  var f;
3065
- return (f = he(u, n)) == null ? void 0 : f.getTime();
3084
+ return (f = Fe(u, n)) == null ? void 0 : f.getTime();
3066
3085
  }
3067
3086
  );
3068
3087
  return l.find((u) => {
3069
- const f = U(
3088
+ const f = G(
3070
3089
  { ...e, defaultDateFilter: u },
3071
3090
  i
3072
3091
  );
3073
- return (f == null ? void 0 : f.operation) === t.operation && Ie(
3092
+ return (f == null ? void 0 : f.operation) === t.operation && Se(
3074
3093
  f.values.map(
3075
3094
  (d) => {
3076
3095
  var y;
3077
- return (y = he(d, n)) == null ? void 0 : y.getTime();
3096
+ return (y = Fe(d, n)) == null ? void 0 : y.getTime();
3078
3097
  }
3079
3098
  ),
3080
3099
  c
3081
3100
  );
3082
3101
  });
3083
3102
  }
3084
- function ua(e) {
3103
+ function ga(e) {
3085
3104
  const t = H(e.format);
3086
3105
  if ((t == null ? void 0 : t.type) === "temporal_bucket") {
3087
3106
  if (!e.granularity) return {};
3088
- const i = qi(
3107
+ const i = Gi(
3089
3108
  t,
3090
3109
  e.granularity
3091
3110
  );
@@ -3102,34 +3121,34 @@ function ua(e) {
3102
3121
  ...t ? { format: t } : {}
3103
3122
  };
3104
3123
  }
3105
- function da(e, t) {
3124
+ function ba(e, t) {
3106
3125
  var r, a;
3107
3126
  const i = ((r = e.nativeDataType) == null ? void 0 : r.trim()) || ((a = e.native_data_type) == null ? void 0 : a.trim());
3108
3127
  return i || ((e.dataTypeProvenance || t) === "physical" ? e.data_type : void 0);
3109
3128
  }
3110
- function ni(e) {
3129
+ function oi(e) {
3111
3130
  const t = (e.label ?? "").trim();
3112
3131
  return t ? e.derivedLabel === void 0 ? !0 : t !== e.derivedLabel.trim() : !1;
3113
3132
  }
3114
- function ke(e) {
3115
- return ni(e) ? e.label.trim() : e.name || (e.label ?? "").trim();
3133
+ function qe(e) {
3134
+ return oi(e) ? e.label.trim() : e.name || (e.label ?? "").trim();
3116
3135
  }
3117
- function ct(e) {
3118
- return ke(e).toLowerCase().trim();
3136
+ function dt(e) {
3137
+ return qe(e).toLowerCase().trim();
3119
3138
  }
3120
- function fa(e, t) {
3121
- return ct(e).localeCompare(ct(t), void 0, {
3139
+ function va(e, t) {
3140
+ return dt(e).localeCompare(dt(t), void 0, {
3122
3141
  numeric: !0,
3123
3142
  sensitivity: "base"
3124
3143
  });
3125
3144
  }
3126
- function ie(e) {
3145
+ function ne(e) {
3127
3146
  return String(e ?? "").toLowerCase().replace(/[\s_\-.]+/g, "");
3128
3147
  }
3129
- function Mo(e, t) {
3130
- const i = ie(t);
3148
+ function ko(e, t) {
3149
+ const i = ne(t);
3131
3150
  return i ? [
3132
- ke(e),
3151
+ qe(e),
3133
3152
  e.label,
3134
3153
  e.name,
3135
3154
  e.description,
@@ -3138,21 +3157,21 @@ function Mo(e, t) {
3138
3157
  e.entityName && e.name ? `${e.entityName}.${e.name}` : "",
3139
3158
  e.dataType
3140
3159
  ].some(
3141
- (r) => !!r && ie(r).includes(i)
3160
+ (r) => !!r && ne(r).includes(i)
3142
3161
  ) : !0;
3143
3162
  }
3144
- function ut(e, t) {
3145
- const i = ie(t);
3163
+ function ft(e, t) {
3164
+ const i = ne(t);
3146
3165
  if (!i) return 0;
3147
- const n = ie(ke(e));
3148
- return n.startsWith(i) ? 0 : n.includes(i) ? 1 : [e.label, e.name].filter(Boolean).map(ie).some((a) => a.includes(i)) ? 2 : 3;
3166
+ const n = ne(qe(e));
3167
+ return n.startsWith(i) ? 0 : n.includes(i) ? 1 : [e.label, e.name].filter(Boolean).map(ne).some((a) => a.includes(i)) ? 2 : 3;
3149
3168
  }
3150
- function Do(e, t, i) {
3151
- return ut(e, i) - ut(t, i) || fa(e, t);
3169
+ function Bo(e, t, i) {
3170
+ return ft(e, i) - ft(t, i) || va(e, t);
3152
3171
  }
3153
- function ma(e, t) {
3172
+ function Fa(e, t) {
3154
3173
  var a;
3155
- const i = e.type === "dataset" ? (a = t.find((o) => o.entityName)) == null ? void 0 : a.entityName : void 0, n = i || e.name, r = Ze(
3174
+ const i = e.type === "dataset" ? (a = t.find((o) => o.entityName)) == null ? void 0 : a.entityName : void 0, n = i || e.name, r = tt(
3156
3175
  e.type === "dataset" && i ? { ...e, name: i } : e
3157
3176
  );
3158
3177
  return {
@@ -3164,12 +3183,12 @@ function ma(e, t) {
3164
3183
  qualifiedEntityName: r,
3165
3184
  columns: t.map((o) => {
3166
3185
  var y;
3167
- const s = e.type === "dataset" ? o.entityName || n : e.name, l = o.qualifiedEntityName || (e.type === "dataset" && s ? Ze({ ...e, name: s }) : r), c = da(
3186
+ const s = e.type === "dataset" ? o.entityName || n : e.name, l = o.qualifiedEntityName || (e.type === "dataset" && s ? tt({ ...e, name: s }) : r), c = ba(
3168
3187
  o,
3169
3188
  e.type === "dataset" ? "semantic" : "physical"
3170
- ), u = (y = o.label) != null && y.trim() ? o.label : void 0, f = u ? void 0 : gn(o.column_name);
3189
+ ), u = (y = o.label) != null && y.trim() ? o.label : void 0, f = u ? void 0 : Cn(o.column_name);
3171
3190
  return {
3172
- id: bn(s, o.column_name),
3191
+ id: In(s, o.column_name),
3173
3192
  name: o.column_name,
3174
3193
  qualifiedFieldName: o.qualifiedFieldName || o.column_name,
3175
3194
  dataType: o.data_type,
@@ -3193,23 +3212,23 @@ function ma(e, t) {
3193
3212
  aggregateOrigin: o.aggregateOrigin,
3194
3213
  labelOrigin: o.labelOrigin,
3195
3214
  formatOrigin: o.formatOrigin,
3196
- ...ua(o),
3215
+ ...ga(o),
3197
3216
  aggregate: o.aggregate
3198
3217
  };
3199
3218
  })
3200
3219
  };
3201
3220
  }
3202
- function pa(e) {
3221
+ function Ca(e) {
3203
3222
  return e.map((t) => ({
3204
3223
  ...t,
3205
- id: Pt({ ...t }),
3224
+ id: At({ ...t }),
3206
3225
  fieldScope: "domain"
3207
3226
  }));
3208
3227
  }
3209
- function ya(e) {
3228
+ function Ia(e) {
3210
3229
  return e.flatMap(
3211
3230
  (t) => t.columns.map((i) => {
3212
- const n = ni(i) ? i.label : void 0, r = n ? void 0 : i.derivedLabel ?? vn(i.name), a = n ?? r ?? i.name;
3231
+ const n = oi(i) ? i.label : void 0, r = n ? void 0 : i.derivedLabel ?? Sn(i.name), a = n ?? r ?? i.name;
3213
3232
  return {
3214
3233
  ...i,
3215
3234
  id: i.id || `${t.entityId}-${i.name}`,
@@ -3227,137 +3246,235 @@ function ya(e) {
3227
3246
  })
3228
3247
  );
3229
3248
  }
3230
- function To(e) {
3231
- const t = e.map((n) => ma(n.target, n.columns || [])).filter((n) => {
3249
+ function Ko(e) {
3250
+ const t = e.map((n) => Fa(n.target, n.columns || [])).filter((n) => {
3232
3251
  var r;
3233
3252
  return ((r = n == null ? void 0 : n.columns) == null ? void 0 : r.length) > 0;
3234
- }), i = pa(e.flatMap((n) => n.calculatedFields || []));
3253
+ }), i = Ca(e.flatMap((n) => n.calculatedFields || []));
3235
3254
  if (i.length > 0) {
3236
3255
  const n = /* @__PURE__ */ new Map();
3237
3256
  i.forEach((r) => {
3238
- const a = Pt(r);
3257
+ const a = At(r);
3239
3258
  n.has(a) || n.set(a, r);
3240
3259
  }), t.unshift({
3241
- entityId: hn,
3260
+ entityId: xn,
3242
3261
  entityType: "dataset",
3243
- entityName: et,
3262
+ entityName: it,
3244
3263
  label: "Calculated Fields",
3245
3264
  description: "Domain-level calculated metrics and dimensions",
3246
- qualifiedEntityName: et,
3265
+ qualifiedEntityName: it,
3247
3266
  columns: Array.from(n.values())
3248
3267
  });
3249
3268
  }
3250
- return { columnGroups: t, columns: ya(t) };
3269
+ return { columnGroups: t, columns: Ia(t) };
3270
+ }
3271
+ function Lo(e, t) {
3272
+ const i = e.answers.relationshipIds;
3273
+ return !i || !t ? !i && !t : i.length === t.length && i.every((n, r) => t[r] === n);
3274
+ }
3275
+ const xa = /* @__PURE__ */ new Set([
3276
+ "dataset_not_reachable",
3277
+ "field_not_resolvable",
3278
+ "missing_metadata",
3279
+ "unsupported_calculated_filter",
3280
+ "relationship_unsupported",
3281
+ "relationship_missing",
3282
+ "relationship_ambiguous"
3283
+ ]);
3284
+ function L(e) {
3285
+ return !!e && typeof e == "object" && !Array.isArray(e);
3286
+ }
3287
+ function Sa(e) {
3288
+ if (L(e))
3289
+ switch (e.status) {
3290
+ case "applied": {
3291
+ const t = Nt(e.route);
3292
+ return t ? { status: "applied", route: t } : void 0;
3293
+ }
3294
+ case "skipped":
3295
+ return typeof e.reason == "string" && xa.has(e.reason) ? { status: "skipped", reason: e.reason } : void 0;
3296
+ case "needsPath":
3297
+ return { status: "needsPath" };
3298
+ case "blocked":
3299
+ return typeof e.message == "string" ? { status: "blocked", message: e.message } : void 0;
3300
+ case "kept":
3301
+ return { status: "kept" };
3302
+ case "notRelationship":
3303
+ return { status: "notRelationship" };
3304
+ default:
3305
+ return;
3306
+ }
3307
+ }
3308
+ function si(e) {
3309
+ if (e !== void 0)
3310
+ return Array.isArray(e) && e.length > 0 && e.every((t) => typeof t == "string" && t.length > 0) ? e : null;
3311
+ }
3312
+ function Ma(e) {
3313
+ if (!L(e)) return;
3314
+ const t = Nt(e.route), i = e.target;
3315
+ if (!(!t || !L(i) || i.kind !== "relationship" || !L(i.field) || typeof i.field.name != "string" || !L(i.field.source) || i.field.source.kind !== "semantic" || !si(i.relationshipIds)))
3316
+ return { route: t, target: i };
3317
+ }
3318
+ function qo(e) {
3319
+ if (!L(e) || !Array.isArray(e.previews)) return { previews: [] };
3320
+ const t = [];
3321
+ for (const n of e.previews) {
3322
+ if (!L(n) || typeof n.cardId != "string" || !n.cardId || !L(n.answers)) continue;
3323
+ const r = si(n.answers.relationshipIds), a = Sa(n.outcome), o = Array.isArray(n.paths) ? n.paths.map(Ma) : [];
3324
+ r === null || !a || !o.every(Boolean) || a.status === "needsPath" && o.length < 2 || t.push({
3325
+ cardId: n.cardId,
3326
+ answers: r ? { relationshipIds: r } : {},
3327
+ outcome: a,
3328
+ paths: o
3329
+ });
3330
+ }
3331
+ const i = L(e.manageRelationships) && typeof e.manageRelationships.href == "string" ? { href: e.manageRelationships.href } : void 0;
3332
+ return { previews: t, ...i ? { manageRelationships: i } : {} };
3333
+ }
3334
+ const ue = (e) => (e == null ? void 0 : e.label) || (e == null ? void 0 : e.name) || "";
3335
+ function Da(e) {
3336
+ return !e || /s$/i.test(e) ? e : /[^aeiou]y$/i.test(e) ? `${e.slice(0, -1)}ies` : `${e}s`;
3337
+ }
3338
+ function $o(e) {
3339
+ if (e.direction === "to_many") {
3340
+ const i = ue(e.matchingDataset ?? e.datasets[e.datasets.length - 1]);
3341
+ return `${e.base ? Da(ue(e.base)) : "Rows"} with at least one matching ${i}`;
3342
+ }
3343
+ return `through ${(e.datasets.length > 1 ? e.datasets.slice(0, -1) : e.datasets).map(ue).join(", ")}`;
3344
+ }
3345
+ const zo = "The relationship this card used changed; choose it again";
3346
+ function jo(e, t) {
3347
+ switch (e) {
3348
+ case "relationship_missing":
3349
+ return t ? `Not related to ${ue(t)}` : "Not related to this card";
3350
+ case "relationship_ambiguous":
3351
+ return "Connects through more than one path";
3352
+ case "relationship_unsupported":
3353
+ return "Can't be applied to this card";
3354
+ case "dataset_not_reachable":
3355
+ case "field_not_resolvable":
3356
+ case "missing_metadata":
3357
+ case "unsupported_calculated_filter":
3358
+ return "No matching field on this card";
3359
+ default:
3360
+ return String(e);
3361
+ }
3251
3362
  }
3252
3363
  export {
3253
- io as $,
3254
- z as A,
3255
- ue as B,
3256
- Er as C,
3257
- _a as D,
3258
- Vr as E,
3259
- co as F,
3260
- yo as G,
3261
- Vn as H,
3262
- ka as I,
3263
- Nn as J,
3264
- En as K,
3265
- $t as L,
3266
- Kn as M,
3267
- Pr as N,
3268
- Bn as O,
3269
- Ne as P,
3270
- Ua as Q,
3271
- $a as R,
3272
- Ya as S,
3273
- Bt as T,
3274
- hr as U,
3275
- ao as V,
3276
- Ja as W,
3277
- er as X,
3278
- Ve as Y,
3279
- Ha as Z,
3280
- eo as _,
3281
- go as a,
3282
- to as a0,
3283
- Nt as a1,
3284
- cr as a2,
3285
- Fr as a3,
3286
- re as a4,
3287
- Za as a5,
3288
- no as a6,
3289
- jn as a7,
3290
- Zn as a8,
3291
- pr as a9,
3292
- Fo as aA,
3293
- aa as aB,
3294
- Ke as aC,
3295
- bo as aD,
3296
- Co as aE,
3297
- ho as aF,
3298
- ta as aG,
3299
- da as aH,
3300
- So as aI,
3301
- xo as aJ,
3302
- vo as aK,
3303
- ra as aL,
3304
- fo as aM,
3305
- Ar as aN,
3306
- lr as aO,
3307
- Do as aP,
3308
- ut as aQ,
3309
- ua as aR,
3310
- ie as aS,
3311
- La as aT,
3312
- yr as aa,
3313
- ro as ab,
3314
- Se as ac,
3315
- ur as ad,
3316
- Qa as ae,
3317
- Ga as af,
3318
- Wa as ag,
3319
- Wn as ah,
3320
- Gn as ai,
3321
- Cr as aj,
3322
- xe as ak,
3323
- qa as al,
3324
- An as am,
3325
- Ba as an,
3326
- Rn as ao,
3327
- ja as ap,
3328
- de as aq,
3329
- ae as ar,
3330
- Ka as as,
3331
- Xa as at,
3332
- rr as au,
3333
- za as av,
3334
- Rr as aw,
3335
- ni as ax,
3336
- Mo as ay,
3337
- ne as az,
3338
- po as b,
3339
- lo as c,
3340
- oa as d,
3341
- Br as e,
3342
- Kr as f,
3343
- Ra as g,
3344
- Pn as h,
3345
- Ir as i,
3346
- Sr as j,
3347
- Mr as k,
3348
- oo as l,
3349
- Dr as m,
3350
- Tr as n,
3351
- so as o,
3352
- wr as p,
3353
- ma as q,
3354
- Io as r,
3355
- pa as s,
3356
- ya as t,
3357
- To as u,
3358
- ke as v,
3359
- vr as w,
3360
- mr as x,
3361
- mo as y,
3362
- uo as z
3364
+ bo as $,
3365
+ qe as A,
3366
+ Sr as B,
3367
+ br as C,
3368
+ Ha as D,
3369
+ Mo as E,
3370
+ xo as F,
3371
+ z as G,
3372
+ fe as H,
3373
+ Ja as I,
3374
+ Br as J,
3375
+ Kr as K,
3376
+ Io as L,
3377
+ To as M,
3378
+ Er as N,
3379
+ Kn as O,
3380
+ kn as P,
3381
+ Bn as Q,
3382
+ zo as R,
3383
+ Gt as S,
3384
+ zn as T,
3385
+ $n as U,
3386
+ Ee as V,
3387
+ no as W,
3388
+ to as X,
3389
+ co as Y,
3390
+ Lt as Z,
3391
+ xr as _,
3392
+ wo as a,
3393
+ lo as a0,
3394
+ ar as a1,
3395
+ Ve as a2,
3396
+ ro as a3,
3397
+ mo as a4,
3398
+ yo as a5,
3399
+ po as a6,
3400
+ Rt as a7,
3401
+ pr as a8,
3402
+ Mr as a9,
3403
+ cr as aA,
3404
+ eo as aB,
3405
+ qr as aC,
3406
+ ko as aD,
3407
+ oi as aE,
3408
+ No as aF,
3409
+ fa as aG,
3410
+ re as aH,
3411
+ Le as aI,
3412
+ Po as aJ,
3413
+ _o as aK,
3414
+ Oo as aL,
3415
+ la as aM,
3416
+ ba as aN,
3417
+ Vo as aO,
3418
+ Ro as aP,
3419
+ Ao as aQ,
3420
+ da as aR,
3421
+ So as aS,
3422
+ Vr as aT,
3423
+ mr as aU,
3424
+ Bo as aV,
3425
+ ft as aW,
3426
+ ga as aX,
3427
+ ne as aY,
3428
+ Xa as aZ,
3429
+ ae as aa,
3430
+ fo as ab,
3431
+ ho as ac,
3432
+ Qn as ad,
3433
+ rr as ae,
3434
+ vr as af,
3435
+ Fr as ag,
3436
+ go as ah,
3437
+ De as ai,
3438
+ yr as aj,
3439
+ so as ak,
3440
+ ao as al,
3441
+ oo as am,
3442
+ Zn as an,
3443
+ Xn as ao,
3444
+ Dr as ap,
3445
+ Me as aq,
3446
+ Za as ar,
3447
+ Vn as as,
3448
+ Qa as at,
3449
+ qn as au,
3450
+ io as av,
3451
+ me as aw,
3452
+ oe as ax,
3453
+ Ya as ay,
3454
+ uo as az,
3455
+ Do as b,
3456
+ Co as c,
3457
+ ma as d,
3458
+ $r as e,
3459
+ zr as f,
3460
+ Wa as g,
3461
+ En as h,
3462
+ Tr as i,
3463
+ Pr as j,
3464
+ Or as k,
3465
+ vo as l,
3466
+ Ar as m,
3467
+ Nr as n,
3468
+ Fo as o,
3469
+ _r as p,
3470
+ Fa as q,
3471
+ Eo as r,
3472
+ Ca as s,
3473
+ Ia as t,
3474
+ Ko as u,
3475
+ Lo as v,
3476
+ qo as w,
3477
+ Da as x,
3478
+ $o as y,
3479
+ jo as z
3363
3480
  };