react-semaphor 0.1.566 → 0.1.568

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