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