3.1.0
[jquery.git] / dist / jquery.slim.js
blob0689d4548864f1b48c30b78331086c497dc1e62e
1 /*eslint-disable no-unused-vars*/
2 /*!
3  * jQuery JavaScript Library v3.1.0 -ajax,-ajax/jsonp,-ajax/load,-ajax/parseXML,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-event/ajax,-effects,-effects/Tween,-effects/animatedSelector,-deprecated
4  * https://jquery.com/
5  *
6  * Includes Sizzle.js
7  * https://sizzlejs.com/
8  *
9  * Copyright jQuery Foundation and other contributors
10  * Released under the MIT license
11  * https://jquery.org/license
12  *
13  * Date: 2016-07-07T21:44Z
14  */
15 ( function( global, factory ) {
17         "use strict";
19         if ( typeof module === "object" && typeof module.exports === "object" ) {
21                 // For CommonJS and CommonJS-like environments where a proper `window`
22                 // is present, execute the factory and get jQuery.
23                 // For environments that do not have a `window` with a `document`
24                 // (such as Node.js), expose a factory as module.exports.
25                 // This accentuates the need for the creation of a real `window`.
26                 // e.g. var jQuery = require("jquery")(window);
27                 // See ticket #14549 for more info.
28                 module.exports = global.document ?
29                         factory( global, true ) :
30                         function( w ) {
31                                 if ( !w.document ) {
32                                         throw new Error( "jQuery requires a window with a document" );
33                                 }
34                                 return factory( w );
35                         };
36         } else {
37                 factory( global );
38         }
40 // Pass this if window is not defined yet
41 } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
43 // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
44 // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
45 // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
46 // enough that all such attempts are guarded in a try block.
47 "use strict";
49 var arr = [];
51 var document = window.document;
53 var getProto = Object.getPrototypeOf;
55 var slice = arr.slice;
57 var concat = arr.concat;
59 var push = arr.push;
61 var indexOf = arr.indexOf;
63 var class2type = {};
65 var toString = class2type.toString;
67 var hasOwn = class2type.hasOwnProperty;
69 var fnToString = hasOwn.toString;
71 var ObjectFunctionString = fnToString.call( Object );
73 var support = {};
77         function DOMEval( code, doc ) {
78                 doc = doc || document;
80                 var script = doc.createElement( "script" );
82                 script.text = code;
83                 doc.head.appendChild( script ).parentNode.removeChild( script );
84         }
85 /* global Symbol */
86 // Defining this global in .eslintrc would create a danger of using the global
87 // unguarded in another place, it seems safer to define global only for this module
91 var
92         version = "3.1.0 -ajax,-ajax/jsonp,-ajax/load,-ajax/parseXML,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-event/ajax,-effects,-effects/Tween,-effects/animatedSelector,-deprecated",
94         // Define a local copy of jQuery
95         jQuery = function( selector, context ) {
97                 // The jQuery object is actually just the init constructor 'enhanced'
98                 // Need init if jQuery is called (just allow error to be thrown if not included)
99                 return new jQuery.fn.init( selector, context );
100         },
102         // Support: Android <=4.0 only
103         // Make sure we trim BOM and NBSP
104         rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
106         // Matches dashed string for camelizing
107         rmsPrefix = /^-ms-/,
108         rdashAlpha = /-([a-z])/g,
110         // Used by jQuery.camelCase as callback to replace()
111         fcamelCase = function( all, letter ) {
112                 return letter.toUpperCase();
113         };
115 jQuery.fn = jQuery.prototype = {
117         // The current version of jQuery being used
118         jquery: version,
120         constructor: jQuery,
122         // The default length of a jQuery object is 0
123         length: 0,
125         toArray: function() {
126                 return slice.call( this );
127         },
129         // Get the Nth element in the matched element set OR
130         // Get the whole matched element set as a clean array
131         get: function( num ) {
132                 return num != null ?
134                         // Return just the one element from the set
135                         ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
137                         // Return all the elements in a clean array
138                         slice.call( this );
139         },
141         // Take an array of elements and push it onto the stack
142         // (returning the new matched element set)
143         pushStack: function( elems ) {
145                 // Build a new jQuery matched element set
146                 var ret = jQuery.merge( this.constructor(), elems );
148                 // Add the old object onto the stack (as a reference)
149                 ret.prevObject = this;
151                 // Return the newly-formed element set
152                 return ret;
153         },
155         // Execute a callback for every element in the matched set.
156         each: function( callback ) {
157                 return jQuery.each( this, callback );
158         },
160         map: function( callback ) {
161                 return this.pushStack( jQuery.map( this, function( elem, i ) {
162                         return callback.call( elem, i, elem );
163                 } ) );
164         },
166         slice: function() {
167                 return this.pushStack( slice.apply( this, arguments ) );
168         },
170         first: function() {
171                 return this.eq( 0 );
172         },
174         last: function() {
175                 return this.eq( -1 );
176         },
178         eq: function( i ) {
179                 var len = this.length,
180                         j = +i + ( i < 0 ? len : 0 );
181                 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
182         },
184         end: function() {
185                 return this.prevObject || this.constructor();
186         },
188         // For internal use only.
189         // Behaves like an Array's method, not like a jQuery method.
190         push: push,
191         sort: arr.sort,
192         splice: arr.splice
195 jQuery.extend = jQuery.fn.extend = function() {
196         var options, name, src, copy, copyIsArray, clone,
197                 target = arguments[ 0 ] || {},
198                 i = 1,
199                 length = arguments.length,
200                 deep = false;
202         // Handle a deep copy situation
203         if ( typeof target === "boolean" ) {
204                 deep = target;
206                 // Skip the boolean and the target
207                 target = arguments[ i ] || {};
208                 i++;
209         }
211         // Handle case when target is a string or something (possible in deep copy)
212         if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
213                 target = {};
214         }
216         // Extend jQuery itself if only one argument is passed
217         if ( i === length ) {
218                 target = this;
219                 i--;
220         }
222         for ( ; i < length; i++ ) {
224                 // Only deal with non-null/undefined values
225                 if ( ( options = arguments[ i ] ) != null ) {
227                         // Extend the base object
228                         for ( name in options ) {
229                                 src = target[ name ];
230                                 copy = options[ name ];
232                                 // Prevent never-ending loop
233                                 if ( target === copy ) {
234                                         continue;
235                                 }
237                                 // Recurse if we're merging plain objects or arrays
238                                 if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
239                                         ( copyIsArray = jQuery.isArray( copy ) ) ) ) {
241                                         if ( copyIsArray ) {
242                                                 copyIsArray = false;
243                                                 clone = src && jQuery.isArray( src ) ? src : [];
245                                         } else {
246                                                 clone = src && jQuery.isPlainObject( src ) ? src : {};
247                                         }
249                                         // Never move original objects, clone them
250                                         target[ name ] = jQuery.extend( deep, clone, copy );
252                                 // Don't bring in undefined values
253                                 } else if ( copy !== undefined ) {
254                                         target[ name ] = copy;
255                                 }
256                         }
257                 }
258         }
260         // Return the modified object
261         return target;
264 jQuery.extend( {
266         // Unique for each copy of jQuery on the page
267         expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
269         // Assume jQuery is ready without the ready module
270         isReady: true,
272         error: function( msg ) {
273                 throw new Error( msg );
274         },
276         noop: function() {},
278         isFunction: function( obj ) {
279                 return jQuery.type( obj ) === "function";
280         },
282         isArray: Array.isArray,
284         isWindow: function( obj ) {
285                 return obj != null && obj === obj.window;
286         },
288         isNumeric: function( obj ) {
290                 // As of jQuery 3.0, isNumeric is limited to
291                 // strings and numbers (primitives or objects)
292                 // that can be coerced to finite numbers (gh-2662)
293                 var type = jQuery.type( obj );
294                 return ( type === "number" || type === "string" ) &&
296                         // parseFloat NaNs numeric-cast false positives ("")
297                         // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
298                         // subtraction forces infinities to NaN
299                         !isNaN( obj - parseFloat( obj ) );
300         },
302         isPlainObject: function( obj ) {
303                 var proto, Ctor;
305                 // Detect obvious negatives
306                 // Use toString instead of jQuery.type to catch host objects
307                 if ( !obj || toString.call( obj ) !== "[object Object]" ) {
308                         return false;
309                 }
311                 proto = getProto( obj );
313                 // Objects with no prototype (e.g., `Object.create( null )`) are plain
314                 if ( !proto ) {
315                         return true;
316                 }
318                 // Objects with prototype are plain iff they were constructed by a global Object function
319                 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
320                 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
321         },
323         isEmptyObject: function( obj ) {
325                 /* eslint-disable no-unused-vars */
326                 // See https://github.com/eslint/eslint/issues/6125
327                 var name;
329                 for ( name in obj ) {
330                         return false;
331                 }
332                 return true;
333         },
335         type: function( obj ) {
336                 if ( obj == null ) {
337                         return obj + "";
338                 }
340                 // Support: Android <=2.3 only (functionish RegExp)
341                 return typeof obj === "object" || typeof obj === "function" ?
342                         class2type[ toString.call( obj ) ] || "object" :
343                         typeof obj;
344         },
346         // Evaluates a script in a global context
347         globalEval: function( code ) {
348                 DOMEval( code );
349         },
351         // Convert dashed to camelCase; used by the css and data modules
352         // Support: IE <=9 - 11, Edge 12 - 13
353         // Microsoft forgot to hump their vendor prefix (#9572)
354         camelCase: function( string ) {
355                 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
356         },
358         nodeName: function( elem, name ) {
359                 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
360         },
362         each: function( obj, callback ) {
363                 var length, i = 0;
365                 if ( isArrayLike( obj ) ) {
366                         length = obj.length;
367                         for ( ; i < length; i++ ) {
368                                 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
369                                         break;
370                                 }
371                         }
372                 } else {
373                         for ( i in obj ) {
374                                 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
375                                         break;
376                                 }
377                         }
378                 }
380                 return obj;
381         },
383         // Support: Android <=4.0 only
384         trim: function( text ) {
385                 return text == null ?
386                         "" :
387                         ( text + "" ).replace( rtrim, "" );
388         },
390         // results is for internal usage only
391         makeArray: function( arr, results ) {
392                 var ret = results || [];
394                 if ( arr != null ) {
395                         if ( isArrayLike( Object( arr ) ) ) {
396                                 jQuery.merge( ret,
397                                         typeof arr === "string" ?
398                                         [ arr ] : arr
399                                 );
400                         } else {
401                                 push.call( ret, arr );
402                         }
403                 }
405                 return ret;
406         },
408         inArray: function( elem, arr, i ) {
409                 return arr == null ? -1 : indexOf.call( arr, elem, i );
410         },
412         // Support: Android <=4.0 only, PhantomJS 1 only
413         // push.apply(_, arraylike) throws on ancient WebKit
414         merge: function( first, second ) {
415                 var len = +second.length,
416                         j = 0,
417                         i = first.length;
419                 for ( ; j < len; j++ ) {
420                         first[ i++ ] = second[ j ];
421                 }
423                 first.length = i;
425                 return first;
426         },
428         grep: function( elems, callback, invert ) {
429                 var callbackInverse,
430                         matches = [],
431                         i = 0,
432                         length = elems.length,
433                         callbackExpect = !invert;
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                 }
444                 return matches;
445         },
447         // arg is for internal usage only
448         map: function( elems, callback, arg ) {
449                 var length, value,
450                         i = 0,
451                         ret = [];
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 );
459                                 if ( value != null ) {
460                                         ret.push( value );
461                                 }
462                         }
464                 // Go through every key on the object,
465                 } else {
466                         for ( i in elems ) {
467                                 value = callback( elems[ i ], i, arg );
469                                 if ( value != null ) {
470                                         ret.push( value );
471                                 }
472                         }
473                 }
475                 // Flatten any nested arrays
476                 return concat.apply( [], ret );
477         },
479         // A global GUID counter for objects
480         guid: 1,
482         // Bind a function to a context, optionally partially applying any
483         // arguments.
484         proxy: function( fn, context ) {
485                 var tmp, args, proxy;
487                 if ( typeof context === "string" ) {
488                         tmp = fn[ context ];
489                         context = fn;
490                         fn = tmp;
491                 }
493                 // Quick check to determine if target is callable, in the spec
494                 // this throws a TypeError, but we will just return undefined.
495                 if ( !jQuery.isFunction( fn ) ) {
496                         return undefined;
497                 }
499                 // Simulated bind
500                 args = slice.call( arguments, 2 );
501                 proxy = function() {
502                         return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
503                 };
505                 // Set the guid of unique handler to the same of original handler, so it can be removed
506                 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
508                 return proxy;
509         },
511         now: Date.now,
513         // jQuery.support is not used in Core but other projects attach their
514         // properties to it so it needs to exist.
515         support: support
516 } );
518 if ( typeof Symbol === "function" ) {
519         jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
522 // Populate the class2type map
523 jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
524 function( i, name ) {
525         class2type[ "[object " + name + "]" ] = name.toLowerCase();
526 } );
528 function isArrayLike( obj ) {
530         // Support: real iOS 8.2 only (not reproducible in simulator)
531         // `in` check used to prevent JIT error (gh-2145)
532         // hasOwn isn't used here due to false negatives
533         // regarding Nodelist length in IE
534         var length = !!obj && "length" in obj && obj.length,
535                 type = jQuery.type( obj );
537         if ( type === "function" || jQuery.isWindow( obj ) ) {
538                 return false;
539         }
541         return type === "array" || length === 0 ||
542                 typeof length === "number" && length > 0 && ( length - 1 ) in obj;
544 var Sizzle =
546  * Sizzle CSS Selector Engine v2.3.0
547  * https://sizzlejs.com/
549  * Copyright jQuery Foundation and other contributors
550  * Released under the MIT license
551  * http://jquery.org/license
553  * Date: 2016-01-04
554  */
555 (function( window ) {
557 var i,
558         support,
559         Expr,
560         getText,
561         isXML,
562         tokenize,
563         compile,
564         select,
565         outermostContext,
566         sortInput,
567         hasDuplicate,
569         // Local document vars
570         setDocument,
571         document,
572         docElem,
573         documentIsHTML,
574         rbuggyQSA,
575         rbuggyMatches,
576         matches,
577         contains,
579         // Instance-specific data
580         expando = "sizzle" + 1 * new Date(),
581         preferredDoc = window.document,
582         dirruns = 0,
583         done = 0,
584         classCache = createCache(),
585         tokenCache = createCache(),
586         compilerCache = createCache(),
587         sortOrder = function( a, b ) {
588                 if ( a === b ) {
589                         hasDuplicate = true;
590                 }
591                 return 0;
592         },
594         // Instance methods
595         hasOwn = ({}).hasOwnProperty,
596         arr = [],
597         pop = arr.pop,
598         push_native = arr.push,
599         push = arr.push,
600         slice = arr.slice,
601         // Use a stripped-down indexOf as it's faster than native
602         // https://jsperf.com/thor-indexof-vs-for/5
603         indexOf = function( list, elem ) {
604                 var i = 0,
605                         len = list.length;
606                 for ( ; i < len; i++ ) {
607                         if ( list[i] === elem ) {
608                                 return i;
609                         }
610                 }
611                 return -1;
612         },
614         booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
616         // Regular expressions
618         // http://www.w3.org/TR/css3-selectors/#whitespace
619         whitespace = "[\\x20\\t\\r\\n\\f]",
621         // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
622         identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
624         // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
625         attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
626                 // Operator (capture 2)
627                 "*([*^$|!~]?=)" + whitespace +
628                 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
629                 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
630                 "*\\]",
632         pseudos = ":(" + identifier + ")(?:\\((" +
633                 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
634                 // 1. quoted (capture 3; capture 4 or capture 5)
635                 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
636                 // 2. simple (capture 6)
637                 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
638                 // 3. anything else (capture 2)
639                 ".*" +
640                 ")\\)|)",
642         // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
643         rwhitespace = new RegExp( whitespace + "+", "g" ),
644         rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
646         rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
647         rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
649         rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
651         rpseudo = new RegExp( pseudos ),
652         ridentifier = new RegExp( "^" + identifier + "$" ),
654         matchExpr = {
655                 "ID": new RegExp( "^#(" + identifier + ")" ),
656                 "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
657                 "TAG": new RegExp( "^(" + identifier + "|[*])" ),
658                 "ATTR": new RegExp( "^" + attributes ),
659                 "PSEUDO": new RegExp( "^" + pseudos ),
660                 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
661                         "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
662                         "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
663                 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
664                 // For use in libraries implementing .is()
665                 // We use this for POS matching in `select`
666                 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
667                         whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
668         },
670         rinputs = /^(?:input|select|textarea|button)$/i,
671         rheader = /^h\d$/i,
673         rnative = /^[^{]+\{\s*\[native \w/,
675         // Easily-parseable/retrievable ID or TAG or CLASS selectors
676         rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
678         rsibling = /[+~]/,
680         // CSS escapes
681         // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
682         runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
683         funescape = function( _, escaped, escapedWhitespace ) {
684                 var high = "0x" + escaped - 0x10000;
685                 // NaN means non-codepoint
686                 // Support: Firefox<24
687                 // Workaround erroneous numeric interpretation of +"0x"
688                 return high !== high || escapedWhitespace ?
689                         escaped :
690                         high < 0 ?
691                                 // BMP codepoint
692                                 String.fromCharCode( high + 0x10000 ) :
693                                 // Supplemental Plane codepoint (surrogate pair)
694                                 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
695         },
697         // CSS string/identifier serialization
698         // https://drafts.csswg.org/cssom/#common-serializing-idioms
699         rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,
700         fcssescape = function( ch, asCodePoint ) {
701                 if ( asCodePoint ) {
703                         // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
704                         if ( ch === "\0" ) {
705                                 return "\uFFFD";
706                         }
708                         // Control characters and (dependent upon position) numbers get escaped as code points
709                         return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
710                 }
712                 // Other potentially-special ASCII characters get backslash-escaped
713                 return "\\" + ch;
714         },
716         // Used for iframes
717         // See setDocument()
718         // Removing the function wrapper causes a "Permission Denied"
719         // error in IE
720         unloadHandler = function() {
721                 setDocument();
722         },
724         disabledAncestor = addCombinator(
725                 function( elem ) {
726                         return elem.disabled === true;
727                 },
728                 { dir: "parentNode", next: "legend" }
729         );
731 // Optimize for push.apply( _, NodeList )
732 try {
733         push.apply(
734                 (arr = slice.call( preferredDoc.childNodes )),
735                 preferredDoc.childNodes
736         );
737         // Support: Android<4.0
738         // Detect silently failing push.apply
739         arr[ preferredDoc.childNodes.length ].nodeType;
740 } catch ( e ) {
741         push = { apply: arr.length ?
743                 // Leverage slice if possible
744                 function( target, els ) {
745                         push_native.apply( target, slice.call(els) );
746                 } :
748                 // Support: IE<9
749                 // Otherwise append directly
750                 function( target, els ) {
751                         var j = target.length,
752                                 i = 0;
753                         // Can't trust NodeList.length
754                         while ( (target[j++] = els[i++]) ) {}
755                         target.length = j - 1;
756                 }
757         };
760 function Sizzle( selector, context, results, seed ) {
761         var m, i, elem, nid, match, groups, newSelector,
762                 newContext = context && context.ownerDocument,
764                 // nodeType defaults to 9, since context defaults to document
765                 nodeType = context ? context.nodeType : 9;
767         results = results || [];
769         // Return early from calls with invalid selector or context
770         if ( typeof selector !== "string" || !selector ||
771                 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
773                 return results;
774         }
776         // Try to shortcut find operations (as opposed to filters) in HTML documents
777         if ( !seed ) {
779                 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
780                         setDocument( context );
781                 }
782                 context = context || document;
784                 if ( documentIsHTML ) {
786                         // If the selector is sufficiently simple, try using a "get*By*" DOM method
787                         // (excepting DocumentFragment context, where the methods don't exist)
788                         if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
790                                 // ID selector
791                                 if ( (m = match[1]) ) {
793                                         // Document context
794                                         if ( nodeType === 9 ) {
795                                                 if ( (elem = context.getElementById( m )) ) {
797                                                         // Support: IE, Opera, Webkit
798                                                         // TODO: identify versions
799                                                         // getElementById can match elements by name instead of ID
800                                                         if ( elem.id === m ) {
801                                                                 results.push( elem );
802                                                                 return results;
803                                                         }
804                                                 } else {
805                                                         return results;
806                                                 }
808                                         // Element context
809                                         } else {
811                                                 // Support: IE, Opera, Webkit
812                                                 // TODO: identify versions
813                                                 // getElementById can match elements by name instead of ID
814                                                 if ( newContext && (elem = newContext.getElementById( m )) &&
815                                                         contains( context, elem ) &&
816                                                         elem.id === m ) {
818                                                         results.push( elem );
819                                                         return results;
820                                                 }
821                                         }
823                                 // Type selector
824                                 } else if ( match[2] ) {
825                                         push.apply( results, context.getElementsByTagName( selector ) );
826                                         return results;
828                                 // Class selector
829                                 } else if ( (m = match[3]) && support.getElementsByClassName &&
830                                         context.getElementsByClassName ) {
832                                         push.apply( results, context.getElementsByClassName( m ) );
833                                         return results;
834                                 }
835                         }
837                         // Take advantage of querySelectorAll
838                         if ( support.qsa &&
839                                 !compilerCache[ selector + " " ] &&
840                                 (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
842                                 if ( nodeType !== 1 ) {
843                                         newContext = context;
844                                         newSelector = selector;
846                                 // qSA looks outside Element context, which is not what we want
847                                 // Thanks to Andrew Dupont for this workaround technique
848                                 // Support: IE <=8
849                                 // Exclude object elements
850                                 } else if ( context.nodeName.toLowerCase() !== "object" ) {
852                                         // Capture the context ID, setting it first if necessary
853                                         if ( (nid = context.getAttribute( "id" )) ) {
854                                                 nid = nid.replace( rcssescape, fcssescape );
855                                         } else {
856                                                 context.setAttribute( "id", (nid = expando) );
857                                         }
859                                         // Prefix every selector in the list
860                                         groups = tokenize( selector );
861                                         i = groups.length;
862                                         while ( i-- ) {
863                                                 groups[i] = "#" + nid + " " + toSelector( groups[i] );
864                                         }
865                                         newSelector = groups.join( "," );
867                                         // Expand context for sibling selectors
868                                         newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
869                                                 context;
870                                 }
872                                 if ( newSelector ) {
873                                         try {
874                                                 push.apply( results,
875                                                         newContext.querySelectorAll( newSelector )
876                                                 );
877                                                 return results;
878                                         } catch ( qsaError ) {
879                                         } finally {
880                                                 if ( nid === expando ) {
881                                                         context.removeAttribute( "id" );
882                                                 }
883                                         }
884                                 }
885                         }
886                 }
887         }
889         // All others
890         return select( selector.replace( rtrim, "$1" ), context, results, seed );
894  * Create key-value caches of limited size
895  * @returns {function(string, object)} Returns the Object data after storing it on itself with
896  *      property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
897  *      deleting the oldest entry
898  */
899 function createCache() {
900         var keys = [];
902         function cache( key, value ) {
903                 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
904                 if ( keys.push( key + " " ) > Expr.cacheLength ) {
905                         // Only keep the most recent entries
906                         delete cache[ keys.shift() ];
907                 }
908                 return (cache[ key + " " ] = value);
909         }
910         return cache;
914  * Mark a function for special use by Sizzle
915  * @param {Function} fn The function to mark
916  */
917 function markFunction( fn ) {
918         fn[ expando ] = true;
919         return fn;
923  * Support testing using an element
924  * @param {Function} fn Passed the created element and returns a boolean result
925  */
926 function assert( fn ) {
927         var el = document.createElement("fieldset");
929         try {
930                 return !!fn( el );
931         } catch (e) {
932                 return false;
933         } finally {
934                 // Remove from its parent by default
935                 if ( el.parentNode ) {
936                         el.parentNode.removeChild( el );
937                 }
938                 // release memory in IE
939                 el = null;
940         }
944  * Adds the same handler for all of the specified attrs
945  * @param {String} attrs Pipe-separated list of attributes
946  * @param {Function} handler The method that will be applied
947  */
948 function addHandle( attrs, handler ) {
949         var arr = attrs.split("|"),
950                 i = arr.length;
952         while ( i-- ) {
953                 Expr.attrHandle[ arr[i] ] = handler;
954         }
958  * Checks document order of two siblings
959  * @param {Element} a
960  * @param {Element} b
961  * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
962  */
963 function siblingCheck( a, b ) {
964         var cur = b && a,
965                 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
966                         a.sourceIndex - b.sourceIndex;
968         // Use IE sourceIndex if available on both nodes
969         if ( diff ) {
970                 return diff;
971         }
973         // Check if b follows a
974         if ( cur ) {
975                 while ( (cur = cur.nextSibling) ) {
976                         if ( cur === b ) {
977                                 return -1;
978                         }
979                 }
980         }
982         return a ? 1 : -1;
986  * Returns a function to use in pseudos for input types
987  * @param {String} type
988  */
989 function createInputPseudo( type ) {
990         return function( elem ) {
991                 var name = elem.nodeName.toLowerCase();
992                 return name === "input" && elem.type === type;
993         };
997  * Returns a function to use in pseudos for buttons
998  * @param {String} type
999  */
1000 function createButtonPseudo( type ) {
1001         return function( elem ) {
1002                 var name = elem.nodeName.toLowerCase();
1003                 return (name === "input" || name === "button") && elem.type === type;
1004         };
1008  * Returns a function to use in pseudos for :enabled/:disabled
1009  * @param {Boolean} disabled true for :disabled; false for :enabled
1010  */
1011 function createDisabledPseudo( disabled ) {
1012         // Known :disabled false positives:
1013         // IE: *[disabled]:not(button, input, select, textarea, optgroup, option, menuitem, fieldset)
1014         // not IE: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
1015         return function( elem ) {
1017                 // Check form elements and option elements for explicit disabling
1018                 return "label" in elem && elem.disabled === disabled ||
1019                         "form" in elem && elem.disabled === disabled ||
1021                         // Check non-disabled form elements for fieldset[disabled] ancestors
1022                         "form" in elem && elem.disabled === false && (
1023                                 // Support: IE6-11+
1024                                 // Ancestry is covered for us
1025                                 elem.isDisabled === disabled ||
1027                                 // Otherwise, assume any non-<option> under fieldset[disabled] is disabled
1028                                 /* jshint -W018 */
1029                                 elem.isDisabled !== !disabled &&
1030                                         ("label" in elem || !disabledAncestor( elem )) !== disabled
1031                         );
1032         };
1036  * Returns a function to use in pseudos for positionals
1037  * @param {Function} fn
1038  */
1039 function createPositionalPseudo( fn ) {
1040         return markFunction(function( argument ) {
1041                 argument = +argument;
1042                 return markFunction(function( seed, matches ) {
1043                         var j,
1044                                 matchIndexes = fn( [], seed.length, argument ),
1045                                 i = matchIndexes.length;
1047                         // Match elements found at the specified indexes
1048                         while ( i-- ) {
1049                                 if ( seed[ (j = matchIndexes[i]) ] ) {
1050                                         seed[j] = !(matches[j] = seed[j]);
1051                                 }
1052                         }
1053                 });
1054         });
1058  * Checks a node for validity as a Sizzle context
1059  * @param {Element|Object=} context
1060  * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
1061  */
1062 function testContext( context ) {
1063         return context && typeof context.getElementsByTagName !== "undefined" && context;
1066 // Expose support vars for convenience
1067 support = Sizzle.support = {};
1070  * Detects XML nodes
1071  * @param {Element|Object} elem An element or a document
1072  * @returns {Boolean} True iff elem is a non-HTML XML node
1073  */
1074 isXML = Sizzle.isXML = function( elem ) {
1075         // documentElement is verified for cases where it doesn't yet exist
1076         // (such as loading iframes in IE - #4833)
1077         var documentElement = elem && (elem.ownerDocument || elem).documentElement;
1078         return documentElement ? documentElement.nodeName !== "HTML" : false;
1082  * Sets document-related variables once based on the current document
1083  * @param {Element|Object} [doc] An element or document object to use to set the document
1084  * @returns {Object} Returns the current document
1085  */
1086 setDocument = Sizzle.setDocument = function( node ) {
1087         var hasCompare, subWindow,
1088                 doc = node ? node.ownerDocument || node : preferredDoc;
1090         // Return early if doc is invalid or already selected
1091         if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
1092                 return document;
1093         }
1095         // Update global variables
1096         document = doc;
1097         docElem = document.documentElement;
1098         documentIsHTML = !isXML( document );
1100         // Support: IE 9-11, Edge
1101         // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
1102         if ( preferredDoc !== document &&
1103                 (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
1105                 // Support: IE 11, Edge
1106                 if ( subWindow.addEventListener ) {
1107                         subWindow.addEventListener( "unload", unloadHandler, false );
1109                 // Support: IE 9 - 10 only
1110                 } else if ( subWindow.attachEvent ) {
1111                         subWindow.attachEvent( "onunload", unloadHandler );
1112                 }
1113         }
1115         /* Attributes
1116         ---------------------------------------------------------------------- */
1118         // Support: IE<8
1119         // Verify that getAttribute really returns attributes and not properties
1120         // (excepting IE8 booleans)
1121         support.attributes = assert(function( el ) {
1122                 el.className = "i";
1123                 return !el.getAttribute("className");
1124         });
1126         /* getElement(s)By*
1127         ---------------------------------------------------------------------- */
1129         // Check if getElementsByTagName("*") returns only elements
1130         support.getElementsByTagName = assert(function( el ) {
1131                 el.appendChild( document.createComment("") );
1132                 return !el.getElementsByTagName("*").length;
1133         });
1135         // Support: IE<9
1136         support.getElementsByClassName = rnative.test( document.getElementsByClassName );
1138         // Support: IE<10
1139         // Check if getElementById returns elements by name
1140         // The broken getElementById methods don't pick up programmatically-set names,
1141         // so use a roundabout getElementsByName test
1142         support.getById = assert(function( el ) {
1143                 docElem.appendChild( el ).id = expando;
1144                 return !document.getElementsByName || !document.getElementsByName( expando ).length;
1145         });
1147         // ID find and filter
1148         if ( support.getById ) {
1149                 Expr.find["ID"] = function( id, context ) {
1150                         if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1151                                 var m = context.getElementById( id );
1152                                 return m ? [ m ] : [];
1153                         }
1154                 };
1155                 Expr.filter["ID"] = function( id ) {
1156                         var attrId = id.replace( runescape, funescape );
1157                         return function( elem ) {
1158                                 return elem.getAttribute("id") === attrId;
1159                         };
1160                 };
1161         } else {
1162                 // Support: IE6/7
1163                 // getElementById is not reliable as a find shortcut
1164                 delete Expr.find["ID"];
1166                 Expr.filter["ID"] =  function( id ) {
1167                         var attrId = id.replace( runescape, funescape );
1168                         return function( elem ) {
1169                                 var node = typeof elem.getAttributeNode !== "undefined" &&
1170                                         elem.getAttributeNode("id");
1171                                 return node && node.value === attrId;
1172                         };
1173                 };
1174         }
1176         // Tag
1177         Expr.find["TAG"] = support.getElementsByTagName ?
1178                 function( tag, context ) {
1179                         if ( typeof context.getElementsByTagName !== "undefined" ) {
1180                                 return context.getElementsByTagName( tag );
1182                         // DocumentFragment nodes don't have gEBTN
1183                         } else if ( support.qsa ) {
1184                                 return context.querySelectorAll( tag );
1185                         }
1186                 } :
1188                 function( tag, context ) {
1189                         var elem,
1190                                 tmp = [],
1191                                 i = 0,
1192                                 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
1193                                 results = context.getElementsByTagName( tag );
1195                         // Filter out possible comments
1196                         if ( tag === "*" ) {
1197                                 while ( (elem = results[i++]) ) {
1198                                         if ( elem.nodeType === 1 ) {
1199                                                 tmp.push( elem );
1200                                         }
1201                                 }
1203                                 return tmp;
1204                         }
1205                         return results;
1206                 };
1208         // Class
1209         Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
1210                 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
1211                         return context.getElementsByClassName( className );
1212                 }
1213         };
1215         /* QSA/matchesSelector
1216         ---------------------------------------------------------------------- */
1218         // QSA and matchesSelector support
1220         // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
1221         rbuggyMatches = [];
1223         // qSa(:focus) reports false when true (Chrome 21)
1224         // We allow this because of a bug in IE8/9 that throws an error
1225         // whenever `document.activeElement` is accessed on an iframe
1226         // So, we allow :focus to pass through QSA all the time to avoid the IE error
1227         // See https://bugs.jquery.com/ticket/13378
1228         rbuggyQSA = [];
1230         if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
1231                 // Build QSA regex
1232                 // Regex strategy adopted from Diego Perini
1233                 assert(function( el ) {
1234                         // Select is set to empty string on purpose
1235                         // This is to test IE's treatment of not explicitly
1236                         // setting a boolean content attribute,
1237                         // since its presence should be enough
1238                         // https://bugs.jquery.com/ticket/12359
1239                         docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
1240                                 "<select id='" + expando + "-\r\\' msallowcapture=''>" +
1241                                 "<option selected=''></option></select>";
1243                         // Support: IE8, Opera 11-12.16
1244                         // Nothing should be selected when empty strings follow ^= or $= or *=
1245                         // The test attribute must be unknown in Opera but "safe" for WinRT
1246                         // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
1247                         if ( el.querySelectorAll("[msallowcapture^='']").length ) {
1248                                 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
1249                         }
1251                         // Support: IE8
1252                         // Boolean attributes and "value" are not treated correctly
1253                         if ( !el.querySelectorAll("[selected]").length ) {
1254                                 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
1255                         }
1257                         // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
1258                         if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
1259                                 rbuggyQSA.push("~=");
1260                         }
1262                         // Webkit/Opera - :checked should return selected option elements
1263                         // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1264                         // IE8 throws error here and will not see later tests
1265                         if ( !el.querySelectorAll(":checked").length ) {
1266                                 rbuggyQSA.push(":checked");
1267                         }
1269                         // Support: Safari 8+, iOS 8+
1270                         // https://bugs.webkit.org/show_bug.cgi?id=136851
1271                         // In-page `selector#id sibling-combinator selector` fails
1272                         if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
1273                                 rbuggyQSA.push(".#.+[+~]");
1274                         }
1275                 });
1277                 assert(function( el ) {
1278                         el.innerHTML = "<a href='' disabled='disabled'></a>" +
1279                                 "<select disabled='disabled'><option/></select>";
1281                         // Support: Windows 8 Native Apps
1282                         // The type and name attributes are restricted during .innerHTML assignment
1283                         var input = document.createElement("input");
1284                         input.setAttribute( "type", "hidden" );
1285                         el.appendChild( input ).setAttribute( "name", "D" );
1287                         // Support: IE8
1288                         // Enforce case-sensitivity of name attribute
1289                         if ( el.querySelectorAll("[name=d]").length ) {
1290                                 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
1291                         }
1293                         // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
1294                         // IE8 throws error here and will not see later tests
1295                         if ( el.querySelectorAll(":enabled").length !== 2 ) {
1296                                 rbuggyQSA.push( ":enabled", ":disabled" );
1297                         }
1299                         // Support: IE9-11+
1300                         // IE's :disabled selector does not pick up the children of disabled fieldsets
1301                         docElem.appendChild( el ).disabled = true;
1302                         if ( el.querySelectorAll(":disabled").length !== 2 ) {
1303                                 rbuggyQSA.push( ":enabled", ":disabled" );
1304                         }
1306                         // Opera 10-11 does not throw on post-comma invalid pseudos
1307                         el.querySelectorAll("*,:x");
1308                         rbuggyQSA.push(",.*:");
1309                 });
1310         }
1312         if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
1313                 docElem.webkitMatchesSelector ||
1314                 docElem.mozMatchesSelector ||
1315                 docElem.oMatchesSelector ||
1316                 docElem.msMatchesSelector) )) ) {
1318                 assert(function( el ) {
1319                         // Check to see if it's possible to do matchesSelector
1320                         // on a disconnected node (IE 9)
1321                         support.disconnectedMatch = matches.call( el, "*" );
1323                         // This should fail with an exception
1324                         // Gecko does not error, returns false instead
1325                         matches.call( el, "[s!='']:x" );
1326                         rbuggyMatches.push( "!=", pseudos );
1327                 });
1328         }
1330         rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
1331         rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
1333         /* Contains
1334         ---------------------------------------------------------------------- */
1335         hasCompare = rnative.test( docElem.compareDocumentPosition );
1337         // Element contains another
1338         // Purposefully self-exclusive
1339         // As in, an element does not contain itself
1340         contains = hasCompare || rnative.test( docElem.contains ) ?
1341                 function( a, b ) {
1342                         var adown = a.nodeType === 9 ? a.documentElement : a,
1343                                 bup = b && b.parentNode;
1344                         return a === bup || !!( bup && bup.nodeType === 1 && (
1345                                 adown.contains ?
1346                                         adown.contains( bup ) :
1347                                         a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
1348                         ));
1349                 } :
1350                 function( a, b ) {
1351                         if ( b ) {
1352                                 while ( (b = b.parentNode) ) {
1353                                         if ( b === a ) {
1354                                                 return true;
1355                                         }
1356                                 }
1357                         }
1358                         return false;
1359                 };
1361         /* Sorting
1362         ---------------------------------------------------------------------- */
1364         // Document order sorting
1365         sortOrder = hasCompare ?
1366         function( a, b ) {
1368                 // Flag for duplicate removal
1369                 if ( a === b ) {
1370                         hasDuplicate = true;
1371                         return 0;
1372                 }
1374                 // Sort on method existence if only one input has compareDocumentPosition
1375                 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
1376                 if ( compare ) {
1377                         return compare;
1378                 }
1380                 // Calculate position if both inputs belong to the same document
1381                 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
1382                         a.compareDocumentPosition( b ) :
1384                         // Otherwise we know they are disconnected
1385                         1;
1387                 // Disconnected nodes
1388                 if ( compare & 1 ||
1389                         (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
1391                         // Choose the first element that is related to our preferred document
1392                         if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
1393                                 return -1;
1394                         }
1395                         if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
1396                                 return 1;
1397                         }
1399                         // Maintain original order
1400                         return sortInput ?
1401                                 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1402                                 0;
1403                 }
1405                 return compare & 4 ? -1 : 1;
1406         } :
1407         function( a, b ) {
1408                 // Exit early if the nodes are identical
1409                 if ( a === b ) {
1410                         hasDuplicate = true;
1411                         return 0;
1412                 }
1414                 var cur,
1415                         i = 0,
1416                         aup = a.parentNode,
1417                         bup = b.parentNode,
1418                         ap = [ a ],
1419                         bp = [ b ];
1421                 // Parentless nodes are either documents or disconnected
1422                 if ( !aup || !bup ) {
1423                         return a === document ? -1 :
1424                                 b === document ? 1 :
1425                                 aup ? -1 :
1426                                 bup ? 1 :
1427                                 sortInput ?
1428                                 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1429                                 0;
1431                 // If the nodes are siblings, we can do a quick check
1432                 } else if ( aup === bup ) {
1433                         return siblingCheck( a, b );
1434                 }
1436                 // Otherwise we need full lists of their ancestors for comparison
1437                 cur = a;
1438                 while ( (cur = cur.parentNode) ) {
1439                         ap.unshift( cur );
1440                 }
1441                 cur = b;
1442                 while ( (cur = cur.parentNode) ) {
1443                         bp.unshift( cur );
1444                 }
1446                 // Walk down the tree looking for a discrepancy
1447                 while ( ap[i] === bp[i] ) {
1448                         i++;
1449                 }
1451                 return i ?
1452                         // Do a sibling check if the nodes have a common ancestor
1453                         siblingCheck( ap[i], bp[i] ) :
1455                         // Otherwise nodes in our document sort first
1456                         ap[i] === preferredDoc ? -1 :
1457                         bp[i] === preferredDoc ? 1 :
1458                         0;
1459         };
1461         return document;
1464 Sizzle.matches = function( expr, elements ) {
1465         return Sizzle( expr, null, null, elements );
1468 Sizzle.matchesSelector = function( elem, expr ) {
1469         // Set document vars if needed
1470         if ( ( elem.ownerDocument || elem ) !== document ) {
1471                 setDocument( elem );
1472         }
1474         // Make sure that attribute selectors are quoted
1475         expr = expr.replace( rattributeQuotes, "='$1']" );
1477         if ( support.matchesSelector && documentIsHTML &&
1478                 !compilerCache[ expr + " " ] &&
1479                 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
1480                 ( !rbuggyQSA     || !rbuggyQSA.test( expr ) ) ) {
1482                 try {
1483                         var ret = matches.call( elem, expr );
1485                         // IE 9's matchesSelector returns false on disconnected nodes
1486                         if ( ret || support.disconnectedMatch ||
1487                                         // As well, disconnected nodes are said to be in a document
1488                                         // fragment in IE 9
1489                                         elem.document && elem.document.nodeType !== 11 ) {
1490                                 return ret;
1491                         }
1492                 } catch (e) {}
1493         }
1495         return Sizzle( expr, document, null, [ elem ] ).length > 0;
1498 Sizzle.contains = function( context, elem ) {
1499         // Set document vars if needed
1500         if ( ( context.ownerDocument || context ) !== document ) {
1501                 setDocument( context );
1502         }
1503         return contains( context, elem );
1506 Sizzle.attr = function( elem, name ) {
1507         // Set document vars if needed
1508         if ( ( elem.ownerDocument || elem ) !== document ) {
1509                 setDocument( elem );
1510         }
1512         var fn = Expr.attrHandle[ name.toLowerCase() ],
1513                 // Don't get fooled by Object.prototype properties (jQuery #13807)
1514                 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
1515                         fn( elem, name, !documentIsHTML ) :
1516                         undefined;
1518         return val !== undefined ?
1519                 val :
1520                 support.attributes || !documentIsHTML ?
1521                         elem.getAttribute( name ) :
1522                         (val = elem.getAttributeNode(name)) && val.specified ?
1523                                 val.value :
1524                                 null;
1527 Sizzle.escape = function( sel ) {
1528         return (sel + "").replace( rcssescape, fcssescape );
1531 Sizzle.error = function( msg ) {
1532         throw new Error( "Syntax error, unrecognized expression: " + msg );
1536  * Document sorting and removing duplicates
1537  * @param {ArrayLike} results
1538  */
1539 Sizzle.uniqueSort = function( results ) {
1540         var elem,
1541                 duplicates = [],
1542                 j = 0,
1543                 i = 0;
1545         // Unless we *know* we can detect duplicates, assume their presence
1546         hasDuplicate = !support.detectDuplicates;
1547         sortInput = !support.sortStable && results.slice( 0 );
1548         results.sort( sortOrder );
1550         if ( hasDuplicate ) {
1551                 while ( (elem = results[i++]) ) {
1552                         if ( elem === results[ i ] ) {
1553                                 j = duplicates.push( i );
1554                         }
1555                 }
1556                 while ( j-- ) {
1557                         results.splice( duplicates[ j ], 1 );
1558                 }
1559         }
1561         // Clear input after sorting to release objects
1562         // See https://github.com/jquery/sizzle/pull/225
1563         sortInput = null;
1565         return results;
1569  * Utility function for retrieving the text value of an array of DOM nodes
1570  * @param {Array|Element} elem
1571  */
1572 getText = Sizzle.getText = function( elem ) {
1573         var node,
1574                 ret = "",
1575                 i = 0,
1576                 nodeType = elem.nodeType;
1578         if ( !nodeType ) {
1579                 // If no nodeType, this is expected to be an array
1580                 while ( (node = elem[i++]) ) {
1581                         // Do not traverse comment nodes
1582                         ret += getText( node );
1583                 }
1584         } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
1585                 // Use textContent for elements
1586                 // innerText usage removed for consistency of new lines (jQuery #11153)
1587                 if ( typeof elem.textContent === "string" ) {
1588                         return elem.textContent;
1589                 } else {
1590                         // Traverse its children
1591                         for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1592                                 ret += getText( elem );
1593                         }
1594                 }
1595         } else if ( nodeType === 3 || nodeType === 4 ) {
1596                 return elem.nodeValue;
1597         }
1598         // Do not include comment or processing instruction nodes
1600         return ret;
1603 Expr = Sizzle.selectors = {
1605         // Can be adjusted by the user
1606         cacheLength: 50,
1608         createPseudo: markFunction,
1610         match: matchExpr,
1612         attrHandle: {},
1614         find: {},
1616         relative: {
1617                 ">": { dir: "parentNode", first: true },
1618                 " ": { dir: "parentNode" },
1619                 "+": { dir: "previousSibling", first: true },
1620                 "~": { dir: "previousSibling" }
1621         },
1623         preFilter: {
1624                 "ATTR": function( match ) {
1625                         match[1] = match[1].replace( runescape, funescape );
1627                         // Move the given value to match[3] whether quoted or unquoted
1628                         match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
1630                         if ( match[2] === "~=" ) {
1631                                 match[3] = " " + match[3] + " ";
1632                         }
1634                         return match.slice( 0, 4 );
1635                 },
1637                 "CHILD": function( match ) {
1638                         /* matches from matchExpr["CHILD"]
1639                                 1 type (only|nth|...)
1640                                 2 what (child|of-type)
1641                                 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
1642                                 4 xn-component of xn+y argument ([+-]?\d*n|)
1643                                 5 sign of xn-component
1644                                 6 x of xn-component
1645                                 7 sign of y-component
1646                                 8 y of y-component
1647                         */
1648                         match[1] = match[1].toLowerCase();
1650                         if ( match[1].slice( 0, 3 ) === "nth" ) {
1651                                 // nth-* requires argument
1652                                 if ( !match[3] ) {
1653                                         Sizzle.error( match[0] );
1654                                 }
1656                                 // numeric x and y parameters for Expr.filter.CHILD
1657                                 // remember that false/true cast respectively to 0/1
1658                                 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
1659                                 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
1661                         // other types prohibit arguments
1662                         } else if ( match[3] ) {
1663                                 Sizzle.error( match[0] );
1664                         }
1666                         return match;
1667                 },
1669                 "PSEUDO": function( match ) {
1670                         var excess,
1671                                 unquoted = !match[6] && match[2];
1673                         if ( matchExpr["CHILD"].test( match[0] ) ) {
1674                                 return null;
1675                         }
1677                         // Accept quoted arguments as-is
1678                         if ( match[3] ) {
1679                                 match[2] = match[4] || match[5] || "";
1681                         // Strip excess characters from unquoted arguments
1682                         } else if ( unquoted && rpseudo.test( unquoted ) &&
1683                                 // Get excess from tokenize (recursively)
1684                                 (excess = tokenize( unquoted, true )) &&
1685                                 // advance to the next closing parenthesis
1686                                 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
1688                                 // excess is a negative index
1689                                 match[0] = match[0].slice( 0, excess );
1690                                 match[2] = unquoted.slice( 0, excess );
1691                         }
1693                         // Return only captures needed by the pseudo filter method (type and argument)
1694                         return match.slice( 0, 3 );
1695                 }
1696         },
1698         filter: {
1700                 "TAG": function( nodeNameSelector ) {
1701                         var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1702                         return nodeNameSelector === "*" ?
1703                                 function() { return true; } :
1704                                 function( elem ) {
1705                                         return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
1706                                 };
1707                 },
1709                 "CLASS": function( className ) {
1710                         var pattern = classCache[ className + " " ];
1712                         return pattern ||
1713                                 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
1714                                 classCache( className, function( elem ) {
1715                                         return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
1716                                 });
1717                 },
1719                 "ATTR": function( name, operator, check ) {
1720                         return function( elem ) {
1721                                 var result = Sizzle.attr( elem, name );
1723                                 if ( result == null ) {
1724                                         return operator === "!=";
1725                                 }
1726                                 if ( !operator ) {
1727                                         return true;
1728                                 }
1730                                 result += "";
1732                                 return operator === "=" ? result === check :
1733                                         operator === "!=" ? result !== check :
1734                                         operator === "^=" ? check && result.indexOf( check ) === 0 :
1735                                         operator === "*=" ? check && result.indexOf( check ) > -1 :
1736                                         operator === "$=" ? check && result.slice( -check.length ) === check :
1737                                         operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
1738                                         operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
1739                                         false;
1740                         };
1741                 },
1743                 "CHILD": function( type, what, argument, first, last ) {
1744                         var simple = type.slice( 0, 3 ) !== "nth",
1745                                 forward = type.slice( -4 ) !== "last",
1746                                 ofType = what === "of-type";
1748                         return first === 1 && last === 0 ?
1750                                 // Shortcut for :nth-*(n)
1751                                 function( elem ) {
1752                                         return !!elem.parentNode;
1753                                 } :
1755                                 function( elem, context, xml ) {
1756                                         var cache, uniqueCache, outerCache, node, nodeIndex, start,
1757                                                 dir = simple !== forward ? "nextSibling" : "previousSibling",
1758                                                 parent = elem.parentNode,
1759                                                 name = ofType && elem.nodeName.toLowerCase(),
1760                                                 useCache = !xml && !ofType,
1761                                                 diff = false;
1763                                         if ( parent ) {
1765                                                 // :(first|last|only)-(child|of-type)
1766                                                 if ( simple ) {
1767                                                         while ( dir ) {
1768                                                                 node = elem;
1769                                                                 while ( (node = node[ dir ]) ) {
1770                                                                         if ( ofType ?
1771                                                                                 node.nodeName.toLowerCase() === name :
1772                                                                                 node.nodeType === 1 ) {
1774                                                                                 return false;
1775                                                                         }
1776                                                                 }
1777                                                                 // Reverse direction for :only-* (if we haven't yet done so)
1778                                                                 start = dir = type === "only" && !start && "nextSibling";
1779                                                         }
1780                                                         return true;
1781                                                 }
1783                                                 start = [ forward ? parent.firstChild : parent.lastChild ];
1785                                                 // non-xml :nth-child(...) stores cache data on `parent`
1786                                                 if ( forward && useCache ) {
1788                                                         // Seek `elem` from a previously-cached index
1790                                                         // ...in a gzip-friendly way
1791                                                         node = parent;
1792                                                         outerCache = node[ expando ] || (node[ expando ] = {});
1794                                                         // Support: IE <9 only
1795                                                         // Defend against cloned attroperties (jQuery gh-1709)
1796                                                         uniqueCache = outerCache[ node.uniqueID ] ||
1797                                                                 (outerCache[ node.uniqueID ] = {});
1799                                                         cache = uniqueCache[ type ] || [];
1800                                                         nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1801                                                         diff = nodeIndex && cache[ 2 ];
1802                                                         node = nodeIndex && parent.childNodes[ nodeIndex ];
1804                                                         while ( (node = ++nodeIndex && node && node[ dir ] ||
1806                                                                 // Fallback to seeking `elem` from the start
1807                                                                 (diff = nodeIndex = 0) || start.pop()) ) {
1809                                                                 // When found, cache indexes on `parent` and break
1810                                                                 if ( node.nodeType === 1 && ++diff && node === elem ) {
1811                                                                         uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
1812                                                                         break;
1813                                                                 }
1814                                                         }
1816                                                 } else {
1817                                                         // Use previously-cached element index if available
1818                                                         if ( useCache ) {
1819                                                                 // ...in a gzip-friendly way
1820                                                                 node = elem;
1821                                                                 outerCache = node[ expando ] || (node[ expando ] = {});
1823                                                                 // Support: IE <9 only
1824                                                                 // Defend against cloned attroperties (jQuery gh-1709)
1825                                                                 uniqueCache = outerCache[ node.uniqueID ] ||
1826                                                                         (outerCache[ node.uniqueID ] = {});
1828                                                                 cache = uniqueCache[ type ] || [];
1829                                                                 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1830                                                                 diff = nodeIndex;
1831                                                         }
1833                                                         // xml :nth-child(...)
1834                                                         // or :nth-last-child(...) or :nth(-last)?-of-type(...)
1835                                                         if ( diff === false ) {
1836                                                                 // Use the same loop as above to seek `elem` from the start
1837                                                                 while ( (node = ++nodeIndex && node && node[ dir ] ||
1838                                                                         (diff = nodeIndex = 0) || start.pop()) ) {
1840                                                                         if ( ( ofType ?
1841                                                                                 node.nodeName.toLowerCase() === name :
1842                                                                                 node.nodeType === 1 ) &&
1843                                                                                 ++diff ) {
1845                                                                                 // Cache the index of each encountered element
1846                                                                                 if ( useCache ) {
1847                                                                                         outerCache = node[ expando ] || (node[ expando ] = {});
1849                                                                                         // Support: IE <9 only
1850                                                                                         // Defend against cloned attroperties (jQuery gh-1709)
1851                                                                                         uniqueCache = outerCache[ node.uniqueID ] ||
1852                                                                                                 (outerCache[ node.uniqueID ] = {});
1854                                                                                         uniqueCache[ type ] = [ dirruns, diff ];
1855                                                                                 }
1857                                                                                 if ( node === elem ) {
1858                                                                                         break;
1859                                                                                 }
1860                                                                         }
1861                                                                 }
1862                                                         }
1863                                                 }
1865                                                 // Incorporate the offset, then check against cycle size
1866                                                 diff -= last;
1867                                                 return diff === first || ( diff % first === 0 && diff / first >= 0 );
1868                                         }
1869                                 };
1870                 },
1872                 "PSEUDO": function( pseudo, argument ) {
1873                         // pseudo-class names are case-insensitive
1874                         // http://www.w3.org/TR/selectors/#pseudo-classes
1875                         // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
1876                         // Remember that setFilters inherits from pseudos
1877                         var args,
1878                                 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
1879                                         Sizzle.error( "unsupported pseudo: " + pseudo );
1881                         // The user may use createPseudo to indicate that
1882                         // arguments are needed to create the filter function
1883                         // just as Sizzle does
1884                         if ( fn[ expando ] ) {
1885                                 return fn( argument );
1886                         }
1888                         // But maintain support for old signatures
1889                         if ( fn.length > 1 ) {
1890                                 args = [ pseudo, pseudo, "", argument ];
1891                                 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
1892                                         markFunction(function( seed, matches ) {
1893                                                 var idx,
1894                                                         matched = fn( seed, argument ),
1895                                                         i = matched.length;
1896                                                 while ( i-- ) {
1897                                                         idx = indexOf( seed, matched[i] );
1898                                                         seed[ idx ] = !( matches[ idx ] = matched[i] );
1899                                                 }
1900                                         }) :
1901                                         function( elem ) {
1902                                                 return fn( elem, 0, args );
1903                                         };
1904                         }
1906                         return fn;
1907                 }
1908         },
1910         pseudos: {
1911                 // Potentially complex pseudos
1912                 "not": markFunction(function( selector ) {
1913                         // Trim the selector passed to compile
1914                         // to avoid treating leading and trailing
1915                         // spaces as combinators
1916                         var input = [],
1917                                 results = [],
1918                                 matcher = compile( selector.replace( rtrim, "$1" ) );
1920                         return matcher[ expando ] ?
1921                                 markFunction(function( seed, matches, context, xml ) {
1922                                         var elem,
1923                                                 unmatched = matcher( seed, null, xml, [] ),
1924                                                 i = seed.length;
1926                                         // Match elements unmatched by `matcher`
1927                                         while ( i-- ) {
1928                                                 if ( (elem = unmatched[i]) ) {
1929                                                         seed[i] = !(matches[i] = elem);
1930                                                 }
1931                                         }
1932                                 }) :
1933                                 function( elem, context, xml ) {
1934                                         input[0] = elem;
1935                                         matcher( input, null, xml, results );
1936                                         // Don't keep the element (issue #299)
1937                                         input[0] = null;
1938                                         return !results.pop();
1939                                 };
1940                 }),
1942                 "has": markFunction(function( selector ) {
1943                         return function( elem ) {
1944                                 return Sizzle( selector, elem ).length > 0;
1945                         };
1946                 }),
1948                 "contains": markFunction(function( text ) {
1949                         text = text.replace( runescape, funescape );
1950                         return function( elem ) {
1951                                 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
1952                         };
1953                 }),
1955                 // "Whether an element is represented by a :lang() selector
1956                 // is based solely on the element's language value
1957                 // being equal to the identifier C,
1958                 // or beginning with the identifier C immediately followed by "-".
1959                 // The matching of C against the element's language value is performed case-insensitively.
1960                 // The identifier C does not have to be a valid language name."
1961                 // http://www.w3.org/TR/selectors/#lang-pseudo
1962                 "lang": markFunction( function( lang ) {
1963                         // lang value must be a valid identifier
1964                         if ( !ridentifier.test(lang || "") ) {
1965                                 Sizzle.error( "unsupported lang: " + lang );
1966                         }
1967                         lang = lang.replace( runescape, funescape ).toLowerCase();
1968                         return function( elem ) {
1969                                 var elemLang;
1970                                 do {
1971                                         if ( (elemLang = documentIsHTML ?
1972                                                 elem.lang :
1973                                                 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
1975                                                 elemLang = elemLang.toLowerCase();
1976                                                 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
1977                                         }
1978                                 } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
1979                                 return false;
1980                         };
1981                 }),
1983                 // Miscellaneous
1984                 "target": function( elem ) {
1985                         var hash = window.location && window.location.hash;
1986                         return hash && hash.slice( 1 ) === elem.id;
1987                 },
1989                 "root": function( elem ) {
1990                         return elem === docElem;
1991                 },
1993                 "focus": function( elem ) {
1994                         return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
1995                 },
1997                 // Boolean properties
1998                 "enabled": createDisabledPseudo( false ),
1999                 "disabled": createDisabledPseudo( true ),
2001                 "checked": function( elem ) {
2002                         // In CSS3, :checked should return both checked and selected elements
2003                         // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
2004                         var nodeName = elem.nodeName.toLowerCase();
2005                         return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
2006                 },
2008                 "selected": function( elem ) {
2009                         // Accessing this property makes selected-by-default
2010                         // options in Safari work properly
2011                         if ( elem.parentNode ) {
2012                                 elem.parentNode.selectedIndex;
2013                         }
2015                         return elem.selected === true;
2016                 },
2018                 // Contents
2019                 "empty": function( elem ) {
2020                         // http://www.w3.org/TR/selectors/#empty-pseudo
2021                         // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
2022                         //   but not by others (comment: 8; processing instruction: 7; etc.)
2023                         // nodeType < 6 works because attributes (2) do not appear as children
2024                         for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
2025                                 if ( elem.nodeType < 6 ) {
2026                                         return false;
2027                                 }
2028                         }
2029                         return true;
2030                 },
2032                 "parent": function( elem ) {
2033                         return !Expr.pseudos["empty"]( elem );
2034                 },
2036                 // Element/input types
2037                 "header": function( elem ) {
2038                         return rheader.test( elem.nodeName );
2039                 },
2041                 "input": function( elem ) {
2042                         return rinputs.test( elem.nodeName );
2043                 },
2045                 "button": function( elem ) {
2046                         var name = elem.nodeName.toLowerCase();
2047                         return name === "input" && elem.type === "button" || name === "button";
2048                 },
2050                 "text": function( elem ) {
2051                         var attr;
2052                         return elem.nodeName.toLowerCase() === "input" &&
2053                                 elem.type === "text" &&
2055                                 // Support: IE<8
2056                                 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
2057                                 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
2058                 },
2060                 // Position-in-collection
2061                 "first": createPositionalPseudo(function() {
2062                         return [ 0 ];
2063                 }),
2065                 "last": createPositionalPseudo(function( matchIndexes, length ) {
2066                         return [ length - 1 ];
2067                 }),
2069                 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
2070                         return [ argument < 0 ? argument + length : argument ];
2071                 }),
2073                 "even": createPositionalPseudo(function( matchIndexes, length ) {
2074                         var i = 0;
2075                         for ( ; i < length; i += 2 ) {
2076                                 matchIndexes.push( i );
2077                         }
2078                         return matchIndexes;
2079                 }),
2081                 "odd": createPositionalPseudo(function( matchIndexes, length ) {
2082                         var i = 1;
2083                         for ( ; i < length; i += 2 ) {
2084                                 matchIndexes.push( i );
2085                         }
2086                         return matchIndexes;
2087                 }),
2089                 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2090                         var i = argument < 0 ? argument + length : argument;
2091                         for ( ; --i >= 0; ) {
2092                                 matchIndexes.push( i );
2093                         }
2094                         return matchIndexes;
2095                 }),
2097                 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2098                         var i = argument < 0 ? argument + length : argument;
2099                         for ( ; ++i < length; ) {
2100                                 matchIndexes.push( i );
2101                         }
2102                         return matchIndexes;
2103                 })
2104         }
2107 Expr.pseudos["nth"] = Expr.pseudos["eq"];
2109 // Add button/input type pseudos
2110 for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
2111         Expr.pseudos[ i ] = createInputPseudo( i );
2113 for ( i in { submit: true, reset: true } ) {
2114         Expr.pseudos[ i ] = createButtonPseudo( i );
2117 // Easy API for creating new setFilters
2118 function setFilters() {}
2119 setFilters.prototype = Expr.filters = Expr.pseudos;
2120 Expr.setFilters = new setFilters();
2122 tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
2123         var matched, match, tokens, type,
2124                 soFar, groups, preFilters,
2125                 cached = tokenCache[ selector + " " ];
2127         if ( cached ) {
2128                 return parseOnly ? 0 : cached.slice( 0 );
2129         }
2131         soFar = selector;
2132         groups = [];
2133         preFilters = Expr.preFilter;
2135         while ( soFar ) {
2137                 // Comma and first run
2138                 if ( !matched || (match = rcomma.exec( soFar )) ) {
2139                         if ( match ) {
2140                                 // Don't consume trailing commas as valid
2141                                 soFar = soFar.slice( match[0].length ) || soFar;
2142                         }
2143                         groups.push( (tokens = []) );
2144                 }
2146                 matched = false;
2148                 // Combinators
2149                 if ( (match = rcombinators.exec( soFar )) ) {
2150                         matched = match.shift();
2151                         tokens.push({
2152                                 value: matched,
2153                                 // Cast descendant combinators to space
2154                                 type: match[0].replace( rtrim, " " )
2155                         });
2156                         soFar = soFar.slice( matched.length );
2157                 }
2159                 // Filters
2160                 for ( type in Expr.filter ) {
2161                         if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
2162                                 (match = preFilters[ type ]( match ))) ) {
2163                                 matched = match.shift();
2164                                 tokens.push({
2165                                         value: matched,
2166                                         type: type,
2167                                         matches: match
2168                                 });
2169                                 soFar = soFar.slice( matched.length );
2170                         }
2171                 }
2173                 if ( !matched ) {
2174                         break;
2175                 }
2176         }
2178         // Return the length of the invalid excess
2179         // if we're just parsing
2180         // Otherwise, throw an error or return tokens
2181         return parseOnly ?
2182                 soFar.length :
2183                 soFar ?
2184                         Sizzle.error( selector ) :
2185                         // Cache the tokens
2186                         tokenCache( selector, groups ).slice( 0 );
2189 function toSelector( tokens ) {
2190         var i = 0,
2191                 len = tokens.length,
2192                 selector = "";
2193         for ( ; i < len; i++ ) {
2194                 selector += tokens[i].value;
2195         }
2196         return selector;
2199 function addCombinator( matcher, combinator, base ) {
2200         var dir = combinator.dir,
2201                 skip = combinator.next,
2202                 key = skip || dir,
2203                 checkNonElements = base && key === "parentNode",
2204                 doneName = done++;
2206         return combinator.first ?
2207                 // Check against closest ancestor/preceding element
2208                 function( elem, context, xml ) {
2209                         while ( (elem = elem[ dir ]) ) {
2210                                 if ( elem.nodeType === 1 || checkNonElements ) {
2211                                         return matcher( elem, context, xml );
2212                                 }
2213                         }
2214                 } :
2216                 // Check against all ancestor/preceding elements
2217                 function( elem, context, xml ) {
2218                         var oldCache, uniqueCache, outerCache,
2219                                 newCache = [ dirruns, doneName ];
2221                         // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
2222                         if ( xml ) {
2223                                 while ( (elem = elem[ dir ]) ) {
2224                                         if ( elem.nodeType === 1 || checkNonElements ) {
2225                                                 if ( matcher( elem, context, xml ) ) {
2226                                                         return true;
2227                                                 }
2228                                         }
2229                                 }
2230                         } else {
2231                                 while ( (elem = elem[ dir ]) ) {
2232                                         if ( elem.nodeType === 1 || checkNonElements ) {
2233                                                 outerCache = elem[ expando ] || (elem[ expando ] = {});
2235                                                 // Support: IE <9 only
2236                                                 // Defend against cloned attroperties (jQuery gh-1709)
2237                                                 uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
2239                                                 if ( skip && skip === elem.nodeName.toLowerCase() ) {
2240                                                         elem = elem[ dir ] || elem;
2241                                                 } else if ( (oldCache = uniqueCache[ key ]) &&
2242                                                         oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
2244                                                         // Assign to newCache so results back-propagate to previous elements
2245                                                         return (newCache[ 2 ] = oldCache[ 2 ]);
2246                                                 } else {
2247                                                         // Reuse newcache so results back-propagate to previous elements
2248                                                         uniqueCache[ key ] = newCache;
2250                                                         // A match means we're done; a fail means we have to keep checking
2251                                                         if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
2252                                                                 return true;
2253                                                         }
2254                                                 }
2255                                         }
2256                                 }
2257                         }
2258                 };
2261 function elementMatcher( matchers ) {
2262         return matchers.length > 1 ?
2263                 function( elem, context, xml ) {
2264                         var i = matchers.length;
2265                         while ( i-- ) {
2266                                 if ( !matchers[i]( elem, context, xml ) ) {
2267                                         return false;
2268                                 }
2269                         }
2270                         return true;
2271                 } :
2272                 matchers[0];
2275 function multipleContexts( selector, contexts, results ) {
2276         var i = 0,
2277                 len = contexts.length;
2278         for ( ; i < len; i++ ) {
2279                 Sizzle( selector, contexts[i], results );
2280         }
2281         return results;
2284 function condense( unmatched, map, filter, context, xml ) {
2285         var elem,
2286                 newUnmatched = [],
2287                 i = 0,
2288                 len = unmatched.length,
2289                 mapped = map != null;
2291         for ( ; i < len; i++ ) {
2292                 if ( (elem = unmatched[i]) ) {
2293                         if ( !filter || filter( elem, context, xml ) ) {
2294                                 newUnmatched.push( elem );
2295                                 if ( mapped ) {
2296                                         map.push( i );
2297                                 }
2298                         }
2299                 }
2300         }
2302         return newUnmatched;
2305 function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
2306         if ( postFilter && !postFilter[ expando ] ) {
2307                 postFilter = setMatcher( postFilter );
2308         }
2309         if ( postFinder && !postFinder[ expando ] ) {
2310                 postFinder = setMatcher( postFinder, postSelector );
2311         }
2312         return markFunction(function( seed, results, context, xml ) {
2313                 var temp, i, elem,
2314                         preMap = [],
2315                         postMap = [],
2316                         preexisting = results.length,
2318                         // Get initial elements from seed or context
2319                         elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
2321                         // Prefilter to get matcher input, preserving a map for seed-results synchronization
2322                         matcherIn = preFilter && ( seed || !selector ) ?
2323                                 condense( elems, preMap, preFilter, context, xml ) :
2324                                 elems,
2326                         matcherOut = matcher ?
2327                                 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
2328                                 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2330                                         // ...intermediate processing is necessary
2331                                         [] :
2333                                         // ...otherwise use results directly
2334                                         results :
2335                                 matcherIn;
2337                 // Find primary matches
2338                 if ( matcher ) {
2339                         matcher( matcherIn, matcherOut, context, xml );
2340                 }
2342                 // Apply postFilter
2343                 if ( postFilter ) {
2344                         temp = condense( matcherOut, postMap );
2345                         postFilter( temp, [], context, xml );
2347                         // Un-match failing elements by moving them back to matcherIn
2348                         i = temp.length;
2349                         while ( i-- ) {
2350                                 if ( (elem = temp[i]) ) {
2351                                         matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
2352                                 }
2353                         }
2354                 }
2356                 if ( seed ) {
2357                         if ( postFinder || preFilter ) {
2358                                 if ( postFinder ) {
2359                                         // Get the final matcherOut by condensing this intermediate into postFinder contexts
2360                                         temp = [];
2361                                         i = matcherOut.length;
2362                                         while ( i-- ) {
2363                                                 if ( (elem = matcherOut[i]) ) {
2364                                                         // Restore matcherIn since elem is not yet a final match
2365                                                         temp.push( (matcherIn[i] = elem) );
2366                                                 }
2367                                         }
2368                                         postFinder( null, (matcherOut = []), temp, xml );
2369                                 }
2371                                 // Move matched elements from seed to results to keep them synchronized
2372                                 i = matcherOut.length;
2373                                 while ( i-- ) {
2374                                         if ( (elem = matcherOut[i]) &&
2375                                                 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
2377                                                 seed[temp] = !(results[temp] = elem);
2378                                         }
2379                                 }
2380                         }
2382                 // Add elements to results, through postFinder if defined
2383                 } else {
2384                         matcherOut = condense(
2385                                 matcherOut === results ?
2386                                         matcherOut.splice( preexisting, matcherOut.length ) :
2387                                         matcherOut
2388                         );
2389                         if ( postFinder ) {
2390                                 postFinder( null, results, matcherOut, xml );
2391                         } else {
2392                                 push.apply( results, matcherOut );
2393                         }
2394                 }
2395         });
2398 function matcherFromTokens( tokens ) {
2399         var checkContext, matcher, j,
2400                 len = tokens.length,
2401                 leadingRelative = Expr.relative[ tokens[0].type ],
2402                 implicitRelative = leadingRelative || Expr.relative[" "],
2403                 i = leadingRelative ? 1 : 0,
2405                 // The foundational matcher ensures that elements are reachable from top-level context(s)
2406                 matchContext = addCombinator( function( elem ) {
2407                         return elem === checkContext;
2408                 }, implicitRelative, true ),
2409                 matchAnyContext = addCombinator( function( elem ) {
2410                         return indexOf( checkContext, elem ) > -1;
2411                 }, implicitRelative, true ),
2412                 matchers = [ function( elem, context, xml ) {
2413                         var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
2414                                 (checkContext = context).nodeType ?
2415                                         matchContext( elem, context, xml ) :
2416                                         matchAnyContext( elem, context, xml ) );
2417                         // Avoid hanging onto element (issue #299)
2418                         checkContext = null;
2419                         return ret;
2420                 } ];
2422         for ( ; i < len; i++ ) {
2423                 if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
2424                         matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
2425                 } else {
2426                         matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
2428                         // Return special upon seeing a positional matcher
2429                         if ( matcher[ expando ] ) {
2430                                 // Find the next relative operator (if any) for proper handling
2431                                 j = ++i;
2432                                 for ( ; j < len; j++ ) {
2433                                         if ( Expr.relative[ tokens[j].type ] ) {
2434                                                 break;
2435                                         }
2436                                 }
2437                                 return setMatcher(
2438                                         i > 1 && elementMatcher( matchers ),
2439                                         i > 1 && toSelector(
2440                                                 // If the preceding token was a descendant combinator, insert an implicit any-element `*`
2441                                                 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
2442                                         ).replace( rtrim, "$1" ),
2443                                         matcher,
2444                                         i < j && matcherFromTokens( tokens.slice( i, j ) ),
2445                                         j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
2446                                         j < len && toSelector( tokens )
2447                                 );
2448                         }
2449                         matchers.push( matcher );
2450                 }
2451         }
2453         return elementMatcher( matchers );
2456 function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2457         var bySet = setMatchers.length > 0,
2458                 byElement = elementMatchers.length > 0,
2459                 superMatcher = function( seed, context, xml, results, outermost ) {
2460                         var elem, j, matcher,
2461                                 matchedCount = 0,
2462                                 i = "0",
2463                                 unmatched = seed && [],
2464                                 setMatched = [],
2465                                 contextBackup = outermostContext,
2466                                 // We must always have either seed elements or outermost context
2467                                 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
2468                                 // Use integer dirruns iff this is the outermost matcher
2469                                 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
2470                                 len = elems.length;
2472                         if ( outermost ) {
2473                                 outermostContext = context === document || context || outermost;
2474                         }
2476                         // Add elements passing elementMatchers directly to results
2477                         // Support: IE<9, Safari
2478                         // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
2479                         for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
2480                                 if ( byElement && elem ) {
2481                                         j = 0;
2482                                         if ( !context && elem.ownerDocument !== document ) {
2483                                                 setDocument( elem );
2484                                                 xml = !documentIsHTML;
2485                                         }
2486                                         while ( (matcher = elementMatchers[j++]) ) {
2487                                                 if ( matcher( elem, context || document, xml) ) {
2488                                                         results.push( elem );
2489                                                         break;
2490                                                 }
2491                                         }
2492                                         if ( outermost ) {
2493                                                 dirruns = dirrunsUnique;
2494                                         }
2495                                 }
2497                                 // Track unmatched elements for set filters
2498                                 if ( bySet ) {
2499                                         // They will have gone through all possible matchers
2500                                         if ( (elem = !matcher && elem) ) {
2501                                                 matchedCount--;
2502                                         }
2504                                         // Lengthen the array for every element, matched or not
2505                                         if ( seed ) {
2506                                                 unmatched.push( elem );
2507                                         }
2508                                 }
2509                         }
2511                         // `i` is now the count of elements visited above, and adding it to `matchedCount`
2512                         // makes the latter nonnegative.
2513                         matchedCount += i;
2515                         // Apply set filters to unmatched elements
2516                         // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
2517                         // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
2518                         // no element matchers and no seed.
2519                         // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
2520                         // case, which will result in a "00" `matchedCount` that differs from `i` but is also
2521                         // numerically zero.
2522                         if ( bySet && i !== matchedCount ) {
2523                                 j = 0;
2524                                 while ( (matcher = setMatchers[j++]) ) {
2525                                         matcher( unmatched, setMatched, context, xml );
2526                                 }
2528                                 if ( seed ) {
2529                                         // Reintegrate element matches to eliminate the need for sorting
2530                                         if ( matchedCount > 0 ) {
2531                                                 while ( i-- ) {
2532                                                         if ( !(unmatched[i] || setMatched[i]) ) {
2533                                                                 setMatched[i] = pop.call( results );
2534                                                         }
2535                                                 }
2536                                         }
2538                                         // Discard index placeholder values to get only actual matches
2539                                         setMatched = condense( setMatched );
2540                                 }
2542                                 // Add matches to results
2543                                 push.apply( results, setMatched );
2545                                 // Seedless set matches succeeding multiple successful matchers stipulate sorting
2546                                 if ( outermost && !seed && setMatched.length > 0 &&
2547                                         ( matchedCount + setMatchers.length ) > 1 ) {
2549                                         Sizzle.uniqueSort( results );
2550                                 }
2551                         }
2553                         // Override manipulation of globals by nested matchers
2554                         if ( outermost ) {
2555                                 dirruns = dirrunsUnique;
2556                                 outermostContext = contextBackup;
2557                         }
2559                         return unmatched;
2560                 };
2562         return bySet ?
2563                 markFunction( superMatcher ) :
2564                 superMatcher;
2567 compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2568         var i,
2569                 setMatchers = [],
2570                 elementMatchers = [],
2571                 cached = compilerCache[ selector + " " ];
2573         if ( !cached ) {
2574                 // Generate a function of recursive functions that can be used to check each element
2575                 if ( !match ) {
2576                         match = tokenize( selector );
2577                 }
2578                 i = match.length;
2579                 while ( i-- ) {
2580                         cached = matcherFromTokens( match[i] );
2581                         if ( cached[ expando ] ) {
2582                                 setMatchers.push( cached );
2583                         } else {
2584                                 elementMatchers.push( cached );
2585                         }
2586                 }
2588                 // Cache the compiled function
2589                 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
2591                 // Save selector and tokenization
2592                 cached.selector = selector;
2593         }
2594         return cached;
2598  * A low-level selection function that works with Sizzle's compiled
2599  *  selector functions
2600  * @param {String|Function} selector A selector or a pre-compiled
2601  *  selector function built with Sizzle.compile
2602  * @param {Element} context
2603  * @param {Array} [results]
2604  * @param {Array} [seed] A set of elements to match against
2605  */
2606 select = Sizzle.select = function( selector, context, results, seed ) {
2607         var i, tokens, token, type, find,
2608                 compiled = typeof selector === "function" && selector,
2609                 match = !seed && tokenize( (selector = compiled.selector || selector) );
2611         results = results || [];
2613         // Try to minimize operations if there is only one selector in the list and no seed
2614         // (the latter of which guarantees us context)
2615         if ( match.length === 1 ) {
2617                 // Reduce context if the leading compound selector is an ID
2618                 tokens = match[0] = match[0].slice( 0 );
2619                 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
2620                                 support.getById && context.nodeType === 9 && documentIsHTML &&
2621                                 Expr.relative[ tokens[1].type ] ) {
2623                         context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
2624                         if ( !context ) {
2625                                 return results;
2627                         // Precompiled matchers will still verify ancestry, so step up a level
2628                         } else if ( compiled ) {
2629                                 context = context.parentNode;
2630                         }
2632                         selector = selector.slice( tokens.shift().value.length );
2633                 }
2635                 // Fetch a seed set for right-to-left matching
2636                 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
2637                 while ( i-- ) {
2638                         token = tokens[i];
2640                         // Abort if we hit a combinator
2641                         if ( Expr.relative[ (type = token.type) ] ) {
2642                                 break;
2643                         }
2644                         if ( (find = Expr.find[ type ]) ) {
2645                                 // Search, expanding context for leading sibling combinators
2646                                 if ( (seed = find(
2647                                         token.matches[0].replace( runescape, funescape ),
2648                                         rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
2649                                 )) ) {
2651                                         // If seed is empty or no tokens remain, we can return early
2652                                         tokens.splice( i, 1 );
2653                                         selector = seed.length && toSelector( tokens );
2654                                         if ( !selector ) {
2655                                                 push.apply( results, seed );
2656                                                 return results;
2657                                         }
2659                                         break;
2660                                 }
2661                         }
2662                 }
2663         }
2665         // Compile and execute a filtering function if one is not provided
2666         // Provide `match` to avoid retokenization if we modified the selector above
2667         ( compiled || compile( selector, match ) )(
2668                 seed,
2669                 context,
2670                 !documentIsHTML,
2671                 results,
2672                 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
2673         );
2674         return results;
2677 // One-time assignments
2679 // Sort stability
2680 support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
2682 // Support: Chrome 14-35+
2683 // Always assume duplicates if they aren't passed to the comparison function
2684 support.detectDuplicates = !!hasDuplicate;
2686 // Initialize against the default document
2687 setDocument();
2689 // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
2690 // Detached nodes confoundingly follow *each other*
2691 support.sortDetached = assert(function( el ) {
2692         // Should return 1, but returns 4 (following)
2693         return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
2696 // Support: IE<8
2697 // Prevent attribute/property "interpolation"
2698 // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
2699 if ( !assert(function( el ) {
2700         el.innerHTML = "<a href='#'></a>";
2701         return el.firstChild.getAttribute("href") === "#" ;
2702 }) ) {
2703         addHandle( "type|href|height|width", function( elem, name, isXML ) {
2704                 if ( !isXML ) {
2705                         return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
2706                 }
2707         });
2710 // Support: IE<9
2711 // Use defaultValue in place of getAttribute("value")
2712 if ( !support.attributes || !assert(function( el ) {
2713         el.innerHTML = "<input/>";
2714         el.firstChild.setAttribute( "value", "" );
2715         return el.firstChild.getAttribute( "value" ) === "";
2716 }) ) {
2717         addHandle( "value", function( elem, name, isXML ) {
2718                 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
2719                         return elem.defaultValue;
2720                 }
2721         });
2724 // Support: IE<9
2725 // Use getAttributeNode to fetch booleans when getAttribute lies
2726 if ( !assert(function( el ) {
2727         return el.getAttribute("disabled") == null;
2728 }) ) {
2729         addHandle( booleans, function( elem, name, isXML ) {
2730                 var val;
2731                 if ( !isXML ) {
2732                         return elem[ name ] === true ? name.toLowerCase() :
2733                                         (val = elem.getAttributeNode( name )) && val.specified ?
2734                                         val.value :
2735                                 null;
2736                 }
2737         });
2740 return Sizzle;
2742 })( window );
2746 jQuery.find = Sizzle;
2747 jQuery.expr = Sizzle.selectors;
2749 // Deprecated
2750 jQuery.expr[ ":" ] = jQuery.expr.pseudos;
2751 jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
2752 jQuery.text = Sizzle.getText;
2753 jQuery.isXMLDoc = Sizzle.isXML;
2754 jQuery.contains = Sizzle.contains;
2755 jQuery.escapeSelector = Sizzle.escape;
2760 var dir = function( elem, dir, until ) {
2761         var matched = [],
2762                 truncate = until !== undefined;
2764         while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
2765                 if ( elem.nodeType === 1 ) {
2766                         if ( truncate && jQuery( elem ).is( until ) ) {
2767                                 break;
2768                         }
2769                         matched.push( elem );
2770                 }
2771         }
2772         return matched;
2776 var siblings = function( n, elem ) {
2777         var matched = [];
2779         for ( ; n; n = n.nextSibling ) {
2780                 if ( n.nodeType === 1 && n !== elem ) {
2781                         matched.push( n );
2782                 }
2783         }
2785         return matched;
2789 var rneedsContext = jQuery.expr.match.needsContext;
2791 var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
2795 var risSimple = /^.[^:#\[\.,]*$/;
2797 // Implement the identical functionality for filter and not
2798 function winnow( elements, qualifier, not ) {
2799         if ( jQuery.isFunction( qualifier ) ) {
2800                 return jQuery.grep( elements, function( elem, i ) {
2801                         return !!qualifier.call( elem, i, elem ) !== not;
2802                 } );
2804         }
2806         if ( qualifier.nodeType ) {
2807                 return jQuery.grep( elements, function( elem ) {
2808                         return ( elem === qualifier ) !== not;
2809                 } );
2811         }
2813         if ( typeof qualifier === "string" ) {
2814                 if ( risSimple.test( qualifier ) ) {
2815                         return jQuery.filter( qualifier, elements, not );
2816                 }
2818                 qualifier = jQuery.filter( qualifier, elements );
2819         }
2821         return jQuery.grep( elements, function( elem ) {
2822                 return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1;
2823         } );
2826 jQuery.filter = function( expr, elems, not ) {
2827         var elem = elems[ 0 ];
2829         if ( not ) {
2830                 expr = ":not(" + expr + ")";
2831         }
2833         return elems.length === 1 && elem.nodeType === 1 ?
2834                 jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
2835                 jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
2836                         return elem.nodeType === 1;
2837                 } ) );
2840 jQuery.fn.extend( {
2841         find: function( selector ) {
2842                 var i, ret,
2843                         len = this.length,
2844                         self = this;
2846                 if ( typeof selector !== "string" ) {
2847                         return this.pushStack( jQuery( selector ).filter( function() {
2848                                 for ( i = 0; i < len; i++ ) {
2849                                         if ( jQuery.contains( self[ i ], this ) ) {
2850                                                 return true;
2851                                         }
2852                                 }
2853                         } ) );
2854                 }
2856                 ret = this.pushStack( [] );
2858                 for ( i = 0; i < len; i++ ) {
2859                         jQuery.find( selector, self[ i ], ret );
2860                 }
2862                 return len > 1 ? jQuery.uniqueSort( ret ) : ret;
2863         },
2864         filter: function( selector ) {
2865                 return this.pushStack( winnow( this, selector || [], false ) );
2866         },
2867         not: function( selector ) {
2868                 return this.pushStack( winnow( this, selector || [], true ) );
2869         },
2870         is: function( selector ) {
2871                 return !!winnow(
2872                         this,
2874                         // If this is a positional/relative selector, check membership in the returned set
2875                         // so $("p:first").is("p:last") won't return true for a doc with two "p".
2876                         typeof selector === "string" && rneedsContext.test( selector ) ?
2877                                 jQuery( selector ) :
2878                                 selector || [],
2879                         false
2880                 ).length;
2881         }
2882 } );
2885 // Initialize a jQuery object
2888 // A central reference to the root jQuery(document)
2889 var rootjQuery,
2891         // A simple way to check for HTML strings
2892         // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
2893         // Strict HTML recognition (#11290: must start with <)
2894         // Shortcut simple #id case for speed
2895         rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
2897         init = jQuery.fn.init = function( selector, context, root ) {
2898                 var match, elem;
2900                 // HANDLE: $(""), $(null), $(undefined), $(false)
2901                 if ( !selector ) {
2902                         return this;
2903                 }
2905                 // Method init() accepts an alternate rootjQuery
2906                 // so migrate can support jQuery.sub (gh-2101)
2907                 root = root || rootjQuery;
2909                 // Handle HTML strings
2910                 if ( typeof selector === "string" ) {
2911                         if ( selector[ 0 ] === "<" &&
2912                                 selector[ selector.length - 1 ] === ">" &&
2913                                 selector.length >= 3 ) {
2915                                 // Assume that strings that start and end with <> are HTML and skip the regex check
2916                                 match = [ null, selector, null ];
2918                         } else {
2919                                 match = rquickExpr.exec( selector );
2920                         }
2922                         // Match html or make sure no context is specified for #id
2923                         if ( match && ( match[ 1 ] || !context ) ) {
2925                                 // HANDLE: $(html) -> $(array)
2926                                 if ( match[ 1 ] ) {
2927                                         context = context instanceof jQuery ? context[ 0 ] : context;
2929                                         // Option to run scripts is true for back-compat
2930                                         // Intentionally let the error be thrown if parseHTML is not present
2931                                         jQuery.merge( this, jQuery.parseHTML(
2932                                                 match[ 1 ],
2933                                                 context && context.nodeType ? context.ownerDocument || context : document,
2934                                                 true
2935                                         ) );
2937                                         // HANDLE: $(html, props)
2938                                         if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
2939                                                 for ( match in context ) {
2941                                                         // Properties of context are called as methods if possible
2942                                                         if ( jQuery.isFunction( this[ match ] ) ) {
2943                                                                 this[ match ]( context[ match ] );
2945                                                         // ...and otherwise set as attributes
2946                                                         } else {
2947                                                                 this.attr( match, context[ match ] );
2948                                                         }
2949                                                 }
2950                                         }
2952                                         return this;
2954                                 // HANDLE: $(#id)
2955                                 } else {
2956                                         elem = document.getElementById( match[ 2 ] );
2958                                         if ( elem ) {
2960                                                 // Inject the element directly into the jQuery object
2961                                                 this[ 0 ] = elem;
2962                                                 this.length = 1;
2963                                         }
2964                                         return this;
2965                                 }
2967                         // HANDLE: $(expr, $(...))
2968                         } else if ( !context || context.jquery ) {
2969                                 return ( context || root ).find( selector );
2971                         // HANDLE: $(expr, context)
2972                         // (which is just equivalent to: $(context).find(expr)
2973                         } else {
2974                                 return this.constructor( context ).find( selector );
2975                         }
2977                 // HANDLE: $(DOMElement)
2978                 } else if ( selector.nodeType ) {
2979                         this[ 0 ] = selector;
2980                         this.length = 1;
2981                         return this;
2983                 // HANDLE: $(function)
2984                 // Shortcut for document ready
2985                 } else if ( jQuery.isFunction( selector ) ) {
2986                         return root.ready !== undefined ?
2987                                 root.ready( selector ) :
2989                                 // Execute immediately if ready is not present
2990                                 selector( jQuery );
2991                 }
2993                 return jQuery.makeArray( selector, this );
2994         };
2996 // Give the init function the jQuery prototype for later instantiation
2997 init.prototype = jQuery.fn;
2999 // Initialize central reference
3000 rootjQuery = jQuery( document );
3003 var rparentsprev = /^(?:parents|prev(?:Until|All))/,
3005         // Methods guaranteed to produce a unique set when starting from a unique set
3006         guaranteedUnique = {
3007                 children: true,
3008                 contents: true,
3009                 next: true,
3010                 prev: true
3011         };
3013 jQuery.fn.extend( {
3014         has: function( target ) {
3015                 var targets = jQuery( target, this ),
3016                         l = targets.length;
3018                 return this.filter( function() {
3019                         var i = 0;
3020                         for ( ; i < l; i++ ) {
3021                                 if ( jQuery.contains( this, targets[ i ] ) ) {
3022                                         return true;
3023                                 }
3024                         }
3025                 } );
3026         },
3028         closest: function( selectors, context ) {
3029                 var cur,
3030                         i = 0,
3031                         l = this.length,
3032                         matched = [],
3033                         targets = typeof selectors !== "string" && jQuery( selectors );
3035                 // Positional selectors never match, since there's no _selection_ context
3036                 if ( !rneedsContext.test( selectors ) ) {
3037                         for ( ; i < l; i++ ) {
3038                                 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
3040                                         // Always skip document fragments
3041                                         if ( cur.nodeType < 11 && ( targets ?
3042                                                 targets.index( cur ) > -1 :
3044                                                 // Don't pass non-elements to Sizzle
3045                                                 cur.nodeType === 1 &&
3046                                                         jQuery.find.matchesSelector( cur, selectors ) ) ) {
3048                                                 matched.push( cur );
3049                                                 break;
3050                                         }
3051                                 }
3052                         }
3053                 }
3055                 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
3056         },
3058         // Determine the position of an element within the set
3059         index: function( elem ) {
3061                 // No argument, return index in parent
3062                 if ( !elem ) {
3063                         return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
3064                 }
3066                 // Index in selector
3067                 if ( typeof elem === "string" ) {
3068                         return indexOf.call( jQuery( elem ), this[ 0 ] );
3069                 }
3071                 // Locate the position of the desired element
3072                 return indexOf.call( this,
3074                         // If it receives a jQuery object, the first element is used
3075                         elem.jquery ? elem[ 0 ] : elem
3076                 );
3077         },
3079         add: function( selector, context ) {
3080                 return this.pushStack(
3081                         jQuery.uniqueSort(
3082                                 jQuery.merge( this.get(), jQuery( selector, context ) )
3083                         )
3084                 );
3085         },
3087         addBack: function( selector ) {
3088                 return this.add( selector == null ?
3089                         this.prevObject : this.prevObject.filter( selector )
3090                 );
3091         }
3092 } );
3094 function sibling( cur, dir ) {
3095         while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
3096         return cur;
3099 jQuery.each( {
3100         parent: function( elem ) {
3101                 var parent = elem.parentNode;
3102                 return parent && parent.nodeType !== 11 ? parent : null;
3103         },
3104         parents: function( elem ) {
3105                 return dir( elem, "parentNode" );
3106         },
3107         parentsUntil: function( elem, i, until ) {
3108                 return dir( elem, "parentNode", until );
3109         },
3110         next: function( elem ) {
3111                 return sibling( elem, "nextSibling" );
3112         },
3113         prev: function( elem ) {
3114                 return sibling( elem, "previousSibling" );
3115         },
3116         nextAll: function( elem ) {
3117                 return dir( elem, "nextSibling" );
3118         },
3119         prevAll: function( elem ) {
3120                 return dir( elem, "previousSibling" );
3121         },
3122         nextUntil: function( elem, i, until ) {
3123                 return dir( elem, "nextSibling", until );
3124         },
3125         prevUntil: function( elem, i, until ) {
3126                 return dir( elem, "previousSibling", until );
3127         },
3128         siblings: function( elem ) {
3129                 return siblings( ( elem.parentNode || {} ).firstChild, elem );
3130         },
3131         children: function( elem ) {
3132                 return siblings( elem.firstChild );
3133         },
3134         contents: function( elem ) {
3135                 return elem.contentDocument || jQuery.merge( [], elem.childNodes );
3136         }
3137 }, function( name, fn ) {
3138         jQuery.fn[ name ] = function( until, selector ) {
3139                 var matched = jQuery.map( this, fn, until );
3141                 if ( name.slice( -5 ) !== "Until" ) {
3142                         selector = until;
3143                 }
3145                 if ( selector && typeof selector === "string" ) {
3146                         matched = jQuery.filter( selector, matched );
3147                 }
3149                 if ( this.length > 1 ) {
3151                         // Remove duplicates
3152                         if ( !guaranteedUnique[ name ] ) {
3153                                 jQuery.uniqueSort( matched );
3154                         }
3156                         // Reverse order for parents* and prev-derivatives
3157                         if ( rparentsprev.test( name ) ) {
3158                                 matched.reverse();
3159                         }
3160                 }
3162                 return this.pushStack( matched );
3163         };
3164 } );
3165 var rnotwhite = ( /\S+/g );
3169 // Convert String-formatted options into Object-formatted ones
3170 function createOptions( options ) {
3171         var object = {};
3172         jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
3173                 object[ flag ] = true;
3174         } );
3175         return object;
3179  * Create a callback list using the following parameters:
3181  *      options: an optional list of space-separated options that will change how
3182  *                      the callback list behaves or a more traditional option object
3184  * By default a callback list will act like an event callback list and can be
3185  * "fired" multiple times.
3187  * Possible options:
3189  *      once:                   will ensure the callback list can only be fired once (like a Deferred)
3191  *      memory:                 will keep track of previous values and will call any callback added
3192  *                                      after the list has been fired right away with the latest "memorized"
3193  *                                      values (like a Deferred)
3195  *      unique:                 will ensure a callback can only be added once (no duplicate in the list)
3197  *      stopOnFalse:    interrupt callings when a callback returns false
3199  */
3200 jQuery.Callbacks = function( options ) {
3202         // Convert options from String-formatted to Object-formatted if needed
3203         // (we check in cache first)
3204         options = typeof options === "string" ?
3205                 createOptions( options ) :
3206                 jQuery.extend( {}, options );
3208         var // Flag to know if list is currently firing
3209                 firing,
3211                 // Last fire value for non-forgettable lists
3212                 memory,
3214                 // Flag to know if list was already fired
3215                 fired,
3217                 // Flag to prevent firing
3218                 locked,
3220                 // Actual callback list
3221                 list = [],
3223                 // Queue of execution data for repeatable lists
3224                 queue = [],
3226                 // Index of currently firing callback (modified by add/remove as needed)
3227                 firingIndex = -1,
3229                 // Fire callbacks
3230                 fire = function() {
3232                         // Enforce single-firing
3233                         locked = options.once;
3235                         // Execute callbacks for all pending executions,
3236                         // respecting firingIndex overrides and runtime changes
3237                         fired = firing = true;
3238                         for ( ; queue.length; firingIndex = -1 ) {
3239                                 memory = queue.shift();
3240                                 while ( ++firingIndex < list.length ) {
3242                                         // Run callback and check for early termination
3243                                         if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
3244                                                 options.stopOnFalse ) {
3246                                                 // Jump to end and forget the data so .add doesn't re-fire
3247                                                 firingIndex = list.length;
3248                                                 memory = false;
3249                                         }
3250                                 }
3251                         }
3253                         // Forget the data if we're done with it
3254                         if ( !options.memory ) {
3255                                 memory = false;
3256                         }
3258                         firing = false;
3260                         // Clean up if we're done firing for good
3261                         if ( locked ) {
3263                                 // Keep an empty list if we have data for future add calls
3264                                 if ( memory ) {
3265                                         list = [];
3267                                 // Otherwise, this object is spent
3268                                 } else {
3269                                         list = "";
3270                                 }
3271                         }
3272                 },
3274                 // Actual Callbacks object
3275                 self = {
3277                         // Add a callback or a collection of callbacks to the list
3278                         add: function() {
3279                                 if ( list ) {
3281                                         // If we have memory from a past run, we should fire after adding
3282                                         if ( memory && !firing ) {
3283                                                 firingIndex = list.length - 1;
3284                                                 queue.push( memory );
3285                                         }
3287                                         ( function add( args ) {
3288                                                 jQuery.each( args, function( _, arg ) {
3289                                                         if ( jQuery.isFunction( arg ) ) {
3290                                                                 if ( !options.unique || !self.has( arg ) ) {
3291                                                                         list.push( arg );
3292                                                                 }
3293                                                         } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) {
3295                                                                 // Inspect recursively
3296                                                                 add( arg );
3297                                                         }
3298                                                 } );
3299                                         } )( arguments );
3301                                         if ( memory && !firing ) {
3302                                                 fire();
3303                                         }
3304                                 }
3305                                 return this;
3306                         },
3308                         // Remove a callback from the list
3309                         remove: function() {
3310                                 jQuery.each( arguments, function( _, arg ) {
3311                                         var index;
3312                                         while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
3313                                                 list.splice( index, 1 );
3315                                                 // Handle firing indexes
3316                                                 if ( index <= firingIndex ) {
3317                                                         firingIndex--;
3318                                                 }
3319                                         }
3320                                 } );
3321                                 return this;
3322                         },
3324                         // Check if a given callback is in the list.
3325                         // If no argument is given, return whether or not list has callbacks attached.
3326                         has: function( fn ) {
3327                                 return fn ?
3328                                         jQuery.inArray( fn, list ) > -1 :
3329                                         list.length > 0;
3330                         },
3332                         // Remove all callbacks from the list
3333                         empty: function() {
3334                                 if ( list ) {
3335                                         list = [];
3336                                 }
3337                                 return this;
3338                         },
3340                         // Disable .fire and .add
3341                         // Abort any current/pending executions
3342                         // Clear all callbacks and values
3343                         disable: function() {
3344                                 locked = queue = [];
3345                                 list = memory = "";
3346                                 return this;
3347                         },
3348                         disabled: function() {
3349                                 return !list;
3350                         },
3352                         // Disable .fire
3353                         // Also disable .add unless we have memory (since it would have no effect)
3354                         // Abort any pending executions
3355                         lock: function() {
3356                                 locked = queue = [];
3357                                 if ( !memory && !firing ) {
3358                                         list = memory = "";
3359                                 }
3360                                 return this;
3361                         },
3362                         locked: function() {
3363                                 return !!locked;
3364                         },
3366                         // Call all callbacks with the given context and arguments
3367                         fireWith: function( context, args ) {
3368                                 if ( !locked ) {
3369                                         args = args || [];
3370                                         args = [ context, args.slice ? args.slice() : args ];
3371                                         queue.push( args );
3372                                         if ( !firing ) {
3373                                                 fire();
3374                                         }
3375                                 }
3376                                 return this;
3377                         },
3379                         // Call all the callbacks with the given arguments
3380                         fire: function() {
3381                                 self.fireWith( this, arguments );
3382                                 return this;
3383                         },
3385                         // To know if the callbacks have already been called at least once
3386                         fired: function() {
3387                                 return !!fired;
3388                         }
3389                 };
3391         return self;
3395 function Identity( v ) {
3396         return v;
3398 function Thrower( ex ) {
3399         throw ex;
3402 function adoptValue( value, resolve, reject ) {
3403         var method;
3405         try {
3407                 // Check for promise aspect first to privilege synchronous behavior
3408                 if ( value && jQuery.isFunction( ( method = value.promise ) ) ) {
3409                         method.call( value ).done( resolve ).fail( reject );
3411                 // Other thenables
3412                 } else if ( value && jQuery.isFunction( ( method = value.then ) ) ) {
3413                         method.call( value, resolve, reject );
3415                 // Other non-thenables
3416                 } else {
3418                         // Support: Android 4.0 only
3419                         // Strict mode functions invoked without .call/.apply get global-object context
3420                         resolve.call( undefined, value );
3421                 }
3423         // For Promises/A+, convert exceptions into rejections
3424         // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
3425         // Deferred#then to conditionally suppress rejection.
3426         } catch ( value ) {
3428                 // Support: Android 4.0 only
3429                 // Strict mode functions invoked without .call/.apply get global-object context
3430                 reject.call( undefined, value );
3431         }
3434 jQuery.extend( {
3436         Deferred: function( func ) {
3437                 var tuples = [
3439                                 // action, add listener, callbacks,
3440                                 // ... .then handlers, argument index, [final state]
3441                                 [ "notify", "progress", jQuery.Callbacks( "memory" ),
3442                                         jQuery.Callbacks( "memory" ), 2 ],
3443                                 [ "resolve", "done", jQuery.Callbacks( "once memory" ),
3444                                         jQuery.Callbacks( "once memory" ), 0, "resolved" ],
3445                                 [ "reject", "fail", jQuery.Callbacks( "once memory" ),
3446                                         jQuery.Callbacks( "once memory" ), 1, "rejected" ]
3447                         ],
3448                         state = "pending",
3449                         promise = {
3450                                 state: function() {
3451                                         return state;
3452                                 },
3453                                 always: function() {
3454                                         deferred.done( arguments ).fail( arguments );
3455                                         return this;
3456                                 },
3457                                 "catch": function( fn ) {
3458                                         return promise.then( null, fn );
3459                                 },
3461                                 // Keep pipe for back-compat
3462                                 pipe: function( /* fnDone, fnFail, fnProgress */ ) {
3463                                         var fns = arguments;
3465                                         return jQuery.Deferred( function( newDefer ) {
3466                                                 jQuery.each( tuples, function( i, tuple ) {
3468                                                         // Map tuples (progress, done, fail) to arguments (done, fail, progress)
3469                                                         var fn = jQuery.isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
3471                                                         // deferred.progress(function() { bind to newDefer or newDefer.notify })
3472                                                         // deferred.done(function() { bind to newDefer or newDefer.resolve })
3473                                                         // deferred.fail(function() { bind to newDefer or newDefer.reject })
3474                                                         deferred[ tuple[ 1 ] ]( function() {
3475                                                                 var returned = fn && fn.apply( this, arguments );
3476                                                                 if ( returned && jQuery.isFunction( returned.promise ) ) {
3477                                                                         returned.promise()
3478                                                                                 .progress( newDefer.notify )
3479                                                                                 .done( newDefer.resolve )
3480                                                                                 .fail( newDefer.reject );
3481                                                                 } else {
3482                                                                         newDefer[ tuple[ 0 ] + "With" ](
3483                                                                                 this,
3484                                                                                 fn ? [ returned ] : arguments
3485                                                                         );
3486                                                                 }
3487                                                         } );
3488                                                 } );
3489                                                 fns = null;
3490                                         } ).promise();
3491                                 },
3492                                 then: function( onFulfilled, onRejected, onProgress ) {
3493                                         var maxDepth = 0;
3494                                         function resolve( depth, deferred, handler, special ) {
3495                                                 return function() {
3496                                                         var that = this,
3497                                                                 args = arguments,
3498                                                                 mightThrow = function() {
3499                                                                         var returned, then;
3501                                                                         // Support: Promises/A+ section 2.3.3.3.3
3502                                                                         // https://promisesaplus.com/#point-59
3503                                                                         // Ignore double-resolution attempts
3504                                                                         if ( depth < maxDepth ) {
3505                                                                                 return;
3506                                                                         }
3508                                                                         returned = handler.apply( that, args );
3510                                                                         // Support: Promises/A+ section 2.3.1
3511                                                                         // https://promisesaplus.com/#point-48
3512                                                                         if ( returned === deferred.promise() ) {
3513                                                                                 throw new TypeError( "Thenable self-resolution" );
3514                                                                         }
3516                                                                         // Support: Promises/A+ sections 2.3.3.1, 3.5
3517                                                                         // https://promisesaplus.com/#point-54
3518                                                                         // https://promisesaplus.com/#point-75
3519                                                                         // Retrieve `then` only once
3520                                                                         then = returned &&
3522                                                                                 // Support: Promises/A+ section 2.3.4
3523                                                                                 // https://promisesaplus.com/#point-64
3524                                                                                 // Only check objects and functions for thenability
3525                                                                                 ( typeof returned === "object" ||
3526                                                                                         typeof returned === "function" ) &&
3527                                                                                 returned.then;
3529                                                                         // Handle a returned thenable
3530                                                                         if ( jQuery.isFunction( then ) ) {
3532                                                                                 // Special processors (notify) just wait for resolution
3533                                                                                 if ( special ) {
3534                                                                                         then.call(
3535                                                                                                 returned,
3536                                                                                                 resolve( maxDepth, deferred, Identity, special ),
3537                                                                                                 resolve( maxDepth, deferred, Thrower, special )
3538                                                                                         );
3540                                                                                 // Normal processors (resolve) also hook into progress
3541                                                                                 } else {
3543                                                                                         // ...and disregard older resolution values
3544                                                                                         maxDepth++;
3546                                                                                         then.call(
3547                                                                                                 returned,
3548                                                                                                 resolve( maxDepth, deferred, Identity, special ),
3549                                                                                                 resolve( maxDepth, deferred, Thrower, special ),
3550                                                                                                 resolve( maxDepth, deferred, Identity,
3551                                                                                                         deferred.notifyWith )
3552                                                                                         );
3553                                                                                 }
3555                                                                         // Handle all other returned values
3556                                                                         } else {
3558                                                                                 // Only substitute handlers pass on context
3559                                                                                 // and multiple values (non-spec behavior)
3560                                                                                 if ( handler !== Identity ) {
3561                                                                                         that = undefined;
3562                                                                                         args = [ returned ];
3563                                                                                 }
3565                                                                                 // Process the value(s)
3566                                                                                 // Default process is resolve
3567                                                                                 ( special || deferred.resolveWith )( that, args );
3568                                                                         }
3569                                                                 },
3571                                                                 // Only normal processors (resolve) catch and reject exceptions
3572                                                                 process = special ?
3573                                                                         mightThrow :
3574                                                                         function() {
3575                                                                                 try {
3576                                                                                         mightThrow();
3577                                                                                 } catch ( e ) {
3579                                                                                         if ( jQuery.Deferred.exceptionHook ) {
3580                                                                                                 jQuery.Deferred.exceptionHook( e,
3581                                                                                                         process.stackTrace );
3582                                                                                         }
3584                                                                                         // Support: Promises/A+ section 2.3.3.3.4.1
3585                                                                                         // https://promisesaplus.com/#point-61
3586                                                                                         // Ignore post-resolution exceptions
3587                                                                                         if ( depth + 1 >= maxDepth ) {
3589                                                                                                 // Only substitute handlers pass on context
3590                                                                                                 // and multiple values (non-spec behavior)
3591                                                                                                 if ( handler !== Thrower ) {
3592                                                                                                         that = undefined;
3593                                                                                                         args = [ e ];
3594                                                                                                 }
3596                                                                                                 deferred.rejectWith( that, args );
3597                                                                                         }
3598                                                                                 }
3599                                                                         };
3601                                                         // Support: Promises/A+ section 2.3.3.3.1
3602                                                         // https://promisesaplus.com/#point-57
3603                                                         // Re-resolve promises immediately to dodge false rejection from
3604                                                         // subsequent errors
3605                                                         if ( depth ) {
3606                                                                 process();
3607                                                         } else {
3609                                                                 // Call an optional hook to record the stack, in case of exception
3610                                                                 // since it's otherwise lost when execution goes async
3611                                                                 if ( jQuery.Deferred.getStackHook ) {
3612                                                                         process.stackTrace = jQuery.Deferred.getStackHook();
3613                                                                 }
3614                                                                 window.setTimeout( process );
3615                                                         }
3616                                                 };
3617                                         }
3619                                         return jQuery.Deferred( function( newDefer ) {
3621                                                 // progress_handlers.add( ... )
3622                                                 tuples[ 0 ][ 3 ].add(
3623                                                         resolve(
3624                                                                 0,
3625                                                                 newDefer,
3626                                                                 jQuery.isFunction( onProgress ) ?
3627                                                                         onProgress :
3628                                                                         Identity,
3629                                                                 newDefer.notifyWith
3630                                                         )
3631                                                 );
3633                                                 // fulfilled_handlers.add( ... )
3634                                                 tuples[ 1 ][ 3 ].add(
3635                                                         resolve(
3636                                                                 0,
3637                                                                 newDefer,
3638                                                                 jQuery.isFunction( onFulfilled ) ?
3639                                                                         onFulfilled :
3640                                                                         Identity
3641                                                         )
3642                                                 );
3644                                                 // rejected_handlers.add( ... )
3645                                                 tuples[ 2 ][ 3 ].add(
3646                                                         resolve(
3647                                                                 0,
3648                                                                 newDefer,
3649                                                                 jQuery.isFunction( onRejected ) ?
3650                                                                         onRejected :
3651                                                                         Thrower
3652                                                         )
3653                                                 );
3654                                         } ).promise();
3655                                 },
3657                                 // Get a promise for this deferred
3658                                 // If obj is provided, the promise aspect is added to the object
3659                                 promise: function( obj ) {
3660                                         return obj != null ? jQuery.extend( obj, promise ) : promise;
3661                                 }
3662                         },
3663                         deferred = {};
3665                 // Add list-specific methods
3666                 jQuery.each( tuples, function( i, tuple ) {
3667                         var list = tuple[ 2 ],
3668                                 stateString = tuple[ 5 ];
3670                         // promise.progress = list.add
3671                         // promise.done = list.add
3672                         // promise.fail = list.add
3673                         promise[ tuple[ 1 ] ] = list.add;
3675                         // Handle state
3676                         if ( stateString ) {
3677                                 list.add(
3678                                         function() {
3680                                                 // state = "resolved" (i.e., fulfilled)
3681                                                 // state = "rejected"
3682                                                 state = stateString;
3683                                         },
3685                                         // rejected_callbacks.disable
3686                                         // fulfilled_callbacks.disable
3687                                         tuples[ 3 - i ][ 2 ].disable,
3689                                         // progress_callbacks.lock
3690                                         tuples[ 0 ][ 2 ].lock
3691                                 );
3692                         }
3694                         // progress_handlers.fire
3695                         // fulfilled_handlers.fire
3696                         // rejected_handlers.fire
3697                         list.add( tuple[ 3 ].fire );
3699                         // deferred.notify = function() { deferred.notifyWith(...) }
3700                         // deferred.resolve = function() { deferred.resolveWith(...) }
3701                         // deferred.reject = function() { deferred.rejectWith(...) }
3702                         deferred[ tuple[ 0 ] ] = function() {
3703                                 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
3704                                 return this;
3705                         };
3707                         // deferred.notifyWith = list.fireWith
3708                         // deferred.resolveWith = list.fireWith
3709                         // deferred.rejectWith = list.fireWith
3710                         deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
3711                 } );
3713                 // Make the deferred a promise
3714                 promise.promise( deferred );
3716                 // Call given func if any
3717                 if ( func ) {
3718                         func.call( deferred, deferred );
3719                 }
3721                 // All done!
3722                 return deferred;
3723         },
3725         // Deferred helper
3726         when: function( singleValue ) {
3727                 var
3729                         // count of uncompleted subordinates
3730                         remaining = arguments.length,
3732                         // count of unprocessed arguments
3733                         i = remaining,
3735                         // subordinate fulfillment data
3736                         resolveContexts = Array( i ),
3737                         resolveValues = slice.call( arguments ),
3739                         // the master Deferred
3740                         master = jQuery.Deferred(),
3742                         // subordinate callback factory
3743                         updateFunc = function( i ) {
3744                                 return function( value ) {
3745                                         resolveContexts[ i ] = this;
3746                                         resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
3747                                         if ( !( --remaining ) ) {
3748                                                 master.resolveWith( resolveContexts, resolveValues );
3749                                         }
3750                                 };
3751                         };
3753                 // Single- and empty arguments are adopted like Promise.resolve
3754                 if ( remaining <= 1 ) {
3755                         adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject );
3757                         // Use .then() to unwrap secondary thenables (cf. gh-3000)
3758                         if ( master.state() === "pending" ||
3759                                 jQuery.isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
3761                                 return master.then();
3762                         }
3763                 }
3765                 // Multiple arguments are aggregated like Promise.all array elements
3766                 while ( i-- ) {
3767                         adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
3768                 }
3770                 return master.promise();
3771         }
3772 } );
3775 // These usually indicate a programmer mistake during development,
3776 // warn about them ASAP rather than swallowing them by default.
3777 var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
3779 jQuery.Deferred.exceptionHook = function( error, stack ) {
3781         // Support: IE 8 - 9 only
3782         // Console exists when dev tools are open, which can happen at any time
3783         if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
3784                 window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
3785         }
3791 jQuery.readyException = function( error ) {
3792         window.setTimeout( function() {
3793                 throw error;
3794         } );
3800 // The deferred used on DOM ready
3801 var readyList = jQuery.Deferred();
3803 jQuery.fn.ready = function( fn ) {
3805         readyList
3806                 .then( fn )
3808                 // Wrap jQuery.readyException in a function so that the lookup
3809                 // happens at the time of error handling instead of callback
3810                 // registration.
3811                 .catch( function( error ) {
3812                         jQuery.readyException( error );
3813                 } );
3815         return this;
3818 jQuery.extend( {
3820         // Is the DOM ready to be used? Set to true once it occurs.
3821         isReady: false,
3823         // A counter to track how many items to wait for before
3824         // the ready event fires. See #6781
3825         readyWait: 1,
3827         // Hold (or release) the ready event
3828         holdReady: function( hold ) {
3829                 if ( hold ) {
3830                         jQuery.readyWait++;
3831                 } else {
3832                         jQuery.ready( true );
3833                 }
3834         },
3836         // Handle when the DOM is ready
3837         ready: function( wait ) {
3839                 // Abort if there are pending holds or we're already ready
3840                 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
3841                         return;
3842                 }
3844                 // Remember that the DOM is ready
3845                 jQuery.isReady = true;
3847                 // If a normal DOM Ready event fired, decrement, and wait if need be
3848                 if ( wait !== true && --jQuery.readyWait > 0 ) {
3849                         return;
3850                 }
3852                 // If there are functions bound, to execute
3853                 readyList.resolveWith( document, [ jQuery ] );
3854         }
3855 } );
3857 jQuery.ready.then = readyList.then;
3859 // The ready event handler and self cleanup method
3860 function completed() {
3861         document.removeEventListener( "DOMContentLoaded", completed );
3862         window.removeEventListener( "load", completed );
3863         jQuery.ready();
3866 // Catch cases where $(document).ready() is called
3867 // after the browser event has already occurred.
3868 // Support: IE <=9 - 10 only
3869 // Older IE sometimes signals "interactive" too soon
3870 if ( document.readyState === "complete" ||
3871         ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
3873         // Handle it asynchronously to allow scripts the opportunity to delay ready
3874         window.setTimeout( jQuery.ready );
3876 } else {
3878         // Use the handy event callback
3879         document.addEventListener( "DOMContentLoaded", completed );
3881         // A fallback to window.onload, that will always work
3882         window.addEventListener( "load", completed );
3888 // Multifunctional method to get and set values of a collection
3889 // The value/s can optionally be executed if it's a function
3890 var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
3891         var i = 0,
3892                 len = elems.length,
3893                 bulk = key == null;
3895         // Sets many values
3896         if ( jQuery.type( key ) === "object" ) {
3897                 chainable = true;
3898                 for ( i in key ) {
3899                         access( elems, fn, i, key[ i ], true, emptyGet, raw );
3900                 }
3902         // Sets one value
3903         } else if ( value !== undefined ) {
3904                 chainable = true;
3906                 if ( !jQuery.isFunction( value ) ) {
3907                         raw = true;
3908                 }
3910                 if ( bulk ) {
3912                         // Bulk operations run against the entire set
3913                         if ( raw ) {
3914                                 fn.call( elems, value );
3915                                 fn = null;
3917                         // ...except when executing function values
3918                         } else {
3919                                 bulk = fn;
3920                                 fn = function( elem, key, value ) {
3921                                         return bulk.call( jQuery( elem ), value );
3922                                 };
3923                         }
3924                 }
3926                 if ( fn ) {
3927                         for ( ; i < len; i++ ) {
3928                                 fn(
3929                                         elems[ i ], key, raw ?
3930                                         value :
3931                                         value.call( elems[ i ], i, fn( elems[ i ], key ) )
3932                                 );
3933                         }
3934                 }
3935         }
3937         return chainable ?
3938                 elems :
3940                 // Gets
3941                 bulk ?
3942                         fn.call( elems ) :
3943                         len ? fn( elems[ 0 ], key ) : emptyGet;
3945 var acceptData = function( owner ) {
3947         // Accepts only:
3948         //  - Node
3949         //    - Node.ELEMENT_NODE
3950         //    - Node.DOCUMENT_NODE
3951         //  - Object
3952         //    - Any
3953         return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
3959 function Data() {
3960         this.expando = jQuery.expando + Data.uid++;
3963 Data.uid = 1;
3965 Data.prototype = {
3967         cache: function( owner ) {
3969                 // Check if the owner object already has a cache
3970                 var value = owner[ this.expando ];
3972                 // If not, create one
3973                 if ( !value ) {
3974                         value = {};
3976                         // We can accept data for non-element nodes in modern browsers,
3977                         // but we should not, see #8335.
3978                         // Always return an empty object.
3979                         if ( acceptData( owner ) ) {
3981                                 // If it is a node unlikely to be stringify-ed or looped over
3982                                 // use plain assignment
3983                                 if ( owner.nodeType ) {
3984                                         owner[ this.expando ] = value;
3986                                 // Otherwise secure it in a non-enumerable property
3987                                 // configurable must be true to allow the property to be
3988                                 // deleted when data is removed
3989                                 } else {
3990                                         Object.defineProperty( owner, this.expando, {
3991                                                 value: value,
3992                                                 configurable: true
3993                                         } );
3994                                 }
3995                         }
3996                 }
3998                 return value;
3999         },
4000         set: function( owner, data, value ) {
4001                 var prop,
4002                         cache = this.cache( owner );
4004                 // Handle: [ owner, key, value ] args
4005                 // Always use camelCase key (gh-2257)
4006                 if ( typeof data === "string" ) {
4007                         cache[ jQuery.camelCase( data ) ] = value;
4009                 // Handle: [ owner, { properties } ] args
4010                 } else {
4012                         // Copy the properties one-by-one to the cache object
4013                         for ( prop in data ) {
4014                                 cache[ jQuery.camelCase( prop ) ] = data[ prop ];
4015                         }
4016                 }
4017                 return cache;
4018         },
4019         get: function( owner, key ) {
4020                 return key === undefined ?
4021                         this.cache( owner ) :
4023                         // Always use camelCase key (gh-2257)
4024                         owner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ];
4025         },
4026         access: function( owner, key, value ) {
4028                 // In cases where either:
4029                 //
4030                 //   1. No key was specified
4031                 //   2. A string key was specified, but no value provided
4032                 //
4033                 // Take the "read" path and allow the get method to determine
4034                 // which value to return, respectively either:
4035                 //
4036                 //   1. The entire cache object
4037                 //   2. The data stored at the key
4038                 //
4039                 if ( key === undefined ||
4040                                 ( ( key && typeof key === "string" ) && value === undefined ) ) {
4042                         return this.get( owner, key );
4043                 }
4045                 // When the key is not a string, or both a key and value
4046                 // are specified, set or extend (existing objects) with either:
4047                 //
4048                 //   1. An object of properties
4049                 //   2. A key and value
4050                 //
4051                 this.set( owner, key, value );
4053                 // Since the "set" path can have two possible entry points
4054                 // return the expected data based on which path was taken[*]
4055                 return value !== undefined ? value : key;
4056         },
4057         remove: function( owner, key ) {
4058                 var i,
4059                         cache = owner[ this.expando ];
4061                 if ( cache === undefined ) {
4062                         return;
4063                 }
4065                 if ( key !== undefined ) {
4067                         // Support array or space separated string of keys
4068                         if ( jQuery.isArray( key ) ) {
4070                                 // If key is an array of keys...
4071                                 // We always set camelCase keys, so remove that.
4072                                 key = key.map( jQuery.camelCase );
4073                         } else {
4074                                 key = jQuery.camelCase( key );
4076                                 // If a key with the spaces exists, use it.
4077                                 // Otherwise, create an array by matching non-whitespace
4078                                 key = key in cache ?
4079                                         [ key ] :
4080                                         ( key.match( rnotwhite ) || [] );
4081                         }
4083                         i = key.length;
4085                         while ( i-- ) {
4086                                 delete cache[ key[ i ] ];
4087                         }
4088                 }
4090                 // Remove the expando if there's no more data
4091                 if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
4093                         // Support: Chrome <=35 - 45
4094                         // Webkit & Blink performance suffers when deleting properties
4095                         // from DOM nodes, so set to undefined instead
4096                         // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
4097                         if ( owner.nodeType ) {
4098                                 owner[ this.expando ] = undefined;
4099                         } else {
4100                                 delete owner[ this.expando ];
4101                         }
4102                 }
4103         },
4104         hasData: function( owner ) {
4105                 var cache = owner[ this.expando ];
4106                 return cache !== undefined && !jQuery.isEmptyObject( cache );
4107         }
4109 var dataPriv = new Data();
4111 var dataUser = new Data();
4115 //      Implementation Summary
4117 //      1. Enforce API surface and semantic compatibility with 1.9.x branch
4118 //      2. Improve the module's maintainability by reducing the storage
4119 //              paths to a single mechanism.
4120 //      3. Use the same single mechanism to support "private" and "user" data.
4121 //      4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
4122 //      5. Avoid exposing implementation details on user objects (eg. expando properties)
4123 //      6. Provide a clear path for implementation upgrade to WeakMap in 2014
4125 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
4126         rmultiDash = /[A-Z]/g;
4128 function dataAttr( elem, key, data ) {
4129         var name;
4131         // If nothing was found internally, try to fetch any
4132         // data from the HTML5 data-* attribute
4133         if ( data === undefined && elem.nodeType === 1 ) {
4134                 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
4135                 data = elem.getAttribute( name );
4137                 if ( typeof data === "string" ) {
4138                         try {
4139                                 data = data === "true" ? true :
4140                                         data === "false" ? false :
4141                                         data === "null" ? null :
4143                                         // Only convert to a number if it doesn't change the string
4144                                         +data + "" === data ? +data :
4145                                         rbrace.test( data ) ? JSON.parse( data ) :
4146                                         data;
4147                         } catch ( e ) {}
4149                         // Make sure we set the data so it isn't changed later
4150                         dataUser.set( elem, key, data );
4151                 } else {
4152                         data = undefined;
4153                 }
4154         }
4155         return data;
4158 jQuery.extend( {
4159         hasData: function( elem ) {
4160                 return dataUser.hasData( elem ) || dataPriv.hasData( elem );
4161         },
4163         data: function( elem, name, data ) {
4164                 return dataUser.access( elem, name, data );
4165         },
4167         removeData: function( elem, name ) {
4168                 dataUser.remove( elem, name );
4169         },
4171         // TODO: Now that all calls to _data and _removeData have been replaced
4172         // with direct calls to dataPriv methods, these can be deprecated.
4173         _data: function( elem, name, data ) {
4174                 return dataPriv.access( elem, name, data );
4175         },
4177         _removeData: function( elem, name ) {
4178                 dataPriv.remove( elem, name );
4179         }
4180 } );
4182 jQuery.fn.extend( {
4183         data: function( key, value ) {
4184                 var i, name, data,
4185                         elem = this[ 0 ],
4186                         attrs = elem && elem.attributes;
4188                 // Gets all values
4189                 if ( key === undefined ) {
4190                         if ( this.length ) {
4191                                 data = dataUser.get( elem );
4193                                 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
4194                                         i = attrs.length;
4195                                         while ( i-- ) {
4197                                                 // Support: IE 11 only
4198                                                 // The attrs elements can be null (#14894)
4199                                                 if ( attrs[ i ] ) {
4200                                                         name = attrs[ i ].name;
4201                                                         if ( name.indexOf( "data-" ) === 0 ) {
4202                                                                 name = jQuery.camelCase( name.slice( 5 ) );
4203                                                                 dataAttr( elem, name, data[ name ] );
4204                                                         }
4205                                                 }
4206                                         }
4207                                         dataPriv.set( elem, "hasDataAttrs", true );
4208                                 }
4209                         }
4211                         return data;
4212                 }
4214                 // Sets multiple values
4215                 if ( typeof key === "object" ) {
4216                         return this.each( function() {
4217                                 dataUser.set( this, key );
4218                         } );
4219                 }
4221                 return access( this, function( value ) {
4222                         var data;
4224                         // The calling jQuery object (element matches) is not empty
4225                         // (and therefore has an element appears at this[ 0 ]) and the
4226                         // `value` parameter was not undefined. An empty jQuery object
4227                         // will result in `undefined` for elem = this[ 0 ] which will
4228                         // throw an exception if an attempt to read a data cache is made.
4229                         if ( elem && value === undefined ) {
4231                                 // Attempt to get data from the cache
4232                                 // The key will always be camelCased in Data
4233                                 data = dataUser.get( elem, key );
4234                                 if ( data !== undefined ) {
4235                                         return data;
4236                                 }
4238                                 // Attempt to "discover" the data in
4239                                 // HTML5 custom data-* attrs
4240                                 data = dataAttr( elem, key );
4241                                 if ( data !== undefined ) {
4242                                         return data;
4243                                 }
4245                                 // We tried really hard, but the data doesn't exist.
4246                                 return;
4247                         }
4249                         // Set the data...
4250                         this.each( function() {
4252                                 // We always store the camelCased key
4253                                 dataUser.set( this, key, value );
4254                         } );
4255                 }, null, value, arguments.length > 1, null, true );
4256         },
4258         removeData: function( key ) {
4259                 return this.each( function() {
4260                         dataUser.remove( this, key );
4261                 } );
4262         }
4263 } );
4266 jQuery.extend( {
4267         queue: function( elem, type, data ) {
4268                 var queue;
4270                 if ( elem ) {
4271                         type = ( type || "fx" ) + "queue";
4272                         queue = dataPriv.get( elem, type );
4274                         // Speed up dequeue by getting out quickly if this is just a lookup
4275                         if ( data ) {
4276                                 if ( !queue || jQuery.isArray( data ) ) {
4277                                         queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
4278                                 } else {
4279                                         queue.push( data );
4280                                 }
4281                         }
4282                         return queue || [];
4283                 }
4284         },
4286         dequeue: function( elem, type ) {
4287                 type = type || "fx";
4289                 var queue = jQuery.queue( elem, type ),
4290                         startLength = queue.length,
4291                         fn = queue.shift(),
4292                         hooks = jQuery._queueHooks( elem, type ),
4293                         next = function() {
4294                                 jQuery.dequeue( elem, type );
4295                         };
4297                 // If the fx queue is dequeued, always remove the progress sentinel
4298                 if ( fn === "inprogress" ) {
4299                         fn = queue.shift();
4300                         startLength--;
4301                 }
4303                 if ( fn ) {
4305                         // Add a progress sentinel to prevent the fx queue from being
4306                         // automatically dequeued
4307                         if ( type === "fx" ) {
4308                                 queue.unshift( "inprogress" );
4309                         }
4311                         // Clear up the last queue stop function
4312                         delete hooks.stop;
4313                         fn.call( elem, next, hooks );
4314                 }
4316                 if ( !startLength && hooks ) {
4317                         hooks.empty.fire();
4318                 }
4319         },
4321         // Not public - generate a queueHooks object, or return the current one
4322         _queueHooks: function( elem, type ) {
4323                 var key = type + "queueHooks";
4324                 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
4325                         empty: jQuery.Callbacks( "once memory" ).add( function() {
4326                                 dataPriv.remove( elem, [ type + "queue", key ] );
4327                         } )
4328                 } );
4329         }
4330 } );
4332 jQuery.fn.extend( {
4333         queue: function( type, data ) {
4334                 var setter = 2;
4336                 if ( typeof type !== "string" ) {
4337                         data = type;
4338                         type = "fx";
4339                         setter--;
4340                 }
4342                 if ( arguments.length < setter ) {
4343                         return jQuery.queue( this[ 0 ], type );
4344                 }
4346                 return data === undefined ?
4347                         this :
4348                         this.each( function() {
4349                                 var queue = jQuery.queue( this, type, data );
4351                                 // Ensure a hooks for this queue
4352                                 jQuery._queueHooks( this, type );
4354                                 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
4355                                         jQuery.dequeue( this, type );
4356                                 }
4357                         } );
4358         },
4359         dequeue: function( type ) {
4360                 return this.each( function() {
4361                         jQuery.dequeue( this, type );
4362                 } );
4363         },
4364         clearQueue: function( type ) {
4365                 return this.queue( type || "fx", [] );
4366         },
4368         // Get a promise resolved when queues of a certain type
4369         // are emptied (fx is the type by default)
4370         promise: function( type, obj ) {
4371                 var tmp,
4372                         count = 1,
4373                         defer = jQuery.Deferred(),
4374                         elements = this,
4375                         i = this.length,
4376                         resolve = function() {
4377                                 if ( !( --count ) ) {
4378                                         defer.resolveWith( elements, [ elements ] );
4379                                 }
4380                         };
4382                 if ( typeof type !== "string" ) {
4383                         obj = type;
4384                         type = undefined;
4385                 }
4386                 type = type || "fx";
4388                 while ( i-- ) {
4389                         tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
4390                         if ( tmp && tmp.empty ) {
4391                                 count++;
4392                                 tmp.empty.add( resolve );
4393                         }
4394                 }
4395                 resolve();
4396                 return defer.promise( obj );
4397         }
4398 } );
4399 var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
4401 var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
4404 var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
4406 var isHiddenWithinTree = function( elem, el ) {
4408                 // isHiddenWithinTree might be called from jQuery#filter function;
4409                 // in that case, element will be second argument
4410                 elem = el || elem;
4412                 // Inline style trumps all
4413                 return elem.style.display === "none" ||
4414                         elem.style.display === "" &&
4416                         // Otherwise, check computed style
4417                         // Support: Firefox <=43 - 45
4418                         // Disconnected elements can have computed display: none, so first confirm that elem is
4419                         // in the document.
4420                         jQuery.contains( elem.ownerDocument, elem ) &&
4422                         jQuery.css( elem, "display" ) === "none";
4423         };
4425 var swap = function( elem, options, callback, args ) {
4426         var ret, name,
4427                 old = {};
4429         // Remember the old values, and insert the new ones
4430         for ( name in options ) {
4431                 old[ name ] = elem.style[ name ];
4432                 elem.style[ name ] = options[ name ];
4433         }
4435         ret = callback.apply( elem, args || [] );
4437         // Revert the old values
4438         for ( name in options ) {
4439                 elem.style[ name ] = old[ name ];
4440         }
4442         return ret;
4448 function adjustCSS( elem, prop, valueParts, tween ) {
4449         var adjusted,
4450                 scale = 1,
4451                 maxIterations = 20,
4452                 currentValue = tween ?
4453                         function() {
4454                                 return tween.cur();
4455                         } :
4456                         function() {
4457                                 return jQuery.css( elem, prop, "" );
4458                         },
4459                 initial = currentValue(),
4460                 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
4462                 // Starting value computation is required for potential unit mismatches
4463                 initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
4464                         rcssNum.exec( jQuery.css( elem, prop ) );
4466         if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
4468                 // Trust units reported by jQuery.css
4469                 unit = unit || initialInUnit[ 3 ];
4471                 // Make sure we update the tween properties later on
4472                 valueParts = valueParts || [];
4474                 // Iteratively approximate from a nonzero starting point
4475                 initialInUnit = +initial || 1;
4477                 do {
4479                         // If previous iteration zeroed out, double until we get *something*.
4480                         // Use string for doubling so we don't accidentally see scale as unchanged below
4481                         scale = scale || ".5";
4483                         // Adjust and apply
4484                         initialInUnit = initialInUnit / scale;
4485                         jQuery.style( elem, prop, initialInUnit + unit );
4487                 // Update scale, tolerating zero or NaN from tween.cur()
4488                 // Break the loop if scale is unchanged or perfect, or if we've just had enough.
4489                 } while (
4490                         scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
4491                 );
4492         }
4494         if ( valueParts ) {
4495                 initialInUnit = +initialInUnit || +initial || 0;
4497                 // Apply relative offset (+=/-=) if specified
4498                 adjusted = valueParts[ 1 ] ?
4499                         initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
4500                         +valueParts[ 2 ];
4501                 if ( tween ) {
4502                         tween.unit = unit;
4503                         tween.start = initialInUnit;
4504                         tween.end = adjusted;
4505                 }
4506         }
4507         return adjusted;
4511 var defaultDisplayMap = {};
4513 function getDefaultDisplay( elem ) {
4514         var temp,
4515                 doc = elem.ownerDocument,
4516                 nodeName = elem.nodeName,
4517                 display = defaultDisplayMap[ nodeName ];
4519         if ( display ) {
4520                 return display;
4521         }
4523         temp = doc.body.appendChild( doc.createElement( nodeName ) ),
4524         display = jQuery.css( temp, "display" );
4526         temp.parentNode.removeChild( temp );
4528         if ( display === "none" ) {
4529                 display = "block";
4530         }
4531         defaultDisplayMap[ nodeName ] = display;
4533         return display;
4536 function showHide( elements, show ) {
4537         var display, elem,
4538                 values = [],
4539                 index = 0,
4540                 length = elements.length;
4542         // Determine new display value for elements that need to change
4543         for ( ; index < length; index++ ) {
4544                 elem = elements[ index ];
4545                 if ( !elem.style ) {
4546                         continue;
4547                 }
4549                 display = elem.style.display;
4550                 if ( show ) {
4552                         // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
4553                         // check is required in this first loop unless we have a nonempty display value (either
4554                         // inline or about-to-be-restored)
4555                         if ( display === "none" ) {
4556                                 values[ index ] = dataPriv.get( elem, "display" ) || null;
4557                                 if ( !values[ index ] ) {
4558                                         elem.style.display = "";
4559                                 }
4560                         }
4561                         if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
4562                                 values[ index ] = getDefaultDisplay( elem );
4563                         }
4564                 } else {
4565                         if ( display !== "none" ) {
4566                                 values[ index ] = "none";
4568                                 // Remember what we're overwriting
4569                                 dataPriv.set( elem, "display", display );
4570                         }
4571                 }
4572         }
4574         // Set the display of the elements in a second loop to avoid constant reflow
4575         for ( index = 0; index < length; index++ ) {
4576                 if ( values[ index ] != null ) {
4577                         elements[ index ].style.display = values[ index ];
4578                 }
4579         }
4581         return elements;
4584 jQuery.fn.extend( {
4585         show: function() {
4586                 return showHide( this, true );
4587         },
4588         hide: function() {
4589                 return showHide( this );
4590         },
4591         toggle: function( state ) {
4592                 if ( typeof state === "boolean" ) {
4593                         return state ? this.show() : this.hide();
4594                 }
4596                 return this.each( function() {
4597                         if ( isHiddenWithinTree( this ) ) {
4598                                 jQuery( this ).show();
4599                         } else {
4600                                 jQuery( this ).hide();
4601                         }
4602                 } );
4603         }
4604 } );
4605 var rcheckableType = ( /^(?:checkbox|radio)$/i );
4607 var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
4609 var rscriptType = ( /^$|\/(?:java|ecma)script/i );
4613 // We have to close these tags to support XHTML (#13200)
4614 var wrapMap = {
4616         // Support: IE <=9 only
4617         option: [ 1, "<select multiple='multiple'>", "</select>" ],
4619         // XHTML parsers do not magically insert elements in the
4620         // same way that tag soup parsers do. So we cannot shorten
4621         // this by omitting <tbody> or other required elements.
4622         thead: [ 1, "<table>", "</table>" ],
4623         col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
4624         tr: [ 2, "<table><tbody>", "</tbody></table>" ],
4625         td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
4627         _default: [ 0, "", "" ]
4630 // Support: IE <=9 only
4631 wrapMap.optgroup = wrapMap.option;
4633 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
4634 wrapMap.th = wrapMap.td;
4637 function getAll( context, tag ) {
4639         // Support: IE <=9 - 11 only
4640         // Use typeof to avoid zero-argument method invocation on host objects (#15151)
4641         var ret = typeof context.getElementsByTagName !== "undefined" ?
4642                         context.getElementsByTagName( tag || "*" ) :
4643                         typeof context.querySelectorAll !== "undefined" ?
4644                                 context.querySelectorAll( tag || "*" ) :
4645                         [];
4647         return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
4648                 jQuery.merge( [ context ], ret ) :
4649                 ret;
4653 // Mark scripts as having already been evaluated
4654 function setGlobalEval( elems, refElements ) {
4655         var i = 0,
4656                 l = elems.length;
4658         for ( ; i < l; i++ ) {
4659                 dataPriv.set(
4660                         elems[ i ],
4661                         "globalEval",
4662                         !refElements || dataPriv.get( refElements[ i ], "globalEval" )
4663                 );
4664         }
4668 var rhtml = /<|&#?\w+;/;
4670 function buildFragment( elems, context, scripts, selection, ignored ) {
4671         var elem, tmp, tag, wrap, contains, j,
4672                 fragment = context.createDocumentFragment(),
4673                 nodes = [],
4674                 i = 0,
4675                 l = elems.length;
4677         for ( ; i < l; i++ ) {
4678                 elem = elems[ i ];
4680                 if ( elem || elem === 0 ) {
4682                         // Add nodes directly
4683                         if ( jQuery.type( elem ) === "object" ) {
4685                                 // Support: Android <=4.0 only, PhantomJS 1 only
4686                                 // push.apply(_, arraylike) throws on ancient WebKit
4687                                 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
4689                         // Convert non-html into a text node
4690                         } else if ( !rhtml.test( elem ) ) {
4691                                 nodes.push( context.createTextNode( elem ) );
4693                         // Convert html into DOM nodes
4694                         } else {
4695                                 tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
4697                                 // Deserialize a standard representation
4698                                 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
4699                                 wrap = wrapMap[ tag ] || wrapMap._default;
4700                                 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
4702                                 // Descend through wrappers to the right content
4703                                 j = wrap[ 0 ];
4704                                 while ( j-- ) {
4705                                         tmp = tmp.lastChild;
4706                                 }
4708                                 // Support: Android <=4.0 only, PhantomJS 1 only
4709                                 // push.apply(_, arraylike) throws on ancient WebKit
4710                                 jQuery.merge( nodes, tmp.childNodes );
4712                                 // Remember the top-level container
4713                                 tmp = fragment.firstChild;
4715                                 // Ensure the created nodes are orphaned (#12392)
4716                                 tmp.textContent = "";
4717                         }
4718                 }
4719         }
4721         // Remove wrapper from fragment
4722         fragment.textContent = "";
4724         i = 0;
4725         while ( ( elem = nodes[ i++ ] ) ) {
4727                 // Skip elements already in the context collection (trac-4087)
4728                 if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
4729                         if ( ignored ) {
4730                                 ignored.push( elem );
4731                         }
4732                         continue;
4733                 }
4735                 contains = jQuery.contains( elem.ownerDocument, elem );
4737                 // Append to fragment
4738                 tmp = getAll( fragment.appendChild( elem ), "script" );
4740                 // Preserve script evaluation history
4741                 if ( contains ) {
4742                         setGlobalEval( tmp );
4743                 }
4745                 // Capture executables
4746                 if ( scripts ) {
4747                         j = 0;
4748                         while ( ( elem = tmp[ j++ ] ) ) {
4749                                 if ( rscriptType.test( elem.type || "" ) ) {
4750                                         scripts.push( elem );
4751                                 }
4752                         }
4753                 }
4754         }
4756         return fragment;
4760 ( function() {
4761         var fragment = document.createDocumentFragment(),
4762                 div = fragment.appendChild( document.createElement( "div" ) ),
4763                 input = document.createElement( "input" );
4765         // Support: Android 4.0 - 4.3 only
4766         // Check state lost if the name is set (#11217)
4767         // Support: Windows Web Apps (WWA)
4768         // `name` and `type` must use .setAttribute for WWA (#14901)
4769         input.setAttribute( "type", "radio" );
4770         input.setAttribute( "checked", "checked" );
4771         input.setAttribute( "name", "t" );
4773         div.appendChild( input );
4775         // Support: Android <=4.1 only
4776         // Older WebKit doesn't clone checked state correctly in fragments
4777         support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
4779         // Support: IE <=11 only
4780         // Make sure textarea (and checkbox) defaultValue is properly cloned
4781         div.innerHTML = "<textarea>x</textarea>";
4782         support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
4783 } )();
4784 var documentElement = document.documentElement;
4789         rkeyEvent = /^key/,
4790         rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
4791         rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
4793 function returnTrue() {
4794         return true;
4797 function returnFalse() {
4798         return false;
4801 // Support: IE <=9 only
4802 // See #13393 for more info
4803 function safeActiveElement() {
4804         try {
4805                 return document.activeElement;
4806         } catch ( err ) { }
4809 function on( elem, types, selector, data, fn, one ) {
4810         var origFn, type;
4812         // Types can be a map of types/handlers
4813         if ( typeof types === "object" ) {
4815                 // ( types-Object, selector, data )
4816                 if ( typeof selector !== "string" ) {
4818                         // ( types-Object, data )
4819                         data = data || selector;
4820                         selector = undefined;
4821                 }
4822                 for ( type in types ) {
4823                         on( elem, type, selector, data, types[ type ], one );
4824                 }
4825                 return elem;
4826         }
4828         if ( data == null && fn == null ) {
4830                 // ( types, fn )
4831                 fn = selector;
4832                 data = selector = undefined;
4833         } else if ( fn == null ) {
4834                 if ( typeof selector === "string" ) {
4836                         // ( types, selector, fn )
4837                         fn = data;
4838                         data = undefined;
4839                 } else {
4841                         // ( types, data, fn )
4842                         fn = data;
4843                         data = selector;
4844                         selector = undefined;
4845                 }
4846         }
4847         if ( fn === false ) {
4848                 fn = returnFalse;
4849         } else if ( !fn ) {
4850                 return elem;
4851         }
4853         if ( one === 1 ) {
4854                 origFn = fn;
4855                 fn = function( event ) {
4857                         // Can use an empty set, since event contains the info
4858                         jQuery().off( event );
4859                         return origFn.apply( this, arguments );
4860                 };
4862                 // Use same guid so caller can remove using origFn
4863                 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
4864         }
4865         return elem.each( function() {
4866                 jQuery.event.add( this, types, fn, data, selector );
4867         } );
4871  * Helper functions for managing events -- not part of the public interface.
4872  * Props to Dean Edwards' addEvent library for many of the ideas.
4873  */
4874 jQuery.event = {
4876         global: {},
4878         add: function( elem, types, handler, data, selector ) {
4880                 var handleObjIn, eventHandle, tmp,
4881                         events, t, handleObj,
4882                         special, handlers, type, namespaces, origType,
4883                         elemData = dataPriv.get( elem );
4885                 // Don't attach events to noData or text/comment nodes (but allow plain objects)
4886                 if ( !elemData ) {
4887                         return;
4888                 }
4890                 // Caller can pass in an object of custom data in lieu of the handler
4891                 if ( handler.handler ) {
4892                         handleObjIn = handler;
4893                         handler = handleObjIn.handler;
4894                         selector = handleObjIn.selector;
4895                 }
4897                 // Ensure that invalid selectors throw exceptions at attach time
4898                 // Evaluate against documentElement in case elem is a non-element node (e.g., document)
4899                 if ( selector ) {
4900                         jQuery.find.matchesSelector( documentElement, selector );
4901                 }
4903                 // Make sure that the handler has a unique ID, used to find/remove it later
4904                 if ( !handler.guid ) {
4905                         handler.guid = jQuery.guid++;
4906                 }
4908                 // Init the element's event structure and main handler, if this is the first
4909                 if ( !( events = elemData.events ) ) {
4910                         events = elemData.events = {};
4911                 }
4912                 if ( !( eventHandle = elemData.handle ) ) {
4913                         eventHandle = elemData.handle = function( e ) {
4915                                 // Discard the second event of a jQuery.event.trigger() and
4916                                 // when an event is called after a page has unloaded
4917                                 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
4918                                         jQuery.event.dispatch.apply( elem, arguments ) : undefined;
4919                         };
4920                 }
4922                 // Handle multiple events separated by a space
4923                 types = ( types || "" ).match( rnotwhite ) || [ "" ];
4924                 t = types.length;
4925                 while ( t-- ) {
4926                         tmp = rtypenamespace.exec( types[ t ] ) || [];
4927                         type = origType = tmp[ 1 ];
4928                         namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
4930                         // There *must* be a type, no attaching namespace-only handlers
4931                         if ( !type ) {
4932                                 continue;
4933                         }
4935                         // If event changes its type, use the special event handlers for the changed type
4936                         special = jQuery.event.special[ type ] || {};
4938                         // If selector defined, determine special event api type, otherwise given type
4939                         type = ( selector ? special.delegateType : special.bindType ) || type;
4941                         // Update special based on newly reset type
4942                         special = jQuery.event.special[ type ] || {};
4944                         // handleObj is passed to all event handlers
4945                         handleObj = jQuery.extend( {
4946                                 type: type,
4947                                 origType: origType,
4948                                 data: data,
4949                                 handler: handler,
4950                                 guid: handler.guid,
4951                                 selector: selector,
4952                                 needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
4953                                 namespace: namespaces.join( "." )
4954                         }, handleObjIn );
4956                         // Init the event handler queue if we're the first
4957                         if ( !( handlers = events[ type ] ) ) {
4958                                 handlers = events[ type ] = [];
4959                                 handlers.delegateCount = 0;
4961                                 // Only use addEventListener if the special events handler returns false
4962                                 if ( !special.setup ||
4963                                         special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
4965                                         if ( elem.addEventListener ) {
4966                                                 elem.addEventListener( type, eventHandle );
4967                                         }
4968                                 }
4969                         }
4971                         if ( special.add ) {
4972                                 special.add.call( elem, handleObj );
4974                                 if ( !handleObj.handler.guid ) {
4975                                         handleObj.handler.guid = handler.guid;
4976                                 }
4977                         }
4979                         // Add to the element's handler list, delegates in front
4980                         if ( selector ) {
4981                                 handlers.splice( handlers.delegateCount++, 0, handleObj );
4982                         } else {
4983                                 handlers.push( handleObj );
4984                         }
4986                         // Keep track of which events have ever been used, for event optimization
4987                         jQuery.event.global[ type ] = true;
4988                 }
4990         },
4992         // Detach an event or set of events from an element
4993         remove: function( elem, types, handler, selector, mappedTypes ) {
4995                 var j, origCount, tmp,
4996                         events, t, handleObj,
4997                         special, handlers, type, namespaces, origType,
4998                         elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
5000                 if ( !elemData || !( events = elemData.events ) ) {
5001                         return;
5002                 }
5004                 // Once for each type.namespace in types; type may be omitted
5005                 types = ( types || "" ).match( rnotwhite ) || [ "" ];
5006                 t = types.length;
5007                 while ( t-- ) {
5008                         tmp = rtypenamespace.exec( types[ t ] ) || [];
5009                         type = origType = tmp[ 1 ];
5010                         namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
5012                         // Unbind all events (on this namespace, if provided) for the element
5013                         if ( !type ) {
5014                                 for ( type in events ) {
5015                                         jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
5016                                 }
5017                                 continue;
5018                         }
5020                         special = jQuery.event.special[ type ] || {};
5021                         type = ( selector ? special.delegateType : special.bindType ) || type;
5022                         handlers = events[ type ] || [];
5023                         tmp = tmp[ 2 ] &&
5024                                 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
5026                         // Remove matching events
5027                         origCount = j = handlers.length;
5028                         while ( j-- ) {
5029                                 handleObj = handlers[ j ];
5031                                 if ( ( mappedTypes || origType === handleObj.origType ) &&
5032                                         ( !handler || handler.guid === handleObj.guid ) &&
5033                                         ( !tmp || tmp.test( handleObj.namespace ) ) &&
5034                                         ( !selector || selector === handleObj.selector ||
5035                                                 selector === "**" && handleObj.selector ) ) {
5036                                         handlers.splice( j, 1 );
5038                                         if ( handleObj.selector ) {
5039                                                 handlers.delegateCount--;
5040                                         }
5041                                         if ( special.remove ) {
5042                                                 special.remove.call( elem, handleObj );
5043                                         }
5044                                 }
5045                         }
5047                         // Remove generic event handler if we removed something and no more handlers exist
5048                         // (avoids potential for endless recursion during removal of special event handlers)
5049                         if ( origCount && !handlers.length ) {
5050                                 if ( !special.teardown ||
5051                                         special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
5053                                         jQuery.removeEvent( elem, type, elemData.handle );
5054                                 }
5056                                 delete events[ type ];
5057                         }
5058                 }
5060                 // Remove data and the expando if it's no longer used
5061                 if ( jQuery.isEmptyObject( events ) ) {
5062                         dataPriv.remove( elem, "handle events" );
5063                 }
5064         },
5066         dispatch: function( nativeEvent ) {
5068                 // Make a writable jQuery.Event from the native event object
5069                 var event = jQuery.event.fix( nativeEvent );
5071                 var i, j, ret, matched, handleObj, handlerQueue,
5072                         args = new Array( arguments.length ),
5073                         handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
5074                         special = jQuery.event.special[ event.type ] || {};
5076                 // Use the fix-ed jQuery.Event rather than the (read-only) native event
5077                 args[ 0 ] = event;
5079                 for ( i = 1; i < arguments.length; i++ ) {
5080                         args[ i ] = arguments[ i ];
5081                 }
5083                 event.delegateTarget = this;
5085                 // Call the preDispatch hook for the mapped type, and let it bail if desired
5086                 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
5087                         return;
5088                 }
5090                 // Determine handlers
5091                 handlerQueue = jQuery.event.handlers.call( this, event, handlers );
5093                 // Run delegates first; they may want to stop propagation beneath us
5094                 i = 0;
5095                 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
5096                         event.currentTarget = matched.elem;
5098                         j = 0;
5099                         while ( ( handleObj = matched.handlers[ j++ ] ) &&
5100                                 !event.isImmediatePropagationStopped() ) {
5102                                 // Triggered event must either 1) have no namespace, or 2) have namespace(s)
5103                                 // a subset or equal to those in the bound event (both can have no namespace).
5104                                 if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
5106                                         event.handleObj = handleObj;
5107                                         event.data = handleObj.data;
5109                                         ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
5110                                                 handleObj.handler ).apply( matched.elem, args );
5112                                         if ( ret !== undefined ) {
5113                                                 if ( ( event.result = ret ) === false ) {
5114                                                         event.preventDefault();
5115                                                         event.stopPropagation();
5116                                                 }
5117                                         }
5118                                 }
5119                         }
5120                 }
5122                 // Call the postDispatch hook for the mapped type
5123                 if ( special.postDispatch ) {
5124                         special.postDispatch.call( this, event );
5125                 }
5127                 return event.result;
5128         },
5130         handlers: function( event, handlers ) {
5131                 var i, matches, sel, handleObj,
5132                         handlerQueue = [],
5133                         delegateCount = handlers.delegateCount,
5134                         cur = event.target;
5136                 // Support: IE <=9
5137                 // Find delegate handlers
5138                 // Black-hole SVG <use> instance trees (#13180)
5139                 //
5140                 // Support: Firefox <=42
5141                 // Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343)
5142                 if ( delegateCount && cur.nodeType &&
5143                         ( event.type !== "click" || isNaN( event.button ) || event.button < 1 ) ) {
5145                         for ( ; cur !== this; cur = cur.parentNode || this ) {
5147                                 // Don't check non-elements (#13208)
5148                                 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
5149                                 if ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== "click" ) ) {
5150                                         matches = [];
5151                                         for ( i = 0; i < delegateCount; i++ ) {
5152                                                 handleObj = handlers[ i ];
5154                                                 // Don't conflict with Object.prototype properties (#13203)
5155                                                 sel = handleObj.selector + " ";
5157                                                 if ( matches[ sel ] === undefined ) {
5158                                                         matches[ sel ] = handleObj.needsContext ?
5159                                                                 jQuery( sel, this ).index( cur ) > -1 :
5160                                                                 jQuery.find( sel, this, null, [ cur ] ).length;
5161                                                 }
5162                                                 if ( matches[ sel ] ) {
5163                                                         matches.push( handleObj );
5164                                                 }
5165                                         }
5166                                         if ( matches.length ) {
5167                                                 handlerQueue.push( { elem: cur, handlers: matches } );
5168                                         }
5169                                 }
5170                         }
5171                 }
5173                 // Add the remaining (directly-bound) handlers
5174                 if ( delegateCount < handlers.length ) {
5175                         handlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } );
5176                 }
5178                 return handlerQueue;
5179         },
5181         addProp: function( name, hook ) {
5182                 Object.defineProperty( jQuery.Event.prototype, name, {
5183                         enumerable: true,
5184                         configurable: true,
5186                         get: jQuery.isFunction( hook ) ?
5187                                 function() {
5188                                         if ( this.originalEvent ) {
5189                                                         return hook( this.originalEvent );
5190                                         }
5191                                 } :
5192                                 function() {
5193                                         if ( this.originalEvent ) {
5194                                                         return this.originalEvent[ name ];
5195                                         }
5196                                 },
5198                         set: function( value ) {
5199                                 Object.defineProperty( this, name, {
5200                                         enumerable: true,
5201                                         configurable: true,
5202                                         writable: true,
5203                                         value: value
5204                                 } );
5205                         }
5206                 } );
5207         },
5209         fix: function( originalEvent ) {
5210                 return originalEvent[ jQuery.expando ] ?
5211                         originalEvent :
5212                         new jQuery.Event( originalEvent );
5213         },
5215         special: {
5216                 load: {
5218                         // Prevent triggered image.load events from bubbling to window.load
5219                         noBubble: true
5220                 },
5221                 focus: {
5223                         // Fire native event if possible so blur/focus sequence is correct
5224                         trigger: function() {
5225                                 if ( this !== safeActiveElement() && this.focus ) {
5226                                         this.focus();
5227                                         return false;
5228                                 }
5229                         },
5230                         delegateType: "focusin"
5231                 },
5232                 blur: {
5233                         trigger: function() {
5234                                 if ( this === safeActiveElement() && this.blur ) {
5235                                         this.blur();
5236                                         return false;
5237                                 }
5238                         },
5239                         delegateType: "focusout"
5240                 },
5241                 click: {
5243                         // For checkbox, fire native event so checked state will be right
5244                         trigger: function() {
5245                                 if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
5246                                         this.click();
5247                                         return false;
5248                                 }
5249                         },
5251                         // For cross-browser consistency, don't fire native .click() on links
5252                         _default: function( event ) {
5253                                 return jQuery.nodeName( event.target, "a" );
5254                         }
5255                 },
5257                 beforeunload: {
5258                         postDispatch: function( event ) {
5260                                 // Support: Firefox 20+
5261                                 // Firefox doesn't alert if the returnValue field is not set.
5262                                 if ( event.result !== undefined && event.originalEvent ) {
5263                                         event.originalEvent.returnValue = event.result;
5264                                 }
5265                         }
5266                 }
5267         }
5270 jQuery.removeEvent = function( elem, type, handle ) {
5272         // This "if" is needed for plain objects
5273         if ( elem.removeEventListener ) {
5274                 elem.removeEventListener( type, handle );
5275         }
5278 jQuery.Event = function( src, props ) {
5280         // Allow instantiation without the 'new' keyword
5281         if ( !( this instanceof jQuery.Event ) ) {
5282                 return new jQuery.Event( src, props );
5283         }
5285         // Event object
5286         if ( src && src.type ) {
5287                 this.originalEvent = src;
5288                 this.type = src.type;
5290                 // Events bubbling up the document may have been marked as prevented
5291                 // by a handler lower down the tree; reflect the correct value.
5292                 this.isDefaultPrevented = src.defaultPrevented ||
5293                                 src.defaultPrevented === undefined &&
5295                                 // Support: Android <=2.3 only
5296                                 src.returnValue === false ?
5297                         returnTrue :
5298                         returnFalse;
5300                 // Create target properties
5301                 // Support: Safari <=6 - 7 only
5302                 // Target should not be a text node (#504, #13143)
5303                 this.target = ( src.target && src.target.nodeType === 3 ) ?
5304                         src.target.parentNode :
5305                         src.target;
5307                 this.currentTarget = src.currentTarget;
5308                 this.relatedTarget = src.relatedTarget;
5310         // Event type
5311         } else {
5312                 this.type = src;
5313         }
5315         // Put explicitly provided properties onto the event object
5316         if ( props ) {
5317                 jQuery.extend( this, props );
5318         }
5320         // Create a timestamp if incoming event doesn't have one
5321         this.timeStamp = src && src.timeStamp || jQuery.now();
5323         // Mark it as fixed
5324         this[ jQuery.expando ] = true;
5327 // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
5328 // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
5329 jQuery.Event.prototype = {
5330         constructor: jQuery.Event,
5331         isDefaultPrevented: returnFalse,
5332         isPropagationStopped: returnFalse,
5333         isImmediatePropagationStopped: returnFalse,
5334         isSimulated: false,
5336         preventDefault: function() {
5337                 var e = this.originalEvent;
5339                 this.isDefaultPrevented = returnTrue;
5341                 if ( e && !this.isSimulated ) {
5342                         e.preventDefault();
5343                 }
5344         },
5345         stopPropagation: function() {
5346                 var e = this.originalEvent;
5348                 this.isPropagationStopped = returnTrue;
5350                 if ( e && !this.isSimulated ) {
5351                         e.stopPropagation();
5352                 }
5353         },
5354         stopImmediatePropagation: function() {
5355                 var e = this.originalEvent;
5357                 this.isImmediatePropagationStopped = returnTrue;
5359                 if ( e && !this.isSimulated ) {
5360                         e.stopImmediatePropagation();
5361                 }
5363                 this.stopPropagation();
5364         }
5367 // Includes all common event props including KeyEvent and MouseEvent specific props
5368 jQuery.each( {
5369         altKey: true,
5370         bubbles: true,
5371         cancelable: true,
5372         changedTouches: true,
5373         ctrlKey: true,
5374         detail: true,
5375         eventPhase: true,
5376         metaKey: true,
5377         pageX: true,
5378         pageY: true,
5379         shiftKey: true,
5380         view: true,
5381         "char": true,
5382         charCode: true,
5383         key: true,
5384         keyCode: true,
5385         button: true,
5386         buttons: true,
5387         clientX: true,
5388         clientY: true,
5389         offsetX: true,
5390         offsetY: true,
5391         pointerId: true,
5392         pointerType: true,
5393         screenX: true,
5394         screenY: true,
5395         targetTouches: true,
5396         toElement: true,
5397         touches: true,
5399         which: function( event ) {
5400                 var button = event.button;
5402                 // Add which for key events
5403                 if ( event.which == null && rkeyEvent.test( event.type ) ) {
5404                         return event.charCode != null ? event.charCode : event.keyCode;
5405                 }
5407                 // Add which for click: 1 === left; 2 === middle; 3 === right
5408                 if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
5409                         return ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
5410                 }
5412                 return event.which;
5413         }
5414 }, jQuery.event.addProp );
5416 // Create mouseenter/leave events using mouseover/out and event-time checks
5417 // so that event delegation works in jQuery.
5418 // Do the same for pointerenter/pointerleave and pointerover/pointerout
5420 // Support: Safari 7 only
5421 // Safari sends mouseenter too often; see:
5422 // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
5423 // for the description of the bug (it existed in older Chrome versions as well).
5424 jQuery.each( {
5425         mouseenter: "mouseover",
5426         mouseleave: "mouseout",
5427         pointerenter: "pointerover",
5428         pointerleave: "pointerout"
5429 }, function( orig, fix ) {
5430         jQuery.event.special[ orig ] = {
5431                 delegateType: fix,
5432                 bindType: fix,
5434                 handle: function( event ) {
5435                         var ret,
5436                                 target = this,
5437                                 related = event.relatedTarget,
5438                                 handleObj = event.handleObj;
5440                         // For mouseenter/leave call the handler if related is outside the target.
5441                         // NB: No relatedTarget if the mouse left/entered the browser window
5442                         if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
5443                                 event.type = handleObj.origType;
5444                                 ret = handleObj.handler.apply( this, arguments );
5445                                 event.type = fix;
5446                         }
5447                         return ret;
5448                 }
5449         };
5450 } );
5452 jQuery.fn.extend( {
5454         on: function( types, selector, data, fn ) {
5455                 return on( this, types, selector, data, fn );
5456         },
5457         one: function( types, selector, data, fn ) {
5458                 return on( this, types, selector, data, fn, 1 );
5459         },
5460         off: function( types, selector, fn ) {
5461                 var handleObj, type;
5462                 if ( types && types.preventDefault && types.handleObj ) {
5464                         // ( event )  dispatched jQuery.Event
5465                         handleObj = types.handleObj;
5466                         jQuery( types.delegateTarget ).off(
5467                                 handleObj.namespace ?
5468                                         handleObj.origType + "." + handleObj.namespace :
5469                                         handleObj.origType,
5470                                 handleObj.selector,
5471                                 handleObj.handler
5472                         );
5473                         return this;
5474                 }
5475                 if ( typeof types === "object" ) {
5477                         // ( types-object [, selector] )
5478                         for ( type in types ) {
5479                                 this.off( type, selector, types[ type ] );
5480                         }
5481                         return this;
5482                 }
5483                 if ( selector === false || typeof selector === "function" ) {
5485                         // ( types [, fn] )
5486                         fn = selector;
5487                         selector = undefined;
5488                 }
5489                 if ( fn === false ) {
5490                         fn = returnFalse;
5491                 }
5492                 return this.each( function() {
5493                         jQuery.event.remove( this, types, fn, selector );
5494                 } );
5495         }
5496 } );
5501         /* eslint-disable max-len */
5503         // See https://github.com/eslint/eslint/issues/3229
5504         rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
5506         /* eslint-enable */
5508         // Support: IE <=10 - 11, Edge 12 - 13
5509         // In IE/Edge using regex groups here causes severe slowdowns.
5510         // See https://connect.microsoft.com/IE/feedback/details/1736512/
5511         rnoInnerhtml = /<script|<style|<link/i,
5513         // checked="checked" or checked
5514         rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
5515         rscriptTypeMasked = /^true\/(.*)/,
5516         rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
5518 function manipulationTarget( elem, content ) {
5519         if ( jQuery.nodeName( elem, "table" ) &&
5520                 jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
5522                 return elem.getElementsByTagName( "tbody" )[ 0 ] || elem;
5523         }
5525         return elem;
5528 // Replace/restore the type attribute of script elements for safe DOM manipulation
5529 function disableScript( elem ) {
5530         elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
5531         return elem;
5533 function restoreScript( elem ) {
5534         var match = rscriptTypeMasked.exec( elem.type );
5536         if ( match ) {
5537                 elem.type = match[ 1 ];
5538         } else {
5539                 elem.removeAttribute( "type" );
5540         }
5542         return elem;
5545 function cloneCopyEvent( src, dest ) {
5546         var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
5548         if ( dest.nodeType !== 1 ) {
5549                 return;
5550         }
5552         // 1. Copy private data: events, handlers, etc.
5553         if ( dataPriv.hasData( src ) ) {
5554                 pdataOld = dataPriv.access( src );
5555                 pdataCur = dataPriv.set( dest, pdataOld );
5556                 events = pdataOld.events;
5558                 if ( events ) {
5559                         delete pdataCur.handle;
5560                         pdataCur.events = {};
5562                         for ( type in events ) {
5563                                 for ( i = 0, l = events[ type ].length; i < l; i++ ) {
5564                                         jQuery.event.add( dest, type, events[ type ][ i ] );
5565                                 }
5566                         }
5567                 }
5568         }
5570         // 2. Copy user data
5571         if ( dataUser.hasData( src ) ) {
5572                 udataOld = dataUser.access( src );
5573                 udataCur = jQuery.extend( {}, udataOld );
5575                 dataUser.set( dest, udataCur );
5576         }
5579 // Fix IE bugs, see support tests
5580 function fixInput( src, dest ) {
5581         var nodeName = dest.nodeName.toLowerCase();
5583         // Fails to persist the checked state of a cloned checkbox or radio button.
5584         if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
5585                 dest.checked = src.checked;
5587         // Fails to return the selected option to the default selected state when cloning options
5588         } else if ( nodeName === "input" || nodeName === "textarea" ) {
5589                 dest.defaultValue = src.defaultValue;
5590         }
5593 function domManip( collection, args, callback, ignored ) {
5595         // Flatten any nested arrays
5596         args = concat.apply( [], args );
5598         var fragment, first, scripts, hasScripts, node, doc,
5599                 i = 0,
5600                 l = collection.length,
5601                 iNoClone = l - 1,
5602                 value = args[ 0 ],
5603                 isFunction = jQuery.isFunction( value );
5605         // We can't cloneNode fragments that contain checked, in WebKit
5606         if ( isFunction ||
5607                         ( l > 1 && typeof value === "string" &&
5608                                 !support.checkClone && rchecked.test( value ) ) ) {
5609                 return collection.each( function( index ) {
5610                         var self = collection.eq( index );
5611                         if ( isFunction ) {
5612                                 args[ 0 ] = value.call( this, index, self.html() );
5613                         }
5614                         domManip( self, args, callback, ignored );
5615                 } );
5616         }
5618         if ( l ) {
5619                 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
5620                 first = fragment.firstChild;
5622                 if ( fragment.childNodes.length === 1 ) {
5623                         fragment = first;
5624                 }
5626                 // Require either new content or an interest in ignored elements to invoke the callback
5627                 if ( first || ignored ) {
5628                         scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
5629                         hasScripts = scripts.length;
5631                         // Use the original fragment for the last item
5632                         // instead of the first because it can end up
5633                         // being emptied incorrectly in certain situations (#8070).
5634                         for ( ; i < l; i++ ) {
5635                                 node = fragment;
5637                                 if ( i !== iNoClone ) {
5638                                         node = jQuery.clone( node, true, true );
5640                                         // Keep references to cloned scripts for later restoration
5641                                         if ( hasScripts ) {
5643                                                 // Support: Android <=4.0 only, PhantomJS 1 only
5644                                                 // push.apply(_, arraylike) throws on ancient WebKit
5645                                                 jQuery.merge( scripts, getAll( node, "script" ) );
5646                                         }
5647                                 }
5649                                 callback.call( collection[ i ], node, i );
5650                         }
5652                         if ( hasScripts ) {
5653                                 doc = scripts[ scripts.length - 1 ].ownerDocument;
5655                                 // Reenable scripts
5656                                 jQuery.map( scripts, restoreScript );
5658                                 // Evaluate executable scripts on first document insertion
5659                                 for ( i = 0; i < hasScripts; i++ ) {
5660                                         node = scripts[ i ];
5661                                         if ( rscriptType.test( node.type || "" ) &&
5662                                                 !dataPriv.access( node, "globalEval" ) &&
5663                                                 jQuery.contains( doc, node ) ) {
5665                                                 if ( node.src ) {
5667                                                         // Optional AJAX dependency, but won't run scripts if not present
5668                                                         if ( jQuery._evalUrl ) {
5669                                                                 jQuery._evalUrl( node.src );
5670                                                         }
5671                                                 } else {
5672                                                         DOMEval( node.textContent.replace( rcleanScript, "" ), doc );
5673                                                 }
5674                                         }
5675                                 }
5676                         }
5677                 }
5678         }
5680         return collection;
5683 function remove( elem, selector, keepData ) {
5684         var node,
5685                 nodes = selector ? jQuery.filter( selector, elem ) : elem,
5686                 i = 0;
5688         for ( ; ( node = nodes[ i ] ) != null; i++ ) {
5689                 if ( !keepData && node.nodeType === 1 ) {
5690                         jQuery.cleanData( getAll( node ) );
5691                 }
5693                 if ( node.parentNode ) {
5694                         if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
5695                                 setGlobalEval( getAll( node, "script" ) );
5696                         }
5697                         node.parentNode.removeChild( node );
5698                 }
5699         }
5701         return elem;
5704 jQuery.extend( {
5705         htmlPrefilter: function( html ) {
5706                 return html.replace( rxhtmlTag, "<$1></$2>" );
5707         },
5709         clone: function( elem, dataAndEvents, deepDataAndEvents ) {
5710                 var i, l, srcElements, destElements,
5711                         clone = elem.cloneNode( true ),
5712                         inPage = jQuery.contains( elem.ownerDocument, elem );
5714                 // Fix IE cloning issues
5715                 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
5716                                 !jQuery.isXMLDoc( elem ) ) {
5718                         // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
5719                         destElements = getAll( clone );
5720                         srcElements = getAll( elem );
5722                         for ( i = 0, l = srcElements.length; i < l; i++ ) {
5723                                 fixInput( srcElements[ i ], destElements[ i ] );
5724                         }
5725                 }
5727                 // Copy the events from the original to the clone
5728                 if ( dataAndEvents ) {
5729                         if ( deepDataAndEvents ) {
5730                                 srcElements = srcElements || getAll( elem );
5731                                 destElements = destElements || getAll( clone );
5733                                 for ( i = 0, l = srcElements.length; i < l; i++ ) {
5734                                         cloneCopyEvent( srcElements[ i ], destElements[ i ] );
5735                                 }
5736                         } else {
5737                                 cloneCopyEvent( elem, clone );
5738                         }
5739                 }
5741                 // Preserve script evaluation history
5742                 destElements = getAll( clone, "script" );
5743                 if ( destElements.length > 0 ) {
5744                         setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
5745                 }
5747                 // Return the cloned set
5748                 return clone;
5749         },
5751         cleanData: function( elems ) {
5752                 var data, elem, type,
5753                         special = jQuery.event.special,
5754                         i = 0;
5756                 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
5757                         if ( acceptData( elem ) ) {
5758                                 if ( ( data = elem[ dataPriv.expando ] ) ) {
5759                                         if ( data.events ) {
5760                                                 for ( type in data.events ) {
5761                                                         if ( special[ type ] ) {
5762                                                                 jQuery.event.remove( elem, type );
5764                                                         // This is a shortcut to avoid jQuery.event.remove's overhead
5765                                                         } else {
5766                                                                 jQuery.removeEvent( elem, type, data.handle );
5767                                                         }
5768                                                 }
5769                                         }
5771                                         // Support: Chrome <=35 - 45+
5772                                         // Assign undefined instead of using delete, see Data#remove
5773                                         elem[ dataPriv.expando ] = undefined;
5774                                 }
5775                                 if ( elem[ dataUser.expando ] ) {
5777                                         // Support: Chrome <=35 - 45+
5778                                         // Assign undefined instead of using delete, see Data#remove
5779                                         elem[ dataUser.expando ] = undefined;
5780                                 }
5781                         }
5782                 }
5783         }
5784 } );
5786 jQuery.fn.extend( {
5787         detach: function( selector ) {
5788                 return remove( this, selector, true );
5789         },
5791         remove: function( selector ) {
5792                 return remove( this, selector );
5793         },
5795         text: function( value ) {
5796                 return access( this, function( value ) {
5797                         return value === undefined ?
5798                                 jQuery.text( this ) :
5799                                 this.empty().each( function() {
5800                                         if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5801                                                 this.textContent = value;
5802                                         }
5803                                 } );
5804                 }, null, value, arguments.length );
5805         },
5807         append: function() {
5808                 return domManip( this, arguments, function( elem ) {
5809                         if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5810                                 var target = manipulationTarget( this, elem );
5811                                 target.appendChild( elem );
5812                         }
5813                 } );
5814         },
5816         prepend: function() {
5817                 return domManip( this, arguments, function( elem ) {
5818                         if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5819                                 var target = manipulationTarget( this, elem );
5820                                 target.insertBefore( elem, target.firstChild );
5821                         }
5822                 } );
5823         },
5825         before: function() {
5826                 return domManip( this, arguments, function( elem ) {
5827                         if ( this.parentNode ) {
5828                                 this.parentNode.insertBefore( elem, this );
5829                         }
5830                 } );
5831         },
5833         after: function() {
5834                 return domManip( this, arguments, function( elem ) {
5835                         if ( this.parentNode ) {
5836                                 this.parentNode.insertBefore( elem, this.nextSibling );
5837                         }
5838                 } );
5839         },
5841         empty: function() {
5842                 var elem,
5843                         i = 0;
5845                 for ( ; ( elem = this[ i ] ) != null; i++ ) {
5846                         if ( elem.nodeType === 1 ) {
5848                                 // Prevent memory leaks
5849                                 jQuery.cleanData( getAll( elem, false ) );
5851                                 // Remove any remaining nodes
5852                                 elem.textContent = "";
5853                         }
5854                 }
5856                 return this;
5857         },
5859         clone: function( dataAndEvents, deepDataAndEvents ) {
5860                 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
5861                 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
5863                 return this.map( function() {
5864                         return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
5865                 } );
5866         },
5868         html: function( value ) {
5869                 return access( this, function( value ) {
5870                         var elem = this[ 0 ] || {},
5871                                 i = 0,
5872                                 l = this.length;
5874                         if ( value === undefined && elem.nodeType === 1 ) {
5875                                 return elem.innerHTML;
5876                         }
5878                         // See if we can take a shortcut and just use innerHTML
5879                         if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
5880                                 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
5882                                 value = jQuery.htmlPrefilter( value );
5884                                 try {
5885                                         for ( ; i < l; i++ ) {
5886                                                 elem = this[ i ] || {};
5888                                                 // Remove element nodes and prevent memory leaks
5889                                                 if ( elem.nodeType === 1 ) {
5890                                                         jQuery.cleanData( getAll( elem, false ) );
5891                                                         elem.innerHTML = value;
5892                                                 }
5893                                         }
5895                                         elem = 0;
5897                                 // If using innerHTML throws an exception, use the fallback method
5898                                 } catch ( e ) {}
5899                         }
5901                         if ( elem ) {
5902                                 this.empty().append( value );
5903                         }
5904                 }, null, value, arguments.length );
5905         },
5907         replaceWith: function() {
5908                 var ignored = [];
5910                 // Make the changes, replacing each non-ignored context element with the new content
5911                 return domManip( this, arguments, function( elem ) {
5912                         var parent = this.parentNode;
5914                         if ( jQuery.inArray( this, ignored ) < 0 ) {
5915                                 jQuery.cleanData( getAll( this ) );
5916                                 if ( parent ) {
5917                                         parent.replaceChild( elem, this );
5918                                 }
5919                         }
5921                 // Force callback invocation
5922                 }, ignored );
5923         }
5924 } );
5926 jQuery.each( {
5927         appendTo: "append",
5928         prependTo: "prepend",
5929         insertBefore: "before",
5930         insertAfter: "after",
5931         replaceAll: "replaceWith"
5932 }, function( name, original ) {
5933         jQuery.fn[ name ] = function( selector ) {
5934                 var elems,
5935                         ret = [],
5936                         insert = jQuery( selector ),
5937                         last = insert.length - 1,
5938                         i = 0;
5940                 for ( ; i <= last; i++ ) {
5941                         elems = i === last ? this : this.clone( true );
5942                         jQuery( insert[ i ] )[ original ]( elems );
5944                         // Support: Android <=4.0 only, PhantomJS 1 only
5945                         // .get() because push.apply(_, arraylike) throws on ancient WebKit
5946                         push.apply( ret, elems.get() );
5947                 }
5949                 return this.pushStack( ret );
5950         };
5951 } );
5952 var rmargin = ( /^margin/ );
5954 var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
5956 var getStyles = function( elem ) {
5958                 // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
5959                 // IE throws on elements created in popups
5960                 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
5961                 var view = elem.ownerDocument.defaultView;
5963                 if ( !view || !view.opener ) {
5964                         view = window;
5965                 }
5967                 return view.getComputedStyle( elem );
5968         };
5972 ( function() {
5974         // Executing both pixelPosition & boxSizingReliable tests require only one layout
5975         // so they're executed at the same time to save the second computation.
5976         function computeStyleTests() {
5978                 // This is a singleton, we need to execute it only once
5979                 if ( !div ) {
5980                         return;
5981                 }
5983                 div.style.cssText =
5984                         "box-sizing:border-box;" +
5985                         "position:relative;display:block;" +
5986                         "margin:auto;border:1px;padding:1px;" +
5987                         "top:1%;width:50%";
5988                 div.innerHTML = "";
5989                 documentElement.appendChild( container );
5991                 var divStyle = window.getComputedStyle( div );
5992                 pixelPositionVal = divStyle.top !== "1%";
5994                 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
5995                 reliableMarginLeftVal = divStyle.marginLeft === "2px";
5996                 boxSizingReliableVal = divStyle.width === "4px";
5998                 // Support: Android 4.0 - 4.3 only
5999                 // Some styles come back with percentage values, even though they shouldn't
6000                 div.style.marginRight = "50%";
6001                 pixelMarginRightVal = divStyle.marginRight === "4px";
6003                 documentElement.removeChild( container );
6005                 // Nullify the div so it wouldn't be stored in the memory and
6006                 // it will also be a sign that checks already performed
6007                 div = null;
6008         }
6010         var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal,
6011                 container = document.createElement( "div" ),
6012                 div = document.createElement( "div" );
6014         // Finish early in limited (non-browser) environments
6015         if ( !div.style ) {
6016                 return;
6017         }
6019         // Support: IE <=9 - 11 only
6020         // Style of cloned element affects source element cloned (#8908)
6021         div.style.backgroundClip = "content-box";
6022         div.cloneNode( true ).style.backgroundClip = "";
6023         support.clearCloneStyle = div.style.backgroundClip === "content-box";
6025         container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
6026                 "padding:0;margin-top:1px;position:absolute";
6027         container.appendChild( div );
6029         jQuery.extend( support, {
6030                 pixelPosition: function() {
6031                         computeStyleTests();
6032                         return pixelPositionVal;
6033                 },
6034                 boxSizingReliable: function() {
6035                         computeStyleTests();
6036                         return boxSizingReliableVal;
6037                 },
6038                 pixelMarginRight: function() {
6039                         computeStyleTests();
6040                         return pixelMarginRightVal;
6041                 },
6042                 reliableMarginLeft: function() {
6043                         computeStyleTests();
6044                         return reliableMarginLeftVal;
6045                 }
6046         } );
6047 } )();
6050 function curCSS( elem, name, computed ) {
6051         var width, minWidth, maxWidth, ret,
6052                 style = elem.style;
6054         computed = computed || getStyles( elem );
6056         // Support: IE <=9 only
6057         // getPropertyValue is only needed for .css('filter') (#12537)
6058         if ( computed ) {
6059                 ret = computed.getPropertyValue( name ) || computed[ name ];
6061                 if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
6062                         ret = jQuery.style( elem, name );
6063                 }
6065                 // A tribute to the "awesome hack by Dean Edwards"
6066                 // Android Browser returns percentage for some values,
6067                 // but width seems to be reliably pixels.
6068                 // This is against the CSSOM draft spec:
6069                 // https://drafts.csswg.org/cssom/#resolved-values
6070                 if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
6072                         // Remember the original values
6073                         width = style.width;
6074                         minWidth = style.minWidth;
6075                         maxWidth = style.maxWidth;
6077                         // Put in the new values to get a computed value out
6078                         style.minWidth = style.maxWidth = style.width = ret;
6079                         ret = computed.width;
6081                         // Revert the changed values
6082                         style.width = width;
6083                         style.minWidth = minWidth;
6084                         style.maxWidth = maxWidth;
6085                 }
6086         }
6088         return ret !== undefined ?
6090                 // Support: IE <=9 - 11 only
6091                 // IE returns zIndex value as an integer.
6092                 ret + "" :
6093                 ret;
6097 function addGetHookIf( conditionFn, hookFn ) {
6099         // Define the hook, we'll check on the first run if it's really needed.
6100         return {
6101                 get: function() {
6102                         if ( conditionFn() ) {
6104                                 // Hook not needed (or it's not possible to use it due
6105                                 // to missing dependency), remove it.
6106                                 delete this.get;
6107                                 return;
6108                         }
6110                         // Hook needed; redefine it so that the support test is not executed again.
6111                         return ( this.get = hookFn ).apply( this, arguments );
6112                 }
6113         };
6119         // Swappable if display is none or starts with table
6120         // except "table", "table-cell", or "table-caption"
6121         // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
6122         rdisplayswap = /^(none|table(?!-c[ea]).+)/,
6123         cssShow = { position: "absolute", visibility: "hidden", display: "block" },
6124         cssNormalTransform = {
6125                 letterSpacing: "0",
6126                 fontWeight: "400"
6127         },
6129         cssPrefixes = [ "Webkit", "Moz", "ms" ],
6130         emptyStyle = document.createElement( "div" ).style;
6132 // Return a css property mapped to a potentially vendor prefixed property
6133 function vendorPropName( name ) {
6135         // Shortcut for names that are not vendor prefixed
6136         if ( name in emptyStyle ) {
6137                 return name;
6138         }
6140         // Check for vendor prefixed names
6141         var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
6142                 i = cssPrefixes.length;
6144         while ( i-- ) {
6145                 name = cssPrefixes[ i ] + capName;
6146                 if ( name in emptyStyle ) {
6147                         return name;
6148                 }
6149         }
6152 function setPositiveNumber( elem, value, subtract ) {
6154         // Any relative (+/-) values have already been
6155         // normalized at this point
6156         var matches = rcssNum.exec( value );
6157         return matches ?
6159                 // Guard against undefined "subtract", e.g., when used as in cssHooks
6160                 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
6161                 value;
6164 function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
6165         var i = extra === ( isBorderBox ? "border" : "content" ) ?
6167                 // If we already have the right measurement, avoid augmentation
6168                 4 :
6170                 // Otherwise initialize for horizontal or vertical properties
6171                 name === "width" ? 1 : 0,
6173                 val = 0;
6175         for ( ; i < 4; i += 2 ) {
6177                 // Both box models exclude margin, so add it if we want it
6178                 if ( extra === "margin" ) {
6179                         val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
6180                 }
6182                 if ( isBorderBox ) {
6184                         // border-box includes padding, so remove it if we want content
6185                         if ( extra === "content" ) {
6186                                 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6187                         }
6189                         // At this point, extra isn't border nor margin, so remove border
6190                         if ( extra !== "margin" ) {
6191                                 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6192                         }
6193                 } else {
6195                         // At this point, extra isn't content, so add padding
6196                         val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6198                         // At this point, extra isn't content nor padding, so add border
6199                         if ( extra !== "padding" ) {
6200                                 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6201                         }
6202                 }
6203         }
6205         return val;
6208 function getWidthOrHeight( elem, name, extra ) {
6210         // Start with offset property, which is equivalent to the border-box value
6211         var val,
6212                 valueIsBorderBox = true,
6213                 styles = getStyles( elem ),
6214                 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
6216         // Support: IE <=11 only
6217         // Running getBoundingClientRect on a disconnected node
6218         // in IE throws an error.
6219         if ( elem.getClientRects().length ) {
6220                 val = elem.getBoundingClientRect()[ name ];
6221         }
6223         // Some non-html elements return undefined for offsetWidth, so check for null/undefined
6224         // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
6225         // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
6226         if ( val <= 0 || val == null ) {
6228                 // Fall back to computed then uncomputed css if necessary
6229                 val = curCSS( elem, name, styles );
6230                 if ( val < 0 || val == null ) {
6231                         val = elem.style[ name ];
6232                 }
6234                 // Computed unit is not pixels. Stop here and return.
6235                 if ( rnumnonpx.test( val ) ) {
6236                         return val;
6237                 }
6239                 // Check for style in case a browser which returns unreliable values
6240                 // for getComputedStyle silently falls back to the reliable elem.style
6241                 valueIsBorderBox = isBorderBox &&
6242                         ( support.boxSizingReliable() || val === elem.style[ name ] );
6244                 // Normalize "", auto, and prepare for extra
6245                 val = parseFloat( val ) || 0;
6246         }
6248         // Use the active box-sizing model to add/subtract irrelevant styles
6249         return ( val +
6250                 augmentWidthOrHeight(
6251                         elem,
6252                         name,
6253                         extra || ( isBorderBox ? "border" : "content" ),
6254                         valueIsBorderBox,
6255                         styles
6256                 )
6257         ) + "px";
6260 jQuery.extend( {
6262         // Add in style property hooks for overriding the default
6263         // behavior of getting and setting a style property
6264         cssHooks: {
6265                 opacity: {
6266                         get: function( elem, computed ) {
6267                                 if ( computed ) {
6269                                         // We should always get a number back from opacity
6270                                         var ret = curCSS( elem, "opacity" );
6271                                         return ret === "" ? "1" : ret;
6272                                 }
6273                         }
6274                 }
6275         },
6277         // Don't automatically add "px" to these possibly-unitless properties
6278         cssNumber: {
6279                 "animationIterationCount": true,
6280                 "columnCount": true,
6281                 "fillOpacity": true,
6282                 "flexGrow": true,
6283                 "flexShrink": true,
6284                 "fontWeight": true,
6285                 "lineHeight": true,
6286                 "opacity": true,
6287                 "order": true,
6288                 "orphans": true,
6289                 "widows": true,
6290                 "zIndex": true,
6291                 "zoom": true
6292         },
6294         // Add in properties whose names you wish to fix before
6295         // setting or getting the value
6296         cssProps: {
6297                 "float": "cssFloat"
6298         },
6300         // Get and set the style property on a DOM Node
6301         style: function( elem, name, value, extra ) {
6303                 // Don't set styles on text and comment nodes
6304                 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
6305                         return;
6306                 }
6308                 // Make sure that we're working with the right name
6309                 var ret, type, hooks,
6310                         origName = jQuery.camelCase( name ),
6311                         style = elem.style;
6313                 name = jQuery.cssProps[ origName ] ||
6314                         ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
6316                 // Gets hook for the prefixed version, then unprefixed version
6317                 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6319                 // Check if we're setting a value
6320                 if ( value !== undefined ) {
6321                         type = typeof value;
6323                         // Convert "+=" or "-=" to relative numbers (#7345)
6324                         if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
6325                                 value = adjustCSS( elem, name, ret );
6327                                 // Fixes bug #9237
6328                                 type = "number";
6329                         }
6331                         // Make sure that null and NaN values aren't set (#7116)
6332                         if ( value == null || value !== value ) {
6333                                 return;
6334                         }
6336                         // If a number was passed in, add the unit (except for certain CSS properties)
6337                         if ( type === "number" ) {
6338                                 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
6339                         }
6341                         // background-* props affect original clone's values
6342                         if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
6343                                 style[ name ] = "inherit";
6344                         }
6346                         // If a hook was provided, use that value, otherwise just set the specified value
6347                         if ( !hooks || !( "set" in hooks ) ||
6348                                 ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
6350                                 style[ name ] = value;
6351                         }
6353                 } else {
6355                         // If a hook was provided get the non-computed value from there
6356                         if ( hooks && "get" in hooks &&
6357                                 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
6359                                 return ret;
6360                         }
6362                         // Otherwise just get the value from the style object
6363                         return style[ name ];
6364                 }
6365         },
6367         css: function( elem, name, extra, styles ) {
6368                 var val, num, hooks,
6369                         origName = jQuery.camelCase( name );
6371                 // Make sure that we're working with the right name
6372                 name = jQuery.cssProps[ origName ] ||
6373                         ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
6375                 // Try prefixed name followed by the unprefixed name
6376                 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6378                 // If a hook was provided get the computed value from there
6379                 if ( hooks && "get" in hooks ) {
6380                         val = hooks.get( elem, true, extra );
6381                 }
6383                 // Otherwise, if a way to get the computed value exists, use that
6384                 if ( val === undefined ) {
6385                         val = curCSS( elem, name, styles );
6386                 }
6388                 // Convert "normal" to computed value
6389                 if ( val === "normal" && name in cssNormalTransform ) {
6390                         val = cssNormalTransform[ name ];
6391                 }
6393                 // Make numeric if forced or a qualifier was provided and val looks numeric
6394                 if ( extra === "" || extra ) {
6395                         num = parseFloat( val );
6396                         return extra === true || isFinite( num ) ? num || 0 : val;
6397                 }
6398                 return val;
6399         }
6400 } );
6402 jQuery.each( [ "height", "width" ], function( i, name ) {
6403         jQuery.cssHooks[ name ] = {
6404                 get: function( elem, computed, extra ) {
6405                         if ( computed ) {
6407                                 // Certain elements can have dimension info if we invisibly show them
6408                                 // but it must have a current display style that would benefit
6409                                 return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
6411                                         // Support: Safari 8+
6412                                         // Table columns in Safari have non-zero offsetWidth & zero
6413                                         // getBoundingClientRect().width unless display is changed.
6414                                         // Support: IE <=11 only
6415                                         // Running getBoundingClientRect on a disconnected node
6416                                         // in IE throws an error.
6417                                         ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
6418                                                 swap( elem, cssShow, function() {
6419                                                         return getWidthOrHeight( elem, name, extra );
6420                                                 } ) :
6421                                                 getWidthOrHeight( elem, name, extra );
6422                         }
6423                 },
6425                 set: function( elem, value, extra ) {
6426                         var matches,
6427                                 styles = extra && getStyles( elem ),
6428                                 subtract = extra && augmentWidthOrHeight(
6429                                         elem,
6430                                         name,
6431                                         extra,
6432                                         jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
6433                                         styles
6434                                 );
6436                         // Convert to pixels if value adjustment is needed
6437                         if ( subtract && ( matches = rcssNum.exec( value ) ) &&
6438                                 ( matches[ 3 ] || "px" ) !== "px" ) {
6440                                 elem.style[ name ] = value;
6441                                 value = jQuery.css( elem, name );
6442                         }
6444                         return setPositiveNumber( elem, value, subtract );
6445                 }
6446         };
6447 } );
6449 jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
6450         function( elem, computed ) {
6451                 if ( computed ) {
6452                         return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
6453                                 elem.getBoundingClientRect().left -
6454                                         swap( elem, { marginLeft: 0 }, function() {
6455                                                 return elem.getBoundingClientRect().left;
6456                                         } )
6457                                 ) + "px";
6458                 }
6459         }
6462 // These hooks are used by animate to expand properties
6463 jQuery.each( {
6464         margin: "",
6465         padding: "",
6466         border: "Width"
6467 }, function( prefix, suffix ) {
6468         jQuery.cssHooks[ prefix + suffix ] = {
6469                 expand: function( value ) {
6470                         var i = 0,
6471                                 expanded = {},
6473                                 // Assumes a single number if not a string
6474                                 parts = typeof value === "string" ? value.split( " " ) : [ value ];
6476                         for ( ; i < 4; i++ ) {
6477                                 expanded[ prefix + cssExpand[ i ] + suffix ] =
6478                                         parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
6479                         }
6481                         return expanded;
6482                 }
6483         };
6485         if ( !rmargin.test( prefix ) ) {
6486                 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
6487         }
6488 } );
6490 jQuery.fn.extend( {
6491         css: function( name, value ) {
6492                 return access( this, function( elem, name, value ) {
6493                         var styles, len,
6494                                 map = {},
6495                                 i = 0;
6497                         if ( jQuery.isArray( name ) ) {
6498                                 styles = getStyles( elem );
6499                                 len = name.length;
6501                                 for ( ; i < len; i++ ) {
6502                                         map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
6503                                 }
6505                                 return map;
6506                         }
6508                         return value !== undefined ?
6509                                 jQuery.style( elem, name, value ) :
6510                                 jQuery.css( elem, name );
6511                 }, name, value, arguments.length > 1 );
6512         }
6513 } );
6516 // Based off of the plugin by Clint Helfers, with permission.
6517 // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
6518 jQuery.fn.delay = function( time, type ) {
6519         time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
6520         type = type || "fx";
6522         return this.queue( type, function( next, hooks ) {
6523                 var timeout = window.setTimeout( next, time );
6524                 hooks.stop = function() {
6525                         window.clearTimeout( timeout );
6526                 };
6527         } );
6531 ( function() {
6532         var input = document.createElement( "input" ),
6533                 select = document.createElement( "select" ),
6534                 opt = select.appendChild( document.createElement( "option" ) );
6536         input.type = "checkbox";
6538         // Support: Android <=4.3 only
6539         // Default value for a checkbox should be "on"
6540         support.checkOn = input.value !== "";
6542         // Support: IE <=11 only
6543         // Must access selectedIndex to make default options select
6544         support.optSelected = opt.selected;
6546         // Support: IE <=11 only
6547         // An input loses its value after becoming a radio
6548         input = document.createElement( "input" );
6549         input.value = "t";
6550         input.type = "radio";
6551         support.radioValue = input.value === "t";
6552 } )();
6555 var boolHook,
6556         attrHandle = jQuery.expr.attrHandle;
6558 jQuery.fn.extend( {
6559         attr: function( name, value ) {
6560                 return access( this, jQuery.attr, name, value, arguments.length > 1 );
6561         },
6563         removeAttr: function( name ) {
6564                 return this.each( function() {
6565                         jQuery.removeAttr( this, name );
6566                 } );
6567         }
6568 } );
6570 jQuery.extend( {
6571         attr: function( elem, name, value ) {
6572                 var ret, hooks,
6573                         nType = elem.nodeType;
6575                 // Don't get/set attributes on text, comment and attribute nodes
6576                 if ( nType === 3 || nType === 8 || nType === 2 ) {
6577                         return;
6578                 }
6580                 // Fallback to prop when attributes are not supported
6581                 if ( typeof elem.getAttribute === "undefined" ) {
6582                         return jQuery.prop( elem, name, value );
6583                 }
6585                 // Attribute hooks are determined by the lowercase version
6586                 // Grab necessary hook if one is defined
6587                 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
6588                         hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
6589                                 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
6590                 }
6592                 if ( value !== undefined ) {
6593                         if ( value === null ) {
6594                                 jQuery.removeAttr( elem, name );
6595                                 return;
6596                         }
6598                         if ( hooks && "set" in hooks &&
6599                                 ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
6600                                 return ret;
6601                         }
6603                         elem.setAttribute( name, value + "" );
6604                         return value;
6605                 }
6607                 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
6608                         return ret;
6609                 }
6611                 ret = jQuery.find.attr( elem, name );
6613                 // Non-existent attributes return null, we normalize to undefined
6614                 return ret == null ? undefined : ret;
6615         },
6617         attrHooks: {
6618                 type: {
6619                         set: function( elem, value ) {
6620                                 if ( !support.radioValue && value === "radio" &&
6621                                         jQuery.nodeName( elem, "input" ) ) {
6622                                         var val = elem.value;
6623                                         elem.setAttribute( "type", value );
6624                                         if ( val ) {
6625                                                 elem.value = val;
6626                                         }
6627                                         return value;
6628                                 }
6629                         }
6630                 }
6631         },
6633         removeAttr: function( elem, value ) {
6634                 var name,
6635                         i = 0,
6636                         attrNames = value && value.match( rnotwhite );
6638                 if ( attrNames && elem.nodeType === 1 ) {
6639                         while ( ( name = attrNames[ i++ ] ) ) {
6640                                 elem.removeAttribute( name );
6641                         }
6642                 }
6643         }
6644 } );
6646 // Hooks for boolean attributes
6647 boolHook = {
6648         set: function( elem, value, name ) {
6649                 if ( value === false ) {
6651                         // Remove boolean attributes when set to false
6652                         jQuery.removeAttr( elem, name );
6653                 } else {
6654                         elem.setAttribute( name, name );
6655                 }
6656                 return name;
6657         }
6660 jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
6661         var getter = attrHandle[ name ] || jQuery.find.attr;
6663         attrHandle[ name ] = function( elem, name, isXML ) {
6664                 var ret, handle,
6665                         lowercaseName = name.toLowerCase();
6667                 if ( !isXML ) {
6669                         // Avoid an infinite loop by temporarily removing this function from the getter
6670                         handle = attrHandle[ lowercaseName ];
6671                         attrHandle[ lowercaseName ] = ret;
6672                         ret = getter( elem, name, isXML ) != null ?
6673                                 lowercaseName :
6674                                 null;
6675                         attrHandle[ lowercaseName ] = handle;
6676                 }
6677                 return ret;
6678         };
6679 } );
6684 var rfocusable = /^(?:input|select|textarea|button)$/i,
6685         rclickable = /^(?:a|area)$/i;
6687 jQuery.fn.extend( {
6688         prop: function( name, value ) {
6689                 return access( this, jQuery.prop, name, value, arguments.length > 1 );
6690         },
6692         removeProp: function( name ) {
6693                 return this.each( function() {
6694                         delete this[ jQuery.propFix[ name ] || name ];
6695                 } );
6696         }
6697 } );
6699 jQuery.extend( {
6700         prop: function( elem, name, value ) {
6701                 var ret, hooks,
6702                         nType = elem.nodeType;
6704                 // Don't get/set properties on text, comment and attribute nodes
6705                 if ( nType === 3 || nType === 8 || nType === 2 ) {
6706                         return;
6707                 }
6709                 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
6711                         // Fix name and attach hooks
6712                         name = jQuery.propFix[ name ] || name;
6713                         hooks = jQuery.propHooks[ name ];
6714                 }
6716                 if ( value !== undefined ) {
6717                         if ( hooks && "set" in hooks &&
6718                                 ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
6719                                 return ret;
6720                         }
6722                         return ( elem[ name ] = value );
6723                 }
6725                 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
6726                         return ret;
6727                 }
6729                 return elem[ name ];
6730         },
6732         propHooks: {
6733                 tabIndex: {
6734                         get: function( elem ) {
6736                                 // Support: IE <=9 - 11 only
6737                                 // elem.tabIndex doesn't always return the
6738                                 // correct value when it hasn't been explicitly set
6739                                 // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
6740                                 // Use proper attribute retrieval(#12072)
6741                                 var tabindex = jQuery.find.attr( elem, "tabindex" );
6743                                 return tabindex ?
6744                                         parseInt( tabindex, 10 ) :
6745                                         rfocusable.test( elem.nodeName ) ||
6746                                                 rclickable.test( elem.nodeName ) && elem.href ?
6747                                                         0 :
6748                                                         -1;
6749                         }
6750                 }
6751         },
6753         propFix: {
6754                 "for": "htmlFor",
6755                 "class": "className"
6756         }
6757 } );
6759 // Support: IE <=11 only
6760 // Accessing the selectedIndex property
6761 // forces the browser to respect setting selected
6762 // on the option
6763 // The getter ensures a default option is selected
6764 // when in an optgroup
6765 if ( !support.optSelected ) {
6766         jQuery.propHooks.selected = {
6767                 get: function( elem ) {
6768                         var parent = elem.parentNode;
6769                         if ( parent && parent.parentNode ) {
6770                                 parent.parentNode.selectedIndex;
6771                         }
6772                         return null;
6773                 },
6774                 set: function( elem ) {
6775                         var parent = elem.parentNode;
6776                         if ( parent ) {
6777                                 parent.selectedIndex;
6779                                 if ( parent.parentNode ) {
6780                                         parent.parentNode.selectedIndex;
6781                                 }
6782                         }
6783                 }
6784         };
6787 jQuery.each( [
6788         "tabIndex",
6789         "readOnly",
6790         "maxLength",
6791         "cellSpacing",
6792         "cellPadding",
6793         "rowSpan",
6794         "colSpan",
6795         "useMap",
6796         "frameBorder",
6797         "contentEditable"
6798 ], function() {
6799         jQuery.propFix[ this.toLowerCase() ] = this;
6800 } );
6805 var rclass = /[\t\r\n\f]/g;
6807 function getClass( elem ) {
6808         return elem.getAttribute && elem.getAttribute( "class" ) || "";
6811 jQuery.fn.extend( {
6812         addClass: function( value ) {
6813                 var classes, elem, cur, curValue, clazz, j, finalValue,
6814                         i = 0;
6816                 if ( jQuery.isFunction( value ) ) {
6817                         return this.each( function( j ) {
6818                                 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
6819                         } );
6820                 }
6822                 if ( typeof value === "string" && value ) {
6823                         classes = value.match( rnotwhite ) || [];
6825                         while ( ( elem = this[ i++ ] ) ) {
6826                                 curValue = getClass( elem );
6827                                 cur = elem.nodeType === 1 &&
6828                                         ( " " + curValue + " " ).replace( rclass, " " );
6830                                 if ( cur ) {
6831                                         j = 0;
6832                                         while ( ( clazz = classes[ j++ ] ) ) {
6833                                                 if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
6834                                                         cur += clazz + " ";
6835                                                 }
6836                                         }
6838                                         // Only assign if different to avoid unneeded rendering.
6839                                         finalValue = jQuery.trim( cur );
6840                                         if ( curValue !== finalValue ) {
6841                                                 elem.setAttribute( "class", finalValue );
6842                                         }
6843                                 }
6844                         }
6845                 }
6847                 return this;
6848         },
6850         removeClass: function( value ) {
6851                 var classes, elem, cur, curValue, clazz, j, finalValue,
6852                         i = 0;
6854                 if ( jQuery.isFunction( value ) ) {
6855                         return this.each( function( j ) {
6856                                 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
6857                         } );
6858                 }
6860                 if ( !arguments.length ) {
6861                         return this.attr( "class", "" );
6862                 }
6864                 if ( typeof value === "string" && value ) {
6865                         classes = value.match( rnotwhite ) || [];
6867                         while ( ( elem = this[ i++ ] ) ) {
6868                                 curValue = getClass( elem );
6870                                 // This expression is here for better compressibility (see addClass)
6871                                 cur = elem.nodeType === 1 &&
6872                                         ( " " + curValue + " " ).replace( rclass, " " );
6874                                 if ( cur ) {
6875                                         j = 0;
6876                                         while ( ( clazz = classes[ j++ ] ) ) {
6878                                                 // Remove *all* instances
6879                                                 while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
6880                                                         cur = cur.replace( " " + clazz + " ", " " );
6881                                                 }
6882                                         }
6884                                         // Only assign if different to avoid unneeded rendering.
6885                                         finalValue = jQuery.trim( cur );
6886                                         if ( curValue !== finalValue ) {
6887                                                 elem.setAttribute( "class", finalValue );
6888                                         }
6889                                 }
6890                         }
6891                 }
6893                 return this;
6894         },
6896         toggleClass: function( value, stateVal ) {
6897                 var type = typeof value;
6899                 if ( typeof stateVal === "boolean" && type === "string" ) {
6900                         return stateVal ? this.addClass( value ) : this.removeClass( value );
6901                 }
6903                 if ( jQuery.isFunction( value ) ) {
6904                         return this.each( function( i ) {
6905                                 jQuery( this ).toggleClass(
6906                                         value.call( this, i, getClass( this ), stateVal ),
6907                                         stateVal
6908                                 );
6909                         } );
6910                 }
6912                 return this.each( function() {
6913                         var className, i, self, classNames;
6915                         if ( type === "string" ) {
6917                                 // Toggle individual class names
6918                                 i = 0;
6919                                 self = jQuery( this );
6920                                 classNames = value.match( rnotwhite ) || [];
6922                                 while ( ( className = classNames[ i++ ] ) ) {
6924                                         // Check each className given, space separated list
6925                                         if ( self.hasClass( className ) ) {
6926                                                 self.removeClass( className );
6927                                         } else {
6928                                                 self.addClass( className );
6929                                         }
6930                                 }
6932                         // Toggle whole class name
6933                         } else if ( value === undefined || type === "boolean" ) {
6934                                 className = getClass( this );
6935                                 if ( className ) {
6937                                         // Store className if set
6938                                         dataPriv.set( this, "__className__", className );
6939                                 }
6941                                 // If the element has a class name or if we're passed `false`,
6942                                 // then remove the whole classname (if there was one, the above saved it).
6943                                 // Otherwise bring back whatever was previously saved (if anything),
6944                                 // falling back to the empty string if nothing was stored.
6945                                 if ( this.setAttribute ) {
6946                                         this.setAttribute( "class",
6947                                                 className || value === false ?
6948                                                 "" :
6949                                                 dataPriv.get( this, "__className__" ) || ""
6950                                         );
6951                                 }
6952                         }
6953                 } );
6954         },
6956         hasClass: function( selector ) {
6957                 var className, elem,
6958                         i = 0;
6960                 className = " " + selector + " ";
6961                 while ( ( elem = this[ i++ ] ) ) {
6962                         if ( elem.nodeType === 1 &&
6963                                 ( " " + getClass( elem ) + " " ).replace( rclass, " " )
6964                                         .indexOf( className ) > -1
6965                         ) {
6966                                 return true;
6967                         }
6968                 }
6970                 return false;
6971         }
6972 } );
6977 var rreturn = /\r/g,
6978         rspaces = /[\x20\t\r\n\f]+/g;
6980 jQuery.fn.extend( {
6981         val: function( value ) {
6982                 var hooks, ret, isFunction,
6983                         elem = this[ 0 ];
6985                 if ( !arguments.length ) {
6986                         if ( elem ) {
6987                                 hooks = jQuery.valHooks[ elem.type ] ||
6988                                         jQuery.valHooks[ elem.nodeName.toLowerCase() ];
6990                                 if ( hooks &&
6991                                         "get" in hooks &&
6992                                         ( ret = hooks.get( elem, "value" ) ) !== undefined
6993                                 ) {
6994                                         return ret;
6995                                 }
6997                                 ret = elem.value;
6999                                 return typeof ret === "string" ?
7001                                         // Handle most common string cases
7002                                         ret.replace( rreturn, "" ) :
7004                                         // Handle cases where value is null/undef or number
7005                                         ret == null ? "" : ret;
7006                         }
7008                         return;
7009                 }
7011                 isFunction = jQuery.isFunction( value );
7013                 return this.each( function( i ) {
7014                         var val;
7016                         if ( this.nodeType !== 1 ) {
7017                                 return;
7018                         }
7020                         if ( isFunction ) {
7021                                 val = value.call( this, i, jQuery( this ).val() );
7022                         } else {
7023                                 val = value;
7024                         }
7026                         // Treat null/undefined as ""; convert numbers to string
7027                         if ( val == null ) {
7028                                 val = "";
7030                         } else if ( typeof val === "number" ) {
7031                                 val += "";
7033                         } else if ( jQuery.isArray( val ) ) {
7034                                 val = jQuery.map( val, function( value ) {
7035                                         return value == null ? "" : value + "";
7036                                 } );
7037                         }
7039                         hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
7041                         // If set returns undefined, fall back to normal setting
7042                         if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
7043                                 this.value = val;
7044                         }
7045                 } );
7046         }
7047 } );
7049 jQuery.extend( {
7050         valHooks: {
7051                 option: {
7052                         get: function( elem ) {
7054                                 var val = jQuery.find.attr( elem, "value" );
7055                                 return val != null ?
7056                                         val :
7058                                         // Support: IE <=10 - 11 only
7059                                         // option.text throws exceptions (#14686, #14858)
7060                                         // Strip and collapse whitespace
7061                                         // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
7062                                         jQuery.trim( jQuery.text( elem ) ).replace( rspaces, " " );
7063                         }
7064                 },
7065                 select: {
7066                         get: function( elem ) {
7067                                 var value, option,
7068                                         options = elem.options,
7069                                         index = elem.selectedIndex,
7070                                         one = elem.type === "select-one",
7071                                         values = one ? null : [],
7072                                         max = one ? index + 1 : options.length,
7073                                         i = index < 0 ?
7074                                                 max :
7075                                                 one ? index : 0;
7077                                 // Loop through all the selected options
7078                                 for ( ; i < max; i++ ) {
7079                                         option = options[ i ];
7081                                         // Support: IE <=9 only
7082                                         // IE8-9 doesn't update selected after form reset (#2551)
7083                                         if ( ( option.selected || i === index ) &&
7085                                                         // Don't return options that are disabled or in a disabled optgroup
7086                                                         !option.disabled &&
7087                                                         ( !option.parentNode.disabled ||
7088                                                                 !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
7090                                                 // Get the specific value for the option
7091                                                 value = jQuery( option ).val();
7093                                                 // We don't need an array for one selects
7094                                                 if ( one ) {
7095                                                         return value;
7096                                                 }
7098                                                 // Multi-Selects return an array
7099                                                 values.push( value );
7100                                         }
7101                                 }
7103                                 return values;
7104                         },
7106                         set: function( elem, value ) {
7107                                 var optionSet, option,
7108                                         options = elem.options,
7109                                         values = jQuery.makeArray( value ),
7110                                         i = options.length;
7112                                 while ( i-- ) {
7113                                         option = options[ i ];
7115                                         /* eslint-disable no-cond-assign */
7117                                         if ( option.selected =
7118                                                 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
7119                                         ) {
7120                                                 optionSet = true;
7121                                         }
7123                                         /* eslint-enable no-cond-assign */
7124                                 }
7126                                 // Force browsers to behave consistently when non-matching value is set
7127                                 if ( !optionSet ) {
7128                                         elem.selectedIndex = -1;
7129                                 }
7130                                 return values;
7131                         }
7132                 }
7133         }
7134 } );
7136 // Radios and checkboxes getter/setter
7137 jQuery.each( [ "radio", "checkbox" ], function() {
7138         jQuery.valHooks[ this ] = {
7139                 set: function( elem, value ) {
7140                         if ( jQuery.isArray( value ) ) {
7141                                 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
7142                         }
7143                 }
7144         };
7145         if ( !support.checkOn ) {
7146                 jQuery.valHooks[ this ].get = function( elem ) {
7147                         return elem.getAttribute( "value" ) === null ? "on" : elem.value;
7148                 };
7149         }
7150 } );
7155 // Return jQuery for attributes-only inclusion
7158 var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/;
7160 jQuery.extend( jQuery.event, {
7162         trigger: function( event, data, elem, onlyHandlers ) {
7164                 var i, cur, tmp, bubbleType, ontype, handle, special,
7165                         eventPath = [ elem || document ],
7166                         type = hasOwn.call( event, "type" ) ? event.type : event,
7167                         namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
7169                 cur = tmp = elem = elem || document;
7171                 // Don't do events on text and comment nodes
7172                 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
7173                         return;
7174                 }
7176                 // focus/blur morphs to focusin/out; ensure we're not firing them right now
7177                 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
7178                         return;
7179                 }
7181                 if ( type.indexOf( "." ) > -1 ) {
7183                         // Namespaced trigger; create a regexp to match event type in handle()
7184                         namespaces = type.split( "." );
7185                         type = namespaces.shift();
7186                         namespaces.sort();
7187                 }
7188                 ontype = type.indexOf( ":" ) < 0 && "on" + type;
7190                 // Caller can pass in a jQuery.Event object, Object, or just an event type string
7191                 event = event[ jQuery.expando ] ?
7192                         event :
7193                         new jQuery.Event( type, typeof event === "object" && event );
7195                 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
7196                 event.isTrigger = onlyHandlers ? 2 : 3;
7197                 event.namespace = namespaces.join( "." );
7198                 event.rnamespace = event.namespace ?
7199                         new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
7200                         null;
7202                 // Clean up the event in case it is being reused
7203                 event.result = undefined;
7204                 if ( !event.target ) {
7205                         event.target = elem;
7206                 }
7208                 // Clone any incoming data and prepend the event, creating the handler arg list
7209                 data = data == null ?
7210                         [ event ] :
7211                         jQuery.makeArray( data, [ event ] );
7213                 // Allow special events to draw outside the lines
7214                 special = jQuery.event.special[ type ] || {};
7215                 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
7216                         return;
7217                 }
7219                 // Determine event propagation path in advance, per W3C events spec (#9951)
7220                 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
7221                 if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
7223                         bubbleType = special.delegateType || type;
7224                         if ( !rfocusMorph.test( bubbleType + type ) ) {
7225                                 cur = cur.parentNode;
7226                         }
7227                         for ( ; cur; cur = cur.parentNode ) {
7228                                 eventPath.push( cur );
7229                                 tmp = cur;
7230                         }
7232                         // Only add window if we got to document (e.g., not plain obj or detached DOM)
7233                         if ( tmp === ( elem.ownerDocument || document ) ) {
7234                                 eventPath.push( tmp.defaultView || tmp.parentWindow || window );
7235                         }
7236                 }
7238                 // Fire handlers on the event path
7239                 i = 0;
7240                 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
7242                         event.type = i > 1 ?
7243                                 bubbleType :
7244                                 special.bindType || type;
7246                         // jQuery handler
7247                         handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
7248                                 dataPriv.get( cur, "handle" );
7249                         if ( handle ) {
7250                                 handle.apply( cur, data );
7251                         }
7253                         // Native handler
7254                         handle = ontype && cur[ ontype ];
7255                         if ( handle && handle.apply && acceptData( cur ) ) {
7256                                 event.result = handle.apply( cur, data );
7257                                 if ( event.result === false ) {
7258                                         event.preventDefault();
7259                                 }
7260                         }
7261                 }
7262                 event.type = type;
7264                 // If nobody prevented the default action, do it now
7265                 if ( !onlyHandlers && !event.isDefaultPrevented() ) {
7267                         if ( ( !special._default ||
7268                                 special._default.apply( eventPath.pop(), data ) === false ) &&
7269                                 acceptData( elem ) ) {
7271                                 // Call a native DOM method on the target with the same name as the event.
7272                                 // Don't do default actions on window, that's where global variables be (#6170)
7273                                 if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
7275                                         // Don't re-trigger an onFOO event when we call its FOO() method
7276                                         tmp = elem[ ontype ];
7278                                         if ( tmp ) {
7279                                                 elem[ ontype ] = null;
7280                                         }
7282                                         // Prevent re-triggering of the same event, since we already bubbled it above
7283                                         jQuery.event.triggered = type;
7284                                         elem[ type ]();
7285                                         jQuery.event.triggered = undefined;
7287                                         if ( tmp ) {
7288                                                 elem[ ontype ] = tmp;
7289                                         }
7290                                 }
7291                         }
7292                 }
7294                 return event.result;
7295         },
7297         // Piggyback on a donor event to simulate a different one
7298         // Used only for `focus(in | out)` events
7299         simulate: function( type, elem, event ) {
7300                 var e = jQuery.extend(
7301                         new jQuery.Event(),
7302                         event,
7303                         {
7304                                 type: type,
7305                                 isSimulated: true
7306                         }
7307                 );
7309                 jQuery.event.trigger( e, null, elem );
7310         }
7312 } );
7314 jQuery.fn.extend( {
7316         trigger: function( type, data ) {
7317                 return this.each( function() {
7318                         jQuery.event.trigger( type, data, this );
7319                 } );
7320         },
7321         triggerHandler: function( type, data ) {
7322                 var elem = this[ 0 ];
7323                 if ( elem ) {
7324                         return jQuery.event.trigger( type, data, elem, true );
7325                 }
7326         }
7327 } );
7330 jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
7331         "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
7332         "change select submit keydown keypress keyup contextmenu" ).split( " " ),
7333         function( i, name ) {
7335         // Handle event binding
7336         jQuery.fn[ name ] = function( data, fn ) {
7337                 return arguments.length > 0 ?
7338                         this.on( name, null, data, fn ) :
7339                         this.trigger( name );
7340         };
7341 } );
7343 jQuery.fn.extend( {
7344         hover: function( fnOver, fnOut ) {
7345                 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
7346         }
7347 } );
7352 support.focusin = "onfocusin" in window;
7355 // Support: Firefox <=44
7356 // Firefox doesn't have focus(in | out) events
7357 // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
7359 // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
7360 // focus(in | out) events fire after focus & blur events,
7361 // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
7362 // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
7363 if ( !support.focusin ) {
7364         jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
7366                 // Attach a single capturing handler on the document while someone wants focusin/focusout
7367                 var handler = function( event ) {
7368                         jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
7369                 };
7371                 jQuery.event.special[ fix ] = {
7372                         setup: function() {
7373                                 var doc = this.ownerDocument || this,
7374                                         attaches = dataPriv.access( doc, fix );
7376                                 if ( !attaches ) {
7377                                         doc.addEventListener( orig, handler, true );
7378                                 }
7379                                 dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
7380                         },
7381                         teardown: function() {
7382                                 var doc = this.ownerDocument || this,
7383                                         attaches = dataPriv.access( doc, fix ) - 1;
7385                                 if ( !attaches ) {
7386                                         doc.removeEventListener( orig, handler, true );
7387                                         dataPriv.remove( doc, fix );
7389                                 } else {
7390                                         dataPriv.access( doc, fix, attaches );
7391                                 }
7392                         }
7393                 };
7394         } );
7399         rbracket = /\[\]$/,
7400         rCRLF = /\r?\n/g,
7401         rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
7402         rsubmittable = /^(?:input|select|textarea|keygen)/i;
7404 function buildParams( prefix, obj, traditional, add ) {
7405         var name;
7407         if ( jQuery.isArray( obj ) ) {
7409                 // Serialize array item.
7410                 jQuery.each( obj, function( i, v ) {
7411                         if ( traditional || rbracket.test( prefix ) ) {
7413                                 // Treat each array item as a scalar.
7414                                 add( prefix, v );
7416                         } else {
7418                                 // Item is non-scalar (array or object), encode its numeric index.
7419                                 buildParams(
7420                                         prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
7421                                         v,
7422                                         traditional,
7423                                         add
7424                                 );
7425                         }
7426                 } );
7428         } else if ( !traditional && jQuery.type( obj ) === "object" ) {
7430                 // Serialize object item.
7431                 for ( name in obj ) {
7432                         buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
7433                 }
7435         } else {
7437                 // Serialize scalar item.
7438                 add( prefix, obj );
7439         }
7442 // Serialize an array of form elements or a set of
7443 // key/values into a query string
7444 jQuery.param = function( a, traditional ) {
7445         var prefix,
7446                 s = [],
7447                 add = function( key, valueOrFunction ) {
7449                         // If value is a function, invoke it and use its return value
7450                         var value = jQuery.isFunction( valueOrFunction ) ?
7451                                 valueOrFunction() :
7452                                 valueOrFunction;
7454                         s[ s.length ] = encodeURIComponent( key ) + "=" +
7455                                 encodeURIComponent( value == null ? "" : value );
7456                 };
7458         // If an array was passed in, assume that it is an array of form elements.
7459         if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
7461                 // Serialize the form elements
7462                 jQuery.each( a, function() {
7463                         add( this.name, this.value );
7464                 } );
7466         } else {
7468                 // If traditional, encode the "old" way (the way 1.3.2 or older
7469                 // did it), otherwise encode params recursively.
7470                 for ( prefix in a ) {
7471                         buildParams( prefix, a[ prefix ], traditional, add );
7472                 }
7473         }
7475         // Return the resulting serialization
7476         return s.join( "&" );
7479 jQuery.fn.extend( {
7480         serialize: function() {
7481                 return jQuery.param( this.serializeArray() );
7482         },
7483         serializeArray: function() {
7484                 return this.map( function() {
7486                         // Can add propHook for "elements" to filter or add form elements
7487                         var elements = jQuery.prop( this, "elements" );
7488                         return elements ? jQuery.makeArray( elements ) : this;
7489                 } )
7490                 .filter( function() {
7491                         var type = this.type;
7493                         // Use .is( ":disabled" ) so that fieldset[disabled] works
7494                         return this.name && !jQuery( this ).is( ":disabled" ) &&
7495                                 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
7496                                 ( this.checked || !rcheckableType.test( type ) );
7497                 } )
7498                 .map( function( i, elem ) {
7499                         var val = jQuery( this ).val();
7501                         return val == null ?
7502                                 null :
7503                                 jQuery.isArray( val ) ?
7504                                         jQuery.map( val, function( val ) {
7505                                                 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
7506                                         } ) :
7507                                         { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
7508                 } ).get();
7509         }
7510 } );
7513 jQuery.fn.extend( {
7514         wrapAll: function( html ) {
7515                 var wrap;
7517                 if ( this[ 0 ] ) {
7518                         if ( jQuery.isFunction( html ) ) {
7519                                 html = html.call( this[ 0 ] );
7520                         }
7522                         // The elements to wrap the target around
7523                         wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
7525                         if ( this[ 0 ].parentNode ) {
7526                                 wrap.insertBefore( this[ 0 ] );
7527                         }
7529                         wrap.map( function() {
7530                                 var elem = this;
7532                                 while ( elem.firstElementChild ) {
7533                                         elem = elem.firstElementChild;
7534                                 }
7536                                 return elem;
7537                         } ).append( this );
7538                 }
7540                 return this;
7541         },
7543         wrapInner: function( html ) {
7544                 if ( jQuery.isFunction( html ) ) {
7545                         return this.each( function( i ) {
7546                                 jQuery( this ).wrapInner( html.call( this, i ) );
7547                         } );
7548                 }
7550                 return this.each( function() {
7551                         var self = jQuery( this ),
7552                                 contents = self.contents();
7554                         if ( contents.length ) {
7555                                 contents.wrapAll( html );
7557                         } else {
7558                                 self.append( html );
7559                         }
7560                 } );
7561         },
7563         wrap: function( html ) {
7564                 var isFunction = jQuery.isFunction( html );
7566                 return this.each( function( i ) {
7567                         jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );
7568                 } );
7569         },
7571         unwrap: function( selector ) {
7572                 this.parent( selector ).not( "body" ).each( function() {
7573                         jQuery( this ).replaceWith( this.childNodes );
7574                 } );
7575                 return this;
7576         }
7577 } );
7580 jQuery.expr.pseudos.hidden = function( elem ) {
7581         return !jQuery.expr.pseudos.visible( elem );
7583 jQuery.expr.pseudos.visible = function( elem ) {
7584         return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
7590 // Support: Safari 8 only
7591 // In Safari 8 documents created via document.implementation.createHTMLDocument
7592 // collapse sibling forms: the second one becomes a child of the first one.
7593 // Because of that, this security measure has to be disabled in Safari 8.
7594 // https://bugs.webkit.org/show_bug.cgi?id=137337
7595 support.createHTMLDocument = ( function() {
7596         var body = document.implementation.createHTMLDocument( "" ).body;
7597         body.innerHTML = "<form></form><form></form>";
7598         return body.childNodes.length === 2;
7599 } )();
7602 // Argument "data" should be string of html
7603 // context (optional): If specified, the fragment will be created in this context,
7604 // defaults to document
7605 // keepScripts (optional): If true, will include scripts passed in the html string
7606 jQuery.parseHTML = function( data, context, keepScripts ) {
7607         if ( typeof data !== "string" ) {
7608                 return [];
7609         }
7610         if ( typeof context === "boolean" ) {
7611                 keepScripts = context;
7612                 context = false;
7613         }
7615         var base, parsed, scripts;
7617         if ( !context ) {
7619                 // Stop scripts or inline event handlers from being executed immediately
7620                 // by using document.implementation
7621                 if ( support.createHTMLDocument ) {
7622                         context = document.implementation.createHTMLDocument( "" );
7624                         // Set the base href for the created document
7625                         // so any parsed elements with URLs
7626                         // are based on the document's URL (gh-2965)
7627                         base = context.createElement( "base" );
7628                         base.href = document.location.href;
7629                         context.head.appendChild( base );
7630                 } else {
7631                         context = document;
7632                 }
7633         }
7635         parsed = rsingleTag.exec( data );
7636         scripts = !keepScripts && [];
7638         // Single tag
7639         if ( parsed ) {
7640                 return [ context.createElement( parsed[ 1 ] ) ];
7641         }
7643         parsed = buildFragment( [ data ], context, scripts );
7645         if ( scripts && scripts.length ) {
7646                 jQuery( scripts ).remove();
7647         }
7649         return jQuery.merge( [], parsed.childNodes );
7654  * Gets a window from an element
7655  */
7656 function getWindow( elem ) {
7657         return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
7660 jQuery.offset = {
7661         setOffset: function( elem, options, i ) {
7662                 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
7663                         position = jQuery.css( elem, "position" ),
7664                         curElem = jQuery( elem ),
7665                         props = {};
7667                 // Set position first, in-case top/left are set even on static elem
7668                 if ( position === "static" ) {
7669                         elem.style.position = "relative";
7670                 }
7672                 curOffset = curElem.offset();
7673                 curCSSTop = jQuery.css( elem, "top" );
7674                 curCSSLeft = jQuery.css( elem, "left" );
7675                 calculatePosition = ( position === "absolute" || position === "fixed" ) &&
7676                         ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
7678                 // Need to be able to calculate position if either
7679                 // top or left is auto and position is either absolute or fixed
7680                 if ( calculatePosition ) {
7681                         curPosition = curElem.position();
7682                         curTop = curPosition.top;
7683                         curLeft = curPosition.left;
7685                 } else {
7686                         curTop = parseFloat( curCSSTop ) || 0;
7687                         curLeft = parseFloat( curCSSLeft ) || 0;
7688                 }
7690                 if ( jQuery.isFunction( options ) ) {
7692                         // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
7693                         options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
7694                 }
7696                 if ( options.top != null ) {
7697                         props.top = ( options.top - curOffset.top ) + curTop;
7698                 }
7699                 if ( options.left != null ) {
7700                         props.left = ( options.left - curOffset.left ) + curLeft;
7701                 }
7703                 if ( "using" in options ) {
7704                         options.using.call( elem, props );
7706                 } else {
7707                         curElem.css( props );
7708                 }
7709         }
7712 jQuery.fn.extend( {
7713         offset: function( options ) {
7715                 // Preserve chaining for setter
7716                 if ( arguments.length ) {
7717                         return options === undefined ?
7718                                 this :
7719                                 this.each( function( i ) {
7720                                         jQuery.offset.setOffset( this, options, i );
7721                                 } );
7722                 }
7724                 var docElem, win, rect, doc,
7725                         elem = this[ 0 ];
7727                 if ( !elem ) {
7728                         return;
7729                 }
7731                 // Support: IE <=11 only
7732                 // Running getBoundingClientRect on a
7733                 // disconnected node in IE throws an error
7734                 if ( !elem.getClientRects().length ) {
7735                         return { top: 0, left: 0 };
7736                 }
7738                 rect = elem.getBoundingClientRect();
7740                 // Make sure element is not hidden (display: none)
7741                 if ( rect.width || rect.height ) {
7742                         doc = elem.ownerDocument;
7743                         win = getWindow( doc );
7744                         docElem = doc.documentElement;
7746                         return {
7747                                 top: rect.top + win.pageYOffset - docElem.clientTop,
7748                                 left: rect.left + win.pageXOffset - docElem.clientLeft
7749                         };
7750                 }
7752                 // Return zeros for disconnected and hidden elements (gh-2310)
7753                 return rect;
7754         },
7756         position: function() {
7757                 if ( !this[ 0 ] ) {
7758                         return;
7759                 }
7761                 var offsetParent, offset,
7762                         elem = this[ 0 ],
7763                         parentOffset = { top: 0, left: 0 };
7765                 // Fixed elements are offset from window (parentOffset = {top:0, left: 0},
7766                 // because it is its only offset parent
7767                 if ( jQuery.css( elem, "position" ) === "fixed" ) {
7769                         // Assume getBoundingClientRect is there when computed position is fixed
7770                         offset = elem.getBoundingClientRect();
7772                 } else {
7774                         // Get *real* offsetParent
7775                         offsetParent = this.offsetParent();
7777                         // Get correct offsets
7778                         offset = this.offset();
7779                         if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
7780                                 parentOffset = offsetParent.offset();
7781                         }
7783                         // Add offsetParent borders
7784                         parentOffset = {
7785                                 top: parentOffset.top + jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ),
7786                                 left: parentOffset.left + jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true )
7787                         };
7788                 }
7790                 // Subtract parent offsets and element margins
7791                 return {
7792                         top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
7793                         left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
7794                 };
7795         },
7797         // This method will return documentElement in the following cases:
7798         // 1) For the element inside the iframe without offsetParent, this method will return
7799         //    documentElement of the parent window
7800         // 2) For the hidden or detached element
7801         // 3) For body or html element, i.e. in case of the html node - it will return itself
7802         //
7803         // but those exceptions were never presented as a real life use-cases
7804         // and might be considered as more preferable results.
7805         //
7806         // This logic, however, is not guaranteed and can change at any point in the future
7807         offsetParent: function() {
7808                 return this.map( function() {
7809                         var offsetParent = this.offsetParent;
7811                         while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
7812                                 offsetParent = offsetParent.offsetParent;
7813                         }
7815                         return offsetParent || documentElement;
7816                 } );
7817         }
7818 } );
7820 // Create scrollLeft and scrollTop methods
7821 jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
7822         var top = "pageYOffset" === prop;
7824         jQuery.fn[ method ] = function( val ) {
7825                 return access( this, function( elem, method, val ) {
7826                         var win = getWindow( elem );
7828                         if ( val === undefined ) {
7829                                 return win ? win[ prop ] : elem[ method ];
7830                         }
7832                         if ( win ) {
7833                                 win.scrollTo(
7834                                         !top ? val : win.pageXOffset,
7835                                         top ? val : win.pageYOffset
7836                                 );
7838                         } else {
7839                                 elem[ method ] = val;
7840                         }
7841                 }, method, val, arguments.length );
7842         };
7843 } );
7845 // Support: Safari <=7 - 9.1, Chrome <=37 - 49
7846 // Add the top/left cssHooks using jQuery.fn.position
7847 // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
7848 // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
7849 // getComputedStyle returns percent when specified for top/left/bottom/right;
7850 // rather than make the css module depend on the offset module, just check for it here
7851 jQuery.each( [ "top", "left" ], function( i, prop ) {
7852         jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
7853                 function( elem, computed ) {
7854                         if ( computed ) {
7855                                 computed = curCSS( elem, prop );
7857                                 // If curCSS returns percentage, fallback to offset
7858                                 return rnumnonpx.test( computed ) ?
7859                                         jQuery( elem ).position()[ prop ] + "px" :
7860                                         computed;
7861                         }
7862                 }
7863         );
7864 } );
7867 // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
7868 jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
7869         jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
7870                 function( defaultExtra, funcName ) {
7872                 // Margin is only for outerHeight, outerWidth
7873                 jQuery.fn[ funcName ] = function( margin, value ) {
7874                         var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
7875                                 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
7877                         return access( this, function( elem, type, value ) {
7878                                 var doc;
7880                                 if ( jQuery.isWindow( elem ) ) {
7882                                         // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
7883                                         return funcName.indexOf( "outer" ) === 0 ?
7884                                                 elem[ "inner" + name ] :
7885                                                 elem.document.documentElement[ "client" + name ];
7886                                 }
7888                                 // Get document width or height
7889                                 if ( elem.nodeType === 9 ) {
7890                                         doc = elem.documentElement;
7892                                         // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
7893                                         // whichever is greatest
7894                                         return Math.max(
7895                                                 elem.body[ "scroll" + name ], doc[ "scroll" + name ],
7896                                                 elem.body[ "offset" + name ], doc[ "offset" + name ],
7897                                                 doc[ "client" + name ]
7898                                         );
7899                                 }
7901                                 return value === undefined ?
7903                                         // Get width or height on the element, requesting but not forcing parseFloat
7904                                         jQuery.css( elem, type, extra ) :
7906                                         // Set width or height on the element
7907                                         jQuery.style( elem, type, value, extra );
7908                         }, type, chainable ? margin : undefined, chainable );
7909                 };
7910         } );
7911 } );
7914 // Register as a named AMD module, since jQuery can be concatenated with other
7915 // files that may use define, but not via a proper concatenation script that
7916 // understands anonymous AMD modules. A named AMD is safest and most robust
7917 // way to register. Lowercase jquery is used because AMD module names are
7918 // derived from file names, and jQuery is normally delivered in a lowercase
7919 // file name. Do this after creating the global so that if an AMD module wants
7920 // to call noConflict to hide this version of jQuery, it will work.
7922 // Note that for maximum portability, libraries that are not jQuery should
7923 // declare themselves as anonymous modules, and avoid setting a global if an
7924 // AMD loader is present. jQuery is a special case. For more information, see
7925 // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
7927 if ( typeof define === "function" && define.amd ) {
7928         define( "jquery", [], function() {
7929                 return jQuery;
7930         } );
7939         // Map over jQuery in case of overwrite
7940         _jQuery = window.jQuery,
7942         // Map over the $ in case of overwrite
7943         _$ = window.$;
7945 jQuery.noConflict = function( deep ) {
7946         if ( window.$ === jQuery ) {
7947                 window.$ = _$;
7948         }
7950         if ( deep && window.jQuery === jQuery ) {
7951                 window.jQuery = _jQuery;
7952         }
7954         return jQuery;
7957 // Expose jQuery and $ identifiers, even in AMD
7958 // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
7959 // and CommonJS for browser emulators (#13566)
7960 if ( !noGlobal ) {
7961         window.jQuery = window.$ = jQuery;
7965 return jQuery;
7966 } );