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