{"version":3,"sources":["../source/format_.js"],"names":["VALID_PUNCTUATION","matchesEntirely","Metadata","getIDDPrefix","formatRFC3966","DEFAULT_OPTIONS","formatExtension","formattedNumber","extension","metadata","ext","formatNumber","input","format","options","country","hasCountry","Error","countryCallingCode","chooseCountryByCountryCallingCode","phone","nationalNumber","v2","number","formatNationalNumber","addExtension","fromCountry","IDDPrefix","undefined","humanReadable","formattedForSameCountryCallingCode","formatIDDSameCountryCallingCodeNumber","FIRST_GROUP_PATTERN","formatNationalNumberUsingFormat","useInternationalSeparator","useNationalPrefixFormattingRule","replace","RegExp","pattern","internationalFormat","nationalPrefixFormattingRule","applyInternationalSeparatorStyle","formatAs","chooseFormatForNumber","formats","nationalPrefixIsOptionalWhenFormattingInNationalFormat","nationalPrefix","availableFormats","nationalNnumber","leadingDigitsPatterns","length","lastLeadingDigitsPattern","search","local","trim","toCountryCallingCode","toCountryMetadata","fromCountryMetadata"],"mappings":";;;;AAAA;AACA;AACA;AACA;AAEA,SAASA,iBAAT,QAAkC,aAAlC;AACA,SAASC,eAAT,QAAgC,QAAhC;AACA,OAAOC,QAAP,MAAqB,YAArB;AACA,SAASC,YAAT,QAA6B,OAA7B;AACA,SAASC,aAAT,QAA8B,WAA9B;AAEA,IAAMC,eAAe,GAAG;AACvBC,EAAAA,eAAe,EAAE,yBAACC,eAAD,EAAkBC,SAAlB,EAA6BC,QAA7B;AAAA,qBAA6CF,eAA7C,SAA+DE,QAAQ,CAACC,GAAT,EAA/D,SAAgFF,SAAhF;AAAA,GADM,CAIxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAhBwB,CAAxB;AAiBA,eAAe,SAASG,YAAT,CAAsBC,KAAtB,EAA6BC,MAA7B,EAAqCC,OAArC,EAA8CL,QAA9C,EAAwD;AACtE;AACA,MAAIK,OAAJ,EAAa;AACZA,IAAAA,OAAO,qBAAQT,eAAR,EAA4BS,OAA5B,CAAP;AACA,GAFD,MAEO;AACNA,IA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,CAAC1C,OAApB,CAA4BW,WAA5B,EAFC,CAGD;;AACA,MAAI6B,oBAAoB,KAAKE,mBAAmB,CAACvC,kBAApB,EAA7B,EAAuE;AACtE;AACA;AACA,QAAIqC,oBAAoB,KAAK,GAA7B,EAAkC;AACjC,aAAOA,oBAAoB,GAAG,GAAvB,GAA6B/B,oBAAoB,CAACD,MAAD,EAAS,UAAT,EAAqBiC,iBAArB,EAAwC1C,OAAxC,CAAxD;AACA,KALqE,CAMtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,WAAOU,oBAAoB,CAACD,MAAD,EAAS,UAAT,EAAqBiC,iBAArB,EAAwC1C,OAAxC,CAA3B;AACA;AACD","sourcesContent":["// This is a port of Google Android `libphonenumber`'s\r\n// `phonenumberutil.js` of December 31th, 2018.\r\n//\r\n// https://github.com/googlei18n/libphonenumber/commits/master/javascript/i18n/phonenumbers/phonenumberutil.js\r\n\r\nimport { VALID_PUNCTUATION } from './constants'\r\nimport { matchesEntirely } from './util'\r\nimport Metadata from './metadata'\r\nimport { getIDDPrefix } from './IDD'\r\nimport { formatRFC3966 } from './RFC3966'\r\n\r\nconst DEFAULT_OPTIONS = {\r\n\tformatExtension: (formattedNumber, extension, metadata) => `${formattedNumber}${metadata.ext()}${extension}`\r\n}\r\n\r\n// Formats a phone number\r\n//\r\n// Example use cases:\r\n//\r\n// ```js\r\n// formatNumber('8005553535', 'RU', 'INTERNATIONAL')\r\n// formatNumber('8005553535', 'RU', 'INTERNATIONAL', metadata)\r\n// formatNumber({ phone: '8005553535', country: 'RU' }, 'INTERNATIONAL')\r\n// formatNumber({ phone: '8005553535', country: 'RU' }, 'INTERNATIONAL', metadata)\r\n// formatNumber('+78005553535', 'NATIONAL')\r\n// formatNumber('+78005553535', 'NATIONAL', metadata)\r\n// ```\r\n//\r\nexport default function formatNumber(input, format, options, metadata) {\r\n\t// Apply default options.\r\n\tif (options) {\r\n\t\toptions = { ...DEFAULT_OPTIONS, ...options }\r\n\t} else {\r\n\t\toptions = DEFAULT_OPTIONS\r\n\t}\r\n\r\n\tmetadata = new Metadata(metadata)\r\n\r\n\tif (input.country && input.country !== '001') {\r\n\t\t// Validate `input.country`.\r\n\t\tif (!metadata.hasCountry(input.country)) {\r\n\t\t\tthrow new Error(`Unknown country: ${input.country}`)\r\n\t\t}\r\n\t\tmetadata.country(input.country)\r\n\t}\r\n\telse if (input.countryCallingCode) {\r\n\t\tmetadata.chooseCountryByCountryCallingCode(input.countryCallingCode)\r\n\t}\r\n\telse return input.phone || ''\r\n\r\n\tconst countryCallingCode = metadata.countryCallingCode()\r\n\r\n\tconst nationalNumber = options.v2 ? input.nationalNumber : input.phone\r\n\r\n\t// This variable should have been declared inside `case`s\r\n\t// but Babel has a bug and it says \"duplicate variable declaration\".\r\n\tlet number\r\n\r\n\tswitch (format) {\r\n\t\tcase 'NATIONAL':\r\n\t\t\t// Legacy argument support.\r\n\t\t\t// (`{ country: ..., phone: '' }`)\r\n\t\t\tif (!nationalNumber) {\r\n\t\t\t\treturn ''\r\n\t\t\t}\r\n\t\t\tnumber = formatNationalNumber(nationalNumber, 'NATIONAL', metadata, options)\r\n\t\t\treturn addExtension(number, input.ext, metadata, options.formatExtension)\r\n\r\n\t\tcase 'INTERNATIONAL':\r\n\t\t\t// Legacy argument support.\r\n\t\t\t// (`{ country: ..., phone: '' }`)\r\n\t\t\tif (!nationalNumber) {\r\n\t\t\t\treturn `+${countryCallingCode}`\r\n\t\t\t}\r\n\t\t\tnumber = formatNationalNumber(nationalNumber, 'INTERNATIONAL', metadata, options)\r\n\t\t\tnumber = `+${countryCallingCode} ${number}`\r\n\t\t\treturn addExtension(number, input.ext, metadata, options.formatExtension)\r\n\r\n\t\tcase 'E.164':\r\n\t\t\t// `E.164` doesn't define \"phone number extensions\".\r\n\t\t\treturn `+${countryCallingCode}${nationalNumber}`\r\n\r\n\t\tcase 'RFC3966':\r\n\t\t\treturn formatRFC3966({\r\n\t\t\t\tnumber: `+${countryCallingCode}${nationalNumber}`,\r\n\t\t\t\text: input.ext\r\n\t\t\t})\r\n\r\n\t\tcase 'IDD':\r\n\t\t\tif (!options.fromCountry) {\r\n\t\t\t\treturn\r\n\t\t\t\t// throw new Error('`fromCountry` option not passed for IDD-prefixed formatting.')\r\n\t\t\t}\r\n\t\t\tconst IDDPrefix = getIDDPrefix(options.fromCountry, undefined, metadata.metadata)\r\n\t\t\tif (!IDDPrefix) {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t\tif (options.humanReadable) {\r\n\t\t\t\tconst formattedForSameCountryCallingCode = countryCallingCode && formatIDDSameCountryCallingCodeNumber(\r\n\t\t\t\t\tnationalNumber,\r\n\t\t\t\t\tmetadata.countryCallingCode(),\r\n\t\t\t\t\toptions.fromCountry,\r\n\t\t\t\t\tmetadata,\r\n\t\t\t\t\toptions\r\n\t\t\t\t)\r\n\t\t\t\tif (formattedForSameCountryCallingCode) {\r\n\t\t\t\t\tnumber = formattedForSameCountryCallingCode\r\n\t\t\t\t} else {\r\n\t\t\t\t\tnumber = `${IDDPrefix} ${countryCallingCode} ${formatNationalNumber(nationalNumber, 'INTERNATIONAL', metadata, options)}`\r\n\t\t\t\t}\r\n\t\t\t\treturn addExtension(number, input.ext, metadata, options.formatExtension)\r\n\t\t\t}\r\n\t\t\treturn `${IDDPrefix}${countryCallingCode}${nationalNumber}`\r\n\r\n\t\tdefault:\r\n\t\t\tthrow new Error(`Unknown \"format\" argument passed to \"formatNumber()\": \"${format}\"`)\r\n\t}\r\n}\r\n\r\n// This was originally set to $1 but there are some countries for which the\r\n// first group is not used in the national pattern (e.g. Argentina) so the $1\r\n// group does not match correctly. Therefore, we use \\d, so that the first\r\n// group actually used in the pattern will be matched.\r\nexport const FIRST_GROUP_PATTERN = /(\\$\\d)/\r\n\r\nexport function formatNationalNumberUsingFormat(\r\n\tnumber,\r\n\tformat,\r\n\tuseInternationalSeparator,\r\n\tuseNationalPrefixFormattingRule,\r\n\tmetadata\r\n) {\r\n\tconst formattedNumber = number.replace(\r\n\t\tnew RegExp(format.pattern()),\r\n\t\tuseInternationalSeparator ?\r\n\t\t\tformat.internationalFormat() :\r\n\t\t\tuseNationalPrefixFormattingRule && format.nationalPrefixFormattingRule() ?\r\n\t\t\t\tformat.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule()) :\r\n\t\t\t\tformat.format()\r\n\t)\r\n\tif (useInternationalSeparator) {\r\n\t\treturn applyInternationalSeparatorStyle(formattedNumber)\r\n\t}\r\n\treturn formattedNumber\r\n}\r\n\r\nfunction formatNationalNumber(number, formatAs, metadata, options) {\r\n\tconst format = chooseFormatForNumber(metadata.formats(), number)\r\n\tif (!format) {\r\n\t\treturn number\r\n\t}\r\n\treturn formatNationalNumberUsingFormat(\r\n\t\tnumber,\r\n\t\tformat,\r\n\t\tformatAs === 'INTERNATIONAL',\r\n\t\tformat.nationalPrefixIsOptionalWhenFormattingInNationalFormat() && options.nationalPrefix === false ? false : true,\r\n\t\tmetadata\r\n\t)\r\n}\r\n\r\nfunction chooseFormatForNumber(availableFormats, nationalNnumber) {\r\n\tfor (const format of availableFormats) {\r\n\t\t// Validate leading digits\r\n\t\tif (format.leadingDigitsPatterns().length > 0) {\r\n\t\t\t// The last leading_digits_pattern is used here, as it is the most detailed\r\n\t\t\tconst lastLeadingDigitsPattern = format.leadingDigitsPatterns()[format.leadingDigitsPatterns().length - 1]\r\n\t\t\t// If leading digits don't match then move on to the next phone number format\r\n\t\t\tif (nationalNnumber.search(lastLeadingDigitsPattern) !== 0) {\r\n\t\t\t\tcontinue\r\n\t\t\t}\r\n\t\t}\r\n\t\t// Check that the national number matches the phone number format regular expression\r\n\t\tif (matchesEntirely(nationalNnumber, format.pattern())) {\r\n\t\t\treturn format\r\n\t\t}\r\n\t}\r\n}\r\n\r\n// Removes brackets and replaces dashes with spaces.\r\n//\r\n// E.g. \"(999) 111-22-33\" -> \"999 111 22 33\"\r\n//\r\n// For some reason Google's metadata contains ``s with brackets and dashes.\r\n// Meanwhile, there's no single opinion about using punctuation in international phone numbers.\r\n//\r\n// For example, Google's `` for USA is `+1 213-373-4253`.\r\n// And here's a quote from WikiPedia's \"North American Numbering Plan\" page:\r\n// https://en.wikipedia.org/wiki/North_American_Numbering_Plan\r\n//\r\n// \"The country calling code for all countries participating in the NANP is 1.\r\n// In international format, an NANP number should be listed as +1 301 555 01 00,\r\n// where 301 is an area code (Maryland).\"\r\n//\r\n// I personally prefer the international format without any punctuation.\r\n// For example, brackets are remnants of the old age, meaning that the\r\n// phone number part in brackets (so called \"area code\") can be omitted\r\n// if dialing within the same \"area\".\r\n// And hyphens were clearly introduced for splitting local numbers into memorizable groups.\r\n// For example, remembering \"5553535\" is difficult but \"555-35-35\" is much simpler.\r\n// Imagine a man taking a bus from home to work and seeing an ad with a phone number.\r\n// He has a couple of seconds to memorize that number until it passes by.\r\n// If it were spaces instead of hyphens the man wouldn't necessarily get it,\r\n// but with hyphens instead of spaces the grouping is more explicit.\r\n// I personally think that hyphens introduce visual clutter,\r\n// so I prefer replacing them with spaces in international numbers.\r\n// In the modern age all output is done on displays where spaces are clearly distinguishable\r\n// so hyphens can be safely replaced with spaces without losing any legibility.\r\n//\r\nexport function applyInternationalSeparatorStyle(local) {\r\n\treturn local.replace(new RegExp(`[${VALID_PUNCTUATION}]+`, 'g'), ' ').trim()\r\n}\r\n\r\nfunction addExtension(formattedNumber, ext, metadata, formatExtension) {\r\n\treturn ext ? formatExtension(formattedNumber, ext, metadata) : formattedNumber\r\n}\r\n\r\nfunction formatIDDSameCountryCallingCodeNumber(\r\n\tnumber,\r\n\ttoCountryCallingCode,\r\n\tfromCountry,\r\n\ttoCountryMetadata,\r\n\toptions\r\n) {\r\n\tconst fromCountryMetadata = new Metadata(toCountryMetadata.metadata)\r\n\tfromCountryMetadata.country(fromCountry)\r\n\t// If calling within the same country calling code.\r\n\tif (toCountryCallingCode === fromCountryMetadata.countryCallingCode()) {\r\n\t\t// For NANPA regions, return the national format for these regions\r\n\t\t// but prefix it with the country calling code.\r\n\t\tif (toCountryCallingCode === '1') {\r\n\t\t\treturn toCountryCallingCode + ' ' + formatNationalNumber(number, 'NATIONAL', toCountryMetadata, options)\r\n\t\t}\r\n\t\t// If regions share a country calling code, the country calling code need\r\n\t\t// not be dialled. This also applies when dialling within a region, so this\r\n\t\t// if clause covers both these cases. Technically this is the case for\r\n\t\t// dialling from La Reunion to other overseas departments of France (French\r\n\t\t// Guiana, Martinique, Guadeloupe), but not vice versa - so we don't cover\r\n\t\t// this edge case for now and for those cases return the version including\r\n\t\t// country calling code. Details here:\r\n\t\t// http://www.petitfute.com/voyage/225-info-pratiques-reunion\r\n\t\t//\r\n\t\treturn formatNationalNumber(number, 'NATIONAL', toCountryMetadata, options)\r\n\t}\r\n}"],"file":"format_.js"}