import { jsx as a, jsxs as t } from "react/jsx-runtime";
import { useState as u } from "react";
import { c as o } from "../../clsx-0c6e471a.js";
import { useLocalizationContext as c } from "../../contexts/LocalizationContext.js";
import { useDocumentPasswordContext as _ } from "../../contexts/DocumentPasswordContext.js";
import '../../assets/PasswordModal.css';const r = {
  "rp-password-overlay": "_rp-password-overlay_18s56_1",
  "rp-password-modal": "_rp-password-modal_18s56_13",
  "rp-password-title": "_rp-password-title_18s56_27",
  "rp-password-content": "_rp-password-content_18s56_35",
  "rp-password-form": "_rp-password-form_18s56_41",
  "rp-password-input": "_rp-password-input_18s56_45",
  "rp-password-input-invalid": "_rp-password-input-invalid_18s56_62",
  "rp-password-message-invalid": "_rp-password-message-invalid_18s56_66",
  "rp-password-submit-button": "_rp-password-submit-button_18s56_72"
}, P = () => {
  const [p, e] = u(""), { localeMessages: s } = c(), { setPassword: m, invalidPassword: i } = _(), w = (d) => {
    e(d.target.value);
  }, n = (d) => {
    d.preventDefault(), p && p.trim() && m(p);
  }, l = !p.trim();
  return /* @__PURE__ */ a("div", { className: o(r["rp-password-overlay"]), children: /* @__PURE__ */ t("div", { className: o(r["rp-password-modal"]), children: [
    /* @__PURE__ */ a("div", { className: o(r["rp-password-title"]), children: s == null ? void 0 : s.passwordModalTitle }),
    /* @__PURE__ */ a("div", { className: o(r["rp-password-content"]), children: s == null ? void 0 : s.passwordModalMessage }),
    /* @__PURE__ */ t("form", { onSubmit: n, children: [
      /* @__PURE__ */ t("div", { className: o(r["rp-password-form"]), children: [
        /* @__PURE__ */ a(
          "input",
          {
            type: "password",
            value: p,
            onChange: w,
            className: o(
              r["rp-password-input"],
              i && r["rp-password-input-invalid"]
            ),
            placeholder: s == null ? void 0 : s.passwordPlaceholder,
            autoComplete: "off"
          }
        ),
        /* @__PURE__ */ a("div", { className: o(r["rp-password-message-invalid"]), children: i && /* @__PURE__ */ a("span", { children: s == null ? void 0 : s.passwordError }) })
      ] }),
      /* @__PURE__ */ a(
        "button",
        {
          type: "submit",
          disabled: l,
          className: o(r["rp-password-submit-button"]),
          onClick: n,
          children: s == null ? void 0 : s.passwordConfirmLabel
        }
      )
    ] })
  ] }) });
};
export {
  P as default
};
