react-semaphor 0.1.474 → 0.1.476
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/brand-studio/index.cjs +1 -1
- package/dist/brand-studio/index.js +1 -1
- package/dist/briefings/index.cjs +1 -1
- package/dist/briefings/index.js +20 -20
- package/dist/chunks/{dashboard-briefing-launcher-BjCkA5vw.cjs → dashboard-briefing-launcher-ZfuxdRN2.cjs} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-B0f28WrK.js → dashboard-briefing-launcher-eBsB9kr8.js} +5 -5
- package/dist/chunks/{dashboard-controls-CMJqSLgo.js → dashboard-controls-BX6p6z8a.js} +5 -5
- package/dist/chunks/{dashboard-controls-BRclCQEX.cjs → dashboard-controls-DwjEc7sO.cjs} +1 -1
- package/dist/chunks/dashboard-filter-value-compatibility-BCVF9IHg.js +1026 -0
- package/dist/chunks/dashboard-filter-value-compatibility-DLkdeypb.cjs +1 -0
- package/dist/chunks/{dashboard-json-1ohpjO_q.js → dashboard-json-BfgitBXc.js} +3 -3
- package/dist/chunks/{dashboard-json-DmtGHdDq.cjs → dashboard-json-CdwYFOsc.cjs} +1 -1
- package/dist/chunks/{edit-dashboard-visual-DNqJHdHE.cjs → edit-dashboard-visual-Cbougpzc.cjs} +1 -1
- package/dist/chunks/{edit-dashboard-visual-D9oKtOo6.js → edit-dashboard-visual-D80DLF7C.js} +6 -6
- package/dist/chunks/{editor-action-buttons-DwI3FcSw.cjs → editor-action-buttons-BDRLfaW-.cjs} +1 -1
- package/dist/chunks/{editor-action-buttons-C_B8Wzkf.js → editor-action-buttons-DjsEDQok.js} +3 -3
- package/dist/chunks/index-CneWIz__.cjs +1404 -0
- package/dist/chunks/{index-DsvIlrI-.js → index-D9S3j7_z.js} +532 -463
- package/dist/chunks/{index-DalKzjEZ.js → index-Dv5hbC1r.js} +40833 -40225
- package/dist/chunks/index-v2MZLyus.cjs +4 -0
- package/dist/chunks/{pivot-header-presentation-Be3FyR0N.js → pivot-header-presentation-CaERAWpl.js} +144 -128
- package/dist/chunks/pivot-header-presentation-CePk1R6g.cjs +4 -0
- package/dist/chunks/{pivot-result-lifecycle-PxmbJWkm.js → pivot-result-lifecycle-B9FTybxN.js} +176 -165
- package/dist/chunks/pivot-result-lifecycle-CcGt_29N.cjs +1 -0
- package/dist/chunks/{report-preferences-dialog-C9mJffNQ.js → report-preferences-dialog-BXBlvW79.js} +2 -2
- package/dist/chunks/{report-preferences-dialog-DGMd-eTT.cjs → report-preferences-dialog-cSMJYqns.cjs} +1 -1
- package/dist/chunks/switch-B1mZx2k9.cjs +138 -0
- package/dist/chunks/{switch-D20CIzj6.js → switch-C8NihGV4.js} +3326 -3318
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.cjs +3 -3
- package/dist/dashboard-authoring/index.js +298 -287
- package/dist/data-app-builder/index.cjs +1 -1
- package/dist/data-app-builder/index.js +2 -2
- package/dist/format-utils/index.cjs +3 -3
- package/dist/format-utils/index.js +92 -82
- package/dist/index.cjs +1 -1
- package/dist/index.js +6 -6
- package/dist/pdf-export-policy/index.cjs +1 -0
- package/dist/pdf-export-policy/index.js +32 -0
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/briefings.d.ts +13 -1
- package/dist/types/dashboard-assistant.d.ts +2 -0
- package/dist/types/dashboard-authoring.d.ts +13 -1
- package/dist/types/dashboard.d.ts +19 -1
- package/dist/types/format-utils.d.ts +46 -0
- package/dist/types/main.d.ts +19 -1
- package/dist/types/pdf-export-policy.d.ts +28 -0
- package/dist/types/shared.d.ts +13 -1
- package/dist/types/surfboard.d.ts +19 -1
- package/dist/types/types.d.ts +19 -1
- package/package.json +6 -1
- package/dist/chunks/dashboard-filter-value-compatibility-9W8Ckcle.js +0 -846
- package/dist/chunks/dashboard-filter-value-compatibility-Co1dn9Bc.cjs +0 -1
- package/dist/chunks/index-B4VxBoJg.cjs +0 -4
- package/dist/chunks/index-B6zSYUN4.cjs +0 -1404
- package/dist/chunks/pivot-header-presentation-Cr6pU5JL.cjs +0 -4
- package/dist/chunks/pivot-result-lifecycle-DJgO2P0H.cjs +0 -1
- package/dist/chunks/switch-B4eH4guz.cjs +0 -138
package/dist/chunks/{pivot-header-presentation-Be3FyR0N.js → pivot-header-presentation-CaERAWpl.js}
RENAMED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var A = (e, t, n) =>
|
|
4
|
-
import { t as f, c as U, g as O, e as P, a as T, m as S, b as M, i as
|
|
5
|
-
import { b as y } from "./pivot-result-lifecycle-
|
|
1
|
+
var R = Object.defineProperty;
|
|
2
|
+
var F = (e, t, n) => t in e ? R(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var A = (e, t, n) => F(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { t as f, c as U, g as O, e as P, a as T, m as S, b as M, i as k, f as Z, d as X } from "./format-types-CFHQoIuk.js";
|
|
5
|
+
import { b as y } from "./pivot-result-lifecycle-B9FTybxN.js";
|
|
6
6
|
import { f as B } from "./index-CACdoqu3.js";
|
|
7
|
-
import { h as
|
|
8
|
-
function
|
|
7
|
+
import { h as G } from "./temporal-bucket-CtP7hKLa.js";
|
|
8
|
+
function w(e, t) {
|
|
9
9
|
const n = f(e), o = f(t), r = n.getTime() - o.getTime();
|
|
10
10
|
return r < 0 ? -1 : r > 0 ? 1 : r;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function j(e) {
|
|
13
13
|
return U(e, Date.now());
|
|
14
14
|
}
|
|
15
15
|
function H(e, t) {
|
|
@@ -22,23 +22,23 @@ function Y(e) {
|
|
|
22
22
|
return o === 0 ? 0 : o;
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function K(e, t) {
|
|
26
26
|
return +f(e) - +f(t);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function W(e) {
|
|
29
29
|
const t = f(e);
|
|
30
30
|
return t.setHours(23, 59, 59, 999), t;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function q(e) {
|
|
33
33
|
const t = f(e), n = t.getMonth();
|
|
34
34
|
return t.setFullYear(t.getFullYear(), n + 1, 0), t.setHours(23, 59, 59, 999), t;
|
|
35
35
|
}
|
|
36
36
|
function J(e) {
|
|
37
37
|
const t = f(e);
|
|
38
|
-
return +
|
|
38
|
+
return +W(t) == +q(t);
|
|
39
39
|
}
|
|
40
40
|
function Q(e, t) {
|
|
41
|
-
const n = f(e), o = f(t), r =
|
|
41
|
+
const n = f(e), o = f(t), r = w(n, o), s = Math.abs(
|
|
42
42
|
H(n, o)
|
|
43
43
|
);
|
|
44
44
|
let i;
|
|
@@ -46,63 +46,63 @@ function Q(e, t) {
|
|
|
46
46
|
i = 0;
|
|
47
47
|
else {
|
|
48
48
|
n.getMonth() === 1 && n.getDate() > 27 && n.setDate(30), n.setMonth(n.getMonth() - r * s);
|
|
49
|
-
let a =
|
|
50
|
-
J(f(e)) && s === 1 &&
|
|
49
|
+
let a = w(n, o) === -r;
|
|
50
|
+
J(f(e)) && s === 1 && w(e, o) === 1 && (a = !1), i = r * (s - Number(a));
|
|
51
51
|
}
|
|
52
52
|
return i === 0 ? 0 : i;
|
|
53
53
|
}
|
|
54
54
|
function z(e, t, n) {
|
|
55
|
-
const o =
|
|
55
|
+
const o = K(e, t) / 1e3;
|
|
56
56
|
return Y(n == null ? void 0 : n.roundingMethod)(o);
|
|
57
57
|
}
|
|
58
58
|
function ee(e, t, n) {
|
|
59
|
-
const o = O(), r = (n == null ? void 0 : n.locale) ?? o.locale ?? P, s = 2520, i =
|
|
59
|
+
const o = O(), r = (n == null ? void 0 : n.locale) ?? o.locale ?? P, s = 2520, i = w(e, t);
|
|
60
60
|
if (isNaN(i))
|
|
61
61
|
throw new RangeError("Invalid time value");
|
|
62
62
|
const a = Object.assign({}, n, {
|
|
63
63
|
addSuffix: n == null ? void 0 : n.addSuffix,
|
|
64
64
|
comparison: i
|
|
65
65
|
});
|
|
66
|
-
let
|
|
67
|
-
i > 0 ? (
|
|
68
|
-
const
|
|
66
|
+
let l, c;
|
|
67
|
+
i > 0 ? (l = f(t), c = f(e)) : (l = f(e), c = f(t));
|
|
68
|
+
const g = z(c, l), m = (T(c) - T(l)) / 1e3, u = Math.round((g - m) / 60);
|
|
69
69
|
let h;
|
|
70
70
|
if (u < 2)
|
|
71
|
-
return n != null && n.includeSeconds ?
|
|
71
|
+
return n != null && n.includeSeconds ? g < 5 ? r.formatDistance("lessThanXSeconds", 5, a) : g < 10 ? r.formatDistance("lessThanXSeconds", 10, a) : g < 20 ? r.formatDistance("lessThanXSeconds", 20, a) : g < 40 ? r.formatDistance("halfAMinute", 0, a) : g < 60 ? r.formatDistance("lessThanXMinutes", 1, a) : r.formatDistance("xMinutes", 1, a) : u === 0 ? r.formatDistance("lessThanXMinutes", 1, a) : r.formatDistance("xMinutes", u, a);
|
|
72
72
|
if (u < 45)
|
|
73
73
|
return r.formatDistance("xMinutes", u, a);
|
|
74
74
|
if (u < 90)
|
|
75
75
|
return r.formatDistance("aboutXHours", 1, a);
|
|
76
76
|
if (u < S) {
|
|
77
|
-
const
|
|
78
|
-
return r.formatDistance("aboutXHours",
|
|
77
|
+
const d = Math.round(u / 60);
|
|
78
|
+
return r.formatDistance("aboutXHours", d, a);
|
|
79
79
|
} else {
|
|
80
80
|
if (u < s)
|
|
81
81
|
return r.formatDistance("xDays", 1, a);
|
|
82
82
|
if (u < M) {
|
|
83
|
-
const
|
|
84
|
-
return r.formatDistance("xDays",
|
|
83
|
+
const d = Math.round(u / S);
|
|
84
|
+
return r.formatDistance("xDays", d, a);
|
|
85
85
|
} else if (u < M * 2)
|
|
86
86
|
return h = Math.round(u / M), r.formatDistance("aboutXMonths", h, a);
|
|
87
87
|
}
|
|
88
|
-
if (h = Q(
|
|
89
|
-
const
|
|
90
|
-
return r.formatDistance("xMonths",
|
|
88
|
+
if (h = Q(c, l), h < 12) {
|
|
89
|
+
const d = Math.round(u / M);
|
|
90
|
+
return r.formatDistance("xMonths", d, a);
|
|
91
91
|
} else {
|
|
92
|
-
const
|
|
93
|
-
return
|
|
92
|
+
const d = h % 12, D = Math.trunc(h / 12);
|
|
93
|
+
return d < 3 ? r.formatDistance("aboutXYears", D, a) : d < 9 ? r.formatDistance("overXYears", D, a) : r.formatDistance("almostXYears", D + 1, a);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
function te(e, t) {
|
|
97
|
-
return ee(e,
|
|
97
|
+
return ee(e, j(e), t);
|
|
98
98
|
}
|
|
99
|
-
const
|
|
99
|
+
const I = [
|
|
100
100
|
"day",
|
|
101
101
|
"hour",
|
|
102
102
|
"minute",
|
|
103
103
|
"second",
|
|
104
104
|
"millisecond"
|
|
105
|
-
],
|
|
105
|
+
], L = {
|
|
106
106
|
day: 864e5,
|
|
107
107
|
hour: 36e5,
|
|
108
108
|
minute: 6e4,
|
|
@@ -127,29 +127,29 @@ function oe(e) {
|
|
|
127
127
|
function V(e, t) {
|
|
128
128
|
return oe(e) ? e : t;
|
|
129
129
|
}
|
|
130
|
-
function
|
|
131
|
-
return
|
|
130
|
+
function v(e, t) {
|
|
131
|
+
return I.indexOf(V(e, t));
|
|
132
132
|
}
|
|
133
133
|
function se(e, t) {
|
|
134
|
-
const n =
|
|
135
|
-
return
|
|
134
|
+
const n = v(e, "day"), o = v(t, "second"), r = Math.min(n, o), s = Math.max(n, o);
|
|
135
|
+
return I.slice(r, s + 1);
|
|
136
136
|
}
|
|
137
137
|
function ae(e, t) {
|
|
138
|
-
return e *
|
|
138
|
+
return e * L[V(t, "second")];
|
|
139
139
|
}
|
|
140
140
|
function ie(e, t) {
|
|
141
|
-
const n = se(t.largestUnit, t.smallestUnit), o = n[n.length - 1], r =
|
|
141
|
+
const n = se(t.largestUnit, t.smallestUnit), o = n[n.length - 1], r = L[o];
|
|
142
142
|
let s = Math.round(e / r) * r;
|
|
143
143
|
return n.map((i) => {
|
|
144
|
-
const a =
|
|
145
|
-
return s -=
|
|
144
|
+
const a = L[i], l = Math.floor(s / a);
|
|
145
|
+
return s -= l * a, { unit: i, value: l };
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function le(e, t) {
|
|
149
149
|
const n = e.filter((s) => s.value !== 0), o = n.length > 0 ? n : [e[e.length - 1]], r = typeof t == "number" && Number.isFinite(t) ? Math.max(1, Math.trunc(t)) : o.length;
|
|
150
150
|
return o.slice(0, r).map((s) => `${s.value}${ne[s.unit]}`).join(" ");
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function ce(e, t) {
|
|
153
153
|
const n = e.filter((s) => s.value !== 0), o = n.length > 0 ? n : [e[e.length - 1]], r = typeof t == "number" && Number.isFinite(t) ? Math.max(1, Math.trunc(t)) : o.length;
|
|
154
154
|
return o.slice(0, r).map((s) => {
|
|
155
155
|
const [i, a] = re[s.unit];
|
|
@@ -158,11 +158,11 @@ function le(e, t) {
|
|
|
158
158
|
}
|
|
159
159
|
function ue(e) {
|
|
160
160
|
const t = e.some(
|
|
161
|
-
(
|
|
162
|
-
), n = e.some((
|
|
161
|
+
(l) => l.unit === "day" && l.value !== 0
|
|
162
|
+
), n = e.some((l) => l.unit === "millisecond"), o = e.findIndex((l) => l.value !== 0), r = Math.max(0, e.length - 2), s = t ? 0 : o === -1 ? r : Math.min(o, r), i = o === -1 ? e.slice(r) : e.slice(s);
|
|
163
163
|
if (i.length === 0)
|
|
164
164
|
return "0";
|
|
165
|
-
const a = i.map((
|
|
165
|
+
const a = i.map((l, c) => l.unit === "millisecond" ? String(l.value).padStart(3, "0") : c === 0 ? String(l.value) : String(l.value).padStart(2, "0")).join(":");
|
|
166
166
|
return n ? a.replace(/:(\d{3})$/, ".$1") : a;
|
|
167
167
|
}
|
|
168
168
|
function fe(e, t, n) {
|
|
@@ -175,10 +175,10 @@ function me(e, t = {}) {
|
|
|
175
175
|
const n = typeof e == "number" ? e : typeof e == "string" && e.trim() ? Number(e) : NaN;
|
|
176
176
|
if (!Number.isFinite(n))
|
|
177
177
|
return "";
|
|
178
|
-
const o = t.inputUnit || "second", r = t.outputStyle === "digital" || t.outputStyle === "long" ? t.outputStyle : "compact", s = n < 0, i = Math.abs(ae(n, o)), a = ie(i, t),
|
|
179
|
-
return fe(
|
|
178
|
+
const o = t.inputUnit || "second", r = t.outputStyle === "digital" || t.outputStyle === "long" ? t.outputStyle : "compact", s = n < 0, i = Math.abs(ae(n, o)), a = ie(i, t), l = r === "digital" ? ue(a) : r === "long" ? ce(a, t.maxUnits) : le(a, t.maxUnits);
|
|
179
|
+
return fe(l, s, t);
|
|
180
180
|
}
|
|
181
|
-
function
|
|
181
|
+
function ge(e, t, n) {
|
|
182
182
|
const o = {
|
|
183
183
|
...t,
|
|
184
184
|
locale: t.locale ?? n
|
|
@@ -191,8 +191,8 @@ function de(e, t, n) {
|
|
|
191
191
|
negativeStyle: o.type === "currency" ? o.negativeStyle : "minus"
|
|
192
192
|
})}${s ?? ""}`;
|
|
193
193
|
}
|
|
194
|
-
function
|
|
195
|
-
return e === null ? { value: e, text: null } : !t || !
|
|
194
|
+
function x(e, t, n) {
|
|
195
|
+
return e === null ? { value: e, text: null } : !t || !k(t) && t.type !== "duration" ? {
|
|
196
196
|
value: e,
|
|
197
197
|
text: y(e, { type: "number", locale: n })
|
|
198
198
|
} : t.type === "duration" ? {
|
|
@@ -207,9 +207,9 @@ function L(e, t, n) {
|
|
|
207
207
|
suffix: t.suffix,
|
|
208
208
|
negativeInParentheses: t.negativeStyle === "parentheses"
|
|
209
209
|
})
|
|
210
|
-
} : { value: e, text:
|
|
210
|
+
} : { value: e, text: ge(e, t, n) };
|
|
211
211
|
}
|
|
212
|
-
function
|
|
212
|
+
function _(e, t, n, o) {
|
|
213
213
|
return e === null ? { value: e, text: null } : o === "percent" ? {
|
|
214
214
|
value: e,
|
|
215
215
|
text: y(e, {
|
|
@@ -230,46 +230,46 @@ function v(e, t, n, o) {
|
|
|
230
230
|
})
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
|
-
function
|
|
233
|
+
function C(e, t) {
|
|
234
234
|
if (e === void 0) return t;
|
|
235
235
|
if (!Number.isInteger(e) || e < 0 || e > 6)
|
|
236
236
|
throw new RangeError("Comparison precision must be an integer from 0 to 6.");
|
|
237
237
|
return e;
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function _e(e, t) {
|
|
240
240
|
const n = {
|
|
241
241
|
mode: t.displayMode,
|
|
242
|
-
current:
|
|
242
|
+
current: x(
|
|
243
243
|
e.currentValue,
|
|
244
244
|
t.metricFormat,
|
|
245
245
|
t.locale
|
|
246
246
|
),
|
|
247
|
-
comparison:
|
|
247
|
+
comparison: x(
|
|
248
248
|
e.comparisonValue,
|
|
249
249
|
t.metricFormat,
|
|
250
250
|
t.locale
|
|
251
251
|
)
|
|
252
252
|
};
|
|
253
|
-
return (t.displayMode === "difference" || t.displayMode === "both") && (n.difference =
|
|
253
|
+
return (t.displayMode === "difference" || t.displayMode === "both") && (n.difference = x(
|
|
254
254
|
e.delta,
|
|
255
255
|
t.metricFormat,
|
|
256
256
|
t.locale
|
|
257
|
-
)), (t.displayMode === "percent_change" || t.displayMode === "both") && (n.percentChange =
|
|
257
|
+
)), (t.displayMode === "percent_change" || t.displayMode === "both") && (n.percentChange = _(
|
|
258
258
|
e.percentChange,
|
|
259
|
-
|
|
259
|
+
C(t.precision, 1),
|
|
260
260
|
t.locale,
|
|
261
261
|
"percent"
|
|
262
|
-
)), t.displayMode === "ratio" && (n.ratio =
|
|
262
|
+
)), t.displayMode === "ratio" && (n.ratio = _(
|
|
263
263
|
e.ratio,
|
|
264
|
-
|
|
264
|
+
C(t.precision, 2),
|
|
265
265
|
t.locale,
|
|
266
266
|
"ratio"
|
|
267
267
|
)), n;
|
|
268
268
|
}
|
|
269
|
-
function
|
|
269
|
+
function Ce(e, t) {
|
|
270
270
|
return e && e !== "auto" ? e : t;
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function Ie(e, t = /* @__PURE__ */ new Date()) {
|
|
273
273
|
try {
|
|
274
274
|
const n = {
|
|
275
275
|
timeZone: e,
|
|
@@ -293,7 +293,7 @@ function Ve(e) {
|
|
|
293
293
|
return e;
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
|
-
function
|
|
296
|
+
function N(e, t = "auto") {
|
|
297
297
|
if (!e)
|
|
298
298
|
return /* @__PURE__ */ new Date(NaN);
|
|
299
299
|
const n = e.endsWith("Z"), o = /[+-]\d{2}:?\d{2}$/.test(e), r = /\([A-Z]{3,4}\)$/.test(e);
|
|
@@ -307,15 +307,15 @@ function C(e, t = "auto") {
|
|
|
307
307
|
return new Date(e);
|
|
308
308
|
} else return t === "UTC" ? n ? new Date(e) : o ? new Date(e) : /* @__PURE__ */ new Date(e + "Z") : n || o || r ? new Date(e) : B(e, t);
|
|
309
309
|
}
|
|
310
|
-
const
|
|
310
|
+
const de = "MM/dd/yyyy", Ne = (e, t, n, o = "auto") => {
|
|
311
311
|
if (!e)
|
|
312
312
|
return "";
|
|
313
313
|
try {
|
|
314
|
-
const r =
|
|
314
|
+
const r = N(e, o);
|
|
315
315
|
if (isNaN(r.getTime()))
|
|
316
316
|
return e;
|
|
317
|
-
const i = (t && t.trim() ? t :
|
|
318
|
-
return n && n !== "auto" ?
|
|
317
|
+
const i = (t && t.trim() ? t : de).replace(/LLLL/g, "MMMM").replace(/LLL/g, "MMM");
|
|
318
|
+
return n && n !== "auto" ? Z(r, n, i) : X(r, i);
|
|
319
319
|
} catch (r) {
|
|
320
320
|
return console.error("Date formatting error:", r), e;
|
|
321
321
|
}
|
|
@@ -323,7 +323,7 @@ const ge = "MM/dd/yyyy", Ce = (e, t, n, o = "auto") => {
|
|
|
323
323
|
if (!e)
|
|
324
324
|
return "";
|
|
325
325
|
try {
|
|
326
|
-
const n =
|
|
326
|
+
const n = N(e, t);
|
|
327
327
|
return isNaN(n.getTime()) ? e : te(n, { addSuffix: !0 });
|
|
328
328
|
} catch (n) {
|
|
329
329
|
return console.error("Relative time formatting error:", n), e;
|
|
@@ -355,38 +355,38 @@ function Ee(e, t = {}) {
|
|
|
355
355
|
columns: s
|
|
356
356
|
} = t, i = s || Object.keys(e[0]), a = [];
|
|
357
357
|
r && a.push(i);
|
|
358
|
-
for (const
|
|
359
|
-
const
|
|
360
|
-
const m =
|
|
358
|
+
for (const l of e) {
|
|
359
|
+
const c = i.map((g) => {
|
|
360
|
+
const m = l[g];
|
|
361
361
|
return m == null ? "" : String(m);
|
|
362
362
|
});
|
|
363
|
-
a.push(
|
|
363
|
+
a.push(c);
|
|
364
364
|
}
|
|
365
365
|
return Me(a, { delimiter: n, lineEnding: o });
|
|
366
366
|
}
|
|
367
|
-
const
|
|
368
|
-
function
|
|
369
|
-
return e >
|
|
367
|
+
const we = 1e4, Re = 1e6;
|
|
368
|
+
function Fe(e) {
|
|
369
|
+
return e > we;
|
|
370
370
|
}
|
|
371
|
-
const
|
|
372
|
-
function
|
|
371
|
+
const be = "__TOTAL__";
|
|
372
|
+
function b(e) {
|
|
373
373
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
374
374
|
}
|
|
375
|
-
function
|
|
376
|
-
return e ===
|
|
375
|
+
function p(e) {
|
|
376
|
+
return e === be;
|
|
377
377
|
}
|
|
378
378
|
function Ue(e) {
|
|
379
379
|
const t = /* @__PURE__ */ new Map(), n = (e.groupByColumns ?? []).map((r, s) => {
|
|
380
|
-
var
|
|
381
|
-
if (!
|
|
380
|
+
var c, g, m;
|
|
381
|
+
if (!b(r))
|
|
382
382
|
throw new Error(`Aggregate groupByColumns[${s}] is invalid`);
|
|
383
|
-
const i = typeof r.id == "string" && r.id.length > 0 ? r.id : void 0, a = i ? (m = (
|
|
384
|
-
if (!
|
|
383
|
+
const i = typeof r.id == "string" && r.id.length > 0 ? r.id : void 0, a = i ? (m = (g = (c = e.columnKeyMap) == null ? void 0 : c.byRole) == null ? void 0 : g.groupby) == null ? void 0 : m[i] : void 0, l = (a == null ? void 0 : a.outputKey) || (a == null ? void 0 : a.rawKey) || (typeof r.alias == "string" && r.alias.length > 0 ? r.alias : typeof r.name == "string" && r.name.length > 0 ? r.name : void 0);
|
|
384
|
+
if (!l)
|
|
385
385
|
throw new Error(`Aggregate groupByColumns[${s}] has no output key`);
|
|
386
|
-
return [i, r.alias, r.name,
|
|
387
|
-
typeof u == "string" && u.length > 0 && t.set(u,
|
|
388
|
-
}),
|
|
389
|
-
}), o = (e.rowAggregates ?? []).flatMap((r) => !
|
|
386
|
+
return [i, r.alias, r.name, l].forEach((u) => {
|
|
387
|
+
typeof u == "string" && u.length > 0 && t.set(u, l);
|
|
388
|
+
}), l;
|
|
389
|
+
}), o = (e.rowAggregates ?? []).flatMap((r) => !b(r) || typeof r.function != "string" || typeof r.groupLevel != "string" ? [] : [
|
|
390
390
|
{
|
|
391
391
|
function: r.function,
|
|
392
392
|
groupLevel: r.groupLevel === "ALL" ? "ALL" : t.get(r.groupLevel) || r.groupLevel,
|
|
@@ -398,11 +398,11 @@ function Ue(e) {
|
|
|
398
398
|
function $(e) {
|
|
399
399
|
return e === "SUM" ? "Total" : e.charAt(0).toUpperCase() + e.slice(1).toLowerCase();
|
|
400
400
|
}
|
|
401
|
-
function
|
|
401
|
+
function De(e) {
|
|
402
402
|
var n;
|
|
403
403
|
if (e.customLabel) return e.customLabel;
|
|
404
404
|
const t = $(e.aggregateFunction);
|
|
405
|
-
if (e.levelValue !== void 0 && !
|
|
405
|
+
if (e.levelValue !== void 0 && !p(e.levelValue)) {
|
|
406
406
|
if (e.levelValue === null) {
|
|
407
407
|
const r = (n = e.formatValue) == null ? void 0 : n.call(e, null);
|
|
408
408
|
return r ? `Subtotal ${r}` : `Subtotal ${t}`;
|
|
@@ -412,9 +412,24 @@ function we(e) {
|
|
|
412
412
|
}
|
|
413
413
|
return `Subtotal ${t}`;
|
|
414
414
|
}
|
|
415
|
-
function
|
|
415
|
+
function xe(e, t) {
|
|
416
416
|
return t || `Grand ${$(e)}`;
|
|
417
417
|
}
|
|
418
|
+
function Oe(e) {
|
|
419
|
+
const t = e.context.groupColumnKeys.indexOf(e.columnKey);
|
|
420
|
+
if (t < 0)
|
|
421
|
+
throw new Error(
|
|
422
|
+
`Aggregate group column "${e.columnKey}" is unknown`
|
|
423
|
+
);
|
|
424
|
+
if (!e.previousRow || e.row.isSubtotal === !0 || e.row.isGrandTotal === !0 || e.previousRow.isSubtotal === !0 || e.previousRow.isGrandTotal === !0)
|
|
425
|
+
return !0;
|
|
426
|
+
for (let n = 0; n <= t; n++) {
|
|
427
|
+
const o = e.context.groupColumnKeys[n];
|
|
428
|
+
if (e.row[o] !== e.previousRow[o])
|
|
429
|
+
return !0;
|
|
430
|
+
}
|
|
431
|
+
return !1;
|
|
432
|
+
}
|
|
418
433
|
function E(e) {
|
|
419
434
|
var o, r;
|
|
420
435
|
const t = e.context.groupColumnKeys, n = typeof e.row.aggregate == "string" ? e.row.aggregate : "SUM";
|
|
@@ -426,7 +441,7 @@ function E(e) {
|
|
|
426
441
|
kind: "grand-total",
|
|
427
442
|
cells: t.map((i, a) => ({
|
|
428
443
|
columnKey: i,
|
|
429
|
-
text: a === 0 ?
|
|
444
|
+
text: a === 0 ? xe(n, s) : "",
|
|
430
445
|
placement: a === 0 ? "label" : "empty",
|
|
431
446
|
colSpan: a === 0 ? t.length : 1
|
|
432
447
|
}))
|
|
@@ -440,35 +455,35 @@ function E(e) {
|
|
|
440
455
|
throw new Error(
|
|
441
456
|
`Aggregate subtotal level "${e.row.subtotalLevel}" has no group column`
|
|
442
457
|
);
|
|
443
|
-
const i =
|
|
444
|
-
(
|
|
458
|
+
const i = b(e.row.subtotalContext) ? e.row.subtotalContext : void 0, a = b(i == null ? void 0 : i.groupByValues) ? i.groupByValues : {}, l = (r = e.context.rowAggregates.find(
|
|
459
|
+
(c) => c.groupLevel === e.row.subtotalLevel && c.function === n
|
|
445
460
|
)) == null ? void 0 : r.label;
|
|
446
461
|
return {
|
|
447
462
|
kind: "subtotal",
|
|
448
|
-
cells: t.map((
|
|
449
|
-
if (
|
|
463
|
+
cells: t.map((c, g) => {
|
|
464
|
+
if (g > s)
|
|
450
465
|
return {
|
|
451
|
-
columnKey:
|
|
466
|
+
columnKey: c,
|
|
452
467
|
text: "",
|
|
453
468
|
placement: "empty",
|
|
454
469
|
colSpan: 1
|
|
455
470
|
};
|
|
456
|
-
if (
|
|
457
|
-
const m = e.row[
|
|
471
|
+
if (g < s) {
|
|
472
|
+
const m = e.row[c];
|
|
458
473
|
return {
|
|
459
|
-
columnKey:
|
|
460
|
-
text: m === void 0 ||
|
|
474
|
+
columnKey: c,
|
|
475
|
+
text: m === void 0 || p(m) ? "" : e.formatValue(m, c),
|
|
461
476
|
placement: "value",
|
|
462
477
|
colSpan: 1
|
|
463
478
|
};
|
|
464
479
|
}
|
|
465
480
|
return {
|
|
466
|
-
columnKey:
|
|
467
|
-
text:
|
|
481
|
+
columnKey: c,
|
|
482
|
+
text: De({
|
|
468
483
|
aggregateFunction: n,
|
|
469
|
-
customLabel:
|
|
470
|
-
levelValue: a[
|
|
471
|
-
formatValue: (m) => e.formatLabelValue ? e.formatLabelValue(m,
|
|
484
|
+
customLabel: l,
|
|
485
|
+
levelValue: a[c],
|
|
486
|
+
formatValue: (m) => e.formatLabelValue ? e.formatLabelValue(m, c) : String(e.formatValue(m, c) ?? "")
|
|
472
487
|
}),
|
|
473
488
|
placement: "label",
|
|
474
489
|
colSpan: t.length - s
|
|
@@ -482,14 +497,14 @@ function E(e) {
|
|
|
482
497
|
const i = e.row[s];
|
|
483
498
|
return {
|
|
484
499
|
columnKey: s,
|
|
485
|
-
text: i === void 0 ||
|
|
500
|
+
text: i === void 0 || p(i) ? "" : e.formatValue(i, s),
|
|
486
501
|
placement: "value",
|
|
487
502
|
colSpan: 1
|
|
488
503
|
};
|
|
489
504
|
})
|
|
490
505
|
};
|
|
491
506
|
}
|
|
492
|
-
function
|
|
507
|
+
function Pe(e) {
|
|
493
508
|
const t = E(e).cells.find(
|
|
494
509
|
(n) => n.columnKey === e.columnKey
|
|
495
510
|
);
|
|
@@ -497,10 +512,10 @@ function Oe(e) {
|
|
|
497
512
|
throw new Error(`Aggregate group column "${e.columnKey}" is unknown`);
|
|
498
513
|
return t.text;
|
|
499
514
|
}
|
|
500
|
-
function
|
|
515
|
+
function ke(e) {
|
|
501
516
|
return E(e).cells.map((t) => t.text);
|
|
502
517
|
}
|
|
503
|
-
class
|
|
518
|
+
class Le extends Error {
|
|
504
519
|
constructor(n, o) {
|
|
505
520
|
super(`${n}: ${o}`);
|
|
506
521
|
A(this, "deliveryBlocking", !0);
|
|
@@ -515,11 +530,11 @@ function Ze(e) {
|
|
|
515
530
|
return s.value === null ? "" : String(s.value);
|
|
516
531
|
const i = (a = e.resolveTemporalFormat) == null ? void 0 : a.call(e, s.fieldId);
|
|
517
532
|
if (!i)
|
|
518
|
-
throw new
|
|
533
|
+
throw new Le(
|
|
519
534
|
"missing_resolved_temporal_format",
|
|
520
535
|
`Missing resolved temporal presentation for pivot field "${s.fieldId}"`
|
|
521
536
|
);
|
|
522
|
-
return
|
|
537
|
+
return G({
|
|
523
538
|
value: s.value,
|
|
524
539
|
metadata: s.temporalBucket,
|
|
525
540
|
format: i
|
|
@@ -535,30 +550,31 @@ function Ze(e) {
|
|
|
535
550
|
};
|
|
536
551
|
}
|
|
537
552
|
export {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
553
|
+
be as A,
|
|
554
|
+
we as D,
|
|
555
|
+
Re as F,
|
|
556
|
+
Le as P,
|
|
557
|
+
Ne as a,
|
|
543
558
|
ye as b,
|
|
544
559
|
me as c,
|
|
545
|
-
|
|
560
|
+
_e as d,
|
|
546
561
|
he as e,
|
|
547
562
|
$e as f,
|
|
548
|
-
|
|
563
|
+
Ie as g,
|
|
549
564
|
Ve as h,
|
|
550
565
|
Me as i,
|
|
551
|
-
|
|
552
|
-
|
|
566
|
+
Fe as j,
|
|
567
|
+
p as k,
|
|
553
568
|
Ue as l,
|
|
554
|
-
|
|
555
|
-
|
|
569
|
+
De as m,
|
|
570
|
+
xe as n,
|
|
556
571
|
Ee as o,
|
|
557
|
-
|
|
572
|
+
N as p,
|
|
558
573
|
E as q,
|
|
559
|
-
|
|
574
|
+
Ce as r,
|
|
560
575
|
Oe as s,
|
|
561
576
|
Pe as t,
|
|
562
|
-
|
|
563
|
-
|
|
577
|
+
ke as u,
|
|
578
|
+
Ze as v,
|
|
579
|
+
te as w
|
|
564
580
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";var X=Object.defineProperty;var Z=(e,t,r)=>t in e?X(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var x=(e,t,r)=>Z(e,typeof t!="symbol"?t+"":t,r);const c=require("./format-types-PSZZ7hG8.cjs"),M=require("./pivot-result-lifecycle-CcGt_29N.cjs"),B=require("./index-F25jnH0p.cjs"),j=require("./temporal-bucket-9Wz9Ds6H.cjs");function y(e,t){const r=c.toDate(e),o=c.toDate(t),n=r.getTime()-o.getTime();return n<0?-1:n>0?1:n}function H(e){return c.constructFrom(e,Date.now())}function Y(e,t){const r=c.toDate(e),o=c.toDate(t),n=r.getFullYear()-o.getFullYear(),a=r.getMonth()-o.getMonth();return n*12+a}function K(e){return t=>{const o=(e?Math[e]:Math.trunc)(t);return o===0?0:o}}function W(e,t){return+c.toDate(e)-+c.toDate(t)}function q(e){const t=c.toDate(e);return t.setHours(23,59,59,999),t}function J(e){const t=c.toDate(e),r=t.getMonth();return t.setFullYear(t.getFullYear(),r+1,0),t.setHours(23,59,59,999),t}function Q(e){const t=c.toDate(e);return+q(t)==+J(t)}function z(e,t){const r=c.toDate(e),o=c.toDate(t),n=y(r,o),a=Math.abs(Y(r,o));let i;if(a<1)i=0;else{r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-n*a);let s=y(r,o)===-n;Q(c.toDate(e))&&a===1&&y(e,o)===1&&(s=!1),i=n*(a-Number(s))}return i===0?0:i}function ee(e,t,r){const o=W(e,t)/1e3;return K(r==null?void 0:r.roundingMethod)(o)}function te(e,t,r){const o=c.getDefaultOptions(),n=(r==null?void 0:r.locale)??o.locale??c.enUS,a=2520,i=y(e,t);if(isNaN(i))throw new RangeError("Invalid time value");const s=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:i});let l,u;i>0?(l=c.toDate(t),u=c.toDate(e)):(l=c.toDate(e),u=c.toDate(t));const g=ee(u,l),m=(c.getTimezoneOffsetInMilliseconds(u)-c.getTimezoneOffsetInMilliseconds(l))/1e3,f=Math.round((g-m)/60);let h;if(f<2)return r!=null&&r.includeSeconds?g<5?n.formatDistance("lessThanXSeconds",5,s):g<10?n.formatDistance("lessThanXSeconds",10,s):g<20?n.formatDistance("lessThanXSeconds",20,s):g<40?n.formatDistance("halfAMinute",0,s):g<60?n.formatDistance("lessThanXMinutes",1,s):n.formatDistance("xMinutes",1,s):f===0?n.formatDistance("lessThanXMinutes",1,s):n.formatDistance("xMinutes",f,s);if(f<45)return n.formatDistance("xMinutes",f,s);if(f<90)return n.formatDistance("aboutXHours",1,s);if(f<c.minutesInDay){const d=Math.round(f/60);return n.formatDistance("aboutXHours",d,s)}else{if(f<a)return n.formatDistance("xDays",1,s);if(f<c.minutesInMonth){const d=Math.round(f/c.minutesInDay);return n.formatDistance("xDays",d,s)}else if(f<c.minutesInMonth*2)return h=Math.round(f/c.minutesInMonth),n.formatDistance("aboutXMonths",h,s)}if(h=z(u,l),h<12){const d=Math.round(f/c.minutesInMonth);return n.formatDistance("xMonths",d,s)}else{const d=h%12,w=Math.trunc(h/12);return d<3?n.formatDistance("aboutXYears",w,s):d<9?n.formatDistance("overXYears",w,s):n.formatDistance("almostXYears",w+1,s)}}function v(e,t){return te(e,H(e),t)}const R=["day","hour","minute","second","millisecond"],A={day:864e5,hour:36e5,minute:6e4,second:1e3,millisecond:1},re={day:"d",hour:"hr",minute:"min",second:"s",millisecond:"ms"},ne={day:["day","days"],hour:["hour","hours"],minute:["minute","minutes"],second:["second","seconds"],millisecond:["millisecond","milliseconds"]};function oe(e){return e==="day"||e==="hour"||e==="minute"||e==="second"||e==="millisecond"}function E(e,t){return oe(e)?e:t}function S(e,t){return R.indexOf(E(e,t))}function ae(e,t){const r=S(e,"day"),o=S(t,"second"),n=Math.min(r,o),a=Math.max(r,o);return R.slice(n,a+1)}function se(e,t){return e*A[E(t,"second")]}function ie(e,t){const r=ae(t.largestUnit,t.smallestUnit),o=r[r.length-1],n=A[o];let a=Math.round(e/n)*n;return r.map(i=>{const s=A[i],l=Math.floor(a/s);return a-=l*s,{unit:i,value:l}})}function le(e,t){const r=e.filter(a=>a.value!==0),o=r.length>0?r:[e[e.length-1]],n=typeof t=="number"&&Number.isFinite(t)?Math.max(1,Math.trunc(t)):o.length;return o.slice(0,n).map(a=>`${a.value}${re[a.unit]}`).join(" ")}function ce(e,t){const r=e.filter(a=>a.value!==0),o=r.length>0?r:[e[e.length-1]],n=typeof t=="number"&&Number.isFinite(t)?Math.max(1,Math.trunc(t)):o.length;return o.slice(0,n).map(a=>{const[i,s]=ne[a.unit];return`${a.value} ${a.value===1?i:s}`}).join(" ")}function ue(e){const t=e.some(l=>l.unit==="day"&&l.value!==0),r=e.some(l=>l.unit==="millisecond"),o=e.findIndex(l=>l.value!==0),n=Math.max(0,e.length-2),a=t?0:o===-1?n:Math.min(o,n),i=o===-1?e.slice(n):e.slice(a);if(i.length===0)return"0";const s=i.map((l,u)=>l.unit==="millisecond"?String(l.value).padStart(3,"0"):u===0?String(l.value):String(l.value).padStart(2,"0")).join(":");return r?s.replace(/:(\d{3})$/,".$1"):s}function fe(e,t,r){const o=`${r.prefix||""}${e}${r.suffix||""}`;return t?r.negativeInParentheses?`(${o})`:`-${o}`:o}function V(e,t={}){if(e==null)return"";const r=typeof e=="number"?e:typeof e=="string"&&e.trim()?Number(e):NaN;if(!Number.isFinite(r))return"";const o=t.inputUnit||"second",n=t.outputStyle==="digital"||t.outputStyle==="long"?t.outputStyle:"compact",a=r<0,i=Math.abs(se(r,o)),s=ie(i,t),l=n==="digital"?ue(s):n==="long"?ce(s,t.maxUnits):le(s,t.maxUnits);return fe(l,a,t)}function me(e,t,r){const o={...t,locale:t.locale??r};if(o.type==="number")return M.formatNumericCanonical(e,o);const{prefix:n,suffix:a,...i}=o;return`${n??""}${M.formatNumericCanonical(e,{...i,negativeStyle:o.type==="currency"?o.negativeStyle:"minus"})}${a??""}`}function T(e,t,r){return e===null?{value:e,text:null}:!t||!c.isNumericCanonicalFormat(t)&&t.type!=="duration"?{value:e,text:M.formatNumericCanonical(e,{type:"number",locale:r})}:t.type==="duration"?{value:e,text:V(e,{inputUnit:t.inputUnit,outputStyle:t.outputStyle,largestUnit:t.largestUnit,smallestUnit:t.smallestUnit,maxUnits:t.maxUnits,prefix:t.prefix,suffix:t.suffix,negativeInParentheses:t.negativeStyle==="parentheses"})}:{value:e,text:me(e,t,r)}}function C(e,t,r,o){return e===null?{value:e,text:null}:o==="percent"?{value:e,text:M.formatNumericCanonical(e,{type:"percent",locale:r,minimumFractionDigits:t,maximumFractionDigits:t,percentValueMode:"fraction"})}:{value:e,text:M.formatNumericCanonical(e,{type:"number",locale:r,minimumFractionDigits:t,maximumFractionDigits:t,suffix:"×"})}}function _(e,t){if(e===void 0)return t;if(!Number.isInteger(e)||e<0||e>6)throw new RangeError("Comparison precision must be an integer from 0 to 6.");return e}function ge(e,t){const r={mode:t.displayMode,current:T(e.currentValue,t.metricFormat,t.locale),comparison:T(e.comparisonValue,t.metricFormat,t.locale)};return(t.displayMode==="difference"||t.displayMode==="both")&&(r.difference=T(e.delta,t.metricFormat,t.locale)),(t.displayMode==="percent_change"||t.displayMode==="both")&&(r.percentChange=C(e.percentChange,_(t.precision,1),t.locale,"percent")),t.displayMode==="ratio"&&(r.ratio=C(e.ratio,_(t.precision,2),t.locale,"ratio")),r}function de(e,t){return e&&e!=="auto"?e:t}function he(e,t=new Date){try{const r={timeZone:e,timeZoneName:"short"},n=new Intl.DateTimeFormat("en-US",r).formatToParts(t).find(a=>a.type==="timeZoneName");return(n==null?void 0:n.value)||e}catch{return e}}function Me(e){try{const t={timeZone:e,timeZoneName:"long"},o=new Intl.DateTimeFormat("en-US",t).formatToParts(new Date).find(n=>n.type==="timeZoneName");return(o==null?void 0:o.value)||e}catch{return e}}function L(e,t="auto"){if(!e)return new Date(NaN);const r=e.endsWith("Z"),o=/[+-]\d{2}:?\d{2}$/.test(e),n=/\([A-Z]{3,4}\)$/.test(e);if(t==="auto")return r||o||n?new Date(e):new Date(e+"Z");if(t==="local"){if(r||o){const a=e.replace(/Z$/,"").replace(/[+-]\d{2}:?\d{2}$/,"");return new Date(a)}return new Date(e)}else return t==="UTC"?r?new Date(e):o?new Date(e):new Date(e+"Z"):r||o||n?new Date(e):B.fromZonedTime(e,t)}const ye="MM/dd/yyyy",De=(e,t,r,o="auto")=>{if(!e)return"";try{const n=L(e,o);if(isNaN(n.getTime()))return e;const i=(t&&t.trim()?t:ye).replace(/LLLL/g,"MMMM").replace(/LLL/g,"MMM");return r&&r!=="auto"?c.formatInTimeZone(n,r,i):c.format(n,i)}catch(n){return console.error("Date formatting error:",n),e}},be=(e,t="auto")=>{if(!e)return"";try{const r=L(e,t);return isNaN(r.getTime())?e:v(r,{addSuffix:!0})}catch(r){return console.error("Relative time formatting error:",r),e}};function I(e,t=","){if(e==null)return"";const r=String(e);return r.includes(t)||r.includes('"')||r.includes(`
|
|
2
|
+
`)||r.includes("\r")?`"${r.replace(/"/g,'""')}"`:r}function N(e,t=","){return e.map(r=>I(r,t)).join(t)}function O(e,t={}){const{delimiter:r=",",lineEnding:o=`
|
|
3
|
+
`}=t;return e.map(n=>N(n,r)).join(o)}function we(e,t={}){if(e.length===0)return"";const{delimiter:r=",",lineEnding:o=`
|
|
4
|
+
`,includeHeaders:n=!0,columns:a}=t,i=a||Object.keys(e[0]),s=[];n&&s.push(i);for(const l of e){const u=i.map(g=>{const m=l[g];return m==null?"":String(m)});s.push(u)}return O(s,{delimiter:r,lineEnding:o})}const P=1e4,Te=1e6;function Ae(e){return e>P}const $="__TOTAL__";function D(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function b(e){return e===$}function Le(e){const t=new Map,r=(e.groupByColumns??[]).map((n,a)=>{var u,g,m;if(!D(n))throw new Error(`Aggregate groupByColumns[${a}] is invalid`);const i=typeof n.id=="string"&&n.id.length>0?n.id:void 0,s=i?(m=(g=(u=e.columnKeyMap)==null?void 0:u.byRole)==null?void 0:g.groupby)==null?void 0:m[i]:void 0,l=(s==null?void 0:s.outputKey)||(s==null?void 0:s.rawKey)||(typeof n.alias=="string"&&n.alias.length>0?n.alias:typeof n.name=="string"&&n.name.length>0?n.name:void 0);if(!l)throw new Error(`Aggregate groupByColumns[${a}] has no output key`);return[i,n.alias,n.name,l].forEach(f=>{typeof f=="string"&&f.length>0&&t.set(f,l)}),l}),o=(e.rowAggregates??[]).flatMap(n=>!D(n)||typeof n.function!="string"||typeof n.groupLevel!="string"?[]:[{function:n.function,groupLevel:n.groupLevel==="ALL"?"ALL":t.get(n.groupLevel)||n.groupLevel,...typeof n.label=="string"?{label:n.label}:{}}]);return{groupColumnKeys:r,rowAggregates:o}}function F(e){return e==="SUM"?"Total":e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function U(e){var r;if(e.customLabel)return e.customLabel;const t=F(e.aggregateFunction);if(e.levelValue!==void 0&&!b(e.levelValue)){if(e.levelValue===null){const n=(r=e.formatValue)==null?void 0:r.call(e,null);return n?`Subtotal ${n}`:`Subtotal ${t}`}const o=e.formatValue?e.formatValue(e.levelValue):String(e.levelValue);if(o)return`Subtotal (${o})`}return`Subtotal ${t}`}function G(e,t){return t||`Grand ${F(e)}`}function pe(e){const t=e.context.groupColumnKeys.indexOf(e.columnKey);if(t<0)throw new Error(`Aggregate group column "${e.columnKey}" is unknown`);if(!e.previousRow||e.row.isSubtotal===!0||e.row.isGrandTotal===!0||e.previousRow.isSubtotal===!0||e.previousRow.isGrandTotal===!0)return!0;for(let r=0;r<=t;r++){const o=e.context.groupColumnKeys[r];if(e.row[o]!==e.previousRow[o])return!0}return!1}function p(e){var o,n;const t=e.context.groupColumnKeys,r=typeof e.row.aggregate=="string"?e.row.aggregate:"SUM";if(e.row.isGrandTotal===!0){const a=(o=e.context.rowAggregates.find(i=>i.groupLevel==="ALL"))==null?void 0:o.label;return{kind:"grand-total",cells:t.map((i,s)=>({columnKey:i,text:s===0?G(r,a):"",placement:s===0?"label":"empty",colSpan:s===0?t.length:1}))}}if(e.row.isSubtotal===!0){if(typeof e.row.subtotalLevel!="string")throw new Error("Aggregate subtotal row is missing subtotalLevel");const a=t.indexOf(e.row.subtotalLevel);if(a<0)throw new Error(`Aggregate subtotal level "${e.row.subtotalLevel}" has no group column`);const i=D(e.row.subtotalContext)?e.row.subtotalContext:void 0,s=D(i==null?void 0:i.groupByValues)?i.groupByValues:{},l=(n=e.context.rowAggregates.find(u=>u.groupLevel===e.row.subtotalLevel&&u.function===r))==null?void 0:n.label;return{kind:"subtotal",cells:t.map((u,g)=>{if(g>a)return{columnKey:u,text:"",placement:"empty",colSpan:1};if(g<a){const m=e.row[u];return{columnKey:u,text:m===void 0||b(m)?"":e.formatValue(m,u),placement:"value",colSpan:1}}return{columnKey:u,text:U({aggregateFunction:r,customLabel:l,levelValue:s[u],formatValue:m=>e.formatLabelValue?e.formatLabelValue(m,u):String(e.formatValue(m,u)??"")}),placement:"label",colSpan:t.length-a}})}}return{kind:"data",cells:t.map(a=>{const i=e.row[a];return{columnKey:a,text:i===void 0||b(i)?"":e.formatValue(i,a),placement:"value",colSpan:1}})}}function xe(e){const t=p(e).cells.find(r=>r.columnKey===e.columnKey);if(!t)throw new Error(`Aggregate group column "${e.columnKey}" is unknown`);return t.text}function Se(e){return p(e).cells.map(t=>t.text)}class k extends Error{constructor(r,o){super(`${r}: ${o}`);x(this,"deliveryBlocking",!0);this.code=r,this.name="PivotHeaderPresentationError"}}function Ce(e){var n;const t=e.mode??"formatted",r=e.members.map(a=>{var s;if(t==="canonical"||!a.temporalBucket)return a.value===null?"":String(a.value);const i=(s=e.resolveTemporalFormat)==null?void 0:s.call(e,a.fieldId);if(!i)throw new k("missing_resolved_temporal_format",`Missing resolved temporal presentation for pivot field "${a.fieldId}"`);return j.formatTemporalBucket({value:a.value,metadata:a.temporalBucket,format:i})}),o=((n=e.metricLabel)==null?void 0:n.trim())||void 0;return{memberLabels:r,...o?{metricLabel:o}:{},flattenedLabel:[...r,...o?[o]:[]].join(" / ")}}exports.AGGREGATE_TOTAL_MEMBER_MARKER=$;exports.DIRECT_CSV_EXPORT_MAX_ROWS=P;exports.FULL_DATASET_CSV_EXPORT_MAX_ROWS=Te;exports.PivotHeaderPresentationError=k;exports.arrayToCSV=O;exports.arrayToCSVRow=N;exports.escapeCSVValue=I;exports.formatAggregateGrandTotalLabel=G;exports.formatAggregateGroupCell=xe;exports.formatAggregateGroupRow=Se;exports.formatAggregateSubtotalLabel=U;exports.formatDate=De;exports.formatDistanceToNow=v;exports.formatDuration=V;exports.formatMetricComparison=ge;exports.formatRelativeTime=be;exports.getTimezoneAbbreviation=he;exports.getTimezoneName=Me;exports.isAggregateTotalMemberMarker=b;exports.objectsToCSV=we;exports.parseWithSourceTimezone=L;exports.presentAggregateGroupRow=p;exports.presentPivotHeader=Ce;exports.requiresChunkedCsvExport=Ae;exports.resolveAggregateTablePresentationContext=Le;exports.resolveTimezone=de;exports.shouldPresentAggregateGroupValue=pe;
|