{"version":3,"file":"phoneUtils.cjs","sources":["../../../../src/components/lib/phoneUtils.ts"],"sourcesContent":["import countryObjects from \"./json/countryObjects\";\n\n/**\n * A country entry augmented with a normalised, digits-only dial code.\n * The raw dataset stores `phonecode` inconsistently (\"234\", \"+1-242\",\n * \"0055\", \"+1-787 and 1-939\"), so `dialCode` is the value to rely on.\n */\nexport interface PhoneCountryType {\n  name: string;\n  isoCode: string;\n  flag: string;\n  phonecode: string;\n  dialCode: string;\n  [key: string]: any;\n}\n\nexport interface ParsedPhoneNumberType {\n  /** Country detected from an explicit dial code, if any. */\n  country?: PhoneCountryType;\n  /** Digits-only dial code that was stripped off, if any. */\n  dialCode?: string;\n  /** Subscriber number with the dial code and trunk prefix removed. */\n  nationalNumber: string;\n  /** True when a dial code was found and removed from the input. */\n  matchedCountryCode: boolean;\n}\n\nexport interface PhoneNumberValueType {\n  /** Display form of the dial code, e.g. \"+234\". */\n  phoneCode: string;\n  /** Digits-only dial code, e.g. \"234\". */\n  dialCode: string;\n  /** Subscriber number without dial code or trunk prefix, e.g. \"8031234567\". */\n  nationalNumber: string;\n  /** Storage form, e.g. \"+2348031234567\". Empty when there is no number. */\n  e164: string;\n  /** Human readable form, e.g. \"+234 803 123 4567\". */\n  formatted: string;\n  isoCode: string;\n  countryName: string;\n  flag: string;\n  isValid: boolean;\n}\n\n/** E.164 caps dial code + national number at 15 digits. */\nexport const E164_MAX_DIGITS = 15;\n\n/** Shortest national number we treat as plausible when splitting a paste. */\nexport const MIN_NATIONAL_DIGITS = 4;\n\n/**\n * A national number (no dial code) never exceeds this in practice. Anything\n * longer that was pasted without a \"+\" almost certainly embeds a dial code.\n */\nexport const MAX_NATIONAL_DIGITS = 11;\n\n/**\n * Several countries share a dial code. When a number is parsed we cannot know\n * which one was meant, so pick the most populous holder of the code.\n */\nconst AMBIGUOUS_DIAL_CODE_PREFERENCE: Record<string, string> = {\n  \"1\": \"US\",\n  \"7\": \"RU\",\n  \"39\": \"IT\",\n  \"44\": \"GB\",\n  \"47\": \"NO\",\n  \"61\": \"AU\",\n  \"212\": \"MA\",\n  \"262\": \"RE\",\n  \"290\": \"SH\",\n  \"358\": \"FI\",\n  \"500\": \"FK\",\n  \"590\": \"GP\",\n  \"599\": \"CW\",\n  \"672\": \"NF\",\n};\n\n/**\n * Reduce a raw `phonecode` to digits only.\n * \"+1-242\" -> \"1242\", \"0055\" -> \"55\", \"+1-787 and 1-939\" -> \"1787\".\n */\nexport const normalizeDialCode = (phonecode?: string | null): string => {\n  if (!phonecode) return \"\";\n  const primary = String(phonecode).split(/\\s+and\\s+/i)[0];\n  const digits = primary.replace(/\\D/g, \"\");\n  return digits.replace(/^0+/, \"\") || digits;\n};\n\n/** Every country, with a usable `dialCode`, sorted alphabetically by name. */\nexport const PHONE_COUNTRIES: PhoneCountryType[] = (countryObjects as any[])\n  .map((country) => ({\n    ...country,\n    dialCode: normalizeDialCode(country.phonecode),\n  }))\n  .filter((country) => country.dialCode.length > 0)\n  .sort((a, b) => a.name.localeCompare(b.name));\n\n/** Unique dial codes, longest first, so prefix matching is greedy. */\nconst DIAL_CODES_LONGEST_FIRST: string[] = Array.from(\n  new Set(PHONE_COUNTRIES.map((country) => country.dialCode))\n).sort((a, b) => b.length - a.length);\n\n/** Strip everything except digits. */\nexport const digitsOnly = (value?: string | null): string =>\n  String(value ?? \"\").replace(/\\D/g, \"\");\n\n/** Longest national number allowed for a dial code, per E.164. */\nexport const maxNationalDigits = (dialCode?: string | null): number =>\n  Math.max(MIN_NATIONAL_DIGITS, E164_MAX_DIGITS - (dialCode?.length || 0));\n\nexport const findCountryByIso = (\n  isoCode?: string | null\n): PhoneCountryType | undefined => {\n  if (!isoCode) return undefined;\n  const iso = String(isoCode).trim().toUpperCase();\n  return PHONE_COUNTRIES.find((country) => country.isoCode === iso);\n};\n\n/**\n * Resolve the country that owns a dial code. `preferIso` wins when it is one\n * of the holders, which keeps the current selection stable while typing.\n */\nexport const findCountryByDialCode = (\n  dialCode: string,\n  preferIso?: string | null\n): PhoneCountryType | undefined => {\n  const matches = PHONE_COUNTRIES.filter(\n    (country) => country.dialCode === dialCode\n  );\n  if (matches.length === 0) return undefined;\n  if (matches.length === 1) return matches[0];\n\n  const preferred = preferIso\n    ? matches.find((country) => country.isoCode === preferIso.toUpperCase())\n    : undefined;\n  if (preferred) return preferred;\n\n  const fallbackIso = AMBIGUOUS_DIAL_CODE_PREFERENCE[dialCode];\n  const fallback = fallbackIso\n    ? matches.find((country) => country.isoCode === fallbackIso)\n    : undefined;\n\n  return fallback || matches[0];\n};\n\n/**\n * Accepts anything a caller might pass as a country: \"234\", \"+234\", \"+1-242\",\n * \"NG\", \"ng\" or \"Nigeria\".\n */\nexport const resolveCountry = (\n  value?: string | null,\n  preferIso?: string | null\n): PhoneCountryType | undefined => {\n  const raw = String(value ?? \"\").trim();\n  if (!raw) return undefined;\n\n  const byIso = findCountryByIso(raw);\n  if (byIso) return byIso;\n\n  const dialCode = normalizeDialCode(raw);\n  if (dialCode) {\n    const byDialCode = findCountryByDialCode(dialCode, preferIso);\n    if (byDialCode) return byDialCode;\n  }\n\n  const lowered = raw.toLowerCase();\n  return PHONE_COUNTRIES.find(\n    (country) => country.name.toLowerCase() === lowered\n  );\n};\n\n/** Greedy longest-prefix dial code match against a digits-only string. */\nexport const matchDialCode = (\n  digits: string,\n  preferIso?: string | null\n): ParsedPhoneNumberType | null => {\n  for (const dialCode of DIAL_CODES_LONGEST_FIRST) {\n    if (!digits.startsWith(dialCode)) continue;\n    const country = findCountryByDialCode(dialCode, preferIso);\n    if (!country) continue;\n    return {\n      country,\n      dialCode,\n      nationalNumber: digits.slice(dialCode.length),\n      matchedCountryCode: true,\n    };\n  }\n  return null;\n};\n\n/**\n * Split a phone number into a country and a national number.\n *\n * Explicit international input (\"+234…\" or \"00234…\") always attempts a dial\n * code match. Input without that prefix is treated as national — a leading\n * trunk \"0\" is dropped and the current country is kept — unless `aggressive`\n * is set, which is what paste and blur use to also recognise a bare\n * \"2348031234567\".\n */\nexport const parsePhoneNumber = (\n  raw: string,\n  options: {\n    currentCountry?: PhoneCountryType | null;\n    aggressive?: boolean;\n  } = {}\n): ParsedPhoneNumberType => {\n  const { currentCountry, aggressive = false } = options;\n  const preferIso = currentCountry?.isoCode;\n  const text = String(raw ?? \"\").trim();\n  const digits = digitsOnly(text);\n\n  if (!digits) return { nationalNumber: \"\", matchedCountryCode: false };\n\n  const hasPlus = text.startsWith(\"+\");\n  const hasIddPrefix = !hasPlus && /^00[1-9]/.test(digits);\n  const body = hasIddPrefix ? digits.replace(/^00/, \"\") : digits;\n\n  if (hasPlus || hasIddPrefix) {\n    return (\n      matchDialCode(body, preferIso) || {\n        nationalNumber: body,\n        matchedCountryCode: false,\n      }\n    );\n  }\n\n  // Trunk prefix: \"08031234567\" is a national number, not a country code.\n  if (body.startsWith(\"0\")) {\n    return {\n      nationalNumber: body.replace(/^0+/, \"\"),\n      matchedCountryCode: false,\n    };\n  }\n\n  if (aggressive) {\n    // A dial code only counts when what is left behind is itself a plausible\n    // national number. Without the upper bound, a long run of digits would\n    // match some country and drag the selection with it.\n    const isPlausibleRemainder = (remainder: string) =>\n      remainder.length >= MIN_NATIONAL_DIGITS &&\n      remainder.length <= MAX_NATIONAL_DIGITS;\n\n    // \"2348031234567\" pasted without a \"+\", for the country already selected.\n    const currentDialCode = currentCountry?.dialCode;\n    if (currentDialCode && body.startsWith(currentDialCode)) {\n      const remainder = body.slice(currentDialCode.length);\n      if (isPlausibleRemainder(remainder)) {\n        return {\n          country: currentCountry as PhoneCountryType,\n          dialCode: currentDialCode,\n          nationalNumber: remainder,\n          matchedCountryCode: true,\n        };\n      }\n    }\n\n    // Too long to be national on its own, so it must carry a dial code.\n    if (body.length > MAX_NATIONAL_DIGITS) {\n      const matched = matchDialCode(body, preferIso);\n      if (matched && isPlausibleRemainder(matched.nationalNumber)) {\n        return matched;\n      }\n    }\n  }\n\n  return { nationalNumber: body, matchedCountryCode: false };\n};\n\n/** Group a national number for display: \"8031234567\" -> \"803 123 4567\". */\nexport const formatNationalNumber = (nationalNumber?: string | null): string => {\n  const digits = digitsOnly(nationalNumber);\n  if (digits.length <= 6) return digits;\n  const tail = digits.slice(-4);\n  const head = digits.slice(0, -4);\n  const groups = head.match(/.{1,3}/g) || [];\n  return [...groups, tail].join(\" \");\n};\n\n/** Build the full value object a consumer stores or submits. */\nexport const buildPhoneValue = (\n  country: PhoneCountryType,\n  nationalNumber?: string | null\n): PhoneNumberValueType => {\n  const digits = digitsOnly(nationalNumber);\n  const dialCode = country.dialCode;\n  const isValid =\n    digits.length >= MIN_NATIONAL_DIGITS &&\n    digits.length <= maxNationalDigits(dialCode);\n\n  return {\n    phoneCode: `+${dialCode}`,\n    dialCode,\n    nationalNumber: digits,\n    e164: digits ? `+${dialCode}${digits}` : \"\",\n    formatted: digits\n      ? `+${dialCode} ${formatNationalNumber(digits)}`\n      : `+${dialCode}`,\n    isoCode: country.isoCode,\n    countryName: country.name,\n    flag: country.flag,\n    isValid,\n  };\n};\n\n/**\n * Filter countries by name, ISO code or dial code, ranked so the most likely\n * match sorts first. \"ng\", \"nigeria\", \"234\" and \"+234\" all find Nigeria.\n */\nexport const searchCountries = (\n  query?: string | null,\n  countries: PhoneCountryType[] = PHONE_COUNTRIES\n): PhoneCountryType[] => {\n  const term = String(query ?? \"\")\n    .trim()\n    .toLowerCase();\n  if (!term) return countries;\n\n  const digitTerm = digitsOnly(term);\n  const ranked: Array<{ country: PhoneCountryType; score: number }> = [];\n\n  countries.forEach((country) => {\n    const name = country.name.toLowerCase();\n    const iso = country.isoCode.toLowerCase();\n    let score = -1;\n\n    if (name === term) score = 0;\n    else if (iso === term) score = 1;\n    else if (name.startsWith(term)) score = 2;\n    else if (digitTerm && country.dialCode === digitTerm) score = 3;\n    else if (digitTerm && country.dialCode.startsWith(digitTerm)) score = 4;\n    else if (name.includes(term)) score = 5;\n\n    if (score >= 0) ranked.push({ country, score });\n  });\n\n  return ranked\n    .sort(\n      (a, b) =>\n        a.score - b.score || a.country.name.localeCompare(b.country.name)\n    )\n    .map((entry) => entry.country);\n};\n\n/**\n * Move a set of ISO codes to the top of the list, preserving their given\n * order. Used for the `preferredCountries` prop.\n */\nexport const withPreferredCountries = (\n  preferredIsoCodes?: string[] | null,\n  countries: PhoneCountryType[] = PHONE_COUNTRIES\n): PhoneCountryType[] => {\n  if (!preferredIsoCodes || preferredIsoCodes.length === 0) return countries;\n\n  const preferred = preferredIsoCodes\n    .map((iso) => findCountryByIso(iso))\n    .filter((country): country is PhoneCountryType => Boolean(country));\n\n  if (preferred.length === 0) return countries;\n\n  const preferredIsoSet = new Set(preferred.map((country) => country.isoCode));\n  return [\n    ...preferred,\n    ...countries.filter((country) => !preferredIsoSet.has(country.isoCode)),\n  ];\n};\n"],"names":["AMBIGUOUS_DIAL_CODE_PREFERENCE","normalizeDialCode","phonecode","digits","String","split","replace","PHONE_COUNTRIES","countryObjects","map","country","_objectSpread","objectSpread2","dialCode","filter","length","sort","a","b","name","localeCompare","DIAL_CODES_LONGEST_FIRST","Array","from","Set","digitsOnly","value","maxNationalDigits","Math","max","findCountryByIso","isoCode","iso","trim","toUpperCase","find","findCountryByDialCode","preferIso","matches","preferred","undefined","fallbackIso","matchDialCode","_step","_iterator","_createForOfIteratorHelper","createForOfIteratorHelper","s","n","done","startsWith","nationalNumber","slice","matchedCountryCode","err","e","f","formatNationalNumber","tail","groups","match","concat","_toConsumableArray","join","isValid","phoneCode","e164","formatted","countryName","flag","raw","options","arguments","currentCountry","_options$aggressive","aggressive","text","hasPlus","hasIddPrefix","test","body","isPlausibleRemainder","remainder","currentDialCode","matched","byIso","byDialCode","lowered","toLowerCase","query","countries","term","digitTerm","ranked","forEach","score","includes","push","entry","preferredIsoCodes","Boolean","preferredIsoSet","has"],"mappings":"4KA4DMA,EAAyD,CAC7D,EAAK,KACL,EAAK,KACL,GAAM,KACN,GAAM,KACN,GAAM,KACN,GAAM,KACN,IAAO,KACP,IAAO,KACP,IAAO,KACP,IAAO,KACP,IAAO,KACP,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