import { defineComponent as $, inject as C, ref as m, reactive as k, resolveComponent as r, openBlock as g, createElementBlock as f, createVNode as e, withCtx as n, createElementVNode as h, createTextVNode as v, toDisplayString as u, createCommentVNode as N } from "vue";
import { b as q, e as E, _ as F } from "./index-e250a75e.mjs";
const L = { class: "login-container" }, R = { class: "login-form" }, z = {
  key: 0,
  style: { color: "var(--el-color-error)" }
}, B = /* @__PURE__ */ $({
  __name: "index",
  setup(D) {
    const i = C("globalContext"), p = m(), t = k({
      username: "",
      password: ""
    }), s = m(!1), b = i.router;
    function w() {
      p.value.validate((o) => {
        s.value = !1, o && E(i, t).then(() => {
          var l;
          b.push(((l = i.router.currentRoute.value.query) == null ? void 0 : l.redirect) || "/");
        }).catch((l) => {
          console.log(l), s.value = !0;
        });
      });
    }
    return (o, l) => {
      const c = r("lc-icon"), _ = r("el-input"), a = r("el-form-item"), y = r("el-button"), V = r("el-form"), x = r("dvi");
      return g(), f("div", L, [
        e(x, { class: "login-area" }, {
          default: n(() => [
            h("div", R, [
              h("h2", null, [
                v(u(o.$t("_.plugin.login.title")) + " ", 1),
                e(q, { style: { "line-height": "32px", "margin-left": "8px" } })
              ]),
              e(V, {
                ref_key: "loginFormRef",
                ref: p,
                model: t,
                size: "large",
                "label-position": "top"
              }, {
                default: n(() => [
                  e(a, {
                    prop: "username",
                    label: o.$t("_.plugin.login.username"),
                    required: ""
                  }, {
                    default: n(() => [
                      e(_, {
                        clearable: "",
                        modelValue: t.username,
                        "onUpdate:modelValue": l[0] || (l[0] = (d) => t.username = d),
                        placeholder: o.$t("_.plugin.login.usernamePlaceholder")
                      }, {
                        prefix: n(() => [
                          e(c, { icon: "mdiAccount" })
                        ]),
                        _: 1
                      }, 8, ["modelValue", "placeholder"])
                    ]),
                    _: 1
                  }, 8, ["label"]),
                  e(a, {
                    prop: "password",
                    label: o.$t("_.plugin.login.password"),
                    required: ""
                  }, {
                    default: n(() => [
                      e(_, {
                        clearable: "",
                        "show-password": "",
                        modelValue: t.password,
                        "onUpdate:modelValue": l[1] || (l[1] = (d) => t.password = d),
                        placeholder: o.$t("_.plugin.login.passwordPlaceholder")
                      }, {
                        prefix: n(() => [
                          e(c, { icon: "mdiLock" })
                        ]),
                        _: 1
                      }, 8, ["modelValue", "placeholder"])
                    ]),
                    _: 1
                  }, 8, ["label"]),
                  e(a, null, {
                    default: n(() => [
                      e(y, {
                        size: "large",
                        type: "primary",
                        style: { width: "100%" },
                        onClick: w
                      }, {
                        default: n(() => [
                          v(u(o.$t("_.plugin.login.login")), 1)
                        ]),
                        _: 1
                      })
                    ]),
                    _: 1
                  }),
                  e(a, null, {
                    default: n(() => [
                      s.value ? (g(), f("span", z, u(o.$t("_.plugin.login.loginFail")), 1)) : N("", !0)
                    ]),
                    _: 1
                  })
                ]),
                _: 1
              }, 8, ["model"])
            ])
          ]),
          _: 1
        })
      ]);
    };
  }
});
const j = /* @__PURE__ */ F(B, [["__scopeId", "data-v-a225f599"]]);
export {
  j as default
};
