import { Ctx as g } from "./accelbyte-widgets33.mjs";
import { Env as m } from "./accelbyte-widgets108.mjs";
import { VerificationCodeContext as f } from "./accelbyte-widgets139.mjs";
import r from "react";
import { UpgradeAccountPage as h } from "./accelbyte-widgets144.mjs";
class w extends r.Component {
  constructor() {
    super(...arguments), this.appState = g.getAppState(), this.state = {
      isReady: !1,
      isLoading: !1,
      loadError: null
    }, this.setStatePromise = (t) => new Promise((e) => this.setState(t, e));
  }
  componentDidMount() {
    this.init();
  }
  async init() {
    try {
      await this.setStatePromise({ isLoading: !0 }), await this.appState.fetchAllUserInformation(), await this.setStatePromise({ isReady: !0, loadError: null });
    } catch (t) {
      await this.setStatePromise({ loadError: t });
    } finally {
      await this.setStatePromise({ isLoading: !1 });
    }
  }
  render() {
    const { isReady: t, isLoading: e, loadError: s } = this.state, { isRequestingCode: i, requestCodeError: o, isUpgradingHeadless: n, upgradeHeadlessError: d } = this.appState.userAppManager.state, { upgradeHeadlessAccount: p } = this.appState.linkAccountManager, { sendVerificationCode: c } = this.appState.verificationManager;
    return /* @__PURE__ */ r.createElement(
      h,
      {
        isReady: t,
        isLoading: e,
        loadError: s,
        requestCode: (a) => c(a, f.enum.upgradeHeadlessAccount),
        isRequestingCode: i,
        requestCodeError: o,
        upgradeAccount: (a, l, u) => p({ emailAddress: a, password: l, code: u, validateOnly: !1 }, m.IS_DISABLE_USERNAME),
        isUpgrading: n,
        upgradeError: d
      }
    );
  }
}
export {
  w as default
};
