PageSourceSearch

https://support.acf.org.au/Client/Scripts/jquery/jquery.validate.js

js acf.org.au collected 2026-10-02 03:37:30 UTC 52,142 bytes, 1,700 lines download raw bytes

vendor: 8,121 bytes, lines 1-295
1/*!
2 * jQuery Validation Plugin v1.20.0
3 *
4 * https://jqueryvalidation.org/
5 *
6 * Copyright (c) 2023 Jörn Zaefferer
7 * Released under the MIT license
8 */
9(function( factory ) {
10	if ( typeof define === "function" && define.amd ) {
11		define( ["jquery"], factory );
12	} else if (typeof module === "object" && module.exports) {
13		module.exports = factory( require( "jquery" ) );
14	} else {
15		factory( jQuery );
16	}
17}(function( $ ) {
18
19$.extend( $.fn, {
20
21	// https://jqueryvalidation.org/validate/
22	validate: function( options ) {
23
24		// If nothing is selected, return nothing; can't chain anyway
25		if ( !this.length ) {
26			if ( options && options.debug && window.console ) {
27				console.warn( "Nothing selected, can't validate, returning nothing." );
28			}
29			return;
30		}
31
32		// Check if a validator for this form was already created
33		var validator = $.data( this[ 0 ], "validator" );
34		if ( validator ) {
35			return validator;
36		}
37
38		// Add novalidate tag if HTML5.
39		this.attr( "novalidate", "novalidate" );
40
41		validator = new $.validator( options, this[ 0 ] );
42		$.data( this[ 0 ], "validator", validator );
43
44		if ( validator.settings.onsubmit ) {
45
46			this.on( "click.validate", ":submit", function( event ) {
47
48				// Track the used submit button to properly handle scripted
49				// submits later.
50				validator.submitButton = event.currentTarget;
51
52				// Allow suppressing validation by adding a cancel class to the submit button
53				if ( $( this ).hasClass( "cancel" ) ) {
54					validator.cancelSubmit = true;
55				}
56
57				// Allow suppressing validation by adding the html5 formnovalidate attribute to the submit button
58				if ( $( this ).attr( "formnovalidate" ) !== undefined ) {
59					validator.cancelSubmit = true;
60				}
61			} );
62
63			// Validate the form on submit
64			this.on( "submit.validate", function( event ) {
65				if ( validator.settings.debug ) {
66
67					// Prevent form submit to be able to see console output
68					event.preventDefault();
69				}
70
71				function handle() {
72					var hidden, result;
73
74					// Insert a hidden input as a replacement for the missing submit button
75					// The hidden input is inserted in two cases:
76					//   - A user defined a `submitHandler`
77					//   - There was a pending request due to `remote` method and `stopRequest()`
78					//     was called to submit the form in case it's valid
79					if ( validator.submitButton && ( validator.settings.submitHandler || validator.formSubmitted ) ) {
80						hidden = $( "<input type='hidden'/>" )
81							.attr( "name", validator.submitButton.name )
82							.val( $( validator.submitButton ).val() )
83							.appendTo( validator.currentForm );
84					}
85
86					if ( validator.settings.submitHandler && !validator.settings.debug ) {
87						result = validator.settings.submitHandler.call( validator, validator.currentForm, event );
88						if ( hidden ) {
89
90							// And clean up afterwards; thanks to no-block-scope, hidden can be referenced
91							hidden.remove();
92						}
93						if ( result !== undefined ) {
94							return result;
95						}
96						return false;
97					}
98					return true;
99				}
100
101				// Prevent submit for invalid forms or custom submit handlers
102				if ( validator.cancelSubmit ) {
103					validator.cancelSubmit = false;
104					return handle();
105				}
106				if ( validator.form() ) {
107					if ( validator.pendingRequest ) {
108						validator.formSubmitted = true;
109						return false;
110					}
111					return handle();
112				} else {
113					validator.focusInvalid();
114					return false;
115				}
116			} );
117		}
118
119		return validator;
120	},
121
122	// https://jqueryvalidation.org/valid/
123	valid: function() {
124		var valid, validator, errorList;
125
126		if ( $( this[ 0 ] ).is( "form" ) ) {
127			valid = this.validate().form();
128		} else {
129			errorList = [];
130			valid = true;
131			validator = $( this[ 0 ].form ).validate();
132			this.each( function() {
133				valid = validator.element( this ) && valid;
134				if ( !valid ) {
135					errorList = errorList.concat( validator.errorList );
136				}
137			} );
138			validator.errorList = errorList;
139		}
140		return valid;
141	},
142
143	// https://jqueryvalidation.org/rules/
144	rules: function( command, argument ) {
145		var element = this[ 0 ],
146			isContentEditable = typeof this.attr( "contenteditable" ) !== "undefined" && this.attr( "contenteditable" ) !== "false",
147			settings, staticRules, existingRules, data, param, filtered;
148
149		// If nothing is selected, return empty object; can't chain anyway
150		if ( element == null ) {
151			return;
152		}
153
154		if ( !element.form && isContentEditable ) {
155			element.form = this.closest( "form" )[ 0 ];
156			element.name = this.attr( "name" );
157		}
158
159		if ( element.form == null ) {
160			return;
161		}
162
163		if ( command ) {
164			settings = $.data( element.form, "validator" ).settings;
165			staticRules = settings.rules;
166			existingRules = $.validator.staticRules( element );
167			switch ( command ) {
168			case "add":
169				$.extend( existingRules, $.validator.normalizeRule( argument ) );
170
171				// Remove messages from rules, but allow them to be set separately
172				delete existingRules.messages;
173				staticRules[ element.name ] = existingRules;
174				if ( argument.messages ) {
175					settings.messages[ element.name ] = $.extend( settings.messages[ element.name ], argument.messages );
176				}
177				break;
178			case "remove":
179				if ( !argument ) {
180					delete staticRules[ element.name ];
181					return existingRules;
182				}
183				filtered = {};
184				$.each( argument.split( /\s/ ), function( index, method ) {
185					filtered[ method ] = existingRules[ method ];
186					delete existingRules[ method ];
187				} );
188				return filtered;
189			}
190		}
191
192		data = $.validator.normalizeRules(
193		$.extend(
194			{},
195			$.validator.classRules( element ),
196			$.validator.attributeRules( element ),
197			$.validator.dataRules( element ),
198			$.validator.staticRules( element )
199		), element );
200
201		// Make sure required is at front
202		if ( data.required ) {
203			param = data.required;
204			delete data.required;
205			data = $.extend( { required: param }, data );
206		}
207
208		// Make sure remote is at back
209		if ( data.remote ) {
210			param = data.remote;
211			delete data.remote;
212			data = $.extend( data, { remote: param } );
213		}
214
215		return data;
216	}
217} );
218
219// JQuery trim is deprecated, provide a trim method based on String.prototype.trim
220var trim = function( str ) {
221
222	// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim#Polyfill
223	return str.replace( /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "" );
224};
225
226// Custom selectors
227$.extend( $.expr.pseudos || $.expr[ ":" ], {		// '|| $.expr[ ":" ]' here enables backwards compatibility to jQuery 1.7. Can be removed when dropping jQ 1.7.x support
228
229	// https://jqueryvalidation.org/blank-selector/
230	blank: function( a ) {
231		return !trim( "" + $( a ).val() );
232	},
233
234	// https://jqueryvalidation.org/filled-selector/
235	filled: function( a ) {
236		var val = $( a ).val();
237		return val !== null && !!trim( "" + val );
238	},
239
240	// https://jqueryvalidation.org/unchecked-selector/
241	unchecked: function( a ) {
242		return !$( a ).prop( "checked" );
243	}
244} );
245
246// Constructor for validator
247$.validator = function( options, form ) {
248	this.settings = $.extend( true, {}, $.validator.defaults, options );
249	this.currentForm = form;
250	this.init();
251};
252
253// https://jqueryvalidation.org/jQuery.validator.format/
254$.validator.format = function( source, params ) {
255	if ( arguments.length === 1 ) {
256		return function() {
257			var args = $.makeArray( arguments );
258			args.unshift( source );
259			return $.validator.format.apply( this, args );
260		};
261	}
262	if ( params === undefined ) {
263		return source;
264	}
265	if ( arguments.length > 2 && params.constructor !== Array  ) {
266		params = $.makeArray( arguments ).slice( 1 );
267	}
268	if ( params.constructor !== Array ) {
269		params = [ params ];
270	}
271	$.each( params, function( i, n ) {
272		source = source.replace( new RegExp( "\\{" + i + "\\}", "g" ), function() {
273			return n;
274		} );
275	} );
276	return source;
277};
278
279$.extend( $.validator, {
280
281	defaults: {
282		messages: {},
283		groups: {},
284		rules: {},
285		errorClass: "error",
286		pendingClass: "pending",
287		validClass: "valid",
288		errorElement: "label",
289		focusCleanup: false,
290		focusInvalid: true,
291		errorContainer: $( [] ),
292		errorLabelContainer: $( [] ),
293		onsubmit: true,
294		ignore: ":hidden",
295		ignoreTitle: false
vendor: 5,102 bytes, lines 295-442
295,
296		onfocusin: function( element ) {
297			this.lastActive = element;
298
299			// Hide error label and remove error class on focus if enabled
300			if ( this.settings.focusCleanup ) {
301				if ( this.settings.unhighlight ) {
302					this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass );
303				}
304				this.hideThese( this.errorsFor( element ) );
305			}
306		},
307		onfocusout: function( element ) {
308			if ( !this.checkable( element ) && ( element.name in this.submitted || !this.optional( element ) ) ) {
309				this.element( element );
310			}
311		},
312		onkeyup: function( element, event ) {
313
314			// Avoid revalidate the field when pressing one of the following keys
315			// Shift       => 16
316			// Ctrl        => 17
317			// Alt         => 18
318			// Caps lock   => 20
319			// End         => 35
320			// Home        => 36
321			// Left arrow  => 37
322			// Up arrow    => 38
323			// Right arrow => 39
324			// Down arrow  => 40
325			// Insert      => 45
326			// Num lock    => 144
327			// AltGr key   => 225
328			var excludedKeys = [
329				16, 17, 18, 20, 35, 36, 37,
330				38, 39, 40, 45, 144, 225
331			];
332
333			if ( event.which === 9 && this.elementValue( element ) === "" || $.inArray( event.keyCode, excludedKeys ) !== -1 ) {
334				return;
335			} else if ( element.name in this.submitted || element.name in this.invalid ) {
336				this.element( element );
337			}
338		},
339		onclick: function( element ) {
340
341			// Click on selects, radiobuttons and checkboxes
342			if ( element.name in this.submitted ) {
343				this.element( element );
344
345			// Or option elements, check parent select in that case
346			} else if ( element.parentNode.name in this.submitted ) {
347				this.element( element.parentNode );
348			}
349		},
350		highlight: function( element, errorClass, validClass ) {
351			if ( element.type === "radio" ) {
352				this.findByName( element.name ).addClass( errorClass ).removeClass( validClass );
353			} else {
354				$( element ).addClass( errorClass ).removeClass( validClass );
355			}
356		},
357		unhighlight: function( element, errorClass, validClass ) {
358			if ( element.type === "radio" ) {
359				this.findByName( element.name ).removeClass( errorClass ).addClass( validClass );
360			} else {
361				$( element ).removeClass( errorClass ).addClass( validClass );
362			}
363		}
364	},
365
366	// https://jqueryvalidation.org/jQuery.validator.setDefaults/
367	setDefaults: function( settings ) {
368		$.extend( $.validator.defaults, settings );
369	},
370
371	messages: {
372		required: "This field is required.",
373		remote: "Please fix this field.",
374		email: "Please enter a valid email address.",
375		url: "Please enter a valid URL.",
376		date: "Please enter a valid date.",
377		dateISO: "Please enter a valid date (ISO).",
378		number: "Please enter a valid number.",
379		digits: "Please enter only digits.",
380		equalTo: "Please enter the same value again.",
381		maxlength: $.validator.format( "Please enter no more than {0} characters." ),
382		minlength: $.validator.format( "Please enter at least {0} characters." ),
383		rangelength: $.validator.format( "Please enter a value between {0} and {1} characters long." ),
384		range: $.validator.format( "Please enter a value between {0} and {1}." ),
385		max: $.validator.format( "Please enter a value less than or equal to {0}." ),
386		min: $.validator.format( "Please enter a value greater than or equal to {0}." ),
387		step: $.validator.format( "Please enter a multiple of {0}." )
388	},
389
390	autoCreateRanges: false,
391
392	prototype: {
393
394		init: function() {
395			this.labelContainer = $( this.settings.errorLabelContainer );
396			this.errorContext = this.labelContainer.length && this.labelContainer || $( this.currentForm );
397			this.containers = $( this.settings.errorContainer ).add( this.settings.errorLabelContainer );
398			this.submitted = {};
399			this.valueCache = {};
400			this.pendingRequest = 0;
401			this.pending = {};
402			this.invalid = {};
403			this.reset();
404
405			var currentForm = this.currentForm,
406				groups = ( this.groups = {} ),
407				rules;
408			$.each( this.settings.groups, function( key, value ) {
409				if ( typeof value === "string" ) {
410					value = value.split( /\s/ );
411				}
412				$.each( value, function( index, name ) {
413					groups[ name ] = key;
414				} );
415			} );
416			rules = this.settings.rules;
417			$.each( rules, function( key, value ) {
418				rules[ key ] = $.validator.normalizeRule( value );
419			} );
420
421			function delegate( event ) {
422				var isContentEditable = typeof $( this ).attr( "contenteditable" ) !== "undefined" && $( this ).attr( "contenteditable" ) !== "false";
423
424				// Set form expando on contenteditable
425				if ( !this.form && isContentEditable ) {
426					this.form = $( this ).closest( "form" )[ 0 ];
427					this.name = $( this ).attr( "name" );
428				}
429
430				// Ignore the element if it belongs to another form. This will happen mainly
431				// when setting the `form` attribute of an input to the id of another form.
432				if ( currentForm !== this.form ) {
433					return;
434				}
435
436				var validator = $.data( this.form, "validator" ),
437					eventType = "on" + event.type.replace( /^validate/, "" ),
438					settings = validator.settings;
439				if ( settings[ eventType ] && !$( this ).is( settings.ignore ) ) {
440					settings[ eventType ].call( validator, this, event );
441				}
442			}
vendor: 38,919 bytes, lines 443-1700
443
444			$( this.currentForm )
445				.on( "focusin.validate focusout.validate keyup.validate",
446					":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], " +
447					"[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], " +
448					"[type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], " +
449					"[type='radio'], [type='checkbox'], [contenteditable], [type='button']", delegate )
450
451				// Support: Chrome, oldIE
452				// "select" is provided as event.target when clicking a option
453				.on( "click.validate", "select, option, [type='radio'], [type='checkbox']", delegate );
454
455			if ( this.settings.invalidHandler ) {
456				$( this.currentForm ).on( "invalid-form.validate", this.settings.invalidHandler );
457			}
458		},
459
460		// https://jqueryvalidation.org/Validator.form/
461		form: function() {
462			this.checkForm();
463			$.extend( this.submitted, this.errorMap );
464			this.invalid = $.extend( {}, this.errorMap );
465			if ( !this.valid() ) {
466				$( this.currentForm ).triggerHandler( "invalid-form", [ this ] );
467			}
468			this.showErrors();
469			return this.valid();
470		},
471
472		checkForm: function() {
473			this.prepareForm();
474			for ( var i = 0, elements = ( this.currentElements = this.elements() ); elements[ i ]; i++ ) {
475				this.check( elements[ i ] );
476			}
477			return this.valid();
478		},
479
480		// https://jqueryvalidation.org/Validator.element/
481		element: function( element ) {
482			var cleanElement = this.clean( element ),
483				checkElement = this.validationTargetFor( cleanElement ),
484				v = this,
485				result = true,
486				rs, group;
487
488			if ( checkElement === undefined ) {
489				delete this.invalid[ cleanElement.name ];
490			} else {
491				this.prepareElement( checkElement );
492				this.currentElements = $( checkElement );
493
494				// If this element is grouped, then validate all group elements already
495				// containing a value
496				group = this.groups[ checkElement.name ];
497				if ( group ) {
498					$.each( this.groups, function( name, testgroup ) {
499						if ( testgroup === group && name !== checkElement.name ) {
500							cleanElement = v.validationTargetFor( v.clean( v.findByName( name ) ) );
501							if ( cleanElement && cleanElement.name in v.invalid ) {
502								v.currentElements.push( cleanElement );
503								result = v.check( cleanElement ) && result;
504							}
505						}
506					} );
507				}
508
509				rs = this.check( checkElement ) !== false;
510				result = result && rs;
511				if ( rs ) {
512					this.invalid[ checkElement.name ] = false;
513				} else {
514					this.invalid[ checkElement.name ] = true;
515				}
516
517				if ( !this.numberOfInvalids() ) {
518
519					// Hide error containers on last error
520					this.toHide = this.toHide.add( this.containers );
521				}
522				this.showErrors();
523
524				// Add aria-invalid status for screen readers
525				$( element ).attr( "aria-invalid", !rs );
526			}
527
528			return result;
529		},
530
531		// https://jqueryvalidation.org/Validator.showErrors/
532		showErrors: function( errors ) {
533			if ( errors ) {
534				var validator = this;
535
536				// Add items to error list and map
537				$.extend( this.errorMap, errors );
538				this.errorList = $.map( this.errorMap, function( message, name ) {
539					return {
540						message: message,
541						element: validator.findByName( name )[ 0 ]
542					};
543				} );
544
545				// Remove items from success list
546				this.successList = $.grep( this.successList, function( element ) {
547					return !( element.name in errors );
548				} );
549			}
550			if ( this.settings.showErrors ) {
551				this.settings.showErrors.call( this, this.errorMap, this.errorList );
552			} else {
553				this.defaultShowErrors();
554			}
555		},
556
557		// https://jqueryvalidation.org/Validator.resetForm/
558		resetForm: function() {
559			if ( $.fn.resetForm ) {
560				$( this.currentForm ).resetForm();
561			}
562			this.invalid = {};
563			this.submitted = {};
564			this.prepareForm();
565			this.hideErrors();
566			var elements = this.elements()
567				.removeData( "previousValue" )
568				.removeAttr( "aria-invalid" );
569
570			this.resetElements( elements );
571		},
572
573		resetElements: function( elements ) {
574			var i;
575
576			if ( this.settings.unhighlight ) {
577				for ( i = 0; elements[ i ]; i++ ) {
578					this.settings.unhighlight.call( this, elements[ i ],
579						this.settings.errorClass, "" );
580					this.findByName( elements[ i ].name ).removeClass( this.settings.validClass );
581				}
582			} else {
583				elements
584					.removeClass( this.settings.errorClass )
585					.removeClass( this.settings.validClass );
586			}
587		},
588
589		numberOfInvalids: function() {
590			return this.objectLength( this.invalid );
591		},
592
593		objectLength: function( obj ) {
594			/* jshint unused: false */
595			var count = 0,
596				i;
597			for ( i in obj ) {
598
599				// This check allows counting elements with empty error
600				// message as invalid elements
601				if ( obj[ i ] !== undefined && obj[ i ] !== null && obj[ i ] !== false ) {
602					count++;
603				}
604			}
605			return count;
606		},
607
608		hideErrors: function() {
609			this.hideThese( this.toHide );
610		},
611
612		hideThese: function( errors ) {
613			errors.not( this.containers ).text( "" );
614			this.addWrapper( errors ).hide();
615		},
616
617		valid: function() {
618			return this.size() === 0;
619		},
620
621		size: function() {
622			return this.errorList.length;
623		},
624
625		focusInvalid: function() {
626			if ( this.settings.focusInvalid ) {
627				try {
628					$( this.findLastActive() || this.errorList.length && this.errorList[ 0 ].element || [] )
629					.filter( ":visible" )
630					.trigger( "focus" )
631
632					// Manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find
633					.trigger( "focusin" );
634				} catch ( e ) {
635
636					// Ignore IE throwing errors when focusing hidden elements
637				}
638			}
639		},
640
641		findLastActive: function() {
642			var lastActive = this.lastActive;
643			return lastActive && $.grep( this.errorList, function( n ) {
644				return n.element.name === lastActive.name;
645			} ).length === 1 && lastActive;
646		},
647
648		elements: function() {
649			var validator = this,
650				rulesCache = {};
651
652			// Select all valid inputs inside the form (no submit or reset buttons)
653			return $( this.currentForm )
654			.find( "input, select, textarea, [contenteditable]" )
655			.not( ":submit, :reset, :image, :disabled" )
656			.not( this.settings.ignore )
657			.filter( function() {
658				var name = this.name || $( this ).attr( "name" ); // For contenteditable
659				var isContentEditable = typeof $( this ).attr( "contenteditable" ) !== "undefined" && $( this ).attr( "contenteditable" ) !== "false";
660
661				if ( !name && validator.settings.debug && window.console ) {
662					console.error( "%o has no name assigned", this );
663				}
664
665				// Set form expando on contenteditable
666				if ( isContentEditable ) {
667					this.form = $( this ).closest( "form" )[ 0 ];
668					this.name = name;
669				}
670
671				// Ignore elements that belong to other/nested forms
672				if ( this.form !== validator.currentForm ) {
673					return false;
674				}
675
676				// Select only the first element for each name, and only those with rules specified
677				if ( name in rulesCache || !validator.objectLength( $( this ).rules() ) ) {
678					return false;
679				}
680
681				rulesCache[ name ] = true;
682				return true;
683			} );
684		},
685
686		clean: function( selector ) {
687			return $( selector )[ 0 ];
688		},
689
690		errors: function() {
691			var errorClass = this.settings.errorClass.split( " " ).join( "." );
692			return $( this.settings.errorElement + "." + errorClass, this.errorContext );
693		},
694
695		resetInternals: function() {
696			this.successList = [];
697			this.errorList = [];
698			this.errorMap = {};
699			this.toShow = $( [] );
700			this.toHide = $( [] );
701		},
702
703		reset: function() {
704			this.resetInternals();
705			this.currentElements = $( [] );
706		},
707
708		prepareForm: function() {
709			this.reset();
710			this.toHide = this.errors().add( this.containers );
711		},
712
713		prepareElement: function( element ) {
714			this.reset();
715			this.toHide = this.errorsFor( element );
716		},
717
718		elementValue: function( element ) {
719			var $element = $( element ),
720				type = element.type,
721				isContentEditable = typeof $element.attr( "contenteditable" ) !== "undefined" && $element.attr( "contenteditable" ) !== "false",
722				val, idx;
723
724			if ( type === "radio" || type === "checkbox" ) {
725				return this.findByName( element.name ).filter( ":checked" ).val();
726			} else if ( type === "number" && typeof element.validity !== "undefined" ) {
727				return element.validity.badInput ? "NaN" : $element.val();
728			}
729
730			if ( isContentEditable ) {
731				val = $element.text();
732			} else {
733				val = $element.val();
734			}
735
736			if ( type === "file" ) {
737
738				// Modern browser (chrome & safari)
739				if ( val.substr( 0, 12 ) === "C:\\fakepath\\" ) {
740					return val.substr( 12 );
741				}
742
743				// Legacy browsers
744				// Unix-based path
745				idx = val.lastIndexOf( "/" );
746				if ( idx >= 0 ) {
747					return val.substr( idx + 1 );
748				}
749
750				// Windows-based path
751				idx = val.lastIndexOf( "\\" );
752				if ( idx >= 0 ) {
753					return val.substr( idx + 1 );
754				}
755
756				// Just the file name
757				return val;
758			}
759
760			if ( typeof val === "string" ) {
761				return val.replace( /\r/g, "" );
762			}
763			return val;
764		},
765
766		check: function( element ) {
767			element = this.validationTargetFor( this.clean( element ) );
768
769			var rules = $( element ).rules(),
770				rulesCount = $.map( rules, function( n, i ) {
771					return i;
772				} ).length,
773				dependencyMismatch = false,
774				val = this.elementValue( element ),
775				result, method, rule, normalizer;
776
777			// Abort any pending Ajax request from a previous call to this method.
778			this.abortRequest( element );
779
780			// Prioritize the local normalizer defined for this element over the global one
781			// if the former exists, otherwise user the global one in case it exists.
782			if ( typeof rules.normalizer === "function" ) {
783				normalizer = rules.normalizer;
784			} else if (	typeof this.settings.normalizer === "function" ) {
785				normalizer = this.settings.normalizer;
786			}
787
788			// If normalizer is defined, then call it to retreive the changed value instead
789			// of using the real one.
790			// Note that `this` in the normalizer is `element`.
791			if ( normalizer ) {
792				val = normalizer.call( element, val );
793
794				// Delete the normalizer from rules to avoid treating it as a pre-defined method.
795				delete rules.normalizer;
796			}
797
798			for ( method in rules ) {
799				rule = { method: method, parameters: rules[ method ] };
800				try {
801					result = $.validator.methods[ method ].call( this, val, element, rule.parameters );
802
803					// If a method indicates that the field is optional and therefore valid,
804					// don't mark it as valid when there are no other rules
805					if ( result === "dependency-mismatch" && rulesCount === 1 ) {
806						dependencyMismatch = true;
807						continue;
808					}
809					dependencyMismatch = false;
810
811					if ( result === "pending" ) {
812						this.toHide = this.toHide.not( this.errorsFor( element ) );
813						return;
814					}
815
816					if ( !result ) {
817						this.formatAndAdd( element, rule );
818						return false;
819					}
820				} catch ( e ) {
821					if ( this.settings.debug && window.console ) {
822						console.log( "Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.", e );
823					}
824					if ( e instanceof TypeError ) {
825						e.message += ".  Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.";
826					}
827
828					throw e;
829				}
830			}
831			if ( dependencyMismatch ) {
832				return;
833			}
834			if ( this.objectLength( rules ) ) {
835				this.successList.push( element );
836			}
837			return true;
838		},
839
840		// Return the custom message for the given element and validation method
841		// specified in the element's HTML5 data attribute
842		// return the generic message if present and no method specific message is present
843		customDataMessage: function( element, method ) {
844			return $( element ).data( "msg" + method.charAt( 0 ).toUpperCase() +
845				method.substring( 1 ).toLowerCase() ) || $( element ).data( "msg" );
846		},
847
848		// Return the custom message for the given element name and validation method
849		customMessage: function( name, method ) {
850			var m = this.settings.messages[ name ];
851			return m && ( m.constructor === String ? m : m[ method ] );
852		},
853
854		// Return the first defined argument, allowing empty strings
855		findDefined: function() {
856			for ( var i = 0; i < arguments.length; i++ ) {
857				if ( arguments[ i ] !== undefined ) {
858					return arguments[ i ];
859				}
860			}
861			return undefined;
862		},
863
864		// The second parameter 'rule' used to be a string, and extended to an object literal
865		// of the following form:
866		// rule = {
867		//     method: "method name",
868		//     parameters: "the given method parameters"
869		// }
870		//
871		// The old behavior still supported, kept to maintain backward compatibility with
872		// old code, and will be removed in the next major release.
873		defaultMessage: function( element, rule ) {
874			if ( typeof rule === "string" ) {
875				rule = { method: rule };
876			}
877
878			var message = this.findDefined(
879					this.customMessage( element.name, rule.method ),
880					this.customDataMessage( element, rule.method ),
881
882					// 'title' is never undefined, so handle empty string as undefined
883					!this.settings.ignoreTitle && element.title || undefined,
884					$.validator.messages[ rule.method ],
885					"<strong>Warning: No message defined for " + element.name + "</strong>"
886				),
887				theregex = /\$?\{(\d+)\}/g;
888			if ( typeof message === "function" ) {
889				message = message.call( this, rule.parameters, element );
890			} else if ( theregex.test( message ) ) {
891				message = $.validator.format( message.replace( theregex, "{$1}" ), rule.parameters );
892			}
893
894			return message;
895		},
896
897		formatAndAdd: function( element, rule ) {
898			var message = this.defaultMessage( element, rule );
899
900			this.errorList.push( {
901				message: message,
902				element: element,
903				method: rule.method
904			} );
905
906			this.errorMap[ element.name ] = message;
907			this.submitted[ element.name ] = message;
908		},
909
910		addWrapper: function( toToggle ) {
911			if ( this.settings.wrapper ) {
912				toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) );
913			}
914			return toToggle;
915		},
916
917		defaultShowErrors: function() {
918			var i, elements, error;
919			for ( i = 0; this.errorList[ i ]; i++ ) {
920				error = this.errorList[ i ];
921				if ( this.settings.highlight ) {
922					this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass );
923				}
924				this.showLabel( error.element, error.message );
925			}
926			if ( this.errorList.length ) {
927				this.toShow = this.toShow.add( this.containers );
928			}
929			if ( this.settings.success ) {
930				for ( i = 0; this.successList[ i ]; i++ ) {
931					this.showLabel( this.successList[ i ] );
932				}
933			}
934			if ( this.settings.unhighlight ) {
935				for ( i = 0, elements = this.validElements(); elements[ i ]; i++ ) {
936					this.settings.unhighlight.call( this, elements[ i ], this.settings.errorClass, this.settings.validClass );
937				}
938			}
939			this.toHide = this.toHide.not( this.toShow );
940			this.hideErrors();
941			this.addWrapper( this.toShow ).show();
942		},
943
944		validElements: function() {
945			return this.currentElements.not( this.invalidElements() );
946		},
947
948		invalidElements: function() {
949			return $( this.errorList ).map( function() {
950				return this.element;
951			} );
952		},
953
954		showLabel: function( element, message ) {
955			var place, group, errorID, v,
956				error = this.errorsFor( element ),
957				elementID = this.idOrName( element ),
958				describedBy = $( element ).attr( "aria-describedby" );
959
960			if ( error.length ) {
961
962				// Refresh error/success class
963				error.removeClass( this.settings.validClass ).addClass( this.settings.errorClass );
964
965				// Replace message on existing label
966				if ( this.settings && this.settings.escapeHtml ) {
967					error.text( message || "" );
968				} else {
969					error.html( message || "" );
970				}
971			} else {
972
973				// Create error element
974				error = $( "<" + this.settings.errorElement + ">" )
975					.attr( "id", elementID + "-error" )
976					.addClass( this.settings.errorClass );
977
978				if ( this.settings && this.settings.escapeHtml ) {
979					error.text( message || "" );
980				} else {
981					error.html( message || "" );
982				}
983
984				// Maintain reference to the element to be placed into the DOM
985				place = error;
986				if ( this.settings.wrapper ) {
987
988					// Make sure the element is visible, even in IE
989					// actually showing the wrapped element is handled elsewhere
990					place = error.hide().show().wrap( "<" + this.settings.wrapper + "/>" ).parent();
991				}
992				if ( this.labelContainer.length ) {
993					this.labelContainer.append( place );
994				} else if ( this.settings.errorPlacement ) {
995					this.settings.errorPlacement.call( this, place, $( element ) );
996				} else {
997					place.insertAfter( element );
998				}
999
1000				// Link error back to the element
1001				if ( error.is( "label" ) ) {
1002
1003					// If the error is a label, then associate using 'for'
1004					error.attr( "for", elementID );
1005
1006					// If the element is not a child of an associated label, then it's necessary
1007					// to explicitly apply aria-describedby
1008				} else if ( error.parents( "label[for='" + this.escapeCssMeta( elementID ) + "']" ).length === 0 ) {
1009					errorID = error.attr( "id" );
1010
1011					// Respect existing non-error aria-describedby
1012					if ( !describedBy ) {
1013						describedBy = errorID;
1014					} else if ( !describedBy.match( new RegExp( "\\b" + this.escapeCssMeta( errorID ) + "\\b" ) ) ) {
1015
1016						// Add to end of list if not already present
1017						describedBy += " " + errorID;
1018					}
1019					$( element ).attr( "aria-describedby", describedBy );
1020
1021					// If this element is grouped, then assign to all elements in the same group
1022					group = this.groups[ element.name ];
1023					if ( group ) {
1024						v = this;
1025						$.each( v.groups, function( name, testgroup ) {
1026							if ( testgroup === group ) {
1027								$( "[name='" + v.escapeCssMeta( name ) + "']", v.currentForm )
1028									.attr( "aria-describedby", error.attr( "id" ) );
1029							}
1030						} );
1031					}
1032				}
1033			}
1034			if ( !message && this.settings.success ) {
1035				error.text( "" );
1036				if ( typeof this.settings.success === "string" ) {
1037					error.addClass( this.settings.success );
1038				} else {
1039					this.settings.success( error, element );
1040				}
1041			}
1042			this.toShow = this.toShow.add( error );
1043		},
1044
1045		errorsFor: function( element ) {
1046			var name = this.escapeCssMeta( this.idOrName( element ) ),
1047				describer = $( element ).attr( "aria-describedby" ),
1048				selector = "label[for='" + name + "'], label[for='" + name + "'] *";
1049
1050			// 'aria-describedby' should directly reference the error element
1051			if ( describer ) {
1052				selector = selector + ", #" + this.escapeCssMeta( describer )
1053					.replace( /\s+/g, ", #" );
1054			}
1055
1056			return this
1057				.errors()
1058				.filter( selector );
1059		},
1060
1061		// See https://api.jquery.com/category/selectors/, for CSS
1062		// meta-characters that should be escaped in order to be used with JQuery
1063		// as a literal part of a name/id or any selector.
1064		escapeCssMeta: function( string ) {
1065			if ( string === undefined ) {
1066				return "";
1067			}
1068
1069			return string.replace( /([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g, "\\$1" );
1070		},
1071
1072		idOrName: function( element ) {
1073			return this.groups[ element.name ] || ( this.checkable( element ) ? element.name : element.id || element.name );
1074		},
1075
1076		validationTargetFor: function( element ) {
1077
1078			// If radio/checkbox, validate first element in group instead
1079			if ( this.checkable( element ) ) {
1080				element = this.findByName( element.name );
1081			}
1082
1083			// Always apply ignore filter
1084			return $( element ).not( this.settings.ignore )[ 0 ];
1085		},
1086
1087		checkable: function( element ) {
1088			return ( /radio|checkbox/i ).test( element.type );
1089		},
1090
1091		findByName: function( name ) {
1092			return $( this.currentForm ).find( "[name='" + this.escapeCssMeta( name ) + "']" );
1093		},
1094
1095		getLength: function( value, element ) {
1096			switch ( element.nodeName.toLowerCase() ) {
1097			case "select":
1098				return $( "option:selected", element ).length;
1099			case "input":
1100				if ( this.checkable( element ) ) {
1101					return this.findByName( element.name ).filter( ":checked" ).length;
1102				}
1103			}
1104			return value.length;
1105		},
1106
1107		depend: function( param, element ) {
1108			return this.dependTypes[ typeof param ] ? this.dependTypes[ typeof param ]( param, element ) : true;
1109		},
1110
1111		dependTypes: {
1112			"boolean": function( param ) {
1113				return param;
1114			},
1115			"string": function( param, element ) {
1116				return !!$( param, element.form ).length;
1117			},
1118			"function": function( param, element ) {
1119				return param( element );
1120			}
1121		},
1122
1123		optional: function( element ) {
1124			var val = this.elementValue( element );
1125			return !$.validator.methods.required.call( this, val, element ) && "dependency-mismatch";
1126		},
1127
1128		elementAjaxPort: function( element ) {
1129			return "validate" + element.name;
1130		},
1131
1132		startRequest: function( element ) {
1133			if ( !this.pending[ element.name ] ) {
1134				this.pendingRequest++;
1135				$( element ).addClass( this.settings.pendingClass );
1136				this.pending[ element.name ] = true;
1137			}
1138		},
1139
1140		stopRequest: function( element, valid ) {
1141			this.pendingRequest--;
1142
1143			// Sometimes synchronization fails, make sure pendingRequest is never < 0
1144			if ( this.pendingRequest < 0 ) {
1145				this.pendingRequest = 0;
1146			}
1147			delete this.pending[ element.name ];
1148			$( element ).removeClass( this.settings.pendingClass );
1149			if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() && this.pendingRequest === 0 ) {
1150				$( this.currentForm ).trigger( "submit" );
1151
1152				// Remove the hidden input that was used as a replacement for the
1153				// missing submit button. The hidden input is added by `handle()`
1154				// to ensure that the value of the used submit button is passed on
1155				// for scripted submits triggered by this method
1156				if ( this.submitButton ) {
1157					$( "input:hidden[name='" + this.submitButton.name + "']", this.currentForm ).remove();
1158				}
1159
1160				this.formSubmitted = false;
1161			} else if ( !valid && this.pendingRequest === 0 && this.formSubmitted ) {
1162				$( this.currentForm ).triggerHandler( "invalid-form", [ this ] );
1163				this.formSubmitted = false;
1164			}
1165		},
1166
1167		abortRequest: function( element ) {
1168			var port;
1169
1170			if ( this.pending[ element.name ] ) {
1171				port = this.elementAjaxPort( element );
1172				$.ajaxAbort( port );
1173
1174				this.pendingRequest--;
1175
1176				// Sometimes synchronization fails, make sure pendingRequest is never < 0
1177				if ( this.pendingRequest < 0 ) {
1178					this.pendingRequest = 0;
1179				}
1180
1181				delete this.pending[ element.name ];
1182				$( element ).removeClass( this.settings.pendingClass );
1183			}
1184		},
1185
1186		previousValue: function( element, method ) {
1187			method = typeof method === "string" && method || "remote";
1188
1189			return $.data( element, "previousValue" ) || $.data( element, "previousValue", {
1190				old: null,
1191				valid: true,
1192				message: this.defaultMessage( element, { method: method } )
1193			} );
1194		},
1195
1196		// Cleans up all forms and elements, removes validator-specific events
1197		destroy: function() {
1198			this.resetForm();
1199
1200			$( this.currentForm )
1201				.off( ".validate" )
1202				.removeData( "validator" )
1203				.find( ".validate-equalTo-blur" )
1204					.off( ".validate-equalTo" )
1205					.removeClass( "validate-equalTo-blur" )
1206				.find( ".validate-lessThan-blur" )
1207					.off( ".validate-lessThan" )
1208					.removeClass( "validate-lessThan-blur" )
1209				.find( ".validate-lessThanEqual-blur" )
1210					.off( ".validate-lessThanEqual" )
1211					.removeClass( "validate-lessThanEqual-blur" )
1212				.find( ".validate-greaterThanEqual-blur" )
1213					.off( ".validate-greaterThanEqual" )
1214					.removeClass( "validate-greaterThanEqual-blur" )
1215				.find( ".validate-greaterThan-blur" )
1216					.off( ".validate-greaterThan" )
1217					.removeClass( "validate-greaterThan-blur" );
1218		}
1219
1220	},
1221
1222	classRuleSettings: {
1223		required: { required: true },
1224		email: { email: true },
1225		url: { url: true },
1226		date: { date: true },
1227		dateISO: { dateISO: true },
1228		number: { number: true },
1229		digits: { digits: true },
1230		creditcard: { creditcard: true }
1231	},
1232
1233	addClassRules: function( className, rules ) {
1234		if ( className.constructor === String ) {
1235			this.classRuleSettings[ className ] = rules;
1236		} else {
1237			$.extend( this.classRuleSettings, className );
1238		}
1239	},
1240
1241	classRules: function( element ) {
1242		var rules = {},
1243			classes = $( element ).attr( "class" );
1244
1245		if ( classes ) {
1246			$.each( classes.split( " " ), function() {
1247				if ( this in $.validator.classRuleSettings ) {
1248					$.extend( rules, $.validator.classRuleSettings[ this ] );
1249				}
1250			} );
1251		}
1252		return rules;
1253	},
1254
1255	normalizeAttributeRule: function( rules, type, method, value ) {
1256
1257		// Convert the value to a number for number inputs, and for text for backwards compability
1258		// allows type="date" and others to be compared as strings
1259		if ( /min|max|step/.test( method ) && ( type === null || /number|range|text/.test( type ) ) ) {
1260			value = Number( value );
1261
1262			// Support Opera Mini, which returns NaN for undefined minlength
1263			if ( isNaN( value ) ) {
1264				value = undefined;
1265			}
1266		}
1267
1268		if ( value || value === 0 ) {
1269			rules[ method ] = value;
1270		} else if ( type === method && type !== "range" ) {
1271
1272			// Exception: the jquery validate 'range' method
1273			// does not test for the html5 'range' type
1274			rules[ type === "date" ? "dateISO" : method ] = true;
1275		}
1276	},
1277
1278	attributeRules: function( element ) {
1279		var rules = {},
1280			$element = $( element ),
1281			type = element.getAttribute( "type" ),
1282			method, value;
1283
1284		for ( method in $.validator.methods ) {
1285
1286			// Support for <input required> in both html5 and older browsers
1287			if ( method === "required" ) {
1288				value = element.getAttribute( method );
1289
1290				// Some browsers return an empty string for the required attribute
1291				// and non-HTML5 browsers might have required="" markup
1292				if ( value === "" ) {
1293					value = true;
1294				}
1295
1296				// Force non-HTML5 browsers to return bool
1297				value = !!value;
1298			} else {
1299				value = $element.attr( method );
1300			}
1301
1302			this.normalizeAttributeRule( rules, type, method, value );
1303		}
1304
1305		// 'maxlength' may be returned as -1, 2147483647 ( IE ) and 524288 ( safari ) for text inputs
1306		if ( rules.maxlength && /-1|2147483647|524288/.test( rules.maxlength ) ) {
1307			delete rules.maxlength;
1308		}
1309
1310		return rules;
1311	},
1312
1313	dataRules: function( element ) {
1314		var rules = {},
1315			$element = $( element ),
1316			type = element.getAttribute( "type" ),
1317			method, value;
1318
1319		for ( method in $.validator.methods ) {
1320			value = $element.data( "rule" + method.charAt( 0 ).toUpperCase() + method.substring( 1 ).toLowerCase() );
1321
1322			// Cast empty attributes like `data-rule-required` to `true`
1323			if ( value === "" ) {
1324				value = true;
1325			}
1326
1327			this.normalizeAttributeRule( rules, type, method, value );
1328		}
1329		return rules;
1330	},
1331
1332	staticRules: function( element ) {
1333		var rules = {},
1334			validator = $.data( element.form, "validator" );
1335
1336		if ( validator.settings.rules ) {
1337			rules = $.validator.normalizeRule( validator.settings.rules[ element.name ] ) || {};
1338		}
1339		return rules;
1340	},
1341
1342	normalizeRules: function( rules, element ) {
1343
1344		// Handle dependency check
1345		$.each( rules, function( prop, val ) {
1346
1347			// Ignore rule when param is explicitly false, eg. required:false
1348			if ( val === false ) {
1349				delete rules[ prop ];
1350				return;
1351			}
1352			if ( val.param || val.depends ) {
1353				var keepRule = true;
1354				switch ( typeof val.depends ) {
1355				case "string":
1356					keepRule = !!$( val.depends, element.form ).length;
1357					break;
1358				case "function":
1359					keepRule = val.depends.call( element, element );
1360					break;
1361				}
1362				if ( keepRule ) {
1363					rules[ prop ] = val.param !== undefined ? val.param : true;
1364				} else {
1365					$.data( element.form, "validator" ).resetElements( $( element ) );
1366					delete rules[ prop ];
1367				}
1368			}
1369		} );
1370
1371		// Evaluate parameters
1372		$.each( rules, function( rule, parameter ) {
1373			rules[ rule ] = typeof parameter === "function" && rule !== "normalizer" ? parameter( element ) : parameter;
1374		} );
1375
1376		// Clean number parameters
1377		$.each( [ "minlength", "maxlength" ], function() {
1378			if ( rules[ this ] ) {
1379				rules[ this ] = Number( rules[ this ] );
1380			}
1381		} );
1382		$.each( [ "rangelength", "range" ], function() {
1383			var parts;
1384			if ( rules[ this ] ) {
1385				if ( Array.isArray( rules[ this ] ) ) {
1386					rules[ this ] = [ Number( rules[ this ][ 0 ] ), Number( rules[ this ][ 1 ] ) ];
1387				} else if ( typeof rules[ this ] === "string" ) {
1388					parts = rules[ this ].replace( /[\[\]]/g, "" ).split( /[\s,]+/ );
1389					rules[ this ] = [ Number( parts[ 0 ] ), Number( parts[ 1 ] ) ];
1390				}
1391			}
1392		} );
1393
1394		if ( $.validator.autoCreateRanges ) {
1395
1396			// Auto-create ranges
1397			if ( rules.min != null && rules.max != null ) {
1398				rules.range = [ rules.min, rules.max ];
1399				delete rules.min;
1400				delete rules.max;
1401			}
1402			if ( rules.minlength != null && rules.maxlength != null ) {
1403				rules.rangelength = [ rules.minlength, rules.maxlength ];
1404				delete rules.minlength;
1405				delete rules.maxlength;
1406			}
1407		}
1408
1409		return rules;
1410	},
1411
1412	// Converts a simple string to a {string: true} rule, e.g., "required" to {required:true}
1413	normalizeRule: function( data ) {
1414		if ( typeof data === "string" ) {
1415			var transformed = {};
1416			$.each( data.split( /\s/ ), function() {
1417				transformed[ this ] = true;
1418			} );
1419			data = transformed;
1420		}
1421		return data;
1422	},
1423
1424	// https://jqueryvalidation.org/jQuery.validator.addMethod/
1425	addMethod: function( name, method, message ) {
1426		$.validator.methods[ name ] = method;
1427		$.validator.messages[ name ] = message !== undefined ? message : $.validator.messages[ name ];
1428		if ( method.length < 3 ) {
1429			$.validator.addClassRules( name, $.validator.normalizeRule( name ) );
1430		}
1431	},
1432
1433	// https://jqueryvalidation.org/jQuery.validator.methods/
1434	methods: {
1435
1436		// https://jqueryvalidation.org/required-method/
1437		required: function( value, element, param ) {
1438
1439			// Check if dependency is met
1440			if ( !this.depend( param, element ) ) {
1441				return "dependency-mismatch";
1442			}
1443			if ( element.nodeName.toLowerCase() === "select" ) {
1444
1445				// Could be an array for select-multiple or a string, both are fine this way
1446				var val = $( element ).val();
1447				return val && val.length > 0;
1448			}
1449			if ( this.checkable( element ) ) {
1450				return this.getLength( value, element ) > 0;
1451			}
1452			return value !== undefined && value !== null && value.length > 0;
1453		},
1454
1455		// https://jqueryvalidation.org/email-method/
1456		email: function( value, element ) {
1457
1458			// From https://html.spec.whatwg.org/multipage/forms.html#valid-e-mail-address
1459			// Retrieved 2014-01-14
1460			// If you have a problem with this implementation, report a bug against the above spec
1461			// Or use custom methods to implement your own email validation
1462			return this.optional( element ) || /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test( value );
1463		},
1464
1465		// https://jqueryvalidation.org/url-method/
1466		url: function( value, element ) {
1467
1468			// Copyright (c) 2010-2013 Diego Perini, MIT licensed
1469			// https://gist.github.com/dperini/729294
1470			// see also https://mathiasbynens.be/demo/url-regex
1471			// modified to allow protocol-relative URLs
1472			return this.optional( element ) || /^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})+(?::(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test( value );
1473		},
1474
1475		// https://jqueryvalidation.org/date-method/
1476		date: ( function() {
1477			var called = false;
1478
1479			return function( value, element ) {
1480				if ( !called ) {
1481					called = true;
1482					if ( this.settings.debug && window.console ) {
1483						console.warn(
1484							"The `date` method is deprecated and will be removed in version '2.0.0'.\n" +
1485							"Please don't use it, since it relies on the Date constructor, which\n" +
1486							"behaves very differently across browsers and locales. Use `dateISO`\n" +
1487							"instead or one of the locale specific methods in `localizations/`\n" +
1488							"and `additional-methods.js`."
1489						);
1490					}
1491				}
1492
1493				return this.optional( element ) || !/Invalid|NaN/.test( new Date( value ).toString() );
1494			};
1495		}() ),
1496
1497		// https://jqueryvalidation.org/dateISO-method/
1498		dateISO: function( value, element ) {
1499			return this.optional( element ) || /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test( value );
1500		},
1501
1502		// https://jqueryvalidation.org/number-method/
1503		number: function( value, element ) {
1504			return this.optional( element ) || /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test( value );
1505		},
1506
1507		// https://jqueryvalidation.org/digits-method/
1508		digits: function( value, element ) {
1509			return this.optional( element ) || /^\d+$/.test( value );
1510		},
1511
1512		// https://jqueryvalidation.org/minlength-method/
1513		minlength: function( value, element, param ) {
1514			var length = Array.isArray( value ) ? value.length : this.getLength( value, element );
1515			return this.optional( element ) || length >= param;
1516		},
1517
1518		// https://jqueryvalidation.org/maxlength-method/
1519		maxlength: function( value, element, param ) {
1520			var length = Array.isArray( value ) ? value.length : this.getLength( value, element );
1521			return this.optional( element ) || length <= param;
1522		},
1523
1524		// https://jqueryvalidation.org/rangelength-method/
1525		rangelength: function( value, element, param ) {
1526			var length = Array.isArray( value ) ? value.length : this.getLength( value, element );
1527			return this.optional( element ) || ( length >= param[ 0 ] && length <= param[ 1 ] );
1528		},
1529
1530		// https://jqueryvalidation.org/min-method/
1531		min: function( value, element, param ) {
1532			return this.optional( element ) || value >= param;
1533		},
1534
1535		// https://jqueryvalidation.org/max-method/
1536		max: function( value, element, param ) {
1537			return this.optional( element ) || value <= param;
1538		},
1539
1540		// https://jqueryvalidation.org/range-method/
1541		range: function( value, element, param ) {
1542			return this.optional( element ) || ( value >= param[ 0 ] && value <= param[ 1 ] );
1543		},
1544
1545		// https://jqueryvalidation.org/step-method/
1546		step: function( value, element, param ) {
1547			var type = $( element ).attr( "type" ),
1548				errorMessage = "Step attribute on input type " + type + " is not supported.",
1549				supportedTypes = [ "text", "number", "range" ],
1550				re = new RegExp( "\\b" + type + "\\b" ),
1551				notSupported = type && !re.test( supportedTypes.join() ),
1552				decimalPlaces = function( num ) {
1553					var match = ( "" + num ).match( /(?:\.(\d+))?$/ );
1554					if ( !match ) {
1555						return 0;
1556					}
1557
1558					// Number of digits right of decimal point.
1559					return match[ 1 ] ? match[ 1 ].length : 0;
1560				},
1561				toInt = function( num ) {
1562					return Math.round( num * Math.pow( 10, decimals ) );
1563				},
1564				valid = true,
1565				decimals;
1566
1567			// Works only for text, number and range input types
1568			// TODO find a way to support input types date, datetime, datetime-local, month, time and week
1569			if ( notSupported ) {
1570				throw new Error( errorMessage );
1571			}
1572
1573			decimals = decimalPlaces( param );
1574
1575			// Value can't have too many decimals
1576			if ( decimalPlaces( value ) > decimals || toInt( value ) % toInt( param ) !== 0 ) {
1577				valid = false;
1578			}
1579
1580			return this.optional( element ) || valid;
1581		},
1582
1583		// https://jqueryvalidation.org/equalTo-method/
1584		equalTo: function( value, element, param ) {
1585
1586			// Bind to the blur event of the target in order to revalidate whenever the target field is updated
1587			var target = $( param );
1588			if ( this.settings.onfocusout && target.not( ".validate-equalTo-blur" ).length ) {
1589				target.addClass( "validate-equalTo-blur" ).on( "blur.validate-equalTo", function() {
1590					$( element ).valid();
1591				} );
1592			}
1593			return value === target.val();
1594		},
1595
1596		// https://jqueryvalidation.org/remote-method/
1597		remote: function( value, element, param, method ) {
1598			if ( this.optional( element ) ) {
1599				return "dependency-mismatch";
1600			}
1601
1602			method = typeof method === "string" && method || "remote";
1603
1604			var previous = this.previousValue( element, method ),
1605				validator, data, optionDataString;
1606
1607			if ( !this.settings.messages[ element.name ] ) {
1608				this.settings.messages[ element.name ] = {};
1609			}
1610			previous.originalMessage = previous.originalMessage || this.settings.messages[ element.name ][ method ];
1611			this.settings.messages[ element.name ][ method ] = previous.message;
1612
1613			param = typeof param === "string" && { url: param } || param;
1614			optionDataString = $.param( $.extend( { data: value }, param.data ) );
1615			if ( previous.old === optionDataString ) {
1616				return previous.valid;
1617			}
1618
1619			previous.old = optionDataString;
1620			validator = this;
1621			this.startRequest( element );
1622			data = {};
1623			data[ element.name ] = value;
1624			$.ajax( $.extend( true, {
1625				mode: "abort",
1626				port: this.elementAjaxPort( element ),
1627				dataType: "json",
1628				data: data,
1629				context: validator.currentForm,
1630				success: function( response ) {
1631					var valid = response === true || response === "true",
1632						errors, message, submitted;
1633
1634					validator.settings.messages[ element.name ][ method ] = previous.originalMessage;
1635					if ( valid ) {
1636						submitted = validator.formSubmitted;
1637						validator.toHide = validator.errorsFor( element );
1638						validator.formSubmitted = submitted;
1639						validator.successList.push( element );
1640						validator.invalid[ element.name ] = false;
1641						validator.showErrors();
1642					} else {
1643						errors = {};
1644						message = response || validator.defaultMessage( element, { method: method, parameters: value } );
1645						errors[ element.name ] = previous.message = message;
1646						validator.invalid[ element.name ] = true;
1647						validator.showErrors( errors );
1648					}
1649					previous.valid = valid;
1650					validator.stopRequest( element, valid );
1651				}
1652			}, param ) );
1653			return "pending";
1654		}
1655	}
1656
1657} );
1658
1659// Ajax mode: abort
1660// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]});
1661//        $.ajaxAbort( port );
1662// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort()
1663
1664var pendingRequests = {},
1665	ajax;
1666
1667// Use a prefilter if available (1.5+)
1668if ( $.ajaxPrefilter ) {
1669	$.ajaxPrefilter( function( settings, _, xhr ) {
1670		var port = settings.port;
1671		if ( settings.mode === "abort" ) {
1672			$.ajaxAbort( port );
1673			pendingRequests[ port ] = xhr;
1674		}
1675	} );
1676} else {
1677
1678	// Proxy ajax
1679	ajax = $.ajax;
1680	$.ajax = function( settings ) {
1681		var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode,
1682			port = ( "port" in settings ? settings : $.ajaxSettings ).port;
1683		if ( mode === "abort" ) {
1684			$.ajaxAbort( port );
1685			pendingRequests[ port ] = ajax.apply( this, arguments );
1686			return pendingRequests[ port ];
1687		}
1688		return ajax.apply( this, arguments );
1689	};
1690}
1691
1692// Abort the previous request without sending a new one
1693$.ajaxAbort = function( port ) {
1694	if ( pendingRequests[ port ] ) {
1695		pendingRequests[ port ].abort();
1696		delete pendingRequests[ port ];
1697	}
1698};
1699return $;
1700}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.