import {type CountryCode as LibPhoneNumberJsCountryCode} from 'libphonenumber-js'

// Exclude Ascension Island and Tristan da Cunha - merged into `SH` in 2009
export type CountryCode = Exclude<LibPhoneNumberJsCountryCode, 'AC' | 'TA'>

/**
 * Note: data is from Wikipedia, but some have been removed to match `libphonenumber-js`
 * Mostly tiny British overseas territories + Antarctica, all of which
 * share codes with a larger country. If you've one of the 10 people from these
 * places, you probably know what to do.
 */
export const INTERNATIONAL_TELEPHONE_CODES = {
  AD: {
    code: '+376',
    unicodeFlag: '🇦🇩',
    svgFlag: require('../../assets/icons/flags/AD.svg'),
  },
  AF: {
    code: '+93',
    unicodeFlag: '🇦🇫',
    svgFlag: require('../../assets/icons/flags/AF.svg'),
  },
  AG: {
    code: '+1268',
    unicodeFlag: '🇦🇬',
    svgFlag: require('../../assets/icons/flags/AG.svg'),
  },
  AI: {
    code: '+1264',
    unicodeFlag: '🇦🇮',
    svgFlag: require('../../assets/icons/flags/AI.svg'),
  },
  AL: {
    code: '+355',
    unicodeFlag: '🇦🇱',
    svgFlag: require('../../assets/icons/flags/AL.svg'),
  },
  AM: {
    code: '+374',
    unicodeFlag: '🇦🇲',
    svgFlag: require('../../assets/icons/flags/AM.svg'),
  },
  AO: {
    code: '+244',
    unicodeFlag: '🇦🇴',
    svgFlag: require('../../assets/icons/flags/AO.svg'),
  },
  // sorry penguins :(
  // same as Norfolk Island
  // AQ: {
  //   code: '+672',
  //   unicodeFlag: '🇦🇶',
  //   svgFlag: require('../../assets/icons/flags/AQ.svg'),
  // },
  AR: {
    code: '+54',
    unicodeFlag: '🇦🇷',
    svgFlag: require('../../assets/icons/flags/AR.svg'),
  },
  AS: {
    code: '+1684',
    unicodeFlag: '🇦🇸',
    svgFlag: require('../../assets/icons/flags/AS.svg'),
  },
  AT: {
    code: '+43',
    unicodeFlag: '🇦🇹',
    svgFlag: require('../../assets/icons/flags/AT.svg'),
  },
  AU: {
    code: '+61',
    unicodeFlag: '🇦🇺',
    svgFlag: require('../../assets/icons/flags/AU.svg'),
  },
  AW: {
    code: '+297',
    unicodeFlag: '🇦🇼',
    svgFlag: require('../../assets/icons/flags/AW.svg'),
  },
  AX: {
    code: '+358',
    unicodeFlag: '🇦🇽',
    svgFlag: require('../../assets/icons/flags/AX.svg'),
  },
  AZ: {
    code: '+994',
    unicodeFlag: '🇦🇿',
    svgFlag: require('../../assets/icons/flags/AZ.svg'),
  },
  BA: {
    code: '+387',
    unicodeFlag: '🇧🇦',
    svgFlag: require('../../assets/icons/flags/BA.svg'),
  },
  BB: {
    code: '+1246',
    unicodeFlag: '🇧🇧',
    svgFlag: require('../../assets/icons/flags/BB.svg'),
  },
  BD: {
    code: '+880',
    unicodeFlag: '🇧🇩',
    svgFlag: require('../../assets/icons/flags/BD.svg'),
  },
  BE: {
    code: '+32',
    unicodeFlag: '🇧🇪',
    svgFlag: require('../../assets/icons/flags/BE.svg'),
  },
  BF: {
    code: '+226',
    unicodeFlag: '🇧🇫',
    svgFlag: require('../../assets/icons/flags/BF.svg'),
  },
  BG: {
    code: '+359',
    unicodeFlag: '🇧🇬',
    svgFlag: require('../../assets/icons/flags/BG.svg'),
  },
  BH: {
    code: '+973',
    unicodeFlag: '🇧🇭',
    svgFlag: require('../../assets/icons/flags/BH.svg'),
  },
  BI: {
    code: '+257',
    unicodeFlag: '🇧🇮',
    svgFlag: require('../../assets/icons/flags/BI.svg'),
  },
  BJ: {
    code: '+229',
    unicodeFlag: '🇧🇯',
    svgFlag: require('../../assets/icons/flags/BJ.svg'),
  },
  BL: {
    code: '+590',
    unicodeFlag: '🇧🇱',
    svgFlag: require('../../assets/icons/flags/BL.svg'),
  },
  BM: {
    code: '+1441',
    unicodeFlag: '🇧🇲',
    svgFlag: require('../../assets/icons/flags/BM.svg'),
  },
  BN: {
    code: '+673',
    unicodeFlag: '🇧🇳',
    svgFlag: require('../../assets/icons/flags/BN.svg'),
  },
  BO: {
    code: '+591',
    unicodeFlag: '🇧🇴',
    svgFlag: require('../../assets/icons/flags/BO.svg'),
  },
  BQ: {
    code: '+5997',
    unicodeFlag: '🇧🇶',
    svgFlag: require('../../assets/icons/flags/BQ.svg'),
  },
  BR: {
    code: '+55',
    unicodeFlag: '🇧🇷',
    svgFlag: require('../../assets/icons/flags/BR.svg'),
  },
  BT: {
    code: '+975',
    unicodeFlag: '🇧🇹',
    svgFlag: require('../../assets/icons/flags/BT.svg'),
  },
  // same as Norway
  // BV: {
  //   code: '+47',
  //   unicodeFlag: '🇧🇻',
  //   svgFlag: require('../../assets/icons/flags/BV.svg'),
  // },
  BW: {
    code: '+267',
    unicodeFlag: '🇧🇼',
    svgFlag: require('../../assets/icons/flags/BW.svg'),
  },
  BY: {
    code: '+375',
    unicodeFlag: '🇧🇾',
    svgFlag: require('../../assets/icons/flags/BY.svg'),
  },
  BZ: {
    code: '+501',
    unicodeFlag: '🇧🇿',
    svgFlag: require('../../assets/icons/flags/BZ.svg'),
  },
  CA: {
    code: '+1',
    unicodeFlag: '🇨🇦',
    svgFlag: require('../../assets/icons/flags/CA.svg'),
  },
  CH: {
    code: '+41',
    unicodeFlag: '🇨🇭',
    svgFlag: require('../../assets/icons/flags/CH.svg'),
  },
  CI: {
    code: '+225',
    unicodeFlag: '🇨🇮',
    svgFlag: require('../../assets/icons/flags/CI.svg'),
  },
  CL: {
    code: '+56',
    unicodeFlag: '🇨🇱',
    svgFlag: require('../../assets/icons/flags/CL.svg'),
  },
  CM: {
    code: '+237',
    unicodeFlag: '🇨🇲',
    svgFlag: require('../../assets/icons/flags/CM.svg'),
  },
  CN: {
    code: '+86',
    unicodeFlag: '🇨🇳',
    svgFlag: require('../../assets/icons/flags/CN.svg'),
  },
  CO: {
    code: '+57',
    unicodeFlag: '🇨🇴',
    svgFlag: require('../../assets/icons/flags/CO.svg'),
  },
  CR: {
    code: '+506',
    unicodeFlag: '🇨🇷',
    svgFlag: require('../../assets/icons/flags/CR.svg'),
  },
  CU: {
    code: '+53',
    unicodeFlag: '🇨🇺',
    svgFlag: require('../../assets/icons/flags/CU.svg'),
  },
  CV: {
    code: '+238',
    unicodeFlag: '🇨🇻',
    svgFlag: require('../../assets/icons/flags/CV.svg'),
  },
  CW: {
    code: '+599',
    unicodeFlag: '🇨🇼',
    svgFlag: require('../../assets/icons/flags/CW.svg'),
  },
  CX: {
    code: '+61',
    unicodeFlag: '🇨🇽',
    svgFlag: require('../../assets/icons/flags/CX.svg'),
  },
  CY: {
    code: '+357',
    unicodeFlag: '🇨🇾',
    svgFlag: require('../../assets/icons/flags/CY.svg'),
  },
  DE: {
    code: '+49',
    unicodeFlag: '🇩🇪',
    svgFlag: require('../../assets/icons/flags/DE.svg'),
  },
  DJ: {
    code: '+253',
    unicodeFlag: '🇩🇯',
    svgFlag: require('../../assets/icons/flags/DJ.svg'),
  },
  DK: {
    code: '+45',
    unicodeFlag: '🇩🇰',
    svgFlag: require('../../assets/icons/flags/DK.svg'),
  },
  DM: {
    code: '+767',
    unicodeFlag: '🇩🇲',
    svgFlag: require('../../assets/icons/flags/DM.svg'),
  },
  DZ: {
    code: '+213',
    unicodeFlag: '🇩🇿',
    svgFlag: require('../../assets/icons/flags/DZ.svg'),
  },
  EC: {
    code: '+593',
    unicodeFlag: '🇪🇨',
    svgFlag: require('../../assets/icons/flags/EC.svg'),
  },
  EE: {
    code: '+372',
    unicodeFlag: '🇪🇪',
    svgFlag: require('../../assets/icons/flags/EE.svg'),
  },
  EG: {
    code: '+20',
    unicodeFlag: '🇪🇬',
    svgFlag: require('../../assets/icons/flags/EG.svg'),
  },
  EH: {
    code: '+212',
    unicodeFlag: '🇪🇭',
    svgFlag: require('../../assets/icons/flags/EH.svg'),
  },
  ER: {
    code: '+291',
    unicodeFlag: '🇪🇷',
    svgFlag: require('../../assets/icons/flags/ER.svg'),
  },
  ES: {
    code: '+34',
    unicodeFlag: '🇪🇸',
    svgFlag: require('../../assets/icons/flags/ES.svg'),
  },
  ET: {
    code: '+251',
    unicodeFlag: '🇪🇹',
    svgFlag: require('../../assets/icons/flags/ET.svg'),
  },
  FI: {
    code: '+358',
    unicodeFlag: '🇫🇮',
    svgFlag: require('../../assets/icons/flags/FI.svg'),
  },
  FJ: {
    code: '+679',
    unicodeFlag: '🇫🇯',
    svgFlag: require('../../assets/icons/flags/FJ.svg'),
  },
  FM: {
    code: '+691',
    unicodeFlag: '🇫🇲',
    svgFlag: require('../../assets/icons/flags/FM.svg'),
  },
  FR: {
    code: '+33',
    unicodeFlag: '🇫🇷',
    svgFlag: require('../../assets/icons/flags/FR.svg'),
  },
  GA: {
    code: '+241',
    unicodeFlag: '🇬🇦',
    svgFlag: require('../../assets/icons/flags/GA.svg'),
  },
  GD: {
    code: '+1473',
    unicodeFlag: '🇬🇩',
    svgFlag: require('../../assets/icons/flags/GD.svg'),
  },
  GE: {
    code: '+995',
    unicodeFlag: '🇬🇪',
    svgFlag: require('../../assets/icons/flags/GE.svg'),
  },
  GF: {
    code: '+594',
    unicodeFlag: '🇬🇫',
    svgFlag: require('../../assets/icons/flags/GF.svg'),
  },
  GG: {
    code: '+44',
    unicodeFlag: '🇬🇬',
    svgFlag: require('../../assets/icons/flags/GG.svg'),
  },
  GH: {
    code: '+233',
    unicodeFlag: '🇬🇭',
    svgFlag: require('../../assets/icons/flags/GH.svg'),
  },
  GI: {
    code: '+350',
    unicodeFlag: '🇬🇮',
    svgFlag: require('../../assets/icons/flags/GI.svg'),
  },
  GL: {
    code: '+299',
    unicodeFlag: '🇬🇱',
    svgFlag: require('../../assets/icons/flags/GL.svg'),
  },
  GN: {
    code: '+224',
    unicodeFlag: '🇬🇳',
    svgFlag: require('../../assets/icons/flags/GN.svg'),
  },
  GP: {
    code: '+590',
    unicodeFlag: '🇬🇵',
    svgFlag: require('../../assets/icons/flags/GP.svg'),
  },
  GQ: {
    code: '+240',
    unicodeFlag: '🇬🇶',
    svgFlag: require('../../assets/icons/flags/GQ.svg'),
  },
  GR: {
    code: '+30',
    unicodeFlag: '🇬🇷',
    svgFlag: require('../../assets/icons/flags/GR.svg'),
  },
  // same as Falkland Islands
  // GS: {
  //   code: '+500',
  //   unicodeFlag: '🇬🇸',
  //   svgFlag: require('../../assets/icons/flags/GS.svg'),
  // },
  GT: {
    code: '+502',
    unicodeFlag: '🇬🇹',
    svgFlag: require('../../assets/icons/flags/GT.svg'),
  },
  GU: {
    code: '+1',
    unicodeFlag: '🇬🇺',
    svgFlag: require('../../assets/icons/flags/GU.svg'),
  },
  GW: {
    code: '+245',
    unicodeFlag: '🇬🇼',
    svgFlag: require('../../assets/icons/flags/GW.svg'),
  },
  GY: {
    code: '+592',
    unicodeFlag: '🇬🇾',
    svgFlag: require('../../assets/icons/flags/GY.svg'),
  },
  HK: {
    code: '+852',
    unicodeFlag: '🇭🇰',
    svgFlag: require('../../assets/icons/flags/HK.svg'),
  },
  HN: {
    code: '+504',
    unicodeFlag: '🇭🇳',
    svgFlag: require('../../assets/icons/flags/HN.svg'),
  },
  HR: {
    code: '+385',
    unicodeFlag: '🇭🇷',
    svgFlag: require('../../assets/icons/flags/HR.svg'),
  },
  HT: {
    code: '+509',
    unicodeFlag: '🇭🇹',
    svgFlag: require('../../assets/icons/flags/HT.svg'),
  },
  HU: {
    code: '+36',
    unicodeFlag: '🇭🇺',
    svgFlag: require('../../assets/icons/flags/HU.svg'),
  },
  ID: {
    code: '+62',
    unicodeFlag: '🇮🇩',
    svgFlag: require('../../assets/icons/flags/ID.svg'),
  },
  IE: {
    code: '+353',
    unicodeFlag: '🇮🇪',
    svgFlag: require('../../assets/icons/flags/IE.svg'),
  },
  IL: {
    code: '+972',
    unicodeFlag: '🇮🇱',
    svgFlag: require('../../assets/icons/flags/IL.svg'),
  },
  IM: {
    code: '+44',
    unicodeFlag: '🇮🇲',
    svgFlag: require('../../assets/icons/flags/IM.svg'),
  },
  IN: {
    code: '+91',
    unicodeFlag: '🇮🇳',
    svgFlag: require('../../assets/icons/flags/IN.svg'),
  },
  IO: {
    code: '+246',
    unicodeFlag: '🇮🇴',
    svgFlag: require('../../assets/icons/flags/IO.svg'),
  },
  IQ: {
    code: '+964',
    unicodeFlag: '🇮🇶',
    svgFlag: require('../../assets/icons/flags/IQ.svg'),
  },
  IR: {
    code: '+98',
    unicodeFlag: '🇮🇷',
    svgFlag: require('../../assets/icons/flags/IR.svg'),
  },
  IS: {
    code: '+354',
    unicodeFlag: '🇮🇸',
    svgFlag: require('../../assets/icons/flags/IS.svg'),
  },
  IT: {
    code: '+39',
    unicodeFlag: '🇮🇹',
    svgFlag: require('../../assets/icons/flags/IT.svg'),
  },
  JE: {
    code: '+44',
    unicodeFlag: '🇯🇪',
    svgFlag: require('../../assets/icons/flags/JE.svg'),
  },
  JM: {
    code: '+876',
    unicodeFlag: '🇯🇲',
    svgFlag: require('../../assets/icons/flags/JM.svg'),
  },
  JO: {
    code: '+962',
    unicodeFlag: '🇯🇴',
    svgFlag: require('../../assets/icons/flags/JO.svg'),
  },
  JP: {
    code: '+81',
    unicodeFlag: '🇯🇵',
    svgFlag: require('../../assets/icons/flags/JP.svg'),
  },
  KE: {
    code: '+254',
    unicodeFlag: '🇰🇪',
    svgFlag: require('../../assets/icons/flags/KE.svg'),
  },
  KG: {
    code: '+996',
    unicodeFlag: '🇰🇬',
    svgFlag: require('../../assets/icons/flags/KG.svg'),
  },
  KH: {
    code: '+855',
    unicodeFlag: '🇰🇭',
    svgFlag: require('../../assets/icons/flags/KH.svg'),
  },
  KP: {
    code: '+850',
    unicodeFlag: '🇰🇵',
    svgFlag: require('../../assets/icons/flags/KP.svg'),
  },
  KR: {
    code: '+82',
    unicodeFlag: '🇰🇷',
    svgFlag: require('../../assets/icons/flags/KR.svg'),
  },
  KI: {
    code: '+686',
    unicodeFlag: '🇰🇮',
    svgFlag: require('../../assets/icons/flags/KI.svg'),
  },
  KN: {
    code: '+1869',
    unicodeFlag: '🇰🇳',
    svgFlag: require('../../assets/icons/flags/KN.svg'),
  },
  KW: {
    code: '+965',
    unicodeFlag: '🇰🇼',
    svgFlag: require('../../assets/icons/flags/KW.svg'),
  },
  KZ: {
    code: '+7',
    unicodeFlag: '🇰🇿',
    svgFlag: require('../../assets/icons/flags/KZ.svg'),
  },
  LB: {
    code: '+961',
    unicodeFlag: '🇱🇧',
    svgFlag: require('../../assets/icons/flags/LB.svg'),
  },
  LC: {
    code: '+1758',
    unicodeFlag: '🇱🇨',
    svgFlag: require('../../assets/icons/flags/LC.svg'),
  },
  LI: {
    code: '+423',
    unicodeFlag: '🇱🇮',
    svgFlag: require('../../assets/icons/flags/LI.svg'),
  },
  LK: {
    code: '+94',
    unicodeFlag: '🇱🇰',
    svgFlag: require('../../assets/icons/flags/LK.svg'),
  },
  LR: {
    code: '+231',
    unicodeFlag: '🇱🇷',
    svgFlag: require('../../assets/icons/flags/LR.svg'),
  },
  LS: {
    code: '+266',
    unicodeFlag: '🇱🇸',
    svgFlag: require('../../assets/icons/flags/LS.svg'),
  },
  LT: {
    code: '+370',
    unicodeFlag: '🇱🇹',
    svgFlag: require('../../assets/icons/flags/LT.svg'),
  },
  LU: {
    code: '+352',
    unicodeFlag: '🇱🇺',
    svgFlag: require('../../assets/icons/flags/LU.svg'),
  },
  LV: {
    code: '+371',
    unicodeFlag: '🇱🇻',
    svgFlag: require('../../assets/icons/flags/LV.svg'),
  },
  LY: {
    code: '+218',
    unicodeFlag: '🇱🇾',
    svgFlag: require('../../assets/icons/flags/LY.svg'),
  },
  MA: {
    code: '+212',
    unicodeFlag: '🇲🇦',
    svgFlag: require('../../assets/icons/flags/MA.svg'),
  },
  MC: {
    code: '+377',
    unicodeFlag: '🇲🇨',
    svgFlag: require('../../assets/icons/flags/MC.svg'),
  },
  ME: {
    code: '+382',
    unicodeFlag: '🇲🇪',
    svgFlag: require('../../assets/icons/flags/ME.svg'),
  },
  MF: {
    code: '+590',
    unicodeFlag: '🇲🇫',
    svgFlag: require('../../assets/icons/flags/MF.svg'),
  },
  MG: {
    code: '+261',
    unicodeFlag: '🇲🇬',
    svgFlag: require('../../assets/icons/flags/MG.svg'),
  },
  ML: {
    code: '+223',
    unicodeFlag: '🇲🇱',
    svgFlag: require('../../assets/icons/flags/ML.svg'),
  },
  MM: {
    code: '+95',
    unicodeFlag: '🇲🇲',
    svgFlag: require('../../assets/icons/flags/MM.svg'),
  },
  MN: {
    code: '+976',
    unicodeFlag: '🇲🇳',
    svgFlag: require('../../assets/icons/flags/MN.svg'),
  },
  MO: {
    code: '+853',
    unicodeFlag: '🇲🇴',
    svgFlag: require('../../assets/icons/flags/MO.svg'),
  },
  MQ: {
    code: '+596',
    unicodeFlag: '🇲🇶',
    svgFlag: require('../../assets/icons/flags/MQ.svg'),
  },
  MR: {
    code: '+222',
    unicodeFlag: '🇲🇷',
    svgFlag: require('../../assets/icons/flags/MR.svg'),
  },
  MS: {
    code: '+1664',
    unicodeFlag: '🇲🇸',
    svgFlag: require('../../assets/icons/flags/MS.svg'),
  },
  MT: {
    code: '+356',
    unicodeFlag: '🇲🇹',
    svgFlag: require('../../assets/icons/flags/MT.svg'),
  },
  MU: {
    code: '+230',
    unicodeFlag: '🇲🇺',
    svgFlag: require('../../assets/icons/flags/MU.svg'),
  },
  MV: {
    code: '+960',
    unicodeFlag: '🇲🇻',
    svgFlag: require('../../assets/icons/flags/MV.svg'),
  },
  MW: {
    code: '+265',
    unicodeFlag: '🇲🇼',
    svgFlag: require('../../assets/icons/flags/MW.svg'),
  },
  MX: {
    code: '+52',
    unicodeFlag: '🇲🇽',
    svgFlag: require('../../assets/icons/flags/MX.svg'),
  },
  MY: {
    code: '+60',
    unicodeFlag: '🇲🇾',
    svgFlag: require('../../assets/icons/flags/MY.svg'),
  },
  MZ: {
    code: '+258',
    unicodeFlag: '🇲🇿',
    svgFlag: require('../../assets/icons/flags/MZ.svg'),
  },
  NA: {
    code: '+264',
    unicodeFlag: '🇳🇦',
    svgFlag: require('../../assets/icons/flags/NA.svg'),
  },
  NC: {
    code: '+687',
    unicodeFlag: '🇳🇨',
    svgFlag: require('../../assets/icons/flags/NC.svg'),
  },
  NF: {
    code: '+672',
    unicodeFlag: '🇳🇫',
    svgFlag: require('../../assets/icons/flags/NF.svg'),
  },
  NG: {
    code: '+234',
    unicodeFlag: '🇳🇬',
    svgFlag: require('../../assets/icons/flags/NG.svg'),
  },
  NI: {
    code: '+505',
    unicodeFlag: '🇳🇮',
    svgFlag: require('../../assets/icons/flags/NI.svg'),
  },
  NO: {
    code: '+47',
    unicodeFlag: '🇳🇴',
    svgFlag: require('../../assets/icons/flags/NO.svg'),
  },
  NP: {
    code: '+977',
    unicodeFlag: '🇳🇵',
    svgFlag: require('../../assets/icons/flags/NP.svg'),
  },
  NR: {
    code: '+674',
    unicodeFlag: '🇳🇷',
    svgFlag: require('../../assets/icons/flags/NR.svg'),
  },
  NU: {
    code: '+683',
    unicodeFlag: '🇳🇺',
    svgFlag: require('../../assets/icons/flags/NU.svg'),
  },
  NZ: {
    code: '+64',
    unicodeFlag: '🇳🇿',
    svgFlag: require('../../assets/icons/flags/NZ.svg'),
  },
  OM: {
    code: '+968',
    unicodeFlag: '🇴🇲',
    svgFlag: require('../../assets/icons/flags/OM.svg'),
  },
  PA: {
    code: '+507',
    unicodeFlag: '🇵🇦',
    svgFlag: require('../../assets/icons/flags/PA.svg'),
  },
  PE: {
    code: '+51',
    unicodeFlag: '🇵🇪',
    svgFlag: require('../../assets/icons/flags/PE.svg'),
  },
  PF: {
    code: '+689',
    unicodeFlag: '🇵🇫',
    svgFlag: require('../../assets/icons/flags/PF.svg'),
  },
  PG: {
    code: '+675',
    unicodeFlag: '🇵🇬',
    svgFlag: require('../../assets/icons/flags/PG.svg'),
  },
  PK: {
    code: '+92',
    unicodeFlag: '🇵🇰',
    svgFlag: require('../../assets/icons/flags/PK.svg'),
  },
  PL: {
    code: '+48',
    unicodeFlag: '🇵🇱',
    svgFlag: require('../../assets/icons/flags/PL.svg'),
  },
  PM: {
    code: '+508',
    unicodeFlag: '🇵🇲',
    svgFlag: require('../../assets/icons/flags/PM.svg'),
  },
  // same as New Zealand
  // PN: {
  //   code: '+64',
  //   unicodeFlag: '🇵🇳',
  //   svgFlag: require('../../assets/icons/flags/PN.svg'),
  // },
  PR: {
    code: '+1',
    unicodeFlag: '🇵🇷',
    svgFlag: require('../../assets/icons/flags/PR.svg'),
  },
  PS: {
    code: '+970',
    unicodeFlag: '🇵🇸',
    svgFlag: require('../../assets/icons/flags/PS.svg'),
  },
  PT: {
    code: '+351',
    unicodeFlag: '🇵🇹',
    svgFlag: require('../../assets/icons/flags/PT.svg'),
  },
  PW: {
    code: '+680',
    unicodeFlag: '🇵🇼',
    svgFlag: require('../../assets/icons/flags/PW.svg'),
  },
  PY: {
    code: '+595',
    unicodeFlag: '🇵🇾',
    svgFlag: require('../../assets/icons/flags/PY.svg'),
  },
  QA: {
    code: '+974',
    unicodeFlag: '🇶🇦',
    svgFlag: require('../../assets/icons/flags/QA.svg'),
  },
  RE: {
    code: '+262',
    unicodeFlag: '🇷🇪',
    svgFlag: require('../../assets/icons/flags/RE.svg'),
  },
  RO: {
    code: '+40',
    unicodeFlag: '🇷🇴',
    svgFlag: require('../../assets/icons/flags/RO.svg'),
  },
  RS: {
    code: '+381',
    unicodeFlag: '🇷🇸',
    svgFlag: require('../../assets/icons/flags/RS.svg'),
  },
  RU: {
    code: '+7',
    unicodeFlag: '🇷🇺',
    svgFlag: require('../../assets/icons/flags/RU.svg'),
  },
  RW: {
    code: '+250',
    unicodeFlag: '🇷🇼',
    svgFlag: require('../../assets/icons/flags/RW.svg'),
  },
  SA: {
    code: '+966',
    unicodeFlag: '🇸🇦',
    svgFlag: require('../../assets/icons/flags/SA.svg'),
  },
  SB: {
    code: '+677',
    unicodeFlag: '🇸🇧',
    svgFlag: require('../../assets/icons/flags/SB.svg'),
  },
  SC: {
    code: '+248',
    unicodeFlag: '🇸🇨',
    svgFlag: require('../../assets/icons/flags/SC.svg'),
  },
  SE: {
    code: '+46',
    unicodeFlag: '🇸🇪',
    svgFlag: require('../../assets/icons/flags/SE.svg'),
  },
  SG: {
    code: '+65',
    unicodeFlag: '🇸🇬',
    svgFlag: require('../../assets/icons/flags/SG.svg'),
  },
  SH: {
    code: '+290',
    unicodeFlag: '🇸🇭',
    svgFlag: require('../../assets/icons/flags/SH.svg'),
  },
  SI: {
    code: '+386',
    unicodeFlag: '🇸🇮',
    svgFlag: require('../../assets/icons/flags/SI.svg'),
  },
  SJ: {
    code: '+4779',
    unicodeFlag: '🇸🇯',
    svgFlag: require('../../assets/icons/flags/SJ.svg'),
  },
  SK: {
    code: '+421',
    unicodeFlag: '🇸🇰',
    svgFlag: require('../../assets/icons/flags/SK.svg'),
  },
  SL: {
    code: '+232',
    unicodeFlag: '🇸🇱',
    svgFlag: require('../../assets/icons/flags/SL.svg'),
  },
  SM: {
    code: '+378',
    unicodeFlag: '🇸🇲',
    svgFlag: require('../../assets/icons/flags/SM.svg'),
  },
  SN: {
    code: '+221',
    unicodeFlag: '🇸🇳',
    svgFlag: require('../../assets/icons/flags/SN.svg'),
  },
  SO: {
    code: '+252',
    unicodeFlag: '🇸🇴',
    svgFlag: require('../../assets/icons/flags/SO.svg'),
  },
  SR: {
    code: '+597',
    unicodeFlag: '🇸🇷',
    svgFlag: require('../../assets/icons/flags/SR.svg'),
  },
  SS: {
    code: '+211',
    unicodeFlag: '🇸🇸',
    svgFlag: require('../../assets/icons/flags/SS.svg'),
  },
  ST: {
    code: '+239',
    unicodeFlag: '🇸🇹',
    svgFlag: require('../../assets/icons/flags/ST.svg'),
  },
  SV: {
    code: '+503',
    unicodeFlag: '🇸🇻',
    svgFlag: require('../../assets/icons/flags/SV.svg'),
  },
  SX: {
    code: '+1721',
    unicodeFlag: '🇸🇽',
    svgFlag: require('../../assets/icons/flags/SX.svg'),
  },
  SY: {
    code: '+963',
    unicodeFlag: '🇸🇾',
    svgFlag: require('../../assets/icons/flags/SY.svg'),
  },
  TD: {
    code: '+235',
    unicodeFlag: '🇹🇩',
    svgFlag: require('../../assets/icons/flags/TD.svg'),
  },
  TG: {
    code: '+228',
    unicodeFlag: '🇹🇬',
    svgFlag: require('../../assets/icons/flags/TG.svg'),
  },
  TH: {
    code: '+66',
    unicodeFlag: '🇹🇭',
    svgFlag: require('../../assets/icons/flags/TH.svg'),
  },
  TJ: {
    code: '+992',
    unicodeFlag: '🇹🇯',
    svgFlag: require('../../assets/icons/flags/TJ.svg'),
  },
  TK: {
    code: '+690',
    unicodeFlag: '🇹🇰',
    svgFlag: require('../../assets/icons/flags/TK.svg'),
  },
  TL: {
    code: '+670',
    unicodeFlag: '🇹🇱',
    svgFlag: require('../../assets/icons/flags/TL.svg'),
  },
  TM: {
    code: '+993',
    unicodeFlag: '🇹🇲',
    svgFlag: require('../../assets/icons/flags/TM.svg'),
  },
  TN: {
    code: '+216',
    unicodeFlag: '🇹🇳',
    svgFlag: require('../../assets/icons/flags/TN.svg'),
  },
  TO: {
    code: '+676',
    unicodeFlag: '🇹🇴',
    svgFlag: require('../../assets/icons/flags/TO.svg'),
  },
  TR: {
    code: '+90',
    unicodeFlag: '🇹🇷',
    svgFlag: require('../../assets/icons/flags/TR.svg'),
  },
  TT: {
    code: '+868',
    unicodeFlag: '🇹🇹',
    svgFlag: require('../../assets/icons/flags/TT.svg'),
  },
  TV: {
    code: '+688',
    unicodeFlag: '🇹🇻',
    svgFlag: require('../../assets/icons/flags/TV.svg'),
  },
  TZ: {
    code: '+255',
    unicodeFlag: '🇹🇿',
    svgFlag: require('../../assets/icons/flags/TZ.svg'),
  },
  UA: {
    code: '+380',
    unicodeFlag: '🇺🇦',
    svgFlag: require('../../assets/icons/flags/UA.svg'),
  },
  UG: {
    code: '+256',
    unicodeFlag: '🇺🇬',
    svgFlag: require('../../assets/icons/flags/UG.svg'),
  },
  US: {
    code: '+1',
    unicodeFlag: '🇺🇸',
    svgFlag: require('../../assets/icons/flags/US.svg'),
  },
  UY: {
    code: '+598',
    unicodeFlag: '🇺🇾',
    svgFlag: require('../../assets/icons/flags/UY.svg'),
  },
  UZ: {
    code: '+998',
    unicodeFlag: '🇺🇿',
    svgFlag: require('../../assets/icons/flags/UZ.svg'),
  },
  VC: {
    code: '+1784',
    unicodeFlag: '🇻🇨',
    svgFlag: require('../../assets/icons/flags/VC.svg'),
  },
  VE: {
    code: '+58',
    unicodeFlag: '🇻🇪',
    svgFlag: require('../../assets/icons/flags/VE.svg'),
  },
  VG: {
    code: '+1284',
    unicodeFlag: '🇻🇬',
    svgFlag: require('../../assets/icons/flags/VG.svg'),
  },
  VI: {
    code: '+1340',
    unicodeFlag: '🇻🇮',
    svgFlag: require('../../assets/icons/flags/VI.svg'),
  },
  VN: {
    code: '+84',
    unicodeFlag: '🇻🇳',
    svgFlag: require('../../assets/icons/flags/VN.svg'),
  },
  VU: {
    code: '+678',
    unicodeFlag: '🇻🇺',
    svgFlag: require('../../assets/icons/flags/VU.svg'),
  },
  WF: {
    code: '+681',
    unicodeFlag: '🇼🇫',
    svgFlag: require('../../assets/icons/flags/WF.svg'),
  },
  WS: {
    code: '+685',
    unicodeFlag: '🇼🇸',
    svgFlag: require('../../assets/icons/flags/WS.svg'),
  },
  YE: {
    code: '+967',
    unicodeFlag: '🇾🇪',
    svgFlag: require('../../assets/icons/flags/YE.svg'),
  },
  YT: {
    code: '+262',
    unicodeFlag: '🇾🇹',
    svgFlag: require('../../assets/icons/flags/YT.svg'),
  },
  ZA: {
    code: '+27',
    unicodeFlag: '🇿🇦',
    svgFlag: require('../../assets/icons/flags/ZA.svg'),
  },
  ZM: {
    code: '+260',
    unicodeFlag: '🇿🇲',
    svgFlag: require('../../assets/icons/flags/ZM.svg'),
  },
  ZW: {
    code: '+263',
    unicodeFlag: '🇿🇼',
    svgFlag: require('../../assets/icons/flags/ZW.svg'),
  },
  SZ: {
    code: '+268',
    unicodeFlag: '🇸🇿',
    svgFlag: require('../../assets/icons/flags/SZ.svg'),
  },
  MK: {
    code: '+389',
    unicodeFlag: '🇲🇰',
    svgFlag: require('../../assets/icons/flags/MK.svg'),
  },
  PH: {
    code: '+63',
    unicodeFlag: '🇵🇭',
    svgFlag: require('../../assets/icons/flags/PH.svg'),
  },
  NL: {
    code: '+31',
    unicodeFlag: '🇳🇱',
    svgFlag: require('../../assets/icons/flags/NL.svg'),
  },
  AE: {
    code: '+971',
    unicodeFlag: '🇦🇪',
    svgFlag: require('../../assets/icons/flags/AE.svg'),
  },
  MD: {
    code: '+373',
    unicodeFlag: '🇲🇩',
    svgFlag: require('../../assets/icons/flags/MD.svg'),
  },
  GM: {
    code: '+220',
    unicodeFlag: '🇬🇲',
    svgFlag: require('../../assets/icons/flags/GM.svg'),
  },
  DO: {
    code: '+1',
    unicodeFlag: '🇩🇴',
    svgFlag: require('../../assets/icons/flags/DO.svg'),
  },
  SD: {
    code: '+249',
    unicodeFlag: '🇸🇩',
    svgFlag: require('../../assets/icons/flags/SD.svg'),
  },
  LA: {
    code: '+856',
    unicodeFlag: '🇱🇦',
    svgFlag: require('../../assets/icons/flags/LA.svg'),
  },
  TW: {
    code: '+886',
    unicodeFlag: '🇹🇼',
    svgFlag: require('../../assets/icons/flags/TW.svg'),
  },
  CG: {
    code: '+242',
    unicodeFlag: '🇨🇬',
    svgFlag: require('../../assets/icons/flags/CG.svg'),
  },
  CZ: {
    code: '+420',
    unicodeFlag: '🇨🇿',
    svgFlag: require('../../assets/icons/flags/CZ.svg'),
  },
  GB: {
    code: '+44',
    unicodeFlag: '🇬🇧',
    svgFlag: require('../../assets/icons/flags/GB.svg'),
  },
  NE: {
    code: '+227',
    unicodeFlag: '🇳🇪',
    svgFlag: require('../../assets/icons/flags/NE.svg'),
  },
  CD: {
    code: '+243',
    unicodeFlag: '🇨🇩',
    svgFlag: require('../../assets/icons/flags/CD.svg'),
  },
  BS: {
    code: '+1 242',
    unicodeFlag: '🇧🇸',
    svgFlag: require('../../assets/icons/flags/BS.svg'),
  },
  CC: {
    code: '+61 891',
    unicodeFlag: '🇨🇨',
    svgFlag: require('../../assets/icons/flags/CC.svg'),
  },
  CF: {
    code: '+236',
    unicodeFlag: '🇨🇫',
    svgFlag: require('../../assets/icons/flags/CF.svg'),
  },
  CK: {
    code: '+682',
    unicodeFlag: '🇨🇰',
    svgFlag: require('../../assets/icons/flags/CK.svg'),
  },
  FK: {
    code: '+500',
    unicodeFlag: '🇫🇰',
    svgFlag: require('../../assets/icons/flags/FK.svg'),
  },
  FO: {
    code: '+298',
    unicodeFlag: '🇫🇴',
    svgFlag: require('../../assets/icons/flags/FO.svg'),
  },
  // same as Norfolk Island
  // HM: {
  //   code: '+672',
  //   unicodeFlag: '🇭🇲',
  //   svgFlag: require('../../assets/icons/flags/HM.svg'),
  // },
  KM: {
    code: '+269',
    unicodeFlag: '🇰🇲',
    svgFlag: require('../../assets/icons/flags/KM.svg'),
  },
  KY: {
    code: '+1 345',
    unicodeFlag: '🇰🇾',
    svgFlag: require('../../assets/icons/flags/KY.svg'),
  },
  MH: {
    code: '+692',
    unicodeFlag: '🇲🇭',
    svgFlag: require('../../assets/icons/flags/MH.svg'),
  },
  MP: {
    code: '+1 670',
    unicodeFlag: '🇲🇵',
    svgFlag: require('../../assets/icons/flags/MP.svg'),
  },
  TC: {
    code: '+1 649',
    unicodeFlag: '🇹🇨',
    svgFlag: require('../../assets/icons/flags/TC.svg'),
  },
  // same as Norfolk Island
  // TF: {
  //   code: '+672',
  //   unicodeFlag: '🇹🇫',
  //   svgFlag: require('../../assets/icons/flags/TF.svg'),
  // },
  // same as US mainland
  // UM: {
  //   code: '+1',
  //   unicodeFlag: '🇺🇲',
  //   svgFlag: require('../../assets/icons/flags/UM.svg'),
  // },
  VA: {
    code: '+39',
    unicodeFlag: '🇻🇦',
    svgFlag: require('../../assets/icons/flags/VA.svg'),
  },
  XK: {
    code: '+383',
    unicodeFlag: '🇽🇰',
    svgFlag: require('../../assets/icons/flags/XK.svg'),
  },
} satisfies Record<
  CountryCode,
  {
    code: string
    unicodeFlag: string
    svgFlag: any
  }
>

const DEFAULT_PHONE_COUNTRY = 'US' as const

export function getDefaultCountry(location?: {
  countryCode?: string
}): CountryCode {
  const locationCountryCode = location?.countryCode?.toUpperCase()
  if (
    locationCountryCode &&
    locationCountryCode in INTERNATIONAL_TELEPHONE_CODES
  ) {
    return locationCountryCode as CountryCode
  }
  return DEFAULT_PHONE_COUNTRY
}
