import jcb from "./cardPng/JCB.png";
import amex from "./cardPng/AMEX.png";
import masterCard from "./cardPng/MasterCard.png";
import visa from "./cardPng/VISA.png";
import unionPay from "./cardPng/UnionPay.png";
import discover from "./cardPng/Discover.png";
//#region src/components/pisellInput/components/BankCard/utils.ts
const isJcb = (str) => {
	return str.startsWith("35");
};
const isAmex = (str) => {
	return str.startsWith("34") || str.startsWith("37");
};
const isMasterCard = (str) => {
	return str.startsWith("51") || str.startsWith("52") || str.startsWith("53") || str.startsWith("54") || str.startsWith("55") || str.startsWith("22") || str.startsWith("23") || str.startsWith("24") || str.startsWith("25") || str.startsWith("26") || str.startsWith("27");
};
const isVisa = (str) => {
	return str.startsWith("4");
};
const isUnionPay = (str) => {
	return str.startsWith("62") || str.startsWith("81");
};
const isDiscover = (str) => {
	return str.startsWith("60") || str.startsWith("64") || str.startsWith("65");
};
const getCardType = (str) => {
	if (isJcb(str)) return "jcb";
	if (isAmex(str)) return "amex";
	if (isVisa(str)) return "visa";
	if (isMasterCard(str)) return "masterCard";
	if (isUnionPay(str)) return "unionPay";
	if (isDiscover(str)) return "discover";
};
const bankTypeMap = {
	jcb,
	amex,
	masterCard,
	visa,
	unionPay,
	discover
};
const getBankCardTypeImg = (val) => {
	const type = getCardType(`${val || ""}`);
	return type ? bankTypeMap[type] : null;
};
//#endregion
export { bankTypeMap, getBankCardTypeImg, getCardType };
