import { jsx as t } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js";
import { useMemo as f } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js";
import y from "../../../../internal/Card/Card.js";
import { Tag as T } from "../../../../internal/Tag/Tag.js";
import { TagVariant as n } from "../../../../internal/Tag/types.js";
import { TypographyVariant as i, TypographyElement as u } from "../../../../internal/Typography/types.js";
import m from "../../../../internal/Typography/Typography.js";
import A from "../../../../../hooks/useTimezoneAwareDateFormatting.js";
/* empty css                        */
import h from "../../../../../core/Context/preact/useCoreContext.js";
import { DATE_FORMAT_PAYMENT_LINK_DETAILS_SUMMARY as S } from "../../../../../constants/dateFormats.js";
const s = {
  root: "adyen-pe-payment-link-summary",
  content: "adyen-pe-payment-link-summary__content",
  expiresLabel: "adyen-pe-payment-link-summary__expires-label"
}, M = ({ paymentLink: r }) => {
  const { i18n: e } = h(), { dateFormat: c } = A(), a = r?.linkInformation.status, p = (o) => {
    switch (o) {
      case "active":
        return n.BLUE;
      case "completed":
        return n.SUCCESS;
      case "expired":
        return n.DEFAULT;
      case "paymentPending":
        return n.WARNING;
      default:
        return n.DEFAULT;
    }
  }, d = f(() => {
    if (!r?.linkInformation.amount) return null;
    const { value: o, currency: l } = r.linkInformation.amount;
    return `${e.amount(o, l, { hideCurrency: !0 })} ${l}`;
  }, [e, r?.linkInformation.amount]);
  return /* @__PURE__ */ t(y, { classNameModifiers: [s.root], children: /* @__PURE__ */ t("div", { className: s.content, children: [
    /* @__PURE__ */ t(T, { variant: p(a), children: e.has(`payByLink.common.status.${a}`) ? e.get(`payByLink.common.status.${a}`) : r?.linkInformation.status }),
    /* @__PURE__ */ t(m, { variant: i.TITLE, large: !0, children: d }),
    /* @__PURE__ */ t("div", { children: [
      /* @__PURE__ */ t(m, { el: u.SPAN, variant: i.BODY, className: s.expiresLabel, children: `${e.get("payByLink.details.fields.expiresOn")}: ` }),
      /* @__PURE__ */ t(m, { el: u.SPAN, variant: i.BODY, children: c(r.linkInformation.expirationDate, S) })
    ] })
  ] }) });
};
export {
  M as PaymentLinkSummary
};
