@vuepic/vue-datepicker
Version:
Datepicker component for Vue 3
1,311 lines (1,310 loc) • 153 kB
JavaScript
import { openBlock as p, createElementBlock as P, createElementVNode as ae, reactive as Mt, computed as V, unref as d, ref as U, watch as dt, onMounted as He, nextTick as ct, toRef as It, defineComponent as We, renderSlot as j, createCommentVNode as D, normalizeClass as ge, withKeys as ue, createBlock as me, withModifiers as qe, normalizeStyle as Qe, normalizeProps as Ne, mergeProps as Pe, Fragment as fe, createTextVNode as je, toDisplayString as _e, renderList as Me, createVNode as et, Transition as ht, withCtx as se, onBeforeUpdate as qn, onUnmounted as on, withDirectives as Ct, vShow as _t, createSlots as Ee, isRef as ot, guardReactiveProps as Ue, resolveDynamicComponent as Bn, useSlots as sn, getCurrentScope as Jn, onScopeDispose as Qn, Teleport as ea } from "vue";
import { isBefore as un, isEqual as Yn, isAfter as dn, setHours as Vn, setMinutes as En, setSeconds as Ln, setMilliseconds as cn, parse as an, isValid as Nt, isDate as ta, set as Re, format as bt, getMonth as ke, getDay as na, getYear as we, getHours as Ze, getMinutes as Xe, getSeconds as gt, parseISO as aa, startOfWeek as hn, endOfWeek as ra, setMonth as Rt, setYear as ut, addDays as yt, add as Fn, addMonths as st, subMonths as Dt, getWeek as la, getISOWeek as oa, differenceInCalendarDays as sa, eachDayOfInterval as pn, addYears as ia, subYears as ua, sub as da } from "date-fns";
function Ft() {
return p(), P(
"svg",
{
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 32 32",
fill: "currentColor",
"aria-hidden": "true",
class: "dp__icon"
},
[
ae("path", {
d: "M29.333 8c0-2.208-1.792-4-4-4h-18.667c-2.208 0-4 1.792-4 4v18.667c0 2.208 1.792 4 4 4h18.667c2.208 0 4-1.792 4-4v-18.667zM26.667 8v18.667c0 0.736-0.597 1.333-1.333 1.333 0 0-18.667 0-18.667 0-0.736 0-1.333-0.597-1.333-1.333 0 0 0-18.667 0-18.667 0-0.736 0.597-1.333 1.333-1.333 0 0 18.667 0 18.667 0 0.736 0 1.333 0.597 1.333 1.333z"
}),
ae("path", {
d: "M20 2.667v5.333c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-5.333c0-0.736-0.597-1.333-1.333-1.333s-1.333 0.597-1.333 1.333z"
}),
ae("path", {
d: "M9.333 2.667v5.333c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-5.333c0-0.736-0.597-1.333-1.333-1.333s-1.333 0.597-1.333 1.333z"
}),
ae("path", {
d: "M4 14.667h24c0.736 0 1.333-0.597 1.333-1.333s-0.597-1.333-1.333-1.333h-24c-0.736 0-1.333 0.597-1.333 1.333s0.597 1.333 1.333 1.333z"
})
]
);
}
function ca() {
return p(), P(
"svg",
{
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 32 32",
fill: "currentColor",
"aria-hidden": "true",
class: "dp__icon"
},
[
ae("path", {
d: "M23.057 7.057l-16 16c-0.52 0.52-0.52 1.365 0 1.885s1.365 0.52 1.885 0l16-16c0.52-0.52 0.52-1.365 0-1.885s-1.365-0.52-1.885 0z"
}),
ae("path", {
d: "M7.057 8.943l16 16c0.52 0.52 1.365 0.52 1.885 0s0.52-1.365 0-1.885l-16-16c-0.52-0.52-1.365-0.52-1.885 0s-0.52 1.365 0 1.885z"
})
]
);
}
function kn() {
return p(), P(
"svg",
{
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 32 32",
fill: "currentColor",
"aria-hidden": "true",
class: "dp__icon"
},
[
ae("path", {
d: "M20.943 23.057l-7.057-7.057c0 0 7.057-7.057 7.057-7.057 0.52-0.52 0.52-1.365 0-1.885s-1.365-0.52-1.885 0l-8 8c-0.521 0.521-0.521 1.365 0 1.885l8 8c0.52 0.52 1.365 0.52 1.885 0s0.52-1.365 0-1.885z"
})
]
);
}
function wn() {
return p(), P(
"svg",
{
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 32 32",
fill: "currentColor",
"aria-hidden": "true",
class: "dp__icon"
},
[
ae("path", {
d: "M12.943 24.943l8-8c0.521-0.521 0.521-1.365 0-1.885l-8-8c-0.52-0.52-1.365-0.52-1.885 0s-0.52 1.365 0 1.885l7.057 7.057c0 0-7.057 7.057-7.057 7.057-0.52 0.52-0.52 1.365 0 1.885s1.365 0.52 1.885 0z"
})
]
);
}
function Un() {
return p(), P(
"svg",
{
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 32 32",
fill: "currentColor",
"aria-hidden": "true",
class: "dp__icon"
},
[
ae("path", {
d: "M16 1.333c-8.095 0-14.667 6.572-14.667 14.667s6.572 14.667 14.667 14.667c8.095 0 14.667-6.572 14.667-14.667s-6.572-14.667-14.667-14.667zM16 4c6.623 0 12 5.377 12 12s-5.377 12-12 12c-6.623 0-12-5.377-12-12s5.377-12 12-12z"
}),
ae("path", {
d: "M14.667 8v8c0 0.505 0.285 0.967 0.737 1.193l5.333 2.667c0.658 0.329 1.46 0.062 1.789-0.596s0.062-1.46-0.596-1.789l-4.596-2.298c0 0 0-7.176 0-7.176 0-0.736-0.597-1.333-1.333-1.333s-1.333 0.597-1.333 1.333z"
})
]
);
}
function Hn() {
return p(), P(
"svg",
{
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 32 32",
fill: "currentColor",
"aria-hidden": "true",
class: "dp__icon"
},
[
ae("path", {
d: "M24.943 19.057l-8-8c-0.521-0.521-1.365-0.521-1.885 0l-8 8c-0.52 0.52-0.52 1.365 0 1.885s1.365 0.52 1.885 0l7.057-7.057c0 0 7.057 7.057 7.057 7.057 0.52 0.52 1.365 0.52 1.885 0s0.52-1.365 0-1.885z"
})
]
);
}
function Wn() {
return p(), P(
"svg",
{
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 32 32",
fill: "currentColor",
"aria-hidden": "true",
class: "dp__icon"
},
[
ae("path", {
d: "M7.057 12.943l8 8c0.521 0.521 1.365 0.521 1.885 0l8-8c0.52-0.52 0.52-1.365 0-1.885s-1.365-0.52-1.885 0l-7.057 7.057c0 0-7.057-7.057-7.057-7.057-0.52-0.52-1.365-0.52-1.885 0s-0.52 1.365 0 1.885z"
})
]
);
}
const bn = (e, n, a, t) => {
const s = an(e, n.slice(0, e.length), /* @__PURE__ */ new Date());
return Nt(s) && ta(s) ? t ? s : Re(s, {
hours: +a.hours,
minutes: +(a == null ? void 0 : a.minutes),
seconds: +(a == null ? void 0 : a.seconds),
milliseconds: 0
}) : null;
}, fa = (e, n, a, t) => {
const s = Array.isArray(a) ? a[0] : a;
if (typeof n == "string")
return bn(e, n, s, t);
if (Array.isArray(n)) {
let f = null;
for (const h of n)
if (f = bn(e, h, s, t), f)
break;
return f;
}
return typeof n == "function" ? n(e) : null;
}, k = (e) => e ? new Date(e) : /* @__PURE__ */ new Date(), va = (e, n) => {
if (n) {
const t = (e.getMonth() + 1).toString().padStart(2, "0"), s = e.getDate().toString().padStart(2, "0"), f = e.getHours().toString().padStart(2, "0"), h = e.getMinutes().toString().padStart(2, "0");
return `${e.getFullYear()}-${t}-${s}T${f}:${h}:00.000Z`;
}
const a = Date.UTC(
e.getUTCFullYear(),
e.getUTCMonth(),
e.getUTCDate(),
e.getUTCHours(),
e.getUTCMinutes(),
e.getUTCSeconds()
);
return new Date(a).toISOString();
}, xe = (e) => {
let n = k(JSON.parse(JSON.stringify(e)));
return n = Vn(n, 0), n = En(n, 0), n = Ln(n, 0), n = cn(n, 0), n;
}, Fe = (e, n, a, t) => {
let s = e ? k(e) : k();
return (n || n === 0) && (s = Vn(s, +n)), (a || a === 0) && (s = En(s, +a)), (t || t === 0) && (s = Ln(s, +t)), cn(s, 0);
}, Oe = (e, n) => !e || !n ? !1 : un(xe(e), xe(n)), he = (e, n) => !e || !n ? !1 : Yn(xe(e), xe(n)), Ve = (e, n) => !e || !n ? !1 : dn(xe(e), xe(n)), zn = (e, n, a) => e && e[0] && e[1] ? Ve(a, e[0]) && Oe(a, e[1]) : e && e[0] && n ? Ve(a, e[0]) && Oe(a, n) || Oe(a, e[0]) && Ve(a, n) : !1, wt = Mt({
menuFocused: !1,
shiftKeyInMenu: !1
}), Kn = () => {
const e = (t) => {
wt.menuFocused = t;
}, n = (t) => {
wt.shiftKeyInMenu !== t && (wt.shiftKeyInMenu = t);
};
return {
control: V(() => ({ shiftKeyInMenu: wt.shiftKeyInMenu, menuFocused: wt.menuFocused })),
setMenuFocused: e,
setShiftKey: n
};
};
function fn(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var Bt = {}, ma = {
get exports() {
return Bt;
},
set exports(e) {
Bt = e;
}
};
(function(e, n) {
Object.defineProperty(n, "__esModule", {
value: !0
}), n.default = a;
function a(t) {
if (t === null || t === !0 || t === !1)
return NaN;
var s = Number(t);
return isNaN(s) ? s : s < 0 ? Math.ceil(s) : Math.floor(s);
}
e.exports = n.default;
})(ma, Bt);
const ya = /* @__PURE__ */ fn(Bt);
var Yt = {}, ga = {
get exports() {
return Yt;
},
set exports(e) {
Yt = e;
}
};
(function(e, n) {
Object.defineProperty(n, "__esModule", {
value: !0
}), n.default = a;
function a(t) {
var s = new Date(Date.UTC(t.getFullYear(), t.getMonth(), t.getDate(), t.getHours(), t.getMinutes(), t.getSeconds(), t.getMilliseconds()));
return s.setUTCFullYear(t.getFullYear()), t.getTime() - s.getTime();
}
e.exports = n.default;
})(ga, Yt);
const Dn = /* @__PURE__ */ fn(Yt);
function ha(e, n) {
var a = ba(n);
return a.formatToParts ? ka(a, e) : wa(a, e);
}
var pa = {
year: 0,
month: 1,
day: 2,
hour: 3,
minute: 4,
second: 5
};
function ka(e, n) {
try {
for (var a = e.formatToParts(n), t = [], s = 0; s < a.length; s++) {
var f = pa[a[s].type];
f >= 0 && (t[f] = parseInt(a[s].value, 10));
}
return t;
} catch (h) {
if (h instanceof RangeError)
return [NaN];
throw h;
}
}
function wa(e, n) {
var a = e.format(n).replace(/\u200E/g, ""), t = /(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(a);
return [t[3], t[1], t[2], t[4], t[5], t[6]];
}
var xt = {};
function ba(e) {
if (!xt[e]) {
var n = new Intl.DateTimeFormat("en-US", {
hour12: !1,
timeZone: "America/New_York",
year: "numeric",
month: "numeric",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit"
}).format(/* @__PURE__ */ new Date("2014-06-25T04:00:00.123Z")), a = n === "06/25/2014, 00:00:00" || n === "06/25/2014 00:00:00";
xt[e] = a ? new Intl.DateTimeFormat("en-US", {
hour12: !1,
timeZone: e,
year: "numeric",
month: "numeric",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit"
}) : new Intl.DateTimeFormat("en-US", {
hourCycle: "h23",
timeZone: e,
year: "numeric",
month: "numeric",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit"
});
}
return xt[e];
}
function vn(e, n, a, t, s, f, h) {
var C = /* @__PURE__ */ new Date(0);
return C.setUTCFullYear(e, n, a), C.setUTCHours(t, s, f, h), C;
}
var $n = 36e5, Da = 6e4, Gt = {
timezone: /([Z+-].*)$/,
timezoneZ: /^(Z)$/,
timezoneHH: /^([+-]\d{2})$/,
timezoneHHMM: /^([+-]\d{2}):?(\d{2})$/
};
function mn(e, n, a) {
var t, s;
if (!e || (t = Gt.timezoneZ.exec(e), t))
return 0;
var f;
if (t = Gt.timezoneHH.exec(e), t)
return f = parseInt(t[1], 10), Mn(f) ? -(f * $n) : NaN;
if (t = Gt.timezoneHHMM.exec(e), t) {
f = parseInt(t[1], 10);
var h = parseInt(t[2], 10);
return Mn(f, h) ? (s = Math.abs(f) * $n + h * Da, f > 0 ? -s : s) : NaN;
}
if (Ta(e)) {
n = new Date(n || Date.now());
var C = a ? n : $a(n), I = rn(C, e), $ = a ? I : Ma(n, I, e);
return -$;
}
return NaN;
}
function $a(e) {
return vn(
e.getFullYear(),
e.getMonth(),
e.getDate(),
e.getHours(),
e.getMinutes(),
e.getSeconds(),
e.getMilliseconds()
);
}
function rn(e, n) {
var a = ha(e, n), t = vn(
a[0],
a[1] - 1,
a[2],
a[3] % 24,
a[4],
a[5],
0
).getTime(), s = e.getTime(), f = s % 1e3;
return s -= f >= 0 ? f : 1e3 + f, t - s;
}
function Ma(e, n, a) {
var t = e.getTime(), s = t - n, f = rn(new Date(s), a);
if (n === f)
return n;
s -= f - n;
var h = rn(new Date(s), a);
return f === h ? f : Math.max(f, h);
}
function Mn(e, n) {
return -23 <= e && e <= 23 && (n == null || 0 <= n && n <= 59);
}
var Tn = {};
function Ta(e) {
if (Tn[e])
return !0;
try {
return new Intl.DateTimeFormat(void 0, { timeZone: e }), Tn[e] = !0, !0;
} catch {
return !1;
}
}
var Aa = /(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/;
const jn = Aa;
var Zt = 36e5, An = 6e4, Sa = 2, Ye = {
dateTimePattern: /^([0-9W+-]+)(T| )(.*)/,
datePattern: /^([0-9W+-]+)(.*)/,
plainTime: /:/,
// year tokens
YY: /^(\d{2})$/,
YYY: [
/^([+-]\d{2})$/,
// 0 additional digits
/^([+-]\d{3})$/,
// 1 additional digit
/^([+-]\d{4})$/
// 2 additional digits
],
YYYY: /^(\d{4})/,
YYYYY: [
/^([+-]\d{4})/,
// 0 additional digits
/^([+-]\d{5})/,
// 1 additional digit
/^([+-]\d{6})/
// 2 additional digits
],
// date tokens
MM: /^-(\d{2})$/,
DDD: /^-?(\d{3})$/,
MMDD: /^-?(\d{2})-?(\d{2})$/,
Www: /^-?W(\d{2})$/,
WwwD: /^-?W(\d{2})-?(\d{1})$/,
HH: /^(\d{2}([.,]\d*)?)$/,
HHMM: /^(\d{2}):?(\d{2}([.,]\d*)?)$/,
HHMMSS: /^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,
// time zone tokens (to identify the presence of a tz)
timeZone: jn
};
function ln(e, n) {
if (arguments.length < 1)
throw new TypeError("1 argument required, but only " + arguments.length + " present");
if (e === null)
return /* @__PURE__ */ new Date(NaN);
var a = n || {}, t = a.additionalDigits == null ? Sa : ya(a.additionalDigits);
if (t !== 2 && t !== 1 && t !== 0)
throw new RangeError("additionalDigits must be 0, 1 or 2");
if (e instanceof Date || typeof e == "object" && Object.prototype.toString.call(e) === "[object Date]")
return new Date(e.getTime());
if (typeof e == "number" || Object.prototype.toString.call(e) === "[object Number]")
return new Date(e);
if (!(typeof e == "string" || Object.prototype.toString.call(e) === "[object String]"))
return /* @__PURE__ */ new Date(NaN);
var s = Pa(e), f = Ca(s.date, t), h = f.year, C = f.restDateString, I = _a(C, h);
if (isNaN(I))
return /* @__PURE__ */ new Date(NaN);
if (I) {
var $ = I.getTime(), L = 0, M;
if (s.time && (L = Na(s.time), isNaN(L)))
return /* @__PURE__ */ new Date(NaN);
if (s.timeZone || a.timeZone) {
if (M = mn(s.timeZone || a.timeZone, new Date($ + L)), isNaN(M))
return /* @__PURE__ */ new Date(NaN);
} else
M = Dn(new Date($ + L)), M = Dn(new Date($ + L + M));
return new Date($ + L + M);
} else
return /* @__PURE__ */ new Date(NaN);
}
function Pa(e) {
var n = {}, a = Ye.dateTimePattern.exec(e), t;
if (a ? (n.date = a[1], t = a[3]) : (a = Ye.datePattern.exec(e), a ? (n.date = a[1], t = a[2]) : (n.date = null, t = e)), t) {
var s = Ye.timeZone.exec(t);
s ? (n.time = t.replace(s[1], ""), n.timeZone = s[1].trim()) : n.time = t;
}
return n;
}
function Ca(e, n) {
var a = Ye.YYY[n], t = Ye.YYYYY[n], s;
if (s = Ye.YYYY.exec(e) || t.exec(e), s) {
var f = s[1];
return {
year: parseInt(f, 10),
restDateString: e.slice(f.length)
};
}
if (s = Ye.YY.exec(e) || a.exec(e), s) {
var h = s[1];
return {
year: parseInt(h, 10) * 100,
restDateString: e.slice(h.length)
};
}
return {
year: null
};
}
function _a(e, n) {
if (n === null)
return null;
var a, t, s, f;
if (e.length === 0)
return t = /* @__PURE__ */ new Date(0), t.setUTCFullYear(n), t;
if (a = Ye.MM.exec(e), a)
return t = /* @__PURE__ */ new Date(0), s = parseInt(a[1], 10) - 1, Pn(n, s) ? (t.setUTCFullYear(n, s), t) : /* @__PURE__ */ new Date(NaN);
if (a = Ye.DDD.exec(e), a) {
t = /* @__PURE__ */ new Date(0);
var h = parseInt(a[1], 10);
return Ia(n, h) ? (t.setUTCFullYear(n, 0, h), t) : /* @__PURE__ */ new Date(NaN);
}
if (a = Ye.MMDD.exec(e), a) {
t = /* @__PURE__ */ new Date(0), s = parseInt(a[1], 10) - 1;
var C = parseInt(a[2], 10);
return Pn(n, s, C) ? (t.setUTCFullYear(n, s, C), t) : /* @__PURE__ */ new Date(NaN);
}
if (a = Ye.Www.exec(e), a)
return f = parseInt(a[1], 10) - 1, Cn(n, f) ? Sn(n, f) : /* @__PURE__ */ new Date(NaN);
if (a = Ye.WwwD.exec(e), a) {
f = parseInt(a[1], 10) - 1;
var I = parseInt(a[2], 10) - 1;
return Cn(n, f, I) ? Sn(n, f, I) : /* @__PURE__ */ new Date(NaN);
}
return null;
}
function Na(e) {
var n, a, t;
if (n = Ye.HH.exec(e), n)
return a = parseFloat(n[1].replace(",", ".")), Xt(a) ? a % 24 * Zt : NaN;
if (n = Ye.HHMM.exec(e), n)
return a = parseInt(n[1], 10), t = parseFloat(n[2].replace(",", ".")), Xt(a, t) ? a % 24 * Zt + t * An : NaN;
if (n = Ye.HHMMSS.exec(e), n) {
a = parseInt(n[1], 10), t = parseInt(n[2], 10);
var s = parseFloat(n[3].replace(",", "."));
return Xt(a, t, s) ? a % 24 * Zt + t * An + s * 1e3 : NaN;
}
return null;
}
function Sn(e, n, a) {
n = n || 0, a = a || 0;
var t = /* @__PURE__ */ new Date(0);
t.setUTCFullYear(e, 0, 4);
var s = t.getUTCDay() || 7, f = n * 7 + a + 1 - s;
return t.setUTCDate(t.getUTCDate() + f), t;
}
var Ra = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], Oa = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
function xn(e) {
return e % 400 === 0 || e % 4 === 0 && e % 100 !== 0;
}
function Pn(e, n, a) {
if (n < 0 || n > 11)
return !1;
if (a != null) {
if (a < 1)
return !1;
var t = xn(e);
if (t && a > Oa[n] || !t && a > Ra[n])
return !1;
}
return !0;
}
function Ia(e, n) {
if (n < 1)
return !1;
var a = xn(e);
return !(a && n > 366 || !a && n > 365);
}
function Cn(e, n, a) {
return !(n < 0 || n > 52 || a != null && (a < 0 || a > 6));
}
function Xt(e, n, a) {
return !(e != null && (e < 0 || e >= 25) || n != null && (n < 0 || n >= 60) || a != null && (a < 0 || a >= 60));
}
var Vt = {}, Ba = {
get exports() {
return Vt;
},
set exports(e) {
Vt = e;
}
}, Et = {}, Ya = {
get exports() {
return Et;
},
set exports(e) {
Et = e;
}
};
(function(e, n) {
Object.defineProperty(n, "__esModule", {
value: !0
}), n.default = a;
function a(t, s) {
if (t == null)
throw new TypeError("assign requires that input parameter not be null or undefined");
for (var f in s)
Object.prototype.hasOwnProperty.call(s, f) && (t[f] = s[f]);
return t;
}
e.exports = n.default;
})(Ya, Et);
(function(e, n) {
Object.defineProperty(n, "__esModule", {
value: !0
}), n.default = s;
var a = t(Et);
function t(f) {
return f && f.__esModule ? f : { default: f };
}
function s(f) {
return (0, a.default)({}, f);
}
e.exports = n.default;
})(Ba, Vt);
const Va = /* @__PURE__ */ fn(Vt);
function Ea(e, n, a) {
var t = ln(e, a), s = mn(n, t, !0), f = new Date(t.getTime() - s), h = /* @__PURE__ */ new Date(0);
return h.setFullYear(f.getUTCFullYear(), f.getUTCMonth(), f.getUTCDate()), h.setHours(f.getUTCHours(), f.getUTCMinutes(), f.getUTCSeconds(), f.getUTCMilliseconds()), h;
}
function La(e, n, a) {
if (typeof e == "string" && !e.match(jn)) {
var t = Va(a);
return t.timeZone = n, ln(e, t);
}
var s = ln(e, a), f = vn(
s.getFullYear(),
s.getMonth(),
s.getDate(),
s.getHours(),
s.getMinutes(),
s.getSeconds(),
s.getMilliseconds()
).getTime(), h = mn(n, new Date(f));
return new Date(f + h);
}
const Fa = (e, n = 3) => {
const a = [];
for (let t = 0; t < e.length; t += n)
a.push([e[t], e[t + 1], e[t + 2]]);
return a;
}, Ua = (e, n) => {
const a = [1, 2, 3, 4, 5, 6, 7].map((f) => new Intl.DateTimeFormat(e, { weekday: "short", timeZone: "UTC" }).format(/* @__PURE__ */ new Date(`2017-01-0${f}T00:00:00+00:00`)).slice(0, 2)), t = a.slice(0, n), s = a.slice(n + 1, a.length);
return [a[n]].concat(...s).concat(...t);
}, Ha = (e) => {
const n = [];
for (let a = +e[0]; a <= +e[1]; a++)
n.push({ value: +a, text: `${a}` });
return n;
}, Wa = (e, n) => {
const a = new Intl.DateTimeFormat(e, { month: n, timeZone: "UTC" });
return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].map((s) => {
const f = s < 10 ? `0${s}` : s;
return /* @__PURE__ */ new Date(`2017-${f}-01T00:00:00+00:00`);
}).map((s, f) => ({
text: a.format(s),
value: f
}));
}, za = (e) => [12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11][e], Te = (e) => {
const n = d(e);
return n != null && n.$el ? n == null ? void 0 : n.$el : n;
}, Ka = (e) => Object.assign({ type: "dot" }, e), Gn = (e) => Array.isArray(e) ? !!e[0] && !!e[1] : !1, Lt = {
prop: (e) => `"${e}" prop must be enabled!`,
dateArr: (e) => `You need to use array as "model-value" binding in order to support "${e}"`
}, Se = (e) => e, _n = (e) => e === 0 ? e : !e || isNaN(+e) ? null : +e, Nn = (e) => Object.assign(
{
menuAppear: "dp-menu-appear",
open: "dp-slide-down",
close: "dp-slide-up",
next: "calendar-next",
previous: "calendar-prev",
vNext: "dp-slide-up",
vPrevious: "dp-slide-down"
},
e
), ja = (e) => Object.assign(
{
toggleOverlay: "Toggle overlay",
menu: "Datepicker menu",
input: "Datepicker input",
calendarWrap: "Calendar wrapper",
calendarDays: "Calendar days",
openTimePicker: "Open time picker",
closeTimePicker: "Close time Picker",
incrementValue: (n) => `Increment ${n}`,
decrementValue: (n) => `Decrement ${n}`,
openTpOverlay: (n) => `Open ${n} overlay`,
amPmButton: "Switch AM/PM mode",
openYearsOverlay: "Open years overlay",
openMonthsOverlay: "Open months overlay",
nextMonth: "Next month",
prevMonth: "Previous month",
day: () => ""
},
e
), xa = (e) => e === null ? 0 : typeof e == "boolean" ? e ? 2 : 0 : +e >= 2 ? +e : 2, Ga = (e, n, a) => e || (typeof a == "string" ? a : n), Za = (e) => typeof e == "boolean" ? e ? Nn({}) : !1 : Nn(e), Xa = () => ({
enterSubmit: !0,
tabSubmit: !0,
openMenu: !0,
rangeSeparator: " - "
}), qa = (e) => Object.assign({ months: [], years: [], times: { hours: [], minutes: [], seconds: [] } }, e), Le = (e) => {
const n = () => {
if (e.partialRange)
return null;
throw new Error(Lt.prop("partial-range"));
}, a = V(() => ({
ariaLabels: ja(e.ariaLabels),
textInputOptions: Object.assign(Xa(), e.textInputOptions),
multiCalendars: xa(e.multiCalendars),
previewFormat: Ga(e.previewFormat, e.format, f()),
filters: qa(e.filters),
transitions: Za(e.transitions),
startTime: m()
})), t = (o) => {
if (e.range)
return o();
throw new Error(Lt.prop("range"));
}, s = () => {
const o = e.enableSeconds ? ":ss" : "";
return e.is24 ? `HH:mm${o}` : `hh:mm${o} aa`;
}, f = () => e.format ? e.format : e.monthPicker ? "MM/yyyy" : e.timePicker ? s() : e.weekPicker ? "MM/dd/yyyy" : e.yearPicker ? "yyyy" : e.enableTimePicker ? `MM/dd/yyyy, ${s()}` : "MM/dd/yyyy", h = (o, r) => {
if (typeof e.format == "function")
return e.format(o);
const c = r || f(), b = e.formatLocale ? { locale: e.formatLocale } : void 0;
return Array.isArray(o) ? `${bt(o[0], c, b)} ${e.modelAuto && !o[1] ? "" : a.value.textInputOptions.rangeSeparator || "-"} ${o[1] ? bt(o[1], c, b) : ""}` : bt(o, c, b);
}, C = (o) => e.timezone ? Ea(o, e.timezone) : o, I = (o) => e.timezone ? La(o, e.timezone) : o, $ = V(() => (o) => {
var r;
return (r = e.hideNavigation) == null ? void 0 : r.includes(o);
}), L = (o) => {
const r = e.maxDate ? Ve(C(o), C(k(e.maxDate))) : !1, c = e.minDate ? Oe(C(o), C(k(e.minDate))) : !1, b = O(o, e.disabledDates), R = a.value.filters.months.map((te) => +te).includes(ke(o)), ce = e.disabledWeekDays.length ? e.disabledWeekDays.some((te) => +te === na(o)) : !1, y = e.allowedDates.length ? !e.allowedDates.some((te) => he(C(k(te)), C(o))) : !1, i = we(o), Z = i < +e.yearRange[0] || i > +e.yearRange[1];
return !(r || c || b || R || Z || ce || y);
}, M = (o) => {
const r = {
hours: Ze(k()),
minutes: Xe(k()),
seconds: e.enableSeconds ? gt(k()) : 0
};
return Object.assign(r, o);
}, m = () => e.range ? e.startTime && Array.isArray(e.startTime) ? [M(e.startTime[0]), M(e.startTime[1])] : null : e.startTime && !Array.isArray(e.startTime) ? M(e.startTime) : null, T = (o) => !L(o), H = (o) => Array.isArray(o) ? Nt(o[0]) && (o[1] ? Nt(o[1]) : !0) : o ? Nt(o) : !1, B = (o) => o instanceof Date ? o : aa(o), J = (o) => {
const r = hn(C(o), { weekStartsOn: +e.weekStart }), c = ra(C(o), { weekStartsOn: +e.weekStart });
return [r, c];
}, O = (o, r) => Array.isArray(r) ? r.some((c) => he(C(k(c)), C(o))) : r(o), E = (o, r, c) => {
let b = o ? k(o) : k();
return (r || r === 0) && (b = Rt(b, r)), c && (b = ut(b, c)), b;
}, A = (o) => Re(k(), { hours: Ze(o), minutes: Xe(o), seconds: gt(o) }), x = (o) => Re(k(), {
hours: +o.hours || 0,
minutes: +o.minutes || 0,
seconds: +o.seconds || 0
}), le = (o, r, c, b) => {
if (!o)
return !0;
if (b) {
const W = c === "max" ? un(o, r) : dn(o, r), R = { seconds: 0, milliseconds: 0 };
return W || Yn(Re(o, R), Re(r, R));
}
return c === "max" ? o.getTime() <= r.getTime() : o.getTime() >= r.getTime();
}, oe = () => !e.enableTimePicker || e.monthPicker || e.yearPicker || e.ignoreTimeValidation, de = (o) => Array.isArray(o) ? [o[0] ? A(o[0]) : null, o[1] ? A(o[1]) : null] : A(o), S = (o) => {
const r = e.maxTime ? x(e.maxTime) : k(e.maxDate);
return Array.isArray(o) ? le(o[0], r, "max", !!e.maxDate) && le(o[1], r, "max", !!e.maxDate) : le(o, r, "max", !!e.maxDate);
}, Y = (o, r) => {
const c = e.minTime ? x(e.minTime) : k(e.minDate);
return Array.isArray(o) ? le(o[0], c, "min", !!e.minDate) && le(o[1], c, "min", !!e.minDate) && r : le(o, c, "min", !!e.minDate) && r;
}, F = (o) => {
let r = !0;
if (!o || oe())
return !0;
const c = !e.minDate && !e.maxDate ? de(o) : o;
return (e.maxTime || e.maxDate) && (r = S(Se(c))), (e.minTime || e.minDate) && (r = Y(Se(c), r)), r;
}, v = (o, r) => {
const c = k(JSON.parse(JSON.stringify(o))), b = [];
for (let W = 0; W < 7; W++) {
const R = yt(c, W), ce = ke(R) !== r;
b.push({
text: e.hideOffsetDates && ce ? "" : R.getDate(),
value: R,
current: !ce,
classData: {}
});
}
return b;
}, _ = (o, r) => {
const c = [], b = k(C(new Date(r, o))), W = k(C(new Date(r, o + 1, 0))), R = hn(b, { weekStartsOn: e.weekStart }), ce = (y) => {
const i = v(y, o);
if (c.push({ days: i }), !c[c.length - 1].days.some(
(Z) => he(xe(Z.value), xe(W))
)) {
const Z = yt(y, 7);
ce(Z);
}
};
if (ce(R), e.sixWeeks && c.length < 6) {
const y = 6 - c.length;
for (let i = 1; i <= y; i++) {
const Z = c[c.length - 1], te = Z.days[Z.days.length - 1], be = v(yt(te.value, 1), ke(b));
c.push({ days: be });
}
}
return c;
}, z = (o, r, c) => [Re(k(o), { date: 1 }), Re(k(), { month: r, year: c, date: 1 })], q = (o, r) => Oe(...z(e.minDate, o, r)) || he(...z(e.minDate, o, r)), Q = (o, r) => Ve(...z(e.maxDate, o, r)) || he(...z(e.maxDate, o, r)), N = (o, r, c) => {
let b = !1;
return e.maxDate && c && Q(o, r) && (b = !0), e.minDate && !c && q(o, r) && (b = !0), b;
};
return {
checkPartialRangeValue: n,
checkRangeEnabled: t,
getZonedDate: C,
getZonedToUtc: I,
formatDate: h,
getDefaultPattern: f,
validateDate: L,
getDefaultStartTime: m,
isDisabled: T,
isValidDate: H,
sanitizeDate: B,
getWeekFromDate: J,
matchDate: O,
setDateMonthOrYear: E,
isValidTime: F,
getCalendarDays: _,
validateMonthYearInRange: (o, r, c, b) => {
let W = !1;
return b ? e.minDate && e.maxDate ? W = N(o, r, c) : (e.minDate && q(o, r) || e.maxDate && Q(o, r)) && (W = !0) : W = !0, W;
},
validateMaxDate: Q,
validateMinDate: q,
assignDefaultTime: M,
defaults: a,
hideNavigationButtons: $
};
}, pe = Mt({
monthYear: [],
calendar: [],
time: [],
actionRow: [],
selectionGrid: [],
timePicker: {
0: [],
1: []
},
monthPicker: []
}), qt = U(null), Pt = U(!1), Jt = U(!1), Qt = U(!1), en = U(!1), Be = U(0), Ce = U(0), tt = () => {
const e = V(() => Pt.value ? [...pe.selectionGrid, pe.actionRow].filter((O) => O.length) : Jt.value ? [
...pe.timePicker[0],
...pe.timePicker[1],
en.value ? [] : [qt.value],
pe.actionRow
].filter((O) => O.length) : Qt.value ? [...pe.monthPicker, pe.actionRow] : [pe.monthYear, ...pe.calendar, pe.time, pe.actionRow].filter((O) => O.length)), n = (O) => {
Be.value = O ? Be.value + 1 : Be.value - 1;
let E = null;
e.value[Ce.value] && (E = e.value[Ce.value][Be.value]), E || (Be.value = O ? Be.value - 1 : Be.value + 1);
}, a = (O) => {
if (Ce.value === 0 && !O || Ce.value === e.value.length && O)
return;
Ce.value = O ? Ce.value + 1 : Ce.value - 1, e.value[Ce.value] ? e.value[Ce.value] && !e.value[Ce.value][Be.value] && Be.value !== 0 && (Be.value = e.value[Ce.value].length - 1) : Ce.value = O ? Ce.value - 1 : Ce.value + 1;
}, t = (O) => {
let E = null;
e.value[Ce.value] && (E = e.value[Ce.value][Be.value]), E ? E.focus({ preventScroll: !Pt.value }) : Be.value = O ? Be.value - 1 : Be.value + 1;
}, s = () => {
n(!0), t(!0);
}, f = () => {
n(!1), t(!1);
}, h = () => {
a(!1), t(!0);
}, C = () => {
a(!0), t(!0);
}, I = (O, E) => {
pe[E] = O;
}, $ = (O, E) => {
pe[E] = O;
}, L = () => {
Be.value = 0, Ce.value = 0;
};
return {
buildMatrix: I,
buildMultiLevelMatrix: $,
setTimePickerBackRef: (O) => {
qt.value = O;
},
setSelectionGrid: (O) => {
Pt.value = O, L(), O || (pe.selectionGrid = []);
},
setTimePicker: (O, E = !1) => {
Jt.value = O, en.value = E, L(), O || (pe.timePicker[0] = [], pe.timePicker[1] = []);
},
setTimePickerElements: (O, E = 0) => {
pe.timePicker[E] = O;
},
arrowRight: s,
arrowLeft: f,
arrowUp: h,
arrowDown: C,
clearArrowNav: () => {
pe.monthYear = [], pe.calendar = [], pe.time = [], pe.actionRow = [], pe.selectionGrid = [], pe.timePicker[0] = [], pe.timePicker[1] = [], Pt.value = !1, Jt.value = !1, en.value = !1, Qt.value = !1, L(), qt.value = null;
},
setMonthPicker: (O) => {
Qt.value = O, L();
},
refSets: pe
// exposed for testing
};
}, Rn = (e) => Array.isArray(e), lt = (e) => Array.isArray(e), On = (e) => Array.isArray(e) && e.length === 2, Ja = (e, n, a, t, s) => {
const {
getDefaultStartTime: f,
isDisabled: h,
sanitizeDate: C,
getWeekFromDate: I,
setDateMonthOrYear: $,
validateMonthYearInRange: L,
defaults: M
} = Le(e), m = V({
get: () => e.internalModelValue,
set: (u) => {
!e.readonly && !e.disabled && n("update:internal-model-value", u);
}
}), T = U([]);
dt(m, () => {
le();
});
const H = U([{ month: ke(k()), year: we(k()) }]), B = Mt({
hours: e.range ? [Ze(k()), Ze(k())] : Ze(k()),
minutes: e.range ? [Xe(k()), Xe(k())] : Xe(k()),
seconds: e.range ? [0, 0] : 0
}), J = V(
() => (u) => H.value[u] ? H.value[u].month : 0
), O = V(
() => (u) => H.value[u] ? H.value[u].year : 0
), E = V(() => e.flow && e.flow.length && !e.partialFlow ? s.value === e.flow.length : !0), A = (u, w, G) => {
var ee, De;
H.value[u] || (H.value[u] = { month: 0, year: 0 }), H.value[u].month = w === null ? (ee = H.value[u]) == null ? void 0 : ee.month : w, H.value[u].year = G === null ? (De = H.value[u]) == null ? void 0 : De.year : G;
}, x = (u, w) => {
B[u] = w;
};
He(() => {
m.value || (e.startDate && (A(0, ke(k(e.startDate)), we(k(e.startDate))), M.value.multiCalendars && ye(0)), M.value.startTime && Q()), le(!0);
});
const le = (u = !1) => {
if (m.value)
return Array.isArray(m.value) ? (T.value = m.value, F(u)) : de(m.value);
if (e.timePicker)
return v();
if (e.monthPicker && !e.range)
return _();
if (e.yearPicker && !e.range)
return z();
if (M.value.multiCalendars && u && !e.startDate)
return oe(k(), u);
}, oe = (u, w = !1) => {
if ((!M.value.multiCalendars || !e.multiStatic || w) && A(0, ke(u), we(u)), M.value.multiCalendars)
for (let G = 1; G < M.value.multiCalendars; G++) {
const ee = Re(k(), { month: J.value(G - 1), year: O.value(G - 1) }), De = Fn(ee, { months: 1 });
H.value[G] = { month: ke(De), year: we(De) };
}
}, de = (u) => {
oe(u), x("hours", Ze(u)), x("minutes", Xe(u)), x("seconds", gt(u));
}, S = (u, w) => {
oe(u[0], w);
const G = (ee, De) => [
ee(u[0]),
u[1] ? ee(u[1]) : B[De][1]
];
x("hours", G(Ze, "hours")), x("minutes", G(Xe, "minutes")), x("seconds", G(gt, "seconds"));
}, Y = (u, w) => {
if ((e.range || e.weekPicker) && !e.multiDates)
return S(u, w);
if (e.multiDates) {
const G = u[u.length - 1];
return de(G);
}
}, F = (u) => {
const w = m.value;
Y(w, u), M.value.multiCalendars && e.multiCalendarsSolo && l();
}, v = () => {
if (Q(), !e.range)
m.value = Fe(k(), B.hours, B.minutes, q());
else {
const u = B.hours, w = B.minutes;
m.value = [
Fe(k(), u[0], w[0], q()),
Fe(k(), u[1], w[1], q(!1))
];
}
}, _ = () => {
m.value = $(k(), J.value(0), O.value(0));
}, z = () => {
m.value = k();
}, q = (u = !0) => e.enableSeconds ? Array.isArray(B.seconds) ? u ? B.seconds[0] : B.seconds[1] : B.seconds : 0, Q = () => {
const u = f();
if (u) {
const w = Array.isArray(u), G = w ? [+u[0].hours, +u[1].hours] : +u.hours, ee = w ? [+u[0].minutes, +u[1].minutes] : +u.minutes, De = w ? [+u[0].seconds, +u[1].seconds] : +u.seconds;
x("hours", G), x("minutes", ee), e.enableSeconds && x("seconds", De);
}
}, N = () => Array.isArray(m.value) && m.value.length ? m.value[m.value.length - 1] : null, l = () => {
if (Array.isArray(m.value) && m.value.length === 2) {
const u = k(
k(m.value[1] ? m.value[1] : st(m.value[0], 1))
), [w, G] = [ke(m.value[0]), we(m.value[0])], [ee, De] = [ke(m.value[1]), we(m.value[1])];
(w !== ee || w === ee && G !== De) && e.multiCalendarsSolo && A(1, ke(u), we(u));
}
}, o = (u) => {
const w = st(u, 1);
return { month: ke(w), year: we(w) };
}, r = (u) => {
const w = ke(k(u)), G = we(k(u));
if (A(0, w, G), M.value.multiCalendars > 0)
for (let ee = 1; ee < M.value.multiCalendars; ee++) {
const De = o(
Re(k(u), { year: J.value(ee - 1), month: O.value(ee - 1) })
);
A(ee, De.month, De.year);
}
}, c = (u) => {
if (m.value && Array.isArray(m.value))
if (m.value.some((w) => he(u, w))) {
const w = m.value.filter((G) => !he(G, u));
m.value = w.length ? w : null;
} else
(e.multiDatesLimit && +e.multiDatesLimit > m.value.length || !e.multiDatesLimit) && m.value.push(u);
else
m.value = [u];
}, b = (u, w) => {
const G = Ve(u, w) ? w : u, ee = Ve(w, u) ? w : u;
return pn({ start: G, end: ee });
}, W = (u, w = 0) => {
if (Array.isArray(m.value) && m.value[w]) {
const G = sa(u, m.value[w]), ee = b(m.value[w], u), De = ee.length === 1 ? 0 : ee.filter((K) => h(K)).length, g = Math.abs(G) - De;
if (e.minRange && e.maxRange)
return g >= +e.minRange && g <= +e.maxRange;
if (e.minRange)
return g >= +e.minRange;
if (e.maxRange)
return g <= +e.maxRange;
}
return !0;
}, R = (u) => Array.isArray(m.value) && m.value.length === 2 ? e.fixedStart && (Ve(u, m.value[0]) || he(u, m.value[0])) ? [m.value[0], u] : e.fixedEnd && (Oe(u, m.value[1]) || he(u, m.value[1])) ? [u, m.value[1]] : (n("invalid-fixed-range", u), m.value) : [], ce = () => {
e.autoApply && E.value && n("auto-apply", e.partialFlow);
}, y = () => {
e.autoApply && n("select-date");
}, i = (u) => !pn({ start: u[0], end: u[1] }).some((G) => h(G)), Z = (u) => (m.value = I(k(u.value)), ce()), te = (u) => {
const w = Fe(k(u.value), B.hours, B.minutes, q());
e.multiDates ? c(w) : m.value = w, a(), ce();
}, be = () => {
T.value = m.value ? m.value.slice() : [], T.value.length === 2 && !(e.fixedStart || e.fixedEnd) && (T.value = []);
}, ze = (u, w) => {
const G = [k(u.value), yt(k(u.value), +e.autoRange)];
i(G) && (w && r(u.value), T.value = G);
}, Je = (u) => {
re(u.value) || !W(u.value, e.fixedStart ? 0 : 1) || (T.value = R(k(u.value)));
}, re = (u) => e.noDisabledRange ? b(T.value[0], u).some((G) => h(G)) : !1, Ge = (u, w) => {
if (be(), e.autoRange)
return ze(u, w);
if (e.fixedStart || e.fixedEnd)
return Je(u);
T.value[0] ? W(k(u.value)) && !re(u.value) && (Oe(k(u.value), k(T.value[0])) ? T.value.unshift(k(u.value)) : T.value[1] = k(u.value)) : T.value[0] = k(u.value);
}, Ke = (u) => {
T.value[u] = Fe(
T.value[u],
B.hours[u],
B.minutes[u],
q(u !== 1)
);
}, Ie = () => {
T.value.length && (T.value[0] && !T.value[1] ? Ke(0) : (Ke(0), Ke(1), a()), m.value = T.value.slice(), T.value[0] && T.value[1] && e.autoApply && n("auto-apply"), T.value[0] && !T.value[1] && e.modelAuto && e.autoApply && n("auto-apply"));
}, pt = (u, w = !1) => {
if (!(h(u.value) || !u.current && e.hideOffsetDates)) {
if (e.weekPicker)
return Z(u);
if (!e.range)
return te(u);
lt(B.hours) && lt(B.minutes) && !e.multiDates && (Ge(u, w), Ie());
}
}, ne = (u) => {
const w = u[0];
return e.weekNumbers === "local" ? la(w.value, { weekStartsOn: +e.weekStart }) : e.weekNumbers === "iso" ? oa(w.value) : typeof e.weekNumbers == "function" ? e.weekNumbers(w.value) : "";
}, ye = (u) => {
for (let w = u - 1; w >= 0; w--) {
const G = Dt(Re(k(), { month: J.value(w + 1), year: O.value(w + 1) }), 1);
A(w, ke(G), we(G));
}
for (let w = u + 1; w <= M.value.multiCalendars - 1; w++) {
const G = st(Re(k(), { month: J.value(w - 1), year: O.value(w - 1) }), 1);
A(w, ke(G), we(G));
}
}, ve = (u) => $(k(), J.value(u), O.value(u)), at = (u) => Fe(u, B.hours, B.minutes, q()), rt = (u, w) => {
const G = e.monthPicker ? J.value(u) !== w.month || !w.fromNav : O.value(u) !== w.year;
if (A(u, w.month, w.year), M.value.multiCalendars && !e.multiCalendarsSolo && ye(u), e.monthPicker || e.yearPicker)
if (e.range) {
if (G) {
let ee = m.value ? m.value.slice() : [];
ee.length === 2 && ee[1] !== null && (ee = []), ee.length ? Oe(ve(u), ee[0]) ? ee.unshift(ve(u)) : ee[1] = ve(u) : ee = [ve(u)], m.value = ee;
}
} else
m.value = ve(u);
n("update-month-year", { instance: u, month: w.month, year: w.year }), t(e.multiCalendarsSolo ? u : void 0);
}, Ht = async (u = !1) => {
if (e.autoApply && (e.monthPicker || e.yearPicker)) {
await ct();
const w = e.monthPicker ? u : !1;
e.range ? n("auto-apply", w || !m.value || m.value.length === 1) : n("auto-apply", w);
}
a();
}, Tt = (u, w) => {
const G = Re(k(), { month: J.value(w), year: O.value(w) }), ee = u < 0 ? st(G, 1) : Dt(G, 1);
L(ke(ee), we(ee), u < 0, e.preventMinMaxNavigation) && (A(w, ke(ee), we(ee)), M.value.multiCalendars && !e.multiCalendarsSolo && ye(w), n("update-month-year", { instance: w, month: ke(ee), year: we(ee) }), t());
}, kt = (u) => {
Rn(u) && Rn(m.value) && lt(B.hours) && lt(B.minutes) ? (u[0] && m.value[0] && (m.value[0] = Fe(u[0], B.hours[0], B.minutes[0], q())), u[1] && m.value[1] && (m.value[1] = Fe(u[1], B.hours[1], B.minutes[1], q(!1)))) : e.multiDates && Array.isArray(m.value) ? m.value[m.value.length - 1] = at(u) : !e.range && !On(u) && (m.value = at(u)), n("time-update");
}, Wt = (u, w = !0, G = !1) => {
const ee = w ? u : B.hours, De = !w && !G ? u : B.minutes, g = G ? u : B.seconds;
if (e.range && On(m.value) && lt(ee) && lt(De) && lt(g) && !e.disableTimeRangeValidation) {
const K = ($e) => Fe(m.value[$e], ee[$e], De[$e], g[$e]), Ae = ($e) => cn(m.value[$e], 0);
if (he(m.value[0], m.value[1]) && (dn(K(0), Ae(1)) || un(K(1), Ae(0))))
return;
}
if (x("hours", ee), x("minutes", De), x("seconds", g), m.value)
if (e.multiDates) {
const K = N();
K && kt(K);
} else
kt(m.value);
else
e.timePicker && kt(e.range ? [k(), k()] : k());
a();
}, zt = (u, w) => {
e.monthChangeOnScroll && Tt(e.monthChangeOnScroll !== "inverse" ? -u.deltaY : u.deltaY, w);
}, Kt = (u, w, G = !1) => {
e.monthChangeOnArrows && e.vertical === G && At(u, w);
}, At = (u, w) => {
Tt(u === "right" ? -1 : 1, w);
};
return {
time: B,
month: J,
year: O,
modelValue: m,
calendars: H,
monthYearSelect: Ht,
isDisabled: h,
updateTime: Wt,
getWeekNum: ne,
selectDate: pt,
updateMonthYear: rt,
handleScroll: zt,
getMarker: (u) => e.markers.find((w) => he(C(u.value), C(w.date))),
handleArrow: Kt,
handleSwipe: At,
selectCurrentDate: () => {
e.range ? m.value && Array.isArray(m.value) && m.value[0] ? m.value = Oe(k(), m.value[0]) ? [k(), m.value[0]] : [m.value[0], k()] : m.value = [k()] : m.value = k(), y();
},
presetDateRange: (u, w) => {
w || u.length && u.length <= 2 && e.range && (m.value = u.map((G) => k(G)), y(), e.multiCalendars && ct().then(() => le(!0)));
}
};
}, Qa = (e, n, a) => {
const t = U(), {
getZonedToUtc: s,
getZonedDate: f,
formatDate: h,
getDefaultPattern: C,
checkRangeEnabled: I,
checkPartialRangeValue: $,
isValidDate: L,
setDateMonthOrYear: M,
defaults: m
} = Le(n), T = U(""), H = It(n, "format");
dt(t, () => {
e("internal-model-change", t.value);
}), dt(H, () => {
o();
});
const B = (i) => {
const Z = i || k();
return n.modelType ? c(Z) : {
hours: Ze(Z),
minutes: Xe(Z),
seconds: n.enableSeconds ? gt(Z) : 0
};
}, J = (i) => n.modelType ? c(i) : { month: ke(i), year: we(i) }, O = (i) => Array.isArray(i) ? I(() => [
ut(k(), i[0]),
i[1] ? ut(k(), i[1]) : $()
]) : ut(k(), +i), E = (i, Z) => (typeof i == "string" || typeof i == "number") && n.modelType ? r(i) : Z, A = (i) => Array.isArray(i) ? [
E(
i[0],
Fe(null, +i[0].hours, +i[0].minutes, i[0].seconds)
),
E(
i[1],
Fe(null, +i[1].hours, +i[1].minutes, i[1].seconds)
)
] : E(i, Fe(null, i.hours, i.minutes, i.seconds)), x = (i) => Array.isArray(i) ? I(() => [
E(i[0], M(null, +i[0].month, +i[0].year)),
E(
i[1],
i[1] ? M(null, +i[1].month, +i[1].year) : $()
)
]) : E(i, M(null, +i.month, +i.year)), le = (i) => {
if (Array.isArray(i))
return i.map((Z) => r(Z));
throw new Error(Lt.dateArr("multi-dates"));
}, oe = (i) => {
if (Array.isArray(i))
return [k(i[0]), k(i[1])];
throw new Error(Lt.dateArr("week-picker"));
}, de = (i) => n.modelAuto ? Array.isArray(i) ? [r(i[0]), r(i[1])] : n.autoApply ? [r(i)] : [r(i), null] : Array.isArray(i) ? I(() => [
r(i[0]),
i[1] ? r(i[1]) : $()
]) : r(i), S = () => {
Array.isArray(t.value) && n.range && t.value.length === 1 && t.value.push($());
}, Y = () => {
const i = t.value;
return [
c(i[0]),
i[1] ? c(i[1]) : $()
];
}, F = () => t.value[1] ? Y() : c(Se(t.value[0])), v = () => (t.value || []).map((i) => c(i)), _ = () => (S(), n.modelAuto ? F() : n.multiDates ? v() : Array.isArray(t.value) ? I(() => Y()) : c(Se(t.value))), z = (i) => i ? n.timePicker ? A(Se(i)) : n.monthPicker ? x(Se(i)) : n.yearPicker ? O(Se(i)) : n.multiDates ? le(Se(i)) : n.weekPicker ? oe(Se(i)) : de(Se(i)) : null, q = (i) => {
const Z = z(i);
L(Se(Z)) ? (t.value = Se(Z), o()) : (t.value = null, T.value = "");
}, Q = () => {
var Z;
const i = (te) => {
var be;
return bt(te, (be = m.value.textInputOptions) == null ? void 0 : be.format);
};
return `${i(t.value[0])} ${(Z = m.value.textInputOptions) == null ? void 0 : Z.rangeSeparator} ${t.value[1] ? i(t.value[1]) : ""}`;
}, N = () => {
var i;
return a.value && t.value ? Array.isArray(t.value) ? Q() : bt(t.value, (i = m.value.textInputOptions) == null ? void 0 : i.format) : h(t.value);
}, l = () => {
var i;
return t.value ? n.multiDates ? t.value.map((Z) => h(Z)).join("; ") : n.textInput && typeof ((i = m.value.textInputOptions) == null ? void 0 : i.format) == "string" ? N() : h(t.value) : "";
}, o = () => {
!n.format || typeof n.format == "string" ? T.value = l() : T.value = n.format(t.value);
}, r = (i) => {
if (n.utc) {
const Z = new Date(i);
return n.utc === "preserve" ? new Date(Z.getTime() + Z.getTimezoneOffset() * 6e4) : Z;
}
return n.modelType ? n.modelType === "date" || n.modelType === "timestamp" ? f(new Date(i)) : n.modelType === "format" && (typeof n.format == "string" || !n.format) ? an(i, C(), /* @__PURE__ */ new Date()) : f(an(i, n.modelType, /* @__PURE__ */ new Date())) : f(new Date(i));
}, c = (i) => i ? n.utc ? va(i, n.utc === "preserve") : n.modelType ? n.modelType === "timestamp" ? +s(i) : n.modelType === "format" && (typeof n.format == "string" || !n.format) ? h(s(i)) : h(s(i), n.modelType) : s(i) : "", b = (i) => {
e("update:model-value", i);
}, W = (i) => Array.isArray(t.value) ? [
i(t.value[0]),
t.value[1] ? i(t.value[1]) : $()
] : i(Se(t.value)), R = (i) => b(Se(W(i)));
return {
inputValue: T,
internalModelValue: t,
checkBeforeEmit: () => t.value ? n.range ? n.partialRange ? t.value.length >= 1 : t.value.length === 2 : !!t.value : !1,
parseExternalModelValue: q,
formatInputValue: o,
emitModelValue: () => (o(), n.monthPicker ? R(J) : n.timePicker ? R(B) : n.yearPicker ? R(we) : n.weekPicker ? b(t.value) : b(_()))
};
}, er = (e, n) => {
const { validateMonthYearInRange: a, validateMaxDate: t, validateMinDate: s, defaults: f } = Le(e), h = (M, m) => {
let T = M;
return f.value.filters.months.includes(ke(T)) ? (T = m ? st(M, 1) : Dt(M, 1), h(T, m)) : T;
}, C = (M, m) => {
let T = M;
return f.value.filters.years.includes(we(T)) ? (T = m ? ia(M, 1) : ua(M, 1), C(T, m)) : T;
}, I = (M) => {
const m = Re(/* @__PURE__ */ new Date(), { month: e.month, year: e.year });
let T = M ? st(m, 1) : Dt(m, 1), H = ke(T), B = we(T);
f.value.filters.months.includes(H) && (T = h(T, M), H = ke(T), B = we(T)), f.value.filters.years.includes(B) && (T = C(T, M), B = we(T)), a(H, B, M, e.preventMinMaxNavigation) && $(H, B);
}, $ = (M, m) => {
n("update-month-year", { month: M, year: m });
}, L = V(() => (M) => {
if (!e.preventMinMaxNavigation || M && !e.maxDate || !M && !e.minDate)
return !1;
const m = Re(/* @__PURE__ */ new Date(), { month: e.month, year: e.year }), T = M ? st(m, 1) : Dt(m, 1), H = [ke(T), we(T)];
return M ? !t(...H) : !s(...H);
});
return { handleMonthYearChange: I, isDisabled: L, updateMonthYear: $ };
};
var Ot = /* @__PURE__ */ ((e) => (e.center = "center", e.left = "left", e.right = "right", e))(Ot || {});
const tr = (e, n, a, t) => {
const s = U({
top: "0",
left: "0",
transform: "none"
}), f = U(!1), h = It(t, "teleportCenter");
dt(h, () => {
B();
});
const C = (S) => {
if (t.teleport) {
const Y = S.getBoundingClientRect();
return {
left: Y.left + window.scrollX,
top: Y.top + window.scrollY
};
}
return { top: 0, left: 0 };
}, I = (S, Y) => {
s.value.left = `${S + Y}px`, s.value.transform = "translateX(-100%)";
}, $ = (S) => {
s.value.left = `${S}px`, s.value.transform = "translateX(0)";
}, L = (S, Y, F = !1) => {
t.position === Ot.left && $(S), t.position === Ot.right && I(S, Y), t.position === Ot.center && (s.value.left = `${S + Y / 2}px`, s.value.transform = F ? "translate(-50%, -50%)" : "translateX(-50%)");
}, M = (S) => {
const { width: Y, height: F } = S.getBoundingClientRect(), { top: v, left: _ } = t.altPosition ? t.altPosition(S) : C(S);
return { top: +v, left: +_, width: Y, height: F };
}, m = () => {
const S = Te(n);
if (S) {
const { top: Y, left: F, width: v, height: _ } = M(S);
s.value.top = `${Y + _ / 2}px`, s.value.transform = "translateY(-50%)", L(F, v, !0);
}
}, T = () => {
s.value.left = "50%", s.value.top = "50%", s.value.transform = "translate(-50%, -50%)", s.value.position = "fixed";
}, H = () => {
const S = Te(n), { top: Y, left: F, transform: v } = t.altPosition(S);
s.value = { top: `${Y}px`, left: `${F}px`, transform: v || "" };
}, B = (S = !0) => {
if (!t.inline)
return h.value ? T() : t.altPosition !== null ? H() : (S && a("recalculate-position"), le());
}, J = ({
inputEl: S,
menuEl: Y,
left: F,
width: v
}) => {
window.screen.width > 768 && L(F, v), A(S, Y);
}, O = (S, Y) => {
const { top: F, left: v, height: _, width: z } = M(S);
s.value.top = `${_ + F + +t.offset}px`, J({ inputEl: S, menuEl: Y, left: v, width: z }), f.value = !1;
}, E = (S, Y) => {
const { top: F, left: v, width: _ } = M(S), { height: z } = Y.getBoundingClientRect();
s.value.top = `${F - z - +t.offset}px`, J({ inputEl: S, menuEl: Y, left: v, width: _ }), f.value = !0;
}, A = (S, Y) => {
if (t.autoPosition) {
const { left: F, width: v } = M(S), { left: _, right: z } = Y.getBoundingClientRect();
return _ <= 0 || _ <= F ? $(F) : z >= document.documentElement.clientWidth ? I(F, v) : L(F, v);
}
}, x = (S, Y) => {
const { height: F } = Y.getBoundingClientRect(), { top: v, height: _ } = S.getBoundingClientRect(), q = window.innerHeight - v - _, Q = v;
return F <= q ? O(S, Y) : F > q && F <= Q ? E(S, Y) : q >= Q ? O(S, Y) : E(S, Y);
}, le = () => {
const S = Te(n), Y = Te(e);
if (S && Y)
return t.autoPosition ? x(S, Y) : O(S, Y);
}, oe = function(S) {
if (S) {
const Y = S.scrollHeight > S.clientHeight, v = window.getComputedStyle(S).overflowY.indexOf("hidden") !== -1;
return Y && !v;
}