diff --git a/.gitignore b/.gitignore index 58324be04..ac1a8fe3f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .DS_Store node_modules coverage +coverage.lcov .nyc_output package-lock.json yarn.lock diff --git a/.travis.yml b/.travis.yml index 6833ce4c2..0681de748 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,5 +10,6 @@ node_js: - 6 notifications: email: false -after_script: - - npm install coveralls & coveralls +after_success: + - npm install -g codecov + - npm run test:ci > coverage.lcov && codecov diff --git a/README.md b/README.md index d1a6fd723..1e09b96ba 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![NPM version][npm-image]][npm-url] [![Build Status](https://travis-ci.org/validatorjs/validator.js.svg?branch=master)](https://travis-ci.org/validatorjs/validator.js) -[![Coverage Status](https://coveralls.io/repos/github/validatorjs/validator.js/badge.svg?branch=master)](https://coveralls.io/github/validatorjs/validator.js?branch=master) +[![codecov](https://codecov.io/gh/validatorjs/validator.js/branch/master/graph/badge.svg)](https://codecov.io/gh/validatorjs/validator.js) [![Downloads][downloads-image]][npm-url] [![Backers on Open Collective](https://opencollective.com/validatorjs/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/validatorjs/sponsors/badge.svg)](#sponsors) diff --git a/es/lib/alpha.js b/es/lib/alpha.js index 38d385b7c..a5c6976a4 100644 --- a/es/lib/alpha.js +++ b/es/lib/alpha.js @@ -22,6 +22,7 @@ export var alpha = { 'sv-SE': /^[A-ZÅÄÖ]+$/i, 'tr-TR': /^[A-ZÇĞİıÖŞÜ]+$/i, 'uk-UA': /^[А-ЩЬЮЯЄIЇҐі]+$/i, + 'vi-VN': /^[A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i, 'ku-IQ': /^[ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i, ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/, he: /^[א-ת]+$/, @@ -52,6 +53,7 @@ export var alphanumeric = { 'tr-TR': /^[0-9A-ZÇĞİıÖŞÜ]+$/i, 'uk-UA': /^[0-9А-ЩЬЮЯЄIЇҐі]+$/i, 'ku-IQ': /^[٠١٢٣٤٥٦٧٨٩0-9ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i, + 'vi-VN': /^[0-9A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i, ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/, he: /^[0-9א-ת]+$/, 'fa-IR': /^['0-9آابپتثجچهخدذرزژسشصضطظعغفقکگلمنوهی۱۲۳۴۵۶۷۸۹۰']+$/i @@ -81,7 +83,7 @@ for (var _locale, _i = 0; _i < arabicLocales.length; _i++) { export var dotDecimal = ['ar-EG', 'ar-LB', 'ar-LY']; -export var commaDecimal = ['bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-ZM', 'es-ES', 'fr-FR', 'it-IT', 'ku-IQ', 'hu-HU', 'nb-NO', 'nn-NO', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'sl-SI', 'sr-RS@latin', 'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA']; +export var commaDecimal = ['bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-ZM', 'es-ES', 'fr-FR', 'it-IT', 'ku-IQ', 'hu-HU', 'nb-NO', 'nn-NO', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'sl-SI', 'sr-RS@latin', 'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA', 'vi-VN']; for (var _i2 = 0; _i2 < dotDecimal.length; _i2++) { decimal[dotDecimal[_i2]] = decimal['en-US']; diff --git a/es/lib/isIdentityCard.js b/es/lib/isIdentityCard.js index de8714aeb..7ba8962a4 100644 --- a/es/lib/isIdentityCard.js +++ b/es/lib/isIdentityCard.js @@ -51,11 +51,6 @@ var validators = { var f = sanitized.split('').map(Number); var k1 = (11 - (3 * f[0] + 7 * f[1] + 6 * f[2] + 1 * f[3] + 8 * f[4] + 9 * f[5] + 4 * f[6] + 5 * f[7] + 2 * f[8]) % 11) % 11; var k2 = (11 - (5 * f[0] + 4 * f[1] + 3 * f[2] + 2 * f[3] + 7 * f[4] + 6 * f[5] + 5 * f[6] + 4 * f[7] + 3 * f[8] + 2 * k1) % 11) % 11; - - if (k1 === 11) { - k1 = 0; - } - if (k1 !== f[9] || k2 !== f[10]) return false; return true; }, @@ -92,56 +87,50 @@ var validators = { return true; }, 'zh-CN': function zhCN(str) { - var provinceAndCitys = { - 11: '北京', - 12: '天津', - 13: '河北', - 14: '山西', - 15: '内蒙古', - 21: '辽宁', - 22: '吉林', - 23: '黑龙江', - 31: '上海', - 32: '江苏', - 33: '浙江', - 34: '安徽', - 35: '福建', - 36: '江西', - 37: '山东', - 41: '河南', - 42: '湖北', - 43: '湖南', - 44: '广东', - 45: '广西', - 46: '海南', - 50: '重庆', - 51: '四川', - 52: '贵州', - 53: '云南', - 54: '西藏', - 61: '陕西', - 62: '甘肃', - 63: '青海', - 64: '宁夏', - 65: '新疆', - 71: '台湾', - 81: '香港', - 82: '澳门', - 91: '国外' - }; + var provincesAndCities = ['11', // 北京 + '12', // 天津 + '13', // 河北 + '14', // 山西 + '15', // 内蒙古 + '21', // 辽宁 + '22', // 吉林 + '23', // 黑龙江 + '31', // 上海 + '32', // 江苏 + '33', // 浙江 + '34', // 安徽 + '35', // 福建 + '36', // 江西 + '37', // 山东 + '41', // 河南 + '42', // 湖北 + '43', // 湖南 + '44', // 广东 + '45', // 广西 + '46', // 海南 + '50', // 重庆 + '51', // 四川 + '52', // 贵州 + '53', // 云南 + '54', // 西藏 + '61', // 陕西 + '62', // 甘肃 + '63', // 青海 + '64', // 宁夏 + '65', // 新疆 + '71', // 台湾 + '81', // 香港 + '82', // 澳门 + '91' // 国外 + ]; var powers = ['7', '9', '10', '5', '8', '4', '2', '1', '6', '3', '7', '9', '10', '5', '8', '4', '2']; var parityBit = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2']; var checkAddressCode = function checkAddressCode(addressCode) { - var check = /^[1-9]\d{5}$/.test(addressCode); - if (!check) return false; // eslint-disable-next-line radix - - return !!provinceAndCitys[Number.parseInt(addressCode.substring(0, 2))]; + return provincesAndCities.includes(addressCode); }; var checkBirthDayCode = function checkBirthDayCode(birDayCode) { - var check = /^[1-9]\d{3}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))$/.test(birDayCode); - if (!check) return false; var yyyy = parseInt(birDayCode.substring(0, 4), 10); var mm = parseInt(birDayCode.substring(4, 6), 10); var dd = parseInt(birDayCode.substring(6), 10); @@ -161,8 +150,7 @@ var validators = { var power = 0; for (var i = 0; i < 17; i++) { - // eslint-disable-next-line radix - power += parseInt(id17.charAt(i), 10) * Number.parseInt(powers[i]); + power += parseInt(id17.charAt(i), 10) * parseInt(powers[i], 10); } var mod = power % 11; @@ -176,19 +164,19 @@ var validators = { var check15IdCardNo = function check15IdCardNo(idCardNo) { var check = /^[1-9]\d{7}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}$/.test(idCardNo); if (!check) return false; - var addressCode = idCardNo.substring(0, 6); + var addressCode = idCardNo.substring(0, 2); check = checkAddressCode(addressCode); if (!check) return false; var birDayCode = "19".concat(idCardNo.substring(6, 12)); check = checkBirthDayCode(birDayCode); if (!check) return false; - return checkParityBit(idCardNo); + return true; }; var check18IdCardNo = function check18IdCardNo(idCardNo) { var check = /^[1-9]\d{5}[1-9]\d{3}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}(\d|x|X)$/.test(idCardNo); if (!check) return false; - var addressCode = idCardNo.substring(0, 6); + var addressCode = idCardNo.substring(0, 2); check = checkAddressCode(addressCode); if (!check) return false; var birDayCode = idCardNo.substring(6, 14); @@ -203,11 +191,9 @@ var validators = { if (idCardNo.length === 15) { return check15IdCardNo(idCardNo); - } else if (idCardNo.length === 18) { - return check18IdCardNo(idCardNo); } - return false; + return check18IdCardNo(idCardNo); }; return checkIdCardNo(str); diff --git a/es/lib/isMobilePhone.js b/es/lib/isMobilePhone.js index 9c1bc865c..354896e3e 100644 --- a/es/lib/isMobilePhone.js +++ b/es/lib/isMobilePhone.js @@ -14,6 +14,7 @@ var phones = { 'ar-SA': /^(!?(\+?966)|0)?5\d{8}$/, 'ar-SY': /^(!?(\+?963)|0)?9\d{8}$/, 'ar-TN': /^(\+?216)?[2459]\d{7}$/, + 'bs-BA': /^((((\+|00)3876)|06))((([0-3]|[5-6])\d{6})|(4\d{7}))$/, 'be-BY': /^(\+?375)?(24|25|29|33|44)\d{7}$/, 'bg-BG': /^(\+?359|0)?8[789]\d{7}$/, 'bn-BD': /^(\+?880|0)1[13456789][0-9]{8}$/, @@ -50,7 +51,7 @@ var phones = { 'es-CL': /^(\+?56|0)[2-9]\d{1}\d{7}$/, 'es-CR': /^(\+506)?[2-8]\d{7}$/, 'es-EC': /^(\+?593|0)([2-7]|9[2-9])\d{7}$/, - 'es-ES': /^(\+?34)?(6\d{1}|7[1234])\d{7}$/, + 'es-ES': /^(\+?34)?[6|7]\d{8}$/, 'es-MX': /^(\+?52)?(1|01)?\d{10,11}$/, 'es-PA': /^(\+?507)\d{7,8}$/, 'es-PY': /^(\+?595|0)9[9876]\d{7}$/, @@ -93,7 +94,7 @@ var phones = { 'tr-TR': /^(\+?90|0)?5\d{9}$/, 'uk-UA': /^(\+?38|8)?0\d{9}$/, 'vi-VN': /^(\+?84|0)((3([2-9]))|(5([2689]))|(7([0|6-9]))|(8([1-6|89]))|(9([0-9])))([0-9]{7})$/, - 'zh-CN': /^((\+|00)86)?1([3568][0-9]|4[579]|6[67]|7[01235678]|9[189])[0-9]{8}$/, + 'zh-CN': /^((\+|00)86)?1([3568][0-9]|4[579]|6[67]|7[01235678]|9[012356789])[0-9]{8}$/, 'zh-TW': /^(\+?886\-?|0)?9\d{8}$/ }; /* eslint-enable max-len */ diff --git a/es/lib/isPostalCode.js b/es/lib/isPostalCode.js index 0e0cf7ec0..ad27dd727 100644 --- a/es/lib/isPostalCode.js +++ b/es/lib/isPostalCode.js @@ -18,7 +18,7 @@ var patterns = { DK: fourDigit, DZ: fiveDigit, EE: fiveDigit, - ES: fiveDigit, + ES: /^(5[0-2]{1}|[0-4]{1}\d{1})\d{3}$/, FI: fiveDigit, FR: /^\d{2}\s?\d{3}$/, GB: /^(gir\s?0aa|[a-z]{1,2}\d[\da-z]?\s?(\d[a-z]{2})?)$/i, @@ -27,7 +27,7 @@ var patterns = { HU: fourDigit, ID: fiveDigit, IE: /^(?!.*(?:o))[A-z]\d[\dw]\s\w{4}$/i, - IL: fiveDigit, + IL: /^(\d{5}|\d{7})$/, IN: /^((?!10|29|35|54|55|65|66|86|87|88|89)[1-9][0-9]{5})$/, IS: threeDigit, IT: fiveDigit, diff --git a/es/lib/isSemVer.js b/es/lib/isSemVer.js index d9b51eb5e..f6dd9bd73 100644 --- a/es/lib/isSemVer.js +++ b/es/lib/isSemVer.js @@ -7,7 +7,7 @@ import multilineRegexp from './util/multilineRegex'; * Reference: https://semver.org/ */ -var semanticVersioningRegex = multilineRegexp(['^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)', '(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))', '?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$']); +var semanticVersioningRegex = multilineRegexp(['^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)', '(?:-((?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*))*))', '?(?:\\+([0-9a-z-]+(?:\\.[0-9a-z-]+)*))?$'], 'i'); export default function isSemVer(str) { assertString(str); return semanticVersioningRegex.test(str); diff --git a/es/lib/isTaxID.js b/es/lib/isTaxID.js index 500a76211..bc25e3fc1 100644 --- a/es/lib/isTaxID.js +++ b/es/lib/isTaxID.js @@ -48,6 +48,8 @@ function getPrefixes(locale) { var prefixes = []; for (var location in campusPrefix[locale]) { + // https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes + // istanbul ignore else if (campusPrefix[locale].hasOwnProperty(location)) { prefixes.push.apply(prefixes, _toConsumableArray(campusPrefix[locale][location])); } @@ -55,7 +57,7 @@ function getPrefixes(locale) { prefixes.sort(); return prefixes; -} // tax id regex formats for various loacles +} // tax id regex formats for various locales var taxIdFormat = { @@ -65,9 +67,13 @@ export default function isTaxID(str) { var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en-US'; assertString(str); - if (!taxIdFormat[locale].test(str)) { - return false; + if (locale in taxIdFormat) { + if (!taxIdFormat[locale].test(str)) { + return false; + } + + return getPrefixes(locale).indexOf(str.substr(0, 2)) !== -1; } - return getPrefixes(locale).indexOf(str.substr(0, 2)) !== -1; + throw new Error("Invalid locale '".concat(locale, "'")); } \ No newline at end of file diff --git a/es/lib/util/multilineRegex.js b/es/lib/util/multilineRegex.js index 2a344a70a..fed25a372 100644 --- a/es/lib/util/multilineRegex.js +++ b/es/lib/util/multilineRegex.js @@ -6,8 +6,7 @@ * @param {string} flags * @return {object} - RegExp object */ -export default function multilineRegexp(parts) { - var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; +export default function multilineRegexp(parts, flags) { var regexpAsStringLiteral = parts.join(''); return new RegExp(regexpAsStringLiteral, flags); } \ No newline at end of file diff --git a/lib/alpha.js b/lib/alpha.js index 7c43b56b3..4091f3004 100644 --- a/lib/alpha.js +++ b/lib/alpha.js @@ -28,6 +28,7 @@ var alpha = { 'sv-SE': /^[A-ZÅÄÖ]+$/i, 'tr-TR': /^[A-ZÇĞİıÖŞÜ]+$/i, 'uk-UA': /^[А-ЩЬЮЯЄIЇҐі]+$/i, + 'vi-VN': /^[A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i, 'ku-IQ': /^[ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i, ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/, he: /^[א-ת]+$/, @@ -59,6 +60,7 @@ var alphanumeric = { 'tr-TR': /^[0-9A-ZÇĞİıÖŞÜ]+$/i, 'uk-UA': /^[0-9А-ЩЬЮЯЄIЇҐі]+$/i, 'ku-IQ': /^[٠١٢٣٤٥٦٧٨٩0-9ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i, + 'vi-VN': /^[0-9A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i, ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/, he: /^[0-9א-ת]+$/, 'fa-IR': /^['0-9آابپتثجچهخدذرزژسشصضطظعغفقکگلمنوهی۱۲۳۴۵۶۷۸۹۰']+$/i @@ -93,7 +95,7 @@ for (var _locale, _i = 0; _i < arabicLocales.length; _i++) { var dotDecimal = ['ar-EG', 'ar-LB', 'ar-LY']; exports.dotDecimal = dotDecimal; -var commaDecimal = ['bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-ZM', 'es-ES', 'fr-FR', 'it-IT', 'ku-IQ', 'hu-HU', 'nb-NO', 'nn-NO', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'sl-SI', 'sr-RS@latin', 'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA']; +var commaDecimal = ['bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-ZM', 'es-ES', 'fr-FR', 'it-IT', 'ku-IQ', 'hu-HU', 'nb-NO', 'nn-NO', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'sl-SI', 'sr-RS@latin', 'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA', 'vi-VN']; exports.commaDecimal = commaDecimal; for (var _i2 = 0; _i2 < dotDecimal.length; _i2++) { diff --git a/lib/isIdentityCard.js b/lib/isIdentityCard.js index 7f5c63d5d..b120faee7 100644 --- a/lib/isIdentityCard.js +++ b/lib/isIdentityCard.js @@ -61,11 +61,6 @@ var validators = { var f = sanitized.split('').map(Number); var k1 = (11 - (3 * f[0] + 7 * f[1] + 6 * f[2] + 1 * f[3] + 8 * f[4] + 9 * f[5] + 4 * f[6] + 5 * f[7] + 2 * f[8]) % 11) % 11; var k2 = (11 - (5 * f[0] + 4 * f[1] + 3 * f[2] + 2 * f[3] + 7 * f[4] + 6 * f[5] + 5 * f[6] + 4 * f[7] + 3 * f[8] + 2 * k1) % 11) % 11; - - if (k1 === 11) { - k1 = 0; - } - if (k1 !== f[9] || k2 !== f[10]) return false; return true; }, @@ -102,56 +97,50 @@ var validators = { return true; }, 'zh-CN': function zhCN(str) { - var provinceAndCitys = { - 11: '北京', - 12: '天津', - 13: '河北', - 14: '山西', - 15: '内蒙古', - 21: '辽宁', - 22: '吉林', - 23: '黑龙江', - 31: '上海', - 32: '江苏', - 33: '浙江', - 34: '安徽', - 35: '福建', - 36: '江西', - 37: '山东', - 41: '河南', - 42: '湖北', - 43: '湖南', - 44: '广东', - 45: '广西', - 46: '海南', - 50: '重庆', - 51: '四川', - 52: '贵州', - 53: '云南', - 54: '西藏', - 61: '陕西', - 62: '甘肃', - 63: '青海', - 64: '宁夏', - 65: '新疆', - 71: '台湾', - 81: '香港', - 82: '澳门', - 91: '国外' - }; + var provincesAndCities = ['11', // 北京 + '12', // 天津 + '13', // 河北 + '14', // 山西 + '15', // 内蒙古 + '21', // 辽宁 + '22', // 吉林 + '23', // 黑龙江 + '31', // 上海 + '32', // 江苏 + '33', // 浙江 + '34', // 安徽 + '35', // 福建 + '36', // 江西 + '37', // 山东 + '41', // 河南 + '42', // 湖北 + '43', // 湖南 + '44', // 广东 + '45', // 广西 + '46', // 海南 + '50', // 重庆 + '51', // 四川 + '52', // 贵州 + '53', // 云南 + '54', // 西藏 + '61', // 陕西 + '62', // 甘肃 + '63', // 青海 + '64', // 宁夏 + '65', // 新疆 + '71', // 台湾 + '81', // 香港 + '82', // 澳门 + '91' // 国外 + ]; var powers = ['7', '9', '10', '5', '8', '4', '2', '1', '6', '3', '7', '9', '10', '5', '8', '4', '2']; var parityBit = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2']; var checkAddressCode = function checkAddressCode(addressCode) { - var check = /^[1-9]\d{5}$/.test(addressCode); - if (!check) return false; // eslint-disable-next-line radix - - return !!provinceAndCitys[Number.parseInt(addressCode.substring(0, 2))]; + return provincesAndCities.includes(addressCode); }; var checkBirthDayCode = function checkBirthDayCode(birDayCode) { - var check = /^[1-9]\d{3}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))$/.test(birDayCode); - if (!check) return false; var yyyy = parseInt(birDayCode.substring(0, 4), 10); var mm = parseInt(birDayCode.substring(4, 6), 10); var dd = parseInt(birDayCode.substring(6), 10); @@ -171,8 +160,7 @@ var validators = { var power = 0; for (var i = 0; i < 17; i++) { - // eslint-disable-next-line radix - power += parseInt(id17.charAt(i), 10) * Number.parseInt(powers[i]); + power += parseInt(id17.charAt(i), 10) * parseInt(powers[i], 10); } var mod = power % 11; @@ -186,19 +174,19 @@ var validators = { var check15IdCardNo = function check15IdCardNo(idCardNo) { var check = /^[1-9]\d{7}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}$/.test(idCardNo); if (!check) return false; - var addressCode = idCardNo.substring(0, 6); + var addressCode = idCardNo.substring(0, 2); check = checkAddressCode(addressCode); if (!check) return false; var birDayCode = "19".concat(idCardNo.substring(6, 12)); check = checkBirthDayCode(birDayCode); if (!check) return false; - return checkParityBit(idCardNo); + return true; }; var check18IdCardNo = function check18IdCardNo(idCardNo) { var check = /^[1-9]\d{5}[1-9]\d{3}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}(\d|x|X)$/.test(idCardNo); if (!check) return false; - var addressCode = idCardNo.substring(0, 6); + var addressCode = idCardNo.substring(0, 2); check = checkAddressCode(addressCode); if (!check) return false; var birDayCode = idCardNo.substring(6, 14); @@ -213,11 +201,9 @@ var validators = { if (idCardNo.length === 15) { return check15IdCardNo(idCardNo); - } else if (idCardNo.length === 18) { - return check18IdCardNo(idCardNo); } - return false; + return check18IdCardNo(idCardNo); }; return checkIdCardNo(str); diff --git a/lib/isMobilePhone.js b/lib/isMobilePhone.js index d4868cba8..ff8486582 100644 --- a/lib/isMobilePhone.js +++ b/lib/isMobilePhone.js @@ -24,6 +24,7 @@ var phones = { 'ar-SA': /^(!?(\+?966)|0)?5\d{8}$/, 'ar-SY': /^(!?(\+?963)|0)?9\d{8}$/, 'ar-TN': /^(\+?216)?[2459]\d{7}$/, + 'bs-BA': /^((((\+|00)3876)|06))((([0-3]|[5-6])\d{6})|(4\d{7}))$/, 'be-BY': /^(\+?375)?(24|25|29|33|44)\d{7}$/, 'bg-BG': /^(\+?359|0)?8[789]\d{7}$/, 'bn-BD': /^(\+?880|0)1[13456789][0-9]{8}$/, @@ -60,7 +61,7 @@ var phones = { 'es-CL': /^(\+?56|0)[2-9]\d{1}\d{7}$/, 'es-CR': /^(\+506)?[2-8]\d{7}$/, 'es-EC': /^(\+?593|0)([2-7]|9[2-9])\d{7}$/, - 'es-ES': /^(\+?34)?(6\d{1}|7[1234])\d{7}$/, + 'es-ES': /^(\+?34)?[6|7]\d{8}$/, 'es-MX': /^(\+?52)?(1|01)?\d{10,11}$/, 'es-PA': /^(\+?507)\d{7,8}$/, 'es-PY': /^(\+?595|0)9[9876]\d{7}$/, @@ -103,7 +104,7 @@ var phones = { 'tr-TR': /^(\+?90|0)?5\d{9}$/, 'uk-UA': /^(\+?38|8)?0\d{9}$/, 'vi-VN': /^(\+?84|0)((3([2-9]))|(5([2689]))|(7([0|6-9]))|(8([1-6|89]))|(9([0-9])))([0-9]{7})$/, - 'zh-CN': /^((\+|00)86)?1([3568][0-9]|4[579]|6[67]|7[01235678]|9[189])[0-9]{8}$/, + 'zh-CN': /^((\+|00)86)?1([3568][0-9]|4[579]|6[67]|7[01235678]|9[012356789])[0-9]{8}$/, 'zh-TW': /^(\+?886\-?|0)?9\d{8}$/ }; /* eslint-enable max-len */ diff --git a/lib/isPostalCode.js b/lib/isPostalCode.js index 333152fba..d9efc7706 100644 --- a/lib/isPostalCode.js +++ b/lib/isPostalCode.js @@ -29,7 +29,7 @@ var patterns = { DK: fourDigit, DZ: fiveDigit, EE: fiveDigit, - ES: fiveDigit, + ES: /^(5[0-2]{1}|[0-4]{1}\d{1})\d{3}$/, FI: fiveDigit, FR: /^\d{2}\s?\d{3}$/, GB: /^(gir\s?0aa|[a-z]{1,2}\d[\da-z]?\s?(\d[a-z]{2})?)$/i, @@ -38,7 +38,7 @@ var patterns = { HU: fourDigit, ID: fiveDigit, IE: /^(?!.*(?:o))[A-z]\d[\dw]\s\w{4}$/i, - IL: fiveDigit, + IL: /^(\d{5}|\d{7})$/, IN: /^((?!10|29|35|54|55|65|66|86|87|88|89)[1-9][0-9]{5})$/, IS: threeDigit, IT: fiveDigit, diff --git a/lib/isSemVer.js b/lib/isSemVer.js index 23cb2a70d..27355cd1e 100644 --- a/lib/isSemVer.js +++ b/lib/isSemVer.js @@ -17,7 +17,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de * built from multi-line, multi-parts regexp * Reference: https://semver.org/ */ -var semanticVersioningRegex = (0, _multilineRegex.default)(['^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)', '(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))', '?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$']); +var semanticVersioningRegex = (0, _multilineRegex.default)(['^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)', '(?:-((?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*))*))', '?(?:\\+([0-9a-z-]+(?:\\.[0-9a-z-]+)*))?$'], 'i'); function isSemVer(str) { (0, _assertString.default)(str); diff --git a/lib/isTaxID.js b/lib/isTaxID.js index 4b6426576..aff61f0e7 100644 --- a/lib/isTaxID.js +++ b/lib/isTaxID.js @@ -57,6 +57,8 @@ function getPrefixes(locale) { var prefixes = []; for (var location in campusPrefix[locale]) { + // https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes + // istanbul ignore else if (campusPrefix[locale].hasOwnProperty(location)) { prefixes.push.apply(prefixes, _toConsumableArray(campusPrefix[locale][location])); } @@ -64,7 +66,7 @@ function getPrefixes(locale) { prefixes.sort(); return prefixes; -} // tax id regex formats for various loacles +} // tax id regex formats for various locales var taxIdFormat = { @@ -75,11 +77,15 @@ function isTaxID(str) { var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en-US'; (0, _assertString.default)(str); - if (!taxIdFormat[locale].test(str)) { - return false; + if (locale in taxIdFormat) { + if (!taxIdFormat[locale].test(str)) { + return false; + } + + return getPrefixes(locale).indexOf(str.substr(0, 2)) !== -1; } - return getPrefixes(locale).indexOf(str.substr(0, 2)) !== -1; + throw new Error("Invalid locale '".concat(locale, "'")); } module.exports = exports.default; diff --git a/lib/util/multilineRegex.js b/lib/util/multilineRegex.js index 0879ca905..6980d14d4 100644 --- a/lib/util/multilineRegex.js +++ b/lib/util/multilineRegex.js @@ -13,8 +13,7 @@ exports.default = multilineRegexp; * @param {string} flags * @return {object} - RegExp object */ -function multilineRegexp(parts) { - var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; +function multilineRegexp(parts, flags) { var regexpAsStringLiteral = parts.join(''); return new RegExp(regexpAsStringLiteral, flags); } diff --git a/package.json b/package.json index 5062eeecf..5276e1f98 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,8 @@ "build:node": "babel src -d .", "build": "npm run build:browser && npm run build:node && npm run build:es", "pretest": "npm run lint && npm run build", - "test": "nyc mocha --require @babel/register --reporter dot" + "test": "nyc mocha --require @babel/register --reporter dot", + "test:ci": "nyc report --reporter=text-lcov" }, "engines": { "node": ">= 0.10" diff --git a/src/lib/isIdentityCard.js b/src/lib/isIdentityCard.js index 4fc5c8385..a2172f526 100644 --- a/src/lib/isIdentityCard.js +++ b/src/lib/isIdentityCard.js @@ -89,10 +89,7 @@ const validators = { let k2 = (11 - (((5 * f[0]) + (4 * f[1]) + (3 * f[2]) + (2 * f[3]) + (7 * f[4]) + (6 * f[5]) + (5 * f[6]) + (4 * f[7]) + (3 * f[8]) + (2 * k1)) % 11)) % 11; - // this block where k1 === 11 need to be tested - if (k1 === 11) { - k1 = 0; - } + if (k1 !== f[9] || k2 !== f[10]) return false; return true; }, @@ -130,64 +127,62 @@ const validators = { return true; }, 'zh-CN': (str) => { - const provinceAndCitys = { - 11: '北京', - 12: '天津', - 13: '河北', - 14: '山西', - 15: '内蒙古', - 21: '辽宁', - 22: '吉林', - 23: '黑龙江', - 31: '上海', - 32: '江苏', - 33: '浙江', - 34: '安徽', - 35: '福建', - 36: '江西', - 37: '山东', - 41: '河南', - 42: '湖北', - 43: '湖南', - 44: '广东', - 45: '广西', - 46: '海南', - 50: '重庆', - 51: '四川', - 52: '贵州', - 53: '云南', - 54: '西藏', - 61: '陕西', - 62: '甘肃', - 63: '青海', - 64: '宁夏', - 65: '新疆', - 71: '台湾', - 81: '香港', - 82: '澳门', - 91: '国外', - }; + const provincesAndCities = [ + '11', // 北京 + '12', // 天津 + '13', // 河北 + '14', // 山西 + '15', // 内蒙古 + '21', // 辽宁 + '22', // 吉林 + '23', // 黑龙江 + '31', // 上海 + '32', // 江苏 + '33', // 浙江 + '34', // 安徽 + '35', // 福建 + '36', // 江西 + '37', // 山东 + '41', // 河南 + '42', // 湖北 + '43', // 湖南 + '44', // 广东 + '45', // 广西 + '46', // 海南 + '50', // 重庆 + '51', // 四川 + '52', // 贵州 + '53', // 云南 + '54', // 西藏 + '61', // 陕西 + '62', // 甘肃 + '63', // 青海 + '64', // 宁夏 + '65', // 新疆 + '71', // 台湾 + '81', // 香港 + '82', // 澳门 + '91', // 国外 + ]; const powers = ['7', '9', '10', '5', '8', '4', '2', '1', '6', '3', '7', '9', '10', '5', '8', '4', '2']; const parityBit = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2']; - const checkAddressCode = (addressCode) => { - let check = /^[1-9]\d{5}$/.test(addressCode); - if (!check) return false; - // eslint-disable-next-line radix - return !!provinceAndCitys[Number.parseInt(addressCode.substring(0, 2))]; - }; + const checkAddressCode = addressCode => provincesAndCities.includes(addressCode); const checkBirthDayCode = (birDayCode) => { - let check = /^[1-9]\d{3}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))$/.test(birDayCode); - if (!check) return false; const yyyy = parseInt(birDayCode.substring(0, 4), 10); const mm = parseInt(birDayCode.substring(4, 6), 10); const dd = parseInt(birDayCode.substring(6), 10); const xdata = new Date(yyyy, mm - 1, dd); - if (xdata > new Date()) return false; - return true; + if (xdata > new Date()) { + return false; + // eslint-disable-next-line max-len + } else if ((xdata.getFullYear() === yyyy) && (xdata.getMonth() === mm - 1) && (xdata.getDate() === dd)) { + return true; + } + return false; }; const getParityBit = (idCardNo) => { @@ -195,8 +190,7 @@ const validators = { let power = 0; for (let i = 0; i < 17; i++) { - // eslint-disable-next-line radix - power += parseInt(id17.charAt(i), 10) * Number.parseInt(powers[i]); + power += parseInt(id17.charAt(i), 10) * parseInt(powers[i], 10); } let mod = power % 11; @@ -209,20 +203,19 @@ const validators = { const check15IdCardNo = (idCardNo) => { let check = /^[1-9]\d{7}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}$/.test(idCardNo); if (!check) return false; - let addressCode = idCardNo.substring(0, 6); + let addressCode = idCardNo.substring(0, 2); check = checkAddressCode(addressCode); if (!check) return false; let birDayCode = `19${idCardNo.substring(6, 12)}`; check = checkBirthDayCode(birDayCode); if (!check) return false; - // since this is 15 id card no, no need to check parity in charAt(17) return true; }; const check18IdCardNo = (idCardNo) => { let check = /^[1-9]\d{5}[1-9]\d{3}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}(\d|x|X)$/.test(idCardNo); if (!check) return false; - let addressCode = idCardNo.substring(0, 6); + let addressCode = idCardNo.substring(0, 2); check = checkAddressCode(addressCode); if (!check) return false; let birDayCode = idCardNo.substring(6, 14); @@ -233,9 +226,11 @@ const validators = { const checkIdCardNo = (idCardNo) => { let check = /^\d{15}|(\d{17}(\d|x|X))$/.test(idCardNo); - if (check && idCardNo.length === 15) return check15IdCardNo(idCardNo); - if (check && idCardNo.length === 18) return check18IdCardNo(idCardNo); - return false; + if (!check) return false; + if (idCardNo.length === 15) { + return check15IdCardNo(idCardNo); + } + return check18IdCardNo(idCardNo); }; return checkIdCardNo(str); }, diff --git a/src/lib/isSemVer.js b/src/lib/isSemVer.js index f685771db..172d36496 100644 --- a/src/lib/isSemVer.js +++ b/src/lib/isSemVer.js @@ -9,9 +9,9 @@ import multilineRegexp from './util/multilineRegex'; */ const semanticVersioningRegex = multilineRegexp([ '^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)', - '(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))', - '?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$', -]); + '(?:-((?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*))*))', + '?(?:\\+([0-9a-z-]+(?:\\.[0-9a-z-]+)*))?$', +], 'i'); export default function isSemVer(str) { assertString(str); diff --git a/src/lib/isTaxID.js b/src/lib/isTaxID.js index 6d607a271..30a6b561b 100644 --- a/src/lib/isTaxID.js +++ b/src/lib/isTaxID.js @@ -39,6 +39,8 @@ function getPrefixes(locale) { const prefixes = []; for (const location in campusPrefix[locale]) { + // https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes + // istanbul ignore else if (campusPrefix[locale].hasOwnProperty(location)) { prefixes.push(...campusPrefix[locale][location]); } @@ -49,7 +51,7 @@ function getPrefixes(locale) { return prefixes; } -// tax id regex formats for various loacles +// tax id regex formats for various locales const taxIdFormat = { @@ -60,9 +62,12 @@ const taxIdFormat = { export default function isTaxID(str, locale = 'en-US') { assertString(str); - if (!taxIdFormat[locale].test(str)) { - return false; + if (locale in taxIdFormat) { + if (!taxIdFormat[locale].test(str)) { + return false; + } + return getPrefixes(locale).indexOf(str.substr(0, 2)) !== -1; } - return getPrefixes(locale).indexOf(str.substr(0, 2)) !== -1; + throw new Error(`Invalid locale '${locale}'`); } diff --git a/src/lib/util/multilineRegex.js b/src/lib/util/multilineRegex.js index e8d21229d..706d8a639 100644 --- a/src/lib/util/multilineRegex.js +++ b/src/lib/util/multilineRegex.js @@ -6,7 +6,7 @@ * @param {string} flags * @return {object} - RegExp object */ -export default function multilineRegexp(parts, flags = '') { +export default function multilineRegexp(parts, flags) { const regexpAsStringLiteral = parts.join(''); return new RegExp(regexpAsStringLiteral, flags); diff --git a/test/validators.js b/test/validators.js index 824ee3302..ad5393e83 100755 --- a/test/validators.js +++ b/test/validators.js @@ -4116,6 +4116,7 @@ describe('Validators', () => { ], invalid: [ '09053426699', + '00000000000', '26028338724', '92031470790', ], @@ -4190,10 +4191,18 @@ describe('Validators', () => { '235407195106112745', '210203197503102721', '520323197806058856', - '235477190110989', + '110101491001001', ], invalid: [ + '160323197806058856', + '010203197503102721', + '520323297806058856', + '520323197802318856', '235407195106112742', + '010101491001001', + '110101491041001', + '160101491001001', + '110101940231001', 'xx1234567', '135407195106112742', '123456789546', @@ -8608,6 +8617,19 @@ describe('Validators', () => { '01 1234567', '01 1234 567'], }); + test({ + validator: 'isTaxID', + args: ['is-NOT'], + error: [ + '01-1234567', + '01 1234567', + '011234567', + '0-11234567', + '01#1234567', + '01 1234567', + '01 1234 567', + ], + }); }); diff --git a/validator.js b/validator.js index e8495ef28..a7ee94d8d 100644 --- a/validator.js +++ b/validator.js @@ -223,6 +223,7 @@ var alpha = { 'sv-SE': /^[A-ZÅÄÖ]+$/i, 'tr-TR': /^[A-ZÇĞİıÖŞÜ]+$/i, 'uk-UA': /^[А-ЩЬЮЯЄIЇҐі]+$/i, + 'vi-VN': /^[A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i, 'ku-IQ': /^[ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i, ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/, he: /^[א-ת]+$/, @@ -253,6 +254,7 @@ var alphanumeric = { 'tr-TR': /^[0-9A-ZÇĞİıÖŞÜ]+$/i, 'uk-UA': /^[0-9А-ЩЬЮЯЄIЇҐі]+$/i, 'ku-IQ': /^[٠١٢٣٤٥٦٧٨٩0-9ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i, + 'vi-VN': /^[0-9A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i, ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/, he: /^[0-9א-ת]+$/, 'fa-IR': /^['0-9آابپتثجچهخدذرزژسشصضطظعغفقکگلمنوهی۱۲۳۴۵۶۷۸۹۰']+$/i @@ -282,7 +284,7 @@ for (var _locale, _i = 0; _i < arabicLocales.length; _i++) { var dotDecimal = ['ar-EG', 'ar-LB', 'ar-LY']; -var commaDecimal = ['bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-ZM', 'es-ES', 'fr-FR', 'it-IT', 'ku-IQ', 'hu-HU', 'nb-NO', 'nn-NO', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'sl-SI', 'sr-RS@latin', 'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA']; +var commaDecimal = ['bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-ZM', 'es-ES', 'fr-FR', 'it-IT', 'ku-IQ', 'hu-HU', 'nb-NO', 'nn-NO', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'sl-SI', 'sr-RS@latin', 'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA', 'vi-VN']; for (var _i2 = 0; _i2 < dotDecimal.length; _i2++) { decimal[dotDecimal[_i2]] = decimal['en-US']; @@ -1273,8 +1275,7 @@ function isMultibyte(str) { * @param {string} flags * @return {object} - RegExp object */ -function multilineRegexp(parts) { - var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; +function multilineRegexp(parts, flags) { var regexpAsStringLiteral = parts.join(''); return new RegExp(regexpAsStringLiteral, flags); } @@ -1286,7 +1287,7 @@ function multilineRegexp(parts) { * Reference: https://semver.org/ */ -var semanticVersioningRegex = multilineRegexp(['^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)', '(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))', '?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$']); +var semanticVersioningRegex = multilineRegexp(['^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)', '(?:-((?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*))*))', '?(?:\\+([0-9a-z-]+(?:\\.[0-9a-z-]+)*))?$'], 'i'); function isSemVer(str) { assertString(str); return semanticVersioningRegex.test(str); @@ -1786,11 +1787,6 @@ var validators = { var f = sanitized.split('').map(Number); var k1 = (11 - (3 * f[0] + 7 * f[1] + 6 * f[2] + 1 * f[3] + 8 * f[4] + 9 * f[5] + 4 * f[6] + 5 * f[7] + 2 * f[8]) % 11) % 11; var k2 = (11 - (5 * f[0] + 4 * f[1] + 3 * f[2] + 2 * f[3] + 7 * f[4] + 6 * f[5] + 5 * f[6] + 4 * f[7] + 3 * f[8] + 2 * k1) % 11) % 11; - - if (k1 === 11) { - k1 = 0; - } - if (k1 !== f[9] || k2 !== f[10]) return false; return true; }, @@ -1827,56 +1823,50 @@ var validators = { return true; }, 'zh-CN': function zhCN(str) { - var provinceAndCitys = { - 11: '北京', - 12: '天津', - 13: '河北', - 14: '山西', - 15: '内蒙古', - 21: '辽宁', - 22: '吉林', - 23: '黑龙江', - 31: '上海', - 32: '江苏', - 33: '浙江', - 34: '安徽', - 35: '福建', - 36: '江西', - 37: '山东', - 41: '河南', - 42: '湖北', - 43: '湖南', - 44: '广东', - 45: '广西', - 46: '海南', - 50: '重庆', - 51: '四川', - 52: '贵州', - 53: '云南', - 54: '西藏', - 61: '陕西', - 62: '甘肃', - 63: '青海', - 64: '宁夏', - 65: '新疆', - 71: '台湾', - 81: '香港', - 82: '澳门', - 91: '国外' - }; + var provincesAndCities = ['11', // 北京 + '12', // 天津 + '13', // 河北 + '14', // 山西 + '15', // 内蒙古 + '21', // 辽宁 + '22', // 吉林 + '23', // 黑龙江 + '31', // 上海 + '32', // 江苏 + '33', // 浙江 + '34', // 安徽 + '35', // 福建 + '36', // 江西 + '37', // 山东 + '41', // 河南 + '42', // 湖北 + '43', // 湖南 + '44', // 广东 + '45', // 广西 + '46', // 海南 + '50', // 重庆 + '51', // 四川 + '52', // 贵州 + '53', // 云南 + '54', // 西藏 + '61', // 陕西 + '62', // 甘肃 + '63', // 青海 + '64', // 宁夏 + '65', // 新疆 + '71', // 台湾 + '81', // 香港 + '82', // 澳门 + '91' // 国外 + ]; var powers = ['7', '9', '10', '5', '8', '4', '2', '1', '6', '3', '7', '9', '10', '5', '8', '4', '2']; var parityBit = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2']; var checkAddressCode = function checkAddressCode(addressCode) { - var check = /^[1-9]\d{5}$/.test(addressCode); - if (!check) return false; // eslint-disable-next-line radix - - return !!provinceAndCitys[Number.parseInt(addressCode.substring(0, 2))]; + return provincesAndCities.includes(addressCode); }; var checkBirthDayCode = function checkBirthDayCode(birDayCode) { - var check = /^[1-9]\d{3}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))$/.test(birDayCode); - if (!check) return false; var yyyy = parseInt(birDayCode.substring(0, 4), 10); var mm = parseInt(birDayCode.substring(4, 6), 10); var dd = parseInt(birDayCode.substring(6), 10); @@ -1896,8 +1886,7 @@ var validators = { var power = 0; for (var i = 0; i < 17; i++) { - // eslint-disable-next-line radix - power += parseInt(id17.charAt(i), 10) * Number.parseInt(powers[i]); + power += parseInt(id17.charAt(i), 10) * parseInt(powers[i], 10); } var mod = power % 11; @@ -1911,19 +1900,19 @@ var validators = { var check15IdCardNo = function check15IdCardNo(idCardNo) { var check = /^[1-9]\d{7}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}$/.test(idCardNo); if (!check) return false; - var addressCode = idCardNo.substring(0, 6); + var addressCode = idCardNo.substring(0, 2); check = checkAddressCode(addressCode); if (!check) return false; var birDayCode = "19".concat(idCardNo.substring(6, 12)); check = checkBirthDayCode(birDayCode); if (!check) return false; - return checkParityBit(idCardNo); + return true; }; var check18IdCardNo = function check18IdCardNo(idCardNo) { var check = /^[1-9]\d{5}[1-9]\d{3}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}(\d|x|X)$/.test(idCardNo); if (!check) return false; - var addressCode = idCardNo.substring(0, 6); + var addressCode = idCardNo.substring(0, 2); check = checkAddressCode(addressCode); if (!check) return false; var birDayCode = idCardNo.substring(6, 14); @@ -1938,11 +1927,9 @@ var validators = { if (idCardNo.length === 15) { return check15IdCardNo(idCardNo); - } else if (idCardNo.length === 18) { - return check18IdCardNo(idCardNo); } - return false; + return check18IdCardNo(idCardNo); }; return checkIdCardNo(str); @@ -2232,6 +2219,8 @@ function getPrefixes(locale) { var prefixes = []; for (var location in campusPrefix[locale]) { + // https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes + // istanbul ignore else if (campusPrefix[locale].hasOwnProperty(location)) { prefixes.push.apply(prefixes, _toConsumableArray(campusPrefix[locale][location])); } @@ -2239,7 +2228,7 @@ function getPrefixes(locale) { prefixes.sort(); return prefixes; -} // tax id regex formats for various loacles +} // tax id regex formats for various locales var taxIdFormat = { @@ -2249,11 +2238,15 @@ function isTaxID(str) { var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en-US'; assertString(str); - if (!taxIdFormat[locale].test(str)) { - return false; + if (locale in taxIdFormat) { + if (!taxIdFormat[locale].test(str)) { + return false; + } + + return getPrefixes(locale).indexOf(str.substr(0, 2)) !== -1; } - return getPrefixes(locale).indexOf(str.substr(0, 2)) !== -1; + throw new Error("Invalid locale '".concat(locale, "'")); } /* eslint-disable max-len */ @@ -2271,6 +2264,7 @@ var phones = { 'ar-SA': /^(!?(\+?966)|0)?5\d{8}$/, 'ar-SY': /^(!?(\+?963)|0)?9\d{8}$/, 'ar-TN': /^(\+?216)?[2459]\d{7}$/, + 'bs-BA': /^((((\+|00)3876)|06))((([0-3]|[5-6])\d{6})|(4\d{7}))$/, 'be-BY': /^(\+?375)?(24|25|29|33|44)\d{7}$/, 'bg-BG': /^(\+?359|0)?8[789]\d{7}$/, 'bn-BD': /^(\+?880|0)1[13456789][0-9]{8}$/, @@ -2307,7 +2301,7 @@ var phones = { 'es-CL': /^(\+?56|0)[2-9]\d{1}\d{7}$/, 'es-CR': /^(\+506)?[2-8]\d{7}$/, 'es-EC': /^(\+?593|0)([2-7]|9[2-9])\d{7}$/, - 'es-ES': /^(\+?34)?(6\d{1}|7[1234])\d{7}$/, + 'es-ES': /^(\+?34)?[6|7]\d{8}$/, 'es-MX': /^(\+?52)?(1|01)?\d{10,11}$/, 'es-PA': /^(\+?507)\d{7,8}$/, 'es-PY': /^(\+?595|0)9[9876]\d{7}$/, @@ -2350,7 +2344,7 @@ var phones = { 'tr-TR': /^(\+?90|0)?5\d{9}$/, 'uk-UA': /^(\+?38|8)?0\d{9}$/, 'vi-VN': /^(\+?84|0)((3([2-9]))|(5([2689]))|(7([0|6-9]))|(8([1-6|89]))|(9([0-9])))([0-9]{7})$/, - 'zh-CN': /^((\+|00)86)?1([3568][0-9]|4[579]|6[67]|7[01235678]|9[189])[0-9]{8}$/, + 'zh-CN': /^((\+|00)86)?1([3568][0-9]|4[579]|6[67]|7[01235678]|9[012356789])[0-9]{8}$/, 'zh-TW': /^(\+?886\-?|0)?9\d{8}$/ }; /* eslint-enable max-len */ @@ -2702,7 +2696,7 @@ var patterns = { DK: fourDigit, DZ: fiveDigit, EE: fiveDigit, - ES: fiveDigit, + ES: /^(5[0-2]{1}|[0-4]{1}\d{1})\d{3}$/, FI: fiveDigit, FR: /^\d{2}\s?\d{3}$/, GB: /^(gir\s?0aa|[a-z]{1,2}\d[\da-z]?\s?(\d[a-z]{2})?)$/i, @@ -2711,7 +2705,7 @@ var patterns = { HU: fourDigit, ID: fiveDigit, IE: /^(?!.*(?:o))[A-z]\d[\dw]\s\w{4}$/i, - IL: fiveDigit, + IL: /^(\d{5}|\d{7})$/, IN: /^((?!10|29|35|54|55|65|66|86|87|88|89)[1-9][0-9]{5})$/, IS: threeDigit, IT: fiveDigit, diff --git a/validator.min.js b/validator.min.js index 241dd977a..76c8470f2 100644 --- a/validator.min.js +++ b/validator.min.js @@ -20,4 +20,4 @@ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.validator=e()}(this,function(){"use strict";function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function g(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return r}(t,e)||u(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||u(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(t,e){if(t){if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,e):void 0}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r=e.min)&&(!e.hasOwnProperty("max")||n<=e.max)&&(!e.hasOwnProperty("lt")||ne.gt)}r["pt-BR"]=r["pt-PT"],s["pt-BR"]=s["pt-PT"],l["pt-BR"]=l["pt-PT"],r["pl-Pl"]=r["pl-PL"],s["pl-Pl"]=s["pl-PL"],l["pl-Pl"]=l["pl-PL"];var S=Object.keys(l);function _(t){return Z(t)?parseFloat(t):NaN}function F(t){return"object"===a(t)&&null!==t?t="function"==typeof t.toString?t.toString():"[object Object]":(null==t||isNaN(t)&&!t.length)&&(t=""),String(t)}function E(t,e){var r=0a)return!1;if("::"===t)return!0;"::"===t.substr(0,2)?(n.shift(),n.shift(),i=!0):"::"===t.substr(t.length-2)&&(n.pop(),n.pop(),i=!0);for(var s=0;s$/i,w=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i,x=/^[a-z\d]+$/,B=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i,D=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i,O=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/i;var G={protocols:["http","https","ftp"],require_tld:!0,require_protocol:!1,require_host:!0,require_valid_protocol:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_protocol_relative_urls:!1},U=/^\[([^\]]+)\](?::([0-9]+))?$/;function P(t,e){for(var r,n=0;n=e.min,i=!e.hasOwnProperty("max")||t<=e.max,o=!e.hasOwnProperty("lt")||te.gt;return r.test(t)&&n&&i&&o&&a}var rt=/^[0-9]{15}$/,nt=/^\d{2}-\d{6}-\d{6}-\d{1}$/;var it=/^[\x00-\x7F]+$/;var ot=/[^\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/;var at=/[\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/;var st=/[^\x00-\x7F]/;var lt=function(t,e){var r=1new Date)&&(i.getFullYear()===e&&i.getMonth()===r-1&&i.getDate()===n)}function a(t){return function(t){for(var e=t.substring(0,17),r=0,n=0;n<17;n++)r+=parseInt(e.charAt(n),10)*Number.parseInt(s[n]);return l[r%11]}(t)===t.charAt(17).toUpperCase()}var e,r={11:"北京",12:"天津",13:"河北",14:"山西",15:"内蒙古",21:"辽宁",22:"吉林",23:"黑龙江",31:"上海",32:"江苏",33:"浙江",34:"安徽",35:"福建",36:"江西",37:"山东",41:"河南",42:"湖北",43:"湖南",44:"广东",45:"广西",46:"海南",50:"重庆",51:"四川",52:"贵州",53:"云南",54:"西藏",61:"陕西",62:"甘肃",63:"青海",64:"宁夏",65:"新疆",71:"台湾",81:"香港",82:"澳门",91:"国外"},s=["7","9","10","5","8","4","2","1","6","3","7","9","10","5","8","4","2"],l=["1","0","X","9","8","7","6","5","4","3","2"];return!!/^\d{15}|(\d{17}(\d|x|X))$/.test(e=t)&&(15===e.length?function(t){var e=/^[1-9]\d{7}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}$/.test(t);if(!e)return!1;var r=t.substring(0,6);if(!(e=i(r)))return!1;var n="19".concat(t.substring(6,12));return!!(e=o(n))&&a(t)}(e):18===e.length&&function(t){var e=/^[1-9]\d{5}[1-9]\d{3}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}(\d|x|X)$/.test(t);if(!e)return!1;var r=t.substring(0,6);if(!(e=i(r)))return!1;var n=t.substring(6,14);return!!(e=o(n))&&a(t)}(e))},"zh-TW":function(t){var i={A:10,B:11,C:12,D:13,E:14,F:15,G:16,H:17,I:34,J:18,K:19,L:20,M:21,N:22,O:35,P:23,Q:24,R:25,S:26,T:27,U:28,V:29,W:32,X:30,Y:31,Z:33},e=t.trim().toUpperCase();return!!/^[A-Z][0-9]{9}$/.test(e)&&Array.from(e).reduce(function(t,e,r){if(0!==r)return 9===r?(10-t%10-Number(e))%10==0:t+Number(e)*(9-r);var n=i[e];return n%10*9+Math.floor(n/10)},0)}};var Dt=8,Ot=/^(\d{8}|\d{13})$/;function Gt(i){var t=10-i.slice(0,-1).split("").map(function(t,e){return Number(t)*(r=i.length,n=e,r===Dt?n%2==0?3:1:n%2==0?1:3);var r,n}).reduce(function(t,e){return t+e},0)%10;return t<10?t:0}var Ut=/^[A-Z]{2}[0-9A-Z]{9}[0-9]$/;var Pt=/^(?:[0-9]{9}X|[0-9]{10})$/,Kt=/^(?:[0-9]{13})$/,Ht=[1,3];var kt={"en-US":{andover:["10","12"],atlanta:["60","67"],austin:["50","53"],brookhaven:["01","02","03","04","05","06","11","13","14","16","21","22","23","25","34","51","52","54","55","56","57","58","59","65"],cincinnati:["30","32","35","36","37","38","61"],fresno:["15","24"],internet:["20","26","27","45","46","47"],kansas:["40","44"],memphis:["94","95"],ogden:["80","90"],philadelphia:["33","39","41","42","43","46","48","62","63","64","66","68","71","72","73","74","75","76","77","81","82","83","84","85","86","87","88","91","92","93","98","99"],sba:["31"]}};var zt={"en-US":/^\d{2}[- ]{0,1}\d{7}$/};var Wt={"am-AM":/^(\+?374|0)((10|[9|7][0-9])\d{6}$|[2-4]\d{7}$)/,"ar-AE":/^((\+?971)|0)?5[024568]\d{7}$/,"ar-BH":/^(\+?973)?(3|6)\d{7}$/,"ar-DZ":/^(\+?213|0)(5|6|7)\d{8}$/,"ar-EG":/^((\+?20)|0)?1[0125]\d{8}$/,"ar-IQ":/^(\+?964|0)?7[0-9]\d{8}$/,"ar-JO":/^(\+?962|0)?7[789]\d{7}$/,"ar-KW":/^(\+?965)[569]\d{7}$/,"ar-LY":/^((\+?218)|0)?(9[1-6]\d{7}|[1-8]\d{7,9})$/,"ar-SA":/^(!?(\+?966)|0)?5\d{8}$/,"ar-SY":/^(!?(\+?963)|0)?9\d{8}$/,"ar-TN":/^(\+?216)?[2459]\d{7}$/,"be-BY":/^(\+?375)?(24|25|29|33|44)\d{7}$/,"bg-BG":/^(\+?359|0)?8[789]\d{7}$/,"bn-BD":/^(\+?880|0)1[13456789][0-9]{8}$/,"cs-CZ":/^(\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,"da-DK":/^(\+?45)?\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{2}$/,"de-DE":/^(\+49)?0?1(5[0-25-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7}$/,"de-AT":/^(\+43|0)\d{1,4}\d{3,12}$/,"de-CH":/^(\+41|0)(7[5-9])\d{1,7}$/,"el-GR":/^(\+?30|0)?(69\d{8})$/,"en-AU":/^(\+?61|0)4\d{8}$/,"en-GB":/^(\+?44|0)7\d{9}$/,"en-GG":/^(\+?44|0)1481\d{6}$/,"en-GH":/^(\+233|0)(20|50|24|54|27|57|26|56|23|28)\d{7}$/,"en-HK":/^(\+?852[-\s]?)?[456789]\d{3}[-\s]?\d{4}$/,"en-MO":/^(\+?853[-\s]?)?[6]\d{3}[-\s]?\d{4}$/,"en-IE":/^(\+?353|0)8[356789]\d{7}$/,"en-IN":/^(\+?91|0)?[6789]\d{9}$/,"en-KE":/^(\+?254|0)(7|1)\d{8}$/,"en-MT":/^(\+?356|0)?(99|79|77|21|27|22|25)[0-9]{6}$/,"en-MU":/^(\+?230|0)?\d{8}$/,"en-NG":/^(\+?234|0)?[789]\d{9}$/,"en-NZ":/^(\+?64|0)[28]\d{7,9}$/,"en-PK":/^((\+92)|(0092))-{0,1}\d{3}-{0,1}\d{7}$|^\d{11}$|^\d{4}-\d{7}$/,"en-RW":/^(\+?250|0)?[7]\d{8}$/,"en-SG":/^(\+65)?[689]\d{7}$/,"en-SL":/^(?:0|94|\+94)?(7(0|1|2|5|6|7|8)( |-)?\d)\d{6}$/,"en-TZ":/^(\+?255|0)?[67]\d{8}$/,"en-UG":/^(\+?256|0)?[7]\d{8}$/,"en-US":/^((\+1|1)?( |-)?)?(\([2-9][0-9]{2}\)|[2-9][0-9]{2})( |-)?([2-9][0-9]{2}( |-)?[0-9]{4})$/,"en-ZA":/^(\+?27|0)\d{9}$/,"en-ZM":/^(\+?26)?09[567]\d{7}$/,"en-ZW":/^(\+263)[0-9]{9}$/,"es-CO":/^(\+?57)?([1-8]{1}|3[0-9]{2})?[2-9]{1}\d{6}$/,"es-CL":/^(\+?56|0)[2-9]\d{1}\d{7}$/,"es-CR":/^(\+506)?[2-8]\d{7}$/,"es-EC":/^(\+?593|0)([2-7]|9[2-9])\d{7}$/,"es-ES":/^(\+?34)?(6\d{1}|7[1234])\d{7}$/,"es-MX":/^(\+?52)?(1|01)?\d{10,11}$/,"es-PA":/^(\+?507)\d{7,8}$/,"es-PY":/^(\+?595|0)9[9876]\d{7}$/,"es-UY":/^(\+598|0)9[1-9][\d]{6}$/,"et-EE":/^(\+?372)?\s?(5|8[1-4])\s?([0-9]\s?){6,7}$/,"fa-IR":/^(\+?98[\-\s]?|0)9[0-39]\d[\-\s]?\d{3}[\-\s]?\d{4}$/,"fi-FI":/^(\+?358|0)\s?(4(0|1|2|4|5|6)?|50)\s?(\d\s?){4,8}\d$/,"fj-FJ":/^(\+?679)?\s?\d{3}\s?\d{4}$/,"fo-FO":/^(\+?298)?\s?\d{2}\s?\d{2}\s?\d{2}$/,"fr-FR":/^(\+?33|0)[67]\d{8}$/,"fr-GF":/^(\+?594|0|00594)[67]\d{8}$/,"fr-GP":/^(\+?590|0|00590)[67]\d{8}$/,"fr-MQ":/^(\+?596|0|00596)[67]\d{8}$/,"fr-RE":/^(\+?262|0|00262)[67]\d{8}$/,"he-IL":/^(\+972|0)([23489]|5[012345689]|77)[1-9]\d{6}$/,"hu-HU":/^(\+?36)(20|30|70)\d{7}$/,"id-ID":/^(\+?62|0)8(1[123456789]|2[1238]|3[1238]|5[12356789]|7[78]|9[56789]|8[123456789])([\s?|\d]{5,11})$/,"it-IT":/^(\+?39)?\s?3\d{2} ?\d{6,7}$/,"ja-JP":/^(\+81[ \-]?(\(0\))?|0)[6789]0[ \-]?\d{4}[ \-]?\d{4}$/,"kk-KZ":/^(\+?7|8)?7\d{9}$/,"kl-GL":/^(\+?299)?\s?\d{2}\s?\d{2}\s?\d{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86)?1([3568][0-9]|4[579]|6[67]|7[01235678]|9[189])[0-9]{8}$/,"zh-TW":/^(\+?886\-?|0)?9\d{8}$/};Wt["en-CA"]=Wt["en-US"],Wt["fr-BE"]=Wt["nl-BE"],Wt["zh-HK"]=Wt["en-HK"],Wt["zh-MO"]=Wt["en-MO"];var Yt=Object.keys(Wt),Vt=/^(0x)[0-9a-f]{40}$/i;var jt={symbol:"$",require_symbol:!1,allow_space_after_symbol:!1,symbol_after_digits:!1,allow_negatives:!0,parens_for_negatives:!1,negative_sign_before_digits:!1,negative_sign_after_digits:!1,allow_negative_sign_placeholder:!1,thousands_separator:",",decimal_separator:".",allow_decimal:!0,require_decimal:!1,digits_after_decimal:[2],allow_space_after_digits:!1};var Jt=/^(bc1|[13])[a-zA-HJ-NP-Z0-9]{25,39}$/;var Xt=/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;var Qt=/([01][0-9]|2[0-3])/,qt=/[0-5][0-9]/,te=new RegExp("[-+]".concat(Qt.source,":").concat(qt.source)),ee=new RegExp("([zZ]|".concat(te.source,")")),re=new RegExp("".concat(Qt.source,":").concat(qt.source,":").concat(/([0-5][0-9]|60)/.source).concat(/(\.[0-9]+)?/.source)),ne=new RegExp("".concat(/[0-9]{4}/.source,"-").concat(/(0[1-9]|1[0-2])/.source,"-").concat(/([12]\d|0[1-9]|3[01])/.source)),ie=new RegExp("".concat(re.source).concat(ee.source)),oe=new RegExp("".concat(ne.source,"[ tT]").concat(ie.source));var ae=["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","YE","YT","ZA","ZM","ZW"];var se=["AFG","ALA","ALB","DZA","ASM","AND","AGO","AIA","ATA","ATG","ARG","ARM","ABW","AUS","AUT","AZE","BHS","BHR","BGD","BRB","BLR","BEL","BLZ","BEN","BMU","BTN","BOL","BES","BIH","BWA","BVT","BRA","IOT","BRN","BGR","BFA","BDI","KHM","CMR","CAN","CPV","CYM","CAF","TCD","CHL","CHN","CXR","CCK","COL","COM","COG","COD","COK","CRI","CIV","HRV","CUB","CUW","CYP","CZE","DNK","DJI","DMA","DOM","ECU","EGY","SLV","GNQ","ERI","EST","ETH","FLK","FRO","FJI","FIN","FRA","GUF","PYF","ATF","GAB","GMB","GEO","DEU","GHA","GIB","GRC","GRL","GRD","GLP","GUM","GTM","GGY","GIN","GNB","GUY","HTI","HMD","VAT","HND","HKG","HUN","ISL","IND","IDN","IRN","IRQ","IRL","IMN","ISR","ITA","JAM","JPN","JEY","JOR","KAZ","KEN","KIR","PRK","KOR","KWT","KGZ","LAO","LVA","LBN","LSO","LBR","LBY","LIE","LTU","LUX","MAC","MKD","MDG","MWI","MYS","MDV","MLI","MLT","MHL","MTQ","MRT","MUS","MYT","MEX","FSM","MDA","MCO","MNG","MNE","MSR","MAR","MOZ","MMR","NAM","NRU","NPL","NLD","NCL","NZL","NIC","NER","NGA","NIU","NFK","MNP","NOR","OMN","PAK","PLW","PSE","PAN","PNG","PRY","PER","PHL","PCN","POL","PRT","PRI","QAT","REU","ROU","RUS","RWA","BLM","SHN","KNA","LCA","MAF","SPM","VCT","WSM","SMR","STP","SAU","SEN","SRB","SYC","SLE","SGP","SXM","SVK","SVN","SLB","SOM","ZAF","SGS","SSD","ESP","LKA","SDN","SUR","SJM","SWZ","SWE","CHE","SYR","TWN","TJK","TZA","THA","TLS","TGO","TKL","TON","TTO","TUN","TUR","TKM","TCA","TUV","UGA","UKR","ARE","GBR","USA","UMI","URY","UZB","VUT","VEN","VNM","VGB","VIR","WLF","ESH","YEM","ZMB","ZWE"];var le=/^[A-Z2-7]+=*$/;var ue=/^[a-z]+\/[a-z0-9\-\+]+$/i,de=/^[a-z\-]+=[a-z0-9\-]+$/i,ce=/^[a-z0-9!\$&'\(\)\*\+,;=\-\._~:@\/\?%\s]*$/i;var fe=/^magnet:\?xt=urn:[a-z0-9]+:[a-z0-9]{32,40}&dn=.+&tr=.+$/i;var $e=/^(application|audio|font|image|message|model|multipart|text|video)\/[a-zA-Z0-9\.\-\+]{1,100}$/i,Ae=/^text\/[a-zA-Z0-9\.\-\+]{1,100};\s?charset=("[a-zA-Z0-9\.\-\+\s]{0,70}"|[a-zA-Z0-9\.\-\+]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$/,MX:_e,MT:/^[A-Za-z]{3}\s{0,1}\d{4}$/,NL:/^\d{4}\s?[a-z]{2}$/i,NO:Se,NP:/^(10|21|22|32|33|34|44|45|56|57)\d{3}$|^(977)$/i,NZ:Se,PL:/^\d{2}\-\d{3}$/,PR:/^00[679]\d{2}([ -]\d{4})?$/,PT:/^\d{4}\-\d{3}?$/,RO:Fe,RU:Fe,SA:_e,SE:/^[1-9]\d{2}\s?\d{2}$/,SI:Se,SK:/^\d{3}\s?\d{2}$/,TN:Se,TW:/^\d{3}(\d{2})?$/,UA:_e,US:/^\d{5}(-\d{4})?$/,ZA:Se,ZM:_e},Re=Object.keys(Ee);function Ie(t,e){h(t);var r=e?new RegExp("^[".concat(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"]+"),"g"):/^\s+/g;return t.replace(r,"")}function Ce(t,e){h(t);var r=e?new RegExp("[".concat(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"]+$"),"g"):/\s+$/g;return t.replace(r,"")}function be(t,e){return h(t),t.replace(new RegExp("[".concat(e,"]+"),"g"),"")}var Le={all_lowercase:!0,gmail_lowercase:!0,gmail_remove_dots:!0,gmail_remove_subaddress:!0,gmail_convert_googlemaildotcom:!0,outlookdotcom_lowercase:!0,outlookdotcom_remove_subaddress:!0,yahoo_lowercase:!0,yahoo_remove_subaddress:!0,yandex_lowercase:!0,icloud_lowercase:!0,icloud_remove_subaddress:!0},Me=["icloud.com","me.com"],Ne=["hotmail.at","hotmail.be","hotmail.ca","hotmail.cl","hotmail.co.il","hotmail.co.nz","hotmail.co.th","hotmail.co.uk","hotmail.com","hotmail.com.ar","hotmail.com.au","hotmail.com.br","hotmail.com.gr","hotmail.com.mx","hotmail.com.pe","hotmail.com.tr","hotmail.com.vn","hotmail.cz","hotmail.de","hotmail.dk","hotmail.es","hotmail.fr","hotmail.hu","hotmail.id","hotmail.ie","hotmail.in","hotmail.it","hotmail.jp","hotmail.kr","hotmail.lv","hotmail.my","hotmail.ph","hotmail.pt","hotmail.sa","hotmail.sg","hotmail.sk","live.be","live.co.uk","live.com","live.com.ar","live.com.mx","live.de","live.es","live.eu","live.fr","live.it","live.nl","msn.com","outlook.at","outlook.be","outlook.cl","outlook.co.il","outlook.co.nz","outlook.co.th","outlook.com","outlook.com.ar","outlook.com.au","outlook.com.br","outlook.com.gr","outlook.com.pe","outlook.com.tr","outlook.com.vn","outlook.cz","outlook.de","outlook.dk","outlook.es","outlook.fr","outlook.hu","outlook.id","outlook.ie","outlook.in","outlook.it","outlook.jp","outlook.kr","outlook.lv","outlook.my","outlook.ph","outlook.pt","outlook.sa","outlook.sg","outlook.sk","passport.com"],ye=["rocketmail.com","yahoo.ca","yahoo.co.uk","yahoo.com","yahoo.de","yahoo.fr","yahoo.in","yahoo.it","ymail.com"],Te=["yandex.ru","yandex.ua","yandex.kz","yandex.com","yandex.by","ya.ru"];function we(t){return 1]/.test(r)){if(!e)return;if(!(r.split('"').length===r.split('\\"').length))return}return 1}}(i))return!1}else if(e.require_display_name)return!1}if(!e.ignore_max_length&&254]/.test(t))return!1;if(0===t.indexOf("mailto:"))return!1;var r,n,i,o,a,s,l,u;if(e=E(e,G),1<(l=(t=(l=(t=(l=t.split("#")).shift()).split("?")).shift()).split("://")).length){if(r=l.shift().toLowerCase(),e.require_valid_protocol&&-1===e.protocols.indexOf(r))return!1}else{if(e.require_protocol)return!1;if("//"===t.substr(0,2)){if(!e.allow_protocol_relative_urls)return!1;l[0]=t.substr(2)}}if(""===(t=l.join("://")))return!1;if(""===(t=(l=t.split("/")).shift())&&!e.require_host)return!0;if(1<(l=t.split("@")).length){if(e.disallow_auth)return!1;if(0<=(n=l.shift()).indexOf(":")&&2/g,">").replace(/\//g,"/").replace(/\\/g,"\").replace(/`/g,"`")},unescape:function(t){return h(t),t.replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">").replace(///g,"/").replace(/\/g,"\\").replace(/`/g,"`")},stripLow:function(t,e){return h(t),be(t,e?"\\x00-\\x09\\x0B\\x0C\\x0E-\\x1F\\x7F":"\\x00-\\x1F\\x7F")},whitelist:function(t,e){return h(t),t.replace(new RegExp("[^".concat(e,"]+"),"g"),"")},blacklist:be,isWhitelisted:function(t,e){h(t);for(var r=t.length-1;0<=r;r--)if(-1===e.indexOf(t[r]))return!1;return!0},normalizeEmail:function(t,e){e=E(e,Le);var r,n=t.split("@"),i=n.pop(),o=[n.join("@"),i];if(o[1]=o[1].toLowerCase(),"gmail.com"===o[1]||"googlemail.com"===o[1]){if(e.gmail_remove_subaddress&&(o[0]=o[0].split("+")[0]),e.gmail_remove_dots&&(o[0]=o[0].replace(/\.+/g,we)),!o[0].length)return!1;(e.all_lowercase||e.gmail_lowercase)&&(o[0]=o[0].toLowerCase()),o[1]=e.gmail_convert_googlemaildotcom?"gmail.com":o[1]}else if(0<=Me.indexOf(o[1])){if(e.icloud_remove_subaddress&&(o[0]=o[0].split("+")[0]),!o[0].length)return!1;(e.all_lowercase||e.icloud_lowercase)&&(o[0]=o[0].toLowerCase())}else if(0<=Ne.indexOf(o[1])){if(e.outlookdotcom_remove_subaddress&&(o[0]=o[0].split("+")[0]),!o[0].length)return!1;(e.all_lowercase||e.outlookdotcom_lowercase)&&(o[0]=o[0].toLowerCase())}else if(0<=ye.indexOf(o[1])){if(e.yahoo_remove_subaddress&&(r=o[0].split("-"),o[0]=1=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f: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.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}(function(t,e){for(var r=[],n=Math.min(t.length,e.length),i=0;it.length)&&(e=t.length);for(var r=0,n=new Array(e);r=e.min)&&(!e.hasOwnProperty("max")||n<=e.max)&&(!e.hasOwnProperty("lt")||ne.gt)}r["pt-BR"]=r["pt-PT"],s["pt-BR"]=s["pt-PT"],l["pt-BR"]=l["pt-PT"],r["pl-Pl"]=r["pl-PL"],s["pl-Pl"]=s["pl-PL"],l["pl-Pl"]=l["pl-PL"];var Z=Object.keys(l);function _(t){return S(t)?parseFloat(t):NaN}function F(t){return"object"===a(t)&&null!==t?t="function"==typeof t.toString?t.toString():"[object Object]":(null==t||isNaN(t)&&!t.length)&&(t=""),String(t)}function E(t,e){var r=0a)return!1;if("::"===t)return!0;"::"===t.substr(0,2)?(n.shift(),n.shift(),i=!0):"::"===t.substr(t.length-2)&&(n.pop(),n.pop(),i=!0);for(var s=0;s$/i,w=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i,x=/^[a-z\d]+$/,B=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i,D=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i,O=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/i;var G={protocols:["http","https","ftp"],require_tld:!0,require_protocol:!1,require_host:!0,require_valid_protocol:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_protocol_relative_urls:!1},U=/^\[([^\]]+)\](?::([0-9]+))?$/;function P(t,e){for(var r,n=0;n=e.min,i=!e.hasOwnProperty("max")||t<=e.max,o=!e.hasOwnProperty("lt")||te.gt;return r.test(t)&&n&&i&&o&&a}var rt=/^[0-9]{15}$/,nt=/^\d{2}-\d{6}-\d{6}-\d{1}$/;var it=/^[\x00-\x7F]+$/;var ot=/[^\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/;var at=/[\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/;var st=/[^\x00-\x7F]/;var lt,ut,dt=(lt="i",ut=["^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)","(?:-((?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*))*))","?(?:\\+([0-9a-z-]+(?:\\.[0-9a-z-]+)*))?$"].join(""),new RegExp(ut,lt));var ct=/[\uD800-\uDBFF][\uDC00-\uDFFF]/;function ft(t,e){return t.some(function(t){return e===t})}var $t={force_decimal:!1,decimal_digits:"1,",locale:"en-US"},At=["","-","+"];var pt=/^(0x|0h)?[0-9A-F]+$/i;function ht(t){return g(t),pt.test(t)}var gt=/^(0o)?[0-7]+$/i;var vt=/^#?([0-9A-F]{3}|[0-9A-F]{4}|[0-9A-F]{6}|[0-9A-F]{8})$/i;var mt=/^rgb\((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]),){2}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\)$/,St=/^rgba\((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]),){3}(0?\.\d|1(\.0)?|0(\.0)?)\)$/,Zt=/^rgb\((([0-9]%|[1-9][0-9]%|100%),){2}([0-9]%|[1-9][0-9]%|100%)\)/,_t=/^rgba\((([0-9]%|[1-9][0-9]%|100%),){3}(0?\.\d|1(\.0)?|0(\.0)?)\)/;var Ft=/^(hsl)a?\(\s*((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?))(deg|grad|rad|turn|\s*)(\s*,\s*(\+|\-)?([0-9]+(\.[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-Z0-9_\-]+$/i,yt={urlSafe:!1};function Tt(t,e){g(t),e=E(e,yt);var r=t.length;if(e.urlSafe)return Mt.test(t);if(!r||r%4!=0||Nt.test(t))return!1;var n=t.indexOf("=");return-1===n||n===r-1||n===r-2&&"="===t[r-1]}var wt={allow_primitives:!1};var xt={ignore_whitespace:!1};var Bt={3:/^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i,4:/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,5:/^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,all:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i};var Dt=/^(?:4[0-9]{12}(?:[0-9]{3,6})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12,15}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11}|6[27][0-9]{14})$/;var Ot={ES:function(t){g(t);var e={X:0,Y:1,Z:2},r=t.trim().toUpperCase();if(!/^[0-9X-Z][0-9]{7}[TRWAGMYFPDXBNJZSQVHLCKE]$/.test(r))return!1;var n=r.slice(0,-1).replace(/[X,Y,Z]/g,function(t){return e[t]});return r.endsWith(["T","R","W","A","G","M","Y","F","P","D","X","B","N","J","Z","S","Q","V","H","L","C","K","E"][n%23])},IN:function(t){var r=[[0,1,2,3,4,5,6,7,8,9],[1,2,3,4,0,6,7,8,9,5],[2,3,4,0,1,7,8,9,5,6],[3,4,0,1,2,8,9,5,6,7],[4,0,1,2,3,9,5,6,7,8],[5,9,8,7,6,0,4,3,2,1],[6,5,9,8,7,1,0,4,3,2],[7,6,5,9,8,2,1,0,4,3],[8,7,6,5,9,3,2,1,0,4],[9,8,7,6,5,4,3,2,1,0]],n=[[0,1,2,3,4,5,6,7,8,9],[1,5,7,6,2,8,3,0,9,4],[5,8,0,3,7,9,6,1,4,2],[8,9,1,6,0,4,3,5,2,7],[9,4,5,3,1,2,6,8,7,0],[4,2,8,6,5,7,3,9,0,1],[2,7,9,3,8,0,6,4,1,5],[7,0,4,6,9,1,3,2,5,8]],e=t.trim();if(!/^[1-9]\d{3}\s?\d{4}\s?\d{4}$/.test(e))return!1;var i=0;return e.replace(/\s/g,"").split("").map(Number).reverse().forEach(function(t,e){i=r[i][n[e%8][t]]}),0===i},NO:function(t){var e=t.trim();if(isNaN(Number(e)))return!1;if(11!==e.length)return!1;if("00000000000"===e)return!1;var r=e.split("").map(Number),n=(11-(3*r[0]+7*r[1]+6*r[2]+ +r[3]+8*r[4]+9*r[5]+4*r[6]+5*r[7]+2*r[8])%11)%11,i=(11-(5*r[0]+4*r[1]+3*r[2]+2*r[3]+7*r[4]+6*r[5]+5*r[6]+4*r[7]+3*r[8]+2*n)%11)%11;return n===r[9]&&i===r[10]},"he-IL":function(t){var e=t.trim();if(!/^\d{9}$/.test(e))return!1;for(var r,n=e,i=0,o=0;onew Date)&&(i.getFullYear()===e&&i.getMonth()===r-1&&i.getDate()===n)}function a(t){return function(t){for(var e=t.substring(0,17),r=0,n=0;n<17;n++)r+=parseInt(e.charAt(n),10)*parseInt(s[n],10);return l[r%11]}(t)===t.charAt(17).toUpperCase()}var e,r=["11","12","13","14","15","21","22","23","31","32","33","34","35","36","37","41","42","43","44","45","46","50","51","52","53","54","61","62","63","64","65","71","81","82","91"],s=["7","9","10","5","8","4","2","1","6","3","7","9","10","5","8","4","2"],l=["1","0","X","9","8","7","6","5","4","3","2"];return!!/^\d{15}|(\d{17}(\d|x|X))$/.test(e=t)&&(15===e.length?function(t){var e=/^[1-9]\d{7}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}$/.test(t);if(!e)return!1;var r=t.substring(0,2);if(!(e=i(r)))return!1;var n="19".concat(t.substring(6,12));return!!(e=o(n))}:function(t){var e=/^[1-9]\d{5}[1-9]\d{3}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}(\d|x|X)$/.test(t);if(!e)return!1;var r=t.substring(0,2);if(!(e=i(r)))return!1;var n=t.substring(6,14);return!!(e=o(n))&&a(t)})(e)},"zh-TW":function(t){var i={A:10,B:11,C:12,D:13,E:14,F:15,G:16,H:17,I:34,J:18,K:19,L:20,M:21,N:22,O:35,P:23,Q:24,R:25,S:26,T:27,U:28,V:29,W:32,X:30,Y:31,Z:33},e=t.trim().toUpperCase();return!!/^[A-Z][0-9]{9}$/.test(e)&&Array.from(e).reduce(function(t,e,r){if(0!==r)return 9===r?(10-t%10-Number(e))%10==0:t+Number(e)*(9-r);var n=i[e];return n%10*9+Math.floor(n/10)},0)}};var Gt=8,Ut=/^(\d{8}|\d{13})$/;function Pt(i){var t=10-i.slice(0,-1).split("").map(function(t,e){return Number(t)*(r=i.length,n=e,r===Gt?n%2==0?3:1:n%2==0?1:3);var r,n}).reduce(function(t,e){return t+e},0)%10;return t<10?t:0}var Kt=/^[A-Z]{2}[0-9A-Z]{9}[0-9]$/;var Ht=/^(?:[0-9]{9}X|[0-9]{10})$/,kt=/^(?:[0-9]{13})$/,zt=[1,3];var Wt={"en-US":{andover:["10","12"],atlanta:["60","67"],austin:["50","53"],brookhaven:["01","02","03","04","05","06","11","13","14","16","21","22","23","25","34","51","52","54","55","56","57","58","59","65"],cincinnati:["30","32","35","36","37","38","61"],fresno:["15","24"],internet:["20","26","27","45","46","47"],kansas:["40","44"],memphis:["94","95"],ogden:["80","90"],philadelphia:["33","39","41","42","43","46","48","62","63","64","66","68","71","72","73","74","75","76","77","81","82","83","84","85","86","87","88","91","92","93","98","99"],sba:["31"]}};var Yt={"en-US":/^\d{2}[- ]{0,1}\d{7}$/};var Vt={"am-AM":/^(\+?374|0)((10|[9|7][0-9])\d{6}$|[2-4]\d{7}$)/,"ar-AE":/^((\+?971)|0)?5[024568]\d{7}$/,"ar-BH":/^(\+?973)?(3|6)\d{7}$/,"ar-DZ":/^(\+?213|0)(5|6|7)\d{8}$/,"ar-EG":/^((\+?20)|0)?1[0125]\d{8}$/,"ar-IQ":/^(\+?964|0)?7[0-9]\d{8}$/,"ar-JO":/^(\+?962|0)?7[789]\d{7}$/,"ar-KW":/^(\+?965)[569]\d{7}$/,"ar-LY":/^((\+?218)|0)?(9[1-6]\d{7}|[1-8]\d{7,9})$/,"ar-SA":/^(!?(\+?966)|0)?5\d{8}$/,"ar-SY":/^(!?(\+?963)|0)?9\d{8}$/,"ar-TN":/^(\+?216)?[2459]\d{7}$/,"bs-BA":/^((((\+|00)3876)|06))((([0-3]|[5-6])\d{6})|(4\d{7}))$/,"be-BY":/^(\+?375)?(24|25|29|33|44)\d{7}$/,"bg-BG":/^(\+?359|0)?8[789]\d{7}$/,"bn-BD":/^(\+?880|0)1[13456789][0-9]{8}$/,"cs-CZ":/^(\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,"da-DK":/^(\+?45)?\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{2}$/,"de-DE":/^(\+49)?0?1(5[0-25-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7}$/,"de-AT":/^(\+43|0)\d{1,4}\d{3,12}$/,"de-CH":/^(\+41|0)(7[5-9])\d{1,7}$/,"el-GR":/^(\+?30|0)?(69\d{8})$/,"en-AU":/^(\+?61|0)4\d{8}$/,"en-GB":/^(\+?44|0)7\d{9}$/,"en-GG":/^(\+?44|0)1481\d{6}$/,"en-GH":/^(\+233|0)(20|50|24|54|27|57|26|56|23|28)\d{7}$/,"en-HK":/^(\+?852[-\s]?)?[456789]\d{3}[-\s]?\d{4}$/,"en-MO":/^(\+?853[-\s]?)?[6]\d{3}[-\s]?\d{4}$/,"en-IE":/^(\+?353|0)8[356789]\d{7}$/,"en-IN":/^(\+?91|0)?[6789]\d{9}$/,"en-KE":/^(\+?254|0)(7|1)\d{8}$/,"en-MT":/^(\+?356|0)?(99|79|77|21|27|22|25)[0-9]{6}$/,"en-MU":/^(\+?230|0)?\d{8}$/,"en-NG":/^(\+?234|0)?[789]\d{9}$/,"en-NZ":/^(\+?64|0)[28]\d{7,9}$/,"en-PK":/^((\+92)|(0092))-{0,1}\d{3}-{0,1}\d{7}$|^\d{11}$|^\d{4}-\d{7}$/,"en-RW":/^(\+?250|0)?[7]\d{8}$/,"en-SG":/^(\+65)?[689]\d{7}$/,"en-SL":/^(?:0|94|\+94)?(7(0|1|2|5|6|7|8)( |-)?\d)\d{6}$/,"en-TZ":/^(\+?255|0)?[67]\d{8}$/,"en-UG":/^(\+?256|0)?[7]\d{8}$/,"en-US":/^((\+1|1)?( |-)?)?(\([2-9][0-9]{2}\)|[2-9][0-9]{2})( |-)?([2-9][0-9]{2}( |-)?[0-9]{4})$/,"en-ZA":/^(\+?27|0)\d{9}$/,"en-ZM":/^(\+?26)?09[567]\d{7}$/,"en-ZW":/^(\+263)[0-9]{9}$/,"es-CO":/^(\+?57)?([1-8]{1}|3[0-9]{2})?[2-9]{1}\d{6}$/,"es-CL":/^(\+?56|0)[2-9]\d{1}\d{7}$/,"es-CR":/^(\+506)?[2-8]\d{7}$/,"es-EC":/^(\+?593|0)([2-7]|9[2-9])\d{7}$/,"es-ES":/^(\+?34)?[6|7]\d{8}$/,"es-MX":/^(\+?52)?(1|01)?\d{10,11}$/,"es-PA":/^(\+?507)\d{7,8}$/,"es-PY":/^(\+?595|0)9[9876]\d{7}$/,"es-UY":/^(\+598|0)9[1-9][\d]{6}$/,"et-EE":/^(\+?372)?\s?(5|8[1-4])\s?([0-9]\s?){6,7}$/,"fa-IR":/^(\+?98[\-\s]?|0)9[0-39]\d[\-\s]?\d{3}[\-\s]?\d{4}$/,"fi-FI":/^(\+?358|0)\s?(4(0|1|2|4|5|6)?|50)\s?(\d\s?){4,8}\d$/,"fj-FJ":/^(\+?679)?\s?\d{3}\s?\d{4}$/,"fo-FO":/^(\+?298)?\s?\d{2}\s?\d{2}\s?\d{2}$/,"fr-FR":/^(\+?33|0)[67]\d{8}$/,"fr-GF":/^(\+?594|0|00594)[67]\d{8}$/,"fr-GP":/^(\+?590|0|00590)[67]\d{8}$/,"fr-MQ":/^(\+?596|0|00596)[67]\d{8}$/,"fr-RE":/^(\+?262|0|00262)[67]\d{8}$/,"he-IL":/^(\+972|0)([23489]|5[012345689]|77)[1-9]\d{6}$/,"hu-HU":/^(\+?36)(20|30|70)\d{7}$/,"id-ID":/^(\+?62|0)8(1[123456789]|2[1238]|3[1238]|5[12356789]|7[78]|9[56789]|8[123456789])([\s?|\d]{5,11})$/,"it-IT":/^(\+?39)?\s?3\d{2} ?\d{6,7}$/,"ja-JP":/^(\+81[ \-]?(\(0\))?|0)[6789]0[ \-]?\d{4}[ \-]?\d{4}$/,"kk-KZ":/^(\+?7|8)?7\d{9}$/,"kl-GL":/^(\+?299)?\s?\d{2}\s?\d{2}\s?\d{2}$/,"ko-KR":/^((\+?82)[ \-]?)?0?1([0|1|6|7|8|9]{1})[ \-]?\d{3,4}[ \-]?\d{4}$/,"lt-LT":/^(\+370|8)\d{8}$/,"ms-MY":/^(\+?6?01){1}(([0145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,"nb-NO":/^(\+?47)?[49]\d{7}$/,"ne-NP":/^(\+?977)?9[78]\d{8}$/,"nl-BE":/^(\+?32|0)4?\d{8}$/,"nl-NL":/^(((\+|00)?31\(0\))|((\+|00)?31)|0)6{1}\d{8}$/,"nn-NO":/^(\+?47)?[49]\d{7}$/,"pl-PL":/^(\+?48)? ?[5-8]\d ?\d{3} ?\d{2} ?\d{2}$/,"pt-BR":/(?=^(\+?5{2}\-?|0)[1-9]{2}\-?\d{4}\-?\d{4}$)(^(\+?5{2}\-?|0)[1-9]{2}\-?[6-9]{1}\d{3}\-?\d{4}$)|(^(\+?5{2}\-?|0)[1-9]{2}\-?9[6-9]{1}\d{3}\-?\d{4}$)/,"pt-PT":/^(\+?351)?9[1236]\d{7}$/,"ro-RO":/^(\+?4?0)\s?7\d{2}(\/|\s|\.|\-)?\d{3}(\s|\.|\-)?\d{3}$/,"ru-RU":/^(\+?7|8)?9\d{9}$/,"sl-SI":/^(\+386\s?|0)(\d{1}\s?\d{3}\s?\d{2}\s?\d{2}|\d{2}\s?\d{3}\s?\d{3})$/,"sk-SK":/^(\+?421)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,"sr-RS":/^(\+3816|06)[- \d]{5,9}$/,"sv-SE":/^(\+?46|0)[\s\-]?7[\s\-]?[02369]([\s\-]?\d){7}$/,"th-TH":/^(\+66|66|0)\d{9}$/,"tr-TR":/^(\+?90|0)?5\d{9}$/,"uk-UA":/^(\+?38|8)?0\d{9}$/,"vi-VN":/^(\+?84|0)((3([2-9]))|(5([2689]))|(7([0|6-9]))|(8([1-6|89]))|(9([0-9])))([0-9]{7})$/,"zh-CN":/^((\+|00)86)?1([3568][0-9]|4[579]|6[67]|7[01235678]|9[012356789])[0-9]{8}$/,"zh-TW":/^(\+?886\-?|0)?9\d{8}$/};Vt["en-CA"]=Vt["en-US"],Vt["fr-BE"]=Vt["nl-BE"],Vt["zh-HK"]=Vt["en-HK"],Vt["zh-MO"]=Vt["en-MO"];var jt=Object.keys(Vt),Jt=/^(0x)[0-9a-f]{40}$/i;var Xt={symbol:"$",require_symbol:!1,allow_space_after_symbol:!1,symbol_after_digits:!1,allow_negatives:!0,parens_for_negatives:!1,negative_sign_before_digits:!1,negative_sign_after_digits:!1,allow_negative_sign_placeholder:!1,thousands_separator:",",decimal_separator:".",allow_decimal:!0,require_decimal:!1,digits_after_decimal:[2],allow_space_after_digits:!1};var Qt=/^(bc1|[13])[a-zA-HJ-NP-Z0-9]{25,39}$/;var qt=/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;var te=/([01][0-9]|2[0-3])/,ee=/[0-5][0-9]/,re=new RegExp("[-+]".concat(te.source,":").concat(ee.source)),ne=new RegExp("([zZ]|".concat(re.source,")")),ie=new RegExp("".concat(te.source,":").concat(ee.source,":").concat(/([0-5][0-9]|60)/.source).concat(/(\.[0-9]+)?/.source)),oe=new RegExp("".concat(/[0-9]{4}/.source,"-").concat(/(0[1-9]|1[0-2])/.source,"-").concat(/([12]\d|0[1-9]|3[01])/.source)),ae=new RegExp("".concat(ie.source).concat(ne.source)),se=new RegExp("".concat(oe.source,"[ tT]").concat(ae.source));var le=["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","YE","YT","ZA","ZM","ZW"];var ue=["AFG","ALA","ALB","DZA","ASM","AND","AGO","AIA","ATA","ATG","ARG","ARM","ABW","AUS","AUT","AZE","BHS","BHR","BGD","BRB","BLR","BEL","BLZ","BEN","BMU","BTN","BOL","BES","BIH","BWA","BVT","BRA","IOT","BRN","BGR","BFA","BDI","KHM","CMR","CAN","CPV","CYM","CAF","TCD","CHL","CHN","CXR","CCK","COL","COM","COG","COD","COK","CRI","CIV","HRV","CUB","CUW","CYP","CZE","DNK","DJI","DMA","DOM","ECU","EGY","SLV","GNQ","ERI","EST","ETH","FLK","FRO","FJI","FIN","FRA","GUF","PYF","ATF","GAB","GMB","GEO","DEU","GHA","GIB","GRC","GRL","GRD","GLP","GUM","GTM","GGY","GIN","GNB","GUY","HTI","HMD","VAT","HND","HKG","HUN","ISL","IND","IDN","IRN","IRQ","IRL","IMN","ISR","ITA","JAM","JPN","JEY","JOR","KAZ","KEN","KIR","PRK","KOR","KWT","KGZ","LAO","LVA","LBN","LSO","LBR","LBY","LIE","LTU","LUX","MAC","MKD","MDG","MWI","MYS","MDV","MLI","MLT","MHL","MTQ","MRT","MUS","MYT","MEX","FSM","MDA","MCO","MNG","MNE","MSR","MAR","MOZ","MMR","NAM","NRU","NPL","NLD","NCL","NZL","NIC","NER","NGA","NIU","NFK","MNP","NOR","OMN","PAK","PLW","PSE","PAN","PNG","PRY","PER","PHL","PCN","POL","PRT","PRI","QAT","REU","ROU","RUS","RWA","BLM","SHN","KNA","LCA","MAF","SPM","VCT","WSM","SMR","STP","SAU","SEN","SRB","SYC","SLE","SGP","SXM","SVK","SVN","SLB","SOM","ZAF","SGS","SSD","ESP","LKA","SDN","SUR","SJM","SWZ","SWE","CHE","SYR","TWN","TJK","TZA","THA","TLS","TGO","TKL","TON","TTO","TUN","TUR","TKM","TCA","TUV","UGA","UKR","ARE","GBR","USA","UMI","URY","UZB","VUT","VEN","VNM","VGB","VIR","WLF","ESH","YEM","ZMB","ZWE"];var de=/^[A-Z2-7]+=*$/;var ce=/^[a-z]+\/[a-z0-9\-\+]+$/i,fe=/^[a-z\-]+=[a-z0-9\-]+$/i,$e=/^[a-z0-9!\$&'\(\)\*\+,;=\-\._~:@\/\?%\s]*$/i;var Ae=/^magnet:\?xt=urn:[a-z0-9]+:[a-z0-9]{32,40}&dn=.+&tr=.+$/i;var pe=/^(application|audio|font|image|message|model|multipart|text|video)\/[a-zA-Z0-9\.\-\+]{1,100}$/i,he=/^text\/[a-zA-Z0-9\.\-\+]{1,100};\s?charset=("[a-zA-Z0-9\.\-\+\s]{0,70}"|[a-zA-Z0-9\.\-\+]{0,70})(\s?\([a-zA-Z0-9\.\-\+\s]{1,20}\))?$/i,ge=/^multipart\/[a-zA-Z0-9\.\-\+]{1,100}(;\s?(boundary|charset)=("[a-zA-Z0-9\.\-\+\s]{0,70}"|[a-zA-Z0-9\.\-\+]{0,70})(\s?\([a-zA-Z0-9\.\-\+\s]{1,20}\))?){0,2}$/i;var ve=/^\(?[+-]?(90(\.0+)?|[1-8]?\d(\.\d+)?)$/,me=/^\s?[+-]?(180(\.0+)?|1[0-7]\d(\.\d+)?|\d{1,2}(\.\d+)?)\)?$/,Se=/^(([1-8]?\d)\D+([1-5]?\d|60)\D+([1-5]?\d|60)(\.\d+)?|90\D+0\D+0)\D+[NSns]?$/i,Ze=/^\s*([1-7]?\d{1,2}\D+([1-5]?\d|60)\D+([1-5]?\d|60)(\.\d+)?|180\D+0\D+0)\D+[EWew]?$/i,_e={checkDMS:!1};var Fe=/^\d{4}$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"]+"),"g"):/^\s+/g;return t.replace(r,"")}function Le(t,e){g(t);var r=e?new RegExp("[".concat(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"]+$"),"g"):/\s+$/g;return t.replace(r,"")}function Ne(t,e){return g(t),t.replace(new RegExp("[".concat(e,"]+"),"g"),"")}var Me={all_lowercase:!0,gmail_lowercase:!0,gmail_remove_dots:!0,gmail_remove_subaddress:!0,gmail_convert_googlemaildotcom:!0,outlookdotcom_lowercase:!0,outlookdotcom_remove_subaddress:!0,yahoo_lowercase:!0,yahoo_remove_subaddress:!0,yandex_lowercase:!0,icloud_lowercase:!0,icloud_remove_subaddress:!0},ye=["icloud.com","me.com"],Te=["hotmail.at","hotmail.be","hotmail.ca","hotmail.cl","hotmail.co.il","hotmail.co.nz","hotmail.co.th","hotmail.co.uk","hotmail.com","hotmail.com.ar","hotmail.com.au","hotmail.com.br","hotmail.com.gr","hotmail.com.mx","hotmail.com.pe","hotmail.com.tr","hotmail.com.vn","hotmail.cz","hotmail.de","hotmail.dk","hotmail.es","hotmail.fr","hotmail.hu","hotmail.id","hotmail.ie","hotmail.in","hotmail.it","hotmail.jp","hotmail.kr","hotmail.lv","hotmail.my","hotmail.ph","hotmail.pt","hotmail.sa","hotmail.sg","hotmail.sk","live.be","live.co.uk","live.com","live.com.ar","live.com.mx","live.de","live.es","live.eu","live.fr","live.it","live.nl","msn.com","outlook.at","outlook.be","outlook.cl","outlook.co.il","outlook.co.nz","outlook.co.th","outlook.com","outlook.com.ar","outlook.com.au","outlook.com.br","outlook.com.gr","outlook.com.pe","outlook.com.tr","outlook.com.vn","outlook.cz","outlook.de","outlook.dk","outlook.es","outlook.fr","outlook.hu","outlook.id","outlook.ie","outlook.in","outlook.it","outlook.jp","outlook.kr","outlook.lv","outlook.my","outlook.ph","outlook.pt","outlook.sa","outlook.sg","outlook.sk","passport.com"],we=["rocketmail.com","yahoo.ca","yahoo.co.uk","yahoo.com","yahoo.de","yahoo.fr","yahoo.in","yahoo.it","ymail.com"],xe=["yandex.ru","yandex.ua","yandex.kz","yandex.com","yandex.by","ya.ru"];function Be(t){return 1]/.test(r)){if(!e)return;if(!(r.split('"').length===r.split('\\"').length))return}return 1}}(i))return!1}else if(e.require_display_name)return!1}if(!e.ignore_max_length&&254]/.test(t))return!1;if(0===t.indexOf("mailto:"))return!1;var r,n,i,o,a,s,l,u;if(e=E(e,G),1<(l=(t=(l=(t=(l=t.split("#")).shift()).split("?")).shift()).split("://")).length){if(r=l.shift().toLowerCase(),e.require_valid_protocol&&-1===e.protocols.indexOf(r))return!1}else{if(e.require_protocol)return!1;if("//"===t.substr(0,2)){if(!e.allow_protocol_relative_urls)return!1;l[0]=t.substr(2)}}if(""===(t=l.join("://")))return!1;if(""===(t=(l=t.split("/")).shift())&&!e.require_host)return!0;if(1<(l=t.split("@")).length){if(e.disallow_auth)return!1;if(0<=(n=l.shift()).indexOf(":")&&2/g,">").replace(/\//g,"/").replace(/\\/g,"\").replace(/`/g,"`")},unescape:function(t){return g(t),t.replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">").replace(///g,"/").replace(/\/g,"\\").replace(/`/g,"`")},stripLow:function(t,e){return g(t),Ne(t,e?"\\x00-\\x09\\x0B\\x0C\\x0E-\\x1F\\x7F":"\\x00-\\x1F\\x7F")},whitelist:function(t,e){return g(t),t.replace(new RegExp("[^".concat(e,"]+"),"g"),"")},blacklist:Ne,isWhitelisted:function(t,e){g(t);for(var r=t.length-1;0<=r;r--)if(-1===e.indexOf(t[r]))return!1;return!0},normalizeEmail:function(t,e){e=E(e,Me);var r,n=t.split("@"),i=n.pop(),o=[n.join("@"),i];if(o[1]=o[1].toLowerCase(),"gmail.com"===o[1]||"googlemail.com"===o[1]){if(e.gmail_remove_subaddress&&(o[0]=o[0].split("+")[0]),e.gmail_remove_dots&&(o[0]=o[0].replace(/\.+/g,Be)),!o[0].length)return!1;(e.all_lowercase||e.gmail_lowercase)&&(o[0]=o[0].toLowerCase()),o[1]=e.gmail_convert_googlemaildotcom?"gmail.com":o[1]}else if(0<=ye.indexOf(o[1])){if(e.icloud_remove_subaddress&&(o[0]=o[0].split("+")[0]),!o[0].length)return!1;(e.all_lowercase||e.icloud_lowercase)&&(o[0]=o[0].toLowerCase())}else if(0<=Te.indexOf(o[1])){if(e.outlookdotcom_remove_subaddress&&(o[0]=o[0].split("+")[0]),!o[0].length)return!1;(e.all_lowercase||e.outlookdotcom_lowercase)&&(o[0]=o[0].toLowerCase())}else if(0<=we.indexOf(o[1])){if(e.yahoo_remove_subaddress&&(r=o[0].split("-"),o[0]=1=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f: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.")}var o,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}(function(t,e){for(var r=[],n=Math.min(t.length,e.length),i=0;i