react-semaphor 0.1.555 → 0.1.557
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/DATA_APP_SDK.md +6 -29
- package/dist/analytics-protocol/index.js +20 -21
- package/dist/assistant-context/index.js +1 -1
- package/dist/assistant-protocol/index.js +5 -5
- package/dist/brand-studio/index.js +426 -444
- package/dist/briefings/index.js +56 -57
- package/dist/chunks/{analytics-base-schemas-BKs3flFS.js → analytics-base-schemas-BUFUoO6G.js} +2 -2
- package/dist/chunks/{assistant-chat-8NZP6m-u.js → assistant-chat-WMTpYirZ.js} +79 -81
- package/dist/chunks/{bookmark-state-BAeGKd3s.js → bookmark-state-PjQpxbG7.js} +3 -3
- package/dist/chunks/{braces-o9UiRQes.js → braces-BOErQVyi.js} +1 -1
- package/dist/chunks/comparison-window-caption-Dc7BaCMz.js +1218 -0
- package/dist/chunks/{context-BerEBuFR.js → context-DVy4HOU0.js} +1 -1
- package/dist/chunks/{custom-visual-inputs-Gw-Ggg3O.js → custom-visual-inputs-CxYI-gFa.js} +31 -33
- package/dist/chunks/{dashboard-Ds68ckO3.js → dashboard-4D8Vy4pL.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-DlTr-VGc.js → dashboard-briefing-launcher-C4EmOfxs.js} +149 -151
- package/dist/chunks/{dashboard-controls-oNXJZN6x.js → dashboard-controls-DBWykmvL.js} +171 -173
- package/dist/chunks/{dashboard-json-CW7Q_efH.js → dashboard-json-DiX-p0F7.js} +21 -22
- package/dist/chunks/{document-dashboard-inputs-C21mL3ib.js → document-dashboard-inputs-DP5hquBR.js} +32 -32
- package/dist/chunks/{edit-dashboard-visual-BnnT_oKR.js → edit-dashboard-visual-n1jLV_7V.js} +5842 -5955
- package/dist/chunks/{filter-reach-copy-DlNPHbE-.js → filter-reach-copy-BB9iakLA.js} +915 -986
- package/dist/chunks/{filter-value-text-DMrpj4h9.js → filter-value-text-CUBpotVN.js} +5 -5
- package/dist/chunks/{global-date-filter-utils-7OboTgrM.js → global-date-filter-utils-Cc5tqkoW.js} +2908 -3112
- package/dist/chunks/{index-B2k6KtUN.js → index-CgjhzkKM.js} +72 -80
- package/dist/chunks/{index-CtoK1Lgu.js → index-dIV-Gdsb.js} +159 -161
- package/dist/chunks/{layout-grid-Bgzth8vd.js → layout-grid-CcNklCwL.js} +1 -1
- package/dist/chunks/{list-filter-DsaTbM3J.js → list-filter-Ds_4UTpD.js} +1 -1
- package/dist/chunks/{matrix-analytical-definition-DPVGg1mU.js → matrix-analytical-definition-4GTUDheD.js} +22 -22
- package/dist/chunks/{matrix-card-D9bsdAye.js → matrix-card-fS_4O7zA.js} +3 -3
- package/dist/chunks/{matrix-member-presentation-DRWcJ8Mi.js → matrix-member-presentation-Dj7HaAHC.js} +1 -1
- package/dist/chunks/{matrix-operation-contract--lMaLlpV.js → matrix-operation-contract-CpgLZ7E5.js} +52 -52
- package/dist/chunks/{metric-comparison-CYIt2F5X.js → metric-comparison-C8LY7GG5.js} +4 -4
- package/dist/chunks/{model-change-B0rAK-5w.js → model-change-CJEj3ZD6.js} +1 -1
- package/dist/chunks/{palette-D10o_yYX.js → palette-DMkIhagj.js} +1 -1
- package/dist/chunks/{matrix-formatter-K2OVPJQI.js → pivot-result-contract-expectations-DMk-mKhG.js} +451 -402
- package/dist/chunks/pivot-result-identity-CrQ54Xbj.js +77 -0
- package/dist/chunks/{raw-temporal-presentation-CivONfcO.js → raw-temporal-presentation-DdEpgPRB.js} +25 -26
- package/dist/chunks/report-preferences-dialog-CFg5VFLk.js +2109 -0
- package/dist/chunks/{report-runtime-context-BaIKSaja.js → report-runtime-context-CohdtiMg.js} +2 -2
- package/dist/chunks/{resolve-dashboard-input-context-CIm9A8_j.js → resolve-dashboard-input-context-Djl3kCFL.js} +1396 -1550
- package/dist/chunks/{save-CfJpQQ68.js → save-D1EpMcwT.js} +1 -1
- package/dist/chunks/{saved-dashboard-context-akb9JfOL.js → saved-dashboard-context-umlQFevH.js} +9 -9
- package/dist/chunks/selection-reducer-_d6aKJnj.js +46 -0
- package/dist/chunks/{semaphor-ready-indicator-Ba7dwP5_.js → semaphor-ready-indicator-4cOp6sla.js} +54479 -63899
- package/dist/chunks/{shelf-drop-preview-context-5rg3pJHW.js → shelf-drop-preview-context-DAtRuvR7.js} +7 -7
- package/dist/chunks/{source-entity-resolution-CGymm5td.js → source-entity-resolution-DXW1HpKf.js} +1 -1
- package/dist/chunks/{switch-B-UTI6v-.js → switch-9CJt5EF_.js} +1431 -1342
- package/dist/chunks/{table-export-sheet-CgO6gaSM.js → table-export-sheet-CTCTA_bd.js} +1 -1
- package/dist/chunks/{table-settings-DOT_Bv1m.js → table-settings-DF1gdVQR.js} +3 -3
- package/dist/chunks/temporal-input-presentation-DoSniQj1.js +2939 -0
- package/dist/chunks/{token-types-DYECHYGH.js → token-types-DFyLflLY.js} +1 -1
- package/dist/chunks/{upload-BFX7apKV.js → upload-LSNKpt0w.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-BHNs0wl7.js → use-create-flow-overlay-state-esyMT9vU.js} +125 -127
- package/dist/chunks/{validators-ClKLGDGZ.js → validators-hmfNNQz8.js} +305 -307
- package/dist/chunks/zoned-wall-clock-E35Frf9v.js +191 -0
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +168 -169
- package/dist/data-app-sdk/index.js +789 -4154
- package/dist/data-app-sdk-adapters/index.js +3 -3
- package/dist/data-app-sdk-validation/index.js +6 -6
- package/dist/format-utils/index.js +234 -253
- package/dist/index.js +233 -235
- package/dist/layouts/index.js +1 -1
- package/dist/pdf-export-policy/index.js +9 -11
- package/dist/report-runtime-context/index.js +2 -2
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/brand-studio/brand-studio-draft.d.ts +0 -3
- package/dist/types/brand-studio/index.d.ts +1 -1
- package/dist/types/components/visual/data-table/types/data-table.d.ts +0 -1
- package/dist/types/components/visual/shared/utils/table-column-order.d.ts +0 -6
- package/dist/types/data-app-sdk/contracts.d.ts +0 -146
- package/dist/types/data-app-sdk/index.d.ts +0 -2
- package/dist/types/index.js +27 -28
- package/dist/types/lib/api/exports-api.d.ts +1 -1
- package/dist/types/lib/charts/table-chart-types.d.ts +1 -1
- package/dist/types/lib/charts/types.d.ts +2 -2
- package/dist/types/lib/dashboard-viewer/export-table-view.d.ts +0 -3
- package/dist/types/lib/document/document-edits.d.ts +1 -1
- package/dist/types/lib/document/document-section-kinds.d.ts +2 -4
- package/dist/types/lib/document/document-table-data-policy.d.ts +1 -2
- package/dist/types/lib/formatters/grouped-temporal-activation.d.ts +3 -3
- package/dist/types/lib/formatters/grouped-temporal-presentation.d.ts +0 -6
- package/dist/types/lib/query-context/card-server-request.d.ts +0 -1
- package/dist/types/lib/table-formatting/table-formatting-types.d.ts +1 -1
- package/dist/types/lib/types/common-types.d.ts +0 -7
- package/dist/types/lib/types/explorer-types.d.ts +1 -14
- package/dist/types/lib/utils/card-config-utils.d.ts +11 -1
- package/dist/types/shared/dashboard-authoring/card-export-request.d.ts +1 -2
- package/dist/types/shared/dashboard-authoring/filter-model/filter-definitions.d.ts +1 -7
- package/dist/types/shared/dashboard-authoring/legacy-table-routing.d.ts +9 -4
- package/dist/types/shared/format-utils/grouped-table-presentation.d.ts +0 -14
- package/dist/types/shared/format-utils/index.d.ts +0 -2
- package/dist/types/shared/format-utils/pdf-export-policy.d.ts +1 -1
- package/dist/types/shared/format-utils/pivot-result-contract-expectations.d.ts +2 -20
- package/dist/types/shared/format-utils/pivot-result-identity.d.ts +0 -20
- package/dist/types/shared/format-utils/table-export/prepare-table-export.d.ts +0 -1
- package/dist/types/shared/format-utils/table-export/table-export-result.d.ts +0 -4
- package/package.json +2 -4
- package/src/data-app-sdk/README.md +7 -31
- package/dist/chunks/comparison-window-caption-C2WNTlxK.js +0 -1433
- package/dist/chunks/pivot-header-presentation-CX4fkRuG.js +0 -42
- package/dist/chunks/pivot-result-identity-BHJGZwIc.js +0 -94
- package/dist/chunks/pivot-result-lifecycle-BygCpOhk.js +0 -1238
- package/dist/chunks/raw-temporal-contract-WuXA8jBP.js +0 -64
- package/dist/chunks/report-preferences-dialog-D_KyuEFx.js +0 -2261
- package/dist/chunks/selection-reducer-yw_JgICP.js +0 -111
- package/dist/chunks/temporal-bucket-C4rqmwaQ.js +0 -2071
- package/dist/chunks/x-4f5U2XwU.js +0 -100
- package/dist/chunks/zoned-wall-clock-MulfA26h.js +0 -129
- package/dist/types/components/visual/pivot-table/types.d.ts +0 -80
- package/dist/types/data-app-sdk/devtools/index.d.ts +0 -49
- package/dist/types/data-app-sdk/devtools.d.ts +0 -1
- package/dist/types/shared/format-utils/aggregate-table-row-presentation.d.ts +0 -85
- package/dist/types/shared/format-utils/pivot-result-lifecycle.d.ts +0 -55
|
@@ -0,0 +1,2939 @@
|
|
|
1
|
+
var kt = Object.defineProperty;
|
|
2
|
+
var _t = (e, t, r) => t in e ? kt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var v = (e, t, r) => _t(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { aO as je, aP as bt, aQ as Nt, l as Mt, X as $t, P as I, o as It } from "./validators-hmfNNQz8.js";
|
|
5
|
+
import { z as f } from "zod";
|
|
6
|
+
import { E as Ke, l as He } from "./export-file-format-C-tJsxsf.js";
|
|
7
|
+
import { b as Et } from "./report-runtime-context-CohdtiMg.js";
|
|
8
|
+
import { canonicalizeSupportedLocale as F, canonicalizeSupportedCurrencyCode as ce, DEFAULT_RESOLVED_VALUE_FORMAT_PREFERENCES as Ft } from "../value-format-preferences/index.js";
|
|
9
|
+
import { i as L } from "./analytics-base-schemas-BUFUoO6G.js";
|
|
10
|
+
import { p as Ct, z as Ut } from "./zoned-wall-clock-E35Frf9v.js";
|
|
11
|
+
function Ze(e) {
|
|
12
|
+
if (!e || typeof e != "object") return !1;
|
|
13
|
+
const t = e.type;
|
|
14
|
+
return t === "number" || t === "currency" || t === "percent" || t === "scientific";
|
|
15
|
+
}
|
|
16
|
+
function ya(e) {
|
|
17
|
+
return Ze(e) || !!e && typeof e == "object" && e.type === "duration";
|
|
18
|
+
}
|
|
19
|
+
const qe = [
|
|
20
|
+
"day",
|
|
21
|
+
"hour",
|
|
22
|
+
"minute",
|
|
23
|
+
"second",
|
|
24
|
+
"millisecond"
|
|
25
|
+
], ue = {
|
|
26
|
+
day: 864e5,
|
|
27
|
+
hour: 36e5,
|
|
28
|
+
minute: 6e4,
|
|
29
|
+
second: 1e3,
|
|
30
|
+
millisecond: 1
|
|
31
|
+
}, zt = {
|
|
32
|
+
day: "d",
|
|
33
|
+
hour: "hr",
|
|
34
|
+
minute: "min",
|
|
35
|
+
second: "s",
|
|
36
|
+
millisecond: "ms"
|
|
37
|
+
}, At = {
|
|
38
|
+
day: ["day", "days"],
|
|
39
|
+
hour: ["hour", "hours"],
|
|
40
|
+
minute: ["minute", "minutes"],
|
|
41
|
+
second: ["second", "seconds"],
|
|
42
|
+
millisecond: ["millisecond", "milliseconds"]
|
|
43
|
+
};
|
|
44
|
+
function Yt(e) {
|
|
45
|
+
return e === "day" || e === "hour" || e === "minute" || e === "second" || e === "millisecond";
|
|
46
|
+
}
|
|
47
|
+
function Be(e, t) {
|
|
48
|
+
return Yt(e) ? e : t;
|
|
49
|
+
}
|
|
50
|
+
function Se(e, t) {
|
|
51
|
+
return qe.indexOf(Be(e, t));
|
|
52
|
+
}
|
|
53
|
+
function Rt(e, t) {
|
|
54
|
+
const r = Se(e, "day"), n = Se(t, "second"), a = Math.min(r, n), i = Math.max(r, n);
|
|
55
|
+
return qe.slice(a, i + 1);
|
|
56
|
+
}
|
|
57
|
+
function Ot(e, t) {
|
|
58
|
+
return e * ue[Be(t, "second")];
|
|
59
|
+
}
|
|
60
|
+
function Pt(e, t) {
|
|
61
|
+
const r = Rt(t.largestUnit, t.smallestUnit), n = r[r.length - 1], a = ue[n];
|
|
62
|
+
let i = Math.round(e / a) * a;
|
|
63
|
+
return r.map((o) => {
|
|
64
|
+
const s = ue[o], c = Math.floor(i / s);
|
|
65
|
+
return i -= c * s, { unit: o, value: c };
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function Lt(e, t) {
|
|
69
|
+
const r = e.filter((i) => i.value !== 0), n = r.length > 0 ? r : [e[e.length - 1]], a = typeof t == "number" && Number.isFinite(t) ? Math.max(1, Math.trunc(t)) : n.length;
|
|
70
|
+
return n.slice(0, a).map((i) => `${i.value}${zt[i.unit]}`).join(" ");
|
|
71
|
+
}
|
|
72
|
+
function jt(e, t) {
|
|
73
|
+
const r = e.filter((i) => i.value !== 0), n = r.length > 0 ? r : [e[e.length - 1]], a = typeof t == "number" && Number.isFinite(t) ? Math.max(1, Math.trunc(t)) : n.length;
|
|
74
|
+
return n.slice(0, a).map((i) => {
|
|
75
|
+
const [o, s] = At[i.unit];
|
|
76
|
+
return `${i.value} ${i.value === 1 ? o : s}`;
|
|
77
|
+
}).join(" ");
|
|
78
|
+
}
|
|
79
|
+
function Kt(e) {
|
|
80
|
+
const t = e.some(
|
|
81
|
+
(c) => c.unit === "day" && c.value !== 0
|
|
82
|
+
), r = e.some((c) => c.unit === "millisecond"), n = e.findIndex((c) => c.value !== 0), a = Math.max(0, e.length - 2), i = t ? 0 : n === -1 ? a : Math.min(n, a), o = n === -1 ? e.slice(a) : e.slice(i);
|
|
83
|
+
if (o.length === 0)
|
|
84
|
+
return "0";
|
|
85
|
+
const s = o.map((c, u) => c.unit === "millisecond" ? String(c.value).padStart(3, "0") : u === 0 ? String(c.value) : String(c.value).padStart(2, "0")).join(":");
|
|
86
|
+
return r ? s.replace(/:(\d{3})$/, ".$1") : s;
|
|
87
|
+
}
|
|
88
|
+
function Ht(e, t, r) {
|
|
89
|
+
const n = `${r.prefix || ""}${e}${r.suffix || ""}`;
|
|
90
|
+
return t ? r.negativeInParentheses ? `(${n})` : `-${n}` : n;
|
|
91
|
+
}
|
|
92
|
+
function Zt(e, t = {}) {
|
|
93
|
+
if (e == null)
|
|
94
|
+
return "";
|
|
95
|
+
const r = typeof e == "number" ? e : typeof e == "string" && e.trim() ? Number(e) : NaN;
|
|
96
|
+
if (!Number.isFinite(r))
|
|
97
|
+
return "";
|
|
98
|
+
const n = t.inputUnit || "second", a = t.outputStyle === "digital" || t.outputStyle === "long" ? t.outputStyle : "compact", i = r < 0, o = Math.abs(Ot(r, n)), s = Pt(o, t), c = a === "digital" ? Kt(s) : a === "long" ? jt(s, t.maxUnits) : Lt(s, t.maxUnits);
|
|
99
|
+
return Ht(c, i, t);
|
|
100
|
+
}
|
|
101
|
+
function Ve(e, t) {
|
|
102
|
+
return Zt(
|
|
103
|
+
e !== null && typeof e == "object" ? e.value : e,
|
|
104
|
+
{
|
|
105
|
+
inputUnit: t.inputUnit,
|
|
106
|
+
outputStyle: t.outputStyle,
|
|
107
|
+
largestUnit: t.largestUnit,
|
|
108
|
+
smallestUnit: t.smallestUnit,
|
|
109
|
+
maxUnits: t.maxUnits,
|
|
110
|
+
prefix: t.prefix,
|
|
111
|
+
suffix: t.suffix,
|
|
112
|
+
negativeInParentheses: t.negativeStyle === "parentheses"
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
let ve;
|
|
117
|
+
function xe(e, t) {
|
|
118
|
+
const r = e.format;
|
|
119
|
+
return r(t);
|
|
120
|
+
}
|
|
121
|
+
function qt(e, t) {
|
|
122
|
+
if (ve ?? (ve = xe(
|
|
123
|
+
new Intl.NumberFormat("en-US", { useGrouping: !1, maximumFractionDigits: 6 }),
|
|
124
|
+
"9007199254740993.000009"
|
|
125
|
+
) === "9007199254740993.000009"), !ve)
|
|
126
|
+
throw new RangeError("This runtime cannot format exact decimal strings.");
|
|
127
|
+
const r = Number(e);
|
|
128
|
+
if (!Number.isFinite(r) || r === 0 && e !== "0")
|
|
129
|
+
throw new RangeError("Exact value is outside the Intl formatting range; use raw text.");
|
|
130
|
+
return xe(t, e);
|
|
131
|
+
}
|
|
132
|
+
function G(e) {
|
|
133
|
+
return typeof e == "number" ? e < 0 : e.value.startsWith("-");
|
|
134
|
+
}
|
|
135
|
+
function j(e) {
|
|
136
|
+
return typeof e == "number" ? Math.abs(e) : G(e) ? { ...e, value: e.value.slice(1) } : e;
|
|
137
|
+
}
|
|
138
|
+
function Ge(e, t) {
|
|
139
|
+
return typeof e == "number" ? e * t : {
|
|
140
|
+
kind: "exact_number",
|
|
141
|
+
type: "decimal",
|
|
142
|
+
value: je(e.value, t)
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function K(e, t) {
|
|
146
|
+
return t === 0 ? e : typeof e == "number" ? e / 10 ** t : {
|
|
147
|
+
kind: "exact_number",
|
|
148
|
+
type: "decimal",
|
|
149
|
+
value: je(e.value, `1e-${t}`)
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function b(e, t) {
|
|
153
|
+
return typeof e == "number" ? t.format(e) : qt(e.value, t);
|
|
154
|
+
}
|
|
155
|
+
function De(e) {
|
|
156
|
+
if (!e) return !1;
|
|
157
|
+
const t = e.toLowerCase().replace("_", "-");
|
|
158
|
+
return t === "en-in" || t.startsWith("en-in-");
|
|
159
|
+
}
|
|
160
|
+
function ke(e, t) {
|
|
161
|
+
const r = j(e), n = (a) => typeof r == "number" ? r >= a : bt(r.value, String(a)) >= 0;
|
|
162
|
+
return n(1e12) ? { power: 12, suffix: "T" } : n(1e9) ? { power: 9, suffix: "B" } : De(t) && n(1e7) ? { power: 7, suffix: "Cr" } : n(1e6) ? { power: 6, suffix: "M" } : De(t) && n(1e5) ? { power: 5, suffix: "L" } : n(1e3) ? { power: 3, suffix: "K" } : { power: 0, suffix: "" };
|
|
163
|
+
}
|
|
164
|
+
function le(e, t) {
|
|
165
|
+
try {
|
|
166
|
+
const r = M(t);
|
|
167
|
+
return ke(e, r);
|
|
168
|
+
} catch {
|
|
169
|
+
return ke(e, "en-US");
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
const We = 500, U = /* @__PURE__ */ new Map(), z = /* @__PURE__ */ new Map();
|
|
173
|
+
function S(e, t = {}) {
|
|
174
|
+
const r = `${e}|${JSON.stringify(t)}`;
|
|
175
|
+
let n = U.get(r);
|
|
176
|
+
return n || (n = new Intl.NumberFormat(e, t), U.size >= We && U.clear(), U.set(r, n)), n;
|
|
177
|
+
}
|
|
178
|
+
function Bt(e) {
|
|
179
|
+
let t = z.get(e);
|
|
180
|
+
if (t === void 0) {
|
|
181
|
+
try {
|
|
182
|
+
S(e), t = !0;
|
|
183
|
+
} catch {
|
|
184
|
+
t = !1;
|
|
185
|
+
}
|
|
186
|
+
z.size >= We && z.clear(), z.set(e, t);
|
|
187
|
+
}
|
|
188
|
+
return t;
|
|
189
|
+
}
|
|
190
|
+
function M(e) {
|
|
191
|
+
return e && Bt(e) ? e : "en-US";
|
|
192
|
+
}
|
|
193
|
+
function ge(e, t) {
|
|
194
|
+
if (e == null || Number.isNaN(e))
|
|
195
|
+
return "";
|
|
196
|
+
const r = M(t == null ? void 0 : t.locale);
|
|
197
|
+
let n = e;
|
|
198
|
+
if (t != null && t.multiplyBy && (n = Ge(n, t.multiplyBy)), t != null && t.useSuffix) {
|
|
199
|
+
const { power: i, suffix: o } = le(n, r);
|
|
200
|
+
n = K(n, i);
|
|
201
|
+
const s = b(n, S(r, {
|
|
202
|
+
minimumFractionDigits: (t == null ? void 0 : t.minimumFractionDigits) ?? 0,
|
|
203
|
+
maximumFractionDigits: (t == null ? void 0 : t.maximumFractionDigits) ?? 2,
|
|
204
|
+
useGrouping: (t == null ? void 0 : t.useGrouping) ?? !0
|
|
205
|
+
}));
|
|
206
|
+
return `${(t == null ? void 0 : t.prefix) ?? ""}${s}${o}${(t == null ? void 0 : t.suffix) ?? ""}`;
|
|
207
|
+
}
|
|
208
|
+
const a = b(n, S(r, {
|
|
209
|
+
minimumFractionDigits: (t == null ? void 0 : t.minimumFractionDigits) ?? 0,
|
|
210
|
+
maximumFractionDigits: (t == null ? void 0 : t.maximumFractionDigits) ?? 2,
|
|
211
|
+
useGrouping: (t == null ? void 0 : t.useGrouping) ?? !0
|
|
212
|
+
}));
|
|
213
|
+
if (t != null && t.negativeInParentheses && G(n)) {
|
|
214
|
+
const i = a.replace("-", "");
|
|
215
|
+
return `(${(t == null ? void 0 : t.prefix) ?? ""}${i}${(t == null ? void 0 : t.suffix) ?? ""})`;
|
|
216
|
+
}
|
|
217
|
+
return `${(t == null ? void 0 : t.prefix) ?? ""}${a}${(t == null ? void 0 : t.suffix) ?? ""}`;
|
|
218
|
+
}
|
|
219
|
+
function Xe(e, t) {
|
|
220
|
+
if (e == null || Number.isNaN(e))
|
|
221
|
+
return "";
|
|
222
|
+
const r = M(t == null ? void 0 : t.locale), n = (t == null ? void 0 : t.currency) || "USD", a = G(e), i = !!(t != null && t.negativeInParentheses && a), o = i ? j(e) : e;
|
|
223
|
+
try {
|
|
224
|
+
if (t != null && t.useSuffix) {
|
|
225
|
+
const { power: c, suffix: u } = le(o, r), l = K(o, c), y = `${b(l, S(r, {
|
|
226
|
+
style: "currency",
|
|
227
|
+
currency: n,
|
|
228
|
+
minimumFractionDigits: (t == null ? void 0 : t.minimumFractionDigits) ?? 0,
|
|
229
|
+
maximumFractionDigits: (t == null ? void 0 : t.maximumFractionDigits) ?? 2,
|
|
230
|
+
useGrouping: (t == null ? void 0 : t.useGrouping) ?? !0
|
|
231
|
+
}))}${u}`;
|
|
232
|
+
return i ? `(${y})` : y;
|
|
233
|
+
}
|
|
234
|
+
const s = b(o, S(r, {
|
|
235
|
+
style: "currency",
|
|
236
|
+
currency: n,
|
|
237
|
+
minimumFractionDigits: (t == null ? void 0 : t.minimumFractionDigits) ?? 0,
|
|
238
|
+
maximumFractionDigits: (t == null ? void 0 : t.maximumFractionDigits) ?? 2,
|
|
239
|
+
useGrouping: (t == null ? void 0 : t.useGrouping) ?? !0
|
|
240
|
+
}));
|
|
241
|
+
return i ? `(${s})` : s;
|
|
242
|
+
} catch {
|
|
243
|
+
const s = j(e), c = t != null && t.useSuffix ? le(s, r) : { power: 0, suffix: "" }, u = ge(
|
|
244
|
+
K(s, c.power),
|
|
245
|
+
{
|
|
246
|
+
locale: r,
|
|
247
|
+
minimumFractionDigits: (t == null ? void 0 : t.minimumFractionDigits) ?? 0,
|
|
248
|
+
maximumFractionDigits: (t == null ? void 0 : t.maximumFractionDigits) ?? 2,
|
|
249
|
+
useGrouping: (t == null ? void 0 : t.useGrouping) ?? !0
|
|
250
|
+
}
|
|
251
|
+
), l = `${n} ${u}${c.suffix}`;
|
|
252
|
+
return a ? t != null && t.negativeInParentheses ? `(${l})` : `-${l}` : l;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
function Je(e, t) {
|
|
256
|
+
if (e == null || Number.isNaN(e))
|
|
257
|
+
return "";
|
|
258
|
+
const r = M(t == null ? void 0 : t.locale), a = (t == null ? void 0 : t.alreadyPercent) ?? (t == null ? void 0 : t.percentValueMode) === "whole" ? K(e, 2) : e;
|
|
259
|
+
return b(a, S(r, {
|
|
260
|
+
style: "percent",
|
|
261
|
+
minimumFractionDigits: (t == null ? void 0 : t.minimumFractionDigits) ?? 0,
|
|
262
|
+
maximumFractionDigits: (t == null ? void 0 : t.maximumFractionDigits) ?? 2,
|
|
263
|
+
useGrouping: (t == null ? void 0 : t.useGrouping) ?? !0
|
|
264
|
+
}));
|
|
265
|
+
}
|
|
266
|
+
function Qe(e, t) {
|
|
267
|
+
if (e == null || Number.isNaN(e))
|
|
268
|
+
return "";
|
|
269
|
+
const r = M(t == null ? void 0 : t.locale);
|
|
270
|
+
return b(e, S(r, {
|
|
271
|
+
notation: "scientific",
|
|
272
|
+
minimumFractionDigits: (t == null ? void 0 : t.minimumFractionDigits) ?? 0,
|
|
273
|
+
maximumFractionDigits: (t == null ? void 0 : t.maximumFractionDigits) ?? 2
|
|
274
|
+
}));
|
|
275
|
+
}
|
|
276
|
+
function et(e, t) {
|
|
277
|
+
if (e == null || Number.isNaN(e))
|
|
278
|
+
return "";
|
|
279
|
+
const r = t.scale === void 0 ? e : Ge(e, t.scale), n = t.negativeStyle === "parentheses" && G(r), a = n ? j(r) : r, i = {
|
|
280
|
+
style: t.type === "number" ? "decimal" : t.type,
|
|
281
|
+
locale: t.locale,
|
|
282
|
+
currency: t.currency,
|
|
283
|
+
minimumFractionDigits: t.minimumFractionDigits,
|
|
284
|
+
maximumFractionDigits: t.maximumFractionDigits,
|
|
285
|
+
useGrouping: t.useGrouping,
|
|
286
|
+
percentValueMode: t.percentValueMode,
|
|
287
|
+
useSuffix: t.compact
|
|
288
|
+
};
|
|
289
|
+
let o;
|
|
290
|
+
switch (t.type) {
|
|
291
|
+
case "currency":
|
|
292
|
+
o = Xe(a, i);
|
|
293
|
+
break;
|
|
294
|
+
case "percent":
|
|
295
|
+
o = Je(a, i);
|
|
296
|
+
break;
|
|
297
|
+
case "scientific":
|
|
298
|
+
o = Qe(a, i);
|
|
299
|
+
break;
|
|
300
|
+
default:
|
|
301
|
+
o = ge(a, i);
|
|
302
|
+
break;
|
|
303
|
+
}
|
|
304
|
+
const s = `${t.prefix ?? ""}${o}${t.suffix ?? ""}`;
|
|
305
|
+
return n ? `(${s})` : s;
|
|
306
|
+
}
|
|
307
|
+
function ga(e, t) {
|
|
308
|
+
return t.type === "duration" ? e == null ? "" : Ve(e, t) : et(e, t);
|
|
309
|
+
}
|
|
310
|
+
function ha(e, t, r = "en-US") {
|
|
311
|
+
if (e == null || typeof e == "number" && isNaN(e))
|
|
312
|
+
return "";
|
|
313
|
+
if ((t == null ? void 0 : t.style) === "duration")
|
|
314
|
+
return Ve(e, {
|
|
315
|
+
...t.duration,
|
|
316
|
+
prefix: t.prefix,
|
|
317
|
+
suffix: t.suffix,
|
|
318
|
+
negativeStyle: t.negativeStyle
|
|
319
|
+
});
|
|
320
|
+
const n = M((t == null ? void 0 : t.locale) || r), a = (t == null ? void 0 : t.style) || "decimal", i = a === "decimal" ? "number" : a;
|
|
321
|
+
return i === "currency" && S(n, {
|
|
322
|
+
style: "currency",
|
|
323
|
+
currency: (t == null ? void 0 : t.currency) || "USD"
|
|
324
|
+
}), et(e, {
|
|
325
|
+
type: i,
|
|
326
|
+
locale: n,
|
|
327
|
+
currency: i === "currency" ? (t == null ? void 0 : t.currency) || "USD" : void 0,
|
|
328
|
+
minimumFractionDigits: (t == null ? void 0 : t.minimumFractionDigits) ?? 0,
|
|
329
|
+
maximumFractionDigits: (t == null ? void 0 : t.maximumFractionDigits) ?? 2,
|
|
330
|
+
useGrouping: (t == null ? void 0 : t.useGrouping) ?? !0,
|
|
331
|
+
percentValueMode: i === "percent" ? (t == null ? void 0 : t.percentValueMode) ?? "whole" : void 0,
|
|
332
|
+
scale: t == null ? void 0 : t.scale,
|
|
333
|
+
compact: t == null ? void 0 : t.compact,
|
|
334
|
+
negativeStyle: t == null ? void 0 : t.negativeStyle,
|
|
335
|
+
prefix: t == null ? void 0 : t.prefix,
|
|
336
|
+
suffix: t == null ? void 0 : t.suffix
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
function pa(e, t, r) {
|
|
340
|
+
const n = {
|
|
341
|
+
style: t === "currency" ? "currency" : t === "percent" ? "percent" : "decimal",
|
|
342
|
+
locale: r == null ? void 0 : r.locale,
|
|
343
|
+
currency: r == null ? void 0 : r.currency,
|
|
344
|
+
minimumFractionDigits: r == null ? void 0 : r.decimalPlaces,
|
|
345
|
+
maximumFractionDigits: r == null ? void 0 : r.decimalPlaces,
|
|
346
|
+
useSuffix: r == null ? void 0 : r.useSuffix,
|
|
347
|
+
prefix: r == null ? void 0 : r.prefix,
|
|
348
|
+
suffix: r == null ? void 0 : r.suffix,
|
|
349
|
+
negativeInParentheses: r == null ? void 0 : r.negativeInParentheses,
|
|
350
|
+
multiplyBy: r == null ? void 0 : r.multiplyBy
|
|
351
|
+
};
|
|
352
|
+
switch (t) {
|
|
353
|
+
case "currency":
|
|
354
|
+
return Xe(e, n);
|
|
355
|
+
case "percent":
|
|
356
|
+
return Je(e, n);
|
|
357
|
+
case "scientific":
|
|
358
|
+
return Qe(e, n);
|
|
359
|
+
default:
|
|
360
|
+
return ge(e, n);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
const wa = 6048e5, Ta = 864e5, tt = 6e4, rt = 36e5, Sa = 525600, va = 43200, xa = 1440;
|
|
364
|
+
function Da(e, t) {
|
|
365
|
+
const n = Xt(e);
|
|
366
|
+
let a;
|
|
367
|
+
if (n.date) {
|
|
368
|
+
const c = Jt(n.date, 2);
|
|
369
|
+
a = Qt(c.restDateString, c.year);
|
|
370
|
+
}
|
|
371
|
+
if (!a || isNaN(a.getTime()))
|
|
372
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
373
|
+
const i = a.getTime();
|
|
374
|
+
let o = 0, s;
|
|
375
|
+
if (n.time && (o = er(n.time), isNaN(o)))
|
|
376
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
377
|
+
if (n.timezone) {
|
|
378
|
+
if (s = tr(n.timezone), isNaN(s))
|
|
379
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
380
|
+
} else {
|
|
381
|
+
const c = new Date(i + o), u = /* @__PURE__ */ new Date(0);
|
|
382
|
+
return u.setFullYear(
|
|
383
|
+
c.getUTCFullYear(),
|
|
384
|
+
c.getUTCMonth(),
|
|
385
|
+
c.getUTCDate()
|
|
386
|
+
), u.setHours(
|
|
387
|
+
c.getUTCHours(),
|
|
388
|
+
c.getUTCMinutes(),
|
|
389
|
+
c.getUTCSeconds(),
|
|
390
|
+
c.getUTCMilliseconds()
|
|
391
|
+
), u;
|
|
392
|
+
}
|
|
393
|
+
return new Date(i + o + s);
|
|
394
|
+
}
|
|
395
|
+
const A = {
|
|
396
|
+
dateTimeDelimiter: /[T ]/,
|
|
397
|
+
timeZoneDelimiter: /[Z ]/i,
|
|
398
|
+
timezone: /([Z+-].*)$/
|
|
399
|
+
}, Vt = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/, Gt = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/, Wt = /^([+-])(\d{2})(?::?(\d{2}))?$/;
|
|
400
|
+
function Xt(e) {
|
|
401
|
+
const t = {}, r = e.split(A.dateTimeDelimiter);
|
|
402
|
+
let n;
|
|
403
|
+
if (r.length > 2)
|
|
404
|
+
return t;
|
|
405
|
+
if (/:/.test(r[0]) ? n = r[0] : (t.date = r[0], n = r[1], A.timeZoneDelimiter.test(t.date) && (t.date = e.split(A.timeZoneDelimiter)[0], n = e.substr(
|
|
406
|
+
t.date.length,
|
|
407
|
+
e.length
|
|
408
|
+
))), n) {
|
|
409
|
+
const a = A.timezone.exec(n);
|
|
410
|
+
a ? (t.time = n.replace(a[1], ""), t.timezone = a[1]) : t.time = n;
|
|
411
|
+
}
|
|
412
|
+
return t;
|
|
413
|
+
}
|
|
414
|
+
function Jt(e, t) {
|
|
415
|
+
const r = new RegExp(
|
|
416
|
+
"^(?:(\\d{4}|[+-]\\d{" + (4 + t) + "})|(\\d{2}|[+-]\\d{" + (2 + t) + "})$)"
|
|
417
|
+
), n = e.match(r);
|
|
418
|
+
if (!n) return { year: NaN, restDateString: "" };
|
|
419
|
+
const a = n[1] ? parseInt(n[1]) : null, i = n[2] ? parseInt(n[2]) : null;
|
|
420
|
+
return {
|
|
421
|
+
year: i === null ? a : i * 100,
|
|
422
|
+
restDateString: e.slice((n[1] || n[2]).length)
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
function Qt(e, t) {
|
|
426
|
+
if (t === null) return /* @__PURE__ */ new Date(NaN);
|
|
427
|
+
const r = e.match(Vt);
|
|
428
|
+
if (!r) return /* @__PURE__ */ new Date(NaN);
|
|
429
|
+
const n = !!r[4], a = $(r[1]), i = $(r[2]) - 1, o = $(r[3]), s = $(r[4]), c = $(r[5]) - 1;
|
|
430
|
+
if (n)
|
|
431
|
+
return or(t, s, c) ? rr(t, s, c) : /* @__PURE__ */ new Date(NaN);
|
|
432
|
+
{
|
|
433
|
+
const u = /* @__PURE__ */ new Date(0);
|
|
434
|
+
return !ar(t, i, o) || !ir(t, a) ? /* @__PURE__ */ new Date(NaN) : (u.setUTCFullYear(t, i, Math.max(a, o)), u);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
function $(e) {
|
|
438
|
+
return e ? parseInt(e) : 1;
|
|
439
|
+
}
|
|
440
|
+
function er(e) {
|
|
441
|
+
const t = e.match(Gt);
|
|
442
|
+
if (!t) return NaN;
|
|
443
|
+
const r = ee(t[1]), n = ee(t[2]), a = ee(t[3]);
|
|
444
|
+
return sr(r, n, a) ? r * rt + n * tt + a * 1e3 : NaN;
|
|
445
|
+
}
|
|
446
|
+
function ee(e) {
|
|
447
|
+
return e && parseFloat(e.replace(",", ".")) || 0;
|
|
448
|
+
}
|
|
449
|
+
function tr(e) {
|
|
450
|
+
if (e === "Z") return 0;
|
|
451
|
+
const t = e.match(Wt);
|
|
452
|
+
if (!t) return 0;
|
|
453
|
+
const r = t[1] === "+" ? -1 : 1, n = parseInt(t[2]), a = t[3] && parseInt(t[3]) || 0;
|
|
454
|
+
return cr(n, a) ? r * (n * rt + a * tt) : NaN;
|
|
455
|
+
}
|
|
456
|
+
function rr(e, t, r) {
|
|
457
|
+
const n = /* @__PURE__ */ new Date(0);
|
|
458
|
+
n.setUTCFullYear(e, 0, 4);
|
|
459
|
+
const a = n.getUTCDay() || 7, i = (t - 1) * 7 + r + 1 - a;
|
|
460
|
+
return n.setUTCDate(n.getUTCDate() + i), n;
|
|
461
|
+
}
|
|
462
|
+
const nr = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
463
|
+
function nt(e) {
|
|
464
|
+
return e % 400 === 0 || e % 4 === 0 && e % 100 !== 0;
|
|
465
|
+
}
|
|
466
|
+
function ar(e, t, r) {
|
|
467
|
+
return t >= 0 && t <= 11 && r >= 1 && r <= (nr[t] || (nt(e) ? 29 : 28));
|
|
468
|
+
}
|
|
469
|
+
function ir(e, t) {
|
|
470
|
+
return t >= 1 && t <= (nt(e) ? 366 : 365);
|
|
471
|
+
}
|
|
472
|
+
function or(e, t, r) {
|
|
473
|
+
return t >= 1 && t <= 53 && r >= 0 && r <= 6;
|
|
474
|
+
}
|
|
475
|
+
function sr(e, t, r) {
|
|
476
|
+
return e === 24 ? t === 0 && r === 0 : r >= 0 && r < 60 && t >= 0 && t < 60 && e >= 0 && e < 25;
|
|
477
|
+
}
|
|
478
|
+
function cr(e, t) {
|
|
479
|
+
return t >= 0 && t <= 59;
|
|
480
|
+
}
|
|
481
|
+
function ur(e, t) {
|
|
482
|
+
const r = yr(t);
|
|
483
|
+
return "formatToParts" in r ? mr(r, e) : dr(r, e);
|
|
484
|
+
}
|
|
485
|
+
const lr = {
|
|
486
|
+
year: 0,
|
|
487
|
+
month: 1,
|
|
488
|
+
day: 2,
|
|
489
|
+
hour: 3,
|
|
490
|
+
minute: 4,
|
|
491
|
+
second: 5
|
|
492
|
+
};
|
|
493
|
+
function mr(e, t) {
|
|
494
|
+
try {
|
|
495
|
+
const r = e.formatToParts(t), n = [];
|
|
496
|
+
for (let a = 0; a < r.length; a++) {
|
|
497
|
+
const i = lr[r[a].type];
|
|
498
|
+
i !== void 0 && (n[i] = parseInt(r[a].value, 10));
|
|
499
|
+
}
|
|
500
|
+
return n;
|
|
501
|
+
} catch (r) {
|
|
502
|
+
if (r instanceof RangeError)
|
|
503
|
+
return [NaN];
|
|
504
|
+
throw r;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
function dr(e, t) {
|
|
508
|
+
const r = e.format(t), n = /(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(r);
|
|
509
|
+
return [
|
|
510
|
+
parseInt(n[3], 10),
|
|
511
|
+
parseInt(n[1], 10),
|
|
512
|
+
parseInt(n[2], 10),
|
|
513
|
+
parseInt(n[4], 10),
|
|
514
|
+
parseInt(n[5], 10),
|
|
515
|
+
parseInt(n[6], 10)
|
|
516
|
+
];
|
|
517
|
+
}
|
|
518
|
+
const te = {}, _e = new Intl.DateTimeFormat("en-US", {
|
|
519
|
+
hourCycle: "h23",
|
|
520
|
+
timeZone: "America/New_York",
|
|
521
|
+
year: "numeric",
|
|
522
|
+
month: "2-digit",
|
|
523
|
+
day: "2-digit",
|
|
524
|
+
hour: "2-digit",
|
|
525
|
+
minute: "2-digit",
|
|
526
|
+
second: "2-digit"
|
|
527
|
+
}).format(/* @__PURE__ */ new Date("2014-06-25T04:00:00.123Z")), fr = _e === "06/25/2014, 00:00:00" || _e === "06/25/2014 00:00:00";
|
|
528
|
+
function yr(e) {
|
|
529
|
+
return te[e] || (te[e] = fr ? new Intl.DateTimeFormat("en-US", {
|
|
530
|
+
hourCycle: "h23",
|
|
531
|
+
timeZone: e,
|
|
532
|
+
year: "numeric",
|
|
533
|
+
month: "numeric",
|
|
534
|
+
day: "2-digit",
|
|
535
|
+
hour: "2-digit",
|
|
536
|
+
minute: "2-digit",
|
|
537
|
+
second: "2-digit"
|
|
538
|
+
}) : new Intl.DateTimeFormat("en-US", {
|
|
539
|
+
hour12: !1,
|
|
540
|
+
timeZone: e,
|
|
541
|
+
year: "numeric",
|
|
542
|
+
month: "numeric",
|
|
543
|
+
day: "2-digit",
|
|
544
|
+
hour: "2-digit",
|
|
545
|
+
minute: "2-digit",
|
|
546
|
+
second: "2-digit"
|
|
547
|
+
})), te[e];
|
|
548
|
+
}
|
|
549
|
+
function he(e, t, r, n, a, i, o) {
|
|
550
|
+
const s = /* @__PURE__ */ new Date(0);
|
|
551
|
+
return s.setUTCFullYear(e, t, r), s.setUTCHours(n, a, i, o), s;
|
|
552
|
+
}
|
|
553
|
+
const be = 36e5, gr = 6e4, re = {
|
|
554
|
+
timezoneZ: /^(Z)$/,
|
|
555
|
+
timezoneHH: /^([+-]\d{2})$/,
|
|
556
|
+
timezoneHHMM: /^([+-])(\d{2}):?(\d{2})$/
|
|
557
|
+
};
|
|
558
|
+
function at(e, t, r) {
|
|
559
|
+
if (!e)
|
|
560
|
+
return 0;
|
|
561
|
+
let n = re.timezoneZ.exec(e);
|
|
562
|
+
if (n)
|
|
563
|
+
return 0;
|
|
564
|
+
let a, i;
|
|
565
|
+
if (n = re.timezoneHH.exec(e), n)
|
|
566
|
+
return a = parseInt(n[1], 10), Ne(a) ? -(a * be) : NaN;
|
|
567
|
+
if (n = re.timezoneHHMM.exec(e), n) {
|
|
568
|
+
a = parseInt(n[2], 10);
|
|
569
|
+
const o = parseInt(n[3], 10);
|
|
570
|
+
return Ne(a, o) ? (i = Math.abs(a) * be + o * gr, n[1] === "+" ? -i : i) : NaN;
|
|
571
|
+
}
|
|
572
|
+
if (wr(e)) {
|
|
573
|
+
t = new Date(t || Date.now());
|
|
574
|
+
const o = r ? t : hr(t), s = me(o, e);
|
|
575
|
+
return -(r ? s : pr(t, s, e));
|
|
576
|
+
}
|
|
577
|
+
return NaN;
|
|
578
|
+
}
|
|
579
|
+
function hr(e) {
|
|
580
|
+
return he(e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), e.getMinutes(), e.getSeconds(), e.getMilliseconds());
|
|
581
|
+
}
|
|
582
|
+
function me(e, t) {
|
|
583
|
+
const r = ur(e, t), n = he(r[0], r[1] - 1, r[2], r[3] % 24, r[4], r[5], 0).getTime();
|
|
584
|
+
let a = e.getTime();
|
|
585
|
+
const i = a % 1e3;
|
|
586
|
+
return a -= i >= 0 ? i : 1e3 + i, n - a;
|
|
587
|
+
}
|
|
588
|
+
function pr(e, t, r) {
|
|
589
|
+
let a = e.getTime() - t;
|
|
590
|
+
const i = me(new Date(a), r);
|
|
591
|
+
if (t === i)
|
|
592
|
+
return t;
|
|
593
|
+
a -= i - t;
|
|
594
|
+
const o = me(new Date(a), r);
|
|
595
|
+
return i === o ? i : Math.max(i, o);
|
|
596
|
+
}
|
|
597
|
+
function Ne(e, t) {
|
|
598
|
+
return -23 <= e && e <= 23 && (t == null || 0 <= t && t <= 59);
|
|
599
|
+
}
|
|
600
|
+
const Me = {};
|
|
601
|
+
function wr(e) {
|
|
602
|
+
if (Me[e])
|
|
603
|
+
return !0;
|
|
604
|
+
try {
|
|
605
|
+
return new Intl.DateTimeFormat(void 0, { timeZone: e }), Me[e] = !0, !0;
|
|
606
|
+
} catch {
|
|
607
|
+
return !1;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
function $e(e) {
|
|
611
|
+
const t = new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), e.getMinutes(), e.getSeconds(), e.getMilliseconds()));
|
|
612
|
+
return t.setUTCFullYear(e.getFullYear()), +e - +t;
|
|
613
|
+
}
|
|
614
|
+
const it = /(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/, ne = 36e5, Ie = 6e4, Tr = 2, p = {
|
|
615
|
+
dateTimePattern: /^([0-9W+-]+)(T| )(.*)/,
|
|
616
|
+
datePattern: /^([0-9W+-]+)(.*)/,
|
|
617
|
+
// year tokens
|
|
618
|
+
YY: /^(\d{2})$/,
|
|
619
|
+
YYY: [
|
|
620
|
+
/^([+-]\d{2})$/,
|
|
621
|
+
// 0 additional digits
|
|
622
|
+
/^([+-]\d{3})$/,
|
|
623
|
+
// 1 additional digit
|
|
624
|
+
/^([+-]\d{4})$/
|
|
625
|
+
// 2 additional digits
|
|
626
|
+
],
|
|
627
|
+
YYYY: /^(\d{4})/,
|
|
628
|
+
YYYYY: [
|
|
629
|
+
/^([+-]\d{4})/,
|
|
630
|
+
// 0 additional digits
|
|
631
|
+
/^([+-]\d{5})/,
|
|
632
|
+
// 1 additional digit
|
|
633
|
+
/^([+-]\d{6})/
|
|
634
|
+
// 2 additional digits
|
|
635
|
+
],
|
|
636
|
+
// date tokens
|
|
637
|
+
MM: /^-(\d{2})$/,
|
|
638
|
+
DDD: /^-?(\d{3})$/,
|
|
639
|
+
MMDD: /^-?(\d{2})-?(\d{2})$/,
|
|
640
|
+
Www: /^-?W(\d{2})$/,
|
|
641
|
+
WwwD: /^-?W(\d{2})-?(\d{1})$/,
|
|
642
|
+
HH: /^(\d{2}([.,]\d*)?)$/,
|
|
643
|
+
HHMM: /^(\d{2}):?(\d{2}([.,]\d*)?)$/,
|
|
644
|
+
HHMMSS: /^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,
|
|
645
|
+
// time zone tokens (to identify the presence of a tz)
|
|
646
|
+
timeZone: it
|
|
647
|
+
};
|
|
648
|
+
function Ee(e, t = {}) {
|
|
649
|
+
if (arguments.length < 1)
|
|
650
|
+
throw new TypeError("1 argument required, but only " + arguments.length + " present");
|
|
651
|
+
if (e === null)
|
|
652
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
653
|
+
const r = t.additionalDigits == null ? Tr : Number(t.additionalDigits);
|
|
654
|
+
if (r !== 2 && r !== 1 && r !== 0)
|
|
655
|
+
throw new RangeError("additionalDigits must be 0, 1 or 2");
|
|
656
|
+
if (e instanceof Date || typeof e == "object" && Object.prototype.toString.call(e) === "[object Date]")
|
|
657
|
+
return new Date(e.getTime());
|
|
658
|
+
if (typeof e == "number" || Object.prototype.toString.call(e) === "[object Number]")
|
|
659
|
+
return new Date(e);
|
|
660
|
+
if (Object.prototype.toString.call(e) !== "[object String]")
|
|
661
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
662
|
+
const n = Sr(e), { year: a, restDateString: i } = vr(n.date, r), o = xr(i, a);
|
|
663
|
+
if (o === null || isNaN(o.getTime()))
|
|
664
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
665
|
+
if (o) {
|
|
666
|
+
const s = o.getTime();
|
|
667
|
+
let c = 0, u;
|
|
668
|
+
if (n.time && (c = Dr(n.time), c === null || isNaN(c)))
|
|
669
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
670
|
+
if (n.timeZone || t.timeZone) {
|
|
671
|
+
if (u = at(n.timeZone || t.timeZone, new Date(s + c)), isNaN(u))
|
|
672
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
673
|
+
} else
|
|
674
|
+
u = $e(new Date(s + c)), u = $e(new Date(s + c + u));
|
|
675
|
+
return new Date(s + c + u);
|
|
676
|
+
} else
|
|
677
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
678
|
+
}
|
|
679
|
+
function Sr(e) {
|
|
680
|
+
const t = {};
|
|
681
|
+
let r = p.dateTimePattern.exec(e), n;
|
|
682
|
+
if (r ? (t.date = r[1], n = r[3]) : (r = p.datePattern.exec(e), r ? (t.date = r[1], n = r[2]) : (t.date = null, n = e)), n) {
|
|
683
|
+
const a = p.timeZone.exec(n);
|
|
684
|
+
a ? (t.time = n.replace(a[1], ""), t.timeZone = a[1].trim()) : t.time = n;
|
|
685
|
+
}
|
|
686
|
+
return t;
|
|
687
|
+
}
|
|
688
|
+
function vr(e, t) {
|
|
689
|
+
if (e) {
|
|
690
|
+
const r = p.YYY[t], n = p.YYYYY[t];
|
|
691
|
+
let a = p.YYYY.exec(e) || n.exec(e);
|
|
692
|
+
if (a) {
|
|
693
|
+
const i = a[1];
|
|
694
|
+
return {
|
|
695
|
+
year: parseInt(i, 10),
|
|
696
|
+
restDateString: e.slice(i.length)
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
if (a = p.YY.exec(e) || r.exec(e), a) {
|
|
700
|
+
const i = a[1];
|
|
701
|
+
return {
|
|
702
|
+
year: parseInt(i, 10) * 100,
|
|
703
|
+
restDateString: e.slice(i.length)
|
|
704
|
+
};
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
return {
|
|
708
|
+
year: null
|
|
709
|
+
};
|
|
710
|
+
}
|
|
711
|
+
function xr(e, t) {
|
|
712
|
+
if (t === null)
|
|
713
|
+
return null;
|
|
714
|
+
let r, n, a;
|
|
715
|
+
if (!e || !e.length)
|
|
716
|
+
return r = /* @__PURE__ */ new Date(0), r.setUTCFullYear(t), r;
|
|
717
|
+
let i = p.MM.exec(e);
|
|
718
|
+
if (i)
|
|
719
|
+
return r = /* @__PURE__ */ new Date(0), n = parseInt(i[1], 10) - 1, Ce(t, n) ? (r.setUTCFullYear(t, n), r) : /* @__PURE__ */ new Date(NaN);
|
|
720
|
+
if (i = p.DDD.exec(e), i) {
|
|
721
|
+
r = /* @__PURE__ */ new Date(0);
|
|
722
|
+
const o = parseInt(i[1], 10);
|
|
723
|
+
return br(t, o) ? (r.setUTCFullYear(t, 0, o), r) : /* @__PURE__ */ new Date(NaN);
|
|
724
|
+
}
|
|
725
|
+
if (i = p.MMDD.exec(e), i) {
|
|
726
|
+
r = /* @__PURE__ */ new Date(0), n = parseInt(i[1], 10) - 1;
|
|
727
|
+
const o = parseInt(i[2], 10);
|
|
728
|
+
return Ce(t, n, o) ? (r.setUTCFullYear(t, n, o), r) : /* @__PURE__ */ new Date(NaN);
|
|
729
|
+
}
|
|
730
|
+
if (i = p.Www.exec(e), i)
|
|
731
|
+
return a = parseInt(i[1], 10) - 1, Ue(a) ? Fe(t, a) : /* @__PURE__ */ new Date(NaN);
|
|
732
|
+
if (i = p.WwwD.exec(e), i) {
|
|
733
|
+
a = parseInt(i[1], 10) - 1;
|
|
734
|
+
const o = parseInt(i[2], 10) - 1;
|
|
735
|
+
return Ue(a, o) ? Fe(t, a, o) : /* @__PURE__ */ new Date(NaN);
|
|
736
|
+
}
|
|
737
|
+
return null;
|
|
738
|
+
}
|
|
739
|
+
function Dr(e) {
|
|
740
|
+
let t, r, n = p.HH.exec(e);
|
|
741
|
+
if (n)
|
|
742
|
+
return t = parseFloat(n[1].replace(",", ".")), ae(t) ? t % 24 * ne : NaN;
|
|
743
|
+
if (n = p.HHMM.exec(e), n)
|
|
744
|
+
return t = parseInt(n[1], 10), r = parseFloat(n[2].replace(",", ".")), ae(t, r) ? t % 24 * ne + r * Ie : NaN;
|
|
745
|
+
if (n = p.HHMMSS.exec(e), n) {
|
|
746
|
+
t = parseInt(n[1], 10), r = parseInt(n[2], 10);
|
|
747
|
+
const a = parseFloat(n[3].replace(",", "."));
|
|
748
|
+
return ae(t, r, a) ? t % 24 * ne + r * Ie + a * 1e3 : NaN;
|
|
749
|
+
}
|
|
750
|
+
return null;
|
|
751
|
+
}
|
|
752
|
+
function Fe(e, t, r) {
|
|
753
|
+
t = t || 0, r = r || 0;
|
|
754
|
+
const n = /* @__PURE__ */ new Date(0);
|
|
755
|
+
n.setUTCFullYear(e, 0, 4);
|
|
756
|
+
const a = n.getUTCDay() || 7, i = t * 7 + r + 1 - a;
|
|
757
|
+
return n.setUTCDate(n.getUTCDate() + i), n;
|
|
758
|
+
}
|
|
759
|
+
const kr = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], _r = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
760
|
+
function ot(e) {
|
|
761
|
+
return e % 400 === 0 || e % 4 === 0 && e % 100 !== 0;
|
|
762
|
+
}
|
|
763
|
+
function Ce(e, t, r) {
|
|
764
|
+
if (t < 0 || t > 11)
|
|
765
|
+
return !1;
|
|
766
|
+
if (r != null) {
|
|
767
|
+
if (r < 1)
|
|
768
|
+
return !1;
|
|
769
|
+
const n = ot(e);
|
|
770
|
+
if (n && r > _r[t] || !n && r > kr[t])
|
|
771
|
+
return !1;
|
|
772
|
+
}
|
|
773
|
+
return !0;
|
|
774
|
+
}
|
|
775
|
+
function br(e, t) {
|
|
776
|
+
if (t < 1)
|
|
777
|
+
return !1;
|
|
778
|
+
const r = ot(e);
|
|
779
|
+
return !(r && t > 366 || !r && t > 365);
|
|
780
|
+
}
|
|
781
|
+
function Ue(e, t) {
|
|
782
|
+
return !(e < 0 || e > 52 || t != null && (t < 0 || t > 6));
|
|
783
|
+
}
|
|
784
|
+
function ae(e, t, r) {
|
|
785
|
+
return !(e < 0 || e >= 25 || t != null && (t < 0 || t >= 60) || r != null && (r < 0 || r >= 60));
|
|
786
|
+
}
|
|
787
|
+
function W(e, t, r) {
|
|
788
|
+
if (typeof e == "string" && !e.match(it))
|
|
789
|
+
return Ee(e, { ...r, timeZone: t });
|
|
790
|
+
e = Ee(e, r);
|
|
791
|
+
const n = he(e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), e.getMinutes(), e.getSeconds(), e.getMilliseconds()).getTime(), a = at(t, new Date(n));
|
|
792
|
+
return new Date(n + a);
|
|
793
|
+
}
|
|
794
|
+
const Nr = 5 * 1024 * 1024, ka = 64 * 1024 * 1024, H = f.number().int().positive().max(Number.MAX_SAFE_INTEGER), R = f.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER), Z = R.refine((e) => e > 0), Mr = (e) => !!e && e !== "." && e !== ".." && !e.includes("/") && !e.includes("\\");
|
|
795
|
+
function k(e, t) {
|
|
796
|
+
const r = t.split("/");
|
|
797
|
+
if (r.length !== 5 || r[0] !== "exports" || r[1] !== e || r[2] !== "attempts" || !r.every(Mr))
|
|
798
|
+
throw new Error("Invalid Matrix export artifact namespace.");
|
|
799
|
+
return { attemptId: r[3], filename: r[4] };
|
|
800
|
+
}
|
|
801
|
+
function _a(e, t, r) {
|
|
802
|
+
const n = `exports/${e}/attempts/${t}/${r}`;
|
|
803
|
+
return k(e, n), n;
|
|
804
|
+
}
|
|
805
|
+
const ba = f.object({
|
|
806
|
+
acquisition: f.literal("continuation"),
|
|
807
|
+
jobId: f.string().min(1),
|
|
808
|
+
sequence: Z,
|
|
809
|
+
deadlineAt: H
|
|
810
|
+
}), $r = [
|
|
811
|
+
"application/json",
|
|
812
|
+
...Ke.map((e) => He(e).partContentType)
|
|
813
|
+
], Ir = f.object({
|
|
814
|
+
key: f.string(),
|
|
815
|
+
content: f.string(),
|
|
816
|
+
contentType: f.enum($r),
|
|
817
|
+
encoding: f.literal("gzip-base64").optional()
|
|
818
|
+
// Transport-only compression: JSON (layout, sheet layout) and Excel rows. CSV travels as it always has.
|
|
819
|
+
}).refine((e) => !e.encoding || e.contentType === "application/json" || e.contentType === He("xlsx").partContentType, "Unsupported Matrix artifact encoding."), Er = f.discriminatedUnion("kind", [
|
|
820
|
+
f.object({ kind: f.literal("work"), sequence: Z, checkpointKey: f.string(), objects: f.array(Ir).min(2).max(4), deadlineAt: H }),
|
|
821
|
+
f.object({ kind: f.literal("committed"), sequence: Z, done: f.boolean(), deadlineAt: H })
|
|
822
|
+
]);
|
|
823
|
+
function Fr(e) {
|
|
824
|
+
const t = JSON.stringify(e);
|
|
825
|
+
if (t === void 0 || new TextEncoder().encode(t).byteLength > Nr)
|
|
826
|
+
throw new RangeError("Matrix export batch exceeds its transport byte limit.");
|
|
827
|
+
}
|
|
828
|
+
function Na(e, t) {
|
|
829
|
+
const r = Er.parse(e);
|
|
830
|
+
if (Fr(e), r.deadlineAt !== t.deadlineAt) throw new Error("Matrix deadline does not match the job.");
|
|
831
|
+
if (r.sequence !== t.sequence + (r.kind === "committed" ? 1 : 0))
|
|
832
|
+
throw new Error("Invalid Matrix batch sequence.");
|
|
833
|
+
if (r.kind === "work") {
|
|
834
|
+
k(t.jobId, r.checkpointKey);
|
|
835
|
+
for (const n of r.objects)
|
|
836
|
+
k(t.jobId, n.key);
|
|
837
|
+
}
|
|
838
|
+
return r;
|
|
839
|
+
}
|
|
840
|
+
const Cr = f.object({
|
|
841
|
+
acquisition: f.literal("continuation"),
|
|
842
|
+
deadlineAt: H,
|
|
843
|
+
chunks: f.array(f.object({ chunkNumber: Z, dataKey: f.string() })).min(1),
|
|
844
|
+
totalRows: R,
|
|
845
|
+
totalBytes: R,
|
|
846
|
+
fileKey: f.string().min(1).optional(),
|
|
847
|
+
fileSize: R.optional(),
|
|
848
|
+
/** The file the job writes; absent means CSV (manifests from before Excel). */
|
|
849
|
+
format: f.enum(Ke).optional(),
|
|
850
|
+
/** Excel only: the sheet layout the layout batch stored, which compaction wraps the rows in. */
|
|
851
|
+
sheetKey: f.string().min(1).optional()
|
|
852
|
+
}).refine((e) => e.fileKey === void 0 == (e.fileSize === void 0), "Incomplete published Matrix artifact.").refine((e) => e.format === "xlsx" == (e.sheetKey !== void 0), "An Excel Matrix manifest names its sheet layout, and only it does.");
|
|
853
|
+
function Ma(e, t, r) {
|
|
854
|
+
const n = Cr.parse(e);
|
|
855
|
+
if (n.deadlineAt !== r) throw new Error("Matrix deadline does not match the job.");
|
|
856
|
+
return n.chunks.forEach((a, i) => {
|
|
857
|
+
if (a.chunkNumber !== i + 1) throw new Error("Invalid committed Matrix chunk order.");
|
|
858
|
+
k(t, a.dataKey);
|
|
859
|
+
}), n.fileKey !== void 0 && k(t, n.fileKey), n.sheetKey !== void 0 && k(t, n.sheetKey), n;
|
|
860
|
+
}
|
|
861
|
+
function g(e) {
|
|
862
|
+
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
863
|
+
return !1;
|
|
864
|
+
const t = Object.getPrototypeOf(e);
|
|
865
|
+
if (t === null || t === Object.prototype) return !0;
|
|
866
|
+
const r = Object.prototype.hasOwnProperty.call(
|
|
867
|
+
t,
|
|
868
|
+
"constructor"
|
|
869
|
+
) ? t.constructor : void 0;
|
|
870
|
+
return typeof r == "function" && Function.prototype.toString.call(r) === Function.prototype.toString.call(Object);
|
|
871
|
+
}
|
|
872
|
+
const Ur = [
|
|
873
|
+
"type",
|
|
874
|
+
"locale",
|
|
875
|
+
"minimumFractionDigits",
|
|
876
|
+
"maximumFractionDigits",
|
|
877
|
+
"useGrouping",
|
|
878
|
+
"prefix",
|
|
879
|
+
"suffix",
|
|
880
|
+
"negativeStyle",
|
|
881
|
+
"compact",
|
|
882
|
+
"scale",
|
|
883
|
+
"currency",
|
|
884
|
+
"percentValueMode"
|
|
885
|
+
];
|
|
886
|
+
function zr(e) {
|
|
887
|
+
if (!g(e))
|
|
888
|
+
return {
|
|
889
|
+
ok: !1,
|
|
890
|
+
issues: [{ path: "$", message: "Numeric format must be an object." }]
|
|
891
|
+
};
|
|
892
|
+
const t = [], r = new Set(Ur);
|
|
893
|
+
Object.keys(e).filter((i) => !r.has(i)).forEach(
|
|
894
|
+
(i) => t.push({ path: i, message: `Unknown property "${i}".` })
|
|
895
|
+
), e.type !== "number" && e.type !== "currency" && e.type !== "percent" && e.type !== "scientific" && t.push({
|
|
896
|
+
path: "type",
|
|
897
|
+
message: "Expected number, currency, percent, or scientific."
|
|
898
|
+
});
|
|
899
|
+
const n = e.locale === void 0 ? void 0 : F(e.locale);
|
|
900
|
+
e.locale !== void 0 && !n && t.push({ path: "locale", message: "Expected a supported BCP 47 locale." });
|
|
901
|
+
const a = e.currency === void 0 ? void 0 : ce(e.currency);
|
|
902
|
+
e.currency !== void 0 && !a && t.push({
|
|
903
|
+
path: "currency",
|
|
904
|
+
message: "Expected a supported ISO 4217 currency code."
|
|
905
|
+
});
|
|
906
|
+
for (const i of ["minimumFractionDigits", "maximumFractionDigits"]) {
|
|
907
|
+
const o = e[i];
|
|
908
|
+
o !== void 0 && (!Number.isInteger(o) || typeof o != "number" || o < 0 || o > 20) && t.push({
|
|
909
|
+
path: i,
|
|
910
|
+
message: "Expected an integer from 0 to 20."
|
|
911
|
+
});
|
|
912
|
+
}
|
|
913
|
+
typeof e.minimumFractionDigits == "number" && typeof e.maximumFractionDigits == "number" && e.minimumFractionDigits > e.maximumFractionDigits && t.push({
|
|
914
|
+
path: "maximumFractionDigits",
|
|
915
|
+
message: "Must be greater than or equal to minimumFractionDigits."
|
|
916
|
+
});
|
|
917
|
+
for (const i of ["useGrouping", "compact"])
|
|
918
|
+
e[i] !== void 0 && typeof e[i] != "boolean" && t.push({ path: i, message: "Expected a boolean." });
|
|
919
|
+
for (const i of ["prefix", "suffix"])
|
|
920
|
+
e[i] !== void 0 && typeof e[i] != "string" && t.push({ path: i, message: "Expected a string." });
|
|
921
|
+
return e.negativeStyle !== void 0 && e.negativeStyle !== "minus" && e.negativeStyle !== "parentheses" && t.push({
|
|
922
|
+
path: "negativeStyle",
|
|
923
|
+
message: "Expected minus or parentheses."
|
|
924
|
+
}), e.percentValueMode !== void 0 && e.percentValueMode !== "fraction" && e.percentValueMode !== "whole" && t.push({
|
|
925
|
+
path: "percentValueMode",
|
|
926
|
+
message: "Expected fraction or whole."
|
|
927
|
+
}), e.scale !== void 0 && (typeof e.scale != "number" || !Number.isFinite(e.scale)) && t.push({ path: "scale", message: "Expected a finite number." }), t.length > 0 ? { ok: !1, issues: t } : {
|
|
928
|
+
ok: !0,
|
|
929
|
+
value: {
|
|
930
|
+
type: e.type,
|
|
931
|
+
...n ? { locale: n } : {},
|
|
932
|
+
...e.minimumFractionDigits !== void 0 ? { minimumFractionDigits: e.minimumFractionDigits } : {},
|
|
933
|
+
...e.maximumFractionDigits !== void 0 ? { maximumFractionDigits: e.maximumFractionDigits } : {},
|
|
934
|
+
...e.useGrouping !== void 0 ? { useGrouping: e.useGrouping } : {},
|
|
935
|
+
...e.prefix !== void 0 ? { prefix: e.prefix } : {},
|
|
936
|
+
...e.suffix !== void 0 ? { suffix: e.suffix } : {},
|
|
937
|
+
...e.negativeStyle !== void 0 ? {
|
|
938
|
+
negativeStyle: e.negativeStyle
|
|
939
|
+
} : {},
|
|
940
|
+
...e.compact !== void 0 ? { compact: e.compact } : {},
|
|
941
|
+
...e.scale !== void 0 ? { scale: e.scale } : {},
|
|
942
|
+
...a ? { currency: a } : {},
|
|
943
|
+
...e.percentValueMode !== void 0 ? {
|
|
944
|
+
percentValueMode: e.percentValueMode
|
|
945
|
+
} : {}
|
|
946
|
+
}
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
function Ar(e) {
|
|
950
|
+
const t = zr(e);
|
|
951
|
+
if (!t.ok)
|
|
952
|
+
return t;
|
|
953
|
+
const r = [];
|
|
954
|
+
return t.value.locale || r.push({
|
|
955
|
+
path: "locale",
|
|
956
|
+
message: "Resolved numeric formats require an explicit locale."
|
|
957
|
+
}), t.value.minimumFractionDigits === void 0 && r.push({
|
|
958
|
+
path: "minimumFractionDigits",
|
|
959
|
+
message: "Resolved numeric formats require minimumFractionDigits."
|
|
960
|
+
}), t.value.maximumFractionDigits === void 0 && r.push({
|
|
961
|
+
path: "maximumFractionDigits",
|
|
962
|
+
message: "Resolved numeric formats require maximumFractionDigits."
|
|
963
|
+
}), t.value.type === "currency" && !t.value.currency && r.push({
|
|
964
|
+
path: "currency",
|
|
965
|
+
message: "Resolved currency formats require an explicit currency."
|
|
966
|
+
}), r.length > 0 ? { ok: !1, issues: r } : t;
|
|
967
|
+
}
|
|
968
|
+
function $a(e) {
|
|
969
|
+
var n;
|
|
970
|
+
const t = /* @__PURE__ */ new Set();
|
|
971
|
+
if (e.snapshot.resolvedFormats.forEach((a, i) => {
|
|
972
|
+
if (a.format.type !== "temporal_bucket") {
|
|
973
|
+
if (a.scope.attachmentIndex !== void 0)
|
|
974
|
+
throw new Error(
|
|
975
|
+
`resolvedFormats.${i}.scope.attachmentIndex is not valid for a card export`
|
|
976
|
+
);
|
|
977
|
+
if (a.scope.dashboardId !== e.expectedScope.dashboardId || a.scope.cardId !== e.expectedScope.cardId)
|
|
978
|
+
throw new Error(
|
|
979
|
+
`resolvedFormats.${i}.scope must match the executing dashboard/card`
|
|
980
|
+
);
|
|
981
|
+
if (a.target.kind !== "column")
|
|
982
|
+
throw new Error(
|
|
983
|
+
`resolvedFormats.${i}.target must identify an export column`
|
|
984
|
+
);
|
|
985
|
+
if (t.has(a.target.columnKey))
|
|
986
|
+
throw new Error(
|
|
987
|
+
`resolvedFormats.${i} duplicates export column "${a.target.columnKey}"`
|
|
988
|
+
);
|
|
989
|
+
t.add(a.target.columnKey);
|
|
990
|
+
}
|
|
991
|
+
}), !e.useFormattedValues)
|
|
992
|
+
return;
|
|
993
|
+
if (!((n = e.visibleColumns) != null && n.length))
|
|
994
|
+
throw new Error(
|
|
995
|
+
"visibleColumns must identify every formatted export column"
|
|
996
|
+
);
|
|
997
|
+
const r = e.visibleColumns.find(
|
|
998
|
+
(a) => !t.has(a)
|
|
999
|
+
);
|
|
1000
|
+
if (r)
|
|
1001
|
+
throw new Error(
|
|
1002
|
+
`resolvedFormats is missing visible export column "${r}"`
|
|
1003
|
+
);
|
|
1004
|
+
}
|
|
1005
|
+
function Yr(e, t) {
|
|
1006
|
+
const r = new Intl.NumberFormat(e, {
|
|
1007
|
+
style: "currency",
|
|
1008
|
+
currency: t
|
|
1009
|
+
}).resolvedOptions();
|
|
1010
|
+
return {
|
|
1011
|
+
minimumFractionDigits: r.minimumFractionDigits,
|
|
1012
|
+
maximumFractionDigits: r.maximumFractionDigits
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
1015
|
+
function Rr(e) {
|
|
1016
|
+
if (e.minimumFractionDigits !== void 0 || e.maximumFractionDigits !== void 0) {
|
|
1017
|
+
const r = e.minimumFractionDigits ?? 0;
|
|
1018
|
+
return {
|
|
1019
|
+
minimumFractionDigits: r,
|
|
1020
|
+
maximumFractionDigits: e.maximumFractionDigits ?? Math.max(r, 2)
|
|
1021
|
+
};
|
|
1022
|
+
}
|
|
1023
|
+
const t = e.type === "percent" ? 1 : e.type === "scientific" ? 2 : 0;
|
|
1024
|
+
return {
|
|
1025
|
+
minimumFractionDigits: t,
|
|
1026
|
+
maximumFractionDigits: t
|
|
1027
|
+
};
|
|
1028
|
+
}
|
|
1029
|
+
function Ia(e, t, r) {
|
|
1030
|
+
const n = F(e.locale) ?? t.locale, a = e.type === "number" || e.type === "currency" ? ce(r) : void 0;
|
|
1031
|
+
if (!(e.type === "currency" || a !== void 0))
|
|
1032
|
+
return {
|
|
1033
|
+
...e,
|
|
1034
|
+
locale: n,
|
|
1035
|
+
...Rr(e)
|
|
1036
|
+
};
|
|
1037
|
+
const o = a ?? ce(e.currency) ?? t.defaultCurrency, s = Yr(
|
|
1038
|
+
n,
|
|
1039
|
+
o
|
|
1040
|
+
), c = s.minimumFractionDigits ?? 0, u = s.maximumFractionDigits ?? c, l = e.minimumFractionDigits ?? Math.min(
|
|
1041
|
+
c,
|
|
1042
|
+
e.maximumFractionDigits ?? c
|
|
1043
|
+
), d = e.maximumFractionDigits ?? Math.max(
|
|
1044
|
+
l,
|
|
1045
|
+
u
|
|
1046
|
+
);
|
|
1047
|
+
return {
|
|
1048
|
+
...e,
|
|
1049
|
+
type: "currency",
|
|
1050
|
+
locale: n,
|
|
1051
|
+
currency: o,
|
|
1052
|
+
minimumFractionDigits: l,
|
|
1053
|
+
maximumFractionDigits: d
|
|
1054
|
+
};
|
|
1055
|
+
}
|
|
1056
|
+
const Or = [
|
|
1057
|
+
"YYYY",
|
|
1058
|
+
"MMMM",
|
|
1059
|
+
"MMM",
|
|
1060
|
+
"YY",
|
|
1061
|
+
"MM",
|
|
1062
|
+
"DD",
|
|
1063
|
+
"HH",
|
|
1064
|
+
"mm",
|
|
1065
|
+
"ss"
|
|
1066
|
+
], Pr = /* @__PURE__ */ new Set([" ", "-", "/", ":", ".", ",", "T"]), st = {
|
|
1067
|
+
week_of_short: "week",
|
|
1068
|
+
week_of_long: "week",
|
|
1069
|
+
quarter_short: "quarter",
|
|
1070
|
+
quarter_long: "quarter",
|
|
1071
|
+
fiscal_quarter_short: "quarter",
|
|
1072
|
+
fiscal_year: "year"
|
|
1073
|
+
};
|
|
1074
|
+
function Lr(e) {
|
|
1075
|
+
return typeof e == "string" && Object.prototype.hasOwnProperty.call(st, e);
|
|
1076
|
+
}
|
|
1077
|
+
function jr(e, t) {
|
|
1078
|
+
return Or.find(
|
|
1079
|
+
(r) => e.startsWith(r, t)
|
|
1080
|
+
);
|
|
1081
|
+
}
|
|
1082
|
+
function C(e) {
|
|
1083
|
+
var a;
|
|
1084
|
+
if (!e || e.trim() !== e)
|
|
1085
|
+
return {
|
|
1086
|
+
ok: !1,
|
|
1087
|
+
code: "invalid_temporal_bucket_pattern",
|
|
1088
|
+
message: "Temporal bucket patterns must be non-empty and trimmed."
|
|
1089
|
+
};
|
|
1090
|
+
const t = [];
|
|
1091
|
+
let r = 0, n = !1;
|
|
1092
|
+
for (; r < e.length; ) {
|
|
1093
|
+
const i = jr(e, r);
|
|
1094
|
+
if (i) {
|
|
1095
|
+
if (n)
|
|
1096
|
+
return {
|
|
1097
|
+
ok: !1,
|
|
1098
|
+
code: "invalid_temporal_bucket_pattern",
|
|
1099
|
+
message: "Adjacent temporal bucket tokens require a separator."
|
|
1100
|
+
};
|
|
1101
|
+
t.push({ kind: "token", value: i }), r += i.length, n = !0;
|
|
1102
|
+
continue;
|
|
1103
|
+
}
|
|
1104
|
+
const o = e[r];
|
|
1105
|
+
if (!Pr.has(o))
|
|
1106
|
+
return {
|
|
1107
|
+
ok: !1,
|
|
1108
|
+
code: "invalid_temporal_bucket_pattern",
|
|
1109
|
+
message: `Unsupported temporal bucket pattern character "${o}".`
|
|
1110
|
+
};
|
|
1111
|
+
if (t.length === 0)
|
|
1112
|
+
return {
|
|
1113
|
+
ok: !1,
|
|
1114
|
+
code: "invalid_temporal_bucket_pattern",
|
|
1115
|
+
message: "Temporal bucket patterns cannot begin with a separator."
|
|
1116
|
+
};
|
|
1117
|
+
const s = t[t.length - 1];
|
|
1118
|
+
s.kind === "literal" ? s.value += o : t.push({ kind: "literal", value: o }), r += 1, n = !1;
|
|
1119
|
+
}
|
|
1120
|
+
return ((a = t[t.length - 1]) == null ? void 0 : a.kind) !== "token" ? {
|
|
1121
|
+
ok: !1,
|
|
1122
|
+
code: "invalid_temporal_bucket_pattern",
|
|
1123
|
+
message: "Temporal bucket patterns cannot end with a separator."
|
|
1124
|
+
} : { ok: !0, segments: t };
|
|
1125
|
+
}
|
|
1126
|
+
function Kr(e) {
|
|
1127
|
+
return e.flatMap(
|
|
1128
|
+
(t) => t.kind === "token" ? [t.value] : []
|
|
1129
|
+
);
|
|
1130
|
+
}
|
|
1131
|
+
function ze(e, t) {
|
|
1132
|
+
return e.filter((r) => t.includes(r)).length === 1;
|
|
1133
|
+
}
|
|
1134
|
+
function Y(e, t) {
|
|
1135
|
+
return e.some((r) => t.includes(r));
|
|
1136
|
+
}
|
|
1137
|
+
function Hr(e) {
|
|
1138
|
+
return new Set(e).size !== e.length;
|
|
1139
|
+
}
|
|
1140
|
+
function Zr(e, t) {
|
|
1141
|
+
if (Hr(e)) return !1;
|
|
1142
|
+
const r = ["YYYY", "YY"], n = ["MMMM", "MMM", "MM"], a = ["HH", "mm", "ss"], i = ze(e, r), o = ze(e, n), s = e.includes("DD"), c = Y(e, a);
|
|
1143
|
+
switch (t) {
|
|
1144
|
+
case "second":
|
|
1145
|
+
return e.includes("HH") && e.includes("mm") && e.includes("ss") && (!Y(e, [...r, ...n, "DD"]) || i && o && s);
|
|
1146
|
+
case "minute":
|
|
1147
|
+
return e.includes("HH") && e.includes("mm") && (!Y(e, [...r, ...n, "DD"]) || i && o && s);
|
|
1148
|
+
case "hour":
|
|
1149
|
+
return e.includes("HH") && (!Y(e, [...r, ...n, "DD"]) || i && o && s);
|
|
1150
|
+
case "day":
|
|
1151
|
+
case "week":
|
|
1152
|
+
return i && o && s && !c;
|
|
1153
|
+
case "month":
|
|
1154
|
+
return i && o && !s && !c;
|
|
1155
|
+
case "quarter":
|
|
1156
|
+
return !1;
|
|
1157
|
+
case "year":
|
|
1158
|
+
return i && !o && !s && !c;
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
function ct(e, t) {
|
|
1162
|
+
if (e.presentation.mode === "auto")
|
|
1163
|
+
return { ok: !0 };
|
|
1164
|
+
if (e.presentation.mode === "preset") {
|
|
1165
|
+
const n = st[e.presentation.preset];
|
|
1166
|
+
return n === t ? { ok: !0 } : {
|
|
1167
|
+
ok: !1,
|
|
1168
|
+
code: "incompatible_temporal_bucket_preset",
|
|
1169
|
+
message: `Preset ${e.presentation.preset} requires ${n} granularity.`
|
|
1170
|
+
};
|
|
1171
|
+
}
|
|
1172
|
+
const r = C(e.presentation.pattern);
|
|
1173
|
+
return r.ok ? Zr(
|
|
1174
|
+
Kr(r.segments),
|
|
1175
|
+
t
|
|
1176
|
+
) ? { ok: !0, segments: r.segments } : {
|
|
1177
|
+
ok: !1,
|
|
1178
|
+
code: "incompatible_temporal_bucket_pattern",
|
|
1179
|
+
message: `Pattern ${e.presentation.pattern} is not compatible with ${t} granularity.`
|
|
1180
|
+
} : r;
|
|
1181
|
+
}
|
|
1182
|
+
function Ea(e, t) {
|
|
1183
|
+
if (!(!e || !t))
|
|
1184
|
+
return ct(e, t).ok ? e : void 0;
|
|
1185
|
+
}
|
|
1186
|
+
class N extends Error {
|
|
1187
|
+
constructor(r, n) {
|
|
1188
|
+
super(n);
|
|
1189
|
+
v(this, "code");
|
|
1190
|
+
this.name = "RawTemporalFormatContractError", this.code = r;
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
const qr = [
|
|
1194
|
+
"SSSSSSSSS",
|
|
1195
|
+
"SSSSSSSS",
|
|
1196
|
+
"SSSSSSS",
|
|
1197
|
+
"SSSSSS",
|
|
1198
|
+
"SSSSS",
|
|
1199
|
+
"SSSS",
|
|
1200
|
+
"SSS",
|
|
1201
|
+
"SS",
|
|
1202
|
+
"S"
|
|
1203
|
+
], ut = /^(\d{4})-(\d{2})-(\d{2})$/, lt = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?$/, mt = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?(Z|[+-]\d{2}:\d{2})$/, Br = [
|
|
1204
|
+
"yyyy",
|
|
1205
|
+
"MMMM",
|
|
1206
|
+
"LLLL",
|
|
1207
|
+
"zzz",
|
|
1208
|
+
"XXX",
|
|
1209
|
+
"MMM",
|
|
1210
|
+
"LLL",
|
|
1211
|
+
"yy",
|
|
1212
|
+
"MM",
|
|
1213
|
+
"dd",
|
|
1214
|
+
"HH",
|
|
1215
|
+
"hh",
|
|
1216
|
+
"mm",
|
|
1217
|
+
"ss",
|
|
1218
|
+
"M",
|
|
1219
|
+
"d",
|
|
1220
|
+
"H",
|
|
1221
|
+
"h",
|
|
1222
|
+
"m",
|
|
1223
|
+
"s",
|
|
1224
|
+
"a"
|
|
1225
|
+
], Vr = /* @__PURE__ */ new Set([
|
|
1226
|
+
"HH",
|
|
1227
|
+
"H",
|
|
1228
|
+
"hh",
|
|
1229
|
+
"h",
|
|
1230
|
+
"mm",
|
|
1231
|
+
"m",
|
|
1232
|
+
"ss",
|
|
1233
|
+
"s",
|
|
1234
|
+
"a",
|
|
1235
|
+
...qr
|
|
1236
|
+
]), Gr = /* @__PURE__ */ new Set(["zzz", "XXX"]), ie = /* @__PURE__ */ new Set(["short", "medium", "long"]);
|
|
1237
|
+
function T(e, t) {
|
|
1238
|
+
return Object.keys(e).length === t.length && t.every((n) => n in e);
|
|
1239
|
+
}
|
|
1240
|
+
function m(e) {
|
|
1241
|
+
throw new N(
|
|
1242
|
+
"invalid_raw_temporal_format",
|
|
1243
|
+
e
|
|
1244
|
+
);
|
|
1245
|
+
}
|
|
1246
|
+
function dt(e) {
|
|
1247
|
+
if (!e || e.trim() !== e || e.length > 256)
|
|
1248
|
+
return m(
|
|
1249
|
+
"date_fns patterns must be non-empty, trimmed, and at most 256 characters."
|
|
1250
|
+
);
|
|
1251
|
+
const t = [], r = (a) => {
|
|
1252
|
+
const i = t[t.length - 1];
|
|
1253
|
+
(i == null ? void 0 : i.kind) === "literal" ? i.value += a : t.push({ kind: "literal", value: a });
|
|
1254
|
+
};
|
|
1255
|
+
let n = 0;
|
|
1256
|
+
for (; n < e.length; ) {
|
|
1257
|
+
if (e[n] === "'") {
|
|
1258
|
+
if (e[n + 1] === "'") {
|
|
1259
|
+
r("'"), n += 2;
|
|
1260
|
+
continue;
|
|
1261
|
+
}
|
|
1262
|
+
let o = "", s = !1;
|
|
1263
|
+
for (n += 1; n < e.length; ) {
|
|
1264
|
+
if (e[n] === "'") {
|
|
1265
|
+
if (e[n + 1] === "'") {
|
|
1266
|
+
o += "'", n += 2;
|
|
1267
|
+
continue;
|
|
1268
|
+
}
|
|
1269
|
+
s = !0, n += 1;
|
|
1270
|
+
break;
|
|
1271
|
+
}
|
|
1272
|
+
o += e[n], n += 1;
|
|
1273
|
+
}
|
|
1274
|
+
if (!s)
|
|
1275
|
+
return m("date_fns pattern has an unclosed quote.");
|
|
1276
|
+
r(o);
|
|
1277
|
+
continue;
|
|
1278
|
+
}
|
|
1279
|
+
if (e[n] === "S") {
|
|
1280
|
+
let o = n + 1;
|
|
1281
|
+
for (; e[o] === "S"; ) o += 1;
|
|
1282
|
+
const s = e.slice(n, o);
|
|
1283
|
+
if (s.length > 9)
|
|
1284
|
+
return m(
|
|
1285
|
+
"date_fns fractional-second tokens support at most nine digits."
|
|
1286
|
+
);
|
|
1287
|
+
t.push({
|
|
1288
|
+
kind: "token",
|
|
1289
|
+
value: s
|
|
1290
|
+
}), n = o;
|
|
1291
|
+
continue;
|
|
1292
|
+
}
|
|
1293
|
+
const a = Br.find(
|
|
1294
|
+
(o) => e.startsWith(o, n)
|
|
1295
|
+
);
|
|
1296
|
+
if (a) {
|
|
1297
|
+
t.push({ kind: "token", value: a }), n += a.length;
|
|
1298
|
+
continue;
|
|
1299
|
+
}
|
|
1300
|
+
const i = e[n];
|
|
1301
|
+
if (/[A-Za-z]/.test(i))
|
|
1302
|
+
return m(
|
|
1303
|
+
`Unsupported date_fns pattern token beginning at "${e.slice(n)}".`
|
|
1304
|
+
);
|
|
1305
|
+
r(i), n += 1;
|
|
1306
|
+
}
|
|
1307
|
+
return t.some((a) => a.kind === "token") ? t : m("date_fns patterns must contain at least one token.");
|
|
1308
|
+
}
|
|
1309
|
+
function ft(e, t) {
|
|
1310
|
+
if (e === "semaphor_tokens") {
|
|
1311
|
+
const r = C(t);
|
|
1312
|
+
r.ok || m(r.message);
|
|
1313
|
+
return;
|
|
1314
|
+
}
|
|
1315
|
+
dt(t);
|
|
1316
|
+
}
|
|
1317
|
+
function Wr(e) {
|
|
1318
|
+
return !g(e) || !T(e, ["dateStyle", "dateTime"]) ? m("Automatic raw temporal styles are incomplete.") : ie.has(e.dateStyle) ? !g(e.dateTime) || !T(e.dateTime, ["dateStyle", "timeStyle"]) || !ie.has(e.dateTime.dateStyle) || !ie.has(e.dateTime.timeStyle) ? m(
|
|
1319
|
+
"Automatic dateTime styles are incomplete or invalid."
|
|
1320
|
+
) : {
|
|
1321
|
+
dateStyle: e.dateStyle,
|
|
1322
|
+
dateTime: {
|
|
1323
|
+
dateStyle: e.dateTime.dateStyle,
|
|
1324
|
+
timeStyle: e.dateTime.timeStyle
|
|
1325
|
+
}
|
|
1326
|
+
} : m("Automatic dateStyle is invalid.");
|
|
1327
|
+
}
|
|
1328
|
+
function pe(e) {
|
|
1329
|
+
const t = ["type", "locale", "calendarTimezone", "presentation"], r = [...t, "sourceTimezone"];
|
|
1330
|
+
if (!g(e) || !T(e, t) && !T(e, r) || e.type !== "raw_temporal")
|
|
1331
|
+
return m("Resolved raw temporal format has an invalid shape.");
|
|
1332
|
+
const n = F(e.locale);
|
|
1333
|
+
return n ? typeof e.calendarTimezone != "string" || !L(e.calendarTimezone) ? m(
|
|
1334
|
+
"Raw temporal calendarTimezone must be a valid IANA timezone."
|
|
1335
|
+
) : e.sourceTimezone !== void 0 && (typeof e.sourceTimezone != "string" || !L(e.sourceTimezone)) ? m(
|
|
1336
|
+
"Raw temporal sourceTimezone must be a valid IANA timezone."
|
|
1337
|
+
) : g(e.presentation) ? e.presentation.mode === "auto" ? T(e.presentation, ["mode", "styles"]) ? {
|
|
1338
|
+
type: "raw_temporal",
|
|
1339
|
+
locale: n,
|
|
1340
|
+
calendarTimezone: e.calendarTimezone,
|
|
1341
|
+
...e.sourceTimezone ? { sourceTimezone: e.sourceTimezone } : {},
|
|
1342
|
+
presentation: {
|
|
1343
|
+
mode: "auto",
|
|
1344
|
+
styles: Wr(e.presentation.styles)
|
|
1345
|
+
}
|
|
1346
|
+
} : m(
|
|
1347
|
+
"Automatic raw temporal presentation has unknown fields."
|
|
1348
|
+
) : e.presentation.mode !== "pattern" || !T(e.presentation, ["mode", "dialect", "pattern"]) || e.presentation.dialect !== "semaphor_tokens" && e.presentation.dialect !== "date_fns" || typeof e.presentation.pattern != "string" ? m(
|
|
1349
|
+
"Pattern raw temporal presentation has an invalid shape."
|
|
1350
|
+
) : (ft(e.presentation.dialect, e.presentation.pattern), {
|
|
1351
|
+
type: "raw_temporal",
|
|
1352
|
+
locale: n,
|
|
1353
|
+
calendarTimezone: e.calendarTimezone,
|
|
1354
|
+
...e.sourceTimezone ? { sourceTimezone: e.sourceTimezone } : {},
|
|
1355
|
+
presentation: {
|
|
1356
|
+
mode: "pattern",
|
|
1357
|
+
dialect: e.presentation.dialect,
|
|
1358
|
+
pattern: e.presentation.pattern
|
|
1359
|
+
}
|
|
1360
|
+
}) : m("Raw temporal presentation must be an object.") : m("Raw temporal locale is invalid or unsupported.");
|
|
1361
|
+
}
|
|
1362
|
+
function Xr(e) {
|
|
1363
|
+
var s, c, u;
|
|
1364
|
+
if (e.format) {
|
|
1365
|
+
if (!g(e.format))
|
|
1366
|
+
return m(
|
|
1367
|
+
"Authored raw temporal format has an invalid shape."
|
|
1368
|
+
);
|
|
1369
|
+
const l = Object.keys(e.format);
|
|
1370
|
+
if (!l.includes("type") || !l.includes("presentation") || l.some(
|
|
1371
|
+
(y) => y !== "type" && y !== "presentation" && y !== "timezone" && y !== "sourceTimezone"
|
|
1372
|
+
) || e.format.type !== "raw_temporal" || !g(e.format.presentation))
|
|
1373
|
+
return m(
|
|
1374
|
+
"Authored raw temporal format has an invalid shape."
|
|
1375
|
+
);
|
|
1376
|
+
const d = e.format.presentation;
|
|
1377
|
+
if (d.mode === "auto") {
|
|
1378
|
+
if (!T(d, ["mode"]))
|
|
1379
|
+
return m(
|
|
1380
|
+
"Automatic authored raw temporal format has unknown fields."
|
|
1381
|
+
);
|
|
1382
|
+
} else {
|
|
1383
|
+
if (d.mode !== "pattern" || !T(d, ["mode", "dialect", "pattern"]) || d.dialect !== "semaphor_tokens" && d.dialect !== "date_fns" || typeof d.pattern != "string")
|
|
1384
|
+
return m(
|
|
1385
|
+
"Authored raw temporal pattern has an invalid shape."
|
|
1386
|
+
);
|
|
1387
|
+
ft(d.dialect, d.pattern);
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
const t = (s = e.format) == null ? void 0 : s.timezone, r = (c = e.format) == null ? void 0 : c.sourceTimezone, n = t && t !== "auto" ? t : e.calendar.tz, a = r && r !== "auto" ? r === "local" ? Intl.DateTimeFormat().resolvedOptions().timeZone : r : void 0;
|
|
1391
|
+
if (t !== void 0 && t !== "auto" && !L(n) || a !== void 0 && !L(a))
|
|
1392
|
+
return m("Authored raw temporal timezone is invalid.");
|
|
1393
|
+
const i = ((u = e.format) == null ? void 0 : u.presentation) ?? { mode: "auto" }, o = {
|
|
1394
|
+
type: "raw_temporal",
|
|
1395
|
+
locale: e.preferences.locale,
|
|
1396
|
+
calendarTimezone: n,
|
|
1397
|
+
...a ? { sourceTimezone: a } : {},
|
|
1398
|
+
presentation: i.mode === "pattern" ? { ...i } : {
|
|
1399
|
+
mode: "auto",
|
|
1400
|
+
styles: {
|
|
1401
|
+
dateStyle: e.preferences.dateStyle,
|
|
1402
|
+
dateTime: { ...e.preferences.dateTime }
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
};
|
|
1406
|
+
return pe(o);
|
|
1407
|
+
}
|
|
1408
|
+
function Jr(e) {
|
|
1409
|
+
if (ut.test(e)) return "date";
|
|
1410
|
+
if (mt.test(e)) return "instant";
|
|
1411
|
+
if (lt.test(e)) return "wall_datetime";
|
|
1412
|
+
}
|
|
1413
|
+
function Fa(e) {
|
|
1414
|
+
const t = /* @__PURE__ */ new Set();
|
|
1415
|
+
let r = !1;
|
|
1416
|
+
for (const n of e.values) {
|
|
1417
|
+
if (n === null) continue;
|
|
1418
|
+
r = !0;
|
|
1419
|
+
const a = Jr(n);
|
|
1420
|
+
a && t.add(a);
|
|
1421
|
+
}
|
|
1422
|
+
if (!r) return { status: "empty" };
|
|
1423
|
+
if (t.size === 0) return { status: "invalid_only" };
|
|
1424
|
+
if (t.size > 1)
|
|
1425
|
+
throw new N(
|
|
1426
|
+
"mixed_sql_temporal_semantics",
|
|
1427
|
+
`Declared SQL temporal column "${e.columnKey}" mixes date, wall-datetime, or instant semantics. Normalize it to one kind.`
|
|
1428
|
+
);
|
|
1429
|
+
return {
|
|
1430
|
+
status: "classified",
|
|
1431
|
+
metadata: {
|
|
1432
|
+
kind: "raw_temporal",
|
|
1433
|
+
valueKind: [...t][0]
|
|
1434
|
+
}
|
|
1435
|
+
};
|
|
1436
|
+
}
|
|
1437
|
+
function Ca(e) {
|
|
1438
|
+
return {
|
|
1439
|
+
version: 1,
|
|
1440
|
+
columns: Object.fromEntries(
|
|
1441
|
+
[...e].map(([t, r]) => [
|
|
1442
|
+
t,
|
|
1443
|
+
r.status === "classified" ? r.metadata.valueKind : r.status
|
|
1444
|
+
])
|
|
1445
|
+
)
|
|
1446
|
+
};
|
|
1447
|
+
}
|
|
1448
|
+
function Qr(e) {
|
|
1449
|
+
if (!g(e) || e.version !== 1 || !g(e.columns) || Object.keys(e).some((n) => n !== "version" && n !== "columns"))
|
|
1450
|
+
throw new N(
|
|
1451
|
+
"invalid_raw_temporal_format",
|
|
1452
|
+
"Raw temporal chunk classification evidence is malformed."
|
|
1453
|
+
);
|
|
1454
|
+
const t = {}, r = /* @__PURE__ */ new Set([
|
|
1455
|
+
"empty",
|
|
1456
|
+
"invalid_only",
|
|
1457
|
+
"date",
|
|
1458
|
+
"wall_datetime",
|
|
1459
|
+
"instant"
|
|
1460
|
+
]);
|
|
1461
|
+
for (const [n, a] of Object.entries(e.columns)) {
|
|
1462
|
+
if (!n.trim() || !r.has(a))
|
|
1463
|
+
throw new N(
|
|
1464
|
+
"invalid_raw_temporal_format",
|
|
1465
|
+
"Raw temporal chunk classification evidence contains an invalid column or status."
|
|
1466
|
+
);
|
|
1467
|
+
t[n] = a;
|
|
1468
|
+
}
|
|
1469
|
+
return { version: 1, columns: t };
|
|
1470
|
+
}
|
|
1471
|
+
function Ua(e) {
|
|
1472
|
+
if (e.length === 0) return;
|
|
1473
|
+
const t = e.map(Qr), r = Object.keys(t[0].columns).sort();
|
|
1474
|
+
for (let n = 1; n < t.length; n += 1) {
|
|
1475
|
+
const a = Object.keys(t[n].columns).sort();
|
|
1476
|
+
if (a.length !== r.length || a.some((i, o) => i !== r[o]))
|
|
1477
|
+
throw new N(
|
|
1478
|
+
"invalid_raw_temporal_format",
|
|
1479
|
+
"Raw temporal chunk classification evidence has inconsistent columns."
|
|
1480
|
+
);
|
|
1481
|
+
}
|
|
1482
|
+
for (const n of r)
|
|
1483
|
+
if (new Set(
|
|
1484
|
+
t.map((i) => i.columns[n]).filter(
|
|
1485
|
+
(i) => i !== "empty" && i !== "invalid_only"
|
|
1486
|
+
)
|
|
1487
|
+
).size > 1)
|
|
1488
|
+
throw new N(
|
|
1489
|
+
"mixed_sql_temporal_semantics",
|
|
1490
|
+
`Declared SQL temporal column "${n}" has inconsistent semantics across export chunks. Normalize it to one kind.`
|
|
1491
|
+
);
|
|
1492
|
+
}
|
|
1493
|
+
function en(e) {
|
|
1494
|
+
return e % 4 === 0 && (e % 100 !== 0 || e % 400 === 0);
|
|
1495
|
+
}
|
|
1496
|
+
function tn(e, t) {
|
|
1497
|
+
return t === 2 ? en(e) ? 29 : 28 : [4, 6, 9, 11].includes(t) ? 30 : 31;
|
|
1498
|
+
}
|
|
1499
|
+
function rn(e) {
|
|
1500
|
+
return e.year >= 1 && e.year <= 9999 && e.month >= 1 && e.month <= 12 && e.day >= 1 && e.day <= tn(e.year, e.month) && e.hour >= 0 && e.hour <= 23 && e.minute >= 0 && e.minute <= 59 && e.second >= 0 && e.second <= 59;
|
|
1501
|
+
}
|
|
1502
|
+
function nn(e) {
|
|
1503
|
+
return {
|
|
1504
|
+
year: Number(e[1]),
|
|
1505
|
+
month: Number(e[2]),
|
|
1506
|
+
day: Number(e[3]),
|
|
1507
|
+
hour: Number(e[4] ?? 0),
|
|
1508
|
+
minute: Number(e[5] ?? 0),
|
|
1509
|
+
second: Number(e[6] ?? 0),
|
|
1510
|
+
fraction: e[7] ?? ""
|
|
1511
|
+
};
|
|
1512
|
+
}
|
|
1513
|
+
function an(e, t) {
|
|
1514
|
+
const r = t === "date" ? e.match(ut) : t === "wall_datetime" ? e.match(lt) : e.match(mt);
|
|
1515
|
+
if (!r) return { status: "invalid_shape" };
|
|
1516
|
+
const n = nn(r);
|
|
1517
|
+
if (!rn(n)) return { status: "out_of_range" };
|
|
1518
|
+
if (t === "instant") {
|
|
1519
|
+
const a = r[8];
|
|
1520
|
+
if (a && a !== "Z") {
|
|
1521
|
+
const [o, s] = a.slice(1).split(":").map(Number);
|
|
1522
|
+
if (o > 23 || s > 59) return { status: "out_of_range" };
|
|
1523
|
+
}
|
|
1524
|
+
const i = new Date(e.replace(" ", "T"));
|
|
1525
|
+
return Number.isNaN(i.getTime()) ? { status: "out_of_range" } : { status: "valid", fields: n, instant: i };
|
|
1526
|
+
}
|
|
1527
|
+
return { status: "valid", fields: n };
|
|
1528
|
+
}
|
|
1529
|
+
function de(e) {
|
|
1530
|
+
const t = /* @__PURE__ */ new Date(0);
|
|
1531
|
+
return t.setUTCFullYear(e.year, e.month - 1, e.day), t.setUTCHours(e.hour, e.minute, e.second, 0), t;
|
|
1532
|
+
}
|
|
1533
|
+
function we(e, t) {
|
|
1534
|
+
const r = e.fraction ? `.${e.fraction.padEnd(3, "0").slice(0, 3)}` : "";
|
|
1535
|
+
return W(
|
|
1536
|
+
`${String(e.year).padStart(4, "0")}-${String(e.month).padStart(2, "0")}-${String(e.day).padStart(2, "0")}T${String(e.hour).padStart(2, "0")}:${String(e.minute).padStart(2, "0")}:${String(e.second).padStart(2, "0")}${r}`,
|
|
1537
|
+
t
|
|
1538
|
+
);
|
|
1539
|
+
}
|
|
1540
|
+
function yt(e, t) {
|
|
1541
|
+
const r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
1542
|
+
let a, i, o, s;
|
|
1543
|
+
return {
|
|
1544
|
+
number(c, u = 1) {
|
|
1545
|
+
let l = r.get(u);
|
|
1546
|
+
return l || (l = new Intl.NumberFormat(e, {
|
|
1547
|
+
useGrouping: !1,
|
|
1548
|
+
minimumIntegerDigits: u,
|
|
1549
|
+
maximumFractionDigits: 0
|
|
1550
|
+
}), r.set(u, l)), l.format(c);
|
|
1551
|
+
},
|
|
1552
|
+
month(c, u, l) {
|
|
1553
|
+
var w;
|
|
1554
|
+
const d = `${u}:${l ? "standalone" : "contextual"}`;
|
|
1555
|
+
let y = n.get(d);
|
|
1556
|
+
if (!y) {
|
|
1557
|
+
const h = {
|
|
1558
|
+
calendar: "gregory",
|
|
1559
|
+
timeZone: "UTC",
|
|
1560
|
+
month: u
|
|
1561
|
+
};
|
|
1562
|
+
l || (h.day = "numeric"), y = new Intl.DateTimeFormat(e, h), n.set(d, y);
|
|
1563
|
+
}
|
|
1564
|
+
return ((w = y.formatToParts(c).find((h) => h.type === "month")) == null ? void 0 : w.value) ?? "";
|
|
1565
|
+
},
|
|
1566
|
+
dayPeriod(c) {
|
|
1567
|
+
var u;
|
|
1568
|
+
return a ?? (a = new Intl.DateTimeFormat(e, {
|
|
1569
|
+
calendar: "gregory",
|
|
1570
|
+
timeZone: "UTC",
|
|
1571
|
+
hour: "numeric",
|
|
1572
|
+
hour12: !0
|
|
1573
|
+
})), ((u = a.formatToParts(c).find((l) => l.type === "dayPeriod")) == null ? void 0 : u.value) ?? "";
|
|
1574
|
+
},
|
|
1575
|
+
instantFields(c) {
|
|
1576
|
+
i ?? (i = new Intl.DateTimeFormat("en-CA", {
|
|
1577
|
+
calendar: "gregory",
|
|
1578
|
+
numberingSystem: "latn",
|
|
1579
|
+
timeZone: t,
|
|
1580
|
+
year: "numeric",
|
|
1581
|
+
month: "2-digit",
|
|
1582
|
+
day: "2-digit",
|
|
1583
|
+
hour: "2-digit",
|
|
1584
|
+
minute: "2-digit",
|
|
1585
|
+
second: "2-digit",
|
|
1586
|
+
hourCycle: "h23"
|
|
1587
|
+
}));
|
|
1588
|
+
const u = i.formatToParts(c), l = (d) => {
|
|
1589
|
+
var y;
|
|
1590
|
+
return Number((y = u.find((w) => w.type === d)) == null ? void 0 : y.value);
|
|
1591
|
+
};
|
|
1592
|
+
return {
|
|
1593
|
+
year: l("year"),
|
|
1594
|
+
month: l("month"),
|
|
1595
|
+
day: l("day"),
|
|
1596
|
+
hour: l("hour"),
|
|
1597
|
+
minute: l("minute"),
|
|
1598
|
+
second: l("second"),
|
|
1599
|
+
fraction: ""
|
|
1600
|
+
};
|
|
1601
|
+
},
|
|
1602
|
+
timezoneName(c) {
|
|
1603
|
+
var u;
|
|
1604
|
+
return o ?? (o = new Intl.DateTimeFormat(e, {
|
|
1605
|
+
calendar: "gregory",
|
|
1606
|
+
timeZone: t,
|
|
1607
|
+
timeZoneName: "short"
|
|
1608
|
+
})), ((u = o.formatToParts(c).find((l) => l.type === "timeZoneName")) == null ? void 0 : u.value) ?? "";
|
|
1609
|
+
},
|
|
1610
|
+
timezoneOffset(c) {
|
|
1611
|
+
var d;
|
|
1612
|
+
s ?? (s = new Intl.DateTimeFormat("en-US", {
|
|
1613
|
+
calendar: "gregory",
|
|
1614
|
+
timeZone: t,
|
|
1615
|
+
timeZoneName: "longOffset"
|
|
1616
|
+
}));
|
|
1617
|
+
const u = (d = s.formatToParts(c).find((y) => y.type === "timeZoneName")) == null ? void 0 : d.value;
|
|
1618
|
+
if (!u)
|
|
1619
|
+
return m("Unable to resolve the instant timezone offset.");
|
|
1620
|
+
const l = u.replace(/^GMT/, "");
|
|
1621
|
+
return l === "" || /^[+-]00:00$/.test(l) ? "Z" : l;
|
|
1622
|
+
}
|
|
1623
|
+
};
|
|
1624
|
+
}
|
|
1625
|
+
function on(e, t, r, n, a) {
|
|
1626
|
+
if (/^S{1,9}$/.test(e)) {
|
|
1627
|
+
const i = t.fraction.padEnd(e.length, "0").slice(0, e.length);
|
|
1628
|
+
return n.number(Number(i), e.length);
|
|
1629
|
+
}
|
|
1630
|
+
switch (e) {
|
|
1631
|
+
case "YYYY":
|
|
1632
|
+
case "yyyy":
|
|
1633
|
+
return n.number(t.year, 4);
|
|
1634
|
+
case "YY":
|
|
1635
|
+
case "yy":
|
|
1636
|
+
return n.number(t.year % 100, 2);
|
|
1637
|
+
case "MMMM":
|
|
1638
|
+
return n.month(r, "long", !1);
|
|
1639
|
+
case "LLLL":
|
|
1640
|
+
return n.month(r, "long", !0);
|
|
1641
|
+
case "MMM":
|
|
1642
|
+
return n.month(r, "short", !1);
|
|
1643
|
+
case "LLL":
|
|
1644
|
+
return n.month(r, "short", !0);
|
|
1645
|
+
case "MM":
|
|
1646
|
+
return n.number(t.month, 2);
|
|
1647
|
+
case "M":
|
|
1648
|
+
return n.number(t.month);
|
|
1649
|
+
case "DD":
|
|
1650
|
+
case "dd":
|
|
1651
|
+
return n.number(t.day, 2);
|
|
1652
|
+
case "d":
|
|
1653
|
+
return n.number(t.day);
|
|
1654
|
+
case "HH":
|
|
1655
|
+
return n.number(t.hour, 2);
|
|
1656
|
+
case "H":
|
|
1657
|
+
return n.number(t.hour);
|
|
1658
|
+
case "hh":
|
|
1659
|
+
return n.number(t.hour % 12 || 12, 2);
|
|
1660
|
+
case "h":
|
|
1661
|
+
return n.number(t.hour % 12 || 12);
|
|
1662
|
+
case "mm":
|
|
1663
|
+
return n.number(t.minute, 2);
|
|
1664
|
+
case "m":
|
|
1665
|
+
return n.number(t.minute);
|
|
1666
|
+
case "ss":
|
|
1667
|
+
return n.number(t.second, 2);
|
|
1668
|
+
case "s":
|
|
1669
|
+
return n.number(t.second);
|
|
1670
|
+
case "a":
|
|
1671
|
+
return n.dayPeriod(r);
|
|
1672
|
+
case "zzz":
|
|
1673
|
+
return a ? n.timezoneName(a) : m(
|
|
1674
|
+
"Timezone pattern tokens require an instant value."
|
|
1675
|
+
);
|
|
1676
|
+
case "XXX":
|
|
1677
|
+
return a ? n.timezoneOffset(a) : m(
|
|
1678
|
+
"Timezone pattern tokens require an instant value."
|
|
1679
|
+
);
|
|
1680
|
+
default:
|
|
1681
|
+
return m(
|
|
1682
|
+
`Unsupported raw temporal pattern token "${e}".`
|
|
1683
|
+
);
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
function sn(e, t, r, n) {
|
|
1687
|
+
const a = de(t);
|
|
1688
|
+
return e.map(
|
|
1689
|
+
(i) => i.kind === "literal" ? i.value : on(i.value, t, a, r, n)
|
|
1690
|
+
).join("");
|
|
1691
|
+
}
|
|
1692
|
+
function gt(e, t, r) {
|
|
1693
|
+
const n = t === "date_fns" ? dt(r) : (() => {
|
|
1694
|
+
const i = C(r);
|
|
1695
|
+
return i.ok ? i.segments : m(i.message);
|
|
1696
|
+
})(), a = n.filter((i) => i.kind === "token").map((i) => i.value);
|
|
1697
|
+
return e === "date" && a.some((i) => Vr.has(i)) ? m("Date patterns cannot contain time tokens.") : e !== "instant" && a.some((i) => Gr.has(i)) ? m("Timezone pattern tokens require an instant value.") : n;
|
|
1698
|
+
}
|
|
1699
|
+
function cn(e) {
|
|
1700
|
+
gt(
|
|
1701
|
+
e.valueKind ?? "instant",
|
|
1702
|
+
e.dialect,
|
|
1703
|
+
e.pattern
|
|
1704
|
+
);
|
|
1705
|
+
}
|
|
1706
|
+
function un(e, t, r, n) {
|
|
1707
|
+
const a = gt(
|
|
1708
|
+
e.valueKind,
|
|
1709
|
+
r,
|
|
1710
|
+
n
|
|
1711
|
+
), i = yt(t.locale, t.calendarTimezone);
|
|
1712
|
+
return (o) => {
|
|
1713
|
+
const s = e.valueKind === "wall_datetime" && t.sourceTimezone ? we(o.fields, t.sourceTimezone) : void 0, c = e.valueKind === "instant" ? {
|
|
1714
|
+
...i.instantFields(o.instant),
|
|
1715
|
+
fraction: o.fields.fraction
|
|
1716
|
+
} : s ? {
|
|
1717
|
+
...i.instantFields(s),
|
|
1718
|
+
fraction: o.fields.fraction
|
|
1719
|
+
} : o.fields;
|
|
1720
|
+
return sn(a, c, i, o.instant ?? s);
|
|
1721
|
+
};
|
|
1722
|
+
}
|
|
1723
|
+
function ln(e, t) {
|
|
1724
|
+
const r = yt(t.locale, t.calendarTimezone);
|
|
1725
|
+
return (n) => {
|
|
1726
|
+
const a = e.valueKind === "instant" ? r.instantFields(n.instant) : e.valueKind === "wall_datetime" && t.sourceTimezone ? r.instantFields(we(n.fields, t.sourceTimezone)) : n.fields;
|
|
1727
|
+
return {
|
|
1728
|
+
year: a.year,
|
|
1729
|
+
month: a.month,
|
|
1730
|
+
day: a.day,
|
|
1731
|
+
hour: a.hour,
|
|
1732
|
+
minute: a.minute,
|
|
1733
|
+
second: a.second
|
|
1734
|
+
};
|
|
1735
|
+
};
|
|
1736
|
+
}
|
|
1737
|
+
function mn(e, t) {
|
|
1738
|
+
const r = t.presentation.mode === "auto" ? t.presentation.styles : m("Automatic raw temporal formatting requires styles.");
|
|
1739
|
+
if (e.valueKind === "date") {
|
|
1740
|
+
const o = new Intl.DateTimeFormat(t.locale, {
|
|
1741
|
+
calendar: "gregory",
|
|
1742
|
+
timeZone: "UTC",
|
|
1743
|
+
dateStyle: r.dateStyle
|
|
1744
|
+
});
|
|
1745
|
+
return (s) => o.format(de(s.fields));
|
|
1746
|
+
}
|
|
1747
|
+
const n = e.valueKind === "instant", a = !n && r.dateTime.timeStyle === "long" ? "medium" : r.dateTime.timeStyle, i = new Intl.DateTimeFormat(t.locale, {
|
|
1748
|
+
calendar: "gregory",
|
|
1749
|
+
timeZone: n || e.valueKind === "wall_datetime" && t.sourceTimezone ? t.calendarTimezone : "UTC",
|
|
1750
|
+
dateStyle: r.dateTime.dateStyle,
|
|
1751
|
+
timeStyle: a
|
|
1752
|
+
});
|
|
1753
|
+
return (o) => n ? i.format(o.instant) : e.valueKind === "wall_datetime" && t.sourceTimezone ? i.format(we(o.fields, t.sourceTimezone)) : i.format(de(o.fields));
|
|
1754
|
+
}
|
|
1755
|
+
function Ae(e, t, r) {
|
|
1756
|
+
return {
|
|
1757
|
+
ok: !1,
|
|
1758
|
+
text: e,
|
|
1759
|
+
diagnostic: {
|
|
1760
|
+
code: r,
|
|
1761
|
+
message: `Raw temporal ${t.valueKind} value is ${r === "invalid_raw_temporal_value" ? "malformed" : "out of range"}.`
|
|
1762
|
+
}
|
|
1763
|
+
};
|
|
1764
|
+
}
|
|
1765
|
+
function dn(e) {
|
|
1766
|
+
const t = Ct(e.metadata), r = pe(e.format), n = r.presentation.mode === "auto" ? mn(t, r) : un(
|
|
1767
|
+
t,
|
|
1768
|
+
r,
|
|
1769
|
+
r.presentation.dialect,
|
|
1770
|
+
r.presentation.pattern
|
|
1771
|
+
), a = ln(t, r);
|
|
1772
|
+
return (i) => {
|
|
1773
|
+
if (i === null)
|
|
1774
|
+
return { ok: !0, text: "", status: "empty" };
|
|
1775
|
+
const o = an(i, t.valueKind);
|
|
1776
|
+
return o.status === "invalid_shape" ? Ae(i, t, "invalid_raw_temporal_value") : o.status === "out_of_range" ? Ae(i, t, "out_of_range_raw_temporal_value") : {
|
|
1777
|
+
ok: !0,
|
|
1778
|
+
text: n(o),
|
|
1779
|
+
status: "formatted",
|
|
1780
|
+
wallClock: a(o)
|
|
1781
|
+
};
|
|
1782
|
+
};
|
|
1783
|
+
}
|
|
1784
|
+
function fn(e) {
|
|
1785
|
+
return dn({
|
|
1786
|
+
metadata: e.metadata,
|
|
1787
|
+
format: e.format
|
|
1788
|
+
})(e.value);
|
|
1789
|
+
}
|
|
1790
|
+
const yn = {
|
|
1791
|
+
dateStyle: "short",
|
|
1792
|
+
dateTime: { dateStyle: "short", timeStyle: "short" }
|
|
1793
|
+
};
|
|
1794
|
+
class O extends Error {
|
|
1795
|
+
constructor(r, n) {
|
|
1796
|
+
super(n);
|
|
1797
|
+
v(this, "code");
|
|
1798
|
+
this.name = "TemporalBucketContractError", this.code = r;
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
const gn = [
|
|
1802
|
+
"Jan",
|
|
1803
|
+
"Feb",
|
|
1804
|
+
"Mar",
|
|
1805
|
+
"Apr",
|
|
1806
|
+
"May",
|
|
1807
|
+
"Jun",
|
|
1808
|
+
"Jul",
|
|
1809
|
+
"Aug",
|
|
1810
|
+
"Sep",
|
|
1811
|
+
"Oct",
|
|
1812
|
+
"Nov",
|
|
1813
|
+
"Dec"
|
|
1814
|
+
], hn = [
|
|
1815
|
+
"January",
|
|
1816
|
+
"February",
|
|
1817
|
+
"March",
|
|
1818
|
+
"April",
|
|
1819
|
+
"May",
|
|
1820
|
+
"June",
|
|
1821
|
+
"July",
|
|
1822
|
+
"August",
|
|
1823
|
+
"September",
|
|
1824
|
+
"October",
|
|
1825
|
+
"November",
|
|
1826
|
+
"December"
|
|
1827
|
+
];
|
|
1828
|
+
function oe(e) {
|
|
1829
|
+
return {
|
|
1830
|
+
ok: !1,
|
|
1831
|
+
error: { code: "invalid_temporal_bucket_value", message: e }
|
|
1832
|
+
};
|
|
1833
|
+
}
|
|
1834
|
+
function pn(e) {
|
|
1835
|
+
return e % 4 === 0 && (e % 100 !== 0 || e % 400 === 0);
|
|
1836
|
+
}
|
|
1837
|
+
function wn(e, t) {
|
|
1838
|
+
return t === 2 ? pn(e) ? 29 : 28 : [4, 6, 9, 11].includes(t) ? 30 : 31;
|
|
1839
|
+
}
|
|
1840
|
+
function Tn(e, t, r) {
|
|
1841
|
+
const n = [0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4], a = t < 3 ? e - 1 : e;
|
|
1842
|
+
return (a + Math.floor(a / 4) - Math.floor(a / 100) + Math.floor(a / 400) + n[t - 1] + r) % 7;
|
|
1843
|
+
}
|
|
1844
|
+
function X(e) {
|
|
1845
|
+
var t;
|
|
1846
|
+
return (t = e.calendar.fiscalCalendar) == null ? void 0 : t.yearStartMonth;
|
|
1847
|
+
}
|
|
1848
|
+
function Sn(e, t) {
|
|
1849
|
+
return (e - t + 12) % 12 % 3 === 0;
|
|
1850
|
+
}
|
|
1851
|
+
function vn(e, t) {
|
|
1852
|
+
const { granularity: r } = t, n = X(t) ?? 1;
|
|
1853
|
+
switch (r) {
|
|
1854
|
+
case "second":
|
|
1855
|
+
return !0;
|
|
1856
|
+
case "minute":
|
|
1857
|
+
return e.second === 0;
|
|
1858
|
+
case "hour":
|
|
1859
|
+
return e.minute === 0 && e.second === 0;
|
|
1860
|
+
case "day":
|
|
1861
|
+
return !0;
|
|
1862
|
+
case "week":
|
|
1863
|
+
return Tn(e.year, e.month, e.day) === t.calendar.weekStart;
|
|
1864
|
+
case "month":
|
|
1865
|
+
return e.day === 1;
|
|
1866
|
+
case "quarter":
|
|
1867
|
+
return e.day === 1 && Sn(e.month, n);
|
|
1868
|
+
case "year":
|
|
1869
|
+
return e.day === 1 && e.month === n;
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
function ht(e, t) {
|
|
1873
|
+
if (e === null) return { ok: !0, value: null };
|
|
1874
|
+
const r = t.granularity === "second" || t.granularity === "minute" || t.granularity === "hour", n = r ? /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})$/.exec(e) : /^(\d{4})-(\d{2})-(\d{2})$/.exec(e);
|
|
1875
|
+
if (!n)
|
|
1876
|
+
return oe(
|
|
1877
|
+
`Expected ${r ? "YYYY-MM-DDTHH:mm:ss" : "YYYY-MM-DD"} for ${t.granularity} granularity.`
|
|
1878
|
+
);
|
|
1879
|
+
const a = {
|
|
1880
|
+
year: Number(n[1]),
|
|
1881
|
+
month: Number(n[2]),
|
|
1882
|
+
day: Number(n[3]),
|
|
1883
|
+
hour: r ? Number(n[4]) : 0,
|
|
1884
|
+
minute: r ? Number(n[5]) : 0,
|
|
1885
|
+
second: r ? Number(n[6]) : 0
|
|
1886
|
+
};
|
|
1887
|
+
return a.year < 1 || a.month < 1 || a.month > 12 || a.day < 1 || a.day > wn(a.year, a.month) || a.hour > 23 || a.minute > 59 || a.second > 59 ? oe(`Invalid canonical ${t.granularity} bucket value ${e}.`) : vn(a, t) ? { ok: !0, value: a } : oe(
|
|
1888
|
+
`Canonical value ${e} is not aligned to ${t.granularity} granularity and its governed Calendar.`
|
|
1889
|
+
);
|
|
1890
|
+
}
|
|
1891
|
+
function za(e) {
|
|
1892
|
+
const { granularity: t, calendar: r } = e, n = (o, s) => new Intl.DateTimeFormat("en-US", { ...o, timeZone: "UTC" }).format(s), a = [`by ${t} in the ${r.tz} calendar`];
|
|
1893
|
+
t === "week" && a.push(`weeks starting on ${n({ weekday: "long" }, new Date(Date.UTC(2023, 0, 1 + r.weekStart)))}`);
|
|
1894
|
+
const i = X(e);
|
|
1895
|
+
return i && (t === "quarter" || t === "year") && a.push(`the fiscal year starting in ${n({ month: "long" }, new Date(Date.UTC(2e3, i - 1, 1)))}`), `${a.join(", ")}; each value is a bucket's start`;
|
|
1896
|
+
}
|
|
1897
|
+
function pt(e) {
|
|
1898
|
+
if (!g(e))
|
|
1899
|
+
return {
|
|
1900
|
+
ok: !1,
|
|
1901
|
+
issues: [{ path: "$", message: "Resolved temporal bucket format must be an object." }]
|
|
1902
|
+
};
|
|
1903
|
+
const t = [], r = /* @__PURE__ */ new Set(["type", "presentation", "locale"]);
|
|
1904
|
+
for (const o of Object.keys(e))
|
|
1905
|
+
r.has(o) || t.push({ path: o, message: `Unknown property "${o}".` });
|
|
1906
|
+
e.type !== "temporal_bucket" && t.push({ path: "type", message: "Expected temporal_bucket." });
|
|
1907
|
+
const n = e.presentation;
|
|
1908
|
+
if (!g(n))
|
|
1909
|
+
t.push({ path: "presentation", message: "Expected a presentation object." });
|
|
1910
|
+
else {
|
|
1911
|
+
const o = n.mode, s = o === "preset" ? /* @__PURE__ */ new Set(["mode", "preset"]) : o === "pattern" ? /* @__PURE__ */ new Set(["mode", "pattern"]) : o === "auto" ? /* @__PURE__ */ new Set(["mode", "styles"]) : /* @__PURE__ */ new Set(["mode"]);
|
|
1912
|
+
for (const c of Object.keys(n))
|
|
1913
|
+
s.has(c) || t.push({
|
|
1914
|
+
path: `presentation.${c}`,
|
|
1915
|
+
message: `Unknown property "${c}".`
|
|
1916
|
+
});
|
|
1917
|
+
if (o === "preset")
|
|
1918
|
+
Lr(n.preset) || t.push({ path: "presentation.preset", message: "Expected a supported preset." });
|
|
1919
|
+
else if (o === "pattern")
|
|
1920
|
+
if (typeof n.pattern != "string" || !n.pattern)
|
|
1921
|
+
t.push({ path: "presentation.pattern", message: "Expected a non-empty pattern." });
|
|
1922
|
+
else {
|
|
1923
|
+
const c = C(n.pattern);
|
|
1924
|
+
c.ok || t.push({
|
|
1925
|
+
path: "presentation.pattern",
|
|
1926
|
+
message: c.message
|
|
1927
|
+
});
|
|
1928
|
+
}
|
|
1929
|
+
else if (o === "auto") {
|
|
1930
|
+
const c = n.styles;
|
|
1931
|
+
(!g(c) || !["short", "medium", "long"].includes(String(c.dateStyle)) || !g(c.dateTime) || !["short", "medium", "long"].includes(
|
|
1932
|
+
String(c.dateTime.dateStyle)
|
|
1933
|
+
) || !["short", "medium", "long"].includes(
|
|
1934
|
+
String(c.dateTime.timeStyle)
|
|
1935
|
+
) || Object.keys(c).some(
|
|
1936
|
+
(u) => u !== "dateStyle" && u !== "dateTime"
|
|
1937
|
+
) || Object.keys(c.dateTime).some(
|
|
1938
|
+
(u) => u !== "dateStyle" && u !== "timeStyle"
|
|
1939
|
+
)) && t.push({
|
|
1940
|
+
path: "presentation.styles",
|
|
1941
|
+
message: "Expected complete resolved date and datetime styles."
|
|
1942
|
+
});
|
|
1943
|
+
} else
|
|
1944
|
+
t.push({ path: "presentation.mode", message: "Expected auto, preset, or pattern." });
|
|
1945
|
+
}
|
|
1946
|
+
const a = F(e.locale);
|
|
1947
|
+
if (a || t.push({ path: "locale", message: "Expected a supported base BCP 47 locale." }), t.length > 0 || !a || !g(n))
|
|
1948
|
+
return { ok: !1, issues: t };
|
|
1949
|
+
if (n.mode === "auto") {
|
|
1950
|
+
const o = n.styles;
|
|
1951
|
+
return {
|
|
1952
|
+
ok: !0,
|
|
1953
|
+
value: {
|
|
1954
|
+
type: "temporal_bucket",
|
|
1955
|
+
locale: a,
|
|
1956
|
+
presentation: {
|
|
1957
|
+
mode: "auto",
|
|
1958
|
+
styles: {
|
|
1959
|
+
dateStyle: o.dateStyle,
|
|
1960
|
+
dateTime: {
|
|
1961
|
+
dateStyle: o.dateTime.dateStyle,
|
|
1962
|
+
timeStyle: o.dateTime.timeStyle
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
};
|
|
1968
|
+
}
|
|
1969
|
+
return {
|
|
1970
|
+
ok: !0,
|
|
1971
|
+
value: {
|
|
1972
|
+
type: "temporal_bucket",
|
|
1973
|
+
presentation: n.mode === "preset" ? {
|
|
1974
|
+
mode: "preset",
|
|
1975
|
+
preset: n.preset
|
|
1976
|
+
} : {
|
|
1977
|
+
mode: "pattern",
|
|
1978
|
+
pattern: n.pattern
|
|
1979
|
+
},
|
|
1980
|
+
locale: a
|
|
1981
|
+
}
|
|
1982
|
+
};
|
|
1983
|
+
}
|
|
1984
|
+
function xn(e, t) {
|
|
1985
|
+
const r = !!t.calendar.fiscalCalendar;
|
|
1986
|
+
return e === "fiscal_quarter_short" || e === "fiscal_year" ? r : e === "quarter_short" || e === "quarter_long" ? !r : !0;
|
|
1987
|
+
}
|
|
1988
|
+
function wt(e, t) {
|
|
1989
|
+
return ct(e, t.granularity).ok ? e.presentation.mode === "preset" ? xn(e.presentation.preset, t) : !(e.presentation.mode === "pattern" && t.calendar.fiscalCalendar && (t.granularity === "quarter" || t.granularity === "year")) : !1;
|
|
1990
|
+
}
|
|
1991
|
+
function Ye(e, t) {
|
|
1992
|
+
if (!(!e || e.presentation.mode === "auto"))
|
|
1993
|
+
return wt(e, t) ? { type: "temporal_bucket", presentation: e.presentation } : void 0;
|
|
1994
|
+
}
|
|
1995
|
+
function Dn(e) {
|
|
1996
|
+
var a;
|
|
1997
|
+
const t = F(e.locale);
|
|
1998
|
+
if (!t)
|
|
1999
|
+
throw new O(
|
|
2000
|
+
"invalid_temporal_bucket_format",
|
|
2001
|
+
"Temporal bucket locale must be a supported base BCP 47 locale."
|
|
2002
|
+
);
|
|
2003
|
+
const r = Ye(e.cardFormat, e.metadata);
|
|
2004
|
+
if (r)
|
|
2005
|
+
return { format: { ...r, locale: t }, source: "card" };
|
|
2006
|
+
const n = ((a = e.semanticFormat) == null ? void 0 : a.granularity) === e.metadata.granularity ? Ye(e.semanticFormat.format, e.metadata) : void 0;
|
|
2007
|
+
return n ? { format: { ...n, locale: t }, source: "semantic" } : {
|
|
2008
|
+
format: {
|
|
2009
|
+
type: "temporal_bucket",
|
|
2010
|
+
locale: t,
|
|
2011
|
+
presentation: {
|
|
2012
|
+
mode: "auto",
|
|
2013
|
+
styles: e.styles ?? yn
|
|
2014
|
+
}
|
|
2015
|
+
},
|
|
2016
|
+
source: "automatic"
|
|
2017
|
+
};
|
|
2018
|
+
}
|
|
2019
|
+
function x(e, t = 2) {
|
|
2020
|
+
return String(e).padStart(t, "0");
|
|
2021
|
+
}
|
|
2022
|
+
function q(e, t, r) {
|
|
2023
|
+
if (t === "en-US")
|
|
2024
|
+
return (r === "short" ? gn : hn)[e - 1];
|
|
2025
|
+
const n = new Date(Date.UTC(2e3, e - 1, 15));
|
|
2026
|
+
return new Intl.DateTimeFormat(t, {
|
|
2027
|
+
calendar: "gregory",
|
|
2028
|
+
month: r,
|
|
2029
|
+
timeZone: "UTC"
|
|
2030
|
+
}).format(n);
|
|
2031
|
+
}
|
|
2032
|
+
function kn(e, t, r) {
|
|
2033
|
+
return t.map((n) => {
|
|
2034
|
+
if (n.kind === "literal") return n.value;
|
|
2035
|
+
switch (n.value) {
|
|
2036
|
+
case "YYYY":
|
|
2037
|
+
return x(e.year, 4);
|
|
2038
|
+
case "YY":
|
|
2039
|
+
return x(e.year % 100);
|
|
2040
|
+
case "MMMM":
|
|
2041
|
+
return q(e.month, r, "long");
|
|
2042
|
+
case "MMM":
|
|
2043
|
+
return q(e.month, r, "short");
|
|
2044
|
+
case "MM":
|
|
2045
|
+
return x(e.month);
|
|
2046
|
+
case "DD":
|
|
2047
|
+
return x(e.day);
|
|
2048
|
+
case "HH":
|
|
2049
|
+
return x(e.hour);
|
|
2050
|
+
case "mm":
|
|
2051
|
+
return x(e.minute);
|
|
2052
|
+
case "ss":
|
|
2053
|
+
return x(e.second);
|
|
2054
|
+
}
|
|
2055
|
+
}).join("");
|
|
2056
|
+
}
|
|
2057
|
+
const Re = /* @__PURE__ */ new Map();
|
|
2058
|
+
function E(e, t) {
|
|
2059
|
+
const r = `${e}:${JSON.stringify(t)}`, n = Re.get(r);
|
|
2060
|
+
if (n) return n;
|
|
2061
|
+
const a = new Intl.DateTimeFormat(e, t);
|
|
2062
|
+
return Re.set(r, a), a;
|
|
2063
|
+
}
|
|
2064
|
+
function B(e) {
|
|
2065
|
+
const t = /* @__PURE__ */ new Date(0);
|
|
2066
|
+
return t.setUTCFullYear(e.year, e.month - 1, e.day), t.setUTCHours(e.hour, e.minute, e.second, 0), t;
|
|
2067
|
+
}
|
|
2068
|
+
function Oe(e, t, r) {
|
|
2069
|
+
return E(t, {
|
|
2070
|
+
calendar: "gregory",
|
|
2071
|
+
dateStyle: r,
|
|
2072
|
+
timeZone: "UTC"
|
|
2073
|
+
}).format(B(e));
|
|
2074
|
+
}
|
|
2075
|
+
function _n(e, t, r) {
|
|
2076
|
+
return E(t, {
|
|
2077
|
+
calendar: "gregory",
|
|
2078
|
+
dateStyle: r.dateStyle,
|
|
2079
|
+
// Grouped buckets are civil values, not instants. Long time styles would
|
|
2080
|
+
// append a zone label that the canonical value does not semantically own.
|
|
2081
|
+
timeStyle: r.timeStyle === "long" ? "medium" : r.timeStyle,
|
|
2082
|
+
timeZone: "UTC"
|
|
2083
|
+
}).format(B(e));
|
|
2084
|
+
}
|
|
2085
|
+
function bn(e, t, r) {
|
|
2086
|
+
var a;
|
|
2087
|
+
if (r === "short") {
|
|
2088
|
+
const i = B(e), o = E(t, {
|
|
2089
|
+
calendar: "gregory",
|
|
2090
|
+
dateStyle: "short",
|
|
2091
|
+
timeZone: "UTC"
|
|
2092
|
+
}).formatToParts(i), s = o.findIndex((l) => l.type === "month"), c = o.findIndex((l) => l.type === "year"), u = (a = E(t, {
|
|
2093
|
+
calendar: "gregory",
|
|
2094
|
+
timeZone: "UTC",
|
|
2095
|
+
year: "numeric"
|
|
2096
|
+
}).formatToParts(i).find((l) => l.type === "year")) == null ? void 0 : a.value;
|
|
2097
|
+
if (s >= 0 && c >= 0 && u) {
|
|
2098
|
+
const l = Math.min(s, c), d = Math.max(s, c);
|
|
2099
|
+
let y = !1;
|
|
2100
|
+
return o.slice(l, d + 1).filter((w) => w.type === "day" ? (y = !0, !1) : y && w.type === "literal" ? (y = !1, !1) : !0).map((w) => w.type === "year" ? u : w.value).join("");
|
|
2101
|
+
}
|
|
2102
|
+
}
|
|
2103
|
+
return E(t, {
|
|
2104
|
+
calendar: "gregory",
|
|
2105
|
+
month: r === "short" ? "numeric" : r === "medium" ? "short" : "long",
|
|
2106
|
+
timeZone: "UTC",
|
|
2107
|
+
year: "numeric"
|
|
2108
|
+
}).format(B(e));
|
|
2109
|
+
}
|
|
2110
|
+
function Nn(e, t) {
|
|
2111
|
+
return Math.floor((e.month - t + 12) % 12 / 3) + 1;
|
|
2112
|
+
}
|
|
2113
|
+
function Pe(e, t) {
|
|
2114
|
+
return t === 1 || e.month < t ? e.year : e.year + 1;
|
|
2115
|
+
}
|
|
2116
|
+
function Mn(e) {
|
|
2117
|
+
return e === 1 ? "1st" : e === 2 ? "2nd" : e === 3 ? "3rd" : `${e}th`;
|
|
2118
|
+
}
|
|
2119
|
+
function fe(e, t, r, n) {
|
|
2120
|
+
const a = X(n) ?? 1, i = Nn(e, a);
|
|
2121
|
+
switch (t) {
|
|
2122
|
+
case "week_of_short":
|
|
2123
|
+
return `Week of ${q(e.month, r, "short")} ${e.day}, ${e.year}`;
|
|
2124
|
+
case "week_of_long":
|
|
2125
|
+
return `Week of ${q(e.month, r, "long")} ${e.day}, ${e.year}`;
|
|
2126
|
+
case "quarter_short":
|
|
2127
|
+
return `Q${i} ${e.year}`;
|
|
2128
|
+
case "quarter_long":
|
|
2129
|
+
return `${Mn(i)} Quarter ${e.year}`;
|
|
2130
|
+
case "fiscal_quarter_short":
|
|
2131
|
+
return `Q${i} FY${Pe(e, a)}`;
|
|
2132
|
+
case "fiscal_year":
|
|
2133
|
+
return `FY${Pe(e, a)}`;
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2136
|
+
function $n(e, t, r, n) {
|
|
2137
|
+
const a = X(t);
|
|
2138
|
+
switch (t.granularity) {
|
|
2139
|
+
case "second":
|
|
2140
|
+
case "minute":
|
|
2141
|
+
case "hour":
|
|
2142
|
+
return _n(e, r, n.dateTime);
|
|
2143
|
+
case "day":
|
|
2144
|
+
return Oe(e, r, n.dateStyle);
|
|
2145
|
+
case "week":
|
|
2146
|
+
return `Week of ${Oe(e, r, n.dateStyle)}`;
|
|
2147
|
+
case "month":
|
|
2148
|
+
return bn(e, r, n.dateStyle);
|
|
2149
|
+
case "quarter":
|
|
2150
|
+
return fe(
|
|
2151
|
+
e,
|
|
2152
|
+
a ? "fiscal_quarter_short" : "quarter_short",
|
|
2153
|
+
r,
|
|
2154
|
+
t
|
|
2155
|
+
);
|
|
2156
|
+
case "year":
|
|
2157
|
+
return a ? fe(e, "fiscal_year", r, t) : String(e.year);
|
|
2158
|
+
}
|
|
2159
|
+
}
|
|
2160
|
+
function Aa(e, t) {
|
|
2161
|
+
if (t.granularity !== "second" && t.granularity !== "minute" && t.granularity !== "hour" && t.granularity !== "day" && t.granularity !== "month")
|
|
2162
|
+
return;
|
|
2163
|
+
const r = ht(e, t);
|
|
2164
|
+
if (!r.ok || r.value === null) return;
|
|
2165
|
+
const { year: n, month: a, day: i, hour: o, minute: s, second: c } = r.value;
|
|
2166
|
+
return { year: n, month: a, day: i, hour: o, minute: s, second: c };
|
|
2167
|
+
}
|
|
2168
|
+
function In(e) {
|
|
2169
|
+
const t = pt(e.format);
|
|
2170
|
+
if (!t.ok || !wt(t.value, e.metadata))
|
|
2171
|
+
throw new O(
|
|
2172
|
+
"invalid_temporal_bucket_format",
|
|
2173
|
+
"Resolved temporal bucket format is invalid or inapplicable to its metadata."
|
|
2174
|
+
);
|
|
2175
|
+
const r = ht(e.value, e.metadata);
|
|
2176
|
+
if (!r.ok)
|
|
2177
|
+
throw new O(
|
|
2178
|
+
r.error.code,
|
|
2179
|
+
r.error.message
|
|
2180
|
+
);
|
|
2181
|
+
if (r.value === null) return "(Blank)";
|
|
2182
|
+
const { presentation: n, locale: a } = t.value;
|
|
2183
|
+
if (n.mode === "auto")
|
|
2184
|
+
return $n(
|
|
2185
|
+
r.value,
|
|
2186
|
+
e.metadata,
|
|
2187
|
+
a,
|
|
2188
|
+
n.styles
|
|
2189
|
+
);
|
|
2190
|
+
if (n.mode === "preset")
|
|
2191
|
+
return fe(
|
|
2192
|
+
r.value,
|
|
2193
|
+
n.preset,
|
|
2194
|
+
a,
|
|
2195
|
+
e.metadata
|
|
2196
|
+
);
|
|
2197
|
+
const i = C(n.pattern);
|
|
2198
|
+
if (!i.ok)
|
|
2199
|
+
throw new O(
|
|
2200
|
+
"invalid_temporal_bucket_format",
|
|
2201
|
+
i.message
|
|
2202
|
+
);
|
|
2203
|
+
return kn(r.value, i.segments, a);
|
|
2204
|
+
}
|
|
2205
|
+
function Ya(e, t) {
|
|
2206
|
+
return t.levelLabels[e.id] ?? e.field.label ?? e.field.name;
|
|
2207
|
+
}
|
|
2208
|
+
function Ra(e, t) {
|
|
2209
|
+
return t.measureLabels[e.id] ?? (e.kind === "aggregate" ? e.field.label ?? e.field.name : e.definition.label);
|
|
2210
|
+
}
|
|
2211
|
+
function Oa(e) {
|
|
2212
|
+
return It.parse(En(e));
|
|
2213
|
+
}
|
|
2214
|
+
function En(e) {
|
|
2215
|
+
const t = Nt.parse(e), r = (n) => ({
|
|
2216
|
+
grand: { visible: !0, position: "after" },
|
|
2217
|
+
levels: Object.fromEntries(
|
|
2218
|
+
n.map((a) => [
|
|
2219
|
+
a.id,
|
|
2220
|
+
{ visible: !0, position: "before" }
|
|
2221
|
+
])
|
|
2222
|
+
)
|
|
2223
|
+
});
|
|
2224
|
+
return Mt.parse({
|
|
2225
|
+
version: 1,
|
|
2226
|
+
spec: t,
|
|
2227
|
+
presentation: {
|
|
2228
|
+
layout: { kind: "compact" },
|
|
2229
|
+
absence: { emptyText: "—", nullText: "" },
|
|
2230
|
+
levelLabels: {},
|
|
2231
|
+
measureLabels: {},
|
|
2232
|
+
levelFormats: {},
|
|
2233
|
+
measureFormats: {},
|
|
2234
|
+
totals: { rows: r(t.rows), columns: r(t.columns) }
|
|
2235
|
+
},
|
|
2236
|
+
defaultView: {
|
|
2237
|
+
rows: { depth: 0, overrides: [] },
|
|
2238
|
+
columns: { depth: t.columns.length > 1 ? 1 : 0, overrides: [] }
|
|
2239
|
+
}
|
|
2240
|
+
});
|
|
2241
|
+
}
|
|
2242
|
+
function Fn(e, t) {
|
|
2243
|
+
const r = new Map(e.map((n) => [I(n), n]));
|
|
2244
|
+
for (const n of t ?? []) r.set(I(n), n);
|
|
2245
|
+
return [...r.values()];
|
|
2246
|
+
}
|
|
2247
|
+
function Pa(e) {
|
|
2248
|
+
const { spec: t, presentation: r, defaults: n, session: a } = $t.parse(e), i = new Map(
|
|
2249
|
+
Fn(t.sorts, a == null ? void 0 : a.sorts).map((s) => [I(s), s])
|
|
2250
|
+
);
|
|
2251
|
+
for (const s of ["rows", "columns"])
|
|
2252
|
+
for (const c of t[s]) {
|
|
2253
|
+
const u = {
|
|
2254
|
+
axis: s,
|
|
2255
|
+
levelId: c.id,
|
|
2256
|
+
scope: { kind: "level" },
|
|
2257
|
+
target: { kind: "member" },
|
|
2258
|
+
direction: "asc",
|
|
2259
|
+
nulls: "last"
|
|
2260
|
+
};
|
|
2261
|
+
i.has(I(u)) || i.set(I(u), u);
|
|
2262
|
+
}
|
|
2263
|
+
const o = (s, c) => ({
|
|
2264
|
+
depth: Math.min(s.depth, Math.max(0, c - 1)),
|
|
2265
|
+
// Leaf toggles are valid but have no effect. Collapsed ancestors retain dormant overrides.
|
|
2266
|
+
overrides: s.overrides.filter(
|
|
2267
|
+
(u) => u.path.length < c
|
|
2268
|
+
)
|
|
2269
|
+
});
|
|
2270
|
+
return {
|
|
2271
|
+
spec: { ...t, sorts: [...i.values()] },
|
|
2272
|
+
presentation: r,
|
|
2273
|
+
view: {
|
|
2274
|
+
rows: o((a == null ? void 0 : a.rows) ?? n.rows, t.rows.length),
|
|
2275
|
+
columns: o(
|
|
2276
|
+
(a == null ? void 0 : a.columns) ?? n.columns,
|
|
2277
|
+
t.columns.length
|
|
2278
|
+
),
|
|
2279
|
+
sorts: (a == null ? void 0 : a.sorts) ?? []
|
|
2280
|
+
}
|
|
2281
|
+
};
|
|
2282
|
+
}
|
|
2283
|
+
class Le extends Error {
|
|
2284
|
+
constructor(r) {
|
|
2285
|
+
super(
|
|
2286
|
+
`invalid_presentation_execution_snapshot: ${r} Resave this report before running it again.`
|
|
2287
|
+
);
|
|
2288
|
+
v(this, "code", "invalid_presentation_execution_snapshot");
|
|
2289
|
+
v(this, "deliveryBlocking", !0);
|
|
2290
|
+
this.name = "PresentationExecutionSnapshotError";
|
|
2291
|
+
}
|
|
2292
|
+
}
|
|
2293
|
+
class La extends Error {
|
|
2294
|
+
constructor(r) {
|
|
2295
|
+
super(
|
|
2296
|
+
`missing_resolved_raw_temporal_format: Column "${r}" has no captured presentation. Resave this report before running it again.`
|
|
2297
|
+
);
|
|
2298
|
+
v(this, "code", "missing_resolved_raw_temporal_format");
|
|
2299
|
+
v(this, "deliveryBlocking", !0);
|
|
2300
|
+
this.name = "MissingResolvedRawTemporalFormatError";
|
|
2301
|
+
}
|
|
2302
|
+
}
|
|
2303
|
+
function D(e, t, r) {
|
|
2304
|
+
const n = new Set(t), a = Object.keys(e).find((i) => !n.has(i));
|
|
2305
|
+
if (a)
|
|
2306
|
+
throw new Error(`${r} contains unknown property "${a}"`);
|
|
2307
|
+
}
|
|
2308
|
+
function Cn(e, t = "scope") {
|
|
2309
|
+
if (!g(e))
|
|
2310
|
+
throw new Error(`${t} must be an object`);
|
|
2311
|
+
D(
|
|
2312
|
+
e,
|
|
2313
|
+
["dashboardId", "cardId", "attachmentIndex"],
|
|
2314
|
+
t
|
|
2315
|
+
);
|
|
2316
|
+
const r = typeof e.dashboardId == "string" ? e.dashboardId.trim() : "";
|
|
2317
|
+
if (!r)
|
|
2318
|
+
throw new Error(`${t}.dashboardId is required`);
|
|
2319
|
+
const n = typeof e.cardId == "string" ? e.cardId.trim() : void 0;
|
|
2320
|
+
if (e.cardId !== void 0 && !n)
|
|
2321
|
+
throw new Error(`${t}.cardId must be a non-empty string`);
|
|
2322
|
+
const a = e.attachmentIndex;
|
|
2323
|
+
if (a !== void 0 && (typeof a != "number" || !Number.isInteger(a) || a < 0))
|
|
2324
|
+
throw new Error(
|
|
2325
|
+
`${t}.attachmentIndex must be a non-negative integer`
|
|
2326
|
+
);
|
|
2327
|
+
return {
|
|
2328
|
+
dashboardId: r,
|
|
2329
|
+
...n ? { cardId: n } : {},
|
|
2330
|
+
...typeof a == "number" ? { attachmentIndex: a } : {}
|
|
2331
|
+
};
|
|
2332
|
+
}
|
|
2333
|
+
function _(e, t, r, n) {
|
|
2334
|
+
if (e.kind !== t) return;
|
|
2335
|
+
D(e, ["kind", r], n);
|
|
2336
|
+
const a = e[r];
|
|
2337
|
+
if (typeof a != "string" || !a.trim())
|
|
2338
|
+
throw new Error(`${n}.${r} is required`);
|
|
2339
|
+
return a;
|
|
2340
|
+
}
|
|
2341
|
+
function se(e, t) {
|
|
2342
|
+
if (!g(e))
|
|
2343
|
+
throw new Error(`${t} must be an object`);
|
|
2344
|
+
const r = _(e, "metric", "metricId", t);
|
|
2345
|
+
if (r) return { kind: "metric", metricId: r };
|
|
2346
|
+
const n = _(e, "column", "columnKey", t);
|
|
2347
|
+
if (n) return { kind: "column", columnKey: n };
|
|
2348
|
+
const a = _(
|
|
2349
|
+
e,
|
|
2350
|
+
"matrix_measure",
|
|
2351
|
+
"measureId",
|
|
2352
|
+
t
|
|
2353
|
+
);
|
|
2354
|
+
if (a) return { kind: "matrix_measure", measureId: a };
|
|
2355
|
+
throw new Error(`${t} is not a valid numeric presentation target`);
|
|
2356
|
+
}
|
|
2357
|
+
const Un = [
|
|
2358
|
+
"type",
|
|
2359
|
+
"inputUnit",
|
|
2360
|
+
"outputStyle",
|
|
2361
|
+
"largestUnit",
|
|
2362
|
+
"smallestUnit",
|
|
2363
|
+
"maxUnits",
|
|
2364
|
+
"prefix",
|
|
2365
|
+
"suffix",
|
|
2366
|
+
"negativeStyle"
|
|
2367
|
+
];
|
|
2368
|
+
function zn(e) {
|
|
2369
|
+
return e === "millisecond" || e === "second" || e === "minute" || e === "hour" || e === "day";
|
|
2370
|
+
}
|
|
2371
|
+
const An = ["type", "locale", "pattern", "timezone", "sourceTimezone"];
|
|
2372
|
+
function Yn(e, t) {
|
|
2373
|
+
if (D(e, An, t), typeof e.locale != "string" || !e.locale.trim())
|
|
2374
|
+
throw new Error(`${t}.locale must be a non-empty string`);
|
|
2375
|
+
for (const r of ["pattern", "timezone", "sourceTimezone"])
|
|
2376
|
+
if (e[r] !== void 0 && typeof e[r] != "string")
|
|
2377
|
+
throw new Error(`${t}.${r} must be a string`);
|
|
2378
|
+
return {
|
|
2379
|
+
type: "date",
|
|
2380
|
+
locale: e.locale,
|
|
2381
|
+
...typeof e.pattern == "string" ? { pattern: e.pattern } : {},
|
|
2382
|
+
...typeof e.timezone == "string" ? { timezone: e.timezone } : {},
|
|
2383
|
+
...typeof e.sourceTimezone == "string" ? { sourceTimezone: e.sourceTimezone } : {}
|
|
2384
|
+
};
|
|
2385
|
+
}
|
|
2386
|
+
function Rn(e, t) {
|
|
2387
|
+
D(e, Un, t);
|
|
2388
|
+
for (const i of ["inputUnit", "largestUnit", "smallestUnit"])
|
|
2389
|
+
if (e[i] !== void 0 && !zn(e[i]))
|
|
2390
|
+
throw new Error(`${t}.${i} must be a duration unit`);
|
|
2391
|
+
const r = e.outputStyle;
|
|
2392
|
+
if (r !== void 0 && r !== "compact" && r !== "digital" && r !== "long")
|
|
2393
|
+
throw new Error(`${t}.outputStyle must be compact, digital, or long`);
|
|
2394
|
+
const n = e.maxUnits;
|
|
2395
|
+
if (n !== void 0 && (typeof n != "number" || !Number.isInteger(n) || n < 0 || n > 10))
|
|
2396
|
+
throw new Error(`${t}.maxUnits must be an integer from 0 to 10`);
|
|
2397
|
+
for (const i of ["prefix", "suffix"])
|
|
2398
|
+
if (e[i] !== void 0 && typeof e[i] != "string")
|
|
2399
|
+
throw new Error(`${t}.${i} must be a string`);
|
|
2400
|
+
const a = e.negativeStyle;
|
|
2401
|
+
if (a !== void 0 && a !== "minus" && a !== "parentheses")
|
|
2402
|
+
throw new Error(`${t}.negativeStyle must be minus or parentheses`);
|
|
2403
|
+
return {
|
|
2404
|
+
type: "duration",
|
|
2405
|
+
...e.inputUnit !== void 0 ? { inputUnit: e.inputUnit } : {},
|
|
2406
|
+
...r !== void 0 ? { outputStyle: r } : {},
|
|
2407
|
+
...e.largestUnit !== void 0 ? { largestUnit: e.largestUnit } : {},
|
|
2408
|
+
...e.smallestUnit !== void 0 ? { smallestUnit: e.smallestUnit } : {},
|
|
2409
|
+
...n !== void 0 ? { maxUnits: n } : {},
|
|
2410
|
+
...e.prefix !== void 0 ? { prefix: e.prefix } : {},
|
|
2411
|
+
...e.suffix !== void 0 ? { suffix: e.suffix } : {},
|
|
2412
|
+
...a !== void 0 ? { negativeStyle: a } : {}
|
|
2413
|
+
};
|
|
2414
|
+
}
|
|
2415
|
+
function On(e, t) {
|
|
2416
|
+
if (!g(e))
|
|
2417
|
+
throw new Error(`${t} must be an object`);
|
|
2418
|
+
if (e.kind === "field") {
|
|
2419
|
+
D(e, ["kind", "fieldId", "role"], t);
|
|
2420
|
+
const a = typeof e.fieldId == "string" ? e.fieldId.trim() : "";
|
|
2421
|
+
if (!a)
|
|
2422
|
+
throw new Error(`${t}.fieldId is required`);
|
|
2423
|
+
const i = e.role;
|
|
2424
|
+
if (i !== void 0 && i !== "groupby" && i !== "pivotby")
|
|
2425
|
+
throw new Error(`${t}.role must be groupby or pivotby`);
|
|
2426
|
+
return {
|
|
2427
|
+
kind: "field",
|
|
2428
|
+
fieldId: a,
|
|
2429
|
+
...i ? { role: i } : {}
|
|
2430
|
+
};
|
|
2431
|
+
}
|
|
2432
|
+
const r = _(e, "column", "columnKey", t);
|
|
2433
|
+
if (r) return { kind: "column", columnKey: r };
|
|
2434
|
+
const n = _(
|
|
2435
|
+
e,
|
|
2436
|
+
"matrix_axis",
|
|
2437
|
+
"axisInstanceId",
|
|
2438
|
+
t
|
|
2439
|
+
);
|
|
2440
|
+
if (n) return { kind: "matrix_axis", axisInstanceId: n };
|
|
2441
|
+
throw new Error(`${t} is not a valid temporal bucket presentation target`);
|
|
2442
|
+
}
|
|
2443
|
+
function Pn(e, t) {
|
|
2444
|
+
if (!g(e))
|
|
2445
|
+
throw new Error(`${t} must be an object`);
|
|
2446
|
+
const r = _(e, "column", "columnKey", t);
|
|
2447
|
+
if (!r)
|
|
2448
|
+
throw new Error(`${t} must identify a column`);
|
|
2449
|
+
return { kind: "column", columnKey: r };
|
|
2450
|
+
}
|
|
2451
|
+
function Ln(e) {
|
|
2452
|
+
return [
|
|
2453
|
+
e.dashboardId,
|
|
2454
|
+
e.cardId ?? null,
|
|
2455
|
+
e.attachmentIndex ?? null
|
|
2456
|
+
];
|
|
2457
|
+
}
|
|
2458
|
+
function V(e) {
|
|
2459
|
+
switch (e.kind) {
|
|
2460
|
+
case "metric":
|
|
2461
|
+
return [e.kind, e.metricId];
|
|
2462
|
+
case "column":
|
|
2463
|
+
return [e.kind, e.columnKey];
|
|
2464
|
+
case "matrix_measure":
|
|
2465
|
+
return [e.kind, e.measureId];
|
|
2466
|
+
case "field":
|
|
2467
|
+
return [e.kind, e.fieldId, e.role ?? ""];
|
|
2468
|
+
case "matrix_axis":
|
|
2469
|
+
return [e.kind, e.axisInstanceId];
|
|
2470
|
+
}
|
|
2471
|
+
}
|
|
2472
|
+
function J(e, t) {
|
|
2473
|
+
return e.dashboardId === t.dashboardId && e.cardId === t.cardId && e.attachmentIndex === t.attachmentIndex;
|
|
2474
|
+
}
|
|
2475
|
+
function Q(e, t) {
|
|
2476
|
+
const r = V(e), n = V(t);
|
|
2477
|
+
return r.length === n.length && r.every((a, i) => a === n[i]);
|
|
2478
|
+
}
|
|
2479
|
+
function jn(e) {
|
|
2480
|
+
if (!Array.isArray(e))
|
|
2481
|
+
throw new Error("resolvedFormats must be an array");
|
|
2482
|
+
const t = /* @__PURE__ */ new Set();
|
|
2483
|
+
return e.map((r, n) => {
|
|
2484
|
+
var c, u;
|
|
2485
|
+
const a = `resolvedFormats.${n}`;
|
|
2486
|
+
if (!g(r))
|
|
2487
|
+
throw new Error(`${a} must be an object`);
|
|
2488
|
+
D(r, ["scope", "target", "format"], a);
|
|
2489
|
+
const i = Cn(r.scope, `${a}.scope`);
|
|
2490
|
+
if (!g(r.format))
|
|
2491
|
+
throw new Error(`${a}.format must be an object`);
|
|
2492
|
+
let o;
|
|
2493
|
+
switch (r.format.type) {
|
|
2494
|
+
case "temporal_bucket": {
|
|
2495
|
+
const l = pt(r.format);
|
|
2496
|
+
if (!l.ok)
|
|
2497
|
+
throw new Error(
|
|
2498
|
+
`${a}.format is invalid: ${((c = l.issues[0]) == null ? void 0 : c.message) ?? "invalid value"}`
|
|
2499
|
+
);
|
|
2500
|
+
o = {
|
|
2501
|
+
scope: i,
|
|
2502
|
+
target: On(r.target, `${a}.target`),
|
|
2503
|
+
format: l.value
|
|
2504
|
+
};
|
|
2505
|
+
break;
|
|
2506
|
+
}
|
|
2507
|
+
case "raw_temporal":
|
|
2508
|
+
o = {
|
|
2509
|
+
scope: i,
|
|
2510
|
+
target: Pn(r.target, `${a}.target`),
|
|
2511
|
+
format: pe(r.format)
|
|
2512
|
+
};
|
|
2513
|
+
break;
|
|
2514
|
+
case "number":
|
|
2515
|
+
case "currency":
|
|
2516
|
+
case "percent":
|
|
2517
|
+
case "scientific": {
|
|
2518
|
+
const l = Ar(r.format);
|
|
2519
|
+
if (!l.ok)
|
|
2520
|
+
throw new Error(
|
|
2521
|
+
`${a}.format is invalid: ${((u = l.issues[0]) == null ? void 0 : u.message) ?? "invalid value"}`
|
|
2522
|
+
);
|
|
2523
|
+
o = {
|
|
2524
|
+
scope: i,
|
|
2525
|
+
target: se(r.target, `${a}.target`),
|
|
2526
|
+
format: l.value
|
|
2527
|
+
};
|
|
2528
|
+
break;
|
|
2529
|
+
}
|
|
2530
|
+
case "date": {
|
|
2531
|
+
const l = se(r.target, `${a}.target`);
|
|
2532
|
+
if (l.kind !== "column")
|
|
2533
|
+
throw new Error(`${a}.target must identify a column for a date format`);
|
|
2534
|
+
o = {
|
|
2535
|
+
scope: i,
|
|
2536
|
+
target: l,
|
|
2537
|
+
format: Yn(r.format, `${a}.format`)
|
|
2538
|
+
};
|
|
2539
|
+
break;
|
|
2540
|
+
}
|
|
2541
|
+
case "duration":
|
|
2542
|
+
o = {
|
|
2543
|
+
scope: i,
|
|
2544
|
+
target: se(r.target, `${a}.target`),
|
|
2545
|
+
format: Rn(
|
|
2546
|
+
r.format,
|
|
2547
|
+
`${a}.format`
|
|
2548
|
+
)
|
|
2549
|
+
};
|
|
2550
|
+
break;
|
|
2551
|
+
default:
|
|
2552
|
+
throw new Error(`${a}.format.type is unsupported`);
|
|
2553
|
+
}
|
|
2554
|
+
const s = JSON.stringify([
|
|
2555
|
+
...Ln(o.scope),
|
|
2556
|
+
...V(o.target)
|
|
2557
|
+
]);
|
|
2558
|
+
if (t.has(s))
|
|
2559
|
+
throw new Error(
|
|
2560
|
+
`${a} duplicates a scoped presentation target`
|
|
2561
|
+
);
|
|
2562
|
+
return t.add(s), o;
|
|
2563
|
+
});
|
|
2564
|
+
}
|
|
2565
|
+
function Kn(e) {
|
|
2566
|
+
try {
|
|
2567
|
+
if (!g(e))
|
|
2568
|
+
throw new Error("presentation execution snapshot must be an object");
|
|
2569
|
+
if (D(
|
|
2570
|
+
e,
|
|
2571
|
+
["version", "reportContext", "resolvedFormats"],
|
|
2572
|
+
"presentation execution snapshot"
|
|
2573
|
+
), e.version !== 1)
|
|
2574
|
+
throw new Error("presentation execution snapshot version must be 1");
|
|
2575
|
+
const t = Et(e.reportContext);
|
|
2576
|
+
if (!t.ok) {
|
|
2577
|
+
const r = t.issues[0];
|
|
2578
|
+
throw new Error(
|
|
2579
|
+
`presentation execution snapshot reportContext is invalid: ${r != null && r.path && r.path !== "$" ? `${r.path}: ` : ""}${(r == null ? void 0 : r.message) ?? "invalid value"}`
|
|
2580
|
+
);
|
|
2581
|
+
}
|
|
2582
|
+
return {
|
|
2583
|
+
version: 1,
|
|
2584
|
+
reportContext: t.value,
|
|
2585
|
+
resolvedFormats: jn(e.resolvedFormats)
|
|
2586
|
+
};
|
|
2587
|
+
} catch (t) {
|
|
2588
|
+
throw t instanceof Le ? t : new Le(
|
|
2589
|
+
t instanceof Error ? t.message : "Snapshot is invalid."
|
|
2590
|
+
);
|
|
2591
|
+
}
|
|
2592
|
+
}
|
|
2593
|
+
function ja(e) {
|
|
2594
|
+
return Kn({
|
|
2595
|
+
version: 1,
|
|
2596
|
+
reportContext: e.reportContext,
|
|
2597
|
+
resolvedFormats: [...e.resolvedFormats]
|
|
2598
|
+
});
|
|
2599
|
+
}
|
|
2600
|
+
function Ka(e) {
|
|
2601
|
+
const t = Hn(e);
|
|
2602
|
+
return Ze(t) ? t : void 0;
|
|
2603
|
+
}
|
|
2604
|
+
function Hn(e) {
|
|
2605
|
+
const t = e.snapshot.resolvedFormats.find(
|
|
2606
|
+
(r) => r.format.type !== "temporal_bucket" && r.format.type !== "raw_temporal" && r.format.type !== "date" && J(r.scope, e.scope) && Q(r.target, e.target)
|
|
2607
|
+
);
|
|
2608
|
+
return t == null ? void 0 : t.format;
|
|
2609
|
+
}
|
|
2610
|
+
function Ha(e) {
|
|
2611
|
+
const t = e.snapshot.resolvedFormats.find(
|
|
2612
|
+
(r) => r.format.type === "date" && J(r.scope, e.scope) && Q(r.target, e.target)
|
|
2613
|
+
);
|
|
2614
|
+
return t == null ? void 0 : t.format;
|
|
2615
|
+
}
|
|
2616
|
+
function Za(e) {
|
|
2617
|
+
const t = e.snapshot.resolvedFormats.find(
|
|
2618
|
+
(r) => r.format.type === "raw_temporal" && J(r.scope, e.scope) && Q(r.target, e.target)
|
|
2619
|
+
);
|
|
2620
|
+
return t == null ? void 0 : t.format;
|
|
2621
|
+
}
|
|
2622
|
+
function qa(e) {
|
|
2623
|
+
const t = e.snapshot.resolvedFormats.find(
|
|
2624
|
+
(r) => r.format.type === "temporal_bucket" && J(r.scope, e.scope) && Q(r.target, e.target)
|
|
2625
|
+
);
|
|
2626
|
+
return t == null ? void 0 : t.format;
|
|
2627
|
+
}
|
|
2628
|
+
function Ba(e) {
|
|
2629
|
+
var a;
|
|
2630
|
+
const t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
2631
|
+
if (e.snapshot.resolvedFormats.forEach((i, o) => {
|
|
2632
|
+
if (i.scope.attachmentIndex !== void 0)
|
|
2633
|
+
throw new Error(
|
|
2634
|
+
`resolvedFormats.${o}.scope.attachmentIndex is not valid for a card export`
|
|
2635
|
+
);
|
|
2636
|
+
if (i.scope.dashboardId !== e.expectedScope.dashboardId || i.scope.cardId !== e.expectedScope.cardId)
|
|
2637
|
+
throw new Error(
|
|
2638
|
+
`resolvedFormats.${o}.scope must match the executing dashboard/card`
|
|
2639
|
+
);
|
|
2640
|
+
if (i.target.kind === "field" && i.format.type === "temporal_bucket") {
|
|
2641
|
+
const s = JSON.stringify(V(i.target));
|
|
2642
|
+
if (r.has(s))
|
|
2643
|
+
throw new Error(
|
|
2644
|
+
`resolvedFormats.${o} duplicates export field "${i.target.fieldId}"`
|
|
2645
|
+
);
|
|
2646
|
+
r.add(s);
|
|
2647
|
+
return;
|
|
2648
|
+
}
|
|
2649
|
+
if (i.target.kind !== "column")
|
|
2650
|
+
throw new Error(
|
|
2651
|
+
`resolvedFormats.${o}.target must identify an export column or temporal pivot field`
|
|
2652
|
+
);
|
|
2653
|
+
if (t.has(i.target.columnKey))
|
|
2654
|
+
throw new Error(
|
|
2655
|
+
`resolvedFormats.${o} duplicates export column "${i.target.columnKey}"`
|
|
2656
|
+
);
|
|
2657
|
+
t.add(i.target.columnKey);
|
|
2658
|
+
}), !e.useFormattedValues) return;
|
|
2659
|
+
if (!((a = e.visibleColumns) != null && a.length))
|
|
2660
|
+
throw new Error("visibleColumns must identify every formatted export column");
|
|
2661
|
+
const n = e.visibleColumns.find(
|
|
2662
|
+
(i) => !t.has(i)
|
|
2663
|
+
);
|
|
2664
|
+
if (n)
|
|
2665
|
+
throw new Error(
|
|
2666
|
+
`resolvedFormats is missing visible export column "${n}"`
|
|
2667
|
+
);
|
|
2668
|
+
}
|
|
2669
|
+
const Zn = /* @__PURE__ */ new Set(["short", "medium", "long"]), qn = /^(\d{4})-(\d{2})-(\d{2})$/, Bn = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,9})?)?$/, Vn = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,9})?)?(?:Z|[+-]\d{2}:\d{2})$/, Te = " – ";
|
|
2670
|
+
function Va(e) {
|
|
2671
|
+
if (!g(e)) return;
|
|
2672
|
+
const t = Object.keys(e);
|
|
2673
|
+
if (e.mode === "period_label" && t.length === 1)
|
|
2674
|
+
return { mode: "period_label" };
|
|
2675
|
+
if (e.mode === "style" && t.length === 2 && typeof e.dateStyle == "string" && Zn.has(e.dateStyle))
|
|
2676
|
+
return { mode: "style", dateStyle: e.dateStyle };
|
|
2677
|
+
if (e.mode === "pattern" && t.length === 3 && e.dialect === "semaphor_tokens" && typeof e.pattern == "string" && Gn(e.pattern) === null)
|
|
2678
|
+
return {
|
|
2679
|
+
mode: "pattern",
|
|
2680
|
+
dialect: "semaphor_tokens",
|
|
2681
|
+
pattern: e.pattern
|
|
2682
|
+
};
|
|
2683
|
+
}
|
|
2684
|
+
function Gn(e) {
|
|
2685
|
+
try {
|
|
2686
|
+
return cn({ dialect: "semaphor_tokens", pattern: e }), null;
|
|
2687
|
+
} catch (t) {
|
|
2688
|
+
return t instanceof Error ? t.message : "The pattern is invalid.";
|
|
2689
|
+
}
|
|
2690
|
+
}
|
|
2691
|
+
function Ga(e) {
|
|
2692
|
+
const { value: t, part: r, presentation: n, preferences: a, calendar: i } = e;
|
|
2693
|
+
if ((n == null ? void 0 : n.mode) === "period_label" && t.periodLabel && r === "range")
|
|
2694
|
+
return { ok: !0, text: t.periodLabel };
|
|
2695
|
+
const [o, s] = t.bounds, u = s === void 0 || r === "start" ? [{ raw: o, role: "start" }] : r === "end" ? [{ raw: s, role: "end" }] : [
|
|
2696
|
+
{ raw: o, role: "start" },
|
|
2697
|
+
{ raw: s, role: "end" }
|
|
2698
|
+
], l = u.map(({ raw: h }) => Qn(h, i.tz));
|
|
2699
|
+
if (l.some((h) => h === null))
|
|
2700
|
+
return {
|
|
2701
|
+
ok: !1,
|
|
2702
|
+
text: u.map(({ raw: h }) => h).join(Te),
|
|
2703
|
+
diagnostic: {
|
|
2704
|
+
code: "invalid_temporal_input_value",
|
|
2705
|
+
message: "A date input bound is not a date or an instant."
|
|
2706
|
+
}
|
|
2707
|
+
};
|
|
2708
|
+
const d = t.precision === "day" ? l.map(
|
|
2709
|
+
(h, Dt) => ta(h, u[Dt].role, i.tz)
|
|
2710
|
+
) : [], y = d.length > 0 && d.every((h) => h !== null) ? d : null;
|
|
2711
|
+
return { ok: !0, text: y ? Wn(y, n, a, i) : Xn(
|
|
2712
|
+
l.map((h) => ea(h, i.tz)),
|
|
2713
|
+
n,
|
|
2714
|
+
a,
|
|
2715
|
+
i
|
|
2716
|
+
) };
|
|
2717
|
+
}
|
|
2718
|
+
function Wn(e, t, r, n) {
|
|
2719
|
+
const [a, i = a] = e;
|
|
2720
|
+
if ((t == null ? void 0 : t.mode) === "pattern")
|
|
2721
|
+
return vt(
|
|
2722
|
+
e.map(
|
|
2723
|
+
(c) => St(ye(c), "date", t.pattern, r, n)
|
|
2724
|
+
)
|
|
2725
|
+
);
|
|
2726
|
+
const o = (t == null ? void 0 : t.mode) === "style" ? t.dateStyle : r.dateStyle;
|
|
2727
|
+
if (!t || t.mode === "period_label") {
|
|
2728
|
+
const c = ra(a, i, n);
|
|
2729
|
+
if (c)
|
|
2730
|
+
return In({
|
|
2731
|
+
value: ye(a),
|
|
2732
|
+
metadata: {
|
|
2733
|
+
kind: "temporal_bucket",
|
|
2734
|
+
granularity: c,
|
|
2735
|
+
calendar: { tz: n.tz, weekStart: n.weekStart ?? 1 }
|
|
2736
|
+
},
|
|
2737
|
+
format: Dn({
|
|
2738
|
+
metadata: {
|
|
2739
|
+
kind: "temporal_bucket",
|
|
2740
|
+
granularity: c,
|
|
2741
|
+
calendar: { tz: n.tz, weekStart: n.weekStart ?? 1 }
|
|
2742
|
+
},
|
|
2743
|
+
locale: r.locale,
|
|
2744
|
+
styles: { dateStyle: o, dateTime: { ...r.dateTime } }
|
|
2745
|
+
}).format
|
|
2746
|
+
});
|
|
2747
|
+
}
|
|
2748
|
+
const s = new Intl.DateTimeFormat(r.locale, {
|
|
2749
|
+
calendar: "gregory",
|
|
2750
|
+
timeZone: "UTC",
|
|
2751
|
+
dateStyle: o
|
|
2752
|
+
});
|
|
2753
|
+
return aa(a, i) ? s.format(P(a)) : Tt(s, P(a), P(i));
|
|
2754
|
+
}
|
|
2755
|
+
function Xn(e, t, r, n) {
|
|
2756
|
+
if ((t == null ? void 0 : t.mode) === "pattern")
|
|
2757
|
+
return vt(
|
|
2758
|
+
e.map(
|
|
2759
|
+
(s) => St(
|
|
2760
|
+
s.toISOString(),
|
|
2761
|
+
"instant",
|
|
2762
|
+
t.pattern,
|
|
2763
|
+
r,
|
|
2764
|
+
n
|
|
2765
|
+
)
|
|
2766
|
+
)
|
|
2767
|
+
);
|
|
2768
|
+
const a = new Intl.DateTimeFormat(r.locale, {
|
|
2769
|
+
calendar: "gregory",
|
|
2770
|
+
timeZone: n.tz,
|
|
2771
|
+
dateStyle: (t == null ? void 0 : t.mode) === "style" ? t.dateStyle : r.dateTime.dateStyle,
|
|
2772
|
+
timeStyle: r.dateTime.timeStyle
|
|
2773
|
+
}), [i, o] = e;
|
|
2774
|
+
return o && o.getTime() !== i.getTime() ? Tt(a, i, o) : a.format(i);
|
|
2775
|
+
}
|
|
2776
|
+
function Tt(e, t, r) {
|
|
2777
|
+
const n = e;
|
|
2778
|
+
return typeof n.formatRange == "function" ? n.formatRange(t, r) : `${e.format(t)}${Te}${e.format(r)}`;
|
|
2779
|
+
}
|
|
2780
|
+
function St(e, t, r, n, a) {
|
|
2781
|
+
const i = Xr({
|
|
2782
|
+
format: {
|
|
2783
|
+
type: "raw_temporal",
|
|
2784
|
+
presentation: { mode: "pattern", dialect: "semaphor_tokens", pattern: r }
|
|
2785
|
+
},
|
|
2786
|
+
// Temporal formatting reads no currency.
|
|
2787
|
+
preferences: {
|
|
2788
|
+
...n,
|
|
2789
|
+
defaultCurrency: Ft.defaultCurrency
|
|
2790
|
+
},
|
|
2791
|
+
calendar: { tz: a.tz }
|
|
2792
|
+
}), o = t === "date" && Jn(r) ? "instant" : t;
|
|
2793
|
+
return fn({
|
|
2794
|
+
value: o === t ? e : W(`${e}T00:00:00`, a.tz).toISOString(),
|
|
2795
|
+
metadata: { kind: "raw_temporal", valueKind: o },
|
|
2796
|
+
format: i
|
|
2797
|
+
}).text;
|
|
2798
|
+
}
|
|
2799
|
+
function Jn(e) {
|
|
2800
|
+
return /HH|mm|ss/.test(e);
|
|
2801
|
+
}
|
|
2802
|
+
function vt(e) {
|
|
2803
|
+
return e[1] === void 0 || e[0] === e[1] ? e[0] : e.join(Te);
|
|
2804
|
+
}
|
|
2805
|
+
function Qn(e, t) {
|
|
2806
|
+
const r = qn.exec(e);
|
|
2807
|
+
if (r) {
|
|
2808
|
+
const a = {
|
|
2809
|
+
year: Number(r[1]),
|
|
2810
|
+
month: Number(r[2]),
|
|
2811
|
+
day: Number(r[3])
|
|
2812
|
+
};
|
|
2813
|
+
return ia(a) ? { kind: "date", date: a } : null;
|
|
2814
|
+
}
|
|
2815
|
+
const n = Vn.test(e) ? new Date(e.replace(" ", "T")) : Bn.test(e) ? W(e.replace(" ", "T"), t) : null;
|
|
2816
|
+
return n && !Number.isNaN(n.getTime()) ? { kind: "instant", instant: n } : null;
|
|
2817
|
+
}
|
|
2818
|
+
function ea(e, t) {
|
|
2819
|
+
return e.kind === "instant" ? e.instant : W(`${ye(e.date)}T00:00:00`, t);
|
|
2820
|
+
}
|
|
2821
|
+
function ta(e, t, r) {
|
|
2822
|
+
if (e.kind === "date") return e.date;
|
|
2823
|
+
const n = Ut(e.instant, r), a = { year: n.year, month: n.month, day: n.day };
|
|
2824
|
+
if (n.hour === 0 && n.minute === 0 && n.second === 0 && e.instant.getUTCMilliseconds() === 0) return t === "start" ? a : na(a, -1);
|
|
2825
|
+
const o = n.hour === 23 && n.minute === 59 && n.second === 59;
|
|
2826
|
+
return t === "end" && o ? a : null;
|
|
2827
|
+
}
|
|
2828
|
+
function ra(e, t, r) {
|
|
2829
|
+
return r.fiscalCalendar || e.day !== 1 || e.year !== t.year || t.day !== xt(t.year, t.month) ? null : e.month === t.month ? "month" : e.month % 3 === 1 && t.month === e.month + 2 ? "quarter" : e.month === 1 && t.month === 12 ? "year" : null;
|
|
2830
|
+
}
|
|
2831
|
+
function ye(e) {
|
|
2832
|
+
return `${String(e.year).padStart(4, "0")}-${String(e.month).padStart(2, "0")}-${String(e.day).padStart(2, "0")}`;
|
|
2833
|
+
}
|
|
2834
|
+
function P(e) {
|
|
2835
|
+
const t = /* @__PURE__ */ new Date(0);
|
|
2836
|
+
return t.setUTCFullYear(e.year, e.month - 1, e.day), t.setUTCHours(0, 0, 0, 0), t;
|
|
2837
|
+
}
|
|
2838
|
+
function na(e, t) {
|
|
2839
|
+
const r = P(e);
|
|
2840
|
+
return r.setUTCDate(r.getUTCDate() + t), {
|
|
2841
|
+
year: r.getUTCFullYear(),
|
|
2842
|
+
month: r.getUTCMonth() + 1,
|
|
2843
|
+
day: r.getUTCDate()
|
|
2844
|
+
};
|
|
2845
|
+
}
|
|
2846
|
+
function aa(e, t) {
|
|
2847
|
+
return e.year === t.year && e.month === t.month && e.day === t.day;
|
|
2848
|
+
}
|
|
2849
|
+
function xt(e, t) {
|
|
2850
|
+
return new Date(Date.UTC(e, t, 0)).getUTCDate();
|
|
2851
|
+
}
|
|
2852
|
+
function ia(e) {
|
|
2853
|
+
return e.year >= 1 && e.month >= 1 && e.month <= 12 && e.day >= 1 && e.day <= xt(e.year, e.month);
|
|
2854
|
+
}
|
|
2855
|
+
export {
|
|
2856
|
+
za as $,
|
|
2857
|
+
Na as A,
|
|
2858
|
+
Cr as B,
|
|
2859
|
+
Ma as C,
|
|
2860
|
+
zr as D,
|
|
2861
|
+
Ar as E,
|
|
2862
|
+
$a as F,
|
|
2863
|
+
Yr as G,
|
|
2864
|
+
Ia as H,
|
|
2865
|
+
Cn as I,
|
|
2866
|
+
jn as J,
|
|
2867
|
+
Kn as K,
|
|
2868
|
+
ja as L,
|
|
2869
|
+
La as M,
|
|
2870
|
+
Ka as N,
|
|
2871
|
+
Ha as O,
|
|
2872
|
+
Le as P,
|
|
2873
|
+
qa as Q,
|
|
2874
|
+
N as R,
|
|
2875
|
+
Ba as S,
|
|
2876
|
+
Or as T,
|
|
2877
|
+
Lr as U,
|
|
2878
|
+
C as V,
|
|
2879
|
+
ct as W,
|
|
2880
|
+
Ea as X,
|
|
2881
|
+
yn as Y,
|
|
2882
|
+
O as Z,
|
|
2883
|
+
ht as _,
|
|
2884
|
+
Hn as a,
|
|
2885
|
+
pt as a0,
|
|
2886
|
+
Dn as a1,
|
|
2887
|
+
Aa as a2,
|
|
2888
|
+
In as a3,
|
|
2889
|
+
pe as a4,
|
|
2890
|
+
Jr as a5,
|
|
2891
|
+
Ca as a6,
|
|
2892
|
+
Qr as a7,
|
|
2893
|
+
Ua as a8,
|
|
2894
|
+
fn as a9,
|
|
2895
|
+
Va as aa,
|
|
2896
|
+
Gn as ab,
|
|
2897
|
+
Ga as ac,
|
|
2898
|
+
Ya as ad,
|
|
2899
|
+
Ra as ae,
|
|
2900
|
+
Oa as af,
|
|
2901
|
+
En as ag,
|
|
2902
|
+
Fn as ah,
|
|
2903
|
+
Pa as ai,
|
|
2904
|
+
Da as aj,
|
|
2905
|
+
xa as ak,
|
|
2906
|
+
va as al,
|
|
2907
|
+
Sa as am,
|
|
2908
|
+
tt as an,
|
|
2909
|
+
Ta as ao,
|
|
2910
|
+
wa as ap,
|
|
2911
|
+
at as aq,
|
|
2912
|
+
Ee as ar,
|
|
2913
|
+
W as as,
|
|
2914
|
+
ga as b,
|
|
2915
|
+
Fa as c,
|
|
2916
|
+
ya as d,
|
|
2917
|
+
ge as e,
|
|
2918
|
+
Za as f,
|
|
2919
|
+
Xe as g,
|
|
2920
|
+
Je as h,
|
|
2921
|
+
Ze as i,
|
|
2922
|
+
Qe as j,
|
|
2923
|
+
et as k,
|
|
2924
|
+
ha as l,
|
|
2925
|
+
pa as m,
|
|
2926
|
+
Zt as n,
|
|
2927
|
+
Ve as o,
|
|
2928
|
+
dn as p,
|
|
2929
|
+
Nr as q,
|
|
2930
|
+
Xr as r,
|
|
2931
|
+
ka as s,
|
|
2932
|
+
H as t,
|
|
2933
|
+
k as u,
|
|
2934
|
+
cn as v,
|
|
2935
|
+
_a as w,
|
|
2936
|
+
ba as x,
|
|
2937
|
+
Er as y,
|
|
2938
|
+
Fr as z
|
|
2939
|
+
};
|