;
{
  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] = "2cbac8d6-1221-45a3-b12b-169fb3ee3b2d", e._sentryDebugIdIdentifier = "sentry-dbid-2cbac8d6-1221-45a3-b12b-169fb3ee3b2d");
  } catch (e) {
  }
}
;
import { jsxs, jsx, Fragment } from "preact/jsx-runtime";
import cx from "classnames";
import { A as Avatar } from "./Avatar-9UrQk3Hf.js";
import { q as TaskStatuses, u as useTranslation, a1 as Skeleton, z as Typography } from "./StoreProvider-CqQrndhS.js";
import { T as Tag } from "./Tag-DdkVScyr.js";
import { O as OnboardingStatuses } from "./view-verification-status-VFcBydkR.js";
const embeddedStatus = "adyen-kyc-embedded-status";
const embeddedStatusLoading = "adyen-kyc-embedded-status-loading";
const embeddedStatusActionIndicator = "adyen-kyc-embedded-status-action-indicator";
const embeddedStatusInfo = "adyen-kyc-embedded-status-info";
const styles = {
  embeddedStatus,
  embeddedStatusLoading,
  embeddedStatusActionIndicator,
  embeddedStatusInfo
};
const statusToTag = (status, uiT) => {
  switch (status) {
    case TaskStatuses.FINISHED:
    case OnboardingStatuses.VERIFIED:
      return { text: uiT(($) => $["verified"]), variant: "green" };
    case TaskStatuses.SIGNED:
    case OnboardingStatuses.REJECTED:
      return { text: uiT(($) => $["rejected"]), variant: "red" };
    case TaskStatuses.ERROR:
      return { text: uiT(($) => $["actionNeeded"]), variant: "red" };
    case TaskStatuses.PROCESSING:
    case OnboardingStatuses.IN_REVIEW:
    case OnboardingStatuses.AWAITING_DATA:
      return { text: uiT(($) => $["inReview"]), variant: "grey" };
    case OnboardingStatuses.UNSUCCESSFUL:
      return { text: uiT(($) => $["unsuccessful"]), variant: "red" };
    default:
      return void 0;
  }
};
const EmbeddedStatus = ({
  title,
  subtitle,
  status,
  tag,
  iconName = "user",
  loading = false,
  onClick,
  light = false,
  className,
  actionIndicator,
  ...props
}) => {
  const { t } = useTranslation("ui");
  const statusTag = status ? statusToTag(status, t) : tag;
  const avatarVariant = light ? "tertiary" : "secondary";
  return /* @__PURE__ */ jsxs(
    "button",
    {
      type: "button",
      className: cx(className, styles.embeddedStatus, "adyen-kyc-externalComponent", {
        [styles.embeddedStatusLoading]: loading,
        [styles.embeddedStatusLight]: light
      }),
      onClick,
      ...props,
      children: [
        loading ? /* @__PURE__ */ jsx(Skeleton, { height: "44px", width: "44px", circle: true }) : /* @__PURE__ */ jsx(Avatar, { iconName, variant: avatarVariant, circle: true }),
        /* @__PURE__ */ jsx("section", { className: styles.embeddedStatusInfo, children: loading ? /* @__PURE__ */ jsxs(Fragment, { children: [
          /* @__PURE__ */ jsx(Skeleton, { text: true, width: "20ch", height: "1em" }),
          /* @__PURE__ */ jsx(Skeleton, { text: true, width: "90%", height: "1em" })
        ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
          /* @__PURE__ */ jsx(Typography, { variant: "body-stronger", el: "h3", children: title }),
          /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", el: "div", children: subtitle })
        ] }) }),
        actionIndicator ? /* @__PURE__ */ jsx("section", { children: loading ? /* @__PURE__ */ jsx(Skeleton, { width: "5em", height: "2em" }) : /* @__PURE__ */ jsx(
          Typography,
          {
            el: "div",
            variant: "body-stronger",
            className: styles.embeddedStatusActionIndicator,
            children: actionIndicator.text
          }
        ) }) : statusTag?.text && /* @__PURE__ */ jsx("section", { children: loading ? /* @__PURE__ */ jsx(Skeleton, { width: "8ch", height: "1em" }) : /* @__PURE__ */ jsx(Tag, { variant: statusTag.variant, children: statusTag.text }) })
      ]
    }
  );
};
export {
  EmbeddedStatus as E,
  statusToTag as s
};
