react-semaphor 0.1.537 → 0.1.538

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.
Files changed (173) hide show
  1. package/dist/analytics-protocol/index.js +352 -341
  2. package/dist/assistant-context/index.js +10 -0
  3. package/dist/assistant-protocol/index.js +104 -0
  4. package/dist/brand-studio/index.js +35 -31
  5. package/dist/briefings/index.js +46 -45
  6. package/dist/chunks/_commonjsHelpers-BkfeUUK-.js +28 -0
  7. package/dist/chunks/add-to-dashboard-CxtTfISD.js +56 -0
  8. package/dist/chunks/aggregate-table-row-presentation-Qgpv6_G8.js +979 -0
  9. package/dist/chunks/analytics-base-schemas-BFAoRlkU.js +472 -0
  10. package/dist/chunks/apply-dashboard-operations-C-iahGka.js +402 -0
  11. package/dist/chunks/assistant-chat-BAqUIFp5.js +7966 -0
  12. package/dist/chunks/availability-Bp5Gfu1I.js +44 -0
  13. package/dist/chunks/{bookmark-state-B-I9BDD0.js → bookmark-state-k7y5SNGf.js} +9 -9
  14. package/dist/chunks/{braces-8TRlDwDw.js → braces-o9UiRQes.js} +1 -1
  15. package/dist/chunks/calculated-field-identity-DcBS2NPP.js +2161 -0
  16. package/dist/chunks/calendar-day-equality-Bpl15IBo.js +487 -0
  17. package/dist/chunks/class-utils-Df1OVOT1.js +2315 -0
  18. package/dist/chunks/{field-dependencies-CpRUwr9J.js → common-types-CUf03Htv.js} +65 -58
  19. package/dist/chunks/context-HD9usB1P.js +349 -0
  20. package/dist/chunks/conversation-sQiWYUOb.js +16 -0
  21. package/dist/chunks/csv-utils-GUfKyT1J.js +56 -0
  22. package/dist/chunks/custom-visual-inputs-BrUOIwln.js +3288 -0
  23. package/dist/chunks/{dashboard-BPJo-Fnd.js → dashboard-DTDDFQsS.js} +1 -1
  24. package/dist/chunks/{dashboard-briefing-launcher-A2uVpHCp.js → dashboard-briefing-launcher-Bb2QUqOa.js} +764 -740
  25. package/dist/chunks/{dashboard-controls-DxTuVis_.js → dashboard-controls-FpONU8QV.js} +683 -686
  26. package/dist/chunks/{common-types-g7yS12Cg.js → dashboard-filter-value-compatibility-D95O4nd7.js} +18 -24
  27. package/dist/chunks/dashboard-json-DazPhBU_.js +69 -0
  28. package/dist/chunks/document-dashboard-inputs-D96rlU7S.js +10678 -0
  29. package/dist/chunks/document-sheet-utils-C1eEldxs.js +1076 -0
  30. package/dist/chunks/{edit-dashboard-visual-ByV0OwSp.js → edit-dashboard-visual-CIhZodVH.js} +4744 -4746
  31. package/dist/chunks/editor-draft-sync-BN5qYHPF.js +15 -0
  32. package/dist/chunks/filter-value-text-BhWugPWE.js +163 -0
  33. package/dist/chunks/index-CqMiAkay.js +3164 -0
  34. package/dist/chunks/index-CuHybtft.js +51 -0
  35. package/dist/chunks/layout-grid-Bgzth8vd.js +16 -0
  36. package/dist/chunks/{matrix-analytical-definition-CgBTD6H8.js → matrix-analytical-definition-bcprSe4u.js} +1 -1
  37. package/dist/chunks/{matrix-card-CAdizkUl.js → matrix-card-CJn1hB5V.js} +13 -12
  38. package/dist/chunks/matrix-definition-DQDI2okF.js +206 -0
  39. package/dist/chunks/{matrix-formatter-DJCk8Znf.js → matrix-formatter-Bgw32tb3.js} +648 -457
  40. package/dist/chunks/matrix-member-presentation-BNPSDKBG.js +105 -0
  41. package/dist/chunks/{matrix-operation-contract-BKupLHXL.js → matrix-operation-contract-B8PBF1Gd.js} +134 -133
  42. package/dist/chunks/{metric-comparison-BKHyvnAy.js → metric-comparison-CojWeLqx.js} +1 -1
  43. package/dist/chunks/{palette-Cp1hqZtm.js → palette-D10o_yYX.js} +1 -1
  44. package/dist/chunks/pivot-header-presentation-MkcKnjn3.js +42 -0
  45. package/dist/chunks/{pivot-result-identity-Bs4tLtLo.js → pivot-result-identity-D6hhcRXi.js} +1 -1
  46. package/dist/chunks/pivot-result-lifecycle-8qCDmpKc.js +804 -0
  47. package/dist/chunks/raw-temporal-D61lr48Y.js +1464 -0
  48. package/dist/chunks/{raw-temporal-contract-mLFS-9wk.js → raw-temporal-contract-C51YG48G.js} +1 -1
  49. package/dist/chunks/report-preferences-dialog-BCGs4-AE.js +1808 -0
  50. package/dist/chunks/{report-runtime-context-CG_I0PPW.js → report-runtime-context-B984Nq1E.js} +8 -7
  51. package/dist/chunks/save-CfJpQQ68.js +21 -0
  52. package/dist/chunks/saved-dashboard-context-BrTkjcod.js +566 -0
  53. package/dist/chunks/{selection-reducer-CiDEtmAq.js → selection-reducer-vKIb_jS6.js} +2 -2
  54. package/dist/chunks/{semaphor-ready-indicator-CHu1L-lo.js → semaphor-ready-indicator-CHHoWhil.js} +65586 -62749
  55. package/dist/chunks/{shelf-drop-preview-context-i-H6DFyU.js → shelf-drop-preview-context-EsayECEC.js} +199 -196
  56. package/dist/chunks/{source-entity-resolution-C-oNyYMp.js → source-entity-resolution-CVA1a85c.js} +8 -8
  57. package/dist/chunks/switch-CvItuC1Q.js +8199 -0
  58. package/dist/chunks/{temporal-bucket-DlFuhCnT.js → temporal-bucket-D8JF7zKz.js} +86 -71
  59. package/dist/chunks/{temporal-bucket-contract-D2OuaVZ7.js → temporal-bucket-contract-DaOajRC7.js} +1 -1
  60. package/dist/chunks/{token-types-DtSJOUjh.js → token-types-bxUxXDX2.js} +1 -1
  61. package/dist/chunks/{upload-CAIpsti1.js → upload-BFX7apKV.js} +1 -1
  62. package/dist/chunks/{use-create-flow-overlay-state-Bj63WwHc.js → use-create-flow-overlay-state-BqA92GkX.js} +331 -339
  63. package/dist/chunks/{validators-DMSH81OM.js → validators-Ej1DdCXa.js} +1050 -1510
  64. package/dist/chunks/visual-choice-JiJ-_3bi.js +204 -0
  65. package/dist/chunks/x-4f5U2XwU.js +100 -0
  66. package/dist/chunks/{zoned-wall-clock-1qlWCE20.js → zoned-wall-clock-MulfA26h.js} +2 -2
  67. package/dist/dashboard/index.js +2 -2
  68. package/dist/dashboard-authoring/index.js +823 -661
  69. package/dist/data-app-sdk/index.js +32 -30
  70. package/dist/data-app-sdk-adapters/index.js +23 -22
  71. package/dist/data-app-sdk-validation/index.js +23 -22
  72. package/dist/format-utils/index.js +173 -168
  73. package/dist/index.js +267 -258
  74. package/dist/layouts/index.js +236 -24
  75. package/dist/report-runtime-context/index.js +2 -2
  76. package/dist/style.css +1 -1
  77. package/dist/surfboard/index.js +2 -2
  78. package/dist/types/assistant-context.d.ts +2 -0
  79. package/dist/types/assistant-protocol.d.ts +2 -0
  80. package/dist/types/components/assistant/assistant-entry-points.d.ts +18 -0
  81. package/dist/types/components/assistant/assistant-provider.d.ts +19 -0
  82. package/dist/types/components/assistant/assistant-store.d.ts +52 -0
  83. package/dist/types/components/assistant/use-assistant.d.ts +38 -0
  84. package/dist/types/components/index.d.ts +5 -1
  85. package/dist/types/components/surfboard/filter/types.d.ts +5 -2
  86. package/dist/types/index.js +50 -51
  87. package/dist/types/lib/api/invalidate-token.d.ts +7 -0
  88. package/dist/types/lib/charts/cartesian-fields.d.ts +64 -0
  89. package/dist/types/lib/charts/types.d.ts +7 -0
  90. package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-storage-transition.d.ts +14 -2
  91. package/dist/types/lib/dashboard-inputs/dashboard-input-target-context.d.ts +5 -6
  92. package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +8 -3
  93. package/dist/types/lib/dashboard-inputs/resolve-dashboard-input-context.d.ts +11 -6
  94. package/dist/types/lib/dashboard-pagination/dashboard-card-pagination.d.ts +7 -0
  95. package/dist/types/lib/dashboard-viewer/compatibility-input-storage.d.ts +79 -0
  96. package/dist/types/lib/dashboard-viewer/viewer-state.d.ts +3 -2
  97. package/dist/types/lib/document/document-table-data-policy.d.ts +15 -0
  98. package/dist/types/lib/filter-values/filter-mode.d.ts +22 -0
  99. package/dist/types/lib/hooks/use-calendar-context.d.ts +5 -0
  100. package/dist/types/lib/hooks/use-text-filter.d.ts +7 -0
  101. package/dist/types/lib/print/print-inputs.d.ts +4 -2
  102. package/dist/types/lib/query-context/build-card-query-context.d.ts +12 -4
  103. package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +93 -0
  104. package/dist/types/lib/query-context/card-server-request.d.ts +72 -0
  105. package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +7 -0
  106. package/dist/types/lib/query-context/describe-card-execution-snapshot.d.ts +56 -0
  107. package/dist/types/lib/query-context/document-section-card-query.d.ts +45 -0
  108. package/dist/types/lib/query-context/resolve-runtime-card-filters.d.ts +17 -2
  109. package/dist/types/lib/stores/dashboard-store.d.ts +34 -11
  110. package/dist/types/lib/stores/editor-store.d.ts +4 -2
  111. package/dist/types/lib/types/token-types.d.ts +11 -0
  112. package/dist/types/lib/utils/card-type-change.d.ts +30 -0
  113. package/dist/types/lib/utils/comparison-window-caption.d.ts +12 -0
  114. package/dist/types/lib/utils/filter-default-value-utils.d.ts +13 -2
  115. package/dist/types/shared/analytics-protocol/applied-constraints.d.ts +74 -0
  116. package/dist/types/shared/analytics-protocol/contracts.d.ts +3 -0
  117. package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +43 -0
  118. package/dist/types/shared/analytics-protocol/index.d.ts +3 -0
  119. package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +1 -1
  120. package/dist/types/shared/analytics-protocol/visual-choice.d.ts +75 -0
  121. package/dist/types/shared/assistant-context/index.d.ts +9 -0
  122. package/dist/types/shared/assistant-context/project-context.d.ts +55 -0
  123. package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +130 -0
  124. package/dist/types/shared/assistant-protocol/add-to-dashboard.d.ts +17 -0
  125. package/dist/types/shared/assistant-protocol/artifact.d.ts +63 -0
  126. package/dist/types/shared/assistant-protocol/availability.d.ts +39 -0
  127. package/dist/types/shared/assistant-protocol/context.d.ts +952 -0
  128. package/dist/types/shared/assistant-protocol/conversation.d.ts +38 -0
  129. package/dist/types/shared/assistant-protocol/index.d.ts +16 -0
  130. package/dist/types/shared/assistant-protocol/limits.d.ts +53 -0
  131. package/dist/types/shared/assistant-protocol/parts.d.ts +131 -0
  132. package/dist/types/shared/assistant-protocol/request.d.ts +77 -0
  133. package/dist/types/shared/assistant-protocol/sources.d.ts +27 -0
  134. package/dist/types/shared/assistant-protocol/token-config.d.ts +32 -0
  135. package/dist/types/shared/assistant-protocol/transcript.d.ts +40 -0
  136. package/dist/types/shared/dashboard-authoring/card-query-request.d.ts +112 -0
  137. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +1794 -0
  138. package/dist/types/shared/dashboard-authoring/index.d.ts +5 -0
  139. package/dist/types/shared/dashboard-authoring/new-card.d.ts +10 -0
  140. package/dist/types/shared/dashboard-authoring/operations/apply-dashboard-operations.d.ts +40 -0
  141. package/dist/types/shared/dashboard-authoring/resolved-primary-date-field-validation.d.ts +16 -0
  142. package/dist/types/shared/format-utils/filter-detail.d.ts +70 -0
  143. package/dist/types/shared/format-utils/filter-value-text.d.ts +15 -0
  144. package/dist/types/shared/format-utils/index.d.ts +3 -0
  145. package/dist/types/shared/format-utils/raw-temporal.d.ts +7 -0
  146. package/dist/types/shared/format-utils/temporal-bucket.d.ts +7 -0
  147. package/dist/types/shared/layouts/frame-layouts.d.ts +23 -0
  148. package/dist/types/shared/layouts/index.d.ts +1 -0
  149. package/package.json +12 -2
  150. package/dist/chunks/calculated-field-identity-BptYhyOP.js +0 -1326
  151. package/dist/chunks/calendar-day-equality-BRjN1S9h.js +0 -383
  152. package/dist/chunks/card-config-utils-BOM1dxCk.js +0 -1150
  153. package/dist/chunks/constants-DNWVy8Y3.js +0 -9
  154. package/dist/chunks/dashboard-json-B1dEQu98.js +0 -65
  155. package/dist/chunks/field-aggregations-CoLzYHeL.js +0 -1229
  156. package/dist/chunks/index-DTcTAGGM.js +0 -4101
  157. package/dist/chunks/matrix-continuation-C4sRcjZU.js +0 -72
  158. package/dist/chunks/matrix-control-sources-DTqcA2_L.js +0 -636
  159. package/dist/chunks/matrix-definition-D9iShKZI.js +0 -87
  160. package/dist/chunks/matrix-member-presentation-Ct8GuxHt.js +0 -209
  161. package/dist/chunks/numeric-presentation-CWu3gunq.js +0 -537
  162. package/dist/chunks/pivot-header-presentation-CHs2GFrM.js +0 -753
  163. package/dist/chunks/pivot-result-lifecycle-DQz_gjGu.js +0 -789
  164. package/dist/chunks/raw-temporal-iMXRK-Qz.js +0 -930
  165. package/dist/chunks/report-preferences-dialog-DXPjteCU.js +0 -1623
  166. package/dist/chunks/save-kO6cIaob.js +0 -34
  167. package/dist/chunks/semantic-format-DiqYeKwU.js +0 -192
  168. package/dist/chunks/switch-DO8a0EfJ.js +0 -25004
  169. package/dist/chunks/temporal-input-presentation-BD7YNUzu.js +0 -195
  170. package/dist/chunks/x-CXDkqdur.js +0 -149
  171. package/dist/types/lib/class-utils.d.ts +0 -2
  172. package/dist/types/lib/document/document-input-runtime.d.ts +0 -26
  173. package/dist/types/lib/utils.d.ts +0 -51
@@ -1,930 +0,0 @@
1
- var B = Object.defineProperty;
2
- var ee = (e, t, r) => t in e ? B(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var b = (e, t, r) => ee(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { i as g } from "./validators-DMSH81OM.js";
5
- import { p as te } from "./raw-temporal-contract-mLFS-9wk.js";
6
- import { canonicalizeSupportedLocale as ne } from "../value-format-preferences/index.js";
7
- import { d as h, t as U } from "./temporal-bucket-DlFuhCnT.js";
8
- function re(e) {
9
- if (!e || typeof e != "object") return !1;
10
- const t = e.type;
11
- return t === "number" || t === "currency" || t === "percent" || t === "scientific";
12
- }
13
- function We(e) {
14
- return re(e) || !!e && typeof e == "object" && e.type === "duration";
15
- }
16
- function ae(e, t) {
17
- const r = ue(t);
18
- return "formatToParts" in r ? se(r, e) : ie(r, e);
19
- }
20
- const oe = {
21
- year: 0,
22
- month: 1,
23
- day: 2,
24
- hour: 3,
25
- minute: 4,
26
- second: 5
27
- };
28
- function se(e, t) {
29
- try {
30
- const r = e.formatToParts(t), n = [];
31
- for (let o = 0; o < r.length; o++) {
32
- const a = oe[r[o].type];
33
- a !== void 0 && (n[a] = parseInt(r[o].value, 10));
34
- }
35
- return n;
36
- } catch (r) {
37
- if (r instanceof RangeError)
38
- return [NaN];
39
- throw r;
40
- }
41
- }
42
- function ie(e, t) {
43
- const r = e.format(t), n = /(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(r);
44
- return [
45
- parseInt(n[3], 10),
46
- parseInt(n[1], 10),
47
- parseInt(n[2], 10),
48
- parseInt(n[4], 10),
49
- parseInt(n[5], 10),
50
- parseInt(n[6], 10)
51
- ];
52
- }
53
- const D = {}, k = new Intl.DateTimeFormat("en-US", {
54
- hourCycle: "h23",
55
- timeZone: "America/New_York",
56
- year: "numeric",
57
- month: "2-digit",
58
- day: "2-digit",
59
- hour: "2-digit",
60
- minute: "2-digit",
61
- second: "2-digit"
62
- }).format(/* @__PURE__ */ new Date("2014-06-25T04:00:00.123Z")), ce = k === "06/25/2014, 00:00:00" || k === "‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00";
63
- function ue(e) {
64
- return D[e] || (D[e] = ce ? new Intl.DateTimeFormat("en-US", {
65
- hourCycle: "h23",
66
- timeZone: e,
67
- year: "numeric",
68
- month: "numeric",
69
- day: "2-digit",
70
- hour: "2-digit",
71
- minute: "2-digit",
72
- second: "2-digit"
73
- }) : new Intl.DateTimeFormat("en-US", {
74
- hour12: !1,
75
- timeZone: e,
76
- year: "numeric",
77
- month: "numeric",
78
- day: "2-digit",
79
- hour: "2-digit",
80
- minute: "2-digit",
81
- second: "2-digit"
82
- })), D[e];
83
- }
84
- function Y(e, t, r, n, o, a, s) {
85
- const i = /* @__PURE__ */ new Date(0);
86
- return i.setUTCFullYear(e, t, r), i.setUTCHours(n, o, a, s), i;
87
- }
88
- const F = 36e5, le = 6e4, N = {
89
- timezoneZ: /^(Z)$/,
90
- timezoneHH: /^([+-]\d{2})$/,
91
- timezoneHHMM: /^([+-])(\d{2}):?(\d{2})$/
92
- };
93
- function P(e, t, r) {
94
- if (!e)
95
- return 0;
96
- let n = N.timezoneZ.exec(e);
97
- if (n)
98
- return 0;
99
- let o, a;
100
- if (n = N.timezoneHH.exec(e), n)
101
- return o = parseInt(n[1], 10), A(o) ? -(o * F) : NaN;
102
- if (n = N.timezoneHHMM.exec(e), n) {
103
- o = parseInt(n[2], 10);
104
- const s = parseInt(n[3], 10);
105
- return A(o, s) ? (a = Math.abs(o) * F + s * le, n[1] === "+" ? -a : a) : NaN;
106
- }
107
- if (de(e)) {
108
- t = new Date(t || Date.now());
109
- const s = r ? t : me(t), i = I(s, e);
110
- return -(r ? i : fe(t, i, e));
111
- }
112
- return NaN;
113
- }
114
- function me(e) {
115
- return Y(e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), e.getMinutes(), e.getSeconds(), e.getMilliseconds());
116
- }
117
- function I(e, t) {
118
- const r = ae(e, t), n = Y(r[0], r[1] - 1, r[2], r[3] % 24, r[4], r[5], 0).getTime();
119
- let o = e.getTime();
120
- const a = o % 1e3;
121
- return o -= a >= 0 ? a : 1e3 + a, n - o;
122
- }
123
- function fe(e, t, r) {
124
- let o = e.getTime() - t;
125
- const a = I(new Date(o), r);
126
- if (t === a)
127
- return t;
128
- o -= a - t;
129
- const s = I(new Date(o), r);
130
- return a === s ? a : Math.max(a, s);
131
- }
132
- function A(e, t) {
133
- return -23 <= e && e <= 23 && (t == null || 0 <= t && t <= 59);
134
- }
135
- const C = {};
136
- function de(e) {
137
- if (C[e])
138
- return !0;
139
- try {
140
- return new Intl.DateTimeFormat(void 0, { timeZone: e }), C[e] = !0, !0;
141
- } catch {
142
- return !1;
143
- }
144
- }
145
- function O(e) {
146
- const t = new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), e.getMinutes(), e.getSeconds(), e.getMilliseconds()));
147
- return t.setUTCFullYear(e.getFullYear()), +e - +t;
148
- }
149
- const Z = /(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/, _ = 36e5, E = 6e4, pe = 2, d = {
150
- dateTimePattern: /^([0-9W+-]+)(T| )(.*)/,
151
- datePattern: /^([0-9W+-]+)(.*)/,
152
- // year tokens
153
- YY: /^(\d{2})$/,
154
- YYY: [
155
- /^([+-]\d{2})$/,
156
- // 0 additional digits
157
- /^([+-]\d{3})$/,
158
- // 1 additional digit
159
- /^([+-]\d{4})$/
160
- // 2 additional digits
161
- ],
162
- YYYY: /^(\d{4})/,
163
- YYYYY: [
164
- /^([+-]\d{4})/,
165
- // 0 additional digits
166
- /^([+-]\d{5})/,
167
- // 1 additional digit
168
- /^([+-]\d{6})/
169
- // 2 additional digits
170
- ],
171
- // date tokens
172
- MM: /^-(\d{2})$/,
173
- DDD: /^-?(\d{3})$/,
174
- MMDD: /^-?(\d{2})-?(\d{2})$/,
175
- Www: /^-?W(\d{2})$/,
176
- WwwD: /^-?W(\d{2})-?(\d{1})$/,
177
- HH: /^(\d{2}([.,]\d*)?)$/,
178
- HHMM: /^(\d{2}):?(\d{2}([.,]\d*)?)$/,
179
- HHMMSS: /^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,
180
- // time zone tokens (to identify the presence of a tz)
181
- timeZone: Z
182
- };
183
- function $(e, t = {}) {
184
- if (arguments.length < 1)
185
- throw new TypeError("1 argument required, but only " + arguments.length + " present");
186
- if (e === null)
187
- return /* @__PURE__ */ new Date(NaN);
188
- const r = t.additionalDigits == null ? pe : Number(t.additionalDigits);
189
- if (r !== 2 && r !== 1 && r !== 0)
190
- throw new RangeError("additionalDigits must be 0, 1 or 2");
191
- if (e instanceof Date || typeof e == "object" && Object.prototype.toString.call(e) === "[object Date]")
192
- return new Date(e.getTime());
193
- if (typeof e == "number" || Object.prototype.toString.call(e) === "[object Number]")
194
- return new Date(e);
195
- if (Object.prototype.toString.call(e) !== "[object String]")
196
- return /* @__PURE__ */ new Date(NaN);
197
- const n = Te(e), { year: o, restDateString: a } = he(n.date, r), s = ye(a, o);
198
- if (s === null || isNaN(s.getTime()))
199
- return /* @__PURE__ */ new Date(NaN);
200
- if (s) {
201
- const i = s.getTime();
202
- let m = 0, u;
203
- if (n.time && (m = we(n.time), m === null || isNaN(m)))
204
- return /* @__PURE__ */ new Date(NaN);
205
- if (n.timeZone || t.timeZone) {
206
- if (u = P(n.timeZone || t.timeZone, new Date(i + m)), isNaN(u))
207
- return /* @__PURE__ */ new Date(NaN);
208
- } else
209
- u = O(new Date(i + m)), u = O(new Date(i + m + u));
210
- return new Date(i + m + u);
211
- } else
212
- return /* @__PURE__ */ new Date(NaN);
213
- }
214
- function Te(e) {
215
- const t = {};
216
- let r = d.dateTimePattern.exec(e), n;
217
- if (r ? (t.date = r[1], n = r[3]) : (r = d.datePattern.exec(e), r ? (t.date = r[1], n = r[2]) : (t.date = null, n = e)), n) {
218
- const o = d.timeZone.exec(n);
219
- o ? (t.time = n.replace(o[1], ""), t.timeZone = o[1].trim()) : t.time = n;
220
- }
221
- return t;
222
- }
223
- function he(e, t) {
224
- if (e) {
225
- const r = d.YYY[t], n = d.YYYYY[t];
226
- let o = d.YYYY.exec(e) || n.exec(e);
227
- if (o) {
228
- const a = o[1];
229
- return {
230
- year: parseInt(a, 10),
231
- restDateString: e.slice(a.length)
232
- };
233
- }
234
- if (o = d.YY.exec(e) || r.exec(e), o) {
235
- const a = o[1];
236
- return {
237
- year: parseInt(a, 10) * 100,
238
- restDateString: e.slice(a.length)
239
- };
240
- }
241
- }
242
- return {
243
- year: null
244
- };
245
- }
246
- function ye(e, t) {
247
- if (t === null)
248
- return null;
249
- let r, n, o;
250
- if (!e || !e.length)
251
- return r = /* @__PURE__ */ new Date(0), r.setUTCFullYear(t), r;
252
- let a = d.MM.exec(e);
253
- if (a)
254
- return r = /* @__PURE__ */ new Date(0), n = parseInt(a[1], 10) - 1, H(t, n) ? (r.setUTCFullYear(t, n), r) : /* @__PURE__ */ new Date(NaN);
255
- if (a = d.DDD.exec(e), a) {
256
- r = /* @__PURE__ */ new Date(0);
257
- const s = parseInt(a[1], 10);
258
- return De(t, s) ? (r.setUTCFullYear(t, 0, s), r) : /* @__PURE__ */ new Date(NaN);
259
- }
260
- if (a = d.MMDD.exec(e), a) {
261
- r = /* @__PURE__ */ new Date(0), n = parseInt(a[1], 10) - 1;
262
- const s = parseInt(a[2], 10);
263
- return H(t, n, s) ? (r.setUTCFullYear(t, n, s), r) : /* @__PURE__ */ new Date(NaN);
264
- }
265
- if (a = d.Www.exec(e), a)
266
- return o = parseInt(a[1], 10) - 1, L(o) ? x(t, o) : /* @__PURE__ */ new Date(NaN);
267
- if (a = d.WwwD.exec(e), a) {
268
- o = parseInt(a[1], 10) - 1;
269
- const s = parseInt(a[2], 10) - 1;
270
- return L(o, s) ? x(t, o, s) : /* @__PURE__ */ new Date(NaN);
271
- }
272
- return null;
273
- }
274
- function we(e) {
275
- let t, r, n = d.HH.exec(e);
276
- if (n)
277
- return t = parseFloat(n[1].replace(",", ".")), v(t) ? t % 24 * _ : NaN;
278
- if (n = d.HHMM.exec(e), n)
279
- return t = parseInt(n[1], 10), r = parseFloat(n[2].replace(",", ".")), v(t, r) ? t % 24 * _ + r * E : NaN;
280
- if (n = d.HHMMSS.exec(e), n) {
281
- t = parseInt(n[1], 10), r = parseInt(n[2], 10);
282
- const o = parseFloat(n[3].replace(",", "."));
283
- return v(t, r, o) ? t % 24 * _ + r * E + o * 1e3 : NaN;
284
- }
285
- return null;
286
- }
287
- function x(e, t, r) {
288
- t = t || 0, r = r || 0;
289
- const n = /* @__PURE__ */ new Date(0);
290
- n.setUTCFullYear(e, 0, 4);
291
- const o = n.getUTCDay() || 7, a = t * 7 + r + 1 - o;
292
- return n.setUTCDate(n.getUTCDate() + a), n;
293
- }
294
- const Se = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], ge = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
295
- function K(e) {
296
- return e % 400 === 0 || e % 4 === 0 && e % 100 !== 0;
297
- }
298
- function H(e, t, r) {
299
- if (t < 0 || t > 11)
300
- return !1;
301
- if (r != null) {
302
- if (r < 1)
303
- return !1;
304
- const n = K(e);
305
- if (n && r > ge[t] || !n && r > Se[t])
306
- return !1;
307
- }
308
- return !0;
309
- }
310
- function De(e, t) {
311
- if (t < 1)
312
- return !1;
313
- const r = K(e);
314
- return !(r && t > 366 || !r && t > 365);
315
- }
316
- function L(e, t) {
317
- return !(e < 0 || e > 52 || t != null && (t < 0 || t > 6));
318
- }
319
- function v(e, t, r) {
320
- return !(e < 0 || e >= 25 || t != null && (t < 0 || t >= 60) || r != null && (r < 0 || r >= 60));
321
- }
322
- function Ne(e, t, r) {
323
- if (typeof e == "string" && !e.match(Z))
324
- return $(e, { ...r, timeZone: t });
325
- e = $(e, r);
326
- const n = Y(e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), e.getMinutes(), e.getSeconds(), e.getMilliseconds()).getTime(), o = P(t, new Date(n));
327
- return new Date(n + o);
328
- }
329
- class y extends Error {
330
- constructor(r, n) {
331
- super(n);
332
- b(this, "code");
333
- this.name = "RawTemporalFormatContractError", this.code = r;
334
- }
335
- }
336
- const _e = [
337
- "SSSSSSSSS",
338
- "SSSSSSSS",
339
- "SSSSSSS",
340
- "SSSSSS",
341
- "SSSSS",
342
- "SSSS",
343
- "SSS",
344
- "SS",
345
- "S"
346
- ], j = /^(\d{4})-(\d{2})-(\d{2})$/, W = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?$/, q = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,9}))?)?(Z|[+-]\d{2}:\d{2})$/, ve = [
347
- "yyyy",
348
- "MMMM",
349
- "LLLL",
350
- "zzz",
351
- "XXX",
352
- "MMM",
353
- "LLL",
354
- "yy",
355
- "MM",
356
- "dd",
357
- "HH",
358
- "hh",
359
- "mm",
360
- "ss",
361
- "M",
362
- "d",
363
- "H",
364
- "h",
365
- "m",
366
- "s",
367
- "a"
368
- ], ze = /* @__PURE__ */ new Set([
369
- "HH",
370
- "H",
371
- "hh",
372
- "h",
373
- "mm",
374
- "m",
375
- "ss",
376
- "s",
377
- "a",
378
- ..._e
379
- ]), Ie = /* @__PURE__ */ new Set(["zzz", "XXX"]), z = /* @__PURE__ */ new Set(["short", "medium", "long"]);
380
- function T(e, t) {
381
- return Object.keys(e).length === t.length && t.every((n) => n in e);
382
- }
383
- function c(e) {
384
- throw new y(
385
- "invalid_raw_temporal_format",
386
- e
387
- );
388
- }
389
- function X(e) {
390
- if (!e || e.trim() !== e || e.length > 256)
391
- return c(
392
- "date_fns patterns must be non-empty, trimmed, and at most 256 characters."
393
- );
394
- const t = [], r = (o) => {
395
- const a = t[t.length - 1];
396
- (a == null ? void 0 : a.kind) === "literal" ? a.value += o : t.push({ kind: "literal", value: o });
397
- };
398
- let n = 0;
399
- for (; n < e.length; ) {
400
- if (e[n] === "'") {
401
- if (e[n + 1] === "'") {
402
- r("'"), n += 2;
403
- continue;
404
- }
405
- let s = "", i = !1;
406
- for (n += 1; n < e.length; ) {
407
- if (e[n] === "'") {
408
- if (e[n + 1] === "'") {
409
- s += "'", n += 2;
410
- continue;
411
- }
412
- i = !0, n += 1;
413
- break;
414
- }
415
- s += e[n], n += 1;
416
- }
417
- if (!i)
418
- return c("date_fns pattern has an unclosed quote.");
419
- r(s);
420
- continue;
421
- }
422
- if (e[n] === "S") {
423
- let s = n + 1;
424
- for (; e[s] === "S"; ) s += 1;
425
- const i = e.slice(n, s);
426
- if (i.length > 9)
427
- return c(
428
- "date_fns fractional-second tokens support at most nine digits."
429
- );
430
- t.push({
431
- kind: "token",
432
- value: i
433
- }), n = s;
434
- continue;
435
- }
436
- const o = ve.find(
437
- (s) => e.startsWith(s, n)
438
- );
439
- if (o) {
440
- t.push({ kind: "token", value: o }), n += o.length;
441
- continue;
442
- }
443
- const a = e[n];
444
- if (/[A-Za-z]/.test(a))
445
- return c(
446
- `Unsupported date_fns pattern token beginning at "${e.slice(n)}".`
447
- );
448
- r(a), n += 1;
449
- }
450
- return t.some((o) => o.kind === "token") ? t : c("date_fns patterns must contain at least one token.");
451
- }
452
- function V(e, t) {
453
- if (e === "semaphor_tokens") {
454
- const r = U(t);
455
- r.ok || c(r.message);
456
- return;
457
- }
458
- X(t);
459
- }
460
- function Me(e) {
461
- return !h(e) || !T(e, ["dateStyle", "dateTime"]) ? c("Automatic raw temporal styles are incomplete.") : z.has(e.dateStyle) ? !h(e.dateTime) || !T(e.dateTime, ["dateStyle", "timeStyle"]) || !z.has(e.dateTime.dateStyle) || !z.has(e.dateTime.timeStyle) ? c(
462
- "Automatic dateTime styles are incomplete or invalid."
463
- ) : {
464
- dateStyle: e.dateStyle,
465
- dateTime: {
466
- dateStyle: e.dateTime.dateStyle,
467
- timeStyle: e.dateTime.timeStyle
468
- }
469
- } : c("Automatic dateStyle is invalid.");
470
- }
471
- function G(e) {
472
- const t = ["type", "locale", "calendarTimezone", "presentation"], r = [...t, "sourceTimezone"];
473
- if (!h(e) || !T(e, t) && !T(e, r) || e.type !== "raw_temporal")
474
- return c("Resolved raw temporal format has an invalid shape.");
475
- const n = ne(e.locale);
476
- return n ? typeof e.calendarTimezone != "string" || !g(e.calendarTimezone) ? c(
477
- "Raw temporal calendarTimezone must be a valid IANA timezone."
478
- ) : e.sourceTimezone !== void 0 && (typeof e.sourceTimezone != "string" || !g(e.sourceTimezone)) ? c(
479
- "Raw temporal sourceTimezone must be a valid IANA timezone."
480
- ) : h(e.presentation) ? e.presentation.mode === "auto" ? T(e.presentation, ["mode", "styles"]) ? {
481
- type: "raw_temporal",
482
- locale: n,
483
- calendarTimezone: e.calendarTimezone,
484
- ...e.sourceTimezone ? { sourceTimezone: e.sourceTimezone } : {},
485
- presentation: {
486
- mode: "auto",
487
- styles: Me(e.presentation.styles)
488
- }
489
- } : c(
490
- "Automatic raw temporal presentation has unknown fields."
491
- ) : 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" ? c(
492
- "Pattern raw temporal presentation has an invalid shape."
493
- ) : (V(e.presentation.dialect, e.presentation.pattern), {
494
- type: "raw_temporal",
495
- locale: n,
496
- calendarTimezone: e.calendarTimezone,
497
- ...e.sourceTimezone ? { sourceTimezone: e.sourceTimezone } : {},
498
- presentation: {
499
- mode: "pattern",
500
- dialect: e.presentation.dialect,
501
- pattern: e.presentation.pattern
502
- }
503
- }) : c("Raw temporal presentation must be an object.") : c("Raw temporal locale is invalid or unsupported.");
504
- }
505
- function qe(e) {
506
- var i, m, u;
507
- if (e.format) {
508
- if (!h(e.format))
509
- return c(
510
- "Authored raw temporal format has an invalid shape."
511
- );
512
- const l = Object.keys(e.format);
513
- if (!l.includes("type") || !l.includes("presentation") || l.some(
514
- (p) => p !== "type" && p !== "presentation" && p !== "timezone" && p !== "sourceTimezone"
515
- ) || e.format.type !== "raw_temporal" || !h(e.format.presentation))
516
- return c(
517
- "Authored raw temporal format has an invalid shape."
518
- );
519
- const f = e.format.presentation;
520
- if (f.mode === "auto") {
521
- if (!T(f, ["mode"]))
522
- return c(
523
- "Automatic authored raw temporal format has unknown fields."
524
- );
525
- } else {
526
- if (f.mode !== "pattern" || !T(f, ["mode", "dialect", "pattern"]) || f.dialect !== "semaphor_tokens" && f.dialect !== "date_fns" || typeof f.pattern != "string")
527
- return c(
528
- "Authored raw temporal pattern has an invalid shape."
529
- );
530
- V(f.dialect, f.pattern);
531
- }
532
- }
533
- const t = (i = e.format) == null ? void 0 : i.timezone, r = (m = e.format) == null ? void 0 : m.sourceTimezone, n = t && t !== "auto" ? t : e.calendar.tz, o = r && r !== "auto" ? r === "local" ? Intl.DateTimeFormat().resolvedOptions().timeZone : r : void 0;
534
- if (t !== void 0 && t !== "auto" && !g(n) || o !== void 0 && !g(o))
535
- return c("Authored raw temporal timezone is invalid.");
536
- const a = ((u = e.format) == null ? void 0 : u.presentation) ?? { mode: "auto" }, s = {
537
- type: "raw_temporal",
538
- locale: e.preferences.locale,
539
- calendarTimezone: n,
540
- ...o ? { sourceTimezone: o } : {},
541
- presentation: a.mode === "pattern" ? { ...a } : {
542
- mode: "auto",
543
- styles: {
544
- dateStyle: e.preferences.dateStyle,
545
- dateTime: { ...e.preferences.dateTime }
546
- }
547
- }
548
- };
549
- return G(s);
550
- }
551
- function Ye(e) {
552
- if (j.test(e)) return "date";
553
- if (q.test(e)) return "instant";
554
- if (W.test(e)) return "wall_datetime";
555
- }
556
- function Xe(e) {
557
- const t = /* @__PURE__ */ new Set();
558
- let r = !1;
559
- for (const n of e.values) {
560
- if (n === null) continue;
561
- r = !0;
562
- const o = Ye(n);
563
- o && t.add(o);
564
- }
565
- if (!r) return { status: "empty" };
566
- if (t.size === 0) return { status: "invalid_only" };
567
- if (t.size > 1)
568
- throw new y(
569
- "mixed_sql_temporal_semantics",
570
- `Declared SQL temporal column "${e.columnKey}" mixes date, wall-datetime, or instant semantics. Normalize it to one kind.`
571
- );
572
- return {
573
- status: "classified",
574
- metadata: {
575
- kind: "raw_temporal",
576
- valueKind: [...t][0]
577
- }
578
- };
579
- }
580
- function Ve(e) {
581
- return {
582
- version: 1,
583
- columns: Object.fromEntries(
584
- [...e].map(([t, r]) => [
585
- t,
586
- r.status === "classified" ? r.metadata.valueKind : r.status
587
- ])
588
- )
589
- };
590
- }
591
- function be(e) {
592
- if (!h(e) || e.version !== 1 || !h(e.columns) || Object.keys(e).some((n) => n !== "version" && n !== "columns"))
593
- throw new y(
594
- "invalid_raw_temporal_format",
595
- "Raw temporal chunk classification evidence is malformed."
596
- );
597
- const t = {}, r = /* @__PURE__ */ new Set([
598
- "empty",
599
- "invalid_only",
600
- "date",
601
- "wall_datetime",
602
- "instant"
603
- ]);
604
- for (const [n, o] of Object.entries(e.columns)) {
605
- if (!n.trim() || !r.has(o))
606
- throw new y(
607
- "invalid_raw_temporal_format",
608
- "Raw temporal chunk classification evidence contains an invalid column or status."
609
- );
610
- t[n] = o;
611
- }
612
- return { version: 1, columns: t };
613
- }
614
- function Ge(e) {
615
- if (e.length === 0) return;
616
- const t = e.map(be), r = Object.keys(t[0].columns).sort();
617
- for (let n = 1; n < t.length; n += 1) {
618
- const o = Object.keys(t[n].columns).sort();
619
- if (o.length !== r.length || o.some((a, s) => a !== r[s]))
620
- throw new y(
621
- "invalid_raw_temporal_format",
622
- "Raw temporal chunk classification evidence has inconsistent columns."
623
- );
624
- }
625
- for (const n of r)
626
- if (new Set(
627
- t.map((a) => a.columns[n]).filter(
628
- (a) => a !== "empty" && a !== "invalid_only"
629
- )
630
- ).size > 1)
631
- throw new y(
632
- "mixed_sql_temporal_semantics",
633
- `Declared SQL temporal column "${n}" has inconsistent semantics across export chunks. Normalize it to one kind.`
634
- );
635
- }
636
- function ke(e) {
637
- return e % 4 === 0 && (e % 100 !== 0 || e % 400 === 0);
638
- }
639
- function Fe(e, t) {
640
- return t === 2 ? ke(e) ? 29 : 28 : [4, 6, 9, 11].includes(t) ? 30 : 31;
641
- }
642
- function Ae(e) {
643
- return e.year >= 1 && e.year <= 9999 && e.month >= 1 && e.month <= 12 && e.day >= 1 && e.day <= Fe(e.year, e.month) && e.hour >= 0 && e.hour <= 23 && e.minute >= 0 && e.minute <= 59 && e.second >= 0 && e.second <= 59;
644
- }
645
- function Ce(e) {
646
- return {
647
- year: Number(e[1]),
648
- month: Number(e[2]),
649
- day: Number(e[3]),
650
- hour: Number(e[4] ?? 0),
651
- minute: Number(e[5] ?? 0),
652
- second: Number(e[6] ?? 0),
653
- fraction: e[7] ?? ""
654
- };
655
- }
656
- function Oe(e, t) {
657
- const r = t === "date" ? e.match(j) : t === "wall_datetime" ? e.match(W) : e.match(q);
658
- if (!r) return { status: "invalid_shape" };
659
- const n = Ce(r);
660
- if (!Ae(n)) return { status: "out_of_range" };
661
- if (t === "instant") {
662
- const o = r[8];
663
- if (o && o !== "Z") {
664
- const [s, i] = o.slice(1).split(":").map(Number);
665
- if (s > 23 || i > 59) return { status: "out_of_range" };
666
- }
667
- const a = new Date(e.replace(" ", "T"));
668
- return Number.isNaN(a.getTime()) ? { status: "out_of_range" } : { status: "valid", fields: n, instant: a };
669
- }
670
- return { status: "valid", fields: n };
671
- }
672
- function M(e) {
673
- const t = /* @__PURE__ */ new Date(0);
674
- return t.setUTCFullYear(e.year, e.month - 1, e.day), t.setUTCHours(e.hour, e.minute, e.second, 0), t;
675
- }
676
- function J(e, t) {
677
- const r = e.fraction ? `.${e.fraction.padEnd(3, "0").slice(0, 3)}` : "";
678
- return Ne(
679
- `${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}`,
680
- t
681
- );
682
- }
683
- function Ee(e, t) {
684
- const r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
685
- let o, a, s, i;
686
- return {
687
- number(m, u = 1) {
688
- let l = r.get(u);
689
- return l || (l = new Intl.NumberFormat(e, {
690
- useGrouping: !1,
691
- minimumIntegerDigits: u,
692
- maximumFractionDigits: 0
693
- }), r.set(u, l)), l.format(m);
694
- },
695
- month(m, u, l) {
696
- var w;
697
- const f = `${u}:${l ? "standalone" : "contextual"}`;
698
- let p = n.get(f);
699
- if (!p) {
700
- const S = {
701
- calendar: "gregory",
702
- timeZone: "UTC",
703
- month: u
704
- };
705
- l || (S.day = "numeric"), p = new Intl.DateTimeFormat(e, S), n.set(f, p);
706
- }
707
- return ((w = p.formatToParts(m).find((S) => S.type === "month")) == null ? void 0 : w.value) ?? "";
708
- },
709
- dayPeriod(m) {
710
- var u;
711
- return o ?? (o = new Intl.DateTimeFormat(e, {
712
- calendar: "gregory",
713
- timeZone: "UTC",
714
- hour: "numeric",
715
- hour12: !0
716
- })), ((u = o.formatToParts(m).find((l) => l.type === "dayPeriod")) == null ? void 0 : u.value) ?? "";
717
- },
718
- instantFields(m) {
719
- a ?? (a = new Intl.DateTimeFormat("en-CA", {
720
- calendar: "gregory",
721
- numberingSystem: "latn",
722
- timeZone: t,
723
- year: "numeric",
724
- month: "2-digit",
725
- day: "2-digit",
726
- hour: "2-digit",
727
- minute: "2-digit",
728
- second: "2-digit",
729
- hourCycle: "h23"
730
- }));
731
- const u = a.formatToParts(m), l = (f) => {
732
- var p;
733
- return Number((p = u.find((w) => w.type === f)) == null ? void 0 : p.value);
734
- };
735
- return {
736
- year: l("year"),
737
- month: l("month"),
738
- day: l("day"),
739
- hour: l("hour"),
740
- minute: l("minute"),
741
- second: l("second"),
742
- fraction: ""
743
- };
744
- },
745
- timezoneName(m) {
746
- var u;
747
- return s ?? (s = new Intl.DateTimeFormat(e, {
748
- calendar: "gregory",
749
- timeZone: t,
750
- timeZoneName: "short"
751
- })), ((u = s.formatToParts(m).find((l) => l.type === "timeZoneName")) == null ? void 0 : u.value) ?? "";
752
- },
753
- timezoneOffset(m) {
754
- var f;
755
- i ?? (i = new Intl.DateTimeFormat("en-US", {
756
- calendar: "gregory",
757
- timeZone: t,
758
- timeZoneName: "longOffset"
759
- }));
760
- const u = (f = i.formatToParts(m).find((p) => p.type === "timeZoneName")) == null ? void 0 : f.value;
761
- if (!u)
762
- return c("Unable to resolve the instant timezone offset.");
763
- const l = u.replace(/^GMT/, "");
764
- return l === "" || /^[+-]00:00$/.test(l) ? "Z" : l;
765
- }
766
- };
767
- }
768
- function $e(e, t, r, n, o) {
769
- if (/^S{1,9}$/.test(e)) {
770
- const a = t.fraction.padEnd(e.length, "0").slice(0, e.length);
771
- return n.number(Number(a), e.length);
772
- }
773
- switch (e) {
774
- case "YYYY":
775
- case "yyyy":
776
- return n.number(t.year, 4);
777
- case "YY":
778
- case "yy":
779
- return n.number(t.year % 100, 2);
780
- case "MMMM":
781
- return n.month(r, "long", !1);
782
- case "LLLL":
783
- return n.month(r, "long", !0);
784
- case "MMM":
785
- return n.month(r, "short", !1);
786
- case "LLL":
787
- return n.month(r, "short", !0);
788
- case "MM":
789
- return n.number(t.month, 2);
790
- case "M":
791
- return n.number(t.month);
792
- case "DD":
793
- case "dd":
794
- return n.number(t.day, 2);
795
- case "d":
796
- return n.number(t.day);
797
- case "HH":
798
- return n.number(t.hour, 2);
799
- case "H":
800
- return n.number(t.hour);
801
- case "hh":
802
- return n.number(t.hour % 12 || 12, 2);
803
- case "h":
804
- return n.number(t.hour % 12 || 12);
805
- case "mm":
806
- return n.number(t.minute, 2);
807
- case "m":
808
- return n.number(t.minute);
809
- case "ss":
810
- return n.number(t.second, 2);
811
- case "s":
812
- return n.number(t.second);
813
- case "a":
814
- return n.dayPeriod(r);
815
- case "zzz":
816
- return o ? n.timezoneName(o) : c(
817
- "Timezone pattern tokens require an instant value."
818
- );
819
- case "XXX":
820
- return o ? n.timezoneOffset(o) : c(
821
- "Timezone pattern tokens require an instant value."
822
- );
823
- default:
824
- return c(
825
- `Unsupported raw temporal pattern token "${e}".`
826
- );
827
- }
828
- }
829
- function xe(e, t, r, n) {
830
- const o = M(t);
831
- return e.map(
832
- (a) => a.kind === "literal" ? a.value : $e(a.value, t, o, r, n)
833
- ).join("");
834
- }
835
- function Q(e, t, r) {
836
- const n = t === "date_fns" ? X(r) : (() => {
837
- const a = U(r);
838
- return a.ok ? a.segments : c(a.message);
839
- })(), o = n.filter((a) => a.kind === "token").map((a) => a.value);
840
- return e === "date" && o.some((a) => ze.has(a)) ? c("Date patterns cannot contain time tokens.") : e !== "instant" && o.some((a) => Ie.has(a)) ? c("Timezone pattern tokens require an instant value.") : n;
841
- }
842
- function Je(e) {
843
- Q(
844
- e.valueKind ?? "instant",
845
- e.dialect,
846
- e.pattern
847
- );
848
- }
849
- function He(e, t, r, n) {
850
- const o = Q(
851
- e.valueKind,
852
- r,
853
- n
854
- ), a = Ee(t.locale, t.calendarTimezone);
855
- return (s) => {
856
- const i = e.valueKind === "wall_datetime" && t.sourceTimezone ? J(s.fields, t.sourceTimezone) : void 0, m = e.valueKind === "instant" ? {
857
- ...a.instantFields(s.instant),
858
- fraction: s.fields.fraction
859
- } : i ? {
860
- ...a.instantFields(i),
861
- fraction: s.fields.fraction
862
- } : s.fields;
863
- return xe(o, m, a, s.instant ?? i);
864
- };
865
- }
866
- function Le(e, t) {
867
- const r = t.presentation.mode === "auto" ? t.presentation.styles : c("Automatic raw temporal formatting requires styles.");
868
- if (e.valueKind === "date") {
869
- const s = new Intl.DateTimeFormat(t.locale, {
870
- calendar: "gregory",
871
- timeZone: "UTC",
872
- dateStyle: r.dateStyle
873
- });
874
- return (i) => s.format(M(i.fields));
875
- }
876
- const n = e.valueKind === "instant", o = !n && r.dateTime.timeStyle === "long" ? "medium" : r.dateTime.timeStyle, a = new Intl.DateTimeFormat(t.locale, {
877
- calendar: "gregory",
878
- timeZone: n || e.valueKind === "wall_datetime" && t.sourceTimezone ? t.calendarTimezone : "UTC",
879
- dateStyle: r.dateTime.dateStyle,
880
- timeStyle: o
881
- });
882
- return (s) => n ? a.format(s.instant) : e.valueKind === "wall_datetime" && t.sourceTimezone ? a.format(J(s.fields, t.sourceTimezone)) : a.format(M(s.fields));
883
- }
884
- function R(e, t, r) {
885
- return {
886
- ok: !1,
887
- text: e,
888
- diagnostic: {
889
- code: r,
890
- message: `Raw temporal ${t.valueKind} value is ${r === "invalid_raw_temporal_value" ? "malformed" : "out of range"}.`
891
- }
892
- };
893
- }
894
- function Re(e) {
895
- const t = te(e.metadata), r = G(e.format), n = r.presentation.mode === "auto" ? Le(t, r) : He(
896
- t,
897
- r,
898
- r.presentation.dialect,
899
- r.presentation.pattern
900
- );
901
- return (o) => {
902
- if (o === null)
903
- return { ok: !0, text: "", status: "empty" };
904
- const a = Oe(o, t.valueKind);
905
- return a.status === "invalid_shape" ? R(o, t, "invalid_raw_temporal_value") : a.status === "out_of_range" ? R(o, t, "out_of_range_raw_temporal_value") : { ok: !0, text: n(a), status: "formatted" };
906
- };
907
- }
908
- function Qe(e) {
909
- return Re({
910
- metadata: e.metadata,
911
- format: e.format
912
- })(e.value);
913
- }
914
- export {
915
- y as R,
916
- We as a,
917
- Ve as b,
918
- Xe as c,
919
- be as d,
920
- Ge as e,
921
- Re as f,
922
- Qe as g,
923
- Ne as h,
924
- re as i,
925
- $ as j,
926
- G as p,
927
- qe as r,
928
- P as t,
929
- Je as v
930
- };