import { Grid as Grid$1 } from "../../../UI/Grid.mjs";
import { c } from "react-compiler-runtime";
import React from "react";
import { Card, CardContent, Chip, Typography } from "@material-ui/core";
import eCheckLogo from "../../../assets/paymentIcons/echeck-logo.svg";
//#region src/utilities/form/paymentForm/PaymentBankDetails.tsx
const logos = { default: eCheckLogo };
/**
* PaymentBankDetails component displays the bank details of a payment method.
* It shows the card logo, nickname, routing number, and an inactive chip if the card is not active.
*
* @param {Object} props - The component props.
* @param {CardData} props.bankData - The bank data containing payment token and routing number.
* @returns {JSX.Element} The rendered PaymentBankDetails component.
*/
const PaymentBankDetails = (t0) => {
	const $ = c(24);
	const { bankData } = t0;
	let t1;
	if ($[0] !== bankData) {
		t1 = bankData || {};
		$[0] = bankData;
		$[1] = t1;
	} else t1 = $[1];
	const { paymentToken, routingNumber } = t1;
	const getCardLogo = _temp;
	let t2;
	if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
		t2 = {
			card: {
				border: 0,
				padding: "5px 15px",
				width: "100%"
			},
			logoContainer: {
				border: "2px solid #e0e0e0",
				borderRadius: "8px",
				padding: "8px",
				display: "flex",
				justifyContent: "center",
				alignItems: "center",
				height: "42px",
				width: "70px"
			},
			logoImage: {
				width: 52,
				height: "auto",
				objectFit: "contain"
			},
			nickname: { fontWeight: 600 },
			expiration: { fontWeight: 400 },
			expiredChip: { fontWeight: "bold" }
		};
		$[2] = t2;
	} else t2 = $[2];
	const styles = t2;
	const t3 = styles.card;
	let t4;
	if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
		t4 = { padding: "5px 0" };
		$[3] = t4;
	} else t4 = $[3];
	const t5 = styles.logoContainer;
	const t6 = paymentToken?.nickname || "";
	let t7;
	if ($[4] !== t6) {
		t7 = getCardLogo(t6);
		$[4] = t6;
		$[5] = t7;
	} else t7 = $[5];
	let t8;
	if ($[6] !== t7) {
		t8 = /* @__PURE__ */ React.createElement(Grid$1, { item: true }, /* @__PURE__ */ React.createElement("div", { style: t5 }, /* @__PURE__ */ React.createElement("img", {
			src: t7,
			alt: "Card Logo",
			style: styles.logoImage
		})));
		$[6] = t7;
		$[7] = t8;
	} else t8 = $[7];
	const t9 = paymentToken?.nickname || "Unknown Card";
	let t10;
	if ($[8] !== t9) {
		t10 = /* @__PURE__ */ React.createElement(Typography, {
			variant: "body1",
			style: styles.nickname
		}, t9);
		$[8] = t9;
		$[9] = t10;
	} else t10 = $[9];
	const t11 = routingNumber ? routingNumber : "N/A";
	let t12;
	if ($[10] !== t11) {
		t12 = /* @__PURE__ */ React.createElement(Typography, {
			variant: "subtitle2",
			color: "textSecondary",
			style: styles.expiration
		}, "Routing Number: ", " ", t11);
		$[10] = t11;
		$[11] = t12;
	} else t12 = $[11];
	let t13;
	if ($[12] !== t10 || $[13] !== t12) {
		t13 = /* @__PURE__ */ React.createElement(Grid$1, {
			item: true,
			xs: true
		}, t10, t12);
		$[12] = t10;
		$[13] = t12;
		$[14] = t13;
	} else t13 = $[14];
	let t14;
	if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
		t14 = { marginRight: "15px" };
		$[15] = t14;
	} else t14 = $[15];
	let t15;
	if ($[16] !== paymentToken?.active) {
		t15 = !paymentToken?.active && /* @__PURE__ */ React.createElement(Chip, {
			label: "Inactive",
			color: "secondary",
			size: "small",
			style: styles.expiredChip
		});
		$[16] = paymentToken?.active;
		$[17] = t15;
	} else t15 = $[17];
	let t16;
	if ($[18] !== t15) {
		t16 = /* @__PURE__ */ React.createElement(Grid$1, {
			item: true,
			style: t14
		}, t15);
		$[18] = t15;
		$[19] = t16;
	} else t16 = $[19];
	let t17;
	if ($[20] !== t13 || $[21] !== t16 || $[22] !== t8) {
		t17 = /* @__PURE__ */ React.createElement(Card, {
			variant: "outlined",
			style: t3
		}, /* @__PURE__ */ React.createElement(CardContent, { style: t4 }, /* @__PURE__ */ React.createElement(Grid$1, {
			container: true,
			alignItems: "center",
			spacing: 2
		}, t8, t13, t16)));
		$[20] = t13;
		$[21] = t16;
		$[22] = t8;
		$[23] = t17;
	} else t17 = $[23];
	return t17;
};
function _temp(nickname) {
	if ((nickname?.toLowerCase()).includes("visa")) return logos.default;
	return logos.default;
}
//#endregion
export { PaymentBankDetails };

//# sourceMappingURL=PaymentBankDetails.mjs.map