import { defineComponent as ge, inject as le, reactive as ee, ref as pe, onMounted as Se, nextTick as ce, watch as ue, openBlock as Y, createElementBlock as E, createElementVNode as C, unref as me, createCommentVNode as X, toDisplayString as De, Fragment as he, renderList as ke, normalizeClass as ie, computed as fe, normalizeStyle as $e, withDirectives as Le, vShow as Re, createVNode as ye, provide as _e, createBlock as Ce, readonly as Ne, withCtx as Pe } from "vue";
import _ from "dayjs";
import { C as g } from "../Shared/base-PQGakkrl.js";
import { _ as Qe } from "../Shared/List.vue_vue_type_script_setup_true_lang-DzmylhZ6.js";
import { C as Ie } from "../Shared/index-BnerInzC.js";
import { u as Me } from "../Shared/language-DxTlvFs2.js";
import { _ as Oe } from "../Shared/Index.vue_vue_type_script_setup_true_lang-BxtgFrvB.js";
import Be from "../Element/ClButton.js";
const Fe = { class: "datetime-days" }, Ue = { class: "datetime-container" }, je = {
  class: "time-head time-head-day",
  colspan: "7"
}, Ze = { class: "time-prev" }, ze = ["title"], Ke = ["title"], We = { class: "time-next" }, qe = ["title"], Je = ["title"], Ge = ["onClick", "onMouseover"], Xe = /* @__PURE__ */ ge({
  name: "ClCalendarsDays",
  __name: "CalendarsDays",
  props: {
    viewValue: String,
    selectValue: String,
    startValue: String,
    endValue: String,
    hoverValue: String
  },
  emits: ["onChangeDate", "onChangeType", "onSelectDate", "onHoverDate", "onInitComplete"],
  setup(b, { emit: re }) {
    const v = b, D = re, { optPageLanguage: I, getPageLanguage: T } = Me();
    T("dataTime");
    const d = le("$DateTimeTop"), p = le("$DateTimeTopBase"), r = le("$DateTimeBase"), u = ee({
      keyIndex: d.keyIndex
    }), a = ee({
      isPrevYear: !1,
      isPrevMonth: !1,
      titleYear: "",
      titleMonth: "",
      isNextYear: !1,
      isNextMonth: !1
    }), l = pe([]), s = pe([]), t = {
      viewDate: null,
      selectDate: null,
      startDate: null,
      endDate: null,
      hoverDate: null
    }, j = () => {
      const i = t.viewDate.year(), x = t.viewDate.localeData().monthsShort(t.viewDate), w = t.viewDate.clone().subtract(1, "years").endOf("month"), M = r.checkDataMinMax(w, "day"), W = t.viewDate.clone().subtract(1, "months").endOf("month"), z = r.checkDataMinMax(W, "day"), F = t.viewDate.clone().add(1, "months").startOf("month"), U = r.checkDataMinMax(F, "day"), L = t.viewDate.clone().add(1, "years").startOf("month"), ne = r.checkDataMinMax(L, "day");
      a.isPrevYear = !M, a.isPrevMonth = !z, a.titleYear = `${i}${I.value.year}`, a.titleMonth = x, a.isNextMonth = !U, a.isNextYear = !ne;
    }, J = () => {
      const i = t.viewDate.localeData(), c = i.weekdaysMin(), x = i.firstDayOfWeek(), w = [];
      c.forEach((M, W) => {
        w[(7 + W - x) % 7] = M;
      }), l.value = w;
    }, G = () => {
      const i = t.viewDate.clone(), c = t.selectDate, x = i.year(), w = i.month();
      let M = i.clone().subtract(1, "months");
      const W = [];
      let z = [];
      M = M.date(M.daysInMonth()).startOf("week");
      for (let F = 0; F < 42; F += 1) {
        F > 0 && (M = M.add(1, "days"));
        const U = M.clone(), L = U.date(), ne = M.year() === x && M.month() < w || M.year() < x, se = M.year() === x && M.month() > w || M.year() > x;
        let ve = c && M.isSame(c, "day");
        const we = r.checkDataMinMax(U, "day");
        let e = !1, o = !1, m = !1;
        p.isRange && (t.hoverDate ? t.startDate ? (e = M.isSame(t.startDate, "day"), m = e || M.isSame(t.hoverDate, "day"), m = m || M.isAfter(t.startDate, "day") && M.isBefore(t.hoverDate, "day"), o = t.hoverDate.isSame(t.startDate, "day") && e) : t.endDate && (o = M.isSame(t.endDate, "day"), m = o || M.isSame(t.hoverDate, "day"), m = m || M.isAfter(t.hoverDate, "day") && M.isBefore(t.endDate, "day"), e = t.hoverDate.isSame(t.endDate, "day") && o) : (e = t.startDate && M.isSame(t.startDate, "day"), t.endDate && (o = M.isSame(t.endDate, "day"), m = e || o || M.isAfter(t.startDate, "day") && M.isBefore(t.endDate, "day"))), ve = e || o);
        const k = Ie.getAddClass("day", {
          old: ne,
          new: se,
          active: ve && !ne && !se,
          disabled: we,
          "date-start": e && !ne && !se,
          "date-end": o && !ne && !se,
          "range-in": m && !ne && !se
        });
        z.push({ cls: k, day: L, value: L, isDisabled: we, isOld: ne, isNew: se }), z.length === 7 && (W.push({ days: z }), z = []);
      }
      s.value = W;
    }, R = (i, c, x) => {
      const w = t.viewDate.clone()[i](c, x);
      D("onChangeDate", w);
    }, Z = (i, c, x) => {
      c !== x && (t[i] = d.getMomentDate(c), J(), j(), G());
    }, te = () => {
      g.isEmpty(v.viewValue) || (t.viewDate = d.getMomentDate(v.viewValue), t.selectDate = d.getMomentDate(v.selectValue), t.startDate = d.getMomentDate(v.startValue), t.endDate = d.getMomentDate(v.endValue), J(), j(), G(), ce(() => {
        D("onInitComplete", "days");
      }));
    };
    Se(() => {
      ce(() => {
        te();
      });
    }), ue(
      () => v.viewValue,
      (i, c) => {
        Z("viewDate", i, c);
      }
    ), ue(
      [() => v.selectValue, () => v.startValue, () => v.endValue, () => v.hoverValue],
      () => {
        t.selectDate = d.getMomentDate(v.selectValue), t.startDate = d.getMomentDate(v.startValue), t.endDate = d.getMomentDate(v.endValue), t.hoverDate = d.getMomentDate(v.hoverValue), J(), j(), G();
      }
    );
    const K = (i) => {
      i.preventDefault(), i.stopPropagation(), R("subtract", 1, "years");
    }, H = (i) => {
      i.preventDefault(), i.stopPropagation(), R("subtract", 1, "months");
    }, A = (i) => {
      i.preventDefault(), i.stopPropagation(), R("add", 1, "months");
    }, V = (i) => {
      i.preventDefault(), i.stopPropagation(), R("add", 1, "years");
    }, S = (i, c) => {
      i.preventDefault(), i.stopPropagation(), D("onChangeType", c);
    }, O = (i, c) => {
      i.preventDefault(), i.stopPropagation(), c.isDisabled || D("onSelectDate", "days", c);
    }, h = (i, c) => {
      i.preventDefault(), i.stopPropagation(), c.isDisabled || D("onHoverDate", "days", c);
    };
    return (i, c) => (Y(), E("div", Fe, [
      C("table", Ue, [
        C("thead", null, [
          C("tr", null, [
            C("th", je, [
              C("span", Ze, [
                a.isPrevYear ? (Y(), E("span", {
                  key: 0,
                  class: "prev-year",
                  title: me(I).prevYear,
                  onClick: K
                }, [...c[2] || (c[2] = [
                  C("i", { class: "clIconFont clIcon-angle-double-left" }, null, -1)
                ])], 8, ze)) : X("", !0),
                a.isPrevMonth ? (Y(), E("span", {
                  key: 1,
                  class: "prev-month",
                  title: me(I).prevMonth,
                  onClick: H
                }, [...c[3] || (c[3] = [
                  C("i", { class: "clIconFont clIcon-angle-left" }, null, -1)
                ])], 8, Ke)) : X("", !0)
              ]),
              C("span", {
                class: "datetime-switch-year",
                onClick: c[0] || (c[0] = (x) => S(x, "years"))
              }, De(a.titleYear), 1),
              C("span", {
                class: "datetime-switch-month",
                onClick: c[1] || (c[1] = (x) => S(x, "months"))
              }, De(a.titleMonth), 1),
              C("span", We, [
                a.isNextYear ? (Y(), E("span", {
                  key: 0,
                  class: "next-year",
                  title: me(I).nextYear,
                  onClick: V
                }, [...c[4] || (c[4] = [
                  C("i", { class: "clIconFont clIcon-angle-double-right" }, null, -1)
                ])], 8, qe)) : X("", !0),
                a.isNextMonth ? (Y(), E("span", {
                  key: 1,
                  class: "next-month",
                  title: me(I).nextMonth,
                  onClick: A
                }, [...c[5] || (c[5] = [
                  C("i", { class: "clIconFont clIcon-angle-right" }, null, -1)
                ])], 8, Je)) : X("", !0)
              ])
            ])
          ]),
          C("tr", null, [
            (Y(!0), E(he, null, ke(l.value, (x, w) => (Y(), E("th", {
              key: `${u.keyIndex}-week-${w}`
            }, De(x), 1))), 128))
          ])
        ]),
        C("tbody", null, [
          (Y(!0), E(he, null, ke(s.value, (x, w) => (Y(), E("tr", {
            key: `${u.keyIndex}-days-${w}`
          }, [
            (Y(!0), E(he, null, ke(x.days, (M, W) => (Y(), E("td", {
              key: `${u.keyIndex}-day-${W}`,
              class: ie(M.cls),
              onClick: (z) => O(z, M),
              onMouseover: (z) => h(z, M)
            }, De(M.day), 43, Ge))), 128))
          ]))), 128))
        ])
      ])
    ]));
  }
}), et = { class: "datetime-months" }, tt = { class: "datetime-container" }, at = { class: "time-head time-head-month" }, nt = { class: "time-prev" }, st = ["title"], ot = { class: "time-next" }, it = ["title"], lt = { class: "time-body-month" }, rt = ["onClick", "onMouseover"], ct = /* @__PURE__ */ ge({
  name: "ClCalendarsMonths",
  __name: "CalendarsMonths",
  props: {
    viewValue: String,
    selectValue: String,
    startValue: String,
    endValue: String,
    hoverValue: String
  },
  emits: ["onChangeDate", "onChangeType", "onSelectDate", "onHoverDate", "onInitComplete"],
  setup(b, { emit: re }) {
    const v = b, D = re, { optPageLanguage: I, getPageLanguage: T } = Me();
    T("dataTime");
    const d = le("$DateTimeTop"), p = le("$DateTimeTopBase"), r = le("$DateTimeBase"), u = ee({
      keyIndex: d.keyIndex
    }), a = ee({
      isPrevYear: !1,
      titleYear: "",
      isNextYear: !1
    }), l = pe([]), s = {
      viewDate: null,
      selectDate: null,
      startDate: null,
      endDate: null,
      hoverDate: null
    }, t = () => {
      const V = s.viewDate.year(), S = s.viewDate.clone().subtract(1, "years").endOf("year"), O = r.checkDataMinMax(S, "month"), h = s.viewDate.clone().add(1, "years").startOf("year"), i = r.checkDataMinMax(h, "month");
      a.isPrevYear = !O, a.titleYear = `${V}${I.value.year}`, a.isNextYear = !i;
    }, j = () => {
      const V = s.viewDate.clone(), S = r.getFocusDate(), O = s.selectDate, h = V.year(), i = [];
      V.localeData().monthsShort().forEach((c, x) => {
        const w = r.getViewMin(h, x);
        let M = O && w.isSame(O, "month"), W = w.isSame(S, "month");
        const z = r.checkDataMinMax(w, "month");
        let F = !1, U = !1, L = !1;
        p.isRange && (W = !1, s.hoverDate ? s.startDate ? (F = w.isSame(s.startDate, "month"), L = F || w.isSame(s.hoverDate, "month"), L = L || w.isAfter(s.startDate, "month") && w.isBefore(s.hoverDate, "month"), U = !1) : s.endDate && (U = w.isSame(s.endDate, "month"), L = U || w.isSame(s.hoverDate, "month"), L = L || w.isAfter(s.hoverDate, "month") && w.isBefore(s.endDate, "month"), F = !1) : (F = s.startDate && w.isSame(s.startDate, "month"), s.endDate && (U = w.isSame(s.endDate, "month"), L = w.isAfter(s.startDate, "month") && w.isBefore(s.endDate, "month"))), M = F || U), p.layerType === "months" && (W = !1);
        const ne = Ie.getAddClass("month", {
          active: M,
          focused: W,
          disabled: z,
          "date-start": F,
          "date-end": U,
          "range-in": L
        });
        i.push({ cls: ne, month: c, isDisabled: z, value: x });
      }), l.value = i;
    }, J = (V, S, O) => {
      const h = s.viewDate.clone()[V](S, O);
      D("onChangeDate", h);
    }, G = (V, S, O) => {
      S !== O && (s[V] = d.getMomentDate(S), t(), j());
    }, R = () => {
      s.viewDate = d.getMomentDate(v.viewValue), s.selectDate = d.getMomentDate(v.selectValue), s.startDate = d.getMomentDate(v.startValue), s.endDate = d.getMomentDate(v.endValue), t(), j(), ce(() => {
        D("onInitComplete", "months");
      });
    };
    Se(() => {
      ce(() => {
        R();
      });
    }), ue(
      () => v.viewValue,
      (V, S) => {
        G("viewDate", V, S);
      }
    ), ue(
      [() => v.selectValue, () => v.startValue, () => v.endValue, () => v.hoverValue],
      () => {
        s.selectDate = d.getMomentDate(v.selectValue), s.startDate = d.getMomentDate(v.startValue), s.endDate = d.getMomentDate(v.endValue), s.hoverDate = d.getMomentDate(v.hoverValue), t(), j();
      }
    );
    const Z = (V) => {
      V.preventDefault(), V.stopPropagation(), J("subtract", 1, "years");
    }, te = (V) => {
      V.preventDefault(), V.stopPropagation(), J("add", 1, "years");
    }, K = (V, S) => {
      V.preventDefault(), V.stopPropagation(), D("onChangeType", S);
    }, H = (V, S) => {
      V.preventDefault(), V.stopPropagation(), S.isDisabled || D("onSelectDate", "months", S);
    }, A = (V, S) => {
      V.preventDefault(), V.stopPropagation(), S.isDisabled || D("onHoverDate", "months", S);
    };
    return (V, S) => (Y(), E("div", et, [
      C("table", tt, [
        C("thead", null, [
          C("tr", null, [
            C("th", at, [
              C("span", nt, [
                a.isPrevYear ? (Y(), E("span", {
                  key: 0,
                  class: "prev-year",
                  title: me(I).prevYear,
                  onClick: Z
                }, [...S[1] || (S[1] = [
                  C("i", { class: "clIconFont clIcon-angle-left" }, null, -1)
                ])], 8, st)) : X("", !0)
              ]),
              C("span", {
                class: "datetime-switch-year",
                onClick: S[0] || (S[0] = (O) => K(O, "years"))
              }, De(a.titleYear), 1),
              C("span", ot, [
                a.isNextYear ? (Y(), E("span", {
                  key: 0,
                  class: "next-year",
                  title: me(I).nextYear,
                  onClick: te
                }, [...S[2] || (S[2] = [
                  C("i", { class: "clIconFont clIcon-angle-right" }, null, -1)
                ])], 8, it)) : X("", !0)
              ])
            ])
          ])
        ]),
        C("tbody", null, [
          C("tr", null, [
            C("td", lt, [
              C("div", null, [
                (Y(!0), E(he, null, ke(l.value, (O, h) => (Y(), E("span", {
                  key: `${u.keyIndex}-month-${h}`,
                  class: ie(O.cls),
                  onClick: (i) => H(i, O),
                  onMouseover: (i) => A(i, O)
                }, De(O.month), 43, rt))), 128))
              ])
            ])
          ])
        ])
      ])
    ]));
  }
}), ut = { class: "datetime-years" }, mt = { class: "datetime-container" }, dt = { class: "time-head time-head-year" }, Dt = { class: "time-prev" }, ft = ["title"], ht = { class: "" }, yt = { class: "time-next" }, pt = ["title"], gt = { class: "time-body-year" }, vt = ["onClick", "onMouseover"], Vt = /* @__PURE__ */ ge({
  name: "ClCalendarsYears",
  __name: "CalendarsYears",
  props: {
    viewValue: String,
    selectValue: String,
    startValue: String,
    endValue: String,
    hoverValue: String
  },
  emits: ["onChangeDate", "onChangeType", "onSelectDate", "onHoverDate", "onInitComplete"],
  setup(b, { emit: re }) {
    const v = b, D = re, { optPageLanguage: I, getPageLanguage: T } = Me();
    T("dataTime");
    const d = le("$DateTimeTop"), p = le("$DateTimeTopBase"), r = le("$DateTimeBase"), u = ee({
      keyIndex: d.keyIndex
    }), a = ee({
      isPrevYear: !1,
      titleYear: "",
      isNextYear: !1
    }), l = pe([]), s = {
      startYear: 0,
      viewDate: null,
      selectDate: null,
      startDate: null,
      endDate: null,
      hoverDate: null
    }, t = () => {
      const V = `${s.startYear}-${s.startYear + 9}`, S = d.getMomentDate({ year: s.startYear - 1, month: 11 }).endOf("month"), O = r.checkDataMinMax(S, "year"), h = d.getMomentDate({ year: s.startYear + 10, month: 0 }).startOf("month"), i = r.checkDataMinMax(h, "year");
      a.isPrevYear = !O, a.titleYear = V, a.isNextYear = !i;
    }, j = () => {
      const V = r.getFocusDate(), S = s.selectDate, O = [];
      for (let h = -1; h < 11; h += 1) {
        const i = s.startYear + h, c = r.getViewMin(i), x = h === -1, w = h > 9;
        let M = S && c.isSame(S, "year"), W = c.isSame(V, "year");
        const z = r.checkDataMinMax(c, "year");
        let F = !1, U = !1, L = !1;
        if (p.isRange) {
          if (W = !1, s.hoverDate) {
            const se = parseInt(s.hoverDate.format("YYYY"), 10);
            s.startDate ? (F = i === parseInt(s.startDate.format("YYYY"), 10), L = F || i === se, L = L || c.isAfter(s.startDate, "year") && c.isBefore(s.hoverDate, "year"), U = !1) : s.endDate && (U = i === parseInt(s.endDate.format("YYYY"), 10), L = U || i === se, L = L || c.isAfter(s.hoverDate, "year") && c.isBefore(s.endDate, "year"), F = !1);
          } else
            F = s.startDate && c.isSame(s.startDate, "year"), s.endDate && (U = c.isSame(s.endDate, "year"), L = c.isAfter(s.startDate, "year") && c.isBefore(s.endDate, "year"));
          M = F || U;
        }
        p.layerType === "years" && (W = !1);
        const ne = Ie.getAddClass("year", {
          old: x,
          new: w,
          active: M && !x && !w,
          focused: W,
          disabled: z,
          "date-start": F && !x && !w,
          "date-end": U && !x && !w,
          "range-in": L && !x && !w
        });
        O.push({ cls: ne, year: i, isDisabled: z, value: i });
      }
      l.value = O;
    }, J = () => {
      s.startYear = parseInt((s.viewDate.year() / 10).toString(), 10) * 10, t(), j();
    }, G = (V, S, O) => {
      const h = s.viewDate.clone()[V](S, O);
      D("onChangeDate", h);
    }, R = (V, S, O) => {
      S !== O && (s[V] = d.getMomentDate(S), J());
    }, Z = () => {
      s.viewDate = d.getMomentDate(v.viewValue), s.selectDate = d.getMomentDate(v.selectValue), s.startDate = d.getMomentDate(v.startValue), s.endDate = d.getMomentDate(v.endValue), J(), ce(() => {
        D("onInitComplete", "years");
      });
    };
    Se(() => {
      ce(() => {
        Z();
      });
    }), ue(
      () => v.viewValue,
      (V, S) => {
        R("viewDate", V, S);
      }
    ), ue(
      [() => v.selectValue, () => v.startValue, () => v.endValue, () => v.hoverValue],
      () => {
        s.selectDate = d.getMomentDate(v.selectValue), s.startDate = d.getMomentDate(v.startValue), s.endDate = d.getMomentDate(v.endValue), s.hoverDate = d.getMomentDate(v.hoverValue), J();
      }
    );
    const te = (V) => {
      V.preventDefault(), V.stopPropagation(), G("subtract", 10, "years");
    }, K = (V) => {
      V.preventDefault(), V.stopPropagation(), G("add", 10, "years");
    }, H = (V, S) => {
      V.preventDefault(), V.stopPropagation(), S.isDisabled || D("onSelectDate", "years", S);
    }, A = (V, S) => {
      V.preventDefault(), V.stopPropagation(), S.isDisabled || D("onHoverDate", "years", S);
    };
    return (V, S) => (Y(), E("div", ut, [
      C("table", mt, [
        C("thead", null, [
          C("tr", null, [
            C("th", dt, [
              C("span", Dt, [
                a.isPrevYear ? (Y(), E("span", {
                  key: 0,
                  class: "prev-year",
                  title: me(I).prevYear10,
                  onClick: te
                }, [...S[0] || (S[0] = [
                  C("i", { class: "clIconFont clIcon-angle-left" }, null, -1)
                ])], 8, ft)) : X("", !0)
              ]),
              C("span", ht, De(a.titleYear), 1),
              C("span", yt, [
                a.isNextYear ? (Y(), E("span", {
                  key: 0,
                  class: "next-year",
                  title: me(I).nextYear10,
                  onClick: K
                }, [...S[1] || (S[1] = [
                  C("i", { class: "clIconFont clIcon-angle-right" }, null, -1)
                ])], 8, pt)) : X("", !0)
              ])
            ])
          ])
        ]),
        C("tbody", null, [
          C("tr", null, [
            C("td", gt, [
              (Y(!0), E(he, null, ke(l.value, (O, h) => (Y(), E("span", {
                key: `${u.keyIndex}-year-${h}`,
                class: ie(O.cls),
                onClick: (i) => H(i, O),
                onMouseover: (i) => A(i, O)
              }, De(O.year), 43, vt))), 128))
            ])
          ])
        ])
      ])
    ]));
  }
}), kt = { class: "datetime-container" }, St = { class: "times-container" }, wt = ["title"], Ct = ["title"], Mt = { class: "times-clock" }, bt = { class: "clock-nums" }, xt = ["onClick"], Tt = { class: "clock-pointer" }, Yt = { class: "clock-am" }, $t = /* @__PURE__ */ ge({
  name: "ClCalendarsClocks",
  __name: "CalendarsClock",
  props: {
    selectDay: String,
    selectValue: String,
    minValue: String,
    maxValue: String,
    isShowPointer: {
      type: Boolean,
      default: !0
    },
    isShowSubmit: {
      type: Boolean,
      default: !1
    },
    isShowCancel: {
      type: Boolean,
      default: !1
    },
    isClickOverlay: {
      type: Boolean,
      default: !1
    }
  },
  emits: ["onSubmit", "onInitComplete"],
  setup(b, { emit: re }) {
    const v = b, D = re, { optPageLanguage: I, getPageLanguage: T } = Me();
    T("dataTime");
    const d = le("$DateTimeTop"), p = le("$DateTimeTopBase"), r = ee({
      keyIndex: d.keyIndex,
      isOpen: !1,
      activePointer: "hour",
      activeAm: "am"
    }), u = ee({
      hour: !0,
      hourAdd: !0,
      hourSub: !0,
      hourDisabled: !1,
      minute: !0,
      minuteAdd: !0,
      minuteSub: !0,
      minuteDisabled: !1,
      minuteShowAddSub: !0,
      second: !0,
      secondAdd: !0,
      secondSub: !0,
      secondDisabled: !1
    }), a = ee({
      hour: -90,
      hourMinute: 0,
      minute: -90,
      minuteSecond: 0,
      second: -90
    }), l = ee({
      hour: "00",
      minute: "00",
      second: "00"
    }), s = pe([]), t = {
      selectDayDate: null,
      minDate: null,
      maxDate: null,
      timeAngle: { hour: 30, minute: 6, second: 6 },
      num: {
        hourAm: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
        hourPm: [12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],
        minute: [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55],
        second: [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55]
      },
      origValue: {
        hour: "00",
        minute: "00",
        second: "00"
      },
      lastValue: {
        hour: "00",
        minute: "00",
        second: "00"
      },
      isCheckMin: !1,
      checkMinDiff: null,
      min: {
        hour: 0,
        minute: 0,
        second: 0
      },
      isCheckMax: !1,
      checkMaxDiff: null,
      max: {
        hour: 0,
        minute: 0,
        second: 0
      }
    }, j = fe(() => {
      const n = { "datetime-times": !0 };
      return n["times-open"] = r.isOpen, n;
    }), J = fe(() => {
      const n = { "pointer-hour": !0 };
      return n["pointer-active"] = r.activePointer === "hour", n["pointer-disabled"] = u.hourDisabled, n;
    }), G = fe(() => {
      const n = { "pointer-minute": !0 };
      return n["pointer-active"] = r.activePointer === "minute", n["pointer-disabled"] = u.minuteDisabled, n;
    }), R = fe(() => {
      const n = { "pointer-second": !0 };
      return n["pointer-active"] = r.activePointer === "second", n["pointer-disabled"] = u.secondDisabled, n;
    }), Z = fe(() => {
      const n = { "am-am": !0 };
      return n["am-active"] = r.activeAm === "am", n;
    }), te = fe(() => {
      const n = { "am-pm": !0 };
      return n["am-active"] = r.activeAm === "pm", n;
    }), K = fe(() => {
      const n = { "clock-set": !0, "clock-set-hour": !0 };
      return n["clock-set-active"] = r.activePointer === "hour", n["clock-set-disabled"] = u.hourDisabled, n;
    }), H = fe(() => {
      const n = { "clock-set": !0, "clock-set-minute": !0 };
      return n["clock-set-active"] = r.activePointer === "minute", n["clock-set-disabled"] = u.minuteDisabled, n;
    }), A = fe(() => {
      const n = { "clock-set": !0, "clock-set-second": !0 };
      return n["clock-set-active"] = r.activePointer === "second", n["clock-set-disabled"] = u.secondDisabled, n;
    }), V = (n, f) => {
      t[n] = d.getMomentDate(f);
    }, S = (n) => {
      let f = parseInt(t.lastValue[n], 10), y = parseInt(l[n], 10), P = 0;
      return n === "hour" ? (y === 0 && f === 23 && (y = 24), f === 0 && y === 23 && (f = 24), y - f > 6 && (f += 12), f - y >= 6 && (y += 12), P = y - f) : (y - f > 30 && (f += 60), f - y >= 30 && (y += 60), P = y - f), P;
    }, O = (n) => {
      const y = S(n) * t.timeAngle[n];
      return a[n] + (y >= 360 ? y % 360 : y);
    }, h = () => {
      const n = O("hour"), f = t.timeAngle.hour * parseFloat((parseInt(l.minute, 10) / 60).toString()), y = O("minute"), P = t.timeAngle.second * parseFloat((parseInt(l.second, 10) / 60).toString()), Q = O("second");
      a.hour = n, a.hourMinute = f, a.minute = y, a.minuteSecond = P, a.second = Q;
    }, i = (n) => parseInt(n, 10) < 12 ? "am" : "pm", c = (n, f) => {
      let y = !0;
      switch (n) {
        case "hour":
          y = !0;
          break;
        case "minute":
          y = parseInt(l.hour, 10) === t[f].hour;
          break;
        case "second":
          y = parseInt(l.hour, 10) === t[f].hour && parseInt(l.minute, 10) === t[f].minute;
          break;
      }
      return y;
    }, x = (n, f) => {
      let y = !1;
      return t.isCheckMin && (t.checkMinDiff === 0 ? c(n, "min") && (y = f < t.min[n]) : t.checkMinDiff < 0 && (y = !0)), !y && t.isCheckMax && (t.checkMaxDiff === 0 ? c(n, "max") && (y = f > t.max[n]) : t.checkMaxDiff > 0 && (y = !0)), y;
    }, w = (n) => {
      let f = n;
      f === "hour" && (f = r.activeAm === "am" ? "hourAm" : "hourPm");
      const y = u[`${n}Disabled`], P = [];
      t.num[f].forEach((Q, ae) => {
        const oe = { num: Q, cls: "clock-num", isDisabled: !1 };
        oe.cls += ` clock-num${ae + 1} `, oe.isDisabled = y ? !0 : x(n, Q), oe.isDisabled && (oe.cls += " clock-nums-disabled "), P.push(oe);
      }), s.value = P;
    }, M = (n) => {
      r.activePointer = n, n === "hour" && (r.activeAm = i(l.hour)), w(n);
    }, W = (n) => {
      let f = null;
      if (!g.isUndefined(n) && !g.isUndefined(t.selectDayDate)) {
        const y = t.selectDayDate.clone().format("YYYY-MM-DD 00:00:00"), P = n.clone().format("YYYY-MM-DD 00:00:00");
        f = d.Dayjs(y).diff(d.Dayjs(P));
      }
      return f;
    }, z = () => {
      a.hour = -90, a.hourMinute = 0, a.minute = -90, a.minuteSecond = 0, a.second = -90, t.lastValue = { hour: "00", minute: "00", second: "00" }, h(), ce(() => {
        const n = l.hour, f = l.minute, y = l.second;
        t.lastValue = { hour: n, minute: f, second: y }, t.origValue = { hour: n, minute: f, second: y };
      });
    }, F = (n, f) => {
      t.lastValue.hour = l.hour, t.lastValue.minute = l.minute, t.lastValue.second = l.second, l[n] = g.getFillZero(f), h(), v.isShowSubmit || D("onSubmit", `${l.hour}:${l.minute}:${l.second}`);
    }, U = (n) => {
      let f = 0, y = 0, P = 0;
      if (!g.isEmpty(n)) {
        const Q = (g.isEmpty(t.selectDayDate) ? d.getNow() : t.selectDayDate).format("YYYY-MM-DD"), ae = d.getMomentDate(`${Q} ${n}`);
        f = ae.hour(), y = ae.minute(), P = ae.second();
      }
      return { HH: f, mm: y, ss: P };
    }, L = () => {
      let f = !0, y = !0;
      const P = g.isEmpty(t.selectDayDate), Q = U(v.selectValue), ae = Q.HH, oe = Q.mm, Ae = Q.ss;
      switch (p.layerType) {
        case "hours":
          f = !1, y = !1;
          break;
        case "minutes":
          y = !1;
          break;
      }
      t.isCheckMin = !g.isUndefined(t.minDate), t.isCheckMin && (t.checkMinDiff = d.checkIsTimes() ? 0 : W(t.minDate), t.min = {
        hour: t.minDate.hour(),
        minute: t.minDate.minute(),
        second: t.minDate.second()
      }), t.isCheckMax = !g.isUndefined(t.maxDate), t.isCheckMax && (t.checkMaxDiff = d.checkIsTimes() ? 0 : W(t.maxDate), t.max = {
        hour: t.maxDate.hour(),
        minute: t.maxDate.minute(),
        second: t.maxDate.second()
      });
      const Ye = g.getFillZero(ae);
      let xe = g.getFillZero(oe), Te = g.getFillZero(Ae);
      f || (xe = "00"), y || (Te = "00"), t.lastValue = { hour: Ye, minute: xe, second: Te }, t.origValue = { hour: Ye, minute: xe, second: Te }, u.hour = !0, u.minute = f, u.second = y, l.hour = Ye, l.minute = xe, l.second = Te, d.checkIsTimes() || (u.hourDisabled = P, u.minuteDisabled = P, u.secondDisabled = P), p.layerType === "hours" && (u.minute = !0, u.minuteDisabled = !0, u.minuteShowAddSub = !1);
    }, ne = () => {
      r.isOpen = v.isShowPointer, V(
        "selectDayDate",
        d.checkIsTimes() ? d.Dayjs().format("YYYY-MM-DD") : v.selectDay
      ), V("minDate", d.getValueEffective(v.minValue)), V("maxDate", d.getValueEffective(v.maxValue)), L(), M("hour"), z(), ce(() => {
        D("onInitComplete", "times");
      });
    };
    ue(
      () => v.selectDay,
      (n, f) => {
        V("selectDayDate", n), L();
      }
    ), ue(
      () => v.minValue,
      (n, f) => {
        const y = d.getValueEffective(n);
        V("minDate", y), L();
      }
    ), ue(
      () => v.maxValue,
      (n, f) => {
        const y = d.getValueEffective(n);
        V("maxDate", y), L();
      }
    ), ue(
      () => v.selectValue,
      (n, f) => {
        const y = U(n), P = g.getFillZero(y.HH), Q = g.getFillZero(y.mm), ae = g.getFillZero(y.ss);
        (l.hour !== P || l.minute !== Q || l.second !== ae) && (l.hour = P, l.minute = Q, l.second = ae);
      }
    ), Se(() => {
      ce(() => {
        ne();
      });
    });
    const se = (n) => {
      u[n] && !u[`${n}Disabled`] && (M(n), r.isOpen || (z(), r.isOpen = !0));
    }, ve = (n) => {
      if (!n.isDisabled) {
        const f = r.activePointer, y = parseInt(l[f], 10), P = parseInt(n.num, 10);
        P !== y && F(f, P);
      }
    }, we = (n) => {
      r.activeAm = n, r.activePointer = "hour", w("hour");
    }, e = (n) => {
      let f = !1;
      return u[n] && !u[`${n}Disabled`] && (r.isOpen ? f = !0 : (z(), r.isOpen = !0, M(n))), f;
    }, o = (n, f) => {
      if (u[n] && !u[`${n}Disabled`] && r.isOpen) {
        let y = !0, P = 0, Q = n === "hour" ? 23 : 59;
        if (t.isCheckMin && (t.checkMinDiff === 0 ? c(n, "min") && (P = t.min[n]) : t.checkMinDiff < 0 && (y = !1)), t.isCheckMax && (t.checkMaxDiff === 0 ? c(n, "max") && (Q = t.max[n]) : t.checkMaxDiff > 0 && (y = !1)), y) {
          const ae = parseInt(l[n], 10);
          let oe = 0;
          f === "add" ? oe = ae < P || ae >= Q ? P : ae + 1 : oe = ae > Q || ae <= P ? Q : ae - 1, x(n, oe) || (F(n, oe), M(n));
        }
      }
    }, m = () => e("hour"), k = (n) => (g.isEmpty(n.type) || o("hour", n.type), { value: l.hour, subtractDisabled: !1, addDisabled: !1 }), $ = () => e("minute"), B = (n) => (g.isEmpty(n.type) || o("minute", n.type), { value: l.minute, subtractDisabled: !1, addDisabled: !1 }), N = () => e("second"), q = (n) => (g.isEmpty(n.type) || o("second", n.type), { value: l.second, subtractDisabled: !1, addDisabled: !1 }), de = () => {
      v.isClickOverlay && (d.checkIsTimes() || (r.isOpen = !1), D("onSubmit", `${l.hour}:${l.minute}:${l.second}`));
    }, Ve = () => {
      d.checkIsTimes() || (r.isOpen = !1), D("onSubmit", `${l.hour}:${l.minute}:${l.second}`);
    }, be = () => {
      (l.hour !== t.origValue.hour || l.minute !== t.origValue.minute || l.second !== t.origValue.second) && (t.lastValue.hour = l.hour, t.lastValue.minute = l.minute, t.lastValue.second = l.second, l.hour = t.origValue.hour, l.minute = t.origValue.minute, l.second = t.origValue.second, h()), d.checkIsTimes() ? D("onSubmit", `${l.hour}:${l.minute}:${l.second}`) : r.isOpen = !1;
    };
    return (n, f) => (Y(), E("div", {
      class: ie(j.value)
    }, [
      f[13] || (f[13] = C("div", { class: "datetime-times-inner" }, null, -1)),
      C("div", kt, [
        C("div", St, [
          C("div", {
            class: "times-overlay",
            onClick: de
          }),
          b.isShowCancel ? (Y(), E("div", {
            key: 0,
            class: "times-cancel",
            title: me(I).common.cancel,
            onClick: be
          }, [...f[11] || (f[11] = [
            C("i", { class: "clIconFont clIcon-close" }, null, -1)
          ])], 8, wt)) : X("", !0),
          b.isShowSubmit ? (Y(), E("div", {
            key: 1,
            class: "times-submit",
            title: me(I).common.submit,
            onClick: Ve
          }, [...f[12] || (f[12] = [
            C("i", { class: "clIconFont clIcon-check" }, null, -1)
          ])], 8, Ct)) : X("", !0),
          C("div", Mt, [
            C("div", bt, [
              (Y(!0), E(he, null, ke(s.value, (y, P) => (Y(), E("div", {
                key: `${r.keyIndex}-clock-${P}`,
                class: ie(y.cls),
                onClick: (Q) => ve(y)
              }, De(y.num), 11, xt))), 128))
            ]),
            C("div", Tt, [
              u.hour ? (Y(), E("div", {
                key: 0,
                class: ie(J.value),
                onClick: f[0] || (f[0] = (y) => se("hour")),
                style: $e({ transform: `rotate(${a.hour + a.hourMinute}deg)` })
              }, null, 6)) : X("", !0),
              u.minute ? (Y(), E("div", {
                key: 1,
                class: ie(G.value),
                onClick: f[1] || (f[1] = (y) => se("minute")),
                style: $e({ transform: `rotate(${a.minute + a.minuteSecond}deg)` })
              }, null, 6)) : X("", !0),
              u.second ? (Y(), E("div", {
                key: 2,
                class: ie(R.value),
                onClick: f[2] || (f[2] = (y) => se("second")),
                style: $e({ transform: `rotate(${a.second}deg)` })
              }, null, 6)) : X("", !0)
            ]),
            Le(C("div", Yt, [
              C("small", {
                class: ie(Z.value),
                onClick: f[3] || (f[3] = (y) => we("am"))
              }, De(me(I).am), 3),
              C("small", {
                class: ie(te.value),
                onClick: f[4] || (f[4] = (y) => we("pm"))
              }, De(me(I).pm), 3)
            ], 512), [
              [Re, r.activePointer === "hour"]
            ])
          ])
        ]),
        u.hour ? (Y(), E("div", {
          key: 0,
          class: ie(K.value),
          onClick: f[6] || (f[6] = (y) => se("hour"))
        }, [
          ye(Oe, {
            value: l.hour,
            "onUpdate:value": f[5] || (f[5] = (y) => l.hour = y),
            size: "small",
            isClean: !1,
            disabled: u.hourDisabled,
            isTextRead: !0,
            fillZeroCount: 2,
            isLoop: !0,
            btnTheme: "upDown",
            operateBtnDownBeforeCallback: m,
            calculationOperateValueCallback: k
          }, null, 8, ["value", "disabled"])
        ], 2)) : X("", !0),
        u.minute && u.minuteShowAddSub ? (Y(), E("div", {
          key: 1,
          class: ie(H.value),
          onClick: f[8] || (f[8] = (y) => se("minute"))
        }, [
          ye(Oe, {
            value: l.minute,
            "onUpdate:value": f[7] || (f[7] = (y) => l.minute = y),
            size: "small",
            isClean: !1,
            disabled: u.minuteDisabled,
            isTextRead: !0,
            fillZeroCount: 2,
            isLoop: !0,
            btnTheme: "upDown",
            operateBtnDownBeforeCallback: $,
            calculationOperateValueCallback: B
          }, null, 8, ["value", "disabled"])
        ], 2)) : X("", !0),
        u.second ? (Y(), E("div", {
          key: 2,
          class: ie(A.value),
          onClick: f[10] || (f[10] = (y) => se("second"))
        }, [
          ye(Oe, {
            value: l.second,
            "onUpdate:value": f[9] || (f[9] = (y) => l.second = y),
            size: "small",
            isClean: !1,
            disabled: u.secondDisabled,
            isTextRead: !0,
            fillZeroCount: 2,
            isLoop: !0,
            btnTheme: "upDown",
            operateBtnDownBeforeCallback: N,
            calculationOperateValueCallback: q
          }, null, 8, ["value", "disabled"])
        ], 2)) : X("", !0)
      ])
    ], 2));
  }
}), Ee = /* @__PURE__ */ ge({
  name: "ClCalendarsBase",
  __name: "CalendarsBase",
  props: {
    viewValue: String,
    selectValue: String,
    startValue: String,
    endValue: String,
    hoverValue: String,
    minValue: String,
    maxValue: String
  },
  emits: ["onSelectDate", "onChangeViewValue", "onHoverDate", "onChangeViewType", "onSelectTime", "onInitComplete"],
  setup(b, { emit: re }) {
    const v = b, D = re, I = le("$DateTimeTop"), T = le("$DateTimeTopBase"), d = ee({
      currentView: "",
      viewValue: "",
      selectValue: "",
      selectClockDay: "",
      selectClockTime: ""
    }), p = ee({
      isShow: !1,
      isViewDay: !1,
      isViewSubmitDisplay: !0,
      isShowClockPointer: !1,
      isShowClockSubmit: !1,
      isShowClockCancel: !1,
      isClockClickOverlay: !1
    }), r = {
      viewDate: null,
      selectDate: null,
      focusDate: null,
      minDate: null,
      maxDate: null
    }, u = (h, i) => {
      r[h] = I.getMomentDate(i);
    }, a = (h) => {
      const i = Object.keys(h);
      g.isExistValue(i, "viewValue") && T.layerView === h.currentView && D("onChangeViewValue", h.viewValue), i.forEach((c) => {
        g.isExistJsonKey(d, c) && d[c] !== h[c] && (d[c] = h[c]), g.isExistJsonKey(r, c) && (r[c] = h[c]);
      });
    }, l = (h, i) => {
      let c = !1;
      return g.isEmpty(r.minDate) || (c = I.Dayjs(h).isBefore(r.minDate, i)), !c && !g.isEmpty(r.maxDate) && (c = I.Dayjs(h).isAfter(r.maxDate, i)), c;
    }, s = (h, i) => {
      let c = 0, x = 1;
      if (g.isEmpty(r.minDate))
        i && (c = i);
      else {
        const w = h === r.minDate.year();
        let M = !0;
        g.isUndefined(i) ? c = w ? r.minDate.month() : 0 : (M = i === r.minDate.month(), c = i), x = w && M ? r.minDate.date() : 1;
      }
      return I.getMomentDate({ year: h, month: c, day: x });
    }, t = (h) => {
      let i = "";
      switch (h) {
        case "days":
          i = "days";
          break;
        case "months":
          i = "days";
          break;
        case "years":
          i = "months";
          break;
        default:
          i = "days";
          break;
      }
      return i;
    }, j = (h) => {
      const c = (h || r.selectDate.clone()).format("YYYY-MM-DD") + " " + (g.isEmpty(d.selectClockTime) ? "00:00:00" : d.selectClockTime);
      return I.Dayjs(c);
    }, J = (h, i) => {
      let c;
      const x = r.viewDate.clone(), w = parseInt(i.value, 10);
      switch (h) {
        case "days":
        case "datetimes": {
          let M = 0;
          i.isNew ? M = 1 : i.isOld && (M = -1), c = x.month(x.month() + M).date(w);
          break;
        }
        case "months": {
          const M = r.selectDate || x;
          c = x.month(w).date(M.date());
          break;
        }
        case "years":
          c = x.month(0).date(1).year(w);
          break;
      }
      return j(c);
    }, G = () => {
      d.viewValue = r.viewDate.format(T.formatIn), r.focusDate = r.viewDate.clone();
    }, R = (h) => {
      u("selectDate", h === "-1" ? "" : h);
      const i = r.selectDate ? r.selectDate.format("YYYY-MM-DD") : "";
      d.selectValue = i, d.selectClockDay = i, d.selectClockTime = r.selectDate ? r.selectDate.format("HH:mm:ss") : "", p.isViewSubmitDisplay = g.isEmpty(h);
    }, Z = () => {
      let h = !1, i = !1, c = !1, x = !1, w = !1, M = !1;
      d.currentView === "times" ? (h = !0, c = !0, M = !1, x = T.isDefault && T.isShowPopup, w = T.isDefault && T.isShowPopup, T.layerType === "hours" && (w = !1, x = !1)) : d.currentView === "days" && (i = T.timeType === "datetime", i && (w = !0, x = !0, c = !1, M = !0)), p.isShow = h, p.isViewDay = i, p.isShowClockPointer = c, p.isShowClockSubmit = x, p.isShowClockCancel = w, p.isClockClickOverlay = M;
    }, te = () => {
      d.currentView = T.layerView, r.viewDate = I.getViewDate(v.viewValue), G(), R(v.selectValue), u("minDate", v.minValue), u("maxDate", v.maxValue), Z();
    };
    Se(() => {
      ce(() => {
        te();
      });
    }), ue(
      () => v.viewValue,
      (h, i) => {
        r.viewDate = I.getViewDate(h), G();
      }
    ), ue(
      () => v.selectValue,
      (h, i) => {
        const c = T.isRange && h === "-1";
        let x = h;
        const w = d.selectClockTime;
        c && (x = ""), R(x), c && (d.selectClockTime = w);
      }
    ), ue(
      () => v.minValue,
      (h, i) => {
        u("minDate", h);
      }
    ), ue(
      () => v.maxValue,
      (h, i) => {
        u("maxDate", h);
      }
    );
    const K = (h) => {
      a({
        currentView: d.currentView,
        viewDate: h.clone(),
        viewValue: h.format(T.formatIn)
      });
    }, H = (h) => {
      d.currentView = h, r.focusDate = r.viewDate.clone(), Z();
    }, A = (h, i) => {
      const c = J(h, i), x = c.format("YYYY-MM-DD"), w = {};
      T.layerView === h ? (w.selectDate = c, w.selectValue = x, T.isRange || (w.selectClockDay = x), a(w), D("onSelectDate", x)) : (w.viewDate = c.clone().startOf("month"), w.viewValue = x, w.currentView = t(h), a(w), Z(), D("onChangeViewType", w.currentView));
    }, V = (h, i) => {
      const c = J(h, i);
      D("onHoverDate", c);
    }, S = (h) => {
      a({ selectClockTime: h }), D("onSelectTime", h);
    }, O = (h) => {
      T.layerView === h && D("onInitComplete", h);
    };
    return _e("$DateTimeBase", {
      checkDataMinMax: l,
      getViewMin: s,
      getFocusDate: () => r.focusDate && r.focusDate.clone()
    }), (h, i) => (Y(), E("div", null, [
      d.currentView === "days" ? (Y(), Ce(Xe, {
        key: 0,
        viewValue: d.viewValue,
        selectValue: d.selectValue,
        startValue: b.startValue,
        endValue: b.endValue,
        hoverValue: b.hoverValue,
        onOnChangeDate: K,
        onOnChangeType: H,
        onOnSelectDate: A,
        onOnHoverDate: V,
        onOnInitComplete: O
      }, null, 8, ["viewValue", "selectValue", "startValue", "endValue", "hoverValue"])) : d.currentView === "months" ? (Y(), Ce(ct, {
        key: 1,
        viewValue: d.viewValue,
        selectValue: d.selectValue,
        startValue: b.startValue,
        endValue: b.endValue,
        hoverValue: b.hoverValue,
        onOnChangeDate: K,
        onOnChangeType: H,
        onOnSelectDate: A,
        onOnHoverDate: V,
        onOnInitComplete: O
      }, null, 8, ["viewValue", "selectValue", "startValue", "endValue", "hoverValue"])) : d.currentView === "years" ? (Y(), Ce(Vt, {
        key: 2,
        viewValue: d.viewValue,
        selectValue: d.selectValue,
        startValue: b.startValue,
        endValue: b.endValue,
        hoverValue: b.hoverValue,
        onOnChangeDate: K,
        onOnChangeType: H,
        onOnSelectDate: A,
        onOnHoverDate: V,
        onOnInitComplete: O
      }, null, 8, ["viewValue", "selectValue", "startValue", "endValue", "hoverValue"])) : X("", !0),
      p.isShow || p.isViewDay ? (Y(), E("div", {
        key: 3,
        class: ie({ "datetime-days-times": p.isViewDay })
      }, [
        ye($t, {
          selectDay: d.selectClockDay,
          selectValue: d.selectClockTime,
          minValue: b.minValue,
          maxValue: b.maxValue,
          isShowPointer: p.isShowClockPointer,
          isShowSubmit: p.isShowClockSubmit,
          isShowCancel: p.isShowClockCancel,
          isClickOverlay: p.isClockClickOverlay,
          onOnSubmit: S,
          onOnInitComplete: O
        }, null, 8, ["selectDay", "selectValue", "minValue", "maxValue", "isShowPointer", "isShowSubmit", "isShowCancel", "isClickOverlay"])
      ], 2)) : X("", !0)
    ]));
  }
}), Ot = /* @__PURE__ */ ge({
  name: "ClDatetimeDefault",
  __name: "DateTimeDefault",
  props: {
    value: String,
    minValue: String,
    maxValue: String
  },
  emits: ["onSelectValue", "onInitComplete"],
  setup(b, { expose: re, emit: v }) {
    const D = b, I = v, { optPageLanguage: T, getPageLanguage: d } = Me();
    d("dataTime");
    const p = le("$DateTimeTop"), r = le("$DateTimeTopBase"), u = ee({
      isShowSubmit: !1,
      isSubmitDisplay: !1
    }), a = ee({
      day: "",
      time: ""
    }), l = () => {
      const H = p.getMergeDayTime(a.day, a.time), A = p.checkValue(H);
      u.isSubmitDisplay = g.isEmpty(a.day) || A.errMsg.length > 0;
    }, s = (H) => {
      let A = !1;
      r.isShowPopup && r.timeType === "datetime" && (A = H === "days"), u.isShowSubmit = A;
    }, t = (H) => {
      let A = "", V = "", S = !0;
      if (H && !g.isEmpty(H)) {
        const O = p.getMomentDate(H);
        O && (A = O.format("YYYY-MM-DD"), V = O.format("HH:mm:ss"), S = !1);
      }
      a.day = A, a.time = V, u.isSubmitDisplay = S, l();
    }, j = () => {
      s(r.layerView), t(D.value);
    };
    ue(
      () => D.value,
      (H, A) => {
        H !== A && t(H);
      }
    ), Se(() => {
      ce(() => {
        j();
      });
    });
    const J = (H) => {
      a.day = H;
      const A = g.isEmpty(H);
      u.isSubmitDisplay = A, A || l(), r.timeType === "date" && I("onSelectValue", p.getMomentDate(p.getMergeDayTime(a.day, a.time)));
    }, G = (H) => {
      a.time = H, l(), r.timeType === "time" && I("onSelectValue", p.getMomentDate(p.getMergeDayTime(a.day, a.time)));
    }, R = (H) => {
      s(H);
    }, Z = () => {
      u.isShowSubmit && !u.isSubmitDisplay && I("onSelectValue", p.getMomentDate(p.getMergeDayTime(a.day, a.time)));
    }, te = () => {
      I("onInitComplete");
    };
    return re({
      getValue: () => {
        const H = p.getMergeDayTime(a.day, a.time);
        return p.getMomentDate(H);
      }
    }), (H, A) => (Y(), E(he, null, [
      ye(Ee, {
        selectValue: b.value,
        viewValue: b.value,
        minValue: b.minValue,
        maxValue: b.maxValue,
        onOnSelectDate: J,
        onOnSelectTime: G,
        onOnChangeViewType: R,
        onOnInitComplete: te
      }, null, 8, ["selectValue", "viewValue", "minValue", "maxValue"]),
      u.isShowSubmit ? (Y(), E("div", {
        key: 0,
        class: ie({ "datetime-days-submit": !0, "days-submit-disabled": u.isSubmitDisplay }),
        onClick: Z
      }, [
        C("span", null, De(me(T).common.submit), 1)
      ], 2)) : X("", !0)
    ], 64));
  }
}), _t = { class: "panel-range-calendar" }, Et = { class: "calendar-range calendar-left" }, It = { class: "calendar-text" }, Pt = { class: "time-input-base" }, Bt = ["value", "name"], Ht = { class: "calendar-panel" }, At = { class: "calendar-range calendar-right" }, Lt = { class: "calendar-text" }, Rt = { class: "time-input-base" }, Nt = ["value", "name"], Qt = { class: "calendar-panel" }, Ft = { class: "calendar-range calendar-quick" }, Ut = ["onClick"], jt = {
  key: 0,
  class: "panel-quick-btn"
}, Zt = /* @__PURE__ */ ge({
  name: "ClDateTimeRange",
  __name: "DateTimeRange",
  props: {
    startValue: String,
    endValue: String,
    minValue: String,
    maxValue: String,
    rangeQuick: {
      type: Array,
      default: () => []
    }
  },
  emits: ["onSubmit", "onCancel", "onInitComplete"],
  setup(b, { expose: re, emit: v }) {
    const D = b, I = v, { optPageLanguage: T, getPageLanguage: d } = Me();
    d("dataTime");
    const p = le("$DateTimeTop"), r = le("$DateTimeTopBase"), u = ee({
      keyIndex: p.keyIndex,
      operateViewDataType: "",
      selectCount: 0,
      hoverValue: "",
      activeQuick: "",
      isCheck: !0,
      isShowQuickBtn: r.isShowPopup
    }), a = ee({
      view: "",
      text: "",
      name: `input_${g.getRandom(8)}`
    }), l = ee({
      view: "",
      text: "",
      name: `input_${g.getRandom(8)}`
    }), s = ee({
      day: "",
      time: "",
      value: ""
    }), t = ee({
      day: "",
      time: "",
      value: ""
    }), j = pe([]), J = {
      initCount: 0
    }, G = (e, o) => {
      const m = p.getViewDate(e), k = r.layerView === "years" ? 10 : 1;
      return m[o](k, u.operateViewDataType).format(r.formatIn);
    }, R = (e, o) => {
      if (g.isEmpty(e))
        return "";
      const m = o === "right" ? r.formatOutEnd : r.formatOut;
      return g.isString(e) ? p.getMomentDate(e).format(m) : e.format(m);
    }, Z = () => {
      const e = p.getMergeDayTime(s.day, s.time);
      s.value = e, a.text = R(e, "left");
    }, te = () => {
      const e = p.getMergeDayTime(t.day, t.time);
      t.value = e, l.text = R(e, "right");
    }, K = () => {
      if (u.selectCount === 2) {
        let e = "-1";
        if (!g.isEmpty(s.day) && !g.isEmpty(t.day) && !g.isEmpty(j.value)) {
          const o = "YYYY-MM-DD";
          let m = p.getMomentDate(s.day, o), k = p.getMomentDate(t.day, o);
          switch (r.layerType) {
            case "years":
              m = p.getMomentDate(
                m.startOf("year").format(o),
                o
              ), k = p.getMomentDate(k.endOf("year").format(o), o);
              break;
            case "months":
              m = p.getMomentDate(
                m.startOf("month").format(o),
                o
              ), k = p.getMomentDate(k.endOf("month").format(o), o);
              break;
          }
          j.value.forEach(($) => {
            $.start && $.end && m.isSame($.start.format(o)) && k.isSame($.end.format(o)) && (e = $.id);
          });
        }
        u.activeQuick = e;
      }
    }, H = (e) => {
      const o = s.value, m = t.value, k = g.isEmpty(o), $ = g.isEmpty(m), B = !k && $, N = k && !$;
      let q = !1, de = !1;
      if (B || N) {
        const Ve = p.getMomentDate(B ? o : m);
        q = e.isBefore(Ve, "day"), de = e.isSame(Ve, "day");
      }
      return { isStart: B, isEnd: N, isBefore: q, isSame: de };
    }, A = (e) => {
      if (u.selectCount === 1) {
        const o = e.format("YYYY-MM-DD"), m = s.day, k = t.day, $ = H(e);
        if (u.hoverValue = o, $.isBefore) {
          s.day = "", Z(), t.day = $.isStart ? m : k, te();
          const B = p.getMergeDayTime(o, s.time);
          a.text = R(B, "left");
          const N = p.getMergeDayTime(
            $.isStart ? m : k,
            t.time
          );
          l.text = R(N, "right");
        } else {
          s.day = $.isEnd ? k : m, Z(), t.day = "", te();
          const B = p.getMergeDayTime(
            $.isEnd ? k : m,
            s.time
          );
          a.text = R(B, "left");
          const N = p.getMergeDayTime(o, t.time);
          l.text = R(N, "right");
        }
      }
    }, V = (e) => {
      switch (u.selectCount) {
        case 0:
        case 2: {
          u.selectCount = 1, s.day = e, Z(), t.day = "", t.value = "", l.text = R(p.getMergeDayTime(e, t.time), "right"), u.hoverValue = e;
          break;
        }
        case 1: {
          u.selectCount = 2;
          const o = H(p.getMomentDate(e));
          o.isSame ? (s.day = e, Z(), t.day = e, te()) : o.isBefore ? (s.day = e, Z()) : (t.day = e, te()), u.hoverValue = "";
          break;
        }
      }
      u.selectCount === 2 && (K(), u.isShowQuickBtn || I("onSubmit", { start: s.value, end: t.value }));
    }, S = (e, o) => {
      const m = p.getMomentDate(o), k = m ? m.format("YYYY-MM-DD") : "", $ = m ? m.format("HH:mm:ss") : "", B = m ? p.getMergeDayTime(k, $) : "";
      e ? (s.day = k, s.time = $, s.value = B, a.text = R(B, "left")) : (t.day = k, t.time = $, t.value = B, l.text = R(B, "right"));
    }, O = () => {
      let e = "";
      switch (r.layerType) {
        case "days":
          e = "months";
          break;
        case "months":
          e = "years";
          break;
        case "years":
          e = "years";
          break;
        default:
          e = "months";
      }
      u.operateViewDataType = e;
      let o = 0;
      const m = D.startValue || "", k = D.endValue || "", $ = !g.isEmpty(m), B = !g.isEmpty(k);
      if ($ && B ? o = 2 : o = $ || B ? 1 : 0, u.selectCount = o, a.view = p.getViewDate(m).format(r.formatIn), l.view = G(a.view, "add"), S(!0, m), S(!1, k), r.timeType === "time") {
        u.selectCount = 2;
        let q = "";
        switch (r.layerType) {
          case "hours":
            q = "00:00";
            break;
          case "minutes":
            q = "00:00";
            break;
          case "seconds":
            q = "00:00:00";
            break;
        }
        g.isEmpty(a.text) && S(!0, p.getValueEffective(q)), g.isEmpty(l.text) && S(!1, p.getValueEffective(q));
      }
      const N = g.getListClone(D.rangeQuick);
      N.length > 0 && N.push({ id: "-1", text: T.value.common.custom }), j.value = N;
    }, h = () => {
      O(), K();
    };
    Se(() => {
      ce(() => {
        h();
      });
    });
    const i = () => {
      if (u.selectCount === 2) {
        const e = p.checkValue(s.value, t.value);
        u.isCheck = e.errMsg.length === 0;
      }
    }, c = (e) => {
      a.view = e, l.view = G(e, "add");
    }, x = (e) => {
      V(e), i();
    }, w = (e) => {
      s.time = e, Z(), i();
    }, M = (e) => {
      A(e);
    }, W = (e) => {
      a.view = G(e, "subtract"), l.view = e;
    }, z = (e) => {
      V(e), i();
    }, F = (e) => {
      t.time = e, te(), i();
    }, U = (e) => {
      A(e);
    }, L = (e) => {
      if (e.id !== "-1") {
        let o = e.start.format("YYYY-MM-DD"), m = e.end.format("YYYY-MM-DD");
        const k = p.checkMinMax(o, m, "YYYY-MM-DD");
        !k.isStartMax || !k.isEndMin || (k.isStartMin || (o = k.minDay), k.isStartMax || (o = k.maxDay), k.isEndMin || (m = k.minDay), k.isEndMax || (m = k.maxDay), s.day = o, Z(), t.day = m, te(), a.view = o, l.view = G(o, "add"), u.hoverValue = "", u.selectCount = 2, u.activeQuick = e.id, r.timeType === "datetime" ? i() : u.isShowQuickBtn || I("onSubmit", { start: s.value, end: t.value }));
      }
    }, ne = () => {
      u.selectCount === 2 && I("onSubmit", { start: s.value, end: t.value });
    }, se = () => {
      I("onCancel");
    }, ve = () => {
      J.initCount += 1, J.initCount === 2 && I("onInitComplete");
    };
    return re({
      getValue: () => ({ start: s.value, end: t.value })
    }), (e, o) => (Y(), E("div", _t, [
      C("div", Et, [
        C("div", It, [
          C("div", Pt, [
            C("input", {
              class: "form-control time-input",
              type: "text",
              readonly: !0,
              value: a.text,
              name: a.name
            }, null, 8, Bt),
            o[0] || (o[0] = C("i", { class: "clIconFont clIcon-calendar time-icon" }, null, -1))
          ])
        ]),
        C("div", Ht, [
          ye(Ee, {
            selectValue: u.selectCount === 2 ? s.value : "-1",
            startValue: s.value,
            endValue: t.value,
            viewValue: a.view,
            hoverValue: u.hoverValue,
            minValue: b.minValue,
            maxValue: b.maxValue,
            onOnChangeViewValue: c,
            onOnSelectDate: x,
            onOnSelectTime: w,
            onOnHoverDate: M,
            onOnInitComplete: ve
          }, null, 8, ["selectValue", "startValue", "endValue", "viewValue", "hoverValue", "minValue", "maxValue"])
        ])
      ]),
      C("div", At, [
        C("div", Lt, [
          C("div", Rt, [
            C("input", {
              class: "form-control time-input",
              type: "text",
              readonly: !0,
              value: l.text,
              name: l.name
            }, null, 8, Nt),
            o[1] || (o[1] = C("i", { class: "clIconFont clIcon-calendar time-icon" }, null, -1))
          ])
        ]),
        C("div", Qt, [
          ye(Ee, {
            selectValue: u.selectCount === 2 ? t.value : "-1",
            startValue: s.value,
            endValue: t.value,
            viewValue: l.view,
            hoverValue: u.hoverValue,
            minValue: b.minValue,
            maxValue: b.maxValue,
            onOnChangeViewValue: W,
            onOnSelectDate: z,
            onOnSelectTime: F,
            onOnHoverDate: U,
            onOnInitComplete: ve
          }, null, 8, ["selectValue", "startValue", "endValue", "viewValue", "hoverValue", "minValue", "maxValue"])
        ])
      ]),
      C("div", Ft, [
        C("ul", null, [
          (Y(!0), E(he, null, ke(j.value, (m, k) => (Y(), E("li", {
            key: `${u.keyIndex}-rang-${k}`,
            class: ie({ active: m.id === u.activeQuick, "calendar-quick-special": m.id === "-1" }),
            onClick: ($) => L(m)
          }, De(m.text), 11, Ut))), 128))
        ]),
        u.isShowQuickBtn ? (Y(), E("div", jt, [
          ye(Be, {
            className: "quick-submit",
            label: me(T).common.submit,
            size: "small",
            disabled: u.selectCount !== 2 || !u.isCheck,
            onOnClick: ne
          }, null, 8, ["label", "disabled"]),
          ye(Be, {
            className: "quick-cancel",
            label: me(T).common.cancel,
            size: "small",
            color: "grayLight",
            onOnClick: se
          }, null, 8, ["label"])
        ])) : X("", !0)
      ])
    ]));
  }
}), zt = {
  key: 3,
  class: "datetime-errmsg"
}, He = /* @__PURE__ */ ge({
  name: "ClDateTimeBase",
  __name: "DateTimeBase",
  props: {
    isDefault: {
      type: Boolean,
      default: !1
    },
    isRange: {
      type: Boolean,
      default: !1
    },
    start: String,
    end: String,
    minDate: String,
    maxDate: String,
    rangeQuick: {
      type: Array,
      default: () => []
    },
    errMsg: {
      type: Array,
      default: () => []
    }
  },
  emits: ["onSelectValue", "onClose", "onInitComplete"],
  setup(b, { expose: re, emit: v }) {
    const D = v, I = le("$DateTimeTop"), T = pe(null), d = ee({
      optKeyIndex: I.keyIndex
    }), p = (l) => {
      D("onSelectValue", l);
    }, r = () => {
      D("onClose");
    }, u = () => {
      D("onInitComplete");
    };
    return re({
      getValue: () => T.value ? T.value.getValue() : ""
    }), (l, s) => (Y(), E(he, null, [
      b.isDefault ? (Y(), Ce(Ot, {
        key: 0,
        ref_key: "refEl",
        ref: T,
        value: b.start,
        minValue: b.minDate,
        maxValue: b.maxDate,
        onOnSelectValue: p,
        onOnInitComplete: u
      }, null, 8, ["value", "minValue", "maxValue"])) : b.isRange ? (Y(), Ce(Zt, {
        key: 1,
        ref_key: "refEl",
        ref: T,
        rangeQuick: b.rangeQuick,
        minValue: b.minDate,
        maxValue: b.maxDate,
        startValue: b.start,
        endValue: b.end,
        onOnSubmit: p,
        onOnCancel: r,
        onOnInitComplete: u
      }, null, 8, ["rangeQuick", "minValue", "maxValue", "startValue", "endValue"])) : (Y(), E(he, { key: 2 }, [], 64)),
      b.errMsg.length > 0 ? (Y(), E("ul", zt, [
        (Y(!0), E(he, null, ke(b.errMsg, (t, j) => (Y(), E("li", {
          key: `${d.optKeyIndex}-err-${j}`
        }, De(t), 1))), 128))
      ])) : X("", !0)
    ], 64));
  }
}), aa = /* @__PURE__ */ ge({
  name: "ClDatetime",
  __name: "Index",
  props: {
    value: String,
    className: String,
    placeholder: String,
    disabled: {
      type: Boolean,
      default: !1
    },
    theme: {
      type: String,
      default: "default"
      // default | range
    },
    layerType: {
      type: String,
      default: "days"
      // years|months|days|hours|minutes|seconds
    },
    timeType: {
      type: String,
      default: "date"
      // date|time|datetime
    },
    format: String,
    formatEnd: String,
    direction: {
      type: String,
      default: "left"
      // left|right
    },
    minDate: String,
    maxDate: String,
    isClear: {
      type: Boolean,
      default: !1
    },
    rangeQuick: {
      type: Array,
      default: () => []
    },
    isDropdown: {
      type: Boolean,
      default: !0
    },
    checkCallback: Function,
    themeStyle: {
      type: String,
      default: "default"
      // default noBorder
    },
    arrowDirection: {
      type: String,
      default: "right"
      // left|right
    },
    isUseDropdownArrow: {
      type: Boolean,
      default: !0
    }
  },
  emits: ["update:value", "onChange", "onInit"],
  setup(b, { expose: re, emit: v }) {
    const D = b, I = v, { optPageLanguage: T, getPageLanguage: d } = Me();
    d("dataTime");
    const p = pe(null), r = pe(null), u = `datetime-${g.getRandom(8)}`, a = ee({
      isInit: !1,
      isDefault: D.theme === "default",
      isRange: D.theme === "range",
      isShowPopup: D.isDropdown,
      timeType: "",
      layerType: D.layerType,
      layerView: "",
      formatIn: "",
      formatOut: "",
      formatOutEnd: "",
      rangeQuick: [],
      errMsg: []
    }), l = ee({
      showText: "",
      start: "",
      end: ""
    }), s = {
      lastStart: "",
      lastEnd: "",
      rangeQuick: {
        days: [
          { id: "today", text: T.value.today, start: _(), end: _() },
          {
            id: "yesterDay",
            text: T.value.yesterDay,
            start: _().subtract(1, "day"),
            end: _().subtract(1, "day")
          },
          {
            id: "pastDays7",
            text: T.value.pastDays7,
            start: _().subtract(7, "day"),
            end: _().subtract(1, "day")
          },
          {
            id: "pastDays30",
            text: T.value.pastDays30,
            start: _().subtract(30, "day"),
            end: _().subtract(1, "day")
          },
          {
            id: "mont",
            text: T.value.montCurrent,
            start: _().startOf("month"),
            end: _().endOf("month")
          },
          {
            id: "montLast",
            text: T.value.montLast,
            start: _().subtract(1, "month").startOf("month"),
            end: _().subtract(1, "month").endOf("month")
          }
        ],
        months: [
          {
            id: "mont",
            text: T.value.montCurrent,
            start: _().startOf("month"),
            end: _().endOf("month")
          },
          {
            id: "montLast",
            text: T.value.montLast,
            start: _().subtract(1, "month").startOf("month"),
            end: _().subtract(1, "month").endOf("month")
          },
          {
            id: "montLately6",
            text: T.value.montLately6,
            start: _().subtract(5, "month").startOf("month"),
            end: _().endOf("month")
          },
          {
            id: "year",
            text: T.value.yearCurrent,
            start: _().startOf("year"),
            end: _().endOf("year")
          },
          {
            id: "yearLast",
            text: T.value.yearLast,
            start: _().subtract(1, "year").startOf("year"),
            end: _().subtract(1, "year").endOf("year")
          }
        ],
        years: [
          {
            id: "year",
            text: T.value.yearCurrent,
            start: _().startOf("year"),
            end: _().endOf("year")
          },
          {
            id: "yearLast",
            text: T.value.yearLast,
            start: _().subtract(1, "year").startOf("year"),
            end: _().subtract(1, "year").endOf("year")
          }
        ]
      }
    }, t = fe(() => {
      let e = " panel-datetime box-width ";
      return D.themeStyle === "noBorder" && (e += " datetime-themeStyle-noBorder "), D.className && !g.isEmpty(D.className) && (e += D.className), D.isDropdown || (e += ` datetime-noPopup datetime-${D.theme} `), e;
    }), j = fe(() => {
      const e = {
        "datetime-icon": !0,
        clIconFont: !0
      }, o = a.timeType === "time" ? "clIcon-clock" : "clIcon-calendar";
      return e[o] = !0, e;
    }), J = fe(() => `datetime-dropdown datetime-${D.theme}`), G = fe(() => {
      let e = D.arrowDirection;
      return D.themeStyle === "noBorder" && (e = e.length === 0 ? "left" : e), e;
    }), R = (e) => {
      const o = g.isEmpty(e.start), m = g.isEmpty(e.end), k = o ? "" : _(e.start).format(a.formatOut), $ = m ? "" : _(e.end).format(a.formatOutEnd), B = a.isDefault ? k : o || m ? "" : `${k}~${$}`, N = a.isDefault ? { value: k } : { start: k, end: $ };
      return N.value = B, { value: B, info: N };
    }, Z = () => {
      p.value && p.value.setOpen(!1);
    }, te = () => a.timeType === "time", K = (e) => {
      if (!e)
        return e;
      const o = g.trim(e);
      return te() ? `${_().format("YYYY-MM-DD")} ${o}` : o;
    }, H = () => _(), A = (e, o) => {
      let m = null;
      if (!g.isEmpty(e)) {
        const k = g.isUndefined(o) ? a.formatIn : o;
        m = g.isString(e) ? _(e, k) : _(e), m && !m.isValid() && (m = null);
      }
      return m;
    }, V = (e) => {
      const o = A(e);
      return g.isUndefined(o) ? H().startOf("month") : o.startOf("month");
    }, S = (e, o, m) => {
      const k = g.isEmpty(m) ? a.formatIn : m;
      let $ = "";
      if (!g.isEmpty(D.minDate)) {
        const oe = A(K(D.minDate));
        $ = oe ? oe.format(k) : "";
      }
      let B = "";
      if (!g.isEmpty(D.maxDate)) {
        const oe = A(K(D.maxDate));
        B = oe ? oe.format(k) : "";
      }
      let N = !0, q = !0, de = !0, Ve = !0, be = !0, n = !1;
      const f = g.isEmpty(e), y = g.isEmpty(o);
      let P;
      switch (D.layerType) {
        case "years":
          P = "year";
          break;
        case "months":
          P = "month";
          break;
        case "days":
          P = "day";
          break;
        case "hours":
          P = "hour";
          break;
        case "minutes":
          P = "minute";
          break;
        case "seconds":
          P = "second";
          break;
      }
      f || (g.isEmpty($) || (N = _(e).isSameOrAfter($, P), y || (de = _(o).isSameOrAfter($, P))), g.isEmpty(B) || (q = _(e).isSameOrBefore(B, P), y || (Ve = _(o).isSameOrBefore(B, P))), y || _(o).isBefore(_(e)) && (be = !1));
      const Q = [], ae = a.isRange ? T.value.rangeStartLabel : "";
      return q ? de ? (N || Q.push(
        `${ae}${T.value.checkStartMinLabel}(${_($).format(
          a.formatOut
        )})`
      ), Ve || Q.push(
        `${T.value.checkEndMaxLabel}(${_(B).format(a.formatOut)})`
      )) : Q.push(`${T.value.checkEndMinLabel}(${_($).format(a.formatOut)})`) : Q.push(
        `${ae}${T.value.checkStartMaxLabel}(${_(B).format(a.formatOut)})`
      ), a.isRange && ((f || y) && (n = !0, Q.push(T.value.checkRangeEmptyLabel)), be || Q.push(T.value.checkStartEndLabel)), { isStartMin: N, isStartMax: q, isEndMin: de, isEndMax: Ve, isStartEnd: be, isRangeEmpty: n, errMsg: Q, minDay: $, maxDay: B };
    }, O = (e, o, m) => {
      const k = S(e, o || "", m);
      return a.errMsg = k.errMsg, p.value && ce(() => {
        p.value.calculationPosition();
      }), k;
    }, h = () => {
      let e = [];
      if (a.isRange)
        if (g.isEmpty(D.rangeQuick))
          switch (D.layerType) {
            case "days":
            case "hours":
            case "minutes":
            case "seconds":
              e = a.timeType === "time" ? [] : s.rangeQuick.days;
              break;
            case "months":
              e = s.rangeQuick.months;
              break;
            case "years":
              e = s.rangeQuick.years;
              break;
          }
        else
          e = D.rangeQuick;
      a.rangeQuick = e;
    }, i = () => {
      let e = "", o = "", m = "";
      switch (D.layerType) {
        case "years":
          e = "date", o = "YYYY", m = D.layerType;
          break;
        case "months":
          e = "date", o = "YYYY-MM", m = D.layerType;
          break;
        case "days":
          e = "date", o = "YYYY-MM-DD", m = D.layerType;
          break;
        case "hours":
          e = D.timeType === "date" ? "datetime" : D.timeType, o = e === "time" ? "HH:00" : "YYYY-MM-DD HH:00", m = e === "datetime" ? "days" : "times";
          break;
        case "minutes":
          e = D.timeType === "date" ? "datetime" : D.timeType, o = e === "time" ? "HH:mm" : "YYYY-MM-DD HH:mm", m = e === "datetime" ? "days" : "times";
          break;
        case "seconds":
          e = D.timeType === "date" ? "datetime" : D.timeType, o = e === "time" ? "HH:mm:ss" : "YYYY-MM-DD HH:mm:ss", m = e === "datetime" ? "days" : "times";
          break;
        default:
          e = "date", o = "YYYY-MM-DD", m = D.layerType;
          break;
      }
      a.timeType = e, a.layerView = m, a.formatIn = e === "date" ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm:ss", a.formatOut = D.format && !g.isEmpty(D.format) ? D.format : o, a.formatOutEnd = D.formatEnd && !g.isEmpty(D.formatEnd) ? D.formatEnd : o;
    }, c = (e) => {
      let o = "", m = "", k = "";
      if (e && !g.isEmpty(e)) {
        if (a.isDefault) {
          const $ = K(e), B = _($);
          m = B.format(a.formatIn), o = B.format(a.formatOut);
        } else if (a.isRange) {
          const $ = e.split("~");
          if ($.length === 2) {
            const B = K($[0]), N = K($[1]), q = _(B), de = _(N);
            m = q.format(a.formatIn), k = de.format(a.formatIn), o = `${q.format(a.formatOut)} ~ ${de.format(a.formatOutEnd)}`;
          }
        }
      }
      l.start = m, l.end = k, l.showText = o;
    }, x = (e) => {
      let o = !0;
      return D.checkCallback && (a.isDefault ? o = D.checkCallback(e) : a.isRange && (o = D.checkCallback(e.start, e.end)), o = g.isBoolean(o) ? o : !0), o;
    }, w = (e) => {
      let o = "", m = "", k = "", $ = !1;
      if (a.isDefault) {
        if (!g.isEmpty(e)) {
          const q = A(e);
          m = q.format(a.formatIn), o = q.format(a.formatOut);
        }
        $ = m !== s.lastStart;
      } else if (a.isRange) {
        if (!g.isEmpty(e.start) && !g.isEmpty(e.end)) {
          const q = A(e.start), de = A(e.end);
          m = q.format(a.formatIn), k = de.format(a.formatIn), o = `${q.format(a.formatOut)} ~ ${de.format(a.formatOutEnd)}`;
        }
        $ = m !== s.lastStart || k !== s.lastEnd;
      }
      const B = S(m, k);
      let N = !1;
      return B.errMsg.length === 0 && (N = x(e)), a.errMsg = B.errMsg, p.value && ce(() => {
        p.value.calculationPosition();
      }), { start: m, end: k, text: o, isChange: $, checkInfo: B, isCheck: N };
    }, M = () => {
      i(), c(D.value), h(), ce(() => {
        a.isInit = !0;
      });
    };
    ue(
      () => D.value,
      (e, o) => {
        e !== o && c(e);
      }
    ), Se(() => {
      ce(() => {
        M();
      });
    });
    const W = (e) => {
      D.disabled || e && (a.errMsg = [], s.lastStart = l.start, s.lastEnd = l.end);
    }, z = () => {
      if (!D.disabled) {
        l.start = "", l.end = "", l.showText = "";
        const e = R(l);
        I("update:value", e.value), I("onChange", e.value, e.info);
      }
    }, F = (e) => {
      if (!D.disabled) {
        const { start: o, end: m, text: k, isChange: $, isCheck: B } = w(e);
        if (B && (l.start = o, l.end = m, l.showText = k, Z(), $)) {
          const N = R(l);
          I("update:value", N.value), I("onChange", N.value, N.info);
        }
      }
    }, U = () => {
      Z();
    }, L = () => {
      a.isShowPopup ? p.value && (p.value.checkCurrentIsOpen() || p.value.initCompleteOpen()) : I("onInit");
    };
    _e("$DateTimeTop", {
      keyIndex: u,
      getMomentDate: A,
      getViewDate: V,
      getNow: H,
      checkIsTimes: te,
      checkValue: O,
      checkMinMax: S,
      getValueEffective: K,
      getMergeDayTime: (e, o) => {
        let m = "";
        const k = g.trim(e);
        let $ = g.trim(o);
        switch (a.timeType) {
          case "date":
            m = k;
            break;
          case "time":
            m = K($) || "";
            break;
          case "datetime":
            g.isEmpty(k) || ($ = g.isEmpty(o) ? "00:00:00" : $, m = `${k} ${$}`);
            break;
        }
        return m;
      },
      Dayjs: _
    }), _e("$DateTimeTopBase", Ne(a));
    const ne = () => {
      const e = r.value.getValue(), { start: o, end: m, isCheck: k } = w(e);
      return k ? R({ start: o, end: m }) : {};
    };
    return re({
      getValue: () => {
        const e = ne();
        return g.isUndefined(e.value) ? "" : e.value;
      },
      getValueData: () => {
        const e = ne();
        return g.isUndefined(e.info) ? {} : e.info;
      },
      setValue: (e) => {
        c(e);
      }
    }), (e, o) => b.isDropdown ? (Y(), Ce(Qe, {
      key: 0,
      ref_key: "refElDropdownLayer",
      ref: p,
      classParent: t.value,
      classDropDown: J.value,
      placeholder: b.placeholder,
      isDisabled: b.disabled,
      isClear: b.isClear,
      textLabel: l.showText,
      textArrowDirection: G.value,
      dropdownArrowPos: b.direction,
      isUseDropdownArrow: b.isUseDropdownArrow,
      onOnChangeOpen: W,
      onOnClear: z
    }, {
      textExtend: Pe(() => [
        C("i", {
          class: ie(j.value)
        }, null, 2)
      ]),
      dropdown: Pe(() => [
        ye(He, {
          ref_key: "refElDatetime",
          ref: r,
          isDefault: a.isDefault,
          isRange: a.isRange,
          start: l.start,
          end: l.end,
          minDate: b.minDate,
          maxDate: b.maxDate,
          rangeQuick: a.rangeQuick,
          errMsg: a.errMsg,
          onOnSelectValue: F,
          onOnClose: U,
          onOnInitComplete: L
        }, null, 8, ["isDefault", "isRange", "start", "end", "minDate", "maxDate", "rangeQuick", "errMsg"])
      ]),
      _: 1
    }, 8, ["classParent", "classDropDown", "placeholder", "isDisabled", "isClear", "textLabel", "textArrowDirection", "dropdownArrowPos", "isUseDropdownArrow"])) : (Y(), E("div", {
      key: 1,
      class: ie(t.value)
    }, [
      a.isInit ? (Y(), Ce(He, {
        key: 0,
        ref_key: "refElDatetime",
        ref: r,
        isDefault: a.isDefault,
        isRange: a.isRange,
        start: l.start,
        end: l.end,
        minDate: b.minDate,
        maxDate: b.maxDate,
        rangeQuick: a.rangeQuick,
        errMsg: a.errMsg,
        onOnSelectValue: F,
        onOnClose: U,
        onOnInitComplete: L
      }, null, 8, ["isDefault", "isRange", "start", "end", "minDate", "maxDate", "rangeQuick", "errMsg"])) : X("", !0)
    ], 2));
  }
});
export {
  aa as default
};
//# sourceMappingURL=ClDatetime.js.map
