import { Button as n, ButtonType as m, ButtonStyle as d } from "./accelbyte-widgets107.mjs";
import { Dialog as p, DialogBody as c, DialogFooter as u } from "./accelbyte-widgets235.mjs";
import { FormGroupError as g, FormGroup as f } from "./accelbyte-widgets263.mjs";
import { InputGroup as w } from "./accelbyte-widgets229.mjs";
import { t as l } from "./accelbyte-widgets58.mjs";
import e from "react";
import { Trans as r } from "react-i18next";
import "./accelbyte-widgets485.mjs";
import { validateComplexPassword as E, ValidateComplexPasswordErrorType as y } from "./accelbyte-widgets285.mjs";
import { Validation as C } from "./accelbyte-widgets269.mjs";
class K extends e.Component {
  constructor(t) {
    super(t), this.onPasswordChange = (a) => {
      const o = a.target.value;
      this.validation.set("password", E(o)), this.setState({ password: o });
    }, this.state = {
      password: ""
    }, this.validation = new C(), this.validation.listen(() => this.setState({}));
  }
  renderErrorType(t) {
    return t === y.enum.empty ? /* @__PURE__ */ e.createElement(g, null, /* @__PURE__ */ e.createElement(r, { i18nKey: "PersonalDataPage.inputPasswordForm.inputPasswordError.empty" }, "Input your password to proceed")) : null;
  }
  render() {
    const { password: t } = this.state, { onCancel: a, onConfirm: o, dateRequest: s } = this.props;
    return /* @__PURE__ */ e.createElement(p, { className: "cancelConfirmDialog", title: l("PersonalDataPage.downloadConfirmDialog.title"), isOpen: !0 }, /* @__PURE__ */ e.createElement(c, { className: "dialogBody" }, /* @__PURE__ */ e.createElement("div", { className: "bodyText" }, /* @__PURE__ */ e.createElement(r, { i18nKey: "PersonalDataPage.downloadConfirmDialog.bodyText" }, "Input your password to download")), /* @__PURE__ */ e.createElement(
      "form",
      {
        className: "form",
        onSubmit: (i) => {
          i.preventDefault();
        }
      },
      /* @__PURE__ */ e.createElement(f, null, /* @__PURE__ */ e.createElement(
        w,
        {
          className: "inputRedeem",
          type: "password",
          value: t,
          placeholder: l("PersonalDataPage.form.passwordPlaceholder"),
          onChange: this.onPasswordChange
        }
      ), this.renderErrorType(this.validation.get("password")))
    )), /* @__PURE__ */ e.createElement(u, { className: "dialogFooter" }, /* @__PURE__ */ e.createElement("div", { className: "btnContainer" }, /* @__PURE__ */ e.createElement(
      n,
      {
        className: "btn btn-ghost big btnCancel",
        buttonType: m.TEXT,
        buttonStyle: d.NONE,
        onClick: () => {
          a && a();
        }
      },
      /* @__PURE__ */ e.createElement(r, { i18nKey: "PersonalDataPage.downloadConfirmDialog.cancel" }, "Cancel")
    ), /* @__PURE__ */ e.createElement(
      n,
      {
        className: "btn btn-primary big btnDownload",
        onClick: () => {
          o && o(s, t);
        }
      },
      /* @__PURE__ */ e.createElement(r, { i18nKey: "PersonalDataPage.cancelDialogConfirm.download" }, "Download")
    ))));
  }
}
export {
  K as DownloadConfirmDialog
};
