From 29e659ad963bc17068115abb56e79a99ebc33150 Mon Sep 17 00:00:00 2001 From: Sandu Luca Date: Wed, 10 May 2023 14:53:15 +0300 Subject: [PATCH 1/2] reduced bundle size (used libphonenumber-js) --- .github/dependabot.yml | 4 +- README.md | 27 +- dist/yup-phone.cjs.d.ts | 26 +- dist/yup-phone.cjs.js | 6 +- dist/yup-phone.cjs.js.map | 2 +- dist/yup-phone.esm.d.ts | 26 +- dist/yup-phone.esm.js | 5 +- dist/yup-phone.umd.d.ts | 26 +- dist/yup-phone.umd.js | 4177 ++++++++++++++++++++++++++++++++- dist/yup-phone.umd.js.map | 2 +- dist/yup-phone.umd.min.d.ts | 26 +- dist/yup-phone.umd.min.js | 1165 ++------- dist/yup-phone.umd.min.js.map | 2 +- docs/index.md | 27 +- package-lock.json | 766 +----- package.json | 7 +- src/yup-phone.test.ts | 2 +- src/yup-phone.ts | 95 +- tsconfig.json | 1 + 19 files changed, 4462 insertions(+), 1930 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index b9d32f57..a1d2da2a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -88,6 +88,6 @@ updates: versions: - 2.2.0 - 2.2.1 - - dependency-name: google-libphonenumber + - dependency-name: libphonenumber-js versions: - - 3.2.17 + - 1.10.30 diff --git a/README.md b/README.md index 69256578..64fa08bd 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,7 @@ [![Coverage Status](https://coveralls.io/repos/github/abhisekp/yup-phone/badge.svg?branch=master)](https://coveralls.io/github/abhisekp/yup-phone?branch=master) --> -> Adds a phone number validation check to yup validator using [**google-libphonenumber**](https://www.npmjs.com/package/google-libphonenumber) which gives accurate validation checks. -_Read more about the **core library** here_ [*libphonenumber*](https://github.com/googlei18n/libphonenumber/blob/master/README.md#readme). +> Adds a phone number validation check to yup validator using [**libphonenumber-js**](https://www.npmjs.com/package/libphonenumber-js) which gives accurate validation checks. _Read more about **yup** validator here_ [*yup*](https://www.npmjs.com/package/yup) ## Install @@ -128,30 +127,30 @@ For more examples, check [yup-phone.test.ts](src/yup-phone.test.ts) file. ``` Destination: dist/yup-phone.umd.js -Bundle Size: 544.08 KB -Minified Size: 537.41 KB -Gzipped Size: 107.04 KB +Bundle Size: 220.83 KB +Minified Size: 114.36 KB +Gzipped Size: 27.88 KB ``` ``` Destination: dist/yup-phone.umd.min.js -Bundle Size: 508.65 KB -Minified Size: 506.46 KB -Gzipped Size: 105.73 KB +Bundle Size: 113.55 KB +Minified Size: 112.38 KB +Gzipped Size: 28 KB ``` ``` Destination: dist/yup-phone.esm.js -Bundle Size: 648 B -Minified Size: 646 B -Gzipped Size: 370 B +Bundle Size: 481 B +Minified Size: 483 B +Gzipped Size: 299 B ``` ``` Destination: dist/yup-phone.cjs.js -Bundle Size: 1.35 KB -Minified Size: 1.34 KB -Gzipped Size: 662 B +Bundle Size: 912 B +Minified Size: 914 B +Gzipped Size: 496 B ``` ### Contributing diff --git a/dist/yup-phone.cjs.d.ts b/dist/yup-phone.cjs.d.ts index 98af4a9f..e267c0eb 100644 --- a/dist/yup-phone.cjs.d.ts +++ b/dist/yup-phone.cjs.d.ts @@ -1,13 +1,13 @@ -declare module "yup" { - interface StringSchema { - /** - * Check for phone number validity. - * - * @param {String} [countryCode=IN] The country code to check against. - * @param {Boolean} [strict=false] How strictly should it check. - * @param {String} [errorMessage=DEFAULT_MESSAGE] The error message to return if the validation fails. - */ - phone(countryCode?: string, strict?: boolean, errorMessage?: string): StringSchema; - } -} -export {}; +import { CountryCode } from "libphonenumber-js"; +declare module "yup" { + interface StringSchema { + /** + * Check for phone number validity. + * + * @param {CountryCode} [countryCode] The country code to check against. + * @param {Boolean} [strict=false] How strictly should it check. + * @param {String} [errorMessage=DEFAULT_MESSAGE] The error message to return if the validation fails. + */ + phone(countryCode?: CountryCode, strict?: boolean, errorMessage?: string): StringSchema; + } +} diff --git a/dist/yup-phone.cjs.js b/dist/yup-phone.cjs.js index 5ee0b2e5..af397dce 100644 --- a/dist/yup-phone.cjs.js +++ b/dist/yup-phone.cjs.js @@ -1,5 +1,3 @@ -'use strict';var Yup=require("yup"),gPhoneNumber=require("google-libphonenumber");function _interopDefaultLegacy(a){return a&&"object"===typeof a&&"default"in a?a:{"default":a}}function _interopNamespace(a){if(a&&a.__esModule)return a;var c=Object.create(null);a&&Object.keys(a).forEach(function(b){if("default"!==b){var d=Object.getOwnPropertyDescriptor(a,b);Object.defineProperty(c,b,d.get?d:{enumerable:!0,get:function(){return a[b]}})}});c["default"]=a;return Object.freeze(c)} -var Yup__namespace=_interopNamespace(Yup),gPhoneNumber__default=_interopDefaultLegacy(gPhoneNumber),phoneUtil=gPhoneNumber__default["default"].PhoneNumberUtil.getInstance(),YUP_PHONE_METHOD="phone",CLDR_REGION_CODE_SIZE=2,isValidCountryCode=function(a){return"string"===typeof a&&a.length===CLDR_REGION_CODE_SIZE}; -Yup__namespace.addMethod(Yup__namespace.string,YUP_PHONE_METHOD,function(a,c,b){void 0===c&&(c=!1);void 0===b&&(b="");b="string"===typeof b&&b?b:isValidCountryCode(a)?"${path} must be a valid phone number for region "+a:"${path} must be a valid phone number.";return this.test(YUP_PHONE_METHOD,b,function(d){isValidCountryCode(a)||(a="IN",c=!1);try{var e=phoneUtil.parseAndKeepRawInput(d,a);if(!phoneUtil.isPossibleNumber(e))return!1;var f=phoneUtil.getRegionCodeForNumber(e);return c?phoneUtil.isValidNumberForRegion(e, -a):phoneUtil.isValidNumberForRegion(e,f)}catch(g){return!1}})}) +'use strict';var Yup=require("yup"),libphonenumberJs=require("libphonenumber-js");function _interopNamespace(a){if(a&&a.__esModule)return a;var c=Object.create(null);a&&Object.keys(a).forEach(function(b){if("default"!==b){var d=Object.getOwnPropertyDescriptor(a,b);Object.defineProperty(c,b,d.get?d:{enumerable:!0,get:function(){return a[b]}})}});c["default"]=a;return Object.freeze(c)}var Yup__namespace=_interopNamespace(Yup),YUP_PHONE_METHOD="phone"; +Yup__namespace.addMethod(Yup__namespace.string,YUP_PHONE_METHOD,function(a,c,b){void 0===c&&(c=!1);void 0===b&&(b="");return this.test(YUP_PHONE_METHOD,"string"===typeof b&&b?b:a?"${path} must be a valid phone number for region "+a:"${path} must be a valid phone number.",function(d){try{var e=libphonenumberJs.parsePhoneNumberWithError(d,a);return e.isPossible()?c&&a?libphonenumberJs.isValidNumberForRegion(d,a):e.isValid():!1}catch(f){return!1}})}) //# sourceMappingURL=yup-phone.cjs.js.map diff --git a/dist/yup-phone.cjs.js.map b/dist/yup-phone.cjs.js.map index eb6ea03a..ee001396 100644 --- a/dist/yup-phone.cjs.js.map +++ b/dist/yup-phone.cjs.js.map @@ -1 +1 @@ -{"version":3,"file":"yup-phone.cjs.js","sources":["../src/yup-phone.ts"],"sourcesContent":["import * as Yup from 'yup';\nimport gPhoneNumber from 'google-libphonenumber';\n\nconst phoneUtil = gPhoneNumber.PhoneNumberUtil.getInstance();\n\ndeclare module 'yup' {\n export interface StringSchema {\n /**\n * Check for phone number validity.\n *\n * @param {String} [countryCode=IN] The country code to check against.\n * @param {Boolean} [strict=false] How strictly should it check.\n * @param {String} [errorMessage=DEFAULT_MESSAGE] The error message to return if the validation fails.\n */\n phone(\n countryCode?: string,\n strict?: boolean,\n errorMessage?: string\n ): StringSchema;\n }\n}\n\nconst YUP_PHONE_METHOD = 'phone';\nconst CLDR_REGION_CODE_SIZE = 2;\n\nconst isValidCountryCode = (countryCode: any): boolean =>\n typeof countryCode === 'string' &&\n countryCode.length === CLDR_REGION_CODE_SIZE;\n\nYup.addMethod(Yup.string, YUP_PHONE_METHOD, function yupPhone(\n countryCode?: string,\n strict: boolean = false,\n errorMessage: string = ''\n) {\n const errMsg =\n typeof errorMessage === 'string' && errorMessage\n ? errorMessage\n : isValidCountryCode(countryCode)\n ? `\\${path} must be a valid phone number for region ${countryCode}`\n : '${path} must be a valid phone number.';\n // @ts-ignore\n return this.test(YUP_PHONE_METHOD, errMsg, (value: string) => {\n if (!isValidCountryCode(countryCode)) {\n // if not valid countryCode, then set default country to India (IN)\n countryCode = 'IN';\n strict = false;\n }\n\n try {\n const phoneNumber = phoneUtil.parseAndKeepRawInput(value, countryCode);\n\n if (!phoneUtil.isPossibleNumber(phoneNumber)) {\n return false;\n }\n\n const regionCodeFromPhoneNumber = phoneUtil.getRegionCodeForNumber(\n phoneNumber\n );\n\n /* check if the countryCode provided should be used as\n default country code or strictly followed\n */\n return strict\n ? phoneUtil.isValidNumberForRegion(phoneNumber, countryCode)\n : phoneUtil.isValidNumberForRegion(\n phoneNumber,\n regionCodeFromPhoneNumber\n );\n } catch {\n return false;\n }\n });\n});\n"],"names":["phoneUtil","gPhoneNumber","PhoneNumberUtil","getInstance","YUP_PHONE_METHOD","CLDR_REGION_CODE_SIZE","isValidCountryCode","countryCode","length","Yup","addMethod","string","yupPhone","strict","errorMessage","errMsg","test","value","phoneNumber","parseAndKeepRawInput","isPossibleNumber","regionCodeFromPhoneNumber","getRegionCodeForNumber","isValidNumberForRegion"],"mappings":";oGAGMA,UAAYC,qBAAAA,UAAAA,CAAaC,CAAAA,eAAgBC,CAAAA,WAA7BF,GAmBZG,iBAAmB,QACnBC,sBAAwB,EAExBC,mBAAqBA,QAAA,CAACC,CAAD,QACF,WAAvB,MAAOA,IACPA,CAAYC,CAAAA,SAAWH,sBAEzBI;cAAIC,CAAAA,SAAJD,CAAcA,cAAIE,CAAAA,MAAlBF,CAA0BL,gBAA1BK,CAA4CG,QAAA,CAC1CL,CAD0C,CAE1CM,CAF0C,CAG1CC,CAH0C,CAGjB,UADzBD,IAAAA,EAAkB,CAAA,YAClBC,IAAAA,EAAuB,GAEjBC,EAAAA,CACoB,QAAxB,GAAA,MAAOD,EAAP,EAAoCA,CAApC,CACIA,CADJ,CAEIR,kBAAA,CAAmBC,CAAnB,CAAA,mDAAA,CACoDA,CADpD,CAEA,8CAEC,KAAKS,CAAAA,IAAL,CAAUZ,gBAAV,CAA4BW,CAA5B,CAAoC,SAACE,EAAiB,CACtDX,kBAAA,CAAmBC,CAAnB,IAEHA,CACA,CADc,IACd,CAAAM,CAAA,CAAS,CAAA,MAGP,KACIK,EAAclB,SAAUmB,CAAAA,oBAAV,CAA+BF,CAA/B,CAAsCV,CAAtC,KAEhB,CAACP,SAAUoB,CAAAA,gBAAV,CAA2BF,CAA3B,QACI,CAAA,MAGHG,EAA4BrB,SAAUsB,CAAAA,sBAAV,CAChCJ,CADgC,QAO3BL,EAAA,CACHb,SAAUuB,CAAAA,sBAAV,CAAiCL,CAAjC;AAA8CX,CAA9C,CADG,CAEHP,SAAUuB,CAAAA,sBAAV,CACEL,CADF,CAEEG,CAFF,CAhBF,CAoBF,OAAA,CAAM,OACC,CAAA,CADD,CA3BmD,CAAtD,CATkB,CAH3BZ;"} \ No newline at end of file +{"version":3,"file":"yup-phone.cjs.js","sources":["../src/yup-phone.ts"],"sourcesContent":["import * as Yup from \"yup\";\nimport {\n isValidNumberForRegion,\n CountryCode,\n parsePhoneNumberWithError,\n} from \"libphonenumber-js\";\n\ndeclare module \"yup\" {\n export interface StringSchema {\n /**\n * Check for phone number validity.\n *\n * @param {CountryCode} [countryCode] The country code to check against.\n * @param {Boolean} [strict=false] How strictly should it check.\n * @param {String} [errorMessage=DEFAULT_MESSAGE] The error message to return if the validation fails.\n */\n phone(\n countryCode?: CountryCode,\n strict?: boolean,\n errorMessage?: string\n ): StringSchema;\n }\n}\n\nconst YUP_PHONE_METHOD = \"phone\";\n\nYup.addMethod(\n Yup.string,\n YUP_PHONE_METHOD,\n function yupPhone(\n countryCode?: CountryCode,\n strict: boolean = false,\n errorMessage: string = \"\"\n ) {\n const errMsg =\n typeof errorMessage === \"string\" && errorMessage\n ? errorMessage\n : countryCode\n ? `\\${path} must be a valid phone number for region ${countryCode}`\n : \"${path} must be a valid phone number.\";\n\n // @ts-ignore\n return this.test(YUP_PHONE_METHOD, errMsg, (value: string) => {\n try {\n const phoneNumber = parsePhoneNumberWithError(value, countryCode);\n\n if (!phoneNumber.isPossible()) {\n return false;\n }\n\n /* check if the countryCode provided should be used as\n default country code or strictly followed\n */\n if (strict && countryCode) {\n return isValidNumberForRegion(value, countryCode);\n }\n\n return phoneNumber.isValid();\n } catch {\n return false;\n }\n });\n }\n);\n"],"names":["YUP_PHONE_METHOD","Yup","addMethod","string","yupPhone","countryCode","strict","errorMessage","test","errMsg","value","phoneNumber","parsePhoneNumberWithError","isPossible","isValidNumberForRegion","isValid"],"mappings":"4aAwBMA,iBAAmB,OAEzBC;cAAIC,CAAAA,SAAJD,CACEA,cAAIE,CAAAA,MADNF,CAEED,gBAFFC,CAGEG,QAAA,CACEC,CADF,CAEEC,CAFF,CAGEC,CAHF,CAG2B,UADzBD,IAAAA,EAAkB,CAAA,YAClBC,IAAAA,EAAuB,UAUhB,KAAKC,CAAAA,IAAL,CAAUR,gBAAV,CAPmB,QAAxBS,GAAA,MAAOF,EAAPE,EAAoCF,CAApCE,CACIF,CADJE,CAEIJ,CAAA,mDAAA,CACoDA,CADpD,CAEA,uCAGC,CAAoC,SAACK,EAAiB,IACvD,KACIC,EAAcC,0CAAAA,CAA0BF,CAA1BE,CAAiCP,CAAjCO,QAEfD,EAAYE,CAAAA,UAAZ,GAODP,GAAUD,EACLS,uCAAAA,CAAuBJ,CAAvBI,CAA8BT,CAA9BS,EAGFH,CAAYI,CAAAA,OAAZ,GAVE,CAAA,CAJP,CAeF,OAAA,CAAM,OACC,CAAA,CADD,CAhBmD,CAAtD,CAVkB,CAN7Bd;"} \ No newline at end of file diff --git a/dist/yup-phone.esm.d.ts b/dist/yup-phone.esm.d.ts index 98af4a9f..e267c0eb 100644 --- a/dist/yup-phone.esm.d.ts +++ b/dist/yup-phone.esm.d.ts @@ -1,13 +1,13 @@ -declare module "yup" { - interface StringSchema { - /** - * Check for phone number validity. - * - * @param {String} [countryCode=IN] The country code to check against. - * @param {Boolean} [strict=false] How strictly should it check. - * @param {String} [errorMessage=DEFAULT_MESSAGE] The error message to return if the validation fails. - */ - phone(countryCode?: string, strict?: boolean, errorMessage?: string): StringSchema; - } -} -export {}; +import { CountryCode } from "libphonenumber-js"; +declare module "yup" { + interface StringSchema { + /** + * Check for phone number validity. + * + * @param {CountryCode} [countryCode] The country code to check against. + * @param {Boolean} [strict=false] How strictly should it check. + * @param {String} [errorMessage=DEFAULT_MESSAGE] The error message to return if the validation fails. + */ + phone(countryCode?: CountryCode, strict?: boolean, errorMessage?: string): StringSchema; + } +} diff --git a/dist/yup-phone.esm.js b/dist/yup-phone.esm.js index cb33065e..6716ad52 100644 --- a/dist/yup-phone.esm.js +++ b/dist/yup-phone.esm.js @@ -1,3 +1,2 @@ -import gPhoneNumber from'google-libphonenumber';import * as Yup from'yup';var b=gPhoneNumber.PhoneNumberUtil.getInstance(); -Yup.addMethod(Yup.string,"phone",function(a,d,c){void 0===d&&(d=!1);void 0===c&&(c="");return this.test("phone","string"===typeof c&&c?c:"string"===typeof a&&2===a.length?"${path} must be a valid phone number for region "+a:"${path} must be a valid phone number.",function(f){if("string"!==typeof a||2!==a.length)a="IN",d=!1;try{var e=b.parseAndKeepRawInput(f,a);if(!b.isPossibleNumber(e))return!1;var g=b.getRegionCodeForNumber(e);return d?b.isValidNumberForRegion(e,a):b.isValidNumberForRegion(e,g)}catch(h){return!1}})}) -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoieXVwLXBob25lLmVzbS5qcyIsInNvdXJjZXMiOlsiLi4vc3JjL3l1cC1waG9uZS50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBZdXAgZnJvbSAneXVwJztcbmltcG9ydCBnUGhvbmVOdW1iZXIgZnJvbSAnZ29vZ2xlLWxpYnBob25lbnVtYmVyJztcblxuY29uc3QgcGhvbmVVdGlsID0gZ1Bob25lTnVtYmVyLlBob25lTnVtYmVyVXRpbC5nZXRJbnN0YW5jZSgpO1xuXG5kZWNsYXJlIG1vZHVsZSAneXVwJyB7XG4gIGV4cG9ydCBpbnRlcmZhY2UgU3RyaW5nU2NoZW1hIHtcbiAgICAvKipcbiAgICAgKiBDaGVjayBmb3IgcGhvbmUgbnVtYmVyIHZhbGlkaXR5LlxuICAgICAqXG4gICAgICogQHBhcmFtIHtTdHJpbmd9IFtjb3VudHJ5Q29kZT1JTl0gVGhlIGNvdW50cnkgY29kZSB0byBjaGVjayBhZ2FpbnN0LlxuICAgICAqIEBwYXJhbSB7Qm9vbGVhbn0gW3N0cmljdD1mYWxzZV0gSG93IHN0cmljdGx5IHNob3VsZCBpdCBjaGVjay5cbiAgICAgKiBAcGFyYW0ge1N0cmluZ30gW2Vycm9yTWVzc2FnZT1ERUZBVUxUX01FU1NBR0VdIFRoZSBlcnJvciBtZXNzYWdlIHRvIHJldHVybiBpZiB0aGUgdmFsaWRhdGlvbiBmYWlscy5cbiAgICAgKi9cbiAgICBwaG9uZShcbiAgICAgIGNvdW50cnlDb2RlPzogc3RyaW5nLFxuICAgICAgc3RyaWN0PzogYm9vbGVhbixcbiAgICAgIGVycm9yTWVzc2FnZT86IHN0cmluZ1xuICAgICk6IFN0cmluZ1NjaGVtYTtcbiAgfVxufVxuXG5jb25zdCBZVVBfUEhPTkVfTUVUSE9EID0gJ3Bob25lJztcbmNvbnN0IENMRFJfUkVHSU9OX0NPREVfU0laRSA9IDI7XG5cbmNvbnN0IGlzVmFsaWRDb3VudHJ5Q29kZSA9IChjb3VudHJ5Q29kZTogYW55KTogYm9vbGVhbiA9PlxuICB0eXBlb2YgY291bnRyeUNvZGUgPT09ICdzdHJpbmcnICYmXG4gIGNvdW50cnlDb2RlLmxlbmd0aCA9PT0gQ0xEUl9SRUdJT05fQ09ERV9TSVpFO1xuXG5ZdXAuYWRkTWV0aG9kKFl1cC5zdHJpbmcsIFlVUF9QSE9ORV9NRVRIT0QsIGZ1bmN0aW9uIHl1cFBob25lKFxuICBjb3VudHJ5Q29kZT86IHN0cmluZyxcbiAgc3RyaWN0OiBib29sZWFuID0gZmFsc2UsXG4gIGVycm9yTWVzc2FnZTogc3RyaW5nID0gJydcbikge1xuICBjb25zdCBlcnJNc2cgPVxuICAgIHR5cGVvZiBlcnJvck1lc3NhZ2UgPT09ICdzdHJpbmcnICYmIGVycm9yTWVzc2FnZVxuICAgICAgPyBlcnJvck1lc3NhZ2VcbiAgICAgIDogaXNWYWxpZENvdW50cnlDb2RlKGNvdW50cnlDb2RlKVxuICAgICAgPyBgXFwke3BhdGh9IG11c3QgYmUgYSB2YWxpZCBwaG9uZSBudW1iZXIgZm9yIHJlZ2lvbiAke2NvdW50cnlDb2RlfWBcbiAgICAgIDogJyR7cGF0aH0gbXVzdCBiZSBhIHZhbGlkIHBob25lIG51bWJlci4nO1xuICAvLyBAdHMtaWdub3JlXG4gIHJldHVybiB0aGlzLnRlc3QoWVVQX1BIT05FX01FVEhPRCwgZXJyTXNnLCAodmFsdWU6IHN0cmluZykgPT4ge1xuICAgIGlmICghaXNWYWxpZENvdW50cnlDb2RlKGNvdW50cnlDb2RlKSkge1xuICAgICAgLy8gaWYgbm90IHZhbGlkIGNvdW50cnlDb2RlLCB0aGVuIHNldCBkZWZhdWx0IGNvdW50cnkgdG8gSW5kaWEgKElOKVxuICAgICAgY291bnRyeUNvZGUgPSAnSU4nO1xuICAgICAgc3RyaWN0ID0gZmFsc2U7XG4gICAgfVxuXG4gICAgdHJ5IHtcbiAgICAgIGNvbnN0IHBob25lTnVtYmVyID0gcGhvbmVVdGlsLnBhcnNlQW5kS2VlcFJhd0lucHV0KHZhbHVlLCBjb3VudHJ5Q29kZSk7XG5cbiAgICAgIGlmICghcGhvbmVVdGlsLmlzUG9zc2libGVOdW1iZXIocGhvbmVOdW1iZXIpKSB7XG4gICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgIH1cblxuICAgICAgY29uc3QgcmVnaW9uQ29kZUZyb21QaG9uZU51bWJlciA9IHBob25lVXRpbC5nZXRSZWdpb25Db2RlRm9yTnVtYmVyKFxuICAgICAgICBwaG9uZU51bWJlclxuICAgICAgKTtcblxuICAgICAgLyogY2hlY2sgaWYgdGhlIGNvdW50cnlDb2RlIHByb3ZpZGVkIHNob3VsZCBiZSB1c2VkIGFzXG4gICAgICAgZGVmYXVsdCBjb3VudHJ5IGNvZGUgb3Igc3RyaWN0bHkgZm9sbG93ZWRcbiAgICAgKi9cbiAgICAgIHJldHVybiBzdHJpY3RcbiAgICAgICAgPyBwaG9uZVV0aWwuaXNWYWxpZE51bWJlckZvclJlZ2lvbihwaG9uZU51bWJlciwgY291bnRyeUNvZGUpXG4gICAgICAgIDogcGhvbmVVdGlsLmlzVmFsaWROdW1iZXJGb3JSZWdpb24oXG4gICAgICAgICAgICBwaG9uZU51bWJlcixcbiAgICAgICAgICAgIHJlZ2lvbkNvZGVGcm9tUGhvbmVOdW1iZXJcbiAgICAgICAgICApO1xuICAgIH0gY2F0Y2gge1xuICAgICAgcmV0dXJuIGZhbHNlO1xuICAgIH1cbiAgfSk7XG59KTtcbiJdLCJuYW1lcyI6WyJwaG9uZVV0aWwiLCJnUGhvbmVOdW1iZXIiLCJQaG9uZU51bWJlclV0aWwiLCJnZXRJbnN0YW5jZSIsIll1cCIsImFkZE1ldGhvZCIsInN0cmluZyIsIllVUF9QSE9ORV9NRVRIT0QiLCJ5dXBQaG9uZSIsImNvdW50cnlDb2RlIiwic3RyaWN0IiwiZXJyb3JNZXNzYWdlIiwidGVzdCIsImVyck1zZyIsIkNMRFJfUkVHSU9OX0NPREVfU0laRSIsImxlbmd0aCIsInZhbHVlIiwicGhvbmVOdW1iZXIiLCJwYXJzZUFuZEtlZXBSYXdJbnB1dCIsImlzUG9zc2libGVOdW1iZXIiLCJyZWdpb25Db2RlRnJvbVBob25lTnVtYmVyIiwiZ2V0UmVnaW9uQ29kZUZvck51bWJlciIsImlzVmFsaWROdW1iZXJGb3JSZWdpb24iXSwibWFwcGluZ3MiOiJhQUdBLElBQU1BLEVBQVlDLFlBQWFDLENBQUFBLGVBQWdCQyxDQUFBQSxXQUE3QixFQTBCbEJDO0dBQUlDLENBQUFBLFNBQUosQ0FBY0QsR0FBSUUsQ0FBQUEsTUFBbEIsQ0FQeUJDLE9BT3pCLENBQTRDQyxRQUFBLENBQzFDQyxDQUQwQyxDQUUxQ0MsQ0FGMEMsQ0FHMUNDLENBSDBDLENBR2pCLFVBRHpCRCxJQUFBQSxFQUFrQixDQUFBLFlBQ2xCQyxJQUFBQSxFQUF1QixVQVNoQixLQUFLQyxDQUFBQSxJQUFMLENBbkJnQkwsT0FtQmhCLENBTm1CLFFBQXhCTSxHQUFBLE1BQU9GLEVBQVBFLEVBQW9DRixDQUFwQ0UsQ0FDSUYsQ0FESkUsQ0FUcUIsUUFXakIsR0FYTixNQVd5QkosRUFBbkIsRUFkc0JLLENBY3RCLEdBQW1CTCxDQVZiTSxDQUFBQSxNQVVOLG1EQUFBLENBQ29ETixDQURwRCxDQUVBLHVDQUVDLENBQW9DLFNBQUNPLEVBQWlCLElBZnRDLFdBQXZCLE1BZ0IwQlAsSUFuQkVLLElBbUJGTCxDQWZkTSxDQUFBQSxPQWlCUk4sQ0FDQSxDQURjLElBQ2QsQ0FBQUMsQ0FBQSxDQUFTLENBQUEsS0FHUCxLQUNJTyxFQUFjakIsQ0FBVWtCLENBQUFBLG9CQUFWLENBQStCRixDQUEvQixDQUFzQ1AsQ0FBdEMsS0FFaEIsQ0FBQ1QsQ0FBVW1CLENBQUFBLGdCQUFWLENBQTJCRixDQUEzQixRQUNJLENBQUEsTUFHSEcsRUFBNEJwQixDQUFVcUIsQ0FBQUEsc0JBQVYsQ0FDaENKLENBRGdDLFFBTzNCUCxFQUFBLENBQ0hWLENBQVVzQixDQUFBQSxzQkFBVixDQUFpQ0wsQ0FBakMsQ0FBOENSLENBQTlDLENBREcsQ0FFSFQsQ0FBVXNCLENBQUFBLHNCQUFWLENBQ0VMLENBREYsQ0FFRUcsQ0FGRixDQWhCRixDQW9CRixPQUFBLENBQU0sT0FDQyxDQUFBLENBREQsQ0EzQm1ELENBQXRELENBVGtCLENBSDNCOyJ9 +import{parsePhoneNumberWithError,isValidNumberForRegion}from'libphonenumber-js';import * as Yup from'yup';Yup.addMethod(Yup.string,"phone",function(a,c,b){void 0===c&&(c=!1);void 0===b&&(b="");return this.test("phone","string"===typeof b&&b?b:a?"${path} must be a valid phone number for region "+a:"${path} must be a valid phone number.",function(d){try{var e=parsePhoneNumberWithError(d,a);return e.isPossible()?c&&a?isValidNumberForRegion(d,a):e.isValid():!1}catch(f){return!1}})}) +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoieXVwLXBob25lLmVzbS5qcyIsInNvdXJjZXMiOlsiLi4vc3JjL3l1cC1waG9uZS50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgKiBhcyBZdXAgZnJvbSBcInl1cFwiO1xuaW1wb3J0IHtcbiAgaXNWYWxpZE51bWJlckZvclJlZ2lvbixcbiAgQ291bnRyeUNvZGUsXG4gIHBhcnNlUGhvbmVOdW1iZXJXaXRoRXJyb3IsXG59IGZyb20gXCJsaWJwaG9uZW51bWJlci1qc1wiO1xuXG5kZWNsYXJlIG1vZHVsZSBcInl1cFwiIHtcbiAgZXhwb3J0IGludGVyZmFjZSBTdHJpbmdTY2hlbWEge1xuICAgIC8qKlxuICAgICAqIENoZWNrIGZvciBwaG9uZSBudW1iZXIgdmFsaWRpdHkuXG4gICAgICpcbiAgICAgKiBAcGFyYW0ge0NvdW50cnlDb2RlfSBbY291bnRyeUNvZGVdIFRoZSBjb3VudHJ5IGNvZGUgdG8gY2hlY2sgYWdhaW5zdC5cbiAgICAgKiBAcGFyYW0ge0Jvb2xlYW59IFtzdHJpY3Q9ZmFsc2VdIEhvdyBzdHJpY3RseSBzaG91bGQgaXQgY2hlY2suXG4gICAgICogQHBhcmFtIHtTdHJpbmd9IFtlcnJvck1lc3NhZ2U9REVGQVVMVF9NRVNTQUdFXSBUaGUgZXJyb3IgbWVzc2FnZSB0byByZXR1cm4gaWYgdGhlIHZhbGlkYXRpb24gZmFpbHMuXG4gICAgICovXG4gICAgcGhvbmUoXG4gICAgICBjb3VudHJ5Q29kZT86IENvdW50cnlDb2RlLFxuICAgICAgc3RyaWN0PzogYm9vbGVhbixcbiAgICAgIGVycm9yTWVzc2FnZT86IHN0cmluZ1xuICAgICk6IFN0cmluZ1NjaGVtYTtcbiAgfVxufVxuXG5jb25zdCBZVVBfUEhPTkVfTUVUSE9EID0gXCJwaG9uZVwiO1xuXG5ZdXAuYWRkTWV0aG9kKFxuICBZdXAuc3RyaW5nLFxuICBZVVBfUEhPTkVfTUVUSE9ELFxuICBmdW5jdGlvbiB5dXBQaG9uZShcbiAgICBjb3VudHJ5Q29kZT86IENvdW50cnlDb2RlLFxuICAgIHN0cmljdDogYm9vbGVhbiA9IGZhbHNlLFxuICAgIGVycm9yTWVzc2FnZTogc3RyaW5nID0gXCJcIlxuICApIHtcbiAgICBjb25zdCBlcnJNc2cgPVxuICAgICAgdHlwZW9mIGVycm9yTWVzc2FnZSA9PT0gXCJzdHJpbmdcIiAmJiBlcnJvck1lc3NhZ2VcbiAgICAgICAgPyBlcnJvck1lc3NhZ2VcbiAgICAgICAgOiBjb3VudHJ5Q29kZVxuICAgICAgICA/IGBcXCR7cGF0aH0gbXVzdCBiZSBhIHZhbGlkIHBob25lIG51bWJlciBmb3IgcmVnaW9uICR7Y291bnRyeUNvZGV9YFxuICAgICAgICA6IFwiJHtwYXRofSBtdXN0IGJlIGEgdmFsaWQgcGhvbmUgbnVtYmVyLlwiO1xuXG4gICAgLy8gQHRzLWlnbm9yZVxuICAgIHJldHVybiB0aGlzLnRlc3QoWVVQX1BIT05FX01FVEhPRCwgZXJyTXNnLCAodmFsdWU6IHN0cmluZykgPT4ge1xuICAgICAgdHJ5IHtcbiAgICAgICAgY29uc3QgcGhvbmVOdW1iZXIgPSBwYXJzZVBob25lTnVtYmVyV2l0aEVycm9yKHZhbHVlLCBjb3VudHJ5Q29kZSk7XG5cbiAgICAgICAgaWYgKCFwaG9uZU51bWJlci5pc1Bvc3NpYmxlKCkpIHtcbiAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgIH1cblxuICAgICAgICAvKiBjaGVjayBpZiB0aGUgY291bnRyeUNvZGUgcHJvdmlkZWQgc2hvdWxkIGJlIHVzZWQgYXNcbiAgICAgICAgICBkZWZhdWx0IGNvdW50cnkgY29kZSBvciBzdHJpY3RseSBmb2xsb3dlZFxuICAgICAgICAqL1xuICAgICAgICBpZiAoc3RyaWN0ICYmIGNvdW50cnlDb2RlKSB7XG4gICAgICAgICAgcmV0dXJuIGlzVmFsaWROdW1iZXJGb3JSZWdpb24odmFsdWUsIGNvdW50cnlDb2RlKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBwaG9uZU51bWJlci5pc1ZhbGlkKCk7XG4gICAgICB9IGNhdGNoIHtcbiAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgfVxuICAgIH0pO1xuICB9XG4pO1xuIl0sIm5hbWVzIjpbIll1cCIsImFkZE1ldGhvZCIsInN0cmluZyIsIllVUF9QSE9ORV9NRVRIT0QiLCJ5dXBQaG9uZSIsImNvdW50cnlDb2RlIiwic3RyaWN0IiwiZXJyb3JNZXNzYWdlIiwidGVzdCIsImVyck1zZyIsInZhbHVlIiwicGhvbmVOdW1iZXIiLCJwYXJzZVBob25lTnVtYmVyV2l0aEVycm9yIiwiaXNQb3NzaWJsZSIsImlzVmFsaWROdW1iZXJGb3JSZWdpb24iLCJpc1ZhbGlkIl0sIm1hcHBpbmdzIjoiYUEwQkFBLEdBQUlDLENBQUFBLFNBQUosQ0FDRUQsR0FBSUUsQ0FBQUEsTUFETixDQUZ5QkMsT0FFekIsQ0FHRUMsUUFBQSxDQUNFQyxDQURGLENBRUVDLENBRkYsQ0FHRUMsQ0FIRixDQUcyQixVQUR6QkQsSUFBQUEsRUFBa0IsQ0FBQSxZQUNsQkMsSUFBQUEsRUFBdUIsVUFVaEIsS0FBS0MsQ0FBQUEsSUFBTCxDQWxCY0wsT0FrQmQsQ0FQbUIsUUFBeEJNLEdBQUEsTUFBT0YsRUFBUEUsRUFBb0NGLENBQXBDRSxDQUNJRixDQURKRSxDQUVJSixDQUFBLG1EQUFBLENBQ29EQSxDQURwRCxDQUVBLHVDQUdDLENBQW9DLFNBQUNLLEVBQWlCLElBQ3ZELEtBQ0lDLEVBQWNDLHlCQUFBLENBQTBCRixDQUExQixDQUFpQ0wsQ0FBakMsUUFFZk0sRUFBWUUsQ0FBQUEsVUFBWixHQU9EUCxHQUFVRCxFQUNMUyxzQkFBQSxDQUF1QkosQ0FBdkIsQ0FBOEJMLENBQTlCLEVBR0ZNLENBQVlJLENBQUFBLE9BQVosR0FWRSxDQUFBLENBSlAsQ0FlRixPQUFBLENBQU0sT0FDQyxDQUFBLENBREQsQ0FoQm1ELENBQXRELENBVmtCLENBTjdCOyJ9 diff --git a/dist/yup-phone.umd.d.ts b/dist/yup-phone.umd.d.ts index 98af4a9f..e267c0eb 100644 --- a/dist/yup-phone.umd.d.ts +++ b/dist/yup-phone.umd.d.ts @@ -1,13 +1,13 @@ -declare module "yup" { - interface StringSchema { - /** - * Check for phone number validity. - * - * @param {String} [countryCode=IN] The country code to check against. - * @param {Boolean} [strict=false] How strictly should it check. - * @param {String} [errorMessage=DEFAULT_MESSAGE] The error message to return if the validation fails. - */ - phone(countryCode?: string, strict?: boolean, errorMessage?: string): StringSchema; - } -} -export {}; +import { CountryCode } from "libphonenumber-js"; +declare module "yup" { + interface StringSchema { + /** + * Check for phone number validity. + * + * @param {CountryCode} [countryCode] The country code to check against. + * @param {Boolean} [strict=false] How strictly should it check. + * @param {String} [errorMessage=DEFAULT_MESSAGE] The error message to return if the validation fails. + */ + phone(countryCode?: CountryCode, strict?: boolean, errorMessage?: string): StringSchema; + } +} diff --git a/dist/yup-phone.umd.js b/dist/yup-phone.umd.js index 6da071b9..496d0455 100644 --- a/dist/yup-phone.umd.js +++ b/dist/yup-phone.umd.js @@ -24,125 +24,4150 @@ var Yup__namespace = /*#__PURE__*/_interopNamespace(Yup); - var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + // This file is a workaround for a bug in web browsers' "native" + // ES6 importing system which is uncapable of importing "*.json" files. + // https://github.com/catamphetamine/libphonenumber-js/issues/239 + var metadata = { + "version": 4, + "country_calling_codes": { + "1": ["US", "AG", "AI", "AS", "BB", "BM", "BS", "CA", "DM", "DO", "GD", "GU", "JM", "KN", "KY", "LC", "MP", "MS", "PR", "SX", "TC", "TT", "VC", "VG", "VI"], + "7": ["RU", "KZ"], + "20": ["EG"], + "27": ["ZA"], + "30": ["GR"], + "31": ["NL"], + "32": ["BE"], + "33": ["FR"], + "34": ["ES"], + "36": ["HU"], + "39": ["IT", "VA"], + "40": ["RO"], + "41": ["CH"], + "43": ["AT"], + "44": ["GB", "GG", "IM", "JE"], + "45": ["DK"], + "46": ["SE"], + "47": ["NO", "SJ"], + "48": ["PL"], + "49": ["DE"], + "51": ["PE"], + "52": ["MX"], + "53": ["CU"], + "54": ["AR"], + "55": ["BR"], + "56": ["CL"], + "57": ["CO"], + "58": ["VE"], + "60": ["MY"], + "61": ["AU", "CC", "CX"], + "62": ["ID"], + "63": ["PH"], + "64": ["NZ"], + "65": ["SG"], + "66": ["TH"], + "81": ["JP"], + "82": ["KR"], + "84": ["VN"], + "86": ["CN"], + "90": ["TR"], + "91": ["IN"], + "92": ["PK"], + "93": ["AF"], + "94": ["LK"], + "95": ["MM"], + "98": ["IR"], + "211": ["SS"], + "212": ["MA", "EH"], + "213": ["DZ"], + "216": ["TN"], + "218": ["LY"], + "220": ["GM"], + "221": ["SN"], + "222": ["MR"], + "223": ["ML"], + "224": ["GN"], + "225": ["CI"], + "226": ["BF"], + "227": ["NE"], + "228": ["TG"], + "229": ["BJ"], + "230": ["MU"], + "231": ["LR"], + "232": ["SL"], + "233": ["GH"], + "234": ["NG"], + "235": ["TD"], + "236": ["CF"], + "237": ["CM"], + "238": ["CV"], + "239": ["ST"], + "240": ["GQ"], + "241": ["GA"], + "242": ["CG"], + "243": ["CD"], + "244": ["AO"], + "245": ["GW"], + "246": ["IO"], + "247": ["AC"], + "248": ["SC"], + "249": ["SD"], + "250": ["RW"], + "251": ["ET"], + "252": ["SO"], + "253": ["DJ"], + "254": ["KE"], + "255": ["TZ"], + "256": ["UG"], + "257": ["BI"], + "258": ["MZ"], + "260": ["ZM"], + "261": ["MG"], + "262": ["RE", "YT"], + "263": ["ZW"], + "264": ["NA"], + "265": ["MW"], + "266": ["LS"], + "267": ["BW"], + "268": ["SZ"], + "269": ["KM"], + "290": ["SH", "TA"], + "291": ["ER"], + "297": ["AW"], + "298": ["FO"], + "299": ["GL"], + "350": ["GI"], + "351": ["PT"], + "352": ["LU"], + "353": ["IE"], + "354": ["IS"], + "355": ["AL"], + "356": ["MT"], + "357": ["CY"], + "358": ["FI", "AX"], + "359": ["BG"], + "370": ["LT"], + "371": ["LV"], + "372": ["EE"], + "373": ["MD"], + "374": ["AM"], + "375": ["BY"], + "376": ["AD"], + "377": ["MC"], + "378": ["SM"], + "380": ["UA"], + "381": ["RS"], + "382": ["ME"], + "383": ["XK"], + "385": ["HR"], + "386": ["SI"], + "387": ["BA"], + "389": ["MK"], + "420": ["CZ"], + "421": ["SK"], + "423": ["LI"], + "500": ["FK"], + "501": ["BZ"], + "502": ["GT"], + "503": ["SV"], + "504": ["HN"], + "505": ["NI"], + "506": ["CR"], + "507": ["PA"], + "508": ["PM"], + "509": ["HT"], + "590": ["GP", "BL", "MF"], + "591": ["BO"], + "592": ["GY"], + "593": ["EC"], + "594": ["GF"], + "595": ["PY"], + "596": ["MQ"], + "597": ["SR"], + "598": ["UY"], + "599": ["CW", "BQ"], + "670": ["TL"], + "672": ["NF"], + "673": ["BN"], + "674": ["NR"], + "675": ["PG"], + "676": ["TO"], + "677": ["SB"], + "678": ["VU"], + "679": ["FJ"], + "680": ["PW"], + "681": ["WF"], + "682": ["CK"], + "683": ["NU"], + "685": ["WS"], + "686": ["KI"], + "687": ["NC"], + "688": ["TV"], + "689": ["PF"], + "690": ["TK"], + "691": ["FM"], + "692": ["MH"], + "850": ["KP"], + "852": ["HK"], + "853": ["MO"], + "855": ["KH"], + "856": ["LA"], + "880": ["BD"], + "886": ["TW"], + "960": ["MV"], + "961": ["LB"], + "962": ["JO"], + "963": ["SY"], + "964": ["IQ"], + "965": ["KW"], + "966": ["SA"], + "967": ["YE"], + "968": ["OM"], + "970": ["PS"], + "971": ["AE"], + "972": ["IL"], + "973": ["BH"], + "974": ["QA"], + "975": ["BT"], + "976": ["MN"], + "977": ["NP"], + "992": ["TJ"], + "993": ["TM"], + "994": ["AZ"], + "995": ["GE"], + "996": ["KG"], + "998": ["UZ"] + }, + "countries": { + "AC": ["247", "00", "(?:[01589]\\d|[46])\\d{4}", [5, 6]], + "AD": ["376", "00", "(?:1|6\\d)\\d{7}|[135-9]\\d{5}", [6, 8, 9], [["(\\d{3})(\\d{3})", "$1 $2", ["[135-9]"]], ["(\\d{4})(\\d{4})", "$1 $2", ["1"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["6"]]]], + "AE": ["971", "00", "(?:[4-7]\\d|9[0-689])\\d{7}|800\\d{2,9}|[2-4679]\\d{7}", [5, 6, 7, 8, 9, 10, 11, 12], [["(\\d{3})(\\d{2,9})", "$1 $2", ["60|8"]], ["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["[236]|[479][2-8]"], "0$1"], ["(\\d{3})(\\d)(\\d{5})", "$1 $2 $3", ["[479]"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["5"], "0$1"]], "0"], + "AF": ["93", "00", "[2-7]\\d{8}", [9], [["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[2-7]"], "0$1"]], "0"], + "AG": ["1", "011", "(?:268|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([457]\\d{6})$|1", "268$1", 0, "268"], + "AI": ["1", "011", "(?:264|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2457]\\d{6})$|1", "264$1", 0, "264"], + "AL": ["355", "00", "(?:700\\d\\d|900)\\d{3}|8\\d{5,7}|(?:[2-5]|6\\d)\\d{7}", [6, 7, 8, 9], [["(\\d{3})(\\d{3,4})", "$1 $2", ["80|9"], "0$1"], ["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["4[2-6]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2358][2-5]|4"], "0$1"], ["(\\d{3})(\\d{5})", "$1 $2", ["[23578]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["6"], "0$1"]], "0"], + "AM": ["374", "00", "(?:[1-489]\\d|55|60|77)\\d{6}", [8], [["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["[89]0"], "0 $1"], ["(\\d{3})(\\d{5})", "$1 $2", ["2|3[12]"], "(0$1)"], ["(\\d{2})(\\d{6})", "$1 $2", ["1|47"], "(0$1)"], ["(\\d{2})(\\d{6})", "$1 $2", ["[3-9]"], "0$1"]], "0"], + "AO": ["244", "00", "[29]\\d{8}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[29]"]]]], + "AR": ["54", "00", "(?:11|[89]\\d\\d)\\d{8}|[2368]\\d{9}", [10, 11], [["(\\d{4})(\\d{2})(\\d{4})", "$1 $2-$3", ["2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])", "2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)", "2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]", "2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"], "0$1", 1], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2-$3", ["1"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{4})", "$1-$2-$3", ["[68]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2-$3", ["[23]"], "0$1", 1], ["(\\d)(\\d{4})(\\d{2})(\\d{4})", "$2 15-$3-$4", ["9(?:2[2-469]|3[3-578])", "9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))", "9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)", "9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]", "9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"], "0$1", 0, "$1 $2 $3-$4"], ["(\\d)(\\d{2})(\\d{4})(\\d{4})", "$2 15-$3-$4", ["91"], "0$1", 0, "$1 $2 $3-$4"], ["(\\d{3})(\\d{3})(\\d{5})", "$1-$2-$3", ["8"], "0$1"], ["(\\d)(\\d{3})(\\d{3})(\\d{4})", "$2 15-$3-$4", ["9"], "0$1", 0, "$1 $2 $3-$4"]], "0", 0, "0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?", "9$1"], + "AS": ["1", "011", "(?:[58]\\d\\d|684|900)\\d{7}", [10], 0, "1", 0, "([267]\\d{6})$|1", "684$1", 0, "684"], + "AT": ["43", "00", "1\\d{3,12}|2\\d{6,12}|43(?:(?:0\\d|5[02-9])\\d{3,9}|2\\d{4,5}|[3467]\\d{4}|8\\d{4,6}|9\\d{4,7})|5\\d{4,12}|8\\d{7,12}|9\\d{8,12}|(?:[367]\\d|4[0-24-9])\\d{4,11}", [4, 5, 6, 7, 8, 9, 10, 11, 12, 13], [["(\\d)(\\d{3,12})", "$1 $2", ["1(?:11|[2-9])"], "0$1"], ["(\\d{3})(\\d{2})", "$1 $2", ["517"], "0$1"], ["(\\d{2})(\\d{3,5})", "$1 $2", ["5[079]"], "0$1"], ["(\\d{3})(\\d{3,10})", "$1 $2", ["(?:31|4)6|51|6(?:5[0-3579]|[6-9])|7(?:20|32|8)|[89]"], "0$1"], ["(\\d{4})(\\d{3,9})", "$1 $2", ["[2-467]|5[2-6]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["5"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4,7})", "$1 $2 $3", ["5"], "0$1"]], "0"], + "AU": ["61", "001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011", "1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}", [5, 6, 7, 8, 9, 10, 12], [["(\\d{2})(\\d{3,4})", "$1 $2", ["16"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2,4})", "$1 $2 $3", ["16"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["14|4"], "0$1"], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["[2378]"], "(0$1)"], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1(?:30|[89])"]]], "0", 0, "(183[12])|0", 0, 0, 0, [["(?:(?:2(?:[0-26-9]\\d|3[0-8]|4[02-9]|5[0135-9])|3(?:[0-3589]\\d|4[0-578]|6[1-9]|7[0-35-9])|7(?:[013-57-9]\\d|2[0-8]))\\d{3}|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4]))|(?:6[0-8]|[78]\\d)\\d{3}|9(?:[02-9]\\d{3}|1(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79])))))\\d{3}", [9]], ["4(?:79[01]|83[0-389]|93[0-6])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[016-9]|7[02-8]|8[0-24-9]|9[0-27-9])\\d{6}", [9]], ["180(?:0\\d{3}|2)\\d{3}", [7, 10]], ["190[0-26]\\d{6}", [10]], 0, 0, 0, ["163\\d{2,6}", [5, 6, 7, 8, 9]], ["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}", [9]], ["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}", [6, 8, 10, 12]]], "0011"], + "AW": ["297", "00", "(?:[25-79]\\d\\d|800)\\d{4}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[25-9]"]]]], + "AX": ["358", "00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))", "2\\d{4,9}|35\\d{4,5}|(?:60\\d\\d|800)\\d{4,6}|7\\d{5,11}|(?:[14]\\d|3[0-46-9]|50)\\d{4,8}", [5, 6, 7, 8, 9, 10, 11, 12], 0, "0", 0, 0, 0, 0, "18", 0, "00"], + "AZ": ["994", "00", "365\\d{6}|(?:[124579]\\d|60|88)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["90"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["1[28]|2|365|46", "1[28]|2|365[45]|46", "1[28]|2|365(?:4|5[02])|46"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[13-9]"], "0$1"]], "0"], + "BA": ["387", "00", "6\\d{8}|(?:[35689]\\d|49|70)\\d{6}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["6[1-3]|[7-9]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2-$3", ["[3-5]|6[56]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3 $4", ["6"], "0$1"]], "0"], + "BB": ["1", "011", "(?:246|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-9]\\d{6})$|1", "246$1", 0, "246"], + "BD": ["880", "00", "[1-469]\\d{9}|8[0-79]\\d{7,8}|[2-79]\\d{8}|[2-9]\\d{7}|[3-9]\\d{6}|[57-9]\\d{5}", [6, 7, 8, 9, 10], [["(\\d{2})(\\d{4,6})", "$1-$2", ["31[5-8]|[459]1"], "0$1"], ["(\\d{3})(\\d{3,7})", "$1-$2", ["3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:28|4[14]|5)|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]"], "0$1"], ["(\\d{4})(\\d{3,6})", "$1-$2", ["[13-9]|22"], "0$1"], ["(\\d)(\\d{7,8})", "$1-$2", ["2"], "0$1"]], "0"], + "BE": ["32", "00", "4\\d{8}|[1-9]\\d{7}", [8, 9], [["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["(?:80|9)0"], "0$1"], ["(\\d)(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[239]|4[23]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[15-8]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["4"], "0$1"]], "0"], + "BF": ["226", "00", "[025-7]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[025-7]"]]]], + "BG": ["359", "00", "00800\\d{7}|[2-7]\\d{6,7}|[89]\\d{6,8}|2\\d{5}", [6, 7, 8, 9, 12], [["(\\d)(\\d)(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["2"], "0$1"], ["(\\d{3})(\\d{4})", "$1 $2", ["43[1-6]|70[1-9]"], "0$1"], ["(\\d)(\\d{3})(\\d{3,4})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2,3})", "$1 $2 $3", ["[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["(?:70|8)0"], "0$1"], ["(\\d{3})(\\d{3})(\\d{2})", "$1 $2 $3", ["43[1-7]|7"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[48]|9[08]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["9"], "0$1"]], "0"], + "BH": ["973", "00", "[136-9]\\d{7}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["[13679]|8[047]"]]]], + "BI": ["257", "00", "(?:[267]\\d|31)\\d{6}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2367]"]]]], + "BJ": ["229", "00", "[24-689]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[24-689]"]]]], + "BL": ["590", "00", "590\\d{6}|(?:69|80|9\\d)\\d{7}", [9], 0, "0", 0, 0, 0, 0, 0, [["590(?:2[7-9]|5[12]|87)\\d{4}"], ["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"], ["80[0-5]\\d{6}"], 0, 0, 0, 0, 0, ["9(?:(?:395|76[018])\\d|475[0-2])\\d{4}"]]], + "BM": ["1", "011", "(?:441|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-9]\\d{6})$|1", "441$1", 0, "441"], + "BN": ["673", "00", "[2-578]\\d{6}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[2-578]"]]]], + "BO": ["591", "00(?:1\\d)?", "(?:[2-467]\\d\\d|8001)\\d{5}", [8, 9], [["(\\d)(\\d{7})", "$1 $2", ["[23]|4[46]"]], ["(\\d{8})", "$1", ["[67]"]], ["(\\d{3})(\\d{2})(\\d{4})", "$1 $2 $3", ["8"]]], "0", 0, "0(1\\d)?"], + "BQ": ["599", "00", "(?:[34]1|7\\d)\\d{5}", [7], 0, 0, 0, 0, 0, 0, "[347]"], + "BR": ["55", "00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)", "(?:[1-46-9]\\d\\d|5(?:[0-46-9]\\d|5[0-46-9]))\\d{8}|[1-9]\\d{9}|[3589]\\d{8}|[34]\\d{7}", [8, 9, 10, 11], [["(\\d{4})(\\d{4})", "$1-$2", ["300|4(?:0[02]|37)", "4(?:02|37)0|[34]00"]], ["(\\d{3})(\\d{2,3})(\\d{4})", "$1 $2 $3", ["(?:[358]|90)0"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2-$3", ["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]"], "($1)"], ["(\\d{2})(\\d{5})(\\d{4})", "$1 $2-$3", ["[16][1-9]|[2-57-9]"], "($1)"]], "0", 0, "(?:0|90)(?:(1[245]|2[1-35]|31|4[13]|[56]5|99)(\\d{10,11}))?", "$2"], + "BS": ["1", "011", "(?:242|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([3-8]\\d{6})$|1", "242$1", 0, "242"], + "BT": ["975", "00", "[17]\\d{7}|[2-8]\\d{6}", [7, 8], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-68]|7[246]"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["1[67]|7"]]]], + "BW": ["267", "00", "(?:0800|(?:[37]|800)\\d)\\d{6}|(?:[2-6]\\d|90)\\d{5}", [7, 8, 10], [["(\\d{2})(\\d{5})", "$1 $2", ["90"]], ["(\\d{3})(\\d{4})", "$1 $2", ["[24-6]|3[15-79]"]], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[37]"]], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["0"]], ["(\\d{3})(\\d{4})(\\d{3})", "$1 $2 $3", ["8"]]]], + "BY": ["375", "810", "(?:[12]\\d|33|44|902)\\d{7}|8(?:0[0-79]\\d{5,7}|[1-7]\\d{9})|8(?:1[0-489]|[5-79]\\d)\\d{7}|8[1-79]\\d{6,7}|8[0-79]\\d{5}|8\\d{5}", [6, 7, 8, 9, 10, 11], [["(\\d{3})(\\d{3})", "$1 $2", ["800"], "8 $1"], ["(\\d{3})(\\d{2})(\\d{2,4})", "$1 $2 $3", ["800"], "8 $1"], ["(\\d{4})(\\d{2})(\\d{3})", "$1 $2-$3", ["1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])", "1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])"], "8 0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2-$3-$4", ["1(?:[56]|7[467])|2[1-3]"], "8 0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2-$3-$4", ["[1-4]"], "8 0$1"], ["(\\d{3})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["[89]"], "8 $1"]], "8", 0, "0|80?", 0, 0, 0, 0, "8~10"], + "BZ": ["501", "00", "(?:0800\\d|[2-8])\\d{6}", [7, 11], [["(\\d{3})(\\d{4})", "$1-$2", ["[2-8]"]], ["(\\d)(\\d{3})(\\d{4})(\\d{3})", "$1-$2-$3-$4", ["0"]]]], + "CA": ["1", "011", "(?:[2-8]\\d|90)\\d{8}|3\\d{6}", [7, 10], 0, "1", 0, 0, 0, 0, 0, [["(?:2(?:04|[23]6|[48]9|50|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|73)|90[25])[2-9]\\d{6}", [10]], ["", [10]], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}", [10]], ["900[2-9]\\d{6}", [10]], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:00|2[125-9]|33|44|66|77|88)|622)[2-9]\\d{6}", [10]], 0, ["310\\d{4}", [7]], 0, ["600[2-9]\\d{6}", [10]]]], + "CC": ["61", "001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011", "1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}", [6, 7, 8, 9, 10, 12], 0, "0", 0, "([59]\\d{7})$|0", "8$1", 0, 0, [["8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}", [9]], ["4(?:79[01]|83[0-389]|93[0-6])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[016-9]|7[02-8]|8[0-24-9]|9[0-27-9])\\d{6}", [9]], ["180(?:0\\d{3}|2)\\d{3}", [7, 10]], ["190[0-26]\\d{6}", [10]], 0, 0, 0, 0, ["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}", [9]], ["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}", [6, 8, 10, 12]]], "0011"], + "CD": ["243", "00", "[189]\\d{8}|[1-68]\\d{6}", [7, 9], [["(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3", ["88"], "0$1"], ["(\\d{2})(\\d{5})", "$1 $2", ["[1-6]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[89]"], "0$1"]], "0"], + "CF": ["236", "00", "(?:[27]\\d{3}|8776)\\d{4}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[278]"]]]], + "CG": ["242", "00", "222\\d{6}|(?:0\\d|80)\\d{7}", [9], [["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["8"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[02]"]]]], + "CH": ["41", "00", "8\\d{11}|[2-9]\\d{8}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["8[047]|90"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2-79]|81"], "0$1"], ["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4 $5", ["8"], "0$1"]], "0"], + "CI": ["225", "00", "[02]\\d{9}", [10], [["(\\d{2})(\\d{2})(\\d)(\\d{5})", "$1 $2 $3 $4", ["2"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3 $4", ["0"]]]], + "CK": ["682", "00", "[2-578]\\d{4}", [5], [["(\\d{2})(\\d{3})", "$1 $2", ["[2-578]"]]]], + "CL": ["56", "(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0", "12300\\d{6}|6\\d{9,10}|[2-9]\\d{8}", [9, 10, 11], [["(\\d{5})(\\d{4})", "$1 $2", ["219", "2196"], "($1)"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["44"]], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["2[1-36]"], "($1)"], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["9[2-9]"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-9]|[1-9])"], "($1)"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["60|8"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"]], ["(\\d{3})(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3 $4", ["60"]]]], + "CM": ["237", "00", "[26]\\d{8}|88\\d{6,7}", [8, 9], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["88"]], ["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4 $5", ["[26]|88"]]]], + "CN": ["86", "00|1(?:[12]\\d|79)\\d\\d00", "1[127]\\d{8,9}|2\\d{9}(?:\\d{2})?|[12]\\d{6,7}|86\\d{6}|(?:1[03-689]\\d|6)\\d{7,9}|(?:[3-579]\\d|8[0-57-9])\\d{6,9}", [7, 8, 9, 10, 11, 12], [["(\\d{2})(\\d{5,6})", "$1 $2", ["(?:10|2[0-57-9])[19]", "(?:10|2[0-57-9])(?:10|9[56])", "10(?:10|9[56])|2[0-57-9](?:100|9[56])"], "0$1"], ["(\\d{3})(\\d{5,6})", "$1 $2", ["3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]", "(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))[19]", "85[23](?:10|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:10|9[56])", "85[23](?:100|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:100|9[56])"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["(?:4|80)0"]], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["10|2(?:[02-57-9]|1[1-9])", "10|2(?:[02-57-9]|1[1-9])", "10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]"], "0$1", 1], ["(\\d{3})(\\d{7,8})", "$1 $2", ["9"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["80"], "0$1", 1], ["(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["[3-578]"], "0$1", 1], ["(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["1[3-9]"]], ["(\\d{2})(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3 $4", ["[12]"], "0$1", 1]], "0", 0, "(1(?:[12]\\d|79)\\d\\d)|0", 0, 0, 0, 0, "00"], + "CO": ["57", "00(?:4(?:[14]4|56)|[579])", "(?:60\\d\\d|9101)\\d{6}|(?:1\\d|3)\\d{9}", [10, 11], [["(\\d{3})(\\d{7})", "$1 $2", ["6"], "($1)"], ["(\\d{3})(\\d{7})", "$1 $2", ["3[0-357]|91"]], ["(\\d)(\\d{3})(\\d{7})", "$1-$2-$3", ["1"], "0$1", 0, "$1 $2 $3"]], "0", 0, "0(4(?:[14]4|56)|[579])?"], + "CR": ["506", "00", "(?:8\\d|90)\\d{8}|(?:[24-8]\\d{3}|3005)\\d{4}", [8, 10], [["(\\d{4})(\\d{4})", "$1 $2", ["[2-7]|8[3-9]"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1-$2-$3", ["[89]"]]], 0, 0, "(19(?:0[0-2468]|1[09]|20|66|77|99))"], + "CU": ["53", "119", "[27]\\d{6,7}|[34]\\d{5,7}|(?:5|8\\d\\d)\\d{7}", [6, 7, 8, 10], [["(\\d{2})(\\d{4,6})", "$1 $2", ["2[1-4]|[34]"], "(0$1)"], ["(\\d)(\\d{6,7})", "$1 $2", ["7"], "(0$1)"], ["(\\d)(\\d{7})", "$1 $2", ["5"], "0$1"], ["(\\d{3})(\\d{7})", "$1 $2", ["8"], "0$1"]], "0"], + "CV": ["238", "0", "(?:[2-59]\\d\\d|800)\\d{4}", [7], [["(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3", ["[2-589]"]]]], + "CW": ["599", "00", "(?:[34]1|60|(?:7|9\\d)\\d)\\d{5}", [7, 8], [["(\\d{3})(\\d{4})", "$1 $2", ["[3467]"]], ["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["9[4-8]"]]], 0, 0, 0, 0, 0, "[69]"], + "CX": ["61", "001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011", "1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}", [6, 7, 8, 9, 10, 12], 0, "0", 0, "([59]\\d{7})$|0", "8$1", 0, 0, [["8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}", [9]], ["4(?:79[01]|83[0-389]|93[0-6])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[016-9]|7[02-8]|8[0-24-9]|9[0-27-9])\\d{6}", [9]], ["180(?:0\\d{3}|2)\\d{3}", [7, 10]], ["190[0-26]\\d{6}", [10]], 0, 0, 0, 0, ["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}", [9]], ["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}", [6, 8, 10, 12]]], "0011"], + "CY": ["357", "00", "(?:[279]\\d|[58]0)\\d{6}", [8], [["(\\d{2})(\\d{6})", "$1 $2", ["[257-9]"]]]], + "CZ": ["420", "00", "(?:[2-578]\\d|60)\\d{7}|9\\d{8,11}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-8]|9[015-7]"]], ["(\\d{2})(\\d{3})(\\d{3})(\\d{2})", "$1 $2 $3 $4", ["96"]], ["(\\d{2})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["9"]], ["(\\d{3})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["9"]]]], + "DE": ["49", "00", "[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:2[024-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[015]\\d|2[13]|31|[46][1-8])\\d{1,9}", [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], [["(\\d{2})(\\d{3,13})", "$1 $2", ["3[02]|40|[68]9"], "0$1"], ["(\\d{3})(\\d{3,12})", "$1 $2", ["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1", "2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"], "0$1"], ["(\\d{4})(\\d{2,11})", "$1 $2", ["[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]", "[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]"], "0$1"], ["(\\d{3})(\\d{4})", "$1 $2", ["138"], "0$1"], ["(\\d{5})(\\d{2,10})", "$1 $2", ["3"], "0$1"], ["(\\d{3})(\\d{5,11})", "$1 $2", ["181"], "0$1"], ["(\\d{3})(\\d)(\\d{4,10})", "$1 $2 $3", ["1(?:3|80)|9"], "0$1"], ["(\\d{3})(\\d{7,8})", "$1 $2", ["1[67]"], "0$1"], ["(\\d{3})(\\d{7,12})", "$1 $2", ["8"], "0$1"], ["(\\d{5})(\\d{6})", "$1 $2", ["185", "1850", "18500"], "0$1"], ["(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["7"], "0$1"], ["(\\d{4})(\\d{7})", "$1 $2", ["18[68]"], "0$1"], ["(\\d{5})(\\d{6})", "$1 $2", ["15[0568]"], "0$1"], ["(\\d{4})(\\d{7})", "$1 $2", ["15[1279]"], "0$1"], ["(\\d{3})(\\d{8})", "$1 $2", ["18"], "0$1"], ["(\\d{3})(\\d{2})(\\d{7,8})", "$1 $2 $3", ["1(?:6[023]|7)"], "0$1"], ["(\\d{4})(\\d{2})(\\d{7})", "$1 $2 $3", ["15[279]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{8})", "$1 $2 $3", ["15"], "0$1"]], "0"], + "DJ": ["253", "00", "(?:2\\d|77)\\d{6}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[27]"]]]], + "DK": ["45", "00", "[2-9]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2-9]"]]]], + "DM": ["1", "011", "(?:[58]\\d\\d|767|900)\\d{7}", [10], 0, "1", 0, "([2-7]\\d{6})$|1", "767$1", 0, "767"], + "DO": ["1", "011", "(?:[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, 0, 0, 0, "8001|8[024]9"], + "DZ": ["213", "00", "(?:[1-4]|[5-79]\\d|80)\\d{7}", [8, 9], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[1-4]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["9"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[5-8]"], "0$1"]], "0"], + "EC": ["593", "00", "1\\d{9,10}|(?:[2-7]|9\\d)\\d{7}", [8, 9, 10, 11], [["(\\d)(\\d{3})(\\d{4})", "$1 $2-$3", ["[2-7]"], "(0$1)", 0, "$1-$2-$3"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["9"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["1"]]], "0"], + "EE": ["372", "00", "8\\d{9}|[4578]\\d{7}|(?:[3-8]\\d|90)\\d{5}", [7, 8, 10], [["(\\d{3})(\\d{4})", "$1 $2", ["[369]|4[3-8]|5(?:[0-2]|5[0-478]|6[45])|7[1-9]|88", "[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]|88"]], ["(\\d{4})(\\d{3,4})", "$1 $2", ["[45]|8(?:00|[1-49])", "[45]|8(?:00[1-9]|[1-49])"]], ["(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3", ["7"]], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"]]]], + "EG": ["20", "00", "[189]\\d{8,9}|[24-6]\\d{8}|[135]\\d{7}", [8, 9, 10], [["(\\d)(\\d{7,8})", "$1 $2", ["[23]"], "0$1"], ["(\\d{2})(\\d{6,7})", "$1 $2", ["1[35]|[4-6]|8[2468]|9[235-7]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[189]"], "0$1"]], "0"], + "EH": ["212", "00", "[5-8]\\d{8}", [9], 0, "0", 0, 0, 0, 0, "528[89]"], + "ER": ["291", "00", "[178]\\d{6}", [7], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["[178]"], "0$1"]], "0"], + "ES": ["34", "00", "[5-9]\\d{8}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[89]00"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[5-9]"]]]], + "ET": ["251", "00", "(?:11|[2-579]\\d)\\d{7}", [9], [["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[1-579]"], "0$1"]], "0"], + "FI": ["358", "00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))", "[1-35689]\\d{4}|7\\d{10,11}|(?:[124-7]\\d|3[0-46-9])\\d{8}|[1-9]\\d{5,8}", [5, 6, 7, 8, 9, 10, 11, 12], [["(\\d)(\\d{4,9})", "$1 $2", ["[2568][1-8]|3(?:0[1-9]|[1-9])|9"], "0$1"], ["(\\d{3})(\\d{3,7})", "$1 $2", ["[12]00|[368]|70[07-9]"], "0$1"], ["(\\d{2})(\\d{4,8})", "$1 $2", ["[1245]|7[135]"], "0$1"], ["(\\d{2})(\\d{6,10})", "$1 $2", ["7"], "0$1"]], "0", 0, 0, 0, 0, "1[03-79]|[2-9]", 0, "00"], + "FJ": ["679", "0(?:0|52)", "45\\d{5}|(?:0800\\d|[235-9])\\d{6}", [7, 11], [["(\\d{3})(\\d{4})", "$1 $2", ["[235-9]|45"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["0"]]], 0, 0, 0, 0, 0, 0, 0, "00"], + "FK": ["500", "00", "[2-7]\\d{4}", [5]], + "FM": ["691", "00", "(?:[39]\\d\\d|820)\\d{4}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[389]"]]]], + "FO": ["298", "00", "[2-9]\\d{5}", [6], [["(\\d{6})", "$1", ["[2-9]"]]], 0, 0, "(10(?:01|[12]0|88))"], + "FR": ["33", "00", "[1-9]\\d{8}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"], "0 $1"], ["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4 $5", ["[1-79]"], "0$1"]], "0"], + "GA": ["241", "00", "(?:[067]\\d|11)\\d{6}|[2-7]\\d{6}", [7, 8], [["(\\d)(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2-7]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["0"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["11|[67]"], "0$1"]], 0, 0, "0(11\\d{6}|60\\d{6}|61\\d{6}|6[256]\\d{6}|7[467]\\d{6})", "$1"], + "GB": ["44", "00", "[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}", [7, 9, 10], [["(\\d{3})(\\d{4})", "$1 $2", ["800", "8001", "80011", "800111", "8001111"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3", ["845", "8454", "84546", "845464"], "0$1"], ["(\\d{3})(\\d{6})", "$1 $2", ["800"], "0$1"], ["(\\d{5})(\\d{4,5})", "$1 $2", ["1(?:38|5[23]|69|76|94)", "1(?:(?:38|69)7|5(?:24|39)|768|946)", "1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"], "0$1"], ["(\\d{4})(\\d{5,6})", "$1 $2", ["1(?:[2-69][02-9]|[78])"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["[25]|7(?:0|6[02-9])", "[25]|7(?:0|6(?:[03-9]|2[356]))"], "0$1"], ["(\\d{4})(\\d{6})", "$1 $2", ["7"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[1389]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0235])|4(?:[0-5]\\d\\d|69[7-9]|70[0-579])|(?:(?:5[0-26-9]|[78][0-49])\\d|6(?:[0-4]\\d|50))\\d)|2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d\\d|1(?:[0-7]\\d\\d|8(?:[02]\\d|1[0-46-9])))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}", [9, 10]], ["7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}", [10]], ["80[08]\\d{7}|800\\d{6}|8001111"], ["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d", [7, 10]], ["70\\d{8}", [10]], 0, ["(?:3[0347]|55)\\d{8}", [10]], ["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}", [10]], ["56\\d{8}", [10]]], 0, " x"], + "GD": ["1", "011", "(?:473|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-9]\\d{6})$|1", "473$1", 0, "473"], + "GE": ["995", "00", "(?:[3-57]\\d\\d|800)\\d{6}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["70"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["32"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[57]"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[348]"], "0$1"]], "0"], + "GF": ["594", "00", "[56]94\\d{6}|(?:80|9\\d)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[56]|9[47]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[89]"], "0$1"]], "0"], + "GG": ["44", "00", "(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?", [7, 9, 10], 0, "0", 0, "([25-9]\\d{5})$|0", "1481$1", 0, 0, [["1481[25-9]\\d{5}", [10]], ["7(?:(?:781|839)\\d|911[17])\\d{5}", [10]], ["80[08]\\d{7}|800\\d{6}|8001111"], ["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[0-3]))\\d{7}|845464\\d", [7, 10]], ["70\\d{8}", [10]], 0, ["(?:3[0347]|55)\\d{8}", [10]], ["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}", [10]], ["56\\d{8}", [10]]]], + "GH": ["233", "00", "(?:[235]\\d{3}|800)\\d{5}", [8, 9], [["(\\d{3})(\\d{5})", "$1 $2", ["8"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[235]"], "0$1"]], "0"], + "GI": ["350", "00", "(?:[25]\\d|60)\\d{6}", [8], [["(\\d{3})(\\d{5})", "$1 $2", ["2"]]]], + "GL": ["299", "00", "(?:19|[2-689]\\d|70)\\d{4}", [6], [["(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3", ["19|[2-9]"]]]], + "GM": ["220", "00", "[2-9]\\d{6}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[2-9]"]]]], + "GN": ["224", "00", "722\\d{6}|(?:3|6\\d)\\d{7}", [8, 9], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["3"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[67]"]]]], + "GP": ["590", "00", "590\\d{6}|(?:69|80|9\\d)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[569]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"], "0$1"]], "0", 0, 0, 0, 0, 0, [["590(?:0[1-68]|[14][0-24-9]|2[0-68]|3[1289]|5[3-579]|[68][0-689]|7[08]|9\\d)\\d{4}"], ["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"], ["80[0-5]\\d{6}"], 0, 0, 0, 0, 0, ["9(?:(?:395|76[018])\\d|475[0-2])\\d{4}"]]], + "GQ": ["240", "00", "222\\d{6}|(?:3\\d|55|[89]0)\\d{7}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[235]"]], ["(\\d{3})(\\d{6})", "$1 $2", ["[89]"]]]], + "GR": ["30", "00", "5005000\\d{3}|8\\d{9,11}|(?:[269]\\d|70)\\d{8}", [10, 11, 12], [["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["21|7"]], ["(\\d{4})(\\d{6})", "$1 $2", ["2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[2689]"]], ["(\\d{3})(\\d{3,4})(\\d{5})", "$1 $2 $3", ["8"]]]], + "GT": ["502", "00", "(?:1\\d{3}|[2-7])\\d{7}", [8, 11], [["(\\d{4})(\\d{4})", "$1 $2", ["[2-7]"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"]]]], + "GU": ["1", "011", "(?:[58]\\d\\d|671|900)\\d{7}", [10], 0, "1", 0, "([3-9]\\d{6})$|1", "671$1", 0, "671"], + "GW": ["245", "00", "[49]\\d{8}|4\\d{6}", [7, 9], [["(\\d{3})(\\d{4})", "$1 $2", ["40"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[49]"]]]], + "GY": ["592", "001", "9008\\d{3}|(?:[2-467]\\d\\d|862)\\d{4}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[2-46-9]"]]]], + "HK": ["852", "00(?:30|5[09]|[126-9]?)", "8[0-46-9]\\d{6,7}|9\\d{4,7}|(?:[2-7]|9\\d{3})\\d{7}", [5, 6, 7, 8, 9, 11], [["(\\d{3})(\\d{2,5})", "$1 $2", ["900", "9003"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[2-7]|8[1-4]|9(?:0[1-9]|[1-8])"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"]], ["(\\d{3})(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["9"]]], 0, 0, 0, 0, 0, 0, 0, "00"], + "HN": ["504", "00", "8\\d{10}|[237-9]\\d{7}", [8, 11], [["(\\d{4})(\\d{4})", "$1-$2", ["[237-9]"]]]], + "HR": ["385", "00", "(?:[24-69]\\d|3[0-79])\\d{7}|80\\d{5,7}|[1-79]\\d{7}|6\\d{5,6}", [6, 7, 8, 9], [["(\\d{2})(\\d{2})(\\d{2,3})", "$1 $2 $3", ["6[01]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2,3})", "$1 $2 $3", ["8"], "0$1"], ["(\\d)(\\d{4})(\\d{3})", "$1 $2 $3", ["1"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[67]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["9"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[2-5]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"], "0$1"]], "0"], + "HT": ["509", "00", "(?:[2-489]\\d|55)\\d{6}", [8], [["(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3", ["[2-589]"]]]], + "HU": ["36", "00", "[235-7]\\d{8}|[1-9]\\d{7}", [8, 9], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["1"], "(06 $1)"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6|8[2-57-9]|9[2-69]"], "(06 $1)"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[2-9]"], "06 $1"]], "06"], + "ID": ["62", "00[89]", "(?:(?:00[1-9]|8\\d)\\d{4}|[1-36])\\d{6}|00\\d{10}|[1-9]\\d{8,10}|[2-9]\\d{7}", [7, 8, 9, 10, 11, 12, 13], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["15"]], ["(\\d{2})(\\d{5,9})", "$1 $2", ["2[124]|[36]1"], "(0$1)"], ["(\\d{3})(\\d{5,7})", "$1 $2", ["800"], "0$1"], ["(\\d{3})(\\d{5,8})", "$1 $2", ["[2-79]"], "(0$1)"], ["(\\d{3})(\\d{3,4})(\\d{3})", "$1-$2-$3", ["8[1-35-9]"], "0$1"], ["(\\d{3})(\\d{6,8})", "$1 $2", ["1"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["804"], "0$1"], ["(\\d{3})(\\d)(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["80"], "0$1"], ["(\\d{3})(\\d{4})(\\d{4,5})", "$1-$2-$3", ["8"], "0$1"]], "0"], + "IE": ["353", "00", "(?:1\\d|[2569])\\d{6,8}|4\\d{6,9}|7\\d{8}|8\\d{8,9}", [7, 8, 9, 10], [["(\\d{2})(\\d{5})", "$1 $2", ["2[24-9]|47|58|6[237-9]|9[35-9]"], "(0$1)"], ["(\\d{3})(\\d{5})", "$1 $2", ["[45]0"], "(0$1)"], ["(\\d)(\\d{3,4})(\\d{4})", "$1 $2 $3", ["1"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[2569]|4[1-69]|7[14]"], "(0$1)"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["70"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["81"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[78]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1"]], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["4"], "(0$1)"], ["(\\d{2})(\\d)(\\d{3})(\\d{4})", "$1 $2 $3 $4", ["8"], "0$1"]], "0"], + "IL": ["972", "0(?:0|1[2-9])", "1\\d{6}(?:\\d{3,5})?|[57]\\d{8}|[1-489]\\d{7}", [7, 8, 9, 10, 11, 12], [["(\\d{4})(\\d{3})", "$1-$2", ["125"]], ["(\\d{4})(\\d{2})(\\d{2})", "$1-$2-$3", ["121"]], ["(\\d)(\\d{3})(\\d{4})", "$1-$2-$3", ["[2-489]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1-$2-$3", ["[57]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3})", "$1-$2-$3", ["12"]], ["(\\d{4})(\\d{6})", "$1-$2", ["159"]], ["(\\d)(\\d{3})(\\d{3})(\\d{3})", "$1-$2-$3-$4", ["1[7-9]"]], ["(\\d{3})(\\d{1,2})(\\d{3})(\\d{4})", "$1-$2 $3-$4", ["15"]]], "0"], + "IM": ["44", "00", "1624\\d{6}|(?:[3578]\\d|90)\\d{8}", [10], 0, "0", 0, "([25-8]\\d{5})$|0", "1624$1", 0, "74576|(?:16|7[56])24"], + "IN": ["91", "00", "(?:000800|[2-9]\\d\\d)\\d{7}|1\\d{7,12}", [8, 9, 10, 11, 12, 13], [["(\\d{8})", "$1", ["5(?:0|2[23]|3[03]|[67]1|88)", "5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)", "5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)"], 0, 1], ["(\\d{4})(\\d{4,5})", "$1 $2", ["180", "1800"], 0, 1], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["140"], 0, 1], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["11|2[02]|33|4[04]|79[1-7]|80[2-46]", "11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])", "11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|4[47]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67|72)[14]", "1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:2[14]|3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31|4[47])|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]", "1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:(?:2[14]|5[15])[2-6]|3171|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|(?:74[47]|8(?:16|2[014]|3[126]|6[136]|7[78]|83))(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]"], "0$1", 1], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|28|3[129]|4[1-35689]|5[29]|6[02-5]|70)|807", "1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1(?:[013-8]|9[6-9])|28[6-8]|3(?:17|2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]", "1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|83)|73179|807(?:1|9[1-3])|(?:1552|6(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[124-6])\\d|7(?:1(?:[013-8]\\d|9[6-9])|28[6-8]|3(?:2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]\\d|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]))[2-7]"], "0$1", 1], ["(\\d{5})(\\d{5})", "$1 $2", ["[6-9]"], "0$1", 1], ["(\\d{4})(\\d{2,4})(\\d{4})", "$1 $2 $3", ["1(?:6|8[06])", "1(?:6|8[06]0)"], 0, 1], ["(\\d{4})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["18"], 0, 1]], "0"], + "IO": ["246", "00", "3\\d{6}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["3"]]]], + "IQ": ["964", "00", "(?:1|7\\d\\d)\\d{7}|[2-6]\\d{7,8}", [8, 9, 10], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["1"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[2-6]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["7"], "0$1"]], "0"], + "IR": ["98", "00", "[1-9]\\d{9}|(?:[1-8]\\d\\d|9)\\d{3,4}", [4, 5, 6, 7, 10], [["(\\d{4,5})", "$1", ["96"], "0$1"], ["(\\d{2})(\\d{4,5})", "$1 $2", ["(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])[12689]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["9"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["[1-8]"], "0$1"]], "0"], + "IS": ["354", "00|1(?:0(?:01|[12]0)|100)", "(?:38\\d|[4-9])\\d{6}", [7, 9], [["(\\d{3})(\\d{4})", "$1 $2", ["[4-9]"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["3"]]], 0, 0, 0, 0, 0, 0, 0, "00"], + "IT": ["39", "00", "0\\d{5,10}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?", [6, 7, 8, 9, 10, 11], [["(\\d{2})(\\d{4,6})", "$1 $2", ["0[26]"]], ["(\\d{3})(\\d{3,6})", "$1 $2", ["0[13-57-9][0159]|8(?:03|4[17]|9[2-5])", "0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))"]], ["(\\d{4})(\\d{2,6})", "$1 $2", ["0(?:[13-579][2-46-8]|8[236-8])"]], ["(\\d{4})(\\d{4})", "$1 $2", ["894"]], ["(\\d{2})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["0[26]|5"]], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["1(?:44|[679])|[378]"]], ["(\\d{3})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["0[13-57-9][0159]|14"]], ["(\\d{2})(\\d{4})(\\d{5})", "$1 $2 $3", ["0[26]"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["0"]], ["(\\d{3})(\\d{4})(\\d{4,5})", "$1 $2 $3", ["3"]]], 0, 0, 0, 0, 0, 0, [["0669[0-79]\\d{1,6}|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[1-356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}"], ["3[1-9]\\d{8}|3[2-9]\\d{7}", [9, 10]], ["80(?:0\\d{3}|3)\\d{3}", [6, 9]], ["(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}", [6, 8, 9, 10]], ["1(?:78\\d|99)\\d{6}", [9, 10]], 0, 0, 0, ["55\\d{8}", [10]], ["84(?:[08]\\d{3}|[17])\\d{3}", [6, 9]]]], + "JE": ["44", "00", "1534\\d{6}|(?:[3578]\\d|90)\\d{8}", [10], 0, "0", 0, "([0-24-8]\\d{5})$|0", "1534$1", 0, 0, [["1534[0-24-8]\\d{5}"], ["7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97[7-9]))\\d{5}"], ["80(?:07(?:35|81)|8901)\\d{4}"], ["(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\d{4}"], ["701511\\d{4}"], 0, ["(?:3(?:0(?:07(?:35|81)|8901)|3\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\d{4})\\d{4}"], ["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}"], ["56\\d{8}"]]], + "JM": ["1", "011", "(?:[58]\\d\\d|658|900)\\d{7}", [10], 0, "1", 0, 0, 0, 0, "658|876"], + "JO": ["962", "00", "(?:(?:[2689]|7\\d)\\d|32|53)\\d{6}", [8, 9], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["[2356]|87"], "(0$1)"], ["(\\d{3})(\\d{5,6})", "$1 $2", ["[89]"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["70"], "0$1"], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["7"], "0$1"]], "0"], + "JP": ["81", "010", "00[1-9]\\d{6,14}|[257-9]\\d{9}|(?:00|[1-9]\\d\\d)\\d{6}", [8, 9, 10, 11, 12, 13, 14, 15, 16, 17], [["(\\d{3})(\\d{3})(\\d{3})", "$1-$2-$3", ["(?:12|57|99)0"], "0$1"], ["(\\d{4})(\\d)(\\d{4})", "$1-$2-$3", ["1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51|63)|9(?:80|9[16])", "1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9]|636)|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]", "1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9]|636[457-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1-$2-$3", ["60"], "0$1"], ["(\\d)(\\d{4})(\\d{4})", "$1-$2-$3", ["[36]|4(?:2[09]|7[01])", "[36]|4(?:2(?:0|9[02-69])|7(?:0[019]|1))"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1-$2-$3", ["1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[045]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[27-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])", "1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9])|5(?:2|3[045]|4[0-369]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|49|51|6(?:[0-24]|36|5[0-3589]|72|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:49|55|83)[29]|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]", "1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3[045]|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[23]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|72|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]", "1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|7[015-9]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17|3[015-9]))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3[045]|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9(?:[019]|4[1-3]|6(?:[0-47-9]|5[01346-9])))|3(?:[29]|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[23]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|72|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|829(?:2|66)|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{4})", "$1-$2-$3", ["[14]|[289][2-9]|5[3-9]|7[2-4679]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1-$2-$3", ["800"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1-$2-$3", ["[257-9]"], "0$1"]], "0"], + "KE": ["254", "000", "(?:[17]\\d\\d|900)\\d{6}|(?:2|80)0\\d{6,7}|[4-6]\\d{6,8}", [7, 8, 9, 10], [["(\\d{2})(\\d{5,7})", "$1 $2", ["[24-6]"], "0$1"], ["(\\d{3})(\\d{6})", "$1 $2", ["[17]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[89]"], "0$1"]], "0"], + "KG": ["996", "00", "8\\d{9}|(?:[235-8]\\d|99)\\d{7}", [9, 10], [["(\\d{4})(\\d{5})", "$1 $2", ["3(?:1[346]|[24-79])"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[235-79]|88"], "0$1"], ["(\\d{3})(\\d{3})(\\d)(\\d{2,3})", "$1 $2 $3 $4", ["8"], "0$1"]], "0"], + "KH": ["855", "00[14-9]", "1\\d{9}|[1-9]\\d{7,8}", [8, 9, 10], [["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[1-9]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1"]]], "0"], + "KI": ["686", "00", "(?:[37]\\d|6[0-79])\\d{6}|(?:[2-48]\\d|50)\\d{3}", [5, 8], 0, "0"], + "KM": ["269", "00", "[3478]\\d{6}", [7], [["(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3", ["[3478]"]]]], + "KN": ["1", "011", "(?:[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-7]\\d{6})$|1", "869$1", 0, "869"], + "KP": ["850", "00|99", "85\\d{6}|(?:19\\d|[2-7])\\d{7}", [8, 10], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"], "0$1"], ["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["[2-7]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"], "0$1"]], "0"], + "KR": ["82", "00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))", "00[1-9]\\d{8,11}|(?:[12]|5\\d{3})\\d{7}|[13-6]\\d{9}|(?:[1-6]\\d|80)\\d{7}|[3-6]\\d{4,5}|(?:00|7)0\\d{8}", [5, 6, 8, 9, 10, 11, 12, 13, 14], [["(\\d{2})(\\d{3,4})", "$1-$2", ["(?:3[1-3]|[46][1-4]|5[1-5])1"], "0$1"], ["(\\d{4})(\\d{4})", "$1-$2", ["1"]], ["(\\d)(\\d{3,4})(\\d{4})", "$1-$2-$3", ["2"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1-$2-$3", ["60|8"], "0$1"], ["(\\d{2})(\\d{3,4})(\\d{4})", "$1-$2-$3", ["[1346]|5[1-5]"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1-$2-$3", ["[57]"], "0$1"], ["(\\d{2})(\\d{5})(\\d{4})", "$1-$2-$3", ["5"], "0$1"]], "0", 0, "0(8(?:[1-46-8]|5\\d\\d))?"], + "KW": ["965", "00", "18\\d{5}|(?:[2569]\\d|41)\\d{6}", [7, 8], [["(\\d{4})(\\d{3,4})", "$1 $2", ["[169]|2(?:[235]|4[1-35-9])|52"]], ["(\\d{3})(\\d{5})", "$1 $2", ["[245]"]]]], + "KY": ["1", "011", "(?:345|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-9]\\d{6})$|1", "345$1", 0, "345"], + "KZ": ["7", "810", "(?:33622|8\\d{8})\\d{5}|[78]\\d{9}", [10, 14], 0, "8", 0, 0, 0, 0, "33|7", 0, "8~10"], + "LA": ["856", "00", "[23]\\d{9}|3\\d{8}|(?:[235-8]\\d|41)\\d{6}", [8, 9, 10], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["2[13]|3[14]|[4-8]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3 $4", ["30[013-9]"], "0$1"], ["(\\d{2})(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["[23]"], "0$1"]], "0"], + "LB": ["961", "00", "[27-9]\\d{7}|[13-9]\\d{6}", [7, 8], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["[13-69]|7(?:[2-57]|62|8[0-7]|9[04-9])|8[02-9]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[27-9]"]]], "0"], + "LC": ["1", "011", "(?:[58]\\d\\d|758|900)\\d{7}", [10], 0, "1", 0, "([2-8]\\d{6})$|1", "758$1", 0, "758"], + "LI": ["423", "00", "[68]\\d{8}|(?:[2378]\\d|90)\\d{5}", [7, 9], [["(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3", ["[2379]|8(?:0[09]|7)", "[2379]|8(?:0(?:02|9)|7)"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["69"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["6"]]], "0", 0, "(1001)|0"], + "LK": ["94", "00", "[1-9]\\d{8}", [9], [["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["7"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[1-689]"], "0$1"]], "0"], + "LR": ["231", "00", "(?:[25]\\d|33|77|88)\\d{7}|(?:2\\d|[4-6])\\d{6}", [7, 8, 9], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["[4-6]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[23578]"], "0$1"]], "0"], + "LS": ["266", "00", "(?:[256]\\d\\d|800)\\d{5}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["[2568]"]]]], + "LT": ["370", "00", "(?:[3469]\\d|52|[78]0)\\d{6}", [8], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["52[0-7]"], "(8-$1)", 1], ["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["[7-9]"], "8 $1", 1], ["(\\d{2})(\\d{6})", "$1 $2", ["37|4(?:[15]|6[1-8])"], "(8-$1)", 1], ["(\\d{3})(\\d{5})", "$1 $2", ["[3-6]"], "(8-$1)", 1]], "8", 0, "[08]"], + "LU": ["352", "00", "35[013-9]\\d{4,8}|6\\d{8}|35\\d{2,4}|(?:[2457-9]\\d|3[0-46-9])\\d{2,9}", [4, 5, 6, 7, 8, 9, 10, 11], [["(\\d{2})(\\d{3})", "$1 $2", ["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]], ["(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3", ["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]], ["(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3", ["20[2-689]"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})", "$1 $2 $3 $4", ["2(?:[0367]|4[3-8])"]], ["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["80[01]|90[015]"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3 $4", ["20"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["6"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})", "$1 $2 $3 $4 $5", ["2(?:[0367]|4[3-8])"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{1,5})", "$1 $2 $3 $4", ["[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]"]]], 0, 0, "(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\d)"], + "LV": ["371", "00", "(?:[268]\\d|90)\\d{6}", [8], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[269]|8[01]"]]]], + "LY": ["218", "00", "[2-9]\\d{8}", [9], [["(\\d{2})(\\d{7})", "$1-$2", ["[2-9]"], "0$1"]], "0"], + "MA": ["212", "00", "[5-8]\\d{8}", [9], [["(\\d{5})(\\d{4})", "$1-$2", ["5(?:29|38)", "5(?:29[1289]|389)", "529(?:1[1-46-9]|2[013-8]|90)|5(?:298|389)[0-46-9]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["5[45]"], "0$1"], ["(\\d{4})(\\d{5})", "$1-$2", ["5(?:2[2-489]|3[5-9]|9)|892", "5(?:2(?:[2-49]|8[235-9])|3[5-9]|9)|892"], "0$1"], ["(\\d{2})(\\d{7})", "$1-$2", ["8"], "0$1"], ["(\\d{3})(\\d{6})", "$1-$2", ["[5-7]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["5293[01]\\d{4}|5(?:2(?:[0-25-7]\\d|3[1-578]|4[02-46-8]|8[0235-7]|9[0-289])|3(?:[0-47]\\d|5[02-9]|6[02-8]|8[0189]|9[3-9])|(?:4[067]|5[03])\\d)\\d{5}"], ["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[017]\\d|2[0-2]|6[0-8]|8[0-3]))\\d{6}"], ["80\\d{7}"], ["89\\d{7}"], 0, 0, 0, 0, ["592(?:4[0-2]|93)\\d{4}"]]], + "MC": ["377", "00", "(?:[3489]|6\\d)\\d{7}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["4"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[389]"]], ["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4 $5", ["6"], "0$1"]], "0"], + "MD": ["373", "00", "(?:[235-7]\\d|[89]0)\\d{6}", [8], [["(\\d{3})(\\d{5})", "$1 $2", ["[89]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["22|3"], "0$1"], ["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["[25-7]"], "0$1"]], "0"], + "ME": ["382", "00", "(?:20|[3-79]\\d)\\d{6}|80\\d{6,7}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[2-9]"], "0$1"]], "0"], + "MF": ["590", "00", "590\\d{6}|(?:69|80|9\\d)\\d{7}", [9], 0, "0", 0, 0, 0, 0, 0, [["590(?:0[079]|[14]3|[27][79]|30|5[0-268]|87)\\d{4}"], ["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"], ["80[0-5]\\d{6}"], 0, 0, 0, 0, 0, ["9(?:(?:395|76[018])\\d|475[0-2])\\d{4}"]]], + "MG": ["261", "00", "[23]\\d{8}", [9], [["(\\d{2})(\\d{2})(\\d{3})(\\d{2})", "$1 $2 $3 $4", ["[23]"], "0$1"]], "0", 0, "([24-9]\\d{6})$|0", "20$1"], + "MH": ["692", "011", "329\\d{4}|(?:[256]\\d|45)\\d{5}", [7], [["(\\d{3})(\\d{4})", "$1-$2", ["[2-6]"]]], "1"], + "MK": ["389", "00", "[2-578]\\d{7}", [8], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["2|34[47]|4(?:[37]7|5[47]|64)"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[347]"], "0$1"], ["(\\d{3})(\\d)(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[58]"], "0$1"]], "0"], + "ML": ["223", "00", "[24-9]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[24-9]"]]]], + "MM": ["95", "00", "1\\d{5,7}|95\\d{6}|(?:[4-7]|9[0-46-9])\\d{6,8}|(?:2|8\\d)\\d{5,8}", [6, 7, 8, 9, 10], [["(\\d)(\\d{2})(\\d{3})", "$1 $2 $3", ["16|2"], "0$1"], ["(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3", ["[45]|6(?:0[23]|[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-6]"], "0$1"], ["(\\d)(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[12]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[4-7]|8[1-35]"], "0$1"], ["(\\d)(\\d{3})(\\d{4,6})", "$1 $2 $3", ["9(?:2[0-4]|[35-9]|4[137-9])"], "0$1"], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"], "0$1"], ["(\\d)(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["92"], "0$1"], ["(\\d)(\\d{5})(\\d{4})", "$1 $2 $3", ["9"], "0$1"]], "0"], + "MN": ["976", "001", "[12]\\d{7,9}|[5-9]\\d{7}", [8, 9, 10], [["(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3", ["[12]1"], "0$1"], ["(\\d{4})(\\d{4})", "$1 $2", ["[5-9]"]], ["(\\d{3})(\\d{5,6})", "$1 $2", ["[12]2[1-3]"], "0$1"], ["(\\d{4})(\\d{5,6})", "$1 $2", ["[12](?:27|3[2-8]|4[2-68]|5[1-4689])", "[12](?:27|3[2-8]|4[2-68]|5[1-4689])[0-3]"], "0$1"], ["(\\d{5})(\\d{4,5})", "$1 $2", ["[12]"], "0$1"]], "0"], + "MO": ["853", "00", "0800\\d{3}|(?:28|[68]\\d)\\d{6}", [7, 8], [["(\\d{4})(\\d{3})", "$1 $2", ["0"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[268]"]]]], + "MP": ["1", "011", "[58]\\d{9}|(?:67|90)0\\d{7}", [10], 0, "1", 0, "([2-9]\\d{6})$|1", "670$1", 0, "670"], + "MQ": ["596", "00", "596\\d{6}|(?:69|80|9\\d)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[569]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"], "0$1"]], "0"], + "MR": ["222", "00", "(?:[2-4]\\d\\d|800)\\d{5}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2-48]"]]]], + "MS": ["1", "011", "(?:[58]\\d\\d|664|900)\\d{7}", [10], 0, "1", 0, "([34]\\d{6})$|1", "664$1", 0, "664"], + "MT": ["356", "00", "3550\\d{4}|(?:[2579]\\d\\d|800)\\d{5}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["[2357-9]"]]]], + "MU": ["230", "0(?:0|[24-7]0|3[03])", "(?:[57]|8\\d\\d)\\d{7}|[2-468]\\d{6}", [7, 8, 10], [["(\\d{3})(\\d{4})", "$1 $2", ["[2-46]|8[013]"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[57]"]], ["(\\d{5})(\\d{5})", "$1 $2", ["8"]]], 0, 0, 0, 0, 0, 0, 0, "020"], + "MV": ["960", "0(?:0|19)", "(?:800|9[0-57-9]\\d)\\d{7}|[34679]\\d{6}", [7, 10], [["(\\d{3})(\\d{4})", "$1-$2", ["[34679]"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[89]"]]], 0, 0, 0, 0, 0, 0, 0, "00"], + "MW": ["265", "00", "(?:[1289]\\d|31|77)\\d{7}|1\\d{6}", [7, 9], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["1[2-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[137-9]"], "0$1"]], "0"], + "MX": ["52", "0[09]", "1(?:(?:[27]2|44|99)[1-9]|65[0-689])\\d{7}|(?:1(?:[01]\\d|2[13-9]|[35][1-9]|4[0-35-9]|6[0-46-9]|7[013-9]|8[1-79]|9[1-8])|[2-9]\\d)\\d{8}", [10, 11], [["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["33|5[56]|81"], 0, 1], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[2-9]"], 0, 1], ["(\\d)(\\d{2})(\\d{4})(\\d{4})", "$2 $3 $4", ["1(?:33|5[56]|81)"], 0, 1], ["(\\d)(\\d{3})(\\d{3})(\\d{4})", "$2 $3 $4", ["1"], 0, 1]], "01", 0, "0(?:[12]|4[45])|1", 0, 0, 0, 0, "00"], + "MY": ["60", "00", "1\\d{8,9}|(?:3\\d|[4-9])\\d{7}", [8, 9, 10], [["(\\d)(\\d{3})(\\d{4})", "$1-$2 $3", ["[4-79]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1-$2 $3", ["1(?:[02469]|[378][1-9]|53)|8", "1(?:[02469]|[37][1-9]|53|8(?:[1-46-9]|5[7-9]))|8"], "0$1"], ["(\\d)(\\d{4})(\\d{4})", "$1-$2 $3", ["3"], "0$1"], ["(\\d)(\\d{3})(\\d{2})(\\d{4})", "$1-$2-$3-$4", ["1(?:[367]|80)"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1-$2 $3", ["15"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4})", "$1-$2 $3", ["1"], "0$1"]], "0"], + "MZ": ["258", "00", "(?:2|8\\d)\\d{7}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["2|8[2-79]"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["8"]]]], + "NA": ["264", "00", "[68]\\d{7,8}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["88"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["6"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["87"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"], "0$1"]], "0"], + "NC": ["687", "00", "(?:050|[2-57-9]\\d\\d)\\d{3}", [6], [["(\\d{2})(\\d{2})(\\d{2})", "$1.$2.$3", ["[02-57-9]"]]]], + "NE": ["227", "00", "[027-9]\\d{7}", [8], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["08"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[089]|2[013]|7[04]"]]]], + "NF": ["672", "00", "[13]\\d{5}", [6], [["(\\d{2})(\\d{4})", "$1 $2", ["1[0-3]"]], ["(\\d)(\\d{5})", "$1 $2", ["[13]"]]], 0, 0, "([0-258]\\d{4})$", "3$1"], + "NG": ["234", "009", "(?:[124-7]|9\\d{3})\\d{6}|[1-9]\\d{7}|[78]\\d{9,13}", [7, 8, 10, 11, 12, 13, 14], [["(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3", ["78"], "0$1"], ["(\\d)(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[12]|9(?:0[3-9]|[1-9])"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2,3})", "$1 $2 $3", ["[3-7]|8[2-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[7-9]"], "0$1"], ["(\\d{3})(\\d{4})(\\d{4,5})", "$1 $2 $3", ["[78]"], "0$1"], ["(\\d{3})(\\d{5})(\\d{5,6})", "$1 $2 $3", ["[78]"], "0$1"]], "0"], + "NI": ["505", "00", "(?:1800|[25-8]\\d{3})\\d{4}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["[125-8]"]]]], + "NL": ["31", "00", "(?:[124-7]\\d\\d|3(?:[02-9]\\d|1[0-8]))\\d{6}|8\\d{6,9}|9\\d{6,10}|1\\d{4,5}", [5, 6, 7, 8, 9, 10, 11], [["(\\d{3})(\\d{4,7})", "$1 $2", ["[89]0"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["66"], "0$1"], ["(\\d)(\\d{8})", "$1 $2", ["6"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["1[16-8]|2[259]|3[124]|4[17-9]|5[124679]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[1-578]|91"], "0$1"], ["(\\d{3})(\\d{3})(\\d{5})", "$1 $2 $3", ["9"], "0$1"]], "0"], + "NO": ["47", "00", "(?:0|[2-9]\\d{3})\\d{4}", [5, 8], [["(\\d{3})(\\d{2})(\\d{3})", "$1 $2 $3", ["[489]|59"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[235-7]"]]], 0, 0, 0, 0, 0, "[02-689]|7[0-8]"], + "NP": ["977", "00", "(?:1\\d|9)\\d{9}|[1-9]\\d{7}", [8, 10, 11], [["(\\d)(\\d{7})", "$1-$2", ["1[2-6]"], "0$1"], ["(\\d{2})(\\d{6})", "$1-$2", ["1[01]|[2-8]|9(?:[1-59]|[67][2-6])"], "0$1"], ["(\\d{3})(\\d{7})", "$1-$2", ["9"]]], "0"], + "NR": ["674", "00", "(?:444|(?:55|8\\d)\\d|666)\\d{4}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[4-68]"]]]], + "NU": ["683", "00", "(?:[47]|888\\d)\\d{3}", [4, 7], [["(\\d{3})(\\d{4})", "$1 $2", ["8"]]]], + "NZ": ["64", "0(?:0|161)", "[29]\\d{7,9}|50\\d{5}(?:\\d{2,3})?|6[0-35-9]\\d{6}|7\\d{7,8}|8\\d{4,9}|(?:11\\d|[34])\\d{7}", [5, 6, 7, 8, 9, 10], [["(\\d{2})(\\d{3,8})", "$1 $2", ["8[1-579]"], "0$1"], ["(\\d{3})(\\d{2})(\\d{2,3})", "$1 $2 $3", ["50[036-8]|[89]0", "50(?:[0367]|88)|[89]0"], "0$1"], ["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["24|[346]|7[2-57-9]|9[2-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["2(?:10|74)|[59]|80"], "0$1"], ["(\\d{2})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["1|2[028]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,5})", "$1 $2 $3", ["2(?:[169]|7[0-35-9])|7|86"], "0$1"]], "0", 0, 0, 0, 0, 0, 0, "00"], + "OM": ["968", "00", "(?:1505|[279]\\d{3}|500)\\d{4}|800\\d{5,6}", [7, 8, 9], [["(\\d{3})(\\d{4,6})", "$1 $2", ["[58]"]], ["(\\d{2})(\\d{6})", "$1 $2", ["2"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[179]"]]]], + "PA": ["507", "00", "(?:00800|8\\d{3})\\d{6}|[68]\\d{7}|[1-57-9]\\d{6}", [7, 8, 10, 11], [["(\\d{3})(\\d{4})", "$1-$2", ["[1-57-9]"]], ["(\\d{4})(\\d{4})", "$1-$2", ["[68]"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"]]]], + "PE": ["51", "00|19(?:1[124]|77|90)00", "(?:[14-8]|9\\d)\\d{7}", [8, 9], [["(\\d{3})(\\d{5})", "$1 $2", ["80"], "(0$1)"], ["(\\d)(\\d{7})", "$1 $2", ["1"], "(0$1)"], ["(\\d{2})(\\d{6})", "$1 $2", ["[4-8]"], "(0$1)"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["9"]]], "0", 0, 0, 0, 0, 0, 0, "00", " Anexo "], + "PF": ["689", "00", "4\\d{5}(?:\\d{2})?|8\\d{7,8}", [6, 8, 9], [["(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3", ["44"]], ["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["4|8[7-9]"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"]]]], + "PG": ["675", "00|140[1-3]", "(?:180|[78]\\d{3})\\d{4}|(?:[2-589]\\d|64)\\d{5}", [7, 8], [["(\\d{3})(\\d{4})", "$1 $2", ["18|[2-69]|85"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[78]"]]], 0, 0, 0, 0, 0, 0, 0, "00"], + "PH": ["63", "00", "(?:[2-7]|9\\d)\\d{8}|2\\d{5}|(?:1800|8)\\d{7,9}", [6, 8, 9, 10, 11, 12, 13], [["(\\d)(\\d{5})", "$1 $2", ["2"], "(0$1)"], ["(\\d{4})(\\d{4,6})", "$1 $2", ["3(?:23|39|46)|4(?:2[3-6]|[35]9|4[26]|76)|544|88[245]|(?:52|64|86)2", "3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))"], "(0$1)"], ["(\\d{5})(\\d{4})", "$1 $2", ["346|4(?:27|9[35])|883", "3469|4(?:279|9(?:30|56))|8834"], "(0$1)"], ["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["2"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[3-7]|8[2-8]"], "(0$1)"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["[89]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"]], ["(\\d{4})(\\d{1,2})(\\d{3})(\\d{4})", "$1 $2 $3 $4", ["1"]]], "0"], + "PK": ["92", "00", "122\\d{6}|[24-8]\\d{10,11}|9(?:[013-9]\\d{8,10}|2(?:[01]\\d\\d|2(?:[06-8]\\d|1[01]))\\d{7})|(?:[2-8]\\d{3}|92(?:[0-7]\\d|8[1-9]))\\d{6}|[24-9]\\d{8}|[89]\\d{7}", [8, 9, 10, 11, 12], [["(\\d{3})(\\d{3})(\\d{2,7})", "$1 $2 $3", ["[89]0"], "0$1"], ["(\\d{4})(\\d{5})", "$1 $2", ["1"]], ["(\\d{3})(\\d{6,7})", "$1 $2", ["2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8])", "9(?:2[3-8]|98)|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:22|3[27-9]|4[2-6]|6[3569]|9[25-7]))[2-9]"], "(0$1)"], ["(\\d{2})(\\d{7,8})", "$1 $2", ["(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]"], "(0$1)"], ["(\\d{5})(\\d{5})", "$1 $2", ["58"], "(0$1)"], ["(\\d{3})(\\d{7})", "$1 $2", ["3"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91"], "(0$1)"], ["(\\d{3})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["[24-9]"], "(0$1)"]], "0"], + "PL": ["48", "00", "(?:6|8\\d\\d)\\d{7}|[1-9]\\d{6}(?:\\d{2})?|[26]\\d{5}", [6, 7, 8, 9, 10], [["(\\d{5})", "$1", ["19"]], ["(\\d{3})(\\d{3})", "$1 $2", ["11|20|64"]], ["(\\d{2})(\\d{2})(\\d{3})", "$1 $2 $3", ["(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])1", "(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])19"]], ["(\\d{3})(\\d{2})(\\d{2,3})", "$1 $2 $3", ["64"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["21|39|45|5[0137]|6[0469]|7[02389]|8(?:0[14]|8)"]], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["1[2-8]|[2-7]|8[1-79]|9[145]"]], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["8"]]]], + "PM": ["508", "00", "[45]\\d{5}|(?:708|80\\d)\\d{6}", [6, 9], [["(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3", ["[45]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["7"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"], "0$1"]], "0"], + "PR": ["1", "011", "(?:[589]\\d\\d|787)\\d{7}", [10], 0, "1", 0, 0, 0, 0, "787|939"], + "PS": ["970", "00", "[2489]2\\d{6}|(?:1\\d|5)\\d{8}", [8, 9, 10], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["[2489]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["5"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1"]]], "0"], + "PT": ["351", "00", "1693\\d{5}|(?:[26-9]\\d|30)\\d{7}", [9], [["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["2[12]"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["16|[236-9]"]]]], + "PW": ["680", "01[12]", "(?:[24-8]\\d\\d|345|900)\\d{4}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[2-9]"]]]], + "PY": ["595", "00", "59\\d{4,6}|9\\d{5,10}|(?:[2-46-8]\\d|5[0-8])\\d{4,7}", [6, 7, 8, 9, 10, 11], [["(\\d{3})(\\d{3,6})", "$1 $2", ["[2-9]0"], "0$1"], ["(\\d{2})(\\d{5})", "$1 $2", ["[26]1|3[289]|4[1246-8]|7[1-3]|8[1-36]"], "(0$1)"], ["(\\d{3})(\\d{4,5})", "$1 $2", ["2[279]|3[13-5]|4[359]|5|6(?:[34]|7[1-46-8])|7[46-8]|85"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["2[14-68]|3[26-9]|4[1246-8]|6(?:1|75)|7[1-35]|8[1-36]"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["87"]], ["(\\d{3})(\\d{6})", "$1 $2", ["9(?:[5-79]|8[1-6])"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-8]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["9"]]], "0"], + "QA": ["974", "00", "800\\d{4}|(?:2|800)\\d{6}|(?:0080|[3-7])\\d{7}", [7, 8, 9, 11], [["(\\d{3})(\\d{4})", "$1 $2", ["2[16]|8"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[3-7]"]]]], + "RE": ["262", "00", "(?:26|[689]\\d)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2689]"], "0$1"]], "0", 0, 0, 0, 0, 0, [["26(?:2\\d\\d|3(?:0\\d|1[0-3]))\\d{4}"], ["(?:69(?:2\\d\\d|3(?:0[0-46]|1[013]|2[0-2]|3[0-39]|4\\d|5[0-5]|6[0-6]|7[0-27]|8[0-8]|9[0-479]))|9(?:399[0-3]|479[0-2]|76(?:2[27]|3[0-37]|9\\d)))\\d{4}"], ["80\\d{7}"], ["89[1-37-9]\\d{6}"], 0, 0, 0, 0, 0, ["8(?:1[019]|2[0156]|84|90)\\d{6}"]]], + "RO": ["40", "00", "(?:[2378]\\d|90)\\d{7}|[23]\\d{5}", [6, 9], [["(\\d{3})(\\d{3})", "$1 $2", ["2[3-6]", "2[3-6]\\d9"], "0$1"], ["(\\d{2})(\\d{4})", "$1 $2", ["219|31"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[23]1"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[237-9]"], "0$1"]], "0", 0, 0, 0, 0, 0, 0, 0, " int "], + "RS": ["381", "00", "38[02-9]\\d{6,9}|6\\d{7,9}|90\\d{4,8}|38\\d{5,6}|(?:7\\d\\d|800)\\d{3,9}|(?:[12]\\d|3[0-79])\\d{5,10}", [6, 7, 8, 9, 10, 11, 12], [["(\\d{3})(\\d{3,9})", "$1 $2", ["(?:2[389]|39)0|[7-9]"], "0$1"], ["(\\d{2})(\\d{5,10})", "$1 $2", ["[1-36]"], "0$1"]], "0"], + "RU": ["7", "810", "8\\d{13}|[347-9]\\d{9}", [10, 14], [["(\\d{4})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["7(?:1[0-8]|2[1-9])", "7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:1[23]|[2-9]2))", "7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2"], "8 ($1)", 1], ["(\\d{5})(\\d)(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["7(?:1[0-68]|2[1-9])", "7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))", "7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]"], "8 ($1)", 1], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["7"], "8 ($1)", 1], ["(\\d{3})(\\d{3})(\\d{2})(\\d{2})", "$1 $2-$3-$4", ["[349]|8(?:[02-7]|1[1-8])"], "8 ($1)", 1], ["(\\d{4})(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["8"], "8 ($1)"]], "8", 0, 0, 0, 0, "3[04-689]|[489]", 0, "8~10"], + "RW": ["250", "00", "(?:06|[27]\\d\\d|[89]00)\\d{6}", [8, 9], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["0"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[7-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["2"]]], "0"], + "SA": ["966", "00", "92\\d{7}|(?:[15]|8\\d)\\d{8}", [9, 10], [["(\\d{4})(\\d{5})", "$1 $2", ["9"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["5"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["81"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"]]], "0"], + "SB": ["677", "0[01]", "(?:[1-6]|[7-9]\\d\\d)\\d{4}", [5, 7], [["(\\d{2})(\\d{5})", "$1 $2", ["7|8[4-9]|9(?:[1-8]|9[0-8])"]]]], + "SC": ["248", "010|0[0-2]", "800\\d{4}|(?:[249]\\d|64)\\d{5}", [7], [["(\\d)(\\d{3})(\\d{3})", "$1 $2 $3", ["[246]|9[57]"]]], 0, 0, 0, 0, 0, 0, 0, "00"], + "SD": ["249", "00", "[19]\\d{8}", [9], [["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[19]"], "0$1"]], "0"], + "SE": ["46", "00", "(?:[26]\\d\\d|9)\\d{9}|[1-9]\\d{8}|[1-689]\\d{7}|[1-4689]\\d{6}|2\\d{5}", [6, 7, 8, 9, 10], [["(\\d{2})(\\d{2,3})(\\d{2})", "$1-$2 $3", ["20"], "0$1", 0, "$1 $2 $3"], ["(\\d{3})(\\d{4})", "$1-$2", ["9(?:00|39|44|9)"], "0$1", 0, "$1 $2"], ["(\\d{2})(\\d{3})(\\d{2})", "$1-$2 $3", ["[12][136]|3[356]|4[0246]|6[03]|90[1-9]"], "0$1", 0, "$1 $2 $3"], ["(\\d)(\\d{2,3})(\\d{2})(\\d{2})", "$1-$2 $3 $4", ["8"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d{3})(\\d{2,3})(\\d{2})", "$1-$2 $3", ["1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"], "0$1", 0, "$1 $2 $3"], ["(\\d{3})(\\d{2,3})(\\d{3})", "$1-$2 $3", ["9(?:00|39|44)"], "0$1", 0, "$1 $2 $3"], ["(\\d{2})(\\d{2,3})(\\d{2})(\\d{2})", "$1-$2 $3 $4", ["1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1-$2 $3 $4", ["10|7"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d)(\\d{3})(\\d{3})(\\d{2})", "$1-$2 $3 $4", ["8"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1-$2 $3 $4", ["[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d{3})(\\d{2})(\\d{2})(\\d{3})", "$1-$2 $3 $4", ["9"], "0$1", 0, "$1 $2 $3 $4"], ["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1-$2 $3 $4 $5", ["[26]"], "0$1", 0, "$1 $2 $3 $4 $5"]], "0"], + "SG": ["65", "0[0-3]\\d", "(?:(?:1\\d|8)\\d\\d|7000)\\d{7}|[3689]\\d{7}", [8, 10, 11], [["(\\d{4})(\\d{4})", "$1 $2", ["[369]|8(?:0[1-6]|[1-9])"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"]], ["(\\d{4})(\\d{4})(\\d{3})", "$1 $2 $3", ["7"]], ["(\\d{4})(\\d{3})(\\d{4})", "$1 $2 $3", ["1"]]]], + "SH": ["290", "00", "(?:[256]\\d|8)\\d{3}", [4, 5], 0, 0, 0, 0, 0, 0, "[256]"], + "SI": ["386", "00|10(?:22|66|88|99)", "[1-7]\\d{7}|8\\d{4,7}|90\\d{4,6}", [5, 6, 7, 8], [["(\\d{2})(\\d{3,6})", "$1 $2", ["8[09]|9"], "0$1"], ["(\\d{3})(\\d{5})", "$1 $2", ["59|8"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[37][01]|4[0139]|51|6"], "0$1"], ["(\\d)(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[1-57]"], "(0$1)"]], "0", 0, 0, 0, 0, 0, 0, "00"], + "SJ": ["47", "00", "0\\d{4}|(?:[489]\\d|[57]9)\\d{6}", [5, 8], 0, 0, 0, 0, 0, 0, "79"], + "SK": ["421", "00", "[2-689]\\d{8}|[2-59]\\d{6}|[2-5]\\d{5}", [6, 7, 9], [["(\\d)(\\d{2})(\\d{3,4})", "$1 $2 $3", ["21"], "0$1"], ["(\\d{2})(\\d{2})(\\d{2,3})", "$1 $2 $3", ["[3-5][1-8]1", "[3-5][1-8]1[67]"], "0$1"], ["(\\d)(\\d{3})(\\d{3})(\\d{2})", "$1/$2 $3 $4", ["2"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[689]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1/$2 $3 $4", ["[3-5]"], "0$1"]], "0"], + "SL": ["232", "00", "(?:[237-9]\\d|66)\\d{6}", [8], [["(\\d{2})(\\d{6})", "$1 $2", ["[236-9]"], "(0$1)"]], "0"], + "SM": ["378", "00", "(?:0549|[5-7]\\d)\\d{6}", [8, 10], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[5-7]"]], ["(\\d{4})(\\d{6})", "$1 $2", ["0"]]], 0, 0, "([89]\\d{5})$", "0549$1"], + "SN": ["221", "00", "(?:[378]\\d|93)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"]], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[379]"]]]], + "SO": ["252", "00", "[346-9]\\d{8}|[12679]\\d{7}|[1-5]\\d{6}|[1348]\\d{5}", [6, 7, 8, 9], [["(\\d{2})(\\d{4})", "$1 $2", ["8[125]"]], ["(\\d{6})", "$1", ["[134]"]], ["(\\d)(\\d{6})", "$1 $2", ["[15]|2[0-79]|3[0-46-8]|4[0-7]"]], ["(\\d)(\\d{7})", "$1 $2", ["(?:2|90)4|[67]"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[3478]|64|90"]], ["(\\d{2})(\\d{5,7})", "$1 $2", ["1|28|6(?:0[5-7]|[1-35-9])|9[2-9]"]]], "0"], + "SR": ["597", "00", "(?:[2-5]|68|[78]\\d)\\d{5}", [6, 7], [["(\\d{2})(\\d{2})(\\d{2})", "$1-$2-$3", ["56"]], ["(\\d{3})(\\d{3})", "$1-$2", ["[2-5]"]], ["(\\d{3})(\\d{4})", "$1-$2", ["[6-8]"]]]], + "SS": ["211", "00", "[19]\\d{8}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[19]"], "0$1"]], "0"], + "ST": ["239", "00", "(?:22|9\\d)\\d{5}", [7], [["(\\d{3})(\\d{4})", "$1 $2", ["[29]"]]]], + "SV": ["503", "00", "[267]\\d{7}|[89]00\\d{4}(?:\\d{4})?", [7, 8, 11], [["(\\d{3})(\\d{4})", "$1 $2", ["[89]"]], ["(\\d{4})(\\d{4})", "$1 $2", ["[267]"]], ["(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["[89]"]]]], + "SX": ["1", "011", "7215\\d{6}|(?:[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "(5\\d{6})$|1", "721$1", 0, "721"], + "SY": ["963", "00", "[1-39]\\d{8}|[1-5]\\d{7}", [8, 9], [["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[1-5]"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["9"], "0$1", 1]], "0"], + "SZ": ["268", "00", "0800\\d{4}|(?:[237]\\d|900)\\d{6}", [8, 9], [["(\\d{4})(\\d{4})", "$1 $2", ["[0237]"]], ["(\\d{5})(\\d{4})", "$1 $2", ["9"]]]], + "TA": ["290", "00", "8\\d{3}", [4], 0, 0, 0, 0, 0, 0, "8"], + "TC": ["1", "011", "(?:[58]\\d\\d|649|900)\\d{7}", [10], 0, "1", 0, "([2-479]\\d{6})$|1", "649$1", 0, "649"], + "TD": ["235", "00|16", "(?:22|[69]\\d|77)\\d{6}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[2679]"]]], 0, 0, 0, 0, 0, 0, 0, "00"], + "TG": ["228", "00", "[279]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[279]"]]]], + "TH": ["66", "00[1-9]", "(?:001800|[2-57]|[689]\\d)\\d{7}|1\\d{7,9}", [8, 9, 10, 13], [["(\\d)(\\d{3})(\\d{4})", "$1 $2 $3", ["2"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[13-9]"], "0$1"], ["(\\d{4})(\\d{3})(\\d{3})", "$1 $2 $3", ["1"]]], "0"], + "TJ": ["992", "810", "[0-57-9]\\d{8}", [9], [["(\\d{6})(\\d)(\\d{2})", "$1 $2 $3", ["331", "3317"]], ["(\\d{3})(\\d{2})(\\d{4})", "$1 $2 $3", ["[34]7|91[78]"]], ["(\\d{4})(\\d)(\\d{4})", "$1 $2 $3", ["3[1-5]"]], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[0-57-9]"]]], 0, 0, 0, 0, 0, 0, 0, "8~10"], + "TK": ["690", "00", "[2-47]\\d{3,6}", [4, 5, 6, 7]], + "TL": ["670", "00", "7\\d{7}|(?:[2-47]\\d|[89]0)\\d{5}", [7, 8], [["(\\d{3})(\\d{4})", "$1 $2", ["[2-489]|70"]], ["(\\d{4})(\\d{4})", "$1 $2", ["7"]]]], + "TM": ["993", "810", "[1-6]\\d{7}", [8], [["(\\d{2})(\\d{2})(\\d{2})(\\d{2})", "$1 $2-$3-$4", ["12"], "(8 $1)"], ["(\\d{3})(\\d)(\\d{2})(\\d{2})", "$1 $2-$3-$4", ["[1-5]"], "(8 $1)"], ["(\\d{2})(\\d{6})", "$1 $2", ["6"], "8 $1"]], "8", 0, 0, 0, 0, 0, 0, "8~10"], + "TN": ["216", "00", "[2-57-9]\\d{7}", [8], [["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-57-9]"]]]], + "TO": ["676", "00", "(?:0800|(?:[5-8]\\d\\d|999)\\d)\\d{3}|[2-8]\\d{4}", [5, 7], [["(\\d{2})(\\d{3})", "$1-$2", ["[2-4]|50|6[09]|7[0-24-69]|8[05]"]], ["(\\d{4})(\\d{3})", "$1 $2", ["0"]], ["(\\d{3})(\\d{4})", "$1 $2", ["[5-9]"]]]], + "TR": ["90", "00", "4\\d{6}|8\\d{11,12}|(?:[2-58]\\d\\d|900)\\d{7}", [7, 10, 12, 13], [["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["512|8[01589]|90"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["5(?:[0-59]|61)", "5(?:[0-59]|616)", "5(?:[0-59]|6161)"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[24][1-8]|3[1-9]"], "(0$1)", 1], ["(\\d{3})(\\d{3})(\\d{6,7})", "$1 $2 $3", ["80"], "0$1", 1]], "0"], + "TT": ["1", "011", "(?:[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-46-8]\\d{6})$|1", "868$1", 0, "868"], + "TV": ["688", "00", "(?:2|7\\d\\d|90)\\d{4}", [5, 6, 7], [["(\\d{2})(\\d{3})", "$1 $2", ["2"]], ["(\\d{2})(\\d{4})", "$1 $2", ["90"]], ["(\\d{2})(\\d{5})", "$1 $2", ["7"]]]], + "TW": ["886", "0(?:0[25-79]|19)", "[2-689]\\d{8}|7\\d{9,10}|[2-8]\\d{7}|2\\d{6}", [7, 8, 9, 10, 11], [["(\\d{2})(\\d)(\\d{4})", "$1 $2 $3", ["202"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[258]0"], "0$1"], ["(\\d)(\\d{3,4})(\\d{4})", "$1 $2 $3", ["[23568]|4(?:0[02-48]|[1-47-9])|7[1-9]", "[23568]|4(?:0[2-48]|[1-47-9])|(?:400|7)[1-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[49]"], "0$1"], ["(\\d{2})(\\d{4})(\\d{4,5})", "$1 $2 $3", ["7"], "0$1"]], "0", 0, 0, 0, 0, 0, 0, 0, "#"], + "TZ": ["255", "00[056]", "(?:[25-8]\\d|41|90)\\d{7}", [9], [["(\\d{3})(\\d{2})(\\d{4})", "$1 $2 $3", ["[89]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[24]"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["5"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[67]"], "0$1"]], "0"], + "UA": ["380", "00", "[89]\\d{9}|[3-9]\\d{8}", [9, 10], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["6[12][29]|(?:3[1-8]|4[136-8]|5[12457]|6[49])2|(?:56|65)[24]", "6[12][29]|(?:35|4[1378]|5[12457]|6[49])2|(?:56|65)[24]|(?:3[1-46-8]|46)2[013-9]"], "0$1"], ["(\\d{4})(\\d{5})", "$1 $2", ["3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6[0135689]|7[4-6])|6(?:[12][3-7]|[459])", "3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6(?:[015689]|3[02389])|7[4-6])|6(?:[12][3-7]|[459])"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[3-7]|89|9[1-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[89]"], "0$1"]], "0", 0, 0, 0, 0, 0, 0, "0~0"], + "UG": ["256", "00[057]", "800\\d{6}|(?:[29]0|[347]\\d)\\d{7}", [9], [["(\\d{4})(\\d{5})", "$1 $2", ["202", "2024"], "0$1"], ["(\\d{3})(\\d{6})", "$1 $2", ["[27-9]|4(?:6[45]|[7-9])"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["[34]"], "0$1"]], "0"], + "US": ["1", "011", "[2-9]\\d{9}|3\\d{6}", [10], [["(\\d{3})(\\d{4})", "$1-$2", ["310"], 0, 1], ["(\\d{3})(\\d{3})(\\d{4})", "($1) $2-$3", ["[2-9]"], 0, 1, "$1-$2-$3"]], "1", 0, 0, 0, 0, 0, [["(?:4722(?:0[0-35]|27)|505(?:[2-57-9]\\d\\d|6(?:[0-35-9]\\d|4[46])))\\d{4}|(?:2(?:0[1-35-9]|1[02-9]|2[03-589]|3[149]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-57-9]|1[02-9]|2[01356]|3[0-24679]|4[167]|5[0-2]|6[014]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|[34][016]|5[01679]|6[0-279]|78|8[0-29])|7(?:0[1-46-8]|1[2-9]|2[04-7]|3[1247]|4[037]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[068]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-389]|8[04-69]))[2-9]\\d{6}"], [""], ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"], ["900[2-9]\\d{6}"], ["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"]]], + "UY": ["598", "0(?:0|1[3-9]\\d)", "(?:0004|4)\\d{9}|[1249]\\d{7}|(?:[49]\\d|80)\\d{5}", [7, 8, 10, 13], [["(\\d{3})(\\d{4})", "$1 $2", ["405|8|90"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["9"], "0$1"], ["(\\d{4})(\\d{4})", "$1 $2", ["[124]"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["4"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3 $4", ["0"]]], "0", 0, 0, 0, 0, 0, 0, "00", " int. "], + "UZ": ["998", "810", "(?:33|[5-79]\\d|88)\\d{7}", [9], [["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[35-9]"], "8 $1"]], "8", 0, 0, 0, 0, 0, 0, "8~10"], + "VA": ["39", "00", "0\\d{5,10}|3[0-8]\\d{7,10}|55\\d{8}|8\\d{5}(?:\\d{2,4})?|(?:1\\d|39)\\d{7,8}", [6, 7, 8, 9, 10, 11], 0, 0, 0, 0, 0, 0, "06698"], + "VC": ["1", "011", "(?:[58]\\d\\d|784|900)\\d{7}", [10], 0, "1", 0, "([2-7]\\d{6})$|1", "784$1", 0, "784"], + "VE": ["58", "00", "[68]00\\d{7}|(?:[24]\\d|[59]0)\\d{8}", [10], [["(\\d{3})(\\d{7})", "$1-$2", ["[24-689]"], "0$1"]], "0"], + "VG": ["1", "011", "(?:284|[58]\\d\\d|900)\\d{7}", [10], 0, "1", 0, "([2-578]\\d{6})$|1", "284$1", 0, "284"], + "VI": ["1", "011", "[58]\\d{9}|(?:34|90)0\\d{7}", [10], 0, "1", 0, "([2-9]\\d{6})$|1", "340$1", 0, "340"], + "VN": ["84", "00", "[12]\\d{9}|[135-9]\\d{8}|[16]\\d{7}|[16-8]\\d{6}", [7, 8, 9, 10], [["(\\d{2})(\\d{5})", "$1 $2", ["80"], "0$1", 1], ["(\\d{4})(\\d{4,6})", "$1 $2", ["1"], 0, 1], ["(\\d{2})(\\d{3})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["[69]"], "0$1", 1], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[3578]"], "0$1", 1], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["2[48]"], "0$1", 1], ["(\\d{3})(\\d{4})(\\d{3})", "$1 $2 $3", ["2"], "0$1", 1]], "0"], + "VU": ["678", "00", "[57-9]\\d{6}|(?:[238]\\d|48)\\d{3}", [5, 7], [["(\\d{3})(\\d{4})", "$1 $2", ["[57-9]"]]]], + "WF": ["681", "00", "(?:40|72)\\d{4}|8\\d{5}(?:\\d{3})?", [6, 9], [["(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3", ["[478]"]], ["(\\d{3})(\\d{2})(\\d{2})(\\d{2})", "$1 $2 $3 $4", ["8"]]]], + "WS": ["685", "0", "(?:[2-6]|8\\d{5})\\d{4}|[78]\\d{6}|[68]\\d{5}", [5, 6, 7, 10], [["(\\d{5})", "$1", ["[2-5]|6[1-9]"]], ["(\\d{3})(\\d{3,7})", "$1 $2", ["[68]"]], ["(\\d{2})(\\d{5})", "$1 $2", ["7"]]]], + "XK": ["383", "00", "[23]\\d{7,8}|(?:4\\d\\d|[89]00)\\d{5}", [8, 9], [["(\\d{3})(\\d{5})", "$1 $2", ["[89]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3})", "$1 $2 $3", ["[2-4]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[23]"], "0$1"]], "0"], + "YE": ["967", "00", "(?:1|7\\d)\\d{7}|[1-7]\\d{6}", [7, 8, 9], [["(\\d)(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[1-6]|7(?:[24-6]|8[0-7])"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["7"], "0$1"]], "0"], + "YT": ["262", "00", "(?:(?:(?:26|63)9|80\\d)\\d|9398)\\d{5}", [9], 0, "0", 0, 0, 0, 0, "269|63|9398"], + "ZA": ["27", "00", "[1-79]\\d{8}|8\\d{4,9}", [5, 6, 7, 8, 9, 10], [["(\\d{2})(\\d{3,4})", "$1 $2", ["8[1-4]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{2,3})", "$1 $2 $3", ["8[1-4]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["860"], "0$1"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["[1-9]"], "0$1"], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["8"], "0$1"]], "0"], + "ZM": ["260", "00", "800\\d{6}|(?:21|63|[79]\\d)\\d{7}", [9], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[28]"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["[79]"], "0$1"]], "0"], + "ZW": ["263", "00", "2(?:[0-57-9]\\d{6,8}|6[0-24-9]\\d{6,7})|[38]\\d{9}|[35-8]\\d{8}|[3-6]\\d{7}|[1-689]\\d{6}|[1-3569]\\d{5}|[1356]\\d{4}", [5, 6, 7, 8, 9, 10], [["(\\d{3})(\\d{3,5})", "$1 $2", ["2(?:0[45]|2[278]|[49]8)|3(?:[09]8|17)|6(?:[29]8|37|75)|[23][78]|(?:33|5[15]|6[68])[78]"], "0$1"], ["(\\d)(\\d{3})(\\d{2,4})", "$1 $2 $3", ["[49]"], "0$1"], ["(\\d{3})(\\d{4})", "$1 $2", ["80"], "0$1"], ["(\\d{2})(\\d{7})", "$1 $2", ["24|8[13-59]|(?:2[05-79]|39|5[45]|6[15-8])2", "2(?:02[014]|4|[56]20|[79]2)|392|5(?:42|525)|6(?:[16-8]21|52[013])|8[13-59]"], "(0$1)"], ["(\\d{2})(\\d{3})(\\d{4})", "$1 $2 $3", ["7"], "0$1"], ["(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["2(?:1[39]|2[0157]|[378]|[56][14])|3(?:12|29)", "2(?:1[39]|2[0157]|[378]|[56][14])|3(?:123|29)"], "0$1"], ["(\\d{4})(\\d{6})", "$1 $2", ["8"], "0$1"], ["(\\d{2})(\\d{3,5})", "$1 $2", ["1|2(?:0[0-36-9]|12|29|[56])|3(?:1[0-689]|[24-6])|5(?:[0236-9]|1[2-4])|6(?:[013-59]|7[0-46-9])|(?:33|55|6[68])[0-69]|(?:29|3[09]|62)[0-79]"], "0$1"], ["(\\d{2})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["29[013-9]|39|54"], "0$1"], ["(\\d{4})(\\d{3,5})", "$1 $2", ["(?:25|54)8", "258|5483"], "0$1"]], "0"] + }, + "nonGeographic": { + "800": ["800", 0, "(?:00|[1-9]\\d)\\d{6}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["\\d"]]], 0, 0, 0, 0, 0, 0, [0, 0, ["(?:00|[1-9]\\d)\\d{6}"]]], + "808": ["808", 0, "[1-9]\\d{7}", [8], [["(\\d{4})(\\d{4})", "$1 $2", ["[1-9]"]]], 0, 0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0, 0, 0, 0, ["[1-9]\\d{7}"]]], + "870": ["870", 0, "7\\d{11}|[35-7]\\d{8}", [9, 12], [["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["[35-7]"]]], 0, 0, 0, 0, 0, 0, [0, ["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"]]], + "878": ["878", 0, "10\\d{10}", [12], [["(\\d{2})(\\d{5})(\\d{5})", "$1 $2 $3", ["1"]]], 0, 0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0, 0, 0, ["10\\d{10}"]]], + "881": ["881", 0, "[0-36-9]\\d{8}", [9], [["(\\d)(\\d{3})(\\d{5})", "$1 $2 $3", ["[0-36-9]"]]], 0, 0, 0, 0, 0, 0, [0, ["[0-36-9]\\d{8}"]]], + "882": ["882", 0, "[13]\\d{6}(?:\\d{2,5})?|[19]\\d{7}|(?:[25]\\d\\d|4)\\d{7}(?:\\d{2})?", [7, 8, 9, 10, 11, 12], [["(\\d{2})(\\d{5})", "$1 $2", ["16|342"]], ["(\\d{2})(\\d{6})", "$1 $2", ["49"]], ["(\\d{2})(\\d{2})(\\d{4})", "$1 $2 $3", ["1[36]|9"]], ["(\\d{2})(\\d{4})(\\d{3})", "$1 $2 $3", ["3[23]"]], ["(\\d{2})(\\d{3,4})(\\d{4})", "$1 $2 $3", ["16"]], ["(\\d{2})(\\d{4})(\\d{4})", "$1 $2 $3", ["10|23|3(?:[15]|4[57])|4|51"]], ["(\\d{3})(\\d{4})(\\d{4})", "$1 $2 $3", ["34"]], ["(\\d{2})(\\d{4,5})(\\d{5})", "$1 $2 $3", ["[1-35]"]]], 0, 0, 0, 0, 0, 0, [0, ["342\\d{4}|(?:337|49)\\d{6}|(?:3(?:2|47|7\\d{3})|50\\d{3})\\d{7}", [7, 8, 9, 10, 12]], 0, 0, 0, 0, 0, 0, ["1(?:3(?:0[0347]|[13][0139]|2[035]|4[013568]|6[0459]|7[06]|8[15-8]|9[0689])\\d{4}|6\\d{5,10})|(?:345\\d|9[89])\\d{6}|(?:10|2(?:3|85\\d)|3(?:[15]|[69]\\d\\d)|4[15-8]|51)\\d{8}"]]], + "883": ["883", 0, "(?:[1-4]\\d|51)\\d{6,10}", [8, 9, 10, 11, 12], [["(\\d{3})(\\d{3})(\\d{2,8})", "$1 $2 $3", ["[14]|2[24-689]|3[02-689]|51[24-9]"]], ["(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3", ["510"]], ["(\\d{3})(\\d{3})(\\d{4})", "$1 $2 $3", ["21"]], ["(\\d{4})(\\d{4})(\\d{4})", "$1 $2 $3", ["51[13]"]], ["(\\d{3})(\\d{3})(\\d{3})(\\d{3})", "$1 $2 $3 $4", ["[235]"]]], 0, 0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0, 0, 0, ["(?:2(?:00\\d\\d|10)|(?:370[1-9]|51\\d0)\\d)\\d{7}|51(?:00\\d{5}|[24-9]0\\d{4,7})|(?:1[013-79]|2[24-689]|3[02-689]|4[0-4])0\\d{5,9}"]]], + "888": ["888", 0, "\\d{11}", [11], [["(\\d{3})(\\d{3})(\\d{5})", "$1 $2 $3"]], 0, 0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0, ["\\d{11}"]]], + "979": ["979", 0, "[1359]\\d{8}", [9], [["(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["[1359]"]]], 0, 0, 0, 0, 0, 0, [0, 0, 0, ["[1359]\\d{8}"]]] + } + }; + + // Importing from a ".js" file is a workaround for Node.js "ES Modules" + function withMetadataArgument(func, _arguments) { + var args = Array.prototype.slice.call(_arguments); + args.push(metadata); + return func.apply(this, args); + } + + function _typeof$2(obj) { + "@babel/helpers - typeof"; + + return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, _typeof$2(obj); + } + + function _defineProperties$2(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); + } + } + + function _createClass$2(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties$2(Constructor.prototype, protoProps); + if (staticProps) _defineProperties$2(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + + function _classCallCheck$2(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function"); + } + + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + writable: true, + configurable: true + } + }); + Object.defineProperty(subClass, "prototype", { + writable: false + }); + if (superClass) _setPrototypeOf(subClass, superClass); + } + + function _createSuper(Derived) { + var hasNativeReflectConstruct = _isNativeReflectConstruct(); + + return function _createSuperInternal() { + var Super = _getPrototypeOf(Derived), + result; + + if (hasNativeReflectConstruct) { + var NewTarget = _getPrototypeOf(this).constructor; + + result = Reflect.construct(Super, arguments, NewTarget); + } else { + result = Super.apply(this, arguments); + } + + return _possibleConstructorReturn(this, result); + }; + } + + function _possibleConstructorReturn(self, call) { + if (call && (_typeof$2(call) === "object" || typeof call === "function")) { + return call; + } else if (call !== void 0) { + throw new TypeError("Derived constructors may only return object or undefined"); + } + + return _assertThisInitialized(self); + } + + function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; + } + + function _wrapNativeSuper(Class) { + var _cache = typeof Map === "function" ? new Map() : undefined; + + _wrapNativeSuper = function _wrapNativeSuper(Class) { + if (Class === null || !_isNativeFunction(Class)) return Class; + + if (typeof Class !== "function") { + throw new TypeError("Super expression must either be null or a function"); + } + + if (typeof _cache !== "undefined") { + if (_cache.has(Class)) return _cache.get(Class); + + _cache.set(Class, Wrapper); + } + + function Wrapper() { + return _construct(Class, arguments, _getPrototypeOf(this).constructor); + } + + Wrapper.prototype = Object.create(Class.prototype, { + constructor: { + value: Wrapper, + enumerable: false, + writable: true, + configurable: true + } + }); + return _setPrototypeOf(Wrapper, Class); + }; + + return _wrapNativeSuper(Class); + } + + function _construct(Parent, args, Class) { + if (_isNativeReflectConstruct()) { + _construct = Reflect.construct; + } else { + _construct = function _construct(Parent, args, Class) { + var a = [null]; + a.push.apply(a, args); + var Constructor = Function.bind.apply(Parent, a); + var instance = new Constructor(); + if (Class) _setPrototypeOf(instance, Class.prototype); + return instance; + }; + } + + return _construct.apply(null, arguments); + } + + function _isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + + try { + Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); + return true; + } catch (e) { + return false; + } + } + + function _isNativeFunction(fn) { + return Function.toString.call(fn).indexOf("[native code]") !== -1; + } + + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); + } + + function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return _getPrototypeOf(o); + } // https://stackoverflow.com/a/46971044/970769 + // "Breaking changes in Typescript 2.1" + // "Extending built-ins like Error, Array, and Map may no longer work." + // "As a recommendation, you can manually adjust the prototype immediately after any super(...) calls." + // https://github.com/Microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work + + + var ParseError = /*#__PURE__*/function (_Error) { + _inherits(ParseError, _Error); + + var _super = _createSuper(ParseError); + + function ParseError(code) { + var _this; + + _classCallCheck$2(this, ParseError); + + _this = _super.call(this, code); // Set the prototype explicitly. + // Any subclass of FooError will have to manually set the prototype as well. + + Object.setPrototypeOf(_assertThisInitialized(_this), ParseError.prototype); + _this.name = _this.constructor.name; + return _this; + } + + return _createClass$2(ParseError); + }( /*#__PURE__*/_wrapNativeSuper(Error)); + + // The minimum length of the national significant number. + var MIN_LENGTH_FOR_NSN = 2; // The ITU says the maximum length should be 15, + // but one can find longer numbers in Germany. + + var MAX_LENGTH_FOR_NSN = 17; // The maximum length of the country calling code. + + var MAX_LENGTH_COUNTRY_CODE = 3; // Digits accepted in phone numbers + // (ascii, fullwidth, arabic-indic, and eastern arabic digits). + + var VALID_DIGITS = "0-9\uFF10-\uFF19\u0660-\u0669\u06F0-\u06F9"; // `DASHES` will be right after the opening square bracket of the "character class" + + var DASHES = "-\u2010-\u2015\u2212\u30FC\uFF0D"; + var SLASHES = "\uFF0F/"; + var DOTS = "\uFF0E."; + var WHITESPACE = " \xA0\xAD\u200B\u2060\u3000"; + var BRACKETS = "()\uFF08\uFF09\uFF3B\uFF3D\\[\\]"; // export const OPENING_BRACKETS = '(\uFF08\uFF3B\\\[' + + var TILDES = "~\u2053\u223C\uFF5E"; // Regular expression of acceptable punctuation found in phone numbers. This + // excludes punctuation found as a leading character only. This consists of dash + // characters, white space characters, full stops, slashes, square brackets, + // parentheses and tildes. Full-width variants are also present. + + var VALID_PUNCTUATION = "".concat(DASHES).concat(SLASHES).concat(DOTS).concat(WHITESPACE).concat(BRACKETS).concat(TILDES); + var PLUS_CHARS = "+\uFF0B"; // const LEADING_PLUS_CHARS_PATTERN = new RegExp('^[' + PLUS_CHARS + ']+') + + // Copy-pasted from: + // https://github.com/substack/semver-compare/blob/master/index.js + // + // Inlining this function because some users reported issues with + // importing from `semver-compare` in a browser with ES6 "native" modules. + // + // Fixes `semver-compare` not being able to compare versions with alpha/beta/etc "tags". + // https://github.com/catamphetamine/libphonenumber-js/issues/381 + function compare (a, b) { + a = a.split('-'); + b = b.split('-'); + var pa = a[0].split('.'); + var pb = b[0].split('.'); + + for (var i = 0; i < 3; i++) { + var na = Number(pa[i]); + var nb = Number(pb[i]); + if (na > nb) return 1; + if (nb > na) return -1; + if (!isNaN(na) && isNaN(nb)) return 1; + if (isNaN(na) && !isNaN(nb)) return -1; + } + + if (a[1] && b[1]) { + return a[1] > b[1] ? 1 : a[1] < b[1] ? -1 : 0; + } + + return !a[1] && b[1] ? 1 : a[1] && !b[1] ? -1 : 0; + } + + function _typeof$1(obj) { + "@babel/helpers - typeof"; + + return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, _typeof$1(obj); + } + + function _classCallCheck$1(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + function _defineProperties$1(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); + } + } + + function _createClass$1(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); + if (staticProps) _defineProperties$1(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + + var V3 = '1.2.0'; // Moved `001` country code to "nonGeographic" section of metadata. + + var V4 = '1.7.35'; + var DEFAULT_EXT_PREFIX = ' ext. '; + var CALLING_CODE_REG_EXP = /^\d+$/; + /** + * See: https://gitlab.com/catamphetamine/libphonenumber-js/blob/master/METADATA.md + */ + + var Metadata = /*#__PURE__*/function () { + function Metadata(metadata) { + _classCallCheck$1(this, Metadata); + + validateMetadata(metadata); + this.metadata = metadata; + setVersion.call(this, metadata); + } + + _createClass$1(Metadata, [{ + key: "getCountries", + value: function getCountries() { + return Object.keys(this.metadata.countries).filter(function (_) { + return _ !== '001'; + }); + } + }, { + key: "getCountryMetadata", + value: function getCountryMetadata(countryCode) { + return this.metadata.countries[countryCode]; + } + }, { + key: "nonGeographic", + value: function nonGeographic() { + if (this.v1 || this.v2 || this.v3) return; // `nonGeographical` was a typo. + // It's present in metadata generated from `1.7.35` to `1.7.37`. + // The test case could be found by searching for "nonGeographical". + + return this.metadata.nonGeographic || this.metadata.nonGeographical; + } + }, { + key: "hasCountry", + value: function hasCountry(country) { + return this.getCountryMetadata(country) !== undefined; + } + }, { + key: "hasCallingCode", + value: function hasCallingCode(callingCode) { + if (this.getCountryCodesForCallingCode(callingCode)) { + return true; + } + + if (this.nonGeographic()) { + if (this.nonGeographic()[callingCode]) { + return true; + } + } else { + // A hacky workaround for old custom metadata (generated before V4). + var countryCodes = this.countryCallingCodes()[callingCode]; + + if (countryCodes && countryCodes.length === 1 && countryCodes[0] === '001') { + return true; + } + } + } + }, { + key: "isNonGeographicCallingCode", + value: function isNonGeographicCallingCode(callingCode) { + if (this.nonGeographic()) { + return this.nonGeographic()[callingCode] ? true : false; + } else { + return this.getCountryCodesForCallingCode(callingCode) ? false : true; + } + } // Deprecated. + + }, { + key: "country", + value: function country(countryCode) { + return this.selectNumberingPlan(countryCode); + } + }, { + key: "selectNumberingPlan", + value: function selectNumberingPlan(countryCode, callingCode) { + // Supports just passing `callingCode` as the first argument. + if (countryCode && CALLING_CODE_REG_EXP.test(countryCode)) { + callingCode = countryCode; + countryCode = null; + } + + if (countryCode && countryCode !== '001') { + if (!this.hasCountry(countryCode)) { + throw new Error("Unknown country: ".concat(countryCode)); + } + + this.numberingPlan = new NumberingPlan(this.getCountryMetadata(countryCode), this); + } else if (callingCode) { + if (!this.hasCallingCode(callingCode)) { + throw new Error("Unknown calling code: ".concat(callingCode)); + } + + this.numberingPlan = new NumberingPlan(this.getNumberingPlanMetadata(callingCode), this); + } else { + this.numberingPlan = undefined; + } + + return this; + } + }, { + key: "getCountryCodesForCallingCode", + value: function getCountryCodesForCallingCode(callingCode) { + var countryCodes = this.countryCallingCodes()[callingCode]; + + if (countryCodes) { + // Metadata before V4 included "non-geographic entity" calling codes + // inside `country_calling_codes` (for example, `"881":["001"]`). + // Now the semantics of `country_calling_codes` has changed: + // it's specifically for "countries" now. + // Older versions of custom metadata will simply skip parsing + // "non-geographic entity" phone numbers with new versions + // of this library: it's not considered a bug, + // because such numbers are extremely rare, + // and developers extremely rarely use custom metadata. + if (countryCodes.length === 1 && countryCodes[0].length === 3) { + return; + } + + return countryCodes; + } + } + }, { + key: "getCountryCodeForCallingCode", + value: function getCountryCodeForCallingCode(callingCode) { + var countryCodes = this.getCountryCodesForCallingCode(callingCode); + + if (countryCodes) { + return countryCodes[0]; + } + } + }, { + key: "getNumberingPlanMetadata", + value: function getNumberingPlanMetadata(callingCode) { + var countryCode = this.getCountryCodeForCallingCode(callingCode); + + if (countryCode) { + return this.getCountryMetadata(countryCode); + } + + if (this.nonGeographic()) { + var metadata = this.nonGeographic()[callingCode]; + + if (metadata) { + return metadata; + } + } else { + // A hacky workaround for old custom metadata (generated before V4). + // In that metadata, there was no concept of "non-geographic" metadata + // so metadata for `001` country code was stored along with other countries. + // The test case can be found by searching for: + // "should work around `nonGeographic` metadata not existing". + var countryCodes = this.countryCallingCodes()[callingCode]; + + if (countryCodes && countryCodes.length === 1 && countryCodes[0] === '001') { + return this.metadata.countries['001']; + } + } + } // Deprecated. + + }, { + key: "countryCallingCode", + value: function countryCallingCode() { + return this.numberingPlan.callingCode(); + } // Deprecated. + + }, { + key: "IDDPrefix", + value: function IDDPrefix() { + return this.numberingPlan.IDDPrefix(); + } // Deprecated. + + }, { + key: "defaultIDDPrefix", + value: function defaultIDDPrefix() { + return this.numberingPlan.defaultIDDPrefix(); + } // Deprecated. + + }, { + key: "nationalNumberPattern", + value: function nationalNumberPattern() { + return this.numberingPlan.nationalNumberPattern(); + } // Deprecated. + + }, { + key: "possibleLengths", + value: function possibleLengths() { + return this.numberingPlan.possibleLengths(); + } // Deprecated. + + }, { + key: "formats", + value: function formats() { + return this.numberingPlan.formats(); + } // Deprecated. + + }, { + key: "nationalPrefixForParsing", + value: function nationalPrefixForParsing() { + return this.numberingPlan.nationalPrefixForParsing(); + } // Deprecated. + + }, { + key: "nationalPrefixTransformRule", + value: function nationalPrefixTransformRule() { + return this.numberingPlan.nationalPrefixTransformRule(); + } // Deprecated. + + }, { + key: "leadingDigits", + value: function leadingDigits() { + return this.numberingPlan.leadingDigits(); + } // Deprecated. + + }, { + key: "hasTypes", + value: function hasTypes() { + return this.numberingPlan.hasTypes(); + } // Deprecated. + + }, { + key: "type", + value: function type(_type) { + return this.numberingPlan.type(_type); + } // Deprecated. + + }, { + key: "ext", + value: function ext() { + return this.numberingPlan.ext(); + } + }, { + key: "countryCallingCodes", + value: function countryCallingCodes() { + if (this.v1) return this.metadata.country_phone_code_to_countries; + return this.metadata.country_calling_codes; + } // Deprecated. + + }, { + key: "chooseCountryByCountryCallingCode", + value: function chooseCountryByCountryCallingCode(callingCode) { + return this.selectNumberingPlan(callingCode); + } + }, { + key: "hasSelectedNumberingPlan", + value: function hasSelectedNumberingPlan() { + return this.numberingPlan !== undefined; + } + }]); + + return Metadata; + }(); + + var NumberingPlan = /*#__PURE__*/function () { + function NumberingPlan(metadata, globalMetadataObject) { + _classCallCheck$1(this, NumberingPlan); + + this.globalMetadataObject = globalMetadataObject; + this.metadata = metadata; + setVersion.call(this, globalMetadataObject.metadata); + } + + _createClass$1(NumberingPlan, [{ + key: "callingCode", + value: function callingCode() { + return this.metadata[0]; + } // Formatting information for regions which share + // a country calling code is contained by only one region + // for performance reasons. For example, for NANPA region + // ("North American Numbering Plan Administration", + // which includes USA, Canada, Cayman Islands, Bahamas, etc) + // it will be contained in the metadata for `US`. + + }, { + key: "getDefaultCountryMetadataForRegion", + value: function getDefaultCountryMetadataForRegion() { + return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode()); + } // Is always present. + + }, { + key: "IDDPrefix", + value: function IDDPrefix() { + if (this.v1 || this.v2) return; + return this.metadata[1]; + } // Is only present when a country supports multiple IDD prefixes. + + }, { + key: "defaultIDDPrefix", + value: function defaultIDDPrefix() { + if (this.v1 || this.v2) return; + return this.metadata[12]; + } + }, { + key: "nationalNumberPattern", + value: function nationalNumberPattern() { + if (this.v1 || this.v2) return this.metadata[1]; + return this.metadata[2]; + } // "possible length" data is always present in Google's metadata. + + }, { + key: "possibleLengths", + value: function possibleLengths() { + if (this.v1) return; + return this.metadata[this.v2 ? 2 : 3]; + } + }, { + key: "_getFormats", + value: function _getFormats(metadata) { + return metadata[this.v1 ? 2 : this.v2 ? 3 : 4]; + } // For countries of the same region (e.g. NANPA) + // formats are all stored in the "main" country for that region. + // E.g. "RU" and "KZ", "US" and "CA". + + }, { + key: "formats", + value: function formats() { + var _this = this; + + var formats = this._getFormats(this.metadata) || this._getFormats(this.getDefaultCountryMetadataForRegion()) || []; + return formats.map(function (_) { + return new Format(_, _this); + }); + } + }, { + key: "nationalPrefix", + value: function nationalPrefix() { + return this.metadata[this.v1 ? 3 : this.v2 ? 4 : 5]; + } + }, { + key: "_getNationalPrefixFormattingRule", + value: function _getNationalPrefixFormattingRule(metadata) { + return metadata[this.v1 ? 4 : this.v2 ? 5 : 6]; + } // For countries of the same region (e.g. NANPA) + // national prefix formatting rule is stored in the "main" country for that region. + // E.g. "RU" and "KZ", "US" and "CA". + + }, { + key: "nationalPrefixFormattingRule", + value: function nationalPrefixFormattingRule() { + return this._getNationalPrefixFormattingRule(this.metadata) || this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion()); + } + }, { + key: "_nationalPrefixForParsing", + value: function _nationalPrefixForParsing() { + return this.metadata[this.v1 ? 5 : this.v2 ? 6 : 7]; + } + }, { + key: "nationalPrefixForParsing", + value: function nationalPrefixForParsing() { + // If `national_prefix_for_parsing` is not set explicitly, + // then infer it from `national_prefix` (if any) + return this._nationalPrefixForParsing() || this.nationalPrefix(); + } + }, { + key: "nationalPrefixTransformRule", + value: function nationalPrefixTransformRule() { + return this.metadata[this.v1 ? 6 : this.v2 ? 7 : 8]; + } + }, { + key: "_getNationalPrefixIsOptionalWhenFormatting", + value: function _getNationalPrefixIsOptionalWhenFormatting() { + return !!this.metadata[this.v1 ? 7 : this.v2 ? 8 : 9]; + } // For countries of the same region (e.g. NANPA) + // "national prefix is optional when formatting" flag is + // stored in the "main" country for that region. + // E.g. "RU" and "KZ", "US" and "CA". + + }, { + key: "nationalPrefixIsOptionalWhenFormattingInNationalFormat", + value: function nationalPrefixIsOptionalWhenFormattingInNationalFormat() { + return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata) || this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion()); + } + }, { + key: "leadingDigits", + value: function leadingDigits() { + return this.metadata[this.v1 ? 8 : this.v2 ? 9 : 10]; + } + }, { + key: "types", + value: function types() { + return this.metadata[this.v1 ? 9 : this.v2 ? 10 : 11]; + } + }, { + key: "hasTypes", + value: function hasTypes() { + // Versions 1.2.0 - 1.2.4: can be `[]`. + + /* istanbul ignore next */ + if (this.types() && this.types().length === 0) { + return false; + } // Versions <= 1.2.4: can be `undefined`. + // Version >= 1.2.5: can be `0`. + + + return !!this.types(); + } + }, { + key: "type", + value: function type(_type2) { + if (this.hasTypes() && getType(this.types(), _type2)) { + return new Type(getType(this.types(), _type2), this); + } + } + }, { + key: "ext", + value: function ext() { + if (this.v1 || this.v2) return DEFAULT_EXT_PREFIX; + return this.metadata[13] || DEFAULT_EXT_PREFIX; + } + }]); + + return NumberingPlan; + }(); + + var Format = /*#__PURE__*/function () { + function Format(format, metadata) { + _classCallCheck$1(this, Format); + + this._format = format; + this.metadata = metadata; + } + + _createClass$1(Format, [{ + key: "pattern", + value: function pattern() { + return this._format[0]; + } + }, { + key: "format", + value: function format() { + return this._format[1]; + } + }, { + key: "leadingDigitsPatterns", + value: function leadingDigitsPatterns() { + return this._format[2] || []; + } + }, { + key: "nationalPrefixFormattingRule", + value: function nationalPrefixFormattingRule() { + return this._format[3] || this.metadata.nationalPrefixFormattingRule(); + } + }, { + key: "nationalPrefixIsOptionalWhenFormattingInNationalFormat", + value: function nationalPrefixIsOptionalWhenFormattingInNationalFormat() { + return !!this._format[4] || this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat(); + } + }, { + key: "nationalPrefixIsMandatoryWhenFormattingInNationalFormat", + value: function nationalPrefixIsMandatoryWhenFormattingInNationalFormat() { + // National prefix is omitted if there's no national prefix formatting rule + // set for this country, or when the national prefix formatting rule + // contains no national prefix itself, or when this rule is set but + // national prefix is optional for this phone number format + // (and it is not enforced explicitly) + return this.usesNationalPrefix() && !this.nationalPrefixIsOptionalWhenFormattingInNationalFormat(); + } // Checks whether national prefix formatting rule contains national prefix. + + }, { + key: "usesNationalPrefix", + value: function usesNationalPrefix() { + return this.nationalPrefixFormattingRule() && // Check that national prefix formatting rule is not a "dummy" one. + !FIRST_GROUP_ONLY_PREFIX_PATTERN.test(this.nationalPrefixFormattingRule()) // In compressed metadata, `this.nationalPrefixFormattingRule()` is `0` + // when `national_prefix_formatting_rule` is not present. + // So, `true` or `false` are returned explicitly here, so that + // `0` number isn't returned. + ? true : false; + } + }, { + key: "internationalFormat", + value: function internationalFormat() { + return this._format[5] || this.format(); + } + }]); + + return Format; + }(); + /** + * A pattern that is used to determine if the national prefix formatting rule + * has the first group only, i.e., does not start with the national prefix. + * Note that the pattern explicitly allows for unbalanced parentheses. + */ + + + var FIRST_GROUP_ONLY_PREFIX_PATTERN = /^\(?\$1\)?$/; + + var Type = /*#__PURE__*/function () { + function Type(type, metadata) { + _classCallCheck$1(this, Type); + + this.type = type; + this.metadata = metadata; + } + + _createClass$1(Type, [{ + key: "pattern", + value: function pattern() { + if (this.metadata.v1) return this.type; + return this.type[0]; + } + }, { + key: "possibleLengths", + value: function possibleLengths() { + if (this.metadata.v1) return; + return this.type[1] || this.metadata.possibleLengths(); + } + }]); + + return Type; + }(); + + function getType(types, type) { + switch (type) { + case 'FIXED_LINE': + return types[0]; + + case 'MOBILE': + return types[1]; + + case 'TOLL_FREE': + return types[2]; + + case 'PREMIUM_RATE': + return types[3]; + + case 'PERSONAL_NUMBER': + return types[4]; + + case 'VOICEMAIL': + return types[5]; + + case 'UAN': + return types[6]; + + case 'PAGER': + return types[7]; + + case 'VOIP': + return types[8]; + + case 'SHARED_COST': + return types[9]; + } + } + + function validateMetadata(metadata) { + if (!metadata) { + throw new Error('[libphonenumber-js] `metadata` argument not passed. Check your arguments.'); + } // `country_phone_code_to_countries` was renamed to + // `country_calling_codes` in `1.0.18`. + + + if (!is_object(metadata) || !is_object(metadata.countries)) { + throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(is_object(metadata) ? 'an object of shape: { ' + Object.keys(metadata).join(', ') + ' }' : 'a ' + type_of(metadata) + ': ' + metadata, ".")); + } + } // Babel transforms `typeof` into some "branches" + // so istanbul will show this as "branch not covered". + + /* istanbul ignore next */ + + var is_object = function is_object(_) { + return _typeof$1(_) === 'object'; + }; // Babel transforms `typeof` into some "branches" + // so istanbul will show this as "branch not covered". + + /* istanbul ignore next */ + + + var type_of = function type_of(_) { + return _typeof$1(_); + }; + /** + * Returns "country calling code" for a country. + * Throws an error if the country doesn't exist or isn't supported by this library. + * @param {string} country + * @param {object} metadata + * @return {string} + * @example + * // Returns "44" + * getCountryCallingCode("GB") + */ + + function getCountryCallingCode(country, metadata) { + metadata = new Metadata(metadata); + + if (metadata.hasCountry(country)) { + return metadata.country(country).countryCallingCode(); + } + + throw new Error("Unknown country: ".concat(country)); + } + + function setVersion(metadata) { + var version = metadata.version; + + if (typeof version === 'number') { + this.v1 = version === 1; + this.v2 = version === 2; + this.v3 = version === 3; + this.v4 = version === 4; + } else { + if (!version) { + this.v1 = true; + } else if (compare(version, V3) === -1) { + this.v2 = true; + } else if (compare(version, V4) === -1) { + this.v3 = true; + } else { + this.v4 = true; + } + } + } // const ISO_COUNTRY_CODE = /^[A-Z]{2}$/ + // function isCountryCode(countryCode) { + // return ISO_COUNTRY_CODE.test(countryCodeOrCountryCallingCode) + // } + + var RFC3966_EXTN_PREFIX = ';ext='; + /** + * Helper method for constructing regular expressions for parsing. Creates + * an expression that captures up to max_length digits. + * @return {string} RegEx pattern to capture extension digits. + */ + + var getExtensionDigitsPattern = function getExtensionDigitsPattern(maxLength) { + return "([".concat(VALID_DIGITS, "]{1,").concat(maxLength, "})"); + }; + /** + * Helper initialiser method to create the regular-expression pattern to match + * extensions. + * Copy-pasted from Google's `libphonenumber`: + * https://github.com/google/libphonenumber/blob/55b2646ec9393f4d3d6661b9c82ef9e258e8b829/javascript/i18n/phonenumbers/phonenumberutil.js#L759-L766 + * @return {string} RegEx pattern to capture extensions. + */ + + + function createExtensionPattern(purpose) { + // We cap the maximum length of an extension based on the ambiguity of the way + // the extension is prefixed. As per ITU, the officially allowed length for + // extensions is actually 40, but we don't support this since we haven't seen real + // examples and this introduces many false interpretations as the extension labels + // are not standardized. + + /** @type {string} */ + var extLimitAfterExplicitLabel = '20'; + /** @type {string} */ + + var extLimitAfterLikelyLabel = '15'; + /** @type {string} */ + + var extLimitAfterAmbiguousChar = '9'; + /** @type {string} */ + + var extLimitWhenNotSure = '6'; + /** @type {string} */ + + var possibleSeparatorsBetweenNumberAndExtLabel = "[ \xA0\\t,]*"; // Optional full stop (.) or colon, followed by zero or more spaces/tabs/commas. + + /** @type {string} */ + + var possibleCharsAfterExtLabel = "[:\\.\uFF0E]?[ \xA0\\t,-]*"; + /** @type {string} */ + + var optionalExtnSuffix = "#?"; // Here the extension is called out in more explicit way, i.e mentioning it obvious + // patterns like "ext.". + + /** @type {string} */ + + var explicitExtLabels = "(?:e?xt(?:ensi(?:o\u0301?|\xF3))?n?|\uFF45?\uFF58\uFF54\uFF4E?|\u0434\u043E\u0431|anexo)"; // One-character symbols that can be used to indicate an extension, and less + // commonly used or more ambiguous extension labels. + + /** @type {string} */ + + var ambiguousExtLabels = "(?:[x\uFF58#\uFF03~\uFF5E]|int|\uFF49\uFF4E\uFF54)"; // When extension is not separated clearly. + + /** @type {string} */ + + var ambiguousSeparator = "[- ]+"; // This is the same as possibleSeparatorsBetweenNumberAndExtLabel, but not matching + // comma as extension label may have it. + + /** @type {string} */ + + var possibleSeparatorsNumberExtLabelNoComma = "[ \xA0\\t]*"; // ",," is commonly used for auto dialling the extension when connected. First + // comma is matched through possibleSeparatorsBetweenNumberAndExtLabel, so we do + // not repeat it here. Semi-colon works in Iphone and Android also to pop up a + // button with the extension number following. + + /** @type {string} */ + + var autoDiallingAndExtLabelsFound = "(?:,{2}|;)"; + /** @type {string} */ + + var rfcExtn = RFC3966_EXTN_PREFIX + getExtensionDigitsPattern(extLimitAfterExplicitLabel); + /** @type {string} */ + + var explicitExtn = possibleSeparatorsBetweenNumberAndExtLabel + explicitExtLabels + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterExplicitLabel) + optionalExtnSuffix; + /** @type {string} */ + + var ambiguousExtn = possibleSeparatorsBetweenNumberAndExtLabel + ambiguousExtLabels + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterAmbiguousChar) + optionalExtnSuffix; + /** @type {string} */ + + var americanStyleExtnWithSuffix = ambiguousSeparator + getExtensionDigitsPattern(extLimitWhenNotSure) + "#"; + /** @type {string} */ + + var autoDiallingExtn = possibleSeparatorsNumberExtLabelNoComma + autoDiallingAndExtLabelsFound + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterLikelyLabel) + optionalExtnSuffix; + /** @type {string} */ + + var onlyCommasExtn = possibleSeparatorsNumberExtLabelNoComma + "(?:,)+" + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterAmbiguousChar) + optionalExtnSuffix; // The first regular expression covers RFC 3966 format, where the extension is added + // using ";ext=". The second more generic where extension is mentioned with explicit + // labels like "ext:". In both the above cases we allow more numbers in extension than + // any other extension labels. The third one captures when single character extension + // labels or less commonly used labels are used. In such cases we capture fewer + // extension digits in order to reduce the chance of falsely interpreting two + // numbers beside each other as a number + extension. The fourth one covers the + // special case of American numbers where the extension is written with a hash + // at the end, such as "- 503#". The fifth one is exclusively for extension + // autodialling formats which are used when dialling and in this case we accept longer + // extensions. The last one is more liberal on the number of commas that acts as + // extension labels, so we have a strict cap on the number of digits in such extensions. + + return rfcExtn + "|" + explicitExtn + "|" + ambiguousExtn + "|" + americanStyleExtnWithSuffix + "|" + autoDiallingExtn + "|" + onlyCommasExtn; + } + + // Checks we have at least three leading digits, and only valid punctuation, + // alpha characters and digits in the phone number. Does not include extension + // data. The symbol 'x' is allowed here as valid punctuation since it is often + // used as a placeholder for carrier codes, for example in Brazilian phone + // numbers. We also allow multiple '+' characters at the start. + // + // Corresponds to the following: + // [digits]{minLengthNsn}| + // plus_sign* + // (([punctuation]|[star])*[digits]){3,}([punctuation]|[star]|[digits]|[alpha])* + // + // The first reg-ex is to allow short numbers (two digits long) to be parsed if + // they are entered as "15" etc, but only if there is no punctuation in them. + // The second expression restricts the number of digits to three or more, but + // then allows them to be in international form, and to have alpha-characters + // and punctuation. We split up the two reg-exes here and combine them when + // creating the reg-ex VALID_PHONE_NUMBER_PATTERN itself so we can prefix it + // with ^ and append $ to each branch. + // + // "Note VALID_PUNCTUATION starts with a -, + // so must be the first in the range" (c) Google devs. + // (wtf did they mean by saying that; probably nothing) + // + + var MIN_LENGTH_PHONE_NUMBER_PATTERN = '[' + VALID_DIGITS + ']{' + MIN_LENGTH_FOR_NSN + '}'; // + // And this is the second reg-exp: + // (see MIN_LENGTH_PHONE_NUMBER_PATTERN for a full description of this reg-exp) + // + + var VALID_PHONE_NUMBER = '[' + PLUS_CHARS + ']{0,1}' + '(?:' + '[' + VALID_PUNCTUATION + ']*' + '[' + VALID_DIGITS + ']' + '){3,}' + '[' + VALID_PUNCTUATION + VALID_DIGITS + ']*'; // This regular expression isn't present in Google's `libphonenumber` + // and is only used to determine whether the phone number being input + // is too short for it to even consider it a "valid" number. + // This is just a way to differentiate between a really invalid phone + // number like "abcde" and a valid phone number that a user has just + // started inputting, like "+1" or "1": both these cases would be + // considered `NOT_A_NUMBER` by Google's `libphonenumber`, but this + // library can provide a more detailed error message — whether it's + // really "not a number", or is it just a start of a valid phone number. + + var VALID_PHONE_NUMBER_START_REG_EXP = new RegExp('^' + '[' + PLUS_CHARS + ']{0,1}' + '(?:' + '[' + VALID_PUNCTUATION + ']*' + '[' + VALID_DIGITS + ']' + '){1,2}' + '$', 'i'); + var VALID_PHONE_NUMBER_WITH_EXTENSION = VALID_PHONE_NUMBER + // Phone number extensions + '(?:' + createExtensionPattern() + ')?'; // The combined regular expression for valid phone numbers: + // + + var VALID_PHONE_NUMBER_PATTERN = new RegExp( // Either a short two-digit-only phone number + '^' + MIN_LENGTH_PHONE_NUMBER_PATTERN + '$' + '|' + // Or a longer fully parsed phone number (min 3 characters) + '^' + VALID_PHONE_NUMBER_WITH_EXTENSION + '$', 'i'); // Checks to see if the string of characters could possibly be a phone number at + // all. At the moment, checks to see that the string begins with at least 2 + // digits, ignoring any punctuation commonly found in phone numbers. This method + // does not require the number to be normalized in advance - but does assume + // that leading non-number symbols have been removed, such as by the method + // `extract_possible_number`. + // + + function isViablePhoneNumber(number) { + return number.length >= MIN_LENGTH_FOR_NSN && VALID_PHONE_NUMBER_PATTERN.test(number); + } // This is just a way to differentiate between a really invalid phone + // number like "abcde" and a valid phone number that a user has just + // started inputting, like "+1" or "1": both these cases would be + // considered `NOT_A_NUMBER` by Google's `libphonenumber`, but this + // library can provide a more detailed error message — whether it's + // really "not a number", or is it just a start of a valid phone number. + + function isViablePhoneNumberStart(number) { + return VALID_PHONE_NUMBER_START_REG_EXP.test(number); + } + + // 1 or more valid digits, for use when parsing. + + var EXTN_PATTERN = new RegExp('(?:' + createExtensionPattern() + ')$', 'i'); // Strips any extension (as in, the part of the number dialled after the call is + // connected, usually indicated with extn, ext, x or similar) from the end of + // the number, and returns it. + + function extractExtension(number) { + var start = number.search(EXTN_PATTERN); + + if (start < 0) { + return {}; + } // If we find a potential extension, and the number preceding this is a viable + // number, we assume it is an extension. + + + var numberWithoutExtension = number.slice(0, start); + var matches = number.match(EXTN_PATTERN); + var i = 1; + + while (i < matches.length) { + if (matches[i]) { + return { + number: numberWithoutExtension, + ext: matches[i] + }; + } + + i++; + } + } + + // replace it for normalization purposes. Non-European digits that + // may be used in phone numbers are mapped to a European equivalent. + // + // E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`. + // + + + var DIGITS = { + '0': '0', + '1': '1', + '2': '2', + '3': '3', + '4': '4', + '5': '5', + '6': '6', + '7': '7', + '8': '8', + '9': '9', + "\uFF10": '0', + // Fullwidth digit 0 + "\uFF11": '1', + // Fullwidth digit 1 + "\uFF12": '2', + // Fullwidth digit 2 + "\uFF13": '3', + // Fullwidth digit 3 + "\uFF14": '4', + // Fullwidth digit 4 + "\uFF15": '5', + // Fullwidth digit 5 + "\uFF16": '6', + // Fullwidth digit 6 + "\uFF17": '7', + // Fullwidth digit 7 + "\uFF18": '8', + // Fullwidth digit 8 + "\uFF19": '9', + // Fullwidth digit 9 + "\u0660": '0', + // Arabic-indic digit 0 + "\u0661": '1', + // Arabic-indic digit 1 + "\u0662": '2', + // Arabic-indic digit 2 + "\u0663": '3', + // Arabic-indic digit 3 + "\u0664": '4', + // Arabic-indic digit 4 + "\u0665": '5', + // Arabic-indic digit 5 + "\u0666": '6', + // Arabic-indic digit 6 + "\u0667": '7', + // Arabic-indic digit 7 + "\u0668": '8', + // Arabic-indic digit 8 + "\u0669": '9', + // Arabic-indic digit 9 + "\u06F0": '0', + // Eastern-Arabic digit 0 + "\u06F1": '1', + // Eastern-Arabic digit 1 + "\u06F2": '2', + // Eastern-Arabic digit 2 + "\u06F3": '3', + // Eastern-Arabic digit 3 + "\u06F4": '4', + // Eastern-Arabic digit 4 + "\u06F5": '5', + // Eastern-Arabic digit 5 + "\u06F6": '6', + // Eastern-Arabic digit 6 + "\u06F7": '7', + // Eastern-Arabic digit 7 + "\u06F8": '8', + // Eastern-Arabic digit 8 + "\u06F9": '9' // Eastern-Arabic digit 9 + + }; + function parseDigit(character) { + return DIGITS[character]; + } + + function _createForOfIteratorHelperLoose$4(o, allowArrayLike) { + var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; + if (it) return (it = it.call(o)).next.bind(it); + + if (Array.isArray(o) || (it = _unsupportedIterableToArray$5(o)) || allowArrayLike && o && typeof o.length === "number") { + if (it) o = it; + var i = 0; + return function () { + if (i >= o.length) return { + done: true + }; + return { + done: false, + value: o[i++] + }; + }; + } + + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function _unsupportedIterableToArray$5(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray$5(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$5(o, minLen); + } + + function _arrayLikeToArray$5(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) { + arr2[i] = arr[i]; + } + + return arr2; + } + /** + * Parses phone number characters from a string. + * Drops all punctuation leaving only digits and the leading `+` sign (if any). + * Also converts wide-ascii and arabic-indic numerals to conventional numerals. + * E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`. + * @param {string} string + * @return {string} + * @example + * ```js + * // Outputs '8800555'. + * parseIncompletePhoneNumber('8 (800) 555') + * // Outputs '+7800555'. + * parseIncompletePhoneNumber('+7 800 555') + * ``` + */ + + function parseIncompletePhoneNumber(string) { + var result = ''; // Using `.split('')` here instead of normal `for ... of` + // because the importing application doesn't neccessarily include an ES6 polyfill. + // The `.split('')` approach discards "exotic" UTF-8 characters + // (the ones consisting of four bytes) but digits + // (including non-European ones) don't fall into that range + // so such "exotic" characters would be discarded anyway. + + for (var _iterator = _createForOfIteratorHelperLoose$4(string.split('')), _step; !(_step = _iterator()).done;) { + var character = _step.value; + result += parsePhoneNumberCharacter(character, result) || ''; + } + + return result; + } + /** + * Parses next character while parsing phone number digits (including a `+`) + * from text: discards everything except `+` and digits, and `+` is only allowed + * at the start of a phone number. + * For example, is used in `react-phone-number-input` where it uses + * [`input-format`](https://gitlab.com/catamphetamine/input-format). + * @param {string} character - Yet another character from raw input string. + * @param {string?} prevParsedCharacters - Previous parsed characters. + * @param {object} meta - Optional custom use-case-specific metadata. + * @return {string?} The parsed character. + */ + + function parsePhoneNumberCharacter(character, prevParsedCharacters) { + // Only allow a leading `+`. + if (character === '+') { + // If this `+` is not the first parsed character + // then discard it. + if (prevParsedCharacters) { + return; + } + + return '+'; + } // Allow digits. + + + return parseDigit(character); + } + + function _createForOfIteratorHelperLoose$3(o, allowArrayLike) { + var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; + if (it) return (it = it.call(o)).next.bind(it); + + if (Array.isArray(o) || (it = _unsupportedIterableToArray$4(o)) || allowArrayLike && o && typeof o.length === "number") { + if (it) o = it; + var i = 0; + return function () { + if (i >= o.length) return { + done: true + }; + return { + done: false, + value: o[i++] + }; + }; + } + + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function _unsupportedIterableToArray$4(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray$4(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen); + } + + function _arrayLikeToArray$4(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) { + arr2[i] = arr[i]; + } + + return arr2; + } + /** + * Merges two arrays. + * @param {*} a + * @param {*} b + * @return {*} + */ + + + function mergeArrays(a, b) { + var merged = a.slice(); + + for (var _iterator = _createForOfIteratorHelperLoose$3(b), _step; !(_step = _iterator()).done;) { + var element = _step.value; + + if (a.indexOf(element) < 0) { + merged.push(element); + } + } + + return merged.sort(function (a, b) { + return a - b; + }); // ES6 version, requires Set polyfill. + // let merged = new Set(a) + // for (const element of b) { + // merged.add(i) + // } + // return Array.from(merged).sort((a, b) => a - b) + } + + function checkNumberLength(nationalNumber, metadata) { + return checkNumberLengthForType(nationalNumber, undefined, metadata); + } // Checks whether a number is possible for the country based on its length. + // Should only be called for the "new" metadata which has "possible lengths". + + function checkNumberLengthForType(nationalNumber, type, metadata) { + var type_info = metadata.type(type); // There should always be "" set for every type element. + // This is declared in the XML schema. + // For size efficiency, where a sub-description (e.g. fixed-line) + // has the same "" as the "general description", this is missing, + // so we fall back to the "general description". Where no numbers of the type + // exist at all, there is one possible length (-1) which is guaranteed + // not to match the length of any real phone number. + + var possible_lengths = type_info && type_info.possibleLengths() || metadata.possibleLengths(); // let local_lengths = type_info && type.possibleLengthsLocal() || metadata.possibleLengthsLocal() + // Metadata before version `1.0.18` didn't contain `possible_lengths`. + + if (!possible_lengths) { + return 'IS_POSSIBLE'; + } + + if (type === 'FIXED_LINE_OR_MOBILE') { + // No such country in metadata. + + /* istanbul ignore next */ + if (!metadata.type('FIXED_LINE')) { + // The rare case has been encountered where no fixedLine data is available + // (true for some non-geographic entities), so we just check mobile. + return checkNumberLengthForType(nationalNumber, 'MOBILE', metadata); + } + + var mobile_type = metadata.type('MOBILE'); + + if (mobile_type) { + // Merge the mobile data in if there was any. "Concat" creates a new + // array, it doesn't edit possible_lengths in place, so we don't need a copy. + // Note that when adding the possible lengths from mobile, we have + // to again check they aren't empty since if they are this indicates + // they are the same as the general desc and should be obtained from there. + possible_lengths = mergeArrays(possible_lengths, mobile_type.possibleLengths()); // The current list is sorted; we need to merge in the new list and + // re-sort (duplicates are okay). Sorting isn't so expensive because + // the lists are very small. + // if (local_lengths) { + // local_lengths = mergeArrays(local_lengths, mobile_type.possibleLengthsLocal()) + // } else { + // local_lengths = mobile_type.possibleLengthsLocal() + // } + } + } // If the type doesn't exist then return 'INVALID_LENGTH'. + else if (type && !type_info) { + return 'INVALID_LENGTH'; + } + + var actual_length = nationalNumber.length; // In `libphonenumber-js` all "local-only" formats are dropped for simplicity. + // // This is safe because there is never an overlap beween the possible lengths + // // and the local-only lengths; this is checked at build time. + // if (local_lengths && local_lengths.indexOf(nationalNumber.length) >= 0) + // { + // return 'IS_POSSIBLE_LOCAL_ONLY' + // } + + var minimum_length = possible_lengths[0]; + + if (minimum_length === actual_length) { + return 'IS_POSSIBLE'; + } + + if (minimum_length > actual_length) { + return 'TOO_SHORT'; + } + + if (possible_lengths[possible_lengths.length - 1] < actual_length) { + return 'TOO_LONG'; + } // We skip the first element since we've already checked it. + + + return possible_lengths.indexOf(actual_length, 1) >= 0 ? 'IS_POSSIBLE' : 'INVALID_LENGTH'; + } + + /** + * Checks if a phone number is "possible" (basically just checks its length). + * + * isPossible(phoneNumberInstance, { ..., v2: true }, metadata) + * + * isPossible({ phone: '8005553535', country: 'RU' }, { ... }, metadata) + * isPossible({ phone: '8005553535', country: 'RU' }, undefined, metadata) + * + * @param {object|PhoneNumber} input — If `options.v2: true` flag is passed, the `input` should be a `PhoneNumber` instance. Otherwise, it should be an object of shape `{ phone: '...', country: '...' }`. + * @param {object} [options] + * @param {object} metadata + * @return {string} + */ + + function isPossiblePhoneNumber(input, options, metadata) { + /* istanbul ignore if */ + if (options === undefined) { + options = {}; + } + + metadata = new Metadata(metadata); + + if (options.v2) { + if (!input.countryCallingCode) { + throw new Error('Invalid phone number object passed'); + } + + metadata.selectNumberingPlan(input.countryCallingCode); + } else { + if (!input.phone) { + return false; + } + + if (input.country) { + if (!metadata.hasCountry(input.country)) { + throw new Error("Unknown country: ".concat(input.country)); + } + + metadata.country(input.country); + } else { + if (!input.countryCallingCode) { + throw new Error('Invalid phone number object passed'); + } + + metadata.selectNumberingPlan(input.countryCallingCode); + } + } // Old metadata (< 1.0.18) had no "possible length" data. + + + if (metadata.possibleLengths()) { + return isPossibleNumber(input.phone || input.nationalNumber, metadata); + } else { + // There was a bug between `1.7.35` and `1.7.37` where "possible_lengths" + // were missing for "non-geographical" numbering plans. + // Just assume the number is possible in such cases: + // it's unlikely that anyone generated their custom metadata + // in that short period of time (one day). + // This code can be removed in some future major version update. + if (input.countryCallingCode && metadata.isNonGeographicCallingCode(input.countryCallingCode)) { + // "Non-geographic entities" did't have `possibleLengths` + // due to a bug in metadata generation process. + return true; + } else { + throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.'); + } + } + } + function isPossibleNumber(nationalNumber, metadata) { + //, isInternational) { + switch (checkNumberLength(nationalNumber, metadata)) { + case 'IS_POSSIBLE': + return true; + // This library ignores "local-only" phone numbers (for simplicity). + // See the readme for more info on what are "local-only" phone numbers. + // case 'IS_POSSIBLE_LOCAL_ONLY': + // return !isInternational + + default: + return false; + } + } + + /** + * Checks whether the entire input sequence can be matched + * against the regular expression. + * @return {boolean} + */ + function matchesEntirely(text, regular_expression) { + // If assigning the `''` default value is moved to the arguments above, + // code coverage would decrease for some weird reason. + text = text || ''; + return new RegExp('^(?:' + regular_expression + ')$').test(text); + } + + function _createForOfIteratorHelperLoose$2(o, allowArrayLike) { + var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; + if (it) return (it = it.call(o)).next.bind(it); + + if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike && o && typeof o.length === "number") { + if (it) o = it; + var i = 0; + return function () { + if (i >= o.length) return { + done: true + }; + return { + done: false, + value: o[i++] + }; + }; + } + + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function _unsupportedIterableToArray$3(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); + } + + function _arrayLikeToArray$3(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) { + arr2[i] = arr[i]; + } + + return arr2; + } + var NON_FIXED_LINE_PHONE_TYPES = ['MOBILE', 'PREMIUM_RATE', 'TOLL_FREE', 'SHARED_COST', 'VOIP', 'PERSONAL_NUMBER', 'PAGER', 'UAN', 'VOICEMAIL']; // Finds out national phone number type (fixed line, mobile, etc) + + function getNumberType(input, options, metadata) { + // If assigning the `{}` default value is moved to the arguments above, + // code coverage would decrease for some weird reason. + options = options || {}; // When `parse()` returned `{}` + // meaning that the phone number is not a valid one. + + if (!input.country) { + return; + } + + metadata = new Metadata(metadata); + metadata.selectNumberingPlan(input.country, input.countryCallingCode); + var nationalNumber = options.v2 ? input.nationalNumber : input.phone; // The following is copy-pasted from the original function: + // https://github.com/googlei18n/libphonenumber/blob/3ea547d4fbaa2d0b67588904dfa5d3f2557c27ff/javascript/i18n/phonenumbers/phonenumberutil.js#L2835 + // Is this national number even valid for this country + + if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern())) { + return; + } // Is it fixed line number + + + if (isNumberTypeEqualTo(nationalNumber, 'FIXED_LINE', metadata)) { + // Because duplicate regular expressions are removed + // to reduce metadata size, if "mobile" pattern is "" + // then it means it was removed due to being a duplicate of the fixed-line pattern. + // + if (metadata.type('MOBILE') && metadata.type('MOBILE').pattern() === '') { + return 'FIXED_LINE_OR_MOBILE'; + } // `MOBILE` type pattern isn't included if it matched `FIXED_LINE` one. + // For example, for "US" country. + // Old metadata (< `1.0.18`) had a specific "types" data structure + // that happened to be `undefined` for `MOBILE` in that case. + // Newer metadata (>= `1.0.18`) has another data structure that is + // not `undefined` for `MOBILE` in that case (it's just an empty array). + // So this `if` is just for backwards compatibility with old metadata. + + + if (!metadata.type('MOBILE')) { + return 'FIXED_LINE_OR_MOBILE'; + } // Check if the number happens to qualify as both fixed line and mobile. + // (no such country in the minimal metadata set) + + /* istanbul ignore if */ + + + if (isNumberTypeEqualTo(nationalNumber, 'MOBILE', metadata)) { + return 'FIXED_LINE_OR_MOBILE'; + } + + return 'FIXED_LINE'; + } + + for (var _iterator = _createForOfIteratorHelperLoose$2(NON_FIXED_LINE_PHONE_TYPES), _step; !(_step = _iterator()).done;) { + var type = _step.value; + + if (isNumberTypeEqualTo(nationalNumber, type, metadata)) { + return type; + } + } + } + function isNumberTypeEqualTo(nationalNumber, type, metadata) { + type = metadata.type(type); + + if (!type || !type.pattern()) { + return false; + } // Check if any possible number lengths are present; + // if so, we use them to avoid checking + // the validation pattern if they don't match. + // If they are absent, this means they match + // the general description, which we have + // already checked before a specific number type. + + + if (type.possibleLengths() && type.possibleLengths().indexOf(nationalNumber.length) < 0) { + return false; + } + + return matchesEntirely(nationalNumber, type.pattern()); + } + + /** + * Checks if a given phone number is valid. + * + * isValid(phoneNumberInstance, { ..., v2: true }, metadata) + * + * isPossible({ phone: '8005553535', country: 'RU' }, { ... }, metadata) + * isPossible({ phone: '8005553535', country: 'RU' }, undefined, metadata) + * + * If the `number` is a string, it will be parsed to an object, + * but only if it contains only valid phone number characters (including punctuation). + * If the `number` is an object, it is used as is. + * + * The optional `defaultCountry` argument is the default country. + * I.e. it does not restrict to just that country, + * e.g. in those cases where several countries share + * the same phone numbering rules (NANPA, Britain, etc). + * For example, even though the number `07624 369230` + * belongs to the Isle of Man ("IM" country code) + * calling `isValidNumber('07624369230', 'GB', metadata)` + * still returns `true` because the country is not restricted to `GB`, + * it's just that `GB` is the default one for the phone numbering rules. + * For restricting the country see `isValidNumberForRegion()` + * though restricting a country might not be a good idea. + * https://github.com/googlei18n/libphonenumber/blob/master/FAQ.md#when-should-i-use-isvalidnumberforregion + * + * Examples: + * + * ```js + * isValidNumber('+78005553535', metadata) + * isValidNumber('8005553535', 'RU', metadata) + * isValidNumber('88005553535', 'RU', metadata) + * isValidNumber({ phone: '8005553535', country: 'RU' }, metadata) + * ``` + */ + + function isValidNumber(input, options, metadata) { + // If assigning the `{}` default value is moved to the arguments above, + // code coverage would decrease for some weird reason. + options = options || {}; + metadata = new Metadata(metadata); + /** + * Checks if a phone number is "possible" (basically just checks its length). + * + * @param {object|PhoneNumber} input — If `options.v2: true` flag is passed, the `input` should be a `PhoneNumber` instance. Otherwise, it should be an object of shape `{ phone: '...', country: '...' }`. + * @param {object} [options] + * @param {object} metadata + * @return {string} + */ + + metadata.selectNumberingPlan(input.country, input.countryCallingCode); // By default, countries only have type regexps when it's required for + // distinguishing different countries having the same `countryCallingCode`. + + if (metadata.hasTypes()) { + return getNumberType(input, options, metadata.metadata) !== undefined; + } // If there are no type regexps for this country in metadata then use + // `nationalNumberPattern` as a "better than nothing" replacement. + + + var nationalNumber = options.v2 ? input.nationalNumber : input.phone; + return matchesEntirely(nationalNumber, metadata.nationalNumberPattern()); + } + + /** + * Returns a list of countries that the phone number could potentially belong to. + * @param {string} callingCode — Calling code. + * @param {string} nationalNumber — National (significant) number. + * @param {object} metadata — Metadata. + * @return {string[]} A list of possible countries. + */ + + function getPossibleCountriesForNumber(callingCode, nationalNumber, metadata) { + var _metadata = new Metadata(metadata); + + var possibleCountries = _metadata.getCountryCodesForCallingCode(callingCode); + + if (!possibleCountries) { + return []; + } + + return possibleCountries.filter(function (country) { + return couldNationalNumberBelongToCountry(nationalNumber, country, metadata); + }); + } + + function couldNationalNumberBelongToCountry(nationalNumber, country, metadata) { + var _metadata = new Metadata(metadata); + + _metadata.selectNumberingPlan(country); + + if (_metadata.numberingPlan.possibleLengths().indexOf(nationalNumber.length) >= 0) { + return true; + } + + return false; + } + + // + // E.g. "(999) 111-22-33" -> "999 111 22 33" + // + // For some reason Google's metadata contains ``s with brackets and dashes. + // Meanwhile, there's no single opinion about using punctuation in international phone numbers. + // + // For example, Google's `` for USA is `+1 213-373-4253`. + // And here's a quote from WikiPedia's "North American Numbering Plan" page: + // https://en.wikipedia.org/wiki/North_American_Numbering_Plan + // + // "The country calling code for all countries participating in the NANP is 1. + // In international format, an NANP number should be listed as +1 301 555 01 00, + // where 301 is an area code (Maryland)." + // + // I personally prefer the international format without any punctuation. + // For example, brackets are remnants of the old age, meaning that the + // phone number part in brackets (so called "area code") can be omitted + // if dialing within the same "area". + // And hyphens were clearly introduced for splitting local numbers into memorizable groups. + // For example, remembering "5553535" is difficult but "555-35-35" is much simpler. + // Imagine a man taking a bus from home to work and seeing an ad with a phone number. + // He has a couple of seconds to memorize that number until it passes by. + // If it were spaces instead of hyphens the man wouldn't necessarily get it, + // but with hyphens instead of spaces the grouping is more explicit. + // I personally think that hyphens introduce visual clutter, + // so I prefer replacing them with spaces in international numbers. + // In the modern age all output is done on displays where spaces are clearly distinguishable + // so hyphens can be safely replaced with spaces without losing any legibility. + // + + function applyInternationalSeparatorStyle(formattedNumber) { + return formattedNumber.replace(new RegExp("[".concat(VALID_PUNCTUATION, "]+"), 'g'), ' ').trim(); + } + + // first group is not used in the national pattern (e.g. Argentina) so the $1 + // group does not match correctly. Therefore, we use `\d`, so that the first + // group actually used in the pattern will be matched. + + var FIRST_GROUP_PATTERN = /(\$\d)/; + function formatNationalNumberUsingFormat(number, format, _ref) { + var useInternationalFormat = _ref.useInternationalFormat, + withNationalPrefix = _ref.withNationalPrefix; + _ref.carrierCode; + _ref.metadata; + var formattedNumber = number.replace(new RegExp(format.pattern()), useInternationalFormat ? format.internationalFormat() : // This library doesn't use `domestic_carrier_code_formatting_rule`, + // because that one is only used when formatting phone numbers + // for dialing from a mobile phone, and this is not a dialing library. + // carrierCode && format.domesticCarrierCodeFormattingRule() + // // First, replace the $CC in the formatting rule with the desired carrier code. + // // Then, replace the $FG in the formatting rule with the first group + // // and the carrier code combined in the appropriate way. + // ? format.format().replace(FIRST_GROUP_PATTERN, format.domesticCarrierCodeFormattingRule().replace('$CC', carrierCode)) + // : ( + // withNationalPrefix && format.nationalPrefixFormattingRule() + // ? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule()) + // : format.format() + // ) + withNationalPrefix && format.nationalPrefixFormattingRule() ? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule()) : format.format()); + + if (useInternationalFormat) { + return applyInternationalSeparatorStyle(formattedNumber); + } + + return formattedNumber; + } + + /** + * Pattern that makes it easy to distinguish whether a region has a single + * international dialing prefix or not. If a region has a single international + * prefix (e.g. 011 in USA), it will be represented as a string that contains + * a sequence of ASCII digits, and possibly a tilde, which signals waiting for + * the tone. If there are multiple available international prefixes in a + * region, they will be represented as a regex string that always contains one + * or more characters that are not ASCII digits or a tilde. + */ + + var SINGLE_IDD_PREFIX_REG_EXP = /^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/; // For regions that have multiple IDD prefixes + // a preferred IDD prefix is returned. + + function getIddPrefix(country, callingCode, metadata) { + var countryMetadata = new Metadata(metadata); + countryMetadata.selectNumberingPlan(country, callingCode); + + if (countryMetadata.defaultIDDPrefix()) { + return countryMetadata.defaultIDDPrefix(); + } + + if (SINGLE_IDD_PREFIX_REG_EXP.test(countryMetadata.IDDPrefix())) { + return countryMetadata.IDDPrefix(); + } + } + + /** + * @param {object} - `{ ?number, ?extension }`. + * @return {string} Phone URI (RFC 3966). + */ + + function formatRFC3966(_ref) { + var number = _ref.number, + ext = _ref.ext; + + if (!number) { + return ''; + } + + if (number[0] !== '+') { + throw new Error("\"formatRFC3966()\" expects \"number\" to be in E.164 format."); + } + + return "tel:".concat(number).concat(ext ? ';ext=' + ext : ''); + } + + function _createForOfIteratorHelperLoose$1(o, allowArrayLike) { + var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; + if (it) return (it = it.call(o)).next.bind(it); + + if (Array.isArray(o) || (it = _unsupportedIterableToArray$2(o)) || allowArrayLike && o && typeof o.length === "number") { + if (it) o = it; + var i = 0; + return function () { + if (i >= o.length) return { + done: true + }; + return { + done: false, + value: o[i++] + }; + }; + } + + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function _unsupportedIterableToArray$2(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray$2(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen); + } + + function _arrayLikeToArray$2(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) { + arr2[i] = arr[i]; + } + + return arr2; + } + + function ownKeys$3(object, enumerableOnly) { + var keys = Object.keys(object); + + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function (sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + + return keys; + } + + function _objectSpread$3(target) { + for (var i = 1; i < arguments.length; i++) { + var source = null != arguments[i] ? arguments[i] : {}; + i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) { + _defineProperty$3(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + + return target; + } + + function _defineProperty$3(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; + } // This is a port of Google Android `libphonenumber`'s + var DEFAULT_OPTIONS = { + formatExtension: function formatExtension(formattedNumber, extension, metadata) { + return "".concat(formattedNumber).concat(metadata.ext()).concat(extension); + } + }; + /** + * Formats a phone number. + * + * format(phoneNumberInstance, 'INTERNATIONAL', { ..., v2: true }, metadata) + * format(phoneNumberInstance, 'NATIONAL', { ..., v2: true }, metadata) + * + * format({ phone: '8005553535', country: 'RU' }, 'INTERNATIONAL', { ... }, metadata) + * format({ phone: '8005553535', country: 'RU' }, 'NATIONAL', undefined, metadata) + * + * @param {object|PhoneNumber} input — If `options.v2: true` flag is passed, the `input` should be a `PhoneNumber` instance. Otherwise, it should be an object of shape `{ phone: '...', country: '...' }`. + * @param {string} format + * @param {object} [options] + * @param {object} metadata + * @return {string} + */ + + function formatNumber(input, format, options, metadata) { + // Apply default options. + if (options) { + options = _objectSpread$3(_objectSpread$3({}, DEFAULT_OPTIONS), options); + } else { + options = DEFAULT_OPTIONS; + } + + metadata = new Metadata(metadata); + + if (input.country && input.country !== '001') { + // Validate `input.country`. + if (!metadata.hasCountry(input.country)) { + throw new Error("Unknown country: ".concat(input.country)); + } + + metadata.country(input.country); + } else if (input.countryCallingCode) { + metadata.selectNumberingPlan(input.countryCallingCode); + } else return input.phone || ''; + + var countryCallingCode = metadata.countryCallingCode(); + var nationalNumber = options.v2 ? input.nationalNumber : input.phone; // This variable should have been declared inside `case`s + // but Babel has a bug and it says "duplicate variable declaration". + + var number; + + switch (format) { + case 'NATIONAL': + // Legacy argument support. + // (`{ country: ..., phone: '' }`) + if (!nationalNumber) { + return ''; + } + + number = formatNationalNumber(nationalNumber, input.carrierCode, 'NATIONAL', metadata, options); + return addExtension(number, input.ext, metadata, options.formatExtension); + + case 'INTERNATIONAL': + // Legacy argument support. + // (`{ country: ..., phone: '' }`) + if (!nationalNumber) { + return "+".concat(countryCallingCode); + } + + number = formatNationalNumber(nationalNumber, null, 'INTERNATIONAL', metadata, options); + number = "+".concat(countryCallingCode, " ").concat(number); + return addExtension(number, input.ext, metadata, options.formatExtension); + + case 'E.164': + // `E.164` doesn't define "phone number extensions". + return "+".concat(countryCallingCode).concat(nationalNumber); + + case 'RFC3966': + return formatRFC3966({ + number: "+".concat(countryCallingCode).concat(nationalNumber), + ext: input.ext + }); + // For reference, here's Google's IDD formatter: + // https://github.com/google/libphonenumber/blob/32719cf74e68796788d1ca45abc85dcdc63ba5b9/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L1546 + // Not saying that this IDD formatter replicates it 1:1, but it seems to work. + // Who would even need to format phone numbers in IDD format anyway? + + case 'IDD': + if (!options.fromCountry) { + return; // throw new Error('`fromCountry` option not passed for IDD-prefixed formatting.') + } + + var formattedNumber = formatIDD(nationalNumber, input.carrierCode, countryCallingCode, options.fromCountry, metadata); + return addExtension(formattedNumber, input.ext, metadata, options.formatExtension); + + default: + throw new Error("Unknown \"format\" argument passed to \"formatNumber()\": \"".concat(format, "\"")); + } + } + + function formatNationalNumber(number, carrierCode, formatAs, metadata, options) { + var format = chooseFormatForNumber(metadata.formats(), number); + + if (!format) { + return number; + } + + return formatNationalNumberUsingFormat(number, format, { + useInternationalFormat: formatAs === 'INTERNATIONAL', + withNationalPrefix: format.nationalPrefixIsOptionalWhenFormattingInNationalFormat() && options && options.nationalPrefix === false ? false : true, + carrierCode: carrierCode, + metadata: metadata + }); + } + + function chooseFormatForNumber(availableFormats, nationalNnumber) { + for (var _iterator = _createForOfIteratorHelperLoose$1(availableFormats), _step; !(_step = _iterator()).done;) { + var format = _step.value; // Validate leading digits. + // The test case for "else path" could be found by searching for + // "format.leadingDigitsPatterns().length === 0". + + if (format.leadingDigitsPatterns().length > 0) { + // The last leading_digits_pattern is used here, as it is the most detailed + var lastLeadingDigitsPattern = format.leadingDigitsPatterns()[format.leadingDigitsPatterns().length - 1]; // If leading digits don't match then move on to the next phone number format + + if (nationalNnumber.search(lastLeadingDigitsPattern) !== 0) { + continue; + } + } // Check that the national number matches the phone number format regular expression + + + if (matchesEntirely(nationalNnumber, format.pattern())) { + return format; + } + } + } + + function addExtension(formattedNumber, ext, metadata, formatExtension) { + return ext ? formatExtension(formattedNumber, ext, metadata) : formattedNumber; + } + + function formatIDD(nationalNumber, carrierCode, countryCallingCode, fromCountry, metadata) { + var fromCountryCallingCode = getCountryCallingCode(fromCountry, metadata.metadata); // When calling within the same country calling code. + + if (fromCountryCallingCode === countryCallingCode) { + var formattedNumber = formatNationalNumber(nationalNumber, carrierCode, 'NATIONAL', metadata); // For NANPA regions, return the national format for these regions + // but prefix it with the country calling code. + + if (countryCallingCode === '1') { + return countryCallingCode + ' ' + formattedNumber; + } // If regions share a country calling code, the country calling code need + // not be dialled. This also applies when dialling within a region, so this + // if clause covers both these cases. Technically this is the case for + // dialling from La Reunion to other overseas departments of France (French + // Guiana, Martinique, Guadeloupe), but not vice versa - so we don't cover + // this edge case for now and for those cases return the version including + // country calling code. Details here: + // http://www.petitfute.com/voyage/225-info-pratiques-reunion + // + + + return formattedNumber; + } + + var iddPrefix = getIddPrefix(fromCountry, undefined, metadata.metadata); + + if (iddPrefix) { + return "".concat(iddPrefix, " ").concat(countryCallingCode, " ").concat(formatNationalNumber(nationalNumber, null, 'INTERNATIONAL', metadata)); + } + } + + function ownKeys$2(object, enumerableOnly) { + var keys = Object.keys(object); + + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function (sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + + return keys; + } + + function _objectSpread$2(target) { + for (var i = 1; i < arguments.length; i++) { + var source = null != arguments[i] ? arguments[i] : {}; + i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { + _defineProperty$2(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + + return target; + } + + function _defineProperty$2(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; + } + + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a 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); + } + } + + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + + var PhoneNumber = /*#__PURE__*/function () { + /** + * @param {string} countryOrCountryCallingCode + * @param {string} nationalNumber + * @param {object} metadata — Metadata JSON + * @return {PhoneNumber} + */ + function PhoneNumber(countryOrCountryCallingCode, nationalNumber, metadata) { + _classCallCheck(this, PhoneNumber); + + if (!countryOrCountryCallingCode) { + throw new TypeError('`country` or `countryCallingCode` not passed'); + } + + if (!nationalNumber) { + throw new TypeError('`nationalNumber` not passed'); + } + + if (!metadata) { + throw new TypeError('`metadata` not passed'); + } + + var _getCountryAndCountry = getCountryAndCountryCallingCode(countryOrCountryCallingCode, metadata), + country = _getCountryAndCountry.country, + countryCallingCode = _getCountryAndCountry.countryCallingCode; + + this.country = country; + this.countryCallingCode = countryCallingCode; + this.nationalNumber = nationalNumber; + this.number = '+' + this.countryCallingCode + this.nationalNumber; + this.metadata = metadata; + } + + _createClass(PhoneNumber, [{ + key: "setExt", + value: function setExt(ext) { + this.ext = ext; + } + }, { + key: "getPossibleCountries", + value: function getPossibleCountries() { + if (this.country) { + return [this.country]; + } + + return getPossibleCountriesForNumber(this.countryCallingCode, this.nationalNumber, this.metadata); + } + }, { + key: "isPossible", + value: function isPossible() { + return isPossiblePhoneNumber(this, { + v2: true + }, this.metadata); + } + }, { + key: "isValid", + value: function isValid() { + return isValidNumber(this, { + v2: true + }, this.metadata); + } + }, { + key: "isNonGeographic", + value: function isNonGeographic() { + var metadata = new Metadata(this.metadata); + return metadata.isNonGeographicCallingCode(this.countryCallingCode); + } + }, { + key: "isEqual", + value: function isEqual(phoneNumber) { + return this.number === phoneNumber.number && this.ext === phoneNumber.ext; + } // This function was originally meant to be an equivalent for `validatePhoneNumberLength()`, + // but later it was found out that it doesn't include the possible `TOO_SHORT` result + // returned from `parsePhoneNumberWithError()` in the original `validatePhoneNumberLength()`, + // so eventually I simply commented out this method from the `PhoneNumber` class + // and just left the `validatePhoneNumberLength()` function, even though that one would require + // and additional step to also validate the actual country / calling code of the phone number. + // validateLength() { + // const metadata = new Metadata(this.metadata) + // metadata.selectNumberingPlan(this.countryCallingCode) + // const result = checkNumberLength(this.nationalNumber, metadata) + // if (result !== 'IS_POSSIBLE') { + // return result + // } + // } + + }, { + key: "getType", + value: function getType() { + return getNumberType(this, { + v2: true + }, this.metadata); + } + }, { + key: "format", + value: function format(_format, options) { + return formatNumber(this, _format, options ? _objectSpread$2(_objectSpread$2({}, options), {}, { + v2: true + }) : { + v2: true + }, this.metadata); + } + }, { + key: "formatNational", + value: function formatNational(options) { + return this.format('NATIONAL', options); + } + }, { + key: "formatInternational", + value: function formatInternational(options) { + return this.format('INTERNATIONAL', options); + } + }, { + key: "getURI", + value: function getURI(options) { + return this.format('RFC3966', options); + } + }]); + + return PhoneNumber; + }(); + + var isCountryCode = function isCountryCode(value) { + return /^[A-Z]{2}$/.test(value); + }; + + function getCountryAndCountryCallingCode(countryOrCountryCallingCode, metadataJson) { + var country; + var countryCallingCode; + var metadata = new Metadata(metadataJson); // If country code is passed then derive `countryCallingCode` from it. + // Also store the country code as `.country`. + + if (isCountryCode(countryOrCountryCallingCode)) { + country = countryOrCountryCallingCode; + metadata.selectNumberingPlan(country); + countryCallingCode = metadata.countryCallingCode(); + } else { + countryCallingCode = countryOrCountryCallingCode; + } + + return { + country: country, + countryCallingCode: countryCallingCode + }; + } + + var CAPTURING_DIGIT_PATTERN = new RegExp('([' + VALID_DIGITS + '])'); + function stripIddPrefix(number, country, callingCode, metadata) { + if (!country) { + return; + } // Check if the number is IDD-prefixed. + + + var countryMetadata = new Metadata(metadata); + countryMetadata.selectNumberingPlan(country, callingCode); + var IDDPrefixPattern = new RegExp(countryMetadata.IDDPrefix()); + + if (number.search(IDDPrefixPattern) !== 0) { + return; + } // Strip IDD prefix. + + + number = number.slice(number.match(IDDPrefixPattern)[0].length); // If there're any digits after an IDD prefix, + // then those digits are a country calling code. + // Since no country code starts with a `0`, + // the code below validates that the next digit (if present) is not `0`. + + var matchedGroups = number.match(CAPTURING_DIGIT_PATTERN); + + if (matchedGroups && matchedGroups[1] != null && matchedGroups[1].length > 0) { + if (matchedGroups[1] === '0') { + return; + } + } + + return number; + } + + /** + * Strips any national prefix (such as 0, 1) present in a + * (possibly incomplete) number provided. + * "Carrier codes" are only used in Colombia and Brazil, + * and only when dialing within those countries from a mobile phone to a fixed line number. + * Sometimes it won't actually strip national prefix + * and will instead prepend some digits to the `number`: + * for example, when number `2345678` is passed with `VI` country selected, + * it will return `{ number: "3402345678" }`, because `340` area code is prepended. + * @param {string} number — National number digits. + * @param {object} metadata — Metadata with country selected. + * @return {object} `{ nationalNumber: string, nationalPrefix: string? carrierCode: string? }`. Even if a national prefix was extracted, it's not necessarily present in the returned object, so don't rely on its presence in the returned object in order to find out whether a national prefix has been extracted or not. + */ + function extractNationalNumberFromPossiblyIncompleteNumber(number, metadata) { + if (number && metadata.numberingPlan.nationalPrefixForParsing()) { + // See METADATA.md for the description of + // `national_prefix_for_parsing` and `national_prefix_transform_rule`. + // Attempt to parse the first digits as a national prefix. + var prefixPattern = new RegExp('^(?:' + metadata.numberingPlan.nationalPrefixForParsing() + ')'); + var prefixMatch = prefixPattern.exec(number); + + if (prefixMatch) { + var nationalNumber; + var carrierCode; // https://gitlab.com/catamphetamine/libphonenumber-js/-/blob/master/METADATA.md#national_prefix_for_parsing--national_prefix_transform_rule + // If a `national_prefix_for_parsing` has any "capturing groups" + // then it means that the national (significant) number is equal to + // those "capturing groups" transformed via `national_prefix_transform_rule`, + // and nothing could be said about the actual national prefix: + // what is it and was it even there. + // If a `national_prefix_for_parsing` doesn't have any "capturing groups", + // then everything it matches is a national prefix. + // To determine whether `national_prefix_for_parsing` matched any + // "capturing groups", the value of the result of calling `.exec()` + // is looked at, and if it has non-undefined values where there're + // "capturing groups" in the regular expression, then it means + // that "capturing groups" have been matched. + // It's not possible to tell whether there'll be any "capturing gropus" + // before the matching process, because a `national_prefix_for_parsing` + // could exhibit both behaviors. + + var capturedGroupsCount = prefixMatch.length - 1; + var hasCapturedGroups = capturedGroupsCount > 0 && prefixMatch[capturedGroupsCount]; + + if (metadata.nationalPrefixTransformRule() && hasCapturedGroups) { + nationalNumber = number.replace(prefixPattern, metadata.nationalPrefixTransformRule()); // If there's more than one captured group, + // then carrier code is the second one. + + if (capturedGroupsCount > 1) { + carrierCode = prefixMatch[1]; + } + } // If there're no "capturing groups", + // or if there're "capturing groups" but no + // `national_prefix_transform_rule`, + // then just strip the national prefix from the number, + // and possibly a carrier code. + // Seems like there could be more. + else { + // `prefixBeforeNationalNumber` is the whole substring matched by + // the `national_prefix_for_parsing` regular expression. + // There seem to be no guarantees that it's just a national prefix. + // For example, if there's a carrier code, it's gonna be a + // part of `prefixBeforeNationalNumber` too. + var prefixBeforeNationalNumber = prefixMatch[0]; + nationalNumber = number.slice(prefixBeforeNationalNumber.length); // If there's at least one captured group, + // then carrier code is the first one. + + if (hasCapturedGroups) { + carrierCode = prefixMatch[1]; + } + } // Tries to guess whether a national prefix was present in the input. + // This is not something copy-pasted from Google's library: + // they don't seem to have an equivalent for that. + // So this isn't an "officially approved" way of doing something like that. + // But since there seems no other existing method, this library uses it. + + + var nationalPrefix; + + if (hasCapturedGroups) { + var possiblePositionOfTheFirstCapturedGroup = number.indexOf(prefixMatch[1]); + var possibleNationalPrefix = number.slice(0, possiblePositionOfTheFirstCapturedGroup); // Example: an Argentinian (AR) phone number `0111523456789`. + // `prefixMatch[0]` is `01115`, and `$1` is `11`, + // and the rest of the phone number is `23456789`. + // The national number is transformed via `9$1` to `91123456789`. + // National prefix `0` is detected being present at the start. + // if (possibleNationalPrefix.indexOf(metadata.numberingPlan.nationalPrefix()) === 0) { + + if (possibleNationalPrefix === metadata.numberingPlan.nationalPrefix()) { + nationalPrefix = metadata.numberingPlan.nationalPrefix(); + } + } else { + nationalPrefix = prefixMatch[0]; + } + + return { + nationalNumber: nationalNumber, + nationalPrefix: nationalPrefix, + carrierCode: carrierCode + }; + } + } + + return { + nationalNumber: number + }; + } + + /** + * Strips national prefix and carrier code from a complete phone number. + * The difference from the non-"FromCompleteNumber" function is that + * it won't extract national prefix if the resultant number is too short + * to be a complete number for the selected phone numbering plan. + * @param {string} number — Complete phone number digits. + * @param {Metadata} metadata — Metadata with a phone numbering plan selected. + * @return {object} `{ nationalNumber: string, carrierCode: string? }`. + */ + + function extractNationalNumber(number, metadata) { + // Parsing national prefixes and carrier codes + // is only required for local phone numbers + // but some people don't understand that + // and sometimes write international phone numbers + // with national prefixes (or maybe even carrier codes). + // http://ucken.blogspot.ru/2016/03/trunk-prefixes-in-skype4b.html + // Google's original library forgives such mistakes + // and so does this library, because it has been requested: + // https://github.com/catamphetamine/libphonenumber-js/issues/127 + var _extractNationalNumbe = extractNationalNumberFromPossiblyIncompleteNumber(number, metadata), + carrierCode = _extractNationalNumbe.carrierCode, + nationalNumber = _extractNationalNumbe.nationalNumber; + + if (nationalNumber !== number) { + if (!shouldHaveExtractedNationalPrefix(number, nationalNumber, metadata)) { + // Don't strip the national prefix. + return { + nationalNumber: number + }; + } // Check the national (significant) number length after extracting national prefix and carrier code. + // Legacy generated metadata (before `1.0.18`) didn't support the "possible lengths" feature. + + + if (metadata.possibleLengths()) { + // The number remaining after stripping the national prefix and carrier code + // should be long enough to have a possible length for the country. + // Otherwise, don't strip the national prefix and carrier code, + // since the original number could be a valid number. + // This check has been copy-pasted "as is" from Google's original library: + // https://github.com/google/libphonenumber/blob/876268eb1ad6cdc1b7b5bef17fc5e43052702d57/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L3236-L3250 + // It doesn't check for the "possibility" of the original `number`. + // I guess it's fine not checking that one. It works as is anyway. + if (!isPossibleIncompleteNationalNumber(nationalNumber, metadata)) { + // Don't strip the national prefix. + return { + nationalNumber: number + }; + } + } + } + + return { + nationalNumber: nationalNumber, + carrierCode: carrierCode + }; + } // In some countries, the same digit could be a national prefix + // or a leading digit of a valid phone number. + // For example, in Russia, national prefix is `8`, + // and also `800 555 35 35` is a valid number + // in which `8` is not a national prefix, but the first digit + // of a national (significant) number. + // Same's with Belarus: + // `82004910060` is a valid national (significant) number, + // but `2004910060` is not. + // To support such cases (to prevent the code from always stripping + // national prefix), a condition is imposed: a national prefix + // is not extracted when the original number is "viable" and the + // resultant number is not, a "viable" national number being the one + // that matches `national_number_pattern`. + + function shouldHaveExtractedNationalPrefix(nationalNumberBefore, nationalNumberAfter, metadata) { + // The equivalent in Google's code is: + // https://github.com/google/libphonenumber/blob/e326fa1fc4283bb05eb35cb3c15c18f98a31af33/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L2969-L3004 + if (matchesEntirely(nationalNumberBefore, metadata.nationalNumberPattern()) && !matchesEntirely(nationalNumberAfter, metadata.nationalNumberPattern())) { + return false; + } // This "is possible" national number (length) check has been commented out + // because it's superceded by the (effectively) same check done in the + // `extractNationalNumber()` function after it calls `shouldHaveExtractedNationalPrefix()`. + // In other words, why run the same check twice if it could only be run once. + // // Check the national (significant) number length after extracting national prefix and carrier code. + // // Fixes a minor "weird behavior" bug: https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/57 + // // (Legacy generated metadata (before `1.0.18`) didn't support the "possible lengths" feature). + // if (metadata.possibleLengths()) { + // if (isPossibleIncompleteNationalNumber(nationalNumberBefore, metadata) && + // !isPossibleIncompleteNationalNumber(nationalNumberAfter, metadata)) { + // return false + // } + // } + + + return true; + } + + function isPossibleIncompleteNationalNumber(nationalNumber, metadata) { + switch (checkNumberLength(nationalNumber, metadata)) { + case 'TOO_SHORT': + case 'INVALID_LENGTH': + // This library ignores "local-only" phone numbers (for simplicity). + // See the readme for more info on what are "local-only" phone numbers. + // case 'IS_POSSIBLE_LOCAL_ONLY': + return false; + + default: + return true; + } + } + + /** + * Sometimes some people incorrectly input international phone numbers + * without the leading `+`. This function corrects such input. + * @param {string} number — Phone number digits. + * @param {string?} country + * @param {string?} callingCode + * @param {object} metadata + * @return {object} `{ countryCallingCode: string?, number: string }`. + */ + + function extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, callingCode, metadata) { + var countryCallingCode = country ? getCountryCallingCode(country, metadata) : callingCode; + + if (number.indexOf(countryCallingCode) === 0) { + metadata = new Metadata(metadata); + metadata.selectNumberingPlan(country, callingCode); + var possibleShorterNumber = number.slice(countryCallingCode.length); + + var _extractNationalNumbe = extractNationalNumber(possibleShorterNumber, metadata), + possibleShorterNationalNumber = _extractNationalNumbe.nationalNumber; + + var _extractNationalNumbe2 = extractNationalNumber(number, metadata), + nationalNumber = _extractNationalNumbe2.nationalNumber; // If the number was not valid before but is valid now, + // or if it was too long before, we consider the number + // with the country calling code stripped to be a better result + // and keep that instead. + // For example, in Germany (+49), `49` is a valid area code, + // so if a number starts with `49`, it could be both a valid + // national German number or an international number without + // a leading `+`. + + + if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern()) && matchesEntirely(possibleShorterNationalNumber, metadata.nationalNumberPattern()) || checkNumberLength(nationalNumber, metadata) === 'TOO_LONG') { + return { + countryCallingCode: countryCallingCode, + number: possibleShorterNumber + }; + } + } - function getDefaultExportFromCjs (x) { - return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; + return { + number: number + }; } - function commonjsRequire (path) { - throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); + /** + * Converts a phone number digits (possibly with a `+`) + * into a calling code and the rest phone number digits. + * The "rest phone number digits" could include + * a national prefix, carrier code, and national + * (significant) number. + * @param {string} number — Phone number digits (possibly with a `+`). + * @param {string} [country] — Default country. + * @param {string} [callingCode] — Default calling code (some phone numbering plans are non-geographic). + * @param {object} metadata + * @return {object} `{ countryCallingCodeSource: string?, countryCallingCode: string?, number: string }` + * @example + * // Returns `{ countryCallingCode: "1", number: "2133734253" }`. + * extractCountryCallingCode('2133734253', 'US', null, metadata) + * extractCountryCallingCode('2133734253', null, '1', metadata) + * extractCountryCallingCode('+12133734253', null, null, metadata) + * extractCountryCallingCode('+12133734253', 'RU', null, metadata) + */ + + function extractCountryCallingCode(number, country, callingCode, metadata) { + if (!number) { + return {}; + } + + var isNumberWithIddPrefix; // If this is not an international phone number, + // then either extract an "IDD" prefix, or extract a + // country calling code from a number by autocorrecting it + // by prepending a leading `+` in cases when it starts + // with the country calling code. + // https://wikitravel.org/en/International_dialling_prefix + // https://github.com/catamphetamine/libphonenumber-js/issues/376 + + if (number[0] !== '+') { + // Convert an "out-of-country" dialing phone number + // to a proper international phone number. + var numberWithoutIDD = stripIddPrefix(number, country, callingCode, metadata); // If an IDD prefix was stripped then + // convert the number to international one + // for subsequent parsing. + + if (numberWithoutIDD && numberWithoutIDD !== number) { + isNumberWithIddPrefix = true; + number = '+' + numberWithoutIDD; + } else { + // Check to see if the number starts with the country calling code + // for the default country. If so, we remove the country calling code, + // and do some checks on the validity of the number before and after. + // https://github.com/catamphetamine/libphonenumber-js/issues/376 + if (country || callingCode) { + var _extractCountryCallin = extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, callingCode, metadata), + countryCallingCode = _extractCountryCallin.countryCallingCode, + shorterNumber = _extractCountryCallin.number; + + if (countryCallingCode) { + return { + countryCallingCodeSource: 'FROM_NUMBER_WITHOUT_PLUS_SIGN', + countryCallingCode: countryCallingCode, + number: shorterNumber + }; + } + } + + return { + // No need to set it to `UNSPECIFIED`. It can be just `undefined`. + // countryCallingCodeSource: 'UNSPECIFIED', + number: number + }; + } + } // Fast abortion: country codes do not begin with a '0' + + + if (number[1] === '0') { + return {}; + } + + metadata = new Metadata(metadata); // The thing with country phone codes + // is that they are orthogonal to each other + // i.e. there's no such country phone code A + // for which country phone code B exists + // where B starts with A. + // Therefore, while scanning digits, + // if a valid country code is found, + // that means that it is the country code. + // + + var i = 2; + + while (i - 1 <= MAX_LENGTH_COUNTRY_CODE && i <= number.length) { + var _countryCallingCode = number.slice(1, i); + + if (metadata.hasCallingCode(_countryCallingCode)) { + metadata.selectNumberingPlan(_countryCallingCode); + return { + countryCallingCodeSource: isNumberWithIddPrefix ? 'FROM_NUMBER_WITH_IDD' : 'FROM_NUMBER_WITH_PLUS_SIGN', + countryCallingCode: _countryCallingCode, + number: number.slice(i) + }; + } + + i++; + } + + return {}; + } // The possible values for the returned `countryCallingCodeSource` are: + // + // Copy-pasted from: + // https://github.com/google/libphonenumber/blob/master/resources/phonenumber.proto + // + // // The source from which the country_code is derived. This is not set in the + // // general parsing method, but in the method that parses and keeps raw_input. + // // New fields could be added upon request. + // enum CountryCodeSource { + // // Default value returned if this is not set, because the phone number was + // // created using parse, not parseAndKeepRawInput. hasCountryCodeSource will + // // return false if this is the case. + // UNSPECIFIED = 0; + // + // // The country_code is derived based on a phone number with a leading "+", + // // e.g. the French number "+33 1 42 68 53 00". + // FROM_NUMBER_WITH_PLUS_SIGN = 1; + // + // // The country_code is derived based on a phone number with a leading IDD, + // // e.g. the French number "011 33 1 42 68 53 00", as it is dialled from US. + // FROM_NUMBER_WITH_IDD = 5; + // + // // The country_code is derived based on a phone number without a leading + // // "+", e.g. the French number "33 1 42 68 53 00" when defaultCountry is + // // supplied as France. + // FROM_NUMBER_WITHOUT_PLUS_SIGN = 10; + // + // // The country_code is derived NOT based on the phone number itself, but + // // from the defaultCountry parameter provided in the parsing function by the + // // clients. This happens mostly for numbers written in the national format + // // (without country code). For example, this would be set when parsing the + // // French number "01 42 68 53 00", when defaultCountry is supplied as + // // France. + // FROM_DEFAULT_COUNTRY = 20; + // } + + function _createForOfIteratorHelperLoose(o, allowArrayLike) { + var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; + if (it) return (it = it.call(o)).next.bind(it); + + if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { + if (it) o = it; + var i = 0; + return function () { + if (i >= o.length) return { + done: true + }; + return { + done: false, + value: o[i++] + }; + }; + } + + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + function _unsupportedIterableToArray$1(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); + } + + function _arrayLikeToArray$1(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) { + arr2[i] = arr[i]; + } + + return arr2; + } + function getCountryByNationalNumber(possibleCountries, nationalPhoneNumber, metadata) { + // Re-create `metadata` because it will be selecting a `country`. + metadata = new Metadata(metadata); + + for (var _iterator = _createForOfIteratorHelperLoose(possibleCountries), _step; !(_step = _iterator()).done;) { + var country = _step.value; + metadata.country(country); // "Leading digits" patterns are only defined for about 20% of all countries. + // By definition, matching "leading digits" is a sufficient but not a necessary + // condition for a phone number to belong to a country. + // The point of "leading digits" check is that it's the fastest one to get a match. + // https://gitlab.com/catamphetamine/libphonenumber-js/blob/master/METADATA.md#leading_digits + + if (metadata.leadingDigits()) { + if (nationalPhoneNumber && nationalPhoneNumber.search(metadata.leadingDigits()) === 0) { + return country; + } + } // Else perform full validation with all of those + // fixed-line/mobile/etc regular expressions. + else if (getNumberType({ + phone: nationalPhoneNumber, + country: country + }, undefined, metadata.metadata)) { + return country; + } + } + } + + var USE_NON_GEOGRAPHIC_COUNTRY_CODE = false; + function getCountryByCallingCode(callingCode, nationalPhoneNumber, metadata) { + /* istanbul ignore if */ + if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) { + if (metadata.isNonGeographicCallingCode(callingCode)) { + return '001'; + } + } + + var possibleCountries = metadata.getCountryCodesForCallingCode(callingCode); + + if (!possibleCountries) { + return; + } // If there's just one country corresponding to the country code, + // then just return it, without further phone number digits validation. + + + if (possibleCountries.length === 1) { + return possibleCountries[0]; + } + + return getCountryByNationalNumber(possibleCountries, nationalPhoneNumber, metadata.metadata); + } + + // When phone numbers are written in `RFC3966` format — `"tel:+12133734253"` — + var PLUS_SIGN = '+'; + var RFC3966_VISUAL_SEPARATOR_ = '[\\-\\.\\(\\)]?'; + var RFC3966_PHONE_DIGIT_ = '(' + '[' + VALID_DIGITS + ']' + '|' + RFC3966_VISUAL_SEPARATOR_ + ')'; + var RFC3966_GLOBAL_NUMBER_DIGITS_ = '^' + '\\' + PLUS_SIGN + RFC3966_PHONE_DIGIT_ + '*' + '[' + VALID_DIGITS + ']' + RFC3966_PHONE_DIGIT_ + '*' + '$'; + /** + * Regular expression of valid global-number-digits for the phone-context + * parameter, following the syntax defined in RFC3966. + */ + + var RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_ = new RegExp(RFC3966_GLOBAL_NUMBER_DIGITS_, 'g'); // In this port of Google's library, we don't accept alpha characters in phone numbers. + // const ALPHANUM_ = VALID_ALPHA_ + VALID_DIGITS + + var ALPHANUM_ = VALID_DIGITS; + var RFC3966_DOMAINLABEL_ = '[' + ALPHANUM_ + ']+((\\-)*[' + ALPHANUM_ + '])*'; + var VALID_ALPHA_ = 'a-zA-Z'; + var RFC3966_TOPLABEL_ = '[' + VALID_ALPHA_ + ']+((\\-)*[' + ALPHANUM_ + '])*'; + var RFC3966_DOMAINNAME_ = '^(' + RFC3966_DOMAINLABEL_ + '\\.)*' + RFC3966_TOPLABEL_ + '\\.?$'; + /** + * Regular expression of valid domainname for the phone-context parameter, + * following the syntax defined in RFC3966. + */ + + var RFC3966_DOMAINNAME_PATTERN_ = new RegExp(RFC3966_DOMAINNAME_, 'g'); + var RFC3966_PREFIX_ = 'tel:'; + var RFC3966_PHONE_CONTEXT_ = ';phone-context='; + var RFC3966_ISDN_SUBADDRESS_ = ';isub='; + /** + * Extracts the value of the phone-context parameter of `numberToExtractFrom`, + * following the syntax defined in RFC3966. + * + * @param {string} numberToExtractFrom + * @return {string|null} the extracted string (possibly empty), or `null` if no phone-context parameter is found. + */ + + function extractPhoneContext(numberToExtractFrom) { + var indexOfPhoneContext = numberToExtractFrom.indexOf(RFC3966_PHONE_CONTEXT_); // If no phone-context parameter is present + + if (indexOfPhoneContext < 0) { + return null; + } + + var phoneContextStart = indexOfPhoneContext + RFC3966_PHONE_CONTEXT_.length; // If phone-context parameter is empty + + if (phoneContextStart >= numberToExtractFrom.length) { + return ''; + } + + var phoneContextEnd = numberToExtractFrom.indexOf(';', phoneContextStart); // If phone-context is not the last parameter + + if (phoneContextEnd >= 0) { + return numberToExtractFrom.substring(phoneContextStart, phoneContextEnd); + } else { + return numberToExtractFrom.substring(phoneContextStart); + } + } + /** + * Returns whether the value of phoneContext follows the syntax defined in RFC3966. + * + * @param {string|null} phoneContext + * @return {boolean} + */ + + function isPhoneContextValid(phoneContext) { + if (phoneContext === null) { + return true; + } + + if (phoneContext.length === 0) { + return false; + } // Does phone-context value match pattern of global-number-digits or domainname. + + + return RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_.test(phoneContext) || RFC3966_DOMAINNAME_PATTERN_.test(phoneContext); + } + + /** + * @param {string} numberToParse + * @param {string} nationalNumber + * @return {} + */ + + function extractFormattedPhoneNumberFromPossibleRfc3966NumberUri(numberToParse, _ref) { + var extractFormattedPhoneNumber = _ref.extractFormattedPhoneNumber; + var phoneContext = extractPhoneContext(numberToParse); + + if (!isPhoneContextValid(phoneContext)) { + throw new ParseError('NOT_A_NUMBER'); + } + + var phoneNumberString; + + if (phoneContext === null) { + // Extract a possible number from the string passed in. + // (this strips leading characters that could not be the start of a phone number) + phoneNumberString = extractFormattedPhoneNumber(numberToParse) || ''; + } else { + phoneNumberString = ''; // If the phone context contains a phone number prefix, we need to capture + // it, whereas domains will be ignored. + + if (phoneContext.charAt(0) === PLUS_SIGN) { + phoneNumberString += phoneContext; + } // Now append everything between the "tel:" prefix and the phone-context. + // This should include the national number, an optional extension or + // isdn-subaddress component. Note we also handle the case when "tel:" is + // missing, as we have seen in some of the phone number inputs. + // In that case, we append everything from the beginning. + + + var indexOfRfc3966Prefix = numberToParse.indexOf(RFC3966_PREFIX_); + var indexOfNationalNumber; // RFC 3966 "tel:" prefix is preset at this stage because + // `isPhoneContextValid()` requires it to be present. + + /* istanbul ignore else */ + + if (indexOfRfc3966Prefix >= 0) { + indexOfNationalNumber = indexOfRfc3966Prefix + RFC3966_PREFIX_.length; + } else { + indexOfNationalNumber = 0; + } + + var indexOfPhoneContext = numberToParse.indexOf(RFC3966_PHONE_CONTEXT_); + phoneNumberString += numberToParse.substring(indexOfNationalNumber, indexOfPhoneContext); + } // Delete the isdn-subaddress and everything after it if it is present. + // Note extension won't appear at the same time with isdn-subaddress + // according to paragraph 5.3 of the RFC3966 spec. + + + var indexOfIsdn = phoneNumberString.indexOf(RFC3966_ISDN_SUBADDRESS_); + + if (indexOfIsdn > 0) { + phoneNumberString = phoneNumberString.substring(0, indexOfIsdn); + } // If both phone context and isdn-subaddress are absent but other + // parameters are present, the parameters are left in nationalNumber. + // This is because we are concerned about deleting content from a potential + // number string when there is no strong evidence that the number is + // actually written in RFC3966. + + + if (phoneNumberString !== '') { + return phoneNumberString; + } + } + + // This is a port of Google Android `libphonenumber`'s + // This prevents malicious input from consuming CPU. + + var MAX_INPUT_STRING_LENGTH = 250; // This consists of the plus symbol, digits, and arabic-indic digits. + + var PHONE_NUMBER_START_PATTERN = new RegExp('[' + PLUS_CHARS + VALID_DIGITS + ']'); // Regular expression of trailing characters that we want to remove. + // A trailing `#` is sometimes used when writing phone numbers with extensions in US. + // Example: "+1 (645) 123 1234-910#" number has extension "910". + + var AFTER_PHONE_NUMBER_END_PATTERN = new RegExp('[^' + VALID_DIGITS + '#' + ']+$'); + // + // ```js + // parse('8 (800) 555-35-35', 'RU') + // parse('8 (800) 555-35-35', 'RU', metadata) + // parse('8 (800) 555-35-35', { country: { default: 'RU' } }) + // parse('8 (800) 555-35-35', { country: { default: 'RU' } }, metadata) + // parse('+7 800 555 35 35') + // parse('+7 800 555 35 35', metadata) + // ``` + // + + /** + * Parses a phone number. + * + * parse('123456789', { defaultCountry: 'RU', v2: true }, metadata) + * parse('123456789', { defaultCountry: 'RU' }, metadata) + * parse('123456789', undefined, metadata) + * + * @param {string} input + * @param {object} [options] + * @param {object} metadata + * @return {object|PhoneNumber?} If `options.v2: true` flag is passed, it returns a `PhoneNumber?` instance. Otherwise, returns an object of shape `{ phone: '...', country: '...' }` (or just `{}` if no phone number was parsed). + */ + + function parse(text, options, metadata) { + // If assigning the `{}` default value is moved to the arguments above, + // code coverage would decrease for some weird reason. + options = options || {}; + metadata = new Metadata(metadata); // Validate `defaultCountry`. + + if (options.defaultCountry && !metadata.hasCountry(options.defaultCountry)) { + if (options.v2) { + throw new ParseError('INVALID_COUNTRY'); + } + + throw new Error("Unknown country: ".concat(options.defaultCountry)); + } // Parse the phone number. + + + var _parseInput = parseInput(text, options.v2, options.extract), + formattedPhoneNumber = _parseInput.number, + ext = _parseInput.ext, + error = _parseInput.error; // If the phone number is not viable then return nothing. + + + if (!formattedPhoneNumber) { + if (options.v2) { + if (error === 'TOO_SHORT') { + throw new ParseError('TOO_SHORT'); + } + + throw new ParseError('NOT_A_NUMBER'); + } + + return {}; + } + + var _parsePhoneNumber = parsePhoneNumber(formattedPhoneNumber, options.defaultCountry, options.defaultCallingCode, metadata), + country = _parsePhoneNumber.country, + nationalNumber = _parsePhoneNumber.nationalNumber, + countryCallingCode = _parsePhoneNumber.countryCallingCode, + countryCallingCodeSource = _parsePhoneNumber.countryCallingCodeSource, + carrierCode = _parsePhoneNumber.carrierCode; + + if (!metadata.hasSelectedNumberingPlan()) { + if (options.v2) { + throw new ParseError('INVALID_COUNTRY'); + } + + return {}; + } // Validate national (significant) number length. + + + if (!nationalNumber || nationalNumber.length < MIN_LENGTH_FOR_NSN) { + // Won't throw here because the regexp already demands length > 1. + + /* istanbul ignore if */ + if (options.v2) { + throw new ParseError('TOO_SHORT'); + } // Google's demo just throws an error in this case. + + + return {}; + } // Validate national (significant) number length. + // + // A sidenote: + // + // They say that sometimes national (significant) numbers + // can be longer than `MAX_LENGTH_FOR_NSN` (e.g. in Germany). + // https://github.com/googlei18n/libphonenumber/blob/7e1748645552da39c4e1ba731e47969d97bdb539/resources/phonenumber.proto#L36 + // Such numbers will just be discarded. + // + + + if (nationalNumber.length > MAX_LENGTH_FOR_NSN) { + if (options.v2) { + throw new ParseError('TOO_LONG'); + } // Google's demo just throws an error in this case. + + + return {}; + } + + if (options.v2) { + var phoneNumber = new PhoneNumber(countryCallingCode, nationalNumber, metadata.metadata); + + if (country) { + phoneNumber.country = country; + } + + if (carrierCode) { + phoneNumber.carrierCode = carrierCode; + } + + if (ext) { + phoneNumber.ext = ext; + } + + phoneNumber.__countryCallingCodeSource = countryCallingCodeSource; + return phoneNumber; + } // Check if national phone number pattern matches the number. + // National number pattern is different for each country, + // even for those ones which are part of the "NANPA" group. + + + var valid = (options.extended ? metadata.hasSelectedNumberingPlan() : country) ? matchesEntirely(nationalNumber, metadata.nationalNumberPattern()) : false; + + if (!options.extended) { + return valid ? result(country, nationalNumber, ext) : {}; + } // isInternational: countryCallingCode !== undefined + + + return { + country: country, + countryCallingCode: countryCallingCode, + carrierCode: carrierCode, + valid: valid, + possible: valid ? true : options.extended === true && metadata.possibleLengths() && isPossibleNumber(nationalNumber, metadata) ? true : false, + phone: nationalNumber, + ext: ext + }; + } + /** + * Extracts a formatted phone number from text. + * Doesn't guarantee that the extracted phone number + * is a valid phone number (for example, doesn't validate its length). + * @param {string} text + * @param {boolean} [extract] — If `false`, then will parse the entire `text` as a phone number. + * @param {boolean} [throwOnError] — By default, it won't throw if the text is too long. + * @return {string} + * @example + * // Returns "(213) 373-4253". + * extractFormattedPhoneNumber("Call (213) 373-4253 for assistance.") + */ + + function _extractFormattedPhoneNumber(text, extract, throwOnError) { + if (!text) { + return; + } + + if (text.length > MAX_INPUT_STRING_LENGTH) { + if (throwOnError) { + throw new ParseError('TOO_LONG'); + } + + return; + } + + if (extract === false) { + return text; + } // Attempt to extract a possible number from the string passed in + + + var startsAt = text.search(PHONE_NUMBER_START_PATTERN); + + if (startsAt < 0) { + return; + } + + return text // Trim everything to the left of the phone number + .slice(startsAt) // Remove trailing non-numerical characters + .replace(AFTER_PHONE_NUMBER_END_PATTERN, ''); + } + /** + * @param {string} text - Input. + * @param {boolean} v2 - Legacy API functions don't pass `v2: true` flag. + * @param {boolean} [extract] - Whether to extract a phone number from `text`, or attempt to parse the entire text as a phone number. + * @return {object} `{ ?number, ?ext }`. + */ + + + function parseInput(text, v2, extract) { + // // Parse RFC 3966 phone number URI. + // if (text && text.indexOf('tel:') === 0) { + // return parseRFC3966(text) + // } + // let number = extractFormattedPhoneNumber(text, extract, v2) + var number = extractFormattedPhoneNumberFromPossibleRfc3966NumberUri(text, { + extractFormattedPhoneNumber: function extractFormattedPhoneNumber(text) { + return _extractFormattedPhoneNumber(text, extract, v2); + } + }); // If the phone number is not viable, then abort. + + if (!number) { + return {}; + } + + if (!isViablePhoneNumber(number)) { + if (isViablePhoneNumberStart(number)) { + return { + error: 'TOO_SHORT' + }; + } + + return {}; + } // Attempt to parse extension first, since it doesn't require region-specific + // data and we want to have the non-normalised number here. + + + var withExtensionStripped = extractExtension(number); + + if (withExtensionStripped.ext) { + return withExtensionStripped; + } + + return { + number: number + }; + } + /** + * Creates `parse()` result object. + */ + + + function result(country, nationalNumber, ext) { + var result = { + country: country, + phone: nationalNumber + }; + + if (ext) { + result.ext = ext; + } + + return result; + } + /** + * Parses a viable phone number. + * @param {string} formattedPhoneNumber — Example: "(213) 373-4253". + * @param {string} [defaultCountry] + * @param {string} [defaultCallingCode] + * @param {Metadata} metadata + * @return {object} Returns `{ country: string?, countryCallingCode: string?, nationalNumber: string? }`. + */ + + + function parsePhoneNumber(formattedPhoneNumber, defaultCountry, defaultCallingCode, metadata) { + // Extract calling code from phone number. + var _extractCountryCallin = extractCountryCallingCode(parseIncompletePhoneNumber(formattedPhoneNumber), defaultCountry, defaultCallingCode, metadata.metadata), + countryCallingCodeSource = _extractCountryCallin.countryCallingCodeSource, + countryCallingCode = _extractCountryCallin.countryCallingCode, + number = _extractCountryCallin.number; // Choose a country by `countryCallingCode`. + + + var country; + + if (countryCallingCode) { + metadata.selectNumberingPlan(countryCallingCode); + } // If `formattedPhoneNumber` is passed in "national" format + // then `number` is defined and `countryCallingCode` is `undefined`. + else if (number && (defaultCountry || defaultCallingCode)) { + metadata.selectNumberingPlan(defaultCountry, defaultCallingCode); + + if (defaultCountry) { + country = defaultCountry; + } + + countryCallingCode = defaultCallingCode || getCountryCallingCode(defaultCountry, metadata.metadata); + } else return {}; + + if (!number) { + return { + countryCallingCodeSource: countryCallingCodeSource, + countryCallingCode: countryCallingCode + }; + } + + var _extractNationalNumbe = extractNationalNumber(parseIncompletePhoneNumber(number), metadata), + nationalNumber = _extractNationalNumbe.nationalNumber, + carrierCode = _extractNationalNumbe.carrierCode; // Sometimes there are several countries + // corresponding to the same country phone code + // (e.g. NANPA countries all having `1` country phone code). + // Therefore, to reliably determine the exact country, + // national (significant) number should have been parsed first. + // + // When `metadata.json` is generated, all "ambiguous" country phone codes + // get their countries populated with the full set of + // "phone number type" regular expressions. + // + + + var exactCountry = getCountryByCallingCode(countryCallingCode, nationalNumber, metadata); + + if (exactCountry) { + country = exactCountry; + /* istanbul ignore if */ + + if (exactCountry === '001') ; else { + metadata.country(country); + } + } + + return { + country: country, + countryCallingCode: countryCallingCode, + countryCallingCodeSource: countryCallingCodeSource, + nationalNumber: nationalNumber, + carrierCode: carrierCode + }; + } + + function ownKeys$1(object, enumerableOnly) { + var keys = Object.keys(object); + + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function (sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + + return keys; + } + + function _objectSpread$1(target) { + for (var i = 1; i < arguments.length; i++) { + var source = null != arguments[i] ? arguments[i] : {}; + i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { + _defineProperty$1(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + + return target; + } + + function _defineProperty$1(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; + } + function parsePhoneNumberWithError$2(text, options, metadata) { + return parse(text, _objectSpread$1(_objectSpread$1({}, options), {}, { + v2: true + }), metadata); + } + + function _typeof(obj) { + "@babel/helpers - typeof"; + + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, _typeof(obj); + } + + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function (sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + + return keys; + } + + function _objectSpread(target) { + for (var i = 1; i < arguments.length; i++) { + var source = null != arguments[i] ? arguments[i] : {}; + i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { + _defineProperty(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + + return target; + } + + function _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; + } + + function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); + } + + function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - var libphonenumber = {exports: {}}; + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } - (function(module,exports){(function(f){{module.exports=f();}})(function(){return function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof commonjsRequire&&commonjsRequire;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a;}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r);},p,p.exports,r,e,n,t);}return n[i].exports;}for(var u="function"==typeof commonjsRequire&&commonjsRequire,i=0;i arr.length) len = arr.length; - Copyright The Closure Library Authors. - SPDX-License-Identifier: Apache-2.0 - */var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.createTemplateTagFirstArg=function(a){return a.raw=a;};$jscomp.createTemplateTagFirstArgWithRaw=function(a,b){a.raw=b;return a;};$jscomp.arrayIteratorImpl=function(a){var b=0;return function(){return b=e;};},"es6","es3");$jscomp.findInternal=function(a,b,c){a instanceof String&&(a=String(a));for(var d=a.length,e=0;e=f;};},"es6","es3");$jscomp.polyfill("String.prototype.repeat",function(a){return a?a:function(b){var c=$jscomp.checkStringArgs(this,null,"repeat");if(0>b||1342177279>>=1)c+=c;return d;};},"es6","es3");$jscomp.initSymbol=function(){};$jscomp.polyfill("Symbol",function(a){if(a)return a;var b=function(e,f){this.$jscomp$symbol$id_=e;$jscomp.defineProperty(this,"description",{configurable:!0,writable:!0,value:f});};b.prototype.toString=function(){return this.$jscomp$symbol$id_;};var c=0,d=function(e){if(this instanceof d)throw new TypeError("Symbol is not a constructor");return new b("jscomp_symbol_"+(e||"")+"_"+c++,e);};return d;},"es6","es3");$jscomp.polyfill("Symbol.iterator",function(a){if(a)return a;a=Symbol("Symbol.iterator");for(var b="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),c=0;cc&&(c=Math.max(c+e,0));c>>0);goog.uidCounter_=0;goog.cloneObject=function(a){var b=goog.typeOf(a);if("object"==b||"array"==b){if("function"===typeof a.clone)return a.clone();b="array"==b?[]:{};for(var c in a)b[c]=goog.cloneObject(a[c]);return b;}return a;};goog.bindNative_=function(a,b,c){return a.call.apply(a.bind,arguments);};goog.bindJs_=function(a,b,c){if(!a)throw Error();if(2").replace(/'/g,"'").replace(/"/g,'"').replace(/&/g,"&"));b&&(a=a.replace(/\{\$([^}]+)}/g,function(d,e){return null!=b&&e in b?b[e]:d;}));return a;};goog.getMsgWithFallback=function(a,b){return a;};goog.exportSymbol=function(a,b,c){goog.exportPath_(a,b,!0,c);};goog.exportProperty=function(a,b,c){a[b]=c;};goog.inherits=function(a,b){function c(){}c.prototype=b.prototype;a.superClass_=b.prototype;a.prototype=new c();a.prototype.constructor=a;a.base=function(d,e,f){for(var g=Array(arguments.length-2),h=2;hc?Math.max(0,a.length+c):c;if("string"===typeof a)return "string"!==typeof b||1!=b.length?-1:a.indexOf(b,c);for(;cc&&(c=Math.max(0,a.length+c));if("string"===typeof a)return "string"!==typeof b||1!=b.length?-1:a.lastIndexOf(b,c);for(;0<=c;c--)if(c in a&&a[c]===b)return c;return -1;};goog.array.lastIndexOf=module$contents$goog$array_lastIndexOf;var module$contents$goog$array_forEach=goog.NATIVE_ARRAY_PROTOTYPES&&(module$contents$goog$array_ASSUME_NATIVE_FUNCTIONS||Array.prototype.forEach)?function(a,b,c){goog.asserts.assert(null!=a.length);Array.prototype.forEach.call(a,b,c);}:function(a,b,c){for(var d=a.length,e="string"===typeof a?a.split(""):a,f=0;fb?null:"string"===typeof a?a.charAt(b):a[b];}goog.array.find=module$contents$goog$array_find;function module$contents$goog$array_findIndex(a,b,c){for(var d=a.length,e="string"===typeof a?a.split(""):a,f=0;fb?null:"string"===typeof a?a.charAt(b):a[b];}goog.array.findRight=module$contents$goog$array_findRight;function module$contents$goog$array_findIndexRight(a,b,c){var d=a.length,e="string"===typeof a?a.split(""):a;for(--d;0<=d;d--)if(d in e&&b.call(c,e[d],d,a))return d;return -1;}goog.array.findIndexRight=module$contents$goog$array_findIndexRight;function module$contents$goog$array_contains(a,b){return 0<=module$contents$goog$array_indexOf(a,b);}goog.array.contains=module$contents$goog$array_contains;function module$contents$goog$array_isEmpty(a){return 0==a.length;}goog.array.isEmpty=module$contents$goog$array_isEmpty;function module$contents$goog$array_clear(a){if(!Array.isArray(a))for(var b=a.length-1;0<=b;b--)delete a[b];a.length=0;}goog.array.clear=module$contents$goog$array_clear;function module$contents$goog$array_insert(a,b){module$contents$goog$array_contains(a,b)||a.push(b);}goog.array.insert=module$contents$goog$array_insert;function module$contents$goog$array_insertAt(a,b,c){module$contents$goog$array_splice(a,c,0,b);}goog.array.insertAt=module$contents$goog$array_insertAt;function module$contents$goog$array_insertArrayAt(a,b,c){goog.partial(module$contents$goog$array_splice,a,c,0).apply(null,b);}goog.array.insertArrayAt=module$contents$goog$array_insertArrayAt;function module$contents$goog$array_insertBefore(a,b,c){var d;2==arguments.length||0>(d=module$contents$goog$array_indexOf(a,c))?a.push(b):module$contents$goog$array_insertAt(a,b,d);}goog.array.insertBefore=module$contents$goog$array_insertBefore;function module$contents$goog$array_remove(a,b){b=module$contents$goog$array_indexOf(a,b);var c;(c=0<=b)&&module$contents$goog$array_removeAt(a,b);return c;}goog.array.remove=module$contents$goog$array_remove;function module$contents$goog$array_removeLast(a,b){b=module$contents$goog$array_lastIndexOf(a,b);return 0<=b?(module$contents$goog$array_removeAt(a,b),!0):!1;}goog.array.removeLast=module$contents$goog$array_removeLast;function module$contents$goog$array_removeAt(a,b){goog.asserts.assert(null!=a.length);return 1==Array.prototype.splice.call(a,b,1).length;}goog.array.removeAt=module$contents$goog$array_removeAt;function module$contents$goog$array_removeIf(a,b,c){b=module$contents$goog$array_findIndex(a,b,c);return 0<=b?(module$contents$goog$array_removeAt(a,b),!0):!1;}goog.array.removeIf=module$contents$goog$array_removeIf;function module$contents$goog$array_removeAllIf(a,b,c){var d=0;module$contents$goog$array_forEachRight(a,function(e,f){b.call(c,e,f,a)&&module$contents$goog$array_removeAt(a,f)&&d++;});return d;}goog.array.removeAllIf=module$contents$goog$array_removeAllIf;function module$contents$goog$array_concat(a){return Array.prototype.concat.apply([],arguments);}goog.array.concat=module$contents$goog$array_concat;function module$contents$goog$array_join(a){return Array.prototype.concat.apply([],arguments);}goog.array.join=module$contents$goog$array_join;function module$contents$goog$array_toArray(a){var b=a.length;if(0=arguments.length?Array.prototype.slice.call(a,b):Array.prototype.slice.call(a,b,c);}goog.array.slice=module$contents$goog$array_slice;function module$contents$goog$array_removeDuplicates(a,b,c){b=b||a;var d=function(k){return goog.isObject(k)?"o"+goog.getUid(k):(typeof k).charAt(0)+k;};c=c||d;d={};for(var e=0,f=0;f>>1);var l=c?b.call(e,a[k],k,a):b(d,a[k]);0b?1:ac?(module$contents$goog$array_insertAt(a,b,-(c+1)),!0):!1;}goog.array.binaryInsert=module$contents$goog$array_binaryInsert;function module$contents$goog$array_binaryRemove(a,b,c){b=module$contents$goog$array_binarySearch(a,b,c);return 0<=b?module$contents$goog$array_removeAt(a,b):!1;}goog.array.binaryRemove=module$contents$goog$array_binaryRemove;function module$contents$goog$array_bucket(a,b,c){for(var d={},e=0;ec*(f-e))return [];if(0f;a+=c)d.push(a);return d;}goog.array.range=module$contents$goog$array_range;function module$contents$goog$array_repeat(a,b){for(var c=[],d=0;db&&Array.prototype.push.apply(a,a.splice(0,-b)));return a;}goog.array.rotate=module$contents$goog$array_rotate;function module$contents$goog$array_moveItem(a,b,c){goog.asserts.assert(0<=b&&b";}else return void 0===a?"undefined":null===a?"null":typeof a;};goog.dom.asserts.getWindow_=function(a){try{var b=a&&a.ownerDocument,c=b&&(b.defaultView||b.parentWindow);c=c||goog.global;if(c.Element&&c.Location)return c;}catch(d){}return null;};goog.dom.HtmlElement=function(){};goog.functions={};goog.functions.constant=function(a){return function(){return a;};};goog.functions.FALSE=function(){return !1;};goog.functions.TRUE=function(){return !0;};goog.functions.NULL=function(){return null;};goog.functions.identity=function(a,b){return a;};goog.functions.error=function(a){return function(){throw Error(a);};};goog.functions.fail=function(a){return function(){throw a;};};goog.functions.lock=function(a,b){b=b||0;return function(){return a.apply(this,Array.prototype.slice.call(arguments,0,b));};};goog.functions.nth=function(a){return function(){return arguments[a];};};goog.functions.partialRight=function(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var d=this;d===goog.global&&(d=void 0);var e=Array.prototype.slice.call(arguments);e.push.apply(e,c);return a.apply(d,e);};};goog.functions.withReturnValue=function(a,b){return goog.functions.sequence(a,goog.functions.constant(b));};goog.functions.equalTo=function(a,b){return function(c){return b?a==c:a===c;};};goog.functions.compose=function(a,b){var c=arguments,d=c.length;return function(){var e;d&&(e=c[d-1].apply(this,arguments));for(var f=d-2;0<=f;f--)e=c[f].call(this,e);return e;};};goog.functions.sequence=function(a){var b=arguments,c=b.length;return function(){for(var d,e=0;ea?goog.i18n.bidi.Dir.RTL:b?null:goog.i18n.bidi.Dir.NEUTRAL:null==a?null:a?goog.i18n.bidi.Dir.RTL:goog.i18n.bidi.Dir.LTR;};goog.i18n.bidi.ltrChars_="A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0900-\u1fff\u200e\u2c00-\ud801\ud804-\ud839\ud83c-\udbff\uf900-\ufb1c\ufe00-\ufe6f\ufefd-\uffff";goog.i18n.bidi.rtlChars_="\u0591-\u06ef\u06fa-\u08ff\u200f\ud802-\ud803\ud83a-\ud83b\ufb1d-\ufdff\ufe70-\ufefc";goog.i18n.bidi.htmlSkipReg_=/<[^>]*>|&[^;]+;/g;goog.i18n.bidi.stripHtmlIfNeeded_=function(a,b){return b?a.replace(goog.i18n.bidi.htmlSkipReg_,""):a;};goog.i18n.bidi.rtlCharReg_=new RegExp("["+goog.i18n.bidi.rtlChars_+"]");goog.i18n.bidi.ltrCharReg_=new RegExp("["+goog.i18n.bidi.ltrChars_+"]");goog.i18n.bidi.hasAnyRtl=function(a,b){return goog.i18n.bidi.rtlCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a,b));};goog.i18n.bidi.hasRtlChar=goog.i18n.bidi.hasAnyRtl;goog.i18n.bidi.hasAnyLtr=function(a,b){return goog.i18n.bidi.ltrCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a,b));};goog.i18n.bidi.ltrRe_=new RegExp("^["+goog.i18n.bidi.ltrChars_+"]");goog.i18n.bidi.rtlRe_=new RegExp("^["+goog.i18n.bidi.rtlChars_+"]");goog.i18n.bidi.isRtlChar=function(a){return goog.i18n.bidi.rtlRe_.test(a);};goog.i18n.bidi.isLtrChar=function(a){return goog.i18n.bidi.ltrRe_.test(a);};goog.i18n.bidi.isNeutralChar=function(a){return !goog.i18n.bidi.isLtrChar(a)&&!goog.i18n.bidi.isRtlChar(a);};goog.i18n.bidi.ltrDirCheckRe_=new RegExp("^[^"+goog.i18n.bidi.rtlChars_+"]*["+goog.i18n.bidi.ltrChars_+"]");goog.i18n.bidi.rtlDirCheckRe_=new RegExp("^[^"+goog.i18n.bidi.ltrChars_+"]*["+goog.i18n.bidi.rtlChars_+"]");goog.i18n.bidi.startsWithRtl=function(a,b){return goog.i18n.bidi.rtlDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a,b));};goog.i18n.bidi.isRtlText=goog.i18n.bidi.startsWithRtl;goog.i18n.bidi.startsWithLtr=function(a,b){return goog.i18n.bidi.ltrDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a,b));};goog.i18n.bidi.isLtrText=goog.i18n.bidi.startsWithLtr;goog.i18n.bidi.isRequiredLtrRe_=/^http:\/\/.*/;goog.i18n.bidi.isNeutralText=function(a,b){a=goog.i18n.bidi.stripHtmlIfNeeded_(a,b);return goog.i18n.bidi.isRequiredLtrRe_.test(a)||!goog.i18n.bidi.hasAnyLtr(a)&&!goog.i18n.bidi.hasAnyRtl(a);};goog.i18n.bidi.ltrExitDirCheckRe_=new RegExp("["+goog.i18n.bidi.ltrChars_+"][^"+goog.i18n.bidi.rtlChars_+"]*$");goog.i18n.bidi.rtlExitDirCheckRe_=new RegExp("["+goog.i18n.bidi.rtlChars_+"][^"+goog.i18n.bidi.ltrChars_+"]*$");goog.i18n.bidi.endsWithLtr=function(a,b){return goog.i18n.bidi.ltrExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a,b));};goog.i18n.bidi.isLtrExitText=goog.i18n.bidi.endsWithLtr;goog.i18n.bidi.endsWithRtl=function(a,b){return goog.i18n.bidi.rtlExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a,b));};goog.i18n.bidi.isRtlExitText=goog.i18n.bidi.endsWithRtl;goog.i18n.bidi.rtlLocalesRe_=/^(ar|ckb|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|.*[-_](Adlm|Arab|Hebr|Nkoo|Rohg|Thaa))(?!.*[-_](Latn|Cyrl)($|-|_))($|-|_)/i;goog.i18n.bidi.isRtlLanguage=function(a){return goog.i18n.bidi.rtlLocalesRe_.test(a);};goog.i18n.bidi.bracketGuardTextRe_=/(\(.*?\)+)|(\[.*?\]+)|(\{.*?\}+)|(<.*?>+)/g;goog.i18n.bidi.guardBracketInText=function(a,b){b=(void 0===b?goog.i18n.bidi.hasAnyRtl(a):b)?goog.i18n.bidi.Format.RLM:goog.i18n.bidi.Format.LRM;return a.replace(goog.i18n.bidi.bracketGuardTextRe_,b+"$&"+b);};goog.i18n.bidi.enforceRtlInHtml=function(a){return "<"==a.charAt(0)?a.replace(/<\w+/,"$& dir=rtl"):"\n"+a+"";};goog.i18n.bidi.enforceRtlInText=function(a){return goog.i18n.bidi.Format.RLE+a+goog.i18n.bidi.Format.PDF;};goog.i18n.bidi.enforceLtrInHtml=function(a){return "<"==a.charAt(0)?a.replace(/<\w+/,"$& dir=ltr"):"\n"+a+"";};goog.i18n.bidi.enforceLtrInText=function(a){return goog.i18n.bidi.Format.LRE+a+goog.i18n.bidi.Format.PDF;};goog.i18n.bidi.dimensionsRe_=/:\s*([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)/g;goog.i18n.bidi.leftRe_=/left/gi;goog.i18n.bidi.rightRe_=/right/gi;goog.i18n.bidi.tempRe_=/%%%%/g;goog.i18n.bidi.mirrorCSS=function(a){return a.replace(goog.i18n.bidi.dimensionsRe_,":$1 $4 $3 $2").replace(goog.i18n.bidi.leftRe_,"%%%%").replace(goog.i18n.bidi.rightRe_,goog.i18n.bidi.LEFT).replace(goog.i18n.bidi.tempRe_,goog.i18n.bidi.RIGHT);};goog.i18n.bidi.doubleQuoteSubstituteRe_=/([\u0591-\u05f2])"/g;goog.i18n.bidi.singleQuoteSubstituteRe_=/([\u0591-\u05f2])'/g;goog.i18n.bidi.normalizeHebrewQuote=function(a){return a.replace(goog.i18n.bidi.doubleQuoteSubstituteRe_,"$1\u05f4").replace(goog.i18n.bidi.singleQuoteSubstituteRe_,"$1\u05f3");};goog.i18n.bidi.wordSeparatorRe_=/\s+/;goog.i18n.bidi.hasNumeralsRe_=/[\d\u06f0-\u06f9]/;goog.i18n.bidi.rtlDetectionThreshold_=.4;goog.i18n.bidi.estimateDirection=function(a,b){var c=0,d=0,e=!1;a=goog.i18n.bidi.stripHtmlIfNeeded_(a,b).split(goog.i18n.bidi.wordSeparatorRe_);for(b=0;bgoog.i18n.bidi.rtlDetectionThreshold_?goog.i18n.bidi.Dir.RTL:goog.i18n.bidi.Dir.LTR;};goog.i18n.bidi.detectRtlDirectionality=function(a,b){return goog.i18n.bidi.estimateDirection(a,b)==goog.i18n.bidi.Dir.RTL;};goog.i18n.bidi.setElementDirAndAlign=function(a,b){a&&(b=goog.i18n.bidi.toDir(b))&&(a.style.textAlign=b==goog.i18n.bidi.Dir.RTL?goog.i18n.bidi.RIGHT:goog.i18n.bidi.LEFT,a.dir=b==goog.i18n.bidi.Dir.RTL?"rtl":"ltr");};goog.i18n.bidi.setElementDirByTextDirectionality=function(a,b){switch(goog.i18n.bidi.estimateDirection(b)){case goog.i18n.bidi.Dir.LTR:"ltr"!==a.dir&&(a.dir="ltr");break;case goog.i18n.bidi.Dir.RTL:"rtl"!==a.dir&&(a.dir="rtl");break;default:a.removeAttribute("dir");}};goog.i18n.bidi.DirectionalString=function(){};goog.html.TrustedResourceUrl=function(a,b){this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_=b===goog.html.TrustedResourceUrl.CONSTRUCTOR_TOKEN_PRIVATE_?a:"";};goog.html.TrustedResourceUrl.prototype.implementsGoogStringTypedString=!0;goog.html.TrustedResourceUrl.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_.toString();};goog.html.TrustedResourceUrl.prototype.implementsGoogI18nBidiDirectionalString=!0;goog.html.TrustedResourceUrl.prototype.getDirection=function(){return goog.i18n.bidi.Dir.LTR;};goog.html.TrustedResourceUrl.prototype.cloneWithParams=function(a,b){var c=goog.html.TrustedResourceUrl.unwrap(this);c=goog.html.TrustedResourceUrl.URL_PARAM_PARSER_.exec(c);var d=c[3]||"";return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(c[1]+goog.html.TrustedResourceUrl.stringifyParams_("?",c[2]||"",a)+goog.html.TrustedResourceUrl.stringifyParams_("#",d,b));};goog.DEBUG&&(goog.html.TrustedResourceUrl.prototype.toString=function(){return "TrustedResourceUrl{"+this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_+"}";});goog.html.TrustedResourceUrl.unwrap=function(a){return goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(a).toString();};goog.html.TrustedResourceUrl.unwrapTrustedScriptURL=function(a){if(a instanceof goog.html.TrustedResourceUrl&&a.constructor===goog.html.TrustedResourceUrl)return a.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_;goog.asserts.fail("expected object of type TrustedResourceUrl, got '"+a+"' of type "+goog.typeOf(a));return "type_error:TrustedResourceUrl";};goog.html.TrustedResourceUrl.format=function(a,b){var c=goog.string.Const.unwrap(a);if(!goog.html.TrustedResourceUrl.BASE_URL_.test(c))throw Error("Invalid TrustedResourceUrl format: "+c);a=c.replace(goog.html.TrustedResourceUrl.FORMAT_MARKER_,function(d,e){if(!Object.prototype.hasOwnProperty.call(b,e))throw Error('Found marker, "'+e+'", in format string, "'+c+'", but no valid label mapping found in args: '+JSON.stringify(b));d=b[e];return d instanceof goog.string.Const?goog.string.Const.unwrap(d):encodeURIComponent(String(d));});return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(a);};goog.html.TrustedResourceUrl.FORMAT_MARKER_=/%{(\w+)}/g;goog.html.TrustedResourceUrl.BASE_URL_=/^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^/\\]|[^:/\\%]+\/|[^:/\\%]*[?#]|about:blank#)/i;goog.html.TrustedResourceUrl.URL_PARAM_PARSER_=/^([^?#]*)(\?[^#]*)?(#[\s\S]*)?/;goog.html.TrustedResourceUrl.formatWithParams=function(a,b,c,d){return goog.html.TrustedResourceUrl.format(a,b).cloneWithParams(c,d);};goog.html.TrustedResourceUrl.fromConstant=function(a){return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(a));};goog.html.TrustedResourceUrl.fromConstants=function(a){for(var b="",c=0;ca.length?"&":"")+encodeURIComponent(d)+"="+encodeURIComponent(String(g)));}}return b;};goog.string.internal={};goog.string.internal.startsWith=function(a,b){return 0==a.lastIndexOf(b,0);};goog.string.internal.endsWith=function(a,b){var c=a.length-b.length;return 0<=c&&a.indexOf(b,c)==c;};goog.string.internal.caseInsensitiveStartsWith=function(a,b){return 0==goog.string.internal.caseInsensitiveCompare(b,a.substr(0,b.length));};goog.string.internal.caseInsensitiveEndsWith=function(a,b){return 0==goog.string.internal.caseInsensitiveCompare(b,a.substr(a.length-b.length,b.length));};goog.string.internal.caseInsensitiveEquals=function(a,b){return a.toLowerCase()==b.toLowerCase();};goog.string.internal.isEmptyOrWhitespace=function(a){return /^[\s\xa0]*$/.test(a);};goog.string.internal.trim=goog.TRUSTED_SITE&&String.prototype.trim?function(a){return a.trim();}:function(a){return /^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(a)[1];};goog.string.internal.caseInsensitiveCompare=function(a,b){a=String(a).toLowerCase();b=String(b).toLowerCase();return a":"
");};goog.string.internal.htmlEscape=function(a,b){if(b)a=a.replace(goog.string.internal.AMP_RE_,"&").replace(goog.string.internal.LT_RE_,"<").replace(goog.string.internal.GT_RE_,">").replace(goog.string.internal.QUOT_RE_,""").replace(goog.string.internal.SINGLE_QUOTE_RE_,"'").replace(goog.string.internal.NULL_RE_,"�");else {if(!goog.string.internal.ALL_RE_.test(a))return a;-1!=a.indexOf("&")&&(a=a.replace(goog.string.internal.AMP_RE_,"&"));-1!=a.indexOf("<")&&(a=a.replace(goog.string.internal.LT_RE_,"<"));-1!=a.indexOf(">")&&(a=a.replace(goog.string.internal.GT_RE_,">"));-1!=a.indexOf('"')&&(a=a.replace(goog.string.internal.QUOT_RE_,"""));-1!=a.indexOf("'")&&(a=a.replace(goog.string.internal.SINGLE_QUOTE_RE_,"'"));-1!=a.indexOf("\x00")&&(a=a.replace(goog.string.internal.NULL_RE_,"�"));}return a;};goog.string.internal.AMP_RE_=/&/g;goog.string.internal.LT_RE_=//g;goog.string.internal.QUOT_RE_=/"/g;goog.string.internal.SINGLE_QUOTE_RE_=/'/g;goog.string.internal.NULL_RE_=/\x00/g;goog.string.internal.ALL_RE_=/[\x00&<>"']/;goog.string.internal.whitespaceEscape=function(a,b){return goog.string.internal.newLineToBr(a.replace(/ /g,"  "),b);};goog.string.internal.contains=function(a,b){return -1!=a.indexOf(b);};goog.string.internal.caseInsensitiveContains=function(a,b){return goog.string.internal.contains(a.toLowerCase(),b.toLowerCase());};goog.string.internal.compareVersions=function(a,b){var c=0;a=goog.string.internal.trim(String(a)).split(".");b=goog.string.internal.trim(String(b)).split(".");for(var d=Math.max(a.length,b.length),e=0;0==c&&eb?1:0;};goog.html.SafeUrl=function(a,b){this.privateDoNotAccessOrElseSafeUrlWrappedValue_=b===goog.html.SafeUrl.CONSTRUCTOR_TOKEN_PRIVATE_?a:"";};goog.html.SafeUrl.INNOCUOUS_STRING="about:invalid#zClosurez";goog.html.SafeUrl.prototype.implementsGoogStringTypedString=!0;goog.html.SafeUrl.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeUrlWrappedValue_.toString();};goog.html.SafeUrl.prototype.implementsGoogI18nBidiDirectionalString=!0;goog.html.SafeUrl.prototype.getDirection=function(){return goog.i18n.bidi.Dir.LTR;};goog.DEBUG&&(goog.html.SafeUrl.prototype.toString=function(){return "SafeUrl{"+this.privateDoNotAccessOrElseSafeUrlWrappedValue_+"}";});goog.html.SafeUrl.unwrap=function(a){if(a instanceof goog.html.SafeUrl&&a.constructor===goog.html.SafeUrl)return a.privateDoNotAccessOrElseSafeUrlWrappedValue_;goog.asserts.fail("expected object of type SafeUrl, got '"+a+"' of type "+goog.typeOf(a));return "type_error:SafeUrl";};goog.html.SafeUrl.fromConstant=function(a){return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(a));};goog.html.SAFE_MIME_TYPE_PATTERN_=/^(?:audio\/(?:3gpp2|3gpp|aac|L16|midi|mp3|mp4|mpeg|oga|ogg|opus|x-m4a|x-matroska|x-wav|wav|webm)|font\/\w+|image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp|x-icon)|video\/(?:mpeg|mp4|ogg|webm|quicktime|x-matroska))(?:;\w+=(?:\w+|"[\w;,= ]+"))*$/i;goog.html.SafeUrl.isSafeMimeType=function(a){return goog.html.SAFE_MIME_TYPE_PATTERN_.test(a);};goog.html.SafeUrl.fromBlob=function(a){a=goog.html.SafeUrl.isSafeMimeType(a.type)?goog.fs.url.createObjectUrl(a):goog.html.SafeUrl.INNOCUOUS_STRING;return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a);};goog.html.SafeUrl.revokeObjectUrl=function(a){a=a.getTypedStringValue();a!==goog.html.SafeUrl.INNOCUOUS_STRING&&goog.fs.url.revokeObjectUrl(a);};goog.html.SafeUrl.fromMediaSource=function(a){goog.asserts.assert("MediaSource"in goog.global,"No support for MediaSource");a=a instanceof MediaSource?goog.fs.url.createObjectUrl(a):goog.html.SafeUrl.INNOCUOUS_STRING;return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a);};goog.html.DATA_URL_PATTERN_=/^data:(.*);base64,[a-z0-9+\/]+=*$/i;goog.html.SafeUrl.tryFromDataUrl=function(a){a=String(a);a=a.replace(/(%0A|%0D)/g,"");var b=a.match(goog.html.DATA_URL_PATTERN_);return b&&goog.html.SafeUrl.isSafeMimeType(b[1])?goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a):null;};goog.html.SafeUrl.fromDataUrl=function(a){return goog.html.SafeUrl.tryFromDataUrl(a)||goog.html.SafeUrl.INNOCUOUS_URL;};goog.html.SafeUrl.fromTelUrl=function(a){goog.string.internal.caseInsensitiveStartsWith(a,"tel:")||(a=goog.html.SafeUrl.INNOCUOUS_STRING);return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a);};goog.html.SIP_URL_PATTERN_=/^sip[s]?:[+a-z0-9_.!$%&'*\/=^`{|}~-]+@([a-z0-9-]+\.)+[a-z0-9]{2,63}$/i;goog.html.SafeUrl.fromSipUrl=function(a){goog.html.SIP_URL_PATTERN_.test(decodeURIComponent(a))||(a=goog.html.SafeUrl.INNOCUOUS_STRING);return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a);};goog.html.SafeUrl.fromFacebookMessengerUrl=function(a){goog.string.internal.caseInsensitiveStartsWith(a,"fb-messenger://share")||(a=goog.html.SafeUrl.INNOCUOUS_STRING);return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a);};goog.html.SafeUrl.fromWhatsAppUrl=function(a){goog.string.internal.caseInsensitiveStartsWith(a,"whatsapp://send")||(a=goog.html.SafeUrl.INNOCUOUS_STRING);return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a);};goog.html.SafeUrl.fromSmsUrl=function(a){goog.string.internal.caseInsensitiveStartsWith(a,"sms:")&&goog.html.SafeUrl.isSmsUrlBodyValid_(a)||(a=goog.html.SafeUrl.INNOCUOUS_STRING);return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a);};goog.html.SafeUrl.isSmsUrlBodyValid_=function(a){var b=a.indexOf("#");0+~[\]()=^$|]+$/.test(c))throw Error("Selector allows only [-_a-zA-Z0-9#.:* ,>+~[\\]()=^$|] and strings, got: "+a);if(!module$contents$goog$html$SafeStyleSheet_SafeStyleSheet.hasBalancedBrackets_(c))throw Error("() and [] in selector must be balanced, got: "+a);b instanceof goog.html.SafeStyle||(b=goog.html.SafeStyle.create(b));a=a+"{"+goog.html.SafeStyle.unwrap(b).replace(/.":"");if(a.toUpperCase()in goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_)throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?"Tag name <"+a+"> is not allowed for SafeHtml.":"");};goog.html.SafeHtml.createIframe=function(a,b,c,d){a&&goog.html.TrustedResourceUrl.unwrap(a);var e={};e.src=a||null;e.srcdoc=b&&goog.html.SafeHtml.unwrap(b);a=goog.html.SafeHtml.combineAttributes(e,{sandbox:""},c);return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe",a,d);};goog.html.SafeHtml.createSandboxIframe=function(a,b,c,d){if(!goog.html.SafeHtml.canUseSandboxIframe())throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?"The browser does not support sandboxed iframes.":"");var e={};e.src=a?goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitize(a)):null;e.srcdoc=b||null;e.sandbox="";a=goog.html.SafeHtml.combineAttributes(e,{},c);return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe",a,d);};goog.html.SafeHtml.canUseSandboxIframe=function(){return goog.global.HTMLIFrameElement&&"sandbox"in goog.global.HTMLIFrameElement.prototype;};goog.html.SafeHtml.createScriptSrc=function(a,b){goog.html.TrustedResourceUrl.unwrap(a);a=goog.html.SafeHtml.combineAttributes({src:a},{},b);return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("script",a);};goog.html.SafeHtml.createScript=function(a,b){for(var c in b)if(Object.prototype.hasOwnProperty.call(b,c)){var d=c.toLowerCase();if("language"==d||"src"==d||"text"==d||"type"==d)throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?'Cannot set "'+d+'" attribute':"");}c="";a=module$contents$goog$array_concat(a);for(d=0;d does not allow content."),e+=">"):(d=goog.html.SafeHtml.concat(c),e+=">"+goog.html.SafeHtml.unwrap(d)+"",d=d.getDirection());(a=b&&b.dir)&&(d=/^(ltr|rtl|auto)$/i.test(a)?goog.i18n.bidi.Dir.NEUTRAL:null);return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(e,d);};goog.html.SafeHtml.stringifyAttributes=function(a,b){var c="";if(b)for(var d in b)if(Object.prototype.hasOwnProperty.call(b,d)){if(!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(d))throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?'Invalid attribute name "'+d+'".':"");var e=b[d];null!=e&&(c+=" "+goog.html.SafeHtml.getAttrNameAndValue_(a,d,e));}return c;};goog.html.SafeHtml.combineAttributes=function(a,b,c){var d={},e;for(e in a)Object.prototype.hasOwnProperty.call(a,e)&&(goog.asserts.assert(e.toLowerCase()==e,"Must be lower case"),d[e]=a[e]);for(e in b)Object.prototype.hasOwnProperty.call(b,e)&&(goog.asserts.assert(e.toLowerCase()==e,"Must be lower case"),d[e]=b[e]);if(c)for(e in c)if(Object.prototype.hasOwnProperty.call(c,e)){var f=e.toLowerCase();if(f in a)throw Error(goog.html.SafeHtml.ENABLE_ERROR_MESSAGES?'Cannot override "'+f+'" attribute, got "'+e+'" with value "'+c[e]+'"':"");f in b&&delete d[f];d[e]=c[e];}return d;};goog.html.SafeHtml.DOCTYPE_HTML=function(){return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("",goog.i18n.bidi.Dir.NEUTRAL);}();goog.html.SafeHtml.EMPTY=new goog.html.SafeHtml(goog.global.trustedTypes&&goog.global.trustedTypes.emptyHTML||"",goog.i18n.bidi.Dir.NEUTRAL,goog.html.SafeHtml.CONSTRUCTOR_TOKEN_PRIVATE_);goog.html.SafeHtml.BR=function(){return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("
",goog.i18n.bidi.Dir.NEUTRAL);}();goog.html.uncheckedconversions={};goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract=function(a,b,c){goog.asserts.assertString(goog.string.Const.unwrap(a),"must provide justification");goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)),"must provide non-empty justification");return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(b,c||null);};goog.html.uncheckedconversions.safeScriptFromStringKnownToSatisfyTypeContract=function(a,b){goog.asserts.assertString(goog.string.Const.unwrap(a),"must provide justification");goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)),"must provide non-empty justification");return module$contents$goog$html$SafeScript_SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(b);};goog.html.uncheckedconversions.safeStyleFromStringKnownToSatisfyTypeContract=function(a,b){goog.asserts.assertString(goog.string.Const.unwrap(a),"must provide justification");goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)),"must provide non-empty justification");return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(b);};goog.html.uncheckedconversions.safeStyleSheetFromStringKnownToSatisfyTypeContract=function(a,b){goog.asserts.assertString(goog.string.Const.unwrap(a),"must provide justification");goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)),"must provide non-empty justification");return module$contents$goog$html$SafeStyleSheet_SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(b);};goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract=function(a,b){goog.asserts.assertString(goog.string.Const.unwrap(a),"must provide justification");goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)),"must provide non-empty justification");return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(b);};goog.html.uncheckedconversions.trustedResourceUrlFromStringKnownToSatisfyTypeContract=function(a,b){goog.asserts.assertString(goog.string.Const.unwrap(a),"must provide justification");goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)),"must provide non-empty justification");return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(b);};goog.dom.safe={};goog.dom.safe.InsertAdjacentHtmlPosition={AFTERBEGIN:"afterbegin",AFTEREND:"afterend",BEFOREBEGIN:"beforebegin",BEFOREEND:"beforeend"};goog.dom.safe.insertAdjacentHtml=function(a,b,c){a.insertAdjacentHTML(b,goog.html.SafeHtml.unwrapTrustedHTML(c));};goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_={MATH:!0,SCRIPT:!0,STYLE:!0,SVG:!0,TEMPLATE:!0};goog.dom.safe.isInnerHtmlCleanupRecursive_=goog.functions.cacheReturnValue(function(){if(goog.DEBUG&&"undefined"===typeof document)return !1;var a=document.createElement("div"),b=document.createElement("div");b.appendChild(document.createElement("div"));a.appendChild(b);if(goog.DEBUG&&!a.firstChild)return !1;b=a.firstChild.firstChild;a.innerHTML=goog.html.SafeHtml.unwrapTrustedHTML(goog.html.SafeHtml.EMPTY);return !b.parentElement;});goog.dom.safe.unsafeSetInnerHtmlDoNotUseOrElse=function(a,b){if(goog.dom.safe.isInnerHtmlCleanupRecursive_())for(;a.lastChild;)a.removeChild(a.lastChild);a.innerHTML=goog.html.SafeHtml.unwrapTrustedHTML(b);};goog.dom.safe.setInnerHtml=function(a,b){if(goog.asserts.ENABLE_ASSERTS&&a.tagName){var c=a.tagName.toUpperCase();if(goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_[c])throw Error("goog.dom.safe.setInnerHtml cannot be used to set content of "+a.tagName+".");}goog.dom.safe.unsafeSetInnerHtmlDoNotUseOrElse(a,b);};goog.dom.safe.setInnerHtmlFromConstant=function(a,b){goog.dom.safe.setInnerHtml(a,goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Constant HTML to be immediatelly used."),goog.string.Const.unwrap(b)));};goog.dom.safe.setOuterHtml=function(a,b){a.outerHTML=goog.html.SafeHtml.unwrapTrustedHTML(b);};goog.dom.safe.setFormElementAction=function(a,b){b=b instanceof goog.html.SafeUrl?b:goog.html.SafeUrl.sanitizeAssertUnchanged(b);goog.dom.asserts.assertIsHTMLFormElement(a).action=goog.html.SafeUrl.unwrap(b);};goog.dom.safe.setButtonFormAction=function(a,b){b=b instanceof goog.html.SafeUrl?b:goog.html.SafeUrl.sanitizeAssertUnchanged(b);goog.dom.asserts.assertIsHTMLButtonElement(a).formAction=goog.html.SafeUrl.unwrap(b);};goog.dom.safe.setInputFormAction=function(a,b){b=b instanceof goog.html.SafeUrl?b:goog.html.SafeUrl.sanitizeAssertUnchanged(b);goog.dom.asserts.assertIsHTMLInputElement(a).formAction=goog.html.SafeUrl.unwrap(b);};goog.dom.safe.setStyle=function(a,b){a.style.cssText=goog.html.SafeStyle.unwrap(b);};goog.dom.safe.documentWrite=function(a,b){a.write(goog.html.SafeHtml.unwrapTrustedHTML(b));};goog.dom.safe.setAnchorHref=function(a,b){goog.dom.asserts.assertIsHTMLAnchorElement(a);b=b instanceof goog.html.SafeUrl?b:goog.html.SafeUrl.sanitizeAssertUnchanged(b);a.href=goog.html.SafeUrl.unwrap(b);};goog.dom.safe.setImageSrc=function(a,b){goog.dom.asserts.assertIsHTMLImageElement(a);if(!(b instanceof goog.html.SafeUrl)){var c=/^data:image\//i.test(b);b=goog.html.SafeUrl.sanitizeAssertUnchanged(b,c);}a.src=goog.html.SafeUrl.unwrap(b);};goog.dom.safe.setAudioSrc=function(a,b){goog.dom.asserts.assertIsHTMLAudioElement(a);if(!(b instanceof goog.html.SafeUrl)){var c=/^data:audio\//i.test(b);b=goog.html.SafeUrl.sanitizeAssertUnchanged(b,c);}a.src=goog.html.SafeUrl.unwrap(b);};goog.dom.safe.setVideoSrc=function(a,b){goog.dom.asserts.assertIsHTMLVideoElement(a);if(!(b instanceof goog.html.SafeUrl)){var c=/^data:video\//i.test(b);b=goog.html.SafeUrl.sanitizeAssertUnchanged(b,c);}a.src=goog.html.SafeUrl.unwrap(b);};goog.dom.safe.setEmbedSrc=function(a,b){goog.dom.asserts.assertIsHTMLEmbedElement(a);a.src=goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(b);};goog.dom.safe.setFrameSrc=function(a,b){goog.dom.asserts.assertIsHTMLFrameElement(a);a.src=goog.html.TrustedResourceUrl.unwrap(b);};goog.dom.safe.setIframeSrc=function(a,b){goog.dom.asserts.assertIsHTMLIFrameElement(a);a.src=goog.html.TrustedResourceUrl.unwrap(b);};goog.dom.safe.setIframeSrcdoc=function(a,b){goog.dom.asserts.assertIsHTMLIFrameElement(a);a.srcdoc=goog.html.SafeHtml.unwrapTrustedHTML(b);};goog.dom.safe.setLinkHrefAndRel=function(a,b,c){goog.dom.asserts.assertIsHTMLLinkElement(a);a.rel=c;goog.string.internal.caseInsensitiveContains(c,"stylesheet")?(goog.asserts.assert(b instanceof goog.html.TrustedResourceUrl,'URL must be TrustedResourceUrl because "rel" contains "stylesheet"'),a.href=goog.html.TrustedResourceUrl.unwrap(b)):a.href=b instanceof goog.html.TrustedResourceUrl?goog.html.TrustedResourceUrl.unwrap(b):b instanceof goog.html.SafeUrl?goog.html.SafeUrl.unwrap(b):goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitizeAssertUnchanged(b));};goog.dom.safe.setObjectData=function(a,b){goog.dom.asserts.assertIsHTMLObjectElement(a);a.data=goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(b);};goog.dom.safe.setScriptSrc=function(a,b){goog.dom.asserts.assertIsHTMLScriptElement(a);a.src=goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(b);goog.dom.safe.setNonceForScriptElement_(a);};goog.dom.safe.setScriptContent=function(a,b){goog.dom.asserts.assertIsHTMLScriptElement(a);a.textContent=module$contents$goog$html$SafeScript_SafeScript.unwrapTrustedScript(b);goog.dom.safe.setNonceForScriptElement_(a);};goog.dom.safe.setNonceForScriptElement_=function(a){var b=goog.getScriptNonce(a.ownerDocument&&a.ownerDocument.defaultView);b&&a.setAttribute("nonce",b);};goog.dom.safe.setLocationHref=function(a,b){goog.dom.asserts.assertIsLocation(a);b=b instanceof goog.html.SafeUrl?b:goog.html.SafeUrl.sanitizeAssertUnchanged(b);a.href=goog.html.SafeUrl.unwrap(b);};goog.dom.safe.assignLocation=function(a,b){goog.dom.asserts.assertIsLocation(a);b=b instanceof goog.html.SafeUrl?b:goog.html.SafeUrl.sanitizeAssertUnchanged(b);a.assign(goog.html.SafeUrl.unwrap(b));};goog.dom.safe.replaceLocation=function(a,b){b=b instanceof goog.html.SafeUrl?b:goog.html.SafeUrl.sanitizeAssertUnchanged(b);a.replace(goog.html.SafeUrl.unwrap(b));};goog.dom.safe.openInWindow=function(a,b,c,d,e){a=a instanceof goog.html.SafeUrl?a:goog.html.SafeUrl.sanitizeAssertUnchanged(a);b=b||goog.global;c=c instanceof goog.string.Const?goog.string.Const.unwrap(c):c||"";return b.open(goog.html.SafeUrl.unwrap(a),c,d,e);};goog.dom.safe.parseFromStringHtml=function(a,b){return goog.dom.safe.parseFromString(a,b,"text/html");};goog.dom.safe.parseFromString=function(a,b,c){return a.parseFromString(goog.html.SafeHtml.unwrapTrustedHTML(b),c);};goog.dom.safe.createImageFromBlob=function(a){if(!/^image\/.*/g.test(a.type))throw Error("goog.dom.safe.createImageFromBlob only accepts MIME type image/.*.");var b=goog.global.URL.createObjectURL(a);a=new goog.global.Image();a.onload=function(){goog.global.URL.revokeObjectURL(b);};goog.dom.safe.setImageSrc(a,goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Image blob URL."),b));return a;};goog.string.DETECT_DOUBLE_ESCAPING=!1;goog.string.FORCE_NON_DOM_HTML_UNESCAPING=!1;goog.string.Unicode={NBSP:"\u00a0"};goog.string.startsWith=goog.string.internal.startsWith;goog.string.endsWith=goog.string.internal.endsWith;goog.string.caseInsensitiveStartsWith=goog.string.internal.caseInsensitiveStartsWith;goog.string.caseInsensitiveEndsWith=goog.string.internal.caseInsensitiveEndsWith;goog.string.caseInsensitiveEquals=goog.string.internal.caseInsensitiveEquals;goog.string.subs=function(a,b){for(var c=a.split("%s"),d="",e=Array.prototype.slice.call(arguments,1);e.length&&1=a||"\u0080"<=a&&"\ufffd">=a;};goog.string.stripNewlines=function(a){return a.replace(/(\r\n|\r|\n)+/g," ");};goog.string.canonicalizeNewlines=function(a){return a.replace(/(\r\n|\r|\n)/g,"\n");};goog.string.normalizeWhitespace=function(a){return a.replace(/\xa0|\s/g," ");};goog.string.normalizeSpaces=function(a){return a.replace(/\xa0|[ \t]+/g," ");};goog.string.collapseBreakingSpaces=function(a){return a.replace(/[\t\r\n ]+/g," ").replace(/^[\t\r\n ]+|[\t\r\n ]+$/g,"");};goog.string.trim=goog.string.internal.trim;goog.string.trimLeft=function(a){return a.replace(/^[\s\xa0]+/,"");};goog.string.trimRight=function(a){return a.replace(/[\s\xa0]+$/,"");};goog.string.caseInsensitiveCompare=goog.string.internal.caseInsensitiveCompare;goog.string.numberAwareCompare_=function(a,b,c){if(a==b)return 0;if(!a)return -1;if(!b)return 1;for(var d=a.toLowerCase().match(c),e=b.toLowerCase().match(c),f=Math.min(d.length,e.length),g=0;g",""":'"'};var d=b?b.createElement("div"):goog.global.document.createElement("div");return a.replace(goog.string.HTML_ENTITY_PATTERN_,function(e,f){var g=c[e];if(g)return g;"#"==f.charAt(0)&&(f=Number("0"+f.substr(1)),isNaN(f)||(g=String.fromCharCode(f)));g||(goog.dom.safe.setInnerHtml(d,goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Single HTML entity."),e+" ")),g=d.firstChild.nodeValue.slice(0,-1));return c[e]=g;});};goog.string.unescapePureXmlEntities_=function(a){return a.replace(/&([^;]+);/g,function(b,c){switch(c){case"amp":return "&";case"lt":return "<";case"gt":return ">";case"quot":return '"';default:return "#"!=c.charAt(0)||(c=Number("0"+c.substr(1)),isNaN(c))?b:String.fromCharCode(c);}});};goog.string.HTML_ENTITY_PATTERN_=/&([^;\s<&]+);?/g;goog.string.whitespaceEscape=function(a,b){return goog.string.newLineToBr(a.replace(/ /g,"  "),b);};goog.string.preserveSpaces=function(a){return a.replace(/(^|[\n ]) /g,"$1"+goog.string.Unicode.NBSP);};goog.string.stripQuotes=function(a,b){for(var c=b.length,d=0;db&&(a=a.substring(0,b-3)+"...");c&&(a=goog.string.htmlEscape(a));return a;};goog.string.truncateMiddle=function(a,b,c,d){c&&(a=goog.string.unescapeEntities(a));if(d&&a.length>b){d>b&&(d=b);var e=a.length-d;a=a.substring(0,b-d)+"..."+a.substring(e);}else a.length>b&&(d=Math.floor(b/2),e=a.length-d,a=a.substring(0,d+b%2)+"..."+a.substring(e));c&&(a=goog.string.htmlEscape(a));return a;};goog.string.specialEscapeChars_={"\x00":"\\0","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\x0B",'"':'\\"',"\\":"\\\\","<":"\\u003C"};goog.string.jsEscapeCache_={"'":"\\'"};goog.string.quote=function(a){a=String(a);for(var b=['"'],c=0;ce?d:goog.string.escapeChar(d));}b.push('"');return b.join("");};goog.string.escapeString=function(a){for(var b=[],c=0;cb)var c=a;else {if(256>b){if(c="\\x",16>b||256b&&(c+="0");c+=b.toString(16).toUpperCase();}return goog.string.jsEscapeCache_[a]=c;};goog.string.contains=goog.string.internal.contains;goog.string.caseInsensitiveContains=goog.string.internal.caseInsensitiveContains;goog.string.countOf=function(a,b){return a&&b?a.split(b).length-1:0;};goog.string.removeAt=function(a,b,c){var d=a;0<=b&&b>>0;return b;};goog.string.uniqueStringCounter_=2147483648*Math.random()|0;goog.string.createUniqueString=function(){return "goog_"+goog.string.uniqueStringCounter_++;};goog.string.toNumber=function(a){var b=Number(a);return 0==b&&goog.string.isEmptyOrWhitespace(a)?NaN:b;};goog.string.isLowerCamelCase=function(a){return /^[a-z]+([A-Z][a-z]*)*$/.test(a);};goog.string.isUpperCamelCase=function(a){return /^([A-Z][a-z]*)+$/.test(a);};goog.string.toCamelCase=function(a){return String(a).replace(/\-([a-z])/g,function(b,c){return c.toUpperCase();});};goog.string.toSelectorCase=function(a){return String(a).replace(/([A-Z])/g,"-$1").toLowerCase();};goog.string.toTitleCase=function(a,b){b="string"===typeof b?goog.string.regExpEscape(b):"\\s";return a.replace(new RegExp("(^"+(b?"|["+b+"]+":"")+")([a-z])","g"),function(c,d,e){return d+e.toUpperCase();});};goog.string.capitalize=function(a){return String(a.charAt(0)).toUpperCase()+String(a.substr(1)).toLowerCase();};goog.string.parseInt=function(a){isFinite(a)&&(a=String(a));return "string"===typeof a?/^\s*-?0x/i.test(a)?parseInt(a,16):parseInt(a,10):NaN;};goog.string.splitLimit=function(a,b,c){a=a.split(b);for(var d=[];0c&&(c=e);}return -1==c?a:a.slice(c+1);};goog.string.editDistance=function(a,b){var c=[],d=[];if(a==b)return 0;if(!a.length||!b.length)return Math.max(a.length,b.length);for(var e=0;e=b.length?0:this.getNumberType(a)==i18n.phonenumbers.PhoneNumberType.MOBILE&&(a=i18n.phonenumbers.PhoneNumberUtil.getCountryMobileToken(a.getCountryCodeOrDefault()),""!=a)?b[2].length+a.length:b[1].length;};i18n.phonenumbers.PhoneNumberUtil.getCountryMobileToken=function(a){return i18n.phonenumbers.PhoneNumberUtil.MOBILE_TOKEN_MAPPINGS_[a]||"";};i18n.phonenumbers.PhoneNumberUtil.prototype.getSupportedRegions=function(){return Object.keys(i18n.phonenumbers.metadata.countryToMetadata).filter(function(a){return isNaN(a);});};i18n.phonenumbers.PhoneNumberUtil.prototype.getSupportedGlobalNetworkCallingCodes=function(){return Object.keys(i18n.phonenumbers.metadata.countryToMetadata).filter(function(a){return !isNaN(a);}).map(function(a){return parseInt(a,10);});};i18n.phonenumbers.PhoneNumberUtil.prototype.getSupportedCallingCodes=function(){var a=Object.keys(i18n.phonenumbers.metadata.countryCodeToRegionCodeMap);return [].concat($jscomp.arrayFromIterable(this.getSupportedGlobalNetworkCallingCodes()),$jscomp.arrayFromIterable(a.map(function(b){return parseInt(b,10);})));};i18n.phonenumbers.PhoneNumberUtil.descHasPossibleNumberData_=function(a){return null!=a&&(1!=a.possibleLengthCount()||-1!=a.possibleLengthArray()[0]);};i18n.phonenumbers.PhoneNumberUtil.descHasData_=function(a){return null!=a&&(a.hasExampleNumber()||i18n.phonenumbers.PhoneNumberUtil.descHasPossibleNumberData_(a)||a.hasNationalNumberPattern());};i18n.phonenumbers.PhoneNumberUtil.getSupportedTypesForMetadata_=function(a){var b=[];goog.object.forEach(i18n.phonenumbers.PhoneNumberType,function(c){if(c!=i18n.phonenumbers.PhoneNumberType.FIXED_LINE_OR_MOBILE&&c!=i18n.phonenumbers.PhoneNumberType.UNKNOWN){var d=i18n.phonenumbers.PhoneNumberUtil.getNumberDescByType_(a,c);i18n.phonenumbers.PhoneNumberUtil.descHasData_(d)&&b.push(c);}});return b;};i18n.phonenumbers.PhoneNumberUtil.prototype.getSupportedTypesForRegion=function(a){return this.isValidRegionCode_(a)?i18n.phonenumbers.PhoneNumberUtil.getSupportedTypesForMetadata_(this.getMetadataForRegion(a)):[];};i18n.phonenumbers.PhoneNumberUtil.prototype.getSupportedTypesForNonGeoEntity=function(a){a=this.getMetadataForNonGeographicalRegion(a);return null==a?[]:i18n.phonenumbers.PhoneNumberUtil.getSupportedTypesForMetadata_(a);};i18n.phonenumbers.PhoneNumberUtil.normalizeHelper_=function(a,b,c){for(var d=new goog.string.StringBuffer(),e,f,g=a.length,h=0;h=e||(d=d.substring(0,e),d=i18n.phonenumbers.PhoneNumberUtil.normalizeDigitsOnly(d),0!=d.length&&(b=c.clone(),b.clearNationalPrefixFormattingRule(),b=this.formatByPattern(a,i18n.phonenumbers.PhoneNumberFormat.NATIONAL,[b])));}}a=a.getRawInputOrDefault();null!=b&&0a?i18n.phonenumbers.PhoneNumberUtil.ValidationResult.TOO_SHORT:e[e.length-1]i18n.phonenumbers.PhoneNumberUtil.MAX_INPUT_STRING_LENGTH_)throw Error(i18n.phonenumbers.Error.TOO_LONG);var e=new goog.string.StringBuffer();this.buildNationalNumberForParsing_(a,e);if(!i18n.phonenumbers.PhoneNumberUtil.isViablePhoneNumber(e.toString()))throw Error(i18n.phonenumbers.Error.NOT_A_NUMBER);if(d&&!this.checkRegionForParsing_(e.toString(),b))throw Error(i18n.phonenumbers.Error.INVALID_COUNTRY_CODE);d=new i18n.phonenumbers.PhoneNumber();c&&d.setRawInput(a);a=this.maybeStripExtension(e);0i18n.phonenumbers.PhoneNumberUtil.MAX_LENGTH_FOR_NSN_)throw Error(i18n.phonenumbers.Error.TOO_LONG);i18n.phonenumbers.PhoneNumberUtil.setItalianLeadingZerosForPhoneNumber_(c,d);d.setNationalNumber(parseInt(c,10));return d;};i18n.phonenumbers.PhoneNumberUtil.prototype.buildNationalNumberForParsing_=function(a,b){var c=a.indexOf(i18n.phonenumbers.PhoneNumberUtil.RFC3966_PHONE_CONTEXT_);if(0<=c){var d=c+i18n.phonenumbers.PhoneNumberUtil.RFC3966_PHONE_CONTEXT_.length;if(a.charAt(d)==i18n.phonenumbers.PhoneNumberUtil.PLUS_SIGN){var e=a.indexOf(";",d);0=i18n.phonenumbers.AsYouTypeFormatter.MIN_LEADING_DIGITS_LENGTH_?(this.getAvailableFormats_(a),a=this.attemptToFormatAccruedDigits_(),0=e}},\"es6\",\"es3\");\n$jscomp.findInternal=function(a,b,c){a instanceof String&&(a=String(a));for(var d=a.length,e=0;e=f}},\"es6\",\"es3\");\n$jscomp.polyfill(\"String.prototype.repeat\",function(a){return a?a:function(b){var c=$jscomp.checkStringArgs(this,null,\"repeat\");if(0>b||1342177279>>=1)c+=c;return d}},\"es6\",\"es3\");$jscomp.initSymbol=function(){};\n$jscomp.polyfill(\"Symbol\",function(a){if(a)return a;var b=function(e,f){this.$jscomp$symbol$id_=e;$jscomp.defineProperty(this,\"description\",{configurable:!0,writable:!0,value:f})};b.prototype.toString=function(){return this.$jscomp$symbol$id_};var c=0,d=function(e){if(this instanceof d)throw new TypeError(\"Symbol is not a constructor\");return new b(\"jscomp_symbol_\"+(e||\"\")+\"_\"+c++,e)};return d},\"es6\",\"es3\");\n$jscomp.polyfill(\"Symbol.iterator\",function(a){if(a)return a;a=Symbol(\"Symbol.iterator\");for(var b=\"Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array\".split(\" \"),c=0;cc&&(c=Math.max(c+e,0));c>>0);\ngoog.uidCounter_=0;goog.cloneObject=function(a){var b=goog.typeOf(a);if(\"object\"==b||\"array\"==b){if(\"function\"===typeof a.clone)return a.clone();b=\"array\"==b?[]:{};for(var c in a)b[c]=goog.cloneObject(a[c]);return b}return a};goog.bindNative_=function(a,b,c){return a.call.apply(a.bind,arguments)};\ngoog.bindJs_=function(a,b,c){if(!a)throw Error();if(2\").replace(/'/g,\"'\").replace(/"/g,'\"').replace(/&/g,\"&\"));b&&(a=a.replace(/\\{\\$([^}]+)}/g,function(d,e){return null!=b&&e in b?b[e]:d}));return a};\ngoog.getMsgWithFallback=function(a,b){return a};goog.exportSymbol=function(a,b,c){goog.exportPath_(a,b,!0,c)};goog.exportProperty=function(a,b,c){a[b]=c};goog.inherits=function(a,b){function c(){}c.prototype=b.prototype;a.superClass_=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.base=function(d,e,f){for(var g=Array(arguments.length-2),h=2;h{\"use strict\";class X{constructor(){if(new.target!=String)throw 1;this.x=42}}let q=Reflect.construct(X,[],String);if(q.x!=42||!(q instanceof String))throw 1;for(const a of[2,3]){if(a==2)continue;function f(z={a}){let a=0;return z.a}{function f(){return 0;}}return f()==3}})()')});\na(\"es7\",function(){return b(\"2 ** 2 == 4\")});a(\"es8\",function(){return b(\"async () => 1, true\")});a(\"es9\",function(){return b(\"({...rest} = {}), true\")});a(\"es_next\",function(){return!1});return{target:c,map:d}},goog.Transpiler.prototype.needsTranspile=function(a,b){if(\"always\"==goog.TRANSPILE)return!0;if(\"never\"==goog.TRANSPILE)return!1;if(!this.requiresTranspilation_){var c=this.createRequiresTranspilation_();this.requiresTranspilation_=c.map;this.transpilationTarget_=this.transpilationTarget_||\nc.target}if(a in this.requiresTranspilation_)return this.requiresTranspilation_[a]?!0:!goog.inHtmlDocument_()||\"es6\"!=b||\"noModule\"in goog.global.document.createElement(\"script\")?!1:!0;throw Error(\"Unknown language mode: \"+a);},goog.Transpiler.prototype.transpile=function(a,b){return goog.transpile_(a,b,this.transpilationTarget_)},goog.transpiler_=new goog.Transpiler,goog.protectScriptTag_=function(a){return a.replace(/<\\/(SCRIPT)/ig,\"\\\\x3c/$1\")},goog.DebugLoader_=function(){this.dependencies_={};\nthis.idToPath_={};this.written_={};this.loadingDeps_=[];this.depsToLoad_=[];this.paused_=!1;this.factory_=new goog.DependencyFactory(goog.transpiler_);this.deferredCallbacks_={};this.deferredQueue_=[]},goog.DebugLoader_.prototype.bootstrap=function(a,b){function c(){d&&(goog.global.setTimeout(d,0),d=null)}var d=b;if(a.length){b=[];for(var e=0;e\\x3c/script>';f+=\"\";f=goog.Dependency.defer_?f+(\"document.getElementById('script-\"+e+\"').onload = function() {\\n goog.Dependency.callback_('\"+e+\"', this);\\n};\\n\"):f+(\"goog.Dependency.callback_('\"+e+\"', document.getElementById('script-\"+e+\"'));\");f+=\"\\x3c/script>\";b.write(goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createHTML(f):f)}else{var g=b.createElement(\"script\");g.defer=goog.Dependency.defer_;\ng.async=!1;c&&(g.nonce=c);goog.DebugLoader_.IS_OLD_IE_?(a.pause(),g.onreadystatechange=function(){if(\"loaded\"==g.readyState||\"complete\"==g.readyState)a.loaded(),a.resume()}):g.onload=function(){g.onload=null;a.loaded()};g.src=goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createScriptURL(this.path):this.path;b.head.appendChild(g)}}else goog.logToConsole_(\"Cannot use default debug loader outside of HTML documents.\"),\"deps.js\"==this.relativePath?(goog.logToConsole_(\"Consider setting CLOSURE_IMPORT_SCRIPT before loading base.js, or setting CLOSURE_NO_DEPS to true.\"),\na.loaded()):a.pause()},goog.Es6ModuleDependency=function(a,b,c,d,e){goog.Dependency.call(this,a,b,c,d,e)},goog.inherits(goog.Es6ModuleDependency,goog.Dependency),goog.Es6ModuleDependency.prototype.load=function(a){function b(l,p){var m=\"\",n=goog.getScriptNonce();n&&(m=' nonce=\"'+n+'\"');l=p?'