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