· 5 years ago · Oct 13, 2020, 08:54 PM
1/*!
2 * jQuery JavaScript Library v4.0.0-pre
3 * https://jquery.com/
4 *
5 * Copyright OpenJS Foundation and other contributors
6 * Released under the MIT license
7 * https://jquery.org/license
8 *
9 * Date: 2020-10-13T20:43Z
10 */
11( function( global, factory ) {
12
13 "use strict";
14
15 if ( typeof module === "object" && typeof module.exports === "object" ) {
16
17 // For CommonJS and CommonJS-like environments where a proper `window`
18 // is present, execute the factory and get jQuery.
19 // For environments that do not have a `window` with a `document`
20 // (such as Node.js), expose a factory as module.exports.
21 // This accentuates the need for the creation of a real `window`.
22 // e.g. var jQuery = require("jquery")(window);
23 // See ticket #14549 for more info.
24 module.exports = global.document ?
25 factory( global, true ) :
26 function( w ) {
27 if ( !w.document ) {
28 throw new Error( "jQuery requires a window with a document" );
29 }
30 return factory( w );
31 };
32 } else {
33 factory( global );
34 }
35
36// Pass this if window is not defined yet
37} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
38
39"use strict";
40
41var arr = [];
42
43var getProto = Object.getPrototypeOf;
44
45var slice = arr.slice;
46
47// Support: IE 11+
48// IE doesn't have Array#flat; provide a fallback.
49var flat = arr.flat ? function( array ) {
50 return arr.flat.call( array );
51} : function( array ) {
52 return arr.concat.apply( [], array );
53};
54
55var push = arr.push;
56
57var indexOf = arr.indexOf;
58
59// [[Class]] -> type pairs
60var class2type = {};
61
62var toString = class2type.toString;
63
64var hasOwn = class2type.hasOwnProperty;
65
66var fnToString = hasOwn.toString;
67
68var ObjectFunctionString = fnToString.call( Object );
69
70// All support tests are defined in their respective modules.
71var support = {};
72
73function isWindow( obj ) {
74 return obj != null && obj === obj.window;
75}
76
77var document = window.document;
78
79var preservedScriptAttributes = {
80 type: true,
81 src: true,
82 nonce: true,
83 noModule: true
84};
85
86function DOMEval( code, node, doc ) {
87 doc = doc || document;
88
89 var i,
90 script = doc.createElement( "script" );
91
92 script.text = code;
93 if ( node ) {
94 for ( i in preservedScriptAttributes ) {
95 if ( node[ i ] ) {
96 script[ i ] = node[ i ];
97 }
98 }
99 }
100 doc.head.appendChild( script ).parentNode.removeChild( script );
101}
102
103function toType( obj ) {
104 if ( obj == null ) {
105 return obj + "";
106 }
107
108 return typeof obj === "object" ?
109 class2type[ toString.call( obj ) ] || "object" :
110 typeof obj;
111}
112
113var version = "4.0.0-pre",
114
115 rhtmlSuffix = /HTML$/i,
116
117 // Define a local copy of jQuery
118 jQuery = function( selector, context ) {
119
120 // The jQuery object is actually just the init constructor 'enhanced'
121 // Need init if jQuery is called (just allow error to be thrown if not included)
122 return new jQuery.fn.init( selector, context );
123 };
124
125jQuery.fn = jQuery.prototype = {
126
127 // The current version of jQuery being used
128 jquery: version,
129
130 constructor: jQuery,
131
132 // The default length of a jQuery object is 0
133 length: 0,
134
135 toArray: function() {
136 return slice.call( this );
137 },
138
139 // Get the Nth element in the matched element set OR
140 // Get the whole matched element set as a clean array
141 get: function( num ) {
142
143 // Return all the elements in a clean array
144 if ( num == null ) {
145 return slice.call( this );
146 }
147
148 // Return just the one element from the set
149 return num < 0 ? this[ num + this.length ] : this[ num ];
150 },
151
152 // Take an array of elements and push it onto the stack
153 // (returning the new matched element set)
154 pushStack: function( elems ) {
155
156 // Build a new jQuery matched element set
157 var ret = jQuery.merge( this.constructor(), elems );
158
159 // Add the old object onto the stack (as a reference)
160 ret.prevObject = this;
161
162 // Return the newly-formed element set
163 return ret;
164 },
165
166 // Execute a callback for every element in the matched set.
167 each: function( callback ) {
168 return jQuery.each( this, callback );
169 },
170
171 map: function( callback ) {
172 return this.pushStack( jQuery.map( this, function( elem, i ) {
173 return callback.call( elem, i, elem );
174 } ) );
175 },
176
177 slice: function() {
178 return this.pushStack( slice.apply( this, arguments ) );
179 },
180
181 first: function() {
182 return this.eq( 0 );
183 },
184
185 last: function() {
186 return this.eq( -1 );
187 },
188
189 even: function() {
190 return this.pushStack( jQuery.grep( this, function( _elem, i ) {
191 return ( i + 1 ) % 2;
192 } ) );
193 },
194
195 odd: function() {
196 return this.pushStack( jQuery.grep( this, function( _elem, i ) {
197 return i % 2;
198 } ) );
199 },
200
201 eq: function( i ) {
202 var len = this.length,
203 j = +i + ( i < 0 ? len : 0 );
204 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
205 },
206
207 end: function() {
208 return this.prevObject || this.constructor();
209 }
210};
211
212jQuery.extend = jQuery.fn.extend = function() {
213 var options, name, src, copy, copyIsArray, clone,
214 target = arguments[ 0 ] || {},
215 i = 1,
216 length = arguments.length,
217 deep = false;
218
219 // Handle a deep copy situation
220 if ( typeof target === "boolean" ) {
221 deep = target;
222
223 // Skip the boolean and the target
224 target = arguments[ i ] || {};
225 i++;
226 }
227
228 // Handle case when target is a string or something (possible in deep copy)
229 if ( typeof target !== "object" && typeof target !== "function" ) {
230 target = {};
231 }
232
233 // Extend jQuery itself if only one argument is passed
234 if ( i === length ) {
235 target = this;
236 i--;
237 }
238
239 for ( ; i < length; i++ ) {
240
241 // Only deal with non-null/undefined values
242 if ( ( options = arguments[ i ] ) != null ) {
243
244 // Extend the base object
245 for ( name in options ) {
246 copy = options[ name ];
247
248 // Prevent Object.prototype pollution
249 // Prevent never-ending loop
250 if ( name === "__proto__" || target === copy ) {
251 continue;
252 }
253
254 // Recurse if we're merging plain objects or arrays
255 if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
256 ( copyIsArray = Array.isArray( copy ) ) ) ) {
257 src = target[ name ];
258
259 // Ensure proper type for the source value
260 if ( copyIsArray && !Array.isArray( src ) ) {
261 clone = [];
262 } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
263 clone = {};
264 } else {
265 clone = src;
266 }
267 copyIsArray = false;
268
269 // Never move original objects, clone them
270 target[ name ] = jQuery.extend( deep, clone, copy );
271
272 // Don't bring in undefined values
273 } else if ( copy !== undefined ) {
274 target[ name ] = copy;
275 }
276 }
277 }
278 }
279
280 // Return the modified object
281 return target;
282};
283
284jQuery.extend( {
285
286 // Unique for each copy of jQuery on the page
287 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
288
289 // Assume jQuery is ready without the ready module
290 isReady: true,
291
292 error: function( msg ) {
293 throw new Error( msg );
294 },
295
296 noop: function() {},
297
298 isPlainObject: function( obj ) {
299 var proto, Ctor;
300
301 // Detect obvious negatives
302 // Use toString instead of jQuery.type to catch host objects
303 if ( !obj || toString.call( obj ) !== "[object Object]" ) {
304 return false;
305 }
306
307 proto = getProto( obj );
308
309 // Objects with no prototype (e.g., `Object.create( null )`) are plain
310 if ( !proto ) {
311 return true;
312 }
313
314 // Objects with prototype are plain iff they were constructed by a global Object function
315 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
316 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
317 },
318
319 isEmptyObject: function( obj ) {
320 var name;
321
322 for ( name in obj ) {
323 return false;
324 }
325 return true;
326 },
327
328 // Evaluates a script in a provided context; falls back to the global one
329 // if not specified.
330 globalEval: function( code, options, doc ) {
331 DOMEval( code, { nonce: options && options.nonce }, doc );
332 },
333
334 each: function( obj, callback ) {
335 var length, i = 0;
336
337 if ( isArrayLike( obj ) ) {
338 length = obj.length;
339 for ( ; i < length; i++ ) {
340 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
341 break;
342 }
343 }
344 } else {
345 for ( i in obj ) {
346 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
347 break;
348 }
349 }
350 }
351
352 return obj;
353 },
354
355
356 // Retrieve the text value of an array of DOM nodes
357 text: function( elem ) {
358 var node,
359 ret = "",
360 i = 0,
361 nodeType = elem.nodeType;
362
363 if ( !nodeType ) {
364
365 // If no nodeType, this is expected to be an array
366 while ( ( node = elem[ i++ ] ) ) {
367
368 // Do not traverse comment nodes
369 ret += jQuery.text( node );
370 }
371 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
372 return elem.textContent;
373 } else if ( nodeType === 3 || nodeType === 4 ) {
374 return elem.nodeValue;
375 }
376
377 // Do not include comment or processing instruction nodes
378
379 return ret;
380 },
381
382
383 // results is for internal usage only
384 makeArray: function( arr, results ) {
385 var ret = results || [];
386
387 if ( arr != null ) {
388 if ( isArrayLike( Object( arr ) ) ) {
389 jQuery.merge( ret,
390 typeof arr === "string" ?
391 [ arr ] : arr
392 );
393 } else {
394 push.call( ret, arr );
395 }
396 }
397
398 return ret;
399 },
400
401 inArray: function( elem, arr, i ) {
402 return arr == null ? -1 : indexOf.call( arr, elem, i );
403 },
404
405 isXMLDoc: function( elem ) {
406 var namespace = elem.namespaceURI,
407 docElem = ( elem.ownerDocument || elem ).documentElement;
408
409 // Assume HTML when documentElement doesn't yet exist, such as inside
410 // document fragments.
411 return !rhtmlSuffix.test( namespace || docElem && docElem.nodeName || "HTML" );
412 },
413
414 merge: function( first, second ) {
415 var len = +second.length,
416 j = 0,
417 i = first.length;
418
419 for ( ; j < len; j++ ) {
420 first[ i++ ] = second[ j ];
421 }
422
423 first.length = i;
424
425 return first;
426 },
427
428 grep: function( elems, callback, invert ) {
429 var callbackInverse,
430 matches = [],
431 i = 0,
432 length = elems.length,
433 callbackExpect = !invert;
434
435 // Go through the array, only saving the items
436 // that pass the validator function
437 for ( ; i < length; i++ ) {
438 callbackInverse = !callback( elems[ i ], i );
439 if ( callbackInverse !== callbackExpect ) {
440 matches.push( elems[ i ] );
441 }
442 }
443
444 return matches;
445 },
446
447 // arg is for internal usage only
448 map: function( elems, callback, arg ) {
449 var length, value,
450 i = 0,
451 ret = [];
452
453 // Go through the array, translating each of the items to their new values
454 if ( isArrayLike( elems ) ) {
455 length = elems.length;
456 for ( ; i < length; i++ ) {
457 value = callback( elems[ i ], i, arg );
458
459 if ( value != null ) {
460 ret.push( value );
461 }
462 }
463
464 // Go through every key on the object,
465 } else {
466 for ( i in elems ) {
467 value = callback( elems[ i ], i, arg );
468
469 if ( value != null ) {
470 ret.push( value );
471 }
472 }
473 }
474
475 // Flatten any nested arrays
476 return flat( ret );
477 },
478
479 // A global GUID counter for objects
480 guid: 1,
481
482 // jQuery.support is not used in Core but other projects attach their
483 // properties to it so it needs to exist.
484 support: support
485} );
486
487if ( typeof Symbol === "function" ) {
488 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
489}
490
491// Populate the class2type map
492jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
493 function( _i, name ) {
494 class2type[ "[object " + name + "]" ] = name.toLowerCase();
495 } );
496
497function isArrayLike( obj ) {
498
499 var length = !!obj && obj.length,
500 type = toType( obj );
501
502 if ( typeof obj === "function" || isWindow( obj ) ) {
503 return false;
504 }
505
506 return type === "array" || length === 0 ||
507 typeof length === "number" && length > 0 && ( length - 1 ) in obj;
508}
509
510function nodeName( elem, name ) {
511
512 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
513
514}
515
516var documentElement = document.documentElement;
517
518var pop = arr.pop;
519
520// https://www.w3.org/TR/css3-selectors/#whitespace
521var whitespace = "[\\x20\\t\\r\\n\\f]";
522
523var isIE = document.documentMode;
524
525var rbuggyQSA = isIE && new RegExp(
526
527 // Support: IE 9 - 11+
528 // IE's :disabled selector does not pick up the children of disabled fieldsets
529 ":enabled|:disabled|" +
530
531 // Support: IE 11+
532 // IE 11 doesn't find elements on a `[name='']` query in some cases.
533 // Adding a temporary attribute to the document before the selection works
534 // around the issue.
535 "\\[" + whitespace + "*name" + whitespace + "*=" +
536 whitespace + "*(?:''|\"\")"
537
538);
539
540// Note: an element does not contain itself
541jQuery.contains = function( a, b ) {
542 var adown = a.nodeType === 9 ? a.documentElement : a,
543 bup = b && b.parentNode;
544
545 return a === bup || !!( bup && bup.nodeType === 1 && (
546
547 // Support: IE 9 - 11+
548 // IE doesn't have `contains` on SVG.
549 adown.contains ?
550 adown.contains( bup ) :
551 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
552 ) );
553};
554
555// CSS string/identifier serialization
556// https://drafts.csswg.org/cssom/#common-serializing-idioms
557var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
558
559function fcssescape( ch, asCodePoint ) {
560 if ( asCodePoint ) {
561
562 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
563 if ( ch === "\0" ) {
564 return "\uFFFD";
565 }
566
567 // Control characters and (dependent upon position) numbers get escaped as code points
568 return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
569 }
570
571 // Other potentially-special ASCII characters get backslash-escaped
572 return "\\" + ch;
573}
574
575jQuery.escapeSelector = function( sel ) {
576 return ( sel + "" ).replace( rcssescape, fcssescape );
577};
578
579var sort = arr.sort;
580
581var hasDuplicate;
582
583// Document order sorting
584function sortOrder( a, b ) {
585
586 // Flag for duplicate removal
587 if ( a === b ) {
588 hasDuplicate = true;
589 return 0;
590 }
591
592 // Sort on method existence if only one input has compareDocumentPosition
593 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
594 if ( compare ) {
595 return compare;
596 }
597
598 // Calculate position if both inputs belong to the same document
599 // Support: IE 11+
600 // IE sometimes throws a "Permission denied" error when strict-comparing
601 // two documents; shallow comparisons work.
602 // eslint-disable-next-line eqeqeq
603 compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ?
604 a.compareDocumentPosition( b ) :
605
606 // Otherwise we know they are disconnected
607 1;
608
609 // Disconnected nodes
610 if ( compare & 1 ) {
611
612 // Choose the first element that is related to the document
613 // Support: IE 11+
614 // IE sometimes throws a "Permission denied" error when strict-comparing
615 // two documents; shallow comparisons work.
616 // eslint-disable-next-line eqeqeq
617 if ( a == document || a.ownerDocument == document &&
618 jQuery.contains( document, a ) ) {
619 return -1;
620 }
621
622 // Support: IE 11+
623 // IE sometimes throws a "Permission denied" error when strict-comparing
624 // two documents; shallow comparisons work.
625 // eslint-disable-next-line eqeqeq
626 if ( b == document || b.ownerDocument == document &&
627 jQuery.contains( document, b ) ) {
628 return 1;
629 }
630
631 // Maintain original order
632 return 0;
633 }
634
635 return compare & 4 ? -1 : 1;
636}
637
638/**
639 * Document sorting and removing duplicates
640 * @param {ArrayLike} results
641 */
642jQuery.uniqueSort = function( results ) {
643 var elem,
644 duplicates = [],
645 j = 0,
646 i = 0;
647
648 hasDuplicate = false;
649
650 sort.call( results, sortOrder );
651
652 if ( hasDuplicate ) {
653 while ( ( elem = results[ i++ ] ) ) {
654 if ( elem === results[ i ] ) {
655 j = duplicates.push( i );
656 }
657 }
658 while ( j-- ) {
659 results.splice( duplicates[ j ], 1 );
660 }
661 }
662
663 return results;
664};
665
666var preferredDoc = document,
667 matches = documentElement.matches || documentElement.msMatchesSelector;
668
669( function() {
670
671var i,
672 Expr,
673 outermostContext,
674
675 // Local document vars
676 document,
677 documentElement,
678 documentIsHTML,
679
680 // Instance-specific data
681 expando = jQuery.expando,
682 dirruns = 0,
683 done = 0,
684 classCache = createCache(),
685 tokenCache = createCache(),
686 compilerCache = createCache(),
687 nonnativeSelectorCache = createCache(),
688
689 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" +
690 "loop|multiple|open|readonly|required|scoped",
691
692 // Regular expressions
693
694 // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
695 identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace +
696 "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",
697
698 // Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors
699 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
700
701 // Operator (capture 2)
702 "*([*^$|!~]?=)" + whitespace +
703
704 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
705 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" +
706 whitespace + "*\\]",
707
708 pseudos = ":(" + identifier + ")(?:\\((" +
709
710 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
711 // 1. quoted (capture 3; capture 4 or capture 5)
712 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
713
714 // 2. simple (capture 6)
715 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
716
717 // 3. anything else (capture 2)
718 ".*" +
719 ")\\)|)",
720
721 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
722 rwhitespace = new RegExp( whitespace + "+", "g" ),
723 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
724
725 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
726 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" +
727 whitespace + "*" ),
728 rdescend = new RegExp( whitespace + "|>" ),
729
730 rpseudo = new RegExp( pseudos ),
731 ridentifier = new RegExp( "^" + identifier + "$" ),
732
733 matchExpr = {
734 ID: new RegExp( "^#(" + identifier + ")" ),
735 CLASS: new RegExp( "^\\.(" + identifier + ")" ),
736 TAG: new RegExp( "^(" + identifier + "|[*])" ),
737 ATTR: new RegExp( "^" + attributes ),
738 PSEUDO: new RegExp( "^" + pseudos ),
739 CHILD: new RegExp(
740 "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" +
741 whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" +
742 whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
743 bool: new RegExp( "^(?:" + booleans + ")$", "i" ),
744
745 // For use in libraries implementing .is()
746 // We use this for POS matching in `select`
747 needsContext: new RegExp( "^" + whitespace +
748 "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
749 "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
750 },
751
752 rinputs = /^(?:input|select|textarea|button)$/i,
753 rheader = /^h\d$/i,
754
755 // Easily-parseable/retrievable ID or TAG or CLASS selectors
756 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
757
758 rsibling = /[+~]/,
759
760 // CSS escapes
761 // https://www.w3.org/TR/CSS21/syndata.html#escaped-characters
762 runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace +
763 "?|\\\\([^\\r\\n\\f])", "g" ),
764 funescape = function( escape, nonHex ) {
765 var high = "0x" + escape.slice( 1 ) - 0x10000;
766
767 if ( nonHex ) {
768
769 // Strip the backslash prefix from a non-hex escape sequence
770 return nonHex;
771 }
772
773 // Replace a hexadecimal escape sequence with the encoded Unicode code point
774 // Support: IE <=11+
775 // For values outside the Basic Multilingual Plane (BMP), manually construct a
776 // surrogate pair
777 return high < 0 ?
778 String.fromCharCode( high + 0x10000 ) :
779 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
780 },
781
782 // Used for iframes; see `setDocument`.
783 // Support: IE 9 - 11+
784 // Removing the function wrapper causes a "Permission Denied"
785 // error in IE.
786 unloadHandler = function() {
787 setDocument();
788 },
789
790 inDisabledFieldset = addCombinator(
791 function( elem ) {
792 return elem.disabled === true && nodeName( elem, "fieldset" );
793 },
794 { dir: "parentNode", next: "legend" }
795 );
796
797function selectorError( msg ) {
798 throw new Error( "Syntax error, unrecognized expression: " + msg );
799}
800
801function find( selector, context, results, seed ) {
802 var m, i, elem, nid, match, groups, newSelector,
803 newContext = context && context.ownerDocument,
804
805 // nodeType defaults to 9, since context defaults to document
806 nodeType = context ? context.nodeType : 9;
807
808 results = results || [];
809
810 // Return early from calls with invalid selector or context
811 if ( typeof selector !== "string" || !selector ||
812 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
813
814 return results;
815 }
816
817 // Try to shortcut find operations (as opposed to filters) in HTML documents
818 if ( !seed ) {
819 setDocument( context );
820 context = context || document;
821
822 if ( documentIsHTML ) {
823
824 // If the selector is sufficiently simple, try using a "get*By*" DOM method
825 // (excepting DocumentFragment context, where the methods don't exist)
826 if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) {
827
828 // ID selector
829 if ( ( m = match[ 1 ] ) ) {
830
831 // Document context
832 if ( nodeType === 9 ) {
833 if ( ( elem = context.getElementById( m ) ) ) {
834 push.call( results, elem );
835 }
836 return results;
837
838 // Element context
839 } else {
840 if ( newContext && ( elem = newContext.getElementById( m ) ) &&
841 jQuery.contains( context, elem ) ) {
842
843 push.call( results, elem );
844 return results;
845 }
846 }
847
848 // Type selector
849 } else if ( match[ 2 ] ) {
850 push.apply( results, context.getElementsByTagName( selector ) );
851 return results;
852
853 // Class selector
854 } else if ( ( m = match[ 3 ] ) && context.getElementsByClassName ) {
855 push.apply( results, context.getElementsByClassName( m ) );
856 return results;
857 }
858 }
859
860 // Take advantage of querySelectorAll
861 if ( !nonnativeSelectorCache[ selector + " " ] &&
862 ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) ) {
863
864 newSelector = selector;
865 newContext = context;
866
867 // qSA considers elements outside a scoping root when evaluating child or
868 // descendant combinators, which is not what we want.
869 // In such cases, we work around the behavior by prefixing every selector in the
870 // list with an ID selector referencing the scope context.
871 // The technique has to be used as well when a leading combinator is used
872 // as such selectors are not recognized by querySelectorAll.
873 // Thanks to Andrew Dupont for this technique.
874 if ( nodeType === 1 &&
875 ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) {
876
877 // Expand context for sibling selectors
878 newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
879 context;
880
881 // Outside of IE, if we're not changing the context we can
882 // use :scope instead of an ID.
883 if ( newContext !== context || isIE ) {
884
885 // Capture the context ID, setting it first if necessary
886 if ( ( nid = context.getAttribute( "id" ) ) ) {
887 nid = jQuery.escapeSelector( nid );
888 } else {
889 context.setAttribute( "id", ( nid = expando ) );
890 }
891 }
892
893 // Prefix every selector in the list
894 groups = tokenize( selector );
895 i = groups.length;
896 while ( i-- ) {
897 groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " +
898 toSelector( groups[ i ] );
899 }
900 newSelector = groups.join( "," );
901 }
902
903 try {
904 push.apply( results,
905 newContext.querySelectorAll( newSelector )
906 );
907 return results;
908 } catch ( qsaError ) {
909 nonnativeSelectorCache( selector, true );
910 } finally {
911 if ( nid === expando ) {
912 context.removeAttribute( "id" );
913 }
914 }
915 }
916 }
917 }
918
919 // All others
920 return select( selector.replace( rtrim, "$1" ), context, results, seed );
921}
922
923/**
924 * Create key-value caches of limited size
925 * @returns {function(string, object)} Returns the Object data after storing it on itself with
926 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
927 * deleting the oldest entry
928 */
929function createCache() {
930 var keys = [];
931
932 function cache( key, value ) {
933
934 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
935 if ( keys.push( key + " " ) > Expr.cacheLength ) {
936
937 // Only keep the most recent entries
938 delete cache[ keys.shift() ];
939 }
940 return ( cache[ key + " " ] = value );
941 }
942 return cache;
943}
944
945/**
946 * Mark a function for special use by jQuery selector module
947 * @param {Function} fn The function to mark
948 */
949function markFunction( fn ) {
950 fn[ expando ] = true;
951 return fn;
952}
953
954/**
955 * Returns a function to use in pseudos for input types
956 * @param {String} type
957 */
958function createInputPseudo( type ) {
959 return function( elem ) {
960 return nodeName( elem, "input" ) && elem.type === type;
961 };
962}
963
964/**
965 * Returns a function to use in pseudos for buttons
966 * @param {String} type
967 */
968function createButtonPseudo( type ) {
969 return function( elem ) {
970 return ( nodeName( elem, "input" ) || nodeName( elem, "button" ) ) &&
971 elem.type === type;
972 };
973}
974
975/**
976 * Returns a function to use in pseudos for :enabled/:disabled
977 * @param {Boolean} disabled true for :disabled; false for :enabled
978 */
979function createDisabledPseudo( disabled ) {
980
981 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
982 return function( elem ) {
983
984 // Only certain elements can match :enabled or :disabled
985 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
986 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
987 if ( "form" in elem ) {
988
989 // Check for inherited disabledness on relevant non-disabled elements:
990 // * listed form-associated elements in a disabled fieldset
991 // https://html.spec.whatwg.org/multipage/forms.html#category-listed
992 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
993 // * option elements in a disabled optgroup
994 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
995 // All such elements have a "form" property.
996 if ( elem.parentNode && elem.disabled === false ) {
997
998 // Option elements defer to a parent optgroup if present
999 if ( "label" in elem ) {
1000 if ( "label" in elem.parentNode ) {
1001 return elem.parentNode.disabled === disabled;
1002 } else {
1003 return elem.disabled === disabled;
1004 }
1005 }
1006
1007 // Support: IE 6 - 11+
1008 // Use the isDisabled shortcut property to check for disabled fieldset ancestors
1009 return elem.isDisabled === disabled ||
1010
1011 // Where there is no isDisabled, check manually
1012 elem.isDisabled !== !disabled &&
1013 inDisabledFieldset( elem ) === disabled;
1014 }
1015
1016 return elem.disabled === disabled;
1017
1018 // Try to winnow out elements that can't be disabled before trusting the disabled property.
1019 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
1020 // even exist on them, let alone have a boolean value.
1021 } else if ( "label" in elem ) {
1022 return elem.disabled === disabled;
1023 }
1024
1025 // Remaining elements are neither :enabled nor :disabled
1026 return false;
1027 };
1028}
1029
1030/**
1031 * Returns a function to use in pseudos for positionals
1032 * @param {Function} fn
1033 */
1034function createPositionalPseudo( fn ) {
1035 return markFunction( function( argument ) {
1036 argument = +argument;
1037 return markFunction( function( seed, matches ) {
1038 var j,
1039 matchIndexes = fn( [], seed.length, argument ),
1040 i = matchIndexes.length;
1041
1042 // Match elements found at the specified indexes
1043 while ( i-- ) {
1044 if ( seed[ ( j = matchIndexes[ i ] ) ] ) {
1045 seed[ j ] = !( matches[ j ] = seed[ j ] );
1046 }
1047 }
1048 } );
1049 } );
1050}
1051
1052/**
1053 * Checks a node for validity as a jQuery selector context
1054 * @param {Element|Object=} context
1055 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
1056 */
1057function testContext( context ) {
1058 return context && typeof context.getElementsByTagName !== "undefined" && context;
1059}
1060
1061/**
1062 * Sets document-related variables once based on the current document
1063 * @param {Element|Object} [node] An element or document object to use to set the document
1064 */
1065function setDocument( node ) {
1066 var subWindow,
1067 doc = node ? node.ownerDocument || node : preferredDoc;
1068
1069 // Return early if doc is invalid or already selected
1070 // Support: IE 11+
1071 // IE sometimes throws a "Permission denied" error when strict-comparing
1072 // two documents; shallow comparisons work.
1073 // eslint-disable-next-line eqeqeq
1074 if ( doc == document || doc.nodeType !== 9 ) {
1075 return;
1076 }
1077
1078 // Update global variables
1079 document = doc;
1080 documentElement = document.documentElement;
1081 documentIsHTML = !jQuery.isXMLDoc( document );
1082
1083 // Support: IE 9 - 11+
1084 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
1085 // Support: IE 11+
1086 // IE sometimes throws a "Permission denied" error when strict-comparing
1087 // two documents; shallow comparisons work.
1088 // eslint-disable-next-line eqeqeq
1089 if ( isIE && preferredDoc != document &&
1090 ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {
1091 subWindow.addEventListener( "unload", unloadHandler );
1092 }
1093}
1094
1095find.matches = function( expr, elements ) {
1096 return find( expr, null, null, elements );
1097};
1098
1099find.matchesSelector = function( elem, expr ) {
1100 setDocument( elem );
1101
1102 if ( documentIsHTML &&
1103 !nonnativeSelectorCache[ expr + " " ] &&
1104 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
1105
1106 try {
1107 return matches.call( elem, expr );
1108 } catch ( e ) {
1109 nonnativeSelectorCache( expr, true );
1110 }
1111 }
1112
1113 return find( expr, document, null, [ elem ] ).length > 0;
1114};
1115
1116Expr = jQuery.expr = {
1117
1118 // Can be adjusted by the user
1119 cacheLength: 50,
1120
1121 createPseudo: markFunction,
1122
1123 match: matchExpr,
1124
1125 find: {
1126 ID: function( id, context ) {
1127 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1128 var elem = context.getElementById( id );
1129 return elem ? [ elem ] : [];
1130 }
1131 },
1132
1133 TAG: function( tag, context ) {
1134 if ( typeof context.getElementsByTagName !== "undefined" ) {
1135 return context.getElementsByTagName( tag );
1136
1137 // DocumentFragment nodes don't have gEBTN
1138 } else {
1139 return context.querySelectorAll( tag );
1140 }
1141 },
1142
1143 CLASS: function( className, context ) {
1144 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
1145 return context.getElementsByClassName( className );
1146 }
1147 }
1148 },
1149
1150 relative: {
1151 ">": { dir: "parentNode", first: true },
1152 " ": { dir: "parentNode" },
1153 "+": { dir: "previousSibling", first: true },
1154 "~": { dir: "previousSibling" }
1155 },
1156
1157 preFilter: {
1158 ATTR: function( match ) {
1159 match[ 1 ] = match[ 1 ].replace( runescape, funescape );
1160
1161 // Move the given value to match[3] whether quoted or unquoted
1162 match[ 3 ] = ( match[ 3 ] || match[ 4 ] || match[ 5 ] || "" )
1163 .replace( runescape, funescape );
1164
1165 if ( match[ 2 ] === "~=" ) {
1166 match[ 3 ] = " " + match[ 3 ] + " ";
1167 }
1168
1169 return match.slice( 0, 4 );
1170 },
1171
1172 CHILD: function( match ) {
1173
1174 /* matches from matchExpr["CHILD"]
1175 1 type (only|nth|...)
1176 2 what (child|of-type)
1177 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
1178 4 xn-component of xn+y argument ([+-]?\d*n|)
1179 5 sign of xn-component
1180 6 x of xn-component
1181 7 sign of y-component
1182 8 y of y-component
1183 */
1184 match[ 1 ] = match[ 1 ].toLowerCase();
1185
1186 if ( match[ 1 ].slice( 0, 3 ) === "nth" ) {
1187
1188 // nth-* requires argument
1189 if ( !match[ 3 ] ) {
1190 selectorError( match[ 0 ] );
1191 }
1192
1193 // numeric x and y parameters for Expr.filter.CHILD
1194 // remember that false/true cast respectively to 0/1
1195 match[ 4 ] = +( match[ 4 ] ?
1196 match[ 5 ] + ( match[ 6 ] || 1 ) :
1197 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" )
1198 );
1199 match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" );
1200
1201 // other types prohibit arguments
1202 } else if ( match[ 3 ] ) {
1203 selectorError( match[ 0 ] );
1204 }
1205
1206 return match;
1207 },
1208
1209 PSEUDO: function( match ) {
1210 var excess,
1211 unquoted = !match[ 6 ] && match[ 2 ];
1212
1213 if ( matchExpr.CHILD.test( match[ 0 ] ) ) {
1214 return null;
1215 }
1216
1217 // Accept quoted arguments as-is
1218 if ( match[ 3 ] ) {
1219 match[ 2 ] = match[ 4 ] || match[ 5 ] || "";
1220
1221 // Strip excess characters from unquoted arguments
1222 } else if ( unquoted && rpseudo.test( unquoted ) &&
1223
1224 // Get excess from tokenize (recursively)
1225 ( excess = tokenize( unquoted, true ) ) &&
1226
1227 // advance to the next closing parenthesis
1228 ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) {
1229
1230 // excess is a negative index
1231 match[ 0 ] = match[ 0 ].slice( 0, excess );
1232 match[ 2 ] = unquoted.slice( 0, excess );
1233 }
1234
1235 // Return only captures needed by the pseudo filter method (type and argument)
1236 return match.slice( 0, 3 );
1237 }
1238 },
1239
1240 filter: {
1241 ID: function( id ) {
1242 var attrId = id.replace( runescape, funescape );
1243 return function( elem ) {
1244 return elem.getAttribute( "id" ) === attrId;
1245 };
1246 },
1247
1248 TAG: function( nodeNameSelector ) {
1249 var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1250 return nodeNameSelector === "*" ?
1251
1252 function() {
1253 return true;
1254 } :
1255
1256 function( elem ) {
1257 return nodeName( elem, expectedNodeName );
1258 };
1259 },
1260
1261 CLASS: function( className ) {
1262 var pattern = classCache[ className + " " ];
1263
1264 return pattern ||
1265 ( pattern = new RegExp( "(^|" + whitespace + ")" + className +
1266 "(" + whitespace + "|$)" ) ) &&
1267 classCache( className, function( elem ) {
1268 return pattern.test(
1269 typeof elem.className === "string" && elem.className ||
1270 typeof elem.getAttribute !== "undefined" &&
1271 elem.getAttribute( "class" ) ||
1272 ""
1273 );
1274 } );
1275 },
1276
1277 ATTR: function( name, operator, check ) {
1278 return function( elem ) {
1279 var result = jQuery.attr( elem, name );
1280
1281 if ( result == null ) {
1282 return operator === "!=";
1283 }
1284 if ( !operator ) {
1285 return true;
1286 }
1287
1288 result += "";
1289
1290 if ( operator === "=" ) {
1291 return result === check;
1292 }
1293 if ( operator === "!=" ) {
1294 return result !== check;
1295 }
1296 if ( operator === "^=" ) {
1297 return check && result.indexOf( check ) === 0;
1298 }
1299 if ( operator === "*=" ) {
1300 return check && result.indexOf( check ) > -1;
1301 }
1302 if ( operator === "$=" ) {
1303 return check && result.slice( -check.length ) === check;
1304 }
1305 if ( operator === "~=" ) {
1306 return ( " " + result.replace( rwhitespace, " " ) + " " )
1307 .indexOf( check ) > -1;
1308 }
1309 if ( operator === "|=" ) {
1310 return result === check || result.slice( 0, check.length + 1 ) === check + "-";
1311 }
1312
1313 return false;
1314 };
1315 },
1316
1317 CHILD: function( type, what, _argument, first, last ) {
1318 var simple = type.slice( 0, 3 ) !== "nth",
1319 forward = type.slice( -4 ) !== "last",
1320 ofType = what === "of-type";
1321
1322 return first === 1 && last === 0 ?
1323
1324 // Shortcut for :nth-*(n)
1325 function( elem ) {
1326 return !!elem.parentNode;
1327 } :
1328
1329 function( elem, _context, xml ) {
1330 var cache, outerCache, node, nodeIndex, start,
1331 dir = simple !== forward ? "nextSibling" : "previousSibling",
1332 parent = elem.parentNode,
1333 name = ofType && elem.nodeName.toLowerCase(),
1334 useCache = !xml && !ofType,
1335 diff = false;
1336
1337 if ( parent ) {
1338
1339 // :(first|last|only)-(child|of-type)
1340 if ( simple ) {
1341 while ( dir ) {
1342 node = elem;
1343 while ( ( node = node[ dir ] ) ) {
1344 if ( ofType ?
1345 nodeName( node, name ) :
1346 node.nodeType === 1 ) {
1347
1348 return false;
1349 }
1350 }
1351
1352 // Reverse direction for :only-* (if we haven't yet done so)
1353 start = dir = type === "only" && !start && "nextSibling";
1354 }
1355 return true;
1356 }
1357
1358 start = [ forward ? parent.firstChild : parent.lastChild ];
1359
1360 // non-xml :nth-child(...) stores cache data on `parent`
1361 if ( forward && useCache ) {
1362
1363 // Seek `elem` from a previously-cached index
1364 outerCache = parent[ expando ] || ( parent[ expando ] = {} );
1365 cache = outerCache[ type ] || [];
1366 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1367 diff = nodeIndex && cache[ 2 ];
1368 node = nodeIndex && parent.childNodes[ nodeIndex ];
1369
1370 while ( ( node = ++nodeIndex && node && node[ dir ] ||
1371
1372 // Fallback to seeking `elem` from the start
1373 ( diff = nodeIndex = 0 ) || start.pop() ) ) {
1374
1375 // When found, cache indexes on `parent` and break
1376 if ( node.nodeType === 1 && ++diff && node === elem ) {
1377 outerCache[ type ] = [ dirruns, nodeIndex, diff ];
1378 break;
1379 }
1380 }
1381
1382 } else {
1383
1384 // Use previously-cached element index if available
1385 if ( useCache ) {
1386 outerCache = elem[ expando ] || ( elem[ expando ] = {} );
1387 cache = outerCache[ type ] || [];
1388 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1389 diff = nodeIndex;
1390 }
1391
1392 // xml :nth-child(...)
1393 // or :nth-last-child(...) or :nth(-last)?-of-type(...)
1394 if ( diff === false ) {
1395
1396 // Use the same loop as above to seek `elem` from the start
1397 while ( ( node = ++nodeIndex && node && node[ dir ] ||
1398 ( diff = nodeIndex = 0 ) || start.pop() ) ) {
1399
1400 if ( ( ofType ?
1401 nodeName( node, name ) :
1402 node.nodeType === 1 ) &&
1403 ++diff ) {
1404
1405 // Cache the index of each encountered element
1406 if ( useCache ) {
1407 outerCache = node[ expando ] ||
1408 ( node[ expando ] = {} );
1409 outerCache[ type ] = [ dirruns, diff ];
1410 }
1411
1412 if ( node === elem ) {
1413 break;
1414 }
1415 }
1416 }
1417 }
1418 }
1419
1420 // Incorporate the offset, then check against cycle size
1421 diff -= last;
1422 return diff === first || ( diff % first === 0 && diff / first >= 0 );
1423 }
1424 };
1425 },
1426
1427 PSEUDO: function( pseudo, argument ) {
1428
1429 // pseudo-class names are case-insensitive
1430 // https://www.w3.org/TR/selectors/#pseudo-classes
1431 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
1432 // Remember that setFilters inherits from pseudos
1433 var args,
1434 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
1435 selectorError( "unsupported pseudo: " + pseudo );
1436
1437 // The user may use createPseudo to indicate that
1438 // arguments are needed to create the filter function
1439 // just as jQuery does
1440 if ( fn[ expando ] ) {
1441 return fn( argument );
1442 }
1443
1444 // But maintain support for old signatures
1445 if ( fn.length > 1 ) {
1446 args = [ pseudo, pseudo, "", argument ];
1447 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
1448 markFunction( function( seed, matches ) {
1449 var idx,
1450 matched = fn( seed, argument ),
1451 i = matched.length;
1452 while ( i-- ) {
1453 idx = indexOf.call( seed, matched[ i ] );
1454 seed[ idx ] = !( matches[ idx ] = matched[ i ] );
1455 }
1456 } ) :
1457 function( elem ) {
1458 return fn( elem, 0, args );
1459 };
1460 }
1461
1462 return fn;
1463 }
1464 },
1465
1466 pseudos: {
1467
1468 // Potentially complex pseudos
1469 not: markFunction( function( selector ) {
1470
1471 // Trim the selector passed to compile
1472 // to avoid treating leading and trailing
1473 // spaces as combinators
1474 var input = [],
1475 results = [],
1476 matcher = compile( selector.replace( rtrim, "$1" ) );
1477
1478 return matcher[ expando ] ?
1479 markFunction( function( seed, matches, _context, xml ) {
1480 var elem,
1481 unmatched = matcher( seed, null, xml, [] ),
1482 i = seed.length;
1483
1484 // Match elements unmatched by `matcher`
1485 while ( i-- ) {
1486 if ( ( elem = unmatched[ i ] ) ) {
1487 seed[ i ] = !( matches[ i ] = elem );
1488 }
1489 }
1490 } ) :
1491 function( elem, _context, xml ) {
1492 input[ 0 ] = elem;
1493 matcher( input, null, xml, results );
1494
1495 // Don't keep the element (issue #299)
1496 input[ 0 ] = null;
1497 return !results.pop();
1498 };
1499 } ),
1500
1501 has: markFunction( function( selector ) {
1502 return function( elem ) {
1503 return find( selector, elem ).length > 0;
1504 };
1505 } ),
1506
1507 contains: markFunction( function( text ) {
1508 text = text.replace( runescape, funescape );
1509 return function( elem ) {
1510 return ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1;
1511 };
1512 } ),
1513
1514 // "Whether an element is represented by a :lang() selector
1515 // is based solely on the element's language value
1516 // being equal to the identifier C,
1517 // or beginning with the identifier C immediately followed by "-".
1518 // The matching of C against the element's language value is performed case-insensitively.
1519 // The identifier C does not have to be a valid language name."
1520 // https://www.w3.org/TR/selectors/#lang-pseudo
1521 lang: markFunction( function( lang ) {
1522
1523 // lang value must be a valid identifier
1524 if ( !ridentifier.test( lang || "" ) ) {
1525 selectorError( "unsupported lang: " + lang );
1526 }
1527 lang = lang.replace( runescape, funescape ).toLowerCase();
1528 return function( elem ) {
1529 var elemLang;
1530 do {
1531 if ( ( elemLang = documentIsHTML ?
1532 elem.lang :
1533 elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) {
1534
1535 elemLang = elemLang.toLowerCase();
1536 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
1537 }
1538 } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 );
1539 return false;
1540 };
1541 } ),
1542
1543 // Miscellaneous
1544 target: function( elem ) {
1545 var hash = window.location && window.location.hash;
1546 return hash && hash.slice( 1 ) === elem.id;
1547 },
1548
1549 root: function( elem ) {
1550 return elem === documentElement;
1551 },
1552
1553 focus: function( elem ) {
1554 return elem === document.activeElement &&
1555 document.hasFocus() &&
1556 !!( elem.type || elem.href || ~elem.tabIndex );
1557 },
1558
1559 // Boolean properties
1560 enabled: createDisabledPseudo( false ),
1561 disabled: createDisabledPseudo( true ),
1562
1563 checked: function( elem ) {
1564
1565 // In CSS3, :checked should return both checked and selected elements
1566 // https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1567 return ( nodeName( elem, "input" ) && !!elem.checked ) ||
1568 ( nodeName( elem, "option" ) && !!elem.selected );
1569 },
1570
1571 selected: function( elem ) {
1572
1573 // Support: IE <=11+
1574 // Accessing the selectedIndex property
1575 // forces the browser to treat the default option as
1576 // selected when in an optgroup.
1577 if ( isIE && elem.parentNode ) {
1578 // eslint-disable-next-line no-unused-expressions
1579 elem.parentNode.selectedIndex;
1580 }
1581
1582 return elem.selected === true;
1583 },
1584
1585 // Contents
1586 empty: function( elem ) {
1587
1588 // https://www.w3.org/TR/selectors/#empty-pseudo
1589 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
1590 // but not by others (comment: 8; processing instruction: 7; etc.)
1591 // nodeType < 6 works because attributes (2) do not appear as children
1592 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1593 if ( elem.nodeType < 6 ) {
1594 return false;
1595 }
1596 }
1597 return true;
1598 },
1599
1600 parent: function( elem ) {
1601 return !Expr.pseudos.empty( elem );
1602 },
1603
1604 // Element/input types
1605 header: function( elem ) {
1606 return rheader.test( elem.nodeName );
1607 },
1608
1609 input: function( elem ) {
1610 return rinputs.test( elem.nodeName );
1611 },
1612
1613 button: function( elem ) {
1614 return nodeName( elem, "input" ) && elem.type === "button" ||
1615 nodeName( elem, "button" );
1616 },
1617
1618 text: function( elem ) {
1619 return nodeName( elem, "input" ) && elem.type === "text";
1620 },
1621
1622 // Position-in-collection
1623 first: createPositionalPseudo( function() {
1624 return [ 0 ];
1625 } ),
1626
1627 last: createPositionalPseudo( function( _matchIndexes, length ) {
1628 return [ length - 1 ];
1629 } ),
1630
1631 eq: createPositionalPseudo( function( _matchIndexes, length, argument ) {
1632 return [ argument < 0 ? argument + length : argument ];
1633 } ),
1634
1635 even: createPositionalPseudo( function( matchIndexes, length ) {
1636 var i = 0;
1637 for ( ; i < length; i += 2 ) {
1638 matchIndexes.push( i );
1639 }
1640 return matchIndexes;
1641 } ),
1642
1643 odd: createPositionalPseudo( function( matchIndexes, length ) {
1644 var i = 1;
1645 for ( ; i < length; i += 2 ) {
1646 matchIndexes.push( i );
1647 }
1648 return matchIndexes;
1649 } ),
1650
1651 lt: createPositionalPseudo( function( matchIndexes, length, argument ) {
1652 var i;
1653
1654 if ( argument < 0 ) {
1655 i = argument + length;
1656 } else if ( argument > length ) {
1657 i = length;
1658 } else {
1659 i = argument;
1660 }
1661
1662 for ( ; --i >= 0; ) {
1663 matchIndexes.push( i );
1664 }
1665 return matchIndexes;
1666 } ),
1667
1668 gt: createPositionalPseudo( function( matchIndexes, length, argument ) {
1669 var i = argument < 0 ? argument + length : argument;
1670 for ( ; ++i < length; ) {
1671 matchIndexes.push( i );
1672 }
1673 return matchIndexes;
1674 } )
1675 }
1676};
1677
1678Expr.pseudos.nth = Expr.pseudos.eq;
1679
1680// Add button/input type pseudos
1681for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
1682 Expr.pseudos[ i ] = createInputPseudo( i );
1683}
1684for ( i in { submit: true, reset: true } ) {
1685 Expr.pseudos[ i ] = createButtonPseudo( i );
1686}
1687
1688// Easy API for creating new setFilters
1689function setFilters() {}
1690setFilters.prototype = Expr.filters = Expr.pseudos;
1691Expr.setFilters = new setFilters();
1692
1693function tokenize( selector, parseOnly ) {
1694 var matched, match, tokens, type,
1695 soFar, groups, preFilters,
1696 cached = tokenCache[ selector + " " ];
1697
1698 if ( cached ) {
1699 return parseOnly ? 0 : cached.slice( 0 );
1700 }
1701
1702 soFar = selector;
1703 groups = [];
1704 preFilters = Expr.preFilter;
1705
1706 while ( soFar ) {
1707
1708 // Comma and first run
1709 if ( !matched || ( match = rcomma.exec( soFar ) ) ) {
1710 if ( match ) {
1711
1712 // Don't consume trailing commas as valid
1713 soFar = soFar.slice( match[ 0 ].length ) || soFar;
1714 }
1715 groups.push( ( tokens = [] ) );
1716 }
1717
1718 matched = false;
1719
1720 // Combinators
1721 if ( ( match = rcombinators.exec( soFar ) ) ) {
1722 matched = match.shift();
1723 tokens.push( {
1724 value: matched,
1725
1726 // Cast descendant combinators to space
1727 type: match[ 0 ].replace( rtrim, " " )
1728 } );
1729 soFar = soFar.slice( matched.length );
1730 }
1731
1732 // Filters
1733 for ( type in Expr.filter ) {
1734 if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] ||
1735 ( match = preFilters[ type ]( match ) ) ) ) {
1736 matched = match.shift();
1737 tokens.push( {
1738 value: matched,
1739 type: type,
1740 matches: match
1741 } );
1742 soFar = soFar.slice( matched.length );
1743 }
1744 }
1745
1746 if ( !matched ) {
1747 break;
1748 }
1749 }
1750
1751 // Return the length of the invalid excess
1752 // if we're just parsing
1753 // Otherwise, throw an error or return tokens
1754 if ( parseOnly ) {
1755 return soFar.length;
1756 }
1757
1758 return soFar ?
1759 selectorError( selector ) :
1760
1761 // Cache the tokens
1762 tokenCache( selector, groups ).slice( 0 );
1763}
1764
1765function toSelector( tokens ) {
1766 var i = 0,
1767 len = tokens.length,
1768 selector = "";
1769 for ( ; i < len; i++ ) {
1770 selector += tokens[ i ].value;
1771 }
1772 return selector;
1773}
1774
1775function addCombinator( matcher, combinator, base ) {
1776 var dir = combinator.dir,
1777 skip = combinator.next,
1778 key = skip || dir,
1779 checkNonElements = base && key === "parentNode",
1780 doneName = done++;
1781
1782 return combinator.first ?
1783
1784 // Check against closest ancestor/preceding element
1785 function( elem, context, xml ) {
1786 while ( ( elem = elem[ dir ] ) ) {
1787 if ( elem.nodeType === 1 || checkNonElements ) {
1788 return matcher( elem, context, xml );
1789 }
1790 }
1791 return false;
1792 } :
1793
1794 // Check against all ancestor/preceding elements
1795 function( elem, context, xml ) {
1796 var oldCache, outerCache,
1797 newCache = [ dirruns, doneName ];
1798
1799 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
1800 if ( xml ) {
1801 while ( ( elem = elem[ dir ] ) ) {
1802 if ( elem.nodeType === 1 || checkNonElements ) {
1803 if ( matcher( elem, context, xml ) ) {
1804 return true;
1805 }
1806 }
1807 }
1808 } else {
1809 while ( ( elem = elem[ dir ] ) ) {
1810 if ( elem.nodeType === 1 || checkNonElements ) {
1811 outerCache = elem[ expando ] || ( elem[ expando ] = {} );
1812
1813 if ( skip && nodeName( elem, skip ) ) {
1814 elem = elem[ dir ] || elem;
1815 } else if ( ( oldCache = outerCache[ key ] ) &&
1816 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
1817
1818 // Assign to newCache so results back-propagate to previous elements
1819 return ( newCache[ 2 ] = oldCache[ 2 ] );
1820 } else {
1821
1822 // Reuse newcache so results back-propagate to previous elements
1823 outerCache[ key ] = newCache;
1824
1825 // A match means we're done; a fail means we have to keep checking
1826 if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) {
1827 return true;
1828 }
1829 }
1830 }
1831 }
1832 }
1833 return false;
1834 };
1835}
1836
1837function elementMatcher( matchers ) {
1838 return matchers.length > 1 ?
1839 function( elem, context, xml ) {
1840 var i = matchers.length;
1841 while ( i-- ) {
1842 if ( !matchers[ i ]( elem, context, xml ) ) {
1843 return false;
1844 }
1845 }
1846 return true;
1847 } :
1848 matchers[ 0 ];
1849}
1850
1851function multipleContexts( selector, contexts, results ) {
1852 var i = 0,
1853 len = contexts.length;
1854 for ( ; i < len; i++ ) {
1855 find( selector, contexts[ i ], results );
1856 }
1857 return results;
1858}
1859
1860function condense( unmatched, map, filter, context, xml ) {
1861 var elem,
1862 newUnmatched = [],
1863 i = 0,
1864 len = unmatched.length,
1865 mapped = map != null;
1866
1867 for ( ; i < len; i++ ) {
1868 if ( ( elem = unmatched[ i ] ) ) {
1869 if ( !filter || filter( elem, context, xml ) ) {
1870 newUnmatched.push( elem );
1871 if ( mapped ) {
1872 map.push( i );
1873 }
1874 }
1875 }
1876 }
1877
1878 return newUnmatched;
1879}
1880
1881function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
1882 if ( postFilter && !postFilter[ expando ] ) {
1883 postFilter = setMatcher( postFilter );
1884 }
1885 if ( postFinder && !postFinder[ expando ] ) {
1886 postFinder = setMatcher( postFinder, postSelector );
1887 }
1888 return markFunction( function( seed, results, context, xml ) {
1889 var temp, i, elem, matcherOut,
1890 preMap = [],
1891 postMap = [],
1892 preexisting = results.length,
1893
1894 // Get initial elements from seed or context
1895 elems = seed ||
1896 multipleContexts( selector || "*",
1897 context.nodeType ? [ context ] : context, [] ),
1898
1899 // Prefilter to get matcher input, preserving a map for seed-results synchronization
1900 matcherIn = preFilter && ( seed || !selector ) ?
1901 condense( elems, preMap, preFilter, context, xml ) :
1902 elems;
1903
1904 if ( matcher ) {
1905
1906 // If we have a postFinder, or filtered seed, or non-seed postFilter
1907 // or preexisting results,
1908 matcherOut = postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
1909
1910 // ...intermediate processing is necessary
1911 [] :
1912
1913 // ...otherwise use results directly
1914 results;
1915
1916 // Find primary matches
1917 matcher( matcherIn, matcherOut, context, xml );
1918 } else {
1919 matcherOut = matcherIn;
1920 }
1921
1922 // Apply postFilter
1923 if ( postFilter ) {
1924 temp = condense( matcherOut, postMap );
1925 postFilter( temp, [], context, xml );
1926
1927 // Un-match failing elements by moving them back to matcherIn
1928 i = temp.length;
1929 while ( i-- ) {
1930 if ( ( elem = temp[ i ] ) ) {
1931 matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem );
1932 }
1933 }
1934 }
1935
1936 if ( seed ) {
1937 if ( postFinder || preFilter ) {
1938 if ( postFinder ) {
1939
1940 // Get the final matcherOut by condensing this intermediate into postFinder contexts
1941 temp = [];
1942 i = matcherOut.length;
1943 while ( i-- ) {
1944 if ( ( elem = matcherOut[ i ] ) ) {
1945
1946 // Restore matcherIn since elem is not yet a final match
1947 temp.push( ( matcherIn[ i ] = elem ) );
1948 }
1949 }
1950 postFinder( null, ( matcherOut = [] ), temp, xml );
1951 }
1952
1953 // Move matched elements from seed to results to keep them synchronized
1954 i = matcherOut.length;
1955 while ( i-- ) {
1956 if ( ( elem = matcherOut[ i ] ) &&
1957 ( temp = postFinder ? indexOf.call( seed, elem ) : preMap[ i ] ) > -1 ) {
1958
1959 seed[ temp ] = !( results[ temp ] = elem );
1960 }
1961 }
1962 }
1963
1964 // Add elements to results, through postFinder if defined
1965 } else {
1966 matcherOut = condense(
1967 matcherOut === results ?
1968 matcherOut.splice( preexisting, matcherOut.length ) :
1969 matcherOut
1970 );
1971 if ( postFinder ) {
1972 postFinder( null, results, matcherOut, xml );
1973 } else {
1974 push.apply( results, matcherOut );
1975 }
1976 }
1977 } );
1978}
1979
1980function matcherFromTokens( tokens ) {
1981 var checkContext, matcher, j,
1982 len = tokens.length,
1983 leadingRelative = Expr.relative[ tokens[ 0 ].type ],
1984 implicitRelative = leadingRelative || Expr.relative[ " " ],
1985 i = leadingRelative ? 1 : 0,
1986
1987 // The foundational matcher ensures that elements are reachable from top-level context(s)
1988 matchContext = addCombinator( function( elem ) {
1989 return elem === checkContext;
1990 }, implicitRelative, true ),
1991 matchAnyContext = addCombinator( function( elem ) {
1992 return indexOf.call( checkContext, elem ) > -1;
1993 }, implicitRelative, true ),
1994 matchers = [ function( elem, context, xml ) {
1995 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
1996 ( checkContext = context ).nodeType ?
1997 matchContext( elem, context, xml ) :
1998 matchAnyContext( elem, context, xml ) );
1999
2000 // Avoid hanging onto element (issue #299)
2001 checkContext = null;
2002 return ret;
2003 } ];
2004
2005 for ( ; i < len; i++ ) {
2006 if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) {
2007 matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
2008 } else {
2009 matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches );
2010
2011 // Return special upon seeing a positional matcher
2012 if ( matcher[ expando ] ) {
2013
2014 // Find the next relative operator (if any) for proper handling
2015 j = ++i;
2016 for ( ; j < len; j++ ) {
2017 if ( Expr.relative[ tokens[ j ].type ] ) {
2018 break;
2019 }
2020 }
2021 return setMatcher(
2022 i > 1 && elementMatcher( matchers ),
2023 i > 1 && toSelector(
2024
2025 // If the preceding token was a descendant combinator, insert an implicit any-element `*`
2026 tokens.slice( 0, i - 1 )
2027 .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } )
2028 ).replace( rtrim, "$1" ),
2029 matcher,
2030 i < j && matcherFromTokens( tokens.slice( i, j ) ),
2031 j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ),
2032 j < len && toSelector( tokens )
2033 );
2034 }
2035 matchers.push( matcher );
2036 }
2037 }
2038
2039 return elementMatcher( matchers );
2040}
2041
2042function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2043 var bySet = setMatchers.length > 0,
2044 byElement = elementMatchers.length > 0,
2045 superMatcher = function( seed, context, xml, results, outermost ) {
2046 var elem, j, matcher,
2047 matchedCount = 0,
2048 i = "0",
2049 unmatched = seed && [],
2050 setMatched = [],
2051 contextBackup = outermostContext,
2052
2053 // We must always have either seed elements or outermost context
2054 elems = seed || byElement && Expr.find.TAG( "*", outermost ),
2055
2056 // Use integer dirruns iff this is the outermost matcher
2057 dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 );
2058
2059 if ( outermost ) {
2060
2061 // Support: IE 11+
2062 // IE sometimes throws a "Permission denied" error when strict-comparing
2063 // two documents; shallow comparisons work.
2064 // eslint-disable-next-line eqeqeq
2065 outermostContext = context == document || context || outermost;
2066 }
2067
2068 // Add elements passing elementMatchers directly to results
2069 for ( ; ( elem = elems[ i ] ) != null; i++ ) {
2070 if ( byElement && elem ) {
2071 j = 0;
2072
2073 // Support: IE 11+
2074 // IE sometimes throws a "Permission denied" error when strict-comparing
2075 // two documents; shallow comparisons work.
2076 // eslint-disable-next-line eqeqeq
2077 if ( !context && elem.ownerDocument != document ) {
2078 setDocument( elem );
2079 xml = !documentIsHTML;
2080 }
2081 while ( ( matcher = elementMatchers[ j++ ] ) ) {
2082 if ( matcher( elem, context || document, xml ) ) {
2083 push.call( results, elem );
2084 break;
2085 }
2086 }
2087 if ( outermost ) {
2088 dirruns = dirrunsUnique;
2089 }
2090 }
2091
2092 // Track unmatched elements for set filters
2093 if ( bySet ) {
2094
2095 // They will have gone through all possible matchers
2096 if ( ( elem = !matcher && elem ) ) {
2097 matchedCount--;
2098 }
2099
2100 // Lengthen the array for every element, matched or not
2101 if ( seed ) {
2102 unmatched.push( elem );
2103 }
2104 }
2105 }
2106
2107 // `i` is now the count of elements visited above, and adding it to `matchedCount`
2108 // makes the latter nonnegative.
2109 matchedCount += i;
2110
2111 // Apply set filters to unmatched elements
2112 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
2113 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
2114 // no element matchers and no seed.
2115 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
2116 // case, which will result in a "00" `matchedCount` that differs from `i` but is also
2117 // numerically zero.
2118 if ( bySet && i !== matchedCount ) {
2119 j = 0;
2120 while ( ( matcher = setMatchers[ j++ ] ) ) {
2121 matcher( unmatched, setMatched, context, xml );
2122 }
2123
2124 if ( seed ) {
2125
2126 // Reintegrate element matches to eliminate the need for sorting
2127 if ( matchedCount > 0 ) {
2128 while ( i-- ) {
2129 if ( !( unmatched[ i ] || setMatched[ i ] ) ) {
2130 setMatched[ i ] = pop.call( results );
2131 }
2132 }
2133 }
2134
2135 // Discard index placeholder values to get only actual matches
2136 setMatched = condense( setMatched );
2137 }
2138
2139 // Add matches to results
2140 push.apply( results, setMatched );
2141
2142 // Seedless set matches succeeding multiple successful matchers stipulate sorting
2143 if ( outermost && !seed && setMatched.length > 0 &&
2144 ( matchedCount + setMatchers.length ) > 1 ) {
2145
2146 jQuery.uniqueSort( results );
2147 }
2148 }
2149
2150 // Override manipulation of globals by nested matchers
2151 if ( outermost ) {
2152 dirruns = dirrunsUnique;
2153 outermostContext = contextBackup;
2154 }
2155
2156 return unmatched;
2157 };
2158
2159 return bySet ?
2160 markFunction( superMatcher ) :
2161 superMatcher;
2162}
2163
2164function compile( selector, match /* Internal Use Only */ ) {
2165 var i,
2166 setMatchers = [],
2167 elementMatchers = [],
2168 cached = compilerCache[ selector + " " ];
2169
2170 if ( !cached ) {
2171
2172 // Generate a function of recursive functions that can be used to check each element
2173 if ( !match ) {
2174 match = tokenize( selector );
2175 }
2176 i = match.length;
2177 while ( i-- ) {
2178 cached = matcherFromTokens( match[ i ] );
2179 if ( cached[ expando ] ) {
2180 setMatchers.push( cached );
2181 } else {
2182 elementMatchers.push( cached );
2183 }
2184 }
2185
2186 // Cache the compiled function
2187 cached = compilerCache( selector,
2188 matcherFromGroupMatchers( elementMatchers, setMatchers ) );
2189
2190 // Save selector and tokenization
2191 cached.selector = selector;
2192 }
2193 return cached;
2194}
2195
2196/**
2197 * A low-level selection function that works with jQuery's compiled
2198 * selector functions
2199 * @param {String|Function} selector A selector or a pre-compiled
2200 * selector function built with jQuery selector compile
2201 * @param {Element} context
2202 * @param {Array} [results]
2203 * @param {Array} [seed] A set of elements to match against
2204 */
2205function select( selector, context, results, seed ) {
2206 var i, tokens, token, type, find,
2207 compiled = typeof selector === "function" && selector,
2208 match = !seed && tokenize( ( selector = compiled.selector || selector ) );
2209
2210 results = results || [];
2211
2212 // Try to minimize operations if there is only one selector in the list and no seed
2213 // (the latter of which guarantees us context)
2214 if ( match.length === 1 ) {
2215
2216 // Reduce context if the leading compound selector is an ID
2217 tokens = match[ 0 ] = match[ 0 ].slice( 0 );
2218 if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" &&
2219 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) {
2220
2221 context = ( Expr.find.ID(
2222 token.matches[ 0 ].replace( runescape, funescape ),
2223 context
2224 ) || [] )[ 0 ];
2225 if ( !context ) {
2226 return results;
2227
2228 // Precompiled matchers will still verify ancestry, so step up a level
2229 } else if ( compiled ) {
2230 context = context.parentNode;
2231 }
2232
2233 selector = selector.slice( tokens.shift().value.length );
2234 }
2235
2236 // Fetch a seed set for right-to-left matching
2237 i = matchExpr.needsContext.test( selector ) ? 0 : tokens.length;
2238 while ( i-- ) {
2239 token = tokens[ i ];
2240
2241 // Abort if we hit a combinator
2242 if ( Expr.relative[ ( type = token.type ) ] ) {
2243 break;
2244 }
2245 if ( ( find = Expr.find[ type ] ) ) {
2246
2247 // Search, expanding context for leading sibling combinators
2248 if ( ( seed = find(
2249 token.matches[ 0 ].replace( runescape, funescape ),
2250 rsibling.test( tokens[ 0 ].type ) &&
2251 testContext( context.parentNode ) || context
2252 ) ) ) {
2253
2254 // If seed is empty or no tokens remain, we can return early
2255 tokens.splice( i, 1 );
2256 selector = seed.length && toSelector( tokens );
2257 if ( !selector ) {
2258 push.apply( results, seed );
2259 return results;
2260 }
2261
2262 break;
2263 }
2264 }
2265 }
2266 }
2267
2268 // Compile and execute a filtering function if one is not provided
2269 // Provide `match` to avoid retokenization if we modified the selector above
2270 ( compiled || compile( selector, match ) )(
2271 seed,
2272 context,
2273 !documentIsHTML,
2274 results,
2275 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
2276 );
2277 return results;
2278}
2279
2280// Initialize against the default document
2281setDocument();
2282
2283jQuery.find = find;
2284
2285} )();
2286
2287function dir( elem, dir, until ) {
2288 var matched = [],
2289 truncate = until !== undefined;
2290
2291 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
2292 if ( elem.nodeType === 1 ) {
2293 if ( truncate && jQuery( elem ).is( until ) ) {
2294 break;
2295 }
2296 matched.push( elem );
2297 }
2298 }
2299 return matched;
2300}
2301
2302function siblings( n, elem ) {
2303 var matched = [];
2304
2305 for ( ; n; n = n.nextSibling ) {
2306 if ( n.nodeType === 1 && n !== elem ) {
2307 matched.push( n );
2308 }
2309 }
2310
2311 return matched;
2312}
2313
2314var rneedsContext = jQuery.expr.match.needsContext;
2315
2316// rsingleTag matches a string consisting of a single HTML element with no attributes
2317// and captures the element's name
2318var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
2319
2320// Implement the identical functionality for filter and not
2321function winnow( elements, qualifier, not ) {
2322 if ( typeof qualifier === "function" ) {
2323 return jQuery.grep( elements, function( elem, i ) {
2324 return !!qualifier.call( elem, i, elem ) !== not;
2325 } );
2326 }
2327
2328 // Single element
2329 if ( qualifier.nodeType ) {
2330 return jQuery.grep( elements, function( elem ) {
2331 return ( elem === qualifier ) !== not;
2332 } );
2333 }
2334
2335 // Arraylike of elements (jQuery, arguments, Array)
2336 if ( typeof qualifier !== "string" ) {
2337 return jQuery.grep( elements, function( elem ) {
2338 return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
2339 } );
2340 }
2341
2342 // Filtered directly for both simple and complex selectors
2343 return jQuery.filter( qualifier, elements, not );
2344}
2345
2346jQuery.filter = function( expr, elems, not ) {
2347 var elem = elems[ 0 ];
2348
2349 if ( not ) {
2350 expr = ":not(" + expr + ")";
2351 }
2352
2353 if ( elems.length === 1 && elem.nodeType === 1 ) {
2354 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
2355 }
2356
2357 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
2358 return elem.nodeType === 1;
2359 } ) );
2360};
2361
2362jQuery.fn.extend( {
2363 find: function( selector ) {
2364 var i, ret,
2365 len = this.length,
2366 self = this;
2367
2368 if ( typeof selector !== "string" ) {
2369 return this.pushStack( jQuery( selector ).filter( function() {
2370 for ( i = 0; i < len; i++ ) {
2371 if ( jQuery.contains( self[ i ], this ) ) {
2372 return true;
2373 }
2374 }
2375 } ) );
2376 }
2377
2378 ret = this.pushStack( [] );
2379
2380 for ( i = 0; i < len; i++ ) {
2381 jQuery.find( selector, self[ i ], ret );
2382 }
2383
2384 return len > 1 ? jQuery.uniqueSort( ret ) : ret;
2385 },
2386 filter: function( selector ) {
2387 return this.pushStack( winnow( this, selector || [], false ) );
2388 },
2389 not: function( selector ) {
2390 return this.pushStack( winnow( this, selector || [], true ) );
2391 },
2392 is: function( selector ) {
2393 return !!winnow(
2394 this,
2395
2396 // If this is a positional/relative selector, check membership in the returned set
2397 // so $("p:first").is("p:last") won't return true for a doc with two "p".
2398 typeof selector === "string" && rneedsContext.test( selector ) ?
2399 jQuery( selector ) :
2400 selector || [],
2401 false
2402 ).length;
2403 }
2404} );
2405
2406// Initialize a jQuery object
2407
2408// A central reference to the root jQuery(document)
2409var rootjQuery,
2410
2411 // A simple way to check for HTML strings
2412 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
2413 // Strict HTML recognition (#11290: must start with <)
2414 // Shortcut simple #id case for speed
2415 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
2416
2417 init = jQuery.fn.init = function( selector, context, root ) {
2418 var match, elem;
2419
2420 // HANDLE: $(""), $(null), $(undefined), $(false)
2421 if ( !selector ) {
2422 return this;
2423 }
2424
2425 // Method init() accepts an alternate rootjQuery
2426 // so migrate can support jQuery.sub (gh-2101)
2427 root = root || rootjQuery;
2428
2429 // Handle HTML strings
2430 if ( typeof selector === "string" ) {
2431 if ( selector[ 0 ] === "<" &&
2432 selector[ selector.length - 1 ] === ">" &&
2433 selector.length >= 3 ) {
2434
2435 // Assume that strings that start and end with <> are HTML and skip the regex check
2436 match = [ null, selector, null ];
2437
2438 } else {
2439 match = rquickExpr.exec( selector );
2440 }
2441
2442 // Match html or make sure no context is specified for #id
2443 if ( match && ( match[ 1 ] || !context ) ) {
2444
2445 // HANDLE: $(html) -> $(array)
2446 if ( match[ 1 ] ) {
2447 context = context instanceof jQuery ? context[ 0 ] : context;
2448
2449 // Option to run scripts is true for back-compat
2450 // Intentionally let the error be thrown if parseHTML is not present
2451 jQuery.merge( this, jQuery.parseHTML(
2452 match[ 1 ],
2453 context && context.nodeType ? context.ownerDocument || context : document,
2454 true
2455 ) );
2456
2457 // HANDLE: $(html, props)
2458 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
2459 for ( match in context ) {
2460
2461 // Properties of context are called as methods if possible
2462 if ( typeof this[ match ] === "function" ) {
2463 this[ match ]( context[ match ] );
2464
2465 // ...and otherwise set as attributes
2466 } else {
2467 this.attr( match, context[ match ] );
2468 }
2469 }
2470 }
2471
2472 return this;
2473
2474 // HANDLE: $(#id)
2475 } else {
2476 elem = document.getElementById( match[ 2 ] );
2477
2478 if ( elem ) {
2479
2480 // Inject the element directly into the jQuery object
2481 this[ 0 ] = elem;
2482 this.length = 1;
2483 }
2484 return this;
2485 }
2486
2487 // HANDLE: $(expr, $(...))
2488 } else if ( !context || context.jquery ) {
2489 return ( context || root ).find( selector );
2490
2491 // HANDLE: $(expr, context)
2492 // (which is just equivalent to: $(context).find(expr)
2493 } else {
2494 return this.constructor( context ).find( selector );
2495 }
2496
2497 // HANDLE: $(DOMElement)
2498 } else if ( selector.nodeType ) {
2499 this[ 0 ] = selector;
2500 this.length = 1;
2501 return this;
2502
2503 // HANDLE: $(function)
2504 // Shortcut for document ready
2505 } else if ( typeof selector === "function" ) {
2506 return root.ready !== undefined ?
2507 root.ready( selector ) :
2508
2509 // Execute immediately if ready is not present
2510 selector( jQuery );
2511 }
2512
2513 return jQuery.makeArray( selector, this );
2514 };
2515
2516// Give the init function the jQuery prototype for later instantiation
2517init.prototype = jQuery.fn;
2518
2519// Initialize central reference
2520rootjQuery = jQuery( document );
2521
2522var rparentsprev = /^(?:parents|prev(?:Until|All))/,
2523
2524 // Methods guaranteed to produce a unique set when starting from a unique set
2525 guaranteedUnique = {
2526 children: true,
2527 contents: true,
2528 next: true,
2529 prev: true
2530 };
2531
2532jQuery.fn.extend( {
2533 has: function( target ) {
2534 var targets = jQuery( target, this ),
2535 l = targets.length;
2536
2537 return this.filter( function() {
2538 var i = 0;
2539 for ( ; i < l; i++ ) {
2540 if ( jQuery.contains( this, targets[ i ] ) ) {
2541 return true;
2542 }
2543 }
2544 } );
2545 },
2546
2547 closest: function( selectors, context ) {
2548 var cur,
2549 i = 0,
2550 l = this.length,
2551 matched = [],
2552 targets = typeof selectors !== "string" && jQuery( selectors );
2553
2554 // Positional selectors never match, since there's no _selection_ context
2555 if ( !rneedsContext.test( selectors ) ) {
2556 for ( ; i < l; i++ ) {
2557 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
2558
2559 // Always skip document fragments
2560 if ( cur.nodeType < 11 && ( targets ?
2561 targets.index( cur ) > -1 :
2562
2563 // Don't pass non-elements to jQuery#find
2564 cur.nodeType === 1 &&
2565 jQuery.find.matchesSelector( cur, selectors ) ) ) {
2566
2567 matched.push( cur );
2568 break;
2569 }
2570 }
2571 }
2572 }
2573
2574 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
2575 },
2576
2577 // Determine the position of an element within the set
2578 index: function( elem ) {
2579
2580 // No argument, return index in parent
2581 if ( !elem ) {
2582 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
2583 }
2584
2585 // Index in selector
2586 if ( typeof elem === "string" ) {
2587 return indexOf.call( jQuery( elem ), this[ 0 ] );
2588 }
2589
2590 // Locate the position of the desired element
2591 return indexOf.call( this,
2592
2593 // If it receives a jQuery object, the first element is used
2594 elem.jquery ? elem[ 0 ] : elem
2595 );
2596 },
2597
2598 add: function( selector, context ) {
2599 return this.pushStack(
2600 jQuery.uniqueSort(
2601 jQuery.merge( this.get(), jQuery( selector, context ) )
2602 )
2603 );
2604 },
2605
2606 addBack: function( selector ) {
2607 return this.add( selector == null ?
2608 this.prevObject : this.prevObject.filter( selector )
2609 );
2610 }
2611} );
2612
2613function sibling( cur, dir ) {
2614 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
2615 return cur;
2616}
2617
2618jQuery.each( {
2619 parent: function( elem ) {
2620 var parent = elem.parentNode;
2621 return parent && parent.nodeType !== 11 ? parent : null;
2622 },
2623 parents: function( elem ) {
2624 return dir( elem, "parentNode" );
2625 },
2626 parentsUntil: function( elem, _i, until ) {
2627 return dir( elem, "parentNode", until );
2628 },
2629 next: function( elem ) {
2630 return sibling( elem, "nextSibling" );
2631 },
2632 prev: function( elem ) {
2633 return sibling( elem, "previousSibling" );
2634 },
2635 nextAll: function( elem ) {
2636 return dir( elem, "nextSibling" );
2637 },
2638 prevAll: function( elem ) {
2639 return dir( elem, "previousSibling" );
2640 },
2641 nextUntil: function( elem, _i, until ) {
2642 return dir( elem, "nextSibling", until );
2643 },
2644 prevUntil: function( elem, _i, until ) {
2645 return dir( elem, "previousSibling", until );
2646 },
2647 siblings: function( elem ) {
2648 return siblings( ( elem.parentNode || {} ).firstChild, elem );
2649 },
2650 children: function( elem ) {
2651 return siblings( elem.firstChild );
2652 },
2653 contents: function( elem ) {
2654 if ( elem.contentDocument != null &&
2655
2656 // Support: IE 11+
2657 // <object> elements with no `data` attribute has an object
2658 // `contentDocument` with a `null` prototype.
2659 getProto( elem.contentDocument ) ) {
2660
2661 return elem.contentDocument;
2662 }
2663
2664 // Support: IE 9 - 11+
2665 // Treat the template element as a regular one in browsers that
2666 // don't support it.
2667 if ( nodeName( elem, "template" ) ) {
2668 elem = elem.content || elem;
2669 }
2670
2671 return jQuery.merge( [], elem.childNodes );
2672 }
2673}, function( name, fn ) {
2674 jQuery.fn[ name ] = function( until, selector ) {
2675 var matched = jQuery.map( this, fn, until );
2676
2677 if ( name.slice( -5 ) !== "Until" ) {
2678 selector = until;
2679 }
2680
2681 if ( selector && typeof selector === "string" ) {
2682 matched = jQuery.filter( selector, matched );
2683 }
2684
2685 if ( this.length > 1 ) {
2686
2687 // Remove duplicates
2688 if ( !guaranteedUnique[ name ] ) {
2689 jQuery.uniqueSort( matched );
2690 }
2691
2692 // Reverse order for parents* and prev-derivatives
2693 if ( rparentsprev.test( name ) ) {
2694 matched.reverse();
2695 }
2696 }
2697
2698 return this.pushStack( matched );
2699 };
2700} );
2701
2702// Only count HTML whitespace
2703// Other whitespace should count in values
2704// https://infra.spec.whatwg.org/#ascii-whitespace
2705var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
2706
2707// Convert String-formatted options into Object-formatted ones
2708function createOptions( options ) {
2709 var object = {};
2710 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
2711 object[ flag ] = true;
2712 } );
2713 return object;
2714}
2715
2716/*
2717 * Create a callback list using the following parameters:
2718 *
2719 * options: an optional list of space-separated options that will change how
2720 * the callback list behaves or a more traditional option object
2721 *
2722 * By default a callback list will act like an event callback list and can be
2723 * "fired" multiple times.
2724 *
2725 * Possible options:
2726 *
2727 * once: will ensure the callback list can only be fired once (like a Deferred)
2728 *
2729 * memory: will keep track of previous values and will call any callback added
2730 * after the list has been fired right away with the latest "memorized"
2731 * values (like a Deferred)
2732 *
2733 * unique: will ensure a callback can only be added once (no duplicate in the list)
2734 *
2735 * stopOnFalse: interrupt callings when a callback returns false
2736 *
2737 */
2738jQuery.Callbacks = function( options ) {
2739
2740 // Convert options from String-formatted to Object-formatted if needed
2741 // (we check in cache first)
2742 options = typeof options === "string" ?
2743 createOptions( options ) :
2744 jQuery.extend( {}, options );
2745
2746 var // Flag to know if list is currently firing
2747 firing,
2748
2749 // Last fire value for non-forgettable lists
2750 memory,
2751
2752 // Flag to know if list was already fired
2753 fired,
2754
2755 // Flag to prevent firing
2756 locked,
2757
2758 // Actual callback list
2759 list = [],
2760
2761 // Queue of execution data for repeatable lists
2762 queue = [],
2763
2764 // Index of currently firing callback (modified by add/remove as needed)
2765 firingIndex = -1,
2766
2767 // Fire callbacks
2768 fire = function() {
2769
2770 // Enforce single-firing
2771 locked = locked || options.once;
2772
2773 // Execute callbacks for all pending executions,
2774 // respecting firingIndex overrides and runtime changes
2775 fired = firing = true;
2776 for ( ; queue.length; firingIndex = -1 ) {
2777 memory = queue.shift();
2778 while ( ++firingIndex < list.length ) {
2779
2780 // Run callback and check for early termination
2781 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
2782 options.stopOnFalse ) {
2783
2784 // Jump to end and forget the data so .add doesn't re-fire
2785 firingIndex = list.length;
2786 memory = false;
2787 }
2788 }
2789 }
2790
2791 // Forget the data if we're done with it
2792 if ( !options.memory ) {
2793 memory = false;
2794 }
2795
2796 firing = false;
2797
2798 // Clean up if we're done firing for good
2799 if ( locked ) {
2800
2801 // Keep an empty list if we have data for future add calls
2802 if ( memory ) {
2803 list = [];
2804
2805 // Otherwise, this object is spent
2806 } else {
2807 list = "";
2808 }
2809 }
2810 },
2811
2812 // Actual Callbacks object
2813 self = {
2814
2815 // Add a callback or a collection of callbacks to the list
2816 add: function() {
2817 if ( list ) {
2818
2819 // If we have memory from a past run, we should fire after adding
2820 if ( memory && !firing ) {
2821 firingIndex = list.length - 1;
2822 queue.push( memory );
2823 }
2824
2825 ( function add( args ) {
2826 jQuery.each( args, function( _, arg ) {
2827 if ( typeof arg === "function" ) {
2828 if ( !options.unique || !self.has( arg ) ) {
2829 list.push( arg );
2830 }
2831 } else if ( arg && arg.length && toType( arg ) !== "string" ) {
2832
2833 // Inspect recursively
2834 add( arg );
2835 }
2836 } );
2837 } )( arguments );
2838
2839 if ( memory && !firing ) {
2840 fire();
2841 }
2842 }
2843 return this;
2844 },
2845
2846 // Remove a callback from the list
2847 remove: function() {
2848 jQuery.each( arguments, function( _, arg ) {
2849 var index;
2850 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
2851 list.splice( index, 1 );
2852
2853 // Handle firing indexes
2854 if ( index <= firingIndex ) {
2855 firingIndex--;
2856 }
2857 }
2858 } );
2859 return this;
2860 },
2861
2862 // Check if a given callback is in the list.
2863 // If no argument is given, return whether or not list has callbacks attached.
2864 has: function( fn ) {
2865 return fn ?
2866 jQuery.inArray( fn, list ) > -1 :
2867 list.length > 0;
2868 },
2869
2870 // Remove all callbacks from the list
2871 empty: function() {
2872 if ( list ) {
2873 list = [];
2874 }
2875 return this;
2876 },
2877
2878 // Disable .fire and .add
2879 // Abort any current/pending executions
2880 // Clear all callbacks and values
2881 disable: function() {
2882 locked = queue = [];
2883 list = memory = "";
2884 return this;
2885 },
2886 disabled: function() {
2887 return !list;
2888 },
2889
2890 // Disable .fire
2891 // Also disable .add unless we have memory (since it would have no effect)
2892 // Abort any pending executions
2893 lock: function() {
2894 locked = queue = [];
2895 if ( !memory && !firing ) {
2896 list = memory = "";
2897 }
2898 return this;
2899 },
2900 locked: function() {
2901 return !!locked;
2902 },
2903
2904 // Call all callbacks with the given context and arguments
2905 fireWith: function( context, args ) {
2906 if ( !locked ) {
2907 args = args || [];
2908 args = [ context, args.slice ? args.slice() : args ];
2909 queue.push( args );
2910 if ( !firing ) {
2911 fire();
2912 }
2913 }
2914 return this;
2915 },
2916
2917 // Call all the callbacks with the given arguments
2918 fire: function() {
2919 self.fireWith( this, arguments );
2920 return this;
2921 },
2922
2923 // To know if the callbacks have already been called at least once
2924 fired: function() {
2925 return !!fired;
2926 }
2927 };
2928
2929 return self;
2930};
2931
2932function Identity( v ) {
2933 return v;
2934}
2935function Thrower( ex ) {
2936 throw ex;
2937}
2938
2939function adoptValue( value, resolve, reject, noValue ) {
2940 var method;
2941
2942 try {
2943
2944 // Check for promise aspect first to privilege synchronous behavior
2945 if ( value && typeof( method = value.promise ) === "function" ) {
2946 method.call( value ).done( resolve ).fail( reject );
2947
2948 // Other thenables
2949 } else if ( value && typeof( method = value.then ) === "function" ) {
2950 method.call( value, resolve, reject );
2951
2952 // Other non-thenables
2953 } else {
2954
2955 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
2956 // * false: [ value ].slice( 0 ) => resolve( value )
2957 // * true: [ value ].slice( 1 ) => resolve()
2958 resolve.apply( undefined, [ value ].slice( noValue ) );
2959 }
2960
2961 // For Promises/A+, convert exceptions into rejections
2962 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
2963 // Deferred#then to conditionally suppress rejection.
2964 } catch ( value ) {
2965 reject( value );
2966 }
2967}
2968
2969jQuery.extend( {
2970
2971 Deferred: function( func ) {
2972 var tuples = [
2973
2974 // action, add listener, callbacks,
2975 // ... .then handlers, argument index, [final state]
2976 [ "notify", "progress", jQuery.Callbacks( "memory" ),
2977 jQuery.Callbacks( "memory" ), 2 ],
2978 [ "resolve", "done", jQuery.Callbacks( "once memory" ),
2979 jQuery.Callbacks( "once memory" ), 0, "resolved" ],
2980 [ "reject", "fail", jQuery.Callbacks( "once memory" ),
2981 jQuery.Callbacks( "once memory" ), 1, "rejected" ]
2982 ],
2983 state = "pending",
2984 promise = {
2985 state: function() {
2986 return state;
2987 },
2988 always: function() {
2989 deferred.done( arguments ).fail( arguments );
2990 return this;
2991 },
2992 catch: function( fn ) {
2993 return promise.then( null, fn );
2994 },
2995
2996 // Keep pipe for back-compat
2997 pipe: function( /* fnDone, fnFail, fnProgress */ ) {
2998 var fns = arguments;
2999
3000 return jQuery.Deferred( function( newDefer ) {
3001 jQuery.each( tuples, function( _i, tuple ) {
3002
3003 // Map tuples (progress, done, fail) to arguments (done, fail, progress)
3004 var fn = typeof fns[ tuple[ 4 ] ] === "function" &&
3005 fns[ tuple[ 4 ] ];
3006
3007 // deferred.progress(function() { bind to newDefer or newDefer.notify })
3008 // deferred.done(function() { bind to newDefer or newDefer.resolve })
3009 // deferred.fail(function() { bind to newDefer or newDefer.reject })
3010 deferred[ tuple[ 1 ] ]( function() {
3011 var returned = fn && fn.apply( this, arguments );
3012 if ( returned && typeof returned.promise === "function" ) {
3013 returned.promise()
3014 .progress( newDefer.notify )
3015 .done( newDefer.resolve )
3016 .fail( newDefer.reject );
3017 } else {
3018 newDefer[ tuple[ 0 ] + "With" ](
3019 this,
3020 fn ? [ returned ] : arguments
3021 );
3022 }
3023 } );
3024 } );
3025 fns = null;
3026 } ).promise();
3027 },
3028 then: function( onFulfilled, onRejected, onProgress ) {
3029 var maxDepth = 0;
3030 function resolve( depth, deferred, handler, special ) {
3031 return function() {
3032 var that = this,
3033 args = arguments,
3034 mightThrow = function() {
3035 var returned, then;
3036
3037 // Support: Promises/A+ section 2.3.3.3.3
3038 // https://promisesaplus.com/#point-59
3039 // Ignore double-resolution attempts
3040 if ( depth < maxDepth ) {
3041 return;
3042 }
3043
3044 returned = handler.apply( that, args );
3045
3046 // Support: Promises/A+ section 2.3.1
3047 // https://promisesaplus.com/#point-48
3048 if ( returned === deferred.promise() ) {
3049 throw new TypeError( "Thenable self-resolution" );
3050 }
3051
3052 // Support: Promises/A+ sections 2.3.3.1, 3.5
3053 // https://promisesaplus.com/#point-54
3054 // https://promisesaplus.com/#point-75
3055 // Retrieve `then` only once
3056 then = returned &&
3057
3058 // Support: Promises/A+ section 2.3.4
3059 // https://promisesaplus.com/#point-64
3060 // Only check objects and functions for thenability
3061 ( typeof returned === "object" ||
3062 typeof returned === "function" ) &&
3063 returned.then;
3064
3065 // Handle a returned thenable
3066 if ( typeof then === "function" ) {
3067
3068 // Special processors (notify) just wait for resolution
3069 if ( special ) {
3070 then.call(
3071 returned,
3072 resolve( maxDepth, deferred, Identity, special ),
3073 resolve( maxDepth, deferred, Thrower, special )
3074 );
3075
3076 // Normal processors (resolve) also hook into progress
3077 } else {
3078
3079 // ...and disregard older resolution values
3080 maxDepth++;
3081
3082 then.call(
3083 returned,
3084 resolve( maxDepth, deferred, Identity, special ),
3085 resolve( maxDepth, deferred, Thrower, special ),
3086 resolve( maxDepth, deferred, Identity,
3087 deferred.notifyWith )
3088 );
3089 }
3090
3091 // Handle all other returned values
3092 } else {
3093
3094 // Only substitute handlers pass on context
3095 // and multiple values (non-spec behavior)
3096 if ( handler !== Identity ) {
3097 that = undefined;
3098 args = [ returned ];
3099 }
3100
3101 // Process the value(s)
3102 // Default process is resolve
3103 ( special || deferred.resolveWith )( that, args );
3104 }
3105 },
3106
3107 // Only normal processors (resolve) catch and reject exceptions
3108 process = special ?
3109 mightThrow :
3110 function() {
3111 try {
3112 mightThrow();
3113 } catch ( e ) {
3114
3115 if ( jQuery.Deferred.exceptionHook ) {
3116 jQuery.Deferred.exceptionHook( e,
3117 process.stackTrace );
3118 }
3119
3120 // Support: Promises/A+ section 2.3.3.3.4.1
3121 // https://promisesaplus.com/#point-61
3122 // Ignore post-resolution exceptions
3123 if ( depth + 1 >= maxDepth ) {
3124
3125 // Only substitute handlers pass on context
3126 // and multiple values (non-spec behavior)
3127 if ( handler !== Thrower ) {
3128 that = undefined;
3129 args = [ e ];
3130 }
3131
3132 deferred.rejectWith( that, args );
3133 }
3134 }
3135 };
3136
3137 // Support: Promises/A+ section 2.3.3.3.1
3138 // https://promisesaplus.com/#point-57
3139 // Re-resolve promises immediately to dodge false rejection from
3140 // subsequent errors
3141 if ( depth ) {
3142 process();
3143 } else {
3144
3145 // Call an optional hook to record the stack, in case of exception
3146 // since it's otherwise lost when execution goes async
3147 if ( jQuery.Deferred.getStackHook ) {
3148 process.stackTrace = jQuery.Deferred.getStackHook();
3149 }
3150 window.setTimeout( process );
3151 }
3152 };
3153 }
3154
3155 return jQuery.Deferred( function( newDefer ) {
3156
3157 // progress_handlers.add( ... )
3158 tuples[ 0 ][ 3 ].add(
3159 resolve(
3160 0,
3161 newDefer,
3162 typeof onProgress === "function" ?
3163 onProgress :
3164 Identity,
3165 newDefer.notifyWith
3166 )
3167 );
3168
3169 // fulfilled_handlers.add( ... )
3170 tuples[ 1 ][ 3 ].add(
3171 resolve(
3172 0,
3173 newDefer,
3174 typeof onFulfilled === "function" ?
3175 onFulfilled :
3176 Identity
3177 )
3178 );
3179
3180 // rejected_handlers.add( ... )
3181 tuples[ 2 ][ 3 ].add(
3182 resolve(
3183 0,
3184 newDefer,
3185 typeof onRejected === "function" ?
3186 onRejected :
3187 Thrower
3188 )
3189 );
3190 } ).promise();
3191 },
3192
3193 // Get a promise for this deferred
3194 // If obj is provided, the promise aspect is added to the object
3195 promise: function( obj ) {
3196 return obj != null ? jQuery.extend( obj, promise ) : promise;
3197 }
3198 },
3199 deferred = {};
3200
3201 // Add list-specific methods
3202 jQuery.each( tuples, function( i, tuple ) {
3203 var list = tuple[ 2 ],
3204 stateString = tuple[ 5 ];
3205
3206 // promise.progress = list.add
3207 // promise.done = list.add
3208 // promise.fail = list.add
3209 promise[ tuple[ 1 ] ] = list.add;
3210
3211 // Handle state
3212 if ( stateString ) {
3213 list.add(
3214 function() {
3215
3216 // state = "resolved" (i.e., fulfilled)
3217 // state = "rejected"
3218 state = stateString;
3219 },
3220
3221 // rejected_callbacks.disable
3222 // fulfilled_callbacks.disable
3223 tuples[ 3 - i ][ 2 ].disable,
3224
3225 // rejected_handlers.disable
3226 // fulfilled_handlers.disable
3227 tuples[ 3 - i ][ 3 ].disable,
3228
3229 // progress_callbacks.lock
3230 tuples[ 0 ][ 2 ].lock,
3231
3232 // progress_handlers.lock
3233 tuples[ 0 ][ 3 ].lock
3234 );
3235 }
3236
3237 // progress_handlers.fire
3238 // fulfilled_handlers.fire
3239 // rejected_handlers.fire
3240 list.add( tuple[ 3 ].fire );
3241
3242 // deferred.notify = function() { deferred.notifyWith(...) }
3243 // deferred.resolve = function() { deferred.resolveWith(...) }
3244 // deferred.reject = function() { deferred.rejectWith(...) }
3245 deferred[ tuple[ 0 ] ] = function() {
3246 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
3247 return this;
3248 };
3249
3250 // deferred.notifyWith = list.fireWith
3251 // deferred.resolveWith = list.fireWith
3252 // deferred.rejectWith = list.fireWith
3253 deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
3254 } );
3255
3256 // Make the deferred a promise
3257 promise.promise( deferred );
3258
3259 // Call given func if any
3260 if ( func ) {
3261 func.call( deferred, deferred );
3262 }
3263
3264 // All done!
3265 return deferred;
3266 },
3267
3268 // Deferred helper
3269 when: function( singleValue ) {
3270 var
3271
3272 // count of uncompleted subordinates
3273 remaining = arguments.length,
3274
3275 // count of unprocessed arguments
3276 i = remaining,
3277
3278 // subordinate fulfillment data
3279 resolveContexts = Array( i ),
3280 resolveValues = slice.call( arguments ),
3281
3282 // the master Deferred
3283 master = jQuery.Deferred(),
3284
3285 // subordinate callback factory
3286 updateFunc = function( i ) {
3287 return function( value ) {
3288 resolveContexts[ i ] = this;
3289 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
3290 if ( !( --remaining ) ) {
3291 master.resolveWith( resolveContexts, resolveValues );
3292 }
3293 };
3294 };
3295
3296 // Single- and empty arguments are adopted like Promise.resolve
3297 if ( remaining <= 1 ) {
3298 adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
3299 !remaining );
3300
3301 // Use .then() to unwrap secondary thenables (cf. gh-3000)
3302 if ( master.state() === "pending" ||
3303 typeof( resolveValues[ i ] && resolveValues[ i ].then ) === "function" ) {
3304
3305 return master.then();
3306 }
3307 }
3308
3309 // Multiple arguments are aggregated like Promise.all array elements
3310 while ( i-- ) {
3311 adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
3312 }
3313
3314 return master.promise();
3315 }
3316} );
3317
3318// These usually indicate a programmer mistake during development,
3319// warn about them ASAP rather than swallowing them by default.
3320var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
3321
3322jQuery.Deferred.exceptionHook = function( error, stack ) {
3323
3324 if ( error && rerrorNames.test( error.name ) ) {
3325 window.console.warn(
3326 "jQuery.Deferred exception: " + error.message,
3327 error.stack,
3328 stack
3329 );
3330 }
3331};
3332
3333jQuery.readyException = function( error ) {
3334 window.setTimeout( function() {
3335 throw error;
3336 } );
3337};
3338
3339// The deferred used on DOM ready
3340var readyList = jQuery.Deferred();
3341
3342jQuery.fn.ready = function( fn ) {
3343
3344 readyList
3345 .then( fn )
3346
3347 // Wrap jQuery.readyException in a function so that the lookup
3348 // happens at the time of error handling instead of callback
3349 // registration.
3350 .catch( function( error ) {
3351 jQuery.readyException( error );
3352 } );
3353
3354 return this;
3355};
3356
3357jQuery.extend( {
3358
3359 // Is the DOM ready to be used? Set to true once it occurs.
3360 isReady: false,
3361
3362 // A counter to track how many items to wait for before
3363 // the ready event fires. See #6781
3364 readyWait: 1,
3365
3366 // Handle when the DOM is ready
3367 ready: function( wait ) {
3368
3369 // Abort if there are pending holds or we're already ready
3370 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
3371 return;
3372 }
3373
3374 // Remember that the DOM is ready
3375 jQuery.isReady = true;
3376
3377 // If a normal DOM Ready event fired, decrement, and wait if need be
3378 if ( wait !== true && --jQuery.readyWait > 0 ) {
3379 return;
3380 }
3381
3382 // If there are functions bound, to execute
3383 readyList.resolveWith( document, [ jQuery ] );
3384 }
3385} );
3386
3387jQuery.ready.then = readyList.then;
3388
3389// The ready event handler and self cleanup method
3390function completed() {
3391 document.removeEventListener( "DOMContentLoaded", completed );
3392 window.removeEventListener( "load", completed );
3393 jQuery.ready();
3394}
3395
3396// Catch cases where $(document).ready() is called
3397// after the browser event has already occurred.
3398if ( document.readyState !== "loading" ) {
3399
3400 // Handle it asynchronously to allow scripts the opportunity to delay ready
3401 window.setTimeout( jQuery.ready );
3402
3403} else {
3404
3405 // Use the handy event callback
3406 document.addEventListener( "DOMContentLoaded", completed );
3407
3408 // A fallback to window.onload, that will always work
3409 window.addEventListener( "load", completed );
3410}
3411
3412// Multifunctional method to get and set values of a collection
3413// The value/s can optionally be executed if it's a function
3414var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
3415 var i = 0,
3416 len = elems.length,
3417 bulk = key == null;
3418
3419 // Sets many values
3420 if ( toType( key ) === "object" ) {
3421 chainable = true;
3422 for ( i in key ) {
3423 access( elems, fn, i, key[ i ], true, emptyGet, raw );
3424 }
3425
3426 // Sets one value
3427 } else if ( value !== undefined ) {
3428 chainable = true;
3429
3430 if ( typeof value !== "function" ) {
3431 raw = true;
3432 }
3433
3434 if ( bulk ) {
3435
3436 // Bulk operations run against the entire set
3437 if ( raw ) {
3438 fn.call( elems, value );
3439 fn = null;
3440
3441 // ...except when executing function values
3442 } else {
3443 bulk = fn;
3444 fn = function( elem, _key, value ) {
3445 return bulk.call( jQuery( elem ), value );
3446 };
3447 }
3448 }
3449
3450 if ( fn ) {
3451 for ( ; i < len; i++ ) {
3452 fn(
3453 elems[ i ], key, raw ?
3454 value :
3455 value.call( elems[ i ], i, fn( elems[ i ], key ) )
3456 );
3457 }
3458 }
3459 }
3460
3461 if ( chainable ) {
3462 return elems;
3463 }
3464
3465 // Gets
3466 if ( bulk ) {
3467 return fn.call( elems );
3468 }
3469
3470 return len ? fn( elems[ 0 ], key ) : emptyGet;
3471};
3472
3473// Matches dashed string for camelizing
3474var rdashAlpha = /-([a-z])/g;
3475
3476// Used by camelCase as callback to replace()
3477function fcamelCase( _all, letter ) {
3478 return letter.toUpperCase();
3479}
3480
3481// Convert dashed to camelCase
3482function camelCase( string ) {
3483 return string.replace( rdashAlpha, fcamelCase );
3484}
3485
3486/**
3487 * Determines whether an object can have data
3488 */
3489function acceptData( owner ) {
3490
3491 // Accepts only:
3492 // - Node
3493 // - Node.ELEMENT_NODE
3494 // - Node.DOCUMENT_NODE
3495 // - Object
3496 // - Any
3497 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
3498}
3499
3500function Data() {
3501 this.expando = jQuery.expando + Data.uid++;
3502}
3503
3504Data.uid = 1;
3505
3506Data.prototype = {
3507
3508 cache: function( owner ) {
3509
3510 // Check if the owner object already has a cache
3511 var value = owner[ this.expando ];
3512
3513 // If not, create one
3514 if ( !value ) {
3515 value = Object.create( null );
3516
3517 // We can accept data for non-element nodes in modern browsers,
3518 // but we should not, see #8335.
3519 // Always return an empty object.
3520 if ( acceptData( owner ) ) {
3521
3522 // If it is a node unlikely to be stringify-ed or looped over
3523 // use plain assignment
3524 if ( owner.nodeType ) {
3525 owner[ this.expando ] = value;
3526
3527 // Otherwise secure it in a non-enumerable property
3528 // configurable must be true to allow the property to be
3529 // deleted when data is removed
3530 } else {
3531 Object.defineProperty( owner, this.expando, {
3532 value: value,
3533 configurable: true
3534 } );
3535 }
3536 }
3537 }
3538
3539 return value;
3540 },
3541 set: function( owner, data, value ) {
3542 var prop,
3543 cache = this.cache( owner );
3544
3545 // Handle: [ owner, key, value ] args
3546 // Always use camelCase key (gh-2257)
3547 if ( typeof data === "string" ) {
3548 cache[ camelCase( data ) ] = value;
3549
3550 // Handle: [ owner, { properties } ] args
3551 } else {
3552
3553 // Copy the properties one-by-one to the cache object
3554 for ( prop in data ) {
3555 cache[ camelCase( prop ) ] = data[ prop ];
3556 }
3557 }
3558 return cache;
3559 },
3560 get: function( owner, key ) {
3561 return key === undefined ?
3562 this.cache( owner ) :
3563
3564 // Always use camelCase key (gh-2257)
3565 owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
3566 },
3567 access: function( owner, key, value ) {
3568
3569 // In cases where either:
3570 //
3571 // 1. No key was specified
3572 // 2. A string key was specified, but no value provided
3573 //
3574 // Take the "read" path and allow the get method to determine
3575 // which value to return, respectively either:
3576 //
3577 // 1. The entire cache object
3578 // 2. The data stored at the key
3579 //
3580 if ( key === undefined ||
3581 ( ( key && typeof key === "string" ) && value === undefined ) ) {
3582
3583 return this.get( owner, key );
3584 }
3585
3586 // When the key is not a string, or both a key and value
3587 // are specified, set or extend (existing objects) with either:
3588 //
3589 // 1. An object of properties
3590 // 2. A key and value
3591 //
3592 this.set( owner, key, value );
3593
3594 // Since the "set" path can have two possible entry points
3595 // return the expected data based on which path was taken[*]
3596 return value !== undefined ? value : key;
3597 },
3598 remove: function( owner, key ) {
3599 var i,
3600 cache = owner[ this.expando ];
3601
3602 if ( cache === undefined ) {
3603 return;
3604 }
3605
3606 if ( key !== undefined ) {
3607
3608 // Support array or space separated string of keys
3609 if ( Array.isArray( key ) ) {
3610
3611 // If key is an array of keys...
3612 // We always set camelCase keys, so remove that.
3613 key = key.map( camelCase );
3614 } else {
3615 key = camelCase( key );
3616
3617 // If a key with the spaces exists, use it.
3618 // Otherwise, create an array by matching non-whitespace
3619 key = key in cache ?
3620 [ key ] :
3621 ( key.match( rnothtmlwhite ) || [] );
3622 }
3623
3624 i = key.length;
3625
3626 while ( i-- ) {
3627 delete cache[ key[ i ] ];
3628 }
3629 }
3630
3631 // Remove the expando if there's no more data
3632 if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
3633
3634 // Support: Chrome <=35 - 45+
3635 // Webkit & Blink performance suffers when deleting properties
3636 // from DOM nodes, so set to undefined instead
3637 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
3638 if ( owner.nodeType ) {
3639 owner[ this.expando ] = undefined;
3640 } else {
3641 delete owner[ this.expando ];
3642 }
3643 }
3644 },
3645 hasData: function( owner ) {
3646 var cache = owner[ this.expando ];
3647 return cache !== undefined && !jQuery.isEmptyObject( cache );
3648 }
3649};
3650
3651var dataPriv = new Data();
3652
3653var dataUser = new Data();
3654
3655// Implementation Summary
3656//
3657// 1. Enforce API surface and semantic compatibility with 1.9.x branch
3658// 2. Improve the module's maintainability by reducing the storage
3659// paths to a single mechanism.
3660// 3. Use the same single mechanism to support "private" and "user" data.
3661// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
3662// 5. Avoid exposing implementation details on user objects (eg. expando properties)
3663// 6. Provide a clear path for implementation upgrade to WeakMap in 2014
3664
3665var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
3666 rmultiDash = /[A-Z]/g;
3667
3668function getData( data ) {
3669 if ( data === "true" ) {
3670 return true;
3671 }
3672
3673 if ( data === "false" ) {
3674 return false;
3675 }
3676
3677 if ( data === "null" ) {
3678 return null;
3679 }
3680
3681 // Only convert to a number if it doesn't change the string
3682 if ( data === +data + "" ) {
3683 return +data;
3684 }
3685
3686 if ( rbrace.test( data ) ) {
3687 return JSON.parse( data );
3688 }
3689
3690 return data;
3691}
3692
3693function dataAttr( elem, key, data ) {
3694 var name;
3695
3696 // If nothing was found internally, try to fetch any
3697 // data from the HTML5 data-* attribute
3698 if ( data === undefined && elem.nodeType === 1 ) {
3699 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
3700 data = elem.getAttribute( name );
3701
3702 if ( typeof data === "string" ) {
3703 try {
3704 data = getData( data );
3705 } catch ( e ) {}
3706
3707 // Make sure we set the data so it isn't changed later
3708 dataUser.set( elem, key, data );
3709 } else {
3710 data = undefined;
3711 }
3712 }
3713 return data;
3714}
3715
3716jQuery.extend( {
3717 hasData: function( elem ) {
3718 return dataUser.hasData( elem ) || dataPriv.hasData( elem );
3719 },
3720
3721 data: function( elem, name, data ) {
3722 return dataUser.access( elem, name, data );
3723 },
3724
3725 removeData: function( elem, name ) {
3726 dataUser.remove( elem, name );
3727 },
3728
3729 // TODO: Now that all calls to _data and _removeData have been replaced
3730 // with direct calls to dataPriv methods, these can be deprecated.
3731 _data: function( elem, name, data ) {
3732 return dataPriv.access( elem, name, data );
3733 },
3734
3735 _removeData: function( elem, name ) {
3736 dataPriv.remove( elem, name );
3737 }
3738} );
3739
3740jQuery.fn.extend( {
3741 data: function( key, value ) {
3742 var i, name, data,
3743 elem = this[ 0 ],
3744 attrs = elem && elem.attributes;
3745
3746 // Gets all values
3747 if ( key === undefined ) {
3748 if ( this.length ) {
3749 data = dataUser.get( elem );
3750
3751 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
3752 i = attrs.length;
3753 while ( i-- ) {
3754
3755 // Support: IE 11+
3756 // The attrs elements can be null (#14894)
3757 if ( attrs[ i ] ) {
3758 name = attrs[ i ].name;
3759 if ( name.indexOf( "data-" ) === 0 ) {
3760 name = camelCase( name.slice( 5 ) );
3761 dataAttr( elem, name, data[ name ] );
3762 }
3763 }
3764 }
3765 dataPriv.set( elem, "hasDataAttrs", true );
3766 }
3767 }
3768
3769 return data;
3770 }
3771
3772 // Sets multiple values
3773 if ( typeof key === "object" ) {
3774 return this.each( function() {
3775 dataUser.set( this, key );
3776 } );
3777 }
3778
3779 return access( this, function( value ) {
3780 var data;
3781
3782 // The calling jQuery object (element matches) is not empty
3783 // (and therefore has an element appears at this[ 0 ]) and the
3784 // `value` parameter was not undefined. An empty jQuery object
3785 // will result in `undefined` for elem = this[ 0 ] which will
3786 // throw an exception if an attempt to read a data cache is made.
3787 if ( elem && value === undefined ) {
3788
3789 // Attempt to get data from the cache
3790 // The key will always be camelCased in Data
3791 data = dataUser.get( elem, key );
3792 if ( data !== undefined ) {
3793 return data;
3794 }
3795
3796 // Attempt to "discover" the data in
3797 // HTML5 custom data-* attrs
3798 data = dataAttr( elem, key );
3799 if ( data !== undefined ) {
3800 return data;
3801 }
3802
3803 // We tried really hard, but the data doesn't exist.
3804 return;
3805 }
3806
3807 // Set the data...
3808 this.each( function() {
3809
3810 // We always store the camelCased key
3811 dataUser.set( this, key, value );
3812 } );
3813 }, null, value, arguments.length > 1, null, true );
3814 },
3815
3816 removeData: function( key ) {
3817 return this.each( function() {
3818 dataUser.remove( this, key );
3819 } );
3820 }
3821} );
3822
3823jQuery.extend( {
3824 queue: function( elem, type, data ) {
3825 var queue;
3826
3827 if ( elem ) {
3828 type = ( type || "fx" ) + "queue";
3829 queue = dataPriv.get( elem, type );
3830
3831 // Speed up dequeue by getting out quickly if this is just a lookup
3832 if ( data ) {
3833 if ( !queue || Array.isArray( data ) ) {
3834 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
3835 } else {
3836 queue.push( data );
3837 }
3838 }
3839 return queue || [];
3840 }
3841 },
3842
3843 dequeue: function( elem, type ) {
3844 type = type || "fx";
3845
3846 var queue = jQuery.queue( elem, type ),
3847 startLength = queue.length,
3848 fn = queue.shift(),
3849 hooks = jQuery._queueHooks( elem, type ),
3850 next = function() {
3851 jQuery.dequeue( elem, type );
3852 };
3853
3854 // If the fx queue is dequeued, always remove the progress sentinel
3855 if ( fn === "inprogress" ) {
3856 fn = queue.shift();
3857 startLength--;
3858 }
3859
3860 if ( fn ) {
3861
3862 // Add a progress sentinel to prevent the fx queue from being
3863 // automatically dequeued
3864 if ( type === "fx" ) {
3865 queue.unshift( "inprogress" );
3866 }
3867
3868 // Clear up the last queue stop function
3869 delete hooks.stop;
3870 fn.call( elem, next, hooks );
3871 }
3872
3873 if ( !startLength && hooks ) {
3874 hooks.empty.fire();
3875 }
3876 },
3877
3878 // Not public - generate a queueHooks object, or return the current one
3879 _queueHooks: function( elem, type ) {
3880 var key = type + "queueHooks";
3881 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
3882 empty: jQuery.Callbacks( "once memory" ).add( function() {
3883 dataPriv.remove( elem, [ type + "queue", key ] );
3884 } )
3885 } );
3886 }
3887} );
3888
3889jQuery.fn.extend( {
3890 queue: function( type, data ) {
3891 var setter = 2;
3892
3893 if ( typeof type !== "string" ) {
3894 data = type;
3895 type = "fx";
3896 setter--;
3897 }
3898
3899 if ( arguments.length < setter ) {
3900 return jQuery.queue( this[ 0 ], type );
3901 }
3902
3903 return data === undefined ?
3904 this :
3905 this.each( function() {
3906 var queue = jQuery.queue( this, type, data );
3907
3908 // Ensure a hooks for this queue
3909 jQuery._queueHooks( this, type );
3910
3911 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
3912 jQuery.dequeue( this, type );
3913 }
3914 } );
3915 },
3916 dequeue: function( type ) {
3917 return this.each( function() {
3918 jQuery.dequeue( this, type );
3919 } );
3920 },
3921 clearQueue: function( type ) {
3922 return this.queue( type || "fx", [] );
3923 },
3924
3925 // Get a promise resolved when queues of a certain type
3926 // are emptied (fx is the type by default)
3927 promise: function( type, obj ) {
3928 var tmp,
3929 count = 1,
3930 defer = jQuery.Deferred(),
3931 elements = this,
3932 i = this.length,
3933 resolve = function() {
3934 if ( !( --count ) ) {
3935 defer.resolveWith( elements, [ elements ] );
3936 }
3937 };
3938
3939 if ( typeof type !== "string" ) {
3940 obj = type;
3941 type = undefined;
3942 }
3943 type = type || "fx";
3944
3945 while ( i-- ) {
3946 tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
3947 if ( tmp && tmp.empty ) {
3948 count++;
3949 tmp.empty.add( resolve );
3950 }
3951 }
3952 resolve();
3953 return defer.promise( obj );
3954 }
3955} );
3956
3957var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
3958
3959var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
3960
3961var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
3962
3963// isHiddenWithinTree reports if an element has a non-"none" display style (inline and/or
3964// through the CSS cascade), which is useful in deciding whether or not to make it visible.
3965// It differs from the :hidden selector (jQuery.expr.pseudos.hidden) in two important ways:
3966// * A hidden ancestor does not force an element to be classified as hidden.
3967// * Being disconnected from the document does not force an element to be classified as hidden.
3968// These differences improve the behavior of .toggle() et al. when applied to elements that are
3969// detached or contained within hidden ancestors (gh-2404, gh-2863).
3970function isHiddenWithinTree( elem, el ) {
3971
3972 // isHiddenWithinTree might be called from jQuery#filter function;
3973 // in that case, element will be second argument
3974 elem = el || elem;
3975
3976 // Inline style trumps all
3977 return elem.style.display === "none" ||
3978 elem.style.display === "" &&
3979 jQuery.css( elem, "display" ) === "none";
3980}
3981
3982var ralphaStart = /^[a-z]/,
3983
3984 // The regex visualized:
3985 //
3986 // /----------\
3987 // | | /-------\
3988 // | / Top \ | | |
3989 // /--- Border ---+-| Right |-+---+- Width -+---\
3990 // | | Bottom | |
3991 // | \ Left / |
3992 // | |
3993 // | /----------\ |
3994 // | /-------------\ | | |- END
3995 // | | | | / Top \ | |
3996 // | | / Margin \ | | | Right | | |
3997 // |---------+-| |-+---+-| Bottom |-+----|
3998 // | \ Padding / \ Left / |
3999 // BEGIN -| |
4000 // | /---------\ |
4001 // | | | |
4002 // | | / Min \ | / Width \ |
4003 // \--------------+-| |-+---| |---/
4004 // \ Max / \ Height /
4005 rautoPx = /^(?:Border(?:Top|Right|Bottom|Left)?(?:Width|)|(?:Margin|Padding)?(?:Top|Right|Bottom|Left)?|(?:Min|Max)?(?:Width|Height))$/;
4006
4007function isAutoPx( prop ) {
4008
4009 // The first test is used to ensure that:
4010 // 1. The prop starts with a lowercase letter (as we uppercase it for the second regex).
4011 // 2. The prop is not empty.
4012 return ralphaStart.test( prop ) &&
4013 rautoPx.test( prop[ 0 ].toUpperCase() + prop.slice( 1 ) );
4014}
4015
4016function adjustCSS( elem, prop, valueParts, tween ) {
4017 var adjusted, scale,
4018 maxIterations = 20,
4019 currentValue = tween ?
4020 function() {
4021 return tween.cur();
4022 } :
4023 function() {
4024 return jQuery.css( elem, prop, "" );
4025 },
4026 initial = currentValue(),
4027 unit = valueParts && valueParts[ 3 ] || ( isAutoPx( prop ) ? "px" : "" ),
4028
4029 // Starting value computation is required for potential unit mismatches
4030 initialInUnit = elem.nodeType &&
4031 ( !isAutoPx( prop ) || unit !== "px" && +initial ) &&
4032 rcssNum.exec( jQuery.css( elem, prop ) );
4033
4034 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
4035
4036 // Support: Firefox <=54 - 66+
4037 // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
4038 initial = initial / 2;
4039
4040 // Trust units reported by jQuery.css
4041 unit = unit || initialInUnit[ 3 ];
4042
4043 // Iteratively approximate from a nonzero starting point
4044 initialInUnit = +initial || 1;
4045
4046 while ( maxIterations-- ) {
4047
4048 // Evaluate and update our best guess (doubling guesses that zero out).
4049 // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
4050 jQuery.style( elem, prop, initialInUnit + unit );
4051 if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
4052 maxIterations = 0;
4053 }
4054 initialInUnit = initialInUnit / scale;
4055
4056 }
4057
4058 initialInUnit = initialInUnit * 2;
4059 jQuery.style( elem, prop, initialInUnit + unit );
4060
4061 // Make sure we update the tween properties later on
4062 valueParts = valueParts || [];
4063 }
4064
4065 if ( valueParts ) {
4066 initialInUnit = +initialInUnit || +initial || 0;
4067
4068 // Apply relative offset (+=/-=) if specified
4069 adjusted = valueParts[ 1 ] ?
4070 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
4071 +valueParts[ 2 ];
4072 if ( tween ) {
4073 tween.unit = unit;
4074 tween.start = initialInUnit;
4075 tween.end = adjusted;
4076 }
4077 }
4078 return adjusted;
4079}
4080
4081// Matches dashed string for camelizing
4082var rmsPrefix = /^-ms-/;
4083
4084// Convert dashed to camelCase, handle vendor prefixes.
4085// Used by the css & effects modules.
4086// Support: IE <=9 - 11+
4087// Microsoft forgot to hump their vendor prefix (#9572)
4088function cssCamelCase( string ) {
4089 return camelCase( string.replace( rmsPrefix, "ms-" ) );
4090}
4091
4092var defaultDisplayMap = {};
4093
4094function getDefaultDisplay( elem ) {
4095 var temp,
4096 doc = elem.ownerDocument,
4097 nodeName = elem.nodeName,
4098 display = defaultDisplayMap[ nodeName ];
4099
4100 if ( display ) {
4101 return display;
4102 }
4103
4104 temp = doc.body.appendChild( doc.createElement( nodeName ) );
4105 display = jQuery.css( temp, "display" );
4106
4107 temp.parentNode.removeChild( temp );
4108
4109 if ( display === "none" ) {
4110 display = "block";
4111 }
4112 defaultDisplayMap[ nodeName ] = display;
4113
4114 return display;
4115}
4116
4117function showHide( elements, show ) {
4118 var display, elem,
4119 values = [],
4120 index = 0,
4121 length = elements.length;
4122
4123 // Determine new display value for elements that need to change
4124 for ( ; index < length; index++ ) {
4125 elem = elements[ index ];
4126 if ( !elem.style ) {
4127 continue;
4128 }
4129
4130 display = elem.style.display;
4131 if ( show ) {
4132
4133 // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
4134 // check is required in this first loop unless we have a nonempty display value (either
4135 // inline or about-to-be-restored)
4136 if ( display === "none" ) {
4137 values[ index ] = dataPriv.get( elem, "display" ) || null;
4138 if ( !values[ index ] ) {
4139 elem.style.display = "";
4140 }
4141 }
4142 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
4143 values[ index ] = getDefaultDisplay( elem );
4144 }
4145 } else {
4146 if ( display !== "none" ) {
4147 values[ index ] = "none";
4148
4149 // Remember what we're overwriting
4150 dataPriv.set( elem, "display", display );
4151 }
4152 }
4153 }
4154
4155 // Set the display of the elements in a second loop to avoid constant reflow
4156 for ( index = 0; index < length; index++ ) {
4157 if ( values[ index ] != null ) {
4158 elements[ index ].style.display = values[ index ];
4159 }
4160 }
4161
4162 return elements;
4163}
4164
4165jQuery.fn.extend( {
4166 show: function() {
4167 return showHide( this, true );
4168 },
4169 hide: function() {
4170 return showHide( this );
4171 },
4172 toggle: function( state ) {
4173 if ( typeof state === "boolean" ) {
4174 return state ? this.show() : this.hide();
4175 }
4176
4177 return this.each( function() {
4178 if ( isHiddenWithinTree( this ) ) {
4179 jQuery( this ).show();
4180 } else {
4181 jQuery( this ).hide();
4182 }
4183 } );
4184 }
4185} );
4186
4187var isAttached = function( elem ) {
4188 return jQuery.contains( elem.ownerDocument, elem ) ||
4189 elem.getRootNode( composed ) === elem.ownerDocument;
4190 },
4191 composed = { composed: true };
4192
4193// Support: IE 9 - 11+
4194// Check attachment across shadow DOM boundaries when possible (gh-3504).
4195// Provide a fallback for browsers without Shadow DOM v1 support.
4196if ( !documentElement.getRootNode ) {
4197 isAttached = function( elem ) {
4198 return jQuery.contains( elem.ownerDocument, elem );
4199 };
4200}
4201
4202var isAttached$1 = isAttached;
4203
4204// rtagName captures the name from the first start tag in a string of HTML
4205// https://html.spec.whatwg.org/multipage/syntax.html#tag-open-state
4206// https://html.spec.whatwg.org/multipage/syntax.html#tag-name-state
4207var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
4208
4209var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
4210
4211var wrapMap = {
4212
4213 // Table parts need to be wrapped with `<table>` or they're
4214 // stripped to their contents when put in a div.
4215 // XHTML parsers do not magically insert elements in the
4216 // same way that tag soup parsers do, so we cannot shorten
4217 // this by omitting <tbody> or other required elements.
4218 thead: [ "table" ],
4219 col: [ "colgroup", "table" ],
4220 tr: [ "tbody", "table" ],
4221 td: [ "tr", "tbody", "table" ]
4222};
4223
4224wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
4225wrapMap.th = wrapMap.td;
4226
4227function getAll( context, tag ) {
4228
4229 // Support: IE <=9 - 11+
4230 // Use typeof to avoid zero-argument method invocation on host objects (#15151)
4231 var ret;
4232
4233 if ( typeof context.getElementsByTagName !== "undefined" ) {
4234 ret = context.getElementsByTagName( tag || "*" );
4235
4236 } else if ( typeof context.querySelectorAll !== "undefined" ) {
4237 ret = context.querySelectorAll( tag || "*" );
4238
4239 } else {
4240 ret = [];
4241 }
4242
4243 if ( tag === undefined || tag && nodeName( context, tag ) ) {
4244 return jQuery.merge( [ context ], ret );
4245 }
4246
4247 return ret;
4248}
4249
4250// Mark scripts as having already been evaluated
4251function setGlobalEval( elems, refElements ) {
4252 var i = 0,
4253 l = elems.length;
4254
4255 for ( ; i < l; i++ ) {
4256 dataPriv.set(
4257 elems[ i ],
4258 "globalEval",
4259 !refElements || dataPriv.get( refElements[ i ], "globalEval" )
4260 );
4261 }
4262}
4263
4264var rhtml = /<|&#?\w+;/;
4265
4266function buildFragment( elems, context, scripts, selection, ignored ) {
4267 var elem, tmp, tag, wrap, attached, j,
4268 fragment = context.createDocumentFragment(),
4269 nodes = [],
4270 i = 0,
4271 l = elems.length;
4272
4273 for ( ; i < l; i++ ) {
4274 elem = elems[ i ];
4275
4276 if ( elem || elem === 0 ) {
4277
4278 // Add nodes directly
4279 if ( toType( elem ) === "object" ) {
4280 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
4281
4282 // Convert non-html into a text node
4283 } else if ( !rhtml.test( elem ) ) {
4284 nodes.push( context.createTextNode( elem ) );
4285
4286 // Convert html into DOM nodes
4287 } else {
4288 tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
4289
4290 // Deserialize a standard representation
4291 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
4292 wrap = wrapMap[ tag ] || arr;
4293
4294 // Create wrappers & descend into them.
4295 j = wrap.length;
4296 while ( --j > -1 ) {
4297 tmp = tmp.appendChild( context.createElement( wrap[ j ] ) );
4298 }
4299
4300 tmp.innerHTML = jQuery.htmlPrefilter( elem );
4301
4302 jQuery.merge( nodes, tmp.childNodes );
4303
4304 // Remember the top-level container
4305 tmp = fragment.firstChild;
4306
4307 // Ensure the created nodes are orphaned (#12392)
4308 tmp.textContent = "";
4309 }
4310 }
4311 }
4312
4313 // Remove wrapper from fragment
4314 fragment.textContent = "";
4315
4316 i = 0;
4317 while ( ( elem = nodes[ i++ ] ) ) {
4318
4319 // Skip elements already in the context collection (trac-4087)
4320 if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
4321 if ( ignored ) {
4322 ignored.push( elem );
4323 }
4324 continue;
4325 }
4326
4327 attached = isAttached$1( elem );
4328
4329 // Append to fragment
4330 tmp = getAll( fragment.appendChild( elem ), "script" );
4331
4332 // Preserve script evaluation history
4333 if ( attached ) {
4334 setGlobalEval( tmp );
4335 }
4336
4337 // Capture executables
4338 if ( scripts ) {
4339 j = 0;
4340 while ( ( elem = tmp[ j++ ] ) ) {
4341 if ( rscriptType.test( elem.type || "" ) ) {
4342 scripts.push( elem );
4343 }
4344 }
4345 }
4346 }
4347
4348 return fragment;
4349}
4350
4351var rcheckableType = ( /^(?:checkbox|radio)$/i );
4352
4353var rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
4354
4355function returnTrue() {
4356 return true;
4357}
4358
4359function returnFalse() {
4360 return false;
4361}
4362
4363// Support: IE <=9 - 11+
4364// focus() and blur() are asynchronous, except when they are no-op.
4365// So expect focus to be synchronous when the element is already active,
4366// and blur to be synchronous when the element is not already active.
4367// (focus and blur are always synchronous in other supported browsers,
4368// this just defines when we can count on it).
4369function expectSync( elem, type ) {
4370 return ( elem === document.activeElement ) === ( type === "focus" );
4371}
4372
4373function on( elem, types, selector, data, fn, one ) {
4374 var origFn, type;
4375
4376 // Types can be a map of types/handlers
4377 if ( typeof types === "object" ) {
4378
4379 // ( types-Object, selector, data )
4380 if ( typeof selector !== "string" ) {
4381
4382 // ( types-Object, data )
4383 data = data || selector;
4384 selector = undefined;
4385 }
4386 for ( type in types ) {
4387 on( elem, type, selector, data, types[ type ], one );
4388 }
4389 return elem;
4390 }
4391
4392 if ( data == null && fn == null ) {
4393
4394 // ( types, fn )
4395 fn = selector;
4396 data = selector = undefined;
4397 } else if ( fn == null ) {
4398 if ( typeof selector === "string" ) {
4399
4400 // ( types, selector, fn )
4401 fn = data;
4402 data = undefined;
4403 } else {
4404
4405 // ( types, data, fn )
4406 fn = data;
4407 data = selector;
4408 selector = undefined;
4409 }
4410 }
4411 if ( fn === false ) {
4412 fn = returnFalse;
4413 } else if ( !fn ) {
4414 return elem;
4415 }
4416
4417 if ( one === 1 ) {
4418 origFn = fn;
4419 fn = function( event ) {
4420
4421 // Can use an empty set, since event contains the info
4422 jQuery().off( event );
4423 return origFn.apply( this, arguments );
4424 };
4425
4426 // Use same guid so caller can remove using origFn
4427 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
4428 }
4429 return elem.each( function() {
4430 jQuery.event.add( this, types, fn, data, selector );
4431 } );
4432}
4433
4434/*
4435 * Helper functions for managing events -- not part of the public interface.
4436 * Props to Dean Edwards' addEvent library for many of the ideas.
4437 */
4438jQuery.event = {
4439
4440 add: function( elem, types, handler, data, selector ) {
4441
4442 var handleObjIn, eventHandle, tmp,
4443 events, t, handleObj,
4444 special, handlers, type, namespaces, origType,
4445 elemData = dataPriv.get( elem );
4446
4447 // Only attach events to objects that accept data
4448 if ( !acceptData( elem ) ) {
4449 return;
4450 }
4451
4452 // Caller can pass in an object of custom data in lieu of the handler
4453 if ( handler.handler ) {
4454 handleObjIn = handler;
4455 handler = handleObjIn.handler;
4456 selector = handleObjIn.selector;
4457 }
4458
4459 // Ensure that invalid selectors throw exceptions at attach time
4460 // Evaluate against documentElement in case elem is a non-element node (e.g., document)
4461 if ( selector ) {
4462 jQuery.find.matchesSelector( documentElement, selector );
4463 }
4464
4465 // Make sure that the handler has a unique ID, used to find/remove it later
4466 if ( !handler.guid ) {
4467 handler.guid = jQuery.guid++;
4468 }
4469
4470 // Init the element's event structure and main handler, if this is the first
4471 if ( !( events = elemData.events ) ) {
4472 events = elemData.events = Object.create( null );
4473 }
4474 if ( !( eventHandle = elemData.handle ) ) {
4475 eventHandle = elemData.handle = function( e ) {
4476
4477 // Discard the second event of a jQuery.event.trigger() and
4478 // when an event is called after a page has unloaded
4479 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
4480 jQuery.event.dispatch.apply( elem, arguments ) : undefined;
4481 };
4482 }
4483
4484 // Handle multiple events separated by a space
4485 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
4486 t = types.length;
4487 while ( t-- ) {
4488 tmp = rtypenamespace.exec( types[ t ] ) || [];
4489 type = origType = tmp[ 1 ];
4490 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
4491
4492 // There *must* be a type, no attaching namespace-only handlers
4493 if ( !type ) {
4494 continue;
4495 }
4496
4497 // If event changes its type, use the special event handlers for the changed type
4498 special = jQuery.event.special[ type ] || {};
4499
4500 // If selector defined, determine special event api type, otherwise given type
4501 type = ( selector ? special.delegateType : special.bindType ) || type;
4502
4503 // Update special based on newly reset type
4504 special = jQuery.event.special[ type ] || {};
4505
4506 // handleObj is passed to all event handlers
4507 handleObj = jQuery.extend( {
4508 type: type,
4509 origType: origType,
4510 data: data,
4511 handler: handler,
4512 guid: handler.guid,
4513 selector: selector,
4514 needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
4515 namespace: namespaces.join( "." )
4516 }, handleObjIn );
4517
4518 // Init the event handler queue if we're the first
4519 if ( !( handlers = events[ type ] ) ) {
4520 handlers = events[ type ] = [];
4521 handlers.delegateCount = 0;
4522
4523 // Only use addEventListener if the special events handler returns false
4524 if ( !special.setup ||
4525 special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
4526
4527 if ( elem.addEventListener ) {
4528 elem.addEventListener( type, eventHandle );
4529 }
4530 }
4531 }
4532
4533 if ( special.add ) {
4534 special.add.call( elem, handleObj );
4535
4536 if ( !handleObj.handler.guid ) {
4537 handleObj.handler.guid = handler.guid;
4538 }
4539 }
4540
4541 // Add to the element's handler list, delegates in front
4542 if ( selector ) {
4543 handlers.splice( handlers.delegateCount++, 0, handleObj );
4544 } else {
4545 handlers.push( handleObj );
4546 }
4547 }
4548
4549 },
4550
4551 // Detach an event or set of events from an element
4552 remove: function( elem, types, handler, selector, mappedTypes ) {
4553
4554 var j, origCount, tmp,
4555 events, t, handleObj,
4556 special, handlers, type, namespaces, origType,
4557 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
4558
4559 if ( !elemData || !( events = elemData.events ) ) {
4560 return;
4561 }
4562
4563 // Once for each type.namespace in types; type may be omitted
4564 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
4565 t = types.length;
4566 while ( t-- ) {
4567 tmp = rtypenamespace.exec( types[ t ] ) || [];
4568 type = origType = tmp[ 1 ];
4569 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
4570
4571 // Unbind all events (on this namespace, if provided) for the element
4572 if ( !type ) {
4573 for ( type in events ) {
4574 jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
4575 }
4576 continue;
4577 }
4578
4579 special = jQuery.event.special[ type ] || {};
4580 type = ( selector ? special.delegateType : special.bindType ) || type;
4581 handlers = events[ type ] || [];
4582 tmp = tmp[ 2 ] &&
4583 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
4584
4585 // Remove matching events
4586 origCount = j = handlers.length;
4587 while ( j-- ) {
4588 handleObj = handlers[ j ];
4589
4590 if ( ( mappedTypes || origType === handleObj.origType ) &&
4591 ( !handler || handler.guid === handleObj.guid ) &&
4592 ( !tmp || tmp.test( handleObj.namespace ) ) &&
4593 ( !selector || selector === handleObj.selector ||
4594 selector === "**" && handleObj.selector ) ) {
4595 handlers.splice( j, 1 );
4596
4597 if ( handleObj.selector ) {
4598 handlers.delegateCount--;
4599 }
4600 if ( special.remove ) {
4601 special.remove.call( elem, handleObj );
4602 }
4603 }
4604 }
4605
4606 // Remove generic event handler if we removed something and no more handlers exist
4607 // (avoids potential for endless recursion during removal of special event handlers)
4608 if ( origCount && !handlers.length ) {
4609 if ( !special.teardown ||
4610 special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
4611
4612 jQuery.removeEvent( elem, type, elemData.handle );
4613 }
4614
4615 delete events[ type ];
4616 }
4617 }
4618
4619 // Remove data and the expando if it's no longer used
4620 if ( jQuery.isEmptyObject( events ) ) {
4621 dataPriv.remove( elem, "handle events" );
4622 }
4623 },
4624
4625 dispatch: function( nativeEvent ) {
4626
4627 var i, j, ret, matched, handleObj, handlerQueue,
4628 args = new Array( arguments.length ),
4629
4630 // Make a writable jQuery.Event from the native event object
4631 event = jQuery.event.fix( nativeEvent ),
4632
4633 handlers = (
4634 dataPriv.get( this, "events" ) || Object.create( null )
4635 )[ event.type ] || [],
4636 special = jQuery.event.special[ event.type ] || {};
4637
4638 // Use the fix-ed jQuery.Event rather than the (read-only) native event
4639 args[ 0 ] = event;
4640
4641 for ( i = 1; i < arguments.length; i++ ) {
4642 args[ i ] = arguments[ i ];
4643 }
4644
4645 event.delegateTarget = this;
4646
4647 // Call the preDispatch hook for the mapped type, and let it bail if desired
4648 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
4649 return;
4650 }
4651
4652 // Determine handlers
4653 handlerQueue = jQuery.event.handlers.call( this, event, handlers );
4654
4655 // Run delegates first; they may want to stop propagation beneath us
4656 i = 0;
4657 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
4658 event.currentTarget = matched.elem;
4659
4660 j = 0;
4661 while ( ( handleObj = matched.handlers[ j++ ] ) &&
4662 !event.isImmediatePropagationStopped() ) {
4663
4664 // If the event is namespaced, then each handler is only invoked if it is
4665 // specially universal or its namespaces are a superset of the event's.
4666 if ( !event.rnamespace || handleObj.namespace === false ||
4667 event.rnamespace.test( handleObj.namespace ) ) {
4668
4669 event.handleObj = handleObj;
4670 event.data = handleObj.data;
4671
4672 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
4673 handleObj.handler ).apply( matched.elem, args );
4674
4675 if ( ret !== undefined ) {
4676 if ( ( event.result = ret ) === false ) {
4677 event.preventDefault();
4678 event.stopPropagation();
4679 }
4680 }
4681 }
4682 }
4683 }
4684
4685 // Call the postDispatch hook for the mapped type
4686 if ( special.postDispatch ) {
4687 special.postDispatch.call( this, event );
4688 }
4689
4690 return event.result;
4691 },
4692
4693 handlers: function( event, handlers ) {
4694 var i, handleObj, sel, matchedHandlers, matchedSelectors,
4695 handlerQueue = [],
4696 delegateCount = handlers.delegateCount,
4697 cur = event.target;
4698
4699 // Find delegate handlers
4700 if ( delegateCount &&
4701
4702 // Support: Firefox <=42 - 66+
4703 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
4704 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
4705 // Support: IE 11+
4706 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
4707 !( event.type === "click" && event.button >= 1 ) ) {
4708
4709 for ( ; cur !== this; cur = cur.parentNode || this ) {
4710
4711 // Don't check non-elements (#13208)
4712 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
4713 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
4714 matchedHandlers = [];
4715 matchedSelectors = {};
4716 for ( i = 0; i < delegateCount; i++ ) {
4717 handleObj = handlers[ i ];
4718
4719 // Don't conflict with Object.prototype properties (#13203)
4720 sel = handleObj.selector + " ";
4721
4722 if ( matchedSelectors[ sel ] === undefined ) {
4723 matchedSelectors[ sel ] = handleObj.needsContext ?
4724 jQuery( sel, this ).index( cur ) > -1 :
4725 jQuery.find( sel, this, null, [ cur ] ).length;
4726 }
4727 if ( matchedSelectors[ sel ] ) {
4728 matchedHandlers.push( handleObj );
4729 }
4730 }
4731 if ( matchedHandlers.length ) {
4732 handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
4733 }
4734 }
4735 }
4736 }
4737
4738 // Add the remaining (directly-bound) handlers
4739 cur = this;
4740 if ( delegateCount < handlers.length ) {
4741 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
4742 }
4743
4744 return handlerQueue;
4745 },
4746
4747 addProp: function( name, hook ) {
4748 Object.defineProperty( jQuery.Event.prototype, name, {
4749 enumerable: true,
4750 configurable: true,
4751
4752 get: typeof hook === "function" ?
4753 function() {
4754 if ( this.originalEvent ) {
4755 return hook( this.originalEvent );
4756 }
4757 } :
4758 function() {
4759 if ( this.originalEvent ) {
4760 return this.originalEvent[ name ];
4761 }
4762 },
4763
4764 set: function( value ) {
4765 Object.defineProperty( this, name, {
4766 enumerable: true,
4767 configurable: true,
4768 writable: true,
4769 value: value
4770 } );
4771 }
4772 } );
4773 },
4774
4775 fix: function( originalEvent ) {
4776 return originalEvent[ jQuery.expando ] ?
4777 originalEvent :
4778 new jQuery.Event( originalEvent );
4779 },
4780
4781 special: {
4782 load: {
4783
4784 // Prevent triggered image.load events from bubbling to window.load
4785 noBubble: true
4786 },
4787 click: {
4788
4789 // Utilize native event to ensure correct state for checkable inputs
4790 setup: function( data ) {
4791
4792 // For mutual compressibility with _default, replace `this` access with a local var.
4793 // `|| data` is dead code meant only to preserve the variable through minification.
4794 var el = this || data;
4795
4796 // Claim the first handler
4797 if ( rcheckableType.test( el.type ) &&
4798 el.click && nodeName( el, "input" ) ) {
4799
4800 // dataPriv.set( el, "click", ... )
4801 leverageNative( el, "click", returnTrue );
4802 }
4803
4804 // Return false to allow normal processing in the caller
4805 return false;
4806 },
4807 trigger: function( data ) {
4808
4809 // For mutual compressibility with _default, replace `this` access with a local var.
4810 // `|| data` is dead code meant only to preserve the variable through minification.
4811 var el = this || data;
4812
4813 // Force setup before triggering a click
4814 if ( rcheckableType.test( el.type ) &&
4815 el.click && nodeName( el, "input" ) ) {
4816
4817 leverageNative( el, "click" );
4818 }
4819
4820 // Return non-false to allow normal event-path propagation
4821 return true;
4822 },
4823
4824 // For cross-browser consistency, suppress native .click() on links
4825 // Also prevent it if we're currently inside a leveraged native-event stack
4826 _default: function( event ) {
4827 var target = event.target;
4828 return rcheckableType.test( target.type ) &&
4829 target.click && nodeName( target, "input" ) &&
4830 dataPriv.get( target, "click" ) ||
4831 nodeName( target, "a" );
4832 }
4833 },
4834
4835 beforeunload: {
4836 postDispatch: function( event ) {
4837
4838 // Support: Chrome <=73+
4839 // Chrome doesn't alert on `event.preventDefault()`
4840 // as the standard mandates.
4841 if ( event.result !== undefined && event.originalEvent ) {
4842 event.originalEvent.returnValue = event.result;
4843 }
4844 }
4845 }
4846 }
4847};
4848
4849// Ensure the presence of an event listener that handles manually-triggered
4850// synthetic events by interrupting progress until reinvoked in response to
4851// *native* events that it fires directly, ensuring that state changes have
4852// already occurred before other listeners are invoked.
4853function leverageNative( el, type, expectSync ) {
4854
4855 // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
4856 if ( !expectSync ) {
4857 if ( dataPriv.get( el, type ) === undefined ) {
4858 jQuery.event.add( el, type, returnTrue );
4859 }
4860 return;
4861 }
4862
4863 // Register the controller as a special universal handler for all event namespaces
4864 dataPriv.set( el, type, false );
4865 jQuery.event.add( el, type, {
4866 namespace: false,
4867 handler: function( event ) {
4868 var notAsync, result,
4869 saved = dataPriv.get( this, type );
4870
4871 if ( ( event.isTrigger & 1 ) && this[ type ] ) {
4872
4873 // Interrupt processing of the outer synthetic .trigger()ed event
4874 // Saved data should be false in such cases, but might be a leftover capture object
4875 // from an async native handler (gh-4350)
4876 if ( !saved.length ) {
4877
4878 // Store arguments for use when handling the inner native event
4879 // There will always be at least one argument (an event object), so this array
4880 // will not be confused with a leftover capture object.
4881 saved = slice.call( arguments );
4882 dataPriv.set( this, type, saved );
4883
4884 // Trigger the native event and capture its result
4885 // Support: IE <=9 - 11+
4886 // focus() and blur() are asynchronous
4887 notAsync = expectSync( this, type );
4888 this[ type ]();
4889 result = dataPriv.get( this, type );
4890 if ( saved !== result || notAsync ) {
4891 dataPriv.set( this, type, false );
4892 } else {
4893 result = {};
4894 }
4895 if ( saved !== result ) {
4896
4897 // Cancel the outer synthetic event
4898 event.stopImmediatePropagation();
4899 event.preventDefault();
4900 return result.value;
4901 }
4902
4903 // If this is an inner synthetic event for an event with a bubbling surrogate
4904 // (focus or blur), assume that the surrogate already propagated from triggering the
4905 // native event and prevent that from happening again here.
4906 // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
4907 // bubbling surrogate propagates *after* the non-bubbling base), but that seems
4908 // less bad than duplication.
4909 } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
4910 event.stopPropagation();
4911 }
4912
4913 // If this is a native event triggered above, everything is now in order
4914 // Fire an inner synthetic event with the original arguments
4915 } else if ( saved.length ) {
4916
4917 // ...and capture the result
4918 dataPriv.set( this, type, {
4919 value: jQuery.event.trigger(
4920
4921 // Support: IE <=9 - 11+
4922 // Extend with the prototype to reset the above stopImmediatePropagation()
4923 jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
4924 saved.slice( 1 ),
4925 this
4926 )
4927 } );
4928
4929 // Abort handling of the native event
4930 event.stopImmediatePropagation();
4931 }
4932 }
4933 } );
4934}
4935
4936jQuery.removeEvent = function( elem, type, handle ) {
4937
4938 // This "if" is needed for plain objects
4939 if ( elem.removeEventListener ) {
4940 elem.removeEventListener( type, handle );
4941 }
4942};
4943
4944jQuery.Event = function( src, props ) {
4945
4946 // Allow instantiation without the 'new' keyword
4947 if ( !( this instanceof jQuery.Event ) ) {
4948 return new jQuery.Event( src, props );
4949 }
4950
4951 // Event object
4952 if ( src && src.type ) {
4953 this.originalEvent = src;
4954 this.type = src.type;
4955
4956 // Events bubbling up the document may have been marked as prevented
4957 // by a handler lower down the tree; reflect the correct value.
4958 this.isDefaultPrevented = src.defaultPrevented ?
4959 returnTrue :
4960 returnFalse;
4961
4962 // Create target properties
4963 this.target = src.target;
4964 this.currentTarget = src.currentTarget;
4965 this.relatedTarget = src.relatedTarget;
4966
4967 // Event type
4968 } else {
4969 this.type = src;
4970 }
4971
4972 // Put explicitly provided properties onto the event object
4973 if ( props ) {
4974 jQuery.extend( this, props );
4975 }
4976
4977 // Create a timestamp if incoming event doesn't have one
4978 this.timeStamp = src && src.timeStamp || Date.now();
4979
4980 // Mark it as fixed
4981 this[ jQuery.expando ] = true;
4982};
4983
4984// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
4985// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
4986jQuery.Event.prototype = {
4987 constructor: jQuery.Event,
4988 isDefaultPrevented: returnFalse,
4989 isPropagationStopped: returnFalse,
4990 isImmediatePropagationStopped: returnFalse,
4991 isSimulated: false,
4992
4993 preventDefault: function() {
4994 var e = this.originalEvent;
4995
4996 this.isDefaultPrevented = returnTrue;
4997
4998 if ( e && !this.isSimulated ) {
4999 e.preventDefault();
5000 }
5001 },
5002 stopPropagation: function() {
5003 var e = this.originalEvent;
5004
5005 this.isPropagationStopped = returnTrue;
5006
5007 if ( e && !this.isSimulated ) {
5008 e.stopPropagation();
5009 }
5010 },
5011 stopImmediatePropagation: function() {
5012 var e = this.originalEvent;
5013
5014 this.isImmediatePropagationStopped = returnTrue;
5015
5016 if ( e && !this.isSimulated ) {
5017 e.stopImmediatePropagation();
5018 }
5019
5020 this.stopPropagation();
5021 }
5022};
5023
5024// Includes all common event props including KeyEvent and MouseEvent specific props
5025jQuery.each( {
5026 altKey: true,
5027 bubbles: true,
5028 cancelable: true,
5029 changedTouches: true,
5030 ctrlKey: true,
5031 detail: true,
5032 eventPhase: true,
5033 metaKey: true,
5034 pageX: true,
5035 pageY: true,
5036 shiftKey: true,
5037 view: true,
5038 "char": true,
5039 code: true,
5040 charCode: true,
5041 key: true,
5042 keyCode: true,
5043 button: true,
5044 buttons: true,
5045 clientX: true,
5046 clientY: true,
5047 offsetX: true,
5048 offsetY: true,
5049 pointerId: true,
5050 pointerType: true,
5051 screenX: true,
5052 screenY: true,
5053 targetTouches: true,
5054 toElement: true,
5055 touches: true,
5056 which: true
5057}, jQuery.event.addProp );
5058
5059jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
5060 jQuery.event.special[ type ] = {
5061
5062 // Utilize native event if possible so blur/focus sequence is correct
5063 setup: function() {
5064
5065 // Claim the first handler
5066 // dataPriv.set( this, "focus", ... )
5067 // dataPriv.set( this, "blur", ... )
5068 leverageNative( this, type, expectSync );
5069
5070 // Return false to allow normal processing in the caller
5071 return false;
5072 },
5073 trigger: function() {
5074
5075 // Force setup before trigger
5076 leverageNative( this, type );
5077
5078 // Return non-false to allow normal event-path propagation
5079 return true;
5080 },
5081
5082 delegateType: delegateType
5083 };
5084} );
5085
5086// Create mouseenter/leave events using mouseover/out and event-time checks
5087// so that event delegation works in jQuery.
5088// Do the same for pointerenter/pointerleave and pointerover/pointerout
5089jQuery.each( {
5090 mouseenter: "mouseover",
5091 mouseleave: "mouseout",
5092 pointerenter: "pointerover",
5093 pointerleave: "pointerout"
5094}, function( orig, fix ) {
5095 jQuery.event.special[ orig ] = {
5096 delegateType: fix,
5097 bindType: fix,
5098
5099 handle: function( event ) {
5100 var ret,
5101 target = this,
5102 related = event.relatedTarget,
5103 handleObj = event.handleObj;
5104
5105 // For mouseenter/leave call the handler if related is outside the target.
5106 // NB: No relatedTarget if the mouse left/entered the browser window
5107 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
5108 event.type = handleObj.origType;
5109 ret = handleObj.handler.apply( this, arguments );
5110 event.type = fix;
5111 }
5112 return ret;
5113 }
5114 };
5115} );
5116
5117jQuery.fn.extend( {
5118
5119 on: function( types, selector, data, fn ) {
5120 return on( this, types, selector, data, fn );
5121 },
5122 one: function( types, selector, data, fn ) {
5123 return on( this, types, selector, data, fn, 1 );
5124 },
5125 off: function( types, selector, fn ) {
5126 var handleObj, type;
5127 if ( types && types.preventDefault && types.handleObj ) {
5128
5129 // ( event ) dispatched jQuery.Event
5130 handleObj = types.handleObj;
5131 jQuery( types.delegateTarget ).off(
5132 handleObj.namespace ?
5133 handleObj.origType + "." + handleObj.namespace :
5134 handleObj.origType,
5135 handleObj.selector,
5136 handleObj.handler
5137 );
5138 return this;
5139 }
5140 if ( typeof types === "object" ) {
5141
5142 // ( types-object [, selector] )
5143 for ( type in types ) {
5144 this.off( type, selector, types[ type ] );
5145 }
5146 return this;
5147 }
5148 if ( selector === false || typeof selector === "function" ) {
5149
5150 // ( types [, fn] )
5151 fn = selector;
5152 selector = undefined;
5153 }
5154 if ( fn === false ) {
5155 fn = returnFalse;
5156 }
5157 return this.each( function() {
5158 jQuery.event.remove( this, types, fn, selector );
5159 } );
5160 }
5161} );
5162
5163var
5164
5165 // Support: IE <=10 - 11+
5166 // In IE using regex groups here causes severe slowdowns.
5167 rnoInnerhtml = /<script|<style|<link/i,
5168
5169 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
5170
5171// Prefer a tbody over its parent table for containing new rows
5172function manipulationTarget( elem, content ) {
5173 if ( nodeName( elem, "table" ) &&
5174 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
5175
5176 return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
5177 }
5178
5179 return elem;
5180}
5181
5182// Replace/restore the type attribute of script elements for safe DOM manipulation
5183function disableScript( elem ) {
5184 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
5185 return elem;
5186}
5187function restoreScript( elem ) {
5188 if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
5189 elem.type = elem.type.slice( 5 );
5190 } else {
5191 elem.removeAttribute( "type" );
5192 }
5193
5194 return elem;
5195}
5196
5197function cloneCopyEvent( src, dest ) {
5198 var i, l, type, pdataOld, udataOld, udataCur, events;
5199
5200 if ( dest.nodeType !== 1 ) {
5201 return;
5202 }
5203
5204 // 1. Copy private data: events, handlers, etc.
5205 if ( dataPriv.hasData( src ) ) {
5206 pdataOld = dataPriv.get( src );
5207 events = pdataOld.events;
5208
5209 if ( events ) {
5210 dataPriv.remove( dest, "handle events" );
5211
5212 for ( type in events ) {
5213 for ( i = 0, l = events[ type ].length; i < l; i++ ) {
5214 jQuery.event.add( dest, type, events[ type ][ i ] );
5215 }
5216 }
5217 }
5218 }
5219
5220 // 2. Copy user data
5221 if ( dataUser.hasData( src ) ) {
5222 udataOld = dataUser.access( src );
5223 udataCur = jQuery.extend( {}, udataOld );
5224
5225 dataUser.set( dest, udataCur );
5226 }
5227}
5228
5229function domManip( collection, args, callback, ignored ) {
5230
5231 // Flatten any nested arrays
5232 args = flat( args );
5233
5234 var fragment, first, scripts, hasScripts, node, doc,
5235 i = 0,
5236 l = collection.length,
5237 iNoClone = l - 1,
5238 value = args[ 0 ],
5239 valueIsFunction = typeof value === "function";
5240
5241 if ( valueIsFunction ) {
5242 return collection.each( function( index ) {
5243 var self = collection.eq( index );
5244 args[ 0 ] = value.call( this, index, self.html() );
5245 domManip( self, args, callback, ignored );
5246 } );
5247 }
5248
5249 if ( l ) {
5250 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
5251 first = fragment.firstChild;
5252
5253 if ( fragment.childNodes.length === 1 ) {
5254 fragment = first;
5255 }
5256
5257 // Require either new content or an interest in ignored elements to invoke the callback
5258 if ( first || ignored ) {
5259 scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
5260 hasScripts = scripts.length;
5261
5262 // Use the original fragment for the last item
5263 // instead of the first because it can end up
5264 // being emptied incorrectly in certain situations (#8070).
5265 for ( ; i < l; i++ ) {
5266 node = fragment;
5267
5268 if ( i !== iNoClone ) {
5269 node = jQuery.clone( node, true, true );
5270
5271 // Keep references to cloned scripts for later restoration
5272 if ( hasScripts ) {
5273 jQuery.merge( scripts, getAll( node, "script" ) );
5274 }
5275 }
5276
5277 callback.call( collection[ i ], node, i );
5278 }
5279
5280 if ( hasScripts ) {
5281 doc = scripts[ scripts.length - 1 ].ownerDocument;
5282
5283 // Reenable scripts
5284 jQuery.map( scripts, restoreScript );
5285
5286 // Evaluate executable scripts on first document insertion
5287 for ( i = 0; i < hasScripts; i++ ) {
5288 node = scripts[ i ];
5289 if ( rscriptType.test( node.type || "" ) &&
5290 !dataPriv.access( node, "globalEval" ) &&
5291 jQuery.contains( doc, node ) ) {
5292
5293 if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
5294
5295 // Optional AJAX dependency, but won't run scripts if not present
5296 if ( jQuery._evalUrl && !node.noModule ) {
5297 jQuery._evalUrl( node.src, {
5298 nonce: node.nonce,
5299 crossOrigin: node.crossOrigin
5300 }, doc );
5301 }
5302 } else {
5303 DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
5304 }
5305 }
5306 }
5307 }
5308 }
5309 }
5310
5311 return collection;
5312}
5313
5314function remove( elem, selector, keepData ) {
5315 var node,
5316 nodes = selector ? jQuery.filter( selector, elem ) : elem,
5317 i = 0;
5318
5319 for ( ; ( node = nodes[ i ] ) != null; i++ ) {
5320 if ( !keepData && node.nodeType === 1 ) {
5321 jQuery.cleanData( getAll( node ) );
5322 }
5323
5324 if ( node.parentNode ) {
5325 if ( keepData && isAttached$1( node ) ) {
5326 setGlobalEval( getAll( node, "script" ) );
5327 }
5328 node.parentNode.removeChild( node );
5329 }
5330 }
5331
5332 return elem;
5333}
5334
5335jQuery.extend( {
5336 htmlPrefilter: function( html ) {
5337 return html;
5338 },
5339
5340 clone: function( elem, dataAndEvents, deepDataAndEvents ) {
5341 var i, l, srcElements, destElements,
5342 clone = elem.cloneNode( true ),
5343 inPage = isAttached$1( elem );
5344
5345 // Fix IE cloning issues
5346 if ( isIE && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
5347 !jQuery.isXMLDoc( elem ) ) {
5348
5349 // We eschew jQuery#find here for performance reasons:
5350 // https://jsperf.com/getall-vs-sizzle/2
5351 destElements = getAll( clone );
5352 srcElements = getAll( elem );
5353
5354 for ( i = 0, l = srcElements.length; i < l; i++ ) {
5355
5356 // Support: IE <=11+
5357 // IE fails to set the defaultValue to the correct value when
5358 // cloning textareas.
5359 if ( nodeName( destElements[ i ], "textarea" ) ) {
5360 destElements[ i ].defaultValue = srcElements[ i ].defaultValue;
5361 }
5362 }
5363 }
5364
5365 // Copy the events from the original to the clone
5366 if ( dataAndEvents ) {
5367 if ( deepDataAndEvents ) {
5368 srcElements = srcElements || getAll( elem );
5369 destElements = destElements || getAll( clone );
5370
5371 for ( i = 0, l = srcElements.length; i < l; i++ ) {
5372 cloneCopyEvent( srcElements[ i ], destElements[ i ] );
5373 }
5374 } else {
5375 cloneCopyEvent( elem, clone );
5376 }
5377 }
5378
5379 // Preserve script evaluation history
5380 destElements = getAll( clone, "script" );
5381 if ( destElements.length > 0 ) {
5382 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
5383 }
5384
5385 // Return the cloned set
5386 return clone;
5387 },
5388
5389 cleanData: function( elems ) {
5390 var data, elem, type,
5391 special = jQuery.event.special,
5392 i = 0;
5393
5394 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
5395 if ( acceptData( elem ) ) {
5396 if ( ( data = elem[ dataPriv.expando ] ) ) {
5397 if ( data.events ) {
5398 for ( type in data.events ) {
5399 if ( special[ type ] ) {
5400 jQuery.event.remove( elem, type );
5401
5402 // This is a shortcut to avoid jQuery.event.remove's overhead
5403 } else {
5404 jQuery.removeEvent( elem, type, data.handle );
5405 }
5406 }
5407 }
5408
5409 // Support: Chrome <=35 - 45+
5410 // Assign undefined instead of using delete, see Data#remove
5411 elem[ dataPriv.expando ] = undefined;
5412 }
5413 if ( elem[ dataUser.expando ] ) {
5414
5415 // Support: Chrome <=35 - 45+
5416 // Assign undefined instead of using delete, see Data#remove
5417 elem[ dataUser.expando ] = undefined;
5418 }
5419 }
5420 }
5421 }
5422} );
5423
5424jQuery.fn.extend( {
5425 detach: function( selector ) {
5426 return remove( this, selector, true );
5427 },
5428
5429 remove: function( selector ) {
5430 return remove( this, selector );
5431 },
5432
5433 text: function( value ) {
5434 return access( this, function( value ) {
5435 return value === undefined ?
5436 jQuery.text( this ) :
5437 this.empty().each( function() {
5438 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5439 this.textContent = value;
5440 }
5441 } );
5442 }, null, value, arguments.length );
5443 },
5444
5445 append: function() {
5446 return domManip( this, arguments, function( elem ) {
5447 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5448 var target = manipulationTarget( this, elem );
5449 target.appendChild( elem );
5450 }
5451 } );
5452 },
5453
5454 prepend: function() {
5455 return domManip( this, arguments, function( elem ) {
5456 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5457 var target = manipulationTarget( this, elem );
5458 target.insertBefore( elem, target.firstChild );
5459 }
5460 } );
5461 },
5462
5463 before: function() {
5464 return domManip( this, arguments, function( elem ) {
5465 if ( this.parentNode ) {
5466 this.parentNode.insertBefore( elem, this );
5467 }
5468 } );
5469 },
5470
5471 after: function() {
5472 return domManip( this, arguments, function( elem ) {
5473 if ( this.parentNode ) {
5474 this.parentNode.insertBefore( elem, this.nextSibling );
5475 }
5476 } );
5477 },
5478
5479 empty: function() {
5480 var elem,
5481 i = 0;
5482
5483 for ( ; ( elem = this[ i ] ) != null; i++ ) {
5484 if ( elem.nodeType === 1 ) {
5485
5486 // Prevent memory leaks
5487 jQuery.cleanData( getAll( elem, false ) );
5488
5489 // Remove any remaining nodes
5490 elem.textContent = "";
5491 }
5492 }
5493
5494 return this;
5495 },
5496
5497 clone: function( dataAndEvents, deepDataAndEvents ) {
5498 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
5499 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
5500
5501 return this.map( function() {
5502 return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
5503 } );
5504 },
5505
5506 html: function( value ) {
5507 return access( this, function( value ) {
5508 var elem = this[ 0 ] || {},
5509 i = 0,
5510 l = this.length;
5511
5512 if ( value === undefined && elem.nodeType === 1 ) {
5513 return elem.innerHTML;
5514 }
5515
5516 // See if we can take a shortcut and just use innerHTML
5517 if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
5518 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
5519
5520 value = jQuery.htmlPrefilter( value );
5521
5522 try {
5523 for ( ; i < l; i++ ) {
5524 elem = this[ i ] || {};
5525
5526 // Remove element nodes and prevent memory leaks
5527 if ( elem.nodeType === 1 ) {
5528 jQuery.cleanData( getAll( elem, false ) );
5529 elem.innerHTML = value;
5530 }
5531 }
5532
5533 elem = 0;
5534
5535 // If using innerHTML throws an exception, use the fallback method
5536 } catch ( e ) {}
5537 }
5538
5539 if ( elem ) {
5540 this.empty().append( value );
5541 }
5542 }, null, value, arguments.length );
5543 },
5544
5545 replaceWith: function() {
5546 var ignored = [];
5547
5548 // Make the changes, replacing each non-ignored context element with the new content
5549 return domManip( this, arguments, function( elem ) {
5550 var parent = this.parentNode;
5551
5552 if ( jQuery.inArray( this, ignored ) < 0 ) {
5553 jQuery.cleanData( getAll( this ) );
5554 if ( parent ) {
5555 parent.replaceChild( elem, this );
5556 }
5557 }
5558
5559 // Force callback invocation
5560 }, ignored );
5561 }
5562} );
5563
5564jQuery.each( {
5565 appendTo: "append",
5566 prependTo: "prepend",
5567 insertBefore: "before",
5568 insertAfter: "after",
5569 replaceAll: "replaceWith"
5570}, function( name, original ) {
5571 jQuery.fn[ name ] = function( selector ) {
5572 var elems,
5573 ret = [],
5574 insert = jQuery( selector ),
5575 last = insert.length - 1,
5576 i = 0;
5577
5578 for ( ; i <= last; i++ ) {
5579 elems = i === last ? this : this.clone( true );
5580 jQuery( insert[ i ] )[ original ]( elems );
5581 push.apply( ret, elems.get() );
5582 }
5583
5584 return this.pushStack( ret );
5585 };
5586} );
5587
5588var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
5589
5590function getStyles( elem ) {
5591
5592 // Support: IE <=11+ (trac-14150)
5593 // In IE popup's `window` is the opener window which makes `window.getComputedStyle( elem )`
5594 // break. Using `elem.ownerDocument.defaultView` avoids the issue.
5595 var view = elem.ownerDocument.defaultView;
5596
5597 // `document.implementation.createHTMLDocument( "" )` has a `null` `defaultView`
5598 // property; check `defaultView` truthiness to fallback to window in such a case.
5599 if ( !view ) {
5600 view = window;
5601 }
5602
5603 return view.getComputedStyle( elem );
5604}
5605
5606// A method for quickly swapping in/out CSS properties to get correct calculations.
5607function swap( elem, options, callback ) {
5608 var ret, name,
5609 old = {};
5610
5611 // Remember the old values, and insert the new ones
5612 for ( name in options ) {
5613 old[ name ] = elem.style[ name ];
5614 elem.style[ name ] = options[ name ];
5615 }
5616
5617 ret = callback.call( elem );
5618
5619 // Revert the old values
5620 for ( name in options ) {
5621 elem.style[ name ] = old[ name ];
5622 }
5623
5624 return ret;
5625}
5626
5627function curCSS( elem, name, computed ) {
5628 var ret;
5629
5630 computed = computed || getStyles( elem );
5631
5632 // getPropertyValue is needed for `.css('--customProperty')` (gh-3144)
5633 if ( computed ) {
5634 ret = computed.getPropertyValue( name ) || computed[ name ];
5635
5636 if ( ret === "" && !isAttached$1( elem ) ) {
5637 ret = jQuery.style( elem, name );
5638 }
5639 }
5640
5641 return ret !== undefined ?
5642
5643 // Support: IE <=9 - 11+
5644 // IE returns zIndex value as an integer.
5645 ret + "" :
5646 ret;
5647}
5648
5649var cssPrefixes = [ "Webkit", "Moz", "ms" ],
5650 emptyStyle = document.createElement( "div" ).style,
5651 vendorProps = {};
5652
5653// Return a vendor-prefixed property or undefined
5654function vendorPropName( name ) {
5655
5656 // Check for vendor prefixed names
5657 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
5658 i = cssPrefixes.length;
5659
5660 while ( i-- ) {
5661 name = cssPrefixes[ i ] + capName;
5662 if ( name in emptyStyle ) {
5663 return name;
5664 }
5665 }
5666}
5667
5668// Return a potentially-mapped vendor prefixed property
5669function finalPropName( name ) {
5670 var final = vendorProps[ name ];
5671
5672 if ( final ) {
5673 return final;
5674 }
5675 if ( name in emptyStyle ) {
5676 return name;
5677 }
5678 return vendorProps[ name ] = vendorPropName( name ) || name;
5679}
5680
5681var
5682
5683 // Swappable if display is none or starts with table
5684 // except "table", "table-cell", or "table-caption"
5685 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
5686 rdisplayswap = /^(none|table(?!-c[ea]).+)/,
5687 rcustomProp = /^--/,
5688 cssShow = { position: "absolute", visibility: "hidden", display: "block" },
5689 cssNormalTransform = {
5690 letterSpacing: "0",
5691 fontWeight: "400"
5692 };
5693
5694function setPositiveNumber( _elem, value, subtract ) {
5695
5696 // Any relative (+/-) values have already been
5697 // normalized at this point
5698 var matches = rcssNum.exec( value );
5699 return matches ?
5700
5701 // Guard against undefined "subtract", e.g., when used as in cssHooks
5702 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
5703 value;
5704}
5705
5706function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
5707 var i = dimension === "width" ? 1 : 0,
5708 extra = 0,
5709 delta = 0;
5710
5711 // Adjustment may not be necessary
5712 if ( box === ( isBorderBox ? "border" : "content" ) ) {
5713 return 0;
5714 }
5715
5716 for ( ; i < 4; i += 2 ) {
5717
5718 // Both box models exclude margin
5719 if ( box === "margin" ) {
5720 delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
5721 }
5722
5723 // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
5724 if ( !isBorderBox ) {
5725
5726 // Add padding
5727 delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
5728
5729 // For "border" or "margin", add border
5730 if ( box !== "padding" ) {
5731 delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
5732
5733 // But still keep track of it otherwise
5734 } else {
5735 extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
5736 }
5737
5738 // If we get here with a border-box (content + padding + border), we're seeking "content" or
5739 // "padding" or "margin"
5740 } else {
5741
5742 // For "content", subtract padding
5743 if ( box === "content" ) {
5744 delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
5745 }
5746
5747 // For "content" or "padding", subtract border
5748 if ( box !== "margin" ) {
5749 delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
5750 }
5751 }
5752 }
5753
5754 // Account for positive content-box scroll gutter when requested by providing computedVal
5755 if ( !isBorderBox && computedVal >= 0 ) {
5756
5757 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
5758 // Assuming integer scroll gutter, subtract the rest and round down
5759 delta += Math.max( 0, Math.ceil(
5760 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
5761 computedVal -
5762 delta -
5763 extra -
5764 0.5
5765
5766 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
5767 // Use an explicit zero to avoid NaN (gh-3964)
5768 ) ) || 0;
5769 }
5770
5771 return delta;
5772}
5773
5774function getWidthOrHeight( elem, dimension, extra ) {
5775
5776 // Start with computed style
5777 var styles = getStyles( elem ),
5778
5779 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
5780 // Fake content-box until we know it's needed to know the true value.
5781 boxSizingNeeded = isIE || extra,
5782 isBorderBox = boxSizingNeeded &&
5783 jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
5784 valueIsBorderBox = isBorderBox,
5785
5786 val = curCSS( elem, dimension, styles ),
5787 offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
5788
5789 // Return a confounding non-pixel value or feign ignorance, as appropriate.
5790 if ( rnumnonpx.test( val ) ) {
5791 if ( !extra ) {
5792 return val;
5793 }
5794 val = "auto";
5795 }
5796
5797
5798 if ( ( isIE &&
5799 (
5800
5801 // Support: IE 9 - 11+
5802 // Use offsetWidth/offsetHeight for when box sizing is unreliable.
5803 // In those cases, the computed value can be trusted to be border-box.
5804 isBorderBox ||
5805
5806 // Support: IE 10 - 11+
5807 // IE misreports `getComputedStyle` of table rows with width/height
5808 // set in CSS while `offset*` properties report correct values.
5809 nodeName( elem, "tr" )
5810 ) ||
5811
5812 // Fall back to offsetWidth/offsetHeight when value is "auto"
5813 // This happens for inline elements with no explicit setting (gh-3571)
5814 val === "auto" ) &&
5815
5816 // Make sure the element is visible & connected
5817 elem.getClientRects().length ) {
5818
5819 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
5820
5821 // Where available, offsetWidth/offsetHeight approximate border box dimensions.
5822 // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
5823 // retrieved value as a content box dimension.
5824 valueIsBorderBox = offsetProp in elem;
5825 if ( valueIsBorderBox ) {
5826 val = elem[ offsetProp ];
5827 }
5828 }
5829
5830 // Normalize "" and auto
5831 val = parseFloat( val ) || 0;
5832
5833 // Adjust for the element's box model
5834 return ( val +
5835 boxModelAdjustment(
5836 elem,
5837 dimension,
5838 extra || ( isBorderBox ? "border" : "content" ),
5839 valueIsBorderBox,
5840 styles,
5841
5842 // Provide the current computed size to request scroll gutter calculation (gh-3589)
5843 val
5844 )
5845 ) + "px";
5846}
5847
5848jQuery.extend( {
5849
5850 // Add in style property hooks for overriding the default
5851 // behavior of getting and setting a style property
5852 cssHooks: {},
5853
5854 // Get and set the style property on a DOM Node
5855 style: function( elem, name, value, extra ) {
5856
5857 // Don't set styles on text and comment nodes
5858 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
5859 return;
5860 }
5861
5862 // Make sure that we're working with the right name
5863 var ret, type, hooks,
5864 origName = cssCamelCase( name ),
5865 isCustomProp = rcustomProp.test( name ),
5866 style = elem.style;
5867
5868 // Make sure that we're working with the right name. We don't
5869 // want to query the value if it is a CSS custom property
5870 // since they are user-defined.
5871 if ( !isCustomProp ) {
5872 name = finalPropName( origName );
5873 }
5874
5875 // Gets hook for the prefixed version, then unprefixed version
5876 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
5877
5878 // Check if we're setting a value
5879 if ( value !== undefined ) {
5880 type = typeof value;
5881
5882 // Convert "+=" or "-=" to relative numbers (#7345)
5883 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
5884 value = adjustCSS( elem, name, ret );
5885
5886 // Fixes bug #9237
5887 type = "number";
5888 }
5889
5890 // Make sure that null and NaN values aren't set (#7116)
5891 if ( value == null || value !== value ) {
5892 return;
5893 }
5894
5895 // If the value is a number, add `px` for certain CSS properties
5896 if ( type === "number" ) {
5897 value += ret && ret[ 3 ] || ( isAutoPx( origName ) ? "px" : "" );
5898 }
5899
5900 // Support: IE <=9 - 11+
5901 // background-* props of a cloned element affect the source element (#8908)
5902 if ( isIE && value === "" && name.indexOf( "background" ) === 0 ) {
5903 style[ name ] = "inherit";
5904 }
5905
5906 // If a hook was provided, use that value, otherwise just set the specified value
5907 if ( !hooks || !( "set" in hooks ) ||
5908 ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
5909
5910 if ( isCustomProp ) {
5911 style.setProperty( name, value );
5912 } else {
5913 style[ name ] = value;
5914 }
5915 }
5916
5917 } else {
5918
5919 // If a hook was provided get the non-computed value from there
5920 if ( hooks && "get" in hooks &&
5921 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
5922
5923 return ret;
5924 }
5925
5926 // Otherwise just get the value from the style object
5927 return style[ name ];
5928 }
5929 },
5930
5931 css: function( elem, name, extra, styles ) {
5932 var val, num, hooks,
5933 origName = cssCamelCase( name ),
5934 isCustomProp = rcustomProp.test( name );
5935
5936 // Make sure that we're working with the right name. We don't
5937 // want to modify the value if it is a CSS custom property
5938 // since they are user-defined.
5939 if ( !isCustomProp ) {
5940 name = finalPropName( origName );
5941 }
5942
5943 // Try prefixed name followed by the unprefixed name
5944 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
5945
5946 // If a hook was provided get the computed value from there
5947 if ( hooks && "get" in hooks ) {
5948 val = hooks.get( elem, true, extra );
5949 }
5950
5951 // Otherwise, if a way to get the computed value exists, use that
5952 if ( val === undefined ) {
5953 val = curCSS( elem, name, styles );
5954 }
5955
5956 // Convert "normal" to computed value
5957 if ( val === "normal" && name in cssNormalTransform ) {
5958 val = cssNormalTransform[ name ];
5959 }
5960
5961 // Make numeric if forced or a qualifier was provided and val looks numeric
5962 if ( extra === "" || extra ) {
5963 num = parseFloat( val );
5964 return extra === true || isFinite( num ) ? num || 0 : val;
5965 }
5966
5967 return val;
5968 }
5969} );
5970
5971jQuery.each( [ "height", "width" ], function( _i, dimension ) {
5972 jQuery.cssHooks[ dimension ] = {
5973 get: function( elem, computed, extra ) {
5974 if ( computed ) {
5975
5976 // Certain elements can have dimension info if we invisibly show them
5977 // but it must have a current display style that would benefit
5978 return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
5979
5980 // Support: Safari <=8 - 12+, Chrome <=73+
5981 // Table columns in WebKit/Blink have non-zero offsetWidth & zero
5982 // getBoundingClientRect().width unless display is changed.
5983 // Support: IE <=11+
5984 // Running getBoundingClientRect on a disconnected node
5985 // in IE throws an error.
5986 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
5987 swap( elem, cssShow, function() {
5988 return getWidthOrHeight( elem, dimension, extra );
5989 } ) :
5990 getWidthOrHeight( elem, dimension, extra );
5991 }
5992 },
5993
5994 set: function( elem, value, extra ) {
5995 var matches,
5996 styles = getStyles( elem ),
5997
5998 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
5999 isBorderBox = extra &&
6000 jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
6001 subtract = extra ?
6002 boxModelAdjustment(
6003 elem,
6004 dimension,
6005 extra,
6006 isBorderBox,
6007 styles
6008 ) :
6009 0;
6010
6011 // Convert to pixels if value adjustment is needed
6012 if ( subtract && ( matches = rcssNum.exec( value ) ) &&
6013 ( matches[ 3 ] || "px" ) !== "px" ) {
6014
6015 elem.style[ dimension ] = value;
6016 value = jQuery.css( elem, dimension );
6017 }
6018
6019 return setPositiveNumber( elem, value, subtract );
6020 }
6021 };
6022} );
6023
6024// These hooks are used by animate to expand properties
6025jQuery.each( {
6026 margin: "",
6027 padding: "",
6028 border: "Width"
6029}, function( prefix, suffix ) {
6030 jQuery.cssHooks[ prefix + suffix ] = {
6031 expand: function( value ) {
6032 var i = 0,
6033 expanded = {},
6034
6035 // Assumes a single number if not a string
6036 parts = typeof value === "string" ? value.split( " " ) : [ value ];
6037
6038 for ( ; i < 4; i++ ) {
6039 expanded[ prefix + cssExpand[ i ] + suffix ] =
6040 parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
6041 }
6042
6043 return expanded;
6044 }
6045 };
6046
6047 if ( prefix !== "margin" ) {
6048 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
6049 }
6050} );
6051
6052jQuery.fn.extend( {
6053 css: function( name, value ) {
6054 return access( this, function( elem, name, value ) {
6055 var styles, len,
6056 map = {},
6057 i = 0;
6058
6059 if ( Array.isArray( name ) ) {
6060 styles = getStyles( elem );
6061 len = name.length;
6062
6063 for ( ; i < len; i++ ) {
6064 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
6065 }
6066
6067 return map;
6068 }
6069
6070 return value !== undefined ?
6071 jQuery.style( elem, name, value ) :
6072 jQuery.css( elem, name );
6073 }, name, value, arguments.length > 1 );
6074 }
6075} );
6076
6077function Tween( elem, options, prop, end, easing ) {
6078 return new Tween.prototype.init( elem, options, prop, end, easing );
6079}
6080jQuery.Tween = Tween;
6081
6082Tween.prototype = {
6083 constructor: Tween,
6084 init: function( elem, options, prop, end, easing, unit ) {
6085 this.elem = elem;
6086 this.prop = prop;
6087 this.easing = easing || jQuery.easing._default;
6088 this.options = options;
6089 this.start = this.now = this.cur();
6090 this.end = end;
6091 this.unit = unit || ( isAutoPx( prop ) ? "px" : "" );
6092 },
6093 cur: function() {
6094 var hooks = Tween.propHooks[ this.prop ];
6095
6096 return hooks && hooks.get ?
6097 hooks.get( this ) :
6098 Tween.propHooks._default.get( this );
6099 },
6100 run: function( percent ) {
6101 var eased,
6102 hooks = Tween.propHooks[ this.prop ];
6103
6104 if ( this.options.duration ) {
6105 this.pos = eased = jQuery.easing[ this.easing ](
6106 percent, this.options.duration * percent, 0, 1, this.options.duration
6107 );
6108 } else {
6109 this.pos = eased = percent;
6110 }
6111 this.now = ( this.end - this.start ) * eased + this.start;
6112
6113 if ( this.options.step ) {
6114 this.options.step.call( this.elem, this.now, this );
6115 }
6116
6117 if ( hooks && hooks.set ) {
6118 hooks.set( this );
6119 } else {
6120 Tween.propHooks._default.set( this );
6121 }
6122 return this;
6123 }
6124};
6125
6126Tween.prototype.init.prototype = Tween.prototype;
6127
6128Tween.propHooks = {
6129 _default: {
6130 get: function( tween ) {
6131 var result;
6132
6133 // Use a property on the element directly when it is not a DOM element,
6134 // or when there is no matching style property that exists.
6135 if ( tween.elem.nodeType !== 1 ||
6136 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
6137 return tween.elem[ tween.prop ];
6138 }
6139
6140 // Passing an empty string as a 3rd parameter to .css will automatically
6141 // attempt a parseFloat and fallback to a string if the parse fails.
6142 // Simple values such as "10px" are parsed to Float;
6143 // complex values such as "rotate(1rad)" are returned as-is.
6144 result = jQuery.css( tween.elem, tween.prop, "" );
6145
6146 // Empty strings, null, undefined and "auto" are converted to 0.
6147 return !result || result === "auto" ? 0 : result;
6148 },
6149 set: function( tween ) {
6150
6151 // Use step hook for back compat.
6152 // Use cssHook if its there.
6153 // Use .style if available and use plain properties where available.
6154 if ( jQuery.fx.step[ tween.prop ] ) {
6155 jQuery.fx.step[ tween.prop ]( tween );
6156 } else if ( tween.elem.nodeType === 1 && (
6157 jQuery.cssHooks[ tween.prop ] ||
6158 tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
6159 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
6160 } else {
6161 tween.elem[ tween.prop ] = tween.now;
6162 }
6163 }
6164 }
6165};
6166
6167jQuery.easing = {
6168 linear: function( p ) {
6169 return p;
6170 },
6171 swing: function( p ) {
6172 return 0.5 - Math.cos( p * Math.PI ) / 2;
6173 },
6174 _default: "swing"
6175};
6176
6177jQuery.fx = Tween.prototype.init;
6178
6179// Back compat <1.8 extension point
6180jQuery.fx.step = {};
6181
6182var
6183 fxNow, inProgress,
6184 rfxtypes = /^(?:toggle|show|hide)$/,
6185 rrun = /queueHooks$/;
6186
6187function schedule() {
6188 if ( inProgress ) {
6189 if ( document.hidden === false && window.requestAnimationFrame ) {
6190 window.requestAnimationFrame( schedule );
6191 } else {
6192 window.setTimeout( schedule, jQuery.fx.interval );
6193 }
6194
6195 jQuery.fx.tick();
6196 }
6197}
6198
6199// Animations created synchronously will run synchronously
6200function createFxNow() {
6201 window.setTimeout( function() {
6202 fxNow = undefined;
6203 } );
6204 return ( fxNow = Date.now() );
6205}
6206
6207// Generate parameters to create a standard animation
6208function genFx( type, includeWidth ) {
6209 var which,
6210 i = 0,
6211 attrs = { height: type };
6212
6213 // If we include width, step value is 1 to do all cssExpand values,
6214 // otherwise step value is 2 to skip over Left and Right
6215 includeWidth = includeWidth ? 1 : 0;
6216 for ( ; i < 4; i += 2 - includeWidth ) {
6217 which = cssExpand[ i ];
6218 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
6219 }
6220
6221 if ( includeWidth ) {
6222 attrs.opacity = attrs.width = type;
6223 }
6224
6225 return attrs;
6226}
6227
6228function createTween( value, prop, animation ) {
6229 var tween,
6230 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
6231 index = 0,
6232 length = collection.length;
6233 for ( ; index < length; index++ ) {
6234 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
6235
6236 // We're done with this property
6237 return tween;
6238 }
6239 }
6240}
6241
6242function defaultPrefilter( elem, props, opts ) {
6243 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
6244 isBox = "width" in props || "height" in props,
6245 anim = this,
6246 orig = {},
6247 style = elem.style,
6248 hidden = elem.nodeType && isHiddenWithinTree( elem ),
6249 dataShow = dataPriv.get( elem, "fxshow" );
6250
6251 // Queue-skipping animations hijack the fx hooks
6252 if ( !opts.queue ) {
6253 hooks = jQuery._queueHooks( elem, "fx" );
6254 if ( hooks.unqueued == null ) {
6255 hooks.unqueued = 0;
6256 oldfire = hooks.empty.fire;
6257 hooks.empty.fire = function() {
6258 if ( !hooks.unqueued ) {
6259 oldfire();
6260 }
6261 };
6262 }
6263 hooks.unqueued++;
6264
6265 anim.always( function() {
6266
6267 // Ensure the complete handler is called before this completes
6268 anim.always( function() {
6269 hooks.unqueued--;
6270 if ( !jQuery.queue( elem, "fx" ).length ) {
6271 hooks.empty.fire();
6272 }
6273 } );
6274 } );
6275 }
6276
6277 // Detect show/hide animations
6278 for ( prop in props ) {
6279 value = props[ prop ];
6280 if ( rfxtypes.test( value ) ) {
6281 delete props[ prop ];
6282 toggle = toggle || value === "toggle";
6283 if ( value === ( hidden ? "hide" : "show" ) ) {
6284
6285 // Pretend to be hidden if this is a "show" and
6286 // there is still data from a stopped show/hide
6287 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
6288 hidden = true;
6289
6290 // Ignore all other no-op show/hide data
6291 } else {
6292 continue;
6293 }
6294 }
6295 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
6296 }
6297 }
6298
6299 // Bail out if this is a no-op like .hide().hide()
6300 propTween = !jQuery.isEmptyObject( props );
6301 if ( !propTween && jQuery.isEmptyObject( orig ) ) {
6302 return;
6303 }
6304
6305 // Restrict "overflow" and "display" styles during box animations
6306 if ( isBox && elem.nodeType === 1 ) {
6307
6308 // Support: IE <=9 - 11+
6309 // Record all 3 overflow attributes because IE does not infer the shorthand
6310 // from identically-valued overflowX and overflowY.
6311 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
6312
6313 // Identify a display type, preferring old show/hide data over the CSS cascade
6314 restoreDisplay = dataShow && dataShow.display;
6315 if ( restoreDisplay == null ) {
6316 restoreDisplay = dataPriv.get( elem, "display" );
6317 }
6318 display = jQuery.css( elem, "display" );
6319 if ( display === "none" ) {
6320 if ( restoreDisplay ) {
6321 display = restoreDisplay;
6322 } else {
6323
6324 // Get nonempty value(s) by temporarily forcing visibility
6325 showHide( [ elem ], true );
6326 restoreDisplay = elem.style.display || restoreDisplay;
6327 display = jQuery.css( elem, "display" );
6328 showHide( [ elem ] );
6329 }
6330 }
6331
6332 // Animate inline elements as inline-block
6333 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
6334 if ( jQuery.css( elem, "float" ) === "none" ) {
6335
6336 // Restore the original display value at the end of pure show/hide animations
6337 if ( !propTween ) {
6338 anim.done( function() {
6339 style.display = restoreDisplay;
6340 } );
6341 if ( restoreDisplay == null ) {
6342 display = style.display;
6343 restoreDisplay = display === "none" ? "" : display;
6344 }
6345 }
6346 style.display = "inline-block";
6347 }
6348 }
6349 }
6350
6351 if ( opts.overflow ) {
6352 style.overflow = "hidden";
6353 anim.always( function() {
6354 style.overflow = opts.overflow[ 0 ];
6355 style.overflowX = opts.overflow[ 1 ];
6356 style.overflowY = opts.overflow[ 2 ];
6357 } );
6358 }
6359
6360 // Implement show/hide animations
6361 propTween = false;
6362 for ( prop in orig ) {
6363
6364 // General show/hide setup for this element animation
6365 if ( !propTween ) {
6366 if ( dataShow ) {
6367 if ( "hidden" in dataShow ) {
6368 hidden = dataShow.hidden;
6369 }
6370 } else {
6371 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
6372 }
6373
6374 // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
6375 if ( toggle ) {
6376 dataShow.hidden = !hidden;
6377 }
6378
6379 // Show elements before animating them
6380 if ( hidden ) {
6381 showHide( [ elem ], true );
6382 }
6383
6384 // eslint-disable-next-line no-loop-func
6385 anim.done( function() {
6386
6387 // The final step of a "hide" animation is actually hiding the element
6388 if ( !hidden ) {
6389 showHide( [ elem ] );
6390 }
6391 dataPriv.remove( elem, "fxshow" );
6392 for ( prop in orig ) {
6393 jQuery.style( elem, prop, orig[ prop ] );
6394 }
6395 } );
6396 }
6397
6398 // Per-property setup
6399 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
6400 if ( !( prop in dataShow ) ) {
6401 dataShow[ prop ] = propTween.start;
6402 if ( hidden ) {
6403 propTween.end = propTween.start;
6404 propTween.start = 0;
6405 }
6406 }
6407 }
6408}
6409
6410function propFilter( props, specialEasing ) {
6411 var index, name, easing, value, hooks;
6412
6413 // camelCase, specialEasing and expand cssHook pass
6414 for ( index in props ) {
6415 name = cssCamelCase( index );
6416 easing = specialEasing[ name ];
6417 value = props[ index ];
6418 if ( Array.isArray( value ) ) {
6419 easing = value[ 1 ];
6420 value = props[ index ] = value[ 0 ];
6421 }
6422
6423 if ( index !== name ) {
6424 props[ name ] = value;
6425 delete props[ index ];
6426 }
6427
6428 hooks = jQuery.cssHooks[ name ];
6429 if ( hooks && "expand" in hooks ) {
6430 value = hooks.expand( value );
6431 delete props[ name ];
6432
6433 // Not quite $.extend, this won't overwrite existing keys.
6434 // Reusing 'index' because we have the correct "name"
6435 for ( index in value ) {
6436 if ( !( index in props ) ) {
6437 props[ index ] = value[ index ];
6438 specialEasing[ index ] = easing;
6439 }
6440 }
6441 } else {
6442 specialEasing[ name ] = easing;
6443 }
6444 }
6445}
6446
6447function Animation( elem, properties, options ) {
6448 var result,
6449 stopped,
6450 index = 0,
6451 length = Animation.prefilters.length,
6452 deferred = jQuery.Deferred().always( function() {
6453
6454 // Don't match elem in the :animated selector
6455 delete tick.elem;
6456 } ),
6457 tick = function() {
6458 if ( stopped ) {
6459 return false;
6460 }
6461 var currentTime = fxNow || createFxNow(),
6462 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
6463
6464 percent = 1 - ( remaining / animation.duration || 0 ),
6465 index = 0,
6466 length = animation.tweens.length;
6467
6468 for ( ; index < length; index++ ) {
6469 animation.tweens[ index ].run( percent );
6470 }
6471
6472 deferred.notifyWith( elem, [ animation, percent, remaining ] );
6473
6474 // If there's more to do, yield
6475 if ( percent < 1 && length ) {
6476 return remaining;
6477 }
6478
6479 // If this was an empty animation, synthesize a final progress notification
6480 if ( !length ) {
6481 deferred.notifyWith( elem, [ animation, 1, 0 ] );
6482 }
6483
6484 // Resolve the animation and report its conclusion
6485 deferred.resolveWith( elem, [ animation ] );
6486 return false;
6487 },
6488 animation = deferred.promise( {
6489 elem: elem,
6490 props: jQuery.extend( {}, properties ),
6491 opts: jQuery.extend( true, {
6492 specialEasing: {},
6493 easing: jQuery.easing._default
6494 }, options ),
6495 originalProperties: properties,
6496 originalOptions: options,
6497 startTime: fxNow || createFxNow(),
6498 duration: options.duration,
6499 tweens: [],
6500 createTween: function( prop, end ) {
6501 var tween = jQuery.Tween( elem, animation.opts, prop, end,
6502 animation.opts.specialEasing[ prop ] || animation.opts.easing );
6503 animation.tweens.push( tween );
6504 return tween;
6505 },
6506 stop: function( gotoEnd ) {
6507 var index = 0,
6508
6509 // If we are going to the end, we want to run all the tweens
6510 // otherwise we skip this part
6511 length = gotoEnd ? animation.tweens.length : 0;
6512 if ( stopped ) {
6513 return this;
6514 }
6515 stopped = true;
6516 for ( ; index < length; index++ ) {
6517 animation.tweens[ index ].run( 1 );
6518 }
6519
6520 // Resolve when we played the last frame; otherwise, reject
6521 if ( gotoEnd ) {
6522 deferred.notifyWith( elem, [ animation, 1, 0 ] );
6523 deferred.resolveWith( elem, [ animation, gotoEnd ] );
6524 } else {
6525 deferred.rejectWith( elem, [ animation, gotoEnd ] );
6526 }
6527 return this;
6528 }
6529 } ),
6530 props = animation.props;
6531
6532 propFilter( props, animation.opts.specialEasing );
6533
6534 for ( ; index < length; index++ ) {
6535 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
6536 if ( result ) {
6537 if ( typeof result.stop === "function" ) {
6538 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
6539 result.stop.bind( result );
6540 }
6541 return result;
6542 }
6543 }
6544
6545 jQuery.map( props, createTween, animation );
6546
6547 if ( typeof animation.opts.start === "function" ) {
6548 animation.opts.start.call( elem, animation );
6549 }
6550
6551 // Attach callbacks from options
6552 animation
6553 .progress( animation.opts.progress )
6554 .done( animation.opts.done, animation.opts.complete )
6555 .fail( animation.opts.fail )
6556 .always( animation.opts.always );
6557
6558 jQuery.fx.timer(
6559 jQuery.extend( tick, {
6560 elem: elem,
6561 anim: animation,
6562 queue: animation.opts.queue
6563 } )
6564 );
6565
6566 return animation;
6567}
6568
6569jQuery.Animation = jQuery.extend( Animation, {
6570
6571 tweeners: {
6572 "*": [ function( prop, value ) {
6573 var tween = this.createTween( prop, value );
6574 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
6575 return tween;
6576 } ]
6577 },
6578
6579 tweener: function( props, callback ) {
6580 if ( typeof props === "function" ) {
6581 callback = props;
6582 props = [ "*" ];
6583 } else {
6584 props = props.match( rnothtmlwhite );
6585 }
6586
6587 var prop,
6588 index = 0,
6589 length = props.length;
6590
6591 for ( ; index < length; index++ ) {
6592 prop = props[ index ];
6593 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
6594 Animation.tweeners[ prop ].unshift( callback );
6595 }
6596 },
6597
6598 prefilters: [ defaultPrefilter ],
6599
6600 prefilter: function( callback, prepend ) {
6601 if ( prepend ) {
6602 Animation.prefilters.unshift( callback );
6603 } else {
6604 Animation.prefilters.push( callback );
6605 }
6606 }
6607} );
6608
6609jQuery.speed = function( speed, easing, fn ) {
6610 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
6611 complete: fn || !fn && easing ||
6612 typeof speed === "function" && speed,
6613 duration: speed,
6614 easing: fn && easing || easing && typeof easing !== "function" && easing
6615 };
6616
6617 // Go to the end state if fx are off
6618 if ( jQuery.fx.off ) {
6619 opt.duration = 0;
6620
6621 } else {
6622 if ( typeof opt.duration !== "number" ) {
6623 if ( opt.duration in jQuery.fx.speeds ) {
6624 opt.duration = jQuery.fx.speeds[ opt.duration ];
6625
6626 } else {
6627 opt.duration = jQuery.fx.speeds._default;
6628 }
6629 }
6630 }
6631
6632 // Normalize opt.queue - true/undefined/null -> "fx"
6633 if ( opt.queue == null || opt.queue === true ) {
6634 opt.queue = "fx";
6635 }
6636
6637 // Queueing
6638 opt.old = opt.complete;
6639
6640 opt.complete = function() {
6641 if ( typeof opt.old === "function" ) {
6642 opt.old.call( this );
6643 }
6644
6645 if ( opt.queue ) {
6646 jQuery.dequeue( this, opt.queue );
6647 }
6648 };
6649
6650 return opt;
6651};
6652
6653jQuery.fn.extend( {
6654 fadeTo: function( speed, to, easing, callback ) {
6655
6656 // Show any hidden elements after setting opacity to 0
6657 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
6658
6659 // Animate to the value specified
6660 .end().animate( { opacity: to }, speed, easing, callback );
6661 },
6662 animate: function( prop, speed, easing, callback ) {
6663 var empty = jQuery.isEmptyObject( prop ),
6664 optall = jQuery.speed( speed, easing, callback ),
6665 doAnimation = function() {
6666
6667 // Operate on a copy of prop so per-property easing won't be lost
6668 var anim = Animation( this, jQuery.extend( {}, prop ), optall );
6669
6670 // Empty animations, or finishing resolves immediately
6671 if ( empty || dataPriv.get( this, "finish" ) ) {
6672 anim.stop( true );
6673 }
6674 };
6675
6676 doAnimation.finish = doAnimation;
6677
6678 return empty || optall.queue === false ?
6679 this.each( doAnimation ) :
6680 this.queue( optall.queue, doAnimation );
6681 },
6682 stop: function( type, clearQueue, gotoEnd ) {
6683 var stopQueue = function( hooks ) {
6684 var stop = hooks.stop;
6685 delete hooks.stop;
6686 stop( gotoEnd );
6687 };
6688
6689 if ( typeof type !== "string" ) {
6690 gotoEnd = clearQueue;
6691 clearQueue = type;
6692 type = undefined;
6693 }
6694 if ( clearQueue ) {
6695 this.queue( type || "fx", [] );
6696 }
6697
6698 return this.each( function() {
6699 var dequeue = true,
6700 index = type != null && type + "queueHooks",
6701 timers = jQuery.timers,
6702 data = dataPriv.get( this );
6703
6704 if ( index ) {
6705 if ( data[ index ] && data[ index ].stop ) {
6706 stopQueue( data[ index ] );
6707 }
6708 } else {
6709 for ( index in data ) {
6710 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
6711 stopQueue( data[ index ] );
6712 }
6713 }
6714 }
6715
6716 for ( index = timers.length; index--; ) {
6717 if ( timers[ index ].elem === this &&
6718 ( type == null || timers[ index ].queue === type ) ) {
6719
6720 timers[ index ].anim.stop( gotoEnd );
6721 dequeue = false;
6722 timers.splice( index, 1 );
6723 }
6724 }
6725
6726 // Start the next in the queue if the last step wasn't forced.
6727 // Timers currently will call their complete callbacks, which
6728 // will dequeue but only if they were gotoEnd.
6729 if ( dequeue || !gotoEnd ) {
6730 jQuery.dequeue( this, type );
6731 }
6732 } );
6733 },
6734 finish: function( type ) {
6735 if ( type !== false ) {
6736 type = type || "fx";
6737 }
6738 return this.each( function() {
6739 var index,
6740 data = dataPriv.get( this ),
6741 queue = data[ type + "queue" ],
6742 hooks = data[ type + "queueHooks" ],
6743 timers = jQuery.timers,
6744 length = queue ? queue.length : 0;
6745
6746 // Enable finishing flag on private data
6747 data.finish = true;
6748
6749 // Empty the queue first
6750 jQuery.queue( this, type, [] );
6751
6752 if ( hooks && hooks.stop ) {
6753 hooks.stop.call( this, true );
6754 }
6755
6756 // Look for any active animations, and finish them
6757 for ( index = timers.length; index--; ) {
6758 if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
6759 timers[ index ].anim.stop( true );
6760 timers.splice( index, 1 );
6761 }
6762 }
6763
6764 // Look for any animations in the old queue and finish them
6765 for ( index = 0; index < length; index++ ) {
6766 if ( queue[ index ] && queue[ index ].finish ) {
6767 queue[ index ].finish.call( this );
6768 }
6769 }
6770
6771 // Turn off finishing flag
6772 delete data.finish;
6773 } );
6774 }
6775} );
6776
6777jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) {
6778 var cssFn = jQuery.fn[ name ];
6779 jQuery.fn[ name ] = function( speed, easing, callback ) {
6780 return speed == null || typeof speed === "boolean" ?
6781 cssFn.apply( this, arguments ) :
6782 this.animate( genFx( name, true ), speed, easing, callback );
6783 };
6784} );
6785
6786// Generate shortcuts for custom animations
6787jQuery.each( {
6788 slideDown: genFx( "show" ),
6789 slideUp: genFx( "hide" ),
6790 slideToggle: genFx( "toggle" ),
6791 fadeIn: { opacity: "show" },
6792 fadeOut: { opacity: "hide" },
6793 fadeToggle: { opacity: "toggle" }
6794}, function( name, props ) {
6795 jQuery.fn[ name ] = function( speed, easing, callback ) {
6796 return this.animate( props, speed, easing, callback );
6797 };
6798} );
6799
6800jQuery.timers = [];
6801jQuery.fx.tick = function() {
6802 var timer,
6803 i = 0,
6804 timers = jQuery.timers;
6805
6806 fxNow = Date.now();
6807
6808 for ( ; i < timers.length; i++ ) {
6809 timer = timers[ i ];
6810
6811 // Run the timer and safely remove it when done (allowing for external removal)
6812 if ( !timer() && timers[ i ] === timer ) {
6813 timers.splice( i--, 1 );
6814 }
6815 }
6816
6817 if ( !timers.length ) {
6818 jQuery.fx.stop();
6819 }
6820 fxNow = undefined;
6821};
6822
6823jQuery.fx.timer = function( timer ) {
6824 jQuery.timers.push( timer );
6825 jQuery.fx.start();
6826};
6827
6828jQuery.fx.interval = 13;
6829jQuery.fx.start = function() {
6830 if ( inProgress ) {
6831 return;
6832 }
6833
6834 inProgress = true;
6835 schedule();
6836};
6837
6838jQuery.fx.stop = function() {
6839 inProgress = null;
6840};
6841
6842jQuery.fx.speeds = {
6843 slow: 600,
6844 fast: 200,
6845
6846 // Default speed
6847 _default: 400
6848};
6849
6850// Based off of the plugin by Clint Helfers, with permission.
6851// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
6852jQuery.fn.delay = function( time, type ) {
6853 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
6854 type = type || "fx";
6855
6856 return this.queue( type, function( next, hooks ) {
6857 var timeout = window.setTimeout( next, time );
6858 hooks.stop = function() {
6859 window.clearTimeout( timeout );
6860 };
6861 } );
6862};
6863
6864jQuery.fn.extend( {
6865 attr: function( name, value ) {
6866 return access( this, jQuery.attr, name, value, arguments.length > 1 );
6867 },
6868
6869 removeAttr: function( name ) {
6870 return this.each( function() {
6871 jQuery.removeAttr( this, name );
6872 } );
6873 }
6874} );
6875
6876jQuery.extend( {
6877 attr: function( elem, name, value ) {
6878 var ret, hooks,
6879 nType = elem.nodeType;
6880
6881 // Don't get/set attributes on text, comment and attribute nodes
6882 if ( nType === 3 || nType === 8 || nType === 2 ) {
6883 return;
6884 }
6885
6886 // Fallback to prop when attributes are not supported
6887 if ( typeof elem.getAttribute === "undefined" ) {
6888 return jQuery.prop( elem, name, value );
6889 }
6890
6891 // Attribute hooks are determined by the lowercase version
6892 // Grab necessary hook if one is defined
6893 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
6894 hooks = jQuery.attrHooks[ name.toLowerCase() ];
6895 }
6896
6897 if ( value !== undefined ) {
6898 if ( value === null ) {
6899 jQuery.removeAttr( elem, name );
6900 return;
6901 }
6902
6903 if ( hooks && "set" in hooks &&
6904 ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
6905 return ret;
6906 }
6907
6908 elem.setAttribute( name, value + "" );
6909 return value;
6910 }
6911
6912 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
6913 return ret;
6914 }
6915
6916 ret = elem.getAttribute( name );
6917
6918 // Non-existent attributes return null, we normalize to undefined
6919 return ret == null ? undefined : ret;
6920 },
6921
6922 attrHooks: {},
6923
6924 removeAttr: function( elem, value ) {
6925 var name,
6926 i = 0,
6927
6928 // Attribute names can contain non-HTML whitespace characters
6929 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
6930 attrNames = value && value.match( rnothtmlwhite );
6931
6932 if ( attrNames && elem.nodeType === 1 ) {
6933 while ( ( name = attrNames[ i++ ] ) ) {
6934 elem.removeAttribute( name );
6935 }
6936 }
6937 }
6938} );
6939
6940// Support: IE <=11+
6941// An input loses its value after becoming a radio
6942if ( isIE ) {
6943 jQuery.attrHooks.type = {
6944 set: function( elem, value ) {
6945 if ( value === "radio" && nodeName( elem, "input" ) ) {
6946 var val = elem.value;
6947 elem.setAttribute( "type", value );
6948 if ( val ) {
6949 elem.value = val;
6950 }
6951 return value;
6952 }
6953 }
6954 };
6955}
6956
6957jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) {
6958 jQuery.attrHooks[ name ] = {
6959 get: function( elem ) {
6960 var ret,
6961 isXML = jQuery.isXMLDoc( elem ),
6962 lowercaseName = name.toLowerCase();
6963
6964 if ( !isXML ) {
6965 ret = elem.getAttribute( name ) != null ?
6966 lowercaseName :
6967 null;
6968 }
6969 return ret;
6970 },
6971
6972 set: function( elem, value, name ) {
6973 if ( value === false ) {
6974
6975 // Remove boolean attributes when set to false
6976 jQuery.removeAttr( elem, name );
6977 } else {
6978 elem.setAttribute( name, name );
6979 }
6980 return name;
6981 }
6982 };
6983} );
6984
6985var rfocusable = /^(?:input|select|textarea|button)$/i,
6986 rclickable = /^(?:a|area)$/i;
6987
6988jQuery.fn.extend( {
6989 prop: function( name, value ) {
6990 return access( this, jQuery.prop, name, value, arguments.length > 1 );
6991 },
6992
6993 removeProp: function( name ) {
6994 return this.each( function() {
6995 delete this[ jQuery.propFix[ name ] || name ];
6996 } );
6997 }
6998} );
6999
7000jQuery.extend( {
7001 prop: function( elem, name, value ) {
7002 var ret, hooks,
7003 nType = elem.nodeType;
7004
7005 // Don't get/set properties on text, comment and attribute nodes
7006 if ( nType === 3 || nType === 8 || nType === 2 ) {
7007 return;
7008 }
7009
7010 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
7011
7012 // Fix name and attach hooks
7013 name = jQuery.propFix[ name ] || name;
7014 hooks = jQuery.propHooks[ name ];
7015 }
7016
7017 if ( value !== undefined ) {
7018 if ( hooks && "set" in hooks &&
7019 ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
7020 return ret;
7021 }
7022
7023 return ( elem[ name ] = value );
7024 }
7025
7026 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
7027 return ret;
7028 }
7029
7030 return elem[ name ];
7031 },
7032
7033 propHooks: {
7034 tabIndex: {
7035 get: function( elem ) {
7036
7037 // Support: IE <=9 - 11+
7038 // elem.tabIndex doesn't always return the
7039 // correct value when it hasn't been explicitly set
7040 // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
7041 // Use proper attribute retrieval(#12072)
7042 var tabindex = elem.getAttribute( "tabindex" );
7043
7044 if ( tabindex ) {
7045 return parseInt( tabindex, 10 );
7046 }
7047
7048 if (
7049 rfocusable.test( elem.nodeName ) ||
7050
7051 // href-less anchor's `tabIndex` property value is `0` and
7052 // the `tabindex` attribute value: `null`. We want `-1`.
7053 rclickable.test( elem.nodeName ) && elem.href
7054 ) {
7055 return 0;
7056 }
7057
7058 return -1;
7059 }
7060 }
7061 },
7062
7063 propFix: {
7064 "for": "htmlFor",
7065 "class": "className"
7066 }
7067} );
7068
7069// Support: IE <=11+
7070// Accessing the selectedIndex property forces the browser to respect
7071// setting selected on the option. The getter ensures a default option
7072// is selected when in an optgroup. ESLint rule "no-unused-expressions"
7073// is disabled for this code since it considers such accessions noop.
7074if ( isIE ) {
7075 jQuery.propHooks.selected = {
7076 get: function( elem ) {
7077
7078 var parent = elem.parentNode;
7079 if ( parent && parent.parentNode ) {
7080 // eslint-disable-next-line no-unused-expressions
7081 parent.parentNode.selectedIndex;
7082 }
7083 return null;
7084 },
7085 set: function( elem ) {
7086
7087
7088 var parent = elem.parentNode;
7089 if ( parent ) {
7090 // eslint-disable-next-line no-unused-expressions
7091 parent.selectedIndex;
7092
7093 if ( parent.parentNode ) {
7094 // eslint-disable-next-line no-unused-expressions
7095 parent.parentNode.selectedIndex;
7096 }
7097 }
7098 }
7099 };
7100}
7101
7102jQuery.each( [
7103 "tabIndex",
7104 "readOnly",
7105 "maxLength",
7106 "cellSpacing",
7107 "cellPadding",
7108 "rowSpan",
7109 "colSpan",
7110 "useMap",
7111 "frameBorder",
7112 "contentEditable"
7113], function() {
7114 jQuery.propFix[ this.toLowerCase() ] = this;
7115} );
7116
7117// Strip and collapse whitespace according to HTML spec
7118// https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
7119function stripAndCollapse( value ) {
7120 var tokens = value.match( rnothtmlwhite ) || [];
7121 return tokens.join( " " );
7122}
7123
7124function getClass( elem ) {
7125 return elem.getAttribute && elem.getAttribute( "class" ) || "";
7126}
7127
7128function classesToArray( value ) {
7129 if ( Array.isArray( value ) ) {
7130 return value;
7131 }
7132 if ( typeof value === "string" ) {
7133 return value.match( rnothtmlwhite ) || [];
7134 }
7135 return [];
7136}
7137
7138jQuery.fn.extend( {
7139 addClass: function( value ) {
7140 var classes, elem, cur, curValue, clazz, j, finalValue,
7141 i = 0;
7142
7143 if ( typeof value === "function" ) {
7144 return this.each( function( j ) {
7145 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
7146 } );
7147 }
7148
7149 classes = classesToArray( value );
7150
7151 if ( classes.length ) {
7152 while ( ( elem = this[ i++ ] ) ) {
7153 curValue = getClass( elem );
7154 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
7155
7156 if ( cur ) {
7157 j = 0;
7158 while ( ( clazz = classes[ j++ ] ) ) {
7159 if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
7160 cur += clazz + " ";
7161 }
7162 }
7163
7164 // Only assign if different to avoid unneeded rendering.
7165 finalValue = stripAndCollapse( cur );
7166 if ( curValue !== finalValue ) {
7167 elem.setAttribute( "class", finalValue );
7168 }
7169 }
7170 }
7171 }
7172
7173 return this;
7174 },
7175
7176 removeClass: function( value ) {
7177 var classes, elem, cur, curValue, clazz, j, finalValue,
7178 i = 0;
7179
7180 if ( typeof value === "function" ) {
7181 return this.each( function( j ) {
7182 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
7183 } );
7184 }
7185
7186 if ( !arguments.length ) {
7187 return this.attr( "class", "" );
7188 }
7189
7190 classes = classesToArray( value );
7191
7192 if ( classes.length ) {
7193 while ( ( elem = this[ i++ ] ) ) {
7194 curValue = getClass( elem );
7195
7196 // This expression is here for better compressibility (see addClass)
7197 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
7198
7199 if ( cur ) {
7200 j = 0;
7201 while ( ( clazz = classes[ j++ ] ) ) {
7202
7203 // Remove *all* instances
7204 while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
7205 cur = cur.replace( " " + clazz + " ", " " );
7206 }
7207 }
7208
7209 // Only assign if different to avoid unneeded rendering.
7210 finalValue = stripAndCollapse( cur );
7211 if ( curValue !== finalValue ) {
7212 elem.setAttribute( "class", finalValue );
7213 }
7214 }
7215 }
7216 }
7217
7218 return this;
7219 },
7220
7221 toggleClass: function( value, stateVal ) {
7222 if ( typeof value === "function" ) {
7223 return this.each( function( i ) {
7224 jQuery( this ).toggleClass(
7225 value.call( this, i, getClass( this ), stateVal ),
7226 stateVal
7227 );
7228 } );
7229 }
7230
7231 if ( typeof stateVal === "boolean" ) {
7232 return stateVal ? this.addClass( value ) : this.removeClass( value );
7233 }
7234
7235 return this.each( function() {
7236 var className, i, self, classNames;
7237
7238 // Toggle individual class names
7239 i = 0;
7240 self = jQuery( this );
7241 classNames = classesToArray( value );
7242
7243 while ( ( className = classNames[ i++ ] ) ) {
7244
7245 // Check each className given, space separated list
7246 if ( self.hasClass( className ) ) {
7247 self.removeClass( className );
7248 } else {
7249 self.addClass( className );
7250 }
7251 }
7252 } );
7253 },
7254
7255 hasClass: function( selector ) {
7256 var className, elem,
7257 i = 0;
7258
7259 className = " " + selector + " ";
7260 while ( ( elem = this[ i++ ] ) ) {
7261 if ( elem.nodeType === 1 &&
7262 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
7263 return true;
7264 }
7265 }
7266
7267 return false;
7268 }
7269} );
7270
7271jQuery.fn.extend( {
7272 val: function( value ) {
7273 var hooks, ret, valueIsFunction,
7274 elem = this[ 0 ];
7275
7276 if ( !arguments.length ) {
7277 if ( elem ) {
7278 hooks = jQuery.valHooks[ elem.type ] ||
7279 jQuery.valHooks[ elem.nodeName.toLowerCase() ];
7280
7281 if ( hooks &&
7282 "get" in hooks &&
7283 ( ret = hooks.get( elem, "value" ) ) !== undefined
7284 ) {
7285 return ret;
7286 }
7287
7288 ret = elem.value;
7289
7290 // Handle cases where value is null/undef or number
7291 return ret == null ? "" : ret;
7292 }
7293
7294 return;
7295 }
7296
7297 valueIsFunction = typeof value === "function";
7298
7299 return this.each( function( i ) {
7300 var val;
7301
7302 if ( this.nodeType !== 1 ) {
7303 return;
7304 }
7305
7306 if ( valueIsFunction ) {
7307 val = value.call( this, i, jQuery( this ).val() );
7308 } else {
7309 val = value;
7310 }
7311
7312 // Treat null/undefined as ""; convert numbers to string
7313 if ( val == null ) {
7314 val = "";
7315
7316 } else if ( typeof val === "number" ) {
7317 val += "";
7318
7319 } else if ( Array.isArray( val ) ) {
7320 val = jQuery.map( val, function( value ) {
7321 return value == null ? "" : value + "";
7322 } );
7323 }
7324
7325 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
7326
7327 // If set returns undefined, fall back to normal setting
7328 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
7329 this.value = val;
7330 }
7331 } );
7332 }
7333} );
7334
7335jQuery.extend( {
7336 valHooks: {
7337 select: {
7338 get: function( elem ) {
7339 var value, option, i,
7340 options = elem.options,
7341 index = elem.selectedIndex,
7342 one = elem.type === "select-one",
7343 values = one ? null : [],
7344 max = one ? index + 1 : options.length;
7345
7346 if ( index < 0 ) {
7347 i = max;
7348
7349 } else {
7350 i = one ? index : 0;
7351 }
7352
7353 // Loop through all the selected options
7354 for ( ; i < max; i++ ) {
7355 option = options[ i ];
7356
7357 if ( option.selected &&
7358
7359 // Don't return options that are disabled or in a disabled optgroup
7360 !option.disabled &&
7361 ( !option.parentNode.disabled ||
7362 !nodeName( option.parentNode, "optgroup" ) ) ) {
7363
7364 // Get the specific value for the option
7365 value = jQuery( option ).val();
7366
7367 // We don't need an array for one selects
7368 if ( one ) {
7369 return value;
7370 }
7371
7372 // Multi-Selects return an array
7373 values.push( value );
7374 }
7375 }
7376
7377 return values;
7378 },
7379
7380 set: function( elem, value ) {
7381 var optionSet, option,
7382 options = elem.options,
7383 values = jQuery.makeArray( value ),
7384 i = options.length;
7385
7386 while ( i-- ) {
7387 option = options[ i ];
7388
7389 if ( ( option.selected =
7390 jQuery.inArray( jQuery( option ).val(), values ) > -1
7391 ) ) {
7392 optionSet = true;
7393 }
7394 }
7395
7396 // Force browsers to behave consistently when non-matching value is set
7397 if ( !optionSet ) {
7398 elem.selectedIndex = -1;
7399 }
7400 return values;
7401 }
7402 }
7403 }
7404} );
7405
7406if ( isIE ) {
7407 jQuery.valHooks.option = {
7408 get: function( elem ) {
7409
7410 var val = elem.getAttribute( "value" );
7411 return val != null ?
7412 val :
7413
7414 // Support: IE <=10 - 11+
7415 // option.text throws exceptions (#14686, #14858)
7416 // Strip and collapse whitespace
7417 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
7418 stripAndCollapse( jQuery.text( elem ) );
7419 }
7420 };
7421}
7422
7423// Radios and checkboxes getter/setter
7424jQuery.each( [ "radio", "checkbox" ], function() {
7425 jQuery.valHooks[ this ] = {
7426 set: function( elem, value ) {
7427 if ( Array.isArray( value ) ) {
7428 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
7429 }
7430 }
7431 };
7432} );
7433
7434var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
7435 stopPropagationCallback = function( e ) {
7436 e.stopPropagation();
7437 };
7438
7439jQuery.extend( jQuery.event, {
7440
7441 trigger: function( event, data, elem, onlyHandlers ) {
7442
7443 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
7444 eventPath = [ elem || document ],
7445 type = hasOwn.call( event, "type" ) ? event.type : event,
7446 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
7447
7448 cur = lastElement = tmp = elem = elem || document;
7449
7450 // Don't do events on text and comment nodes
7451 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
7452 return;
7453 }
7454
7455 // focus/blur morphs to focusin/out; ensure we're not firing them right now
7456 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
7457 return;
7458 }
7459
7460 if ( type.indexOf( "." ) > -1 ) {
7461
7462 // Namespaced trigger; create a regexp to match event type in handle()
7463 namespaces = type.split( "." );
7464 type = namespaces.shift();
7465 namespaces.sort();
7466 }
7467 ontype = type.indexOf( ":" ) < 0 && "on" + type;
7468
7469 // Caller can pass in a jQuery.Event object, Object, or just an event type string
7470 event = event[ jQuery.expando ] ?
7471 event :
7472 new jQuery.Event( type, typeof event === "object" && event );
7473
7474 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
7475 event.isTrigger = onlyHandlers ? 2 : 3;
7476 event.namespace = namespaces.join( "." );
7477 event.rnamespace = event.namespace ?
7478 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
7479 null;
7480
7481 // Clean up the event in case it is being reused
7482 event.result = undefined;
7483 if ( !event.target ) {
7484 event.target = elem;
7485 }
7486
7487 // Clone any incoming data and prepend the event, creating the handler arg list
7488 data = data == null ?
7489 [ event ] :
7490 jQuery.makeArray( data, [ event ] );
7491
7492 // Allow special events to draw outside the lines
7493 special = jQuery.event.special[ type ] || {};
7494 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
7495 return;
7496 }
7497
7498 // Determine event propagation path in advance, per W3C events spec (#9951)
7499 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
7500 if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
7501
7502 bubbleType = special.delegateType || type;
7503 if ( !rfocusMorph.test( bubbleType + type ) ) {
7504 cur = cur.parentNode;
7505 }
7506 for ( ; cur; cur = cur.parentNode ) {
7507 eventPath.push( cur );
7508 tmp = cur;
7509 }
7510
7511 // Only add window if we got to document (e.g., not plain obj or detached DOM)
7512 if ( tmp === ( elem.ownerDocument || document ) ) {
7513 eventPath.push( tmp.defaultView || tmp.parentWindow || window );
7514 }
7515 }
7516
7517 // Fire handlers on the event path
7518 i = 0;
7519 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
7520 lastElement = cur;
7521 event.type = i > 1 ?
7522 bubbleType :
7523 special.bindType || type;
7524
7525 // jQuery handler
7526 handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] &&
7527 dataPriv.get( cur, "handle" );
7528 if ( handle ) {
7529 handle.apply( cur, data );
7530 }
7531
7532 // Native handler
7533 handle = ontype && cur[ ontype ];
7534 if ( handle && handle.apply && acceptData( cur ) ) {
7535 event.result = handle.apply( cur, data );
7536 if ( event.result === false ) {
7537 event.preventDefault();
7538 }
7539 }
7540 }
7541 event.type = type;
7542
7543 // If nobody prevented the default action, do it now
7544 if ( !onlyHandlers && !event.isDefaultPrevented() ) {
7545
7546 if ( ( !special._default ||
7547 special._default.apply( eventPath.pop(), data ) === false ) &&
7548 acceptData( elem ) ) {
7549
7550 // Call a native DOM method on the target with the same name as the event.
7551 // Don't do default actions on window, that's where global variables be (#6170)
7552 if ( ontype && typeof elem[ type ] === "function" && !isWindow( elem ) ) {
7553
7554 // Don't re-trigger an onFOO event when we call its FOO() method
7555 tmp = elem[ ontype ];
7556
7557 if ( tmp ) {
7558 elem[ ontype ] = null;
7559 }
7560
7561 // Prevent re-triggering of the same event, since we already bubbled it above
7562 jQuery.event.triggered = type;
7563
7564 if ( event.isPropagationStopped() ) {
7565 lastElement.addEventListener( type, stopPropagationCallback );
7566 }
7567
7568 elem[ type ]();
7569
7570 if ( event.isPropagationStopped() ) {
7571 lastElement.removeEventListener( type, stopPropagationCallback );
7572 }
7573
7574 jQuery.event.triggered = undefined;
7575
7576 if ( tmp ) {
7577 elem[ ontype ] = tmp;
7578 }
7579 }
7580 }
7581 }
7582
7583 return event.result;
7584 },
7585
7586 // Piggyback on a donor event to simulate a different one
7587 // Used only for `focus(in | out)` events
7588 simulate: function( type, elem, event ) {
7589 var e = jQuery.extend(
7590 new jQuery.Event(),
7591 event,
7592 {
7593 type: type,
7594 isSimulated: true
7595 }
7596 );
7597
7598 jQuery.event.trigger( e, null, elem );
7599 }
7600
7601} );
7602
7603jQuery.fn.extend( {
7604
7605 trigger: function( type, data ) {
7606 return this.each( function() {
7607 jQuery.event.trigger( type, data, this );
7608 } );
7609 },
7610 triggerHandler: function( type, data ) {
7611 var elem = this[ 0 ];
7612 if ( elem ) {
7613 return jQuery.event.trigger( type, data, elem, true );
7614 }
7615 }
7616} );
7617
7618var location = window.location;
7619
7620var nonce = { guid: Date.now() };
7621
7622var rquery = ( /\?/ );
7623
7624// Cross-browser xml parsing
7625jQuery.parseXML = function( data ) {
7626 var xml;
7627 if ( !data || typeof data !== "string" ) {
7628 return null;
7629 }
7630
7631 // Support: IE 9 - 11+
7632 // IE throws on parseFromString with invalid input.
7633 try {
7634 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
7635 } catch ( e ) {
7636 xml = undefined;
7637 }
7638
7639 if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
7640 jQuery.error( "Invalid XML: " + data );
7641 }
7642 return xml;
7643};
7644
7645var
7646 rbracket = /\[\]$/,
7647 rCRLF = /\r?\n/g,
7648 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
7649 rsubmittable = /^(?:input|select|textarea|keygen)/i;
7650
7651function buildParams( prefix, obj, traditional, add ) {
7652 var name;
7653
7654 if ( Array.isArray( obj ) ) {
7655
7656 // Serialize array item.
7657 jQuery.each( obj, function( i, v ) {
7658 if ( traditional || rbracket.test( prefix ) ) {
7659
7660 // Treat each array item as a scalar.
7661 add( prefix, v );
7662
7663 } else {
7664
7665 // Item is non-scalar (array or object), encode its numeric index.
7666 buildParams(
7667 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
7668 v,
7669 traditional,
7670 add
7671 );
7672 }
7673 } );
7674
7675 } else if ( !traditional && toType( obj ) === "object" ) {
7676
7677 // Serialize object item.
7678 for ( name in obj ) {
7679 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
7680 }
7681
7682 } else {
7683
7684 // Serialize scalar item.
7685 add( prefix, obj );
7686 }
7687}
7688
7689// Serialize an array of form elements or a set of
7690// key/values into a query string
7691jQuery.param = function( a, traditional ) {
7692 var prefix,
7693 s = [],
7694 add = function( key, valueOrFunction ) {
7695
7696 // If value is a function, invoke it and use its return value
7697 var value = typeof valueOrFunction === "function" ?
7698 valueOrFunction() :
7699 valueOrFunction;
7700
7701 s[ s.length ] = encodeURIComponent( key ) + "=" +
7702 encodeURIComponent( value == null ? "" : value );
7703 };
7704
7705 if ( a == null ) {
7706 return "";
7707 }
7708
7709 // If an array was passed in, assume that it is an array of form elements.
7710 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
7711
7712 // Serialize the form elements
7713 jQuery.each( a, function() {
7714 add( this.name, this.value );
7715 } );
7716
7717 } else {
7718
7719 // If traditional, encode the "old" way (the way 1.3.2 or older
7720 // did it), otherwise encode params recursively.
7721 for ( prefix in a ) {
7722 buildParams( prefix, a[ prefix ], traditional, add );
7723 }
7724 }
7725
7726 // Return the resulting serialization
7727 return s.join( "&" );
7728};
7729
7730jQuery.fn.extend( {
7731 serialize: function() {
7732 return jQuery.param( this.serializeArray() );
7733 },
7734 serializeArray: function() {
7735 return this.map( function() {
7736
7737 // Can add propHook for "elements" to filter or add form elements
7738 var elements = jQuery.prop( this, "elements" );
7739 return elements ? jQuery.makeArray( elements ) : this;
7740 } ).filter( function() {
7741 var type = this.type;
7742
7743 // Use .is( ":disabled" ) so that fieldset[disabled] works
7744 return this.name && !jQuery( this ).is( ":disabled" ) &&
7745 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
7746 ( this.checked || !rcheckableType.test( type ) );
7747 } ).map( function( _i, elem ) {
7748 var val = jQuery( this ).val();
7749
7750 if ( val == null ) {
7751 return null;
7752 }
7753
7754 if ( Array.isArray( val ) ) {
7755 return jQuery.map( val, function( val ) {
7756 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
7757 } );
7758 }
7759
7760 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
7761 } ).get();
7762 }
7763} );
7764
7765var
7766 r20 = /%20/g,
7767 rhash = /#.*$/,
7768 rantiCache = /([?&])_=[^&]*/,
7769 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
7770
7771 // #7653, #8125, #8152: local protocol detection
7772 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
7773 rnoContent = /^(?:GET|HEAD)$/,
7774 rprotocol = /^\/\//,
7775
7776 /* Prefilters
7777 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
7778 * 2) These are called:
7779 * - BEFORE asking for a transport
7780 * - AFTER param serialization (s.data is a string if s.processData is true)
7781 * 3) key is the dataType
7782 * 4) the catchall symbol "*" can be used
7783 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
7784 */
7785 prefilters = {},
7786
7787 /* Transports bindings
7788 * 1) key is the dataType
7789 * 2) the catchall symbol "*" can be used
7790 * 3) selection will start with transport dataType and THEN go to "*" if needed
7791 */
7792 transports = {},
7793
7794 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
7795 allTypes = "*/".concat( "*" ),
7796
7797 // Anchor tag for parsing the document origin
7798 originAnchor = document.createElement( "a" );
7799
7800originAnchor.href = location.href;
7801
7802// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
7803function addToPrefiltersOrTransports( structure ) {
7804
7805 // dataTypeExpression is optional and defaults to "*"
7806 return function( dataTypeExpression, func ) {
7807
7808 if ( typeof dataTypeExpression !== "string" ) {
7809 func = dataTypeExpression;
7810 dataTypeExpression = "*";
7811 }
7812
7813 var dataType,
7814 i = 0,
7815 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
7816
7817 if ( typeof func === "function" ) {
7818
7819 // For each dataType in the dataTypeExpression
7820 while ( ( dataType = dataTypes[ i++ ] ) ) {
7821
7822 // Prepend if requested
7823 if ( dataType[ 0 ] === "+" ) {
7824 dataType = dataType.slice( 1 ) || "*";
7825 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
7826
7827 // Otherwise append
7828 } else {
7829 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
7830 }
7831 }
7832 }
7833 };
7834}
7835
7836// Base inspection function for prefilters and transports
7837function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
7838
7839 var inspected = {},
7840 seekingTransport = ( structure === transports );
7841
7842 function inspect( dataType ) {
7843 var selected;
7844 inspected[ dataType ] = true;
7845 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
7846 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
7847 if ( typeof dataTypeOrTransport === "string" &&
7848 !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
7849
7850 options.dataTypes.unshift( dataTypeOrTransport );
7851 inspect( dataTypeOrTransport );
7852 return false;
7853 } else if ( seekingTransport ) {
7854 return !( selected = dataTypeOrTransport );
7855 }
7856 } );
7857 return selected;
7858 }
7859
7860 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
7861}
7862
7863// A special extend for ajax options
7864// that takes "flat" options (not to be deep extended)
7865// Fixes #9887
7866function ajaxExtend( target, src ) {
7867 var key, deep,
7868 flatOptions = jQuery.ajaxSettings.flatOptions || {};
7869
7870 for ( key in src ) {
7871 if ( src[ key ] !== undefined ) {
7872 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
7873 }
7874 }
7875 if ( deep ) {
7876 jQuery.extend( true, target, deep );
7877 }
7878
7879 return target;
7880}
7881
7882/* Handles responses to an ajax request:
7883 * - finds the right dataType (mediates between content-type and expected dataType)
7884 * - returns the corresponding response
7885 */
7886function ajaxHandleResponses( s, jqXHR, responses ) {
7887
7888 var ct, type, finalDataType, firstDataType,
7889 contents = s.contents,
7890 dataTypes = s.dataTypes;
7891
7892 // Remove auto dataType and get content-type in the process
7893 while ( dataTypes[ 0 ] === "*" ) {
7894 dataTypes.shift();
7895 if ( ct === undefined ) {
7896 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
7897 }
7898 }
7899
7900 // Check if we're dealing with a known content-type
7901 if ( ct ) {
7902 for ( type in contents ) {
7903 if ( contents[ type ] && contents[ type ].test( ct ) ) {
7904 dataTypes.unshift( type );
7905 break;
7906 }
7907 }
7908 }
7909
7910 // Check to see if we have a response for the expected dataType
7911 if ( dataTypes[ 0 ] in responses ) {
7912 finalDataType = dataTypes[ 0 ];
7913 } else {
7914
7915 // Try convertible dataTypes
7916 for ( type in responses ) {
7917 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
7918 finalDataType = type;
7919 break;
7920 }
7921 if ( !firstDataType ) {
7922 firstDataType = type;
7923 }
7924 }
7925
7926 // Or just use first one
7927 finalDataType = finalDataType || firstDataType;
7928 }
7929
7930 // If we found a dataType
7931 // We add the dataType to the list if needed
7932 // and return the corresponding response
7933 if ( finalDataType ) {
7934 if ( finalDataType !== dataTypes[ 0 ] ) {
7935 dataTypes.unshift( finalDataType );
7936 }
7937 return responses[ finalDataType ];
7938 }
7939}
7940
7941/* Chain conversions given the request and the original response
7942 * Also sets the responseXXX fields on the jqXHR instance
7943 */
7944function ajaxConvert( s, response, jqXHR, isSuccess ) {
7945 var conv2, current, conv, tmp, prev,
7946 converters = {},
7947
7948 // Work with a copy of dataTypes in case we need to modify it for conversion
7949 dataTypes = s.dataTypes.slice();
7950
7951 // Create converters map with lowercased keys
7952 if ( dataTypes[ 1 ] ) {
7953 for ( conv in s.converters ) {
7954 converters[ conv.toLowerCase() ] = s.converters[ conv ];
7955 }
7956 }
7957
7958 current = dataTypes.shift();
7959
7960 // Convert to each sequential dataType
7961 while ( current ) {
7962
7963 if ( s.responseFields[ current ] ) {
7964 jqXHR[ s.responseFields[ current ] ] = response;
7965 }
7966
7967 // Apply the dataFilter if provided
7968 if ( !prev && isSuccess && s.dataFilter ) {
7969 response = s.dataFilter( response, s.dataType );
7970 }
7971
7972 prev = current;
7973 current = dataTypes.shift();
7974
7975 if ( current ) {
7976
7977 // There's only work to do if current dataType is non-auto
7978 if ( current === "*" ) {
7979
7980 current = prev;
7981
7982 // Convert response if prev dataType is non-auto and differs from current
7983 } else if ( prev !== "*" && prev !== current ) {
7984
7985 // Seek a direct converter
7986 conv = converters[ prev + " " + current ] || converters[ "* " + current ];
7987
7988 // If none found, seek a pair
7989 if ( !conv ) {
7990 for ( conv2 in converters ) {
7991
7992 // If conv2 outputs current
7993 tmp = conv2.split( " " );
7994 if ( tmp[ 1 ] === current ) {
7995
7996 // If prev can be converted to accepted input
7997 conv = converters[ prev + " " + tmp[ 0 ] ] ||
7998 converters[ "* " + tmp[ 0 ] ];
7999 if ( conv ) {
8000
8001 // Condense equivalence converters
8002 if ( conv === true ) {
8003 conv = converters[ conv2 ];
8004
8005 // Otherwise, insert the intermediate dataType
8006 } else if ( converters[ conv2 ] !== true ) {
8007 current = tmp[ 0 ];
8008 dataTypes.unshift( tmp[ 1 ] );
8009 }
8010 break;
8011 }
8012 }
8013 }
8014 }
8015
8016 // Apply converter (if not an equivalence)
8017 if ( conv !== true ) {
8018
8019 // Unless errors are allowed to bubble, catch and return them
8020 if ( conv && s.throws ) {
8021 response = conv( response );
8022 } else {
8023 try {
8024 response = conv( response );
8025 } catch ( e ) {
8026 return {
8027 state: "parsererror",
8028 error: conv ? e : "No conversion from " + prev + " to " + current
8029 };
8030 }
8031 }
8032 }
8033 }
8034 }
8035 }
8036
8037 return { state: "success", data: response };
8038}
8039
8040jQuery.extend( {
8041
8042 // Counter for holding the number of active queries
8043 active: 0,
8044
8045 // Last-Modified header cache for next request
8046 lastModified: {},
8047 etag: {},
8048
8049 ajaxSettings: {
8050 url: location.href,
8051 type: "GET",
8052 isLocal: rlocalProtocol.test( location.protocol ),
8053 global: true,
8054 processData: true,
8055 async: true,
8056 contentType: "application/x-www-form-urlencoded; charset=UTF-8",
8057
8058 /*
8059 timeout: 0,
8060 data: null,
8061 dataType: null,
8062 username: null,
8063 password: null,
8064 cache: null,
8065 throws: false,
8066 traditional: false,
8067 headers: {},
8068 */
8069
8070 accepts: {
8071 "*": allTypes,
8072 text: "text/plain",
8073 html: "text/html",
8074 xml: "application/xml, text/xml",
8075 json: "application/json, text/javascript"
8076 },
8077
8078 contents: {
8079 xml: /\bxml\b/,
8080 html: /\bhtml/,
8081 json: /\bjson\b/
8082 },
8083
8084 responseFields: {
8085 xml: "responseXML",
8086 text: "responseText",
8087 json: "responseJSON"
8088 },
8089
8090 // Data converters
8091 // Keys separate source (or catchall "*") and destination types with a single space
8092 converters: {
8093
8094 // Convert anything to text
8095 "* text": String,
8096
8097 // Text to html (true = no transformation)
8098 "text html": true,
8099
8100 // Evaluate text as a json expression
8101 "text json": JSON.parse,
8102
8103 // Parse text as xml
8104 "text xml": jQuery.parseXML
8105 },
8106
8107 // For options that shouldn't be deep extended:
8108 // you can add your own custom options here if
8109 // and when you create one that shouldn't be
8110 // deep extended (see ajaxExtend)
8111 flatOptions: {
8112 url: true,
8113 context: true
8114 }
8115 },
8116
8117 // Creates a full fledged settings object into target
8118 // with both ajaxSettings and settings fields.
8119 // If target is omitted, writes into ajaxSettings.
8120 ajaxSetup: function( target, settings ) {
8121 return settings ?
8122
8123 // Building a settings object
8124 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
8125
8126 // Extending ajaxSettings
8127 ajaxExtend( jQuery.ajaxSettings, target );
8128 },
8129
8130 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
8131 ajaxTransport: addToPrefiltersOrTransports( transports ),
8132
8133 // Main method
8134 ajax: function( url, options ) {
8135
8136 // If url is an object, simulate pre-1.5 signature
8137 if ( typeof url === "object" ) {
8138 options = url;
8139 url = undefined;
8140 }
8141
8142 // Force options to be an object
8143 options = options || {};
8144
8145 var transport,
8146
8147 // URL without anti-cache param
8148 cacheURL,
8149
8150 // Response headers
8151 responseHeadersString,
8152 responseHeaders,
8153
8154 // timeout handle
8155 timeoutTimer,
8156
8157 // Url cleanup var
8158 urlAnchor,
8159
8160 // Request state (becomes false upon send and true upon completion)
8161 completed,
8162
8163 // To know if global events are to be dispatched
8164 fireGlobals,
8165
8166 // Loop variable
8167 i,
8168
8169 // uncached part of the url
8170 uncached,
8171
8172 // Create the final options object
8173 s = jQuery.ajaxSetup( {}, options ),
8174
8175 // Callbacks context
8176 callbackContext = s.context || s,
8177
8178 // Context for global events is callbackContext if it is a DOM node or jQuery collection
8179 globalEventContext = s.context &&
8180 ( callbackContext.nodeType || callbackContext.jquery ) ?
8181 jQuery( callbackContext ) :
8182 jQuery.event,
8183
8184 // Deferreds
8185 deferred = jQuery.Deferred(),
8186 completeDeferred = jQuery.Callbacks( "once memory" ),
8187
8188 // Status-dependent callbacks
8189 statusCode = s.statusCode || {},
8190
8191 // Headers (they are sent all at once)
8192 requestHeaders = {},
8193 requestHeadersNames = {},
8194
8195 // Default abort message
8196 strAbort = "canceled",
8197
8198 // Fake xhr
8199 jqXHR = {
8200 readyState: 0,
8201
8202 // Builds headers hashtable if needed
8203 getResponseHeader: function( key ) {
8204 var match;
8205 if ( completed ) {
8206 if ( !responseHeaders ) {
8207 responseHeaders = {};
8208 while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
8209
8210 // Support: IE 11+
8211 // `getResponseHeader( key )` in IE doesn't combine all header
8212 // values for the provided key into a single result with values
8213 // joined by commas as other browsers do. Instead, it returns
8214 // them on separate lines.
8215 responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
8216 ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
8217 .concat( match[ 2 ] );
8218 }
8219 }
8220 match = responseHeaders[ key.toLowerCase() + " " ];
8221 }
8222 return match == null ? null : match.join( ", " );
8223 },
8224
8225 // Raw string
8226 getAllResponseHeaders: function() {
8227 return completed ? responseHeadersString : null;
8228 },
8229
8230 // Caches the header
8231 setRequestHeader: function( name, value ) {
8232 if ( completed == null ) {
8233 name = requestHeadersNames[ name.toLowerCase() ] =
8234 requestHeadersNames[ name.toLowerCase() ] || name;
8235 requestHeaders[ name ] = value;
8236 }
8237 return this;
8238 },
8239
8240 // Overrides response content-type header
8241 overrideMimeType: function( type ) {
8242 if ( completed == null ) {
8243 s.mimeType = type;
8244 }
8245 return this;
8246 },
8247
8248 // Status-dependent callbacks
8249 statusCode: function( map ) {
8250 var code;
8251 if ( map ) {
8252 if ( completed ) {
8253
8254 // Execute the appropriate callbacks
8255 jqXHR.always( map[ jqXHR.status ] );
8256 } else {
8257
8258 // Lazy-add the new callbacks in a way that preserves old ones
8259 for ( code in map ) {
8260 statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
8261 }
8262 }
8263 }
8264 return this;
8265 },
8266
8267 // Cancel the request
8268 abort: function( statusText ) {
8269 var finalText = statusText || strAbort;
8270 if ( transport ) {
8271 transport.abort( finalText );
8272 }
8273 done( 0, finalText );
8274 return this;
8275 }
8276 };
8277
8278 // Attach deferreds
8279 deferred.promise( jqXHR );
8280
8281 // Add protocol if not provided (prefilters might expect it)
8282 // Handle falsy url in the settings object (#10093: consistency with old signature)
8283 // We also use the url parameter if available
8284 s.url = ( ( url || s.url || location.href ) + "" )
8285 .replace( rprotocol, location.protocol + "//" );
8286
8287 // Alias method option to type as per ticket #12004
8288 s.type = options.method || options.type || s.method || s.type;
8289
8290 // Extract dataTypes list
8291 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
8292
8293 // A cross-domain request is in order when the origin doesn't match the current origin.
8294 if ( s.crossDomain == null ) {
8295 urlAnchor = document.createElement( "a" );
8296
8297 // Support: IE <=8 - 11+
8298 // IE throws exception on accessing the href property if url is malformed,
8299 // e.g. http://example.com:80x/
8300 try {
8301 urlAnchor.href = s.url;
8302
8303 // Support: IE <=8 - 11+
8304 // Anchor's host property isn't correctly set when s.url is relative
8305 urlAnchor.href = urlAnchor.href;
8306 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
8307 urlAnchor.protocol + "//" + urlAnchor.host;
8308 } catch ( e ) {
8309
8310 // If there is an error parsing the URL, assume it is crossDomain,
8311 // it can be rejected by the transport if it is invalid
8312 s.crossDomain = true;
8313 }
8314 }
8315
8316 // Convert data if not already a string
8317 if ( s.data && s.processData && typeof s.data !== "string" ) {
8318 s.data = jQuery.param( s.data, s.traditional );
8319 }
8320
8321 // Apply prefilters
8322 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
8323
8324 // If request was aborted inside a prefilter, stop there
8325 if ( completed ) {
8326 return jqXHR;
8327 }
8328
8329 // We can fire global events as of now if asked to
8330 // Don't fire events if jQuery.event is undefined in an ESM-usage scenario (trac-15118)
8331 fireGlobals = jQuery.event && s.global;
8332
8333 // Watch for a new set of requests
8334 if ( fireGlobals && jQuery.active++ === 0 ) {
8335 jQuery.event.trigger( "ajaxStart" );
8336 }
8337
8338 // Uppercase the type
8339 s.type = s.type.toUpperCase();
8340
8341 // Determine if request has content
8342 s.hasContent = !rnoContent.test( s.type );
8343
8344 // Save the URL in case we're toying with the If-Modified-Since
8345 // and/or If-None-Match header later on
8346 // Remove hash to simplify url manipulation
8347 cacheURL = s.url.replace( rhash, "" );
8348
8349 // More options handling for requests with no content
8350 if ( !s.hasContent ) {
8351
8352 // Remember the hash so we can put it back
8353 uncached = s.url.slice( cacheURL.length );
8354
8355 // If data is available and should be processed, append data to url
8356 if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
8357 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
8358
8359 // #9682: remove data so that it's not used in an eventual retry
8360 delete s.data;
8361 }
8362
8363 // Add or update anti-cache param if needed
8364 if ( s.cache === false ) {
8365 cacheURL = cacheURL.replace( rantiCache, "$1" );
8366 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" +
8367 ( nonce.guid++ ) + uncached;
8368 }
8369
8370 // Put hash and anti-cache on the URL that will be requested (gh-1732)
8371 s.url = cacheURL + uncached;
8372
8373 // Change '%20' to '+' if this is encoded form body content (gh-2658)
8374 } else if ( s.data && s.processData &&
8375 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
8376 s.data = s.data.replace( r20, "+" );
8377 }
8378
8379 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
8380 if ( s.ifModified ) {
8381 if ( jQuery.lastModified[ cacheURL ] ) {
8382 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
8383 }
8384 if ( jQuery.etag[ cacheURL ] ) {
8385 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
8386 }
8387 }
8388
8389 // Set the correct header, if data is being sent
8390 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
8391 jqXHR.setRequestHeader( "Content-Type", s.contentType );
8392 }
8393
8394 // Set the Accepts header for the server, depending on the dataType
8395 jqXHR.setRequestHeader(
8396 "Accept",
8397 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
8398 s.accepts[ s.dataTypes[ 0 ] ] +
8399 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
8400 s.accepts[ "*" ]
8401 );
8402
8403 // Check for headers option
8404 for ( i in s.headers ) {
8405 jqXHR.setRequestHeader( i, s.headers[ i ] );
8406 }
8407
8408 // Allow custom headers/mimetypes and early abort
8409 if ( s.beforeSend &&
8410 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
8411
8412 // Abort if not done already and return
8413 return jqXHR.abort();
8414 }
8415
8416 // Aborting is no longer a cancellation
8417 strAbort = "abort";
8418
8419 // Install callbacks on deferreds
8420 completeDeferred.add( s.complete );
8421 jqXHR.done( s.success );
8422 jqXHR.fail( s.error );
8423
8424 // Get transport
8425 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
8426
8427 // If no transport, we auto-abort
8428 if ( !transport ) {
8429 done( -1, "No Transport" );
8430 } else {
8431 jqXHR.readyState = 1;
8432
8433 // Send global event
8434 if ( fireGlobals ) {
8435 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
8436 }
8437
8438 // If request was aborted inside ajaxSend, stop there
8439 if ( completed ) {
8440 return jqXHR;
8441 }
8442
8443 // Timeout
8444 if ( s.async && s.timeout > 0 ) {
8445 timeoutTimer = window.setTimeout( function() {
8446 jqXHR.abort( "timeout" );
8447 }, s.timeout );
8448 }
8449
8450 try {
8451 completed = false;
8452 transport.send( requestHeaders, done );
8453 } catch ( e ) {
8454
8455 // Rethrow post-completion exceptions
8456 if ( completed ) {
8457 throw e;
8458 }
8459
8460 // Propagate others as results
8461 done( -1, e );
8462 }
8463 }
8464
8465 // Callback for when everything is done
8466 function done( status, nativeStatusText, responses, headers ) {
8467 var isSuccess, success, error, response, modified,
8468 statusText = nativeStatusText;
8469
8470 // Ignore repeat invocations
8471 if ( completed ) {
8472 return;
8473 }
8474
8475 completed = true;
8476
8477 // Clear timeout if it exists
8478 if ( timeoutTimer ) {
8479 window.clearTimeout( timeoutTimer );
8480 }
8481
8482 // Dereference transport for early garbage collection
8483 // (no matter how long the jqXHR object will be used)
8484 transport = undefined;
8485
8486 // Cache response headers
8487 responseHeadersString = headers || "";
8488
8489 // Set readyState
8490 jqXHR.readyState = status > 0 ? 4 : 0;
8491
8492 // Determine if successful
8493 isSuccess = status >= 200 && status < 300 || status === 304;
8494
8495 // Get response data
8496 if ( responses ) {
8497 response = ajaxHandleResponses( s, jqXHR, responses );
8498 }
8499
8500 // Use a noop converter for missing script but not if jsonp
8501 if ( !isSuccess &&
8502 jQuery.inArray( "script", s.dataTypes ) > -1 &&
8503 jQuery.inArray( "json", s.dataTypes ) < 0 ) {
8504 s.converters[ "text script" ] = function() {};
8505 }
8506
8507 // Convert no matter what (that way responseXXX fields are always set)
8508 response = ajaxConvert( s, response, jqXHR, isSuccess );
8509
8510 // If successful, handle type chaining
8511 if ( isSuccess ) {
8512
8513 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
8514 if ( s.ifModified ) {
8515 modified = jqXHR.getResponseHeader( "Last-Modified" );
8516 if ( modified ) {
8517 jQuery.lastModified[ cacheURL ] = modified;
8518 }
8519 modified = jqXHR.getResponseHeader( "etag" );
8520 if ( modified ) {
8521 jQuery.etag[ cacheURL ] = modified;
8522 }
8523 }
8524
8525 // if no content
8526 if ( status === 204 || s.type === "HEAD" ) {
8527 statusText = "nocontent";
8528
8529 // if not modified
8530 } else if ( status === 304 ) {
8531 statusText = "notmodified";
8532
8533 // If we have data, let's convert it
8534 } else {
8535 statusText = response.state;
8536 success = response.data;
8537 error = response.error;
8538 isSuccess = !error;
8539 }
8540 } else {
8541
8542 // Extract error from statusText and normalize for non-aborts
8543 error = statusText;
8544 if ( status || !statusText ) {
8545 statusText = "error";
8546 if ( status < 0 ) {
8547 status = 0;
8548 }
8549 }
8550 }
8551
8552 // Set data for the fake xhr object
8553 jqXHR.status = status;
8554 jqXHR.statusText = ( nativeStatusText || statusText ) + "";
8555
8556 // Success/Error
8557 if ( isSuccess ) {
8558 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
8559 } else {
8560 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
8561 }
8562
8563 // Status-dependent callbacks
8564 jqXHR.statusCode( statusCode );
8565 statusCode = undefined;
8566
8567 if ( fireGlobals ) {
8568 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
8569 [ jqXHR, s, isSuccess ? success : error ] );
8570 }
8571
8572 // Complete
8573 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
8574
8575 if ( fireGlobals ) {
8576 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
8577
8578 // Handle the global AJAX counter
8579 if ( !( --jQuery.active ) ) {
8580 jQuery.event.trigger( "ajaxStop" );
8581 }
8582 }
8583 }
8584
8585 return jqXHR;
8586 },
8587
8588 getJSON: function( url, data, callback ) {
8589 return jQuery.get( url, data, callback, "json" );
8590 },
8591
8592 getScript: function( url, callback ) {
8593 return jQuery.get( url, undefined, callback, "script" );
8594 }
8595} );
8596
8597jQuery.each( [ "get", "post" ], function( _i, method ) {
8598 jQuery[ method ] = function( url, data, callback, type ) {
8599
8600 // Shift arguments if data argument was omitted
8601 if ( typeof data === "function" ) {
8602 type = type || callback;
8603 callback = data;
8604 data = undefined;
8605 }
8606
8607 // The url can be an options object (which then must have .url)
8608 return jQuery.ajax( jQuery.extend( {
8609 url: url,
8610 type: method,
8611 dataType: type,
8612 data: data,
8613 success: callback
8614 }, jQuery.isPlainObject( url ) && url ) );
8615 };
8616} );
8617
8618jQuery.ajaxPrefilter( function( s ) {
8619 var i;
8620 for ( i in s.headers ) {
8621 if ( i.toLowerCase() === "content-type" ) {
8622 s.contentType = s.headers[ i ] || "";
8623 }
8624 }
8625} );
8626
8627jQuery._evalUrl = function( url, options, doc ) {
8628 return jQuery.ajax( {
8629 url: url,
8630
8631 // Make this explicit, since user can override this through ajaxSetup (#11264)
8632 type: "GET",
8633 dataType: "script",
8634 cache: true,
8635 async: false,
8636 global: false,
8637 scriptAttrs: options.crossOrigin ? { "crossOrigin": options.crossOrigin } : undefined,
8638
8639 // Only evaluate the response if it is successful (gh-4126)
8640 // dataFilter is not invoked for failure responses, so using it instead
8641 // of the default converter is kludgy but it works.
8642 converters: {
8643 "text script": function() {}
8644 },
8645 dataFilter: function( response ) {
8646 jQuery.globalEval( response, options, doc );
8647 }
8648 } );
8649};
8650
8651jQuery.fn.extend( {
8652 wrapAll: function( html ) {
8653 var wrap;
8654
8655 if ( this[ 0 ] ) {
8656 if ( typeof html === "function" ) {
8657 html = html.call( this[ 0 ] );
8658 }
8659
8660 // The elements to wrap the target around
8661 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
8662
8663 if ( this[ 0 ].parentNode ) {
8664 wrap.insertBefore( this[ 0 ] );
8665 }
8666
8667 wrap.map( function() {
8668 var elem = this;
8669
8670 while ( elem.firstElementChild ) {
8671 elem = elem.firstElementChild;
8672 }
8673
8674 return elem;
8675 } ).append( this );
8676 }
8677
8678 return this;
8679 },
8680
8681 wrapInner: function( html ) {
8682 if ( typeof html === "function" ) {
8683 return this.each( function( i ) {
8684 jQuery( this ).wrapInner( html.call( this, i ) );
8685 } );
8686 }
8687
8688 return this.each( function() {
8689 var self = jQuery( this ),
8690 contents = self.contents();
8691
8692 if ( contents.length ) {
8693 contents.wrapAll( html );
8694
8695 } else {
8696 self.append( html );
8697 }
8698 } );
8699 },
8700
8701 wrap: function( html ) {
8702 var htmlIsFunction = typeof html === "function";
8703
8704 return this.each( function( i ) {
8705 jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
8706 } );
8707 },
8708
8709 unwrap: function( selector ) {
8710 this.parent( selector ).not( "body" ).each( function() {
8711 jQuery( this ).replaceWith( this.childNodes );
8712 } );
8713 return this;
8714 }
8715} );
8716
8717jQuery.expr.pseudos.hidden = function( elem ) {
8718 return !jQuery.expr.pseudos.visible( elem );
8719};
8720jQuery.expr.pseudos.visible = function( elem ) {
8721 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
8722};
8723
8724jQuery.ajaxSettings.xhr = function() {
8725 return new window.XMLHttpRequest();
8726};
8727
8728var xhrSuccessStatus = {
8729
8730 // File protocol always yields status code 0, assume 200
8731 0: 200
8732};
8733
8734jQuery.ajaxTransport( function( options ) {
8735 var callback;
8736
8737 // Cross domain only allowed if supported through XMLHttpRequest
8738 return {
8739 send: function( headers, complete ) {
8740 var i,
8741 xhr = options.xhr();
8742
8743 xhr.open(
8744 options.type,
8745 options.url,
8746 options.async,
8747 options.username,
8748 options.password
8749 );
8750
8751 // Apply custom fields if provided
8752 if ( options.xhrFields ) {
8753 for ( i in options.xhrFields ) {
8754 xhr[ i ] = options.xhrFields[ i ];
8755 }
8756 }
8757
8758 // Override mime type if needed
8759 if ( options.mimeType && xhr.overrideMimeType ) {
8760 xhr.overrideMimeType( options.mimeType );
8761 }
8762
8763 // X-Requested-With header
8764 // For cross-domain requests, seeing as conditions for a preflight are
8765 // akin to a jigsaw puzzle, we simply never set it to be sure.
8766 // (it can always be set on a per-request basis or even using ajaxSetup)
8767 // For same-domain requests, won't change header if already provided.
8768 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
8769 headers[ "X-Requested-With" ] = "XMLHttpRequest";
8770 }
8771
8772 // Set headers
8773 for ( i in headers ) {
8774 xhr.setRequestHeader( i, headers[ i ] );
8775 }
8776
8777 // Callback
8778 callback = function( type ) {
8779 return function() {
8780 if ( callback ) {
8781 callback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = null;
8782
8783 if ( type === "abort" ) {
8784 xhr.abort();
8785 } else if ( type === "error" ) {
8786 complete(
8787
8788 // File: protocol always yields status 0; see #8605, #14207
8789 xhr.status,
8790 xhr.statusText
8791 );
8792 } else {
8793 complete(
8794 xhrSuccessStatus[ xhr.status ] || xhr.status,
8795 xhr.statusText,
8796
8797 // For XHR2 non-text, let the caller handle it (gh-2498)
8798 ( xhr.responseType || "text" ) === "text" ?
8799 { text: xhr.responseText } :
8800 { binary: xhr.response },
8801 xhr.getAllResponseHeaders()
8802 );
8803 }
8804 }
8805 };
8806 };
8807
8808 // Listen to events
8809 xhr.onload = callback();
8810 xhr.onabort = xhr.onerror = xhr.ontimeout = callback( "error" );
8811
8812 // Create the abort callback
8813 callback = callback( "abort" );
8814
8815 try {
8816
8817 // Do send the request (this may raise an exception)
8818 xhr.send( options.hasContent && options.data || null );
8819 } catch ( e ) {
8820
8821 // #14683: Only rethrow if this hasn't been notified as an error yet
8822 if ( callback ) {
8823 throw e;
8824 }
8825 }
8826 },
8827
8828 abort: function() {
8829 if ( callback ) {
8830 callback();
8831 }
8832 }
8833 };
8834} );
8835
8836function canUseScriptTag( s ) {
8837
8838 // A script tag can only be used for async, cross domain or forced-by-attrs requests.
8839 // Sync requests remain handled differently to preserve strict script ordering.
8840 return s.crossDomain || s.scriptAttrs ||
8841
8842 // When dealing with JSONP (`s.dataTypes` include "json" then)
8843 // don't use a script tag so that error responses still may have
8844 // `responseJSON` set. Continue using a script tag for JSONP requests that:
8845 // * are cross-domain as AJAX requests won't work without a CORS setup
8846 // * have `scriptAttrs` set as that's a script-only functionality
8847 // Note that this means JSONP requests violate strict CSP script-src settings.
8848 // A proper solution is to migrate from using JSONP to a CORS setup.
8849 ( s.async && jQuery.inArray( "json", s.dataTypes ) < 0 );
8850}
8851
8852// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
8853jQuery.ajaxPrefilter( function( s ) {
8854 if ( s.crossDomain ) {
8855 s.contents.script = false;
8856 }
8857} );
8858
8859// Install script dataType
8860jQuery.ajaxSetup( {
8861 accepts: {
8862 script: "text/javascript, application/javascript, " +
8863 "application/ecmascript, application/x-ecmascript"
8864 },
8865 contents: {
8866 script: /\b(?:java|ecma)script\b/
8867 },
8868 converters: {
8869 "text script": function( text ) {
8870 jQuery.globalEval( text );
8871 return text;
8872 }
8873 }
8874} );
8875
8876// Handle cache's special case and crossDomain
8877jQuery.ajaxPrefilter( "script", function( s ) {
8878 if ( s.cache === undefined ) {
8879 s.cache = false;
8880 }
8881
8882 // These types of requests are handled via a script tag
8883 // so force their methods to GET.
8884 if ( canUseScriptTag( s ) ) {
8885 s.type = "GET";
8886 }
8887} );
8888
8889// Bind script tag hack transport
8890jQuery.ajaxTransport( "script", function( s ) {
8891 if ( canUseScriptTag( s ) ) {
8892 var script, callback;
8893 return {
8894 send: function( _, complete ) {
8895 script = jQuery( "<script>" )
8896 .attr( s.scriptAttrs || {} )
8897 .prop( { charset: s.scriptCharset, src: s.url } )
8898 .on( "load error", callback = function( evt ) {
8899 script.remove();
8900 callback = null;
8901 if ( evt ) {
8902 complete( evt.type === "error" ? 404 : 200, evt.type );
8903 }
8904 } );
8905
8906 // Use native DOM manipulation to avoid our domManip AJAX trickery
8907 document.head.appendChild( script[ 0 ] );
8908 },
8909 abort: function() {
8910 if ( callback ) {
8911 callback();
8912 }
8913 }
8914 };
8915 }
8916} );
8917
8918var oldCallbacks = [],
8919 rjsonp = /(=)\?(?=&|$)|\?\?/;
8920
8921// Default jsonp settings
8922jQuery.ajaxSetup( {
8923 jsonp: "callback",
8924 jsonpCallback: function() {
8925 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) );
8926 this[ callback ] = true;
8927 return callback;
8928 }
8929} );
8930
8931// Detect, normalize options and install callbacks for jsonp requests
8932jQuery.ajaxPrefilter( "jsonp", function( s, originalSettings, jqXHR ) {
8933
8934 var callbackName, overwritten, responseContainer,
8935 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
8936 "url" :
8937 typeof s.data === "string" &&
8938 ( s.contentType || "" )
8939 .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
8940 rjsonp.test( s.data ) && "data"
8941 );
8942
8943 // Get callback name, remembering preexisting value associated with it
8944 callbackName = s.jsonpCallback = typeof s.jsonpCallback === "function" ?
8945 s.jsonpCallback() :
8946 s.jsonpCallback;
8947
8948 // Insert callback into url or form data
8949 if ( jsonProp ) {
8950 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
8951 } else if ( s.jsonp !== false ) {
8952 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
8953 }
8954
8955 // Use data converter to retrieve json after script execution
8956 s.converters[ "script json" ] = function() {
8957 if ( !responseContainer ) {
8958 jQuery.error( callbackName + " was not called" );
8959 }
8960 return responseContainer[ 0 ];
8961 };
8962
8963 // Force json dataType
8964 s.dataTypes[ 0 ] = "json";
8965
8966 // Install callback
8967 overwritten = window[ callbackName ];
8968 window[ callbackName ] = function() {
8969 responseContainer = arguments;
8970 };
8971
8972 // Clean-up function (fires after converters)
8973 jqXHR.always( function() {
8974
8975 // If previous value didn't exist - remove it
8976 if ( overwritten === undefined ) {
8977 jQuery( window ).removeProp( callbackName );
8978
8979 // Otherwise restore preexisting value
8980 } else {
8981 window[ callbackName ] = overwritten;
8982 }
8983
8984 // Save back as free
8985 if ( s[ callbackName ] ) {
8986
8987 // Make sure that re-using the options doesn't screw things around
8988 s.jsonpCallback = originalSettings.jsonpCallback;
8989
8990 // Save the callback name for future use
8991 oldCallbacks.push( callbackName );
8992 }
8993
8994 // Call if it was a function and we have a response
8995 if ( responseContainer && typeof overwritten === "function" ) {
8996 overwritten( responseContainer[ 0 ] );
8997 }
8998
8999 responseContainer = overwritten = undefined;
9000 } );
9001
9002 // Delegate to script
9003 return "script";
9004} );
9005
9006// Argument "data" should be string of html
9007// context (optional): If specified, the fragment will be created in this context,
9008// defaults to document
9009// keepScripts (optional): If true, will include scripts passed in the html string
9010jQuery.parseHTML = function( data, context, keepScripts ) {
9011 if ( typeof data !== "string" ) {
9012 return [];
9013 }
9014 if ( typeof context === "boolean" ) {
9015 keepScripts = context;
9016 context = false;
9017 }
9018
9019 var base, parsed, scripts;
9020
9021 if ( !context ) {
9022
9023 // Stop scripts or inline event handlers from being executed immediately
9024 // by using document.implementation
9025 context = document.implementation.createHTMLDocument( "" );
9026
9027 // Set the base href for the created document
9028 // so any parsed elements with URLs
9029 // are based on the document's URL (gh-2965)
9030 base = context.createElement( "base" );
9031 base.href = document.location.href;
9032 context.head.appendChild( base );
9033 }
9034
9035 parsed = rsingleTag.exec( data );
9036 scripts = !keepScripts && [];
9037
9038 // Single tag
9039 if ( parsed ) {
9040 return [ context.createElement( parsed[ 1 ] ) ];
9041 }
9042
9043 parsed = buildFragment( [ data ], context, scripts );
9044
9045 if ( scripts && scripts.length ) {
9046 jQuery( scripts ).remove();
9047 }
9048
9049 return jQuery.merge( [], parsed.childNodes );
9050};
9051
9052/**
9053 * Load a url into a page
9054 */
9055jQuery.fn.load = function( url, params, callback ) {
9056 var selector, type, response,
9057 self = this,
9058 off = url.indexOf( " " );
9059
9060 if ( off > -1 ) {
9061 selector = stripAndCollapse( url.slice( off ) );
9062 url = url.slice( 0, off );
9063 }
9064
9065 // If it's a function
9066 if ( typeof params === "function" ) {
9067
9068 // We assume that it's the callback
9069 callback = params;
9070 params = undefined;
9071
9072 // Otherwise, build a param string
9073 } else if ( params && typeof params === "object" ) {
9074 type = "POST";
9075 }
9076
9077 // If we have elements to modify, make the request
9078 if ( self.length > 0 ) {
9079 jQuery.ajax( {
9080 url: url,
9081
9082 // If "type" variable is undefined, then "GET" method will be used.
9083 // Make value of this field explicit since
9084 // user can override it through ajaxSetup method
9085 type: type || "GET",
9086 dataType: "html",
9087 data: params
9088 } ).done( function( responseText ) {
9089
9090 // Save response for use in complete callback
9091 response = arguments;
9092
9093 self.html( selector ?
9094
9095 // If a selector was specified, locate the right elements in a dummy div
9096 // Exclude scripts to avoid IE 'Permission Denied' errors
9097 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
9098
9099 // Otherwise use the full result
9100 responseText );
9101
9102 // If the request succeeds, this function gets "data", "status", "jqXHR"
9103 // but they are ignored because response was set above.
9104 // If it fails, this function gets "jqXHR", "status", "error"
9105 } ).always( callback && function( jqXHR, status ) {
9106 self.each( function() {
9107 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
9108 } );
9109 } );
9110 }
9111
9112 return this;
9113};
9114
9115jQuery.expr.pseudos.animated = function( elem ) {
9116 return jQuery.grep( jQuery.timers, function( fn ) {
9117 return elem === fn.elem;
9118 } ).length;
9119};
9120
9121jQuery.offset = {
9122 setOffset: function( elem, options, i ) {
9123 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
9124 position = jQuery.css( elem, "position" ),
9125 curElem = jQuery( elem ),
9126 props = {};
9127
9128 // Set position first, in-case top/left are set even on static elem
9129 if ( position === "static" ) {
9130 elem.style.position = "relative";
9131 }
9132
9133 curOffset = curElem.offset();
9134 curCSSTop = jQuery.css( elem, "top" );
9135 curCSSLeft = jQuery.css( elem, "left" );
9136 calculatePosition = ( position === "absolute" || position === "fixed" ) &&
9137 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
9138
9139 // Need to be able to calculate position if either
9140 // top or left is auto and position is either absolute or fixed
9141 if ( calculatePosition ) {
9142 curPosition = curElem.position();
9143 curTop = curPosition.top;
9144 curLeft = curPosition.left;
9145
9146 } else {
9147 curTop = parseFloat( curCSSTop ) || 0;
9148 curLeft = parseFloat( curCSSLeft ) || 0;
9149 }
9150
9151 if ( typeof options === "function" ) {
9152
9153 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
9154 options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
9155 }
9156
9157 if ( options.top != null ) {
9158 props.top = ( options.top - curOffset.top ) + curTop;
9159 }
9160 if ( options.left != null ) {
9161 props.left = ( options.left - curOffset.left ) + curLeft;
9162 }
9163
9164 if ( "using" in options ) {
9165 options.using.call( elem, props );
9166
9167 } else {
9168 curElem.css( props );
9169 }
9170 }
9171};
9172
9173jQuery.fn.extend( {
9174
9175 // offset() relates an element's border box to the document origin
9176 offset: function( options ) {
9177
9178 // Preserve chaining for setter
9179 if ( arguments.length ) {
9180 return options === undefined ?
9181 this :
9182 this.each( function( i ) {
9183 jQuery.offset.setOffset( this, options, i );
9184 } );
9185 }
9186
9187 var rect, win,
9188 elem = this[ 0 ];
9189
9190 if ( !elem ) {
9191 return;
9192 }
9193
9194 // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
9195 // Support: IE <=11+
9196 // Running getBoundingClientRect on a
9197 // disconnected node in IE throws an error
9198 if ( !elem.getClientRects().length ) {
9199 return { top: 0, left: 0 };
9200 }
9201
9202 // Get document-relative position by adding viewport scroll to viewport-relative gBCR
9203 rect = elem.getBoundingClientRect();
9204 win = elem.ownerDocument.defaultView;
9205 return {
9206 top: rect.top + win.pageYOffset,
9207 left: rect.left + win.pageXOffset
9208 };
9209 },
9210
9211 // position() relates an element's margin box to its offset parent's padding box
9212 // This corresponds to the behavior of CSS absolute positioning
9213 position: function() {
9214 if ( !this[ 0 ] ) {
9215 return;
9216 }
9217
9218 var offsetParent, offset, doc,
9219 elem = this[ 0 ],
9220 parentOffset = { top: 0, left: 0 };
9221
9222 // position:fixed elements are offset from the viewport, which itself always has zero offset
9223 if ( jQuery.css( elem, "position" ) === "fixed" ) {
9224
9225 // Assume position:fixed implies availability of getBoundingClientRect
9226 offset = elem.getBoundingClientRect();
9227
9228 } else {
9229 offset = this.offset();
9230
9231 // Account for the *real* offset parent, which can be the document or its root element
9232 // when a statically positioned element is identified
9233 doc = elem.ownerDocument;
9234 offsetParent = elem.offsetParent || doc.documentElement;
9235 while ( offsetParent &&
9236 ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
9237 jQuery.css( offsetParent, "position" ) === "static" ) {
9238
9239 offsetParent = offsetParent.parentNode;
9240 }
9241 if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
9242
9243 // Incorporate borders into its offset, since they are outside its content origin
9244 parentOffset = jQuery( offsetParent ).offset();
9245 parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
9246 parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
9247 }
9248 }
9249
9250 // Subtract parent offsets and element margins
9251 return {
9252 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
9253 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
9254 };
9255 },
9256
9257 // This method will return documentElement in the following cases:
9258 // 1) For the element inside the iframe without offsetParent, this method will return
9259 // documentElement of the parent window
9260 // 2) For the hidden or detached element
9261 // 3) For body or html element, i.e. in case of the html node - it will return itself
9262 //
9263 // but those exceptions were never presented as a real life use-cases
9264 // and might be considered as more preferable results.
9265 //
9266 // This logic, however, is not guaranteed and can change at any point in the future
9267 offsetParent: function() {
9268 return this.map( function() {
9269 var offsetParent = this.offsetParent;
9270
9271 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
9272 offsetParent = offsetParent.offsetParent;
9273 }
9274
9275 return offsetParent || documentElement;
9276 } );
9277 }
9278} );
9279
9280// Create scrollLeft and scrollTop methods
9281jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
9282 var top = "pageYOffset" === prop;
9283
9284 jQuery.fn[ method ] = function( val ) {
9285 return access( this, function( elem, method, val ) {
9286
9287 // Coalesce documents and windows
9288 var win;
9289 if ( isWindow( elem ) ) {
9290 win = elem;
9291 } else if ( elem.nodeType === 9 ) {
9292 win = elem.defaultView;
9293 }
9294
9295 if ( val === undefined ) {
9296 return win ? win[ prop ] : elem[ method ];
9297 }
9298
9299 if ( win ) {
9300 win.scrollTo(
9301 !top ? val : win.pageXOffset,
9302 top ? val : win.pageYOffset
9303 );
9304
9305 } else {
9306 elem[ method ] = val;
9307 }
9308 }, method, val, arguments.length );
9309 };
9310} );
9311
9312// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
9313jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
9314 jQuery.each( {
9315 padding: "inner" + name,
9316 content: type,
9317 "": "outer" + name
9318 }, function( defaultExtra, funcName ) {
9319
9320 // Margin is only for outerHeight, outerWidth
9321 jQuery.fn[ funcName ] = function( margin, value ) {
9322 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
9323 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
9324
9325 return access( this, function( elem, type, value ) {
9326 var doc;
9327
9328 if ( isWindow( elem ) ) {
9329
9330 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
9331 return funcName.indexOf( "outer" ) === 0 ?
9332 elem[ "inner" + name ] :
9333 elem.document.documentElement[ "client" + name ];
9334 }
9335
9336 // Get document width or height
9337 if ( elem.nodeType === 9 ) {
9338 doc = elem.documentElement;
9339
9340 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
9341 // whichever is greatest
9342 return Math.max(
9343 elem.body[ "scroll" + name ], doc[ "scroll" + name ],
9344 elem.body[ "offset" + name ], doc[ "offset" + name ],
9345 doc[ "client" + name ]
9346 );
9347 }
9348
9349 return value === undefined ?
9350
9351 // Get width or height on the element, requesting but not forcing parseFloat
9352 jQuery.css( elem, type, extra ) :
9353
9354 // Set width or height on the element
9355 jQuery.style( elem, type, value, extra );
9356 }, type, chainable ? margin : undefined, chainable );
9357 };
9358 } );
9359} );
9360
9361jQuery.each( [
9362 "ajaxStart",
9363 "ajaxStop",
9364 "ajaxComplete",
9365 "ajaxError",
9366 "ajaxSuccess",
9367 "ajaxSend"
9368], function( _i, type ) {
9369 jQuery.fn[ type ] = function( fn ) {
9370 return this.on( type, fn );
9371 };
9372} );
9373
9374jQuery.fn.extend( {
9375
9376 bind: function( types, data, fn ) {
9377 return this.on( types, null, data, fn );
9378 },
9379 unbind: function( types, fn ) {
9380 return this.off( types, null, fn );
9381 },
9382
9383 delegate: function( selector, types, data, fn ) {
9384 return this.on( types, selector, data, fn );
9385 },
9386 undelegate: function( selector, types, fn ) {
9387
9388 // ( namespace ) or ( selector, types [, fn] )
9389 return arguments.length === 1 ?
9390 this.off( selector, "**" ) :
9391 this.off( types, selector || "**", fn );
9392 },
9393
9394 hover: function( fnOver, fnOut ) {
9395 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
9396 }
9397} );
9398
9399jQuery.each(
9400 ( "blur focus focusin focusout resize scroll click dblclick " +
9401 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
9402 "change select submit keydown keypress keyup contextmenu" ).split( " " ),
9403 function( _i, name ) {
9404
9405 // Handle event binding
9406 jQuery.fn[ name ] = function( data, fn ) {
9407 return arguments.length > 0 ?
9408 this.on( name, null, data, fn ) :
9409 this.trigger( name );
9410 };
9411 }
9412);
9413
9414// Bind a function to a context, optionally partially applying any
9415// arguments.
9416// jQuery.proxy is deprecated to promote standards (specifically Function#bind)
9417// However, it is not slated for removal any time soon
9418jQuery.proxy = function( fn, context ) {
9419 var tmp, args, proxy;
9420
9421 if ( typeof context === "string" ) {
9422 tmp = fn[ context ];
9423 context = fn;
9424 fn = tmp;
9425 }
9426
9427 // Quick check to determine if target is callable, in the spec
9428 // this throws a TypeError, but we will just return undefined.
9429 if ( typeof fn !== "function" ) {
9430 return undefined;
9431 }
9432
9433 // Simulated bind
9434 args = slice.call( arguments, 2 );
9435 proxy = function() {
9436 return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
9437 };
9438
9439 // Set the guid of unique handler to the same of original handler, so it can be removed
9440 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
9441
9442 return proxy;
9443};
9444
9445jQuery.holdReady = function( hold ) {
9446 if ( hold ) {
9447 jQuery.readyWait++;
9448 } else {
9449 jQuery.ready( true );
9450 }
9451};
9452
9453// Register as a named AMD module, since jQuery can be concatenated with other
9454// files that may use define, but not via a proper concatenation script that
9455// understands anonymous AMD modules. A named AMD is safest and most robust
9456// way to register. Lowercase jquery is used because AMD module names are
9457// derived from file names, and jQuery is normally delivered in a lowercase
9458// file name. Do this after creating the global so that if an AMD module wants
9459// to call noConflict to hide this version of jQuery, it will work.
9460
9461// Note that for maximum portability, libraries that are not jQuery should
9462// declare themselves as anonymous modules, and avoid setting a global if an
9463// AMD loader is present. jQuery is a special case. For more information, see
9464// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
9465
9466if ( typeof define === "function" && define.amd ) {
9467 define( "jquery", [], function() {
9468 return jQuery;
9469 } );
9470}
9471
9472var
9473
9474 // Map over jQuery in case of overwrite
9475 _jQuery = window.jQuery,
9476
9477 // Map over the $ in case of overwrite
9478 _$ = window.$;
9479
9480jQuery.noConflict = function( deep ) {
9481 if ( window.$ === jQuery ) {
9482 window.$ = _$;
9483 }
9484
9485 if ( deep && window.jQuery === jQuery ) {
9486 window.jQuery = _jQuery;
9487 }
9488
9489 return jQuery;
9490};
9491
9492// Expose jQuery and $ identifiers, even in AMD
9493// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
9494// and CommonJS for browser emulators (#13566)
9495if ( typeof noGlobal === "undefined" ) {
9496 window.jQuery = window.$ = jQuery;
9497}
9498
9499return jQuery;
9500} );
9501