dgz-ui
Version:
Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript
1,701 lines • 115 kB
JavaScript
import { jsx as C, jsxs as se } from "react/jsx-runtime";
import y, { createContext as jn, useContext as zn, useCallback as I, useRef as Fe, useLayoutEffect as $n, useState as ee, useEffect as Ze, useMemo as he, forwardRef as Gn } from "react";
import { useTranslation as Le } from "react-i18next";
import { dayjs as j } from "../utils/index.es.js";
import { t as Rn, c as L } from "./utils-CnvKSirc.es.js";
import { B as oe, b as mt } from "./button-DTRIYqDb.es.js";
import { P as Vn, b as Qn, a as Un } from "./popover-BredK0sg.es.js";
import { J as _t, r as Et, g as Xn } from "./index-Br4MVOGV.es.js";
import { c as Kn } from "./createLucideIcon-CyFYF6Ug.es.js";
import { S as yt, h as gt, i as bt, a as wt, c as Mt } from "./select-BTgKkicD.es.js";
/**
* @license lucide-react v0.563.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const Jn = [
["path", { d: "M8 2v4", key: "1cmpym" }],
["path", { d: "M16 2v4", key: "4m81vk" }],
["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
["path", { d: "M3 10h18", key: "8toen8" }]
], Zn = Kn("calendar", Jn);
function Ln(e, t, n = "long") {
return new Intl.DateTimeFormat("en-US", {
// Enforces engine to render the time. Without the option JavaScriptCore omits it.
hour: "numeric",
timeZone: e,
timeZoneName: n
}).format(t).split(/\s/g).slice(2).join(" ");
}
const Re = {}, We = {};
function fe(e, t) {
try {
const r = (Re[e] || (Re[e] = new Intl.DateTimeFormat("en-US", {
timeZone: e,
timeZoneName: "longOffset"
}).format))(t).split("GMT")[1];
return r in We ? We[r] : kt(r, r.split(":"));
} catch {
if (e in We) return We[e];
const n = e == null ? void 0 : e.match(er);
return n ? kt(e, n.slice(1)) : NaN;
}
}
const er = /([+-]\d\d):?(\d\d)?/;
function kt(e, t) {
const n = +(t[0] || 0), r = +(t[1] || 0), a = +(t[2] || 0) / 60;
return We[e] = n * 60 + r > 0 ? n * 60 + r + a : n * 60 - r - a;
}
class te extends Date {
//#region static
constructor(...t) {
super(), t.length > 1 && typeof t[t.length - 1] == "string" && (this.timeZone = t.pop()), this.internal = /* @__PURE__ */ new Date(), isNaN(fe(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)), Ft(this), Je(this)) : this.setTime(Date.now());
}
static tz(t, ...n) {
return n.length ? new te(...n, t) : new te(Date.now(), t);
}
//#endregion
//#region time zone
withTimeZone(t) {
return new te(+this, t);
}
getTimezoneOffset() {
const t = -fe(this.timeZone, this);
return t > 0 ? Math.floor(t) : Math.ceil(t);
}
//#endregion
//#region time
setTime(t) {
return Date.prototype.setTime.apply(this, arguments), Je(this), +this;
}
//#endregion
//#region date-fns integration
[Symbol.for("constructDateFrom")](t) {
return new te(+new Date(t), this.timeZone);
}
//#endregion
}
const Dt = /^(get|set)(?!UTC)/;
Object.getOwnPropertyNames(Date.prototype).forEach((e) => {
if (!Dt.test(e)) return;
const t = e.replace(Dt, "$1UTC");
te.prototype[t] && (e.startsWith("get") ? te.prototype[e] = function() {
return this.internal[t]();
} : (te.prototype[e] = function() {
return Date.prototype[t].apply(this.internal, arguments), tr(this), +this;
}, te.prototype[t] = function() {
return Date.prototype[t].apply(this, arguments), Je(this), +this;
}));
});
function Je(e) {
e.internal.setTime(+e), e.internal.setUTCSeconds(e.internal.getUTCSeconds() - Math.round(-fe(e.timeZone, e) * 60));
}
function tr(e) {
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()), Ft(e);
}
function Ft(e) {
const t = fe(e.timeZone, e), n = t > 0 ? Math.floor(t) : Math.ceil(t), r = /* @__PURE__ */ new Date(+e);
r.setUTCHours(r.getUTCHours() - 1);
const a = -(/* @__PURE__ */ new Date(+e)).getTimezoneOffset(), o = -(/* @__PURE__ */ new Date(+r)).getTimezoneOffset(), s = a - o, i = Date.prototype.getHours.apply(e) !== e.internal.getUTCHours();
s && i && e.internal.setUTCMinutes(e.internal.getUTCMinutes() + s);
const c = a - n;
c && Date.prototype.setUTCMinutes.call(e, Date.prototype.getUTCMinutes.call(e) + c);
const u = /* @__PURE__ */ new Date(+e);
u.setUTCSeconds(0);
const l = a > 0 ? u.getSeconds() : (u.getSeconds() - 60) % 60, d = Math.round(-(fe(e.timeZone, e) * 60)) % 60;
(d || l) && (e.internal.setUTCSeconds(e.internal.getUTCSeconds() + d), Date.prototype.setUTCSeconds.call(e, Date.prototype.getUTCSeconds.call(e) + d + l));
const h = fe(e.timeZone, e), b = h > 0 ? Math.floor(h) : Math.ceil(h), D = -(/* @__PURE__ */ new Date(+e)).getTimezoneOffset() - b, M = b !== n, v = D - c;
if (M && v) {
Date.prototype.setUTCMinutes.call(e, Date.prototype.getUTCMinutes.call(e) + v);
const g = fe(e.timeZone, e), w = g > 0 ? Math.floor(g) : Math.ceil(g), N = b - w;
N && (e.internal.setUTCMinutes(e.internal.getUTCMinutes() + N), Date.prototype.setUTCMinutes.call(e, Date.prototype.getUTCMinutes.call(e) + N));
}
}
class q extends te {
//#region static
static tz(t, ...n) {
return n.length ? new q(...n, t) : new q(Date.now(), t);
}
//#endregion
//#region representation
toISOString() {
const [t, n, r] = this.tzComponents(), a = `${t}${n}:${r}`;
return this.internal.toISOString().slice(0, -1) + a;
}
toString() {
return `${this.toDateString()} ${this.toTimeString()}`;
}
toDateString() {
const [t, n, r, a] = this.internal.toUTCString().split(" ");
return `${t == null ? void 0 : t.slice(0, -1)} ${r} ${n} ${a}`;
}
toTimeString() {
const t = this.internal.toUTCString().split(" ")[4], [n, r, a] = this.tzComponents();
return `${t} GMT${n}${r}${a} (${Ln(this.timeZone, this)})`;
}
toLocaleString(t, n) {
return Date.prototype.toLocaleString.call(this, t, {
...n,
timeZone: (n == null ? void 0 : n.timeZone) || this.timeZone
});
}
toLocaleDateString(t, n) {
return Date.prototype.toLocaleDateString.call(this, t, {
...n,
timeZone: (n == null ? void 0 : n.timeZone) || this.timeZone
});
}
toLocaleTimeString(t, n) {
return Date.prototype.toLocaleTimeString.call(this, t, {
...n,
timeZone: (n == null ? void 0 : n.timeZone) || this.timeZone
});
}
//#endregion
//#region private
tzComponents() {
const t = this.getTimezoneOffset(), n = t > 0 ? "-" : "+", r = String(Math.floor(Math.abs(t) / 60)).padStart(2, "0"), a = String(Math.abs(t) % 60).padStart(2, "0");
return [n, r, a];
}
//#endregion
withTimeZone(t) {
return new q(+this, t);
}
//#region date-fns integration
[Symbol.for("constructDateFrom")](t) {
return new q(+new Date(t), this.timeZone);
}
//#endregion
}
const Bt = 6048e5, nr = 864e5, vt = Symbol.for("constructDateFrom");
function H(e, t) {
return typeof e == "function" ? e(t) : e && typeof e == "object" && vt in e ? e[vt](t) : e instanceof Date ? new e.constructor(t) : new Date(t);
}
function _(e, t) {
return H(t || e, e);
}
function It(e, t, n) {
const r = _(e, n == null ? void 0 : n.in);
return isNaN(t) ? H(e, NaN) : (t && r.setDate(r.getDate() + t), r);
}
function Ht(e, t, n) {
const r = _(e, n == null ? void 0 : n.in);
if (isNaN(t)) return H(e, NaN);
if (!t)
return r;
const a = r.getDate(), o = H(e, r.getTime());
o.setMonth(r.getMonth() + t + 1, 0);
const s = o.getDate();
return a >= s ? o : (r.setFullYear(
o.getFullYear(),
o.getMonth(),
a
), r);
}
let rr = {};
function Ce() {
return rr;
}
function we(e, t) {
var i, c, u, l;
const n = Ce(), r = (t == null ? void 0 : t.weekStartsOn) ?? ((c = (i = t == null ? void 0 : t.locale) == null ? void 0 : i.options) == null ? void 0 : c.weekStartsOn) ?? n.weekStartsOn ?? ((l = (u = n.locale) == null ? void 0 : u.options) == null ? void 0 : l.weekStartsOn) ?? 0, a = _(e, t == null ? void 0 : t.in), o = a.getDay(), s = (o < r ? 7 : 0) + o - r;
return a.setDate(a.getDate() - s), a.setHours(0, 0, 0, 0), a;
}
function Ne(e, t) {
return we(e, { ...t, weekStartsOn: 1 });
}
function At(e, t) {
const n = _(e, t == null ? void 0 : t.in), r = n.getFullYear(), a = H(n, 0);
a.setFullYear(r + 1, 0, 4), a.setHours(0, 0, 0, 0);
const o = Ne(a), s = H(n, 0);
s.setFullYear(r, 0, 4), s.setHours(0, 0, 0, 0);
const i = Ne(s);
return n.getTime() >= o.getTime() ? r + 1 : n.getTime() >= i.getTime() ? r : r - 1;
}
function Ot(e) {
const t = _(e), n = new Date(
Date.UTC(
t.getFullYear(),
t.getMonth(),
t.getDate(),
t.getHours(),
t.getMinutes(),
t.getSeconds(),
t.getMilliseconds()
)
);
return n.setUTCFullYear(t.getFullYear()), +e - +n;
}
function Me(e, ...t) {
const n = H.bind(
null,
t.find((r) => typeof r == "object")
);
return t.map(n);
}
function xe(e, t) {
const n = _(e, t == null ? void 0 : t.in);
return n.setHours(0, 0, 0, 0), n;
}
function et(e, t, n) {
const [r, a] = Me(
n == null ? void 0 : n.in,
e,
t
), o = xe(r), s = xe(a), i = +o - Ot(o), c = +s - Ot(s);
return Math.round((i - c) / nr);
}
function ar(e, t) {
const n = At(e, t), r = H(e, 0);
return r.setFullYear(n, 0, 4), r.setHours(0, 0, 0, 0), Ne(r);
}
function or(e, t, n) {
return It(e, t * 7, n);
}
function sr(e, t, n) {
return Ht(e, t * 12, n);
}
function ir(e, t) {
let n, r = t == null ? void 0 : t.in;
return e.forEach((a) => {
!r && typeof a == "object" && (r = H.bind(null, a));
const o = _(a, r);
(!n || n < o || isNaN(+o)) && (n = o);
}), H(r, n || NaN);
}
function cr(e, t) {
let n, r = t == null ? void 0 : t.in;
return e.forEach((a) => {
!r && typeof a == "object" && (r = H.bind(null, a));
const o = _(a, r);
(!n || n > o || isNaN(+o)) && (n = o);
}), H(r, n || NaN);
}
function ur(e, t, n) {
const [r, a] = Me(
n == null ? void 0 : n.in,
e,
t
);
return +xe(r) == +xe(a);
}
function qt(e) {
return e instanceof Date || typeof e == "object" && Object.prototype.toString.call(e) === "[object Date]";
}
function lr(e) {
return !(!qt(e) && typeof e != "number" || isNaN(+_(e)));
}
function jt(e, t, n) {
const [r, a] = Me(
n == null ? void 0 : n.in,
e,
t
), o = r.getFullYear() - a.getFullYear(), s = r.getMonth() - a.getMonth();
return o * 12 + s;
}
function dr(e, t) {
const n = _(e, t == null ? void 0 : t.in), r = n.getMonth();
return n.setFullYear(n.getFullYear(), r + 1, 0), n.setHours(23, 59, 59, 999), n;
}
function zt(e, t) {
const [n, r] = Me(e, t.start, t.end);
return { start: n, end: r };
}
function fr(e, t) {
const { start: n, end: r } = zt(t == null ? void 0 : t.in, e);
let a = +n > +r;
const o = a ? +n : +r, s = a ? r : n;
s.setHours(0, 0, 0, 0), s.setDate(1);
let i = 1;
const c = [];
for (; +s <= o; )
c.push(H(n, s)), s.setMonth(s.getMonth() + i);
return a ? c.reverse() : c;
}
function hr(e, t) {
const n = _(e, t == null ? void 0 : t.in);
return n.setDate(1), n.setHours(0, 0, 0, 0), n;
}
function mr(e, t) {
const n = _(e, t == null ? void 0 : t.in), r = n.getFullYear();
return n.setFullYear(r + 1, 0, 0), n.setHours(23, 59, 59, 999), n;
}
function $t(e, t) {
const n = _(e, t == null ? void 0 : t.in);
return n.setFullYear(n.getFullYear(), 0, 1), n.setHours(0, 0, 0, 0), n;
}
function yr(e, t) {
const { start: n, end: r } = zt(t == null ? void 0 : t.in, e);
let a = +n > +r;
const o = a ? +n : +r, s = a ? r : n;
s.setHours(0, 0, 0, 0), s.setMonth(0, 1);
let i = 1;
const c = [];
for (; +s <= o; )
c.push(H(n, s)), s.setFullYear(s.getFullYear() + i);
return a ? c.reverse() : c;
}
function Gt(e, t) {
var i, c, u, l;
const n = Ce(), r = (t == null ? void 0 : t.weekStartsOn) ?? ((c = (i = t == null ? void 0 : t.locale) == null ? void 0 : i.options) == null ? void 0 : c.weekStartsOn) ?? n.weekStartsOn ?? ((l = (u = n.locale) == null ? void 0 : u.options) == null ? void 0 : l.weekStartsOn) ?? 0, a = _(e, t == null ? void 0 : t.in), o = a.getDay(), s = (o < r ? -7 : 0) + 6 - (o - r);
return a.setDate(a.getDate() + s), a.setHours(23, 59, 59, 999), a;
}
function gr(e, t) {
return Gt(e, { ...t, weekStartsOn: 1 });
}
const br = {
lessThanXSeconds: {
one: "less than a second",
other: "less than {{count}} seconds"
},
xSeconds: {
one: "1 second",
other: "{{count}} seconds"
},
halfAMinute: "half a minute",
lessThanXMinutes: {
one: "less than a minute",
other: "less than {{count}} minutes"
},
xMinutes: {
one: "1 minute",
other: "{{count}} minutes"
},
aboutXHours: {
one: "about 1 hour",
other: "about {{count}} hours"
},
xHours: {
one: "1 hour",
other: "{{count}} hours"
},
xDays: {
one: "1 day",
other: "{{count}} days"
},
aboutXWeeks: {
one: "about 1 week",
other: "about {{count}} weeks"
},
xWeeks: {
one: "1 week",
other: "{{count}} weeks"
},
aboutXMonths: {
one: "about 1 month",
other: "about {{count}} months"
},
xMonths: {
one: "1 month",
other: "{{count}} months"
},
aboutXYears: {
one: "about 1 year",
other: "about {{count}} years"
},
xYears: {
one: "1 year",
other: "{{count}} years"
},
overXYears: {
one: "over 1 year",
other: "over {{count}} years"
},
almostXYears: {
one: "almost 1 year",
other: "almost {{count}} years"
}
}, wr = (e, t, n) => {
let r;
const a = br[e];
return typeof a == "string" ? r = a : t === 1 ? r = a.one : r = a.other.replace("{{count}}", t.toString()), n != null && n.addSuffix ? n.comparison && n.comparison > 0 ? "in " + r : r + " ago" : r;
};
function Ve(e) {
return (t = {}) => {
const n = t.width ? String(t.width) : e.defaultWidth;
return e.formats[n] || e.formats[e.defaultWidth];
};
}
const Mr = {
full: "EEEE, MMMM do, y",
long: "MMMM do, y",
medium: "MMM d, y",
short: "MM/dd/yyyy"
}, kr = {
full: "h:mm:ss a zzzz",
long: "h:mm:ss a z",
medium: "h:mm:ss a",
short: "h:mm a"
}, Dr = {
full: "{{date}} 'at' {{time}}",
long: "{{date}} 'at' {{time}}",
medium: "{{date}}, {{time}}",
short: "{{date}}, {{time}}"
}, vr = {
date: Ve({
formats: Mr,
defaultWidth: "full"
}),
time: Ve({
formats: kr,
defaultWidth: "full"
}),
dateTime: Ve({
formats: Dr,
defaultWidth: "full"
})
}, Or = {
lastWeek: "'last' eeee 'at' p",
yesterday: "'yesterday at' p",
today: "'today at' p",
tomorrow: "'tomorrow at' p",
nextWeek: "eeee 'at' p",
other: "P"
}, Wr = (e, t, n, r) => Or[e];
function ve(e) {
return (t, n) => {
const r = n != null && n.context ? String(n.context) : "standalone";
let a;
if (r === "formatting" && e.formattingValues) {
const s = e.defaultFormattingWidth || e.defaultWidth, i = n != null && n.width ? String(n.width) : s;
a = e.formattingValues[i] || e.formattingValues[s];
} else {
const s = e.defaultWidth, i = n != null && n.width ? String(n.width) : e.defaultWidth;
a = e.values[i] || e.values[s];
}
const o = e.argumentCallback ? e.argumentCallback(t) : t;
return a[o];
};
}
const Sr = {
narrow: ["B", "A"],
abbreviated: ["BC", "AD"],
wide: ["Before Christ", "Anno Domini"]
}, Nr = {
narrow: ["1", "2", "3", "4"],
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
}, xr = {
narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
abbreviated: [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
],
wide: [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
]
}, Cr = {
narrow: ["S", "M", "T", "W", "T", "F", "S"],
short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
wide: [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
]
}, pr = {
narrow: {
am: "a",
pm: "p",
midnight: "mi",
noon: "n",
morning: "morning",
afternoon: "afternoon",
evening: "evening",
night: "night"
},
abbreviated: {
am: "AM",
pm: "PM",
midnight: "midnight",
noon: "noon",
morning: "morning",
afternoon: "afternoon",
evening: "evening",
night: "night"
},
wide: {
am: "a.m.",
pm: "p.m.",
midnight: "midnight",
noon: "noon",
morning: "morning",
afternoon: "afternoon",
evening: "evening",
night: "night"
}
}, Yr = {
narrow: {
am: "a",
pm: "p",
midnight: "mi",
noon: "n",
morning: "in the morning",
afternoon: "in the afternoon",
evening: "in the evening",
night: "at night"
},
abbreviated: {
am: "AM",
pm: "PM",
midnight: "midnight",
noon: "noon",
morning: "in the morning",
afternoon: "in the afternoon",
evening: "in the evening",
night: "at night"
},
wide: {
am: "a.m.",
pm: "p.m.",
midnight: "midnight",
noon: "noon",
morning: "in the morning",
afternoon: "in the afternoon",
evening: "in the evening",
night: "at night"
}
}, Tr = (e, t) => {
const n = Number(e), r = n % 100;
if (r > 20 || r < 10)
switch (r % 10) {
case 1:
return n + "st";
case 2:
return n + "nd";
case 3:
return n + "rd";
}
return n + "th";
}, Pr = {
ordinalNumber: Tr,
era: ve({
values: Sr,
defaultWidth: "wide"
}),
quarter: ve({
values: Nr,
defaultWidth: "wide",
argumentCallback: (e) => e - 1
}),
month: ve({
values: xr,
defaultWidth: "wide"
}),
day: ve({
values: Cr,
defaultWidth: "wide"
}),
dayPeriod: ve({
values: pr,
defaultWidth: "wide",
formattingValues: Yr,
defaultFormattingWidth: "wide"
})
};
function Oe(e) {
return (t, n = {}) => {
const r = n.width, a = r && e.matchPatterns[r] || e.matchPatterns[e.defaultMatchWidth], o = t.match(a);
if (!o)
return null;
const s = o[0], i = r && e.parsePatterns[r] || e.parsePatterns[e.defaultParseWidth], c = Array.isArray(i) ? Er(i, (d) => d.test(s)) : (
// [TODO] -- I challenge you to fix the type
_r(i, (d) => d.test(s))
);
let u;
u = e.valueCallback ? e.valueCallback(c) : c, u = n.valueCallback ? (
// [TODO] -- I challenge you to fix the type
n.valueCallback(u)
) : u;
const l = t.slice(s.length);
return { value: u, rest: l };
};
}
function _r(e, t) {
for (const n in e)
if (Object.prototype.hasOwnProperty.call(e, n) && t(e[n]))
return n;
}
function Er(e, t) {
for (let n = 0; n < e.length; n++)
if (t(e[n]))
return n;
}
function Fr(e) {
return (t, n = {}) => {
const r = t.match(e.matchPattern);
if (!r) return null;
const a = r[0], o = t.match(e.parsePattern);
if (!o) return null;
let s = e.valueCallback ? e.valueCallback(o[0]) : o[0];
s = n.valueCallback ? n.valueCallback(s) : s;
const i = t.slice(a.length);
return { value: s, rest: i };
};
}
const Br = /^(\d+)(th|st|nd|rd)?/i, Ir = /\d+/i, Hr = {
narrow: /^(b|a)/i,
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
wide: /^(before christ|before common era|anno domini|common era)/i
}, Ar = {
any: [/^b/i, /^(a|c)/i]
}, qr = {
narrow: /^[1234]/i,
abbreviated: /^q[1234]/i,
wide: /^[1234](th|st|nd|rd)? quarter/i
}, jr = {
any: [/1/i, /2/i, /3/i, /4/i]
}, zr = {
narrow: /^[jfmasond]/i,
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
}, $r = {
narrow: [
/^j/i,
/^f/i,
/^m/i,
/^a/i,
/^m/i,
/^j/i,
/^j/i,
/^a/i,
/^s/i,
/^o/i,
/^n/i,
/^d/i
],
any: [
/^ja/i,
/^f/i,
/^mar/i,
/^ap/i,
/^may/i,
/^jun/i,
/^jul/i,
/^au/i,
/^s/i,
/^o/i,
/^n/i,
/^d/i
]
}, Gr = {
narrow: /^[smtwf]/i,
short: /^(su|mo|tu|we|th|fr|sa)/i,
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
}, Rr = {
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
}, Vr = {
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
}, Qr = {
any: {
am: /^a/i,
pm: /^p/i,
midnight: /^mi/i,
noon: /^no/i,
morning: /morning/i,
afternoon: /afternoon/i,
evening: /evening/i,
night: /night/i
}
}, Ur = {
ordinalNumber: Fr({
matchPattern: Br,
parsePattern: Ir,
valueCallback: (e) => parseInt(e, 10)
}),
era: Oe({
matchPatterns: Hr,
defaultMatchWidth: "wide",
parsePatterns: Ar,
defaultParseWidth: "any"
}),
quarter: Oe({
matchPatterns: qr,
defaultMatchWidth: "wide",
parsePatterns: jr,
defaultParseWidth: "any",
valueCallback: (e) => e + 1
}),
month: Oe({
matchPatterns: zr,
defaultMatchWidth: "wide",
parsePatterns: $r,
defaultParseWidth: "any"
}),
day: Oe({
matchPatterns: Gr,
defaultMatchWidth: "wide",
parsePatterns: Rr,
defaultParseWidth: "any"
}),
dayPeriod: Oe({
matchPatterns: Vr,
defaultMatchWidth: "any",
parsePatterns: Qr,
defaultParseWidth: "any"
})
}, be = {
code: "en-US",
formatDistance: wr,
formatLong: vr,
formatRelative: Wr,
localize: Pr,
match: Ur,
options: {
weekStartsOn: 0,
firstWeekContainsDate: 1
}
};
function Xr(e, t) {
const n = _(e, t == null ? void 0 : t.in);
return et(n, $t(n)) + 1;
}
function tt(e, t) {
const n = _(e, t == null ? void 0 : t.in), r = +Ne(n) - +ar(n);
return Math.round(r / Bt) + 1;
}
function Rt(e, t) {
var l, d, h, b;
const n = _(e, t == null ? void 0 : t.in), r = n.getFullYear(), a = Ce(), o = (t == null ? void 0 : t.firstWeekContainsDate) ?? ((d = (l = t == null ? void 0 : t.locale) == null ? void 0 : l.options) == null ? void 0 : d.firstWeekContainsDate) ?? a.firstWeekContainsDate ?? ((b = (h = a.locale) == null ? void 0 : h.options) == null ? void 0 : b.firstWeekContainsDate) ?? 1, s = H((t == null ? void 0 : t.in) || e, 0);
s.setFullYear(r + 1, 0, o), s.setHours(0, 0, 0, 0);
const i = we(s, t), c = H((t == null ? void 0 : t.in) || e, 0);
c.setFullYear(r, 0, o), c.setHours(0, 0, 0, 0);
const u = we(c, t);
return +n >= +i ? r + 1 : +n >= +u ? r : r - 1;
}
function Kr(e, t) {
var i, c, u, l;
const n = Ce(), r = (t == null ? void 0 : t.firstWeekContainsDate) ?? ((c = (i = t == null ? void 0 : t.locale) == null ? void 0 : i.options) == null ? void 0 : c.firstWeekContainsDate) ?? n.firstWeekContainsDate ?? ((l = (u = n.locale) == null ? void 0 : u.options) == null ? void 0 : l.firstWeekContainsDate) ?? 1, a = Rt(e, t), o = H((t == null ? void 0 : t.in) || e, 0);
return o.setFullYear(a, 0, r), o.setHours(0, 0, 0, 0), we(o, t);
}
function nt(e, t) {
const n = _(e, t == null ? void 0 : t.in), r = +we(n, t) - +Kr(n, t);
return Math.round(r / Bt) + 1;
}
function P(e, t) {
const n = e < 0 ? "-" : "", r = Math.abs(e).toString().padStart(t, "0");
return n + r;
}
const le = {
// Year
y(e, t) {
const n = e.getFullYear(), r = n > 0 ? n : 1 - n;
return P(t === "yy" ? r % 100 : r, t.length);
},
// Month
M(e, t) {
const n = e.getMonth();
return t === "M" ? String(n + 1) : P(n + 1, 2);
},
// Day of the month
d(e, t) {
return P(e.getDate(), t.length);
},
// AM or PM
a(e, t) {
const n = e.getHours() / 12 >= 1 ? "pm" : "am";
switch (t) {
case "a":
case "aa":
return n.toUpperCase();
case "aaa":
return n;
case "aaaaa":
return n[0];
case "aaaa":
default:
return n === "am" ? "a.m." : "p.m.";
}
},
// Hour [1-12]
h(e, t) {
return P(e.getHours() % 12 || 12, t.length);
},
// Hour [0-23]
H(e, t) {
return P(e.getHours(), t.length);
},
// Minute
m(e, t) {
return P(e.getMinutes(), t.length);
},
// Second
s(e, t) {
return P(e.getSeconds(), t.length);
},
// Fraction of second
S(e, t) {
const n = t.length, r = e.getMilliseconds(), a = Math.trunc(
r * Math.pow(10, n - 3)
);
return P(a, t.length);
}
}, ye = {
midnight: "midnight",
noon: "noon",
morning: "morning",
afternoon: "afternoon",
evening: "evening",
night: "night"
}, Wt = {
// Era
G: function(e, t, n) {
const r = e.getFullYear() > 0 ? 1 : 0;
switch (t) {
// AD, BC
case "G":
case "GG":
case "GGG":
return n.era(r, { width: "abbreviated" });
// A, B
case "GGGGG":
return n.era(r, { width: "narrow" });
// Anno Domini, Before Christ
case "GGGG":
default:
return n.era(r, { width: "wide" });
}
},
// Year
y: function(e, t, n) {
if (t === "yo") {
const r = e.getFullYear(), a = r > 0 ? r : 1 - r;
return n.ordinalNumber(a, { unit: "year" });
}
return le.y(e, t);
},
// Local week-numbering year
Y: function(e, t, n, r) {
const a = Rt(e, r), o = a > 0 ? a : 1 - a;
if (t === "YY") {
const s = o % 100;
return P(s, 2);
}
return t === "Yo" ? n.ordinalNumber(o, { unit: "year" }) : P(o, t.length);
},
// ISO week-numbering year
R: function(e, t) {
const n = At(e);
return P(n, t.length);
},
// Extended year. This is a single number designating the year of this calendar system.
// The main difference between `y` and `u` localizers are B.C. years:
// | Year | `y` | `u` |
// |------|-----|-----|
// | AC 1 | 1 | 1 |
// | BC 1 | 1 | 0 |
// | BC 2 | 2 | -1 |
// Also `yy` always returns the last two digits of a year,
// while `uu` pads single digit years to 2 characters and returns other years unchanged.
u: function(e, t) {
const n = e.getFullYear();
return P(n, t.length);
},
// Quarter
Q: function(e, t, n) {
const r = Math.ceil((e.getMonth() + 1) / 3);
switch (t) {
// 1, 2, 3, 4
case "Q":
return String(r);
// 01, 02, 03, 04
case "QQ":
return P(r, 2);
// 1st, 2nd, 3rd, 4th
case "Qo":
return n.ordinalNumber(r, { unit: "quarter" });
// Q1, Q2, Q3, Q4
case "QQQ":
return n.quarter(r, {
width: "abbreviated",
context: "formatting"
});
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
case "QQQQQ":
return n.quarter(r, {
width: "narrow",
context: "formatting"
});
// 1st quarter, 2nd quarter, ...
case "QQQQ":
default:
return n.quarter(r, {
width: "wide",
context: "formatting"
});
}
},
// Stand-alone quarter
q: function(e, t, n) {
const r = Math.ceil((e.getMonth() + 1) / 3);
switch (t) {
// 1, 2, 3, 4
case "q":
return String(r);
// 01, 02, 03, 04
case "qq":
return P(r, 2);
// 1st, 2nd, 3rd, 4th
case "qo":
return n.ordinalNumber(r, { unit: "quarter" });
// Q1, Q2, Q3, Q4
case "qqq":
return n.quarter(r, {
width: "abbreviated",
context: "standalone"
});
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
case "qqqqq":
return n.quarter(r, {
width: "narrow",
context: "standalone"
});
// 1st quarter, 2nd quarter, ...
case "qqqq":
default:
return n.quarter(r, {
width: "wide",
context: "standalone"
});
}
},
// Month
M: function(e, t, n) {
const r = e.getMonth();
switch (t) {
case "M":
case "MM":
return le.M(e, t);
// 1st, 2nd, ..., 12th
case "Mo":
return n.ordinalNumber(r + 1, { unit: "month" });
// Jan, Feb, ..., Dec
case "MMM":
return n.month(r, {
width: "abbreviated",
context: "formatting"
});
// J, F, ..., D
case "MMMMM":
return n.month(r, {
width: "narrow",
context: "formatting"
});
// January, February, ..., December
case "MMMM":
default:
return n.month(r, { width: "wide", context: "formatting" });
}
},
// Stand-alone month
L: function(e, t, n) {
const r = e.getMonth();
switch (t) {
// 1, 2, ..., 12
case "L":
return String(r + 1);
// 01, 02, ..., 12
case "LL":
return P(r + 1, 2);
// 1st, 2nd, ..., 12th
case "Lo":
return n.ordinalNumber(r + 1, { unit: "month" });
// Jan, Feb, ..., Dec
case "LLL":
return n.month(r, {
width: "abbreviated",
context: "standalone"
});
// J, F, ..., D
case "LLLLL":
return n.month(r, {
width: "narrow",
context: "standalone"
});
// January, February, ..., December
case "LLLL":
default:
return n.month(r, { width: "wide", context: "standalone" });
}
},
// Local week of year
w: function(e, t, n, r) {
const a = nt(e, r);
return t === "wo" ? n.ordinalNumber(a, { unit: "week" }) : P(a, t.length);
},
// ISO week of year
I: function(e, t, n) {
const r = tt(e);
return t === "Io" ? n.ordinalNumber(r, { unit: "week" }) : P(r, t.length);
},
// Day of the month
d: function(e, t, n) {
return t === "do" ? n.ordinalNumber(e.getDate(), { unit: "date" }) : le.d(e, t);
},
// Day of year
D: function(e, t, n) {
const r = Xr(e);
return t === "Do" ? n.ordinalNumber(r, { unit: "dayOfYear" }) : P(r, t.length);
},
// Day of week
E: function(e, t, n) {
const r = e.getDay();
switch (t) {
// Tue
case "E":
case "EE":
case "EEE":
return n.day(r, {
width: "abbreviated",
context: "formatting"
});
// T
case "EEEEE":
return n.day(r, {
width: "narrow",
context: "formatting"
});
// Tu
case "EEEEEE":
return n.day(r, {
width: "short",
context: "formatting"
});
// Tuesday
case "EEEE":
default:
return n.day(r, {
width: "wide",
context: "formatting"
});
}
},
// Local day of week
e: function(e, t, n, r) {
const a = e.getDay(), o = (a - r.weekStartsOn + 8) % 7 || 7;
switch (t) {
// Numerical value (Nth day of week with current locale or weekStartsOn)
case "e":
return String(o);
// Padded numerical value
case "ee":
return P(o, 2);
// 1st, 2nd, ..., 7th
case "eo":
return n.ordinalNumber(o, { unit: "day" });
case "eee":
return n.day(a, {
width: "abbreviated",
context: "formatting"
});
// T
case "eeeee":
return n.day(a, {
width: "narrow",
context: "formatting"
});
// Tu
case "eeeeee":
return n.day(a, {
width: "short",
context: "formatting"
});
// Tuesday
case "eeee":
default:
return n.day(a, {
width: "wide",
context: "formatting"
});
}
},
// Stand-alone local day of week
c: function(e, t, n, r) {
const a = e.getDay(), o = (a - r.weekStartsOn + 8) % 7 || 7;
switch (t) {
// Numerical value (same as in `e`)
case "c":
return String(o);
// Padded numerical value
case "cc":
return P(o, t.length);
// 1st, 2nd, ..., 7th
case "co":
return n.ordinalNumber(o, { unit: "day" });
case "ccc":
return n.day(a, {
width: "abbreviated",
context: "standalone"
});
// T
case "ccccc":
return n.day(a, {
width: "narrow",
context: "standalone"
});
// Tu
case "cccccc":
return n.day(a, {
width: "short",
context: "standalone"
});
// Tuesday
case "cccc":
default:
return n.day(a, {
width: "wide",
context: "standalone"
});
}
},
// ISO day of week
i: function(e, t, n) {
const r = e.getDay(), a = r === 0 ? 7 : r;
switch (t) {
// 2
case "i":
return String(a);
// 02
case "ii":
return P(a, t.length);
// 2nd
case "io":
return n.ordinalNumber(a, { unit: "day" });
// Tue
case "iii":
return n.day(r, {
width: "abbreviated",
context: "formatting"
});
// T
case "iiiii":
return n.day(r, {
width: "narrow",
context: "formatting"
});
// Tu
case "iiiiii":
return n.day(r, {
width: "short",
context: "formatting"
});
// Tuesday
case "iiii":
default:
return n.day(r, {
width: "wide",
context: "formatting"
});
}
},
// AM or PM
a: function(e, t, n) {
const a = e.getHours() / 12 >= 1 ? "pm" : "am";
switch (t) {
case "a":
case "aa":
return n.dayPeriod(a, {
width: "abbreviated",
context: "formatting"
});
case "aaa":
return n.dayPeriod(a, {
width: "abbreviated",
context: "formatting"
}).toLowerCase();
case "aaaaa":
return n.dayPeriod(a, {
width: "narrow",
context: "formatting"
});
case "aaaa":
default:
return n.dayPeriod(a, {
width: "wide",
context: "formatting"
});
}
},
// AM, PM, midnight, noon
b: function(e, t, n) {
const r = e.getHours();
let a;
switch (r === 12 ? a = ye.noon : r === 0 ? a = ye.midnight : a = r / 12 >= 1 ? "pm" : "am", t) {
case "b":
case "bb":
return n.dayPeriod(a, {
width: "abbreviated",
context: "formatting"
});
case "bbb":
return n.dayPeriod(a, {
width: "abbreviated",
context: "formatting"
}).toLowerCase();
case "bbbbb":
return n.dayPeriod(a, {
width: "narrow",
context: "formatting"
});
case "bbbb":
default:
return n.dayPeriod(a, {
width: "wide",
context: "formatting"
});
}
},
// in the morning, in the afternoon, in the evening, at night
B: function(e, t, n) {
const r = e.getHours();
let a;
switch (r >= 17 ? a = ye.evening : r >= 12 ? a = ye.afternoon : r >= 4 ? a = ye.morning : a = ye.night, t) {
case "B":
case "BB":
case "BBB":
return n.dayPeriod(a, {
width: "abbreviated",
context: "formatting"
});
case "BBBBB":
return n.dayPeriod(a, {
width: "narrow",
context: "formatting"
});
case "BBBB":
default:
return n.dayPeriod(a, {
width: "wide",
context: "formatting"
});
}
},
// Hour [1-12]
h: function(e, t, n) {
if (t === "ho") {
let r = e.getHours() % 12;
return r === 0 && (r = 12), n.ordinalNumber(r, { unit: "hour" });
}
return le.h(e, t);
},
// Hour [0-23]
H: function(e, t, n) {
return t === "Ho" ? n.ordinalNumber(e.getHours(), { unit: "hour" }) : le.H(e, t);
},
// Hour [0-11]
K: function(e, t, n) {
const r = e.getHours() % 12;
return t === "Ko" ? n.ordinalNumber(r, { unit: "hour" }) : P(r, t.length);
},
// Hour [1-24]
k: function(e, t, n) {
let r = e.getHours();
return r === 0 && (r = 24), t === "ko" ? n.ordinalNumber(r, { unit: "hour" }) : P(r, t.length);
},
// Minute
m: function(e, t, n) {
return t === "mo" ? n.ordinalNumber(e.getMinutes(), { unit: "minute" }) : le.m(e, t);
},
// Second
s: function(e, t, n) {
return t === "so" ? n.ordinalNumber(e.getSeconds(), { unit: "second" }) : le.s(e, t);
},
// Fraction of second
S: function(e, t) {
return le.S(e, t);
},
// Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
X: function(e, t, n) {
const r = e.getTimezoneOffset();
if (r === 0)
return "Z";
switch (t) {
// Hours and optional minutes
case "X":
return Nt(r);
// Hours, minutes and optional seconds without `:` delimiter
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
// so this token always has the same output as `XX`
case "XXXX":
case "XX":
return de(r);
// Hours, minutes and optional seconds with `:` delimiter
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
// so this token always has the same output as `XXX`
case "XXXXX":
case "XXX":
// Hours and minutes with `:` delimiter
default:
return de(r, ":");
}
},
// Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
x: function(e, t, n) {
const r = e.getTimezoneOffset();
switch (t) {
// Hours and optional minutes
case "x":
return Nt(r);
// Hours, minutes and optional seconds without `:` delimiter
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
// so this token always has the same output as `xx`
case "xxxx":
case "xx":
return de(r);
// Hours, minutes and optional seconds with `:` delimiter
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
// so this token always has the same output as `xxx`
case "xxxxx":
case "xxx":
// Hours and minutes with `:` delimiter
default:
return de(r, ":");
}
},
// Timezone (GMT)
O: function(e, t, n) {
const r = e.getTimezoneOffset();
switch (t) {
// Short
case "O":
case "OO":
case "OOO":
return "GMT" + St(r, ":");
// Long
case "OOOO":
default:
return "GMT" + de(r, ":");
}
},
// Timezone (specific non-location)
z: function(e, t, n) {
const r = e.getTimezoneOffset();
switch (t) {
// Short
case "z":
case "zz":
case "zzz":
return "GMT" + St(r, ":");
// Long
case "zzzz":
default:
return "GMT" + de(r, ":");
}
},
// Seconds timestamp
t: function(e, t, n) {
const r = Math.trunc(+e / 1e3);
return P(r, t.length);
},
// Milliseconds timestamp
T: function(e, t, n) {
return P(+e, t.length);
}
};
function St(e, t = "") {
const n = e > 0 ? "-" : "+", r = Math.abs(e), a = Math.trunc(r / 60), o = r % 60;
return o === 0 ? n + String(a) : n + String(a) + t + P(o, 2);
}
function Nt(e, t) {
return e % 60 === 0 ? (e > 0 ? "-" : "+") + P(Math.abs(e) / 60, 2) : de(e, t);
}
function de(e, t = "") {
const n = e > 0 ? "-" : "+", r = Math.abs(e), a = P(Math.trunc(r / 60), 2), o = P(r % 60, 2);
return n + a + t + o;
}
const xt = (e, t) => {
switch (e) {
case "P":
return t.date({ width: "short" });
case "PP":
return t.date({ width: "medium" });
case "PPP":
return t.date({ width: "long" });
case "PPPP":
default:
return t.date({ width: "full" });
}
}, Vt = (e, t) => {
switch (e) {
case "p":
return t.time({ width: "short" });
case "pp":
return t.time({ width: "medium" });
case "ppp":
return t.time({ width: "long" });
case "pppp":
default:
return t.time({ width: "full" });
}
}, Jr = (e, t) => {
const n = e.match(/(P+)(p+)?/) || [], r = n[1], a = n[2];
if (!a)
return xt(e, t);
let o;
switch (r) {
case "P":
o = t.dateTime({ width: "short" });
break;
case "PP":
o = t.dateTime({ width: "medium" });
break;
case "PPP":
o = t.dateTime({ width: "long" });
break;
case "PPPP":
default:
o = t.dateTime({ width: "full" });
break;
}
return o.replace("{{date}}", xt(r, t)).replace("{{time}}", Vt(a, t));
}, Zr = {
p: Vt,
P: Jr
}, Lr = /^D+$/, ea = /^Y+$/, ta = ["D", "DD", "YY", "YYYY"];
function na(e) {
return Lr.test(e);
}
function ra(e) {
return ea.test(e);
}
function aa(e, t, n) {
const r = oa(e, t, n);
if (console.warn(r), ta.includes(e)) throw new RangeError(r);
}
function oa(e, t, n) {
const r = e[0] === "Y" ? "years" : "days of the month";
return `Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
}
const sa = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, ia = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, ca = /^'([^]*?)'?$/, ua = /''/g, la = /[a-zA-Z]/;
function Se(e, t, n) {
var l, d, h, b, m, D, M, v;
const r = Ce(), a = (n == null ? void 0 : n.locale) ?? r.locale ?? be, o = (n == null ? void 0 : n.firstWeekContainsDate) ?? ((d = (l = n == null ? void 0 : n.locale) == null ? void 0 : l.options) == null ? void 0 : d.firstWeekContainsDate) ?? r.firstWeekContainsDate ?? ((b = (h = r.locale) == null ? void 0 : h.options) == null ? void 0 : b.firstWeekContainsDate) ?? 1, s = (n == null ? void 0 : n.weekStartsOn) ?? ((D = (m = n == null ? void 0 : n.locale) == null ? void 0 : m.options) == null ? void 0 : D.weekStartsOn) ?? r.weekStartsOn ?? ((v = (M = r.locale) == null ? void 0 : M.options) == null ? void 0 : v.weekStartsOn) ?? 0, i = _(e, n == null ? void 0 : n.in);
if (!lr(i))
throw new RangeError("Invalid time value");
let c = t.match(ia).map((g) => {
const w = g[0];
if (w === "p" || w === "P") {
const N = Zr[w];
return N(g, a.formatLong);
}
return g;
}).join("").match(sa).map((g) => {
if (g === "''")
return { isToken: !1, value: "'" };
const w = g[0];
if (w === "'")
return { isToken: !1, value: da(g) };
if (Wt[w])
return { isToken: !0, value: g };
if (w.match(la))
throw new RangeError(
"Format string contains an unescaped latin alphabet character `" + w + "`"
);
return { isToken: !1, value: g };
});
a.localize.preprocessor && (c = a.localize.preprocessor(i, c));
const u = {
firstWeekContainsDate: o,
weekStartsOn: s,
locale: a
};
return c.map((g) => {
if (!g.isToken) return g.value;
const w = g.value;
(!(n != null && n.useAdditionalWeekYearTokens) && ra(w) || !(n != null && n.useAdditionalDayOfYearTokens) && na(w)) && aa(w, t, String(e));
const N = Wt[w[0]];
return N(i, w, a.localize, u);
}).join("");
}
function da(e) {
const t = e.match(ca);
return t ? t[1].replace(ua, "'") : e;
}
function fa(e, t) {
const n = _(e, t == null ? void 0 : t.in), r = n.getFullYear(), a = n.getMonth(), o = H(n, 0);
return o.setFullYear(r, a + 1, 0), o.setHours(0, 0, 0, 0), o.getDate();
}
function ha(e, t) {
return _(e, t == null ? void 0 : t.in).getMonth();
}
function ma(e, t) {
return _(e, t == null ? void 0 : t.in).getFullYear();
}
function ya(e, t) {
return +_(e) > +_(t);
}
function ga(e, t) {
return +_(e) < +_(t);
}
function ba(e, t, n) {
const [r, a] = Me(
n == null ? void 0 : n.in,
e,
t
);
return r.getFullYear() === a.getFullYear() && r.getMonth() === a.getMonth();
}
function wa(e, t, n) {
const [r, a] = Me(
n == null ? void 0 : n.in,
e,
t
);
return r.getFullYear() === a.getFullYear();
}
function Ma(e, t, n) {
const r = _(e, n == null ? void 0 : n.in), a = r.getFullYear(), o = r.getDate(), s = H(e, 0);
s.setFullYear(a, t, 15), s.setHours(0, 0, 0, 0);
const i = fa(s);
return r.setMonth(t, Math.min(o, i)), r;
}
function ka(e, t, n) {
const r = _(e, n == null ? void 0 : n.in);
return isNaN(+r) ? H(e, NaN) : (r.setFullYear(t), r);
}
const Ct = 5, Da = 4;
function va(e, t) {
const n = t.startOfMonth(e), r = n.getDay() > 0 ? n.getDay() : 7, a = t.addDays(e, -r + 1), o = t.addDays(a, Ct * 7 - 1);
return t.getMonth(e) === t.getMonth(o) ? Ct : Da;
}
function Qt(e, t) {
const n = t.startOfMonth(e), r = n.getDay();
return r === 1 ? n : r === 0 ? t.addDays(n, -6) : t.addDays(n, -1 * (r - 1));
}
function Oa(e, t) {
const n = Qt(e, t), r = va(e, t);
return t.addDays(n, r * 7 - 1);
}
const Ut = {
...be,
labels: {
labelDayButton: (e, t, n, r) => {
let a;
r && typeof r.format == "function" ? a = r.format.bind(r) : a = (s, i) => Se(s, i, { locale: be, ...n });
let o = a(e, "PPPP");
return t.today && (o = `Today, ${o}`), t.selected && (o = `${o}, selected`), o;
},
labelMonthDropdown: "Choose the Month",
labelNext: "Go to the Next Month",
labelPrevious: "Go to the Previous Month",
labelWeekNumber: (e) => `Week ${e}`,
labelYearDropdown: "Choose the Year",
labelGrid: (e, t, n) => {
let r;
return n && typeof n.format == "function" ? r = n.format.bind(n) : r = (a, o) => Se(a, o, { locale: be, ...t }), r(e, "LLLL yyyy");
},
labelGridcell: (e, t, n, r) => {
let a;
r && typeof r.format == "function" ? a = r.format.bind(r) : a = (s, i) => Se(s, i, { locale: be, ...n });
let o = a(e, "PPPP");
return t != null && t.today && (o = `Today, ${o}`), o;
},
labelNav: "Navigation bar",
labelWeekNumberHeader: "Week Number",
labelWeekday: (e, t, n) => {
let r;
return n && typeof n.format == "function" ? r = n.format.bind(n) : r = (a, o) => Se(a, o, { locale: be, ...t }), r(e, "cccc");
}
}
};
class G {
/**
* Creates an instance of `DateLib`.
*
* @param options Configuration options for the date library.
* @param overrides Custom overrides for the date library functions.
*/
constructor(t, n) {
this.Date = Date, this.today = () => {
var r;
return (r = this.overrides) != null && r.today ? this.overrides.today() : this.options.timeZone ? q.tz(this.options.timeZone) : new this.Date();
}, this.newDate = (r, a, o) => {
var s;
return (s = this.overrides) != null && s.newDate ? this.overrides.newDate(r, a, o) : this.options.timeZone ? new q(r, a, o, this.options.timeZone) : new Date(r, a, o);
}, this.addDays = (r, a) => {
var o;
return (o = this.overrides) != null && o.addDays ? this.overrides.addDays(r, a) : It(r, a);
}, this.addMonths = (r, a) => {
var o;
return (o = this.overrides) != null && o.addMonths ? this.overrides.addMonths(r, a) : Ht(r, a);
}, this.addWeeks = (r, a) => {
var o;
return (o = this.overrides) != null && o.addWeeks ? this.overrides.addWeeks(r, a) : or(r, a);
}, this.addYears = (r, a) => {
var o;
return (o = this.overrides) != null && o.addYears ? this.overrides.addYears(r, a) : sr(r, a);
}, this.differenceInCalendarDays = (r, a) => {
var o;
return (o = this.overrides) != null && o.differenceInCalendarDays ? this.overrides.differenceInCalendarDays(r, a) : et(r, a);
}, this.differenceInCalendarMonths = (r, a) => {
var o;
return (o = this.overrides) != null && o.differenceInCalendarMonths ? this.overrides.differenceInCalendarMonths(r, a) : jt(r, a);
}, this.eachMonthOfInterval = (r) => {
var a;
return (a = this.overrides) != null && a.eachMonthOfInterval ? this.overrides.eachMonthOfInterval(r) : fr(r);
}, this.eachYearOfInterval = (r) => {
var i;
const a = (i = this.overrides) != null && i.eachYearOfInterval ? this.overrides.eachYearOfInterval(r) : yr(r), o = new Set(a.map((c) => this.getYear(c)));
if (o.size === a.length)
return a;
const s = [];
return o.forEach((c) => {
s.push(new Date(c, 0, 1));
}), s;
}, this.endOfBroadcastWeek = (r) => {
var a;
return (a = this.overrides) != null && a.endOfBroadcastWeek ? this.overrides.endOfBroadcastWeek(r) : Oa(r, this);
}, this.endOfISOWeek = (r) => {
var a;
return (a = this.overrides) != null && a.endOfISOWeek ? this.overrides.endOfISOWeek(r) : gr(r);
}, this.endOfMonth = (r) => {
var a;
return (a = this.overrides) != null && a.endOfMonth ? this.overrides.endOfMonth(r) : dr(r);
}, this.endOfWeek = (r, a) => {
var o;
return (o = this.overrides) != null && o.endOfWeek ? this.overrides.endOfWeek(r, a) : Gt(r, this.options);
}, this.endOfYear = (r) => {
var a;
return (a = this.overrides) != null && a.endOfYear ? this.overrides.endOfYear(r) : mr(r);
}, this.format = (r, a, o) => {
var i;
const s = (i = this.overrides) != null && i.format ? this.overrides.format(r, a, this.options) : Se(r, a, this.options);
return this.options.numerals && this.options.numerals !== "latn" ? this.replaceDigits(s) : s;
}, this.getISOWeek = (r) => {
var a;
return (a = this.overrides) != null && a.getISOWeek ? this.overrides.getISOWeek(r) : tt(r);
}, this.getMonth = (r, a) => {
var o;
return (o = this.overrides) != null && o.getMonth ? this.overrides.getMonth(r, this.options) : ha(r, this.options);
}, this.getYear = (r, a) => {
var o;
return (o = this.overrides) !=