diff --git a/.travis.yml b/.travis.yml
index fe0b9314e..6c69d39ac 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,6 +3,5 @@ language: node_js
node_js:
- stable
- 8
- - 6
notifications:
email: false
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5b6475715..caa2acba2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,7 +1,18 @@
#### HEAD
-- New locale
- ([#856](https://github.com/chriso/validator.js/pull/856))
+- Added support for IP hostnames in `isEmail()`
+ ([#845](https://github.com/chriso/validator.js/pull/845))
+- Added a `no_symbols` option to `isNumeric()`
+ ([#848](https://github.com/chriso/validator.js/pull/848))
+- Added a `no_colons` option to `isMACAddress()`
+ ([#849](https://github.com/chriso/validator.js/pull/849))
+- New and improved locales
+ ([#801](https://github.com/chriso/validator.js/pull/801),
+ [#856](https://github.com/chriso/validator.js/pull/856),
+ [#861](https://github.com/chriso/validator.js/pull/861),
+ [#863](https://github.com/chriso/validator.js/pull/863),
+ [#870](https://github.com/chriso/validator.js/pull/870),
+ [#872](https://github.com/chriso/validator.js/pull/872))
#### 10.4.0
diff --git a/README.md b/README.md
index 6b5cfdefd..ba0c3d7d1 100644
--- a/README.md
+++ b/README.md
@@ -63,8 +63,8 @@ Validator | Description
***contains(str, seed)*** | check if the string contains the seed.
**equals(str, comparison)** | check if the string matches the comparison.
**isAfter(str [, date])** | check if the string is a date that's after the specified date (defaults to now).
-**isAlpha(str [, locale])** | check if the string contains only letters (a-zA-Z).
Locale is one of `['ar', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-LB', 'ar-LY', 'ar-MA', 'ar-QA', 'ar-QM', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-YE', 'bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', 'es-ES', 'fr-FR', 'hu-HU', 'it-IT', 'nb-NO', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'sk-SK', 'sr-RS', 'sr-RS@latin', 'sv-SE', 'tr-TR', 'uk-UA']`) and defaults to `en-US`.
-**isAlphanumeric(str [, locale])** | check if the string contains only letters and numbers.
Locale is one of `['ar', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-LB', 'ar-LY', 'ar-MA', 'ar-QA', 'ar-QM', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-YE', 'bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', 'es-ES', 'fr-FR', 'hu-HU', 'it-IT', 'nb-NO', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'sk-SK', 'sr-RS', 'sr-RS@latin', 'sv-SE', 'tr-TR', 'uk-UA']`) and defaults to `en-US`.
+**isAlpha(str [, locale])** | check if the string contains only letters (a-zA-Z).
Locale is one of `['ar', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-LB', 'ar-LY', 'ar-MA', 'ar-QA', 'ar-QM', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-YE', 'bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', 'es-ES', 'fr-FR', 'hu-HU', 'it-IT', 'ku-IQ', 'nb-NO', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'sk-SK', 'sr-RS', 'sr-RS@latin', 'sv-SE', 'tr-TR', 'uk-UA']`) and defaults to `en-US`.
+**isAlphanumeric(str [, locale])** | check if the string contains only letters and numbers.
Locale is one of `['ar', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-LB', 'ar-LY', 'ar-MA', 'ar-QA', 'ar-QM', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-YE', 'bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', 'es-ES', 'fr-FR', 'hu-HU', 'it-IT', 'ku-IQ', 'nb-NO', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'sk-SK', 'sr-RS', 'sr-RS@latin', 'sv-SE', 'tr-TR', 'uk-UA']`) and defaults to `en-US`.
**isAscii(str)** | check if the string contains ASCII chars only.
**isBase64(str)** | check if a string is base64 encoded.
**isBefore(str [, date])** | check if the string is a date that's before the specified date.
@@ -73,9 +73,9 @@ Validator | Description
**isCreditCard(str)** | check if the string is a credit card.
**isCurrency(str [, options])** | check if the string is a valid currency amount.
`options` is an object which defaults to `{symbol: '$', require_symbol: false, allow_space_after_symbol: false, symbol_after_digits: false, allow_negatives: true, parens_for_negatives: false, negative_sign_before_digits: false, negative_sign_after_digits: false, allow_negative_sign_placeholder: false, thousands_separator: ',', decimal_separator: '.', allow_decimal: true, require_decimal: false, digits_after_decimal: [2], allow_space_after_digits: false}`.
**Note:** The array `digits_after_decimal` is filled with the exact number of digits allowd not a range, for example a range 1 to 3 will be given as [1, 2, 3].
**isDataURI(str)** | check if the string is a [data uri format](https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs).
-**isDecimal(str [, options])** | check if the string represents a decimal number, such as 0.1, .3, 1.1, 1.00003, 4.0, etc.
`options` is an object which defaults to `{force_decimal: false, decimal_digits: '1,', locale: 'en-US'}`
`locale` determine the decimal separator and is one of `['ar', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-LB', 'ar-LY', 'ar-MA', 'ar-QA', 'ar-QM', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-YE', 'bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', 'es-ES', 'fr-FR', 'hu-HU', 'it-IT', 'nb-NO', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'sr-RS', 'sr-RS@latin', 'sv-SE', 'tr-TR', 'uk-UA']`.
**Note:** `decimal_digits` is given as a range like '1,3', a specific value like '3' or min like '1,'.
+**isDecimal(str [, options])** | check if the string represents a decimal number, such as 0.1, .3, 1.1, 1.00003, 4.0, etc.
`options` is an object which defaults to `{force_decimal: false, decimal_digits: '1,', locale: 'en-US'}`
`locale` determine the decimal separator and is one of `['ar', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-LB', 'ar-LY', 'ar-MA', 'ar-QA', 'ar-QM', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-YE', 'bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', 'es-ES', 'fr-FR', 'hu-HU', 'it-IT', 'ku-IQ', nb-NO', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'sr-RS', 'sr-RS@latin', 'sv-SE', 'tr-TR', 'uk-UA']`.
**Note:** `decimal_digits` is given as a range like '1,3', a specific value like '3' or min like '1,'.
**isDivisibleBy(str, number)** | check if the string is a number that's divisible by another.
-**isEmail(str [, options])** | check if the string is an email.
`options` is an object which defaults to `{ allow_display_name: false, require_display_name: false, allow_utf8_local_part: true, require_tld: true }`. If `allow_display_name` is set to true, the validator will also match `Display Name `. If `require_display_name` is set to true, the validator will reject strings without the format `Display Name `. If `allow_utf8_local_part` is set to false, the validator will not allow any non-English UTF8 character in email address' local part. If `require_tld` is set to false, e-mail addresses without having TLD in their domain will also be matched.
+**isEmail(str [, options])** | check if the string is an email.
`options` is an object which defaults to `{ allow_display_name: false, require_display_name: false, allow_utf8_local_part: true, require_tld: true, allow_ip_domain: false }`. If `allow_display_name` is set to true, the validator will also match `Display Name `. If `require_display_name` is set to true, the validator will reject strings without the format `Display Name `. If `allow_utf8_local_part` is set to false, the validator will not allow any non-English UTF8 character in email address' local part. If `require_tld` is set to false, e-mail addresses without having TLD in their domain will also be matched. If `allow_ip_domain` is set to true, the validator will allow IP addresses in the host part.
**isEmpty(str)** | check if the string has a length of zero.
**isFQDN(str [, options])** | check if the string is a fully qualified domain name (e.g. domain.com).
`options` is an object which defaults to `{ require_tld: true, allow_underscores: false, allow_trailing_dot: false }`.
**isFloat(str [, options])** | check if the string is a float.
`options` is an object which can contain the keys `min`, `max`, `gt`, and/or `lt` to validate the float is within boundaries (e.g. `{ min: 7.22, max: 9.55 }`) it also has `locale` as an option.
`min` and `max` are equivalent to 'greater or equal' and 'less or equal', respectively while `gt` and `lt` are their strict counterparts.
`locale` determine the decimal separator and is one of `['ar', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-LB', 'ar-LY', 'ar-MA', 'ar-QA', 'ar-QM', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-YE', 'bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', 'es-ES', 'fr-FR', 'hu-HU', 'it-IT', 'nb-NO', 'nl-NL', 'nn-NO', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'sr-RS', 'sr-RS@latin', 'sv-SE', 'tr-TR', 'uk-UA']`.
@@ -100,15 +100,15 @@ Validator | Description
**isLatLong(str)** | check if the string is a valid latitude-longitude coordinate in the format `lat,long` or `lat, long`.
**isLength(str [, options])** | check if the string's length falls in a range.
`options` is an object which defaults to `{min:0, max: undefined}`. Note: this function takes into account surrogate pairs.
**isLowercase(str)** | check if the string is lowercase.
-**isMACAddress(str)** | check if the string is a MAC address.
+**isMACAddress(str)** | check if the string is a MAC address.
`options` is an object which defaults to `{no_colons: false}`. If `no_colons` is true, the validator will allow MAC addresses without the colons.
**isMD5(str)** | check if the string is a MD5 hash.
**isMimeType(str)** | check if the string matches to a valid [MIME type](https://en.wikipedia.org/wiki/Media_type) format
-**isMobilePhone(str, locale [, options])** | check if the string is a mobile phone number,
(locale is either an array of locales (e.g `['sk-SK', 'sr-RS']`) OR one of `['ar-AE', 'ar-DZ', 'ar-EG', 'ar-IQ', ar-JO', 'ar-KW', 'ar-SA', 'ar-SY', 'ar-TN', 'be-BY', 'bg-BG', 'cs-CZ', 'de-DE', 'da-DK', 'el-GR', 'en-AU', 'en-CA', 'en-GB', 'en-HK', 'en-IN', 'en-KE', 'en-NG', 'en-NZ', 'en-RW', 'en-SG', 'en-UG', 'en-US', 'en-TZ', 'en-ZA', 'en-ZM', 'en-PK', 'es-ES', 'et-EE', 'fa-IR', 'fi-FI', 'fr-FR', 'he-IL', 'hu-HU', 'it-IT', 'ja-JP', 'kk-KZ', 'ko-KR', 'lt-LT', 'ms-MY', 'nb-NO', 'nn-NO', 'pl-PL', 'pt-PT', 'pt-BR', 'ro-RO', 'ru-RU', 'sk-SK', 'sr-RS', 'sv-SE', 'th-TH', 'tr-TR', 'uk-UA', 'vi-VN', 'zh-CN', 'zh-HK', 'zh-TW']` OR 'any'. If 'any' is used, function will check if any of the locales match).
`options` is an optional object that can be supplied with the following keys: `strictMode`, if this is set to `true`, the mobile phone number must be supplied with the country code and therefore must start with `+`.
+**isMobilePhone(str, locale [, options])** | check if the string is a mobile phone number,
(locale is either an array of locales (e.g `['sk-SK', 'sr-RS']`) OR one of `['ar-AE', 'ar-DZ', 'ar-EG', 'ar-IQ', ar-JO', 'ar-KW', 'ar-SA', 'ar-SY', 'ar-TN', 'be-BY', 'bg-BG', 'bn-BD', 'cs-CZ', 'de-DE', 'da-DK', 'el-GR', 'en-AU', 'en-CA', 'en-GB', 'en-HK', 'en-IN', 'en-KE', 'en-NG', 'en-NZ', 'en-RW', 'en-SG', 'en-UG', 'en-US', 'en-TZ', 'en-ZA', 'en-ZM', 'en-PK', 'es-ES', 'et-EE', 'fa-IR', 'fi-FI', 'fr-FR', 'he-IL', 'hu-HU', 'it-IT', 'ja-JP', 'kk-KZ', 'ko-KR', 'lt-LT', 'ms-MY', 'nb-NO', 'nn-NO', 'pl-PL', 'pt-PT', 'pt-BR', 'ro-RO', 'ru-RU', 'sk-SK', 'sr-RS', 'sv-SE', 'th-TH', 'tr-TR', 'uk-UA', 'vi-VN', 'zh-CN', 'zh-HK', 'zh-TW']` OR 'any'. If 'any' is used, function will check if any of the locales match).
`options` is an optional object that can be supplied with the following keys: `strictMode`, if this is set to `true`, the mobile phone number must be supplied with the country code and therefore must start with `+`.
**isMongoId(str)** | check if the string is a valid hex-encoded representation of a [MongoDB ObjectId][mongoid].
**isMultibyte(str)** | check if the string contains one or more multibyte chars.
-**isNumeric(str)** | check if the string contains only numbers.
+**isNumeric(str [, options])** | check if the string contains only numbers.
`options` is an object which defaults to `{no_symbols: false}`. If `no_symbols` is true, the validator will reject numeric strings that feature a symbol (e.g. `+`, `-`, or `.`).
**isPort(str)** | check if the string is a valid port number.
-**isPostalCode(str, locale)** | check if the string is a postal code,
(locale is one of `[ 'AT', 'AU', 'BE', 'BG', 'CA', 'CH', 'CZ', 'DE', 'DK', 'DZ', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'HR', 'HU', 'IL', 'IN', 'IS', 'IT', 'JP', 'KE', 'LI', 'LT', 'LU', 'LV', 'MX', 'NL', 'NO', 'PL', 'PT', 'RO', 'RU', 'SA', 'SE', 'SI', 'TN', 'TW', 'US', 'ZA', 'ZM' ]` OR 'any'. If 'any' is used, function will check if any of the locals match. locale list is `validator.isPostalCodeLocales`.).
+**isPostalCode(str, locale)** | check if the string is a postal code,
(locale is one of `[ 'AD', 'AT', 'AU', 'BE', 'BG', 'CA', 'CH', 'CZ', 'DE', 'DK', 'DZ', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'HR', 'HU', 'IL', 'IN', 'IS', 'IT', 'JP', 'KE', 'LI', 'LT', 'LU', 'LV', 'MX', 'NL', 'NO', 'PL', 'PT', 'RO', 'RU', 'SA', 'SE', 'SI', 'TN', 'TW', 'US', 'ZA', 'ZM' ]` OR 'any'. If 'any' is used, function will check if any of the locals match. locale list is `validator.isPostalCodeLocales`.).
**isSurrogatePair(str)** | check if the string contains any surrogate pairs chars.
**isURL(str [, options])** | check if the string is an URL.
`options` is an object which defaults to `{ protocols: ['http','https','ftp'], require_tld: true, require_protocol: false, require_host: true, require_valid_protocol: true, allow_underscores: false, host_whitelist: false, host_blacklist: false, allow_trailing_dot: false, allow_protocol_relative_urls: false }`.
**isUUID(str [, version])** | check if the string is a UUID (version 3, 4 or 5).
diff --git a/lib/alpha.js b/lib/alpha.js
index 3b49eb346..5c8a3f8a7 100644
--- a/lib/alpha.js
+++ b/lib/alpha.js
@@ -26,6 +26,7 @@ var alpha = exports.alpha = {
'sv-SE': /^[A-ZÅÄÖ]+$/i,
'tr-TR': /^[A-ZÇĞİıÖŞÜ]+$/i,
'uk-UA': /^[А-ЩЬЮЯЄIЇҐі]+$/i,
+ 'ku-IQ': /^[ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,
ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/
};
@@ -52,6 +53,7 @@ var alphanumeric = exports.alphanumeric = {
'sv-SE': /^[0-9A-ZÅÄÖ]+$/i,
'tr-TR': /^[0-9A-ZÇĞİıÖŞÜ]+$/i,
'uk-UA': /^[0-9А-ЩЬЮЯЄIЇҐі]+$/i,
+ 'ku-IQ': /^[٠١٢٣٤٥٦٧٨٩0-9ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,
ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/
};
@@ -81,7 +83,7 @@ for (var _locale, _i = 0; _i < arabicLocales.length; _i++) {
// Source: https://en.wikipedia.org/wiki/Decimal_mark
var dotDecimal = exports.dotDecimal = [];
-var commaDecimal = exports.commaDecimal = ['bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'es-ES', 'fr-FR', 'it-IT', 'hu-HU', 'nb-NO', 'nn-NO', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'sr-RS@latin', 'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA'];
+var commaDecimal = exports.commaDecimal = ['bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'es-ES', 'fr-FR', 'it-IT', 'ku-IQ', 'hu-HU', 'nb-NO', 'nn-NO', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'sr-RS@latin', 'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA'];
for (var _i2 = 0; _i2 < dotDecimal.length; _i2++) {
decimal[dotDecimal[_i2]] = decimal['en-US'];
@@ -93,4 +95,9 @@ for (var _i3 = 0; _i3 < commaDecimal.length; _i3++) {
alpha['pt-BR'] = alpha['pt-PT'];
alphanumeric['pt-BR'] = alphanumeric['pt-PT'];
-decimal['pt-BR'] = decimal['pt-PT'];
\ No newline at end of file
+decimal['pt-BR'] = decimal['pt-PT'];
+
+// see #862
+alpha['pl-Pl'] = alpha['pl-PL'];
+alphanumeric['pl-Pl'] = alphanumeric['pl-PL'];
+decimal['pl-Pl'] = decimal['pl-PL'];
\ No newline at end of file
diff --git a/lib/isEmail.js b/lib/isEmail.js
index 941cb4cbb..65ce4ce9c 100644
--- a/lib/isEmail.js
+++ b/lib/isEmail.js
@@ -21,6 +21,10 @@ var _isFQDN = require('./isFQDN');
var _isFQDN2 = _interopRequireDefault(_isFQDN);
+var _isIP = require('./isIP');
+
+var _isIP2 = _interopRequireDefault(_isIP);
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var default_email_options = {
@@ -91,7 +95,21 @@ function isEmail(str, options) {
}
if (!(0, _isFQDN2.default)(domain, { require_tld: options.require_tld })) {
- return false;
+ if (!options.allow_ip_domain) {
+ return false;
+ }
+
+ if (!(0, _isIP2.default)(domain)) {
+ if (!domain.startsWith('[') || !domain.endsWith(']')) {
+ return false;
+ }
+
+ var noBracketdomain = domain.substr(1, domain.length - 2);
+
+ if (noBracketdomain.length === 0 || !(0, _isIP2.default)(noBracketdomain)) {
+ return false;
+ }
+ }
}
if (user[0] === '"') {
diff --git a/lib/isMACAddress.js b/lib/isMACAddress.js
index 16d1631de..38c12645d 100644
--- a/lib/isMACAddress.js
+++ b/lib/isMACAddress.js
@@ -12,9 +12,13 @@ var _assertString2 = _interopRequireDefault(_assertString);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var macAddress = /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/;
+var macAddressNoColons = /^([0-9a-fA-F]){12}$/;
-function isMACAddress(str) {
+function isMACAddress(str, options) {
(0, _assertString2.default)(str);
+ if (options && options.no_colons) {
+ return macAddressNoColons.test(str);
+ }
return macAddress.test(str);
}
module.exports = exports['default'];
\ No newline at end of file
diff --git a/lib/isMobilePhone.js b/lib/isMobilePhone.js
index 8a30a7bc2..3fd089343 100644
--- a/lib/isMobilePhone.js
+++ b/lib/isMobilePhone.js
@@ -24,6 +24,7 @@ var phones = {
'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': /\+?(88)?0?1[156789][0-9]{8}\b/,
'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[ \.\-]?)?([\(]{1}[0-9]{1,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,
@@ -40,7 +41,7 @@ var phones = {
'en-SG': /^(\+65)?[89]\d{7}$/,
'en-TZ': /^(\+?255|0)?[67]\d{8}$/,
'en-UG': /^(\+?256|0)?[7]\d{8}$/,
- 'en-US': /^(\+?1)?[2-9]\d{2}[2-9](?!11)\d{6}$/,
+ 'en-US': /^(\+?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}$/,
'es-ES': /^(\+?34)?(6\d{1}|7[1234])\d{7}$/,
@@ -51,7 +52,7 @@ var phones = {
'fr-FR': /^(\+?33|0)[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[1-9])[\s|\d]+$/,
+ 'id-ID': /^(\+?62|0)(0?8?\d\d\s?\d?)([\s?|\d]{7,12})$/,
'it-IT': /^(\+?39)?\s?3\d{2} ?\d{6,7}$/,
'ja-JP': /^(\+?81|0)[789]0[ \-]?[1-9]\d{2}[ \-]?\d{5}$/,
'kk-KZ': /^(\+?7|8)?7\d{9}$/,
@@ -74,7 +75,7 @@ var phones = {
'tr-TR': /^(\+?90|0)?5\d{9}$/,
'uk-UA': /^(\+?38|8)?0\d{9}$/,
'vi-VN': /^(\+?84|0)?((1(2([0-9])|6([2-9])|88|99))|(9((?!5)[0-9])))([0-9]{7})$/,
- 'zh-CN': /^(\+?0?86\-?)?1[3456789]\d{9}$/,
+ 'zh-CN': /^((\+|00)86)?1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$/,
'zh-TW': /^(\+?886\-?|0)?9\d{8}$/
};
/* eslint-enable max-len */
diff --git a/lib/isNumeric.js b/lib/isNumeric.js
index 9d4c633e7..13a32a770 100644
--- a/lib/isNumeric.js
+++ b/lib/isNumeric.js
@@ -12,9 +12,13 @@ var _assertString2 = _interopRequireDefault(_assertString);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var numeric = /^[+-]?([0-9]*[.])?[0-9]+$/;
+var numericNoSymbols = /^[0-9]+$/;
-function isNumeric(str) {
+function isNumeric(str, options) {
(0, _assertString2.default)(str);
+ if (options && options.no_symbols) {
+ return numericNoSymbols.test(str);
+ }
return numeric.test(str);
}
module.exports = exports['default'];
\ No newline at end of file
diff --git a/lib/isPostalCode.js b/lib/isPostalCode.js
index c637d4b9e..a6fe0cba8 100644
--- a/lib/isPostalCode.js
+++ b/lib/isPostalCode.js
@@ -36,6 +36,7 @@ var fiveDigit = /^\d{5}$/;
var sixDigit = /^\d{6}$/;
var patterns = {
+ AD: /^AD\d{3}$/,
AT: fourDigit,
AU: fourDigit,
BE: fourDigit,
diff --git a/src/lib/alpha.js b/src/lib/alpha.js
index e54a2f90e..7e183f6cf 100644
--- a/src/lib/alpha.js
+++ b/src/lib/alpha.js
@@ -21,6 +21,7 @@ export const alpha = {
'sv-SE': /^[A-ZÅÄÖ]+$/i,
'tr-TR': /^[A-ZÇĞİıÖŞÜ]+$/i,
'uk-UA': /^[А-ЩЬЮЯЄIЇҐі]+$/i,
+ 'ku-IQ': /^[ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,
ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/,
};
@@ -47,6 +48,7 @@ export const alphanumeric = {
'sv-SE': /^[0-9A-ZÅÄÖ]+$/i,
'tr-TR': /^[0-9A-ZÇĞİıÖŞÜ]+$/i,
'uk-UA': /^[0-9А-ЩЬЮЯЄIЇҐі]+$/i,
+ 'ku-IQ': /^[٠١٢٣٤٥٦٧٨٩0-9ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,
ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/,
};
@@ -81,7 +83,7 @@ for (let locale, i = 0; i < arabicLocales.length; i++) {
// Source: https://en.wikipedia.org/wiki/Decimal_mark
export const dotDecimal = [];
export const commaDecimal = [
- 'bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'es-ES', 'fr-FR', 'it-IT', 'hu-HU', 'nb-NO',
+ 'bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'es-ES', 'fr-FR', 'it-IT', 'ku-IQ', 'hu-HU', 'nb-NO',
'nn-NO', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'sr-RS@latin',
'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA',
];
@@ -97,3 +99,8 @@ for (let i = 0; i < commaDecimal.length; i++) {
alpha['pt-BR'] = alpha['pt-PT'];
alphanumeric['pt-BR'] = alphanumeric['pt-PT'];
decimal['pt-BR'] = decimal['pt-PT'];
+
+// see #862
+alpha['pl-Pl'] = alpha['pl-PL'];
+alphanumeric['pl-Pl'] = alphanumeric['pl-PL'];
+decimal['pl-Pl'] = decimal['pl-PL'];
\ No newline at end of file
diff --git a/src/lib/isEmail.js b/src/lib/isEmail.js
index e6df4f36c..037183c98 100644
--- a/src/lib/isEmail.js
+++ b/src/lib/isEmail.js
@@ -3,6 +3,7 @@ import assertString from './util/assertString';
import merge from './util/merge';
import isByteLength from './isByteLength';
import isFQDN from './isFQDN';
+import isIP from './isIP';
const default_email_options = {
allow_display_name: false,
@@ -73,7 +74,21 @@ export default function isEmail(str, options) {
}
if (!isFQDN(domain, { require_tld: options.require_tld })) {
- return false;
+ if (!options.allow_ip_domain) {
+ return false;
+ }
+
+ if (!isIP(domain)) {
+ if (!domain.startsWith('[') || !domain.endsWith(']')) {
+ return false;
+ }
+
+ let noBracketdomain = domain.substr(1, domain.length - 2);
+
+ if (noBracketdomain.length === 0 || !isIP(noBracketdomain)) {
+ return false;
+ }
+ }
}
if (user[0] === '"') {
diff --git a/src/lib/isMACAddress.js b/src/lib/isMACAddress.js
index 78647bd0e..6e64c56fc 100644
--- a/src/lib/isMACAddress.js
+++ b/src/lib/isMACAddress.js
@@ -1,8 +1,12 @@
import assertString from './util/assertString';
const macAddress = /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/;
+const macAddressNoColons = /^([0-9a-fA-F]){12}$/;
-export default function isMACAddress(str) {
+export default function isMACAddress(str, options) {
assertString(str);
+ if (options && options.no_colons) {
+ return macAddressNoColons.test(str);
+ }
return macAddress.test(str);
}
diff --git a/src/lib/isMobilePhone.js b/src/lib/isMobilePhone.js
index 10e6f5c0d..63cb6de49 100644
--- a/src/lib/isMobilePhone.js
+++ b/src/lib/isMobilePhone.js
@@ -13,6 +13,7 @@ const phones = {
'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': /\+?(88)?0?1[156789][0-9]{8}\b/,
'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[ \.\-]?)?([\(]{1}[0-9]{1,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,
@@ -29,7 +30,7 @@ const phones = {
'en-SG': /^(\+65)?[89]\d{7}$/,
'en-TZ': /^(\+?255|0)?[67]\d{8}$/,
'en-UG': /^(\+?256|0)?[7]\d{8}$/,
- 'en-US': /^(\+?1)?[2-9]\d{2}[2-9](?!11)\d{6}$/,
+ 'en-US': /^(\+?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}$/,
'es-ES': /^(\+?34)?(6\d{1}|7[1234])\d{7}$/,
@@ -40,7 +41,7 @@ const phones = {
'fr-FR': /^(\+?33|0)[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[1-9])[\s|\d]+$/,
+ 'id-ID': /^(\+?62|0)(0?8?\d\d\s?\d?)([\s?|\d]{7,12})$/,
'it-IT': /^(\+?39)?\s?3\d{2} ?\d{6,7}$/,
'ja-JP': /^(\+?81|0)[789]0[ \-]?[1-9]\d{2}[ \-]?\d{5}$/,
'kk-KZ': /^(\+?7|8)?7\d{9}$/,
@@ -63,7 +64,7 @@ const phones = {
'tr-TR': /^(\+?90|0)?5\d{9}$/,
'uk-UA': /^(\+?38|8)?0\d{9}$/,
'vi-VN': /^(\+?84|0)?((1(2([0-9])|6([2-9])|88|99))|(9((?!5)[0-9])))([0-9]{7})$/,
- 'zh-CN': /^(\+?0?86\-?)?1[3456789]\d{9}$/,
+ 'zh-CN': /^((\+|00)86)?1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$/,
'zh-TW': /^(\+?886\-?|0)?9\d{8}$/,
};
/* eslint-enable max-len */
diff --git a/src/lib/isNumeric.js b/src/lib/isNumeric.js
index 69645a1ba..65649ae88 100644
--- a/src/lib/isNumeric.js
+++ b/src/lib/isNumeric.js
@@ -1,8 +1,12 @@
import assertString from './util/assertString';
const numeric = /^[+-]?([0-9]*[.])?[0-9]+$/;
+const numericNoSymbols = /^[0-9]+$/;
-export default function isNumeric(str) {
+export default function isNumeric(str, options) {
assertString(str);
+ if (options && options.no_symbols) {
+ return numericNoSymbols.test(str);
+ }
return numeric.test(str);
}
diff --git a/src/lib/isPostalCode.js b/src/lib/isPostalCode.js
index 3d852d8f3..f8bbfe774 100644
--- a/src/lib/isPostalCode.js
+++ b/src/lib/isPostalCode.js
@@ -7,6 +7,7 @@ const fiveDigit = /^\d{5}$/;
const sixDigit = /^\d{6}$/;
const patterns = {
+ AD: /^AD\d{3}$/,
AT: fourDigit,
AU: fourDigit,
BE: fourDigit,
diff --git a/test/validators.js b/test/validators.js
index 22d8ab61e..ee831c76c 100644
--- a/test/validators.js
+++ b/test/validators.js
@@ -98,6 +98,8 @@ describe('Validators', () => {
'multiple..dots@gmail.com',
'multiple..dots@stillinvalid.com',
'test123+invalid! sub_address@gmail.com',
+ 'email@0.0.0.256',
+ 'email@26.0.0.256',
],
});
});
@@ -228,6 +230,52 @@ describe('Validators', () => {
});
});
+ it('should validate email addresses with allowed IPs', () => {
+ test({
+ validator: 'isEmail',
+ args: [{ allow_ip_domain: true }],
+ valid: [
+ 'email@[123.123.123.123]',
+ 'email@255.255.255.255',
+ ],
+ invalid: [
+ 'invalidemail@',
+ 'invalid.com',
+ '@invalid.com',
+ 'foo@bar.com.',
+ 'somename@gmail.com',
+ 'foo@bar.co.uk.',
+ 'z@co.c',
+ 'gmailgmailgmailgmailgmail@gmail.com',
+ `${repeat('a', 64)}@${repeat('a', 251)}.com`,
+ `${repeat('a', 65)}@${repeat('a', 250)}.com`,
+ `${repeat('a', 64)}@${repeat('a', 64)}.com`,
+ `${repeat('a', 31)}@gmail.com`,
+ 'test1@invalid.co m',
+ 'test2@invalid.co m',
+ 'test3@invalid.co m',
+ 'test4@invalid.co m',
+ 'test5@invalid.co m',
+ 'test6@invalid.co m',
+ 'test7@invalid.co m',
+ 'test8@invalid.co m',
+ 'test9@invalid.co m',
+ 'test10@invalid.co m',
+ 'test11@invalid.co m',
+ 'test12@invalid.co m',
+ 'test13@invalid.co m',
+ 'gmail...ignores...dots...@gmail.com',
+ 'test@gmail.com',
+ 'test.1@gmail.com',
+ 'ends.with.dot.@gmail.com',
+ 'multiple..dots@gmail.com',
+ 'multiple..dots@stillinvalid.com',
+ 'test123+invalid! sub_address@gmail.com',
+ 'email@0.0.0.256',
+ 'email@26.0.0.256',
+ ],
+ });
+ });
it('should validate URLs', () => {
test({
@@ -563,6 +611,36 @@ describe('Validators', () => {
});
});
+ it('should validate MAC addresses without colons', () => {
+ test({
+ validator: 'isMACAddress',
+ args: [{
+ no_colons: true,
+ }],
+ valid: [
+ 'abababababab',
+ 'FFFFFFFFFFFF',
+ '0102030405ab',
+ '01AB03040506',
+ ],
+ invalid: [
+ 'abc',
+ '01:02:03:04:05',
+ '01:02:03:04::ab',
+ '1:2:3:4:5:6',
+ 'AB:CD:EF:GH:01:02',
+ 'ab:ab:ab:ab:ab:ab',
+ 'FF:FF:FF:FF:FF:FF',
+ '01:02:03:04:05:ab',
+ '01:AB:03:04:05:06',
+ '0102030405',
+ '01020304ab',
+ '123456',
+ 'ABCDEFGH0102',
+ ],
+ });
+ });
+
it('should validate IP addresses', () => {
test({
validator: 'isIP',
@@ -913,6 +991,28 @@ describe('Validators', () => {
});
});
+ it('should validate kurdish alpha strings', () => {
+ test({
+ validator: 'isAlpha',
+ args: ['ku-IQ'],
+ valid: [
+ 'ئؤڤگێ',
+ 'کوردستان',
+ ],
+ invalid: [
+ 'ئؤڤگێ١٢٣',
+ '١٢٣',
+ 'abc1',
+ ' foo ',
+ '',
+ 'ÄBC',
+ 'FÜübar',
+ 'Jön',
+ 'Heiß',
+ ],
+ });
+ });
+
it('should validate norwegian alpha strings', () => {
test({
validator: 'isAlpha',
@@ -1321,6 +1421,21 @@ describe('Validators', () => {
});
});
+ it('should validate kurdish alphanumeric strings', () => {
+ test({
+ validator: 'isAlphanumeric',
+ args: ['ku-IQ'],
+ valid: [
+ 'ئؤڤگێ١٢٣',
+ ],
+ invalid: [
+ 'äca ',
+ 'abcß',
+ 'föö!!',
+ ],
+ });
+ });
+
it('should validate defined arabic aliases', () => {
test({
validator: 'isAlphanumeric',
@@ -1500,8 +1615,34 @@ describe('Validators', () => {
'-0',
'+123',
'123.123',
+ '+000000',
+ ],
+ invalid: [
+ ' ',
+ '',
+ '.',
+ ],
+ });
+ });
+
+ it('should validate numeric strings without symbols', () => {
+ test({
+ validator: 'isNumeric',
+ args: [{
+ no_symbols: true,
+ }],
+ valid: [
+ '123',
+ '00123',
+ '0',
],
invalid: [
+ '-0',
+ '+000000',
+ '',
+ '+123',
+ '123.123',
+ '-00123',
' ',
'.',
],
@@ -3259,6 +3400,22 @@ describe('Validators', () => {
'12125559999',
],
},
+ {
+ locale: 'bn-BD',
+ valid: [
+ '+8801794626846',
+ '01199098893',
+ '8801671163269',
+ '01717112029',
+ ],
+ invalid: [
+ '',
+ '0174626346',
+ '017943563469',
+ '18001234567',
+ '01494676946',
+ ],
+ },
{
locale: 'cs-CZ',
valid: [
@@ -3331,17 +3488,26 @@ describe('Validators', () => {
'15323456787',
'13523333233',
'13898728332',
- '+086-13238234822',
- '08613487234567',
- '8617823492338',
- '86-17823492338',
+ '+8613238234822',
+ '+8613487234567',
+ '+8617823492338',
+ '+8617823492338',
'16637108167',
- '86-16637108167',
- '+086-16637108167',
+ '+8616637108167',
+ '+8616637108167',
+ '008618812341234',
+ '008618812341234',
+ '+8619912341234',
+ '+8619812341234',
],
invalid: [
'12345',
'',
+ '+08613811211114',
+ '+008613811211114',
+ '08613811211114',
+ '0086-13811211114',
+ '0086-138-1121-1114',
'Vml2YW11cyBmZXJtZtesting123',
'010-38238383',
],
@@ -3567,34 +3733,33 @@ describe('Validators', () => {
'19876543210',
'8005552222',
'+15673628910',
+ '+1(567)3628910',
+ '+1(567)362-8910',
+ '+1(567) 362-8910',
+ '1(567)362-8910',
+ '1(567)362 8910',
+ '223-456-7890',
],
invalid: [
'564785',
'0123456789',
'1437439210',
- '8009112340',
'+10345672645',
'11435213543',
- '2436119753',
- '16532116190',
+ '1(067)362-8910',
+ '1(167)362-8910',
+ '+2(267)362-8910',
],
},
{
locale: 'en-CA',
- valid: [
- '19876543210',
- '8005552222',
- '+15673628910',
- ],
+ valid: ['19876543210', '8005552222', '+15673628910'],
invalid: [
'564785',
'0123456789',
'1437439210',
- '8009112340',
'+10345672645',
'11435213543',
- '2436119753',
- '16532116190',
],
},
{
@@ -4027,6 +4192,10 @@ describe('Validators', () => {
'+6221740123456',
'+62811 778 998',
'+62811778998',
+ '+62812 9650 3508',
+ '08197231819',
+ '085361008008',
+ '+62811787391',
],
invalid: [
'+65740 123 456',
@@ -5571,6 +5740,18 @@ describe('Validators', () => {
'499 49',
],
},
+ {
+ locale: 'AD',
+ valid: [
+ 'AD100',
+ 'AD200',
+ 'AD300',
+ 'AD400',
+ 'AD500',
+ 'AD600',
+ 'AD700',
+ ],
+ },
];
let allValid = [];
diff --git a/validator.js b/validator.js
index 688b1492c..9a83edb62 100644
--- a/validator.js
+++ b/validator.js
@@ -173,6 +173,74 @@ function isFQDN(str, options) {
return true;
}
+var ipv4Maybe = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
+var ipv6Block = /^[0-9A-F]{1,4}$/i;
+
+function isIP(str) {
+ var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
+
+ assertString(str);
+ version = String(version);
+ if (!version) {
+ return isIP(str, 4) || isIP(str, 6);
+ } else if (version === '4') {
+ if (!ipv4Maybe.test(str)) {
+ return false;
+ }
+ var parts = str.split('.').sort(function (a, b) {
+ return a - b;
+ });
+ return parts[3] <= 255;
+ } else if (version === '6') {
+ var blocks = str.split(':');
+ var foundOmissionBlock = false; // marker to indicate ::
+
+ // At least some OS accept the last 32 bits of an IPv6 address
+ // (i.e. 2 of the blocks) in IPv4 notation, and RFC 3493 says
+ // that '::ffff:a.b.c.d' is valid for IPv4-mapped IPv6 addresses,
+ // and '::a.b.c.d' is deprecated, but also valid.
+ var foundIPv4TransitionBlock = isIP(blocks[blocks.length - 1], 4);
+ var expectedNumberOfBlocks = foundIPv4TransitionBlock ? 7 : 8;
+
+ if (blocks.length > expectedNumberOfBlocks) {
+ return false;
+ }
+ // initial or final ::
+ if (str === '::') {
+ return true;
+ } else if (str.substr(0, 2) === '::') {
+ blocks.shift();
+ blocks.shift();
+ foundOmissionBlock = true;
+ } else if (str.substr(str.length - 2) === '::') {
+ blocks.pop();
+ blocks.pop();
+ foundOmissionBlock = true;
+ }
+
+ for (var i = 0; i < blocks.length; ++i) {
+ // test for a :: which can not be at the string start/end
+ // since those cases have been handled above
+ if (blocks[i] === '' && i > 0 && i < blocks.length - 1) {
+ if (foundOmissionBlock) {
+ return false; // multiple :: in address
+ }
+ foundOmissionBlock = true;
+ } else if (foundIPv4TransitionBlock && i === blocks.length - 1) {
+ // it has been checked before that the last
+ // block is a valid IPv4 address
+ } else if (!ipv6Block.test(blocks[i])) {
+ return false;
+ }
+ }
+ if (foundOmissionBlock) {
+ return blocks.length >= 1;
+ }
+ return blocks.length === expectedNumberOfBlocks;
+ }
+ return false;
+}
+
var default_email_options = {
allow_display_name: false,
require_display_name: false,
@@ -241,7 +309,21 @@ function isEmail(str, options) {
}
if (!isFQDN(domain, { require_tld: options.require_tld })) {
- return false;
+ if (!options.allow_ip_domain) {
+ return false;
+ }
+
+ if (!isIP(domain)) {
+ if (!domain.startsWith('[') || !domain.endsWith(']')) {
+ return false;
+ }
+
+ var noBracketdomain = domain.substr(1, domain.length - 2);
+
+ if (noBracketdomain.length === 0 || !isIP(noBracketdomain)) {
+ return false;
+ }
+ }
}
if (user[0] === '"') {
@@ -261,74 +343,6 @@ function isEmail(str, options) {
return true;
}
-var ipv4Maybe = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
-var ipv6Block = /^[0-9A-F]{1,4}$/i;
-
-function isIP(str) {
- var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
-
- assertString(str);
- version = String(version);
- if (!version) {
- return isIP(str, 4) || isIP(str, 6);
- } else if (version === '4') {
- if (!ipv4Maybe.test(str)) {
- return false;
- }
- var parts = str.split('.').sort(function (a, b) {
- return a - b;
- });
- return parts[3] <= 255;
- } else if (version === '6') {
- var blocks = str.split(':');
- var foundOmissionBlock = false; // marker to indicate ::
-
- // At least some OS accept the last 32 bits of an IPv6 address
- // (i.e. 2 of the blocks) in IPv4 notation, and RFC 3493 says
- // that '::ffff:a.b.c.d' is valid for IPv4-mapped IPv6 addresses,
- // and '::a.b.c.d' is deprecated, but also valid.
- var foundIPv4TransitionBlock = isIP(blocks[blocks.length - 1], 4);
- var expectedNumberOfBlocks = foundIPv4TransitionBlock ? 7 : 8;
-
- if (blocks.length > expectedNumberOfBlocks) {
- return false;
- }
- // initial or final ::
- if (str === '::') {
- return true;
- } else if (str.substr(0, 2) === '::') {
- blocks.shift();
- blocks.shift();
- foundOmissionBlock = true;
- } else if (str.substr(str.length - 2) === '::') {
- blocks.pop();
- blocks.pop();
- foundOmissionBlock = true;
- }
-
- for (var i = 0; i < blocks.length; ++i) {
- // test for a :: which can not be at the string start/end
- // since those cases have been handled above
- if (blocks[i] === '' && i > 0 && i < blocks.length - 1) {
- if (foundOmissionBlock) {
- return false; // multiple :: in address
- }
- foundOmissionBlock = true;
- } else if (foundIPv4TransitionBlock && i === blocks.length - 1) {
- // it has been checked before that the last
- // block is a valid IPv4 address
- } else if (!ipv6Block.test(blocks[i])) {
- return false;
- }
- }
- if (foundOmissionBlock) {
- return blocks.length >= 1;
- }
- return blocks.length === expectedNumberOfBlocks;
- }
- return false;
-}
-
var default_url_options = {
protocols: ['http', 'https', 'ftp'],
require_tld: true,
@@ -452,9 +466,13 @@ function isURL(url, options) {
}
var macAddress = /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/;
+var macAddressNoColons = /^([0-9a-fA-F]){12}$/;
-function isMACAddress(str) {
+function isMACAddress(str, options) {
assertString(str);
+ if (options && options.no_colons) {
+ return macAddressNoColons.test(str);
+ }
return macAddress.test(str);
}
@@ -509,6 +527,7 @@ var alpha = {
'sv-SE': /^[A-ZÅÄÖ]+$/i,
'tr-TR': /^[A-ZÇĞİıÖŞÜ]+$/i,
'uk-UA': /^[А-ЩЬЮЯЄIЇҐі]+$/i,
+ 'ku-IQ': /^[ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,
ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/
};
@@ -535,6 +554,7 @@ var alphanumeric = {
'sv-SE': /^[0-9A-ZÅÄÖ]+$/i,
'tr-TR': /^[0-9A-ZÇĞİıÖŞÜ]+$/i,
'uk-UA': /^[0-9А-ЩЬЮЯЄIЇҐі]+$/i,
+ 'ku-IQ': /^[٠١٢٣٤٥٦٧٨٩0-9ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,
ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/
};
@@ -564,7 +584,7 @@ for (var _locale, _i = 0; _i < arabicLocales.length; _i++) {
// Source: https://en.wikipedia.org/wiki/Decimal_mark
var dotDecimal = [];
-var commaDecimal = ['bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'es-ES', 'fr-FR', 'it-IT', 'hu-HU', 'nb-NO', 'nn-NO', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'sr-RS@latin', 'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA'];
+var commaDecimal = ['bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'es-ES', 'fr-FR', 'it-IT', 'ku-IQ', 'hu-HU', 'nb-NO', 'nn-NO', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'sr-RS@latin', 'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA'];
for (var _i2 = 0; _i2 < dotDecimal.length; _i2++) {
decimal[dotDecimal[_i2]] = decimal['en-US'];
@@ -577,7 +597,12 @@ for (var _i3 = 0; _i3 < commaDecimal.length; _i3++) {
alpha['pt-BR'] = alpha['pt-PT'];
alphanumeric['pt-BR'] = alphanumeric['pt-PT'];
decimal['pt-BR'] = decimal['pt-PT'];
-
+
+// see #862
+alpha['pl-Pl'] = alpha['pl-PL'];
+alphanumeric['pl-Pl'] = alphanumeric['pl-PL'];
+decimal['pl-Pl'] = decimal['pl-PL'];
+
function isAlpha(str) {
var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en-US';
@@ -599,9 +624,13 @@ function isAlphanumeric(str) {
}
var numeric = /^[+-]?([0-9]*[.])?[0-9]+$/;
+var numericNoSymbols = /^[0-9]+$/;
-function isNumeric(str) {
+function isNumeric(str, options) {
assertString(str);
+ if (options && options.no_symbols) {
+ return numericNoSymbols.test(str);
+ }
return numeric.test(str);
}
@@ -1012,6 +1041,7 @@ var phones = {
'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': /\+?(88)?0?1[156789][0-9]{8}\b/,
'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[ \.\-]?)?([\(]{1}[0-9]{1,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,
@@ -1028,7 +1058,7 @@ var phones = {
'en-SG': /^(\+65)?[89]\d{7}$/,
'en-TZ': /^(\+?255|0)?[67]\d{8}$/,
'en-UG': /^(\+?256|0)?[7]\d{8}$/,
- 'en-US': /^(\+?1)?[2-9]\d{2}[2-9](?!11)\d{6}$/,
+ 'en-US': /^(\+?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}$/,
'es-ES': /^(\+?34)?(6\d{1}|7[1234])\d{7}$/,
@@ -1039,7 +1069,7 @@ var phones = {
'fr-FR': /^(\+?33|0)[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[1-9])[\s|\d]+$/,
+ 'id-ID': /^(\+?62|0)(0?8?\d\d\s?\d?)([\s?|\d]{7,12})$/,
'it-IT': /^(\+?39)?\s?3\d{2} ?\d{6,7}$/,
'ja-JP': /^(\+?81|0)[789]0[ \-]?[1-9]\d{2}[ \-]?\d{5}$/,
'kk-KZ': /^(\+?7|8)?7\d{9}$/,
@@ -1062,7 +1092,7 @@ var phones = {
'tr-TR': /^(\+?90|0)?5\d{9}$/,
'uk-UA': /^(\+?38|8)?0\d{9}$/,
'vi-VN': /^(\+?84|0)?((1(2([0-9])|6([2-9])|88|99))|(9((?!5)[0-9])))([0-9]{7})$/,
- 'zh-CN': /^(\+?0?86\-?)?1[3456789]\d{9}$/,
+ 'zh-CN': /^((\+|00)86)?1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$/,
'zh-TW': /^(\+?886\-?|0)?9\d{8}$/
};
/* eslint-enable max-len */
@@ -1334,6 +1364,7 @@ var fiveDigit = /^\d{5}$/;
var sixDigit = /^\d{6}$/;
var patterns = {
+ AD: /^AD\d{3}$/,
AT: fourDigit,
AU: fourDigit,
BE: fourDigit,
diff --git a/validator.min.js b/validator.min.js
index dc76e0ae9..0ea32e222 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(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.validator=t()}(this,function(){"use strict";function p(e){if(!("string"==typeof e||e instanceof String))throw new TypeError("This library (validator.js) validates strings only")}function i(e){return p(e),e=Date.parse(e),isNaN(e)?null:new Date(e)}function r(e){return p(e),parseFloat(e)}var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function n(e){return"object"===(void 0===e?"undefined":a(e))&&null!==e?e="function"==typeof e.toString?e.toString():"[object Object]":(null==e||isNaN(e)&&!e.length)&&(e=""),String(e)}function g(){var e=0$/i,$=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i,_=/^[a-z\d]+$/,F=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i,S=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i,R=/^([\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 s=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/,u=/^[0-9A-F]{1,4}$/i;function c(e){var t=1n)return!1;if("::"===e)return!0;"::"===e.substr(0,2)?(r.shift(),r.shift(),o=!0):"::"===e.substr(e.length-2)&&(r.pop(),r.pop(),o=!0);for(var a=0;a=t.min,i=!t.hasOwnProperty("max")||e<=t.max,n=!t.hasOwnProperty("lt")||et.gt;return r.test(e)&&o&&i&&n&&a}var P=/^[\x00-\x7F]+$/;var K=/[^\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/;var k=/[\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/;var H=/[^\x00-\x7F]/;var z=/[\uD800-\uDBFF][\uDC00-\uDFFF]/;var V=function(e,t){return e.some(function(e){return t===e})};var W={force_decimal:!1,decimal_digits:"1,",locale:"en-US"},Y=["","-","+"];var j=/^[0-9A-F]+$/i;function J(e){return p(e),j.test(e)}var q=/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i;var Q=/^[A-Z]{2}[0-9A-Z]{3}\d{2}\d{5}$/;var X=/^[a-f0-9]{32}$/;var ee={md5:32,md4:32,sha1:40,sha256:64,sha384:96,sha512:128,ripemd128:32,ripemd160:40,tiger128:32,tiger160:40,tiger192:48,crc32:8,crc32b:8};var te={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 re=/^(?:4[0-9]{12}(?:[0-9]{3})?|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}|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 oe=/^[A-Z]{2}[0-9A-Z]{9}[0-9]$/;var ie=/^(?:[0-9]{9}X|[0-9]{10})$/,ne=/^(?:[0-9]{13})$/,ae=[1,3];var le={"ar-AE":/^((\+?971)|0)?5[024568]\d{7}$/,"ar-DZ":/^(\+?213|0)(5|6|7)\d{8}$/,"ar-EG":/^((\+?20)|0)?1[012]\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-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}$/,"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[ \.\-]?)?([\(]{1}[0-9]{1,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,"el-GR":/^(\+?30|0)?(69\d{8})$/,"en-AU":/^(\+?61|0)4\d{8}$/,"en-GB":/^(\+?44|0)7\d{9}$/,"en-HK":/^(\+?852\-?)?[456789]\d{3}\-?\d{4}$/,"en-IN":/^(\+?91|0)?[6789]\d{9}$/,"en-KE":/^(\+?254|0)?[7]\d{8}$/,"en-NG":/^(\+?234|0)?[789]\d{9}$/,"en-NZ":/^(\+?64|0)2\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)?[89]\d{7}$/,"en-TZ":/^(\+?255|0)?[67]\d{8}$/,"en-UG":/^(\+?256|0)?[7]\d{8}$/,"en-US":/^(\+?1)?[2-9]\d{2}[2-9](?!11)\d{6}$/,"en-ZA":/^(\+?27|0)\d{9}$/,"en-ZM":/^(\+?26)?09[567]\d{7}$/,"es-ES":/^(\+?34)?(6\d{1}|7[1234])\d{7}$/,"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$/,"fo-FO":/^(\+?298)?\s?\d{2}\s?\d{2}\s?\d{2}$/,"fr-FR":/^(\+?33|0)[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[1-9])[\s|\d]+$/,"it-IT":/^(\+?39)?\s?3\d{2} ?\d{6,7}$/,"ja-JP":/^(\+?81|0)[789]0[ \-]?[1-9]\d{2}[ \-]?\d{5}$/,"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}(([145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,"nb-NO":/^(\+?47)?[49]\d{7}$/,"nl-BE":/^(\+?32|0)4?\d{8}$/,"nn-NO":/^(\+?47)?[49]\d{7}$/,"pl-PL":/^(\+?48)? ?[5-8]\d ?\d{3} ?\d{2} ?\d{2}$/,"pt-BR":/^(\+?55|0)\-?[1-9]{2}\-?[2-9]{1}\d{3,4}\-?\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}$/,"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)?((1(2([0-9])|6([2-9])|88|99))|(9((?!5)[0-9])))([0-9]{7})$/,"zh-CN":/^(\+?0?86\-?)?1[3456789]\d{9}$/,"zh-TW":/^(\+?886\-?|0)?9\d{8}$/};le["en-CA"]=le["en-US"],le["fr-BE"]=le["nl-BE"],le["zh-HK"]=le["en-HK"];var se={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 ue=/^([\+-]?\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-2])(-?[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 de=/([01][0-9]|2[0-3])/,ce=/[0-5][0-9]/,fe=new RegExp("[-+]"+de.source+":"+ce.source),pe=new RegExp("([zZ]|"+fe.source+")"),ge=new RegExp(de.source+":"+ce.source+":"+/([0-5][0-9]|60)/.source+/(\.[0-9]+)?/.source),Ae=new RegExp(/[0-9]{4}/.source+"-"+/(0[1-9]|1[0-2])/.source+"-"+/([12]\d|0[1-9]|3[01])/.source),he=new RegExp(""+ge.source+pe.source),ve=new RegExp(Ae.source+"[ tT]"+he.source);var me=["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 $e=["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 _e=/[^A-Z0-9+\/=]/i;var Fe=/^[a-z]+\/[a-z0-9\-\+]+$/i,Se=/^[a-z\-]+=[a-z0-9\-]+$/i,Re=/^[a-z0-9!\$&'\(\)\*\+,;=\-\._~:@\/\?%\s]*$/i;var Ee=/^(application|audio|font|image|message|model|multipart|text|video)\/[a-zA-Z0-9\.\-\+]{1,100}$/i,xe=/^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,Ce=/^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 Me=/^\(?[+-]?(90(\.0+)?|[1-8]?\d(\.\d+)?)$/,Ne=/^\s?[+-]?(180(\.0+)?|1[0-7]\d(\.\d+)?|\d{1,2}(\.\d+)?)\)?$/,we=/^\d{4}$/,Te=/^\d{5}$/,Le=/^\d{6}$/,Ie={AT:we,AU:we,BE:we,BG:we,CA:/^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][\s\-]?\d[ABCEGHJ-NPRSTV-Z]\d$/i,CH:we,CZ:/^\d{3}\s?\d{2}$/,DE:Te,DK:we,DZ:Te,EE:Te,ES:Te,FI:Te,FR:/^\d{2}\s?\d{3}$/,GB:/^(gir\s?0aa|[a-z]{1,2}\d[\da-z]?\s?(\d[a-z]{2})?)$/i,GR:/^\d{3}\s?\d{2}$/,HR:/^([1-5]\d{4}$)/,HU:we,IL:Te,IN:Le,IS:/^\d{3}$/,IT:Te,JP:/^\d{3}\-\d{4}$/,KE:Te,LI:/^(948[5-9]|949[0-7])$/,LT:/^LT\-\d{5}$/,LU:we,LV:/^LV\-\d{4}$/,MX:Te,NL:/^\d{4}\s?[a-z]{2}$/i,NO:we,PL:/^\d{2}\-\d{3}$/,PT:/^\d{4}\-\d{3}?$/,RO:Le,RU:Le,SA:Te,SE:/^\d{3}\s?\d{2}$/,SI:we,SK:/^\d{3}\s?\d{2}$/,TN:we,TW:/^\d{3}(\d{2})?$/,US:/^\d{5}(-\d{4})?$/,ZA:we,ZM:Te},Ze=Object.keys(Ie);function Be(e,t){p(e);var r=t?new RegExp("^["+t+"]+","g"):/^\s+/g;return e.replace(r,"")}function Ge(e,t){p(e);for(var r=t?new RegExp("["+t+"]"):/\s/,o=e.length-1;0<=o&&r.test(e[o]);o--);return o]/.test(e))return!1;if(0===e.indexOf("mailto:"))return!1;t=g(t,f);var r=void 0,o=void 0,i=void 0,n=void 0,a=void 0,l=void 0,s=void 0,u=void 0;if(1<(s=(e=(s=(e=(s=e.split("#")).shift()).split("?")).shift()).split("://")).length){if(r=s.shift(),t.require_valid_protocol&&-1===t.protocols.indexOf(r))return!1}else{if(t.require_protocol)return!1;t.allow_protocol_relative_urls&&"//"===e.substr(0,2)&&(s[0]=e.substr(2))}if(""===(e=s.join("://")))return!1;if(""===(e=(s=e.split("/")).shift())&&!t.require_host)return!0;if(1<(s=e.split("@")).length&&0<=(o=s.shift()).indexOf(":")&&2=t.min)&&(!t.hasOwnProperty("max")||o<=t.max)&&(!t.hasOwnProperty("lt")||ot.gt)},isDecimal:function(e,t){if(p(e),(t=g(t,W)).locale in M)return!V(Y,e.replace(/ /g,""))&&(r=t,new RegExp("^[-+]?([0-9]+)?(\\"+M[r.locale]+"[0-9]{"+r.decimal_digits+"})"+(r.force_decimal?"":"?")+"$")).test(e);var r;throw new Error("Invalid locale '"+t.locale+"'")},isHexadecimal:J,isDivisibleBy:function(e,t){return p(e),r(e)%parseInt(t,10)==0},isHexColor:function(e){return p(e),q.test(e)},isISRC:function(e){return p(e),Q.test(e)},isMD5:function(e){return p(e),X.test(e)},isHash:function(e,t){return p(e),new RegExp("^[a-f0-9]{"+ee[t]+"}$").test(e)},isJSON:function(e){p(e);try{var t=JSON.parse(e);return!!t&&"object"===(void 0===t?"undefined":a(t))}catch(e){}return!1},isEmpty:function(e){return p(e),0===e.length},isLength:function(e,t){p(e);var r=void 0,o=void 0;"object"===(void 0===t?"undefined":a(t))?(r=t.min||0,o=t.max):(r=t,o=arguments[2]);var i=e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g)||[],n=e.length-i.length;return r<=n&&(void 0===o||n<=o)},isByteLength:A,isUUID:function(e){var t=1/g,">").replace(/\//g,"/").replace(/\\/g,"\").replace(/`/g,"`")},unescape:function(e){return p(e),e.replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">").replace(///g,"/").replace(/\/g,"\\").replace(/`/g,"`")},stripLow:function(e,t){return p(e),ye(e,t?"\\x00-\\x09\\x0B\\x0C\\x0E-\\x1F\\x7F":"\\x00-\\x1F\\x7F")},whitelist:function(e,t){return p(e),e.replace(new RegExp("[^"+t+"]+","g"),"")},blacklist:ye,isWhitelisted:function(e,t){p(e);for(var r=e.length-1;0<=r;r--)if(-1===t.indexOf(e[r]))return!1;return!0},normalizeEmail:function(e,t){t=g(t,De);var r=e.split("@"),o=r.pop(),i=[r.join("@"),o];if(i[1]=i[1].toLowerCase(),"gmail.com"===i[1]||"googlemail.com"===i[1]){if(t.gmail_remove_subaddress&&(i[0]=i[0].split("+")[0]),t.gmail_remove_dots&&(i[0]=i[0].replace(/\.+/g,Ke)),!i[0].length)return!1;(t.all_lowercase||t.gmail_lowercase)&&(i[0]=i[0].toLowerCase()),i[1]=t.gmail_convert_googlemaildotcom?"gmail.com":i[1]}else if(0<=Oe.indexOf(i[1])){if(t.icloud_remove_subaddress&&(i[0]=i[0].split("+")[0]),!i[0].length)return!1;(t.all_lowercase||t.icloud_lowercase)&&(i[0]=i[0].toLowerCase())}else if(0<=Ue.indexOf(i[1])){if(t.outlookdotcom_remove_subaddress&&(i[0]=i[0].split("+")[0]),!i[0].length)return!1;(t.all_lowercase||t.outlookdotcom_lowercase)&&(i[0]=i[0].toLowerCase())}else if(0<=be.indexOf(i[1])){if(t.yahoo_remove_subaddress){var n=i[0].split("-");i[0]=1$/i,$=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i,_=/^[a-z\d]+$/,F=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i,S=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i,R=/^([\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 s=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/,u=/^[0-9A-F]{1,4}$/i;function c(e){var t=1n)return!1;if("::"===e)return!0;"::"===e.substr(0,2)?(r.shift(),r.shift(),o=!0):"::"===e.substr(e.length-2)&&(r.pop(),r.pop(),o=!0);for(var a=0;a=t.min,i=!t.hasOwnProperty("max")||e<=t.max,n=!t.hasOwnProperty("lt")||et.gt;return r.test(e)&&o&&i&&n&&a}var P=/^[\x00-\x7F]+$/;var K=/[^\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/;var k=/[\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/;var H=/[^\x00-\x7F]/;var z=/[\uD800-\uDBFF][\uDC00-\uDFFF]/;var V=function(e,t){return e.some(function(e){return t===e})};var W={force_decimal:!1,decimal_digits:"1,",locale:"en-US"},Y=["","-","+"];var j=/^[0-9A-F]+$/i;function J(e){return p(e),j.test(e)}var q=/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i;var Q=/^[A-Z]{2}[0-9A-Z]{3}\d{2}\d{5}$/;var X=/^[a-f0-9]{32}$/;var ee={md5:32,md4:32,sha1:40,sha256:64,sha384:96,sha512:128,ripemd128:32,ripemd160:40,tiger128:32,tiger160:40,tiger192:48,crc32:8,crc32b:8};var te={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 re=/^(?:4[0-9]{12}(?:[0-9]{3})?|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}|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 oe=/^[A-Z]{2}[0-9A-Z]{9}[0-9]$/;var ie=/^(?:[0-9]{9}X|[0-9]{10})$/,ne=/^(?:[0-9]{13})$/,ae=[1,3];var le={"ar-AE":/^((\+?971)|0)?5[024568]\d{7}$/,"ar-DZ":/^(\+?213|0)(5|6|7)\d{8}$/,"ar-EG":/^((\+?20)|0)?1[012]\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-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}$/,"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[ \.\-]?)?([\(]{1}[0-9]{1,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,"el-GR":/^(\+?30|0)?(69\d{8})$/,"en-AU":/^(\+?61|0)4\d{8}$/,"en-GB":/^(\+?44|0)7\d{9}$/,"en-HK":/^(\+?852\-?)?[456789]\d{3}\-?\d{4}$/,"en-IN":/^(\+?91|0)?[6789]\d{9}$/,"en-KE":/^(\+?254|0)?[7]\d{8}$/,"en-NG":/^(\+?234|0)?[789]\d{9}$/,"en-NZ":/^(\+?64|0)2\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)?[89]\d{7}$/,"en-TZ":/^(\+?255|0)?[67]\d{8}$/,"en-UG":/^(\+?256|0)?[7]\d{8}$/,"en-US":/^(\+?1)?[2-9]\d{2}[2-9](?!11)\d{6}$/,"en-ZA":/^(\+?27|0)\d{9}$/,"en-ZM":/^(\+?26)?09[567]\d{7}$/,"es-ES":/^(\+?34)?(6\d{1}|7[1234])\d{7}$/,"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$/,"fo-FO":/^(\+?298)?\s?\d{2}\s?\d{2}\s?\d{2}$/,"fr-FR":/^(\+?33|0)[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[1-9])[\s|\d]+$/,"it-IT":/^(\+?39)?\s?3\d{2} ?\d{6,7}$/,"ja-JP":/^(\+?81|0)[789]0[ \-]?[1-9]\d{2}[ \-]?\d{5}$/,"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}(([145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,"nb-NO":/^(\+?47)?[49]\d{7}$/,"nl-BE":/^(\+?32|0)4?\d{8}$/,"nn-NO":/^(\+?47)?[49]\d{7}$/,"pl-PL":/^(\+?48)? ?[5-8]\d ?\d{3} ?\d{2} ?\d{2}$/,"pt-BR":/^(\+?55|0)\-?[1-9]{2}\-?[2-9]{1}\d{3,4}\-?\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}$/,"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)?((1(2([0-9])|6([2-9])|88|99))|(9((?!5)[0-9])))([0-9]{7})$/,"zh-CN":/^(\+?0?86\-?)?1[3456789]\d{9}$/,"zh-TW":/^(\+?886\-?|0)?9\d{8}$/};le["en-CA"]=le["en-US"],le["fr-BE"]=le["nl-BE"],le["zh-HK"]=le["en-HK"];var se={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 ue=/^([\+-]?\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-2])(-?[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 de=/([01][0-9]|2[0-3])/,ce=/[0-5][0-9]/,fe=new RegExp("[-+]"+de.source+":"+ce.source),pe=new RegExp("([zZ]|"+fe.source+")"),ge=new RegExp(de.source+":"+ce.source+":"+/([0-5][0-9]|60)/.source+/(\.[0-9]+)?/.source),Ae=new RegExp(/[0-9]{4}/.source+"-"+/(0[1-9]|1[0-2])/.source+"-"+/([12]\d|0[1-9]|3[01])/.source),he=new RegExp(""+ge.source+pe.source),ve=new RegExp(Ae.source+"[ tT]"+he.source);var me=["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 $e=["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 _e=/[^A-Z0-9+\/=]/i;var Fe=/^[a-z]+\/[a-z0-9\-\+]+$/i,Se=/^[a-z\-]+=[a-z0-9\-]+$/i,Re=/^[a-z0-9!\$&'\(\)\*\+,;=\-\._~:@\/\?%\s]*$/i;var Ee=/^(application|audio|font|image|message|model|multipart|text|video)\/[a-zA-Z0-9\.\-\+]{1,100}$/i,xe=/^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,Ce=/^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 Me=/^\(?[+-]?(90(\.0+)?|[1-8]?\d(\.\d+)?)$/,Ne=/^\s?[+-]?(180(\.0+)?|1[0-7]\d(\.\d+)?|\d{1,2}(\.\d+)?)\)?$/,we=/^\d{4}$/,Te=/^\d{5}$/,Le=/^\d{6}$/,Ie={AT:we,AU:we,BE:we,BG:we,CA:/^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][\s\-]?\d[ABCEGHJ-NPRSTV-Z]\d$/i,CH:we,CZ:/^\d{3}\s?\d{2}$/,DE:Te,DK:we,DZ:Te,EE:Te,ES:Te,FI:Te,FR:/^\d{2}\s?\d{3}$/,GB:/^(gir\s?0aa|[a-z]{1,2}\d[\da-z]?\s?(\d[a-z]{2})?)$/i,GR:/^\d{3}\s?\d{2}$/,HR:/^([1-5]\d{4}$)/,HU:we,IL:Te,IN:Le,IS:/^\d{3}$/,IT:Te,JP:/^\d{3}\-\d{4}$/,KE:Te,LI:/^(948[5-9]|949[0-7])$/,LT:/^LT\-\d{5}$/,LU:we,LV:/^LV\-\d{4}$/,MX:Te,NL:/^\d{4}\s?[a-z]{2}$/i,NO:we,PL:/^\d{2}\-\d{3}$/,PT:/^\d{4}\-\d{3}?$/,RO:Le,RU:Le,SA:Te,SE:/^\d{3}\s?\d{2}$/,SI:we,SK:/^\d{3}\s?\d{2}$/,TN:we,TW:/^\d{3}(\d{2})?$/,US:/^\d{5}(-\d{4})?$/,ZA:we,ZM:Te},Ze=Object.keys(Ie);function Be(e,t){p(e);var r=t?new RegExp("^["+t+"]+","g"):/^\s+/g;return e.replace(r,"")}function Ge(e,t){p(e);for(var r=t?new RegExp("["+t+"]"):/\s/,o=e.length-1;0<=o&&r.test(e[o]);o--);return o]/.test(e))return!1;if(0===e.indexOf("mailto:"))return!1;t=g(t,f);var r=void 0,o=void 0,i=void 0,n=void 0,a=void 0,l=void 0,s=void 0,u=void 0;if(1<(s=(e=(s=(e=(s=e.split("#")).shift()).split("?")).shift()).split("://")).length){if(r=s.shift(),t.require_valid_protocol&&-1===t.protocols.indexOf(r))return!1}else{if(t.require_protocol)return!1;t.allow_protocol_relative_urls&&"//"===e.substr(0,2)&&(s[0]=e.substr(2))}if(""===(e=s.join("://")))return!1;if(""===(e=(s=e.split("/")).shift())&&!t.require_host)return!0;if(1<(s=e.split("@")).length&&0<=(o=s.shift()).indexOf(":")&&2=t.min)&&(!t.hasOwnProperty("max")||o<=t.max)&&(!t.hasOwnProperty("lt")||ot.gt)},isDecimal:function(e,t){if(p(e),(t=g(t,W)).locale in M)return!V(Y,e.replace(/ /g,""))&&(r=t,new RegExp("^[-+]?([0-9]+)?(\\"+M[r.locale]+"[0-9]{"+r.decimal_digits+"})"+(r.force_decimal?"":"?")+"$")).test(e);var r;throw new Error("Invalid locale '"+t.locale+"'")},isHexadecimal:J,isDivisibleBy:function(e,t){return p(e),r(e)%parseInt(t,10)==0},isHexColor:function(e){return p(e),q.test(e)},isISRC:function(e){return p(e),Q.test(e)},isMD5:function(e){return p(e),X.test(e)},isHash:function(e,t){return p(e),new RegExp("^[a-f0-9]{"+ee[t]+"}$").test(e)},isJSON:function(e){p(e);try{var t=JSON.parse(e);return!!t&&"object"===(void 0===t?"undefined":a(t))}catch(e){}return!1},isEmpty:function(e){return p(e),0===e.length},isLength:function(e,t){p(e);var r=void 0,o=void 0;"object"===(void 0===t?"undefined":a(t))?(r=t.min||0,o=t.max):(r=t,o=arguments[2]);var i=e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g)||[],n=e.length-i.length;return r<=n&&(void 0===o||n<=o)},isByteLength:A,isUUID:function(e){var t=1/g,">").replace(/\//g,"/").replace(/\\/g,"\").replace(/`/g,"`")},unescape:function(e){return p(e),e.replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">").replace(///g,"/").replace(/\/g,"\\").replace(/`/g,"`")},stripLow:function(e,t){return p(e),ye(e,t?"\\x00-\\x09\\x0B\\x0C\\x0E-\\x1F\\x7F":"\\x00-\\x1F\\x7F")},whitelist:function(e,t){return p(e),e.replace(new RegExp("[^"+t+"]+","g"),"")},blacklist:ye,isWhitelisted:function(e,t){p(e);for(var r=e.length-1;0<=r;r--)if(-1===t.indexOf(e[r]))return!1;return!0},normalizeEmail:function(e,t){t=g(t,De);var r=e.split("@"),o=r.pop(),i=[r.join("@"),o];if(i[1]=i[1].toLowerCase(),"gmail.com"===i[1]||"googlemail.com"===i[1]){if(t.gmail_remove_subaddress&&(i[0]=i[0].split("+")[0]),t.gmail_remove_dots&&(i[0]=i[0].replace(/\.+/g,Ke)),!i[0].length)return!1;(t.all_lowercase||t.gmail_lowercase)&&(i[0]=i[0].toLowerCase()),i[1]=t.gmail_convert_googlemaildotcom?"gmail.com":i[1]}else if(0<=Oe.indexOf(i[1])){if(t.icloud_remove_subaddress&&(i[0]=i[0].split("+")[0]),!i[0].length)return!1;(t.all_lowercase||t.icloud_lowercase)&&(i[0]=i[0].toLowerCase())}else if(0<=Ue.indexOf(i[1])){if(t.outlookdotcom_remove_subaddress&&(i[0]=i[0].split("+")[0]),!i[0].length)return!1;(t.all_lowercase||t.outlookdotcom_lowercase)&&(i[0]=i[0].toLowerCase())}else if(0<=be.indexOf(i[1])){if(t.yahoo_remove_subaddress){var n=i[0].split("-");i[0]=1