{"version":3,"sources":["webpack://libphonenumber/webpack/universalModuleDefinition","webpack://libphonenumber/webpack/bootstrap","webpack://libphonenumber/./es6/metadata.js","webpack://libphonenumber/./es6/common.js","webpack://libphonenumber/./es6/parse.js","webpack://libphonenumber/./es6/types.js","webpack://libphonenumber/./es6/RFC3966.js","webpack://libphonenumber/./es6/format.js","webpack://libphonenumber/./es6/IDD.js","webpack://libphonenumber/./es6/AsYouType.js","webpack://libphonenumber/./es6/getCountryCallingCode.js","webpack://libphonenumber/./es6/findPhoneNumbers.js","webpack://libphonenumber/./es6/validate.js","webpack://libphonenumber/./node_modules/semver-compare/index.js","webpack://libphonenumber/./index.es6.js"],"names":["root","factory","exports","module","define","amd","window","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","r","value","n","__esModule","object","property","prototype","hasOwnProperty","p","s","validateMetadata","getExtPrefix","country","metadata","Metadata","ext","_semverCompare","_typeof","Symbol","_typeof2","iterator","obj","constructor","_createClass","defineProperties","target","props","length","descriptor","writable","key","Constructor","protoProps","staticProps","_classCallCheck","instance","TypeError","V3","this","v1","version","v2","undefined","_semverCompare2","default","v3","countries","_country","country_metadata","hasCountry","Error","_this","formats","map","_","Format","nationalPrefix","types","_type","hasTypes","getType","Type","country_phone_code_to_countries","country_calling_codes","country_calling_code","countryCallingCodes","format","_format","nationalPrefixFormattingRule","nationalPrefixIsOptionalWhenFormatting","usesNationalPrefix","test","replace","type","possibleLengths","is_object","keys","join","type_of","parse_phone_number_digits","parse_national_number_and_country_calling_code","number","numberWithoutIDD","_IDD","stripIDDPrefix","MAX_LENGTH_COUNTRY_CODE","countryCallingCode","slice","matches_entirely","text","arguments","regular_expression","matched_groups","match","create_extension_pattern","purpose","single_extension_characters","RFC3966_EXTN_PREFIX","CAPTURING_EXTN_DIGITS","VALID_DIGITS","WHITESPACE","PLUS_CHARS","VALID_PUNCTUATION","LEADING_PLUS_CHARS_PATTERN","RegExp","MAX_LENGTH_FOR_NSN","DIGIT_MAPPINGS","0","1","2","3","4","5","6","7","8","9","0","1","2","3","4","5","6","7","8","9","٠","١","٢","٣","٤","٥","٦","٧","٨","٩","۰","۱","۲","۳","۴","۵","۶","۷","۸","۹","replacements","replaced","_iterator","split","_isArray","Array","isArray","_i","_ref","next","done","character","replacement","toUpperCase","drop_and_substitute_characters","arg_1","arg_2","arg_3","arg_4","_sort_out_arguments","options","_extends","defaultCountry","default_options","_metadata2","sort_out_arguments","_parse_input","indexOf","_RFC","parseRFC3966","extract_formatted_phone_number","is_viable_phone_number","with_extension_stripped","start","search","EXTN_PATTERN","number_without_extension","matches","strip_extension","parse_input","formatted_phone_number","_parse_phone_number","default_country","from_country","_parse_national_numbe","_common","find_country_code","chooseCountryByCountryCallingCode","_parse_national_numbe2","national_number","carrier_code","_strip_national_prefi","strip_national_prefix_and_carrier_code","potential_national_number","carrierCode","_types","check_number_length_for_type","nationalNumberPattern","parse_national_number","parse_phone_number","fromCountry","selectedCountry","extended","MIN_LENGTH_FOR_NSN","valid","result","phone","possible","is_international","is_possible_number","assign","source","MAX_INPUT_STRING_LENGTH","EXTN_PATTERNS_FOR_PARSING","MIN_LENGTH_PHONE_NUMBER_PATTERN","VALID_PHONE_NUMBER","VALID_PHONE_NUMBER_PATTERN","PHONE_NUMBER_START_PATTERN","AFTER_PHONE_NUMBER_END_PATTERN","starts_at","nationalPrefixForParsing","national_prefix_pattern","national_prefix_matcher","exec","national_significant_number","captured_groups_count","nationalPrefixTransformRule","national_phone_number","possible_countries","leadingDigits","_types2","_find_country_code","input","is_of_type","pattern","non_fixed_line_types","type_info","possible_lengths","test_number_length_for_type","mobile_type","merge_arrays","actual_length","minimum_length","_parse","_parse2","a","b","merged","_iterator2","_isArray2","_i2","_ref2","element","push","sort","part","_part$split","_part$split2","_slicedToArray","formatRFC3966","arr","_arr","_n","_d","_e","_s","err","sliceIterator","arg_5","format_type","defaultOptions","format_national_number","add_extension","formatExtension","IDDPrefix","getIDDPrefix","humanReadable","formattedForSameCountryCallingCode","formatIDDSameCountryCallingCodeNumber","format_national_number_using_format","choose_format_for_number","local_to_international_style","_metadata","extension","FIRST_GROUP_PATTERN","international","enforce_national_prefix","format_pattern_matcher","national_prefix_may_be_omitted","formatted_number","internationalFormat","format_as","available_formats","leadingDigitsPatterns","last_leading_digits_pattern","local","trim","toCountryCallingCode","toCountryMetadata","fromCountryMetadata","IDDPrefixPattern","matchedGroups","CAPTURING_DIGIT_PATTERN","SINGLE_IDD_PREFIX","countryMetadata","defaultIDDPrefix","close_dangling_braces","count_occurences","repeat","DUMMY_DIGIT_MATCHER","LONGEST_DUMMY_PHONE_NUMBER","DIGIT_PLACEHOLDER","DIGIT_PLACEHOLDER_MATCHER","DIGIT_PLACEHOLDER_MATCHER_GLOBAL","CHARACTER_CLASS_PATTERN","STANDALONE_DIGIT_PATTERN","ELIGIBLE_FORMAT_PATTERN","VALID_INCOMPLETE_PHONE_NUMBER","VALID_INCOMPLETE_PHONE_NUMBER_PATTERN","AsYouType","country_code","reset","extracted_number","process_input","current_output","parsed_input","reset_countriness","determine_the_country","extract_country_calling_code","initialize_phone_number_formats_for_this_country_calling_code","reset_format","previous_national_prefix","national_prefix","extract_national_prefix","matching_formats","should_format","format_as_non_formatted_number","match_formats_by_leading_digits","formatted_national_phone_number","format_national_phone_number","full_phone_number","template","next_digits","national_number_formatted_with_previous_format","chosen_format","format_next_national_number_digits","attempt_to_format_complete_phone_number","choose_another_format","reformat_national_number","reset_country","partially_populated_template","last_match_position","filter","leading_digits","index_of_leading_digits_pattern","leading_digits_pattern_count","leading_digits_pattern_index","Math","min","leading_digits_pattern","is_format_applicable","create_formatting_template","full_number","formatted_national_number","national_number_rule","nationalPrefixIsMandatoryWhenFormatting","get_template_for_phone_number_format_pattern","number_pattern","dummy_phone_number_matching_format_pattern","number_format","get_format_format","strict_pattern","national_number_dummy_digits","digits","_iterator3","_isArray3","_i3","_ref3","digit","cut_before","retained_template","dangling_braces","symbol","string","count","_iterator4","_isArray4","_i4","_ref4","times","PhoneNumberSearch","phones","hasNext","searchPhoneNumbers","_sort_out_arguments2","_defineProperty","WHITESPACE_IN_THE_BEGINNING_PATTERN","WHITESPACE_IN_THE_END_PATTERN","state","regexp","startsAt","index","endsAt","find","last_match","pa","pb","na","Number","nb","isNaN","parseNumber","parameters","_metadataMin2","apply","parse","formatNumber","_format2","getNumberType","isValidNumber","_validate2","findPhoneNumbers","_findPhoneNumbers2","_findPhoneNumbers","_validate","_getCountryCallingCode","_AsYouType","getCountryCallingCode","getPhoneCode","getPhoneCodeCustom","_getCountryCallingCode2","_AsYouType2","create"],"mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,eAAAC,IACAD,OAAA,oBAAAH,GACA,iBAAAC,QACAA,QAAA,eAAAD,IAEAD,EAAA,eAAAC,IARA,CASCK,OAAA,WACD,mBCTA,IAAAC,KAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAP,QAGA,IAAAC,EAAAI,EAAAE,IACAC,EAAAD,EACAE,GAAA,EACAT,YAUA,OANAU,EAAAH,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAQ,GAAA,EAGAR,EAAAD,QA2CA,OAtCAM,EAAAM,EAAAF,EAGAJ,EAAAO,EAAAR,EAGAC,EAAAQ,EAAA,SAAAd,EAAAe,EAAAC,GACAV,EAAAW,EAAAjB,EAAAe,IACAG,OAAAC,eAAAnB,EAAAe,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAV,EAAAiB,EAAA,SAAAvB,GACAkB,OAAAC,eAAAnB,EAAA,cAAiDwB,OAAA,KAIjDlB,EAAAmB,EAAA,SAAAxB,GACA,IAAAe,EAAAf,KAAAyB,WACA,WAA2B,OAAAzB,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAK,EAAAQ,EAAAE,EAAA,IAAAA,GACAA,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OmI,EAAA2F,cAAoB2J,MAAM/X,KAAM6X,uFAI/BzT,kBA7GT,IAAAgJ,EAAA3Q,EAAA,mFAiHS6D,WAhHT,IAAAuB,EAAApF,EAAA,oFAiHS6D,WA/GT,IAAAmY,EAAAhc,EAAA,4FAgHS6D,WA/GT,IAAAkY,EAAA/b,EAAA,+FAgHS6D,qGACAoW,+GACAH,qBApHT,IAAAnM,EAAA3N,EAAA,2FAqHS6D,WAjHT,IAAAoY,EAAAjc,EAAA,mGAkHS6D,WAnHT,IAAAqY,EAAAlc,EAAA,uFAuHC6D,8FAEAkR,uBAIeoH,0BAMAC,aAAT,SAAsBva,GAE5B,OAAOsa,EAAsBta,MAIdwa,mBAAT,SAA4Bxa,EAASC,GAE3C,OAAO,EAAAwa,EAAAzY,SAA4BhC,EAASC,IAlJ7C,QAAA9B,EAAA,qDAWAgM,EAAAhM,EAAA,sDA8DO,SAAS8Z,EAAkBpT,EAAM8E,GAEvCuQ,EAAAjC,kBAAwBzZ,KAAKkD,KAAMmD,EAAM8E,EAAzC6P,EAAAxX,SAMM,SAAS0R,EAAU1T,GAEzB0a,EAAA1Y,QAAgBxD,KAAKkD,KAAM1B,EAA3BwZ,EAAAxX,SAiDM,SAASsY,EAAsBta,GAErC,OAAO,EAAAya,EAAAzY,SAA4BhC,EAA5BwZ,EAAAxX,SAxDRiW,EAAkBvY,UAAYX,OAAO4b,OAAOT,EAAAjC,kBAAwBvY,cACpEuY,EAAkBvY,UAAUgB,YAAcuX,EAO1CvE,EAAUhU,UAAYX,OAAO4b,OAAOD,EAAA1Y,QAAgBtC,cACpDgU,EAAUhU,UAAUgB,YAAcgT","file":"libphonenumber-js.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"libphonenumber\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"libphonenumber\"] = factory();\n\telse\n\t\troot[\"libphonenumber\"] = factory();\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 13);\n","var _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _createClass = function () { function 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nimport compare from 'semver-compare';\n\n// Added \"possibleLengths\" and renamed\n// \"country_phone_code_to_countries\" to \"country_calling_codes\".\nvar V2 = '1.0.18';\n\n// Added \"idd_prefix\" and \"default_idd_prefix\".\nvar V3 = '1.2.0';\n\nvar DEFAULT_EXT_PREFIX = ' ext. ';\n\nvar Metadata = function () {\n\tfunction Metadata(metadata) {\n\t\t_classCallCheck(this, Metadata);\n\n\t\tvalidateMetadata(metadata);\n\n\t\tthis.metadata = metadata;\n\n\t\tthis.v1 = !metadata.version;\n\t\tthis.v2 = metadata.version !== undefined && compare(metadata.version, V3) === -1;\n\t\tthis.v3 = metadata.version !== undefined; // && compare(metadata.version, V4) === -1\n\t}\n\n\t_createClass(Metadata, [{\n\t\tkey: 'hasCountry',\n\t\tvalue: function hasCountry(country) {\n\t\t\treturn this.metadata.countries[country] !== undefined;\n\t\t}\n\t}, {\n\t\tkey: 'country',\n\t\tvalue: function country(_country) {\n\t\t\tif (!_country) {\n\t\t\t\tthis._country = undefined;\n\t\t\t\tthis.country_metadata = undefined;\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tif (!this.hasCountry(_country)) {\n\t\t\t\tthrow new Error('Unknown country: ' + _country);\n\t\t\t}\n\n\t\t\tthis._country = _country;\n\t\t\tthis.country_metadata = this.metadata.countries[_country];\n\t\t\treturn this;\n\t\t}\n\t}, {\n\t\tkey: 'countryCallingCode',\n\t\tvalue: function countryCallingCode() {\n\t\t\treturn this.country_metadata[0];\n\t\t}\n\t}, {\n\t\tkey: 'IDDPrefix',\n\t\tvalue: function IDDPrefix() {\n\t\t\tif (this.v1 || this.v2) return;\n\t\t\treturn this.country_metadata[1];\n\t\t}\n\t}, {\n\t\tkey: 'defaultIDDPrefix',\n\t\tvalue: function defaultIDDPrefix() {\n\t\t\tif (this.v1 || this.v2) return;\n\t\t\treturn this.country_metadata[12];\n\t\t}\n\t}, {\n\t\tkey: 'nationalNumberPattern',\n\t\tvalue: function nationalNumberPattern() {\n\t\t\tif (this.v1 || this.v2) return this.country_metadata[1];\n\t\t\treturn this.country_metadata[2];\n\t\t}\n\t}, {\n\t\tkey: 'possibleLengths',\n\t\tvalue: function possibleLengths() {\n\t\t\tif (this.v1) return;\n\t\t\treturn this.country_metadata[this.v2 ? 2 : 3];\n\t\t}\n\t}, {\n\t\tkey: 'formats',\n\t\tvalue: function formats() {\n\t\t\tvar _this = this;\n\n\t\t\tvar formats = this.country_metadata[this.v1 ? 2 : this.v2 ? 3 : 4] || [];\n\t\t\treturn formats.map(function (_) {\n\t\t\t\treturn new Format(_, _this);\n\t\t\t});\n\t\t}\n\t}, {\n\t\tkey: 'nationalPrefix',\n\t\tvalue: function nationalPrefix() {\n\t\t\treturn this.country_metadata[this.v1 ? 3 : this.v2 ? 4 : 5];\n\t\t}\n\t}, {\n\t\tkey: 'nationalPrefixFormattingRule',\n\t\tvalue: function nationalPrefixFormattingRule() {\n\t\t\treturn this.country_metadata[this.v1 ? 4 : this.v2 ? 5 : 6];\n\t\t}\n\t}, {\n\t\tkey: 'nationalPrefixForParsing',\n\t\tvalue: function nationalPrefixForParsing() {\n\t\t\t// If `national_prefix_for_parsing` is not set explicitly,\n\t\t\t// then infer it from `national_prefix` (if any)\n\t\t\treturn this.country_metadata[this.v1 ? 5 : this.v2 ? 6 : 7] || this.nationalPrefix();\n\t\t}\n\t}, {\n\t\tkey: 'nationalPrefixTransformRule',\n\t\tvalue: function nationalPrefixTransformRule() {\n\t\t\treturn this.country_metadata[this.v1 ? 6 : this.v2 ? 7 : 8];\n\t\t}\n\t}, {\n\t\tkey: 'nationalPrefixIsOptionalWhenFormatting',\n\t\tvalue: function nationalPrefixIsOptionalWhenFormatting() {\n\t\t\treturn this.country_metadata[this.v1 ? 7 : this.v2 ? 8 : 9];\n\t\t}\n\t}, {\n\t\tkey: 'leadingDigits',\n\t\tvalue: function leadingDigits() {\n\t\t\treturn this.country_metadata[this.v1 ? 8 : this.v2 ? 9 : 10];\n\t\t}\n\t}, {\n\t\tkey: 'types',\n\t\tvalue: function types() {\n\t\t\treturn this.country_metadata[this.v1 ? 9 : this.v2 ? 10 : 11];\n\t\t}\n\t}, {\n\t\tkey: 'hasTypes',\n\t\tvalue: function hasTypes() {\n\t\t\treturn this.types() !== undefined;\n\t\t}\n\t}, {\n\t\tkey: 'type',\n\t\tvalue: function type(_type) {\n\t\t\tif (this.hasTypes() && getType(this.types(), _type)) {\n\t\t\t\treturn new Type(getType(this.types(), _type), this);\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: 'ext',\n\t\tvalue: function ext() {\n\t\t\tif (this.v1 || this.v2) return DEFAULT_EXT_PREFIX;\n\t\t\treturn this.country_metadata[13] || DEFAULT_EXT_PREFIX;\n\t\t}\n\t}, {\n\t\tkey: 'countryCallingCodes',\n\t\tvalue: function countryCallingCodes() {\n\t\t\tif (this.v1) return this.metadata.country_phone_code_to_countries;\n\t\t\treturn this.metadata.country_calling_codes;\n\t\t}\n\n\t\t// Formatting information for regions which share\n\t\t// a country calling code is contained by only one region\n\t\t// for performance reasons. For example, for NANPA region\n\t\t// (\"North American Numbering Plan Administration\",\n\t\t// which includes USA, Canada, Cayman Islands, Bahamas, etc)\n\t\t// it will be contained in the metadata for `US`.\n\t\t//\n\t\t// `country_calling_code` is always valid.\n\t\t// But the actual country may not necessarily be part of the metadata.\n\t\t//\n\n\t}, {\n\t\tkey: 'chooseCountryByCountryCallingCode',\n\t\tvalue: function chooseCountryByCountryCallingCode(country_calling_code) {\n\t\t\tvar country = this.countryCallingCodes()[country_calling_code][0];\n\n\t\t\t// Do not want to test this case.\n\t\t\t// (custom metadata, not all countries).\n\t\t\t/* istanbul ignore else */\n\t\t\tif (this.hasCountry(country)) {\n\t\t\t\tthis.country(country);\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: 'selectedCountry',\n\t\tvalue: function selectedCountry() {\n\t\t\treturn this._country;\n\t\t}\n\t}]);\n\n\treturn Metadata;\n}();\n\nexport default Metadata;\n\nvar Format = function () {\n\tfunction Format(format, metadata) {\n\t\t_classCallCheck(this, Format);\n\n\t\tthis._format = format;\n\t\tthis.metadata = metadata;\n\t}\n\n\t_createClass(Format, [{\n\t\tkey: 'pattern',\n\t\tvalue: function pattern() {\n\t\t\treturn this._format[0];\n\t\t}\n\t}, {\n\t\tkey: 'format',\n\t\tvalue: function format() {\n\t\t\treturn this._format[1];\n\t\t}\n\t}, {\n\t\tkey: 'leadingDigitsPatterns',\n\t\tvalue: function leadingDigitsPatterns() {\n\t\t\treturn this._format[2] || [];\n\t\t}\n\t}, {\n\t\tkey: 'nationalPrefixFormattingRule',\n\t\tvalue: function nationalPrefixFormattingRule() {\n\t\t\treturn this._format[3] || this.metadata.nationalPrefixFormattingRule();\n\t\t}\n\t}, {\n\t\tkey: 'nationalPrefixIsOptionalWhenFormatting',\n\t\tvalue: function nationalPrefixIsOptionalWhenFormatting() {\n\t\t\treturn this._format[4] || this.metadata.nationalPrefixIsOptionalWhenFormatting();\n\t\t}\n\t}, {\n\t\tkey: 'nationalPrefixIsMandatoryWhenFormatting',\n\t\tvalue: function nationalPrefixIsMandatoryWhenFormatting() {\n\t\t\t// National prefix is omitted if there's no national prefix formatting rule\n\t\t\t// set for this country, or when the national prefix formatting rule\n\t\t\t// contains no national prefix itself, or when this rule is set but\n\t\t\t// national prefix is optional for this phone number format\n\t\t\t// (and it is not enforced explicitly)\n\t\t\treturn this.nationalPrefixFormattingRule() &&\n\t\t\t// Check that national prefix formatting rule is not a dummy one.\n\t\t\t// Check that national prefix formatting rule actually has national prefix digit(s).\n\t\t\tthis.usesNationalPrefix() &&\n\t\t\t// Or maybe national prefix is optional for this format\n\t\t\t!this.nationalPrefixIsOptionalWhenFormatting();\n\t\t}\n\n\t\t// Checks whether national prefix formatting rule contains national prefix\n\n\t}, {\n\t\tkey: 'usesNationalPrefix',\n\t\tvalue: function usesNationalPrefix() {\n\t\t\t// Check that national prefix formatting rule is not a dummy one\n\t\t\treturn this.nationalPrefixFormattingRule() !== '$1' &&\n\t\t\t// Check that national prefix formatting rule actually has national prefix digit(s)\n\t\t\t/\\d/.test(this.nationalPrefixFormattingRule().replace('$1', ''));\n\t\t}\n\t}, {\n\t\tkey: 'internationalFormat',\n\t\tvalue: function internationalFormat() {\n\t\t\treturn this._format[5] || this.format();\n\t\t}\n\t}]);\n\n\treturn Format;\n}();\n\nvar Type = function () {\n\tfunction Type(type, metadata) {\n\t\t_classCallCheck(this, Type);\n\n\t\tthis.type = type;\n\t\tthis.metadata = metadata;\n\t}\n\n\t_createClass(Type, [{\n\t\tkey: 'pattern',\n\t\tvalue: function pattern() {\n\t\t\tif (this.metadata.v1) return this.type;\n\t\t\treturn this.type[0];\n\t\t}\n\t}, {\n\t\tkey: 'possibleLengths',\n\t\tvalue: function possibleLengths() {\n\t\t\tif (this.metadata.v1) return;\n\t\t\treturn this.type[1] || this.metadata.possibleLengths();\n\t\t}\n\t}]);\n\n\treturn Type;\n}();\n\nfunction getType(types, type) {\n\tswitch (type) {\n\t\tcase 'FIXED_LINE':\n\t\t\treturn types[0];\n\t\tcase 'MOBILE':\n\t\t\treturn types[1];\n\t\tcase 'TOLL_FREE':\n\t\t\treturn types[2];\n\t\tcase 'PREMIUM_RATE':\n\t\t\treturn types[3];\n\t\tcase 'PERSONAL_NUMBER':\n\t\t\treturn types[4];\n\t\tcase 'VOICEMAIL':\n\t\t\treturn types[5];\n\t\tcase 'UAN':\n\t\t\treturn types[6];\n\t\tcase 'PAGER':\n\t\t\treturn types[7];\n\t\tcase 'VOIP':\n\t\t\treturn types[8];\n\t\tcase 'SHARED_COST':\n\t\t\treturn types[9];\n\t}\n}\n\nexport function validateMetadata(metadata) {\n\tif (!metadata) {\n\t\tthrow new Error('[libphonenumber-js] `metadata` argument not passed. Check your arguments.');\n\t}\n\n\t// `country_phone_code_to_countries` was renamed to\n\t// `country_calling_codes` in `1.0.18`.\n\tif (!is_object(metadata) || !is_object(metadata.countries) || !is_object(metadata.country_calling_codes) && !is_object(metadata.country_phone_code_to_countries)) {\n\t\tthrow new Error('[libphonenumber-js] `metadata` argument was passed but it\\'s not a valid metadata. Must be an object having `.countries` and `.country_calling_codes` child object properties. Got ' + (is_object(metadata) ? 'an object of shape: { ' + Object.keys(metadata).join(', ') + ' }' : 'a ' + type_of(metadata) + ': ' + metadata) + '.');\n\t}\n}\n\n// Babel transforms `typeof` into some \"branches\"\n// so istanbul will show this as \"branch not covered\".\n/* istanbul ignore next */\nvar is_object = function is_object(_) {\n\treturn (typeof _ === 'undefined' ? 'undefined' : _typeof(_)) === 'object';\n};\n\n// Babel transforms `typeof` into some \"branches\"\n// so istanbul will show this as \"branch not covered\".\n/* istanbul ignore next */\nvar type_of = function type_of(_) {\n\treturn typeof _ === 'undefined' ? 'undefined' : _typeof(_);\n};\n\nexport function getExtPrefix(country, metadata) {\n\treturn new Metadata(metadata).country(country).ext();\n}\n//# sourceMappingURL=metadata.js.map","import { stripIDDPrefix } from './IDD';\n\n// `DASHES` will be right after the opening square bracket of the \"character class\"\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\\\\[\\\\]';\n// export const OPENING_BRACKETS = '(\\uFF08\\uFF3B\\\\\\['\nvar TILDES = '~\\u2053\\u223C\\uFF5E';\n\n// Digits accepted in phone numbers\n// (ascii, fullwidth, arabic-indic, and eastern arabic digits).\nexport var VALID_DIGITS = '0-9\\uFF10-\\uFF19\\u0660-\\u0669\\u06F0-\\u06F9';\n\n// 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.\nexport var VALID_PUNCTUATION = '' + DASHES + SLASHES + DOTS + WHITESPACE + BRACKETS + TILDES;\n\nexport var PLUS_CHARS = '+\\uFF0B';\nvar LEADING_PLUS_CHARS_PATTERN = new RegExp('^[' + PLUS_CHARS + ']+');\n\n// The ITU says the maximum length should be 15,\n// but one can find longer numbers in Germany.\nexport var MAX_LENGTH_FOR_NSN = 17;\n\n// The maximum length of the country calling code.\nexport var MAX_LENGTH_COUNTRY_CODE = 3;\n\n// 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 DIGIT_MAPPINGS = {\n\t'0': '0',\n\t'1': '1',\n\t'2': '2',\n\t'3': '3',\n\t'4': '4',\n\t'5': '5',\n\t'6': '6',\n\t'7': '7',\n\t'8': '8',\n\t'9': '9',\n\t'\\uFF10': '0', // Fullwidth digit 0\n\t'\\uFF11': '1', // Fullwidth digit 1\n\t'\\uFF12': '2', // Fullwidth digit 2\n\t'\\uFF13': '3', // Fullwidth digit 3\n\t'\\uFF14': '4', // Fullwidth digit 4\n\t'\\uFF15': '5', // Fullwidth digit 5\n\t'\\uFF16': '6', // Fullwidth digit 6\n\t'\\uFF17': '7', // Fullwidth digit 7\n\t'\\uFF18': '8', // Fullwidth digit 8\n\t'\\uFF19': '9', // Fullwidth digit 9\n\t'\\u0660': '0', // Arabic-indic digit 0\n\t'\\u0661': '1', // Arabic-indic digit 1\n\t'\\u0662': '2', // Arabic-indic digit 2\n\t'\\u0663': '3', // Arabic-indic digit 3\n\t'\\u0664': '4', // Arabic-indic digit 4\n\t'\\u0665': '5', // Arabic-indic digit 5\n\t'\\u0666': '6', // Arabic-indic digit 6\n\t'\\u0667': '7', // Arabic-indic digit 7\n\t'\\u0668': '8', // Arabic-indic digit 8\n\t'\\u0669': '9', // Arabic-indic digit 9\n\t'\\u06F0': '0', // Eastern-Arabic digit 0\n\t'\\u06F1': '1', // Eastern-Arabic digit 1\n\t'\\u06F2': '2', // Eastern-Arabic digit 2\n\t'\\u06F3': '3', // Eastern-Arabic digit 3\n\t'\\u06F4': '4', // Eastern-Arabic digit 4\n\t'\\u06F5': '5', // Eastern-Arabic digit 5\n\t'\\u06F6': '6', // Eastern-Arabic digit 6\n\t'\\u06F7': '7', // Eastern-Arabic digit 7\n\t'\\u06F8': '8', // Eastern-Arabic digit 8\n\t'\\u06F9': '9' // Eastern-Arabic digit 9\n\n\n\t/**\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 *\r\n * E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`.\r\n *\r\n * @param {string} number\r\n * @return {string}\r\n */\n};export function parse_phone_number_digits(number) {\n\treturn (LEADING_PLUS_CHARS_PATTERN.test(number) ? '+' : '') + drop_and_substitute_characters(number, DIGIT_MAPPINGS);\n}\n\n// Parses a formatted phone number\n// and returns `{ country_calling_code, number }`\n// where `number` is the national (significant) phone number.\n//\n// (aka `maybeExtractCountryPhoneCode`)\n//\nexport function parse_national_number_and_country_calling_code(number, country, metadata) {\n\tnumber = parse_phone_number_digits(number);\n\n\tif (!number) {\n\t\treturn {};\n\t}\n\n\t// If this is not an international phone number,\n\t// then don't extract country phone code.\n\tif (number[0] !== '+') {\n\t\t// Convert an \"out-of-country\" dialing phone number\n\t\t// to a proper international phone number.\n\t\tvar numberWithoutIDD = stripIDDPrefix(number, country, metadata.metadata);\n\n\t\tif (numberWithoutIDD) {\n\t\t\tnumber = '+' + numberWithoutIDD;\n\t\t} else {\n\t\t\treturn { number: number };\n\t\t}\n\t}\n\n\t// Fast abortion: country codes do not begin with a '0'\n\tif (number[1] === '0') {\n\t\treturn {};\n\t}\n\n\t// The thing with country phone codes\n\t// is that they are orthogonal to each other\n\t// i.e. there's no such country phone code A\n\t// for which country phone code B exists\n\t// where B starts with A.\n\t// Therefore, while scanning digits,\n\t// if a valid country code is found,\n\t// that means that it is the country code.\n\t//\n\tvar i = 2;\n\twhile (i - 1 <= MAX_LENGTH_COUNTRY_CODE && i <= number.length) {\n\t\tvar countryCallingCode = number.slice(1, i);\n\n\t\tif (metadata.countryCallingCodes()[countryCallingCode]) {\n\t\t\treturn {\n\t\t\t\tcountryCallingCode: countryCallingCode,\n\t\t\t\tnumber: number.slice(i)\n\t\t\t};\n\t\t}\n\n\t\ti++;\n\t}\n\n\treturn {};\n}\n\n// Checks whether the entire input sequence can be matched\n// against the regular expression.\nexport function matches_entirely() {\n\tvar text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n\tvar regular_expression = arguments[1];\n\n\tif (typeof regular_expression === 'string') {\n\t\tregular_expression = '^(?:' + regular_expression + ')$';\n\t}\n\n\tvar matched_groups = text.match(regular_expression);\n\treturn matched_groups !== null && matched_groups[0].length === text.length;\n}\n\n// For any character not being part of `replacements`\n// it is removed from the phone number.\nfunction drop_and_substitute_characters(text, replacements) {\n\tvar replaced = '';\n\n\t// Using `.split('')` to iterate through a string here\n\t// to avoid requiring `Symbol.iterator` polyfill.\n\t// `.split('')` is generally not safe for Unicode,\n\t// but in this particular case for `digits` it is safe.\n\t// for (const character of text)\n\tfor (var _iterator = text.split(''), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n\t\tvar _ref;\n\n\t\tif (_isArray) {\n\t\t\tif (_i >= _iterator.length) break;\n\t\t\t_ref = _iterator[_i++];\n\t\t} else {\n\t\t\t_i = _iterator.next();\n\t\t\tif (_i.done) break;\n\t\t\t_ref = _i.value;\n\t\t}\n\n\t\tvar character = _ref;\n\n\t\tvar replacement = replacements[character.toUpperCase()];\n\n\t\tif (replacement) {\n\t\t\treplaced += replacement;\n\t\t}\n\t}\n\n\treturn replaced;\n}\n\n// The RFC 3966 format for extensions.\nvar RFC3966_EXTN_PREFIX = ';ext=';\n\n// Pattern to capture digits used in an extension.\n// Places a maximum length of '7' for an extension.\nvar CAPTURING_EXTN_DIGITS = '([' + VALID_DIGITS + ']{1,7})';\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 */\nexport function create_extension_pattern(purpose) {\n\t// One-character symbols that can be used to indicate an extension.\n\tvar single_extension_characters = 'x\\uFF58#\\uFF03~\\uFF5E';\n\n\tswitch (purpose) {\n\t\t// For parsing, we are slightly more lenient in our interpretation than for matching. Here we\n\t\t// allow \"comma\" and \"semicolon\" as possible extension indicators. When matching, these are\n\t\tcase 'parsing':\n\t\t\tsingle_extension_characters = ',;' + single_extension_characters;\n\t}\n\n\treturn RFC3966_EXTN_PREFIX + CAPTURING_EXTN_DIGITS + '|' + '[ \\xA0\\\\t,]*' + '(?:e?xt(?:ensi(?:o\\u0301?|\\xF3))?n?|\\uFF45?\\uFF58\\uFF54\\uFF4E?|' + '[' + single_extension_characters + ']|int|anexo|\\uFF49\\uFF4E\\uFF54)' + '[:\\\\.\\uFF0E]?[ \\xA0\\\\t,-]*' + CAPTURING_EXTN_DIGITS + '#?|' + '[- ]+([' + VALID_DIGITS + ']{1,5})#';\n}\n//# sourceMappingURL=common.js.map","var _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; };\n\n// This is a port of Google Android `libphonenumber`'s\n// `phonenumberutil.js` of 17th November, 2016.\n//\n// https://github.com/googlei18n/libphonenumber/commits/master/javascript/i18n/phonenumbers/phonenumberutil.js\n\nimport { parse_phone_number_digits, parse_national_number_and_country_calling_code, VALID_DIGITS, VALID_PUNCTUATION, PLUS_CHARS, MAX_LENGTH_FOR_NSN, matches_entirely, create_extension_pattern } from './common';\n\nimport Metadata from './metadata';\n\nimport get_number_type, { check_number_length_for_type } from './types';\n\nimport { parseRFC3966 } from './RFC3966';\n\n// The minimum length of the national significant number.\nvar MIN_LENGTH_FOR_NSN = 2;\n\n// We don't allow input strings for parsing to be longer than 250 chars.\n// This prevents malicious input from consuming CPU.\nvar MAX_INPUT_STRING_LENGTH = 250;\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 */\nvar EXTN_PATTERNS_FOR_PARSING = create_extension_pattern('parsing');\n\n// Regexp of all known extension prefixes used by different regions followed by\n// 1 or more valid digits, for use when parsing.\nvar EXTN_PATTERN = new RegExp('(?:' + EXTN_PATTERNS_FOR_PARSING + ')$', 'i');\n\n// 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//\nvar MIN_LENGTH_PHONE_NUMBER_PATTERN = '[' + VALID_DIGITS + ']{' + MIN_LENGTH_FOR_NSN + '}';\n//\n// And this is the second reg-exp:\n// (see MIN_LENGTH_PHONE_NUMBER_PATTERN for a full description of this reg-exp)\n//\nvar VALID_PHONE_NUMBER = '[' + PLUS_CHARS + ']{0,1}' + '(?:' + '[' + VALID_PUNCTUATION + ']*' + '[' + VALID_DIGITS + ']' + '){3,}' + '[' + VALID_PUNCTUATION + VALID_DIGITS + ']*';\n\n// The combined regular expression for valid phone numbers:\n//\nvar VALID_PHONE_NUMBER_PATTERN = new RegExp(\n// Either a short two-digit-only phone number\n'^' + MIN_LENGTH_PHONE_NUMBER_PATTERN + '$' + '|' +\n// Or a longer fully parsed phone number (min 3 characters)\n'^' + VALID_PHONE_NUMBER +\n// Phone number extensions\n'(?:' + EXTN_PATTERNS_FOR_PARSING + ')?' + '$', 'i');\n\n// This consists of the plus symbol, digits, and arabic-indic digits.\nvar PHONE_NUMBER_START_PATTERN = new RegExp('[' + PLUS_CHARS + VALID_DIGITS + ']');\n\n// Regular expression of trailing characters that we want to remove.\nvar AFTER_PHONE_NUMBER_END_PATTERN = new RegExp('[^' + VALID_DIGITS + ']+$');\n\nvar default_options = {\n\tcountry: {}\n\n\t// `options`:\n\t// {\n\t// country:\n\t// {\n\t// restrict - (a two-letter country code)\n\t// the phone number must be in this country\n\t//\n\t// default - (a two-letter country code)\n\t// default country to use for phone number parsing and validation\n\t// (if no country code could be derived from the phone number)\n\t// }\n\t// }\n\t//\n\t// Returns `{ country, number }`\n\t//\n\t// Example use cases:\n\t//\n\t// ```js\n\t// parse('8 (800) 555-35-35', 'RU')\n\t// parse('8 (800) 555-35-35', 'RU', metadata)\n\t// parse('8 (800) 555-35-35', { country: { default: 'RU' } })\n\t// parse('8 (800) 555-35-35', { country: { default: 'RU' } }, metadata)\n\t// parse('+7 800 555 35 35')\n\t// parse('+7 800 555 35 35', metadata)\n\t// ```\n\t//\n};export default function parse(arg_1, arg_2, arg_3, arg_4) {\n\tvar _sort_out_arguments = sort_out_arguments(arg_1, arg_2, arg_3, arg_4),\n\t text = _sort_out_arguments.text,\n\t options = _sort_out_arguments.options,\n\t metadata = _sort_out_arguments.metadata;\n\n\t// Validate `defaultCountry`.\n\n\n\tif (options.defaultCountry && !metadata.hasCountry(options.defaultCountry)) {\n\t\tthrow new Error('Unknown country: ' + options.defaultCountry);\n\t}\n\n\t// Parse the phone number.\n\n\tvar _parse_input = parse_input(text),\n\t formatted_phone_number = _parse_input.number,\n\t ext = _parse_input.ext;\n\n\t// If the phone number is not viable then return nothing.\n\n\n\tif (!formatted_phone_number) {\n\t\treturn {};\n\t}\n\n\tvar _parse_phone_number = parse_phone_number(formatted_phone_number, options.defaultCountry, options.fromCountry, metadata),\n\t country = _parse_phone_number.country,\n\t national_number = _parse_phone_number.national_number,\n\t countryCallingCode = _parse_phone_number.countryCallingCode,\n\t carrierCode = _parse_phone_number.carrierCode;\n\n\tif (!metadata.selectedCountry()) {\n\t\treturn options.extended ? { countryCallingCode: countryCallingCode } : {};\n\t}\n\n\t// Validate national (significant) number length.\n\t//\n\t// A sidenote:\n\t//\n\t// They say that sometimes national (significant) numbers\n\t// can be longer than `MAX_LENGTH_FOR_NSN` (e.g. in Germany).\n\t// https://github.com/googlei18n/libphonenumber/blob/7e1748645552da39c4e1ba731e47969d97bdb539/resources/phonenumber.proto#L36\n\t// Such numbers will just be discarded.\n\t//\n\tif (national_number.length < MIN_LENGTH_FOR_NSN || national_number.length > MAX_LENGTH_FOR_NSN) {\n\t\t// Google's demo just throws an error in this case.\n\t\treturn {};\n\t}\n\n\t// Check if national phone number pattern matches the number\n\t// National number pattern is different for each country,\n\t// even for those ones which are part of the \"NANPA\" group.\n\tvar valid = country && matches_entirely(national_number, new RegExp(metadata.nationalNumberPattern())) ? true : false;\n\n\tif (!options.extended) {\n\t\treturn valid ? result(country, national_number, ext) : {};\n\t}\n\n\treturn {\n\t\tcountry: country,\n\t\tcountryCallingCode: countryCallingCode,\n\t\tcarrierCode: carrierCode,\n\t\tvalid: valid,\n\t\tpossible: valid ? true : options.extended === true && metadata.possibleLengths() && is_possible_number(national_number, countryCallingCode !== undefined, metadata),\n\t\tphone: national_number,\n\t\text: ext\n\t};\n}\n\n// 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//\nexport function is_viable_phone_number(number) {\n\treturn number.length >= MIN_LENGTH_FOR_NSN && matches_entirely(number, VALID_PHONE_NUMBER_PATTERN);\n}\n\n/**\r\n * Extracts a parseable phone number.\r\n * @param {string} text - Input.\r\n * @return {string}.\r\n */\nexport function extract_formatted_phone_number(text) {\n\tif (!text || text.length > MAX_INPUT_STRING_LENGTH) {\n\t\treturn;\n\t}\n\n\t// Attempt to extract a possible number from the string passed in\n\n\tvar starts_at = text.search(PHONE_NUMBER_START_PATTERN);\n\n\tif (starts_at < 0) {\n\t\treturn;\n\t}\n\n\treturn text\n\t// Trim everything to the left of the phone number\n\t.slice(starts_at)\n\t// Remove trailing non-numerical characters\n\t.replace(AFTER_PHONE_NUMBER_END_PATTERN, '');\n}\n\n// Strips any national prefix (such as 0, 1) present in the number provided.\n// \"Carrier codes\" are only used in Colombia and Brazil,\n// and only when dialing within those countries from a mobile phone to a fixed line number.\nexport function strip_national_prefix_and_carrier_code(number, metadata) {\n\tif (!number || !metadata.nationalPrefixForParsing()) {\n\t\treturn { number: number };\n\t}\n\n\t// Attempt to parse the first digits as a national prefix\n\tvar national_prefix_pattern = new RegExp('^(?:' + metadata.nationalPrefixForParsing() + ')');\n\tvar national_prefix_matcher = national_prefix_pattern.exec(number);\n\n\t// If no national prefix is present in the phone number,\n\t// but the national prefix is optional for this country,\n\t// then consider this phone number valid.\n\t//\n\t// Google's reference `libphonenumber` implementation\n\t// wouldn't recognize such phone numbers as valid,\n\t// but I think it would perfectly make sense\n\t// to consider such phone numbers as valid\n\t// because if a national phone number was originally\n\t// formatted without the national prefix\n\t// then it must be parseable back into the original national number.\n\t// In other words, `parse(format(number))`\n\t// must always be equal to `number`.\n\t//\n\tif (!national_prefix_matcher) {\n\t\treturn { number: number };\n\t}\n\n\tvar national_significant_number = void 0;\n\n\t// `national_prefix_for_parsing` capturing groups\n\t// (used only for really messy cases: Argentina, Brazil, Mexico, Somalia)\n\tvar captured_groups_count = national_prefix_matcher.length - 1;\n\n\t// If the national number tranformation is needed then do it.\n\t//\n\t// I don't know what did they mean by `&& national_prefix_matcher[captured_groups_count]`.\n\t// https://github.com/googlei18n/libphonenumber/blob/d978e59c2e6b1ddfb6816cd190e1b62d9a96bc3b/javascript/i18n/phonenumbers/phonenumberutil.js#L3885\n\t// https://github.com/googlei18n/libphonenumber/blob/d978e59c2e6b1ddfb6816cd190e1b62d9a96bc3b/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L2906\n\t//\n\tif (metadata.nationalPrefixTransformRule() && national_prefix_matcher[captured_groups_count]) {\n\t\tnational_significant_number = number.replace(national_prefix_pattern, metadata.nationalPrefixTransformRule());\n\t}\n\t// Else, no transformation is necessary,\n\t// and just strip the national prefix.\n\telse {\n\t\t\tnational_significant_number = number.slice(national_prefix_matcher[0].length);\n\t\t}\n\n\tvar carrierCode = void 0;\n\tif (captured_groups_count > 0) {\n\t\tcarrierCode = national_prefix_matcher[1];\n\t}\n\n\t// The following is done in `get_country_and_national_number_for_local_number()` instead.\n\t//\n\t// // Verify the parsed national (significant) number for this country\n\t// const national_number_rule = new RegExp(metadata.nationalNumberPattern())\n\t// //\n\t// // If the original number (before stripping national prefix) was viable,\n\t// // and the resultant number is not, then prefer the original phone number.\n\t// // This is because for some countries (e.g. Russia) the same digit could be both\n\t// // a national prefix and a leading digit of a valid national phone number,\n\t// // like `8` is the national prefix for Russia and both\n\t// // `8 800 555 35 35` and `800 555 35 35` are valid numbers.\n\t// if (matches_entirely(number, national_number_rule) &&\n\t// \t\t!matches_entirely(national_significant_number, national_number_rule))\n\t// {\n\t// \treturn number\n\t// }\n\n\t// Return the parsed national (significant) number\n\treturn {\n\t\tnumber: national_significant_number,\n\t\tcarrierCode: carrierCode\n\t};\n}\n\nexport function find_country_code(country_calling_code, national_phone_number, metadata) {\n\t// Is always non-empty, because `country_calling_code` is always valid\n\tvar possible_countries = metadata.countryCallingCodes()[country_calling_code];\n\n\t// If there's just one country corresponding to the country code,\n\t// then just return it, without further phone number digits validation.\n\tif (possible_countries.length === 1) {\n\t\treturn possible_countries[0];\n\t}\n\n\treturn _find_country_code(possible_countries, national_phone_number, metadata.metadata);\n}\n\n// Changes `metadata` `country`.\nfunction _find_country_code(possible_countries, national_phone_number, metadata) {\n\tmetadata = new Metadata(metadata);\n\n\tfor (var _iterator = possible_countries, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n\t\tvar _ref;\n\n\t\tif (_isArray) {\n\t\t\tif (_i >= _iterator.length) break;\n\t\t\t_ref = _iterator[_i++];\n\t\t} else {\n\t\t\t_i = _iterator.next();\n\t\t\tif (_i.done) break;\n\t\t\t_ref = _i.value;\n\t\t}\n\n\t\tvar country = _ref;\n\n\t\tmetadata.country(country);\n\n\t\t// Leading digits check would be the simplest one\n\t\tif (metadata.leadingDigits()) {\n\t\t\tif (national_phone_number && national_phone_number.search(metadata.leadingDigits()) === 0) {\n\t\t\t\treturn country;\n\t\t\t}\n\t\t}\n\t\t// Else perform full validation with all of those\n\t\t// fixed-line/mobile/etc regular expressions.\n\t\telse if (get_number_type({ phone: national_phone_number, country: country }, metadata.metadata)) {\n\t\t\t\treturn country;\n\t\t\t}\n\t}\n}\n\n// Sort out arguments\nfunction sort_out_arguments(arg_1, arg_2, arg_3, arg_4) {\n\tvar text = void 0;\n\tvar options = void 0;\n\tvar metadata = void 0;\n\n\t// If the phone number is passed as a string.\n\t// `parse('88005553535', ...)`.\n\tif (typeof arg_1 === 'string') {\n\t\ttext = arg_1;\n\t} else throw new TypeError('A phone number for parsing must be a string.');\n\n\t// If \"default country\" argument is being passed\n\t// then move it to `options`.\n\t// `parse('88005553535', 'RU', [options], metadata)`.\n\tif (typeof arg_2 === 'string') {\n\t\tif (arg_4) {\n\t\t\toptions = _extends({ defaultCountry: arg_2 }, arg_3);\n\t\t\tmetadata = arg_4;\n\t\t} else {\n\t\t\toptions = { defaultCountry: arg_2 };\n\t\t\tmetadata = arg_3;\n\t\t}\n\t}\n\t// No \"default country\" argument is being passed.\n\t// International phone number is passed.\n\t// `parse('+78005553535', [options], metadata)`.\n\telse {\n\t\t\tif (arg_3) {\n\t\t\t\toptions = arg_2;\n\t\t\t\tmetadata = arg_3;\n\t\t\t} else {\n\t\t\t\tmetadata = arg_2;\n\t\t\t}\n\t\t}\n\n\t// Apply default options.\n\tif (options) {\n\t\toptions = _extends({}, default_options, options);\n\t} else {\n\t\toptions = default_options;\n\t}\n\n\treturn { text: text, options: options, metadata: new Metadata(metadata) };\n}\n\n// 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.\nfunction strip_extension(number) {\n\tvar start = number.search(EXTN_PATTERN);\n\tif (start < 0) {\n\t\treturn {};\n\t}\n\n\t// If we find a potential extension, and the number preceding this is a viable\n\t// number, we assume it is an extension.\n\tvar number_without_extension = number.slice(0, start);\n\t/* istanbul ignore if - seems a bit of a redundant check */\n\tif (!is_viable_phone_number(number_without_extension)) {\n\t\treturn {};\n\t}\n\n\tvar matches = number.match(EXTN_PATTERN);\n\tvar i = 1;\n\twhile (i < matches.length) {\n\t\tif (matches[i] != null && matches[i].length > 0) {\n\t\t\treturn {\n\t\t\t\tnumber: number_without_extension,\n\t\t\t\text: matches[i]\n\t\t\t};\n\t\t}\n\t\ti++;\n\t}\n}\n\nfunction is_possible_number(national_number, is_international, metadata) {\n\tswitch (check_number_length_for_type(national_number, undefined, metadata)) {\n\t\tcase 'IS_POSSIBLE':\n\t\t\treturn true;\n\t\t// case 'IS_POSSIBLE_LOCAL_ONLY':\n\t\t// \treturn !is_international\n\t\tdefault:\n\t\t\treturn false;\n\t}\n}\n\n/**\r\n * @param {string} text - Input.\r\n * @return {object} `{ ?number, ?ext }`.\r\n */\nfunction parse_input(text) {\n\t// Parse RFC 3966 phone number URI.\n\tif (text && text.indexOf('tel:') === 0) {\n\t\treturn parseRFC3966(text);\n\t}\n\n\tvar number = extract_formatted_phone_number(text);\n\n\t// If the phone number is not viable, then abort.\n\tif (!number || !is_viable_phone_number(number)) {\n\t\treturn {};\n\t}\n\n\t// Attempt to parse extension first, since it doesn't require region-specific\n\t// data and we want to have the non-normalised number here.\n\tvar with_extension_stripped = strip_extension(number);\n\tif (with_extension_stripped.ext) {\n\t\treturn with_extension_stripped;\n\t}\n\n\treturn { number: number };\n}\n\n/**\r\n * Creates `parse()` result object.\r\n */\nfunction result(country, national_number, ext) {\n\tvar result = {\n\t\tcountry: country,\n\t\tphone: national_number\n\t};\n\n\tif (ext) {\n\t\tresult.ext = ext;\n\t}\n\n\treturn result;\n}\n\n/**\r\n * Parses a viable phone number.\r\n * Returns `{ country, countryCallingCode, national_number }`.\r\n */\nfunction parse_phone_number(formatted_phone_number, default_country, from_country, metadata) {\n\tvar _parse_national_numbe = parse_national_number_and_country_calling_code(formatted_phone_number, from_country, metadata),\n\t countryCallingCode = _parse_national_numbe.countryCallingCode,\n\t number = _parse_national_numbe.number;\n\n\tif (!number) {\n\t\treturn { countryCallingCode: countryCallingCode };\n\t}\n\n\tvar country = void 0;\n\n\t// Attempt to extract country from international phone number.\n\tif (countryCallingCode) {\n\t\t// Sometimes there are several countries\n\t\t// corresponding to the same country phone code\n\t\t// (e.g. NANPA countries all having `1` country phone code).\n\t\t// Therefore, to reliably determine the exact country,\n\t\t// national (significant) number should have been parsed first.\n\t\t//\n\t\t// When `metadata.json` is generated, all \"ambiguous\" country phone codes\n\t\t// get their countries populated with the full set of\n\t\t// \"phone number type\" regular expressions.\n\t\t//\n\t\tcountry = find_country_code(countryCallingCode, number, metadata);\n\n\t\tif (country) {\n\t\t\tmetadata.country(country);\n\t\t} else {\n\t\t\t// Formatting information for regions which share\n\t\t\t// a country calling code is contained by only one region\n\t\t\t// for performance reasons. For example, for NANPA region\n\t\t\t// (\"North American Numbering Plan Administration\",\n\t\t\t// which includes USA, Canada, Cayman Islands, Bahamas, etc)\n\t\t\t// it will be contained in the metadata for `US`.\n\t\t\tmetadata.chooseCountryByCountryCallingCode(countryCallingCode);\n\t\t}\n\t} else if (default_country) {\n\t\tcountry = default_country;\n\t\tmetadata.country(country);\n\t\tcountryCallingCode = metadata.countryCallingCode();\n\t} else return {};\n\n\t// Parsing national prefixes and carrier codes\n\t// is only required for local phone numbers\n\t// but some people don't understand that\n\t// and sometimes write international phone numbers\n\t// with national prefixes (or maybe even carrier codes).\n\t// http://ucken.blogspot.ru/2016/03/trunk-prefixes-in-skype4b.html\n\t// Google's original library forgives such mistakes\n\t// and so does this library, because it has been requested:\n\t// https://github.com/catamphetamine/libphonenumber-js/issues/127\n\n\tvar _parse_national_numbe2 = parse_national_number(number, metadata),\n\t national_number = _parse_national_numbe2.national_number,\n\t carrier_code = _parse_national_numbe2.carrier_code;\n\n\treturn {\n\t\tcountry: country,\n\t\tcountryCallingCode: countryCallingCode,\n\t\tnational_number: national_number,\n\t\tcarrierCode: carrier_code\n\t};\n}\n\nfunction parse_national_number(number, metadata) {\n\tvar national_number = parse_phone_number_digits(number);\n\tvar carrier_code = void 0;\n\n\t// Only strip national prefixes for non-international phone numbers\n\t// because national prefixes can't be present in international phone numbers.\n\t// Otherwise, while forgiving, it would parse a NANPA number `+1 1877 215 5230`\n\t// first to `1877 215 5230` and then, stripping the leading `1`, to `877 215 5230`,\n\t// and then it would assume that's a valid number which it isn't.\n\t// So no forgiveness for grandmas here.\n\t// The issue asking for this fix:\n\t// https://github.com/catamphetamine/libphonenumber-js/issues/159\n\n\tvar _strip_national_prefi = strip_national_prefix_and_carrier_code(national_number, metadata),\n\t potential_national_number = _strip_national_prefi.number,\n\t carrierCode = _strip_national_prefi.carrierCode;\n\n\t// If metadata has \"possible lengths\" then employ the new algorythm.\n\n\n\tif (metadata.possibleLengths()) {\n\t\t// We require that the NSN remaining after stripping the national prefix and\n\t\t// carrier code be long enough to be a possible length for the region.\n\t\t// Otherwise, we don't do the stripping, since the original number could be\n\t\t// a valid short number.\n\t\tswitch (check_number_length_for_type(potential_national_number, undefined, metadata)) {\n\t\t\tcase 'TOO_SHORT':\n\t\t\t// case 'IS_POSSIBLE_LOCAL_ONLY':\n\t\t\tcase 'INVALID_LENGTH':\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tnational_number = potential_national_number;\n\t\t\t\tcarrier_code = carrierCode;\n\t\t}\n\t} else {\n\t\t// If the original number (before stripping national prefix) was viable,\n\t\t// and the resultant number is not, then prefer the original phone number.\n\t\t// This is because for some countries (e.g. Russia) the same digit could be both\n\t\t// a national prefix and a leading digit of a valid national phone number,\n\t\t// like `8` is the national prefix for Russia and both\n\t\t// `8 800 555 35 35` and `800 555 35 35` are valid numbers.\n\t\tif (matches_entirely(national_number, metadata.nationalNumberPattern()) && !matches_entirely(potential_national_number, metadata.nationalNumberPattern())) {\n\t\t\t// Keep the number without stripping national prefix.\n\t\t} else {\n\t\t\tnational_number = potential_national_number;\n\t\t\tcarrier_code = carrierCode;\n\t\t}\n\t}\n\n\treturn {\n\t\tnational_number: national_number,\n\t\tcarrier_code: carrier_code\n\t};\n}\n\n// Determines the country for a given (possibly incomplete) phone number.\n// export function get_country_from_phone_number(number, metadata)\n// {\n// \treturn parse_phone_number(number, null, metadata).country\n// }\n//# sourceMappingURL=parse.js.map","var _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nimport parse, { is_viable_phone_number } from './parse';\n\nimport { matches_entirely } from './common';\n\nimport Metadata from './metadata';\n\nvar non_fixed_line_types = ['MOBILE', 'PREMIUM_RATE', 'TOLL_FREE', 'SHARED_COST', 'VOIP', 'PERSONAL_NUMBER', 'PAGER', 'UAN', 'VOICEMAIL'];\n\n// Finds out national phone number type (fixed line, mobile, etc)\nexport default function get_number_type(arg_1, arg_2, arg_3) {\n\tvar _sort_out_arguments = sort_out_arguments(arg_1, arg_2, arg_3),\n\t input = _sort_out_arguments.input,\n\t metadata = _sort_out_arguments.metadata;\n\n\t// When no input was passed\n\n\n\tif (!input) {\n\t\treturn;\n\t}\n\n\t// When `parse()` returned `{}`\n\t// meaning that the phone number is not a valid one.\n\tif (!input.country) {\n\t\treturn;\n\t}\n\n\tif (!metadata.hasCountry(input.country)) {\n\t\tthrow new Error('Unknown country: ' + input.country);\n\t}\n\n\tvar national_number = input.phone;\n\tmetadata.country(input.country);\n\n\t// The following is copy-pasted from the original function:\n\t// https://github.com/googlei18n/libphonenumber/blob/3ea547d4fbaa2d0b67588904dfa5d3f2557c27ff/javascript/i18n/phonenumbers/phonenumberutil.js#L2835\n\n\t// Is this national number even valid for this country\n\tif (!matches_entirely(national_number, metadata.nationalNumberPattern())) {\n\t\treturn;\n\t}\n\n\t// Is it fixed line number\n\tif (is_of_type(national_number, 'FIXED_LINE', metadata)) {\n\t\t// Because duplicate regular expressions are removed\n\t\t// to reduce metadata size, if \"mobile\" pattern is \"\"\n\t\t// then it means it was removed due to being a duplicate of the fixed-line pattern.\n\t\t//\n\t\tif (metadata.type('MOBILE') && metadata.type('MOBILE').pattern() === '') {\n\t\t\treturn 'FIXED_LINE_OR_MOBILE';\n\t\t}\n\n\t\t// v1 metadata.\n\t\t// Legacy.\n\t\t// Deprecated.\n\t\tif (!metadata.type('MOBILE')) {\n\t\t\treturn 'FIXED_LINE_OR_MOBILE';\n\t\t}\n\n\t\t// Check if the number happens to qualify as both fixed line and mobile.\n\t\t// (no such country in the minimal metadata set)\n\t\t/* istanbul ignore if */\n\t\tif (is_of_type(national_number, 'MOBILE', metadata)) {\n\t\t\treturn 'FIXED_LINE_OR_MOBILE';\n\t\t}\n\n\t\treturn 'FIXED_LINE';\n\t}\n\n\tfor (var _iterator = non_fixed_line_types, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n\t\tvar _ref;\n\n\t\tif (_isArray) {\n\t\t\tif (_i >= _iterator.length) break;\n\t\t\t_ref = _iterator[_i++];\n\t\t} else {\n\t\t\t_i = _iterator.next();\n\t\t\tif (_i.done) break;\n\t\t\t_ref = _i.value;\n\t\t}\n\n\t\tvar _type = _ref;\n\n\t\tif (is_of_type(national_number, _type, metadata)) {\n\t\t\treturn _type;\n\t\t}\n\t}\n}\n\nexport function is_of_type(national_number, type, metadata) {\n\ttype = metadata.type(type);\n\n\tif (!type || !type.pattern()) {\n\t\treturn false;\n\t}\n\n\t// Check if any possible number lengths are present;\n\t// if so, we use them to avoid checking\n\t// the validation pattern if they don't match.\n\t// If they are absent, this means they match\n\t// the general description, which we have\n\t// already checked before a specific number type.\n\tif (type.possibleLengths() && type.possibleLengths().indexOf(national_number.length) < 0) {\n\t\treturn false;\n\t}\n\n\treturn matches_entirely(national_number, type.pattern());\n}\n\n// Sort out arguments\nexport function sort_out_arguments(arg_1, arg_2, arg_3) {\n\tvar input = void 0;\n\tvar metadata = void 0;\n\n\t// If the phone number is passed as a string.\n\t// `getNumberType('88005553535', ...)`.\n\tif (typeof arg_1 === 'string') {\n\t\t// If \"resrict country\" argument is being passed\n\t\t// then convert it to an `options` object.\n\t\t// `getNumberType('88005553535', 'RU', metadata)`.\n\t\tif (typeof arg_2 === 'string' || arg_2 === undefined) {\n\t\t\tmetadata = arg_3;\n\n\t\t\t// `parse` extracts phone numbers from raw text,\n\t\t\t// therefore it will cut off all \"garbage\" characters,\n\t\t\t// while this `validate` function needs to verify\n\t\t\t// that the phone number contains no \"garbage\"\n\t\t\t// therefore the explicit `is_viable_phone_number` check.\n\t\t\tif (is_viable_phone_number(arg_1)) {\n\t\t\t\tinput = parse(arg_1, arg_2, metadata);\n\t\t\t}\n\t\t}\n\t\t// No \"resrict country\" argument is being passed.\n\t\t// International phone number is passed.\n\t\t// `getNumberType('+78005553535', metadata)`.\n\t\telse {\n\t\t\t\tmetadata = arg_2;\n\n\t\t\t\t// `parse` extracts phone numbers from raw text,\n\t\t\t\t// therefore it will cut off all \"garbage\" characters,\n\t\t\t\t// while this `validate` function needs to verify\n\t\t\t\t// that the phone number contains no \"garbage\"\n\t\t\t\t// therefore the explicit `is_viable_phone_number` check.\n\t\t\t\tif (is_viable_phone_number(arg_1)) {\n\t\t\t\t\tinput = parse(arg_1, metadata);\n\t\t\t\t}\n\t\t\t}\n\t}\n\t// If the phone number is passed as a parsed phone number.\n\t// `getNumberType({ phone: '88005553535', country: 'RU' }, ...)`.\n\telse if (is_object(arg_1) && typeof arg_1.phone === 'string') {\n\t\t\t// The `arg_1` must be a valid phone number\n\t\t\t// as a whole, not just a part of it which gets parsed here.\n\t\t\tif (is_viable_phone_number(arg_1.phone)) {\n\t\t\t\tinput = arg_1;\n\t\t\t}\n\n\t\t\tmetadata = arg_2;\n\t\t} else throw new TypeError('A phone number must either be a string or an object of shape { phone, [country] }.');\n\n\treturn { input: input, metadata: new Metadata(metadata) };\n}\n\n// Should only be called for the \"new\" metadata which has \"possible lengths\".\nexport function check_number_length_for_type(national_number, type, metadata) {\n\tvar type_info = metadata.type(type);\n\n\t// There should always be \"\" set for every type element.\n\t// This is declared in the XML schema.\n\t// For size efficiency, where a sub-description (e.g. fixed-line)\n\t// has the same \"\" as the \"general description\", this is missing,\n\t// so we fall back to the \"general description\". Where no numbers of the type\n\t// exist at all, there is one possible length (-1) which is guaranteed\n\t// not to match the length of any real phone number.\n\tvar possible_lengths = type_info && type_info.possibleLengths() || metadata.possibleLengths();\n\t// let local_lengths = type_info && type.possibleLengthsLocal() || metadata.possibleLengthsLocal()\n\n\tif (type === 'FIXED_LINE_OR_MOBILE') {\n\t\t// No such country in metadata.\n\t\t/* istanbul ignore next */\n\t\tif (!metadata.type('FIXED_LINE')) {\n\t\t\t// The rare case has been encountered where no fixedLine data is available\n\t\t\t// (true for some non-geographical entities), so we just check mobile.\n\t\t\treturn test_number_length_for_type(national_number, 'MOBILE', metadata);\n\t\t}\n\n\t\tvar mobile_type = metadata.type('MOBILE');\n\n\t\tif (mobile_type) {\n\t\t\t// Merge the mobile data in if there was any. \"Concat\" creates a new\n\t\t\t// array, it doesn't edit possible_lengths in place, so we don't need a copy.\n\t\t\t// Note that when adding the possible lengths from mobile, we have\n\t\t\t// to again check they aren't empty since if they are this indicates\n\t\t\t// they are the same as the general desc and should be obtained from there.\n\t\t\tpossible_lengths = merge_arrays(possible_lengths, mobile_type.possibleLengths());\n\t\t\t// The current list is sorted; we need to merge in the new list and\n\t\t\t// re-sort (duplicates are okay). Sorting isn't so expensive because\n\t\t\t// the lists are very small.\n\n\t\t\t// if (local_lengths)\n\t\t\t// {\n\t\t\t// \tlocal_lengths = merge_arrays(local_lengths, mobile_type.possibleLengthsLocal())\n\t\t\t// }\n\t\t\t// else\n\t\t\t// {\n\t\t\t// \tlocal_lengths = mobile_type.possibleLengthsLocal()\n\t\t\t// }\n\t\t}\n\t}\n\t// If the type doesn't exist then return 'INVALID_LENGTH'.\n\telse if (type && !type_info) {\n\t\t\treturn 'INVALID_LENGTH';\n\t\t}\n\n\tvar actual_length = national_number.length;\n\n\t// // This is safe because there is never an overlap beween the possible lengths\n\t// // and the local-only lengths; this is checked at build time.\n\t// if (local_lengths && local_lengths.indexOf(national_number.length) >= 0)\n\t// {\n\t// \treturn 'IS_POSSIBLE_LOCAL_ONLY'\n\t// }\n\n\tvar minimum_length = possible_lengths[0];\n\n\tif (minimum_length === actual_length) {\n\t\treturn 'IS_POSSIBLE';\n\t}\n\n\tif (minimum_length > actual_length) {\n\t\treturn 'TOO_SHORT';\n\t}\n\n\tif (possible_lengths[possible_lengths.length - 1] < actual_length) {\n\t\treturn 'TOO_LONG';\n\t}\n\n\t// We skip the first element since we've already checked it.\n\treturn possible_lengths.indexOf(actual_length, 1) >= 0 ? 'IS_POSSIBLE' : 'INVALID_LENGTH';\n}\n\n// Babel transforms `typeof` into some \"branches\"\n// so istanbul will show this as \"branch not covered\".\n/* istanbul ignore next */\nvar is_object = function is_object(_) {\n\treturn (typeof _ === 'undefined' ? 'undefined' : _typeof(_)) === 'object';\n};\n\nexport function merge_arrays(a, b) {\n\tvar merged = a.slice();\n\n\tfor (var _iterator2 = b, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {\n\t\tvar _ref2;\n\n\t\tif (_isArray2) {\n\t\t\tif (_i2 >= _iterator2.length) break;\n\t\t\t_ref2 = _iterator2[_i2++];\n\t\t} else {\n\t\t\t_i2 = _iterator2.next();\n\t\t\tif (_i2.done) break;\n\t\t\t_ref2 = _i2.value;\n\t\t}\n\n\t\tvar element = _ref2;\n\n\t\tif (a.indexOf(element) < 0) {\n\t\t\tmerged.push(element);\n\t\t}\n\t}\n\n\treturn merged.sort(function (a, b) {\n\t\treturn a - b;\n\t});\n\n\t// ES6 version, requires Set polyfill.\n\t// let merged = new Set(a)\n\t// for (const element of b)\n\t// {\n\t// \tmerged.add(i)\n\t// }\n\t// return Array.from(merged).sort((a, b) => a - b)\n}\n//# sourceMappingURL=types.js.map","var _slicedToArray = function () { function sliceIterator(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\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nimport { is_viable_phone_number } from './parse';\n\n// 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 */\nexport function parseRFC3966(text) {\n\tvar number = void 0;\n\tvar ext = void 0;\n\n\tfor (var _iterator = text.split(';'), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n\t\tvar _ref;\n\n\t\tif (_isArray) {\n\t\t\tif (_i >= _iterator.length) break;\n\t\t\t_ref = _iterator[_i++];\n\t\t} else {\n\t\t\t_i = _iterator.next();\n\t\t\tif (_i.done) break;\n\t\t\t_ref = _i.value;\n\t\t}\n\n\t\tvar part = _ref;\n\n\t\tvar _part$split = part.split(':'),\n\t\t _part$split2 = _slicedToArray(_part$split, 2),\n\t\t name = _part$split2[0],\n\t\t value = _part$split2[1];\n\n\t\tswitch (name) {\n\t\t\tcase 'tel':\n\t\t\t\tnumber = value;\n\t\t\t\tbreak;\n\t\t\tcase 'ext':\n\t\t\t\text = value;\n\t\t\t\tbreak;\n\t\t\tcase 'phone-context':\n\t\t\t\t// Only \"country contexts\" are supported.\n\t\t\t\t// \"Domain contexts\" are ignored.\n\t\t\t\tif (value[0] === '+') {\n\t\t\t\t\tnumber = value + number;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\t// If the phone number is not viable, then abort.\n\tif (!is_viable_phone_number(number)) {\n\t\treturn {};\n\t}\n\n\tvar result = { number: number };\n\tif (ext) {\n\t\tresult.ext = ext;\n\t}\n\treturn result;\n}\n\n/**\r\n * @param {object} - `{ ?number, ?extension }`.\r\n * @return {string} Phone URI (RFC 3966).\r\n */\nexport function formatRFC3966(_ref2) {\n\tvar number = _ref2.number,\n\t ext = _ref2.ext;\n\n\tif (!number) {\n\t\treturn '';\n\t}\n\n\tif (number[0] !== '+') {\n\t\tthrow new Error('\"formatRFC3966()\" expects \"number\" to be in E.164 format.');\n\t}\n\n\treturn 'tel:' + number + (ext ? ';ext=' + ext : '');\n}\n//# sourceMappingURL=RFC3966.js.map","var _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _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; };\n\n// This is a port of Google Android `libphonenumber`'s\n// `phonenumberutil.js` of 17th November, 2016.\n//\n// https://github.com/googlei18n/libphonenumber/commits/master/javascript/i18n/phonenumbers/phonenumberutil.js\n\nimport { parse_national_number_and_country_calling_code, VALID_PUNCTUATION, matches_entirely } from './common';\n\nimport { getIDDPrefix } from './IDD';\n\nimport Metadata from './metadata';\n\nimport { formatRFC3966 } from './RFC3966';\n\nvar defaultOptions = {\n\tformatExtension: function formatExtension(number, extension, metadata) {\n\t\treturn '' + number + metadata.ext() + extension;\n\t}\n\n\t// Formats a phone number\n\t//\n\t// Example use cases:\n\t//\n\t// ```js\n\t// format('8005553535', 'RU', 'International')\n\t// format('8005553535', 'RU', 'International', metadata)\n\t// format({ phone: '8005553535', country: 'RU' }, 'International')\n\t// format({ phone: '8005553535', country: 'RU' }, 'International', metadata)\n\t// format('+78005553535', 'National')\n\t// format('+78005553535', 'National', metadata)\n\t// ```\n\t//\n};export default function format(arg_1, arg_2, arg_3, arg_4, arg_5) {\n\tvar _sort_out_arguments = sort_out_arguments(arg_1, arg_2, arg_3, arg_4, arg_5),\n\t input = _sort_out_arguments.input,\n\t format_type = _sort_out_arguments.format_type,\n\t options = _sort_out_arguments.options,\n\t metadata = _sort_out_arguments.metadata;\n\n\tif (input.country && metadata.hasCountry(input.country)) {\n\t\tmetadata.country(input.country);\n\t}\n\n\tvar _parse_national_numbe = parse_national_number_and_country_calling_code(input.phone, null, metadata),\n\t countryCallingCode = _parse_national_numbe.countryCallingCode,\n\t number = _parse_national_numbe.number;\n\n\tcountryCallingCode = countryCallingCode || input.countryCallingCode;\n\n\tif (countryCallingCode) {\n\t\t// Check country restriction\n\t\tif (input.country && metadata.selectedCountry() && countryCallingCode !== metadata.countryCallingCode()) {\n\t\t\treturn input.phone;\n\t\t}\n\n\t\tmetadata.chooseCountryByCountryCallingCode(countryCallingCode);\n\t}\n\n\tif (!metadata.selectedCountry()) {\n\t\treturn input.phone;\n\t}\n\n\tswitch (format_type) {\n\t\tcase 'International':\n\t\t\tif (!number) {\n\t\t\t\treturn '+' + metadata.countryCallingCode();\n\t\t\t}\n\t\t\tnumber = format_national_number(number, 'International', false, metadata);\n\t\t\tnumber = '+' + metadata.countryCallingCode() + ' ' + number;\n\t\t\treturn add_extension(number, input.ext, metadata, options.formatExtension);\n\n\t\tcase 'E.164':\n\t\t\t// `E.164` doesn't define \"phone number extensions\".\n\t\t\treturn '+' + metadata.countryCallingCode() + input.phone;\n\n\t\tcase 'RFC3966':\n\t\t\treturn formatRFC3966({\n\t\t\t\tnumber: '+' + metadata.countryCallingCode() + input.phone,\n\t\t\t\text: input.ext\n\t\t\t});\n\n\t\tcase 'IDD':\n\t\t\tif (!options.fromCountry) {\n\t\t\t\treturn;\n\t\t\t\t// throw new Error('`fromCountry` option not passed for IDD-prefixed formatting.')\n\t\t\t}\n\t\t\tvar IDDPrefix = getIDDPrefix(options.fromCountry, metadata.metadata);\n\t\t\tif (!IDDPrefix) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (options.humanReadable) {\n\t\t\t\tvar formattedForSameCountryCallingCode = countryCallingCode && formatIDDSameCountryCallingCodeNumber(number, countryCallingCode, options.fromCountry, metadata);\n\t\t\t\tif (formattedForSameCountryCallingCode) {\n\t\t\t\t\tnumber = formattedForSameCountryCallingCode;\n\t\t\t\t} else {\n\t\t\t\t\tnumber = IDDPrefix + ' ' + metadata.countryCallingCode() + ' ' + format_national_number(number, 'International', false, metadata);\n\t\t\t\t}\n\t\t\t\treturn add_extension(number, input.ext, metadata, options.formatExtension);\n\t\t\t}\n\t\t\treturn '' + IDDPrefix + metadata.countryCallingCode() + number;\n\n\t\tcase 'National':\n\t\t\tif (!number) {\n\t\t\t\treturn '';\n\t\t\t}\n\t\t\tnumber = format_national_number(number, 'National', false, metadata);\n\t\t\treturn add_extension(number, input.ext, metadata, options.formatExtension);\n\t}\n}\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.\nexport var FIRST_GROUP_PATTERN = /(\\$\\d)/;\n\nexport function format_national_number_using_format(number, format, international, enforce_national_prefix, metadata) {\n\tvar format_pattern_matcher = new RegExp(format.pattern());\n\n\t// National prefix is omitted if there's no national prefix formatting rule\n\t// set for this country, or when this rule is set but\n\t// national prefix is optional for this phone number format\n\t// (and it is not enforced explicitly)\n\tvar national_prefix_may_be_omitted = !format.nationalPrefixFormattingRule() || format.nationalPrefixFormattingRule() && format.nationalPrefixIsOptionalWhenFormatting() && !enforce_national_prefix;\n\n\tif (!international && !national_prefix_may_be_omitted) {\n\t\treturn number.replace(format_pattern_matcher, format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule()));\n\t}\n\n\tvar formatted_number = number.replace(format_pattern_matcher, international ? format.internationalFormat() : format.format());\n\n\tif (international) {\n\t\treturn local_to_international_style(formatted_number);\n\t}\n\n\treturn formatted_number;\n}\n\nfunction format_national_number(number, format_as, enforce_national_prefix, metadata) {\n\tvar format = choose_format_for_number(metadata.formats(), number);\n\n\tif (!format) {\n\t\treturn number;\n\t}\n\n\treturn format_national_number_using_format(number, format, format_as === 'International', enforce_national_prefix, metadata);\n}\n\nexport function choose_format_for_number(available_formats, national_number) {\n\tfor (var _iterator = available_formats, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n\t\tvar _ref;\n\n\t\tif (_isArray) {\n\t\t\tif (_i >= _iterator.length) break;\n\t\t\t_ref = _iterator[_i++];\n\t\t} else {\n\t\t\t_i = _iterator.next();\n\t\t\tif (_i.done) break;\n\t\t\t_ref = _i.value;\n\t\t}\n\n\t\tvar _format = _ref;\n\n\t\t// Validate leading digits\n\t\tif (_format.leadingDigitsPatterns().length > 0) {\n\t\t\t// The last leading_digits_pattern is used here, as it is the most detailed\n\t\t\tvar last_leading_digits_pattern = _format.leadingDigitsPatterns()[_format.leadingDigitsPatterns().length - 1];\n\n\t\t\t// If leading digits don't match then move on to the next phone number format\n\t\t\tif (national_number.search(last_leading_digits_pattern) !== 0) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\t// Check that the national number matches the phone number format regular expression\n\t\tif (matches_entirely(national_number, new RegExp(_format.pattern()))) {\n\t\t\treturn _format;\n\t\t}\n\t}\n}\n\n// Removes brackets and replaces dashes with spaces.\n//\n// E.g. \"(999) 111-22-33\" -> \"999 111 22 33\"\n//\nexport function local_to_international_style(local) {\n\treturn local.replace(new RegExp('[' + VALID_PUNCTUATION + ']+', 'g'), ' ').trim();\n}\n\n// Sort out arguments\nfunction sort_out_arguments(arg_1, arg_2, arg_3, arg_4, arg_5) {\n\tvar input = void 0;\n\tvar format_type = void 0;\n\tvar options = void 0;\n\tvar metadata = void 0;\n\n\t// Sort out arguments.\n\n\t// If the phone number is passed as a string.\n\t// `format('8005553535', ...)`.\n\tif (typeof arg_1 === 'string') {\n\t\t// If country code is supplied.\n\t\t// `format('8005553535', 'RU', 'National', [options], metadata)`.\n\t\tif (typeof arg_3 === 'string') {\n\t\t\t// Will be `parse()`d later in code\n\t\t\tinput = {\n\t\t\t\tphone: arg_1,\n\t\t\t\tcountry: arg_2\n\t\t\t};\n\n\t\t\tformat_type = arg_3;\n\n\t\t\tif (arg_5) {\n\t\t\t\toptions = arg_4;\n\t\t\t\tmetadata = arg_5;\n\t\t\t} else {\n\t\t\t\tmetadata = arg_4;\n\t\t\t}\n\t\t}\n\t\t// Just an international phone number is supplied\n\t\t// `format('+78005553535', 'National', [options], metadata)`.\n\t\telse {\n\t\t\t\t// Will be `parse()`d later in code\n\t\t\t\tinput = {\n\t\t\t\t\tphone: arg_1\n\t\t\t\t};\n\n\t\t\t\tif (typeof arg_2 !== 'string') {\n\t\t\t\t\tthrow new Error('Format type argument not passed for `format()`');\n\t\t\t\t}\n\n\t\t\t\tformat_type = arg_2;\n\n\t\t\t\tif (arg_4) {\n\t\t\t\t\toptions = arg_3;\n\t\t\t\t\tmetadata = arg_4;\n\t\t\t\t} else {\n\t\t\t\t\tmetadata = arg_3;\n\t\t\t\t}\n\t\t\t}\n\t}\n\t// If the phone number is passed as a parsed number object.\n\t// `format({ phone: '8005553535', country: 'RU' }, 'National', [options], metadata)`.\n\telse if (is_object(arg_1) && typeof arg_1.phone === 'string') {\n\t\t\tinput = arg_1;\n\t\t\tformat_type = arg_2;\n\n\t\t\tif (arg_4) {\n\t\t\t\toptions = arg_3;\n\t\t\t\tmetadata = arg_4;\n\t\t\t} else {\n\t\t\t\tmetadata = arg_3;\n\t\t\t}\n\t\t} else throw new TypeError('A phone number must either be a string or an object of shape { phone, [country] }.');\n\n\t// Validate `format_type`.\n\tswitch (format_type) {\n\t\tcase 'International':\n\t\tcase 'E.164':\n\t\tcase 'National':\n\t\tcase 'RFC3966':\n\t\tcase 'IDD':\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow new Error('Unknown format type argument passed to \"format()\": \"' + format_type + '\"');\n\t}\n\n\t// Apply default options.\n\tif (options) {\n\t\toptions = _extends({}, defaultOptions, options);\n\t} else {\n\t\toptions = defaultOptions;\n\t}\n\n\treturn { input: input, format_type: format_type, options: options, metadata: new Metadata(metadata) };\n}\n\n// Babel transforms `typeof` into some \"branches\"\n// so istanbul will show this as \"branch not covered\".\n/* istanbul ignore next */\nvar is_object = function is_object(_) {\n\treturn (typeof _ === 'undefined' ? 'undefined' : _typeof(_)) === 'object';\n};\n\nfunction add_extension(number, ext, metadata, formatExtension) {\n\treturn ext ? formatExtension(number, ext, metadata) : number;\n}\n\nexport function formatIDDSameCountryCallingCodeNumber(number, toCountryCallingCode, fromCountry, toCountryMetadata) {\n\tvar fromCountryMetadata = new Metadata(toCountryMetadata.metadata);\n\tfromCountryMetadata.country(fromCountry);\n\n\t// If calling within the same country calling code.\n\tif (toCountryCallingCode === fromCountryMetadata.countryCallingCode()) {\n\t\t// For NANPA regions, return the national format for these regions\n\t\t// but prefix it with the country calling code.\n\t\tif (toCountryCallingCode === '1') {\n\t\t\treturn toCountryCallingCode + ' ' + format_national_number(number, 'National', false, toCountryMetadata);\n\t\t}\n\n\t\t// If regions share a country calling code, the country calling code need\n\t\t// not be dialled. This also applies when dialling within a region, so this\n\t\t// if clause covers both these cases. Technically this is the case for\n\t\t// dialling from La Reunion to other overseas departments of France (French\n\t\t// Guiana, Martinique, Guadeloupe), but not vice versa - so we don't cover\n\t\t// this edge case for now and for those cases return the version including\n\t\t// country calling code. Details here:\n\t\t// http://www.petitfute.com/voyage/225-info-pratiques-reunion\n\t\treturn format_national_number(number, 'National', false, toCountryMetadata);\n\t}\n}\n//# sourceMappingURL=format.js.map","import Metadata from './metadata';\nimport { matches_entirely, VALID_DIGITS } from './common';\n\nvar CAPTURING_DIGIT_PATTERN = new RegExp('([' + VALID_DIGITS + '])');\n\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 */\nvar SINGLE_IDD_PREFIX = /[\\d]+(?:[~\\u2053\\u223C\\uFF5E][\\d]+)?/;\n\n// export function isSingleIDDPrefix(IDDPrefix)\n// {\n// \treturn matches_entirely(IDDPrefix, SINGLE_IDD_PREFIX)\n// }\n\n// For regions that have multiple international prefixes, the international format\n// of the number is returned, unless there is a preferred international prefix.\nexport function getIDDPrefix(country, metadata) {\n\tvar countryMetadata = new Metadata(metadata);\n\tcountryMetadata.country(country);\n\n\tif (matches_entirely(countryMetadata.IDDPrefix(), SINGLE_IDD_PREFIX)) {\n\t\treturn countryMetadata.IDDPrefix();\n\t}\n\n\treturn countryMetadata.defaultIDDPrefix();\n}\n\nexport function stripIDDPrefix(number, country, metadata) {\n\tif (!country) {\n\t\treturn;\n\t}\n\n\t// Check if the number is IDD-prefixed.\n\n\tvar IDDPrefixPattern = new RegExp(getIDDPrefix(country, metadata));\n\n\tif (number.search(IDDPrefixPattern) !== 0) {\n\t\treturn;\n\t}\n\n\t// Strip IDD prefix.\n\tnumber = number.slice(number.match(IDDPrefixPattern)[0].length);\n\n\t// Some kind of a weird edge case.\n\t// No explanation from Google given.\n\tvar matchedGroups = number.match(CAPTURING_DIGIT_PATTERN);\n\t/* istanbul ignore next */\n\tif (matchedGroups && matchedGroups[1] != null && matchedGroups[1].length > 0) {\n\t\tif (matchedGroups[1] === '0') {\n\t\t\treturn;\n\t\t}\n\t}\n\n\treturn number;\n}\n//# sourceMappingURL=IDD.js.map","var _createClass = function () { function 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n// This is an enhanced port of Google Android `libphonenumber`'s\n// `asyoutypeformatter.js` of 17th November, 2016.\n//\n// https://github.com/googlei18n/libphonenumber/blob/8d21a365061de2ba0675c878a710a7b24f74d2ae/javascript/i18n/phonenumbers/asyoutypeformatter.js\n\nimport Metadata from './metadata';\n\nimport { matches_entirely, VALID_DIGITS, VALID_PUNCTUATION, PLUS_CHARS, parse_phone_number_digits, parse_national_number_and_country_calling_code } from './common';\n\nimport { extract_formatted_phone_number, find_country_code, strip_national_prefix_and_carrier_code } from './parse';\n\nimport { FIRST_GROUP_PATTERN, format_national_number_using_format, local_to_international_style } from './format';\n\nimport { check_number_length_for_type } from './types';\n\n// Used in phone number format template creation.\n// Could be any digit, I guess.\nvar DUMMY_DIGIT = '9';\nvar DUMMY_DIGIT_MATCHER = new RegExp(DUMMY_DIGIT, 'g');\n// I don't know why is it exactly `15`\nvar LONGEST_NATIONAL_PHONE_NUMBER_LENGTH = 15;\n// 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.\nvar LONGEST_DUMMY_PHONE_NUMBER = repeat(DUMMY_DIGIT, LONGEST_NATIONAL_PHONE_NUMBER_LENGTH);\n\n// The digits that have not been entered yet will be represented by a \\u2008,\n// the punctuation space.\nexport var DIGIT_PLACEHOLDER = 'x'; // '\\u2008' (punctuation space)\nvar DIGIT_PLACEHOLDER_MATCHER = new RegExp(DIGIT_PLACEHOLDER);\nvar DIGIT_PLACEHOLDER_MATCHER_GLOBAL = new RegExp(DIGIT_PLACEHOLDER, 'g');\n\n// A pattern that is used to match character classes in regular expressions.\n// An example of a character class is \"[1-4]\".\nvar CHARACTER_CLASS_PATTERN = /\\[([^\\[\\]])*\\]/g;\n\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.\nvar STANDALONE_DIGIT_PATTERN = /\\d(?=[^,}][^,}])/g;\n\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\".\nvar ELIGIBLE_FORMAT_PATTERN = new RegExp('^' + '[' + VALID_PUNCTUATION + ']*' + '(\\\\$\\\\d[' + VALID_PUNCTUATION + ']*)+' + '$');\n\n// 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.\nvar MIN_LEADING_DIGITS_LENGTH = 3;\n\nvar VALID_INCOMPLETE_PHONE_NUMBER = '[' + PLUS_CHARS + ']{0,1}' + '[' + VALID_PUNCTUATION + VALID_DIGITS + ']*';\n\nvar VALID_INCOMPLETE_PHONE_NUMBER_PATTERN = new RegExp('^' + VALID_INCOMPLETE_PHONE_NUMBER + '$', 'i');\n\nvar AsYouType = function () {\n\n\t/**\r\n * @param {string} [country_code] - The default country used for parsing non-international phone numbers.\r\n * @param {Object} metadata\r\n */\n\tfunction AsYouType(country_code, metadata) {\n\t\t_classCallCheck(this, AsYouType);\n\n\t\tthis.options = {};\n\n\t\tthis.metadata = new Metadata(metadata);\n\n\t\tif (country_code && this.metadata.hasCountry(country_code)) {\n\t\t\tthis.default_country = country_code;\n\t\t}\n\n\t\tthis.reset();\n\t}\n\t// Not setting `options` to a constructor argument\n\t// not to break backwards compatibility\n\t// for older versions of the library.\n\n\n\t_createClass(AsYouType, [{\n\t\tkey: 'input',\n\t\tvalue: function input(text) {\n\t\t\t// Parse input\n\n\t\t\tvar extracted_number = extract_formatted_phone_number(text) || '';\n\n\t\t\t// Special case for a lone '+' sign\n\t\t\t// since it's not considered a possible phone number.\n\t\t\tif (!extracted_number) {\n\t\t\t\tif (text && text.indexOf('+') >= 0) {\n\t\t\t\t\textracted_number = '+';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Validate possible first part of a phone number\n\t\t\tif (!matches_entirely(extracted_number, VALID_INCOMPLETE_PHONE_NUMBER_PATTERN)) {\n\t\t\t\treturn this.current_output;\n\t\t\t}\n\n\t\t\treturn this.process_input(parse_phone_number_digits(extracted_number));\n\t\t}\n\t}, {\n\t\tkey: 'process_input',\n\t\tvalue: function process_input(input) {\n\t\t\t// If an out of position '+' sign detected\n\t\t\t// (or a second '+' sign),\n\t\t\t// then just drop it from the input.\n\t\t\tif (input[0] === '+') {\n\t\t\t\tif (!this.parsed_input) {\n\t\t\t\t\tthis.parsed_input += '+';\n\n\t\t\t\t\t// If a default country was set\n\t\t\t\t\t// then reset it because an explicitly international\n\t\t\t\t\t// phone number is being entered\n\t\t\t\t\tthis.reset_countriness();\n\t\t\t\t}\n\n\t\t\t\tinput = input.slice(1);\n\t\t\t}\n\n\t\t\t// Raw phone number\n\t\t\tthis.parsed_input += input;\n\n\t\t\t// // Reset phone number validation state\n\t\t\t// this.valid = false\n\n\t\t\t// Add digits to the national number\n\t\t\tthis.national_number += input;\n\n\t\t\t// TODO: Deprecated: rename `this.national_number`\n\t\t\t// to `this.nationalNumber` and remove `.getNationalNumber()`.\n\n\t\t\t// Try to format the parsed input\n\n\t\t\tif (this.is_international()) {\n\t\t\t\tif (!this.countryCallingCode) {\n\t\t\t\t\t// No need to format anything\n\t\t\t\t\t// if there's no national phone number.\n\t\t\t\t\t// (e.g. just the country calling code)\n\t\t\t\t\tif (!this.national_number) {\n\t\t\t\t\t\t// Return raw phone number\n\t\t\t\t\t\treturn this.parsed_input;\n\t\t\t\t\t}\n\n\t\t\t\t\t// If one looks at country phone codes\n\t\t\t\t\t// then he can notice that no one country phone code\n\t\t\t\t\t// is ever a (leftmost) substring of another country phone code.\n\t\t\t\t\t// So if a valid country code is extracted so far\n\t\t\t\t\t// then it means that this is the country code.\n\n\t\t\t\t\t// If no country phone code could be extracted so far,\n\t\t\t\t\t// then just return the raw phone number,\n\t\t\t\t\t// because it has no way of knowing\n\t\t\t\t\t// how to format the phone number so far.\n\t\t\t\t\tif (!this.extract_country_calling_code()) {\n\t\t\t\t\t\t// Return raw phone number\n\t\t\t\t\t\treturn this.parsed_input;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Initialize country-specific data\n\t\t\t\t\tthis.initialize_phone_number_formats_for_this_country_calling_code();\n\t\t\t\t\tthis.reset_format();\n\t\t\t\t\tthis.determine_the_country();\n\t\t\t\t}\n\t\t\t\t// `this.country` could be `undefined`,\n\t\t\t\t// for instance, when there is ambiguity\n\t\t\t\t// in a form of several different countries\n\t\t\t\t// each corresponding to the same country phone code\n\t\t\t\t// (e.g. NANPA: USA, Canada, etc),\n\t\t\t\t// and there's not enough digits entered\n\t\t\t\t// to reliably determine the country\n\t\t\t\t// the phone number belongs to.\n\t\t\t\t// Therefore, in cases of such ambiguity,\n\t\t\t\t// each time something is input,\n\t\t\t\t// try to determine the country\n\t\t\t\t// (if it's not determined yet).\n\t\t\t\telse if (!this.country) {\n\t\t\t\t\t\tthis.determine_the_country();\n\t\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Some national prefixes are substrings of other national prefixes\n\t\t\t\t// (for the same country), therefore try to extract national prefix each time\n\t\t\t\t// because a longer national prefix might be available at some point in time.\n\n\t\t\t\tvar previous_national_prefix = this.national_prefix;\n\t\t\t\tthis.national_number = this.national_prefix + this.national_number;\n\n\t\t\t\t// Possibly extract a national prefix\n\t\t\t\tthis.extract_national_prefix();\n\n\t\t\t\tif (this.national_prefix !== previous_national_prefix) {\n\t\t\t\t\t// National number has changed\n\t\t\t\t\t// (due to another national prefix been extracted)\n\t\t\t\t\t// therefore national number has changed\n\t\t\t\t\t// therefore reset all previous formatting data.\n\t\t\t\t\t// (and leading digits matching state)\n\t\t\t\t\tthis.matching_formats = this.available_formats;\n\t\t\t\t\tthis.reset_format();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!this.should_format()) {\n\t\t\t\treturn this.format_as_non_formatted_number();\n\t\t\t}\n\n\t\t\t// Check the available phone number formats\n\t\t\t// based on the currently available leading digits.\n\t\t\tthis.match_formats_by_leading_digits();\n\n\t\t\t// Format the phone number (given the next digits)\n\t\t\tvar formatted_national_phone_number = this.format_national_phone_number(input);\n\n\t\t\t// If the phone number could be formatted,\n\t\t\t// then return it, possibly prepending with country phone code\n\t\t\t// (for international phone numbers only)\n\t\t\tif (formatted_national_phone_number) {\n\t\t\t\treturn this.full_phone_number(formatted_national_phone_number);\n\t\t\t}\n\n\t\t\t// If the phone number couldn't be formatted,\n\t\t\t// then just fall back to the raw phone number.\n\t\t\treturn this.parsed_input;\n\t\t}\n\t}, {\n\t\tkey: 'format_as_non_formatted_number',\n\t\tvalue: function format_as_non_formatted_number() {\n\t\t\tif (this.is_international() && this.countryCallingCode) {\n\t\t\t\tif (this.national_number) {\n\t\t\t\t\t// For convenience, the public `.template` property\n\t\t\t\t\t// contains the whole international number\n\t\t\t\t\t// if the phone number being input is international:\n\t\t\t\t\t// 'x' for the '+' sign, 'x'es for the country phone code,\n\t\t\t\t\t// a spacebar and then the template for the national number digits.\n\t\t\t\t\tthis.template = DIGIT_PLACEHOLDER + repeat(DIGIT_PLACEHOLDER, this.countryCallingCode.length) + ' ' + repeat(DIGIT_PLACEHOLDER, this.national_number.length);\n\n\t\t\t\t\treturn '+' + this.countryCallingCode + ' ' + this.national_number;\n\t\t\t\t}\n\n\t\t\t\treturn '+' + this.countryCallingCode;\n\t\t\t}\n\n\t\t\treturn this.parsed_input;\n\t\t}\n\t}, {\n\t\tkey: 'format_national_phone_number',\n\t\tvalue: function format_national_phone_number(next_digits) {\n\t\t\t// Format the next phone number digits\n\t\t\t// using the previously chosen phone number format.\n\t\t\t//\n\t\t\t// This is done here because if `attempt_to_format_complete_phone_number`\n\t\t\t// was placed before this call then the `template`\n\t\t\t// wouldn't reflect the situation correctly (and would therefore be inconsistent)\n\t\t\t//\n\t\t\tvar national_number_formatted_with_previous_format = void 0;\n\t\t\tif (this.chosen_format) {\n\t\t\t\tnational_number_formatted_with_previous_format = this.format_next_national_number_digits(next_digits);\n\t\t\t}\n\n\t\t\t// See if the input digits can be formatted properly already. If not,\n\t\t\t// use the results from format_next_national_number_digits(), which does formatting\n\t\t\t// based on the formatting pattern chosen.\n\n\t\t\tvar formatted_number = this.attempt_to_format_complete_phone_number();\n\n\t\t\t// Just because a phone number doesn't have a suitable format\n\t\t\t// that doesn't mean that the phone is invalid\n\t\t\t// because phone number formats only format phone numbers,\n\t\t\t// they don't validate them and some (rare) phone numbers\n\t\t\t// are meant to stay non-formatted.\n\t\t\tif (formatted_number) {\n\t\t\t\t// if (this.country)\n\t\t\t\t// {\n\t\t\t\t// \tthis.valid = true\n\t\t\t\t// }\n\n\t\t\t\treturn formatted_number;\n\t\t\t}\n\n\t\t\t// For some phone number formats national prefix\n\n\t\t\t// If the previously chosen phone number format\n\t\t\t// didn't match the next (current) digit being input\n\t\t\t// (leading digits pattern didn't match).\n\t\t\tif (this.choose_another_format()) {\n\t\t\t\t// And a more appropriate phone number format\n\t\t\t\t// has been chosen for these `leading digits`,\n\t\t\t\t// then format the national phone number (so far)\n\t\t\t\t// using the newly selected phone number pattern.\n\n\t\t\t\t// Will return `undefined` if it couldn't format\n\t\t\t\t// the supplied national number\n\t\t\t\t// using the selected phone number pattern.\n\n\t\t\t\treturn this.reformat_national_number();\n\t\t\t}\n\n\t\t\t// If could format the next (current) digit\n\t\t\t// using the previously chosen phone number format\n\t\t\t// then return the formatted number so far.\n\n\t\t\t// If no new phone number format could be chosen,\n\t\t\t// and couldn't format the supplied national number\n\t\t\t// using the selected phone number pattern,\n\t\t\t// then it will return `undefined`.\n\n\t\t\treturn national_number_formatted_with_previous_format;\n\t\t}\n\t}, {\n\t\tkey: 'reset',\n\t\tvalue: function reset() {\n\t\t\t// Input stripped of non-phone-number characters.\n\t\t\t// Can only contain a possible leading '+' sign and digits.\n\t\t\tthis.parsed_input = '';\n\n\t\t\tthis.current_output = '';\n\n\t\t\t// This contains the national prefix that has been extracted. It contains only\n\t\t\t// digits without formatting.\n\t\t\tthis.national_prefix = '';\n\n\t\t\tthis.national_number = '';\n\n\t\t\tthis.reset_countriness();\n\n\t\t\tthis.reset_format();\n\n\t\t\t// this.valid = false\n\n\t\t\treturn this;\n\t\t}\n\t}, {\n\t\tkey: 'reset_country',\n\t\tvalue: function reset_country() {\n\t\t\tif (this.is_international()) {\n\t\t\t\tthis.country = undefined;\n\t\t\t} else {\n\t\t\t\tthis.country = this.default_country;\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: 'reset_countriness',\n\t\tvalue: function reset_countriness() {\n\t\t\tthis.reset_country();\n\n\t\t\tif (this.default_country && !this.is_international()) {\n\t\t\t\tthis.metadata.country(this.default_country);\n\t\t\t\tthis.countryCallingCode = this.metadata.countryCallingCode();\n\n\t\t\t\tthis.initialize_phone_number_formats_for_this_country_calling_code();\n\t\t\t} else {\n\t\t\t\tthis.metadata.country(undefined);\n\t\t\t\tthis.countryCallingCode = undefined;\n\n\t\t\t\tthis.available_formats = [];\n\t\t\t\tthis.matching_formats = this.available_formats;\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: 'reset_format',\n\t\tvalue: function reset_format() {\n\t\t\tthis.chosen_format = undefined;\n\t\t\tthis.template = undefined;\n\t\t\tthis.partially_populated_template = undefined;\n\t\t\tthis.last_match_position = -1;\n\t\t}\n\n\t\t// Format each digit of national phone number (so far)\n\t\t// using the newly selected phone number pattern.\n\n\t}, {\n\t\tkey: 'reformat_national_number',\n\t\tvalue: function reformat_national_number() {\n\t\t\t// Format each digit of national phone number (so far)\n\t\t\t// using the selected phone number pattern.\n\t\t\treturn this.format_next_national_number_digits(this.national_number);\n\t\t}\n\t}, {\n\t\tkey: 'initialize_phone_number_formats_for_this_country_calling_code',\n\t\tvalue: function initialize_phone_number_formats_for_this_country_calling_code() {\n\t\t\t// Get all \"eligible\" phone number formats for this country\n\t\t\tthis.available_formats = this.metadata.formats().filter(function (format) {\n\t\t\t\treturn ELIGIBLE_FORMAT_PATTERN.test(format.internationalFormat());\n\t\t\t});\n\n\t\t\tthis.matching_formats = this.available_formats;\n\t\t}\n\t}, {\n\t\tkey: 'match_formats_by_leading_digits',\n\t\tvalue: function match_formats_by_leading_digits() {\n\t\t\tvar leading_digits = this.national_number;\n\n\t\t\t// \"leading digits\" pattern list starts with\n\t\t\t// one of a maximum length of 3 digits,\n\t\t\t// and then with each additional digit\n\t\t\t// a more precise \"leading digits\" pattern is specified.\n\n\t\t\tvar index_of_leading_digits_pattern = leading_digits.length - MIN_LEADING_DIGITS_LENGTH;\n\n\t\t\tif (index_of_leading_digits_pattern < 0) {\n\t\t\t\tindex_of_leading_digits_pattern = 0;\n\t\t\t}\n\n\t\t\tthis.matching_formats = this.matching_formats.filter(function (format) {\n\t\t\t\tvar leading_digits_pattern_count = format.leadingDigitsPatterns().length;\n\n\t\t\t\t// Keep everything that isn't restricted by leading digits.\n\t\t\t\tif (leading_digits_pattern_count === 0) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tvar leading_digits_pattern_index = Math.min(index_of_leading_digits_pattern, leading_digits_pattern_count - 1);\n\t\t\t\tvar leading_digits_pattern = format.leadingDigitsPatterns()[leading_digits_pattern_index];\n\n\t\t\t\t// Brackets are required for `^` to be applied to\n\t\t\t\t// all or-ed (`|`) parts, not just the first one.\n\t\t\t\treturn new RegExp('^(' + leading_digits_pattern + ')').test(leading_digits);\n\t\t\t});\n\n\t\t\t// If there was a phone number format chosen\n\t\t\t// and it no longer holds given the new leading digits then reset it.\n\t\t\t// The test for this `if` condition is marked as:\n\t\t\t// \"Reset a chosen format when it no longer holds given the new leading digits\".\n\t\t\t// To construct a valid test case for this one can find a country\n\t\t\t// in `PhoneNumberMetadata.xml` yielding one format for 3 ``\n\t\t\t// and yielding another format for 4 `` (Australia in this case).\n\t\t\tif (this.chosen_format && this.matching_formats.indexOf(this.chosen_format) === -1) {\n\t\t\t\tthis.reset_format();\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: 'should_format',\n\t\tvalue: function should_format() {\n\t\t\t// Start matching any formats at all when the national number\n\t\t\t// entered so far is at least 3 digits long,\n\t\t\t// otherwise format matching would give false negatives\n\t\t\t// like when the digits entered so far are `2`\n\t\t\t// and the leading digits pattern is `21` –\n\t\t\t// it's quite obvious in this case that the format could be the one\n\t\t\t// but due to the absence of further digits it would give false negative.\n\t\t\t//\n\t\t\t// Google could have provided leading digits patterns starting\n\t\t\t// with a single digit but they chose not to (for whatever reasons).\n\t\t\t//\n\t\t\treturn this.national_number >= MIN_LEADING_DIGITS_LENGTH;\n\t\t}\n\n\t\t// Check to see if there is an exact pattern match for these digits. If so, we\n\t\t// should use this instead of any other formatting template whose\n\t\t// `leadingDigitsPattern` also matches the input.\n\n\t}, {\n\t\tkey: 'attempt_to_format_complete_phone_number',\n\t\tvalue: function attempt_to_format_complete_phone_number() {\n\t\t\tfor (var _iterator = this.matching_formats, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n\t\t\t\tvar _ref;\n\n\t\t\t\tif (_isArray) {\n\t\t\t\t\tif (_i >= _iterator.length) break;\n\t\t\t\t\t_ref = _iterator[_i++];\n\t\t\t\t} else {\n\t\t\t\t\t_i = _iterator.next();\n\t\t\t\t\tif (_i.done) break;\n\t\t\t\t\t_ref = _i.value;\n\t\t\t\t}\n\n\t\t\t\tvar format = _ref;\n\n\t\t\t\tvar matcher = new RegExp('^(?:' + format.pattern() + ')$');\n\n\t\t\t\tif (!matcher.test(this.national_number)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (!this.is_format_applicable(format)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// To leave the formatter in a consistent state\n\t\t\t\tthis.reset_format();\n\t\t\t\tthis.chosen_format = format;\n\n\t\t\t\tvar formatted_number = format_national_number_using_format(this.national_number, format, this.is_international(), this.national_prefix.length > 0, this.metadata);\n\n\t\t\t\t// Set `this.template` and `this.partially_populated_template`.\n\t\t\t\t//\n\t\t\t\t// `else` case doesn't ever happen\n\t\t\t\t// with the current metadata,\n\t\t\t\t// but just in case.\n\t\t\t\t//\n\t\t\t\t/* istanbul ignore else */\n\t\t\t\tif (this.create_formatting_template(format)) {\n\t\t\t\t\t// Populate `this.partially_populated_template`\n\t\t\t\t\tthis.reformat_national_number();\n\t\t\t\t} else {\n\t\t\t\t\t// Prepend `+CountryCode` in case of an international phone number\n\t\t\t\t\tvar full_number = this.full_phone_number(formatted_number);\n\t\t\t\t\tthis.template = full_number.replace(/[\\d\\+]/g, DIGIT_PLACEHOLDER);\n\t\t\t\t\tthis.partially_populated_template = full_number;\n\t\t\t\t}\n\n\t\t\t\treturn formatted_number;\n\t\t\t}\n\t\t}\n\n\t\t// Prepends `+CountryCode` in case of an international phone number\n\n\t}, {\n\t\tkey: 'full_phone_number',\n\t\tvalue: function full_phone_number(formatted_national_number) {\n\t\t\tif (this.is_international()) {\n\t\t\t\treturn '+' + this.countryCallingCode + ' ' + formatted_national_number;\n\t\t\t}\n\n\t\t\treturn formatted_national_number;\n\t\t}\n\n\t\t// Extracts the country calling code from the beginning\n\t\t// of the entered `national_number` (so far),\n\t\t// and places the remaining input into the `national_number`.\n\n\t}, {\n\t\tkey: 'extract_country_calling_code',\n\t\tvalue: function extract_country_calling_code() {\n\t\t\tvar _parse_national_numbe = parse_national_number_and_country_calling_code(this.parsed_input, this.options.fromCountry, this.metadata),\n\t\t\t countryCallingCode = _parse_national_numbe.countryCallingCode,\n\t\t\t number = _parse_national_numbe.number;\n\n\t\t\tif (!countryCallingCode) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.countryCallingCode = countryCallingCode;\n\t\t\tthis.national_number = number;\n\n\t\t\tthis.metadata.chooseCountryByCountryCallingCode(countryCallingCode);\n\t\t\treturn this.metadata.selectedCountry() !== undefined;\n\t\t}\n\t}, {\n\t\tkey: 'extract_national_prefix',\n\t\tvalue: function extract_national_prefix() {\n\t\t\tthis.national_prefix = '';\n\n\t\t\tif (!this.metadata.selectedCountry()) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Only strip national prefixes for non-international phone numbers\n\t\t\t// because national prefixes can't be present in international phone numbers.\n\t\t\t// Otherwise, while forgiving, it would parse a NANPA number `+1 1877 215 5230`\n\t\t\t// first to `1877 215 5230` and then, stripping the leading `1`, to `877 215 5230`,\n\t\t\t// and then it would assume that's a valid number which it isn't.\n\t\t\t// So no forgiveness for grandmas here.\n\t\t\t// The issue asking for this fix:\n\t\t\t// https://github.com/catamphetamine/libphonenumber-js/issues/159\n\n\t\t\tvar _strip_national_prefi = strip_national_prefix_and_carrier_code(this.national_number, this.metadata),\n\t\t\t potential_national_number = _strip_national_prefi.number;\n\n\t\t\t// We require that the NSN remaining after stripping the national prefix and\n\t\t\t// carrier code be long enough to be a possible length for the region.\n\t\t\t// Otherwise, we don't do the stripping, since the original number could be\n\t\t\t// a valid short number.\n\n\n\t\t\tif (!this.metadata.possibleLengths() || this.is_possible_number(this.national_number) && !this.is_possible_number(potential_national_number)) {\n\t\t\t\t// Verify the parsed national (significant) number for this country\n\t\t\t\tvar national_number_rule = new RegExp(this.metadata.nationalNumberPattern());\n\t\t\t\t//\n\t\t\t\t// If the original number (before stripping national prefix) was viable,\n\t\t\t\t// and the resultant number is not, then prefer the original phone number.\n\t\t\t\t// This is because for some countries (e.g. Russia) the same digit could be both\n\t\t\t\t// a national prefix and a leading digit of a valid national phone number,\n\t\t\t\t// like `8` is the national prefix for Russia and both\n\t\t\t\t// `8 800 555 35 35` and `800 555 35 35` are valid numbers.\n\t\t\t\tif (matches_entirely(this.national_number, national_number_rule) && !matches_entirely(potential_national_number, national_number_rule)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.national_prefix = this.national_number.slice(0, this.national_number.length - potential_national_number.length);\n\t\t\tthis.national_number = potential_national_number;\n\n\t\t\treturn this.national_prefix;\n\t\t}\n\t}, {\n\t\tkey: 'is_possible_number',\n\t\tvalue: function is_possible_number(number) {\n\t\t\tvar validation_result = check_number_length_for_type(number, undefined, this.metadata);\n\t\t\tswitch (validation_result) {\n\t\t\t\tcase 'IS_POSSIBLE':\n\t\t\t\t\treturn true;\n\t\t\t\t// case 'IS_POSSIBLE_LOCAL_ONLY':\n\t\t\t\t// \treturn !this.is_international()\n\t\t\t\tdefault:\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: 'choose_another_format',\n\t\tvalue: function choose_another_format() {\n\t\t\t// When there are multiple available formats, the formatter uses the first\n\t\t\t// format where a formatting template could be created.\n\t\t\tfor (var _iterator2 = this.matching_formats, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {\n\t\t\t\tvar _ref2;\n\n\t\t\t\tif (_isArray2) {\n\t\t\t\t\tif (_i2 >= _iterator2.length) break;\n\t\t\t\t\t_ref2 = _iterator2[_i2++];\n\t\t\t\t} else {\n\t\t\t\t\t_i2 = _iterator2.next();\n\t\t\t\t\tif (_i2.done) break;\n\t\t\t\t\t_ref2 = _i2.value;\n\t\t\t\t}\n\n\t\t\t\tvar format = _ref2;\n\n\t\t\t\t// If this format is currently being used\n\t\t\t\t// and is still possible, then stick to it.\n\t\t\t\tif (this.chosen_format === format) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// If this `format` is suitable for \"as you type\",\n\t\t\t\t// then extract the template from this format\n\t\t\t\t// and use it to format the phone number being input.\n\n\t\t\t\tif (!this.is_format_applicable(format)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (!this.create_formatting_template(format)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tthis.chosen_format = format;\n\n\t\t\t\t// With a new formatting template, the matched position\n\t\t\t\t// using the old template needs to be reset.\n\t\t\t\tthis.last_match_position = -1;\n\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t// No format matches the phone number,\n\t\t\t// therefore set `country` to `undefined`\n\t\t\t// (or to the default country).\n\t\t\tthis.reset_country();\n\n\t\t\t// No format matches the national phone number entered\n\t\t\tthis.reset_format();\n\t\t}\n\t}, {\n\t\tkey: 'is_format_applicable',\n\t\tvalue: function is_format_applicable(format) {\n\t\t\t// If national prefix is mandatory for this phone number format\n\t\t\t// and the user didn't input the national prefix,\n\t\t\t// then this phone number format isn't suitable.\n\t\t\tif (!this.is_international() && !this.national_prefix && format.nationalPrefixIsMandatoryWhenFormatting()) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\t}, {\n\t\tkey: 'create_formatting_template',\n\t\tvalue: function create_formatting_template(format) {\n\t\t\t// The formatter doesn't format numbers when numberPattern contains '|', e.g.\n\t\t\t// (20|3)\\d{4}. In those cases we quickly return.\n\t\t\t// (Though there's no such format in current metadata)\n\t\t\t/* istanbul ignore if */\n\t\t\tif (format.pattern().indexOf('|') >= 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Get formatting template for this phone number format\n\t\t\tvar template = this.get_template_for_phone_number_format_pattern(format);\n\n\t\t\t// If the national number entered is too long\n\t\t\t// for any phone number format, then abort.\n\t\t\tif (!template) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// This one is for national number only\n\t\t\tthis.partially_populated_template = template;\n\n\t\t\t// For convenience, the public `.template` property\n\t\t\t// contains the whole international number\n\t\t\t// if the phone number being input is international:\n\t\t\t// 'x' for the '+' sign, 'x'es for the country phone code,\n\t\t\t// a spacebar and then the template for the formatted national number.\n\t\t\tif (this.is_international()) {\n\t\t\t\tthis.template = DIGIT_PLACEHOLDER + repeat(DIGIT_PLACEHOLDER, this.countryCallingCode.length) + ' ' + template;\n\t\t\t}\n\t\t\t// For local numbers, replace national prefix\n\t\t\t// with a digit placeholder.\n\t\t\telse {\n\t\t\t\t\tthis.template = template.replace(/\\d/g, DIGIT_PLACEHOLDER);\n\t\t\t\t}\n\n\t\t\t// This one is for the full phone number\n\t\t\treturn this.template;\n\t\t}\n\n\t\t// Generates formatting template for a phone number format\n\n\t}, {\n\t\tkey: 'get_template_for_phone_number_format_pattern',\n\t\tvalue: function get_template_for_phone_number_format_pattern(format) {\n\t\t\t// A very smart trick by the guys at Google\n\t\t\tvar number_pattern = format.pattern()\n\t\t\t// Replace anything in the form of [..] with \\d\n\t\t\t.replace(CHARACTER_CLASS_PATTERN, '\\\\d')\n\t\t\t// Replace any standalone digit (not the one in `{}`) with \\d\n\t\t\t.replace(STANDALONE_DIGIT_PATTERN, '\\\\d');\n\n\t\t\t// This match will always succeed,\n\t\t\t// because the \"longest dummy phone number\"\n\t\t\t// has enough length to accomodate any possible\n\t\t\t// national phone number format pattern.\n\t\t\tvar dummy_phone_number_matching_format_pattern = LONGEST_DUMMY_PHONE_NUMBER.match(number_pattern)[0];\n\n\t\t\t// If the national number entered is too long\n\t\t\t// for any phone number format, then abort.\n\t\t\tif (this.national_number.length > dummy_phone_number_matching_format_pattern.length) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Prepare the phone number format\n\t\t\tvar number_format = this.get_format_format(format);\n\n\t\t\t// Get a formatting template which can be used to efficiently format\n\t\t\t// a partial number where digits are added one by one.\n\n\t\t\t// Below `strict_pattern` is used for the\n\t\t\t// regular expression (with `^` and `$`).\n\t\t\t// This wasn't originally in Google's `libphonenumber`\n\t\t\t// and I guess they don't really need it\n\t\t\t// because they're not using \"templates\" to format phone numbers\n\t\t\t// but I added `strict_pattern` after encountering\n\t\t\t// South Korean phone number formatting bug.\n\t\t\t//\n\t\t\t// Non-strict regular expression bug demonstration:\n\t\t\t//\n\t\t\t// this.national_number : `111111111` (9 digits)\n\t\t\t//\n\t\t\t// number_pattern : (\\d{2})(\\d{3,4})(\\d{4})\n\t\t\t// number_format : `$1 $2 $3`\n\t\t\t// dummy_phone_number_matching_format_pattern : `9999999999` (10 digits)\n\t\t\t//\n\t\t\t// '9999999999'.replace(new RegExp(/(\\d{2})(\\d{3,4})(\\d{4})/g), '$1 $2 $3') = \"99 9999 9999\"\n\t\t\t//\n\t\t\t// template : xx xxxx xxxx\n\t\t\t//\n\t\t\t// But the correct template in this case is `xx xxx xxxx`.\n\t\t\t// The template was generated incorrectly because of the\n\t\t\t// `{3,4}` variability in the `number_pattern`.\n\t\t\t//\n\t\t\t// The fix is, if `this.national_number` has already sufficient length\n\t\t\t// to satisfy the `number_pattern` completely then `this.national_number` is used\n\t\t\t// instead of `dummy_phone_number_matching_format_pattern`.\n\n\t\t\tvar strict_pattern = new RegExp('^' + number_pattern + '$');\n\t\t\tvar national_number_dummy_digits = this.national_number.replace(/\\d/g, DUMMY_DIGIT);\n\n\t\t\t// If `this.national_number` has already sufficient length\n\t\t\t// to satisfy the `number_pattern` completely then use it\n\t\t\t// instead of `dummy_phone_number_matching_format_pattern`.\n\t\t\tif (strict_pattern.test(national_number_dummy_digits)) {\n\t\t\t\tdummy_phone_number_matching_format_pattern = national_number_dummy_digits;\n\t\t\t}\n\n\t\t\t// Generate formatting template for this phone number format\n\t\t\treturn dummy_phone_number_matching_format_pattern\n\t\t\t// Format the dummy phone number according to the format\n\t\t\t.replace(new RegExp(number_pattern), number_format)\n\t\t\t// Replace each dummy digit with a DIGIT_PLACEHOLDER\n\t\t\t.replace(DUMMY_DIGIT_MATCHER, DIGIT_PLACEHOLDER);\n\t\t}\n\t}, {\n\t\tkey: 'format_next_national_number_digits',\n\t\tvalue: function format_next_national_number_digits(digits) {\n\t\t\t// Using `.split('')` to iterate through a string here\n\t\t\t// to avoid requiring `Symbol.iterator` polyfill.\n\t\t\t// `.split('')` is generally not safe for Unicode,\n\t\t\t// but in this particular case for `digits` it is safe.\n\t\t\t// for (const digit of digits)\n\t\t\tfor (var _iterator3 = digits.split(''), _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {\n\t\t\t\tvar _ref3;\n\n\t\t\t\tif (_isArray3) {\n\t\t\t\t\tif (_i3 >= _iterator3.length) break;\n\t\t\t\t\t_ref3 = _iterator3[_i3++];\n\t\t\t\t} else {\n\t\t\t\t\t_i3 = _iterator3.next();\n\t\t\t\t\tif (_i3.done) break;\n\t\t\t\t\t_ref3 = _i3.value;\n\t\t\t\t}\n\n\t\t\t\tvar digit = _ref3;\n\n\t\t\t\t// If there is room for more digits in current `template`,\n\t\t\t\t// then set the next digit in the `template`,\n\t\t\t\t// and return the formatted digits so far.\n\n\t\t\t\t// If more digits are entered than the current format could handle\n\t\t\t\tif (this.partially_populated_template.slice(this.last_match_position + 1).search(DIGIT_PLACEHOLDER_MATCHER) === -1) {\n\t\t\t\t\t// Reset the current format,\n\t\t\t\t\t// so that the new format will be chosen\n\t\t\t\t\t// in a subsequent `this.choose_another_format()` call\n\t\t\t\t\t// later in code.\n\t\t\t\t\tthis.chosen_format = undefined;\n\t\t\t\t\tthis.template = undefined;\n\t\t\t\t\tthis.partially_populated_template = undefined;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis.last_match_position = this.partially_populated_template.search(DIGIT_PLACEHOLDER_MATCHER);\n\t\t\t\tthis.partially_populated_template = this.partially_populated_template.replace(DIGIT_PLACEHOLDER_MATCHER, digit);\n\t\t\t}\n\n\t\t\t// Return the formatted phone number so far\n\t\t\treturn close_dangling_braces(this.partially_populated_template, this.last_match_position + 1).replace(DIGIT_PLACEHOLDER_MATCHER_GLOBAL, ' ');\n\t\t}\n\t}, {\n\t\tkey: 'is_international',\n\t\tvalue: function is_international() {\n\t\t\treturn this.parsed_input && this.parsed_input[0] === '+';\n\t\t}\n\t}, {\n\t\tkey: 'get_format_format',\n\t\tvalue: function get_format_format(format) {\n\t\t\tif (this.is_international()) {\n\t\t\t\treturn local_to_international_style(format.internationalFormat());\n\t\t\t}\n\n\t\t\t// If national prefix formatting rule is set\n\t\t\t// for this phone number format\n\t\t\tif (format.nationalPrefixFormattingRule()) {\n\t\t\t\t// If the user did input the national prefix\n\t\t\t\t// (or if the national prefix formatting rule does not require national prefix)\n\t\t\t\t// then maybe make it part of the phone number template\n\t\t\t\tif (this.national_prefix || !format.usesNationalPrefix()) {\n\t\t\t\t\t// Make the national prefix part of the phone number template\n\t\t\t\t\treturn format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule());\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn format.format();\n\t\t}\n\n\t\t// Determines the country of the phone number\n\t\t// entered so far based on the country phone code\n\t\t// and the national phone number.\n\n\t}, {\n\t\tkey: 'determine_the_country',\n\t\tvalue: function determine_the_country() {\n\t\t\tthis.country = find_country_code(this.countryCallingCode, this.national_number, this.metadata);\n\t\t}\n\t}, {\n\t\tkey: 'getNationalNumber',\n\t\tvalue: function getNationalNumber() {\n\t\t\treturn this.national_number;\n\t\t}\n\t}]);\n\n\treturn AsYouType;\n}();\n\nexport default AsYouType;\n\n\nexport function close_dangling_braces(template, cut_before) {\n\tvar retained_template = template.slice(0, cut_before);\n\n\tvar opening_braces = count_occurences('(', retained_template);\n\tvar closing_braces = count_occurences(')', retained_template);\n\n\tvar dangling_braces = opening_braces - closing_braces;\n\n\twhile (dangling_braces > 0 && cut_before < template.length) {\n\t\tif (template[cut_before] === ')') {\n\t\t\tdangling_braces--;\n\t\t}\n\t\tcut_before++;\n\t}\n\n\treturn template.slice(0, cut_before);\n}\n\n// Counts all occurences of a symbol in a string.\n// Unicode-unsafe (because using `.split()`).\nexport function count_occurences(symbol, string) {\n\tvar count = 0;\n\n\t// Using `.split('')` to iterate through a string here\n\t// to avoid requiring `Symbol.iterator` polyfill.\n\t// `.split('')` is generally not safe for Unicode,\n\t// but in this particular case for counting brackets it is safe.\n\t// for (const character of string)\n\tfor (var _iterator4 = string.split(''), _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) {\n\t\tvar _ref4;\n\n\t\tif (_isArray4) {\n\t\t\tif (_i4 >= _iterator4.length) break;\n\t\t\t_ref4 = _iterator4[_i4++];\n\t\t} else {\n\t\t\t_i4 = _iterator4.next();\n\t\t\tif (_i4.done) break;\n\t\t\t_ref4 = _i4.value;\n\t\t}\n\n\t\tvar character = _ref4;\n\n\t\tif (character === symbol) {\n\t\t\tcount++;\n\t\t}\n\t}\n\n\treturn count;\n}\n\n// Repeats a string (or a symbol) N times.\n// http://stackoverflow.com/questions/202605/repeat-string-javascript\nexport function repeat(string, times) {\n\tif (times < 1) {\n\t\treturn '';\n\t}\n\n\tvar result = '';\n\n\twhile (times > 1) {\n\t\tif (times & 1) {\n\t\t\tresult += string;\n\t\t}\n\n\t\ttimes >>= 1;\n\t\tstring += string;\n\t}\n\n\treturn result + string;\n}\n//# sourceMappingURL=AsYouType.js.map","import Metadata from './metadata';\n\nexport default function (country, metadata) {\n\tmetadata = new Metadata(metadata);\n\n\tif (!metadata.hasCountry(country)) {\n\t\tthrow new Error('Unknown country: ' + country);\n\t}\n\n\treturn metadata.country(country).countryCallingCode();\n}\n//# sourceMappingURL=getCountryCallingCode.js.map","var _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; };\n\nvar _createClass = function () { function 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\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 parse from './parse';\nimport Metadata from './metadata';\n\nimport { PLUS_CHARS, VALID_PUNCTUATION, VALID_DIGITS,\n// OPENING_BRACKETS,\nWHITESPACE, create_extension_pattern } from './common';\n\n// Copy-pasted from `./parse.js`.\nvar VALID_PHONE_NUMBER = '[' + PLUS_CHARS + ']{0,1}' + '(?:' + '[' + VALID_PUNCTUATION + ']*' + '[' + VALID_DIGITS + ']' + '){3,}' + '[' + VALID_PUNCTUATION + VALID_DIGITS + ']*';\n\nvar EXTN_PATTERNS_FOR_PARSING = create_extension_pattern('parsing');\n\nvar WHITESPACE_IN_THE_BEGINNING_PATTERN = new RegExp('^[' + WHITESPACE + ']+');\nvar WHITESPACE_IN_THE_END_PATTERN = new RegExp('[' + WHITESPACE + ']+$');\n\n// // Regular expression for getting opening brackets for a valid number\n// // found using `PHONE_NUMBER_START_PATTERN` for prepending those brackets to the number.\n// const BEFORE_NUMBER_DIGITS_PUNCTUATION = new RegExp('[' + OPENING_BRACKETS + ']+' + '[' + WHITESPACE + ']*' + '$')\n\nexport default function findPhoneNumbers(arg_1, arg_2, arg_3, arg_4) {\n\tvar _sort_out_arguments = sort_out_arguments(arg_1, arg_2, arg_3, arg_4),\n\t text = _sort_out_arguments.text,\n\t options = _sort_out_arguments.options,\n\t metadata = _sort_out_arguments.metadata;\n\n\tvar search = new PhoneNumberSearch(text, options, metadata.metadata);\n\n\tvar phones = [];\n\n\twhile (search.hasNext()) {\n\t\tphones.push(search.next());\n\t}\n\n\treturn phones;\n}\n\n/**\r\n * @return ES6 `for ... of` iterator.\r\n */\nexport function searchPhoneNumbers(arg_1, arg_2, arg_3, arg_4) {\n\tvar _sort_out_arguments2 = sort_out_arguments(arg_1, arg_2, arg_3, arg_4),\n\t text = _sort_out_arguments2.text,\n\t options = _sort_out_arguments2.options,\n\t metadata = _sort_out_arguments2.metadata;\n\n\tvar search = new PhoneNumberSearch(text, options, metadata.metadata);\n\n\treturn _defineProperty({}, Symbol.iterator, function () {\n\t\treturn {\n\t\t\tnext: function next() {\n\t\t\t\tif (search.hasNext()) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdone: false,\n\t\t\t\t\t\tvalue: search.next()\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tdone: true\n\t\t\t\t};\n\t\t\t}\n\t\t};\n\t});\n}\n\n/**\r\n * Extracts a parseable phone number including any opening brackets, etc.\r\n * @param {string} text - Input.\r\n * @return {object} `{ ?number, ?startsAt, ?endsAt }`.\r\n */\nexport var PhoneNumberSearch = function () {\n\tfunction PhoneNumberSearch(text) {\n\t\tvar options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\t\tvar metadata = arguments[2];\n\n\t\t_classCallCheck(this, PhoneNumberSearch);\n\n\t\tthis.state = 'NOT_READY';\n\n\t\tthis.text = text;\n\t\tthis.options = options;\n\t\tthis.metadata = metadata;\n\n\t\tthis.regexp = new RegExp(VALID_PHONE_NUMBER +\n\t\t// Phone number extensions\n\t\t'(?:' + EXTN_PATTERNS_FOR_PARSING + ')?', 'ig');\n\n\t\t// this.searching_from = 0\n\t}\n\t// Iteration tristate.\n\n\n\t_createClass(PhoneNumberSearch, [{\n\t\tkey: 'find',\n\t\tvalue: function find() {\n\t\t\tvar matches = this.regexp.exec(this.text);\n\n\t\t\tif (!matches) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar number = matches[0];\n\t\t\tvar startsAt = matches.index;\n\n\t\t\tnumber = number.replace(WHITESPACE_IN_THE_BEGINNING_PATTERN, '');\n\t\t\tstartsAt += matches[0].length - number.length;\n\t\t\tnumber = number.replace(WHITESPACE_IN_THE_END_PATTERN, '');\n\n\t\t\t// // Prepend any opening brackets left behind by the\n\t\t\t// // `PHONE_NUMBER_START_PATTERN` regexp.\n\t\t\t// const text_before_number = text.slice(this.searching_from, startsAt)\n\t\t\t// const full_number_starts_at = text_before_number.search(BEFORE_NUMBER_DIGITS_PUNCTUATION)\n\t\t\t// if (full_number_starts_at >= 0)\n\t\t\t// {\n\t\t\t// \tnumber = text_before_number.slice(full_number_starts_at) + number\n\t\t\t// \tstartsAt = full_number_starts_at\n\t\t\t// }\n\t\t\t//\n\t\t\t// this.searching_from = matches.lastIndex\n\n\t\t\tvar result = parse(number, { defaultCountry: this.options.defaultCountry }, this.metadata);\n\n\t\t\tif (result.phone) {\n\t\t\t\tresult.startsAt = startsAt;\n\t\t\t\tresult.endsAt = startsAt + number.length;\n\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\t// Tail recursion.\n\t\t\t// Try the next one if this one is not a valid phone number.\n\t\t\treturn this.find();\n\t\t}\n\t}, {\n\t\tkey: 'hasNext',\n\t\tvalue: function hasNext() {\n\t\t\tif (this.state === 'NOT_READY') {\n\t\t\t\tthis.last_match = this.find();\n\n\t\t\t\tif (this.last_match) {\n\t\t\t\t\tthis.state = 'READY';\n\t\t\t\t} else {\n\t\t\t\t\tthis.state = 'DONE';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn this.state === 'READY';\n\t\t}\n\t}, {\n\t\tkey: 'next',\n\t\tvalue: function next() {\n\t\t\t// Check the state and find the next match as a side-effect if necessary.\n\t\t\tif (!this.hasNext()) {\n\t\t\t\tthrow new Error('No next element');\n\t\t\t}\n\n\t\t\t// Don't retain that memory any longer than necessary.\n\t\t\tvar result = this.last_match;\n\t\t\tthis.last_match = null;\n\t\t\tthis.state = 'NOT_READY';\n\t\t\treturn result;\n\t\t}\n\t}]);\n\n\treturn PhoneNumberSearch;\n}();\n\nexport function sort_out_arguments(arg_1, arg_2, arg_3, arg_4) {\n\tvar text = void 0;\n\tvar options = void 0;\n\tvar metadata = void 0;\n\n\t// If the phone number is passed as a string.\n\t// `parse('88005553535', ...)`.\n\tif (typeof arg_1 === 'string') {\n\t\ttext = arg_1;\n\t} else throw new TypeError('A text for parsing must be a string.');\n\n\t// If \"default country\" argument is being passed\n\t// then move it to `options`.\n\t// `findNumbers('88005553535', 'RU', [options], metadata)`.\n\tif (typeof arg_2 === 'string') {\n\t\tif (arg_4) {\n\t\t\toptions = _extends({ defaultCountry: arg_2 }, arg_3);\n\t\t\tmetadata = arg_4;\n\t\t} else {\n\t\t\toptions = { defaultCountry: arg_2 };\n\t\t\tmetadata = arg_3;\n\t\t}\n\t}\n\t// No \"default country\" argument is being passed.\n\t// Only international phone numbers are passed.\n\t// `findNumbers('+78005553535', [options], metadata)`.\n\telse {\n\t\t\tif (arg_3) {\n\t\t\t\toptions = arg_2;\n\t\t\t\tmetadata = arg_3;\n\t\t\t} else {\n\t\t\t\tmetadata = arg_2;\n\t\t\t}\n\t\t}\n\n\tif (!options) {\n\t\toptions = {};\n\t}\n\n\t// // Apply default options.\n\t// if (options)\n\t// {\n\t// \toptions = { ...default_options, ...options }\n\t// }\n\t// else\n\t// {\n\t// \toptions = default_options\n\t// }\n\n\treturn { text: text, options: options, metadata: new Metadata(metadata) };\n}\n//# sourceMappingURL=findPhoneNumbers.js.map","import parse, { is_viable_phone_number } from './parse';\nimport get_number_type, { sort_out_arguments } from './types';\n\n// Checks if a given phone number is valid\n//\n// Example use cases:\n//\n// ```js\n// is_valid('8005553535', 'RU')\n// is_valid('8005553535', 'RU', metadata)\n// is_valid({ phone: '8005553535', country: 'RU' })\n// is_valid({ phone: '8005553535', country: 'RU' }, metadata)\n// is_valid('+78005553535')\n// is_valid('+78005553535', metadata)\n// ```\n//\nexport default function is_valid(arg_1, arg_2, arg_3) {\n\tvar _sort_out_arguments = sort_out_arguments(arg_1, arg_2, arg_3),\n\t input = _sort_out_arguments.input,\n\t metadata = _sort_out_arguments.metadata;\n\n\tif (!input) {\n\t\treturn false;\n\t}\n\n\tif (!input.country) {\n\t\treturn false;\n\t}\n\n\tif (!metadata.hasCountry(input.country)) {\n\t\tthrow new Error('Unknown country: ' + input.country);\n\t}\n\n\tmetadata.country(input.country);\n\n\tif (metadata.hasTypes()) {\n\t\treturn get_number_type(input, metadata.metadata) !== undefined;\n\t}\n\n\treturn true;\n}\n//# sourceMappingURL=validate.js.map","module.exports = function cmp (a, b) {\n var pa = a.split('.');\n var pb = b.split('.');\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 return 0;\n};\n","import metadata from './metadata.min.json'\r\n\r\nimport parseNumberCustom from './es6/parse'\r\nimport formatNumberCustom from './es6/format'\r\nimport getNumberTypeCustom from './es6/types'\r\nimport isValidNumberCustom from './es6/validate'\r\nimport findPhoneNumbersCustom, { searchPhoneNumbers as searchPhoneNumbersCustom, PhoneNumberSearch as PhoneNumberSearchCustom } from './es6/findPhoneNumbers'\r\nimport AsYouTypeCustom from './es6/AsYouType'\r\nimport getCountryCallingCodeCustom from './es6/getCountryCallingCode'\r\nexport { default as Metadata } from './es6/metadata'\r\nimport { getExtPrefix as getExtPrefixCustom } from './es6/metadata'\r\nimport { parseRFC3966 as parseRFC3966Custom, formatRFC3966 as formatRFC3966Custom } from './es6/RFC3966'\r\n\r\nexport function parseNumber()\r\n{\r\n\tvar parameters = Array.prototype.slice.call(arguments)\r\n\tparameters.push(metadata)\r\n\treturn parseNumberCustom.apply(this, parameters)\r\n}\r\n\r\n// Deprecated: remove `parse()` export in 2.0.0.\r\n// (renamed to `parseNumber()`)\r\nexport function parse()\r\n{\r\n\tvar parameters = Array.prototype.slice.call(arguments)\r\n\tparameters.push(metadata)\r\n\treturn parseNumberCustom.apply(this, parameters)\r\n}\r\n\r\nexport function formatNumber()\r\n{\r\n\tvar parameters = Array.prototype.slice.call(arguments)\r\n\tparameters.push(metadata)\r\n\treturn formatNumberCustom.apply(this, parameters)\r\n}\r\n\r\n// Deprecated: remove `format()` export in 2.0.0.\r\n// (renamed to `formatNumber()`)\r\nexport function format()\r\n{\r\n\tvar parameters = Array.prototype.slice.call(arguments)\r\n\tparameters.push(metadata)\r\n\treturn formatNumberCustom.apply(this, parameters)\r\n}\r\n\r\nexport function getNumberType()\r\n{\r\n\tvar parameters = Array.prototype.slice.call(arguments)\r\n\tparameters.push(metadata)\r\n\treturn getNumberTypeCustom.apply(this, parameters)\r\n}\r\n\r\nexport function isValidNumber()\r\n{\r\n\tvar parameters = Array.prototype.slice.call(arguments)\r\n\tparameters.push(metadata)\r\n\treturn isValidNumberCustom.apply(this, parameters)\r\n}\r\n\r\nexport function findPhoneNumbers()\r\n{\r\n\tvar parameters = Array.prototype.slice.call(arguments)\r\n\tparameters.push(metadata)\r\n\treturn findPhoneNumbersCustom.apply(this, parameters)\r\n}\r\n\r\nexport function searchPhoneNumbers()\r\n{\r\n\tvar parameters = Array.prototype.slice.call(arguments)\r\n\tparameters.push(metadata)\r\n\treturn searchPhoneNumbersCustom.apply(this, parameters)\r\n}\r\n\r\nexport function PhoneNumberSearch(text, options)\r\n{\r\n\tPhoneNumberSearchCustom.call(this, text, options, metadata)\r\n}\r\n\r\nPhoneNumberSearch.prototype = Object.create(PhoneNumberSearchCustom.prototype, {})\r\nPhoneNumberSearch.prototype.constructor = PhoneNumberSearch\r\n\r\nexport function AsYouType(country)\r\n{\r\n\tAsYouTypeCustom.call(this, country, metadata)\r\n}\r\n\r\nAsYouType.prototype = Object.create(AsYouTypeCustom.prototype, {})\r\nAsYouType.prototype.constructor = AsYouType\r\n\r\nexport function getExtPrefix()\r\n{\r\n\tvar parameters = Array.prototype.slice.call(arguments)\r\n\tparameters.push(metadata)\r\n\treturn getExtPrefixCustom.apply(this, parameters)\r\n}\r\n\r\nexport function parseRFC3966()\r\n{\r\n\tvar parameters = Array.prototype.slice.call(arguments)\r\n\tparameters.push(metadata)\r\n\treturn parseRFC3966Custom.apply(this, parameters)\r\n}\r\n\r\nexport function formatRFC3966()\r\n{\r\n\tvar parameters = Array.prototype.slice.call(arguments)\r\n\tparameters.push(metadata)\r\n\treturn formatRFC3966Custom.apply(this, parameters)\r\n}\r\n\r\n// Deprecated: remove DIGITS export in 2.0.0 (unused).\r\nexport { DIGIT_MAPPINGS as DIGITS } from './es6/common'\r\n\r\n// Deprecated: remove this in 2.0.0 and make `custom.js` in ES6\r\n// (the old `custom.js` becomes `custom.commonjs.js`).\r\nexport { default as parseCustom } from './es6/parse'\r\nexport { default as formatCustom } from './es6/format'\r\nexport { default as isValidNumberCustom } from './es6/validate'\r\nexport { default as findPhoneNumbersCustom } from './es6/findPhoneNumbers'\r\nexport { searchPhoneNumbers as searchPhoneNumbersCustom } from './es6/findPhoneNumbers'\r\nexport { PhoneNumberSearch as PhoneNumberSearchCustom } from './es6/findPhoneNumbers'\r\nexport { default as getNumberTypeCustom } from './es6/types'\r\nexport { default as getCountryCallingCodeCustom } from './es6/getCountryCallingCode'\r\n\r\nexport\r\n{\r\n\tdefault as AsYouTypeCustom,\r\n\t// `DIGIT_PLACEHOLDER` is used by `react-phone-number-input`.\r\n\tDIGIT_PLACEHOLDER\r\n}\r\nfrom './es6/AsYouType'\r\n\r\nexport function getCountryCallingCode(country)\r\n{\r\n\treturn getCountryCallingCodeCustom(country, metadata)\r\n}\r\n\r\n// `getPhoneCode` name is deprecated, use `getCountryCallingCode` instead.\r\nexport function getPhoneCode(country)\r\n{\r\n\treturn getCountryCallingCode(country)\r\n}\r\n\r\n// `getPhoneCodeCustom` name is deprecated, use `getCountryCallingCodeCustom` instead.\r\nexport function getPhoneCodeCustom(country, metadata)\r\n{\r\n\treturn getCountryCallingCodeCustom(country, metadata)\r\n}"],"sourceRoot":""}