@anoki/fse-ui
Version:
FSE UI components library
1,819 lines • 193 kB
JavaScript
class G extends Error {
}
class _n extends G {
constructor(e) {
super(`Invalid DateTime: ${e.toMessage()}`);
}
}
class Bn extends G {
constructor(e) {
super(`Invalid Interval: ${e.toMessage()}`);
}
}
class jn extends G {
constructor(e) {
super(`Invalid Duration: ${e.toMessage()}`);
}
}
class Q extends G {
}
class Rt extends G {
constructor(e) {
super(`Invalid unit ${e}`);
}
}
class M extends G {
}
class U extends G {
constructor() {
super("Zone is an abstract class");
}
}
const c = "numeric", L = "short", E = "long", Ie = {
year: c,
month: c,
day: c
}, qt = {
year: c,
month: L,
day: c
}, Qn = {
year: c,
month: L,
day: c,
weekday: L
}, Ht = {
year: c,
month: E,
day: c
}, Yt = {
year: c,
month: E,
day: c,
weekday: E
}, Pt = {
hour: c,
minute: c
}, Gt = {
hour: c,
minute: c,
second: c
}, Jt = {
hour: c,
minute: c,
second: c,
timeZoneName: L
}, _t = {
hour: c,
minute: c,
second: c,
timeZoneName: E
}, Bt = {
hour: c,
minute: c,
hourCycle: "h23"
}, jt = {
hour: c,
minute: c,
second: c,
hourCycle: "h23"
}, Qt = {
hour: c,
minute: c,
second: c,
hourCycle: "h23",
timeZoneName: L
}, Kt = {
hour: c,
minute: c,
second: c,
hourCycle: "h23",
timeZoneName: E
}, Xt = {
year: c,
month: c,
day: c,
hour: c,
minute: c
}, en = {
year: c,
month: c,
day: c,
hour: c,
minute: c,
second: c
}, tn = {
year: c,
month: L,
day: c,
hour: c,
minute: c
}, nn = {
year: c,
month: L,
day: c,
hour: c,
minute: c,
second: c
}, Kn = {
year: c,
month: L,
day: c,
weekday: L,
hour: c,
minute: c
}, rn = {
year: c,
month: E,
day: c,
hour: c,
minute: c,
timeZoneName: L
}, sn = {
year: c,
month: E,
day: c,
hour: c,
minute: c,
second: c,
timeZoneName: L
}, an = {
year: c,
month: E,
day: c,
weekday: E,
hour: c,
minute: c,
timeZoneName: E
}, on = {
year: c,
month: E,
day: c,
weekday: E,
hour: c,
minute: c,
second: c,
timeZoneName: E
};
class me {
/**
* The type of zone
* @abstract
* @type {string}
*/
get type() {
throw new U();
}
/**
* The name of this zone.
* @abstract
* @type {string}
*/
get name() {
throw new U();
}
/**
* The IANA name of this zone.
* Defaults to `name` if not overwritten by a subclass.
* @abstract
* @type {string}
*/
get ianaName() {
return this.name;
}
/**
* Returns whether the offset is known to be fixed for the whole year.
* @abstract
* @type {boolean}
*/
get isUniversal() {
throw new U();
}
/**
* Returns the offset's common name (such as EST) at the specified timestamp
* @abstract
* @param {number} ts - Epoch milliseconds for which to get the name
* @param {Object} opts - Options to affect the format
* @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'.
* @param {string} opts.locale - What locale to return the offset name in.
* @return {string}
*/
offsetName(e, t) {
throw new U();
}
/**
* Returns the offset's value as a string
* @abstract
* @param {number} ts - Epoch milliseconds for which to get the offset
* @param {string} format - What style of offset to return.
* Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively
* @return {string}
*/
formatOffset(e, t) {
throw new U();
}
/**
* Return the offset in minutes for this zone at the specified timestamp.
* @abstract
* @param {number} ts - Epoch milliseconds for which to compute the offset
* @return {number}
*/
offset(e) {
throw new U();
}
/**
* Return whether this Zone is equal to another zone
* @abstract
* @param {Zone} otherZone - the zone to compare
* @return {boolean}
*/
equals(e) {
throw new U();
}
/**
* Return whether this Zone is valid.
* @abstract
* @type {boolean}
*/
get isValid() {
throw new U();
}
}
let Le = null;
class be extends me {
/**
* Get a singleton instance of the local zone
* @return {SystemZone}
*/
static get instance() {
return Le === null && (Le = new be()), Le;
}
/** @override **/
get type() {
return "system";
}
/** @override **/
get name() {
return new Intl.DateTimeFormat().resolvedOptions().timeZone;
}
/** @override **/
get isUniversal() {
return !1;
}
/** @override **/
offsetName(e, { format: t, locale: r }) {
return kn(e, t, r);
}
/** @override **/
formatOffset(e, t) {
return de(this.offset(e), t);
}
/** @override **/
offset(e) {
return -new Date(e).getTimezoneOffset();
}
/** @override **/
equals(e) {
return e.type === "system";
}
/** @override **/
get isValid() {
return !0;
}
}
const Ye = /* @__PURE__ */ new Map();
function Xn(n) {
let e = Ye.get(n);
return e === void 0 && (e = new Intl.DateTimeFormat("en-US", {
hour12: !1,
timeZone: n,
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
era: "short"
}), Ye.set(n, e)), e;
}
const er = {
year: 0,
month: 1,
day: 2,
era: 3,
hour: 4,
minute: 5,
second: 6
};
function tr(n, e) {
const t = n.format(e).replace(/\u200E/g, ""), r = /(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t), [, s, i, a, o, u, l, f] = r;
return [a, s, i, o, u, l, f];
}
function nr(n, e) {
const t = n.formatToParts(e), r = [];
for (let s = 0; s < t.length; s++) {
const { type: i, value: a } = t[s], o = er[i];
i === "era" ? r[o] = a : h(o) || (r[o] = parseInt(a, 10));
}
return r;
}
const $e = /* @__PURE__ */ new Map();
class A extends me {
/**
* @param {string} name - Zone name
* @return {IANAZone}
*/
static create(e) {
let t = $e.get(e);
return t === void 0 && $e.set(e, t = new A(e)), t;
}
/**
* Reset local caches. Should only be necessary in testing scenarios.
* @return {void}
*/
static resetCache() {
$e.clear(), Ye.clear();
}
/**
* Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that.
* @param {string} s - The string to check validity on
* @example IANAZone.isValidSpecifier("America/New_York") //=> true
* @example IANAZone.isValidSpecifier("Sport~~blorp") //=> false
* @deprecated For backward compatibility, this forwards to isValidZone, better use `isValidZone()` directly instead.
* @return {boolean}
*/
static isValidSpecifier(e) {
return this.isValidZone(e);
}
/**
* Returns whether the provided string identifies a real zone
* @param {string} zone - The string to check
* @example IANAZone.isValidZone("America/New_York") //=> true
* @example IANAZone.isValidZone("Fantasia/Castle") //=> false
* @example IANAZone.isValidZone("Sport~~blorp") //=> false
* @return {boolean}
*/
static isValidZone(e) {
if (!e)
return !1;
try {
return new Intl.DateTimeFormat("en-US", { timeZone: e }).format(), !0;
} catch {
return !1;
}
}
constructor(e) {
super(), this.zoneName = e, this.valid = A.isValidZone(e);
}
/**
* The type of zone. `iana` for all instances of `IANAZone`.
* @override
* @type {string}
*/
get type() {
return "iana";
}
/**
* The name of this zone (i.e. the IANA zone name).
* @override
* @type {string}
*/
get name() {
return this.zoneName;
}
/**
* Returns whether the offset is known to be fixed for the whole year:
* Always returns false for all IANA zones.
* @override
* @type {boolean}
*/
get isUniversal() {
return !1;
}
/**
* Returns the offset's common name (such as EST) at the specified timestamp
* @override
* @param {number} ts - Epoch milliseconds for which to get the name
* @param {Object} opts - Options to affect the format
* @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'.
* @param {string} opts.locale - What locale to return the offset name in.
* @return {string}
*/
offsetName(e, { format: t, locale: r }) {
return kn(e, t, r, this.name);
}
/**
* Returns the offset's value as a string
* @override
* @param {number} ts - Epoch milliseconds for which to get the offset
* @param {string} format - What style of offset to return.
* Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively
* @return {string}
*/
formatOffset(e, t) {
return de(this.offset(e), t);
}
/**
* Return the offset in minutes for this zone at the specified timestamp.
* @override
* @param {number} ts - Epoch milliseconds for which to compute the offset
* @return {number}
*/
offset(e) {
if (!this.valid) return NaN;
const t = new Date(e);
if (isNaN(t)) return NaN;
const r = Xn(this.name);
let [s, i, a, o, u, l, f] = r.formatToParts ? nr(r, t) : tr(r, t);
o === "BC" && (s = -Math.abs(s) + 1);
const T = Ve({
year: s,
month: i,
day: a,
hour: u === 24 ? 0 : u,
minute: l,
second: f,
millisecond: 0
});
let d = +t;
const O = d % 1e3;
return d -= O >= 0 ? O : 1e3 + O, (T - d) / (60 * 1e3);
}
/**
* Return whether this Zone is equal to another zone
* @override
* @param {Zone} otherZone - the zone to compare
* @return {boolean}
*/
equals(e) {
return e.type === "iana" && e.name === this.name;
}
/**
* Return whether this Zone is valid.
* @override
* @type {boolean}
*/
get isValid() {
return this.valid;
}
}
let ft = {};
function rr(n, e = {}) {
const t = JSON.stringify([n, e]);
let r = ft[t];
return r || (r = new Intl.ListFormat(n, e), ft[t] = r), r;
}
const Pe = /* @__PURE__ */ new Map();
function Ge(n, e = {}) {
const t = JSON.stringify([n, e]);
let r = Pe.get(t);
return r === void 0 && (r = new Intl.DateTimeFormat(n, e), Pe.set(t, r)), r;
}
const Je = /* @__PURE__ */ new Map();
function sr(n, e = {}) {
const t = JSON.stringify([n, e]);
let r = Je.get(t);
return r === void 0 && (r = new Intl.NumberFormat(n, e), Je.set(t, r)), r;
}
const _e = /* @__PURE__ */ new Map();
function ir(n, e = {}) {
const { base: t, ...r } = e, s = JSON.stringify([n, r]);
let i = _e.get(s);
return i === void 0 && (i = new Intl.RelativeTimeFormat(n, e), _e.set(s, i)), i;
}
let le = null;
function ar() {
return le || (le = new Intl.DateTimeFormat().resolvedOptions().locale, le);
}
const Be = /* @__PURE__ */ new Map();
function un(n) {
let e = Be.get(n);
return e === void 0 && (e = new Intl.DateTimeFormat(n).resolvedOptions(), Be.set(n, e)), e;
}
const je = /* @__PURE__ */ new Map();
function or(n) {
let e = je.get(n);
if (!e) {
const t = new Intl.Locale(n);
e = "getWeekInfo" in t ? t.getWeekInfo() : t.weekInfo, "minimalDays" in e || (e = { ...ln, ...e }), je.set(n, e);
}
return e;
}
function ur(n) {
const e = n.indexOf("-x-");
e !== -1 && (n = n.substring(0, e));
const t = n.indexOf("-u-");
if (t === -1)
return [n];
{
let r, s;
try {
r = Ge(n).resolvedOptions(), s = n;
} catch {
const u = n.substring(0, t);
r = Ge(u).resolvedOptions(), s = u;
}
const { numberingSystem: i, calendar: a } = r;
return [s, i, a];
}
}
function lr(n, e, t) {
return (t || e) && (n.includes("-u-") || (n += "-u"), t && (n += `-ca-${t}`), e && (n += `-nu-${e}`)), n;
}
function cr(n) {
const e = [];
for (let t = 1; t <= 12; t++) {
const r = m.utc(2009, t, 1);
e.push(n(r));
}
return e;
}
function fr(n) {
const e = [];
for (let t = 1; t <= 7; t++) {
const r = m.utc(2016, 11, 13 + t);
e.push(n(r));
}
return e;
}
function ke(n, e, t, r) {
const s = n.listingMode();
return s === "error" ? null : s === "en" ? t(e) : r(e);
}
function dr(n) {
return n.numberingSystem && n.numberingSystem !== "latn" ? !1 : n.numberingSystem === "latn" || !n.locale || n.locale.startsWith("en") || un(n.locale).numberingSystem === "latn";
}
class hr {
constructor(e, t, r) {
this.padTo = r.padTo || 0, this.floor = r.floor || !1;
const { padTo: s, floor: i, ...a } = r;
if (!t || Object.keys(a).length > 0) {
const o = { useGrouping: !1, ...r };
r.padTo > 0 && (o.minimumIntegerDigits = r.padTo), this.inf = sr(e, o);
}
}
format(e) {
if (this.inf) {
const t = this.floor ? Math.floor(e) : e;
return this.inf.format(t);
} else {
const t = this.floor ? Math.floor(e) : it(e, 3);
return v(t, this.padTo);
}
}
}
class mr {
constructor(e, t, r) {
this.opts = r, this.originalZone = void 0;
let s;
if (this.opts.timeZone)
this.dt = e;
else if (e.zone.type === "fixed") {
const a = -1 * (e.offset / 60), o = a >= 0 ? `Etc/GMT+${a}` : `Etc/GMT${a}`;
e.offset !== 0 && A.create(o).valid ? (s = o, this.dt = e) : (s = "UTC", this.dt = e.offset === 0 ? e : e.setZone("UTC").plus({ minutes: e.offset }), this.originalZone = e.zone);
} else e.zone.type === "system" ? this.dt = e : e.zone.type === "iana" ? (this.dt = e, s = e.zone.name) : (s = "UTC", this.dt = e.setZone("UTC").plus({ minutes: e.offset }), this.originalZone = e.zone);
const i = { ...this.opts };
i.timeZone = i.timeZone || s, this.dtf = Ge(t, i);
}
format() {
return this.originalZone ? this.formatToParts().map(({ value: e }) => e).join("") : this.dtf.format(this.dt.toJSDate());
}
formatToParts() {
const e = this.dtf.formatToParts(this.dt.toJSDate());
return this.originalZone ? e.map((t) => {
if (t.type === "timeZoneName") {
const r = this.originalZone.offsetName(this.dt.ts, {
locale: this.dt.locale,
format: this.opts.timeZoneName
});
return {
...t,
value: r
};
} else
return t;
}) : e;
}
resolvedOptions() {
return this.dtf.resolvedOptions();
}
}
class yr {
constructor(e, t, r) {
this.opts = { style: "long", ...r }, !t && gn() && (this.rtf = ir(e, r));
}
format(e, t) {
return this.rtf ? this.rtf.format(e, t) : Zr(t, e, this.opts.numeric, this.opts.style !== "long");
}
formatToParts(e, t) {
return this.rtf ? this.rtf.formatToParts(e, t) : [];
}
}
const ln = {
firstDay: 1,
minimalDays: 4,
weekend: [6, 7]
};
class k {
static fromOpts(e) {
return k.create(
e.locale,
e.numberingSystem,
e.outputCalendar,
e.weekSettings,
e.defaultToEN
);
}
static create(e, t, r, s, i = !1) {
const a = e || p.defaultLocale, o = a || (i ? "en-US" : ar()), u = t || p.defaultNumberingSystem, l = r || p.defaultOutputCalendar, f = Ke(s) || p.defaultWeekSettings;
return new k(o, u, l, f, a);
}
static resetCache() {
le = null, Pe.clear(), Je.clear(), _e.clear(), Be.clear(), je.clear();
}
static fromObject({ locale: e, numberingSystem: t, outputCalendar: r, weekSettings: s } = {}) {
return k.create(e, t, r, s);
}
constructor(e, t, r, s, i) {
const [a, o, u] = ur(e);
this.locale = a, this.numberingSystem = t || o || null, this.outputCalendar = r || u || null, this.weekSettings = s, this.intl = lr(this.locale, this.numberingSystem, this.outputCalendar), this.weekdaysCache = { format: {}, standalone: {} }, this.monthsCache = { format: {}, standalone: {} }, this.meridiemCache = null, this.eraCache = {}, this.specifiedLocale = i, this.fastNumbersCached = null;
}
get fastNumbers() {
return this.fastNumbersCached == null && (this.fastNumbersCached = dr(this)), this.fastNumbersCached;
}
listingMode() {
const e = this.isEnglish(), t = (this.numberingSystem === null || this.numberingSystem === "latn") && (this.outputCalendar === null || this.outputCalendar === "gregory");
return e && t ? "en" : "intl";
}
clone(e) {
return !e || Object.getOwnPropertyNames(e).length === 0 ? this : k.create(
e.locale || this.specifiedLocale,
e.numberingSystem || this.numberingSystem,
e.outputCalendar || this.outputCalendar,
Ke(e.weekSettings) || this.weekSettings,
e.defaultToEN || !1
);
}
redefaultToEN(e = {}) {
return this.clone({ ...e, defaultToEN: !0 });
}
redefaultToSystem(e = {}) {
return this.clone({ ...e, defaultToEN: !1 });
}
months(e, t = !1) {
return ke(this, e, pn, () => {
const r = this.intl === "ja" || this.intl.startsWith("ja-");
t &= !r;
const s = t ? { month: e, day: "numeric" } : { month: e }, i = t ? "format" : "standalone";
if (!this.monthsCache[i][e]) {
const a = r ? (o) => this.dtFormatter(o, s).format() : (o) => this.extract(o, s, "month");
this.monthsCache[i][e] = cr(a);
}
return this.monthsCache[i][e];
});
}
weekdays(e, t = !1) {
return ke(this, e, Mn, () => {
const r = t ? { weekday: e, year: "numeric", month: "long", day: "numeric" } : { weekday: e }, s = t ? "format" : "standalone";
return this.weekdaysCache[s][e] || (this.weekdaysCache[s][e] = fr(
(i) => this.extract(i, r, "weekday")
)), this.weekdaysCache[s][e];
});
}
meridiems() {
return ke(
this,
void 0,
() => Nn,
() => {
if (!this.meridiemCache) {
const e = { hour: "numeric", hourCycle: "h12" };
this.meridiemCache = [m.utc(2016, 11, 13, 9), m.utc(2016, 11, 13, 19)].map(
(t) => this.extract(t, e, "dayperiod")
);
}
return this.meridiemCache;
}
);
}
eras(e) {
return ke(this, e, In, () => {
const t = { era: e };
return this.eraCache[e] || (this.eraCache[e] = [m.utc(-40, 1, 1), m.utc(2017, 1, 1)].map(
(r) => this.extract(r, t, "era")
)), this.eraCache[e];
});
}
extract(e, t, r) {
const s = this.dtFormatter(e, t), i = s.formatToParts(), a = i.find((o) => o.type.toLowerCase() === r);
return a ? a.value : null;
}
numberFormatter(e = {}) {
return new hr(this.intl, e.forceSimple || this.fastNumbers, e);
}
dtFormatter(e, t = {}) {
return new mr(e, this.intl, t);
}
relFormatter(e = {}) {
return new yr(this.intl, this.isEnglish(), e);
}
listFormatter(e = {}) {
return rr(this.intl, e);
}
isEnglish() {
return this.locale === "en" || this.locale.toLowerCase() === "en-us" || un(this.intl).locale.startsWith("en-us");
}
getWeekSettings() {
return this.weekSettings ? this.weekSettings : wn() ? or(this.locale) : ln;
}
getStartOfWeek() {
return this.getWeekSettings().firstDay;
}
getMinDaysInFirstWeek() {
return this.getWeekSettings().minimalDays;
}
getWeekendDays() {
return this.getWeekSettings().weekend;
}
equals(e) {
return this.locale === e.locale && this.numberingSystem === e.numberingSystem && this.outputCalendar === e.outputCalendar;
}
toString() {
return `Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`;
}
}
let Ze = null;
class I extends me {
/**
* Get a singleton instance of UTC
* @return {FixedOffsetZone}
*/
static get utcInstance() {
return Ze === null && (Ze = new I(0)), Ze;
}
/**
* Get an instance with a specified offset
* @param {number} offset - The offset in minutes
* @return {FixedOffsetZone}
*/
static instance(e) {
return e === 0 ? I.utcInstance : new I(e);
}
/**
* Get an instance of FixedOffsetZone from a UTC offset string, like "UTC+6"
* @param {string} s - The offset string to parse
* @example FixedOffsetZone.parseSpecifier("UTC+6")
* @example FixedOffsetZone.parseSpecifier("UTC+06")
* @example FixedOffsetZone.parseSpecifier("UTC-6:00")
* @return {FixedOffsetZone}
*/
static parseSpecifier(e) {
if (e) {
const t = e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);
if (t)
return new I(Ce(t[1], t[2]));
}
return null;
}
constructor(e) {
super(), this.fixed = e;
}
/**
* The type of zone. `fixed` for all instances of `FixedOffsetZone`.
* @override
* @type {string}
*/
get type() {
return "fixed";
}
/**
* The name of this zone.
* All fixed zones' names always start with "UTC" (plus optional offset)
* @override
* @type {string}
*/
get name() {
return this.fixed === 0 ? "UTC" : `UTC${de(this.fixed, "narrow")}`;
}
/**
* The IANA name of this zone, i.e. `Etc/UTC` or `Etc/GMT+/-nn`
*
* @override
* @type {string}
*/
get ianaName() {
return this.fixed === 0 ? "Etc/UTC" : `Etc/GMT${de(-this.fixed, "narrow")}`;
}
/**
* Returns the offset's common name at the specified timestamp.
*
* For fixed offset zones this equals to the zone name.
* @override
*/
offsetName() {
return this.name;
}
/**
* Returns the offset's value as a string
* @override
* @param {number} ts - Epoch milliseconds for which to get the offset
* @param {string} format - What style of offset to return.
* Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively
* @return {string}
*/
formatOffset(e, t) {
return de(this.fixed, t);
}
/**
* Returns whether the offset is known to be fixed for the whole year:
* Always returns true for all fixed offset zones.
* @override
* @type {boolean}
*/
get isUniversal() {
return !0;
}
/**
* Return the offset in minutes for this zone at the specified timestamp.
*
* For fixed offset zones, this is constant and does not depend on a timestamp.
* @override
* @return {number}
*/
offset() {
return this.fixed;
}
/**
* Return whether this Zone is equal to another zone (i.e. also fixed and same offset)
* @override
* @param {Zone} otherZone - the zone to compare
* @return {boolean}
*/
equals(e) {
return e.type === "fixed" && e.fixed === this.fixed;
}
/**
* Return whether this Zone is valid:
* All fixed offset zones are valid.
* @override
* @type {boolean}
*/
get isValid() {
return !0;
}
}
class gr extends me {
constructor(e) {
super(), this.zoneName = e;
}
/** @override **/
get type() {
return "invalid";
}
/** @override **/
get name() {
return this.zoneName;
}
/** @override **/
get isUniversal() {
return !1;
}
/** @override **/
offsetName() {
return null;
}
/** @override **/
formatOffset() {
return "";
}
/** @override **/
offset() {
return NaN;
}
/** @override **/
equals() {
return !1;
}
/** @override **/
get isValid() {
return !1;
}
}
function R(n, e) {
if (h(n) || n === null)
return e;
if (n instanceof me)
return n;
if (Or(n)) {
const t = n.toLowerCase();
return t === "default" ? e : t === "local" || t === "system" ? be.instance : t === "utc" || t === "gmt" ? I.utcInstance : I.parseSpecifier(t) || A.create(n);
} else return q(n) ? I.instance(n) : typeof n == "object" && "offset" in n && typeof n.offset == "function" ? n : new gr(n);
}
const tt = {
arab: "[٠-٩]",
arabext: "[۰-۹]",
bali: "[᭐-᭙]",
beng: "[০-৯]",
deva: "[०-९]",
fullwide: "[0-9]",
gujr: "[૦-૯]",
hanidec: "[〇|一|二|三|四|五|六|七|八|九]",
khmr: "[០-៩]",
knda: "[೦-೯]",
laoo: "[໐-໙]",
limb: "[᥆-᥏]",
mlym: "[൦-൯]",
mong: "[᠐-᠙]",
mymr: "[၀-၉]",
orya: "[୦-୯]",
tamldec: "[௦-௯]",
telu: "[౦-౯]",
thai: "[๐-๙]",
tibt: "[༠-༩]",
latn: "\\d"
}, dt = {
arab: [1632, 1641],
arabext: [1776, 1785],
bali: [6992, 7001],
beng: [2534, 2543],
deva: [2406, 2415],
fullwide: [65296, 65303],
gujr: [2790, 2799],
khmr: [6112, 6121],
knda: [3302, 3311],
laoo: [3792, 3801],
limb: [6470, 6479],
mlym: [3430, 3439],
mong: [6160, 6169],
mymr: [4160, 4169],
orya: [2918, 2927],
tamldec: [3046, 3055],
telu: [3174, 3183],
thai: [3664, 3673],
tibt: [3872, 3881]
}, wr = tt.hanidec.replace(/[\[|\]]/g, "").split("");
function kr(n) {
let e = parseInt(n, 10);
if (isNaN(e)) {
e = "";
for (let t = 0; t < n.length; t++) {
const r = n.charCodeAt(t);
if (n[t].search(tt.hanidec) !== -1)
e += wr.indexOf(n[t]);
else
for (const s in dt) {
const [i, a] = dt[s];
r >= i && r <= a && (e += r - i);
}
}
return parseInt(e, 10);
} else
return e;
}
const Qe = /* @__PURE__ */ new Map();
function Tr() {
Qe.clear();
}
function V({ numberingSystem: n }, e = "") {
const t = n || "latn";
let r = Qe.get(t);
r === void 0 && (r = /* @__PURE__ */ new Map(), Qe.set(t, r));
let s = r.get(e);
return s === void 0 && (s = new RegExp(`${tt[t]}${e}`), r.set(e, s)), s;
}
let ht = () => Date.now(), mt = "system", yt = null, gt = null, wt = null, kt = 60, Tt, St = null;
class p {
/**
* Get the callback for returning the current timestamp.
* @type {function}
*/
static get now() {
return ht;
}
/**
* Set the callback for returning the current timestamp.
* The function should return a number, which will be interpreted as an Epoch millisecond count
* @type {function}
* @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future
* @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time
*/
static set now(e) {
ht = e;
}
/**
* Set the default time zone to create DateTimes in. Does not affect existing instances.
* Use the value "system" to reset this value to the system's time zone.
* @type {string}
*/
static set defaultZone(e) {
mt = e;
}
/**
* Get the default time zone object currently used to create DateTimes. Does not affect existing instances.
* The default value is the system's time zone (the one set on the machine that runs this code).
* @type {Zone}
*/
static get defaultZone() {
return R(mt, be.instance);
}
/**
* Get the default locale to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
static get defaultLocale() {
return yt;
}
/**
* Set the default locale to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
static set defaultLocale(e) {
yt = e;
}
/**
* Get the default numbering system to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
static get defaultNumberingSystem() {
return gt;
}
/**
* Set the default numbering system to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
static set defaultNumberingSystem(e) {
gt = e;
}
/**
* Get the default output calendar to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
static get defaultOutputCalendar() {
return wt;
}
/**
* Set the default output calendar to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
static set defaultOutputCalendar(e) {
wt = e;
}
/**
* @typedef {Object} WeekSettings
* @property {number} firstDay
* @property {number} minimalDays
* @property {number[]} weekend
*/
/**
* @return {WeekSettings|null}
*/
static get defaultWeekSettings() {
return St;
}
/**
* Allows overriding the default locale week settings, i.e. the start of the week, the weekend and
* how many days are required in the first week of a year.
* Does not affect existing instances.
*
* @param {WeekSettings|null} weekSettings
*/
static set defaultWeekSettings(e) {
St = Ke(e);
}
/**
* Get the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx.
* @type {number}
*/
static get twoDigitCutoffYear() {
return kt;
}
/**
* Set the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx.
* @type {number}
* @example Settings.twoDigitCutoffYear = 0 // all 'yy' are interpreted as 20th century
* @example Settings.twoDigitCutoffYear = 99 // all 'yy' are interpreted as 21st century
* @example Settings.twoDigitCutoffYear = 50 // '49' -> 2049; '50' -> 1950
* @example Settings.twoDigitCutoffYear = 1950 // interpreted as 50
* @example Settings.twoDigitCutoffYear = 2050 // ALSO interpreted as 50
*/
static set twoDigitCutoffYear(e) {
kt = e % 100;
}
/**
* Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals
* @type {boolean}
*/
static get throwOnInvalid() {
return Tt;
}
/**
* Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals
* @type {boolean}
*/
static set throwOnInvalid(e) {
Tt = e;
}
/**
* Reset Luxon's global caches. Should only be necessary in testing scenarios.
* @return {void}
*/
static resetCaches() {
k.resetCache(), A.resetCache(), m.resetCache(), Tr();
}
}
class W {
constructor(e, t) {
this.reason = e, this.explanation = t;
}
toMessage() {
return this.explanation ? `${this.reason}: ${this.explanation}` : this.reason;
}
}
const cn = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], fn = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
function x(n, e) {
return new W(
"unit out of range",
`you specified ${e} (of type ${typeof e}) as a ${n}, which is invalid`
);
}
function nt(n, e, t) {
const r = new Date(Date.UTC(n, e - 1, t));
n < 100 && n >= 0 && r.setUTCFullYear(r.getUTCFullYear() - 1900);
const s = r.getUTCDay();
return s === 0 ? 7 : s;
}
function dn(n, e, t) {
return t + (ye(n) ? fn : cn)[e - 1];
}
function hn(n, e) {
const t = ye(n) ? fn : cn, r = t.findIndex((i) => i < e), s = e - t[r];
return { month: r + 1, day: s };
}
function rt(n, e) {
return (n - e + 7) % 7 + 1;
}
function Ee(n, e = 4, t = 1) {
const { year: r, month: s, day: i } = n, a = dn(r, s, i), o = rt(nt(r, s, i), t);
let u = Math.floor((a - o + 14 - e) / 7), l;
return u < 1 ? (l = r - 1, u = he(l, e, t)) : u > he(r, e, t) ? (l = r + 1, u = 1) : l = r, { weekYear: l, weekNumber: u, weekday: o, ...We(n) };
}
function pt(n, e = 4, t = 1) {
const { weekYear: r, weekNumber: s, weekday: i } = n, a = rt(nt(r, 1, e), t), o = K(r);
let u = s * 7 + i - a - 7 + e, l;
u < 1 ? (l = r - 1, u += K(l)) : u > o ? (l = r + 1, u -= K(r)) : l = r;
const { month: f, day: y } = hn(l, u);
return { year: l, month: f, day: y, ...We(n) };
}
function Ae(n) {
const { year: e, month: t, day: r } = n, s = dn(e, t, r);
return { year: e, ordinal: s, ...We(n) };
}
function Ot(n) {
const { year: e, ordinal: t } = n, { month: r, day: s } = hn(e, t);
return { year: e, month: r, day: s, ...We(n) };
}
function vt(n, e) {
if (!h(n.localWeekday) || !h(n.localWeekNumber) || !h(n.localWeekYear)) {
if (!h(n.weekday) || !h(n.weekNumber) || !h(n.weekYear))
throw new Q(
"Cannot mix locale-based week fields with ISO-based week fields"
);
return h(n.localWeekday) || (n.weekday = n.localWeekday), h(n.localWeekNumber) || (n.weekNumber = n.localWeekNumber), h(n.localWeekYear) || (n.weekYear = n.localWeekYear), delete n.localWeekday, delete n.localWeekNumber, delete n.localWeekYear, {
minDaysInFirstWeek: e.getMinDaysInFirstWeek(),
startOfWeek: e.getStartOfWeek()
};
} else
return { minDaysInFirstWeek: 4, startOfWeek: 1 };
}
function Sr(n, e = 4, t = 1) {
const r = Fe(n.weekYear), s = b(
n.weekNumber,
1,
he(n.weekYear, e, t)
), i = b(n.weekday, 1, 7);
return r ? s ? i ? !1 : x("weekday", n.weekday) : x("week", n.weekNumber) : x("weekYear", n.weekYear);
}
function pr(n) {
const e = Fe(n.year), t = b(n.ordinal, 1, K(n.year));
return e ? t ? !1 : x("ordinal", n.ordinal) : x("year", n.year);
}
function mn(n) {
const e = Fe(n.year), t = b(n.month, 1, 12), r = b(n.day, 1, De(n.year, n.month));
return e ? t ? r ? !1 : x("day", n.day) : x("month", n.month) : x("year", n.year);
}
function yn(n) {
const { hour: e, minute: t, second: r, millisecond: s } = n, i = b(e, 0, 23) || e === 24 && t === 0 && r === 0 && s === 0, a = b(t, 0, 59), o = b(r, 0, 59), u = b(s, 0, 999);
return i ? a ? o ? u ? !1 : x("millisecond", s) : x("second", r) : x("minute", t) : x("hour", e);
}
function h(n) {
return typeof n > "u";
}
function q(n) {
return typeof n == "number";
}
function Fe(n) {
return typeof n == "number" && n % 1 === 0;
}
function Or(n) {
return typeof n == "string";
}
function vr(n) {
return Object.prototype.toString.call(n) === "[object Date]";
}
function gn() {
try {
return typeof Intl < "u" && !!Intl.RelativeTimeFormat;
} catch {
return !1;
}
}
function wn() {
try {
return typeof Intl < "u" && !!Intl.Locale && ("weekInfo" in Intl.Locale.prototype || "getWeekInfo" in Intl.Locale.prototype);
} catch {
return !1;
}
}
function Mr(n) {
return Array.isArray(n) ? n : [n];
}
function Mt(n, e, t) {
if (n.length !== 0)
return n.reduce((r, s) => {
const i = [e(s), s];
return r && t(r[0], i[0]) === r[0] ? r : i;
}, null)[1];
}
function Nr(n, e) {
return e.reduce((t, r) => (t[r] = n[r], t), {});
}
function ee(n, e) {
return Object.prototype.hasOwnProperty.call(n, e);
}
function Ke(n) {
if (n == null)
return null;
if (typeof n != "object")
throw new M("Week settings must be an object");
if (!b(n.firstDay, 1, 7) || !b(n.minimalDays, 1, 7) || !Array.isArray(n.weekend) || n.weekend.some((e) => !b(e, 1, 7)))
throw new M("Invalid week settings");
return {
firstDay: n.firstDay,
minimalDays: n.minimalDays,
weekend: Array.from(n.weekend)
};
}
function b(n, e, t) {
return Fe(n) && n >= e && n <= t;
}
function Ir(n, e) {
return n - e * Math.floor(n / e);
}
function v(n, e = 2) {
const t = n < 0;
let r;
return t ? r = "-" + ("" + -n).padStart(e, "0") : r = ("" + n).padStart(e, "0"), r;
}
function z(n) {
if (!(h(n) || n === null || n === ""))
return parseInt(n, 10);
}
function H(n) {
if (!(h(n) || n === null || n === ""))
return parseFloat(n);
}
function st(n) {
if (!(h(n) || n === null || n === "")) {
const e = parseFloat("0." + n) * 1e3;
return Math.floor(e);
}
}
function it(n, e, t = "round") {
const r = 10 ** e;
switch (t) {
case "expand":
return n > 0 ? Math.ceil(n * r) / r : Math.floor(n * r) / r;
case "trunc":
return Math.trunc(n * r) / r;
case "round":
return Math.round(n * r) / r;
case "floor":
return Math.floor(n * r) / r;
case "ceil":
return Math.ceil(n * r) / r;
default:
throw new RangeError(`Value rounding ${t} is out of range`);
}
}
function ye(n) {
return n % 4 === 0 && (n % 100 !== 0 || n % 400 === 0);
}
function K(n) {
return ye(n) ? 366 : 365;
}
function De(n, e) {
const t = Ir(e - 1, 12) + 1, r = n + (e - t) / 12;
return t === 2 ? ye(r) ? 29 : 28 : [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][t - 1];
}
function Ve(n) {
let e = Date.UTC(
n.year,
n.month - 1,
n.day,
n.hour,
n.minute,
n.second,
n.millisecond
);
return n.year < 100 && n.year >= 0 && (e = new Date(e), e.setUTCFullYear(n.year, n.month - 1, n.day)), +e;
}
function Nt(n, e, t) {
return -rt(nt(n, 1, e), t) + e - 1;
}
function he(n, e = 4, t = 1) {
const r = Nt(n, e, t), s = Nt(n + 1, e, t);
return (K(n) - r + s) / 7;
}
function Xe(n) {
return n > 99 ? n : n > p.twoDigitCutoffYear ? 1900 + n : 2e3 + n;
}
function kn(n, e, t, r = null) {
const s = new Date(n), i = {
hourCycle: "h23",
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit"
};
r && (i.timeZone = r);
const a = { timeZoneName: e, ...i }, o = new Intl.DateTimeFormat(t, a).formatToParts(s).find((u) => u.type.toLowerCase() === "timezonename");
return o ? o.value : null;
}
function Ce(n, e) {
let t = parseInt(n, 10);
Number.isNaN(t) && (t = 0);
const r = parseInt(e, 10) || 0, s = t < 0 || Object.is(t, -0) ? -r : r;
return t * 60 + s;
}
function Tn(n) {
const e = Number(n);
if (typeof n == "boolean" || n === "" || !Number.isFinite(e))
throw new M(`Invalid unit value ${n}`);
return e;
}
function xe(n, e) {
const t = {};
for (const r in n)
if (ee(n, r)) {
const s = n[r];
if (s == null) continue;
t[e(r)] = Tn(s);
}
return t;
}
function de(n, e) {
const t = Math.trunc(Math.abs(n / 60)), r = Math.trunc(Math.abs(n % 60)), s = n >= 0 ? "+" : "-";
switch (e) {
case "short":
return `${s}${v(t, 2)}:${v(r, 2)}`;
case "narrow":
return `${s}${t}${r > 0 ? `:${r}` : ""}`;
case "techie":
return `${s}${v(t, 2)}${v(r, 2)}`;
default:
throw new RangeError(`Value format ${e} is out of range for property format`);
}
}
function We(n) {
return Nr(n, ["hour", "minute", "second", "millisecond"]);
}
const Er = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
], Sn = [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
], Dr = ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"];
function pn(n) {
switch (n) {
case "narrow":
return [...Dr];
case "short":
return [...Sn];
case "long":
return [...Er];
case "numeric":
return ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
case "2-digit":
return ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"];
default:
return null;
}
}
const On = [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday"
], vn = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], xr = ["M", "T", "W", "T", "F", "S", "S"];
function Mn(n) {
switch (n) {
case "narrow":
return [...xr];
case "short":
return [...vn];
case "long":
return [...On];
case "numeric":
return ["1", "2", "3", "4", "5", "6", "7"];
default:
return null;
}
}
const Nn = ["AM", "PM"], br = ["Before Christ", "Anno Domini"], Fr = ["BC", "AD"], Vr = ["B", "A"];
function In(n) {
switch (n) {
case "narrow":
return [...Vr];
case "short":
return [...Fr];
case "long":
return [...br];
default:
return null;
}
}
function Cr(n) {
return Nn[n.hour < 12 ? 0 : 1];
}
function Wr(n, e) {
return Mn(e)[n.weekday - 1];
}
function Lr(n, e) {
return pn(e)[n.month - 1];
}
function $r(n, e) {
return In(e)[n.year < 0 ? 0 : 1];
}
function Zr(n, e, t = "always", r = !1) {
const s = {
years: ["year", "yr."],
quarters: ["quarter", "qtr."],
months: ["month", "mo."],
weeks: ["week", "wk."],
days: ["day", "day", "days"],
hours: ["hour", "hr."],
minutes: ["minute", "min."],
seconds: ["second", "sec."]
}, i = ["hours", "minutes", "seconds"].indexOf(n) === -1;
if (t === "auto" && i) {
const y = n === "days";
switch (e) {
case 1:
return y ? "tomorrow" : `next ${s[n][0]}`;
case -1:
return y ? "yesterday" : `last ${s[n][0]}`;
case 0:
return y ? "today" : `this ${s[n][0]}`;
}
}
const a = Object.is(e, -0) || e < 0, o = Math.abs(e), u = o === 1, l = s[n], f = r ? u ? l[1] : l[2] || l[1] : u ? s[n][0] : n;
return a ? `${o} ${f} ago` : `in ${o} ${f}`;
}
function It(n, e) {
let t = "";
for (const r of n)
r.literal ? t += r.val : t += e(r.val);
return t;
}
const Ar = {
D: Ie,
DD: qt,
DDD: Ht,
DDDD: Yt,
t: Pt,
tt: Gt,
ttt: Jt,
tttt: _t,
T: Bt,
TT: jt,
TTT: Qt,
TTTT: Kt,
f: Xt,
ff: tn,
fff: rn,
ffff: an,
F: en,
FF: nn,
FFF: sn,
FFFF: on
};
class N {
static create(e, t = {}) {
return new N(e, t);
}
static parseFormat(e) {
let t = null, r = "", s = !1;
const i = [];
for (let a = 0; a < e.length; a++) {
const o = e.charAt(a);
o === "'" ? ((r.length > 0 || s) && i.push({
literal: s || /^\s+$/.test(r),
val: r === "" ? "'" : r
}), t = null, r = "", s = !s) : s || o === t ? r += o : (r.length > 0 && i.push({ literal: /^\s+$/.test(r), val: r }), r = o, t = o);
}
return r.length > 0 && i.push({ literal: s || /^\s+$/.test(r), val: r }), i;
}
static macroTokenToFormatOpts(e) {
return Ar[e];
}
constructor(e, t) {
this.opts = t, this.loc = e, this.systemLoc = null;
}
formatWithSystemDefault(e, t) {
return this.systemLoc === null && (this.systemLoc = this.loc.redefaultToSystem()), this.systemLoc.dtFormatter(e, { ...this.opts, ...t }).format();
}
dtFormatter(e, t = {}) {
return this.loc.dtFormatter(e, { ...this.opts, ...t });
}
formatDateTime(e, t) {
return this.dtFormatter(e, t).format();
}
formatDateTimeParts(e, t) {
return this.dtFormatter(e, t).formatToParts();
}
formatInterval(e, t) {
return this.dtFormatter(e.start, t).dtf.formatRange(e.start.toJSDate(), e.end.toJSDate());
}
resolvedOptions(e, t) {
return this.dtFormatter(e, t).resolvedOptions();
}
num(e, t = 0, r = void 0) {
if (this.opts.forceSimple)
return v(e, t);
const s = { ...this.opts };
return t > 0 && (s.padTo = t), r && (s.signDisplay = r), this.loc.numberFormatter(s).format(e);
}
formatDateTimeFromString(e, t) {
const r = this.loc.listingMode() === "en", s = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory", i = (d, O) => this.loc.extract(e, d, O), a = (d) => e.isOffsetFixed && e.offset === 0 && d.allowZ ? "Z" : e.isValid ? e.zone.formatOffset(e.ts, d.format) : "", o = () => r ? Cr(e) : i({ hour: "numeric", hourCycle: "h12" }, "dayperiod"), u = (d, O) => r ? Lr(e, d) : i(O ? { month: d } : { month: d, day: "numeric" }, "month"), l = (d, O) => r ? Wr(e, d) : i(
O ? { weekday: d } : { weekday: d, month: "long", day: "numeric" },
"weekday"
), f = (d) => {
const O = N.macroTokenToFormatOpts(d);
return O ? this.formatWithSystemDefault(e, O) : d;
}, y = (d) => r ? $r(e, d) : i({ era: d }, "era"), T = (d) => {
switch (d) {
// ms
case "S":
return this.num(e.millisecond);
case "u":
// falls through
case "SSS":
return this.num(e.millisecond, 3);
// seconds
case "s":
return this.num(e.second);
case "ss":
return this.num(e.second, 2);
// fractional seconds
case "uu":
return this.num(Math.floor(e.millisecond / 10), 2);
case "uuu":
return this.num(Math.floor(e.millisecond / 100));
// minutes
case "m":
return this.num(e.minute);
case "mm":
return this.num(e.minute, 2);
// hours
case "h":
return this.num(e.hour % 12 === 0 ? 12 : e.hour % 12);
case "hh":
return this.num(e.hour % 12 === 0 ? 12 : e.hour % 12, 2);
case "H":
return this.num(e.hour);
case "HH":
return this.num(e.hour, 2);
// offset
case "Z":
return a({ format: "narrow", allowZ: this.opts.allowZ });
case "ZZ":
return a({ format: "short", allowZ: this.opts.allowZ });
case "ZZZ":
return a({ format: "techie", allowZ: this.opts.allowZ });
case "ZZZZ":
return e.zone.offsetName(e.ts, { format: "short", locale: this.loc.locale });
case "ZZZZZ":
return e.zone.offsetName(e.ts, { format: "long", locale: this.loc.locale });
// zone
case "z":
return e.zoneName;
// meridiems
case "a":
return o();
// dates
case "d":
return s ? i({ day: "numeric" }, "day") : this.num(e.day);
case "dd":
return s ? i({ day: "2-digit" }, "day") : this.num(e.day, 2);
// weekdays - standalone
case "c":
return this.num(e.weekday);
case "ccc":
return l("short", !0);
case "cccc":
return l("long", !0);
case "ccccc":
return l("narrow", !0);
// weekdays - format
case "E":
return this.num(e.weekday);
case "EEE":
return l("short", !1);
case "EEEE":
return l("long", !1);
case "EEEEE":
return l("narrow", !1);
// months - standalone
case "L":
return s ? i({ month: "numeric", day: "numeric" }, "month") : this.num(e.month);
case "LL":
return s ? i({ month: "2-digit", day: "numeric" }, "month") : this.num(e.month, 2);
case "LLL":
return u("short", !0);
case "LLLL":
return u("long", !0);
case "LLLLL":
return u("narrow", !0);
// months - format
case "M":
return s ? i({ month: "numeric" }, "month") : this.num(e.month);
case "MM":
return s ? i({ month: "2-digit" }, "month") : this.num(e.month, 2);
case "MMM":
return u("short", !1);
case "MMMM":
return u("long", !1);
case "MMMMM":
return u("narrow", !1);
// years
case "y":
return s ? i({ year: "numeric" }, "year") : this.num(e.year);
case "yy":
return s ? i({ year: "2-digit" }, "year") : this.num(e.year.toString().slice(-2), 2);
case "yyyy":
return s ? i({ year: "numeric" }, "year") : this.num(e.year, 4);
case "yyyyyy":
return s ? i({ year: "numeric" }, "year") : this.num(e.year, 6);
// eras
case "G":
return y("short");
case "GG":
return y("long");
case "GGGGG":
return y("narrow");
case "kk":
return this.num(e.weekYear.toString().slice(-2), 2);
case "kkkk":
return this.num(e.weekYear, 4);
case "W":
return this.num(e.weekNumber);
case "WW":
return this.num(e.weekNumber, 2);
case "n":
return this.num(e.localWeekNumber);
case "nn":
return this.num(e.localWeekNumber, 2);
case "ii":
return this.num(e.localWeekYear.toString().slice(-2), 2);
case "iiii":
return this.num(e.localWeekYear, 4);
case "o":
return this.num(e.ordinal);
case "ooo":
return this.num(e.ordinal, 3);
case "q":
return this.num(e.quarter);
case "qq":
return this.num(e.quarter, 2);
case "X":
return this.num(Math.floor(e.ts / 1e3));
case "x":
return this.num(e.ts);
default:
return f(d);
}
};
return It(N.parseFormat(t), T);
}
formatDurationFromString(e, t) {
const r = this.opts.signMode === "negativeLargestOnly" ? -1 : 1, s = (f) => {
switch (f[0]) {
case "S":
return "milliseconds";
case "s":
return "seconds";
case "m":
return "minutes";
case "h":
return "hours";
case "d":
return "days";
case "w":
return "weeks";
case "M":
return "months";
case "y":
return "years";
default:
return null;
}
}, i = (f, y) => (T) => {
const d = s(T);
if (d) {
const O = y.isNegativeDuration && d !== y.largestUnit ? r : 1;
let F;
return this.opts.signMode === "negativeLargestOnly" && d !== y.largestUnit ? F = "never" : this.opts.signMode === "all" ? F = "always" : F = "auto", this.num(f.get(d) * O, T.length, F);
} else
return T;
}, a = N.parseFormat(t), o = a.reduce(
(f, { literal: y, val: T }) => y ? f : f.concat(T),
[]
), u = e.shiftTo(...o.map(s).filter((f) => f)), l = {
isNegativeDuration: u < 0,
// this relies on "collapsed" being based on "shiftTo", which builds up the object
// in order
largestUnit: Object.keys(u.values)[0]
};
return It(a, i(u, l));
}
}
const En = /[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;
function te(...n) {
const e = n.reduce((t, r) => t + r.source, "");
return RegExp(`^${e}$`);
}
function ne(...n) {
return (e) => n.reduce(
([t, r, s], i) => {
const [a, o, u] = i(e, s);
return [{ ...t, ...a }, o || r, u];
},
[{}, null, 1]
).slice(0, 2);
}
function re(n, ...e) {
if (n == null)
return [null, null];
for (const [t, r] of e) {
const s = t.exec(n);
if (s)
return r(s);
}
return [null, null];
}
function Dn(...n) {
return (e, t) => {
const r = {};
let s;
for (s = 0; s < n.length; s++)
r[n[s]] = z(e[t + s]);
return [r, null, t + s];
};
}
const xn = /(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/, Ur = `(?:${xn.source}?(?:\\[(${En.source})\\])?)?`, at = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/, bn = RegExp(`${at.source}${Ur}`), ot = RegExp(`(?:[Tt]${bn.source})?`), zr = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/, Rr = /(\d{4})-?W(\d\d)(?:-?(\d))?/, qr = /(\d{4})-?(\d{3})/, Hr = Dn("weekYear", "weekNumber", "weekDay"), Yr = Dn("year", "ordinal"), Pr = /(\d{4})-(\d\d)-(\d\d)/, Fn = RegExp(
`${at.source} ?(?:${xn.source}|(${En.source}))?`
), Gr = RegExp(`(?: ${Fn.source})?`);
function X(n, e, t) {
const r = n[e];
return h(r) ? t : z(r);
}
function Jr(n, e) {
return [{
year: X(n, e),
month: X(n, e + 1, 1),
day: X(n,