react-semaphor 0.1.545 → 0.1.547
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 +408 -442
- package/dist/assistant-context/index.js +1 -1
- package/dist/assistant-protocol/index.js +100 -76
- package/dist/brand-studio/index.js +4 -4
- package/dist/briefings/index.js +6 -6
- package/dist/chunks/{add-to-dashboard-BuAqfA2Y.js → add-to-dashboard-BQRAAnc3.js} +55 -33
- package/dist/chunks/{analytics-base-schemas-BFAoRlkU.js → analytics-base-schemas-BKs3flFS.js} +2 -2
- package/dist/chunks/applied-constraints-DU-wndZ7.js +47 -0
- package/dist/chunks/{assistant-chat-D7sWTypJ.js → assistant-chat-CK84cPAB.js} +2826 -2595
- package/dist/chunks/{bookmark-state-CXw7lZ50.js → bookmark-state-Cu-a5ie_.js} +8 -15
- package/dist/chunks/comparison-window-caption-C2xF-eWw.js +1433 -0
- package/dist/chunks/{context-ClREvqCZ.js → context-BerEBuFR.js} +11 -6
- package/dist/chunks/custom-visual-inputs-ChL54gGm.js +295 -0
- package/dist/chunks/{dashboard-B1tMju0u.js → dashboard-DCk26-6i.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-CePgIu0Z.js → dashboard-briefing-launcher-CQ1eYsGy.js} +1291 -1277
- package/dist/chunks/dashboard-controls-BMeZjF7r.js +2307 -0
- package/dist/chunks/{dashboard-json-CoYRPqxx.js → dashboard-json-BZqCoanC.js} +5 -5
- package/dist/chunks/{document-dashboard-inputs-BesAHZvB.js → document-dashboard-inputs-tYd7ao0o.js} +877 -979
- package/dist/chunks/{edit-dashboard-visual-JPtNfJRb.js → edit-dashboard-visual-Bv3MHM_G.js} +2157 -2243
- package/dist/chunks/filter-reach-copy-CGWsL_ez.js +3480 -0
- package/dist/chunks/{filter-value-text-ff7osJr7.js → filter-value-text-Ddf55Ku1.js} +9 -9
- package/dist/chunks/global-date-filter-utils-BhAu8zIM.js +12137 -0
- package/dist/chunks/index-CtoK1Lgu.js +586 -0
- package/dist/chunks/{index-DRWiuqyd.js → index-DmrLP5Ro.js} +105 -104
- package/dist/chunks/list-filter-DsaTbM3J.js +15 -0
- package/dist/chunks/matrix-analytical-definition-B9vW-osb.js +717 -0
- package/dist/chunks/{matrix-card-DjwWcCo8.js → matrix-card-LiMEipvq.js} +3 -3
- package/dist/chunks/{matrix-formatter-DnCyRXJE.js → matrix-formatter-DWEeC0_c.js} +44 -44
- package/dist/chunks/{matrix-member-presentation-CQGdVks6.js → matrix-member-presentation-DqzG-UhQ.js} +1 -1
- package/dist/chunks/{matrix-operation-contract-8OIO4gob.js → matrix-operation-contract-D6vYkZK4.js} +72 -72
- package/dist/chunks/{metric-comparison-DEwi9uc2.js → metric-comparison-zpGw4lD6.js} +2 -2
- package/dist/chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js +119 -0
- package/dist/chunks/{pivot-header-presentation-DHcx1XGQ.js → pivot-header-presentation-CQnIDtUv.js} +1 -1
- package/dist/chunks/{pivot-result-identity-DJhXXcns.js → pivot-result-identity-C-Q1j1Wb.js} +1 -1
- package/dist/chunks/{pivot-result-lifecycle-DM4CyGKs.js → pivot-result-lifecycle-pwq3b7LC.js} +571 -380
- package/dist/chunks/{raw-temporal-contract-C51YG48G.js → raw-temporal-contract-WuXA8jBP.js} +1 -1
- package/dist/chunks/{raw-temporal-presentation-C3mUgnEx.js → raw-temporal-presentation-DypB7sMX.js} +8 -8
- package/dist/chunks/{report-preferences-dialog-DUtuUL_5.js → report-preferences-dialog-DoVyriYC.js} +154 -155
- package/dist/chunks/{report-runtime-context-Dq8XyODK.js → report-runtime-context-hWiTCzFV.js} +2 -2
- package/dist/chunks/resolve-dashboard-input-context-D0JDUa4h.js +5576 -0
- package/dist/chunks/{saved-dashboard-context-LrF_kW0l.js → saved-dashboard-context-BfAH5j4L.js} +34 -34
- package/dist/chunks/{selection-reducer-Dj_8xD69.js → selection-reducer-CJzkTZio.js} +15 -15
- package/dist/chunks/{semaphor-ready-indicator-BxF96Yhv.js → semaphor-ready-indicator-CRm17oIP.js} +51771 -52574
- package/dist/chunks/{shelf-drop-preview-context-CNaM_Gmh.js → shelf-drop-preview-context-vy6P9THz.js} +7 -7
- package/dist/chunks/{source-entity-resolution-BYn9giz3.js → source-entity-resolution-BIGRvtbG.js} +13 -13
- package/dist/chunks/{switch-uDtPgQlQ.js → switch-CEBOR4n7.js} +3 -3
- package/dist/chunks/{table-export-sheet-YzMioA7Y.js → table-export-sheet-4X9mAG3V.js} +1 -1
- package/dist/chunks/table-settings-WysCBj62.js +614 -0
- package/dist/chunks/{temporal-bucket-D7NBrrtL.js → temporal-bucket-CQOSbv9-.js} +26 -26
- package/dist/chunks/{token-types-DBbZVQsm.js → token-types-BMqRmT-C.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-CjB7ig1o.js → use-create-flow-overlay-state-Csx_Xjsh.js} +101 -101
- package/dist/chunks/{validators-DMHTpf7a.js → validators-C-aOQlTB.js} +713 -658
- package/dist/chunks/{relative-date-label-Bk2j94pA.js → zoned-wall-clock-MulfA26h.js} +64 -21
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +1895 -1163
- package/dist/data-app-sdk/index.js +6 -6
- package/dist/data-app-sdk-adapters/index.js +3 -3
- package/dist/data-app-sdk-validation/index.js +14 -14
- package/dist/format-utils/index.js +133 -133
- package/dist/index.js +192 -186
- package/dist/layouts/index.js +5 -242
- package/dist/report-runtime-context/index.js +2 -2
- package/dist/shared/index.js +4 -5
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/components/surfboard/arrange-layout-button.d.ts +8 -0
- package/dist/types/components/surfboard/filter/types.d.ts +7 -0
- package/dist/types/components/surfboard/screen-size-preview-button.d.ts +10 -0
- package/dist/types/components/visual/matrix-table/matrix-card-view.d.ts +3 -0
- package/dist/types/index.js +6 -6
- package/dist/types/lib/charts/table-chart-types.d.ts +4 -0
- package/dist/types/lib/charts/types.d.ts +2 -2
- package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-authoring.d.ts +346 -21
- package/dist/types/lib/dashboard-inputs/dashboard-filter-value-identity.d.ts +65 -0
- package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +6 -0
- package/dist/types/lib/dashboard-inputs/filter-settings.d.ts +2 -0
- package/dist/types/lib/dashboard-inputs/prepare-loaded-dashboard.d.ts +15 -0
- package/dist/types/lib/dashboard-inputs/resolve-selection-input.d.ts +3 -3
- package/dist/types/lib/hooks/use-dashboard-card.d.ts +2 -0
- package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +1 -1
- package/dist/types/lib/matrix-table/matrix-editor.d.ts +52 -0
- package/dist/types/lib/matrix-table/matrix-runtime-types.d.ts +9 -1
- package/dist/types/lib/matrix-table/matrix-runtime.d.ts +5 -1
- package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +149 -10
- package/dist/types/lib/stores/dashboard-store.d.ts +137 -6
- package/dist/types/lib/types/common-types.d.ts +8 -0
- package/dist/types/lib/types/explorer-types.d.ts +10 -0
- package/dist/types/lib/types/semantic-types.d.ts +84 -0
- package/dist/types/lib/utils/build-saved-editor-card.d.ts +20 -0
- package/dist/types/lib/utils/card-type-change.d.ts +16 -0
- package/dist/types/lib/utils/field-availability-context.d.ts +25 -0
- package/dist/types/lib/utils/field-placement.d.ts +96 -0
- package/dist/types/lib/utils/field-state-calculator.d.ts +161 -0
- package/dist/types/lib/utils/qualified-entity-name.d.ts +2 -0
- package/dist/types/shared/analytics-protocol/applied-constraints.d.ts +57 -1
- package/dist/types/shared/analytics-protocol/field-provenance.d.ts +89 -0
- package/dist/types/shared/analytics-protocol/index.d.ts +2 -0
- package/dist/types/shared/analytics-protocol/query-policies.d.ts +52 -0
- package/dist/types/shared/analytics-protocol/time-window-schema.d.ts +1 -1
- package/dist/types/shared/analytics-protocol/time-window.d.ts +40 -1
- package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +4 -1
- package/dist/types/shared/assistant-protocol/answer-text.d.ts +20 -0
- package/dist/types/shared/assistant-protocol/context.d.ts +29 -29
- package/dist/types/shared/assistant-protocol/index.d.ts +1 -0
- package/dist/types/shared/assistant-protocol/limits.d.ts +6 -1
- package/dist/types/shared/assistant-protocol/parts.d.ts +43 -3
- package/dist/types/shared/assistant-protocol/request.d.ts +14 -2
- package/dist/types/shared/dashboard-authoring/calculated-field-identity.d.ts +3 -0
- package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +487 -0
- package/dist/types/shared/dashboard-authoring/changes/card-types.d.ts +34 -0
- package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +7886 -0
- package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +45 -0
- package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +54 -0
- package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +96 -0
- package/dist/types/shared/dashboard-authoring/click-to-filter-settings.d.ts +3 -3
- package/dist/types/shared/dashboard-authoring/column-catalog.d.ts +32 -0
- package/dist/types/shared/dashboard-authoring/contracts.d.ts +0 -55
- package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +24 -14
- package/dist/types/shared/dashboard-authoring/dashboard-card-source-index.d.ts +9 -1
- package/dist/types/shared/dashboard-authoring/dashboard-filter-automatic-target.d.ts +4 -4
- package/dist/types/shared/dashboard-authoring/dashboard-filter-mapping-contract.d.ts +3 -1
- package/dist/types/shared/dashboard-authoring/dashboard-filter-mapping-types.d.ts +27 -1
- package/dist/types/shared/dashboard-authoring/dashboard-filter-value-compatibility.d.ts +12 -3
- package/dist/types/shared/dashboard-authoring/dashboard-input-scope.d.ts +26 -0
- package/dist/types/shared/dashboard-authoring/filter-applicability.d.ts +75 -0
- package/dist/types/shared/dashboard-authoring/filter-reach-copy.d.ts +18 -0
- package/dist/types/shared/dashboard-authoring/filter-reach-preview.d.ts +97 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +22 -2
- package/dist/types/shared/dashboard-authoring/operations/apply-dashboard-operations.d.ts +10 -37
- package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +189 -0
- package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +101 -0
- package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +100 -0
- package/dist/types/shared/dashboard-authoring/semantic-auto-join-card.d.ts +22 -0
- package/dist/types/shared/dashboard-authoring/validators.d.ts +1 -2
- package/dist/types/shared/layouts/engine/grid.d.ts +25 -0
- package/dist/types/shared/layouts/engine/index.d.ts +4 -0
- package/dist/types/shared/layouts/engine/sheet-layout.d.ts +7 -0
- package/dist/types/shared/layouts/engine/types.d.ts +125 -0
- package/dist/types/shared/layouts/index.d.ts +1 -2
- package/package.json +2 -2
- package/dist/chunks/apply-dashboard-operations-CZEMsx8E.js +0 -2080
- package/dist/chunks/calendar-day-equality-dvoQp1xW.js +0 -410
- package/dist/chunks/comparison-window-caption-D4E6IHPD.js +0 -1624
- package/dist/chunks/custom-visual-inputs-DLCD9Y5V.js +0 -329
- package/dist/chunks/dashboard-controls-Cq05n3e0.js +0 -2315
- package/dist/chunks/dashboard-filter-value-compatibility-CwQ_iSNb.js +0 -108
- package/dist/chunks/matrix-analytical-definition-C7Gb0e12.js +0 -117
- package/dist/chunks/normalize-dashboard-for-dirty-check-Bk3VYv_q.js +0 -67
- package/dist/chunks/numeric-presentation-7X_IrD58.js +0 -5226
- package/dist/chunks/resolve-dashboard-input-context-DJ2tICwz.js +0 -9415
- package/dist/chunks/stable-serialize-CfqXeiBP.js +0 -6
- package/dist/chunks/table-settings-CLZocegs.js +0 -501
- package/dist/chunks/use-debounced-dirty-check-BwAbnX_5.js +0 -59
- package/dist/chunks/zoned-wall-clock-BkxV9jS2.js +0 -46
- package/dist/types/shared/dashboard-authoring/change-compiler.d.ts +0 -7
- package/dist/types/shared/dashboard-authoring/layout-compiler.d.ts +0 -2
- package/dist/types/shared/layouts/create-frame-layouts.d.ts +0 -27
- package/dist/types/shared/layouts/frame-layouts.d.ts +0 -23
|
@@ -0,0 +1,1433 @@
|
|
|
1
|
+
var je = Object.defineProperty;
|
|
2
|
+
var Ge = (e, t, r) => t in e ? je(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var ce = (e, t, r) => Ge(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { i as ze, j as O, m as He, c as Xe, p as We, J as Ye, a as G, F as Ze, G as qe, f as Je, I as Qe } from "./temporal-bucket-CQOSbv9-.js";
|
|
5
|
+
import { i as Me, m as ee, j as Le, k as et, l as ke, a as ue, d as tt, n as $ } from "./matrix-formatter-DWEeC0_c.js";
|
|
6
|
+
import { h as Y, e as rt, p as ot, k as nt } from "./export-file-format-C-tJsxsf.js";
|
|
7
|
+
import { aI as K, ab as at, t as H, aH as st, v as re, u as it } from "./validators-C-aOQlTB.js";
|
|
8
|
+
import "./matrix-operation-contract-D6vYkZK4.js";
|
|
9
|
+
import "./analytics-base-schemas-BKs3flFS.js";
|
|
10
|
+
import "zod";
|
|
11
|
+
import { D as Ae, a as lt, t as me, s as ct, P as de, l as ut, o as mt, v as dt, J as V } from "./pivot-result-lifecycle-pwq3b7LC.js";
|
|
12
|
+
import { PDF_SAFETY_LIMIT_EXCEEDED as Ie, getUtf8ByteLength as ft, FAST_PDF_POLICY as gt } from "../pdf-export-policy/index.js";
|
|
13
|
+
import { p as pt } from "./pivot-header-presentation-CQnIDtUv.js";
|
|
14
|
+
import { d as bt, c as fe } from "./pivot-result-identity-C-Q1j1Wb.js";
|
|
15
|
+
import { v as yt } from "./raw-temporal-contract-WuXA8jBP.js";
|
|
16
|
+
import { g as ht } from "./zoned-wall-clock-MulfA26h.js";
|
|
17
|
+
function wt(e, t, r) {
|
|
18
|
+
const n = {
|
|
19
|
+
...t,
|
|
20
|
+
locale: t.locale ?? r
|
|
21
|
+
};
|
|
22
|
+
if (n.type === "number")
|
|
23
|
+
return O(e, n);
|
|
24
|
+
const { prefix: o, suffix: i, ...a } = n;
|
|
25
|
+
return `${o ?? ""}${O(e, {
|
|
26
|
+
...a,
|
|
27
|
+
negativeStyle: n.type === "currency" ? n.negativeStyle : "minus"
|
|
28
|
+
})}${i ?? ""}`;
|
|
29
|
+
}
|
|
30
|
+
function Z(e, t, r) {
|
|
31
|
+
return e === null ? { value: e, text: null } : !t || !ze(t) && t.type !== "duration" ? {
|
|
32
|
+
value: e,
|
|
33
|
+
text: O(e, { type: "number", locale: r })
|
|
34
|
+
} : t.type === "duration" ? {
|
|
35
|
+
value: e,
|
|
36
|
+
text: He(e, {
|
|
37
|
+
inputUnit: t.inputUnit,
|
|
38
|
+
outputStyle: t.outputStyle,
|
|
39
|
+
largestUnit: t.largestUnit,
|
|
40
|
+
smallestUnit: t.smallestUnit,
|
|
41
|
+
maxUnits: t.maxUnits,
|
|
42
|
+
prefix: t.prefix,
|
|
43
|
+
suffix: t.suffix,
|
|
44
|
+
negativeInParentheses: t.negativeStyle === "parentheses"
|
|
45
|
+
})
|
|
46
|
+
} : { value: e, text: wt(e, t, r) };
|
|
47
|
+
}
|
|
48
|
+
function ge(e, t, r, n) {
|
|
49
|
+
return e === null ? { value: e, text: null } : n === "percent" ? {
|
|
50
|
+
value: e,
|
|
51
|
+
text: O(e, {
|
|
52
|
+
type: "percent",
|
|
53
|
+
locale: r,
|
|
54
|
+
minimumFractionDigits: t,
|
|
55
|
+
maximumFractionDigits: t,
|
|
56
|
+
percentValueMode: "fraction"
|
|
57
|
+
})
|
|
58
|
+
} : {
|
|
59
|
+
value: e,
|
|
60
|
+
text: O(e, {
|
|
61
|
+
type: "number",
|
|
62
|
+
locale: r,
|
|
63
|
+
minimumFractionDigits: t,
|
|
64
|
+
maximumFractionDigits: t,
|
|
65
|
+
suffix: "×"
|
|
66
|
+
})
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function pe(e, t) {
|
|
70
|
+
if (e === void 0) return t;
|
|
71
|
+
if (!Number.isInteger(e) || e < 0 || e > 6)
|
|
72
|
+
throw new RangeError("Comparison precision must be an integer from 0 to 6.");
|
|
73
|
+
return e;
|
|
74
|
+
}
|
|
75
|
+
function Dr(e, t) {
|
|
76
|
+
const r = {
|
|
77
|
+
mode: t.displayMode,
|
|
78
|
+
current: Z(
|
|
79
|
+
e.currentValue,
|
|
80
|
+
t.metricFormat,
|
|
81
|
+
t.locale
|
|
82
|
+
),
|
|
83
|
+
comparison: Z(
|
|
84
|
+
e.comparisonValue,
|
|
85
|
+
t.metricFormat,
|
|
86
|
+
t.locale
|
|
87
|
+
)
|
|
88
|
+
};
|
|
89
|
+
return (t.displayMode === "difference" || t.displayMode === "both") && (r.difference = Z(
|
|
90
|
+
e.delta,
|
|
91
|
+
t.metricFormat,
|
|
92
|
+
t.locale
|
|
93
|
+
)), (t.displayMode === "percent_change" || t.displayMode === "both") && (r.percentChange = ge(
|
|
94
|
+
e.percentChange,
|
|
95
|
+
pe(t.precision, 1),
|
|
96
|
+
t.locale,
|
|
97
|
+
"percent"
|
|
98
|
+
)), t.displayMode === "ratio" && (r.ratio = ge(
|
|
99
|
+
e.ratio,
|
|
100
|
+
pe(t.precision, 2),
|
|
101
|
+
t.locale,
|
|
102
|
+
"ratio"
|
|
103
|
+
)), r;
|
|
104
|
+
}
|
|
105
|
+
const vt = /* @__PURE__ */ new Set(["second", "minute", "hour", "day", "month"]);
|
|
106
|
+
function xt(e) {
|
|
107
|
+
const { presentation: t } = e;
|
|
108
|
+
return e.formattedValues ? (t == null ? void 0 : t.kind) === "text" || (t == null ? void 0 : t.kind) === "measure" && t.format.type === "duration" ? "text" : (t == null ? void 0 : t.kind) === "temporal_bucket" ? vt.has(t.grain) ? "date" : "text" : (t == null ? void 0 : t.kind) === "datetime" ? "date" : e.dataType === "number" ? "number" : e.dataType === "boolean" ? "boolean" : e.dataType === "unknown" ? "by_value" : "text" : "by_value";
|
|
109
|
+
}
|
|
110
|
+
function Ct(e) {
|
|
111
|
+
const t = (o, i) => Number.isInteger(o) ? Math.min(20, Math.max(0, o)) : i, r = t(e.minimumFractionDigits, 0), n = Math.max(r, t(e.maximumFractionDigits, 2));
|
|
112
|
+
return n === 0 ? "" : `.${"0".repeat(n)}`;
|
|
113
|
+
}
|
|
114
|
+
function q(e) {
|
|
115
|
+
return `"${e.replace(/"/g, "")}"`;
|
|
116
|
+
}
|
|
117
|
+
function Tt(e) {
|
|
118
|
+
let t;
|
|
119
|
+
try {
|
|
120
|
+
t = new Intl.NumberFormat(e.locale ?? "en-US", {
|
|
121
|
+
style: "currency",
|
|
122
|
+
currency: e.currency || "USD"
|
|
123
|
+
}).formatToParts(1);
|
|
124
|
+
} catch {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const r = t.findIndex((i) => i.type === "currency"), n = t.findIndex((i) => i.type === "integer");
|
|
128
|
+
if (r < 0 || n < 0) return;
|
|
129
|
+
const o = (i, a) => t.slice(i, a).filter((l) => l.type === "literal").map((l) => l.value.replace(/\s/g, " ")).join("");
|
|
130
|
+
return r < n ? { side: "before", text: t[r].value + o(r + 1, n) } : {
|
|
131
|
+
side: "after",
|
|
132
|
+
text: o(n + 1, r) + t[r].value
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function Et(e) {
|
|
136
|
+
const t = Ct(e);
|
|
137
|
+
let r;
|
|
138
|
+
if (e.type === "scientific")
|
|
139
|
+
r = `0${t}E+00`;
|
|
140
|
+
else {
|
|
141
|
+
const n = `${e.useGrouping === !1 ? "0" : "#,##0"}${t}`;
|
|
142
|
+
if (e.type === "currency") {
|
|
143
|
+
const o = Tt(e);
|
|
144
|
+
r = o ? o.side === "before" ? `${q(o.text)}${n}` : `${n}${q(o.text)}` : n;
|
|
145
|
+
} else e.type === "percent" ? r = e.percentValueMode === "whole" ? `${n}${q("%")}` : `${n}%` : r = n;
|
|
146
|
+
}
|
|
147
|
+
return e.negativeStyle === "parentheses" ? `${r};(${r})` : r;
|
|
148
|
+
}
|
|
149
|
+
function St(e, t) {
|
|
150
|
+
if (!e.formattedValues) return;
|
|
151
|
+
const { presentation: r } = e;
|
|
152
|
+
if (t === "number" || t === "by_value")
|
|
153
|
+
return (r == null ? void 0 : r.kind) !== "measure" || r.format.type === "duration" ? void 0 : Et(r.format);
|
|
154
|
+
if (t === "date") {
|
|
155
|
+
if ((r == null ? void 0 : r.kind) === "temporal_bucket")
|
|
156
|
+
return r.grain === "day" ? "yyyy-mm-dd" : r.grain === "month" ? "mmm yyyy" : "yyyy-mm-dd hh:mm";
|
|
157
|
+
if ((r == null ? void 0 : r.kind) === "datetime")
|
|
158
|
+
return r.dateOnly ? "yyyy-mm-dd" : "yyyy-mm-dd hh:mm:ss";
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function be(e) {
|
|
162
|
+
const t = xt(e), r = St(e, t);
|
|
163
|
+
return Object.freeze({
|
|
164
|
+
key: e.key,
|
|
165
|
+
label: e.label,
|
|
166
|
+
cellType: t,
|
|
167
|
+
...r === void 0 ? {} : { numberFormat: r }
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
const Ft = 15, Mt = /^-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/;
|
|
171
|
+
function $e(e) {
|
|
172
|
+
return Mt.test(e) ? e : void 0;
|
|
173
|
+
}
|
|
174
|
+
function ye(e) {
|
|
175
|
+
const r = e.replace(/^-/, "").replace(/[eE].*$/, "").replace(".", "").replace(/^0+/, "").replace(/0+$/, "");
|
|
176
|
+
if (r.length > Ft) return !1;
|
|
177
|
+
const n = Number(e);
|
|
178
|
+
return Number.isFinite(n) && (n !== 0 || r.length === 0);
|
|
179
|
+
}
|
|
180
|
+
const Lt = Date.UTC(1900, 2, 1), kt = Date.UTC(1e4, 0, 1), At = Date.UTC(1899, 11, 30), It = 864e5;
|
|
181
|
+
function $t(e) {
|
|
182
|
+
const t = Date.UTC(
|
|
183
|
+
e.year,
|
|
184
|
+
e.month - 1,
|
|
185
|
+
e.day,
|
|
186
|
+
e.hour,
|
|
187
|
+
e.minute,
|
|
188
|
+
e.second
|
|
189
|
+
);
|
|
190
|
+
if (!(e.year < 1900 || !Number.isFinite(t)) && !(t < Lt || t >= kt))
|
|
191
|
+
return (t - At) / It;
|
|
192
|
+
}
|
|
193
|
+
function he(e, t, r) {
|
|
194
|
+
if (typeof e == "number")
|
|
195
|
+
return Number.isFinite(e) ? { kind: "number", text: t, value: e } : void 0;
|
|
196
|
+
if (K(e))
|
|
197
|
+
return ye(e.value) ? { kind: "number", text: t, value: e } : void 0;
|
|
198
|
+
if (r && typeof e == "string") {
|
|
199
|
+
const n = $e(e);
|
|
200
|
+
return n !== void 0 && ye(n) ? { kind: "number", text: t, value: n } : void 0;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
function P(e) {
|
|
204
|
+
const { value: t, text: r, column: n } = e;
|
|
205
|
+
if (r === "") return { kind: "empty" };
|
|
206
|
+
const o = { kind: "text", text: r };
|
|
207
|
+
switch (n.cellType) {
|
|
208
|
+
case "text":
|
|
209
|
+
return o;
|
|
210
|
+
case "date": {
|
|
211
|
+
const i = e.wallClock ? $t(e.wallClock) : void 0;
|
|
212
|
+
return i === void 0 ? o : { kind: "date", text: r, serial: i };
|
|
213
|
+
}
|
|
214
|
+
case "number":
|
|
215
|
+
return he(t, r, !0) ?? o;
|
|
216
|
+
case "boolean":
|
|
217
|
+
return typeof t == "boolean" ? { kind: "boolean", text: r, value: t } : o;
|
|
218
|
+
case "by_value":
|
|
219
|
+
return typeof t == "boolean" ? { kind: "boolean", text: r, value: t } : he(t, r, !1) ?? o;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
function Pr(e) {
|
|
223
|
+
return e.kind === "empty" ? "" : e.text;
|
|
224
|
+
}
|
|
225
|
+
const _e = 1e4, _t = 1e6, Nr = 5e6, Vr = 1024 ** 3, Or = 1024 ** 3;
|
|
226
|
+
function Kr(e) {
|
|
227
|
+
return e > _e;
|
|
228
|
+
}
|
|
229
|
+
function Ur(e) {
|
|
230
|
+
return e.cardType === "matrixTable" ? "try-direct" : e.loadedRowCount === null || e.loadedRowCount <= _e ? "direct" : e.loadedRowCount <= _t ? "background" : "blocked";
|
|
231
|
+
}
|
|
232
|
+
const Br = {
|
|
233
|
+
rowLabels: "tabular",
|
|
234
|
+
subtotals: "after"
|
|
235
|
+
};
|
|
236
|
+
function jr(e, t) {
|
|
237
|
+
const r = t.rowLabels === "outline" ? { kind: "compact" } : e.layout.kind === "tabular" ? e.layout : { kind: "tabular", repeatLabels: !1 }, n = e.totals.rows;
|
|
238
|
+
return {
|
|
239
|
+
...e,
|
|
240
|
+
layout: r,
|
|
241
|
+
totals: {
|
|
242
|
+
...e.totals,
|
|
243
|
+
rows: {
|
|
244
|
+
...n,
|
|
245
|
+
levels: Object.fromEntries(
|
|
246
|
+
Object.entries(n.levels).map(([o, i]) => [
|
|
247
|
+
o,
|
|
248
|
+
{ ...i, position: t.subtotals }
|
|
249
|
+
])
|
|
250
|
+
)
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
const Rt = 2;
|
|
256
|
+
function Dt(e) {
|
|
257
|
+
return typeof e == "number" ? Number.isInteger(e) : K(e) ? !e.value.includes(".") : !0;
|
|
258
|
+
}
|
|
259
|
+
function Pt(e, t, r) {
|
|
260
|
+
const n = e.descriptors.measures.filter(
|
|
261
|
+
(a) => r.measureFormats[a.id] === void 0 && a.semanticFormat === void 0 && at(a.column.dataType) === "number"
|
|
262
|
+
);
|
|
263
|
+
if (n.length === 0) return r;
|
|
264
|
+
const o = /* @__PURE__ */ new Set();
|
|
265
|
+
e.columns.forEach((a, l) => {
|
|
266
|
+
if (!(a.kind !== "measure" || o.has(a.measureId)))
|
|
267
|
+
for (const d of t) {
|
|
268
|
+
const u = d.values[l];
|
|
269
|
+
if ((u == null ? void 0 : u.kind) === "value" && !Dt(u.value)) {
|
|
270
|
+
o.add(a.measureId);
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
const i = { ...r.measureFormats };
|
|
276
|
+
for (const { id: a } of n) {
|
|
277
|
+
const l = o.has(a) ? Rt : 0;
|
|
278
|
+
i[a] = {
|
|
279
|
+
type: "number",
|
|
280
|
+
minimumFractionDigits: l,
|
|
281
|
+
maximumFractionDigits: l,
|
|
282
|
+
useGrouping: !0
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
return { ...r, measureFormats: i };
|
|
286
|
+
}
|
|
287
|
+
function z(e) {
|
|
288
|
+
return H(e.slice(0, -1));
|
|
289
|
+
}
|
|
290
|
+
function Nt(e, t) {
|
|
291
|
+
return t.length > e.length && H(t.slice(0, e.length)) === H(e);
|
|
292
|
+
}
|
|
293
|
+
function Vt(e) {
|
|
294
|
+
return e.map((t, r) => {
|
|
295
|
+
if (r === 0 || t.kind !== "layout") return !1;
|
|
296
|
+
const n = e[r - 1];
|
|
297
|
+
if (n.kind !== "layout") return !1;
|
|
298
|
+
if (t.role !== "member" || Nt(n.rowPath, t.rowPath)) return !0;
|
|
299
|
+
const o = e[r - 2];
|
|
300
|
+
return n.role === "member" && (!o || o.kind !== "layout" || o.role !== "member" || z(o.rowPath) !== z(n.rowPath)) && t.rowPath.length === n.rowPath.length && z(t.rowPath) === z(n.rowPath);
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
const Ot = "pdf-group-continuation";
|
|
304
|
+
function Kt(e) {
|
|
305
|
+
if (!e.previousRow || e.row.isSubtotal === !0 || e.row.isGrandTotal === !0 || e.previousRow.isSubtotal === !0 || e.previousRow.isGrandTotal === !0)
|
|
306
|
+
return !0;
|
|
307
|
+
for (let t = 0; t <= e.levelIndex; t++)
|
|
308
|
+
if (e.getValue(e.row, t) !== e.getValue(e.previousRow, t))
|
|
309
|
+
return !0;
|
|
310
|
+
return !1;
|
|
311
|
+
}
|
|
312
|
+
function Re(e, t, r) {
|
|
313
|
+
return !(r != null && r.hasTextAffixes) && t.kind === "value" && (typeof t.value == "number" || K(t.value)) ? e : Y(e);
|
|
314
|
+
}
|
|
315
|
+
function Ut(e, t, r) {
|
|
316
|
+
const n = Me(e.descriptors, t.presentation, r), o = e.columns.map((m) => {
|
|
317
|
+
var s;
|
|
318
|
+
return m.kind === "measure" && ((s = n.measureSemantics.get(m.measureId)) == null ? void 0 : s.isNumeric) === !0;
|
|
319
|
+
}), i = (m) => ee([m], n.levels), a = (m, s, f) => Le(m, s, t.presentation.totals[f], n.levels), l = e.columns.map((m) => {
|
|
320
|
+
if (m.kind !== "measure") return m.label;
|
|
321
|
+
const s = m.columnPath.map(i);
|
|
322
|
+
return m.role !== "member" && s.push(a(m.columnPath, m.role, "columns")), [...s, m.label].join(" / ");
|
|
323
|
+
}), d = Math.min(t.spec.columns.length, Math.max(
|
|
324
|
+
0,
|
|
325
|
+
...e.columns.map((m) => m.kind === "measure" ? m.columnPath.length + (m.role !== "member" ? 1 : 0) : 0)
|
|
326
|
+
)), u = Array.from({ length: d + 1 }, (m, s) => e.columns.map((f) => s === d ? f.label : f.kind !== "measure" ? "" : s < f.columnPath.length ? i(f.columnPath[s]) : s === f.columnPath.length && f.role !== "member" ? a(f.columnPath, f.role, "columns") : "")), g = (m, s) => et({
|
|
327
|
+
path: m.rowPath,
|
|
328
|
+
role: m.kind === "layout" ? m.role : "member",
|
|
329
|
+
levelCount: Math.max(1, t.spec.rows.length),
|
|
330
|
+
repeatLabels: t.presentation.layout.kind !== "tabular" || t.presentation.layout.repeatLabels,
|
|
331
|
+
previousPath: s == null ? void 0 : s.rowPath
|
|
332
|
+
}), y = (m, s) => {
|
|
333
|
+
if (m.kind !== "layout") throw new Error("Layout presentation requires layout rows.");
|
|
334
|
+
if (m.values.length !== e.columns.length) throw new Error("Matrix row does not match its frozen layout.");
|
|
335
|
+
const f = g(m, s);
|
|
336
|
+
return e.columns.map((h, p) => {
|
|
337
|
+
if (h.kind === "hierarchy")
|
|
338
|
+
return `${" ".repeat(Math.max(0, m.rowPath.length - 1))}${a(m.rowPath, m.role, "rows")}`;
|
|
339
|
+
if (h.kind === "level") {
|
|
340
|
+
const C = t.spec.rows.findIndex((k) => k.id === h.levelId), T = f[C];
|
|
341
|
+
return T != null && T.visible ? T.total ? a(m.rowPath, m.role, "rows") : ee(T.path, n.levels) : "";
|
|
342
|
+
}
|
|
343
|
+
const E = m.values[p], w = n.measures.get(h.measureId);
|
|
344
|
+
if (E.kind === "value" && !w)
|
|
345
|
+
throw new Error("Matrix value is missing its measure descriptor.");
|
|
346
|
+
return ke(E, w, t.presentation.absence);
|
|
347
|
+
});
|
|
348
|
+
}, x = (m, s) => y(m, s).map((f, h) => {
|
|
349
|
+
const p = e.columns[h];
|
|
350
|
+
return p.kind === "measure" ? Re(f, m.values[h], n.measureSemantics.get(p.measureId)) : Y(f);
|
|
351
|
+
});
|
|
352
|
+
return {
|
|
353
|
+
headers: l,
|
|
354
|
+
headerBands: u,
|
|
355
|
+
numericColumns: o,
|
|
356
|
+
/** The card's prepared formats this presentation formats with (the Excel form reads its measure formats). */
|
|
357
|
+
formatting: n,
|
|
358
|
+
/** A row's cells; after `previous`, a tabular layout prints each label once. */
|
|
359
|
+
row: (m, s) => y(m, s),
|
|
360
|
+
/**
|
|
361
|
+
* Level columns whose group label the row above shows, so this row
|
|
362
|
+
* continues the group (Plan 2, 2d, C8). Only a member row after a member
|
|
363
|
+
* row continues one: a total prints as a band, and its rules stay whole
|
|
364
|
+
* above and below it.
|
|
365
|
+
*/
|
|
366
|
+
continuedColumns: (m, s) => {
|
|
367
|
+
const f = (p) => (p == null ? void 0 : p.kind) === "layout" && p.role === "member";
|
|
368
|
+
if (!f(m) || !f(s)) return [];
|
|
369
|
+
const h = g(m, s);
|
|
370
|
+
return e.columns.flatMap((p, E) => {
|
|
371
|
+
var C;
|
|
372
|
+
if (p.kind !== "level") return [];
|
|
373
|
+
const w = t.spec.rows.findIndex((T) => T.id === p.levelId);
|
|
374
|
+
return w < m.rowPath.length && ((C = h[w]) == null ? void 0 : C.visible) === !1 ? [E] : [];
|
|
375
|
+
});
|
|
376
|
+
},
|
|
377
|
+
csvRow: (m) => x(m),
|
|
378
|
+
/**
|
|
379
|
+
* `previousRow` is the row before `data[0]`, carried by the export's
|
|
380
|
+
* continuation, so a tabular layout prints each label once across the
|
|
381
|
+
* whole file. Retries are pure: suppression never relies on mutable
|
|
382
|
+
* formatter state or an earlier worker. Without it, the first row prints
|
|
383
|
+
* its labels.
|
|
384
|
+
*/
|
|
385
|
+
csvRows: (m, s) => m.map((f, h) => x(f, h ? m[h - 1] : s ?? void 0))
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
function Gr(e) {
|
|
389
|
+
return e.columns.map((t) => Y(t.label));
|
|
390
|
+
}
|
|
391
|
+
function zr(e, t, r) {
|
|
392
|
+
return Bt(e, t, r).map((n, o) => {
|
|
393
|
+
const i = t.columns[o];
|
|
394
|
+
return i.kind === "measure" ? Re(n, e.values[o], r.measureSemantics.get(i.measureId)) : Y(n);
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
function Bt(e, t, r) {
|
|
398
|
+
if (e.kind !== "flat") throw new Error("Flat Matrix CSV requires flat rows.");
|
|
399
|
+
if (e.values.length !== t.columns.length) throw new Error("Matrix row does not match its frozen layout.");
|
|
400
|
+
const n = [...e.rowPath, ...e.columnPath];
|
|
401
|
+
return t.columns.map((o, i) => {
|
|
402
|
+
if (o.kind === "measure") {
|
|
403
|
+
const l = e.values[i], d = r.measures.get(o.measureId);
|
|
404
|
+
if (l.kind === "value" && !d) throw new Error("Matrix value is missing its measure descriptor.");
|
|
405
|
+
return ke(l, d, r.absence);
|
|
406
|
+
}
|
|
407
|
+
const a = o.kind === "level" ? n.find((l) => l.levelId === o.levelId) : void 0;
|
|
408
|
+
if (!a) throw new Error("Flat Matrix row does not match its frozen layout.");
|
|
409
|
+
return ee([a], r.levels);
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
function jt(e) {
|
|
413
|
+
const t = Ut(e.layout, e.request, e.report), r = e.layout.columns.map((a, l) => ({
|
|
414
|
+
index: l,
|
|
415
|
+
columnId: `matrix:${l}`,
|
|
416
|
+
label: t.headers[l],
|
|
417
|
+
isNumeric: t.numericColumns[l]
|
|
418
|
+
})), n = (a, l, d) => ({
|
|
419
|
+
text: a,
|
|
420
|
+
colspan: 1,
|
|
421
|
+
rowspan: 1,
|
|
422
|
+
columnId: r[l].columnId,
|
|
423
|
+
isHeader: d,
|
|
424
|
+
isNumeric: r[l].isNumeric,
|
|
425
|
+
className: r[l].isNumeric ? "numeric" : e.layout.columns[l].kind === "hierarchy" ? "matrix-hierarchy" : ""
|
|
426
|
+
}), o = [], i = e.layout.columns.findIndex((a) => a.kind === "measure");
|
|
427
|
+
e.request.spec.columns.length && i >= 0 && o.push({
|
|
428
|
+
repeatHeader: !0,
|
|
429
|
+
headerType: "pivot-axis",
|
|
430
|
+
headerRowIndex: 0,
|
|
431
|
+
cells: [
|
|
432
|
+
...i ? [{ ...n("", 0, !0), colspan: i }] : [],
|
|
433
|
+
{
|
|
434
|
+
...n(e.request.spec.columns.map((a) => Ae(a, e.request.presentation)).join(" / "), i, !0),
|
|
435
|
+
colspan: e.layout.columns.length - i,
|
|
436
|
+
isNumeric: !1,
|
|
437
|
+
className: ""
|
|
438
|
+
}
|
|
439
|
+
]
|
|
440
|
+
});
|
|
441
|
+
for (const [a, l] of t.headerBands.entries())
|
|
442
|
+
o.push({
|
|
443
|
+
repeatHeader: !0,
|
|
444
|
+
headerType: a === t.headerBands.length - 1 ? "metrics" : "pivot-level",
|
|
445
|
+
headerRowIndex: o.length,
|
|
446
|
+
cells: l.map((d, u) => n(d, u, !0))
|
|
447
|
+
});
|
|
448
|
+
return {
|
|
449
|
+
headers: o,
|
|
450
|
+
rows: e.rows.map((a, l) => {
|
|
451
|
+
const d = new Set(t.continuedColumns(a, e.rows[l - 1]));
|
|
452
|
+
return {
|
|
453
|
+
index: l,
|
|
454
|
+
type: a.kind === "layout" && a.role !== "member" ? "subtotal" : "data",
|
|
455
|
+
subtotalLevel: String(a.rowPath.length),
|
|
456
|
+
// A tabular layout prints each label once unless it repeats them; the
|
|
457
|
+
// blank cell continues its group, so a grid draws no rule above it.
|
|
458
|
+
cells: t.row(a, e.rows[l - 1]).map((u, g) => d.has(g) ? { ...n(u, g, !1), className: Ot } : n(u, g, !1))
|
|
459
|
+
};
|
|
460
|
+
}),
|
|
461
|
+
grandTotal: null,
|
|
462
|
+
// Totals are already in the ordered body at their authored position.
|
|
463
|
+
metadata: {
|
|
464
|
+
tableType: "pivot",
|
|
465
|
+
totalRows: e.rows.length,
|
|
466
|
+
totalColumns: r.length,
|
|
467
|
+
rowLevels: e.layout.columns.filter((a) => a.kind !== "measure").length,
|
|
468
|
+
pivotLevels: e.request.spec.columns.length,
|
|
469
|
+
hasGrandTotal: !1,
|
|
470
|
+
columnOrder: r.map((a) => a.columnId),
|
|
471
|
+
columns: r
|
|
472
|
+
}
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
function Gt(e, t, r) {
|
|
476
|
+
const { levels: n } = Me(e.descriptors, t.presentation, r), o = t.spec.columns.length > 0, i = [], a = [], l = e.columns.map((u, g) => {
|
|
477
|
+
if (u.kind !== "measure") return null;
|
|
478
|
+
const y = o ? `${u.role}:${H(u.columnPath)}` : `measure:${g}`;
|
|
479
|
+
let x = i.indexOf(y);
|
|
480
|
+
return x < 0 && (x = i.push(y) - 1, a.push(o ? Le(u.columnPath, u.role, t.presentation.totals.columns, n) : u.label)), x;
|
|
481
|
+
}), d = t.spec.columns[t.spec.columns.length - 1];
|
|
482
|
+
return {
|
|
483
|
+
columnGroups: l,
|
|
484
|
+
groupLabels: a,
|
|
485
|
+
/** What bands name their groups by: the innermost column level, or "Measures". */
|
|
486
|
+
groupLevelLabel: d ? Ae(d, t.presentation) : "Measures"
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
function Hr(e) {
|
|
490
|
+
const { layout: t, rows: r, report: n } = e, o = {
|
|
491
|
+
...e.request,
|
|
492
|
+
presentation: Pt(t, r, e.request.presentation)
|
|
493
|
+
}, i = jt({ layout: t, rows: r, request: o, report: n }), a = Vt(r), l = Gt(t, o, n), d = {
|
|
494
|
+
...i,
|
|
495
|
+
rows: i.rows.map((u, g) => ({ ...u, keepWithPrevious: a[g] })),
|
|
496
|
+
metadata: { ...i.metadata, ...l }
|
|
497
|
+
};
|
|
498
|
+
return { request: o, table: d, ...l };
|
|
499
|
+
}
|
|
500
|
+
class zt extends Error {
|
|
501
|
+
constructor() {
|
|
502
|
+
super(...arguments);
|
|
503
|
+
ce(this, "code", Ie);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
function we(e) {
|
|
507
|
+
if (!e || typeof e != "object")
|
|
508
|
+
return;
|
|
509
|
+
const { error: t, message: r, detail: n } = e;
|
|
510
|
+
for (const o of [t, r, n])
|
|
511
|
+
if (typeof o == "string" && o.trim())
|
|
512
|
+
return o.trim();
|
|
513
|
+
}
|
|
514
|
+
async function Ht(e) {
|
|
515
|
+
const t = `PDF request failed: ${e.status} ${e.statusText}`.trim(), r = e.headers.get("content-type") || "";
|
|
516
|
+
try {
|
|
517
|
+
if (r.includes("application/json")) {
|
|
518
|
+
const o = await e.json(), i = typeof o.code == "string" ? o.code : typeof o.errorCode == "string" ? o.errorCode : void 0;
|
|
519
|
+
return { message: we(o) || t, code: i };
|
|
520
|
+
}
|
|
521
|
+
const n = await e.text();
|
|
522
|
+
if (!n.trim())
|
|
523
|
+
return { message: t };
|
|
524
|
+
try {
|
|
525
|
+
const o = JSON.parse(n), i = typeof o.code == "string" ? o.code : typeof o.errorCode == "string" ? o.errorCode : void 0;
|
|
526
|
+
return {
|
|
527
|
+
message: we(o) || n.trim(),
|
|
528
|
+
code: i
|
|
529
|
+
};
|
|
530
|
+
} catch {
|
|
531
|
+
return { message: n.trim() };
|
|
532
|
+
}
|
|
533
|
+
} catch {
|
|
534
|
+
return { message: t };
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
async function Xr(e) {
|
|
538
|
+
if (!e.token) throw new Error("Missing auth token for PDF export");
|
|
539
|
+
if (ft(e.serializedPayload) > gt.maxRequestBytes)
|
|
540
|
+
throw new Error("Fast-path PDF request exceeds the structured body limit");
|
|
541
|
+
const t = await (e.fetchImpl ?? fetch)(e.url, {
|
|
542
|
+
method: "POST",
|
|
543
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${e.token}` },
|
|
544
|
+
body: e.serializedPayload,
|
|
545
|
+
signal: e.signal
|
|
546
|
+
});
|
|
547
|
+
if (!t.ok) {
|
|
548
|
+
const n = await Ht(t);
|
|
549
|
+
throw n.code === Ie ? new zt(n.message) : new Error(n.message);
|
|
550
|
+
}
|
|
551
|
+
const r = await t.json();
|
|
552
|
+
if (r != null && r.error) throw new Error(r.error);
|
|
553
|
+
if (typeof (r == null ? void 0 : r.url) != "string" || !r.url.trim())
|
|
554
|
+
throw new Error("Fast-path PDF response missing download URL");
|
|
555
|
+
return r;
|
|
556
|
+
}
|
|
557
|
+
const Xt = "__TOTAL__";
|
|
558
|
+
function X(e) {
|
|
559
|
+
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
560
|
+
}
|
|
561
|
+
function te(e) {
|
|
562
|
+
return e === Xt;
|
|
563
|
+
}
|
|
564
|
+
function Wt(e) {
|
|
565
|
+
const t = /* @__PURE__ */ new Map(), r = (e.groupByColumns ?? []).map((o, i) => {
|
|
566
|
+
var u, g, y;
|
|
567
|
+
if (!X(o))
|
|
568
|
+
throw new Error(`Aggregate groupByColumns[${i}] is invalid`);
|
|
569
|
+
const a = typeof o.id == "string" && o.id.length > 0 ? o.id : void 0, l = a ? (y = (g = (u = e.columnKeyMap) == null ? void 0 : u.byRole) == null ? void 0 : g.groupby) == null ? void 0 : y[a] : void 0, d = (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);
|
|
570
|
+
if (!d)
|
|
571
|
+
throw new Error(`Aggregate groupByColumns[${i}] has no output key`);
|
|
572
|
+
return [a, o.alias, o.name, d].forEach((x) => {
|
|
573
|
+
typeof x == "string" && x.length > 0 && t.set(x, d);
|
|
574
|
+
}), d;
|
|
575
|
+
}), n = (e.rowAggregates ?? []).flatMap((o) => !X(o) || typeof o.function != "string" || typeof o.groupLevel != "string" ? [] : [
|
|
576
|
+
{
|
|
577
|
+
function: o.function,
|
|
578
|
+
groupLevel: o.groupLevel === "ALL" ? "ALL" : t.get(o.groupLevel) || o.groupLevel,
|
|
579
|
+
...typeof o.label == "string" ? { label: o.label } : {}
|
|
580
|
+
}
|
|
581
|
+
]);
|
|
582
|
+
return { groupColumnKeys: r, rowAggregates: n };
|
|
583
|
+
}
|
|
584
|
+
function De(e) {
|
|
585
|
+
return e === "SUM" ? "Total" : e.charAt(0).toUpperCase() + e.slice(1).toLowerCase();
|
|
586
|
+
}
|
|
587
|
+
function Yt(e) {
|
|
588
|
+
var r;
|
|
589
|
+
if (e.customLabel) return e.customLabel;
|
|
590
|
+
const t = De(e.aggregateFunction);
|
|
591
|
+
if (e.levelValue !== void 0 && !te(e.levelValue)) {
|
|
592
|
+
if (e.levelValue === null) {
|
|
593
|
+
const o = (r = e.formatValue) == null ? void 0 : r.call(e, null);
|
|
594
|
+
return o ? `Subtotal ${o}` : `Subtotal ${t}`;
|
|
595
|
+
}
|
|
596
|
+
const n = e.formatValue ? e.formatValue(e.levelValue) : String(e.levelValue);
|
|
597
|
+
if (n) return `Subtotal (${n})`;
|
|
598
|
+
}
|
|
599
|
+
return `Subtotal ${t}`;
|
|
600
|
+
}
|
|
601
|
+
function Zt(e, t) {
|
|
602
|
+
return t || `Grand ${De(e)}`;
|
|
603
|
+
}
|
|
604
|
+
function Wr(e) {
|
|
605
|
+
const t = e.context.groupColumnKeys.indexOf(e.columnKey);
|
|
606
|
+
if (t < 0)
|
|
607
|
+
throw new Error(
|
|
608
|
+
`Aggregate group column "${e.columnKey}" is unknown`
|
|
609
|
+
);
|
|
610
|
+
return Kt({
|
|
611
|
+
row: e.row,
|
|
612
|
+
previousRow: e.previousRow,
|
|
613
|
+
levelIndex: t,
|
|
614
|
+
getValue: (r, n) => r[e.context.groupColumnKeys[n]]
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
function Pe(e) {
|
|
618
|
+
var n, o;
|
|
619
|
+
const t = e.context.groupColumnKeys, r = typeof e.row.aggregate == "string" ? e.row.aggregate : "SUM";
|
|
620
|
+
if (e.row.isGrandTotal === !0) {
|
|
621
|
+
const i = (n = e.context.rowAggregates.find(
|
|
622
|
+
(a) => a.groupLevel === "ALL"
|
|
623
|
+
)) == null ? void 0 : n.label;
|
|
624
|
+
return {
|
|
625
|
+
kind: "grand-total",
|
|
626
|
+
cells: t.map((a, l) => ({
|
|
627
|
+
columnKey: a,
|
|
628
|
+
text: l === 0 ? Zt(r, i) : "",
|
|
629
|
+
placement: l === 0 ? "label" : "empty",
|
|
630
|
+
colSpan: l === 0 ? t.length : 1
|
|
631
|
+
}))
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
if (e.row.isSubtotal === !0) {
|
|
635
|
+
if (typeof e.row.subtotalLevel != "string")
|
|
636
|
+
throw new Error("Aggregate subtotal row is missing subtotalLevel");
|
|
637
|
+
const i = t.indexOf(e.row.subtotalLevel);
|
|
638
|
+
if (i < 0)
|
|
639
|
+
throw new Error(
|
|
640
|
+
`Aggregate subtotal level "${e.row.subtotalLevel}" has no group column`
|
|
641
|
+
);
|
|
642
|
+
const a = X(e.row.subtotalContext) ? e.row.subtotalContext : void 0, l = X(a == null ? void 0 : a.groupByValues) ? a.groupByValues : {}, d = (o = e.context.rowAggregates.find(
|
|
643
|
+
(u) => u.groupLevel === e.row.subtotalLevel && u.function === r
|
|
644
|
+
)) == null ? void 0 : o.label;
|
|
645
|
+
return {
|
|
646
|
+
kind: "subtotal",
|
|
647
|
+
cells: t.map((u, g) => {
|
|
648
|
+
if (g > i)
|
|
649
|
+
return {
|
|
650
|
+
columnKey: u,
|
|
651
|
+
text: "",
|
|
652
|
+
placement: "empty",
|
|
653
|
+
colSpan: 1
|
|
654
|
+
};
|
|
655
|
+
if (g < i) {
|
|
656
|
+
const y = e.row[u];
|
|
657
|
+
return {
|
|
658
|
+
columnKey: u,
|
|
659
|
+
text: y === void 0 || te(y) ? "" : e.formatValue(y, u),
|
|
660
|
+
placement: "value",
|
|
661
|
+
colSpan: 1
|
|
662
|
+
};
|
|
663
|
+
}
|
|
664
|
+
return {
|
|
665
|
+
columnKey: u,
|
|
666
|
+
text: Yt({
|
|
667
|
+
aggregateFunction: r,
|
|
668
|
+
customLabel: d,
|
|
669
|
+
levelValue: l[u],
|
|
670
|
+
formatValue: (y) => e.formatLabelValue ? e.formatLabelValue(y, u) : String(e.formatValue(y, u) ?? "")
|
|
671
|
+
}),
|
|
672
|
+
placement: "label",
|
|
673
|
+
colSpan: t.length - i
|
|
674
|
+
};
|
|
675
|
+
})
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
return {
|
|
679
|
+
kind: "data",
|
|
680
|
+
cells: t.map((i) => {
|
|
681
|
+
const a = e.row[i];
|
|
682
|
+
return {
|
|
683
|
+
columnKey: i,
|
|
684
|
+
text: a === void 0 || te(a) ? "" : e.formatValue(a, i),
|
|
685
|
+
placement: "value",
|
|
686
|
+
colSpan: 1
|
|
687
|
+
};
|
|
688
|
+
})
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
function Yr(e) {
|
|
692
|
+
const t = Pe(e).cells.find(
|
|
693
|
+
(r) => r.columnKey === e.columnKey
|
|
694
|
+
);
|
|
695
|
+
if (!t)
|
|
696
|
+
throw new Error(`Aggregate group column "${e.columnKey}" is unknown`);
|
|
697
|
+
return t.text;
|
|
698
|
+
}
|
|
699
|
+
function qt(e) {
|
|
700
|
+
return Pe(e).cells.map((t) => t.text);
|
|
701
|
+
}
|
|
702
|
+
function Jt(e) {
|
|
703
|
+
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
704
|
+
}
|
|
705
|
+
function Qt(e, t) {
|
|
706
|
+
if ((e == null ? void 0 : e.cardType) !== "aggregateTable") return;
|
|
707
|
+
const r = Jt(e.cardConfig) ? e.cardConfig : void 0, n = r == null ? void 0 : r.groupByColumns, o = r == null ? void 0 : r.rowAggregates;
|
|
708
|
+
if (n !== void 0 && !Array.isArray(n))
|
|
709
|
+
throw new Error("Aggregate export groupByColumns is invalid");
|
|
710
|
+
if (o !== void 0 && !Array.isArray(o))
|
|
711
|
+
throw new Error("Aggregate export rowAggregates is invalid");
|
|
712
|
+
return Wt({
|
|
713
|
+
groupByColumns: n,
|
|
714
|
+
rowAggregates: o,
|
|
715
|
+
columnKeyMap: t
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
function er(e) {
|
|
719
|
+
if (!e.aggregateContext || !e.useFormattedValues || e.row.isSubtotal !== !0 && e.row.isGrandTotal !== !0)
|
|
720
|
+
return;
|
|
721
|
+
const t = qt({
|
|
722
|
+
row: e.row,
|
|
723
|
+
context: e.aggregateContext,
|
|
724
|
+
formatValue: (r, n) => e.visibleColumnKeys.has(n) ? e.formatGroupValue(r, n) : ""
|
|
725
|
+
});
|
|
726
|
+
return new Map(
|
|
727
|
+
e.aggregateContext.groupColumnKeys.map((r, n) => [
|
|
728
|
+
r,
|
|
729
|
+
t[n]
|
|
730
|
+
])
|
|
731
|
+
);
|
|
732
|
+
}
|
|
733
|
+
function tr(e, t) {
|
|
734
|
+
return e.dashboardId === t.dashboardId && e.cardId === t.cardId && e.attachmentIndex === void 0;
|
|
735
|
+
}
|
|
736
|
+
function Ne(e) {
|
|
737
|
+
return new Map(
|
|
738
|
+
e.presentationExecutionSnapshot.resolvedFormats.flatMap(
|
|
739
|
+
(t) => t.format.type === "raw_temporal" && t.target.kind === "column" && tr(t.scope, e.scope) ? [[t.target.columnKey, t.format]] : []
|
|
740
|
+
)
|
|
741
|
+
);
|
|
742
|
+
}
|
|
743
|
+
function Ve(e) {
|
|
744
|
+
const t = e == null ? void 0 : e.sql, r = e == null ? void 0 : e.python;
|
|
745
|
+
return (e == null ? void 0 : e.resultOwner) === "freeform" && typeof t == "string" && !!t.trim() && (typeof r != "string" || !r.trim());
|
|
746
|
+
}
|
|
747
|
+
function Zr(e) {
|
|
748
|
+
return e.formatting.useFormattedValues !== !1 && Ve(e.queryPayload) && Ne(e.formatting).size > 0;
|
|
749
|
+
}
|
|
750
|
+
function rr(e, t) {
|
|
751
|
+
return e.map((r, n) => {
|
|
752
|
+
if (!Object.prototype.hasOwnProperty.call(r, t) || r[t] === void 0)
|
|
753
|
+
throw new Error(
|
|
754
|
+
`missing_raw_temporal_result_contract: Row ${n} is missing declared temporal column "${t}".`
|
|
755
|
+
);
|
|
756
|
+
const o = r[t];
|
|
757
|
+
return o === null || typeof o == "string" ? o : String(o);
|
|
758
|
+
});
|
|
759
|
+
}
|
|
760
|
+
function or(e) {
|
|
761
|
+
if (e.formatting.useFormattedValues === !1)
|
|
762
|
+
return {
|
|
763
|
+
activatedColumnKeys: /* @__PURE__ */ new Set(),
|
|
764
|
+
byColumnKey: /* @__PURE__ */ new Map()
|
|
765
|
+
};
|
|
766
|
+
const t = Ne(e.formatting), r = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Map();
|
|
767
|
+
if (t.size === 0)
|
|
768
|
+
return { activatedColumnKeys: r, byColumnKey: n };
|
|
769
|
+
const o = new Map(
|
|
770
|
+
e.columns.flatMap((l) => {
|
|
771
|
+
const d = l.key || l.field;
|
|
772
|
+
return d ? [[d, l]] : [];
|
|
773
|
+
})
|
|
774
|
+
), i = Ve(e.queryPayload), a = /* @__PURE__ */ new Map();
|
|
775
|
+
for (const [l, d] of t) {
|
|
776
|
+
const u = o.get(l);
|
|
777
|
+
let g;
|
|
778
|
+
if (u != null && u.rawTemporal)
|
|
779
|
+
g = yt(u, {
|
|
780
|
+
metadataRequired: !0
|
|
781
|
+
}), r.add(l);
|
|
782
|
+
else if (i) {
|
|
783
|
+
r.add(l);
|
|
784
|
+
const y = Xe({
|
|
785
|
+
columnKey: l,
|
|
786
|
+
values: rr(e.records, l)
|
|
787
|
+
});
|
|
788
|
+
a.set(l, y), y.status === "classified" && (g = y.metadata);
|
|
789
|
+
} else
|
|
790
|
+
continue;
|
|
791
|
+
g && n.set(l, {
|
|
792
|
+
metadata: g,
|
|
793
|
+
format: d,
|
|
794
|
+
formatValue: We({ metadata: g, format: d })
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
return {
|
|
798
|
+
activatedColumnKeys: r,
|
|
799
|
+
byColumnKey: n,
|
|
800
|
+
...i ? {
|
|
801
|
+
sqlChunkEvidence: Ye(a)
|
|
802
|
+
} : {}
|
|
803
|
+
};
|
|
804
|
+
}
|
|
805
|
+
function nr(e) {
|
|
806
|
+
if (!e.resolution.activatedColumnKeys.has(e.columnKey))
|
|
807
|
+
return;
|
|
808
|
+
if (e.value === void 0)
|
|
809
|
+
throw new Error(
|
|
810
|
+
`missing_raw_temporal_result_contract: Row ${e.rowIndex} is missing temporal column "${e.columnKey}".`
|
|
811
|
+
);
|
|
812
|
+
const t = e.resolution.byColumnKey.get(e.columnKey);
|
|
813
|
+
if (!t)
|
|
814
|
+
return { text: e.value === null ? "" : String(e.value) };
|
|
815
|
+
if (e.value !== null && typeof e.value != "string")
|
|
816
|
+
return { text: String(e.value) };
|
|
817
|
+
const r = t.formatValue(e.value);
|
|
818
|
+
return r.ok && r.wallClock ? { text: r.text, wallClock: r.wallClock } : { text: r.text };
|
|
819
|
+
}
|
|
820
|
+
function ve(e, t) {
|
|
821
|
+
const r = e.byColumnKey.get(t);
|
|
822
|
+
return r ? r.metadata.valueKind === "date" : void 0;
|
|
823
|
+
}
|
|
824
|
+
const ar = /* @__PURE__ */ new Set(["string", "number", "boolean", "date", "datetime"]), sr = /^\d{4}-\d{2}-\d{2}|^\d{2}\/\d{2}\/\d{4}/, ir = /^\d{4}-\d{2}-\d{2}$/, Oe = "MM/dd/yyyy";
|
|
825
|
+
function W(e) {
|
|
826
|
+
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
827
|
+
}
|
|
828
|
+
function N(e) {
|
|
829
|
+
return e.key || e.field || void 0;
|
|
830
|
+
}
|
|
831
|
+
function J(e) {
|
|
832
|
+
return e == null ? "" : typeof e == "string" ? e : K(e) ? e.value : e instanceof Date ? e.toISOString() : typeof e == "object" ? JSON.stringify(e) : String(e);
|
|
833
|
+
}
|
|
834
|
+
function xe(e, t) {
|
|
835
|
+
var n;
|
|
836
|
+
const r = (n = e.columnSettings) == null ? void 0 : n[t];
|
|
837
|
+
if (!(!W(r) || r.type !== "date"))
|
|
838
|
+
return W(r.dateFormat) ? r.dateFormat : {};
|
|
839
|
+
}
|
|
840
|
+
function Ce(e) {
|
|
841
|
+
return e.useCustomFormat && e.customFormat ? e.customFormat : e.format || Oe;
|
|
842
|
+
}
|
|
843
|
+
function Te(e, t) {
|
|
844
|
+
return e && e !== "auto" ? e : t;
|
|
845
|
+
}
|
|
846
|
+
function lr(e) {
|
|
847
|
+
return !/[HhKkmsSa]/.test(e.replace(/'[^']*'/g, ""));
|
|
848
|
+
}
|
|
849
|
+
function cr(e) {
|
|
850
|
+
if (typeof e == "number") return Number.isFinite(e) ? e : null;
|
|
851
|
+
if (typeof e != "string" || !e.trim()) return null;
|
|
852
|
+
const t = Number(e);
|
|
853
|
+
return Number.isFinite(t) ? t : null;
|
|
854
|
+
}
|
|
855
|
+
function ur(e) {
|
|
856
|
+
const t = $e(e);
|
|
857
|
+
if (t !== void 0)
|
|
858
|
+
try {
|
|
859
|
+
return st(t, /[.eE]/.test(t) ? "decimal" : "integer");
|
|
860
|
+
} catch {
|
|
861
|
+
return;
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
function mr(e) {
|
|
865
|
+
return e.calendar.fiscalCalendar && (e.granularity === "quarter" || e.granularity === "year") ? "fiscal" : e.granularity;
|
|
866
|
+
}
|
|
867
|
+
function qr(e) {
|
|
868
|
+
const { formatting: t, queryPayload: r } = e, n = t.useFormattedValues, o = t.scope, i = (s) => lt({ snapshot: t.presentationExecutionSnapshot, scope: o, target: { kind: "column", columnKey: s } }), a = (s) => ct({ snapshot: t.presentationExecutionSnapshot, scope: o, target: { kind: "column", columnKey: s } });
|
|
869
|
+
function l(s) {
|
|
870
|
+
var h;
|
|
871
|
+
if ((h = t.visibleColumns) != null && h.length) return t.visibleColumns;
|
|
872
|
+
const f = s.columns.map(N).filter((p) => !!p);
|
|
873
|
+
return f.length > 0 ? f : s.records[0] ? Object.keys(s.records[0]) : [];
|
|
874
|
+
}
|
|
875
|
+
function d(s, f) {
|
|
876
|
+
return t.columnLabels && Object.prototype.hasOwnProperty.call(t.columnLabels, s) && t.columnLabels[s] || void 0 || u(f) || (f == null ? void 0 : f.label) || (f == null ? void 0 : f.headerName) || s;
|
|
877
|
+
}
|
|
878
|
+
function u(s, f) {
|
|
879
|
+
const h = s == null ? void 0 : s.pivotIdentity;
|
|
880
|
+
if (!h || !h.members || h.members.length === 0) return;
|
|
881
|
+
const p = fe({ identity: h, columnKey: (s == null ? void 0 : s.key) || (s == null ? void 0 : s.field) || "" });
|
|
882
|
+
return pt({
|
|
883
|
+
members: p,
|
|
884
|
+
metricLabel: (s == null ? void 0 : s.label) || (s == null ? void 0 : s.headerName),
|
|
885
|
+
mode: n ? "formatted" : "canonical",
|
|
886
|
+
resolveTemporalFormat: (E) => {
|
|
887
|
+
const w = p.find((T) => T.fieldId === E);
|
|
888
|
+
if (!(w != null && w.temporalBucket)) return;
|
|
889
|
+
const C = me({
|
|
890
|
+
snapshot: t.presentationExecutionSnapshot,
|
|
891
|
+
scope: o,
|
|
892
|
+
target: { kind: "field", fieldId: E, role: "pivotby" }
|
|
893
|
+
});
|
|
894
|
+
return C ? g(w.temporalBucket, C) : void 0;
|
|
895
|
+
}
|
|
896
|
+
}).flattenedLabel;
|
|
897
|
+
}
|
|
898
|
+
function g(s, f) {
|
|
899
|
+
return Ze({
|
|
900
|
+
metadata: s,
|
|
901
|
+
cardFormat: f,
|
|
902
|
+
locale: f.locale,
|
|
903
|
+
...f.presentation.mode === "auto" ? { styles: f.presentation.styles } : {}
|
|
904
|
+
}).format;
|
|
905
|
+
}
|
|
906
|
+
function y(s, f) {
|
|
907
|
+
const { records: h, columns: p } = s, E = W(r.cardConfig) ? r.cardConfig : void 0;
|
|
908
|
+
if (s.pivotResultKind === "not_pivot") {
|
|
909
|
+
const c = E == null ? void 0 : E.pivotByColumns, b = Array.isArray(c) ? c.flatMap(
|
|
910
|
+
(v) => W(v) && typeof v.id == "string" && v.id ? [v.id] : []
|
|
911
|
+
) : [];
|
|
912
|
+
bt(
|
|
913
|
+
p.map((v) => ({ key: N(v) || "<unknown>", pivotIdentity: v.pivotIdentity })),
|
|
914
|
+
{
|
|
915
|
+
expectedPivotFieldIds: b,
|
|
916
|
+
columnClassifications: s.columnMetadata
|
|
917
|
+
}
|
|
918
|
+
);
|
|
919
|
+
}
|
|
920
|
+
const w = l(s), C = new Set(w), T = new Map(
|
|
921
|
+
p.flatMap((c) => {
|
|
922
|
+
const b = N(c);
|
|
923
|
+
return b ? [[b, c]] : [];
|
|
924
|
+
})
|
|
925
|
+
), k = new Map(s.resultColumns.map((c) => [c.key, c.dataType])), A = or({
|
|
926
|
+
records: h,
|
|
927
|
+
columns: p,
|
|
928
|
+
formatting: t,
|
|
929
|
+
queryPayload: r
|
|
930
|
+
}), U = new Map(
|
|
931
|
+
p.flatMap((c) => {
|
|
932
|
+
const b = N(c);
|
|
933
|
+
return b && c.temporalBucket ? [[b, c.temporalBucket]] : [];
|
|
934
|
+
})
|
|
935
|
+
), ne = /* @__PURE__ */ new Map();
|
|
936
|
+
for (const c of w) {
|
|
937
|
+
const b = me({
|
|
938
|
+
snapshot: t.presentationExecutionSnapshot,
|
|
939
|
+
scope: o,
|
|
940
|
+
target: { kind: "column", columnKey: c }
|
|
941
|
+
}), v = U.get(c);
|
|
942
|
+
if (n) {
|
|
943
|
+
if (b && !v) throw new Error(`Missing temporal bucket metadata for column "${c}"`);
|
|
944
|
+
if (v && !b) throw new Error(`Missing resolved temporal presentation for column "${c}"`);
|
|
945
|
+
}
|
|
946
|
+
b && v && ne.set(c, g(v, b));
|
|
947
|
+
}
|
|
948
|
+
const Ue = U.size > 0 && e.cardType === "aggregateTable" ? Qt(r, s.columnKeyMap) : void 0, B = w.map((c) => {
|
|
949
|
+
const b = k.get(c), v = b && ar.has(b) ? b : "unknown", S = n ? x(c, A, U) : void 0, F = d(c, T.get(c)), M = n && A.activatedColumnKeys.has(c) && ve(A, c) === void 0;
|
|
950
|
+
return {
|
|
951
|
+
key: c,
|
|
952
|
+
label: F,
|
|
953
|
+
dataType: v,
|
|
954
|
+
...S ? { presentation: S } : {},
|
|
955
|
+
xlsx: be({ key: c, label: F, formattedValues: n, dataType: v, presentation: S }),
|
|
956
|
+
...M ? { xlsxPending: !0 } : {}
|
|
957
|
+
};
|
|
958
|
+
});
|
|
959
|
+
function ae(c, b, v, S) {
|
|
960
|
+
if (!n) return { text: J(c), value: c };
|
|
961
|
+
const F = nr({ value: c, columnKey: b, rowIndex: v, resolution: A });
|
|
962
|
+
if (F !== void 0) return { text: F.text, value: c, ...F.wallClock ? { wallClock: F.wallClock } : {} };
|
|
963
|
+
const M = U.get(b);
|
|
964
|
+
if (M) {
|
|
965
|
+
const L = ne.get(b);
|
|
966
|
+
if (!L) throw new Error(`Missing resolved temporal presentation for column "${b}"`);
|
|
967
|
+
if (c != null && typeof c != "string")
|
|
968
|
+
throw new Error(`Canonical temporal column "${b}" must contain a string or null`);
|
|
969
|
+
const R = c ?? null, D = qe(R, M);
|
|
970
|
+
return {
|
|
971
|
+
text: Je({ value: R, metadata: M, format: L }),
|
|
972
|
+
value: c,
|
|
973
|
+
...D ? { wallClock: D } : {}
|
|
974
|
+
};
|
|
975
|
+
}
|
|
976
|
+
if (c == null) return { text: "", value: c };
|
|
977
|
+
const _ = a(b);
|
|
978
|
+
if (_ && typeof c == "number" && Number.isFinite(c))
|
|
979
|
+
return {
|
|
980
|
+
text: ue(
|
|
981
|
+
new Date(c).toISOString(),
|
|
982
|
+
_.pattern || Oe,
|
|
983
|
+
Te(_.timezone, t.timezone),
|
|
984
|
+
"UTC"
|
|
985
|
+
),
|
|
986
|
+
value: c
|
|
987
|
+
};
|
|
988
|
+
const I = i(b);
|
|
989
|
+
if (typeof c == "number")
|
|
990
|
+
return { text: I ? G(c, I) : String(c), value: c };
|
|
991
|
+
if (K(c))
|
|
992
|
+
return { text: I ? G(c, I) : c.value, value: c };
|
|
993
|
+
const j = xe(t, b);
|
|
994
|
+
if (j && (c instanceof Date || typeof c == "string" && sr.test(c))) {
|
|
995
|
+
const L = c instanceof Date ? c.toISOString() : c, R = typeof c == "string" && ir.test(c), D = R ? "UTC" : Te(j.timezone, t.timezone), ie = R ? "UTC" : j.sourceTimezone || "auto", le = tt(L, D, ie);
|
|
996
|
+
return {
|
|
997
|
+
text: ue(L, Ce(j), D, ie),
|
|
998
|
+
value: c,
|
|
999
|
+
...le ? { wallClock: le } : {}
|
|
1000
|
+
};
|
|
1001
|
+
}
|
|
1002
|
+
if (typeof c == "string" && I && S.dataType === "number") {
|
|
1003
|
+
const L = ur(c);
|
|
1004
|
+
if (L) return { text: G(L, I), value: c };
|
|
1005
|
+
}
|
|
1006
|
+
return { text: J(c), value: c };
|
|
1007
|
+
}
|
|
1008
|
+
const Be = h.map((c, b) => {
|
|
1009
|
+
const v = er({
|
|
1010
|
+
row: c,
|
|
1011
|
+
aggregateContext: Ue,
|
|
1012
|
+
useFormattedValues: n,
|
|
1013
|
+
visibleColumnKeys: C,
|
|
1014
|
+
formatGroupValue: (S, F) => {
|
|
1015
|
+
const M = B.find((_) => _.key === F);
|
|
1016
|
+
return M ? ae(S, F, b, M).text : J(S);
|
|
1017
|
+
}
|
|
1018
|
+
});
|
|
1019
|
+
return B.map((S) => {
|
|
1020
|
+
const F = v == null ? void 0 : v.get(S.key);
|
|
1021
|
+
if (F !== void 0) return P({ value: F, text: F, column: S.xlsx });
|
|
1022
|
+
const M = ae(c[S.key], S.key, b, S);
|
|
1023
|
+
return P({ value: M.value, text: M.text, column: S.xlsx, wallClock: M.wallClock });
|
|
1024
|
+
});
|
|
1025
|
+
}), se = (f == null ? void 0 : f.withHeader) !== !1 && t.includeHeaders;
|
|
1026
|
+
if (se && s.pivotResultKind === "not_pivot")
|
|
1027
|
+
for (const c of w) {
|
|
1028
|
+
const b = T.get(c);
|
|
1029
|
+
b != null && b.pivotIdentity && fe({ identity: b.pivotIdentity, columnKey: N(b) || c });
|
|
1030
|
+
}
|
|
1031
|
+
return {
|
|
1032
|
+
...se ? { header: B.map((c) => c.label) } : {},
|
|
1033
|
+
columns: B,
|
|
1034
|
+
rows: Be,
|
|
1035
|
+
...A.sqlChunkEvidence ? { rawTemporalClassification: A.sqlChunkEvidence } : {}
|
|
1036
|
+
};
|
|
1037
|
+
}
|
|
1038
|
+
function x(s, f, h) {
|
|
1039
|
+
if (f.activatedColumnKeys.has(s)) {
|
|
1040
|
+
const C = ve(f, s);
|
|
1041
|
+
return C === void 0 ? { kind: "text" } : { kind: "datetime", dateOnly: C };
|
|
1042
|
+
}
|
|
1043
|
+
const p = h.get(s);
|
|
1044
|
+
if (p) return { kind: "temporal_bucket", grain: mr(p) };
|
|
1045
|
+
if (a(s)) return { kind: "text" };
|
|
1046
|
+
const E = xe(t, s);
|
|
1047
|
+
if (E) return { kind: "datetime", dateOnly: lr(Ce(E)) };
|
|
1048
|
+
const w = i(s);
|
|
1049
|
+
return w ? { kind: "measure", format: w } : void 0;
|
|
1050
|
+
}
|
|
1051
|
+
function m(s, f) {
|
|
1052
|
+
if (!Number.isInteger(f) || f < 0)
|
|
1053
|
+
throw new Error("totalRows must be a non-negative integer");
|
|
1054
|
+
return f === 0 ? void 0 : (t.visibleColumns ?? Object.keys(s)).map((p) => {
|
|
1055
|
+
const w = Object.prototype.hasOwnProperty.call(s, p) ? s[p] : p === t.tableTotalsLabelColumnKey ? "Total" : null, C = n ? i(p) : void 0, T = be({
|
|
1056
|
+
key: p,
|
|
1057
|
+
label: p,
|
|
1058
|
+
formattedValues: n,
|
|
1059
|
+
dataType: "unknown",
|
|
1060
|
+
...C ? { presentation: { kind: "measure", format: C } } : {}
|
|
1061
|
+
});
|
|
1062
|
+
if (w == null) return { kind: "empty" };
|
|
1063
|
+
if (!n) return P({ value: w, text: String(w), column: T });
|
|
1064
|
+
const k = C ? cr(w) : null;
|
|
1065
|
+
return P(C && k !== null ? { value: k, text: G(k, C), column: T } : { value: w, text: String(w), column: T });
|
|
1066
|
+
});
|
|
1067
|
+
}
|
|
1068
|
+
return { format: y, totals: m };
|
|
1069
|
+
}
|
|
1070
|
+
const dr = /* @__PURE__ */ new Set([
|
|
1071
|
+
"scope",
|
|
1072
|
+
"useFormattedValues",
|
|
1073
|
+
"timezone",
|
|
1074
|
+
"presentationExecutionSnapshot",
|
|
1075
|
+
"delimiter",
|
|
1076
|
+
"csvEncoding",
|
|
1077
|
+
"includeHeaders",
|
|
1078
|
+
"columnSettings",
|
|
1079
|
+
"visibleColumns",
|
|
1080
|
+
"columnLabels",
|
|
1081
|
+
"tableTotalsLabelColumnKey",
|
|
1082
|
+
"fileFormat",
|
|
1083
|
+
"title"
|
|
1084
|
+
]);
|
|
1085
|
+
function oe(e) {
|
|
1086
|
+
return e !== null && typeof e == "object" && !Array.isArray(e);
|
|
1087
|
+
}
|
|
1088
|
+
function Ee(e, t) {
|
|
1089
|
+
if (e !== void 0) {
|
|
1090
|
+
if (!oe(e))
|
|
1091
|
+
throw new Error(`formatting.${t} must be an object`);
|
|
1092
|
+
return e;
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
function Jr(e) {
|
|
1096
|
+
if (!oe(e))
|
|
1097
|
+
throw new Error("formatting must be an object");
|
|
1098
|
+
const t = ["reportContext", "resolvedFormats"].find(
|
|
1099
|
+
(s) => Object.prototype.hasOwnProperty.call(e, s)
|
|
1100
|
+
);
|
|
1101
|
+
if (t)
|
|
1102
|
+
throw new de(
|
|
1103
|
+
`formatting.${t} is retired; formatting.presentationExecutionSnapshot is authoritative.`
|
|
1104
|
+
);
|
|
1105
|
+
const r = Object.keys(e).find((s) => !dr.has(s));
|
|
1106
|
+
if (r)
|
|
1107
|
+
throw new Error(`formatting contains unknown property "${r}"`);
|
|
1108
|
+
const n = typeof e.timezone == "string" ? e.timezone.trim() : "";
|
|
1109
|
+
if (!n)
|
|
1110
|
+
throw new Error("formatting.timezone must be a non-empty string");
|
|
1111
|
+
const o = rt(e.delimiter);
|
|
1112
|
+
if (!o)
|
|
1113
|
+
throw new Error("formatting.delimiter must be a comma, semicolon or tab");
|
|
1114
|
+
const i = ot(e.csvEncoding);
|
|
1115
|
+
if (!i)
|
|
1116
|
+
throw new Error("formatting.csvEncoding must be 'utf-8-bom' or 'utf-8'");
|
|
1117
|
+
if (typeof e.includeHeaders != "boolean")
|
|
1118
|
+
throw new Error("formatting.includeHeaders must be a boolean");
|
|
1119
|
+
if (e.useFormattedValues !== void 0 && typeof e.useFormattedValues != "boolean")
|
|
1120
|
+
throw new Error("formatting.useFormattedValues must be a boolean");
|
|
1121
|
+
const a = e.fileFormat === void 0 ? void 0 : nt(e.fileFormat);
|
|
1122
|
+
if (e.fileFormat !== void 0 && !a)
|
|
1123
|
+
throw new Error("formatting.fileFormat must be 'csv' or 'xlsx'");
|
|
1124
|
+
if (e.title !== void 0 && typeof e.title != "string")
|
|
1125
|
+
throw new Error("formatting.title must be a string");
|
|
1126
|
+
const l = e.visibleColumns === void 0 ? void 0 : Array.isArray(e.visibleColumns) && e.visibleColumns.every((s) => typeof s == "string") ? e.visibleColumns : void 0;
|
|
1127
|
+
if (e.visibleColumns !== void 0 && !l)
|
|
1128
|
+
throw new Error("formatting.visibleColumns must be an array of strings");
|
|
1129
|
+
const d = Ee(e.columnLabels, "columnLabels");
|
|
1130
|
+
if (d && Object.values(d).some((s) => typeof s != "string"))
|
|
1131
|
+
throw new Error("formatting.columnLabels values must be strings");
|
|
1132
|
+
const u = Ee(e.columnSettings, "columnSettings"), g = e.tableTotalsLabelColumnKey === void 0 ? void 0 : typeof e.tableTotalsLabelColumnKey == "string" && e.tableTotalsLabelColumnKey.trim() ? e.tableTotalsLabelColumnKey : null;
|
|
1133
|
+
if (g === null)
|
|
1134
|
+
throw new Error("formatting.tableTotalsLabelColumnKey must be a non-empty string");
|
|
1135
|
+
if (g && !(l != null && l.includes(g)))
|
|
1136
|
+
throw new Error("formatting.tableTotalsLabelColumnKey must identify a visible column");
|
|
1137
|
+
const y = ut(e.scope, "formatting.scope");
|
|
1138
|
+
if (!y.cardId || y.attachmentIndex !== void 0)
|
|
1139
|
+
throw new Error("formatting.scope must identify exactly one dashboard card");
|
|
1140
|
+
const x = e.useFormattedValues !== !1, m = mt(e.presentationExecutionSnapshot);
|
|
1141
|
+
if (n !== m.reportContext.calendar.tz)
|
|
1142
|
+
throw new Error(
|
|
1143
|
+
"formatting.timezone must equal presentationExecutionSnapshot.reportContext.calendar.tz"
|
|
1144
|
+
);
|
|
1145
|
+
try {
|
|
1146
|
+
dt({
|
|
1147
|
+
snapshot: m,
|
|
1148
|
+
expectedScope: { dashboardId: y.dashboardId, cardId: y.cardId },
|
|
1149
|
+
visibleColumns: l,
|
|
1150
|
+
useFormattedValues: x
|
|
1151
|
+
});
|
|
1152
|
+
} catch (s) {
|
|
1153
|
+
throw new de(
|
|
1154
|
+
`formatting.presentationExecutionSnapshot.${s instanceof Error ? s.message : String(s)}`
|
|
1155
|
+
);
|
|
1156
|
+
}
|
|
1157
|
+
return {
|
|
1158
|
+
scope: { dashboardId: y.dashboardId, cardId: y.cardId },
|
|
1159
|
+
useFormattedValues: x,
|
|
1160
|
+
timezone: n,
|
|
1161
|
+
presentationExecutionSnapshot: m,
|
|
1162
|
+
delimiter: o,
|
|
1163
|
+
csvEncoding: i,
|
|
1164
|
+
includeHeaders: e.includeHeaders,
|
|
1165
|
+
...u ? { columnSettings: u } : {},
|
|
1166
|
+
...l ? { visibleColumns: l } : {},
|
|
1167
|
+
...d ? { columnLabels: d } : {},
|
|
1168
|
+
...g ? { tableTotalsLabelColumnKey: g } : {},
|
|
1169
|
+
...a ? { fileFormat: a } : {},
|
|
1170
|
+
...typeof e.title == "string" ? { title: e.title } : {}
|
|
1171
|
+
};
|
|
1172
|
+
}
|
|
1173
|
+
function Qr(e) {
|
|
1174
|
+
const t = e.formatOptions, r = (n) => oe(n) ? n : void 0;
|
|
1175
|
+
return {
|
|
1176
|
+
scope: { dashboardId: e.dashboardId, cardId: e.cardId },
|
|
1177
|
+
useFormattedValues: t.useFormattedValues !== !1,
|
|
1178
|
+
timezone: t.presentationExecutionSnapshot.reportContext.calendar.tz,
|
|
1179
|
+
presentationExecutionSnapshot: t.presentationExecutionSnapshot,
|
|
1180
|
+
delimiter: typeof t.delimiter == "string" ? t.delimiter : ",",
|
|
1181
|
+
csvEncoding: t.csvEncoding,
|
|
1182
|
+
includeHeaders: t.includeHeaders !== !1,
|
|
1183
|
+
columnSettings: r(t.columnSettings),
|
|
1184
|
+
visibleColumns: Array.isArray(t.visibleColumns) ? t.visibleColumns : void 0,
|
|
1185
|
+
columnLabels: r(t.columnLabels),
|
|
1186
|
+
tableTotalsLabelColumnKey: typeof t.tableTotalsLabelColumnKey == "string" ? t.tableTotalsLabelColumnKey : void 0,
|
|
1187
|
+
...e.fileFormat ? { fileFormat: e.fileFormat } : {},
|
|
1188
|
+
...typeof e.title == "string" ? { title: e.title } : {}
|
|
1189
|
+
};
|
|
1190
|
+
}
|
|
1191
|
+
const fr = /^\d{4}-\d{2}-\d{2}$/;
|
|
1192
|
+
function Ke(e) {
|
|
1193
|
+
const t = e.split(".");
|
|
1194
|
+
return t[t.length - 1].replace(/_/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").split(" ").map((o) => o.charAt(0).toUpperCase() + o.slice(1).toLowerCase()).join(" ");
|
|
1195
|
+
}
|
|
1196
|
+
const Se = 10;
|
|
1197
|
+
function Q(e, t) {
|
|
1198
|
+
const r = e.slice(0, Se).map(t).join(", "), n = e.length - Se;
|
|
1199
|
+
return n > 0 ? `${r}, and ${n} more` : r;
|
|
1200
|
+
}
|
|
1201
|
+
function gr(e) {
|
|
1202
|
+
if (e.valueType !== "date" || e.operation !== "between" && e.operation !== "not between")
|
|
1203
|
+
return;
|
|
1204
|
+
const t = re(e.relativeMeta);
|
|
1205
|
+
if (t)
|
|
1206
|
+
return it(t) || t.unit === "quarter" || t.unit === "year" ? t : void 0;
|
|
1207
|
+
}
|
|
1208
|
+
function pr(e, t) {
|
|
1209
|
+
if (t !== "label") return gr(e);
|
|
1210
|
+
if (!(e.valueType !== "date" || e.operation !== "between" && e.operation !== "not between"))
|
|
1211
|
+
return re(e.relativeMeta);
|
|
1212
|
+
}
|
|
1213
|
+
function Fe(e, t = {}) {
|
|
1214
|
+
const { name: r, operation: n, values: o, valueType: i } = e, a = t.label ?? Ke(r), l = pr(e, t.relativeDates);
|
|
1215
|
+
if (l) {
|
|
1216
|
+
const u = ht(l);
|
|
1217
|
+
if (u)
|
|
1218
|
+
return n === "between" ? `${a}: ${u}` : `${a} not in ${u}`;
|
|
1219
|
+
}
|
|
1220
|
+
if (!o || o.length === 0)
|
|
1221
|
+
return n === "is null" ? `${a} is empty` : n === "is not null" ? `${a} is not empty` : "";
|
|
1222
|
+
const d = (u) => {
|
|
1223
|
+
if (i === "date" && u) {
|
|
1224
|
+
const g = e.temporalPrecision === "minute", y = {
|
|
1225
|
+
year: "numeric",
|
|
1226
|
+
month: "short",
|
|
1227
|
+
day: "numeric",
|
|
1228
|
+
...g ? {
|
|
1229
|
+
hour: "numeric",
|
|
1230
|
+
minute: "2-digit"
|
|
1231
|
+
} : {}
|
|
1232
|
+
};
|
|
1233
|
+
if (typeof u == "string" && fr.test(u)) {
|
|
1234
|
+
const [m, s, f] = u.split("-").map(Number);
|
|
1235
|
+
return new Intl.DateTimeFormat(void 0, {
|
|
1236
|
+
year: "numeric",
|
|
1237
|
+
month: "short",
|
|
1238
|
+
day: "numeric",
|
|
1239
|
+
timeZone: "UTC"
|
|
1240
|
+
}).format(new Date(Date.UTC(m, s - 1, f)));
|
|
1241
|
+
}
|
|
1242
|
+
if (typeof u == "string" && Qe(u) === "wall_datetime") {
|
|
1243
|
+
const [m, s, f, h, p] = u.split(/[-T :.]/).map(Number);
|
|
1244
|
+
return new Intl.DateTimeFormat(void 0, {
|
|
1245
|
+
...y,
|
|
1246
|
+
timeZone: "UTC"
|
|
1247
|
+
}).format(new Date(Date.UTC(m, s - 1, f, h, p)));
|
|
1248
|
+
}
|
|
1249
|
+
const x = new Date(u);
|
|
1250
|
+
if (!isNaN(x.getTime()))
|
|
1251
|
+
try {
|
|
1252
|
+
return new Intl.DateTimeFormat(void 0, {
|
|
1253
|
+
...y,
|
|
1254
|
+
...t.timezone ? { timeZone: t.timezone } : {}
|
|
1255
|
+
}).format(x);
|
|
1256
|
+
} catch {
|
|
1257
|
+
return g ? x.toLocaleString(void 0, y) : x.toLocaleDateString(void 0, y);
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
return String(u);
|
|
1261
|
+
};
|
|
1262
|
+
switch (n) {
|
|
1263
|
+
case "=":
|
|
1264
|
+
return `${a}: ${d(o[0])}`;
|
|
1265
|
+
case "!=":
|
|
1266
|
+
return `${a} ≠ ${d(o[0])}`;
|
|
1267
|
+
case ">":
|
|
1268
|
+
return `${a} > ${d(o[0])}`;
|
|
1269
|
+
case "<":
|
|
1270
|
+
return `${a} < ${d(o[0])}`;
|
|
1271
|
+
case ">=":
|
|
1272
|
+
return `${a} ≥ ${d(o[0])}`;
|
|
1273
|
+
case "<=":
|
|
1274
|
+
return `${a} ≤ ${d(o[0])}`;
|
|
1275
|
+
case "between":
|
|
1276
|
+
case "not between": {
|
|
1277
|
+
const u = `${d(o[0])} - ${d(o[1])}`;
|
|
1278
|
+
return n === "between" ? `${a}: ${u}` : `${a} not in ${u}`;
|
|
1279
|
+
}
|
|
1280
|
+
case "in":
|
|
1281
|
+
return o.length === 1 ? `${a}: ${d(o[0])}` : `${a}: ${Q(o, d)}`;
|
|
1282
|
+
case "not in":
|
|
1283
|
+
return `${a} not in (${Q(o, d)})`;
|
|
1284
|
+
case "like":
|
|
1285
|
+
return `${a} contains "${o[0]}"`;
|
|
1286
|
+
case "not like":
|
|
1287
|
+
return `${a} doesn't contain "${o[0]}"`;
|
|
1288
|
+
default:
|
|
1289
|
+
return `${a}: ${Q(o, d)}`;
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
function eo(e, t = {}) {
|
|
1293
|
+
if (!e || e.length === 0)
|
|
1294
|
+
return "";
|
|
1295
|
+
const r = /* @__PURE__ */ new Map();
|
|
1296
|
+
e.forEach((o) => {
|
|
1297
|
+
const i = r.get(o.name) || [];
|
|
1298
|
+
i.push(o), r.set(o.name, i);
|
|
1299
|
+
});
|
|
1300
|
+
const n = [];
|
|
1301
|
+
return r.forEach((o, i) => {
|
|
1302
|
+
if (o.length === 1) {
|
|
1303
|
+
const a = Fe(o[0], t);
|
|
1304
|
+
a && n.push(a);
|
|
1305
|
+
} else {
|
|
1306
|
+
const a = Ke(i), l = o.map((d) => Fe(d, t).replace(`${a}: `, "").replace(`${a} `, "")).filter(Boolean);
|
|
1307
|
+
l.length > 0 && n.push(`${a}: ${l.join(" and ")}`);
|
|
1308
|
+
}
|
|
1309
|
+
}), n.join(" | ");
|
|
1310
|
+
}
|
|
1311
|
+
function to(e) {
|
|
1312
|
+
return ((e == null ? void 0 : e.filterValues) ?? []).filter(br).map(yr);
|
|
1313
|
+
}
|
|
1314
|
+
function br(e) {
|
|
1315
|
+
return !!e && typeof e == "object" && typeof e.name == "string" && Array.isArray(e.values);
|
|
1316
|
+
}
|
|
1317
|
+
function yr(e) {
|
|
1318
|
+
if (!("relativeMeta" in e) || e.relativeMeta === void 0) return e;
|
|
1319
|
+
const { relativeMeta: t, ...r } = e, n = re(t);
|
|
1320
|
+
return n ? { ...r, relativeMeta: n } : r;
|
|
1321
|
+
}
|
|
1322
|
+
const hr = /* @__PURE__ */ new Set([
|
|
1323
|
+
"day",
|
|
1324
|
+
"week",
|
|
1325
|
+
"month",
|
|
1326
|
+
"quarter",
|
|
1327
|
+
"year"
|
|
1328
|
+
]);
|
|
1329
|
+
function wr(e, t) {
|
|
1330
|
+
try {
|
|
1331
|
+
const r = $(
|
|
1332
|
+
V(e),
|
|
1333
|
+
t,
|
|
1334
|
+
"yyyy-MM-dd"
|
|
1335
|
+
), [n, o, i] = r.split("-").map(Number), a = new Date(Date.UTC(n, o - 1, i));
|
|
1336
|
+
return a.setUTCDate(a.getUTCDate() - 1), $(a, "UTC", "yyyy-MM-dd");
|
|
1337
|
+
} catch {
|
|
1338
|
+
return;
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
function ro(e, t, r, n = !1) {
|
|
1342
|
+
const o = vr(
|
|
1343
|
+
e,
|
|
1344
|
+
t,
|
|
1345
|
+
r,
|
|
1346
|
+
n
|
|
1347
|
+
);
|
|
1348
|
+
return `${o.start} - ${o.end}`;
|
|
1349
|
+
}
|
|
1350
|
+
function vr(e, t, r, n = !1) {
|
|
1351
|
+
try {
|
|
1352
|
+
if (r && hr.has(r)) {
|
|
1353
|
+
const o = wr(e.end, t);
|
|
1354
|
+
if (o) {
|
|
1355
|
+
const i = n ? "MMM d" : "MMM d, yyyy";
|
|
1356
|
+
return {
|
|
1357
|
+
start: $(
|
|
1358
|
+
V(e.start),
|
|
1359
|
+
t,
|
|
1360
|
+
i
|
|
1361
|
+
),
|
|
1362
|
+
end: $(
|
|
1363
|
+
V(`${o}T00:00:00Z`),
|
|
1364
|
+
"UTC",
|
|
1365
|
+
"MMM d, yyyy"
|
|
1366
|
+
)
|
|
1367
|
+
};
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
if (r === "second" || r === "minute" || r === "hour") {
|
|
1371
|
+
const o = n ? "MMM d, h:mm a" : "MMM d, yyyy, h:mm a";
|
|
1372
|
+
return {
|
|
1373
|
+
start: $(V(e.start), t, o),
|
|
1374
|
+
end: `before ${$(
|
|
1375
|
+
V(e.end),
|
|
1376
|
+
t,
|
|
1377
|
+
o
|
|
1378
|
+
)}`
|
|
1379
|
+
};
|
|
1380
|
+
}
|
|
1381
|
+
} catch {
|
|
1382
|
+
}
|
|
1383
|
+
return { start: e.start, end: `before ${e.end}` };
|
|
1384
|
+
}
|
|
1385
|
+
export {
|
|
1386
|
+
Zr as A,
|
|
1387
|
+
Se as B,
|
|
1388
|
+
gr as C,
|
|
1389
|
+
_e as D,
|
|
1390
|
+
Fe as E,
|
|
1391
|
+
_t as F,
|
|
1392
|
+
eo as G,
|
|
1393
|
+
to as H,
|
|
1394
|
+
Xt as I,
|
|
1395
|
+
te as J,
|
|
1396
|
+
Wt as K,
|
|
1397
|
+
Yt as L,
|
|
1398
|
+
Nr as M,
|
|
1399
|
+
Zt as N,
|
|
1400
|
+
Wr as O,
|
|
1401
|
+
Ot as P,
|
|
1402
|
+
Pe as Q,
|
|
1403
|
+
Yr as R,
|
|
1404
|
+
qt as S,
|
|
1405
|
+
Kt as T,
|
|
1406
|
+
vr as U,
|
|
1407
|
+
Dr as a,
|
|
1408
|
+
Vr as b,
|
|
1409
|
+
Or as c,
|
|
1410
|
+
Kr as d,
|
|
1411
|
+
Pr as e,
|
|
1412
|
+
ro as f,
|
|
1413
|
+
Ur as g,
|
|
1414
|
+
Gr as h,
|
|
1415
|
+
zr as i,
|
|
1416
|
+
jt as j,
|
|
1417
|
+
Hr as k,
|
|
1418
|
+
Br as l,
|
|
1419
|
+
Bt as m,
|
|
1420
|
+
jr as n,
|
|
1421
|
+
Rt as o,
|
|
1422
|
+
Ut as p,
|
|
1423
|
+
Pt as q,
|
|
1424
|
+
be as r,
|
|
1425
|
+
Vt as s,
|
|
1426
|
+
P as t,
|
|
1427
|
+
zt as u,
|
|
1428
|
+
Ht as v,
|
|
1429
|
+
Xr as w,
|
|
1430
|
+
qr as x,
|
|
1431
|
+
Jr as y,
|
|
1432
|
+
Qr as z
|
|
1433
|
+
};
|