react-semaphor 0.1.583 → 0.1.585
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/analytics-protocol/index.js +470 -428
- package/dist/assistant-context/index.js +1 -1
- package/dist/brand-studio/index.js +7 -7
- package/dist/briefings/index.js +4 -4
- package/dist/chunks/aggregate-measure-field-DsFXETpI.js +22 -0
- package/dist/chunks/{assistant-chat-D3fm5qod.js → assistant-chat-BdbLmAnK.js} +12 -12
- package/dist/chunks/{bookmark-impact-Dpxl46Wd.js → bookmark-impact-BhT3k379.js} +2 -2
- package/dist/chunks/{bookmark-state-BEl_G9vr.js → bookmark-state-CL4WEpgB.js} +22 -22
- package/dist/chunks/{card-filter-builder-IxkFVxy2.js → card-filter-builder-CEcKF6Fw.js} +124 -124
- package/dist/chunks/comparison-window-caption-CoART8BC.js +1254 -0
- package/dist/chunks/{dashboard-BMqG98fc.js → dashboard-MPku_x1M.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-D45YfCkm.js → dashboard-briefing-launcher-CkFNlkr1.js} +13 -13
- package/dist/chunks/{dashboard-controls-DOvZRfof.js → dashboard-controls-Clt4ovXS.js} +84 -84
- package/dist/chunks/{dashboard-json-B_4TqF_o.js → dashboard-json-DSmXazIg.js} +4 -4
- package/dist/chunks/{dates-44_rcNj2.js → dates-CYZW9owO.js} +8 -8
- package/dist/chunks/{edit-dashboard-visual-BBPKJWSe.js → edit-dashboard-visual-Dn2ECRbX.js} +2752 -2687
- package/dist/chunks/filter-line-Cu2u1K36.js +131 -0
- package/dist/chunks/{filter-reach-copy-DWPq4Swi.js → filter-reach-copy-CmJpPa4G.js} +1745 -1326
- package/dist/chunks/{filter-value-text-DXGYypEd.js → filter-value-text-xefXzZlf.js} +6 -6
- package/dist/chunks/{index-DPRzcFp0.js → index-0WYn6RMz.js} +37 -37
- package/dist/chunks/{layout-grid-8rR-LPTk.js → layout-grid-9nSS2SL-.js} +1 -1
- package/dist/chunks/{list-filter-C1-uTgjR.js → list-filter-CfMPI6v4.js} +1 -1
- package/dist/chunks/{matrix-analytical-definition-D_HgptqZ.js → matrix-analytical-definition-QjBgUYhP.js} +382 -544
- package/dist/chunks/{matrix-member-presentation-DRa-9e6Q.js → matrix-member-presentation-BKDyxJho.js} +1 -1
- package/dist/chunks/{matrix-operation-contract-DCVinw1o.js → matrix-operation-contract-BM5TveR3.js} +153 -147
- package/dist/chunks/{metric-comparison-n9NsIa-2.js → metric-comparison-ZmurmEIs.js} +3 -3
- package/dist/chunks/{paintbrush-aR17Z3C9.js → paintbrush-LzAje2ff.js} +1 -1
- package/dist/chunks/{palette-a5FCZKFI.js → palette-DicJG0TC.js} +1 -1
- package/dist/chunks/{pivot-header-presentation-MvvlxtIB.js → pivot-header-presentation-CdeTU96P.js} +1 -1
- package/dist/chunks/{pivot-result-contract-expectations-8tuNjRvG.js → pivot-result-contract-expectations-Bx_BCu-7.js} +1029 -1010
- package/dist/chunks/{pivot-result-identity-B89X5xjb.js → pivot-result-identity-Bvs6Uq3v.js} +1 -1
- package/dist/chunks/raw-temporal-value-DH-feMc2.js +322 -0
- package/dist/chunks/{report-preferences-dialog-B8PhISua.js → report-preferences-dialog-BRaeufEi.js} +63 -62
- package/dist/chunks/{report-runtime-context-BhPzLTbS.js → report-runtime-context-NlOXwyRB.js} +1 -1
- package/dist/chunks/{resolve-dashboard-input-context-BfT8y5xL.js → resolve-dashboard-input-context-Cn9jumxl.js} +4924 -4823
- package/dist/chunks/{save-D985VvYp.js → save-0wu1Z1U7.js} +1 -1
- package/dist/chunks/{saved-dashboard-context-DH91-2B9.js → saved-dashboard-context-CfqkUMzR.js} +6 -6
- package/dist/chunks/selection-filter-compiler-BReJy-uv.js +92 -0
- package/dist/chunks/{semaphor-ready-indicator-Cg_Z2IDc.js → semaphor-ready-indicator-D6WjdTGl.js} +48377 -47074
- package/dist/chunks/{shelf-drop-preview-context-C7-BgcP4.js → shelf-drop-preview-context-Bbbrr9u4.js} +5 -5
- package/dist/chunks/{stored-dashboard-BpyCiE49.js → stored-dashboard-sPkTjxYf.js} +210 -221
- package/dist/chunks/{style-sheet-parts-C7qGZuH1.js → style-sheet-parts-_dGSFzDi.js} +2 -2
- package/dist/chunks/{table-export-sheet-wBkk17aa.js → table-export-sheet-Dmtqi5NV.js} +1 -1
- package/dist/chunks/{token-types-iKMplaBL.js → token-types-DEe_FP4l.js} +1 -1
- package/dist/chunks/{upload-CiGNKJ_0.js → upload-CtyOkU_B.js} +1 -1
- package/dist/chunks/{validators-B8fpdinG.js → validators-CJ8Jh0E8.js} +2 -2
- package/dist/chunks/{variable-draft-D8GFhAkm.js → variable-draft-D1RotIEG.js} +4 -4
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +670 -647
- package/dist/format-utils/index.js +218 -215
- package/dist/index.js +234 -231
- package/dist/report-runtime-context/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/components/visual/data-table/types/data-table.d.ts +3 -0
- package/dist/types/components/visual/matrix-table/matrix-interaction-actions.d.ts +24 -3
- package/dist/types/index.js +5 -5
- package/dist/types/lib/hooks/interactions/use-drill-actions.d.ts +1 -1
- package/dist/types/lib/interactions/get-click-context-from-chartjs.d.ts +9 -0
- package/dist/types/lib/matrix-table/matrix-runtime.d.ts +8 -3
- package/dist/types/lib/query-context/compile-selection-filters.d.ts +1 -5
- package/dist/types/lib/see-records/click.d.ts +79 -0
- package/dist/types/lib/see-records/see-records-offer.d.ts +25 -0
- package/dist/types/lib/see-records/use-see-records-offer.d.ts +16 -0
- package/dist/types/lib/types/common-types.d.ts +6 -0
- package/dist/types/shared/analytics-protocol/aggregate-expression.d.ts +7 -0
- package/dist/types/shared/analytics-protocol/aggregate-measure-field.d.ts +13 -0
- package/dist/types/shared/analytics-protocol/index.d.ts +1 -0
- package/dist/types/shared/analytics-protocol/selection-filter-compiler.d.ts +3 -0
- package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +6 -0
- package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +1 -1
- package/dist/types/shared/dashboard-authoring/card-settings/index.d.ts +1 -1
- package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +2 -0
- package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +2 -0
- package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +1 -0
- package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +10 -10
- package/dist/types/shared/dashboard-authoring/index.d.ts +2 -0
- package/dist/types/shared/dashboard-authoring/kpi-date-context.d.ts +191 -0
- package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +14 -0
- package/dist/types/shared/dashboard-authoring/see-records/availability.d.ts +30 -0
- package/dist/types/shared/dashboard-authoring/see-records/click.d.ts +37 -0
- package/dist/types/shared/dashboard-authoring/see-records/index.d.ts +12 -0
- package/dist/types/shared/dashboard-authoring/see-records/limits.d.ts +18 -0
- package/dist/types/shared/dashboard-authoring/see-records/measure-kind.d.ts +49 -0
- package/dist/types/shared/dashboard-authoring/see-records/request.d.ts +28 -0
- package/dist/types/shared/dashboard-authoring/see-records/result.d.ts +94 -0
- package/dist/types/shared/format-utils/semantic-format.d.ts +0 -1
- package/dist/types/shared/format-utils/temporal-bucket.d.ts +20 -0
- package/dist/types/shared/temporal/calendar-periods.d.ts +15 -0
- package/dist/types/shared/temporal/raw-temporal-equality.d.ts +14 -0
- package/dist/types/shared/usage-events/envelope.d.ts +4 -4
- package/package.json +1 -1
- package/dist/chunks/comparison-window-caption-sRFtnX1q.js +0 -1371
- package/dist/chunks/raw-temporal-value-DdT0s47W.js +0 -159
- package/dist/chunks/selection-filter-compiler-CUDRnUxc.js +0 -80
|
@@ -0,0 +1,1254 @@
|
|
|
1
|
+
import { aE as He, i as ze, k as U, n as Ge, T as Pe, aF as ae, aG as $e, aH as qe, aI as Ie, aJ as Le, ar as Xe, aw as Ye, as as We, a as Je, b as B, a7 as de, al as Ze, a5 as Qe, am as et, f as tt, q as fe, t as rt, Z as pe, $ as nt, a1 as ot, a8 as at, aK as I, aL as K } from "./pivot-result-contract-expectations-Bx_BCu-7.js";
|
|
2
|
+
import { h as Y, e as st, p as it, k as ct } from "./export-file-format-C-tJsxsf.js";
|
|
3
|
+
import { aU as j, a5 as lt, m as q, aT as ut, r as mt } from "./validators-CJ8Jh0E8.js";
|
|
4
|
+
import "./matrix-operation-contract-BM5TveR3.js";
|
|
5
|
+
import "./analytics-base-schemas-BaIQrEzX.js";
|
|
6
|
+
import { readPdfCapacityFacts as dt, PDF_SAFETY_LIMIT_EXCEEDED as se, PDF_CAPACITY as k, PDF_NUMBER_COLUMN_TOO_WIDE as Me, getUtf8ByteLength as ft, FAST_PDF_POLICY as pt, isPdfCapacityRefusalCode as ht } from "../pdf-export-policy/index.js";
|
|
7
|
+
import { p as bt } from "./pivot-header-presentation-CdeTU96P.js";
|
|
8
|
+
import { c as yt, b as he } from "./pivot-result-identity-Bvs6Uq3v.js";
|
|
9
|
+
import { v as gt } from "./raw-temporal-value-DH-feMc2.js";
|
|
10
|
+
function wt(e, t, r) {
|
|
11
|
+
const n = {
|
|
12
|
+
...t,
|
|
13
|
+
locale: t.locale ?? r
|
|
14
|
+
};
|
|
15
|
+
if (n.type === "number")
|
|
16
|
+
return U(e, n);
|
|
17
|
+
const { prefix: o, suffix: i, ...l } = n;
|
|
18
|
+
return `${o ?? ""}${U(e, {
|
|
19
|
+
...l,
|
|
20
|
+
negativeStyle: n.type === "currency" ? n.negativeStyle : "minus"
|
|
21
|
+
})}${i ?? ""}`;
|
|
22
|
+
}
|
|
23
|
+
function Q(e, t, r) {
|
|
24
|
+
return e === null ? { value: e, text: null } : !t || !ze(t) && t.type !== "duration" ? {
|
|
25
|
+
value: e,
|
|
26
|
+
text: U(e, { type: "number", locale: r })
|
|
27
|
+
} : t.type === "duration" ? {
|
|
28
|
+
value: e,
|
|
29
|
+
text: Ge(e, {
|
|
30
|
+
inputUnit: t.inputUnit,
|
|
31
|
+
outputStyle: t.outputStyle,
|
|
32
|
+
largestUnit: t.largestUnit,
|
|
33
|
+
smallestUnit: t.smallestUnit,
|
|
34
|
+
maxUnits: t.maxUnits,
|
|
35
|
+
prefix: t.prefix,
|
|
36
|
+
suffix: t.suffix,
|
|
37
|
+
negativeInParentheses: t.negativeStyle === "parentheses"
|
|
38
|
+
})
|
|
39
|
+
} : { value: e, text: wt(e, t, r) };
|
|
40
|
+
}
|
|
41
|
+
function be(e, t, r, n) {
|
|
42
|
+
return e === null ? { value: e, text: null } : n === "percent" ? {
|
|
43
|
+
value: e,
|
|
44
|
+
text: U(e, {
|
|
45
|
+
type: "percent",
|
|
46
|
+
locale: r,
|
|
47
|
+
minimumFractionDigits: t,
|
|
48
|
+
maximumFractionDigits: t,
|
|
49
|
+
percentValueMode: "fraction"
|
|
50
|
+
})
|
|
51
|
+
} : {
|
|
52
|
+
value: e,
|
|
53
|
+
text: U(e, {
|
|
54
|
+
type: "number",
|
|
55
|
+
locale: r,
|
|
56
|
+
minimumFractionDigits: t,
|
|
57
|
+
maximumFractionDigits: t,
|
|
58
|
+
suffix: "×"
|
|
59
|
+
})
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function ye(e, t) {
|
|
63
|
+
if (e === void 0) return t;
|
|
64
|
+
if (!Number.isInteger(e) || e < 0 || e > 6)
|
|
65
|
+
throw new RangeError("Comparison precision must be an integer from 0 to 6.");
|
|
66
|
+
return e;
|
|
67
|
+
}
|
|
68
|
+
function Fr(e, t) {
|
|
69
|
+
const r = {
|
|
70
|
+
mode: t.displayMode,
|
|
71
|
+
current: Q(
|
|
72
|
+
e.currentValue,
|
|
73
|
+
t.metricFormat,
|
|
74
|
+
t.locale
|
|
75
|
+
),
|
|
76
|
+
comparison: Q(
|
|
77
|
+
e.comparisonValue,
|
|
78
|
+
t.metricFormat,
|
|
79
|
+
t.locale
|
|
80
|
+
)
|
|
81
|
+
};
|
|
82
|
+
return (t.displayMode === "difference" || t.displayMode === "both") && (r.difference = Q(
|
|
83
|
+
e.delta,
|
|
84
|
+
He(t.metricFormat),
|
|
85
|
+
t.locale
|
|
86
|
+
)), (t.displayMode === "percent_change" || t.displayMode === "both") && (r.percentChange = be(
|
|
87
|
+
e.percentChange,
|
|
88
|
+
ye(t.precision, 1),
|
|
89
|
+
t.locale,
|
|
90
|
+
"percent"
|
|
91
|
+
)), t.displayMode === "ratio" && (r.ratio = be(
|
|
92
|
+
e.ratio,
|
|
93
|
+
ye(t.precision, 2),
|
|
94
|
+
t.locale,
|
|
95
|
+
"ratio"
|
|
96
|
+
)), r;
|
|
97
|
+
}
|
|
98
|
+
const xt = /* @__PURE__ */ new Set(["second", "minute", "hour", "day", "month"]);
|
|
99
|
+
function vt(e) {
|
|
100
|
+
const { presentation: t } = e;
|
|
101
|
+
return e.formattedValues ? (t == null ? void 0 : t.kind) === "text" || (t == null ? void 0 : t.kind) === "measure" && t.format.type === "duration" ? "text" : (t == null ? void 0 : t.kind) === "temporal_bucket" ? xt.has(t.grain) ? "date" : "text" : (t == null ? void 0 : t.kind) === "datetime" ? "date" : e.dataType === "number" ? "number" : e.dataType === "boolean" ? "boolean" : e.dataType === "unknown" ? "by_value" : "text" : "by_value";
|
|
102
|
+
}
|
|
103
|
+
function Ct(e) {
|
|
104
|
+
const t = (o, i) => Number.isInteger(o) ? Math.min(20, Math.max(0, o)) : i, r = t(e.minimumFractionDigits, 0), n = Math.max(r, t(e.maximumFractionDigits, 2));
|
|
105
|
+
return n === 0 ? "" : `.${"0".repeat(n)}`;
|
|
106
|
+
}
|
|
107
|
+
function ee(e) {
|
|
108
|
+
return `"${e.replace(/"/g, "")}"`;
|
|
109
|
+
}
|
|
110
|
+
function _t(e) {
|
|
111
|
+
let t;
|
|
112
|
+
try {
|
|
113
|
+
t = new Intl.NumberFormat(e.locale ?? "en-US", {
|
|
114
|
+
style: "currency",
|
|
115
|
+
currency: e.currency || "USD"
|
|
116
|
+
}).formatToParts(1);
|
|
117
|
+
} catch {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const r = t.findIndex((i) => i.type === "currency"), n = t.findIndex((i) => i.type === "integer");
|
|
121
|
+
if (r < 0 || n < 0) return;
|
|
122
|
+
const o = (i, l) => t.slice(i, l).filter((c) => c.type === "literal").map((c) => c.value.replace(/\s/g, " ")).join("");
|
|
123
|
+
return r < n ? { side: "before", text: t[r].value + o(r + 1, n) } : {
|
|
124
|
+
side: "after",
|
|
125
|
+
text: o(n + 1, r) + t[r].value
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function Tt(e) {
|
|
129
|
+
const t = Ct(e);
|
|
130
|
+
let r;
|
|
131
|
+
if (e.type === "scientific")
|
|
132
|
+
r = `0${t}E+00`;
|
|
133
|
+
else {
|
|
134
|
+
const n = `${e.useGrouping === !1 ? "0" : "#,##0"}${t}`;
|
|
135
|
+
if (e.type === "currency") {
|
|
136
|
+
const o = _t(e);
|
|
137
|
+
r = o ? o.side === "before" ? `${ee(o.text)}${n}` : `${n}${ee(o.text)}` : n;
|
|
138
|
+
} else e.type === "percent" ? r = e.percentValueMode === "whole" ? `${n}${ee("%")}` : `${n}%` : r = n;
|
|
139
|
+
}
|
|
140
|
+
return e.negativeStyle === "parentheses" ? `${r};(${r})` : r;
|
|
141
|
+
}
|
|
142
|
+
function Et(e, t) {
|
|
143
|
+
if (!e.formattedValues) return;
|
|
144
|
+
const { presentation: r } = e;
|
|
145
|
+
if (t === "number" || t === "by_value")
|
|
146
|
+
return (r == null ? void 0 : r.kind) !== "measure" || r.format.type === "duration" ? void 0 : Tt(r.format);
|
|
147
|
+
if (t === "date") {
|
|
148
|
+
if ((r == null ? void 0 : r.kind) === "temporal_bucket")
|
|
149
|
+
return r.grain === "day" ? "yyyy-mm-dd" : r.grain === "month" ? "mmm yyyy" : "yyyy-mm-dd hh:mm";
|
|
150
|
+
if ((r == null ? void 0 : r.kind) === "datetime")
|
|
151
|
+
return r.dateOnly ? "yyyy-mm-dd" : "yyyy-mm-dd hh:mm:ss";
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
function ge(e) {
|
|
155
|
+
const t = vt(e), r = Et(e, t);
|
|
156
|
+
return Object.freeze({
|
|
157
|
+
key: e.key,
|
|
158
|
+
label: e.label,
|
|
159
|
+
cellType: t,
|
|
160
|
+
...r === void 0 ? {} : { numberFormat: r }
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
const Ft = 15, St = /^-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/;
|
|
164
|
+
function De(e) {
|
|
165
|
+
return St.test(e) ? e : void 0;
|
|
166
|
+
}
|
|
167
|
+
function we(e) {
|
|
168
|
+
const r = e.replace(/^-/, "").replace(/[eE].*$/, "").replace(".", "").replace(/^0+/, "").replace(/0+$/, "");
|
|
169
|
+
if (r.length > Ft) return !1;
|
|
170
|
+
const n = Number(e);
|
|
171
|
+
return Number.isFinite(n) && (n !== 0 || r.length === 0);
|
|
172
|
+
}
|
|
173
|
+
const Pt = Date.UTC(1900, 2, 1), $t = Date.UTC(1e4, 0, 1), It = Date.UTC(1899, 11, 30), Lt = 864e5;
|
|
174
|
+
function Mt(e) {
|
|
175
|
+
const t = Date.UTC(
|
|
176
|
+
e.year,
|
|
177
|
+
e.month - 1,
|
|
178
|
+
e.day,
|
|
179
|
+
e.hour,
|
|
180
|
+
e.minute,
|
|
181
|
+
e.second
|
|
182
|
+
);
|
|
183
|
+
if (!(e.year < 1900 || !Number.isFinite(t)) && !(t < Pt || t >= $t))
|
|
184
|
+
return (t - It) / Lt;
|
|
185
|
+
}
|
|
186
|
+
function xe(e, t, r) {
|
|
187
|
+
if (typeof e == "number")
|
|
188
|
+
return Number.isFinite(e) ? { kind: "number", text: t, value: e } : void 0;
|
|
189
|
+
if (j(e))
|
|
190
|
+
return we(e.value) ? { kind: "number", text: t, value: e } : void 0;
|
|
191
|
+
if (r && typeof e == "string") {
|
|
192
|
+
const n = De(e);
|
|
193
|
+
return n !== void 0 && we(n) ? { kind: "number", text: t, value: n } : void 0;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function H(e) {
|
|
197
|
+
const { value: t, text: r, column: n } = e;
|
|
198
|
+
if (r === "") return { kind: "empty" };
|
|
199
|
+
const o = { kind: "text", text: r };
|
|
200
|
+
switch (n.cellType) {
|
|
201
|
+
case "text":
|
|
202
|
+
return o;
|
|
203
|
+
case "date": {
|
|
204
|
+
const i = e.wallClock ? Mt(e.wallClock) : void 0;
|
|
205
|
+
return i === void 0 ? o : { kind: "date", text: r, serial: i };
|
|
206
|
+
}
|
|
207
|
+
case "number":
|
|
208
|
+
return xe(t, r, !0) ?? o;
|
|
209
|
+
case "boolean":
|
|
210
|
+
return typeof t == "boolean" ? { kind: "boolean", text: r, value: t } : o;
|
|
211
|
+
case "by_value":
|
|
212
|
+
return typeof t == "boolean" ? { kind: "boolean", text: r, value: t } : xe(t, r, !1) ?? o;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
function Sr(e) {
|
|
216
|
+
return e.kind === "empty" ? "" : e.text;
|
|
217
|
+
}
|
|
218
|
+
const Pr = {
|
|
219
|
+
rowLabels: "tabular",
|
|
220
|
+
subtotals: "after"
|
|
221
|
+
};
|
|
222
|
+
function $r(e, t) {
|
|
223
|
+
const r = t.rowLabels === "outline" ? { kind: "compact" } : e.layout.kind === "tabular" ? e.layout : { kind: "tabular", repeatLabels: !1 }, n = e.totals.rows;
|
|
224
|
+
return {
|
|
225
|
+
...e,
|
|
226
|
+
layout: r,
|
|
227
|
+
totals: {
|
|
228
|
+
...e.totals,
|
|
229
|
+
rows: {
|
|
230
|
+
...n,
|
|
231
|
+
levels: Object.fromEntries(
|
|
232
|
+
Object.entries(n.levels).map(([o, i]) => [
|
|
233
|
+
o,
|
|
234
|
+
{ ...i, position: t.subtotals }
|
|
235
|
+
])
|
|
236
|
+
)
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
const Dt = 2;
|
|
242
|
+
function kt(e) {
|
|
243
|
+
return typeof e == "number" ? Number.isInteger(e) : j(e) ? !e.value.includes(".") : !0;
|
|
244
|
+
}
|
|
245
|
+
function At(e, t, r) {
|
|
246
|
+
const n = e.descriptors.measures.filter(
|
|
247
|
+
(l) => r.measureFormats[l.id] === void 0 && l.semanticFormat === void 0 && lt(l.column.dataType) === "number"
|
|
248
|
+
);
|
|
249
|
+
if (n.length === 0) return r;
|
|
250
|
+
const o = /* @__PURE__ */ new Set();
|
|
251
|
+
e.columns.forEach((l, c) => {
|
|
252
|
+
if (!(l.kind !== "measure" || o.has(l.measureId)))
|
|
253
|
+
for (const f of t) {
|
|
254
|
+
const h = f.values[c];
|
|
255
|
+
if ((h == null ? void 0 : h.kind) === "value" && !kt(h.value)) {
|
|
256
|
+
o.add(l.measureId);
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
const i = { ...r.measureFormats };
|
|
262
|
+
for (const { id: l } of n) {
|
|
263
|
+
const c = o.has(l) ? Dt : 0;
|
|
264
|
+
i[l] = {
|
|
265
|
+
type: "number",
|
|
266
|
+
minimumFractionDigits: c,
|
|
267
|
+
maximumFractionDigits: c,
|
|
268
|
+
useGrouping: !0
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
return { ...r, measureFormats: i };
|
|
272
|
+
}
|
|
273
|
+
function z(e) {
|
|
274
|
+
return q(e.slice(0, -1));
|
|
275
|
+
}
|
|
276
|
+
function Nt(e, t) {
|
|
277
|
+
return t.length > e.length && q(t.slice(0, e.length)) === q(e);
|
|
278
|
+
}
|
|
279
|
+
function Ot(e) {
|
|
280
|
+
return e.map((t, r) => {
|
|
281
|
+
if (r === 0 || t.kind !== "layout") return !1;
|
|
282
|
+
const n = e[r - 1];
|
|
283
|
+
if (n.kind !== "layout") return !1;
|
|
284
|
+
if (t.role !== "member" || Nt(n.rowPath, t.rowPath)) return !0;
|
|
285
|
+
const o = e[r - 2];
|
|
286
|
+
return n.role === "member" && (!o || o.kind !== "layout" || o.role !== "member" || z(o.rowPath) !== z(n.rowPath)) && t.rowPath.length === n.rowPath.length && z(t.rowPath) === z(n.rowPath);
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
const Rt = "pdf-group-continuation";
|
|
290
|
+
function ke(e, t, r) {
|
|
291
|
+
return !(r != null && r.hasTextAffixes) && t.kind === "value" && (typeof t.value == "number" || j(t.value)) ? e : Y(e);
|
|
292
|
+
}
|
|
293
|
+
function Ut(e, t, r) {
|
|
294
|
+
const n = Pe(e.descriptors, t.presentation, r), o = e.columns.map((u) => {
|
|
295
|
+
var a;
|
|
296
|
+
return u.kind === "measure" && ((a = n.measureSemantics.get(u.measureId)) == null ? void 0 : a.isNumeric) === !0;
|
|
297
|
+
}), i = (u) => ae([u], n.levels), l = (u, a, m) => $e(u, a, t.presentation.totals[m], n.levels), c = e.columns.map((u) => {
|
|
298
|
+
if (u.kind !== "measure") return u.label;
|
|
299
|
+
const a = u.columnPath.map(i);
|
|
300
|
+
return u.role !== "member" && a.push(l(u.columnPath, u.role, "columns")), [...a, u.label].join(" / ");
|
|
301
|
+
}), f = Math.min(t.spec.columns.length, Math.max(
|
|
302
|
+
0,
|
|
303
|
+
...e.columns.map((u) => u.kind === "measure" ? u.columnPath.length + (u.role !== "member" ? 1 : 0) : 0)
|
|
304
|
+
)), h = Array.from({ length: f + 1 }, (u, a) => e.columns.map((m) => a === f ? m.label : m.kind !== "measure" ? "" : a < m.columnPath.length ? i(m.columnPath[a]) : a === m.columnPath.length && m.role !== "member" ? l(m.columnPath, m.role, "columns") : "")), y = (u, a) => qe({
|
|
305
|
+
path: u.rowPath,
|
|
306
|
+
role: u.kind === "layout" ? u.role : "member",
|
|
307
|
+
levelCount: Math.max(1, t.spec.rows.length),
|
|
308
|
+
repeatLabels: t.presentation.layout.kind !== "tabular" || t.presentation.layout.repeatLabels,
|
|
309
|
+
previousPath: a == null ? void 0 : a.rowPath
|
|
310
|
+
}), w = (u, a) => {
|
|
311
|
+
if (u.kind !== "layout") throw new Error("Layout presentation requires layout rows.");
|
|
312
|
+
if (u.values.length !== e.columns.length) throw new Error("Matrix row does not match its frozen layout.");
|
|
313
|
+
const m = y(u, a);
|
|
314
|
+
return e.columns.map((b, d) => {
|
|
315
|
+
if (b.kind === "hierarchy")
|
|
316
|
+
return `${" ".repeat(Math.max(0, u.rowPath.length - 1))}${l(u.rowPath, u.role, "rows")}`;
|
|
317
|
+
if (b.kind === "level") {
|
|
318
|
+
const x = t.spec.rows.findIndex((P) => P.id === b.levelId), v = m[x];
|
|
319
|
+
return v != null && v.visible ? v.total ? l(u.rowPath, u.role, "rows") : ae(v.path, n.levels) : "";
|
|
320
|
+
}
|
|
321
|
+
const C = u.values[d], g = n.measures.get(b.measureId);
|
|
322
|
+
if (C.kind === "value" && !g)
|
|
323
|
+
throw new Error("Matrix value is missing its measure descriptor.");
|
|
324
|
+
return Ie(C, g, t.presentation.absence);
|
|
325
|
+
});
|
|
326
|
+
}, T = (u, a) => w(u, a).map((m, b) => {
|
|
327
|
+
const d = e.columns[b];
|
|
328
|
+
return d.kind === "measure" ? ke(m, u.values[b], n.measureSemantics.get(d.measureId)) : Y(m);
|
|
329
|
+
});
|
|
330
|
+
return {
|
|
331
|
+
headers: c,
|
|
332
|
+
headerBands: h,
|
|
333
|
+
numericColumns: o,
|
|
334
|
+
/** The card's prepared formats this presentation formats with (the Excel form reads its measure formats). */
|
|
335
|
+
formatting: n,
|
|
336
|
+
/** A row's cells; after `previous`, a tabular layout prints each label once. */
|
|
337
|
+
row: (u, a) => w(u, a),
|
|
338
|
+
/**
|
|
339
|
+
* Level columns whose group label the row above shows, so this row
|
|
340
|
+
* continues the group (Plan 2, 2d, C8). Only a member row after a member
|
|
341
|
+
* row continues one: a total prints as a band, and its rules stay whole
|
|
342
|
+
* above and below it.
|
|
343
|
+
*/
|
|
344
|
+
continuedColumns: (u, a) => {
|
|
345
|
+
const m = (d) => (d == null ? void 0 : d.kind) === "layout" && d.role === "member";
|
|
346
|
+
if (!m(u) || !m(a)) return [];
|
|
347
|
+
const b = y(u, a);
|
|
348
|
+
return e.columns.flatMap((d, C) => {
|
|
349
|
+
var x;
|
|
350
|
+
if (d.kind !== "level") return [];
|
|
351
|
+
const g = t.spec.rows.findIndex((v) => v.id === d.levelId);
|
|
352
|
+
return g < u.rowPath.length && ((x = b[g]) == null ? void 0 : x.visible) === !1 ? [C] : [];
|
|
353
|
+
});
|
|
354
|
+
},
|
|
355
|
+
csvRow: (u) => T(u),
|
|
356
|
+
/**
|
|
357
|
+
* `previousRow` is the row before `data[0]`, carried by the export's
|
|
358
|
+
* continuation, so a tabular layout prints each label once across the
|
|
359
|
+
* whole file. Retries are pure: suppression never relies on mutable
|
|
360
|
+
* formatter state or an earlier worker. Without it, the first row prints
|
|
361
|
+
* its labels.
|
|
362
|
+
*/
|
|
363
|
+
csvRows: (u, a) => u.map((m, b) => T(m, b ? u[b - 1] : a ?? void 0))
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
function Ir(e) {
|
|
367
|
+
return e.columns.map((t) => Y(t.label));
|
|
368
|
+
}
|
|
369
|
+
function Lr(e, t, r) {
|
|
370
|
+
return Kt(e, t, r).map((n, o) => {
|
|
371
|
+
const i = t.columns[o];
|
|
372
|
+
return i.kind === "measure" ? ke(n, e.values[o], r.measureSemantics.get(i.measureId)) : Y(n);
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
function Kt(e, t, r) {
|
|
376
|
+
if (e.kind !== "flat") throw new Error("Flat Matrix CSV requires flat rows.");
|
|
377
|
+
if (e.values.length !== t.columns.length) throw new Error("Matrix row does not match its frozen layout.");
|
|
378
|
+
const n = [...e.rowPath, ...e.columnPath];
|
|
379
|
+
return t.columns.map((o, i) => {
|
|
380
|
+
if (o.kind === "measure") {
|
|
381
|
+
const c = e.values[i], f = r.measures.get(o.measureId);
|
|
382
|
+
if (c.kind === "value" && !f) throw new Error("Matrix value is missing its measure descriptor.");
|
|
383
|
+
return Ie(c, f, r.absence);
|
|
384
|
+
}
|
|
385
|
+
const l = o.kind === "level" ? n.find((c) => c.levelId === o.levelId) : void 0;
|
|
386
|
+
if (!l) throw new Error("Flat Matrix row does not match its frozen layout.");
|
|
387
|
+
return ae([l], r.levels);
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
function jt(e) {
|
|
391
|
+
const t = Ut(e.layout, e.request, e.report), r = e.layout.columns.map((l, c) => ({
|
|
392
|
+
index: c,
|
|
393
|
+
columnId: `matrix:${c}`,
|
|
394
|
+
label: t.headers[c],
|
|
395
|
+
isNumeric: t.numericColumns[c]
|
|
396
|
+
})), n = (l, c, f) => ({
|
|
397
|
+
text: l,
|
|
398
|
+
colspan: 1,
|
|
399
|
+
rowspan: 1,
|
|
400
|
+
columnId: r[c].columnId,
|
|
401
|
+
isHeader: f,
|
|
402
|
+
isNumeric: r[c].isNumeric,
|
|
403
|
+
className: r[c].isNumeric ? "numeric" : e.layout.columns[c].kind === "hierarchy" ? "matrix-hierarchy" : ""
|
|
404
|
+
}), o = [], i = e.layout.columns.findIndex((l) => l.kind === "measure");
|
|
405
|
+
e.request.spec.columns.length && i >= 0 && o.push({
|
|
406
|
+
repeatHeader: !0,
|
|
407
|
+
headerType: "pivot-axis",
|
|
408
|
+
headerRowIndex: 0,
|
|
409
|
+
cells: [
|
|
410
|
+
...i ? [{ ...n("", 0, !0), colspan: i }] : [],
|
|
411
|
+
{
|
|
412
|
+
...n(e.request.spec.columns.map((l) => Le(l, e.request.presentation)).join(" / "), i, !0),
|
|
413
|
+
colspan: e.layout.columns.length - i,
|
|
414
|
+
isNumeric: !1,
|
|
415
|
+
className: ""
|
|
416
|
+
}
|
|
417
|
+
]
|
|
418
|
+
});
|
|
419
|
+
for (const [l, c] of t.headerBands.entries())
|
|
420
|
+
o.push({
|
|
421
|
+
repeatHeader: !0,
|
|
422
|
+
headerType: l === t.headerBands.length - 1 ? "metrics" : "pivot-level",
|
|
423
|
+
headerRowIndex: o.length,
|
|
424
|
+
cells: c.map((f, h) => n(f, h, !0))
|
|
425
|
+
});
|
|
426
|
+
return {
|
|
427
|
+
headers: o,
|
|
428
|
+
rows: e.rows.map((l, c) => {
|
|
429
|
+
const f = new Set(t.continuedColumns(l, e.rows[c - 1]));
|
|
430
|
+
return {
|
|
431
|
+
index: c,
|
|
432
|
+
type: l.kind === "layout" && l.role !== "member" ? "subtotal" : "data",
|
|
433
|
+
subtotalLevel: String(l.rowPath.length),
|
|
434
|
+
// A tabular layout prints each label once unless it repeats them; the
|
|
435
|
+
// blank cell continues its group, so a grid draws no rule above it.
|
|
436
|
+
cells: t.row(l, e.rows[c - 1]).map((h, y) => f.has(y) ? { ...n(h, y, !1), className: Rt } : n(h, y, !1))
|
|
437
|
+
};
|
|
438
|
+
}),
|
|
439
|
+
grandTotal: null,
|
|
440
|
+
// Totals are already in the ordered body at their authored position.
|
|
441
|
+
metadata: {
|
|
442
|
+
tableType: "pivot",
|
|
443
|
+
totalRows: e.rows.length,
|
|
444
|
+
totalColumns: r.length,
|
|
445
|
+
rowLevels: e.layout.columns.filter((l) => l.kind !== "measure").length,
|
|
446
|
+
pivotLevels: e.request.spec.columns.length,
|
|
447
|
+
hasGrandTotal: !1,
|
|
448
|
+
columnOrder: r.map((l) => l.columnId),
|
|
449
|
+
columns: r
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
function Vt(e, t, r) {
|
|
454
|
+
const { levels: n } = Pe(e.descriptors, t.presentation, r), o = t.spec.columns.length > 0, i = [], l = [], c = e.columns.map((h, y) => {
|
|
455
|
+
if (h.kind !== "measure") return null;
|
|
456
|
+
const w = o ? `${h.role}:${q(h.columnPath)}` : `measure:${y}`;
|
|
457
|
+
let T = i.indexOf(w);
|
|
458
|
+
return T < 0 && (T = i.push(w) - 1, l.push(o ? $e(h.columnPath, h.role, t.presentation.totals.columns, n) : h.label)), T;
|
|
459
|
+
}), f = t.spec.columns[t.spec.columns.length - 1];
|
|
460
|
+
return {
|
|
461
|
+
columnGroups: c,
|
|
462
|
+
groupLabels: l,
|
|
463
|
+
/** What bands name their groups by: the innermost column level, or "Measures". */
|
|
464
|
+
groupLevelLabel: f ? Le(f, t.presentation) : "Measures"
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
function Mr(e) {
|
|
468
|
+
const { layout: t, rows: r, report: n } = e, o = {
|
|
469
|
+
...e.request,
|
|
470
|
+
presentation: At(t, r, e.request.presentation)
|
|
471
|
+
}, i = jt({ layout: t, rows: r, request: o, report: n }), l = Ot(r), c = Vt(t, o, n), f = {
|
|
472
|
+
...i,
|
|
473
|
+
rows: i.rows.map((h, y) => ({ ...h, keepWithPrevious: l[y] })),
|
|
474
|
+
metadata: { ...i.metadata, ...c }
|
|
475
|
+
};
|
|
476
|
+
return { request: o, table: f, ...c };
|
|
477
|
+
}
|
|
478
|
+
const S = (e) => e.toLocaleString("en-US"), G = (e) => `${S(Math.ceil(e / 1048576))} MB`, te = "export the data as CSV or Excel";
|
|
479
|
+
function Dr(e) {
|
|
480
|
+
const t = dt(e.facts), r = e.dataExport ? `Add a filter to narrow it, or ${te}.` : "Add a filter to narrow it, then export again.";
|
|
481
|
+
switch (e.code) {
|
|
482
|
+
case "PDF_ROW_LIMIT_EXCEEDED": {
|
|
483
|
+
const n = e.subject ?? "This table", o = t.rowLimit ?? k.maxTableRows;
|
|
484
|
+
return t.rowCount !== void 0 ? `${n} has ${S(t.rowCount)} rows. A PDF holds up to ${S(o)} rows per table. ${r}` : `${n} has more than ${S(o)} rows, the most a PDF holds per table. ${r}`;
|
|
485
|
+
}
|
|
486
|
+
case "PDF_PAGE_LIMIT_EXCEEDED": {
|
|
487
|
+
const n = e.subject ?? "This PDF", o = t.pageLimit ?? k.maxPages;
|
|
488
|
+
return t.pageCount !== void 0 ? `${n} is ${S(t.pageCount)} pages. A PDF holds up to ${S(o)}. ${r}` : `${n} is longer than ${S(o)} pages, the most a PDF holds. ${r}`;
|
|
489
|
+
}
|
|
490
|
+
case "PDF_SIZE_LIMIT_EXCEEDED": {
|
|
491
|
+
const n = e.subject ?? "This PDF", o = t.byteLimit ?? k.maxFileBytes;
|
|
492
|
+
return t.bytes !== void 0 ? `${n} is ${G(t.bytes)}. A PDF file holds up to ${G(o)}. ${r}` : `${n} is larger than ${G(o)}, the most a PDF file holds. ${r}`;
|
|
493
|
+
}
|
|
494
|
+
case "PDF_CAPTURE_TOO_TALL":
|
|
495
|
+
return `${e.subject ?? "This dashboard"} is too long to print as one PDF. Print one sheet or fewer cards${e.dataExport ? `, or ${te}` : ""}.`;
|
|
496
|
+
case Me:
|
|
497
|
+
return `A number in this table is too wide for its column in a PDF. Use landscape or fewer columns${e.dataExport ? `, or ${te}` : ""}.`;
|
|
498
|
+
case se:
|
|
499
|
+
return `This PDF is over what a PDF holds: ${S(k.maxTableRows)} rows per table, ${S(
|
|
500
|
+
k.maxPages
|
|
501
|
+
)} pages and ${G(k.maxFileBytes)}. ${r}`;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
class Bt extends Error {
|
|
505
|
+
constructor(t, r = se) {
|
|
506
|
+
super(t), this.code = r;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
function Ht(e) {
|
|
510
|
+
return ht(e) || e === se || e === Me;
|
|
511
|
+
}
|
|
512
|
+
function ve(e) {
|
|
513
|
+
if (!e || typeof e != "object")
|
|
514
|
+
return;
|
|
515
|
+
const { error: t, message: r, detail: n } = e;
|
|
516
|
+
for (const o of [t, r, n])
|
|
517
|
+
if (typeof o == "string" && o.trim())
|
|
518
|
+
return o.trim();
|
|
519
|
+
}
|
|
520
|
+
async function zt(e) {
|
|
521
|
+
const t = `PDF request failed: ${e.status} ${e.statusText}`.trim(), r = e.headers.get("content-type") || "";
|
|
522
|
+
try {
|
|
523
|
+
if (r.includes("application/json")) {
|
|
524
|
+
const o = await e.json(), i = typeof o.code == "string" ? o.code : typeof o.errorCode == "string" ? o.errorCode : void 0;
|
|
525
|
+
return { message: ve(o) || t, code: i };
|
|
526
|
+
}
|
|
527
|
+
const n = await e.text();
|
|
528
|
+
if (!n.trim())
|
|
529
|
+
return { message: t };
|
|
530
|
+
try {
|
|
531
|
+
const o = JSON.parse(n), i = typeof o.code == "string" ? o.code : typeof o.errorCode == "string" ? o.errorCode : void 0;
|
|
532
|
+
return {
|
|
533
|
+
message: ve(o) || n.trim(),
|
|
534
|
+
code: i
|
|
535
|
+
};
|
|
536
|
+
} catch {
|
|
537
|
+
return { message: n.trim() };
|
|
538
|
+
}
|
|
539
|
+
} catch {
|
|
540
|
+
return { message: t };
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
async function kr(e) {
|
|
544
|
+
if (!e.token) throw new Error("Missing auth token for PDF export");
|
|
545
|
+
if (ft(e.serializedPayload) > pt.maxRequestBytes)
|
|
546
|
+
throw new Error("Fast-path PDF request exceeds the structured body limit");
|
|
547
|
+
const t = await (e.fetchImpl ?? fetch)(e.url, {
|
|
548
|
+
method: "POST",
|
|
549
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${e.token}` },
|
|
550
|
+
body: e.serializedPayload,
|
|
551
|
+
signal: e.signal
|
|
552
|
+
});
|
|
553
|
+
if (!t.ok) {
|
|
554
|
+
const n = await zt(t);
|
|
555
|
+
throw Ht(n.code) ? new Bt(n.message, n.code) : new Error(n.message);
|
|
556
|
+
}
|
|
557
|
+
const r = await t.json();
|
|
558
|
+
if (r != null && r.error) throw new Error(r.error);
|
|
559
|
+
if (typeof (r == null ? void 0 : r.url) != "string" || !r.url.trim())
|
|
560
|
+
throw new Error("Fast-path PDF response missing download URL");
|
|
561
|
+
return r;
|
|
562
|
+
}
|
|
563
|
+
const Ar = 1, Ae = ["loading", "measuring", "checking", "laidOut"], Gt = [
|
|
564
|
+
// Already emitted before these contracts; names kept.
|
|
565
|
+
"document_matrix_too_large",
|
|
566
|
+
"document_matrix_unavailable",
|
|
567
|
+
"document_matrix_too_wide",
|
|
568
|
+
"document_kpi_value_overflow",
|
|
569
|
+
"print_inputs_not_captured",
|
|
570
|
+
// New.
|
|
571
|
+
"document_section_setup",
|
|
572
|
+
"document_input_missing",
|
|
573
|
+
"document_section_query_failed",
|
|
574
|
+
"document_table_completeness_unverified",
|
|
575
|
+
"document_row_limit_exceeded",
|
|
576
|
+
"document_section_render_failed",
|
|
577
|
+
"document_page_overflow",
|
|
578
|
+
"document_sheet_not_found",
|
|
579
|
+
"document_print_timed_out",
|
|
580
|
+
// PDF capacity contract PC-D3: more pages than one PDF holds.
|
|
581
|
+
"document_page_limit_exceeded"
|
|
582
|
+
];
|
|
583
|
+
function Nr(e) {
|
|
584
|
+
return Gt.includes(e);
|
|
585
|
+
}
|
|
586
|
+
const qt = 64, Xt = 120, Yt = 3, Wt = 80, Jt = [...Ae, "noPageStack", "unknown"];
|
|
587
|
+
function re(e, t) {
|
|
588
|
+
return typeof e != "string" ? void 0 : e.trim().slice(0, t).trim() || void 0;
|
|
589
|
+
}
|
|
590
|
+
function F(e, t) {
|
|
591
|
+
return typeof e == "number" && Number.isInteger(e) && e >= t ? e : void 0;
|
|
592
|
+
}
|
|
593
|
+
function ne(e, t) {
|
|
594
|
+
return t.includes(e) ? e : void 0;
|
|
595
|
+
}
|
|
596
|
+
function Zt(e) {
|
|
597
|
+
let t = e;
|
|
598
|
+
if (typeof e == "string")
|
|
599
|
+
try {
|
|
600
|
+
t = JSON.parse(e);
|
|
601
|
+
} catch {
|
|
602
|
+
return {};
|
|
603
|
+
}
|
|
604
|
+
if (!t || typeof t != "object" || Array.isArray(t)) return {};
|
|
605
|
+
const r = t, n = Array.isArray(r.inputLabels) ? r.inputLabels.map((i) => re(i, Wt)).filter((i) => i !== void 0).slice(0, Yt) : [], o = {
|
|
606
|
+
sectionId: re(r.sectionId, qt),
|
|
607
|
+
sectionTitle: re(r.sectionTitle, Xt),
|
|
608
|
+
pageNumber: F(r.pageNumber, 1),
|
|
609
|
+
rowCount: F(r.rowCount, 0),
|
|
610
|
+
rowLimit: F(r.rowLimit, 1),
|
|
611
|
+
inputLabels: n.length ? n : void 0,
|
|
612
|
+
overflowAxis: ne(r.overflowAxis, ["height", "width"]),
|
|
613
|
+
overflowPx: F(r.overflowPx, 0),
|
|
614
|
+
matrixLimit: ne(r.matrixLimit, ["rows", "bytes"]),
|
|
615
|
+
layoutStage: ne(r.layoutStage, Jt),
|
|
616
|
+
loadingSectionCount: F(r.loadingSectionCount, 0),
|
|
617
|
+
measuredRowCount: F(r.measuredRowCount, 0),
|
|
618
|
+
totalRowCount: F(r.totalRowCount, 0),
|
|
619
|
+
pageCount: F(r.pageCount, 0),
|
|
620
|
+
pageLimit: F(r.pageLimit, 1)
|
|
621
|
+
};
|
|
622
|
+
return Object.fromEntries(
|
|
623
|
+
Object.entries(o).filter(([, i]) => i !== void 0)
|
|
624
|
+
);
|
|
625
|
+
}
|
|
626
|
+
function Or(e) {
|
|
627
|
+
const t = Zt(e.facts), r = t.sectionTitle ? `Section "${t.sectionTitle}"` : t.sectionId ? `Section ${t.sectionId}` : "A section", n = t.pageNumber !== void 0 ? ` on page ${t.pageNumber}` : "";
|
|
628
|
+
switch (e.code) {
|
|
629
|
+
case "document_section_setup":
|
|
630
|
+
return `${r} is not set up to print.`;
|
|
631
|
+
case "document_input_missing":
|
|
632
|
+
return t.inputLabels ? `${r} needs a value for ${t.inputLabels.join(", ")}.` : `${r} needs a value for a required input.`;
|
|
633
|
+
case "document_section_query_failed":
|
|
634
|
+
return `${r}: its data could not be loaded.`;
|
|
635
|
+
case "document_table_completeness_unverified":
|
|
636
|
+
return `${r}: the query returned no total row count, so the table could not be confirmed complete.`;
|
|
637
|
+
case "document_row_limit_exceeded":
|
|
638
|
+
return t.rowCount !== void 0 && t.rowLimit !== void 0 ? `${r} has ${t.rowCount} rows; a document table prints up to ${t.rowLimit}.` : `${r} has more rows than a document table prints.`;
|
|
639
|
+
case "document_section_render_failed":
|
|
640
|
+
return `${r} could not be drawn.`;
|
|
641
|
+
case "document_page_overflow":
|
|
642
|
+
return `${r}${n} does not fit the page${t.overflowAxis ? ` (${t.overflowAxis}` : ""}${t.overflowAxis && t.overflowPx !== void 0 ? `, ${t.overflowPx} px over` : ""}${t.overflowAxis ? ")" : ""}.`;
|
|
643
|
+
case "document_matrix_too_large":
|
|
644
|
+
return t.matrixLimit === "rows" && t.rowLimit !== void 0 ? `${r}: the Matrix has more than ${t.rowLimit} rows, the most a report prints.` : `${r}: the Matrix is too large to print.`;
|
|
645
|
+
case "document_matrix_unavailable":
|
|
646
|
+
return `${r}: the Matrix result could not be loaded.`;
|
|
647
|
+
case "document_matrix_too_wide":
|
|
648
|
+
return `${r}: the Matrix is wider than the page.`;
|
|
649
|
+
case "document_kpi_value_overflow":
|
|
650
|
+
return `${r}: a KPI value does not fit its tile.`;
|
|
651
|
+
case "print_inputs_not_captured":
|
|
652
|
+
return t.inputLabels ? `The report's input values were not saved: ${t.inputLabels.join(", ")}.` : "The report's input values were not saved.";
|
|
653
|
+
case "document_sheet_not_found":
|
|
654
|
+
return "The requested Document sheet is not in the dashboard.";
|
|
655
|
+
case "document_page_limit_exceeded":
|
|
656
|
+
return t.pageCount !== void 0 && t.pageLimit !== void 0 ? `The Document is ${t.pageCount} pages; a PDF holds up to ${t.pageLimit}.` : "The Document has more pages than a PDF holds.";
|
|
657
|
+
case "document_print_timed_out":
|
|
658
|
+
return [
|
|
659
|
+
`The Document did not finish preparing in time (stage ${t.layoutStage ?? "unknown"}`,
|
|
660
|
+
t.measuredRowCount !== void 0 ? `; ${t.measuredRowCount} of ${t.totalRowCount ?? "unknown"} rows measured` : "",
|
|
661
|
+
t.pageCount !== void 0 ? `; ${t.pageCount} pages` : "",
|
|
662
|
+
t.loadingSectionCount ? `; ${t.loadingSectionCount} sections loading` : "",
|
|
663
|
+
")."
|
|
664
|
+
].join("");
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
function Qt(e) {
|
|
668
|
+
return Ae.includes(e);
|
|
669
|
+
}
|
|
670
|
+
function oe(e) {
|
|
671
|
+
return typeof e == "number" && Number.isInteger(e) && e >= 0;
|
|
672
|
+
}
|
|
673
|
+
function Rr(e) {
|
|
674
|
+
let t = e;
|
|
675
|
+
if (typeof e == "string")
|
|
676
|
+
try {
|
|
677
|
+
t = JSON.parse(e);
|
|
678
|
+
} catch {
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
if (!t || typeof t != "object" || Array.isArray(t)) return;
|
|
682
|
+
const { stage: r, measuredRowCount: n, totalRowCount: o, pageCount: i } = t;
|
|
683
|
+
if (!(!Qt(r) || !oe(n) || o !== null && !oe(o) || i !== null && !oe(i)))
|
|
684
|
+
return { stage: r, measuredRowCount: n, totalRowCount: o, pageCount: i };
|
|
685
|
+
}
|
|
686
|
+
function er(e, t) {
|
|
687
|
+
return e.dashboardId === t.dashboardId && e.cardId === t.cardId && e.attachmentIndex === void 0;
|
|
688
|
+
}
|
|
689
|
+
function Ne(e) {
|
|
690
|
+
return new Map(
|
|
691
|
+
e.presentationExecutionSnapshot.resolvedFormats.flatMap(
|
|
692
|
+
(t) => t.format.type === "raw_temporal" && t.target.kind === "column" && er(t.scope, e.scope) ? [[t.target.columnKey, t.format]] : []
|
|
693
|
+
)
|
|
694
|
+
);
|
|
695
|
+
}
|
|
696
|
+
function Oe(e) {
|
|
697
|
+
const t = e == null ? void 0 : e.sql, r = e == null ? void 0 : e.python;
|
|
698
|
+
return (e == null ? void 0 : e.resultOwner) === "freeform" && typeof t == "string" && !!t.trim() && (typeof r != "string" || !r.trim());
|
|
699
|
+
}
|
|
700
|
+
function Ur(e) {
|
|
701
|
+
return e.formatting.useFormattedValues !== !1 && Oe(e.queryPayload) && Ne(e.formatting).size > 0;
|
|
702
|
+
}
|
|
703
|
+
function tr(e, t) {
|
|
704
|
+
return e.map((r, n) => {
|
|
705
|
+
if (!Object.prototype.hasOwnProperty.call(r, t) || r[t] === void 0)
|
|
706
|
+
throw new Error(
|
|
707
|
+
`missing_raw_temporal_result_contract: Row ${n} is missing declared temporal column "${t}".`
|
|
708
|
+
);
|
|
709
|
+
const o = r[t];
|
|
710
|
+
return o === null || typeof o == "string" ? o : String(o);
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
function rr(e) {
|
|
714
|
+
if (e.formatting.useFormattedValues === !1)
|
|
715
|
+
return {
|
|
716
|
+
activatedColumnKeys: /* @__PURE__ */ new Set(),
|
|
717
|
+
byColumnKey: /* @__PURE__ */ new Map()
|
|
718
|
+
};
|
|
719
|
+
const t = Ne(e.formatting), r = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Map();
|
|
720
|
+
if (t.size === 0)
|
|
721
|
+
return { activatedColumnKeys: r, byColumnKey: n };
|
|
722
|
+
const o = new Map(
|
|
723
|
+
e.columns.flatMap((c) => {
|
|
724
|
+
const f = c.key || c.field;
|
|
725
|
+
return f ? [[f, c]] : [];
|
|
726
|
+
})
|
|
727
|
+
), i = Oe(e.queryPayload), l = /* @__PURE__ */ new Map();
|
|
728
|
+
for (const [c, f] of t) {
|
|
729
|
+
const h = o.get(c);
|
|
730
|
+
let y;
|
|
731
|
+
if (h != null && h.rawTemporal)
|
|
732
|
+
y = gt(h, {
|
|
733
|
+
metadataRequired: !0
|
|
734
|
+
}), r.add(c);
|
|
735
|
+
else if (i) {
|
|
736
|
+
r.add(c);
|
|
737
|
+
const w = Xe({
|
|
738
|
+
columnKey: c,
|
|
739
|
+
values: tr(e.records, c)
|
|
740
|
+
});
|
|
741
|
+
l.set(c, w), w.status === "classified" && (y = w.metadata);
|
|
742
|
+
} else
|
|
743
|
+
continue;
|
|
744
|
+
y && n.set(c, {
|
|
745
|
+
metadata: y,
|
|
746
|
+
format: f,
|
|
747
|
+
formatValue: Ye({ metadata: y, format: f })
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
return {
|
|
751
|
+
activatedColumnKeys: r,
|
|
752
|
+
byColumnKey: n,
|
|
753
|
+
...i ? {
|
|
754
|
+
sqlChunkEvidence: We(l)
|
|
755
|
+
} : {}
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
function nr(e) {
|
|
759
|
+
if (!e.resolution.activatedColumnKeys.has(e.columnKey))
|
|
760
|
+
return;
|
|
761
|
+
if (e.value === void 0)
|
|
762
|
+
throw new Error(
|
|
763
|
+
`missing_raw_temporal_result_contract: Row ${e.rowIndex} is missing temporal column "${e.columnKey}".`
|
|
764
|
+
);
|
|
765
|
+
const t = e.resolution.byColumnKey.get(e.columnKey);
|
|
766
|
+
if (!t)
|
|
767
|
+
return { text: e.value === null ? "" : String(e.value) };
|
|
768
|
+
if (e.value !== null && typeof e.value != "string")
|
|
769
|
+
return { text: String(e.value) };
|
|
770
|
+
const r = t.formatValue(e.value);
|
|
771
|
+
return r.ok && r.wallClock ? { text: r.text, wallClock: r.wallClock } : { text: r.text };
|
|
772
|
+
}
|
|
773
|
+
function Ce(e, t) {
|
|
774
|
+
const r = e.byColumnKey.get(t);
|
|
775
|
+
return r ? r.metadata.valueKind === "date" : void 0;
|
|
776
|
+
}
|
|
777
|
+
const or = /* @__PURE__ */ new Set(["string", "number", "boolean", "date", "datetime"]), ar = /^\d{4}-\d{2}-\d{2}|^\d{2}\/\d{2}\/\d{4}/, sr = /^\d{4}-\d{2}-\d{2}$/, Re = "MM/dd/yyyy";
|
|
778
|
+
function X(e) {
|
|
779
|
+
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
780
|
+
}
|
|
781
|
+
function R(e) {
|
|
782
|
+
return e.key || e.field || void 0;
|
|
783
|
+
}
|
|
784
|
+
function _e(e) {
|
|
785
|
+
return e == null ? "" : typeof e == "string" ? e : j(e) ? e.value : e instanceof Date ? e.toISOString() : typeof e == "object" ? JSON.stringify(e) : String(e);
|
|
786
|
+
}
|
|
787
|
+
function Te(e, t) {
|
|
788
|
+
var n;
|
|
789
|
+
const r = (n = e.columnSettings) == null ? void 0 : n[t];
|
|
790
|
+
if (!(!X(r) || r.type !== "date"))
|
|
791
|
+
return X(r.dateFormat) ? r.dateFormat : {};
|
|
792
|
+
}
|
|
793
|
+
function Ee(e) {
|
|
794
|
+
return e.useCustomFormat && e.customFormat ? e.customFormat : e.format || Re;
|
|
795
|
+
}
|
|
796
|
+
function Fe(e, t) {
|
|
797
|
+
return e && e !== "auto" ? e : t;
|
|
798
|
+
}
|
|
799
|
+
function ir(e) {
|
|
800
|
+
return !/[HhKkmsSa]/.test(e.replace(/'[^']*'/g, ""));
|
|
801
|
+
}
|
|
802
|
+
function cr(e) {
|
|
803
|
+
if (typeof e == "number") return Number.isFinite(e) ? e : null;
|
|
804
|
+
if (typeof e != "string" || !e.trim()) return null;
|
|
805
|
+
const t = Number(e);
|
|
806
|
+
return Number.isFinite(t) ? t : null;
|
|
807
|
+
}
|
|
808
|
+
function lr(e) {
|
|
809
|
+
const t = De(e);
|
|
810
|
+
if (t !== void 0)
|
|
811
|
+
try {
|
|
812
|
+
return ut(t, /[.eE]/.test(t) ? "decimal" : "integer");
|
|
813
|
+
} catch {
|
|
814
|
+
return;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
function ur(e) {
|
|
818
|
+
return e.calendar.fiscalCalendar && (e.granularity === "quarter" || e.granularity === "year") ? "fiscal" : e.granularity;
|
|
819
|
+
}
|
|
820
|
+
function Kr(e) {
|
|
821
|
+
const { formatting: t, queryPayload: r } = e, n = t.useFormattedValues, o = t.scope, i = (a) => Je({ snapshot: t.presentationExecutionSnapshot, scope: o, target: { kind: "column", columnKey: a } }), l = (a) => Qe({ snapshot: t.presentationExecutionSnapshot, scope: o, target: { kind: "column", columnKey: a } });
|
|
822
|
+
function c(a) {
|
|
823
|
+
var b;
|
|
824
|
+
if ((b = t.visibleColumns) != null && b.length) return t.visibleColumns;
|
|
825
|
+
const m = a.columns.map(R).filter((d) => !!d);
|
|
826
|
+
return m.length > 0 ? m : a.records[0] ? Object.keys(a.records[0]) : [];
|
|
827
|
+
}
|
|
828
|
+
function f(a, m) {
|
|
829
|
+
return t.columnLabels && Object.prototype.hasOwnProperty.call(t.columnLabels, a) && t.columnLabels[a] || void 0 || h(m) || (m == null ? void 0 : m.label) || (m == null ? void 0 : m.headerName) || a;
|
|
830
|
+
}
|
|
831
|
+
function h(a, m) {
|
|
832
|
+
const b = a == null ? void 0 : a.pivotIdentity;
|
|
833
|
+
if (!b || !b.members || b.members.length === 0) return;
|
|
834
|
+
const d = he({ identity: b, columnKey: (a == null ? void 0 : a.key) || (a == null ? void 0 : a.field) || "" });
|
|
835
|
+
return bt({
|
|
836
|
+
members: d,
|
|
837
|
+
metricLabel: (a == null ? void 0 : a.label) || (a == null ? void 0 : a.headerName),
|
|
838
|
+
mode: n ? "formatted" : "canonical",
|
|
839
|
+
resolveTemporalFormat: (C) => {
|
|
840
|
+
const g = d.find((v) => v.fieldId === C);
|
|
841
|
+
if (!(g != null && g.temporalBucket)) return;
|
|
842
|
+
const x = de({
|
|
843
|
+
snapshot: t.presentationExecutionSnapshot,
|
|
844
|
+
scope: o,
|
|
845
|
+
target: { kind: "field", fieldId: C, role: "pivotby" }
|
|
846
|
+
});
|
|
847
|
+
return x ? y(g.temporalBucket, x) : void 0;
|
|
848
|
+
}
|
|
849
|
+
}).flattenedLabel;
|
|
850
|
+
}
|
|
851
|
+
function y(a, m) {
|
|
852
|
+
return Ze({
|
|
853
|
+
metadata: a,
|
|
854
|
+
cardFormat: m,
|
|
855
|
+
locale: m.locale,
|
|
856
|
+
...m.presentation.mode === "auto" ? { styles: m.presentation.styles } : {}
|
|
857
|
+
}).format;
|
|
858
|
+
}
|
|
859
|
+
function w(a, m) {
|
|
860
|
+
const { records: b, columns: d } = a, C = X(r.cardConfig) ? r.cardConfig : void 0, g = C == null ? void 0 : C.pivotByColumns, x = Array.isArray(g) ? g.flatMap(
|
|
861
|
+
(s) => X(s) && typeof s.id == "string" && s.id ? [s.id] : []
|
|
862
|
+
) : [];
|
|
863
|
+
yt(
|
|
864
|
+
d.map((s) => ({ key: R(s) || "<unknown>", pivotIdentity: s.pivotIdentity })),
|
|
865
|
+
{ expectedPivotFieldIds: x }
|
|
866
|
+
);
|
|
867
|
+
const v = c(a), P = new Map(
|
|
868
|
+
d.flatMap((s) => {
|
|
869
|
+
const p = R(s);
|
|
870
|
+
return p ? [[p, s]] : [];
|
|
871
|
+
})
|
|
872
|
+
), je = new Map(a.resultColumns.map((s) => [s.key, s.dataType])), M = rr({
|
|
873
|
+
records: b,
|
|
874
|
+
columns: d,
|
|
875
|
+
formatting: t,
|
|
876
|
+
queryPayload: r
|
|
877
|
+
}), W = new Map(
|
|
878
|
+
d.flatMap((s) => {
|
|
879
|
+
const p = R(s);
|
|
880
|
+
return p && s.temporalBucket ? [[p, s.temporalBucket]] : [];
|
|
881
|
+
})
|
|
882
|
+
), ce = /* @__PURE__ */ new Map();
|
|
883
|
+
for (const s of v) {
|
|
884
|
+
const p = de({
|
|
885
|
+
snapshot: t.presentationExecutionSnapshot,
|
|
886
|
+
scope: o,
|
|
887
|
+
target: { kind: "column", columnKey: s }
|
|
888
|
+
}), _ = W.get(s);
|
|
889
|
+
if (n) {
|
|
890
|
+
if (p && !_) throw new Error(`Missing temporal bucket metadata for column "${s}"`);
|
|
891
|
+
if (_ && !p) throw new Error(`Missing resolved temporal presentation for column "${s}"`);
|
|
892
|
+
}
|
|
893
|
+
p && _ && ce.set(s, y(_, p));
|
|
894
|
+
}
|
|
895
|
+
const J = v.map((s) => {
|
|
896
|
+
const p = je.get(s), _ = p && or.has(p) ? p : "unknown", E = n ? T(s, M, W) : void 0, L = f(s, P.get(s)), A = n && M.activatedColumnKeys.has(s) && Ce(M, s) === void 0;
|
|
897
|
+
return {
|
|
898
|
+
key: s,
|
|
899
|
+
label: L,
|
|
900
|
+
dataType: _,
|
|
901
|
+
...E ? { presentation: E } : {},
|
|
902
|
+
xlsx: ge({ key: s, label: L, formattedValues: n, dataType: _, presentation: E }),
|
|
903
|
+
...A ? { xlsxPending: !0 } : {}
|
|
904
|
+
};
|
|
905
|
+
});
|
|
906
|
+
function Ve(s, p, _, E) {
|
|
907
|
+
if (!n) return { text: _e(s), value: s };
|
|
908
|
+
const L = nr({ value: s, columnKey: p, rowIndex: _, resolution: M });
|
|
909
|
+
if (L !== void 0) return { text: L.text, value: s, ...L.wallClock ? { wallClock: L.wallClock } : {} };
|
|
910
|
+
const A = W.get(p);
|
|
911
|
+
if (A) {
|
|
912
|
+
const $ = ce.get(p);
|
|
913
|
+
if (!$) throw new Error(`Missing resolved temporal presentation for column "${p}"`);
|
|
914
|
+
if (s != null && typeof s != "string")
|
|
915
|
+
throw new Error(`Canonical temporal column "${p}" must contain a string or null`);
|
|
916
|
+
const N = s ?? null, O = et(N, A);
|
|
917
|
+
return {
|
|
918
|
+
text: tt({ value: N, metadata: A, format: $ }),
|
|
919
|
+
value: s,
|
|
920
|
+
...O ? { wallClock: O } : {}
|
|
921
|
+
};
|
|
922
|
+
}
|
|
923
|
+
if (s == null) return { text: "", value: s };
|
|
924
|
+
const Z = l(p);
|
|
925
|
+
if (Z && typeof s == "number" && Number.isFinite(s))
|
|
926
|
+
return {
|
|
927
|
+
text: fe(
|
|
928
|
+
new Date(s).toISOString(),
|
|
929
|
+
Z.pattern || Re,
|
|
930
|
+
Fe(Z.timezone, t.timezone),
|
|
931
|
+
"UTC"
|
|
932
|
+
),
|
|
933
|
+
value: s
|
|
934
|
+
};
|
|
935
|
+
const D = i(p);
|
|
936
|
+
if (typeof s == "number")
|
|
937
|
+
return { text: D ? B(s, D) : String(s), value: s };
|
|
938
|
+
if (j(s))
|
|
939
|
+
return { text: D ? B(s, D) : s.value, value: s };
|
|
940
|
+
const V = Te(t, p);
|
|
941
|
+
if (V && (s instanceof Date || typeof s == "string" && ar.test(s))) {
|
|
942
|
+
const $ = s instanceof Date ? s.toISOString() : s, N = typeof s == "string" && sr.test(s), O = N ? "UTC" : Fe(V.timezone, t.timezone), ue = N ? "UTC" : V.sourceTimezone || "auto", me = rt($, O, ue);
|
|
943
|
+
return {
|
|
944
|
+
text: fe($, Ee(V), O, ue),
|
|
945
|
+
value: s,
|
|
946
|
+
...me ? { wallClock: me } : {}
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
if (typeof s == "string" && D && E.dataType === "number") {
|
|
950
|
+
const $ = lr(s);
|
|
951
|
+
if ($) return { text: B($, D), value: s };
|
|
952
|
+
}
|
|
953
|
+
return { text: _e(s), value: s };
|
|
954
|
+
}
|
|
955
|
+
const Be = b.map(
|
|
956
|
+
(s, p) => J.map((_) => {
|
|
957
|
+
const E = Ve(s[_.key], _.key, p, _);
|
|
958
|
+
return H({ value: E.value, text: E.text, column: _.xlsx, wallClock: E.wallClock });
|
|
959
|
+
})
|
|
960
|
+
), le = (m == null ? void 0 : m.withHeader) !== !1 && t.includeHeaders;
|
|
961
|
+
if (le)
|
|
962
|
+
for (const s of v) {
|
|
963
|
+
const p = P.get(s);
|
|
964
|
+
p != null && p.pivotIdentity && he({ identity: p.pivotIdentity, columnKey: R(p) || s });
|
|
965
|
+
}
|
|
966
|
+
return {
|
|
967
|
+
...le ? { header: J.map((s) => s.label) } : {},
|
|
968
|
+
columns: J,
|
|
969
|
+
rows: Be,
|
|
970
|
+
...M.sqlChunkEvidence ? { rawTemporalClassification: M.sqlChunkEvidence } : {}
|
|
971
|
+
};
|
|
972
|
+
}
|
|
973
|
+
function T(a, m, b) {
|
|
974
|
+
if (m.activatedColumnKeys.has(a)) {
|
|
975
|
+
const x = Ce(m, a);
|
|
976
|
+
return x === void 0 ? { kind: "text" } : { kind: "datetime", dateOnly: x };
|
|
977
|
+
}
|
|
978
|
+
const d = b.get(a);
|
|
979
|
+
if (d) return { kind: "temporal_bucket", grain: ur(d) };
|
|
980
|
+
if (l(a)) return { kind: "text" };
|
|
981
|
+
const C = Te(t, a);
|
|
982
|
+
if (C) return { kind: "datetime", dateOnly: ir(Ee(C)) };
|
|
983
|
+
const g = i(a);
|
|
984
|
+
return g ? { kind: "measure", format: g } : void 0;
|
|
985
|
+
}
|
|
986
|
+
function u(a, m) {
|
|
987
|
+
if (!Number.isInteger(m) || m < 0)
|
|
988
|
+
throw new Error("totalRows must be a non-negative integer");
|
|
989
|
+
return m === 0 ? void 0 : (t.visibleColumns ?? Object.keys(a)).map((d) => {
|
|
990
|
+
const g = Object.prototype.hasOwnProperty.call(a, d) ? a[d] : d === t.tableTotalsLabelColumnKey ? "Total" : null, x = n ? i(d) : void 0, v = ge({
|
|
991
|
+
key: d,
|
|
992
|
+
label: d,
|
|
993
|
+
formattedValues: n,
|
|
994
|
+
dataType: "unknown",
|
|
995
|
+
...x ? { presentation: { kind: "measure", format: x } } : {}
|
|
996
|
+
});
|
|
997
|
+
if (g == null) return { kind: "empty" };
|
|
998
|
+
if (!n) return H({ value: g, text: String(g), column: v });
|
|
999
|
+
const P = x ? cr(g) : null;
|
|
1000
|
+
return H(x && P !== null ? { value: P, text: B(P, x), column: v } : { value: g, text: String(g), column: v });
|
|
1001
|
+
});
|
|
1002
|
+
}
|
|
1003
|
+
return { format: w, totals: u };
|
|
1004
|
+
}
|
|
1005
|
+
const mr = /* @__PURE__ */ new Set([
|
|
1006
|
+
"scope",
|
|
1007
|
+
"useFormattedValues",
|
|
1008
|
+
"timezone",
|
|
1009
|
+
"presentationExecutionSnapshot",
|
|
1010
|
+
"delimiter",
|
|
1011
|
+
"csvEncoding",
|
|
1012
|
+
"includeHeaders",
|
|
1013
|
+
"columnSettings",
|
|
1014
|
+
"visibleColumns",
|
|
1015
|
+
"columnLabels",
|
|
1016
|
+
"tableTotalsLabelColumnKey",
|
|
1017
|
+
"fileFormat",
|
|
1018
|
+
"title"
|
|
1019
|
+
]);
|
|
1020
|
+
function ie(e) {
|
|
1021
|
+
return e !== null && typeof e == "object" && !Array.isArray(e);
|
|
1022
|
+
}
|
|
1023
|
+
function Se(e, t) {
|
|
1024
|
+
if (e !== void 0) {
|
|
1025
|
+
if (!ie(e))
|
|
1026
|
+
throw new Error(`formatting.${t} must be an object`);
|
|
1027
|
+
return e;
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
function jr(e) {
|
|
1031
|
+
if (!ie(e))
|
|
1032
|
+
throw new Error("formatting must be an object");
|
|
1033
|
+
const t = ["reportContext", "resolvedFormats"].find(
|
|
1034
|
+
(a) => Object.prototype.hasOwnProperty.call(e, a)
|
|
1035
|
+
);
|
|
1036
|
+
if (t)
|
|
1037
|
+
throw new pe(
|
|
1038
|
+
`formatting.${t} is retired; formatting.presentationExecutionSnapshot is authoritative.`
|
|
1039
|
+
);
|
|
1040
|
+
const r = Object.keys(e).find((a) => !mr.has(a));
|
|
1041
|
+
if (r)
|
|
1042
|
+
throw new Error(`formatting contains unknown property "${r}"`);
|
|
1043
|
+
const n = typeof e.timezone == "string" ? e.timezone.trim() : "";
|
|
1044
|
+
if (!n)
|
|
1045
|
+
throw new Error("formatting.timezone must be a non-empty string");
|
|
1046
|
+
const o = st(e.delimiter);
|
|
1047
|
+
if (!o)
|
|
1048
|
+
throw new Error("formatting.delimiter must be a comma, semicolon or tab");
|
|
1049
|
+
const i = it(e.csvEncoding);
|
|
1050
|
+
if (!i)
|
|
1051
|
+
throw new Error("formatting.csvEncoding must be 'utf-8-bom' or 'utf-8'");
|
|
1052
|
+
if (typeof e.includeHeaders != "boolean")
|
|
1053
|
+
throw new Error("formatting.includeHeaders must be a boolean");
|
|
1054
|
+
if (e.useFormattedValues !== void 0 && typeof e.useFormattedValues != "boolean")
|
|
1055
|
+
throw new Error("formatting.useFormattedValues must be a boolean");
|
|
1056
|
+
const l = e.fileFormat === void 0 ? void 0 : ct(e.fileFormat);
|
|
1057
|
+
if (e.fileFormat !== void 0 && !l)
|
|
1058
|
+
throw new Error("formatting.fileFormat must be 'csv' or 'xlsx'");
|
|
1059
|
+
if (e.title !== void 0 && typeof e.title != "string")
|
|
1060
|
+
throw new Error("formatting.title must be a string");
|
|
1061
|
+
const c = e.visibleColumns === void 0 ? void 0 : Array.isArray(e.visibleColumns) && e.visibleColumns.every((a) => typeof a == "string") ? e.visibleColumns : void 0;
|
|
1062
|
+
if (e.visibleColumns !== void 0 && !c)
|
|
1063
|
+
throw new Error("formatting.visibleColumns must be an array of strings");
|
|
1064
|
+
const f = Se(e.columnLabels, "columnLabels");
|
|
1065
|
+
if (f && Object.values(f).some((a) => typeof a != "string"))
|
|
1066
|
+
throw new Error("formatting.columnLabels values must be strings");
|
|
1067
|
+
const h = Se(e.columnSettings, "columnSettings"), y = e.tableTotalsLabelColumnKey === void 0 ? void 0 : typeof e.tableTotalsLabelColumnKey == "string" && e.tableTotalsLabelColumnKey.trim() ? e.tableTotalsLabelColumnKey : null;
|
|
1068
|
+
if (y === null)
|
|
1069
|
+
throw new Error("formatting.tableTotalsLabelColumnKey must be a non-empty string");
|
|
1070
|
+
if (y && !(c != null && c.includes(y)))
|
|
1071
|
+
throw new Error("formatting.tableTotalsLabelColumnKey must identify a visible column");
|
|
1072
|
+
const w = nt(e.scope, "formatting.scope");
|
|
1073
|
+
if (!w.cardId || w.attachmentIndex !== void 0)
|
|
1074
|
+
throw new Error("formatting.scope must identify exactly one dashboard card");
|
|
1075
|
+
const T = e.useFormattedValues !== !1, u = ot(e.presentationExecutionSnapshot);
|
|
1076
|
+
if (n !== u.reportContext.calendar.tz)
|
|
1077
|
+
throw new Error(
|
|
1078
|
+
"formatting.timezone must equal presentationExecutionSnapshot.reportContext.calendar.tz"
|
|
1079
|
+
);
|
|
1080
|
+
try {
|
|
1081
|
+
at({
|
|
1082
|
+
snapshot: u,
|
|
1083
|
+
expectedScope: { dashboardId: w.dashboardId, cardId: w.cardId },
|
|
1084
|
+
visibleColumns: c,
|
|
1085
|
+
useFormattedValues: T
|
|
1086
|
+
});
|
|
1087
|
+
} catch (a) {
|
|
1088
|
+
throw new pe(
|
|
1089
|
+
`formatting.presentationExecutionSnapshot.${a instanceof Error ? a.message : String(a)}`
|
|
1090
|
+
);
|
|
1091
|
+
}
|
|
1092
|
+
return {
|
|
1093
|
+
scope: { dashboardId: w.dashboardId, cardId: w.cardId },
|
|
1094
|
+
useFormattedValues: T,
|
|
1095
|
+
timezone: n,
|
|
1096
|
+
presentationExecutionSnapshot: u,
|
|
1097
|
+
delimiter: o,
|
|
1098
|
+
csvEncoding: i,
|
|
1099
|
+
includeHeaders: e.includeHeaders,
|
|
1100
|
+
...h ? { columnSettings: h } : {},
|
|
1101
|
+
...c ? { visibleColumns: c } : {},
|
|
1102
|
+
...f ? { columnLabels: f } : {},
|
|
1103
|
+
...y ? { tableTotalsLabelColumnKey: y } : {},
|
|
1104
|
+
...l ? { fileFormat: l } : {},
|
|
1105
|
+
...typeof e.title == "string" ? { title: e.title } : {}
|
|
1106
|
+
};
|
|
1107
|
+
}
|
|
1108
|
+
function Vr(e) {
|
|
1109
|
+
const t = e.formatOptions, r = (n) => ie(n) ? n : void 0;
|
|
1110
|
+
return {
|
|
1111
|
+
scope: { dashboardId: e.dashboardId, cardId: e.cardId },
|
|
1112
|
+
useFormattedValues: t.useFormattedValues !== !1,
|
|
1113
|
+
timezone: t.presentationExecutionSnapshot.reportContext.calendar.tz,
|
|
1114
|
+
presentationExecutionSnapshot: t.presentationExecutionSnapshot,
|
|
1115
|
+
delimiter: typeof t.delimiter == "string" ? t.delimiter : ",",
|
|
1116
|
+
csvEncoding: t.csvEncoding,
|
|
1117
|
+
includeHeaders: t.includeHeaders !== !1,
|
|
1118
|
+
columnSettings: r(t.columnSettings),
|
|
1119
|
+
visibleColumns: Array.isArray(t.visibleColumns) ? t.visibleColumns : void 0,
|
|
1120
|
+
columnLabels: r(t.columnLabels),
|
|
1121
|
+
tableTotalsLabelColumnKey: typeof t.tableTotalsLabelColumnKey == "string" ? t.tableTotalsLabelColumnKey : void 0,
|
|
1122
|
+
...e.fileFormat ? { fileFormat: e.fileFormat } : {},
|
|
1123
|
+
...typeof e.title == "string" ? { title: e.title } : {}
|
|
1124
|
+
};
|
|
1125
|
+
}
|
|
1126
|
+
function Br(e) {
|
|
1127
|
+
return ((e == null ? void 0 : e.filterValues) ?? []).filter(dr).map(fr);
|
|
1128
|
+
}
|
|
1129
|
+
function dr(e) {
|
|
1130
|
+
return !!e && typeof e == "object" && typeof e.name == "string" && Array.isArray(e.values);
|
|
1131
|
+
}
|
|
1132
|
+
function fr(e) {
|
|
1133
|
+
if (!("relativeMeta" in e) || e.relativeMeta === void 0) return e;
|
|
1134
|
+
const { relativeMeta: t, ...r } = e, n = mt(t);
|
|
1135
|
+
return n ? { ...r, relativeMeta: n } : r;
|
|
1136
|
+
}
|
|
1137
|
+
const pr = /* @__PURE__ */ new Set([
|
|
1138
|
+
"day",
|
|
1139
|
+
"week",
|
|
1140
|
+
"month",
|
|
1141
|
+
"quarter",
|
|
1142
|
+
"year"
|
|
1143
|
+
]);
|
|
1144
|
+
function hr(e, t) {
|
|
1145
|
+
try {
|
|
1146
|
+
const r = K(e), n = I(r, t, "yyyy-MM-dd");
|
|
1147
|
+
if (I(r, t, "HH:mm:ss.SSS") !== "00:00:00.000")
|
|
1148
|
+
return {
|
|
1149
|
+
date: n,
|
|
1150
|
+
time: I(r, t, "h:mm a")
|
|
1151
|
+
};
|
|
1152
|
+
const [o, i, l] = n.split("-").map(Number), c = new Date(Date.UTC(o, i - 1, l));
|
|
1153
|
+
return c.setUTCDate(c.getUTCDate() - 1), { date: I(c, "UTC", "yyyy-MM-dd") };
|
|
1154
|
+
} catch {
|
|
1155
|
+
return;
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
function Ue(e, t, r) {
|
|
1159
|
+
const n = hr(e.end, t);
|
|
1160
|
+
if (n)
|
|
1161
|
+
return {
|
|
1162
|
+
start: I(
|
|
1163
|
+
K(e.start),
|
|
1164
|
+
t,
|
|
1165
|
+
r ? "MMM d" : "MMM d, yyyy"
|
|
1166
|
+
),
|
|
1167
|
+
endDate: I(
|
|
1168
|
+
K(`${n.date}T00:00:00Z`),
|
|
1169
|
+
"UTC",
|
|
1170
|
+
"MMM d, yyyy"
|
|
1171
|
+
),
|
|
1172
|
+
...n.time ? { endTime: n.time } : {}
|
|
1173
|
+
};
|
|
1174
|
+
}
|
|
1175
|
+
function Ke(e) {
|
|
1176
|
+
return !!(e && pr.has(e));
|
|
1177
|
+
}
|
|
1178
|
+
function Hr(e, t, r, n = !1) {
|
|
1179
|
+
if (Ke(r))
|
|
1180
|
+
try {
|
|
1181
|
+
const i = Ue(e, t, !1);
|
|
1182
|
+
if (i && i.start === i.endDate)
|
|
1183
|
+
return i.endTime ? `${i.endDate} until ${i.endTime}` : i.endDate;
|
|
1184
|
+
} catch {
|
|
1185
|
+
}
|
|
1186
|
+
const o = br(
|
|
1187
|
+
e,
|
|
1188
|
+
t,
|
|
1189
|
+
r,
|
|
1190
|
+
n
|
|
1191
|
+
);
|
|
1192
|
+
return `${o.start} – ${o.end}`;
|
|
1193
|
+
}
|
|
1194
|
+
function br(e, t, r, n = !1) {
|
|
1195
|
+
try {
|
|
1196
|
+
if (Ke(r)) {
|
|
1197
|
+
const o = Ue(e, t, n);
|
|
1198
|
+
if (o)
|
|
1199
|
+
return {
|
|
1200
|
+
start: o.start,
|
|
1201
|
+
end: o.endTime ? `${o.endDate}, ${o.endTime}` : o.endDate
|
|
1202
|
+
};
|
|
1203
|
+
}
|
|
1204
|
+
if (r === "second" || r === "minute" || r === "hour") {
|
|
1205
|
+
const o = n ? "MMM d, h:mm a" : "MMM d, yyyy, h:mm a";
|
|
1206
|
+
return {
|
|
1207
|
+
start: I(K(e.start), t, o),
|
|
1208
|
+
end: `before ${I(
|
|
1209
|
+
K(e.end),
|
|
1210
|
+
t,
|
|
1211
|
+
o
|
|
1212
|
+
)}`
|
|
1213
|
+
};
|
|
1214
|
+
}
|
|
1215
|
+
} catch {
|
|
1216
|
+
}
|
|
1217
|
+
return { start: e.start, end: `before ${e.end}` };
|
|
1218
|
+
}
|
|
1219
|
+
export {
|
|
1220
|
+
jr as A,
|
|
1221
|
+
Vr as B,
|
|
1222
|
+
Ur as C,
|
|
1223
|
+
Ar as D,
|
|
1224
|
+
Br as E,
|
|
1225
|
+
br as F,
|
|
1226
|
+
Pr as M,
|
|
1227
|
+
Rt as P,
|
|
1228
|
+
Fr as a,
|
|
1229
|
+
Ir as b,
|
|
1230
|
+
Lr as c,
|
|
1231
|
+
jt as d,
|
|
1232
|
+
Sr as e,
|
|
1233
|
+
Hr as f,
|
|
1234
|
+
Mr as g,
|
|
1235
|
+
$r as h,
|
|
1236
|
+
Dt as i,
|
|
1237
|
+
At as j,
|
|
1238
|
+
Ot as k,
|
|
1239
|
+
Dr as l,
|
|
1240
|
+
Kt as m,
|
|
1241
|
+
Bt as n,
|
|
1242
|
+
Ht as o,
|
|
1243
|
+
Ut as p,
|
|
1244
|
+
zt as q,
|
|
1245
|
+
ge as r,
|
|
1246
|
+
kr as s,
|
|
1247
|
+
H as t,
|
|
1248
|
+
Gt as u,
|
|
1249
|
+
Nr as v,
|
|
1250
|
+
Zt as w,
|
|
1251
|
+
Or as x,
|
|
1252
|
+
Rr as y,
|
|
1253
|
+
Kr as z
|
|
1254
|
+
};
|