@stanfordspezi/spezi-web-design-system
Version:
Stanford Biodesign Digital Health Spezi Web Design System
1,689 lines • 94 kB
JavaScript
import { jsxs as ln, Fragment as hn, jsx as ae } from "react/jsx-runtime";
import { b as et } from "./Button-nH76KtOO.mjs";
import { c as de } from "./index-2NvaPZWc.mjs";
import l, { createContext as mn, useContext as yn, useCallback as z, useRef as Oe, useLayoutEffect as gn, useState as ze, useEffect as wn, useMemo as ve } from "react";
import pn from "./chevron-left-DE2jAC6y.mjs";
import bn from "./chevron-right-DwA2ExUr.mjs";
const mt = 6048e5, Mn = 864e5, tt = /* @__PURE__ */ Symbol.for("constructDateFrom");
function F(e, t) {
return typeof e == "function" ? e(t) : e && typeof e == "object" && tt in e ? e[tt](t) : e instanceof Date ? new e.constructor(t) : new Date(t);
}
function E(e, t) {
return F(t || e, e);
}
function yt(e, t, r) {
const n = E(e, r?.in);
return isNaN(t) ? F(e, NaN) : (t && n.setDate(n.getDate() + t), n);
}
function gt(e, t, r) {
const n = E(e, r?.in);
if (isNaN(t)) return F(e, NaN);
if (!t)
return n;
const o = n.getDate(), a = F(e, n.getTime());
a.setMonth(n.getMonth() + t + 1, 0);
const s = a.getDate();
return o >= s ? a : (n.setFullYear(
a.getFullYear(),
a.getMonth(),
o
), n);
}
let kn = {};
function ge() {
return kn;
}
function ie(e, t) {
const r = ge(), n = t?.weekStartsOn ?? t?.locale?.options?.weekStartsOn ?? r.weekStartsOn ?? r.locale?.options?.weekStartsOn ?? 0, o = E(e, t?.in), a = o.getDay(), s = (a < n ? 7 : 0) + a - n;
return o.setDate(o.getDate() - s), o.setHours(0, 0, 0, 0), o;
}
function me(e, t) {
return ie(e, { ...t, weekStartsOn: 1 });
}
function wt(e, t) {
const r = E(e, t?.in), n = r.getFullYear(), o = F(r, 0);
o.setFullYear(n + 1, 0, 4), o.setHours(0, 0, 0, 0);
const a = me(o), s = F(r, 0);
s.setFullYear(n, 0, 4), s.setHours(0, 0, 0, 0);
const i = me(s);
return r.getTime() >= a.getTime() ? n + 1 : r.getTime() >= i.getTime() ? n : n - 1;
}
function nt(e) {
const t = E(e), r = new Date(
Date.UTC(
t.getFullYear(),
t.getMonth(),
t.getDate(),
t.getHours(),
t.getMinutes(),
t.getSeconds(),
t.getMilliseconds()
)
);
return r.setUTCFullYear(t.getFullYear()), +e - +r;
}
function ce(e, ...t) {
const r = F.bind(
null,
t.find((n) => typeof n == "object")
);
return t.map(r);
}
function ye(e, t) {
const r = E(e, t?.in);
return r.setHours(0, 0, 0, 0), r;
}
function pt(e, t, r) {
const [n, o] = ce(
r?.in,
e,
t
), a = ye(n), s = ye(o), i = +a - nt(a), c = +s - nt(s);
return Math.round((i - c) / Mn);
}
function Dn(e, t) {
const r = wt(e, t), n = F(e, 0);
return n.setFullYear(r, 0, 4), n.setHours(0, 0, 0, 0), me(n);
}
function On(e, t, r) {
return yt(e, t * 7, r);
}
function vn(e, t, r) {
return gt(e, t * 12, r);
}
function Wn(e, t) {
let r, n = t?.in;
return e.forEach((o) => {
!n && typeof o == "object" && (n = F.bind(null, o));
const a = E(o, n);
(!r || r < a || isNaN(+a)) && (r = a);
}), F(n, r || NaN);
}
function Sn(e, t) {
let r, n = t?.in;
return e.forEach((o) => {
!n && typeof o == "object" && (n = F.bind(null, o));
const a = E(o, n);
(!r || r > a || isNaN(+a)) && (r = a);
}), F(n, r || NaN);
}
function Cn(e, t, r) {
const [n, o] = ce(
r?.in,
e,
t
);
return +ye(n) == +ye(o);
}
function We(e) {
return e instanceof Date || typeof e == "object" && Object.prototype.toString.call(e) === "[object Date]";
}
function Nn(e) {
return !(!We(e) && typeof e != "number" || isNaN(+E(e)));
}
function xn(e, t, r) {
const [n, o] = ce(
r?.in,
e,
t
), a = n.getFullYear() - o.getFullYear(), s = n.getMonth() - o.getMonth();
return a * 12 + s;
}
function Tn(e, t) {
const r = E(e, t?.in), n = r.getMonth();
return r.setFullYear(r.getFullYear(), n + 1, 0), r.setHours(23, 59, 59, 999), r;
}
function bt(e, t) {
const [r, n] = ce(e, t.start, t.end);
return { start: r, end: n };
}
function Yn(e, t) {
const { start: r, end: n } = bt(t?.in, e);
let o = +r > +n;
const a = o ? +r : +n, s = o ? n : r;
s.setHours(0, 0, 0, 0), s.setDate(1);
let i = 1;
const c = [];
for (; +s <= a; )
c.push(F(r, s)), s.setMonth(s.getMonth() + i);
return o ? c.reverse() : c;
}
function En(e, t) {
const r = E(e, t?.in);
return r.setDate(1), r.setHours(0, 0, 0, 0), r;
}
function Pn(e, t) {
const r = E(e, t?.in), n = r.getFullYear();
return r.setFullYear(n + 1, 0, 0), r.setHours(23, 59, 59, 999), r;
}
function Mt(e, t) {
const r = E(e, t?.in);
return r.setFullYear(r.getFullYear(), 0, 1), r.setHours(0, 0, 0, 0), r;
}
function _n(e, t) {
const { start: r, end: n } = bt(t?.in, e);
let o = +r > +n;
const a = o ? +r : +n, s = o ? n : r;
s.setHours(0, 0, 0, 0), s.setMonth(0, 1);
let i = 1;
const c = [];
for (; +s <= a; )
c.push(F(r, s)), s.setFullYear(s.getFullYear() + i);
return o ? c.reverse() : c;
}
function kt(e, t) {
const r = ge(), n = t?.weekStartsOn ?? t?.locale?.options?.weekStartsOn ?? r.weekStartsOn ?? r.locale?.options?.weekStartsOn ?? 0, o = E(e, t?.in), a = o.getDay(), s = (a < n ? -7 : 0) + 6 - (a - n);
return o.setDate(o.getDate() + s), o.setHours(23, 59, 59, 999), o;
}
function Fn(e, t) {
return kt(e, { ...t, weekStartsOn: 1 });
}
const Bn = {
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"
}
}, In = (e, t, r) => {
let n;
const o = Bn[e];
return typeof o == "string" ? n = o : t === 1 ? n = o.one : n = o.other.replace("{{count}}", t.toString()), r?.addSuffix ? r.comparison && r.comparison > 0 ? "in " + n : n + " ago" : n;
};
function Ie(e) {
return (t = {}) => {
const r = t.width ? String(t.width) : e.defaultWidth;
return e.formats[r] || e.formats[e.defaultWidth];
};
}
const Hn = {
full: "EEEE, MMMM do, y",
long: "MMMM do, y",
medium: "MMM d, y",
short: "MM/dd/yyyy"
}, An = {
full: "h:mm:ss a zzzz",
long: "h:mm:ss a z",
medium: "h:mm:ss a",
short: "h:mm a"
}, qn = {
full: "{{date}} 'at' {{time}}",
long: "{{date}} 'at' {{time}}",
medium: "{{date}}, {{time}}",
short: "{{date}}, {{time}}"
}, jn = {
date: Ie({
formats: Hn,
defaultWidth: "full"
}),
time: Ie({
formats: An,
defaultWidth: "full"
}),
dateTime: Ie({
formats: qn,
defaultWidth: "full"
})
}, zn = {
lastWeek: "'last' eeee 'at' p",
yesterday: "'yesterday at' p",
today: "'today at' p",
tomorrow: "'tomorrow at' p",
nextWeek: "eeee 'at' p",
other: "P"
}, Rn = (e, t, r, n) => zn[e];
function fe(e) {
return (t, r) => {
const n = r?.context ? String(r.context) : "standalone";
let o;
if (n === "formatting" && e.formattingValues) {
const s = e.defaultFormattingWidth || e.defaultWidth, i = r?.width ? String(r.width) : s;
o = e.formattingValues[i] || e.formattingValues[s];
} else {
const s = e.defaultWidth, i = r?.width ? String(r.width) : e.defaultWidth;
o = e.values[i] || e.values[s];
}
const a = e.argumentCallback ? e.argumentCallback(t) : t;
return o[a];
};
}
const $n = {
narrow: ["B", "A"],
abbreviated: ["BC", "AD"],
wide: ["Before Christ", "Anno Domini"]
}, Gn = {
narrow: ["1", "2", "3", "4"],
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
}, Qn = {
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"
]
}, Xn = {
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"
]
}, Zn = {
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"
}
}, Un = {
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"
}
}, Ln = (e, t) => {
const r = Number(e), n = r % 100;
if (n > 20 || n < 10)
switch (n % 10) {
case 1:
return r + "st";
case 2:
return r + "nd";
case 3:
return r + "rd";
}
return r + "th";
}, Vn = {
ordinalNumber: Ln,
era: fe({
values: $n,
defaultWidth: "wide"
}),
quarter: fe({
values: Gn,
defaultWidth: "wide",
argumentCallback: (e) => e - 1
}),
month: fe({
values: Qn,
defaultWidth: "wide"
}),
day: fe({
values: Xn,
defaultWidth: "wide"
}),
dayPeriod: fe({
values: Zn,
defaultWidth: "wide",
formattingValues: Un,
defaultFormattingWidth: "wide"
})
};
function le(e) {
return (t, r = {}) => {
const n = r.width, o = n && e.matchPatterns[n] || e.matchPatterns[e.defaultMatchWidth], a = t.match(o);
if (!a)
return null;
const s = a[0], i = n && e.parsePatterns[n] || e.parsePatterns[e.defaultParseWidth], c = Array.isArray(i) ? Jn(i, (u) => u.test(s)) : (
// [TODO] -- I challenge you to fix the type
Kn(i, (u) => u.test(s))
);
let d;
d = e.valueCallback ? e.valueCallback(c) : c, d = r.valueCallback ? (
// [TODO] -- I challenge you to fix the type
r.valueCallback(d)
) : d;
const f = t.slice(s.length);
return { value: d, rest: f };
};
}
function Kn(e, t) {
for (const r in e)
if (Object.prototype.hasOwnProperty.call(e, r) && t(e[r]))
return r;
}
function Jn(e, t) {
for (let r = 0; r < e.length; r++)
if (t(e[r]))
return r;
}
function er(e) {
return (t, r = {}) => {
const n = t.match(e.matchPattern);
if (!n) return null;
const o = n[0], a = t.match(e.parsePattern);
if (!a) return null;
let s = e.valueCallback ? e.valueCallback(a[0]) : a[0];
s = r.valueCallback ? r.valueCallback(s) : s;
const i = t.slice(o.length);
return { value: s, rest: i };
};
}
const tr = /^(\d+)(th|st|nd|rd)?/i, nr = /\d+/i, rr = {
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
}, or = {
any: [/^b/i, /^(a|c)/i]
}, sr = {
narrow: /^[1234]/i,
abbreviated: /^q[1234]/i,
wide: /^[1234](th|st|nd|rd)? quarter/i
}, ar = {
any: [/1/i, /2/i, /3/i, /4/i]
}, ir = {
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
}, cr = {
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
]
}, ur = {
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
}, dr = {
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]
}, fr = {
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
}, lr = {
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
}
}, hr = {
ordinalNumber: er({
matchPattern: tr,
parsePattern: nr,
valueCallback: (e) => parseInt(e, 10)
}),
era: le({
matchPatterns: rr,
defaultMatchWidth: "wide",
parsePatterns: or,
defaultParseWidth: "any"
}),
quarter: le({
matchPatterns: sr,
defaultMatchWidth: "wide",
parsePatterns: ar,
defaultParseWidth: "any",
valueCallback: (e) => e + 1
}),
month: le({
matchPatterns: ir,
defaultMatchWidth: "wide",
parsePatterns: cr,
defaultParseWidth: "any"
}),
day: le({
matchPatterns: ur,
defaultMatchWidth: "wide",
parsePatterns: dr,
defaultParseWidth: "any"
}),
dayPeriod: le({
matchPatterns: fr,
defaultMatchWidth: "any",
parsePatterns: lr,
defaultParseWidth: "any"
})
}, $e = {
code: "en-US",
formatDistance: In,
formatLong: jn,
formatRelative: Rn,
localize: Vn,
match: hr,
options: {
weekStartsOn: 0,
firstWeekContainsDate: 1
}
};
function mr(e, t) {
const r = E(e, t?.in);
return pt(r, Mt(r)) + 1;
}
function Dt(e, t) {
const r = E(e, t?.in), n = +me(r) - +Dn(r);
return Math.round(n / mt) + 1;
}
function Ot(e, t) {
const r = E(e, t?.in), n = r.getFullYear(), o = ge(), a = t?.firstWeekContainsDate ?? t?.locale?.options?.firstWeekContainsDate ?? o.firstWeekContainsDate ?? o.locale?.options?.firstWeekContainsDate ?? 1, s = F(t?.in || e, 0);
s.setFullYear(n + 1, 0, a), s.setHours(0, 0, 0, 0);
const i = ie(s, t), c = F(t?.in || e, 0);
c.setFullYear(n, 0, a), c.setHours(0, 0, 0, 0);
const d = ie(c, t);
return +r >= +i ? n + 1 : +r >= +d ? n : n - 1;
}
function yr(e, t) {
const r = ge(), n = t?.firstWeekContainsDate ?? t?.locale?.options?.firstWeekContainsDate ?? r.firstWeekContainsDate ?? r.locale?.options?.firstWeekContainsDate ?? 1, o = Ot(e, t), a = F(t?.in || e, 0);
return a.setFullYear(o, 0, n), a.setHours(0, 0, 0, 0), ie(a, t);
}
function vt(e, t) {
const r = E(e, t?.in), n = +ie(r, t) - +yr(r, t);
return Math.round(n / mt) + 1;
}
function Y(e, t) {
const r = e < 0 ? "-" : "", n = Math.abs(e).toString().padStart(t, "0");
return r + n;
}
const te = {
// Year
y(e, t) {
const r = e.getFullYear(), n = r > 0 ? r : 1 - r;
return Y(t === "yy" ? n % 100 : n, t.length);
},
// Month
M(e, t) {
const r = e.getMonth();
return t === "M" ? String(r + 1) : Y(r + 1, 2);
},
// Day of the month
d(e, t) {
return Y(e.getDate(), t.length);
},
// AM or PM
a(e, t) {
const r = e.getHours() / 12 >= 1 ? "pm" : "am";
switch (t) {
case "a":
case "aa":
return r.toUpperCase();
case "aaa":
return r;
case "aaaaa":
return r[0];
default:
return r === "am" ? "a.m." : "p.m.";
}
},
// Hour [1-12]
h(e, t) {
return Y(e.getHours() % 12 || 12, t.length);
},
// Hour [0-23]
H(e, t) {
return Y(e.getHours(), t.length);
},
// Minute
m(e, t) {
return Y(e.getMinutes(), t.length);
},
// Second
s(e, t) {
return Y(e.getSeconds(), t.length);
},
// Fraction of second
S(e, t) {
const r = t.length, n = e.getMilliseconds(), o = Math.trunc(
n * Math.pow(10, r - 3)
);
return Y(o, t.length);
}
}, se = {
midnight: "midnight",
noon: "noon",
morning: "morning",
afternoon: "afternoon",
evening: "evening",
night: "night"
}, rt = {
// Era
G: function(e, t, r) {
const n = e.getFullYear() > 0 ? 1 : 0;
switch (t) {
// AD, BC
case "G":
case "GG":
case "GGG":
return r.era(n, { width: "abbreviated" });
// A, B
case "GGGGG":
return r.era(n, { width: "narrow" });
default:
return r.era(n, { width: "wide" });
}
},
// Year
y: function(e, t, r) {
if (t === "yo") {
const n = e.getFullYear(), o = n > 0 ? n : 1 - n;
return r.ordinalNumber(o, { unit: "year" });
}
return te.y(e, t);
},
// Local week-numbering year
Y: function(e, t, r, n) {
const o = Ot(e, n), a = o > 0 ? o : 1 - o;
if (t === "YY") {
const s = a % 100;
return Y(s, 2);
}
return t === "Yo" ? r.ordinalNumber(a, { unit: "year" }) : Y(a, t.length);
},
// ISO week-numbering year
R: function(e, t) {
const r = wt(e);
return Y(r, 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 r = e.getFullYear();
return Y(r, t.length);
},
// Quarter
Q: function(e, t, r) {
const n = Math.ceil((e.getMonth() + 1) / 3);
switch (t) {
// 1, 2, 3, 4
case "Q":
return String(n);
// 01, 02, 03, 04
case "QQ":
return Y(n, 2);
// 1st, 2nd, 3rd, 4th
case "Qo":
return r.ordinalNumber(n, { unit: "quarter" });
// Q1, Q2, Q3, Q4
case "QQQ":
return r.quarter(n, {
width: "abbreviated",
context: "formatting"
});
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
case "QQQQQ":
return r.quarter(n, {
width: "narrow",
context: "formatting"
});
default:
return r.quarter(n, {
width: "wide",
context: "formatting"
});
}
},
// Stand-alone quarter
q: function(e, t, r) {
const n = Math.ceil((e.getMonth() + 1) / 3);
switch (t) {
// 1, 2, 3, 4
case "q":
return String(n);
// 01, 02, 03, 04
case "qq":
return Y(n, 2);
// 1st, 2nd, 3rd, 4th
case "qo":
return r.ordinalNumber(n, { unit: "quarter" });
// Q1, Q2, Q3, Q4
case "qqq":
return r.quarter(n, {
width: "abbreviated",
context: "standalone"
});
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
case "qqqqq":
return r.quarter(n, {
width: "narrow",
context: "standalone"
});
default:
return r.quarter(n, {
width: "wide",
context: "standalone"
});
}
},
// Month
M: function(e, t, r) {
const n = e.getMonth();
switch (t) {
case "M":
case "MM":
return te.M(e, t);
// 1st, 2nd, ..., 12th
case "Mo":
return r.ordinalNumber(n + 1, { unit: "month" });
// Jan, Feb, ..., Dec
case "MMM":
return r.month(n, {
width: "abbreviated",
context: "formatting"
});
// J, F, ..., D
case "MMMMM":
return r.month(n, {
width: "narrow",
context: "formatting"
});
default:
return r.month(n, { width: "wide", context: "formatting" });
}
},
// Stand-alone month
L: function(e, t, r) {
const n = e.getMonth();
switch (t) {
// 1, 2, ..., 12
case "L":
return String(n + 1);
// 01, 02, ..., 12
case "LL":
return Y(n + 1, 2);
// 1st, 2nd, ..., 12th
case "Lo":
return r.ordinalNumber(n + 1, { unit: "month" });
// Jan, Feb, ..., Dec
case "LLL":
return r.month(n, {
width: "abbreviated",
context: "standalone"
});
// J, F, ..., D
case "LLLLL":
return r.month(n, {
width: "narrow",
context: "standalone"
});
default:
return r.month(n, { width: "wide", context: "standalone" });
}
},
// Local week of year
w: function(e, t, r, n) {
const o = vt(e, n);
return t === "wo" ? r.ordinalNumber(o, { unit: "week" }) : Y(o, t.length);
},
// ISO week of year
I: function(e, t, r) {
const n = Dt(e);
return t === "Io" ? r.ordinalNumber(n, { unit: "week" }) : Y(n, t.length);
},
// Day of the month
d: function(e, t, r) {
return t === "do" ? r.ordinalNumber(e.getDate(), { unit: "date" }) : te.d(e, t);
},
// Day of year
D: function(e, t, r) {
const n = mr(e);
return t === "Do" ? r.ordinalNumber(n, { unit: "dayOfYear" }) : Y(n, t.length);
},
// Day of week
E: function(e, t, r) {
const n = e.getDay();
switch (t) {
// Tue
case "E":
case "EE":
case "EEE":
return r.day(n, {
width: "abbreviated",
context: "formatting"
});
// T
case "EEEEE":
return r.day(n, {
width: "narrow",
context: "formatting"
});
// Tu
case "EEEEEE":
return r.day(n, {
width: "short",
context: "formatting"
});
default:
return r.day(n, {
width: "wide",
context: "formatting"
});
}
},
// Local day of week
e: function(e, t, r, n) {
const o = e.getDay(), a = (o - n.weekStartsOn + 8) % 7 || 7;
switch (t) {
// Numerical value (Nth day of week with current locale or weekStartsOn)
case "e":
return String(a);
// Padded numerical value
case "ee":
return Y(a, 2);
// 1st, 2nd, ..., 7th
case "eo":
return r.ordinalNumber(a, { unit: "day" });
case "eee":
return r.day(o, {
width: "abbreviated",
context: "formatting"
});
// T
case "eeeee":
return r.day(o, {
width: "narrow",
context: "formatting"
});
// Tu
case "eeeeee":
return r.day(o, {
width: "short",
context: "formatting"
});
default:
return r.day(o, {
width: "wide",
context: "formatting"
});
}
},
// Stand-alone local day of week
c: function(e, t, r, n) {
const o = e.getDay(), a = (o - n.weekStartsOn + 8) % 7 || 7;
switch (t) {
// Numerical value (same as in `e`)
case "c":
return String(a);
// Padded numerical value
case "cc":
return Y(a, t.length);
// 1st, 2nd, ..., 7th
case "co":
return r.ordinalNumber(a, { unit: "day" });
case "ccc":
return r.day(o, {
width: "abbreviated",
context: "standalone"
});
// T
case "ccccc":
return r.day(o, {
width: "narrow",
context: "standalone"
});
// Tu
case "cccccc":
return r.day(o, {
width: "short",
context: "standalone"
});
default:
return r.day(o, {
width: "wide",
context: "standalone"
});
}
},
// ISO day of week
i: function(e, t, r) {
const n = e.getDay(), o = n === 0 ? 7 : n;
switch (t) {
// 2
case "i":
return String(o);
// 02
case "ii":
return Y(o, t.length);
// 2nd
case "io":
return r.ordinalNumber(o, { unit: "day" });
// Tue
case "iii":
return r.day(n, {
width: "abbreviated",
context: "formatting"
});
// T
case "iiiii":
return r.day(n, {
width: "narrow",
context: "formatting"
});
// Tu
case "iiiiii":
return r.day(n, {
width: "short",
context: "formatting"
});
default:
return r.day(n, {
width: "wide",
context: "formatting"
});
}
},
// AM or PM
a: function(e, t, r) {
const o = e.getHours() / 12 >= 1 ? "pm" : "am";
switch (t) {
case "a":
case "aa":
return r.dayPeriod(o, {
width: "abbreviated",
context: "formatting"
});
case "aaa":
return r.dayPeriod(o, {
width: "abbreviated",
context: "formatting"
}).toLowerCase();
case "aaaaa":
return r.dayPeriod(o, {
width: "narrow",
context: "formatting"
});
default:
return r.dayPeriod(o, {
width: "wide",
context: "formatting"
});
}
},
// AM, PM, midnight, noon
b: function(e, t, r) {
const n = e.getHours();
let o;
switch (n === 12 ? o = se.noon : n === 0 ? o = se.midnight : o = n / 12 >= 1 ? "pm" : "am", t) {
case "b":
case "bb":
return r.dayPeriod(o, {
width: "abbreviated",
context: "formatting"
});
case "bbb":
return r.dayPeriod(o, {
width: "abbreviated",
context: "formatting"
}).toLowerCase();
case "bbbbb":
return r.dayPeriod(o, {
width: "narrow",
context: "formatting"
});
default:
return r.dayPeriod(o, {
width: "wide",
context: "formatting"
});
}
},
// in the morning, in the afternoon, in the evening, at night
B: function(e, t, r) {
const n = e.getHours();
let o;
switch (n >= 17 ? o = se.evening : n >= 12 ? o = se.afternoon : n >= 4 ? o = se.morning : o = se.night, t) {
case "B":
case "BB":
case "BBB":
return r.dayPeriod(o, {
width: "abbreviated",
context: "formatting"
});
case "BBBBB":
return r.dayPeriod(o, {
width: "narrow",
context: "formatting"
});
default:
return r.dayPeriod(o, {
width: "wide",
context: "formatting"
});
}
},
// Hour [1-12]
h: function(e, t, r) {
if (t === "ho") {
let n = e.getHours() % 12;
return n === 0 && (n = 12), r.ordinalNumber(n, { unit: "hour" });
}
return te.h(e, t);
},
// Hour [0-23]
H: function(e, t, r) {
return t === "Ho" ? r.ordinalNumber(e.getHours(), { unit: "hour" }) : te.H(e, t);
},
// Hour [0-11]
K: function(e, t, r) {
const n = e.getHours() % 12;
return t === "Ko" ? r.ordinalNumber(n, { unit: "hour" }) : Y(n, t.length);
},
// Hour [1-24]
k: function(e, t, r) {
let n = e.getHours();
return n === 0 && (n = 24), t === "ko" ? r.ordinalNumber(n, { unit: "hour" }) : Y(n, t.length);
},
// Minute
m: function(e, t, r) {
return t === "mo" ? r.ordinalNumber(e.getMinutes(), { unit: "minute" }) : te.m(e, t);
},
// Second
s: function(e, t, r) {
return t === "so" ? r.ordinalNumber(e.getSeconds(), { unit: "second" }) : te.s(e, t);
},
// Fraction of second
S: function(e, t) {
return te.S(e, t);
},
// Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
X: function(e, t, r) {
const n = e.getTimezoneOffset();
if (n === 0)
return "Z";
switch (t) {
// Hours and optional minutes
case "X":
return st(n);
// 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 re(n);
// Hours and minutes with `:` delimiter
default:
return re(n, ":");
}
},
// Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
x: function(e, t, r) {
const n = e.getTimezoneOffset();
switch (t) {
// Hours and optional minutes
case "x":
return st(n);
// 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 re(n);
// Hours and minutes with `:` delimiter
default:
return re(n, ":");
}
},
// Timezone (GMT)
O: function(e, t, r) {
const n = e.getTimezoneOffset();
switch (t) {
// Short
case "O":
case "OO":
case "OOO":
return "GMT" + ot(n, ":");
default:
return "GMT" + re(n, ":");
}
},
// Timezone (specific non-location)
z: function(e, t, r) {
const n = e.getTimezoneOffset();
switch (t) {
// Short
case "z":
case "zz":
case "zzz":
return "GMT" + ot(n, ":");
default:
return "GMT" + re(n, ":");
}
},
// Seconds timestamp
t: function(e, t, r) {
const n = Math.trunc(+e / 1e3);
return Y(n, t.length);
},
// Milliseconds timestamp
T: function(e, t, r) {
return Y(+e, t.length);
}
};
function ot(e, t = "") {
const r = e > 0 ? "-" : "+", n = Math.abs(e), o = Math.trunc(n / 60), a = n % 60;
return a === 0 ? r + String(o) : r + String(o) + t + Y(a, 2);
}
function st(e, t) {
return e % 60 === 0 ? (e > 0 ? "-" : "+") + Y(Math.abs(e) / 60, 2) : re(e, t);
}
function re(e, t = "") {
const r = e > 0 ? "-" : "+", n = Math.abs(e), o = Y(Math.trunc(n / 60), 2), a = Y(n % 60, 2);
return r + o + t + a;
}
const at = (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" });
default:
return t.date({ width: "full" });
}
}, Wt = (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" });
default:
return t.time({ width: "full" });
}
}, gr = (e, t) => {
const r = e.match(/(P+)(p+)?/) || [], n = r[1], o = r[2];
if (!o)
return at(e, t);
let a;
switch (n) {
case "P":
a = t.dateTime({ width: "short" });
break;
case "PP":
a = t.dateTime({ width: "medium" });
break;
case "PPP":
a = t.dateTime({ width: "long" });
break;
default:
a = t.dateTime({ width: "full" });
break;
}
return a.replace("{{date}}", at(n, t)).replace("{{time}}", Wt(o, t));
}, wr = {
p: Wt,
P: gr
}, pr = /^D+$/, br = /^Y+$/, Mr = ["D", "DD", "YY", "YYYY"];
function kr(e) {
return pr.test(e);
}
function Dr(e) {
return br.test(e);
}
function Or(e, t, r) {
const n = vr(e, t, r);
if (console.warn(n), Mr.includes(e)) throw new RangeError(n);
}
function vr(e, t, r) {
const n = e[0] === "Y" ? "years" : "days of the month";
return `Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
}
const Wr = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, Sr = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, Cr = /^'([^]*?)'?$/, Nr = /''/g, xr = /[a-zA-Z]/;
function Tr(e, t, r) {
const n = ge(), o = r?.locale ?? n.locale ?? $e, a = r?.firstWeekContainsDate ?? r?.locale?.options?.firstWeekContainsDate ?? n.firstWeekContainsDate ?? n.locale?.options?.firstWeekContainsDate ?? 1, s = r?.weekStartsOn ?? r?.locale?.options?.weekStartsOn ?? n.weekStartsOn ?? n.locale?.options?.weekStartsOn ?? 0, i = E(e, r?.in);
if (!Nn(i))
throw new RangeError("Invalid time value");
let c = t.match(Sr).map((f) => {
const u = f[0];
if (u === "p" || u === "P") {
const h = wr[u];
return h(f, o.formatLong);
}
return f;
}).join("").match(Wr).map((f) => {
if (f === "''")
return { isToken: !1, value: "'" };
const u = f[0];
if (u === "'")
return { isToken: !1, value: Yr(f) };
if (rt[u])
return { isToken: !0, value: f };
if (u.match(xr))
throw new RangeError(
"Format string contains an unescaped latin alphabet character `" + u + "`"
);
return { isToken: !1, value: f };
});
o.localize.preprocessor && (c = o.localize.preprocessor(i, c));
const d = {
firstWeekContainsDate: a,
weekStartsOn: s,
locale: o
};
return c.map((f) => {
if (!f.isToken) return f.value;
const u = f.value;
(!r?.useAdditionalWeekYearTokens && Dr(u) || !r?.useAdditionalDayOfYearTokens && kr(u)) && Or(u, t, String(e));
const h = rt[u[0]];
return h(i, u, o.localize, d);
}).join("");
}
function Yr(e) {
const t = e.match(Cr);
return t ? t[1].replace(Nr, "'") : e;
}
function Er(e, t) {
const r = E(e, t?.in), n = r.getFullYear(), o = r.getMonth(), a = F(r, 0);
return a.setFullYear(n, o + 1, 0), a.setHours(0, 0, 0, 0), a.getDate();
}
function Pr(e, t) {
return E(e, t?.in).getMonth();
}
function _r(e, t) {
return E(e, t?.in).getFullYear();
}
function Fr(e, t) {
return +E(e) > +E(t);
}
function Br(e, t) {
return +E(e) < +E(t);
}
function Ir(e, t, r) {
const [n, o] = ce(
r?.in,
e,
t
);
return n.getFullYear() === o.getFullYear() && n.getMonth() === o.getMonth();
}
function Hr(e, t, r) {
const [n, o] = ce(
r?.in,
e,
t
);
return n.getFullYear() === o.getFullYear();
}
function St(e, t, r) {
const n = E(e, r?.in), o = n.getFullYear(), a = n.getDate(), s = F(e, 0);
s.setFullYear(o, t, 15), s.setHours(0, 0, 0, 0);
const i = Er(s);
return n.setMonth(t, Math.min(a, i)), n;
}
function Ar(e, t, r) {
let n = E(e, r?.in);
return isNaN(+n) ? F(e, NaN) : (t.year != null && n.setFullYear(t.year), t.month != null && (n = St(n, t.month)), t.date != null && n.setDate(t.date), t.hours != null && n.setHours(t.hours), t.minutes != null && n.setMinutes(t.minutes), t.seconds != null && n.setSeconds(t.seconds), t.milliseconds != null && n.setMilliseconds(t.milliseconds), n);
}
function qr(e, t, r) {
const n = E(e, r?.in);
return isNaN(+n) ? F(e, NaN) : (n.setFullYear(t), n);
}
function jr(e, t, r = "long") {
return new Intl.DateTimeFormat("en-US", {
// Enforces engine to render the time. Without the option JavaScriptCore omits it.
hour: "numeric",
timeZone: e,
timeZoneName: r
}).format(t).split(/\s/g).slice(2).join(" ");
}
const zr = {}, he = {};
function oe(e, t) {
try {
const n = (zr[e] ||= new Intl.DateTimeFormat("en-US", {
timeZone: e,
timeZoneName: "longOffset"
}).format)(t).split("GMT")[1];
return n in he ? he[n] : it(n, n.split(":"));
} catch {
if (e in he) return he[e];
const r = e?.match(Rr);
return r ? it(e, r.slice(1)) : NaN;
}
}
const Rr = /([+-]\d\d):?(\d\d)?/;
function it(e, t) {
const r = +(t[0] || 0), n = +(t[1] || 0), o = +(t[2] || 0) / 60;
return he[e] = r * 60 + n > 0 ? r * 60 + n + o : r * 60 - n - o;
}
class U 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(oe(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)), Ct(this), Re(this)) : this.setTime(Date.now());
}
static tz(t, ...r) {
return r.length ? new U(...r, t) : new U(Date.now(), t);
}
//#endregion
//#region time zone
withTimeZone(t) {
return new U(+this, t);
}
getTimezoneOffset() {
const t = -oe(this.timeZone, this);
return t > 0 ? Math.floor(t) : Math.ceil(t);
}
//#endregion
//#region time
setTime(t) {
return Date.prototype.setTime.apply(this, arguments), Re(this), +this;
}
//#endregion
//#region date-fns integration
[/* @__PURE__ */ Symbol.for("constructDateFrom")](t) {
return new U(+new Date(t), this.timeZone);
}
//#endregion
}
const ct = /^(get|set)(?!UTC)/;
Object.getOwnPropertyNames(Date.prototype).forEach((e) => {
if (!ct.test(e)) return;
const t = e.replace(ct, "$1UTC");
U.prototype[t] && (e.startsWith("get") ? U.prototype[e] = function() {
return this.internal[t]();
} : (U.prototype[e] = function() {
return Date.prototype[t].apply(this.internal, arguments), $r(this), +this;
}, U.prototype[t] = function() {
return Date.prototype[t].apply(this, arguments), Re(this), +this;
}));
});
function Re(e) {
e.internal.setTime(+e), e.internal.setUTCSeconds(e.internal.getUTCSeconds() - Math.round(-oe(e.timeZone, e) * 60));
}
function $r(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()), Ct(e);
}
function Ct(e) {
const t = oe(e.timeZone, e), r = t > 0 ? Math.floor(t) : Math.ceil(t), n = /* @__PURE__ */ new Date(+e);
n.setUTCHours(n.getUTCHours() - 1);
const o = -(/* @__PURE__ */ new Date(+e)).getTimezoneOffset(), a = -(/* @__PURE__ */ new Date(+n)).getTimezoneOffset(), s = o - a, i = Date.prototype.getHours.apply(e) !== e.internal.getUTCHours();
s && i && e.internal.setUTCMinutes(e.internal.getUTCMinutes() + s);
const c = o - r;
c && Date.prototype.setUTCMinutes.call(e, Date.prototype.getUTCMinutes.call(e) + c);
const d = /* @__PURE__ */ new Date(+e);
d.setUTCSeconds(0);
const f = o > 0 ? d.getSeconds() : (d.getSeconds() - 60) % 60, u = Math.round(-(oe(e.timeZone, e) * 60)) % 60;
(u || f) && (e.internal.setUTCSeconds(e.internal.getUTCSeconds() + u), Date.prototype.setUTCSeconds.call(e, Date.prototype.getUTCSeconds.call(e) + u + f));
const h = oe(e.timeZone, e), w = h > 0 ? Math.floor(h) : Math.ceil(h), C = -(/* @__PURE__ */ new Date(+e)).getTimezoneOffset() - w, M = w !== r, v = C - c;
if (M && v) {
Date.prototype.setUTCMinutes.call(e, Date.prototype.getUTCMinutes.call(e) + v);
const x = oe(e.timeZone, e), b = x > 0 ? Math.floor(x) : Math.ceil(x), D = w - b;
D && (e.internal.setUTCMinutes(e.internal.getUTCMinutes() + D), Date.prototype.setUTCMinutes.call(e, Date.prototype.getUTCMinutes.call(e) + D));
}
}
class K extends U {
//#region static
static tz(t, ...r) {
return r.length ? new K(...r, t) : new K(Date.now(), t);
}
//#endregion
//#region representation
toISOString() {
const [t, r, n] = this.tzComponents(), o = `${t}${r}:${n}`;
return this.internal.toISOString().slice(0, -1) + o;
}
toString() {
return `${this.toDateString()} ${this.toTimeString()}`;
}
toDateString() {
const [t, r, n, o] = this.internal.toUTCString().split(" ");
return `${t?.slice(0, -1)} ${n} ${r} ${o}`;
}
toTimeString() {
const t = this.internal.toUTCString().split(" ")[4], [r, n, o] = this.tzComponents();
return `${t} GMT${r}${n}${o} (${jr(this.timeZone, this)})`;
}
toLocaleString(t, r) {
return Date.prototype.toLocaleString.call(this, t, {
...r,
timeZone: r?.timeZone || this.timeZone
});
}
toLocaleDateString(t, r) {
return Date.prototype.toLocaleDateString.call(this, t, {
...r,
timeZone: r?.timeZone || this.timeZone
});
}
toLocaleTimeString(t, r) {
return Date.prototype.toLocaleTimeString.call(this, t, {
...r,
timeZone: r?.timeZone || this.timeZone
});
}
//#endregion
//#region private
tzComponents() {
const t = this.getTimezoneOffset(), r = t > 0 ? "-" : "+", n = String(Math.floor(Math.abs(t) / 60)).padStart(2, "0"), o = String(Math.abs(t) % 60).padStart(2, "0");
return [r, n, o];
}
//#endregion
withTimeZone(t) {
return new K(+this, t);
}
//#region date-fns integration
[/* @__PURE__ */ Symbol.for("constructDateFrom")](t) {
return new K(+new Date(t), this.timeZone);
}
//#endregion
}
const ut = 5, Gr = 4;
function Qr(e, t) {
const r = t.startOfMonth(e), n = r.getDay() > 0 ? r.getDay() : 7, o = t.addDays(e, -n + 1), a = t.addDays(o, ut * 7 - 1);
return t.getMonth(e) === t.getMonth(a) ? ut : Gr;
}
function Nt(e, t) {
const r = t.startOfMonth(e), n = r.getDay();
return n === 1 ? r : n === 0 ? t.addDays(r, -6) : t.addDays(r, -1 * (n - 1));
}
function Xr(e, t) {
const r = Nt(e, t), n = Qr(e, t);
return t.addDays(r, n * 7 - 1);
}
class j {
/**
* Creates an instance of `DateLib`.
*
* @param options Configuration options for the date library.
* @param overrides Custom overrides for the date library functions.
*/
constructor(t, r) {
this.Date = Date, this.today = () => this.overrides?.today ? this.overrides.today() : this.options.timeZone ? K.tz(this.options.timeZone) : new this.Date(), this.newDate = (n, o, a) => this.overrides?.newDate ? this.overrides.newDate(n, o, a) : this.options.timeZone ? new K(n, o, a, this.options.timeZone) : new Date(n, o, a), this.addDays = (n, o) => this.overrides?.addDays ? this.overrides.addDays(n, o) : yt(n, o), this.addMonths = (n, o) => this.overrides?.addMonths ? this.overrides.addMonths(n, o) : gt(n, o), this.addWeeks = (n, o) => this.overrides?.addWeeks ? this.overrides.addWeeks(n, o) : On(n, o), this.addYears = (n, o) => this.overrides?.addYears ? this.overrides.addYears(n, o) : vn(n, o), this.differenceInCalendarDays = (n, o) => this.overrides?.differenceInCalendarDays ? this.overrides.differenceInCalendarDays(n, o) : pt(n, o), this.differenceInCalendarMonths = (n, o) => this.overrides?.differenceInCalendarMonths ? this.overrides.differenceInCalendarMonths(n, o) : xn(n, o), this.eachMonthOfInterval = (n) => this.overrides?.eachMonthOfInterval ? this.overrides.eachMonthOfInterval(n) : Yn(n), this.eachYearOfInterval = (n) => {
const o = this.overrides?.eachYearOfInterval ? this.overrides.eachYearOfInterval(n) : _n(n), a = new Set(o.map((i) => this.getYear(i)));
if (a.size === o.length)
return o;
const s = [];
return a.forEach((i) => {
s.push(new Date(i, 0, 1));
}), s;
}, this.endOfBroadcastWeek = (n) => this.overrides?.endOfBroadcastWeek ? this.overrides.endOfBroadcastWeek(n) : Xr(n, this), this.endOfISOWeek = (n) => this.overrides?.endOfISOWeek ? this.overrides.endOfISOWeek(n) : Fn(n), this.endOfMonth = (n) => this.overrides?.endOfMonth ? this.overrides.endOfMonth(n) : Tn(n), this.endOfWeek = (n, o) => this.overrides?.endOfWeek ? this.overrides.endOfWeek(n, o) : kt(n, this.options), this.endOfYear = (n) => this.overrides?.endOfYear ? this.overrides.endOfYear(n) : Pn(n), this.format = (n, o, a) => {
const s = this.overrides?.format ? this.overrides.format(n, o, this.options) : Tr(n, o, this.options);
return this.options.numerals && this.options.numerals !== "latn" ? this.replaceDigits(s) : s;
}, this.getISOWeek = (n) => this.overrides?.getISOWeek ? this.overrides.getISOWeek(n) : Dt(n), this.getMonth = (n, o) => this.overrides?.getMonth ? this.overrides.getMonth(n, this.options) : Pr(n, this.options), this.getYear = (n, o) => this.overrides?.getYear ? this.overrides.getYear(n, this.options) : _r(n, this.options), this.getWeek = (n, o) => this.overrides?.getWeek ? this.overrides.getWeek(n, this.options) : vt(n, this.options), this.isAfter = (n, o) => this.overrides?.isAfter ? this.overrides.isAfter(n, o) : Fr(n, o), this.isBefore = (n, o) => this.overrides?.isBefore ? this.overrides.isBefore(n, o) : Br(n, o), this.isDate = (n) => this.overrides?.isDate ? this.overrides.isDate(n) : We(n), this.isSameDay = (n, o) => this.overrides?.isSameDay ? this.overrides.isSameDay(n, o) : Cn(n, o), this.isSameMonth = (n, o) => this.overrides?.isSameMonth ? this.overrides.isSameMonth(n, o) : Ir(n, o), this.isSameYear = (n, o) => this.overrides?.isSameYear ? this.overrides.isSameYear(n, o) : Hr(n, o), this.max = (n) => this.overrides?.max ? this.overrides.max(n) : Wn(n), this.min = (n) => this.overrides?.min ? this.overrides.min(n) : Sn(n), this.setMonth = (n, o) => this.overrides?.setMonth ? this.overrides.setMonth(n, o) : St(n, o), this.setYear = (n, o) => this.overrides?.setYear ? this.overrides.setYear(n, o) : qr(n, o), this.startOfBroadcastWeek = (n, o) => this.overrides?.startOfBroadcastWeek ? this.overrides.startOfBroadcastWeek(n, this) : Nt(n, this), this.startOfDay = (n) => this.overrides?.startOfDay ? this.overrides.startOfDay(n) : ye(n), this.startOfISOWeek = (n) => this.overrides?.startOfISOWeek ? this.overrides.startOfISOWeek(n) : me(n), this.startOfMonth = (n) => this.overrides?.startOfMonth ? this.overrides.startOfMonth(n) : En(n), this.startOfWeek = (n, o) => this.overrides?.startOfWeek ? this.overrides.startOfWeek(n, this.options) : ie(n, this.options), this.startOfYear = (n) => this.overrides?.startOfYear ? this.overrides.startOfYear(n) : Mt(n), this.options = { locale: $e, ...t }, this.overrides = r;
}
/**
* Generates a mapping of Arabic digits (0-9) to the target numbering system
* digits.
*
* @since 9.5.0
* @returns A record mapping Arabic digits to the target numerals.
*/
getDigitMap() {
const { numerals: t = "latn" } = this.options, r = new Intl.NumberFormat("en-US", {
numberingSystem: t
}), n = {};
for (let o = 0; o < 10; o++)
n[o.toString()] = r.format(o);
return n;
}
/**
* Replaces Arabic digits in a string with the target numbering system digits.
*
* @since 9.5.0
* @param input The string containing Arabic digits.
* @returns The string with digits replaced.
*/
replaceDigits(t) {
const r = this.getDigitMap();
return t.replace(/\d/g, (n) => r[n] || n);
}
/**
* Formats a number using the configured numbering system.
*
* @since 9.5.0
* @param value The number to format.
* @returns The formatted number as a string.
*/
formatNumber(t) {
return this.replaceDigits(t.toString());
}
/**
* Returns the preferred ordering for month and year labels for the current
* locale.
*/
getMonthYearOrder() {
const t = this.options.locale?.code;
return t && j.yearFirstLocales.has(t) ? "year-first" : "month-first";
}
/**
* Formats the month/year pair respecting locale conventions.
*
* @since 9.11.0
*/
formatMonthYear(t) {
const { locale: r, timeZone: n, numerals: o } = this.options, a = r?.code;
if (a && j.yearFirstLocales.has(a))
try {
return new Intl.DateTimeFormat(a, {
month: "long",
year: "numeric",
timeZone: n,
numberingSystem: o
}).format(t);
} catch {
}
const s = this.getMonthYearOrder() === "year-first" ? "y LLLL" : "LLLL y";
return this.format(t, s);
}
}
j.yearFirstLocales = /* @__PURE__ */ new Set([
"eu",
"hu",
"ja",
"ja-Hira",
"ja-JP",
"ko",
"ko-KR",
"lt",
"lt-LT",
"lv",
"lv-LV",
"mn",
"mn-MN",
"zh",
"zh-CN",
"zh-HK",
"zh-TW"
]);
const L = new j();
class xt {
constructor(t, r, n = L) {
this.date = t, this.displayMonth = r, this.outside = !!(r && !n.isSameMonth(t, r)), this.dateLib = n, this.isoDate = n.format(t, "yyyy-MM-dd"), this.displayMonthId = n.format(r, "yyyy-MM"), this.dateMonthId = n.format(t, "yyyy-MM");
}
/**
* Checks if this day is equal to another `CalendarDay`, considering both the
* date and the displayed month.
*
* @param day The `CalendarDay` to compare with.
* @returns `true` if the days are equal, otherwise `false`.
*/
isEqualTo(t) {
return this.dateLib.isSameDay(t.date, this.date) && this.dateLib.isSameMonth(t.displayMonth, this.displayMonth);
}
}
class Zr {
constructor(t, r) {
this.date = t, this.weeks = r;
}
}
class Ur {
constructor(t, r) {
this.days = r, this.weekNumber = t;
}
}
function Lr(e) {
return l.createElement("button", { ...e });
}
function Vr(e) {
return l.createElement("span", { ...e });
}
function Kr(e) {
const { size: t = 24, orientation: r = "left", className: n } = e;
return (
// biome-ignore lint/a11y/noSvgWithoutTitle: handled by the parent component
l.createElement(
"svg",
{ className: n, width: t, height: t, viewBox: "0 0 24 24" },
r === "up" && l.createElement("polygon", { points: "6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28" }),
r === "down" && l.createElement("polygon", { points: "6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72" }),
r === "left" && l.createElement("polygon", { points: "16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20" }),
r === "right" && l.createElement("poly