import { defineComponent as q, computed as r, reactive as c, markRaw as x, openBlock as u, createElementBlock as f, createElementVNode as v, toDisplayString as C, unref as n, Fragment as D, renderList as w, createBlock as B, resolveDynamicComponent as L, createVNode as z } from "vue";
import { E as H, i as R, a as V, k as N } from "./index-ec8bc9b4.mjs";
import "pinia";
import "dayjs";
const $ = { class: "cds-auth__body" }, A = ["textContent"], F = { class: "cds-auth__form" }, I = { class: "cds-auth__action" }, G = /* @__PURE__ */ q({
  __name: "AuthRecover",
  props: {
    disabled: { type: Boolean, default: !1 },
    lang: { default: {
      title: "Войти по email",
      submit: "Войти",
      emailLabel: "Email",
      emailHint: "name@company.org",
      passwordLabel: "Пароль",
      passwordHint: "оЧеньсЛожНыйПароЛь"
    } }
  },
  emits: ["update", "recover"],
  setup(_, { emit: p }) {
    const m = _, i = r(() => m.lang), o = r(() => m.disabled), y = c({
      disabled: o.value,
      card: !1,
      inline: !1,
      iconEnd: !0,
      size: "large"
    }), d = c([
      {
        icon: H,
        validate: R,
        iconEnd: !1,
        label: i.value.emailLabel,
        hint: i.value.emailHint,
        params: { autocomplete: "email", type: "email" },
        required: !0,
        key: "email",
        value: "",
        component: x(V)
      }
    ]), s = c({
      email: { value: "", valid: !1 },
      password: { value: "", valid: !1 }
    }), h = r(() => {
      let t = [];
      for (let a in s)
        t = [...t, s[a].valid];
      return t.every((a) => a);
    }), b = (t) => {
      const { key: a, valid: e, value: l } = t;
      if (!a)
        return;
      const g = d.findIndex((E) => E.key === a);
      d[g].value = l, s[a] = { value: l, valid: e }, e && p("update", { key: a, valid: e, value: l });
    }, k = () => p("recover", s);
    return (t, a) => (u(), f("div", $, [
      v("div", {
        class: "cds-auth__title",
        textContent: C(n(i).title)
      }, null, 8, A),
      v("div", F, [
        (u(!0), f(D, null, w(d, (e) => (u(), B(L(e.component), {
          base: {
            key: e.key,
            autocapitalizationType: !1,
            hint: e.hint,
            icon: e.icon,
            label: e.label,
            required: e.required,
            validate: e.validate,
            value: e.value
          },
          decorations: y,
          disabled: n(o),
          hint: e.hint,
          icon: e.icon,
          iconEnd: !0,
          inline: !1,
          label: e.label,
          name: e.key,
          params: e.params,
          required: e.required,
          validate: e.validate,
          value: e.value,
          onChangeData: a[0] || (a[0] = (l) => b(l)),
          onUpdateData: a[1] || (a[1] = (l) => b(l))
        }, null, 40, ["base", "decorations", "disabled", "hint", "icon", "label", "name", "params", "required", "validate", "value"]))), 256))
      ]),
      v("div", I, [
        z(N, {
          disabled: !n(h) || n(o),
          fill: !0,
          label: n(i).submit,
          color: "success",
          size: "large",
          type: "submit",
          onClick: k
        }, null, 8, ["disabled", "label"])
      ])
    ]));
  }
});
export {
  G as default
};
//# sourceMappingURL=AuthRecover-32ad2b0f.mjs.map
