UNPKG

strapi-plugin-comments

Version:
1,808 lines 1.33 MB
import * as $ from "react"; import ze, { useRef as ue, useEffect as Ce, useMemo as yo, useCallback as rt, createContext as Ha, createElement as B, useContext as hh, forwardRef as O, Children as mo, isValidElement as Cu, cloneElement as tg, Fragment as fh, useState as De, useLayoutEffect as dh, useReducer as Nw, useImperativeHandle as CT } from "react"; import { useTheme as V, styled as W, ThemeProvider as $T, css as Ie, createGlobalStyle as ST, keyframes as tn } from "styled-components"; import { jsxs as ae, Fragment as Ps, jsx as m } from "react/jsx-runtime"; import * as Ws from "react-dom"; import AT, { flushSync as Fw, createPortal as Vw } from "react-dom"; const C0 = (t, e = "") => Object.keys(t).reduce((n, r) => { const i = e.length ? `${e}.` : ""; return typeof t[r] == "object" && t[r] !== null && !Array.isArray(t[r]) ? Object.assign(n, C0(t[r], i + r)) : n[i + r] = t[r], n; }, {}), Ov = (t, e) => { if (!e) throw new TypeError("pluginId can't be empty"); return Object.keys(t).reduce((n, r) => (n[`${e}.${r}`] = t[r], n), {}); }; function Dt(t) { const e = ue(t); return Ce(() => { e.current = t; }), yo( () => (...n) => { var r; return (r = e.current) === null || r === void 0 ? void 0 : r.call(e, ...n); }, [] ); } function kd(t, e) { return t - e * Math.floor(t / e); } const Hw = 1721426; function Cc(t, e, n, r) { e = ng(t, e); let i = e - 1, o = -2; return n <= 2 ? o = 0 : su(e) && (o = -1), Hw - 1 + 365 * i + Math.floor(i / 4) - Math.floor(i / 100) + Math.floor(i / 400) + Math.floor((367 * n - 362) / 12 + o + r); } function su(t) { return t % 4 === 0 && (t % 100 !== 0 || t % 400 === 0); } function ng(t, e) { return t === "BC" ? 1 - e : e; } function kT(t) { let e = "AD"; return t <= 0 && (e = "BC", t = 1 - t), [ e, t ]; } const MT = { standard: [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ], leapyear: [ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ] }; class Ss { fromJulianDay(e) { let n = e, r = n - Hw, i = Math.floor(r / 146097), o = kd(r, 146097), s = Math.floor(o / 36524), a = kd(o, 36524), c = Math.floor(a / 1461), h = kd(a, 1461), f = Math.floor(h / 365), d = i * 400 + s * 100 + c * 4 + f + (s !== 4 && f !== 4 ? 1 : 0), [p, v] = kT(d), b = n - Cc(p, v, 1, 1), w = 2; n < Cc(p, v, 3, 1) ? w = 0 : su(v) && (w = 1); let y = Math.floor(((b + w) * 12 + 373) / 367), C = n - Cc(p, v, y, 1) + 1; return new Pa(p, v, y, C); } toJulianDay(e) { return Cc(e.era, e.year, e.month, e.day); } getDaysInMonth(e) { return MT[su(e.year) ? "leapyear" : "standard"][e.month - 1]; } // eslint-disable-next-line @typescript-eslint/no-unused-vars getMonthsInYear(e) { return 12; } getDaysInYear(e) { return su(e.year) ? 366 : 365; } // eslint-disable-next-line @typescript-eslint/no-unused-vars getYearsInEra(e) { return 9999; } getEras() { return [ "BC", "AD" ]; } isInverseEra(e) { return e.era === "BC"; } balanceDate(e) { e.year <= 0 && (e.era = e.era === "BC" ? "AD" : "BC", e.year = 1 - e.year); } constructor() { this.identifier = "gregory"; } } const TT = { "001": 1, AD: 1, AE: 6, AF: 6, AI: 1, AL: 1, AM: 1, AN: 1, AR: 1, AT: 1, AU: 1, AX: 1, AZ: 1, BA: 1, BE: 1, BG: 1, BH: 6, BM: 1, BN: 1, BY: 1, CH: 1, CL: 1, CM: 1, CN: 1, CR: 1, CY: 1, CZ: 1, DE: 1, DJ: 6, DK: 1, DZ: 6, EC: 1, EE: 1, EG: 6, ES: 1, FI: 1, FJ: 1, FO: 1, FR: 1, GB: 1, GE: 1, GF: 1, GP: 1, GR: 1, HR: 1, HU: 1, IE: 1, IQ: 6, IR: 6, IS: 1, IT: 1, JO: 6, KG: 1, KW: 6, KZ: 1, LB: 1, LI: 1, LK: 1, LT: 1, LU: 1, LV: 1, LY: 6, MC: 1, MD: 1, ME: 1, MK: 1, MN: 1, MQ: 1, MV: 5, MY: 1, NL: 1, NO: 1, NZ: 1, OM: 6, PL: 1, QA: 6, RE: 1, RO: 1, RS: 1, RU: 1, SD: 6, SE: 1, SI: 1, SK: 1, SM: 1, SY: 6, TJ: 1, TM: 1, TR: 1, UA: 1, UY: 1, UZ: 1, VA: 1, VN: 1, XK: 1 }; function Pw(t, e) { return e = or(e, t.calendar), t.era === e.era && t.year === e.year && t.month === e.month && t.day === e.day; } function Ww(t, e) { let n = t.calendar.toJulianDay(t), r = Math.ceil(n + 1 - _T(e)) % 7; return r < 0 && (r += 7), r; } function RT(t) { return ii(Date.now(), t); } function rg(t) { return Yw(RT(t)); } function zw(t, e) { return t.calendar.toJulianDay(t) - e.calendar.toJulianDay(e); } function ET(t, e) { return Dv(t) - Dv(e); } function Dv(t) { return t.hour * 36e5 + t.minute * 6e4 + t.second * 1e3 + t.millisecond; } let Md = null; function As() { return Md == null && (Md = new Intl.DateTimeFormat().resolvedOptions().timeZone), Md; } function OT(t) { return t.subtract({ days: t.day - 1 }); } function DT(t) { return t.add({ days: t.calendar.getDaysInMonth(t) - t.day }); } function Uw(t, e) { let n = Ww(t, e); return t.subtract({ days: n }); } const Iv = /* @__PURE__ */ new Map(); function IT(t) { if (Intl.Locale) { let n = Iv.get(t); return n || (n = new Intl.Locale(t).maximize().region, n && Iv.set(t, n)), n; } let e = t.split("-")[1]; return e === "u" ? void 0 : e; } function _T(t) { let e = IT(t); return e && TT[e] || 0; } function $0(t, e) { return t && e ? t.compare(e) <= 0 ? t : e : t || e; } function S0(t, e) { return t && e ? t.compare(e) >= 0 ? t : e : t || e; } function ks(t) { t = or(t, new Ss()); let e = ng(t.era, t.year); return Kw(e, t.month, t.day, t.hour, t.minute, t.second, t.millisecond); } function Kw(t, e, n, r, i, o, s) { let a = /* @__PURE__ */ new Date(); return a.setUTCHours(r, i, o, s), a.setUTCFullYear(t, e - 1, n), a.getTime(); } function A0(t, e) { if (e === "UTC") return 0; if (t > 0 && e === As()) return new Date(t).getTimezoneOffset() * -6e4; let { year: n, month: r, day: i, hour: o, minute: s, second: a } = qw(t, e); return Kw(n, r, i, o, s, a, 0) - Math.floor(t / 1e3) * 1e3; } const _v = /* @__PURE__ */ new Map(); function qw(t, e) { let n = _v.get(e); n || (n = new Intl.DateTimeFormat("en-US", { timeZone: e, hour12: !1, era: "short", year: "numeric", month: "numeric", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }), _v.set(e, n)); let r = n.formatToParts(new Date(t)), i = {}; for (let o of r) o.type !== "literal" && (i[o.type] = o.value); return { // Firefox returns B instead of BC... https://bugzilla.mozilla.org/show_bug.cgi?id=1752253 year: i.era === "BC" || i.era === "B" ? -i.year + 1 : +i.year, month: +i.month, day: +i.day, hour: i.hour === "24" ? 0 : +i.hour, minute: +i.minute, second: +i.second }; } const Lv = 864e5; function LT(t, e, n, r) { return (n === r ? [ n ] : [ n, r ]).filter((o) => BT(t, e, o)); } function BT(t, e, n) { let r = qw(n, e); return t.year === r.year && t.month === r.month && t.day === r.day && t.hour === r.hour && t.minute === r.minute && t.second === r.second; } function ni(t, e, n = "compatible") { let r = Co(t); if (e === "UTC") return ks(r); if (e === As() && n === "compatible") { r = or(r, new Ss()); let c = /* @__PURE__ */ new Date(), h = ng(r.era, r.year); return c.setFullYear(h, r.month - 1, r.day), c.setHours(r.hour, r.minute, r.second, r.millisecond), c.getTime(); } let i = ks(r), o = A0(i - Lv, e), s = A0(i + Lv, e), a = LT(r, e, i - o, i - s); if (a.length === 1) return a[0]; if (a.length > 1) switch (n) { case "compatible": case "earlier": return a[0]; case "later": return a[a.length - 1]; case "reject": throw new RangeError("Multiple possible absolute times found"); } switch (n) { case "earlier": return Math.min(i - o, i - s); case "compatible": case "later": return Math.max(i - o, i - s); case "reject": throw new RangeError("No such absolute time found"); } } function Gw(t, e, n = "compatible") { return new Date(ni(t, e, n)); } function ii(t, e) { let n = A0(t, e), r = new Date(t + n), i = r.getUTCFullYear(), o = r.getUTCMonth() + 1, s = r.getUTCDate(), a = r.getUTCHours(), c = r.getUTCMinutes(), h = r.getUTCSeconds(), f = r.getUTCMilliseconds(); return new Ms(i, o, s, e, n, a, c, h, f); } function Yw(t) { return new Pa(t.calendar, t.era, t.year, t.month, t.day); } function Co(t, e) { let n = 0, r = 0, i = 0, o = 0; if ("timeZone" in t) ({ hour: n, minute: r, second: i, millisecond: o } = t); else if ("hour" in t && !e) return t; return e && ({ hour: n, minute: r, second: i, millisecond: o } = e), new Su(t.calendar, t.era, t.year, t.month, t.day, n, r, i, o); } function or(t, e) { if (t.calendar.identifier === e.identifier) return t; let n = e.fromJulianDay(t.calendar.toJulianDay(t)), r = t.copy(); return r.calendar = e, r.era = n.era, r.year = n.year, r.month = n.month, r.day = n.day, $o(r), r; } function NT(t, e, n) { if (t instanceof Ms) return t.timeZone === e ? t : jw(t, e); let r = ni(t, e, n); return ii(r, e); } function FT(t) { let e = ks(t) - t.offset; return new Date(e); } function jw(t, e) { let n = ks(t) - t.offset; return or(ii(n, e), t.calendar); } const ba = 36e5; function gh(t, e) { let n = t.copy(), r = "hour" in n ? WT(n, e) : 0; k0(n, e.years || 0), n.calendar.balanceYearMonth && n.calendar.balanceYearMonth(n, t), n.month += e.months || 0, M0(n), Xw(n), n.day += (e.weeks || 0) * 7, n.day += e.days || 0, n.day += r, VT(n), n.calendar.balanceDate && n.calendar.balanceDate(n), n.year < 1 && (n.year = 1, n.month = 1, n.day = 1); let i = n.calendar.getYearsInEra(n); if (n.year > i) { var o, s; let c = (o = (s = n.calendar).isInverseEra) === null || o === void 0 ? void 0 : o.call(s, n); n.year = i, n.month = c ? 1 : n.calendar.getMonthsInYear(n), n.day = c ? 1 : n.calendar.getDaysInMonth(n); } n.month < 1 && (n.month = 1, n.day = 1); let a = n.calendar.getMonthsInYear(n); return n.month > a && (n.month = a, n.day = n.calendar.getDaysInMonth(n)), n.day = Math.max(1, Math.min(n.calendar.getDaysInMonth(n), n.day)), n; } function k0(t, e) { var n, r; !((n = (r = t.calendar).isInverseEra) === null || n === void 0) && n.call(r, t) && (e = -e), t.year += e; } function M0(t) { for (; t.month < 1; ) k0(t, -1), t.month += t.calendar.getMonthsInYear(t); let e = 0; for (; t.month > (e = t.calendar.getMonthsInYear(t)); ) t.month -= e, k0(t, 1); } function VT(t) { for (; t.day < 1; ) t.month--, M0(t), t.day += t.calendar.getDaysInMonth(t); for (; t.day > t.calendar.getDaysInMonth(t); ) t.day -= t.calendar.getDaysInMonth(t), t.month++, M0(t); } function Xw(t) { t.month = Math.max(1, Math.min(t.calendar.getMonthsInYear(t), t.month)), t.day = Math.max(1, Math.min(t.calendar.getDaysInMonth(t), t.day)); } function $o(t) { t.calendar.constrainDate && t.calendar.constrainDate(t), t.year = Math.max(1, Math.min(t.calendar.getYearsInEra(t), t.year)), Xw(t); } function Zw(t) { let e = {}; for (let n in t) typeof t[n] == "number" && (e[n] = -t[n]); return e; } function Qw(t, e) { return gh(t, Zw(e)); } function ig(t, e) { let n = t.copy(); return e.era != null && (n.era = e.era), e.year != null && (n.year = e.year), e.month != null && (n.month = e.month), e.day != null && (n.day = e.day), $o(n), n; } function $u(t, e) { let n = t.copy(); return e.hour != null && (n.hour = e.hour), e.minute != null && (n.minute = e.minute), e.second != null && (n.second = e.second), e.millisecond != null && (n.millisecond = e.millisecond), PT(n), n; } function HT(t) { t.second += Math.floor(t.millisecond / 1e3), t.millisecond = $c(t.millisecond, 1e3), t.minute += Math.floor(t.second / 60), t.second = $c(t.second, 60), t.hour += Math.floor(t.minute / 60), t.minute = $c(t.minute, 60); let e = Math.floor(t.hour / 24); return t.hour = $c(t.hour, 24), e; } function PT(t) { t.millisecond = Math.max(0, Math.min(t.millisecond, 1e3)), t.second = Math.max(0, Math.min(t.second, 59)), t.minute = Math.max(0, Math.min(t.minute, 59)), t.hour = Math.max(0, Math.min(t.hour, 23)); } function $c(t, e) { let n = t % e; return n < 0 && (n += e), n; } function WT(t, e) { return t.hour += e.hours || 0, t.minute += e.minutes || 0, t.second += e.seconds || 0, t.millisecond += e.milliseconds || 0, HT(t); } function og(t, e, n, r) { let i = t.copy(); switch (e) { case "era": { let a = t.calendar.getEras(), c = a.indexOf(t.era); if (c < 0) throw new Error("Invalid era: " + t.era); c = oi(c, n, 0, a.length - 1, r?.round), i.era = a[c], $o(i); break; } case "year": var o, s; !((o = (s = i.calendar).isInverseEra) === null || o === void 0) && o.call(s, i) && (n = -n), i.year = oi(t.year, n, -1 / 0, 9999, r?.round), i.year === -1 / 0 && (i.year = 1), i.calendar.balanceYearMonth && i.calendar.balanceYearMonth(i, t); break; case "month": i.month = oi(t.month, n, 1, t.calendar.getMonthsInYear(t), r?.round); break; case "day": i.day = oi(t.day, n, 1, t.calendar.getDaysInMonth(t), r?.round); break; default: throw new Error("Unsupported field " + e); } return t.calendar.balanceDate && t.calendar.balanceDate(i), $o(i), i; } function Jw(t, e, n, r) { let i = t.copy(); switch (e) { case "hour": { let o = t.hour, s = 0, a = 23; if (r?.hourCycle === 12) { let c = o >= 12; s = c ? 12 : 0, a = c ? 23 : 11; } i.hour = oi(o, n, s, a, r?.round); break; } case "minute": i.minute = oi(t.minute, n, 0, 59, r?.round); break; case "second": i.second = oi(t.second, n, 0, 59, r?.round); break; case "millisecond": i.millisecond = oi(t.millisecond, n, 0, 999, r?.round); break; default: throw new Error("Unsupported field " + e); } return i; } function oi(t, e, n, r, i = !1) { if (i) { t += Math.sign(e), t < n && (t = r); let o = Math.abs(e); e > 0 ? t = Math.ceil(t / o) * o : t = Math.floor(t / o) * o, t > r && (t = n); } else t += e, t < n ? t = r - (n - t - 1) : t > r && (t = n + (t - r - 1)); return t; } function e3(t, e) { let n; if (e.years != null && e.years !== 0 || e.months != null && e.months !== 0 || e.weeks != null && e.weeks !== 0 || e.days != null && e.days !== 0) { let i = gh(Co(t), { years: e.years, months: e.months, weeks: e.weeks, days: e.days }); n = ni(i, t.timeZone); } else n = ks(t) - t.offset; n += e.milliseconds || 0, n += (e.seconds || 0) * 1e3, n += (e.minutes || 0) * 6e4, n += (e.hours || 0) * 36e5; let r = ii(n, t.timeZone); return or(r, t.calendar); } function zT(t, e) { return e3(t, Zw(e)); } function UT(t, e, n, r) { switch (e) { case "hour": { let i = 0, o = 23; if (r?.hourCycle === 12) { let b = t.hour >= 12; i = b ? 12 : 0, o = b ? 23 : 11; } let s = Co(t), a = or($u(s, { hour: i }), new Ss()), c = [ ni(a, t.timeZone, "earlier"), ni(a, t.timeZone, "later") ].filter((b) => ii(b, t.timeZone).day === a.day)[0], h = or($u(s, { hour: o }), new Ss()), f = [ ni(h, t.timeZone, "earlier"), ni(h, t.timeZone, "later") ].filter((b) => ii(b, t.timeZone).day === h.day).pop(), d = ks(t) - t.offset, p = Math.floor(d / ba), v = d % ba; return d = oi(p, n, Math.floor(c / ba), Math.floor(f / ba), r?.round) * ba + v, or(ii(d, t.timeZone), t.calendar); } case "minute": case "second": case "millisecond": return Jw(t, e, n, r); case "era": case "year": case "month": case "day": { let i = og(Co(t), e, n, r), o = ni(i, t.timeZone); return or(ii(o, t.timeZone), t.calendar); } default: throw new Error("Unsupported field " + e); } } function KT(t, e, n) { let r = Co(t), i = $u(ig(r, e), e); if (i.compare(r) === 0) return t; let o = ni(i, t.timeZone, n); return or(ii(o, t.timeZone), t.calendar); } const qT = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/; function t3(t, e) { let n = t.match(qT); if (!n) throw new Error("Invalid ISO 8601 date time string: " + t); let r = new Ms(Qr(n[1], 1, 9999), Qr(n[2], 1, 12), 1, e, 0, n[4] ? Qr(n[4], 0, 23) : 0, n[5] ? Qr(n[5], 0, 59) : 0, n[6] ? Qr(n[6], 0, 59) : 0, n[7] ? Qr(n[7], 0, 1 / 0) * 1e3 : 0); r.day = Qr(n[3], 0, r.calendar.getDaysInMonth(r)); var i; return n[8] && (r.offset = Qr(n[8], -23, 23) * 36e5 + Qr((i = n[9]) !== null && i !== void 0 ? i : "0", 0, 59) * 6e4), jw(r, e); } function GT(t) { return t3(t, As()); } function Qr(t, e, n) { let r = Number(t); if (r < e || r > n) throw new RangeError(`Value out of range: ${e} <= ${r} <= ${n}`); return r; } function YT(t) { return `${String(t.hour).padStart(2, "0")}:${String(t.minute).padStart(2, "0")}:${String(t.second).padStart(2, "0")}${t.millisecond ? String(t.millisecond / 1e3).slice(1) : ""}`; } function n3(t) { let e = or(t, new Ss()); return `${String(e.year).padStart(4, "0")}-${String(e.month).padStart(2, "0")}-${String(e.day).padStart(2, "0")}`; } function r3(t) { return `${n3(t)}T${YT(t)}`; } function jT(t) { let e = Math.sign(t) < 0 ? "-" : "+"; t = Math.abs(t); let n = Math.floor(t / 36e5), r = t % 36e5 / 6e4; return `${e}${String(n).padStart(2, "0")}:${String(r).padStart(2, "0")}`; } function XT(t) { return `${r3(t)}${jT(t.offset)}[${t.timeZone}]`; } function ZT(t, e) { if (e.has(t)) throw new TypeError("Cannot initialize the same private elements twice on an object"); } function sg(t, e, n) { ZT(t, e), e.set(t, n); } function ag(t) { let e = typeof t[0] == "object" ? t.shift() : new Ss(), n; if (typeof t[0] == "string") n = t.shift(); else { let s = e.getEras(); n = s[s.length - 1]; } let r = t.shift(), i = t.shift(), o = t.shift(); return [ e, n, r, i, o ]; } var QT = /* @__PURE__ */ new WeakMap(); class Pa { /** Returns a copy of this date. */ copy() { return this.era ? new Pa(this.calendar, this.era, this.year, this.month, this.day) : new Pa(this.calendar, this.year, this.month, this.day); } /** Returns a new `CalendarDate` with the given duration added to it. */ add(e) { return gh(this, e); } /** Returns a new `CalendarDate` with the given duration subtracted from it. */ subtract(e) { return Qw(this, e); } /** Returns a new `CalendarDate` with the given fields set to the provided values. Other fields will be constrained accordingly. */ set(e) { return ig(this, e); } /** * Returns a new `CalendarDate` with the given field adjusted by a specified amount. * When the resulting value reaches the limits of the field, it wraps around. */ cycle(e, n, r) { return og(this, e, n, r); } /** Converts the date to a native JavaScript Date object, with the time set to midnight in the given time zone. */ toDate(e) { return Gw(this, e); } /** Converts the date to an ISO 8601 formatted string. */ toString() { return n3(this); } /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */ compare(e) { return zw(this, e); } constructor(...e) { sg(this, QT, { writable: !0, value: void 0 }); let [n, r, i, o, s] = ag(e); this.calendar = n, this.era = r, this.year = i, this.month = o, this.day = s, $o(this); } } var JT = /* @__PURE__ */ new WeakMap(); class Su { /** Returns a copy of this date. */ copy() { return this.era ? new Su(this.calendar, this.era, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond) : new Su(this.calendar, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond); } /** Returns a new `CalendarDateTime` with the given duration added to it. */ add(e) { return gh(this, e); } /** Returns a new `CalendarDateTime` with the given duration subtracted from it. */ subtract(e) { return Qw(this, e); } /** Returns a new `CalendarDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */ set(e) { return ig($u(this, e), e); } /** * Returns a new `CalendarDateTime` with the given field adjusted by a specified amount. * When the resulting value reaches the limits of the field, it wraps around. */ cycle(e, n, r) { switch (e) { case "era": case "year": case "month": case "day": return og(this, e, n, r); default: return Jw(this, e, n, r); } } /** Converts the date to a native JavaScript Date object in the given time zone. */ toDate(e, n) { return Gw(this, e, n); } /** Converts the date to an ISO 8601 formatted string. */ toString() { return r3(this); } /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */ compare(e) { let n = zw(this, e); return n === 0 ? ET(this, Co(e)) : n; } constructor(...e) { sg(this, JT, { writable: !0, value: void 0 }); let [n, r, i, o, s] = ag(e); this.calendar = n, this.era = r, this.year = i, this.month = o, this.day = s, this.hour = e.shift() || 0, this.minute = e.shift() || 0, this.second = e.shift() || 0, this.millisecond = e.shift() || 0, $o(this); } } var eR = /* @__PURE__ */ new WeakMap(); class Ms { /** Returns a copy of this date. */ copy() { return this.era ? new Ms(this.calendar, this.era, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond) : new Ms(this.calendar, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond); } /** Returns a new `ZonedDateTime` with the given duration added to it. */ add(e) { return e3(this, e); } /** Returns a new `ZonedDateTime` with the given duration subtracted from it. */ subtract(e) { return zT(this, e); } /** Returns a new `ZonedDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */ set(e, n) { return KT(this, e, n); } /** * Returns a new `ZonedDateTime` with the given field adjusted by a specified amount. * When the resulting value reaches the limits of the field, it wraps around. */ cycle(e, n, r) { return UT(this, e, n, r); } /** Converts the date to a native JavaScript Date object. */ toDate() { return FT(this); } /** Converts the date to an ISO 8601 formatted string, including the UTC offset and time zone identifier. */ toString() { return XT(this); } /** Converts the date to an ISO 8601 formatted string in UTC. */ toAbsoluteString() { return this.toDate().toISOString(); } /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */ compare(e) { return this.toDate().getTime() - NT(e, this.timeZone).toDate().getTime(); } constructor(...e) { sg(this, eR, { writable: !0, value: void 0 }); let [n, r, i, o, s] = ag(e), a = e.shift(), c = e.shift(); this.calendar = n, this.era = r, this.year = i, this.month = o, this.day = s, this.timeZone = a, this.offset = c, this.hour = e.shift() || 0, this.minute = e.shift() || 0, this.second = e.shift() || 0, this.millisecond = e.shift() || 0, $o(this); } } let Td = /* @__PURE__ */ new Map(); class tR { /** Formats a date as a string according to the locale and format options passed to the constructor. */ format(e) { return this.formatter.format(e); } /** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */ formatToParts(e) { return this.formatter.formatToParts(e); } /** Formats a date range as a string. */ formatRange(e, n) { if (typeof this.formatter.formatRange == "function") return this.formatter.formatRange(e, n); if (n < e) throw new RangeError("End date must be >= start date"); return `${this.formatter.format(e)} – ${this.formatter.format(n)}`; } /** Formats a date range as an array of parts. */ formatRangeToParts(e, n) { if (typeof this.formatter.formatRangeToParts == "function") return this.formatter.formatRangeToParts(e, n); if (n < e) throw new RangeError("End date must be >= start date"); let r = this.formatter.formatToParts(e), i = this.formatter.formatToParts(n); return [ ...r.map((o) => ({ ...o, source: "startRange" })), { type: "literal", value: " – ", source: "shared" }, ...i.map((o) => ({ ...o, source: "endRange" })) ]; } /** Returns the resolved formatting options based on the values passed to the constructor. */ resolvedOptions() { let e = this.formatter.resolvedOptions(); return iR() && (this.resolvedHourCycle || (this.resolvedHourCycle = oR(e.locale, this.options)), e.hourCycle = this.resolvedHourCycle, e.hour12 = this.resolvedHourCycle === "h11" || this.resolvedHourCycle === "h12"), e.calendar === "ethiopic-amete-alem" && (e.calendar = "ethioaa"), e; } constructor(e, n = {}) { this.formatter = i3(e, n), this.options = n; } } const nR = { true: { // Only Japanese uses the h11 style for 12 hour time. All others use h12. ja: "h11" }, false: {} }; function i3(t, e = {}) { if (typeof e.hour12 == "boolean" && rR()) { e = { ...e }; let i = nR[String(e.hour12)][t.split("-")[0]], o = e.hour12 ? "h12" : "h23"; e.hourCycle = i ?? o, delete e.hour12; } let n = t + (e ? Object.entries(e).sort((i, o) => i[0] < o[0] ? -1 : 1).join() : ""); if (Td.has(n)) return Td.get(n); let r = new Intl.DateTimeFormat(t, e); return Td.set(n, r), r; } let Rd = null; function rR() { return Rd == null && (Rd = new Intl.DateTimeFormat("en-US", { hour: "numeric", hour12: !1 }).format(new Date(2020, 2, 3, 0)) === "24"), Rd; } let Ed = null; function iR() { return Ed == null && (Ed = new Intl.DateTimeFormat("fr", { hour: "numeric", hour12: !1 }).resolvedOptions().hourCycle === "h12"), Ed; } function oR(t, e) { if (!e.timeStyle && !e.hour) return; t = t.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, ""), t += (t.includes("-u-") ? "" : "-u") + "-nu-latn"; let n = i3(t, { ...e, timeZone: void 0 // use local timezone }), r = parseInt(n.formatToParts(new Date(2020, 2, 3, 0)).find((o) => o.type === "hour").value, 10), i = parseInt(n.formatToParts(new Date(2020, 2, 3, 23)).find((o) => o.type === "hour").value, 10); if (r === 0 && i === 23) return "h23"; if (r === 24 && i === 23) return "h24"; if (r === 0 && i === 11) return "h11"; if (r === 12 && i === 11) return "h12"; throw new Error("Unexpected hour cycle result"); } function G() { return G = Object.assign ? Object.assign.bind() : function(t) { for (var e = 1; e < arguments.length; e++) { var n = arguments[e]; for (var r in n) ({}).hasOwnProperty.call(n, r) && (t[r] = n[r]); } return t; }, G.apply(null, arguments); } function ie(t, e, { checkForDefaultPrevented: n = !0 } = {}) { return function(i) { if (t?.(i), n === !1 || !i.defaultPrevented) return e?.(i); }; } function sR(t, e) { typeof t == "function" ? t(e) : t != null && (t.current = e); } function ph(...t) { return (e) => t.forEach( (n) => sR(n, e) ); } function ke(...t) { return rt(ph(...t), t); } function lg(t, e) { const n = /* @__PURE__ */ Ha(e); function r(o) { const { children: s, ...a } = o, c = yo( () => a, Object.values(a) ); return /* @__PURE__ */ B(n.Provider, { value: c }, s); } function i(o) { const s = hh(n); if (s) return s; if (e !== void 0) return e; throw new Error(`\`${o}\` must be used within \`${t}\``); } return r.displayName = t + "Provider", [ r, i ]; } function Tt(t, e = []) { let n = []; function r(o, s) { const a = /* @__PURE__ */ Ha(s), c = n.length; n = [ ...n, s ]; function h(d) { const { scope: p, children: v, ...b } = d, w = p?.[t][c] || a, y = yo( () => b, Object.values(b) ); return /* @__PURE__ */ B(w.Provider, { value: y }, v); } function f(d, p) { const v = p?.[t][c] || a, b = hh(v); if (b) return b; if (s !== void 0) return s; throw new Error(`\`${d}\` must be used within \`${o}\``); } return h.displayName = o + "Provider", [ h, f ]; } const i = () => { const o = n.map((s) => /* @__PURE__ */ Ha(s)); return function(a) { const c = a?.[t] || o; return yo( () => ({ [`__scope${t}`]: { ...a, [t]: c } }), [ a, c ] ); }; }; return i.scopeName = t, [ r, aR(i, ...e) ]; } function aR(...t) { const e = t[0]; if (t.length === 1) return e; const n = () => { const r = t.map( (i) => ({ useScope: i(), scopeName: i.scopeName }) ); return function(o) { const s = r.reduce((a, { useScope: c, scopeName: h }) => { const d = c(o)[`__scope${h}`]; return { ...a, ...d }; }, {}); return yo( () => ({ [`__scope${e.scopeName}`]: s }), [ s ] ); }; }; return n.scopeName = e.scopeName, n; } const Ir = /* @__PURE__ */ O((t, e) => { const { children: n, ...r } = t, i = mo.toArray(n), o = i.find(lR); if (o) { const s = o.props.children, a = i.map((c) => c === o ? mo.count(s) > 1 ? mo.only(null) : /* @__PURE__ */ Cu(s) ? s.props.children : null : c); return /* @__PURE__ */ B(T0, G({}, r, { ref: e }), /* @__PURE__ */ Cu(s) ? /* @__PURE__ */ tg(s, void 0, a) : null); } return /* @__PURE__ */ B(T0, G({}, r, { ref: e }), n); }); Ir.displayName = "Slot"; const T0 = /* @__PURE__ */ O((t, e) => { const { children: n, ...r } = t; return /* @__PURE__ */ Cu(n) ? /* @__PURE__ */ tg(n, { ...cR(r, n.props), ref: e ? ph(e, n.ref) : n.ref }) : mo.count(n) > 1 ? mo.only(null) : null; }); T0.displayName = "SlotClone"; const cg = ({ children: t }) => /* @__PURE__ */ B(fh, null, t); function lR(t) { return /* @__PURE__ */ Cu(t) && t.type === cg; } function cR(t, e) { const n = { ...e }; for (const r in e) { const i = t[r], o = e[r]; /^on[A-Z]/.test(r) ? i && o ? n[r] = (...a) => { o(...a), i(...a); } : i && (n[r] = i) : r === "style" ? n[r] = { ...i, ...o } : r === "className" && (n[r] = [ i, o ].filter(Boolean).join(" ")); } return { ...t, ...n }; } const uR = [ "a", "button", "div", "form", "h2", "h3", "img", "input", "label", "li", "nav", "ol", "p", "span", "svg", "ul" ], we = uR.reduce((t, e) => { const n = /* @__PURE__ */ O((r, i) => { const { asChild: o, ...s } = r, a = o ? Ir : e; return Ce(() => { window[Symbol.for("radix-ui")] = !0; }, []), /* @__PURE__ */ B(a, G({}, s, { ref: i })); }); return n.displayName = `Primitive.${e}`, { ...t, [e]: n }; }, {}); function o3(t, e) { t && Fw( () => t.dispatchEvent(e) ); } function hR(t, e = globalThis?.document) { const n = Dt(t); Ce(() => { const r = (i) => { i.key === "Escape" && n(i); }; return e.addEventListener("keydown", r), () => e.removeEventListener("keydown", r); }, [ n, e ]); } const R0 = "dismissableLayer.update", fR = "dismissableLayer.pointerDownOutside", dR = "dismissableLayer.focusOutside"; let Bv; const gR = /* @__PURE__ */ Ha({ layers: /* @__PURE__ */ new Set(), layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(), branches: /* @__PURE__ */ new Set() }), Io = /* @__PURE__ */ O((t, e) => { var n; const { disableOutsidePointerEvents: r = !1, onEscapeKeyDown: i, onPointerDownOutside: o, onFocusOutside: s, onInteractOutside: a, onDismiss: c, ...h } = t, f = hh(gR), [d, p] = De(null), v = (n = d?.ownerDocument) !== null && n !== void 0 ? n : globalThis?.document, [, b] = De({}), w = ke( e, (P) => p(P) ), y = Array.from(f.layers), [C] = [ ...f.layersWithOutsidePointerEventsDisabled ].slice(-1), S = y.indexOf(C), k = d ? y.indexOf(d) : -1, R = f.layersWithOutsidePointerEventsDisabled.size > 0, E = k >= S, _ = pR((P) => { const H = P.target, z = [ ...f.branches ].some( (j) => j.contains(H) ); !E || z || (o?.(P), a?.(P), P.defaultPrevented || c?.()); }, v), D = mR((P) => { const H = P.target; [ ...f.branches ].some( (j) => j.contains(H) ) || (s?.(P), a?.(P), P.defaultPrevented || c?.()); }, v); return hR((P) => { k === f.layers.size - 1 && (i?.(P), !P.defaultPrevented && c && (P.preventDefault(), c())); }, v), Ce(() => { if (d) return r && (f.layersWithOutsidePointerEventsDisabled.size === 0 && (Bv = v.body.style.pointerEvents, v.body.style.pointerEvents = "none"), f.layersWithOutsidePointerEventsDisabled.add(d)), f.layers.add(d), Nv(), () => { r && f.layersWithOutsidePointerEventsDisabled.size === 1 && (v.body.style.pointerEvents = Bv); }; }, [ d, v, r, f ]), Ce(() => () => { d && (f.layers.delete(d), f.layersWithOutsidePointerEventsDisabled.delete(d), Nv()); }, [ d, f ]), Ce(() => { const P = () => b({}); return document.addEventListener(R0, P), () => document.removeEventListener(R0, P); }, []), /* @__PURE__ */ B(we.div, G({}, h, { ref: w, style: { pointerEvents: R ? E ? "auto" : "none" : void 0, ...t.style }, onFocusCapture: ie(t.onFocusCapture, D.onFocusCapture), onBlurCapture: ie(t.onBlurCapture, D.onBlurCapture), onPointerDownCapture: ie(t.onPointerDownCapture, _.onPointerDownCapture) })); }); function pR(t, e = globalThis?.document) { const n = Dt(t), r = ue(!1), i = ue(() => { }); return Ce(() => { const o = (a) => { if (a.target && !r.current) { let h = function() { s3(fR, n, c, { discrete: !0 }); }; const c = { originalEvent: a }; a.pointerType === "touch" ? (e.removeEventListener("click", i.current), i.current = h, e.addEventListener("click", i.current, { once: !0 })) : h(); } else e.removeEventListener("click", i.current); r.current = !1; }, s = window.setTimeout(() => { e.addEventListener("pointerdown", o); }, 0); return () => { window.clearTimeout(s), e.removeEventListener("pointerdown", o), e.removeEventListener("click", i.current); }; }, [ e, n ]), { // ensures we check React component tree (not just DOM tree) onPointerDownCapture: () => r.current = !0 }; } function mR(t, e = globalThis?.document) { const n = Dt(t), r = ue(!1); return Ce(() => { const i = (o) => { o.target && !r.current && s3(dR, n, { originalEvent: o }, { discrete: !1 }); }; return e.addEventListener("focusin", i), () => e.removeEventListener("focusin", i); }, [ e, n ]), { onFocusCapture: () => r.current = !0, onBlurCapture: () => r.current = !1 }; } function Nv() { const t = new CustomEvent(R0); document.dispatchEvent(t); } function s3(t, e, n, { discrete: r }) { const i = n.originalEvent.target, o = new CustomEvent(t, { bubbles: !1, cancelable: !0, detail: n }); e && i.addEventListener(t, e, { once: !0 }), r ? o3(i, o) : i.dispatchEvent(o); } const vR = Io, wt = globalThis?.document ? dh : () => { }, bR = $.useId || (() => { }); let wR = 0; function Kt(t) { const [e, n] = $.useState(bR()); return wt(() => { n( (r) => r ?? String(wR++) ); }, [ t ]), e ? `radix-${e}` : ""; } const xR = ["top", "right", "bottom", "left"], Ni = Math.min, Bn = Math.max, Au = Math.round, Sc = Math.floor, Er = (t) => ({ x: t, y: t }), yR = { left: "right", right: "left", bottom: "top", top: "bottom" }, CR = { start: "end", end: "start" }; function E0(t, e, n) { return Bn(t, Ni(e, n)); } function li(t, e) { return typeof t == "function" ? t(e) : t; } function ci(t) { return t.split("-")[0]; } function zs(t) { return t.split("-")[1]; } function ug(t) { return t === "x" ? "y" : "x"; } function hg(t) { return t === "y" ? "height" : "width"; } function Fi(t) { return ["top", "bottom"].includes(ci(t)) ? "y" : "x"; } function fg(t) { return ug(Fi(t)); } function $R(t, e, n) { n === void 0 && (n = !1); const r = zs(t), i = fg(t), o = hg(i); let s = i === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top"; return e.reference[o] > e.floating[o] && (s = ku(s)), [s, ku(s)]; } function SR(t) { const e = ku(t); return [O0(t), e, O0(e)]; } function O0(t) { return t.replace(/start|end/g, (e) => CR[e]); } function AR(t, e, n) { const r = ["left", "right"], i = ["right", "left"], o = ["top", "bottom"], s = ["bottom", "top"]; switch (t) { case "top": case "bottom": return n ? e ? i : r : e ? r : i; case "left": case "right": return e ? o : s; default: return []; } } function kR(t, e, n, r) { const i = zs(t); let o = AR(ci(t), n === "start", r); return i && (o = o.map((s) => s + "-" + i), e && (o = o.concat(o.map(O0)))), o; } function ku(t) { return t.replace(/left|right|bottom|top/g, (e) => yR[e]); } function MR(t) { return { top: 0, right: 0, bottom: 0, left: 0, ...t }; } function a3(t) { return typeof t != "number" ? MR(t) : { top: t, right: t, bottom: t, left: t }; } function Mu(t) { const { x: e, y: n, width: r, height: i } = t; return { width: r, height: i, top: n, left: e, right: e + r, bottom: n + i, x: e, y: n }; } function Fv(t, e, n) { let { reference: r, floating: i } = t; const o = Fi(e), s = fg(e), a = hg(s), c = ci(e), h = o === "y", f = r.x + r.width / 2 - i.width / 2, d = r.y + r.height / 2 - i.height / 2, p = r[a] / 2 - i[a] / 2; let v; switch (c) { case "top": v = { x: f, y: r.y - i.height }; break; case "bottom": v = { x: f, y: r.y + r.height }; break; case "right": v = { x: r.x + r.width, y: d }; break; case "left": v = { x: r.x - i.width, y: d }; break; default: v = { x: r.x, y: r.y }; } switch (zs(e)) { case "start": v[s] -= p * (n && h ? -1 : 1); break; case "end": v[s] += p * (n && h ? -1 : 1); break; } return v; } const TR = async (t, e, n) => { const { placement: r = "bottom", strategy: i = "absolute", middleware: o = [], platform: s } = n, a = o.filter(Boolean), c = await (s.isRTL == null ? void 0 : s.isRTL(e)); let h = await s.getElementRects({ reference: t, floating: e, strategy: i }), { x: f, y: d } = Fv(h, r, c), p = r, v = {}, b = 0; for (let w = 0; w < a.length; w++) { const { name: y, fn: C } = a[w], { x: S, y: k, data: R, reset: E } = await C({ x: f, y: d, initialPlacement: r, placement: p, strategy: i, middlewareData: v, rects: h, platform: s, elements: { reference: t, floating: e } }); f = S ?? f, d = k ?? d, v = { ...v, [y]: { ...v[y], ...R } }, E && b <= 50 && (b++, typeof E == "object" && (E.placement && (p = E.placement), E.rects && (h = E.rects === !0 ? await s.getElementRects({ reference: t, floating: e, strategy: i }) : E.rects), { x: f, y: d } = Fv(h, p, c)), w = -1); } return { x: f, y: d, placement: p, strategy: i, middlewareData: v }; }; async function Wa(t, e) { var n; e === void 0 && (e = {}); const { x: r, y: i, platform: o, rects: s, elements: a, strategy: c } = t, { boundary: h = "clippingAncestors", rootBoundary: f = "viewport", elementContext: d = "floating", altBoundary: p = !1, padding: v = 0 } = li(e, t), b = a3(v), y = a[p ? d === "floating" ? "reference" : "floating" : d], C = Mu(await o.getClippingRect({ element: (n = await (o.isElement == null ? void 0 : o.isElement(y))) == null || n ? y : y.contextElement || await (o.getDocumentElement == null ? void 0 : o.getDocumentElement(a.floating)), boundary: h, rootBoundary: f, strategy: c })), S = d === "floating" ? { x: r, y: i, width: s.floating.width, height: s.floating.height } : s.reference, k = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(a.floating)), R = await (o.isElement == null ? void 0 : o.isElement(k)) ? await (o.getScale == null ? void 0 : o.getScale(k)) || { x: 1, y: 1 } : { x: 1, y: 1 }, E = Mu(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({ elements: a, rect: S, offsetParent: k, strategy: c }) : S); return { top: (C.top - E.top + b.top) / R.y, bottom: (E.bottom - C.bottom + b.bottom) / R.y, left: (C.left - E.left + b.left) / R.x, right: (E.right - C.right + b.right) / R.x }; } const RR = (t) => ({ name: "arrow", options: t, async fn(e) { const { x: n, y: r, placement: i, rects: o, platform: s, elements: a, middlewareData: c } = e, { element: h, padding: f = 0 } = li(t, e) || {}; if (h == null) return {}; const d = a3(f), p = { x: n, y: r }, v = fg(i), b = hg(v), w = await s.getDimensions(h), y = v === "y", C = y ? "top" : "left", S = y ? "bottom" : "right", k = y ? "clientHeight" : "clientWidth", R = o.reference[b] + o.reference[v] - p[v] - o.floating[b], E = p[v] - o.reference[v], _ = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(h)); let D = _ ? _[k] : 0; (!D || !await (s.isElement == null ? void 0 : s.isElement(_))) && (D = a.floating[k] || o.floating[b]); const P = R / 2 - E / 2, H = D / 2 - w[b] / 2 - 1, z = Ni(d[C], H), j = Ni(d[S], H), K = z, te = D - w[b] - j, X = D / 2 - w[b] / 2 + P, oe = E0(K, X, te), le = !c.arrow && zs(i) != null && X !== oe && o.reference[b] / 2 - (X < K ? z : j) - w[b] / 2 < 0, re = le ? X < K ? X - K : X - te : 0; return { [v]: p[v] + re, data: { [v]: oe, centerOffset: X - oe - re, ...le && { alignmentOffset: re } }, reset: le }; } }), ER = function(t) { return t === void 0 && (t = {}), { name: "flip", options: t, async fn(e) { var n, r; const { placement: i, middlewareData: o, rects: s, initialPlacement: a, platform: c, elements: h } = e, { mainAxis: f = !0, crossAxis: d = !0, fallbackPlacements: p, fallbackStrategy: v = "bestFit", fallbackAxisSideDirection: b = "none", flipAlignment: w = !0, ...y } = li(t, e); if ((n = o.arrow) != null && n.alignmentOffset) return {}; const C = ci(i), S = Fi(a), k = ci(a) === a, R = await (c.isRTL == null ? void 0 : c.isRTL(h.floating)), E = p || (k || !w ? [ku(a)] : SR(a)), _ = b !== "none"; !p && _ && E.push(...kR(a, w, b, R)); const D = [a, ...E], P = await Wa(e, y), H = []; let z = ((r = o.flip) == null ? void 0 : r.overflows) || []; if (f && H.push(P[C]), d) { const X = $R(i, s, R); H.push(P[X[0]], P[X[1]]); } if (z = [...z, { placement: i, overflows: H }], !H.every((X) => X <= 0)) { var j, K; const X = (((j = o.flip) == null ? void 0 : j.index) || 0) + 1, oe = D[X]; if (oe) return { data: { index: X, overflows: z }, reset: { placement: oe } }; let le = (K = z.filter((re) => re.overflows[0] <= 0).sort((re, se) => re.overflows[1] - se.overflows[1])[0]) == null ? void 0 : K.placement; if (!le) switch (v) { case "bestFit": { var te; const re = (te = z.filter((se) => { if (_) { const Z = Fi(se.placement); return Z === S || // Create a bias to the `y` side axis due to horizontal // reading directions favoring greater width. Z === "y"; } return !0; }).map((se) => [se.placement, se.overflows.filter((Z) => Z > 0).reduce((Z, ge) => Z + ge, 0)]).sort((se, Z) => se[1] - Z[1])[0]) == null ? void 0 : te[0]; re && (le = re); break; } case "initialPlacement": le = a; break; } if (i !== le) return { reset: { placement: le } }; } return {}; } }; }; function Vv(t, e) { return { top: t.top - e.height, right: t.right - e.width, bottom: t.bottom - e.height, left: t.left - e.width }; } function Hv(t) { return xR.some((e) => t[e] >= 0); } const OR = function(t) { return t === void 0 && (t = {}), { name: "hide", options: t, async fn(e) { const { rects: n } = e, { strategy: r = "referenceHidden", ...i } = li(t, e); switch (r) { case "referenceHidden": { const o = await Wa(e, { ...i, elementContext: "reference" }), s = Vv(o, n.reference); return { data: { referenceHiddenOffsets: s, referenceHidden: Hv(s) } }; } case "escaped": { const o = await Wa(e, { ...i, altBoundary: !0 }), s = Vv(o, n.floating); return { data: { escapedOffsets: s, escaped: Hv(s) } }; } default: return {}; } } }; }; async function DR(t, e) { const { placement: n, platform: r, elements: i } = t, o = await (r.isRTL == null ? void 0 : r.isRTL(i.floating)), s = ci(n), a = zs(n), c = Fi(n) === "y", h = ["left", "top"].includes(s) ? -1 : 1, f = o && c ? -1 : 1, d = li(e, t); let { mainAxis: p, crossAxis: v, alignmentAxis: b } = typeof d == "number" ? { mainAxis: d, crossAxis: 0, alignmentAxis: null } : { mainAxis: d.mainAxis || 0, crossAxis: d.crossAxis || 0, alignmentAxis: d.alignmentAxis }; return a && typeof b == "number" && (v = a === "end" ? b * -1 : b), c ? { x: v * f, y: p * h } : { x: p * h, y: v * f }; } const IR = function(t) { return t === void 0 && (t = 0), { name: "offset", options: t, async fn(e) { var n, r; const { x: i, y: o, placement: s, middlewareData: a } = e, c = await DR(e, t); return s === ((n = a.offset) == null ? void 0 : n.placement) && (r = a.arrow) != null && r.alignmentOffset ? {} : { x: i + c.x, y: o + c.y, data: { ...c, placement: s } }; } }; }, _R = function(t) { return t === void 0 && (t = {}), { name: "shift", options: t, async fn(e) { const { x: n, y: r, placement: i } = e, { mainAxis: o = !0, crossAxis: s = !1, limiter: a = { fn: (y) => { let { x: C, y: S } = y; return { x: C, y: S }; } }, ...c } = li(t, e), h = { x: n, y: r }, f = await Wa(e, c), d = Fi(ci(i)), p = ug(d); let v = h[p], b = h[d]; if (o) { const y = p === "y" ? "top" : "left", C = p === "y" ? "bottom" : "right", S = v + f[y], k = v - f[C]; v = E0(S, v, k); } if (s) { const y = d === "y" ? "top" : "left", C = d === "y" ? "bottom" : "right", S = b + f[y], k = b - f[C]; b = E0(S, b, k); } const w = a.fn({ ...e, [p]: v, [d]: b }); return { ...w, data: { x: w.x - n, y: w.y - r, enabled: { [p]: o, [d]: s } } }; } }; }, LR = function(t) { return t === void 0 && (t = {}), { options: t, fn(e) { const { x: n, y: r, placement: i, rects: o, middlewareData: s } = e, { offset: a = 0, mainAxis: c = !0, crossAxis: h = !0 } = li(t, e), f = { x: n, y: r }, d = Fi(i), p = ug(d); let v = f[p], b = f[d]; const w = li(a, e), y = typeof w == "number" ? { mainAxis: w, crossAxis: 0 } : { mainAxis