import { jsx as r } from "react/jsx-runtime";
import { Box as a, TextField as l } from "@mui/material";
import { useReactive as s, useMemoizedFn as f } from "ahooks";
import v from "@arcblock/ux/lib/Toast";
import { client as m } from "../../libs/client.js";
import { formatAxiosError as c } from "../libs/utils.js";
function y({ user: i }) {
  const e = s({
    inviter: i?.inviter,
    loading: !1
  }), n = f(async (o) => {
    try {
      const { value: t } = o.target;
      e.loading = !0, await m.user.saveProfile({ inviter: t }), e.inviter = t;
    } catch (t) {
      v.error(c(t));
    } finally {
      e.loading = !1;
    }
  });
  return !i || !!!window.blocklet?.settings?.invite?.enabled || !!i.inviter ? "-" : /* @__PURE__ */ r(a, { children: /* @__PURE__ */ r(l, { size: "small", fullWidth: !0, label: "", value: e.inviter, onChange: n }) });
}
export {
  y as default
};
