import { AccountMainSection as N, AccountMainSectionHeader as H, AccountMainSectionBody as g } from "./accelbyte-widgets122.mjs";
import { Alert as A } from "./accelbyte-widgets123.mjs";
import { CommonError as P } from "./accelbyte-widgets124.mjs";
import { ArrowIcon as s, ArrowIconStyles as l } from "./accelbyte-widgets125.mjs";
import { BackLinkIcon as k } from "./accelbyte-widgets126.mjs";
import { AccountHistoryEvent as o } from "./accelbyte-widgets127.mjs";
import { AlertType as v } from "./accelbyte-widgets128.mjs";
import { AccPath as t } from "./accelbyte-widgets34.mjs";
import { UrlUtils as c } from "./accelbyte-widgets90.mjs";
import m from "classnames";
import e from "react";
import { Trans as i } from "react-i18next";
import { Link as w, Switch as S, Redirect as u, NavLink as E, Route as D } from "react-router-dom";
import "./accelbyte-widgets129.mjs";
import { DisplayNameAccountHistoryPage as b } from "./accelbyte-widgets130.mjs";
import { EmailAddressAccountHistoryPage as x } from "./accelbyte-widgets131.mjs";
import { PasswordAccountHistoryPage as B } from "./accelbyte-widgets132.mjs";
const K = () => /* @__PURE__ */ e.createElement("div", { className: "sidebar mb-4 w-full md:mb-0" }, /* @__PURE__ */ e.createElement("nav", { className: "navigationDesktop flex flex-col flex-nowrap items-stretch" }, /* @__PURE__ */ e.createElement(E, { to: t.DisplayNameHistory.makePath() }, /* @__PURE__ */ e.createElement("span", null, /* @__PURE__ */ e.createElement(i, { i18nKey: "Navigation.editHistory.displayName" }, "Display Name")), /* @__PURE__ */ e.createElement(s, { className: m("activeArrow", l.right) })), /* @__PURE__ */ e.createElement(E, { to: t.EmailHistory.makePath() }, /* @__PURE__ */ e.createElement("span", null, /* @__PURE__ */ e.createElement(i, { i18nKey: "Navigation.editHistory.emailAddress" }, "Email Address")), /* @__PURE__ */ e.createElement(s, { className: m("activeArrow", l.right) })), /* @__PURE__ */ e.createElement(E, { to: t.PasswordHistory.makePath() }, /* @__PURE__ */ e.createElement("span", null, /* @__PURE__ */ e.createElement(i, { i18nKey: "Navigation.editHistory.password" }, "Password")), /* @__PURE__ */ e.createElement(s, { className: m("activeArrow", l.right) })))), d = ({ component: p, path: r }) => /* @__PURE__ */ e.createElement(
  D,
  {
    path: r,
    render: (a) => {
      const n = Number(c.silentSearchParamsBuilder(a.location.search).get("page")), f = c.silentSearchParamsBuilder(a.location.search).get("startdate") || "", h = c.silentSearchParamsBuilder(a.location.search).get("enddate") || "", y = !Number.isNaN(n) && n >= 1;
      return y ? y && /* @__PURE__ */ e.createElement(p, { startDate: f, endDate: h, page: n }) : /* @__PURE__ */ e.createElement(u, { to: `${r}?page=1` });
    }
  }
);
class Q extends e.Component {
  constructor(r) {
    super(r), this.clearNotification = () => {
      this.setState({ alert: null });
    }, this.requestAccountHistoryOfflineError = (a) => {
      this.setState({
        alert: {
          type: v.danger,
          element: /* @__PURE__ */ e.createElement(P, { error: a })
        }
      });
    }, this.state = {
      alert: null
    };
  }
  componentDidMount() {
    o.register(o._.requestAccountHistoryOfflineError, this.requestAccountHistoryOfflineError), o.register(o._.clearNotification, this.clearNotification);
  }
  render() {
    const { alert: r } = this.state;
    return /* @__PURE__ */ e.createElement(N, { className: "editHistoryPage" }, /* @__PURE__ */ e.createElement(H, null, /* @__PURE__ */ e.createElement(w, { to: t.Profile.makePath(), className: "btnEditHistory" }, /* @__PURE__ */ e.createElement(k, { className: "icon" }), /* @__PURE__ */ e.createElement(i, { i18nKey: "Navigation.editHistory.backlink" }, "Edit History"))), /* @__PURE__ */ e.createElement(g, null, !!r && /* @__PURE__ */ e.createElement(A, { type: r.type, className: "alert", onDismiss: () => this.setState({ alert: null }) }, r.element), /* @__PURE__ */ e.createElement("div", { className: "sidebarContainer" }, /* @__PURE__ */ e.createElement(K, null), /* @__PURE__ */ e.createElement("section", { className: "historyContent" }, /* @__PURE__ */ e.createElement(S, null, /* @__PURE__ */ e.createElement(d, { path: t.DisplayNameHistory.link, component: b }), /* @__PURE__ */ e.createElement(d, { path: t.EmailHistory.link, component: x }), /* @__PURE__ */ e.createElement(d, { path: t.PasswordHistory.link, component: B }), /* @__PURE__ */ e.createElement(u, { from: t.ProfileHistory.makePath(), to: t.DisplayNameHistory.makePath() }))))));
  }
}
export {
  K as SidebarNav,
  Q as default
};
