react-semaphor 0.1.565 → 0.1.566

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 (34) hide show
  1. package/dist/assistant-context/index.js +1 -1
  2. package/dist/briefings/index.js +50 -46
  3. package/dist/chunks/{assistant-chat-DNfb5fbF.js → assistant-chat-DNKAYSQL.js} +5 -5
  4. package/dist/chunks/{bookmark-impact-CHr7b1J2.js → bookmark-impact-BeUbq0jc.js} +1 -1
  5. package/dist/chunks/{card-filter-builder-CcEcfaYz.js → card-filter-builder-SXaRWbKr.js} +46 -46
  6. package/dist/chunks/{dashboard-CtIfxycc.js → dashboard-Cni7nGhg.js} +1 -1
  7. package/dist/chunks/{dashboard-briefing-launcher-D3mc6peE.js → dashboard-briefing-launcher-CXeXRTem.js} +202 -202
  8. package/dist/chunks/{dashboard-controls-BFv0zdws.js → dashboard-controls-CsqKybrf.js} +56 -56
  9. package/dist/chunks/{dashboard-json-CXn_3OYb.js → dashboard-json-WWmw3Piu.js} +1 -1
  10. package/dist/chunks/{dates-DcRxw17S.js → dates-DJRUS-he.js} +4 -4
  11. package/dist/chunks/{edit-dashboard-visual-Y6HatqBd.js → edit-dashboard-visual-BrIEaBhc.js} +213 -197
  12. package/dist/chunks/{filter-reach-copy-DbggA5B7.js → filter-reach-copy-D5LqgrUf.js} +852 -858
  13. package/dist/chunks/{index-DDa_rklN.js → index-Bq9UbCGk.js} +648 -574
  14. package/dist/chunks/{report-preferences-dialog-Db-b04B4.js → report-preferences-dialog-CeHioJwL.js} +7 -7
  15. package/dist/chunks/{resolve-dashboard-input-context-C18J-YZC.js → resolve-dashboard-input-context-CwS-2r-b.js} +3497 -3472
  16. package/dist/chunks/{saved-dashboard-context-DhC_EVus.js → saved-dashboard-context-c-MZZTx2.js} +2 -2
  17. package/dist/chunks/{semaphor-ready-indicator-T6TsiBMT.js → semaphor-ready-indicator-B2NpYRE-.js} +27601 -27648
  18. package/dist/chunks/{shelf-drop-preview-context-CNWL_b0S.js → shelf-drop-preview-context-DM7yypwC.js} +2 -2
  19. package/dist/chunks/{stored-dashboard-IdmtrNkA.js → stored-dashboard-DTWc2pzt.js} +204 -204
  20. package/dist/chunks/{variable-draft-3xseULxR.js → variable-draft-DFizFCJu.js} +2 -2
  21. package/dist/dashboard/index.js +1 -1
  22. package/dist/dashboard-authoring/index.js +1669 -1642
  23. package/dist/index.js +11 -11
  24. package/dist/style.css +1 -1
  25. package/dist/surfboard/index.js +1 -1
  26. package/dist/types/briefings/delivery-outcome.d.ts +37 -0
  27. package/dist/types/briefings/index.d.ts +2 -0
  28. package/dist/types/briefings/run-outcomes.d.ts +6 -0
  29. package/dist/types/components/briefings/briefing-author/run-model.d.ts +9 -0
  30. package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +15 -3
  31. package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +2 -0
  32. package/dist/types/shared/dashboard-authoring/dashboard-filter-sql-subscription.d.ts +24 -0
  33. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +20 -4
  34. package/package.json +1 -1
@@ -1,40 +1,27 @@
1
- import { J as ur, K as fr, M as mr, N as rn, O as pr, P as hr, Q as gr, R as yr, S as br, T as an, U as vr, V as Ir, W as Cr, X as Oe, Y as Fr, Z as Sr, _ as xr, g as wr, k as be, $ as Tr, a0 as Dr } from "./stored-dashboard-IdmtrNkA.js";
2
- import { fw as on, bo as ve, fx as kr, fy as Mr, fz as Or, fA as _r, O as H, fB as sn, bq as Pr, fC as Ar, fD as Ye, ah as Xe, fE as Nr, fF as Er, fG as Rr, K as Je, fH as $r, bz as Kr, P as Vr, fI as Lr, L as Br, m as Qe, fJ as Ze, fK as qr, fL as F, o as xe, fM as Q, fN as T, fO as Ur, fP as zr, fQ as Tt, fR as jr, fS as Dt, fT as Gr, aN as w, fU as cn, aY as et, fV as Wr, fW as Hr, fX as Yr, fY as Xr, fZ as Jr, f_ as ln, cd as dn, f$ as un, g0 as fn, g1 as Ie, g2 as kt, a2 as Y, g3 as tt, g4 as Mt, g5 as nt, t as Ot, g6 as _t, c0 as rt, g7 as Qr, g8 as Zr, g9 as ei, ga as re, gb as ti, gc as ni, gd as ri, a5 as ii, bt as ai, c5 as it, ge as mn, gf as Ve, J as oi, aC as si, dW as ci, gg as li, gh as di, gi as ui, gj as fi, gk as mi, gl as pi, gm as hi, gn as gi, go as Le, gp as yi, fr as _e, gq as bi, gr as vi, gs as pn, a as hn, gt as Ii, gu as Ci, c_ as gn, gv as Pt, cy as Fi, d1 as At, d0 as Si, e2 as xi, aR as wi, eD as Ti, gw as Di, gx as ki, ck as Nt } from "./resolve-dashboard-input-context-C18J-YZC.js";
3
- import { H as ce, f as Mi, e as Oi, G as yn, aA as _i, v as Pi, n as Ai, d as Ni } from "./validators-wtjw0aw6.js";
4
- import { N as Ei, r as Pe } from "./matrix-operation-contract-Eb6elidS.js";
5
- import { r as Ri, C as $i } from "./metric-comparison-ChXUFaZu.js";
6
- import { t as Et, e as Rt } from "./analytics-base-schemas-BaIQrEzX.js";
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";
7
7
  import "zod";
8
- import { b as J, i as N, aI as Ki, aJ as Vi, m as Li, h as Bi, d as Be, e as qi, Q as _, af as Ui, am as zi, c as ji, ah as Gi, W as Wi, w as Hi, a5 as Yi } from "./temporal-input-presentation--2r9BLr0.js";
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";
9
9
  import "../value-format-preferences/index.js";
10
- import { y as Xi, R as Ji, J as Qi, ae as Zi, a0 as $t, M as bn, z as vn, ap as ea, N as In, A as ta, a4 as na, a5 as ra, F as Cn, W as ia, X as Fn, H as at, Y as Sn, aq as aa } from "./bookmark-state-ByODVqee.js";
11
- import { g as oa } from "./_commonjsHelpers-DimLPMtv.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";
12
12
  import "./index-CuHybtft.js";
13
13
  import "./index-RNaTnE3m.js";
14
14
  import "./context-R31TSL5V.js";
15
- import { a as sa } from "./source-entity-resolution-DF6GulDn.js";
16
- import { R as ca, l as la } from "./matrix-analytical-definition-C9xB_T84.js";
17
- import { r as qe } from "./pivot-result-identity-BlbLrqaC.js";
15
+ import { a as ca } from "./source-entity-resolution-DF6GulDn.js";
16
+ import { R as la, l as da } from "./matrix-analytical-definition-C9xB_T84.js";
17
+ import { r as Ue } from "./pivot-result-identity-BlbLrqaC.js";
18
18
  import { r as xn } from "./applied-constraints-DU-wndZ7.js";
19
- const da = /\{\{-?\s*filters\s*\|\s*where\s*-?\}\}/i, ua = /\{\{-?\s*filters\s*\|\s*and\s*-?\}\}/i, fa = /\bwhere\b/i;
20
- function ma(e) {
21
- return e != null && e.trim() ? da.test(e) || ua.test(e) : !1;
22
- }
23
- function sc(e) {
24
- return !(e != null && e.trim()) || ma(e) ? null : fa.test(e) ? {
25
- helper: "{{ filters | and }}",
26
- description: "For queries with an existing WHERE clause."
27
- } : {
28
- helper: "{{ filters | where }}",
29
- description: "For queries without a WHERE clause."
30
- };
31
- }
32
- function pa(e, t) {
19
+ function ua(e, t) {
33
20
  if (!(typeof e != "number" || typeof t != "number"))
34
21
  return e === t ? t : void 0;
35
22
  }
36
23
  function U(e, t) {
37
- const n = J(e, t);
24
+ const n = Q(e, t);
38
25
  if (n) {
39
26
  if (n.type === "date")
40
27
  return {
@@ -66,7 +53,7 @@ function U(e, t) {
66
53
  type: n.type,
67
54
  locale: n.locale,
68
55
  currency: n.type === "currency" ? n.currency : void 0,
69
- decimalPlaces: t != null && t.preserveOmittedProperties ? void 0 : pa(
56
+ decimalPlaces: t != null && t.preserveOmittedProperties ? void 0 : ua(
70
57
  n.minimumFractionDigits,
71
58
  n.maximumFractionDigits
72
59
  ),
@@ -84,7 +71,7 @@ function U(e, t) {
84
71
  }
85
72
  }
86
73
  function wn(e, t) {
87
- const n = J(e, t);
74
+ const n = Q(e, t);
88
75
  return (n == null ? void 0 : n.type) === "duration" ? {
89
76
  style: "duration",
90
77
  duration: {
@@ -100,7 +87,7 @@ function wn(e, t) {
100
87
  } : !n || !N(n) ? void 0 : {
101
88
  style: n.type === "currency" ? "currency" : n.type === "percent" ? "percent" : n.type === "scientific" ? "scientific" : "decimal",
102
89
  currency: n.type === "currency" && n.currency || (t != null && t.preserveOmittedProperties ? void 0 : "USD"),
103
- locale: n.locale || (t != null && t.preserveOmittedProperties ? void 0 : Ki),
90
+ locale: n.locale || (t != null && t.preserveOmittedProperties ? void 0 : Vi),
104
91
  minimumFractionDigits: n.minimumFractionDigits ?? (t != null && t.preserveOmittedProperties ? void 0 : 0),
105
92
  maximumFractionDigits: n.maximumFractionDigits ?? (t != null && t.preserveOmittedProperties ? void 0 : 2),
106
93
  useGrouping: typeof n.useGrouping == "boolean" ? n.useGrouping : !0,
@@ -113,30 +100,30 @@ function wn(e, t) {
113
100
  suffix: n.suffix
114
101
  };
115
102
  }
116
- const Kt = [10, 20, 50, 100, 500, 1e3], ha = 50;
117
- function ga(e) {
118
- return e && e > 0 ? e : ha;
103
+ const Kt = [10, 20, 50, 100, 500, 1e3], fa = 50;
104
+ function ma(e) {
105
+ return e && e > 0 ? e : fa;
119
106
  }
120
- function cc(e) {
121
- const t = ga(e), n = [...Kt];
107
+ function ac(e) {
108
+ const t = ma(e), n = [...Kt];
122
109
  return Kt.includes(
123
110
  t
124
111
  ) || (n.push(t), n.sort((r, i) => r - i)), n;
125
112
  }
126
- function lc(e) {
113
+ function oc(e) {
127
114
  var t, n;
128
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));
129
116
  }
130
- function ya(e, t) {
117
+ function pa(e, t) {
131
118
  var r, i, o, a;
132
119
  if (t === "table-print")
133
120
  return "disabled";
134
121
  if ((i = (r = e.preferences) == null ? void 0 : r.tablePrefs) != null && i.forceClientPagination)
135
122
  return "client";
136
123
  const n = on(e.config);
137
- return e.sql && !n ? (a = (o = e.preferences) == null ? void 0 : o.tablePrefs) != null && a.enableDevModePagination ? "server" : "client" : n && ur(e) ? "server" : "client";
124
+ return e.sql && !n ? (a = (o = e.preferences) == null ? void 0 : o.tablePrefs) != null && a.enableDevModePagination ? "server" : "client" : n && fr(e) ? "server" : "client";
138
125
  }
139
- const Tn = Object.freeze({}), dc = {
126
+ const Tn = Object.freeze({}), sc = {
140
127
  access: "session-only",
141
128
  printMode: !1,
142
129
  baseline: null,
@@ -147,26 +134,26 @@ const Tn = Object.freeze({}), dc = {
147
134
  isFavorite: !1,
148
135
  fetchedAt: 0
149
136
  };
150
- function uc(e) {
137
+ function cc(e) {
151
138
  return !e.viewer.printMode && e.viewer.access !== "session-only" && !!e.viewer.baseline && !!e.viewerStateClient && !e.isDashboardEditing;
152
139
  }
153
- function ba(e) {
140
+ function ga(e) {
154
141
  return e.isDashboardEditing ? Tn : e.viewer.tableSettings;
155
142
  }
156
- function va(e, t) {
157
- return ba(e)[t];
143
+ function ha(e, t) {
144
+ return ga(e)[t];
158
145
  }
159
- function fc(e, t, n) {
160
- if (!(n.isEditorPreview || e.isDashboardEditing) && Xi(e.dashboard, t))
161
- return { settings: va(e, t) };
146
+ function lc(e, t, n) {
147
+ if (!(n.isEditorPreview || e.isDashboardEditing) && Qi(e.dashboard, t))
148
+ return { settings: ha(e, t) };
162
149
  }
163
- function Ia(e) {
150
+ function ya(e) {
164
151
  var t;
165
- return fr({
152
+ return mr({
166
153
  card: e.card,
167
- paginationMode: ya(e.card) === "server" ? "server" : "client",
154
+ paginationMode: pa(e.card) === "server" ? "server" : "client",
168
155
  result: {
169
- keys: e.keys ?? mr(e.records),
156
+ keys: e.keys ?? pr(e.records),
170
157
  rows: e.records,
171
158
  columns: e.resultColumns,
172
159
  columnKeyMap: e.columnKeyMap,
@@ -176,14 +163,14 @@ function Ia(e) {
176
163
  projection: "export"
177
164
  });
178
165
  }
179
- function Ca(e) {
166
+ function ba(e) {
180
167
  if (e)
181
168
  return U(
182
- J(e, { preserveOmittedProperties: !0 }),
169
+ Q(e, { preserveOmittedProperties: !0 }),
183
170
  { preserveOmittedProperties: !0 }
184
171
  );
185
172
  }
186
- function Fa(e) {
173
+ function va(e) {
187
174
  if (e.type === "percent") {
188
175
  const { multiplyBy: t, percentValueMode: n, ...r } = e, i = t === 100 ? "fraction" : t === 1 ? "whole" : t === void 0 ? n : void 0;
189
176
  if (i || t === void 0)
@@ -195,7 +182,7 @@ function Fa(e) {
195
182
  ve(e, { preserveOmittedProperties: !0 })
196
183
  );
197
184
  }
198
- const we = Ca, mc = Fa, Sa = () => ({
185
+ const Te = ba, dc = va, Ia = () => ({
199
186
  urlTemplate: "{value}",
200
187
  // Default: use cell value as-is
201
188
  labelType: "value",
@@ -209,9 +196,9 @@ const we = Ca, mc = Fa, Sa = () => ({
209
196
  inheritMetricFormat: !0,
210
197
  textAlign: "left",
211
198
  // The table's one width rule (card appearance P2-21).
212
- width: Or,
213
- minWidth: Mr,
214
- maxWidth: kr,
199
+ width: _r,
200
+ minWidth: Or,
201
+ maxWidth: Mr,
215
202
  textOverflow: "ellipsis",
216
203
  textWrap: "default",
217
204
  numberFormat: {
@@ -233,12 +220,12 @@ const we = Ca, mc = Fa, Sa = () => ({
233
220
  sourceTimezone: "auto"
234
221
  // Default to auto (use explicit timezone if present, otherwise assume UTC)
235
222
  },
236
- linkFormat: Sa()
223
+ linkFormat: Ia()
237
224
  });
238
- function pc(e, t, n, r) {
225
+ function uc(e, t, n, r) {
239
226
  return t && t !== "auto" ? t : n;
240
227
  }
241
- const hc = (e) => !e || e === "auto" ? "local time" : {
228
+ const fc = (e) => !e || e === "auto" ? "local time" : {
242
229
  "America/New_York": "Eastern Time",
243
230
  "America/Chicago": "Central Time",
244
231
  "America/Denver": "Mountain Time",
@@ -275,8 +262,8 @@ function Ce(e, t) {
275
262
  };
276
263
  }
277
264
  function st(e, t = "auto", n = {}) {
278
- if (t === "auto" && (t = ka(e, n)), (t === "number" || t === "currency" || t === "percent" || t === "scientific") && n.signDisplay && n.signDisplay !== "auto" && Number.isFinite(Number(e))) {
279
- const i = typeof n.multiplyBy == "number" && Number.isFinite(n.multiplyBy) ? n.multiplyBy : 1, o = Number(e) * i, a = Vi(o, n.signDisplay), s = st(a.value === o ? e : -Number(e), t, { ...n, signDisplay: void 0 });
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 });
280
267
  if (!a.plus) return s;
281
268
  const c = n.prefix ?? "";
282
269
  return c && s.startsWith(c) ? `${c}+${s.slice(c.length)}` : `+${s}`;
@@ -287,13 +274,13 @@ function st(e, t = "auto", n = {}) {
287
274
  case "currency":
288
275
  return Mn(e, n);
289
276
  case "percent":
290
- return xa(e, n);
277
+ return Ca(e, n);
291
278
  case "date":
292
- return wa(e, n);
279
+ return Fa(e, n);
293
280
  case "scientific":
294
- return Ta(e, n);
281
+ return Sa(e, n);
295
282
  case "duration":
296
- return Da(e, n);
283
+ return xa(e, n);
297
284
  default:
298
285
  return String(e);
299
286
  }
@@ -314,7 +301,7 @@ function kn(e, t = {}) {
314
301
  );
315
302
  }
316
303
  function Mn(e, t = {}) {
317
- return qi(e, {
304
+ return Ui(e, {
318
305
  ...Ce(t, {
319
306
  min: 2,
320
307
  max: 2
@@ -323,7 +310,7 @@ function Mn(e, t = {}) {
323
310
  currency: t.currency || "USD"
324
311
  });
325
312
  }
326
- function xa(e, t = {}) {
313
+ function Ca(e, t = {}) {
327
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;
328
315
  return Be(o, {
329
316
  locale: t.locale,
@@ -336,7 +323,7 @@ function xa(e, t = {}) {
336
323
  useSuffix: !1
337
324
  });
338
325
  }
339
- function wa(e, t = {}) {
326
+ function Fa(e, t = {}) {
340
327
  const { locale: n = "en-US" } = t;
341
328
  try {
342
329
  const r = new Date(e);
@@ -347,14 +334,14 @@ function wa(e, t = {}) {
347
334
  return String(e);
348
335
  }
349
336
  }
350
- function Ta(e, t = {}) {
337
+ function Sa(e, t = {}) {
351
338
  return Bi(
352
339
  e,
353
340
  Ce(t, { min: 2, max: 2 })
354
341
  );
355
342
  }
356
- function Da(e, t = {}) {
357
- return Li(e, {
343
+ function xa(e, t = {}) {
344
+ return qi(e, {
358
345
  inputUnit: t.durationInputUnit,
359
346
  outputStyle: t.durationDisplayStyle,
360
347
  largestUnit: t.durationLargestUnit,
@@ -365,13 +352,13 @@ function Da(e, t = {}) {
365
352
  negativeInParentheses: t.negativeInParentheses
366
353
  });
367
354
  }
368
- function ka(e, t) {
355
+ function wa(e, t) {
369
356
  return t.currency ? "currency" : typeof e == "string" && !isNaN(Date.parse(e)) ? "date" : "number";
370
357
  }
371
- function gc(e, t = {}) {
358
+ function mc(e, t = {}) {
372
359
  return (n) => st(n, e, t);
373
360
  }
374
- function Ma({
361
+ function Ta({
375
362
  number: e,
376
363
  decimalPlaces: t = 0,
377
364
  useSuffix: n = !1,
@@ -395,7 +382,7 @@ function Ma({
395
382
  locale: o
396
383
  });
397
384
  }
398
- var Oa = function e(t, n) {
385
+ var Da = function e(t, n) {
399
386
  if (t === n) return !0;
400
387
  if (t && n && typeof t == "object" && typeof n == "object") {
401
388
  if (t.constructor !== n.constructor) return !1;
@@ -421,7 +408,7 @@ var Oa = function e(t, n) {
421
408
  }
422
409
  return t !== t && n !== n;
423
410
  };
424
- const Fe = /* @__PURE__ */ oa(Oa);
411
+ const Fe = /* @__PURE__ */ sa(Da);
425
412
  function ct(e, t) {
426
413
  var n;
427
414
  if (t.id)
@@ -438,8 +425,8 @@ function On(e) {
438
425
  n ? e.context.resolveBoundCurrency(n) : void 0
439
426
  );
440
427
  }
441
- function _a(e) {
442
- const t = H(e.card)[e.columnKey], n = (t == null ? void 0 : t.type) === "number" ? pr(
428
+ function ka(e) {
429
+ const t = H(e.card)[e.columnKey], n = (t == null ? void 0 : t.type) === "number" ? gr(
443
430
  { dataType: "number", format: void 0 },
444
431
  t
445
432
  ) : void 0, r = n == null ? void 0 : n.authoredFormat, i = N(r) ? On({
@@ -460,9 +447,9 @@ function _a(e) {
460
447
  format: i
461
448
  };
462
449
  }
463
- function yc(e) {
450
+ function pc(e) {
464
451
  const t = new Set(
465
- _r(e.records)
452
+ Pr(e.records)
466
453
  ), n = new Set(
467
454
  e.renderedMetricKeys || e.resultKeys
468
455
  ), r = H(e.card);
@@ -473,13 +460,13 @@ function yc(e) {
473
460
  }
474
461
  );
475
462
  }
476
- function bc(e) {
463
+ function gc(e) {
477
464
  var o, a;
478
465
  const { card: t, context: n } = e;
479
466
  if (!(n != null && n.preferences) || !sn(t.type))
480
467
  return t;
481
468
  const r = n.preferences, i = (o = t.sql) != null && o.trim() ? e.resultMetricKeys.map(
482
- (s) => _a({
469
+ (s) => ka({
483
470
  card: t,
484
471
  columnKey: s,
485
472
  context: n
@@ -511,7 +498,7 @@ function bc(e) {
511
498
  }
512
499
  };
513
500
  }
514
- function Te(e) {
501
+ function De(e) {
515
502
  var c;
516
503
  const { card: t, context: n, formatOptions: r } = e, i = n == null ? void 0 : n.preferences;
517
504
  if (!t || !i || !sn(t.type))
@@ -581,14 +568,14 @@ function Te(e) {
581
568
  preserveOmittedProperties: !0
582
569
  });
583
570
  }
584
- function Ue(e) {
571
+ function ze(e) {
585
572
  return e ? Object.entries(e).some(([t, n]) => n == null || n === "" ? !1 : t === "type" ? n !== "auto" : !0) : !1;
586
573
  }
587
574
  function _n(e) {
588
575
  if (e)
589
576
  return e.alias || e.label || e.name;
590
577
  }
591
- function ze(e, t) {
578
+ function je(e, t) {
592
579
  var r;
593
580
  return (((r = e == null ? void 0 : e.config) == null ? void 0 : r.metricColumns) || []).find((i) => {
594
581
  const o = _n(i);
@@ -597,14 +584,14 @@ function ze(e, t) {
597
584
  }
598
585
  function le(e, t) {
599
586
  var r, i;
600
- const n = Pr(e, t);
601
- if (!(n && ((i = (r = e == null ? void 0 : e.config) == null ? void 0 : r.groupByColumns) != null && i.includes(n)) && !Ar(n)))
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)))
602
589
  return n;
603
590
  }
604
- function Pa(e) {
591
+ function Ma(e) {
605
592
  return !!e && !(e != null && e.format) && ce(e == null ? void 0 : e.dataType) === "number";
606
593
  }
607
- const Aa = {
594
+ const Oa = {
608
595
  style: "decimal"
609
596
  };
610
597
  function Pn(e) {
@@ -616,7 +603,7 @@ function Pn(e) {
616
603
  ...e,
617
604
  inheritMetricFormat: e.numberFormat ? e.inheritMetricFormat : e.inheritMetricFormat ?? t.inheritMetricFormat,
618
605
  numberFormat: {
619
- ...Aa,
606
+ ...Oa,
620
607
  ...e.numberFormat
621
608
  },
622
609
  dateFormat: {
@@ -629,7 +616,7 @@ function Pn(e) {
629
616
  }
630
617
  };
631
618
  }
632
- function vc(e) {
619
+ function hc(e) {
633
620
  return Object.fromEntries(
634
621
  Object.entries(e || {}).map(([t, n]) => [
635
622
  t,
@@ -667,7 +654,7 @@ function An(e, t, n) {
667
654
  }
668
655
  return o;
669
656
  }
670
- function Ic(e) {
657
+ function yc(e) {
671
658
  let t = An(
672
659
  e.persisted,
673
660
  e.baseline,
@@ -676,11 +663,11 @@ function Ic(e) {
676
663
  if (e.enforceDeclaredSqlTemporalFormat && e.next.type === "date" && !e.next.dateFormat.useRelativeTime && e.next.dateFormat.useCustomFormat) {
677
664
  const n = e.next.dateFormat.customFormat;
678
665
  if (!(n != null && n.trim()))
679
- throw new Ui(
666
+ throw new zi(
680
667
  "invalid_raw_temporal_format",
681
668
  "Custom table date formatting requires a non-empty pattern."
682
669
  );
683
- zi({
670
+ ji({
684
671
  dialect: "date_fns",
685
672
  pattern: n,
686
673
  valueKind: e.rawTemporalValueKind
@@ -706,7 +693,7 @@ function Ic(e) {
706
693
  type: "date"
707
694
  } : t;
708
695
  }
709
- function Na(e, t) {
696
+ function _a(e, t) {
710
697
  const n = e || ot(), r = !t;
711
698
  return {
712
699
  ...n,
@@ -720,25 +707,25 @@ function Na(e, t) {
720
707
  }
721
708
  };
722
709
  }
723
- function Ae(e) {
710
+ function Ne(e) {
724
711
  if (e)
725
712
  return e.trim().toLowerCase();
726
713
  }
727
714
  const Nn = /\s*(?:\((?:previous|last year|start|target|comparison)\)|δ)\s*$/i;
728
- function Ea(e) {
715
+ function Pa(e) {
729
716
  const t = e == null ? void 0 : e.trim();
730
717
  return t ? t.replace(Nn, "").trim() || t : void 0;
731
718
  }
732
- function Ra(e) {
719
+ function Aa(e) {
733
720
  const t = e == null ? void 0 : e.trim();
734
721
  return t ? Nn.test(t) : !1;
735
722
  }
736
- function $a(e, t) {
723
+ function Na(e, t) {
737
724
  return t.metricAlias ? e.find(
738
725
  (n) => Ri(n) === t.metricAlias
739
726
  ) : t.metricId ? e.find((n) => n.id === t.metricId) : void 0;
740
727
  }
741
- function Ka(e) {
728
+ function Ea(e) {
742
729
  var y;
743
730
  const {
744
731
  card: t,
@@ -749,60 +736,60 @@ function Ka(e) {
749
736
  metricKey: a
750
737
  } = e, s = ((y = t == null ? void 0 : t.config) == null ? void 0 : y.metricColumns) || [];
751
738
  if (r || n)
752
- return $a(s, {
739
+ return Na(s, {
753
740
  metricAlias: r,
754
741
  metricId: n
755
742
  });
756
743
  const c = [a, o], l = c.some(
757
- (h) => Ra(h)
744
+ (g) => Aa(g)
758
745
  ), d = c.filter(
759
- (h) => !!h
746
+ (g) => !!g
760
747
  );
761
- for (const h of d) {
762
- const g = ze(t, {
763
- columnId: h,
764
- metricAlias: h
748
+ for (const g of d) {
749
+ const h = je(t, {
750
+ columnId: g,
751
+ metricAlias: g
765
752
  });
766
- if (g)
767
- return g;
753
+ if (h)
754
+ return h;
768
755
  }
769
- const u = d.map((h) => Ae(h)).filter((h) => !!h), f = d.map((h) => Ea(h)).filter((h) => !!h);
770
- for (const h of f) {
771
- const g = ze(t, {
772
- columnId: h,
773
- metricAlias: h
756
+ const u = d.map((g) => Ne(g)).filter((g) => !!g), f = d.map((g) => Pa(g)).filter((g) => !!g);
757
+ for (const g of f) {
758
+ const h = je(t, {
759
+ columnId: g,
760
+ metricAlias: g
774
761
  });
775
- if (g)
776
- return g;
762
+ if (h)
763
+ return h;
777
764
  }
778
765
  if (s.length === 1)
779
766
  return s[0];
780
767
  if (!l && typeof i == "number" && i >= 0 && i < s.length)
781
768
  return s[i];
782
- const m = f.map((h) => Ae(h)).filter((h) => !!h), p = [
769
+ const m = f.map((g) => Ne(g)).filter((g) => !!g), p = [
783
770
  ...u,
784
771
  ...m
785
772
  ];
786
773
  if (p.length !== 0)
787
- return s.find((h) => {
788
- const g = [
789
- h.alias,
790
- h.label,
791
- h.name,
792
- _n(h)
793
- ].map((C) => Ae(C)).filter((C) => !!C);
774
+ return s.find((g) => {
775
+ const h = [
776
+ g.alias,
777
+ g.label,
778
+ g.name,
779
+ _n(g)
780
+ ].map((C) => Ne(C)).filter((C) => !!C);
794
781
  return p.some(
795
- (C) => g.includes(C)
782
+ (C) => h.includes(C)
796
783
  );
797
784
  });
798
785
  }
799
- function Va(e) {
800
- const t = J(e == null ? void 0 : e.format);
786
+ function $a(e) {
787
+ const t = Q(e == null ? void 0 : e.format);
801
788
  return U(t);
802
789
  }
803
790
  function Vt(e, t) {
804
791
  if (t)
805
- return ze(e, {
792
+ return je(e, {
806
793
  columnId: t,
807
794
  metricAlias: t
808
795
  });
@@ -812,35 +799,35 @@ function Lt(e) {
812
799
  if (t)
813
800
  return JSON.stringify(t);
814
801
  }
815
- function La(e, t) {
802
+ function Ra(e, t) {
816
803
  const n = Lt(e), r = Lt(t);
817
804
  return !!(n && r && n === r);
818
805
  }
819
- function Ba(e) {
806
+ function Ka(e) {
820
807
  if (e.length === 0)
821
808
  return;
822
809
  const t = e.map(
823
- (a) => Va(a)
810
+ (a) => $a(a)
824
811
  );
825
812
  if (!t.every(
826
- (a) => Ue(a)
813
+ (a) => ze(a)
827
814
  ))
828
815
  return;
829
816
  const r = t, [i] = r;
830
817
  return r.every(
831
- (a) => La(i, a)
818
+ (a) => Ra(i, a)
832
819
  ) ? i : void 0;
833
820
  }
834
- function De(e) {
835
- if (Ue(e.overrideFormatOptions))
821
+ function ke(e) {
822
+ if (ze(e.overrideFormatOptions))
836
823
  return {
837
824
  formatOptions: e.overrideFormatOptions || void 0,
838
825
  source: "override"
839
826
  };
840
- const t = Ba(
827
+ const t = Ka(
841
828
  e.metrics || []
842
829
  );
843
- return Ue(t) ? {
830
+ return ze(t) ? {
844
831
  formatOptions: t,
845
832
  source: "metric"
846
833
  } : {
@@ -870,7 +857,7 @@ function En(e) {
870
857
  ) || o[1] || o[0];
871
858
  return r === "x" ? u ? [u] : [] : f ? [f] : [];
872
859
  }
873
- const s = Xe(n, i);
860
+ const s = Qe(n, i);
874
861
  return n === "radar" ? r === "y" ? o : [] : r !== s ? [] : o;
875
862
  }
876
863
  function lt(e) {
@@ -879,13 +866,13 @@ function lt(e) {
879
866
  chartType: n,
880
867
  axis: r,
881
868
  preferences: i
882
- }), s = De({
883
- overrideFormatOptions: we(o == null ? void 0 : o.valueFormat),
869
+ }), s = ke({
870
+ overrideFormatOptions: Te(o == null ? void 0 : o.valueFormat),
884
871
  metrics: a
885
872
  });
886
873
  return {
887
874
  ...s,
888
- formatOptions: Te({
875
+ formatOptions: De({
889
876
  card: t,
890
877
  metrics: a,
891
878
  formatOptions: s.formatOptions,
@@ -893,14 +880,14 @@ function lt(e) {
893
880
  })
894
881
  };
895
882
  }
896
- function qa(e) {
897
- const { preferences: t, metric: n } = e, r = t == null ? void 0 : t.tooltipConfig, i = De({
898
- overrideFormatOptions: we(r == null ? void 0 : r.valueFormat),
883
+ function Va(e) {
884
+ const { preferences: t, metric: n } = e, r = t == null ? void 0 : t.tooltipConfig, i = ke({
885
+ overrideFormatOptions: Te(r == null ? void 0 : r.valueFormat),
899
886
  metrics: n ? [n] : []
900
887
  });
901
888
  return {
902
889
  ...i,
903
- formatOptions: Te({
890
+ formatOptions: De({
904
891
  card: e.card,
905
892
  metrics: e.metric ? [e.metric] : [],
906
893
  formatOptions: i.formatOptions,
@@ -909,13 +896,13 @@ function qa(e) {
909
896
  };
910
897
  }
911
898
  function dt(e, t, n) {
912
- return t === Xe(n, e) ? Nr(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) ? 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;
913
900
  }
914
901
  function ut(e) {
915
902
  const { chartType: t, preferences: n } = e;
916
- return t === "bubble" || t === "scatter" ? "y" : Xe(t, n);
903
+ return t === "bubble" || t === "scatter" ? "y" : Qe(t, n);
917
904
  }
918
- function Rn(e) {
905
+ function $n(e) {
919
906
  switch (e) {
920
907
  case "pie":
921
908
  case "doughnut":
@@ -928,8 +915,8 @@ function Rn(e) {
928
915
  return !0;
929
916
  }
930
917
  }
931
- function Cc(e) {
932
- const { card: t, chartType: n, preferences: r, metric: i } = e, o = qa({
918
+ function bc(e) {
919
+ const { card: t, chartType: n, preferences: r, metric: i } = e, o = Va({
933
920
  card: t,
934
921
  preferences: r,
935
922
  metric: i,
@@ -947,7 +934,7 @@ function Cc(e) {
947
934
  });
948
935
  return s.source === "override" ? s : o;
949
936
  }
950
- function Fc(e) {
937
+ function vc(e) {
951
938
  const { card: t, chartType: n, preferences: r, dataLabelsConfig: i } = e, o = n || (t == null ? void 0 : t.type), a = ut({
952
939
  chartType: o,
953
940
  preferences: r
@@ -956,19 +943,19 @@ function Fc(e) {
956
943
  chartType: o,
957
944
  axis: a,
958
945
  preferences: r
959
- }), c = De({
960
- overrideFormatOptions: we(i == null ? void 0 : i.valueFormat),
946
+ }), c = ke({
947
+ overrideFormatOptions: Te(i == null ? void 0 : i.valueFormat),
961
948
  metrics: s
962
949
  }), l = {
963
950
  ...c,
964
- formatOptions: Te({
951
+ formatOptions: De({
965
952
  card: t,
966
953
  metrics: s,
967
954
  formatOptions: c.formatOptions,
968
955
  context: e.numericPresentation
969
956
  })
970
957
  };
971
- if (l.source === "override" || !Rn(o))
958
+ if (l.source === "override" || !$n(o))
972
959
  return l;
973
960
  const d = lt({
974
961
  card: t,
@@ -984,14 +971,14 @@ function Fc(e) {
984
971
  });
985
972
  return d.source === "override" ? d : l;
986
973
  }
987
- function Ua(e) {
988
- const { preferences: t, dataLabelsConfig: n, metric: r } = e, i = De({
989
- overrideFormatOptions: we(n == null ? void 0 : n.valueFormat),
974
+ function La(e) {
975
+ const { preferences: t, dataLabelsConfig: n, metric: r } = e, i = ke({
976
+ overrideFormatOptions: Te(n == null ? void 0 : n.valueFormat),
990
977
  metrics: r ? [r] : []
991
978
  });
992
979
  return {
993
980
  ...i,
994
- formatOptions: Te({
981
+ formatOptions: De({
995
982
  card: e.card,
996
983
  metrics: e.metric ? [e.metric] : [],
997
984
  formatOptions: i.formatOptions,
@@ -999,16 +986,16 @@ function Ua(e) {
999
986
  })
1000
987
  };
1001
988
  }
1002
- function Sc(e) {
989
+ function Ic(e) {
1003
990
  var a, s;
1004
- const t = Ka({
991
+ const t = Ea({
1005
992
  card: e.card,
1006
993
  metricId: e.metricId,
1007
994
  metricAlias: e.metricAlias,
1008
995
  datasetIndex: e.datasetIndex,
1009
996
  datasetLabel: e.datasetLabel,
1010
997
  metricKey: e.metricKey
1011
- }), n = Ua({
998
+ }), n = La({
1012
999
  card: e.card,
1013
1000
  preferences: e.preferences,
1014
1001
  dataLabelsConfig: e.dataLabelsConfig,
@@ -1018,7 +1005,7 @@ function Sc(e) {
1018
1005
  if (n.source === "override")
1019
1006
  return n;
1020
1007
  const r = (a = e.card) == null ? void 0 : a.type;
1021
- if (!Rn(r))
1008
+ if (!$n(r))
1022
1009
  return n;
1023
1010
  let i = ut({
1024
1011
  chartType: r,
@@ -1044,15 +1031,15 @@ function Sc(e) {
1044
1031
  });
1045
1032
  return o.source === "override" ? o : n;
1046
1033
  }
1047
- function xc(e) {
1034
+ function Cc(e) {
1048
1035
  return (e == null ? void 0 : e.rawValue) === !0;
1049
1036
  }
1050
- function za(e) {
1037
+ function qa(e) {
1051
1038
  const t = e == null ? void 0 : e.numberFormat;
1052
1039
  if (!t)
1053
1040
  return;
1054
1041
  if (t.style === "duration")
1055
- return U(Ye(t), {
1042
+ return U(Xe(t), {
1056
1043
  preserveOmittedProperties: !0
1057
1044
  });
1058
1045
  const n = t.style === "currency" ? "currency" : t.style === "percent" ? "percent" : t.style === "scientific" ? "scientific" : "number", r = t.minimumFractionDigits, i = t.maximumFractionDigits;
@@ -1072,8 +1059,8 @@ function za(e) {
1072
1059
  suffix: t.suffix
1073
1060
  };
1074
1061
  }
1075
- function ja(e, t, n = !1) {
1076
- const r = n ? { preserveOmittedProperties: !0 } : void 0, i = J(e == null ? void 0 : e.format, r), o = wn(
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(
1077
1064
  i,
1078
1065
  r
1079
1066
  );
@@ -1093,7 +1080,7 @@ function ja(e, t, n = !1) {
1093
1080
  }
1094
1081
  };
1095
1082
  }
1096
- function $n(e) {
1083
+ function Rn(e) {
1097
1084
  var D;
1098
1085
  const {
1099
1086
  card: t,
@@ -1109,12 +1096,12 @@ function $n(e) {
1109
1096
  valueFormatPreferences: u,
1110
1097
  boundCurrency: f,
1111
1098
  preserveOmittedProperties: m
1112
- } = e, p = r ?? H(t)[n], y = !((D = t == null ? void 0 : t.sql) != null && D.trim()) || hr(p), h = y ? u : null, g = y ? f : void 0, C = i ?? Pn(p);
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);
1113
1100
  if (C && C.inheritMetricFormat !== !0)
1114
- return Bt(
1101
+ return qt(
1115
1102
  C,
1116
- h,
1117
- g
1103
+ g,
1104
+ h
1118
1105
  );
1119
1106
  const v = le(t, {
1120
1107
  columnId: n,
@@ -1123,24 +1110,24 @@ function $n(e) {
1123
1110
  columnKeyMap: d,
1124
1111
  fieldId: c,
1125
1112
  fieldRole: l
1126
- }), b = ja(
1113
+ }), b = Ba(
1127
1114
  v,
1128
1115
  C || o,
1129
1116
  m ?? !!u
1130
- ), S = !b && h && Pa(v) ? Na(
1117
+ ), S = !b && g && Ma(v) ? _a(
1131
1118
  C || o,
1132
- g
1119
+ h
1133
1120
  ) : void 0;
1134
- return Bt(
1121
+ return qt(
1135
1122
  b || S || C || o,
1136
- h,
1137
- g
1123
+ g,
1124
+ h
1138
1125
  );
1139
1126
  }
1140
- function Bt(e, t, n) {
1127
+ function qt(e, t, n) {
1141
1128
  if (!e || e.type !== "number" || !t)
1142
1129
  return e;
1143
- const r = e.numberFormat, i = r ? Ye(r, {
1130
+ const r = e.numberFormat, i = r ? Xe(r, {
1144
1131
  preserveOmittedProperties: !0
1145
1132
  }) : { type: "number" };
1146
1133
  if (!i || !N(i))
@@ -1163,16 +1150,16 @@ function Bt(e, t, n) {
1163
1150
  function Se(e) {
1164
1151
  if (!e.valueFormatPreferences)
1165
1152
  return;
1166
- const t = $n(e);
1153
+ const t = Rn(e);
1167
1154
  if (!t || t.type !== "number")
1168
1155
  return;
1169
- const n = Ye(t.numberFormat, {
1156
+ const n = Xe(t.numberFormat, {
1170
1157
  preserveOmittedProperties: !0
1171
1158
  });
1172
- if (!(!n || !ji(n)))
1159
+ if (!(!n || !Gi(n)))
1173
1160
  return n;
1174
1161
  }
1175
- function Ga(e) {
1162
+ function Ua(e) {
1176
1163
  var r, i;
1177
1164
  if (!e.presentation.preferences)
1178
1165
  return;
@@ -1208,7 +1195,7 @@ function Ga(e) {
1208
1195
  suffix: "×"
1209
1196
  };
1210
1197
  }
1211
- const n = gr({
1198
+ const n = yr({
1212
1199
  card: e.card,
1213
1200
  columnKey: e.columnId,
1214
1201
  metricId: e.metricId ?? (t && !((i = (r = e.card.config) == null ? void 0 : r.groupByColumns) != null && i.includes(t)) ? t.id : void 0)
@@ -1226,10 +1213,10 @@ function Ga(e) {
1226
1213
  boundCurrency: n ? e.presentation.resolveBoundCurrency(n) : void 0
1227
1214
  });
1228
1215
  }
1229
- function Wa(e) {
1216
+ function za(e) {
1230
1217
  var s, c, l, d, u;
1231
1218
  if (e.card.type === "matrixTable" && e.target.kind === "matrix_measure") {
1232
- const f = e.target, m = yr(e.card, e.matrixCatalog).find(
1219
+ const f = e.target, m = br(e.card, e.matrixCatalog).find(
1233
1220
  (y) => y.measureId === f.measureId
1234
1221
  ), p = m == null ? void 0 : m.canonical;
1235
1222
  return p && (p.type === "number" || p.type === "currency") ? _(
@@ -1246,7 +1233,7 @@ function Wa(e) {
1246
1233
  (y) => y.id === f
1247
1234
  )))
1248
1235
  return;
1249
- const m = br(e.card, {
1236
+ const m = vr(e.card, {
1250
1237
  ...f ? { column: { kind: "field", fieldId: f } } : {},
1251
1238
  resultColumnKey: e.target.kind === "column" ? e.target.columnKey : void 0
1252
1239
  }), p = m.authoredFormat;
@@ -1256,9 +1243,9 @@ function Wa(e) {
1256
1243
  e.boundCurrency
1257
1244
  ) : void 0;
1258
1245
  }
1259
- if (!((l = e.card.sql) != null && l.trim()) && !Er(e.card.type) && e.target.kind === "metric") {
1246
+ if (!((l = e.card.sql) != null && l.trim()) && !$r(e.card.type) && e.target.kind === "metric") {
1260
1247
  const f = e.target.metricId, m = (u = (d = e.card.config) == null ? void 0 : d.metricColumns) == null ? void 0 : u.find(
1261
- (h) => h.id === f
1248
+ (g) => g.id === f
1262
1249
  );
1263
1250
  if (!m)
1264
1251
  return;
@@ -1293,11 +1280,11 @@ function Wa(e) {
1293
1280
  });
1294
1281
  return N(a) ? a : void 0;
1295
1282
  }
1296
- function wc(e) {
1283
+ function Fc(e) {
1297
1284
  var n, r;
1298
1285
  const t = e.persistedSettings ?? H(e.card)[e.columnId];
1299
1286
  if (!t && !e.resolvedSettings || (t == null ? void 0 : t.inheritMetricFormat) === !0 || ((n = e.resolvedSettings) == null ? void 0 : n.inheritMetricFormat) === !0) {
1300
- const i = J(
1287
+ const i = Q(
1301
1288
  (r = le(e.card, {
1302
1289
  columnId: e.columnId,
1303
1290
  metricId: e.metricId,
@@ -1311,16 +1298,16 @@ function wc(e) {
1311
1298
  preserveOmittedProperties: !0
1312
1299
  });
1313
1300
  }
1314
- return za(
1315
- $n({
1301
+ return qa(
1302
+ Rn({
1316
1303
  ...e,
1317
1304
  persistedSettings: t
1318
1305
  })
1319
1306
  );
1320
1307
  }
1321
- function Tc(e) {
1308
+ function Sc(e) {
1322
1309
  const { value: t, formatOptions: n, preferences: r } = e;
1323
- return n != null && n.type && n.type !== "auto" ? st(t, n.type, n) : Ma({
1310
+ return n != null && n.type && n.type !== "auto" ? st(t, n.type, n) : Ta({
1324
1311
  number: t,
1325
1312
  decimalPlaces: 0,
1326
1313
  useSuffix: !1,
@@ -1329,7 +1316,7 @@ function Tc(e) {
1329
1316
  currency: ""
1330
1317
  });
1331
1318
  }
1332
- function Ha(e) {
1319
+ function ja(e) {
1333
1320
  return Rr({
1334
1321
  ...e,
1335
1322
  activation: Je({
@@ -1338,8 +1325,8 @@ function Ha(e) {
1338
1325
  })
1339
1326
  });
1340
1327
  }
1341
- function Dc(e) {
1342
- return $r({
1328
+ function xc(e) {
1329
+ return Kr({
1343
1330
  activation: Je({
1344
1331
  card: e.card,
1345
1332
  cardConfig: e.cardConfig
@@ -1348,8 +1335,8 @@ function Dc(e) {
1348
1335
  expectedResultOwner: e.expectedResultOwner
1349
1336
  });
1350
1337
  }
1351
- function Ya(e) {
1352
- const t = an(e.card, e.effectiveCardConfig), n = Ia({
1338
+ function Ga(e) {
1339
+ const t = an(e.card, e.effectiveCardConfig), n = ya({
1353
1340
  card: t,
1354
1341
  records: e.rows,
1355
1342
  keys: e.rows.length === 0 ? e.resultKeys : void 0,
@@ -1372,34 +1359,34 @@ function Ya(e) {
1372
1359
  }
1373
1360
  };
1374
1361
  }
1375
- function Xa(e) {
1362
+ function Wa(e) {
1376
1363
  var n;
1377
1364
  const t = (n = e.preferences) == null ? void 0 : n.comparisonPresentation;
1378
1365
  return {
1379
- ...$i,
1366
+ ...Ki,
1380
1367
  ...t,
1381
1368
  ...t != null && t.conditionalLabels ? { conditionalLabels: { ...t.conditionalLabels } } : {},
1382
1369
  ...t != null && t.colors ? { colors: { ...t.colors } } : {}
1383
1370
  };
1384
1371
  }
1385
- function Ja(e) {
1372
+ function Ha(e) {
1386
1373
  const t = an(e.card, e.effectiveCardConfig), { cardId: n, ...r } = e.requestPayloadBase, i = e.formatOptions.visibleColumns ?? [], o = [
1387
1374
  ...i,
1388
1375
  ...Object.keys(e.formatOptions.columnSettings ?? {})
1389
- ], a = vr(
1376
+ ], a = Ir(
1390
1377
  e.card,
1391
1378
  i,
1392
1379
  e.effectiveCardConfig
1393
- ), s = Ir(
1380
+ ), s = Cr(
1394
1381
  e.card,
1395
1382
  e.effectiveCardConfig,
1396
1383
  a
1397
- ), c = Cr(
1384
+ ), c = Fr(
1398
1385
  t,
1399
1386
  o
1400
1387
  ), l = new Set(
1401
- c.eligibleTargets.map(Oe)
1402
- ), d = (v) => l.has(Oe(v)) ? Sr({
1388
+ c.eligibleTargets.map(_e)
1389
+ ), d = (v) => l.has(_e(v)) ? xr({
1403
1390
  bindings: r.controlBindings,
1404
1391
  controls: [
1405
1392
  ...r.controlDefinitions ?? [],
@@ -1409,14 +1396,14 @@ function Ja(e) {
1409
1396
  target: v,
1410
1397
  knownTargets: c.knownTargets,
1411
1398
  eligibleTargets: c.eligibleTargets
1412
- }).currency : void 0, u = Fr({
1399
+ }).currency : void 0, u = Sr({
1413
1400
  card: e.card,
1414
1401
  comparisonMetadata: e.comparisonMetadata,
1415
1402
  columnKeyMap: e.columnKeyMap
1416
1403
  }), f = Je({
1417
1404
  card: e.card,
1418
1405
  cardConfig: e.effectiveCardConfig
1419
- }), m = Ha({
1406
+ }), m = ja({
1420
1407
  card: e.card,
1421
1408
  cardConfig: e.effectiveCardConfig,
1422
1409
  columns: e.resultColumns,
@@ -1428,7 +1415,7 @@ function Ja(e) {
1428
1415
  `${v.role}:${v.id}`,
1429
1416
  v
1430
1417
  ])
1431
- ), h = /* @__PURE__ */ new Map();
1418
+ ), g = /* @__PURE__ */ new Map();
1432
1419
  if (e.card.type === "detailTable" && r.resultOwner === "config") {
1433
1420
  const v = e.resultColumns || [];
1434
1421
  if (v.filter(
@@ -1438,7 +1425,7 @@ function Ja(e) {
1438
1425
  throw new Error(
1439
1426
  "Canonical raw temporal export requires an authoritative columnKeyMap."
1440
1427
  );
1441
- const b = Kr({
1428
+ const b = Vr({
1442
1429
  cardType: e.card.type,
1443
1430
  resultOwner: r.resultOwner,
1444
1431
  effectiveCardConfig: e.effectiveCardConfig,
@@ -1453,41 +1440,41 @@ function Ja(e) {
1453
1440
  if (b.kind === "invalid") throw b.error;
1454
1441
  if (b.kind === "loaded_empty" || b.kind === "loaded_valid")
1455
1442
  for (const [S, P] of b.presentation.byColumnKey)
1456
- h.set(S, P.format);
1443
+ g.set(S, P.format);
1457
1444
  }
1458
1445
  } else if (r.resultOwner === "freeform" && r.sql.trim() && !r.python.trim())
1459
1446
  for (const [v, I] of Object.entries(
1460
1447
  H(e.card)
1461
1448
  )) {
1462
1449
  if (I.type !== "date") continue;
1463
- const b = Vr(I.dateFormat);
1464
- b && h.set(
1450
+ const b = Lr(I.dateFormat);
1451
+ b && g.set(
1465
1452
  v,
1466
- Gi({
1453
+ Wi({
1467
1454
  format: b,
1468
1455
  preferences: e.reportContext.valueFormat,
1469
1456
  calendar: e.reportContext.calendar
1470
1457
  })
1471
1458
  );
1472
1459
  }
1473
- const g = [
1460
+ const h = [
1474
1461
  ...new Set(o)
1475
1462
  ].flatMap((v) => {
1476
- var G, R, ue;
1477
- if (m.byColumnKey.has(v) || h.has(v))
1463
+ var G, $, ue;
1464
+ if (m.byColumnKey.has(v) || g.has(v))
1478
1465
  return [];
1479
1466
  const I = u.columnPresentationOwners.get(v), b = {
1480
- ...Lr(t, v, {
1467
+ ...qr(t, v, {
1481
1468
  columnKeyMap: e.columnKeyMap,
1482
1469
  resultColumns: e.resultColumns
1483
1470
  }),
1484
1471
  ...I ? { metricId: I.metricId, metricAlias: I.metricAlias } : {}
1485
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(
1486
- Oe(P)
1473
+ _e(P)
1487
1474
  ), L = d(P), j = H(t)[v], E = {
1488
1475
  dashboardId: e.dashboardId,
1489
1476
  cardId: t.id
1490
- }, ee = { kind: "column", columnKey: v }, k = S && (!j || j.inheritMetricFormat === !0) ? J(S.format, {
1477
+ }, ee = { kind: "column", columnKey: v }, k = S && (!j || j.inheritMetricFormat === !0) ? Q(S.format, {
1491
1478
  preserveOmittedProperties: !0
1492
1479
  }) : void 0;
1493
1480
  if ((k == null ? void 0 : k.type) === "date")
@@ -1504,7 +1491,7 @@ function Ja(e) {
1504
1491
  }
1505
1492
  }
1506
1493
  ];
1507
- const B = (I ? Ga({
1494
+ const q = (I ? Ua({
1508
1495
  card: t,
1509
1496
  columnId: v,
1510
1497
  columnKeyMap: e.columnKeyMap,
@@ -1512,12 +1499,12 @@ function Ja(e) {
1512
1499
  metricId: I.metricId,
1513
1500
  metricAlias: I.metricAlias,
1514
1501
  comparisonValueKind: I.kind,
1515
- comparisonPrecision: (ue = (R = t.preferences) == null ? void 0 : R.comparisonPresentation) == null ? void 0 : ue.precision,
1502
+ comparisonPrecision: (ue = ($ = t.preferences) == null ? void 0 : $.comparisonPresentation) == null ? void 0 : ue.precision,
1516
1503
  presentation: {
1517
1504
  preferences: e.reportContext.valueFormat,
1518
1505
  resolveBoundCurrency: d
1519
1506
  }
1520
- }) : void 0) ?? (D ? Wa({
1507
+ }) : void 0) ?? (D ? za({
1521
1508
  card: t,
1522
1509
  target: P,
1523
1510
  resultColumnKeys: o,
@@ -1528,8 +1515,8 @@ function Ja(e) {
1528
1515
  ...b,
1529
1516
  persistedSettings: j,
1530
1517
  valueFormatPreferences: e.reportContext.valueFormat
1531
- }), q = (B == null ? void 0 : B.type) === "duration" ? B : B ? _(
1532
- B,
1518
+ }), B = (q == null ? void 0 : q.type) === "duration" ? q : q ? _(
1519
+ q,
1533
1520
  e.reportContext.valueFormat,
1534
1521
  L
1535
1522
  ) : _(
@@ -1541,10 +1528,10 @@ function Ja(e) {
1541
1528
  e.reportContext.valueFormat
1542
1529
  );
1543
1530
  return [
1544
- q.type === "duration" ? { scope: E, target: ee, format: q } : { scope: E, target: ee, format: q }
1531
+ B.type === "duration" ? { scope: E, target: ee, format: B } : { scope: E, target: ee, format: B }
1545
1532
  ];
1546
1533
  });
1547
- g.push(
1534
+ h.push(
1548
1535
  ...[...m.byColumnKey.values()].map((v) => {
1549
1536
  const I = y.get(
1550
1537
  `${v.role ?? "groupby"}:${v.fieldId}`
@@ -1569,32 +1556,32 @@ function Ja(e) {
1569
1556
  )
1570
1557
  };
1571
1558
  })
1572
- ), g.push(
1573
- ...[...h].map(([v, I]) => ({
1559
+ ), h.push(
1560
+ ...[...g].map(([v, I]) => ({
1574
1561
  scope: { dashboardId: e.dashboardId, cardId: e.card.id },
1575
1562
  target: { kind: "column", columnKey: v },
1576
1563
  format: I
1577
1564
  }))
1578
1565
  );
1579
- const C = Wi({
1566
+ const C = Hi({
1580
1567
  reportContext: e.reportContext,
1581
- resolvedFormats: g
1568
+ resolvedFormats: h
1582
1569
  });
1583
1570
  return {
1584
1571
  formatOptions: {
1585
1572
  ...e.formatOptions,
1586
1573
  ...a ? { tableTotalsLabelColumnKey: a } : {},
1587
- comparisonPresentation: Xa(e.card),
1574
+ comparisonPresentation: Wa(e.card),
1588
1575
  presentationExecutionSnapshot: C
1589
1576
  },
1590
1577
  ...s ? { tableTotalsRequest: s } : {}
1591
1578
  };
1592
1579
  }
1593
- function Qa(e) {
1594
- const t = wr(
1580
+ function Ya(e) {
1581
+ const t = Tr(
1595
1582
  e.card,
1596
1583
  e.requestPayloadBase
1597
- ), { cardId: n, ...r } = t.requestPayloadBase, i = Ja(e);
1584
+ ), { cardId: n, ...r } = t.requestPayloadBase, i = Ha(e);
1598
1585
  return {
1599
1586
  type: "card",
1600
1587
  dashboardId: e.dashboardId,
@@ -1608,14 +1595,14 @@ function Qa(e) {
1608
1595
  formatOptions: i.formatOptions
1609
1596
  };
1610
1597
  }
1611
- function kc(e) {
1598
+ function wc(e) {
1612
1599
  const { card: t, result: n } = e;
1613
1600
  if (t.type !== "table" && t.type !== "detailTable")
1614
1601
  return { status: "refused", reason: "not_a_table" };
1615
- const r = n.modelFormats ? Hi(e.effectiveCardConfig ?? t.config, n) : e.effectiveCardConfig;
1616
- if (xr({ card: t, comparisonMetadata: n.comparisonMetadata }))
1602
+ const r = n.modelFormats ? Yi(e.effectiveCardConfig ?? t.config, n) : e.effectiveCardConfig;
1603
+ if (wr({ card: t, comparisonMetadata: n.comparisonMetadata }))
1617
1604
  return { status: "refused", reason: "comparison_metadata_missing" };
1618
- const i = Ya({
1605
+ const i = Ga({
1619
1606
  card: t,
1620
1607
  effectiveCardConfig: r,
1621
1608
  rows: e.rows,
@@ -1626,7 +1613,7 @@ function kc(e) {
1626
1613
  });
1627
1614
  return i ? {
1628
1615
  status: "ready",
1629
- request: Qa({
1616
+ request: Ya({
1630
1617
  card: t,
1631
1618
  dashboardId: e.dashboardId,
1632
1619
  title: e.title,
@@ -1643,8 +1630,8 @@ function kc(e) {
1643
1630
  } : { status: "refused", reason: "columns_unresolved" };
1644
1631
  }
1645
1632
  function Kn(e, t, n) {
1646
- if (Mi(
1647
- Oi(t),
1633
+ if (Oi(
1634
+ _i(t),
1648
1635
  e.aggregateOrigin
1649
1636
  ))
1650
1637
  return { aggregate: void 0, aggregateOrigin: void 0 };
@@ -1654,7 +1641,7 @@ function Kn(e, t, n) {
1654
1641
  aggregateOrigin: e.aggregate ? e.aggregateOrigin : r ? t.aggregateOrigin : void 0
1655
1642
  };
1656
1643
  }
1657
- function Za(e, t, n) {
1644
+ function Xa(e, t, n) {
1658
1645
  var r, i, o, a, s, c;
1659
1646
  if (n === "domain")
1660
1647
  return {
@@ -1667,7 +1654,7 @@ function Za(e, t, n) {
1667
1654
  windowTransform: ((s = e.parameters) == null ? void 0 : s.windowTransform) ?? ((c = t.parameters) == null ? void 0 : c.windowTransform)
1668
1655
  };
1669
1656
  }
1670
- function Mc(e, t, n) {
1657
+ function Tc(e, t, n) {
1671
1658
  const r = e;
1672
1659
  return {
1673
1660
  id: e.id,
@@ -1682,16 +1669,16 @@ function Mc(e, t, n) {
1682
1669
  valueAliases: r.valueAliases,
1683
1670
  comparison: r.comparison,
1684
1671
  comparisonPolarity: r.comparisonPolarity,
1685
- parameters: Za(
1672
+ parameters: Xa(
1686
1673
  r,
1687
1674
  t,
1688
1675
  "domain"
1689
1676
  )
1690
1677
  } : {},
1691
- ...eo(e)
1678
+ ...Qa(e)
1692
1679
  };
1693
1680
  }
1694
- function eo(e) {
1681
+ function Qa(e) {
1695
1682
  const t = {
1696
1683
  ...e.labelOrigin === "override" ? { label: e.label, labelOrigin: e.labelOrigin } : {},
1697
1684
  ...e.formatOrigin === "override" ? { format: e.format, formatOrigin: e.formatOrigin } : {}
@@ -1711,17 +1698,17 @@ function eo(e) {
1711
1698
  return t;
1712
1699
  }
1713
1700
  }
1714
- const to = "table";
1715
- function Oc({ preferences: e, ...t }) {
1701
+ const Ja = "table";
1702
+ function Dc({ preferences: e, ...t }) {
1716
1703
  return {
1717
1704
  ...t,
1718
- type: to,
1705
+ type: Ja,
1719
1706
  preferences: e ?? { onClickFilter: [{ columnIndex: 0, expression: "" }] },
1720
1707
  sql: "",
1721
1708
  data: []
1722
1709
  };
1723
1710
  }
1724
- function _c(e) {
1711
+ function kc(e) {
1725
1712
  return {
1726
1713
  id: e.id,
1727
1714
  title: e.title,
@@ -1731,7 +1718,7 @@ function _c(e) {
1731
1718
  data: []
1732
1719
  };
1733
1720
  }
1734
- const no = {
1721
+ const Za = {
1735
1722
  SUM: "total",
1736
1723
  AVG: "average",
1737
1724
  MIN: "lowest",
@@ -1745,16 +1732,16 @@ function ne(e) {
1745
1732
  }
1746
1733
  function me(e) {
1747
1734
  const t = e;
1748
- return !e.aggregate || t.labelOrigin === "override" ? ne(e) : Ze(e.name);
1735
+ return !e.aggregate || t.labelOrigin === "override" ? ne(e) : et(e.name);
1749
1736
  }
1750
- function qt(e) {
1737
+ function Bt(e) {
1751
1738
  return e.length <= 1 ? e[0] ?? "" : `${e.slice(0, -1).join(", ")} and ${e[e.length - 1]}`;
1752
1739
  }
1753
- function ro(e) {
1740
+ function eo(e) {
1754
1741
  var i, o, a;
1755
- const t = Qi({ variables: [e] })[0];
1742
+ const t = Zi({ variables: [e] })[0];
1756
1743
  if (!t) return;
1757
- const n = Qe(t.card), r = n.kind === "config" ? n.executableSources[0] : n.kind === "sql" ? (i = n.pinnedCatalogSources[0]) == null ? void 0 : i.source : void 0;
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;
1758
1745
  if (!r) {
1759
1746
  const s = (a = (o = e.query.dataSource) == null ? void 0 : o.selectedEntities) == null ? void 0 : a[0];
1760
1747
  return (s == null ? void 0 : s.label) || (s == null ? void 0 : s.name) || void 0;
@@ -1762,7 +1749,7 @@ function ro(e) {
1762
1749
  if (r.kind === "semantic") return r.label || r.datasetName;
1763
1750
  if (r.kind === "physical") return r.label || r.tableName;
1764
1751
  }
1765
- function io(e) {
1752
+ function to(e) {
1766
1753
  var r;
1767
1754
  const t = (r = e.query.config) == null ? void 0 : r.filters, n = t ? Vn(t) : 0;
1768
1755
  return n ? n === 1 ? " with one condition" : ` with ${n} conditions` : "";
@@ -1776,18 +1763,18 @@ function Ut(e) {
1776
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";
1777
1764
  return ` by ${e.aggregate ? me(e) : ne(e)}, ${n}`;
1778
1765
  }
1779
- function ao(e) {
1766
+ function no(e) {
1780
1767
  var s, c, l;
1781
- const t = ro(e), n = t ? ` in ${t}` : "", r = io(e);
1768
+ const t = eo(e), n = t ? ` in ${t}` : "", r = to(e);
1782
1769
  if ((s = e.query.sql) != null && s.trim()) {
1783
1770
  const d = e.get.kind === "first" ? "the first row" : "the only row";
1784
- return `${oo(d)} of a SQL query${t ? ` on ${t}` : ""}`;
1771
+ return `${ro(d)} of a SQL query${t ? ` on ${t}` : ""}`;
1785
1772
  }
1786
1773
  const i = e.query.config ?? {}, o = i.groupByColumns ?? [], a = i.metricColumns ?? [];
1787
1774
  switch (e.get.kind) {
1788
1775
  case "aggregate": {
1789
1776
  const d = a[0];
1790
- return d ? d.aggregate ? `The ${no[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 ${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";
1791
1778
  }
1792
1779
  case "list": {
1793
1780
  const d = o[0];
@@ -1795,22 +1782,22 @@ function ao(e) {
1795
1782
  }
1796
1783
  case "first": {
1797
1784
  const d = [...o.map(ne), ...a.map(me)];
1798
- return d.length ? `The first ${qt(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 ${Bt(d)}${n}${r}${Ut((l = i.sortByColumns) == null ? void 0 : l[0])}` : "The first row, with no field chosen yet";
1799
1786
  }
1800
1787
  default: {
1801
1788
  const d = [...o.map(ne), ...a.map(me)];
1802
- return d.length ? `The ${qt(d)}${n}${r}, the only value` : "The only value, with no field chosen yet";
1789
+ return d.length ? `The ${Bt(d)}${n}${r}, the only value` : "The only value, with no field chosen yet";
1803
1790
  }
1804
1791
  }
1805
1792
  }
1806
1793
  function zt(e) {
1807
- const t = Zi(e);
1808
- return t ? `, compared with ${qr({ mode: "explicit", spec: t })}` : "";
1794
+ const t = ea(e);
1795
+ return t ? `, compared with ${Ur({ mode: "explicit", spec: t })}` : "";
1809
1796
  }
1810
- function oo(e) {
1797
+ function ro(e) {
1811
1798
  return e.charAt(0).toUpperCase() + e.slice(1);
1812
1799
  }
1813
- function so(e, t) {
1800
+ function io(e, t) {
1814
1801
  const n = e.sheets ?? [], r = n.findIndex((a) => a.id === t.sheetId), i = n[r];
1815
1802
  if (!i)
1816
1803
  throw new F("sheet_not_found", `No sheet ${t.sheetId} on this dashboard.`);
@@ -1820,17 +1807,17 @@ function so(e, t) {
1820
1807
  "This sheet is a document: it has no grid to arrange.",
1821
1808
  "Arrange a grid sheet; Document sheets are laid out in the editor."
1822
1809
  );
1823
- const o = Q(i, { kind: "arrange", keepOrder: t.keepOrder === !0 });
1810
+ const o = J(i, { kind: "arrange", keepOrder: t.keepOrder === !0 });
1824
1811
  return {
1825
1812
  dashboard: { ...e, sheets: n.map((a, s) => s === r ? o : a) },
1826
1813
  clauses: [T.arranged(i.title || "the dashboard", t.keepOrder === !0, !(i.frames ?? []).length)]
1827
1814
  };
1828
1815
  }
1829
- function co(e) {
1816
+ function ao(e) {
1830
1817
  return !!(e && Object.prototype.hasOwnProperty.call(e, "calculatedFields"));
1831
1818
  }
1832
1819
  function X(...e) {
1833
- return Ur(e.flatMap((t) => t || []));
1820
+ return zr(e.flatMap((t) => t || []));
1834
1821
  }
1835
1822
  function ie(e, t) {
1836
1823
  return {
@@ -1844,7 +1831,7 @@ function ft(e) {
1844
1831
  function Ln(e) {
1845
1832
  return ((e == null ? void 0 : e.calculatedFields) || []).filter((t) => !t.fieldScope).map((t) => ie(t, "sheet"));
1846
1833
  }
1847
- function lo(e) {
1834
+ function oo(e) {
1848
1835
  return e ? [
1849
1836
  ...(e.calculatedFields || []).filter(
1850
1837
  (t) => t.fieldScope === "dashboard"
@@ -1852,17 +1839,17 @@ function lo(e) {
1852
1839
  ...(e.frames || []).flatMap((t) => t.calculatedFields || [])
1853
1840
  ].map((t) => ie(t, "dashboard")) : [];
1854
1841
  }
1855
- function uo(e) {
1842
+ function so(e) {
1856
1843
  if (e !== void 0)
1857
1844
  return X(
1858
1845
  e.map((t) => ie(t, "dashboard"))
1859
1846
  );
1860
1847
  }
1861
- function Pc(e) {
1848
+ function Mc(e) {
1862
1849
  var r;
1863
1850
  const t = [], n = (e.sheets || []).map((i) => {
1864
1851
  var o;
1865
- return t.push(...lo(i)), {
1852
+ return t.push(...oo(i)), {
1866
1853
  ...i,
1867
1854
  calculatedFields: X(
1868
1855
  ft(i),
@@ -1875,7 +1862,7 @@ function Pc(e) {
1875
1862
  });
1876
1863
  return {
1877
1864
  ...e,
1878
- calculatedFields: uo(
1865
+ calculatedFields: so(
1879
1866
  X(
1880
1867
  (r = e.calculatedFields) == null ? void 0 : r.map(
1881
1868
  (i) => ie(i, "dashboard")
@@ -1898,30 +1885,30 @@ function jt(e, t) {
1898
1885
  ...r.map((o) => o.calculatedFields)
1899
1886
  );
1900
1887
  }
1901
- function fo(e, t) {
1888
+ function co(e, t) {
1902
1889
  return e ? ft(e) : [];
1903
1890
  }
1904
- function Ac(e, t) {
1891
+ function Oc(e, t) {
1905
1892
  if (!e)
1906
1893
  return [];
1907
1894
  const n = ft(e), r = Ln(e), i = X(
1908
1895
  n,
1909
1896
  r
1910
1897
  );
1911
- return co(e) ? i.length === 0 ? [] : r.length === 0 ? i : X(
1898
+ return ao(e) ? i.length === 0 ? [] : r.length === 0 ? i : X(
1912
1899
  i,
1913
1900
  jt(e, t)
1914
1901
  ) : jt(e, t);
1915
1902
  }
1916
- function mo(e) {
1903
+ function lo(e) {
1917
1904
  if (e !== void 0)
1918
1905
  return X(
1919
1906
  e.map((t) => ie(t, "sheet"))
1920
1907
  );
1921
1908
  }
1922
- function Nc(e) {
1909
+ function _c(e) {
1923
1910
  const { field: t, sheetFields: n = [], dashboardFields: r = [] } = e, i = (s) => s.find(
1924
- (c) => zr(c, t, {
1911
+ (c) => jr(c, t, {
1925
1912
  allowComparableFallback: !0
1926
1913
  })
1927
1914
  );
@@ -1935,7 +1922,7 @@ function Nc(e) {
1935
1922
  const a = i(r);
1936
1923
  return a ? { scope: "dashboard", matchedField: a } : { scope: "card" };
1937
1924
  }
1938
- function po(e, t) {
1925
+ function uo(e, t) {
1939
1926
  var C, v, I;
1940
1927
  const n = (e.sheets ?? []).findIndex((b) => b.id === t.sheetId), r = (C = e.sheets) == null ? void 0 : C[n];
1941
1928
  if (!(r != null && r.frames))
@@ -1946,27 +1933,27 @@ function po(e, t) {
1946
1933
  const a = r.frames[o], s = Tt(r), c = (b) => b.calculatedFields === void 0 ? b : { ...b, calculatedFields: void 0 }, l = t.rewrittenFrames, d = l && l.length > 0 ? (() => {
1947
1934
  const b = l.map((S) => S.id === i.id ? i : S);
1948
1935
  return b.some((S) => S.id === i.id) ? b : [i, ...b];
1949
- })() : [i], u = new Map(d.map((b) => [b.id, b])), f = Q(r, { kind: "frame_updated", frame: i, resizeForNewKind: t.resizeLayouts });
1936
+ })() : [i], u = new Map(d.map((b) => [b.id, b])), f = J(r, { kind: "frame_updated", frame: i, resizeForNewKind: t.resizeLayouts });
1950
1937
  let m = /* @__PURE__ */ new Set();
1951
- const p = jr.produce(e, (b) => {
1938
+ const p = Gr.produce(e, (b) => {
1952
1939
  const S = b.sheets[n];
1953
- f.layouts !== r.layouts && (S.layouts = Dt(f.layouts)), f.customizedBreakpoints !== r.customizedBreakpoints && (S.customizedBreakpoints = f.customizedBreakpoints), t.sheetCalculatedFields !== void 0 && (S.calculatedFields = mo(t.sheetCalculatedFields)), S.frames = S.frames.map((D) => {
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) => {
1954
1941
  const L = u.get(D.id);
1955
1942
  return L ? Dt(c(L)) : D.calculatedFields === void 0 ? D : { ...D, calculatedFields: void 0 };
1956
1943
  });
1957
1944
  const P = Tt(S);
1958
- m = new Set([...s].filter((D) => !P.has(D))), Gr(b, m), t.dashboardCalculatedFields && (b.calculatedFields = t.dashboardCalculatedFields);
1959
- }), y = p.sheets[n].frames.find((b) => b.id === i.id), h = [
1945
+ m = new Set([...s].filter((D) => !P.has(D))), Wr(b, m), t.dashboardCalculatedFields && (b.calculatedFields = t.dashboardCalculatedFields);
1946
+ }), y = p.sheets[n].frames.find((b) => b.id === i.id), g = [
1960
1947
  ...m.size ? [{ kind: "cards_removed", cardIds: [...m] }] : [],
1961
1948
  { kind: "frame_committed", sheetId: t.sheetId, before: a, after: y }
1962
- ], g = ((v = i.cards) == null ? void 0 : v.find((b) => b.id === i.activeCardId)) ?? ((I = i.cards) == null ? void 0 : I[0]);
1963
- return { dashboard: p, runtimeEffects: h, clauses: [T.committed(g == null ? void 0 : g.title)] };
1949
+ ], h = ((v = i.cards) == null ? void 0 : v.find((b) => b.id === i.activeCardId)) ?? ((I = i.cards) == null ? void 0 : I[0]);
1950
+ return { dashboard: p, runtimeEffects: g, clauses: [T.committed(h == null ? void 0 : h.title)] };
1964
1951
  }
1965
- function ho(e, t) {
1952
+ function fo(e, t) {
1966
1953
  const n = { ...e }, r = [];
1967
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")] };
1968
1955
  }
1969
- function go(e, t, n) {
1956
+ function mo(e, t, n) {
1970
1957
  const r = e.sheets ?? [], i = r.findIndex((s) => s.id === t), o = r[i];
1971
1958
  if (!o) throw new F("sheet_not_found", `No sheet ${t} on this dashboard.`);
1972
1959
  if (xe(o))
@@ -1974,46 +1961,46 @@ function go(e, t, n) {
1974
1961
  const a = n.map((s) => {
1975
1962
  const c = (o.frames ?? []).find((l) => l.cards.some((d) => d.id === s));
1976
1963
  if (!c)
1977
- throw new F("card_not_found", `No card ${s} on ${Wr(o)}.`, "Read the outline again and use its card ids.");
1964
+ throw new F("card_not_found", `No card ${s} on ${Hr(o)}.`, "Read the outline again and use its card ids.");
1978
1965
  return c.cards.find((l) => l.id === s);
1979
1966
  });
1980
1967
  return { sheets: r, sheetIndex: i, sheet: o, cards: a };
1981
1968
  }
1982
1969
  const pe = (e, t) => (e.frames ?? []).find((n) => n.cards.some((r) => r.id === t));
1983
- function je(e) {
1970
+ function Ge(e) {
1984
1971
  const { visualId: t, ...n } = e;
1985
1972
  return n;
1986
1973
  }
1987
- const Bn = (e) => e.cards.find((t) => t.id === e.activeCardId) ?? e.cards[0], Ne = (e) => T.plain("detached", `makes ${e} local to this report; it no longer follows its library visual`);
1988
- function yo(e, t) {
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) {
1989
1976
  var p;
1990
- const { sheets: n, sheetIndex: r, sheet: i, cards: o } = go(e, t.sheetId, t.cardIds), a = pe(i, t.cardIds[0]).id;
1977
+ const { sheets: n, sheetIndex: r, sheet: i, cards: o } = mo(e, t.sheetId, t.cardIds), a = pe(i, t.cardIds[0]).id;
1991
1978
  let s = i;
1992
1979
  const c = [];
1993
1980
  for (const y of t.cardIds.slice(1)) {
1994
- const h = pe(s, y);
1995
- if (h.id === a) continue;
1996
- const g = cn(h, y);
1997
- if (!g.cards.length) {
1998
- h.visualId && c.push(Ne(w(h.cards[0].title))), s = Q(s, { kind: "frame_removed", frameId: h.id });
1981
+ const g = pe(s, y);
1982
+ if (g.id === a) continue;
1983
+ const h = cn(g, y);
1984
+ if (!h.cards.length) {
1985
+ g.visualId && c.push(Ee(w(g.cards[0].title))), s = J(s, { kind: "frame_removed", frameId: g.id });
1999
1986
  continue;
2000
1987
  }
2001
- h.visualId && c.push(Ne(`the tile of ${w((p = Bn(g)) == null ? void 0 : p.title)}`)), s = Q(s, { kind: "frame_updated", frame: h.visualId ? je(g) : g, resizeForNewKind: !0 });
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 });
2002
1989
  }
2003
1990
  const l = pe(s, t.cardIds[0]), d = new Set(t.cardIds), u = {
2004
1991
  ...l,
2005
1992
  cards: [...o, ...l.cards.filter((y) => !d.has(y.id))],
2006
1993
  activeCardId: t.cardIds[0]
2007
1994
  };
2008
- l.visualId && c.push(Ne("the tabs")), s = Q(s, { kind: "frame_updated", frame: l.visualId ? je(u) : u, resizeForNewKind: !0 });
1995
+ l.visualId && c.push(Ee("the tabs")), s = J(s, { kind: "frame_updated", frame: l.visualId ? Ge(u) : u, resizeForNewKind: !0 });
2009
1996
  const f = o.map((y) => w(y.title)), m = [...new Map(c.map((y) => [y.lead, y])).values()];
2010
1997
  return {
2011
- dashboard: { ...e, sheets: n.map((y, h) => h === r ? s : y) },
2012
- clauses: [T.plain("layout", `puts ${et(f)} in one spot as tabs, ${f[0]} first`), ...m],
1998
+ dashboard: { ...e, sheets: n.map((y, g) => g === r ? s : y) },
1999
+ clauses: [T.plain("layout", `puts ${we(f)} in one spot as tabs, ${f[0]} first`), ...m],
2013
2000
  detached: m.length > 0
2014
2001
  };
2015
2002
  }
2016
- function bo(e, t) {
2003
+ function go(e, t) {
2017
2004
  var d;
2018
2005
  const n = e.sheets ?? [], r = n.findIndex((u) => !xe(u) && (u.frames ?? []).some((f) => f.cards.some((m) => m.id === t.cardId)));
2019
2006
  if (r < 0)
@@ -2024,12 +2011,12 @@ function bo(e, t) {
2024
2011
  if (o.cards.length < 2)
2025
2012
  throw new F("frame_not_found", `${w(a.title)} already has its own spot.`);
2026
2013
  const s = cn(o, t.cardId);
2027
- let c = Q(i, {
2014
+ let c = J(i, {
2028
2015
  kind: "frame_updated",
2029
- frame: o.visualId ? je(s) : s,
2016
+ frame: o.visualId ? Ge(s) : s,
2030
2017
  resizeForNewKind: !0
2031
2018
  });
2032
- c = Q(c, {
2019
+ c = J(c, {
2033
2020
  kind: "frame_added",
2034
2021
  frame: { id: t.newFrameId, cards: [a], activeCardId: a.id },
2035
2022
  placement: { position: { beside: o.id } }
@@ -2038,13 +2025,13 @@ function bo(e, t) {
2038
2025
  return {
2039
2026
  dashboard: { ...e, sheets: n.map((u, f) => f === r ? c : u) },
2040
2027
  clauses: [
2041
- T.plain("layout", `gives ${w(a.title)} its own spot beside ${w((d = Bn(s)) == null ? void 0 : d.title)}`),
2028
+ T.plain("layout", `gives ${w(a.title)} its own spot beside ${w((d = qn(s)) == null ? void 0 : d.title)}`),
2042
2029
  ...l ? [T.plain("detached", "makes both spots local to this report; they no longer follow their library visual")] : []
2043
2030
  ],
2044
2031
  detached: l
2045
2032
  };
2046
2033
  }
2047
- function vo() {
2034
+ function ho() {
2048
2035
  return {
2049
2036
  version: 1,
2050
2037
  page: {
@@ -2059,13 +2046,13 @@ function vo() {
2059
2046
  }
2060
2047
  },
2061
2048
  runtime: {
2062
- generatedAtFormat: Hr
2049
+ generatedAtFormat: Yr
2063
2050
  },
2064
2051
  inputs: [],
2065
2052
  sections: []
2066
2053
  };
2067
2054
  }
2068
- function Io() {
2055
+ function yo() {
2069
2056
  return {
2070
2057
  region: "header",
2071
2058
  enabled: !0,
@@ -2074,7 +2061,7 @@ function Io() {
2074
2061
  blocks: []
2075
2062
  };
2076
2063
  }
2077
- function Co() {
2064
+ function bo() {
2078
2065
  return {
2079
2066
  region: "footer",
2080
2067
  enabled: !0,
@@ -2083,18 +2070,18 @@ function Co() {
2083
2070
  blocks: []
2084
2071
  };
2085
2072
  }
2086
- function qn(e) {
2073
+ function Bn(e) {
2087
2074
  return [{ type: "text", value: e }];
2088
2075
  }
2089
- function Ec(e, t = []) {
2090
- return Yr(e, { by: "then" }).flatMap((n) => n.type === "link" ? n.children ?? [] : [n]).map((n) => n.type === "text" ? n.value : `{{${Xr(n.ref, Jr({ kind: "document", inputs: t }))}}}`).join("") || "";
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("") || "";
2091
2078
  }
2092
- function Fo(e, t) {
2079
+ function vo(e, t) {
2093
2080
  return e.find(
2094
2081
  (n) => n.type === "text" && n.role === t
2095
2082
  );
2096
2083
  }
2097
- function Rc(e, t) {
2084
+ function Ac(e, t) {
2098
2085
  return e.find(
2099
2086
  (n) => n.type === "image" && n.role === t
2100
2087
  );
@@ -2103,11 +2090,11 @@ function Gt(e, t) {
2103
2090
  const n = {
2104
2091
  ...t,
2105
2092
  type: "text",
2106
- content: typeof t.content == "string" ? qn(t.content) : t.content
2093
+ content: typeof t.content == "string" ? Bn(t.content) : t.content
2107
2094
  };
2108
2095
  return Un(e, n);
2109
2096
  }
2110
- function $c(e, t) {
2097
+ function Nc(e, t) {
2111
2098
  return Un(e, t);
2112
2099
  }
2113
2100
  function Un(e, t) {
@@ -2116,18 +2103,18 @@ function Un(e, t) {
2116
2103
  (r, i) => i === n ? t : r
2117
2104
  );
2118
2105
  }
2119
- function So(e, t) {
2106
+ function Io(e, t) {
2120
2107
  const n = e.sheets ?? [], { id: r, title: i, kind: o } = t.sheet;
2121
2108
  if (n.some((s) => s.id === r))
2122
2109
  throw new F("sheet_id_taken", `A sheet with id ${r} is already on this dashboard.`);
2123
- const a = o === "document" ? { id: r, title: i, kind: o, document: vo() } : { id: r, title: i };
2110
+ const a = o === "document" ? { id: r, title: i, kind: o, document: ho() } : { id: r, title: i };
2124
2111
  return {
2125
2112
  dashboard: { ...e, sheets: [...n, a] },
2126
2113
  created: [{ kind: "sheet", id: r, title: i, ...t.changeIndex !== void 0 ? { changeIndex: t.changeIndex } : {} }],
2127
2114
  clauses: [T.plain("sheet", `adds the sheet ${w(i)}`)]
2128
2115
  };
2129
2116
  }
2130
- function xo(e, t) {
2117
+ function Co(e, t) {
2131
2118
  const n = e.sheets ?? [], r = n.findIndex((o) => o.id === t.sheetId);
2132
2119
  if (r < 0)
2133
2120
  throw new F("sheet_not_found", `No sheet ${t.sheetId} on this dashboard.`);
@@ -2137,21 +2124,21 @@ function xo(e, t) {
2137
2124
  clauses: [T.plain("sheet", `renames the sheet ${w(i.title)} to ${w(t.title)}`)]
2138
2125
  };
2139
2126
  }
2140
- function wo(e, t, n) {
2127
+ function Fo(e, t, n) {
2141
2128
  var o;
2142
2129
  if (!e || !t || t.customFilterPreferences) return;
2143
2130
  const r = t.defaultDateFilter;
2144
- return (t.dateSelectionMode === "day" ? Qr(r) : t.dateSelectionMode === "months" && (Zr(r) || ei(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" ? 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;
2145
2132
  }
2146
- function Kc(e) {
2147
- const t = e.createId ?? Ie, n = t(), r = ni({
2133
+ function Ec(e) {
2134
+ const t = e.createId ?? Ie, n = t(), r = ri({
2148
2135
  field: e.field,
2149
2136
  dataSource: e.dataSource,
2150
2137
  connectionId: e.connectionId,
2151
2138
  connectionType: e.connectionType,
2152
2139
  filterId: t()
2153
2140
  });
2154
- return To({
2141
+ return So({
2155
2142
  filter: e.label ? { ...r, title: e.label } : r,
2156
2143
  label: e.label || e.field.label || e.field.name,
2157
2144
  scope: e.scope,
@@ -2159,7 +2146,7 @@ function Kc(e) {
2159
2146
  createId: () => n
2160
2147
  });
2161
2148
  }
2162
- function To(e) {
2149
+ function So(e) {
2163
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 = {
2164
2151
  ...dn(e.filter),
2165
2152
  variableName: r
@@ -2177,8 +2164,8 @@ function To(e) {
2177
2164
  exports: un(i)
2178
2165
  };
2179
2166
  }
2180
- function Do(e, t, n, r = { calendar: null }) {
2181
- var gt, yt, bt, vt, It, Ct, Ft, St;
2167
+ function xo(e, t, n, r = { calendar: null }) {
2168
+ var ht, yt, bt, vt, It, Ct, Ft, St;
2182
2169
  const o = Y(e).findFilterInput(t), a = (O, x) => ({
2183
2170
  ok: !1,
2184
2171
  issues: [
@@ -2205,16 +2192,16 @@ function Do(e, t, n, r = { calendar: null }) {
2205
2192
  if (o.origin !== "embeddedInput")
2206
2193
  return a("This filter can not be edited here.");
2207
2194
  const s = o.input, c = s.filter;
2208
- if (((gt = n.mapping) == null ? void 0 : gt.kind) === "save") {
2195
+ if (((ht = n.mapping) == null ? void 0 : ht.kind) === "save") {
2209
2196
  if (!n.mapping.draft.acceptance.ok)
2210
2197
  return { ok: !1, issues: n.mapping.draft.acceptance.issues };
2211
2198
  if (n.mapping.draft.inputId !== s.id)
2212
2199
  return a("The card mapping was prepared for another filter.");
2213
2200
  }
2214
2201
  const l = n.definition ? dn(n.definition) : c;
2215
- if (l.kind === "global-date" && n.scope && !ko(n.scope))
2202
+ if (l.kind === "global-date" && n.scope && !wo(n.scope))
2216
2203
  return a("The Global Date filter applies to regular tabs only.");
2217
- const d = (yt = r.calendar) == null ? void 0 : yt.tz, u = n.definition !== void 0, f = n.forceSelection !== void 0 || u ? wo(
2204
+ const d = (yt = r.calendar) == null ? void 0 : yt.tz, u = n.definition !== void 0, f = n.forceSelection !== void 0 || u ? Fo(
2218
2205
  n.forceSelection ?? s.forceSelection,
2219
2206
  l,
2220
2207
  d
@@ -2222,14 +2209,14 @@ function Do(e, t, n, r = { calendar: null }) {
2222
2209
  e,
2223
2210
  { name: n.variableName },
2224
2211
  { exclude: { source: "input", inputId: s.id } }
2225
- ) : s.variableName, p = u && (c.title || c.column) !== (l.title || l.column), y = n.label ?? (p ? l.title || l.column || l.id : void 0), h = u && c.hide !== l.hide, g = u && c.toolbarWidth !== l.toolbarWidth, C = (O) => {
2212
+ ) : s.variableName, p = u && (c.title || c.column) !== (l.title || l.column), y = n.label ?? (p ? l.title || l.column || l.id : void 0), g = u && c.hide !== l.hide, h = u && c.toolbarWidth !== l.toolbarWidth, C = (O) => {
2226
2213
  var xt, wt;
2227
2214
  const x = { ...O };
2228
- if (y !== void 0 && (x.label = y), n.variableName !== void 0 && (x.variableName = m), n.scope && (x.scope = n.scope), h || g) {
2229
- const Me = fn(l);
2230
- x.presentation = { ...O.presentation }, h && (x.presentation.placement = Me.placement), g && (Me.widthPx === void 0 ? delete x.presentation.widthPx : x.presentation.widthPx = Me.widthPx);
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);
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);
2231
2218
  }
2232
- return (n.forceSelection !== void 0 || u) && (f ? x.forceSelection = f : delete x.forceSelection), n.requiredAtExecution !== void 0 && (n.requiredAtExecution ? x.requiredAtExecution = !0 : delete x.requiredAtExecution), Ee(x, "optionSource", n.optionSource), Ee(x, "optionDependencies", n.optionDependencies), Ee(x, "optionPopulation", n.optionPopulation), ((xt = n.mapping) == null ? void 0 : xt.kind) === "save" && n.mapping.draft.acceptance.ok ? x.application = n.mapping.draft.acceptance.application : ((wt = n.mapping) == null ? void 0 : wt.kind) === "remove" && delete x.application, x;
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;
2233
2220
  }, v = n.label !== void 0 && n.label !== s.label && n.label !== l.title ? n.label : void 0, I = u || n.variableName !== void 0 || v !== void 0, b = (O) => ({
2234
2221
  ...O,
2235
2222
  ...n.variableName !== void 0 ? { variableName: m } : {},
@@ -2259,20 +2246,20 @@ function Do(e, t, n, r = { calendar: null }) {
2259
2246
  return a(
2260
2247
  ((vt = ee.issues[0]) == null ? void 0 : vt.message) ?? "These settings could not be saved."
2261
2248
  );
2262
- const B = n.variableName !== void 0 || n.scope !== void 0 ? Mo(E, k.input) : void 0;
2263
- if (B)
2249
+ const q = n.variableName !== void 0 || n.scope !== void 0 ? To(E, k.input) : void 0;
2250
+ if (q)
2264
2251
  return a(
2265
- `Another filter on the same cards is already named "${B}". Choose another name.`
2252
+ `Another filter on the same cards is already named "${q}". Choose another name.`
2266
2253
  );
2267
- const q = [], G = {
2254
+ const B = [], G = {
2268
2255
  id: k.input.id,
2269
2256
  runtimeScope: k.input.runtimeScope
2270
2257
  };
2271
- let R = {
2258
+ let $ = {
2272
2259
  defaultInputValues: E.defaultInputValues,
2273
2260
  dashboardInputValues: {}
2274
2261
  };
2275
- const ue = ((It = n.values) == null ? void 0 : It.target) ?? {}, A = Po(
2262
+ const ue = ((It = n.values) == null ? void 0 : It.target) ?? {}, A = Mo(
2276
2263
  c,
2277
2264
  l,
2278
2265
  {
@@ -2288,36 +2275,36 @@ function Do(e, t, n, r = { calendar: null }) {
2288
2275
  );
2289
2276
  if (A.defaultValueChanged || A.selectionIdentityChanged || A.defaultComparisonChanged) {
2290
2277
  const O = zn({
2291
- state: { ...R, dashboardInputValues: {} },
2278
+ state: { ...$, dashboardInputValues: {} },
2292
2279
  input: G,
2293
2280
  settings: A
2294
2281
  });
2295
- R = { ...R, defaultInputValues: O.defaultInputValues }, A.selectionIdentityChanged && q.push({
2282
+ $ = { ...$, defaultInputValues: O.defaultInputValues }, A.selectionIdentityChanged && B.push({
2296
2283
  kind: "clear",
2297
2284
  inputId: G.id,
2298
2285
  target: A.target
2299
- }), A.defaultValueChanged && q.push({
2286
+ }), A.defaultValueChanged && B.push({
2300
2287
  kind: "resetToDefault",
2301
2288
  inputId: G.id,
2302
2289
  target: A.target,
2303
2290
  ...A.defaultFilterValue ? { filterValue: A.defaultFilterValue } : {}
2304
- }), A.defaultComparisonChanged && q.push({
2291
+ }), A.defaultComparisonChanged && B.push({
2305
2292
  kind: "setDefaultComparison",
2306
2293
  inputId: G.id,
2307
2294
  target: A.target
2308
2295
  });
2309
2296
  }
2310
2297
  if (n.scope && k.input.runtimeScope !== "shared") {
2311
- const O = Oo(
2298
+ const O = Do(
2312
2299
  E,
2313
2300
  s,
2314
2301
  k.input,
2315
- R.defaultInputValues
2302
+ $.defaultInputValues
2316
2303
  );
2317
- R = {
2318
- ...R,
2304
+ $ = {
2305
+ ...$,
2319
2306
  defaultInputValues: O.defaultInputValues
2320
- }, q.push(
2307
+ }, B.push(
2321
2308
  ...O.dropped.map((x) => ({
2322
2309
  kind: "dropTargetSlot",
2323
2310
  inputId: G.id,
@@ -2325,14 +2312,14 @@ function Do(e, t, n, r = { calendar: null }) {
2325
2312
  }))
2326
2313
  );
2327
2314
  }
2328
- return E = _o(E, R), {
2315
+ return E = ko(E, $), {
2329
2316
  ok: !0,
2330
2317
  dashboard: E,
2331
2318
  inputId: k.input.id,
2332
- valueEffects: q
2319
+ valueEffects: B
2333
2320
  };
2334
2321
  }
2335
- function Vc(e) {
2322
+ function $c(e) {
2336
2323
  let t = kt({
2337
2324
  dashboard: e.before,
2338
2325
  runtimeValues: e.dashboardInputValues,
@@ -2379,14 +2366,14 @@ function Vc(e) {
2379
2366
  calendar: e.calendar
2380
2367
  });
2381
2368
  }
2382
- function ko(e) {
2369
+ function wo(e) {
2383
2370
  var t;
2384
2371
  return e.kind !== "documentSections" && (e.kind !== "allSheets" || ((t = e.sheetKinds) == null ? void 0 : t.length) === 1 && e.sheetKinds[0] === "dashboard");
2385
2372
  }
2386
- function Ee(e, t, n) {
2373
+ function $e(e, t, n) {
2387
2374
  n !== void 0 && (n === null ? delete e[t] : e[t] = n);
2388
2375
  }
2389
- function Mo(e, t) {
2376
+ function To(e, t) {
2390
2377
  const n = [
2391
2378
  ...Y(e).inputs.map((i) => i.input),
2392
2379
  ...(Array.isArray(e.inputs) ? e.inputs : []).filter(
@@ -2396,14 +2383,14 @@ function Mo(e, t) {
2396
2383
  (i) => i.id !== t.id && i.variableName === t.variableName
2397
2384
  );
2398
2385
  if (!n.length) return;
2399
- const r = $t(e, t);
2386
+ const r = Rt(e, t);
2400
2387
  return n.some(
2401
- (i) => [...$t(e, i)].some(
2388
+ (i) => [...Rt(e, i)].some(
2402
2389
  (o) => r.has(o)
2403
2390
  )
2404
2391
  ) ? t.variableName : void 0;
2405
2392
  }
2406
- function Oo(e, t, n, r) {
2393
+ function Do(e, t, n, r) {
2407
2394
  var d, u;
2408
2395
  const i = [], o = bn(e), a = (f) => Wt(t, f, o), s = (f) => Wt(n, f, o), c = [];
2409
2396
  if (n.runtimeScope === "perSheet")
@@ -2417,7 +2404,7 @@ function Oo(e, t, n, r) {
2417
2404
  sheetKind: (d = o.get(f.sheetId)) == null ? void 0 : d.sheetKind
2418
2405
  });
2419
2406
  for (const f of e.variables ?? [])
2420
- c.push(...ea(e, f.id));
2407
+ c.push(...ta(e, f.id));
2421
2408
  } else if (n.runtimeScope === "perDocumentSection")
2422
2409
  for (const f of e.sheets ?? [])
2423
2410
  for (const m of ((u = f.document) == null ? void 0 : u.sections) ?? [])
@@ -2442,14 +2429,14 @@ function Wt(e, t, n) {
2442
2429
  const r = n.get(t.sheetId);
2443
2430
  return r ? In(e, r) : !1;
2444
2431
  }
2445
- return ta(e, t);
2432
+ return na(e, t);
2446
2433
  }
2447
- function _o(e, t) {
2434
+ function ko(e, t) {
2448
2435
  const n = { ...e };
2449
2436
  return t.defaultInputValues && Object.keys(t.defaultInputValues).length ? n.defaultInputValues = t.defaultInputValues : e.defaultInputValues !== void 0 && delete n.defaultInputValues, n;
2450
2437
  }
2451
- function Po(e, t, n, r, i) {
2452
- const o = !!(n != null && n.defaultValueChanged || n != null && n.selectionIdentityChanged) || ti(e, t);
2438
+ function Mo(e, t, n, r, i) {
2439
+ const o = !!(n != null && n.defaultValueChanged || n != null && n.selectionIdentityChanged) || ni(e, t);
2453
2440
  return {
2454
2441
  ...n,
2455
2442
  target: (n == null ? void 0 : n.target) ?? r,
@@ -2525,7 +2512,7 @@ function zn(e) {
2525
2512
  };
2526
2513
  }
2527
2514
  const Z = (e) => Array.isArray(e.inputs) ? e.inputs : [];
2528
- function ke(e, t) {
2515
+ function Me(e, t) {
2529
2516
  const n = Z(e).find((r) => r.id === t);
2530
2517
  if (!n || n.kind !== "filter")
2531
2518
  throw new F("filter_not_found", `No filter ${t} on this dashboard.`, "Read the outline again and use its filter ids.");
@@ -2539,32 +2526,38 @@ function Gn(e, t) {
2539
2526
  if (!Cn(e, t))
2540
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.");
2541
2528
  }
2542
- function Ao(e, t, n) {
2529
+ function Oo(e, t, n) {
2543
2530
  const r = Y(e), i = r.findFilterInput({ inputId: t });
2544
2531
  return i ? r.reachedCards({ inputId: t }).filter(
2545
2532
  (o) => ["bound", "automatic", "sql", "relationshipApplied"].includes(
2546
- ii(i.input, o.card, n).reach
2533
+ ai(i.input, o.card, n).reach
2547
2534
  )
2548
2535
  ).length : 0;
2549
2536
  }
2550
- function No(e, t) {
2551
- const n = Y(e), r = n.findFilterInput({ inputId: t });
2552
- return r ? n.reachedCards({ inputId: t }).filter((i) => ai(r.input, i.card) === "relationship").length : 0;
2537
+ function _o(e, t) {
2538
+ return Wn(e, t, "relationship");
2539
+ }
2540
+ function Po(e, t) {
2541
+ return Wn(e, t, "sqlTemplate");
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;
2553
2546
  }
2554
- function Wn(e, t) {
2547
+ function Hn(e, t) {
2555
2548
  if (t.scope.kind === "allSheets") return "every sheet";
2556
2549
  if (t.scope.kind !== "sheets") return "its cards";
2557
2550
  const n = [...bn(e).values()].filter((r) => In(t, r));
2558
- return et(n.map((r) => {
2551
+ return we(n.map((r) => {
2559
2552
  var i, o;
2560
2553
  return ((o = (i = e.sheets) == null ? void 0 : i.find((a) => a.id === r.sheetId)) == null ? void 0 : o.title) ?? r.sheetId;
2561
2554
  }));
2562
2555
  }
2563
- const Hn = (e) => {
2556
+ const Yn = (e) => {
2564
2557
  var t;
2565
2558
  return ((t = e.filter) == null ? void 0 : t.type) === "single" ? "single select" : "multi select";
2566
2559
  };
2567
- function Yn(e) {
2560
+ function Xn(e) {
2568
2561
  var t, n, r;
2569
2562
  if ((n = (t = e.filter) == null ? void 0 : t.defaultValues) != null && n.length) return `default ${e.filter.defaultValues.join(", ")}`;
2570
2563
  if ((r = e.filter) != null && r.defaultDateFilter) return "a default period";
@@ -2572,13 +2565,16 @@ function Yn(e) {
2572
2565
  function de(e) {
2573
2566
  return T.plain("filter", e);
2574
2567
  }
2575
- function Eo(e, t) {
2568
+ function Ao(e, t) {
2576
2569
  const { input: n } = t, r = Z(e);
2577
- if (r.some((c) => c.id === n.id))
2570
+ if (r.some((d) => d.id === n.id))
2578
2571
  throw new F("filter_id_taken", `A filter with id ${n.id} is already on this dashboard.`);
2579
2572
  if (Y(e).findFilterInput({ filterId: n.filter.id }))
2580
2573
  throw new F("filter_id_taken", `A filter definition with id ${n.filter.id} is already on this dashboard.`);
2581
- const i = { ...e, inputs: [...r, n] }, o = Ao(i, n.id), a = No(i, n.id), s = [Hn(n), Yn(n)].filter(Boolean).join(", ");
2574
+ const i = { ...e, inputs: [...r, n] }, o = Oo(i, n.id), a = _o(i, n.id), s = Po(i, n.id), c = we([
2575
+ ...a ? [`may filter ${a} more through the domain's relationships`] : [],
2576
+ ...s ? [`may filter ${s} more through ${s === 1 ? "its" : "their"} SQL`] : []
2577
+ ]), l = [Yn(n), Xn(n)].filter(Boolean).join(", ");
2582
2578
  return {
2583
2579
  dashboard: i,
2584
2580
  created: [
@@ -2591,13 +2587,13 @@ function Eo(e, t) {
2591
2587
  ],
2592
2588
  clauses: [
2593
2589
  de(
2594
- `adds the filter ${w(n.label)} (${s}) to ${Wn(i, n)}; it filters ${o} card${o === 1 ? "" : "s"}${a ? ` and may filter ${a} more through the domain's relationships` : ""}`
2590
+ `adds the filter ${w(n.label)} (${l}) to ${Hn(i, n)}; it filters ${o} card${o === 1 ? "" : "s"}${c ? ` and ${c}` : ""}`
2595
2591
  )
2596
2592
  ]
2597
2593
  };
2598
2594
  }
2599
- function Ro(e, t, n) {
2600
- const r = Do(e, { inputId: t.filterId }, t.settings, {
2595
+ function No(e, t, n) {
2596
+ const r = xo(e, { inputId: t.filterId }, t.settings, {
2601
2597
  calendar: n.calendar
2602
2598
  });
2603
2599
  if (!r.ok) {
@@ -2613,37 +2609,37 @@ function Ro(e, t, n) {
2613
2609
  return {
2614
2610
  dashboard: r.dashboard,
2615
2611
  runtimeEffects: [{ kind: "filter_value", effects: r.valueEffects }],
2616
- clauses: [de(`changes the filter ${w((i == null ? void 0 : i.label) ?? o.label)}: ${$o(r.dashboard, i, o)}`)]
2612
+ clauses: [de(`changes the filter ${w((i == null ? void 0 : i.label) ?? o.label)}: ${Eo(r.dashboard, i, o)}`)]
2617
2613
  };
2618
2614
  }
2619
- function $o(e, t, n) {
2615
+ function Eo(e, t, n) {
2620
2616
  var a, s, c, l, d, u;
2621
2617
  if (!t) return "updates its settings";
2622
2618
  const r = [];
2623
- 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 ${Hn(n)}`);
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)}`);
2624
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]);
2625
2621
  if (i !== o) {
2626
- const f = Yn(n);
2622
+ const f = Xn(n);
2627
2623
  r.push(f ? `sets its ${f.replace(/^default /, "default to ").replace(/^a default period$/, "default period")}` : "removes its default");
2628
2624
  }
2629
- return JSON.stringify(t.scope) !== JSON.stringify(n.scope) && r.push(`applies it to ${Wn(e, n)}`), r.length ? et(r) : "keeps its settings";
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";
2630
2626
  }
2631
- function Ko(e, t) {
2632
- const n = ke(e, t);
2627
+ function $o(e, t) {
2628
+ const n = Me(e, t);
2633
2629
  return {
2634
2630
  dashboard: {
2635
2631
  ...e,
2636
2632
  inputs: Z(e).filter((i) => i.id !== t),
2637
- defaultInputValues: ri(e.defaultInputValues, t)
2633
+ defaultInputValues: ii(e.defaultInputValues, t)
2638
2634
  },
2639
2635
  runtimeEffects: [{ kind: "input_removed", inputId: t }],
2640
2636
  clauses: [de(`removes the filter ${w(n.label)}`)]
2641
2637
  };
2642
2638
  }
2643
- function Vo(e, t, n) {
2639
+ function Ro(e, t, n) {
2644
2640
  var a;
2645
2641
  Gn(e, n);
2646
- const r = ra(t.scope, n);
2642
+ const r = ia(t.scope, n);
2647
2643
  if (!r)
2648
2644
  throw new F(
2649
2645
  "filter_invalid",
@@ -2658,9 +2654,9 @@ function Vo(e, t, n) {
2658
2654
  inputs: Z(e).map((s) => s.id === t.id ? i : s)
2659
2655
  };
2660
2656
  }
2661
- function Xn(e, t, n, r, i) {
2657
+ function Qn(e, t, n, r, i) {
2662
2658
  var d, u;
2663
- const o = ke(e, t);
2659
+ const o = Me(e, t);
2664
2660
  Gn(e, n);
2665
2661
  const a = [...((d = o.application) == null ? void 0 : d.cards) ?? []], s = a.findIndex((f) => f.cardId === n);
2666
2662
  s >= 0 ? a[s] = r : a.push(r);
@@ -2680,7 +2676,7 @@ function Xn(e, t, n, r, i) {
2680
2676
  inputs: Z(e).map((f) => f.id === t ? c : f)
2681
2677
  };
2682
2678
  }
2683
- function Lo(e) {
2679
+ function Ko(e) {
2684
2680
  switch (e.kind) {
2685
2681
  case "field":
2686
2682
  return `by ${e.field.name}`;
@@ -2690,22 +2686,22 @@ function Lo(e) {
2690
2686
  return String(e.kind);
2691
2687
  }
2692
2688
  }
2693
- function Bo(e, t) {
2694
- const n = ke(e, t.filterId), r = { ...t.binding, kind: "bound", cardId: t.cardId }, i = na(n.scope, t.cardId), o = i !== n.scope;
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;
2695
2691
  return {
2696
- dashboard: Xn(e, t.filterId, t.cardId, r, o ? i : void 0),
2692
+ dashboard: Qn(e, t.filterId, t.cardId, r, o ? i : void 0),
2697
2693
  clauses: [
2698
2694
  de(
2699
- `makes ${w(n.label)} filter ${jn(e, t.cardId)} ${Lo(r.target)}${o ? ", which it used to leave out" : ""}`
2695
+ `makes ${w(n.label)} filter ${jn(e, t.cardId)} ${Ko(r.target)}${o ? ", which it used to leave out" : ""}`
2700
2696
  )
2701
2697
  ]
2702
2698
  };
2703
2699
  }
2704
- function qo(e, t) {
2700
+ function Lo(e, t) {
2705
2701
  var i;
2706
- const n = ke(e, t.filterId);
2702
+ const n = Me(e, t.filterId);
2707
2703
  return {
2708
- dashboard: ((i = n.filter) == null ? void 0 : i.kind) === "global-date" ? Vo(e, n, t.cardId) : Xn(e, t.filterId, t.cardId, { kind: "excluded", cardId: t.cardId }),
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 }),
2709
2705
  clauses: [de(`stops ${w(n.label)} from filtering ${jn(e, t.cardId)}`)]
2710
2706
  };
2711
2707
  }
@@ -2718,7 +2714,7 @@ function mt(e, t) {
2718
2714
  { issues: e }
2719
2715
  );
2720
2716
  }
2721
- function Ge(e, t) {
2717
+ function We(e, t) {
2722
2718
  const n = (e.variables ?? []).find((r) => r.id === t);
2723
2719
  if (!n)
2724
2720
  throw new F("variable_not_found", `No variable ${t} on this dashboard.`, "Read the outline again and use its variable names.");
@@ -2726,10 +2722,10 @@ function Ge(e, t) {
2726
2722
  }
2727
2723
  function Jn(e) {
2728
2724
  var r;
2729
- const t = ao(e), n = t.charAt(0).toLowerCase() + t.slice(1);
2725
+ const t = no(e), n = t.charAt(0).toLowerCase() + t.slice(1);
2730
2726
  return e.get.kind === "only" && !((r = e.query.sql) != null && r.trim()) ? `${n}. When more than one matches it shows nothing` : n;
2731
2727
  }
2732
- function Uo(e, t) {
2728
+ function qo(e, t) {
2733
2729
  const n = it(e, { kind: "add", variable: t.variable });
2734
2730
  n.ok || mt(n.issues, "This variable could not be added.");
2735
2731
  const { variable: r } = t;
@@ -2740,10 +2736,10 @@ function Uo(e, t) {
2740
2736
  clauses: [T.plain("variable", `adds the variable ${r.name}: ${Jn(r)}`)]
2741
2737
  };
2742
2738
  }
2743
- function zo(e, t) {
2744
- const n = Ge(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 });
2739
+ function Bo(e, t) {
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 });
2745
2741
  i.ok || mt(i.issues, "This variable could not be changed.");
2746
- const o = Ge(i.dashboard, t.variableId), a = [];
2742
+ const o = We(i.dashboard, t.variableId), a = [];
2747
2743
  t.patch.name !== void 0 && t.patch.name !== n.name && a.push(T.plain("variable", `renames the variable ${n.name} to ${o.name}`));
2748
2744
  const { name: s, label: c, ...l } = n, { name: d, label: u, ...f } = o;
2749
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)}`)), {
@@ -2752,8 +2748,8 @@ function zo(e, t) {
2752
2748
  clauses: a.length ? a : [T.plain("variable", `changes nothing on the variable ${o.name}`)]
2753
2749
  };
2754
2750
  }
2755
- function jo(e, t) {
2756
- const n = Ge(e, t.variableId), r = it(e, { kind: "remove", id: t.variableId, confirmed: !1 });
2751
+ function Uo(e, t) {
2752
+ const n = We(e, t.variableId), r = it(e, { kind: "remove", id: t.variableId, confirmed: !1 });
2757
2753
  r.ok || mt(r.issues, "This variable could not be removed.");
2758
2754
  const i = r.removedMappings ? ` and its ${r.removedMappings === 1 ? "filter mapping" : `${r.removedMappings} filter mappings`}` : "";
2759
2755
  return {
@@ -2761,32 +2757,32 @@ function jo(e, t) {
2761
2757
  clauses: [T.plain("variable", `removes the variable ${n.name}${i}`)]
2762
2758
  };
2763
2759
  }
2764
- function Qn(e) {
2765
- return e.cards.length < ia;
2760
+ function Zn(e) {
2761
+ return e.cards.length < aa;
2766
2762
  }
2767
- function Go(e) {
2763
+ function zo(e) {
2768
2764
  return e.kpi.layout === "tiles" && e.cards.length + 1 > Fn;
2769
2765
  }
2770
- function Wo(e, t) {
2771
- return !Qn(e) || t.type !== "kpi" || e.cards.some(({ id: n }) => n === t.id) ? e : {
2766
+ function jo(e, t) {
2767
+ return !Zn(e) || t.type !== "kpi" || e.cards.some(({ id: n }) => n === t.id) ? e : {
2772
2768
  ...e,
2773
2769
  cards: [...e.cards, t],
2774
- kpi: Go(e) ? { ...e.kpi, layout: "lines" } : e.kpi
2770
+ kpi: zo(e) ? { ...e.kpi, layout: "lines" } : e.kpi
2775
2771
  };
2776
2772
  }
2777
- function Ho(e, t) {
2773
+ function Go(e, t) {
2778
2774
  if (e.cards.length <= 1) return e;
2779
2775
  const n = e.cards.filter(({ id: r }) => r !== t);
2780
2776
  return n.length === e.cards.length ? e : { ...e, cards: n };
2781
2777
  }
2782
- function Zn(e) {
2778
+ function er(e) {
2783
2779
  return e.cards.length <= Fn;
2784
2780
  }
2785
- function Yo(e, t) {
2781
+ function Wo(e, t) {
2786
2782
  const n = { ...e.kpi, ...t };
2787
- return n.layout === "tiles" && !Zn(e) ? e : { ...e, kpi: n };
2783
+ return n.layout === "tiles" && !er(e) ? e : { ...e, kpi: n };
2788
2784
  }
2789
- const Xo = ["table"], Jo = ["matrixTable"];
2785
+ const Ho = ["table"], Yo = ["matrixTable"];
2790
2786
  function Ht(e, t, n) {
2791
2787
  return {
2792
2788
  id: e.section(),
@@ -2818,7 +2814,7 @@ function Ht(e, t, n) {
2818
2814
  }
2819
2815
  };
2820
2816
  }
2821
- function er(e) {
2817
+ function tr(e) {
2822
2818
  return { id: e, title: "KPI", type: "kpi" };
2823
2819
  }
2824
2820
  const V = {
@@ -2832,7 +2828,7 @@ const V = {
2832
2828
  create: (e) => ({
2833
2829
  id: e.section(),
2834
2830
  type: "text",
2835
- content: qn("New text section")
2831
+ content: Bn("New text section")
2836
2832
  })
2837
2833
  },
2838
2834
  table: {
@@ -2841,7 +2837,7 @@ const V = {
2841
2837
  description: "Rows and columns from one dataset.",
2842
2838
  group: "data",
2843
2839
  addable: !0,
2844
- cardTypes: Xo,
2840
+ cardTypes: Ho,
2845
2841
  create: (e) => Ht(e, "table", "Table")
2846
2842
  },
2847
2843
  matrix: {
@@ -2850,7 +2846,7 @@ const V = {
2850
2846
  description: "Grouped rows with subtotals, and optional column levels.",
2851
2847
  group: "data",
2852
2848
  addable: !0,
2853
- cardTypes: Jo,
2849
+ cardTypes: Yo,
2854
2850
  create: (e) => Ht(e, "matrixTable", "Matrix")
2855
2851
  },
2856
2852
  kpi: {
@@ -2863,7 +2859,7 @@ const V = {
2863
2859
  create: (e) => ({
2864
2860
  id: e.section(),
2865
2861
  type: "kpi",
2866
- cards: [er(e.card())],
2862
+ cards: [tr(e.card())],
2867
2863
  kpi: { layout: "tiles" }
2868
2864
  })
2869
2865
  },
@@ -2900,7 +2896,7 @@ const V = {
2900
2896
  create: (e) => ({ id: e.section(), type: "page_break" })
2901
2897
  }
2902
2898
  };
2903
- function tr(e) {
2899
+ function nr(e) {
2904
2900
  var t;
2905
2901
  switch (e.type) {
2906
2902
  case "table":
@@ -2917,20 +2913,20 @@ function tr(e) {
2917
2913
  return V.page_break;
2918
2914
  }
2919
2915
  }
2920
- function Qo(e, t) {
2921
- return tr(e).cardTypes.includes(t);
2916
+ function Xo(e, t) {
2917
+ return nr(e).cardTypes.includes(t);
2922
2918
  }
2923
- function nr(e, t) {
2924
- if (Qo(e, t)) return null;
2925
- const n = tr(e);
2919
+ function rr(e, t) {
2920
+ if (Xo(e, t)) return null;
2921
+ const n = nr(e);
2926
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`;
2927
2923
  }
2928
- function Zo(e, t, n) {
2924
+ function Qo(e, t, n) {
2929
2925
  if (!at(e).some(({ id: i }) => i === t))
2930
2926
  throw new Error(
2931
2927
  `Document section '${e.id}' has no card '${t}'.`
2932
2928
  );
2933
- const r = nr(e, n.type);
2929
+ const r = rr(e, n.type);
2934
2930
  if (r)
2935
2931
  throw new Error(r);
2936
2932
  return Sn(
@@ -2938,21 +2934,21 @@ function Zo(e, t, n) {
2938
2934
  (i) => i.id === t ? n : i
2939
2935
  );
2940
2936
  }
2941
- const es = [
2937
+ const Jo = [
2942
2938
  { id: "data", label: "Data" },
2943
2939
  { id: "content", label: "Content" },
2944
2940
  { id: "layout", label: "Layout" }
2945
2941
  ];
2946
- function Lc() {
2942
+ function Rc() {
2947
2943
  const e = Object.values(V).filter(
2948
2944
  (t) => t.addable
2949
2945
  );
2950
- return es.map((t) => ({
2946
+ return Jo.map((t) => ({
2951
2947
  ...t,
2952
2948
  kinds: e.filter((n) => n.group === t.id)
2953
2949
  })).filter((t) => t.kinds.length > 0);
2954
2950
  }
2955
- const ts = {
2951
+ const Zo = {
2956
2952
  header: ["title", "metadata"],
2957
2953
  footer: ["note", "pageInfo"]
2958
2954
  };
@@ -2961,27 +2957,27 @@ class M extends Error {
2961
2957
  super(t), this.name = "DocumentEditError";
2962
2958
  }
2963
2959
  }
2964
- const Yt = 8, ns = 240;
2965
- function Bc() {
2960
+ const Yt = 8, es = 240;
2961
+ function Kc() {
2966
2962
  return {
2967
2963
  section: () => `doc_section_${Ie()}`,
2968
2964
  card: () => `doc_card_${Ie()}`
2969
2965
  };
2970
2966
  }
2971
- function rs(e) {
2967
+ function ts(e) {
2972
2968
  return Number.isFinite(e) ? Math.min(
2973
- ns,
2969
+ es,
2974
2970
  Math.max(Yt, Math.round(e))
2975
2971
  ) : Yt;
2976
2972
  }
2977
- function qc(e, t, n, r) {
2973
+ function Vc(e, t, n, r) {
2978
2974
  const i = e.findIndex(({ id: s }) => s === t), o = e.findIndex(({ id: s }) => s === n);
2979
2975
  if (i === -1 || o === -1) return i;
2980
2976
  const a = r === "after" ? o + 1 : o;
2981
2977
  return i < a ? a - 1 : a;
2982
2978
  }
2983
- const is = /* @__PURE__ */ new Set(["table", "matrixTable", "kpi"]);
2984
- function as(e, t = {}) {
2979
+ const ns = /* @__PURE__ */ new Set(["table", "matrixTable", "kpi"]);
2980
+ function rs(e, t = {}) {
2985
2981
  const n = new Set(
2986
2982
  (e.sheets || []).flatMap(
2987
2983
  (r) => (r.frames || []).flatMap(
@@ -2990,13 +2986,13 @@ function as(e, t = {}) {
2990
2986
  )
2991
2987
  );
2992
2988
  return vn(e).filter(
2993
- (r) => is.has(r.card.type) && !r.card.linkedSourceCardId && !(r.kind === "frameCard" && n.has(r.frameId)) && !(r.kind === "documentSectionCard" && r.sectionId === t.excludeSectionId) && !oi(r.card)
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)
2994
2990
  );
2995
2991
  }
2996
- function os(e) {
2992
+ function is(e) {
2997
2993
  return e.type === "kpi" ? "kpi" : e.type === "matrixTable" ? "matrix" : "table";
2998
2994
  }
2999
- function ss(e, t, n) {
2995
+ function as(e, t, n) {
3000
2996
  const r = e.sections, i = (a) => ({
3001
2997
  ...e,
3002
2998
  sections: a
@@ -3008,17 +3004,17 @@ function ss(e, t, n) {
3008
3004
  throw new M(`${a.label} sections cannot be added.`);
3009
3005
  const s = a.create(n.ids);
3010
3006
  return {
3011
- document: i($e(r, s, t.index)),
3007
+ document: i(Ke(r, s, t.index)),
3012
3008
  target: o(s.id)
3013
3009
  };
3014
3010
  }
3015
3011
  case "copyCard": {
3016
- const a = Re(t.source, n), c = V[os(a.card)].create({
3012
+ const a = Re(t.source, n), c = V[is(a.card)].create({
3017
3013
  section: n.ids.section,
3018
3014
  card: () => a.card.id
3019
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;
3020
3016
  return {
3021
- document: i($e(r, l, t.index)),
3017
+ document: i(Ke(r, l, t.index)),
3022
3018
  target: o(l.id),
3023
3019
  ...a.calculatedFields ? { calculatedFields: a.calculatedFields } : {}
3024
3020
  };
@@ -3029,7 +3025,7 @@ function ss(e, t, n) {
3029
3025
  throw new M(
3030
3026
  "Only a table section can be replaced with a copied card."
3031
3027
  );
3032
- const s = Re(t.source, n, t.sectionId), c = nr(a, s.card.type);
3028
+ const s = Re(t.source, n, t.sectionId), c = rr(a, s.card.type);
3033
3029
  if (c) throw new M(c);
3034
3030
  const l = {
3035
3031
  ...a,
@@ -3037,7 +3033,7 @@ function ss(e, t, n) {
3037
3033
  card: s.card
3038
3034
  };
3039
3035
  return {
3040
- document: i($(r, l)),
3036
+ document: i(R(r, l)),
3041
3037
  target: o(a.id),
3042
3038
  // The section keeps its identity, so references follow its new card,
3043
3039
  // as they do for `replaceCard`. `to: null` is only for removals.
@@ -3047,25 +3043,25 @@ function ss(e, t, n) {
3047
3043
  }
3048
3044
  case "move": {
3049
3045
  const a = r.findIndex(({ id: l }) => l === t.sectionId);
3050
- if (a === -1) throw he(t.sectionId);
3046
+ if (a === -1) throw ge(t.sectionId);
3051
3047
  const s = [...r], [c] = s.splice(a, 1);
3052
- return s.splice(We(t.toIndex, s.length), 0, c), {
3048
+ return s.splice(He(t.toIndex, s.length), 0, c), {
3053
3049
  document: i(s),
3054
3050
  target: o(t.sectionId)
3055
3051
  };
3056
3052
  }
3057
3053
  case "duplicate": {
3058
3054
  const a = r.findIndex(({ id: c }) => c === t.sectionId);
3059
- if (a === -1) throw he(t.sectionId);
3060
- const s = cs(r[a], n.ids);
3055
+ if (a === -1) throw ge(t.sectionId);
3056
+ const s = os(r[a], n.ids);
3061
3057
  return {
3062
- document: i($e(r, s, a + 1)),
3058
+ document: i(Ke(r, s, a + 1)),
3063
3059
  target: o(s.id)
3064
3060
  };
3065
3061
  }
3066
3062
  case "remove": {
3067
3063
  const a = r.findIndex(({ id: d }) => d === t.sectionId);
3068
- if (a === -1) throw he(t.sectionId);
3064
+ if (a === -1) throw ge(t.sectionId);
3069
3065
  const s = r[a], c = r.filter((d, u) => u !== a), l = c[a] ?? c[a - 1];
3070
3066
  return {
3071
3067
  document: i(c),
@@ -3081,7 +3077,7 @@ function ss(e, t, n) {
3081
3077
  if (a.type !== "table" && a.type !== "kpi" && a.type !== "chart")
3082
3078
  throw W("rename", a);
3083
3079
  return {
3084
- document: i($(r, { ...a, title: t.title })),
3080
+ document: i(R(r, { ...a, title: t.title })),
3085
3081
  target: o(a.id)
3086
3082
  };
3087
3083
  }
@@ -3090,7 +3086,7 @@ function ss(e, t, n) {
3090
3086
  if (a.type !== "text") throw W(t.type, a);
3091
3087
  return {
3092
3088
  document: i(
3093
- $(r, {
3089
+ R(r, {
3094
3090
  ...a,
3095
3091
  content: t.content,
3096
3092
  ...t.style !== void 0 ? { style: t.style } : {}
@@ -3100,11 +3096,11 @@ function ss(e, t, n) {
3100
3096
  };
3101
3097
  }
3102
3098
  case "updateRegionText": {
3103
- if (!ts[t.region].includes(t.role))
3099
+ if (!Zo[t.region].includes(t.role))
3104
3100
  throw new M(
3105
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.`
3106
3102
  );
3107
- const a = e[t.region], s = a ? Fo(a.blocks, t.role) : void 0, c = {
3103
+ const a = e[t.region], s = a ? vo(a.blocks, t.role) : void 0, c = {
3108
3104
  id: (s == null ? void 0 : s.id) ?? `${t.region}_${t.role}`,
3109
3105
  role: t.role,
3110
3106
  area: (s == null ? void 0 : s.area) ?? t.role,
@@ -3112,13 +3108,13 @@ function ss(e, t, n) {
3112
3108
  ...t.style !== void 0 ? { style: t.style } : s != null && s.style ? { style: s.style } : {}
3113
3109
  };
3114
3110
  if (t.region === "header") {
3115
- const d = (a == null ? void 0 : a.region) === "header" ? a : Io();
3111
+ const d = (a == null ? void 0 : a.region) === "header" ? a : yo();
3116
3112
  return {
3117
3113
  document: { ...e, header: { ...d, enabled: !0, blocks: Gt(d.blocks, c) } },
3118
3114
  target: { kind: "header" }
3119
3115
  };
3120
3116
  }
3121
- const l = (a == null ? void 0 : a.region) === "footer" ? a : Co();
3117
+ const l = (a == null ? void 0 : a.region) === "footer" ? a : bo();
3122
3118
  return {
3123
3119
  document: { ...e, footer: { ...l, enabled: !0, blocks: Gt(l.blocks, c) } },
3124
3120
  target: { kind: "footer" }
@@ -3129,7 +3125,7 @@ function ss(e, t, n) {
3129
3125
  if (a.type !== "table") throw W(t.type, a);
3130
3126
  return {
3131
3127
  document: i(
3132
- $(r, {
3128
+ R(r, {
3133
3129
  ...a,
3134
3130
  table: { ...a.table, ...t.options }
3135
3131
  })
@@ -3140,11 +3136,11 @@ function ss(e, t, n) {
3140
3136
  case "updateKpiOptions": {
3141
3137
  const a = K(r, t.sectionId);
3142
3138
  if (a.type !== "kpi") throw W(t.type, a);
3143
- if (t.options.layout === "tiles" && !Zn(a))
3139
+ if (t.options.layout === "tiles" && !er(a))
3144
3140
  throw new M("Tiles hold up to 6 KPIs.");
3145
3141
  return {
3146
3142
  document: i(
3147
- $(r, Yo(a, t.options))
3143
+ R(r, Wo(a, t.options))
3148
3144
  ),
3149
3145
  target: o(a.id)
3150
3146
  };
@@ -3154,9 +3150,9 @@ function ss(e, t, n) {
3154
3150
  if (a.type !== "spacer") throw W(t.type, a);
3155
3151
  return {
3156
3152
  document: i(
3157
- $(r, {
3153
+ R(r, {
3158
3154
  ...a,
3159
- heightPx: rs(t.heightPx)
3155
+ heightPx: ts(t.heightPx)
3160
3156
  })
3161
3157
  ),
3162
3158
  target: o(a.id)
@@ -3167,12 +3163,12 @@ function ss(e, t, n) {
3167
3163
  t.card.id !== t.oldCardId && Xt(n, t.card.id);
3168
3164
  let s;
3169
3165
  try {
3170
- s = Zo(a, t.oldCardId, t.card);
3166
+ s = Qo(a, t.oldCardId, t.card);
3171
3167
  } catch (c) {
3172
3168
  throw new M(c.message);
3173
3169
  }
3174
3170
  return (s.type === "table" || s.type === "chart") && (s = { ...s, title: t.card.title || s.title }), {
3175
- document: i($(r, s)),
3171
+ document: i(R(r, s)),
3176
3172
  target: o(a.id, a.type === "kpi" ? t.card.id : void 0),
3177
3173
  ...t.oldCardId !== t.card.id ? { retargetedCardIds: [{ from: t.oldCardId, to: t.card.id }] } : {},
3178
3174
  ...t.calculatedFields !== void 0 ? { calculatedFields: t.calculatedFields } : {}
@@ -3181,18 +3177,18 @@ function ss(e, t, n) {
3181
3177
  case "addKpi": {
3182
3178
  const a = K(r, t.sectionId);
3183
3179
  if (a.type !== "kpi") throw W(t.type, a);
3184
- if (!Qn(a))
3180
+ if (!Zn(a))
3185
3181
  throw new M("A KPI section holds up to 8 KPIs.");
3186
3182
  const s = t.source ? Re(t.source, n, a.id) : void 0;
3187
3183
  t.card && !s && Xt(n, t.card.id);
3188
- const c = (s == null ? void 0 : s.card) ?? t.card ?? er(n.ids.card());
3184
+ const c = (s == null ? void 0 : s.card) ?? t.card ?? tr(n.ids.card());
3189
3185
  if (c.type !== "kpi")
3190
3186
  throw new M("KPI sections hold KPI cards only");
3191
- const l = Wo(a, c);
3187
+ const l = jo(a, c);
3192
3188
  if (l === a)
3193
3189
  throw new M(`KPI section '${a.id}' already has card '${c.id}'.`);
3194
3190
  return {
3195
- document: i($(r, l)),
3191
+ document: i(R(r, l)),
3196
3192
  target: o(a.id, c.id),
3197
3193
  ...s != null && s.calculatedFields ? { calculatedFields: s.calculatedFields } : {}
3198
3194
  };
@@ -3202,11 +3198,11 @@ function ss(e, t, n) {
3202
3198
  if (a.type !== "kpi") throw W(t.type, a);
3203
3199
  if (!a.cards.some(({ id: c }) => c === t.cardId))
3204
3200
  throw new M(`KPI section '${a.id}' has no card '${t.cardId}'.`);
3205
- const s = Ho(a, t.cardId);
3201
+ const s = Go(a, t.cardId);
3206
3202
  if (s === a)
3207
3203
  throw new M("A KPI section keeps at least one KPI.");
3208
3204
  return {
3209
- document: i($(r, s)),
3205
+ document: i(R(r, s)),
3210
3206
  target: o(a.id),
3211
3207
  retargetedCardIds: [{ from: t.cardId, to: null }]
3212
3208
  };
@@ -3218,19 +3214,19 @@ function ss(e, t, n) {
3218
3214
  if (s === -1)
3219
3215
  throw new M(`KPI section '${a.id}' has no card '${t.cardId}'.`);
3220
3216
  const c = [...a.cards], [l] = c.splice(s, 1);
3221
- return c.splice(We(t.toIndex, c.length), 0, l), {
3222
- document: i($(r, { ...a, cards: c })),
3217
+ return c.splice(He(t.toIndex, c.length), 0, l), {
3218
+ document: i(R(r, { ...a, cards: c })),
3223
3219
  target: o(a.id, t.cardId)
3224
3220
  };
3225
3221
  }
3226
3222
  default:
3227
- return ds(t);
3223
+ return cs(t);
3228
3224
  }
3229
3225
  }
3230
3226
  function Re(e, t, n) {
3231
- const r = as(t.dashboard, {
3227
+ const r = rs(t.dashboard, {
3232
3228
  excludeSectionId: n
3233
- }).find((p) => ls(p, e));
3229
+ }).find((p) => ss(p, e));
3234
3230
  if (!r)
3235
3231
  throw new M(
3236
3232
  `Card '${e.cardId}' cannot be copied into this document.`
@@ -3246,27 +3242,27 @@ function Re(e, t, n) {
3246
3242
  onSheetField: (p) => l.add(p)
3247
3243
  }), e.sheetId === t.sheetId || l.size === 0)
3248
3244
  return { card: c };
3249
- const d = fo(o), u = /* @__PURE__ */ new Map(), f = [...l];
3245
+ const d = co(o), u = /* @__PURE__ */ new Map(), f = [...l];
3250
3246
  for (; f.length > 0; ) {
3251
3247
  const p = f.pop();
3252
3248
  if (u.has(p)) continue;
3253
3249
  const y = d.find(
3254
- (g) => Ve(g.id) === p
3250
+ (h) => Le(h.id) === p
3255
3251
  );
3256
3252
  if (!y) continue;
3257
- const h = be(y);
3258
- oe(h, {
3253
+ const g = be(y);
3254
+ oe(g, {
3259
3255
  oldCardId: e.cardId,
3260
3256
  newCardId: s,
3261
3257
  sourceSheetId: e.sheetId,
3262
3258
  targetSheetId: t.sheetId,
3263
- onSheetField: (g) => {
3264
- u.has(g) || f.push(g);
3259
+ onSheetField: (h) => {
3260
+ u.has(h) || f.push(h);
3265
3261
  }
3266
- }), u.set(p, h);
3262
+ }), u.set(p, g);
3267
3263
  }
3268
3264
  const m = d.flatMap((p) => {
3269
- const y = u.get(Ve(p.id) ?? "");
3265
+ const y = u.get(Le(p.id) ?? "");
3270
3266
  return y ? [y] : [];
3271
3267
  });
3272
3268
  return m.length === 0 ? { card: c } : {
@@ -3281,9 +3277,9 @@ function oe(e, t) {
3281
3277
  return;
3282
3278
  }
3283
3279
  const n = e;
3284
- 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(Ve(n.id) ?? n.id), n.entityId = t.targetSheetId)), Object.values(n).forEach((r) => oe(r, t));
3280
+ 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));
3285
3281
  }
3286
- function cs(e, t) {
3282
+ function os(e, t) {
3287
3283
  const n = { ...be(e), id: t.section() }, r = new Map(
3288
3284
  at(n).map((i) => [i.id, t.card()])
3289
3285
  );
@@ -3299,33 +3295,33 @@ function cs(e, t) {
3299
3295
  }), a;
3300
3296
  });
3301
3297
  }
3302
- function ls(e, t) {
3298
+ function ss(e, t) {
3303
3299
  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;
3304
3300
  }
3305
3301
  function Xt(e, t) {
3306
- if (aa(e.dashboard, t))
3302
+ if (oa(e.dashboard, t))
3307
3303
  throw new M(
3308
3304
  `Card id '${t}' is already used by another card in this dashboard.`
3309
3305
  );
3310
3306
  }
3311
- function $e(e, t, n) {
3312
- const r = We(n, e.length);
3307
+ function Ke(e, t, n) {
3308
+ const r = He(n, e.length);
3313
3309
  return [...e.slice(0, r), t, ...e.slice(r)];
3314
3310
  }
3315
- function $(e, t) {
3311
+ function R(e, t) {
3316
3312
  return e.map(
3317
3313
  (n) => n.id === t.id ? t : n
3318
3314
  );
3319
3315
  }
3320
- function We(e, t) {
3316
+ function He(e, t) {
3321
3317
  return Number.isFinite(e) ? Math.min(t, Math.max(0, Math.trunc(e))) : t;
3322
3318
  }
3323
3319
  function K(e, t) {
3324
3320
  const n = e.find(({ id: r }) => r === t);
3325
- if (!n) throw he(t);
3321
+ if (!n) throw ge(t);
3326
3322
  return n;
3327
3323
  }
3328
- function he(e) {
3324
+ function ge(e) {
3329
3325
  return new M(`Document section '${e}' does not exist.`);
3330
3326
  }
3331
3327
  function W(e, t) {
@@ -3333,44 +3329,44 @@ function W(e, t) {
3333
3329
  `'${e}' does not apply to a ${t.type} section.`
3334
3330
  );
3335
3331
  }
3336
- function ds(e) {
3332
+ function cs(e) {
3337
3333
  throw new M(
3338
3334
  `Unknown document edit '${e.type}'.`
3339
3335
  );
3340
3336
  }
3341
- const us = {
3337
+ const ls = {
3342
3338
  section: () => {
3343
3339
  throw new F("document_invalid", "A text edit mints no section id.");
3344
3340
  },
3345
3341
  card: () => {
3346
3342
  throw new F("document_invalid", "A text edit mints no card id.");
3347
3343
  }
3348
- }, fs = { title: "title", metadata: "metadata", note: "note", pageInfo: "page info" };
3349
- function ms(e, t) {
3344
+ }, ds = { title: "title", metadata: "metadata", note: "note", pageInfo: "page info" };
3345
+ function us(e, t) {
3350
3346
  const n = e.sheets ?? [], r = n.findIndex((d) => d.id === t.sheetId), i = n[r];
3351
3347
  if (!i) throw new F("sheet_not_found", `No sheet ${t.sheetId} on this dashboard.`, "Read the outline again and use its sheet ids.");
3352
3348
  if (!xe(i) || !i.document)
3353
3349
  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.");
3354
3350
  let o;
3355
3351
  try {
3356
- o = ss(i.document, t.edit, { dashboard: e, sheetId: i.id, ids: us }).document;
3352
+ o = as(i.document, t.edit, { dashboard: e, sheetId: i.id, ids: ls }).document;
3357
3353
  } catch (d) {
3358
3354
  throw d instanceof M ? new F("document_invalid", d.message, "Read the outline again and use its section ids and line roles.") : d;
3359
3355
  }
3360
- 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 = si(t.edit.content, { inputs: a.inputs, variables: a.variables }), l = ci(c);
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);
3361
3357
  return {
3362
3358
  dashboard: a,
3363
- clauses: [T.plain("document", `sets ${s} to ${w(li(c))}${l ? `, ${l}` : ""}`)]
3359
+ clauses: [T.plain("document", `sets ${s} to ${w(di(c))}${l ? `, ${l}` : ""}`)]
3364
3360
  };
3365
3361
  }
3366
- function Uc(e, t, n) {
3362
+ function Lc(e, t, n) {
3367
3363
  let r = e;
3368
3364
  const i = [], o = [], a = [], s = [], c = [];
3369
3365
  let l = !1;
3370
3366
  for (const [u, f] of t.entries()) {
3371
3367
  let m;
3372
3368
  try {
3373
- m = hs(r, f, n);
3369
+ m = ms(r, f, n);
3374
3370
  } catch (p) {
3375
3371
  if (!(p instanceof F)) throw p;
3376
3372
  return {
@@ -3395,64 +3391,64 @@ function Uc(e, t, n) {
3395
3391
  dashboard: r,
3396
3392
  created: i,
3397
3393
  touched: o.filter((u) => !d.has(u)),
3398
- queryFrames: [...ps(r, i, o), ...s],
3399
- descriptions: gs(c),
3394
+ queryFrames: [...fs(r, i, o), ...s],
3395
+ descriptions: ps(c),
3400
3396
  runtimeEffects: a,
3401
3397
  detaches: l
3402
3398
  };
3403
3399
  }
3404
- function ps(e, t, n) {
3400
+ function fs(e, t, n) {
3405
3401
  const r = /* @__PURE__ */ new Set([...t.filter((i) => i.kind === "card").map((i) => i.id), ...n]);
3406
3402
  return (e.sheets ?? []).flatMap(
3407
3403
  (i) => (i.frames ?? []).filter((o) => (o.cards ?? []).some((a) => r.has(a.id)))
3408
3404
  );
3409
3405
  }
3410
- function hs(e, t, n) {
3406
+ function ms(e, t, n) {
3411
3407
  switch (t.op) {
3412
3408
  case "card.add":
3413
- return fi(e, t);
3409
+ return mi(e, t);
3414
3410
  case "card.remove":
3415
- return ui(e, t.cardId);
3411
+ return fi(e, t.cardId);
3416
3412
  case "card.update":
3417
- return te(di(e, t.cardId, t.update), [t.cardId]);
3413
+ return te(ui(e, t.cardId, t.update), [t.cardId]);
3418
3414
  case "layout.arrange":
3419
- return so(e, t);
3415
+ return io(e, t);
3420
3416
  case "frame.commit":
3421
- return te(po(e, t.commit), [t.commit.frame.activeCardId]);
3417
+ return te(uo(e, t.commit), [t.commit.frame.activeCardId]);
3422
3418
  case "filter.add":
3423
- return Eo(e, t);
3419
+ return Ao(e, t);
3424
3420
  case "filter.update":
3425
- return Ro(e, t, n);
3421
+ return No(e, t, n);
3426
3422
  case "filter.remove":
3427
- return Ko(e, t.filterId);
3423
+ return $o(e, t.filterId);
3428
3424
  case "filter.bind":
3429
- return te(Bo(e, t), [t.cardId]);
3425
+ return te(Vo(e, t), [t.cardId]);
3430
3426
  case "filter.exclude":
3431
- return te(qo(e, t), [t.cardId]);
3427
+ return te(Lo(e, t), [t.cardId]);
3432
3428
  case "dashboard.update":
3433
- return ho(e, t);
3429
+ return fo(e, t);
3434
3430
  case "sheet.add":
3435
- return So(e, t);
3431
+ return Io(e, t);
3436
3432
  case "sheet.update":
3437
- return xo(e, t);
3433
+ return Co(e, t);
3438
3434
  case "layout.tabs":
3439
- return te(yo(e, t), t.cardIds.slice(0, 1));
3435
+ return te(po(e, t), t.cardIds.slice(0, 1));
3440
3436
  case "layout.untab":
3441
- return te(bo(e, t), [t.cardId]);
3437
+ return te(go(e, t), [t.cardId]);
3442
3438
  case "variable.add":
3443
- return Uo(e, t);
3439
+ return qo(e, t);
3444
3440
  case "variable.update":
3445
- return zo(e, t);
3441
+ return Bo(e, t);
3446
3442
  case "variable.remove":
3447
- return jo(e, t);
3443
+ return Uo(e, t);
3448
3444
  case "document.text":
3449
- return ms(e, t);
3445
+ return us(e, t);
3450
3446
  }
3451
3447
  }
3452
3448
  function te(e, t) {
3453
3449
  return { ...e, touched: t.filter(Boolean) };
3454
3450
  }
3455
- function gs(e) {
3451
+ function ps(e) {
3456
3452
  const t = [];
3457
3453
  for (const n of e) {
3458
3454
  const r = n.changeIndex === void 0 ? void 0 : t.find((i) => i.changeIndex === n.changeIndex);
@@ -3469,14 +3465,14 @@ function gs(e) {
3469
3465
  }
3470
3466
  return t.map(({ clauses: n, ...r }) => ({
3471
3467
  ...r,
3472
- sentence: mi(ys(n))
3468
+ sentence: pi(gs(n))
3473
3469
  }));
3474
3470
  }
3475
- function ys(e) {
3471
+ function gs(e) {
3476
3472
  let t = !1;
3477
3473
  return e.filter((n) => n.kind !== "detached" ? !0 : t ? !1 : (t = !0, !0));
3478
3474
  }
3479
- function Jt(e) {
3475
+ function Qt(e) {
3480
3476
  return Object.fromEntries(
3481
3477
  Object.entries(e).filter(
3482
3478
  (t) => typeof t[1] == "string" && t[1].length > 0
@@ -3498,18 +3494,18 @@ function se(e) {
3498
3494
  e.tableName
3499
3495
  ].join(":");
3500
3496
  }
3501
- function bs(e, t) {
3497
+ function hs(e, t) {
3502
3498
  if (e.kind === "semantic")
3503
3499
  return {
3504
3500
  status: "ready",
3505
- request: Jt({
3501
+ request: Qt({
3506
3502
  connection_id: e.connectionId,
3507
3503
  domain_id: e.domainId,
3508
- dataset_id: _i(e),
3504
+ dataset_id: Pi(e),
3509
3505
  dataset_name: e.datasetName
3510
3506
  })
3511
3507
  };
3512
- const n = sa({
3508
+ const n = ca({
3513
3509
  source: e,
3514
3510
  capabilities: t
3515
3511
  });
@@ -3521,7 +3517,7 @@ function bs(e, t) {
3521
3517
  message: `Source is missing required field-metadata coordinates: ${n.missing.join(", ")}.`
3522
3518
  } : {
3523
3519
  status: "ready",
3524
- request: Jt({
3520
+ request: Qt({
3525
3521
  connection_id: e.connectionId,
3526
3522
  datamodel_id: "",
3527
3523
  database_name: n.coordinates.databaseName,
@@ -3530,14 +3526,14 @@ function bs(e, t) {
3530
3526
  })
3531
3527
  };
3532
3528
  }
3533
- function zc(e, t = /* @__PURE__ */ new Map()) {
3529
+ function qc(e, t = /* @__PURE__ */ new Map()) {
3534
3530
  const n = /* @__PURE__ */ new Map();
3535
3531
  for (const { card: r } of e) {
3536
- const i = Qe(r), o = i.kind === "config" ? i.executableSources : i.kind === "sql" ? i.pinnedCatalogSources.map((a) => a.source) : [];
3532
+ const i = Ze(r), o = i.kind === "config" ? i.executableSources : i.kind === "sql" ? i.pinnedCatalogSources.map((a) => a.source) : [];
3537
3533
  for (const a of o) {
3538
3534
  const s = se(a);
3539
3535
  if (!n.has(s)) {
3540
- const c = bs(
3536
+ const c = hs(
3541
3537
  a,
3542
3538
  a.connectionId ? t.get(a.connectionId) : void 0
3543
3539
  );
@@ -3551,7 +3547,7 @@ function zc(e, t = /* @__PURE__ */ new Map()) {
3551
3547
  }
3552
3548
  return Array.from(n.values());
3553
3549
  }
3554
- function vs(e, t) {
3550
+ function ys(e, t) {
3555
3551
  if (e.kind !== "semantic" || !e.connectionId) return;
3556
3552
  const n = (t.qualifiedEntityName || "").split(".").map((i) => i.trim()).filter(Boolean), r = n.at(-1);
3557
3553
  if (r)
@@ -3563,14 +3559,14 @@ function vs(e, t) {
3563
3559
  ...n.length > 2 ? { databaseName: n.at(-3) } : {}
3564
3560
  };
3565
3561
  }
3566
- function ge(e, t) {
3562
+ function he(e, t) {
3567
3563
  let n = e.get(t);
3568
3564
  return n || (n = { fields: /* @__PURE__ */ new Map(), fieldConflicts: /* @__PURE__ */ new Set() }, e.set(t, n)), n;
3569
3565
  }
3570
- function rr(e, t) {
3566
+ function ir(e, t) {
3571
3567
  e.sourceLabel === void 0 ? e.sourceLabel = t : e.sourceLabel !== t && (e.sourceLabelConflict = !0);
3572
3568
  }
3573
- function He(e, t, n) {
3569
+ function Ye(e, t, n) {
3574
3570
  for (const r of t) {
3575
3571
  const i = r == null ? void 0 : r.trim();
3576
3572
  if (!i) continue;
@@ -3578,33 +3574,33 @@ function He(e, t, n) {
3578
3574
  a === void 0 ? e.fields.set(o, n) : a !== n && e.fieldConflicts.add(o);
3579
3575
  }
3580
3576
  }
3581
- function ir(e, t) {
3582
- t.sourceLabel && rr(e, t.sourceLabel), t.sourceLabelConflict && (e.sourceLabelConflict = !0);
3577
+ function ar(e, t) {
3578
+ t.sourceLabel && ir(e, t.sourceLabel), t.sourceLabelConflict && (e.sourceLabelConflict = !0);
3583
3579
  for (const [n, r] of t.fields)
3584
- He(e, [n], r);
3580
+ Ye(e, [n], r);
3585
3581
  for (const n of t.fieldConflicts ?? [])
3586
3582
  e.fieldConflicts.add(n);
3587
3583
  }
3588
- function ar(e) {
3584
+ function or(e) {
3589
3585
  return e.kind === "semantic" && (e.label || e.datasetName || "").trim() || void 0;
3590
3586
  }
3591
- function jc(e, t) {
3587
+ function Bc(e, t) {
3592
3588
  var r, i;
3593
3589
  const n = /* @__PURE__ */ new Map();
3594
3590
  for (const [o, a] of e) {
3595
3591
  if (a.status !== "ready") continue;
3596
- const s = t == null ? void 0 : t.get(o), c = s ? ar(s) : void 0;
3592
+ const s = t == null ? void 0 : t.get(o), c = s ? or(s) : void 0;
3597
3593
  for (const l of a.columns) {
3598
- const d = (r = l.column_name) == null ? void 0 : r.trim(), u = (i = l.label) == null ? void 0 : i.trim(), f = s ? vs(s, l) : void 0;
3599
- f && c && rr(
3600
- ge(n, se(f)),
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(
3596
+ he(n, se(f)),
3601
3597
  c
3602
- ), !(!d || !u || u === d) && (He(
3603
- ge(n, o),
3598
+ ), !(!d || !u || u === d) && (Ye(
3599
+ he(n, o),
3604
3600
  [d, l.sourceField],
3605
3601
  u
3606
- ), f && He(
3607
- ge(n, se(f)),
3602
+ ), f && Ye(
3603
+ he(n, se(f)),
3608
3604
  [l.sourceField, d],
3609
3605
  u
3610
3606
  ));
@@ -3612,20 +3608,20 @@ function jc(e, t) {
3612
3608
  }
3613
3609
  return n;
3614
3610
  }
3615
- function Gc(...e) {
3611
+ function Uc(...e) {
3616
3612
  const t = /* @__PURE__ */ new Map();
3617
3613
  for (const n of e)
3618
3614
  for (const [r, i] of n ?? [])
3619
- ir(ge(t, r), i);
3615
+ ar(he(t, r), i);
3620
3616
  return t;
3621
3617
  }
3622
3618
  function pt(e) {
3623
3619
  return [e.databaseName, e.schemaName, e.tableName].filter(Boolean).join(".");
3624
3620
  }
3625
- function Is(e) {
3621
+ function bs(e) {
3626
3622
  return e.split(":").slice(2).filter(Boolean).join(".");
3627
3623
  }
3628
- function or(e, t) {
3624
+ function sr(e, t) {
3629
3625
  const n = se(t), r = e.get(n);
3630
3626
  if (t.kind !== "physical") return r;
3631
3627
  const i = `physical:${t.connectionId}:`, o = pt(t), a = {
@@ -3634,32 +3630,32 @@ function or(e, t) {
3634
3630
  };
3635
3631
  let s = !1;
3636
3632
  for (const [c, l] of e)
3637
- c.startsWith(i) && (c !== n && !ca(o, Is(c)) || (ir(a, l), s = !0));
3633
+ c.startsWith(i) && (c !== n && !la(o, bs(c)) || (ar(a, l), s = !0));
3638
3634
  return s ? a : void 0;
3639
3635
  }
3640
- function Cs(e, t) {
3636
+ function vs(e, t) {
3641
3637
  var i;
3642
3638
  if (!e) return;
3643
- const n = yn(t.name), r = or(e, t.source);
3639
+ const n = yn(t.name), r = sr(e, t.source);
3644
3640
  return r && !((i = r.fieldConflicts) != null && i.has(n)) ? r.fields.get(n) : void 0;
3645
3641
  }
3646
- function Fs(e, t) {
3642
+ function Is(e, t) {
3647
3643
  if (t.kind === "semantic")
3648
- return ar(t) || t.datasetId || "Dataset";
3649
- const n = e ? or(e, t) : void 0;
3644
+ return or(t) || t.datasetId || "Dataset";
3645
+ const n = e ? sr(e, t) : void 0;
3650
3646
  return n != null && n.sourceLabel && !n.sourceLabelConflict ? n.sourceLabel : pt(t);
3651
3647
  }
3652
- function Wc(e, t) {
3653
- const n = Cs(e, t);
3648
+ function zc(e, t) {
3649
+ const n = vs(e, t);
3654
3650
  return {
3655
3651
  name: t.name,
3656
3652
  ...n ? { label: n } : {},
3657
- entityName: Fs(e, t.source),
3653
+ entityName: Is(e, t.source),
3658
3654
  ...t.source.kind === "physical" ? { qualifiedEntityName: pt(t.source) } : {},
3659
3655
  dataType: t.dataType
3660
3656
  };
3661
3657
  }
3662
- function Ss(e, t) {
3658
+ function Cs(e, t) {
3663
3659
  var i, o;
3664
3660
  const n = (i = t.column_name) == null ? void 0 : i.trim(), r = ce(t.data_type);
3665
3661
  if (!(!n || r === "unknown"))
@@ -3673,10 +3669,10 @@ function Ss(e, t) {
3673
3669
  }
3674
3670
  };
3675
3671
  }
3676
- function Hc(e) {
3672
+ function jc(e) {
3677
3673
  const t = {};
3678
3674
  for (const { card: n } of e.cards) {
3679
- const r = Qe(n), i = r.kind === "config" ? r.executableSources : r.kind === "sql" ? r.pinnedCatalogSources.map((s) => s.source) : [];
3675
+ const r = Ze(n), i = r.kind === "config" ? r.executableSources : r.kind === "sql" ? r.pinnedCatalogSources.map((s) => s.source) : [];
3680
3676
  if (!i.length) continue;
3681
3677
  const o = [];
3682
3678
  let a;
@@ -3689,7 +3685,7 @@ function Hc(e) {
3689
3685
  break;
3690
3686
  }
3691
3687
  for (const l of c.columns) {
3692
- const d = Ss(s, l);
3688
+ const d = Cs(s, l);
3693
3689
  d && o.push(d);
3694
3690
  }
3695
3691
  }
@@ -3697,16 +3693,16 @@ function Hc(e) {
3697
3693
  }
3698
3694
  return t;
3699
3695
  }
3700
- function Yc(e) {
3701
- const { dashboard: t, target: n, calendar: r } = e, i = cr(n), o = sr(t, n, r);
3696
+ function Gc(e) {
3697
+ const { dashboard: t, target: n, calendar: r } = e, i = lr(n), o = cr(t, n, r);
3702
3698
  return {
3703
3699
  value: o,
3704
- mode: Tr(
3705
- Dr(o == null ? void 0 : o.operation) ? o.operation : i.operation
3700
+ mode: Dr(
3701
+ kr(o == null ? void 0 : o.operation) ? o.operation : i.operation
3706
3702
  )
3707
3703
  };
3708
3704
  }
3709
- function sr(e, t, n) {
3705
+ function cr(e, t, n) {
3710
3706
  var r;
3711
3707
  switch (t.kind) {
3712
3708
  case "dashboardInput": {
@@ -3722,7 +3718,7 @@ function sr(e, t, n) {
3722
3718
  const i = (r = e.defaultFilterValues) == null ? void 0 : r.find(
3723
3719
  (o) => o.filterId === t.filter.id
3724
3720
  );
3725
- return i ? pi({
3721
+ return i ? gi({
3726
3722
  filterDefinitions: [t.filter],
3727
3723
  filterValues: [i]
3728
3724
  })[0] : re(t.filter, n);
@@ -3731,16 +3727,16 @@ function sr(e, t, n) {
3731
3727
  return re(t.filter, n);
3732
3728
  }
3733
3729
  }
3734
- function cr(e) {
3730
+ function lr(e) {
3735
3731
  return e.kind === "dashboardInput" ? e.input.filter : e.filter;
3736
3732
  }
3737
- function Xc(e) {
3733
+ function Wc(e) {
3738
3734
  var o;
3739
3735
  const { dashboard: t, filter: n, input: r, scope: i } = e;
3740
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 };
3741
3737
  }
3742
- function Jc(e) {
3743
- const { dashboard: t, target: n, calendar: r } = e, i = cr(n), o = gi(i), a = xs(t, n);
3738
+ function Hc(e) {
3739
+ const { dashboard: t, target: n, calendar: r } = e, i = lr(n), o = yi(i), a = Fs(t, n);
3744
3740
  if (!a) return o;
3745
3741
  if (a === "cleared")
3746
3742
  return {
@@ -3748,13 +3744,13 @@ function Jc(e) {
3748
3744
  defaultValues: void 0,
3749
3745
  defaultDateFilter: void 0
3750
3746
  };
3751
- const s = sr(t, n, r);
3752
- if (!s || ws(s, re(i, r)))
3747
+ const s = cr(t, n, r);
3748
+ if (!s || Ss(s, re(i, r)))
3753
3749
  return o;
3754
3750
  if (s.valueType === "date") {
3755
- const c = Pi(
3751
+ const c = Ai(
3756
3752
  "relativeMeta" in s ? s.relativeMeta : void 0
3757
- ) ?? Ts(i, s, r);
3753
+ ) ?? xs(i, s, r);
3758
3754
  return c ? {
3759
3755
  operation: s.operation,
3760
3756
  defaultValues: i.defaultValues,
@@ -3767,7 +3763,7 @@ function Jc(e) {
3767
3763
  defaultDateFilter: i.defaultDateFilter
3768
3764
  };
3769
3765
  }
3770
- function xs(e, t) {
3766
+ function Fs(e, t) {
3771
3767
  var n;
3772
3768
  if (t.kind === "dashboardInput") {
3773
3769
  const r = nt(
@@ -3782,19 +3778,19 @@ function xs(e, t) {
3782
3778
  (r) => r.filterId === t.filter.id
3783
3779
  ) ? "set" : void 0;
3784
3780
  }
3785
- function ws(e, t) {
3786
- return !!(t && e.operation === t.operation && Le(Qt(e), Qt(t)) && Le(
3781
+ function Ss(e, t) {
3782
+ return !!(t && e.operation === t.operation && qe(Jt(e), Jt(t)) && qe(
3787
3783
  "relativeMeta" in e ? e.relativeMeta : void 0,
3788
3784
  "relativeMeta" in t ? t.relativeMeta : void 0
3789
3785
  ));
3790
3786
  }
3791
- function Qt(e) {
3787
+ function Jt(e) {
3792
3788
  return e.values.map(
3793
3789
  (t) => t instanceof Date ? t.getTime() : t
3794
3790
  );
3795
3791
  }
3796
- function Ts(e, t, n) {
3797
- const r = yi(n == null ? void 0 : n.tz), i = _e(t.values[0], r);
3792
+ function xs(e, t, n) {
3793
+ const r = bi(n == null ? void 0 : n.tz), i = Pe(t.values[0], r);
3798
3794
  if (!i) return;
3799
3795
  const [o, a, s] = new Intl.DateTimeFormat("en-CA", {
3800
3796
  timeZone: r,
@@ -3811,7 +3807,7 @@ function Ts(e, t, n) {
3811
3807
  ], l = t.values.map(
3812
3808
  (d) => {
3813
3809
  var u;
3814
- return (u = _e(d, r)) == null ? void 0 : u.getTime();
3810
+ return (u = Pe(d, r)) == null ? void 0 : u.getTime();
3815
3811
  }
3816
3812
  );
3817
3813
  return c.find((d) => {
@@ -3819,11 +3815,11 @@ function Ts(e, t, n) {
3819
3815
  { ...e, defaultDateFilter: d },
3820
3816
  n
3821
3817
  );
3822
- return (u == null ? void 0 : u.operation) === t.operation && Le(
3818
+ return (u == null ? void 0 : u.operation) === t.operation && qe(
3823
3819
  u.values.map(
3824
3820
  (f) => {
3825
3821
  var m;
3826
- return (m = _e(f, r)) == null ? void 0 : m.getTime();
3822
+ return (m = Pe(f, r)) == null ? void 0 : m.getTime();
3827
3823
  }
3828
3824
  ),
3829
3825
  l
@@ -3831,17 +3827,17 @@ function Ts(e, t, n) {
3831
3827
  });
3832
3828
  }
3833
3829
  function Zt(e) {
3834
- return la(void 0, e ?? "");
3830
+ return da(void 0, e ?? "");
3835
3831
  }
3836
- const Ds = {
3832
+ const ws = {
3837
3833
  type: "temporal_bucket",
3838
3834
  presentation: { mode: "pattern", pattern: "YYYY-MM-DD" }
3839
3835
  };
3840
- function ks(e) {
3836
+ function Ts(e) {
3841
3837
  const t = ce(e.dataType);
3842
3838
  if (!["date", "datetime"].includes(t))
3843
3839
  return e;
3844
- const n = e.granularity !== void 0 || e.format !== void 0, r = bi({
3840
+ const n = e.granularity !== void 0 || e.format !== void 0, r = vi({
3845
3841
  fieldId: e.id,
3846
3842
  dataType: e.dataType,
3847
3843
  granularity: e.granularity,
@@ -3850,19 +3846,19 @@ function ks(e) {
3850
3846
  });
3851
3847
  if (!r.ok)
3852
3848
  return e;
3853
- const i = n ? r.selection.format : Ds;
3849
+ const i = n ? r.selection.format : ws;
3854
3850
  return {
3855
3851
  ...e,
3856
3852
  granularity: r.granularity,
3857
3853
  format: i
3858
3854
  };
3859
3855
  }
3860
- function Qc(e, t) {
3856
+ function Yc(e, t) {
3861
3857
  var r, i;
3862
3858
  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);
3863
3859
  return `${e}-${t.qualifiedEntityName}-${t.name}-${Date.now()}-${n}`;
3864
3860
  }
3865
- function Ms(e, t) {
3861
+ function Ds(e, t) {
3866
3862
  const n = pn(e.replace(/_/g, " "));
3867
3863
  switch (t) {
3868
3864
  case "SUM":
@@ -3881,15 +3877,15 @@ function Ms(e, t) {
3881
3877
  return n;
3882
3878
  }
3883
3879
  }
3884
- function Zc(e, t, n) {
3880
+ function Xc(e, t, n) {
3885
3881
  var i;
3886
- const r = hn(e.dataType);
3882
+ const r = gn(e.dataType);
3887
3883
  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";
3888
3884
  }
3889
- function el(e, t, n, r) {
3890
- const i = hn(e.dataType), o = i === "date";
3891
- e = Ai(e);
3892
- const a = Ni(e), s = a.representation !== "physical", c = a.computeStage, l = s ? e.fieldScope === "domain" ? e.calculatedFieldOrigin : e.calculatedFieldOrigin || {
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 || {
3893
3889
  id: e.id,
3894
3890
  role: e.role
3895
3891
  } : void 0;
@@ -3915,7 +3911,7 @@ function el(e, t, n, r) {
3915
3911
  // Semantic-model labels are customer-facing names. Preserve them when a
3916
3912
  // source field moves into a non-metric shelf; only derive a label when
3917
3913
  // the source did not provide one.
3918
- label: e.label || Ze(e.name),
3914
+ label: e.label || et(e.name),
3919
3915
  derivedLabel: e.derivedLabel,
3920
3916
  alias: e.alias,
3921
3917
  nativeDataType: e.nativeDataType,
@@ -3936,20 +3932,20 @@ function el(e, t, n, r) {
3936
3932
  };
3937
3933
  if (t === "metrics") {
3938
3934
  if (d || s && c === "aggregate") {
3939
- const g = e, C = {
3935
+ const h = e, C = {
3940
3936
  ...m,
3941
3937
  role: "metric",
3942
- ...Kn(g, g, "selection"),
3943
- parameters: g.parameters,
3944
- aliasTemplate: g.aliasTemplate,
3945
- valueAliases: g.valueAliases,
3946
- isPreAggregated: g.isPreAggregated,
3947
- comparison: g.comparison,
3948
- comparisonPolarity: g.comparisonPolarity,
3949
- semanticComparisonPolarity: g.semanticComparisonPolarity
3938
+ ...Kn(h, h, "selection"),
3939
+ parameters: h.parameters,
3940
+ aliasTemplate: h.aliasTemplate,
3941
+ valueAliases: h.valueAliases,
3942
+ isPreAggregated: h.isPreAggregated,
3943
+ comparison: h.comparison,
3944
+ comparisonPolarity: h.comparisonPolarity,
3945
+ semanticComparisonPolarity: h.semanticComparisonPolarity
3950
3946
  }, v = e.expression || "";
3951
3947
  if (!a.legacyManual && c !== "aggregate") {
3952
- const b = !C.aggregate && (c === "row" || Ei(v).calls.length === 0), S = Zt(i);
3948
+ const b = !C.aggregate && (c === "row" || $i(v).calls.length === 0), S = Zt(i);
3953
3949
  return {
3954
3950
  ...C,
3955
3951
  id: r,
@@ -3965,10 +3961,10 @@ function el(e, t, n, r) {
3965
3961
  role: "metric"
3966
3962
  };
3967
3963
  }
3968
- const p = e.aggregate || Zt(i), y = Ms(
3964
+ const p = e.aggregate || Zt(i), y = Ds(
3969
3965
  e.label,
3970
3966
  p
3971
- ), h = Ii(
3967
+ ), g = Ci(
3972
3968
  { ...m, label: y },
3973
3969
  n,
3974
3970
  t
@@ -3976,7 +3972,7 @@ function el(e, t, n, r) {
3976
3972
  return {
3977
3973
  ...m,
3978
3974
  role: "metric",
3979
- label: h,
3975
+ label: g,
3980
3976
  aggregate: p,
3981
3977
  aggregateOrigin: e.aggregate ? e.aggregateOrigin : "default"
3982
3978
  };
@@ -3984,7 +3980,7 @@ function el(e, t, n, r) {
3984
3980
  if (t === "groupBy") {
3985
3981
  if (u) {
3986
3982
  const p = e;
3987
- return ks({
3983
+ return Ts({
3988
3984
  ...m,
3989
3985
  label: e.label || e.name,
3990
3986
  role: "groupby",
@@ -3995,7 +3991,7 @@ function el(e, t, n, r) {
3995
3991
  ...m,
3996
3992
  role: "groupby",
3997
3993
  ...o && {
3998
- granularity: Rt(e.granularity) ? e.granularity : "month",
3994
+ granularity: $t(e.granularity) ? e.granularity : "month",
3999
3995
  // A new shelf placement does not author a presentation override.
4000
3996
  // Same-grain semantic presentation may therefore win; otherwise the
4001
3997
  // viewer's resolved automatic locale/style policy applies.
@@ -4009,13 +4005,13 @@ function el(e, t, n, r) {
4009
4005
  ...m,
4010
4006
  role: "pivotby",
4011
4007
  ...o && {
4012
- granularity: Rt(e.granularity) ? e.granularity : "month",
4008
+ granularity: $t(e.granularity) ? e.granularity : "month",
4013
4009
  format: void 0,
4014
4010
  formatOrigin: void 0
4015
4011
  }
4016
4012
  };
4017
4013
  if (t === "detailColumns") {
4018
- const p = Ci(m, "detail");
4014
+ const p = Fi(m, "detail");
4019
4015
  if (d) {
4020
4016
  const y = e;
4021
4017
  return {
@@ -4044,14 +4040,14 @@ function el(e, t, n, r) {
4044
4040
  direction: "asc"
4045
4041
  } : null;
4046
4042
  }
4047
- function tl(e) {
4048
- return Object.values(vi(e)).some((t) => t.length > 0);
4043
+ function Jc(e) {
4044
+ return Object.values(Ii(e)).some((t) => t.length > 0);
4049
4045
  }
4050
- function Os(e) {
4051
- const t = J(e.format);
4046
+ function ks(e) {
4047
+ const t = Q(e.format);
4052
4048
  if ((t == null ? void 0 : t.type) === "temporal_bucket") {
4053
4049
  if (!e.granularity) return {};
4054
- const n = Yi(
4050
+ const n = Xi(
4055
4051
  t,
4056
4052
  e.granularity
4057
4053
  );
@@ -4068,22 +4064,22 @@ function Os(e) {
4068
4064
  ...t ? { format: t } : {}
4069
4065
  };
4070
4066
  }
4071
- function _s(e, t) {
4067
+ function Ms(e, t) {
4072
4068
  var i, o;
4073
4069
  const n = ((i = e.nativeDataType) == null ? void 0 : i.trim()) || ((o = e.native_data_type) == null ? void 0 : o.trim());
4074
4070
  return n || ((e.dataTypeProvenance || t) === "physical" ? e.data_type : void 0);
4075
4071
  }
4076
- function lr(e) {
4072
+ function dr(e) {
4077
4073
  const t = (e.label ?? "").trim();
4078
4074
  return t ? e.derivedLabel === void 0 ? !0 : t !== e.derivedLabel.trim() : !1;
4079
4075
  }
4080
- function ht(e) {
4081
- return lr(e) ? e.label.trim() : e.name || (e.label ?? "").trim();
4076
+ function gt(e) {
4077
+ return dr(e) ? e.label.trim() : e.name || (e.label ?? "").trim();
4082
4078
  }
4083
4079
  function en(e) {
4084
- return ht(e).toLowerCase().trim();
4080
+ return gt(e).toLowerCase().trim();
4085
4081
  }
4086
- function Ps(e, t) {
4082
+ function Os(e, t) {
4087
4083
  return en(e).localeCompare(en(t), void 0, {
4088
4084
  numeric: !0,
4089
4085
  sensitivity: "base"
@@ -4092,10 +4088,10 @@ function Ps(e, t) {
4092
4088
  function ae(e) {
4093
4089
  return String(e ?? "").toLowerCase().replace(/[\s_\-.]+/g, "");
4094
4090
  }
4095
- function nl(e, t) {
4091
+ function Zc(e, t) {
4096
4092
  const n = ae(t);
4097
4093
  return n ? [
4098
- ht(e),
4094
+ gt(e),
4099
4095
  e.label,
4100
4096
  e.name,
4101
4097
  e.description,
@@ -4110,13 +4106,13 @@ function nl(e, t) {
4110
4106
  function tn(e, t) {
4111
4107
  const n = ae(t);
4112
4108
  if (!n) return 0;
4113
- const r = ae(ht(e));
4109
+ const r = ae(gt(e));
4114
4110
  return r.startsWith(n) ? 0 : r.includes(n) ? 1 : [e.label, e.name].filter(Boolean).map(ae).some((o) => o.includes(n)) ? 2 : 3;
4115
4111
  }
4116
- function rl(e, t, n) {
4117
- return tn(e, n) - tn(t, n) || Ps(e, t);
4112
+ function el(e, t, n) {
4113
+ return tn(e, n) - tn(t, n) || Os(e, t);
4118
4114
  }
4119
- function As(e, t) {
4115
+ function _s(e, t) {
4120
4116
  var o;
4121
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(
4122
4118
  e.type === "dataset" && n ? { ...e, name: n } : e
@@ -4130,12 +4126,12 @@ function As(e, t) {
4130
4126
  qualifiedEntityName: i,
4131
4127
  columns: t.map((a) => {
4132
4128
  var m;
4133
- const s = e.type === "dataset" ? a.entityName || r : e.name, c = a.qualifiedEntityName || (e.type === "dataset" && s ? Pt({ ...e, name: s }) : i), l = _s(
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(
4134
4130
  a,
4135
4131
  e.type === "dataset" ? "semantic" : "physical"
4136
- ), d = (m = a.label) != null && m.trim() ? a.label : void 0, u = d ? void 0 : Ze(a.column_name);
4132
+ ), d = (m = a.label) != null && m.trim() ? a.label : void 0, u = d ? void 0 : et(a.column_name);
4137
4133
  return {
4138
- id: Fi(s, a.column_name),
4134
+ id: Si(s, a.column_name),
4139
4135
  name: a.column_name,
4140
4136
  qualifiedFieldName: a.qualifiedFieldName || a.column_name,
4141
4137
  dataType: a.data_type,
@@ -4159,23 +4155,23 @@ function As(e, t) {
4159
4155
  aggregateOrigin: a.aggregateOrigin,
4160
4156
  labelOrigin: a.labelOrigin,
4161
4157
  formatOrigin: a.formatOrigin,
4162
- ...Os(a),
4158
+ ...ks(a),
4163
4159
  aggregate: a.aggregate
4164
4160
  };
4165
4161
  })
4166
4162
  };
4167
4163
  }
4168
- function Ns(e) {
4164
+ function Ps(e) {
4169
4165
  return e.map((t) => ({
4170
4166
  ...t,
4171
- id: gn({ ...t }),
4167
+ id: hn({ ...t }),
4172
4168
  fieldScope: "domain"
4173
4169
  }));
4174
4170
  }
4175
- function Es(e) {
4171
+ function As(e) {
4176
4172
  return e.flatMap(
4177
4173
  (t) => t.columns.map((n) => {
4178
- const r = lr(n) ? n.label : void 0, i = r ? void 0 : n.derivedLabel ?? pn(n.name), o = r ?? i ?? n.name;
4174
+ const r = dr(n) ? n.label : void 0, i = r ? void 0 : n.derivedLabel ?? pn(n.name), o = r ?? i ?? n.name;
4179
4175
  return {
4180
4176
  ...n,
4181
4177
  id: n.id || `${t.entityId}-${n.name}`,
@@ -4193,18 +4189,18 @@ function Es(e) {
4193
4189
  })
4194
4190
  );
4195
4191
  }
4196
- function il(e) {
4197
- const t = e.map((r) => As(r.target, r.columns || [])).filter((r) => {
4192
+ function tl(e) {
4193
+ const t = e.map((r) => _s(r.target, r.columns || [])).filter((r) => {
4198
4194
  var i;
4199
4195
  return ((i = r == null ? void 0 : r.columns) == null ? void 0 : i.length) > 0;
4200
- }), n = Ns(e.flatMap((r) => r.calculatedFields || []));
4196
+ }), n = Ps(e.flatMap((r) => r.calculatedFields || []));
4201
4197
  if (n.length > 0) {
4202
4198
  const r = /* @__PURE__ */ new Map();
4203
4199
  n.forEach((i) => {
4204
- const o = gn(i);
4200
+ const o = hn(i);
4205
4201
  r.has(o) || r.set(o, i);
4206
4202
  }), t.unshift({
4207
- entityId: Si,
4203
+ entityId: xi,
4208
4204
  entityType: "dataset",
4209
4205
  entityName: At,
4210
4206
  label: "Calculated Fields",
@@ -4213,9 +4209,9 @@ function il(e) {
4213
4209
  columns: Array.from(r.values())
4214
4210
  });
4215
4211
  }
4216
- return { columnGroups: t, columns: Es(t) };
4212
+ return { columnGroups: t, columns: As(t) };
4217
4213
  }
4218
- function Rs(e, t) {
4214
+ function Ns(e, t) {
4219
4215
  var i;
4220
4216
  const n = (i = t.columnKeyMap) == null ? void 0 : i.byRole;
4221
4217
  if (!n) return;
@@ -4226,7 +4222,7 @@ function Rs(e, t) {
4226
4222
  if (r.length === 1)
4227
4223
  return r[0].outputKey ?? r[0].rawKey;
4228
4224
  }
4229
- function $s(e, t) {
4225
+ function Es(e, t) {
4230
4226
  var r;
4231
4227
  const n = (r = t.resultColumns) == null ? void 0 : r.find((i) => {
4232
4228
  const o = i.pivotIdentity;
@@ -4240,9 +4236,9 @@ function nn(e, t) {
4240
4236
  var n;
4241
4237
  switch (e.kind) {
4242
4238
  case "field":
4243
- return Rs(e.fieldId, t);
4239
+ return Ns(e.fieldId, t);
4244
4240
  case "pivot":
4245
- return $s(e, t);
4241
+ return Es(e, t);
4246
4242
  case "result":
4247
4243
  return !t.keys || t.keys.includes(e.key) ? e.key : void 0;
4248
4244
  case "sqlKpiValue":
@@ -4253,7 +4249,7 @@ function nn(e, t) {
4253
4249
  return;
4254
4250
  }
4255
4251
  }
4256
- function al(e, t) {
4252
+ function nl(e, t) {
4257
4253
  return e.flatMap((n) => {
4258
4254
  var s, c;
4259
4255
  const r = nn(n.condition.column, t);
@@ -4273,9 +4269,9 @@ function al(e, t) {
4273
4269
  ];
4274
4270
  });
4275
4271
  }
4276
- function ol(e, t, n) {
4272
+ function rl(e, t, n) {
4277
4273
  var a, s, c, l, d;
4278
- const r = xi(e);
4274
+ const r = wi(e);
4279
4275
  if (r.includes("matrixMeasure"))
4280
4276
  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;
4281
4277
  if (r.includes("sqlKpiValue")) return { kind: "sqlKpiValue" };
@@ -4296,7 +4292,7 @@ function ol(e, t, n) {
4296
4292
  );
4297
4293
  return o.length === 1 ? { kind: "field", fieldId: o[0] } : void 0;
4298
4294
  }
4299
- function sl(e, t) {
4295
+ function il(e, t) {
4300
4296
  var i, o;
4301
4297
  const n = (i = t == null ? void 0 : t.find(
4302
4298
  (a) => a.filterId === e.id
@@ -4306,11 +4302,11 @@ function sl(e, t) {
4306
4302
  ]);
4307
4303
  return n && r.has(n) ? n : e.column;
4308
4304
  }
4309
- function cl(e, t, n) {
4310
- const r = wi({ card: e, stated: t, context: n });
4311
- return r.ok ? { ok: !0, card: r.update ? Ti(e, r.update).card : e, warnings: r.warnings } : r;
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;
4312
4308
  }
4313
- function ll({
4309
+ function ol({
4314
4310
  resolvedCardConfig: e,
4315
4311
  card: t,
4316
4312
  row: n,
@@ -4319,11 +4315,11 @@ function ll({
4319
4315
  rawTemporalPresentation: o
4320
4316
  }) {
4321
4317
  const a = e || t.config, { groupByColumns: s = [], metricColumns: c = [], detailColumns: l = [] } = a || {}, d = t.type === "detailTable", u = d ? "detail" : "groupby", f = d ? l : s, m = d ? [] : c, p = [];
4322
- for (const h of f) {
4323
- const g = r ? qe(r, h.id, u) : void 0, C = (g == null ? void 0 : g.outputKey) || (g == null ? void 0 : g.rawKey) || h.label, v = n.getValue(C), I = i == null ? void 0 : i.byColumnKey.get(C);
4318
+ for (const g of f) {
4319
+ const h = r ? Ue(r, g.id, u) : void 0, C = (h == null ? void 0 : h.outputKey) || (h == null ? void 0 : h.rawKey) || g.label, v = n.getValue(C), I = i == null ? void 0 : i.byColumnKey.get(C);
4324
4320
  if (v == null && I)
4325
4321
  p.push({
4326
- field: h,
4322
+ field: g,
4327
4323
  operator: "isNull",
4328
4324
  value: null,
4329
4325
  ...I ? { label: "(Blank)", temporalBucket: I.metadata } : {}
@@ -4331,19 +4327,19 @@ function ll({
4331
4327
  else if (v != null) {
4332
4328
  const b = I || o == null ? void 0 : o.byColumnKey.get(C);
4333
4329
  p.push({
4334
- field: h,
4330
+ field: g,
4335
4331
  operator: "=",
4336
4332
  value: String(v),
4337
4333
  // Convert to string for consistency
4338
4334
  ...I ? {
4339
- label: ki({
4335
+ label: Mi({
4340
4336
  value: String(v),
4341
4337
  presentation: I
4342
4338
  }),
4343
4339
  temporalBucket: I.metadata
4344
4340
  } : {},
4345
4341
  ...b ? {
4346
- label: Di({ value: String(v), presentation: b }).label,
4342
+ label: ki({ value: String(v), presentation: b }).label,
4347
4343
  rawTemporal: { ...b.metadata, tz: b.format.calendarTimezone }
4348
4344
  } : {}
4349
4345
  });
@@ -4352,12 +4348,12 @@ function ll({
4352
4348
  if (p.length === 0)
4353
4349
  return;
4354
4350
  const y = [];
4355
- for (const h of m) {
4356
- const g = r ? qe(r, h.id, "metric") : void 0, C = n.getValue(
4357
- (g == null ? void 0 : g.outputKey) || (g == null ? void 0 : g.rawKey) || h.label
4351
+ for (const g of m) {
4352
+ const h = r ? Ue(r, g.id, "metric") : void 0, C = n.getValue(
4353
+ (h == null ? void 0 : h.outputKey) || (h == null ? void 0 : h.rawKey) || g.label
4358
4354
  );
4359
4355
  C != null && y.push({
4360
- field: h,
4356
+ field: g,
4361
4357
  value: Number(C)
4362
4358
  // Convert to number for metrics
4363
4359
  });
@@ -4368,7 +4364,7 @@ function ll({
4368
4364
  metrics: y.length > 0 ? y : void 0
4369
4365
  };
4370
4366
  }
4371
- function dl({
4367
+ function sl({
4372
4368
  resolvedCardConfig: e,
4373
4369
  card: t,
4374
4370
  columnId: n,
@@ -4376,25 +4372,25 @@ function dl({
4376
4372
  }) {
4377
4373
  const i = e || t.config, o = t.type === "detailTable", a = o ? "detail" : "groupby";
4378
4374
  return ((o ? i == null ? void 0 : i.detailColumns : i == null ? void 0 : i.groupByColumns) || []).find((c) => {
4379
- const l = r ? qe(r, c.id, a) : void 0;
4375
+ const l = r ? Ue(r, c.id, a) : void 0;
4380
4376
  return ((l == null ? void 0 : l.outputKey) || (l == null ? void 0 : l.rawKey) || c.label) === n;
4381
4377
  });
4382
4378
  }
4383
- const Ks = {
4379
+ const $s = {
4384
4380
  noFields: "There is nothing to filter by here.",
4385
4381
  clickedColumnNotFilterable: "This column cannot filter other cards.",
4386
4382
  noChosenColumns: "This column is not set up to filter other cards.",
4387
4383
  fieldNotFilterable: "This value cannot filter other cards.",
4388
4384
  unsupportedCondition: "This value cannot filter other cards."
4389
4385
  };
4390
- function Ke(e) {
4391
- return { status: "unavailable", code: e, reason: Ks[e] };
4386
+ function Ve(e) {
4387
+ return { status: "unavailable", code: e, reason: $s[e] };
4392
4388
  }
4393
- function ul(e) {
4389
+ function cl(e) {
4394
4390
  const t = e.conditions.filter(
4395
4391
  (s) => s.field.role !== "metric"
4396
4392
  );
4397
- if (!t.length) return Ke("noFields");
4393
+ if (!t.length) return Ve("noFields");
4398
4394
  const n = (s) => {
4399
4395
  if (s.operator !== "=" && s.operator !== "isNull")
4400
4396
  return "unsupportedCondition";
@@ -4416,31 +4412,31 @@ function ul(e) {
4416
4412
  if (r.kind === "wholeRow")
4417
4413
  for (const s of t) {
4418
4414
  const c = n(s);
4419
- if (typeof c == "string") return Ke(c);
4415
+ if (typeof c == "string") return Ve(c);
4420
4416
  i.push(c);
4421
4417
  }
4422
4418
  else {
4423
- const s = r.kind === "clickedCell" && e.clickedField ? Nt(e.clickedField, e.sourceIndex) : void 0, c = r.kind === "chosenColumns" ? r.clickedFieldKeys : s ? [Pe(s)] : [];
4419
+ const s = r.kind === "clickedCell" && e.clickedField ? Nt(e.clickedField, e.sourceIndex) : void 0, c = r.kind === "chosenColumns" ? r.clickedFieldKeys : s ? [Ae(s)] : [];
4424
4420
  for (const l of t) {
4425
4421
  const d = n(l);
4426
- typeof d != "string" && c.includes(Pe(d.field)) && i.push(d);
4422
+ typeof d != "string" && c.includes(Ae(d.field)) && i.push(d);
4427
4423
  }
4428
4424
  if (!i.length)
4429
- return Ke(
4425
+ return Ve(
4430
4426
  r.kind === "clickedCell" ? "clickedColumnNotFilterable" : "noChosenColumns"
4431
4427
  );
4432
4428
  }
4433
4429
  const o = /* @__PURE__ */ new Set();
4434
4430
  return { status: "ready", tuple: { conditions: i.filter((s) => {
4435
- const c = Pe(s.field);
4431
+ const c = Ae(s.field);
4436
4432
  return o.has(c) ? !1 : (o.add(c), !0);
4437
4433
  }) } };
4438
4434
  }
4439
- function fl(e, t) {
4435
+ function ll(e, t) {
4440
4436
  const n = e.answers.relationshipIds;
4441
4437
  return !n || !t ? !n && !t : n.length === t.length && n.every((r, i) => t[i] === r);
4442
4438
  }
4443
- const Vs = /* @__PURE__ */ new Set([
4439
+ const Rs = /* @__PURE__ */ new Set([
4444
4440
  "dataset_not_reachable",
4445
4441
  "field_not_resolvable",
4446
4442
  "missing_metadata",
@@ -4452,7 +4448,7 @@ const Vs = /* @__PURE__ */ new Set([
4452
4448
  function z(e) {
4453
4449
  return !!e && typeof e == "object" && !Array.isArray(e);
4454
4450
  }
4455
- function Ls(e) {
4451
+ function Ks(e) {
4456
4452
  if (z(e))
4457
4453
  switch (e.status) {
4458
4454
  case "applied": {
@@ -4460,7 +4456,7 @@ function Ls(e) {
4460
4456
  return t ? { status: "applied", route: t } : void 0;
4461
4457
  }
4462
4458
  case "skipped":
4463
- return typeof e.reason == "string" && Vs.has(e.reason) ? { status: "skipped", reason: e.reason } : void 0;
4459
+ return typeof e.reason == "string" && Rs.has(e.reason) ? { status: "skipped", reason: e.reason } : void 0;
4464
4460
  case "needsPath":
4465
4461
  return { status: "needsPath" };
4466
4462
  case "blocked":
@@ -4473,22 +4469,22 @@ function Ls(e) {
4473
4469
  return;
4474
4470
  }
4475
4471
  }
4476
- function dr(e) {
4472
+ function ur(e) {
4477
4473
  if (e !== void 0)
4478
4474
  return Array.isArray(e) && e.length > 0 && e.every((t) => typeof t == "string" && t.length > 0) ? e : null;
4479
4475
  }
4480
- function Bs(e) {
4476
+ function Vs(e) {
4481
4477
  if (!z(e)) return;
4482
4478
  const t = xn(e.route), n = e.target;
4483
- if (!(!t || !z(n) || n.kind !== "relationship" || !z(n.field) || typeof n.field.name != "string" || !z(n.field.source) || n.field.source.kind !== "semantic" || !dr(n.relationshipIds)))
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)))
4484
4480
  return { route: t, target: n };
4485
4481
  }
4486
- function ml(e) {
4482
+ function dl(e) {
4487
4483
  if (!z(e) || !Array.isArray(e.previews)) return { previews: [] };
4488
4484
  const t = [];
4489
4485
  for (const r of e.previews) {
4490
4486
  if (!z(r) || typeof r.cardId != "string" || !r.cardId || !z(r.answers)) continue;
4491
- const i = dr(r.answers.relationshipIds), o = Ls(r.outcome), a = Array.isArray(r.paths) ? r.paths.map(Bs) : [];
4487
+ const i = ur(r.answers.relationshipIds), o = Ks(r.outcome), a = Array.isArray(r.paths) ? r.paths.map(Vs) : [];
4492
4488
  i === null || !o || !a.every(Boolean) || o.status === "needsPath" && a.length < 2 || t.push({
4493
4489
  cardId: r.cardId,
4494
4490
  answers: i ? { relationshipIds: i } : {},
@@ -4500,18 +4496,18 @@ function ml(e) {
4500
4496
  return { previews: t, ...n ? { manageRelationships: n } : {} };
4501
4497
  }
4502
4498
  const ye = (e) => (e == null ? void 0 : e.label) || (e == null ? void 0 : e.name) || "";
4503
- function qs(e) {
4499
+ function Ls(e) {
4504
4500
  return !e || /s$/i.test(e) ? e : /[^aeiou]y$/i.test(e) ? `${e.slice(0, -1)}ies` : `${e}s`;
4505
4501
  }
4506
- function pl(e) {
4502
+ function ul(e) {
4507
4503
  if (e.direction === "to_many") {
4508
4504
  const n = ye(e.matchingDataset ?? e.datasets[e.datasets.length - 1]);
4509
- return `${e.base ? qs(ye(e.base)) : "Rows"} with at least one matching ${n}`;
4505
+ return `${e.base ? Ls(ye(e.base)) : "Rows"} with at least one matching ${n}`;
4510
4506
  }
4511
4507
  return `through ${(e.datasets.length > 1 ? e.datasets.slice(0, -1) : e.datasets).map(ye).join(", ")}`;
4512
4508
  }
4513
- const hl = "The relationship this card used changed; choose it again";
4514
- function gl(e, t) {
4509
+ const fl = "The relationship this card used changed; choose it again";
4510
+ function ml(e, t) {
4515
4511
  switch (e) {
4516
4512
  case "relationship_missing":
4517
4513
  return t ? `Not related to ${ye(t)}` : "Not related to this card";
@@ -4529,145 +4525,143 @@ function gl(e, t) {
4529
4525
  }
4530
4526
  }
4531
4527
  export {
4532
- uo as $,
4533
- eo as A,
4534
- ro as B,
4528
+ M as $,
4529
+ _s as A,
4530
+ Ps as B,
4535
4531
  As as C,
4536
- ts as D,
4537
- Ns as E,
4538
- Es as F,
4539
- il as G,
4540
- nn as H,
4532
+ Zo as D,
4533
+ tl as E,
4534
+ nn as F,
4535
+ nl as G,
4536
+ rl as H,
4541
4537
  al as I,
4542
- ol as J,
4543
- cl as K,
4544
- fl as L,
4545
- ml as M,
4546
- to as N,
4547
- qs as O,
4548
- pl as P,
4549
- gl as Q,
4550
- hl as R,
4551
- ht as S,
4552
- Wa as T,
4553
- Ca as U,
4554
- Fa as V,
4555
- we as W,
4556
- mc as X,
4557
- Nc as Y,
4558
- dc as Z,
4559
- Fe as _,
4560
- Qc as a,
4561
- Gc as a$,
4562
- mo as a0,
4563
- M as a1,
4564
- ss as a2,
4565
- vo as a3,
4566
- Pc as a4,
4567
- Bc as a5,
4568
- Vc as a6,
4569
- va as a7,
4570
- ya as a8,
4571
- ba as a9,
4572
- wn as aA,
4573
- Sa as aB,
4574
- ot as aC,
4575
- pc as aD,
4576
- hc as aE,
4577
- Se as aF,
4578
- le as aG,
4579
- lc as aH,
4580
- dl as aI,
4581
- Ic as aJ,
4582
- wo as aK,
4583
- V as aL,
4584
- Ec as aM,
4585
- tr as aN,
4586
- nl as aO,
4587
- lr as aP,
4588
- Wc as aQ,
4589
- Fs as aR,
4590
- se as aS,
4591
- pt as aT,
4592
- zc as aU,
4593
- Hc as aV,
4594
- jc as aW,
4595
- bs as aX,
4596
- _s as aY,
4597
- Jc as aZ,
4598
- Xc as a_,
4599
- Dc as aa,
4600
- lt as ab,
4601
- gc as ac,
4602
- Fc as ad,
4603
- xc as ae,
4604
- Sc as af,
4605
- st as ag,
4606
- Ka as ah,
4607
- Cc as ai,
4608
- wc as aj,
4609
- Ma as ak,
4610
- qa as al,
4611
- Ua as am,
4612
- Tc as an,
4613
- U as ao,
4614
- ze as ap,
4615
- Va as aq,
4616
- yc as ar,
4617
- bc as as,
4618
- tl as at,
4619
- vc as au,
4620
- $n as av,
4621
- fc as aw,
4622
- Ha as ax,
4623
- ga as ay,
4624
- cc as az,
4625
- Ms as b,
4626
- Cs as b0,
4627
- Ac as b1,
4628
- co as b2,
4629
- $a as b3,
4630
- rl as b4,
4631
- tn as b5,
4632
- fo as b6,
4633
- Os as b7,
4634
- Lc as b8,
4635
- as as b9,
4636
- Zc as ba,
4637
- ks as bb,
4638
- ae as bc,
4639
- Rc as bd,
4640
- Io as be,
4641
- $c as bf,
4642
- Gt as bg,
4643
- Co as bh,
4644
- Zn as bi,
4645
- Qn as bj,
4646
- Go as bk,
4647
- qc as bl,
4648
- uc as bm,
4538
+ ll as J,
4539
+ dl as K,
4540
+ Ls as L,
4541
+ ul as M,
4542
+ Ja as N,
4543
+ ml as O,
4544
+ gt as P,
4545
+ za as Q,
4546
+ fl as R,
4547
+ ba as S,
4548
+ va as T,
4549
+ Te as U,
4550
+ dc as V,
4551
+ _c as W,
4552
+ sc as X,
4553
+ 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,
4567
+ lt as a9,
4568
+ ot as aA,
4569
+ uc as aB,
4570
+ fc as aC,
4571
+ Se as aD,
4572
+ le as aE,
4573
+ oc as aF,
4574
+ sl as aG,
4575
+ yc as aH,
4576
+ Fo as aI,
4577
+ 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,
4584
+ se as aQ,
4585
+ 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,
4599
+ 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,
4607
+ U as am,
4608
+ 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,
4632
+ 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,
4649
4643
  Zt as c,
4650
- sl as d,
4651
- Fo as e,
4652
- Kc as f,
4653
- el as g,
4654
- _c as h,
4655
- Oc as i,
4656
- Uc as j,
4657
- Ss as k,
4658
- To as l,
4659
- Do as m,
4660
- ll as n,
4661
- ma as o,
4662
- sc as p,
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,
4663
4657
  Ya as q,
4664
- Yc as r,
4665
- ul as s,
4666
- Ja as t,
4667
- Qa as u,
4668
- ao as v,
4669
- kc as w,
4670
- Kn as x,
4671
- Za as y,
4672
- Mc as z
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
4673
4667
  };