react-semaphor 0.1.537 → 0.1.539
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analytics-protocol/index.js +352 -341
- package/dist/assistant-context/index.js +10 -0
- package/dist/assistant-protocol/index.js +104 -0
- package/dist/brand-studio/index.js +35 -31
- package/dist/briefings/index.js +46 -45
- package/dist/chunks/_commonjsHelpers-BkfeUUK-.js +28 -0
- package/dist/chunks/add-to-dashboard-CxtTfISD.js +56 -0
- package/dist/chunks/aggregate-table-row-presentation-BjK9YfMI.js +979 -0
- package/dist/chunks/analytics-base-schemas-BFAoRlkU.js +472 -0
- package/dist/chunks/apply-dashboard-operations-C-iahGka.js +402 -0
- package/dist/chunks/assistant-chat-DgiSuFT4.js +8083 -0
- package/dist/chunks/availability-Bp5Gfu1I.js +44 -0
- package/dist/chunks/{bookmark-state-B-I9BDD0.js → bookmark-state-k7y5SNGf.js} +9 -9
- package/dist/chunks/{braces-8TRlDwDw.js → braces-o9UiRQes.js} +1 -1
- package/dist/chunks/calculated-field-identity-DcBS2NPP.js +2161 -0
- package/dist/chunks/calendar-day-equality-Bpl15IBo.js +487 -0
- package/dist/chunks/class-utils-Df1OVOT1.js +2315 -0
- package/dist/chunks/{field-dependencies-CpRUwr9J.js → common-types-CUf03Htv.js} +65 -58
- package/dist/chunks/context-HD9usB1P.js +349 -0
- package/dist/chunks/conversation-sQiWYUOb.js +16 -0
- package/dist/chunks/csv-utils-GUfKyT1J.js +56 -0
- package/dist/chunks/custom-visual-inputs-BrUOIwln.js +3288 -0
- package/dist/chunks/{dashboard-briefing-launcher-A2uVpHCp.js → dashboard-briefing-launcher-Bl3gCeBR.js} +580 -556
- package/dist/chunks/{dashboard-controls-DxTuVis_.js → dashboard-controls-0EX0HiJt.js} +683 -686
- package/dist/chunks/{common-types-g7yS12Cg.js → dashboard-filter-value-compatibility-D95O4nd7.js} +18 -24
- package/dist/chunks/dashboard-json-6X_2BDiL.js +69 -0
- package/dist/chunks/{dashboard-BPJo-Fnd.js → dashboard-y5BwcvzT.js} +1 -1
- package/dist/chunks/document-dashboard-inputs-BrYYlRVo.js +10678 -0
- package/dist/chunks/document-sheet-utils-C1eEldxs.js +1076 -0
- package/dist/chunks/{edit-dashboard-visual-ByV0OwSp.js → edit-dashboard-visual-Bzchfgga.js} +4744 -4746
- package/dist/chunks/editor-draft-sync-BN5qYHPF.js +15 -0
- package/dist/chunks/filter-value-text-BhWugPWE.js +163 -0
- package/dist/chunks/index-CqMiAkay.js +3164 -0
- package/dist/chunks/index-CuHybtft.js +51 -0
- package/dist/chunks/layout-grid-Bgzth8vd.js +16 -0
- package/dist/chunks/{matrix-analytical-definition-CgBTD6H8.js → matrix-analytical-definition-bcprSe4u.js} +1 -1
- package/dist/chunks/{matrix-card-CAdizkUl.js → matrix-card-CJn1hB5V.js} +13 -12
- package/dist/chunks/matrix-definition-DQDI2okF.js +206 -0
- package/dist/chunks/{matrix-formatter-DJCk8Znf.js → matrix-formatter-DQ8avoIQ.js} +648 -457
- package/dist/chunks/matrix-member-presentation-BNPSDKBG.js +105 -0
- package/dist/chunks/{matrix-operation-contract-BKupLHXL.js → matrix-operation-contract-B8PBF1Gd.js} +134 -133
- package/dist/chunks/{metric-comparison-BKHyvnAy.js → metric-comparison-CojWeLqx.js} +1 -1
- package/dist/chunks/{palette-Cp1hqZtm.js → palette-D10o_yYX.js} +1 -1
- package/dist/chunks/pivot-header-presentation-MkcKnjn3.js +42 -0
- package/dist/chunks/{pivot-result-identity-Bs4tLtLo.js → pivot-result-identity-D6hhcRXi.js} +1 -1
- package/dist/chunks/pivot-result-lifecycle-8qCDmpKc.js +804 -0
- package/dist/chunks/raw-temporal-D61lr48Y.js +1464 -0
- package/dist/chunks/{raw-temporal-contract-mLFS-9wk.js → raw-temporal-contract-C51YG48G.js} +1 -1
- package/dist/chunks/report-preferences-dialog-CWhSbc5_.js +1808 -0
- package/dist/chunks/{report-runtime-context-CG_I0PPW.js → report-runtime-context-B984Nq1E.js} +8 -7
- package/dist/chunks/save-CfJpQQ68.js +21 -0
- package/dist/chunks/saved-dashboard-context-Dqve2jlB.js +566 -0
- package/dist/chunks/{selection-reducer-CiDEtmAq.js → selection-reducer-vKIb_jS6.js} +2 -2
- package/dist/chunks/{semaphor-ready-indicator-CHu1L-lo.js → semaphor-ready-indicator-ldcwmLoY.js} +65803 -62954
- package/dist/chunks/{shelf-drop-preview-context-i-H6DFyU.js → shelf-drop-preview-context-BWxunXTq.js} +199 -196
- package/dist/chunks/{source-entity-resolution-C-oNyYMp.js → source-entity-resolution-CVA1a85c.js} +8 -8
- package/dist/chunks/switch-CvItuC1Q.js +8199 -0
- package/dist/chunks/{temporal-bucket-DlFuhCnT.js → temporal-bucket-D8JF7zKz.js} +86 -71
- package/dist/chunks/{temporal-bucket-contract-D2OuaVZ7.js → temporal-bucket-contract-DaOajRC7.js} +1 -1
- package/dist/chunks/{token-types-DtSJOUjh.js → token-types-bxUxXDX2.js} +1 -1
- package/dist/chunks/{upload-CAIpsti1.js → upload-BFX7apKV.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-Bj63WwHc.js → use-create-flow-overlay-state-RHgzVfcz.js} +331 -339
- package/dist/chunks/{validators-DMSH81OM.js → validators-Ej1DdCXa.js} +1050 -1510
- package/dist/chunks/visual-choice-JiJ-_3bi.js +204 -0
- package/dist/chunks/x-4f5U2XwU.js +100 -0
- package/dist/chunks/{zoned-wall-clock-1qlWCE20.js → zoned-wall-clock-MulfA26h.js} +2 -2
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +823 -661
- package/dist/data-app-sdk/index.js +32 -30
- package/dist/data-app-sdk-adapters/index.js +23 -22
- package/dist/data-app-sdk-validation/index.js +23 -22
- package/dist/format-utils/index.js +173 -168
- package/dist/index.js +267 -258
- package/dist/layouts/index.js +236 -24
- 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/assistant-context.d.ts +2 -0
- package/dist/types/assistant-protocol.d.ts +2 -0
- package/dist/types/components/assistant/assistant-entry-points.d.ts +18 -0
- package/dist/types/components/assistant/assistant-provider.d.ts +19 -0
- package/dist/types/components/assistant/assistant-store.d.ts +52 -0
- package/dist/types/components/assistant/use-assistant.d.ts +38 -0
- package/dist/types/components/index.d.ts +5 -1
- package/dist/types/components/surfboard/filter/types.d.ts +5 -2
- package/dist/types/index.js +50 -51
- package/dist/types/lib/api/invalidate-token.d.ts +7 -0
- package/dist/types/lib/charts/cartesian-fields.d.ts +64 -0
- package/dist/types/lib/charts/types.d.ts +7 -0
- package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-storage-transition.d.ts +14 -2
- package/dist/types/lib/dashboard-inputs/dashboard-input-target-context.d.ts +5 -6
- package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +8 -3
- package/dist/types/lib/dashboard-inputs/resolve-dashboard-input-context.d.ts +11 -6
- package/dist/types/lib/dashboard-pagination/dashboard-card-pagination.d.ts +7 -0
- package/dist/types/lib/dashboard-viewer/compatibility-input-storage.d.ts +79 -0
- package/dist/types/lib/dashboard-viewer/viewer-state.d.ts +3 -2
- package/dist/types/lib/document/document-table-data-policy.d.ts +15 -0
- package/dist/types/lib/filter-values/filter-mode.d.ts +22 -0
- package/dist/types/lib/hooks/use-calendar-context.d.ts +5 -0
- package/dist/types/lib/hooks/use-filter-option-browse.d.ts +5 -0
- package/dist/types/lib/hooks/use-text-filter.d.ts +9 -0
- package/dist/types/lib/print/print-inputs.d.ts +4 -2
- package/dist/types/lib/query-context/build-card-query-context.d.ts +12 -4
- package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +93 -0
- package/dist/types/lib/query-context/card-server-request.d.ts +72 -0
- package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +7 -0
- package/dist/types/lib/query-context/describe-card-execution-snapshot.d.ts +56 -0
- package/dist/types/lib/query-context/document-section-card-query.d.ts +45 -0
- package/dist/types/lib/query-context/resolve-runtime-card-filters.d.ts +17 -2
- package/dist/types/lib/stores/dashboard-store.d.ts +34 -11
- package/dist/types/lib/stores/editor-store.d.ts +4 -2
- package/dist/types/lib/types/token-types.d.ts +11 -0
- package/dist/types/lib/utils/card-type-change.d.ts +30 -0
- package/dist/types/lib/utils/comparison-window-caption.d.ts +12 -0
- package/dist/types/lib/utils/filter-default-value-utils.d.ts +13 -2
- package/dist/types/shared/analytics-protocol/applied-constraints.d.ts +74 -0
- package/dist/types/shared/analytics-protocol/contracts.d.ts +3 -0
- package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +43 -0
- package/dist/types/shared/analytics-protocol/index.d.ts +3 -0
- package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +1 -1
- package/dist/types/shared/analytics-protocol/visual-choice.d.ts +75 -0
- package/dist/types/shared/assistant-context/index.d.ts +9 -0
- package/dist/types/shared/assistant-context/project-context.d.ts +55 -0
- package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +130 -0
- package/dist/types/shared/assistant-protocol/add-to-dashboard.d.ts +17 -0
- package/dist/types/shared/assistant-protocol/artifact.d.ts +63 -0
- package/dist/types/shared/assistant-protocol/availability.d.ts +39 -0
- package/dist/types/shared/assistant-protocol/context.d.ts +952 -0
- package/dist/types/shared/assistant-protocol/conversation.d.ts +38 -0
- package/dist/types/shared/assistant-protocol/index.d.ts +16 -0
- package/dist/types/shared/assistant-protocol/limits.d.ts +53 -0
- package/dist/types/shared/assistant-protocol/parts.d.ts +140 -0
- package/dist/types/shared/assistant-protocol/request.d.ts +77 -0
- package/dist/types/shared/assistant-protocol/sources.d.ts +27 -0
- package/dist/types/shared/assistant-protocol/token-config.d.ts +32 -0
- package/dist/types/shared/assistant-protocol/transcript.d.ts +40 -0
- package/dist/types/shared/dashboard-authoring/card-query-request.d.ts +112 -0
- package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +1794 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +5 -0
- package/dist/types/shared/dashboard-authoring/new-card.d.ts +10 -0
- package/dist/types/shared/dashboard-authoring/operations/apply-dashboard-operations.d.ts +40 -0
- package/dist/types/shared/dashboard-authoring/resolved-primary-date-field-validation.d.ts +16 -0
- package/dist/types/shared/format-utils/filter-detail.d.ts +70 -0
- package/dist/types/shared/format-utils/filter-value-text.d.ts +15 -0
- package/dist/types/shared/format-utils/index.d.ts +3 -0
- package/dist/types/shared/format-utils/raw-temporal.d.ts +7 -0
- package/dist/types/shared/format-utils/temporal-bucket.d.ts +7 -0
- package/dist/types/shared/layouts/frame-layouts.d.ts +23 -0
- package/dist/types/shared/layouts/index.d.ts +1 -0
- package/package.json +12 -2
- package/dist/chunks/calculated-field-identity-BptYhyOP.js +0 -1326
- package/dist/chunks/calendar-day-equality-BRjN1S9h.js +0 -383
- package/dist/chunks/card-config-utils-BOM1dxCk.js +0 -1150
- package/dist/chunks/constants-DNWVy8Y3.js +0 -9
- package/dist/chunks/dashboard-json-B1dEQu98.js +0 -65
- package/dist/chunks/field-aggregations-CoLzYHeL.js +0 -1229
- package/dist/chunks/index-DTcTAGGM.js +0 -4101
- package/dist/chunks/matrix-continuation-C4sRcjZU.js +0 -72
- package/dist/chunks/matrix-control-sources-DTqcA2_L.js +0 -636
- package/dist/chunks/matrix-definition-D9iShKZI.js +0 -87
- package/dist/chunks/matrix-member-presentation-Ct8GuxHt.js +0 -209
- package/dist/chunks/numeric-presentation-CWu3gunq.js +0 -537
- package/dist/chunks/pivot-header-presentation-CHs2GFrM.js +0 -753
- package/dist/chunks/pivot-result-lifecycle-DQz_gjGu.js +0 -789
- package/dist/chunks/raw-temporal-iMXRK-Qz.js +0 -930
- package/dist/chunks/report-preferences-dialog-DXPjteCU.js +0 -1623
- package/dist/chunks/save-kO6cIaob.js +0 -34
- package/dist/chunks/semantic-format-DiqYeKwU.js +0 -192
- package/dist/chunks/switch-DO8a0EfJ.js +0 -25004
- package/dist/chunks/temporal-input-presentation-BD7YNUzu.js +0 -195
- package/dist/chunks/x-CXDkqdur.js +0 -149
- package/dist/types/lib/class-utils.d.ts +0 -2
- package/dist/types/lib/document/document-input-runtime.d.ts +0 -26
- package/dist/types/lib/utils.d.ts +0 -51
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var w = (e, t, r) =>
|
|
1
|
+
var q = Object.defineProperty;
|
|
2
|
+
var x = (e, t, r) => t in e ? q(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var w = (e, t, r) => x(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
4
|
import { canonicalizeSupportedLocale as E } from "../value-format-preferences/index.js";
|
|
5
|
+
const ue = 6048e5, le = 864e5, me = 6e4, de = 36e5, fe = 525600, pe = 43200, ye = 1440;
|
|
5
6
|
function f(e) {
|
|
6
7
|
if (e === null || typeof e != "object" || Array.isArray(e))
|
|
7
8
|
return !1;
|
|
@@ -31,10 +32,10 @@ const N = [
|
|
|
31
32
|
fiscal_quarter_short: "quarter",
|
|
32
33
|
fiscal_year: "year"
|
|
33
34
|
};
|
|
34
|
-
function
|
|
35
|
+
function U(e) {
|
|
35
36
|
return typeof e == "string" && Object.prototype.hasOwnProperty.call(P, e);
|
|
36
37
|
}
|
|
37
|
-
function
|
|
38
|
+
function j(e, t) {
|
|
38
39
|
return N.find(
|
|
39
40
|
(r) => e.startsWith(r, t)
|
|
40
41
|
);
|
|
@@ -50,7 +51,7 @@ function M(e) {
|
|
|
50
51
|
const t = [];
|
|
51
52
|
let r = 0, n = !1;
|
|
52
53
|
for (; r < e.length; ) {
|
|
53
|
-
const s =
|
|
54
|
+
const s = j(e, r);
|
|
54
55
|
if (s) {
|
|
55
56
|
if (n)
|
|
56
57
|
return {
|
|
@@ -74,8 +75,8 @@ function M(e) {
|
|
|
74
75
|
code: "invalid_temporal_bucket_pattern",
|
|
75
76
|
message: "Temporal bucket patterns cannot begin with a separator."
|
|
76
77
|
};
|
|
77
|
-
const
|
|
78
|
-
|
|
78
|
+
const c = t[t.length - 1];
|
|
79
|
+
c.kind === "literal" ? c.value += o : t.push({ kind: "literal", value: o }), r += 1, n = !1;
|
|
79
80
|
}
|
|
80
81
|
return ((a = t[t.length - 1]) == null ? void 0 : a.kind) !== "token" ? {
|
|
81
82
|
ok: !1,
|
|
@@ -83,7 +84,7 @@ function M(e) {
|
|
|
83
84
|
message: "Temporal bucket patterns cannot end with a separator."
|
|
84
85
|
} : { ok: !0, segments: t };
|
|
85
86
|
}
|
|
86
|
-
function
|
|
87
|
+
function I(e) {
|
|
87
88
|
return e.flatMap(
|
|
88
89
|
(t) => t.kind === "token" ? [t.value] : []
|
|
89
90
|
);
|
|
@@ -94,28 +95,28 @@ function v(e, t) {
|
|
|
94
95
|
function y(e, t) {
|
|
95
96
|
return e.some((r) => t.includes(r));
|
|
96
97
|
}
|
|
97
|
-
function
|
|
98
|
+
function B(e) {
|
|
98
99
|
return new Set(e).size !== e.length;
|
|
99
100
|
}
|
|
100
|
-
function
|
|
101
|
-
if (
|
|
102
|
-
const r = ["YYYY", "YY"], n = ["MMMM", "MMM", "MM"], a = ["HH", "mm", "ss"], s = v(e, r), o = v(e, n),
|
|
101
|
+
function R(e, t) {
|
|
102
|
+
if (B(e)) return !1;
|
|
103
|
+
const r = ["YYYY", "YY"], n = ["MMMM", "MMM", "MM"], a = ["HH", "mm", "ss"], s = v(e, r), o = v(e, n), c = e.includes("DD"), i = y(e, a);
|
|
103
104
|
switch (t) {
|
|
104
105
|
case "second":
|
|
105
|
-
return e.includes("HH") && e.includes("mm") && e.includes("ss") && (!y(e, [...r, ...n, "DD"]) || s && o &&
|
|
106
|
+
return e.includes("HH") && e.includes("mm") && e.includes("ss") && (!y(e, [...r, ...n, "DD"]) || s && o && c);
|
|
106
107
|
case "minute":
|
|
107
|
-
return e.includes("HH") && e.includes("mm") && (!y(e, [...r, ...n, "DD"]) || s && o &&
|
|
108
|
+
return e.includes("HH") && e.includes("mm") && (!y(e, [...r, ...n, "DD"]) || s && o && c);
|
|
108
109
|
case "hour":
|
|
109
|
-
return e.includes("HH") && (!y(e, [...r, ...n, "DD"]) || s && o &&
|
|
110
|
+
return e.includes("HH") && (!y(e, [...r, ...n, "DD"]) || s && o && c);
|
|
110
111
|
case "day":
|
|
111
112
|
case "week":
|
|
112
|
-
return s && o &&
|
|
113
|
+
return s && o && c && !i;
|
|
113
114
|
case "month":
|
|
114
|
-
return s && o && !
|
|
115
|
+
return s && o && !c && !i;
|
|
115
116
|
case "quarter":
|
|
116
117
|
return !1;
|
|
117
118
|
case "year":
|
|
118
|
-
return s && !o && !
|
|
119
|
+
return s && !o && !c && !i;
|
|
119
120
|
}
|
|
120
121
|
}
|
|
121
122
|
function O(e, t) {
|
|
@@ -130,8 +131,8 @@ function O(e, t) {
|
|
|
130
131
|
};
|
|
131
132
|
}
|
|
132
133
|
const r = M(e.presentation.pattern);
|
|
133
|
-
return r.ok ?
|
|
134
|
-
|
|
134
|
+
return r.ok ? R(
|
|
135
|
+
I(r.segments),
|
|
135
136
|
t
|
|
136
137
|
) ? { ok: !0, segments: r.segments } : {
|
|
137
138
|
ok: !1,
|
|
@@ -139,7 +140,7 @@ function O(e, t) {
|
|
|
139
140
|
message: `Pattern ${e.presentation.pattern} is not compatible with ${t} granularity.`
|
|
140
141
|
} : r;
|
|
141
142
|
}
|
|
142
|
-
function
|
|
143
|
+
function he(e, t) {
|
|
143
144
|
if (!(!e || !t))
|
|
144
145
|
return O(e, t).ok ? e : void 0;
|
|
145
146
|
}
|
|
@@ -154,7 +155,7 @@ class h extends Error {
|
|
|
154
155
|
this.name = "TemporalBucketContractError", this.code = r;
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
|
-
const
|
|
158
|
+
const z = [
|
|
158
159
|
"Jan",
|
|
159
160
|
"Feb",
|
|
160
161
|
"Mar",
|
|
@@ -167,7 +168,7 @@ const J = [
|
|
|
167
168
|
"Oct",
|
|
168
169
|
"Nov",
|
|
169
170
|
"Dec"
|
|
170
|
-
],
|
|
171
|
+
], J = [
|
|
171
172
|
"January",
|
|
172
173
|
"February",
|
|
173
174
|
"March",
|
|
@@ -181,7 +182,7 @@ const J = [
|
|
|
181
182
|
"November",
|
|
182
183
|
"December"
|
|
183
184
|
];
|
|
184
|
-
function
|
|
185
|
+
function T(e) {
|
|
185
186
|
return {
|
|
186
187
|
ok: !1,
|
|
187
188
|
error: { code: "invalid_temporal_bucket_value", message: e }
|
|
@@ -197,7 +198,7 @@ function G(e, t, r) {
|
|
|
197
198
|
const n = [0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4], a = t < 3 ? e - 1 : e;
|
|
198
199
|
return (a + Math.floor(a / 4) - Math.floor(a / 100) + Math.floor(a / 400) + n[t - 1] + r) % 7;
|
|
199
200
|
}
|
|
200
|
-
function
|
|
201
|
+
function _(e) {
|
|
201
202
|
var t;
|
|
202
203
|
return (t = e.calendar.fiscalCalendar) == null ? void 0 : t.yearStartMonth;
|
|
203
204
|
}
|
|
@@ -205,7 +206,7 @@ function K(e, t) {
|
|
|
205
206
|
return (e - t + 12) % 12 % 3 === 0;
|
|
206
207
|
}
|
|
207
208
|
function Q(e, t) {
|
|
208
|
-
const { granularity: r } = t, n =
|
|
209
|
+
const { granularity: r } = t, n = _(t) ?? 1;
|
|
209
210
|
switch (r) {
|
|
210
211
|
case "second":
|
|
211
212
|
return !0;
|
|
@@ -229,7 +230,7 @@ function V(e, t) {
|
|
|
229
230
|
if (e === null) return { ok: !0, value: null };
|
|
230
231
|
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);
|
|
231
232
|
if (!n)
|
|
232
|
-
return
|
|
233
|
+
return T(
|
|
233
234
|
`Expected ${r ? "YYYY-MM-DDTHH:mm:ss" : "YYYY-MM-DD"} for ${t.granularity} granularity.`
|
|
234
235
|
);
|
|
235
236
|
const a = {
|
|
@@ -240,10 +241,16 @@ function V(e, t) {
|
|
|
240
241
|
minute: r ? Number(n[5]) : 0,
|
|
241
242
|
second: r ? Number(n[6]) : 0
|
|
242
243
|
};
|
|
243
|
-
return a.year < 1 || a.month < 1 || a.month > 12 || a.day < 1 || a.day > W(a.year, a.month) || a.hour > 23 || a.minute > 59 || a.second > 59 ?
|
|
244
|
+
return a.year < 1 || a.month < 1 || a.month > 12 || a.day < 1 || a.day > W(a.year, a.month) || a.hour > 23 || a.minute > 59 || a.second > 59 ? T(`Invalid canonical ${t.granularity} bucket value ${e}.`) : Q(a, t) ? { ok: !0, value: a } : T(
|
|
244
245
|
`Canonical value ${e} is not aligned to ${t.granularity} granularity and its governed Calendar.`
|
|
245
246
|
);
|
|
246
247
|
}
|
|
248
|
+
function ke(e) {
|
|
249
|
+
const { granularity: t, calendar: r } = e, n = (o, c) => new Intl.DateTimeFormat("en-US", { ...o, timeZone: "UTC" }).format(c), a = [`by ${t} in the ${r.tz} calendar`];
|
|
250
|
+
t === "week" && a.push(`weeks starting on ${n({ weekday: "long" }, new Date(Date.UTC(2023, 0, 1 + r.weekStart)))}`);
|
|
251
|
+
const s = _(e);
|
|
252
|
+
return s && (t === "quarter" || t === "year") && a.push(`the fiscal year starting in ${n({ month: "long" }, new Date(Date.UTC(2e3, s - 1, 1)))}`), `${a.join(", ")}; each value is a bucket's start`;
|
|
253
|
+
}
|
|
247
254
|
function X(e) {
|
|
248
255
|
if (!f(e))
|
|
249
256
|
return {
|
|
@@ -258,34 +265,34 @@ function X(e) {
|
|
|
258
265
|
if (!f(n))
|
|
259
266
|
t.push({ path: "presentation", message: "Expected a presentation object." });
|
|
260
267
|
else {
|
|
261
|
-
const o = n.mode,
|
|
262
|
-
for (const
|
|
263
|
-
|
|
264
|
-
path: `presentation.${
|
|
265
|
-
message: `Unknown property "${
|
|
268
|
+
const o = n.mode, c = 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"]);
|
|
269
|
+
for (const i of Object.keys(n))
|
|
270
|
+
c.has(i) || t.push({
|
|
271
|
+
path: `presentation.${i}`,
|
|
272
|
+
message: `Unknown property "${i}".`
|
|
266
273
|
});
|
|
267
274
|
if (o === "preset")
|
|
268
|
-
|
|
275
|
+
U(n.preset) || t.push({ path: "presentation.preset", message: "Expected a supported preset." });
|
|
269
276
|
else if (o === "pattern")
|
|
270
277
|
if (typeof n.pattern != "string" || !n.pattern)
|
|
271
278
|
t.push({ path: "presentation.pattern", message: "Expected a non-empty pattern." });
|
|
272
279
|
else {
|
|
273
|
-
const
|
|
274
|
-
|
|
280
|
+
const i = M(n.pattern);
|
|
281
|
+
i.ok || t.push({
|
|
275
282
|
path: "presentation.pattern",
|
|
276
|
-
message:
|
|
283
|
+
message: i.message
|
|
277
284
|
});
|
|
278
285
|
}
|
|
279
286
|
else if (o === "auto") {
|
|
280
|
-
const
|
|
281
|
-
(!f(
|
|
282
|
-
String(
|
|
287
|
+
const i = n.styles;
|
|
288
|
+
(!f(i) || !["short", "medium", "long"].includes(String(i.dateStyle)) || !f(i.dateTime) || !["short", "medium", "long"].includes(
|
|
289
|
+
String(i.dateTime.dateStyle)
|
|
283
290
|
) || !["short", "medium", "long"].includes(
|
|
284
|
-
String(
|
|
285
|
-
) || Object.keys(
|
|
286
|
-
(
|
|
287
|
-
) || Object.keys(
|
|
288
|
-
(
|
|
291
|
+
String(i.dateTime.timeStyle)
|
|
292
|
+
) || Object.keys(i).some(
|
|
293
|
+
(u) => u !== "dateStyle" && u !== "dateTime"
|
|
294
|
+
) || Object.keys(i.dateTime).some(
|
|
295
|
+
(u) => u !== "dateStyle" && u !== "timeStyle"
|
|
289
296
|
)) && t.push({
|
|
290
297
|
path: "presentation.styles",
|
|
291
298
|
message: "Expected complete resolved date and datetime styles."
|
|
@@ -338,11 +345,11 @@ function ee(e, t) {
|
|
|
338
345
|
function F(e, t) {
|
|
339
346
|
return O(e, t.granularity).ok ? e.presentation.mode === "preset" ? ee(e.presentation.preset, t) : !(e.presentation.mode === "pattern" && t.calendar.fiscalCalendar && (t.granularity === "quarter" || t.granularity === "year")) : !1;
|
|
340
347
|
}
|
|
341
|
-
function
|
|
348
|
+
function D(e, t) {
|
|
342
349
|
if (!(!e || e.presentation.mode === "auto"))
|
|
343
350
|
return F(e, t) ? { type: "temporal_bucket", presentation: e.presentation } : void 0;
|
|
344
351
|
}
|
|
345
|
-
function
|
|
352
|
+
function ge(e) {
|
|
346
353
|
var a;
|
|
347
354
|
const t = E(e.locale);
|
|
348
355
|
if (!t)
|
|
@@ -350,10 +357,10 @@ function le(e) {
|
|
|
350
357
|
"invalid_temporal_bucket_format",
|
|
351
358
|
"Temporal bucket locale must be a supported base BCP 47 locale."
|
|
352
359
|
);
|
|
353
|
-
const r =
|
|
360
|
+
const r = D(e.cardFormat, e.metadata);
|
|
354
361
|
if (r)
|
|
355
362
|
return { format: { ...r, locale: t }, source: "card" };
|
|
356
|
-
const n = ((a = e.semanticFormat) == null ? void 0 : a.granularity) === e.metadata.granularity ?
|
|
363
|
+
const n = ((a = e.semanticFormat) == null ? void 0 : a.granularity) === e.metadata.granularity ? D(e.semanticFormat.format, e.metadata) : void 0;
|
|
357
364
|
return n ? { format: { ...n, locale: t }, source: "semantic" } : {
|
|
358
365
|
format: {
|
|
359
366
|
type: "temporal_bucket",
|
|
@@ -371,7 +378,7 @@ function m(e, t = 2) {
|
|
|
371
378
|
}
|
|
372
379
|
function k(e, t, r) {
|
|
373
380
|
if (t === "en-US")
|
|
374
|
-
return (r === "short" ?
|
|
381
|
+
return (r === "short" ? z : J)[e - 1];
|
|
375
382
|
const n = new Date(Date.UTC(2e3, e - 1, 15));
|
|
376
383
|
return new Intl.DateTimeFormat(t, {
|
|
377
384
|
calendar: "gregory",
|
|
@@ -415,7 +422,7 @@ function g(e) {
|
|
|
415
422
|
const t = /* @__PURE__ */ new Date(0);
|
|
416
423
|
return t.setUTCFullYear(e.year, e.month - 1, e.day), t.setUTCHours(e.hour, e.minute, e.second, 0), t;
|
|
417
424
|
}
|
|
418
|
-
function
|
|
425
|
+
function Y(e, t, r) {
|
|
419
426
|
return p(t, {
|
|
420
427
|
calendar: "gregory",
|
|
421
428
|
dateStyle: r,
|
|
@@ -439,15 +446,15 @@ function ne(e, t, r) {
|
|
|
439
446
|
calendar: "gregory",
|
|
440
447
|
dateStyle: "short",
|
|
441
448
|
timeZone: "UTC"
|
|
442
|
-
}).formatToParts(s),
|
|
449
|
+
}).formatToParts(s), c = o.findIndex((l) => l.type === "month"), i = o.findIndex((l) => l.type === "year"), u = (a = p(t, {
|
|
443
450
|
calendar: "gregory",
|
|
444
451
|
timeZone: "UTC",
|
|
445
452
|
year: "numeric"
|
|
446
453
|
}).formatToParts(s).find((l) => l.type === "year")) == null ? void 0 : a.value;
|
|
447
|
-
if (
|
|
448
|
-
const l = Math.min(
|
|
449
|
-
let
|
|
450
|
-
return o.slice(l,
|
|
454
|
+
if (c >= 0 && i >= 0 && u) {
|
|
455
|
+
const l = Math.min(c, i), C = Math.max(c, i);
|
|
456
|
+
let b = !1;
|
|
457
|
+
return o.slice(l, C + 1).filter((d) => d.type === "day" ? (b = !0, !1) : b && d.type === "literal" ? (b = !1, !1) : !0).map((d) => d.type === "year" ? u : d.value).join("");
|
|
451
458
|
}
|
|
452
459
|
}
|
|
453
460
|
return p(t, {
|
|
@@ -466,8 +473,8 @@ function A(e, t) {
|
|
|
466
473
|
function oe(e) {
|
|
467
474
|
return e === 1 ? "1st" : e === 2 ? "2nd" : e === 3 ? "3rd" : `${e}th`;
|
|
468
475
|
}
|
|
469
|
-
function
|
|
470
|
-
const a =
|
|
476
|
+
function S(e, t, r, n) {
|
|
477
|
+
const a = _(n) ?? 1, s = ae(e, a);
|
|
471
478
|
switch (t) {
|
|
472
479
|
case "week_of_short":
|
|
473
480
|
return `Week of ${k(e.month, r, "short")} ${e.day}, ${e.year}`;
|
|
@@ -484,30 +491,30 @@ function T(e, t, r, n) {
|
|
|
484
491
|
}
|
|
485
492
|
}
|
|
486
493
|
function se(e, t, r, n) {
|
|
487
|
-
const a =
|
|
494
|
+
const a = _(t);
|
|
488
495
|
switch (t.granularity) {
|
|
489
496
|
case "second":
|
|
490
497
|
case "minute":
|
|
491
498
|
case "hour":
|
|
492
499
|
return re(e, r, n.dateTime);
|
|
493
500
|
case "day":
|
|
494
|
-
return
|
|
501
|
+
return Y(e, r, n.dateStyle);
|
|
495
502
|
case "week":
|
|
496
|
-
return `Week of ${
|
|
503
|
+
return `Week of ${Y(e, r, n.dateStyle)}`;
|
|
497
504
|
case "month":
|
|
498
505
|
return ne(e, r, n.dateStyle);
|
|
499
506
|
case "quarter":
|
|
500
|
-
return
|
|
507
|
+
return S(
|
|
501
508
|
e,
|
|
502
509
|
a ? "fiscal_quarter_short" : "quarter_short",
|
|
503
510
|
r,
|
|
504
511
|
t
|
|
505
512
|
);
|
|
506
513
|
case "year":
|
|
507
|
-
return a ?
|
|
514
|
+
return a ? S(e, "fiscal_year", r, t) : String(e.year);
|
|
508
515
|
}
|
|
509
516
|
}
|
|
510
|
-
function
|
|
517
|
+
function _e(e) {
|
|
511
518
|
const t = X(e.format);
|
|
512
519
|
if (!t.ok || !F(t.value, e.metadata))
|
|
513
520
|
throw new h(
|
|
@@ -530,7 +537,7 @@ function me(e) {
|
|
|
530
537
|
n.styles
|
|
531
538
|
);
|
|
532
539
|
if (n.mode === "preset")
|
|
533
|
-
return
|
|
540
|
+
return S(
|
|
534
541
|
r.value,
|
|
535
542
|
n.preset,
|
|
536
543
|
a,
|
|
@@ -549,12 +556,20 @@ export {
|
|
|
549
556
|
N as T,
|
|
550
557
|
h as a,
|
|
551
558
|
X as b,
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
me as
|
|
555
|
-
|
|
559
|
+
ge as c,
|
|
560
|
+
ke as d,
|
|
561
|
+
me as e,
|
|
562
|
+
_e as f,
|
|
563
|
+
f as g,
|
|
564
|
+
ye as h,
|
|
565
|
+
U as i,
|
|
566
|
+
pe as j,
|
|
567
|
+
fe as k,
|
|
568
|
+
le as l,
|
|
569
|
+
de as m,
|
|
570
|
+
ue as n,
|
|
556
571
|
V as p,
|
|
557
|
-
|
|
572
|
+
he as r,
|
|
558
573
|
M as t,
|
|
559
574
|
O as v
|
|
560
575
|
};
|