import * as e from "react";
import { DesktopChecker as i } from "@accelbyte/sdk";
import { UIEvent as s } from "./accelbyte-widgets138.mjs";
import { Ctx as m } from "./accelbyte-widgets33.mjs";
import { FeUtils as c } from "./accelbyte-widgets45.mjs";
import { AccPath as p } from "./accelbyte-widgets34.mjs";
import { LanguageSelector as l } from "./accelbyte-widgets162.mjs";
import { HeaderLogoContainer as d } from "./accelbyte-widgets53.mjs";
import a from "classnames";
import u from "./accelbyte-widgets140.mjs";
import t from "./accelbyte-widgets182.mjs";
import { OneTimeCodeForm as h } from "./accelbyte-widgets183.mjs";
import { SelectLinkMode as k } from "./accelbyte-widgets184.mjs";
class R extends e.Component {
  constructor(r) {
    super(r), this.onRestart = () => {
      this.setState({ step: "oneTimeCode" }), this.appState.state.appHistory.replace(p.LinkAccountWithOneTimeCode.link);
    }, this.goToSelectLinkModeStep = (o) => {
      this.setState({ oneTimeLinkCode: o, step: "selectLinkMode" });
    }, this.renderContent = () => {
      const { step: o, oneTimeLinkCode: n } = this.state;
      switch (o) {
        case "oneTimeCode":
          return /* @__PURE__ */ e.createElement(h, { onContinue: this.goToSelectLinkModeStep });
        case "selectLinkMode":
          return /* @__PURE__ */ e.createElement(k, { oneTimeLinkCode: n, onRestart: this.onRestart });
        default:
          return null;
      }
    }, this.state = {
      step: "oneTimeCode",
      oneTimeLinkCode: ""
    }, this.appState = m.getAppState();
  }
  componentDidMount() {
    const { appHistory: r } = this.appState.state, n = c.getSearchParamsObject(r).get("oneTimeLinkCode");
    n && this.setState({ oneTimeLinkCode: n, step: "selectLinkMode" }), s.updateBackground(`url(${u})`);
  }
  componentWillUnmount() {
    s.updateBackground(null);
  }
  render() {
    return /* @__PURE__ */ e.createElement("div", { className: a(t.oneTimeLinkAccountPage, { [t.desktop]: i.isDesktopApp() }) }, /* @__PURE__ */ e.createElement(l, { className: t.languageSelector }), /* @__PURE__ */ e.createElement("div", { className: a(t.container) }, /* @__PURE__ */ e.createElement(d, null), /* @__PURE__ */ e.createElement("div", { className: t.form }, this.renderContent())));
  }
}
export {
  R as default
};
