;
{
  try {
    let e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
    n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "42317edb-4c75-40f5-a25b-3529e69036bb", e._sentryDebugIdIdentifier = "sentry-dbid-42317edb-4c75-40f5-a25b-3529e69036bb");
  } catch (e) {
  }
}
;
import { jsx } from "preact/jsx-runtime";
import { u as useTranslation } from "./StoreProvider-CqQrndhS.js";
import { a as Alert } from "./Alert-CpDg47bv.js";
const VerificationErrorAlert = ({
  className,
  problems,
  children,
  fallbackErrorMessage
}) => {
  const { t } = useTranslation("common");
  if (problems?.verificationErrors && Object.keys(problems.verificationErrors).length > 0) {
    const childErrors = Object.values(problems.verificationErrors).reduce(
      (acc, parentChildErrors) => {
        acc = { ...acc, ...parentChildErrors };
        return acc;
      },
      {}
    );
    const childErrorCodes = Object.keys(childErrors);
    if (childErrorCodes.length === 1) {
      const remediationActions = Object.values(childErrors?.[childErrorCodes?.[0]] ?? {}).flat();
      if (remediationActions.length === 1) {
        const childErrorMsg = t(($) => $[`errorMessage_${childErrorCodes[0]}`]);
        const remediationActionMsg = t(
          ($) => $[`remediationMessage_${remediationActions[0].code}`]
        );
        return /* @__PURE__ */ jsx(
          Alert,
          {
            className,
            variant: "error",
            title: `${childErrorMsg}. ${remediationActionMsg}`,
            children
          }
        );
      }
    }
  }
  return /* @__PURE__ */ jsx(
    Alert,
    {
      className,
      variant: "error",
      title: fallbackErrorMessage ?? t(($) => $["verificationErrorMessage"]),
      children
    }
  );
};
export {
  VerificationErrorAlert as V
};
