react-semaphor 0.1.591 → 0.1.593
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.
- package/dist/assistant-context/index.js +1 -1
- package/dist/briefings/index.js +2 -2
- package/dist/chunks/{assistant-chat-Cazikwyh.js → assistant-chat-D05uNAeO.js} +7 -7
- package/dist/chunks/bookmark-impact-B0k90wq8.js +76 -0
- package/dist/chunks/{bookmark-state-Bt_eQEqt.js → bookmark-state-Be2W3s6t.js} +174 -166
- package/dist/chunks/{card-filter-builder-DFR-6Jpm.js → card-filter-builder-CiafWE26.js} +73 -73
- package/dist/chunks/{comparison-window-caption-CFaw-kIV.js → comparison-window-caption-h8w3ySL6.js} +88 -89
- package/dist/chunks/{dashboard-DCh9hKnJ.js → dashboard-T-gYKGTF.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-ob8G1b58.js → dashboard-briefing-launcher-CPh2B3Rf.js} +84 -84
- package/dist/chunks/{dashboard-controls-Nszg0k1A.js → dashboard-controls-Cijc9c3G.js} +9 -9
- package/dist/chunks/{dashboard-json-BpwnG23b.js → dashboard-json-D3m7h4VL.js} +1 -1
- package/dist/chunks/{dates-BOLBSBpn.js → dates-Bb0sn54j.js} +6 -6
- package/dist/chunks/{edit-dashboard-visual-BvM7br5P.js → edit-dashboard-visual-C0iSuX9t.js} +374 -374
- package/dist/chunks/{filter-reach-copy-By3r7O3G.js → filter-reach-copy-CifrEFxj.js} +221 -221
- package/dist/chunks/{filter-value-text-CFiIZWJP.js → filter-value-text-CHBm4IU7.js} +10 -10
- package/dist/chunks/{index-CsQYlwhU.js → index-CzM2w1kY.js} +22 -22
- package/dist/chunks/{pivot-result-contract-expectations-BkMRCjzf.js → pivot-result-contract-expectations-CaS0y823.js} +588 -552
- package/dist/chunks/{report-preferences-dialog-ChXt8wCt.js → report-preferences-dialog-GHvai50w.js} +9 -9
- package/dist/chunks/{resolve-dashboard-input-context-BlyFX8He.js → resolve-dashboard-input-context-BcQHmMlw.js} +7585 -6490
- package/dist/chunks/{saved-dashboard-context-BPSdH2jW.js → saved-dashboard-context-BHHEzmwM.js} +16 -16
- package/dist/chunks/{semaphor-ready-indicator-BZUMCHRU.js → semaphor-ready-indicator-AOUJrUAJ.js} +21334 -21330
- package/dist/chunks/{shelf-drop-preview-context-yJheoeTC.js → shelf-drop-preview-context-Cs62lWI1.js} +2 -2
- package/dist/chunks/stored-dashboard-Cmtl_Obh.js +4029 -0
- package/dist/chunks/{table-export-sheet-h7wm5TwP.js → table-export-sheet-Cd6z7SsG.js} +1 -1
- package/dist/chunks/{variable-draft-OpYyaVCW.js → variable-draft-CSK9Ps1o.js} +2 -2
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +1097 -1105
- package/dist/format-utils/index.js +215 -216
- package/dist/index.js +56 -56
- package/dist/surfboard/index.js +2 -2
- package/dist/types/components/visual/data-table/hooks/use-data-table-logic.d.ts +3 -3
- package/dist/types/components/visual/data-table/types/data-table.d.ts +24 -2
- package/dist/types/index.js +30 -29
- package/dist/types/lib/dashboard-viewer/table-view-edit.d.ts +27 -0
- package/dist/types/lib/dashboard-viewer/table-view.d.ts +37 -1
- package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
- package/dist/types/shared/dashboard-authoring/card-settings/column-names.d.ts +3 -0
- package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +6 -0
- package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +11 -0
- package/dist/types/shared/dashboard-viewer/table-column-move.d.ts +56 -0
- package/dist/types/shared/dashboard-viewer/table-settings.d.ts +7 -0
- package/package.json +1 -1
- package/dist/chunks/bookmark-impact-rWjQgk8h.js +0 -75
- package/dist/chunks/pivot-header-presentation-gUxhdIdr.js +0 -42
- package/dist/chunks/stored-dashboard-CxQl9g0l.js +0 -4994
- package/dist/types/components/visual/shared/utils/table-column-order.d.ts +0 -53
|
@@ -1,4994 +0,0 @@
|
|
|
1
|
-
import { hN as fo, cU as mo, ch as po, aX as go, bj as yo, f as bo, c9 as Co, N as ie, hO as ho, hP as ze, eC as Nt, eF as Io, bS as vo, hQ as Fo, ax as Do, gR as Lt, gT as So, bD as Ge, hR as jt, P as To, gV as Mo, dp as Te, s as R, gM as Me, n as He, hS as Vo, gZ as ko, dg as zt, di as Gt, d1 as Po, dn as xo, dl as Ct, dm as wo, b as Oo, d3 as Bo, df as Ao, dd as Eo, bG as Ht, be as _o, a4 as N, hp as Ro, hT as Ve, hU as Ut, hV as Ko, hW as Ue, hE as ke, hX as qo, hY as $e, hZ as No, h_ as Lo, h$ as jo, i0 as zo, i1 as Go, l as Qe, i2 as Ho, k as ne, r as Uo, h as $o, i3 as J, gD as We, i4 as ye, i5 as $t, i6 as Qo, J as Wo, i7 as Jo, i8 as Zo, gw as Qt, i9 as Yo, ia as Xo, e as er, ib as tr, ic as Wt, id as nr, a0 as Jt, ie as or, ig as rr, ih as Zt, j as Je, ii as ir, cI as sr, a5 as ar, o as Yt, cH as lr, hB as cr, q as dr, t as ht, C as ur, ij as fr, ik as mr, cJ as pr, il as gr } from "./resolve-dashboard-input-context-BlyFX8He.js";
|
|
2
|
-
import { am as yr, a7 as se, M as br, x as Cr, ay as _e, y as hr, a9 as be, aA as Xt, W as Ir, b as vr, r as Fr, k as Dr, aE as Sr } from "./validators-BlEWWX9O.js";
|
|
3
|
-
import { r as en } from "./matrix-operation-contract-CAanJeCj.js";
|
|
4
|
-
import { S as Ze } from "./analytics-base-schemas-8wz9vqn_.js";
|
|
5
|
-
import "./pickers-DkqmtnTL.js";
|
|
6
|
-
import { canonicalizeSupportedCurrencyCode as tn } from "../value-format-preferences/index.js";
|
|
7
|
-
import { ZodError as Tr } from "zod";
|
|
8
|
-
import { c as Ce, r as Mr, b4 as Vr, i as kr, aN as Pr, aj as It, aL as vt } from "./pivot-result-contract-expectations-BkMRCjzf.js";
|
|
9
|
-
import { aD as nn, aE as on, aF as Oe, a2 as xr, aG as rn, aH as sn, aC as an, aI as ln, n as wr, l as Or, v as cn, t as U, aJ as dn, k as un, C as Re, aK as Q, z as ae, i as fn, o as Br, u as Ar, B as Ye, aL as Er, ak as _r, F as mn, D as Rr, J as Ft, O as pn, P as gn, I as yn } from "./bookmark-state-Bt_eQEqt.js";
|
|
10
|
-
import "./schema-C9NPiIru.js";
|
|
11
|
-
import "./index-CV_Kzou0.js";
|
|
12
|
-
import "./context-CVXTFljo.js";
|
|
13
|
-
import { a as Kr, k as qr, s as Nr, i as Lr } from "./matrix-analytical-definition-CyWOwLmE.js";
|
|
14
|
-
import { D as jr } from "./report-runtime-context-g4Zp_TU9.js";
|
|
15
|
-
import { isPdfTableCardType as zr, PDF_CAPACITY as Gr } from "../pdf-export-policy/index.js";
|
|
16
|
-
import { K as Dt } from "./raw-temporal-value-BzdgeDa7.js";
|
|
17
|
-
import { t as Hr, n as Ur, c as $r } from "./selection-filter-compiler-BclSpK3P.js";
|
|
18
|
-
import { a as le, C as Qr } from "./metric-comparison-BeKnUD08.js";
|
|
19
|
-
import { r as Wr } from "./pivot-result-identity-BKUjYO1u.js";
|
|
20
|
-
import { p as Jr } from "./pivot-header-presentation-gUxhdIdr.js";
|
|
21
|
-
const Zr = (e, t) => {
|
|
22
|
-
const n = {};
|
|
23
|
-
if (e === null || t === null)
|
|
24
|
-
return t;
|
|
25
|
-
const o = /* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)]);
|
|
26
|
-
for (const r of o) {
|
|
27
|
-
if (!(r in e) && r in t) {
|
|
28
|
-
n[r] = t[r];
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
if (r in e && !(r in t)) {
|
|
32
|
-
n[r] = void 0;
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
|
-
const i = e[r], s = t[r];
|
|
36
|
-
if (!Ke(i, s))
|
|
37
|
-
if (Array.isArray(i) && Array.isArray(s))
|
|
38
|
-
n[r] = s;
|
|
39
|
-
else if (St(i) && St(s)) {
|
|
40
|
-
const a = Zr(i, s);
|
|
41
|
-
Object.keys(a).length > 0 && (n[r] = a);
|
|
42
|
-
} else
|
|
43
|
-
n[r] = s;
|
|
44
|
-
}
|
|
45
|
-
return n;
|
|
46
|
-
}, Ke = (e, t) => {
|
|
47
|
-
if (e === t) return !0;
|
|
48
|
-
if (e && t && typeof e == "object" && typeof t == "object") {
|
|
49
|
-
if (Array.isArray(e) && Array.isArray(t))
|
|
50
|
-
return e.length !== t.length ? !1 : e.every((r, i) => Ke(r, t[i]));
|
|
51
|
-
const n = Object.keys(e), o = Object.keys(t);
|
|
52
|
-
return n.length !== o.length ? !1 : n.every((r) => Ke(e[r], t[r]));
|
|
53
|
-
}
|
|
54
|
-
return !1;
|
|
55
|
-
}, St = (e) => e !== null && typeof e == "object" && !Array.isArray(e), he = (e) => {
|
|
56
|
-
if (e === null || typeof e != "object")
|
|
57
|
-
return e;
|
|
58
|
-
if (e instanceof Date)
|
|
59
|
-
return new Date(e);
|
|
60
|
-
if (e instanceof RegExp)
|
|
61
|
-
return new RegExp(e);
|
|
62
|
-
if (Array.isArray(e))
|
|
63
|
-
return e.map((n) => he(n));
|
|
64
|
-
const t = {};
|
|
65
|
-
for (const n in e)
|
|
66
|
-
Object.prototype.hasOwnProperty.call(e, n) && (t[n] = he(e[n]));
|
|
67
|
-
return t;
|
|
68
|
-
}, Yr = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
69
|
-
function Xr(e) {
|
|
70
|
-
return typeof e == "string" && Yr.test(e);
|
|
71
|
-
}
|
|
72
|
-
function ei(e) {
|
|
73
|
-
if (!Xr(e))
|
|
74
|
-
throw TypeError("Invalid UUID");
|
|
75
|
-
let t;
|
|
76
|
-
const n = new Uint8Array(16);
|
|
77
|
-
return n[0] = (t = parseInt(e.slice(0, 8), 16)) >>> 24, n[1] = t >>> 16 & 255, n[2] = t >>> 8 & 255, n[3] = t & 255, n[4] = (t = parseInt(e.slice(9, 13), 16)) >>> 8, n[5] = t & 255, n[6] = (t = parseInt(e.slice(14, 18), 16)) >>> 8, n[7] = t & 255, n[8] = (t = parseInt(e.slice(19, 23), 16)) >>> 8, n[9] = t & 255, n[10] = (t = parseInt(e.slice(24, 36), 16)) / 1099511627776 & 255, n[11] = t / 4294967296 & 255, n[12] = t >>> 24 & 255, n[13] = t >>> 16 & 255, n[14] = t >>> 8 & 255, n[15] = t & 255, n;
|
|
78
|
-
}
|
|
79
|
-
function ti(e) {
|
|
80
|
-
e = unescape(encodeURIComponent(e));
|
|
81
|
-
const t = [];
|
|
82
|
-
for (let n = 0; n < e.length; ++n)
|
|
83
|
-
t.push(e.charCodeAt(n));
|
|
84
|
-
return t;
|
|
85
|
-
}
|
|
86
|
-
const ni = "6ba7b810-9dad-11d1-80b4-00c04fd430c8", oi = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
|
|
87
|
-
function ri(e, t, n) {
|
|
88
|
-
function o(r, i, s, a) {
|
|
89
|
-
var c;
|
|
90
|
-
if (typeof r == "string" && (r = ti(r)), typeof i == "string" && (i = ei(i)), ((c = i) === null || c === void 0 ? void 0 : c.length) !== 16)
|
|
91
|
-
throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
|
|
92
|
-
let l = new Uint8Array(16 + r.length);
|
|
93
|
-
if (l.set(i), l.set(r, i.length), l = n(l), l[6] = l[6] & 15 | t, l[8] = l[8] & 63 | 128, s) {
|
|
94
|
-
a = a || 0;
|
|
95
|
-
for (let d = 0; d < 16; ++d)
|
|
96
|
-
s[a + d] = l[d];
|
|
97
|
-
return s;
|
|
98
|
-
}
|
|
99
|
-
return fo(l);
|
|
100
|
-
}
|
|
101
|
-
try {
|
|
102
|
-
o.name = e;
|
|
103
|
-
} catch {
|
|
104
|
-
}
|
|
105
|
-
return o.DNS = ni, o.URL = oi, o;
|
|
106
|
-
}
|
|
107
|
-
function ii(e, t, n, o) {
|
|
108
|
-
switch (e) {
|
|
109
|
-
case 0:
|
|
110
|
-
return t & n ^ ~t & o;
|
|
111
|
-
case 1:
|
|
112
|
-
return t ^ n ^ o;
|
|
113
|
-
case 2:
|
|
114
|
-
return t & n ^ t & o ^ n & o;
|
|
115
|
-
case 3:
|
|
116
|
-
return t ^ n ^ o;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
function Be(e, t) {
|
|
120
|
-
return e << t | e >>> 32 - t;
|
|
121
|
-
}
|
|
122
|
-
function si(e) {
|
|
123
|
-
const t = [1518500249, 1859775393, 2400959708, 3395469782], n = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
|
|
124
|
-
if (typeof e == "string") {
|
|
125
|
-
const s = unescape(encodeURIComponent(e));
|
|
126
|
-
e = [];
|
|
127
|
-
for (let a = 0; a < s.length; ++a)
|
|
128
|
-
e.push(s.charCodeAt(a));
|
|
129
|
-
} else Array.isArray(e) || (e = Array.prototype.slice.call(e));
|
|
130
|
-
e.push(128);
|
|
131
|
-
const o = e.length / 4 + 2, r = Math.ceil(o / 16), i = new Array(r);
|
|
132
|
-
for (let s = 0; s < r; ++s) {
|
|
133
|
-
const a = new Uint32Array(16);
|
|
134
|
-
for (let c = 0; c < 16; ++c)
|
|
135
|
-
a[c] = e[s * 64 + c * 4] << 24 | e[s * 64 + c * 4 + 1] << 16 | e[s * 64 + c * 4 + 2] << 8 | e[s * 64 + c * 4 + 3];
|
|
136
|
-
i[s] = a;
|
|
137
|
-
}
|
|
138
|
-
i[r - 1][14] = (e.length - 1) * 8 / Math.pow(2, 32), i[r - 1][14] = Math.floor(i[r - 1][14]), i[r - 1][15] = (e.length - 1) * 8 & 4294967295;
|
|
139
|
-
for (let s = 0; s < r; ++s) {
|
|
140
|
-
const a = new Uint32Array(80);
|
|
141
|
-
for (let p = 0; p < 16; ++p)
|
|
142
|
-
a[p] = i[s][p];
|
|
143
|
-
for (let p = 16; p < 80; ++p)
|
|
144
|
-
a[p] = Be(a[p - 3] ^ a[p - 8] ^ a[p - 14] ^ a[p - 16], 1);
|
|
145
|
-
let c = n[0], l = n[1], d = n[2], u = n[3], f = n[4];
|
|
146
|
-
for (let p = 0; p < 80; ++p) {
|
|
147
|
-
const g = Math.floor(p / 20), m = Be(c, 5) + ii(g, l, d, u) + f + t[g] + a[p] >>> 0;
|
|
148
|
-
f = u, u = d, d = Be(l, 30) >>> 0, l = c, c = m;
|
|
149
|
-
}
|
|
150
|
-
n[0] = n[0] + c >>> 0, n[1] = n[1] + l >>> 0, n[2] = n[2] + d >>> 0, n[3] = n[3] + u >>> 0, n[4] = n[4] + f >>> 0;
|
|
151
|
-
}
|
|
152
|
-
return [n[0] >> 24 & 255, n[0] >> 16 & 255, n[0] >> 8 & 255, n[0] & 255, n[1] >> 24 & 255, n[1] >> 16 & 255, n[1] >> 8 & 255, n[1] & 255, n[2] >> 24 & 255, n[2] >> 16 & 255, n[2] >> 8 & 255, n[2] & 255, n[3] >> 24 & 255, n[3] >> 16 & 255, n[3] >> 8 & 255, n[3] & 255, n[4] >> 24 & 255, n[4] >> 16 & 255, n[4] >> 8 & 255, n[4] & 255];
|
|
153
|
-
}
|
|
154
|
-
const ai = ri("v5", 80, si), Tt = /\[\[\s*param\.([A-Za-z0-9_.-]+)\s*\]\]/g, Mt = /\bparam\s*\(\s*(['"])([^'"]+)\1/g;
|
|
155
|
-
function li(e) {
|
|
156
|
-
const t = [];
|
|
157
|
-
let n = 0;
|
|
158
|
-
for (; n < e.length; ) {
|
|
159
|
-
const o = e.indexOf("{{", n), r = e.indexOf("{%", n);
|
|
160
|
-
let i = -1, s = "";
|
|
161
|
-
if (o === -1 ? (i = r, s = "%}") : r === -1 || o < r ? (i = o, s = "}}") : (i = r, s = "%}"), i === -1)
|
|
162
|
-
break;
|
|
163
|
-
const a = e.indexOf(s, i + 2);
|
|
164
|
-
if (a === -1) {
|
|
165
|
-
n = i + 2;
|
|
166
|
-
continue;
|
|
167
|
-
}
|
|
168
|
-
t.push(e.slice(i + 2, a)), n = a + 2;
|
|
169
|
-
}
|
|
170
|
-
return t;
|
|
171
|
-
}
|
|
172
|
-
function bn(e) {
|
|
173
|
-
var o, r;
|
|
174
|
-
if (!e)
|
|
175
|
-
return [];
|
|
176
|
-
const t = /* @__PURE__ */ new Set();
|
|
177
|
-
let n;
|
|
178
|
-
for (Tt.lastIndex = 0; (n = Tt.exec(e)) !== null; ) {
|
|
179
|
-
const i = (o = n[1]) == null ? void 0 : o.trim();
|
|
180
|
-
i && t.add(i);
|
|
181
|
-
}
|
|
182
|
-
for (const i of li(e))
|
|
183
|
-
for (Mt.lastIndex = 0; (n = Mt.exec(i)) !== null; ) {
|
|
184
|
-
const s = (r = n[2]) == null ? void 0 : r.trim();
|
|
185
|
-
s && t.add(s);
|
|
186
|
-
}
|
|
187
|
-
return Array.from(t);
|
|
188
|
-
}
|
|
189
|
-
function Xe(e) {
|
|
190
|
-
const t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Map();
|
|
191
|
-
for (const o of e.controlBindings || [])
|
|
192
|
-
t.add(o.controlId), o.target === "sql_param" && n.set(o.paramId, o.controlId);
|
|
193
|
-
for (const o of bn(e.sql))
|
|
194
|
-
t.add(n.get(o) ?? o);
|
|
195
|
-
return Array.from(t);
|
|
196
|
-
}
|
|
197
|
-
function ci(e) {
|
|
198
|
-
const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
199
|
-
for (const o of e.controlBindings || [])
|
|
200
|
-
o.target === "sql_param" && n.set(o.paramId, o.controlId);
|
|
201
|
-
for (const o of bn(e.sql))
|
|
202
|
-
t.set(o, {
|
|
203
|
-
paramId: o,
|
|
204
|
-
controlId: n.get(o) ?? o
|
|
205
|
-
});
|
|
206
|
-
return Array.from(t.values());
|
|
207
|
-
}
|
|
208
|
-
function di(e, t) {
|
|
209
|
-
var r;
|
|
210
|
-
const n = (r = e.controlBindings) == null ? void 0 : r.map((i) => ({
|
|
211
|
-
...i,
|
|
212
|
-
controlId: t.get(i.controlId) ?? i.controlId
|
|
213
|
-
})), o = ci(e).flatMap(
|
|
214
|
-
({ paramId: i, controlId: s }) => {
|
|
215
|
-
var c;
|
|
216
|
-
const a = t.get(s);
|
|
217
|
-
return !a || a === s || (c = e.controlBindings) != null && c.some(
|
|
218
|
-
(l) => l.target === "sql_param" && l.paramId === i
|
|
219
|
-
) ? [] : [{ target: "sql_param", paramId: i, controlId: a }];
|
|
220
|
-
}
|
|
221
|
-
);
|
|
222
|
-
return o.length ? [...n ?? [], ...o] : n;
|
|
223
|
-
}
|
|
224
|
-
function Cn(e, t) {
|
|
225
|
-
var s, a;
|
|
226
|
-
const n = Oe(e) ?? e, o = n.source === "dashboardInputAlias" ? (s = t.inputAliases) == null ? void 0 : s[n.variableName] : void 0, r = n.source === "dashboardInputAlias" && o ? Oe(o) ?? Oe({ ...o, export: n.export ?? "label" }) ?? n : n, i = n.source === "dashboardInputAlias" && r !== n ? { ...r, export: n.export ?? "label" } : r;
|
|
227
|
-
return i.source === "input" ? {
|
|
228
|
-
...i,
|
|
229
|
-
inputId: ((a = t.inputIds) == null ? void 0 : a[i.inputId]) ?? i.inputId
|
|
230
|
-
} : i;
|
|
231
|
-
}
|
|
232
|
-
function ui(e, t) {
|
|
233
|
-
var r;
|
|
234
|
-
const n = {};
|
|
235
|
-
for (const i of [
|
|
236
|
-
"cardIds",
|
|
237
|
-
"sheetIds",
|
|
238
|
-
"inputIds",
|
|
239
|
-
"controlIds",
|
|
240
|
-
"filterIds"
|
|
241
|
-
]) {
|
|
242
|
-
const s = { ...t[i] };
|
|
243
|
-
for (const [a, c] of Object.entries((e == null ? void 0 : e[i]) ?? {}))
|
|
244
|
-
s[a] = ((r = t[i]) == null ? void 0 : r[c]) ?? c;
|
|
245
|
-
Object.keys(s).length && (n[i] = s);
|
|
246
|
-
}
|
|
247
|
-
const o = { ...t.inputAliases };
|
|
248
|
-
for (const [i, s] of Object.entries((e == null ? void 0 : e.inputAliases) ?? {}))
|
|
249
|
-
o[i] = Cn(s, t);
|
|
250
|
-
return Object.keys(o).length && (n.inputAliases = o), n;
|
|
251
|
-
}
|
|
252
|
-
function fl(e, t) {
|
|
253
|
-
var r, i, s, a;
|
|
254
|
-
const n = he(nn(e));
|
|
255
|
-
n.controlBindings = di(
|
|
256
|
-
e,
|
|
257
|
-
new Map(Object.entries(t.controlIds ?? {}))
|
|
258
|
-
);
|
|
259
|
-
for (const c of n.controls ?? [])
|
|
260
|
-
c.id = ((r = t.controlIds) == null ? void 0 : r[c.id]) ?? c.id;
|
|
261
|
-
for (const c of n.inlineFilters ?? [])
|
|
262
|
-
c.id = ((i = t.filterIds) == null ? void 0 : i[c.id]) ?? c.id;
|
|
263
|
-
const o = (c) => {
|
|
264
|
-
var d, u;
|
|
265
|
-
if (!c || typeof c != "object") return;
|
|
266
|
-
if (Array.isArray(c)) {
|
|
267
|
-
c.forEach(o);
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
const l = c;
|
|
271
|
-
if (Object.assign(
|
|
272
|
-
l,
|
|
273
|
-
on(
|
|
274
|
-
l,
|
|
275
|
-
(f) => f && typeof f == "object" ? Cn(f, t) : f
|
|
276
|
-
)
|
|
277
|
-
), typeof l.entityId == "string") {
|
|
278
|
-
const f = l.entityId;
|
|
279
|
-
l.fieldScope === "card" && (l.entityId = ((d = t.cardIds) == null ? void 0 : d[f]) ?? f), l.fieldScope === "sheet" && (l.entityId = ((u = t.sheetIds) == null ? void 0 : u[f]) ?? f);
|
|
280
|
-
}
|
|
281
|
-
for (const [f, p] of Object.entries(l))
|
|
282
|
-
f !== "linkedReferenceOverrides" && o(p);
|
|
283
|
-
};
|
|
284
|
-
o(n), n.clickToFilter && (n.clickToFilter = mo(n.clickToFilter, t));
|
|
285
|
-
for (const c of Object.values(
|
|
286
|
-
((s = n.customCardPreferences) == null ? void 0 : s.dataInputCardIds) ?? {}
|
|
287
|
-
))
|
|
288
|
-
c.cardId = ((a = t.cardIds) == null ? void 0 : a[c.cardId]) ?? c.cardId;
|
|
289
|
-
return n;
|
|
290
|
-
}
|
|
291
|
-
const fi = "9677efdd-86ec-4afb-b9bb-5ead8b5442af";
|
|
292
|
-
function mi(e) {
|
|
293
|
-
let t = 0;
|
|
294
|
-
return () => ai(`${e}#${t++}`, fi);
|
|
295
|
-
}
|
|
296
|
-
const pi = [
|
|
297
|
-
{ code: "matrix_definition_incomplete", label: "Matrix definition" }
|
|
298
|
-
], gi = [
|
|
299
|
-
{ code: "connection_type_unresolved", label: "Connection type" }
|
|
300
|
-
], ee = (e) => !Array.isArray(e) || e.length === 0;
|
|
301
|
-
function yi(e) {
|
|
302
|
-
var i;
|
|
303
|
-
const t = e.config ?? {};
|
|
304
|
-
if ((i = e.sql) != null && i.trim() || !ee(t.pivotByColumns)) return "matrixTable";
|
|
305
|
-
const n = !ee(t.groupByColumns), o = !ee(t.metricColumns), r = e.type === "pivotTable" && (n || o) && ee(t.rowAggregates) && ee(t.columnAggregates);
|
|
306
|
-
return n && !o || r ? "table" : "matrixTable";
|
|
307
|
-
}
|
|
308
|
-
function bi(e) {
|
|
309
|
-
var r;
|
|
310
|
-
const t = e.dataSource;
|
|
311
|
-
if (!t || (r = t.connectionType) != null && r.trim()) return e;
|
|
312
|
-
const n = yr(Co(t.selectedEntities));
|
|
313
|
-
if (!n) return e;
|
|
314
|
-
const o = Array.isArray(t.selectedEntities) ? t.selectedEntities.map((i) => i && typeof i == "object" && "connectionType" in i && !String(i.connectionType ?? "").trim() ? { ...i, connectionType: n } : i) : t.selectedEntities;
|
|
315
|
-
return { ...e, dataSource: { ...t, connectionType: n, selectedEntities: o } };
|
|
316
|
-
}
|
|
317
|
-
function hn(e) {
|
|
318
|
-
var s, a;
|
|
319
|
-
const t = e;
|
|
320
|
-
if (!po(t)) return { status: "not_legacy", card: e };
|
|
321
|
-
const n = bi(t), o = yi(t) === "table" ? go(n, "table") : yo(n, "matrixTable", { createId: mi(t.id) });
|
|
322
|
-
if (o.status !== "changed") throw new Error(`Card ${t.id} could not leave ${t.type}.`);
|
|
323
|
-
const r = o.card.type === "matrixTable" && bo(o.card).status !== "ready", i = !!n.dataSource && !((a = (s = n.dataSource) == null ? void 0 : s.connectionType) != null && a.trim());
|
|
324
|
-
return {
|
|
325
|
-
status: "routed",
|
|
326
|
-
card: o.card,
|
|
327
|
-
gaps: [
|
|
328
|
-
...o.gaps,
|
|
329
|
-
...r ? pi : [],
|
|
330
|
-
...i ? gi : []
|
|
331
|
-
]
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
function ml(e) {
|
|
335
|
-
if (!e.cards) return e;
|
|
336
|
-
const t = e.cards.map((n) => hn(n).card);
|
|
337
|
-
return t.every((n, o) => n === e.cards[o]) ? e : { ...e, cards: t };
|
|
338
|
-
}
|
|
339
|
-
function Ci(e) {
|
|
340
|
-
const t = [];
|
|
341
|
-
return { dashboard: xr(e, (o, r) => {
|
|
342
|
-
const i = hn(o);
|
|
343
|
-
return i.status === "routed" && i.gaps.length && t.push({ location: r, gaps: i.gaps }), i.card;
|
|
344
|
-
}), routedWithGaps: t };
|
|
345
|
-
}
|
|
346
|
-
function hi(e, t) {
|
|
347
|
-
return e.name === t.name && e.qualifiedEntityName === t.qualifiedEntityName;
|
|
348
|
-
}
|
|
349
|
-
function Ii(e, t, n) {
|
|
350
|
-
var r, i;
|
|
351
|
-
if (n.sortPolicy === "dropUnrelatedSorts") {
|
|
352
|
-
const s = new Set(
|
|
353
|
-
(e.metricColumns || []).map((a) => a.id)
|
|
354
|
-
);
|
|
355
|
-
return {
|
|
356
|
-
...e,
|
|
357
|
-
groupByColumns: [t],
|
|
358
|
-
sortByColumns: (e.sortByColumns || []).filter(
|
|
359
|
-
(a) => a.id === t.id || s.has(a.id)
|
|
360
|
-
)
|
|
361
|
-
};
|
|
362
|
-
}
|
|
363
|
-
const o = (r = e.groupByColumns) == null ? void 0 : r[0];
|
|
364
|
-
return {
|
|
365
|
-
...e,
|
|
366
|
-
groupByColumns: [t],
|
|
367
|
-
sortByColumns: (i = e.sortByColumns) == null ? void 0 : i.map(
|
|
368
|
-
(s) => o && hi(s, o) ? {
|
|
369
|
-
...t,
|
|
370
|
-
role: "sortby",
|
|
371
|
-
direction: s.direction
|
|
372
|
-
} : s
|
|
373
|
-
)
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
|
-
function pl(e) {
|
|
377
|
-
switch (e) {
|
|
378
|
-
case "previous_period":
|
|
379
|
-
return "Previous";
|
|
380
|
-
case "previous_year":
|
|
381
|
-
return "Last Year";
|
|
382
|
-
case "target":
|
|
383
|
-
return "Target";
|
|
384
|
-
default:
|
|
385
|
-
return "Comparison";
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
function In(e, t, n) {
|
|
389
|
-
var o;
|
|
390
|
-
if (((o = n == null ? void 0 : n.output) == null ? void 0 : o.availability.status) === "available" && n.output.comparisonColumnKey)
|
|
391
|
-
return n.output.comparisonColumnKey;
|
|
392
|
-
}
|
|
393
|
-
function vi(e, t) {
|
|
394
|
-
return `${e} Δ`;
|
|
395
|
-
}
|
|
396
|
-
function gl(e, t) {
|
|
397
|
-
return rn(e, t);
|
|
398
|
-
}
|
|
399
|
-
function Fi(e, t) {
|
|
400
|
-
return e.rawKey === t.rawKey && e.outputKey === t.outputKey;
|
|
401
|
-
}
|
|
402
|
-
function vn(e) {
|
|
403
|
-
var a;
|
|
404
|
-
const { card: t, columnKeyMap: n, metricAlias: o, metricId: r } = e;
|
|
405
|
-
if (!(t != null && t.config) || !n || !o || ie(t) !== "config")
|
|
406
|
-
return;
|
|
407
|
-
const i = (a = n.byMetricAlias) == null ? void 0 : a[o];
|
|
408
|
-
if (!i) return;
|
|
409
|
-
const s = (t.config.metricColumns || []).filter((c) => {
|
|
410
|
-
var d;
|
|
411
|
-
if (r && c.id !== r) return !1;
|
|
412
|
-
const l = (d = n.byMetricAlias) == null ? void 0 : d[le(c)];
|
|
413
|
-
return !!(l && Fi(i, l));
|
|
414
|
-
});
|
|
415
|
-
return s.length === 1 ? s[0] : void 0;
|
|
416
|
-
}
|
|
417
|
-
function yl(e, t) {
|
|
418
|
-
return t ? { ...e, config: t } : e;
|
|
419
|
-
}
|
|
420
|
-
function Di(e) {
|
|
421
|
-
return [
|
|
422
|
-
e.alias,
|
|
423
|
-
e.name,
|
|
424
|
-
e.qualifiedFieldName,
|
|
425
|
-
e.id
|
|
426
|
-
].filter((t) => !!t);
|
|
427
|
-
}
|
|
428
|
-
function Z(e) {
|
|
429
|
-
return e != null && e.config ? ie(e) === "config" : !1;
|
|
430
|
-
}
|
|
431
|
-
function Si(e, t, n, o) {
|
|
432
|
-
if (t === -1 || n === -1 || t === n)
|
|
433
|
-
return null;
|
|
434
|
-
const r = [...e], [i] = r.splice(t, 1), s = o === "before" ? n > t ? n - 1 : n : n > t ? n : n + 1;
|
|
435
|
-
return r.splice(s, 0, i), r;
|
|
436
|
-
}
|
|
437
|
-
function Ae(e, t, n) {
|
|
438
|
-
if (!(e != null && e.length)) return null;
|
|
439
|
-
const o = e.findIndex(
|
|
440
|
-
(i) => n(i).includes(t.draggingColumnId)
|
|
441
|
-
), r = e.findIndex(
|
|
442
|
-
(i) => n(i).includes(t.targetColumnId)
|
|
443
|
-
);
|
|
444
|
-
return Si(e, o, r, t.side);
|
|
445
|
-
}
|
|
446
|
-
function Ee(e, t, n) {
|
|
447
|
-
return n ? {
|
|
448
|
-
...e ?? {},
|
|
449
|
-
[t]: n
|
|
450
|
-
} : null;
|
|
451
|
-
}
|
|
452
|
-
function bl(e, t, n) {
|
|
453
|
-
if (!Z(e) || !n) return null;
|
|
454
|
-
const o = e.config;
|
|
455
|
-
return e.type === "detailTable" ? Ee(
|
|
456
|
-
o,
|
|
457
|
-
"detailColumns",
|
|
458
|
-
Ae(
|
|
459
|
-
o == null ? void 0 : o.detailColumns,
|
|
460
|
-
t,
|
|
461
|
-
(r) => ge(r, "detail", n)
|
|
462
|
-
)
|
|
463
|
-
) : Ee(
|
|
464
|
-
o,
|
|
465
|
-
"groupByColumns",
|
|
466
|
-
Ae(
|
|
467
|
-
o == null ? void 0 : o.groupByColumns,
|
|
468
|
-
t,
|
|
469
|
-
(r) => ge(r, "groupby", n)
|
|
470
|
-
)
|
|
471
|
-
) ?? Ee(
|
|
472
|
-
o,
|
|
473
|
-
"metricColumns",
|
|
474
|
-
Ae(
|
|
475
|
-
o == null ? void 0 : o.metricColumns,
|
|
476
|
-
t,
|
|
477
|
-
(r) => ge(r, "metric", n)
|
|
478
|
-
)
|
|
479
|
-
);
|
|
480
|
-
}
|
|
481
|
-
function Ti(e) {
|
|
482
|
-
var t, n, o, r, i, s;
|
|
483
|
-
return Z(e) ? e.type === "detailTable" ? !!((n = (t = e.config) == null ? void 0 : t.detailColumns) != null && n.length) : !!((r = (o = e.config) == null ? void 0 : o.groupByColumns) != null && r.length || (s = (i = e.config) == null ? void 0 : i.metricColumns) != null && s.length) : !1;
|
|
484
|
-
}
|
|
485
|
-
function Cl(e, t) {
|
|
486
|
-
return Ti(e) && !!t;
|
|
487
|
-
}
|
|
488
|
-
function ge(e, t, n) {
|
|
489
|
-
if (!n) return [];
|
|
490
|
-
const o = t === "metric" ? [
|
|
491
|
-
le(e),
|
|
492
|
-
e.alias
|
|
493
|
-
].filter((i) => !!i).flatMap((i) => {
|
|
494
|
-
var a;
|
|
495
|
-
const s = (a = n.byMetricAlias) == null ? void 0 : a[i];
|
|
496
|
-
return s ? [s] : [];
|
|
497
|
-
}) : [], r = Wr(
|
|
498
|
-
n,
|
|
499
|
-
e.id,
|
|
500
|
-
t
|
|
501
|
-
);
|
|
502
|
-
return [...o, r].flatMap((i) => [i == null ? void 0 : i.outputKey, i == null ? void 0 : i.rawKey]).filter((i) => !!i);
|
|
503
|
-
}
|
|
504
|
-
function ce(e, t, n, o) {
|
|
505
|
-
const r = ge(
|
|
506
|
-
e,
|
|
507
|
-
t,
|
|
508
|
-
o
|
|
509
|
-
);
|
|
510
|
-
return o ? r.find(
|
|
511
|
-
(i) => n.includes(i)
|
|
512
|
-
) : Di(e).find(
|
|
513
|
-
(i) => n.includes(i)
|
|
514
|
-
);
|
|
515
|
-
}
|
|
516
|
-
function Fn(e, t, n) {
|
|
517
|
-
if (!Z(t) || !n)
|
|
518
|
-
return;
|
|
519
|
-
const o = t.type === "detailTable" ? [{ role: "detail", fields: t.config.detailColumns }] : [
|
|
520
|
-
{ role: "groupby", fields: t.config.groupByColumns },
|
|
521
|
-
{ role: "metric", fields: t.config.metricColumns }
|
|
522
|
-
];
|
|
523
|
-
for (const { role: r, fields: i } of o)
|
|
524
|
-
for (const s of i || [])
|
|
525
|
-
if (ce(
|
|
526
|
-
s,
|
|
527
|
-
r,
|
|
528
|
-
[e],
|
|
529
|
-
n
|
|
530
|
-
) === e && typeof s.label == "string" && s.label.length > 0)
|
|
531
|
-
return s.label;
|
|
532
|
-
}
|
|
533
|
-
function Mi(e, t) {
|
|
534
|
-
if (!e) return;
|
|
535
|
-
const n = JSON.stringify(t), o = t.every((r) => r !== null) ? t.join("__") : void 0;
|
|
536
|
-
return e[n] || (o ? e[o] : void 0);
|
|
537
|
-
}
|
|
538
|
-
function Vi(e, t, n) {
|
|
539
|
-
if (!e) return;
|
|
540
|
-
let o = e, r = !1;
|
|
541
|
-
return t.forEach((i, s) => {
|
|
542
|
-
const a = n[s] ?? "";
|
|
543
|
-
[
|
|
544
|
-
i.entityName ? `{{${i.entityName}.${i.name}}}` : void 0,
|
|
545
|
-
`{{${i.name}}}`
|
|
546
|
-
].filter((l) => !!l).forEach((l) => {
|
|
547
|
-
o.includes(l) && (o = o.split(l).join(a), r = !0);
|
|
548
|
-
});
|
|
549
|
-
}), r && o.trim() ? o : void 0;
|
|
550
|
-
}
|
|
551
|
-
function ki(e) {
|
|
552
|
-
const t = (e.card.config.metricColumns || []).filter(
|
|
553
|
-
(n) => n.id === e.metricId && le(n) === e.metricAlias
|
|
554
|
-
);
|
|
555
|
-
return t.length === 1 ? t[0] : vn({
|
|
556
|
-
card: e.card,
|
|
557
|
-
columnKeyMap: e.columnKeyMap,
|
|
558
|
-
metricAlias: e.metricAlias,
|
|
559
|
-
metricId: e.metricId
|
|
560
|
-
});
|
|
561
|
-
}
|
|
562
|
-
function et(e) {
|
|
563
|
-
var s;
|
|
564
|
-
const t = (s = e.resultColumn) == null ? void 0 : s.pivotIdentity, n = e.card.config.pivotByColumns || [];
|
|
565
|
-
if (!t || n.length === 0 || t.members.length !== n.length || t.members.some(
|
|
566
|
-
(a, c) => {
|
|
567
|
-
var l;
|
|
568
|
-
return a.fieldId !== ((l = n[c]) == null ? void 0 : l.id);
|
|
569
|
-
}
|
|
570
|
-
))
|
|
571
|
-
return;
|
|
572
|
-
const o = e.card.config.metricColumns || [], r = ki({
|
|
573
|
-
card: e.card,
|
|
574
|
-
columnKeyMap: e.columnKeyMap,
|
|
575
|
-
metricId: t.metricId,
|
|
576
|
-
metricAlias: t.metricAlias
|
|
577
|
-
}), i = o.length === 0 && t.metricId === Ze;
|
|
578
|
-
if (!(!r && !i))
|
|
579
|
-
return {
|
|
580
|
-
resultColumn: e.resultColumn,
|
|
581
|
-
identity: t,
|
|
582
|
-
pivotFields: n,
|
|
583
|
-
authoredMetrics: o,
|
|
584
|
-
authoredMetric: r
|
|
585
|
-
};
|
|
586
|
-
}
|
|
587
|
-
function Pi(e) {
|
|
588
|
-
const {
|
|
589
|
-
columnId: t,
|
|
590
|
-
card: n,
|
|
591
|
-
columnKeyMap: o,
|
|
592
|
-
resultColumns: r,
|
|
593
|
-
temporalPresentation: i,
|
|
594
|
-
metricLabelOverride: s
|
|
595
|
-
} = e;
|
|
596
|
-
if (!Z(n) || n.type !== "table")
|
|
597
|
-
return;
|
|
598
|
-
const a = et({
|
|
599
|
-
resultColumn: r == null ? void 0 : r.find((I) => I.key === t),
|
|
600
|
-
card: n,
|
|
601
|
-
columnKeyMap: o
|
|
602
|
-
});
|
|
603
|
-
if (!a) return;
|
|
604
|
-
const { identity: c, pivotFields: l, authoredMetrics: d, authoredMetric: u } = a, p = Jr({
|
|
605
|
-
members: c.members,
|
|
606
|
-
resolveTemporalFormat: (I) => {
|
|
607
|
-
var v;
|
|
608
|
-
return (v = ho({
|
|
609
|
-
presentation: i,
|
|
610
|
-
fieldId: I,
|
|
611
|
-
role: "pivotby"
|
|
612
|
-
})) == null ? void 0 : v.resolved.format;
|
|
613
|
-
}
|
|
614
|
-
}).memberLabels.map(
|
|
615
|
-
(I) => I || "(Blank)"
|
|
616
|
-
), g = c.members.map((I) => I.value), m = Mi(u == null ? void 0 : u.valueAliases, g) || Vi(
|
|
617
|
-
u == null ? void 0 : u.aliasTemplate,
|
|
618
|
-
l,
|
|
619
|
-
p
|
|
620
|
-
), y = m ? [m] : p, b = s || (d.length > 1 ? (u == null ? void 0 : u.label) || (u == null ? void 0 : u.name) : void 0);
|
|
621
|
-
return [...y, ...b ? [b] : []].join(" / ");
|
|
622
|
-
}
|
|
623
|
-
function H(e, t, n, o) {
|
|
624
|
-
return e != null && e.length ? e.map(
|
|
625
|
-
(r) => ce(
|
|
626
|
-
r,
|
|
627
|
-
n,
|
|
628
|
-
t,
|
|
629
|
-
o
|
|
630
|
-
)
|
|
631
|
-
).filter((r) => !!r) : [];
|
|
632
|
-
}
|
|
633
|
-
function Vt(e, t, n, o) {
|
|
634
|
-
if (!Z(t) || !o) return e;
|
|
635
|
-
const r = [], i = (s) => {
|
|
636
|
-
s && e.includes(s) && !r.includes(s) && r.push(s);
|
|
637
|
-
};
|
|
638
|
-
return t.type === "detailTable" ? H(
|
|
639
|
-
t.config.detailColumns,
|
|
640
|
-
e,
|
|
641
|
-
"detail",
|
|
642
|
-
o
|
|
643
|
-
).forEach(i) : (H(
|
|
644
|
-
t.config.groupByColumns,
|
|
645
|
-
e,
|
|
646
|
-
"groupby",
|
|
647
|
-
o
|
|
648
|
-
).forEach(i), H(
|
|
649
|
-
t.config.metricColumns,
|
|
650
|
-
e,
|
|
651
|
-
"metric",
|
|
652
|
-
o
|
|
653
|
-
).forEach((s) => {
|
|
654
|
-
i(s), i(n == null ? void 0 : n(s));
|
|
655
|
-
})), e.forEach(i), r;
|
|
656
|
-
}
|
|
657
|
-
function xi(e, t) {
|
|
658
|
-
var f, p, g;
|
|
659
|
-
const { keys: n, card: o, columnKeyMap: r, resultColumns: i } = e;
|
|
660
|
-
if (!((f = o.config.pivotByColumns) != null && f.length)) return null;
|
|
661
|
-
if (!r || !(i != null && i.length)) return [...n];
|
|
662
|
-
const s = n.every(
|
|
663
|
-
(m) => i.some((y) => y.key === m)
|
|
664
|
-
), a = [
|
|
665
|
-
...H(
|
|
666
|
-
o.config.groupByColumns,
|
|
667
|
-
n,
|
|
668
|
-
"groupby",
|
|
669
|
-
r
|
|
670
|
-
),
|
|
671
|
-
...H(
|
|
672
|
-
o.config.metricColumns,
|
|
673
|
-
n,
|
|
674
|
-
"metric",
|
|
675
|
-
r
|
|
676
|
-
)
|
|
677
|
-
].length === (((p = o.config.groupByColumns) == null ? void 0 : p.length) || 0) + (((g = o.config.metricColumns) == null ? void 0 : g.length) || 0);
|
|
678
|
-
if (!s || !a)
|
|
679
|
-
return [...n];
|
|
680
|
-
const c = i.filter(
|
|
681
|
-
(m) => m.pivotIdentity && n.includes(m.key)
|
|
682
|
-
);
|
|
683
|
-
if (c.some(
|
|
684
|
-
(m) => !et({
|
|
685
|
-
resultColumn: m,
|
|
686
|
-
card: o,
|
|
687
|
-
columnKeyMap: r
|
|
688
|
-
})
|
|
689
|
-
))
|
|
690
|
-
return [...n];
|
|
691
|
-
const l = c.map((m) => m.key);
|
|
692
|
-
if (l.length === 0) return [...n];
|
|
693
|
-
const d = [], u = (m) => {
|
|
694
|
-
m && n.includes(m) && !d.includes(m) && d.push(m);
|
|
695
|
-
};
|
|
696
|
-
return H(
|
|
697
|
-
o.config.groupByColumns,
|
|
698
|
-
n,
|
|
699
|
-
"groupby",
|
|
700
|
-
r
|
|
701
|
-
).forEach(u), l.forEach(u), H(
|
|
702
|
-
o.config.metricColumns,
|
|
703
|
-
n,
|
|
704
|
-
"metric",
|
|
705
|
-
r
|
|
706
|
-
).forEach((m) => {
|
|
707
|
-
u(m), u(t(m));
|
|
708
|
-
}), n.forEach(u), d;
|
|
709
|
-
}
|
|
710
|
-
function wi(e) {
|
|
711
|
-
var c;
|
|
712
|
-
const { keys: t, card: n, comparisonMetadata: o, columnKeyMap: r, resultColumns: i } = e;
|
|
713
|
-
if ((n == null ? void 0 : n.type) !== "table")
|
|
714
|
-
return Vt(
|
|
715
|
-
t,
|
|
716
|
-
n,
|
|
717
|
-
void 0,
|
|
718
|
-
r
|
|
719
|
-
);
|
|
720
|
-
const s = /* @__PURE__ */ new Map();
|
|
721
|
-
(((c = n.config) == null ? void 0 : c.metricColumns) || []).forEach((l) => {
|
|
722
|
-
const { comparisonKind: d, metadata: u } = sn(o, l);
|
|
723
|
-
if (d === "none") return;
|
|
724
|
-
const f = l.label || l.name, p = ce(
|
|
725
|
-
l,
|
|
726
|
-
"metric",
|
|
727
|
-
t,
|
|
728
|
-
r
|
|
729
|
-
);
|
|
730
|
-
if (!p) return;
|
|
731
|
-
const g = In(
|
|
732
|
-
f,
|
|
733
|
-
d,
|
|
734
|
-
u
|
|
735
|
-
);
|
|
736
|
-
g && s.set(p, g);
|
|
737
|
-
});
|
|
738
|
-
const a = (l) => s.get(l) ?? null;
|
|
739
|
-
if (Z(n)) {
|
|
740
|
-
const l = xi(
|
|
741
|
-
{ keys: t, card: n, columnKeyMap: r, resultColumns: i },
|
|
742
|
-
a
|
|
743
|
-
);
|
|
744
|
-
if (l) return l;
|
|
745
|
-
}
|
|
746
|
-
return Vt(
|
|
747
|
-
t,
|
|
748
|
-
n,
|
|
749
|
-
a,
|
|
750
|
-
r
|
|
751
|
-
);
|
|
752
|
-
}
|
|
753
|
-
function Ie(e) {
|
|
754
|
-
return e == null ? void 0 : e.map(
|
|
755
|
-
({
|
|
756
|
-
format: t,
|
|
757
|
-
formatOrigin: n,
|
|
758
|
-
semanticTemporalPresentation: o,
|
|
759
|
-
...r
|
|
760
|
-
}) => r
|
|
761
|
-
);
|
|
762
|
-
}
|
|
763
|
-
function ve(e) {
|
|
764
|
-
if (!e)
|
|
765
|
-
return;
|
|
766
|
-
const {
|
|
767
|
-
format: t,
|
|
768
|
-
formatOrigin: n,
|
|
769
|
-
semanticTemporalPresentation: o,
|
|
770
|
-
...r
|
|
771
|
-
} = e;
|
|
772
|
-
return oe(r);
|
|
773
|
-
}
|
|
774
|
-
function Dn(e, t) {
|
|
775
|
-
return e == null ? void 0 : e.map(
|
|
776
|
-
(n) => Nt(oe(Ie([n])[0]), n.format, t)
|
|
777
|
-
);
|
|
778
|
-
}
|
|
779
|
-
function Oi(e, t) {
|
|
780
|
-
return e == null ? void 0 : e.map(
|
|
781
|
-
(n) => Io(oe(Ie([n])[0]), n.format, t)
|
|
782
|
-
);
|
|
783
|
-
}
|
|
784
|
-
function Bi(e, t) {
|
|
785
|
-
const { dateFormat: n, customFormat: o, ...r } = ve(e.field);
|
|
786
|
-
return {
|
|
787
|
-
...e,
|
|
788
|
-
field: t ? r : Nt(ve(e.field), e.field.format, "raw")
|
|
789
|
-
};
|
|
790
|
-
}
|
|
791
|
-
function Pe(e, t = !1) {
|
|
792
|
-
if (e)
|
|
793
|
-
return {
|
|
794
|
-
...e,
|
|
795
|
-
conditions: e.conditions.map((n) => Bi(n, t)),
|
|
796
|
-
groups: e.groups.map((n) => Pe(n, t))
|
|
797
|
-
};
|
|
798
|
-
}
|
|
799
|
-
function oe(e) {
|
|
800
|
-
var n, o;
|
|
801
|
-
const t = { ...e };
|
|
802
|
-
return (n = t.calculatedFormula) != null && n.inputFields && (t.calculatedFormula = {
|
|
803
|
-
...t.calculatedFormula,
|
|
804
|
-
inputFields: t.calculatedFormula.inputFields.map(
|
|
805
|
-
(r) => ve(r)
|
|
806
|
-
)
|
|
807
|
-
}), (o = t.parameters) != null && o.filters && (t.parameters = {
|
|
808
|
-
...t.parameters,
|
|
809
|
-
filters: Pe(t.parameters.filters)
|
|
810
|
-
}), t;
|
|
811
|
-
}
|
|
812
|
-
function Ai(e, t) {
|
|
813
|
-
return t.cardType === "detailTable" || !vo(t.cardType) || t.temporalResultOwner !== "config" ? Dn(e, "grouped") : e == null ? void 0 : e.map((n) => {
|
|
814
|
-
const o = Fo(n), r = ve(o ?? n);
|
|
815
|
-
if (!o)
|
|
816
|
-
return r;
|
|
817
|
-
const { dateFormat: i, customFormat: s, ...a } = r;
|
|
818
|
-
return a;
|
|
819
|
-
});
|
|
820
|
-
}
|
|
821
|
-
function Sn(e, t) {
|
|
822
|
-
if (!e)
|
|
823
|
-
return;
|
|
824
|
-
const n = { type: t.cardType, config: e };
|
|
825
|
-
return ze(n) ? Ei(n, t) : e.matrix === void 0 ? {} : { matrix: e.matrix };
|
|
826
|
-
}
|
|
827
|
-
function Ei(e, t = {}) {
|
|
828
|
-
var i, s, a;
|
|
829
|
-
const n = e.config;
|
|
830
|
-
if (!n) return;
|
|
831
|
-
const o = { ...t, cardType: e.type };
|
|
832
|
-
return {
|
|
833
|
-
...n,
|
|
834
|
-
groupByColumns: Ai(n.groupByColumns, o),
|
|
835
|
-
metricColumns: (i = Ie(n.metricColumns)) == null ? void 0 : i.map(
|
|
836
|
-
oe
|
|
837
|
-
),
|
|
838
|
-
pivotByColumns: Dn(n.pivotByColumns, "grouped"),
|
|
839
|
-
sortByColumns: (s = Ie(n.sortByColumns)) == null ? void 0 : s.map(
|
|
840
|
-
oe
|
|
841
|
-
),
|
|
842
|
-
detailColumns: Oi(n.detailColumns, (a = o.dataSource) == null ? void 0 : a.connectionType),
|
|
843
|
-
filters: Pe(n.filters)
|
|
844
|
-
};
|
|
845
|
-
}
|
|
846
|
-
function Fe(e) {
|
|
847
|
-
return (e == null ? void 0 : e.type) === "number" || (e == null ? void 0 : e.type) === "currency";
|
|
848
|
-
}
|
|
849
|
-
function _i(e) {
|
|
850
|
-
return (e == null ? void 0 : e.type) === "number";
|
|
851
|
-
}
|
|
852
|
-
function Ri(e) {
|
|
853
|
-
var n;
|
|
854
|
-
if (!_i(e))
|
|
855
|
-
return !1;
|
|
856
|
-
const t = (n = e == null ? void 0 : e.numberFormat) == null ? void 0 : n.style;
|
|
857
|
-
return t === void 0 || t === "decimal" || t === "currency";
|
|
858
|
-
}
|
|
859
|
-
function Ki(e, t) {
|
|
860
|
-
const n = t == null ? void 0 : t.type;
|
|
861
|
-
if (n && n !== "none" && n !== "number")
|
|
862
|
-
return { currencyBindable: !1 };
|
|
863
|
-
const o = n === "number" ? t != null && t.numberFormat ? So(t.numberFormat, {
|
|
864
|
-
preserveOmittedProperties: !0
|
|
865
|
-
}) : { type: "number" } : void 0, r = Ce(e.format, {
|
|
866
|
-
preserveOmittedProperties: !0
|
|
867
|
-
}), i = se(e.dataType) === "number" ? { type: "number" } : void 0, a = (t == null ? void 0 : t.inheritMetricFormat) === !1 || !!(t != null && t.numberFormat) && (t == null ? void 0 : t.inheritMetricFormat) !== !0 ? o : r || i || o;
|
|
868
|
-
return {
|
|
869
|
-
authoredFormat: a,
|
|
870
|
-
currencyBindable: Fe(a)
|
|
871
|
-
};
|
|
872
|
-
}
|
|
873
|
-
function qi(e, t) {
|
|
874
|
-
const n = Ce(t.format, {
|
|
875
|
-
preserveOmittedProperties: !0
|
|
876
|
-
}), o = se(t.dataType) === "number" ? { type: "number" } : void 0, r = n || o;
|
|
877
|
-
return {
|
|
878
|
-
authoredFormat: r,
|
|
879
|
-
source: n ? "semantic" : o ? "inferred" : void 0,
|
|
880
|
-
currencyBindable: Fe(r)
|
|
881
|
-
};
|
|
882
|
-
}
|
|
883
|
-
function qe(e, t = {}) {
|
|
884
|
-
var c, l, d;
|
|
885
|
-
const n = t.column ?? ((c = Do(e)) == null ? void 0 : c.value);
|
|
886
|
-
if ((n == null ? void 0 : n.kind) === "sqlKpiValue") {
|
|
887
|
-
const u = t.resultColumnKey ? {
|
|
888
|
-
kind: "column",
|
|
889
|
-
columnKey: t.resultColumnKey
|
|
890
|
-
} : void 0, f = Ce(
|
|
891
|
-
Mr({ card: e, column: { kind: "sqlKpiValue" }, surface: "kpiValue" }).format,
|
|
892
|
-
{ preserveOmittedProperties: !0 }
|
|
893
|
-
);
|
|
894
|
-
return {
|
|
895
|
-
target: u,
|
|
896
|
-
authoredFormat: f,
|
|
897
|
-
...f ? { source: "stored" } : {},
|
|
898
|
-
currencyBindable: !!u && Fe(f)
|
|
899
|
-
};
|
|
900
|
-
}
|
|
901
|
-
const o = n ? (d = (l = e.config) == null ? void 0 : l.metricColumns) == null ? void 0 : d.find((u) => u.id === n.fieldId) : void 0, r = o != null && o.id ? {
|
|
902
|
-
kind: "metric",
|
|
903
|
-
metricId: o.id
|
|
904
|
-
} : void 0, i = Ce(o == null ? void 0 : o.format, {
|
|
905
|
-
preserveOmittedProperties: !0
|
|
906
|
-
}), s = se(o == null ? void 0 : o.dataType) === "number" ? { type: "number" } : void 0, a = i || s;
|
|
907
|
-
return {
|
|
908
|
-
target: r,
|
|
909
|
-
authoredFormat: a,
|
|
910
|
-
...i ? { source: "stored" } : s ? { source: "inferred" } : {},
|
|
911
|
-
currencyBindable: Lt(e.type) && !!r && Fe(a)
|
|
912
|
-
};
|
|
913
|
-
}
|
|
914
|
-
function Tn(e, t, n) {
|
|
915
|
-
var r;
|
|
916
|
-
const o = n(e, t);
|
|
917
|
-
return ((r = e.derivedField) == null ? void 0 : r.format) ?? (o == null ? void 0 : o.format) ?? (o == null ? void 0 : o.resolvedField.format);
|
|
918
|
-
}
|
|
919
|
-
function Mn(e, t, n) {
|
|
920
|
-
return e.kind === "calculated" ? e.definition.format : Tn(e.field, t, n);
|
|
921
|
-
}
|
|
922
|
-
function hl(e, t) {
|
|
923
|
-
const n = jt(t), o = (r, i) => Object.fromEntries(r.flatMap((s) => {
|
|
924
|
-
const a = i(s);
|
|
925
|
-
return a ? [[s.id, a]] : [];
|
|
926
|
-
}));
|
|
927
|
-
return {
|
|
928
|
-
measureFormats: o(e.measures, (r) => Mn(r, e.source, n)),
|
|
929
|
-
levelFormats: o([...e.rows, ...e.columns], (r) => Tn(r.field, e.source, n))
|
|
930
|
-
};
|
|
931
|
-
}
|
|
932
|
-
function Vn(e, t = []) {
|
|
933
|
-
const n = Ge(e);
|
|
934
|
-
if (n.status !== "ready") return [];
|
|
935
|
-
const { spec: o, presentation: r } = n.config, i = jt(t);
|
|
936
|
-
return o.measures.map((s) => {
|
|
937
|
-
var p;
|
|
938
|
-
const a = s.kind === "aggregate" ? i(s.field, o.source) : void 0, c = Vr(r.measureFormats[s.id], Mn(s, o.source, i)), l = s.kind === "calculated" ? s.definition.dataType : ["MIN", "MAX"].includes(s.aggregate) ? ((p = s.field.derivedField) == null ? void 0 : p.dataType) ?? (a == null ? void 0 : a.resolvedField.dataType) ?? s.field.dataType : "number", d = se(l) === "number", u = s.kind === "calculated" || !!(a || s.field.derivedField || s.field.name === "*"), f = c && kr(c) ? c : !c && d && u ? { type: "number" } : void 0;
|
|
939
|
-
return { measureId: s.id, label: Pr(s, r), canonical: f };
|
|
940
|
-
});
|
|
941
|
-
}
|
|
942
|
-
function Ni(e) {
|
|
943
|
-
var t, n;
|
|
944
|
-
return e.type === "detailTable" ? ((t = e.config) == null ? void 0 : t.detailColumns) || [] : ((n = e.config) == null ? void 0 : n.metricColumns) || [];
|
|
945
|
-
}
|
|
946
|
-
function kn(e) {
|
|
947
|
-
return new Set(
|
|
948
|
-
an(e).flatMap(
|
|
949
|
-
(t) => (t.controlBindings || []).filter(Te).map((n) => n.controlId)
|
|
950
|
-
)
|
|
951
|
-
);
|
|
952
|
-
}
|
|
953
|
-
function Li(e, t) {
|
|
954
|
-
const n = [
|
|
955
|
-
t.id,
|
|
956
|
-
t.alias,
|
|
957
|
-
t.label,
|
|
958
|
-
t.name,
|
|
959
|
-
t.qualifiedFieldName
|
|
960
|
-
].filter((i) => !!i);
|
|
961
|
-
for (const i of n)
|
|
962
|
-
if (e[i])
|
|
963
|
-
return e[i];
|
|
964
|
-
const o = new Set(
|
|
965
|
-
n.map((i) => i.trim().toLowerCase())
|
|
966
|
-
), r = Object.entries(e).find(
|
|
967
|
-
([i]) => o.has(i.trim().toLowerCase())
|
|
968
|
-
);
|
|
969
|
-
return r == null ? void 0 : r[1];
|
|
970
|
-
}
|
|
971
|
-
function kt(e) {
|
|
972
|
-
return [
|
|
973
|
-
...new Map(
|
|
974
|
-
e.map((t) => [
|
|
975
|
-
W(t),
|
|
976
|
-
t
|
|
977
|
-
])
|
|
978
|
-
).values()
|
|
979
|
-
];
|
|
980
|
-
}
|
|
981
|
-
function ji(e, t = [], n) {
|
|
982
|
-
var M;
|
|
983
|
-
const o = !!((M = e.sql) != null && M.trim()), r = Lt(e.type), i = o && r && e.type !== "kpi" && e.type !== "matrixTable", s = Ni(e), a = To(e), c = !o && e.type === "kpi" ? s.map(
|
|
984
|
-
(h) => qe(e, {
|
|
985
|
-
column: { kind: "field", fieldId: h.id }
|
|
986
|
-
})
|
|
987
|
-
) : [], l = !o && e.type === "matrixTable" ? Vn(e, n) : [], d = (o ? [] : s).map(
|
|
988
|
-
(h) => ({
|
|
989
|
-
kind: "metric",
|
|
990
|
-
metricId: h.id
|
|
991
|
-
})
|
|
992
|
-
), u = l.map(
|
|
993
|
-
(h) => ({
|
|
994
|
-
kind: "matrix_measure",
|
|
995
|
-
measureId: h.measureId
|
|
996
|
-
})
|
|
997
|
-
), f = l.filter((h) => {
|
|
998
|
-
var w, B;
|
|
999
|
-
return ((w = h.canonical) == null ? void 0 : w.type) === "number" || ((B = h.canonical) == null ? void 0 : B.type) === "currency";
|
|
1000
|
-
}).map(
|
|
1001
|
-
(h) => ({
|
|
1002
|
-
kind: "matrix_measure",
|
|
1003
|
-
measureId: h.measureId
|
|
1004
|
-
})
|
|
1005
|
-
), p = e.type === "matrixTable" ? [] : e.type === "kpi" ? c.filter((h) => h.currencyBindable).flatMap(
|
|
1006
|
-
(h) => h.target ? [h.target] : []
|
|
1007
|
-
) : (o || !r ? [] : s).filter(
|
|
1008
|
-
(h) => (Mo(e.type) ? Ki(
|
|
1009
|
-
h,
|
|
1010
|
-
Li(a, h)
|
|
1011
|
-
) : qi(e, h)).currencyBindable
|
|
1012
|
-
).map(
|
|
1013
|
-
(h) => ({
|
|
1014
|
-
kind: "metric",
|
|
1015
|
-
metricId: h.id
|
|
1016
|
-
})
|
|
1017
|
-
), g = [...new Set(t)], m = (i ? g : []).map(
|
|
1018
|
-
(h) => ({
|
|
1019
|
-
kind: "column",
|
|
1020
|
-
columnKey: h
|
|
1021
|
-
})
|
|
1022
|
-
), y = (i ? g : []).filter(
|
|
1023
|
-
(h) => Ri(
|
|
1024
|
-
a[h]
|
|
1025
|
-
)
|
|
1026
|
-
).map(
|
|
1027
|
-
(h) => ({
|
|
1028
|
-
kind: "column",
|
|
1029
|
-
columnKey: h
|
|
1030
|
-
})
|
|
1031
|
-
), b = (o && e.type === "kpi" ? g.slice(0, 1) : []).map(
|
|
1032
|
-
(h) => ({
|
|
1033
|
-
kind: "column",
|
|
1034
|
-
columnKey: h
|
|
1035
|
-
})
|
|
1036
|
-
), I = o && e.type === "kpi" ? qe(e, {
|
|
1037
|
-
resultColumnKey: g[0]
|
|
1038
|
-
}) : void 0, v = r && (I != null && I.currencyBindable) ? b : [];
|
|
1039
|
-
return {
|
|
1040
|
-
knownTargets: kt([
|
|
1041
|
-
...e.type === "matrixTable" ? u : d,
|
|
1042
|
-
...m,
|
|
1043
|
-
...b
|
|
1044
|
-
]),
|
|
1045
|
-
eligibleTargets: kt([
|
|
1046
|
-
...p,
|
|
1047
|
-
...f,
|
|
1048
|
-
...y,
|
|
1049
|
-
...v
|
|
1050
|
-
])
|
|
1051
|
-
};
|
|
1052
|
-
}
|
|
1053
|
-
function Il(e, t) {
|
|
1054
|
-
const n = qe(e, {
|
|
1055
|
-
resultColumnKey: t
|
|
1056
|
-
});
|
|
1057
|
-
return n.currencyBindable ? n.target : void 0;
|
|
1058
|
-
}
|
|
1059
|
-
function vl(e) {
|
|
1060
|
-
var t;
|
|
1061
|
-
return (t = e.card.sql) != null && t.trim() ? { kind: "column", columnKey: e.columnKey } : e.metricId ? { kind: "metric", metricId: e.metricId } : void 0;
|
|
1062
|
-
}
|
|
1063
|
-
function W(e) {
|
|
1064
|
-
return e.kind === "metric" ? `metric:${e.metricId}` : e.kind === "column" ? `column:${e.columnKey}` : `matrix_measure:${e.measureId}`;
|
|
1065
|
-
}
|
|
1066
|
-
function zi(e) {
|
|
1067
|
-
if (!e || typeof e != "object" || Array.isArray(e))
|
|
1068
|
-
return;
|
|
1069
|
-
const t = e;
|
|
1070
|
-
if (t.kind === "metric" && typeof t.metricId == "string" && t.metricId.trim())
|
|
1071
|
-
return { kind: "metric", metricId: t.metricId };
|
|
1072
|
-
if (t.kind === "column" && typeof t.columnKey == "string" && t.columnKey.trim())
|
|
1073
|
-
return { kind: "column", columnKey: t.columnKey };
|
|
1074
|
-
if (t.kind === "matrix_measure" && typeof t.measureId == "string" && t.measureId.trim())
|
|
1075
|
-
return { kind: "matrix_measure", measureId: t.measureId };
|
|
1076
|
-
}
|
|
1077
|
-
function Pt(e) {
|
|
1078
|
-
const t = tn(e);
|
|
1079
|
-
return typeof e == "string" && e === t ? t : void 0;
|
|
1080
|
-
}
|
|
1081
|
-
function Pn(e) {
|
|
1082
|
-
if (e.type !== "enum" || e.source.kind !== "manual")
|
|
1083
|
-
return { diagnostic: "invalid_control_type" };
|
|
1084
|
-
const t = e.source.options.map(
|
|
1085
|
-
(n) => Pt(n.value)
|
|
1086
|
-
);
|
|
1087
|
-
if (t.length === 0 || t.some((n) => !n))
|
|
1088
|
-
return { diagnostic: "invalid_currency_option" };
|
|
1089
|
-
if (e.requiredAtExecution) {
|
|
1090
|
-
const n = e.initialValueStrategy === "saved_default" ? Pt(e.defaultValue) : void 0;
|
|
1091
|
-
if (!n || !t.includes(n))
|
|
1092
|
-
return { diagnostic: "invalid_control_default" };
|
|
1093
|
-
}
|
|
1094
|
-
return {
|
|
1095
|
-
control: e,
|
|
1096
|
-
currencies: t
|
|
1097
|
-
};
|
|
1098
|
-
}
|
|
1099
|
-
function Fl(e) {
|
|
1100
|
-
return "control" in Pn(e);
|
|
1101
|
-
}
|
|
1102
|
-
function xn(e) {
|
|
1103
|
-
const t = kn(e.dashboard);
|
|
1104
|
-
if (t.size === 0)
|
|
1105
|
-
return {
|
|
1106
|
-
definitions: e.definitions || [],
|
|
1107
|
-
values: e.values || {}
|
|
1108
|
-
};
|
|
1109
|
-
const n = new Set(
|
|
1110
|
-
[...t].filter(
|
|
1111
|
-
(o) => !e.referencedControlIds.has(o)
|
|
1112
|
-
)
|
|
1113
|
-
);
|
|
1114
|
-
return {
|
|
1115
|
-
definitions: (e.definitions || []).filter(
|
|
1116
|
-
(o) => !n.has(o.id)
|
|
1117
|
-
),
|
|
1118
|
-
values: Object.fromEntries(
|
|
1119
|
-
Object.entries(e.values || {}).filter(
|
|
1120
|
-
([o]) => !n.has(o)
|
|
1121
|
-
)
|
|
1122
|
-
)
|
|
1123
|
-
};
|
|
1124
|
-
}
|
|
1125
|
-
function Dl(e) {
|
|
1126
|
-
return xn({
|
|
1127
|
-
...e,
|
|
1128
|
-
referencedControlIds: new Set(
|
|
1129
|
-
Xe({
|
|
1130
|
-
sql: e.filterSql,
|
|
1131
|
-
controlBindings: []
|
|
1132
|
-
})
|
|
1133
|
-
)
|
|
1134
|
-
});
|
|
1135
|
-
}
|
|
1136
|
-
function Sl(e) {
|
|
1137
|
-
var t;
|
|
1138
|
-
return xn({
|
|
1139
|
-
...e,
|
|
1140
|
-
referencedControlIds: new Set(
|
|
1141
|
-
Xe({
|
|
1142
|
-
sql: (t = e.source) == null ? void 0 : t.sql,
|
|
1143
|
-
controlBindings: []
|
|
1144
|
-
})
|
|
1145
|
-
)
|
|
1146
|
-
});
|
|
1147
|
-
}
|
|
1148
|
-
function wn(e) {
|
|
1149
|
-
return {
|
|
1150
|
-
knownKeys: new Set(
|
|
1151
|
-
e.knownTargets.map(W)
|
|
1152
|
-
),
|
|
1153
|
-
eligibleKeys: new Set(
|
|
1154
|
-
e.eligibleTargets.map(W)
|
|
1155
|
-
),
|
|
1156
|
-
controlsById: new Map(
|
|
1157
|
-
(e.controls || []).map((t) => [t.id, t])
|
|
1158
|
-
)
|
|
1159
|
-
};
|
|
1160
|
-
}
|
|
1161
|
-
function On(e, t) {
|
|
1162
|
-
if (!e || typeof e != "object" || e.target !== "presentation_currency")
|
|
1163
|
-
return {};
|
|
1164
|
-
const n = e, o = typeof n.controlId == "string" && n.controlId.trim() ? n.controlId : void 0;
|
|
1165
|
-
if (!o)
|
|
1166
|
-
return { diagnostic: { code: "invalid_binding_shape" } };
|
|
1167
|
-
const r = zi(
|
|
1168
|
-
n.presentationTarget
|
|
1169
|
-
);
|
|
1170
|
-
if (!r)
|
|
1171
|
-
return {
|
|
1172
|
-
diagnostic: { code: "missing_target", controlId: o }
|
|
1173
|
-
};
|
|
1174
|
-
const i = W(r);
|
|
1175
|
-
if (!t.knownKeys.has(i))
|
|
1176
|
-
return {
|
|
1177
|
-
diagnostic: { code: "stale_target", controlId: o }
|
|
1178
|
-
};
|
|
1179
|
-
if (!t.eligibleKeys.has(i))
|
|
1180
|
-
return {
|
|
1181
|
-
diagnostic: { code: "inapplicable_target", controlId: o }
|
|
1182
|
-
};
|
|
1183
|
-
const s = t.controlsById.get(o);
|
|
1184
|
-
if (!s)
|
|
1185
|
-
return {
|
|
1186
|
-
diagnostic: { code: "missing_control", controlId: o }
|
|
1187
|
-
};
|
|
1188
|
-
const a = Pn(s);
|
|
1189
|
-
return "diagnostic" in a ? {
|
|
1190
|
-
diagnostic: { code: a.diagnostic, controlId: o }
|
|
1191
|
-
} : {
|
|
1192
|
-
binding: {
|
|
1193
|
-
controlId: o,
|
|
1194
|
-
presentationTarget: r,
|
|
1195
|
-
control: a.control,
|
|
1196
|
-
currencies: a.currencies
|
|
1197
|
-
}
|
|
1198
|
-
};
|
|
1199
|
-
}
|
|
1200
|
-
function Tl(e) {
|
|
1201
|
-
const t = wn(e);
|
|
1202
|
-
return (e.bindings || []).flatMap((n) => {
|
|
1203
|
-
const o = On(n, t);
|
|
1204
|
-
return "diagnostic" in o ? [o.diagnostic] : [];
|
|
1205
|
-
});
|
|
1206
|
-
}
|
|
1207
|
-
function Gi(e) {
|
|
1208
|
-
var r;
|
|
1209
|
-
const t = [], n = W(e.target), o = wn(e);
|
|
1210
|
-
for (const i of e.bindings || []) {
|
|
1211
|
-
const s = On(i, o);
|
|
1212
|
-
if ("diagnostic" in s) {
|
|
1213
|
-
t.push(s.diagnostic);
|
|
1214
|
-
continue;
|
|
1215
|
-
}
|
|
1216
|
-
const a = s.binding;
|
|
1217
|
-
if (!a || W(
|
|
1218
|
-
a.presentationTarget
|
|
1219
|
-
) !== n) continue;
|
|
1220
|
-
const l = tn(
|
|
1221
|
-
(r = e.values) == null ? void 0 : r[a.control.id]
|
|
1222
|
-
);
|
|
1223
|
-
if (!(!l || !a.currencies.includes(l)))
|
|
1224
|
-
return { currency: l, diagnostics: t };
|
|
1225
|
-
}
|
|
1226
|
-
return { diagnostics: t };
|
|
1227
|
-
}
|
|
1228
|
-
function Hi(e, t, n, o) {
|
|
1229
|
-
const r = { ...e, config: { ...e.config, matrix: t } }, i = ji(r, [], o), s = Vn(r, o), a = { ...t.presentation.measureFormats };
|
|
1230
|
-
for (const c of s) {
|
|
1231
|
-
const l = { kind: "matrix_measure", measureId: c.measureId }, { currency: d } = Gi({
|
|
1232
|
-
...n,
|
|
1233
|
-
...i,
|
|
1234
|
-
bindings: e.controlBindings,
|
|
1235
|
-
target: l
|
|
1236
|
-
});
|
|
1237
|
-
if (!d || !c.canonical) continue;
|
|
1238
|
-
const { locale: u, ...f } = c.canonical;
|
|
1239
|
-
a[c.measureId] = { ...f, type: "currency", currency: d };
|
|
1240
|
-
}
|
|
1241
|
-
return { ...t.presentation, measureFormats: a };
|
|
1242
|
-
}
|
|
1243
|
-
function Ui(e, t) {
|
|
1244
|
-
if (!e || typeof e != "object" || !("kind" in e))
|
|
1245
|
-
return e;
|
|
1246
|
-
switch (e.kind) {
|
|
1247
|
-
case "manual":
|
|
1248
|
-
return {
|
|
1249
|
-
kind: "manual",
|
|
1250
|
-
...t != null && t.includePresentation ? {
|
|
1251
|
-
options: e.options.map((n) => ({
|
|
1252
|
-
value: n.value,
|
|
1253
|
-
label: n.label,
|
|
1254
|
-
presentation: n.presentation
|
|
1255
|
-
}))
|
|
1256
|
-
} : {
|
|
1257
|
-
optionValues: e.options.map((n) => n.value).sort()
|
|
1258
|
-
}
|
|
1259
|
-
};
|
|
1260
|
-
case "dataset_values":
|
|
1261
|
-
return {
|
|
1262
|
-
kind: "dataset_values",
|
|
1263
|
-
fieldId: e.fieldId,
|
|
1264
|
-
connectionId: e.connectionId || ""
|
|
1265
|
-
};
|
|
1266
|
-
case "field_allowlist":
|
|
1267
|
-
return {
|
|
1268
|
-
kind: "field_allowlist",
|
|
1269
|
-
fieldIds: [...e.fieldIds].sort()
|
|
1270
|
-
};
|
|
1271
|
-
case "metric_allowlist":
|
|
1272
|
-
return {
|
|
1273
|
-
kind: "metric_allowlist",
|
|
1274
|
-
metricIds: [...e.metricIds].sort()
|
|
1275
|
-
};
|
|
1276
|
-
case "sql_query":
|
|
1277
|
-
return {
|
|
1278
|
-
kind: "sql_query",
|
|
1279
|
-
connectionId: e.connectionId,
|
|
1280
|
-
sql: e.sql,
|
|
1281
|
-
valueColumn: e.valueColumn,
|
|
1282
|
-
labelColumn: e.labelColumn
|
|
1283
|
-
};
|
|
1284
|
-
default:
|
|
1285
|
-
return e;
|
|
1286
|
-
}
|
|
1287
|
-
}
|
|
1288
|
-
function $i(e, t) {
|
|
1289
|
-
return {
|
|
1290
|
-
id: e.id,
|
|
1291
|
-
scope: e.scope,
|
|
1292
|
-
type: e.type,
|
|
1293
|
-
source: Ui(e.source, t),
|
|
1294
|
-
initialValueStrategy: e.initialValueStrategy,
|
|
1295
|
-
defaultValue: e.defaultValue,
|
|
1296
|
-
requiredAtExecution: e.requiredAtExecution,
|
|
1297
|
-
...t != null && t.includePresentation ? {
|
|
1298
|
-
label: e.label,
|
|
1299
|
-
helpText: e.helpText,
|
|
1300
|
-
hidden: e.hidden,
|
|
1301
|
-
locked: e.locked,
|
|
1302
|
-
placement: e.placement,
|
|
1303
|
-
showLabel: e.showLabel,
|
|
1304
|
-
toolbarWidth: e.toolbarWidth
|
|
1305
|
-
} : {}
|
|
1306
|
-
};
|
|
1307
|
-
}
|
|
1308
|
-
function Qi(e, t) {
|
|
1309
|
-
return e.target === "sql_param" || e.target === "presentation_currency" ? e : e.target === "config_field_selector" && !(t != null && t.includePresentation) ? {
|
|
1310
|
-
...e,
|
|
1311
|
-
mapping: Object.fromEntries(
|
|
1312
|
-
Object.entries(e.mapping).sort(([n], [o]) => n.localeCompare(o)).map(([n, o]) => {
|
|
1313
|
-
if ("kind" in o) return [n, o];
|
|
1314
|
-
const r = { ...o };
|
|
1315
|
-
return delete r.format, delete r.dateFormat, delete r.customFormat, delete r.semanticTemporalPresentation, [n, r];
|
|
1316
|
-
})
|
|
1317
|
-
)
|
|
1318
|
-
} : {
|
|
1319
|
-
...e,
|
|
1320
|
-
mapping: Object.fromEntries(
|
|
1321
|
-
Object.entries(e.mapping).sort(([n], [o]) => n.localeCompare(o)).map(([n, o]) => [
|
|
1322
|
-
n,
|
|
1323
|
-
o && typeof o == "object" && !Array.isArray(o) ? Object.fromEntries(
|
|
1324
|
-
Object.entries(o).sort(
|
|
1325
|
-
([r], [i]) => r.localeCompare(i)
|
|
1326
|
-
)
|
|
1327
|
-
) : o
|
|
1328
|
-
])
|
|
1329
|
-
)
|
|
1330
|
-
};
|
|
1331
|
-
}
|
|
1332
|
-
function xt(e = [], t) {
|
|
1333
|
-
return [...e].map((n) => $i(n, t)).sort(
|
|
1334
|
-
(n, o) => n.id.localeCompare(o.id) || n.scope.localeCompare(o.scope) || n.type.localeCompare(o.type)
|
|
1335
|
-
);
|
|
1336
|
-
}
|
|
1337
|
-
function Wi(e = [], t) {
|
|
1338
|
-
return e.filter(
|
|
1339
|
-
(n) => (t == null ? void 0 : t.includePresentation) || !Te(n)
|
|
1340
|
-
).map((n) => Qi(n, t)).sort(
|
|
1341
|
-
(n, o) => R(n).localeCompare(R(o))
|
|
1342
|
-
);
|
|
1343
|
-
}
|
|
1344
|
-
function Ji(e, t) {
|
|
1345
|
-
return e ? R({
|
|
1346
|
-
controlDefinitions: xt(e.controlDefinitions, t),
|
|
1347
|
-
cardControlDefinitions: xt(
|
|
1348
|
-
e.cardControlDefinitions,
|
|
1349
|
-
t
|
|
1350
|
-
),
|
|
1351
|
-
controlBindings: Wi(e.controlBindings, t)
|
|
1352
|
-
}) : "__none__";
|
|
1353
|
-
}
|
|
1354
|
-
const Zi = ["table", "detailTable"], wt = (e) => Zi.includes(e.type), Yi = "calendar-context";
|
|
1355
|
-
function Xi(e) {
|
|
1356
|
-
const { id: t, label: n, field: o, ...r } = e;
|
|
1357
|
-
return {
|
|
1358
|
-
...r,
|
|
1359
|
-
field: tt(
|
|
1360
|
-
o
|
|
1361
|
-
)
|
|
1362
|
-
};
|
|
1363
|
-
}
|
|
1364
|
-
function xe(e) {
|
|
1365
|
-
if (!e)
|
|
1366
|
-
return;
|
|
1367
|
-
const { id: t, conditions: n, groups: o, ...r } = e;
|
|
1368
|
-
return {
|
|
1369
|
-
...r,
|
|
1370
|
-
conditions: n.map(Xi),
|
|
1371
|
-
groups: o.map((i) => xe(i))
|
|
1372
|
-
};
|
|
1373
|
-
}
|
|
1374
|
-
function tt(e) {
|
|
1375
|
-
var o, r;
|
|
1376
|
-
const { label: t, ...n } = e;
|
|
1377
|
-
return {
|
|
1378
|
-
...n,
|
|
1379
|
-
...(o = e.calculatedFormula) != null && o.inputFields ? {
|
|
1380
|
-
calculatedFormula: {
|
|
1381
|
-
...e.calculatedFormula,
|
|
1382
|
-
inputFields: e.calculatedFormula.inputFields.map(
|
|
1383
|
-
tt
|
|
1384
|
-
)
|
|
1385
|
-
}
|
|
1386
|
-
} : {},
|
|
1387
|
-
...(r = e.parameters) != null && r.filters ? {
|
|
1388
|
-
parameters: {
|
|
1389
|
-
...e.parameters,
|
|
1390
|
-
filters: xe(
|
|
1391
|
-
e.parameters.filters
|
|
1392
|
-
)
|
|
1393
|
-
}
|
|
1394
|
-
} : {}
|
|
1395
|
-
};
|
|
1396
|
-
}
|
|
1397
|
-
function es(e) {
|
|
1398
|
-
const t = (n) => n == null ? void 0 : n.map(tt);
|
|
1399
|
-
return {
|
|
1400
|
-
...e,
|
|
1401
|
-
groupByColumns: t(e.groupByColumns),
|
|
1402
|
-
metricColumns: t(e.metricColumns),
|
|
1403
|
-
pivotByColumns: t(e.pivotByColumns),
|
|
1404
|
-
sortByColumns: t(e.sortByColumns),
|
|
1405
|
-
detailColumns: t(e.detailColumns),
|
|
1406
|
-
filters: e.filters ? xe(e.filters) : void 0
|
|
1407
|
-
};
|
|
1408
|
-
}
|
|
1409
|
-
function ts(e, t, n) {
|
|
1410
|
-
if (!e)
|
|
1411
|
-
return JSON.stringify(e);
|
|
1412
|
-
if (n === "matrixTable" && e.matrix) return R(Kr(e.matrix.spec));
|
|
1413
|
-
const { matrix: o, ...r } = e, i = t ? es(r) : r;
|
|
1414
|
-
return JSON.stringify({
|
|
1415
|
-
...i,
|
|
1416
|
-
filters: xe(i.filters)
|
|
1417
|
-
});
|
|
1418
|
-
}
|
|
1419
|
-
function ns(e) {
|
|
1420
|
-
if (!e)
|
|
1421
|
-
return null;
|
|
1422
|
-
const { format: t, ...n } = e;
|
|
1423
|
-
return n;
|
|
1424
|
-
}
|
|
1425
|
-
function os(e, t) {
|
|
1426
|
-
const n = /* @__PURE__ */ new Map();
|
|
1427
|
-
for (const r of (t == null ? void 0 : t.controlDefinitions) || [])
|
|
1428
|
-
n.set(r.id, r.type);
|
|
1429
|
-
for (const r of (t == null ? void 0 : t.cardControlDefinitions) || [])
|
|
1430
|
-
n.set(r.id, r.type);
|
|
1431
|
-
const o = Object.fromEntries(
|
|
1432
|
-
Object.entries(e || {}).map(([r, i]) => n.get(r) === "multi_enum" && Array.isArray(i) ? [
|
|
1433
|
-
r,
|
|
1434
|
-
[...i].sort(
|
|
1435
|
-
(s, a) => R(s).localeCompare(R(a))
|
|
1436
|
-
)
|
|
1437
|
-
] : [r, i])
|
|
1438
|
-
);
|
|
1439
|
-
return R(o);
|
|
1440
|
-
}
|
|
1441
|
-
function rs(e, {
|
|
1442
|
-
finalFiltersKey: t,
|
|
1443
|
-
cardFilterValues: n,
|
|
1444
|
-
controlValues: o,
|
|
1445
|
-
controlDefinitions: r,
|
|
1446
|
-
cardControlDefinitions: i,
|
|
1447
|
-
controlBindings: s,
|
|
1448
|
-
queryRelevantConfig: a,
|
|
1449
|
-
resolvedPrimaryDateField: c,
|
|
1450
|
-
globalDateComparison: l,
|
|
1451
|
-
calendarContext: d
|
|
1452
|
-
}) {
|
|
1453
|
-
const { filterColumns: u, ...f } = e.queryConfig || {}, p = u == null ? void 0 : u.filter(
|
|
1454
|
-
(v) => {
|
|
1455
|
-
var M, h;
|
|
1456
|
-
return (h = (M = e.queryConfig) == null ? void 0 : M.filters) == null ? void 0 : h.some((w) => w.filterColumnName === v.name);
|
|
1457
|
-
}
|
|
1458
|
-
), g = (e == null ? void 0 : e.sql) || "", m = He((e == null ? void 0 : e.python) || ""), y = ["table", "detailTable", "matrixTable"].includes(
|
|
1459
|
-
e.type
|
|
1460
|
-
) ? "table" : e.type === "kpi" ? "kpi" : "chart", b = a || Sn(e.config, { cardType: e.type, dataSource: e.dataSource }), I = Vo.includes(
|
|
1461
|
-
e.type
|
|
1462
|
-
);
|
|
1463
|
-
return [
|
|
1464
|
-
"query",
|
|
1465
|
-
e == null ? void 0 : e.id,
|
|
1466
|
-
y,
|
|
1467
|
-
g,
|
|
1468
|
-
m,
|
|
1469
|
-
JSON.stringify(n),
|
|
1470
|
-
os(o, {
|
|
1471
|
-
controlDefinitions: r,
|
|
1472
|
-
cardControlDefinitions: i
|
|
1473
|
-
}),
|
|
1474
|
-
Ji({
|
|
1475
|
-
controlDefinitions: r,
|
|
1476
|
-
cardControlDefinitions: i,
|
|
1477
|
-
controlBindings: s
|
|
1478
|
-
}),
|
|
1479
|
-
R(
|
|
1480
|
-
ns(c)
|
|
1481
|
-
),
|
|
1482
|
-
R(l ?? null),
|
|
1483
|
-
Yi,
|
|
1484
|
-
R(d),
|
|
1485
|
-
JSON.stringify(f),
|
|
1486
|
-
JSON.stringify(p),
|
|
1487
|
-
ts(
|
|
1488
|
-
b,
|
|
1489
|
-
I,
|
|
1490
|
-
e.type
|
|
1491
|
-
),
|
|
1492
|
-
t
|
|
1493
|
-
];
|
|
1494
|
-
}
|
|
1495
|
-
function is(e, t, n) {
|
|
1496
|
-
var a, c, l;
|
|
1497
|
-
const o = rs(e, t), r = R(o), i = ((a = n == null ? void 0 : n.resolvePaginationConfig) == null ? void 0 : a.call(n, r)) ?? e.paginationConfig, s = wt(e) && Me(e.config) || wt(e) && e.sql && ((l = (c = e.preferences) == null ? void 0 : c.tablePrefs) == null ? void 0 : l.enableDevModePagination);
|
|
1498
|
-
return {
|
|
1499
|
-
queryKey: [
|
|
1500
|
-
...o,
|
|
1501
|
-
s ? JSON.stringify(i) : ""
|
|
1502
|
-
],
|
|
1503
|
-
queryInputIdentity: r,
|
|
1504
|
-
paginationConfig: i
|
|
1505
|
-
};
|
|
1506
|
-
}
|
|
1507
|
-
function ss(e, t, n, o) {
|
|
1508
|
-
return is(
|
|
1509
|
-
e,
|
|
1510
|
-
{
|
|
1511
|
-
finalFiltersKey: t.finalFiltersKey,
|
|
1512
|
-
cardFilterValues: t.cardFilterValues,
|
|
1513
|
-
controlValues: t.controlValues,
|
|
1514
|
-
controlDefinitions: t.controlDefinitions,
|
|
1515
|
-
cardControlDefinitions: t.cardControlDefinitions,
|
|
1516
|
-
controlBindings: t.controlBindings,
|
|
1517
|
-
queryRelevantConfig: t.queryRelevantConfig,
|
|
1518
|
-
resolvedPrimaryDateField: t.resolvedPrimaryDateField || void 0,
|
|
1519
|
-
globalDateComparison: t.globalDateComparison,
|
|
1520
|
-
calendarContext: n
|
|
1521
|
-
},
|
|
1522
|
-
o
|
|
1523
|
-
);
|
|
1524
|
-
}
|
|
1525
|
-
function Bn(e) {
|
|
1526
|
-
const t = {
|
|
1527
|
-
...Qr,
|
|
1528
|
-
...e.presentation
|
|
1529
|
-
}, n = t.displayMode, {
|
|
1530
|
-
bookkeepingKeys: o,
|
|
1531
|
-
comparisonColumnKeys: r,
|
|
1532
|
-
deltaColumnKeys: i,
|
|
1533
|
-
percentChangeColumnKeys: s,
|
|
1534
|
-
ratioColumnKeys: a
|
|
1535
|
-
} = ln(e.comparisonMetadata), c = /* @__PURE__ */ new Set();
|
|
1536
|
-
t.showComparison && (n === "difference" || n === "both") && i.forEach((f) => c.add(f)), t.showComparison && (n === "percent_change" || n === "both") && s.forEach((f) => c.add(f)), t.showComparison && n === "ratio" && a.forEach((f) => c.add(f));
|
|
1537
|
-
const l = new Set(o);
|
|
1538
|
-
t.showComparison || r.forEach((f) => l.add(f)), [i, s, a].forEach(
|
|
1539
|
-
(f) => f.forEach((p) => {
|
|
1540
|
-
c.has(p) || l.add(p);
|
|
1541
|
-
})
|
|
1542
|
-
);
|
|
1543
|
-
const d = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map();
|
|
1544
|
-
return Object.entries(e.comparisonMetadata || {}).forEach(
|
|
1545
|
-
([f, p]) => {
|
|
1546
|
-
var b;
|
|
1547
|
-
const g = p.output;
|
|
1548
|
-
if (!g || g.outputId !== f || g.availability.status !== "available")
|
|
1549
|
-
return;
|
|
1550
|
-
const m = ((b = e.resolveMetricName) == null ? void 0 : b.call(e, {
|
|
1551
|
-
metricId: g.metricId,
|
|
1552
|
-
metricAlias: g.metricAlias
|
|
1553
|
-
})) || p.displayName || g.metricId, y = p.displayLabel || "Comparison";
|
|
1554
|
-
g.comparisonColumnKey && (d.set(
|
|
1555
|
-
g.comparisonColumnKey,
|
|
1556
|
-
`${m} (${y})`
|
|
1557
|
-
), u.set(g.comparisonColumnKey, {
|
|
1558
|
-
metricId: g.metricId,
|
|
1559
|
-
metricAlias: g.metricAlias,
|
|
1560
|
-
kind: "comparison"
|
|
1561
|
-
})), g.deltaColumnKey && c.has(g.deltaColumnKey) && (d.set(g.deltaColumnKey, `${m} Difference`), u.set(g.deltaColumnKey, {
|
|
1562
|
-
metricId: g.metricId,
|
|
1563
|
-
metricAlias: g.metricAlias,
|
|
1564
|
-
kind: "delta"
|
|
1565
|
-
})), g.percentChangeColumnKey && c.has(g.percentChangeColumnKey) && (d.set(
|
|
1566
|
-
g.percentChangeColumnKey,
|
|
1567
|
-
`${m} Percent Change`
|
|
1568
|
-
), u.set(g.percentChangeColumnKey, {
|
|
1569
|
-
metricId: g.metricId,
|
|
1570
|
-
metricAlias: g.metricAlias,
|
|
1571
|
-
kind: "percent_change"
|
|
1572
|
-
})), g.ratioColumnKey && c.has(g.ratioColumnKey) && (d.set(
|
|
1573
|
-
g.ratioColumnKey,
|
|
1574
|
-
`${m} Ratio (current ÷ comparison)`
|
|
1575
|
-
), u.set(g.ratioColumnKey, {
|
|
1576
|
-
metricId: g.metricId,
|
|
1577
|
-
metricAlias: g.metricAlias,
|
|
1578
|
-
kind: "ratio"
|
|
1579
|
-
}));
|
|
1580
|
-
}
|
|
1581
|
-
), {
|
|
1582
|
-
excludedKeys: l,
|
|
1583
|
-
selectedDerivedKeys: c,
|
|
1584
|
-
columnLabels: d,
|
|
1585
|
-
columnPresentationOwners: u
|
|
1586
|
-
};
|
|
1587
|
-
}
|
|
1588
|
-
function Ml(e) {
|
|
1589
|
-
var t, n;
|
|
1590
|
-
return Bn({
|
|
1591
|
-
comparisonMetadata: e.comparisonMetadata,
|
|
1592
|
-
presentation: (n = (t = e.card) == null ? void 0 : t.preferences) == null ? void 0 : n.comparisonPresentation,
|
|
1593
|
-
resolveMetricName: ({ metricId: o, metricAlias: r }) => {
|
|
1594
|
-
var i;
|
|
1595
|
-
return (i = vn({
|
|
1596
|
-
card: e.card,
|
|
1597
|
-
columnKeyMap: e.columnKeyMap,
|
|
1598
|
-
metricId: o,
|
|
1599
|
-
metricAlias: r
|
|
1600
|
-
})) == null ? void 0 : i.label;
|
|
1601
|
-
}
|
|
1602
|
-
});
|
|
1603
|
-
}
|
|
1604
|
-
function Vl(e) {
|
|
1605
|
-
var n;
|
|
1606
|
-
return (((n = e.card.config) == null ? void 0 : n.metricColumns) || []).filter(
|
|
1607
|
-
(o) => {
|
|
1608
|
-
var r;
|
|
1609
|
-
return ((r = o.comparison) == null ? void 0 : r.mode) === "explicit";
|
|
1610
|
-
}
|
|
1611
|
-
).some(
|
|
1612
|
-
(o) => !rn(e.comparisonMetadata, o)
|
|
1613
|
-
);
|
|
1614
|
-
}
|
|
1615
|
-
function as(e) {
|
|
1616
|
-
return e.part === "base" && !!e.columnId;
|
|
1617
|
-
}
|
|
1618
|
-
function nt(e) {
|
|
1619
|
-
const t = e.config ?? {};
|
|
1620
|
-
return e.type === "detailTable" ? [{ role: "detail", fields: t.detailColumns ?? [] }] : [
|
|
1621
|
-
{ role: "groupby", fields: t.groupByColumns ?? [] },
|
|
1622
|
-
{ role: "metric", fields: t.metricColumns ?? [] },
|
|
1623
|
-
{ role: "detail", fields: t.detailColumns ?? [] }
|
|
1624
|
-
];
|
|
1625
|
-
}
|
|
1626
|
-
function ot(e, t) {
|
|
1627
|
-
if (e.id)
|
|
1628
|
-
return t === "metric" ? {
|
|
1629
|
-
kind: "metric",
|
|
1630
|
-
metricId: e.id,
|
|
1631
|
-
metricAlias: le(e)
|
|
1632
|
-
} : { kind: "dimension", role: t, fieldId: e.id };
|
|
1633
|
-
}
|
|
1634
|
-
function Ot(e) {
|
|
1635
|
-
const t = /* @__PURE__ */ new Map();
|
|
1636
|
-
for (const n of e) t.set(n, (t.get(n) ?? 0) + 1);
|
|
1637
|
-
return t;
|
|
1638
|
-
}
|
|
1639
|
-
function ls(e, t) {
|
|
1640
|
-
var u, f;
|
|
1641
|
-
const n = [...t.keys], o = new Set(n), r = t.columnKeyMap, i = nt(e).flatMap(
|
|
1642
|
-
({ role: p, fields: g }) => g.flatMap((m) => {
|
|
1643
|
-
const y = ot(m, p);
|
|
1644
|
-
return y ? [
|
|
1645
|
-
{
|
|
1646
|
-
identity: y,
|
|
1647
|
-
columnId: U(y),
|
|
1648
|
-
field: m,
|
|
1649
|
-
// Identity comes from result metadata (PLAN B2): no key map, no address.
|
|
1650
|
-
outputKey: r ? ce(m, p, n, r) : void 0
|
|
1651
|
-
}
|
|
1652
|
-
] : [];
|
|
1653
|
-
})
|
|
1654
|
-
), s = Ot(i.map((p) => p.columnId)), a = Ot(
|
|
1655
|
-
i.flatMap(
|
|
1656
|
-
(p) => p.outputKey ? [p.outputKey] : []
|
|
1657
|
-
)
|
|
1658
|
-
), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
|
|
1659
|
-
for (const p of i) {
|
|
1660
|
-
if (s.get(p.columnId) !== 1) continue;
|
|
1661
|
-
const g = p.outputKey && a.get(p.outputKey) === 1 ? p.outputKey : void 0;
|
|
1662
|
-
c.set(p.columnId, {
|
|
1663
|
-
columnId: p.columnId,
|
|
1664
|
-
identity: p.identity,
|
|
1665
|
-
field: p.field,
|
|
1666
|
-
baseKey: g,
|
|
1667
|
-
// Today's header for the column's own key; a metric shown only as pivot
|
|
1668
|
-
// members is named by its field.
|
|
1669
|
-
authorLabel: g ? Fn(g, e, r) ?? g : p.field.label || p.field.name || p.columnId
|
|
1670
|
-
}), g && l.set(g, { columnId: p.columnId, part: "base" });
|
|
1671
|
-
}
|
|
1672
|
-
const d = e.config;
|
|
1673
|
-
if (e.type === "table" && ((u = d == null ? void 0 : d.pivotByColumns) != null && u.length) && ((f = t.columns) != null && f.length)) {
|
|
1674
|
-
const p = e;
|
|
1675
|
-
for (const g of t.columns) {
|
|
1676
|
-
if (!g.pivotIdentity || !o.has(g.key) || l.has(g.key))
|
|
1677
|
-
continue;
|
|
1678
|
-
const m = et({
|
|
1679
|
-
resultColumn: g,
|
|
1680
|
-
card: p,
|
|
1681
|
-
columnKeyMap: r
|
|
1682
|
-
});
|
|
1683
|
-
if (!m) continue;
|
|
1684
|
-
const y = {
|
|
1685
|
-
kind: "metric",
|
|
1686
|
-
metricId: m.identity.metricId,
|
|
1687
|
-
metricAlias: m.identity.metricAlias
|
|
1688
|
-
}, b = U(y);
|
|
1689
|
-
if (m.authoredMetric) {
|
|
1690
|
-
if (!c.has(b))
|
|
1691
|
-
continue;
|
|
1692
|
-
} else {
|
|
1693
|
-
if (m.identity.metricId !== Ze)
|
|
1694
|
-
continue;
|
|
1695
|
-
c.has(b) || c.set(b, { columnId: b, identity: y, authorLabel: "Count" });
|
|
1696
|
-
}
|
|
1697
|
-
l.set(g.key, { columnId: b, part: "pivot-member" });
|
|
1698
|
-
}
|
|
1699
|
-
}
|
|
1700
|
-
for (const [p, g] of Object.entries(
|
|
1701
|
-
t.comparisonMetadata ?? {}
|
|
1702
|
-
)) {
|
|
1703
|
-
const m = g.output;
|
|
1704
|
-
if (m.outputId !== p || m.availability.status !== "available")
|
|
1705
|
-
continue;
|
|
1706
|
-
const y = U({
|
|
1707
|
-
kind: "metric",
|
|
1708
|
-
metricId: m.metricId,
|
|
1709
|
-
metricAlias: m.metricAlias
|
|
1710
|
-
});
|
|
1711
|
-
if (c.has(y))
|
|
1712
|
-
for (const b of [
|
|
1713
|
-
m.comparisonColumnKey,
|
|
1714
|
-
m.deltaColumnKey,
|
|
1715
|
-
m.percentChangeColumnKey,
|
|
1716
|
-
m.ratioColumnKey
|
|
1717
|
-
])
|
|
1718
|
-
b && !l.has(b) && l.set(b, { columnId: y, part: "comparison" });
|
|
1719
|
-
}
|
|
1720
|
-
return { entries: c, owners: l };
|
|
1721
|
-
}
|
|
1722
|
-
function cs(e) {
|
|
1723
|
-
const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
1724
|
-
for (const o of e.keys) {
|
|
1725
|
-
const r = { kind: "result", key: o }, i = U(r);
|
|
1726
|
-
t.set(i, {
|
|
1727
|
-
columnId: i,
|
|
1728
|
-
identity: r,
|
|
1729
|
-
baseKey: o,
|
|
1730
|
-
authorLabel: o
|
|
1731
|
-
}), n.set(o, { columnId: i, part: "base" });
|
|
1732
|
-
}
|
|
1733
|
-
return { entries: t, owners: n };
|
|
1734
|
-
}
|
|
1735
|
-
function kl(e) {
|
|
1736
|
-
const t = /* @__PURE__ */ new Set();
|
|
1737
|
-
for (const n of e ?? [])
|
|
1738
|
-
if (n && typeof n == "object")
|
|
1739
|
-
for (const o of Object.keys(n)) t.add(o);
|
|
1740
|
-
return [...t];
|
|
1741
|
-
}
|
|
1742
|
-
function ds(e, t) {
|
|
1743
|
-
if (e.toLowerCase() !== "count") return !1;
|
|
1744
|
-
const n = t == null ? void 0 : t.find((o) => (o == null ? void 0 : o[e]) != null);
|
|
1745
|
-
return n ? typeof n[e] == "number" : !1;
|
|
1746
|
-
}
|
|
1747
|
-
function us(e, t, n, o) {
|
|
1748
|
-
var c, l, d, u;
|
|
1749
|
-
let r = [...t.keys], i = /* @__PURE__ */ new Map();
|
|
1750
|
-
const s = t.comparisonMetadata;
|
|
1751
|
-
if (n === "screen") {
|
|
1752
|
-
const f = ln(s);
|
|
1753
|
-
r = r.filter((g) => !f.internalKeys.has(g));
|
|
1754
|
-
const p = e.type === "table" ? (c = e.preferences) == null ? void 0 : c.comparisonPresentation : void 0;
|
|
1755
|
-
dn(p) || (r = r.filter((g) => !f.comparisonColumnKeys.has(g)));
|
|
1756
|
-
} else {
|
|
1757
|
-
const f = Bn({
|
|
1758
|
-
comparisonMetadata: s,
|
|
1759
|
-
presentation: (l = e.preferences) == null ? void 0 : l.comparisonPresentation,
|
|
1760
|
-
resolveMetricName: o
|
|
1761
|
-
});
|
|
1762
|
-
r = r.filter((p) => !f.excludedKeys.has(p)), i = f.columnLabels;
|
|
1763
|
-
}
|
|
1764
|
-
const a = e.config;
|
|
1765
|
-
return e.type === "table" && !((d = a == null ? void 0 : a.metricColumns) != null && d.length) && ((u = a == null ? void 0 : a.groupByColumns) != null && u.length) && !e.sql && (r = r.filter((f) => !ds(f, t.rows))), {
|
|
1766
|
-
keys: wi({
|
|
1767
|
-
keys: r,
|
|
1768
|
-
card: e,
|
|
1769
|
-
comparisonMetadata: s,
|
|
1770
|
-
columnKeyMap: t.columnKeyMap,
|
|
1771
|
-
resultColumns: t.columns
|
|
1772
|
-
}),
|
|
1773
|
-
exportLabels: i
|
|
1774
|
-
};
|
|
1775
|
-
}
|
|
1776
|
-
function fs(e, t, n) {
|
|
1777
|
-
var r, i;
|
|
1778
|
-
const o = /* @__PURE__ */ new Map();
|
|
1779
|
-
if (e.type !== "table" || !dn((r = e.preferences) == null ? void 0 : r.comparisonPresentation))
|
|
1780
|
-
return o;
|
|
1781
|
-
for (const s of ((i = e.config) == null ? void 0 : i.metricColumns) ?? []) {
|
|
1782
|
-
const { comparisonKind: a, metadata: c } = sn(
|
|
1783
|
-
t.comparisonMetadata,
|
|
1784
|
-
s
|
|
1785
|
-
);
|
|
1786
|
-
if (a === "none" || !ce(
|
|
1787
|
-
s,
|
|
1788
|
-
"metric",
|
|
1789
|
-
[...n],
|
|
1790
|
-
t.columnKeyMap
|
|
1791
|
-
)) continue;
|
|
1792
|
-
const d = In(
|
|
1793
|
-
s.label || s.name,
|
|
1794
|
-
a,
|
|
1795
|
-
c
|
|
1796
|
-
);
|
|
1797
|
-
d && o.set(d, { metric: s, kind: a });
|
|
1798
|
-
}
|
|
1799
|
-
return o;
|
|
1800
|
-
}
|
|
1801
|
-
function ms(e) {
|
|
1802
|
-
const t = nt(e);
|
|
1803
|
-
return [
|
|
1804
|
-
...t.filter((n) => n.role === "metric"),
|
|
1805
|
-
...t.filter((n) => n.role !== "metric")
|
|
1806
|
-
];
|
|
1807
|
-
}
|
|
1808
|
-
function ps(e, t, n) {
|
|
1809
|
-
if (!t.length) return [];
|
|
1810
|
-
const o = ms(e), r = [], i = /* @__PURE__ */ new Set();
|
|
1811
|
-
for (const s of t) {
|
|
1812
|
-
const a = qr(o, s);
|
|
1813
|
-
if (!a) continue;
|
|
1814
|
-
const c = o[a.group], l = ot(c.fields[a.index], c.role);
|
|
1815
|
-
if (!l) continue;
|
|
1816
|
-
const d = U(l);
|
|
1817
|
-
!n.has(d) || i.has(d) || (i.add(d), r.push({
|
|
1818
|
-
columnId: d,
|
|
1819
|
-
direction: s.direction === "desc" ? "desc" : "asc"
|
|
1820
|
-
}));
|
|
1821
|
-
}
|
|
1822
|
-
return r;
|
|
1823
|
-
}
|
|
1824
|
-
function gs(e, t) {
|
|
1825
|
-
return e ? "query" : t === "server" ? "page-only" : "browser";
|
|
1826
|
-
}
|
|
1827
|
-
function An(e, t) {
|
|
1828
|
-
var n, o, r;
|
|
1829
|
-
return !!t && ((r = (o = (n = e.preferences) == null ? void 0 : n.tablePrefs) == null ? void 0 : o.columnVisibility) == null ? void 0 : r[t]) === !1;
|
|
1830
|
-
}
|
|
1831
|
-
function ys(e) {
|
|
1832
|
-
return e.type !== "table" && e.type !== "detailTable" ? "card-type" : cn(e) ? void 0 : "author-disabled";
|
|
1833
|
-
}
|
|
1834
|
-
function Ne(e, t) {
|
|
1835
|
-
const n = [], o = /* @__PURE__ */ new Map();
|
|
1836
|
-
for (const r of e) {
|
|
1837
|
-
const i = t(r), s = i ? `column:${i.columnId}` : `key:${r}`;
|
|
1838
|
-
let a = o.get(s);
|
|
1839
|
-
a || (a = { id: s, columnId: i == null ? void 0 : i.columnId, keys: [] }, o.set(s, a), n.push(a)), a.keys.push(r);
|
|
1840
|
-
}
|
|
1841
|
-
return n;
|
|
1842
|
-
}
|
|
1843
|
-
function fe(e, t, n) {
|
|
1844
|
-
const o = Ne(e, t), r = new Set(n), i = new Map(
|
|
1845
|
-
o.flatMap(
|
|
1846
|
-
(a) => a.columnId ? [[a.columnId, a]] : []
|
|
1847
|
-
)
|
|
1848
|
-
), s = n.flatMap((a) => {
|
|
1849
|
-
const c = i.get(a);
|
|
1850
|
-
return c ? [c] : [];
|
|
1851
|
-
});
|
|
1852
|
-
return o.forEach((a, c) => {
|
|
1853
|
-
if (a.columnId && r.has(a.columnId)) return;
|
|
1854
|
-
const l = c > 0 ? o[c - 1] : void 0, d = l ? s.indexOf(l) + 1 : 0;
|
|
1855
|
-
s.splice(d, 0, a);
|
|
1856
|
-
}), s.flatMap((a) => a.keys);
|
|
1857
|
-
}
|
|
1858
|
-
function bs(e) {
|
|
1859
|
-
return e != null && e.pivotIdentity ? JSON.stringify(e.pivotIdentity.members.map((t) => t.value)) : void 0;
|
|
1860
|
-
}
|
|
1861
|
-
function Cs(e, t, n, o) {
|
|
1862
|
-
const r = e.findIndex(
|
|
1863
|
-
(l) => {
|
|
1864
|
-
var d;
|
|
1865
|
-
return ((d = t(l)) == null ? void 0 : d.part) === "pivot-member";
|
|
1866
|
-
}
|
|
1867
|
-
);
|
|
1868
|
-
if (r === -1) return fe(e, t, n);
|
|
1869
|
-
let i = r;
|
|
1870
|
-
e.forEach((l, d) => {
|
|
1871
|
-
var u;
|
|
1872
|
-
((u = t(l)) == null ? void 0 : u.part) === "pivot-member" && (i = d);
|
|
1873
|
-
});
|
|
1874
|
-
const s = new Map(
|
|
1875
|
-
(o ?? []).map((l) => [l.key, l])
|
|
1876
|
-
), a = [];
|
|
1877
|
-
let c;
|
|
1878
|
-
for (const l of e.slice(r, i + 1)) {
|
|
1879
|
-
const d = bs(s.get(l)) ?? `key:${l}`;
|
|
1880
|
-
(!a.length || d !== c) && a.push([]), a[a.length - 1].push(l), c = d;
|
|
1881
|
-
}
|
|
1882
|
-
return [
|
|
1883
|
-
...fe(e.slice(0, r), t, n),
|
|
1884
|
-
...a.flatMap((l) => fe(l, t, n)),
|
|
1885
|
-
...fe(e.slice(i + 1), t, n)
|
|
1886
|
-
];
|
|
1887
|
-
}
|
|
1888
|
-
function Pl(e) {
|
|
1889
|
-
if (ie(e) !== "config") return;
|
|
1890
|
-
const t = /* @__PURE__ */ new Set();
|
|
1891
|
-
for (const { role: n, fields: o } of nt(e))
|
|
1892
|
-
for (const r of o) {
|
|
1893
|
-
const i = ot(r, n);
|
|
1894
|
-
i && t.add(U(i));
|
|
1895
|
-
}
|
|
1896
|
-
return t;
|
|
1897
|
-
}
|
|
1898
|
-
function xl(e) {
|
|
1899
|
-
const t = un(e);
|
|
1900
|
-
return (t == null ? void 0 : t.kind) === "metric" && t.metricId === Ze;
|
|
1901
|
-
}
|
|
1902
|
-
function wl(e) {
|
|
1903
|
-
var ut, ft, mt, pt, gt, yt, bt;
|
|
1904
|
-
const { card: t, result: n } = e, o = e.projection ?? "screen", r = ie(t) === "config", i = ys(t), s = i === "card-type" ? void 0 : i === "author-disabled" ? (ut = e.settings) != null && ut.sort ? { sort: e.settings.sort } : void 0 : e.settings, a = gs(r, e.paginationMode), c = n.columnKeyMap, l = r ? ls(t, n) : cs(n), d = (C) => {
|
|
1905
|
-
var F, P;
|
|
1906
|
-
return C && ((P = (F = s == null ? void 0 : s.labels) == null ? void 0 : F[C]) == null ? void 0 : P.trim()) || void 0;
|
|
1907
|
-
}, u = (C) => U({ kind: "metric", ...C }), { keys: f, exportLabels: p } = us(
|
|
1908
|
-
t,
|
|
1909
|
-
n,
|
|
1910
|
-
o,
|
|
1911
|
-
(C) => {
|
|
1912
|
-
var P;
|
|
1913
|
-
const F = u(C);
|
|
1914
|
-
return d(l.entries.has(F) ? F : void 0) ?? ((P = l.entries.get(F)) == null ? void 0 : P.authorLabel);
|
|
1915
|
-
}
|
|
1916
|
-
), g = (C) => An(t, C), m = (C) => {
|
|
1917
|
-
const F = l.owners.get(C);
|
|
1918
|
-
if (!F || i === "card-type") return;
|
|
1919
|
-
const P = l.entries.get(F.columnId);
|
|
1920
|
-
if (!(!P || P.baseKey && g(P.baseKey)))
|
|
1921
|
-
return F;
|
|
1922
|
-
}, y = f.filter((C) => !g(C)), I = Ne(y, m).flatMap(
|
|
1923
|
-
(C) => C.columnId ? [C.columnId] : []
|
|
1924
|
-
), v = new Set(I), M = r ? ps(
|
|
1925
|
-
t,
|
|
1926
|
-
((ft = t.config) == null ? void 0 : ft.sortByColumns) ?? [],
|
|
1927
|
-
l.entries
|
|
1928
|
-
).filter((C) => v.has(C.columnId)) : [], h = [
|
|
1929
|
-
...(s == null ? void 0 : s.order) ?? [],
|
|
1930
|
-
...(s == null ? void 0 : s.hidden) ?? [],
|
|
1931
|
-
...Object.keys((s == null ? void 0 : s.labels) ?? {}),
|
|
1932
|
-
...((s == null ? void 0 : s.sort) ?? []).map((C) => C.columnId),
|
|
1933
|
-
...Object.keys((s == null ? void 0 : s.widths) ?? {})
|
|
1934
|
-
], w = [
|
|
1935
|
-
...new Set(h.filter((C) => !v.has(C)))
|
|
1936
|
-
];
|
|
1937
|
-
let B;
|
|
1938
|
-
if (s != null && s.sort && a !== "page-only") {
|
|
1939
|
-
const C = s.sort.filter(
|
|
1940
|
-
(F) => v.has(F.columnId)
|
|
1941
|
-
);
|
|
1942
|
-
B = C.length || !s.sort.length ? C : void 0;
|
|
1943
|
-
}
|
|
1944
|
-
const T = wr(
|
|
1945
|
-
s ? {
|
|
1946
|
-
order: (mt = s.order) == null ? void 0 : mt.filter(
|
|
1947
|
-
(C) => v.has(C)
|
|
1948
|
-
),
|
|
1949
|
-
hidden: (pt = s.hidden) == null ? void 0 : pt.filter(
|
|
1950
|
-
(C) => v.has(C)
|
|
1951
|
-
),
|
|
1952
|
-
labels: Object.fromEntries(
|
|
1953
|
-
Object.entries(s.labels ?? {}).filter(
|
|
1954
|
-
([C]) => v.has(C)
|
|
1955
|
-
)
|
|
1956
|
-
),
|
|
1957
|
-
sort: B,
|
|
1958
|
-
widths: Object.fromEntries(
|
|
1959
|
-
Object.entries(s.widths ?? {}).filter(
|
|
1960
|
-
([C]) => v.has(C)
|
|
1961
|
-
)
|
|
1962
|
-
)
|
|
1963
|
-
} : void 0
|
|
1964
|
-
), D = T == null ? void 0 : T.order, V = D ? Cs(y, m, D, n.columns) : y, O = D ? [...V, ...f.filter(g)] : f, x = Ne(V, m).flatMap(
|
|
1965
|
-
(C) => C.columnId ? [C.columnId] : []
|
|
1966
|
-
), S = new Set((T == null ? void 0 : T.hidden) ?? []);
|
|
1967
|
-
x.length && x.every((C) => S.has(C)) && S.delete(x[0]);
|
|
1968
|
-
const k = o === "screen" ? fs(t, n, f) : /* @__PURE__ */ new Map(), A = (C, F) => {
|
|
1969
|
-
const P = d(F == null ? void 0 : F.columnId);
|
|
1970
|
-
if ((F == null ? void 0 : F.part) === "base" && P) return P;
|
|
1971
|
-
const K = k.get(C);
|
|
1972
|
-
if (K)
|
|
1973
|
-
return vi(
|
|
1974
|
-
((F == null ? void 0 : F.part) === "comparison" ? P : void 0) ?? (K.metric.label || K.metric.name),
|
|
1975
|
-
K.kind
|
|
1976
|
-
);
|
|
1977
|
-
const Y = p.get(C);
|
|
1978
|
-
if (Y) return Y;
|
|
1979
|
-
const X = Pi({
|
|
1980
|
-
columnId: C,
|
|
1981
|
-
card: t,
|
|
1982
|
-
columnKeyMap: c,
|
|
1983
|
-
resultColumns: n.columns,
|
|
1984
|
-
// No temporal presentation: a flat table never formats pivot members
|
|
1985
|
-
// as dates (its temporal activation covers group columns only).
|
|
1986
|
-
metricLabelOverride: (F == null ? void 0 : F.part) === "pivot-member" ? P : void 0
|
|
1987
|
-
});
|
|
1988
|
-
return X || (Fn(C, t, c) ?? C);
|
|
1989
|
-
}, E = O.map((C) => {
|
|
1990
|
-
var K;
|
|
1991
|
-
const F = m(C), P = (F == null ? void 0 : F.part) ?? ((K = l.owners.get(C)) == null ? void 0 : K.part) ?? "base";
|
|
1992
|
-
return {
|
|
1993
|
-
outputKey: C,
|
|
1994
|
-
...F ? { columnId: F.columnId } : {},
|
|
1995
|
-
part: P,
|
|
1996
|
-
visible: !g(C) && !(F && S.has(F.columnId)),
|
|
1997
|
-
label: A(C, F),
|
|
1998
|
-
resizable: !i && as({ part: P, columnId: F == null ? void 0 : F.columnId })
|
|
1999
|
-
};
|
|
2000
|
-
}), q = Object.fromEntries(
|
|
2001
|
-
E.map((C) => [C.outputKey, C.label])
|
|
2002
|
-
), L = {
|
|
2003
|
-
...((yt = (gt = t.preferences) == null ? void 0 : gt.tablePrefs) == null ? void 0 : yt.columnSizing) ?? {}
|
|
2004
|
-
};
|
|
2005
|
-
for (const C of E) {
|
|
2006
|
-
const F = C.resizable ? (bt = T == null ? void 0 : T.widths) == null ? void 0 : bt[C.columnId] : void 0;
|
|
2007
|
-
F !== void 0 && (L[C.outputKey] = F);
|
|
2008
|
-
}
|
|
2009
|
-
const G = a === "page-only" ? [] : a === "query" ? M : (T == null ? void 0 : T.sort) ?? [], j = new Map(
|
|
2010
|
-
G.map((C) => [C.columnId, C.direction])
|
|
2011
|
-
), uo = G.flatMap((C) => {
|
|
2012
|
-
var P;
|
|
2013
|
-
const F = (P = l.entries.get(C.columnId)) == null ? void 0 : P.baseKey;
|
|
2014
|
-
return F && y.includes(F) ? [{ outputKey: F, desc: C.direction === "desc" }] : [];
|
|
2015
|
-
}), dt = !i && Or(T);
|
|
2016
|
-
let ue;
|
|
2017
|
-
if (i)
|
|
2018
|
-
ue = { available: !1, reason: i };
|
|
2019
|
-
else if (!x.length)
|
|
2020
|
-
ue = { available: !1, reason: "no-addressable-columns" };
|
|
2021
|
-
else {
|
|
2022
|
-
const C = new Set(D ?? []), F = x.filter(
|
|
2023
|
-
(P) => !S.has(P)
|
|
2024
|
-
).length;
|
|
2025
|
-
ue = {
|
|
2026
|
-
available: !0,
|
|
2027
|
-
canReset: dt,
|
|
2028
|
-
items: x.map((P) => {
|
|
2029
|
-
const K = l.entries.get(P), Y = S.has(P), X = j.get(P);
|
|
2030
|
-
return {
|
|
2031
|
-
columnId: P,
|
|
2032
|
-
label: d(P) ?? K.authorLabel,
|
|
2033
|
-
authorLabel: K.authorLabel,
|
|
2034
|
-
hidden: Y,
|
|
2035
|
-
isNew: D !== void 0 && !C.has(P),
|
|
2036
|
-
canHide: !Y && F > 1,
|
|
2037
|
-
...X ? { sort: X } : {}
|
|
2038
|
-
};
|
|
2039
|
-
})
|
|
2040
|
-
};
|
|
2041
|
-
}
|
|
2042
|
-
return {
|
|
2043
|
-
columns: E,
|
|
2044
|
-
visibleKeys: E.filter((C) => C.visible).map((C) => C.outputKey),
|
|
2045
|
-
labels: q,
|
|
2046
|
-
columnSizing: L,
|
|
2047
|
-
sortMode: a,
|
|
2048
|
-
clientSort: uo,
|
|
2049
|
-
panel: ue,
|
|
2050
|
-
...T ? { settings: T } : {},
|
|
2051
|
-
dropped: w,
|
|
2052
|
-
isCustomized: dt,
|
|
2053
|
-
canSort: i !== "card-type" && a !== "page-only",
|
|
2054
|
-
author: { order: I }
|
|
2055
|
-
};
|
|
2056
|
-
}
|
|
2057
|
-
function Ol(e, t) {
|
|
2058
|
-
var n;
|
|
2059
|
-
return (n = En(e, t)) == null ? void 0 : n.field;
|
|
2060
|
-
}
|
|
2061
|
-
function En(e, t) {
|
|
2062
|
-
const n = un(t), o = e.config;
|
|
2063
|
-
if (!n || !o) return;
|
|
2064
|
-
let r = [], i;
|
|
2065
|
-
if (n.kind === "dimension")
|
|
2066
|
-
i = n.role, r = ((n.role === "detail" ? o.detailColumns : o.groupByColumns) ?? []).filter((a) => a.id === n.fieldId);
|
|
2067
|
-
else if (n.kind === "metric")
|
|
2068
|
-
i = "metric", r = (o.metricColumns ?? []).filter(
|
|
2069
|
-
(s) => s.id === n.metricId && le(s) === n.metricAlias
|
|
2070
|
-
);
|
|
2071
|
-
else
|
|
2072
|
-
return;
|
|
2073
|
-
return r.length === 1 ? { field: r[0], role: i } : void 0;
|
|
2074
|
-
}
|
|
2075
|
-
function hs(e, t) {
|
|
2076
|
-
const n = t == null ? void 0 : t.sort;
|
|
2077
|
-
if (!n || !e.config || e.type !== "table" && e.type !== "detailTable" || ie(e) !== "config")
|
|
2078
|
-
return e.config;
|
|
2079
|
-
const o = n.flatMap((r) => {
|
|
2080
|
-
const i = En(e, r.columnId);
|
|
2081
|
-
if (!i) return [];
|
|
2082
|
-
const s = Nr(i.field, i.role);
|
|
2083
|
-
return An(e, s) ? [] : [
|
|
2084
|
-
{
|
|
2085
|
-
...i.field,
|
|
2086
|
-
alias: s,
|
|
2087
|
-
role: "sortby",
|
|
2088
|
-
direction: r.direction
|
|
2089
|
-
}
|
|
2090
|
-
];
|
|
2091
|
-
});
|
|
2092
|
-
return n.length > 0 && o.length === 0 ? e.config : { ...e.config, sortByColumns: o };
|
|
2093
|
-
}
|
|
2094
|
-
const Is = 500, vs = 250;
|
|
2095
|
-
function Le(e) {
|
|
2096
|
-
return e.type === "table" || e.type === "detailTable";
|
|
2097
|
-
}
|
|
2098
|
-
function Fs(e) {
|
|
2099
|
-
var t, n, o;
|
|
2100
|
-
return !!((t = e.sql) != null && t.trim() && Le(e) && ((o = (n = e.preferences) == null ? void 0 : n.tablePrefs) != null && o.enableDevModePagination));
|
|
2101
|
-
}
|
|
2102
|
-
function Bl(e) {
|
|
2103
|
-
return e === "export-full-with-cap" ? Is : vs;
|
|
2104
|
-
}
|
|
2105
|
-
function Ds({
|
|
2106
|
-
card: e,
|
|
2107
|
-
isTablePrintMode: t,
|
|
2108
|
-
isDocumentSectionRuntime: n,
|
|
2109
|
-
documentTableDataPolicy: o
|
|
2110
|
-
}) {
|
|
2111
|
-
var c, l;
|
|
2112
|
-
const r = n && o !== void 0 && Le(e), i = t && !r, s = Me(e.config) && Le(e) && !e.sql, a = r ? Fs(e) : !!(e.sql && ((l = (c = e.preferences) == null ? void 0 : c.tablePrefs) != null && l.enableDevModePagination));
|
|
2113
|
-
return !i && (s || a);
|
|
2114
|
-
}
|
|
2115
|
-
function Ss(e) {
|
|
2116
|
-
var t, n, o;
|
|
2117
|
-
return ((t = e.paginationConfig) == null ? void 0 : t.pageSize) || ((o = (n = e.preferences) == null ? void 0 : n.tablePrefs) == null ? void 0 : o.pageSize) || 50;
|
|
2118
|
-
}
|
|
2119
|
-
function Al({
|
|
2120
|
-
current: e,
|
|
2121
|
-
defaultPageSize: t,
|
|
2122
|
-
queryInputIdentity: n
|
|
2123
|
-
}) {
|
|
2124
|
-
return (e == null ? void 0 : e.queryInputIdentity) === n ? {
|
|
2125
|
-
page: e.page,
|
|
2126
|
-
pageSize: e.pageSize
|
|
2127
|
-
} : {
|
|
2128
|
-
page: 1,
|
|
2129
|
-
pageSize: (e == null ? void 0 : e.pageSize) ?? t
|
|
2130
|
-
};
|
|
2131
|
-
}
|
|
2132
|
-
function El(e, t, n) {
|
|
2133
|
-
return (e == null ? void 0 : e.queryInputIdentity) === n && e.page === t.page && e.pageSize === t.pageSize;
|
|
2134
|
-
}
|
|
2135
|
-
function _l(e, t) {
|
|
2136
|
-
return !e || !t || e.page === t.page && e.pageSize === t.pageSize ? e : {
|
|
2137
|
-
...e,
|
|
2138
|
-
page: t.page,
|
|
2139
|
-
pageSize: t.pageSize,
|
|
2140
|
-
hasPrevPage: t.page > 1
|
|
2141
|
-
};
|
|
2142
|
-
}
|
|
2143
|
-
function Ts(e) {
|
|
2144
|
-
return { page: 1, pageSize: Ss(e) };
|
|
2145
|
-
}
|
|
2146
|
-
function Ms(e) {
|
|
2147
|
-
var s, a, c, l, d;
|
|
2148
|
-
const { card: t } = e, n = Ds({
|
|
2149
|
-
card: t,
|
|
2150
|
-
isTablePrintMode: ((s = e.display) == null ? void 0 : s.isTablePrintMode) ?? !1,
|
|
2151
|
-
isDocumentSectionRuntime: !!e.documentSection,
|
|
2152
|
-
documentTableDataPolicy: (a = e.documentSection) == null ? void 0 : a.documentTableDataPolicy
|
|
2153
|
-
}), { page: o } = e, r = e.documentSection && !e.documentSection.totalsRow ? void 0 : ko(t, e.finalConfig), i = !!((c = e.display) != null && c.deliveryStrict && e.display.isTablePrintMode && !e.documentSection && zr(t.type));
|
|
2154
|
-
return {
|
|
2155
|
-
...r ? { tableTotalsRequest: r } : {},
|
|
2156
|
-
...i ? { sourceRowProbe: { limit: Gr.maxTableRows } } : {},
|
|
2157
|
-
...n ? {
|
|
2158
|
-
pagination: {
|
|
2159
|
-
page: (o == null ? void 0 : o.page) || 1,
|
|
2160
|
-
pageSize: (o == null ? void 0 : o.pageSize) || ((d = (l = t.preferences) == null ? void 0 : l.tablePrefs) == null ? void 0 : d.pageSize) || 50
|
|
2161
|
-
}
|
|
2162
|
-
} : {}
|
|
2163
|
-
};
|
|
2164
|
-
}
|
|
2165
|
-
function Vs(e, t = {}) {
|
|
2166
|
-
var r, i, s;
|
|
2167
|
-
const n = ((r = e.connectionId) == null ? void 0 : r.trim()) || void 0;
|
|
2168
|
-
if (t.editorDevMode) return n;
|
|
2169
|
-
const o = ((s = (i = e.dataSource) == null ? void 0 : i.connectionId) == null ? void 0 : s.trim()) || void 0;
|
|
2170
|
-
return e.sql ? n || o : o || n;
|
|
2171
|
-
}
|
|
2172
|
-
function ks(e, t) {
|
|
2173
|
-
var n;
|
|
2174
|
-
return {
|
|
2175
|
-
connectionId: t,
|
|
2176
|
-
connectionType: ((n = e.dataSource) == null ? void 0 : n.connectionType) || "unknown",
|
|
2177
|
-
mode: "database",
|
|
2178
|
-
selectedEntities: []
|
|
2179
|
-
};
|
|
2180
|
-
}
|
|
2181
|
-
function Rl(e, t, n = {}) {
|
|
2182
|
-
const o = Vs(e, n);
|
|
2183
|
-
if (!o)
|
|
2184
|
-
throw new Error("No connection ID found for card");
|
|
2185
|
-
const r = t.cardDataSource || e.dataSource;
|
|
2186
|
-
return {
|
|
2187
|
-
connectionId: o,
|
|
2188
|
-
requestPayloadBase: {
|
|
2189
|
-
...t,
|
|
2190
|
-
cardDataSource: n.liveDataSource ? r : r || ks(e, o)
|
|
2191
|
-
}
|
|
2192
|
-
};
|
|
2193
|
-
}
|
|
2194
|
-
const Ps = /* @__PURE__ */ new Set([
|
|
2195
|
-
"day",
|
|
2196
|
-
"week",
|
|
2197
|
-
"month",
|
|
2198
|
-
"quarter",
|
|
2199
|
-
"year",
|
|
2200
|
-
"hour",
|
|
2201
|
-
"minute",
|
|
2202
|
-
"second"
|
|
2203
|
-
]);
|
|
2204
|
-
function xs(e) {
|
|
2205
|
-
let t = e.spec;
|
|
2206
|
-
const n = zt(
|
|
2207
|
-
e.controlDefinitions || [],
|
|
2208
|
-
e.cardControlDefinitions || []
|
|
2209
|
-
), o = (e.controlBindings || []).filter(
|
|
2210
|
-
(m) => m.target !== "sql_param"
|
|
2211
|
-
), r = o.filter(
|
|
2212
|
-
(m) => m.target === "config_metric_selector" || m.target === "config_field_selector"
|
|
2213
|
-
), i = o.filter(
|
|
2214
|
-
(m) => m.target === "config_grain" || m.target === "config_aggregation"
|
|
2215
|
-
), s = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map();
|
|
2216
|
-
let c;
|
|
2217
|
-
const l = () => {
|
|
2218
|
-
if (c) return c;
|
|
2219
|
-
const m = e.catalog, y = /* @__PURE__ */ new Map();
|
|
2220
|
-
for (const b of m) {
|
|
2221
|
-
const I = y.get(b.id) ?? [];
|
|
2222
|
-
y.set(b.id, [...I, b]);
|
|
2223
|
-
}
|
|
2224
|
-
return c = { refs: m, byId: y }, c;
|
|
2225
|
-
}, d = (m, y) => {
|
|
2226
|
-
throw new Ao(m, {
|
|
2227
|
-
code: Eo,
|
|
2228
|
-
...y ? { controlId: y } : {}
|
|
2229
|
-
});
|
|
2230
|
-
}, u = (m, y) => {
|
|
2231
|
-
var I;
|
|
2232
|
-
if (m.derivedField) return m.derivedField.dataType;
|
|
2233
|
-
const b = l().refs.filter((v) => v.field.name === m.name && _e(v.field.source ?? e.spec.source, m.source ?? e.spec.source));
|
|
2234
|
-
return b.length > 1 ? d("The selected field is ambiguous in the authorized Matrix field catalog.", y) : se(((I = b[0]) == null ? void 0 : I.field.dataType) ?? m.dataType);
|
|
2235
|
-
}, f = (m, y) => Po(m, y.target, (b) => u(b, y.controlId)), p = br.safeParse(t);
|
|
2236
|
-
if (!p.success) return d(p.error.message);
|
|
2237
|
-
t = p.data;
|
|
2238
|
-
const g = [...r, ...i].map((m) => {
|
|
2239
|
-
const y = Gt({ binding: m, definitions: n, controlValues: e.controlValues }), b = !m.matrixTargetId && y !== void 0 && y !== Re ? f(p.data, m) : [];
|
|
2240
|
-
return {
|
|
2241
|
-
binding: m,
|
|
2242
|
-
selectedValue: y,
|
|
2243
|
-
targetId: m.matrixTargetId ?? (b.length === 1 ? b[0].id : void 0)
|
|
2244
|
-
};
|
|
2245
|
-
});
|
|
2246
|
-
for (const { binding: m, targetId: y, selectedValue: b } of g) {
|
|
2247
|
-
if (b === void 0 || b === Re)
|
|
2248
|
-
continue;
|
|
2249
|
-
const I = (D) => d(D, m.controlId), v = m.target === "config_metric_selector" || m.target === "config_aggregation", M = f(t, m);
|
|
2250
|
-
(!y || !M.some((D) => D.id === y)) && I("Choose a valid Matrix level or measure target for this control.");
|
|
2251
|
-
const h = `${m.target}:${y}`;
|
|
2252
|
-
s.has(h) && I("Multiple controls cannot replace the same Matrix target."), s.add(h);
|
|
2253
|
-
const w = (D) => {
|
|
2254
|
-
const V = (l().byId.get(D.id) ?? []).filter((x) => !D.source || _e(D.source, x.field.source ?? e.spec.source));
|
|
2255
|
-
if (V.length !== 1) return I(V.length ? "The selected field is ambiguous in the authorized Matrix field catalog." : "The selected field is not in the authorized Matrix field catalog.");
|
|
2256
|
-
const O = hr.safeParse(V[0].field);
|
|
2257
|
-
return O.success ? O.data : I(O.error.message);
|
|
2258
|
-
}, B = m.target === "config_metric_selector" || m.target === "config_field_selector" ? m.mapping[b] : void 0, T = B && typeof B == "object" && "kind" in B && B.kind === "matrix_instance" ? B.id : void 0;
|
|
2259
|
-
if (v) {
|
|
2260
|
-
a.set(y, m.controlId);
|
|
2261
|
-
const D = T === void 0 ? void 0 : p.data.measures.find(
|
|
2262
|
-
(S) => S.id === T && S.kind === "aggregate"
|
|
2263
|
-
);
|
|
2264
|
-
T !== void 0 && !D && I("The selected Matrix aggregate measure is no longer available.");
|
|
2265
|
-
const V = m.target === "config_metric_selector" && !D ? xo({ binding: m, selectedValue: b }) : void 0, O = ((D == null ? void 0 : D.kind) === "aggregate" ? D.aggregate : V == null ? void 0 : V.aggregate) ?? (m.target === "config_aggregation" ? Ct({ binding: m, selectedValue: b }) : void 0), x = O === void 0 ? void 0 : Cr.safeParse(O);
|
|
2266
|
-
x && !x.success && I("This aggregation is not supported by Matrix."), t = {
|
|
2267
|
-
...t,
|
|
2268
|
-
measures: t.measures.map(
|
|
2269
|
-
(S) => S.id !== y || S.kind !== "aggregate" ? S : {
|
|
2270
|
-
...S,
|
|
2271
|
-
...V ? { field: w(V) } : {},
|
|
2272
|
-
...(D == null ? void 0 : D.kind) === "aggregate" ? { field: D.field } : {},
|
|
2273
|
-
aggregate: x != null && x.success ? x.data : S.aggregate
|
|
2274
|
-
}
|
|
2275
|
-
)
|
|
2276
|
-
};
|
|
2277
|
-
} else {
|
|
2278
|
-
const D = T === void 0 ? void 0 : [...p.data.rows, ...p.data.columns].find(
|
|
2279
|
-
(S) => S.id === T
|
|
2280
|
-
);
|
|
2281
|
-
T !== void 0 && !D && I("The selected Matrix level is no longer available.");
|
|
2282
|
-
const V = m.target === "config_field_selector" && !D ? wo({ binding: m, selectedValue: b }) : void 0, O = m.target === "config_grain" ? Ct({ binding: m, selectedValue: b }) : D ? D.grain : V == null ? void 0 : V.granularity;
|
|
2283
|
-
O !== void 0 && !Ps.has(O) && I("This time grain is not supported by Matrix.");
|
|
2284
|
-
const x = (S) => S.map((k) => {
|
|
2285
|
-
if (k.id !== y) return k;
|
|
2286
|
-
const A = (D == null ? void 0 : D.field) ?? (V ? w(V) : k.field), E = u(A, m.controlId), q = O ?? (V && be(E) ? k.grain : void 0);
|
|
2287
|
-
return q && !be(E) && I("A time grain requires a temporal Matrix level."), { ...k, field: A, grain: q };
|
|
2288
|
-
});
|
|
2289
|
-
t = {
|
|
2290
|
-
...t,
|
|
2291
|
-
rows: x(t.rows),
|
|
2292
|
-
columns: x(t.columns)
|
|
2293
|
-
};
|
|
2294
|
-
}
|
|
2295
|
-
}
|
|
2296
|
-
for (const [m, y] of Array.from(a)) {
|
|
2297
|
-
const b = t.measures.find((v) => v.id === m);
|
|
2298
|
-
if (!b || b.kind !== "aggregate") continue;
|
|
2299
|
-
const I = u(b.field, y);
|
|
2300
|
-
Oo(I).some((v) => v.value === b.aggregate) || d(`Aggregation '${b.aggregate}' is not eligible for this Matrix field datatype.`, y);
|
|
2301
|
-
}
|
|
2302
|
-
try {
|
|
2303
|
-
return Bo(p.data, t);
|
|
2304
|
-
} catch (m) {
|
|
2305
|
-
if (m instanceof Tr) return d(m.message);
|
|
2306
|
-
throw m;
|
|
2307
|
-
}
|
|
2308
|
-
}
|
|
2309
|
-
function _n(e, t) {
|
|
2310
|
-
const n = [], o = (r) => {
|
|
2311
|
-
if (r.source) {
|
|
2312
|
-
const i = Ir.safeParse(r.source);
|
|
2313
|
-
if (i.success) n.push(i.data);
|
|
2314
|
-
else if (t) throw i.error;
|
|
2315
|
-
}
|
|
2316
|
-
r.derivedField && Object.values(r.derivedField.inputs).forEach((i) => o(i.field));
|
|
2317
|
-
};
|
|
2318
|
-
for (const r of e) {
|
|
2319
|
-
if (r.target !== "config_field_selector" && r.target !== "config_metric_selector") continue;
|
|
2320
|
-
const i = t == null ? void 0 : t.get(r), s = t ? i && i !== Re ? [r.mapping[i]] : [] : Object.values(r.mapping);
|
|
2321
|
-
for (const a of s)
|
|
2322
|
-
a && "role" in a && o(a);
|
|
2323
|
-
}
|
|
2324
|
-
return n;
|
|
2325
|
-
}
|
|
2326
|
-
function ws(e, t = [], n = []) {
|
|
2327
|
-
return Xt([...Ht(e), ..._n(t), ...n]);
|
|
2328
|
-
}
|
|
2329
|
-
function Os(e, t = {}) {
|
|
2330
|
-
const n = t.controlBindings ?? [], o = zt(t.controlDefinitions ?? [], t.cardControlDefinitions ?? []), r = new Map(n.filter((i) => i.target === "config_field_selector" || i.target === "config_metric_selector").map((i) => [i, Gt({ binding: i, definitions: o, controlValues: t.controlValues })]));
|
|
2331
|
-
return Xt([...Ht(e), ..._n(n, r)]);
|
|
2332
|
-
}
|
|
2333
|
-
function Bs(e, t) {
|
|
2334
|
-
return ze(e) ? As(e, t) : e.config ?? {};
|
|
2335
|
-
}
|
|
2336
|
-
function As(e, t) {
|
|
2337
|
-
var o;
|
|
2338
|
-
const n = (o = t == null ? void 0 : t.steps[t.steps.length - 1]) == null ? void 0 : o.toField;
|
|
2339
|
-
return n ? Ii(e.config ?? {}, n, {
|
|
2340
|
-
sortPolicy: "retargetDimensionSort"
|
|
2341
|
-
}) : e.config ?? {};
|
|
2342
|
-
}
|
|
2343
|
-
function Es(e, t) {
|
|
2344
|
-
const n = (e == null ? void 0 : e.steps) ?? [];
|
|
2345
|
-
if (n.length !== 0)
|
|
2346
|
-
return {
|
|
2347
|
-
id: `${t}-drill-root`,
|
|
2348
|
-
logicalOperator: "AND",
|
|
2349
|
-
negate: !1,
|
|
2350
|
-
conditions: [],
|
|
2351
|
-
groups: n.map((o, r) => ({
|
|
2352
|
-
id: `breadcrumb-${r}`,
|
|
2353
|
-
logicalOperator: "OR",
|
|
2354
|
-
negate: !1,
|
|
2355
|
-
conditions: [],
|
|
2356
|
-
groups: [
|
|
2357
|
-
{
|
|
2358
|
-
id: `breadcrumb-${r}-group-0`,
|
|
2359
|
-
logicalOperator: "AND",
|
|
2360
|
-
negate: !1,
|
|
2361
|
-
conditions: o.conditions.map(
|
|
2362
|
-
(i) => Hr(
|
|
2363
|
-
i,
|
|
2364
|
-
`${i.field.id}-${i.value}`
|
|
2365
|
-
)
|
|
2366
|
-
),
|
|
2367
|
-
groups: []
|
|
2368
|
-
}
|
|
2369
|
-
]
|
|
2370
|
-
}))
|
|
2371
|
-
};
|
|
2372
|
-
}
|
|
2373
|
-
const we = (e) => typeof e == "object" && e !== null && !Array.isArray(e);
|
|
2374
|
-
function te(e) {
|
|
2375
|
-
return e instanceof Date ? JSON.stringify(Number.isNaN(e.getTime()) ? null : e.toISOString()) : Array.isArray(e) ? `[${e.map(te).join(",")}]` : we(e) ? `{${Object.keys(e).sort().filter((t) => e[t] !== void 0).map((t) => `${JSON.stringify(t)}:${te(e[t])}`).join(",")}}` : JSON.stringify(e) ?? "null";
|
|
2376
|
-
}
|
|
2377
|
-
function _s(e) {
|
|
2378
|
-
const t = e;
|
|
2379
|
-
return t.valueType === "date" || t.relativeMeta !== void 0 || t.temporalBucket !== void 0 || be(t.dataType);
|
|
2380
|
-
}
|
|
2381
|
-
function Rs(e) {
|
|
2382
|
-
const t = we(e.field) ? e.field : void 0;
|
|
2383
|
-
return e.temporalBucket !== void 0 || e.rawTemporal !== void 0 || e.relativeMeta !== void 0 || be(t == null ? void 0 : t.dataType);
|
|
2384
|
-
}
|
|
2385
|
-
function Rn(e) {
|
|
2386
|
-
return e ? [...(e.conditions ?? []).filter(Rs).map((n) => {
|
|
2387
|
-
const o = we(n.field) ? n.field : {};
|
|
2388
|
-
return {
|
|
2389
|
-
field: o.qualifiedFieldName ?? o.name,
|
|
2390
|
-
operator: n.operator,
|
|
2391
|
-
value: n.value,
|
|
2392
|
-
temporalBucket: n.temporalBucket,
|
|
2393
|
-
rawTemporal: n.rawTemporal,
|
|
2394
|
-
relativeMeta: n.relativeMeta
|
|
2395
|
-
};
|
|
2396
|
-
}), ...(e.groups ?? []).flatMap((n) => Rn(n))] : [];
|
|
2397
|
-
}
|
|
2398
|
-
function Bt(e) {
|
|
2399
|
-
const t = e.filterValues.filter(_s).map((o) => {
|
|
2400
|
-
const r = o, i = we(r.fieldMeta) ? r.fieldMeta : void 0;
|
|
2401
|
-
return {
|
|
2402
|
-
field: (i == null ? void 0 : i.qualifiedFieldName) ?? r.name,
|
|
2403
|
-
operation: r.operation,
|
|
2404
|
-
...r.relativeMeta !== void 0 ? { relativeMeta: r.relativeMeta } : { values: r.values },
|
|
2405
|
-
temporalBucket: r.temporalBucket
|
|
2406
|
-
};
|
|
2407
|
-
}), n = Rn(e.selectionFilters);
|
|
2408
|
-
return te({
|
|
2409
|
-
values: t.map(te).sort(),
|
|
2410
|
-
conditions: n.map(te).sort(),
|
|
2411
|
-
...e.zoom ? { zoom: [e.zoom.from, e.zoom.to] } : {}
|
|
2412
|
-
});
|
|
2413
|
-
}
|
|
2414
|
-
function Ks(e, t, n) {
|
|
2415
|
-
if (!t || n.drillActive || t.madeUnder !== n.currentFingerprint) return e;
|
|
2416
|
-
const o = e.groupByColumns ?? [];
|
|
2417
|
-
return o.some((r) => r.id === t.fieldId && r.grainMode === "automatic") ? {
|
|
2418
|
-
...e,
|
|
2419
|
-
groupByColumns: o.map((r) => {
|
|
2420
|
-
if (r.id !== t.fieldId || r.grainMode !== "automatic") return r;
|
|
2421
|
-
const { grainMode: i, ...s } = r;
|
|
2422
|
-
return { ...s, granularity: t.granularity };
|
|
2423
|
-
})
|
|
2424
|
-
} : e;
|
|
2425
|
-
}
|
|
2426
|
-
function Kl(e) {
|
|
2427
|
-
var t;
|
|
2428
|
-
return (((t = e.config) == null ? void 0 : t.groupByColumns) ?? []).find(
|
|
2429
|
-
(n) => n.grainMode === "automatic" && _o({ cardType: e.type, configBacked: !0, shelf: "groupBy", dataType: n.dataType }).ok
|
|
2430
|
-
);
|
|
2431
|
-
}
|
|
2432
|
-
function qs(e, t) {
|
|
2433
|
-
if (!e || !t || t.id !== e.fieldId || vr(t)) return;
|
|
2434
|
-
const {
|
|
2435
|
-
granularity: n,
|
|
2436
|
-
grainMode: o,
|
|
2437
|
-
dateFormat: r,
|
|
2438
|
-
timeDrillPath: i,
|
|
2439
|
-
...s
|
|
2440
|
-
} = t;
|
|
2441
|
-
return {
|
|
2442
|
-
id: `zoom:${e.fieldId}`,
|
|
2443
|
-
logicalOperator: "AND",
|
|
2444
|
-
negate: !1,
|
|
2445
|
-
conditions: [
|
|
2446
|
-
{
|
|
2447
|
-
id: `zoom:${e.fieldId}:range`,
|
|
2448
|
-
field: s,
|
|
2449
|
-
operator: "between",
|
|
2450
|
-
value: [e.from, e.to],
|
|
2451
|
-
viewerZoom: !0
|
|
2452
|
-
}
|
|
2453
|
-
],
|
|
2454
|
-
groups: []
|
|
2455
|
-
};
|
|
2456
|
-
}
|
|
2457
|
-
function ql(e, t, n) {
|
|
2458
|
-
const o = It(e, n), r = It(t, n);
|
|
2459
|
-
if (!o || !r) return;
|
|
2460
|
-
const [i, s] = o.first <= r.first ? [o, r] : [r, o];
|
|
2461
|
-
return { from: i.first, to: s.last };
|
|
2462
|
-
}
|
|
2463
|
-
function Ns(e, t, n) {
|
|
2464
|
-
if (!e || e.madeUnder !== n) return;
|
|
2465
|
-
const o = t == null ? void 0 : t.find((i) => i.id === e.fieldId && i.grainMode === "automatic"), r = qs(e, o);
|
|
2466
|
-
return r ? { zoom: e, filterGroup: r } : void 0;
|
|
2467
|
-
}
|
|
2468
|
-
function Nl(e, t, n) {
|
|
2469
|
-
if (!e) return;
|
|
2470
|
-
const [o, r] = t <= n ? [t, n] : [n, t];
|
|
2471
|
-
if (o < 0 || r >= e.length) return;
|
|
2472
|
-
const i = e.slice(o, r + 1);
|
|
2473
|
-
if (!i.every((d) => typeof d == "string" && d !== "")) return;
|
|
2474
|
-
const s = [...i].sort(), a = s[0], c = s[s.length - 1];
|
|
2475
|
-
return e.some(
|
|
2476
|
-
(d, u) => (u < o || u > r) && typeof d == "string" && d > a && d < c
|
|
2477
|
-
) ? void 0 : { first: a, last: c };
|
|
2478
|
-
}
|
|
2479
|
-
function Ll(e, t, n) {
|
|
2480
|
-
if (!t || !n) return { from: e.from, to: e.to };
|
|
2481
|
-
const o = Dt(new Date(t.startInclusive), n), r = Dt(new Date(Date.parse(t.endExclusive) - 1), n), i = e.from < o ? o : e.from, s = e.to > r ? r : e.to;
|
|
2482
|
-
return i <= s ? { from: i, to: s } : { from: e.from, to: e.to };
|
|
2483
|
-
}
|
|
2484
|
-
function jl(e, t, n) {
|
|
2485
|
-
const o = (i) => /* @__PURE__ */ new Date(`${i}T00:00:00.000Z`), r = new Intl.DateTimeFormat(t, { dateStyle: n, timeZone: "UTC" });
|
|
2486
|
-
return e.from === e.to ? r.format(o(e.from)) : r.formatRange(o(e.from), o(e.to));
|
|
2487
|
-
}
|
|
2488
|
-
function rt(e) {
|
|
2489
|
-
return e === "in" || e === "not in";
|
|
2490
|
-
}
|
|
2491
|
-
function it(e) {
|
|
2492
|
-
return e === "not in" ? "exclude" : "include";
|
|
2493
|
-
}
|
|
2494
|
-
function Ls(e) {
|
|
2495
|
-
return e === "exclude" ? "not in" : "in";
|
|
2496
|
-
}
|
|
2497
|
-
function zl(e) {
|
|
2498
|
-
var n;
|
|
2499
|
-
const t = (n = e.liveValue) == null ? void 0 : n.operation;
|
|
2500
|
-
return rt(t) ? it(t) : e.pendingMode ?? e.authoredMode;
|
|
2501
|
-
}
|
|
2502
|
-
function js(e) {
|
|
2503
|
-
var o;
|
|
2504
|
-
let t = !1;
|
|
2505
|
-
const n = (o = e.inputs) == null ? void 0 : o.map((r) => {
|
|
2506
|
-
if (r.kind !== "filter" || !r.filter) return r;
|
|
2507
|
-
const i = zs(
|
|
2508
|
-
r.filter,
|
|
2509
|
-
new Set(Gs(e.defaultInputValues, r))
|
|
2510
|
-
);
|
|
2511
|
-
return i === r.filter ? r : (t = !0, { ...r, filter: i });
|
|
2512
|
-
});
|
|
2513
|
-
return t ? { ...e, inputs: n } : e;
|
|
2514
|
-
}
|
|
2515
|
-
function zs(e, t) {
|
|
2516
|
-
if (t.size !== 1 || !rt(e.operation))
|
|
2517
|
-
return e;
|
|
2518
|
-
const [n] = t;
|
|
2519
|
-
return it(e.operation) === n ? e : { ...e, operation: Ls(n) };
|
|
2520
|
-
}
|
|
2521
|
-
function Gs(e, t) {
|
|
2522
|
-
var r;
|
|
2523
|
-
const n = (i) => Object.values(i ?? {}).map((s) => s[t.id]);
|
|
2524
|
-
return (t.runtimeScope === "shared" ? [(r = e == null ? void 0 : e.shared) == null ? void 0 : r[t.id]] : t.runtimeScope === "perSheet" ? n(e == null ? void 0 : e.bySheetId) : t.runtimeScope === "perCard" ? n(e == null ? void 0 : e.byCardId) : t.runtimeScope === "perDocumentSection" ? n(e == null ? void 0 : e.byDocumentSectionId) : []).flatMap(
|
|
2525
|
-
(i) => (i == null ? void 0 : i.status) === "set" && i.value.kind === "filter" ? Hs(i.value.filterValue) : []
|
|
2526
|
-
);
|
|
2527
|
-
}
|
|
2528
|
-
function Hs(e) {
|
|
2529
|
-
return rt(e.operation) ? [it(e.operation)] : [];
|
|
2530
|
-
}
|
|
2531
|
-
function Gl(e) {
|
|
2532
|
-
const t = nn(e), o = N(t).issues.length ? t : Ha(t);
|
|
2533
|
-
return Ci(js(o)).dashboard;
|
|
2534
|
-
}
|
|
2535
|
-
function st(e, t) {
|
|
2536
|
-
const n = {};
|
|
2537
|
-
for (const o of an(e)) {
|
|
2538
|
-
if (!o.inlineFilters || o.inlineFilters.length === 0)
|
|
2539
|
-
continue;
|
|
2540
|
-
const r = [];
|
|
2541
|
-
for (const i of o.inlineFilters) {
|
|
2542
|
-
const s = Ro(i, t);
|
|
2543
|
-
s && r.push(s);
|
|
2544
|
-
}
|
|
2545
|
-
r.length > 0 && (n[o.id] = r);
|
|
2546
|
-
}
|
|
2547
|
-
return n;
|
|
2548
|
-
}
|
|
2549
|
-
function re(e) {
|
|
2550
|
-
const t = Ve(e ?? {}), n = [];
|
|
2551
|
-
for (const [o, r] of Object.entries(t.shared ?? {}))
|
|
2552
|
-
n.push({ scope: "shared", target: null, inputId: o, slot: r });
|
|
2553
|
-
for (const o of ["bySheetId", "byCardId"])
|
|
2554
|
-
for (const [r, i] of Object.entries(t[o] ?? {}))
|
|
2555
|
-
for (const [s, a] of Object.entries(i))
|
|
2556
|
-
n.push({ scope: o, target: r, inputId: s, slot: a });
|
|
2557
|
-
return n;
|
|
2558
|
-
}
|
|
2559
|
-
function De(e, t, n) {
|
|
2560
|
-
const o = e;
|
|
2561
|
-
if (t.scope === "shared") {
|
|
2562
|
-
o.shared = { ...o.shared, [t.inputId]: n };
|
|
2563
|
-
return;
|
|
2564
|
-
}
|
|
2565
|
-
const r = { ...o[t.scope] ?? {} };
|
|
2566
|
-
r[t.target] = { ...r[t.target], [t.inputId]: n }, o[t.scope] = r;
|
|
2567
|
-
}
|
|
2568
|
-
function Kn(e, t, n) {
|
|
2569
|
-
const o = Ut(
|
|
2570
|
-
e,
|
|
2571
|
-
t.controlOverrides,
|
|
2572
|
-
{ hasExplicitRuntimeOverrides: t.controlOverrides !== void 0 }
|
|
2573
|
-
);
|
|
2574
|
-
return {
|
|
2575
|
-
adHocFilterValues: [...t.adHocFilterValues],
|
|
2576
|
-
controlValues: o.dashboardControlValues,
|
|
2577
|
-
cardControlValuesMap: o.cardControlValuesMap,
|
|
2578
|
-
dashboardInputValues: t.dashboardInputValues,
|
|
2579
|
-
inlineFilterValuesMap: t.inlineFilterValuesMap ?? st(e, n)
|
|
2580
|
-
};
|
|
2581
|
-
}
|
|
2582
|
-
function at(e, t, n) {
|
|
2583
|
-
return qn(
|
|
2584
|
-
e,
|
|
2585
|
-
Kn(e, t, n),
|
|
2586
|
-
n
|
|
2587
|
-
);
|
|
2588
|
-
}
|
|
2589
|
-
function Hl(e, t, n) {
|
|
2590
|
-
return qn(e, t, n);
|
|
2591
|
-
}
|
|
2592
|
-
function qn(e, t, n) {
|
|
2593
|
-
const o = e.sheets ?? [], r = o.filter((a) => (a.kind ?? "dashboard") === "dashboard").map((a) => a.id), i = o.filter((a) => a.kind === "document"), s = r.length ? qo({
|
|
2594
|
-
dashboard: e,
|
|
2595
|
-
sheetIds: r,
|
|
2596
|
-
mode: "dashboard",
|
|
2597
|
-
runtimeValues: t,
|
|
2598
|
-
transientContexts: void 0,
|
|
2599
|
-
calendar: n ?? null
|
|
2600
|
-
}).snapshot.dashboardInputValues : {};
|
|
2601
|
-
return i.reduce(
|
|
2602
|
-
(a, c) => {
|
|
2603
|
-
var l;
|
|
2604
|
-
return $e(
|
|
2605
|
-
a,
|
|
2606
|
-
No({
|
|
2607
|
-
dashboard: e,
|
|
2608
|
-
sheetId: c.id,
|
|
2609
|
-
sheetKind: "document",
|
|
2610
|
-
mode: "document",
|
|
2611
|
-
sectionIds: (((l = c.document) == null ? void 0 : l.sections) ?? []).map(
|
|
2612
|
-
(d) => d.id
|
|
2613
|
-
),
|
|
2614
|
-
runtimeValues: t,
|
|
2615
|
-
transientContexts: void 0,
|
|
2616
|
-
calendar: n ?? null
|
|
2617
|
-
}).snapshot.dashboardInputValues
|
|
2618
|
-
);
|
|
2619
|
-
},
|
|
2620
|
-
s
|
|
2621
|
-
);
|
|
2622
|
-
}
|
|
2623
|
-
function Nn(e, t) {
|
|
2624
|
-
const n = {}, o = {}, r = /* @__PURE__ */ new Map();
|
|
2625
|
-
for (const i of re(t)) {
|
|
2626
|
-
const s = e.get(i.inputId), { slot: a } = i, c = () => a.status === "set" && a.value.kind === "filter" ? a.value.filterValue : a.status === "cleared" ? null : void 0;
|
|
2627
|
-
if ((s == null ? void 0 : s.source) === "cardInlineFilter") {
|
|
2628
|
-
const l = c();
|
|
2629
|
-
if (l !== void 0) {
|
|
2630
|
-
const d = r.get(s.cardId) ?? /* @__PURE__ */ new Map();
|
|
2631
|
-
d.set(s.filterId, l), r.set(s.cardId, d);
|
|
2632
|
-
}
|
|
2633
|
-
} else if ((s == null ? void 0 : s.source) === "dashboardControl" || (s == null ? void 0 : s.source) === "cardControl")
|
|
2634
|
-
a.status === "set" && a.value.kind === "control" ? o[s.controlId] = a.value.value : a.status === "cleared" && (o[s.controlId] = void 0);
|
|
2635
|
-
else {
|
|
2636
|
-
De(n, i, a);
|
|
2637
|
-
continue;
|
|
2638
|
-
}
|
|
2639
|
-
a.comparisonSelection && De(n, i, {
|
|
2640
|
-
comparisonSelection: a.comparisonSelection
|
|
2641
|
-
});
|
|
2642
|
-
}
|
|
2643
|
-
return {
|
|
2644
|
-
runtime: Ve(n),
|
|
2645
|
-
controlValues: o,
|
|
2646
|
-
inlineFilterValues: r
|
|
2647
|
-
};
|
|
2648
|
-
}
|
|
2649
|
-
function Us(e, t) {
|
|
2650
|
-
if (!t.size) return [...e];
|
|
2651
|
-
const n = e.filter((r) => !t.has(r.filterId)), o = [...t.values()].filter(
|
|
2652
|
-
(r) => r !== null
|
|
2653
|
-
);
|
|
2654
|
-
return Lo(n, o);
|
|
2655
|
-
}
|
|
2656
|
-
function Ln(e, t, n) {
|
|
2657
|
-
if (!Object.keys(n).length) return t;
|
|
2658
|
-
const o = Ut(
|
|
2659
|
-
e,
|
|
2660
|
-
t,
|
|
2661
|
-
{ hasExplicitRuntimeOverrides: t !== void 0 }
|
|
2662
|
-
);
|
|
2663
|
-
return {
|
|
2664
|
-
...Ko({
|
|
2665
|
-
dashboardValues: o.dashboardControlValues,
|
|
2666
|
-
cardValuesMap: o.cardControlValuesMap
|
|
2667
|
-
}),
|
|
2668
|
-
...n
|
|
2669
|
-
};
|
|
2670
|
-
}
|
|
2671
|
-
function $s(e, t) {
|
|
2672
|
-
if (!t.size) return;
|
|
2673
|
-
const n = Object.fromEntries(
|
|
2674
|
-
Object.entries(e).map(([o, r]) => [o, [...r]])
|
|
2675
|
-
);
|
|
2676
|
-
for (const [o, r] of t)
|
|
2677
|
-
n[o] = Us(n[o] ?? [], r);
|
|
2678
|
-
return n;
|
|
2679
|
-
}
|
|
2680
|
-
function Qs(e, t, n) {
|
|
2681
|
-
const o = new Map(
|
|
2682
|
-
Q(e).map(({ card: s }) => [
|
|
2683
|
-
s.id,
|
|
2684
|
-
new Map((s.inlineFilters ?? []).map((a) => [a.id, a]))
|
|
2685
|
-
])
|
|
2686
|
-
);
|
|
2687
|
-
let r = !1;
|
|
2688
|
-
const i = Object.fromEntries(
|
|
2689
|
-
Object.entries(t).map(([s, a]) => [s, [...a]])
|
|
2690
|
-
);
|
|
2691
|
-
for (const [s, a] of Object.entries(n)) {
|
|
2692
|
-
const c = o.get(s), l = (a ?? []).filter((d) => {
|
|
2693
|
-
const u = c == null ? void 0 : c.get(d.filterId);
|
|
2694
|
-
return u ? Ue(u, d) : !1;
|
|
2695
|
-
});
|
|
2696
|
-
ke(l, i[s] ?? []) || (r = !0), i[s] = l;
|
|
2697
|
-
}
|
|
2698
|
-
return r ? i : void 0;
|
|
2699
|
-
}
|
|
2700
|
-
function Ul(e) {
|
|
2701
|
-
const { dashboard: t, capture: n, calendar: o } = e, r = co(t, n.filterValues, {
|
|
2702
|
-
calendar: o
|
|
2703
|
-
}), i = n.dashboardInputExecutionSnapshot, s = n.controlValues, a = {
|
|
2704
|
-
...Kn(
|
|
2705
|
-
t,
|
|
2706
|
-
{
|
|
2707
|
-
adHocFilterValues: r.adHocFilterValues,
|
|
2708
|
-
controlOverrides: s,
|
|
2709
|
-
// The snapshot replays exactly over the listed values.
|
|
2710
|
-
dashboardInputValues: i ? $e(
|
|
2711
|
-
r.slots,
|
|
2712
|
-
zo({
|
|
2713
|
-
dashboard: t,
|
|
2714
|
-
dashboardInputValues: i.dashboardInputValues,
|
|
2715
|
-
sheetId: i.sheetId,
|
|
2716
|
-
cardId: i.cardId
|
|
2717
|
-
})
|
|
2718
|
-
) : r.slots
|
|
2719
|
-
},
|
|
2720
|
-
o
|
|
2721
|
-
),
|
|
2722
|
-
cardViewState: i ? jo(i.cardViewState) : {}
|
|
2723
|
-
}, c = i ? Go(i.transientContexts) : void 0;
|
|
2724
|
-
return {
|
|
2725
|
-
runtimeValues: a,
|
|
2726
|
-
controlOverrides: s,
|
|
2727
|
-
...c != null && c.length ? { transientContexts: c } : {}
|
|
2728
|
-
};
|
|
2729
|
-
}
|
|
2730
|
-
function $l(e, t) {
|
|
2731
|
-
const { controlContractOverrides: n, cardId: o } = t;
|
|
2732
|
-
if (!n || (n.controlDefinitions !== void 0 && (e.controls = n.controlDefinitions), typeof o != "string" || o.trim().length === 0))
|
|
2733
|
-
return e;
|
|
2734
|
-
const r = ae(e, o);
|
|
2735
|
-
return r && (n.cardControlDefinitions !== void 0 && (r.controls = n.cardControlDefinitions), n.controlBindings !== void 0 && (r.controlBindings = n.controlBindings)), e;
|
|
2736
|
-
}
|
|
2737
|
-
const Ws = ["bySheetId", "byCardId", "byDocumentSectionId"];
|
|
2738
|
-
function Js(e, t) {
|
|
2739
|
-
const n = N(e);
|
|
2740
|
-
let o = !1;
|
|
2741
|
-
const r = (s) => {
|
|
2742
|
-
if (!s) return s;
|
|
2743
|
-
const a = Object.entries(s).filter(([c, l]) => {
|
|
2744
|
-
var u;
|
|
2745
|
-
if (l.status !== "set" || l.value.kind !== "filter") return !0;
|
|
2746
|
-
const d = (u = n.findFilterInput({ inputId: c })) == null ? void 0 : u.input.filter;
|
|
2747
|
-
return !d || Ue(d, l.value.filterValue) ? !0 : (o = !0, !1);
|
|
2748
|
-
});
|
|
2749
|
-
return Object.fromEntries(a);
|
|
2750
|
-
}, i = {
|
|
2751
|
-
...t,
|
|
2752
|
-
...t.shared ? { shared: r(t.shared) } : {}
|
|
2753
|
-
};
|
|
2754
|
-
for (const s of Ws) {
|
|
2755
|
-
const a = t[s];
|
|
2756
|
-
a && (i[s] = Object.fromEntries(
|
|
2757
|
-
Object.entries(a).map(([c, l]) => [c, r(l) ?? {}])
|
|
2758
|
-
));
|
|
2759
|
-
}
|
|
2760
|
-
return o ? i : t;
|
|
2761
|
-
}
|
|
2762
|
-
function Zs(e) {
|
|
2763
|
-
var t, n;
|
|
2764
|
-
return ((n = (t = e.sheets) == null ? void 0 : t[0]) == null ? void 0 : n.id) ?? null;
|
|
2765
|
-
}
|
|
2766
|
-
function de(e, t) {
|
|
2767
|
-
var n;
|
|
2768
|
-
return !!t && !!((n = e.sheets) != null && n.some((o) => o.id === t));
|
|
2769
|
-
}
|
|
2770
|
-
function Ql(e) {
|
|
2771
|
-
const { dashboard: t, host: n, calendar: o } = e, r = co(t, n.filterValues, {
|
|
2772
|
-
calendar: o
|
|
2773
|
-
}).slots, i = n.controlValues, s = de(t, n.selectedSheetId) ? n.selectedSheetId : Zs(t);
|
|
2774
|
-
return {
|
|
2775
|
-
hostInputValues: r,
|
|
2776
|
-
controlOverrides: i,
|
|
2777
|
-
selectedSheetId: s,
|
|
2778
|
-
hostSelectedSheetId: n.selectedSheetId ?? null,
|
|
2779
|
-
materializedInputs: e.materializeInputs === !1 ? {} : at(
|
|
2780
|
-
t,
|
|
2781
|
-
{
|
|
2782
|
-
adHocFilterValues: [],
|
|
2783
|
-
controlOverrides: i,
|
|
2784
|
-
dashboardInputValues: r
|
|
2785
|
-
},
|
|
2786
|
-
o
|
|
2787
|
-
)
|
|
2788
|
-
};
|
|
2789
|
-
}
|
|
2790
|
-
function jn(e) {
|
|
2791
|
-
const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Map();
|
|
2792
|
-
for (const r of Qe(e))
|
|
2793
|
-
r.kind === "filter" && r.filter ? t.set(r.id, r.filter) : r.kind === "control" && n.add(r.id), r.compatibility && o.set(r.id, r.compatibility);
|
|
2794
|
-
return { filterInputs: t, controlInputIds: n, compatibility: o };
|
|
2795
|
-
}
|
|
2796
|
-
function zn(e, t) {
|
|
2797
|
-
const n = en(t);
|
|
2798
|
-
if (!n) return;
|
|
2799
|
-
const o = ae(e, n);
|
|
2800
|
-
return o ? Ho(o, e) ? "applies" : "not-eligible" : "removed";
|
|
2801
|
-
}
|
|
2802
|
-
function Wl(e, t) {
|
|
2803
|
-
const n = zn(e, t);
|
|
2804
|
-
return n ? n === "applies" : Qe(e).some(
|
|
2805
|
-
(o) => o.id === t
|
|
2806
|
-
);
|
|
2807
|
-
}
|
|
2808
|
-
function Gn(e, t, n, o) {
|
|
2809
|
-
if (!n) return {};
|
|
2810
|
-
const r = new Set((e.sheets ?? []).map((l) => l.id)), i = new Set(
|
|
2811
|
-
Q(e).map(({ card: l }) => l.id)
|
|
2812
|
-
), s = N(e), a = (l) => {
|
|
2813
|
-
var u;
|
|
2814
|
-
if (!l) return;
|
|
2815
|
-
const d = {};
|
|
2816
|
-
for (const [f, p] of Object.entries(l)) {
|
|
2817
|
-
const g = t.filterInputs.has(f) || t.controlInputIds.has(f) ? f : ((u = s.findFilterInput({ inputId: f })) == null ? void 0 : u.input.id) ?? f;
|
|
2818
|
-
if (g !== f && l[g]) continue;
|
|
2819
|
-
const m = zn(e, g);
|
|
2820
|
-
if (m) {
|
|
2821
|
-
if (m !== "applies") {
|
|
2822
|
-
o.push({
|
|
2823
|
-
kind: "setting-no-longer-applies",
|
|
2824
|
-
target: "selection",
|
|
2825
|
-
id: g,
|
|
2826
|
-
reason: m
|
|
2827
|
-
});
|
|
2828
|
-
continue;
|
|
2829
|
-
}
|
|
2830
|
-
d[g] = p;
|
|
2831
|
-
continue;
|
|
2832
|
-
}
|
|
2833
|
-
const y = t.filterInputs.get(g);
|
|
2834
|
-
if (!y && !t.controlInputIds.has(g)) {
|
|
2835
|
-
o.push({
|
|
2836
|
-
kind: "setting-no-longer-applies",
|
|
2837
|
-
target: "input",
|
|
2838
|
-
id: g,
|
|
2839
|
-
reason: "removed"
|
|
2840
|
-
});
|
|
2841
|
-
continue;
|
|
2842
|
-
}
|
|
2843
|
-
if (y && p.status === "set" && p.value.kind === "filter" && !Ue(y, p.value.filterValue)) {
|
|
2844
|
-
o.push({
|
|
2845
|
-
kind: "setting-no-longer-applies",
|
|
2846
|
-
target: "input",
|
|
2847
|
-
id: g,
|
|
2848
|
-
reason: "incompatible"
|
|
2849
|
-
});
|
|
2850
|
-
continue;
|
|
2851
|
-
}
|
|
2852
|
-
d[g] = p;
|
|
2853
|
-
}
|
|
2854
|
-
return Object.keys(d).length ? d : void 0;
|
|
2855
|
-
}, c = (l, d) => {
|
|
2856
|
-
if (!l) return;
|
|
2857
|
-
const u = {};
|
|
2858
|
-
for (const [f, p] of Object.entries(l)) {
|
|
2859
|
-
if (!d(f)) {
|
|
2860
|
-
for (const m of Object.keys(p))
|
|
2861
|
-
o.push({
|
|
2862
|
-
kind: "setting-no-longer-applies",
|
|
2863
|
-
target: "input",
|
|
2864
|
-
id: m,
|
|
2865
|
-
reason: "removed"
|
|
2866
|
-
});
|
|
2867
|
-
continue;
|
|
2868
|
-
}
|
|
2869
|
-
const g = a(p);
|
|
2870
|
-
g && (u[f] = g);
|
|
2871
|
-
}
|
|
2872
|
-
return u;
|
|
2873
|
-
};
|
|
2874
|
-
return Ve({
|
|
2875
|
-
shared: a(n.shared),
|
|
2876
|
-
bySheetId: c(n.bySheetId, (l) => r.has(l)),
|
|
2877
|
-
byCardId: c(n.byCardId, (l) => i.has(l))
|
|
2878
|
-
// Document sections are not viewer state.
|
|
2879
|
-
});
|
|
2880
|
-
}
|
|
2881
|
-
function _(e, t, n, o = {}) {
|
|
2882
|
-
const r = new Map(
|
|
2883
|
-
Q(e).map(({ card: s }) => [s.id, s])
|
|
2884
|
-
), i = {};
|
|
2885
|
-
for (const [s, a] of Object.entries(t ?? {})) {
|
|
2886
|
-
const c = r.get(s);
|
|
2887
|
-
if (c && cn(c)) {
|
|
2888
|
-
Br(a) || (i[s] = a);
|
|
2889
|
-
continue;
|
|
2890
|
-
}
|
|
2891
|
-
if (c && o.sessionSorts && Ar(c)) {
|
|
2892
|
-
a.sort && (i[s] = { sort: a.sort });
|
|
2893
|
-
continue;
|
|
2894
|
-
}
|
|
2895
|
-
n == null || n.push({
|
|
2896
|
-
kind: "setting-no-longer-applies",
|
|
2897
|
-
target: "card",
|
|
2898
|
-
id: s,
|
|
2899
|
-
reason: ae(e, s) ? "not-eligible" : "removed"
|
|
2900
|
-
});
|
|
2901
|
-
}
|
|
2902
|
-
return i;
|
|
2903
|
-
}
|
|
2904
|
-
function Ys(e, t, n) {
|
|
2905
|
-
if (t) {
|
|
2906
|
-
if (de(e, t)) return t;
|
|
2907
|
-
n.push({
|
|
2908
|
-
kind: "setting-no-longer-applies",
|
|
2909
|
-
target: "sheet",
|
|
2910
|
-
id: t,
|
|
2911
|
-
reason: "removed"
|
|
2912
|
-
});
|
|
2913
|
-
}
|
|
2914
|
-
}
|
|
2915
|
-
const lt = (e, t) => ke(e ?? null, t ?? null);
|
|
2916
|
-
function Hn(e) {
|
|
2917
|
-
return {
|
|
2918
|
-
adHocFilterValues: e.adHocFilterValues,
|
|
2919
|
-
controlOverrides: e.controlOverrides,
|
|
2920
|
-
dashboardInputValues: e.dashboardInputValues,
|
|
2921
|
-
...e.inlineFilterValuesMap ? { inlineFilterValuesMap: e.inlineFilterValuesMap } : {},
|
|
2922
|
-
selectedSheetId: e.selectedSheetId,
|
|
2923
|
-
tableSettings: e.tableSettings
|
|
2924
|
-
};
|
|
2925
|
-
}
|
|
2926
|
-
function me(e, t) {
|
|
2927
|
-
return {
|
|
2928
|
-
adHocFilterValues: [],
|
|
2929
|
-
controlOverrides: e.controlOverrides,
|
|
2930
|
-
dashboardInputValues: e.hostInputValues,
|
|
2931
|
-
selectedSheetId: e.selectedSheetId,
|
|
2932
|
-
tableSettings: t
|
|
2933
|
-
};
|
|
2934
|
-
}
|
|
2935
|
-
function Un(e, t) {
|
|
2936
|
-
const n = t.dashboardInputValues === e.baseline.hostInputValues && !t.inlineFilterValuesMap && !t.adHocFilterValues.length && t.controlOverrides === e.baseline.controlOverrides;
|
|
2937
|
-
return {
|
|
2938
|
-
selectedSheetId: t.selectedSheetId,
|
|
2939
|
-
// Overlay: the bookmark's values on the baseline's runtime values.
|
|
2940
|
-
inputs: n ? e.baseline.materializedInputs : at(e.dashboard, t, e.calendar),
|
|
2941
|
-
tableSettings: t.tableSettings
|
|
2942
|
-
};
|
|
2943
|
-
}
|
|
2944
|
-
function $(e, t) {
|
|
2945
|
-
const n = Hn(t), o = t.restore ?? n;
|
|
2946
|
-
return {
|
|
2947
|
-
...n,
|
|
2948
|
-
appliedBookmarkId: t.appliedBookmarkId,
|
|
2949
|
-
rememberedWrites: t.rememberedWrites ?? [],
|
|
2950
|
-
notices: t.notices ?? [],
|
|
2951
|
-
opened: Un(e, o),
|
|
2952
|
-
restore: o
|
|
2953
|
-
};
|
|
2954
|
-
}
|
|
2955
|
-
function At(e, t, n, o) {
|
|
2956
|
-
const { dashboard: r, baseline: i } = e, s = [], a = fn(t.state, Ye), c = a.ok ? a.value : {};
|
|
2957
|
-
for (const g of a.ok ? a.issues : [])
|
|
2958
|
-
s.push(Xs(g));
|
|
2959
|
-
const l = jn(r), d = Nn(
|
|
2960
|
-
l.compatibility,
|
|
2961
|
-
Gn(r, l, c.inputs, s)
|
|
2962
|
-
), u = Ys(r, c.selectedSheetId, s) ?? i.selectedSheetId, f = _(
|
|
2963
|
-
r,
|
|
2964
|
-
c.tableSettings,
|
|
2965
|
-
s
|
|
2966
|
-
), p = _(
|
|
2967
|
-
r,
|
|
2968
|
-
n,
|
|
2969
|
-
void 0
|
|
2970
|
-
);
|
|
2971
|
-
return $(e, {
|
|
2972
|
-
appliedBookmarkId: t.id,
|
|
2973
|
-
// A bookmark opens without ad-hoc values, as today (P4a-02 f).
|
|
2974
|
-
adHocFilterValues: [],
|
|
2975
|
-
controlOverrides: Ln(
|
|
2976
|
-
r,
|
|
2977
|
-
i.controlOverrides,
|
|
2978
|
-
d.controlValues
|
|
2979
|
-
),
|
|
2980
|
-
// Overlay, never replacement: the bookmark's slots over the host's.
|
|
2981
|
-
dashboardInputValues: $e(
|
|
2982
|
-
i.hostInputValues,
|
|
2983
|
-
d.runtime
|
|
2984
|
-
),
|
|
2985
|
-
...$n(
|
|
2986
|
-
$s(
|
|
2987
|
-
st(r, e.calendar),
|
|
2988
|
-
d.inlineFilterValues
|
|
2989
|
-
)
|
|
2990
|
-
),
|
|
2991
|
-
selectedSheetId: u,
|
|
2992
|
-
tableSettings: o.writeRemembered ? { ...p, ...f } : (
|
|
2993
|
-
// A default bookmark on load: remembered settings per card win.
|
|
2994
|
-
{ ...f, ...p }
|
|
2995
|
-
),
|
|
2996
|
-
rememberedWrites: o.writeRemembered ? Object.entries(f).filter(
|
|
2997
|
-
([g, m]) => !lt(p[g], m)
|
|
2998
|
-
).map(([g, m]) => ({
|
|
2999
|
-
kind: "set",
|
|
3000
|
-
cardId: g,
|
|
3001
|
-
settings: m
|
|
3002
|
-
})) : [],
|
|
3003
|
-
notices: s
|
|
3004
|
-
});
|
|
3005
|
-
}
|
|
3006
|
-
function Xs(e) {
|
|
3007
|
-
return {
|
|
3008
|
-
kind: "setting-no-longer-applies",
|
|
3009
|
-
target: e.target,
|
|
3010
|
-
id: e.id,
|
|
3011
|
-
reason: "invalid"
|
|
3012
|
-
};
|
|
3013
|
-
}
|
|
3014
|
-
function $n(e) {
|
|
3015
|
-
return e ? { inlineFilterValuesMap: e } : {};
|
|
3016
|
-
}
|
|
3017
|
-
function Et(e, t, n) {
|
|
3018
|
-
const { dashboard: o, baseline: r } = e;
|
|
3019
|
-
return {
|
|
3020
|
-
// A reload in place keeps ad-hoc values, as today (P4a-02 f), unless the
|
|
3021
|
-
// template now defines a filter with that id.
|
|
3022
|
-
adHocFilterValues: t.adHocFilterValues.filter(
|
|
3023
|
-
(i) => !N(o).findFilterInput({ filterId: i.filterId })
|
|
3024
|
-
),
|
|
3025
|
-
// A host's new control defaults are the baseline's, not the viewer's.
|
|
3026
|
-
controlOverrides: n.controlsChanged ? r.controlOverrides : t.controlOverrides,
|
|
3027
|
-
// Live slots stay, except a filter value this template no longer accepts:
|
|
3028
|
-
// that filter loads its new default, as the old list did. The resolver
|
|
3029
|
-
// ignores slots this template no longer has.
|
|
3030
|
-
dashboardInputValues: Js(
|
|
3031
|
-
o,
|
|
3032
|
-
t.dashboardInputValues
|
|
3033
|
-
),
|
|
3034
|
-
...$n(
|
|
3035
|
-
Qs(
|
|
3036
|
-
o,
|
|
3037
|
-
st(o, e.calendar),
|
|
3038
|
-
t.inlineFilterValuesMap ?? {}
|
|
3039
|
-
)
|
|
3040
|
-
),
|
|
3041
|
-
selectedSheetId: !n.sheetChanged && de(o, t.selectedSheetId) ? t.selectedSheetId : r.selectedSheetId,
|
|
3042
|
-
tableSettings: _(
|
|
3043
|
-
o,
|
|
3044
|
-
t.tableSettings,
|
|
3045
|
-
void 0,
|
|
3046
|
-
{ sessionSorts: !0 }
|
|
3047
|
-
)
|
|
3048
|
-
};
|
|
3049
|
-
}
|
|
3050
|
-
function Jl(e) {
|
|
3051
|
-
const { dashboard: t, baseline: n, event: o } = e, r = e.rememberedTableSettings;
|
|
3052
|
-
switch (o.kind) {
|
|
3053
|
-
case "initial-load":
|
|
3054
|
-
return o.defaultBookmark ? At(e, o.defaultBookmark, r, {
|
|
3055
|
-
writeRemembered: !1
|
|
3056
|
-
}) : $(e, {
|
|
3057
|
-
appliedBookmarkId: null,
|
|
3058
|
-
...me(
|
|
3059
|
-
n,
|
|
3060
|
-
_(t, r, void 0, {
|
|
3061
|
-
sessionSorts: o.captured
|
|
3062
|
-
})
|
|
3063
|
-
)
|
|
3064
|
-
});
|
|
3065
|
-
case "refetch": {
|
|
3066
|
-
const { live: i } = o, s = i.applied, a = {
|
|
3067
|
-
sheetChanged: !!i.previousBaseline && i.previousBaseline.hostSelectedSheetId !== n.hostSelectedSheetId,
|
|
3068
|
-
controlsChanged: !!i.previousBaseline && !ke(
|
|
3069
|
-
i.previousBaseline.controlOverrides ?? null,
|
|
3070
|
-
n.controlOverrides ?? null
|
|
3071
|
-
)
|
|
3072
|
-
}, c = Et(
|
|
3073
|
-
e,
|
|
3074
|
-
{
|
|
3075
|
-
adHocFilterValues: i.adHocFilterValues,
|
|
3076
|
-
controlOverrides: i.controlValues ?? n.controlOverrides,
|
|
3077
|
-
dashboardInputValues: i.dashboardInputValues,
|
|
3078
|
-
inlineFilterValuesMap: i.inlineFilterValuesMap,
|
|
3079
|
-
selectedSheetId: i.selectedSheetId,
|
|
3080
|
-
tableSettings: i.tableSettings
|
|
3081
|
-
},
|
|
3082
|
-
a
|
|
3083
|
-
), l = s ? Et(e, s.restore, a) : me(
|
|
3084
|
-
n,
|
|
3085
|
-
_(t, r, void 0)
|
|
3086
|
-
);
|
|
3087
|
-
return $(e, {
|
|
3088
|
-
appliedBookmarkId: (s == null ? void 0 : s.appliedBookmarkId) ?? null,
|
|
3089
|
-
...c,
|
|
3090
|
-
notices: (s == null ? void 0 : s.notices) ?? [],
|
|
3091
|
-
restore: l
|
|
3092
|
-
});
|
|
3093
|
-
}
|
|
3094
|
-
case "open-bookmark":
|
|
3095
|
-
return At(e, o.bookmark, r, {
|
|
3096
|
-
writeRemembered: !0
|
|
3097
|
-
});
|
|
3098
|
-
case "open-default-view":
|
|
3099
|
-
return $(e, {
|
|
3100
|
-
appliedBookmarkId: null,
|
|
3101
|
-
...me(
|
|
3102
|
-
n,
|
|
3103
|
-
_(t, r, void 0)
|
|
3104
|
-
)
|
|
3105
|
-
});
|
|
3106
|
-
case "reset-to-default-view":
|
|
3107
|
-
return $(e, {
|
|
3108
|
-
appliedBookmarkId: null,
|
|
3109
|
-
...me(n, {}),
|
|
3110
|
-
rememberedWrites: [{ kind: "clear-all" }]
|
|
3111
|
-
});
|
|
3112
|
-
case "discard-changes": {
|
|
3113
|
-
const { restore: i } = o.applied, s = _(
|
|
3114
|
-
t,
|
|
3115
|
-
i.tableSettings,
|
|
3116
|
-
void 0,
|
|
3117
|
-
{ sessionSorts: !0 }
|
|
3118
|
-
), a = _(t, s, void 0), c = _(t, r, void 0), l = [];
|
|
3119
|
-
for (const d of /* @__PURE__ */ new Set([
|
|
3120
|
-
...Object.keys(c),
|
|
3121
|
-
...Object.keys(a)
|
|
3122
|
-
])) {
|
|
3123
|
-
if (lt(c[d], a[d])) continue;
|
|
3124
|
-
const u = a[d];
|
|
3125
|
-
l.push(
|
|
3126
|
-
u ? { kind: "set", cardId: d, settings: u } : { kind: "clear", cardId: d }
|
|
3127
|
-
);
|
|
3128
|
-
}
|
|
3129
|
-
return $(e, {
|
|
3130
|
-
appliedBookmarkId: o.applied.appliedBookmarkId,
|
|
3131
|
-
...i,
|
|
3132
|
-
selectedSheetId: de(t, i.selectedSheetId) ? i.selectedSheetId : n.selectedSheetId,
|
|
3133
|
-
tableSettings: s,
|
|
3134
|
-
rememberedWrites: l,
|
|
3135
|
-
notices: o.applied.notices,
|
|
3136
|
-
restore: i
|
|
3137
|
-
});
|
|
3138
|
-
}
|
|
3139
|
-
}
|
|
3140
|
-
}
|
|
3141
|
-
function Zl(e) {
|
|
3142
|
-
const { dashboard: t, calendar: n } = e, o = e.hostControlValues, r = {
|
|
3143
|
-
...e.baseline,
|
|
3144
|
-
controlOverrides: o,
|
|
3145
|
-
materializedInputs: at(
|
|
3146
|
-
t,
|
|
3147
|
-
{
|
|
3148
|
-
adHocFilterValues: [],
|
|
3149
|
-
controlOverrides: o,
|
|
3150
|
-
dashboardInputValues: e.baseline.hostInputValues
|
|
3151
|
-
},
|
|
3152
|
-
n
|
|
3153
|
-
)
|
|
3154
|
-
};
|
|
3155
|
-
let i = o;
|
|
3156
|
-
if (e.appliedBookmark) {
|
|
3157
|
-
const c = fn(
|
|
3158
|
-
e.appliedBookmark.state,
|
|
3159
|
-
Ye
|
|
3160
|
-
), l = jn(t), d = Nn(
|
|
3161
|
-
l.compatibility,
|
|
3162
|
-
Gn(
|
|
3163
|
-
t,
|
|
3164
|
-
l,
|
|
3165
|
-
c.ok ? c.value.inputs : void 0,
|
|
3166
|
-
[]
|
|
3167
|
-
)
|
|
3168
|
-
).controlValues;
|
|
3169
|
-
i = Ln(t, o, d);
|
|
3170
|
-
}
|
|
3171
|
-
const s = e.applied;
|
|
3172
|
-
if (!s) return { baseline: r, controlOverrides: i, applied: null };
|
|
3173
|
-
const a = { ...s.restore, controlOverrides: i };
|
|
3174
|
-
return {
|
|
3175
|
-
baseline: r,
|
|
3176
|
-
controlOverrides: i,
|
|
3177
|
-
applied: {
|
|
3178
|
-
...s,
|
|
3179
|
-
controlOverrides: i,
|
|
3180
|
-
restore: a,
|
|
3181
|
-
opened: Un({ dashboard: t, baseline: r, calendar: n }, a)
|
|
3182
|
-
}
|
|
3183
|
-
};
|
|
3184
|
-
}
|
|
3185
|
-
function Yl(e, t, n) {
|
|
3186
|
-
const o = Hn(n.values);
|
|
3187
|
-
return {
|
|
3188
|
-
...o,
|
|
3189
|
-
appliedBookmarkId: t,
|
|
3190
|
-
rememberedWrites: [],
|
|
3191
|
-
notices: e.notices,
|
|
3192
|
-
opened: n.snapshot,
|
|
3193
|
-
restore: o
|
|
3194
|
-
};
|
|
3195
|
-
}
|
|
3196
|
-
const _t = (e) => JSON.stringify([e.scope, e.target, e.inputId]);
|
|
3197
|
-
function pe(e) {
|
|
3198
|
-
return !e || e.status === "cleared" && !e.comparisonSelection;
|
|
3199
|
-
}
|
|
3200
|
-
function Qn(e, t) {
|
|
3201
|
-
const n = new Map(
|
|
3202
|
-
re(e).map((i) => [_t(i), i])
|
|
3203
|
-
), o = new Map(
|
|
3204
|
-
re(t).map((i) => [_t(i), i])
|
|
3205
|
-
), r = {};
|
|
3206
|
-
for (const [i, s] of o) {
|
|
3207
|
-
const a = n.get(i);
|
|
3208
|
-
a && ke(a.slot, s.slot) || pe(s.slot) && pe(a == null ? void 0 : a.slot) || De(
|
|
3209
|
-
r,
|
|
3210
|
-
s,
|
|
3211
|
-
pe(s.slot) ? { status: "cleared" } : s.slot
|
|
3212
|
-
);
|
|
3213
|
-
}
|
|
3214
|
-
for (const [i, s] of n)
|
|
3215
|
-
o.has(i) || pe(s.slot) || De(r, s, { status: "cleared" });
|
|
3216
|
-
return Ve(r);
|
|
3217
|
-
}
|
|
3218
|
-
function Xl(e) {
|
|
3219
|
-
const { dashboard: t, baseline: n, current: o } = e, r = Qn(n.materializedInputs, o.inputs), i = _(
|
|
3220
|
-
t,
|
|
3221
|
-
o.tableSettings,
|
|
3222
|
-
void 0
|
|
3223
|
-
), s = o.selectedSheetId && o.selectedSheetId !== n.selectedSheetId && de(t, o.selectedSheetId) ? o.selectedSheetId : void 0;
|
|
3224
|
-
return {
|
|
3225
|
-
version: Ye,
|
|
3226
|
-
...s ? { selectedSheetId: s } : {},
|
|
3227
|
-
...re(r).length ? { inputs: r } : {},
|
|
3228
|
-
...Object.keys(i).length ? { tableSettings: i } : {}
|
|
3229
|
-
};
|
|
3230
|
-
}
|
|
3231
|
-
function ea(e) {
|
|
3232
|
-
const t = /* @__PURE__ */ new Map();
|
|
3233
|
-
for (const n of Qe(e))
|
|
3234
|
-
n.label && t.set(n.id, n.label);
|
|
3235
|
-
return t;
|
|
3236
|
-
}
|
|
3237
|
-
function ta(e, t, n) {
|
|
3238
|
-
var r, i;
|
|
3239
|
-
const o = en(n);
|
|
3240
|
-
if (o) {
|
|
3241
|
-
const s = (i = (r = ae(e, o)) == null ? void 0 : r.title) == null ? void 0 : i.trim();
|
|
3242
|
-
return s ? `Selection in ${s}` : "Selection";
|
|
3243
|
-
}
|
|
3244
|
-
return t.get(n) ?? n;
|
|
3245
|
-
}
|
|
3246
|
-
function ec(e) {
|
|
3247
|
-
var l, d;
|
|
3248
|
-
const { dashboard: t, opened: n, current: o } = e, r = [], i = ea(t), s = /* @__PURE__ */ new Set();
|
|
3249
|
-
for (const u of re(
|
|
3250
|
-
Qn(n.inputs, o.inputs)
|
|
3251
|
-
))
|
|
3252
|
-
s.has(u.inputId) || (s.add(u.inputId), r.push({
|
|
3253
|
-
target: "input",
|
|
3254
|
-
inputId: u.inputId,
|
|
3255
|
-
label: ta(t, i, u.inputId)
|
|
3256
|
-
}));
|
|
3257
|
-
(n.selectedSheetId ?? null) !== (o.selectedSheetId ?? null) && r.push({ target: "sheet" });
|
|
3258
|
-
const a = _(
|
|
3259
|
-
t,
|
|
3260
|
-
n.tableSettings,
|
|
3261
|
-
void 0
|
|
3262
|
-
), c = _(
|
|
3263
|
-
t,
|
|
3264
|
-
o.tableSettings,
|
|
3265
|
-
void 0
|
|
3266
|
-
);
|
|
3267
|
-
for (const u of /* @__PURE__ */ new Set([
|
|
3268
|
-
...Object.keys(a),
|
|
3269
|
-
...Object.keys(c)
|
|
3270
|
-
]))
|
|
3271
|
-
lt(a[u], c[u]) || r.push({
|
|
3272
|
-
target: "table",
|
|
3273
|
-
cardId: u,
|
|
3274
|
-
cardTitle: ((d = (l = ae(t, u)) == null ? void 0 : l.title) == null ? void 0 : d.trim()) || "Table"
|
|
3275
|
-
});
|
|
3276
|
-
return r;
|
|
3277
|
-
}
|
|
3278
|
-
function Rt(e) {
|
|
3279
|
-
const t = ne(e.filter);
|
|
3280
|
-
return {
|
|
3281
|
-
inputId: e.inputId,
|
|
3282
|
-
filterId: e.filterId,
|
|
3283
|
-
label: e.label,
|
|
3284
|
-
selection: e.selection,
|
|
3285
|
-
owner: t ? { kind: "global_date" } : {
|
|
3286
|
-
kind: "field_date",
|
|
3287
|
-
filterId: e.filterId,
|
|
3288
|
-
label: e.label
|
|
3289
|
-
}
|
|
3290
|
-
};
|
|
3291
|
-
}
|
|
3292
|
-
function na(e) {
|
|
3293
|
-
var r, i;
|
|
3294
|
-
if ((r = e.card.sql) != null && r.trim())
|
|
3295
|
-
return {
|
|
3296
|
-
inputs: e.inputs,
|
|
3297
|
-
fieldCandidates: [],
|
|
3298
|
-
resolution: { status: "none" }
|
|
3299
|
-
};
|
|
3300
|
-
const t = e.inputs.filter((s) => !ne(s.filter)).map((s) => ({
|
|
3301
|
-
input: s,
|
|
3302
|
-
resolution: Uo({
|
|
3303
|
-
filter: s.filter,
|
|
3304
|
-
filterValue: s.filterValue,
|
|
3305
|
-
effectiveFilterValue: s.effectiveFilterValue,
|
|
3306
|
-
mappedFilterValue: s.mappedFilterValue,
|
|
3307
|
-
temporalBinding: e.temporalBinding,
|
|
3308
|
-
card: e.card
|
|
3309
|
-
})
|
|
3310
|
-
}));
|
|
3311
|
-
if (!e.temporalBinding)
|
|
3312
|
-
return { inputs: e.inputs, fieldCandidates: t, resolution: { status: "none" } };
|
|
3313
|
-
const n = e.inputs.find(
|
|
3314
|
-
(s) => ne(s.filter)
|
|
3315
|
-
);
|
|
3316
|
-
if (n && ((i = n.filterValue) == null ? void 0 : i.filterId) === n.filterId && n.effectiveFilterValue.filterId === n.filterId && $o(n.effectiveFilterValue))
|
|
3317
|
-
return {
|
|
3318
|
-
inputs: e.inputs,
|
|
3319
|
-
fieldCandidates: t,
|
|
3320
|
-
resolution: {
|
|
3321
|
-
status: "resolved",
|
|
3322
|
-
resolvedOwner: Rt(n)
|
|
3323
|
-
}
|
|
3324
|
-
};
|
|
3325
|
-
const o = t.filter(
|
|
3326
|
-
(s) => s.resolution.status === "eligible"
|
|
3327
|
-
);
|
|
3328
|
-
return o.length === 1 ? {
|
|
3329
|
-
inputs: e.inputs,
|
|
3330
|
-
fieldCandidates: t,
|
|
3331
|
-
resolution: {
|
|
3332
|
-
status: "resolved",
|
|
3333
|
-
resolvedOwner: Rt(o[0].input)
|
|
3334
|
-
}
|
|
3335
|
-
} : o.length > 1 ? {
|
|
3336
|
-
inputs: e.inputs,
|
|
3337
|
-
fieldCandidates: t,
|
|
3338
|
-
resolution: {
|
|
3339
|
-
status: "ambiguous",
|
|
3340
|
-
candidateInputIds: o.map(
|
|
3341
|
-
(s) => s.input.inputId
|
|
3342
|
-
)
|
|
3343
|
-
}
|
|
3344
|
-
} : { inputs: e.inputs, fieldCandidates: t, resolution: { status: "none" } };
|
|
3345
|
-
}
|
|
3346
|
-
function tc(e) {
|
|
3347
|
-
const t = {
|
|
3348
|
-
ownerCardCount: 0,
|
|
3349
|
-
matchingCardCount: 0,
|
|
3350
|
-
globalPrecedenceCardCount: 0,
|
|
3351
|
-
ambiguousCardCount: 0
|
|
3352
|
-
};
|
|
3353
|
-
for (const n of e.targets) {
|
|
3354
|
-
const o = n.plan.fieldCandidates.find(
|
|
3355
|
-
(i) => i.input.inputId === e.inputId
|
|
3356
|
-
);
|
|
3357
|
-
if (!o || o.resolution.status !== "eligible") continue;
|
|
3358
|
-
t.matchingCardCount += 1;
|
|
3359
|
-
const { resolution: r } = n.plan;
|
|
3360
|
-
r.status === "resolved" && r.resolvedOwner.inputId === e.inputId ? t.ownerCardCount += 1 : r.status === "resolved" && r.resolvedOwner.owner.kind === "global_date" ? t.globalPrecedenceCardCount += 1 : r.status === "ambiguous" && r.candidateInputIds.includes(e.inputId) && (t.ambiguousCardCount += 1);
|
|
3361
|
-
}
|
|
3362
|
-
return t;
|
|
3363
|
-
}
|
|
3364
|
-
const oa = /* @__PURE__ */ new Set([
|
|
3365
|
-
"between",
|
|
3366
|
-
"not between",
|
|
3367
|
-
"=",
|
|
3368
|
-
"!=",
|
|
3369
|
-
">",
|
|
3370
|
-
">=",
|
|
3371
|
-
"<",
|
|
3372
|
-
"<=",
|
|
3373
|
-
"is null",
|
|
3374
|
-
"is not null"
|
|
3375
|
-
]), ra = /^(\d{4}-\d{2}-\d{2})T/, ia = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2}(?:\.\d{1,9})?)?(?:Z|[+-]\d{2}:\d{2})$/;
|
|
3376
|
-
function ct(e) {
|
|
3377
|
-
return oa.has(e);
|
|
3378
|
-
}
|
|
3379
|
-
function sa(e, t) {
|
|
3380
|
-
if (e instanceof Date)
|
|
3381
|
-
return Number.isNaN(e.getTime()) ? e : t ? vt(e, t, "yyyy-MM-dd") : e.toISOString().slice(0, 10);
|
|
3382
|
-
if (typeof e != "string")
|
|
3383
|
-
return e;
|
|
3384
|
-
const n = e.trim();
|
|
3385
|
-
if (t && ia.test(n)) {
|
|
3386
|
-
const r = new Date(n);
|
|
3387
|
-
if (!Number.isNaN(r.getTime()))
|
|
3388
|
-
return vt(r, t, "yyyy-MM-dd");
|
|
3389
|
-
}
|
|
3390
|
-
const o = ra.exec(n);
|
|
3391
|
-
return o ? o[1] : e;
|
|
3392
|
-
}
|
|
3393
|
-
function Wn(e, t) {
|
|
3394
|
-
return Array.isArray(e) ? e.map(
|
|
3395
|
-
(n) => sa(n, t)
|
|
3396
|
-
) : e;
|
|
3397
|
-
}
|
|
3398
|
-
function Jn(e) {
|
|
3399
|
-
return typeof e.allowMinutePrecision == "boolean" ? e.allowMinutePrecision : We(
|
|
3400
|
-
e.dashboard,
|
|
3401
|
-
e.semanticExecutionPayload
|
|
3402
|
-
).allEligibleTargetsAreDateTime;
|
|
3403
|
-
}
|
|
3404
|
-
function Zn(e) {
|
|
3405
|
-
const {
|
|
3406
|
-
globalDateFilter: t,
|
|
3407
|
-
globalDateFilterValue: n,
|
|
3408
|
-
timezone: o,
|
|
3409
|
-
allowMinutePrecision: r = !1
|
|
3410
|
-
} = e;
|
|
3411
|
-
if (!t || !n)
|
|
3412
|
-
return;
|
|
3413
|
-
if (!ct(n.operation))
|
|
3414
|
-
return {
|
|
3415
|
-
...n,
|
|
3416
|
-
filterId: t.id
|
|
3417
|
-
};
|
|
3418
|
-
const i = n, s = i.temporalPrecision === "minute" || ye(i.relativeMeta) === "minute", a = !r && s, c = i.operation === "is null" || i.operation === "is not null" ? [] : a ? Wn(i.values, o) : i.values, l = r || ye(i.relativeMeta) !== "minute" ? i.relativeMeta : void 0, d = r && i.temporalPrecision === "minute" ? i.temporalPrecision : void 0, {
|
|
3419
|
-
relativeMeta: u,
|
|
3420
|
-
temporalPrecision: f,
|
|
3421
|
-
values: p,
|
|
3422
|
-
...g
|
|
3423
|
-
} = n;
|
|
3424
|
-
return {
|
|
3425
|
-
...g,
|
|
3426
|
-
filterId: t.id,
|
|
3427
|
-
values: c,
|
|
3428
|
-
...l ? { relativeMeta: l } : {},
|
|
3429
|
-
...d ? { temporalPrecision: d } : {}
|
|
3430
|
-
};
|
|
3431
|
-
}
|
|
3432
|
-
function aa(e) {
|
|
3433
|
-
const t = J(e.filters);
|
|
3434
|
-
if (!t)
|
|
3435
|
-
return e.filterValues;
|
|
3436
|
-
const n = Jn(e);
|
|
3437
|
-
return e.filterValues.map((o) => o.filterId !== t.id ? o : Zn({
|
|
3438
|
-
globalDateFilter: t,
|
|
3439
|
-
globalDateFilterValue: o,
|
|
3440
|
-
timezone: e.timezone,
|
|
3441
|
-
allowMinutePrecision: n
|
|
3442
|
-
}) || o);
|
|
3443
|
-
}
|
|
3444
|
-
function Yn(e) {
|
|
3445
|
-
const {
|
|
3446
|
-
globalDateFilter: t,
|
|
3447
|
-
globalDateFilterValue: n,
|
|
3448
|
-
resolvedPrimaryDateField: o,
|
|
3449
|
-
semanticContext: r,
|
|
3450
|
-
timezone: i,
|
|
3451
|
-
allowMinutePrecision: s = !1
|
|
3452
|
-
} = e;
|
|
3453
|
-
if (!t || !n || !o || !ct(n.operation))
|
|
3454
|
-
return null;
|
|
3455
|
-
const a = n, c = Qo(
|
|
3456
|
-
o.dataType
|
|
3457
|
-
), l = s && c, d = a.temporalPrecision === "minute" || ye(a.relativeMeta) === "minute", u = l && a.temporalPrecision === "minute" ? a.temporalPrecision : void 0, f = l || ye(a.relativeMeta) !== "minute" ? a.relativeMeta : void 0, p = !l && d;
|
|
3458
|
-
return {
|
|
3459
|
-
filterId: t.id,
|
|
3460
|
-
dateOwner: "global_date",
|
|
3461
|
-
name: o.qualifiedFieldName || o.name,
|
|
3462
|
-
operation: a.operation,
|
|
3463
|
-
valueType: "date",
|
|
3464
|
-
values: a.operation === "is null" || a.operation === "is not null" ? [] : p ? Wn(
|
|
3465
|
-
a.values,
|
|
3466
|
-
i
|
|
3467
|
-
) : a.values,
|
|
3468
|
-
dataType: o.dataType || "date",
|
|
3469
|
-
// The exact type travels with the filter, so the server formats the predicate for
|
|
3470
|
-
// the column's storage type (it read it from `dataType` before 2.1 split the two).
|
|
3471
|
-
...o.nativeDataType ? { nativeDataType: o.nativeDataType } : {},
|
|
3472
|
-
fieldMeta: {
|
|
3473
|
-
name: o.name,
|
|
3474
|
-
qualifiedFieldName: o.qualifiedFieldName,
|
|
3475
|
-
qualifiedEntityName: o.qualifiedEntityName,
|
|
3476
|
-
entityId: o.entityId,
|
|
3477
|
-
entityName: o.entityName,
|
|
3478
|
-
entityType: o.entityType,
|
|
3479
|
-
dataType: o.dataType,
|
|
3480
|
-
...o.nativeDataType ? { nativeDataType: o.nativeDataType } : {},
|
|
3481
|
-
role: "groupby",
|
|
3482
|
-
...t != null && t.title ? { label: t.title } : {}
|
|
3483
|
-
},
|
|
3484
|
-
...r ? { semanticContext: r } : {},
|
|
3485
|
-
...f ? { relativeMeta: f } : {},
|
|
3486
|
-
...u ? { temporalPrecision: u } : {}
|
|
3487
|
-
};
|
|
3488
|
-
}
|
|
3489
|
-
function z(e) {
|
|
3490
|
-
return typeof e == "string" ? e.trim() : "";
|
|
3491
|
-
}
|
|
3492
|
-
function la(e) {
|
|
3493
|
-
var t;
|
|
3494
|
-
return (((t = e.semanticContext) == null ? void 0 : t.selectedEntities) || []).filter((n) => typeof n == "object" && n !== null).filter((n) => n.type === "dataset").map((n) => {
|
|
3495
|
-
var o;
|
|
3496
|
-
return {
|
|
3497
|
-
domainId: z(n.domainId) || z((o = e.semanticContext) == null ? void 0 : o.semanticDomainId),
|
|
3498
|
-
datasetName: z(n.name),
|
|
3499
|
-
selectedEntityId: z(n.id)
|
|
3500
|
-
};
|
|
3501
|
-
}).filter((n) => n.domainId && n.datasetName);
|
|
3502
|
-
}
|
|
3503
|
-
function ca(e) {
|
|
3504
|
-
var c, l, d, u, f;
|
|
3505
|
-
if (ne(e) || (c = e.sql) != null && c.trim())
|
|
3506
|
-
return null;
|
|
3507
|
-
const t = la(e), n = z((l = e.semanticContext) == null ? void 0 : l.semanticDomainId), o = z((d = e.fieldMeta) == null ? void 0 : d.entityId), r = z((u = e.fieldMeta) == null ? void 0 : u.entityName), i = z((f = e.fieldMeta) == null ? void 0 : f.entityType) === "dataset", s = t.find(
|
|
3508
|
-
(p) => o && p.selectedEntityId === o
|
|
3509
|
-
);
|
|
3510
|
-
if (s)
|
|
3511
|
-
return s;
|
|
3512
|
-
const a = t.find(
|
|
3513
|
-
(p) => r && p.datasetName === r && (!n || p.domainId === n)
|
|
3514
|
-
);
|
|
3515
|
-
return a || (t.length === 1 ? t[0] : i && r && n ? {
|
|
3516
|
-
domainId: n,
|
|
3517
|
-
datasetName: r
|
|
3518
|
-
} : null);
|
|
3519
|
-
}
|
|
3520
|
-
function da(e) {
|
|
3521
|
-
var r, i;
|
|
3522
|
-
const { filter: t, semanticExecutionPayload: n } = e;
|
|
3523
|
-
if (!n)
|
|
3524
|
-
return null;
|
|
3525
|
-
const o = ca(t);
|
|
3526
|
-
return o && ((i = (r = n.domainsById[o.domainId]) == null ? void 0 : r.datasetsByName[o.datasetName]) == null ? void 0 : i.primaryDateField) || null;
|
|
3527
|
-
}
|
|
3528
|
-
function Xn(e) {
|
|
3529
|
-
const t = J(e.filters);
|
|
3530
|
-
return t ? e.filterValues.filter(
|
|
3531
|
-
(n) => n.filterId !== t.id
|
|
3532
|
-
) : e.filterValues;
|
|
3533
|
-
}
|
|
3534
|
-
function nc(e) {
|
|
3535
|
-
const t = J(e.filters), n = Xn({
|
|
3536
|
-
filters: e.filters,
|
|
3537
|
-
filterValues: e.filterValues
|
|
3538
|
-
});
|
|
3539
|
-
if (!t || ne(e.filter))
|
|
3540
|
-
return n;
|
|
3541
|
-
const o = e.filterValues.find(
|
|
3542
|
-
(s) => s.filterId === t.id
|
|
3543
|
-
), r = da({
|
|
3544
|
-
filter: e.filter,
|
|
3545
|
-
semanticExecutionPayload: e.semanticExecutionPayload
|
|
3546
|
-
}), i = Yn({
|
|
3547
|
-
globalDateFilter: t,
|
|
3548
|
-
globalDateFilterValue: o,
|
|
3549
|
-
resolvedPrimaryDateField: r || void 0,
|
|
3550
|
-
semanticContext: e.filter.semanticContext,
|
|
3551
|
-
timezone: e.timezone,
|
|
3552
|
-
allowMinutePrecision: e.allowMinutePrecision
|
|
3553
|
-
});
|
|
3554
|
-
return i ? [i, ...n] : n;
|
|
3555
|
-
}
|
|
3556
|
-
function ua(e) {
|
|
3557
|
-
var d;
|
|
3558
|
-
const t = J(e.filters), n = t ? e.cardFilterValues.find(
|
|
3559
|
-
(u) => u.filterId === t.id
|
|
3560
|
-
) : void 0, o = t ? e.cardFilterValues.filter(
|
|
3561
|
-
(u) => u.filterId !== t.id
|
|
3562
|
-
) : e.cardFilterValues, r = e.resolvedPrimaryDateField ?? $t({
|
|
3563
|
-
card: e.card,
|
|
3564
|
-
cardConfig: e.cardConfig,
|
|
3565
|
-
resolvedFields: e.resolvedFields,
|
|
3566
|
-
semanticExecutionPayload: e.semanticExecutionPayload
|
|
3567
|
-
}), i = Yn({
|
|
3568
|
-
globalDateFilter: t,
|
|
3569
|
-
globalDateFilterValue: n,
|
|
3570
|
-
resolvedPrimaryDateField: r || void 0,
|
|
3571
|
-
timezone: e.timezone,
|
|
3572
|
-
allowMinutePrecision: e.allowMinutePrecision
|
|
3573
|
-
}), s = i ? [i, ...o] : o, a = new Map(
|
|
3574
|
-
s.map((u) => [
|
|
3575
|
-
u.filterId,
|
|
3576
|
-
u
|
|
3577
|
-
])
|
|
3578
|
-
), c = ((d = e.dateComparisonInputs) == null ? void 0 : d.flatMap((u) => {
|
|
3579
|
-
var p;
|
|
3580
|
-
const f = a.get(
|
|
3581
|
-
u.filterId
|
|
3582
|
-
);
|
|
3583
|
-
return f ? [{
|
|
3584
|
-
...u,
|
|
3585
|
-
effectiveFilterValue: f,
|
|
3586
|
-
mappedFilterValue: (p = e.mappedFilterValuesByInputId) == null ? void 0 : p.get(u.inputId)
|
|
3587
|
-
}] : [];
|
|
3588
|
-
})) || [], l = na({
|
|
3589
|
-
inputs: c,
|
|
3590
|
-
temporalBinding: r,
|
|
3591
|
-
card: e.card
|
|
3592
|
-
});
|
|
3593
|
-
return {
|
|
3594
|
-
cardFilterValues: s,
|
|
3595
|
-
resolvedPrimaryDateField: r,
|
|
3596
|
-
dateComparisonPlan: l
|
|
3597
|
-
};
|
|
3598
|
-
}
|
|
3599
|
-
function oc(e) {
|
|
3600
|
-
const t = J(e.filters), n = Jn(e), o = t ? e.filterValues.find(
|
|
3601
|
-
(s) => s.filterId === t.id
|
|
3602
|
-
) : void 0, r = Xn(e);
|
|
3603
|
-
return !t || !o || !ct(o.operation) ? r : [
|
|
3604
|
-
{
|
|
3605
|
-
...Zn({
|
|
3606
|
-
globalDateFilter: t,
|
|
3607
|
-
globalDateFilterValue: o,
|
|
3608
|
-
timezone: e.timezone,
|
|
3609
|
-
allowMinutePrecision: n
|
|
3610
|
-
}) || o,
|
|
3611
|
-
filterId: t.id,
|
|
3612
|
-
name: t.title || t.column
|
|
3613
|
-
},
|
|
3614
|
-
...r
|
|
3615
|
-
];
|
|
3616
|
-
}
|
|
3617
|
-
class fa extends Error {
|
|
3618
|
-
}
|
|
3619
|
-
function rc(e, t) {
|
|
3620
|
-
const n = new Map((e ? Q(e) : []).map(({ card: o }) => [o.id, o]));
|
|
3621
|
-
return t && n.set(t.id, t), [...n.values()].flatMap((o) => {
|
|
3622
|
-
const r = Ge(o);
|
|
3623
|
-
return r.status === "ready" ? ws(r.config.spec, o.controlBindings) : [];
|
|
3624
|
-
});
|
|
3625
|
-
}
|
|
3626
|
-
function ma(e, t, n) {
|
|
3627
|
-
const o = Wo(e);
|
|
3628
|
-
if (!o) throw new Error("Matrix card definition is required.");
|
|
3629
|
-
const r = n && xs({
|
|
3630
|
-
...n,
|
|
3631
|
-
spec: o.spec,
|
|
3632
|
-
catalog: t.map((d) => ({ ...d, id: d.resolvedField.id }))
|
|
3633
|
-
}), i = r ? { ...o, spec: r.spec } : o, s = Jo(t), a = Zo(t), c = (d) => {
|
|
3634
|
-
const u = a(d, i.spec.source);
|
|
3635
|
-
if (!(!u && d.derivedField)) {
|
|
3636
|
-
if (!u) throw new fa(`Matrix field metadata is unavailable: ${d.name}`);
|
|
3637
|
-
return { ...u, ...d.derivedField ? { derivedField: d.derivedField } : {} };
|
|
3638
|
-
}
|
|
3639
|
-
}, l = {
|
|
3640
|
-
rows: i.spec.rows.flatMap((d) => {
|
|
3641
|
-
const u = c(d.field);
|
|
3642
|
-
return u ? [{ ...u, id: d.id, granularity: d.grain, role: "groupby" }] : [];
|
|
3643
|
-
}),
|
|
3644
|
-
columns: i.spec.columns.flatMap((d) => {
|
|
3645
|
-
const u = c(d.field);
|
|
3646
|
-
return u ? [{ ...u, id: d.id, granularity: d.grain, role: "pivotby" }] : [];
|
|
3647
|
-
}),
|
|
3648
|
-
// Aggregate-stage expressions have no source-column filter target. They stay
|
|
3649
|
-
// authoritative in matrix.spec, including all dependencies and controls.
|
|
3650
|
-
metrics: i.spec.measures.flatMap((d) => {
|
|
3651
|
-
if (d.kind !== "aggregate" || d.field.name === "*") return [];
|
|
3652
|
-
const u = c(d.field);
|
|
3653
|
-
return u ? [{ ...u, id: d.id, aggregate: d.aggregate, role: "metric" }] : [];
|
|
3654
|
-
})
|
|
3655
|
-
};
|
|
3656
|
-
return { config: i, fields: l, resolveField: s };
|
|
3657
|
-
}
|
|
3658
|
-
function pa(e) {
|
|
3659
|
-
const t = e.filter(Boolean);
|
|
3660
|
-
if (t.length !== 0)
|
|
3661
|
-
return t.length === 1 ? t[0] : {
|
|
3662
|
-
id: Qt(),
|
|
3663
|
-
logicalOperator: "AND",
|
|
3664
|
-
negate: !1,
|
|
3665
|
-
conditions: [],
|
|
3666
|
-
groups: t
|
|
3667
|
-
};
|
|
3668
|
-
}
|
|
3669
|
-
function ga(e) {
|
|
3670
|
-
if (!e) return;
|
|
3671
|
-
const t = (n) => ({
|
|
3672
|
-
logicalOperator: n.logicalOperator,
|
|
3673
|
-
negate: n.negate,
|
|
3674
|
-
conditions: n.conditions.map((o) => ({
|
|
3675
|
-
field: o.field.id,
|
|
3676
|
-
operator: o.operator,
|
|
3677
|
-
value: o.value,
|
|
3678
|
-
temporalBucket: o.temporalBucket,
|
|
3679
|
-
rawTemporal: o.rawTemporal,
|
|
3680
|
-
// The run-time markers decide what runs, so they belong in the key.
|
|
3681
|
-
relativeMeta: o.relativeMeta,
|
|
3682
|
-
latestValue: o.latestValue,
|
|
3683
|
-
viewerZoom: o.viewerZoom
|
|
3684
|
-
})),
|
|
3685
|
-
groups: n.groups.map(t)
|
|
3686
|
-
});
|
|
3687
|
-
return JSON.stringify(t(e));
|
|
3688
|
-
}
|
|
3689
|
-
function ya(e, t, n = {}) {
|
|
3690
|
-
const o = e.metricColumns || [];
|
|
3691
|
-
if (o.length === 0) return e;
|
|
3692
|
-
const r = Yo.includes(
|
|
3693
|
-
t
|
|
3694
|
-
), i = Xo.includes(
|
|
3695
|
-
t
|
|
3696
|
-
), s = (l) => {
|
|
3697
|
-
var d;
|
|
3698
|
-
return (d = l.parameters) != null && d.windowTransform ? {
|
|
3699
|
-
...l,
|
|
3700
|
-
parameters: {
|
|
3701
|
-
...l.parameters,
|
|
3702
|
-
windowTransform: void 0
|
|
3703
|
-
}
|
|
3704
|
-
} : l;
|
|
3705
|
-
};
|
|
3706
|
-
let a = !1;
|
|
3707
|
-
const c = o.map(
|
|
3708
|
-
(l) => {
|
|
3709
|
-
var f;
|
|
3710
|
-
const d = Er(l);
|
|
3711
|
-
if (d === "none")
|
|
3712
|
-
return l;
|
|
3713
|
-
let u = l;
|
|
3714
|
-
return (f = u.parameters) != null && f.windowTransform && (a = !0, u = s(u)), n.keepsPeriodComparison && d !== "target" ? u : r ? d === "target" && !i ? (a = !0, {
|
|
3715
|
-
...u,
|
|
3716
|
-
comparison: void 0
|
|
3717
|
-
}) : u : (a = !0, { ...u, comparison: void 0 });
|
|
3718
|
-
}
|
|
3719
|
-
);
|
|
3720
|
-
return a ? {
|
|
3721
|
-
...e,
|
|
3722
|
-
metricColumns: c
|
|
3723
|
-
} : e;
|
|
3724
|
-
}
|
|
3725
|
-
function ic(e, t = {}) {
|
|
3726
|
-
return eo(to(e, t));
|
|
3727
|
-
}
|
|
3728
|
-
function eo(e) {
|
|
3729
|
-
const t = [e.drill, e.selections, e.zoom];
|
|
3730
|
-
return e.authored ? Ur(e.authored, t, Qt()) : pa(t);
|
|
3731
|
-
}
|
|
3732
|
-
function to(e, t = {}) {
|
|
3733
|
-
return {
|
|
3734
|
-
authored: t.includeAuthoredFilters === !1 ? void 0 : er(e),
|
|
3735
|
-
drill: Es(t.drill, e.id),
|
|
3736
|
-
selections: $r(t.selections ?? []),
|
|
3737
|
-
...t.zoom ? { zoom: t.zoom } : {}
|
|
3738
|
-
};
|
|
3739
|
-
}
|
|
3740
|
-
function ba(e, t, n) {
|
|
3741
|
-
const o = Bs(e, t);
|
|
3742
|
-
return ze(e) ? ya(
|
|
3743
|
-
{ ...o, filters: n },
|
|
3744
|
-
e.type,
|
|
3745
|
-
// A data variable's card keeps its own period comparison (P3b-03).
|
|
3746
|
-
{ keepsPeriodComparison: _r(e) }
|
|
3747
|
-
) : o;
|
|
3748
|
-
}
|
|
3749
|
-
function Ca(e) {
|
|
3750
|
-
const t = tr(e);
|
|
3751
|
-
return {
|
|
3752
|
-
contextMode: t,
|
|
3753
|
-
shouldApplyDashboardFilters: !t || t === "full"
|
|
3754
|
-
};
|
|
3755
|
-
}
|
|
3756
|
-
function ha(e) {
|
|
3757
|
-
const t = e.dashboardControls || [], n = e.card.controls || [], o = /* @__PURE__ */ new Set([
|
|
3758
|
-
...t.map((r) => r.id),
|
|
3759
|
-
...n.map((r) => r.id)
|
|
3760
|
-
]);
|
|
3761
|
-
return no(
|
|
3762
|
-
e.card,
|
|
3763
|
-
{
|
|
3764
|
-
controlValues: Wt({
|
|
3765
|
-
relevantControlIds: o,
|
|
3766
|
-
dashboardValues: e.dashboardControlValues,
|
|
3767
|
-
cardValues: e.cardControlValues
|
|
3768
|
-
}),
|
|
3769
|
-
controlDefinitions: t,
|
|
3770
|
-
cardControlDefinitions: n,
|
|
3771
|
-
controlBindings: e.card.controlBindings || []
|
|
3772
|
-
},
|
|
3773
|
-
e.presentationControlIds
|
|
3774
|
-
);
|
|
3775
|
-
}
|
|
3776
|
-
function no(e, t, n) {
|
|
3777
|
-
const r = t.controlBindings.filter(
|
|
3778
|
-
(f) => !Te(f)
|
|
3779
|
-
), i = new Set(
|
|
3780
|
-
Xe({
|
|
3781
|
-
sql: e.sql,
|
|
3782
|
-
controlBindings: r
|
|
3783
|
-
})
|
|
3784
|
-
), s = new Set(
|
|
3785
|
-
[...n].filter(
|
|
3786
|
-
(f) => !i.has(f)
|
|
3787
|
-
)
|
|
3788
|
-
), a = t.controlDefinitions.filter(
|
|
3789
|
-
(f) => !s.has(f.id)
|
|
3790
|
-
), c = t.cardControlDefinitions.filter(
|
|
3791
|
-
(f) => !s.has(f.id)
|
|
3792
|
-
), l = /* @__PURE__ */ new Set([
|
|
3793
|
-
...a.map((f) => f.id),
|
|
3794
|
-
...c.map((f) => f.id)
|
|
3795
|
-
]), d = r.filter(
|
|
3796
|
-
(f) => l.has(f.controlId)
|
|
3797
|
-
);
|
|
3798
|
-
return {
|
|
3799
|
-
controlValues: Wt({
|
|
3800
|
-
relevantControlIds: l,
|
|
3801
|
-
dashboardValues: t.controlValues
|
|
3802
|
-
}),
|
|
3803
|
-
controlDefinitions: a,
|
|
3804
|
-
cardControlDefinitions: c,
|
|
3805
|
-
controlBindings: d
|
|
3806
|
-
};
|
|
3807
|
-
}
|
|
3808
|
-
function Ia(e, t) {
|
|
3809
|
-
return !!t && e.endsWith(t);
|
|
3810
|
-
}
|
|
3811
|
-
function oo(e, t) {
|
|
3812
|
-
return (e ?? []).filter(
|
|
3813
|
-
(n) => Ia(n.filterId, t)
|
|
3814
|
-
);
|
|
3815
|
-
}
|
|
3816
|
-
function ro(e, t, n) {
|
|
3817
|
-
var o;
|
|
3818
|
-
if (t)
|
|
3819
|
-
return {
|
|
3820
|
-
selection: t,
|
|
3821
|
-
...((o = e.preferences) == null ? void 0 : o.inheritGlobalComparison) === !1 ? { inheritGlobalComparison: !1 } : {},
|
|
3822
|
-
...n ? { owner: n } : {}
|
|
3823
|
-
};
|
|
3824
|
-
}
|
|
3825
|
-
function va(e) {
|
|
3826
|
-
if (e.resolution.status === "resolved")
|
|
3827
|
-
return ro(
|
|
3828
|
-
e.card,
|
|
3829
|
-
e.resolution.resolvedOwner.selection,
|
|
3830
|
-
e.resolution.resolvedOwner.owner
|
|
3831
|
-
);
|
|
3832
|
-
}
|
|
3833
|
-
function Fa(e) {
|
|
3834
|
-
return `Set ${e.join(", ")} to run this card.`;
|
|
3835
|
-
}
|
|
3836
|
-
function Da({
|
|
3837
|
-
dashboardInputContext: e,
|
|
3838
|
-
shouldApplyDashboardFilters: t
|
|
3839
|
-
}) {
|
|
3840
|
-
if (t)
|
|
3841
|
-
return e.activeFilters;
|
|
3842
|
-
const n = new Set(
|
|
3843
|
-
e.inputs.flatMap(
|
|
3844
|
-
(o) => o.kind === "filter" && mn(o) ? [o.filter.id] : []
|
|
3845
|
-
)
|
|
3846
|
-
);
|
|
3847
|
-
return e.activeFilters.filter(
|
|
3848
|
-
(o) => n.has(o.filterId)
|
|
3849
|
-
);
|
|
3850
|
-
}
|
|
3851
|
-
function Sa({
|
|
3852
|
-
dashboardInputFilterValues: e,
|
|
3853
|
-
adHocFilterValues: t
|
|
3854
|
-
}) {
|
|
3855
|
-
const n = [...e], o = new Set(
|
|
3856
|
-
n.map((r) => r.filterId)
|
|
3857
|
-
);
|
|
3858
|
-
for (const r of t)
|
|
3859
|
-
o.has(r.filterId) || (n.push(r), o.add(r.filterId));
|
|
3860
|
-
return n;
|
|
3861
|
-
}
|
|
3862
|
-
function Se(e, t) {
|
|
3863
|
-
const n = t.shouldApplyDashboardFilters ? oo(t.adHocFilterValues, t.selectedSheetId) : [], o = t.selectionFilterValues ?? [];
|
|
3864
|
-
if (!t.dashboardInputContext)
|
|
3865
|
-
return {
|
|
3866
|
-
status: "ready",
|
|
3867
|
-
filterValues: [...n, ...t.inlineFilterValues, ...o],
|
|
3868
|
-
mappingDispositions: []
|
|
3869
|
-
};
|
|
3870
|
-
const r = t.dashboardInputContext.inputs.filter(
|
|
3871
|
-
(u) => u.kind === "filter" && !!u.application
|
|
3872
|
-
), i = new Set(
|
|
3873
|
-
r.map((u) => u.filter.id)
|
|
3874
|
-
), s = new Set(
|
|
3875
|
-
t.dashboardInputContext.inputs.flatMap(
|
|
3876
|
-
(u) => {
|
|
3877
|
-
var f;
|
|
3878
|
-
return u.kind === "filter" && ((f = u.compatibility) == null ? void 0 : f.source) === "cardInlineFilter" ? [u.filter.id] : [];
|
|
3879
|
-
}
|
|
3880
|
-
)
|
|
3881
|
-
), a = Da({
|
|
3882
|
-
dashboardInputContext: t.dashboardInputContext,
|
|
3883
|
-
shouldApplyDashboardFilters: t.shouldApplyDashboardFilters
|
|
3884
|
-
}).filter((u) => !i.has(u.filterId)), c = a.filter(
|
|
3885
|
-
(u) => !s.has(u.filterId)
|
|
3886
|
-
), l = a.filter(
|
|
3887
|
-
(u) => s.has(u.filterId)
|
|
3888
|
-
), d = nr({
|
|
3889
|
-
card: e,
|
|
3890
|
-
inputs: r,
|
|
3891
|
-
resolvedInputs: t.dashboardInputContext.resolvedInputs,
|
|
3892
|
-
activeFilterValues: t.dashboardInputContext.activeFilters,
|
|
3893
|
-
shouldApplyDashboardFilters: t.shouldApplyDashboardFilters
|
|
3894
|
-
});
|
|
3895
|
-
return d.status === "blocked" ? {
|
|
3896
|
-
status: "blocked",
|
|
3897
|
-
mappingDispositions: d.dispositions
|
|
3898
|
-
} : {
|
|
3899
|
-
status: "ready",
|
|
3900
|
-
filterValues: [
|
|
3901
|
-
...Sa({
|
|
3902
|
-
dashboardInputFilterValues: [
|
|
3903
|
-
...c,
|
|
3904
|
-
...d.filterValues
|
|
3905
|
-
],
|
|
3906
|
-
adHocFilterValues: n
|
|
3907
|
-
}),
|
|
3908
|
-
...l,
|
|
3909
|
-
...o
|
|
3910
|
-
],
|
|
3911
|
-
mappingDispositions: d.dispositions
|
|
3912
|
-
};
|
|
3913
|
-
}
|
|
3914
|
-
function Ta(e, t) {
|
|
3915
|
-
const n = e.dashboardInputContext;
|
|
3916
|
-
if (!n) return [];
|
|
3917
|
-
const o = new Set(
|
|
3918
|
-
t.flatMap(
|
|
3919
|
-
(i) => i.status === "skip" && (i.reason === "explicitlyExcluded" || i.reason === "outsideScope") ? [i.inputId] : []
|
|
3920
|
-
)
|
|
3921
|
-
), r = new Map(n.inputs.map((i) => [i.id, i]));
|
|
3922
|
-
return n.resolvedInputs.flatMap((i) => {
|
|
3923
|
-
if (!i.missingRequiredValue) return [];
|
|
3924
|
-
const s = r.get(i.id);
|
|
3925
|
-
return s ? s.kind === "filter" && (!e.shouldApplyDashboardFilters && !mn(s) || o.has(s.id)) ? [] : [i.label] : [];
|
|
3926
|
-
});
|
|
3927
|
-
}
|
|
3928
|
-
function Ma({
|
|
3929
|
-
card: e,
|
|
3930
|
-
cardConfig: t,
|
|
3931
|
-
input: n,
|
|
3932
|
-
resolvedPrimaryDateField: o,
|
|
3933
|
-
resolvedFields: r,
|
|
3934
|
-
semanticExecutionPayload: i,
|
|
3935
|
-
timezone: s,
|
|
3936
|
-
allowMinutePrecision: a
|
|
3937
|
-
}) {
|
|
3938
|
-
var m;
|
|
3939
|
-
const c = n.dashboardInputContext ? n.dashboardInputContext.inputs.flatMap(
|
|
3940
|
-
(y) => y.kind === "filter" ? [y.filter] : []
|
|
3941
|
-
) : [], l = Se(e, n), d = Ta(
|
|
3942
|
-
n,
|
|
3943
|
-
l.mappingDispositions
|
|
3944
|
-
);
|
|
3945
|
-
if (d.length)
|
|
3946
|
-
return {
|
|
3947
|
-
status: "blocked",
|
|
3948
|
-
cardId: e.id,
|
|
3949
|
-
reason: "requiredInput",
|
|
3950
|
-
mappingDispositions: l.mappingDispositions,
|
|
3951
|
-
missingRequiredLabels: d
|
|
3952
|
-
};
|
|
3953
|
-
if (l.status === "blocked")
|
|
3954
|
-
return {
|
|
3955
|
-
status: "blocked",
|
|
3956
|
-
cardId: e.id,
|
|
3957
|
-
reason: "mapping",
|
|
3958
|
-
mappingDispositions: l.mappingDispositions,
|
|
3959
|
-
missingRequiredLabels: []
|
|
3960
|
-
};
|
|
3961
|
-
const u = ua({
|
|
3962
|
-
card: e,
|
|
3963
|
-
cardConfig: t,
|
|
3964
|
-
filters: c,
|
|
3965
|
-
cardFilterValues: l.filterValues,
|
|
3966
|
-
resolvedPrimaryDateField: o,
|
|
3967
|
-
resolvedFields: r,
|
|
3968
|
-
semanticExecutionPayload: i,
|
|
3969
|
-
timezone: s,
|
|
3970
|
-
allowMinutePrecision: a,
|
|
3971
|
-
dateComparisonInputs: n.dateComparisonInputs,
|
|
3972
|
-
mappedFilterValuesByInputId: new Map(
|
|
3973
|
-
l.mappingDispositions.flatMap(
|
|
3974
|
-
(y) => y.status === "apply" ? [[y.inputId, y.filterValue]] : []
|
|
3975
|
-
)
|
|
3976
|
-
)
|
|
3977
|
-
}), f = J(c), p = !!(f && u.cardFilterValues.some(
|
|
3978
|
-
(y) => y.filterId === f.id
|
|
3979
|
-
)), g = u.resolvedPrimaryDateField && !((m = e.sql) != null && m.trim()) ? u.dateComparisonPlan.inputs.length ? va({
|
|
3980
|
-
card: e,
|
|
3981
|
-
resolution: u.dateComparisonPlan.resolution
|
|
3982
|
-
}) : p ? ro(
|
|
3983
|
-
e,
|
|
3984
|
-
n.globalDateComparisonSelection
|
|
3985
|
-
) : void 0 : void 0;
|
|
3986
|
-
return {
|
|
3987
|
-
status: "ready",
|
|
3988
|
-
...u,
|
|
3989
|
-
queryFilterDefinitions: c,
|
|
3990
|
-
globalDateComparison: g,
|
|
3991
|
-
mappingDispositions: l.mappingDispositions
|
|
3992
|
-
};
|
|
3993
|
-
}
|
|
3994
|
-
function Va({
|
|
3995
|
-
card: e,
|
|
3996
|
-
dashboard: t,
|
|
3997
|
-
transientContexts: n,
|
|
3998
|
-
cardViewState: o,
|
|
3999
|
-
viewerTableSettings: r,
|
|
4000
|
-
adHocFilterValues: i,
|
|
4001
|
-
selectedSheetId: s,
|
|
4002
|
-
inlineFilterValuesMap: a,
|
|
4003
|
-
dashboardControls: c,
|
|
4004
|
-
dashboardControlValues: l,
|
|
4005
|
-
cardControlValuesMap: d,
|
|
4006
|
-
dashboardInputContext: u,
|
|
4007
|
-
includeAuthoredFilters: f
|
|
4008
|
-
}) {
|
|
4009
|
-
var q, L, G;
|
|
4010
|
-
const p = kn(t);
|
|
4011
|
-
for (const j of e.controlBindings || [])
|
|
4012
|
-
Te(j) && p.add(j.controlId);
|
|
4013
|
-
const { shouldApplyDashboardFilters: g } = Ca(n), m = u != null && u.inputs.length ? u : void 0, y = ((u == null ? void 0 : u.selections) ?? []).filter(
|
|
4014
|
-
(j) => j.status === "apply"
|
|
4015
|
-
), b = to(e, {
|
|
4016
|
-
includeAuthoredFilters: f,
|
|
4017
|
-
selections: y,
|
|
4018
|
-
drill: o == null ? void 0 : o.drill
|
|
4019
|
-
}), I = {
|
|
4020
|
-
adHocFilterValues: i || [],
|
|
4021
|
-
selectedSheetId: s,
|
|
4022
|
-
inlineFilterValues: (a == null ? void 0 : a[e.id]) || [],
|
|
4023
|
-
// Outside the input-context gate: a dashboard whose only input is a
|
|
4024
|
-
// click still sends them.
|
|
4025
|
-
selectionFilterValues: y.flatMap((j) => j.filterValues),
|
|
4026
|
-
shouldApplyDashboardFilters: g,
|
|
4027
|
-
...m ? {
|
|
4028
|
-
dashboardInputContext: {
|
|
4029
|
-
inputs: m.inputs,
|
|
4030
|
-
resolvedInputs: m.resolvedInputs,
|
|
4031
|
-
activeFilters: m.activeFilters
|
|
4032
|
-
}
|
|
4033
|
-
} : {},
|
|
4034
|
-
...m != null && m.globalDateComparisonSelection ? {
|
|
4035
|
-
globalDateComparisonSelection: m.globalDateComparisonSelection
|
|
4036
|
-
} : {},
|
|
4037
|
-
...m != null && m.dateComparisonInputs ? {
|
|
4038
|
-
dateComparisonInputs: m.dateComparisonInputs
|
|
4039
|
-
} : {}
|
|
4040
|
-
}, v = Se(e, I), M = {
|
|
4041
|
-
filterValues: v.status === "ready" ? v.filterValues : [],
|
|
4042
|
-
selectionFilters: b.selections
|
|
4043
|
-
}, h = Bt(M), w = Ns(o == null ? void 0 : o.zoom, (q = e.config) == null ? void 0 : q.groupByColumns, h), B = w ? { ...b, zoom: w.filterGroup } : b, T = w ? Bt({ ...M, zoom: w.zoom }) : h, D = eo(B), V = f === !1 ? Pe(D, !0) : D, O = ba(
|
|
4044
|
-
e,
|
|
4045
|
-
o == null ? void 0 : o.drill,
|
|
4046
|
-
V
|
|
4047
|
-
), x = Ks(O, o == null ? void 0 : o.grainPick, {
|
|
4048
|
-
currentFingerprint: T,
|
|
4049
|
-
drillActive: (((L = o == null ? void 0 : o.drill) == null ? void 0 : L.steps.length) ?? 0) > 0
|
|
4050
|
-
}), S = hs({ ...e, config: x }, r) ?? x, k = Sn(S, {
|
|
4051
|
-
cardType: e.type,
|
|
4052
|
-
dataSource: e.dataSource,
|
|
4053
|
-
temporalResultOwner: Jt({
|
|
4054
|
-
hasExecutableConfig: Me(S, e.type),
|
|
4055
|
-
sql: e.sql,
|
|
4056
|
-
normalizedPython: He(e.python || "")
|
|
4057
|
-
})
|
|
4058
|
-
}) || S, A = ga(V) || "", E = m ? no(
|
|
4059
|
-
e,
|
|
4060
|
-
{
|
|
4061
|
-
controlValues: m.controlValues,
|
|
4062
|
-
controlDefinitions: m.controlDefinitions,
|
|
4063
|
-
cardControlDefinitions: m.cardControlDefinitions,
|
|
4064
|
-
controlBindings: m.controlBindings
|
|
4065
|
-
},
|
|
4066
|
-
p
|
|
4067
|
-
) : ha({
|
|
4068
|
-
card: e,
|
|
4069
|
-
presentationControlIds: p,
|
|
4070
|
-
dashboardControls: c,
|
|
4071
|
-
dashboardControlValues: l,
|
|
4072
|
-
cardControlValues: d == null ? void 0 : d[e.id]
|
|
4073
|
-
});
|
|
4074
|
-
return {
|
|
4075
|
-
filterCompilationInput: I,
|
|
4076
|
-
...E,
|
|
4077
|
-
resolvedFilters: V,
|
|
4078
|
-
resolvedFilterParts: B,
|
|
4079
|
-
drillSteps: ((G = o == null ? void 0 : o.drill) == null ? void 0 : G.steps) ?? or,
|
|
4080
|
-
dateContextKey: T,
|
|
4081
|
-
zoomContextKey: h,
|
|
4082
|
-
...w ? { activeZoom: w.zoom } : {},
|
|
4083
|
-
finalConfig: S,
|
|
4084
|
-
queryRelevantConfig: k,
|
|
4085
|
-
finalFiltersKey: A
|
|
4086
|
-
};
|
|
4087
|
-
}
|
|
4088
|
-
function io(e, t, n) {
|
|
4089
|
-
const o = Ma({
|
|
4090
|
-
resolvedFields: t.resolvedDateFields,
|
|
4091
|
-
...n,
|
|
4092
|
-
card: e,
|
|
4093
|
-
cardConfig: t.queryRelevantConfig,
|
|
4094
|
-
input: t.filterCompilationInput
|
|
4095
|
-
});
|
|
4096
|
-
if (o.status === "blocked") return o;
|
|
4097
|
-
const { filterCompilationInput: r, ...i } = t;
|
|
4098
|
-
return { status: "ready", queryContext: {
|
|
4099
|
-
...i,
|
|
4100
|
-
cardFilterValues: o.cardFilterValues,
|
|
4101
|
-
queryFilterDefinitions: o.queryFilterDefinitions,
|
|
4102
|
-
resolvedPrimaryDateField: o.resolvedPrimaryDateField,
|
|
4103
|
-
globalDateComparison: o.globalDateComparison,
|
|
4104
|
-
globalDateComparisonSelection: r.globalDateComparisonSelection,
|
|
4105
|
-
dateComparisonInputs: r.dateComparisonInputs
|
|
4106
|
-
}, compiledFilters: o };
|
|
4107
|
-
}
|
|
4108
|
-
function ka(e, t, n) {
|
|
4109
|
-
const o = rr(e), r = io(e, t, {
|
|
4110
|
-
resolvedPrimaryDateField: n.resolvedPrimaryDateField,
|
|
4111
|
-
timezone: n.calendarContext.tz,
|
|
4112
|
-
allowMinutePrecision: n.allowGlobalDateMinutePrecision
|
|
4113
|
-
});
|
|
4114
|
-
if (r.status === "blocked")
|
|
4115
|
-
return { ...r, tableConfig: o };
|
|
4116
|
-
const { compiledFilters: i } = r, {
|
|
4117
|
-
cardFilterValues: s,
|
|
4118
|
-
resolvedPrimaryDateField: a,
|
|
4119
|
-
globalDateComparison: c
|
|
4120
|
-
} = i, { queryKey: l, queryInputIdentity: d, paginationConfig: u } = ss(
|
|
4121
|
-
e,
|
|
4122
|
-
r.queryContext,
|
|
4123
|
-
n.calendarContext,
|
|
4124
|
-
{ resolvePaginationConfig: n.resolvePaginationConfig }
|
|
4125
|
-
), f = t.queryRelevantConfig, p = He(e.python || ""), g = Jt({
|
|
4126
|
-
hasExecutableConfig: Me(f, e.type),
|
|
4127
|
-
sql: e.sql,
|
|
4128
|
-
normalizedPython: p
|
|
4129
|
-
});
|
|
4130
|
-
return {
|
|
4131
|
-
status: "ready",
|
|
4132
|
-
queryKey: l,
|
|
4133
|
-
queryInputIdentity: d,
|
|
4134
|
-
paginationConfig: u,
|
|
4135
|
-
tableConfig: o,
|
|
4136
|
-
compiledFilters: i,
|
|
4137
|
-
requestPayloadBase: {
|
|
4138
|
-
cardId: e.id,
|
|
4139
|
-
sql: (e == null ? void 0 : e.sql) || "",
|
|
4140
|
-
python: p,
|
|
4141
|
-
resultOwner: g,
|
|
4142
|
-
active_filters: s,
|
|
4143
|
-
controlValues: t.controlValues,
|
|
4144
|
-
controlDefinitions: t.controlDefinitions,
|
|
4145
|
-
cardControlDefinitions: t.cardControlDefinitions,
|
|
4146
|
-
controlBindings: t.controlBindings,
|
|
4147
|
-
cache_config: n.globalCacheConfig,
|
|
4148
|
-
queryConfig: e.queryConfig,
|
|
4149
|
-
tableConfig: o,
|
|
4150
|
-
cardType: e.type,
|
|
4151
|
-
cardTitle: e.title || "",
|
|
4152
|
-
cardConfig: f,
|
|
4153
|
-
cardDataSource: e.dataSource,
|
|
4154
|
-
resolvedPrimaryDateField: a || void 0,
|
|
4155
|
-
calendarContext: n.calendarContext,
|
|
4156
|
-
...c ? { globalDateComparison: c } : {},
|
|
4157
|
-
...t.sqlRowLimit ? { sqlRowLimit: t.sqlRowLimit } : {}
|
|
4158
|
-
}
|
|
4159
|
-
};
|
|
4160
|
-
}
|
|
4161
|
-
const Kt = [], Pa = [], xa = {};
|
|
4162
|
-
function sc(e, t) {
|
|
4163
|
-
return {
|
|
4164
|
-
sheetId: e.sheetId,
|
|
4165
|
-
sectionId: e.sectionId,
|
|
4166
|
-
documentFilterValues: e.documentFilterValues ?? Kt,
|
|
4167
|
-
documentControlDefinitions: e.documentControlDefinitions ?? Pa,
|
|
4168
|
-
documentControlValues: e.documentControlValues ?? xa,
|
|
4169
|
-
editorFilterValues: t ?? Kt
|
|
4170
|
-
};
|
|
4171
|
-
}
|
|
4172
|
-
function wa({
|
|
4173
|
-
card: e,
|
|
4174
|
-
dashboard: t,
|
|
4175
|
-
runtime: n,
|
|
4176
|
-
dashboardRuntimeValues: o,
|
|
4177
|
-
calendar: r
|
|
4178
|
-
}) {
|
|
4179
|
-
const i = Zt({
|
|
4180
|
-
dashboard: t,
|
|
4181
|
-
dashboardInputValues: o.dashboardInputValues,
|
|
4182
|
-
transientContexts: void 0
|
|
4183
|
-
}) ? Je({
|
|
4184
|
-
transientContexts: void 0,
|
|
4185
|
-
dashboard: t,
|
|
4186
|
-
sheetId: n.sheetId,
|
|
4187
|
-
sheetKind: "document",
|
|
4188
|
-
sectionId: n.sectionId,
|
|
4189
|
-
card: e,
|
|
4190
|
-
runtimeValues: {
|
|
4191
|
-
...o,
|
|
4192
|
-
dashboardInputValues: n.documentDashboardInputValues || o.dashboardInputValues
|
|
4193
|
-
},
|
|
4194
|
-
calendar: r
|
|
4195
|
-
}) : void 0, s = i && (i.inputs.length > 0 || i.selections.length > 0) ? i : void 0, a = !!(i != null && i.inputs.length), c = [
|
|
4196
|
-
...n.editorFilterValues || [],
|
|
4197
|
-
...n.documentFilterValues
|
|
4198
|
-
];
|
|
4199
|
-
return {
|
|
4200
|
-
card: a ? e : Oa(
|
|
4201
|
-
e,
|
|
4202
|
-
n.documentControlDefinitions
|
|
4203
|
-
),
|
|
4204
|
-
dashboard: t,
|
|
4205
|
-
transientContexts: void 0,
|
|
4206
|
-
// Document section cards do not drill.
|
|
4207
|
-
cardViewState: void 0,
|
|
4208
|
-
// Document section cards are not viewer-customizable tables.
|
|
4209
|
-
viewerTableSettings: void 0,
|
|
4210
|
-
adHocFilterValues: [],
|
|
4211
|
-
inlineFilterValuesMap: !a && c.length ? { [e.id]: c } : {},
|
|
4212
|
-
dashboardControls: [],
|
|
4213
|
-
dashboardControlValues: {},
|
|
4214
|
-
cardControlValuesMap: !a && Object.keys(n.documentControlValues).length > 0 ? { [e.id]: n.documentControlValues } : {},
|
|
4215
|
-
dashboardInputContext: s
|
|
4216
|
-
};
|
|
4217
|
-
}
|
|
4218
|
-
function Oa(e, t) {
|
|
4219
|
-
if (t.length === 0)
|
|
4220
|
-
return e;
|
|
4221
|
-
const n = /* @__PURE__ */ new Map();
|
|
4222
|
-
for (const o of e.controls || [])
|
|
4223
|
-
n.set(o.id, o);
|
|
4224
|
-
for (const o of t)
|
|
4225
|
-
n.set(o.id, o);
|
|
4226
|
-
return {
|
|
4227
|
-
...e,
|
|
4228
|
-
controls: Array.from(n.values())
|
|
4229
|
-
};
|
|
4230
|
-
}
|
|
4231
|
-
function ac({
|
|
4232
|
-
card: e,
|
|
4233
|
-
place: t,
|
|
4234
|
-
source: n
|
|
4235
|
-
}) {
|
|
4236
|
-
const o = je(e, t, n);
|
|
4237
|
-
return {
|
|
4238
|
-
card: o.card,
|
|
4239
|
-
context: o.context,
|
|
4240
|
-
inputContext: o.inputContext
|
|
4241
|
-
};
|
|
4242
|
-
}
|
|
4243
|
-
function Ba(e, t, n) {
|
|
4244
|
-
return {
|
|
4245
|
-
calendarContext: n ?? jr,
|
|
4246
|
-
allowGlobalDateMinutePrecision: We(
|
|
4247
|
-
e,
|
|
4248
|
-
t
|
|
4249
|
-
).allEligibleTargetsAreDateTime,
|
|
4250
|
-
semanticExecutionPayload: t,
|
|
4251
|
-
globalCacheConfig: e.globalCacheConfig
|
|
4252
|
-
};
|
|
4253
|
-
}
|
|
4254
|
-
function lc(e, t) {
|
|
4255
|
-
return lo(
|
|
4256
|
-
e,
|
|
4257
|
-
t,
|
|
4258
|
-
t.allowGlobalDateMinutePrecision
|
|
4259
|
-
);
|
|
4260
|
-
}
|
|
4261
|
-
function Aa(e, t, n = {}) {
|
|
4262
|
-
const o = ao(e, t);
|
|
4263
|
-
return {
|
|
4264
|
-
...ka(e.card, e.context, {
|
|
4265
|
-
resolvedPrimaryDateField: o,
|
|
4266
|
-
calendarContext: t.calendarContext,
|
|
4267
|
-
allowGlobalDateMinutePrecision: t.allowGlobalDateMinutePrecision,
|
|
4268
|
-
globalCacheConfig: t.globalCacheConfig,
|
|
4269
|
-
resolvePaginationConfig: n.resolvePaginationConfig
|
|
4270
|
-
}),
|
|
4271
|
-
resolvedPrimaryDateField: o
|
|
4272
|
-
};
|
|
4273
|
-
}
|
|
4274
|
-
function Ea({
|
|
4275
|
-
card: e,
|
|
4276
|
-
place: t,
|
|
4277
|
-
source: n,
|
|
4278
|
-
semanticExecutionPayload: o,
|
|
4279
|
-
matrixCatalog: r,
|
|
4280
|
-
withRequest: i = !1
|
|
4281
|
-
}) {
|
|
4282
|
-
var m, y;
|
|
4283
|
-
const { dashboard: s } = n, a = e.id, c = (b, I) => {
|
|
4284
|
-
var M;
|
|
4285
|
-
let v;
|
|
4286
|
-
try {
|
|
4287
|
-
const h = Ge(b);
|
|
4288
|
-
if (h.status === "invalid") throw h.error;
|
|
4289
|
-
const w = je(
|
|
4290
|
-
b,
|
|
4291
|
-
I,
|
|
4292
|
-
n,
|
|
4293
|
-
h.status === "absent"
|
|
4294
|
-
);
|
|
4295
|
-
if (v = w.context, h.status === "absent")
|
|
4296
|
-
return { status: "ready", value: { assembled: w } };
|
|
4297
|
-
if (!r)
|
|
4298
|
-
return {
|
|
4299
|
-
status: "blocked",
|
|
4300
|
-
reason: "metadata",
|
|
4301
|
-
message: "Matrix field metadata is required.",
|
|
4302
|
-
context: v
|
|
4303
|
-
};
|
|
4304
|
-
const B = Os(h.config.spec, v), T = r.filter(
|
|
4305
|
-
(k) => k.field.source && B.some(
|
|
4306
|
-
(A) => _e(A, k.field.source)
|
|
4307
|
-
)
|
|
4308
|
-
), D = ma(b, T, v), { params: V } = w, O = V.dashboardInputContext;
|
|
4309
|
-
D.config = {
|
|
4310
|
-
...D.config,
|
|
4311
|
-
presentation: Hi(
|
|
4312
|
-
b,
|
|
4313
|
-
D.config,
|
|
4314
|
-
{
|
|
4315
|
-
controls: O ? [
|
|
4316
|
-
...O.controlDefinitions,
|
|
4317
|
-
...O.cardControlDefinitions
|
|
4318
|
-
] : [
|
|
4319
|
-
...V.dashboardControls ?? s.controls ?? [],
|
|
4320
|
-
...V.card.controls ?? []
|
|
4321
|
-
],
|
|
4322
|
-
values: (O == null ? void 0 : O.controlValues) ?? {
|
|
4323
|
-
...V.dashboardControlValues,
|
|
4324
|
-
...(M = V.cardControlValuesMap) == null ? void 0 : M[b.id]
|
|
4325
|
-
}
|
|
4326
|
-
},
|
|
4327
|
-
T
|
|
4328
|
-
)
|
|
4329
|
-
};
|
|
4330
|
-
const x = {
|
|
4331
|
-
...b,
|
|
4332
|
-
config: { matrix: D.config }
|
|
4333
|
-
}, S = je(x, I, n, !1);
|
|
4334
|
-
return {
|
|
4335
|
-
status: "ready",
|
|
4336
|
-
value: {
|
|
4337
|
-
assembled: {
|
|
4338
|
-
card: x,
|
|
4339
|
-
context: { ...S.context, resolvedDateFields: D.fields },
|
|
4340
|
-
inputContext: S.inputContext
|
|
4341
|
-
},
|
|
4342
|
-
matrix: D
|
|
4343
|
-
}
|
|
4344
|
-
};
|
|
4345
|
-
} catch (h) {
|
|
4346
|
-
return {
|
|
4347
|
-
status: "blocked",
|
|
4348
|
-
reason: "configuration",
|
|
4349
|
-
message: h instanceof Error ? h.message : "Card configuration is invalid.",
|
|
4350
|
-
context: v
|
|
4351
|
-
};
|
|
4352
|
-
}
|
|
4353
|
-
}, l = c(e, t);
|
|
4354
|
-
if (l.status === "blocked")
|
|
4355
|
-
return {
|
|
4356
|
-
status: "blocked",
|
|
4357
|
-
cardId: a,
|
|
4358
|
-
mappingDispositions: [],
|
|
4359
|
-
reason: l.reason,
|
|
4360
|
-
missingRequiredLabels: [],
|
|
4361
|
-
message: l.message
|
|
4362
|
-
};
|
|
4363
|
-
const { assembled: d, matrix: u } = l.value, f = Ba(
|
|
4364
|
-
s,
|
|
4365
|
-
o,
|
|
4366
|
-
n.calendar
|
|
4367
|
-
), p = d.context.filterCompilationInput, g = sr(s);
|
|
4368
|
-
try {
|
|
4369
|
-
const b = Se(d.card, p), I = u && g && b.status === "ready" && b.filterValues.some((w) => w.filterId === g.id);
|
|
4370
|
-
let v = f.allowGlobalDateMinutePrecision;
|
|
4371
|
-
if (I) {
|
|
4372
|
-
const w = (m = p.dashboardInputContext) == null ? void 0 : m.inputs.find(
|
|
4373
|
-
(S) => S.kind === "filter" && S.filter.id === g.id
|
|
4374
|
-
), T = ar(s, g).filter(
|
|
4375
|
-
({ card: S, sheet: k }) => !w || Rr(w, {
|
|
4376
|
-
cardId: S.id,
|
|
4377
|
-
sheetId: k.id,
|
|
4378
|
-
sheetKind: Yt(k) ? "document" : "dashboard"
|
|
4379
|
-
})
|
|
4380
|
-
).map(({ card: S, sheet: k }) => ({
|
|
4381
|
-
card: S,
|
|
4382
|
-
value: S.id === a ? l : c(S, { kind: "sheet", sheetId: k.id })
|
|
4383
|
-
})), D = new Map(
|
|
4384
|
-
T.map(({ card: S, value: k }) => [
|
|
4385
|
-
S.id,
|
|
4386
|
-
k.status === "ready" ? k.value.assembled.card : null
|
|
4387
|
-
])
|
|
4388
|
-
), V = new Map(
|
|
4389
|
-
T.map(({ card: S, value: k }) => {
|
|
4390
|
-
var A;
|
|
4391
|
-
return [
|
|
4392
|
-
S.id,
|
|
4393
|
-
k.status === "ready" ? (A = k.value.matrix) == null ? void 0 : A.fields : void 0
|
|
4394
|
-
];
|
|
4395
|
-
})
|
|
4396
|
-
), O = T.flatMap(
|
|
4397
|
-
({ card: S, value: k }) => {
|
|
4398
|
-
const A = S.id, E = k.status === "ready" ? k.value.assembled.context : k.context;
|
|
4399
|
-
if (!E) return [A];
|
|
4400
|
-
const q = k.status === "ready" ? k.value.assembled.card : S;
|
|
4401
|
-
try {
|
|
4402
|
-
const L = Se(
|
|
4403
|
-
q,
|
|
4404
|
-
E.filterCompilationInput
|
|
4405
|
-
);
|
|
4406
|
-
return L.status === "blocked" || L.filterValues.some((G) => G.filterId === g.id) ? [A] : [];
|
|
4407
|
-
} catch {
|
|
4408
|
-
return D.set(A, null), [A];
|
|
4409
|
-
}
|
|
4410
|
-
}
|
|
4411
|
-
), x = We(
|
|
4412
|
-
s,
|
|
4413
|
-
o,
|
|
4414
|
-
g,
|
|
4415
|
-
D,
|
|
4416
|
-
V,
|
|
4417
|
-
O
|
|
4418
|
-
);
|
|
4419
|
-
if ((y = x.unresolvedCardIds) != null && y.length)
|
|
4420
|
-
return {
|
|
4421
|
-
status: "blocked",
|
|
4422
|
-
cardId: a,
|
|
4423
|
-
mappingDispositions: [],
|
|
4424
|
-
reason: "coverage",
|
|
4425
|
-
missingRequiredLabels: [],
|
|
4426
|
-
message: `Date precision requires field metadata and valid inputs for: ${x.unresolvedCardIds.join(", ")}.`
|
|
4427
|
-
};
|
|
4428
|
-
v = x.allEligibleTargetsAreDateTime;
|
|
4429
|
-
}
|
|
4430
|
-
const M = lo(d, f, v);
|
|
4431
|
-
if (M.status === "blocked")
|
|
4432
|
-
return {
|
|
4433
|
-
status: "blocked",
|
|
4434
|
-
cardId: M.cardId,
|
|
4435
|
-
mappingDispositions: M.mappingDispositions,
|
|
4436
|
-
reason: M.reason,
|
|
4437
|
-
missingRequiredLabels: M.missingRequiredLabels,
|
|
4438
|
-
...M.reason === "requiredInput" ? { message: Fa(M.missingRequiredLabels) } : {},
|
|
4439
|
-
...M.resolvedPrimaryDateField ? { resolvedPrimaryDateField: M.resolvedPrimaryDateField } : {}
|
|
4440
|
-
};
|
|
4441
|
-
const h = i && !u ? Aa(d, f) : void 0;
|
|
4442
|
-
return {
|
|
4443
|
-
...M,
|
|
4444
|
-
...u ? { matrix: u } : {},
|
|
4445
|
-
// The whole request a card runs with: the contract's payload and its
|
|
4446
|
-
// extras (server pagination, table totals) from the one extras owner,
|
|
4447
|
-
// on the first page a new viewer opens (ledger P3-78).
|
|
4448
|
-
...(h == null ? void 0 : h.status) === "ready" ? {
|
|
4449
|
-
request: {
|
|
4450
|
-
...h.requestPayloadBase,
|
|
4451
|
-
...Ms({
|
|
4452
|
-
card: d.card,
|
|
4453
|
-
finalConfig: d.context.finalConfig,
|
|
4454
|
-
documentSection: t.kind === "documentSection" ? {} : void 0,
|
|
4455
|
-
page: Ts(d.card)
|
|
4456
|
-
})
|
|
4457
|
-
}
|
|
4458
|
-
} : {}
|
|
4459
|
-
};
|
|
4460
|
-
} catch (b) {
|
|
4461
|
-
return {
|
|
4462
|
-
status: "blocked",
|
|
4463
|
-
cardId: a,
|
|
4464
|
-
mappingDispositions: [],
|
|
4465
|
-
reason: "configuration",
|
|
4466
|
-
missingRequiredLabels: [],
|
|
4467
|
-
message: b instanceof Error ? b.message : "Card filter configuration is invalid."
|
|
4468
|
-
};
|
|
4469
|
-
}
|
|
4470
|
-
}
|
|
4471
|
-
function _a(e) {
|
|
4472
|
-
const t = e.editor ? {
|
|
4473
|
-
...e.inlineFilterValuesMap,
|
|
4474
|
-
...Object.fromEntries(
|
|
4475
|
-
Object.entries(e.editor.inlineFilterValuesMap).filter(
|
|
4476
|
-
(n) => n[1] !== void 0
|
|
4477
|
-
)
|
|
4478
|
-
)
|
|
4479
|
-
} : e.inlineFilterValuesMap;
|
|
4480
|
-
return {
|
|
4481
|
-
dashboardInputValues: e.dashboardInputValues,
|
|
4482
|
-
adHocFilterValues: e.adHocFilterValues,
|
|
4483
|
-
controlValues: e.controlValues,
|
|
4484
|
-
inlineFilterValuesMap: t,
|
|
4485
|
-
cardControlValuesMap: e.cardControlValuesMap
|
|
4486
|
-
};
|
|
4487
|
-
}
|
|
4488
|
-
function je(e, t, n, o) {
|
|
4489
|
-
var l, d;
|
|
4490
|
-
const { dashboard: r } = n, i = _a(n), s = t.kind === "documentSection" ? {
|
|
4491
|
-
...wa({
|
|
4492
|
-
card: e,
|
|
4493
|
-
dashboard: r,
|
|
4494
|
-
runtime: t.section,
|
|
4495
|
-
dashboardRuntimeValues: i,
|
|
4496
|
-
calendar: n.calendar
|
|
4497
|
-
}),
|
|
4498
|
-
selectedSheetId: t.section.sheetId,
|
|
4499
|
-
includeAuthoredFilters: o
|
|
4500
|
-
} : Ra(e, t.sheetId, n, i, o), a = Va(s), c = (l = e.config) == null ? void 0 : l.rowLimit;
|
|
4501
|
-
return (d = e.sql) != null && d.trim() && c && so(r, e.id) && (a.sqlRowLimit = c), {
|
|
4502
|
-
card: s.card,
|
|
4503
|
-
params: s,
|
|
4504
|
-
context: a,
|
|
4505
|
-
inputContext: s.dashboardInputContext
|
|
4506
|
-
};
|
|
4507
|
-
}
|
|
4508
|
-
function so(e, t) {
|
|
4509
|
-
return (e.variables ?? []).some((n) => n.id === t);
|
|
4510
|
-
}
|
|
4511
|
-
function Ra(e, t, n, o, r) {
|
|
4512
|
-
var l, d, u;
|
|
4513
|
-
const { dashboard: i } = n, s = so(i, e.id), a = s ? void 0 : n.transientContexts, c = Zt({
|
|
4514
|
-
dashboard: i,
|
|
4515
|
-
dashboardInputValues: o.dashboardInputValues,
|
|
4516
|
-
transientContexts: a
|
|
4517
|
-
}) ? Je({
|
|
4518
|
-
transientContexts: a,
|
|
4519
|
-
dashboard: i,
|
|
4520
|
-
sheetId: t,
|
|
4521
|
-
card: e,
|
|
4522
|
-
runtimeValues: o,
|
|
4523
|
-
calendar: n.calendar
|
|
4524
|
-
}) : void 0;
|
|
4525
|
-
return {
|
|
4526
|
-
card: e,
|
|
4527
|
-
dashboard: i,
|
|
4528
|
-
transientContexts: a,
|
|
4529
|
-
// The editor previews the card without a viewer's zoom (chart date zoom
|
|
4530
|
-
// DZ-D1): it shows the dashboard's dates, and its save never sees one.
|
|
4531
|
-
cardViewState: s ? void 0 : n.editor ? ir((l = n.cardViewStates) == null ? void 0 : l[e.id], null) : (d = n.cardViewStates) == null ? void 0 : d[e.id],
|
|
4532
|
-
viewerTableSettings: n.editor || s || (u = n.viewerTableSettings) == null ? void 0 : u[e.id],
|
|
4533
|
-
adHocFilterValues: s ? [] : o.adHocFilterValues,
|
|
4534
|
-
selectedSheetId: t,
|
|
4535
|
-
inlineFilterValuesMap: o.inlineFilterValuesMap,
|
|
4536
|
-
dashboardControls: i.controls,
|
|
4537
|
-
dashboardControlValues: o.controlValues,
|
|
4538
|
-
cardControlValuesMap: o.cardControlValuesMap,
|
|
4539
|
-
// Keep a selection-only context so the query has one resolved-input contract.
|
|
4540
|
-
dashboardInputContext: c && (c.inputs.length > 0 || c.selections.length > 0) ? c : void 0,
|
|
4541
|
-
includeAuthoredFilters: r
|
|
4542
|
-
};
|
|
4543
|
-
}
|
|
4544
|
-
function ao({ card: e, context: t }, n) {
|
|
4545
|
-
return $t({
|
|
4546
|
-
card: e,
|
|
4547
|
-
cardConfig: t.queryRelevantConfig,
|
|
4548
|
-
resolvedFields: t.resolvedDateFields,
|
|
4549
|
-
semanticExecutionPayload: n.semanticExecutionPayload
|
|
4550
|
-
});
|
|
4551
|
-
}
|
|
4552
|
-
function lo(e, t, n) {
|
|
4553
|
-
const { card: o } = e, r = ao(e, t), i = io(o, e.context, {
|
|
4554
|
-
resolvedPrimaryDateField: r,
|
|
4555
|
-
timezone: t.calendarContext.tz,
|
|
4556
|
-
allowMinutePrecision: n
|
|
4557
|
-
});
|
|
4558
|
-
return i.status === "blocked" ? { ...i, card: o, resolvedPrimaryDateField: r } : {
|
|
4559
|
-
status: "ready",
|
|
4560
|
-
card: o,
|
|
4561
|
-
queryContext: i.queryContext,
|
|
4562
|
-
compiledFilters: i.compiledFilters,
|
|
4563
|
-
resolvedPrimaryDateField: r
|
|
4564
|
-
};
|
|
4565
|
-
}
|
|
4566
|
-
function cc({
|
|
4567
|
-
dashboard: e,
|
|
4568
|
-
dashboardInputValues: t,
|
|
4569
|
-
adHocFilterValues: n,
|
|
4570
|
-
calendar: o,
|
|
4571
|
-
selectedSheetId: r,
|
|
4572
|
-
sheetSelection: i = "current",
|
|
4573
|
-
dashboardControlValues: s,
|
|
4574
|
-
cardControlValuesMap: a,
|
|
4575
|
-
semanticExecutionPayload: c,
|
|
4576
|
-
timezone: l
|
|
4577
|
-
}) {
|
|
4578
|
-
const d = e ? [...lr(e)] : void 0, u = r ?? null, f = (I) => {
|
|
4579
|
-
var v;
|
|
4580
|
-
return e ? Na({
|
|
4581
|
-
dashboard: e,
|
|
4582
|
-
runtimeValues: { dashboardInputValues: t },
|
|
4583
|
-
adHocFilterValues: n,
|
|
4584
|
-
sheetId: I,
|
|
4585
|
-
sheetKind: Yt(
|
|
4586
|
-
(v = e.sheets) == null ? void 0 : v.find((M) => M.id === I)
|
|
4587
|
-
) ? "document" : "dashboard",
|
|
4588
|
-
calendar: o
|
|
4589
|
-
}) : [];
|
|
4590
|
-
}, p = i === "all" ? Array.from(
|
|
4591
|
-
new Map(
|
|
4592
|
-
((e == null ? void 0 : e.sheets) || []).flatMap(
|
|
4593
|
-
(I) => f(I.id).map(
|
|
4594
|
-
(v) => [v.filterId, v]
|
|
4595
|
-
)
|
|
4596
|
-
)
|
|
4597
|
-
).values()
|
|
4598
|
-
) : f(u), g = {
|
|
4599
|
-
...s || {}
|
|
4600
|
-
}, m = i === "all" ? Q({ sheets: (e == null ? void 0 : e.sheets) || [] }) : u ? Q({ sheets: (e == null ? void 0 : e.sheets) || [] }).filter(
|
|
4601
|
-
(I) => I.sheet.id === u
|
|
4602
|
-
) : [];
|
|
4603
|
-
for (const I of m)
|
|
4604
|
-
Object.assign(g, (a == null ? void 0 : a[I.card.id]) || {});
|
|
4605
|
-
const y = cr({
|
|
4606
|
-
filterDefinitions: d,
|
|
4607
|
-
filterValues: p
|
|
4608
|
-
}), b = aa({
|
|
4609
|
-
filters: d,
|
|
4610
|
-
filterValues: y,
|
|
4611
|
-
dashboard: e,
|
|
4612
|
-
semanticExecutionPayload: c,
|
|
4613
|
-
timezone: l
|
|
4614
|
-
});
|
|
4615
|
-
return {
|
|
4616
|
-
selectedSheetId: u,
|
|
4617
|
-
filterValues: b,
|
|
4618
|
-
controlValues: g
|
|
4619
|
-
};
|
|
4620
|
-
}
|
|
4621
|
-
function dc({
|
|
4622
|
-
dashboard: e,
|
|
4623
|
-
cardId: t,
|
|
4624
|
-
transientContexts: n,
|
|
4625
|
-
cardViewStates: o,
|
|
4626
|
-
viewerTableSettings: r,
|
|
4627
|
-
semanticExecutionPayload: i,
|
|
4628
|
-
adHocFilterValues: s,
|
|
4629
|
-
inlineFilterValuesMap: a,
|
|
4630
|
-
dashboardControlValues: c,
|
|
4631
|
-
cardControlValuesMap: l,
|
|
4632
|
-
dashboardInputValues: d,
|
|
4633
|
-
calendar: u,
|
|
4634
|
-
matrixCatalog: f,
|
|
4635
|
-
cardOverride: p,
|
|
4636
|
-
sheetId: g,
|
|
4637
|
-
documentSection: m,
|
|
4638
|
-
editor: y,
|
|
4639
|
-
withRequest: b
|
|
4640
|
-
}) {
|
|
4641
|
-
var M;
|
|
4642
|
-
if (!e)
|
|
4643
|
-
return null;
|
|
4644
|
-
p && !Ft(e, t) && g && (e = { ...e, sheets: (M = e.sheets) == null ? void 0 : M.map((h) => h.id === g ? { ...h, cards: [...h.cards ?? [], p] } : h) });
|
|
4645
|
-
const I = Ft(e, t);
|
|
4646
|
-
if (!I)
|
|
4647
|
-
return null;
|
|
4648
|
-
const v = Ea({
|
|
4649
|
-
card: p ?? I.card,
|
|
4650
|
-
place: m ? { kind: "documentSection", section: m } : { kind: "sheet", sheetId: I.sheet.id },
|
|
4651
|
-
source: {
|
|
4652
|
-
dashboard: e,
|
|
4653
|
-
adHocFilterValues: s,
|
|
4654
|
-
controlValues: c,
|
|
4655
|
-
inlineFilterValuesMap: a,
|
|
4656
|
-
cardControlValuesMap: l ? Object.fromEntries(
|
|
4657
|
-
Object.entries(l).filter(
|
|
4658
|
-
(h) => h[1] !== void 0
|
|
4659
|
-
)
|
|
4660
|
-
) : void 0,
|
|
4661
|
-
dashboardInputValues: d,
|
|
4662
|
-
transientContexts: n,
|
|
4663
|
-
cardViewStates: o,
|
|
4664
|
-
viewerTableSettings: r,
|
|
4665
|
-
calendar: u,
|
|
4666
|
-
...y ? { editor: y } : {}
|
|
4667
|
-
},
|
|
4668
|
-
semanticExecutionPayload: i,
|
|
4669
|
-
matrixCatalog: f,
|
|
4670
|
-
withRequest: b
|
|
4671
|
-
});
|
|
4672
|
-
return v.status === "blocked" ? v : {
|
|
4673
|
-
status: "ready",
|
|
4674
|
-
card: p ?? I.card,
|
|
4675
|
-
sheetId: I.sheet.id,
|
|
4676
|
-
queryContext: v.queryContext,
|
|
4677
|
-
compiledFilters: v.compiledFilters,
|
|
4678
|
-
resolvedPrimaryDateField: v.resolvedPrimaryDateField,
|
|
4679
|
-
...v.matrix ? { matrix: v.matrix } : {},
|
|
4680
|
-
...v.request ? { request: v.request } : {}
|
|
4681
|
-
};
|
|
4682
|
-
}
|
|
4683
|
-
function Ka(e, t, n) {
|
|
4684
|
-
const o = t === "date" && "relativeMeta" in e ? Fr(e.relativeMeta) : void 0;
|
|
4685
|
-
if (!o) return { values: e.values };
|
|
4686
|
-
const r = mr(o, n ?? void 0), i = Dr(String(e.operation), o);
|
|
4687
|
-
return {
|
|
4688
|
-
values: r && i ? Sr(String(e.operation), r) : e.values,
|
|
4689
|
-
relativeMeta: o,
|
|
4690
|
-
..."temporalPrecision" in e && e.temporalPrecision === "minute" ? { temporalPrecision: "minute" } : {}
|
|
4691
|
-
};
|
|
4692
|
-
}
|
|
4693
|
-
function qa(e, t, n) {
|
|
4694
|
-
const o = t, r = ur(e);
|
|
4695
|
-
return fr({
|
|
4696
|
-
definition: e,
|
|
4697
|
-
sourceValue: o,
|
|
4698
|
-
value: {
|
|
4699
|
-
filterId: o.filterId,
|
|
4700
|
-
name: e.column,
|
|
4701
|
-
operation: o.operation ?? e.operation,
|
|
4702
|
-
valueType: r,
|
|
4703
|
-
dataType: e.dataType,
|
|
4704
|
-
fieldMeta: e.fieldMeta,
|
|
4705
|
-
semanticContext: e.semanticContext,
|
|
4706
|
-
...Ka(o, r, n)
|
|
4707
|
-
}
|
|
4708
|
-
});
|
|
4709
|
-
}
|
|
4710
|
-
function co(e, t, n) {
|
|
4711
|
-
const o = N(e);
|
|
4712
|
-
let r = {};
|
|
4713
|
-
const i = [], s = [];
|
|
4714
|
-
for (const a of t ?? []) {
|
|
4715
|
-
if (Lr(a.filterId)) {
|
|
4716
|
-
s.push(a.filterId);
|
|
4717
|
-
continue;
|
|
4718
|
-
}
|
|
4719
|
-
const c = o.findFilterInput({ filterId: a.filterId }), l = c == null ? void 0 : c.input;
|
|
4720
|
-
if (l || i.push(a), !l || l.runtimeScope === "perCard" || l.runtimeScope === "perDocumentSection") {
|
|
4721
|
-
s.push(a.filterId);
|
|
4722
|
-
continue;
|
|
4723
|
-
}
|
|
4724
|
-
const d = dr(
|
|
4725
|
-
qa(l.filter, a, n.calendar)
|
|
4726
|
-
);
|
|
4727
|
-
if (d) {
|
|
4728
|
-
if (l.runtimeScope === "shared") {
|
|
4729
|
-
r = ht(r, l, {}, d);
|
|
4730
|
-
continue;
|
|
4731
|
-
}
|
|
4732
|
-
for (const u of pn(e).values())
|
|
4733
|
-
gn(l, u) && (r = ht(
|
|
4734
|
-
r,
|
|
4735
|
-
l,
|
|
4736
|
-
{ sheetId: u.sheetId },
|
|
4737
|
-
d
|
|
4738
|
-
));
|
|
4739
|
-
}
|
|
4740
|
-
}
|
|
4741
|
-
return { slots: r, adHocFilterValues: i, droppedFilterIds: s };
|
|
4742
|
-
}
|
|
4743
|
-
function Na(e) {
|
|
4744
|
-
const { dashboard: t, sheetId: n } = e, o = [];
|
|
4745
|
-
if (n)
|
|
4746
|
-
for (const { input: r } of pr(t, n, e.sheetKind)) {
|
|
4747
|
-
const i = gr({
|
|
4748
|
-
dashboard: t,
|
|
4749
|
-
input: r,
|
|
4750
|
-
runtimeValues: { dashboardInputValues: e.runtimeValues.dashboardInputValues },
|
|
4751
|
-
target: { sheetId: n },
|
|
4752
|
-
calendar: e.calendar
|
|
4753
|
-
});
|
|
4754
|
-
i.kind === "filter" && i.filterValue && o.push(i.filterValue);
|
|
4755
|
-
}
|
|
4756
|
-
return [...o, ...oo(e.adHocFilterValues, n)];
|
|
4757
|
-
}
|
|
4758
|
-
function uc(e, t) {
|
|
4759
|
-
switch (t.runtimeScope) {
|
|
4760
|
-
case "shared":
|
|
4761
|
-
return [{}];
|
|
4762
|
-
case "perSheet":
|
|
4763
|
-
return [...pn(e).values()].filter((n) => gn(t, n)).map((n) => ({ sheetId: n.sheetId }));
|
|
4764
|
-
case "perCard": {
|
|
4765
|
-
const n = N(e);
|
|
4766
|
-
return [
|
|
4767
|
-
...n.reachedCards({ inputId: t.id }).map((o) => ({ sheetId: o.sheetId, cardId: o.cardId })),
|
|
4768
|
-
// A variable holds a value at each place it is used (DV-D35).
|
|
4769
|
-
...n.reachedVariables({ inputId: t.id }).flatMap(
|
|
4770
|
-
(o) => o.places.map((r) => ({ sheetId: r.sheetId, cardId: o.variableId }))
|
|
4771
|
-
)
|
|
4772
|
-
];
|
|
4773
|
-
}
|
|
4774
|
-
case "perDocumentSection": {
|
|
4775
|
-
const n = /* @__PURE__ */ new Map();
|
|
4776
|
-
for (const o of N(e).reachedCards({ inputId: t.id }))
|
|
4777
|
-
o.kind === "documentSectionCard" && n.set(o.sectionId, { sheetId: o.sheetId, sectionId: o.sectionId });
|
|
4778
|
-
return [...n.values()];
|
|
4779
|
-
}
|
|
4780
|
-
default:
|
|
4781
|
-
return [];
|
|
4782
|
-
}
|
|
4783
|
-
}
|
|
4784
|
-
function qt(e) {
|
|
4785
|
-
var t;
|
|
4786
|
-
return [
|
|
4787
|
-
...e.cards ?? [],
|
|
4788
|
-
...(e.frames ?? []).flatMap((n) => n.cards),
|
|
4789
|
-
...(((t = e.document) == null ? void 0 : t.sections) ?? []).flatMap(
|
|
4790
|
-
(n) => yn(n)
|
|
4791
|
-
)
|
|
4792
|
-
];
|
|
4793
|
-
}
|
|
4794
|
-
function La(e, t) {
|
|
4795
|
-
var n, o;
|
|
4796
|
-
return {
|
|
4797
|
-
sheetId: e.id,
|
|
4798
|
-
cardId: t.id,
|
|
4799
|
-
sheetKind: e.kind ?? "dashboard",
|
|
4800
|
-
sectionId: (o = (n = e.document) == null ? void 0 : n.sections.find(
|
|
4801
|
-
(r) => yn(r).some(({ id: i }) => i === t.id)
|
|
4802
|
-
)) == null ? void 0 : o.id
|
|
4803
|
-
};
|
|
4804
|
-
}
|
|
4805
|
-
function ja(e, t, n, o) {
|
|
4806
|
-
var l, d, u;
|
|
4807
|
-
const r = {}, i = (l = e.preferences) == null ? void 0 : l.textVisualOptions;
|
|
4808
|
-
if (!i) return r;
|
|
4809
|
-
const s = Je({
|
|
4810
|
-
// Authoring: carried drill context never applies to a dashboard being edited.
|
|
4811
|
-
transientContexts: void 0,
|
|
4812
|
-
dashboard: n,
|
|
4813
|
-
...La(o, t),
|
|
4814
|
-
card: t,
|
|
4815
|
-
runtimeValues: {},
|
|
4816
|
-
// Aliases only: no input value is read.
|
|
4817
|
-
calendar: null
|
|
4818
|
-
}), a = (f) => {
|
|
4819
|
-
if (f.source !== "dashboardInputAlias") return f;
|
|
4820
|
-
const p = s.variablesByName[f.variableName], g = p ? {
|
|
4821
|
-
source: "input",
|
|
4822
|
-
inputId: p.id,
|
|
4823
|
-
export: f.export ?? "label"
|
|
4824
|
-
} : f;
|
|
4825
|
-
return p && (r[f.variableName] = g), g;
|
|
4826
|
-
}, c = (f) => {
|
|
4827
|
-
Object.assign(f, on(f, (p) => a(p))), f.type === "link" && [...f.children, ...Array.isArray(f.url) ? f.url : []].forEach((p) => c(p)), f.type === "when" && [...f.then ?? [], ...f.else ?? []].forEach(c);
|
|
4828
|
-
};
|
|
4829
|
-
return (d = i.content) == null || d.forEach((f) => {
|
|
4830
|
-
f.type === "variable" && (f.ref = a(f.ref));
|
|
4831
|
-
}), (u = i.richContent) == null || u.blocks.forEach((f) => {
|
|
4832
|
-
f.type === "list" ? f.items.forEach((p) => p.forEach(c)) : f.children.forEach(c);
|
|
4833
|
-
}), r;
|
|
4834
|
-
}
|
|
4835
|
-
function za(e, t) {
|
|
4836
|
-
var i;
|
|
4837
|
-
const n = qt(e);
|
|
4838
|
-
if (!n.some((s) => {
|
|
4839
|
-
var a;
|
|
4840
|
-
return (a = s.preferences) == null ? void 0 : a.textVisualOptions;
|
|
4841
|
-
}))
|
|
4842
|
-
return e;
|
|
4843
|
-
const o = he(e), r = qt(o);
|
|
4844
|
-
for (let s = 0; s < r.length; s++) {
|
|
4845
|
-
const a = ja(
|
|
4846
|
-
r[s],
|
|
4847
|
-
n[s],
|
|
4848
|
-
t,
|
|
4849
|
-
e
|
|
4850
|
-
);
|
|
4851
|
-
(i = e.frames) != null && i.some(
|
|
4852
|
-
(c) => c.visualId && c.cards.some((l) => l.id === r[s].id)
|
|
4853
|
-
) && (r[s].linkedReferenceOverrides = ui(
|
|
4854
|
-
r[s].linkedReferenceOverrides,
|
|
4855
|
-
{ inputAliases: a }
|
|
4856
|
-
));
|
|
4857
|
-
}
|
|
4858
|
-
return o;
|
|
4859
|
-
}
|
|
4860
|
-
function Ga(e) {
|
|
4861
|
-
var n;
|
|
4862
|
-
const t = (n = e.sheets) == null ? void 0 : n.map(
|
|
4863
|
-
(o) => za(o, e)
|
|
4864
|
-
);
|
|
4865
|
-
return t && t.some((o, r) => o !== e.sheets[r]) ? { ...e, sheets: t } : e;
|
|
4866
|
-
}
|
|
4867
|
-
function Ha(e) {
|
|
4868
|
-
const t = N(e);
|
|
4869
|
-
return t.issues.length === 0 && !t.needsUpgrade ? e : t.issues.length ? t.toStoredDashboard() : N(
|
|
4870
|
-
Ga(e)
|
|
4871
|
-
).toStoredDashboard();
|
|
4872
|
-
}
|
|
4873
|
-
export {
|
|
4874
|
-
Zr as $,
|
|
4875
|
-
co as A,
|
|
4876
|
-
Na as B,
|
|
4877
|
-
uc as C,
|
|
4878
|
-
Ia as D,
|
|
4879
|
-
oo as E,
|
|
4880
|
-
ui as F,
|
|
4881
|
-
fl as G,
|
|
4882
|
-
Ii as H,
|
|
4883
|
-
xs as I,
|
|
4884
|
-
wt as J,
|
|
4885
|
-
wl as K,
|
|
4886
|
-
fi as L,
|
|
4887
|
-
kl as M,
|
|
4888
|
-
qi as N,
|
|
4889
|
-
Ki as O,
|
|
4890
|
-
_i as P,
|
|
4891
|
-
vl as Q,
|
|
4892
|
-
Vn as R,
|
|
4893
|
-
qe as S,
|
|
4894
|
-
yl as T,
|
|
4895
|
-
ji as U,
|
|
4896
|
-
W as V,
|
|
4897
|
-
Ml as W,
|
|
4898
|
-
Gi as X,
|
|
4899
|
-
Vl as Y,
|
|
4900
|
-
it as Z,
|
|
4901
|
-
rt as _,
|
|
4902
|
-
ta as a,
|
|
4903
|
-
Hl as a$,
|
|
4904
|
-
Fl as a0,
|
|
4905
|
-
Tl as a1,
|
|
4906
|
-
Ni as a2,
|
|
4907
|
-
hl as a3,
|
|
4908
|
-
lc as a4,
|
|
4909
|
-
Ba as a5,
|
|
4910
|
-
qt as a6,
|
|
4911
|
-
La as a7,
|
|
4912
|
-
ja as a8,
|
|
4913
|
-
za as a9,
|
|
4914
|
-
Ll as aA,
|
|
4915
|
-
jl as aB,
|
|
4916
|
-
ce as aC,
|
|
4917
|
-
In as aD,
|
|
4918
|
-
gl as aE,
|
|
4919
|
-
pl as aF,
|
|
4920
|
-
Cl as aG,
|
|
4921
|
-
Ea as aH,
|
|
4922
|
-
Ti as aI,
|
|
4923
|
-
bl as aJ,
|
|
4924
|
-
rc as aK,
|
|
4925
|
-
bn as aL,
|
|
4926
|
-
Dl as aM,
|
|
4927
|
-
nc as aN,
|
|
4928
|
-
zl as aO,
|
|
4929
|
-
Ls as aP,
|
|
4930
|
-
tc as aQ,
|
|
4931
|
-
Zn as aR,
|
|
4932
|
-
Se as aS,
|
|
4933
|
-
Il as aT,
|
|
4934
|
-
fa as aU,
|
|
4935
|
-
Yn as aV,
|
|
4936
|
-
Xe as aW,
|
|
4937
|
-
Sl as aX,
|
|
4938
|
-
Bl as aY,
|
|
4939
|
-
vs as aZ,
|
|
4940
|
-
re as a_,
|
|
4941
|
-
as as aa,
|
|
4942
|
-
Yl as ab,
|
|
4943
|
-
Jl as ac,
|
|
4944
|
-
Kn as ad,
|
|
4945
|
-
Zl as ae,
|
|
4946
|
-
Ji as af,
|
|
4947
|
-
Fa as ag,
|
|
4948
|
-
cc as ah,
|
|
4949
|
-
ba as ai,
|
|
4950
|
-
ic as aj,
|
|
4951
|
-
ac as ak,
|
|
4952
|
-
Ds as al,
|
|
4953
|
-
Ss as am,
|
|
4954
|
-
Aa as an,
|
|
4955
|
-
Al as ao,
|
|
4956
|
-
El as ap,
|
|
4957
|
-
Ms as aq,
|
|
4958
|
-
Le as ar,
|
|
4959
|
-
Fs as as,
|
|
4960
|
-
Vs as at,
|
|
4961
|
-
_l as au,
|
|
4962
|
-
sc as av,
|
|
4963
|
-
oc as aw,
|
|
4964
|
-
Kl as ax,
|
|
4965
|
-
Nl as ay,
|
|
4966
|
-
ql as az,
|
|
4967
|
-
Pl as b,
|
|
4968
|
-
ec as b0,
|
|
4969
|
-
Xl as b1,
|
|
4970
|
-
ss as c,
|
|
4971
|
-
Ca as d,
|
|
4972
|
-
ci as e,
|
|
4973
|
-
Ol as f,
|
|
4974
|
-
Rl as g,
|
|
4975
|
-
Wl as h,
|
|
4976
|
-
xl as i,
|
|
4977
|
-
$l as j,
|
|
4978
|
-
he as k,
|
|
4979
|
-
ea as l,
|
|
4980
|
-
dc as m,
|
|
4981
|
-
Ql as n,
|
|
4982
|
-
at as o,
|
|
4983
|
-
Gl as p,
|
|
4984
|
-
qa as q,
|
|
4985
|
-
Ul as r,
|
|
4986
|
-
ws as s,
|
|
4987
|
-
Os as t,
|
|
4988
|
-
mi as u,
|
|
4989
|
-
yi as v,
|
|
4990
|
-
hn as w,
|
|
4991
|
-
ml as x,
|
|
4992
|
-
Ci as y,
|
|
4993
|
-
Ha as z
|
|
4994
|
-
};
|