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