{"version":3,"file":"react-phone-number-input.js","sources":["../node_modules/classnames/index.js","../node_modules/input-format/modules/helpers.js","../node_modules/input-format/modules/template formatter.js","../node_modules/input-format/modules/close braces.js","../node_modules/input-format/modules/dom.js","../node_modules/input-format/modules/input control.js","../node_modules/input-format/modules/parse.js","../node_modules/input-format/modules/edit.js","../node_modules/input-format/modules/format.js","../node_modules/input-format/modules/react/Input.js","../node_modules/libphonenumber-js/es6/ParseError.js","../node_modules/libphonenumber-js/es6/constants.js","../node_modules/libphonenumber-js/es6/util.js","../node_modules/libphonenumber-js/es6/tools/semver-compare.js","../node_modules/libphonenumber-js/es6/metadata.js","../node_modules/libphonenumber-js/es6/extension.js","../node_modules/libphonenumber-js/es6/isViablePhoneNumber.js","../node_modules/libphonenumber-js/es6/parseDigits.js","../node_modules/libphonenumber-js/es6/parseIncompletePhoneNumber.js","../node_modules/libphonenumber-js/es6/getNumberType_.js","../node_modules/libphonenumber-js/es6/isPossibleNumber_.js","../node_modules/libphonenumber-js/es6/IDD.js","../node_modules/libphonenumber-js/es6/RFC3966.js","../node_modules/libphonenumber-js/es6/format_.js","../node_modules/libphonenumber-js/es6/PhoneNumber.js","../node_modules/libphonenumber-js/es6/validate_.js","../node_modules/libphonenumber-js/es6/parse_.js","../node_modules/libphonenumber-js/es6/parsePhoneNumber_.js","../node_modules/libphonenumber-js/es6/parsePhoneNumber.js","../node_modules/libphonenumber-js/es6/parsePhoneNumberFromString_.js","../node_modules/libphonenumber-js/es6/parsePhoneNumberFromString.js","../node_modules/libphonenumber-js/es6/AsYouType.js","../node_modules/libphonenumber-js/es6/getCountries.js","../modules/inputValuePrefix.js","../modules/InputSmart.js","../modules/InputBasic.js","../node_modules/libphonenumber-js/es6/formatIncompletePhoneNumber.js","../modules/Flag.js","../modules/InternationalIcon.js","../modules/countries.js","../modules/CountryIcon.js","../modules/PropTypes.js","../modules/phoneInputHelpers.js","../modules/PhoneInputWithCountry.js","../modules/libphonenumber/formatPhoneNumber.js","../modules/libphonenumber/isValidPhoneNumber.js","../modules/libphonenumber/isPossiblePhoneNumber.js","../node_modules/country-flag-icons/modules/unicode.js","../modules/CountrySelect.js","../modules/PhoneInputWithCountryDefault.js","../min/index.js"],"sourcesContent":["/*!\n Copyright (c) 2016 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg)) {\n\t\t\t\tclasses.push(classNames.apply(null, arg));\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","// Counts all occurences of a symbol in a string\nexport function count_occurences(symbol, string) {\n var count = 0; // Using `.split('')` here instead of normal `for ... of`\n // because the importing application doesn't neccessarily include an ES6 polyfill.\n // The `.split('')` approach discards \"exotic\" UTF-8 characters\n // (the ones consisting of four bytes)\n // but template placeholder characters don't fall into that range\n // so skipping such miscellaneous \"exotic\" characters\n // won't matter here for just counting placeholder character occurrences.\n\n for (var _iterator = string.split(''), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref = _i.value;\n }\n\n var character = _ref;\n\n if (character === symbol) {\n count++;\n }\n }\n\n return count;\n}\n//# sourceMappingURL=helpers.js.map","import { count_occurences } from './helpers';\nimport close_braces from './close braces'; // Takes a `template` where character placeholders\n// are denoted by 'x'es (e.g. 'x (xxx) xxx-xx-xx').\n//\n// Returns a function which takes `value` characters\n// and returns the `template` filled with those characters.\n// If the `template` can only be partially filled\n// then it is cut off.\n//\n// If `should_close_braces` is `true`,\n// then it will also make sure all dangling braces are closed,\n// e.g. \"8 (8\" -> \"8 (8 )\" (iPhone style phone number input).\n//\n\nexport default function (template) {\n var placeholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'x';\n var should_close_braces = arguments.length > 2 ? arguments[2] : undefined;\n\n if (!template) {\n return function (value) {\n return {\n text: value\n };\n };\n }\n\n var characters_in_template = count_occurences(placeholder, template);\n return function (value) {\n if (!value) {\n return {\n text: '',\n template: template\n };\n }\n\n var value_character_index = 0;\n var filled_in_template = ''; // Using `.split('')` here instead of normal `for ... of`\n // because the importing application doesn't neccessarily include an ES6 polyfill.\n // The `.split('')` approach discards \"exotic\" UTF-8 characters\n // (the ones consisting of four bytes)\n // but template placeholder characters don't fall into that range\n // and appending UTF-8 characters to a string in parts still works.\n\n for (var _iterator = template.split(''), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref = _i.value;\n }\n\n var character = _ref;\n\n if (character !== placeholder) {\n filled_in_template += character;\n continue;\n }\n\n filled_in_template += value[value_character_index];\n value_character_index++; // If the last available value character has been filled in,\n // then return the filled in template\n // (either trim the right part or retain it,\n // if no more character placeholders in there)\n\n if (value_character_index === value.length) {\n // If there are more character placeholders\n // in the right part of the template\n // then simply trim it.\n if (value.length < characters_in_template) {\n break;\n }\n }\n }\n\n if (should_close_braces) {\n filled_in_template = close_braces(filled_in_template, template);\n }\n\n return {\n text: filled_in_template,\n template: template\n };\n };\n}\n//# sourceMappingURL=template formatter.js.map","import { count_occurences } from './helpers';\nexport default function close_braces(retained_template, template) {\n var placeholder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'x';\n var empty_placeholder = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ' ';\n var cut_before = retained_template.length;\n var opening_braces = count_occurences('(', retained_template);\n var closing_braces = count_occurences(')', retained_template);\n var dangling_braces = opening_braces - closing_braces;\n\n while (dangling_braces > 0 && cut_before < template.length) {\n retained_template += template[cut_before].replace(placeholder, empty_placeholder);\n\n if (template[cut_before] === ')') {\n dangling_braces--;\n }\n\n cut_before++;\n }\n\n return retained_template;\n}\n//# sourceMappingURL=close braces.js.map","// Gets selection bounds\nexport function getSelection(element) {\n // If no selection, return nothing\n if (element.selectionStart === element.selectionEnd) {\n return;\n }\n\n return {\n start: element.selectionStart,\n end: element.selectionEnd\n };\n} // Key codes\n\nexport var Keys = {\n Backspace: 8,\n Delete: 46\n}; // Finds out the operation to be intercepted and performed\n// based on the key down event `keyCode`.\n\nexport function getOperation(event) {\n switch (event.keyCode) {\n case Keys.Backspace:\n return 'Backspace';\n\n case Keys.Delete:\n return 'Delete';\n }\n} // Gets caret position\n\nexport function getCaretPosition(element) {\n return element.selectionStart;\n} // Sets caret position\n\nexport function setCaretPosition(element, caret_position) {\n // Sanity check\n if (caret_position === undefined) {\n return;\n } // Set caret position.\n // There has been an issue with caret positioning on Android devices.\n // https://github.com/catamphetamine/input-format/issues/2\n // I was revisiting this issue and looked for similar issues in other libraries.\n // For example, there's [`text-mask`](https://github.com/text-mask/text-mask) library.\n // They've had exactly the same issue when the caret seemingly refused to be repositioned programmatically.\n // The symptoms were the same: whenever the caret passed through a non-digit character of a mask (a whitespace, a bracket, a dash, etc), it looked as if it placed itself one character before its correct position.\n // https://github.com/text-mask/text-mask/issues/300\n // They seem to have found a basic fix for it: calling `input.setSelectionRange()` in a timeout rather than instantly for Android devices.\n // https://github.com/text-mask/text-mask/pull/400/files\n // I've implemented the same workaround here.\n\n\n if (isAndroid()) {\n setTimeout(function () {\n return element.setSelectionRange(caret_position, caret_position);\n }, 0);\n } else {\n element.setSelectionRange(caret_position, caret_position);\n }\n}\n\nfunction isAndroid() {\n // `navigator` is not defined when running mocha tests.\n if (typeof navigator !== 'undefined') {\n return ANDROID_USER_AGENT_REG_EXP.test(navigator.userAgent);\n }\n}\n\nvar ANDROID_USER_AGENT_REG_EXP = /Android/i;\n//# sourceMappingURL=dom.js.map","import edit from './edit';\nimport parse from './parse';\nimport format from './format';\nimport { getOperation, getSelection, getCaretPosition, setCaretPosition } from './dom';\nexport function onCut(event, input, _parse, _format, on_change) {\n // The actual cut hasn't happened just yet hence the timeout.\n setTimeout(function () {\n return format_input_text(input, _parse, _format, undefined, on_change);\n }, 0);\n}\nexport function onPaste(event, input, _parse, _format, on_change) {\n var selection = getSelection(input); // If selection is made,\n // just erase the selected text\n // prior to pasting\n\n if (selection) {\n erase_selection(input, selection);\n }\n\n format_input_text(input, _parse, _format, undefined, on_change);\n}\nexport function onChange(event, input, _parse, _format, on_change) {\n format_input_text(input, _parse, _format, undefined, on_change);\n} // Intercepts \"Delete\" and \"Backspace\" keys.\n// (hitting \"Delete\" or \"Backspace\" at any caret\n// position should always result in rasing a digit)\n\nexport function onKeyDown(event, input, _parse, _format, on_change) {\n var operation = getOperation(event);\n\n switch (operation) {\n case 'Delete':\n case 'Backspace':\n // Intercept this operation and perform it manually.\n event.preventDefault();\n var selection = getSelection(input); // If selection is made,\n // just erase the selected text,\n // and don't apply any more operations to it.\n\n if (selection) {\n erase_selection(input, selection);\n return format_input_text(input, _parse, _format, undefined, on_change);\n } // Else, perform the (character erasing) operation manually\n\n\n return format_input_text(input, _parse, _format, operation, on_change);\n\n default: // Will be handled when `onChange` fires.\n\n }\n}\n/**\r\n * Erases the selected text inside an ``.\r\n * @param {DOMElement} input\r\n * @param {Selection} selection\r\n */\n\nfunction erase_selection(input, selection) {\n var text = input.value;\n text = text.slice(0, selection.start) + text.slice(selection.end);\n input.value = text;\n setCaretPosition(input, selection.start);\n}\n/**\r\n * Parses and re-formats `` textual value.\r\n * E.g. when a user enters something into the ``\r\n * that raw input must first be parsed and the re-formatted properly.\r\n * Is called either after some user input (e.g. entered a character, pasted something)\r\n * or after the user performed an `operation` (e.g. \"Backspace\", \"Delete\").\r\n * @param {DOMElement} input\r\n * @param {Function} parse\r\n * @param {Function} format\r\n * @param {string} [operation] - The operation that triggered `` textual value change. E.g. \"Backspace\", \"Delete\".\r\n * @param {Function} onChange\r\n */\n\n\nfunction format_input_text(input, _parse, _format, operation, on_change) {\n // Parse `` textual value.\n // Get `value` and `caret` position.\n var _parse2 = parse(input.value, getCaretPosition(input), _parse),\n value = _parse2.value,\n caret = _parse2.caret; // If a user performed an operation (e.g. \"Backspace\", \"Delete\")\n // then apply that operation and get new `value` and `caret` position.\n\n\n if (operation) {\n var operation_applied = edit(value, caret, operation);\n value = operation_applied.value;\n caret = operation_applied.caret;\n } // Format the `value`.\n // (and reposition the caret accordingly)\n\n\n var formatted = format(value, caret, _format);\n var text = formatted.text;\n caret = formatted.caret; // Set `` textual value manually\n // to prevent React from resetting the caret position\n // later inside subsequent `render()`.\n // Doesn't work for custom `inputComponent`s for some reason.\n\n input.value = text; // Position the caret properly.\n\n setCaretPosition(input, caret); // `` textual value may have changed,\n // so the parsed `value` may have changed too.\n // The `value` didn't neccessarily change\n // but it might have.\n\n on_change(value);\n}\n//# sourceMappingURL=input control.js.map","// Parses the `text`.\n//\n// Returns `{ value, caret }` where `caret` is\n// the caret position inside `value`\n// corresponding to the `caret_position` inside `text`.\n//\n// The `text` is parsed by feeding each character sequentially to\n// `parse_character(character, value)` function\n// and appending the result (if it's not `undefined`) to `value`.\n//\n// Example:\n//\n// `text` is `8 (800) 555-35-35`,\n// `caret_position` is `4` (before the first `0`).\n// `parse_character` is `(character, value) =>\n// if (character >= '0' && character <= '9') { return character }`.\n//\n// then `parse()` outputs `{ value: '88005553535', caret: 2 }`.\n//\nexport default function parse(text, caret_position, parse_character) {\n var value = '';\n var focused_input_character_index = 0;\n var index = 0;\n\n while (index < text.length) {\n var character = parse_character(text[index], value);\n\n if (character !== undefined) {\n value += character;\n\n if (caret_position !== undefined) {\n if (caret_position === index) {\n focused_input_character_index = value.length - 1;\n } else if (caret_position > index) {\n focused_input_character_index = value.length;\n }\n }\n }\n\n index++;\n } // If caret position wasn't specified\n\n\n if (caret_position === undefined) {\n // Then set caret position to \"after the last input character\"\n focused_input_character_index = value.length;\n }\n\n var result = {\n value: value,\n caret: focused_input_character_index\n };\n return result;\n}\n//# sourceMappingURL=parse.js.map","// Edits text `value` (if `operation` is passed) and repositions the `caret` if needed.\n//\n// Example:\n//\n// value - '88005553535'\n// caret - 2 // starting from 0; is positioned before the first zero\n// operation - 'Backspace'\n//\n// Returns\n// {\n// \tvalue: '8005553535'\n// \tcaret: 1\n// }\n//\n// Currently supports just 'Delete' and 'Backspace' operations\n//\nexport default function edit(value, caret, operation) {\n switch (operation) {\n case 'Backspace':\n // If there exists the previous character,\n // then erase it and reposition the caret.\n if (caret > 0) {\n // Remove the previous character\n value = value.slice(0, caret - 1) + value.slice(caret); // Position the caret where the previous (erased) character was\n\n caret--;\n }\n\n break;\n\n case 'Delete':\n // Remove current digit (if any)\n value = value.slice(0, caret) + value.slice(caret + 1);\n break;\n }\n\n return {\n value: value,\n caret: caret\n };\n}\n//# sourceMappingURL=edit.js.map","import template_formatter from './template formatter'; // Formats `value` value preserving `caret` at the same character.\n//\n// `{ value, caret }` attribute is the result of `parse()` function call.\n//\n// Returns `{ text, caret }` where the new `caret` is the caret position\n// inside `text` text corresponding to the original `caret` position inside `value`.\n//\n// `formatter(value)` is a function returning `{ text, template }`.\n//\n// `text` is the `value` value formatted using `template`.\n// It may either cut off the non-filled right part of the `template`\n// or it may fill the non-filled character placeholders\n// in the right part of the `template` with `spacer`\n// which is a space (' ') character by default.\n//\n// `template` is the template used to format the `value`.\n// It can be either a full-length template or a partial template.\n//\n// `formatter` can also be a string — a `template`\n// where character placeholders are denoted by 'x'es.\n// In this case `formatter` function is automatically created.\n//\n// Example:\n//\n// `value` is '880',\n// `caret` is `2` (before the first `0`)\n//\n// `formatter` is `'880' =>\n// { text: '8 (80 )', template: 'x (xxx) xxx-xx-xx' }`\n//\n// The result is `{ text: '8 (80 )', caret: 4 }`.\n//\n\nexport default function format(value, caret, formatter) {\n if (typeof formatter === 'string') {\n formatter = template_formatter(formatter);\n }\n\n var _ref = formatter(value) || {},\n text = _ref.text,\n template = _ref.template;\n\n if (text === undefined) {\n text = value;\n }\n\n if (template) {\n if (caret === undefined) {\n caret = text.length;\n } else {\n var index = 0;\n var found = false;\n var possibly_last_input_character_index = -1;\n\n while (index < text.length && index < template.length) {\n // Character placeholder found\n if (text[index] !== template[index]) {\n if (caret === 0) {\n found = true;\n caret = index;\n break;\n }\n\n possibly_last_input_character_index = index;\n caret--;\n }\n\n index++;\n } // If the caret was positioned after last input character,\n // then the text caret index is just after the last input character.\n\n\n if (!found) {\n caret = possibly_last_input_character_index + 1;\n }\n }\n }\n\n return {\n text: text,\n caret: caret\n };\n}\n//# sourceMappingURL=format.js.map","function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n// This is just `./ReactInput.js` rewritten in Hooks.\nimport React, { useCallback, useRef } from 'react';\nimport PropTypes from 'prop-types';\nimport { onChange as onInputChange, onCut as onInputCut, onPaste as onInputPaste, onKeyDown as onInputKeyDown } from '../input control'; // Usage:\n//\n// this.setState({ phone })}\n// \tparse={character => character}\n// \tformat={value => ({ text: value, template: 'xxxxxxxx' })}/>\n//\n\nfunction Input(_ref, ref) {\n var value = _ref.value,\n parse = _ref.parse,\n format = _ref.format,\n InputComponent = _ref.inputComponent,\n onChange = _ref.onChange,\n onCut = _ref.onCut,\n onPaste = _ref.onPaste,\n onKeyDown = _ref.onKeyDown,\n rest = _objectWithoutProperties(_ref, [\"value\", \"parse\", \"format\", \"inputComponent\", \"onChange\", \"onCut\", \"onPaste\", \"onKeyDown\"]);\n\n var ownRef = useRef();\n ref = ref || ownRef;\n\n var _onChange = useCallback(function (event) {\n return onInputChange(event, ref.current, parse, format, onChange);\n }, [ref, parse, format, onChange]);\n\n var _onPaste = useCallback(function (event) {\n if (onPaste) {\n onPaste(event);\n }\n\n return onInputPaste(event, ref.current, parse, format, onChange);\n }, [ref, parse, format, onChange, onPaste]);\n\n var _onCut = useCallback(function (event) {\n if (onCut) {\n onCut(event);\n }\n\n return onInputCut(event, ref.current, parse, format, onChange);\n }, [ref, parse, format, onChange, onCut]);\n\n var _onKeyDown = useCallback(function (event) {\n if (onKeyDown) {\n onKeyDown(event);\n }\n\n return onInputKeyDown(event, ref.current, parse, format, onChange);\n }, [ref, parse, format, onChange, onKeyDown]);\n\n return React.createElement(InputComponent, _extends({}, rest, {\n ref: ref,\n value: format(isEmptyValue(value) ? '' : value).text,\n onKeyDown: _onKeyDown,\n onChange: _onChange,\n onPaste: _onPaste,\n onCut: _onCut\n }));\n}\n\nInput = React.forwardRef(Input);\nInput.propTypes = {\n // Parses a single characher of `` text.\n parse: PropTypes.func.isRequired,\n // Formats `value` into `` text.\n format: PropTypes.func.isRequired,\n // Renders `` by default.\n inputComponent: PropTypes.elementType.isRequired,\n // `` `type` attribute.\n type: PropTypes.string.isRequired,\n // Is parsed from text.\n value: PropTypes.string,\n // This handler is called each time `` text is changed.\n onChange: PropTypes.func.isRequired,\n // Passthrough\n onKeyDown: PropTypes.func,\n onCut: PropTypes.func,\n onPaste: PropTypes.func\n};\nInput.defaultProps = {\n // Renders `` by default.\n inputComponent: 'input',\n // `` `type` attribute.\n type: 'text'\n};\nexport default Input;\n\nfunction isEmptyValue(value) {\n return value === undefined || value === null;\n}\n//# sourceMappingURL=Input.js.map","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n// https://stackoverflow.com/a/46971044/970769\nvar ParseError = function ParseError(code) {\n _classCallCheck(this, ParseError);\n\n this.name = this.constructor.name;\n this.message = code;\n this.stack = new Error(code).stack;\n};\n\nexport { ParseError as default };\nParseError.prototype = Object.create(Error.prototype);\nParseError.prototype.constructor = ParseError;\n//# sourceMappingURL=ParseError.js.map","// The minimum length of the national significant number.\nexport var MIN_LENGTH_FOR_NSN = 2; // The ITU says the maximum length should be 15,\n// but one can find longer numbers in Germany.\n\nexport var MAX_LENGTH_FOR_NSN = 17; // The maximum length of the country calling code.\n\nexport var MAX_LENGTH_COUNTRY_CODE = 3; // Digits accepted in phone numbers\n// (ascii, fullwidth, arabic-indic, and eastern arabic digits).\n\nexport var VALID_DIGITS = \"0-9\\uFF10-\\uFF19\\u0660-\\u0669\\u06F0-\\u06F9\"; // `DASHES` will be right after the opening square bracket of the \"character class\"\n\nvar DASHES = \"-\\u2010-\\u2015\\u2212\\u30FC\\uFF0D\";\nvar SLASHES = \"\\uFF0F/\";\nvar DOTS = \"\\uFF0E.\";\nexport var WHITESPACE = \" \\xA0\\xAD\\u200B\\u2060\\u3000\";\nvar BRACKETS = \"()\\uFF08\\uFF09\\uFF3B\\uFF3D\\\\[\\\\]\"; // export const OPENING_BRACKETS = '(\\uFF08\\uFF3B\\\\\\['\n\nvar TILDES = \"~\\u2053\\u223C\\uFF5E\"; // Regular expression of acceptable punctuation found in phone numbers. This\n// excludes punctuation found as a leading character only. This consists of dash\n// characters, white space characters, full stops, slashes, square brackets,\n// parentheses and tildes. Full-width variants are also present.\n\nexport var VALID_PUNCTUATION = \"\".concat(DASHES).concat(SLASHES).concat(DOTS).concat(WHITESPACE).concat(BRACKETS).concat(TILDES);\nexport var PLUS_CHARS = \"+\\uFF0B\"; // const LEADING_PLUS_CHARS_PATTERN = new RegExp('^[' + PLUS_CHARS + ']+')\n//# sourceMappingURL=constants.js.map","/**\r\n * Checks whether the entire input sequence can be matched\r\n * against the regular expression.\r\n * @return {boolean}\r\n */\nexport function matchesEntirely(text, regular_expression) {\n // If assigning the `''` default value is moved to the arguments above,\n // code coverage would decrease for some weird reason.\n text = text || '';\n return new RegExp('^(?:' + regular_expression + ')$').test(text);\n}\n/**\r\n * Merges two arrays.\r\n * @param {*} a\r\n * @param {*} b\r\n * @return {*}\r\n */\n\nexport function mergeArrays(a, b) {\n var merged = a.slice();\n\n for (var _iterator = b, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref = _i.value;\n }\n\n var element = _ref;\n\n if (a.indexOf(element) < 0) {\n merged.push(element);\n }\n }\n\n return merged.sort(function (a, b) {\n return a - b;\n }); // ES6 version, requires Set polyfill.\n // let merged = new Set(a)\n // for (const element of b)\n // {\n // \tmerged.add(i)\n // }\n // return Array.from(merged).sort((a, b) => a - b)\n}\n//# sourceMappingURL=util.js.map","// Copy-pasted from:\n// https://github.com/substack/semver-compare/blob/master/index.js\n//\n// Inlining this function because some users reported issues with\n// importing from `semver-compare` in a browser with ES6 \"native\" modules.\n//\n// Fixes `semver-compare` not being able to compare versions with alpha/beta/etc \"tags\".\n// https://github.com/catamphetamine/libphonenumber-js/issues/381\nexport default function (a, b) {\n a = a.split('-');\n b = b.split('-');\n var pa = a[0].split('.');\n var pb = b[0].split('.');\n\n for (var i = 0; i < 3; i++) {\n var na = Number(pa[i]);\n var nb = Number(pb[i]);\n if (na > nb) return 1;\n if (nb > na) return -1;\n if (!isNaN(na) && isNaN(nb)) return 1;\n if (isNaN(na) && !isNaN(nb)) return -1;\n }\n\n if (a[1] && b[1]) {\n return a[1] > b[1] ? 1 : a[1] < b[1] ? -1 : 0;\n }\n\n return !a[1] && b[1] ? 1 : a[1] && !b[1] ? -1 : 0;\n}\n//# sourceMappingURL=semver-compare.js.map","function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport compare from './tools/semver-compare'; // Added \"possibleLengths\" and renamed\n// \"country_phone_code_to_countries\" to \"country_calling_codes\".\n\nvar V2 = '1.0.18'; // Added \"idd_prefix\" and \"default_idd_prefix\".\n\nvar V3 = '1.2.0'; // Moved `001` country code to \"nonGeographic\" section of metadata.\n\nvar V4 = '1.7.35';\nvar DEFAULT_EXT_PREFIX = ' ext. ';\n/**\r\n * See: https://gitlab.com/catamphetamine/libphonenumber-js/blob/master/METADATA.md\r\n */\n\nvar Metadata =\n/*#__PURE__*/\nfunction () {\n function Metadata(metadata) {\n _classCallCheck(this, Metadata);\n\n validateMetadata(metadata);\n this.metadata = metadata;\n setVersion.call(this, metadata);\n }\n\n _createClass(Metadata, [{\n key: \"getCountries\",\n value: function getCountries() {\n return Object.keys(this.metadata.countries).filter(function (_) {\n return _ !== '001';\n });\n }\n }, {\n key: \"getCountryMetadata\",\n value: function getCountryMetadata(countryCode) {\n return this.metadata.countries[countryCode];\n }\n }, {\n key: \"nonGeographic\",\n value: function nonGeographic() {\n if (this.v1 || this.v2 || this.v3) return; // `nonGeographical` was a typo.\n // It's present in metadata generated from `1.7.35` to `1.7.37`.\n\n return this.metadata.nonGeographic || this.metadata.nonGeographical;\n }\n }, {\n key: \"hasCountry\",\n value: function hasCountry(country) {\n return this.getCountryMetadata(country) !== undefined;\n }\n }, {\n key: \"hasCallingCode\",\n value: function hasCallingCode(callingCode) {\n if (this.getCountryCodesForCallingCode(callingCode)) {\n return true;\n }\n\n if (this.nonGeographic()) {\n if (this.nonGeographic()[callingCode]) {\n return true;\n }\n } else {\n // A hacky workaround for old custom metadata (generated before V4).\n var countryCodes = this.countryCallingCodes()[callingCode];\n\n if (countryCodes && countryCodes.length === 1 && countryCodes[0] === '001') {\n return true;\n }\n }\n }\n }, {\n key: \"isNonGeographicCallingCode\",\n value: function isNonGeographicCallingCode(callingCode) {\n if (this.nonGeographic()) {\n return this.nonGeographic()[callingCode] ? true : false;\n } else {\n return this.getCountryCodesForCallingCode(callingCode) ? false : true;\n }\n } // Deprecated.\n\n }, {\n key: \"country\",\n value: function country(countryCode) {\n return this.selectNumberingPlan(countryCode);\n }\n }, {\n key: \"selectNumberingPlan\",\n value: function selectNumberingPlan(countryCode, callingCode) {\n if (countryCode && countryCode !== '001') {\n if (!this.hasCountry(countryCode)) {\n throw new Error(\"Unknown country: \".concat(countryCode));\n }\n\n this.numberingPlan = new NumberingPlan(this.getCountryMetadata(countryCode), this);\n } else if (callingCode) {\n if (!this.hasCallingCode(callingCode)) {\n throw new Error(\"Unknown calling code: \".concat(callingCode));\n }\n\n this.numberingPlan = new NumberingPlan(this.getNumberingPlanMetadata(callingCode), this);\n } else {\n this.numberingPlan = undefined;\n }\n\n return this;\n }\n }, {\n key: \"getCountryCodesForCallingCode\",\n value: function getCountryCodesForCallingCode(callingCode) {\n var countryCodes = this.countryCallingCodes()[callingCode];\n\n if (countryCodes) {\n // Metadata before V4 included \"non-geographic entity\" calling codes\n // inside `country_calling_codes` (for example, `\"881\":[\"001\"]`).\n // Now the semantics of `country_calling_codes` has changed:\n // it's specifically for \"countries\" now.\n // Older versions of custom metadata will simply skip parsing\n // \"non-geographic entity\" phone numbers with new versions\n // of this library: it's not considered a bug,\n // because such numbers are extremely rare,\n // and developers extremely rarely use custom metadata.\n if (countryCodes.length === 1 && countryCodes[0].length === 3) {\n return;\n }\n\n return countryCodes;\n }\n }\n }, {\n key: \"getCountryCodeForCallingCode\",\n value: function getCountryCodeForCallingCode(callingCode) {\n var countryCodes = this.getCountryCodesForCallingCode(callingCode);\n\n if (countryCodes) {\n return countryCodes[0];\n }\n }\n }, {\n key: \"getNumberingPlanMetadata\",\n value: function getNumberingPlanMetadata(callingCode) {\n var countryCode = this.getCountryCodeForCallingCode(callingCode);\n\n if (countryCode) {\n return this.getCountryMetadata(countryCode);\n }\n\n if (this.nonGeographic()) {\n var metadata = this.nonGeographic()[callingCode];\n\n if (metadata) {\n return metadata;\n }\n } else {\n // A hacky workaround for old custom metadata (generated before V4).\n var countryCodes = this.countryCallingCodes()[callingCode];\n\n if (countryCodes && countryCodes.length === 1 && countryCodes[0] === '001') {\n return this.metadata.countries['001'];\n }\n }\n } // Deprecated.\n\n }, {\n key: \"countryCallingCode\",\n value: function countryCallingCode() {\n return this.numberingPlan.callingCode();\n } // Deprecated.\n\n }, {\n key: \"IDDPrefix\",\n value: function IDDPrefix() {\n return this.numberingPlan.IDDPrefix();\n } // Deprecated.\n\n }, {\n key: \"defaultIDDPrefix\",\n value: function defaultIDDPrefix() {\n return this.numberingPlan.defaultIDDPrefix();\n } // Deprecated.\n\n }, {\n key: \"nationalNumberPattern\",\n value: function nationalNumberPattern() {\n return this.numberingPlan.nationalNumberPattern();\n } // Deprecated.\n\n }, {\n key: \"possibleLengths\",\n value: function possibleLengths() {\n return this.numberingPlan.possibleLengths();\n } // Deprecated.\n\n }, {\n key: \"formats\",\n value: function formats() {\n return this.numberingPlan.formats();\n } // Deprecated.\n\n }, {\n key: \"nationalPrefixForParsing\",\n value: function nationalPrefixForParsing() {\n return this.numberingPlan.nationalPrefixForParsing();\n } // Deprecated.\n\n }, {\n key: \"nationalPrefixTransformRule\",\n value: function nationalPrefixTransformRule() {\n return this.numberingPlan.nationalPrefixTransformRule();\n } // Deprecated.\n\n }, {\n key: \"leadingDigits\",\n value: function leadingDigits() {\n return this.numberingPlan.leadingDigits();\n } // Deprecated.\n\n }, {\n key: \"hasTypes\",\n value: function hasTypes() {\n return this.numberingPlan.hasTypes();\n } // Deprecated.\n\n }, {\n key: \"type\",\n value: function type(_type) {\n return this.numberingPlan.type(_type);\n } // Deprecated.\n\n }, {\n key: \"ext\",\n value: function ext() {\n return this.numberingPlan.ext();\n }\n }, {\n key: \"countryCallingCodes\",\n value: function countryCallingCodes() {\n if (this.v1) return this.metadata.country_phone_code_to_countries;\n return this.metadata.country_calling_codes;\n } // Deprecated.\n\n }, {\n key: \"chooseCountryByCountryCallingCode\",\n value: function chooseCountryByCountryCallingCode(callingCode) {\n this.selectNumberingPlan(null, callingCode);\n }\n }, {\n key: \"hasSelectedNumberingPlan\",\n value: function hasSelectedNumberingPlan() {\n return this.numberingPlan !== undefined;\n }\n }]);\n\n return Metadata;\n}();\n\nexport { Metadata as default };\n\nvar NumberingPlan =\n/*#__PURE__*/\nfunction () {\n function NumberingPlan(metadata, globalMetadataObject) {\n _classCallCheck(this, NumberingPlan);\n\n this.globalMetadataObject = globalMetadataObject;\n this.metadata = metadata;\n setVersion.call(this, globalMetadataObject.metadata);\n }\n\n _createClass(NumberingPlan, [{\n key: \"callingCode\",\n value: function callingCode() {\n return this.metadata[0];\n } // Formatting information for regions which share\n // a country calling code is contained by only one region\n // for performance reasons. For example, for NANPA region\n // (\"North American Numbering Plan Administration\",\n // which includes USA, Canada, Cayman Islands, Bahamas, etc)\n // it will be contained in the metadata for `US`.\n\n }, {\n key: \"getDefaultCountryMetadataForRegion\",\n value: function getDefaultCountryMetadataForRegion() {\n return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode());\n }\n }, {\n key: \"IDDPrefix\",\n value: function IDDPrefix() {\n if (this.v1 || this.v2) return;\n return this.metadata[1];\n }\n }, {\n key: \"defaultIDDPrefix\",\n value: function defaultIDDPrefix() {\n if (this.v1 || this.v2) return;\n return this.metadata[12];\n }\n }, {\n key: \"nationalNumberPattern\",\n value: function nationalNumberPattern() {\n if (this.v1 || this.v2) return this.metadata[1];\n return this.metadata[2];\n }\n }, {\n key: \"possibleLengths\",\n value: function possibleLengths() {\n if (this.v1) return;\n return this.metadata[this.v2 ? 2 : 3];\n }\n }, {\n key: \"_getFormats\",\n value: function _getFormats(metadata) {\n return metadata[this.v1 ? 2 : this.v2 ? 3 : 4];\n } // For countries of the same region (e.g. NANPA)\n // formats are all stored in the \"main\" country for that region.\n // E.g. \"RU\" and \"KZ\", \"US\" and \"CA\".\n\n }, {\n key: \"formats\",\n value: function formats() {\n var _this = this;\n\n var formats = this._getFormats(this.metadata) || this._getFormats(this.getDefaultCountryMetadataForRegion()) || [];\n return formats.map(function (_) {\n return new Format(_, _this);\n });\n }\n }, {\n key: \"nationalPrefix\",\n value: function nationalPrefix() {\n return this.metadata[this.v1 ? 3 : this.v2 ? 4 : 5];\n }\n }, {\n key: \"_getNationalPrefixFormattingRule\",\n value: function _getNationalPrefixFormattingRule(metadata) {\n return metadata[this.v1 ? 4 : this.v2 ? 5 : 6];\n } // For countries of the same region (e.g. NANPA)\n // national prefix formatting rule is stored in the \"main\" country for that region.\n // E.g. \"RU\" and \"KZ\", \"US\" and \"CA\".\n\n }, {\n key: \"nationalPrefixFormattingRule\",\n value: function nationalPrefixFormattingRule() {\n return this._getNationalPrefixFormattingRule(this.metadata) || this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion());\n }\n }, {\n key: \"_nationalPrefixForParsing\",\n value: function _nationalPrefixForParsing() {\n return this.metadata[this.v1 ? 5 : this.v2 ? 6 : 7];\n }\n }, {\n key: \"nationalPrefixForParsing\",\n value: function nationalPrefixForParsing() {\n // If `national_prefix_for_parsing` is not set explicitly,\n // then infer it from `national_prefix` (if any)\n return this._nationalPrefixForParsing() || this.nationalPrefix();\n }\n }, {\n key: \"nationalPrefixTransformRule\",\n value: function nationalPrefixTransformRule() {\n return this.metadata[this.v1 ? 6 : this.v2 ? 7 : 8];\n }\n }, {\n key: \"_getNationalPrefixIsOptionalWhenFormatting\",\n value: function _getNationalPrefixIsOptionalWhenFormatting() {\n return !!this.metadata[this.v1 ? 7 : this.v2 ? 8 : 9];\n } // For countries of the same region (e.g. NANPA)\n // \"national prefix is optional when formatting\" flag is\n // stored in the \"main\" country for that region.\n // E.g. \"RU\" and \"KZ\", \"US\" and \"CA\".\n\n }, {\n key: \"nationalPrefixIsOptionalWhenFormattingInNationalFormat\",\n value: function nationalPrefixIsOptionalWhenFormattingInNationalFormat() {\n return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata) || this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion());\n }\n }, {\n key: \"leadingDigits\",\n value: function leadingDigits() {\n return this.metadata[this.v1 ? 8 : this.v2 ? 9 : 10];\n }\n }, {\n key: \"types\",\n value: function types() {\n return this.metadata[this.v1 ? 9 : this.v2 ? 10 : 11];\n }\n }, {\n key: \"hasTypes\",\n value: function hasTypes() {\n // Versions 1.2.0 - 1.2.4: can be `[]`.\n\n /* istanbul ignore next */\n if (this.types() && this.types().length === 0) {\n return false;\n } // Versions <= 1.2.4: can be `undefined`.\n // Version >= 1.2.5: can be `0`.\n\n\n return !!this.types();\n }\n }, {\n key: \"type\",\n value: function type(_type2) {\n if (this.hasTypes() && getType(this.types(), _type2)) {\n return new Type(getType(this.types(), _type2), this);\n }\n }\n }, {\n key: \"ext\",\n value: function ext() {\n if (this.v1 || this.v2) return DEFAULT_EXT_PREFIX;\n return this.metadata[13] || DEFAULT_EXT_PREFIX;\n }\n }]);\n\n return NumberingPlan;\n}();\n\nvar Format =\n/*#__PURE__*/\nfunction () {\n function Format(format, metadata) {\n _classCallCheck(this, Format);\n\n this._format = format;\n this.metadata = metadata;\n }\n\n _createClass(Format, [{\n key: \"pattern\",\n value: function pattern() {\n return this._format[0];\n }\n }, {\n key: \"format\",\n value: function format() {\n return this._format[1];\n }\n }, {\n key: \"leadingDigitsPatterns\",\n value: function leadingDigitsPatterns() {\n return this._format[2] || [];\n }\n }, {\n key: \"nationalPrefixFormattingRule\",\n value: function nationalPrefixFormattingRule() {\n return this._format[3] || this.metadata.nationalPrefixFormattingRule();\n }\n }, {\n key: \"nationalPrefixIsOptionalWhenFormattingInNationalFormat\",\n value: function nationalPrefixIsOptionalWhenFormattingInNationalFormat() {\n return !!this._format[4] || this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat();\n }\n }, {\n key: \"nationalPrefixIsMandatoryWhenFormattingInNationalFormat\",\n value: function nationalPrefixIsMandatoryWhenFormattingInNationalFormat() {\n // National prefix is omitted if there's no national prefix formatting rule\n // set for this country, or when the national prefix formatting rule\n // contains no national prefix itself, or when this rule is set but\n // national prefix is optional for this phone number format\n // (and it is not enforced explicitly)\n return this.usesNationalPrefix() && !this.nationalPrefixIsOptionalWhenFormattingInNationalFormat();\n } // Checks whether national prefix formatting rule contains national prefix.\n\n }, {\n key: \"usesNationalPrefix\",\n value: function usesNationalPrefix() {\n return this.nationalPrefixFormattingRule() && // Check that national prefix formatting rule is not a \"dummy\" one.\n !FIRST_GROUP_ONLY_PREFIX_PATTERN.test(this.nationalPrefixFormattingRule()); // Previously, `FIRST_GROUP_ONLY_PREFIX_PATTERN` check was instead done via:\n // // Check that national prefix formatting rule is not a \"dummy\" one.\n // this.nationalPrefixFormattingRule() !== '$1' &&\n // // Check that national prefix formatting rule actually has national prefix digit(s).\n // // Filters out cases like \"($1)\".\n // // Is used in place of `libphonenumber`'s `FIRST_GROUP_ONLY_PREFIX_PATTERN_` regexp.\n // /\\d/.test(this.nationalPrefixFormattingRule().replace('$1', ''))\n }\n }, {\n key: \"internationalFormat\",\n value: function internationalFormat() {\n return this._format[5] || this.format();\n }\n }]);\n\n return Format;\n}();\n/**\r\n * A pattern that is used to determine if the national prefix formatting rule\r\n * has the first group only, i.e., does not start with the national prefix.\r\n * Note that the pattern explicitly allows for unbalanced parentheses.\r\n */\n\n\nvar FIRST_GROUP_ONLY_PREFIX_PATTERN = /^\\(?\\$1\\)?$/;\n\nvar Type =\n/*#__PURE__*/\nfunction () {\n function Type(type, metadata) {\n _classCallCheck(this, Type);\n\n this.type = type;\n this.metadata = metadata;\n }\n\n _createClass(Type, [{\n key: \"pattern\",\n value: function pattern() {\n if (this.metadata.v1) return this.type;\n return this.type[0];\n }\n }, {\n key: \"possibleLengths\",\n value: function possibleLengths() {\n if (this.metadata.v1) return;\n return this.type[1] || this.metadata.possibleLengths();\n }\n }]);\n\n return Type;\n}();\n\nfunction getType(types, type) {\n switch (type) {\n case 'FIXED_LINE':\n return types[0];\n\n case 'MOBILE':\n return types[1];\n\n case 'TOLL_FREE':\n return types[2];\n\n case 'PREMIUM_RATE':\n return types[3];\n\n case 'PERSONAL_NUMBER':\n return types[4];\n\n case 'VOICEMAIL':\n return types[5];\n\n case 'UAN':\n return types[6];\n\n case 'PAGER':\n return types[7];\n\n case 'VOIP':\n return types[8];\n\n case 'SHARED_COST':\n return types[9];\n }\n}\n\nexport function validateMetadata(metadata) {\n if (!metadata) {\n throw new Error('[libphonenumber-js] `metadata` argument not passed. Check your arguments.');\n } // `country_phone_code_to_countries` was renamed to\n // `country_calling_codes` in `1.0.18`.\n\n\n if (!is_object(metadata) || !is_object(metadata.countries)) {\n throw new Error(\"[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got \".concat(is_object(metadata) ? 'an object of shape: { ' + Object.keys(metadata).join(', ') + ' }' : 'a ' + type_of(metadata) + ': ' + metadata, \".\"));\n }\n} // Babel transforms `typeof` into some \"branches\"\n// so istanbul will show this as \"branch not covered\".\n\n/* istanbul ignore next */\n\nvar is_object = function is_object(_) {\n return _typeof(_) === 'object';\n}; // Babel transforms `typeof` into some \"branches\"\n// so istanbul will show this as \"branch not covered\".\n\n/* istanbul ignore next */\n\n\nvar type_of = function type_of(_) {\n return _typeof(_);\n};\n/**\r\n * Returns extension prefix for a country.\r\n * @param {string} country\r\n * @param {object} metadata\r\n * @return {string?}\r\n * @example\r\n * // Returns \" ext. \"\r\n * getExtPrefix(\"US\")\r\n */\n\n\nexport function getExtPrefix(country, metadata) {\n metadata = new Metadata(metadata);\n\n if (metadata.hasCountry(country)) {\n return metadata.country(country).ext();\n }\n\n return DEFAULT_EXT_PREFIX;\n}\n/**\r\n * Returns \"country calling code\" for a country.\r\n * Throws an error if the country doesn't exist or isn't supported by this library.\r\n * @param {string} country\r\n * @param {object} metadata\r\n * @return {string}\r\n * @example\r\n * // Returns \"44\"\r\n * getCountryCallingCode(\"GB\")\r\n */\n\nexport function getCountryCallingCode(country, metadata) {\n metadata = new Metadata(metadata);\n\n if (metadata.hasCountry(country)) {\n return metadata.country(country).countryCallingCode();\n }\n\n throw new Error(\"Unknown country: \".concat(country));\n}\nexport function isSupportedCountry(country, metadata) {\n // metadata = new Metadata(metadata)\n // return metadata.hasCountry(country)\n return metadata.countries[country] !== undefined;\n}\n\nfunction setVersion(metadata) {\n this.v1 = !metadata.version;\n this.v2 = metadata.version !== undefined && compare(metadata.version, V3) === -1;\n this.v3 = metadata.version !== undefined && compare(metadata.version, V4) === -1;\n this.v4 = metadata.version !== undefined; // && compare(metadata.version, V5) === -1\n} // const ISO_COUNTRY_CODE = /^[A-Z]{2}$/\n// function isCountryCode(countryCode) {\n// \treturn ISO_COUNTRY_CODE.test(countryCodeOrCountryCallingCode)\n// }\n//# sourceMappingURL=metadata.js.map","import { VALID_DIGITS } from './constants'; // The RFC 3966 format for extensions.\n\nvar RFC3966_EXTN_PREFIX = ';ext='; // Pattern to capture digits used in an extension.\n// Places a maximum length of '7' for an extension.\n\nvar CAPTURING_EXTN_DIGITS = '([' + VALID_DIGITS + ']{1,7})';\n/**\r\n * Regexp of all possible ways to write extensions, for use when parsing. This\r\n * will be run as a case-insensitive regexp match. Wide character versions are\r\n * also provided after each ASCII version. There are three regular expressions\r\n * here. The first covers RFC 3966 format, where the extension is added using\r\n * ';ext='. The second more generic one starts with optional white space and\r\n * ends with an optional full stop (.), followed by zero or more spaces/tabs\r\n * /commas and then the numbers themselves. The other one covers the special\r\n * case of American numbers where the extension is written with a hash at the\r\n * end, such as '- 503#'. Note that the only capturing groups should be around\r\n * the digits that you want to capture as part of the extension, or else parsing\r\n * will fail! We allow two options for representing the accented o - the\r\n * character itself, and one in the unicode decomposed form with the combining\r\n * acute accent.\r\n */\n\nfunction create_extension_pattern(purpose) {\n // One-character symbols that can be used to indicate an extension.\n var single_extension_characters = \"x\\uFF58#\\uFF03~\\uFF5E\";\n\n switch (purpose) {\n // For parsing, we are slightly more lenient in our interpretation than for matching. Here we\n // allow \"comma\" and \"semicolon\" as possible extension indicators. When matching, these are\n case 'parsing':\n single_extension_characters = ',;' + single_extension_characters;\n }\n\n return RFC3966_EXTN_PREFIX + CAPTURING_EXTN_DIGITS + '|' + \"[ \\xA0\\\\t,]*\" + \"(?:e?xt(?:ensi(?:o\\u0301?|\\xF3))?n?|\\uFF45?\\uFF58\\uFF54\\uFF4E?|\" + // \"доб.\"\n \"\\u0434\\u043E\\u0431|\" + '[' + single_extension_characters + \"]|int|anexo|\\uFF49\\uFF4E\\uFF54)\" + \"[:\\\\.\\uFF0E]?[ \\xA0\\\\t,-]*\" + CAPTURING_EXTN_DIGITS + '#?|' + '[- ]+([' + VALID_DIGITS + ']{1,5})#';\n}\n/**\r\n * Regexp of all possible ways to write extensions, for use when parsing. This\r\n * will be run as a case-insensitive regexp match. Wide character versions are\r\n * also provided after each ASCII version. There are three regular expressions\r\n * here. The first covers RFC 3966 format, where the extension is added using\r\n * ';ext='. The second more generic one starts with optional white space and\r\n * ends with an optional full stop (.), followed by zero or more spaces/tabs\r\n * /commas and then the numbers themselves. The other one covers the special\r\n * case of American numbers where the extension is written with a hash at the\r\n * end, such as '- 503#'. Note that the only capturing groups should be around\r\n * the digits that you want to capture as part of the extension, or else parsing\r\n * will fail! We allow two options for representing the accented o - the\r\n * character itself, and one in the unicode decomposed form with the combining\r\n * acute accent.\r\n */\n\n\nexport var EXTN_PATTERNS_FOR_PARSING = create_extension_pattern('parsing');\nexport var EXTN_PATTERNS_FOR_MATCHING = create_extension_pattern('matching'); // Regexp of all known extension prefixes used by different regions followed by\n// 1 or more valid digits, for use when parsing.\n\nvar EXTN_PATTERN = new RegExp('(?:' + EXTN_PATTERNS_FOR_PARSING + ')$', 'i'); // Strips any extension (as in, the part of the number dialled after the call is\n// connected, usually indicated with extn, ext, x or similar) from the end of\n// the number, and returns it.\n\nexport function extractExtension(number) {\n var start = number.search(EXTN_PATTERN);\n\n if (start < 0) {\n return {};\n } // If we find a potential extension, and the number preceding this is a viable\n // number, we assume it is an extension.\n\n\n var number_without_extension = number.slice(0, start);\n var matches = number.match(EXTN_PATTERN);\n var i = 1;\n\n while (i < matches.length) {\n if (matches[i] != null && matches[i].length > 0) {\n return {\n number: number_without_extension,\n ext: matches[i]\n };\n }\n\n i++;\n }\n}\n//# sourceMappingURL=extension.js.map","import { MIN_LENGTH_FOR_NSN, VALID_DIGITS, VALID_PUNCTUATION, PLUS_CHARS } from './constants';\nimport { EXTN_PATTERNS_FOR_PARSING } from './extension'; // Regular expression of viable phone numbers. This is location independent.\n// Checks we have at least three leading digits, and only valid punctuation,\n// alpha characters and digits in the phone number. Does not include extension\n// data. The symbol 'x' is allowed here as valid punctuation since it is often\n// used as a placeholder for carrier codes, for example in Brazilian phone\n// numbers. We also allow multiple '+' characters at the start.\n//\n// Corresponds to the following:\n// [digits]{minLengthNsn}|\n// plus_sign*\n// (([punctuation]|[star])*[digits]){3,}([punctuation]|[star]|[digits]|[alpha])*\n//\n// The first reg-ex is to allow short numbers (two digits long) to be parsed if\n// they are entered as \"15\" etc, but only if there is no punctuation in them.\n// The second expression restricts the number of digits to three or more, but\n// then allows them to be in international form, and to have alpha-characters\n// and punctuation. We split up the two reg-exes here and combine them when\n// creating the reg-ex VALID_PHONE_NUMBER_PATTERN itself so we can prefix it\n// with ^ and append $ to each branch.\n//\n// \"Note VALID_PUNCTUATION starts with a -,\n// so must be the first in the range\" (c) Google devs.\n// (wtf did they mean by saying that; probably nothing)\n//\n\nvar MIN_LENGTH_PHONE_NUMBER_PATTERN = '[' + VALID_DIGITS + ']{' + MIN_LENGTH_FOR_NSN + '}'; //\n// And this is the second reg-exp:\n// (see MIN_LENGTH_PHONE_NUMBER_PATTERN for a full description of this reg-exp)\n//\n\nvar VALID_PHONE_NUMBER = '[' + PLUS_CHARS + ']{0,1}' + '(?:' + '[' + VALID_PUNCTUATION + ']*' + '[' + VALID_DIGITS + ']' + '){3,}' + '[' + VALID_PUNCTUATION + VALID_DIGITS + ']*'; // The combined regular expression for valid phone numbers:\n//\n\nvar VALID_PHONE_NUMBER_PATTERN = new RegExp( // Either a short two-digit-only phone number\n'^' + MIN_LENGTH_PHONE_NUMBER_PATTERN + '$' + '|' + // Or a longer fully parsed phone number (min 3 characters)\n'^' + VALID_PHONE_NUMBER + // Phone number extensions\n'(?:' + EXTN_PATTERNS_FOR_PARSING + ')?' + '$', 'i'); // Checks to see if the string of characters could possibly be a phone number at\n// all. At the moment, checks to see that the string begins with at least 2\n// digits, ignoring any punctuation commonly found in phone numbers. This method\n// does not require the number to be normalized in advance - but does assume\n// that leading non-number symbols have been removed, such as by the method\n// `extract_possible_number`.\n//\n\nexport default function isViablePhoneNumber(number) {\n return number.length >= MIN_LENGTH_FOR_NSN && VALID_PHONE_NUMBER_PATTERN.test(number);\n}\n//# sourceMappingURL=isViablePhoneNumber.js.map","// These mappings map a character (key) to a specific digit that should\n// replace it for normalization purposes. Non-European digits that\n// may be used in phone numbers are mapped to a European equivalent.\n//\n// E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`.\n//\nexport var DIGITS = {\n '0': '0',\n '1': '1',\n '2': '2',\n '3': '3',\n '4': '4',\n '5': '5',\n '6': '6',\n '7': '7',\n '8': '8',\n '9': '9',\n \"\\uFF10\": '0',\n // Fullwidth digit 0\n \"\\uFF11\": '1',\n // Fullwidth digit 1\n \"\\uFF12\": '2',\n // Fullwidth digit 2\n \"\\uFF13\": '3',\n // Fullwidth digit 3\n \"\\uFF14\": '4',\n // Fullwidth digit 4\n \"\\uFF15\": '5',\n // Fullwidth digit 5\n \"\\uFF16\": '6',\n // Fullwidth digit 6\n \"\\uFF17\": '7',\n // Fullwidth digit 7\n \"\\uFF18\": '8',\n // Fullwidth digit 8\n \"\\uFF19\": '9',\n // Fullwidth digit 9\n \"\\u0660\": '0',\n // Arabic-indic digit 0\n \"\\u0661\": '1',\n // Arabic-indic digit 1\n \"\\u0662\": '2',\n // Arabic-indic digit 2\n \"\\u0663\": '3',\n // Arabic-indic digit 3\n \"\\u0664\": '4',\n // Arabic-indic digit 4\n \"\\u0665\": '5',\n // Arabic-indic digit 5\n \"\\u0666\": '6',\n // Arabic-indic digit 6\n \"\\u0667\": '7',\n // Arabic-indic digit 7\n \"\\u0668\": '8',\n // Arabic-indic digit 8\n \"\\u0669\": '9',\n // Arabic-indic digit 9\n \"\\u06F0\": '0',\n // Eastern-Arabic digit 0\n \"\\u06F1\": '1',\n // Eastern-Arabic digit 1\n \"\\u06F2\": '2',\n // Eastern-Arabic digit 2\n \"\\u06F3\": '3',\n // Eastern-Arabic digit 3\n \"\\u06F4\": '4',\n // Eastern-Arabic digit 4\n \"\\u06F5\": '5',\n // Eastern-Arabic digit 5\n \"\\u06F6\": '6',\n // Eastern-Arabic digit 6\n \"\\u06F7\": '7',\n // Eastern-Arabic digit 7\n \"\\u06F8\": '8',\n // Eastern-Arabic digit 8\n \"\\u06F9\": '9' // Eastern-Arabic digit 9\n\n};\nexport function parseDigit(character) {\n return DIGITS[character];\n}\n/**\r\n * Parses phone number digits from a string.\r\n * Drops all punctuation leaving only digits.\r\n * Also converts wide-ascii and arabic-indic numerals to conventional numerals.\r\n * E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`.\r\n * @param {string} string\r\n * @return {string}\r\n * @example\r\n * ```js\r\n * parseDigits('8 (800) 555')\r\n * // Outputs '8800555'.\r\n * ```\r\n */\n\nexport default function parseDigits(string) {\n var result = ''; // Using `.split('')` here instead of normal `for ... of`\n // because the importing application doesn't neccessarily include an ES6 polyfill.\n // The `.split('')` approach discards \"exotic\" UTF-8 characters\n // (the ones consisting of four bytes) but digits\n // (including non-European ones) don't fall into that range\n // so such \"exotic\" characters would be discarded anyway.\n\n for (var _iterator = string.split(''), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref = _i.value;\n }\n\n var character = _ref;\n var digit = parseDigit(character);\n\n if (digit) {\n result += digit;\n }\n }\n\n return result;\n}\n//# sourceMappingURL=parseDigits.js.map","import { parseDigit } from './parseDigits';\n/**\r\n * Parses phone number characters from a string.\r\n * Drops all punctuation leaving only digits and the leading `+` sign (if any).\r\n * Also converts wide-ascii and arabic-indic numerals to conventional numerals.\r\n * E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`.\r\n * @param {string} string\r\n * @return {string}\r\n * @example\r\n * ```js\r\n * // Outputs '8800555'.\r\n * parseIncompletePhoneNumber('8 (800) 555')\r\n * // Outputs '+7800555'.\r\n * parseIncompletePhoneNumber('+7 800 555')\r\n * ```\r\n */\n\nexport default function parseIncompletePhoneNumber(string) {\n var result = ''; // Using `.split('')` here instead of normal `for ... of`\n // because the importing application doesn't neccessarily include an ES6 polyfill.\n // The `.split('')` approach discards \"exotic\" UTF-8 characters\n // (the ones consisting of four bytes) but digits\n // (including non-European ones) don't fall into that range\n // so such \"exotic\" characters would be discarded anyway.\n\n for (var _iterator = string.split(''), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref = _i.value;\n }\n\n var character = _ref;\n result += parsePhoneNumberCharacter(character, result) || '';\n }\n\n return result;\n}\n/**\r\n * `input-format` `parse()` function.\r\n * https://gitlab.com/catamphetamine/input-format\r\n * @param {string} character - Yet another character from raw input string.\r\n * @param {string} value - The value parsed so far.\r\n * @param {object} meta - Optional custom use-case-specific metadata.\r\n * @return {string?} The parsed character.\r\n */\n\nexport function parsePhoneNumberCharacter(character, value) {\n // Only allow a leading `+`.\n if (character === '+') {\n // If this `+` is not the first parsed character\n // then discard it.\n if (value) {\n return;\n }\n\n return '+';\n } // Allow digits.\n\n\n return parseDigit(character);\n}\n//# sourceMappingURL=parseIncompletePhoneNumber.js.map","import Metadata from './metadata';\nimport { matchesEntirely, mergeArrays } from './util';\nvar NON_FIXED_LINE_PHONE_TYPES = ['MOBILE', 'PREMIUM_RATE', 'TOLL_FREE', 'SHARED_COST', 'VOIP', 'PERSONAL_NUMBER', 'PAGER', 'UAN', 'VOICEMAIL']; // Finds out national phone number type (fixed line, mobile, etc)\n\nexport default function getNumberType(input, options, metadata) {\n // If assigning the `{}` default value is moved to the arguments above,\n // code coverage would decrease for some weird reason.\n options = options || {}; // When `parse()` returned `{}`\n // meaning that the phone number is not a valid one.\n\n if (!input.country) {\n return;\n }\n\n metadata = new Metadata(metadata);\n metadata.selectNumberingPlan(input.country, input.countryCallingCode);\n var nationalNumber = options.v2 ? input.nationalNumber : input.phone; // The following is copy-pasted from the original function:\n // https://github.com/googlei18n/libphonenumber/blob/3ea547d4fbaa2d0b67588904dfa5d3f2557c27ff/javascript/i18n/phonenumbers/phonenumberutil.js#L2835\n // Is this national number even valid for this country\n\n if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern())) {\n return;\n } // Is it fixed line number\n\n\n if (is_of_type(nationalNumber, 'FIXED_LINE', metadata)) {\n // Because duplicate regular expressions are removed\n // to reduce metadata size, if \"mobile\" pattern is \"\"\n // then it means it was removed due to being a duplicate of the fixed-line pattern.\n //\n if (metadata.type('MOBILE') && metadata.type('MOBILE').pattern() === '') {\n return 'FIXED_LINE_OR_MOBILE';\n } // v1 metadata.\n // Legacy.\n // Deprecated.\n\n\n if (!metadata.type('MOBILE')) {\n return 'FIXED_LINE_OR_MOBILE';\n } // Check if the number happens to qualify as both fixed line and mobile.\n // (no such country in the minimal metadata set)\n\n /* istanbul ignore if */\n\n\n if (is_of_type(nationalNumber, 'MOBILE', metadata)) {\n return 'FIXED_LINE_OR_MOBILE';\n }\n\n return 'FIXED_LINE';\n }\n\n for (var _i = 0, _NON_FIXED_LINE_PHONE = NON_FIXED_LINE_PHONE_TYPES; _i < _NON_FIXED_LINE_PHONE.length; _i++) {\n var _type = _NON_FIXED_LINE_PHONE[_i];\n\n if (is_of_type(nationalNumber, _type, metadata)) {\n return _type;\n }\n }\n}\nexport function is_of_type(nationalNumber, type, metadata) {\n type = metadata.type(type);\n\n if (!type || !type.pattern()) {\n return false;\n } // Check if any possible number lengths are present;\n // if so, we use them to avoid checking\n // the validation pattern if they don't match.\n // If they are absent, this means they match\n // the general description, which we have\n // already checked before a specific number type.\n\n\n if (type.possibleLengths() && type.possibleLengths().indexOf(nationalNumber.length) < 0) {\n return false;\n }\n\n return matchesEntirely(nationalNumber, type.pattern());\n} // Should only be called for the \"new\" metadata which has \"possible lengths\".\n\nexport function checkNumberLengthForType(nationalNumber, type, metadata) {\n var type_info = metadata.type(type); // There should always be \"\" set for every type element.\n // This is declared in the XML schema.\n // For size efficiency, where a sub-description (e.g. fixed-line)\n // has the same \"\" as the \"general description\", this is missing,\n // so we fall back to the \"general description\". Where no numbers of the type\n // exist at all, there is one possible length (-1) which is guaranteed\n // not to match the length of any real phone number.\n\n var possible_lengths = type_info && type_info.possibleLengths() || metadata.possibleLengths(); // let local_lengths = type_info && type.possibleLengthsLocal() || metadata.possibleLengthsLocal()\n // Metadata before version `1.0.18` didn't contain `possible_lengths`.\n\n if (!possible_lengths) {\n return 'IS_POSSIBLE';\n }\n\n if (type === 'FIXED_LINE_OR_MOBILE') {\n // No such country in metadata.\n\n /* istanbul ignore next */\n if (!metadata.type('FIXED_LINE')) {\n // The rare case has been encountered where no fixedLine data is available\n // (true for some non-geographic entities), so we just check mobile.\n return checkNumberLengthForType(nationalNumber, 'MOBILE', metadata);\n }\n\n var mobile_type = metadata.type('MOBILE');\n\n if (mobile_type) {\n // Merge the mobile data in if there was any. \"Concat\" creates a new\n // array, it doesn't edit possible_lengths in place, so we don't need a copy.\n // Note that when adding the possible lengths from mobile, we have\n // to again check they aren't empty since if they are this indicates\n // they are the same as the general desc and should be obtained from there.\n possible_lengths = mergeArrays(possible_lengths, mobile_type.possibleLengths()); // The current list is sorted; we need to merge in the new list and\n // re-sort (duplicates are okay). Sorting isn't so expensive because\n // the lists are very small.\n // if (local_lengths)\n // {\n // \tlocal_lengths = mergeArrays(local_lengths, mobile_type.possibleLengthsLocal())\n // }\n // else\n // {\n // \tlocal_lengths = mobile_type.possibleLengthsLocal()\n // }\n }\n } // If the type doesn't exist then return 'INVALID_LENGTH'.\n else if (type && !type_info) {\n return 'INVALID_LENGTH';\n }\n\n var actual_length = nationalNumber.length; // In `libphonenumber-js` all \"local-only\" formats are dropped for simplicity.\n // // This is safe because there is never an overlap beween the possible lengths\n // // and the local-only lengths; this is checked at build time.\n // if (local_lengths && local_lengths.indexOf(nationalNumber.length) >= 0)\n // {\n // \treturn 'IS_POSSIBLE_LOCAL_ONLY'\n // }\n\n var minimum_length = possible_lengths[0];\n\n if (minimum_length === actual_length) {\n return 'IS_POSSIBLE';\n }\n\n if (minimum_length > actual_length) {\n return 'TOO_SHORT';\n }\n\n if (possible_lengths[possible_lengths.length - 1] < actual_length) {\n return 'TOO_LONG';\n } // We skip the first element since we've already checked it.\n\n\n return possible_lengths.indexOf(actual_length, 1) >= 0 ? 'IS_POSSIBLE' : 'INVALID_LENGTH';\n}\n//# sourceMappingURL=getNumberType_.js.map","import Metadata from './metadata';\nimport { checkNumberLengthForType } from './getNumberType_';\nexport default function isPossiblePhoneNumber(input, options, metadata) {\n /* istanbul ignore if */\n if (options === undefined) {\n options = {};\n }\n\n metadata = new Metadata(metadata);\n\n if (options.v2) {\n if (!input.countryCallingCode) {\n throw new Error('Invalid phone number object passed');\n }\n\n metadata.chooseCountryByCountryCallingCode(input.countryCallingCode);\n } else {\n if (!input.phone) {\n return false;\n }\n\n if (input.country) {\n if (!metadata.hasCountry(input.country)) {\n throw new Error(\"Unknown country: \".concat(input.country));\n }\n\n metadata.country(input.country);\n } else {\n if (!input.countryCallingCode) {\n throw new Error('Invalid phone number object passed');\n }\n\n metadata.chooseCountryByCountryCallingCode(input.countryCallingCode);\n }\n }\n\n if (metadata.possibleLengths()) {\n return isPossibleNumber(input.phone || input.nationalNumber, undefined, metadata);\n } else {\n // There was a bug between `1.7.35` and `1.7.37` where \"possible_lengths\"\n // were missing for \"non-geographical\" numbering plans.\n // Just assume the number is possible in such cases:\n // it's unlikely that anyone generated their custom metadata\n // in that short period of time (one day).\n // This code can be removed in some future major version update.\n if (input.countryCallingCode && metadata.isNonGeographicCallingCode(input.countryCallingCode)) {\n // \"Non-geographic entities\" did't have `possibleLengths`\n // due to a bug in metadata generation process.\n return true;\n } else {\n throw new Error('Missing \"possibleLengths\" in metadata. Perhaps the metadata has been generated before v1.0.18.');\n }\n }\n}\nexport function isPossibleNumber(nationalNumber, isInternational, metadata) {\n switch (checkNumberLengthForType(nationalNumber, undefined, metadata)) {\n case 'IS_POSSIBLE':\n return true;\n // case 'IS_POSSIBLE_LOCAL_ONLY':\n // \treturn !isInternational\n\n default:\n return false;\n }\n}\n//# sourceMappingURL=isPossibleNumber_.js.map","import Metadata from './metadata';\nimport { VALID_DIGITS } from './constants';\nvar CAPTURING_DIGIT_PATTERN = new RegExp('([' + VALID_DIGITS + '])');\n/**\r\n * Pattern that makes it easy to distinguish whether a region has a single\r\n * international dialing prefix or not. If a region has a single international\r\n * prefix (e.g. 011 in USA), it will be represented as a string that contains\r\n * a sequence of ASCII digits, and possibly a tilde, which signals waiting for\r\n * the tone. If there are multiple available international prefixes in a\r\n * region, they will be represented as a regex string that always contains one\r\n * or more characters that are not ASCII digits or a tilde.\r\n */\n\nvar SINGLE_IDD_PREFIX = /^[\\d]+(?:[~\\u2053\\u223C\\uFF5E][\\d]+)?$/; // For regions that have multiple IDD prefixes\n// a preferred IDD prefix is returned.\n\nexport function getIDDPrefix(country, callingCode, metadata) {\n var countryMetadata = new Metadata(metadata);\n countryMetadata.selectNumberingPlan(country, callingCode);\n\n if (SINGLE_IDD_PREFIX.test(countryMetadata.IDDPrefix())) {\n return countryMetadata.IDDPrefix();\n }\n\n return countryMetadata.defaultIDDPrefix();\n}\nexport function stripIDDPrefix(number, country, callingCode, metadata) {\n if (!country) {\n return;\n } // Check if the number is IDD-prefixed.\n\n\n var countryMetadata = new Metadata(metadata);\n countryMetadata.selectNumberingPlan(country, callingCode);\n var IDDPrefixPattern = new RegExp(countryMetadata.IDDPrefix());\n\n if (number.search(IDDPrefixPattern) !== 0) {\n return;\n } // Strip IDD prefix.\n\n\n number = number.slice(number.match(IDDPrefixPattern)[0].length); // Some kind of a weird edge case.\n // No explanation from Google given.\n\n var matchedGroups = number.match(CAPTURING_DIGIT_PATTERN);\n /* istanbul ignore next */\n\n if (matchedGroups && matchedGroups[1] != null && matchedGroups[1].length > 0) {\n if (matchedGroups[1] === '0') {\n return;\n }\n }\n\n return number;\n}\n//# sourceMappingURL=IDD.js.map","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nimport isViablePhoneNumber from './isViablePhoneNumber'; // https://www.ietf.org/rfc/rfc3966.txt\n\n/**\r\n * @param {string} text - Phone URI (RFC 3966).\r\n * @return {object} `{ ?number, ?ext }`.\r\n */\n\nexport function parseRFC3966(text) {\n var number;\n var ext; // Replace \"tel:\" with \"tel=\" for parsing convenience.\n\n text = text.replace(/^tel:/, 'tel=');\n\n for (var _iterator = text.split(';'), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref = _i.value;\n }\n\n var part = _ref;\n\n var _part$split = part.split('='),\n _part$split2 = _slicedToArray(_part$split, 2),\n name = _part$split2[0],\n value = _part$split2[1];\n\n switch (name) {\n case 'tel':\n number = value;\n break;\n\n case 'ext':\n ext = value;\n break;\n\n case 'phone-context':\n // Only \"country contexts\" are supported.\n // \"Domain contexts\" are ignored.\n if (value[0] === '+') {\n number = value + number;\n }\n\n break;\n }\n } // If the phone number is not viable, then abort.\n\n\n if (!isViablePhoneNumber(number)) {\n return {};\n }\n\n var result = {\n number: number\n };\n\n if (ext) {\n result.ext = ext;\n }\n\n return result;\n}\n/**\r\n * @param {object} - `{ ?number, ?extension }`.\r\n * @return {string} Phone URI (RFC 3966).\r\n */\n\nexport function formatRFC3966(_ref2) {\n var number = _ref2.number,\n ext = _ref2.ext;\n\n if (!number) {\n return '';\n }\n\n if (number[0] !== '+') {\n throw new Error(\"\\\"formatRFC3966()\\\" expects \\\"number\\\" to be in E.164 format.\");\n }\n\n return \"tel:\".concat(number).concat(ext ? ';ext=' + ext : '');\n}\n//# sourceMappingURL=RFC3966.js.map","function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n// This is a port of Google Android `libphonenumber`'s\n// `phonenumberutil.js` of December 31th, 2018.\n//\n// https://github.com/googlei18n/libphonenumber/commits/master/javascript/i18n/phonenumbers/phonenumberutil.js\nimport { VALID_PUNCTUATION } from './constants';\nimport { matchesEntirely } from './util';\nimport Metadata from './metadata';\nimport { getIDDPrefix } from './IDD';\nimport { formatRFC3966 } from './RFC3966';\nvar DEFAULT_OPTIONS = {\n formatExtension: function formatExtension(formattedNumber, extension, metadata) {\n return \"\".concat(formattedNumber).concat(metadata.ext()).concat(extension);\n } // Formats a phone number\n //\n // Example use cases:\n //\n // ```js\n // formatNumber('8005553535', 'RU', 'INTERNATIONAL')\n // formatNumber('8005553535', 'RU', 'INTERNATIONAL', metadata)\n // formatNumber({ phone: '8005553535', country: 'RU' }, 'INTERNATIONAL')\n // formatNumber({ phone: '8005553535', country: 'RU' }, 'INTERNATIONAL', metadata)\n // formatNumber('+78005553535', 'NATIONAL')\n // formatNumber('+78005553535', 'NATIONAL', metadata)\n // ```\n //\n\n};\nexport default function formatNumber(input, format, options, metadata) {\n // Apply default options.\n if (options) {\n options = _objectSpread({}, DEFAULT_OPTIONS, options);\n } else {\n options = DEFAULT_OPTIONS;\n }\n\n metadata = new Metadata(metadata);\n\n if (input.country && input.country !== '001') {\n // Validate `input.country`.\n if (!metadata.hasCountry(input.country)) {\n throw new Error(\"Unknown country: \".concat(input.country));\n }\n\n metadata.country(input.country);\n } else if (input.countryCallingCode) {\n metadata.chooseCountryByCountryCallingCode(input.countryCallingCode);\n } else return input.phone || '';\n\n var countryCallingCode = metadata.countryCallingCode();\n var nationalNumber = options.v2 ? input.nationalNumber : input.phone; // This variable should have been declared inside `case`s\n // but Babel has a bug and it says \"duplicate variable declaration\".\n\n var number;\n\n switch (format) {\n case 'NATIONAL':\n // Legacy argument support.\n // (`{ country: ..., phone: '' }`)\n if (!nationalNumber) {\n return '';\n }\n\n number = formatNationalNumber(nationalNumber, 'NATIONAL', metadata, options);\n return addExtension(number, input.ext, metadata, options.formatExtension);\n\n case 'INTERNATIONAL':\n // Legacy argument support.\n // (`{ country: ..., phone: '' }`)\n if (!nationalNumber) {\n return \"+\".concat(countryCallingCode);\n }\n\n number = formatNationalNumber(nationalNumber, 'INTERNATIONAL', metadata, options);\n number = \"+\".concat(countryCallingCode, \" \").concat(number);\n return addExtension(number, input.ext, metadata, options.formatExtension);\n\n case 'E.164':\n // `E.164` doesn't define \"phone number extensions\".\n return \"+\".concat(countryCallingCode).concat(nationalNumber);\n\n case 'RFC3966':\n return formatRFC3966({\n number: \"+\".concat(countryCallingCode).concat(nationalNumber),\n ext: input.ext\n });\n\n case 'IDD':\n if (!options.fromCountry) {\n return; // throw new Error('`fromCountry` option not passed for IDD-prefixed formatting.')\n }\n\n var IDDPrefix = getIDDPrefix(options.fromCountry, undefined, metadata.metadata);\n\n if (!IDDPrefix) {\n return;\n }\n\n if (options.humanReadable) {\n var formattedForSameCountryCallingCode = countryCallingCode && formatIDDSameCountryCallingCodeNumber(nationalNumber, metadata.countryCallingCode(), options.fromCountry, metadata, options);\n\n if (formattedForSameCountryCallingCode) {\n number = formattedForSameCountryCallingCode;\n } else {\n number = \"\".concat(IDDPrefix, \" \").concat(countryCallingCode, \" \").concat(formatNationalNumber(nationalNumber, 'INTERNATIONAL', metadata, options));\n }\n\n return addExtension(number, input.ext, metadata, options.formatExtension);\n }\n\n return \"\".concat(IDDPrefix).concat(countryCallingCode).concat(nationalNumber);\n\n default:\n throw new Error(\"Unknown \\\"format\\\" argument passed to \\\"formatNumber()\\\": \\\"\".concat(format, \"\\\"\"));\n }\n} // This was originally set to $1 but there are some countries for which the\n// first group is not used in the national pattern (e.g. Argentina) so the $1\n// group does not match correctly. Therefore, we use \\d, so that the first\n// group actually used in the pattern will be matched.\n\nexport var FIRST_GROUP_PATTERN = /(\\$\\d)/;\nexport function formatNationalNumberUsingFormat(number, format, useInternationalSeparator, useNationalPrefixFormattingRule, metadata) {\n var formattedNumber = number.replace(new RegExp(format.pattern()), useInternationalSeparator ? format.internationalFormat() : useNationalPrefixFormattingRule && format.nationalPrefixFormattingRule() ? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule()) : format.format());\n\n if (useInternationalSeparator) {\n return applyInternationalSeparatorStyle(formattedNumber);\n }\n\n return formattedNumber;\n}\n\nfunction formatNationalNumber(number, formatAs, metadata, options) {\n var format = chooseFormatForNumber(metadata.formats(), number);\n\n if (!format) {\n return number;\n }\n\n return formatNationalNumberUsingFormat(number, format, formatAs === 'INTERNATIONAL', format.nationalPrefixIsOptionalWhenFormattingInNationalFormat() && options.nationalPrefix === false ? false : true, metadata);\n}\n\nfunction chooseFormatForNumber(availableFormats, nationalNnumber) {\n for (var _iterator = availableFormats, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref = _i.value;\n }\n\n var format = _ref;\n\n // Validate leading digits\n if (format.leadingDigitsPatterns().length > 0) {\n // The last leading_digits_pattern is used here, as it is the most detailed\n var lastLeadingDigitsPattern = format.leadingDigitsPatterns()[format.leadingDigitsPatterns().length - 1]; // If leading digits don't match then move on to the next phone number format\n\n if (nationalNnumber.search(lastLeadingDigitsPattern) !== 0) {\n continue;\n }\n } // Check that the national number matches the phone number format regular expression\n\n\n if (matchesEntirely(nationalNnumber, format.pattern())) {\n return format;\n }\n }\n} // Removes brackets and replaces dashes with spaces.\n//\n// E.g. \"(999) 111-22-33\" -> \"999 111 22 33\"\n//\n// For some reason Google's metadata contains ``s with brackets and dashes.\n// Meanwhile, there's no single opinion about using punctuation in international phone numbers.\n//\n// For example, Google's `` for USA is `+1 213-373-4253`.\n// And here's a quote from WikiPedia's \"North American Numbering Plan\" page:\n// https://en.wikipedia.org/wiki/North_American_Numbering_Plan\n//\n// \"The country calling code for all countries participating in the NANP is 1.\n// In international format, an NANP number should be listed as +1 301 555 01 00,\n// where 301 is an area code (Maryland).\"\n//\n// I personally prefer the international format without any punctuation.\n// For example, brackets are remnants of the old age, meaning that the\n// phone number part in brackets (so called \"area code\") can be omitted\n// if dialing within the same \"area\".\n// And hyphens were clearly introduced for splitting local numbers into memorizable groups.\n// For example, remembering \"5553535\" is difficult but \"555-35-35\" is much simpler.\n// Imagine a man taking a bus from home to work and seeing an ad with a phone number.\n// He has a couple of seconds to memorize that number until it passes by.\n// If it were spaces instead of hyphens the man wouldn't necessarily get it,\n// but with hyphens instead of spaces the grouping is more explicit.\n// I personally think that hyphens introduce visual clutter,\n// so I prefer replacing them with spaces in international numbers.\n// In the modern age all output is done on displays where spaces are clearly distinguishable\n// so hyphens can be safely replaced with spaces without losing any legibility.\n//\n\n\nexport function applyInternationalSeparatorStyle(local) {\n return local.replace(new RegExp(\"[\".concat(VALID_PUNCTUATION, \"]+\"), 'g'), ' ').trim();\n}\n\nfunction addExtension(formattedNumber, ext, metadata, formatExtension) {\n return ext ? formatExtension(formattedNumber, ext, metadata) : formattedNumber;\n}\n\nfunction formatIDDSameCountryCallingCodeNumber(number, toCountryCallingCode, fromCountry, toCountryMetadata, options) {\n var fromCountryMetadata = new Metadata(toCountryMetadata.metadata);\n fromCountryMetadata.country(fromCountry); // If calling within the same country calling code.\n\n if (toCountryCallingCode === fromCountryMetadata.countryCallingCode()) {\n // For NANPA regions, return the national format for these regions\n // but prefix it with the country calling code.\n if (toCountryCallingCode === '1') {\n return toCountryCallingCode + ' ' + formatNationalNumber(number, 'NATIONAL', toCountryMetadata, options);\n } // If regions share a country calling code, the country calling code need\n // not be dialled. This also applies when dialling within a region, so this\n // if clause covers both these cases. Technically this is the case for\n // dialling from La Reunion to other overseas departments of France (French\n // Guiana, Martinique, Guadeloupe), but not vice versa - so we don't cover\n // this edge case for now and for those cases return the version including\n // country calling code. Details here:\n // http://www.petitfute.com/voyage/225-info-pratiques-reunion\n //\n\n\n return formatNationalNumber(number, 'NATIONAL', toCountryMetadata, options);\n }\n}\n//# sourceMappingURL=format_.js.map","function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport Metadata from './metadata';\nimport isPossibleNumber from './isPossibleNumber_';\nimport isValidNumber from './validate_';\nimport isValidNumberForRegion from './isValidNumberForRegion_';\nimport getNumberType from './getNumberType_';\nimport formatNumber from './format_';\nvar USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;\n\nvar PhoneNumber =\n/*#__PURE__*/\nfunction () {\n function PhoneNumber(countryCallingCode, nationalNumber, metadata) {\n _classCallCheck(this, PhoneNumber);\n\n if (!countryCallingCode) {\n throw new TypeError('`country` or `countryCallingCode` not passed');\n }\n\n if (!nationalNumber) {\n throw new TypeError('`nationalNumber` not passed');\n }\n\n var _metadata = new Metadata(metadata); // If country code is passed then derive `countryCallingCode` from it.\n // Also store the country code as `.country`.\n\n\n if (isCountryCode(countryCallingCode)) {\n this.country = countryCallingCode;\n\n _metadata.country(countryCallingCode);\n\n countryCallingCode = _metadata.countryCallingCode();\n } else {\n /* istanbul ignore if */\n if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\n if (_metadata.isNonGeographicCallingCode(countryCallingCode)) {\n this.country = '001';\n }\n }\n }\n\n this.countryCallingCode = countryCallingCode;\n this.nationalNumber = nationalNumber;\n this.number = '+' + this.countryCallingCode + this.nationalNumber;\n this.metadata = metadata;\n }\n\n _createClass(PhoneNumber, [{\n key: \"isPossible\",\n value: function isPossible() {\n return isPossibleNumber(this, {\n v2: true\n }, this.metadata);\n }\n }, {\n key: \"isValid\",\n value: function isValid() {\n return isValidNumber(this, {\n v2: true\n }, this.metadata);\n }\n }, {\n key: \"isNonGeographic\",\n value: function isNonGeographic() {\n var metadata = new Metadata(this.metadata);\n return metadata.isNonGeographicCallingCode(this.countryCallingCode);\n }\n }, {\n key: \"isEqual\",\n value: function isEqual(phoneNumber) {\n return this.number === phoneNumber.number && this.ext === phoneNumber.ext;\n } // // Is just an alias for `this.isValid() && this.country === country`.\n // // https://github.com/googlei18n/libphonenumber/blob/master/FAQ.md#when-should-i-use-isvalidnumberforregion\n // isValidForRegion(country) {\n // \treturn isValidNumberForRegion(this, country, { v2: true }, this.metadata)\n // }\n\n }, {\n key: \"getType\",\n value: function getType() {\n return getNumberType(this, {\n v2: true\n }, this.metadata);\n }\n }, {\n key: \"format\",\n value: function format(_format, options) {\n return formatNumber(this, _format, options ? _objectSpread({}, options, {\n v2: true\n }) : {\n v2: true\n }, this.metadata);\n }\n }, {\n key: \"formatNational\",\n value: function formatNational(options) {\n return this.format('NATIONAL', options);\n }\n }, {\n key: \"formatInternational\",\n value: function formatInternational(options) {\n return this.format('INTERNATIONAL', options);\n }\n }, {\n key: \"getURI\",\n value: function getURI(options) {\n return this.format('RFC3966', options);\n }\n }]);\n\n return PhoneNumber;\n}();\n\nexport { PhoneNumber as default };\n\nvar isCountryCode = function isCountryCode(value) {\n return /^[A-Z]{2}$/.test(value);\n};\n//# sourceMappingURL=PhoneNumber.js.map","import Metadata from './metadata';\nimport { matchesEntirely } from './util';\nimport getNumberType from './getNumberType_';\n/**\r\n * Checks if a given phone number is valid.\r\n *\r\n * If the `number` is a string, it will be parsed to an object,\r\n * but only if it contains only valid phone number characters (including punctuation).\r\n * If the `number` is an object, it is used as is.\r\n *\r\n * The optional `defaultCountry` argument is the default country.\r\n * I.e. it does not restrict to just that country,\r\n * e.g. in those cases where several countries share\r\n * the same phone numbering rules (NANPA, Britain, etc).\r\n * For example, even though the number `07624 369230`\r\n * belongs to the Isle of Man (\"IM\" country code)\r\n * calling `isValidNumber('07624369230', 'GB', metadata)`\r\n * still returns `true` because the country is not restricted to `GB`,\r\n * it's just that `GB` is the default one for the phone numbering rules.\r\n * For restricting the country see `isValidNumberForRegion()`\r\n * though restricting a country might not be a good idea.\r\n * https://github.com/googlei18n/libphonenumber/blob/master/FAQ.md#when-should-i-use-isvalidnumberforregion\r\n *\r\n * Examples:\r\n *\r\n * ```js\r\n * isValidNumber('+78005553535', metadata)\r\n * isValidNumber('8005553535', 'RU', metadata)\r\n * isValidNumber('88005553535', 'RU', metadata)\r\n * isValidNumber({ phone: '8005553535', country: 'RU' }, metadata)\r\n * ```\r\n */\n\nexport default function isValidNumber(input, options, metadata) {\n // If assigning the `{}` default value is moved to the arguments above,\n // code coverage would decrease for some weird reason.\n options = options || {};\n metadata = new Metadata(metadata); // This is just to support `isValidNumber({})`\n // for cases when `parseNumber()` returns `{}`.\n\n if (!input.country) {\n return false;\n }\n\n metadata.selectNumberingPlan(input.country, input.countryCallingCode); // By default, countries only have type regexps when it's required for\n // distinguishing different countries having the same `countryCallingCode`.\n\n if (metadata.hasTypes()) {\n return getNumberType(input, options, metadata.metadata) !== undefined;\n } // If there are no type regexps for this country in metadata then use\n // `nationalNumberPattern` as a \"better than nothing\" replacement.\n\n\n var national_number = options.v2 ? input.nationalNumber : input.phone;\n return matchesEntirely(national_number, metadata.nationalNumberPattern());\n}\n//# sourceMappingURL=validate_.js.map","// This is a port of Google Android `libphonenumber`'s\n// `phonenumberutil.js` of December 31th, 2018.\n//\n// https://github.com/googlei18n/libphonenumber/commits/master/javascript/i18n/phonenumbers/phonenumberutil.js\nimport { VALID_DIGITS, PLUS_CHARS, MIN_LENGTH_FOR_NSN, MAX_LENGTH_FOR_NSN, MAX_LENGTH_COUNTRY_CODE } from './constants';\nimport { matchesEntirely } from './util';\nimport ParseError from './ParseError';\nimport Metadata from './metadata';\nimport isViablePhoneNumber from './isViablePhoneNumber';\nimport { extractExtension } from './extension';\nimport parseIncompletePhoneNumber from './parseIncompletePhoneNumber';\nimport getCountryCallingCode from './getCountryCallingCode';\nimport getNumberType, { checkNumberLengthForType } from './getNumberType_';\nimport { isPossibleNumber } from './isPossibleNumber_';\nimport { stripIDDPrefix } from './IDD';\nimport { parseRFC3966 } from './RFC3966';\nimport PhoneNumber from './PhoneNumber'; // We don't allow input strings for parsing to be longer than 250 chars.\n// This prevents malicious input from consuming CPU.\n\nvar MAX_INPUT_STRING_LENGTH = 250; // This consists of the plus symbol, digits, and arabic-indic digits.\n\nvar PHONE_NUMBER_START_PATTERN = new RegExp('[' + PLUS_CHARS + VALID_DIGITS + ']'); // Regular expression of trailing characters that we want to remove.\n\nvar AFTER_PHONE_NUMBER_END_PATTERN = new RegExp('[^' + VALID_DIGITS + ']+$');\nvar USE_NON_GEOGRAPHIC_COUNTRY_CODE = false; // `options`:\n// {\n// country:\n// {\n// restrict - (a two-letter country code)\n// the phone number must be in this country\n//\n// default - (a two-letter country code)\n// default country to use for phone number parsing and validation\n// (if no country code could be derived from the phone number)\n// }\n// }\n//\n// Returns `{ country, number }`\n//\n// Example use cases:\n//\n// ```js\n// parse('8 (800) 555-35-35', 'RU')\n// parse('8 (800) 555-35-35', 'RU', metadata)\n// parse('8 (800) 555-35-35', { country: { default: 'RU' } })\n// parse('8 (800) 555-35-35', { country: { default: 'RU' } }, metadata)\n// parse('+7 800 555 35 35')\n// parse('+7 800 555 35 35', metadata)\n// ```\n//\n\nexport default function parse(text, options, metadata) {\n // If assigning the `{}` default value is moved to the arguments above,\n // code coverage would decrease for some weird reason.\n options = options || {};\n metadata = new Metadata(metadata); // Validate `defaultCountry`.\n\n if (options.defaultCountry && !metadata.hasCountry(options.defaultCountry)) {\n if (options.v2) {\n throw new ParseError('INVALID_COUNTRY');\n }\n\n throw new Error(\"Unknown country: \".concat(options.defaultCountry));\n } // Parse the phone number.\n\n\n var _parseInput = parseInput(text, options.v2),\n formattedPhoneNumber = _parseInput.number,\n ext = _parseInput.ext; // If the phone number is not viable then return nothing.\n\n\n if (!formattedPhoneNumber) {\n if (options.v2) {\n throw new ParseError('NOT_A_NUMBER');\n }\n\n return {};\n }\n\n var _parsePhoneNumber = parsePhoneNumber(formattedPhoneNumber, options.defaultCountry, options.defaultCallingCode, metadata),\n country = _parsePhoneNumber.country,\n nationalNumber = _parsePhoneNumber.nationalNumber,\n countryCallingCode = _parsePhoneNumber.countryCallingCode,\n carrierCode = _parsePhoneNumber.carrierCode;\n\n if (!metadata.hasSelectedNumberingPlan()) {\n if (options.v2) {\n throw new ParseError('INVALID_COUNTRY');\n }\n\n return {};\n } // Validate national (significant) number length.\n\n\n if (!nationalNumber || nationalNumber.length < MIN_LENGTH_FOR_NSN) {\n // Won't throw here because the regexp already demands length > 1.\n\n /* istanbul ignore if */\n if (options.v2) {\n throw new ParseError('TOO_SHORT');\n } // Google's demo just throws an error in this case.\n\n\n return {};\n } // Validate national (significant) number length.\n //\n // A sidenote:\n //\n // They say that sometimes national (significant) numbers\n // can be longer than `MAX_LENGTH_FOR_NSN` (e.g. in Germany).\n // https://github.com/googlei18n/libphonenumber/blob/7e1748645552da39c4e1ba731e47969d97bdb539/resources/phonenumber.proto#L36\n // Such numbers will just be discarded.\n //\n\n\n if (nationalNumber.length > MAX_LENGTH_FOR_NSN) {\n if (options.v2) {\n throw new ParseError('TOO_LONG');\n } // Google's demo just throws an error in this case.\n\n\n return {};\n }\n\n if (options.v2) {\n var phoneNumber = new PhoneNumber(countryCallingCode, nationalNumber, metadata.metadata);\n\n if (country) {\n phoneNumber.country = country;\n }\n\n if (carrierCode) {\n phoneNumber.carrierCode = carrierCode;\n }\n\n if (ext) {\n phoneNumber.ext = ext;\n }\n\n return phoneNumber;\n } // Check if national phone number pattern matches the number.\n // National number pattern is different for each country,\n // even for those ones which are part of the \"NANPA\" group.\n\n\n var valid = (options.extended ? metadata.hasSelectedNumberingPlan() : country) ? matchesEntirely(nationalNumber, metadata.nationalNumberPattern()) : false;\n\n if (!options.extended) {\n return valid ? result(country, nationalNumber, ext) : {};\n }\n\n return {\n country: country,\n countryCallingCode: countryCallingCode,\n carrierCode: carrierCode,\n valid: valid,\n possible: valid ? true : options.extended === true && metadata.possibleLengths() && isPossibleNumber(nationalNumber, countryCallingCode !== undefined, metadata) ? true : false,\n phone: nationalNumber,\n ext: ext\n };\n}\n/**\r\n * Extracts a formatted phone number from text.\r\n * Doesn't guarantee that the extracted phone number\r\n * is a valid phone number (for example, doesn't validate its length).\r\n * @param {string} text\r\n * @param {boolean} throwOnError — By default, it won't throw if the text is too long.\r\n * @return {string}\r\n * @example\r\n * // Returns \"(213) 373-4253\".\r\n * extractFormattedPhoneNumber(\"Call (213) 373-4253 for assistance.\")\r\n */\n\nexport function extractFormattedPhoneNumber(text, throwOnError) {\n if (!text) {\n return;\n }\n\n if (text.length > MAX_INPUT_STRING_LENGTH) {\n if (throwOnError) {\n throw new ParseError('TOO_LONG');\n }\n\n return;\n } // Attempt to extract a possible number from the string passed in\n\n\n var startsAt = text.search(PHONE_NUMBER_START_PATTERN);\n\n if (startsAt < 0) {\n return;\n }\n\n return text // Trim everything to the left of the phone number\n .slice(startsAt) // Remove trailing non-numerical characters\n .replace(AFTER_PHONE_NUMBER_END_PATTERN, '');\n}\n/**\r\n * Strips any national prefix (such as 0, 1) present in a\r\n * (possibly incomplete) number provided.\r\n * \"Carrier codes\" are only used in Colombia and Brazil,\r\n * and only when dialing within those countries from a mobile phone to a fixed line number.\r\n * Sometimes it won't actually strip national prefix\r\n * and will instead prepend some digits to the `number`:\r\n * for example, when number `2345678` is passed with `VI` country selected,\r\n * it will return `{ number: \"3402345678\" }`, because `340` area code is prepended.\r\n * @param {string} number — National number digits.\r\n * @param {object} metadata — Metadata with country selected.\r\n * @return {object} `{ nationalNumber: string, carrierCode: string? }`.\r\n */\n\nexport function stripNationalPrefixAndCarrierCode(number, metadata) {\n if (number && metadata.nationalPrefixForParsing()) {\n // See METADATA.md for the description of\n // `national_prefix_for_parsing` and `national_prefix_transform_rule`.\n // Attempt to parse the first digits as a national prefix.\n var prefixPattern = new RegExp('^(?:' + metadata.nationalPrefixForParsing() + ')');\n var prefixMatch = prefixPattern.exec(number);\n\n if (prefixMatch) {\n var nationalNumber;\n var carrierCode; // If a \"capturing group\" didn't match\n // then its element in `prefixMatch[]` array will be `undefined`.\n\n var capturedGroupsCount = prefixMatch.length - 1;\n\n if (metadata.nationalPrefixTransformRule() && capturedGroupsCount > 0 && prefixMatch[capturedGroupsCount]) {\n nationalNumber = number.replace(prefixPattern, metadata.nationalPrefixTransformRule()); // Carrier code is the last captured group,\n // but only when there's more than one captured group.\n\n if (capturedGroupsCount > 1 && prefixMatch[capturedGroupsCount]) {\n carrierCode = prefixMatch[1];\n }\n } // If it's a simple-enough case then just\n // strip the national prefix from the number.\n else {\n // National prefix is the whole substring matched by\n // the `national_prefix_for_parsing` regexp.\n var nationalPrefix = prefixMatch[0];\n nationalNumber = number.slice(nationalPrefix.length); // Carrier code is the last captured group.\n\n if (capturedGroupsCount > 0) {\n carrierCode = prefixMatch[1];\n }\n } // We require that the national (significant) number remaining after\n // stripping the national prefix and carrier code be long enough\n // to be a possible length for the region. Otherwise, we don't do\n // the stripping, since the original number could be a valid number.\n // For example, in some countries (Russia, Belarus) the same digit\n // could be both a national prefix and a leading digit of a valid\n // national phone number, like `8` is the national prefix for Russia\n // and `800 555 35 35` is a valid national (significant) number.\n\n\n if (matchesEntirely(number, metadata.nationalNumberPattern()) && !matchesEntirely(nationalNumber, metadata.nationalNumberPattern())) {// Don't strip national prefix or carrier code.\n } else {\n return {\n nationalNumber: nationalNumber,\n carrierCode: carrierCode\n };\n }\n }\n }\n\n return {\n nationalNumber: number\n };\n}\nexport function findCountryCode(callingCode, nationalPhoneNumber, metadata) {\n /* istanbul ignore if */\n if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\n if (metadata.isNonGeographicCallingCode(callingCode)) {\n return '001';\n }\n } // Is always non-empty, because `callingCode` is always valid\n\n\n var possibleCountries = metadata.getCountryCodesForCallingCode(callingCode);\n\n if (!possibleCountries) {\n return;\n } // If there's just one country corresponding to the country code,\n // then just return it, without further phone number digits validation.\n\n\n if (possibleCountries.length === 1) {\n return possibleCountries[0];\n }\n\n return _findCountryCode(possibleCountries, nationalPhoneNumber, metadata.metadata);\n} // Changes `metadata` `country`.\n\nfunction _findCountryCode(possibleCountries, nationalPhoneNumber, metadata) {\n metadata = new Metadata(metadata);\n\n for (var _iterator = possibleCountries, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref = _i.value;\n }\n\n var country = _ref;\n metadata.country(country); // Leading digits check would be the simplest one\n\n if (metadata.leadingDigits()) {\n if (nationalPhoneNumber && nationalPhoneNumber.search(metadata.leadingDigits()) === 0) {\n return country;\n }\n } // Else perform full validation with all of those\n // fixed-line/mobile/etc regular expressions.\n else if (getNumberType({\n phone: nationalPhoneNumber,\n country: country\n }, undefined, metadata.metadata)) {\n return country;\n }\n }\n}\n/**\r\n * @param {string} text - Input.\r\n * @return {object} `{ ?number, ?ext }`.\r\n */\n\n\nfunction parseInput(text, v2) {\n // Parse RFC 3966 phone number URI.\n if (text && text.indexOf('tel:') === 0) {\n return parseRFC3966(text);\n }\n\n var number = extractFormattedPhoneNumber(text, v2); // If the phone number is not viable, then abort.\n\n if (!number || !isViablePhoneNumber(number)) {\n return {};\n } // Attempt to parse extension first, since it doesn't require region-specific\n // data and we want to have the non-normalised number here.\n\n\n var withExtensionStripped = extractExtension(number);\n\n if (withExtensionStripped.ext) {\n return withExtensionStripped;\n }\n\n return {\n number: number\n };\n}\n/**\r\n * Creates `parse()` result object.\r\n */\n\n\nfunction result(country, nationalNumber, ext) {\n var result = {\n country: country,\n phone: nationalNumber\n };\n\n if (ext) {\n result.ext = ext;\n }\n\n return result;\n}\n/**\r\n * Parses a viable phone number.\r\n * @param {string} formattedPhoneNumber — Example: \"(213) 373-4253\".\r\n * @param {string} [defaultCountry]\r\n * @param {string} [defaultCallingCode]\r\n * @param {Metadata} metadata\r\n * @return {object} Returns `{ country: string?, countryCallingCode: string?, nationalNumber: string? }`.\r\n */\n\n\nfunction parsePhoneNumber(formattedPhoneNumber, defaultCountry, defaultCallingCode, metadata) {\n // Extract calling code from phone number.\n var _extractCountryCallin = extractCountryCallingCode(parseIncompletePhoneNumber(formattedPhoneNumber), defaultCountry, defaultCallingCode, metadata.metadata),\n countryCallingCode = _extractCountryCallin.countryCallingCode,\n number = _extractCountryCallin.number; // Choose a country by `countryCallingCode`.\n\n\n var country;\n\n if (countryCallingCode) {\n metadata.chooseCountryByCountryCallingCode(countryCallingCode);\n } // If `formattedPhoneNumber` is in \"national\" format\n // then `number` is defined and `countryCallingCode` isn't.\n else if (number && (defaultCountry || defaultCallingCode)) {\n metadata.selectNumberingPlan(defaultCountry, defaultCallingCode);\n\n if (defaultCountry) {\n country = defaultCountry;\n } else {\n /* istanbul ignore if */\n if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\n if (metadata.isNonGeographicCallingCode(defaultCallingCode)) {\n country = '001';\n }\n }\n }\n\n countryCallingCode = defaultCallingCode || getCountryCallingCode(defaultCountry, metadata.metadata);\n } else return {};\n\n if (!number) {\n return {\n countryCallingCode: countryCallingCode\n };\n }\n\n var _stripNationalPrefixA = stripNationalPrefixAndCarrierCodeFromCompleteNumber(parseIncompletePhoneNumber(number), metadata),\n nationalNumber = _stripNationalPrefixA.nationalNumber,\n carrierCode = _stripNationalPrefixA.carrierCode; // Sometimes there are several countries\n // corresponding to the same country phone code\n // (e.g. NANPA countries all having `1` country phone code).\n // Therefore, to reliably determine the exact country,\n // national (significant) number should have been parsed first.\n //\n // When `metadata.json` is generated, all \"ambiguous\" country phone codes\n // get their countries populated with the full set of\n // \"phone number type\" regular expressions.\n //\n\n\n var exactCountry = findCountryCode(countryCallingCode, nationalNumber, metadata);\n\n if (exactCountry) {\n country = exactCountry;\n /* istanbul ignore if */\n\n if (exactCountry === '001') {// Can't happen with `USE_NON_GEOGRAPHIC_COUNTRY_CODE` being `false`.\n // If `USE_NON_GEOGRAPHIC_COUNTRY_CODE` is set to `true` for some reason,\n // then remove the \"istanbul ignore if\".\n } else {\n metadata.country(country);\n }\n }\n\n return {\n country: country,\n countryCallingCode: countryCallingCode,\n nationalNumber: nationalNumber,\n carrierCode: carrierCode\n };\n}\n/**\r\n * Strips national prefix and carrier code from a complete phone number.\r\n * The difference from the non-\"FromCompleteNumber\" function is that\r\n * it won't extract national prefix if the resultant number is too short\r\n * to be a complete number for the selected phone numbering plan.\r\n * @param {string} number — Complete phone number digits.\r\n * @param {Metadata} metadata — Metadata with a phone numbering plan selected.\r\n * @return {object} `{ nationalNumber: string, carrierCode: string? }`.\r\n */\n\n\nexport function stripNationalPrefixAndCarrierCodeFromCompleteNumber(number, metadata) {\n // Parsing national prefixes and carrier codes\n // is only required for local phone numbers\n // but some people don't understand that\n // and sometimes write international phone numbers\n // with national prefixes (or maybe even carrier codes).\n // http://ucken.blogspot.ru/2016/03/trunk-prefixes-in-skype4b.html\n // Google's original library forgives such mistakes\n // and so does this library, because it has been requested:\n // https://github.com/catamphetamine/libphonenumber-js/issues/127\n var _stripNationalPrefixA2 = stripNationalPrefixAndCarrierCode(parseIncompletePhoneNumber(number), metadata),\n nationalNumber = _stripNationalPrefixA2.nationalNumber,\n carrierCode = _stripNationalPrefixA2.carrierCode; // If a national prefix has been extracted, check to see\n // if the resultant number isn't too short.\n\n\n if (nationalNumber.length !== number.length + (carrierCode ? carrierCode.length : 0)) {\n // If not using legacy generated metadata (before version `1.0.18`)\n // then it has \"possible lengths\", so use those to validate the number length.\n if (metadata.possibleLengths()) {\n // \"We require that the NSN remaining after stripping the national prefix and\n // carrier code be long enough to be a possible length for the region.\n // Otherwise, we don't do the stripping, since the original number could be\n // a valid short number.\"\n // https://github.com/google/libphonenumber/blob/876268eb1ad6cdc1b7b5bef17fc5e43052702d57/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L3236-L3250\n switch (checkNumberLengthForType(nationalNumber, undefined, metadata)) {\n case 'TOO_SHORT':\n case 'INVALID_LENGTH':\n // case 'IS_POSSIBLE_LOCAL_ONLY':\n // Don't strip the national prefix.\n return {\n nationalNumber: number\n };\n }\n }\n }\n\n return {\n nationalNumber: nationalNumber,\n carrierCode: carrierCode\n };\n}\n/**\r\n * Converts a phone number digits (possibly with a `+`)\r\n * into a calling code and the rest phone number digits.\r\n * The \"rest phone number digits\" could include\r\n * a national prefix, carrier code, and national\r\n * (significant) number.\r\n * @param {string} number — Phone number digits (possibly with a `+`).\r\n * @param {string} [country] — Default country.\r\n * @param {string} [callingCode] — Default calling code (some phone numbering plans are non-geographic).\r\n * @param {object} metadata\r\n * @return {object} `{ countryCallingCode: string?, number: string }`\r\n * @example\r\n * // Returns `{ countryCallingCode: \"1\", number: \"2133734253\" }`.\r\n * extractCountryCallingCode('2133734253', 'US', null, metadata)\r\n * extractCountryCallingCode('2133734253', null, '1', metadata)\r\n * extractCountryCallingCode('+12133734253', null, null, metadata)\r\n * extractCountryCallingCode('+12133734253', 'RU', null, metadata)\r\n */\n\nexport function extractCountryCallingCode(number, country, callingCode, metadata) {\n if (!number) {\n return {};\n } // If this is not an international phone number,\n // then either extract an \"IDD\" prefix, or extract a\n // country calling code from a number by autocorrecting it\n // by prepending a leading `+` in cases when it starts\n // with the country calling code.\n // https://wikitravel.org/en/International_dialling_prefix\n // https://github.com/catamphetamine/libphonenumber-js/issues/376\n\n\n if (number[0] !== '+') {\n // Convert an \"out-of-country\" dialing phone number\n // to a proper international phone number.\n var numberWithoutIDD = stripIDDPrefix(number, country, callingCode, metadata); // If an IDD prefix was stripped then\n // convert the number to international one\n // for subsequent parsing.\n\n if (numberWithoutIDD && numberWithoutIDD !== number) {\n number = '+' + numberWithoutIDD;\n } else {\n // Check to see if the number starts with the country calling code\n // for the default country. If so, we remove the country calling code,\n // and do some checks on the validity of the number before and after.\n // https://github.com/catamphetamine/libphonenumber-js/issues/376\n if (country || callingCode) {\n var _extractCountryCallin2 = extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, callingCode, metadata),\n countryCallingCode = _extractCountryCallin2.countryCallingCode,\n shorterNumber = _extractCountryCallin2.number;\n\n if (countryCallingCode) {\n return {\n countryCallingCode: countryCallingCode,\n number: shorterNumber\n };\n }\n }\n\n return {\n number: number\n };\n }\n } // Fast abortion: country codes do not begin with a '0'\n\n\n if (number[1] === '0') {\n return {};\n }\n\n metadata = new Metadata(metadata); // The thing with country phone codes\n // is that they are orthogonal to each other\n // i.e. there's no such country phone code A\n // for which country phone code B exists\n // where B starts with A.\n // Therefore, while scanning digits,\n // if a valid country code is found,\n // that means that it is the country code.\n //\n\n var i = 2;\n\n while (i - 1 <= MAX_LENGTH_COUNTRY_CODE && i <= number.length) {\n var _countryCallingCode = number.slice(1, i);\n\n if (metadata.hasCallingCode(_countryCallingCode)) {\n metadata.selectNumberingPlan(undefined, _countryCallingCode);\n return {\n countryCallingCode: _countryCallingCode,\n number: number.slice(i)\n };\n }\n\n i++;\n }\n\n return {};\n}\n/**\r\n * Sometimes some people incorrectly input international phone numbers\r\n * without the leading `+`. This function corrects such input.\r\n * @param {string} number — Phone number digits.\r\n * @param {string?} country\r\n * @param {string?} callingCode\r\n * @param {object} metadata\r\n * @return {object} `{ countryCallingCode: string?, number: string }`.\r\n */\n\nexport function extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, callingCode, metadata) {\n var countryCallingCode = country ? getCountryCallingCode(country, metadata) : callingCode;\n\n if (number.indexOf(countryCallingCode) === 0) {\n metadata = new Metadata(metadata);\n metadata.selectNumberingPlan(country, callingCode);\n var possibleShorterNumber = number.slice(countryCallingCode.length);\n\n var _stripNationalPrefixA3 = stripNationalPrefixAndCarrierCode(possibleShorterNumber, metadata),\n possibleShorterNationalNumber = _stripNationalPrefixA3.nationalNumber;\n\n var _stripNationalPrefixA4 = stripNationalPrefixAndCarrierCode(number, metadata),\n nationalNumber = _stripNationalPrefixA4.nationalNumber; // If the number was not valid before but is valid now,\n // or if it was too long before, we consider the number\n // with the country calling code stripped to be a better result\n // and keep that instead.\n // For example, in Germany (+49), `49` is a valid area code,\n // so if a number starts with `49`, it could be both a valid\n // national German number or an international number without\n // a leading `+`.\n\n\n if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern()) && matchesEntirely(possibleShorterNationalNumber, metadata.nationalNumberPattern()) || checkNumberLengthForType(nationalNumber, undefined, metadata) === 'TOO_LONG') {\n return {\n countryCallingCode: countryCallingCode,\n number: possibleShorterNumber\n };\n }\n }\n\n return {\n number: number\n };\n}\n//# sourceMappingURL=parse_.js.map","function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport parseNumber from './parse_';\nexport default function parsePhoneNumber(text, options, metadata) {\n return parseNumber(text, _objectSpread({}, options, {\n v2: true\n }), metadata);\n}\n//# sourceMappingURL=parsePhoneNumber_.js.map","function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nimport parsePhoneNumber_ from './parsePhoneNumber_';\nexport default function parsePhoneNumber() {\n var _normalizeArguments = normalizeArguments(arguments),\n text = _normalizeArguments.text,\n options = _normalizeArguments.options,\n metadata = _normalizeArguments.metadata;\n\n return parsePhoneNumber_(text, options, metadata);\n}\nexport function normalizeArguments(args) {\n var _Array$prototype$slic = Array.prototype.slice.call(args),\n _Array$prototype$slic2 = _slicedToArray(_Array$prototype$slic, 4),\n arg_1 = _Array$prototype$slic2[0],\n arg_2 = _Array$prototype$slic2[1],\n arg_3 = _Array$prototype$slic2[2],\n arg_4 = _Array$prototype$slic2[3];\n\n var text;\n var options;\n var metadata; // If the phone number is passed as a string.\n // `parsePhoneNumber('88005553535', ...)`.\n\n if (typeof arg_1 === 'string') {\n text = arg_1;\n } else throw new TypeError('A text for parsing must be a string.'); // If \"default country\" argument is being passed then move it to `options`.\n // `parsePhoneNumber('88005553535', 'RU', [options], metadata)`.\n\n\n if (!arg_2 || typeof arg_2 === 'string') {\n if (arg_4) {\n options = arg_3;\n metadata = arg_4;\n } else {\n options = undefined;\n metadata = arg_3;\n }\n\n if (arg_2) {\n options = _objectSpread({\n defaultCountry: arg_2\n }, options);\n }\n } // `defaultCountry` is not passed.\n // Example: `parsePhoneNumber('+78005553535', [options], metadata)`.\n else if (isObject(arg_2)) {\n if (arg_3) {\n options = arg_2;\n metadata = arg_3;\n } else {\n metadata = arg_2;\n }\n } else throw new Error(\"Invalid second argument: \".concat(arg_2));\n\n return {\n text: text,\n options: options,\n metadata: metadata\n };\n} // Otherwise istanbul would show this as \"branch not covered\".\n\n/* istanbul ignore next */\n\nvar isObject = function isObject(_) {\n return _typeof(_) === 'object';\n};\n//# sourceMappingURL=parsePhoneNumber.js.map","function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport parsePhoneNumber from './parsePhoneNumber_';\nimport ParseError from './ParseError';\nimport { isSupportedCountry } from './metadata';\nexport default function parsePhoneNumberFromString(text, options, metadata) {\n // Validate `defaultCountry`.\n if (options && options.defaultCountry && !isSupportedCountry(options.defaultCountry, metadata)) {\n options = _objectSpread({}, options, {\n defaultCountry: undefined\n });\n } // Parse phone number.\n\n\n try {\n return parsePhoneNumber(text, options, metadata);\n } catch (error) {\n /* istanbul ignore else */\n if (error instanceof ParseError) {//\n } else {\n throw error;\n }\n }\n}\n//# sourceMappingURL=parsePhoneNumberFromString_.js.map","import { normalizeArguments } from './parsePhoneNumber';\nimport parsePhoneNumberFromString_ from './parsePhoneNumberFromString_';\nexport default function parsePhoneNumberFromString() {\n var _normalizeArguments = normalizeArguments(arguments),\n text = _normalizeArguments.text,\n options = _normalizeArguments.options,\n metadata = _normalizeArguments.metadata;\n\n return parsePhoneNumberFromString_(text, options, metadata);\n}\n//# sourceMappingURL=parsePhoneNumberFromString.js.map","function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n// This is an enhanced port of Google Android `libphonenumber`'s\n// `asyoutypeformatter.js` of December 31th, 2018.\n//\n// https://github.com/googlei18n/libphonenumber/blob/8d21a365061de2ba0675c878a710a7b24f74d2ae/javascript/i18n/phonenumbers/asyoutypeformatter.js\n//\n// Simplified: does not differentiate between \"local-only\" numbers\n// and \"internationally dialable\" numbers.\n// For example, doesn't include changes like this:\n// https://github.com/googlei18n/libphonenumber/commit/865da605da12b01053c4f053310bac7c5fbb7935\nimport Metadata from './metadata';\nimport PhoneNumber from './PhoneNumber';\nimport { VALID_DIGITS, VALID_PUNCTUATION, PLUS_CHARS } from './constants';\nimport { matchesEntirely } from './util';\nimport { extractCountryCallingCode as _extractCountryCallingCode, findCountryCode, stripNationalPrefixAndCarrierCode, stripNationalPrefixAndCarrierCodeFromCompleteNumber, extractCountryCallingCodeFromInternationalNumberWithoutPlusSign } from './parse_';\nimport { FIRST_GROUP_PATTERN, formatNationalNumberUsingFormat, applyInternationalSeparatorStyle } from './format_';\nimport { stripIDDPrefix } from './IDD';\nimport { checkNumberLengthForType } from './getNumberType_';\nimport parseDigits from './parseDigits'; // Used in phone number format template creation.\n// Could be any digit, I guess.\n\nvar DUMMY_DIGIT = '9'; // I don't know why is it exactly `15`\n\nvar LONGEST_NATIONAL_PHONE_NUMBER_LENGTH = 15; // Create a phone number consisting only of the digit 9 that matches the\n// `number_pattern` by applying the pattern to the \"longest phone number\" string.\n\nvar LONGEST_DUMMY_PHONE_NUMBER = repeat(DUMMY_DIGIT, LONGEST_NATIONAL_PHONE_NUMBER_LENGTH); // The digits that have not been entered yet will be represented by a \\u2008,\n// the punctuation space.\n\nexport var DIGIT_PLACEHOLDER = 'x'; // '\\u2008' (punctuation space)\n\nvar DIGIT_PLACEHOLDER_MATCHER = new RegExp(DIGIT_PLACEHOLDER); // A set of characters that, if found in a national prefix formatting rules, are an indicator to\n// us that we should separate the national prefix from the number when formatting.\n\nvar NATIONAL_PREFIX_SEPARATORS_PATTERN = /[- ]/; // Deprecated: Google has removed some formatting pattern related code from their repo.\n// https://github.com/googlei18n/libphonenumber/commit/a395b4fef3caf57c4bc5f082e1152a4d2bd0ba4c\n// \"We no longer have numbers in formatting matching patterns, only \\d.\"\n// Because this library supports generating custom metadata\n// some users may still be using old metadata so the relevant\n// code seems to stay until some next major version update.\n\nvar SUPPORT_LEGACY_FORMATTING_PATTERNS = true; // A pattern that is used to match character classes in regular expressions.\n// An example of a character class is \"[1-4]\".\n\nvar CREATE_CHARACTER_CLASS_PATTERN = SUPPORT_LEGACY_FORMATTING_PATTERNS && function () {\n return /\\[([^\\[\\]])*\\]/g;\n}; // Any digit in a regular expression that actually denotes a digit. For\n// example, in the regular expression \"80[0-2]\\d{6,10}\", the first 2 digits\n// (8 and 0) are standalone digits, but the rest are not.\n// Two look-aheads are needed because the number following \\\\d could be a\n// two-digit number, since the phone number can be as long as 15 digits.\n\n\nvar CREATE_STANDALONE_DIGIT_PATTERN = SUPPORT_LEGACY_FORMATTING_PATTERNS && function () {\n return /\\d(?=[^,}][^,}])/g;\n}; // A pattern that is used to determine if a `format` is eligible\n// to be used by the \"as you type formatter\".\n// It is eligible when the `format` contains groups of the dollar sign\n// followed by a single digit, separated by valid phone number punctuation.\n// This prevents invalid punctuation (such as the star sign in Israeli star numbers)\n// getting into the output of the \"as you type formatter\".\n\n\nvar ELIGIBLE_FORMAT_PATTERN = new RegExp('^' + '[' + VALID_PUNCTUATION + ']*' + '(\\\\$\\\\d[' + VALID_PUNCTUATION + ']*)+' + '$'); // This is the minimum length of the leading digits of a phone number\n// to guarantee the first \"leading digits pattern\" for a phone number format\n// to be preemptive.\n\nvar MIN_LEADING_DIGITS_LENGTH = 3;\nvar VALID_FORMATTED_PHONE_NUMBER_PART = '[' + VALID_PUNCTUATION + VALID_DIGITS + ']+';\nvar VALID_FORMATTED_PHONE_NUMBER_PART_PATTERN = new RegExp('^' + VALID_FORMATTED_PHONE_NUMBER_PART + '$', 'i');\nvar VALID_PHONE_NUMBER = '(?:' + '[' + PLUS_CHARS + ']' + '[' + VALID_PUNCTUATION + VALID_DIGITS + ']*' + '|' + '[' + VALID_PUNCTUATION + VALID_DIGITS + ']+' + ')';\nvar AFTER_PHONE_NUMBER_DIGITS_END_PATTERN = new RegExp('[^' + VALID_PUNCTUATION + VALID_DIGITS + ']+' + '.*' + '$');\nvar USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;\n\nvar AsYouType =\n/*#__PURE__*/\nfunction () {\n // Not setting `options` to a constructor argument\n // not to break backwards compatibility\n // for older versions of the library.\n\n /**\r\n * @param {(string|object)?} [optionsOrDefaultCountry] - The default country used for parsing non-international phone numbers. Can also be an `options` object.\r\n * @param {Object} metadata\r\n */\n function AsYouType(optionsOrDefaultCountry, metadata) {\n _classCallCheck(this, AsYouType);\n\n _defineProperty(this, \"options\", {});\n\n this.metadata = new Metadata(metadata); // Set `defaultCountry` and `defaultCallingCode` options.\n\n var defaultCountry;\n var defaultCallingCode; // Turns out `null` also has type \"object\". Weird.\n\n if (optionsOrDefaultCountry) {\n if (_typeof(optionsOrDefaultCountry) === 'object') {\n defaultCountry = optionsOrDefaultCountry.defaultCountry;\n defaultCallingCode = optionsOrDefaultCountry.defaultCallingCode;\n } else {\n defaultCountry = optionsOrDefaultCountry;\n }\n }\n\n if (defaultCountry && this.metadata.hasCountry(defaultCountry)) {\n this.defaultCountry = defaultCountry;\n }\n\n if (defaultCallingCode) {\n /* istanbul ignore if */\n if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\n if (this.metadata.isNonGeographicCallingCode(defaultCallingCode)) {\n this.defaultCountry = '001';\n }\n }\n\n this.defaultCallingCode = defaultCallingCode;\n } // Reset.\n\n\n this.reset();\n }\n\n _createClass(AsYouType, [{\n key: \"reset\",\n value: function reset() {\n this.formattedOutput = '';\n this.international = false;\n this.internationalPrefix = undefined;\n this.countryCallingCode = undefined;\n this.digits = '';\n this.nationalNumberDigits = '';\n this.nationalPrefix = '';\n this.carrierCode = '';\n this.setCountry(this.defaultCountry, this.defaultCallingCode);\n return this;\n }\n }, {\n key: \"resetFormat\",\n value: function resetFormat() {\n this.chosenFormat = undefined;\n this.template = undefined;\n this.populatedNationalNumberTemplate = undefined;\n this.populatedNationalNumberTemplatePosition = -1;\n }\n /**\r\n * Returns `true` if the phone number is being input in international format.\r\n * In other words, returns `true` if and only if the parsed phone number starts with a `\"+\"`.\r\n * @return {boolean}\r\n */\n\n }, {\n key: \"isInternational\",\n value: function isInternational() {\n return this.international;\n }\n /**\r\n * Returns the \"country calling code\" part of the phone number.\r\n * Returns `undefined` if the number is not being input in international format.\r\n * Returns \"country calling code\" for \"non-geographic\" phone numbering plans too.\r\n * @return {string} [countryCallingCode]\r\n */\n\n }, {\n key: \"getCountryCallingCode\",\n value: function getCountryCallingCode() {\n return this.countryCallingCode;\n }\n /**\r\n * Returns a two-letter country code of the phone number.\r\n * Returns `undefined` for \"non-geographic\" phone numbering plans.\r\n * Returns `undefined` if no phone number has been input yet.\r\n * @return {string} [country]\r\n */\n\n }, {\n key: \"getCountry\",\n value: function getCountry() {\n // If no digits have been input yet,\n // then `this.country` is the `defaultCountry`.\n // Won't return the `defaultCountry` in such case.\n if (!this.digits) {\n return;\n }\n\n var countryCode = this.country;\n /* istanbul ignore if */\n\n if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\n if (this.country === '001') {\n countryCode = undefined;\n }\n }\n\n return countryCode;\n }\n }, {\n key: \"setCountry\",\n value: function setCountry(country, callingCode) {\n this.country = country;\n this.metadata.selectNumberingPlan(country, callingCode);\n\n if (this.metadata.hasSelectedNumberingPlan()) {\n this.initializePhoneNumberFormatsForCountry();\n } else {\n this.matchingFormats = [];\n }\n\n this.resetFormat();\n }\n /**\r\n * Inputs \"next\" phone number characters.\r\n * @param {string} text\r\n * @return {string} Formatted phone number characters that have been input so far.\r\n */\n\n }, {\n key: \"input\",\n value: function input(text) {\n var formattedDigits = this.extractFormattedDigits(text); // If the extracted phone number part\n // can possibly be a part of some valid phone number\n // then parse phone number characters from a formatted phone number.\n\n if (VALID_FORMATTED_PHONE_NUMBER_PART_PATTERN.test(formattedDigits)) {\n this.formattedOutput = this.getFullNumber(this.inputDigits(parseDigits(formattedDigits)) || this.getNonFormattedNationalNumber());\n }\n\n return this.formattedOutput;\n }\n /**\r\n * Extracts formatted phone number digits from text (if there're any).\r\n * @param {string} text\r\n * @return {string}\r\n */\n\n }, {\n key: \"extractFormattedDigits\",\n value: function extractFormattedDigits(text) {\n // Extract a formatted phone number part from text.\n var extractedNumber = extractFormattedPhoneNumber(text) || ''; // Trim a `+`.\n\n if (extractedNumber[0] === '+') {\n // Trim the `+`.\n extractedNumber = extractedNumber.slice('+'.length);\n\n if (this.digits) {// If an out of position `+` is detected\n // (or a second `+`) then just ignore it.\n } else {\n this.formattedOutput = '+';\n this.startInternationalNumber();\n }\n }\n\n return extractedNumber;\n }\n }, {\n key: \"startInternationalNumber\",\n value: function startInternationalNumber() {\n // Prepend the `+` to parsed input.\n this.international = true; // If a default country was set then reset it\n // because an explicitly international phone\n // number is being entered.\n\n this.setCountry();\n }\n /**\r\n * Inputs \"next\" phone number digits.\r\n * @param {string} digits\r\n * @return {string} [formattedNumber] Formatted national phone number (if it can be formatted at this stage). Returning `undefined` means \"don't format the national phone number at this stage\".\r\n */\n\n }, {\n key: \"inputDigits\",\n value: function inputDigits(nextDigits) {\n // Some users input their phone number in \"out-of-country\"\n // dialing format instead of using the leading `+`.\n // https://github.com/catamphetamine/libphonenumber-js/issues/185\n // Detect such numbers.\n if (!this.digits) {\n var numberWithoutIDD = stripIDDPrefix(nextDigits, this.defaultCountry, this.defaultCallingCode, this.metadata.metadata);\n\n if (numberWithoutIDD && numberWithoutIDD !== nextDigits) {\n // If an IDD prefix was stripped then\n // convert the number to international one\n // for subsequent parsing.\n this.internationalPrefix = nextDigits.slice(0, nextDigits.length - numberWithoutIDD.length);\n nextDigits = numberWithoutIDD;\n this.startInternationalNumber();\n }\n } // Append phone number digits.\n\n\n this.digits += nextDigits; // Try to format the parsed input\n\n if (this.isInternational()) {\n if (this.countryCallingCode) {\n this.nationalNumberDigits += nextDigits; // `this.country` could be `undefined`, for example, when there is\n // ambiguity in a form of several different countries,\n // each corresponding to the same country phone code\n // (e.g. NANPA: USA, Canada, etc), and there's not enough digits\n // to reliably determine the country the phone number belongs to.\n // Therefore, in cases of such ambiguity, each time something is input,\n // try to determine the country (if it hasn't been determined yet).\n\n if (!this.country || this.isCountryCallingCodeAmbiguous()) {\n this.determineTheCountry();\n }\n } else {\n // Extract country calling code from the digits entered so far.\n // There must be some digits in order to extract anything from them.\n //\n // If one looks at country phone codes\n // then they can notice that no one country phone code\n // is ever a (leftmost) substring of another country phone code.\n // So if a valid country code is extracted so far\n // then it means that this is the country code.\n //\n // If no country phone code could be extracted so far,\n // then don't format the phone number.\n //\n if (!this.extractCountryCallingCode()) {\n // Don't format the phone number.\n return;\n } // Possibly extract a national prefix.\n // Some people incorrectly input national prefix\n // in an international phone number.\n // For example, some people write British phone numbers as `+44(0)...`.\n // Also, mobile phone numbers in Mexico are supposed to be dialled\n // internationally using a `15` national prefix.\n //\n // https://www.mexperience.com/dialing-cell-phones-in-mexico/\n //\n // \"Dialing a Mexican cell phone from abroad\n // When you are calling a cell phone number in Mexico from outside Mexico,\n // it’s necessary to dial an additional “1” after Mexico’s country code\n // (which is “52”) and before the area code.\n // You also ignore the 045, and simply dial the area code and the\n // cell phone’s number.\n //\n // If you don’t add the “1”, you’ll receive a recorded announcement\n // asking you to redial using it.\n //\n // For example, if you are calling from the USA to a cell phone\n // in Mexico City, you would dial +52 – 1 – 55 – 1234 5678.\n // (Note that this is different to calling a land line in Mexico City\n // from abroad, where the number dialed would be +52 – 55 – 1234 5678)\".\n //\n\n\n this.nationalNumberDigits = this.digits.slice(this.countryCallingCode.length); // this.extractNationalPrefix()\n //\n // Determine the country from country calling code and national number.\n\n this.determineTheCountry();\n }\n } else {\n this.nationalNumberDigits += nextDigits; // If `defaultCallingCode` is set,\n // see if the `country` could be derived.\n\n if (!this.country) {\n this.determineTheCountry();\n } // Some national prefixes are substrings of other national prefixes\n // (for the same country), therefore try to extract national prefix each time\n // because a longer national prefix might be available at some point in time.\n\n\n var previousNationalPrefix = this.nationalPrefix;\n this.nationalNumberDigits = this.nationalPrefix + this.nationalNumberDigits; // Re-extract national prefix.\n\n this.extractNationalPrefix(); // If another national prefix has been extracted.\n\n if (this.nationalPrefix !== previousNationalPrefix) {\n // National number has changed\n // (due to another national prefix been extracted)\n // therefore national number has changed\n // therefore reset all previous formatting data.\n // (and leading digits matching state)\n this.initializePhoneNumberFormatsForCountry();\n this.resetFormat();\n }\n }\n\n if (this.nationalNumberDigits) {\n // Match the available formats by the currently available leading digits.\n this.matchFormats(this.nationalNumberDigits);\n } // Format the phone number (given the next digits)\n\n\n return this.formatNationalNumberWithNextDigits(nextDigits);\n }\n }, {\n key: \"formatNationalNumberWithNextDigits\",\n value: function formatNationalNumberWithNextDigits(nextDigits) {\n // See if the phone number digits can be formatted as a complete phone number.\n // If not, use the results from `formatNextNationalNumberDigits()`,\n // which formats based on the chosen formatting pattern.\n // Attempting to format complete phone number first is how it's done\n // in Google's `libphonenumber`.\n var formattedNumber = this.attemptToFormatCompletePhoneNumber(); // Just because a phone number doesn't have a suitable format\n // that doesn't mean that the phone number is invalid,\n // because phone number formats only format phone numbers,\n // they don't validate them and some (rare) phone numbers\n // are meant to stay non-formatted.\n\n if (formattedNumber) {\n return formattedNumber;\n } // Format the next phone number digits\n // using the previously chosen phone number format.\n //\n // This is done here because if `attemptToFormatCompletePhoneNumber`\n // was placed before this call then the `template`\n // wouldn't reflect the situation correctly (and would therefore be inconsistent)\n //\n\n\n var previouslyChosenFormat = this.chosenFormat; // Choose a format from the list of matching ones.\n\n var newlyChosenFormat = this.chooseFormat();\n\n if (newlyChosenFormat) {\n if (newlyChosenFormat === previouslyChosenFormat) {\n // If could format the next (current) digit\n // using the previously chosen phone number format\n // then return the formatted number so far.\n //\n // If no new phone number format could be chosen,\n // and couldn't format the supplied national number\n // using the previously chosen phone number pattern,\n // then return `undefined`.\n //\n return this.formatNextNationalNumberDigits(nextDigits);\n } else {\n // If a more appropriate phone number format\n // has been chosen for these \"leading digits\",\n // then format the national phone number (so far)\n // using the newly selected format.\n //\n // Will return `undefined` if it couldn't format\n // the supplied national number\n // using the selected phone number pattern.\n //\n return this.reformatNationalNumber();\n }\n }\n }\n }, {\n key: \"chooseFormat\",\n value: function chooseFormat() {\n // When there are multiple available formats, the formatter uses the first\n // format where a formatting template could be created.\n for (var _iterator = this.matchingFormats, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref = _i.value;\n }\n\n var format = _ref;\n\n // If this format is currently being used\n // and is still possible, then stick to it.\n if (this.chosenFormat === format) {\n break;\n }\n\n if (!this.createFormattingTemplate(format)) {\n continue;\n }\n\n this.chosenFormat = format; // With a new formatting template, the matched position\n // using the old template needs to be reset.\n\n this.populatedNationalNumberTemplatePosition = -1;\n break;\n }\n\n if (!this.chosenFormat) {\n // No format matches the national phone number entered.\n this.resetFormat();\n }\n\n return this.chosenFormat;\n } // Formats each digit of the national phone number (so far)\n // using the selected format.\n\n }, {\n key: \"reformatNationalNumber\",\n value: function reformatNationalNumber() {\n return this.formatNextNationalNumberDigits(this.nationalPrefix + this.nationalNumberDigits);\n }\n }, {\n key: \"initializePhoneNumberFormatsForCountry\",\n value: function initializePhoneNumberFormatsForCountry() {\n // Get all \"eligible\" phone number formats for this country\n this.matchingFormats = this.metadata.formats().filter(function (format) {\n // Compared to `libphonenumber`'s code, the two \"Discard a few formats\n // that we know are not relevant based on the presence of the national prefix\"\n // checks have changed: the first one has been moved to `.matchFormats()`,\n // and the second one doesn't apply to this library because it doesn't deal with\n // \"incomplete\" phone numbers (for example, phone numbers, entered without \"area code\").\n return ELIGIBLE_FORMAT_PATTERN.test(format.internationalFormat());\n });\n }\n }, {\n key: \"matchFormats\",\n value: function matchFormats(leadingDigits) {\n var _this = this;\n\n // \"leading digits\" pattern list starts with a\n // \"leading digits\" pattern fitting a maximum of 3 leading digits.\n // So, after a user inputs 3 digits of a national (significant) phone number\n // this national (significant) number can already be formatted.\n // The next \"leading digits\" pattern is for 4 leading digits max,\n // and the \"leading digits\" pattern after it is for 5 leading digits max, etc.\n // This implementation is different from Google's\n // in that it searches for a fitting format\n // even if the user has entered less than\n // `MIN_LEADING_DIGITS_LENGTH` digits of a national number.\n // Because some leading digit patterns already match for a single first digit.\n var leadingDigitsPatternIndex = leadingDigits.length - MIN_LEADING_DIGITS_LENGTH;\n\n if (leadingDigitsPatternIndex < 0) {\n leadingDigitsPatternIndex = 0;\n }\n\n this.matchingFormats = this.matchingFormats.filter(function (format) {\n // If national prefix is mandatory for this phone number format\n // and the user didn't input the national prefix\n // then this phone number format isn't suitable.\n if (!_this.isInternational() && !_this.nationalPrefix && format.nationalPrefixIsMandatoryWhenFormattingInNationalFormat()) {\n return false;\n }\n\n var leadingDigitsPatternsCount = format.leadingDigitsPatterns().length; // If this format is not restricted to a certain\n // leading digits pattern then it fits.\n\n if (leadingDigitsPatternsCount === 0) {\n return true;\n } // Start excluding any non-matching formats only when the\n // national number entered so far is at least 3 digits long,\n // otherwise format matching would give false negatives.\n // For example, when the digits entered so far are `2`\n // and the leading digits pattern is `21` –\n // it's quite obvious in this case that the format could be the one\n // but due to the absence of further digits it would give false negative.\n\n\n if (leadingDigits.length < MIN_LEADING_DIGITS_LENGTH) {\n return true;\n } // If at least `MIN_LEADING_DIGITS_LENGTH` digits of a national number are available\n // then format matching starts narrowing down the list of possible formats\n // (only previously matched formats are considered for next digits).\n\n\n leadingDigitsPatternIndex = Math.min(leadingDigitsPatternIndex, leadingDigitsPatternsCount - 1);\n var leadingDigitsPattern = format.leadingDigitsPatterns()[leadingDigitsPatternIndex]; // Brackets are required for `^` to be applied to\n // all or-ed (`|`) parts, not just the first one.\n\n return new RegExp(\"^(\".concat(leadingDigitsPattern, \")\")).test(leadingDigits);\n }); // If there was a phone number format chosen\n // and it no longer holds given the new leading digits then reset it.\n // The test for this `if` condition is marked as:\n // \"Reset a chosen format when it no longer holds given the new leading digits\".\n // To construct a valid test case for this one can find a country\n // in `PhoneNumberMetadata.xml` yielding one format for 3 ``\n // and yielding another format for 4 `` (Australia in this case).\n\n if (this.chosenFormat && this.matchingFormats.indexOf(this.chosenFormat) === -1) {\n this.resetFormat();\n }\n }\n }, {\n key: \"getSeparatorAfterNationalPrefix\",\n value: function getSeparatorAfterNationalPrefix(format) {\n if (this.metadata.countryCallingCode() === '1') {\n return ' ';\n }\n\n if (format && format.nationalPrefixFormattingRule() && NATIONAL_PREFIX_SEPARATORS_PATTERN.test(format.nationalPrefixFormattingRule())) {\n return ' ';\n }\n\n return '';\n } // This is in accordance to how Google's `libphonenumber` does it.\n // \"Check to see if there is an exact pattern match for these digits.\n // If so, we should use this instead of any other formatting template\n // whose `leadingDigitsPattern` also matches the input.\"\n\n }, {\n key: \"attemptToFormatCompletePhoneNumber\",\n value: function attemptToFormatCompletePhoneNumber() {\n for (var _iterator2 = this.matchingFormats, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {\n var _ref2;\n\n if (_isArray2) {\n if (_i2 >= _iterator2.length) break;\n _ref2 = _iterator2[_i2++];\n } else {\n _i2 = _iterator2.next();\n if (_i2.done) break;\n _ref2 = _i2.value;\n }\n\n var format = _ref2;\n var matcher = new RegExp(\"^(?:\".concat(format.pattern(), \")$\"));\n\n if (!matcher.test(this.nationalNumberDigits)) {\n continue;\n } // Here, national number is formatted without \"national prefix\n // formatting rule\", because otherwise there'd be a bug\n // when \"area code\" is \"duplicated\" during input:\n // https://github.com/catamphetamine/libphonenumber-js/issues/318\n\n\n var formattedNationalNumber = formatNationalNumberUsingFormat(this.nationalNumberDigits, format, this.isInternational(), false, // Don't prepend national prefix (it will be prepended manually).\n this.metadata); // Check if this `format` preserves all digits.\n // This is how it's done in Google's `libphonenumber`.\n // Also, it fixes the bug when \"area code\" is \"duplicated\" during input:\n // https://github.com/catamphetamine/libphonenumber-js/issues/318\n //\n // \"Check that we didn't remove nor add any extra digits when we matched\n // this formatting pattern. This usually happens after we entered the last\n // digit during AYTF. Eg: In case of MX, we swallow mobile token (1) when\n // formatted but AYTF should retain all the number entered and not change\n // in order to match a format (of same leading digits and length) display\n // in that way.\"\n // \"If it's the same (i.e entered number and format is same), then it's\n // safe to return this in formatted number as nothing is lost / added.\"\n // Otherwise, don't use this format.\n // https://github.com/google/libphonenumber/commit/3e7c1f04f5e7200f87fb131e6f85c6e99d60f510#diff-9149457fa9f5d608a11bb975c6ef4bc5\n // https://github.com/google/libphonenumber/commit/3ac88c7106e7dcb553bcc794b15f19185928a1c6#diff-2dcb77e833422ee304da348b905cde0b\n //\n\n if (parseDigits(formattedNationalNumber) !== this.nationalNumberDigits) {\n continue;\n } // Prepend national prefix (if any).\n\n\n if (this.nationalPrefix) {\n // Here, national number is formatted with \"national prefix\n // formatting rule\". The reason is that \"national prefix\n // formatting rule\" often adds parentheses, and while Google's\n // `libphonenumber` dismisses those preferring simply prepending\n // national prefix followed by a \" \" character, this library\n // looks if the national prefix could be formatted better.\n var formattedNationalNumberWithNationalPrefix = formatNationalNumberUsingFormat(this.nationalNumberDigits, format, this.isInternational(), true, // Prepend national prefix.\n this.metadata);\n\n if (parseDigits(formattedNationalNumberWithNationalPrefix) === this.nationalPrefix + this.nationalNumberDigits) {\n formattedNationalNumber = formattedNationalNumberWithNationalPrefix;\n } else {\n formattedNationalNumber = this.nationalPrefix + this.getSeparatorAfterNationalPrefix(format) + formattedNationalNumber;\n }\n } // formats national number (probably) without national prefix.\n // Formatting a national number with national prefix could result in\n // bugs when \"area code\" is \"duplicated\" during input:\n // https://github.com/catamphetamine/libphonenumber-js/issues/318\n // The \"are all digits preserved\" check fixes that type of bug.\n // To leave the formatter in a consistent state\n\n\n this.resetFormat();\n this.chosenFormat = format; // Set `this.template` and `this.populatedNationalNumberTemplate`.\n\n /* istanbul ignore else */\n\n if (this.createFormattingTemplate(format)) {\n // Populate `this.populatedNationalNumberTemplate` with phone number digits.\n this.reformatNationalNumber();\n } else {\n // If the formatting template couldn't be created for a format,\n // create it manually from the formatted phone number.\n // This case doesn't ever happen with the current metadata.\n this.template = this.getFullNumber(formattedNationalNumber).replace(/[\\d\\+]/g, DIGIT_PLACEHOLDER);\n this.populatedNationalNumberTemplate = formattedNationalNumber;\n this.populatedNationalNumberTemplatePosition = this.populatedNationalNumberTemplate.length - 1;\n }\n\n return formattedNationalNumber;\n }\n }\n }, {\n key: \"getInternationalPrefix\",\n value: function getInternationalPrefix(options) {\n return this.internationalPrefix ? options && options.spacing === false ? this.internationalPrefix : this.internationalPrefix + ' ' : '+';\n } // Prepends `+CountryCode ` in case of an international phone number\n\n }, {\n key: \"getFullNumber\",\n value: function getFullNumber(formattedNationalNumber) {\n if (this.isInternational()) {\n var prefix = this.getInternationalPrefix();\n\n if (!this.countryCallingCode) {\n return \"\".concat(prefix).concat(this.digits);\n }\n\n if (!formattedNationalNumber) {\n return \"\".concat(prefix).concat(this.countryCallingCode);\n }\n\n return \"\".concat(prefix).concat(this.countryCallingCode, \" \").concat(formattedNationalNumber);\n }\n\n return formattedNationalNumber;\n }\n }, {\n key: \"getNonFormattedNationalNumber\",\n value: function getNonFormattedNationalNumber() {\n return this.nationalPrefix + (this.nationalPrefix && this.nationalNumberDigits && this.getSeparatorAfterNationalPrefix()) + this.nationalNumberDigits;\n } // Extracts the country calling code from the beginning\n // of the entered `national_number` (so far),\n // and places the remaining input into the `national_number`.\n\n }, {\n key: \"extractCountryCallingCode\",\n value: function extractCountryCallingCode() {\n var _extractCountryCallin = _extractCountryCallingCode('+' + this.digits, this.defaultCountry, this.defaultCallingCode, this.metadata.metadata),\n countryCallingCode = _extractCountryCallin.countryCallingCode,\n number = _extractCountryCallin.number;\n\n if (!countryCallingCode) {\n return;\n }\n\n this.nationalNumberDigits = number;\n this.countryCallingCode = countryCallingCode;\n this.metadata.chooseCountryByCountryCallingCode(countryCallingCode);\n this.initializePhoneNumberFormatsForCountry();\n this.resetFormat();\n return this.metadata.hasSelectedNumberingPlan();\n }\n }, {\n key: \"extractNationalPrefix\",\n value: function extractNationalPrefix() {\n this.nationalPrefix = '';\n\n if (!this.metadata.hasSelectedNumberingPlan()) {\n return;\n } // Only strip national prefixes for non-international phone numbers\n // because national prefixes can't be present in international phone numbers.\n // While `parseNumber()` is forgiving is such cases, `AsYouType` is not.\n\n\n var _stripNationalPrefixA = stripNationalPrefixAndCarrierCode(this.nationalNumberDigits, this.metadata),\n nationalNumber = _stripNationalPrefixA.nationalNumber,\n carrierCode = _stripNationalPrefixA.carrierCode; // Sometimes `stripNationalPrefixAndCarrierCode()` won't actually\n // strip national prefix and will instead prepend some digits to the `number`:\n // for example, when number `2345678` is passed with `VI` country selected,\n // it will return `{ number: \"3402345678\" }`, because `340` area code is prepended.\n // So check if the `nationalNumber` is actually at the end of `this.nationalNumberDigits`.\n\n\n if (nationalNumber) {\n var index = this.nationalNumberDigits.indexOf(nationalNumber);\n\n if (index < 0 || index !== this.nationalNumberDigits.length - nationalNumber.length) {\n return;\n }\n }\n\n if (carrierCode) {\n this.carrierCode = carrierCode;\n }\n\n this.nationalPrefix = this.nationalNumberDigits.slice(0, this.nationalNumberDigits.length - nationalNumber.length);\n this.nationalNumberDigits = nationalNumber;\n return this.nationalPrefix;\n } // isPossibleNumber(number) {\n // \tswitch (checkNumberLengthForType(number, undefined, this.metadata)) {\n // \t\tcase 'IS_POSSIBLE':\n // \t\t\treturn true\n // \t\t// case 'IS_POSSIBLE_LOCAL_ONLY':\n // \t\t// \treturn !this.isInternational()\n // \t\tdefault:\n // \t\t\treturn false\n // \t}\n // }\n\n }, {\n key: \"isCountryCallingCodeAmbiguous\",\n value: function isCountryCallingCodeAmbiguous() {\n var countryCodes = this.metadata.getCountryCodesForCallingCode(this.countryCallingCode);\n return countryCodes && countryCodes.length > 1;\n }\n }, {\n key: \"createFormattingTemplate\",\n value: function createFormattingTemplate(format) {\n // The formatter doesn't format numbers when numberPattern contains '|', e.g.\n // (20|3)\\d{4}. In those cases we quickly return.\n // (Though there's no such format in current metadata)\n\n /* istanbul ignore if */\n if (SUPPORT_LEGACY_FORMATTING_PATTERNS && format.pattern().indexOf('|') >= 0) {\n return;\n } // Get formatting template for this phone number format\n\n\n var template = this.getTemplateForNumberFormatPattern(format, this.nationalPrefix); // If the national number entered is too long\n // for any phone number format, then abort.\n\n if (!template) {\n return;\n }\n\n this.template = template;\n this.populatedNationalNumberTemplate = template; // For convenience, the public `.template` property\n // contains the whole international number\n // if the phone number being input is international:\n // 'x' for the '+' sign, 'x'es for the country phone code,\n // a spacebar and then the template for the formatted national number.\n\n if (this.isInternational()) {\n this.template = this.getInternationalPrefix().replace(/[\\d\\+]/g, DIGIT_PLACEHOLDER) + repeat(DIGIT_PLACEHOLDER, this.countryCallingCode.length) + ' ' + template;\n }\n\n return this.template;\n }\n /**\r\n * Generates formatting template for a national phone number,\r\n * optionally containing a national prefix, for a format.\r\n * @param {Format} format\r\n * @param {string} nationalPrefix\r\n * @return {string}\r\n */\n\n }, {\n key: \"getTemplateForNumberFormatPattern\",\n value: function getTemplateForNumberFormatPattern(format, nationalPrefix) {\n var pattern = format.pattern();\n /* istanbul ignore else */\n\n if (SUPPORT_LEGACY_FORMATTING_PATTERNS) {\n pattern = pattern // Replace anything in the form of [..] with \\d\n .replace(CREATE_CHARACTER_CLASS_PATTERN(), '\\\\d') // Replace any standalone digit (not the one in `{}`) with \\d\n .replace(CREATE_STANDALONE_DIGIT_PATTERN(), '\\\\d');\n } // Generate a dummy national number (consisting of `9`s)\n // that fits this format's `pattern`.\n //\n // This match will always succeed,\n // because the \"longest dummy phone number\"\n // has enough length to accomodate any possible\n // national phone number format pattern.\n //\n\n\n var digits = LONGEST_DUMMY_PHONE_NUMBER.match(pattern)[0]; // If the national number entered is too long\n // for any phone number format, then abort.\n\n if (this.nationalNumberDigits.length > digits.length) {\n return;\n } // Get a formatting template which can be used to efficiently format\n // a partial number where digits are added one by one.\n // Below `strictPattern` is used for the\n // regular expression (with `^` and `$`).\n // This wasn't originally in Google's `libphonenumber`\n // and I guess they don't really need it\n // because they're not using \"templates\" to format phone numbers\n // but I added `strictPattern` after encountering\n // South Korean phone number formatting bug.\n //\n // Non-strict regular expression bug demonstration:\n //\n // this.nationalNumberDigits : `111111111` (9 digits)\n //\n // pattern : (\\d{2})(\\d{3,4})(\\d{4})\n // format : `$1 $2 $3`\n // digits : `9999999999` (10 digits)\n //\n // '9999999999'.replace(new RegExp(/(\\d{2})(\\d{3,4})(\\d{4})/g), '$1 $2 $3') = \"99 9999 9999\"\n //\n // template : xx xxxx xxxx\n //\n // But the correct template in this case is `xx xxx xxxx`.\n // The template was generated incorrectly because of the\n // `{3,4}` variability in the `pattern`.\n //\n // The fix is, if `this.nationalNumberDigits` has already sufficient length\n // to satisfy the `pattern` completely then `this.nationalNumberDigits`\n // is used instead of `digits`.\n\n\n var strictPattern = new RegExp('^' + pattern + '$');\n var nationalNumberDummyDigits = this.nationalNumberDigits.replace(/\\d/g, DUMMY_DIGIT); // If `this.nationalNumberDigits` has already sufficient length\n // to satisfy the `pattern` completely then use it\n // instead of `digits`.\n\n if (strictPattern.test(nationalNumberDummyDigits)) {\n digits = nationalNumberDummyDigits;\n }\n\n var numberFormat = this.getFormatFormat(format);\n var includesNationalPrefix;\n\n if (nationalPrefix) {\n if (format.nationalPrefixFormattingRule()) {\n var numberFormatWithNationalPrefix = numberFormat.replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule());\n\n if (parseDigits(numberFormatWithNationalPrefix) === nationalPrefix + parseDigits(numberFormat)) {\n numberFormat = numberFormatWithNationalPrefix;\n includesNationalPrefix = true;\n var i = nationalPrefix.length;\n\n while (i > 0) {\n numberFormat = numberFormat.replace(/\\d/, DIGIT_PLACEHOLDER);\n i--;\n }\n }\n }\n } // Generate formatting template for this phone number format.\n\n\n var template = digits // Format the dummy phone number according to the format.\n .replace(new RegExp(pattern), numberFormat) // Replace each dummy digit with a DIGIT_PLACEHOLDER.\n .replace(new RegExp(DUMMY_DIGIT, 'g'), DIGIT_PLACEHOLDER);\n\n if (nationalPrefix) {\n if (!includesNationalPrefix) {\n // Prepend national prefix to the template manually.\n template = repeat(DIGIT_PLACEHOLDER, nationalPrefix.length) + this.getSeparatorAfterNationalPrefix(format) + template;\n }\n }\n\n return template;\n }\n }, {\n key: \"formatNextNationalNumberDigits\",\n value: function formatNextNationalNumberDigits(digits) {\n // Using `.split('')` to iterate through a string here\n // to avoid requiring `Symbol.iterator` polyfill.\n // `.split('')` is generally not safe for Unicode,\n // but in this particular case for `digits` it is safe.\n // for (const digit of digits)\n for (var _iterator3 = digits.split(''), _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {\n var _ref3;\n\n if (_isArray3) {\n if (_i3 >= _iterator3.length) break;\n _ref3 = _iterator3[_i3++];\n } else {\n _i3 = _iterator3.next();\n if (_i3.done) break;\n _ref3 = _i3.value;\n }\n\n var digit = _ref3;\n\n // If there is room for more digits in current `template`,\n // then set the next digit in the `template`,\n // and return the formatted digits so far.\n // If more digits are entered than the current format could handle.\n if (this.populatedNationalNumberTemplate.slice(this.populatedNationalNumberTemplatePosition + 1).search(DIGIT_PLACEHOLDER_MATCHER) < 0) {\n // Reset the format.\n this.resetFormat();\n return;\n }\n\n this.populatedNationalNumberTemplatePosition = this.populatedNationalNumberTemplate.search(DIGIT_PLACEHOLDER_MATCHER);\n this.populatedNationalNumberTemplate = this.populatedNationalNumberTemplate.replace(DIGIT_PLACEHOLDER_MATCHER, digit);\n } // Return the formatted phone number so far.\n\n\n return cutAndStripNonPairedParens(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition + 1); // The old way which was good for `input-format` but is not so good\n // for `react-phone-number-input`'s default input (`InputBasic`).\n // return closeNonPairedParens(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition + 1)\n // \t.replace(new RegExp(DIGIT_PLACEHOLDER, 'g'), ' ')\n }\n }, {\n key: \"getFormatFormat\",\n value: function getFormatFormat(format) {\n if (this.isInternational()) {\n return applyInternationalSeparatorStyle(format.internationalFormat());\n }\n\n return format.format();\n } // Determines the country of the phone number\n // entered so far based on the country phone code\n // and the national phone number.\n\n }, {\n key: \"determineTheCountry\",\n value: function determineTheCountry() {\n this.country = findCountryCode(this.isInternational() ? this.countryCallingCode : this.defaultCallingCode, this.nationalNumberDigits, this.metadata);\n }\n /**\r\n * Returns an instance of `PhoneNumber` class.\r\n * Will return `undefined` if no national (significant) number\r\n * digits have been entered so far, or if no `defaultCountry` has been\r\n * set and the user enters a phone number not in international format.\r\n */\n\n }, {\n key: \"getNumber\",\n value: function getNumber() {\n if (this.isInternational()) {\n if (!this.countryCallingCode) {\n return;\n }\n } else {\n if (!this.country && !this.defaultCallingCode) {\n return;\n }\n }\n\n if (!this.nationalNumberDigits) {\n return undefined;\n }\n\n var countryCode = this.getCountry();\n var callingCode = this.getCountryCallingCode() || this.defaultCallingCode;\n var nationalNumber = this.nationalNumberDigits;\n var carrierCode = this.carrierCode; // When an international number without a leading `+` has been autocorrected,\n // extract country calling code, because normally it's only extracted\n // for international numbers with a leading `+`.\n // Could also just use `parsePhoneNumberFromString()` here\n // instead of hacking around this single case.\n\n if (!this.isInternational() && this.nationalNumberDigits === this.digits) {\n var _extractCountryCallin2 = extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(this.digits, countryCode, callingCode, this.metadata.metadata),\n countryCallingCode = _extractCountryCallin2.countryCallingCode,\n number = _extractCountryCallin2.number;\n\n if (countryCallingCode) {\n var _stripNationalPrefixA2 = stripNationalPrefixAndCarrierCodeFromCompleteNumber(number, this.metadata),\n shorterNationalNumber = _stripNationalPrefixA2.nationalNumber,\n newCarrierCode = _stripNationalPrefixA2.carrierCode;\n\n nationalNumber = shorterNationalNumber;\n carrierCode = newCarrierCode;\n }\n }\n\n var phoneNumber = new PhoneNumber(countryCode || callingCode, nationalNumber, this.metadata.metadata);\n\n if (carrierCode) {\n phoneNumber.carrierCode = carrierCode;\n } // Phone number extensions are not supported by \"As You Type\" formatter.\n\n\n return phoneNumber;\n }\n /**\r\n * Returns `true` if the phone number is \"possible\".\r\n * Is just a shortcut for `PhoneNumber.isPossible()`.\r\n * @return {boolean}\r\n */\n\n }, {\n key: \"isPossible\",\n value: function isPossible() {\n var phoneNumber = this.getNumber();\n\n if (!phoneNumber) {\n return false;\n }\n\n return phoneNumber.isPossible();\n }\n /**\r\n * Returns `true` if the phone number is \"valid\".\r\n * Is just a shortcut for `PhoneNumber.isValid()`.\r\n * @return {boolean}\r\n */\n\n }, {\n key: \"isValid\",\n value: function isValid() {\n var phoneNumber = this.getNumber();\n\n if (!phoneNumber) {\n return false;\n }\n\n return phoneNumber.isValid();\n }\n /**\r\n * @deprecated\r\n * This method is used in `react-phone-number-input/source/input-control.js`\r\n * in versions before `3.0.16`.\r\n */\n\n }, {\n key: \"getNationalNumber\",\n value: function getNationalNumber() {\n return this.nationalNumberDigits;\n }\n }, {\n key: \"getNonFormattedTemplate\",\n value: function getNonFormattedTemplate() {\n return this.getFullNumber(this.getNonFormattedNationalNumber()).replace(/[\\+\\d]/g, DIGIT_PLACEHOLDER);\n }\n /**\r\n * Returns formatted phone number template.\r\n * @return {string} [template]\r\n */\n\n }, {\n key: \"getTemplate\",\n value: function getTemplate() {\n if (!this.template) {\n return this.getNonFormattedTemplate();\n }\n\n var index = -1;\n var i = 0;\n\n while (i < (this.isInternational() ? this.getInternationalPrefix({\n spacing: false\n }).length : 0) + this.digits.length) {\n index = this.template.indexOf(DIGIT_PLACEHOLDER, index + 1);\n i++;\n }\n\n return cutAndStripNonPairedParens(this.template, index + 1);\n }\n }]);\n\n return AsYouType;\n}();\n\nexport { AsYouType as default };\nexport function stripNonPairedParens(string) {\n var dangling_braces = [];\n var i = 0;\n\n while (i < string.length) {\n if (string[i] === '(') {\n dangling_braces.push(i);\n } else if (string[i] === ')') {\n dangling_braces.pop();\n }\n\n i++;\n }\n\n var start = 0;\n var cleared_string = '';\n dangling_braces.push(string.length);\n\n for (var _i4 = 0, _dangling_braces = dangling_braces; _i4 < _dangling_braces.length; _i4++) {\n var index = _dangling_braces[_i4];\n cleared_string += string.slice(start, index);\n start = index + 1;\n }\n\n return cleared_string;\n}\nexport function cutAndStripNonPairedParens(string, cutBeforeIndex) {\n if (string[cutBeforeIndex] === ')') {\n cutBeforeIndex++;\n }\n\n return stripNonPairedParens(string.slice(0, cutBeforeIndex));\n}\nexport function closeNonPairedParens(template, cut_before) {\n var retained_template = template.slice(0, cut_before);\n var opening_braces = countOccurences('(', retained_template);\n var closing_braces = countOccurences(')', retained_template);\n var dangling_braces = opening_braces - closing_braces;\n\n while (dangling_braces > 0 && cut_before < template.length) {\n if (template[cut_before] === ')') {\n dangling_braces--;\n }\n\n cut_before++;\n }\n\n return template.slice(0, cut_before);\n} // Counts all occurences of a symbol in a string.\n// Unicode-unsafe (because using `.split()`).\n\nexport function countOccurences(symbol, string) {\n var count = 0; // Using `.split('')` to iterate through a string here\n // to avoid requiring `Symbol.iterator` polyfill.\n // `.split('')` is generally not safe for Unicode,\n // but in this particular case for counting brackets it is safe.\n // for (const character of string)\n\n for (var _iterator4 = string.split(''), _isArray4 = Array.isArray(_iterator4), _i5 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) {\n var _ref4;\n\n if (_isArray4) {\n if (_i5 >= _iterator4.length) break;\n _ref4 = _iterator4[_i5++];\n } else {\n _i5 = _iterator4.next();\n if (_i5.done) break;\n _ref4 = _i5.value;\n }\n\n var character = _ref4;\n\n if (character === symbol) {\n count++;\n }\n }\n\n return count;\n} // Repeats a string (or a symbol) N times.\n// http://stackoverflow.com/questions/202605/repeat-string-javascript\n\nexport function repeat(string, times) {\n if (times < 1) {\n return '';\n }\n\n var result = '';\n\n while (times > 1) {\n if (times & 1) {\n result += string;\n }\n\n times >>= 1;\n string += string;\n }\n\n return result + string;\n}\n/**\r\n * Extracts formatted phone number from text (if there's any).\r\n * @param {string} text\r\n * @return {string} [formattedPhoneNumber]\r\n */\n\nfunction extractFormattedPhoneNumber(text) {\n // Attempt to extract a possible number from the string passed in.\n var startsAt = text.search(VALID_PHONE_NUMBER);\n\n if (startsAt < 0) {\n return;\n } // Trim everything to the left of the phone number.\n\n\n text = text.slice(startsAt); // Trim the `+`.\n\n var hasPlus;\n\n if (text[0] === '+') {\n hasPlus = true;\n text = text.slice('+'.length);\n } // Trim everything to the right of the phone number.\n\n\n text = text.replace(AFTER_PHONE_NUMBER_DIGITS_END_PATTERN, ''); // Re-add the previously trimmed `+`.\n\n if (hasPlus) {\n text = '+' + text;\n }\n\n return text;\n}\n//# sourceMappingURL=AsYouType.js.map","import Metadata from './metadata';\nexport default function getCountries(metadata) {\n return new Metadata(metadata).getCountries();\n}\n//# sourceMappingURL=getCountries.js.map","import { getCountryCallingCode } from 'libphonenumber-js/core';\nexport function getInputValuePrefix(country, international, metadata) {\n return country && international ? \"+\".concat(getCountryCallingCode(country, metadata)) : '';\n}\nexport function removeInputValuePrefix(value, prefix) {\n if (prefix) {\n value = value.slice(prefix.length);\n\n if (value[0] === ' ') {\n value = value.slice(1);\n }\n }\n\n return value;\n}\n//# sourceMappingURL=inputValuePrefix.js.map","function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport React, { useCallback } from 'react';\nimport PropTypes from 'prop-types';\nimport Input from 'input-format/react';\nimport { AsYouType, parsePhoneNumberCharacter } from 'libphonenumber-js/core';\nimport { getInputValuePrefix, removeInputValuePrefix } from './inputValuePrefix';\n/**\r\n * This input uses `input-format` library\r\n * for \"smart\" caret positioning.\r\n */\n\nexport function createInput(defaultMetadata) {\n function InputSmart(_ref, ref) {\n var country = _ref.country,\n international = _ref.international,\n metadata = _ref.metadata,\n rest = _objectWithoutProperties(_ref, [\"country\", \"international\", \"metadata\"]);\n\n var format = useCallback(function (value) {\n // \"As you type\" formatter.\n var formatter = new AsYouType(country, metadata);\n var prefix = getInputValuePrefix(country, international, metadata); // Format the number.\n\n var text = formatter.input(prefix + value);\n var template = formatter.getTemplate();\n\n if (prefix) {\n text = removeInputValuePrefix(text, prefix); // `AsYouType.getTemplate()` can be `undefined`.\n\n if (template) {\n template = removeInputValuePrefix(template, prefix);\n }\n }\n\n return {\n text: text,\n template: template\n };\n }, [country, metadata]);\n return React.createElement(Input, _extends({}, rest, {\n ref: ref,\n parse: parsePhoneNumberCharacter,\n format: format\n }));\n }\n\n InputSmart = React.forwardRef(InputSmart);\n InputSmart.propTypes = {\n /**\r\n * A two-letter country code for formatting `value`\r\n * as a national phone number (e.g. `(800) 555 35 35`).\r\n * E.g. \"US\", \"RU\", etc.\r\n * If no `country` is passed then `value`\r\n * is formatted as an international phone number.\r\n * (e.g. `+7 800 555 35 35`)\r\n * Perhaps the `country` property should have been called `defaultCountry`\r\n * because if `value` is an international number then `country` is ignored.\r\n */\n country: PropTypes.string,\n\n /**\r\n * If `country` property is passed along with `international={true}` property\r\n * then the phone number will be input in \"international\" format for that `country`\r\n * (without \"country calling code\").\r\n * For example, if `country=\"US\"` property is passed to \"without country select\" input\r\n * then the phone number will be input in the \"national\" format for `US` (`(213) 373-4253`).\r\n * But if both `country=\"US\"` and `international={true}` properties are passed then\r\n * the phone number will be input in the \"international\" format for `US` (`213 373 4253`)\r\n * (without \"country calling code\" `+1`).\r\n */\n international: PropTypes.bool,\n\n /**\r\n * `libphonenumber-js` metadata.\r\n */\n metadata: PropTypes.object.isRequired\n };\n InputSmart.defaultProps = {\n metadata: defaultMetadata\n };\n return InputSmart;\n}\nexport default createInput();\n//# sourceMappingURL=InputSmart.js.map","function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport React, { useCallback } from 'react';\nimport PropTypes from 'prop-types';\nimport { parseIncompletePhoneNumber, formatIncompletePhoneNumber } from 'libphonenumber-js/core';\nimport { getInputValuePrefix, removeInputValuePrefix } from './inputValuePrefix';\nexport function createInput(defaultMetadata) {\n /**\r\n * `InputBasic`'s caret is not as \"smart\" as the default `inputComponent`'s\r\n * but still works good enough. When erasing or inserting digits in the middle\r\n * of a phone number the caret usually jumps to the end: this is the expected\r\n * behaviour and it's the workaround for the [Samsung Galaxy smart caret positioning bug](https://github.com/catamphetamine/react-phone-number-input/issues/75).\r\n */\n function InputBasic(_ref, ref) {\n var value = _ref.value,\n onChange = _ref.onChange,\n country = _ref.country,\n international = _ref.international,\n metadata = _ref.metadata,\n Input = _ref.inputComponent,\n rest = _objectWithoutProperties(_ref, [\"value\", \"onChange\", \"country\", \"international\", \"metadata\", \"inputComponent\"]);\n\n var prefix = getInputValuePrefix(country, international, metadata);\n\n var _onChange = useCallback(function (event) {\n var newValue = parseIncompletePhoneNumber(event.target.value); // By default, if a value is something like `\"(123)\"`\n // then Backspace would only erase the rightmost brace\n // becoming something like `\"(123\"`\n // which would give the same `\"123\"` value\n // which would then be formatted back to `\"(123)\"`\n // and so a user wouldn't be able to erase the phone number.\n // Working around this issue with this simple hack.\n\n if (newValue === value) {\n var newValueFormatted = format(prefix, newValue, country, metadata);\n\n if (newValueFormatted.indexOf(event.target.value) === 0) {\n // Trim the last digit (or plus sign).\n newValue = newValue.slice(0, -1);\n }\n }\n\n onChange(newValue);\n }, [prefix, value, onChange, country, metadata]);\n\n return React.createElement(Input, _extends({}, rest, {\n ref: ref,\n value: format(prefix, value, country, metadata),\n onChange: _onChange\n }));\n }\n\n InputBasic = React.forwardRef(InputBasic);\n InputBasic.propTypes = {\n /**\r\n * The parsed phone number.\r\n * \"Parsed\" not in a sense of \"E.164\"\r\n * but rather in a sense of \"having only\r\n * digits and possibly a leading plus character\".\r\n * Examples: `\"\"`, `\"+\"`, `\"+123\"`, `\"123\"`.\r\n */\n value: PropTypes.string.isRequired,\n\n /**\r\n * Updates the `value`.\r\n */\n onChange: PropTypes.func.isRequired,\n\n /**\r\n * A two-letter country code for formatting `value`\r\n * as a national phone number (e.g. `(800) 555 35 35`).\r\n * E.g. \"US\", \"RU\", etc.\r\n * If no `country` is passed then `value`\r\n * is formatted as an international phone number.\r\n * (e.g. `+7 800 555 35 35`)\r\n * Perhaps the `country` property should have been called `defaultCountry`\r\n * because if `value` is an international number then `country` is ignored.\r\n */\n country: PropTypes.string,\n\n /**\r\n * If `country` property is passed along with `international={true}` property\r\n * then the phone number will be input in \"international\" format for that `country`\r\n * (without \"country calling code\").\r\n * For example, if `country=\"US\"` property is passed to \"without country select\" input\r\n * then the phone number will be input in the \"national\" format for `US` (`(213) 373-4253`).\r\n * But if both `country=\"US\"` and `international={true}` properties are passed then\r\n * the phone number will be input in the \"international\" format for `US` (`213 373 4253`)\r\n * (without \"country calling code\" `+1`).\r\n */\n international: PropTypes.bool,\n\n /**\r\n * `libphonenumber-js` metadata.\r\n */\n metadata: PropTypes.object.isRequired,\n\n /**\r\n * The `` component.\r\n */\n inputComponent: PropTypes.elementType.isRequired\n };\n InputBasic.defaultProps = {\n metadata: defaultMetadata,\n inputComponent: 'input'\n };\n return InputBasic;\n}\nexport default createInput();\n\nfunction format(prefix, value, country, metadata) {\n return removeInputValuePrefix(formatIncompletePhoneNumber(prefix + value, country, metadata), prefix);\n}\n//# sourceMappingURL=InputBasic.js.map","import AsYouType from './AsYouType';\n/**\r\n * Formats a (possibly incomplete) phone number.\r\n * The phone number can be either in E.164 format\r\n * or in a form of national number digits.\r\n * @param {string} value - A possibly incomplete phone number. Either in E.164 format or in a form of national number digits.\r\n * @param {string?} country - Two-letter (\"ISO 3166-1 alpha-2\") country code.\r\n * @return {string} Formatted (possibly incomplete) phone number.\r\n */\n\nexport default function formatIncompletePhoneNumber(value, country, metadata) {\n if (!metadata) {\n metadata = country;\n country = undefined;\n }\n\n return new AsYouType(country, metadata).input(value);\n}\n//# sourceMappingURL=formatIncompletePhoneNumber.js.map","function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames'; // Default country flag icon.\n// `` is wrapped in a `
` to prevent SVGs from exploding in size in IE 11.\n// https://github.com/catamphetamine/react-phone-number-input/issues/111\n\nexport default function FlagComponent(_ref) {\n var country = _ref.country,\n countryName = _ref.countryName,\n flags = _ref.flags,\n flagUrl = _ref.flagUrl,\n rest = _objectWithoutProperties(_ref, [\"country\", \"countryName\", \"flags\", \"flagUrl\"]);\n\n if (flags && flags[country]) {\n return flags[country]({\n title: countryName\n });\n }\n\n return React.createElement(\"img\", _extends({}, rest, {\n alt: countryName,\n role: \"presentation\",\n src: flagUrl.replace('{XX}', country).replace('{xx}', country.toLowerCase())\n }));\n}\nFlagComponent.propTypes = {\n // The country to be selected by default.\n // Two-letter country code (\"ISO 3166-1 alpha-2\").\n country: PropTypes.string.isRequired,\n // Will be HTML `title` attribute of the ``.\n countryName: PropTypes.string.isRequired,\n // Country flag icon components.\n // By default flag icons are inserted as ``s\n // with their `src` pointed to `country-flag-icons` gitlab pages website.\n // There might be cases (e.g. an offline application)\n // where having a large (3 megabyte) `` flags\n // bundle is more appropriate.\n // `import flags from 'react-phone-number-input/flags'`.\n flags: PropTypes.objectOf(PropTypes.elementType),\n // A URL for a country flag icon.\n // By default it points to `country-flag-icons` gitlab pages website.\n flagUrl: PropTypes.string.isRequired\n};\n//# sourceMappingURL=Flag.js.map","function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nexport default function InternationalIcon(_ref) {\n var aspectRatio = _ref.aspectRatio,\n rest = _objectWithoutProperties(_ref, [\"aspectRatio\"]);\n\n if (aspectRatio === 1) {\n return React.createElement(InternationalIcon1x1, rest);\n } else {\n return React.createElement(InternationalIcon3x2, rest);\n }\n}\nInternationalIcon.propTypes = {\n title: PropTypes.string.isRequired,\n aspectRatio: PropTypes.number\n}; // 3x2.\n// Using `` in `<svg/>`s:\n// https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title\n\nfunction InternationalIcon3x2(_ref2) {\n var title = _ref2.title,\n rest = _objectWithoutProperties(_ref2, [\"title\"]);\n\n return React.createElement(\"svg\", _extends({}, rest, {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 75 50\"\n }), React.createElement(\"title\", null, title), React.createElement(\"g\", {\n className: \"PhoneInputInternationalIconGlobe\",\n stroke: \"currentColor\",\n fill: \"none\",\n strokeWidth: \"2\",\n strokeMiterlimit: \"10\"\n }, React.createElement(\"path\", {\n strokeLinecap: \"round\",\n d: \"M47.2,36.1C48.1,36,49,36,50,36c7.4,0,14,1.7,18.5,4.3\"\n }), React.createElement(\"path\", {\n d: \"M68.6,9.6C64.2,12.3,57.5,14,50,14c-7.4,0-14-1.7-18.5-4.3\"\n }), React.createElement(\"line\", {\n x1: \"26\",\n y1: \"25\",\n x2: \"74\",\n y2: \"25\"\n }), React.createElement(\"line\", {\n x1: \"50\",\n y1: \"1\",\n x2: \"50\",\n y2: \"49\"\n }), React.createElement(\"path\", {\n strokeLinecap: \"round\",\n d: \"M46.3,48.7c1.2,0.2,2.5,0.3,3.7,0.3c13.3,0,24-10.7,24-24S63.3,1,50,1S26,11.7,26,25c0,2,0.3,3.9,0.7,5.8\"\n }), React.createElement(\"path\", {\n strokeLinecap: \"round\",\n d: \"M46.8,48.2c1,0.6,2.1,0.8,3.2,0.8c6.6,0,12-10.7,12-24S56.6,1,50,1S38,11.7,38,25c0,1.4,0.1,2.7,0.2,4c0,0.1,0,0.2,0,0.2\"\n })), React.createElement(\"path\", {\n className: \"PhoneInputInternationalIconPhone\",\n stroke: \"none\",\n fill: \"currentColor\",\n d: \"M12.4,17.9c2.9-2.9,5.4-4.8,0.3-11.2S4.1,5.2,1.3,8.1C-2,11.4,1.1,23.5,13.1,35.6s24.3,15.2,27.5,11.9c2.8-2.8,7.8-6.3,1.4-11.5s-8.3-2.6-11.2,0.3c-2,2-7.2-2.2-11.7-6.7S10.4,19.9,12.4,17.9z\"\n }));\n}\n\nInternationalIcon3x2.propTypes = {\n title: PropTypes.string.isRequired\n}; // 1x1.\n// Using `<title/>` in `<svg/>`s:\n// https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title\n\nfunction InternationalIcon1x1(_ref3) {\n var title = _ref3.title,\n rest = _objectWithoutProperties(_ref3, [\"title\"]);\n\n return React.createElement(\"svg\", _extends({}, rest, {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 50 50\"\n }), React.createElement(\"title\", null, title), React.createElement(\"g\", {\n className: \"PhoneInputInternationalIconGlobe\",\n stroke: \"currentColor\",\n fill: \"none\",\n strokeWidth: \"2\",\n strokeLinecap: \"round\"\n }, React.createElement(\"path\", {\n d: \"M8.45,13A21.44,21.44,0,1,1,37.08,41.56\"\n }), React.createElement(\"path\", {\n d: \"M19.36,35.47a36.9,36.9,0,0,1-2.28-13.24C17.08,10.39,21.88.85,27.8.85s10.72,9.54,10.72,21.38c0,6.48-1.44,12.28-3.71,16.21\"\n }), React.createElement(\"path\", {\n d: \"M17.41,33.4A39,39,0,0,1,27.8,32.06c6.62,0,12.55,1.5,16.48,3.86\"\n }), React.createElement(\"path\", {\n d: \"M44.29,8.53c-3.93,2.37-9.86,3.88-16.49,3.88S15.25,10.9,11.31,8.54\"\n }), React.createElement(\"line\", {\n x1: \"27.8\",\n y1: \"0.85\",\n x2: \"27.8\",\n y2: \"34.61\"\n }), React.createElement(\"line\", {\n x1: \"15.2\",\n y1: \"22.23\",\n x2: \"49.15\",\n y2: \"22.23\"\n })), React.createElement(\"path\", {\n className: \"PhoneInputInternationalIconPhone\",\n stroke: \"transparent\",\n fill: \"currentColor\",\n d: \"M9.42,26.64c2.22-2.22,4.15-3.59.22-8.49S3.08,17,.93,19.17c-2.49,2.48-.13,11.74,9,20.89s18.41,11.5,20.89,9c2.15-2.15,5.91-4.77,1-8.71s-6.27-2-8.49.22c-1.55,1.55-5.48-1.69-8.86-5.08S7.87,28.19,9.42,26.64Z\"\n }));\n}\n\nInternationalIcon1x1.propTypes = {\n title: PropTypes.string.isRequired\n};\n//# sourceMappingURL=InternationalIcon.js.map","import { isSupportedCountry } from 'libphonenumber-js/core';\nexport { getCountries } from 'libphonenumber-js/core';\n/**\r\n * Sorts country `<select/>` options.\r\n * Can move some country `<select/>` options\r\n * to the top of the list, for example.\r\n * @param {object[]} countryOptions — Country `<select/>` options.\r\n * @param {string[]} [countryOptionsOrder] — Country `<select/>` options order. Example: `[\"US\", \"CA\", \"AU\", \"|\", \"...\"]`.\r\n * @return {object[]}\r\n */\n\nexport function sortCountryOptions(options, order) {\n if (!order) {\n return options;\n }\n\n var optionsOnTop = [];\n var optionsOnBottom = [];\n var appendTo = optionsOnTop;\n\n var _loop = function _loop() {\n if (_isArray) {\n if (_i >= _iterator.length) return \"break\";\n _ref = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) return \"break\";\n _ref = _i.value;\n }\n\n var element = _ref;\n\n if (element === '|') {\n appendTo.push({\n divider: true\n });\n } else if (element === '...' || element === '…') {\n appendTo = optionsOnBottom;\n } else {\n // Find the position of the option.\n var index = options.indexOf(options.filter(function (option) {\n return option.value === element;\n })[0]); // Get the option.\n\n var option = options[index]; // Remove the option from its default position.\n\n options.splice(index, 1); // Add the option on top.\n\n appendTo.push(option);\n }\n };\n\n for (var _iterator = order, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref;\n\n var _ret = _loop();\n\n if (_ret === \"break\") break;\n }\n\n return optionsOnTop.concat(options).concat(optionsOnBottom);\n}\nexport function getSupportedCountryOptions(countryOptions, metadata) {\n if (countryOptions) {\n countryOptions = countryOptions.filter(function (option) {\n switch (option) {\n case '|':\n case '...':\n case '…':\n return true;\n\n default:\n return isCountrySupportedWithError(option, metadata);\n }\n });\n\n if (countryOptions.length > 0) {\n return countryOptions;\n }\n }\n}\nexport function isCountrySupportedWithError(country, metadata) {\n if (isSupportedCountry(country, metadata)) {\n return true;\n } else {\n console.error(\"Country not found: \".concat(country));\n return false;\n }\n}\nexport function getSupportedCountries(countries, metadata) {\n if (countries) {\n countries = countries.filter(function (country) {\n return isCountrySupportedWithError(country, metadata);\n });\n\n if (countries.length === 0) {\n countries = undefined;\n }\n }\n\n return countries;\n}\n//# sourceMappingURL=countries.js.map","import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport DefaultInternationalIcon from './InternationalIcon';\nimport Flag from './Flag';\nexport function createCountryIconComponent(_ref) {\n var flags = _ref.flags,\n flagUrl = _ref.flagUrl,\n FlagComponent = _ref.flagComponent,\n InternationalIcon = _ref.internationalIcon;\n\n function CountryIcon(_ref2) {\n var country = _ref2.country,\n label = _ref2.label,\n aspectRatio = _ref2.aspectRatio;\n\n // `aspectRatio` is currently a hack for the default \"International\" icon\n // to render it as a square when Unicode flag icons are used.\n // So `aspectRatio` property is only used with the default \"International\" icon.\n var _aspectRatio = InternationalIcon === DefaultInternationalIcon ? aspectRatio : undefined;\n\n return React.createElement(\"div\", {\n className: classNames('PhoneInputCountryIcon', {\n 'PhoneInputCountryIcon--square': _aspectRatio === 1,\n 'PhoneInputCountryIcon--border': country\n })\n }, country ? React.createElement(FlagComponent, {\n country: country,\n countryName: label,\n flags: flags,\n flagUrl: flagUrl,\n className: \"PhoneInputCountryIconImg\"\n }) : React.createElement(InternationalIcon, {\n title: label,\n aspectRatio: _aspectRatio,\n className: \"PhoneInputCountryIconImg\"\n }));\n }\n\n CountryIcon.propTypes = {\n country: PropTypes.string,\n label: PropTypes.string.isRequired,\n aspectRatio: PropTypes.number\n };\n return CountryIcon;\n}\nexport default createCountryIconComponent({\n // Must be equal to `defaultProps.flagUrl` in `./PhoneInputWithCountry.js`.\n flagUrl: 'https://catamphetamine.gitlab.io/country-flag-icons/3x2/{XX}.svg',\n flagComponent: Flag,\n internationalIcon: DefaultInternationalIcon\n});\n//# sourceMappingURL=CountryIcon.js.map","import PropTypes from 'prop-types';\nexport var metadata = PropTypes.shape({\n country_calling_codes: PropTypes.object.isRequired,\n countries: PropTypes.object.isRequired\n});\nexport var labels = PropTypes.objectOf(PropTypes.string);\n//# sourceMappingURL=PropTypes.js.map","import { parsePhoneNumberFromString, getCountryCallingCode, AsYouType, Metadata } from 'libphonenumber-js/core';\n/**\r\n * Decides which country should be pre-selected\r\n * when the phone number input component is first mounted.\r\n * @param {object?} phoneNumber - An instance of `PhoneNumber` class.\r\n * @param {string?} country - Pre-defined country (two-letter code).\r\n * @param {string[]?} countries - A list of countries available.\r\n * @param {boolean} includeInternationalOption - Whether \"International\" country option is available.\r\n * @param {object} metadata - `libphonenumber-js` metadata\r\n * @return {string?}\r\n */\n\nexport function getPreSelectedCountry(phoneNumber, country, countries, includeInternationalOption, metadata) {\n // If can get country from E.164 phone number\n // then it overrides the `country` passed (or not passed).\n if (phoneNumber && phoneNumber.country) {\n // `country` will be left `undefined` in case of non-detection.\n country = phoneNumber.country;\n } // Only pre-select a country if it's in the available `countries` list.\n\n\n if (countries && countries.indexOf(country) < 0) {\n country = undefined;\n } // If there will be no \"International\" option\n // then some `country` must be selected.\n // It will still be the wrong country though.\n // But still country `<select/>` can't be left in a broken state.\n\n\n if (!country && !includeInternationalOption && countries && countries.length > 0) {\n country = countries[0];\n }\n\n return country;\n}\n/**\r\n * Generates a sorted list of country `<select/>` options.\r\n * @param {string[]} countries - A list of two-letter (\"ISO 3166-1 alpha-2\") country codes.\r\n * @param {object} labels - Custom country labels. E.g. `{ RU: 'Россия', US: 'США', ... }`.\r\n * @param {boolean} includeInternationalOption - Whether should include \"International\" option at the top of the list.\r\n * @return {object[]} A list of objects having shape `{ value : string, label : string }`.\r\n */\n\nexport function getCountrySelectOptions(countries, country_names, includeInternationalOption) {\n // Generates a `<Select/>` option for each country.\n var country_select_options = countries.map(function (country) {\n return {\n value: country,\n // All `locale` country names included in this library\n // include all countries (this is checked at build time).\n // The only case when a country name might be missing\n // is when a developer supplies their own `labels` property.\n // To guard against such cases, a missing country name\n // is substituted by country code.\n label: country_names[country] || country\n };\n }); // Sort the list of countries alphabetically.\n\n country_select_options.sort(function (a, b) {\n return compare_strings(a.label, b.label);\n }); // Add the \"International\" option to the country list (if suitable)\n\n if (includeInternationalOption) {\n country_select_options.unshift({\n label: country_names.ZZ\n });\n }\n\n return country_select_options;\n}\n/**\r\n * Parses a E.164 phone number to an instance of `PhoneNumber` class.\r\n * @param {string?} value = E.164 phone number.\r\n * @param {object} metadata - `libphonenumber-js` metadata\r\n * @return {object} Object having shape `{ country: string?, countryCallingCode: string, number: string }`. `PhoneNumber`: https://gitlab.com/catamphetamine/libphonenumber-js#phonenumber.\r\n * @example\r\n * parsePhoneNumber('+78005553535')\r\n */\n\nexport function parsePhoneNumber(value, metadata) {\n return parsePhoneNumberFromString(value || '', metadata);\n}\n/**\r\n * Generates national number digits for a parsed phone.\r\n * May prepend national prefix.\r\n * The phone number must be a complete and valid phone number.\r\n * @param {object} phoneNumber - An instance of `PhoneNumber` class.\r\n * @param {object} metadata - `libphonenumber-js` metadata\r\n * @return {string}\r\n * @example\r\n * getNationalNumberDigits({ country: 'RU', phone: '8005553535' })\r\n * // returns '88005553535'\r\n */\n\nexport function generateNationalNumberDigits(phoneNumber) {\n return phoneNumber.formatNational().replace(/\\D/g, '');\n}\n/**\r\n * Migrates parsed `<input/>` `value` for the newly selected `country`.\r\n * @param {string?} value - The `value` parsed from phone number `<input/>` (it's the `parsed_input` state property, not the `value` property).\r\n * @param {string?} previousCountry - Previously selected country.\r\n * @param {string?} newCountry - Newly selected country. Can't be same as previously selected country.\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @param {boolean} preferNationalFormat - whether should attempt to convert from international to national number for the new country.\r\n * @return {string?}\r\n */\n\nexport function migrateParsedInputForNewCountry(value, previous_country, new_country, metadata, preferNationalFormat) {\n // If `parsed_input` is empty\n // then no need to migrate anything.\n if (!value) {\n if (preferNationalFormat) {\n return '';\n } else {\n // If `parsedInput` is empty then set `parsedInput` to\n // `+{getCountryCallingCode(newCountry)}`.\n return '+' + getCountryCallingCode(new_country, metadata);\n }\n } // If switching to some country.\n // (from \"International\" or another country)\n // If switching from \"International\" then `value` starts with a `+`.\n // Otherwise it may or may not start with a `+`.\n\n\n if (new_country) {\n // If the phone number was entered in international format\n // then migrate it to the newly selected country.\n // The phone number may be incomplete.\n // The phone number entered not necessarily starts with\n // the previously selected country phone prefix.\n if (value[0] === '+') {\n // If the international phone number is for the new country\n // then convert it to local if required.\n if (preferNationalFormat) {\n // // If a phone number is being input in international form\n // // and the country can already be derived from it,\n // // and if it is the new country, then format as a national number.\n // const derived_country = get_country_from_possibly_incomplete_international_phone_number(value, metadata)\n // if (derived_country === new_country)\n // {\n // \treturn strip_country_calling_code(value, derived_country, metadata)\n // }\n // Actually, the two countries don't necessarily need to match:\n // the condition could be looser here, because several countries\n // might share the same international phone number format\n // (for example, \"NANPA\" countries like US, Canada, etc).\n // The looser condition would be just \"same nternational phone number format\"\n // which would mean \"same country calling code\" in the context of `libphonenumber-js`.\n if (value.indexOf('+' + getCountryCallingCode(new_country, metadata)) === 0) {\n return strip_country_calling_code(value, new_country, metadata);\n } // Simply discard the previously entered international phone number,\n // because otherwise any \"smart\" transformation like getting the\n // \"national (significant) number\" part and then prepending the\n // newly selected country's \"country calling code\" to it\n // would just be confusing for a user without being actually useful.\n\n\n return ''; // // Simply strip the leading `+` character\n // // therefore simply converting all digits into a \"local\" phone number.\n // // https://github.com/catamphetamine/react-phone-number-input/issues/287\n // return value.slice(1)\n }\n\n if (previous_country) {\n if (getCountryCallingCode(new_country, metadata) === getCountryCallingCode(previous_country, metadata)) {\n return value;\n } else {\n return \"+\".concat(getCountryCallingCode(new_country, metadata));\n }\n } else {\n var defaultValue = \"+\".concat(getCountryCallingCode(new_country, metadata)); // If `parsedInput`'s country calling code part is the same\n // as for the new `country`, then leave `parsedInput` as is.\n\n if (value.indexOf(defaultValue) === 0) {\n return value;\n } // If `parsedInput`'s country calling code part is not the same\n // as for the new `country`, then set `parsedInput` to\n // `+{getCountryCallingCode(newCountry)}`.\n\n\n return defaultValue;\n } // // If the international phone number already contains\n // // any country calling code then trim the country calling code part.\n // // (that could also be the newly selected country phone code prefix as well)\n // // `value` doesn't neccessarily belong to `previous_country`.\n // // (e.g. if a user enters an international number\n // // not belonging to any of the reduced `countries` list).\n // value = strip_country_calling_code(value, previous_country, metadata)\n // // Prepend country calling code prefix\n // // for the newly selected country.\n // return e164(value, new_country, metadata) || `+${getCountryCallingCode(new_country, metadata)}`\n\n }\n } // If switching to \"International\" from a country.\n else {\n // If the phone number was entered in national format.\n if (value[0] !== '+') {\n // Format the national phone number as an international one.\n // The phone number entered not necessarily even starts with\n // the previously selected country phone prefix.\n // Even if the phone number belongs to whole another country\n // it will still be parsed into some national phone number.\n return e164(value, previous_country, metadata) || '';\n }\n }\n\n return value;\n}\n/**\r\n * Converts phone number digits to a (possibly incomplete) E.164 phone number.\r\n * @param {string?} number - A possibly incomplete phone number digits string. Can be a possibly incomplete E.164 phone number.\r\n * @param {string?} country\r\n * @param {[object} metadata - `libphonenumber-js` metadata.\r\n * @return {string?}\r\n */\n\nexport function e164(number, country, metadata) {\n if (!number) {\n return;\n } // If the phone number is being input in international format.\n\n\n if (number[0] === '+') {\n // If it's just the `+` sign then return nothing.\n if (number === '+') {\n return;\n } // If there are any digits then the `value` is returned as is.\n\n\n return number;\n } // For non-international phone numbers\n // an accompanying country code is required.\n\n\n if (!country) {\n return;\n }\n\n var partial_national_significant_number = getNationalSignificantNumberDigits(number, country, metadata);\n\n if (partial_national_significant_number) {\n return \"+\".concat(getCountryCallingCode(country, metadata)).concat(partial_national_significant_number);\n }\n}\n/**\r\n * Trims phone number digits if they exceed the maximum possible length\r\n * for a national (significant) number for the country.\r\n * @param {string} number - A possibly incomplete phone number digits string. Can be a possibly incomplete E.164 phone number.\r\n * @param {string} country\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @return {string} Can be empty.\r\n */\n\nexport function trimNumber(number, country, metadata) {\n var nationalSignificantNumberPart = getNationalSignificantNumberDigits(number, country, metadata);\n\n if (nationalSignificantNumberPart) {\n var overflowDigitsCount = nationalSignificantNumberPart.length - getMaxNumberLength(country, metadata);\n\n if (overflowDigitsCount > 0) {\n return number.slice(0, number.length - overflowDigitsCount);\n }\n }\n\n return number;\n}\n\nfunction getMaxNumberLength(country, metadata) {\n // Get \"possible lengths\" for a phone number of the country.\n metadata = new Metadata(metadata);\n metadata.country(country); // Return the last \"possible length\".\n\n return metadata.possibleLengths()[metadata.possibleLengths().length - 1];\n} // If the phone number being input is an international one\n// then tries to derive the country from the phone number.\n// (regardless of whether there's any country currently selected)\n\n/**\r\n * @param {string} parsedInput - A possibly incomplete E.164 phone number.\r\n * @param {string?} country - Currently selected country.\r\n * @param {string[]?} countries - A list of available countries. If not passed then \"all countries\" are assumed.\r\n * @param {boolean} includeInternationalOption - Whether \"International\" country option is available.\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @return {string?}\r\n */\n\n\nexport function getCountryForPartialE164Number(partialE164Number, country, countries, includeInternationalOption, metadata) {\n if (partialE164Number === '+') {\n // Don't change the currently selected country yet.\n return country;\n }\n\n var derived_country = get_country_from_possibly_incomplete_international_phone_number(partialE164Number, metadata); // If a phone number is being input in international form\n // and the country can already be derived from it,\n // then select that country.\n\n if (derived_country && (!countries || countries.indexOf(derived_country) >= 0)) {\n return derived_country;\n } // If \"International\" country option has not been disabled\n // and the international phone number entered doesn't correspond\n // to the currently selected country then reset the currently selected country.\n else if (country && includeInternationalOption && !could_number_belong_to_country(partialE164Number, country, metadata)) {\n return undefined;\n } // Don't change the currently selected country.\n\n\n return country;\n}\n/**\r\n * Parses `<input/>` value. Derives `country` from `input`. Derives an E.164 `value`.\r\n * @param {string?} input — Parsed `<input/>` value. Examples: `\"\"`, `\"+\"`, `\"+123\"`, `\"123\"`.\r\n * @param {string?} prevInput — Previous parsed `<input/>` value. Examples: `\"\"`, `\"+\"`, `\"+123\"`, `\"123\"`.\r\n * @param {string?} country - Currently selected country.\r\n * @param {string[]?} countries - A list of available countries. If not passed then \"all countries\" are assumed.\r\n * @param {boolean} includeInternationalOption - Whether \"International\" country option is available.\r\n * @param {boolean} international - Set to `true` to force international phone number format (leading `+`).\r\n * @param {boolean} limitMaxLength — Whether to enable limiting phone number max length.\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @return {object} An object of shape `{ input, country, value }`.\r\n */\n\nexport function parseInput(input, prevInput, country, defaultCountry, countries, includeInternationalOption, international, limitMaxLength, metadata) {\n // Trim the input to not exceed the maximum possible number length.\n if (input && country && limitMaxLength) {\n input = trimNumber(input, country, metadata);\n } // If this `onChange()` event was triggered\n // as a result of selecting \"International\" country\n // then force-prepend a `+` sign if the phone number\n // `<input/>` value isn't in international format.\n // Also, force-prepend a `+` sign if international\n // phone number input format is set.\n\n\n if (input && input[0] !== '+' && (!country || international)) {\n input = '+' + input;\n } // If the previously entered phone number\n // has been entered in international format\n // and the user decides to erase it,\n // then also reset the `country`\n // because it was most likely automatically selected\n // while the user was typing in the phone number\n // in international format.\n // This fixes the issue when a user is presented\n // with a phone number input with no country selected\n // and then types in their local phone number\n // then discovers that the input's messed up\n // (a `+` has been prepended at the start of their input\n // and a random country has been selected),\n // decides to undo it all by erasing everything\n // and then types in their local phone number again\n // resulting in a seemingly correct phone number\n // but in reality that phone number has incorrect country.\n // https://github.com/catamphetamine/react-phone-number-input/issues/273\n\n\n if (!input && prevInput && prevInput[0] === '+') {\n if (international) {\n country = undefined;\n } else {\n country = defaultCountry;\n }\n } // Also resets such \"randomly\" selected country\n // as soon as the user erases the number\n // digit-by-digit up to the leading `+` sign.\n\n\n if (input === '+' && prevInput && prevInput[0] === '+' && prevInput.length > '+'.length) {\n country = undefined;\n } // Generate the new `value` property.\n\n\n var value;\n\n if (input) {\n if (input[0] === '+') {\n if (input !== '+') {\n value = input;\n }\n } else {\n value = e164(input, country, metadata);\n }\n } // Derive the country from the phone number.\n // (regardless of whether there's any country currently selected)\n\n\n if (value) {\n country = getCountryForPartialE164Number(value, country, countries, includeInternationalOption, metadata);\n }\n\n return {\n input: input,\n country: country,\n value: value\n };\n}\n/**\r\n * Determines the country for a given (possibly incomplete) E.164 phone number.\r\n * @param {string} number - A possibly incomplete E.164 phone number.\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @return {string?}\r\n */\n\nexport function get_country_from_possibly_incomplete_international_phone_number(number, metadata) {\n var formatter = new AsYouType(null, metadata);\n formatter.input(number); // // `001` is a special \"non-geograpical entity\" code\n // // in Google's `libphonenumber` library.\n // if (formatter.country === '001') {\n // \treturn\n // }\n\n return formatter.country;\n}\n/**\r\n * Compares two strings.\r\n * A helper for `Array.sort()`.\r\n */\n\nexport function compare_strings(a, b) {\n // Use `String.localeCompare` if it's available.\n // https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare\n // Which means everyone except IE <= 10 and Safari <= 10.\n // `localeCompare()` is available in latest Node.js versions.\n\n /* istanbul ignore else */\n if (String.prototype.localeCompare) {\n return a.localeCompare(b);\n }\n /* istanbul ignore next */\n\n\n return a < b ? -1 : a > b ? 1 : 0;\n}\n/**\r\n * Strips `+${countryCallingCode}` prefix from an E.164 phone number.\r\n * @param {string} number - (possibly incomplete) E.164 phone number.\r\n * @param {string?} country - A possible country for this phone number.\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @return {string}\r\n */\n\nexport function strip_country_calling_code(number, country, metadata) {\n // Just an optimization, so that it\n // doesn't have to iterate through all country calling codes.\n if (country) {\n var country_calling_prefix = '+' + getCountryCallingCode(country, metadata); // If `country` fits the actual `number`.\n\n if (number.length < country_calling_prefix.length) {\n if (country_calling_prefix.indexOf(number) === 0) {\n return '';\n }\n } else {\n if (number.indexOf(country_calling_prefix) === 0) {\n return number.slice(country_calling_prefix.length);\n }\n }\n } // If `country` doesn't fit the actual `number`.\n // Try all available country calling codes.\n\n\n for (var _i = 0, _Object$keys = Object.keys(metadata.country_calling_codes); _i < _Object$keys.length; _i++) {\n var country_calling_code = _Object$keys[_i];\n\n if (number.indexOf(country_calling_code) === '+'.length) {\n return number.slice('+'.length + country_calling_code.length);\n }\n }\n\n return '';\n}\n/**\r\n * Parses a partially entered national phone number digits\r\n * (or a partially entered E.164 international phone number)\r\n * and returns the national significant number part.\r\n * National significant number returned doesn't come with a national prefix.\r\n * @param {string} number - National number digits. Or possibly incomplete E.164 phone number.\r\n * @param {string?} country\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @return {string} [result]\r\n */\n\nexport function getNationalSignificantNumberDigits(number, country, metadata) {\n // Create \"as you type\" formatter.\n var formatter = new AsYouType(country, metadata); // Input partial national phone number.\n\n formatter.input(number); // Return the parsed partial national phone number.\n\n var phoneNumber = formatter.getNumber();\n return phoneNumber && phoneNumber.nationalNumber;\n}\n/**\r\n * Checks if a partially entered E.164 phone number could belong to a country.\r\n * @param {string} number\r\n * @param {string} country\r\n * @return {boolean}\r\n */\n\nexport function could_number_belong_to_country(number, country, metadata) {\n var country_calling_code = getCountryCallingCode(country, metadata);\n var i = 0;\n\n while (i + 1 < number.length && i < country_calling_code.length) {\n if (number[i + 1] !== country_calling_code[i]) {\n return false;\n }\n\n i++;\n }\n\n return true;\n}\nexport function getInitialParsedInput(value, country, international, metadata) {\n // If `international` property is `true`,\n // then always show country calling code in the input field.\n if (!value && international && country) {\n return \"+\".concat(getCountryCallingCode(country, metadata));\n }\n\n return value;\n}\n//# sourceMappingURL=phoneInputHelpers.js.map","function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport InputSmart from './InputSmart';\nimport InputBasic from './InputBasic';\nimport Flag from './Flag';\nimport InternationalIcon from './InternationalIcon';\nimport { sortCountryOptions, isCountrySupportedWithError, getSupportedCountries, getSupportedCountryOptions, getCountries } from './countries';\nimport { createCountryIconComponent } from './CountryIcon';\nimport { metadata as metadataPropType, labels as labelsPropType } from './PropTypes';\nimport { getPreSelectedCountry, getCountrySelectOptions, parsePhoneNumber, generateNationalNumberDigits, migrateParsedInputForNewCountry, getCountryForPartialE164Number, getInitialParsedInput, parseInput, e164 } from './phoneInputHelpers';\n\nvar PhoneNumberInput_ =\n/*#__PURE__*/\nfunction (_React$PureComponent) {\n _inherits(PhoneNumberInput_, _React$PureComponent);\n\n function PhoneNumberInput_(props) {\n var _this;\n\n _classCallCheck(this, PhoneNumberInput_);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(PhoneNumberInput_).call(this, props));\n\n _defineProperty(_assertThisInitialized(_this), \"inputRef\", React.createRef());\n\n _defineProperty(_assertThisInitialized(_this), \"isCountrySupportedWithError\", function (country) {\n var metadata = _this.props.metadata;\n return isCountrySupportedWithError(country, metadata);\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onCountryChange\", function (newCountry) {\n var _this$props = _this.props,\n international = _this$props.international,\n metadata = _this$props.metadata,\n onChange = _this$props.onChange;\n var _this$state = _this.state,\n prevParsedInput = _this$state.parsedInput,\n prevCountry = _this$state.country; // After the new `country` has been selected,\n // if the phone number `<input/>` holds any digits\n // then migrate those digits for the new `country`.\n\n var newParsedInput = migrateParsedInputForNewCountry(prevParsedInput, prevCountry, newCountry, metadata, // Convert the phone number to \"national\" format\n // when the user changes the selected country by hand.\n international ? false : true);\n var newValue = e164(newParsedInput, newCountry, metadata); // Focus phone number `<input/>` upon country selection.\n\n _this.getInputRef().current.focus(); // If the user has already manually selected a country\n // then don't override that already selected country\n // if the `defaultCountry` property changes.\n // That's what `hasUserSelectedACountry` flag is for.\n\n\n _this.setState({\n country: newCountry,\n hasUserSelectedACountry: true,\n parsedInput: newParsedInput,\n value: newValue\n }, function () {\n // Update the new `value` property.\n // Doing it after the `state` has been updated\n // because `onChange()` will trigger `getDerivedStateFromProps()`\n // with the new `value` which will be compared to `state.value` there.\n onChange(newValue);\n });\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onChange\", function (_input) {\n var _this$props2 = _this.props,\n defaultCountry = _this$props2.defaultCountry,\n onChange = _this$props2.onChange,\n addInternationalOption = _this$props2.addInternationalOption,\n international = _this$props2.international,\n limitMaxLength = _this$props2.limitMaxLength,\n metadata = _this$props2.metadata;\n\n var _parseInput = parseInput(_input, _this.state.parsedInput, _this.state.country, defaultCountry, _this.state.countries, addInternationalOption, international, limitMaxLength, metadata),\n input = _parseInput.input,\n country = _parseInput.country,\n value = _parseInput.value;\n\n _this.setState({\n parsedInput: input,\n value: value,\n country: country\n }, // Update the new `value` property.\n // Doing it after the `state` has been updated\n // because `onChange()` will trigger `getDerivedStateFromProps()`\n // with the new `value` which will be compared to `state.value` there.\n function () {\n return onChange(value);\n });\n });\n\n _defineProperty(_assertThisInitialized(_this), \"_onFocus\", function () {\n return _this.setState({\n isFocused: true\n });\n });\n\n _defineProperty(_assertThisInitialized(_this), \"_onBlur\", function () {\n return _this.setState({\n isFocused: false\n });\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onFocus\", function (event) {\n _this._onFocus();\n\n var onFocus = _this.props.onFocus;\n\n if (onFocus) {\n onFocus(event);\n }\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onBlur\", function (event) {\n var onBlur = _this.props.onBlur;\n\n _this._onBlur();\n\n if (onBlur) {\n onBlur(event);\n }\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onCountryFocus\", function (event) {\n _this._onFocus(); // this.setState({ countrySelectFocused: true })\n\n\n var countrySelectProps = _this.props.countrySelectProps;\n\n if (countrySelectProps) {\n var onFocus = countrySelectProps.onFocus;\n\n if (onFocus) {\n onFocus(event);\n }\n }\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onCountryBlur\", function (event) {\n _this._onBlur(); // this.setState({ countrySelectFocused: false })\n\n\n var countrySelectProps = _this.props.countrySelectProps;\n\n if (countrySelectProps) {\n var onBlur = countrySelectProps.onBlur;\n\n if (onBlur) {\n onBlur(event);\n }\n }\n });\n\n var _this$props3 = _this.props,\n _value = _this$props3.value,\n labels = _this$props3.labels,\n _addInternationalOption = _this$props3.addInternationalOption,\n _metadata = _this$props3.metadata,\n countryOptionsOrder = _this$props3.countryOptionsOrder;\n var _this$props4 = _this.props,\n _defaultCountry = _this$props4.defaultCountry,\n countries = _this$props4.countries; // Validate `defaultCountry`.\n\n if (_defaultCountry) {\n if (!_this.isCountrySupportedWithError(_defaultCountry)) {\n _defaultCountry = undefined;\n }\n } // Validate `countries`.\n\n\n countries = getSupportedCountries(countries, _metadata);\n var phoneNumber = parsePhoneNumber(_value, _metadata);\n _this.CountryIcon = createCountryIconComponent(_this.props);\n _this.state = {\n // Workaround for `this.props` inside `getDerivedStateFromProps()`.\n props: _this.props,\n // The country selected.\n country: getPreSelectedCountry(phoneNumber, _defaultCountry, countries || getCountries(_metadata), _addInternationalOption, _metadata),\n // `countries` are stored in `this.state` because they're filtered.\n // For example, a developer might theoretically pass some unsupported\n // countries as part of the `countries` property, and because of that\n // the component uses `this.state.countries` (which are filtered)\n // instead of `this.props.countries`\n // (which could potentially contain unsupported countries).\n countries: countries,\n // `parsedInput` state property holds non-formatted user's input.\n // The reason is that there's no way of finding out\n // in which form should `value` be displayed: international or national.\n // E.g. if `value` is `+78005553535` then it could be input\n // by a user both as `8 (800) 555-35-35` and `+7 800 555 35 35`.\n // Hence storing just `value`is not sufficient for correct formatting.\n // E.g. if a user entered `8 (800) 555-35-35`\n // then value is `+78005553535` and `parsedInput` is `88005553535`\n // and if a user entered `+7 800 555 35 35`\n // then value is `+78005553535` and `parsedInput` is `+78005553535`.\n parsedInput: generateInitialParsedInput(_value, phoneNumber, _this.props),\n // `value` property is duplicated in state.\n // The reason is that `getDerivedStateFromProps()`\n // needs this `value` to compare to the new `value` property\n // to find out if `parsedInput` needs updating:\n // If the `value` property was changed externally\n // then it won't be equal to `state.value`\n // in which case `parsedInput` and `country` should be updated.\n value: _value\n };\n return _this;\n }\n\n _createClass(PhoneNumberInput_, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n var onCountryChange = this.props.onCountryChange;\n var defaultCountry = this.props.defaultCountry;\n var selectedCountry = this.state.country;\n\n if (onCountryChange) {\n if (defaultCountry) {\n if (!this.isCountrySupportedWithError(defaultCountry)) {\n defaultCountry = undefined;\n }\n }\n\n if (selectedCountry !== defaultCountry) {\n onCountryChange(selectedCountry);\n }\n }\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps, prevState) {\n var onCountryChange = this.props.onCountryChange;\n var country = this.state.country; // Call `onCountryChange` when user selects another country.\n\n if (onCountryChange && country !== prevState.country) {\n onCountryChange(country);\n }\n } // A shorthand for not passing `metadata` as a second argument.\n\n }, {\n key: \"getInputRef\",\n value: function getInputRef() {\n var inputRef = this.props.inputRef;\n return inputRef || this.inputRef;\n } // `state` holds previous props as `props`, and also:\n // * `country` — The currently selected country, e.g. `\"RU\"`.\n // * `value` — The currently entered phone number (E.164), e.g. `+78005553535`.\n // * `parsedInput` — The parsed `<input/>` value, e.g. `8005553535`.\n // (and a couple of other less significant properties)\n\n }, {\n key: \"render\",\n value: function render() {\n var _this$props5 = this.props,\n name = _this$props5.name,\n disabled = _this$props5.disabled,\n autoComplete = _this$props5.autoComplete,\n style = _this$props5.style,\n className = _this$props5.className,\n inputRef = _this$props5.inputRef,\n inputComponent = _this$props5.inputComponent,\n numberInputProps = _this$props5.numberInputProps,\n smartCaret = _this$props5.smartCaret,\n CountrySelectComponent = _this$props5.countrySelectComponent,\n countrySelectProps = _this$props5.countrySelectProps,\n ContainerComponent = _this$props5.containerComponent,\n defaultCountry = _this$props5.defaultCountry,\n countries = _this$props5.countries,\n countryOptionsOrder = _this$props5.countryOptionsOrder,\n labels = _this$props5.labels,\n flags = _this$props5.flags,\n flagComponent = _this$props5.flagComponent,\n flagUrl = _this$props5.flagUrl,\n addInternationalOption = _this$props5.addInternationalOption,\n internationalIcon = _this$props5.internationalIcon,\n displayInitialValueAsLocalNumber = _this$props5.displayInitialValueAsLocalNumber,\n onCountryChange = _this$props5.onCountryChange,\n limitMaxLength = _this$props5.limitMaxLength,\n reset = _this$props5.reset,\n metadata = _this$props5.metadata,\n international = _this$props5.international,\n rest = _objectWithoutProperties(_this$props5, [\"name\", \"disabled\", \"autoComplete\", \"style\", \"className\", \"inputRef\", \"inputComponent\", \"numberInputProps\", \"smartCaret\", \"countrySelectComponent\", \"countrySelectProps\", \"containerComponent\", \"defaultCountry\", \"countries\", \"countryOptionsOrder\", \"labels\", \"flags\", \"flagComponent\", \"flagUrl\", \"addInternationalOption\", \"internationalIcon\", \"displayInitialValueAsLocalNumber\", \"onCountryChange\", \"limitMaxLength\", \"reset\", \"metadata\", \"international\"]);\n\n var _this$state2 = this.state,\n country = _this$state2.country,\n parsedInput = _this$state2.parsedInput,\n isFocused = _this$state2.isFocused;\n var InputComponent = smartCaret ? InputSmart : InputBasic;\n var countrySelectOptions = useMemoCountrySelectOptions(function () {\n return sortCountryOptions(getCountrySelectOptions(countries || getCountries(metadata), labels, addInternationalOption), getSupportedCountryOptions(countryOptionsOrder, metadata));\n }, [countries, countryOptionsOrder, addInternationalOption, labels, metadata]);\n return React.createElement(ContainerComponent, {\n style: style,\n className: classNames(className, 'PhoneInput', {\n 'PhoneInput--focus': isFocused\n })\n }, React.createElement(CountrySelectComponent, _extends({\n name: name ? \"\".concat(name, \"Country\") : undefined,\n \"aria-label\": labels.country\n }, countrySelectProps, {\n value: country,\n options: countrySelectOptions,\n onChange: this.onCountryChange,\n onFocus: this.onCountryFocus,\n onBlur: this.onCountryBlur,\n disabled: disabled || countrySelectProps && countrySelectProps.disabled,\n iconComponent: this.CountryIcon\n })), React.createElement(InputComponent, _extends({\n ref: this.getInputRef(),\n type: \"tel\",\n autoComplete: autoComplete\n }, numberInputProps, rest, {\n name: name,\n metadata: metadata,\n country: country,\n value: parsedInput || '',\n onChange: this.onChange,\n onFocus: this.onFocus,\n onBlur: this.onBlur,\n disabled: disabled,\n inputComponent: inputComponent,\n className: classNames('PhoneInputInput', numberInputProps && numberInputProps.className, rest.className)\n })));\n }\n }], [{\n key: \"getDerivedStateFromProps\",\n value: function getDerivedStateFromProps(props, state) {\n var country = state.country,\n hasUserSelectedACountry = state.hasUserSelectedACountry,\n value = state.value,\n _state$props = state.props,\n prevDefaultCountry = _state$props.defaultCountry,\n prevValue = _state$props.value,\n prevReset = _state$props.reset;\n var metadata = props.metadata,\n countries = props.countries,\n newDefaultCountry = props.defaultCountry,\n newValue = props.value,\n newReset = props.reset,\n international = props.international;\n var newState = {\n // Emulate `prevProps` via `state.props`.\n props: props,\n // If the user has already manually selected a country\n // then don't override that already selected country\n // if the `defaultCountry` property changes.\n // That's what `hasUserSelectedACountry` flag is for.\n hasUserSelectedACountry: hasUserSelectedACountry\n }; // Some users requested a way to reset the component\n // (both number `<input/>` and country `<select/>`).\n // Whenever `reset` property changes both number `<input/>`\n // and country `<select/>` are reset.\n // It's not implemented as some instance `.reset()` method\n // because `ref` is forwarded to `<input/>`.\n // It's also not replaced with just resetting `country` on\n // external `value` reset, because a user could select a country\n // and then not input any `value`, and so the selected country\n // would be \"stuck\", if not using this `reset` property.\n // https://github.com/catamphetamine/react-phone-number-input/issues/300\n\n if (newReset !== prevReset) {\n return _objectSpread({}, newState, {\n parsedInput: undefined,\n value: undefined,\n country: newDefaultCountry,\n hasUserSelectedACountry: undefined\n });\n } // If the default country changed.\n // (e.g. in case of ajax GeoIP detection after page loaded)\n // then select it but only if the user hasn't already manually\n // selected a country and no phone number has been entered so far.\n // Because if the user has already started inputting a phone number\n // then he's okay with no country being selected at all (\"International\")\n // and doesn't want to be disturbed, doesn't want his input to be screwed, etc.\n\n\n if (newDefaultCountry !== prevDefaultCountry && !hasUserSelectedACountry && (!value && !newValue || international && value === getInitialParsedInput(undefined, prevDefaultCountry, international, metadata) && value === getInitialParsedInput(undefined, newDefaultCountry, international, metadata))) {\n return _objectSpread({}, newState, {\n country: isCountrySupportedWithError(newDefaultCountry, metadata) ? newDefaultCountry : prevDefaultCountry,\n // If `parsedInput` is empty, then automatically select the new `country`\n // and set `parsedInput` to `+{getCountryCallingCode(newCountry)}`.\n parsedInput: generateInitialParsedInput(newValue, undefined, props) // `value` is `undefined`.\n // `parsedInput` is `undefined` because `value` is `undefined`.\n\n });\n } // If a new `value` is set externally.\n // (e.g. as a result of an ajax API request\n // to get user's phone after page loaded)\n // The first part — `newValue !== prevValue` —\n // is basically `props.value !== prevProps.value`\n // so it means \"if value property was changed externally\".\n // The second part — `newValue !== value` —\n // is for ignoring the `getDerivedStateFromProps()` call\n // which happens in `this.onChange()` right after `this.setState()`.\n // If this `getDerivedStateFromProps()` call isn't ignored\n // then the country flag would reset on each input.\n else if (newValue !== prevValue && newValue !== value) {\n var phoneNumber = parsePhoneNumber(newValue, metadata);\n var parsedCountry;\n\n if (phoneNumber) {\n var _countries = getSupportedCountries(props.countries, metadata);\n\n if (!_countries || _countries.indexOf(phoneNumber.country) >= 0) {\n parsedCountry = phoneNumber.country;\n }\n }\n\n if (!newValue) {\n newState.hasUserSelectedACountry = undefined;\n }\n\n return _objectSpread({}, newState, {\n parsedInput: generateInitialParsedInput(newValue, phoneNumber, props),\n value: newValue,\n country: newValue ? parsedCountry : newDefaultCountry\n });\n } // `defaultCountry` didn't change.\n // `value` didn't change.\n // `parsedInput` didn't change, because `value` didn't change.\n //\n // So no need to update state here really.\n // Could as well return `null` explicitly\n // to indicate that the `state` hasn't changed.\n // But just in case, returns `newState`.\n // (who knows if someone adds something\n // changing `newState` above in some future)\n\n\n return newState;\n }\n }]);\n\n return PhoneNumberInput_;\n}(React.PureComponent); // This wrapper is only to `.forwardRef()` to the `<input/>`.\n\n\nvar PhoneNumberInput = React.forwardRef(function (props, ref) {\n return React.createElement(PhoneNumberInput_, _extends({}, props, {\n inputRef: ref\n }));\n});\nPhoneNumberInput.propTypes = {\n /**\r\n * Phone number in `E.164` format.\r\n *\r\n * Example:\r\n *\r\n * `\"+12223333333\"`\r\n */\n value: PropTypes.string,\n\n /**\r\n * Updates the `value` as the user inputs the phone number.\r\n */\n onChange: PropTypes.func.isRequired,\n\n /**\r\n * Toggles the `--focus` CSS class.\r\n * @ignore\r\n */\n onFocus: PropTypes.func,\n\n /**\r\n * `onBlur` is usually passed by `redux-form`.\r\n * @ignore\r\n */\n onBlur: PropTypes.func,\n\n /**\r\n * `onKeyDown` handler (e.g. to handle Enter key press).\r\n * @ignore\r\n */\n onKeyDown: PropTypes.func,\n\n /**\r\n * Set to `true` to disable both the phone number `<input/>`\r\n * and the country `<select/>`.\r\n */\n disabled: PropTypes.bool,\n\n /**\r\n * Sets `autoComplete` property for phone number `<input/>`.\r\n *\r\n * Web browser's \"autocomplete\" feature\r\n * remembers the phone number being input\r\n * and can also autofill the `<input/>`\r\n * with previously remembered phone numbers.\r\n *\r\n * https://developers.google.com\r\n * /web/updates/2015/06/checkout-faster-with-autofill\r\n *\r\n * For example, can be used to turn it off:\r\n *\r\n * \"So when should you use `autocomplete=\"off\"`?\r\n * One example is when you've implemented your own version\r\n * of autocomplete for search. Another example is any form field\r\n * where users will input and submit different kinds of information\r\n * where it would not be useful to have the browser remember\r\n * what was submitted previously\".\r\n */\n // (is `\"tel\"` by default)\n autoComplete: PropTypes.string.isRequired,\n\n /**\r\n * Set to `true` to show the initial `value` in\r\n * \"national\" format rather than \"international\".\r\n *\r\n * For example, if this flag is set to `true`\r\n * and the initial `value=\"+12133734253\"` is passed\r\n * then the `<input/>` value will be `\"(213) 373-4253\"`.\r\n *\r\n * By default, this flag is set to `false`,\r\n * meaning that if the initial `value=\"+12133734253\"` is passed\r\n * then the `<input/>` value will be `\"+1 213 373 4253\"`.\r\n *\r\n * The reason for such default behaviour is that\r\n * the newer generation grows up when there are no stationary phones\r\n * and therefore everyone inputs phone numbers in international format\r\n * in their smartphones so people gradually get more accustomed to\r\n * writing phone numbers in international format rather than in local format.\r\n * Future people won't be using \"national\" format, only \"international\".\r\n */\n // (is `false` by default)\n displayInitialValueAsLocalNumber: PropTypes.bool.isRequired,\n\n /**\r\n * The country to be selected by default.\r\n * For example, can be set after a GeoIP lookup.\r\n *\r\n * Example: `\"US\"`.\r\n */\n // A two-letter country code (\"ISO 3166-1 alpha-2\").\n defaultCountry: PropTypes.string,\n\n /**\r\n * If specified, only these countries will be available for selection.\r\n *\r\n * Example:\r\n *\r\n * `[\"RU\", \"UA\", \"KZ\"]`\r\n */\n countries: PropTypes.arrayOf(PropTypes.string),\n\n /**\r\n * Custom country `<select/>` option names.\r\n * Also some labels like \"ext\" and country `<select/>` `aria-label`.\r\n *\r\n * Example:\r\n *\r\n * `{ \"ZZ\": \"Международный\", RU: \"Россия\", US: \"США\", ... }`\r\n *\r\n * See the `locales` directory for examples.\r\n */\n labels: labelsPropType.isRequired,\n\n /**\r\n * A URL template of a country flag, where\r\n * \"{XX}\" is a two-letter country code in upper case,\r\n * or where \"{xx}\" is a two-letter country code in lower case.\r\n * By default it points to `country-flag-icons` gitlab pages website.\r\n * I imagine someone might want to download those country flag icons\r\n * and host them on their own servers instead\r\n * (all flags are available in the `country-flag-icons` library).\r\n * There's a catch though: new countries may be added in future,\r\n * so when hosting country flag icons on your own server\r\n * one should check the `CHANGELOG.md` every time before updating this library,\r\n * otherwise there's a possibility that some new country flag would be missing.\r\n */\n flagUrl: PropTypes.string.isRequired,\n\n /**\r\n * Custom country flag icon components.\r\n * These flags will be used instead of the default ones.\r\n * The the \"Flags\" section of the readme for more info.\r\n *\r\n * The shape is an object where keys are country codes\r\n * and values are flag icon components.\r\n * Flag icon components receive the same properties\r\n * as `flagComponent` (see below).\r\n *\r\n * Example:\r\n *\r\n * `{ \"RU\": (props) => <img src=\"...\"/> }`\r\n *\r\n * Example:\r\n *\r\n * `import flags from 'country-flag-icons/react/3x2'`\r\n *\r\n * `import PhoneInput from 'react-phone-number-input'`\r\n *\r\n * `<PhoneInput flags={flags} .../>`\r\n */\n flags: PropTypes.objectOf(PropTypes.elementType),\n\n /**\r\n * Country flag icon component.\r\n *\r\n * Takes properties:\r\n *\r\n * * `country: string` — The country code.\r\n * * `countryName: string` — The country name.\r\n * * `flagUrl: string` — The `flagUrl` property (see above).\r\n * * `flags: object` — The `flags` property (see above).\r\n */\n flagComponent: PropTypes.elementType.isRequired,\n\n /**\r\n * Set to `false` to remove the \"International\" option from country `<select/>`.\r\n */\n addInternationalOption: PropTypes.bool.isRequired,\n\n /**\r\n * \"International\" icon component.\r\n * Should have the same aspect ratio.\r\n *\r\n * Receives properties:\r\n *\r\n * * `title: string` — \"International\" country option label.\r\n */\n internationalIcon: PropTypes.elementType.isRequired,\n\n /**\r\n * Can be used to place some countries on top of the list of country `<select/>` options.\r\n *\r\n * * `\"|\"` — inserts a separator.\r\n * * `\"...\"` — means \"the rest of the countries\" (can be omitted, in which case it will automatically be added at the end).\r\n *\r\n * Example:\r\n *\r\n * `[\"US\", \"CA\", \"AU\", \"|\", \"...\"]`\r\n */\n countryOptionsOrder: PropTypes.arrayOf(PropTypes.string),\n\n /**\r\n * `<Phone/>` component CSS style object.\r\n */\n style: PropTypes.object,\n\n /**\r\n * `<Phone/>` component CSS class.\r\n */\n className: PropTypes.string,\n\n /**\r\n * Country `<select/>` component.\r\n *\r\n * Receives properties:\r\n *\r\n * * `name: string?` — HTML `name` attribute.\r\n * * `value: string?` — The currently selected country code.\r\n * * `onChange(value: string?)` — Updates the `value`.\r\n * * `onFocus()` — Is used to toggle the `--focus` CSS class.\r\n * * `onBlur()` — Is used to toggle the `--focus` CSS class.\r\n * * `options: object[]` — The list of all selectable countries (including \"International\") each being an object of shape `{ value: string?, label: string }`.\r\n * * `iconComponent: PropTypes.elementType` — React component that renders a country icon: `<Icon country={value}/>`. If `country` is `undefined` then it renders an \"International\" icon.\r\n * * `disabled: boolean?` — HTML `disabled` attribute.\r\n * * `tabIndex: (number|string)?` — HTML `tabIndex` attribute.\r\n * * `className: string` — CSS class name.\r\n */\n countrySelectComponent: PropTypes.elementType.isRequired,\n\n /**\r\n * Country `<select/>` component props.\r\n * Along with the usual DOM properties such as `aria-label` and `tabIndex`,\r\n * some custom properties are supported, such as `arrowComponent` and `unicodeFlags`.\r\n */\n countrySelectProps: PropTypes.object,\n\n /**\r\n * Phone number `<input/>` component.\r\n *\r\n * Receives properties:\r\n *\r\n * * `value: string` — The formatted `value`.\r\n * * `onChange(event: Event)` — Updates the formatted `value` from `event.target.value`.\r\n * * `onFocus()` — Is used to toggle the `--focus` CSS class.\r\n * * `onBlur()` — Is used to toggle the `--focus` CSS class.\r\n * * Other properties like `type=\"tel\"` or `autoComplete=\"tel\"` that should be passed through to the DOM `<input/>`.\r\n *\r\n * Must also either use `React.forwardRef()` to \"forward\" `ref` to the `<input/>` or implement `.focus()` method.\r\n */\n inputComponent: PropTypes.elementType.isRequired,\n\n /**\r\n * Wrapping `<div/>` component.\r\n *\r\n * Receives properties:\r\n *\r\n * * `style: object` — A component CSS style object.\r\n * * `className: string` — Classes to attach to the component, typically changes when component focuses or blurs.\r\n */\n containerComponent: PropTypes.elementType.isRequired,\n\n /**\r\n * Phone number `<input/>` component props.\r\n */\n numberInputProps: PropTypes.object,\n\n /**\r\n * By default, the caret position is being \"intelligently\" managed\r\n * while a user inputs a phone number.\r\n * This \"smart\" caret behavior can be turned off\r\n * by passing `smartCaret={false}` property.\r\n * This is just an \"escape hatch\" for any possible caret position issues.\r\n */\n // Is `true` by default.\n smartCaret: PropTypes.bool.isRequired,\n\n /**\r\n * Set to `true` to force \"international\" phone number format.\r\n */\n international: PropTypes.bool,\n\n /**\r\n * If set to `true`, the phone number input will get trimmed\r\n * if it exceeds the maximum length for the country.\r\n */\n limitMaxLength: PropTypes.bool.isRequired,\n\n /**\r\n * `libphonenumber-js` metadata.\r\n *\r\n * Can be used to pass custom `libphonenumber-js` metadata\r\n * to reduce the overall bundle size for those who compile \"custom\" metadata.\r\n */\n metadata: metadataPropType.isRequired,\n\n /**\r\n * Is called every time the selected country changes:\r\n * either programmatically or when user selects it manually from the list.\r\n */\n // People have been asking for a way to get the selected country.\n // @see https://github.com/catamphetamine/react-phone-number-input/issues/128\n // For some it's just a \"business requirement\".\n // I guess it's about gathering as much info on the user as a website can\n // without introducing any addional fields that would complicate the form\n // therefore reducing \"conversion\" (that's a marketing term).\n // Assuming that the phone number's country is the user's country\n // is not 100% correct but in most cases I guess it's valid.\n onCountryChange: PropTypes.func\n};\nPhoneNumberInput.defaultProps = {\n /**\r\n * Remember (and autofill) the value as a phone number.\r\n */\n autoComplete: 'tel',\n\n /**\r\n * Flag icon component.\r\n */\n flagComponent: Flag,\n\n /**\r\n * By default, uses icons from `country-flag-icons` gitlab pages website.\r\n */\n // Must be equal to `flagUrl` in `./CountryIcon.js`.\n flagUrl: 'https://catamphetamine.gitlab.io/country-flag-icons/3x2/{XX}.svg',\n\n /**\r\n * Default \"International\" country `<select/>` option icon.\r\n */\n internationalIcon: InternationalIcon,\n\n /**\r\n * Phone number `<input/>` component.\r\n */\n inputComponent: 'input',\n\n /**\r\n * Wrapping `<div/>` component.\r\n */\n containerComponent: 'div',\n\n /**\r\n * Some users requested a way to reset the component:\r\n * both number `<input/>` and country `<select/>`.\r\n * Whenever `reset` property changes both number `<input/>`\r\n * and country `<select/>` are reset.\r\n * It's not implemented as some instance `.reset()` method\r\n * because `ref` is forwarded to `<input/>`.\r\n * It's also not replaced with just resetting `country` on\r\n * external `value` reset, because a user could select a country\r\n * and then not input any `value`, and so the selected country\r\n * would be \"stuck\", if not using this `reset` property.\r\n */\n // https://github.com/catamphetamine/react-phone-number-input/issues/300\n reset: PropTypes.any,\n\n /**\r\n * Don't convert the initially passed phone number `value`\r\n * to a national phone number for its country.\r\n * The reason is that the newer generation grows up when\r\n * there are no stationary phones and therefore everyone inputs\r\n * phone numbers with a `+` in their smartphones\r\n * so phone numbers written in international form\r\n * are gradually being considered more natural than local ones.\r\n */\n displayInitialValueAsLocalNumber: false,\n\n /**\r\n * Set to `false` to use \"basic\" caret instead of the \"smart\" one.\r\n */\n smartCaret: true,\n\n /**\r\n * Whether to add the \"International\" option\r\n * to the list of countries.\r\n */\n addInternationalOption: true,\n\n /**\r\n * If set to `true` the phone number input will get trimmed\r\n * if it exceeds the maximum length for the country.\r\n */\n limitMaxLength: false\n};\nexport default PhoneNumberInput;\n/**\r\n * Gets initial `parsedInput` value.\r\n * @param {string} [value]\r\n * @param {PhoneNumber} [phoneNumber]\r\n * @param {boolean} [options.international]\r\n * @param {string} [options.defaultCountry]\r\n * @param {boolean} options.displayInitialValueAsLocalNumber\r\n * @param {object} options.metadata\r\n * @return {string} [parsedInput]\r\n */\n\nfunction generateInitialParsedInput(value, phoneNumber, _ref) {\n var international = _ref.international,\n defaultCountry = _ref.defaultCountry,\n metadata = _ref.metadata,\n displayInitialValueAsLocalNumber = _ref.displayInitialValueAsLocalNumber;\n\n // If the `value` (E.164 phone number)\n // belongs to the currently selected country\n // and `displayInitialValueAsLocalNumber` property is `true`\n // then convert `value` (E.164 phone number)\n // to a local phone number digits.\n // E.g. '+78005553535' -> '88005553535'.\n if (displayInitialValueAsLocalNumber && phoneNumber && phoneNumber.country) {\n return generateNationalNumberDigits(phoneNumber);\n }\n\n return getInitialParsedInput(value, defaultCountry, international, metadata);\n}\n\nvar countrySelectOptionsMemo;\nvar countrySelectOptionsMemoDependencies;\n\nfunction useMemoCountrySelectOptions(generator, dependencies) {\n if (!countrySelectOptionsMemoDependencies || !areEqualArrays(dependencies, countrySelectOptionsMemoDependencies)) {\n countrySelectOptionsMemo = generator();\n countrySelectOptionsMemoDependencies = dependencies;\n }\n\n return countrySelectOptionsMemo;\n}\n\nfunction areEqualArrays(a, b) {\n if (a.length !== b.length) {\n return false;\n }\n\n var i = 0;\n\n while (i < a.length) {\n if (a[i] !== b[i]) {\n return false;\n }\n\n i++;\n }\n\n return true;\n}\n//# sourceMappingURL=PhoneInputWithCountry.js.map","function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport { parsePhoneNumberFromString } from 'libphonenumber-js/core';\n/**\r\n * Formats a phone number.\r\n * Is a proxy for `libphonenumber-js`'s `.format()` function of a parsed `PhoneNumber`.\r\n * @param {string} value\r\n * @param {string} [format]\r\n * @param {object} metadata\r\n * @return {string}\r\n */\n\nexport default function formatPhoneNumber(value, format, metadata) {\n if (!metadata) {\n if (_typeof(format) === 'object') {\n metadata = format;\n format = 'NATIONAL';\n }\n }\n\n if (!value) {\n return '';\n }\n\n var phoneNumber = parsePhoneNumberFromString(value, metadata);\n\n if (!phoneNumber) {\n return '';\n } // Deprecated.\n // Legacy `format`s.\n\n\n switch (format) {\n case 'National':\n format = 'NATIONAL';\n break;\n\n case 'International':\n format = 'INTERNATIONAL';\n break;\n }\n\n return phoneNumber.format(format);\n}\nexport function formatPhoneNumberIntl(value, metadata) {\n return formatPhoneNumber(value, 'INTERNATIONAL', metadata);\n}\n//# sourceMappingURL=formatPhoneNumber.js.map","import { parsePhoneNumberFromString } from 'libphonenumber-js/core';\nexport default function isValidPhoneNumber(value, metadata) {\n if (!value) {\n return false;\n }\n\n var phoneNumber = parsePhoneNumberFromString(value, metadata);\n\n if (!phoneNumber) {\n return false;\n }\n\n return phoneNumber.isValid();\n}\n//# sourceMappingURL=isValidPhoneNumber.js.map","import { parsePhoneNumberFromString } from 'libphonenumber-js/core';\nexport default function isPossiblePhoneNumber(value, metadata) {\n if (!value) {\n return false;\n }\n\n var phoneNumber = parsePhoneNumberFromString(value, metadata);\n\n if (!phoneNumber) {\n return false;\n }\n\n return phoneNumber.isPossible();\n}\n//# sourceMappingURL=isPossiblePhoneNumber.js.map","/**\r\n * Creates Unicode flag from a two-letter ISO country code.\r\n * https://stackoverflow.com/questions/24050671/how-to-put-japan-flag-character-in-a-string\r\n * @param {string} country — A two-letter ISO country code (case-insensitive).\r\n * @return {string}\r\n */\nexport default function getCountryFlag(country) {\n return getRegionalIndicatorSymbol(country[0]) + getRegionalIndicatorSymbol(country[1]);\n}\n/**\r\n * Converts a letter to a Regional Indicator Symbol.\r\n * @param {string} letter\r\n * @return {string}\r\n */\n\nfunction getRegionalIndicatorSymbol(letter) {\n return String.fromCodePoint(0x1F1E6 - 65 + letter.toUpperCase().charCodeAt(0));\n}\n//# sourceMappingURL=unicode.js.map","function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport React, { useCallback, useMemo } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport getUnicodeFlagIcon from 'country-flag-icons/unicode';\nexport default function CountrySelect(_ref) {\n var value = _ref.value,\n onChange = _ref.onChange,\n options = _ref.options,\n rest = _objectWithoutProperties(_ref, [\"value\", \"onChange\", \"options\"]);\n\n var onChange_ = useCallback(function (event) {\n var value = event.target.value;\n onChange(value === 'ZZ' ? undefined : value);\n }, [onChange]);\n var selectedOption = useMemo(function () {\n return getSelectedOption(options, value);\n }, [options, value]); // \"ZZ\" means \"International\".\n // (HTML requires each `<option/>` have some string `value`).\n\n return React.createElement(\"select\", _extends({}, rest, {\n value: value || 'ZZ',\n onChange: onChange_\n }), options.map(function (_ref2) {\n var value = _ref2.value,\n label = _ref2.label,\n divider = _ref2.divider;\n return React.createElement(\"option\", {\n key: divider ? '|' : value || 'ZZ',\n value: divider ? '|' : value || 'ZZ',\n disabled: divider ? true : false,\n style: divider ? DIVIDER_STYLE : undefined\n }, label);\n }));\n}\nCountrySelect.propTypes = {\n /**\r\n * A two-letter country code.\r\n * Example: \"US\", \"RU\", etc.\r\n */\n value: PropTypes.string,\n\n /**\r\n * Updates the `value`.\r\n */\n onChange: PropTypes.func.isRequired,\n // `<select/>` options.\n options: PropTypes.arrayOf(PropTypes.shape({\n value: PropTypes.string,\n label: PropTypes.string,\n divider: PropTypes.bool\n })).isRequired\n};\nvar DIVIDER_STYLE = {\n fontSize: '1px',\n backgroundColor: 'currentColor',\n color: 'inherit'\n};\nexport function CountrySelectWithIcon(_ref3) {\n var value = _ref3.value,\n options = _ref3.options,\n className = _ref3.className,\n Icon = _ref3.iconComponent,\n getIconAspectRatio = _ref3.getIconAspectRatio,\n Arrow = _ref3.arrowComponent,\n unicodeFlags = _ref3.unicodeFlags,\n rest = _objectWithoutProperties(_ref3, [\"value\", \"options\", \"className\", \"iconComponent\", \"getIconAspectRatio\", \"arrowComponent\", \"unicodeFlags\"]);\n\n var selectedOption = useMemo(function () {\n return getSelectedOption(options, value);\n }, [options, value]);\n return React.createElement(\"div\", {\n className: \"PhoneInputCountry\"\n }, React.createElement(CountrySelect, _extends({}, rest, {\n value: value,\n options: options,\n className: classNames('PhoneInputCountrySelect', className)\n })), unicodeFlags && value && React.createElement(\"div\", {\n className: \"PhoneInputCountryIconUnicode\"\n }, getUnicodeFlagIcon(value)), !(unicodeFlags && value) && React.createElement(Icon, {\n country: value,\n label: selectedOption && selectedOption.label,\n aspectRatio: unicodeFlags ? 1 : undefined\n }), React.createElement(Arrow, null));\n}\nCountrySelectWithIcon.propTypes = {\n // Country flag component.\n iconComponent: PropTypes.elementType,\n // Select arrow component.\n arrowComponent: PropTypes.elementType.isRequired,\n // Set to `true` to render Unicode flag icons instead of SVG images.\n unicodeFlags: PropTypes.bool\n};\nCountrySelectWithIcon.defaultProps = {\n // Is \"International\" icon square?\n arrowComponent: function arrowComponent() {\n return React.createElement(\"div\", {\n className: \"PhoneInputCountrySelectArrow\"\n });\n }\n};\n\nfunction getSelectedOption(options, value) {\n for (var _iterator = options, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref4;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref4 = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref4 = _i.value;\n }\n\n var option = _ref4;\n\n if (!option.divider && option.value === value) {\n return option;\n }\n }\n}\n//# sourceMappingURL=CountrySelect.js.map","function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport labels from '../locale/en.json';\nimport { metadata as metadataPropType, labels as labelsPropType } from './PropTypes';\nimport PhoneInput from './PhoneInputWithCountry';\nimport { CountrySelectWithIcon as CountrySelect } from './CountrySelect';\nexport function createPhoneInput(defaultMetadata) {\n var PhoneInputDefault = React.forwardRef(function (props, ref) {\n return React.createElement(PhoneInput, _extends({\n ref: ref\n }, props));\n });\n PhoneInputDefault.propTypes = {\n metadata: metadataPropType.isRequired,\n labels: labelsPropType.isRequired,\n countrySelectComponent: PropTypes.elementType.isRequired\n };\n PhoneInputDefault.defaultProps = {\n metadata: defaultMetadata,\n labels: labels,\n countrySelectComponent: CountrySelect\n };\n return PhoneInputDefault;\n}\nexport default createPhoneInput();\n//# sourceMappingURL=PhoneInputWithCountryDefault.js.map","import metadata from 'libphonenumber-js/metadata.min.json'\r\n\r\nimport {\r\n\tparsePhoneNumber as _parsePhoneNumber,\r\n\tformatPhoneNumber as _formatPhoneNumber,\r\n\tformatPhoneNumberIntl as _formatPhoneNumberIntl,\r\n\tisValidPhoneNumber as _isValidPhoneNumber,\r\n\tisPossiblePhoneNumber as _isPossiblePhoneNumber,\r\n\tgetCountries as _getCountries,\r\n\tgetCountryCallingCode as _getCountryCallingCode\r\n} from '../core/index'\r\n\r\nimport { createPhoneInput } from '../modules/PhoneInputWithCountryDefault'\r\n\r\nfunction call(func, _arguments) {\r\n\tvar args = Array.prototype.slice.call(_arguments)\r\n\targs.push(metadata)\r\n\treturn func.apply(this, args)\r\n}\r\n\r\nexport default createPhoneInput(metadata)\r\n\r\nexport function parsePhoneNumber() {\r\n\treturn call(_parsePhoneNumber, arguments)\r\n}\r\n\r\nexport function formatPhoneNumber() {\r\n\treturn call(_formatPhoneNumber, arguments)\r\n}\r\n\r\nexport function formatPhoneNumberIntl() {\r\n\treturn call(_formatPhoneNumberIntl, arguments)\r\n}\r\n\r\nexport function isValidPhoneNumber() {\r\n\treturn call(_isValidPhoneNumber, arguments)\r\n}\r\n\r\nexport function isPossiblePhoneNumber() {\r\n\treturn call(_isPossiblePhoneNumber, arguments)\r\n}\r\n\r\nexport function getCountries() {\r\n\treturn call(_getCountries, arguments)\r\n}\r\n\r\nexport function getCountryCallingCode() {\r\n\treturn call(_getCountryCallingCode, arguments)\r\n}"],"names":["hasOwn","hasOwnProperty","classNames","classes","i","arguments","length","arg","argType","push","Array","isArray","apply","key","call","join","module","exports","window","count_occurences","symbol","string","count","_iterator","split","_isArray","_i","Symbol","iterator","_ref","next","done","value","template","placeholder","undefined","should_close_braces","text","characters_in_template","value_character_index","filled_in_template","character","retained_template","empty_placeholder","cut_before","dangling_braces","replace","close_braces","getSelection","element","selectionStart","selectionEnd","start","end","Keys","Backspace","Delete","setCaretPosition","caret_position","navigator","ANDROID_USER_AGENT_REG_EXP","test","userAgent","isAndroid","setSelectionRange","setTimeout","onKeyDown","event","input","_parse","_format","on_change","operation","keyCode","getOperation","preventDefault","selection","erase_selection","format_input_text","slice","_parse2","parse_character","focused_input_character_index","index","caret","parse","operation_applied","edit","formatted","formatter","template_formatter","found","possibly_last_input_character_index","format","_extends","Object","assign","target","source","prototype","this","_objectWithoutProperties","excluded","sourceKeys","keys","indexOf","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","propertyIsEnumerable","Input","ref","InputComponent","inputComponent","onChange","onCut","onPaste","rest","ownRef","useRef","_onChange","useCallback","current","_onPaste","_onCut","_onKeyDown","onInputKeyDown","React","createElement","isEmptyValue","forwardRef","propTypes","PropTypes","func","isRequired","elementType","type","defaultProps","ParseError","code","instance","Constructor","TypeError","_classCallCheck","name","constructor","message","stack","Error","create","MIN_LENGTH_FOR_NSN","MAX_LENGTH_FOR_NSN","MAX_LENGTH_COUNTRY_CODE","VALID_DIGITS","VALID_PUNCTUATION","concat","matchesEntirely","regular_expression","RegExp","a","b","pa","pb","na","Number","nb","isNaN","_typeof","obj","_defineProperties","props","descriptor","enumerable","configurable","writable","defineProperty","_createClass","protoProps","staticProps","V3","V4","Metadata","metadata","is_object","countries","type_of","validateMetadata","setVersion","filter","_","countryCode","v1","v2","v3","nonGeographic","nonGeographical","country","getCountryMetadata","callingCode","getCountryCodesForCallingCode","countryCodes","countryCallingCodes","selectNumberingPlan","hasCountry","numberingPlan","NumberingPlan","hasCallingCode","getNumberingPlanMetadata","getCountryCodeForCallingCode","IDDPrefix","defaultIDDPrefix","nationalNumberPattern","possibleLengths","formats","nationalPrefixForParsing","nationalPrefixTransformRule","leadingDigits","hasTypes","_type","ext","country_phone_code_to_countries","country_calling_codes","globalMetadataObject","_this","_getFormats","getDefaultCountryMetadataForRegion","map","Format","_getNationalPrefixFormattingRule","_nationalPrefixForParsing","nationalPrefix","_getNationalPrefixIsOptionalWhenFormatting","types","_type2","getType","Type","nationalPrefixFormattingRule","nationalPrefixIsOptionalWhenFormattingInNationalFormat","usesNationalPrefix","FIRST_GROUP_ONLY_PREFIX_PATTERN","getCountryCallingCode","countryCallingCode","isSupportedCountry","version","compare","v4","RFC3966_EXTN_PREFIX","CAPTURING_EXTN_DIGITS","create_extension_pattern","purpose","single_extension_characters","EXTN_PATTERNS_FOR_PARSING","EXTN_PATTERN","VALID_PHONE_NUMBER_PATTERN","isViablePhoneNumber","number","DIGITS","0","1","2","3","4","5","6","7","8","9","0","1","2","3","4","5","6","7","8","9","٠","١","٢","٣","٤","٥","٦","٧","٨","٩","۰","۱","۲","۳","۴","۵","۶","۷","۸","۹","parseDigit","parseDigits","result","digit","parseIncompletePhoneNumber","parsePhoneNumberCharacter","NON_FIXED_LINE_PHONE_TYPES","getNumberType","options","nationalNumber","phone","is_of_type","pattern","_NON_FIXED_LINE_PHONE","checkNumberLengthForType","type_info","possible_lengths","mobile_type","merged","sort","mergeArrays","actual_length","minimum_length","isPossibleNumber","isInternational","CAPTURING_DIGIT_PATTERN","SINGLE_IDD_PREFIX","stripIDDPrefix","countryMetadata","IDDPrefixPattern","search","matchedGroups","match","_slicedToArray","arr","_arrayWithHoles","_arr","_n","_d","_e","_s","err","_iterableToArrayLimit","_nonIterableRest","_defineProperty","DEFAULT_OPTIONS","formatExtension","formattedNumber","extension","formatNumber","ownKeys","sym","getOwnPropertyDescriptor","forEach","_objectSpread","chooseCountryByCountryCallingCode","addExtension","formatNationalNumber","_ref2","formatRFC3966","fromCountry","getIDDPrefix","humanReadable","formattedForSameCountryCallingCode","toCountryCallingCode","toCountryMetadata","fromCountryMetadata","formatIDDSameCountryCallingCodeNumber","FIRST_GROUP_PATTERN","formatNationalNumberUsingFormat","useInternationalSeparator","useNationalPrefixFormattingRule","internationalFormat","applyInternationalSeparatorStyle","formatAs","availableFormats","nationalNnumber","leadingDigitsPatterns","lastLeadingDigitsPattern","chooseFormatForNumber","local","trim","PhoneNumber","_metadata","isCountryCode","isNonGeographicCallingCode","isValidNumber","phoneNumber","MAX_INPUT_STRING_LENGTH","PHONE_NUMBER_START_PATTERN","AFTER_PHONE_NUMBER_END_PATTERN","defaultCountry","_parseInput","_part$split2","parseRFC3966","throwOnError","startsAt","extractFormattedPhoneNumber","withExtensionStripped","number_without_extension","matches","extractExtension","parseInput","formattedPhoneNumber","_parsePhoneNumber","defaultCallingCode","_extractCountryCallin","extractCountryCallingCode","_stripNationalPrefixA","stripNationalPrefixAndCarrierCodeFromCompleteNumber","carrierCode","exactCountry","findCountryCode","parsePhoneNumber","hasSelectedNumberingPlan","valid","extended","possible","stripNationalPrefixAndCarrierCode","prefixPattern","prefixMatch","exec","capturedGroupsCount","nationalPhoneNumber","possibleCountries","_findCountryCode","_stripNationalPrefixA2","numberWithoutIDD","_extractCountryCallin2","extractCountryCallingCodeFromInternationalNumberWithoutPlusSign","shorterNumber","_countryCallingCode","possibleShorterNumber","possibleShorterNationalNumber","parseNumber","normalizeArguments","args","_Array$prototype$slic2","arg_1","arg_2","arg_3","arg_4","isObject","parsePhoneNumberFromString","error","_normalizeArguments","parsePhoneNumberFromString_","LONGEST_DUMMY_PHONE_NUMBER","repeat","DIGIT_PLACEHOLDER_MATCHER","NATIONAL_PREFIX_SEPARATORS_PATTERN","ELIGIBLE_FORMAT_PATTERN","VALID_FORMATTED_PHONE_NUMBER_PART_PATTERN","VALID_PHONE_NUMBER","AFTER_PHONE_NUMBER_DIGITS_END_PATTERN","AsYouType","optionsOrDefaultCountry","reset","formattedOutput","international","internationalPrefix","digits","nationalNumberDigits","setCountry","chosenFormat","populatedNationalNumberTemplate","populatedNationalNumberTemplatePosition","initializePhoneNumberFormatsForCountry","matchingFormats","resetFormat","formattedDigits","extractFormattedDigits","getFullNumber","inputDigits","getNonFormattedNationalNumber","extractedNumber","hasPlus","startInternationalNumber","nextDigits","isCountryCallingCodeAmbiguous","determineTheCountry","previousNationalPrefix","extractNationalPrefix","matchFormats","formatNationalNumberWithNextDigits","attemptToFormatCompletePhoneNumber","previouslyChosenFormat","newlyChosenFormat","chooseFormat","formatNextNationalNumberDigits","reformatNationalNumber","createFormattingTemplate","leadingDigitsPatternIndex","nationalPrefixIsMandatoryWhenFormattingInNationalFormat","leadingDigitsPatternsCount","Math","min","leadingDigitsPattern","_iterator2","_isArray2","_i2","formattedNationalNumber","formattedNationalNumberWithNationalPrefix","getSeparatorAfterNationalPrefix","spacing","prefix","getInternationalPrefix","_extractCountryCallingCode","getTemplateForNumberFormatPattern","strictPattern","nationalNumberDummyDigits","includesNationalPrefix","numberFormat","getFormatFormat","numberFormatWithNationalPrefix","_iterator3","_isArray3","_i3","_ref3","cutAndStripNonPairedParens","getCountry","getNumber","isPossible","isValid","getNonFormattedTemplate","cutBeforeIndex","pop","cleared_string","_i4","_dangling_braces","stripNonPairedParens","times","getCountries","getInputValuePrefix","removeInputValuePrefix","defaultMetadata","InputSmart","getTemplate","bool","object","createInput","InputBasic","newValue","formatIncompletePhoneNumber","FlagComponent","countryName","flags","flagUrl","title","alt","role","src","toLowerCase","InternationalIcon","aspectRatio","InternationalIcon1x1","InternationalIcon3x2","xmlns","viewBox","className","stroke","fill","strokeWidth","strokeMiterlimit","strokeLinecap","d","x1","y1","x2","y2","isCountrySupportedWithError","console","getSupportedCountries","createCountryIconComponent","flagComponent","internationalIcon","CountryIcon","label","_aspectRatio","DefaultInternationalIcon","PhoneInputCountryIcon--square","PhoneInputCountryIcon--border","objectOf","Flag","shape","labels","getPreSelectedCountry","includeInternationalOption","getCountrySelectOptions","country_names","country_select_options","String","localeCompare","compare_strings","unshift","ZZ","migrateParsedInputForNewCountry","previous_country","new_country","preferNationalFormat","country_calling_prefix","_Object$keys","country_calling_code","strip_country_calling_code","defaultValue","e164","partial_national_significant_number","getNationalSignificantNumberDigits","trimNumber","nationalSignificantNumberPart","overflowDigitsCount","getMaxNumberLength","getCountryForPartialE164Number","partialE164Number","derived_country","get_country_from_possibly_incomplete_international_phone_number","could_number_belong_to_country","getInitialParsedInput","enumerableOnly","symbols","getOwnPropertyDescriptors","defineProperties","_getPrototypeOf","o","setPrototypeOf","getPrototypeOf","__proto__","_assertThisInitialized","self","ReferenceError","_setPrototypeOf","p","countrySelectOptionsMemo","countrySelectOptionsMemoDependencies","PhoneNumberInput_","_React$PureComponent","_possibleConstructorReturn","createRef","newCountry","_this$props","_this$state","state","newParsedInput","parsedInput","getInputRef","focus","setState","hasUserSelectedACountry","_input","_this$props2","addInternationalOption","limitMaxLength","prevInput","isFocused","_onFocus","onFocus","onBlur","_onBlur","countrySelectProps","_this$props3","_value","_addInternationalOption","_this$props4","countryOptionsOrder","_defaultCountry","generateInitialParsedInput","subClass","superClass","_inherits","_state$props","prevDefaultCountry","prevValue","prevReset","newDefaultCountry","newReset","newState","parsedCountry","_countries","onCountryChange","selectedCountry","prevProps","prevState","inputRef","generator","dependencies","_this$props5","disabled","autoComplete","style","numberInputProps","smartCaret","CountrySelectComponent","countrySelectComponent","ContainerComponent","containerComponent","displayInitialValueAsLocalNumber","_this$state2","countrySelectOptions","order","optionsOnTop","optionsOnBottom","appendTo","_loop","divider","option","splice","sortCountryOptions","countryOptions","getSupportedCountryOptions","areEqualArrays","PhoneInput--focus","aria-label","onCountryFocus","onCountryBlur","iconComponent","PureComponent","PhoneNumberInput","formatNational","generateNationalNumberDigits","formatPhoneNumber","formatPhoneNumberIntl","isValidPhoneNumber","isPossiblePhoneNumber","arrayOf","labelsPropType","metadataPropType","any","getRegionalIndicatorSymbol","letter","fromCodePoint","toUpperCase","charCodeAt","CountrySelect","onChange_","useMemo","getSelectedOption","DIVIDER_STYLE","fontSize","backgroundColor","color","CountrySelectWithIcon","Icon","Arrow","getIconAspectRatio","arrowComponent","unicodeFlags","selectedOption","getUnicodeFlagIcon","_ref4","createPhoneInput","PhoneInputDefault","PhoneInput","_arguments","_formatPhoneNumber","_formatPhoneNumberIntl","_getCountries","_getCountryCallingCode","_isPossiblePhoneNumber","_isValidPhoneNumber"],"mappings":";;;;;;CAOC,WAGA,IAAIA,EAAS,GAAGC,eAEhB,SAASC,IAGR,IAFA,IAAIC,EAAU,GAELC,EAAI,EAAGA,EAAIC,UAAUC,OAAQF,IAAK,CAC1C,IAAIG,EAAMF,UAAUD,GACpB,GAAKG,EAAL,CAEA,IAAIC,SAAiBD,EAErB,GAAgB,WAAZC,GAAoC,WAAZA,EAC3BL,EAAQM,KAAKF,QACP,GAAIG,MAAMC,QAAQJ,GACxBJ,EAAQM,KAAKP,EAAWU,MAAM,KAAML,SAC9B,GAAgB,WAAZC,EACV,IAAK,IAAIK,KAAON,EACXP,EAAOc,KAAKP,EAAKM,IAAQN,EAAIM,IAChCV,EAAQM,KAAKI,IAMjB,OAAOV,EAAQY,KAAK,KAGgBC,EAAOC,QAC3CD,UAAiBd,EAOjBgB,OAAOhB,WAAaA,EAtCtB,MCNO,SAASiB,EAAiBC,EAAQC,GACvC,IAAIC,EAAQ,EAQHC,EAAYF,EAAOG,MAAM,IAAKC,EAAWf,MAAMC,QAAQY,GAAYG,EAAK,EAAjF,IAAoFH,EAAYE,EAAWF,EAAYA,EAAUI,OAAOC,cAAe,CACrJ,IAAIC,EAEJ,GAAIJ,EAAU,CACZ,GAAIC,GAAMH,EAAUjB,OAAQ,MAC5BuB,EAAON,EAAUG,SACZ,CAEL,IADAA,EAAKH,EAAUO,QACRC,KAAM,MACbF,EAAOH,EAAGM,MAGIH,IAEET,GAChBE,IAIJ,OAAOA,ECfM,WAAUW,GACvB,IAAIC,EAAc7B,UAAUC,OAAS,QAAsB6B,IAAjB9B,UAAU,GAAmBA,UAA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