n4s 5.0.0 → 5.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +2 -0
  2. package/date/package.json +9 -0
  3. package/dist/cjs/compose.development.js +9 -13
  4. package/dist/cjs/compose.js +0 -1
  5. package/dist/cjs/compose.production.js +1 -1
  6. package/dist/cjs/compounds.development.js +16 -32
  7. package/dist/cjs/compounds.js +0 -1
  8. package/dist/cjs/compounds.production.js +1 -1
  9. package/dist/cjs/date.development.js +186 -0
  10. package/dist/cjs/date.js +6 -0
  11. package/dist/cjs/date.production.js +1 -0
  12. package/dist/cjs/email.development.js +363 -0
  13. package/dist/cjs/email.js +6 -0
  14. package/dist/cjs/email.production.js +1 -0
  15. package/dist/cjs/isURL.development.js +353 -0
  16. package/dist/cjs/isURL.js +6 -0
  17. package/dist/cjs/isURL.production.js +1 -0
  18. package/dist/cjs/n4s.development.js +134 -213
  19. package/dist/cjs/n4s.js +0 -1
  20. package/dist/cjs/n4s.production.js +1 -1
  21. package/dist/cjs/schema.development.js +13 -22
  22. package/dist/cjs/schema.js +0 -1
  23. package/dist/cjs/schema.production.js +1 -1
  24. package/dist/es/compose.development.js +11 -15
  25. package/dist/es/compose.production.js +1 -1
  26. package/dist/es/compounds.development.js +16 -32
  27. package/dist/es/compounds.production.js +1 -1
  28. package/dist/es/date.development.js +184 -0
  29. package/dist/es/date.production.js +1 -0
  30. package/dist/es/email.development.js +361 -0
  31. package/dist/es/email.production.js +1 -0
  32. package/dist/es/isURL.development.js +351 -0
  33. package/dist/es/isURL.production.js +1 -0
  34. package/dist/es/n4s.development.js +155 -232
  35. package/dist/es/n4s.production.js +1 -1
  36. package/dist/es/schema.development.js +13 -20
  37. package/dist/es/schema.production.js +1 -1
  38. package/dist/umd/compose.development.js +12 -16
  39. package/dist/umd/compose.production.js +1 -1
  40. package/dist/umd/compounds.development.js +19 -35
  41. package/dist/umd/compounds.production.js +1 -1
  42. package/dist/umd/date.development.js +190 -0
  43. package/dist/umd/date.production.js +1 -0
  44. package/dist/umd/email.development.js +367 -0
  45. package/dist/umd/email.production.js +1 -0
  46. package/dist/umd/isURL.development.js +357 -0
  47. package/dist/umd/isURL.production.js +1 -0
  48. package/dist/umd/n4s.development.js +137 -216
  49. package/dist/umd/n4s.production.js +1 -1
  50. package/dist/umd/schema.development.js +16 -25
  51. package/dist/umd/schema.production.js +1 -1
  52. package/email/package.json +9 -0
  53. package/isURL/package.json +9 -0
  54. package/package.json +159 -55
  55. package/testUtils/TEnforceMock.ts +3 -0
  56. package/types/compose.d.ts +22 -23
  57. package/types/compose.d.ts.map +1 -0
  58. package/types/compounds.d.ts +22 -24
  59. package/types/compounds.d.ts.map +1 -0
  60. package/types/date.d.ts +18 -0
  61. package/types/date.d.ts.map +1 -0
  62. package/types/email.d.ts +12 -0
  63. package/types/email.d.ts.map +1 -0
  64. package/types/isURL.d.ts +12 -0
  65. package/types/isURL.d.ts.map +1 -0
  66. package/types/n4s.d.ts +30 -27
  67. package/types/n4s.d.ts.map +1 -0
  68. package/types/schema.d.ts +22 -23
  69. package/types/schema.d.ts.map +1 -0
  70. package/tsconfig.json +0 -8
@@ -0,0 +1,361 @@
1
+ import { enforce } from 'n4s';
2
+
3
+ function _typeof$1(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$1 = function _typeof(obj) { return typeof obj; }; } else { _typeof$1 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$1(obj); }
4
+
5
+ function assertString(input) {
6
+ var isString = typeof input === 'string' || input instanceof String;
7
+
8
+ if (!isString) {
9
+ var invalidType = _typeof$1(input);
10
+
11
+ if (input === null) invalidType = 'null';else if (invalidType === 'object') invalidType = input.constructor.name;
12
+ throw new TypeError("Expected a string but received a ".concat(invalidType));
13
+ }
14
+ }
15
+
16
+ function merge() {
17
+ var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
18
+ var defaults = arguments.length > 1 ? arguments[1] : undefined;
19
+
20
+ for (var key in defaults) {
21
+ if (typeof obj[key] === 'undefined') {
22
+ obj[key] = defaults[key];
23
+ }
24
+ }
25
+
26
+ return obj;
27
+ }
28
+
29
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
30
+ /* eslint-disable prefer-rest-params */
31
+
32
+ function isByteLength(str, options) {
33
+ assertString(str);
34
+ var min;
35
+ var max;
36
+
37
+ if (_typeof(options) === 'object') {
38
+ min = options.min || 0;
39
+ max = options.max;
40
+ } else {
41
+ // backwards compatibility: isByteLength(str, min [, max])
42
+ min = arguments[1];
43
+ max = arguments[2];
44
+ }
45
+
46
+ var len = encodeURI(str).split(/%..|./).length - 1;
47
+ return len >= min && (typeof max === 'undefined' || len <= max);
48
+ }
49
+
50
+ var default_fqdn_options = {
51
+ require_tld: true,
52
+ allow_underscores: false,
53
+ allow_trailing_dot: false,
54
+ allow_numeric_tld: false,
55
+ allow_wildcard: false,
56
+ ignore_max_length: false
57
+ };
58
+ function isFQDN(str, options) {
59
+ assertString(str);
60
+ options = merge(options, default_fqdn_options);
61
+ /* Remove the optional trailing dot before checking validity */
62
+
63
+ if (options.allow_trailing_dot && str[str.length - 1] === '.') {
64
+ str = str.substring(0, str.length - 1);
65
+ }
66
+ /* Remove the optional wildcard before checking validity */
67
+
68
+
69
+ if (options.allow_wildcard === true && str.indexOf('*.') === 0) {
70
+ str = str.substring(2);
71
+ }
72
+
73
+ var parts = str.split('.');
74
+ var tld = parts[parts.length - 1];
75
+
76
+ if (options.require_tld) {
77
+ // disallow fqdns without tld
78
+ if (parts.length < 2) {
79
+ return false;
80
+ }
81
+
82
+ if (!options.allow_numeric_tld && !/^([a-z\u00A1-\u00A8\u00AA-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)) {
83
+ return false;
84
+ } // disallow spaces
85
+
86
+
87
+ if (/\s/.test(tld)) {
88
+ return false;
89
+ }
90
+ } // reject numeric TLDs
91
+
92
+
93
+ if (!options.allow_numeric_tld && /^\d+$/.test(tld)) {
94
+ return false;
95
+ }
96
+
97
+ return parts.every(function (part) {
98
+ if (part.length > 63 && !options.ignore_max_length) {
99
+ return false;
100
+ }
101
+
102
+ if (!/^[a-z_\u00a1-\uffff0-9-]+$/i.test(part)) {
103
+ return false;
104
+ } // disallow full-width chars
105
+
106
+
107
+ if (/[\uff01-\uff5e]/.test(part)) {
108
+ return false;
109
+ } // disallow parts starting or ending with hyphen
110
+
111
+
112
+ if (/^-|-$/.test(part)) {
113
+ return false;
114
+ }
115
+
116
+ if (!options.allow_underscores && /_/.test(part)) {
117
+ return false;
118
+ }
119
+
120
+ return true;
121
+ });
122
+ }
123
+
124
+ /**
125
+ 11.3. Examples
126
+
127
+ The following addresses
128
+
129
+ fe80::1234 (on the 1st link of the node)
130
+ ff02::5678 (on the 5th link of the node)
131
+ ff08::9abc (on the 10th organization of the node)
132
+
133
+ would be represented as follows:
134
+
135
+ fe80::1234%1
136
+ ff02::5678%5
137
+ ff08::9abc%10
138
+
139
+ (Here we assume a natural translation from a zone index to the
140
+ <zone_id> part, where the Nth zone of any scope is translated into
141
+ "N".)
142
+
143
+ If we use interface names as <zone_id>, those addresses could also be
144
+ represented as follows:
145
+
146
+ fe80::1234%ne0
147
+ ff02::5678%pvc1.3
148
+ ff08::9abc%interface10
149
+
150
+ where the interface "ne0" belongs to the 1st link, "pvc1.3" belongs
151
+ to the 5th link, and "interface10" belongs to the 10th organization.
152
+ * * */
153
+
154
+ var IPv4SegmentFormat = '(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])';
155
+ var IPv4AddressFormat = "(".concat(IPv4SegmentFormat, "[.]){3}").concat(IPv4SegmentFormat);
156
+ var IPv4AddressRegExp = new RegExp("^".concat(IPv4AddressFormat, "$"));
157
+ var IPv6SegmentFormat = '(?:[0-9a-fA-F]{1,4})';
158
+ var IPv6AddressRegExp = new RegExp('^(' + "(?:".concat(IPv6SegmentFormat, ":){7}(?:").concat(IPv6SegmentFormat, "|:)|") + "(?:".concat(IPv6SegmentFormat, ":){6}(?:").concat(IPv4AddressFormat, "|:").concat(IPv6SegmentFormat, "|:)|") + "(?:".concat(IPv6SegmentFormat, ":){5}(?::").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,2}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){4}(?:(:").concat(IPv6SegmentFormat, "){0,1}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,3}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){3}(?:(:").concat(IPv6SegmentFormat, "){0,2}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,4}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){2}(?:(:").concat(IPv6SegmentFormat, "){0,3}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,5}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){1}(?:(:").concat(IPv6SegmentFormat, "){0,4}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,6}|:)|") + "(?::((?::".concat(IPv6SegmentFormat, "){0,5}:").concat(IPv4AddressFormat, "|(?::").concat(IPv6SegmentFormat, "){1,7}|:))") + ')(%[0-9a-zA-Z-.:]{1,})?$');
159
+ function isIP(str) {
160
+ var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
161
+ assertString(str);
162
+ version = String(version);
163
+
164
+ if (!version) {
165
+ return isIP(str, 4) || isIP(str, 6);
166
+ }
167
+
168
+ if (version === '4') {
169
+ return IPv4AddressRegExp.test(str);
170
+ }
171
+
172
+ if (version === '6') {
173
+ return IPv6AddressRegExp.test(str);
174
+ }
175
+
176
+ return false;
177
+ }
178
+
179
+ var default_email_options = {
180
+ allow_display_name: false,
181
+ require_display_name: false,
182
+ allow_utf8_local_part: true,
183
+ require_tld: true,
184
+ blacklisted_chars: '',
185
+ ignore_max_length: false,
186
+ host_blacklist: [],
187
+ host_whitelist: []
188
+ };
189
+ /* eslint-disable max-len */
190
+
191
+ /* eslint-disable no-control-regex */
192
+
193
+ var splitNameAddress = /^([^\x00-\x1F\x7F-\x9F\cX]+)</i;
194
+ var emailUserPart = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i;
195
+ var gmailUserPart = /^[a-z\d]+$/;
196
+ var quotedEmailUser = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i;
197
+ var emailUserUtf8Part = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i;
198
+ var quotedEmailUserUtf8 = /^([\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;
199
+ var defaultMaxEmailLength = 254;
200
+ /* eslint-enable max-len */
201
+
202
+ /* eslint-enable no-control-regex */
203
+
204
+ /**
205
+ * Validate display name according to the RFC2822: https://tools.ietf.org/html/rfc2822#appendix-A.1.2
206
+ * @param {String} display_name
207
+ */
208
+
209
+ function validateDisplayName(display_name) {
210
+ var display_name_without_quotes = display_name.replace(/^"(.+)"$/, '$1'); // display name with only spaces is not valid
211
+
212
+ if (!display_name_without_quotes.trim()) {
213
+ return false;
214
+ } // check whether display name contains illegal character
215
+
216
+
217
+ var contains_illegal = /[\.";<>]/.test(display_name_without_quotes);
218
+
219
+ if (contains_illegal) {
220
+ // if contains illegal characters,
221
+ // must to be enclosed in double-quotes, otherwise it's not a valid display name
222
+ if (display_name_without_quotes === display_name) {
223
+ return false;
224
+ } // the quotes in display name must start with character symbol \
225
+
226
+
227
+ var all_start_with_back_slash = display_name_without_quotes.split('"').length === display_name_without_quotes.split('\\"').length;
228
+
229
+ if (!all_start_with_back_slash) {
230
+ return false;
231
+ }
232
+ }
233
+
234
+ return true;
235
+ }
236
+
237
+ function isEmail(str, options) {
238
+ assertString(str);
239
+ options = merge(options, default_email_options);
240
+
241
+ if (options.require_display_name || options.allow_display_name) {
242
+ var display_email = str.match(splitNameAddress);
243
+
244
+ if (display_email) {
245
+ var display_name = display_email[1]; // Remove display name and angle brackets to get email address
246
+ // Can be done in the regex but will introduce a ReDOS (See #1597 for more info)
247
+
248
+ str = str.replace(display_name, '').replace(/(^<|>$)/g, ''); // sometimes need to trim the last space to get the display name
249
+ // because there may be a space between display name and email address
250
+ // eg. myname <address@gmail.com>
251
+ // the display name is `myname` instead of `myname `, so need to trim the last space
252
+
253
+ if (display_name.endsWith(' ')) {
254
+ display_name = display_name.slice(0, -1);
255
+ }
256
+
257
+ if (!validateDisplayName(display_name)) {
258
+ return false;
259
+ }
260
+ } else if (options.require_display_name) {
261
+ return false;
262
+ }
263
+ }
264
+
265
+ if (!options.ignore_max_length && str.length > defaultMaxEmailLength) {
266
+ return false;
267
+ }
268
+
269
+ var parts = str.split('@');
270
+ var domain = parts.pop();
271
+ var lower_domain = domain.toLowerCase();
272
+
273
+ if (options.host_blacklist.includes(lower_domain)) {
274
+ return false;
275
+ }
276
+
277
+ if (options.host_whitelist.length > 0 && !options.host_whitelist.includes(lower_domain)) {
278
+ return false;
279
+ }
280
+
281
+ var user = parts.join('@');
282
+
283
+ if (options.domain_specific_validation && (lower_domain === 'gmail.com' || lower_domain === 'googlemail.com')) {
284
+ /*
285
+ Previously we removed dots for gmail addresses before validating.
286
+ This was removed because it allows `multiple..dots@gmail.com`
287
+ to be reported as valid, but it is not.
288
+ Gmail only normalizes single dots, removing them from here is pointless,
289
+ should be done in normalizeEmail
290
+ */
291
+ user = user.toLowerCase(); // Removing sub-address from username before gmail validation
292
+
293
+ var username = user.split('+')[0]; // Dots are not included in gmail length restriction
294
+
295
+ if (!isByteLength(username.replace(/\./g, ''), {
296
+ min: 6,
297
+ max: 30
298
+ })) {
299
+ return false;
300
+ }
301
+
302
+ var _user_parts = username.split('.');
303
+
304
+ for (var i = 0; i < _user_parts.length; i++) {
305
+ if (!gmailUserPart.test(_user_parts[i])) {
306
+ return false;
307
+ }
308
+ }
309
+ }
310
+
311
+ if (options.ignore_max_length === false && (!isByteLength(user, {
312
+ max: 64
313
+ }) || !isByteLength(domain, {
314
+ max: 254
315
+ }))) {
316
+ return false;
317
+ }
318
+
319
+ if (!isFQDN(domain, {
320
+ require_tld: options.require_tld,
321
+ ignore_max_length: options.ignore_max_length
322
+ })) {
323
+ if (!options.allow_ip_domain) {
324
+ return false;
325
+ }
326
+
327
+ if (!isIP(domain)) {
328
+ if (!domain.startsWith('[') || !domain.endsWith(']')) {
329
+ return false;
330
+ }
331
+
332
+ var noBracketdomain = domain.slice(1, -1);
333
+
334
+ if (noBracketdomain.length === 0 || !isIP(noBracketdomain)) {
335
+ return false;
336
+ }
337
+ }
338
+ }
339
+
340
+ if (user[0] === '"') {
341
+ user = user.slice(1, user.length - 1);
342
+ return options.allow_utf8_local_part ? quotedEmailUserUtf8.test(user) : quotedEmailUser.test(user);
343
+ }
344
+
345
+ var pattern = options.allow_utf8_local_part ? emailUserUtf8Part : emailUserPart;
346
+ var user_parts = user.split('.');
347
+
348
+ for (var _i = 0; _i < user_parts.length; _i++) {
349
+ if (!pattern.test(user_parts[_i])) {
350
+ return false;
351
+ }
352
+ }
353
+
354
+ if (options.blacklisted_chars) {
355
+ if (user.search(new RegExp("[".concat(options.blacklisted_chars, "]+"), 'g')) !== -1) return false;
356
+ }
357
+
358
+ return true;
359
+ }
360
+
361
+ enforce.extend({ isEmail });
@@ -0,0 +1 @@
1
+ import{enforce as t}from"n4s";function e(t){return e="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},e(t)}function n(t){if(!("string"==typeof t||t instanceof String)){var n=e(t);throw null===t?n="null":"object"===n&&(n=t.constructor.name),new TypeError("Expected a string but received a ".concat(n))}}function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;for(var n in e)void 0===t[n]&&(t[n]=e[n]);return t}function o(t){return o="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},o(t)}function i(t,e){var r,i;n(t),"object"===o(e)?(r=e.min||0,i=e.max):(r=arguments[1],i=arguments[2]);var a=encodeURI(t).split(/%..|./).length-1;return a>=r&&(void 0===i||a<=i)}var a={require_tld:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_numeric_tld:!1,allow_wildcard:!1,ignore_max_length:!1};var c="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",l="(".concat(c,"[.]){3}").concat(c),u=new RegExp("^".concat(l,"$")),f="(?:[0-9a-fA-F]{1,4})",s=new RegExp("^("+"(?:".concat(f,":){7}(?:").concat(f,"|:)|")+"(?:".concat(f,":){6}(?:").concat(l,"|:").concat(f,"|:)|")+"(?:".concat(f,":){5}(?::").concat(l,"|(:").concat(f,"){1,2}|:)|")+"(?:".concat(f,":){4}(?:(:").concat(f,"){0,1}:").concat(l,"|(:").concat(f,"){1,3}|:)|")+"(?:".concat(f,":){3}(?:(:").concat(f,"){0,2}:").concat(l,"|(:").concat(f,"){1,4}|:)|")+"(?:".concat(f,":){2}(?:(:").concat(f,"){0,3}:").concat(l,"|(:").concat(f,"){1,5}|:)|")+"(?:".concat(f,":){1}(?:(:").concat(f,"){0,4}:").concat(l,"|(:").concat(f,"){1,6}|:)|")+"(?::((?::".concat(f,"){0,5}:").concat(l,"|(?::").concat(f,"){1,7}|:))")+")(%[0-9a-zA-Z-.:]{1,})?$");function _(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return n(t),(e=String(e))?"4"===e?u.test(t):"6"===e&&s.test(t):_(t,4)||_(t,6)}var x={allow_display_name:!1,require_display_name:!1,allow_utf8_local_part:!0,require_tld:!0,blacklisted_chars:"",ignore_max_length:!1,host_blacklist:[],host_whitelist:[]},d=/^([^\x00-\x1F\x7F-\x9F\cX]+)</i,g=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i,m=/^[a-z\d]+$/,p=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i,F=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i,h=/^([\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;t.extend({isEmail:function(t,e){if(n(t),(e=r(e,x)).require_display_name||e.allow_display_name){var o=t.match(d);if(o){var c=o[1];if(t=t.replace(c,"").replace(/(^<|>$)/g,""),c.endsWith(" ")&&(c=c.slice(0,-1)),!function(t){var e=t.replace(/^"(.+)"$/,"$1");if(!e.trim())return!1;if(/[\.";<>]/.test(e)){if(e===t)return!1;if(e.split('"').length!==e.split('\\"').length)return!1}return!0}(c))return!1}else if(e.require_display_name)return!1}if(!e.ignore_max_length&&t.length>254)return!1;var l=t.split("@"),u=l.pop(),f=u.toLowerCase();if(e.host_blacklist.includes(f))return!1;if(e.host_whitelist.length>0&&!e.host_whitelist.includes(f))return!1;var s=l.join("@");if(e.domain_specific_validation&&("gmail.com"===f||"googlemail.com"===f)){var y=(s=s.toLowerCase()).split("+")[0];if(!i(y.replace(/\./g,""),{min:6,max:30}))return!1;for(var b=y.split("."),v=0;v<b.length;v++)if(!m.test(b[v]))return!1}if(!(!1!==e.ignore_max_length||i(s,{max:64})&&i(u,{max:254})))return!1;if(!function(t,e){n(t),(e=r(e,a)).allow_trailing_dot&&"."===t[t.length-1]&&(t=t.substring(0,t.length-1)),!0===e.allow_wildcard&&0===t.indexOf("*.")&&(t=t.substring(2));var o=t.split("."),i=o[o.length-1];if(e.require_tld){if(o.length<2)return!1;if(!e.allow_numeric_tld&&!/^([a-z\u00A1-\u00A8\u00AA-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}|xn[a-z0-9-]{2,})$/i.test(i))return!1;if(/\s/.test(i))return!1}return!(!e.allow_numeric_tld&&/^\d+$/.test(i))&&o.every((function(t){return!(t.length>63&&!e.ignore_max_length||!/^[a-z_\u00a1-\uffff0-9-]+$/i.test(t)||/[\uff01-\uff5e]/.test(t)||/^-|-$/.test(t)||!e.allow_underscores&&/_/.test(t))}))}(u,{require_tld:e.require_tld,ignore_max_length:e.ignore_max_length})){if(!e.allow_ip_domain)return!1;if(!_(u)){if(!u.startsWith("[")||!u.endsWith("]"))return!1;var w=u.slice(1,-1);if(0===w.length||!_(w))return!1}}if('"'===s[0])return s=s.slice(1,s.length-1),e.allow_utf8_local_part?h.test(s):p.test(s);for(var $=e.allow_utf8_local_part?F:g,D=s.split("."),S=0;S<D.length;S++)if(!$.test(D[S]))return!1;return!e.blacklisted_chars||-1===s.search(new RegExp("[".concat(e.blacklisted_chars,"]+"),"g"))}});