@alto-avios/alto-ui 5.0.0-alpha.9 → 5.0.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.
- package/dist/Calendar-CeNON3JV.js +1374 -0
- package/dist/Calendar-CeNON3JV.js.map +1 -0
- package/dist/{IconButton.module-DcZ9ROrD.js → IconButton.module-4obqG6tY.js} +6 -5
- package/dist/{IconButton.module-DcZ9ROrD.js.map → IconButton.module-4obqG6tY.js.map} +1 -1
- package/dist/assets/AviosCurrency.css +1 -1
- package/dist/assets/AviosCurrencyBadge.css +1 -1
- package/dist/assets/Button.css +1 -1
- package/dist/assets/Calendar.css +1 -0
- package/dist/assets/CalloutBanner.css +1 -1
- package/dist/assets/Checkbox.css +1 -1
- package/dist/assets/ComboBox.css +1 -1
- package/dist/assets/DateField.css +1 -1
- package/dist/assets/DatePicker.css +1 -0
- package/dist/assets/DestinationHeading.css +1 -1
- package/dist/assets/DetailsDisclosure.css +1 -1
- package/dist/assets/Icon.css +1 -1
- package/dist/assets/Input.css +1 -0
- package/dist/assets/MonthYearField.css +1 -1
- package/dist/assets/PhoneNumberField.css +1 -1
- package/dist/assets/Radio.css +1 -1
- package/dist/assets/Section.css +1 -1
- package/dist/assets/SelectCard.css +1 -1
- package/dist/assets/SelectNative.css +1 -1
- package/dist/assets/Switch.css +1 -1
- package/dist/assets/Tooltip.css +1 -1
- package/dist/assets/VisuallyHidden.css +1 -0
- package/dist/assets/input2.css +1 -0
- package/dist/assets/padding.css +1 -1
- package/dist/components/Accordion/Accordion.js +1 -1
- package/dist/components/AviosCurrency/AviosCurrency.js +22 -22
- package/dist/components/AviosCurrencyBadge/AviosCurrencyBadge.js +16 -16
- package/dist/components/AviosCurrencySymbol/AviosCurrencySymbol.d.ts +2 -1
- package/dist/components/AviosCurrencySymbol/AviosCurrencySymbol.js +2 -3
- package/dist/components/AviosCurrencySymbol/AviosCurrencySymbol.js.map +1 -1
- package/dist/components/Box/Box.d.ts +3 -3
- package/dist/components/Box/Box.js +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +3 -3
- package/dist/components/Button/Button.js +36 -38
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Calendar/Calendar.d.ts +100 -0
- package/dist/components/Calendar/Calendar.js +17 -0
- package/dist/components/Calendar/Calendar.js.map +1 -0
- package/dist/components/Calendar/index.d.ts +2 -0
- package/dist/components/Calendar/index.js +5 -0
- package/dist/components/Calendar/index.js.map +1 -0
- package/dist/components/CalloutBanner/CalloutBanner.d.ts +23 -1
- package/dist/components/CalloutBanner/CalloutBanner.js +55 -37
- package/dist/components/CalloutBanner/CalloutBanner.js.map +1 -1
- package/dist/components/Carousel/AutoplayControl/AutoplayControl.js +1 -1
- package/dist/components/Carousel/Carousel.js +3 -3
- package/dist/components/Carousel/CarouselButton/CarouselButton.js +15 -14
- package/dist/components/Carousel/CarouselButton/CarouselButton.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.js +9 -9
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +5 -1
- package/dist/components/CheckboxGroup/CheckboxGroup.js +8 -5
- package/dist/components/CheckboxGroup/CheckboxGroup.js.map +1 -1
- package/dist/components/ComboBox/ComboBox.js +6 -6
- package/dist/components/ComboBox/index.d.ts +1 -0
- package/dist/components/CreditCardNumberField/CreditCardNumberField.js +1 -1
- package/dist/components/CreditCardSecurityCodeField/CreditCardSecurityCodeField.js +1 -1
- package/dist/components/DateField/DateField.d.ts +29 -13
- package/dist/components/DateField/DateField.js +46 -853
- package/dist/components/DateField/DateField.js.map +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +64 -0
- package/dist/components/DatePicker/DatePicker.js +688 -0
- package/dist/components/DatePicker/DatePicker.js.map +1 -0
- package/dist/components/DatePicker/DatePickerContext.d.ts +10 -0
- package/dist/components/DatePicker/DatePickerContext.js +10 -0
- package/dist/components/DatePicker/DatePickerContext.js.map +1 -0
- package/dist/components/DatePicker/index.d.ts +2 -0
- package/dist/components/DatePicker/index.js +5 -0
- package/dist/components/DatePicker/index.js.map +1 -0
- package/dist/components/DestinationHeading/DestinationHeading.js +1 -1
- package/dist/components/DetailsDisclosure/DetailsDisclosure.js +4 -4
- package/dist/components/FieldHeader/FieldHeader.d.ts +5 -1
- package/dist/components/FieldHeader/FieldHeader.js +5 -2
- package/dist/components/FieldHeader/FieldHeader.js.map +1 -1
- package/dist/components/Grid/Grid.d.ts +3 -3
- package/dist/components/Heading/Heading.js +3 -3
- package/dist/components/Icon/Icon.d.ts +3 -7
- package/dist/components/Icon/Icon.js +602 -38
- package/dist/components/Icon/Icon.js.map +1 -1
- package/dist/components/Label/Label.js +3 -3
- package/dist/components/Menu/Menu.d.ts +2 -2
- package/dist/components/Menu/Menu.js +18 -16
- package/dist/components/Menu/Menu.js.map +1 -1
- package/dist/components/MonthYearField/MonthYearField.js +4 -4
- package/dist/components/NumberField/NumberField.d.ts +23 -10
- package/dist/components/NumberField/NumberField.js +636 -24
- package/dist/components/NumberField/NumberField.js.map +1 -1
- package/dist/components/PhoneNumberField/PhoneNumberField.js +5 -5
- package/dist/components/Popover/Popover.js +1 -1
- package/dist/components/Radio/Radio.js +3 -3
- package/dist/components/RadioGroup/RadioGroup.d.ts +2 -1
- package/dist/components/RadioGroup/RadioGroup.js +6 -4
- package/dist/components/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/components/Section/Section.d.ts +3 -3
- package/dist/components/Section/Section.js +27 -31
- package/dist/components/Section/Section.js.map +1 -1
- package/dist/components/SelectCard/SelectCard.d.ts +9 -10
- package/dist/components/SelectCard/SelectCard.js +27 -33
- package/dist/components/SelectCard/SelectCard.js.map +1 -1
- package/dist/components/SelectNative/SelectNative.d.ts +7 -2
- package/dist/components/SelectNative/SelectNative.js +18 -12
- package/dist/components/SelectNative/SelectNative.js.map +1 -1
- package/dist/components/SelectNative/index.js +2 -2
- package/dist/components/Spacer/Spacer.d.ts +2 -2
- package/dist/components/SubHeading/SubHeading.js +3 -3
- package/dist/components/Switch/Switch.js +2 -2
- package/dist/components/Tag/Tag.js +1 -1
- package/dist/components/TextField/TextField.d.ts +18 -15
- package/dist/components/TextField/TextField.js +45 -22
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/components/ToggleButton/ToggleButton.d.ts +2 -2
- package/dist/components/Tooltip/Tooltip.js +1 -1
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +6 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.js +14 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.js.map +1 -0
- package/dist/components/VisuallyHidden/index.d.ts +2 -0
- package/dist/components/VisuallyHidden/index.js +5 -0
- package/dist/components/VisuallyHidden/index.js.map +1 -0
- package/dist/components/_base/Input/Input.d.ts +137 -0
- package/dist/components/_base/Input/Input.js +536 -0
- package/dist/components/_base/Input/Input.js.map +1 -0
- package/dist/components/_base/Input/index.d.ts +2 -0
- package/dist/components/_base/Input/index.js +5 -0
- package/dist/components/_base/Input/index.js.map +1 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.js +12 -6
- package/dist/components/index.js.map +1 -1
- package/dist/date-CwXoZhJO.js +1149 -0
- package/dist/date-CwXoZhJO.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +16 -6
- package/dist/index.js.map +1 -1
- package/dist/input-BtuJi6lQ.js +111 -0
- package/dist/input-BtuJi6lQ.js.map +1 -0
- package/dist/padding-D5iL16t7.js +844 -0
- package/dist/{padding-y3qc0cvJ.js.map → padding-D5iL16t7.js.map} +1 -1
- package/dist/{react-number-format.es-Dbc1db6s.js → react-number-format.es-DXPULhrt.js} +2 -2
- package/dist/{react-number-format.es-Dbc1db6s.js.map → react-number-format.es-DXPULhrt.js.map} +1 -1
- package/dist/useControlledState-BPR3PrW4.js +41 -0
- package/dist/useControlledState-BPR3PrW4.js.map +1 -0
- package/dist/useFormValidationState-Bu2HgCF9.js +140 -0
- package/dist/useFormValidationState-Bu2HgCF9.js.map +1 -0
- package/dist/utils/border/border.d.ts +2 -2
- package/dist/utils/date/date.d.ts +5 -0
- package/dist/utils/date/date.js +5 -0
- package/dist/utils/date/date.js.map +1 -0
- package/dist/utils/flex/flex.d.ts +4 -4
- package/dist/utils/forms/input/input.d.ts +6 -0
- package/dist/utils/forms/input/input.js +6 -0
- package/dist/utils/forms/input/input.js.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +7 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/padding/padding.d.ts +7 -7
- package/dist/utils/padding/padding.js +1 -1
- package/dist/utils/phoneNumber/phoneNumber.d.ts +5 -10
- package/dist/utils/position/position.d.ts +1 -1
- package/dist/utils/stories/DraggableContainer.js +15 -5
- package/dist/utils/stories/DraggableContainer.js.map +1 -1
- package/dist/utils/stories/SliderWithMultipleNumberFields.d.ts +3 -0
- package/dist/utils/stories/SliderWithMultipleNumberFields.js +193 -0
- package/dist/utils/stories/SliderWithMultipleNumberFields.js.map +1 -0
- package/dist/utils/stories/iconPropsArgTypes.js +4 -3
- package/dist/utils/stories/iconPropsArgTypes.js.map +1 -1
- package/dist/utils/stories/inputControls.d.ts +190 -0
- package/dist/utils/stories/inputControls.js +140 -0
- package/dist/utils/stories/inputControls.js.map +1 -0
- package/dist/utils/truncate/truncate.d.ts +6 -0
- package/dist/utils/truncate/truncate.js +11 -0
- package/dist/utils/truncate/truncate.js.map +1 -0
- package/package.json +15 -12
- package/dist/assets/NumberField.css +0 -1
- package/dist/assets/TextField.css +0 -1
- package/dist/padding-y3qc0cvJ.js +0 -795
|
@@ -0,0 +1,1374 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import React__default, { useMemo, useState, createContext, forwardRef, useContext } from "react";
|
|
3
|
+
import { $ as $3b62074eb05584b2$export$80ee6245ec4f29ec, a as $35ea8db9cb2ccb90$export$99faa760c7908e4f, b as $3b62074eb05584b2$export$c36e0ecb2d4fa69d, c as $3b62074eb05584b2$export$4475b7e617eb123c, d as $2b4dce13dd5a17fa$export$842a2cf37af977e1, e as $3b62074eb05584b2$export$f297eb839006d339, f as $3b62074eb05584b2$export$553d7fa8e3805fc0, g as $14e0f24ef4ac5c92$export$a75f2bff57811055, h as $11d87f3f76e88657$export$93522d1a439f3617, i as $14e0f24ef4ac5c92$export$5c333a116e949cdd, j as $14e0f24ef4ac5c92$export$f91e89d3d0406102, k as $14e0f24ef4ac5c92$export$a5a3b454ada2268e, l as $14e0f24ef4ac5c92$export$42c81a444fbfb5d4, m as $11d87f3f76e88657$export$b4a036af3fc0b032, n as $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3, o as $14e0f24ef4ac5c92$export$dbc69fd56b53d5e, q as $14e0f24ef4ac5c92$export$2061056d06d7cdf7, r as $14e0f24ef4ac5c92$export$ea39ec197993aef0, s as $14e0f24ef4ac5c92$export$ef8b6d9133084f4e, t as $14e0f24ef4ac5c92$export$a2258d9c4118825c, p as parseDateValue, u as $14e0f24ef4ac5c92$export$629b0a497aa65267, v as $14e0f24ef4ac5c92$export$aa8b41735afcabd2 } from "./date-CwXoZhJO.js";
|
|
4
|
+
import { useLocale, useDateFormatter } from "@react-aria/i18n";
|
|
5
|
+
import { useCalendarGrid, useCalendar, useCalendarCell } from "@react-aria/calendar";
|
|
6
|
+
import { IconButton } from "./components/IconButton/IconButton.js";
|
|
7
|
+
import { Heading } from "./components/Heading/Heading.js";
|
|
8
|
+
import { useDatePickerContext } from "./components/DatePicker/DatePickerContext.js";
|
|
9
|
+
import { Box } from "./components/Box/Box.js";
|
|
10
|
+
import { $ as $458b0a5536c1a7cf$export$40bfa8c7b0832715 } from "./useControlledState-BPR3PrW4.js";
|
|
11
|
+
import './assets/Calendar.css';const $62225008020f0a13$var$ERA_START_DATES = [
|
|
12
|
+
[
|
|
13
|
+
1868,
|
|
14
|
+
9,
|
|
15
|
+
8
|
|
16
|
+
],
|
|
17
|
+
[
|
|
18
|
+
1912,
|
|
19
|
+
7,
|
|
20
|
+
30
|
|
21
|
+
],
|
|
22
|
+
[
|
|
23
|
+
1926,
|
|
24
|
+
12,
|
|
25
|
+
25
|
|
26
|
+
],
|
|
27
|
+
[
|
|
28
|
+
1989,
|
|
29
|
+
1,
|
|
30
|
+
8
|
|
31
|
+
],
|
|
32
|
+
[
|
|
33
|
+
2019,
|
|
34
|
+
5,
|
|
35
|
+
1
|
|
36
|
+
]
|
|
37
|
+
];
|
|
38
|
+
const $62225008020f0a13$var$ERA_END_DATES = [
|
|
39
|
+
[
|
|
40
|
+
1912,
|
|
41
|
+
7,
|
|
42
|
+
29
|
|
43
|
+
],
|
|
44
|
+
[
|
|
45
|
+
1926,
|
|
46
|
+
12,
|
|
47
|
+
24
|
|
48
|
+
],
|
|
49
|
+
[
|
|
50
|
+
1989,
|
|
51
|
+
1,
|
|
52
|
+
7
|
|
53
|
+
],
|
|
54
|
+
[
|
|
55
|
+
2019,
|
|
56
|
+
4,
|
|
57
|
+
30
|
|
58
|
+
]
|
|
59
|
+
];
|
|
60
|
+
const $62225008020f0a13$var$ERA_ADDENDS = [
|
|
61
|
+
1867,
|
|
62
|
+
1911,
|
|
63
|
+
1925,
|
|
64
|
+
1988,
|
|
65
|
+
2018
|
|
66
|
+
];
|
|
67
|
+
const $62225008020f0a13$var$ERA_NAMES = [
|
|
68
|
+
"meiji",
|
|
69
|
+
"taisho",
|
|
70
|
+
"showa",
|
|
71
|
+
"heisei",
|
|
72
|
+
"reiwa"
|
|
73
|
+
];
|
|
74
|
+
function $62225008020f0a13$var$findEraFromGregorianDate(date) {
|
|
75
|
+
const idx = $62225008020f0a13$var$ERA_START_DATES.findIndex(([year, month, day]) => {
|
|
76
|
+
if (date.year < year) return true;
|
|
77
|
+
if (date.year === year && date.month < month) return true;
|
|
78
|
+
if (date.year === year && date.month === month && date.day < day) return true;
|
|
79
|
+
return false;
|
|
80
|
+
});
|
|
81
|
+
if (idx === -1) return $62225008020f0a13$var$ERA_START_DATES.length - 1;
|
|
82
|
+
if (idx === 0) return 0;
|
|
83
|
+
return idx - 1;
|
|
84
|
+
}
|
|
85
|
+
function $62225008020f0a13$var$toGregorian(date) {
|
|
86
|
+
let eraAddend = $62225008020f0a13$var$ERA_ADDENDS[$62225008020f0a13$var$ERA_NAMES.indexOf(date.era)];
|
|
87
|
+
if (!eraAddend) throw new Error("Unknown era: " + date.era);
|
|
88
|
+
return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(date.year + eraAddend, date.month, date.day);
|
|
89
|
+
}
|
|
90
|
+
class $62225008020f0a13$export$b746ab2b60cdffbf extends $3b62074eb05584b2$export$80ee6245ec4f29ec {
|
|
91
|
+
fromJulianDay(jd) {
|
|
92
|
+
let date = super.fromJulianDay(jd);
|
|
93
|
+
let era = $62225008020f0a13$var$findEraFromGregorianDate(date);
|
|
94
|
+
return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, $62225008020f0a13$var$ERA_NAMES[era], date.year - $62225008020f0a13$var$ERA_ADDENDS[era], date.month, date.day);
|
|
95
|
+
}
|
|
96
|
+
toJulianDay(date) {
|
|
97
|
+
return super.toJulianDay($62225008020f0a13$var$toGregorian(date));
|
|
98
|
+
}
|
|
99
|
+
balanceDate(date) {
|
|
100
|
+
let gregorianDate = $62225008020f0a13$var$toGregorian(date);
|
|
101
|
+
let era = $62225008020f0a13$var$findEraFromGregorianDate(gregorianDate);
|
|
102
|
+
if ($62225008020f0a13$var$ERA_NAMES[era] !== date.era) {
|
|
103
|
+
date.era = $62225008020f0a13$var$ERA_NAMES[era];
|
|
104
|
+
date.year = gregorianDate.year - $62225008020f0a13$var$ERA_ADDENDS[era];
|
|
105
|
+
}
|
|
106
|
+
this.constrainDate(date);
|
|
107
|
+
}
|
|
108
|
+
constrainDate(date) {
|
|
109
|
+
let idx = $62225008020f0a13$var$ERA_NAMES.indexOf(date.era);
|
|
110
|
+
let end = $62225008020f0a13$var$ERA_END_DATES[idx];
|
|
111
|
+
if (end != null) {
|
|
112
|
+
let [endYear, endMonth, endDay] = end;
|
|
113
|
+
let maxYear = endYear - $62225008020f0a13$var$ERA_ADDENDS[idx];
|
|
114
|
+
date.year = Math.max(1, Math.min(maxYear, date.year));
|
|
115
|
+
if (date.year === maxYear) {
|
|
116
|
+
date.month = Math.min(endMonth, date.month);
|
|
117
|
+
if (date.month === endMonth) date.day = Math.min(endDay, date.day);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (date.year === 1 && idx >= 0) {
|
|
121
|
+
let [, startMonth, startDay] = $62225008020f0a13$var$ERA_START_DATES[idx];
|
|
122
|
+
date.month = Math.max(startMonth, date.month);
|
|
123
|
+
if (date.month === startMonth) date.day = Math.max(startDay, date.day);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
getEras() {
|
|
127
|
+
return $62225008020f0a13$var$ERA_NAMES;
|
|
128
|
+
}
|
|
129
|
+
getYearsInEra(date) {
|
|
130
|
+
let era = $62225008020f0a13$var$ERA_NAMES.indexOf(date.era);
|
|
131
|
+
let cur = $62225008020f0a13$var$ERA_START_DATES[era];
|
|
132
|
+
let next = $62225008020f0a13$var$ERA_START_DATES[era + 1];
|
|
133
|
+
if (next == null)
|
|
134
|
+
return 9999 - cur[0] + 1;
|
|
135
|
+
let years = next[0] - cur[0];
|
|
136
|
+
if (date.month < next[1] || date.month === next[1] && date.day < next[2]) years++;
|
|
137
|
+
return years;
|
|
138
|
+
}
|
|
139
|
+
getDaysInMonth(date) {
|
|
140
|
+
return super.getDaysInMonth($62225008020f0a13$var$toGregorian(date));
|
|
141
|
+
}
|
|
142
|
+
getMinimumMonthInYear(date) {
|
|
143
|
+
let start = $62225008020f0a13$var$getMinimums(date);
|
|
144
|
+
return start ? start[1] : 1;
|
|
145
|
+
}
|
|
146
|
+
getMinimumDayInMonth(date) {
|
|
147
|
+
let start = $62225008020f0a13$var$getMinimums(date);
|
|
148
|
+
return start && date.month === start[1] ? start[2] : 1;
|
|
149
|
+
}
|
|
150
|
+
constructor(...args) {
|
|
151
|
+
super(...args), this.identifier = "japanese";
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
function $62225008020f0a13$var$getMinimums(date) {
|
|
155
|
+
if (date.year === 1) {
|
|
156
|
+
let idx = $62225008020f0a13$var$ERA_NAMES.indexOf(date.era);
|
|
157
|
+
return $62225008020f0a13$var$ERA_START_DATES[idx];
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
const $8d73d47422ca7302$var$BUDDHIST_ERA_START = -543;
|
|
161
|
+
class $8d73d47422ca7302$export$42d20a78301dee44 extends $3b62074eb05584b2$export$80ee6245ec4f29ec {
|
|
162
|
+
fromJulianDay(jd) {
|
|
163
|
+
let gregorianDate = super.fromJulianDay(jd);
|
|
164
|
+
let year = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(gregorianDate.era, gregorianDate.year);
|
|
165
|
+
return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, year - $8d73d47422ca7302$var$BUDDHIST_ERA_START, gregorianDate.month, gregorianDate.day);
|
|
166
|
+
}
|
|
167
|
+
toJulianDay(date) {
|
|
168
|
+
return super.toJulianDay($8d73d47422ca7302$var$toGregorian(date));
|
|
169
|
+
}
|
|
170
|
+
getEras() {
|
|
171
|
+
return [
|
|
172
|
+
"BE"
|
|
173
|
+
];
|
|
174
|
+
}
|
|
175
|
+
getDaysInMonth(date) {
|
|
176
|
+
return super.getDaysInMonth($8d73d47422ca7302$var$toGregorian(date));
|
|
177
|
+
}
|
|
178
|
+
balanceDate() {
|
|
179
|
+
}
|
|
180
|
+
constructor(...args) {
|
|
181
|
+
super(...args), this.identifier = "buddhist";
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
function $8d73d47422ca7302$var$toGregorian(date) {
|
|
185
|
+
let [era, year] = $3b62074eb05584b2$export$4475b7e617eb123c(date.year + $8d73d47422ca7302$var$BUDDHIST_ERA_START);
|
|
186
|
+
return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(era, year, date.month, date.day);
|
|
187
|
+
}
|
|
188
|
+
const $5f31bd6f0c8940b2$var$TAIWAN_ERA_START = 1911;
|
|
189
|
+
function $5f31bd6f0c8940b2$var$gregorianYear(date) {
|
|
190
|
+
return date.era === "minguo" ? date.year + $5f31bd6f0c8940b2$var$TAIWAN_ERA_START : 1 - date.year + $5f31bd6f0c8940b2$var$TAIWAN_ERA_START;
|
|
191
|
+
}
|
|
192
|
+
function $5f31bd6f0c8940b2$var$gregorianToTaiwan(year) {
|
|
193
|
+
let y = year - $5f31bd6f0c8940b2$var$TAIWAN_ERA_START;
|
|
194
|
+
if (y > 0) return [
|
|
195
|
+
"minguo",
|
|
196
|
+
y
|
|
197
|
+
];
|
|
198
|
+
else return [
|
|
199
|
+
"before_minguo",
|
|
200
|
+
1 - y
|
|
201
|
+
];
|
|
202
|
+
}
|
|
203
|
+
class $5f31bd6f0c8940b2$export$65e01080afcb0799 extends $3b62074eb05584b2$export$80ee6245ec4f29ec {
|
|
204
|
+
fromJulianDay(jd) {
|
|
205
|
+
let date = super.fromJulianDay(jd);
|
|
206
|
+
let extendedYear = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(date.era, date.year);
|
|
207
|
+
let [era, year] = $5f31bd6f0c8940b2$var$gregorianToTaiwan(extendedYear);
|
|
208
|
+
return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, era, year, date.month, date.day);
|
|
209
|
+
}
|
|
210
|
+
toJulianDay(date) {
|
|
211
|
+
return super.toJulianDay($5f31bd6f0c8940b2$var$toGregorian(date));
|
|
212
|
+
}
|
|
213
|
+
getEras() {
|
|
214
|
+
return [
|
|
215
|
+
"before_minguo",
|
|
216
|
+
"minguo"
|
|
217
|
+
];
|
|
218
|
+
}
|
|
219
|
+
balanceDate(date) {
|
|
220
|
+
let [era, year] = $5f31bd6f0c8940b2$var$gregorianToTaiwan($5f31bd6f0c8940b2$var$gregorianYear(date));
|
|
221
|
+
date.era = era;
|
|
222
|
+
date.year = year;
|
|
223
|
+
}
|
|
224
|
+
isInverseEra(date) {
|
|
225
|
+
return date.era === "before_minguo";
|
|
226
|
+
}
|
|
227
|
+
getDaysInMonth(date) {
|
|
228
|
+
return super.getDaysInMonth($5f31bd6f0c8940b2$var$toGregorian(date));
|
|
229
|
+
}
|
|
230
|
+
getYearsInEra(date) {
|
|
231
|
+
return date.era === "before_minguo" ? 9999 : 9999 - $5f31bd6f0c8940b2$var$TAIWAN_ERA_START;
|
|
232
|
+
}
|
|
233
|
+
constructor(...args) {
|
|
234
|
+
super(...args), this.identifier = "roc";
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
function $5f31bd6f0c8940b2$var$toGregorian(date) {
|
|
238
|
+
let [era, year] = $3b62074eb05584b2$export$4475b7e617eb123c($5f31bd6f0c8940b2$var$gregorianYear(date));
|
|
239
|
+
return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(era, year, date.month, date.day);
|
|
240
|
+
}
|
|
241
|
+
const $f3ed2e4472ae7e25$var$PERSIAN_EPOCH = 1948320;
|
|
242
|
+
const $f3ed2e4472ae7e25$var$MONTH_START = [
|
|
243
|
+
0,
|
|
244
|
+
31,
|
|
245
|
+
62,
|
|
246
|
+
93,
|
|
247
|
+
124,
|
|
248
|
+
155,
|
|
249
|
+
186,
|
|
250
|
+
216,
|
|
251
|
+
246,
|
|
252
|
+
276,
|
|
253
|
+
306,
|
|
254
|
+
336
|
|
255
|
+
// Esfand
|
|
256
|
+
];
|
|
257
|
+
class $f3ed2e4472ae7e25$export$37fccdbfd14c5939 {
|
|
258
|
+
fromJulianDay(jd) {
|
|
259
|
+
let daysSinceEpoch = jd - $f3ed2e4472ae7e25$var$PERSIAN_EPOCH;
|
|
260
|
+
let year = 1 + Math.floor((33 * daysSinceEpoch + 3) / 12053);
|
|
261
|
+
let farvardin1 = 365 * (year - 1) + Math.floor((8 * year + 21) / 33);
|
|
262
|
+
let dayOfYear = daysSinceEpoch - farvardin1;
|
|
263
|
+
let month = dayOfYear < 216 ? Math.floor(dayOfYear / 31) : Math.floor((dayOfYear - 6) / 30);
|
|
264
|
+
let day = dayOfYear - $f3ed2e4472ae7e25$var$MONTH_START[month] + 1;
|
|
265
|
+
return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, year, month + 1, day);
|
|
266
|
+
}
|
|
267
|
+
toJulianDay(date) {
|
|
268
|
+
let jd = $f3ed2e4472ae7e25$var$PERSIAN_EPOCH - 1 + 365 * (date.year - 1) + Math.floor((8 * date.year + 21) / 33);
|
|
269
|
+
jd += $f3ed2e4472ae7e25$var$MONTH_START[date.month - 1];
|
|
270
|
+
jd += date.day;
|
|
271
|
+
return jd;
|
|
272
|
+
}
|
|
273
|
+
getMonthsInYear() {
|
|
274
|
+
return 12;
|
|
275
|
+
}
|
|
276
|
+
getDaysInMonth(date) {
|
|
277
|
+
if (date.month <= 6) return 31;
|
|
278
|
+
if (date.month <= 11) return 30;
|
|
279
|
+
let isLeapYear = $2b4dce13dd5a17fa$export$842a2cf37af977e1(25 * date.year + 11, 33) < 8;
|
|
280
|
+
return isLeapYear ? 30 : 29;
|
|
281
|
+
}
|
|
282
|
+
getEras() {
|
|
283
|
+
return [
|
|
284
|
+
"AP"
|
|
285
|
+
];
|
|
286
|
+
}
|
|
287
|
+
getYearsInEra() {
|
|
288
|
+
return 9377;
|
|
289
|
+
}
|
|
290
|
+
constructor() {
|
|
291
|
+
this.identifier = "persian";
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
const $82c358003bdda0a8$var$INDIAN_ERA_START = 78;
|
|
295
|
+
const $82c358003bdda0a8$var$INDIAN_YEAR_START = 80;
|
|
296
|
+
class $82c358003bdda0a8$export$39f31c639fa15726 extends $3b62074eb05584b2$export$80ee6245ec4f29ec {
|
|
297
|
+
fromJulianDay(jd) {
|
|
298
|
+
let date = super.fromJulianDay(jd);
|
|
299
|
+
let indianYear = date.year - $82c358003bdda0a8$var$INDIAN_ERA_START;
|
|
300
|
+
let yDay = jd - $3b62074eb05584b2$export$f297eb839006d339(date.era, date.year, 1, 1);
|
|
301
|
+
let leapMonth;
|
|
302
|
+
if (yDay < $82c358003bdda0a8$var$INDIAN_YEAR_START) {
|
|
303
|
+
indianYear--;
|
|
304
|
+
leapMonth = $3b62074eb05584b2$export$553d7fa8e3805fc0(date.year - 1) ? 31 : 30;
|
|
305
|
+
yDay += leapMonth + 155 + 90 + 10;
|
|
306
|
+
} else {
|
|
307
|
+
leapMonth = $3b62074eb05584b2$export$553d7fa8e3805fc0(date.year) ? 31 : 30;
|
|
308
|
+
yDay -= $82c358003bdda0a8$var$INDIAN_YEAR_START;
|
|
309
|
+
}
|
|
310
|
+
let indianMonth;
|
|
311
|
+
let indianDay;
|
|
312
|
+
if (yDay < leapMonth) {
|
|
313
|
+
indianMonth = 1;
|
|
314
|
+
indianDay = yDay + 1;
|
|
315
|
+
} else {
|
|
316
|
+
let mDay = yDay - leapMonth;
|
|
317
|
+
if (mDay < 155) {
|
|
318
|
+
indianMonth = Math.floor(mDay / 31) + 2;
|
|
319
|
+
indianDay = mDay % 31 + 1;
|
|
320
|
+
} else {
|
|
321
|
+
mDay -= 155;
|
|
322
|
+
indianMonth = Math.floor(mDay / 30) + 7;
|
|
323
|
+
indianDay = mDay % 30 + 1;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, indianYear, indianMonth, indianDay);
|
|
327
|
+
}
|
|
328
|
+
toJulianDay(date) {
|
|
329
|
+
let extendedYear = date.year + $82c358003bdda0a8$var$INDIAN_ERA_START;
|
|
330
|
+
let [era, year] = $3b62074eb05584b2$export$4475b7e617eb123c(extendedYear);
|
|
331
|
+
let leapMonth;
|
|
332
|
+
let jd;
|
|
333
|
+
if ($3b62074eb05584b2$export$553d7fa8e3805fc0(year)) {
|
|
334
|
+
leapMonth = 31;
|
|
335
|
+
jd = $3b62074eb05584b2$export$f297eb839006d339(era, year, 3, 21);
|
|
336
|
+
} else {
|
|
337
|
+
leapMonth = 30;
|
|
338
|
+
jd = $3b62074eb05584b2$export$f297eb839006d339(era, year, 3, 22);
|
|
339
|
+
}
|
|
340
|
+
if (date.month === 1) return jd + date.day - 1;
|
|
341
|
+
jd += leapMonth + Math.min(date.month - 2, 5) * 31;
|
|
342
|
+
if (date.month >= 8) jd += (date.month - 7) * 30;
|
|
343
|
+
jd += date.day - 1;
|
|
344
|
+
return jd;
|
|
345
|
+
}
|
|
346
|
+
getDaysInMonth(date) {
|
|
347
|
+
if (date.month === 1 && $3b62074eb05584b2$export$553d7fa8e3805fc0(date.year + $82c358003bdda0a8$var$INDIAN_ERA_START)) return 31;
|
|
348
|
+
if (date.month >= 2 && date.month <= 6) return 31;
|
|
349
|
+
return 30;
|
|
350
|
+
}
|
|
351
|
+
getYearsInEra() {
|
|
352
|
+
return 9919;
|
|
353
|
+
}
|
|
354
|
+
getEras() {
|
|
355
|
+
return [
|
|
356
|
+
"saka"
|
|
357
|
+
];
|
|
358
|
+
}
|
|
359
|
+
balanceDate() {
|
|
360
|
+
}
|
|
361
|
+
constructor(...args) {
|
|
362
|
+
super(...args), this.identifier = "indian";
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
const $f2f3e0e3a817edbd$var$CIVIL_EPOC = 1948440;
|
|
366
|
+
const $f2f3e0e3a817edbd$var$ASTRONOMICAL_EPOC = 1948439;
|
|
367
|
+
const $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START = 1300;
|
|
368
|
+
const $f2f3e0e3a817edbd$var$UMALQURA_YEAR_END = 1600;
|
|
369
|
+
const $f2f3e0e3a817edbd$var$UMALQURA_START_DAYS = 460322;
|
|
370
|
+
function $f2f3e0e3a817edbd$var$islamicToJulianDay(epoch, year, month, day) {
|
|
371
|
+
return day + Math.ceil(29.5 * (month - 1)) + (year - 1) * 354 + Math.floor((3 + 11 * year) / 30) + epoch - 1;
|
|
372
|
+
}
|
|
373
|
+
function $f2f3e0e3a817edbd$var$julianDayToIslamic(calendar2, epoch, jd) {
|
|
374
|
+
let year = Math.floor((30 * (jd - epoch) + 10646) / 10631);
|
|
375
|
+
let month = Math.min(12, Math.ceil((jd - (29 + $f2f3e0e3a817edbd$var$islamicToJulianDay(epoch, year, 1, 1))) / 29.5) + 1);
|
|
376
|
+
let day = jd - $f2f3e0e3a817edbd$var$islamicToJulianDay(epoch, year, month, 1) + 1;
|
|
377
|
+
return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(calendar2, year, month, day);
|
|
378
|
+
}
|
|
379
|
+
function $f2f3e0e3a817edbd$var$isLeapYear(year) {
|
|
380
|
+
return (14 + 11 * year) % 30 < 11;
|
|
381
|
+
}
|
|
382
|
+
class $f2f3e0e3a817edbd$export$2066795aadd37bfc {
|
|
383
|
+
fromJulianDay(jd) {
|
|
384
|
+
return $f2f3e0e3a817edbd$var$julianDayToIslamic(this, $f2f3e0e3a817edbd$var$CIVIL_EPOC, jd);
|
|
385
|
+
}
|
|
386
|
+
toJulianDay(date) {
|
|
387
|
+
return $f2f3e0e3a817edbd$var$islamicToJulianDay($f2f3e0e3a817edbd$var$CIVIL_EPOC, date.year, date.month, date.day);
|
|
388
|
+
}
|
|
389
|
+
getDaysInMonth(date) {
|
|
390
|
+
let length = 29 + date.month % 2;
|
|
391
|
+
if (date.month === 12 && $f2f3e0e3a817edbd$var$isLeapYear(date.year)) length++;
|
|
392
|
+
return length;
|
|
393
|
+
}
|
|
394
|
+
getMonthsInYear() {
|
|
395
|
+
return 12;
|
|
396
|
+
}
|
|
397
|
+
getDaysInYear(date) {
|
|
398
|
+
return $f2f3e0e3a817edbd$var$isLeapYear(date.year) ? 355 : 354;
|
|
399
|
+
}
|
|
400
|
+
getYearsInEra() {
|
|
401
|
+
return 9665;
|
|
402
|
+
}
|
|
403
|
+
getEras() {
|
|
404
|
+
return [
|
|
405
|
+
"AH"
|
|
406
|
+
];
|
|
407
|
+
}
|
|
408
|
+
constructor() {
|
|
409
|
+
this.identifier = "islamic-civil";
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
class $f2f3e0e3a817edbd$export$37f0887f2f9d22f7 extends $f2f3e0e3a817edbd$export$2066795aadd37bfc {
|
|
413
|
+
fromJulianDay(jd) {
|
|
414
|
+
return $f2f3e0e3a817edbd$var$julianDayToIslamic(this, $f2f3e0e3a817edbd$var$ASTRONOMICAL_EPOC, jd);
|
|
415
|
+
}
|
|
416
|
+
toJulianDay(date) {
|
|
417
|
+
return $f2f3e0e3a817edbd$var$islamicToJulianDay($f2f3e0e3a817edbd$var$ASTRONOMICAL_EPOC, date.year, date.month, date.day);
|
|
418
|
+
}
|
|
419
|
+
constructor(...args) {
|
|
420
|
+
super(...args), this.identifier = "islamic-tbla";
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
const $f2f3e0e3a817edbd$var$UMALQURA_DATA = "qgpUDckO1AbqBmwDrQpVBakGkgepC9QF2gpcBS0NlQZKB1QLagutBa4ETwoXBYsGpQbVCtYCWwmdBE0KJg2VDawFtgm6AlsKKwWVCsoG6Qr0AnYJtgJWCcoKpAvSC9kF3AJtCU0FpQpSC6ULtAW2CVcFlwJLBaMGUgdlC2oFqworBZUMSg2lDcoF1gpXCasESwmlClILagt1BXYCtwhbBFUFqQW0BdoJ3QRuAjYJqgpUDbIN1QXaAlsJqwRVCkkLZAtxC7QFtQpVCiUNkg7JDtQG6QprCasEkwpJDaQNsg25CroEWworBZUKKgtVC1wFvQQ9Ah0JlQpKC1oLbQW2AjsJmwRVBqkGVAdqC2wFrQpVBSkLkgupC9QF2gpaBasKlQVJB2QHqgu1BbYCVgpNDiULUgtqC60FrgIvCZcESwalBqwG1gpdBZ0ETQoWDZUNqgW1BdoCWwmtBJUFygbkBuoK9QS2AlYJqgpUC9IL2QXqAm0JrQSVCkoLpQuyBbUJ1gSXCkcFkwZJB1ULagVrCisFiwpGDaMNygXWCtsEawJLCaUKUgtpC3UFdgG3CFsCKwVlBbQF2gntBG0BtgimClINqQ3UBdoKWwmrBFMGKQdiB6kLsgW1ClUFJQuSDckO0gbpCmsFqwRVCikNVA2qDbUJugQ7CpsETQqqCtUK2gJdCV4ELgqaDFUNsga5BroEXQotBZUKUguoC7QLuQXaAloJSgukDdEO6AZqC20FNQWVBkoNqA3UDdoGWwWdAisGFQtKC5ULqgWuCi4JjwwnBZUGqgbWCl0FnQI=";
|
|
424
|
+
let $f2f3e0e3a817edbd$var$UMALQURA_MONTHLENGTH;
|
|
425
|
+
let $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE;
|
|
426
|
+
function $f2f3e0e3a817edbd$var$umalquraYearStart(year) {
|
|
427
|
+
return $f2f3e0e3a817edbd$var$UMALQURA_START_DAYS + $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE[year - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START];
|
|
428
|
+
}
|
|
429
|
+
function $f2f3e0e3a817edbd$var$umalquraMonthLength(year, month) {
|
|
430
|
+
let idx = year - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START;
|
|
431
|
+
let mask = 1 << 11 - (month - 1);
|
|
432
|
+
if (($f2f3e0e3a817edbd$var$UMALQURA_MONTHLENGTH[idx] & mask) === 0) return 29;
|
|
433
|
+
else return 30;
|
|
434
|
+
}
|
|
435
|
+
function $f2f3e0e3a817edbd$var$umalquraMonthStart(year, month) {
|
|
436
|
+
let day = $f2f3e0e3a817edbd$var$umalquraYearStart(year);
|
|
437
|
+
for (let i = 1; i < month; i++) day += $f2f3e0e3a817edbd$var$umalquraMonthLength(year, i);
|
|
438
|
+
return day;
|
|
439
|
+
}
|
|
440
|
+
function $f2f3e0e3a817edbd$var$umalquraYearLength(year) {
|
|
441
|
+
return $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE[year + 1 - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START] - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE[year - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START];
|
|
442
|
+
}
|
|
443
|
+
class $f2f3e0e3a817edbd$export$5baab4758c231076 extends $f2f3e0e3a817edbd$export$2066795aadd37bfc {
|
|
444
|
+
fromJulianDay(jd) {
|
|
445
|
+
let days = jd - $f2f3e0e3a817edbd$var$CIVIL_EPOC;
|
|
446
|
+
let startDays = $f2f3e0e3a817edbd$var$umalquraYearStart($f2f3e0e3a817edbd$var$UMALQURA_YEAR_START);
|
|
447
|
+
let endDays = $f2f3e0e3a817edbd$var$umalquraYearStart($f2f3e0e3a817edbd$var$UMALQURA_YEAR_END);
|
|
448
|
+
if (days < startDays || days > endDays) return super.fromJulianDay(jd);
|
|
449
|
+
else {
|
|
450
|
+
let y = $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START - 1;
|
|
451
|
+
let m = 1;
|
|
452
|
+
let d = 1;
|
|
453
|
+
while (d > 0) {
|
|
454
|
+
y++;
|
|
455
|
+
d = days - $f2f3e0e3a817edbd$var$umalquraYearStart(y) + 1;
|
|
456
|
+
let yearLength = $f2f3e0e3a817edbd$var$umalquraYearLength(y);
|
|
457
|
+
if (d === yearLength) {
|
|
458
|
+
m = 12;
|
|
459
|
+
break;
|
|
460
|
+
} else if (d < yearLength) {
|
|
461
|
+
let monthLength = $f2f3e0e3a817edbd$var$umalquraMonthLength(y, m);
|
|
462
|
+
m = 1;
|
|
463
|
+
while (d > monthLength) {
|
|
464
|
+
d -= monthLength;
|
|
465
|
+
m++;
|
|
466
|
+
monthLength = $f2f3e0e3a817edbd$var$umalquraMonthLength(y, m);
|
|
467
|
+
}
|
|
468
|
+
break;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, y, m, days - $f2f3e0e3a817edbd$var$umalquraMonthStart(y, m) + 1);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
toJulianDay(date) {
|
|
475
|
+
if (date.year < $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START || date.year > $f2f3e0e3a817edbd$var$UMALQURA_YEAR_END) return super.toJulianDay(date);
|
|
476
|
+
return $f2f3e0e3a817edbd$var$CIVIL_EPOC + $f2f3e0e3a817edbd$var$umalquraMonthStart(date.year, date.month) + (date.day - 1);
|
|
477
|
+
}
|
|
478
|
+
getDaysInMonth(date) {
|
|
479
|
+
if (date.year < $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START || date.year > $f2f3e0e3a817edbd$var$UMALQURA_YEAR_END) return super.getDaysInMonth(date);
|
|
480
|
+
return $f2f3e0e3a817edbd$var$umalquraMonthLength(date.year, date.month);
|
|
481
|
+
}
|
|
482
|
+
getDaysInYear(date) {
|
|
483
|
+
if (date.year < $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START || date.year > $f2f3e0e3a817edbd$var$UMALQURA_YEAR_END) return super.getDaysInYear(date);
|
|
484
|
+
return $f2f3e0e3a817edbd$var$umalquraYearLength(date.year);
|
|
485
|
+
}
|
|
486
|
+
constructor() {
|
|
487
|
+
super(), this.identifier = "islamic-umalqura";
|
|
488
|
+
if (!$f2f3e0e3a817edbd$var$UMALQURA_MONTHLENGTH) $f2f3e0e3a817edbd$var$UMALQURA_MONTHLENGTH = new Uint16Array(Uint8Array.from(atob($f2f3e0e3a817edbd$var$UMALQURA_DATA), (c) => c.charCodeAt(0)).buffer);
|
|
489
|
+
if (!$f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE) {
|
|
490
|
+
$f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE = new Uint32Array($f2f3e0e3a817edbd$var$UMALQURA_YEAR_END - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START + 1);
|
|
491
|
+
let yearStart = 0;
|
|
492
|
+
for (let year = $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START; year <= $f2f3e0e3a817edbd$var$UMALQURA_YEAR_END; year++) {
|
|
493
|
+
$f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE[year - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START] = yearStart;
|
|
494
|
+
for (let i = 1; i <= 12; i++) yearStart += $f2f3e0e3a817edbd$var$umalquraMonthLength(year, i);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
const $7c5f6fbf42389787$var$HEBREW_EPOCH = 347997;
|
|
500
|
+
const $7c5f6fbf42389787$var$HOUR_PARTS = 1080;
|
|
501
|
+
const $7c5f6fbf42389787$var$DAY_PARTS = 24 * $7c5f6fbf42389787$var$HOUR_PARTS;
|
|
502
|
+
const $7c5f6fbf42389787$var$MONTH_DAYS = 29;
|
|
503
|
+
const $7c5f6fbf42389787$var$MONTH_FRACT = 12 * $7c5f6fbf42389787$var$HOUR_PARTS + 793;
|
|
504
|
+
const $7c5f6fbf42389787$var$MONTH_PARTS = $7c5f6fbf42389787$var$MONTH_DAYS * $7c5f6fbf42389787$var$DAY_PARTS + $7c5f6fbf42389787$var$MONTH_FRACT;
|
|
505
|
+
function $7c5f6fbf42389787$var$isLeapYear(year) {
|
|
506
|
+
return $2b4dce13dd5a17fa$export$842a2cf37af977e1(year * 7 + 1, 19) < 7;
|
|
507
|
+
}
|
|
508
|
+
function $7c5f6fbf42389787$var$hebrewDelay1(year) {
|
|
509
|
+
let months = Math.floor((235 * year - 234) / 19);
|
|
510
|
+
let parts = 12084 + 13753 * months;
|
|
511
|
+
let day = months * 29 + Math.floor(parts / 25920);
|
|
512
|
+
if ($2b4dce13dd5a17fa$export$842a2cf37af977e1(3 * (day + 1), 7) < 3) day += 1;
|
|
513
|
+
return day;
|
|
514
|
+
}
|
|
515
|
+
function $7c5f6fbf42389787$var$hebrewDelay2(year) {
|
|
516
|
+
let last = $7c5f6fbf42389787$var$hebrewDelay1(year - 1);
|
|
517
|
+
let present = $7c5f6fbf42389787$var$hebrewDelay1(year);
|
|
518
|
+
let next = $7c5f6fbf42389787$var$hebrewDelay1(year + 1);
|
|
519
|
+
if (next - present === 356) return 2;
|
|
520
|
+
if (present - last === 382) return 1;
|
|
521
|
+
return 0;
|
|
522
|
+
}
|
|
523
|
+
function $7c5f6fbf42389787$var$startOfYear(year) {
|
|
524
|
+
return $7c5f6fbf42389787$var$hebrewDelay1(year) + $7c5f6fbf42389787$var$hebrewDelay2(year);
|
|
525
|
+
}
|
|
526
|
+
function $7c5f6fbf42389787$var$getDaysInYear(year) {
|
|
527
|
+
return $7c5f6fbf42389787$var$startOfYear(year + 1) - $7c5f6fbf42389787$var$startOfYear(year);
|
|
528
|
+
}
|
|
529
|
+
function $7c5f6fbf42389787$var$getYearType(year) {
|
|
530
|
+
let yearLength = $7c5f6fbf42389787$var$getDaysInYear(year);
|
|
531
|
+
if (yearLength > 380) yearLength -= 30;
|
|
532
|
+
switch (yearLength) {
|
|
533
|
+
case 353:
|
|
534
|
+
return 0;
|
|
535
|
+
case 354:
|
|
536
|
+
return 1;
|
|
537
|
+
case 355:
|
|
538
|
+
return 2;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
function $7c5f6fbf42389787$var$getDaysInMonth(year, month) {
|
|
542
|
+
if (month >= 6 && !$7c5f6fbf42389787$var$isLeapYear(year)) month++;
|
|
543
|
+
if (month === 4 || month === 7 || month === 9 || month === 11 || month === 13) return 29;
|
|
544
|
+
let yearType = $7c5f6fbf42389787$var$getYearType(year);
|
|
545
|
+
if (month === 2) return yearType === 2 ? 30 : 29;
|
|
546
|
+
if (month === 3) return yearType === 0 ? 29 : 30;
|
|
547
|
+
if (month === 6) return $7c5f6fbf42389787$var$isLeapYear(year) ? 30 : 0;
|
|
548
|
+
return 30;
|
|
549
|
+
}
|
|
550
|
+
class $7c5f6fbf42389787$export$ca405048b8fb5af {
|
|
551
|
+
fromJulianDay(jd) {
|
|
552
|
+
let d = jd - $7c5f6fbf42389787$var$HEBREW_EPOCH;
|
|
553
|
+
let m = d * $7c5f6fbf42389787$var$DAY_PARTS / $7c5f6fbf42389787$var$MONTH_PARTS;
|
|
554
|
+
let year = Math.floor((19 * m + 234) / 235) + 1;
|
|
555
|
+
let ys = $7c5f6fbf42389787$var$startOfYear(year);
|
|
556
|
+
let dayOfYear = Math.floor(d - ys);
|
|
557
|
+
while (dayOfYear < 1) {
|
|
558
|
+
year--;
|
|
559
|
+
ys = $7c5f6fbf42389787$var$startOfYear(year);
|
|
560
|
+
dayOfYear = Math.floor(d - ys);
|
|
561
|
+
}
|
|
562
|
+
let month = 1;
|
|
563
|
+
let monthStart = 0;
|
|
564
|
+
while (monthStart < dayOfYear) {
|
|
565
|
+
monthStart += $7c5f6fbf42389787$var$getDaysInMonth(year, month);
|
|
566
|
+
month++;
|
|
567
|
+
}
|
|
568
|
+
month--;
|
|
569
|
+
monthStart -= $7c5f6fbf42389787$var$getDaysInMonth(year, month);
|
|
570
|
+
let day = dayOfYear - monthStart;
|
|
571
|
+
return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, year, month, day);
|
|
572
|
+
}
|
|
573
|
+
toJulianDay(date) {
|
|
574
|
+
let jd = $7c5f6fbf42389787$var$startOfYear(date.year);
|
|
575
|
+
for (let month = 1; month < date.month; month++) jd += $7c5f6fbf42389787$var$getDaysInMonth(date.year, month);
|
|
576
|
+
return jd + date.day + $7c5f6fbf42389787$var$HEBREW_EPOCH;
|
|
577
|
+
}
|
|
578
|
+
getDaysInMonth(date) {
|
|
579
|
+
return $7c5f6fbf42389787$var$getDaysInMonth(date.year, date.month);
|
|
580
|
+
}
|
|
581
|
+
getMonthsInYear(date) {
|
|
582
|
+
return $7c5f6fbf42389787$var$isLeapYear(date.year) ? 13 : 12;
|
|
583
|
+
}
|
|
584
|
+
getDaysInYear(date) {
|
|
585
|
+
return $7c5f6fbf42389787$var$getDaysInYear(date.year);
|
|
586
|
+
}
|
|
587
|
+
getYearsInEra() {
|
|
588
|
+
return 9999;
|
|
589
|
+
}
|
|
590
|
+
getEras() {
|
|
591
|
+
return [
|
|
592
|
+
"AM"
|
|
593
|
+
];
|
|
594
|
+
}
|
|
595
|
+
balanceYearMonth(date, previousDate) {
|
|
596
|
+
if (previousDate.year !== date.year) {
|
|
597
|
+
if ($7c5f6fbf42389787$var$isLeapYear(previousDate.year) && !$7c5f6fbf42389787$var$isLeapYear(date.year) && previousDate.month > 6) date.month--;
|
|
598
|
+
else if (!$7c5f6fbf42389787$var$isLeapYear(previousDate.year) && $7c5f6fbf42389787$var$isLeapYear(date.year) && previousDate.month > 6) date.month++;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
constructor() {
|
|
602
|
+
this.identifier = "hebrew";
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
const $b956b2d7a6cf451f$var$ETHIOPIC_EPOCH = 1723856;
|
|
606
|
+
const $b956b2d7a6cf451f$var$COPTIC_EPOCH = 1824665;
|
|
607
|
+
const $b956b2d7a6cf451f$var$AMETE_MIHRET_DELTA = 5500;
|
|
608
|
+
function $b956b2d7a6cf451f$var$ceToJulianDay(epoch, year, month, day) {
|
|
609
|
+
return epoch + 365 * year + Math.floor(year / 4) + 30 * (month - 1) + day - 1;
|
|
610
|
+
}
|
|
611
|
+
function $b956b2d7a6cf451f$var$julianDayToCE(epoch, jd) {
|
|
612
|
+
let year = Math.floor(4 * (jd - epoch) / 1461);
|
|
613
|
+
let month = 1 + Math.floor((jd - $b956b2d7a6cf451f$var$ceToJulianDay(epoch, year, 1, 1)) / 30);
|
|
614
|
+
let day = jd + 1 - $b956b2d7a6cf451f$var$ceToJulianDay(epoch, year, month, 1);
|
|
615
|
+
return [
|
|
616
|
+
year,
|
|
617
|
+
month,
|
|
618
|
+
day
|
|
619
|
+
];
|
|
620
|
+
}
|
|
621
|
+
function $b956b2d7a6cf451f$var$getLeapDay(year) {
|
|
622
|
+
return Math.floor(year % 4 / 3);
|
|
623
|
+
}
|
|
624
|
+
function $b956b2d7a6cf451f$var$getDaysInMonth(year, month) {
|
|
625
|
+
if (month % 13 !== 0)
|
|
626
|
+
return 30;
|
|
627
|
+
else
|
|
628
|
+
return $b956b2d7a6cf451f$var$getLeapDay(year) + 5;
|
|
629
|
+
}
|
|
630
|
+
class $b956b2d7a6cf451f$export$26ba6eab5e20cd7d {
|
|
631
|
+
fromJulianDay(jd) {
|
|
632
|
+
let [year, month, day] = $b956b2d7a6cf451f$var$julianDayToCE($b956b2d7a6cf451f$var$ETHIOPIC_EPOCH, jd);
|
|
633
|
+
let era = "AM";
|
|
634
|
+
if (year <= 0) {
|
|
635
|
+
era = "AA";
|
|
636
|
+
year += $b956b2d7a6cf451f$var$AMETE_MIHRET_DELTA;
|
|
637
|
+
}
|
|
638
|
+
return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, era, year, month, day);
|
|
639
|
+
}
|
|
640
|
+
toJulianDay(date) {
|
|
641
|
+
let year = date.year;
|
|
642
|
+
if (date.era === "AA") year -= $b956b2d7a6cf451f$var$AMETE_MIHRET_DELTA;
|
|
643
|
+
return $b956b2d7a6cf451f$var$ceToJulianDay($b956b2d7a6cf451f$var$ETHIOPIC_EPOCH, year, date.month, date.day);
|
|
644
|
+
}
|
|
645
|
+
getDaysInMonth(date) {
|
|
646
|
+
return $b956b2d7a6cf451f$var$getDaysInMonth(date.year, date.month);
|
|
647
|
+
}
|
|
648
|
+
getMonthsInYear() {
|
|
649
|
+
return 13;
|
|
650
|
+
}
|
|
651
|
+
getDaysInYear(date) {
|
|
652
|
+
return 365 + $b956b2d7a6cf451f$var$getLeapDay(date.year);
|
|
653
|
+
}
|
|
654
|
+
getYearsInEra(date) {
|
|
655
|
+
return date.era === "AA" ? 9999 : 9991;
|
|
656
|
+
}
|
|
657
|
+
getEras() {
|
|
658
|
+
return [
|
|
659
|
+
"AA",
|
|
660
|
+
"AM"
|
|
661
|
+
];
|
|
662
|
+
}
|
|
663
|
+
constructor() {
|
|
664
|
+
this.identifier = "ethiopic";
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
class $b956b2d7a6cf451f$export$d72e0c37005a4914 extends $b956b2d7a6cf451f$export$26ba6eab5e20cd7d {
|
|
668
|
+
fromJulianDay(jd) {
|
|
669
|
+
let [year, month, day] = $b956b2d7a6cf451f$var$julianDayToCE($b956b2d7a6cf451f$var$ETHIOPIC_EPOCH, jd);
|
|
670
|
+
year += $b956b2d7a6cf451f$var$AMETE_MIHRET_DELTA;
|
|
671
|
+
return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, "AA", year, month, day);
|
|
672
|
+
}
|
|
673
|
+
getEras() {
|
|
674
|
+
return [
|
|
675
|
+
"AA"
|
|
676
|
+
];
|
|
677
|
+
}
|
|
678
|
+
getYearsInEra() {
|
|
679
|
+
return 9999;
|
|
680
|
+
}
|
|
681
|
+
constructor(...args) {
|
|
682
|
+
super(...args), this.identifier = "ethioaa";
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
class $b956b2d7a6cf451f$export$fe6243cbe1a4b7c1 extends $b956b2d7a6cf451f$export$26ba6eab5e20cd7d {
|
|
686
|
+
fromJulianDay(jd) {
|
|
687
|
+
let [year, month, day] = $b956b2d7a6cf451f$var$julianDayToCE($b956b2d7a6cf451f$var$COPTIC_EPOCH, jd);
|
|
688
|
+
let era = "CE";
|
|
689
|
+
if (year <= 0) {
|
|
690
|
+
era = "BCE";
|
|
691
|
+
year = 1 - year;
|
|
692
|
+
}
|
|
693
|
+
return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, era, year, month, day);
|
|
694
|
+
}
|
|
695
|
+
toJulianDay(date) {
|
|
696
|
+
let year = date.year;
|
|
697
|
+
if (date.era === "BCE") year = 1 - year;
|
|
698
|
+
return $b956b2d7a6cf451f$var$ceToJulianDay($b956b2d7a6cf451f$var$COPTIC_EPOCH, year, date.month, date.day);
|
|
699
|
+
}
|
|
700
|
+
getDaysInMonth(date) {
|
|
701
|
+
let year = date.year;
|
|
702
|
+
if (date.era === "BCE") year = 1 - year;
|
|
703
|
+
return $b956b2d7a6cf451f$var$getDaysInMonth(year, date.month);
|
|
704
|
+
}
|
|
705
|
+
isInverseEra(date) {
|
|
706
|
+
return date.era === "BCE";
|
|
707
|
+
}
|
|
708
|
+
balanceDate(date) {
|
|
709
|
+
if (date.year <= 0) {
|
|
710
|
+
date.era = date.era === "BCE" ? "CE" : "BCE";
|
|
711
|
+
date.year = 1 - date.year;
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
getEras() {
|
|
715
|
+
return [
|
|
716
|
+
"BCE",
|
|
717
|
+
"CE"
|
|
718
|
+
];
|
|
719
|
+
}
|
|
720
|
+
getYearsInEra(date) {
|
|
721
|
+
return date.era === "BCE" ? 9999 : 9715;
|
|
722
|
+
}
|
|
723
|
+
constructor(...args) {
|
|
724
|
+
super(...args), this.identifier = "coptic";
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
function $64244302c3013299$export$dd0bbc9b26defe37(name) {
|
|
728
|
+
switch (name) {
|
|
729
|
+
case "buddhist":
|
|
730
|
+
return new $8d73d47422ca7302$export$42d20a78301dee44();
|
|
731
|
+
case "ethiopic":
|
|
732
|
+
return new $b956b2d7a6cf451f$export$26ba6eab5e20cd7d();
|
|
733
|
+
case "ethioaa":
|
|
734
|
+
return new $b956b2d7a6cf451f$export$d72e0c37005a4914();
|
|
735
|
+
case "coptic":
|
|
736
|
+
return new $b956b2d7a6cf451f$export$fe6243cbe1a4b7c1();
|
|
737
|
+
case "hebrew":
|
|
738
|
+
return new $7c5f6fbf42389787$export$ca405048b8fb5af();
|
|
739
|
+
case "indian":
|
|
740
|
+
return new $82c358003bdda0a8$export$39f31c639fa15726();
|
|
741
|
+
case "islamic-civil":
|
|
742
|
+
return new $f2f3e0e3a817edbd$export$2066795aadd37bfc();
|
|
743
|
+
case "islamic-tbla":
|
|
744
|
+
return new $f2f3e0e3a817edbd$export$37f0887f2f9d22f7();
|
|
745
|
+
case "islamic-umalqura":
|
|
746
|
+
return new $f2f3e0e3a817edbd$export$5baab4758c231076();
|
|
747
|
+
case "japanese":
|
|
748
|
+
return new $62225008020f0a13$export$b746ab2b60cdffbf();
|
|
749
|
+
case "persian":
|
|
750
|
+
return new $f3ed2e4472ae7e25$export$37fccdbfd14c5939();
|
|
751
|
+
case "roc":
|
|
752
|
+
return new $5f31bd6f0c8940b2$export$65e01080afcb0799();
|
|
753
|
+
case "gregory":
|
|
754
|
+
default:
|
|
755
|
+
return new $3b62074eb05584b2$export$80ee6245ec4f29ec();
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
let $fb18d541ea1ad717$var$formatterCache = /* @__PURE__ */ new Map();
|
|
759
|
+
class $fb18d541ea1ad717$export$ad991b66133851cf {
|
|
760
|
+
/** Formats a date as a string according to the locale and format options passed to the constructor. */
|
|
761
|
+
format(value) {
|
|
762
|
+
return this.formatter.format(value);
|
|
763
|
+
}
|
|
764
|
+
/** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */
|
|
765
|
+
formatToParts(value) {
|
|
766
|
+
return this.formatter.formatToParts(value);
|
|
767
|
+
}
|
|
768
|
+
/** Formats a date range as a string. */
|
|
769
|
+
formatRange(start, end) {
|
|
770
|
+
if (typeof this.formatter.formatRange === "function")
|
|
771
|
+
return this.formatter.formatRange(start, end);
|
|
772
|
+
if (end < start) throw new RangeError("End date must be >= start date");
|
|
773
|
+
return `${this.formatter.format(start)} – ${this.formatter.format(end)}`;
|
|
774
|
+
}
|
|
775
|
+
/** Formats a date range as an array of parts. */
|
|
776
|
+
formatRangeToParts(start, end) {
|
|
777
|
+
if (typeof this.formatter.formatRangeToParts === "function")
|
|
778
|
+
return this.formatter.formatRangeToParts(start, end);
|
|
779
|
+
if (end < start) throw new RangeError("End date must be >= start date");
|
|
780
|
+
let startParts = this.formatter.formatToParts(start);
|
|
781
|
+
let endParts = this.formatter.formatToParts(end);
|
|
782
|
+
return [
|
|
783
|
+
...startParts.map((p) => ({
|
|
784
|
+
...p,
|
|
785
|
+
source: "startRange"
|
|
786
|
+
})),
|
|
787
|
+
{
|
|
788
|
+
type: "literal",
|
|
789
|
+
value: " – ",
|
|
790
|
+
source: "shared"
|
|
791
|
+
},
|
|
792
|
+
...endParts.map((p) => ({
|
|
793
|
+
...p,
|
|
794
|
+
source: "endRange"
|
|
795
|
+
}))
|
|
796
|
+
];
|
|
797
|
+
}
|
|
798
|
+
/** Returns the resolved formatting options based on the values passed to the constructor. */
|
|
799
|
+
resolvedOptions() {
|
|
800
|
+
let resolvedOptions = this.formatter.resolvedOptions();
|
|
801
|
+
if ($fb18d541ea1ad717$var$hasBuggyResolvedHourCycle()) {
|
|
802
|
+
if (!this.resolvedHourCycle) this.resolvedHourCycle = $fb18d541ea1ad717$var$getResolvedHourCycle(resolvedOptions.locale, this.options);
|
|
803
|
+
resolvedOptions.hourCycle = this.resolvedHourCycle;
|
|
804
|
+
resolvedOptions.hour12 = this.resolvedHourCycle === "h11" || this.resolvedHourCycle === "h12";
|
|
805
|
+
}
|
|
806
|
+
if (resolvedOptions.calendar === "ethiopic-amete-alem") resolvedOptions.calendar = "ethioaa";
|
|
807
|
+
return resolvedOptions;
|
|
808
|
+
}
|
|
809
|
+
constructor(locale, options = {}) {
|
|
810
|
+
this.formatter = $fb18d541ea1ad717$var$getCachedDateFormatter(locale, options);
|
|
811
|
+
this.options = options;
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
const $fb18d541ea1ad717$var$hour12Preferences = {
|
|
815
|
+
true: {
|
|
816
|
+
// Only Japanese uses the h11 style for 12 hour time. All others use h12.
|
|
817
|
+
ja: "h11"
|
|
818
|
+
},
|
|
819
|
+
false: {}
|
|
820
|
+
};
|
|
821
|
+
function $fb18d541ea1ad717$var$getCachedDateFormatter(locale, options = {}) {
|
|
822
|
+
if (typeof options.hour12 === "boolean" && $fb18d541ea1ad717$var$hasBuggyHour12Behavior()) {
|
|
823
|
+
options = {
|
|
824
|
+
...options
|
|
825
|
+
};
|
|
826
|
+
let pref = $fb18d541ea1ad717$var$hour12Preferences[String(options.hour12)][locale.split("-")[0]];
|
|
827
|
+
let defaultHourCycle = options.hour12 ? "h12" : "h23";
|
|
828
|
+
options.hourCycle = pref !== null && pref !== void 0 ? pref : defaultHourCycle;
|
|
829
|
+
delete options.hour12;
|
|
830
|
+
}
|
|
831
|
+
let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : "");
|
|
832
|
+
if ($fb18d541ea1ad717$var$formatterCache.has(cacheKey)) return $fb18d541ea1ad717$var$formatterCache.get(cacheKey);
|
|
833
|
+
let numberFormatter = new Intl.DateTimeFormat(locale, options);
|
|
834
|
+
$fb18d541ea1ad717$var$formatterCache.set(cacheKey, numberFormatter);
|
|
835
|
+
return numberFormatter;
|
|
836
|
+
}
|
|
837
|
+
let $fb18d541ea1ad717$var$_hasBuggyHour12Behavior = null;
|
|
838
|
+
function $fb18d541ea1ad717$var$hasBuggyHour12Behavior() {
|
|
839
|
+
if ($fb18d541ea1ad717$var$_hasBuggyHour12Behavior == null) $fb18d541ea1ad717$var$_hasBuggyHour12Behavior = new Intl.DateTimeFormat("en-US", {
|
|
840
|
+
hour: "numeric",
|
|
841
|
+
hour12: false
|
|
842
|
+
}).format(new Date(2020, 2, 3, 0)) === "24";
|
|
843
|
+
return $fb18d541ea1ad717$var$_hasBuggyHour12Behavior;
|
|
844
|
+
}
|
|
845
|
+
let $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle = null;
|
|
846
|
+
function $fb18d541ea1ad717$var$hasBuggyResolvedHourCycle() {
|
|
847
|
+
if ($fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle == null) $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle = new Intl.DateTimeFormat("fr", {
|
|
848
|
+
hour: "numeric",
|
|
849
|
+
hour12: false
|
|
850
|
+
}).resolvedOptions().hourCycle === "h12";
|
|
851
|
+
return $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle;
|
|
852
|
+
}
|
|
853
|
+
function $fb18d541ea1ad717$var$getResolvedHourCycle(locale, options) {
|
|
854
|
+
if (!options.timeStyle && !options.hour) return void 0;
|
|
855
|
+
locale = locale.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, "");
|
|
856
|
+
locale += (locale.includes("-u-") ? "" : "-u") + "-nu-latn";
|
|
857
|
+
let formatter = $fb18d541ea1ad717$var$getCachedDateFormatter(locale, {
|
|
858
|
+
...options,
|
|
859
|
+
timeZone: void 0
|
|
860
|
+
// use local timezone
|
|
861
|
+
});
|
|
862
|
+
let min = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 0)).find((p) => p.type === "hour").value, 10);
|
|
863
|
+
let max = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 23)).find((p) => p.type === "hour").value, 10);
|
|
864
|
+
if (min === 0 && max === 23) return "h23";
|
|
865
|
+
if (min === 24 && max === 23) return "h24";
|
|
866
|
+
if (min === 0 && max === 11) return "h11";
|
|
867
|
+
if (min === 12 && max === 11) return "h12";
|
|
868
|
+
throw new Error("Unexpected hour cycle result");
|
|
869
|
+
}
|
|
870
|
+
function $f62d864046160412$export$eac50920cf2fd59a(date, minValue, maxValue) {
|
|
871
|
+
return minValue != null && date.compare(minValue) < 0 || maxValue != null && date.compare(maxValue) > 0;
|
|
872
|
+
}
|
|
873
|
+
function $f62d864046160412$export$f4a51ff076cc9a09(date, duration, locale, minValue, maxValue) {
|
|
874
|
+
let halfDuration = {};
|
|
875
|
+
for (let key in duration) {
|
|
876
|
+
halfDuration[key] = Math.floor(duration[key] / 2);
|
|
877
|
+
if (halfDuration[key] > 0 && duration[key] % 2 === 0) halfDuration[key]--;
|
|
878
|
+
}
|
|
879
|
+
let aligned = $f62d864046160412$export$144a00ba6044eb9(date, duration, locale).subtract(halfDuration);
|
|
880
|
+
return $f62d864046160412$export$5bb865b12696a77d(date, aligned, duration, locale, minValue, maxValue);
|
|
881
|
+
}
|
|
882
|
+
function $f62d864046160412$export$144a00ba6044eb9(date, duration, locale, minValue, maxValue) {
|
|
883
|
+
let aligned = date;
|
|
884
|
+
if (duration.years) aligned = $14e0f24ef4ac5c92$export$f91e89d3d0406102(date);
|
|
885
|
+
else if (duration.months) aligned = $14e0f24ef4ac5c92$export$a5a3b454ada2268e(date);
|
|
886
|
+
else if (duration.weeks) aligned = $14e0f24ef4ac5c92$export$42c81a444fbfb5d4(date, locale);
|
|
887
|
+
return $f62d864046160412$export$5bb865b12696a77d(date, aligned, duration, locale, minValue, maxValue);
|
|
888
|
+
}
|
|
889
|
+
function $f62d864046160412$export$530edbfc915b2b04(date, duration, locale, minValue, maxValue) {
|
|
890
|
+
let d = {
|
|
891
|
+
...duration
|
|
892
|
+
};
|
|
893
|
+
if (d.days) d.days--;
|
|
894
|
+
else if (d.weeks) d.weeks--;
|
|
895
|
+
else if (d.months) d.months--;
|
|
896
|
+
else if (d.years) d.years--;
|
|
897
|
+
let aligned = $f62d864046160412$export$144a00ba6044eb9(date, duration, locale).subtract(d);
|
|
898
|
+
return $f62d864046160412$export$5bb865b12696a77d(date, aligned, duration, locale, minValue, maxValue);
|
|
899
|
+
}
|
|
900
|
+
function $f62d864046160412$export$5bb865b12696a77d(date, aligned, duration, locale, minValue, maxValue) {
|
|
901
|
+
if (minValue && date.compare(minValue) >= 0) {
|
|
902
|
+
let newDate = $14e0f24ef4ac5c92$export$a75f2bff57811055(aligned, $f62d864046160412$export$144a00ba6044eb9($11d87f3f76e88657$export$93522d1a439f3617(minValue), duration, locale));
|
|
903
|
+
if (newDate) aligned = newDate;
|
|
904
|
+
}
|
|
905
|
+
if (maxValue && date.compare(maxValue) <= 0) {
|
|
906
|
+
let newDate = $14e0f24ef4ac5c92$export$5c333a116e949cdd(aligned, $f62d864046160412$export$530edbfc915b2b04($11d87f3f76e88657$export$93522d1a439f3617(maxValue), duration, locale));
|
|
907
|
+
if (newDate) aligned = newDate;
|
|
908
|
+
}
|
|
909
|
+
return aligned;
|
|
910
|
+
}
|
|
911
|
+
function $f62d864046160412$export$4f5203c0d889109e(date, minValue, maxValue) {
|
|
912
|
+
if (minValue) {
|
|
913
|
+
let newDate = $14e0f24ef4ac5c92$export$a75f2bff57811055(date, $11d87f3f76e88657$export$93522d1a439f3617(minValue));
|
|
914
|
+
if (newDate) date = newDate;
|
|
915
|
+
}
|
|
916
|
+
if (maxValue) {
|
|
917
|
+
let newDate = $14e0f24ef4ac5c92$export$5c333a116e949cdd(date, $11d87f3f76e88657$export$93522d1a439f3617(maxValue));
|
|
918
|
+
if (newDate) date = newDate;
|
|
919
|
+
}
|
|
920
|
+
return date;
|
|
921
|
+
}
|
|
922
|
+
function $f62d864046160412$export$a1d3911297b952d7(date, minValue, isDateUnavailable) {
|
|
923
|
+
if (!isDateUnavailable) return date;
|
|
924
|
+
while (date.compare(minValue) >= 0 && isDateUnavailable(date)) date = date.subtract({
|
|
925
|
+
days: 1
|
|
926
|
+
});
|
|
927
|
+
if (date.compare(minValue) >= 0) return date;
|
|
928
|
+
return null;
|
|
929
|
+
}
|
|
930
|
+
function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
|
|
931
|
+
let defaultFormatter = useMemo(() => new $fb18d541ea1ad717$export$ad991b66133851cf(props.locale), [
|
|
932
|
+
props.locale
|
|
933
|
+
]);
|
|
934
|
+
let resolvedOptions = useMemo(() => defaultFormatter.resolvedOptions(), [
|
|
935
|
+
defaultFormatter
|
|
936
|
+
]);
|
|
937
|
+
let { locale, createCalendar, visibleDuration = {
|
|
938
|
+
months: 1
|
|
939
|
+
}, minValue, maxValue, selectionAlignment, isDateUnavailable, pageBehavior = "visible", firstDayOfWeek } = props;
|
|
940
|
+
let calendar2 = useMemo(() => createCalendar(resolvedOptions.calendar), [
|
|
941
|
+
createCalendar,
|
|
942
|
+
resolvedOptions.calendar
|
|
943
|
+
]);
|
|
944
|
+
var _props_defaultValue;
|
|
945
|
+
let [value, setControlledValue] = $458b0a5536c1a7cf$export$40bfa8c7b0832715(props.value, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : null, props.onChange);
|
|
946
|
+
let calendarDateValue = useMemo(() => value ? $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$93522d1a439f3617(value), calendar2) : null, [
|
|
947
|
+
value,
|
|
948
|
+
calendar2
|
|
949
|
+
]);
|
|
950
|
+
let timeZone = useMemo(() => value && "timeZone" in value ? value.timeZone : resolvedOptions.timeZone, [
|
|
951
|
+
value,
|
|
952
|
+
resolvedOptions.timeZone
|
|
953
|
+
]);
|
|
954
|
+
let focusedCalendarDate = useMemo(() => props.focusedValue ? $f62d864046160412$export$4f5203c0d889109e($11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$93522d1a439f3617(props.focusedValue), calendar2), minValue, maxValue) : void 0, [
|
|
955
|
+
props.focusedValue,
|
|
956
|
+
calendar2,
|
|
957
|
+
minValue,
|
|
958
|
+
maxValue
|
|
959
|
+
]);
|
|
960
|
+
let defaultFocusedCalendarDate = useMemo(() => $f62d864046160412$export$4f5203c0d889109e(props.defaultFocusedValue ? $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$93522d1a439f3617(props.defaultFocusedValue), calendar2) : calendarDateValue || $11d87f3f76e88657$export$b4a036af3fc0b032($14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(timeZone), calendar2), minValue, maxValue), [
|
|
961
|
+
props.defaultFocusedValue,
|
|
962
|
+
calendarDateValue,
|
|
963
|
+
timeZone,
|
|
964
|
+
calendar2,
|
|
965
|
+
minValue,
|
|
966
|
+
maxValue
|
|
967
|
+
]);
|
|
968
|
+
let [focusedDate, setFocusedDate] = $458b0a5536c1a7cf$export$40bfa8c7b0832715(focusedCalendarDate, defaultFocusedCalendarDate, props.onFocusChange);
|
|
969
|
+
let [startDate, setStartDate] = useState(() => {
|
|
970
|
+
switch (selectionAlignment) {
|
|
971
|
+
case "start":
|
|
972
|
+
return $f62d864046160412$export$144a00ba6044eb9(focusedDate, visibleDuration, locale, minValue, maxValue);
|
|
973
|
+
case "end":
|
|
974
|
+
return $f62d864046160412$export$530edbfc915b2b04(focusedDate, visibleDuration, locale, minValue, maxValue);
|
|
975
|
+
case "center":
|
|
976
|
+
default:
|
|
977
|
+
return $f62d864046160412$export$f4a51ff076cc9a09(focusedDate, visibleDuration, locale, minValue, maxValue);
|
|
978
|
+
}
|
|
979
|
+
});
|
|
980
|
+
let [isFocused, setFocused] = useState(props.autoFocus || false);
|
|
981
|
+
let endDate = useMemo(() => {
|
|
982
|
+
let duration = {
|
|
983
|
+
...visibleDuration
|
|
984
|
+
};
|
|
985
|
+
if (duration.days) duration.days--;
|
|
986
|
+
else duration.days = -1;
|
|
987
|
+
return startDate.add(duration);
|
|
988
|
+
}, [
|
|
989
|
+
startDate,
|
|
990
|
+
visibleDuration
|
|
991
|
+
]);
|
|
992
|
+
let [lastCalendar, setLastCalendar] = useState(calendar2);
|
|
993
|
+
if (!$14e0f24ef4ac5c92$export$dbc69fd56b53d5e(calendar2, lastCalendar)) {
|
|
994
|
+
let newFocusedDate = $11d87f3f76e88657$export$b4a036af3fc0b032(focusedDate, calendar2);
|
|
995
|
+
setStartDate($f62d864046160412$export$f4a51ff076cc9a09(newFocusedDate, visibleDuration, locale, minValue, maxValue));
|
|
996
|
+
setFocusedDate(newFocusedDate);
|
|
997
|
+
setLastCalendar(calendar2);
|
|
998
|
+
}
|
|
999
|
+
if ($f62d864046160412$export$eac50920cf2fd59a(focusedDate, minValue, maxValue))
|
|
1000
|
+
setFocusedDate($f62d864046160412$export$4f5203c0d889109e(focusedDate, minValue, maxValue));
|
|
1001
|
+
else if (focusedDate.compare(startDate) < 0) setStartDate($f62d864046160412$export$530edbfc915b2b04(focusedDate, visibleDuration, locale, minValue, maxValue));
|
|
1002
|
+
else if (focusedDate.compare(endDate) > 0) setStartDate($f62d864046160412$export$144a00ba6044eb9(focusedDate, visibleDuration, locale, minValue, maxValue));
|
|
1003
|
+
function focusCell(date) {
|
|
1004
|
+
date = $f62d864046160412$export$4f5203c0d889109e(date, minValue, maxValue);
|
|
1005
|
+
setFocusedDate(date);
|
|
1006
|
+
}
|
|
1007
|
+
function setValue(newValue) {
|
|
1008
|
+
if (!props.isDisabled && !props.isReadOnly) {
|
|
1009
|
+
let localValue = newValue;
|
|
1010
|
+
if (localValue === null) {
|
|
1011
|
+
setControlledValue(null);
|
|
1012
|
+
return;
|
|
1013
|
+
}
|
|
1014
|
+
localValue = $f62d864046160412$export$4f5203c0d889109e(localValue, minValue, maxValue);
|
|
1015
|
+
localValue = $f62d864046160412$export$a1d3911297b952d7(localValue, startDate, isDateUnavailable);
|
|
1016
|
+
if (!localValue) return;
|
|
1017
|
+
localValue = $11d87f3f76e88657$export$b4a036af3fc0b032(localValue, (value === null || value === void 0 ? void 0 : value.calendar) || new $3b62074eb05584b2$export$80ee6245ec4f29ec());
|
|
1018
|
+
if (value && "hour" in value) setControlledValue(value.set(localValue));
|
|
1019
|
+
else setControlledValue(localValue);
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
let isUnavailable = useMemo(() => {
|
|
1023
|
+
if (!calendarDateValue) return false;
|
|
1024
|
+
if (isDateUnavailable && isDateUnavailable(calendarDateValue)) return true;
|
|
1025
|
+
return $f62d864046160412$export$eac50920cf2fd59a(calendarDateValue, minValue, maxValue);
|
|
1026
|
+
}, [
|
|
1027
|
+
calendarDateValue,
|
|
1028
|
+
isDateUnavailable,
|
|
1029
|
+
minValue,
|
|
1030
|
+
maxValue
|
|
1031
|
+
]);
|
|
1032
|
+
let isValueInvalid = props.isInvalid || props.validationState === "invalid" || isUnavailable;
|
|
1033
|
+
let validationState = isValueInvalid ? "invalid" : null;
|
|
1034
|
+
let pageDuration = useMemo(() => {
|
|
1035
|
+
if (pageBehavior === "visible") return visibleDuration;
|
|
1036
|
+
return $131cf43a05231e1e$var$unitDuration(visibleDuration);
|
|
1037
|
+
}, [
|
|
1038
|
+
pageBehavior,
|
|
1039
|
+
visibleDuration
|
|
1040
|
+
]);
|
|
1041
|
+
var _props_isDisabled, _props_isReadOnly;
|
|
1042
|
+
return {
|
|
1043
|
+
isDisabled: (_props_isDisabled = props.isDisabled) !== null && _props_isDisabled !== void 0 ? _props_isDisabled : false,
|
|
1044
|
+
isReadOnly: (_props_isReadOnly = props.isReadOnly) !== null && _props_isReadOnly !== void 0 ? _props_isReadOnly : false,
|
|
1045
|
+
value: calendarDateValue,
|
|
1046
|
+
setValue,
|
|
1047
|
+
visibleRange: {
|
|
1048
|
+
start: startDate,
|
|
1049
|
+
end: endDate
|
|
1050
|
+
},
|
|
1051
|
+
minValue,
|
|
1052
|
+
maxValue,
|
|
1053
|
+
focusedDate,
|
|
1054
|
+
timeZone,
|
|
1055
|
+
validationState,
|
|
1056
|
+
isValueInvalid,
|
|
1057
|
+
setFocusedDate(date) {
|
|
1058
|
+
focusCell(date);
|
|
1059
|
+
setFocused(true);
|
|
1060
|
+
},
|
|
1061
|
+
focusNextDay() {
|
|
1062
|
+
focusCell(focusedDate.add({
|
|
1063
|
+
days: 1
|
|
1064
|
+
}));
|
|
1065
|
+
},
|
|
1066
|
+
focusPreviousDay() {
|
|
1067
|
+
focusCell(focusedDate.subtract({
|
|
1068
|
+
days: 1
|
|
1069
|
+
}));
|
|
1070
|
+
},
|
|
1071
|
+
focusNextRow() {
|
|
1072
|
+
if (visibleDuration.days) this.focusNextPage();
|
|
1073
|
+
else if (visibleDuration.weeks || visibleDuration.months || visibleDuration.years) focusCell(focusedDate.add({
|
|
1074
|
+
weeks: 1
|
|
1075
|
+
}));
|
|
1076
|
+
},
|
|
1077
|
+
focusPreviousRow() {
|
|
1078
|
+
if (visibleDuration.days) this.focusPreviousPage();
|
|
1079
|
+
else if (visibleDuration.weeks || visibleDuration.months || visibleDuration.years) focusCell(focusedDate.subtract({
|
|
1080
|
+
weeks: 1
|
|
1081
|
+
}));
|
|
1082
|
+
},
|
|
1083
|
+
focusNextPage() {
|
|
1084
|
+
let start = startDate.add(pageDuration);
|
|
1085
|
+
setFocusedDate($f62d864046160412$export$4f5203c0d889109e(focusedDate.add(pageDuration), minValue, maxValue));
|
|
1086
|
+
setStartDate($f62d864046160412$export$144a00ba6044eb9($f62d864046160412$export$5bb865b12696a77d(focusedDate, start, pageDuration, locale, minValue, maxValue), pageDuration, locale));
|
|
1087
|
+
},
|
|
1088
|
+
focusPreviousPage() {
|
|
1089
|
+
let start = startDate.subtract(pageDuration);
|
|
1090
|
+
setFocusedDate($f62d864046160412$export$4f5203c0d889109e(focusedDate.subtract(pageDuration), minValue, maxValue));
|
|
1091
|
+
setStartDate($f62d864046160412$export$144a00ba6044eb9($f62d864046160412$export$5bb865b12696a77d(focusedDate, start, pageDuration, locale, minValue, maxValue), pageDuration, locale));
|
|
1092
|
+
},
|
|
1093
|
+
focusSectionStart() {
|
|
1094
|
+
if (visibleDuration.days) focusCell(startDate);
|
|
1095
|
+
else if (visibleDuration.weeks) focusCell($14e0f24ef4ac5c92$export$42c81a444fbfb5d4(focusedDate, locale));
|
|
1096
|
+
else if (visibleDuration.months || visibleDuration.years) focusCell($14e0f24ef4ac5c92$export$a5a3b454ada2268e(focusedDate));
|
|
1097
|
+
},
|
|
1098
|
+
focusSectionEnd() {
|
|
1099
|
+
if (visibleDuration.days) focusCell(endDate);
|
|
1100
|
+
else if (visibleDuration.weeks) focusCell($14e0f24ef4ac5c92$export$ef8b6d9133084f4e(focusedDate, locale));
|
|
1101
|
+
else if (visibleDuration.months || visibleDuration.years) focusCell($14e0f24ef4ac5c92$export$a2258d9c4118825c(focusedDate));
|
|
1102
|
+
},
|
|
1103
|
+
focusNextSection(larger) {
|
|
1104
|
+
if (!larger && !visibleDuration.days) {
|
|
1105
|
+
focusCell(focusedDate.add($131cf43a05231e1e$var$unitDuration(visibleDuration)));
|
|
1106
|
+
return;
|
|
1107
|
+
}
|
|
1108
|
+
if (visibleDuration.days) this.focusNextPage();
|
|
1109
|
+
else if (visibleDuration.weeks) focusCell(focusedDate.add({
|
|
1110
|
+
months: 1
|
|
1111
|
+
}));
|
|
1112
|
+
else if (visibleDuration.months || visibleDuration.years) focusCell(focusedDate.add({
|
|
1113
|
+
years: 1
|
|
1114
|
+
}));
|
|
1115
|
+
},
|
|
1116
|
+
focusPreviousSection(larger) {
|
|
1117
|
+
if (!larger && !visibleDuration.days) {
|
|
1118
|
+
focusCell(focusedDate.subtract($131cf43a05231e1e$var$unitDuration(visibleDuration)));
|
|
1119
|
+
return;
|
|
1120
|
+
}
|
|
1121
|
+
if (visibleDuration.days) this.focusPreviousPage();
|
|
1122
|
+
else if (visibleDuration.weeks) focusCell(focusedDate.subtract({
|
|
1123
|
+
months: 1
|
|
1124
|
+
}));
|
|
1125
|
+
else if (visibleDuration.months || visibleDuration.years) focusCell(focusedDate.subtract({
|
|
1126
|
+
years: 1
|
|
1127
|
+
}));
|
|
1128
|
+
},
|
|
1129
|
+
selectFocusedDate() {
|
|
1130
|
+
if (!(isDateUnavailable && isDateUnavailable(focusedDate))) setValue(focusedDate);
|
|
1131
|
+
},
|
|
1132
|
+
selectDate(date) {
|
|
1133
|
+
setValue(date);
|
|
1134
|
+
},
|
|
1135
|
+
isFocused,
|
|
1136
|
+
setFocused,
|
|
1137
|
+
isInvalid(date) {
|
|
1138
|
+
return $f62d864046160412$export$eac50920cf2fd59a(date, minValue, maxValue);
|
|
1139
|
+
},
|
|
1140
|
+
isSelected(date) {
|
|
1141
|
+
return calendarDateValue != null && $14e0f24ef4ac5c92$export$ea39ec197993aef0(date, calendarDateValue) && !this.isCellDisabled(date) && !this.isCellUnavailable(date);
|
|
1142
|
+
},
|
|
1143
|
+
isCellFocused(date) {
|
|
1144
|
+
return isFocused && focusedDate && $14e0f24ef4ac5c92$export$ea39ec197993aef0(date, focusedDate);
|
|
1145
|
+
},
|
|
1146
|
+
isCellDisabled(date) {
|
|
1147
|
+
return props.isDisabled || date.compare(startDate) < 0 || date.compare(endDate) > 0 || this.isInvalid(date);
|
|
1148
|
+
},
|
|
1149
|
+
isCellUnavailable(date) {
|
|
1150
|
+
return props.isDateUnavailable ? props.isDateUnavailable(date) : false;
|
|
1151
|
+
},
|
|
1152
|
+
isPreviousVisibleRangeInvalid() {
|
|
1153
|
+
let prev = startDate.subtract({
|
|
1154
|
+
days: 1
|
|
1155
|
+
});
|
|
1156
|
+
return $14e0f24ef4ac5c92$export$ea39ec197993aef0(prev, startDate) || this.isInvalid(prev);
|
|
1157
|
+
},
|
|
1158
|
+
isNextVisibleRangeInvalid() {
|
|
1159
|
+
let next = endDate.add({
|
|
1160
|
+
days: 1
|
|
1161
|
+
});
|
|
1162
|
+
return $14e0f24ef4ac5c92$export$ea39ec197993aef0(next, endDate) || this.isInvalid(next);
|
|
1163
|
+
},
|
|
1164
|
+
getDatesInWeek(weekIndex, from = startDate) {
|
|
1165
|
+
let date = from.add({
|
|
1166
|
+
weeks: weekIndex
|
|
1167
|
+
});
|
|
1168
|
+
let dates = [];
|
|
1169
|
+
date = $14e0f24ef4ac5c92$export$42c81a444fbfb5d4(date, locale, firstDayOfWeek);
|
|
1170
|
+
let dayOfWeek = $14e0f24ef4ac5c92$export$2061056d06d7cdf7(date, locale, firstDayOfWeek);
|
|
1171
|
+
for (let i = 0; i < dayOfWeek; i++) dates.push(null);
|
|
1172
|
+
while (dates.length < 7) {
|
|
1173
|
+
dates.push(date);
|
|
1174
|
+
let nextDate = date.add({
|
|
1175
|
+
days: 1
|
|
1176
|
+
});
|
|
1177
|
+
if ($14e0f24ef4ac5c92$export$ea39ec197993aef0(date, nextDate)) break;
|
|
1178
|
+
date = nextDate;
|
|
1179
|
+
}
|
|
1180
|
+
while (dates.length < 7) dates.push(null);
|
|
1181
|
+
return dates;
|
|
1182
|
+
}
|
|
1183
|
+
};
|
|
1184
|
+
}
|
|
1185
|
+
function $131cf43a05231e1e$var$unitDuration(duration) {
|
|
1186
|
+
let unit = {
|
|
1187
|
+
...duration
|
|
1188
|
+
};
|
|
1189
|
+
for (let key in duration) unit[key] = 1;
|
|
1190
|
+
return unit;
|
|
1191
|
+
}
|
|
1192
|
+
const calendar = "_calendar_3rifq_1";
|
|
1193
|
+
const styles = {
|
|
1194
|
+
calendar,
|
|
1195
|
+
"calendar-header": "_calendar-header_3rifq_17",
|
|
1196
|
+
"calendar-grid": "_calendar-grid_3rifq_41",
|
|
1197
|
+
"calendar-grid-header__cell": "_calendar-grid-header__cell_3rifq_45",
|
|
1198
|
+
"calendar-grid__cell": "_calendar-grid__cell_3rifq_65"
|
|
1199
|
+
};
|
|
1200
|
+
const trueOrUndefined = (bool) => bool || void 0;
|
|
1201
|
+
const CalendarContext = createContext({
|
|
1202
|
+
state: {}
|
|
1203
|
+
});
|
|
1204
|
+
const useCalendarContext = () => useContext(CalendarContext);
|
|
1205
|
+
const CalendarCell = ({
|
|
1206
|
+
date
|
|
1207
|
+
}) => {
|
|
1208
|
+
const ref = React__default.useRef(null);
|
|
1209
|
+
const {
|
|
1210
|
+
state
|
|
1211
|
+
} = useCalendarContext();
|
|
1212
|
+
const {
|
|
1213
|
+
cellProps,
|
|
1214
|
+
buttonProps,
|
|
1215
|
+
isOutsideVisibleRange,
|
|
1216
|
+
formattedDate,
|
|
1217
|
+
isFocused,
|
|
1218
|
+
isPressed,
|
|
1219
|
+
isSelected,
|
|
1220
|
+
isUnavailable
|
|
1221
|
+
} = useCalendarCell({
|
|
1222
|
+
date
|
|
1223
|
+
}, state, ref);
|
|
1224
|
+
const isDateToday = $14e0f24ef4ac5c92$export$629b0a497aa65267(date, $14e0f24ef4ac5c92$export$aa8b41735afcabd2());
|
|
1225
|
+
const dateButtonProps = {
|
|
1226
|
+
...buttonProps,
|
|
1227
|
+
ref,
|
|
1228
|
+
className: styles["calendar-grid__cell"],
|
|
1229
|
+
hidden: isOutsideVisibleRange,
|
|
1230
|
+
"data-focused": trueOrUndefined(isFocused),
|
|
1231
|
+
"data-pressed": trueOrUndefined(isPressed),
|
|
1232
|
+
"data-unavailable": trueOrUndefined(isUnavailable),
|
|
1233
|
+
"data-selected": trueOrUndefined(isSelected),
|
|
1234
|
+
"data-today": trueOrUndefined(isDateToday)
|
|
1235
|
+
};
|
|
1236
|
+
return /* @__PURE__ */ jsx("td", { ...cellProps, children: /* @__PURE__ */ jsx("button", { ...dateButtonProps, children: formattedDate }) });
|
|
1237
|
+
};
|
|
1238
|
+
const CalendarGrid = forwardRef(function CalendarGrid2(props, forwardedRef) {
|
|
1239
|
+
const {
|
|
1240
|
+
state
|
|
1241
|
+
} = useCalendarContext();
|
|
1242
|
+
const {
|
|
1243
|
+
gridProps,
|
|
1244
|
+
headerProps,
|
|
1245
|
+
weekDays,
|
|
1246
|
+
weeksInMonth
|
|
1247
|
+
} = useCalendarGrid({
|
|
1248
|
+
...props,
|
|
1249
|
+
weekdayStyle: "short"
|
|
1250
|
+
}, state);
|
|
1251
|
+
return /* @__PURE__ */ jsxs("table", { className: styles["calendar-grid"], ...gridProps, ref: forwardedRef, children: [
|
|
1252
|
+
/* @__PURE__ */ jsx("thead", { className: styles["calendar-grid-header"], ...headerProps, children: /* @__PURE__ */ jsx("tr", { children: weekDays.map((day, index) => /* @__PURE__ */ jsx("th", { scope: "col", className: styles["calendar-grid-header__cell"], children: day }, index)) }) }),
|
|
1253
|
+
/* @__PURE__ */ jsx("tbody", { children: [...new Array(weeksInMonth).keys()].map((weekIndex) => /* @__PURE__ */ jsx("tr", { children: state.getDatesInWeek(weekIndex, props.startDate).map((date, i) => {
|
|
1254
|
+
if (!date) return /* @__PURE__ */ jsx("td", {}, i);
|
|
1255
|
+
const isInCurrentRange = date.compare(props.startDate) >= 0 && date.compare(props.endDate) <= 0;
|
|
1256
|
+
if (!isInCurrentRange) return /* @__PURE__ */ jsx("td", {}, i);
|
|
1257
|
+
if (props.renderCell !== void 0) return props.renderCell(date);
|
|
1258
|
+
return /* @__PURE__ */ jsx(CalendarCell, { date }, i);
|
|
1259
|
+
}) }, weekIndex)) })
|
|
1260
|
+
] });
|
|
1261
|
+
});
|
|
1262
|
+
const Calendar = forwardRef(function Calendar2(props, forwardedRef) {
|
|
1263
|
+
const {
|
|
1264
|
+
locale
|
|
1265
|
+
} = useLocale();
|
|
1266
|
+
const {
|
|
1267
|
+
isInDatePicker
|
|
1268
|
+
} = useDatePickerContext();
|
|
1269
|
+
const visibleDuration = useMemo(() => {
|
|
1270
|
+
var _a, _b, _c, _d, _e;
|
|
1271
|
+
const defaultVisibleDuration = {
|
|
1272
|
+
months: 1
|
|
1273
|
+
};
|
|
1274
|
+
if (!props.visibleDuration) return defaultVisibleDuration;
|
|
1275
|
+
if (!((_a = props.visibleDuration) == null ? void 0 : _a.days) && !((_b = props.visibleDuration) == null ? void 0 : _b.weeks) && !((_c = props.visibleDuration) == null ? void 0 : _c.months) && !((_d = props.visibleDuration) == null ? void 0 : _d.years)) {
|
|
1276
|
+
return defaultVisibleDuration;
|
|
1277
|
+
}
|
|
1278
|
+
if ((_e = props.visibleDuration) == null ? void 0 : _e.years) {
|
|
1279
|
+
return {
|
|
1280
|
+
months: props.visibleDuration.years * 12
|
|
1281
|
+
};
|
|
1282
|
+
}
|
|
1283
|
+
return props.visibleDuration;
|
|
1284
|
+
}, [props.visibleDuration]);
|
|
1285
|
+
const parsedProps = {
|
|
1286
|
+
...props,
|
|
1287
|
+
visibleDuration,
|
|
1288
|
+
// date value
|
|
1289
|
+
defaultValue: parseDateValue(props == null ? void 0 : props.defaultValue),
|
|
1290
|
+
value: parseDateValue(props == null ? void 0 : props.value),
|
|
1291
|
+
onChange: (dateValue) => {
|
|
1292
|
+
if (!(props == null ? void 0 : props.onChange)) return;
|
|
1293
|
+
if (isInDatePicker) {
|
|
1294
|
+
const onChange = props.onChange;
|
|
1295
|
+
return onChange(dateValue);
|
|
1296
|
+
} else {
|
|
1297
|
+
const onChange = props.onChange;
|
|
1298
|
+
return onChange(dateValue.toDate("UTC").toISOString());
|
|
1299
|
+
}
|
|
1300
|
+
},
|
|
1301
|
+
// focused value
|
|
1302
|
+
focusedValue: parseDateValue(props == null ? void 0 : props.focusedValue),
|
|
1303
|
+
defaultFocusedValue: parseDateValue(props.defaultFocusedValue),
|
|
1304
|
+
onFocusChange: (dateValue) => {
|
|
1305
|
+
if (!(props == null ? void 0 : props.onFocusChange)) return;
|
|
1306
|
+
if (isInDatePicker) {
|
|
1307
|
+
const onFocusChange = props.onFocusChange;
|
|
1308
|
+
return onFocusChange(dateValue);
|
|
1309
|
+
} else {
|
|
1310
|
+
const onFocusChange = props.onFocusChange;
|
|
1311
|
+
return onFocusChange(dateValue.toDate("UTC").toISOString());
|
|
1312
|
+
}
|
|
1313
|
+
},
|
|
1314
|
+
// config
|
|
1315
|
+
minValue: parseDateValue(props == null ? void 0 : props.minValue),
|
|
1316
|
+
maxValue: parseDateValue(props == null ? void 0 : props.maxValue),
|
|
1317
|
+
isDateUnavailable: (dateValue) => {
|
|
1318
|
+
if (!(props == null ? void 0 : props.isDateUnavailable)) return false;
|
|
1319
|
+
if (isInDatePicker) {
|
|
1320
|
+
const isDateUnavailable = props.isDateUnavailable;
|
|
1321
|
+
return isDateUnavailable(dateValue);
|
|
1322
|
+
} else {
|
|
1323
|
+
const isDateUnavailable = props.isDateUnavailable;
|
|
1324
|
+
return isDateUnavailable(dateValue.toDate("UTC").toISOString());
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
};
|
|
1328
|
+
const state = $131cf43a05231e1e$export$6d095e787d2b5e1f({
|
|
1329
|
+
createCalendar: $64244302c3013299$export$dd0bbc9b26defe37,
|
|
1330
|
+
...parsedProps,
|
|
1331
|
+
locale
|
|
1332
|
+
});
|
|
1333
|
+
const {
|
|
1334
|
+
calendarProps,
|
|
1335
|
+
prevButtonProps,
|
|
1336
|
+
nextButtonProps
|
|
1337
|
+
} = useCalendar(parsedProps, state);
|
|
1338
|
+
const sharedIconButtonProps = {
|
|
1339
|
+
styleVariant: "accent",
|
|
1340
|
+
emphasis: "quaternary",
|
|
1341
|
+
size: "sm"
|
|
1342
|
+
};
|
|
1343
|
+
const monthFormatter = useDateFormatter({
|
|
1344
|
+
month: "long",
|
|
1345
|
+
year: "numeric",
|
|
1346
|
+
timeZone: state.timeZone
|
|
1347
|
+
});
|
|
1348
|
+
return /* @__PURE__ */ jsx("div", { ...calendarProps, className: styles.calendar, ref: forwardedRef, children: /* @__PURE__ */ jsx(CalendarContext.Provider, { value: {
|
|
1349
|
+
state
|
|
1350
|
+
}, children: [...Array(visibleDuration.months).keys()].map((i) => {
|
|
1351
|
+
const startDate = state.visibleRange.start.add({
|
|
1352
|
+
months: i
|
|
1353
|
+
});
|
|
1354
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
1355
|
+
/* @__PURE__ */ jsxs("div", { className: styles["calendar-header"], children: [
|
|
1356
|
+
i === 0 && /* @__PURE__ */ jsx(IconButton, { iconProps: {
|
|
1357
|
+
iconName: "chevron-left"
|
|
1358
|
+
}, ...sharedIconButtonProps, ...prevButtonProps }),
|
|
1359
|
+
/* @__PURE__ */ jsx(Heading, { size: "xxs", as: "h3", textAlign: "center", children: monthFormatter.format(startDate.toDate(state.timeZone)) }),
|
|
1360
|
+
i === (visibleDuration.months || 1) - 1 && /* @__PURE__ */ jsx(IconButton, { iconProps: {
|
|
1361
|
+
iconName: "chevron-right"
|
|
1362
|
+
}, ...sharedIconButtonProps, ...nextButtonProps })
|
|
1363
|
+
] }),
|
|
1364
|
+
/* @__PURE__ */ jsx(Box, { padding: "4xs", maxWidth: "pageWidth", children: /* @__PURE__ */ jsx(CalendarGrid, { startDate, endDate: $14e0f24ef4ac5c92$export$a2258d9c4118825c(startDate), renderCell: props.children }) })
|
|
1365
|
+
] }, i);
|
|
1366
|
+
}) }) });
|
|
1367
|
+
});
|
|
1368
|
+
export {
|
|
1369
|
+
$fb18d541ea1ad717$export$ad991b66133851cf as $,
|
|
1370
|
+
Calendar as C,
|
|
1371
|
+
CalendarCell as a,
|
|
1372
|
+
useCalendarContext as u
|
|
1373
|
+
};
|
|
1374
|
+
//# sourceMappingURL=Calendar-CeNON3JV.js.map
|