import { g } from './SvgIcon-BAPcdaJk.mjs';
import { useSSRContext, ref, watch, resolveComponent, mergeProps, withCtx, createVNode, openBlock, createBlock, toDisplayString, createCommentVNode, unref, isRef } from 'vue';
import { ssrRenderComponent, ssrRenderAttr, ssrInterpolate } from 'vue/server-renderer';
import { j as Fv } from './server.mjs';

const x = { __name: "BaseDateInput", __ssrInlineRender: true, props: { name: { type: String, required: true }, label: { type: String, required: false }, placeholder: { type: String, required: false }, value: { type: String, required: false }, maxDate: { type: String, required: false }, minDate: { type: String, required: false }, timePicker: { type: Boolean, required: false }, disabled: { type: Boolean, required: false } }, emits: ["update:value"], setup(a2, { emit: x2 }) {
  const b2 = a2, V = x2, k = Fv(b2.name), S = ref(null);
  return watch(() => b2.value, (e2) => {
    e2 && (b2.timePicker ? k.setValue(e2) : (k.setValue(e2), S.value = new Date(e2)));
  }, { deep: true, immediate: true }), watch(() => S.value, (e2, a3) => {
    var t2;
    if (e2) if (b2.timePicker) {
      const a4 = e2.hours < 10 ? "0" + e2.hours : e2.hours + ":" + (e2.minutes < 10 ? "0" + e2.minutes : e2.minutes);
      k.setValue(a4), V("update:value", a4);
    } else {
      const e3 = null == (t2 = null == S ? undefined : S.value) ? undefined : t2.toISOString().slice(0, 10);
      k.setValue(e3), V("update:value", e3);
    }
    else e2 != a3 && (k.setValue(undefined), V("update:value", undefined));
  }, { deep: true, immediate: true }), (t2, l2, D2, x3) => {
    const b3 = resolveComponent("VeeField"), V2 = resolveComponent("VueDatePicker"), k2 = g, g$1 = resolveComponent("VeeErrorMessage");
    l2(ssrRenderComponent(b3, mergeProps({ name: a2.name }, x3), { default: withCtx(({ field: e2, meta: t3 }, l3, r2, i2) => {
      if (!l3) return [createVNode("div", { class: "input-wrapper" }, [a2.label ? (openBlock(), createBlock("label", { key: 0, for: a2.name }, toDisplayString(a2.label), 9, ["for"])) : createCommentVNode("", true), createVNode(V2, { modelValue: unref(S), "onUpdate:modelValue": (e3) => isRef(S) ? S.value = e3 : null, placeholder: a2.placeholder, format: a2.timePicker ? "HH:mm" : "yyyy-MM-dd", "max-date": a2.maxDate && new Date(a2.maxDate), "min-date": a2.minDate && new Date(a2.minDate), disabled: a2.disabled, autocomplete: "off", "time-picker": a2.timePicker }, { "input-icon": withCtx(() => [createVNode(k2, { name: "calendar", classes: "z-30 !relative !translate-y-0" })]), _: 1 }, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "format", "max-date", "min-date", "disabled", "time-picker"])]), createVNode(g$1, { class: "text-sm text-red-500", name: a2.name }, null, 8, ["name"])];
      l3(`<div class="input-wrapper"${i2}>`), a2.label ? l3(`<label${ssrRenderAttr("for", a2.name)}${i2}>${ssrInterpolate(a2.label)}</label>`) : l3("<!---->"), l3(ssrRenderComponent(V2, { modelValue: unref(S), "onUpdate:modelValue": (e3) => isRef(S) ? S.value = e3 : null, placeholder: a2.placeholder, format: a2.timePicker ? "HH:mm" : "yyyy-MM-dd", "max-date": a2.maxDate && new Date(a2.maxDate), "min-date": a2.minDate && new Date(a2.minDate), disabled: a2.disabled, autocomplete: "off", "time-picker": a2.timePicker }, { "input-icon": withCtx((e3, a3, t4, l4) => {
        if (!a3) return [createVNode(k2, { name: "calendar", classes: "z-30 !relative !translate-y-0" })];
        a3(ssrRenderComponent(k2, { name: "calendar", classes: "z-30 !relative !translate-y-0" }, null, t4, l4));
      }), _: 2 }, r2, i2)), l3("</div>"), l3(ssrRenderComponent(g$1, { class: "text-sm text-red-500", name: a2.name }, null, r2, i2));
    }), _: 1 }, D2));
  };
} }, b = x.setup;
x.setup = (e2, t2) => {
  const l2 = useSSRContext();
  return (l2.modules || (l2.modules = /* @__PURE__ */ new Set())).add("components/Inputs/BaseDateInput.vue"), b ? b(e2, t2) : undefined;
};

export { x };
//# sourceMappingURL=BaseDateInput-C_R-VvDL.mjs.map
