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