@spear-ai/spectral 1.9.1 → 1.10.1

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 (241) hide show
  1. package/README.md +6 -5
  2. package/dist/.js +113 -239
  3. package/dist/Accordion-CDXdSAST.js +363 -0
  4. package/dist/Accordion.js +3 -498
  5. package/dist/Alert/AlertBase.js +69 -152
  6. package/dist/Alert.js +58 -106
  7. package/dist/AnimatePresence-D-9jXfgI.js +178 -0
  8. package/dist/App.js +6 -6
  9. package/dist/Avatar.js +83 -65
  10. package/dist/Badge.d.ts +1 -3
  11. package/dist/Badge.js +21 -25
  12. package/dist/Button.js +102 -178
  13. package/dist/ButtonGroup/ButtonGroupButton.js +38 -40
  14. package/dist/ButtonGroup.js +55 -59
  15. package/dist/ButtonIcon.js +58 -134
  16. package/dist/Calendar-s4lyijkn.js +3109 -0
  17. package/dist/Checkbox/CheckboxBase.js +94 -126
  18. package/dist/Checkbox.d.ts +1 -1
  19. package/dist/Checkbox.js +40 -105
  20. package/dist/Combobox/ComboboxBase.js +2 -79
  21. package/dist/Combobox.js +106 -172
  22. package/dist/ComboboxBase-D8Nf4xC-.js +491 -0
  23. package/dist/ControlGroup/ControlGroupSelect.d.ts +1 -1
  24. package/dist/ControlGroup/ControlGroupSelect.js +85 -101
  25. package/dist/ControlGroup.js +45 -48
  26. package/dist/DataCard/Card.js +37 -12
  27. package/dist/DataCard.d.ts +1 -1
  28. package/dist/DataCard.js +36 -16
  29. package/dist/DateTimePicker/Calendar.js +2 -2967
  30. package/dist/DateTimePicker/DateTimeDisplayInput.d.ts +1 -1
  31. package/dist/DateTimePicker/DateTimeDisplayInput.js +379 -275
  32. package/dist/DateTimePicker/DateTimeInput.d.ts +1 -1
  33. package/dist/DateTimePicker/DateTimeInput.js +133 -141
  34. package/dist/DateTimePicker/DateTimeUtils.js +2 -2193
  35. package/dist/DateTimePicker/TimePeriodSelect.d.ts +1 -1
  36. package/dist/DateTimePicker/TimePeriodSelect.js +45 -20
  37. package/dist/DateTimePicker/TimePicker.d.ts +1 -1
  38. package/dist/DateTimePicker/TimePicker.js +76 -60
  39. package/dist/DateTimePicker.d.ts +2 -2
  40. package/dist/DateTimePicker.js +87 -205
  41. package/dist/DateTimeUtils-DVvG6H-p.js +2098 -0
  42. package/dist/Dialog.js +74 -74
  43. package/dist/Drawer.js +67 -37
  44. package/dist/HoverCard-CYDsIiVK.js +201 -0
  45. package/dist/HoverCard.d.ts +1 -1
  46. package/dist/HoverCard.js +2 -218
  47. package/dist/Icons/AnalyzeIcon.js +50 -57
  48. package/dist/Icons/AnnotationsIcon.js +20 -15
  49. package/dist/Icons/ApprovedIcon.js +26 -18
  50. package/dist/Icons/ArrowDownIcon.js +20 -6
  51. package/dist/Icons/ArrowUpIcon.js +20 -6
  52. package/dist/Icons/BoxToolIcon.js +17 -12
  53. package/dist/Icons/CalendarIcon.js +43 -20
  54. package/dist/Icons/CheckCircleIcon.js +26 -10
  55. package/dist/Icons/CheckSquareIcon.js +26 -10
  56. package/dist/Icons/CheckmarkIcon.js +22 -9
  57. package/dist/Icons/ChevronDownIcon.js +22 -9
  58. package/dist/Icons/ChevronUpIcon.js +22 -9
  59. package/dist/Icons/ClockIcon.js +26 -18
  60. package/dist/Icons/CloseCircleIcon.js +26 -10
  61. package/dist/Icons/CloseIcon.js +18 -9
  62. package/dist/Icons/DashboardIcon.js +36 -10
  63. package/dist/Icons/DatabaseIcon.js +36 -19
  64. package/dist/Icons/DeleteIcon.js +36 -19
  65. package/dist/Icons/DurationIcon.js +57 -22
  66. package/dist/Icons/EditIcon.js +26 -27
  67. package/dist/Icons/EmailIcon.js +26 -10
  68. package/dist/Icons/EraserIcon.js +41 -25
  69. package/dist/Icons/ErrorIcon.js +27 -11
  70. package/dist/Icons/EyeClosedIcon.js +29 -13
  71. package/dist/Icons/EyeClosedIcon2.js +27 -11
  72. package/dist/Icons/EyeOpenIcon.js +22 -9
  73. package/dist/Icons/FileDownloadIcon.js +43 -20
  74. package/dist/Icons/GoToFirstIcon.js +26 -9
  75. package/dist/Icons/GoToLastIcon.js +26 -9
  76. package/dist/Icons/HarmonicCursorsIcon.js +23 -9
  77. package/dist/Icons/IconBase.d.ts +3 -3
  78. package/dist/Icons/IconBase.js +49 -66
  79. package/dist/Icons/InfoIcon.js +36 -10
  80. package/dist/Icons/KeyboardIcon.js +26 -27
  81. package/dist/Icons/LabelIcon.js +19 -14
  82. package/dist/Icons/LassoIcon.js +36 -28
  83. package/dist/Icons/LineToolIcon.js +48 -39
  84. package/dist/Icons/LiveViewIcon.js +50 -12
  85. package/dist/Icons/LoaderIcon.js +67 -27
  86. package/dist/Icons/LocationIcon.js +26 -27
  87. package/dist/Icons/LogoutIcon.js +20 -15
  88. package/dist/Icons/MeasureIcon.js +78 -25
  89. package/dist/Icons/MessagesIcon.js +33 -18
  90. package/dist/Icons/MetadataIcon.js +20 -15
  91. package/dist/Icons/MinusIcon.d.ts +1 -1
  92. package/dist/Icons/MinusIcon.js +18 -6
  93. package/dist/Icons/OntologyIcon.js +87 -71
  94. package/dist/Icons/PanelIconClose.js +28 -10
  95. package/dist/Icons/PanelIconOpen.js +28 -10
  96. package/dist/Icons/PlayIcon.js +20 -6
  97. package/dist/Icons/PlusIcon.js +20 -14
  98. package/dist/Icons/PolygonIcon.js +50 -39
  99. package/dist/Icons/ProgressCheckIcon.d.ts +5 -0
  100. package/dist/Icons/ProgressCheckIcon.js +58 -0
  101. package/dist/Icons/ResetIcon.js +17 -12
  102. package/dist/Icons/ReviewedIcon.js +36 -19
  103. package/dist/Icons/ScissorsIcon.js +22 -17
  104. package/dist/Icons/SearchIcon.js +26 -9
  105. package/dist/Icons/SettingsIcon.js +26 -27
  106. package/dist/Icons/SortAscendingIcon.js +50 -12
  107. package/dist/Icons/SortAtoZIcon.js +50 -12
  108. package/dist/Icons/SortDescendingIcon.js +50 -12
  109. package/dist/Icons/SortZtoAIcon.js +50 -12
  110. package/dist/Icons/StackIcon.js +26 -9
  111. package/dist/Icons/StarIcon.js +20 -6
  112. package/dist/Icons/TrashIcon.js +17 -12
  113. package/dist/Icons/UndoIcon.js +20 -15
  114. package/dist/Icons/User2Icon.js +26 -10
  115. package/dist/Icons/UserIcon.js +19 -14
  116. package/dist/Icons/WarningIcon.js +19 -14
  117. package/dist/Icons/ZoomAllIcon.js +71 -15
  118. package/dist/Icons/ZoomXIcon.js +36 -10
  119. package/dist/Icons/ZoomYIcon.js +36 -10
  120. package/dist/Icons/index.d.ts +1 -0
  121. package/dist/Icons.js +68 -136
  122. package/dist/IconsAnimated/PanelLeftCloseIcon.js +66 -36
  123. package/dist/IconsAnimated/PanelLeftOpenIcon.js +66 -36
  124. package/dist/IconsAnimated.js +3 -6
  125. package/dist/Input/InputUtils.js +51 -52
  126. package/dist/Input.js +132 -185
  127. package/dist/InputNumeric.d.ts +14 -0
  128. package/dist/InputNumeric.js +137 -0
  129. package/dist/InputOTP-cVn5Bzyp.js +461 -0
  130. package/dist/InputOTP.js +2 -382
  131. package/dist/Kbd.d.ts +1 -1
  132. package/dist/Kbd.js +182 -86
  133. package/dist/Label.js +12 -14
  134. package/dist/MultiSelect/MultiSelectBase.js +331 -403
  135. package/dist/MultiSelect.d.ts +1 -1
  136. package/dist/MultiSelect.js +23 -23
  137. package/dist/Popover.js +28 -32
  138. package/dist/RadioButton.d.ts +17 -0
  139. package/dist/RadioButton.js +33 -0
  140. package/dist/RadioButtonGroup/RadioButtonGroupBase.d.ts +3 -1
  141. package/dist/RadioButtonGroup/RadioButtonGroupBase.js +49 -46
  142. package/dist/RadioButtonGroup.d.ts +1 -1
  143. package/dist/RadioButtonGroup.js +11 -8
  144. package/dist/RadioGroup-w_q6RGEK.js +447 -0
  145. package/dist/RadioGroup.js +2 -505
  146. package/dist/Select.js +163 -186
  147. package/dist/Separator.js +16 -19
  148. package/dist/Skeleton.js +10 -6
  149. package/dist/Slider-BzzZT3Zm.js +490 -0
  150. package/dist/Slider.js +2 -562
  151. package/dist/SpectralProvider.js +8 -5
  152. package/dist/Switch/SwitchBase.js +91 -95
  153. package/dist/Switch-CVzRJ-0n.js +126 -0
  154. package/dist/Switch.d.ts +1 -1
  155. package/dist/Switch.js +2 -134
  156. package/dist/Tabs/TabsBase.js +242 -250
  157. package/dist/Tabs/tabsUtils.js +65 -73
  158. package/dist/Tabs.d.ts +1 -1
  159. package/dist/Tabs.js +73 -103
  160. package/dist/Textarea/TextareaUtils.js +35 -46
  161. package/dist/Textarea.js +83 -160
  162. package/dist/Toast-9zqXxKKO.js +711 -0
  163. package/dist/Toast.js +2 -885
  164. package/dist/Toggle/ToggleBase.js +46 -56
  165. package/dist/Toggle.d.ts +1 -1
  166. package/dist/Toggle.js +52 -62
  167. package/dist/ToggleGroup/ToggleGroupBase.js +128 -104
  168. package/dist/ToggleGroup.d.ts +1 -1
  169. package/dist/ToggleGroup.js +52 -63
  170. package/dist/Tooltip-D1K8kY1y.js +389 -0
  171. package/dist/Tooltip.js +2 -365
  172. package/dist/Tray.js +174 -217
  173. package/dist/chunk-h9knIhTc.js +20 -0
  174. package/dist/clsx-jM1GlMvB.js +16 -0
  175. package/dist/dist-3Af8168y.js +913 -0
  176. package/dist/dist-7HRQ5IKN.js +249 -0
  177. package/dist/dist-B2k1iWFp.js +129 -0
  178. package/dist/dist-B4FgboI8.js +122 -0
  179. package/dist/dist-B4g6zpUF.js +33 -0
  180. package/dist/dist-B9tup-4O.js +216 -0
  181. package/dist/dist-BK1K0g9W.js +29 -0
  182. package/dist/dist-Bfjk-jx9.js +28 -0
  183. package/dist/dist-Bft31cJh.js +65 -0
  184. package/dist/dist-BtdmHAzK.js +190 -0
  185. package/dist/dist-C0Hifjgh.js +1287 -0
  186. package/dist/dist-CGzgmYB9.js +68 -0
  187. package/dist/dist-ClmepHp4.js +10 -0
  188. package/dist/dist-D8Wb_MX9.js +6 -0
  189. package/dist/dist-Dtvmk11N.js +12 -0
  190. package/dist/dist-fW81qjVl.js +677 -0
  191. package/dist/dist-s1uWaZYZ.js +11 -0
  192. package/dist/es2015-YHaMV-St.js +701 -0
  193. package/dist/hooks/useAccordionAutoScroll.js +66 -67
  194. package/dist/hooks/useControllableState.js +14 -13
  195. package/dist/hooks/useConvertToOklch.d.ts +3 -0
  196. package/dist/hooks/useConvertToOklch.d.ts.map +1 -0
  197. package/dist/hooks/useConvertToOklch.js +51 -0
  198. package/dist/hooks/useTheme.js +21 -17
  199. package/dist/index.d.ts +3 -1
  200. package/dist/index.d.ts.map +1 -1
  201. package/dist/main.js +18954 -27224
  202. package/dist/primitives/button.js +39 -41
  203. package/dist/primitives/input-group.js +57 -73
  204. package/dist/primitives/input.js +11 -20
  205. package/dist/primitives/popover.js +34 -28
  206. package/dist/primitives/select.js +70 -138
  207. package/dist/primitives/slot.js +32 -31
  208. package/dist/primitives/textarea.js +10 -16
  209. package/dist/proxy-Dn10Pl_g.js +4920 -0
  210. package/dist/styles/main.css +2 -1
  211. package/dist/styles/spectral.css +1 -1
  212. package/dist/twUtils-VNWgstKL.js +1673 -0
  213. package/dist/use-animation-CBUDycyW.js +57 -0
  214. package/dist/utils/constants.js +4 -4
  215. package/dist/utils/formFieldUtils.js +136 -148
  216. package/dist/utils/sharedUtils.js +26 -7
  217. package/dist/utils/twUtils.js +2 -2919
  218. package/package.json +24 -28
  219. package/dist/ComboboxBase-CxNxYtdT.js +0 -408
  220. package/dist/clsx-OuTLNxxd.js +0 -16
  221. package/dist/index-0ioNhtNM.js +0 -10
  222. package/dist/index-6oYKCvIn.js +0 -677
  223. package/dist/index-BFOf48AQ.js +0 -69
  224. package/dist/index-BZPx6jYI.js +0 -8
  225. package/dist/index-BlHU_t18.js +0 -142
  226. package/dist/index-Bm1RbF6w.js +0 -1037
  227. package/dist/index-Bv2OIg5P.js +0 -225
  228. package/dist/index-CKEI0pDv.js +0 -56
  229. package/dist/index-CM_hWgfC.js +0 -32
  230. package/dist/index-C_YVr64u.js +0 -1538
  231. package/dist/index-Cl8VeY0o.js +0 -149
  232. package/dist/index-CwSyIPrv.js +0 -13
  233. package/dist/index-D29mdTf5.js +0 -34
  234. package/dist/index-DEYs15GP.js +0 -66
  235. package/dist/index-Dc0No4pV.js +0 -233
  236. package/dist/index-T6XEa11q.js +0 -822
  237. package/dist/index-pBCLb6Gr.js +0 -240
  238. package/dist/index-psiVrsnE.js +0 -27
  239. package/dist/index-rKs9bXHr.js +0 -6
  240. package/dist/proxy-CO_-Vget.js +0 -4975
  241. package/dist/use-animation-DhEPRwZ3.js +0 -62
@@ -1,2967 +1,2 @@
1
- "use client";
2
- import "../styles/main.css";
3
- import { jsx as at } from "react/jsx-runtime";
4
- import "../Icons/AnalyzeIcon.js";
5
- import "../Icons/AnnotationsIcon.js";
6
- import "../Icons/ApprovedIcon.js";
7
- import "../Icons/ArrowDownIcon.js";
8
- import "../Icons/ArrowUpIcon.js";
9
- import "../Icons/BoxToolIcon.js";
10
- import "../Icons/CalendarIcon.js";
11
- import "../Icons/CheckCircleIcon.js";
12
- import "../Icons/CheckSquareIcon.js";
13
- import "../Icons/CheckmarkIcon.js";
14
- import { ChevronDownIcon as vn } from "../Icons/ChevronDownIcon.js";
15
- import "../Icons/ChevronUpIcon.js";
16
- import "../Icons/ClockIcon.js";
17
- import "../Icons/CloseCircleIcon.js";
18
- import "../Icons/CloseIcon.js";
19
- import "../Icons/DashboardIcon.js";
20
- import "../Icons/DatabaseIcon.js";
21
- import "../Icons/DeleteIcon.js";
22
- import "../Icons/DurationIcon.js";
23
- import "../Icons/EditIcon.js";
24
- import "../Icons/EmailIcon.js";
25
- import "../Icons/EraserIcon.js";
26
- import "../Icons/ErrorIcon.js";
27
- import "../Icons/EyeClosedIcon.js";
28
- import "../Icons/EyeClosedIcon2.js";
29
- import "../Icons/EyeOpenIcon.js";
30
- import "../Icons/FileDownloadIcon.js";
31
- import "../Icons/GoToFirstIcon.js";
32
- import "../Icons/GoToLastIcon.js";
33
- import "../Icons/HarmonicCursorsIcon.js";
34
- import "../Icons/InfoIcon.js";
35
- import "../Icons/KeyboardIcon.js";
36
- import "../Icons/LabelIcon.js";
37
- import "../Icons/LassoIcon.js";
38
- import "../Icons/LineToolIcon.js";
39
- import "../Icons/LiveViewIcon.js";
40
- import "../Icons/LoaderIcon.js";
41
- import "../Icons/LocationIcon.js";
42
- import "../Icons/LogoutIcon.js";
43
- import "../Icons/MeasureIcon.js";
44
- import "../Icons/MessagesIcon.js";
45
- import "../Icons/MetadataIcon.js";
46
- import "../Icons/MinusIcon.js";
47
- import "../Icons/OntologyIcon.js";
48
- import "../Icons/PanelIconClose.js";
49
- import "../Icons/PanelIconOpen.js";
50
- import "../Icons/PlayIcon.js";
51
- import "../Icons/PlusIcon.js";
52
- import "../Icons/PolygonIcon.js";
53
- import "../Icons/ResetIcon.js";
54
- import "../Icons/ReviewedIcon.js";
55
- import "../Icons/ScissorsIcon.js";
56
- import "../Icons/SearchIcon.js";
57
- import "../Icons/SettingsIcon.js";
58
- import "../Icons/SortAscendingIcon.js";
59
- import "../Icons/SortAtoZIcon.js";
60
- import "../Icons/SortDescendingIcon.js";
61
- import "../Icons/SortZtoAIcon.js";
62
- import "../Icons/StackIcon.js";
63
- import "../Icons/StarIcon.js";
64
- import "../Icons/TrashIcon.js";
65
- import "../Icons/UndoIcon.js";
66
- import "../Icons/User2Icon.js";
67
- import "../Icons/UserIcon.js";
68
- import "../Icons/WarningIcon.js";
69
- import "../Icons/ZoomAllIcon.js";
70
- import "../Icons/ZoomXIcon.js";
71
- import "../Icons/ZoomYIcon.js";
72
- import { cn as B } from "../utils/twUtils.js";
73
- import d, { createContext as Wn, useContext as Sn, useCallback as R, useRef as Ce, useLayoutEffect as Cn, useState as Re, useEffect as Nn, useMemo as be } from "react";
74
- function Yn(e, t, r = "long") {
75
- return new Intl.DateTimeFormat("en-US", {
76
- // Enforces engine to render the time. Without the option JavaScriptCore omits it.
77
- hour: "numeric",
78
- timeZone: e,
79
- timeZoneName: r
80
- }).format(t).split(/\s/g).slice(2).join(" ");
81
- }
82
- const Tn = {}, ge = {};
83
- function ie(e, t) {
84
- try {
85
- const n = (Tn[e] ||= new Intl.DateTimeFormat("en-US", {
86
- timeZone: e,
87
- timeZoneName: "longOffset"
88
- }).format)(t).split("GMT")[1];
89
- return n in ge ? ge[n] : it(n, n.split(":"));
90
- } catch {
91
- if (e in ge) return ge[e];
92
- const r = e?.match(xn);
93
- return r ? it(e, r.slice(1)) : NaN;
94
- }
95
- }
96
- const xn = /([+-]\d\d):?(\d\d)?/;
97
- function it(e, t) {
98
- const r = +(t[0] || 0), n = +(t[1] || 0), o = +(t[2] || 0) / 60;
99
- return ge[e] = r * 60 + n > 0 ? r * 60 + n + o : r * 60 - n - o;
100
- }
101
- class J extends Date {
102
- //#region static
103
- constructor(...t) {
104
- super(), t.length > 1 && typeof t[t.length - 1] == "string" && (this.timeZone = t.pop()), this.internal = /* @__PURE__ */ new Date(), isNaN(ie(this.timeZone, this)) ? this.setTime(NaN) : t.length ? typeof t[0] == "number" && (t.length === 1 || t.length === 2 && typeof t[1] != "number") ? this.setTime(t[0]) : typeof t[0] == "string" ? this.setTime(+new Date(t[0])) : t[0] instanceof Date ? this.setTime(+t[0]) : (this.setTime(+new Date(...t)), Mt(this), ze(this)) : this.setTime(Date.now());
105
- }
106
- static tz(t, ...r) {
107
- return r.length ? new J(...r, t) : new J(Date.now(), t);
108
- }
109
- //#endregion
110
- //#region time zone
111
- withTimeZone(t) {
112
- return new J(+this, t);
113
- }
114
- getTimezoneOffset() {
115
- const t = -ie(this.timeZone, this);
116
- return t > 0 ? Math.floor(t) : Math.ceil(t);
117
- }
118
- //#endregion
119
- //#region time
120
- setTime(t) {
121
- return Date.prototype.setTime.apply(this, arguments), ze(this), +this;
122
- }
123
- //#endregion
124
- //#region date-fns integration
125
- [/* @__PURE__ */ Symbol.for("constructDateFrom")](t) {
126
- return new J(+new Date(t), this.timeZone);
127
- }
128
- //#endregion
129
- }
130
- const ct = /^(get|set)(?!UTC)/;
131
- Object.getOwnPropertyNames(Date.prototype).forEach((e) => {
132
- if (!ct.test(e)) return;
133
- const t = e.replace(ct, "$1UTC");
134
- J.prototype[t] && (e.startsWith("get") ? J.prototype[e] = function() {
135
- return this.internal[t]();
136
- } : (J.prototype[e] = function() {
137
- return Date.prototype[t].apply(this.internal, arguments), Pn(this), +this;
138
- }, J.prototype[t] = function() {
139
- return Date.prototype[t].apply(this, arguments), ze(this), +this;
140
- }));
141
- });
142
- function ze(e) {
143
- e.internal.setTime(+e), e.internal.setUTCSeconds(e.internal.getUTCSeconds() - Math.round(-ie(e.timeZone, e) * 60));
144
- }
145
- function Pn(e) {
146
- Date.prototype.setFullYear.call(e, e.internal.getUTCFullYear(), e.internal.getUTCMonth(), e.internal.getUTCDate()), Date.prototype.setHours.call(e, e.internal.getUTCHours(), e.internal.getUTCMinutes(), e.internal.getUTCSeconds(), e.internal.getUTCMilliseconds()), Mt(e);
147
- }
148
- function Mt(e) {
149
- const t = ie(e.timeZone, e), r = t > 0 ? Math.floor(t) : Math.ceil(t), n = /* @__PURE__ */ new Date(+e);
150
- n.setUTCHours(n.getUTCHours() - 1);
151
- const o = -(/* @__PURE__ */ new Date(+e)).getTimezoneOffset(), a = -(/* @__PURE__ */ new Date(+n)).getTimezoneOffset(), i = o - a, s = Date.prototype.getHours.apply(e) !== e.internal.getUTCHours();
152
- i && s && e.internal.setUTCMinutes(e.internal.getUTCMinutes() + i);
153
- const c = o - r;
154
- c && Date.prototype.setUTCMinutes.call(e, Date.prototype.getUTCMinutes.call(e) + c);
155
- const u = /* @__PURE__ */ new Date(+e);
156
- u.setUTCSeconds(0);
157
- const f = o > 0 ? u.getSeconds() : (u.getSeconds() - 60) % 60, l = Math.round(-(ie(e.timeZone, e) * 60)) % 60;
158
- (l || f) && (e.internal.setUTCSeconds(e.internal.getUTCSeconds() + l), Date.prototype.setUTCSeconds.call(e, Date.prototype.getUTCSeconds.call(e) + l + f));
159
- const h = ie(e.timeZone, e), g = h > 0 ? Math.floor(h) : Math.ceil(h), C = -(/* @__PURE__ */ new Date(+e)).getTimezoneOffset() - g, O = g !== r, T = C - c;
160
- if (O && T) {
161
- Date.prototype.setUTCMinutes.call(e, Date.prototype.getUTCMinutes.call(e) + T);
162
- const M = ie(e.timeZone, e), b = M > 0 ? Math.floor(M) : Math.ceil(M), D = g - b;
163
- D && (e.internal.setUTCMinutes(e.internal.getUTCMinutes() + D), Date.prototype.setUTCMinutes.call(e, Date.prototype.getUTCMinutes.call(e) + D));
164
- }
165
- }
166
- class A extends J {
167
- //#region static
168
- static tz(t, ...r) {
169
- return r.length ? new A(...r, t) : new A(Date.now(), t);
170
- }
171
- //#endregion
172
- //#region representation
173
- toISOString() {
174
- const [t, r, n] = this.tzComponents(), o = `${t}${r}:${n}`;
175
- return this.internal.toISOString().slice(0, -1) + o;
176
- }
177
- toString() {
178
- return `${this.toDateString()} ${this.toTimeString()}`;
179
- }
180
- toDateString() {
181
- const [t, r, n, o] = this.internal.toUTCString().split(" ");
182
- return `${t?.slice(0, -1)} ${n} ${r} ${o}`;
183
- }
184
- toTimeString() {
185
- const t = this.internal.toUTCString().split(" ")[4], [r, n, o] = this.tzComponents();
186
- return `${t} GMT${r}${n}${o} (${Yn(this.timeZone, this)})`;
187
- }
188
- toLocaleString(t, r) {
189
- return Date.prototype.toLocaleString.call(this, t, {
190
- ...r,
191
- timeZone: r?.timeZone || this.timeZone
192
- });
193
- }
194
- toLocaleDateString(t, r) {
195
- return Date.prototype.toLocaleDateString.call(this, t, {
196
- ...r,
197
- timeZone: r?.timeZone || this.timeZone
198
- });
199
- }
200
- toLocaleTimeString(t, r) {
201
- return Date.prototype.toLocaleTimeString.call(this, t, {
202
- ...r,
203
- timeZone: r?.timeZone || this.timeZone
204
- });
205
- }
206
- //#endregion
207
- //#region private
208
- tzComponents() {
209
- const t = this.getTimezoneOffset(), r = t > 0 ? "-" : "+", n = String(Math.floor(Math.abs(t) / 60)).padStart(2, "0"), o = String(Math.abs(t) % 60).padStart(2, "0");
210
- return [r, n, o];
211
- }
212
- //#endregion
213
- withTimeZone(t) {
214
- return new A(+this, t);
215
- }
216
- //#region date-fns integration
217
- [/* @__PURE__ */ Symbol.for("constructDateFrom")](t) {
218
- return new A(+new Date(t), this.timeZone);
219
- }
220
- //#endregion
221
- }
222
- const Dt = 6048e5, En = 864e5, ut = /* @__PURE__ */ Symbol.for("constructDateFrom");
223
- function I(e, t) {
224
- return typeof e == "function" ? e(t) : e && typeof e == "object" && ut in e ? e[ut](t) : e instanceof Date ? new e.constructor(t) : new Date(t);
225
- }
226
- function P(e, t) {
227
- return I(t || e, e);
228
- }
229
- function kt(e, t, r) {
230
- const n = P(e, r?.in);
231
- return isNaN(t) ? I(e, NaN) : (t && n.setDate(n.getDate() + t), n);
232
- }
233
- function Ot(e, t, r) {
234
- const n = P(e, r?.in);
235
- if (isNaN(t)) return I(e, NaN);
236
- if (!t)
237
- return n;
238
- const o = n.getDate(), a = I(e, n.getTime());
239
- a.setMonth(n.getMonth() + t + 1, 0);
240
- const i = a.getDate();
241
- return o >= i ? a : (n.setFullYear(
242
- a.getFullYear(),
243
- a.getMonth(),
244
- o
245
- ), n);
246
- }
247
- let _n = {};
248
- function De() {
249
- return _n;
250
- }
251
- function de(e, t) {
252
- const r = De(), n = t?.weekStartsOn ?? t?.locale?.options?.weekStartsOn ?? r.weekStartsOn ?? r.locale?.options?.weekStartsOn ?? 0, o = P(e, t?.in), a = o.getDay(), i = (a < n ? 7 : 0) + a - n;
253
- return o.setDate(o.getDate() - i), o.setHours(0, 0, 0, 0), o;
254
- }
255
- function we(e, t) {
256
- return de(e, { ...t, weekStartsOn: 1 });
257
- }
258
- function vt(e, t) {
259
- const r = P(e, t?.in), n = r.getFullYear(), o = I(r, 0);
260
- o.setFullYear(n + 1, 0, 4), o.setHours(0, 0, 0, 0);
261
- const a = we(o), i = I(r, 0);
262
- i.setFullYear(n, 0, 4), i.setHours(0, 0, 0, 0);
263
- const s = we(i);
264
- return r.getTime() >= a.getTime() ? n + 1 : r.getTime() >= s.getTime() ? n : n - 1;
265
- }
266
- function lt(e) {
267
- const t = P(e), r = new Date(
268
- Date.UTC(
269
- t.getFullYear(),
270
- t.getMonth(),
271
- t.getDate(),
272
- t.getHours(),
273
- t.getMinutes(),
274
- t.getSeconds(),
275
- t.getMilliseconds()
276
- )
277
- );
278
- return r.setUTCFullYear(t.getFullYear()), +e - +r;
279
- }
280
- function he(e, ...t) {
281
- const r = I.bind(
282
- null,
283
- t.find((n) => typeof n == "object")
284
- );
285
- return t.map(r);
286
- }
287
- function Me(e, t) {
288
- const r = P(e, t?.in);
289
- return r.setHours(0, 0, 0, 0), r;
290
- }
291
- function Qe(e, t, r) {
292
- const [n, o] = he(
293
- r?.in,
294
- e,
295
- t
296
- ), a = Me(n), i = Me(o), s = +a - lt(a), c = +i - lt(i);
297
- return Math.round((s - c) / En);
298
- }
299
- function Fn(e, t) {
300
- const r = vt(e, t), n = I(e, 0);
301
- return n.setFullYear(r, 0, 4), n.setHours(0, 0, 0, 0), we(n);
302
- }
303
- function Bn(e, t, r) {
304
- return kt(e, t * 7, r);
305
- }
306
- function In(e, t, r) {
307
- return Ot(e, t * 12, r);
308
- }
309
- function Hn(e, t) {
310
- let r, n = t?.in;
311
- return e.forEach((o) => {
312
- !n && typeof o == "object" && (n = I.bind(null, o));
313
- const a = P(o, n);
314
- (!r || r < a || isNaN(+a)) && (r = a);
315
- }), I(n, r || NaN);
316
- }
317
- function An(e, t) {
318
- let r, n = t?.in;
319
- return e.forEach((o) => {
320
- !n && typeof o == "object" && (n = I.bind(null, o));
321
- const a = P(o, n);
322
- (!r || r > a || isNaN(+a)) && (r = a);
323
- }), I(n, r || NaN);
324
- }
325
- function qn(e, t, r) {
326
- const [n, o] = he(
327
- r?.in,
328
- e,
329
- t
330
- );
331
- return +Me(n) == +Me(o);
332
- }
333
- function Wt(e) {
334
- return e instanceof Date || typeof e == "object" && Object.prototype.toString.call(e) === "[object Date]";
335
- }
336
- function jn(e) {
337
- return !(!Wt(e) && typeof e != "number" || isNaN(+P(e)));
338
- }
339
- function St(e, t, r) {
340
- const [n, o] = he(
341
- r?.in,
342
- e,
343
- t
344
- ), a = n.getFullYear() - o.getFullYear(), i = n.getMonth() - o.getMonth();
345
- return a * 12 + i;
346
- }
347
- function Gn(e, t) {
348
- const r = P(e, t?.in), n = r.getMonth();
349
- return r.setFullYear(r.getFullYear(), n + 1, 0), r.setHours(23, 59, 59, 999), r;
350
- }
351
- function Ct(e, t) {
352
- const [r, n] = he(e, t.start, t.end);
353
- return { start: r, end: n };
354
- }
355
- function $n(e, t) {
356
- const { start: r, end: n } = Ct(t?.in, e);
357
- let o = +r > +n;
358
- const a = o ? +r : +n, i = o ? n : r;
359
- i.setHours(0, 0, 0, 0), i.setDate(1);
360
- let s = 1;
361
- const c = [];
362
- for (; +i <= a; )
363
- c.push(I(r, i)), i.setMonth(i.getMonth() + s);
364
- return o ? c.reverse() : c;
365
- }
366
- function Rn(e, t) {
367
- const r = P(e, t?.in);
368
- return r.setDate(1), r.setHours(0, 0, 0, 0), r;
369
- }
370
- function zn(e, t) {
371
- const r = P(e, t?.in), n = r.getFullYear();
372
- return r.setFullYear(n + 1, 0, 0), r.setHours(23, 59, 59, 999), r;
373
- }
374
- function Nt(e, t) {
375
- const r = P(e, t?.in);
376
- return r.setFullYear(r.getFullYear(), 0, 1), r.setHours(0, 0, 0, 0), r;
377
- }
378
- function Qn(e, t) {
379
- const { start: r, end: n } = Ct(t?.in, e);
380
- let o = +r > +n;
381
- const a = o ? +r : +n, i = o ? n : r;
382
- i.setHours(0, 0, 0, 0), i.setMonth(0, 1);
383
- let s = 1;
384
- const c = [];
385
- for (; +i <= a; )
386
- c.push(I(r, i)), i.setFullYear(i.getFullYear() + s);
387
- return o ? c.reverse() : c;
388
- }
389
- function Yt(e, t) {
390
- const r = De(), n = t?.weekStartsOn ?? t?.locale?.options?.weekStartsOn ?? r.weekStartsOn ?? r.locale?.options?.weekStartsOn ?? 0, o = P(e, t?.in), a = o.getDay(), i = (a < n ? -7 : 0) + 6 - (a - n);
391
- return o.setDate(o.getDate() + i), o.setHours(23, 59, 59, 999), o;
392
- }
393
- function Xn(e, t) {
394
- return Yt(e, { ...t, weekStartsOn: 1 });
395
- }
396
- const Un = {
397
- lessThanXSeconds: {
398
- one: "less than a second",
399
- other: "less than {{count}} seconds"
400
- },
401
- xSeconds: {
402
- one: "1 second",
403
- other: "{{count}} seconds"
404
- },
405
- halfAMinute: "half a minute",
406
- lessThanXMinutes: {
407
- one: "less than a minute",
408
- other: "less than {{count}} minutes"
409
- },
410
- xMinutes: {
411
- one: "1 minute",
412
- other: "{{count}} minutes"
413
- },
414
- aboutXHours: {
415
- one: "about 1 hour",
416
- other: "about {{count}} hours"
417
- },
418
- xHours: {
419
- one: "1 hour",
420
- other: "{{count}} hours"
421
- },
422
- xDays: {
423
- one: "1 day",
424
- other: "{{count}} days"
425
- },
426
- aboutXWeeks: {
427
- one: "about 1 week",
428
- other: "about {{count}} weeks"
429
- },
430
- xWeeks: {
431
- one: "1 week",
432
- other: "{{count}} weeks"
433
- },
434
- aboutXMonths: {
435
- one: "about 1 month",
436
- other: "about {{count}} months"
437
- },
438
- xMonths: {
439
- one: "1 month",
440
- other: "{{count}} months"
441
- },
442
- aboutXYears: {
443
- one: "about 1 year",
444
- other: "about {{count}} years"
445
- },
446
- xYears: {
447
- one: "1 year",
448
- other: "{{count}} years"
449
- },
450
- overXYears: {
451
- one: "over 1 year",
452
- other: "over {{count}} years"
453
- },
454
- almostXYears: {
455
- one: "almost 1 year",
456
- other: "almost {{count}} years"
457
- }
458
- }, Vn = (e, t, r) => {
459
- let n;
460
- const o = Un[e];
461
- return typeof o == "string" ? n = o : t === 1 ? n = o.one : n = o.other.replace("{{count}}", t.toString()), r?.addSuffix ? r.comparison && r.comparison > 0 ? "in " + n : n + " ago" : n;
462
- };
463
- function Ae(e) {
464
- return (t = {}) => {
465
- const r = t.width ? String(t.width) : e.defaultWidth;
466
- return e.formats[r] || e.formats[e.defaultWidth];
467
- };
468
- }
469
- const Zn = {
470
- full: "EEEE, MMMM do, y",
471
- long: "MMMM do, y",
472
- medium: "MMM d, y",
473
- short: "MM/dd/yyyy"
474
- }, Kn = {
475
- full: "h:mm:ss a zzzz",
476
- long: "h:mm:ss a z",
477
- medium: "h:mm:ss a",
478
- short: "h:mm a"
479
- }, Jn = {
480
- full: "{{date}} 'at' {{time}}",
481
- long: "{{date}} 'at' {{time}}",
482
- medium: "{{date}}, {{time}}",
483
- short: "{{date}}, {{time}}"
484
- }, Ln = {
485
- date: Ae({
486
- formats: Zn,
487
- defaultWidth: "full"
488
- }),
489
- time: Ae({
490
- formats: Kn,
491
- defaultWidth: "full"
492
- }),
493
- dateTime: Ae({
494
- formats: Jn,
495
- defaultWidth: "full"
496
- })
497
- }, er = {
498
- lastWeek: "'last' eeee 'at' p",
499
- yesterday: "'yesterday at' p",
500
- today: "'today at' p",
501
- tomorrow: "'tomorrow at' p",
502
- nextWeek: "eeee 'at' p",
503
- other: "P"
504
- }, tr = (e, t, r, n) => er[e];
505
- function me(e) {
506
- return (t, r) => {
507
- const n = r?.context ? String(r.context) : "standalone";
508
- let o;
509
- if (n === "formatting" && e.formattingValues) {
510
- const i = e.defaultFormattingWidth || e.defaultWidth, s = r?.width ? String(r.width) : i;
511
- o = e.formattingValues[s] || e.formattingValues[i];
512
- } else {
513
- const i = e.defaultWidth, s = r?.width ? String(r.width) : e.defaultWidth;
514
- o = e.values[s] || e.values[i];
515
- }
516
- const a = e.argumentCallback ? e.argumentCallback(t) : t;
517
- return o[a];
518
- };
519
- }
520
- const nr = {
521
- narrow: ["B", "A"],
522
- abbreviated: ["BC", "AD"],
523
- wide: ["Before Christ", "Anno Domini"]
524
- }, rr = {
525
- narrow: ["1", "2", "3", "4"],
526
- abbreviated: ["Q1", "Q2", "Q3", "Q4"],
527
- wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
528
- }, or = {
529
- narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
530
- abbreviated: [
531
- "Jan",
532
- "Feb",
533
- "Mar",
534
- "Apr",
535
- "May",
536
- "Jun",
537
- "Jul",
538
- "Aug",
539
- "Sep",
540
- "Oct",
541
- "Nov",
542
- "Dec"
543
- ],
544
- wide: [
545
- "January",
546
- "February",
547
- "March",
548
- "April",
549
- "May",
550
- "June",
551
- "July",
552
- "August",
553
- "September",
554
- "October",
555
- "November",
556
- "December"
557
- ]
558
- }, sr = {
559
- narrow: ["S", "M", "T", "W", "T", "F", "S"],
560
- short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
561
- abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
562
- wide: [
563
- "Sunday",
564
- "Monday",
565
- "Tuesday",
566
- "Wednesday",
567
- "Thursday",
568
- "Friday",
569
- "Saturday"
570
- ]
571
- }, ar = {
572
- narrow: {
573
- am: "a",
574
- pm: "p",
575
- midnight: "mi",
576
- noon: "n",
577
- morning: "morning",
578
- afternoon: "afternoon",
579
- evening: "evening",
580
- night: "night"
581
- },
582
- abbreviated: {
583
- am: "AM",
584
- pm: "PM",
585
- midnight: "midnight",
586
- noon: "noon",
587
- morning: "morning",
588
- afternoon: "afternoon",
589
- evening: "evening",
590
- night: "night"
591
- },
592
- wide: {
593
- am: "a.m.",
594
- pm: "p.m.",
595
- midnight: "midnight",
596
- noon: "noon",
597
- morning: "morning",
598
- afternoon: "afternoon",
599
- evening: "evening",
600
- night: "night"
601
- }
602
- }, ir = {
603
- narrow: {
604
- am: "a",
605
- pm: "p",
606
- midnight: "mi",
607
- noon: "n",
608
- morning: "in the morning",
609
- afternoon: "in the afternoon",
610
- evening: "in the evening",
611
- night: "at night"
612
- },
613
- abbreviated: {
614
- am: "AM",
615
- pm: "PM",
616
- midnight: "midnight",
617
- noon: "noon",
618
- morning: "in the morning",
619
- afternoon: "in the afternoon",
620
- evening: "in the evening",
621
- night: "at night"
622
- },
623
- wide: {
624
- am: "a.m.",
625
- pm: "p.m.",
626
- midnight: "midnight",
627
- noon: "noon",
628
- morning: "in the morning",
629
- afternoon: "in the afternoon",
630
- evening: "in the evening",
631
- night: "at night"
632
- }
633
- }, cr = (e, t) => {
634
- const r = Number(e), n = r % 100;
635
- if (n > 20 || n < 10)
636
- switch (n % 10) {
637
- case 1:
638
- return r + "st";
639
- case 2:
640
- return r + "nd";
641
- case 3:
642
- return r + "rd";
643
- }
644
- return r + "th";
645
- }, ur = {
646
- ordinalNumber: cr,
647
- era: me({
648
- values: nr,
649
- defaultWidth: "wide"
650
- }),
651
- quarter: me({
652
- values: rr,
653
- defaultWidth: "wide",
654
- argumentCallback: (e) => e - 1
655
- }),
656
- month: me({
657
- values: or,
658
- defaultWidth: "wide"
659
- }),
660
- day: me({
661
- values: sr,
662
- defaultWidth: "wide"
663
- }),
664
- dayPeriod: me({
665
- values: ar,
666
- defaultWidth: "wide",
667
- formattingValues: ir,
668
- defaultFormattingWidth: "wide"
669
- })
670
- };
671
- function ye(e) {
672
- return (t, r = {}) => {
673
- const n = r.width, o = n && e.matchPatterns[n] || e.matchPatterns[e.defaultMatchWidth], a = t.match(o);
674
- if (!a)
675
- return null;
676
- const i = a[0], s = n && e.parsePatterns[n] || e.parsePatterns[e.defaultParseWidth], c = Array.isArray(s) ? fr(s, (l) => l.test(i)) : (
677
- // [TODO] -- I challenge you to fix the type
678
- lr(s, (l) => l.test(i))
679
- );
680
- let u;
681
- u = e.valueCallback ? e.valueCallback(c) : c, u = r.valueCallback ? (
682
- // [TODO] -- I challenge you to fix the type
683
- r.valueCallback(u)
684
- ) : u;
685
- const f = t.slice(i.length);
686
- return { value: u, rest: f };
687
- };
688
- }
689
- function lr(e, t) {
690
- for (const r in e)
691
- if (Object.prototype.hasOwnProperty.call(e, r) && t(e[r]))
692
- return r;
693
- }
694
- function fr(e, t) {
695
- for (let r = 0; r < e.length; r++)
696
- if (t(e[r]))
697
- return r;
698
- }
699
- function dr(e) {
700
- return (t, r = {}) => {
701
- const n = t.match(e.matchPattern);
702
- if (!n) return null;
703
- const o = n[0], a = t.match(e.parsePattern);
704
- if (!a) return null;
705
- let i = e.valueCallback ? e.valueCallback(a[0]) : a[0];
706
- i = r.valueCallback ? r.valueCallback(i) : i;
707
- const s = t.slice(o.length);
708
- return { value: i, rest: s };
709
- };
710
- }
711
- const hr = /^(\d+)(th|st|nd|rd)?/i, mr = /\d+/i, yr = {
712
- narrow: /^(b|a)/i,
713
- abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
714
- wide: /^(before christ|before common era|anno domini|common era)/i
715
- }, gr = {
716
- any: [/^b/i, /^(a|c)/i]
717
- }, pr = {
718
- narrow: /^[1234]/i,
719
- abbreviated: /^q[1234]/i,
720
- wide: /^[1234](th|st|nd|rd)? quarter/i
721
- }, br = {
722
- any: [/1/i, /2/i, /3/i, /4/i]
723
- }, wr = {
724
- narrow: /^[jfmasond]/i,
725
- abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
726
- wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
727
- }, Mr = {
728
- narrow: [
729
- /^j/i,
730
- /^f/i,
731
- /^m/i,
732
- /^a/i,
733
- /^m/i,
734
- /^j/i,
735
- /^j/i,
736
- /^a/i,
737
- /^s/i,
738
- /^o/i,
739
- /^n/i,
740
- /^d/i
741
- ],
742
- any: [
743
- /^ja/i,
744
- /^f/i,
745
- /^mar/i,
746
- /^ap/i,
747
- /^may/i,
748
- /^jun/i,
749
- /^jul/i,
750
- /^au/i,
751
- /^s/i,
752
- /^o/i,
753
- /^n/i,
754
- /^d/i
755
- ]
756
- }, Dr = {
757
- narrow: /^[smtwf]/i,
758
- short: /^(su|mo|tu|we|th|fr|sa)/i,
759
- abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
760
- wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
761
- }, kr = {
762
- narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
763
- any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
764
- }, Or = {
765
- narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
766
- any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
767
- }, vr = {
768
- any: {
769
- am: /^a/i,
770
- pm: /^p/i,
771
- midnight: /^mi/i,
772
- noon: /^no/i,
773
- morning: /morning/i,
774
- afternoon: /afternoon/i,
775
- evening: /evening/i,
776
- night: /night/i
777
- }
778
- }, Wr = {
779
- ordinalNumber: dr({
780
- matchPattern: hr,
781
- parsePattern: mr,
782
- valueCallback: (e) => parseInt(e, 10)
783
- }),
784
- era: ye({
785
- matchPatterns: yr,
786
- defaultMatchWidth: "wide",
787
- parsePatterns: gr,
788
- defaultParseWidth: "any"
789
- }),
790
- quarter: ye({
791
- matchPatterns: pr,
792
- defaultMatchWidth: "wide",
793
- parsePatterns: br,
794
- defaultParseWidth: "any",
795
- valueCallback: (e) => e + 1
796
- }),
797
- month: ye({
798
- matchPatterns: wr,
799
- defaultMatchWidth: "wide",
800
- parsePatterns: Mr,
801
- defaultParseWidth: "any"
802
- }),
803
- day: ye({
804
- matchPatterns: Dr,
805
- defaultMatchWidth: "wide",
806
- parsePatterns: kr,
807
- defaultParseWidth: "any"
808
- }),
809
- dayPeriod: ye({
810
- matchPatterns: Or,
811
- defaultMatchWidth: "any",
812
- parsePatterns: vr,
813
- defaultParseWidth: "any"
814
- })
815
- }, fe = {
816
- code: "en-US",
817
- formatDistance: Vn,
818
- formatLong: Ln,
819
- formatRelative: tr,
820
- localize: ur,
821
- match: Wr,
822
- options: {
823
- weekStartsOn: 0,
824
- firstWeekContainsDate: 1
825
- }
826
- };
827
- function Sr(e, t) {
828
- const r = P(e, t?.in);
829
- return Qe(r, Nt(r)) + 1;
830
- }
831
- function Xe(e, t) {
832
- const r = P(e, t?.in), n = +we(r) - +Fn(r);
833
- return Math.round(n / Dt) + 1;
834
- }
835
- function Tt(e, t) {
836
- const r = P(e, t?.in), n = r.getFullYear(), o = De(), a = t?.firstWeekContainsDate ?? t?.locale?.options?.firstWeekContainsDate ?? o.firstWeekContainsDate ?? o.locale?.options?.firstWeekContainsDate ?? 1, i = I(t?.in || e, 0);
837
- i.setFullYear(n + 1, 0, a), i.setHours(0, 0, 0, 0);
838
- const s = de(i, t), c = I(t?.in || e, 0);
839
- c.setFullYear(n, 0, a), c.setHours(0, 0, 0, 0);
840
- const u = de(c, t);
841
- return +r >= +s ? n + 1 : +r >= +u ? n : n - 1;
842
- }
843
- function Cr(e, t) {
844
- const r = De(), n = t?.firstWeekContainsDate ?? t?.locale?.options?.firstWeekContainsDate ?? r.firstWeekContainsDate ?? r.locale?.options?.firstWeekContainsDate ?? 1, o = Tt(e, t), a = I(t?.in || e, 0);
845
- return a.setFullYear(o, 0, n), a.setHours(0, 0, 0, 0), de(a, t);
846
- }
847
- function Ue(e, t) {
848
- const r = P(e, t?.in), n = +de(r, t) - +Cr(r, t);
849
- return Math.round(n / Dt) + 1;
850
- }
851
- function x(e, t) {
852
- const r = e < 0 ? "-" : "", n = Math.abs(e).toString().padStart(t, "0");
853
- return r + n;
854
- }
855
- const se = {
856
- // Year
857
- y(e, t) {
858
- const r = e.getFullYear(), n = r > 0 ? r : 1 - r;
859
- return x(t === "yy" ? n % 100 : n, t.length);
860
- },
861
- // Month
862
- M(e, t) {
863
- const r = e.getMonth();
864
- return t === "M" ? String(r + 1) : x(r + 1, 2);
865
- },
866
- // Day of the month
867
- d(e, t) {
868
- return x(e.getDate(), t.length);
869
- },
870
- // AM or PM
871
- a(e, t) {
872
- const r = e.getHours() / 12 >= 1 ? "pm" : "am";
873
- switch (t) {
874
- case "a":
875
- case "aa":
876
- return r.toUpperCase();
877
- case "aaa":
878
- return r;
879
- case "aaaaa":
880
- return r[0];
881
- default:
882
- return r === "am" ? "a.m." : "p.m.";
883
- }
884
- },
885
- // Hour [1-12]
886
- h(e, t) {
887
- return x(e.getHours() % 12 || 12, t.length);
888
- },
889
- // Hour [0-23]
890
- H(e, t) {
891
- return x(e.getHours(), t.length);
892
- },
893
- // Minute
894
- m(e, t) {
895
- return x(e.getMinutes(), t.length);
896
- },
897
- // Second
898
- s(e, t) {
899
- return x(e.getSeconds(), t.length);
900
- },
901
- // Fraction of second
902
- S(e, t) {
903
- const r = t.length, n = e.getMilliseconds(), o = Math.trunc(
904
- n * Math.pow(10, r - 3)
905
- );
906
- return x(o, t.length);
907
- }
908
- }, ue = {
909
- midnight: "midnight",
910
- noon: "noon",
911
- morning: "morning",
912
- afternoon: "afternoon",
913
- evening: "evening",
914
- night: "night"
915
- }, ft = {
916
- // Era
917
- G: function(e, t, r) {
918
- const n = e.getFullYear() > 0 ? 1 : 0;
919
- switch (t) {
920
- // AD, BC
921
- case "G":
922
- case "GG":
923
- case "GGG":
924
- return r.era(n, { width: "abbreviated" });
925
- // A, B
926
- case "GGGGG":
927
- return r.era(n, { width: "narrow" });
928
- default:
929
- return r.era(n, { width: "wide" });
930
- }
931
- },
932
- // Year
933
- y: function(e, t, r) {
934
- if (t === "yo") {
935
- const n = e.getFullYear(), o = n > 0 ? n : 1 - n;
936
- return r.ordinalNumber(o, { unit: "year" });
937
- }
938
- return se.y(e, t);
939
- },
940
- // Local week-numbering year
941
- Y: function(e, t, r, n) {
942
- const o = Tt(e, n), a = o > 0 ? o : 1 - o;
943
- if (t === "YY") {
944
- const i = a % 100;
945
- return x(i, 2);
946
- }
947
- return t === "Yo" ? r.ordinalNumber(a, { unit: "year" }) : x(a, t.length);
948
- },
949
- // ISO week-numbering year
950
- R: function(e, t) {
951
- const r = vt(e);
952
- return x(r, t.length);
953
- },
954
- // Extended year. This is a single number designating the year of this calendar system.
955
- // The main difference between `y` and `u` localizers are B.C. years:
956
- // | Year | `y` | `u` |
957
- // |------|-----|-----|
958
- // | AC 1 | 1 | 1 |
959
- // | BC 1 | 1 | 0 |
960
- // | BC 2 | 2 | -1 |
961
- // Also `yy` always returns the last two digits of a year,
962
- // while `uu` pads single digit years to 2 characters and returns other years unchanged.
963
- u: function(e, t) {
964
- const r = e.getFullYear();
965
- return x(r, t.length);
966
- },
967
- // Quarter
968
- Q: function(e, t, r) {
969
- const n = Math.ceil((e.getMonth() + 1) / 3);
970
- switch (t) {
971
- // 1, 2, 3, 4
972
- case "Q":
973
- return String(n);
974
- // 01, 02, 03, 04
975
- case "QQ":
976
- return x(n, 2);
977
- // 1st, 2nd, 3rd, 4th
978
- case "Qo":
979
- return r.ordinalNumber(n, { unit: "quarter" });
980
- // Q1, Q2, Q3, Q4
981
- case "QQQ":
982
- return r.quarter(n, {
983
- width: "abbreviated",
984
- context: "formatting"
985
- });
986
- // 1, 2, 3, 4 (narrow quarter; could be not numerical)
987
- case "QQQQQ":
988
- return r.quarter(n, {
989
- width: "narrow",
990
- context: "formatting"
991
- });
992
- default:
993
- return r.quarter(n, {
994
- width: "wide",
995
- context: "formatting"
996
- });
997
- }
998
- },
999
- // Stand-alone quarter
1000
- q: function(e, t, r) {
1001
- const n = Math.ceil((e.getMonth() + 1) / 3);
1002
- switch (t) {
1003
- // 1, 2, 3, 4
1004
- case "q":
1005
- return String(n);
1006
- // 01, 02, 03, 04
1007
- case "qq":
1008
- return x(n, 2);
1009
- // 1st, 2nd, 3rd, 4th
1010
- case "qo":
1011
- return r.ordinalNumber(n, { unit: "quarter" });
1012
- // Q1, Q2, Q3, Q4
1013
- case "qqq":
1014
- return r.quarter(n, {
1015
- width: "abbreviated",
1016
- context: "standalone"
1017
- });
1018
- // 1, 2, 3, 4 (narrow quarter; could be not numerical)
1019
- case "qqqqq":
1020
- return r.quarter(n, {
1021
- width: "narrow",
1022
- context: "standalone"
1023
- });
1024
- default:
1025
- return r.quarter(n, {
1026
- width: "wide",
1027
- context: "standalone"
1028
- });
1029
- }
1030
- },
1031
- // Month
1032
- M: function(e, t, r) {
1033
- const n = e.getMonth();
1034
- switch (t) {
1035
- case "M":
1036
- case "MM":
1037
- return se.M(e, t);
1038
- // 1st, 2nd, ..., 12th
1039
- case "Mo":
1040
- return r.ordinalNumber(n + 1, { unit: "month" });
1041
- // Jan, Feb, ..., Dec
1042
- case "MMM":
1043
- return r.month(n, {
1044
- width: "abbreviated",
1045
- context: "formatting"
1046
- });
1047
- // J, F, ..., D
1048
- case "MMMMM":
1049
- return r.month(n, {
1050
- width: "narrow",
1051
- context: "formatting"
1052
- });
1053
- default:
1054
- return r.month(n, { width: "wide", context: "formatting" });
1055
- }
1056
- },
1057
- // Stand-alone month
1058
- L: function(e, t, r) {
1059
- const n = e.getMonth();
1060
- switch (t) {
1061
- // 1, 2, ..., 12
1062
- case "L":
1063
- return String(n + 1);
1064
- // 01, 02, ..., 12
1065
- case "LL":
1066
- return x(n + 1, 2);
1067
- // 1st, 2nd, ..., 12th
1068
- case "Lo":
1069
- return r.ordinalNumber(n + 1, { unit: "month" });
1070
- // Jan, Feb, ..., Dec
1071
- case "LLL":
1072
- return r.month(n, {
1073
- width: "abbreviated",
1074
- context: "standalone"
1075
- });
1076
- // J, F, ..., D
1077
- case "LLLLL":
1078
- return r.month(n, {
1079
- width: "narrow",
1080
- context: "standalone"
1081
- });
1082
- default:
1083
- return r.month(n, { width: "wide", context: "standalone" });
1084
- }
1085
- },
1086
- // Local week of year
1087
- w: function(e, t, r, n) {
1088
- const o = Ue(e, n);
1089
- return t === "wo" ? r.ordinalNumber(o, { unit: "week" }) : x(o, t.length);
1090
- },
1091
- // ISO week of year
1092
- I: function(e, t, r) {
1093
- const n = Xe(e);
1094
- return t === "Io" ? r.ordinalNumber(n, { unit: "week" }) : x(n, t.length);
1095
- },
1096
- // Day of the month
1097
- d: function(e, t, r) {
1098
- return t === "do" ? r.ordinalNumber(e.getDate(), { unit: "date" }) : se.d(e, t);
1099
- },
1100
- // Day of year
1101
- D: function(e, t, r) {
1102
- const n = Sr(e);
1103
- return t === "Do" ? r.ordinalNumber(n, { unit: "dayOfYear" }) : x(n, t.length);
1104
- },
1105
- // Day of week
1106
- E: function(e, t, r) {
1107
- const n = e.getDay();
1108
- switch (t) {
1109
- // Tue
1110
- case "E":
1111
- case "EE":
1112
- case "EEE":
1113
- return r.day(n, {
1114
- width: "abbreviated",
1115
- context: "formatting"
1116
- });
1117
- // T
1118
- case "EEEEE":
1119
- return r.day(n, {
1120
- width: "narrow",
1121
- context: "formatting"
1122
- });
1123
- // Tu
1124
- case "EEEEEE":
1125
- return r.day(n, {
1126
- width: "short",
1127
- context: "formatting"
1128
- });
1129
- default:
1130
- return r.day(n, {
1131
- width: "wide",
1132
- context: "formatting"
1133
- });
1134
- }
1135
- },
1136
- // Local day of week
1137
- e: function(e, t, r, n) {
1138
- const o = e.getDay(), a = (o - n.weekStartsOn + 8) % 7 || 7;
1139
- switch (t) {
1140
- // Numerical value (Nth day of week with current locale or weekStartsOn)
1141
- case "e":
1142
- return String(a);
1143
- // Padded numerical value
1144
- case "ee":
1145
- return x(a, 2);
1146
- // 1st, 2nd, ..., 7th
1147
- case "eo":
1148
- return r.ordinalNumber(a, { unit: "day" });
1149
- case "eee":
1150
- return r.day(o, {
1151
- width: "abbreviated",
1152
- context: "formatting"
1153
- });
1154
- // T
1155
- case "eeeee":
1156
- return r.day(o, {
1157
- width: "narrow",
1158
- context: "formatting"
1159
- });
1160
- // Tu
1161
- case "eeeeee":
1162
- return r.day(o, {
1163
- width: "short",
1164
- context: "formatting"
1165
- });
1166
- default:
1167
- return r.day(o, {
1168
- width: "wide",
1169
- context: "formatting"
1170
- });
1171
- }
1172
- },
1173
- // Stand-alone local day of week
1174
- c: function(e, t, r, n) {
1175
- const o = e.getDay(), a = (o - n.weekStartsOn + 8) % 7 || 7;
1176
- switch (t) {
1177
- // Numerical value (same as in `e`)
1178
- case "c":
1179
- return String(a);
1180
- // Padded numerical value
1181
- case "cc":
1182
- return x(a, t.length);
1183
- // 1st, 2nd, ..., 7th
1184
- case "co":
1185
- return r.ordinalNumber(a, { unit: "day" });
1186
- case "ccc":
1187
- return r.day(o, {
1188
- width: "abbreviated",
1189
- context: "standalone"
1190
- });
1191
- // T
1192
- case "ccccc":
1193
- return r.day(o, {
1194
- width: "narrow",
1195
- context: "standalone"
1196
- });
1197
- // Tu
1198
- case "cccccc":
1199
- return r.day(o, {
1200
- width: "short",
1201
- context: "standalone"
1202
- });
1203
- default:
1204
- return r.day(o, {
1205
- width: "wide",
1206
- context: "standalone"
1207
- });
1208
- }
1209
- },
1210
- // ISO day of week
1211
- i: function(e, t, r) {
1212
- const n = e.getDay(), o = n === 0 ? 7 : n;
1213
- switch (t) {
1214
- // 2
1215
- case "i":
1216
- return String(o);
1217
- // 02
1218
- case "ii":
1219
- return x(o, t.length);
1220
- // 2nd
1221
- case "io":
1222
- return r.ordinalNumber(o, { unit: "day" });
1223
- // Tue
1224
- case "iii":
1225
- return r.day(n, {
1226
- width: "abbreviated",
1227
- context: "formatting"
1228
- });
1229
- // T
1230
- case "iiiii":
1231
- return r.day(n, {
1232
- width: "narrow",
1233
- context: "formatting"
1234
- });
1235
- // Tu
1236
- case "iiiiii":
1237
- return r.day(n, {
1238
- width: "short",
1239
- context: "formatting"
1240
- });
1241
- default:
1242
- return r.day(n, {
1243
- width: "wide",
1244
- context: "formatting"
1245
- });
1246
- }
1247
- },
1248
- // AM or PM
1249
- a: function(e, t, r) {
1250
- const o = e.getHours() / 12 >= 1 ? "pm" : "am";
1251
- switch (t) {
1252
- case "a":
1253
- case "aa":
1254
- return r.dayPeriod(o, {
1255
- width: "abbreviated",
1256
- context: "formatting"
1257
- });
1258
- case "aaa":
1259
- return r.dayPeriod(o, {
1260
- width: "abbreviated",
1261
- context: "formatting"
1262
- }).toLowerCase();
1263
- case "aaaaa":
1264
- return r.dayPeriod(o, {
1265
- width: "narrow",
1266
- context: "formatting"
1267
- });
1268
- default:
1269
- return r.dayPeriod(o, {
1270
- width: "wide",
1271
- context: "formatting"
1272
- });
1273
- }
1274
- },
1275
- // AM, PM, midnight, noon
1276
- b: function(e, t, r) {
1277
- const n = e.getHours();
1278
- let o;
1279
- switch (n === 12 ? o = ue.noon : n === 0 ? o = ue.midnight : o = n / 12 >= 1 ? "pm" : "am", t) {
1280
- case "b":
1281
- case "bb":
1282
- return r.dayPeriod(o, {
1283
- width: "abbreviated",
1284
- context: "formatting"
1285
- });
1286
- case "bbb":
1287
- return r.dayPeriod(o, {
1288
- width: "abbreviated",
1289
- context: "formatting"
1290
- }).toLowerCase();
1291
- case "bbbbb":
1292
- return r.dayPeriod(o, {
1293
- width: "narrow",
1294
- context: "formatting"
1295
- });
1296
- default:
1297
- return r.dayPeriod(o, {
1298
- width: "wide",
1299
- context: "formatting"
1300
- });
1301
- }
1302
- },
1303
- // in the morning, in the afternoon, in the evening, at night
1304
- B: function(e, t, r) {
1305
- const n = e.getHours();
1306
- let o;
1307
- switch (n >= 17 ? o = ue.evening : n >= 12 ? o = ue.afternoon : n >= 4 ? o = ue.morning : o = ue.night, t) {
1308
- case "B":
1309
- case "BB":
1310
- case "BBB":
1311
- return r.dayPeriod(o, {
1312
- width: "abbreviated",
1313
- context: "formatting"
1314
- });
1315
- case "BBBBB":
1316
- return r.dayPeriod(o, {
1317
- width: "narrow",
1318
- context: "formatting"
1319
- });
1320
- default:
1321
- return r.dayPeriod(o, {
1322
- width: "wide",
1323
- context: "formatting"
1324
- });
1325
- }
1326
- },
1327
- // Hour [1-12]
1328
- h: function(e, t, r) {
1329
- if (t === "ho") {
1330
- let n = e.getHours() % 12;
1331
- return n === 0 && (n = 12), r.ordinalNumber(n, { unit: "hour" });
1332
- }
1333
- return se.h(e, t);
1334
- },
1335
- // Hour [0-23]
1336
- H: function(e, t, r) {
1337
- return t === "Ho" ? r.ordinalNumber(e.getHours(), { unit: "hour" }) : se.H(e, t);
1338
- },
1339
- // Hour [0-11]
1340
- K: function(e, t, r) {
1341
- const n = e.getHours() % 12;
1342
- return t === "Ko" ? r.ordinalNumber(n, { unit: "hour" }) : x(n, t.length);
1343
- },
1344
- // Hour [1-24]
1345
- k: function(e, t, r) {
1346
- let n = e.getHours();
1347
- return n === 0 && (n = 24), t === "ko" ? r.ordinalNumber(n, { unit: "hour" }) : x(n, t.length);
1348
- },
1349
- // Minute
1350
- m: function(e, t, r) {
1351
- return t === "mo" ? r.ordinalNumber(e.getMinutes(), { unit: "minute" }) : se.m(e, t);
1352
- },
1353
- // Second
1354
- s: function(e, t, r) {
1355
- return t === "so" ? r.ordinalNumber(e.getSeconds(), { unit: "second" }) : se.s(e, t);
1356
- },
1357
- // Fraction of second
1358
- S: function(e, t) {
1359
- return se.S(e, t);
1360
- },
1361
- // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
1362
- X: function(e, t, r) {
1363
- const n = e.getTimezoneOffset();
1364
- if (n === 0)
1365
- return "Z";
1366
- switch (t) {
1367
- // Hours and optional minutes
1368
- case "X":
1369
- return ht(n);
1370
- // Hours, minutes and optional seconds without `:` delimiter
1371
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1372
- // so this token always has the same output as `XX`
1373
- case "XXXX":
1374
- case "XX":
1375
- return ae(n);
1376
- // Hours and minutes with `:` delimiter
1377
- default:
1378
- return ae(n, ":");
1379
- }
1380
- },
1381
- // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
1382
- x: function(e, t, r) {
1383
- const n = e.getTimezoneOffset();
1384
- switch (t) {
1385
- // Hours and optional minutes
1386
- case "x":
1387
- return ht(n);
1388
- // Hours, minutes and optional seconds without `:` delimiter
1389
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1390
- // so this token always has the same output as `xx`
1391
- case "xxxx":
1392
- case "xx":
1393
- return ae(n);
1394
- // Hours and minutes with `:` delimiter
1395
- default:
1396
- return ae(n, ":");
1397
- }
1398
- },
1399
- // Timezone (GMT)
1400
- O: function(e, t, r) {
1401
- const n = e.getTimezoneOffset();
1402
- switch (t) {
1403
- // Short
1404
- case "O":
1405
- case "OO":
1406
- case "OOO":
1407
- return "GMT" + dt(n, ":");
1408
- default:
1409
- return "GMT" + ae(n, ":");
1410
- }
1411
- },
1412
- // Timezone (specific non-location)
1413
- z: function(e, t, r) {
1414
- const n = e.getTimezoneOffset();
1415
- switch (t) {
1416
- // Short
1417
- case "z":
1418
- case "zz":
1419
- case "zzz":
1420
- return "GMT" + dt(n, ":");
1421
- default:
1422
- return "GMT" + ae(n, ":");
1423
- }
1424
- },
1425
- // Seconds timestamp
1426
- t: function(e, t, r) {
1427
- const n = Math.trunc(+e / 1e3);
1428
- return x(n, t.length);
1429
- },
1430
- // Milliseconds timestamp
1431
- T: function(e, t, r) {
1432
- return x(+e, t.length);
1433
- }
1434
- };
1435
- function dt(e, t = "") {
1436
- const r = e > 0 ? "-" : "+", n = Math.abs(e), o = Math.trunc(n / 60), a = n % 60;
1437
- return a === 0 ? r + String(o) : r + String(o) + t + x(a, 2);
1438
- }
1439
- function ht(e, t) {
1440
- return e % 60 === 0 ? (e > 0 ? "-" : "+") + x(Math.abs(e) / 60, 2) : ae(e, t);
1441
- }
1442
- function ae(e, t = "") {
1443
- const r = e > 0 ? "-" : "+", n = Math.abs(e), o = x(Math.trunc(n / 60), 2), a = x(n % 60, 2);
1444
- return r + o + t + a;
1445
- }
1446
- const mt = (e, t) => {
1447
- switch (e) {
1448
- case "P":
1449
- return t.date({ width: "short" });
1450
- case "PP":
1451
- return t.date({ width: "medium" });
1452
- case "PPP":
1453
- return t.date({ width: "long" });
1454
- default:
1455
- return t.date({ width: "full" });
1456
- }
1457
- }, xt = (e, t) => {
1458
- switch (e) {
1459
- case "p":
1460
- return t.time({ width: "short" });
1461
- case "pp":
1462
- return t.time({ width: "medium" });
1463
- case "ppp":
1464
- return t.time({ width: "long" });
1465
- default:
1466
- return t.time({ width: "full" });
1467
- }
1468
- }, Nr = (e, t) => {
1469
- const r = e.match(/(P+)(p+)?/) || [], n = r[1], o = r[2];
1470
- if (!o)
1471
- return mt(e, t);
1472
- let a;
1473
- switch (n) {
1474
- case "P":
1475
- a = t.dateTime({ width: "short" });
1476
- break;
1477
- case "PP":
1478
- a = t.dateTime({ width: "medium" });
1479
- break;
1480
- case "PPP":
1481
- a = t.dateTime({ width: "long" });
1482
- break;
1483
- default:
1484
- a = t.dateTime({ width: "full" });
1485
- break;
1486
- }
1487
- return a.replace("{{date}}", mt(n, t)).replace("{{time}}", xt(o, t));
1488
- }, Yr = {
1489
- p: xt,
1490
- P: Nr
1491
- }, Tr = /^D+$/, xr = /^Y+$/, Pr = ["D", "DD", "YY", "YYYY"];
1492
- function Er(e) {
1493
- return Tr.test(e);
1494
- }
1495
- function _r(e) {
1496
- return xr.test(e);
1497
- }
1498
- function Fr(e, t, r) {
1499
- const n = Br(e, t, r);
1500
- if (console.warn(n), Pr.includes(e)) throw new RangeError(n);
1501
- }
1502
- function Br(e, t, r) {
1503
- const n = e[0] === "Y" ? "years" : "days of the month";
1504
- return `Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
1505
- }
1506
- const Ir = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, Hr = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, Ar = /^'([^]*?)'?$/, qr = /''/g, jr = /[a-zA-Z]/;
1507
- function pe(e, t, r) {
1508
- const n = De(), o = r?.locale ?? n.locale ?? fe, a = r?.firstWeekContainsDate ?? r?.locale?.options?.firstWeekContainsDate ?? n.firstWeekContainsDate ?? n.locale?.options?.firstWeekContainsDate ?? 1, i = r?.weekStartsOn ?? r?.locale?.options?.weekStartsOn ?? n.weekStartsOn ?? n.locale?.options?.weekStartsOn ?? 0, s = P(e, r?.in);
1509
- if (!jn(s))
1510
- throw new RangeError("Invalid time value");
1511
- let c = t.match(Hr).map((f) => {
1512
- const l = f[0];
1513
- if (l === "p" || l === "P") {
1514
- const h = Yr[l];
1515
- return h(f, o.formatLong);
1516
- }
1517
- return f;
1518
- }).join("").match(Ir).map((f) => {
1519
- if (f === "''")
1520
- return { isToken: !1, value: "'" };
1521
- const l = f[0];
1522
- if (l === "'")
1523
- return { isToken: !1, value: Gr(f) };
1524
- if (ft[l])
1525
- return { isToken: !0, value: f };
1526
- if (l.match(jr))
1527
- throw new RangeError(
1528
- "Format string contains an unescaped latin alphabet character `" + l + "`"
1529
- );
1530
- return { isToken: !1, value: f };
1531
- });
1532
- o.localize.preprocessor && (c = o.localize.preprocessor(s, c));
1533
- const u = {
1534
- firstWeekContainsDate: a,
1535
- weekStartsOn: i,
1536
- locale: o
1537
- };
1538
- return c.map((f) => {
1539
- if (!f.isToken) return f.value;
1540
- const l = f.value;
1541
- (!r?.useAdditionalWeekYearTokens && _r(l) || !r?.useAdditionalDayOfYearTokens && Er(l)) && Fr(l, t, String(e));
1542
- const h = ft[l[0]];
1543
- return h(s, l, o.localize, u);
1544
- }).join("");
1545
- }
1546
- function Gr(e) {
1547
- const t = e.match(Ar);
1548
- return t ? t[1].replace(qr, "'") : e;
1549
- }
1550
- function $r(e, t) {
1551
- const r = P(e, t?.in), n = r.getFullYear(), o = r.getMonth(), a = I(r, 0);
1552
- return a.setFullYear(n, o + 1, 0), a.setHours(0, 0, 0, 0), a.getDate();
1553
- }
1554
- function Rr(e, t) {
1555
- return P(e, t?.in).getMonth();
1556
- }
1557
- function zr(e, t) {
1558
- return P(e, t?.in).getFullYear();
1559
- }
1560
- function Qr(e, t) {
1561
- return +P(e) > +P(t);
1562
- }
1563
- function Xr(e, t) {
1564
- return +P(e) < +P(t);
1565
- }
1566
- function Ur(e, t, r) {
1567
- const [n, o] = he(
1568
- r?.in,
1569
- e,
1570
- t
1571
- );
1572
- return n.getFullYear() === o.getFullYear() && n.getMonth() === o.getMonth();
1573
- }
1574
- function Vr(e, t, r) {
1575
- const [n, o] = he(
1576
- r?.in,
1577
- e,
1578
- t
1579
- );
1580
- return n.getFullYear() === o.getFullYear();
1581
- }
1582
- function Zr(e, t, r) {
1583
- const n = P(e, r?.in), o = n.getFullYear(), a = n.getDate(), i = I(e, 0);
1584
- i.setFullYear(o, t, 15), i.setHours(0, 0, 0, 0);
1585
- const s = $r(i);
1586
- return n.setMonth(t, Math.min(a, s)), n;
1587
- }
1588
- function Kr(e, t, r) {
1589
- const n = P(e, r?.in);
1590
- return isNaN(+n) ? I(e, NaN) : (n.setFullYear(t), n);
1591
- }
1592
- const yt = 5, Jr = 4;
1593
- function Lr(e, t) {
1594
- const r = t.startOfMonth(e), n = r.getDay() > 0 ? r.getDay() : 7, o = t.addDays(e, -n + 1), a = t.addDays(o, yt * 7 - 1);
1595
- return t.getMonth(e) === t.getMonth(a) ? yt : Jr;
1596
- }
1597
- function Pt(e, t) {
1598
- const r = t.startOfMonth(e), n = r.getDay();
1599
- return n === 1 ? r : n === 0 ? t.addDays(r, -6) : t.addDays(r, -1 * (n - 1));
1600
- }
1601
- function eo(e, t) {
1602
- const r = Pt(e, t), n = Lr(e, t);
1603
- return t.addDays(r, n * 7 - 1);
1604
- }
1605
- const Et = {
1606
- ...fe,
1607
- labels: {
1608
- labelDayButton: (e, t, r, n) => {
1609
- let o;
1610
- n && typeof n.format == "function" ? o = n.format.bind(n) : o = (i, s) => pe(i, s, { locale: fe, ...r });
1611
- let a = o(e, "PPPP");
1612
- return t.today && (a = `Today, ${a}`), t.selected && (a = `${a}, selected`), a;
1613
- },
1614
- labelMonthDropdown: "Choose the Month",
1615
- labelNext: "Go to the Next Month",
1616
- labelPrevious: "Go to the Previous Month",
1617
- labelWeekNumber: (e) => `Week ${e}`,
1618
- labelYearDropdown: "Choose the Year",
1619
- labelGrid: (e, t, r) => {
1620
- let n;
1621
- return r && typeof r.format == "function" ? n = r.format.bind(r) : n = (o, a) => pe(o, a, { locale: fe, ...t }), n(e, "LLLL yyyy");
1622
- },
1623
- labelGridcell: (e, t, r, n) => {
1624
- let o;
1625
- n && typeof n.format == "function" ? o = n.format.bind(n) : o = (i, s) => pe(i, s, { locale: fe, ...r });
1626
- let a = o(e, "PPPP");
1627
- return t?.today && (a = `Today, ${a}`), a;
1628
- },
1629
- labelNav: "Navigation bar",
1630
- labelWeekNumberHeader: "Week Number",
1631
- labelWeekday: (e, t, r) => {
1632
- let n;
1633
- return r && typeof r.format == "function" ? n = r.format.bind(r) : n = (o, a) => pe(o, a, { locale: fe, ...t }), n(e, "cccc");
1634
- }
1635
- }
1636
- };
1637
- class G {
1638
- /**
1639
- * Creates an instance of `DateLib`.
1640
- *
1641
- * @param options Configuration options for the date library.
1642
- * @param overrides Custom overrides for the date library functions.
1643
- */
1644
- constructor(t, r) {
1645
- this.Date = Date, this.today = () => this.overrides?.today ? this.overrides.today() : this.options.timeZone ? A.tz(this.options.timeZone) : new this.Date(), this.newDate = (n, o, a) => this.overrides?.newDate ? this.overrides.newDate(n, o, a) : this.options.timeZone ? new A(n, o, a, this.options.timeZone) : new Date(n, o, a), this.addDays = (n, o) => this.overrides?.addDays ? this.overrides.addDays(n, o) : kt(n, o), this.addMonths = (n, o) => this.overrides?.addMonths ? this.overrides.addMonths(n, o) : Ot(n, o), this.addWeeks = (n, o) => this.overrides?.addWeeks ? this.overrides.addWeeks(n, o) : Bn(n, o), this.addYears = (n, o) => this.overrides?.addYears ? this.overrides.addYears(n, o) : In(n, o), this.differenceInCalendarDays = (n, o) => this.overrides?.differenceInCalendarDays ? this.overrides.differenceInCalendarDays(n, o) : Qe(n, o), this.differenceInCalendarMonths = (n, o) => this.overrides?.differenceInCalendarMonths ? this.overrides.differenceInCalendarMonths(n, o) : St(n, o), this.eachMonthOfInterval = (n) => this.overrides?.eachMonthOfInterval ? this.overrides.eachMonthOfInterval(n) : $n(n), this.eachYearOfInterval = (n) => {
1646
- const o = this.overrides?.eachYearOfInterval ? this.overrides.eachYearOfInterval(n) : Qn(n), a = new Set(o.map((s) => this.getYear(s)));
1647
- if (a.size === o.length)
1648
- return o;
1649
- const i = [];
1650
- return a.forEach((s) => {
1651
- i.push(new Date(s, 0, 1));
1652
- }), i;
1653
- }, this.endOfBroadcastWeek = (n) => this.overrides?.endOfBroadcastWeek ? this.overrides.endOfBroadcastWeek(n) : eo(n, this), this.endOfISOWeek = (n) => this.overrides?.endOfISOWeek ? this.overrides.endOfISOWeek(n) : Xn(n), this.endOfMonth = (n) => this.overrides?.endOfMonth ? this.overrides.endOfMonth(n) : Gn(n), this.endOfWeek = (n, o) => this.overrides?.endOfWeek ? this.overrides.endOfWeek(n, o) : Yt(n, this.options), this.endOfYear = (n) => this.overrides?.endOfYear ? this.overrides.endOfYear(n) : zn(n), this.format = (n, o, a) => {
1654
- const i = this.overrides?.format ? this.overrides.format(n, o, this.options) : pe(n, o, this.options);
1655
- return this.options.numerals && this.options.numerals !== "latn" ? this.replaceDigits(i) : i;
1656
- }, this.getISOWeek = (n) => this.overrides?.getISOWeek ? this.overrides.getISOWeek(n) : Xe(n), this.getMonth = (n, o) => this.overrides?.getMonth ? this.overrides.getMonth(n, this.options) : Rr(n, this.options), this.getYear = (n, o) => this.overrides?.getYear ? this.overrides.getYear(n, this.options) : zr(n, this.options), this.getWeek = (n, o) => this.overrides?.getWeek ? this.overrides.getWeek(n, this.options) : Ue(n, this.options), this.isAfter = (n, o) => this.overrides?.isAfter ? this.overrides.isAfter(n, o) : Qr(n, o), this.isBefore = (n, o) => this.overrides?.isBefore ? this.overrides.isBefore(n, o) : Xr(n, o), this.isDate = (n) => this.overrides?.isDate ? this.overrides.isDate(n) : Wt(n), this.isSameDay = (n, o) => this.overrides?.isSameDay ? this.overrides.isSameDay(n, o) : qn(n, o), this.isSameMonth = (n, o) => this.overrides?.isSameMonth ? this.overrides.isSameMonth(n, o) : Ur(n, o), this.isSameYear = (n, o) => this.overrides?.isSameYear ? this.overrides.isSameYear(n, o) : Vr(n, o), this.max = (n) => this.overrides?.max ? this.overrides.max(n) : Hn(n), this.min = (n) => this.overrides?.min ? this.overrides.min(n) : An(n), this.setMonth = (n, o) => this.overrides?.setMonth ? this.overrides.setMonth(n, o) : Zr(n, o), this.setYear = (n, o) => this.overrides?.setYear ? this.overrides.setYear(n, o) : Kr(n, o), this.startOfBroadcastWeek = (n, o) => this.overrides?.startOfBroadcastWeek ? this.overrides.startOfBroadcastWeek(n, this) : Pt(n, this), this.startOfDay = (n) => this.overrides?.startOfDay ? this.overrides.startOfDay(n) : Me(n), this.startOfISOWeek = (n) => this.overrides?.startOfISOWeek ? this.overrides.startOfISOWeek(n) : we(n), this.startOfMonth = (n) => this.overrides?.startOfMonth ? this.overrides.startOfMonth(n) : Rn(n), this.startOfWeek = (n, o) => this.overrides?.startOfWeek ? this.overrides.startOfWeek(n, this.options) : de(n, this.options), this.startOfYear = (n) => this.overrides?.startOfYear ? this.overrides.startOfYear(n) : Nt(n), this.options = { locale: Et, ...t }, this.overrides = r;
1657
- }
1658
- /**
1659
- * Generates a mapping of Arabic digits (0-9) to the target numbering system
1660
- * digits.
1661
- *
1662
- * @since 9.5.0
1663
- * @returns A record mapping Arabic digits to the target numerals.
1664
- */
1665
- getDigitMap() {
1666
- const { numerals: t = "latn" } = this.options, r = new Intl.NumberFormat("en-US", {
1667
- numberingSystem: t
1668
- }), n = {};
1669
- for (let o = 0; o < 10; o++)
1670
- n[o.toString()] = r.format(o);
1671
- return n;
1672
- }
1673
- /**
1674
- * Replaces Arabic digits in a string with the target numbering system digits.
1675
- *
1676
- * @since 9.5.0
1677
- * @param input The string containing Arabic digits.
1678
- * @returns The string with digits replaced.
1679
- */
1680
- replaceDigits(t) {
1681
- const r = this.getDigitMap();
1682
- return t.replace(/\d/g, (n) => r[n] || n);
1683
- }
1684
- /**
1685
- * Formats a number using the configured numbering system.
1686
- *
1687
- * @since 9.5.0
1688
- * @param value The number to format.
1689
- * @returns The formatted number as a string.
1690
- */
1691
- formatNumber(t) {
1692
- return this.replaceDigits(t.toString());
1693
- }
1694
- /**
1695
- * Returns the preferred ordering for month and year labels for the current
1696
- * locale.
1697
- */
1698
- getMonthYearOrder() {
1699
- const t = this.options.locale?.code;
1700
- return t && G.yearFirstLocales.has(t) ? "year-first" : "month-first";
1701
- }
1702
- /**
1703
- * Formats the month/year pair respecting locale conventions.
1704
- *
1705
- * @since 9.11.0
1706
- */
1707
- formatMonthYear(t) {
1708
- const { locale: r, timeZone: n, numerals: o } = this.options, a = r?.code;
1709
- if (a && G.yearFirstLocales.has(a))
1710
- try {
1711
- return new Intl.DateTimeFormat(a, {
1712
- month: "long",
1713
- year: "numeric",
1714
- timeZone: n,
1715
- numberingSystem: o
1716
- }).format(t);
1717
- } catch {
1718
- }
1719
- const i = this.getMonthYearOrder() === "year-first" ? "y LLLL" : "LLLL y";
1720
- return this.format(t, i);
1721
- }
1722
- }
1723
- G.yearFirstLocales = /* @__PURE__ */ new Set([
1724
- "eu",
1725
- "hu",
1726
- "ja",
1727
- "ja-Hira",
1728
- "ja-JP",
1729
- "ko",
1730
- "ko-KR",
1731
- "lt",
1732
- "lt-LT",
1733
- "lv",
1734
- "lv-LV",
1735
- "mn",
1736
- "mn-MN",
1737
- "zh",
1738
- "zh-CN",
1739
- "zh-HK",
1740
- "zh-TW"
1741
- ]);
1742
- const L = new G();
1743
- class _t {
1744
- constructor(t, r, n = L) {
1745
- this.date = t, this.displayMonth = r, this.outside = !!(r && !n.isSameMonth(t, r)), this.dateLib = n, this.isoDate = n.format(t, "yyyy-MM-dd"), this.displayMonthId = n.format(r, "yyyy-MM"), this.dateMonthId = n.format(t, "yyyy-MM");
1746
- }
1747
- /**
1748
- * Checks if this day is equal to another `CalendarDay`, considering both the
1749
- * date and the displayed month.
1750
- *
1751
- * @param day The `CalendarDay` to compare with.
1752
- * @returns `true` if the days are equal, otherwise `false`.
1753
- */
1754
- isEqualTo(t) {
1755
- return this.dateLib.isSameDay(t.date, this.date) && this.dateLib.isSameMonth(t.displayMonth, this.displayMonth);
1756
- }
1757
- }
1758
- class to {
1759
- constructor(t, r) {
1760
- this.date = t, this.weeks = r;
1761
- }
1762
- }
1763
- class no {
1764
- constructor(t, r) {
1765
- this.days = r, this.weekNumber = t;
1766
- }
1767
- }
1768
- function ro(e) {
1769
- return d.createElement("button", { ...e });
1770
- }
1771
- function oo(e) {
1772
- return d.createElement("span", { ...e });
1773
- }
1774
- function so(e) {
1775
- const { size: t = 24, orientation: r = "left", className: n } = e;
1776
- return (
1777
- // biome-ignore lint/a11y/noSvgWithoutTitle: handled by the parent component
1778
- d.createElement(
1779
- "svg",
1780
- { className: n, width: t, height: t, viewBox: "0 0 24 24" },
1781
- r === "up" && d.createElement("polygon", { points: "6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28" }),
1782
- r === "down" && d.createElement("polygon", { points: "6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72" }),
1783
- r === "left" && d.createElement("polygon", { points: "16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20" }),
1784
- r === "right" && d.createElement("polygon", { points: "8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20" })
1785
- )
1786
- );
1787
- }
1788
- function ao(e) {
1789
- const { day: t, modifiers: r, ...n } = e;
1790
- return d.createElement("td", { ...n });
1791
- }
1792
- function io(e) {
1793
- const { day: t, modifiers: r, ...n } = e, o = d.useRef(null);
1794
- return d.useEffect(() => {
1795
- r.focused && o.current?.focus();
1796
- }, [r.focused]), d.createElement("button", { ref: o, ...n });
1797
- }
1798
- var y;
1799
- (function(e) {
1800
- e.Root = "root", e.Chevron = "chevron", e.Day = "day", e.DayButton = "day_button", e.CaptionLabel = "caption_label", e.Dropdowns = "dropdowns", e.Dropdown = "dropdown", e.DropdownRoot = "dropdown_root", e.Footer = "footer", e.MonthGrid = "month_grid", e.MonthCaption = "month_caption", e.MonthsDropdown = "months_dropdown", e.Month = "month", e.Months = "months", e.Nav = "nav", e.NextMonthButton = "button_next", e.PreviousMonthButton = "button_previous", e.Week = "week", e.Weeks = "weeks", e.Weekday = "weekday", e.Weekdays = "weekdays", e.WeekNumber = "week_number", e.WeekNumberHeader = "week_number_header", e.YearsDropdown = "years_dropdown";
1801
- })(y || (y = {}));
1802
- var _;
1803
- (function(e) {
1804
- e.disabled = "disabled", e.hidden = "hidden", e.outside = "outside", e.focused = "focused", e.today = "today";
1805
- })(_ || (_ = {}));
1806
- var V;
1807
- (function(e) {
1808
- e.range_end = "range_end", e.range_middle = "range_middle", e.range_start = "range_start", e.selected = "selected";
1809
- })(V || (V = {}));
1810
- var j;
1811
- (function(e) {
1812
- e.weeks_before_enter = "weeks_before_enter", e.weeks_before_exit = "weeks_before_exit", e.weeks_after_enter = "weeks_after_enter", e.weeks_after_exit = "weeks_after_exit", e.caption_after_enter = "caption_after_enter", e.caption_after_exit = "caption_after_exit", e.caption_before_enter = "caption_before_enter", e.caption_before_exit = "caption_before_exit";
1813
- })(j || (j = {}));
1814
- function co(e) {
1815
- const { options: t, className: r, components: n, classNames: o, ...a } = e, i = [o[y.Dropdown], r].join(" "), s = t?.find(({ value: c }) => c === a.value);
1816
- return d.createElement(
1817
- "span",
1818
- { "data-disabled": a.disabled, className: o[y.DropdownRoot] },
1819
- d.createElement(n.Select, { className: i, ...a }, t?.map(({ value: c, label: u, disabled: f }) => d.createElement(n.Option, { key: c, value: c, disabled: f }, u))),
1820
- d.createElement(
1821
- "span",
1822
- { className: o[y.CaptionLabel], "aria-hidden": !0 },
1823
- s?.label,
1824
- d.createElement(n.Chevron, { orientation: "down", size: 18, className: o[y.Chevron] })
1825
- )
1826
- );
1827
- }
1828
- function uo(e) {
1829
- return d.createElement("div", { ...e });
1830
- }
1831
- function lo(e) {
1832
- return d.createElement("div", { ...e });
1833
- }
1834
- function fo(e) {
1835
- const { calendarMonth: t, displayIndex: r, ...n } = e;
1836
- return d.createElement("div", { ...n }, e.children);
1837
- }
1838
- function ho(e) {
1839
- const { calendarMonth: t, displayIndex: r, ...n } = e;
1840
- return d.createElement("div", { ...n });
1841
- }
1842
- function mo(e) {
1843
- return d.createElement("table", { ...e });
1844
- }
1845
- function yo(e) {
1846
- return d.createElement("div", { ...e });
1847
- }
1848
- const Ft = Wn(void 0);
1849
- function ke() {
1850
- const e = Sn(Ft);
1851
- if (e === void 0)
1852
- throw new Error("useDayPicker() must be used within a custom component.");
1853
- return e;
1854
- }
1855
- function go(e) {
1856
- const { components: t } = ke();
1857
- return d.createElement(t.Dropdown, { ...e });
1858
- }
1859
- function po(e) {
1860
- const { onPreviousClick: t, onNextClick: r, previousMonth: n, nextMonth: o, ...a } = e, { components: i, classNames: s, labels: { labelPrevious: c, labelNext: u } } = ke(), f = R((h) => {
1861
- o && r?.(h);
1862
- }, [o, r]), l = R((h) => {
1863
- n && t?.(h);
1864
- }, [n, t]);
1865
- return d.createElement(
1866
- "nav",
1867
- { ...a },
1868
- d.createElement(
1869
- i.PreviousMonthButton,
1870
- { type: "button", className: s[y.PreviousMonthButton], tabIndex: n ? void 0 : -1, "aria-disabled": n ? void 0 : !0, "aria-label": c(n), onClick: l },
1871
- d.createElement(i.Chevron, { disabled: n ? void 0 : !0, className: s[y.Chevron], orientation: "left" })
1872
- ),
1873
- d.createElement(
1874
- i.NextMonthButton,
1875
- { type: "button", className: s[y.NextMonthButton], tabIndex: o ? void 0 : -1, "aria-disabled": o ? void 0 : !0, "aria-label": u(o), onClick: f },
1876
- d.createElement(i.Chevron, { disabled: o ? void 0 : !0, orientation: "right", className: s[y.Chevron] })
1877
- )
1878
- );
1879
- }
1880
- function bo(e) {
1881
- const { components: t } = ke();
1882
- return d.createElement(t.Button, { ...e });
1883
- }
1884
- function wo(e) {
1885
- return d.createElement("option", { ...e });
1886
- }
1887
- function Mo(e) {
1888
- const { components: t } = ke();
1889
- return d.createElement(t.Button, { ...e });
1890
- }
1891
- function Do(e) {
1892
- const { rootRef: t, ...r } = e;
1893
- return d.createElement("div", { ...r, ref: t });
1894
- }
1895
- function ko(e) {
1896
- return d.createElement("select", { ...e });
1897
- }
1898
- function Oo(e) {
1899
- const { week: t, ...r } = e;
1900
- return d.createElement("tr", { ...r });
1901
- }
1902
- function vo(e) {
1903
- return d.createElement("th", { ...e });
1904
- }
1905
- function Wo(e) {
1906
- return d.createElement(
1907
- "thead",
1908
- { "aria-hidden": !0 },
1909
- d.createElement("tr", { ...e })
1910
- );
1911
- }
1912
- function So(e) {
1913
- const { week: t, ...r } = e;
1914
- return d.createElement("th", { ...r });
1915
- }
1916
- function Co(e) {
1917
- return d.createElement("th", { ...e });
1918
- }
1919
- function No(e) {
1920
- return d.createElement("tbody", { ...e });
1921
- }
1922
- function Yo(e) {
1923
- const { components: t } = ke();
1924
- return d.createElement(t.Dropdown, { ...e });
1925
- }
1926
- const To = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1927
- __proto__: null,
1928
- Button: ro,
1929
- CaptionLabel: oo,
1930
- Chevron: so,
1931
- Day: ao,
1932
- DayButton: io,
1933
- Dropdown: co,
1934
- DropdownNav: uo,
1935
- Footer: lo,
1936
- Month: fo,
1937
- MonthCaption: ho,
1938
- MonthGrid: mo,
1939
- Months: yo,
1940
- MonthsDropdown: go,
1941
- Nav: po,
1942
- NextMonthButton: bo,
1943
- Option: wo,
1944
- PreviousMonthButton: Mo,
1945
- Root: Do,
1946
- Select: ko,
1947
- Week: Oo,
1948
- WeekNumber: So,
1949
- WeekNumberHeader: Co,
1950
- Weekday: vo,
1951
- Weekdays: Wo,
1952
- Weeks: No,
1953
- YearsDropdown: Yo
1954
- }, Symbol.toStringTag, { value: "Module" }));
1955
- function ne(e, t, r = !1, n = L) {
1956
- let { from: o, to: a } = e;
1957
- const { differenceInCalendarDays: i, isSameDay: s } = n;
1958
- return o && a ? (i(a, o) < 0 && ([o, a] = [a, o]), i(t, o) >= (r ? 1 : 0) && i(a, t) >= (r ? 1 : 0)) : !r && a ? s(a, t) : !r && o ? s(o, t) : !1;
1959
- }
1960
- function Ve(e) {
1961
- return !!(e && typeof e == "object" && "before" in e && "after" in e);
1962
- }
1963
- function Ne(e) {
1964
- return !!(e && typeof e == "object" && "from" in e);
1965
- }
1966
- function Ze(e) {
1967
- return !!(e && typeof e == "object" && "after" in e);
1968
- }
1969
- function Ke(e) {
1970
- return !!(e && typeof e == "object" && "before" in e);
1971
- }
1972
- function Bt(e) {
1973
- return !!(e && typeof e == "object" && "dayOfWeek" in e);
1974
- }
1975
- function It(e, t) {
1976
- return Array.isArray(e) && e.every(t.isDate);
1977
- }
1978
- function re(e, t, r = L) {
1979
- const n = Array.isArray(t) ? t : [t], { isSameDay: o, differenceInCalendarDays: a, isAfter: i } = r;
1980
- return n.some((s) => {
1981
- if (typeof s == "boolean")
1982
- return s;
1983
- if (r.isDate(s))
1984
- return o(e, s);
1985
- if (It(s, r))
1986
- return s.some((c) => o(e, c));
1987
- if (Ne(s))
1988
- return ne(s, e, !1, r);
1989
- if (Bt(s))
1990
- return Array.isArray(s.dayOfWeek) ? s.dayOfWeek.includes(e.getDay()) : s.dayOfWeek === e.getDay();
1991
- if (Ve(s)) {
1992
- const c = a(s.before, e), u = a(s.after, e), f = c > 0, l = u < 0;
1993
- return i(s.before, s.after) ? l && f : f || l;
1994
- }
1995
- return Ze(s) ? a(e, s.after) > 0 : Ke(s) ? a(s.before, e) > 0 : typeof s == "function" ? s(e) : !1;
1996
- });
1997
- }
1998
- function xo(e, t, r, n, o) {
1999
- const { disabled: a, hidden: i, modifiers: s, showOutsideDays: c, broadcastCalendar: u, today: f = o.today() } = t, { isSameDay: l, isSameMonth: h, startOfMonth: g, isBefore: v, endOfMonth: C, isAfter: O } = o, T = r && g(r), M = n && C(n), b = {
2000
- [_.focused]: [],
2001
- [_.outside]: [],
2002
- [_.disabled]: [],
2003
- [_.hidden]: [],
2004
- [_.today]: []
2005
- }, D = {};
2006
- for (const p of e) {
2007
- const { date: m, displayMonth: W } = p, E = !!(W && !h(m, W)), H = !!(T && v(m, T)), F = !!(M && O(m, M)), Z = !!(a && re(m, a, o)), oe = !!(i && re(m, i, o)) || H || F || // Broadcast calendar will show outside days as default
2008
- !u && !c && E || u && c === !1 && E, ee = l(m, f);
2009
- E && b.outside.push(p), Z && b.disabled.push(p), oe && b.hidden.push(p), ee && b.today.push(p), s && Object.keys(s).forEach(($) => {
2010
- const ce = s?.[$];
2011
- ce && re(m, ce, o) && (D[$] ? D[$].push(p) : D[$] = [p]);
2012
- });
2013
- }
2014
- return (p) => {
2015
- const m = {
2016
- [_.focused]: !1,
2017
- [_.disabled]: !1,
2018
- [_.hidden]: !1,
2019
- [_.outside]: !1,
2020
- [_.today]: !1
2021
- }, W = {};
2022
- for (const E in b) {
2023
- const H = b[E];
2024
- m[E] = H.some((F) => F === p);
2025
- }
2026
- for (const E in D)
2027
- W[E] = D[E].some((H) => H === p);
2028
- return {
2029
- ...m,
2030
- // custom modifiers should override all the previous ones
2031
- ...W
2032
- };
2033
- };
2034
- }
2035
- function Po(e, t, r = {}) {
2036
- return Object.entries(e).filter(([, o]) => o === !0).reduce((o, [a]) => (r[a] ? o.push(r[a]) : t[_[a]] ? o.push(t[_[a]]) : t[V[a]] && o.push(t[V[a]]), o), [t[y.Day]]);
2037
- }
2038
- function Eo(e) {
2039
- return {
2040
- ...To,
2041
- ...e
2042
- };
2043
- }
2044
- function _o(e) {
2045
- const t = {
2046
- "data-mode": e.mode ?? void 0,
2047
- "data-required": "required" in e ? e.required : void 0,
2048
- "data-multiple-months": e.numberOfMonths && e.numberOfMonths > 1 || void 0,
2049
- "data-week-numbers": e.showWeekNumber || void 0,
2050
- "data-broadcast-calendar": e.broadcastCalendar || void 0,
2051
- "data-nav-layout": e.navLayout || void 0
2052
- };
2053
- return Object.entries(e).forEach(([r, n]) => {
2054
- r.startsWith("data-") && (t[r] = n);
2055
- }), t;
2056
- }
2057
- function Fo() {
2058
- const e = {};
2059
- for (const t in y)
2060
- e[y[t]] = `rdp-${y[t]}`;
2061
- for (const t in _)
2062
- e[_[t]] = `rdp-${_[t]}`;
2063
- for (const t in V)
2064
- e[V[t]] = `rdp-${V[t]}`;
2065
- for (const t in j)
2066
- e[j[t]] = `rdp-${j[t]}`;
2067
- return e;
2068
- }
2069
- function Ht(e, t, r) {
2070
- return (r ?? new G(t)).formatMonthYear(e);
2071
- }
2072
- const Bo = Ht;
2073
- function Io(e, t, r) {
2074
- return (r ?? new G(t)).format(e, "d");
2075
- }
2076
- function Ho(e, t = L) {
2077
- return t.format(e, "LLLL");
2078
- }
2079
- function Ao(e, t, r) {
2080
- return (r ?? new G(t)).format(e, "cccccc");
2081
- }
2082
- function qo(e, t = L) {
2083
- return e < 10 ? t.formatNumber(`0${e.toLocaleString()}`) : t.formatNumber(`${e.toLocaleString()}`);
2084
- }
2085
- function jo() {
2086
- return "";
2087
- }
2088
- function At(e, t = L) {
2089
- return t.format(e, "yyyy");
2090
- }
2091
- const Go = At, $o = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2092
- __proto__: null,
2093
- formatCaption: Ht,
2094
- formatDay: Io,
2095
- formatMonthCaption: Bo,
2096
- formatMonthDropdown: Ho,
2097
- formatWeekNumber: qo,
2098
- formatWeekNumberHeader: jo,
2099
- formatWeekdayName: Ao,
2100
- formatYearCaption: Go,
2101
- formatYearDropdown: At
2102
- }, Symbol.toStringTag, { value: "Module" }));
2103
- function Ro(e) {
2104
- return e?.formatMonthCaption && !e.formatCaption && (e.formatCaption = e.formatMonthCaption), e?.formatYearCaption && !e.formatYearDropdown && (e.formatYearDropdown = e.formatYearCaption), {
2105
- ...$o,
2106
- ...e
2107
- };
2108
- }
2109
- function Je(e, t, r, n) {
2110
- let o = (n ?? new G(r)).format(e, "PPPP");
2111
- return t.today && (o = `Today, ${o}`), t.selected && (o = `${o}, selected`), o;
2112
- }
2113
- const zo = Je;
2114
- function Le(e, t, r) {
2115
- return (r ?? new G(t)).formatMonthYear(e);
2116
- }
2117
- const Qo = Le;
2118
- function qt(e, t, r, n) {
2119
- let o = (n ?? new G(r)).format(e, "PPPP");
2120
- return t?.today && (o = `Today, ${o}`), o;
2121
- }
2122
- function jt(e) {
2123
- return "Choose the Month";
2124
- }
2125
- function Gt() {
2126
- return "";
2127
- }
2128
- const Xo = "Go to the Next Month";
2129
- function $t(e, t) {
2130
- return Xo;
2131
- }
2132
- function Rt(e) {
2133
- return "Go to the Previous Month";
2134
- }
2135
- function zt(e, t, r) {
2136
- return (r ?? new G(t)).format(e, "cccc");
2137
- }
2138
- function Qt(e, t) {
2139
- return `Week ${e}`;
2140
- }
2141
- function Xt(e) {
2142
- return "Week Number";
2143
- }
2144
- function Ut(e) {
2145
- return "Choose the Year";
2146
- }
2147
- const Uo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2148
- __proto__: null,
2149
- labelCaption: Qo,
2150
- labelDay: zo,
2151
- labelDayButton: Je,
2152
- labelGrid: Le,
2153
- labelGridcell: qt,
2154
- labelMonthDropdown: jt,
2155
- labelNav: Gt,
2156
- labelNext: $t,
2157
- labelPrevious: Rt,
2158
- labelWeekNumber: Qt,
2159
- labelWeekNumberHeader: Xt,
2160
- labelWeekday: zt,
2161
- labelYearDropdown: Ut
2162
- }, Symbol.toStringTag, { value: "Module" })), U = (e, t, r) => t || (r ? typeof r == "function" ? r : (...n) => r : e);
2163
- function Vo(e, t) {
2164
- const r = t.locale?.labels ?? {};
2165
- return {
2166
- ...Uo,
2167
- ...e ?? {},
2168
- labelDayButton: U(Je, e?.labelDayButton, r.labelDayButton),
2169
- labelMonthDropdown: U(jt, e?.labelMonthDropdown, r.labelMonthDropdown),
2170
- labelNext: U($t, e?.labelNext, r.labelNext),
2171
- labelPrevious: U(Rt, e?.labelPrevious, r.labelPrevious),
2172
- labelWeekNumber: U(Qt, e?.labelWeekNumber, r.labelWeekNumber),
2173
- labelYearDropdown: U(Ut, e?.labelYearDropdown, r.labelYearDropdown),
2174
- labelGrid: U(Le, e?.labelGrid, r.labelGrid),
2175
- labelGridcell: U(qt, e?.labelGridcell, r.labelGridcell),
2176
- labelNav: U(Gt, e?.labelNav, r.labelNav),
2177
- labelWeekNumberHeader: U(Xt, e?.labelWeekNumberHeader, r.labelWeekNumberHeader),
2178
- labelWeekday: U(zt, e?.labelWeekday, r.labelWeekday)
2179
- };
2180
- }
2181
- function Zo(e, t, r, n, o) {
2182
- const { startOfMonth: a, startOfYear: i, endOfYear: s, eachMonthOfInterval: c, getMonth: u } = o;
2183
- return c({
2184
- start: i(e),
2185
- end: s(e)
2186
- }).map((h) => {
2187
- const g = n.formatMonthDropdown(h, o), v = u(h), C = t && h < a(t) || r && h > a(r) || !1;
2188
- return { value: v, label: g, disabled: C };
2189
- });
2190
- }
2191
- function Ko(e, t = {}, r = {}) {
2192
- let n = { ...t?.[y.Day] };
2193
- return Object.entries(e).filter(([, o]) => o === !0).forEach(([o]) => {
2194
- n = {
2195
- ...n,
2196
- ...r?.[o]
2197
- };
2198
- }), n;
2199
- }
2200
- function Jo(e, t, r, n) {
2201
- const o = n ?? e.today(), a = r ? e.startOfBroadcastWeek(o, e) : t ? e.startOfISOWeek(o) : e.startOfWeek(o), i = [];
2202
- for (let s = 0; s < 7; s++) {
2203
- const c = e.addDays(a, s);
2204
- i.push(c);
2205
- }
2206
- return i;
2207
- }
2208
- function Lo(e, t, r, n, o = !1) {
2209
- if (!e || !t)
2210
- return;
2211
- const { startOfYear: a, endOfYear: i, eachYearOfInterval: s, getYear: c } = n, u = a(e), f = i(t), l = s({ start: u, end: f });
2212
- return o && l.reverse(), l.map((h) => {
2213
- const g = r.formatYearDropdown(h, n);
2214
- return {
2215
- value: c(h),
2216
- label: g,
2217
- disabled: !1
2218
- };
2219
- });
2220
- }
2221
- function es(e, t = {}) {
2222
- const { weekStartsOn: r, locale: n } = t, o = r ?? n?.options?.weekStartsOn ?? 0, a = (s) => {
2223
- const c = typeof s == "number" || typeof s == "string" ? new Date(s) : s;
2224
- return new A(c.getFullYear(), c.getMonth(), c.getDate(), 12, 0, 0, e);
2225
- }, i = (s) => {
2226
- const c = a(s);
2227
- return new Date(c.getFullYear(), c.getMonth(), c.getDate(), 0, 0, 0, 0);
2228
- };
2229
- return {
2230
- today: () => a(A.tz(e)),
2231
- newDate: (s, c, u) => new A(s, c, u, 12, 0, 0, e),
2232
- startOfDay: (s) => a(s),
2233
- startOfWeek: (s, c) => {
2234
- const u = a(s), f = c?.weekStartsOn ?? o, l = (u.getDay() - f + 7) % 7;
2235
- return u.setDate(u.getDate() - l), u;
2236
- },
2237
- startOfISOWeek: (s) => {
2238
- const c = a(s), u = (c.getDay() - 1 + 7) % 7;
2239
- return c.setDate(c.getDate() - u), c;
2240
- },
2241
- startOfMonth: (s) => {
2242
- const c = a(s);
2243
- return c.setDate(1), c;
2244
- },
2245
- startOfYear: (s) => {
2246
- const c = a(s);
2247
- return c.setMonth(0, 1), c;
2248
- },
2249
- endOfWeek: (s, c) => {
2250
- const u = a(s), h = (((c?.weekStartsOn ?? o) + 6) % 7 - u.getDay() + 7) % 7;
2251
- return u.setDate(u.getDate() + h), u;
2252
- },
2253
- endOfISOWeek: (s) => {
2254
- const c = a(s), u = (7 - c.getDay()) % 7;
2255
- return c.setDate(c.getDate() + u), c;
2256
- },
2257
- endOfMonth: (s) => {
2258
- const c = a(s);
2259
- return c.setMonth(c.getMonth() + 1, 0), c;
2260
- },
2261
- endOfYear: (s) => {
2262
- const c = a(s);
2263
- return c.setMonth(11, 31), c;
2264
- },
2265
- eachMonthOfInterval: (s) => {
2266
- const c = a(s.start), u = a(s.end), f = [], l = new A(c.getFullYear(), c.getMonth(), 1, 12, 0, 0, e), h = u.getFullYear() * 12 + u.getMonth();
2267
- for (; l.getFullYear() * 12 + l.getMonth() <= h; )
2268
- f.push(new A(l, e)), l.setMonth(l.getMonth() + 1, 1);
2269
- return f;
2270
- },
2271
- // Normalize to noon once before arithmetic (avoid DST/midnight edge cases),
2272
- // mutate the same TZDate, and return it.
2273
- addDays: (s, c) => {
2274
- const u = a(s);
2275
- return u.setDate(u.getDate() + c), u;
2276
- },
2277
- addWeeks: (s, c) => {
2278
- const u = a(s);
2279
- return u.setDate(u.getDate() + c * 7), u;
2280
- },
2281
- addMonths: (s, c) => {
2282
- const u = a(s);
2283
- return u.setMonth(u.getMonth() + c), u;
2284
- },
2285
- addYears: (s, c) => {
2286
- const u = a(s);
2287
- return u.setFullYear(u.getFullYear() + c), u;
2288
- },
2289
- eachYearOfInterval: (s) => {
2290
- const c = a(s.start), u = a(s.end), f = [], l = new A(c.getFullYear(), 0, 1, 12, 0, 0, e);
2291
- for (; l.getFullYear() <= u.getFullYear(); )
2292
- f.push(new A(l, e)), l.setFullYear(l.getFullYear() + 1, 0, 1);
2293
- return f;
2294
- },
2295
- getWeek: (s, c) => {
2296
- const u = i(s);
2297
- return Ue(u, {
2298
- weekStartsOn: c?.weekStartsOn ?? o,
2299
- firstWeekContainsDate: c?.firstWeekContainsDate ?? n?.options?.firstWeekContainsDate ?? 1
2300
- });
2301
- },
2302
- getISOWeek: (s) => {
2303
- const c = i(s);
2304
- return Xe(c);
2305
- },
2306
- differenceInCalendarDays: (s, c) => {
2307
- const u = i(s), f = i(c);
2308
- return Qe(u, f);
2309
- },
2310
- differenceInCalendarMonths: (s, c) => {
2311
- const u = i(s), f = i(c);
2312
- return St(u, f);
2313
- }
2314
- };
2315
- }
2316
- const Oe = (e) => e instanceof HTMLElement ? e : null, qe = (e) => [
2317
- ...e.querySelectorAll("[data-animated-month]") ?? []
2318
- ], ts = (e) => Oe(e.querySelector("[data-animated-month]")), je = (e) => Oe(e.querySelector("[data-animated-caption]")), Ge = (e) => Oe(e.querySelector("[data-animated-weeks]")), ns = (e) => Oe(e.querySelector("[data-animated-nav]")), rs = (e) => Oe(e.querySelector("[data-animated-weekdays]"));
2319
- function os(e, t, { classNames: r, months: n, focused: o, dateLib: a }) {
2320
- const i = Ce(null), s = Ce(n), c = Ce(!1);
2321
- Cn(() => {
2322
- const u = s.current;
2323
- if (s.current = n, !t || !e.current || // safety check because the ref can be set to anything by consumers
2324
- !(e.current instanceof HTMLElement) || // validation required for the animation to work as expected
2325
- n.length === 0 || u.length === 0 || n.length !== u.length)
2326
- return;
2327
- const f = a.isSameMonth(n[0].date, u[0].date), l = a.isAfter(n[0].date, u[0].date), h = l ? r[j.caption_after_enter] : r[j.caption_before_enter], g = l ? r[j.weeks_after_enter] : r[j.weeks_before_enter], v = i.current, C = e.current.cloneNode(!0);
2328
- if (C instanceof HTMLElement ? (qe(C).forEach((b) => {
2329
- if (!(b instanceof HTMLElement))
2330
- return;
2331
- const D = ts(b);
2332
- D && b.contains(D) && b.removeChild(D);
2333
- const p = je(b);
2334
- p && p.classList.remove(h);
2335
- const m = Ge(b);
2336
- m && m.classList.remove(g);
2337
- }), i.current = C) : i.current = null, c.current || f || // skip animation if a day is focused because it can cause issues to the animation and is better for a11y
2338
- o)
2339
- return;
2340
- const O = v instanceof HTMLElement ? qe(v) : [], T = qe(e.current);
2341
- if (T?.every((M) => M instanceof HTMLElement) && O && O.every((M) => M instanceof HTMLElement)) {
2342
- c.current = !0, e.current.style.isolation = "isolate";
2343
- const M = ns(e.current);
2344
- M && (M.style.zIndex = "1"), T.forEach((b, D) => {
2345
- const p = O[D];
2346
- if (!p)
2347
- return;
2348
- b.style.position = "relative", b.style.overflow = "hidden";
2349
- const m = je(b);
2350
- m && m.classList.add(h);
2351
- const W = Ge(b);
2352
- W && W.classList.add(g);
2353
- const E = () => {
2354
- c.current = !1, e.current && (e.current.style.isolation = ""), M && (M.style.zIndex = ""), m && m.classList.remove(h), W && W.classList.remove(g), b.style.position = "", b.style.overflow = "", b.contains(p) && b.removeChild(p);
2355
- };
2356
- p.style.pointerEvents = "none", p.style.position = "absolute", p.style.overflow = "hidden", p.setAttribute("aria-hidden", "true");
2357
- const H = rs(p);
2358
- H && (H.style.opacity = "0");
2359
- const F = je(p);
2360
- F && (F.classList.add(l ? r[j.caption_before_exit] : r[j.caption_after_exit]), F.addEventListener("animationend", E));
2361
- const Z = Ge(p);
2362
- Z && Z.classList.add(l ? r[j.weeks_before_exit] : r[j.weeks_after_exit]), b.insertBefore(p, b.firstChild);
2363
- });
2364
- }
2365
- });
2366
- }
2367
- function ss(e, t, r, n) {
2368
- const o = e[0], a = e[e.length - 1], { ISOWeek: i, fixedWeeks: s, broadcastCalendar: c } = r ?? {}, { addDays: u, differenceInCalendarDays: f, differenceInCalendarMonths: l, endOfBroadcastWeek: h, endOfISOWeek: g, endOfMonth: v, endOfWeek: C, isAfter: O, startOfBroadcastWeek: T, startOfISOWeek: M, startOfWeek: b } = n, D = c ? T(o, n) : i ? M(o) : b(o), p = c ? h(a) : i ? g(v(a)) : C(v(a)), m = t && (c ? h(t) : i ? g(t) : C(t)), W = m && O(p, m) ? m : p, E = f(W, D), H = l(a, o) + 1, F = [];
2369
- for (let ee = 0; ee <= E; ee++) {
2370
- const $ = u(D, ee);
2371
- F.push($);
2372
- }
2373
- const oe = (c ? 35 : 42) * H;
2374
- if (s && F.length < oe) {
2375
- const ee = oe - F.length;
2376
- for (let $ = 0; $ < ee; $++) {
2377
- const ce = u(F[F.length - 1], 1);
2378
- F.push(ce);
2379
- }
2380
- }
2381
- return F;
2382
- }
2383
- function as(e) {
2384
- const t = [];
2385
- return e.reduce((r, n) => {
2386
- const o = n.weeks.reduce((a, i) => a.concat(i.days.slice()), t.slice());
2387
- return r.concat(o.slice());
2388
- }, t.slice());
2389
- }
2390
- function is(e, t, r, n) {
2391
- const { numberOfMonths: o = 1 } = r, a = [];
2392
- for (let i = 0; i < o; i++) {
2393
- const s = n.addMonths(e, i);
2394
- if (t && s > t)
2395
- break;
2396
- a.push(s);
2397
- }
2398
- return a;
2399
- }
2400
- function gt(e, t, r, n) {
2401
- const { month: o, defaultMonth: a, today: i = n.today(), numberOfMonths: s = 1 } = e;
2402
- let c = o || a || i;
2403
- const { differenceInCalendarMonths: u, addMonths: f, startOfMonth: l } = n;
2404
- if (r && u(r, c) < s - 1) {
2405
- const h = -1 * (s - 1);
2406
- c = f(r, h);
2407
- }
2408
- return t && u(c, t) < 0 && (c = t), l(c);
2409
- }
2410
- function cs(e, t, r, n) {
2411
- const { addDays: o, endOfBroadcastWeek: a, endOfISOWeek: i, endOfMonth: s, endOfWeek: c, getISOWeek: u, getWeek: f, startOfBroadcastWeek: l, startOfISOWeek: h, startOfWeek: g } = n, v = e.reduce((C, O) => {
2412
- const T = r.broadcastCalendar ? l(O, n) : r.ISOWeek ? h(O) : g(O), M = r.broadcastCalendar ? a(O) : r.ISOWeek ? i(s(O)) : c(s(O)), b = t.filter((W) => W >= T && W <= M), D = r.broadcastCalendar ? 35 : 42;
2413
- if (r.fixedWeeks && b.length < D) {
2414
- const W = t.filter((E) => {
2415
- const H = D - b.length;
2416
- return E > M && E <= o(M, H);
2417
- });
2418
- b.push(...W);
2419
- }
2420
- const p = b.reduce((W, E) => {
2421
- const H = r.ISOWeek ? u(E) : f(E), F = W.find((oe) => oe.weekNumber === H), Z = new _t(E, O, n);
2422
- return F ? F.days.push(Z) : W.push(new no(H, [Z])), W;
2423
- }, []), m = new to(O, p);
2424
- return C.push(m), C;
2425
- }, []);
2426
- return r.reverseMonths ? v.reverse() : v;
2427
- }
2428
- function us(e, t) {
2429
- let { startMonth: r, endMonth: n } = e;
2430
- const { startOfYear: o, startOfDay: a, startOfMonth: i, endOfMonth: s, addYears: c, endOfYear: u, newDate: f, today: l } = t, { fromYear: h, toYear: g, fromMonth: v, toMonth: C } = e;
2431
- !r && v && (r = v), !r && h && (r = t.newDate(h, 0, 1)), !n && C && (n = C), !n && g && (n = f(g, 11, 31));
2432
- const O = e.captionLayout === "dropdown" || e.captionLayout === "dropdown-years";
2433
- return r ? r = i(r) : h ? r = f(h, 0, 1) : !r && O && (r = o(c(e.today ?? l(), -100))), n ? n = s(n) : g ? n = f(g, 11, 31) : !n && O && (n = u(e.today ?? l())), [
2434
- r && a(r),
2435
- n && a(n)
2436
- ];
2437
- }
2438
- function ls(e, t, r, n) {
2439
- if (r.disableNavigation)
2440
- return;
2441
- const { pagedNavigation: o, numberOfMonths: a = 1 } = r, { startOfMonth: i, addMonths: s, differenceInCalendarMonths: c } = n, u = o ? a : 1, f = i(e);
2442
- if (!t)
2443
- return s(f, u);
2444
- if (!(c(t, e) < a))
2445
- return s(f, u);
2446
- }
2447
- function fs(e, t, r, n) {
2448
- if (r.disableNavigation)
2449
- return;
2450
- const { pagedNavigation: o, numberOfMonths: a } = r, { startOfMonth: i, addMonths: s, differenceInCalendarMonths: c } = n, u = o ? a ?? 1 : 1, f = i(e);
2451
- if (!t)
2452
- return s(f, -u);
2453
- if (!(c(f, t) <= 0))
2454
- return s(f, -u);
2455
- }
2456
- function ds(e) {
2457
- const t = [];
2458
- return e.reduce((r, n) => r.concat(n.weeks.slice()), t.slice());
2459
- }
2460
- function Ye(e, t) {
2461
- const [r, n] = Re(e);
2462
- return [t === void 0 ? r : t, n];
2463
- }
2464
- function hs(e, t) {
2465
- const [r, n] = us(e, t), { startOfMonth: o, endOfMonth: a } = t, i = gt(e, r, n, t), [s, c] = Ye(
2466
- i,
2467
- // initialMonth is always computed from props.month if provided
2468
- e.month ? i : void 0
2469
- );
2470
- Nn(() => {
2471
- const D = gt(e, r, n, t);
2472
- c(D);
2473
- }, [e.timeZone]);
2474
- const { months: u, weeks: f, days: l, previousMonth: h, nextMonth: g } = be(() => {
2475
- const D = is(s, n, { numberOfMonths: e.numberOfMonths }, t), p = ss(D, e.endMonth ? a(e.endMonth) : void 0, {
2476
- ISOWeek: e.ISOWeek,
2477
- fixedWeeks: e.fixedWeeks,
2478
- broadcastCalendar: e.broadcastCalendar
2479
- }, t), m = cs(D, p, {
2480
- broadcastCalendar: e.broadcastCalendar,
2481
- fixedWeeks: e.fixedWeeks,
2482
- ISOWeek: e.ISOWeek,
2483
- reverseMonths: e.reverseMonths
2484
- }, t), W = ds(m), E = as(m), H = fs(s, r, e, t), F = ls(s, n, e, t);
2485
- return {
2486
- months: m,
2487
- weeks: W,
2488
- days: E,
2489
- previousMonth: H,
2490
- nextMonth: F
2491
- };
2492
- }, [
2493
- t,
2494
- s.getTime(),
2495
- n?.getTime(),
2496
- r?.getTime(),
2497
- e.disableNavigation,
2498
- e.broadcastCalendar,
2499
- e.endMonth?.getTime(),
2500
- e.fixedWeeks,
2501
- e.ISOWeek,
2502
- e.numberOfMonths,
2503
- e.pagedNavigation,
2504
- e.reverseMonths
2505
- ]), { disableNavigation: v, onMonthChange: C } = e, O = (D) => f.some((p) => p.days.some((m) => m.isEqualTo(D))), T = (D) => {
2506
- if (v)
2507
- return;
2508
- let p = o(D);
2509
- r && p < o(r) && (p = o(r)), n && p > o(n) && (p = o(n)), c(p), C?.(p);
2510
- };
2511
- return {
2512
- months: u,
2513
- weeks: f,
2514
- days: l,
2515
- navStart: r,
2516
- navEnd: n,
2517
- previousMonth: h,
2518
- nextMonth: g,
2519
- goToMonth: T,
2520
- goToDay: (D) => {
2521
- O(D) || T(D.date);
2522
- }
2523
- };
2524
- }
2525
- var K;
2526
- (function(e) {
2527
- e[e.Today = 0] = "Today", e[e.Selected = 1] = "Selected", e[e.LastFocused = 2] = "LastFocused", e[e.FocusedModifier = 3] = "FocusedModifier";
2528
- })(K || (K = {}));
2529
- function pt(e) {
2530
- return !e[_.disabled] && !e[_.hidden] && !e[_.outside];
2531
- }
2532
- function ms(e, t, r, n) {
2533
- let o, a = -1;
2534
- for (const i of e) {
2535
- const s = t(i);
2536
- pt(s) && (s[_.focused] && a < K.FocusedModifier ? (o = i, a = K.FocusedModifier) : n?.isEqualTo(i) && a < K.LastFocused ? (o = i, a = K.LastFocused) : r(i.date) && a < K.Selected ? (o = i, a = K.Selected) : s[_.today] && a < K.Today && (o = i, a = K.Today));
2537
- }
2538
- return o || (o = e.find((i) => pt(t(i)))), o;
2539
- }
2540
- function ys(e, t, r, n, o, a, i) {
2541
- const { ISOWeek: s, broadcastCalendar: c } = a, { addDays: u, addMonths: f, addWeeks: l, addYears: h, endOfBroadcastWeek: g, endOfISOWeek: v, endOfWeek: C, max: O, min: T, startOfBroadcastWeek: M, startOfISOWeek: b, startOfWeek: D } = i;
2542
- let m = {
2543
- day: u,
2544
- week: l,
2545
- month: f,
2546
- year: h,
2547
- startOfWeek: (W) => c ? M(W, i) : s ? b(W) : D(W),
2548
- endOfWeek: (W) => c ? g(W) : s ? v(W) : C(W)
2549
- }[e](r, t === "after" ? 1 : -1);
2550
- return t === "before" && n ? m = O([n, m]) : t === "after" && o && (m = T([o, m])), m;
2551
- }
2552
- function Vt(e, t, r, n, o, a, i, s = 0) {
2553
- if (s > 365)
2554
- return;
2555
- const c = ys(e, t, r.date, n, o, a, i), u = !!(a.disabled && re(c, a.disabled, i)), f = !!(a.hidden && re(c, a.hidden, i)), l = c, h = new _t(c, l, i);
2556
- return !u && !f ? h : Vt(e, t, h, n, o, a, i, s + 1);
2557
- }
2558
- function gs(e, t, r, n, o) {
2559
- const { autoFocus: a } = e, [i, s] = Re(), c = ms(t.days, r, n || (() => !1), i), [u, f] = Re(a ? c : void 0);
2560
- return {
2561
- isFocusTarget: (C) => !!c?.isEqualTo(C),
2562
- setFocused: f,
2563
- focused: u,
2564
- blur: () => {
2565
- s(u), f(void 0);
2566
- },
2567
- moveFocus: (C, O) => {
2568
- if (!u)
2569
- return;
2570
- const T = Vt(C, O, u, t.navStart, t.navEnd, e, o);
2571
- T && (e.disableNavigation && !t.days.some((b) => b.isEqualTo(T)) || (t.goToDay(T), f(T)));
2572
- }
2573
- };
2574
- }
2575
- function ps(e, t) {
2576
- const { selected: r, required: n, onSelect: o } = e, [a, i] = Ye(r, o ? r : void 0), s = o ? r : a, { isSameDay: c } = t, u = (g) => s?.some((v) => c(v, g)) ?? !1, { min: f, max: l } = e;
2577
- return {
2578
- selected: s,
2579
- select: (g, v, C) => {
2580
- let O = [...s ?? []];
2581
- if (u(g)) {
2582
- if (s?.length === f || n && s?.length === 1)
2583
- return;
2584
- O = s?.filter((T) => !c(T, g));
2585
- } else
2586
- s?.length === l ? O = [g] : O = [...O, g];
2587
- return o || i(O), o?.(O, g, v, C), O;
2588
- },
2589
- isSelected: u
2590
- };
2591
- }
2592
- function bs(e, t, r = 0, n = 0, o = !1, a = L) {
2593
- const { from: i, to: s } = t || {}, { isSameDay: c, isAfter: u, isBefore: f } = a;
2594
- let l;
2595
- if (!i && !s)
2596
- l = { from: e, to: r > 0 ? void 0 : e };
2597
- else if (i && !s)
2598
- c(i, e) ? r === 0 ? l = { from: i, to: e } : o ? l = { from: i, to: void 0 } : l = void 0 : f(e, i) ? l = { from: e, to: i } : l = { from: i, to: e };
2599
- else if (i && s)
2600
- if (c(i, e) && c(s, e))
2601
- o ? l = { from: i, to: s } : l = void 0;
2602
- else if (c(i, e))
2603
- l = { from: i, to: r > 0 ? void 0 : e };
2604
- else if (c(s, e))
2605
- l = { from: e, to: r > 0 ? void 0 : e };
2606
- else if (f(e, i))
2607
- l = { from: e, to: s };
2608
- else if (u(e, i))
2609
- l = { from: i, to: e };
2610
- else if (u(e, s))
2611
- l = { from: i, to: e };
2612
- else
2613
- throw new Error("Invalid range");
2614
- if (l?.from && l?.to) {
2615
- const h = a.differenceInCalendarDays(l.to, l.from);
2616
- n > 0 && h > n ? l = { from: e, to: void 0 } : r > 1 && h < r && (l = { from: e, to: void 0 });
2617
- }
2618
- return l;
2619
- }
2620
- function ws(e, t, r = L) {
2621
- const n = Array.isArray(t) ? t : [t];
2622
- let o = e.from;
2623
- const a = r.differenceInCalendarDays(e.to, e.from), i = Math.min(a, 6);
2624
- for (let s = 0; s <= i; s++) {
2625
- if (n.includes(o.getDay()))
2626
- return !0;
2627
- o = r.addDays(o, 1);
2628
- }
2629
- return !1;
2630
- }
2631
- function bt(e, t, r = L) {
2632
- return ne(e, t.from, !1, r) || ne(e, t.to, !1, r) || ne(t, e.from, !1, r) || ne(t, e.to, !1, r);
2633
- }
2634
- function Ms(e, t, r = L) {
2635
- const n = Array.isArray(t) ? t : [t];
2636
- if (n.filter((s) => typeof s != "function").some((s) => typeof s == "boolean" ? s : r.isDate(s) ? ne(e, s, !1, r) : It(s, r) ? s.some((c) => ne(e, c, !1, r)) : Ne(s) ? s.from && s.to ? bt(e, { from: s.from, to: s.to }, r) : !1 : Bt(s) ? ws(e, s.dayOfWeek, r) : Ve(s) ? r.isAfter(s.before, s.after) ? bt(e, {
2637
- from: r.addDays(s.after, 1),
2638
- to: r.addDays(s.before, -1)
2639
- }, r) : re(e.from, s, r) || re(e.to, s, r) : Ze(s) || Ke(s) ? re(e.from, s, r) || re(e.to, s, r) : !1))
2640
- return !0;
2641
- const i = n.filter((s) => typeof s == "function");
2642
- if (i.length) {
2643
- let s = e.from;
2644
- const c = r.differenceInCalendarDays(e.to, e.from);
2645
- for (let u = 0; u <= c; u++) {
2646
- if (i.some((f) => f(s)))
2647
- return !0;
2648
- s = r.addDays(s, 1);
2649
- }
2650
- }
2651
- return !1;
2652
- }
2653
- function Ds(e, t) {
2654
- const { disabled: r, excludeDisabled: n, resetOnSelect: o, selected: a, required: i, onSelect: s } = e, [c, u] = Ye(a, s ? a : void 0), f = s ? a : c;
2655
- return {
2656
- selected: f,
2657
- select: (g, v, C) => {
2658
- const { min: O, max: T } = e;
2659
- let M;
2660
- if (g) {
2661
- const b = f?.from, D = f?.to, p = !!b && !!D, m = !!b && !!D && t.isSameDay(b, D) && t.isSameDay(g, b);
2662
- o && (p || !f?.from) ? !i && m ? M = void 0 : M = { from: g, to: void 0 } : M = bs(g, f, O, T, i, t);
2663
- }
2664
- return n && r && M?.from && M.to && Ms({ from: M.from, to: M.to }, r, t) && (M.from = g, M.to = void 0), s || u(M), s?.(M, g, v, C), M;
2665
- },
2666
- isSelected: (g) => f && ne(f, g, !1, t)
2667
- };
2668
- }
2669
- function ks(e, t) {
2670
- const { selected: r, required: n, onSelect: o } = e, [a, i] = Ye(r, o ? r : void 0), s = o ? r : a, { isSameDay: c } = t;
2671
- return {
2672
- selected: s,
2673
- select: (l, h, g) => {
2674
- let v = l;
2675
- return !n && s && s && c(l, s) && (v = void 0), o || i(v), o?.(v, l, h, g), v;
2676
- },
2677
- isSelected: (l) => s ? c(s, l) : !1
2678
- };
2679
- }
2680
- function Os(e, t) {
2681
- const r = ks(e, t), n = ps(e, t), o = Ds(e, t);
2682
- switch (e.mode) {
2683
- case "single":
2684
- return r;
2685
- case "multiple":
2686
- return n;
2687
- case "range":
2688
- return o;
2689
- default:
2690
- return;
2691
- }
2692
- }
2693
- function z(e, t) {
2694
- return e instanceof A && e.timeZone === t ? e : new A(e, t);
2695
- }
2696
- function le(e, t, r) {
2697
- return z(e, t);
2698
- }
2699
- function wt(e, t, r) {
2700
- return typeof e == "boolean" || typeof e == "function" ? e : e instanceof Date ? le(e, t) : Array.isArray(e) ? e.map((n) => n instanceof Date ? le(n, t) : n) : Ne(e) ? {
2701
- ...e,
2702
- from: e.from ? z(e.from, t) : e.from,
2703
- to: e.to ? z(e.to, t) : e.to
2704
- } : Ve(e) ? {
2705
- before: le(e.before, t),
2706
- after: le(e.after, t)
2707
- } : Ze(e) ? {
2708
- after: le(e.after, t)
2709
- } : Ke(e) ? {
2710
- before: le(e.before, t)
2711
- } : e;
2712
- }
2713
- function $e(e, t, r) {
2714
- return e && (Array.isArray(e) ? e.map((n) => wt(n, t)) : wt(e, t));
2715
- }
2716
- function vs(e) {
2717
- let t = e;
2718
- const r = t.timeZone;
2719
- if (r && (t = {
2720
- ...e,
2721
- timeZone: r
2722
- }, t.today && (t.today = z(t.today, r)), t.month && (t.month = z(t.month, r)), t.defaultMonth && (t.defaultMonth = z(t.defaultMonth, r)), t.startMonth && (t.startMonth = z(t.startMonth, r)), t.endMonth && (t.endMonth = z(t.endMonth, r)), t.mode === "single" && t.selected ? t.selected = z(t.selected, r) : t.mode === "multiple" && t.selected ? t.selected = t.selected?.map((k) => z(k, r)) : t.mode === "range" && t.selected && (t.selected = {
2723
- from: t.selected.from ? z(t.selected.from, r) : t.selected.from,
2724
- to: t.selected.to ? z(t.selected.to, r) : t.selected.to
2725
- }), t.disabled !== void 0 && (t.disabled = $e(t.disabled, r)), t.hidden !== void 0 && (t.hidden = $e(t.hidden, r)), t.modifiers)) {
2726
- const k = {};
2727
- Object.keys(t.modifiers).forEach((Y) => {
2728
- k[Y] = $e(t.modifiers?.[Y], r);
2729
- }), t.modifiers = k;
2730
- }
2731
- const { components: n, formatters: o, labels: a, dateLib: i, locale: s, classNames: c } = be(() => {
2732
- const k = { ...Et, ...t.locale }, Y = t.broadcastCalendar ? 1 : t.weekStartsOn, w = t.noonSafe && t.timeZone ? es(t.timeZone, {
2733
- weekStartsOn: Y,
2734
- locale: k
2735
- }) : void 0, N = t.dateLib && w ? { ...w, ...t.dateLib } : t.dateLib ?? w, q = new G({
2736
- locale: k,
2737
- weekStartsOn: Y,
2738
- firstWeekContainsDate: t.firstWeekContainsDate,
2739
- useAdditionalWeekYearTokens: t.useAdditionalWeekYearTokens,
2740
- useAdditionalDayOfYearTokens: t.useAdditionalDayOfYearTokens,
2741
- timeZone: t.timeZone,
2742
- numerals: t.numerals
2743
- }, N);
2744
- return {
2745
- dateLib: q,
2746
- components: Eo(t.components),
2747
- formatters: Ro(t.formatters),
2748
- labels: Vo(t.labels, q.options),
2749
- locale: k,
2750
- classNames: { ...Fo(), ...t.classNames }
2751
- };
2752
- }, [
2753
- t.locale,
2754
- t.broadcastCalendar,
2755
- t.weekStartsOn,
2756
- t.firstWeekContainsDate,
2757
- t.useAdditionalWeekYearTokens,
2758
- t.useAdditionalDayOfYearTokens,
2759
- t.timeZone,
2760
- t.numerals,
2761
- t.dateLib,
2762
- t.noonSafe,
2763
- t.components,
2764
- t.formatters,
2765
- t.labels,
2766
- t.classNames
2767
- ]);
2768
- t.today || (t = { ...t, today: i.today() });
2769
- const { captionLayout: u, mode: f, navLayout: l, numberOfMonths: h = 1, onDayBlur: g, onDayClick: v, onDayFocus: C, onDayKeyDown: O, onDayMouseEnter: T, onDayMouseLeave: M, onNextClick: b, onPrevClick: D, showWeekNumber: p, styles: m } = t, { formatCaption: W, formatDay: E, formatMonthDropdown: H, formatWeekNumber: F, formatWeekNumberHeader: Z, formatWeekdayName: oe, formatYearDropdown: ee } = o, $ = hs(t, i), { days: ce, months: ve, navStart: Te, navEnd: xe, previousMonth: Q, nextMonth: X, goToMonth: te } = $, Pe = xo(ce, t, Te, xe, i), { isSelected: Ee, select: _e, selected: We } = Os(t, i) ?? {}, { blur: et, focused: tt, isFocusTarget: Zt, moveFocus: nt, setFocused: Se } = gs(t, $, Pe, Ee ?? (() => !1), i), { labelDayButton: Kt, labelGridcell: Jt, labelGrid: Lt, labelMonthDropdown: en, labelNav: rt, labelPrevious: tn, labelNext: nn, labelWeekday: rn, labelWeekNumber: on, labelWeekNumberHeader: sn, labelYearDropdown: an } = a, cn = be(() => Jo(i, t.ISOWeek, t.broadcastCalendar, t.today), [i, t.ISOWeek, t.broadcastCalendar, t.today]), ot = f !== void 0 || v !== void 0, Fe = R(() => {
2770
- Q && (te(Q), D?.(Q));
2771
- }, [Q, te, D]), Be = R(() => {
2772
- X && (te(X), b?.(X));
2773
- }, [te, X, b]), un = R((k, Y) => (w) => {
2774
- w.preventDefault(), w.stopPropagation(), Se(k), !Y.disabled && (_e?.(k.date, Y, w), v?.(k.date, Y, w));
2775
- }, [_e, v, Se]), ln = R((k, Y) => (w) => {
2776
- Se(k), C?.(k.date, Y, w);
2777
- }, [C, Se]), fn = R((k, Y) => (w) => {
2778
- et(), g?.(k.date, Y, w);
2779
- }, [et, g]), dn = R((k, Y) => (w) => {
2780
- const N = {
2781
- ArrowLeft: [
2782
- w.shiftKey ? "month" : "day",
2783
- t.dir === "rtl" ? "after" : "before"
2784
- ],
2785
- ArrowRight: [
2786
- w.shiftKey ? "month" : "day",
2787
- t.dir === "rtl" ? "before" : "after"
2788
- ],
2789
- ArrowDown: [w.shiftKey ? "year" : "week", "after"],
2790
- ArrowUp: [w.shiftKey ? "year" : "week", "before"],
2791
- PageUp: [w.shiftKey ? "year" : "month", "before"],
2792
- PageDown: [w.shiftKey ? "year" : "month", "after"],
2793
- Home: ["startOfWeek", "before"],
2794
- End: ["endOfWeek", "after"]
2795
- };
2796
- if (N[w.key]) {
2797
- w.preventDefault(), w.stopPropagation();
2798
- const [q, S] = N[w.key];
2799
- nt(q, S);
2800
- }
2801
- O?.(k.date, Y, w);
2802
- }, [nt, O, t.dir]), hn = R((k, Y) => (w) => {
2803
- T?.(k.date, Y, w);
2804
- }, [T]), mn = R((k, Y) => (w) => {
2805
- M?.(k.date, Y, w);
2806
- }, [M]), yn = R((k) => (Y) => {
2807
- const w = Number(Y.target.value), N = i.setMonth(i.startOfMonth(k), w);
2808
- te(N);
2809
- }, [i, te]), gn = R((k) => (Y) => {
2810
- const w = Number(Y.target.value), N = i.setYear(i.startOfMonth(k), w);
2811
- te(N);
2812
- }, [i, te]), { className: pn, style: bn } = be(() => ({
2813
- className: [c[y.Root], t.className].filter(Boolean).join(" "),
2814
- style: { ...m?.[y.Root], ...t.style }
2815
- }), [c, t.className, t.style, m]), wn = _o(t), st = Ce(null);
2816
- os(st, !!t.animate, {
2817
- classNames: c,
2818
- months: ve,
2819
- focused: tt,
2820
- dateLib: i
2821
- });
2822
- const Mn = {
2823
- dayPickerProps: t,
2824
- selected: We,
2825
- select: _e,
2826
- isSelected: Ee,
2827
- months: ve,
2828
- nextMonth: X,
2829
- previousMonth: Q,
2830
- goToMonth: te,
2831
- getModifiers: Pe,
2832
- components: n,
2833
- classNames: c,
2834
- styles: m,
2835
- labels: a,
2836
- formatters: o
2837
- };
2838
- return d.createElement(
2839
- Ft.Provider,
2840
- { value: Mn },
2841
- d.createElement(
2842
- n.Root,
2843
- { rootRef: t.animate ? st : void 0, className: pn, style: bn, dir: t.dir, id: t.id, lang: t.lang ?? s.code, nonce: t.nonce, title: t.title, role: t.role, "aria-label": t["aria-label"], "aria-labelledby": t["aria-labelledby"], ...wn },
2844
- d.createElement(
2845
- n.Months,
2846
- { className: c[y.Months], style: m?.[y.Months] },
2847
- !t.hideNavigation && !l && d.createElement(n.Nav, { "data-animated-nav": t.animate ? "true" : void 0, className: c[y.Nav], style: m?.[y.Nav], "aria-label": rt(), onPreviousClick: Fe, onNextClick: Be, previousMonth: Q, nextMonth: X }),
2848
- ve.map((k, Y) => d.createElement(
2849
- n.Month,
2850
- {
2851
- "data-animated-month": t.animate ? "true" : void 0,
2852
- className: c[y.Month],
2853
- style: m?.[y.Month],
2854
- // biome-ignore lint/suspicious/noArrayIndexKey: breaks animation
2855
- key: Y,
2856
- displayIndex: Y,
2857
- calendarMonth: k
2858
- },
2859
- l === "around" && !t.hideNavigation && Y === 0 && d.createElement(
2860
- n.PreviousMonthButton,
2861
- { type: "button", className: c[y.PreviousMonthButton], tabIndex: Q ? void 0 : -1, "aria-disabled": Q ? void 0 : !0, "aria-label": tn(Q), onClick: Fe, "data-animated-button": t.animate ? "true" : void 0 },
2862
- d.createElement(n.Chevron, { disabled: Q ? void 0 : !0, className: c[y.Chevron], orientation: t.dir === "rtl" ? "right" : "left" })
2863
- ),
2864
- d.createElement(n.MonthCaption, { "data-animated-caption": t.animate ? "true" : void 0, className: c[y.MonthCaption], style: m?.[y.MonthCaption], calendarMonth: k, displayIndex: Y }, u?.startsWith("dropdown") ? d.createElement(
2865
- n.DropdownNav,
2866
- { className: c[y.Dropdowns], style: m?.[y.Dropdowns] },
2867
- (() => {
2868
- const w = u === "dropdown" || u === "dropdown-months" ? d.createElement(n.MonthsDropdown, { key: "month", className: c[y.MonthsDropdown], "aria-label": en(), classNames: c, components: n, disabled: !!t.disableNavigation, onChange: yn(k.date), options: Zo(k.date, Te, xe, o, i), style: m?.[y.Dropdown], value: i.getMonth(k.date) }) : d.createElement("span", { key: "month" }, H(k.date, i)), N = u === "dropdown" || u === "dropdown-years" ? d.createElement(n.YearsDropdown, { key: "year", className: c[y.YearsDropdown], "aria-label": an(i.options), classNames: c, components: n, disabled: !!t.disableNavigation, onChange: gn(k.date), options: Lo(Te, xe, o, i, !!t.reverseYears), style: m?.[y.Dropdown], value: i.getYear(k.date) }) : d.createElement("span", { key: "year" }, ee(k.date, i));
2869
- return i.getMonthYearOrder() === "year-first" ? [N, w] : [w, N];
2870
- })(),
2871
- d.createElement("span", { role: "status", "aria-live": "polite", style: {
2872
- border: 0,
2873
- clip: "rect(0 0 0 0)",
2874
- height: "1px",
2875
- margin: "-1px",
2876
- overflow: "hidden",
2877
- padding: 0,
2878
- position: "absolute",
2879
- width: "1px",
2880
- whiteSpace: "nowrap",
2881
- wordWrap: "normal"
2882
- } }, W(k.date, i.options, i))
2883
- ) : d.createElement(n.CaptionLabel, { className: c[y.CaptionLabel], role: "status", "aria-live": "polite" }, W(k.date, i.options, i))),
2884
- l === "around" && !t.hideNavigation && Y === h - 1 && d.createElement(
2885
- n.NextMonthButton,
2886
- { type: "button", className: c[y.NextMonthButton], tabIndex: X ? void 0 : -1, "aria-disabled": X ? void 0 : !0, "aria-label": nn(X), onClick: Be, "data-animated-button": t.animate ? "true" : void 0 },
2887
- d.createElement(n.Chevron, { disabled: X ? void 0 : !0, className: c[y.Chevron], orientation: t.dir === "rtl" ? "left" : "right" })
2888
- ),
2889
- Y === h - 1 && l === "after" && !t.hideNavigation && d.createElement(n.Nav, { "data-animated-nav": t.animate ? "true" : void 0, className: c[y.Nav], style: m?.[y.Nav], "aria-label": rt(), onPreviousClick: Fe, onNextClick: Be, previousMonth: Q, nextMonth: X }),
2890
- d.createElement(
2891
- n.MonthGrid,
2892
- { role: "grid", "aria-multiselectable": f === "multiple" || f === "range", "aria-label": Lt(k.date, i.options, i) || void 0, className: c[y.MonthGrid], style: m?.[y.MonthGrid] },
2893
- !t.hideWeekdays && d.createElement(
2894
- n.Weekdays,
2895
- { "data-animated-weekdays": t.animate ? "true" : void 0, className: c[y.Weekdays], style: m?.[y.Weekdays] },
2896
- p && d.createElement(n.WeekNumberHeader, { "aria-label": sn(i.options), className: c[y.WeekNumberHeader], style: m?.[y.WeekNumberHeader], scope: "col" }, Z()),
2897
- cn.map((w) => d.createElement(n.Weekday, { "aria-label": rn(w, i.options, i), className: c[y.Weekday], key: String(w), style: m?.[y.Weekday], scope: "col" }, oe(w, i.options, i)))
2898
- ),
2899
- d.createElement(n.Weeks, { "data-animated-weeks": t.animate ? "true" : void 0, className: c[y.Weeks], style: m?.[y.Weeks] }, k.weeks.map((w) => d.createElement(
2900
- n.Week,
2901
- { className: c[y.Week], key: w.weekNumber, style: m?.[y.Week], week: w },
2902
- p && d.createElement(n.WeekNumber, { week: w, style: m?.[y.WeekNumber], "aria-label": on(w.weekNumber, {
2903
- locale: s
2904
- }), className: c[y.WeekNumber], scope: "row", role: "rowheader" }, F(w.weekNumber, i)),
2905
- w.days.map((N) => {
2906
- const { date: q } = N, S = Pe(N);
2907
- if (S[_.focused] = !S.hidden && !!tt?.isEqualTo(N), S[V.selected] = Ee?.(q) || S.selected, Ne(We)) {
2908
- const { from: Ie, to: He } = We;
2909
- S[V.range_start] = !!(Ie && He && i.isSameDay(q, Ie)), S[V.range_end] = !!(Ie && He && i.isSameDay(q, He)), S[V.range_middle] = ne(We, q, !0, i);
2910
- }
2911
- const Dn = Ko(S, m, t.modifiersStyles), kn = Po(S, c, t.modifiersClassNames), On = !ot && !S.hidden ? Jt(q, S, i.options, i) : void 0;
2912
- return d.createElement(n.Day, { key: `${N.isoDate}_${N.displayMonthId}`, day: N, modifiers: S, className: kn.join(" "), style: Dn, role: "gridcell", "aria-selected": S.selected || void 0, "aria-label": On, "data-day": N.isoDate, "data-month": N.outside ? N.dateMonthId : void 0, "data-selected": S.selected || void 0, "data-disabled": S.disabled || void 0, "data-hidden": S.hidden || void 0, "data-outside": N.outside || void 0, "data-focused": S.focused || void 0, "data-today": S.today || void 0 }, !S.hidden && ot ? d.createElement(n.DayButton, { className: c[y.DayButton], style: m?.[y.DayButton], type: "button", day: N, modifiers: S, disabled: !S.focused && S.disabled || void 0, "aria-disabled": S.focused && S.disabled || void 0, tabIndex: Zt(N) ? 0 : -1, "aria-label": Kt(q, S, i.options, i), onClick: un(N, S), onBlur: fn(N, S), onFocus: ln(N, S), onKeyDown: dn(N, S), onMouseEnter: hn(N, S), onMouseLeave: mn(N, S) }, E(q, i.options, i)) : !S.hidden && E(N.date, i.options, i));
2913
- })
2914
- )))
2915
- )
2916
- ))
2917
- ),
2918
- t.footer && d.createElement(n.Footer, { className: c[y.Footer], style: m?.[y.Footer], role: "status", "aria-live": "polite" }, t.footer)
2919
- )
2920
- );
2921
- }
2922
- const Ws = ({ classNames: e, disabled: t, disablePastDates: r = !0, fixedWeeks: n, locale: o, showOutsideDays: a = !0, ...i }) => {
2923
- const s = be(() => /* @__PURE__ */ new Date(), []), c = [...r ? [{ before: s }] : [], ...Array.isArray(t) ? t : t ? [t] : []];
2924
- return /* @__PURE__ */ at(
2925
- vs,
2926
- {
2927
- ...i,
2928
- classNames: {
2929
- months: B("months relative flex"),
2930
- month: B("month"),
2931
- caption: B("calendar-header"),
2932
- caption_label: B("month-title"),
2933
- nav: B("rdp-nav w-full flex items-center"),
2934
- nav_button: B("nav-button h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent"),
2935
- button_previous: B("nav-prev absolute left-1 top-0"),
2936
- button_next: B("nav-next absolute right-1 top-0"),
2937
- table: B("table w-full border-collapse space-y-1"),
2938
- head_row: B("day-head-row flex"),
2939
- head_cell: B("days-of-week"),
2940
- row: B("day-row flex w-full mt-2"),
2941
- cell: B("day-cell"),
2942
- day: B("day"),
2943
- day_range_start: B("day-range-start"),
2944
- day_range_middle: B("day-range-middle"),
2945
- day_range_end: B("day-range-end"),
2946
- day_selected: B("day-selected"),
2947
- day_outside: B("day-outside"),
2948
- day_disabled: B("day-disabled"),
2949
- hidden: B("hidden"),
2950
- ...e
2951
- },
2952
- components: {
2953
- Chevron: ({ orientation: u }) => /* @__PURE__ */ at(vn, { "aria-hidden": "true", className: B("size-4", u === "left" && "rotate-90", u === "right" && "-rotate-90") })
2954
- },
2955
- "data-slot": "calendar",
2956
- "data-testid": "spectral-calendar",
2957
- disabled: c.length > 0 ? c : void 0,
2958
- fixedWeeks: n,
2959
- locale: o,
2960
- showOutsideDays: a
2961
- }
2962
- );
2963
- };
2964
- Ws.displayName = "Calendar";
2965
- export {
2966
- Ws as Calendar
2967
- };
1
+ import { t as e } from "../Calendar-s4lyijkn.js";
2
+ export { e as Calendar };