UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

1,429 lines 126 kB
import { defineComponent as Oe, ref as f, watch as U, createVNode as g, Fragment as zt, computed as H, onMounted as Zt, mergeProps as nt } from "vue"; import { useDateFormat as Ze, formatTime as Mn, getDateObject as je, isLeapYear as Dn, compareDate as kt, getDaysInMonth as kn, useBem as Pa, isMobilePhone as bt } from "../common/index.esm.js"; import { cloneDeep as fe } from "lodash-es"; import { FTimePickerTimeView as Sa, convertToDate as Tn, FTouchTimePickerTimeView as Sn } from "../time-picker/index.esm.js"; import { FButton as xn } from "../button/index.esm.js"; import pn from "../button-edit/index.esm.js"; import { FInputGroup as xa } from "../input-group/index.esm.js"; import wn from "../popover/index.esm.js"; import pa from "../date-picker/index.esm.js"; import { LocaleService as On } from "../locale/index.esm.js"; import { FTouchComboListContainer as Cn } from "../combo-list/index.esm.js"; import Pn from "../capsule/index.esm.js"; const Yn = "Sun", Nn = "Mon", Fn = "Tue", Vn = "Wed", Bn = "Thu", Wn = "Fri", $n = "Sat", Ge = [Yn, Nn, Fn, Vn, Bn, Wn, $n], Bl = { Sun: "日", Mon: "一", Tue: "二", Wed: "三", Thu: "四", Fri: "五", Sat: "六" }; var Te = /* @__PURE__ */ ((e) => (e[e.previous = 1] = "previous", e[e.current = 2] = "current", e[e.next = 3] = "next", e))(Te || {}), Le = /* @__PURE__ */ ((e) => (e.Sunday = "Sun", e.Monday = "Mon", e))(Le || {}); const Hn = { dates: { Type: Array, default: [] }, daysInWeek: { Type: Array, default: [] }, enableKeyboadNavigate: { Type: Boolean, default: !0 }, enableMarkCurrent: { Type: Boolean, default: !0 }, enablePeriod: { Type: Boolean, default: !1 }, firstDayOfTheWeek: { Type: String, default: Le.Sunday }, selected: { Type: Object, default: null }, selectedPeriod: { Type: Object, default: null }, selectedWeek: { Type: Object, default: null }, selectMode: { Type: String, default: "day" }, showWeekNumber: { Type: Boolean, default: !1 }, weekTitle: { Type: String, default: "Week" } }; var we = /* @__PURE__ */ ((e) => (e[e.enter = 13] = "enter", e[e.esc = 27] = "esc", e[e.space = 32] = "space", e[e.leftArrow = 37] = "leftArrow", e[e.upArrow = 38] = "upArrow", e[e.rightArrow = 39] = "rightArrow", e[e.downArrow = 40] = "downArrow", e[e.tab = 9] = "tab", e[e.shift = 16] = "shift", e))(we || {}); function ea() { function e(t) { const d = t.key || t.keyCode; return d === "Enter" || d === 13 ? 13 : d === "Escape" || d === 27 ? 27 : d === " " || d === 32 ? 32 : d === "ArrowLeft" || d === 37 ? 37 : d === "ArrowUp" || d === 38 ? 38 : d === "ArrowRight" || d === 39 ? 39 : d === "ArrowDown" || d === 40 ? 40 : d === "Tab" || d === 9 ? 9 : d === "Shift" || d === 16 ? 16 : -1; } return { getKeyCodeFromEvent: e }; } function Se(e) { const t = Object.prototype.toString.call(e); return e instanceof Date || typeof e == "object" && t === "[object Date]" ? new e.constructor(+e) : typeof e == "number" || t === "[object Number]" || typeof e == "string" || t === "[object String]" ? new Date(e) : /* @__PURE__ */ new Date(NaN); } function Tt(e, t) { return e instanceof Date ? new e.constructor(t) : new Date(t); } function Xe(e, t) { const d = Se(e); return isNaN(t) ? Tt(e, NaN) : (t && d.setDate(d.getDate() + t), d); } function ta(e, t) { const d = Se(e); if (isNaN(t)) return Tt(e, NaN); if (!t) return d; const h = d.getDate(), a = Tt(e, d.getTime()); a.setMonth(d.getMonth() + t + 1, 0); const r = a.getDate(); return h >= r ? a : (d.setFullYear( a.getFullYear(), a.getMonth(), h ), d); } let In = {}; function Ya() { return In; } function Qt(e, t) { var s, k, w, c; const d = Ya(), h = (t == null ? void 0 : t.weekStartsOn) ?? ((k = (s = t == null ? void 0 : t.locale) == null ? void 0 : s.options) == null ? void 0 : k.weekStartsOn) ?? d.weekStartsOn ?? ((c = (w = d.locale) == null ? void 0 : w.options) == null ? void 0 : c.weekStartsOn) ?? 0, a = Se(e), r = a.getDay(), b = (r < h ? 7 : 0) + r - h; return a.setDate(a.getDate() - b), a.setHours(0, 0, 0, 0), a; } function En(e) { const t = Se(e); return t.setHours(0, 0, 0, 0), t; } function jn(e, t) { const d = t * 3; return ta(e, d); } function Ut(e, t) { return ta(e, t * 12); } function Ln(e) { return e instanceof Date || typeof e == "object" && Object.prototype.toString.call(e) === "[object Date]"; } function An(e) { if (!Ln(e) && typeof e != "number") return !1; const t = Se(e); return !isNaN(Number(t)); } function jt(e) { const t = Se(e), d = t.getMonth(); return t.setFullYear(t.getFullYear(), d + 1, 0), t.setHours(23, 59, 59, 999), t; } function Lt(e) { const t = Se(e), d = t.getMonth(), h = d - d % 3; return t.setMonth(h, 1), t.setHours(0, 0, 0, 0), t; } function At(e) { const t = Se(e); return t.setDate(1), t.setHours(0, 0, 0, 0), t; } function gt(e) { const t = Se(e), d = t.getFullYear(); return t.setFullYear(d + 1, 0, 0), t.setHours(23, 59, 59, 999), t; } function Mt(e) { const t = Se(e), d = Tt(e, 0); return d.setFullYear(t.getFullYear(), 0, 1), d.setHours(0, 0, 0, 0), d; } function wa(e, t) { var s, k, w, c; const d = Ya(), h = (t == null ? void 0 : t.weekStartsOn) ?? ((k = (s = t == null ? void 0 : t.locale) == null ? void 0 : s.options) == null ? void 0 : k.weekStartsOn) ?? d.weekStartsOn ?? ((c = (w = d.locale) == null ? void 0 : w.options) == null ? void 0 : c.weekStartsOn) ?? 0, a = Se(e), r = a.getDay(), b = (r < h ? -7 : 0) + 6 - (r - h); return a.setDate(a.getDate() + b), a.setHours(23, 59, 59, 999), a; } function Rt(e) { const t = Se(e), d = t.getMonth(), h = d - d % 3 + 3; return t.setMonth(h, 0), t.setHours(23, 59, 59, 999), t; } function Rn(e) { const t = Se(e); return t.setMilliseconds(0), t; } function at(e, t) { return Xe(e, -t); } function _n() { return En(Date.now()); } function _t(e, t) { return ta(e, -t); } function Oa(e, t) { return jn(e, -1); } function Ca(e, t) { return Ut(e, -1); } function Ce() { const { formatTo: e, parseToDate: t } = Ze(); function d() { return { year: 0, month: 0, day: 0 }; } function h(u) { return new Date( u.year || 0, u.month ? u.month - 1 : 0, u.day || 0, u.hour ? u.hour : 0, u.minute ? u.minute : 0, u.second ? u.second : 0, 0 ); } function a(u) { const P = /* @__PURE__ */ new Date(); return u.year || (u.year = P.getFullYear()), u.month || (u.month = P.getMonth() + 1), u.day || (u.day = 1), new Date( u.year, u.month - 1, u.day, u.hour ? u.hour : 0, u.minute ? u.minute : 0, u.second ? u.second : 0, 0 ); } function r(u) { return new Date( u.year || 1, (u.month || 1) - 1, u.day, u.hour ? u.hour : 0, u.minute ? u.minute : 0, u.second ? u.second : 0, 0 ).getDay(); } function b(u) { return Ge.indexOf(u); } function s(u) { return h(u).getTime(); } function k(u) { return Math.round(s(u) / 1e3); } function w(u, P, o) { const O = s(P), Y = s(o), A = s(u); return Y - A > A - O ? P : o; } function c() { const u = /* @__PURE__ */ new Date(); return { year: u.getFullYear(), month: u.getMonth() + 1, day: u.getDate(), hour: u.getHours(), minute: u.getMinutes(), second: u.getSeconds() }; } function l(u, P) { const o = P.match(/[^(DdMmYy)]{1,}/g), O = {}; if (o) { let Y = o[0]; o[0] !== o[1] && (Y = o[0] + o[1], o[2] && o[1] !== o[2] && (Y += o[2])); const A = new RegExp("[" + Y + "]"), _ = u.split(A), Z = P.split(A); for (let E = 0; E < Z.length; E++) Z[E].indexOf("yyyy") !== -1 && (O.year = Number(_[E])), Z[E].indexOf("M") !== -1 && (O.month = Number(_[E] || "1")), Z[E].indexOf("d") !== -1 && (O.day = Number(_[E] || "1")); } else { const Y = (P + "").indexOf("yyyy"), A = (P + "").indexOf("MM"), _ = (P + "").indexOf("dd"); if (Y >= 0) { const Z = u.substring(Y, Y + 4); O.year = Number(Z); } A >= 0 && (O.month = Number(u.substring(A, A + 2) || "1")), _ >= 0 && (O.day = Number(u.substring(_, _ + 2) || "01")); } return O.year === void 0 && (O.year = c().year), O; } function v(u) { return { year: u.getFullYear(), month: u.getMonth() + 1, day: u.getDate(), hour: u.getHours(), minute: u.getMinutes(), second: u.getSeconds() }; } function T(u, P = !0) { const o = new Date(1900, 1, 1, 0, 0, 0), O = new Date(9999, 12, 31, 23, 59, 59), Y = P ? o : O; let A; return u instanceof Date ? A = u : typeof u == "string" ? A = u.trim() ? t(u, "yyyy-MM-dd HH:mm:ss") : Y : A = Y, An(A) || (A = Y), { year: A.getFullYear(), month: A.getMonth() + 1, day: A.getDate(), hour: A.getHours(), minute: A.getMinutes(), second: A.getSeconds() }; } function M(u) { return T(u, !0); } function p(u) { return T(u, !1); } function V(u, P = !1) { if (u && typeof u == "string") { const o = u.replace("时", ":").replace("分", ":").replace("秒", "").split(":"); if (o.length >= 2) return { hour: parseInt(o[0], 10), minute: parseInt(o[1]), second: parseInt(o[2] || "0") || 0 }; } else { const o = /* @__PURE__ */ new Date(), O = o.getHours(), Y = o.getMinutes(), A = o.getSeconds(); return P ? { hour: 0, minute: 0, second: 0 } : { hour: O, minute: Y, second: A }; } return { hour: 0, minute: 0, second: 0 }; } function m(u) { if (u && typeof u == "string") { const Y = u.replace("时", ":").replace("分", ":").replace("秒", "").split(":"); if (Y.length >= 2) return { hour: Y[0], minute: Y[1], second: Y[2] ? Y[2] : 0 }; } return { hour: 23, minute: 59, second: 59 }; } function S(u, P, o) { const { year: O } = u, Y = String(u.month).padStart(2, "0"), A = String(u.day).padStart(2, "0"); if (P === "year") return `${O}`; if (P === "month") return `${O}-${Y}`; let _ = `${O}-${Y}-${A}`; if (o && (u.hour !== void 0 || u.minute !== void 0 || u.second !== void 0)) { const Z = String(u.hour || 0).padStart(2, "0"), E = String(u.minute || 0).padStart(2, "0"), j = String(u.second || 0).padStart(2, "0"); _ += ` ${Z}:${E}:${j}`; } return _; } return { emptyDate: d, getDate: h, getDate2: a, getDayNumber: r, getEpocTime: k, getNearDate: w, getWeekdayIndex: b, getTimeInMilliseconds: s, getToday: c, getDateObject: l, getMinDate: M, getMaxDate: p, getTimeValue: V, getEndTimeValue: m, convertDateToDateObject: v, formatDateObject: S }; } function Be() { const { getTimeInMilliseconds: e } = Ce(); function t(l) { return l && l.year !== 0 && l.month !== 0 && l.day !== 0; } function d(l) { return l && l.year !== 0 && l.month !== 0; } function h(l) { return l && l.year !== 0; } function a(l, v) { return e(l) < e(v); } function r(l, v) { return e(l) <= e(v); } function b(l, v) { return e(l) === e(v); } function s(l, v) { const T = e(v); return e(l.from) === T || e(l.to) === T; } function k(l, v) { return !v || !t(v.to) || !t(v.from) ? !1 : r(v.from, l) && r(l, v.to); } function w(l, v) { return t(v) && e(l) >= e(v); } function c(l, v) { return t(v) && e(l) <= e(v); } return { isDateEarlier: a, equal: b, inPeriod: k, isPoint: s, equalOrEarlier: r, isInitializedDate: t, isInitializedMonth: d, isInitializedYear: h, isMonthDisabledByDisableSince: w, isMonthDisabledByDisableUntil: c }; } const Kt = /* @__PURE__ */ Oe({ name: "FDatePickerCalendarView", props: Hn, emits: ["click", "clickWeek", "keyDown", "mouseEnter", "mouseLeave"], setup(e, t) { const d = f(e.dates), h = f(e.daysInWeek), a = f(e.enableKeyboadNavigate), r = f(e.enableMarkCurrent), b = f(e.enablePeriod), s = f(e.selected), k = f(e.selectedPeriod), w = f(e.selectedWeek), c = f(e.selectMode), l = f(e.showWeekNumber), v = f(e.weekTitle || "周"); U(() => e.dates, () => { d.value = e.dates; }), U(() => e.selected, () => { s.value = e.selected; }), U(() => e.enablePeriod, (D, N) => { D !== N && (b.value = D); }), U(() => e.selectedPeriod, (D) => { k.value = D; }), U(() => e.selectedWeek, (D) => { w.value = D; }); const { equal: T, inPeriod: M, isInitializedDate: p, equalOrEarlier: V, isPoint: m } = Be(), { getKeyCodeFromEvent: S } = ea(), u = (D) => { const N = !!w.value && D.numberInTheYear === w.value.numberInTheYear; return { "f-datepicker-selectWeek": c.value === "week", "f-datepicker-selectedWeek": c.value === "week" && N }; }; function P(D) { return M(D, k.value); } function o(D) { if (!k.value) return !1; const N = { from: { year: k.value.from.year, month: k.value.from.month, day: k.value.from.day }, to: { year: k.value.to.year, month: k.value.to.month, day: k.value.to.day } }; return !!k.value && m(N, D); } function O(D) { return !!s.value && T({ year: s.value.year, month: s.value.month, day: s.value.day }, { year: D.year, month: D.month, day: D.day }); } const Y = (D, N, W) => { const F = c.value !== "week" && D.tag === Te.current && (b.value && P(D.date) && !o(D.date) || D.range), G = D.tag === Te.previous || D.tag === Te.next, ee = { "f-datepicker-range": F, "f-datepicker-no-currmonth": G, "f-datepicker-disabled": D.disable, "f-datepicker-singledate": !D.disable }, ne = `d_${N}_${W}`; return ee[ne] = !0, ee; }, A = (D) => { const N = c.value !== "week" && D.tag === Te.current && (!b.value && O(D.date) || b.value && o(D.date)), W = D.isCurrent && r.value, F = D.highlight && (D.tag === Te.previous || D.tag === Te.next || D.disable); return { "f-datepicker-date": !0, "f-datepicker-selected": N, "f-datepicker-current": W, "f-datepicker-opacity": F, "f-datepicker-highlight": D.highlight, "f-datepicker-disabled": D.disable }; }; function _(D, N) { N.disable || c.value === "week" || (D.stopPropagation(), t.emit("click", { event: D, dayItem: N })); } function Z(D, N) { c.value === "week" && (D.stopPropagation(), t.emit("clickWeek", N)); } function E(D, N) { const W = S(D); W !== we.tab && (D.preventDefault(), W === we.enter || W === we.space ? _(D, N) : a.value && t.emit("keyDown", N.date)); } function j(D) { if (k.value && p(k.value.from) && (!p(k.value.to) || JSON.stringify(k.value.from) === JSON.stringify(k.value.to))) { const { from: N } = k.value; d.value.forEach((W) => { W.days.forEach((F) => { F.range = V(N, F.date) && V(F.date, D.date) || V(F.date, N) && V(D.date, F.date); }); }), t.emit("mouseEnter", D.date); } } function L() { d.value.forEach((D) => { D.days.forEach((N) => { N.range = !1; }); }), t.emit("mouseLeave"); } return () => g(zt, null, [g("div", { class: "f-datepicker-table-wrapper" }, [g("table", { class: "f-datepicker-table", cellpadding: "0" }, [g("thead", null, [g("tr", null, [l.value && g("th", { class: "f-datepicker-weeknbr-title", style: "padding-bottom: 8px;padding-top: 4px" }, [v.value]), h.value && h.value.map((D) => g("th", { scope: "col", style: "padding-bottom: 8px;padding-top: 4px" }, [D]))])]), g("tbody", null, [d.value && d.value.map((D, N) => g("tr", { class: u(D), onClick: (W) => Z(W, D) }, [l.value && g("td", { class: "f-datepicker-weeknbr" }, [g("div", { class: "f-datepicker-date" }, [D.numberInTheYear])]), D.days && D.days.map((W, F) => g("td", { id: `d_${N}_${F}`, tabindex: "0", class: Y(W, N, F), onKeydown: (G) => E(G, W), onMouseenter: () => j(W), onMouseleave: () => L() }, [W.marked && W.marked.marked && g("span", { class: "f-datepicker-markdate", style: { "background-color": W.marked.color } }, null), g("div", { class: A(W), onClick: (G) => _(G, W) }, [W.date.day])]))]))])])])]); } }), qn = { activeMonth: { type: Object, require: !0 }, ariaLabelPrevMonth: { type: String, default: "" }, ariaLabelNextMonth: { type: String, default: "" }, dateFormat: { type: String, default: "yyyy-MM-dd" }, disablePrePage: { type: Boolean, default: !1 }, disablePreRecord: { type: Boolean, default: !1 }, disableNextRecord: { type: Boolean, default: !1 }, disableNextPage: { type: Boolean, default: !1 }, years: { type: Array, default: [[{}]] }, selectingMonth: { type: Boolean, default: !1 }, selectingYear: { type: Boolean, default: !1 }, selectMode: { type: String, default: "day" }, minDate: { type: Object }, maxDate: { type: Object }, minYear: { type: Number, default: 1900 }, maxYear: { type: Number, default: 9999 } }; function aa() { const { getTimeInMilliseconds: e } = Ce(), { isInitializedDate: t } = Be(); function d(a, r) { return t(r) && e(a) < e(r); } function h(a, r) { return t(r) && e(a) > e(r); } return { isMonthDisabledByDisableSince: h, isMonthDisabledByDisableUntil: d }; } function na() { const { getToday: e } = Ce(), { isMonthDisabledByDisableSince: t, isMonthDisabledByDisableUntil: d } = aa(); function h(c) { const l = { displayTextOfMonth: "", month: 0, year: 0, displayTextOfYear: "" }; if (c) { const v = c.match(/[^0-9]/), T = v && v.length ? v[0] : "", M = c.split(T); l.month = M[0].length === 2 ? Number(M[0]) : Number(M[1]), l.year = M[0].length === 2 ? Number(M[1]) : Number(M[0]); } return l; } function a(c, l) { return new Date(l, c, 0).getDate(); } function r(c, l, v) { return new Date(c, l - 1, v, 0, 0, 0, 0); } function b(c, l) { const v = r(l, c, 1); return v.setMonth(v.getMonth() - 1), a(v.getMonth() + 1, v.getFullYear()); } function s(c, l, v, T) { const M = e(), p = [], { year: V } = l, m = 3, S = { year: v.year, month: v.month, day: v.day }, u = { year: T.year, month: T.month, day: T.day }; for (let P = 1; P <= 12; P += m) { const o = []; for (let O = P; O < P + m; O++) { const Y = t({ year: V, month: O, day: 1 }, S) || d({ year: V, month: O, day: a(O, V || 0) }, u); o.push({ month: O, displayText: c[O], isCurrent: O === M.month && V === M.year, disable: Y, date: { year: V, month: O } }); } p.push(o); } return p; } function k(c, l) { const v = { year: c === 12 ? l + 1 : l }, T = c === 12 ? 1 : c + 1; return v.month = T, v; } function w(c, l) { const v = { year: c === 1 ? l - 1 : l }, T = c === 1 ? 12 : c - 1; return v.month = T, v; } return { daysInMonth: a, daysInPreMonth: b, generateMonths: s, parseDefaultMonth: h, getNextMonth: k, getPreviousMonth: w }; } const Jt = /* @__PURE__ */ Oe({ name: "FDatePickerCalendarNavbar", props: qn, emits: ["clickMonth", "clickYear", "prePage", "preRecord", "nextRecord", "nextPage"], setup(e, t) { const d = f(e.ariaLabelPrevMonth), h = f(e.ariaLabelNextMonth), a = f(e.dateFormat), r = f(e.disablePrePage), b = f(e.disablePreRecord), s = f(e.disableNextRecord), k = f(e.disableNextPage), w = f(e.activeMonth), c = f(e.years), l = f(e.selectingMonth), v = f(e.selectingYear), T = f(e.selectMode), M = f(!0), p = f(!0), { isMonthDisabledByDisableSince: V, isMonthDisabledByDisableUntil: m } = aa(), { daysInMonth: S } = na(); U(() => e.selectingMonth, (C, q) => { l.value = C; }), U(() => e.selectingYear, (C, q) => { v.value = C; }); const u = (C, q) => ({ year: q === 1 ? C - 1 : C, month: q === 1 ? 12 : q - 1, day: S(q === 1 ? 12 : q - 1, q === 1 ? C - 1 : C) }), P = (C, q) => ({ year: q === 12 ? C + 1 : C, month: q === 12 ? 1 : q + 1, day: 1 }), o = (C) => ({ year: C - 1, month: 12, day: 31 }), O = (C) => ({ year: C + 1, month: 1, day: 1 }); function Y(C, q, se, ce, ve = "page") { ve === "page" ? (r.value = se || C, k.value = ce || q) : ve === "record" && (b.value = se || C, s.value = ce || q); } function A(C, q) { const { minDate: se, maxDate: ce, minYear: ve, maxYear: ge } = e, xe = se ? m(o(C), se) : !0, We = ce ? V(O(q), ce) : !0; Y(xe, We, C <= ve, q >= ge); } function _(C, q) { var ve, ge; const se = C || ((ve = c.value[0][1]) == null ? void 0 : ve.year), ce = q || ((ge = c.value[3][1]) == null ? void 0 : ge.year); se !== void 0 && ce !== void 0 && A(se, ce); } function Z(C, q) { const { minDate: se, maxDate: ce, minYear: ve, maxYear: ge } = e, xe = u(q, C), We = P(q, C), Pe = se ? m(xe, { year: se.year, month: se.month, day: se.day }) : !0, Ae = ce ? V(We, { year: ce.year, month: ce.month, day: ce.day }) : !0; Y(Pe, Ae, C === 1 && q === ve, C === 12 && q === ge, "record"), _(q, q); } function E(C) { const { minDate: q, maxDate: se, minYear: ce, maxYear: ve } = e, ge = q ? m(o(C), q) : !0, xe = se ? V(O(C), se) : !0; Y(ge, xe, C === ce, C === ve); } U(() => e.selectingMonth, (C, q) => { C && E(w.value.year); }), U(() => e.selectingYear, (C, q) => { C && _(); }), U(() => e.years, (C, q) => { c.value = C, v.value && _(); }), U(() => e.activeMonth, () => { const C = e.activeMonth; C && (w.value = { month: C.month, year: C.year, displayTextOfMonth: C.displayTextOfMonth, displayTextOfYear: C.displayTextOfYear }, !e.selectingMonth && !e.selectingYear ? Z(w.value.month, w.value.year) : e.selectingMonth ? E(w.value.year) : _()); }, { immediate: !0 }); const j = H(() => ({ "f-datepicker-header": !0, monthYearSelBarBorder: l.value || v.value })), L = H(() => ({ "f-datepicker-header-btn": !0, "f-datepicker-header-btn-disabled": r.value })), D = H(() => !l.value && !v.value), N = H(() => ({ "f-datepicker-header-btn": !0, "f-datepicker-header-btn-disabled": b.value })), W = H(() => ({ "f-datepicker-header-btn": !0, "f-datepicker-header-btn-disabled": s.value })), F = H(() => ({ "f-datepicker-header-btn": !0, "f-datepicker-header-btn-disabled": k.value })), G = H(() => ({ "f-datepicker-header-btn": !0, "f-datepicker-yearLabel": M.value, "f-datepicker-labelBtnNotEdit": !M.value })), ee = H(() => ({ "f-datepicker-header-btn": !0, "f-datepicker-monthLabel": p.value, "f-datepicker-labelBtnNotEdit": !p.value })), ne = H(() => { const C = a.value ? a.value.indexOf("yyyy") : 0, q = a.value ? a.value.indexOf("MM") : 0; return C > q ? "MM-yyyy" : "yyyy-MM"; }); function ie(C) { C.stopPropagation(), !r.value && t.emit("prePage"); } function X(C) { C.stopPropagation(), !b.value && t.emit("preRecord"); } function le(C) { C.stopPropagation(), t.emit("clickYear"); } function z(C) { C.stopPropagation(), t.emit("clickMonth"); } function te(C) { C.stopPropagation(), !s.value && t.emit("nextRecord"); } function oe(C) { C.stopPropagation(), !k.value && t.emit("nextPage"); } const he = H(() => { const C = {}; return T.value === "year" && (C.cursor = "default"), C; }); function ye() { return g("button", { type: "button", style: he.value, class: G.value, onClick: (C) => { M.value && le(C); }, tabindex: M.value ? "0" : "-1", disabled: T.value === "year" }, [v.value ? c.value.length > 3 ? c.value[0][1].year + " - " + c.value[3][1].year : "" : w.value.displayTextOfYear]); } function $() { return !v.value && T.value !== "month" && g("button", { type: "button", class: ee.value, onClick: (C) => { p.value && z(C); }, tabindex: p.value ? "0" : "-1" }, [w.value.displayTextOfMonth]); } const R = { opacity: 0.4, cursor: "default" }; return () => g("div", { class: j.value, style: "height:40px; overflow:hidden;" }, [g("div", { class: "f-datepicker-prev-btn" }, [g("button", { type: "button", class: L.value, style: r.value ? R : {}, onClick: ie }, [g("i", { class: "f-icon f-icon-arrow-double-60-left" }, null)]), D.value && g("button", { style: b.value ? R : {}, type: "button", "aria-label": d.value, class: N.value, onClick: X }, [g("i", { class: "f-icon f-icon-arrow-chevron-left" }, null)])]), g("div", { class: "f-datepicker-monthYearText" }, [ne.value === "yyyy-MM" ? [ye(), $()] : [$(), ye()]]), g("div", { class: "f-datepicker-next-btn" }, [D.value && g("button", { style: s.value ? R : {}, type: "button", "aria-label": h.value, class: W.value, onClick: te }, [g("i", { class: "f-icon f-icon-arrow-chevron-right" }, null)]), g("button", { style: k.value ? R : {}, type: "button", class: F.value, onClick: oe }, [g("i", { class: "f-icon f-icon-arrow-double-60-right" }, null)])])]); } }), Na = { 1: "一月", 2: "二月", 3: "三月", 4: "四月", 5: "五月", 6: "六月", 7: "七月", 8: "八月", 9: "九月", 10: "十月", 11: "十一月", 12: "十二月" }, zn = { locales: { type: Object, default: {} }, /** */ top: { type: Number, default: 0 }, /** */ left: { type: Number, default: 0 }, /** 位置 */ position: { type: String, default: "bottom" }, /** 是否允许日期范围 */ enablePeriod: { type: Boolean, default: !1 }, dateFormat: { type: String, default: "yyyy-MM-dd" }, valueFormat: { type: String, default: "yyyy-MM-dd" }, dates: { type: Array, default: [] }, /** 禁用日期 */ disableDates: { Type: Array, default: [] }, /** 禁用范围 */ disablePeriod: { Type: Array, default: [] }, /** 自...禁用 */ disableSince: { Type: Object, default: { year: 0, month: 0, day: 0 } }, /** 禁用特定日 */ disableWeekdays: { Type: Array, default: [] }, /** 禁用周末 */ disableWeekends: { Type: Boolean, default: !1 }, /** 到...禁用 */ disableUntil: { Type: Object, default: { year: 0, month: 0, day: 0 } }, /** 是否允许键盘定位 */ enableKeyboadNavigate: { type: Boolean, default: !0 }, /** 是否启用标记当前 */ enableMarkCurrent: { type: Boolean, default: !0 }, /** 每周第一天 */ firstDayOfTheWeek: { type: String, default: Le.Sunday }, /** 高亮日期 */ highlightDates: { Type: Array, default: [] }, /** 是否高亮周六 */ highlightSaturday: { Type: Boolean, default: !1 }, /** 是否高亮周日 */ highlightSunday: { Type: Boolean, default: !1 }, /** 最晚年限 */ maxYear: { Type: Number, default: 1e4 }, /** 最早年限 */ minYear: { Type: Number, default: 1 }, /** 模式;Embedded;popup; */ mode: { Type: String, default: "Embedded" }, /** 月份 */ months: { type: Array, default: [[]] }, /** 月份名称 */ nameOfMonths: { Type: Object, default: Na }, /** 二级日期 */ secondaryDates: { type: Array, default: [] }, /** 二级月份 */ secondaryMonths: { type: Array, default: [[]] }, /** 选择的时间*/ selectedDate: { type: Object, default: null }, /** 日期范围组件结束日期 */ selectedSecondDate: { type: Object, default: null }, /** 选择的月份 */ selectedMonth: { type: Object, default: null }, /** 选择周 */ selectedWeek: { type: Object, default: null }, /** 选择方式 */ selectMode: { type: String, default: "day" }, /** 显示第几周 */ showWeekNumber: { type: Boolean, default: !1 }, /** 每周标题 */ weekTitle: { type: String, default: "周" }, /** 年份 */ years: { Type: Array, default: [[]] }, /** 日期时间值 */ value: { type: String, default: null }, /** 是否展示时分秒 */ showTime: { type: Boolean, default: !1 }, inlineDateTime: { type: Boolean, default: !0 }, /** 启用快捷选择 */ enableQuickSelect: { type: Boolean, default: !1 }, hourStep: { type: Number, default: 1 }, minuteStep: { type: Number, default: 1 }, secondStep: { type: Number, default: 1 }, /** 默认时间 */ defaultTime: { type: String, default: null } }, Qn = { months: { Type: Array, default: [[]] }, enableMarkCurrent: { Type: Boolean, default: !1 }, enableKeyboadNavigate: { Type: Boolean, default: !0 }, enablePeriod: { Type: Boolean, default: !1 }, selected: { Type: Object, default: null }, selectedPeriod: { Type: Object, default: null }, selectMode: { Type: String, default: "day" } }, Gt = /* @__PURE__ */ Oe({ name: "FDatePickerMonthView", props: Qn, emits: ["click", "keyDown", "mouseEnter", "mouseLeave"], setup(e, t) { const d = f(e.months), h = f(e.enableMarkCurrent), a = f(e.enableKeyboadNavigate), r = f(e.enablePeriod), b = f(e.selected), s = f(e.selectedPeriod), { inPeriod: k, isInitializedDate: w, equalOrEarlier: c } = Be(), { getKeyCodeFromEvent: l } = ea(); U(() => e.months, () => { d.value = e.months; }), U(() => e.selected, () => { b.value = e.selected; }), U(() => e.selectedPeriod, (o) => { s.value = o; }); function v(o, O) { o.stopPropagation(), !O.disable && t.emit("click", O.date); } function T(o, O) { const Y = l(o); Y !== we.tab && (o.preventDefault(), Y === we.enter || Y === we.space ? v(o, O) : a.value && t.emit("keyDown", O)); } function M(o) { s.value && w(s.value.from) && !w(s.value.to) && (d.value.forEach((O) => { O.forEach((Y) => { Y.range = !!s.value && (c(s.value.from, Y.date) && c(Y.date, o.date) || c(Y.date, s.value.from) && c(o.date, Y.date)); }); }), t.emit("mouseEnter", o)); } function p() { d.value.forEach((o) => { o.forEach((O) => { O.range = !1; }); }), t.emit("mouseLeave"); } const V = (o, O) => o.year === O.year && o.month === O.month; function m(o) { return !!b.value && V(b.value, o); } function S(o) { return !!s.value && (V(s.value.from, o) || V(s.value.to, o)); } function u(o) { return k(o, s.value); } const P = (o) => ({ "f-datepicker-month-cell": !0, "f-datepicker-current": o.isCurrent && h.value, "f-datepicker-selected": (!r.value || e.selectMode === "week") && m(o.date) || r.value && S(o.date), "f-datepicker-disabled": o.disable, "f-datepicker-range": u({ ...o.date, day: 1 }) || o.range }); return () => g("div", { class: "f-datepicker-table-wrapper" }, [g("table", { class: "f-datepicker-table" }, [g("tbody", null, [d.value && d.value.map((o, O) => g("tr", null, [o.map((Y, A) => g("td", { id: `m_${O}_${A}`, class: `m_${O}_${A}`, onKeydown: (_) => T(_, Y), onMouseenter: () => M(Y), onMouseleave: () => p(), tabindex: "0", style: "width: 33.3%" }, [g("div", { class: "f-datepicker-month", onClick: (_) => v(_, Y) }, [g("span", { class: P(Y) }, [Y.displayText])])]))]))])])]); } }), Un = { years: { Type: Array, default: [[]] }, enableKeyboadNavigate: { Type: Boolean, default: !0 }, enableMarkCurrent: { Type: Boolean, default: !0 }, enablePeriod: { Type: Boolean, default: !1 }, selected: { Type: Object, default: null }, selectedPeriod: { Type: Object, default: null }, selectMode: { Type: String, default: "day" } }, Xt = /* @__PURE__ */ Oe({ name: "FDatePickerYearView", props: Un, emits: ["click", "keyDown", "mouseEnter", "mouseLeave"], setup(e, t) { const d = f(e.years), h = f(e.enableMarkCurrent), a = f(e.enableKeyboadNavigate), r = f(e.enablePeriod), b = f(e.selected), s = f(e.selectedPeriod), { equal: k, isInitializedDate: w, equalOrEarlier: c } = Be(), { getKeyCodeFromEvent: l } = ea(); U(() => e.years, () => { d.value = e.years; }), U(() => e.selected, () => { b.value = e.selected; }); const v = (o, O) => { const Y = `y_${o}_${O}`, A = { "f-datepicker-no-currmonth": o === 0 && O === 0 || o === 3 && O === 2 }; return A[Y] = !0, A; }; function T(o) { if (!s.value) return !1; const { from: O, to: Y } = s.value; return !w(Y) || !w(O) ? !1 : o != null && o.year && (O != null && O.year) && (Y != null && Y.year) ? o.year >= O.year && o.year <= Y.year : !1; } function M(o) { return !!b.value && k({ year: b.value.year }, o); } function p(o) { return !!s.value && (k({ year: s.value.from.year }, o) || k({ year: s.value.to.year }, o)); } const V = (o) => ({ "f-datepicker-year-cell": !0, "f-datepicker-current": o.isCurrent && h.value, "f-datepicker-selected": (!r.value || e.selectMode === "week") && M(o.date) || r.value && p(o.date), "f-datepicker-disabled": o.disable, "f-datepicker-range": T(o.date) || o.range }); function m(o, O) { o.stopPropagation(), !O.disable && t.emit("click", O); } function S(o, O) { const Y = l(o); Y !== we.tab && (o.preventDefault(), Y === we.enter || Y === we.space ? m(o, O) : a.value && t.emit("keyDown", O)); } function u(o) { s.value && w(s.value.from) && !w(s.value.to) && (d.value.forEach((O) => { O.forEach((Y) => { Y.range = !!s.value && (c(s.value.from, Y.date) && c(Y.date, o.date) || c(Y.date, s.value.from) && c(o.date, Y.date)); }); }), t.emit("mouseEnter", o)); } function P() { d.value.forEach((o) => { o.forEach((O) => { O.range = !1; }); }), t.emit("mouseLeave"); } return () => g("table", { class: "f-datepicker-table-wrapper" }, [g("tbody", { class: "f-datepicker-table" }, [d.value && d.value.map((o, O) => g("tr", null, [o.map((Y, A) => g("td", { id: "y_{yi}_{i}", class: v(O, A), onKeydown: (_) => S(_, Y), onMouseenter: () => u(Y), onMouseleave: () => P(), tabindex: "0" }, [g("div", { class: "f-datepicker-year", onClick: (_) => m(_, Y) }, [g("span", { class: V(Y) }, [Y.year])])]))]))])]); } }); function lt() { function e(a) { return new Date( a.year || 0, (a.month || 1) - 1, a.day, a.hour ? a.hour : 0, a.minute ? a.minute : 0, a.second ? a.second : 0, 0 ).getDay(); } function t(a) { if (!a) return 1; if (!/^\d+$/.test(a.value)) return -1; let r = Number(a.value); return (a.format.length === 1 && a.value.length !== 1 && r < 10 || a.format.length === 1 && a.value.length !== 2 && r >= 10 || a.format.length === 2 && a.value.length > 2) && (r = -1), r; } function d(a, r) { if (a.value) { for (let b = 1; b <= 12; b++) if (a.value.toLowerCase() === r[b].toLowerCase()) return b; } return -1; } function h(a) { const r = new Date(a.year || 0, (a.month || 1) - 1, a.day, 0, 0, 0, 0); return r.setDate(r.getDate() + (r.getDay() === 0 ? -3 : 4 - r.getDay())), Math.round((r.getTime() - new Date(r.getFullYear(), 0, 4).getTime()) / 864e5 / 7) + 1; } return { getNumberByValue: t, getDayNumber: e, getMonthNumberByMonthName: d, getWeekNumber: h }; } function Fa(e, t, d, h, a, r, b, s) { const { getTimeInMilliseconds: k, getWeekdayIndex: w } = Ce(), { isInitializedDate: c } = Be(), { getDayNumber: l } = lt(); function v(T) { if (T.year && T.year < e || T.year && T.year > t) return !0; const M = k(T), p = T.hour !== void 0; if (c(h) && (p ? M : M + 24 * 60 * 60 * 1e3 - 1) < k(h) || c(d) && M > k(d)) return !0; if (b) { const m = l(T); if (m === 0 || m === 6) return !0; } const V = l(T); return !!(s.length > 0 && s.find((S) => w(S) === V) || a.length > 0 && a.find((S) => (S.year === 0 || S.year === T.year) && (S.month === 0 || S.month === T.month) && S.day === T.day) || r.length > 0 && r.find((S) => c(S.from) && c(S.to) && M >= k(S.from) && M <= k(S.to))); } return { isDisabledDate: v }; } function Kn() { const { getDayNumber: e } = lt(); function t(h, a, r) { let b = []; b = a.reduce((k, w) => { const c = w.dates.map((l) => ({ date: l, color: w.color })); return [...k, ...c]; }, b); const s = b.find((k) => (k.date.year === 0 || k.date.year === h.year) && (k.date.month === 0 || k.date.month === h.month) && k.date.day === h.day); if (s) return { marked: !0, color: s.color }; if (r && r.marked) { const k = e(h); if (k === 0 || k === 6) return { marked: !0, color: r.color }; } return { marked: !1, color: "" }; } function d(h, a, r, b) { const s = e(h); return a && s === 0 || r && s === 6 ? !0 : !!b.find((w) => (w.year === 0 || w.year === h.year) && (w.month === 0 || w.month === h.month) && w.day === h.day); } return { isHighlightedDate: d, isMarkedDate: t }; } function Jn({ isDisabledDate: e }) { const { getToday: t } = Ce(), { daysInMonth: d, daysInPreMonth: h } = na(), { isHighlightedDate: a, isMarkedDate: r } = Kn(), { getWeekNumber: b } = lt(); function s(l) { const v = Ge.indexOf(l); return v > 0 ? 7 - v : 0; } function k(l, v, T) { const M = /* @__PURE__ */ new Date(); M.setDate(1), M.setMonth(v - 1), M.setFullYear(l); const p = M.getDay() + T; return p >= 7 ? p - 7 : p; } function w(l, v, T, M, p) { return l === p.day && v === p.month && T === p.year && M === Te.current; } function c(l, v, T, M, p, V, m, S, u) { const P = [], o = t(), O = k(v, l, s(T)), Y = d(l, v), A = h(l, v); let _ = 1, Z = Te.previous; for (let E = 1; E < 7; E++) { const j = []; if (E === 1) { const N = A - O + 1; for (let F = N; F <= A; F++) { const G = { year: l === 1 ? v - 1 : v, month: l === 1 ? 12 : l - 1, day: F }, ee = w(F, l, v, Z, o), ne = e(G), ie = r(G, M, p), X = a(G, S, m, V); j.push({ date: G, tag: Z, isCurrent: ee, disable: ne, marked: ie, highlight: X }); } Z = Te.current; const W = 7 - j.length; for (let F = 0; F < W; F++) { const G = { year: v, month: l, day: _ }, ee = w(_, l, v, Z, o), ne = e(G), ie = r(G, M, p), X = a(G, S, m, V); j.push({ date: G, tag: Z, isCurrent: ee, disable: ne, marked: ie, highlight: X }), _++; } } else for (let N = 1; N <= 7; N++) { _ > Y && (_ = 1, Z = Te.next); const W = { year: Z === Te.next && l === 12 ? v + 1 : v, month: Z === Te.current ? l : Z === Te.next && l < 12 ? l + 1 : 1, day: _ }, F = w(_, l, v, Z, o), G = e(W), ee = r(W, M, p), ne = a(W, S, m, V); j.push({ date: W, tag: Z, isCurrent: F, disable: G, marked: ee, highlight: ne }), _++; } const L = T === Le.Monday ? 0 : 6, D = b(j[L].date); P.push({ days: j, numberInTheYear: D, year: v }); } return P; } return { generateCalendar: c }; } function Gn() { const { getToday: e } = Ce(); function t(d, h, a, r, b, s) { const k = [], w = d - d % 10, { year: c, month: l } = h, v = e(), T = 3, M = w + 10; for (let p = w - 1; p < M; p += T) { const V = []; for (let m = p; m < p + T; m++) { const S = m < a || m > r; V.push({ year: m, isCurrent: m === v.year, selected: m === c, disable: S, date: { year: m } }); } k.push(V); } return k; } return { generateYears: t }; } function Xn() { function e(a, r, b) { const s = []; if (b) { let k = b[0]; b[0] !== b[1] && (k = b[0] + b[1], b[2] && b[1] !== b[2] && (k += b[2])); const w = new RegExp("[" + k + "]"), c = a.split(w), l = r.split(w); for (let v = 0; v < l.length; v++) l[v].indexOf("yyyy") !== -1 && (s[0] = { value: c[v], format: l[v] }), l[v].indexOf("M") !== -1 && (s[1] = c[v] === void 0 ? { value: "1", format: l[v] } : { value: c[v], format: l[v] }), l[v].indexOf("d") !== -1 && (s[2] = c[v] === void 0 ? { value: "1", format: l[v] } : { value: c[v], format: l[v] }); } else { const k = (r + "").indexOf("yyyy"), w = (r + "").indexOf("MM"), c = (r + "").indexOf("dd"); k >= 0 && (s[0] = { value: a.substring(k, k + 4), format: r.substring(k, k + 4) }), w >= 0 && (s[1] = { value: a.substring(w, w + 2), format: r.substring(w, w + 2) }), c >= 0 && (s[2] = { value: a.substring(c, c + 2), format: r.substring(c, c + 2) }); } return s; } function t(a) { return a < 10 ? "0" + Number(a) : String(a); } function d(a, r) { const b = a.match(/[^(DdMmYy)]{1,}/g), s = a.indexOf(r); return s < 0 ? a : s === 0 ? b ? a.substring(3) : a.substring(2) : s + 2 === a.length ? b ? a.substring(0, a.length - 3) : a.substring(0, a.length - 2) : b ? a.substring(0, s) + a.substring(s + 3) : a.substring(0, s) + a.substring(s + 2); } function h(a, r, b) { !a.month && r.indexOf("MM") === -1 && (r = d(r, "MM")), !a.day && r.indexOf("dd") === -1 && (r = d(r, "dd")); let s = r.replace("yyyy", String(a.year)); return r.indexOf("M") === -1 ? s = s.replace("MM", "01") : (r.indexOf("MMM") !== -1 && (s = s.replace("MMM", b[a.month || 1])), r.indexOf("MM") !== -1 ? s = s.replace("MM", t(a.month || 1)) : s = s.replace("M", String(a.month || 1))), r.indexOf("dd") === -1 ? s = s.replace("dd", "01") : r.indexOf("dd") !== -1 ? s = s.replace("dd", t(a.day || 1)) : s = s.replace("d", String(a.day || 1)), s = s.replace("MM", "mm").replace("HH", t(a.hour || 0)).replace("mm", t(a.minute || 0)).replace("ss", t(a.second || 0)), s && s.length > 2 ? s : ""; } return { getDateValue: e, formatDate: h, preZero: t, remove: d }; } function la(e) { const { displayFormat: t, minYear: d, maxYear: h, selectMode: a, valueFormat: r, showTime: b, periodDelimiter: s } = e, { emptyDate: k, getToday: w } = Ce(), { getDateValue: c, preZero: l } = Xn(), { getNumberByValue: v, getMonthNumberByMonthName: T, getWeekNumber: M } = lt(), { isInitializedDate: p, isDateEarlier: V } = Be(), { isDisabledDate: m } = Fa( e.minYear, e.maxYear, e.disableSince, e.disableUntil, e.disableDates, e.disablePeriod, e.disableWeekends, e.disableWeekdays ), S = f(e.nameOfMonths), u = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; function P() { const E = w(), j = E.year, L = E.month; switch (a) { case "month": return { startMonth: { month: 0, year: j }, endMonth: { month: 0, year: j + 1 } }; case "year": return { startMonth: { month: 0, year: j }, endMonth: { month: 0, year: j + 10 } }; default: { const D = { month: L, year: j }; let N = { month: L + 1, year: j }; return L >= 12 && (N = { month: 1, year: j + 1 }), { startMonth: D, endMonth: N }; } } } function o(E, j = !1) { let L = b, D = t, N = E; return j && (D = r.replace(/[年,月]/g, "-").replace(/[日]/, "").replace(/[时,分]/g, ":").replace(/[秒]/g, ""), N = N.replace(/[年,月]/g, "-").replace(/[日]/, "").replace(/[时,分]/g, ":").replace(/[秒]/g, ""), (N[N.length - 1] === "-" || N[N.length - 1] === ":") && (N = N.substring(0, N.length - 1)), !b && r.toLocaleLowerCase().indexOf("hh:mm") > -1 && (L = !0)), { actualFormat: D, shouldDisplayTime: L, targetDateString: N }; } function O(E, j = !1) { const L = { year: 0, month: 0, day: 0 }; if (!E) return L; const { actualFormat: D, shouldDisplayTime: N, targetDateString: W } = o(E, j), F = D.indexOf("MMM") !== -1; let G = W, ee = 0, ne = 0, ie = 0, X = D.match(/[^(DdMmYy)]{1,}/g); if (N && W) { G = W.split(" ")[0], Object.assign(L, { hour: 0, minute: 0, second: 0 }); const he = W.split(" ")[1]; if (he) { const ye = he.replace("时", ":").replace("分", ":").replace("秒", "").split(":"); ye[0] && (ee = Number(ye[0].substr(0, 2)), ee = isNaN(ee) ? 0 : ee), ye[1] && (ne = Number(ye[1].substr(0, 2)), ne = isNaN(ne) ? 0 : ne), ye[2] && (ie = Number(ye[2].substr(0, 2)), ie = isNaN(ie) ? 0 : ie); } else if (X = null, /^\d{1,}$/.test(W)) { const $ = D; G = W.substr(0, 8); let R = W.substr(8); R && ($.includes("HH") && R && (ee = +R.slice(0, 2), R = R.slice(2)), $.includes("mm") && R && (ne = +R.slice(0, 2), R = R.slice(2)), $.includes("ss") && R && (ie = +R.slice(0, 2))); } } else G = W ? W.split(" ")[0] : ""; const le = c(G, D, X), z = v(le[0]), te = F ? T(le[1], S.value) : v(le[1]), oe = v(le[2]); if (a === "year") return { year: z, month: 1, day: 1 }; if (te !== -1 && oe !== -1 && z !== -1) { if (z < d || z > h || te < 1 || te > 12) return L; const he = b ? { year: z, month: te, day: oe, hour: ee, minute: ne, second: ie } : { year: z, month: te, day: oe }; return m(he) || ((z % 400 === 0 || z % 100 !== 0 && z % 4 === 0) && (u[1] = 29), oe < 1 || oe > u[te - 1]) ? L : a === "month" ? { year: he.year, month: he.month } : a === "year" ? { year: he.year } : he; } return L; } function Y(E) { let j = { from: { year: 0, month: 0, day: 0 }, to: { year: 0, month: 0, day: 0 } }; if (E && E.length) { const L = E.split(s || "~"); if (L && L.length === 2) { const [D, N] = L; let W = D ? O(D, !0) : null, F = N ? O(N, !0) : null; if (!W && F && (W = { ...F }), !F && W && (F = { ...W }), !W && !F) return j; j = { from: W, to: F }; } } return j; } function A(E, j) { const { from: L, to: D } = E, N = p(L), W = p(D) && JSON.stringify(L) !== JSON.stringify(D); if (N && W) E.from = j, E.to = k(); else if (!N) E.from = j, !W && e.showTime && (E.to = j); else { if (V(j, L)) { const G = L; E.to = G, E.from = j; } else E.to = j; return { from: E.from, to: E.to, emit: !0 }; } return { from: E.from, to: E.to }; } function _(E) { const j = l(E.getHours()), L = l(E.getMinutes()), D = l(E.getSeconds()); return `${j}:${L}:${D}`; } function Z(E) { const j = Y(E), L = j.from, D = j.to; if (p(L) && p(D)) { const N = l(L.hour || 0), W = l(L.minute || 0), F = l(L.second || 0), G = `${N}:${W}:${F}`, ee = l(D.hour || 0), ne = l(D.minute || 0), ie = l(D.second || 0), X = `${ee}:${ne}:${ie}`, le = { year: L.year || 1, month: L.month || 1, displayTextOfMonth: S.value[L.month || "1"], displayTextOfYear: `${L.year}` }, z = { year: D.year || 1, month: D.month || 1, displayTextOfMonth: S.value[D.month || "1"], displayTextOfYear: `${D.year}` }; if (L.month === D.month && L.year === D.year) if (!E) z.month >= 12 ? (z.month = 1, z.year = z.year + 1) : (z.month = z.month + 1, a === "month" && (z.year = z.year + 1), z.displayTextOfMonth = S.value[z.month]); else { const ye = E.split("~"), $ = ye[0], R = ye[1]; !$ && R ? (le.month === 1 ? (le.year = le.year - 1, le.month = 12) : le.month = le.month - 1, le.displayTextOfMonth = S.value[le.month]) : (z.month === 12 ? (z.year = z.year + 1, z.month = 1) : z.month = z.month + 1, z.displayTextOfMonth = S.value[z.month]); } else a === "month" && L.year === D.year && (z.year = z.year + 1); z.displayTextOfYear = `${z.year}`; const te = e.firstDayOfTheWeek === Le.Sunday ? D : L, he = { numberInTheYear: M(te), year: te.year }; return { beginDateActiveMonth: le, endDateActiveMonth: z, dateRange: j, beginTime: G, endTime: X, selectedWeekInfo: he }; } return { dateRange: j }; } return { normalizeDate: O, normalizeDateRange: Y, setNewDateRange: A, getActiveMonth: Z, getTimeStr: _, getMonthAndYear: P }; } function Zn() { function e(t, d) { if (d === Le.Monday) { t.setDate(t.getDate() - (t.getDay() + 6) % 7); const h = { year: t.getFullYear(), month: t.getMonth() + 1, day: t.getDate() }; t.setDate(t.getDate() + 6); const a = { year: t.getFullYear(), month: t.getMonth() + 1, day: t.getDate() }; return { from: h, to: a }; } else { t.getDay() !== 0 && t.setDate(t.getDate() - t.getDay()); const h = { year: t.getFullYear(), month: t.getMonth() + 1, day: t.getDate() }; t.setDate(t.getDate() + 6 - t.getDay()); const a = { year: t.getFullYear(), month: t.getMonth() + 1, day: t.getDate() }; return { from: h, to: a }; } } return { getNowWeekTime: e }; } function Dt(e, t = 0) { return Xe(Qt(e, { weekStartsOn: t }), t ? 0 : 1); } function el(e, t) { const { locales: d } = e, { quickSelectors: h } = d, a = e.showTime ? Rn(Date.now()) : _n(), r = e.fir