react-semaphor 0.1.541 → 0.1.543
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 +75 -75
- package/dist/assistant-context/index.js +1 -1
- package/dist/brand-studio/index.js +3 -3
- package/dist/briefings/index.js +51 -49
- package/dist/chunks/apply-dashboard-operations-CG9S7MGt.js +2260 -0
- package/dist/chunks/{assistant-chat-D1fDZD6O.js → assistant-chat-BFMRUYoB.js} +12 -12
- package/dist/chunks/bookmark-state-CXw7lZ50.js +118 -0
- package/dist/chunks/{calendar-day-equality-Bpl15IBo.js → calendar-day-equality-BmJAWduY.js} +180 -207
- package/dist/chunks/comparison-window-caption-Bv18samq.js +1618 -0
- package/dist/chunks/custom-visual-inputs-DUtpYZOk.js +323 -0
- package/dist/chunks/{dashboard-B6IrON_Q.js → dashboard-B9mKTJoy.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-DwjFpewq.js → dashboard-briefing-launcher-Bdmry_oG.js} +18 -18
- package/dist/chunks/{dashboard-controls-C_BI28ME.js → dashboard-controls-UGpjOM2k.js} +69 -70
- package/dist/chunks/{dashboard-filter-value-compatibility-D95O4nd7.js → dashboard-filter-value-compatibility-CwQ_iSNb.js} +2 -2
- package/dist/chunks/{dashboard-json-DDY15Trn.js → dashboard-json-DG8dz0eX.js} +4 -4
- package/dist/chunks/{document-dashboard-inputs-DP_Op5mu.js → document-dashboard-inputs-OwqCbrVp.js} +2382 -4975
- package/dist/chunks/document-sheet-utils-BTb3VZxV.js +3619 -0
- package/dist/chunks/{edit-dashboard-visual-CH2dzWW-.js → edit-dashboard-visual-CDpA4y5e.js} +728 -728
- package/dist/chunks/{filter-value-text-BhWugPWE.js → filter-value-text-CYsVYPuD.js} +18 -19
- package/dist/chunks/{index-DaQlghLY.js → index-l5LclZvs.js} +824 -1351
- package/dist/chunks/{matrix-analytical-definition-bcprSe4u.js → matrix-analytical-definition-C7Gb0e12.js} +1 -1
- package/dist/chunks/{matrix-card-CJn1hB5V.js → matrix-card-DjwWcCo8.js} +2 -2
- package/dist/chunks/{matrix-formatter-DQ8avoIQ.js → matrix-formatter-BnsTX90d.js} +430 -417
- package/dist/chunks/{matrix-member-presentation-BNPSDKBG.js → matrix-member-presentation-CQGdVks6.js} +1 -1
- package/dist/chunks/{matrix-operation-contract-B8PBF1Gd.js → matrix-operation-contract-8OIO4gob.js} +65 -65
- package/dist/chunks/metric-comparison-DEwi9uc2.js +498 -0
- package/dist/chunks/numeric-presentation-F_-H6VAw.js +5227 -0
- package/dist/chunks/{pivot-header-presentation-MkcKnjn3.js → pivot-header-presentation-DHcx1XGQ.js} +1 -1
- package/dist/chunks/{pivot-result-identity-D6hhcRXi.js → pivot-result-identity-DJhXXcns.js} +1 -1
- package/dist/chunks/pivot-result-lifecycle-DupbRk-R.js +1155 -0
- package/dist/chunks/raw-temporal-presentation-D-azM_98.js +585 -0
- package/dist/chunks/{report-preferences-dialog-DpNkFfQO.js → report-preferences-dialog-CPwRwEJx.js} +75 -75
- package/dist/chunks/{report-runtime-context-B984Nq1E.js → report-runtime-context-Dq8XyODK.js} +1 -1
- package/dist/chunks/{saved-dashboard-context-CJ2WpoMF.js → saved-dashboard-context-BKvMfRfC.js} +233 -206
- package/dist/chunks/{selection-reducer-vKIb_jS6.js → selection-reducer-Dj_8xD69.js} +1 -1
- package/dist/chunks/{semaphor-ready-indicator-KT598QJq.js → semaphor-ready-indicator-CN2AHm2x.js} +37489 -39476
- package/dist/chunks/{shelf-drop-preview-context-BxV3Fl8h.js → shelf-drop-preview-context-BGl_rxcW.js} +6 -6
- package/dist/chunks/sort-target-MT1WK1vX.js +29 -0
- package/dist/chunks/{source-entity-resolution-CVA1a85c.js → source-entity-resolution-BYn9giz3.js} +1 -1
- package/dist/chunks/{switch-DWEWiv1J.js → switch-C3jLxlG0.js} +2 -2
- package/dist/chunks/table-export-sheet-BDRXLLdq.js +949 -0
- package/dist/chunks/table-settings-CLZocegs.js +501 -0
- package/dist/chunks/temporal-bucket-D7NBrrtL.js +2071 -0
- package/dist/chunks/{token-types-bxUxXDX2.js → token-types-DBbZVQsm.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-DdD12SMY.js → use-create-flow-overlay-state-BnclfB2k.js} +151 -151
- package/dist/chunks/{validators-Ej1DdCXa.js → validators-DMHTpf7a.js} +73 -73
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +462 -457
- package/dist/data-app-sdk/index.js +5 -5
- package/dist/data-app-sdk-adapters/index.js +2 -2
- package/dist/data-app-sdk-validation/index.js +9 -9
- package/dist/format-utils/index.js +346 -241
- package/dist/index.js +174 -175
- package/dist/report-runtime-context/index.js +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/briefings/attachment-outcomes.d.ts +1 -1
- package/dist/types/briefings/attachments.d.ts +17 -1
- package/dist/types/briefings/index.d.ts +5 -3
- package/dist/types/index.js +48 -48
- package/dist/types/lib/api/exports-api.d.ts +11 -65
- package/dist/types/lib/dashboard-inputs/control-contract-overrides.d.ts +17 -0
- package/dist/types/lib/dashboard-viewer/export-table-view.d.ts +2 -0
- package/dist/types/lib/hooks/use-dashboard.d.ts +3 -6
- package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +8 -2
- package/dist/types/lib/matrix-table/matrix-delivery.d.ts +8 -6
- package/dist/types/lib/query-context/build-dashboard-card-query-contract.d.ts +50 -0
- package/dist/types/lib/types/explorer-types.d.ts +6 -0
- package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +3 -3
- package/dist/types/shared/assistant-context/index.d.ts +1 -1
- package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +23 -6
- package/dist/types/shared/dashboard-authoring/card-export-request.d.ts +173 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +1 -0
- package/dist/types/shared/dashboard-authoring/matrix-delivery.d.ts +4 -3
- package/dist/types/shared/format-utils/exporters/export-cells.d.ts +90 -0
- package/dist/types/shared/format-utils/exporters/export-file-format.d.ts +44 -0
- package/dist/types/shared/format-utils/exporters/index.d.ts +6 -0
- package/dist/types/shared/format-utils/exporters/xlsx-file.d.ts +90 -0
- package/dist/types/shared/format-utils/formatters/date-formatter.d.ts +8 -12
- package/dist/types/shared/format-utils/formatters/index.d.ts +1 -1
- package/dist/types/shared/format-utils/formatters/matrix-formatter.d.ts +2 -0
- package/dist/types/shared/format-utils/index.d.ts +2 -0
- package/dist/types/shared/format-utils/matrix-continuation.d.ts +55 -9
- package/dist/types/shared/format-utils/matrix-export-presentation.d.ts +21 -1
- package/dist/types/shared/format-utils/matrix-export-xlsx.d.ts +27 -0
- package/dist/types/shared/format-utils/presentation-execution.d.ts +27 -2
- package/dist/types/shared/format-utils/raw-temporal.d.ts +8 -0
- package/dist/types/shared/format-utils/table-export/index.d.ts +8 -0
- package/dist/types/shared/format-utils/table-export/prepare-table-export.d.ts +50 -0
- package/dist/types/shared/format-utils/table-export/table-export-formatting.d.ts +47 -0
- package/dist/types/shared/format-utils/table-export/table-export-raw-temporal.d.ts +40 -0
- package/dist/types/shared/format-utils/table-export/table-export-result.d.ts +31 -0
- package/dist/types/shared/format-utils/table-export/table-export-sheet.d.ts +38 -0
- package/dist/types/shared/format-utils/temporal-bucket.d.ts +9 -0
- package/package.json +2 -1
- package/dist/chunks/aggregate-table-row-presentation-B_vQjYR3.js +0 -996
- package/dist/chunks/apply-dashboard-operations-C-iahGka.js +0 -402
- package/dist/chunks/bookmark-state-k7y5SNGf.js +0 -331
- package/dist/chunks/calculated-field-identity-DcBS2NPP.js +0 -2161
- package/dist/chunks/canonical-result-keys-CEQefvdO.js +0 -33
- package/dist/chunks/common-types-CUf03Htv.js +0 -288
- package/dist/chunks/csv-utils-GUfKyT1J.js +0 -56
- package/dist/chunks/custom-visual-inputs-BrUOIwln.js +0 -3288
- package/dist/chunks/document-sheet-utils-C1eEldxs.js +0 -1076
- package/dist/chunks/matrix-definition-DQDI2okF.js +0 -206
- package/dist/chunks/metric-comparison-CojWeLqx.js +0 -392
- package/dist/chunks/pivot-result-lifecycle-8qCDmpKc.js +0 -804
- package/dist/chunks/raw-temporal-D61lr48Y.js +0 -1464
- package/dist/chunks/temporal-bucket-D8JF7zKz.js +0 -575
- package/dist/chunks/temporal-bucket-contract-DaOajRC7.js +0 -108
|
@@ -1,996 +0,0 @@
|
|
|
1
|
-
var ne = Object.defineProperty;
|
|
2
|
-
var se = (e, t, a) => t in e ? ne(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
|
|
3
|
-
var V = (e, t, a) => se(e, typeof t != "symbol" ? t + "" : t, a);
|
|
4
|
-
import { i as le, g as L, k as ie, B as R, q as ue, A as ce, y as me, s as de } from "./raw-temporal-D61lr48Y.js";
|
|
5
|
-
import { h as G, m as _, i as X, j as fe, k as Z, l as b } from "./matrix-formatter-DQ8avoIQ.js";
|
|
6
|
-
import { h as E } from "./csv-utils-GUfKyT1J.js";
|
|
7
|
-
import { l as ge, aD as W, w as k, A as F, z as he } from "./validators-Ej1DdCXa.js";
|
|
8
|
-
import "./matrix-operation-contract-B8PBF1Gd.js";
|
|
9
|
-
import "./analytics-base-schemas-BFAoRlkU.js";
|
|
10
|
-
import "zod";
|
|
11
|
-
import { g as K, p as v } from "./matrix-definition-DQDI2okF.js";
|
|
12
|
-
import { PDF_SAFETY_LIMIT_EXCEEDED as Y, getUtf8ByteLength as ye, FAST_PDF_POLICY as pe } from "../pdf-export-policy/index.js";
|
|
13
|
-
import { DEFAULT_RESOLVED_VALUE_FORMAT_PREFERENCES as we } from "../value-format-preferences/index.js";
|
|
14
|
-
import { f as be, c as Te, g as ve } from "./temporal-bucket-D8JF7zKz.js";
|
|
15
|
-
import { z as Le, g as Se } from "./zoned-wall-clock-MulfA26h.js";
|
|
16
|
-
function Ce(e, t, a) {
|
|
17
|
-
const o = {
|
|
18
|
-
...t,
|
|
19
|
-
locale: t.locale ?? a
|
|
20
|
-
};
|
|
21
|
-
if (o.type === "number")
|
|
22
|
-
return L(e, o);
|
|
23
|
-
const { prefix: r, suffix: s, ...n } = o;
|
|
24
|
-
return `${r ?? ""}${L(e, {
|
|
25
|
-
...n,
|
|
26
|
-
negativeStyle: o.type === "currency" ? o.negativeStyle : "minus"
|
|
27
|
-
})}${s ?? ""}`;
|
|
28
|
-
}
|
|
29
|
-
function x(e, t, a) {
|
|
30
|
-
return e === null ? { value: e, text: null } : !t || !le(t) && t.type !== "duration" ? {
|
|
31
|
-
value: e,
|
|
32
|
-
text: L(e, { type: "number", locale: a })
|
|
33
|
-
} : t.type === "duration" ? {
|
|
34
|
-
value: e,
|
|
35
|
-
text: ie(e, {
|
|
36
|
-
inputUnit: t.inputUnit,
|
|
37
|
-
outputStyle: t.outputStyle,
|
|
38
|
-
largestUnit: t.largestUnit,
|
|
39
|
-
smallestUnit: t.smallestUnit,
|
|
40
|
-
maxUnits: t.maxUnits,
|
|
41
|
-
prefix: t.prefix,
|
|
42
|
-
suffix: t.suffix,
|
|
43
|
-
negativeInParentheses: t.negativeStyle === "parentheses"
|
|
44
|
-
})
|
|
45
|
-
} : { value: e, text: Ce(e, t, a) };
|
|
46
|
-
}
|
|
47
|
-
function U(e, t, a, o) {
|
|
48
|
-
return e === null ? { value: e, text: null } : o === "percent" ? {
|
|
49
|
-
value: e,
|
|
50
|
-
text: L(e, {
|
|
51
|
-
type: "percent",
|
|
52
|
-
locale: a,
|
|
53
|
-
minimumFractionDigits: t,
|
|
54
|
-
maximumFractionDigits: t,
|
|
55
|
-
percentValueMode: "fraction"
|
|
56
|
-
})
|
|
57
|
-
} : {
|
|
58
|
-
value: e,
|
|
59
|
-
text: L(e, {
|
|
60
|
-
type: "number",
|
|
61
|
-
locale: a,
|
|
62
|
-
minimumFractionDigits: t,
|
|
63
|
-
maximumFractionDigits: t,
|
|
64
|
-
suffix: "×"
|
|
65
|
-
})
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
function O(e, t) {
|
|
69
|
-
if (e === void 0) return t;
|
|
70
|
-
if (!Number.isInteger(e) || e < 0 || e > 6)
|
|
71
|
-
throw new RangeError("Comparison precision must be an integer from 0 to 6.");
|
|
72
|
-
return e;
|
|
73
|
-
}
|
|
74
|
-
function St(e, t) {
|
|
75
|
-
const a = {
|
|
76
|
-
mode: t.displayMode,
|
|
77
|
-
current: x(
|
|
78
|
-
e.currentValue,
|
|
79
|
-
t.metricFormat,
|
|
80
|
-
t.locale
|
|
81
|
-
),
|
|
82
|
-
comparison: x(
|
|
83
|
-
e.comparisonValue,
|
|
84
|
-
t.metricFormat,
|
|
85
|
-
t.locale
|
|
86
|
-
)
|
|
87
|
-
};
|
|
88
|
-
return (t.displayMode === "difference" || t.displayMode === "both") && (a.difference = x(
|
|
89
|
-
e.delta,
|
|
90
|
-
t.metricFormat,
|
|
91
|
-
t.locale
|
|
92
|
-
)), (t.displayMode === "percent_change" || t.displayMode === "both") && (a.percentChange = U(
|
|
93
|
-
e.percentChange,
|
|
94
|
-
O(t.precision, 1),
|
|
95
|
-
t.locale,
|
|
96
|
-
"percent"
|
|
97
|
-
)), t.displayMode === "ratio" && (a.ratio = U(
|
|
98
|
-
e.ratio,
|
|
99
|
-
O(t.precision, 2),
|
|
100
|
-
t.locale,
|
|
101
|
-
"ratio"
|
|
102
|
-
)), a;
|
|
103
|
-
}
|
|
104
|
-
const Me = 1e4, Ct = 1e6, Mt = 5e6, At = 1024 ** 3, kt = 1024 ** 3;
|
|
105
|
-
function $t(e) {
|
|
106
|
-
return e > Me;
|
|
107
|
-
}
|
|
108
|
-
const Et = {
|
|
109
|
-
rowLabels: "tabular",
|
|
110
|
-
subtotals: "after"
|
|
111
|
-
};
|
|
112
|
-
function xt(e, t) {
|
|
113
|
-
const a = t.rowLabels === "outline" ? { kind: "compact" } : e.layout.kind === "tabular" ? e.layout : { kind: "tabular", repeatLabels: !1 }, o = e.totals.rows;
|
|
114
|
-
return {
|
|
115
|
-
...e,
|
|
116
|
-
layout: a,
|
|
117
|
-
totals: {
|
|
118
|
-
...e.totals,
|
|
119
|
-
rows: {
|
|
120
|
-
...o,
|
|
121
|
-
levels: Object.fromEntries(
|
|
122
|
-
Object.entries(o.levels).map(([r, s]) => [
|
|
123
|
-
r,
|
|
124
|
-
{ ...s, position: t.subtotals }
|
|
125
|
-
])
|
|
126
|
-
)
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
const Ae = 2;
|
|
132
|
-
function ke(e) {
|
|
133
|
-
return typeof e == "number" ? Number.isInteger(e) : W(e) ? !e.value.includes(".") : !0;
|
|
134
|
-
}
|
|
135
|
-
function $e(e, t, a) {
|
|
136
|
-
const o = e.descriptors.measures.filter(
|
|
137
|
-
(n) => a.measureFormats[n.id] === void 0 && n.semanticFormat === void 0 && ge(n.column.dataType) === "number"
|
|
138
|
-
);
|
|
139
|
-
if (o.length === 0) return a;
|
|
140
|
-
const r = /* @__PURE__ */ new Set();
|
|
141
|
-
e.columns.forEach((n, l) => {
|
|
142
|
-
if (!(n.kind !== "measure" || r.has(n.measureId)))
|
|
143
|
-
for (const c of t) {
|
|
144
|
-
const i = c.values[l];
|
|
145
|
-
if ((i == null ? void 0 : i.kind) === "value" && !ke(i.value)) {
|
|
146
|
-
r.add(n.measureId);
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
const s = { ...a.measureFormats };
|
|
152
|
-
for (const { id: n } of o) {
|
|
153
|
-
const l = r.has(n) ? Ae : 0;
|
|
154
|
-
s[n] = {
|
|
155
|
-
type: "number",
|
|
156
|
-
minimumFractionDigits: l,
|
|
157
|
-
maximumFractionDigits: l,
|
|
158
|
-
useGrouping: !0
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
return { ...a, measureFormats: s };
|
|
162
|
-
}
|
|
163
|
-
function M(e) {
|
|
164
|
-
return k(e.slice(0, -1));
|
|
165
|
-
}
|
|
166
|
-
function Ee(e, t) {
|
|
167
|
-
return t.length > e.length && k(t.slice(0, e.length)) === k(e);
|
|
168
|
-
}
|
|
169
|
-
function xe(e) {
|
|
170
|
-
return e.map((t, a) => {
|
|
171
|
-
if (a === 0 || t.kind !== "layout") return !1;
|
|
172
|
-
const o = e[a - 1];
|
|
173
|
-
if (o.kind !== "layout") return !1;
|
|
174
|
-
if (t.role !== "member" || Ee(o.rowPath, t.rowPath)) return !0;
|
|
175
|
-
const r = e[a - 2];
|
|
176
|
-
return o.role === "member" && (!r || r.kind !== "layout" || r.role !== "member" || M(r.rowPath) !== M(o.rowPath)) && t.rowPath.length === o.rowPath.length && M(t.rowPath) === M(o.rowPath);
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
const Pe = "pdf-group-continuation";
|
|
180
|
-
function _e(e) {
|
|
181
|
-
if (!e.previousRow || e.row.isSubtotal === !0 || e.row.isGrandTotal === !0 || e.previousRow.isSubtotal === !0 || e.previousRow.isGrandTotal === !0)
|
|
182
|
-
return !0;
|
|
183
|
-
for (let t = 0; t <= e.levelIndex; t++)
|
|
184
|
-
if (e.getValue(e.row, t) !== e.getValue(e.previousRow, t))
|
|
185
|
-
return !0;
|
|
186
|
-
return !1;
|
|
187
|
-
}
|
|
188
|
-
function q(e, t, a) {
|
|
189
|
-
return !(a != null && a.hasTextAffixes) && t.kind === "value" && (typeof t.value == "number" || W(t.value)) ? e : E(e);
|
|
190
|
-
}
|
|
191
|
-
function Ie(e, t, a) {
|
|
192
|
-
const o = G(e.descriptors, t.presentation, a), r = e.columns.map((u) => {
|
|
193
|
-
var m;
|
|
194
|
-
return u.kind === "measure" && ((m = o.measureSemantics.get(u.measureId)) == null ? void 0 : m.isNumeric) === !0;
|
|
195
|
-
}), s = (u) => _([u], o.levels), n = (u, m, d) => X(u, m, t.presentation.totals[d], o.levels), l = e.columns.map((u) => {
|
|
196
|
-
if (u.kind !== "measure") return u.label;
|
|
197
|
-
const m = u.columnPath.map(s);
|
|
198
|
-
return u.role !== "member" && m.push(n(u.columnPath, u.role, "columns")), [...m, u.label].join(" / ");
|
|
199
|
-
}), c = Math.min(t.spec.columns.length, Math.max(
|
|
200
|
-
0,
|
|
201
|
-
...e.columns.map((u) => u.kind === "measure" ? u.columnPath.length + (u.role !== "member" ? 1 : 0) : 0)
|
|
202
|
-
)), i = Array.from({ length: c + 1 }, (u, m) => e.columns.map((d) => m === c ? d.label : d.kind !== "measure" ? "" : m < d.columnPath.length ? s(d.columnPath[m]) : m === d.columnPath.length && d.role !== "member" ? n(d.columnPath, d.role, "columns") : "")), g = (u, m) => fe({
|
|
203
|
-
path: u.rowPath,
|
|
204
|
-
role: u.kind === "layout" ? u.role : "member",
|
|
205
|
-
levelCount: Math.max(1, t.spec.rows.length),
|
|
206
|
-
repeatLabels: t.presentation.layout.kind !== "tabular" || t.presentation.layout.repeatLabels,
|
|
207
|
-
previousPath: m == null ? void 0 : m.rowPath
|
|
208
|
-
}), f = (u, m) => {
|
|
209
|
-
if (u.kind !== "layout") throw new Error("Layout presentation requires layout rows.");
|
|
210
|
-
if (u.values.length !== e.columns.length) throw new Error("Matrix row does not match its frozen layout.");
|
|
211
|
-
const d = g(u, m);
|
|
212
|
-
return e.columns.map((y, p) => {
|
|
213
|
-
if (y.kind === "hierarchy")
|
|
214
|
-
return `${" ".repeat(Math.max(0, u.rowPath.length - 1))}${n(u.rowPath, u.role, "rows")}`;
|
|
215
|
-
if (y.kind === "level") {
|
|
216
|
-
const C = t.spec.rows.findIndex((oe) => oe.id === y.levelId), w = d[C];
|
|
217
|
-
return w != null && w.visible ? w.total ? n(u.rowPath, u.role, "rows") : _(w.path, o.levels) : "";
|
|
218
|
-
}
|
|
219
|
-
const S = u.values[p], T = o.measures.get(y.measureId);
|
|
220
|
-
if (S.kind === "value" && !T)
|
|
221
|
-
throw new Error("Matrix value is missing its measure descriptor.");
|
|
222
|
-
return Z(S, T, t.presentation.absence);
|
|
223
|
-
});
|
|
224
|
-
}, h = (u, m) => f(u, m).map((d, y) => {
|
|
225
|
-
const p = e.columns[y];
|
|
226
|
-
return p.kind === "measure" ? q(d, u.values[y], o.measureSemantics.get(p.measureId)) : E(d);
|
|
227
|
-
});
|
|
228
|
-
return {
|
|
229
|
-
headers: l,
|
|
230
|
-
headerBands: i,
|
|
231
|
-
numericColumns: r,
|
|
232
|
-
/** A row's cells; after `previous`, a tabular layout prints each label once. */
|
|
233
|
-
row: (u, m) => f(u, m),
|
|
234
|
-
/**
|
|
235
|
-
* Level columns whose group label the row above shows, so this row
|
|
236
|
-
* continues the group (Plan 2, 2d, C8). Only a member row after a member
|
|
237
|
-
* row continues one: a total prints as a band, and its rules stay whole
|
|
238
|
-
* above and below it.
|
|
239
|
-
*/
|
|
240
|
-
continuedColumns: (u, m) => {
|
|
241
|
-
const d = (p) => (p == null ? void 0 : p.kind) === "layout" && p.role === "member";
|
|
242
|
-
if (!d(u) || !d(m)) return [];
|
|
243
|
-
const y = g(u, m);
|
|
244
|
-
return e.columns.flatMap((p, S) => {
|
|
245
|
-
var C;
|
|
246
|
-
if (p.kind !== "level") return [];
|
|
247
|
-
const T = t.spec.rows.findIndex((w) => w.id === p.levelId);
|
|
248
|
-
return T < u.rowPath.length && ((C = y[T]) == null ? void 0 : C.visible) === !1 ? [S] : [];
|
|
249
|
-
});
|
|
250
|
-
},
|
|
251
|
-
csvRow: (u) => h(u),
|
|
252
|
-
/**
|
|
253
|
-
* `previousRow` is the row before `data[0]`, carried by the export's
|
|
254
|
-
* continuation, so a tabular layout prints each label once across the
|
|
255
|
-
* whole file. Retries are pure: suppression never relies on mutable
|
|
256
|
-
* formatter state or an earlier worker. Without it, the first row prints
|
|
257
|
-
* its labels.
|
|
258
|
-
*/
|
|
259
|
-
csvRows: (u, m) => u.map((d, y) => h(d, y ? u[y - 1] : m ?? void 0))
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
function Pt(e) {
|
|
263
|
-
return e.columns.map((t) => E(t.label));
|
|
264
|
-
}
|
|
265
|
-
function _t(e, t, a) {
|
|
266
|
-
if (e.kind !== "flat") throw new Error("Flat Matrix CSV requires flat rows.");
|
|
267
|
-
if (e.values.length !== t.columns.length) throw new Error("Matrix row does not match its frozen layout.");
|
|
268
|
-
const o = [...e.rowPath, ...e.columnPath];
|
|
269
|
-
return t.columns.map((r, s) => {
|
|
270
|
-
if (r.kind === "measure") {
|
|
271
|
-
const l = e.values[s], c = a.measures.get(r.measureId);
|
|
272
|
-
if (l.kind === "value" && !c) throw new Error("Matrix value is missing its measure descriptor.");
|
|
273
|
-
return q(
|
|
274
|
-
Z(l, c, a.absence),
|
|
275
|
-
l,
|
|
276
|
-
a.measureSemantics.get(r.measureId)
|
|
277
|
-
);
|
|
278
|
-
}
|
|
279
|
-
const n = r.kind === "level" ? o.find((l) => l.levelId === r.levelId) : void 0;
|
|
280
|
-
if (!n) throw new Error("Flat Matrix row does not match its frozen layout.");
|
|
281
|
-
return E(_([n], a.levels));
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
function De(e) {
|
|
285
|
-
const t = Ie(e.layout, e.request, e.report), a = e.layout.columns.map((n, l) => ({
|
|
286
|
-
index: l,
|
|
287
|
-
columnId: `matrix:${l}`,
|
|
288
|
-
label: t.headers[l],
|
|
289
|
-
isNumeric: t.numericColumns[l]
|
|
290
|
-
})), o = (n, l, c) => ({
|
|
291
|
-
text: n,
|
|
292
|
-
colspan: 1,
|
|
293
|
-
rowspan: 1,
|
|
294
|
-
columnId: a[l].columnId,
|
|
295
|
-
isHeader: c,
|
|
296
|
-
isNumeric: a[l].isNumeric,
|
|
297
|
-
className: a[l].isNumeric ? "numeric" : e.layout.columns[l].kind === "hierarchy" ? "matrix-hierarchy" : ""
|
|
298
|
-
}), r = [], s = e.layout.columns.findIndex((n) => n.kind === "measure");
|
|
299
|
-
e.request.spec.columns.length && s >= 0 && r.push({
|
|
300
|
-
repeatHeader: !0,
|
|
301
|
-
headerType: "pivot-axis",
|
|
302
|
-
headerRowIndex: 0,
|
|
303
|
-
cells: [
|
|
304
|
-
...s ? [{ ...o("", 0, !0), colspan: s }] : [],
|
|
305
|
-
{
|
|
306
|
-
...o(e.request.spec.columns.map((n) => K(n, e.request.presentation)).join(" / "), s, !0),
|
|
307
|
-
colspan: e.layout.columns.length - s,
|
|
308
|
-
isNumeric: !1,
|
|
309
|
-
className: ""
|
|
310
|
-
}
|
|
311
|
-
]
|
|
312
|
-
});
|
|
313
|
-
for (const [n, l] of t.headerBands.entries())
|
|
314
|
-
r.push({
|
|
315
|
-
repeatHeader: !0,
|
|
316
|
-
headerType: n === t.headerBands.length - 1 ? "metrics" : "pivot-level",
|
|
317
|
-
headerRowIndex: r.length,
|
|
318
|
-
cells: l.map((c, i) => o(c, i, !0))
|
|
319
|
-
});
|
|
320
|
-
return {
|
|
321
|
-
headers: r,
|
|
322
|
-
rows: e.rows.map((n, l) => {
|
|
323
|
-
const c = new Set(t.continuedColumns(n, e.rows[l - 1]));
|
|
324
|
-
return {
|
|
325
|
-
index: l,
|
|
326
|
-
type: n.kind === "layout" && n.role !== "member" ? "subtotal" : "data",
|
|
327
|
-
subtotalLevel: String(n.rowPath.length),
|
|
328
|
-
// A tabular layout prints each label once unless it repeats them; the
|
|
329
|
-
// blank cell continues its group, so a grid draws no rule above it.
|
|
330
|
-
cells: t.row(n, e.rows[l - 1]).map((i, g) => c.has(g) ? { ...o(i, g, !1), className: Pe } : o(i, g, !1))
|
|
331
|
-
};
|
|
332
|
-
}),
|
|
333
|
-
grandTotal: null,
|
|
334
|
-
// Totals are already in the ordered body at their authored position.
|
|
335
|
-
metadata: {
|
|
336
|
-
tableType: "pivot",
|
|
337
|
-
totalRows: e.rows.length,
|
|
338
|
-
totalColumns: a.length,
|
|
339
|
-
rowLevels: e.layout.columns.filter((n) => n.kind !== "measure").length,
|
|
340
|
-
pivotLevels: e.request.spec.columns.length,
|
|
341
|
-
hasGrandTotal: !1,
|
|
342
|
-
columnOrder: a.map((n) => n.columnId),
|
|
343
|
-
columns: a
|
|
344
|
-
}
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
function Re(e, t, a) {
|
|
348
|
-
const { levels: o } = G(e.descriptors, t.presentation, a), r = t.spec.columns.length > 0, s = [], n = [], l = e.columns.map((i, g) => {
|
|
349
|
-
if (i.kind !== "measure") return null;
|
|
350
|
-
const f = r ? `${i.role}:${k(i.columnPath)}` : `measure:${g}`;
|
|
351
|
-
let h = s.indexOf(f);
|
|
352
|
-
return h < 0 && (h = s.push(f) - 1, n.push(r ? X(i.columnPath, i.role, t.presentation.totals.columns, o) : i.label)), h;
|
|
353
|
-
}), c = t.spec.columns[t.spec.columns.length - 1];
|
|
354
|
-
return {
|
|
355
|
-
columnGroups: l,
|
|
356
|
-
groupLabels: n,
|
|
357
|
-
/** What bands name their groups by: the innermost column level, or "Measures". */
|
|
358
|
-
groupLevelLabel: c ? K(c, t.presentation) : "Measures"
|
|
359
|
-
};
|
|
360
|
-
}
|
|
361
|
-
function It(e) {
|
|
362
|
-
const { layout: t, rows: a, report: o } = e, r = {
|
|
363
|
-
...e.request,
|
|
364
|
-
presentation: $e(t, a, e.request.presentation)
|
|
365
|
-
}, s = De({ layout: t, rows: a, request: r, report: o }), n = xe(a), l = Re(t, r, o), c = {
|
|
366
|
-
...s,
|
|
367
|
-
rows: s.rows.map((i, g) => ({ ...i, keepWithPrevious: n[g] })),
|
|
368
|
-
metadata: { ...s.metadata, ...l }
|
|
369
|
-
};
|
|
370
|
-
return { request: r, table: c, ...l };
|
|
371
|
-
}
|
|
372
|
-
class Fe extends Error {
|
|
373
|
-
constructor() {
|
|
374
|
-
super(...arguments);
|
|
375
|
-
V(this, "code", Y);
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
function B(e) {
|
|
379
|
-
if (!e || typeof e != "object")
|
|
380
|
-
return;
|
|
381
|
-
const { error: t, message: a, detail: o } = e;
|
|
382
|
-
for (const r of [t, a, o])
|
|
383
|
-
if (typeof r == "string" && r.trim())
|
|
384
|
-
return r.trim();
|
|
385
|
-
}
|
|
386
|
-
async function Ne(e) {
|
|
387
|
-
const t = `PDF request failed: ${e.status} ${e.statusText}`.trim(), a = e.headers.get("content-type") || "";
|
|
388
|
-
try {
|
|
389
|
-
if (a.includes("application/json")) {
|
|
390
|
-
const r = await e.json(), s = typeof r.code == "string" ? r.code : typeof r.errorCode == "string" ? r.errorCode : void 0;
|
|
391
|
-
return { message: B(r) || t, code: s };
|
|
392
|
-
}
|
|
393
|
-
const o = await e.text();
|
|
394
|
-
if (!o.trim())
|
|
395
|
-
return { message: t };
|
|
396
|
-
try {
|
|
397
|
-
const r = JSON.parse(o), s = typeof r.code == "string" ? r.code : typeof r.errorCode == "string" ? r.errorCode : void 0;
|
|
398
|
-
return {
|
|
399
|
-
message: B(r) || o.trim(),
|
|
400
|
-
code: s
|
|
401
|
-
};
|
|
402
|
-
} catch {
|
|
403
|
-
return { message: o.trim() };
|
|
404
|
-
}
|
|
405
|
-
} catch {
|
|
406
|
-
return { message: t };
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
async function Dt(e) {
|
|
410
|
-
if (!e.token) throw new Error("Missing auth token for PDF export");
|
|
411
|
-
if (ye(e.serializedPayload) > pe.maxRequestBytes)
|
|
412
|
-
throw new Error("Fast-path PDF request exceeds the structured body limit");
|
|
413
|
-
const t = await (e.fetchImpl ?? fetch)(e.url, {
|
|
414
|
-
method: "POST",
|
|
415
|
-
headers: { "Content-Type": "application/json", Authorization: `Bearer ${e.token}` },
|
|
416
|
-
body: e.serializedPayload,
|
|
417
|
-
signal: e.signal
|
|
418
|
-
});
|
|
419
|
-
if (!t.ok) {
|
|
420
|
-
const o = await Ne(t);
|
|
421
|
-
throw o.code === Y ? new Fe(o.message) : new Error(o.message);
|
|
422
|
-
}
|
|
423
|
-
const a = await t.json();
|
|
424
|
-
if (a != null && a.error) throw new Error(a.error);
|
|
425
|
-
if (typeof (a == null ? void 0 : a.url) != "string" || !a.url.trim())
|
|
426
|
-
throw new Error("Fast-path PDF response missing download URL");
|
|
427
|
-
return a;
|
|
428
|
-
}
|
|
429
|
-
const Ve = /* @__PURE__ */ new Set(["short", "medium", "long"]), Ue = /^(\d{4})-(\d{2})-(\d{2})$/, Oe = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,9})?)?$/, Be = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,9})?)?(?:Z|[+-]\d{2}:\d{2})$/, N = " – ";
|
|
430
|
-
function Rt(e) {
|
|
431
|
-
if (!ve(e)) return;
|
|
432
|
-
const t = Object.keys(e);
|
|
433
|
-
if (e.mode === "period_label" && t.length === 1)
|
|
434
|
-
return { mode: "period_label" };
|
|
435
|
-
if (e.mode === "style" && t.length === 2 && typeof e.dateStyle == "string" && Ve.has(e.dateStyle))
|
|
436
|
-
return { mode: "style", dateStyle: e.dateStyle };
|
|
437
|
-
if (e.mode === "pattern" && t.length === 3 && e.dialect === "semaphor_tokens" && typeof e.pattern == "string" && ze(e.pattern) === null)
|
|
438
|
-
return {
|
|
439
|
-
mode: "pattern",
|
|
440
|
-
dialect: "semaphor_tokens",
|
|
441
|
-
pattern: e.pattern
|
|
442
|
-
};
|
|
443
|
-
}
|
|
444
|
-
function ze(e) {
|
|
445
|
-
try {
|
|
446
|
-
return me({ dialect: "semaphor_tokens", pattern: e }), null;
|
|
447
|
-
} catch (t) {
|
|
448
|
-
return t instanceof Error ? t.message : "The pattern is invalid.";
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
function Ft(e) {
|
|
452
|
-
const { value: t, part: a, presentation: o, preferences: r, calendar: s } = e;
|
|
453
|
-
if ((o == null ? void 0 : o.mode) === "period_label" && t.periodLabel && a === "range")
|
|
454
|
-
return { ok: !0, text: t.periodLabel };
|
|
455
|
-
const [n, l] = t.bounds, i = l === void 0 || a === "start" ? [{ raw: n, role: "start" }] : a === "end" ? [{ raw: l, role: "end" }] : [
|
|
456
|
-
{ raw: n, role: "start" },
|
|
457
|
-
{ raw: l, role: "end" }
|
|
458
|
-
], g = i.map(({ raw: m }) => Ze(m, s.tz));
|
|
459
|
-
if (g.some((m) => m === null))
|
|
460
|
-
return {
|
|
461
|
-
ok: !1,
|
|
462
|
-
text: i.map(({ raw: m }) => m).join(N),
|
|
463
|
-
diagnostic: {
|
|
464
|
-
code: "invalid_temporal_input_value",
|
|
465
|
-
message: "A date input bound is not a date or an instant."
|
|
466
|
-
}
|
|
467
|
-
};
|
|
468
|
-
const f = t.precision === "day" ? g.map(
|
|
469
|
-
(m, d) => Ke(m, i[d].role, s.tz)
|
|
470
|
-
) : [], h = f.length > 0 && f.every((m) => m !== null) ? f : null;
|
|
471
|
-
return { ok: !0, text: h ? je(h, o, r, s) : Ge(
|
|
472
|
-
g.map((m) => We(m, s.tz)),
|
|
473
|
-
o,
|
|
474
|
-
r,
|
|
475
|
-
s
|
|
476
|
-
) };
|
|
477
|
-
}
|
|
478
|
-
function je(e, t, a, o) {
|
|
479
|
-
const [r, s = r] = e;
|
|
480
|
-
if ((t == null ? void 0 : t.mode) === "pattern")
|
|
481
|
-
return Q(
|
|
482
|
-
e.map(
|
|
483
|
-
(c) => J(I(c), "date", t.pattern, a, o)
|
|
484
|
-
)
|
|
485
|
-
);
|
|
486
|
-
const n = (t == null ? void 0 : t.mode) === "style" ? t.dateStyle : a.dateStyle;
|
|
487
|
-
if (!t || t.mode === "period_label") {
|
|
488
|
-
const c = Ye(r, s, o);
|
|
489
|
-
if (c)
|
|
490
|
-
return be({
|
|
491
|
-
value: I(r),
|
|
492
|
-
metadata: {
|
|
493
|
-
kind: "temporal_bucket",
|
|
494
|
-
granularity: c,
|
|
495
|
-
calendar: { tz: o.tz, weekStart: o.weekStart ?? 1 }
|
|
496
|
-
},
|
|
497
|
-
format: Te({
|
|
498
|
-
metadata: {
|
|
499
|
-
kind: "temporal_bucket",
|
|
500
|
-
granularity: c,
|
|
501
|
-
calendar: { tz: o.tz, weekStart: o.weekStart ?? 1 }
|
|
502
|
-
},
|
|
503
|
-
locale: a.locale,
|
|
504
|
-
styles: { dateStyle: n, dateTime: { ...a.dateTime } }
|
|
505
|
-
}).format
|
|
506
|
-
});
|
|
507
|
-
}
|
|
508
|
-
const l = new Intl.DateTimeFormat(a.locale, {
|
|
509
|
-
calendar: "gregory",
|
|
510
|
-
timeZone: "UTC",
|
|
511
|
-
dateStyle: n
|
|
512
|
-
});
|
|
513
|
-
return He(r, s) ? l.format(A(r)) : H(l, A(r), A(s));
|
|
514
|
-
}
|
|
515
|
-
function Ge(e, t, a, o) {
|
|
516
|
-
if ((t == null ? void 0 : t.mode) === "pattern")
|
|
517
|
-
return Q(
|
|
518
|
-
e.map(
|
|
519
|
-
(l) => J(
|
|
520
|
-
l.toISOString(),
|
|
521
|
-
"instant",
|
|
522
|
-
t.pattern,
|
|
523
|
-
a,
|
|
524
|
-
o
|
|
525
|
-
)
|
|
526
|
-
)
|
|
527
|
-
);
|
|
528
|
-
const r = new Intl.DateTimeFormat(a.locale, {
|
|
529
|
-
calendar: "gregory",
|
|
530
|
-
timeZone: o.tz,
|
|
531
|
-
dateStyle: (t == null ? void 0 : t.mode) === "style" ? t.dateStyle : a.dateTime.dateStyle,
|
|
532
|
-
timeStyle: a.dateTime.timeStyle
|
|
533
|
-
}), [s, n] = e;
|
|
534
|
-
return n && n.getTime() !== s.getTime() ? H(r, s, n) : r.format(s);
|
|
535
|
-
}
|
|
536
|
-
function H(e, t, a) {
|
|
537
|
-
const o = e;
|
|
538
|
-
return typeof o.formatRange == "function" ? o.formatRange(t, a) : `${e.format(t)}${N}${e.format(a)}`;
|
|
539
|
-
}
|
|
540
|
-
function J(e, t, a, o, r) {
|
|
541
|
-
const s = ue({
|
|
542
|
-
format: {
|
|
543
|
-
type: "raw_temporal",
|
|
544
|
-
presentation: { mode: "pattern", dialect: "semaphor_tokens", pattern: a }
|
|
545
|
-
},
|
|
546
|
-
// Temporal formatting reads no currency.
|
|
547
|
-
preferences: {
|
|
548
|
-
...o,
|
|
549
|
-
defaultCurrency: we.defaultCurrency
|
|
550
|
-
},
|
|
551
|
-
calendar: { tz: r.tz }
|
|
552
|
-
}), n = t === "date" && Xe(a) ? "instant" : t;
|
|
553
|
-
return ce({
|
|
554
|
-
value: n === t ? e : R(`${e}T00:00:00`, r.tz).toISOString(),
|
|
555
|
-
metadata: { kind: "raw_temporal", valueKind: n },
|
|
556
|
-
format: s
|
|
557
|
-
}).text;
|
|
558
|
-
}
|
|
559
|
-
function Xe(e) {
|
|
560
|
-
return /HH|mm|ss/.test(e);
|
|
561
|
-
}
|
|
562
|
-
function Q(e) {
|
|
563
|
-
return e[1] === void 0 || e[0] === e[1] ? e[0] : e.join(N);
|
|
564
|
-
}
|
|
565
|
-
function Ze(e, t) {
|
|
566
|
-
const a = Ue.exec(e);
|
|
567
|
-
if (a) {
|
|
568
|
-
const r = {
|
|
569
|
-
year: Number(a[1]),
|
|
570
|
-
month: Number(a[2]),
|
|
571
|
-
day: Number(a[3])
|
|
572
|
-
};
|
|
573
|
-
return Je(r) ? { kind: "date", date: r } : null;
|
|
574
|
-
}
|
|
575
|
-
const o = Be.test(e) ? new Date(e.replace(" ", "T")) : Oe.test(e) ? R(e.replace(" ", "T"), t) : null;
|
|
576
|
-
return o && !Number.isNaN(o.getTime()) ? { kind: "instant", instant: o } : null;
|
|
577
|
-
}
|
|
578
|
-
function We(e, t) {
|
|
579
|
-
return e.kind === "instant" ? e.instant : R(`${I(e.date)}T00:00:00`, t);
|
|
580
|
-
}
|
|
581
|
-
function Ke(e, t, a) {
|
|
582
|
-
if (e.kind === "date") return e.date;
|
|
583
|
-
const o = Le(e.instant, a), r = { year: o.year, month: o.month, day: o.day };
|
|
584
|
-
if (o.hour === 0 && o.minute === 0 && o.second === 0 && e.instant.getUTCMilliseconds() === 0) return t === "start" ? r : qe(r, -1);
|
|
585
|
-
const n = o.hour === 23 && o.minute === 59 && o.second === 59;
|
|
586
|
-
return t === "end" && n ? r : null;
|
|
587
|
-
}
|
|
588
|
-
function Ye(e, t, a) {
|
|
589
|
-
return a.fiscalCalendar || e.day !== 1 || e.year !== t.year || t.day !== ee(t.year, t.month) ? null : e.month === t.month ? "month" : e.month % 3 === 1 && t.month === e.month + 2 ? "quarter" : e.month === 1 && t.month === 12 ? "year" : null;
|
|
590
|
-
}
|
|
591
|
-
function I(e) {
|
|
592
|
-
return `${String(e.year).padStart(4, "0")}-${String(e.month).padStart(2, "0")}-${String(e.day).padStart(2, "0")}`;
|
|
593
|
-
}
|
|
594
|
-
function A(e) {
|
|
595
|
-
const t = /* @__PURE__ */ new Date(0);
|
|
596
|
-
return t.setUTCFullYear(e.year, e.month - 1, e.day), t.setUTCHours(0, 0, 0, 0), t;
|
|
597
|
-
}
|
|
598
|
-
function qe(e, t) {
|
|
599
|
-
const a = A(e);
|
|
600
|
-
return a.setUTCDate(a.getUTCDate() + t), {
|
|
601
|
-
year: a.getUTCFullYear(),
|
|
602
|
-
month: a.getUTCMonth() + 1,
|
|
603
|
-
day: a.getUTCDate()
|
|
604
|
-
};
|
|
605
|
-
}
|
|
606
|
-
function He(e, t) {
|
|
607
|
-
return e.year === t.year && e.month === t.month && e.day === t.day;
|
|
608
|
-
}
|
|
609
|
-
function ee(e, t) {
|
|
610
|
-
return new Date(Date.UTC(e, t, 0)).getUTCDate();
|
|
611
|
-
}
|
|
612
|
-
function Je(e) {
|
|
613
|
-
return e.year >= 1 && e.month >= 1 && e.month <= 12 && e.day >= 1 && e.day <= ee(e.year, e.month);
|
|
614
|
-
}
|
|
615
|
-
const Qe = /^\d{4}-\d{2}-\d{2}$/;
|
|
616
|
-
function te(e) {
|
|
617
|
-
const t = e.split(".");
|
|
618
|
-
return t[t.length - 1].replace(/_/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").split(" ").map((r) => r.charAt(0).toUpperCase() + r.slice(1).toLowerCase()).join(" ");
|
|
619
|
-
}
|
|
620
|
-
const z = 10;
|
|
621
|
-
function P(e, t) {
|
|
622
|
-
const a = e.slice(0, z).map(t).join(", "), o = e.length - z;
|
|
623
|
-
return o > 0 ? `${a}, and ${o} more` : a;
|
|
624
|
-
}
|
|
625
|
-
function et(e) {
|
|
626
|
-
if (e.valueType !== "date" || e.operation !== "between" && e.operation !== "not between")
|
|
627
|
-
return;
|
|
628
|
-
const t = F(e.relativeMeta);
|
|
629
|
-
if (t)
|
|
630
|
-
return he(t) || t.unit === "quarter" || t.unit === "year" ? t : void 0;
|
|
631
|
-
}
|
|
632
|
-
function tt(e, t) {
|
|
633
|
-
if (t !== "label") return et(e);
|
|
634
|
-
if (!(e.valueType !== "date" || e.operation !== "between" && e.operation !== "not between"))
|
|
635
|
-
return F(e.relativeMeta);
|
|
636
|
-
}
|
|
637
|
-
function j(e, t = {}) {
|
|
638
|
-
const { name: a, operation: o, values: r, valueType: s } = e, n = t.label ?? te(a), l = tt(e, t.relativeDates);
|
|
639
|
-
if (l) {
|
|
640
|
-
const i = Se(l);
|
|
641
|
-
if (i)
|
|
642
|
-
return o === "between" ? `${n}: ${i}` : `${n} not in ${i}`;
|
|
643
|
-
}
|
|
644
|
-
if (!r || r.length === 0)
|
|
645
|
-
return o === "is null" ? `${n} is empty` : o === "is not null" ? `${n} is not empty` : "";
|
|
646
|
-
const c = (i) => {
|
|
647
|
-
if (s === "date" && i) {
|
|
648
|
-
const g = e.temporalPrecision === "minute", f = {
|
|
649
|
-
year: "numeric",
|
|
650
|
-
month: "short",
|
|
651
|
-
day: "numeric",
|
|
652
|
-
...g ? {
|
|
653
|
-
hour: "numeric",
|
|
654
|
-
minute: "2-digit"
|
|
655
|
-
} : {}
|
|
656
|
-
};
|
|
657
|
-
if (typeof i == "string" && Qe.test(i)) {
|
|
658
|
-
const [u, m, d] = i.split("-").map(Number);
|
|
659
|
-
return new Intl.DateTimeFormat(void 0, {
|
|
660
|
-
year: "numeric",
|
|
661
|
-
month: "short",
|
|
662
|
-
day: "numeric",
|
|
663
|
-
timeZone: "UTC"
|
|
664
|
-
}).format(new Date(Date.UTC(u, m - 1, d)));
|
|
665
|
-
}
|
|
666
|
-
if (typeof i == "string" && de(i) === "wall_datetime") {
|
|
667
|
-
const [u, m, d, y, p] = i.split(/[-T :.]/).map(Number);
|
|
668
|
-
return new Intl.DateTimeFormat(void 0, {
|
|
669
|
-
...f,
|
|
670
|
-
timeZone: "UTC"
|
|
671
|
-
}).format(new Date(Date.UTC(u, m - 1, d, y, p)));
|
|
672
|
-
}
|
|
673
|
-
const h = new Date(i);
|
|
674
|
-
if (!isNaN(h.getTime()))
|
|
675
|
-
try {
|
|
676
|
-
return new Intl.DateTimeFormat(void 0, {
|
|
677
|
-
...f,
|
|
678
|
-
...t.timezone ? { timeZone: t.timezone } : {}
|
|
679
|
-
}).format(h);
|
|
680
|
-
} catch {
|
|
681
|
-
return g ? h.toLocaleString(void 0, f) : h.toLocaleDateString(void 0, f);
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
return String(i);
|
|
685
|
-
};
|
|
686
|
-
switch (o) {
|
|
687
|
-
case "=":
|
|
688
|
-
return `${n}: ${c(r[0])}`;
|
|
689
|
-
case "!=":
|
|
690
|
-
return `${n} ≠ ${c(r[0])}`;
|
|
691
|
-
case ">":
|
|
692
|
-
return `${n} > ${c(r[0])}`;
|
|
693
|
-
case "<":
|
|
694
|
-
return `${n} < ${c(r[0])}`;
|
|
695
|
-
case ">=":
|
|
696
|
-
return `${n} ≥ ${c(r[0])}`;
|
|
697
|
-
case "<=":
|
|
698
|
-
return `${n} ≤ ${c(r[0])}`;
|
|
699
|
-
case "between":
|
|
700
|
-
case "not between": {
|
|
701
|
-
const i = `${c(r[0])} - ${c(r[1])}`;
|
|
702
|
-
return o === "between" ? `${n}: ${i}` : `${n} not in ${i}`;
|
|
703
|
-
}
|
|
704
|
-
case "in":
|
|
705
|
-
return r.length === 1 ? `${n}: ${c(r[0])}` : `${n}: ${P(r, c)}`;
|
|
706
|
-
case "not in":
|
|
707
|
-
return `${n} not in (${P(r, c)})`;
|
|
708
|
-
case "like":
|
|
709
|
-
return `${n} contains "${r[0]}"`;
|
|
710
|
-
case "not like":
|
|
711
|
-
return `${n} doesn't contain "${r[0]}"`;
|
|
712
|
-
default:
|
|
713
|
-
return `${n}: ${P(r, c)}`;
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
function Nt(e, t = {}) {
|
|
717
|
-
if (!e || e.length === 0)
|
|
718
|
-
return "";
|
|
719
|
-
const a = /* @__PURE__ */ new Map();
|
|
720
|
-
e.forEach((r) => {
|
|
721
|
-
const s = a.get(r.name) || [];
|
|
722
|
-
s.push(r), a.set(r.name, s);
|
|
723
|
-
});
|
|
724
|
-
const o = [];
|
|
725
|
-
return a.forEach((r, s) => {
|
|
726
|
-
if (r.length === 1) {
|
|
727
|
-
const n = j(r[0], t);
|
|
728
|
-
n && o.push(n);
|
|
729
|
-
} else {
|
|
730
|
-
const n = te(s), l = r.map((c) => j(c, t).replace(`${n}: `, "").replace(`${n} `, "")).filter(Boolean);
|
|
731
|
-
l.length > 0 && o.push(`${n}: ${l.join(" and ")}`);
|
|
732
|
-
}
|
|
733
|
-
}), o.join(" | ");
|
|
734
|
-
}
|
|
735
|
-
function Vt(e) {
|
|
736
|
-
return ((e == null ? void 0 : e.filterValues) ?? []).filter(rt).map(at);
|
|
737
|
-
}
|
|
738
|
-
function rt(e) {
|
|
739
|
-
return !!e && typeof e == "object" && typeof e.name == "string" && Array.isArray(e.values);
|
|
740
|
-
}
|
|
741
|
-
function at(e) {
|
|
742
|
-
if (!("relativeMeta" in e) || e.relativeMeta === void 0) return e;
|
|
743
|
-
const { relativeMeta: t, ...a } = e, o = F(t);
|
|
744
|
-
return o ? { ...a, relativeMeta: o } : a;
|
|
745
|
-
}
|
|
746
|
-
const ot = /* @__PURE__ */ new Set([
|
|
747
|
-
"day",
|
|
748
|
-
"week",
|
|
749
|
-
"month",
|
|
750
|
-
"quarter",
|
|
751
|
-
"year"
|
|
752
|
-
]);
|
|
753
|
-
function nt(e, t) {
|
|
754
|
-
try {
|
|
755
|
-
const a = b(
|
|
756
|
-
v(e),
|
|
757
|
-
t,
|
|
758
|
-
"yyyy-MM-dd"
|
|
759
|
-
), [o, r, s] = a.split("-").map(Number), n = new Date(Date.UTC(o, r - 1, s));
|
|
760
|
-
return n.setUTCDate(n.getUTCDate() - 1), b(n, "UTC", "yyyy-MM-dd");
|
|
761
|
-
} catch {
|
|
762
|
-
return;
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
|
-
function Ut(e, t, a, o = !1) {
|
|
766
|
-
const r = st(
|
|
767
|
-
e,
|
|
768
|
-
t,
|
|
769
|
-
a,
|
|
770
|
-
o
|
|
771
|
-
);
|
|
772
|
-
return `${r.start} - ${r.end}`;
|
|
773
|
-
}
|
|
774
|
-
function st(e, t, a, o = !1) {
|
|
775
|
-
try {
|
|
776
|
-
if (a && ot.has(a)) {
|
|
777
|
-
const r = nt(e.end, t);
|
|
778
|
-
if (r) {
|
|
779
|
-
const s = o ? "MMM d" : "MMM d, yyyy";
|
|
780
|
-
return {
|
|
781
|
-
start: b(
|
|
782
|
-
v(e.start),
|
|
783
|
-
t,
|
|
784
|
-
s
|
|
785
|
-
),
|
|
786
|
-
end: b(
|
|
787
|
-
v(`${r}T00:00:00Z`),
|
|
788
|
-
"UTC",
|
|
789
|
-
"MMM d, yyyy"
|
|
790
|
-
)
|
|
791
|
-
};
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
if (a === "second" || a === "minute" || a === "hour") {
|
|
795
|
-
const r = o ? "MMM d, h:mm a" : "MMM d, yyyy, h:mm a";
|
|
796
|
-
return {
|
|
797
|
-
start: b(v(e.start), t, r),
|
|
798
|
-
end: `before ${b(
|
|
799
|
-
v(e.end),
|
|
800
|
-
t,
|
|
801
|
-
r
|
|
802
|
-
)}`
|
|
803
|
-
};
|
|
804
|
-
}
|
|
805
|
-
} catch {
|
|
806
|
-
}
|
|
807
|
-
return { start: e.start, end: `before ${e.end}` };
|
|
808
|
-
}
|
|
809
|
-
const lt = "__TOTAL__";
|
|
810
|
-
function $(e) {
|
|
811
|
-
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
812
|
-
}
|
|
813
|
-
function D(e) {
|
|
814
|
-
return e === lt;
|
|
815
|
-
}
|
|
816
|
-
function Ot(e) {
|
|
817
|
-
const t = /* @__PURE__ */ new Map(), a = (e.groupByColumns ?? []).map((r, s) => {
|
|
818
|
-
var i, g, f;
|
|
819
|
-
if (!$(r))
|
|
820
|
-
throw new Error(`Aggregate groupByColumns[${s}] is invalid`);
|
|
821
|
-
const n = typeof r.id == "string" && r.id.length > 0 ? r.id : void 0, l = n ? (f = (g = (i = e.columnKeyMap) == null ? void 0 : i.byRole) == null ? void 0 : g.groupby) == null ? void 0 : f[n] : void 0, c = (l == null ? void 0 : l.outputKey) || (l == null ? void 0 : l.rawKey) || (typeof r.alias == "string" && r.alias.length > 0 ? r.alias : typeof r.name == "string" && r.name.length > 0 ? r.name : void 0);
|
|
822
|
-
if (!c)
|
|
823
|
-
throw new Error(`Aggregate groupByColumns[${s}] has no output key`);
|
|
824
|
-
return [n, r.alias, r.name, c].forEach((h) => {
|
|
825
|
-
typeof h == "string" && h.length > 0 && t.set(h, c);
|
|
826
|
-
}), c;
|
|
827
|
-
}), o = (e.rowAggregates ?? []).flatMap((r) => !$(r) || typeof r.function != "string" || typeof r.groupLevel != "string" ? [] : [
|
|
828
|
-
{
|
|
829
|
-
function: r.function,
|
|
830
|
-
groupLevel: r.groupLevel === "ALL" ? "ALL" : t.get(r.groupLevel) || r.groupLevel,
|
|
831
|
-
...typeof r.label == "string" ? { label: r.label } : {}
|
|
832
|
-
}
|
|
833
|
-
]);
|
|
834
|
-
return { groupColumnKeys: a, rowAggregates: o };
|
|
835
|
-
}
|
|
836
|
-
function re(e) {
|
|
837
|
-
return e === "SUM" ? "Total" : e.charAt(0).toUpperCase() + e.slice(1).toLowerCase();
|
|
838
|
-
}
|
|
839
|
-
function it(e) {
|
|
840
|
-
var a;
|
|
841
|
-
if (e.customLabel) return e.customLabel;
|
|
842
|
-
const t = re(e.aggregateFunction);
|
|
843
|
-
if (e.levelValue !== void 0 && !D(e.levelValue)) {
|
|
844
|
-
if (e.levelValue === null) {
|
|
845
|
-
const r = (a = e.formatValue) == null ? void 0 : a.call(e, null);
|
|
846
|
-
return r ? `Subtotal ${r}` : `Subtotal ${t}`;
|
|
847
|
-
}
|
|
848
|
-
const o = e.formatValue ? e.formatValue(e.levelValue) : String(e.levelValue);
|
|
849
|
-
if (o) return `Subtotal (${o})`;
|
|
850
|
-
}
|
|
851
|
-
return `Subtotal ${t}`;
|
|
852
|
-
}
|
|
853
|
-
function ut(e, t) {
|
|
854
|
-
return t || `Grand ${re(e)}`;
|
|
855
|
-
}
|
|
856
|
-
function Bt(e) {
|
|
857
|
-
const t = e.context.groupColumnKeys.indexOf(e.columnKey);
|
|
858
|
-
if (t < 0)
|
|
859
|
-
throw new Error(
|
|
860
|
-
`Aggregate group column "${e.columnKey}" is unknown`
|
|
861
|
-
);
|
|
862
|
-
return _e({
|
|
863
|
-
row: e.row,
|
|
864
|
-
previousRow: e.previousRow,
|
|
865
|
-
levelIndex: t,
|
|
866
|
-
getValue: (a, o) => a[e.context.groupColumnKeys[o]]
|
|
867
|
-
});
|
|
868
|
-
}
|
|
869
|
-
function ae(e) {
|
|
870
|
-
var o, r;
|
|
871
|
-
const t = e.context.groupColumnKeys, a = typeof e.row.aggregate == "string" ? e.row.aggregate : "SUM";
|
|
872
|
-
if (e.row.isGrandTotal === !0) {
|
|
873
|
-
const s = (o = e.context.rowAggregates.find(
|
|
874
|
-
(n) => n.groupLevel === "ALL"
|
|
875
|
-
)) == null ? void 0 : o.label;
|
|
876
|
-
return {
|
|
877
|
-
kind: "grand-total",
|
|
878
|
-
cells: t.map((n, l) => ({
|
|
879
|
-
columnKey: n,
|
|
880
|
-
text: l === 0 ? ut(a, s) : "",
|
|
881
|
-
placement: l === 0 ? "label" : "empty",
|
|
882
|
-
colSpan: l === 0 ? t.length : 1
|
|
883
|
-
}))
|
|
884
|
-
};
|
|
885
|
-
}
|
|
886
|
-
if (e.row.isSubtotal === !0) {
|
|
887
|
-
if (typeof e.row.subtotalLevel != "string")
|
|
888
|
-
throw new Error("Aggregate subtotal row is missing subtotalLevel");
|
|
889
|
-
const s = t.indexOf(e.row.subtotalLevel);
|
|
890
|
-
if (s < 0)
|
|
891
|
-
throw new Error(
|
|
892
|
-
`Aggregate subtotal level "${e.row.subtotalLevel}" has no group column`
|
|
893
|
-
);
|
|
894
|
-
const n = $(e.row.subtotalContext) ? e.row.subtotalContext : void 0, l = $(n == null ? void 0 : n.groupByValues) ? n.groupByValues : {}, c = (r = e.context.rowAggregates.find(
|
|
895
|
-
(i) => i.groupLevel === e.row.subtotalLevel && i.function === a
|
|
896
|
-
)) == null ? void 0 : r.label;
|
|
897
|
-
return {
|
|
898
|
-
kind: "subtotal",
|
|
899
|
-
cells: t.map((i, g) => {
|
|
900
|
-
if (g > s)
|
|
901
|
-
return {
|
|
902
|
-
columnKey: i,
|
|
903
|
-
text: "",
|
|
904
|
-
placement: "empty",
|
|
905
|
-
colSpan: 1
|
|
906
|
-
};
|
|
907
|
-
if (g < s) {
|
|
908
|
-
const f = e.row[i];
|
|
909
|
-
return {
|
|
910
|
-
columnKey: i,
|
|
911
|
-
text: f === void 0 || D(f) ? "" : e.formatValue(f, i),
|
|
912
|
-
placement: "value",
|
|
913
|
-
colSpan: 1
|
|
914
|
-
};
|
|
915
|
-
}
|
|
916
|
-
return {
|
|
917
|
-
columnKey: i,
|
|
918
|
-
text: it({
|
|
919
|
-
aggregateFunction: a,
|
|
920
|
-
customLabel: c,
|
|
921
|
-
levelValue: l[i],
|
|
922
|
-
formatValue: (f) => e.formatLabelValue ? e.formatLabelValue(f, i) : String(e.formatValue(f, i) ?? "")
|
|
923
|
-
}),
|
|
924
|
-
placement: "label",
|
|
925
|
-
colSpan: t.length - s
|
|
926
|
-
};
|
|
927
|
-
})
|
|
928
|
-
};
|
|
929
|
-
}
|
|
930
|
-
return {
|
|
931
|
-
kind: "data",
|
|
932
|
-
cells: t.map((s) => {
|
|
933
|
-
const n = e.row[s];
|
|
934
|
-
return {
|
|
935
|
-
columnKey: s,
|
|
936
|
-
text: n === void 0 || D(n) ? "" : e.formatValue(n, s),
|
|
937
|
-
placement: "value",
|
|
938
|
-
colSpan: 1
|
|
939
|
-
};
|
|
940
|
-
})
|
|
941
|
-
};
|
|
942
|
-
}
|
|
943
|
-
function zt(e) {
|
|
944
|
-
const t = ae(e).cells.find(
|
|
945
|
-
(a) => a.columnKey === e.columnKey
|
|
946
|
-
);
|
|
947
|
-
if (!t)
|
|
948
|
-
throw new Error(`Aggregate group column "${e.columnKey}" is unknown`);
|
|
949
|
-
return t.text;
|
|
950
|
-
}
|
|
951
|
-
function jt(e) {
|
|
952
|
-
return ae(e).cells.map((t) => t.text);
|
|
953
|
-
}
|
|
954
|
-
export {
|
|
955
|
-
lt as A,
|
|
956
|
-
D as B,
|
|
957
|
-
Ot as C,
|
|
958
|
-
Me as D,
|
|
959
|
-
it as E,
|
|
960
|
-
Ct as F,
|
|
961
|
-
ut as G,
|
|
962
|
-
Bt as H,
|
|
963
|
-
ae as I,
|
|
964
|
-
zt as J,
|
|
965
|
-
jt as K,
|
|
966
|
-
_e as L,
|
|
967
|
-
Mt as M,
|
|
968
|
-
st as N,
|
|
969
|
-
Pe as P,
|
|
970
|
-
St as a,
|
|
971
|
-
At as b,
|
|
972
|
-
kt as c,
|
|
973
|
-
_t as d,
|
|
974
|
-
De as e,
|
|
975
|
-
Ut as f,
|
|
976
|
-
It as g,
|
|
977
|
-
Et as h,
|
|
978
|
-
xt as i,
|
|
979
|
-
Ae as j,
|
|
980
|
-
$e as k,
|
|
981
|
-
xe as l,
|
|
982
|
-
Pt as m,
|
|
983
|
-
Fe as n,
|
|
984
|
-
Ne as o,
|
|
985
|
-
Ie as p,
|
|
986
|
-
Dt as q,
|
|
987
|
-
$t as r,
|
|
988
|
-
Rt as s,
|
|
989
|
-
Ft as t,
|
|
990
|
-
z as u,
|
|
991
|
-
ze as v,
|
|
992
|
-
et as w,
|
|
993
|
-
j as x,
|
|
994
|
-
Nt as y,
|
|
995
|
-
Vt as z
|
|
996
|
-
};
|