import { jsx as c } from "react/jsx-runtime";
import l from "prop-types";
import { useMemoizedFn as a } from "ahooks";
import p from "@iconify-icons/tabler/mail-filled";
import { LOGIN_PROVIDER as t, LOGIN_PROVIDER_NAME as I } from "@arcblock/ux/lib/Util/constant";
import { GA_LAST_LOGIN_METHOD as L } from "@arcblock/ux/lib/withTracker/constant";
import f from "../../components/login-item/login-method-item.js";
import { useStateContext as M } from "../../contexts/state.js";
function u({ ...i }) {
  const { setSelectedPlugin: n, getPlugin: r, connectState: m, lastLoginMethod: e } = M(), s = a(() => {
    localStorage.setItem(L, t.EMAIL);
    const o = r(t.EMAIL);
    o.state.reset(), o.state.status = "creating", m.chooseMethod = t.EMAIL, n(o);
  });
  return /* @__PURE__ */ c(
    f,
    {
      ...i,
      isLatest: e && e === t.EMAIL,
      title: I[t.EMAIL],
      icon: p,
      onClick: s
    }
  );
}
u.propTypes = {
  onClick: l.func
};
export {
  u as default
};
