react-semaphor 0.1.513 → 0.1.515
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 +3 -3
- package/dist/chunks/{dashboard-briefing-launcher-BgGxFDKD.cjs → dashboard-briefing-launcher-B7zqm8P1.cjs} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-C7ptb5Yf.js → dashboard-briefing-launcher-BA_bl05p.js} +5 -5
- package/dist/chunks/{dashboard-controls-BybAeRL8.js → dashboard-controls-QMW17RKx.js} +6 -6
- package/dist/chunks/{dashboard-controls-BFT7savs.cjs → dashboard-controls-x_v9wLOU.cjs} +1 -1
- package/dist/chunks/{dashboard-json-qNJC4fZW.cjs → dashboard-json-0ZLLBlHj.cjs} +1 -1
- package/dist/chunks/{dashboard-json-DmgEQ0yQ.js → dashboard-json-DRnpkNwO.js} +3 -3
- package/dist/chunks/{edit-dashboard-visual-CHqpQVfv.js → edit-dashboard-visual-1ISjhwry.js} +1377 -1380
- package/dist/chunks/{edit-dashboard-visual-BS219qr8.cjs → edit-dashboard-visual-CI0EqzKj.cjs} +2 -2
- package/dist/chunks/{editor-action-buttons-DbU_vUvm.js → editor-action-buttons-BTCKZERI.js} +3 -3
- package/dist/chunks/{editor-action-buttons-6NvSUz4D.cjs → editor-action-buttons-Czq5SnA9.cjs} +1 -1
- package/dist/chunks/{index-DhlVxvyI.cjs → index-BMMXKK3G.cjs} +1 -1
- package/dist/chunks/{index-CrxlydOT.cjs → index-C6_xef4P.cjs} +168 -168
- package/dist/chunks/{index-CACdoqu3.js → index-C8w91oj4.js} +61 -51
- package/dist/chunks/index-Cw2ypaFl.cjs +1 -0
- package/dist/chunks/{index-WMVZeOZp.js → index-Dlic9KZs.js} +32234 -31816
- package/dist/chunks/{index-CnGVjyF8.js → index-v1OE4-eA.js} +2 -2
- package/dist/chunks/matrix-formatter-BdIsE7Qu.js +341 -0
- package/dist/chunks/matrix-formatter-Dajj91Ni.cjs +1 -0
- package/dist/chunks/{pivot-header-presentation-Dm9dUQsl.js → pivot-header-presentation-BIf4HW3L.js} +35 -36
- package/dist/chunks/{pivot-header-presentation-Cxz8-06f.cjs → pivot-header-presentation-B_N11CgN.cjs} +3 -3
- package/dist/chunks/{pivot-result-lifecycle-BeOpjAhg.js → pivot-result-lifecycle-CEmyU2At.js} +207 -148
- package/dist/chunks/pivot-result-lifecycle-vg_suUNb.cjs +1 -0
- package/dist/chunks/{raw-temporal-DrmCX9Wq.js → raw-temporal-Bj6_w9cG.js} +471 -361
- package/dist/chunks/raw-temporal-CeblVJbu.cjs +1 -0
- package/dist/chunks/{report-preferences-dialog-CaefWf8W.cjs → report-preferences-dialog-Dr1BYwuf.cjs} +1 -1
- package/dist/chunks/{report-preferences-dialog-BoDcPtha.js → report-preferences-dialog-b8J6KjSy.js} +2 -2
- package/dist/chunks/semantic-format-DFI1iszk.cjs +1 -0
- package/dist/chunks/{semantic-format-BZxJLKvw.js → semantic-format-Dt-nUxFB.js} +23 -29
- package/dist/chunks/switch-Ced9ZZwI.cjs +134 -0
- package/dist/chunks/{switch-QfKb0Iwe.js → switch-D5_tjsIS.js} +3139 -3087
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/data-app-builder/index.cjs +1 -1
- package/dist/data-app-builder/index.js +2 -2
- package/dist/data-app-sdk/index.cjs +1 -1
- package/dist/data-app-sdk/index.js +1 -1
- package/dist/format-utils/index.cjs +3 -3
- package/dist/format-utils/index.js +131 -126
- package/dist/index.cjs +1 -1
- package/dist/index.js +7 -7
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/components/calculated-fields/templates-menu.d.ts +0 -9
- package/dist/types/components/visual/aggregated-table/utils/metric-format-resolver.d.ts +3 -3
- package/dist/types/components/visual/data-table/types/data-table.d.ts +4 -1
- package/dist/types/components/visual/pivot-table/utils/pivot-metric-formatting.d.ts +2 -2
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.js +58 -34
- package/dist/types/lib/formatters/metric-formatting.d.ts +3 -3
- package/dist/types/lib/table-formatting/table-presentation-fields.d.ts +1 -0
- package/dist/types/lib/types/calculated-field-template-types.d.ts +3 -2
- package/dist/types/lib/utils/calculated-field-row-templates.d.ts +6 -4
- package/dist/types/lib/utils/date-timezone-utils.d.ts +26 -4
- package/dist/types/shared/format-utils/formatters/duration-formatter.d.ts +4 -1
- package/dist/types/shared/format-utils/formatters/index.d.ts +2 -2
- package/dist/types/shared/format-utils/formatters/number-formatter.d.ts +8 -2
- package/dist/types/shared/format-utils/presentation-execution.d.ts +17 -2
- package/dist/types/shared/format-utils/types/format-types.d.ts +16 -1
- package/package.json +1 -1
- package/dist/chunks/index-F25jnH0p.cjs +0 -1
- package/dist/chunks/matrix-formatter-BLunke3R.js +0 -424
- package/dist/chunks/matrix-formatter-CveLJo6S.cjs +0 -1
- package/dist/chunks/pivot-result-lifecycle-BiERyXnS.cjs +0 -1
- package/dist/chunks/raw-temporal-BUeTpG76.cjs +0 -1
- package/dist/chunks/semantic-format-BzH69TRq.cjs +0 -1
- package/dist/chunks/switch--Re1K566.cjs +0 -134
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var tt = Object.defineProperty;
|
|
2
2
|
var rt = (e, r, t) => r in e ? tt(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
|
|
3
3
|
var F = (e, r, t) => rt(e, typeof r != "symbol" ? r + "" : r, t);
|
|
4
|
-
import {
|
|
4
|
+
import { w as J, n as G, o as nt, R as ot, u as at, p as xe, h as it } from "./raw-temporal-Bj6_w9cG.js";
|
|
5
5
|
import { ak as $e, a4 as ct, a6 as ie, _ as ke, t as lt } from "./validators-CkHsAvwB.js";
|
|
6
6
|
import "./matrix-continuation-C4sRcjZU.js";
|
|
7
7
|
import "./matrix-operation-contract-D0HfzwZg.js";
|
|
8
8
|
import { DEFAULT_RESOLVED_VALUE_FORMAT_PREFERENCES as se } from "../value-format-preferences/index.js";
|
|
9
|
-
import {
|
|
9
|
+
import { k as dt, i as st, g as mt, j as ut, e as ft, M as pt, c as yt, b as ht, P as j } from "./pivot-result-lifecycle-CEmyU2At.js";
|
|
10
10
|
import { z as E } from "zod";
|
|
11
11
|
import { r as gt } from "./matrix-definition-I9rHB9zN.js";
|
|
12
12
|
import { h as Ee, i as me, r as Se, a as _e, v as vt, b as bt } from "./card-config-utils-B2cDWQqB.js";
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import { b4 as v, S as d, ak as N } from "./validators-CkHsAvwB.js";
|
|
2
|
+
import "./matrix-operation-contract-D0HfzwZg.js";
|
|
3
|
+
import { t as m, c as _, g as L, e as I, a as p, b as C, d as S, f as k } from "./semantic-format-Dt-nUxFB.js";
|
|
4
|
+
import { f as O, i as Z } from "./index-C8w91oj4.js";
|
|
5
|
+
import { f as A, w as R, n as z, m as X, h as V, j as $ } from "./raw-temporal-Bj6_w9cG.js";
|
|
6
|
+
import { b as g, c as y } from "./constants-DeLIHVAW.js";
|
|
7
|
+
import { d as P, f as Y } from "./temporal-bucket-B9hMwemw.js";
|
|
8
|
+
function T(t, e) {
|
|
9
|
+
const n = m(t), s = m(e), r = n.getTime() - s.getTime();
|
|
10
|
+
return r < 0 ? -1 : r > 0 ? 1 : r;
|
|
11
|
+
}
|
|
12
|
+
function j(t) {
|
|
13
|
+
return _(t, Date.now());
|
|
14
|
+
}
|
|
15
|
+
function B(t, e) {
|
|
16
|
+
const n = m(t), s = m(e), r = n.getFullYear() - s.getFullYear(), o = n.getMonth() - s.getMonth();
|
|
17
|
+
return r * 12 + o;
|
|
18
|
+
}
|
|
19
|
+
function E(t) {
|
|
20
|
+
return (e) => {
|
|
21
|
+
const s = (t ? Math[t] : Math.trunc)(e);
|
|
22
|
+
return s === 0 ? 0 : s;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function U(t, e) {
|
|
26
|
+
return +m(t) - +m(e);
|
|
27
|
+
}
|
|
28
|
+
function q(t) {
|
|
29
|
+
const e = m(t);
|
|
30
|
+
return e.setHours(23, 59, 59, 999), e;
|
|
31
|
+
}
|
|
32
|
+
function H(t) {
|
|
33
|
+
const e = m(t), n = e.getMonth();
|
|
34
|
+
return e.setFullYear(e.getFullYear(), n + 1, 0), e.setHours(23, 59, 59, 999), e;
|
|
35
|
+
}
|
|
36
|
+
function W(t) {
|
|
37
|
+
const e = m(t);
|
|
38
|
+
return +q(e) == +H(e);
|
|
39
|
+
}
|
|
40
|
+
function G(t, e) {
|
|
41
|
+
const n = m(t), s = m(e), r = T(n, s), o = Math.abs(
|
|
42
|
+
B(n, s)
|
|
43
|
+
);
|
|
44
|
+
let l;
|
|
45
|
+
if (o < 1)
|
|
46
|
+
l = 0;
|
|
47
|
+
else {
|
|
48
|
+
n.getMonth() === 1 && n.getDate() > 27 && n.setDate(30), n.setMonth(n.getMonth() - r * o);
|
|
49
|
+
let a = T(n, s) === -r;
|
|
50
|
+
W(m(t)) && o === 1 && T(t, s) === 1 && (a = !1), l = r * (o - Number(a));
|
|
51
|
+
}
|
|
52
|
+
return l === 0 ? 0 : l;
|
|
53
|
+
}
|
|
54
|
+
function K(t, e, n) {
|
|
55
|
+
const s = U(t, e) / 1e3;
|
|
56
|
+
return E(n == null ? void 0 : n.roundingMethod)(s);
|
|
57
|
+
}
|
|
58
|
+
function J(t, e, n) {
|
|
59
|
+
const s = L(), r = (n == null ? void 0 : n.locale) ?? s.locale ?? I, o = 2520, l = T(t, e);
|
|
60
|
+
if (isNaN(l))
|
|
61
|
+
throw new RangeError("Invalid time value");
|
|
62
|
+
const a = Object.assign({}, n, {
|
|
63
|
+
addSuffix: n == null ? void 0 : n.addSuffix,
|
|
64
|
+
comparison: l
|
|
65
|
+
});
|
|
66
|
+
let h, u;
|
|
67
|
+
l > 0 ? (h = m(e), u = m(t)) : (h = m(t), u = m(e));
|
|
68
|
+
const f = K(u, h), c = (p(u) - p(h)) / 1e3, i = Math.round((f - c) / 60);
|
|
69
|
+
let D;
|
|
70
|
+
if (i < 2)
|
|
71
|
+
return n != null && n.includeSeconds ? f < 5 ? r.formatDistance("lessThanXSeconds", 5, a) : f < 10 ? r.formatDistance("lessThanXSeconds", 10, a) : f < 20 ? r.formatDistance("lessThanXSeconds", 20, a) : f < 40 ? r.formatDistance("halfAMinute", 0, a) : f < 60 ? r.formatDistance("lessThanXMinutes", 1, a) : r.formatDistance("xMinutes", 1, a) : i === 0 ? r.formatDistance("lessThanXMinutes", 1, a) : r.formatDistance("xMinutes", i, a);
|
|
72
|
+
if (i < 45)
|
|
73
|
+
return r.formatDistance("xMinutes", i, a);
|
|
74
|
+
if (i < 90)
|
|
75
|
+
return r.formatDistance("aboutXHours", 1, a);
|
|
76
|
+
if (i < g) {
|
|
77
|
+
const M = Math.round(i / 60);
|
|
78
|
+
return r.formatDistance("aboutXHours", M, a);
|
|
79
|
+
} else {
|
|
80
|
+
if (i < o)
|
|
81
|
+
return r.formatDistance("xDays", 1, a);
|
|
82
|
+
if (i < y) {
|
|
83
|
+
const M = Math.round(i / g);
|
|
84
|
+
return r.formatDistance("xDays", M, a);
|
|
85
|
+
} else if (i < y * 2)
|
|
86
|
+
return D = Math.round(i / y), r.formatDistance("aboutXMonths", D, a);
|
|
87
|
+
}
|
|
88
|
+
if (D = G(u, h), D < 12) {
|
|
89
|
+
const M = Math.round(i / y);
|
|
90
|
+
return r.formatDistance("xMonths", M, a);
|
|
91
|
+
} else {
|
|
92
|
+
const M = D % 12, b = Math.trunc(D / 12);
|
|
93
|
+
return M < 3 ? r.formatDistance("aboutXYears", b, a) : M < 9 ? r.formatDistance("overXYears", b, a) : r.formatDistance("almostXYears", b + 1, a);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function Q(t, e) {
|
|
97
|
+
return J(t, j(t), e);
|
|
98
|
+
}
|
|
99
|
+
function he(t, e) {
|
|
100
|
+
return t && t !== "auto" ? t : e;
|
|
101
|
+
}
|
|
102
|
+
function De(t, e = /* @__PURE__ */ new Date()) {
|
|
103
|
+
try {
|
|
104
|
+
const n = {
|
|
105
|
+
timeZone: t,
|
|
106
|
+
timeZoneName: "short"
|
|
107
|
+
}, r = new Intl.DateTimeFormat("en-US", n).formatToParts(e).find((o) => o.type === "timeZoneName");
|
|
108
|
+
return (r == null ? void 0 : r.value) || t;
|
|
109
|
+
} catch {
|
|
110
|
+
return t;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function Me(t) {
|
|
114
|
+
try {
|
|
115
|
+
const e = {
|
|
116
|
+
timeZone: t,
|
|
117
|
+
timeZoneName: "long"
|
|
118
|
+
}, s = new Intl.DateTimeFormat("en-US", e).formatToParts(
|
|
119
|
+
/* @__PURE__ */ new Date()
|
|
120
|
+
).find((r) => r.type === "timeZoneName");
|
|
121
|
+
return (s == null ? void 0 : s.value) || t;
|
|
122
|
+
} catch {
|
|
123
|
+
return t;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function w(t, e = "auto") {
|
|
127
|
+
if (!t)
|
|
128
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
129
|
+
const n = t.endsWith("Z"), s = /[+-]\d{2}:?\d{2}$/.test(t), r = /\([A-Z]{3,4}\)$/.test(t);
|
|
130
|
+
if (e === "auto")
|
|
131
|
+
return n || s || r ? new Date(t) : /* @__PURE__ */ new Date(t + "Z");
|
|
132
|
+
if (e === "local") {
|
|
133
|
+
if (n || s) {
|
|
134
|
+
const o = t.replace(/Z$/, "").replace(/[+-]\d{2}:?\d{2}$/, "");
|
|
135
|
+
return new Date(o);
|
|
136
|
+
}
|
|
137
|
+
return new Date(t);
|
|
138
|
+
} else return e === "UTC" ? n ? new Date(t) : s ? new Date(t) : /* @__PURE__ */ new Date(t + "Z") : n || s || r ? new Date(t) : O(t, e);
|
|
139
|
+
}
|
|
140
|
+
const F = "MM/dd/yyyy", ee = (t, e, n, s = "auto") => {
|
|
141
|
+
if (!t)
|
|
142
|
+
return "";
|
|
143
|
+
try {
|
|
144
|
+
const r = w(t, s);
|
|
145
|
+
if (isNaN(r.getTime()))
|
|
146
|
+
return t;
|
|
147
|
+
const l = (e && e.trim() ? e : F).replace(/LLLL/g, "MMMM").replace(/LLL/g, "MMM");
|
|
148
|
+
return n && n !== "auto" ? C(r, n, l) : S(r, l);
|
|
149
|
+
} catch (r) {
|
|
150
|
+
return console.error("Date formatting error:", r), t;
|
|
151
|
+
}
|
|
152
|
+
}, te = (t, e = "auto") => {
|
|
153
|
+
if (!t)
|
|
154
|
+
return "";
|
|
155
|
+
try {
|
|
156
|
+
const n = w(t, e);
|
|
157
|
+
return isNaN(n.getTime()) ? t : Q(n, { addSuffix: !0 });
|
|
158
|
+
} catch (n) {
|
|
159
|
+
return console.error("Relative time formatting error:", n), t;
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
function ne(t, e, n, s) {
|
|
163
|
+
const r = t instanceof Date ? t.toISOString() : String(t), o = (s == null ? void 0 : s.browserTimezone) || n, l = (s == null ? void 0 : s.isSqlCard) ?? !1;
|
|
164
|
+
if (e != null && e.useRelativeTime)
|
|
165
|
+
return te(
|
|
166
|
+
r,
|
|
167
|
+
(e == null ? void 0 : e.sourceTimezone) || "auto"
|
|
168
|
+
);
|
|
169
|
+
const a = e != null && e.useCustomFormat && (e != null && e.customFormat) ? e.customFormat : (e == null ? void 0 : e.format) || "MM/dd/yyyy";
|
|
170
|
+
return ee(
|
|
171
|
+
r,
|
|
172
|
+
a,
|
|
173
|
+
e != null && e.timezone && (e == null ? void 0 : e.timezone) !== "auto" ? e.timezone : l ? o : n,
|
|
174
|
+
(e == null ? void 0 : e.sourceTimezone) || "auto"
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
function x(t, e, n) {
|
|
178
|
+
var l, a;
|
|
179
|
+
if (t == null)
|
|
180
|
+
return t === null ? ((l = n.absence) == null ? void 0 : l.nullText) ?? "" : ((a = n.absence) == null ? void 0 : a.emptyText) ?? "";
|
|
181
|
+
const s = v(t) ? t : void 0, r = s ? s.value : t, o = s ?? (typeof t == "number" ? t : void 0);
|
|
182
|
+
if (!n.useFormattedValues || !e)
|
|
183
|
+
return String(r);
|
|
184
|
+
switch (e.type) {
|
|
185
|
+
case "number":
|
|
186
|
+
return o !== void 0 ? A(
|
|
187
|
+
o,
|
|
188
|
+
e.numberFormat,
|
|
189
|
+
n.locale
|
|
190
|
+
) : String(r);
|
|
191
|
+
case "date":
|
|
192
|
+
return ne(
|
|
193
|
+
r,
|
|
194
|
+
e.dateFormat,
|
|
195
|
+
n.timezone,
|
|
196
|
+
{
|
|
197
|
+
browserTimezone: n.browserTimezone,
|
|
198
|
+
isSqlCard: n.isSqlCard
|
|
199
|
+
}
|
|
200
|
+
);
|
|
201
|
+
case "progress":
|
|
202
|
+
return o !== void 0 ? `${r}%` : String(r);
|
|
203
|
+
case "badge":
|
|
204
|
+
case "link":
|
|
205
|
+
case "text":
|
|
206
|
+
case "none":
|
|
207
|
+
default:
|
|
208
|
+
return String(r);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
function ye(t, e) {
|
|
212
|
+
return e.visibleColumns.map((n) => {
|
|
213
|
+
const s = t[n], r = e.columnSettings[n];
|
|
214
|
+
return x(s, r, {
|
|
215
|
+
useFormattedValues: e.useFormattedValues,
|
|
216
|
+
timezone: e.timezone,
|
|
217
|
+
locale: e.locale
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
function re(t, e) {
|
|
222
|
+
var r;
|
|
223
|
+
const n = t[t.length - 1];
|
|
224
|
+
if (!n) return "";
|
|
225
|
+
if (n.member.kind === "others") return "Others";
|
|
226
|
+
const s = n.member.value;
|
|
227
|
+
return s === null ? "(Blank)" : ((r = e == null ? void 0 : e.get(n.levelId)) == null ? void 0 : r(s)) ?? (typeof s == "object" ? s.value : String(s));
|
|
228
|
+
}
|
|
229
|
+
function se(t, e, n) {
|
|
230
|
+
return t === "grand_total" ? n ?? "Grand Total" : t === "subtotal" ? n ?? `${e} Total` : e;
|
|
231
|
+
}
|
|
232
|
+
function Te(t, e, n, s) {
|
|
233
|
+
var l;
|
|
234
|
+
const r = t[t.length - 1], o = e === "grand_total" ? n.grand.label : r ? (l = n.levels[r.levelId]) == null ? void 0 : l.label : void 0;
|
|
235
|
+
return se(e, re(t, s), o);
|
|
236
|
+
}
|
|
237
|
+
function be(t, e, n) {
|
|
238
|
+
return t.kind === "value" ? (e == null ? void 0 : e(t.value)) ?? "" : t.kind === "null" ? n.nullText : n.emptyText;
|
|
239
|
+
}
|
|
240
|
+
function de(t) {
|
|
241
|
+
const { path: e, previousPath: n, role: s, repeatLabels: r, levelCount: o } = t;
|
|
242
|
+
return Array.from({ length: o }, (l, a) => {
|
|
243
|
+
const h = e.slice(0, a + 1), u = s === "grand_total" ? a === 0 : s === "subtotal" && a === e.length - 1, f = n && n.length > a && d(n.slice(0, a + 1)) === d(h);
|
|
244
|
+
return {
|
|
245
|
+
path: h,
|
|
246
|
+
total: u,
|
|
247
|
+
visible: u || e.length > a && (r || !f || a === e.length - 1)
|
|
248
|
+
};
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
function ae(t, e) {
|
|
252
|
+
return k(t ?? e, {
|
|
253
|
+
preserveOmittedProperties: !0,
|
|
254
|
+
numericInput: "canonical"
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
function pe(t, e, n) {
|
|
258
|
+
const s = /* @__PURE__ */ new Map(), r = (o, l) => {
|
|
259
|
+
const a = (l === "levels" ? e.levelFormats : e.measureFormats)[o.id], h = o.semanticFormat, u = ae(a, h);
|
|
260
|
+
l === "measures" && s.set(o.id, {
|
|
261
|
+
isNumeric: N(o.column.dataType) === "number",
|
|
262
|
+
// Use normalized affixes: a redundant percent suffix is already removed.
|
|
263
|
+
hasTextAffixes: !!u && !!("prefix" in u && u.prefix || "suffix" in u && u.suffix)
|
|
264
|
+
});
|
|
265
|
+
const f = (c) => x(c, void 0, {
|
|
266
|
+
useFormattedValues: !0,
|
|
267
|
+
timezone: n.calendar.tz,
|
|
268
|
+
locale: n.valueFormat.locale,
|
|
269
|
+
absence: e.absence
|
|
270
|
+
});
|
|
271
|
+
if (o.column.temporalBucket) {
|
|
272
|
+
const c = o.column.temporalBucket, i = P({
|
|
273
|
+
metadata: c,
|
|
274
|
+
cardFormat: (a == null ? void 0 : a.type) === "temporal_bucket" ? a : void 0,
|
|
275
|
+
semanticFormat: (h == null ? void 0 : h.type) === "temporal_bucket" ? { granularity: c.granularity, format: h } : void 0,
|
|
276
|
+
locale: n.valueFormat.locale,
|
|
277
|
+
styles: { dateStyle: n.valueFormat.dateStyle, dateTime: n.valueFormat.dateTime }
|
|
278
|
+
});
|
|
279
|
+
return (D) => typeof D == "string" ? Y({ value: D, metadata: c, format: i.format }) : f(D);
|
|
280
|
+
}
|
|
281
|
+
if (o.column.rawTemporal) {
|
|
282
|
+
const c = R({
|
|
283
|
+
metadata: o.column.rawTemporal,
|
|
284
|
+
format: z({
|
|
285
|
+
format: (u == null ? void 0 : u.type) === "date" ? {
|
|
286
|
+
type: "raw_temporal",
|
|
287
|
+
timezone: u.timezone,
|
|
288
|
+
sourceTimezone: u.sourceTimezone,
|
|
289
|
+
presentation: u.pattern ? {
|
|
290
|
+
mode: "pattern",
|
|
291
|
+
dialect: "semaphor_tokens",
|
|
292
|
+
pattern: u.pattern
|
|
293
|
+
} : { mode: "auto" }
|
|
294
|
+
} : void 0,
|
|
295
|
+
preferences: n.valueFormat,
|
|
296
|
+
calendar: n.calendar
|
|
297
|
+
})
|
|
298
|
+
});
|
|
299
|
+
return (i) => {
|
|
300
|
+
if (typeof i != "string") return f(i);
|
|
301
|
+
const D = c(i);
|
|
302
|
+
return D.ok ? D.text : f(i);
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
if (Z(u)) {
|
|
306
|
+
const c = X(u, n.valueFormat);
|
|
307
|
+
return (i) => typeof i == "number" || typeof i == "object" && i !== null ? V(i, c) : f(i);
|
|
308
|
+
}
|
|
309
|
+
return (u == null ? void 0 : u.type) === "duration" ? (c) => typeof c == "number" || typeof c == "string" || typeof c == "object" && c !== null ? $(
|
|
310
|
+
typeof c == "object" ? c.value : c,
|
|
311
|
+
u
|
|
312
|
+
) : f(c) : (u == null ? void 0 : u.type) === "string" ? (c) => c === null ? f(c) : `${u.prefix ?? ""}${f(c)}${u.suffix ?? ""}` : f;
|
|
313
|
+
};
|
|
314
|
+
return {
|
|
315
|
+
levels: new Map(
|
|
316
|
+
t.levels.map((o) => [o.id, r(o, "levels")])
|
|
317
|
+
),
|
|
318
|
+
measures: new Map(
|
|
319
|
+
t.measures.map((o) => [o.id, r(o, "measures")])
|
|
320
|
+
),
|
|
321
|
+
measureSemantics: s
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
export {
|
|
325
|
+
Te as a,
|
|
326
|
+
de as b,
|
|
327
|
+
be as c,
|
|
328
|
+
ee as d,
|
|
329
|
+
te as e,
|
|
330
|
+
ye as f,
|
|
331
|
+
De as g,
|
|
332
|
+
Me as h,
|
|
333
|
+
w as i,
|
|
334
|
+
x as j,
|
|
335
|
+
Q as k,
|
|
336
|
+
ae as l,
|
|
337
|
+
re as m,
|
|
338
|
+
se as n,
|
|
339
|
+
pe as p,
|
|
340
|
+
he as r
|
|
341
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const d=require("./validators-DVYAnnX0.cjs");require("./matrix-operation-contract-DoiWTUbT.cjs");const l=require("./semantic-format-DFI1iszk.cjs"),v=require("./index-Cw2ypaFl.cjs"),y=require("./raw-temporal-CeblVJbu.cjs"),T=require("./constants-B00YUv89.cjs"),w=require("./temporal-bucket-4YEPEKlJ.cjs");function b(t,e){const n=l.toDate(t),s=l.toDate(e),r=n.getTime()-s.getTime();return r<0?-1:r>0?1:r}function A(t){return l.constructFrom(t,Date.now())}function O(t,e){const n=l.toDate(t),s=l.toDate(e),r=n.getFullYear()-s.getFullYear(),o=n.getMonth()-s.getMonth();return r*12+o}function R(t){return e=>{const s=(t?Math[t]:Math.trunc)(e);return s===0?0:s}}function S(t,e){return+l.toDate(t)-+l.toDate(e)}function Z(t){const e=l.toDate(t);return e.setHours(23,59,59,999),e}function k(t){const e=l.toDate(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(23,59,59,999),e}function V(t){const e=l.toDate(t);return+Z(e)==+k(e)}function q(t,e){const n=l.toDate(t),s=l.toDate(e),r=b(n,s),o=Math.abs(O(n,s));let f;if(o<1)f=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-r*o);let a=b(n,s)===-r;V(l.toDate(t))&&o===1&&b(t,s)===1&&(a=!1),f=r*(o-Number(a))}return f===0?0:f}function X(t,e,n){const s=S(t,e)/1e3;return R(n==null?void 0:n.roundingMethod)(s)}function P(t,e,n){const s=l.getDefaultOptions(),r=(n==null?void 0:n.locale)??s.locale??l.enUS,o=2520,f=b(t,e);if(isNaN(f))throw new RangeError("Invalid time value");const a=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:f});let h,u;f>0?(h=l.toDate(e),u=l.toDate(t)):(h=l.toDate(t),u=l.toDate(e));const m=X(u,h),c=(l.getTimezoneOffsetInMilliseconds(u)-l.getTimezoneOffsetInMilliseconds(h))/1e3,i=Math.round((m-c)/60);let D;if(i<2)return n!=null&&n.includeSeconds?m<5?r.formatDistance("lessThanXSeconds",5,a):m<10?r.formatDistance("lessThanXSeconds",10,a):m<20?r.formatDistance("lessThanXSeconds",20,a):m<40?r.formatDistance("halfAMinute",0,a):m<60?r.formatDistance("lessThanXMinutes",1,a):r.formatDistance("xMinutes",1,a):i===0?r.formatDistance("lessThanXMinutes",1,a):r.formatDistance("xMinutes",i,a);if(i<45)return r.formatDistance("xMinutes",i,a);if(i<90)return r.formatDistance("aboutXHours",1,a);if(i<T.minutesInDay){const M=Math.round(i/60);return r.formatDistance("aboutXHours",M,a)}else{if(i<o)return r.formatDistance("xDays",1,a);if(i<T.minutesInMonth){const M=Math.round(i/T.minutesInDay);return r.formatDistance("xDays",M,a)}else if(i<T.minutesInMonth*2)return D=Math.round(i/T.minutesInMonth),r.formatDistance("aboutXMonths",D,a)}if(D=q(u,h),D<12){const M=Math.round(i/T.minutesInMonth);return r.formatDistance("xMonths",M,a)}else{const M=D%12,p=Math.trunc(D/12);return M<3?r.formatDistance("aboutXYears",p,a):M<9?r.formatDistance("overXYears",p,a):r.formatDistance("almostXYears",p+1,a)}}function N(t,e){return P(t,A(t),e)}function $(t,e){return t&&t!=="auto"?t:e}function Y(t,e=new Date){try{const n={timeZone:t,timeZoneName:"short"},r=new Intl.DateTimeFormat("en-US",n).formatToParts(e).find(o=>o.type==="timeZoneName");return(r==null?void 0:r.value)||t}catch{return t}}function B(t){try{const e={timeZone:t,timeZoneName:"long"},s=new Intl.DateTimeFormat("en-US",e).formatToParts(new Date).find(r=>r.type==="timeZoneName");return(s==null?void 0:s.value)||t}catch{return t}}function x(t,e="auto"){if(!t)return new Date(NaN);const n=t.endsWith("Z"),s=/[+-]\d{2}:?\d{2}$/.test(t),r=/\([A-Z]{3,4}\)$/.test(t);if(e==="auto")return n||s||r?new Date(t):new Date(t+"Z");if(e==="local"){if(n||s){const o=t.replace(/Z$/,"").replace(/[+-]\d{2}:?\d{2}$/,"");return new Date(o)}return new Date(t)}else return e==="UTC"?n?new Date(t):s?new Date(t):new Date(t+"Z"):n||s||r?new Date(t):v.fromZonedTime(t,e)}const E="MM/dd/yyyy",L=(t,e,n,s="auto")=>{if(!t)return"";try{const r=x(t,s);if(isNaN(r.getTime()))return t;const f=(e&&e.trim()?e:E).replace(/LLLL/g,"MMMM").replace(/LLL/g,"MMM");return n&&n!=="auto"?l.formatInTimeZone(r,n,f):l.format(r,f)}catch(r){return console.error("Date formatting error:",r),t}},I=(t,e="auto")=>{if(!t)return"";try{const n=x(t,e);return isNaN(n.getTime())?t:N(n,{addSuffix:!0})}catch(n){return console.error("Relative time formatting error:",n),t}};function j(t,e,n,s){const r=t instanceof Date?t.toISOString():String(t),o=(s==null?void 0:s.browserTimezone)||n,f=(s==null?void 0:s.isSqlCard)??!1;if(e!=null&&e.useRelativeTime)return I(r,(e==null?void 0:e.sourceTimezone)||"auto");const a=e!=null&&e.useCustomFormat&&(e!=null&&e.customFormat)?e.customFormat:(e==null?void 0:e.format)||"MM/dd/yyyy";return L(r,a,e!=null&&e.timezone&&(e==null?void 0:e.timezone)!=="auto"?e.timezone:f?o:n,(e==null?void 0:e.sourceTimezone)||"auto")}function g(t,e,n){var f,a;if(t==null)return t===null?((f=n.absence)==null?void 0:f.nullText)??"":((a=n.absence)==null?void 0:a.emptyText)??"";const s=d.isExactNumericValue(t)?t:void 0,r=s?s.value:t,o=s??(typeof t=="number"?t:void 0);if(!n.useFormattedValues||!e)return String(r);switch(e.type){case"number":return o!==void 0?y.formatNumberWithColumnSettings(o,e.numberFormat,n.locale):String(r);case"date":return j(r,e.dateFormat,n.timezone,{browserTimezone:n.browserTimezone,isSqlCard:n.isSqlCard});case"progress":return o!==void 0?`${r}%`:String(r);case"badge":case"link":case"text":case"none":default:return String(r)}}function U(t,e){return e.visibleColumns.map(n=>{const s=t[n],r=e.columnSettings[n];return g(s,r,{useFormattedValues:e.useFormattedValues,timezone:e.timezone,locale:e.locale})})}function _(t,e){var r;const n=t[t.length-1];if(!n)return"";if(n.member.kind==="others")return"Others";const s=n.member.value;return s===null?"(Blank)":((r=e==null?void 0:e.get(n.levelId))==null?void 0:r(s))??(typeof s=="object"?s.value:String(s))}function z(t,e,n){return t==="grand_total"?n??"Grand Total":t==="subtotal"?n??`${e} Total`:e}function W(t,e,n,s){var f;const r=t[t.length-1],o=e==="grand_total"?n.grand.label:r?(f=n.levels[r.levelId])==null?void 0:f.label:void 0;return z(e,_(t,s),o)}function H(t,e,n){return t.kind==="value"?(e==null?void 0:e(t.value))??"":t.kind==="null"?n.nullText:n.emptyText}function K(t){const{path:e,previousPath:n,role:s,repeatLabels:r,levelCount:o}=t;return Array.from({length:o},(f,a)=>{const h=e.slice(0,a+1),u=s==="grand_total"?a===0:s==="subtotal"&&a===e.length-1,m=n&&n.length>a&&d.matrixPathKey(n.slice(0,a+1))===d.matrixPathKey(h);return{path:h,total:u,visible:u||e.length>a&&(r||!m||a===e.length-1)}})}function C(t,e){return l.fromSemanticFormat(t??e,{preserveOmittedProperties:!0,numericInput:"canonical"})}function F(t,e,n){const s=new Map,r=(o,f)=>{const a=(f==="levels"?e.levelFormats:e.measureFormats)[o.id],h=o.semanticFormat,u=C(a,h);f==="measures"&&s.set(o.id,{isNumeric:d.normalizeAnalyticsCatalogDataType(o.column.dataType)==="number",hasTextAffixes:!!u&&!!("prefix"in u&&u.prefix||"suffix"in u&&u.suffix)});const m=c=>g(c,void 0,{useFormattedValues:!0,timezone:n.calendar.tz,locale:n.valueFormat.locale,absence:e.absence});if(o.column.temporalBucket){const c=o.column.temporalBucket,i=w.resolveTemporalBucketPresentation({metadata:c,cardFormat:(a==null?void 0:a.type)==="temporal_bucket"?a:void 0,semanticFormat:(h==null?void 0:h.type)==="temporal_bucket"?{granularity:c.granularity,format:h}:void 0,locale:n.valueFormat.locale,styles:{dateStyle:n.valueFormat.dateStyle,dateTime:n.valueFormat.dateTime}});return D=>typeof D=="string"?w.formatTemporalBucket({value:D,metadata:c,format:i.format}):m(D)}if(o.column.rawTemporal){const c=y.prepareRawTemporalFormatter({metadata:o.column.rawTemporal,format:y.resolveRawTemporalFormat({format:(u==null?void 0:u.type)==="date"?{type:"raw_temporal",timezone:u.timezone,sourceTimezone:u.sourceTimezone,presentation:u.pattern?{mode:"pattern",dialect:"semaphor_tokens",pattern:u.pattern}:{mode:"auto"}}:void 0,preferences:n.valueFormat,calendar:n.calendar})});return i=>{if(typeof i!="string")return m(i);const D=c(i);return D.ok?D.text:m(i)}}if(v.isNumericCanonicalFormat(u)){const c=y.resolveNumericPresentation(u,n.valueFormat);return i=>typeof i=="number"||typeof i=="object"&&i!==null?y.formatNumericCanonical(i,c):m(i)}return(u==null?void 0:u.type)==="duration"?c=>typeof c=="number"||typeof c=="string"||typeof c=="object"&&c!==null?y.formatDuration(typeof c=="object"?c.value:c,u):m(c):(u==null?void 0:u.type)==="string"?c=>c===null?m(c):`${u.prefix??""}${m(c)}${u.suffix??""}`:m};return{levels:new Map(t.levels.map(o=>[o.id,r(o,"levels")])),measures:new Map(t.measures.map(o=>[o.id,r(o,"measures")])),measureSemantics:s}}exports.formatCellValue=g;exports.formatDate=L;exports.formatDistanceToNow=N;exports.formatRelativeTime=I;exports.formatRowForExport=U;exports.getTimezoneAbbreviation=Y;exports.getTimezoneName=B;exports.matrixAxisLabel=W;exports.matrixCellText=H;exports.matrixLevelLabels=K;exports.matrixMemberLabel=_;exports.matrixTotalLabel=z;exports.parseWithSourceTimezone=x;exports.prepareMatrixFormatting=F;exports.resolveMatrixValueFormat=C;exports.resolveTimezone=$;
|
package/dist/chunks/{pivot-header-presentation-Dm9dUQsl.js → pivot-header-presentation-BIf4HW3L.js}
RENAMED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
var x = Object.defineProperty;
|
|
2
2
|
var T = (e, r, t) => r in e ? x(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
|
|
3
3
|
var y = (e, r, t) => T(e, typeof r != "symbol" ? r + "" : r, t);
|
|
4
|
-
import { i as C } from "./
|
|
5
|
-
import {
|
|
6
|
-
import { b as g } from "./raw-temporal-DrmCX9Wq.js";
|
|
4
|
+
import { i as C } from "./index-C8w91oj4.js";
|
|
5
|
+
import { h as g, j as _ } from "./raw-temporal-Bj6_w9cG.js";
|
|
7
6
|
import { PDF_SAFETY_LIMIT_EXCEEDED as S, getUtf8ByteLength as V, FAST_PDF_POLICY as M } from "../pdf-export-policy/index.js";
|
|
8
7
|
import { f as P } from "./temporal-bucket-B9hMwemw.js";
|
|
9
8
|
function R(e, r, t) {
|
|
@@ -37,7 +36,7 @@ function w(e, r, t) {
|
|
|
37
36
|
})
|
|
38
37
|
} : { value: e, text: R(e, r, t) };
|
|
39
38
|
}
|
|
40
|
-
function
|
|
39
|
+
function h(e, r, t, n) {
|
|
41
40
|
return e === null ? { value: e, text: null } : n === "percent" ? {
|
|
42
41
|
value: e,
|
|
43
42
|
text: g(e, {
|
|
@@ -58,13 +57,13 @@ function b(e, r, t, n) {
|
|
|
58
57
|
})
|
|
59
58
|
};
|
|
60
59
|
}
|
|
61
|
-
function
|
|
60
|
+
function b(e, r) {
|
|
62
61
|
if (e === void 0) return r;
|
|
63
62
|
if (!Number.isInteger(e) || e < 0 || e > 6)
|
|
64
63
|
throw new RangeError("Comparison precision must be an integer from 0 to 6.");
|
|
65
64
|
return e;
|
|
66
65
|
}
|
|
67
|
-
function
|
|
66
|
+
function Y(e, r) {
|
|
68
67
|
const t = {
|
|
69
68
|
mode: r.displayMode,
|
|
70
69
|
current: w(
|
|
@@ -82,19 +81,19 @@ function z(e, r) {
|
|
|
82
81
|
e.delta,
|
|
83
82
|
r.metricFormat,
|
|
84
83
|
r.locale
|
|
85
|
-
)), (r.displayMode === "percent_change" || r.displayMode === "both") && (t.percentChange =
|
|
84
|
+
)), (r.displayMode === "percent_change" || r.displayMode === "both") && (t.percentChange = h(
|
|
86
85
|
e.percentChange,
|
|
87
|
-
|
|
86
|
+
b(r.precision, 1),
|
|
88
87
|
r.locale,
|
|
89
88
|
"percent"
|
|
90
|
-
)), r.displayMode === "ratio" && (t.ratio =
|
|
89
|
+
)), r.displayMode === "ratio" && (t.ratio = h(
|
|
91
90
|
e.ratio,
|
|
92
|
-
|
|
91
|
+
b(r.precision, 2),
|
|
93
92
|
r.locale,
|
|
94
93
|
"ratio"
|
|
95
94
|
)), t;
|
|
96
95
|
}
|
|
97
|
-
function
|
|
96
|
+
function z(e) {
|
|
98
97
|
const r = e.trimStart().charAt(0);
|
|
99
98
|
return ["=", "+", "-", "@"].includes(r) || [" ", "\r", `
|
|
100
99
|
`].includes(e.charAt(0)) ? `'${e}` : e;
|
|
@@ -114,7 +113,7 @@ function k(e, r = {}) {
|
|
|
114
113
|
` } = r;
|
|
115
114
|
return e.map((o) => F(o, t)).join(n);
|
|
116
115
|
}
|
|
117
|
-
function
|
|
116
|
+
function W(e, r = {}) {
|
|
118
117
|
if (e.length === 0)
|
|
119
118
|
return "";
|
|
120
119
|
const {
|
|
@@ -134,8 +133,8 @@ function J(e, r = {}) {
|
|
|
134
133
|
}
|
|
135
134
|
return k(l, { delimiter: t, lineEnding: n });
|
|
136
135
|
}
|
|
137
|
-
const I = 1e4,
|
|
138
|
-
function
|
|
136
|
+
const I = 1e4, J = 1e6, Q = 5e6, Z = 1024 ** 3, ee = 1024 ** 3;
|
|
137
|
+
function re(e) {
|
|
139
138
|
return e > I;
|
|
140
139
|
}
|
|
141
140
|
class $ extends Error {
|
|
@@ -175,7 +174,7 @@ async function D(e) {
|
|
|
175
174
|
return { message: r };
|
|
176
175
|
}
|
|
177
176
|
}
|
|
178
|
-
async function
|
|
177
|
+
async function te(e) {
|
|
179
178
|
if (!e.token) throw new Error("Missing auth token for PDF export");
|
|
180
179
|
if (V(e.serializedPayload) > M.maxRequestBytes)
|
|
181
180
|
throw new Error("Fast-path PDF request exceeds the structured body limit");
|
|
@@ -195,7 +194,7 @@ async function oe(e) {
|
|
|
195
194
|
throw new Error("Fast-path PDF response missing download URL");
|
|
196
195
|
return t;
|
|
197
196
|
}
|
|
198
|
-
const
|
|
197
|
+
const oe = "pdf-group-continuation";
|
|
199
198
|
function O(e) {
|
|
200
199
|
if (!e.previousRow || e.row.isSubtotal === !0 || e.row.isGrandTotal === !0 || e.previousRow.isSubtotal === !0 || e.previousRow.isGrandTotal === !0)
|
|
201
200
|
return !0;
|
|
@@ -211,7 +210,7 @@ function d(e) {
|
|
|
211
210
|
function p(e) {
|
|
212
211
|
return e === B;
|
|
213
212
|
}
|
|
214
|
-
function
|
|
213
|
+
function ne(e) {
|
|
215
214
|
const r = /* @__PURE__ */ new Map(), t = (e.groupByColumns ?? []).map((o, a) => {
|
|
216
215
|
var i, f, c;
|
|
217
216
|
if (!d(o))
|
|
@@ -251,7 +250,7 @@ function U(e) {
|
|
|
251
250
|
function G(e, r) {
|
|
252
251
|
return r || `Grand ${E(e)}`;
|
|
253
252
|
}
|
|
254
|
-
function
|
|
253
|
+
function ae(e) {
|
|
255
254
|
const r = e.context.groupColumnKeys.indexOf(e.columnKey);
|
|
256
255
|
if (r < 0)
|
|
257
256
|
throw new Error(
|
|
@@ -338,7 +337,7 @@ function L(e) {
|
|
|
338
337
|
})
|
|
339
338
|
};
|
|
340
339
|
}
|
|
341
|
-
function
|
|
340
|
+
function se(e) {
|
|
342
341
|
const r = L(e).cells.find(
|
|
343
342
|
(t) => t.columnKey === e.columnKey
|
|
344
343
|
);
|
|
@@ -346,7 +345,7 @@ function le(e) {
|
|
|
346
345
|
throw new Error(`Aggregate group column "${e.columnKey}" is unknown`);
|
|
347
346
|
return r.text;
|
|
348
347
|
}
|
|
349
|
-
function
|
|
348
|
+
function le(e) {
|
|
350
349
|
return L(e).cells.map((r) => r.text);
|
|
351
350
|
}
|
|
352
351
|
class X extends Error {
|
|
@@ -356,7 +355,7 @@ class X extends Error {
|
|
|
356
355
|
this.code = t, this.name = "PivotHeaderPresentationError";
|
|
357
356
|
}
|
|
358
357
|
}
|
|
359
|
-
function
|
|
358
|
+
function ie(e) {
|
|
360
359
|
var o;
|
|
361
360
|
const r = e.mode ?? "formatted", t = e.members.map((a) => {
|
|
362
361
|
var l;
|
|
@@ -386,30 +385,30 @@ function ce(e) {
|
|
|
386
385
|
export {
|
|
387
386
|
B as A,
|
|
388
387
|
I as D,
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
388
|
+
J as F,
|
|
389
|
+
Q as M,
|
|
390
|
+
oe as P,
|
|
392
391
|
F as a,
|
|
393
392
|
k as b,
|
|
394
|
-
|
|
395
|
-
|
|
393
|
+
Z as c,
|
|
394
|
+
ee as d,
|
|
396
395
|
v as e,
|
|
397
|
-
|
|
396
|
+
Y as f,
|
|
398
397
|
$ as g,
|
|
399
398
|
D as h,
|
|
400
|
-
|
|
399
|
+
te as i,
|
|
401
400
|
p as j,
|
|
402
|
-
|
|
401
|
+
ne as k,
|
|
403
402
|
U as l,
|
|
404
403
|
G as m,
|
|
405
404
|
L as n,
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
405
|
+
W as o,
|
|
406
|
+
z as p,
|
|
407
|
+
se as q,
|
|
408
|
+
re as r,
|
|
409
|
+
ae as s,
|
|
410
|
+
le as t,
|
|
412
411
|
X as u,
|
|
413
|
-
|
|
412
|
+
ie as v,
|
|
414
413
|
O as w
|
|
415
414
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var v=Object.defineProperty;var X=(e,r,t)=>r in e?v(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var w=(e,r,t)=>X(e,typeof r!="symbol"?r+"":r,t);const D=require("./
|
|
1
|
+
"use strict";var v=Object.defineProperty;var X=(e,r,t)=>r in e?v(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var w=(e,r,t)=>X(e,typeof r!="symbol"?r+"":r,t);const D=require("./index-Cw2ypaFl.cjs"),f=require("./raw-temporal-CeblVJbu.cjs"),d=require("../pdf-export-policy/index.cjs"),k=require("./temporal-bucket-4YEPEKlJ.cjs");function G(e,r,t){const n={...r,locale:r.locale??t};if(n.type==="number")return f.formatNumericCanonical(e,n);const{prefix:o,suffix:a,...s}=n;return`${o??""}${f.formatNumericCanonical(e,{...s,negativeStyle:n.type==="currency"?n.negativeStyle:"minus"})}${a??""}`}function A(e,r,t){return e===null?{value:e,text:null}:!r||!D.isNumericCanonicalFormat(r)&&r.type!=="duration"?{value:e,text:f.formatNumericCanonical(e,{type:"number",locale:t})}:r.type==="duration"?{value:e,text:f.formatDuration(e,{inputUnit:r.inputUnit,outputStyle:r.outputStyle,largestUnit:r.largestUnit,smallestUnit:r.smallestUnit,maxUnits:r.maxUnits,prefix:r.prefix,suffix:r.suffix,negativeInParentheses:r.negativeStyle==="parentheses"})}:{value:e,text:G(e,r,t)}}function T(e,r,t,n){return e===null?{value:e,text:null}:n==="percent"?{value:e,text:f.formatNumericCanonical(e,{type:"percent",locale:t,minimumFractionDigits:r,maximumFractionDigits:r,percentValueMode:"fraction"})}:{value:e,text:f.formatNumericCanonical(e,{type:"number",locale:t,minimumFractionDigits:r,maximumFractionDigits:r,suffix:"×"})}}function _(e,r){if(e===void 0)return r;if(!Number.isInteger(e)||e<0||e>6)throw new RangeError("Comparison precision must be an integer from 0 to 6.");return e}function B(e,r){const t={mode:r.displayMode,current:A(e.currentValue,r.metricFormat,r.locale),comparison:A(e.comparisonValue,r.metricFormat,r.locale)};return(r.displayMode==="difference"||r.displayMode==="both")&&(t.difference=A(e.delta,r.metricFormat,r.locale)),(r.displayMode==="percent_change"||r.displayMode==="both")&&(t.percentChange=T(e.percentChange,_(r.precision,1),r.locale,"percent")),r.displayMode==="ratio"&&(t.ratio=T(e.ratio,_(r.precision,2),r.locale,"ratio")),t}function $(e){const r=e.trimStart().charAt(0);return["=","+","-","@"].includes(r)||[" ","\r",`
|
|
2
2
|
`].includes(e.charAt(0))?`'${e}`:e}function C(e,r=","){if(e==null)return"";const t=String(e);return t.includes(r)||t.includes('"')||t.includes(`
|
|
3
3
|
`)||t.includes("\r")?`"${t.replace(/"/g,'""')}"`:t}function b(e,r=","){return e.map(t=>C(t,r)).join(r)}function h(e,r={}){const{delimiter:t=",",lineEnding:n=`
|
|
4
|
-
`}=r;return e.map(o=>b(o,t)).join(n)}function
|
|
5
|
-
`,includeHeaders:o=!0,columns:a}=r,s=a||Object.keys(e[0]),l=[];o&&l.push(s);for(const u of e){const i=s.map(g=>{const c=u[g];return c==null?"":String(c)});l.push(i)}return h(l,{delimiter:t,lineEnding:n})}const L=1e4,
|
|
4
|
+
`}=r;return e.map(o=>b(o,t)).join(n)}function U(e,r={}){if(e.length===0)return"";const{delimiter:t=",",lineEnding:n=`
|
|
5
|
+
`,includeHeaders:o=!0,columns:a}=r,s=a||Object.keys(e[0]),l=[];o&&l.push(s);for(const u of e){const i=s.map(g=>{const c=u[g];return c==null?"":String(c)});l.push(i)}return h(l,{delimiter:t,lineEnding:n})}const L=1e4,N=1e6,j=5e6,q=1024**3,Y=1024**3;function H(e){return e>L}class R extends Error{constructor(){super(...arguments);w(this,"code",d.PDF_SAFETY_LIMIT_EXCEEDED)}}function S(e){if(!e||typeof e!="object")return;const{error:r,message:t,detail:n}=e;for(const o of[r,t,n])if(typeof o=="string"&&o.trim())return o.trim()}async function x(e){const r=`PDF request failed: ${e.status} ${e.statusText}`.trim(),t=e.headers.get("content-type")||"";try{if(t.includes("application/json")){const o=await e.json(),a=typeof o.code=="string"?o.code:typeof o.errorCode=="string"?o.errorCode:void 0;return{message:S(o)||r,code:a}}const n=await e.text();if(!n.trim())return{message:r};try{const o=JSON.parse(n),a=typeof o.code=="string"?o.code:typeof o.errorCode=="string"?o.errorCode:void 0;return{message:S(o)||n.trim(),code:a}}catch{return{message:n.trim()}}}catch{return{message:r}}}async function K(e){if(!e.token)throw new Error("Missing auth token for PDF export");if(d.getUtf8ByteLength(e.serializedPayload)>d.FAST_PDF_POLICY.maxRequestBytes)throw new Error("Fast-path PDF request exceeds the structured body limit");const r=await(e.fetchImpl??fetch)(e.url,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:e.serializedPayload,signal:e.signal});if(!r.ok){const n=await x(r);throw n.code===d.PDF_SAFETY_LIMIT_EXCEEDED?new R(n.message):new Error(n.message)}const t=await r.json();if(t!=null&&t.error)throw new Error(t.error);if(typeof(t==null?void 0:t.url)!="string"||!t.url.trim())throw new Error("Fast-path PDF response missing download URL");return t}const W="pdf-group-continuation";function P(e){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<=e.levelIndex;r++)if(e.getValue(e.row,r)!==e.getValue(e.previousRow,r))return!0;return!1}const V="__TOTAL__";function m(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function p(e){return e===V}function z(e){const r=new Map,t=(e.groupByColumns??[]).map((o,a)=>{var i,g,c;if(!m(o))throw new Error(`Aggregate groupByColumns[${a}] is invalid`);const s=typeof o.id=="string"&&o.id.length>0?o.id:void 0,l=s?(c=(g=(i=e.columnKeyMap)==null?void 0:i.byRole)==null?void 0:g.groupby)==null?void 0:c[s]:void 0,u=(l==null?void 0:l.outputKey)||(l==null?void 0:l.rawKey)||(typeof o.alias=="string"&&o.alias.length>0?o.alias:typeof o.name=="string"&&o.name.length>0?o.name:void 0);if(!u)throw new Error(`Aggregate groupByColumns[${a}] has no output key`);return[s,o.alias,o.name,u].forEach(y=>{typeof y=="string"&&y.length>0&&r.set(y,u)}),u}),n=(e.rowAggregates??[]).flatMap(o=>!m(o)||typeof o.function!="string"||typeof o.groupLevel!="string"?[]:[{function:o.function,groupLevel:o.groupLevel==="ALL"?"ALL":r.get(o.groupLevel)||o.groupLevel,...typeof o.label=="string"?{label:o.label}:{}}]);return{groupColumnKeys:t,rowAggregates:n}}function M(e){return e==="SUM"?"Total":e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function O(e){var t;if(e.customLabel)return e.customLabel;const r=M(e.aggregateFunction);if(e.levelValue!==void 0&&!p(e.levelValue)){if(e.levelValue===null){const o=(t=e.formatValue)==null?void 0:t.call(e,null);return o?`Subtotal ${o}`:`Subtotal ${r}`}const n=e.formatValue?e.formatValue(e.levelValue):String(e.levelValue);if(n)return`Subtotal (${n})`}return`Subtotal ${r}`}function F(e,r){return r||`Grand ${M(e)}`}function J(e){const r=e.context.groupColumnKeys.indexOf(e.columnKey);if(r<0)throw new Error(`Aggregate group column "${e.columnKey}" is unknown`);return P({row:e.row,previousRow:e.previousRow,levelIndex:r,getValue:(t,n)=>t[e.context.groupColumnKeys[n]]})}function E(e){var n,o;const r=e.context.groupColumnKeys,t=typeof e.row.aggregate=="string"?e.row.aggregate:"SUM";if(e.row.isGrandTotal===!0){const a=(n=e.context.rowAggregates.find(s=>s.groupLevel==="ALL"))==null?void 0:n.label;return{kind:"grand-total",cells:r.map((s,l)=>({columnKey:s,text:l===0?F(t,a):"",placement:l===0?"label":"empty",colSpan:l===0?r.length:1}))}}if(e.row.isSubtotal===!0){if(typeof e.row.subtotalLevel!="string")throw new Error("Aggregate subtotal row is missing subtotalLevel");const a=r.indexOf(e.row.subtotalLevel);if(a<0)throw new Error(`Aggregate subtotal level "${e.row.subtotalLevel}" has no group column`);const s=m(e.row.subtotalContext)?e.row.subtotalContext:void 0,l=m(s==null?void 0:s.groupByValues)?s.groupByValues:{},u=(o=e.context.rowAggregates.find(i=>i.groupLevel===e.row.subtotalLevel&&i.function===t))==null?void 0:o.label;return{kind:"subtotal",cells:r.map((i,g)=>{if(g>a)return{columnKey:i,text:"",placement:"empty",colSpan:1};if(g<a){const c=e.row[i];return{columnKey:i,text:c===void 0||p(c)?"":e.formatValue(c,i),placement:"value",colSpan:1}}return{columnKey:i,text:O({aggregateFunction:t,customLabel:u,levelValue:l[i],formatValue:c=>e.formatLabelValue?e.formatLabelValue(c,i):String(e.formatValue(c,i)??"")}),placement:"label",colSpan:r.length-a}})}}return{kind:"data",cells:r.map(a=>{const s=e.row[a];return{columnKey:a,text:s===void 0||p(s)?"":e.formatValue(s,a),placement:"value",colSpan:1}})}}function Q(e){const r=E(e).cells.find(t=>t.columnKey===e.columnKey);if(!r)throw new Error(`Aggregate group column "${e.columnKey}" is unknown`);return r.text}function Z(e){return E(e).cells.map(r=>r.text)}class I extends Error{constructor(t,n){super(`${t}: ${n}`);w(this,"deliveryBlocking",!0);this.code=t,this.name="PivotHeaderPresentationError"}}function ee(e){var o;const r=e.mode??"formatted",t=e.members.map(a=>{var l;if(r==="canonical"||!a.temporalBucket)return a.value===null?"":String(a.value);const s=(l=e.resolveTemporalFormat)==null?void 0:l.call(e,a.fieldId);if(!s)throw new I("missing_resolved_temporal_format",`Missing resolved temporal presentation for pivot field "${a.fieldId}"`);return k.formatTemporalBucket({value:a.value,metadata:a.temporalBucket,format:s})}),n=((o=e.metricLabel)==null?void 0:o.trim())||void 0;return{memberLabels:t,...n?{metricLabel:n}:{},flattenedLabel:[...t,...n?[n]:[]].join(" / ")}}exports.AGGREGATE_TOTAL_MEMBER_MARKER=V;exports.DIRECT_CSV_EXPORT_MAX_ROWS=L;exports.FULL_DATASET_CSV_EXPORT_MAX_ROWS=N;exports.MATRIX_EXPORT_MAX_ARTIFACT_BYTES=Y;exports.MATRIX_EXPORT_MAX_CELLS=j;exports.MATRIX_EXPORT_MAX_ENCODED_BYTES=q;exports.PDF_GROUP_CONTINUATION_CLASS=W;exports.PdfSafetyLimitError=R;exports.PivotHeaderPresentationError=I;exports.arrayToCSV=h;exports.arrayToCSVRow=b;exports.escapeCSVValue=C;exports.formatAggregateGrandTotalLabel=F;exports.formatAggregateGroupCell=Q;exports.formatAggregateGroupRow=Z;exports.formatAggregateSubtotalLabel=O;exports.formatMetricComparison=B;exports.isAggregateTotalMemberMarker=p;exports.objectsToCSV=U;exports.presentAggregateGroupRow=E;exports.presentPivotHeader=ee;exports.protectCSVText=$;exports.readPdfErrorResponse=x;exports.requestStructuredPdf=K;exports.requiresChunkedCsvExport=H;exports.resolveAggregateTablePresentationContext=z;exports.shouldPresentAggregateGroupValue=J;exports.shouldPresentGroupedTableValue=P;
|