// @ts-ignore
import jcb from "./cardPng/JCB.png";
// @ts-ignore
import amex from "./cardPng/AMEX.png";
// @ts-ignore
import masterCard from "./cardPng/MasterCard.png";
// @ts-ignore
import visa from "./cardPng/VISA.png";
// @ts-ignore
import unionPay from "./cardPng/UnionPay.png";
// @ts-ignore
import discover from "./cardPng/Discover.png";
var isJcb = function isJcb(str) {
  return str.startsWith('35');
};
var isAmex = function isAmex(str) {
  return str.startsWith('34') || str.startsWith('37');
};
var isMasterCard = function 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');
};
var isVisa = function isVisa(str) {
  return str.startsWith('4');
};
var isUnionPay = function isUnionPay(str) {
  return str.startsWith('62') || str.startsWith('81');
};
var isDiscover = function isDiscover(str) {
  return str.startsWith('60') || str.startsWith('64') || str.startsWith('65');
};
export var getCardType = function 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';
  }
};
export var bankTypeMap = {
  jcb: jcb,
  amex: amex,
  masterCard: masterCard,
  visa: visa,
  unionPay: unionPay,
  discover: discover
};
export var getCardImgByType = function getCardImgByType(type) {
  return bankTypeMap[type] || "";
};
export var getBankCardTypeImg = function getBankCardTypeImg(val) {
  var type = getCardType("".concat(val || ''));
  return type ? bankTypeMap[type] : null;
};