import { defineComponent as z, computed as r, reactive as c, markRaw as C, openBlock as u, createElementBlock as h, createElementVNode as p, toDisplayString as O, unref as i, Fragment as Z, renderList as N, createBlock as J, resolveDynamicComponent as Q, createVNode as T } from "vue";
import { E as D, e as V, a as Y, c as E } from "./index-89cd84f1.mjs";
import "pinia";
import "dayjs";
const W = { class: "cds-auth__body" }, X = ["textContent"], j = { class: "cds-auth__form" }, M = { class: "cds-auth__action" }, U = /* @__PURE__ */ z({
  __name: "AuthRecover",
  props: {
    disabled: { type: Boolean, default: !1 },
    lang: { default: {
      title: "Напомнить пароль",
      submit: "Отправить инструкцию",
      emailLabel: "Email",
      emailHint: "name@company.org",
      passwordLabel: "Пароль",
      passwordHint: "оЧеньсЛожНыйПароЛь"
    } }
  },
  emits: ["update", "recover"],
  setup(f, { emit: m }) {
    const v = f, s = r(() => v.lang), o = r(() => v.disabled), y = c({
      disabled: o.value,
      card: !1,
      inline: !1,
      iconEnd: !0,
      size: "large"
    }), d = c([
      {
        icon: D,
        validate: V,
        iconEnd: !1,
        label: s.value.emailLabel,
        hint: s.value.emailHint,
        params: { autocomplete: "email", type: "email" },
        required: !0,
        key: "email",
        value: "",
        component: C(Y)
      }
    ]), n = c({
      email: { value: "", valid: !1 },
      password: { value: "", valid: !1 }
    }), L = r(() => {
      let t = [];
      for (let a in n)
        t = [...t, n[a].valid];
      return t.every((a) => a);
    }), b = (t) => {
      const { key: a, valid: e, value: l } = t;
      if (!a)
        return;
      const g = d.findIndex((k) => k.key === a);
      d[g].value = l, n[a] = { value: l, valid: e }, e && m("update", { key: a, valid: e, value: l });
    }, I = () => m("recover", n), _ = async (t) => (await fetch("https://b.docsme.ru/storage/o/public/test/text.png", {
      method: "POST",
      headers: {
        "Content-Type": "multipart/form-data",
        Authorization: "Bearer eyJhbGciOiJIUzI1NiJ9.eyJodHRwczovL2hhc3VyYS5pby9qd3QvY2xhaW1zIjp7IngtaGFzdXJhLXVzZXItaWQiOiI4NzE3ZTBlMi1mMTk2LTRmZmUtOTU5ZC03NTdkOGY5ZDllOWYiLCJ4LWhhc3VyYS1hbGxvd2VkLXJvbGVzIjpbInVzZXIiLCJtZSIsImVkaXRvciJdLCJ4LWhhc3VyYS1kZWZhdWx0LXJvbGUiOiJlZGl0b3IiLCJ4LWhhc3VyYS1kaXNwbGF5LW5hbWUiOiLQktCw0LvQtdGA0LjQuSDQldC90LjQutC10LXQsiIsIngtaGFzdXJhLWNvbXBhbnktaWQiOiI3MjgxMTM5Mi0yYzEzLTRmNzYtYjdiMy1iYjY1Zjg1MDdlODkifSwic3ViIjoiODcxN2UwZTItZjE5Ni00ZmZlLTk1OWQtNzU3ZDhmOWQ5ZTlmIiwiaXNzIjoibmhvc3QiLCJpYXQiOjE2NzEyODU2ODQsImV4cCI6MTY3MTI5Mjg4NH0.QLyyVdMuzMN0T_4Dc-ZDRcNCdPoIPKsgbsXlrPO9EYQ"
      },
      body: JSON.stringify({
        file: t,
        bucketId: "pub"
      })
    }), {
      success: 1,
      file: {
        url: "https://b.docsme.ru/storage/o/public/app/logo.svg",
        id: "2345234523",
        width: 1e3,
        height: 1e3
      }
    });
    return (t, a) => (u(), h("div", W, [
      p("div", {
        class: "cds-auth__title",
        textContent: O(i(s).title)
      }, null, 8, X),
      p("div", j, [
        (u(!0), h(Z, null, N(d, (e) => (u(), J(Q(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,
            uploader: _
          },
          decorations: y,
          disabled: i(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))
      ]),
      p("div", M, [
        T(E, {
          disabled: !i(L) || i(o),
          fill: !0,
          label: i(s).submit,
          color: "success",
          size: "large",
          type: "submit",
          onClick: I
        }, null, 8, ["disabled", "label"])
      ])
    ]));
  }
});
export {
  U as default
};
//# sourceMappingURL=AuthRecover-f0753378.mjs.map
