react-semaphor 0.1.556 → 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 +19 -20
- package/dist/assistant-context/index.js +1 -1
- package/dist/brand-studio/index.js +28 -29
- package/dist/briefings/index.js +55 -56
- package/dist/chunks/{assistant-chat-C7Acww1T.js → assistant-chat-WMTpYirZ.js} +78 -80
- package/dist/chunks/{bookmark-state-7iZErWnR.js → bookmark-state-PjQpxbG7.js} +3 -3
- package/dist/chunks/{braces-o9UiRQes.js → braces-BOErQVyi.js} +1 -1
- package/dist/chunks/{comparison-window-caption-BseG5aOZ.js → comparison-window-caption-Dc7BaCMz.js} +186 -189
- package/dist/chunks/{custom-visual-inputs-ChuKjx27.js → custom-visual-inputs-CxYI-gFa.js} +1 -1
- package/dist/chunks/{dashboard-BU6rE5kV.js → dashboard-4D8Vy4pL.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-qrYd2zkN.js → dashboard-briefing-launcher-C4EmOfxs.js} +147 -149
- package/dist/chunks/{dashboard-controls-BsapXI2H.js → dashboard-controls-DBWykmvL.js} +170 -172
- package/dist/chunks/{dashboard-json-CJqPqYnI.js → dashboard-json-DiX-p0F7.js} +20 -21
- package/dist/chunks/{document-dashboard-inputs-BNSprf5_.js → document-dashboard-inputs-DP5hquBR.js} +30 -30
- package/dist/chunks/{edit-dashboard-visual-CjAdV-WG.js → edit-dashboard-visual-n1jLV_7V.js} +4773 -4802
- package/dist/chunks/{filter-reach-copy-BTrqtFkh.js → filter-reach-copy-BB9iakLA.js} +147 -148
- package/dist/chunks/{filter-value-text-CJTJDCym.js → filter-value-text-CUBpotVN.js} +3 -3
- package/dist/chunks/{global-date-filter-utils-CTVf3dG3.js → global-date-filter-utils-Cc5tqkoW.js} +585 -591
- package/dist/chunks/{index-B_vIRa-q.js → index-CgjhzkKM.js} +69 -70
- 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-Cg0ioFGQ.js → matrix-analytical-definition-4GTUDheD.js} +3 -3
- package/dist/chunks/{matrix-card-yYibXSw1.js → matrix-card-fS_4O7zA.js} +2 -2
- package/dist/chunks/{matrix-member-presentation-DEEauKXC.js → matrix-member-presentation-Dj7HaAHC.js} +1 -1
- package/dist/chunks/{matrix-operation-contract-C1G6AJNh.js → matrix-operation-contract-CpgLZ7E5.js} +21 -21
- package/dist/chunks/{metric-comparison-BfcmwxM1.js → metric-comparison-C8LY7GG5.js} +1 -1
- package/dist/chunks/{palette-D10o_yYX.js → palette-DMkIhagj.js} +1 -1
- package/dist/chunks/{matrix-formatter-C2kjsCDf.js → pivot-result-contract-expectations-DMk-mKhG.js} +444 -395
- package/dist/chunks/{pivot-result-identity-CWi5WrrY.js → pivot-result-identity-CrQ54Xbj.js} +1 -1
- package/dist/chunks/{raw-temporal-presentation-DWzLIHc3.js → raw-temporal-presentation-DdEpgPRB.js} +24 -25
- package/dist/chunks/report-preferences-dialog-CFg5VFLk.js +2109 -0
- package/dist/chunks/{report-runtime-context-BgM-iNWB.js → report-runtime-context-CohdtiMg.js} +1 -1
- package/dist/chunks/{resolve-dashboard-input-context-Df8V5QHW.js → resolve-dashboard-input-context-Djl3kCFL.js} +224 -226
- package/dist/chunks/{save-CfJpQQ68.js → save-D1EpMcwT.js} +1 -1
- package/dist/chunks/{saved-dashboard-context-VvXI6r03.js → saved-dashboard-context-umlQFevH.js} +8 -8
- package/dist/chunks/selection-reducer-_d6aKJnj.js +46 -0
- package/dist/chunks/{semaphor-ready-indicator-fejZmdq9.js → semaphor-ready-indicator-4cOp6sla.js} +40458 -43400
- package/dist/chunks/{shelf-drop-preview-context-BuTCXe-S.js → shelf-drop-preview-context-DAtRuvR7.js} +6 -6
- package/dist/chunks/{source-entity-resolution-B46EZIzX.js → source-entity-resolution-DXW1HpKf.js} +1 -1
- package/dist/chunks/{switch-Bq92UGId.js → switch-9CJt5EF_.js} +1430 -1341
- package/dist/chunks/{table-export-sheet-noKl8-en.js → table-export-sheet-CTCTA_bd.js} +1 -1
- package/dist/chunks/{table-settings-PpINOzw8.js → table-settings-DF1gdVQR.js} +2 -2
- package/dist/chunks/temporal-input-presentation-DoSniQj1.js +2939 -0
- package/dist/chunks/{token-types--0bgRCaO.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-Cz-ve64t.js → use-create-flow-overlay-state-esyMT9vU.js} +124 -126
- package/dist/chunks/{validators-CZo_H4E6.js → validators-hmfNNQz8.js} +5 -5
- package/dist/chunks/zoned-wall-clock-E35Frf9v.js +191 -0
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +130 -131
- package/dist/data-app-sdk/index.js +788 -4153
- package/dist/data-app-sdk-adapters/index.js +2 -2
- package/dist/data-app-sdk-validation/index.js +5 -5
- package/dist/format-utils/index.js +230 -233
- package/dist/index.js +216 -217
- package/dist/report-runtime-context/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +2 -2
- 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 +6 -6
- package/dist/types/shared/dashboard-authoring/filter-model/filter-definitions.d.ts +1 -7
- package/package.json +1 -3
- package/src/data-app-sdk/README.md +7 -31
- package/dist/chunks/pivot-result-contract-expectations-fKBHFPfz.js +0 -56
- package/dist/chunks/raw-temporal-contract-CjHaUIsE.js +0 -64
- package/dist/chunks/report-preferences-dialog-D_wrbIQt.js +0 -2261
- package/dist/chunks/selection-reducer-By4CSmEF.js +0 -111
- package/dist/chunks/temporal-bucket-DzyadxVY.js +0 -2071
- package/dist/chunks/temporal-input-presentation-CJWS4d0L.js +0 -879
- package/dist/chunks/x-4f5U2XwU.js +0 -100
- package/dist/chunks/zoned-wall-clock-MulfA26h.js +0 -129
- package/dist/types/data-app-sdk/devtools/index.d.ts +0 -49
- package/dist/types/data-app-sdk/devtools.d.ts +0 -1
|
@@ -1,879 +0,0 @@
|
|
|
1
|
-
var Z = Object.defineProperty;
|
|
2
|
-
var X = (e, t, r) => t in e ? Z(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
-
var y = (e, t, r) => X(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
-
import { N as A, O as z, P as f, o as H, H as V, C as W, i as J, Q as C, G, E as Q, r as ee, M as te, v as re } from "./temporal-bucket-DzyadxVY.js";
|
|
5
|
-
import { z as l } from "zod";
|
|
6
|
-
import { E as j, l as K } from "./export-file-format-C-tJsxsf.js";
|
|
7
|
-
import { aM as oe, l as ne, X as ae, P as v, o as se } from "./validators-CZo_H4E6.js";
|
|
8
|
-
import { b as ie } from "./report-runtime-context-BgM-iNWB.js";
|
|
9
|
-
import { DEFAULT_RESOLVED_VALUE_FORMAT_PREFERENCES as ce } from "../value-format-preferences/index.js";
|
|
10
|
-
import { z as le } from "./zoned-wall-clock-MulfA26h.js";
|
|
11
|
-
function ht(e, t) {
|
|
12
|
-
const o = fe(e);
|
|
13
|
-
let n;
|
|
14
|
-
if (o.date) {
|
|
15
|
-
const c = pe(o.date, 2);
|
|
16
|
-
n = ge(c.restDateString, c.year);
|
|
17
|
-
}
|
|
18
|
-
if (!n || isNaN(n.getTime()))
|
|
19
|
-
return /* @__PURE__ */ new Date(NaN);
|
|
20
|
-
const a = n.getTime();
|
|
21
|
-
let s = 0, i;
|
|
22
|
-
if (o.time && (s = he(o.time), isNaN(s)))
|
|
23
|
-
return /* @__PURE__ */ new Date(NaN);
|
|
24
|
-
if (o.timezone) {
|
|
25
|
-
if (i = ye(o.timezone), isNaN(i))
|
|
26
|
-
return /* @__PURE__ */ new Date(NaN);
|
|
27
|
-
} else {
|
|
28
|
-
const c = new Date(a + s), m = /* @__PURE__ */ new Date(0);
|
|
29
|
-
return m.setFullYear(
|
|
30
|
-
c.getUTCFullYear(),
|
|
31
|
-
c.getUTCMonth(),
|
|
32
|
-
c.getUTCDate()
|
|
33
|
-
), m.setHours(
|
|
34
|
-
c.getUTCHours(),
|
|
35
|
-
c.getUTCMinutes(),
|
|
36
|
-
c.getUTCSeconds(),
|
|
37
|
-
c.getUTCMilliseconds()
|
|
38
|
-
), m;
|
|
39
|
-
}
|
|
40
|
-
return new Date(a + s + i);
|
|
41
|
-
}
|
|
42
|
-
const x = {
|
|
43
|
-
dateTimeDelimiter: /[T ]/,
|
|
44
|
-
timeZoneDelimiter: /[Z ]/i,
|
|
45
|
-
timezone: /([Z+-].*)$/
|
|
46
|
-
}, me = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/, de = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/, ue = /^([+-])(\d{2})(?::?(\d{2}))?$/;
|
|
47
|
-
function fe(e) {
|
|
48
|
-
const t = {}, r = e.split(x.dateTimeDelimiter);
|
|
49
|
-
let o;
|
|
50
|
-
if (r.length > 2)
|
|
51
|
-
return t;
|
|
52
|
-
if (/:/.test(r[0]) ? o = r[0] : (t.date = r[0], o = r[1], x.timeZoneDelimiter.test(t.date) && (t.date = e.split(x.timeZoneDelimiter)[0], o = e.substr(
|
|
53
|
-
t.date.length,
|
|
54
|
-
e.length
|
|
55
|
-
))), o) {
|
|
56
|
-
const n = x.timezone.exec(o);
|
|
57
|
-
n ? (t.time = o.replace(n[1], ""), t.timezone = n[1]) : t.time = o;
|
|
58
|
-
}
|
|
59
|
-
return t;
|
|
60
|
-
}
|
|
61
|
-
function pe(e, t) {
|
|
62
|
-
const r = new RegExp(
|
|
63
|
-
"^(?:(\\d{4}|[+-]\\d{" + (4 + t) + "})|(\\d{2}|[+-]\\d{" + (2 + t) + "})$)"
|
|
64
|
-
), o = e.match(r);
|
|
65
|
-
if (!o) return { year: NaN, restDateString: "" };
|
|
66
|
-
const n = o[1] ? parseInt(o[1]) : null, a = o[2] ? parseInt(o[2]) : null;
|
|
67
|
-
return {
|
|
68
|
-
year: a === null ? n : a * 100,
|
|
69
|
-
restDateString: e.slice((o[1] || o[2]).length)
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
function ge(e, t) {
|
|
73
|
-
if (t === null) return /* @__PURE__ */ new Date(NaN);
|
|
74
|
-
const r = e.match(me);
|
|
75
|
-
if (!r) return /* @__PURE__ */ new Date(NaN);
|
|
76
|
-
const o = !!r[4], n = w(r[1]), a = w(r[2]) - 1, s = w(r[3]), i = w(r[4]), c = w(r[5]) - 1;
|
|
77
|
-
if (o)
|
|
78
|
-
return be(t, i, c) ? we(t, i, c) : /* @__PURE__ */ new Date(NaN);
|
|
79
|
-
{
|
|
80
|
-
const m = /* @__PURE__ */ new Date(0);
|
|
81
|
-
return !xe(t, a, s) || !Te(t, n) ? /* @__PURE__ */ new Date(NaN) : (m.setUTCFullYear(t, a, Math.max(n, s)), m);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
function w(e) {
|
|
85
|
-
return e ? parseInt(e) : 1;
|
|
86
|
-
}
|
|
87
|
-
function he(e) {
|
|
88
|
-
const t = e.match(de);
|
|
89
|
-
if (!t) return NaN;
|
|
90
|
-
const r = D(t[1]), o = D(t[2]), n = D(t[3]);
|
|
91
|
-
return ke(r, o, n) ? r * A + o * z + n * 1e3 : NaN;
|
|
92
|
-
}
|
|
93
|
-
function D(e) {
|
|
94
|
-
return e && parseFloat(e.replace(",", ".")) || 0;
|
|
95
|
-
}
|
|
96
|
-
function ye(e) {
|
|
97
|
-
if (e === "Z") return 0;
|
|
98
|
-
const t = e.match(ue);
|
|
99
|
-
if (!t) return 0;
|
|
100
|
-
const r = t[1] === "+" ? -1 : 1, o = parseInt(t[2]), n = t[3] && parseInt(t[3]) || 0;
|
|
101
|
-
return Ie(o, n) ? r * (o * A + n * z) : NaN;
|
|
102
|
-
}
|
|
103
|
-
function we(e, t, r) {
|
|
104
|
-
const o = /* @__PURE__ */ new Date(0);
|
|
105
|
-
o.setUTCFullYear(e, 0, 4);
|
|
106
|
-
const n = o.getUTCDay() || 7, a = (t - 1) * 7 + r + 1 - n;
|
|
107
|
-
return o.setUTCDate(o.getUTCDate() + a), o;
|
|
108
|
-
}
|
|
109
|
-
const ve = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
110
|
-
function O(e) {
|
|
111
|
-
return e % 400 === 0 || e % 4 === 0 && e % 100 !== 0;
|
|
112
|
-
}
|
|
113
|
-
function xe(e, t, r) {
|
|
114
|
-
return t >= 0 && t <= 11 && r >= 1 && r <= (ve[t] || (O(e) ? 29 : 28));
|
|
115
|
-
}
|
|
116
|
-
function Te(e, t) {
|
|
117
|
-
return t >= 1 && t <= (O(e) ? 366 : 365);
|
|
118
|
-
}
|
|
119
|
-
function be(e, t, r) {
|
|
120
|
-
return t >= 1 && t <= 53 && r >= 0 && r <= 6;
|
|
121
|
-
}
|
|
122
|
-
function ke(e, t, r) {
|
|
123
|
-
return e === 24 ? t === 0 && r === 0 : r >= 0 && r < 60 && t >= 0 && t < 60 && e >= 0 && e < 25;
|
|
124
|
-
}
|
|
125
|
-
function Ie(e, t) {
|
|
126
|
-
return t >= 0 && t <= 59;
|
|
127
|
-
}
|
|
128
|
-
const Ee = 5 * 1024 * 1024, yt = 64 * 1024 * 1024, k = l.number().int().positive().max(Number.MAX_SAFE_INTEGER), T = l.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER), I = T.refine((e) => e > 0), Se = (e) => !!e && e !== "." && e !== ".." && !e.includes("/") && !e.includes("\\");
|
|
129
|
-
function g(e, t) {
|
|
130
|
-
const r = t.split("/");
|
|
131
|
-
if (r.length !== 5 || r[0] !== "exports" || r[1] !== e || r[2] !== "attempts" || !r.every(Se))
|
|
132
|
-
throw new Error("Invalid Matrix export artifact namespace.");
|
|
133
|
-
return { attemptId: r[3], filename: r[4] };
|
|
134
|
-
}
|
|
135
|
-
function wt(e, t, r) {
|
|
136
|
-
const o = `exports/${e}/attempts/${t}/${r}`;
|
|
137
|
-
return g(e, o), o;
|
|
138
|
-
}
|
|
139
|
-
const vt = l.object({
|
|
140
|
-
acquisition: l.literal("continuation"),
|
|
141
|
-
jobId: l.string().min(1),
|
|
142
|
-
sequence: I,
|
|
143
|
-
deadlineAt: k
|
|
144
|
-
}), $e = [
|
|
145
|
-
"application/json",
|
|
146
|
-
...j.map((e) => K(e).partContentType)
|
|
147
|
-
], _e = l.object({
|
|
148
|
-
key: l.string(),
|
|
149
|
-
content: l.string(),
|
|
150
|
-
contentType: l.enum($e),
|
|
151
|
-
encoding: l.literal("gzip-base64").optional()
|
|
152
|
-
// Transport-only compression: JSON (layout, sheet layout) and Excel rows. CSV travels as it always has.
|
|
153
|
-
}).refine((e) => !e.encoding || e.contentType === "application/json" || e.contentType === K("xlsx").partContentType, "Unsupported Matrix artifact encoding."), De = l.discriminatedUnion("kind", [
|
|
154
|
-
l.object({ kind: l.literal("work"), sequence: I, checkpointKey: l.string(), objects: l.array(_e).min(2).max(4), deadlineAt: k }),
|
|
155
|
-
l.object({ kind: l.literal("committed"), sequence: I, done: l.boolean(), deadlineAt: k })
|
|
156
|
-
]);
|
|
157
|
-
function Re(e) {
|
|
158
|
-
const t = JSON.stringify(e);
|
|
159
|
-
if (t === void 0 || new TextEncoder().encode(t).byteLength > Ee)
|
|
160
|
-
throw new RangeError("Matrix export batch exceeds its transport byte limit.");
|
|
161
|
-
}
|
|
162
|
-
function xt(e, t) {
|
|
163
|
-
const r = De.parse(e);
|
|
164
|
-
if (Re(e), r.deadlineAt !== t.deadlineAt) throw new Error("Matrix deadline does not match the job.");
|
|
165
|
-
if (r.sequence !== t.sequence + (r.kind === "committed" ? 1 : 0))
|
|
166
|
-
throw new Error("Invalid Matrix batch sequence.");
|
|
167
|
-
if (r.kind === "work") {
|
|
168
|
-
g(t.jobId, r.checkpointKey);
|
|
169
|
-
for (const o of r.objects)
|
|
170
|
-
g(t.jobId, o.key);
|
|
171
|
-
}
|
|
172
|
-
return r;
|
|
173
|
-
}
|
|
174
|
-
const Ne = l.object({
|
|
175
|
-
acquisition: l.literal("continuation"),
|
|
176
|
-
deadlineAt: k,
|
|
177
|
-
chunks: l.array(l.object({ chunkNumber: I, dataKey: l.string() })).min(1),
|
|
178
|
-
totalRows: T,
|
|
179
|
-
totalBytes: T,
|
|
180
|
-
fileKey: l.string().min(1).optional(),
|
|
181
|
-
fileSize: T.optional(),
|
|
182
|
-
/** The file the job writes; absent means CSV (manifests from before Excel). */
|
|
183
|
-
format: l.enum(j).optional(),
|
|
184
|
-
/** Excel only: the sheet layout the layout batch stored, which compaction wraps the rows in. */
|
|
185
|
-
sheetKey: l.string().min(1).optional()
|
|
186
|
-
}).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.");
|
|
187
|
-
function Tt(e, t, r) {
|
|
188
|
-
const o = Ne.parse(e);
|
|
189
|
-
if (o.deadlineAt !== r) throw new Error("Matrix deadline does not match the job.");
|
|
190
|
-
return o.chunks.forEach((n, a) => {
|
|
191
|
-
if (n.chunkNumber !== a + 1) throw new Error("Invalid committed Matrix chunk order.");
|
|
192
|
-
g(t, n.dataKey);
|
|
193
|
-
}), o.fileKey !== void 0 && g(t, o.fileKey), o.sheetKey !== void 0 && g(t, o.sheetKey), o;
|
|
194
|
-
}
|
|
195
|
-
function bt(e, t) {
|
|
196
|
-
return t.levelLabels[e.id] ?? e.field.label ?? e.field.name;
|
|
197
|
-
}
|
|
198
|
-
function kt(e, t) {
|
|
199
|
-
return t.measureLabels[e.id] ?? (e.kind === "aggregate" ? e.field.label ?? e.field.name : e.definition.label);
|
|
200
|
-
}
|
|
201
|
-
function It(e) {
|
|
202
|
-
return se.parse(Ce(e));
|
|
203
|
-
}
|
|
204
|
-
function Ce(e) {
|
|
205
|
-
const t = oe.parse(e), r = (o) => ({
|
|
206
|
-
grand: { visible: !0, position: "after" },
|
|
207
|
-
levels: Object.fromEntries(
|
|
208
|
-
o.map((n) => [
|
|
209
|
-
n.id,
|
|
210
|
-
{ visible: !0, position: "before" }
|
|
211
|
-
])
|
|
212
|
-
)
|
|
213
|
-
});
|
|
214
|
-
return ne.parse({
|
|
215
|
-
version: 1,
|
|
216
|
-
spec: t,
|
|
217
|
-
presentation: {
|
|
218
|
-
layout: { kind: "compact" },
|
|
219
|
-
absence: { emptyText: "—", nullText: "" },
|
|
220
|
-
levelLabels: {},
|
|
221
|
-
measureLabels: {},
|
|
222
|
-
levelFormats: {},
|
|
223
|
-
measureFormats: {},
|
|
224
|
-
totals: { rows: r(t.rows), columns: r(t.columns) }
|
|
225
|
-
},
|
|
226
|
-
defaultView: {
|
|
227
|
-
rows: { depth: 0, overrides: [] },
|
|
228
|
-
columns: { depth: t.columns.length > 1 ? 1 : 0, overrides: [] }
|
|
229
|
-
}
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
function Fe(e, t) {
|
|
233
|
-
const r = new Map(e.map((o) => [v(o), o]));
|
|
234
|
-
for (const o of t ?? []) r.set(v(o), o);
|
|
235
|
-
return [...r.values()];
|
|
236
|
-
}
|
|
237
|
-
function Et(e) {
|
|
238
|
-
const { spec: t, presentation: r, defaults: o, session: n } = ae.parse(e), a = new Map(
|
|
239
|
-
Fe(t.sorts, n == null ? void 0 : n.sorts).map((i) => [v(i), i])
|
|
240
|
-
);
|
|
241
|
-
for (const i of ["rows", "columns"])
|
|
242
|
-
for (const c of t[i]) {
|
|
243
|
-
const m = {
|
|
244
|
-
axis: i,
|
|
245
|
-
levelId: c.id,
|
|
246
|
-
scope: { kind: "level" },
|
|
247
|
-
target: { kind: "member" },
|
|
248
|
-
direction: "asc",
|
|
249
|
-
nulls: "last"
|
|
250
|
-
};
|
|
251
|
-
a.has(v(m)) || a.set(v(m), m);
|
|
252
|
-
}
|
|
253
|
-
const s = (i, c) => ({
|
|
254
|
-
depth: Math.min(i.depth, Math.max(0, c - 1)),
|
|
255
|
-
// Leaf toggles are valid but have no effect. Collapsed ancestors retain dormant overrides.
|
|
256
|
-
overrides: i.overrides.filter(
|
|
257
|
-
(m) => m.path.length < c
|
|
258
|
-
)
|
|
259
|
-
});
|
|
260
|
-
return {
|
|
261
|
-
spec: { ...t, sorts: [...a.values()] },
|
|
262
|
-
presentation: r,
|
|
263
|
-
view: {
|
|
264
|
-
rows: s((n == null ? void 0 : n.rows) ?? o.rows, t.rows.length),
|
|
265
|
-
columns: s(
|
|
266
|
-
(n == null ? void 0 : n.columns) ?? o.columns,
|
|
267
|
-
t.columns.length
|
|
268
|
-
),
|
|
269
|
-
sorts: (n == null ? void 0 : n.sorts) ?? []
|
|
270
|
-
}
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
class U extends Error {
|
|
274
|
-
constructor(r) {
|
|
275
|
-
super(
|
|
276
|
-
`invalid_presentation_execution_snapshot: ${r} Resave this report before running it again.`
|
|
277
|
-
);
|
|
278
|
-
y(this, "code", "invalid_presentation_execution_snapshot");
|
|
279
|
-
y(this, "deliveryBlocking", !0);
|
|
280
|
-
this.name = "PresentationExecutionSnapshotError";
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
class St extends Error {
|
|
284
|
-
constructor(r) {
|
|
285
|
-
super(
|
|
286
|
-
`missing_resolved_raw_temporal_format: Column "${r}" has no captured presentation. Resave this report before running it again.`
|
|
287
|
-
);
|
|
288
|
-
y(this, "code", "missing_resolved_raw_temporal_format");
|
|
289
|
-
y(this, "deliveryBlocking", !0);
|
|
290
|
-
this.name = "MissingResolvedRawTemporalFormatError";
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
function p(e, t, r) {
|
|
294
|
-
const o = new Set(t), n = Object.keys(e).find((a) => !o.has(a));
|
|
295
|
-
if (n)
|
|
296
|
-
throw new Error(`${r} contains unknown property "${n}"`);
|
|
297
|
-
}
|
|
298
|
-
function Me(e, t = "scope") {
|
|
299
|
-
if (!f(e))
|
|
300
|
-
throw new Error(`${t} must be an object`);
|
|
301
|
-
p(
|
|
302
|
-
e,
|
|
303
|
-
["dashboardId", "cardId", "attachmentIndex"],
|
|
304
|
-
t
|
|
305
|
-
);
|
|
306
|
-
const r = typeof e.dashboardId == "string" ? e.dashboardId.trim() : "";
|
|
307
|
-
if (!r)
|
|
308
|
-
throw new Error(`${t}.dashboardId is required`);
|
|
309
|
-
const o = typeof e.cardId == "string" ? e.cardId.trim() : void 0;
|
|
310
|
-
if (e.cardId !== void 0 && !o)
|
|
311
|
-
throw new Error(`${t}.cardId must be a non-empty string`);
|
|
312
|
-
const n = e.attachmentIndex;
|
|
313
|
-
if (n !== void 0 && (typeof n != "number" || !Number.isInteger(n) || n < 0))
|
|
314
|
-
throw new Error(
|
|
315
|
-
`${t}.attachmentIndex must be a non-negative integer`
|
|
316
|
-
);
|
|
317
|
-
return {
|
|
318
|
-
dashboardId: r,
|
|
319
|
-
...o ? { cardId: o } : {},
|
|
320
|
-
...typeof n == "number" ? { attachmentIndex: n } : {}
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
|
-
function h(e, t, r, o) {
|
|
324
|
-
if (e.kind !== t) return;
|
|
325
|
-
p(e, ["kind", r], o);
|
|
326
|
-
const n = e[r];
|
|
327
|
-
if (typeof n != "string" || !n.trim())
|
|
328
|
-
throw new Error(`${o}.${r} is required`);
|
|
329
|
-
return n;
|
|
330
|
-
}
|
|
331
|
-
function R(e, t) {
|
|
332
|
-
if (!f(e))
|
|
333
|
-
throw new Error(`${t} must be an object`);
|
|
334
|
-
const r = h(e, "metric", "metricId", t);
|
|
335
|
-
if (r) return { kind: "metric", metricId: r };
|
|
336
|
-
const o = h(e, "column", "columnKey", t);
|
|
337
|
-
if (o) return { kind: "column", columnKey: o };
|
|
338
|
-
const n = h(
|
|
339
|
-
e,
|
|
340
|
-
"matrix_measure",
|
|
341
|
-
"measureId",
|
|
342
|
-
t
|
|
343
|
-
);
|
|
344
|
-
if (n) return { kind: "matrix_measure", measureId: n };
|
|
345
|
-
throw new Error(`${t} is not a valid numeric presentation target`);
|
|
346
|
-
}
|
|
347
|
-
const Ue = [
|
|
348
|
-
"type",
|
|
349
|
-
"inputUnit",
|
|
350
|
-
"outputStyle",
|
|
351
|
-
"largestUnit",
|
|
352
|
-
"smallestUnit",
|
|
353
|
-
"maxUnits",
|
|
354
|
-
"prefix",
|
|
355
|
-
"suffix",
|
|
356
|
-
"negativeStyle"
|
|
357
|
-
];
|
|
358
|
-
function Ae(e) {
|
|
359
|
-
return e === "millisecond" || e === "second" || e === "minute" || e === "hour" || e === "day";
|
|
360
|
-
}
|
|
361
|
-
const ze = ["type", "locale", "pattern", "timezone", "sourceTimezone"];
|
|
362
|
-
function je(e, t) {
|
|
363
|
-
if (p(e, ze, t), typeof e.locale != "string" || !e.locale.trim())
|
|
364
|
-
throw new Error(`${t}.locale must be a non-empty string`);
|
|
365
|
-
for (const r of ["pattern", "timezone", "sourceTimezone"])
|
|
366
|
-
if (e[r] !== void 0 && typeof e[r] != "string")
|
|
367
|
-
throw new Error(`${t}.${r} must be a string`);
|
|
368
|
-
return {
|
|
369
|
-
type: "date",
|
|
370
|
-
locale: e.locale,
|
|
371
|
-
...typeof e.pattern == "string" ? { pattern: e.pattern } : {},
|
|
372
|
-
...typeof e.timezone == "string" ? { timezone: e.timezone } : {},
|
|
373
|
-
...typeof e.sourceTimezone == "string" ? { sourceTimezone: e.sourceTimezone } : {}
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
|
-
function Ke(e, t) {
|
|
377
|
-
p(e, Ue, t);
|
|
378
|
-
for (const a of ["inputUnit", "largestUnit", "smallestUnit"])
|
|
379
|
-
if (e[a] !== void 0 && !Ae(e[a]))
|
|
380
|
-
throw new Error(`${t}.${a} must be a duration unit`);
|
|
381
|
-
const r = e.outputStyle;
|
|
382
|
-
if (r !== void 0 && r !== "compact" && r !== "digital" && r !== "long")
|
|
383
|
-
throw new Error(`${t}.outputStyle must be compact, digital, or long`);
|
|
384
|
-
const o = e.maxUnits;
|
|
385
|
-
if (o !== void 0 && (typeof o != "number" || !Number.isInteger(o) || o < 0 || o > 10))
|
|
386
|
-
throw new Error(`${t}.maxUnits must be an integer from 0 to 10`);
|
|
387
|
-
for (const a of ["prefix", "suffix"])
|
|
388
|
-
if (e[a] !== void 0 && typeof e[a] != "string")
|
|
389
|
-
throw new Error(`${t}.${a} must be a string`);
|
|
390
|
-
const n = e.negativeStyle;
|
|
391
|
-
if (n !== void 0 && n !== "minus" && n !== "parentheses")
|
|
392
|
-
throw new Error(`${t}.negativeStyle must be minus or parentheses`);
|
|
393
|
-
return {
|
|
394
|
-
type: "duration",
|
|
395
|
-
...e.inputUnit !== void 0 ? { inputUnit: e.inputUnit } : {},
|
|
396
|
-
...r !== void 0 ? { outputStyle: r } : {},
|
|
397
|
-
...e.largestUnit !== void 0 ? { largestUnit: e.largestUnit } : {},
|
|
398
|
-
...e.smallestUnit !== void 0 ? { smallestUnit: e.smallestUnit } : {},
|
|
399
|
-
...o !== void 0 ? { maxUnits: o } : {},
|
|
400
|
-
...e.prefix !== void 0 ? { prefix: e.prefix } : {},
|
|
401
|
-
...e.suffix !== void 0 ? { suffix: e.suffix } : {},
|
|
402
|
-
...n !== void 0 ? { negativeStyle: n } : {}
|
|
403
|
-
};
|
|
404
|
-
}
|
|
405
|
-
function Oe(e, t) {
|
|
406
|
-
if (!f(e))
|
|
407
|
-
throw new Error(`${t} must be an object`);
|
|
408
|
-
if (e.kind === "field") {
|
|
409
|
-
p(e, ["kind", "fieldId", "role"], t);
|
|
410
|
-
const n = typeof e.fieldId == "string" ? e.fieldId.trim() : "";
|
|
411
|
-
if (!n)
|
|
412
|
-
throw new Error(`${t}.fieldId is required`);
|
|
413
|
-
const a = e.role;
|
|
414
|
-
if (a !== void 0 && a !== "groupby" && a !== "pivotby")
|
|
415
|
-
throw new Error(`${t}.role must be groupby or pivotby`);
|
|
416
|
-
return {
|
|
417
|
-
kind: "field",
|
|
418
|
-
fieldId: n,
|
|
419
|
-
...a ? { role: a } : {}
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
|
-
const r = h(e, "column", "columnKey", t);
|
|
423
|
-
if (r) return { kind: "column", columnKey: r };
|
|
424
|
-
const o = h(
|
|
425
|
-
e,
|
|
426
|
-
"matrix_axis",
|
|
427
|
-
"axisInstanceId",
|
|
428
|
-
t
|
|
429
|
-
);
|
|
430
|
-
if (o) return { kind: "matrix_axis", axisInstanceId: o };
|
|
431
|
-
throw new Error(`${t} is not a valid temporal bucket presentation target`);
|
|
432
|
-
}
|
|
433
|
-
function Pe(e, t) {
|
|
434
|
-
if (!f(e))
|
|
435
|
-
throw new Error(`${t} must be an object`);
|
|
436
|
-
const r = h(e, "column", "columnKey", t);
|
|
437
|
-
if (!r)
|
|
438
|
-
throw new Error(`${t} must identify a column`);
|
|
439
|
-
return { kind: "column", columnKey: r };
|
|
440
|
-
}
|
|
441
|
-
function Le(e) {
|
|
442
|
-
return [
|
|
443
|
-
e.dashboardId,
|
|
444
|
-
e.cardId ?? null,
|
|
445
|
-
e.attachmentIndex ?? null
|
|
446
|
-
];
|
|
447
|
-
}
|
|
448
|
-
function E(e) {
|
|
449
|
-
switch (e.kind) {
|
|
450
|
-
case "metric":
|
|
451
|
-
return [e.kind, e.metricId];
|
|
452
|
-
case "column":
|
|
453
|
-
return [e.kind, e.columnKey];
|
|
454
|
-
case "matrix_measure":
|
|
455
|
-
return [e.kind, e.measureId];
|
|
456
|
-
case "field":
|
|
457
|
-
return [e.kind, e.fieldId, e.role ?? ""];
|
|
458
|
-
case "matrix_axis":
|
|
459
|
-
return [e.kind, e.axisInstanceId];
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
function S(e, t) {
|
|
463
|
-
return e.dashboardId === t.dashboardId && e.cardId === t.cardId && e.attachmentIndex === t.attachmentIndex;
|
|
464
|
-
}
|
|
465
|
-
function $(e, t) {
|
|
466
|
-
const r = E(e), o = E(t);
|
|
467
|
-
return r.length === o.length && r.every((n, a) => n === o[a]);
|
|
468
|
-
}
|
|
469
|
-
function Ye(e) {
|
|
470
|
-
if (!Array.isArray(e))
|
|
471
|
-
throw new Error("resolvedFormats must be an array");
|
|
472
|
-
const t = /* @__PURE__ */ new Set();
|
|
473
|
-
return e.map((r, o) => {
|
|
474
|
-
var c, m;
|
|
475
|
-
const n = `resolvedFormats.${o}`;
|
|
476
|
-
if (!f(r))
|
|
477
|
-
throw new Error(`${n} must be an object`);
|
|
478
|
-
p(r, ["scope", "target", "format"], n);
|
|
479
|
-
const a = Me(r.scope, `${n}.scope`);
|
|
480
|
-
if (!f(r.format))
|
|
481
|
-
throw new Error(`${n}.format must be an object`);
|
|
482
|
-
let s;
|
|
483
|
-
switch (r.format.type) {
|
|
484
|
-
case "temporal_bucket": {
|
|
485
|
-
const d = W(r.format);
|
|
486
|
-
if (!d.ok)
|
|
487
|
-
throw new Error(
|
|
488
|
-
`${n}.format is invalid: ${((c = d.issues[0]) == null ? void 0 : c.message) ?? "invalid value"}`
|
|
489
|
-
);
|
|
490
|
-
s = {
|
|
491
|
-
scope: a,
|
|
492
|
-
target: Oe(r.target, `${n}.target`),
|
|
493
|
-
format: d.value
|
|
494
|
-
};
|
|
495
|
-
break;
|
|
496
|
-
}
|
|
497
|
-
case "raw_temporal":
|
|
498
|
-
s = {
|
|
499
|
-
scope: a,
|
|
500
|
-
target: Pe(r.target, `${n}.target`),
|
|
501
|
-
format: V(r.format)
|
|
502
|
-
};
|
|
503
|
-
break;
|
|
504
|
-
case "number":
|
|
505
|
-
case "currency":
|
|
506
|
-
case "percent":
|
|
507
|
-
case "scientific": {
|
|
508
|
-
const d = H(r.format);
|
|
509
|
-
if (!d.ok)
|
|
510
|
-
throw new Error(
|
|
511
|
-
`${n}.format is invalid: ${((m = d.issues[0]) == null ? void 0 : m.message) ?? "invalid value"}`
|
|
512
|
-
);
|
|
513
|
-
s = {
|
|
514
|
-
scope: a,
|
|
515
|
-
target: R(r.target, `${n}.target`),
|
|
516
|
-
format: d.value
|
|
517
|
-
};
|
|
518
|
-
break;
|
|
519
|
-
}
|
|
520
|
-
case "date": {
|
|
521
|
-
const d = R(r.target, `${n}.target`);
|
|
522
|
-
if (d.kind !== "column")
|
|
523
|
-
throw new Error(`${n}.target must identify a column for a date format`);
|
|
524
|
-
s = {
|
|
525
|
-
scope: a,
|
|
526
|
-
target: d,
|
|
527
|
-
format: je(r.format, `${n}.format`)
|
|
528
|
-
};
|
|
529
|
-
break;
|
|
530
|
-
}
|
|
531
|
-
case "duration":
|
|
532
|
-
s = {
|
|
533
|
-
scope: a,
|
|
534
|
-
target: R(r.target, `${n}.target`),
|
|
535
|
-
format: Ke(
|
|
536
|
-
r.format,
|
|
537
|
-
`${n}.format`
|
|
538
|
-
)
|
|
539
|
-
};
|
|
540
|
-
break;
|
|
541
|
-
default:
|
|
542
|
-
throw new Error(`${n}.format.type is unsupported`);
|
|
543
|
-
}
|
|
544
|
-
const i = JSON.stringify([
|
|
545
|
-
...Le(s.scope),
|
|
546
|
-
...E(s.target)
|
|
547
|
-
]);
|
|
548
|
-
if (t.has(i))
|
|
549
|
-
throw new Error(
|
|
550
|
-
`${n} duplicates a scoped presentation target`
|
|
551
|
-
);
|
|
552
|
-
return t.add(i), s;
|
|
553
|
-
});
|
|
554
|
-
}
|
|
555
|
-
function Be(e) {
|
|
556
|
-
try {
|
|
557
|
-
if (!f(e))
|
|
558
|
-
throw new Error("presentation execution snapshot must be an object");
|
|
559
|
-
if (p(
|
|
560
|
-
e,
|
|
561
|
-
["version", "reportContext", "resolvedFormats"],
|
|
562
|
-
"presentation execution snapshot"
|
|
563
|
-
), e.version !== 1)
|
|
564
|
-
throw new Error("presentation execution snapshot version must be 1");
|
|
565
|
-
const t = ie(e.reportContext);
|
|
566
|
-
if (!t.ok) {
|
|
567
|
-
const r = t.issues[0];
|
|
568
|
-
throw new Error(
|
|
569
|
-
`presentation execution snapshot reportContext is invalid: ${r != null && r.path && r.path !== "$" ? `${r.path}: ` : ""}${(r == null ? void 0 : r.message) ?? "invalid value"}`
|
|
570
|
-
);
|
|
571
|
-
}
|
|
572
|
-
return {
|
|
573
|
-
version: 1,
|
|
574
|
-
reportContext: t.value,
|
|
575
|
-
resolvedFormats: Ye(e.resolvedFormats)
|
|
576
|
-
};
|
|
577
|
-
} catch (t) {
|
|
578
|
-
throw t instanceof U ? t : new U(
|
|
579
|
-
t instanceof Error ? t.message : "Snapshot is invalid."
|
|
580
|
-
);
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
function $t(e) {
|
|
584
|
-
return Be({
|
|
585
|
-
version: 1,
|
|
586
|
-
reportContext: e.reportContext,
|
|
587
|
-
resolvedFormats: [...e.resolvedFormats]
|
|
588
|
-
});
|
|
589
|
-
}
|
|
590
|
-
function _t(e) {
|
|
591
|
-
const t = qe(e);
|
|
592
|
-
return J(t) ? t : void 0;
|
|
593
|
-
}
|
|
594
|
-
function qe(e) {
|
|
595
|
-
const t = e.snapshot.resolvedFormats.find(
|
|
596
|
-
(r) => r.format.type !== "temporal_bucket" && r.format.type !== "raw_temporal" && r.format.type !== "date" && S(r.scope, e.scope) && $(r.target, e.target)
|
|
597
|
-
);
|
|
598
|
-
return t == null ? void 0 : t.format;
|
|
599
|
-
}
|
|
600
|
-
function Dt(e) {
|
|
601
|
-
const t = e.snapshot.resolvedFormats.find(
|
|
602
|
-
(r) => r.format.type === "date" && S(r.scope, e.scope) && $(r.target, e.target)
|
|
603
|
-
);
|
|
604
|
-
return t == null ? void 0 : t.format;
|
|
605
|
-
}
|
|
606
|
-
function Rt(e) {
|
|
607
|
-
const t = e.snapshot.resolvedFormats.find(
|
|
608
|
-
(r) => r.format.type === "raw_temporal" && S(r.scope, e.scope) && $(r.target, e.target)
|
|
609
|
-
);
|
|
610
|
-
return t == null ? void 0 : t.format;
|
|
611
|
-
}
|
|
612
|
-
function Nt(e) {
|
|
613
|
-
const t = e.snapshot.resolvedFormats.find(
|
|
614
|
-
(r) => r.format.type === "temporal_bucket" && S(r.scope, e.scope) && $(r.target, e.target)
|
|
615
|
-
);
|
|
616
|
-
return t == null ? void 0 : t.format;
|
|
617
|
-
}
|
|
618
|
-
function Ct(e) {
|
|
619
|
-
var n;
|
|
620
|
-
const t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
621
|
-
if (e.snapshot.resolvedFormats.forEach((a, s) => {
|
|
622
|
-
if (a.scope.attachmentIndex !== void 0)
|
|
623
|
-
throw new Error(
|
|
624
|
-
`resolvedFormats.${s}.scope.attachmentIndex is not valid for a card export`
|
|
625
|
-
);
|
|
626
|
-
if (a.scope.dashboardId !== e.expectedScope.dashboardId || a.scope.cardId !== e.expectedScope.cardId)
|
|
627
|
-
throw new Error(
|
|
628
|
-
`resolvedFormats.${s}.scope must match the executing dashboard/card`
|
|
629
|
-
);
|
|
630
|
-
if (a.target.kind === "field" && a.format.type === "temporal_bucket") {
|
|
631
|
-
const i = JSON.stringify(E(a.target));
|
|
632
|
-
if (r.has(i))
|
|
633
|
-
throw new Error(
|
|
634
|
-
`resolvedFormats.${s} duplicates export field "${a.target.fieldId}"`
|
|
635
|
-
);
|
|
636
|
-
r.add(i);
|
|
637
|
-
return;
|
|
638
|
-
}
|
|
639
|
-
if (a.target.kind !== "column")
|
|
640
|
-
throw new Error(
|
|
641
|
-
`resolvedFormats.${s}.target must identify an export column or temporal pivot field`
|
|
642
|
-
);
|
|
643
|
-
if (t.has(a.target.columnKey))
|
|
644
|
-
throw new Error(
|
|
645
|
-
`resolvedFormats.${s} duplicates export column "${a.target.columnKey}"`
|
|
646
|
-
);
|
|
647
|
-
t.add(a.target.columnKey);
|
|
648
|
-
}), !e.useFormattedValues) return;
|
|
649
|
-
if (!((n = e.visibleColumns) != null && n.length))
|
|
650
|
-
throw new Error("visibleColumns must identify every formatted export column");
|
|
651
|
-
const o = e.visibleColumns.find(
|
|
652
|
-
(a) => !t.has(a)
|
|
653
|
-
);
|
|
654
|
-
if (o)
|
|
655
|
-
throw new Error(
|
|
656
|
-
`resolvedFormats is missing visible export column "${o}"`
|
|
657
|
-
);
|
|
658
|
-
}
|
|
659
|
-
const Ze = /* @__PURE__ */ new Set(["short", "medium", "long"]), Xe = /^(\d{4})-(\d{2})-(\d{2})$/, He = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,9})?)?$/, Ve = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,9})?)?(?:Z|[+-]\d{2}:\d{2})$/, F = " – ";
|
|
660
|
-
function Ft(e) {
|
|
661
|
-
if (!f(e)) return;
|
|
662
|
-
const t = Object.keys(e);
|
|
663
|
-
if (e.mode === "period_label" && t.length === 1)
|
|
664
|
-
return { mode: "period_label" };
|
|
665
|
-
if (e.mode === "style" && t.length === 2 && typeof e.dateStyle == "string" && Ze.has(e.dateStyle))
|
|
666
|
-
return { mode: "style", dateStyle: e.dateStyle };
|
|
667
|
-
if (e.mode === "pattern" && t.length === 3 && e.dialect === "semaphor_tokens" && typeof e.pattern == "string" && We(e.pattern) === null)
|
|
668
|
-
return {
|
|
669
|
-
mode: "pattern",
|
|
670
|
-
dialect: "semaphor_tokens",
|
|
671
|
-
pattern: e.pattern
|
|
672
|
-
};
|
|
673
|
-
}
|
|
674
|
-
function We(e) {
|
|
675
|
-
try {
|
|
676
|
-
return re({ dialect: "semaphor_tokens", pattern: e }), null;
|
|
677
|
-
} catch (t) {
|
|
678
|
-
return t instanceof Error ? t.message : "The pattern is invalid.";
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
function Mt(e) {
|
|
682
|
-
const { value: t, part: r, presentation: o, preferences: n, calendar: a } = e;
|
|
683
|
-
if ((o == null ? void 0 : o.mode) === "period_label" && t.periodLabel && r === "range")
|
|
684
|
-
return { ok: !0, text: t.periodLabel };
|
|
685
|
-
const [s, i] = t.bounds, m = i === void 0 || r === "start" ? [{ raw: s, role: "start" }] : r === "end" ? [{ raw: i, role: "end" }] : [
|
|
686
|
-
{ raw: s, role: "start" },
|
|
687
|
-
{ raw: i, role: "end" }
|
|
688
|
-
], d = m.map(({ raw: u }) => et(u, a.tz));
|
|
689
|
-
if (d.some((u) => u === null))
|
|
690
|
-
return {
|
|
691
|
-
ok: !1,
|
|
692
|
-
text: m.map(({ raw: u }) => u).join(F),
|
|
693
|
-
diagnostic: {
|
|
694
|
-
code: "invalid_temporal_input_value",
|
|
695
|
-
message: "A date input bound is not a date or an instant."
|
|
696
|
-
}
|
|
697
|
-
};
|
|
698
|
-
const _ = t.precision === "day" ? d.map(
|
|
699
|
-
(u, q) => rt(u, m[q].role, a.tz)
|
|
700
|
-
) : [], M = _.length > 0 && _.every((u) => u !== null) ? _ : null;
|
|
701
|
-
return { ok: !0, text: M ? Je(M, o, n, a) : Ge(
|
|
702
|
-
d.map((u) => tt(u, a.tz)),
|
|
703
|
-
o,
|
|
704
|
-
n,
|
|
705
|
-
a
|
|
706
|
-
) };
|
|
707
|
-
}
|
|
708
|
-
function Je(e, t, r, o) {
|
|
709
|
-
const [n, a = n] = e;
|
|
710
|
-
if ((t == null ? void 0 : t.mode) === "pattern")
|
|
711
|
-
return Y(
|
|
712
|
-
e.map(
|
|
713
|
-
(c) => L(N(c), "date", t.pattern, r, o)
|
|
714
|
-
)
|
|
715
|
-
);
|
|
716
|
-
const s = (t == null ? void 0 : t.mode) === "style" ? t.dateStyle : r.dateStyle;
|
|
717
|
-
if (!t || t.mode === "period_label") {
|
|
718
|
-
const c = ot(n, a, o);
|
|
719
|
-
if (c)
|
|
720
|
-
return G({
|
|
721
|
-
value: N(n),
|
|
722
|
-
metadata: {
|
|
723
|
-
kind: "temporal_bucket",
|
|
724
|
-
granularity: c,
|
|
725
|
-
calendar: { tz: o.tz, weekStart: o.weekStart ?? 1 }
|
|
726
|
-
},
|
|
727
|
-
format: Q({
|
|
728
|
-
metadata: {
|
|
729
|
-
kind: "temporal_bucket",
|
|
730
|
-
granularity: c,
|
|
731
|
-
calendar: { tz: o.tz, weekStart: o.weekStart ?? 1 }
|
|
732
|
-
},
|
|
733
|
-
locale: r.locale,
|
|
734
|
-
styles: { dateStyle: s, dateTime: { ...r.dateTime } }
|
|
735
|
-
}).format
|
|
736
|
-
});
|
|
737
|
-
}
|
|
738
|
-
const i = new Intl.DateTimeFormat(r.locale, {
|
|
739
|
-
calendar: "gregory",
|
|
740
|
-
timeZone: "UTC",
|
|
741
|
-
dateStyle: s
|
|
742
|
-
});
|
|
743
|
-
return at(n, a) ? i.format(b(n)) : P(i, b(n), b(a));
|
|
744
|
-
}
|
|
745
|
-
function Ge(e, t, r, o) {
|
|
746
|
-
if ((t == null ? void 0 : t.mode) === "pattern")
|
|
747
|
-
return Y(
|
|
748
|
-
e.map(
|
|
749
|
-
(i) => L(
|
|
750
|
-
i.toISOString(),
|
|
751
|
-
"instant",
|
|
752
|
-
t.pattern,
|
|
753
|
-
r,
|
|
754
|
-
o
|
|
755
|
-
)
|
|
756
|
-
)
|
|
757
|
-
);
|
|
758
|
-
const n = new Intl.DateTimeFormat(r.locale, {
|
|
759
|
-
calendar: "gregory",
|
|
760
|
-
timeZone: o.tz,
|
|
761
|
-
dateStyle: (t == null ? void 0 : t.mode) === "style" ? t.dateStyle : r.dateTime.dateStyle,
|
|
762
|
-
timeStyle: r.dateTime.timeStyle
|
|
763
|
-
}), [a, s] = e;
|
|
764
|
-
return s && s.getTime() !== a.getTime() ? P(n, a, s) : n.format(a);
|
|
765
|
-
}
|
|
766
|
-
function P(e, t, r) {
|
|
767
|
-
const o = e;
|
|
768
|
-
return typeof o.formatRange == "function" ? o.formatRange(t, r) : `${e.format(t)}${F}${e.format(r)}`;
|
|
769
|
-
}
|
|
770
|
-
function L(e, t, r, o, n) {
|
|
771
|
-
const a = ee({
|
|
772
|
-
format: {
|
|
773
|
-
type: "raw_temporal",
|
|
774
|
-
presentation: { mode: "pattern", dialect: "semaphor_tokens", pattern: r }
|
|
775
|
-
},
|
|
776
|
-
// Temporal formatting reads no currency.
|
|
777
|
-
preferences: {
|
|
778
|
-
...o,
|
|
779
|
-
defaultCurrency: ce.defaultCurrency
|
|
780
|
-
},
|
|
781
|
-
calendar: { tz: n.tz }
|
|
782
|
-
}), s = t === "date" && Qe(r) ? "instant" : t;
|
|
783
|
-
return te({
|
|
784
|
-
value: s === t ? e : C(`${e}T00:00:00`, n.tz).toISOString(),
|
|
785
|
-
metadata: { kind: "raw_temporal", valueKind: s },
|
|
786
|
-
format: a
|
|
787
|
-
}).text;
|
|
788
|
-
}
|
|
789
|
-
function Qe(e) {
|
|
790
|
-
return /HH|mm|ss/.test(e);
|
|
791
|
-
}
|
|
792
|
-
function Y(e) {
|
|
793
|
-
return e[1] === void 0 || e[0] === e[1] ? e[0] : e.join(F);
|
|
794
|
-
}
|
|
795
|
-
function et(e, t) {
|
|
796
|
-
const r = Xe.exec(e);
|
|
797
|
-
if (r) {
|
|
798
|
-
const n = {
|
|
799
|
-
year: Number(r[1]),
|
|
800
|
-
month: Number(r[2]),
|
|
801
|
-
day: Number(r[3])
|
|
802
|
-
};
|
|
803
|
-
return st(n) ? { kind: "date", date: n } : null;
|
|
804
|
-
}
|
|
805
|
-
const o = Ve.test(e) ? new Date(e.replace(" ", "T")) : He.test(e) ? C(e.replace(" ", "T"), t) : null;
|
|
806
|
-
return o && !Number.isNaN(o.getTime()) ? { kind: "instant", instant: o } : null;
|
|
807
|
-
}
|
|
808
|
-
function tt(e, t) {
|
|
809
|
-
return e.kind === "instant" ? e.instant : C(`${N(e.date)}T00:00:00`, t);
|
|
810
|
-
}
|
|
811
|
-
function rt(e, t, r) {
|
|
812
|
-
if (e.kind === "date") return e.date;
|
|
813
|
-
const o = le(e.instant, r), n = { year: o.year, month: o.month, day: o.day };
|
|
814
|
-
if (o.hour === 0 && o.minute === 0 && o.second === 0 && e.instant.getUTCMilliseconds() === 0) return t === "start" ? n : nt(n, -1);
|
|
815
|
-
const s = o.hour === 23 && o.minute === 59 && o.second === 59;
|
|
816
|
-
return t === "end" && s ? n : null;
|
|
817
|
-
}
|
|
818
|
-
function ot(e, t, r) {
|
|
819
|
-
return r.fiscalCalendar || e.day !== 1 || e.year !== t.year || t.day !== B(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;
|
|
820
|
-
}
|
|
821
|
-
function N(e) {
|
|
822
|
-
return `${String(e.year).padStart(4, "0")}-${String(e.month).padStart(2, "0")}-${String(e.day).padStart(2, "0")}`;
|
|
823
|
-
}
|
|
824
|
-
function b(e) {
|
|
825
|
-
const t = /* @__PURE__ */ new Date(0);
|
|
826
|
-
return t.setUTCFullYear(e.year, e.month - 1, e.day), t.setUTCHours(0, 0, 0, 0), t;
|
|
827
|
-
}
|
|
828
|
-
function nt(e, t) {
|
|
829
|
-
const r = b(e);
|
|
830
|
-
return r.setUTCDate(r.getUTCDate() + t), {
|
|
831
|
-
year: r.getUTCFullYear(),
|
|
832
|
-
month: r.getUTCMonth() + 1,
|
|
833
|
-
day: r.getUTCDate()
|
|
834
|
-
};
|
|
835
|
-
}
|
|
836
|
-
function at(e, t) {
|
|
837
|
-
return e.year === t.year && e.month === t.month && e.day === t.day;
|
|
838
|
-
}
|
|
839
|
-
function B(e, t) {
|
|
840
|
-
return new Date(Date.UTC(e, t, 0)).getUTCDate();
|
|
841
|
-
}
|
|
842
|
-
function st(e) {
|
|
843
|
-
return e.year >= 1 && e.month >= 1 && e.month <= 12 && e.day >= 1 && e.day <= B(e.year, e.month);
|
|
844
|
-
}
|
|
845
|
-
export {
|
|
846
|
-
It as A,
|
|
847
|
-
Ce as B,
|
|
848
|
-
Fe as C,
|
|
849
|
-
Et as D,
|
|
850
|
-
ht as E,
|
|
851
|
-
St as M,
|
|
852
|
-
U as P,
|
|
853
|
-
qe as a,
|
|
854
|
-
Ee as b,
|
|
855
|
-
yt as c,
|
|
856
|
-
wt as d,
|
|
857
|
-
vt as e,
|
|
858
|
-
Rt as f,
|
|
859
|
-
De as g,
|
|
860
|
-
Re as h,
|
|
861
|
-
xt as i,
|
|
862
|
-
Ne as j,
|
|
863
|
-
Tt as k,
|
|
864
|
-
Me as l,
|
|
865
|
-
k as m,
|
|
866
|
-
Ye as n,
|
|
867
|
-
Be as o,
|
|
868
|
-
g as p,
|
|
869
|
-
$t as q,
|
|
870
|
-
_t as r,
|
|
871
|
-
Dt as s,
|
|
872
|
-
Nt as t,
|
|
873
|
-
Ft as u,
|
|
874
|
-
Ct as v,
|
|
875
|
-
We as w,
|
|
876
|
-
Mt as x,
|
|
877
|
-
bt as y,
|
|
878
|
-
kt as z
|
|
879
|
-
};
|